Just in case, here's how the package looks like in node_modules:
export { parseArgsStringToArgv as default, parseArgsStringToArgv };
declare function parseArgsStringToArgv(value: string, env?: string, file?: string): string[];
package.json:
{
"name": "string-argv",
"description": "string-argv parses a string into an argument array to mimic process.argv. This is useful when testing Command Line Utilities that you want to pass
"version": "0.3.1",
"contributors": [
{
"name": "Michael Ferris",
"email": "mike.ferri@hotmail.com"
}
],
"author": {
"name": "Anthony McCormick",
"email": "anthony.mccormick@gmail.com"
},
"license": "MIT",
"keywords": [
"argv"
],
"scripts": {
"build": "tsc -p .",
"prepublishOnly": "npm test",
"test": "npm run build & jasmine --config=test/config.json"
},
"main": "index",
"types": "index.d.ts",
"engines": {
"node": ">=0.6.19"
},
"bugs": {
"url": "https://github.com/mccormicka/string-argv/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/mccormicka/string-argv"
},
"homepage": "https://github.com/mccormicka/string-argv",
"readmeFilename": "README.md",
"dependencies": {},
"devDependencies": {
"jasmine": "^2.4.1",
"typescript": "^3.4.3"
}
}
Here's the error when JsModule is not present:
ReferenceError: parseArgsStringToArgv is not defined
at com.github.burrunan.ArgumentsTest.parse(cache-action-entrypoint/src/test/kotlin/com/github/burrunan/ArgumentsTest.kt:25)
at com.github.burrunan.ArgumentsTest.multilineWithQuotes(cache-action-entrypoint/src/test/kotlin/com/github/burrunan/ArgumentsTest.kt:45)
at <global>.fn(kotlin/gradle-cache-action-cache-action-entrypoint-test.js:48)
The generated JavaScript is
(function (_, Kotlin, $module$kotlin_test) {
'use strict';
var listOf = Kotlin.kotlin.collections.listOf_i5x0yv$;
var toList = Kotlin.kotlin.collections.toList_us0mfu$;
var assertEquals = $module$kotlin_test.kotlin.test.assertEquals_3m0tl5$;
var Kind_CLASS = Kotlin.Kind.CLASS;
var test = $module$kotlin_test.kotlin.test.test;
var suite = $module$kotlin_test.kotlin.test.suite;
function ArgumentsTest() {
}
ArgumentsTest.prototype.parse_0 = function (input, output) {
assertEquals(listOf(output.slice()), toList(parseArgsStringToArgv(input)), input);
};
ArgumentsTest.prototype.simple = function () {
this.parse_0('a b', ['a', 'b']);
this.parse_0("a 'b'", ['a', 'b']);
this.parse_0('a "b"', ['a', 'b']);
};
ArgumentsTest.prototype.multiline = function () {
this.parse_0('a\nb', ['a', 'b']);
this.parse_0('a\n b', ['a', 'b']);
this.parse_0('a\n b ', ['a', 'b']);
this.parse_0('a\n b \nc', ['a', 'b', 'c']);
};
ArgumentsTest.prototype.multilineWithQuotes = function () {
this.parse_0("'a\nb'", ['a\nb']);
this.parse_0("hello 'a\n b' world", ['hello', 'a\n b', 'world']);
this.parse_0('hello "a\n b" world', ['hello', 'a\n b', 'world']);
};
ArgumentsTest.$metadata$ = {
kind: Kind_CLASS,
simpleName: 'ArgumentsTest',
interfaces: []
};
var package$com = _.com || (_.com = {});
var package$github = package$com.github || (package$com.github = {});
var package$burrunan = package$github.burrunan || (package$github.burrunan = {});
package$burrunan.ArgumentsTest = ArgumentsTest;
suite('com.github.burrunan', false, function () {
suite('ArgumentsTest', false, function () {
test('simple', false, function () {
return (new ArgumentsTest()).simple();
});
test('multiline', false, function () {
return (new ArgumentsTest()).multiline();
});
test('multilineWithQuotes', false, function () {
return (new ArgumentsTest()).multilineWithQuotes();
});
});
});
Kotlin.defineModule('gradle-cache-action-cache-action-entrypoint-test', _);
return _;
}(module.exports, require('kotlin'), require('kotlin-test')));
Just in case, here's how the package looks like in
node_modules
:package.json
:Here's the error when
JsModule
is not present:The generated JavaScript is