install-module-linked-compat 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/bin/cli.js +2 -2
- package/dist/cjs/cli.js +7 -7
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/compat.d.cts +15 -1
- package/dist/cjs/compat.d.ts +15 -1
- package/dist/cjs/compat.js +141 -6
- package/dist/cjs/compat.js.map +1 -1
- package/dist/cjs/index.d.cts +5 -5
- package/dist/cjs/index.d.ts +5 -5
- package/dist/cjs/index.js +70 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/workers/spawn.d.cts +3 -0
- package/dist/cjs/workers/spawn.d.ts +3 -0
- package/dist/cjs/workers/spawn.js +24 -0
- package/dist/cjs/workers/spawn.js.map +1 -0
- package/dist/esm/cli.js +6 -6
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/compat.d.ts +15 -1
- package/dist/esm/compat.js +66 -2
- package/dist/esm/compat.js.map +1 -1
- package/dist/esm/index.d.ts +5 -5
- package/dist/esm/index.js +21 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/workers/spawn.d.ts +3 -0
- package/dist/esm/workers/spawn.js +6 -0
- package/dist/esm/workers/spawn.js.map +1 -0
- package/package.json +5 -6
- package/dist/cjs/constants.d.cts +0 -1
- package/dist/cjs/constants.d.ts +0 -1
- package/dist/cjs/constants.js +0 -19
- package/dist/cjs/constants.js.map +0 -1
- package/dist/cjs/lib/cache.d.cts +0 -2
- package/dist/cjs/lib/cache.d.ts +0 -2
- package/dist/cjs/lib/cache.js +0 -182
- package/dist/cjs/lib/cache.js.map +0 -1
- package/dist/cjs/lib/clear.d.cts +0 -2
- package/dist/cjs/lib/clear.d.ts +0 -2
- package/dist/cjs/lib/clear.js +0 -17
- package/dist/cjs/lib/clear.js.map +0 -1
- package/dist/cjs/lib/getSpecifier.d.cts +0 -2
- package/dist/cjs/lib/getSpecifier.d.ts +0 -2
- package/dist/cjs/lib/getSpecifier.js +0 -34
- package/dist/cjs/lib/getSpecifier.js.map +0 -1
- package/dist/cjs/lib/install.d.cts +0 -2
- package/dist/cjs/lib/install.d.ts +0 -2
- package/dist/cjs/lib/install.js +0 -69
- package/dist/cjs/lib/install.js.map +0 -1
- package/dist/cjs/lib/parseInstallString.d.cts +0 -4
- package/dist/cjs/lib/parseInstallString.d.ts +0 -4
- package/dist/cjs/lib/parseInstallString.js +0 -51
- package/dist/cjs/lib/parseInstallString.js.map +0 -1
- package/dist/cjs/lib/renameWithFallback.d.cts +0 -1
- package/dist/cjs/lib/renameWithFallback.d.ts +0 -1
- package/dist/cjs/lib/renameWithFallback.js +0 -32
- package/dist/cjs/lib/renameWithFallback.js.map +0 -1
- package/dist/cjs/types.d.cts +0 -9
- package/dist/cjs/types.d.ts +0 -9
- package/dist/cjs/types.js +0 -5
- package/dist/cjs/types.js.map +0 -1
- package/dist/cjs/workers/async.d.cts +0 -2
- package/dist/cjs/workers/async.d.ts +0 -2
- package/dist/cjs/workers/async.js +0 -108
- package/dist/cjs/workers/async.js.map +0 -1
- package/dist/cjs/workers/sync.d.cts +0 -1
- package/dist/cjs/workers/sync.d.ts +0 -1
- package/dist/cjs/workers/sync.js +0 -30
- package/dist/cjs/workers/sync.js.map +0 -1
- package/dist/esm/constants.d.ts +0 -1
- package/dist/esm/constants.js +0 -3
- package/dist/esm/constants.js.map +0 -1
- package/dist/esm/lib/cache.d.ts +0 -2
- package/dist/esm/lib/cache.js +0 -93
- package/dist/esm/lib/cache.js.map +0 -1
- package/dist/esm/lib/clear.d.ts +0 -2
- package/dist/esm/lib/clear.js +0 -6
- package/dist/esm/lib/clear.js.map +0 -1
- package/dist/esm/lib/getSpecifier.d.ts +0 -2
- package/dist/esm/lib/getSpecifier.js +0 -18
- package/dist/esm/lib/getSpecifier.js.map +0 -1
- package/dist/esm/lib/install.d.ts +0 -2
- package/dist/esm/lib/install.js +0 -23
- package/dist/esm/lib/install.js.map +0 -1
- package/dist/esm/lib/parseInstallString.d.ts +0 -4
- package/dist/esm/lib/parseInstallString.js +0 -14
- package/dist/esm/lib/parseInstallString.js.map +0 -1
- package/dist/esm/lib/renameWithFallback.d.ts +0 -1
- package/dist/esm/lib/renameWithFallback.js +0 -16
- package/dist/esm/lib/renameWithFallback.js.map +0 -1
- package/dist/esm/types.d.ts +0 -9
- package/dist/esm/types.js +0 -1
- package/dist/esm/types.js.map +0 -1
- package/dist/esm/workers/async.d.ts +0 -2
- package/dist/esm/workers/async.js +0 -50
- package/dist/esm/workers/async.js.map +0 -1
- package/dist/esm/workers/sync.d.ts +0 -1
- package/dist/esm/workers/sync.js +0 -14
- package/dist/esm/workers/sync.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Installs and symlinks a module into node_modules
|
|
4
4
|
|
|
5
|
+
This is the broad-Node version of install-module-linked (engines >= 0.8): it re-exports the identical API and injects shims only for the built-ins the running Node lacks. On Node >= 18 it is a pure pass-through to install-module-linked.
|
|
6
|
+
|
|
5
7
|
### Example 1
|
|
6
8
|
|
|
7
9
|
```typescript
|
package/bin/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// biome-ignore lint/security/noGlobalEval: dual esm and cjs
|
|
4
|
-
if (typeof require === 'undefined') eval("import('../dist/esm/cli.js').then((cli) => cli.default(process.argv.slice(2), 'iml')).catch((err) => { console.error(err); process.exit(-1); });");
|
|
5
|
-
else require('../dist/cjs/cli.js')(process.argv.slice(2), 'iml');
|
|
4
|
+
if (typeof require === 'undefined') eval("import('../dist/esm/cli.js').then((cli) => cli.default(process.argv.slice(2), 'iml-compat')).catch((err) => { console.error(err); process.exit(-1); });");
|
|
5
|
+
else require('../dist/cjs/cli.js')(process.argv.slice(2), 'iml-compat');
|
package/dist/cjs/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
|
14
14
|
var _getoptscompat = /*#__PURE__*/ _interop_require_default(require("getopts-compat"));
|
|
15
15
|
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
16
16
|
var _url = /*#__PURE__*/ _interop_require_default(require("url"));
|
|
17
|
-
var
|
|
17
|
+
var _indexts = require("./index.js");
|
|
18
18
|
function _interop_require_default(obj) {
|
|
19
19
|
return obj && obj.__esModule ? obj : {
|
|
20
20
|
default: obj
|
|
@@ -41,7 +41,7 @@ function printHelp(name) {
|
|
|
41
41
|
console.log(' -h, --help Print this help message');
|
|
42
42
|
}
|
|
43
43
|
var _default = function(argv, name) {
|
|
44
|
-
name = name || 'iml';
|
|
44
|
+
name = name || 'iml-compat';
|
|
45
45
|
var options = (0, _getoptscompat.default)(argv, {
|
|
46
46
|
alias: {
|
|
47
47
|
version: 'v',
|
|
@@ -65,18 +65,18 @@ var _default = function(argv, name) {
|
|
|
65
65
|
}
|
|
66
66
|
var args = options._;
|
|
67
67
|
if (!args.length) {
|
|
68
|
-
console.
|
|
69
|
-
console.
|
|
68
|
+
console.error("Missing command. Example usage: ".concat(name, " [command]"));
|
|
69
|
+
console.error('Run "'.concat(name, ' --help" for more information.'));
|
|
70
70
|
(0, _exitcompat.default)(ERROR_CODE);
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
if (args[0] === 'clear') {
|
|
74
|
-
(0,
|
|
74
|
+
(0, _indexts.clear)();
|
|
75
75
|
(0, _exitcompat.default)(0);
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
console.
|
|
79
|
-
console.
|
|
78
|
+
console.error("Unrecognized command: ".concat(args[0], ". Example usage: ").concat(name, " [command]"));
|
|
79
|
+
console.error('Run "'.concat(name, ' --help" for more information.'));
|
|
80
80
|
(0, _exitcompat.default)(ERROR_CODE);
|
|
81
81
|
};
|
|
82
82
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
package/dist/cjs/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/install-module-linked-compat/src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport exit from 'exit-compat';\nimport fs from 'fs';\nimport getopts from 'getopts-compat';\nimport path from 'path';\nimport url from 'url';\nimport clear from './
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/install-module-linked-compat/src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport exit from 'exit-compat';\nimport fs from 'fs';\nimport getopts from 'getopts-compat';\nimport path from 'path';\nimport url from 'url';\nimport { clear } from './index.ts';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\n\nconst ERROR_CODE = 7;\n\nfunction getVersion(): string {\n const packageJsonPath = path.join(__dirname, '..', '..', 'package.json');\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));\n return packageJson.version;\n}\n\nfunction printHelp(name: string): void {\n const version = getVersion();\n console.log(`${name} v${version}`);\n console.log('');\n console.log(`Usage: ${name} [options] [command]`);\n console.log('');\n console.log('Commands:');\n console.log(' clear Clear the module cache');\n console.log('');\n console.log('Options:');\n console.log(' -v, --version Print version number');\n console.log(' -h, --help Print this help message');\n}\n\nexport default (argv: string[], name?: string): void => {\n name = name || 'iml-compat';\n const options = getopts(argv, {\n alias: { version: 'v', help: 'h' },\n boolean: ['version', 'help'],\n stopEarly: true,\n });\n\n if (options.version) {\n console.log(getVersion());\n exit(0);\n return;\n }\n\n if (options.help) {\n printHelp(name);\n exit(0);\n return;\n }\n\n const args = options._;\n if (!args.length) {\n console.error(`Missing command. Example usage: ${name} [command]`);\n console.error(`Run \"${name} --help\" for more information.`);\n exit(ERROR_CODE);\n return;\n }\n\n if (args[0] === 'clear') {\n clear();\n exit(0);\n return;\n }\n\n console.error(`Unrecognized command: ${args[0]}. Example usage: ${name} [command]`);\n console.error(`Run \"${name} --help\" for more information.`);\n exit(ERROR_CODE);\n};\n"],"names":["__dirname","path","dirname","__filename","url","fileURLToPath","ERROR_CODE","getVersion","packageJsonPath","join","packageJson","JSON","parse","fs","readFileSync","version","printHelp","name","console","log","argv","options","getopts","alias","help","boolean","stopEarly","exit","args","_","length","error","clear"],"mappings":";;;;;+BAiCA;;;eAAA;;;iEA/BiB;yDACF;oEACK;2DACH;0DACD;uBACM;;;;;;AAEtB,IAAMA,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaC,YAAG,CAACC,aAAa,CAAC;AAElG,IAAMC,aAAa;AAEnB,SAASC;IACP,IAAMC,kBAAkBP,aAAI,CAACQ,IAAI,CAACT,WAAW,MAAM,MAAM;IACzD,IAAMU,cAAcC,KAAKC,KAAK,CAACC,WAAE,CAACC,YAAY,CAACN,iBAAiB;IAChE,OAAOE,YAAYK,OAAO;AAC5B;AAEA,SAASC,UAAUC,IAAY;IAC7B,IAAMF,UAAUR;IAChBW,QAAQC,GAAG,CAAC,AAAC,GAAWJ,OAATE,MAAK,MAAY,OAARF;IACxBG,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC,AAAC,UAAc,OAALF,MAAK;IAC3BC,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;AACd;IAEA,WAAe,SAACC,MAAgBH;IAC9BA,OAAOA,QAAQ;IACf,IAAMI,UAAUC,IAAAA,sBAAO,EAACF,MAAM;QAC5BG,OAAO;YAAER,SAAS;YAAKS,MAAM;QAAI;QACjCC,SAAS;YAAC;YAAW;SAAO;QAC5BC,WAAW;IACb;IAEA,IAAIL,QAAQN,OAAO,EAAE;QACnBG,QAAQC,GAAG,CAACZ;QACZoB,IAAAA,mBAAI,EAAC;QACL;IACF;IAEA,IAAIN,QAAQG,IAAI,EAAE;QAChBR,UAAUC;QACVU,IAAAA,mBAAI,EAAC;QACL;IACF;IAEA,IAAMC,OAAOP,QAAQQ,CAAC;IACtB,IAAI,CAACD,KAAKE,MAAM,EAAE;QAChBZ,QAAQa,KAAK,CAAC,AAAC,mCAAuC,OAALd,MAAK;QACtDC,QAAQa,KAAK,CAAC,AAAC,QAAY,OAALd,MAAK;QAC3BU,IAAAA,mBAAI,EAACrB;QACL;IACF;IAEA,IAAIsB,IAAI,CAAC,EAAE,KAAK,SAAS;QACvBI,IAAAA,cAAK;QACLL,IAAAA,mBAAI,EAAC;QACL;IACF;IAEAT,QAAQa,KAAK,CAAC,AAAC,yBAAmDd,OAA3BW,IAAI,CAAC,EAAE,EAAC,qBAAwB,OAALX,MAAK;IACvEC,QAAQa,KAAK,CAAC,AAAC,QAAY,OAALd,MAAK;IAC3BU,IAAAA,mBAAI,EAACrB;AACP"}
|
package/dist/cjs/compat.d.cts
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import type { InstallOptions } from 'install-module-linked';
|
|
2
|
+
export interface OverlayDetection {
|
|
3
|
+
major: number;
|
|
4
|
+
minor: number;
|
|
5
|
+
hasFetch: boolean;
|
|
6
|
+
hasRm: boolean;
|
|
7
|
+
hasMkdir: boolean;
|
|
8
|
+
hasHomedir: boolean;
|
|
9
|
+
hasExecFileSync: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function detect(): OverlayDetection;
|
|
12
|
+
export type Overlay = Partial<Pick<InstallOptions, 'spawn' | 'fetchText' | 'rm' | 'rmSync' | 'mkdir' | 'homedir' | 'syncExec' | 'workerModule'>>;
|
|
13
|
+
export declare function overlayFor(detection: OverlayDetection): Overlay;
|
|
14
|
+
declare const _default: Partial<Pick<InstallOptions, "spawn" | "fetchText" | "rm" | "rmSync" | "mkdir" | "homedir" | "syncExec" | "workerModule">>;
|
|
15
|
+
export default _default;
|
package/dist/cjs/compat.d.ts
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import type { InstallOptions } from 'install-module-linked';
|
|
2
|
+
export interface OverlayDetection {
|
|
3
|
+
major: number;
|
|
4
|
+
minor: number;
|
|
5
|
+
hasFetch: boolean;
|
|
6
|
+
hasRm: boolean;
|
|
7
|
+
hasMkdir: boolean;
|
|
8
|
+
hasHomedir: boolean;
|
|
9
|
+
hasExecFileSync: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function detect(): OverlayDetection;
|
|
12
|
+
export type Overlay = Partial<Pick<InstallOptions, 'spawn' | 'fetchText' | 'rm' | 'rmSync' | 'mkdir' | 'homedir' | 'syncExec' | 'workerModule'>>;
|
|
13
|
+
export declare function overlayFor(detection: OverlayDetection): Overlay;
|
|
14
|
+
declare const _default: Partial<Pick<InstallOptions, "spawn" | "fetchText" | "rm" | "rmSync" | "mkdir" | "homedir" | "syncExec" | "workerModule">>;
|
|
15
|
+
export default _default;
|
package/dist/cjs/compat.js
CHANGED
|
@@ -2,19 +2,154 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get default () {
|
|
13
|
+
return _default;
|
|
14
|
+
},
|
|
15
|
+
get detect () {
|
|
16
|
+
return detect;
|
|
17
|
+
},
|
|
18
|
+
get overlayFor () {
|
|
19
|
+
return overlayFor;
|
|
9
20
|
}
|
|
10
21
|
});
|
|
22
|
+
var _child_process = /*#__PURE__*/ _interop_require_default(require("child_process"));
|
|
23
|
+
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
24
|
+
var _fsremovecompat = require("fs-remove-compat");
|
|
25
|
+
var _getfilecompat = require("get-file-compat");
|
|
26
|
+
var _mkdirpclassic = /*#__PURE__*/ _interop_require_default(require("mkdirp-classic"));
|
|
27
|
+
var _module = /*#__PURE__*/ _interop_require_default(require("module"));
|
|
28
|
+
var _nodeversioncalllocal = require("node-version-call-local");
|
|
11
29
|
var _os = /*#__PURE__*/ _interop_require_default(require("os"));
|
|
30
|
+
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
31
|
+
var _url = /*#__PURE__*/ _interop_require_default(require("url"));
|
|
32
|
+
function _array_like_to_array(arr, len) {
|
|
33
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
34
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
35
|
+
return arr2;
|
|
36
|
+
}
|
|
37
|
+
function _array_with_holes(arr) {
|
|
38
|
+
if (Array.isArray(arr)) return arr;
|
|
39
|
+
}
|
|
12
40
|
function _interop_require_default(obj) {
|
|
13
41
|
return obj && obj.__esModule ? obj : {
|
|
14
42
|
default: obj
|
|
15
43
|
};
|
|
16
44
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
45
|
+
function _iterable_to_array_limit(arr, i) {
|
|
46
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
47
|
+
if (_i == null) return;
|
|
48
|
+
var _arr = [];
|
|
49
|
+
var _n = true;
|
|
50
|
+
var _d = false;
|
|
51
|
+
var _s, _e;
|
|
52
|
+
try {
|
|
53
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
54
|
+
_arr.push(_s.value);
|
|
55
|
+
if (i && _arr.length === i) break;
|
|
56
|
+
}
|
|
57
|
+
} catch (err) {
|
|
58
|
+
_d = true;
|
|
59
|
+
_e = err;
|
|
60
|
+
} finally{
|
|
61
|
+
try {
|
|
62
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
63
|
+
} finally{
|
|
64
|
+
if (_d) throw _e;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return _arr;
|
|
68
|
+
}
|
|
69
|
+
function _non_iterable_rest() {
|
|
70
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
71
|
+
}
|
|
72
|
+
function _sliced_to_array(arr, i) {
|
|
73
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
74
|
+
}
|
|
75
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
76
|
+
if (!o) return;
|
|
77
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
78
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
79
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
80
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
81
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
82
|
+
}
|
|
83
|
+
// Tier 2 deferral: these load only on the sync and pre-Node 4 paths.
|
|
84
|
+
var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
|
|
85
|
+
// Workers MUST always load from dist/cjs/ for old Node compatibility (works from both cjs and esm).
|
|
86
|
+
var __dirname = _path.default.dirname(typeof __filename !== 'undefined' ? __filename : _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()));
|
|
87
|
+
var cjsDir = typeof require === 'undefined' ? _path.default.join(__dirname, '..', 'cjs') : __dirname;
|
|
88
|
+
function detect() {
|
|
89
|
+
var _process_versions_node_split_map = _sliced_to_array(process.versions.node.split('.').map(Number), 2), major = _process_versions_node_split_map[0], minor = _process_versions_node_split_map[1];
|
|
90
|
+
return {
|
|
91
|
+
major: major,
|
|
92
|
+
minor: minor,
|
|
93
|
+
hasFetch: typeof fetch === 'function',
|
|
94
|
+
hasRm: typeof _fs.default.rm === 'function' && typeof _fs.default.rmSync === 'function',
|
|
95
|
+
hasMkdir: major > 10 || major === 10 && minor >= 12,
|
|
96
|
+
hasHomedir: typeof _os.default.homedir === 'function',
|
|
97
|
+
hasExecFileSync: typeof _child_process.default.execFileSync === 'function'
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function overlayFor(detection) {
|
|
101
|
+
var overlay = {};
|
|
102
|
+
if (detection.major === 0) {
|
|
103
|
+
// 0.x npm cannot install modern packages: delegate the spawn to a newer
|
|
104
|
+
// local node, which runs the worker (the proven 1.6.5 mechanism).
|
|
105
|
+
overlay.spawn = (0, _nodeversioncalllocal.bind)('>0.12', _path.default.join(cjsDir, 'workers', 'spawn.js'), {
|
|
106
|
+
callbacks: true
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (!detection.hasFetch) {
|
|
110
|
+
overlay.fetchText = function(u, callback) {
|
|
111
|
+
return (0, _getfilecompat.getContent)(u, 'utf8', function(err, res) {
|
|
112
|
+
return err ? callback(err) : callback(null, res === null || res === void 0 ? void 0 : res.content);
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
if (!detection.hasRm) {
|
|
117
|
+
overlay.rm = function(p, callback) {
|
|
118
|
+
return (0, _fsremovecompat.safeRm)(p, function(err) {
|
|
119
|
+
return callback(err !== null && err !== void 0 ? err : null);
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
overlay.rmSync = function(p) {
|
|
123
|
+
return (0, _fsremovecompat.safeRmSync)(p);
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
if (!detection.hasMkdir) {
|
|
127
|
+
overlay.mkdir = function(p, callback) {
|
|
128
|
+
return (0, _mkdirpclassic.default)(p, callback);
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
if (!detection.hasHomedir) {
|
|
132
|
+
overlay.homedir = function() {
|
|
133
|
+
return _require('homedir-polyfill')();
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
if (!detection.hasExecFileSync) {
|
|
137
|
+
overlay.syncExec = function(workerPath, data) {
|
|
138
|
+
var payload = JSON.parse(data);
|
|
139
|
+
return _require('function-exec-sync')({
|
|
140
|
+
callbacks: true
|
|
141
|
+
}, workerPath, payload.installString, payload.nodeModulesPath, {
|
|
142
|
+
cachePath: payload.cachePath,
|
|
143
|
+
workerModule: payload.workerModule
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
// The sync child is a fresh process on this same node: it needs every shim
|
|
148
|
+
// this node lacks, resolved from this module in its own process.
|
|
149
|
+
if (detection.major === 0 || !detection.hasFetch || !detection.hasRm || !detection.hasMkdir || !detection.hasHomedir) {
|
|
150
|
+
overlay.workerModule = _path.default.join(cjsDir, 'compat.js');
|
|
151
|
+
}
|
|
152
|
+
return overlay;
|
|
19
153
|
}
|
|
154
|
+
var _default = overlayFor(detect());
|
|
20
155
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
package/dist/cjs/compat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/install-module-linked-compat/src/compat.ts"],"sourcesContent":["import os from 'os';\n\nexport function
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/install-module-linked-compat/src/compat.ts"],"sourcesContent":["import childProcess from 'child_process';\nimport fs from 'fs';\nimport { safeRm, safeRmSync } from 'fs-remove-compat';\nimport { getContent } from 'get-file-compat';\nimport type { InstallOptions } from 'install-module-linked';\nimport mkdirp from 'mkdirp-classic';\nimport Module from 'module';\nimport { bind } from 'node-version-call-local';\nimport os from 'os';\nimport path from 'path';\nimport url from 'url';\n\n// Tier 2 deferral: these load only on the sync and pre-Node 4 paths.\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\n// Workers MUST always load from dist/cjs/ for old Node compatibility (works from both cjs and esm).\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst cjsDir = typeof require === 'undefined' ? path.join(__dirname, '..', 'cjs') : __dirname;\n\nexport interface OverlayDetection {\n major: number;\n minor: number;\n hasFetch: boolean;\n hasRm: boolean;\n hasMkdir: boolean;\n hasHomedir: boolean;\n hasExecFileSync: boolean;\n}\n\nexport function detect(): OverlayDetection {\n const [major, minor] = process.versions.node.split('.').map(Number) as [number, number];\n return {\n major,\n minor,\n hasFetch: typeof fetch === 'function',\n hasRm: typeof fs.rm === 'function' && typeof fs.rmSync === 'function',\n hasMkdir: major > 10 || (major === 10 && minor >= 12),\n hasHomedir: typeof os.homedir === 'function',\n hasExecFileSync: typeof childProcess.execFileSync === 'function',\n };\n}\n\n// The shims the running node lacks, keyed by the core's InstallOptions names;\n// empty on Node >= 18.\nexport type Overlay = Partial<Pick<InstallOptions, 'spawn' | 'fetchText' | 'rm' | 'rmSync' | 'mkdir' | 'homedir' | 'syncExec' | 'workerModule'>>;\n\nexport function overlayFor(detection: OverlayDetection): Overlay {\n const overlay: Overlay = {};\n if (detection.major === 0) {\n // 0.x npm cannot install modern packages: delegate the spawn to a newer\n // local node, which runs the worker (the proven 1.6.5 mechanism).\n overlay.spawn = bind('>0.12', path.join(cjsDir, 'workers', 'spawn.js'), { callbacks: true });\n }\n if (!detection.hasFetch) {\n overlay.fetchText = (u, callback) => getContent(u, 'utf8', (err, res) => (err ? callback(err) : callback(null, res?.content)));\n }\n if (!detection.hasRm) {\n overlay.rm = (p, callback) => safeRm(p, (err) => callback(err ?? null));\n overlay.rmSync = (p) => safeRmSync(p);\n }\n if (!detection.hasMkdir) {\n overlay.mkdir = (p, callback) => mkdirp(p, callback);\n }\n if (!detection.hasHomedir) {\n overlay.homedir = () => _require('homedir-polyfill')();\n }\n if (!detection.hasExecFileSync) {\n overlay.syncExec = (workerPath, data) => {\n const payload = JSON.parse(data) as { installString: string; nodeModulesPath: string; cachePath?: string; workerModule?: string };\n return _require('function-exec-sync')({ callbacks: true }, workerPath, payload.installString, payload.nodeModulesPath, { cachePath: payload.cachePath, workerModule: payload.workerModule }) as string | undefined;\n };\n }\n // The sync child is a fresh process on this same node: it needs every shim\n // this node lacks, resolved from this module in its own process.\n if (detection.major === 0 || !detection.hasFetch || !detection.hasRm || !detection.hasMkdir || !detection.hasHomedir) {\n overlay.workerModule = path.join(cjsDir, 'compat.js');\n }\n return overlay;\n}\n\nexport default overlayFor(detect());\n"],"names":["detect","overlayFor","_require","require","Module","createRequire","__dirname","path","dirname","__filename","url","fileURLToPath","cjsDir","join","process","versions","node","split","map","Number","major","minor","hasFetch","fetch","hasRm","fs","rm","rmSync","hasMkdir","hasHomedir","os","homedir","hasExecFileSync","childProcess","execFileSync","detection","overlay","spawn","bind","callbacks","fetchText","u","callback","getContent","err","res","content","p","safeRm","safeRmSync","mkdir","mkdirp","syncExec","workerPath","data","payload","JSON","parse","installString","nodeModulesPath","cachePath","workerModule"],"mappings":"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"}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { InstallCallback, InstallOptions } from '
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export { default as parseInstallString } from './lib/parseInstallString.js';
|
|
5
|
-
export type * from './types.js';
|
|
1
|
+
import type { CleanOptions, InstallCallback, InstallOptions } from 'install-module-linked';
|
|
2
|
+
import { install, parseInstallString } from 'install-module-linked';
|
|
3
|
+
export type * from 'install-module-linked';
|
|
6
4
|
export default function installModule(installString: string, nodeModulesPath: string, callback: InstallCallback): void;
|
|
7
5
|
export default function installModule(installString: string, nodeModulesPath: string, options: InstallOptions, callback: InstallCallback): void;
|
|
8
6
|
export default function installModule(installString: string, nodeModulesPath: string, options?: InstallOptions): Promise<string>;
|
|
9
7
|
export declare function sync(installString: string, nodeModulesPath: string, options?: InstallOptions): string | undefined;
|
|
8
|
+
export declare function clear(options?: CleanOptions): void;
|
|
9
|
+
export { install, parseInstallString };
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { InstallCallback, InstallOptions } from '
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export { default as parseInstallString } from './lib/parseInstallString.js';
|
|
5
|
-
export type * from './types.js';
|
|
1
|
+
import type { CleanOptions, InstallCallback, InstallOptions } from 'install-module-linked';
|
|
2
|
+
import { install, parseInstallString } from 'install-module-linked';
|
|
3
|
+
export type * from 'install-module-linked';
|
|
6
4
|
export default function installModule(installString: string, nodeModulesPath: string, callback: InstallCallback): void;
|
|
7
5
|
export default function installModule(installString: string, nodeModulesPath: string, options: InstallOptions, callback: InstallCallback): void;
|
|
8
6
|
export default function installModule(installString: string, nodeModulesPath: string, options?: InstallOptions): Promise<string>;
|
|
9
7
|
export declare function sync(installString: string, nodeModulesPath: string, options?: InstallOptions): string | undefined;
|
|
8
|
+
export declare function clear(options?: CleanOptions): void;
|
|
9
|
+
export { install, parseInstallString };
|
package/dist/cjs/index.js
CHANGED
|
@@ -10,42 +10,95 @@ function _export(target, all) {
|
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
12
|
get clear () {
|
|
13
|
-
return
|
|
13
|
+
return clear;
|
|
14
14
|
},
|
|
15
15
|
get default () {
|
|
16
16
|
return installModule;
|
|
17
17
|
},
|
|
18
18
|
get install () {
|
|
19
|
-
return
|
|
19
|
+
return _installmodulelinked.install;
|
|
20
20
|
},
|
|
21
21
|
get parseInstallString () {
|
|
22
|
-
return
|
|
22
|
+
return _installmodulelinked.parseInstallString;
|
|
23
23
|
},
|
|
24
24
|
get sync () {
|
|
25
25
|
return sync;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
var _installmodulelinked = /*#__PURE__*/ _interop_require_wildcard(require("install-module-linked"));
|
|
29
|
+
var _compatts = /*#__PURE__*/ _interop_require_default(require("./compat.js"));
|
|
30
|
+
function _define_property(obj, key, value) {
|
|
31
|
+
if (key in obj) {
|
|
32
|
+
Object.defineProperty(obj, key, {
|
|
33
|
+
value: value,
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
writable: true
|
|
37
|
+
});
|
|
38
|
+
} else obj[key] = value;
|
|
39
|
+
return obj;
|
|
40
|
+
}
|
|
33
41
|
function _interop_require_default(obj) {
|
|
34
42
|
return obj && obj.__esModule ? obj : {
|
|
35
43
|
default: obj
|
|
36
44
|
};
|
|
37
45
|
}
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return
|
|
43
|
-
return
|
|
44
|
-
|
|
46
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
47
|
+
if (typeof WeakMap !== "function") return null;
|
|
48
|
+
var cacheBabelInterop = new WeakMap();
|
|
49
|
+
var cacheNodeInterop = new WeakMap();
|
|
50
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
51
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
52
|
+
})(nodeInterop);
|
|
53
|
+
}
|
|
54
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
55
|
+
if (!nodeInterop && obj && obj.__esModule) return obj;
|
|
56
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
|
|
57
|
+
default: obj
|
|
58
|
+
};
|
|
59
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
60
|
+
if (cache && cache.has(obj)) return cache.get(obj);
|
|
61
|
+
var newObj = {
|
|
62
|
+
__proto__: null
|
|
63
|
+
};
|
|
64
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
65
|
+
for(var key in obj){
|
|
66
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
67
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
68
|
+
if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
|
|
69
|
+
else newObj[key] = obj[key];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
newObj.default = obj;
|
|
73
|
+
if (cache) cache.set(obj, newObj);
|
|
74
|
+
return newObj;
|
|
75
|
+
}
|
|
76
|
+
function _object_spread(target) {
|
|
77
|
+
for(var i = 1; i < arguments.length; i++){
|
|
78
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
79
|
+
var ownKeys = Object.keys(source);
|
|
80
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
81
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
82
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
ownKeys.forEach(function(key) {
|
|
86
|
+
_define_property(target, key, source[key]);
|
|
45
87
|
});
|
|
46
|
-
}
|
|
88
|
+
}
|
|
89
|
+
return target;
|
|
90
|
+
}
|
|
91
|
+
function installModule(installString, nodeModulesPath, options, callback) {
|
|
92
|
+
var userOptions = typeof options === 'function' ? {} : options || {};
|
|
93
|
+
var userCallback = typeof options === 'function' ? options : callback;
|
|
94
|
+
var merged = _object_spread({}, _compatts.default, userOptions);
|
|
95
|
+
if (typeof userCallback === 'function') return (0, _installmodulelinked.default)(installString, nodeModulesPath, merged, userCallback);
|
|
96
|
+
return (0, _installmodulelinked.default)(installString, nodeModulesPath, merged);
|
|
47
97
|
}
|
|
48
98
|
function sync(installString, nodeModulesPath, options) {
|
|
49
|
-
return (0,
|
|
99
|
+
return (0, _installmodulelinked.sync)(installString, nodeModulesPath, _object_spread({}, _compatts.default, options));
|
|
100
|
+
}
|
|
101
|
+
function clear(options) {
|
|
102
|
+
(0, _installmodulelinked.clear)(_object_spread({}, _compatts.default, options));
|
|
50
103
|
}
|
|
51
104
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/install-module-linked-compat/src/index.ts"],"sourcesContent":["import type { InstallCallback, InstallOptions } from '
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/install-module-linked-compat/src/index.ts"],"sourcesContent":["import type { CleanOptions, InstallCallback, InstallOptions } from 'install-module-linked';\nimport installModuleCore, { clear as clearCore, install, parseInstallString, sync as syncCore } from 'install-module-linked';\nimport overlay from './compat.ts';\n\nexport type * from 'install-module-linked';\n\n// Identical API to install-module-linked; the overlay supplies the shims the\n// running node lacks (empty on Node >= 18), and user options always win.\n\nexport default function installModule(installString: string, nodeModulesPath: string, callback: InstallCallback): void;\nexport default function installModule(installString: string, nodeModulesPath: string, options: InstallOptions, callback: InstallCallback): void;\nexport default function installModule(installString: string, nodeModulesPath: string, options?: InstallOptions): Promise<string>;\nexport default function installModule(installString: string, nodeModulesPath: string, options?: InstallOptions | InstallCallback, callback?: InstallCallback): void | Promise<string> {\n const userOptions = typeof options === 'function' ? {} : options || {};\n const userCallback = typeof options === 'function' ? options : callback;\n const merged = { ...overlay, ...userOptions };\n if (typeof userCallback === 'function') return installModuleCore(installString, nodeModulesPath, merged, userCallback);\n return installModuleCore(installString, nodeModulesPath, merged);\n}\n\nexport function sync(installString: string, nodeModulesPath: string, options?: InstallOptions): string | undefined {\n return syncCore(installString, nodeModulesPath, { ...overlay, ...options });\n}\n\nexport function clear(options?: CleanOptions): void {\n clearCore({ ...overlay, ...options });\n}\n\nexport { install, parseInstallString };\n"],"names":["clear","installModule","install","parseInstallString","sync","installString","nodeModulesPath","options","callback","userOptions","userCallback","merged","overlay","installModuleCore","syncCore","clearCore"],"mappings":";;;;;;;;;;;QAwBgBA;eAAAA;;QAZhB;eAAwBC;;QAgBfC;eAAAA,4BAAO;;QAAEC;eAAAA,uCAAkB;;QARpBC;eAAAA;;;2EAnBqF;+DACjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUL,SAASH,cAAcI,aAAqB,EAAEC,eAAuB,EAAEC,OAA0C,EAAEC,QAA0B;IAC1J,IAAMC,cAAc,OAAOF,YAAY,aAAa,CAAC,IAAIA,WAAW,CAAC;IACrE,IAAMG,eAAe,OAAOH,YAAY,aAAaA,UAAUC;IAC/D,IAAMG,SAAS,mBAAKC,iBAAO,EAAKH;IAChC,IAAI,OAAOC,iBAAiB,YAAY,OAAOG,IAAAA,4BAAiB,EAACR,eAAeC,iBAAiBK,QAAQD;IACzG,OAAOG,IAAAA,4BAAiB,EAACR,eAAeC,iBAAiBK;AAC3D;AAEO,SAASP,KAAKC,aAAqB,EAAEC,eAAuB,EAAEC,OAAwB;IAC3F,OAAOO,IAAAA,yBAAQ,EAACT,eAAeC,iBAAiB,mBAAKM,iBAAO,EAAKL;AACnE;AAEO,SAASP,MAAMO,OAAsB;IAC1CQ,IAAAA,0BAAS,EAAC,mBAAKH,iBAAO,EAAKL;AAC7B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, // 0.x delegation child: node-version-call-local runs this in a newer local
|
|
6
|
+
// node, where npm can install modern packages (the proven 1.6.5 mechanism).
|
|
7
|
+
"default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function() {
|
|
10
|
+
return spawnRemote;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _crossspawncb = /*#__PURE__*/ _interop_require_default(require("cross-spawn-cb"));
|
|
14
|
+
function _interop_require_default(obj) {
|
|
15
|
+
return obj && obj.__esModule ? obj : {
|
|
16
|
+
default: obj
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function spawnRemote(command, args, options, callback) {
|
|
20
|
+
(0, _crossspawncb.default)(command, args, options, function(err) {
|
|
21
|
+
return callback(err !== null && err !== void 0 ? err : null);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/install-module-linked-compat/src/workers/spawn.ts"],"sourcesContent":["import spawn from 'cross-spawn-cb';\n\n// 0.x delegation child: node-version-call-local runs this in a newer local\n// node, where npm can install modern packages (the proven 1.6.5 mechanism).\nexport default function spawnRemote(command: string, args: string[], options: { cwd: string }, callback: (err: Error | null) => void): void {\n spawn(command, args, options, (err) => callback(err ?? null));\n}\n"],"names":["spawnRemote","command","args","options","callback","spawn","err"],"mappings":";;;;+BAEA,2EAA2E;AAC3E,4EAA4E;AAC5E;;;eAAwBA;;;mEAJN;;;;;;AAIH,SAASA,YAAYC,OAAe,EAAEC,IAAc,EAAEC,OAAwB,EAAEC,QAAqC;IAClIC,IAAAA,qBAAK,EAACJ,SAASC,MAAMC,SAAS,SAACG;eAAQF,SAASE,gBAAAA,iBAAAA,MAAO;;AACzD"}
|
package/dist/esm/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import fs from 'fs';
|
|
|
4
4
|
import getopts from 'getopts-compat';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import url from 'url';
|
|
7
|
-
import clear from './
|
|
7
|
+
import { clear } from './index.js';
|
|
8
8
|
const __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));
|
|
9
9
|
const ERROR_CODE = 7;
|
|
10
10
|
function getVersion() {
|
|
@@ -26,7 +26,7 @@ function printHelp(name) {
|
|
|
26
26
|
console.log(' -h, --help Print this help message');
|
|
27
27
|
}
|
|
28
28
|
export default ((argv, name)=>{
|
|
29
|
-
name = name || 'iml';
|
|
29
|
+
name = name || 'iml-compat';
|
|
30
30
|
const options = getopts(argv, {
|
|
31
31
|
alias: {
|
|
32
32
|
version: 'v',
|
|
@@ -50,8 +50,8 @@ export default ((argv, name)=>{
|
|
|
50
50
|
}
|
|
51
51
|
const args = options._;
|
|
52
52
|
if (!args.length) {
|
|
53
|
-
console.
|
|
54
|
-
console.
|
|
53
|
+
console.error(`Missing command. Example usage: ${name} [command]`);
|
|
54
|
+
console.error(`Run "${name} --help" for more information.`);
|
|
55
55
|
exit(ERROR_CODE);
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
@@ -60,7 +60,7 @@ export default ((argv, name)=>{
|
|
|
60
60
|
exit(0);
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
|
-
console.
|
|
64
|
-
console.
|
|
63
|
+
console.error(`Unrecognized command: ${args[0]}. Example usage: ${name} [command]`);
|
|
64
|
+
console.error(`Run "${name} --help" for more information.`);
|
|
65
65
|
exit(ERROR_CODE);
|
|
66
66
|
});
|
package/dist/esm/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/install-module-linked-compat/src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport exit from 'exit-compat';\nimport fs from 'fs';\nimport getopts from 'getopts-compat';\nimport path from 'path';\nimport url from 'url';\nimport clear from './
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/install-module-linked-compat/src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport exit from 'exit-compat';\nimport fs from 'fs';\nimport getopts from 'getopts-compat';\nimport path from 'path';\nimport url from 'url';\nimport { clear } from './index.ts';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\n\nconst ERROR_CODE = 7;\n\nfunction getVersion(): string {\n const packageJsonPath = path.join(__dirname, '..', '..', 'package.json');\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));\n return packageJson.version;\n}\n\nfunction printHelp(name: string): void {\n const version = getVersion();\n console.log(`${name} v${version}`);\n console.log('');\n console.log(`Usage: ${name} [options] [command]`);\n console.log('');\n console.log('Commands:');\n console.log(' clear Clear the module cache');\n console.log('');\n console.log('Options:');\n console.log(' -v, --version Print version number');\n console.log(' -h, --help Print this help message');\n}\n\nexport default (argv: string[], name?: string): void => {\n name = name || 'iml-compat';\n const options = getopts(argv, {\n alias: { version: 'v', help: 'h' },\n boolean: ['version', 'help'],\n stopEarly: true,\n });\n\n if (options.version) {\n console.log(getVersion());\n exit(0);\n return;\n }\n\n if (options.help) {\n printHelp(name);\n exit(0);\n return;\n }\n\n const args = options._;\n if (!args.length) {\n console.error(`Missing command. Example usage: ${name} [command]`);\n console.error(`Run \"${name} --help\" for more information.`);\n exit(ERROR_CODE);\n return;\n }\n\n if (args[0] === 'clear') {\n clear();\n exit(0);\n return;\n }\n\n console.error(`Unrecognized command: ${args[0]}. Example usage: ${name} [command]`);\n console.error(`Run \"${name} --help\" for more information.`);\n exit(ERROR_CODE);\n};\n"],"names":["exit","fs","getopts","path","url","clear","__dirname","dirname","__filename","fileURLToPath","ERROR_CODE","getVersion","packageJsonPath","join","packageJson","JSON","parse","readFileSync","version","printHelp","name","console","log","argv","options","alias","help","boolean","stopEarly","args","_","length","error"],"mappings":";AAEA,OAAOA,UAAU,cAAc;AAC/B,OAAOC,QAAQ,KAAK;AACpB,OAAOC,aAAa,iBAAiB;AACrC,OAAOC,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,SAASC,KAAK,QAAQ,aAAa;AAEnC,MAAMC,YAAYH,KAAKI,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaJ,IAAIK,aAAa,CAAC,YAAYL,GAAG;AAEjH,MAAMM,aAAa;AAEnB,SAASC;IACP,MAAMC,kBAAkBT,KAAKU,IAAI,CAACP,WAAW,MAAM,MAAM;IACzD,MAAMQ,cAAcC,KAAKC,KAAK,CAACf,GAAGgB,YAAY,CAACL,iBAAiB;IAChE,OAAOE,YAAYI,OAAO;AAC5B;AAEA,SAASC,UAAUC,IAAY;IAC7B,MAAMF,UAAUP;IAChBU,QAAQC,GAAG,CAAC,GAAGF,KAAK,EAAE,EAAEF,SAAS;IACjCG,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC,CAAC,OAAO,EAAEF,KAAK,oBAAoB,CAAC;IAChDC,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;AACd;AAEA,eAAe,CAAA,CAACC,MAAgBH;IAC9BA,OAAOA,QAAQ;IACf,MAAMI,UAAUtB,QAAQqB,MAAM;QAC5BE,OAAO;YAAEP,SAAS;YAAKQ,MAAM;QAAI;QACjCC,SAAS;YAAC;YAAW;SAAO;QAC5BC,WAAW;IACb;IAEA,IAAIJ,QAAQN,OAAO,EAAE;QACnBG,QAAQC,GAAG,CAACX;QACZX,KAAK;QACL;IACF;IAEA,IAAIwB,QAAQE,IAAI,EAAE;QAChBP,UAAUC;QACVpB,KAAK;QACL;IACF;IAEA,MAAM6B,OAAOL,QAAQM,CAAC;IACtB,IAAI,CAACD,KAAKE,MAAM,EAAE;QAChBV,QAAQW,KAAK,CAAC,CAAC,gCAAgC,EAAEZ,KAAK,UAAU,CAAC;QACjEC,QAAQW,KAAK,CAAC,CAAC,KAAK,EAAEZ,KAAK,8BAA8B,CAAC;QAC1DpB,KAAKU;QACL;IACF;IAEA,IAAImB,IAAI,CAAC,EAAE,KAAK,SAAS;QACvBxB;QACAL,KAAK;QACL;IACF;IAEAqB,QAAQW,KAAK,CAAC,CAAC,sBAAsB,EAAEH,IAAI,CAAC,EAAE,CAAC,iBAAiB,EAAET,KAAK,UAAU,CAAC;IAClFC,QAAQW,KAAK,CAAC,CAAC,KAAK,EAAEZ,KAAK,8BAA8B,CAAC;IAC1DpB,KAAKU;AACP,CAAA,EAAE"}
|
package/dist/esm/compat.d.ts
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import type { InstallOptions } from 'install-module-linked';
|
|
2
|
+
export interface OverlayDetection {
|
|
3
|
+
major: number;
|
|
4
|
+
minor: number;
|
|
5
|
+
hasFetch: boolean;
|
|
6
|
+
hasRm: boolean;
|
|
7
|
+
hasMkdir: boolean;
|
|
8
|
+
hasHomedir: boolean;
|
|
9
|
+
hasExecFileSync: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function detect(): OverlayDetection;
|
|
12
|
+
export type Overlay = Partial<Pick<InstallOptions, 'spawn' | 'fetchText' | 'rm' | 'rmSync' | 'mkdir' | 'homedir' | 'syncExec' | 'workerModule'>>;
|
|
13
|
+
export declare function overlayFor(detection: OverlayDetection): Overlay;
|
|
14
|
+
declare const _default: Partial<Pick<InstallOptions, "spawn" | "fetchText" | "rm" | "rmSync" | "mkdir" | "homedir" | "syncExec" | "workerModule">>;
|
|
15
|
+
export default _default;
|