@tapjs/processinfo 3.1.5 → 3.1.7
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/dist/commonjs/canonical-source.d.ts +3 -0
- package/dist/commonjs/canonical-source.d.ts.map +1 -0
- package/dist/commonjs/canonical-source.js +38 -0
- package/dist/commonjs/canonical-source.js.map +1 -0
- package/dist/commonjs/child_process.js +9 -9
- package/dist/commonjs/child_process.js.map +1 -1
- package/dist/commonjs/get-process-info.js +1 -1
- package/dist/commonjs/get-process-info.js.map +1 -1
- package/dist/commonjs/node-options-env.d.ts +1 -1
- package/dist/commonjs/node-options-env.d.ts.map +1 -1
- package/dist/commonjs/node-options-env.js +80 -12
- package/dist/commonjs/node-options-env.js.map +1 -1
- package/dist/commonjs/register-coverage.d.ts.map +1 -1
- package/dist/commonjs/register-coverage.js +19 -4
- package/dist/commonjs/register-coverage.js.map +1 -1
- package/dist/commonjs/register-env.js +3 -3
- package/dist/commonjs/register-env.js.map +1 -1
- package/dist/commonjs/spawn-opts.d.ts +1 -1
- package/dist/commonjs/spawn-opts.d.ts.map +1 -1
- package/dist/commonjs/spawn-opts.js +8 -2
- package/dist/commonjs/spawn-opts.js.map +1 -1
- package/dist/esm/canonical-source.d.ts +3 -0
- package/dist/esm/canonical-source.d.ts.map +1 -0
- package/dist/esm/canonical-source.js +33 -0
- package/dist/esm/canonical-source.js.map +1 -0
- package/dist/esm/child_process.js +9 -9
- package/dist/esm/child_process.js.map +1 -1
- package/dist/esm/get-process-info.js +1 -1
- package/dist/esm/get-process-info.js.map +1 -1
- package/dist/esm/node-options-env.d.ts +1 -1
- package/dist/esm/node-options-env.d.ts.map +1 -1
- package/dist/esm/node-options-env.js +81 -13
- package/dist/esm/node-options-env.js.map +1 -1
- package/dist/esm/register-coverage.d.ts.map +1 -1
- package/dist/esm/register-coverage.js +19 -4
- package/dist/esm/register-coverage.js.map +1 -1
- package/dist/esm/register-env.js +3 -3
- package/dist/esm/register-env.js.map +1 -1
- package/dist/esm/spawn-opts.d.ts +1 -1
- package/dist/esm/spawn-opts.d.ts.map +1 -1
- package/dist/esm/spawn-opts.js +8 -2
- package/dist/esm/spawn-opts.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-source.d.ts","sourceRoot":"","sources":["../../src/canonical-source.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,eAAe,MAAO,MAAM,KAAG,MAY3C,CAAA;AAED,eAAO,MAAM,aAAa,MAAO,MAAM,KAAG,MAUzC,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// The sources reported in sourcemaps can be fickle,
|
|
3
|
+
// and istanbul's reporting doesn't handle it so well.
|
|
4
|
+
// So, we canonicalize all entries in sources to a file://
|
|
5
|
+
// url with consistent capitalization.
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.canonicalPath = exports.canonicalSource = void 0;
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const url_1 = require("url");
|
|
10
|
+
const cwd = process.cwd();
|
|
11
|
+
const canonicalSource = (s) => {
|
|
12
|
+
// convert to a path
|
|
13
|
+
if (s.startsWith('file://')) {
|
|
14
|
+
const u = new URL(s);
|
|
15
|
+
const hash = u.hash;
|
|
16
|
+
const search = u.search;
|
|
17
|
+
return String((0, url_1.pathToFileURL)((0, exports.canonicalPath)((0, url_1.fileURLToPath)(s)))) +
|
|
18
|
+
hash + search;
|
|
19
|
+
}
|
|
20
|
+
// re-resolve it relative to the cwd
|
|
21
|
+
// back to a file: url
|
|
22
|
+
return String((0, url_1.pathToFileURL)((0, exports.canonicalPath)(s)));
|
|
23
|
+
};
|
|
24
|
+
exports.canonicalSource = canonicalSource;
|
|
25
|
+
const canonicalPath = (s) => {
|
|
26
|
+
const rel = (0, path_1.relative)(cwd, s);
|
|
27
|
+
s = (0, path_1.resolve)(cwd, rel);
|
|
28
|
+
// capitalize drive letters
|
|
29
|
+
if (/^[a-z]:/.test(s))
|
|
30
|
+
s = s.charAt(0).toUpperCase() + s.substring(1);
|
|
31
|
+
// capitalize UNC paths
|
|
32
|
+
if (s.startsWith('\\\\')) {
|
|
33
|
+
s = s.replace(/\\\\[^\\]+\\[^\\]+\\/, _0 => _0.toUpperCase());
|
|
34
|
+
}
|
|
35
|
+
return s;
|
|
36
|
+
};
|
|
37
|
+
exports.canonicalPath = canonicalPath;
|
|
38
|
+
//# sourceMappingURL=canonical-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-source.js","sourceRoot":"","sources":["../../src/canonical-source.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,sDAAsD;AACtD,0DAA0D;AAC1D,sCAAsC;;;AAEtC,+BAAwC;AACxC,6BAAkD;AAClD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;AAElB,MAAM,eAAe,GAAG,CAAC,CAAS,EAAU,EAAE;IACnD,oBAAoB;IACpB,IAAI,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAC3B,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAA;QACpB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAA;QACnB,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAA;QACvB,OAAO,MAAM,CAAC,IAAA,mBAAa,EAAC,IAAA,qBAAa,EAAC,IAAA,mBAAa,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3D,IAAI,GAAG,MAAM,CAAA;KAChB;IACD,oCAAoC;IACpC,sBAAsB;IACtB,OAAO,MAAM,CAAC,IAAA,mBAAa,EAAC,IAAA,qBAAa,EAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAChD,CAAC,CAAA;AAZY,QAAA,eAAe,mBAY3B;AAEM,MAAM,aAAa,GAAG,CAAC,CAAS,EAAU,EAAE;IACjD,MAAM,GAAG,GAAG,IAAA,eAAQ,EAAC,GAAG,EAAE,CAAC,CAAC,CAAA;IAC5B,CAAC,GAAG,IAAA,cAAO,EAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACrB,2BAA2B;IAC3B,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IACrE,uBAAuB;IACvB,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QACxB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAA;KAC9D;IACD,OAAO,CAAC,CAAA;AACV,CAAC,CAAA;AAVY,QAAA,aAAa,iBAUzB","sourcesContent":["// The sources reported in sourcemaps can be fickle,\n// and istanbul's reporting doesn't handle it so well.\n// So, we canonicalize all entries in sources to a file://\n// url with consistent capitalization.\n\nimport { relative, resolve } from 'path'\nimport { fileURLToPath, pathToFileURL } from 'url'\nconst cwd = process.cwd()\n\nexport const canonicalSource = (s: string): string => {\n // convert to a path\n if (s.startsWith('file://')) {\n const u = new URL(s)\n const hash = u.hash\n const search = u.search\n return String(pathToFileURL(canonicalPath(fileURLToPath(s)))) +\n hash + search\n }\n // re-resolve it relative to the cwd\n // back to a file: url\n return String(pathToFileURL(canonicalPath(s)))\n}\n\nexport const canonicalPath = (s: string): string => {\n const rel = relative(cwd, s)\n s = resolve(cwd, rel)\n // capitalize drive letters\n if (/^[a-z]:/.test(s)) s = s.charAt(0).toUpperCase() + s.substring(1)\n // capitalize UNC paths\n if (s.startsWith('\\\\\\\\')) {\n s = s.replace(/\\\\\\\\[^\\\\]+\\\\[^\\\\]+\\\\/, _0 => _0.toUpperCase())\n }\n return s\n}\n"]}
|
|
@@ -20,7 +20,7 @@ function spawn(cmd, args, options) {
|
|
|
20
20
|
options = args;
|
|
21
21
|
args = [];
|
|
22
22
|
}
|
|
23
|
-
return (0, child_process_1.spawn)(cmd, args || [], (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k)));
|
|
23
|
+
return (0, child_process_1.spawn)(cmd, args || [], (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k), args));
|
|
24
24
|
}
|
|
25
25
|
exports.spawn = spawn;
|
|
26
26
|
function spawnSync(cmd, args, options) {
|
|
@@ -28,18 +28,18 @@ function spawnSync(cmd, args, options) {
|
|
|
28
28
|
options = args;
|
|
29
29
|
args = [];
|
|
30
30
|
}
|
|
31
|
-
return (0, child_process_1.spawnSync)(cmd, args || [], (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k)));
|
|
31
|
+
return (0, child_process_1.spawnSync)(cmd, args || [], (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k), args));
|
|
32
32
|
}
|
|
33
33
|
exports.spawnSync = spawnSync;
|
|
34
34
|
function exec(...args) {
|
|
35
35
|
const [cmd, options, callback] = args;
|
|
36
36
|
if (typeof options === 'function') {
|
|
37
|
-
return (0, child_process_1.exec)(cmd, (0, spawn_opts_js_1.spawnOpts)({}, (0, get_exclude_js_1.getExclude)(k)), options);
|
|
37
|
+
return (0, child_process_1.exec)(cmd, (0, spawn_opts_js_1.spawnOpts)({}, (0, get_exclude_js_1.getExclude)(k), []), options);
|
|
38
38
|
}
|
|
39
39
|
else if (!options) {
|
|
40
|
-
return (0, child_process_1.exec)(cmd, (0, spawn_opts_js_1.spawnOpts)({}, (0, get_exclude_js_1.getExclude)(k)), callback);
|
|
40
|
+
return (0, child_process_1.exec)(cmd, (0, spawn_opts_js_1.spawnOpts)({}, (0, get_exclude_js_1.getExclude)(k), []), callback);
|
|
41
41
|
}
|
|
42
|
-
return (0, child_process_1.exec)(cmd, (0, spawn_opts_js_1.spawnOpts)(options, (0, get_exclude_js_1.getExclude)(k)), callback);
|
|
42
|
+
return (0, child_process_1.exec)(cmd, (0, spawn_opts_js_1.spawnOpts)(options, (0, get_exclude_js_1.getExclude)(k), []), callback);
|
|
43
43
|
}
|
|
44
44
|
exports.exec = exec;
|
|
45
45
|
(function (exec) {
|
|
@@ -71,7 +71,7 @@ function execFile(file, ...execFileArgs) {
|
|
|
71
71
|
callback = arg;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
return (0, child_process_1.execFile)(file, args, (0, spawn_opts_js_1.spawnOpts)(options, (0, get_exclude_js_1.getExclude)(k)), callback);
|
|
74
|
+
return (0, child_process_1.execFile)(file, args, (0, spawn_opts_js_1.spawnOpts)(options, (0, get_exclude_js_1.getExclude)(k), args), callback);
|
|
75
75
|
}
|
|
76
76
|
exports.execFile = execFile;
|
|
77
77
|
(function (execFile) {
|
|
@@ -82,7 +82,7 @@ exports.execFile = execFile;
|
|
|
82
82
|
options = args;
|
|
83
83
|
args = [];
|
|
84
84
|
}
|
|
85
|
-
return customPromisify(child_process_1.execFile)(file, (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k)));
|
|
85
|
+
return customPromisify(child_process_1.execFile)(file, (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k), args));
|
|
86
86
|
}
|
|
87
87
|
execFile.__promisify__ = __promisify__;
|
|
88
88
|
Object.assign(execFile, { [promisify]: __promisify__ });
|
|
@@ -95,7 +95,7 @@ function execFileSync(file, args, options) {
|
|
|
95
95
|
options = args;
|
|
96
96
|
args = [];
|
|
97
97
|
}
|
|
98
|
-
return (0, child_process_1.execFileSync)(file, args || [], (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k)));
|
|
98
|
+
return (0, child_process_1.execFileSync)(file, args || [], (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k), args));
|
|
99
99
|
}
|
|
100
100
|
exports.execFileSync = execFileSync;
|
|
101
101
|
function fork(modulePath, args, options) {
|
|
@@ -103,7 +103,7 @@ function fork(modulePath, args, options) {
|
|
|
103
103
|
options = args;
|
|
104
104
|
args = [];
|
|
105
105
|
}
|
|
106
|
-
return (0, child_process_1.fork)(modulePath, args, (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k)));
|
|
106
|
+
return (0, child_process_1.fork)(modulePath, args, (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k), args));
|
|
107
107
|
}
|
|
108
108
|
exports.fork = fork;
|
|
109
109
|
//# sourceMappingURL=child_process.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"child_process.js","sourceRoot":"","sources":["../../src/child_process.ts"],"names":[],"mappings":";;;AAAA,0EAA0E;AAC1E,iEAAiE;AACjE,iDAmCsB;AAGtB,qDAA6C;AAC7C,mDAA2D;AAE3D,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;AAO5D,MAAM,eAAe,GAAG,CAAkB,CAAI,EAAE,EAAE;AAChD,uEAAuE;AACvE,qBAAqB;AACpB,CAAW,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,aAAa,CAAA;AAC5C,oBAAoB;AAEpB,MAAM,CAAC,GAAG,6BAA6B,CAAA;AAEvC,iEAAiE;AACjE,MAAM,UAAU,GAAG,CAAiC,CAAM,EAAU,EAAE,CACpE,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AA6GnD,SAAgB,KAAK,CACnB,GAAW,EACX,IAUK,EACL,OASK;IAEL,IAAI,UAAU,CAAe,IAAI,CAAC,EAAE;QAClC,OAAO,GAAG,IAAI,CAAA;QACd,IAAI,GAAG,EAAE,CAAA;KACV;IACD,OAAO,I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CAAC,CAAC,CAAC,CAAA;AAC1E,CAAC;AAVD,oBAUC","sourcesContent":["// This wraps all of the various spawn methods such that externalID can be\n// set in the options, and ensuring that the proper envs get set.\nimport {\n ChildProcess,\n ChildProcessByStdio,\n ChildProcessWithoutNullStreams,\n exec as cpExec,\n ExecException,\n execFile as cpExecFile,\n ExecFileException,\n ExecFileOptions,\n ExecFileOptionsWithBufferEncoding,\n ExecFileOptionsWithOtherEncoding,\n ExecFileOptionsWithStringEncoding,\n execFileSync as cpExecFileSync,\n ExecFileSyncOptions,\n ExecFileSyncOptionsWithBufferEncoding,\n ExecFileSyncOptionsWithStringEncoding,\n ExecOptions,\n execSync as cpExecSync,\n ExecSyncOptions,\n ExecSyncOptionsWithBufferEncoding,\n ExecSyncOptionsWithStringEncoding,\n fork as cpFork,\n ForkOptions,\n PromiseWithChild,\n spawn as cpSpawn,\n SpawnOptions,\n SpawnOptionsWithoutStdio,\n SpawnOptionsWithStdioTuple,\n spawnSync as cpSpawnSync,\n SpawnSyncOptions,\n SpawnSyncOptionsWithBufferEncoding,\n SpawnSyncOptionsWithStringEncoding,\n SpawnSyncReturns,\n StdioNull,\n StdioPipe,\n} from 'child_process'\nimport type { ObjectEncodingOptions } from 'fs'\nimport type { Readable, Writable } from 'stream'\nimport { getExclude } from './get-exclude.js'\nimport { spawnOpts, WithExternalID } from './spawn-opts.js'\n\nconst promisify = Symbol.for('nodejs.util.promisify.custom')\n\n// pull the old __promisify__ out of node's declared namespaces\ntype CP<T extends { __promisify__: any }> = T & {\n [promisify]: T['__promisify__']\n}\ntype OldCP = { __promisify__: (...a: any) => any }\nconst customPromisify = <T extends OldCP>(e: T) =>\n // the node types list it as __promisify__ but it's actually the symbol\n /* c8 ignore start */\n (e as CP<T>)[promisify] || e.__promisify__\n/* c8 ignore stop */\n\nconst k = '_TAPJS_PROCESSINFO_EXCLUDE_'\n\n// coercion function when we know it's an array or something else\nconst isNotArray = <T extends { [k: string]: any }>(o: any): o is T =>\n !!o && typeof o === 'object' && !Array.isArray(o)\n\nexport function spawn(\n command: string,\n options?: WithExternalID<SpawnOptionsWithoutStdio>\n): ChildProcessWithoutNullStreams\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>\n >\n): ChildProcessByStdio<Writable, Readable, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>\n >\n): ChildProcessByStdio<Writable, Readable, null>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>\n >\n): ChildProcessByStdio<Writable, null, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>\n >\n): ChildProcessByStdio<null, Readable, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>\n >\n): ChildProcessByStdio<Writable, null, null>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>\n >\n): ChildProcessByStdio<null, Readable, null>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>\n >\n): ChildProcessByStdio<null, null, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>\n >\n): ChildProcessByStdio<null, null, null>\nexport function spawn(\n command: string,\n options: WithExternalID<SpawnOptions>\n): ChildProcess\nexport function spawn(\n command: string,\n args?: ReadonlyArray<string>,\n options?: SpawnOptionsWithoutStdio\n): ChildProcessWithoutNullStreams\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>\n): ChildProcessByStdio<Writable, Readable, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>\n): ChildProcessByStdio<Writable, Readable, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>\n): ChildProcessByStdio<Writable, null, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>\n): ChildProcessByStdio<null, Readable, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>\n): ChildProcessByStdio<Writable, null, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>\n): ChildProcessByStdio<null, Readable, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>\n): ChildProcessByStdio<null, null, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>\n): ChildProcessByStdio<null, null, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptions\n): ChildProcess\n\nexport function spawn(\n cmd: string,\n args?:\n | ReadonlyArray<string>\n | WithExternalID<SpawnOptions>\n | WithExternalID<SpawnOptionsWithoutStdio>\n | WithExternalID<\n SpawnOptionsWithStdioTuple<\n StdioNull | StdioPipe,\n StdioNull | StdioPipe,\n StdioNull | StdioPipe\n >\n >,\n options?:\n | WithExternalID<SpawnOptions>\n | WithExternalID<SpawnOptionsWithoutStdio>\n | WithExternalID<\n SpawnOptionsWithStdioTuple<\n StdioNull | StdioPipe,\n StdioNull | StdioPipe,\n StdioNull | StdioPipe\n >\n >\n): ChildProcess | ChildProcessWithoutNullStreams {\n if (isNotArray<SpawnOptions>(args)) {\n options = args\n args = []\n }\n return cpSpawn(cmd, args || [], spawnOpts(options || {}, getExclude(k)))\n}\n\nexport function spawnSync(command: string): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n options: WithExternalID<SpawnSyncOptionsWithStringEncoding>\n): SpawnSyncReturns<string>\nexport function spawnSync(\n command: string,\n options: WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n options?: WithExternalID<SpawnSyncOptions>\n): SpawnSyncReturns<string | Buffer>\nexport function spawnSync(\n command: string,\n args: ReadonlyArray<string>\n): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<SpawnSyncOptionsWithStringEncoding>\n): SpawnSyncReturns<string>\nexport function spawnSync(\n command: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n args?: ReadonlyArray<string>,\n options?: WithExternalID<SpawnSyncOptions>\n): SpawnSyncReturns<string | Buffer>\n\nexport function spawnSync(\n cmd: string,\n args?:\n | WithExternalID<SpawnSyncOptionsWithStringEncoding>\n | WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n | WithExternalID<SpawnSyncOptions>\n | ReadonlyArray<string>,\n options?:\n | WithExternalID<SpawnSyncOptionsWithStringEncoding>\n | WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n | WithExternalID<SpawnSyncOptions>\n) {\n if (isNotArray<SpawnSyncOptions>(args)) {\n options = args\n args = []\n }\n return cpSpawnSync(\n cmd,\n args || [],\n spawnOpts(options || {}, getExclude(k))\n )\n}\n\nexport type ExecArgs =\n | [\n command: string,\n callback?: (\n error: ExecException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<\n {\n encoding: 'buffer' | null\n } & ExecOptions\n >,\n callback?: (\n error: ExecException | null,\n stdout: Buffer,\n stderr: Buffer\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >,\n callback?: (\n error: ExecException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >,\n callback?: (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<ExecOptions>,\n callback?: (\n error: ExecException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n command: string,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecOptions>\n | undefined\n | null,\n callback?: (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\nexport function exec(...args: ExecArgs): ChildProcess {\n const [cmd, options, callback] = args\n if (typeof options === 'function') {\n return cpExec(cmd, spawnOpts<ExecOptions>({}, getExclude(k)), options)\n } else if (!options) {\n return cpExec(\n cmd,\n spawnOpts<ExecOptions>({}, getExclude(k)),\n callback as (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n )\n }\n\n return cpExec(\n cmd,\n spawnOpts(options, getExclude(k)),\n callback as (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n )\n}\n\nexport namespace exec {\n export function __promisify__(command: string): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n command: string,\n options: WithExternalID<\n {\n encoding: 'buffer' | null\n } & ExecOptions\n >\n ): PromiseWithChild<{\n stdout: Buffer\n stderr: Buffer\n }>\n export function __promisify__(\n command: string,\n options: WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n command: string,\n options: WithExternalID<ExecOptions>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n command: string,\n options?: WithExternalID<ObjectEncodingOptions & ExecOptions> | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n command: string,\n options?:\n | WithExternalID<\n {\n encoding: 'buffer' | null\n } & ExecOptions\n >\n | WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >\n | WithExternalID<ExecOptions>\n | WithExternalID<ObjectEncodingOptions & ExecOptions>\n | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }> {\n return customPromisify(cpExec)(\n command,\n spawnOpts(options || {}, getExclude(k))\n )\n }\n\n Object.assign(exec, { [promisify]: __promisify__ })\n /* c8 ignore start */\n}\n/* c8 ignore stop */\n\nexport function execSync(command: string): Buffer\nexport function execSync(\n command: string,\n options: WithExternalID<ExecSyncOptionsWithStringEncoding>\n): string\nexport function execSync(\n command: string,\n options: WithExternalID<ExecSyncOptionsWithBufferEncoding>\n): Buffer\nexport function execSync(\n command: string,\n options?: WithExternalID<ExecSyncOptions>\n): string | Buffer\nexport function execSync(\n cmd: string,\n options?:\n | WithExternalID<ExecSyncOptions>\n | WithExternalID<ExecSyncOptionsWithBufferEncoding>\n | WithExternalID<ExecSyncOptionsWithStringEncoding>\n | WithExternalID<ExecSyncOptionsWithBufferEncoding>\n): string | Buffer {\n return cpExecSync(\n cmd,\n spawnOpts<ExecSyncOptions>(options || {}, getExclude(k))\n )\n}\n\nexport type ExecFileArgs =\n | []\n | [\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ]\n | [args?: ReadonlyArray<string> | null]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ]\n | [\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: Buffer,\n stderr: Buffer\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: Buffer,\n stderr: Buffer\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptionsWithStringEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithStringEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptions>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptions>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null,\n callback:\n | ((\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void)\n | undefined\n | null\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null,\n callback:\n | ((\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void)\n | undefined\n | null\n ]\nexport function execFile(\n file: string,\n ...execFileArgs: ExecFileArgs\n): ChildProcess {\n let args = []\n let options: WithExternalID<ObjectEncodingOptions & ExecFileOptions> = {}\n let callback: ((...a: any) => any) | undefined = undefined\n for (const arg of execFileArgs) {\n if (Array.isArray(arg)) {\n args = arg\n } else if (\n arg &&\n typeof arg === 'object' &&\n isNotArray<WithExternalID<ObjectEncodingOptions & ExecFileOptions>>(\n arg\n )\n ) {\n options = arg\n } else if (typeof arg === 'function') {\n callback = arg\n }\n }\n return cpExecFile(\n file,\n args,\n spawnOpts(options, getExclude(k)),\n callback\n )\n}\n\nexport namespace execFile {\n export function __promisify__(file: string): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>\n ): PromiseWithChild<{\n stdout: Buffer\n stderr: Buffer\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>\n ): PromiseWithChild<{\n stdout: Buffer\n stderr: Buffer\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptionsWithStringEncoding>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithStringEncoding>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptions>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptions>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n args?:\n | ReadonlyArray<string>\n | undefined\n | null\n | WithExternalID<ExecFileOptionsWithBufferEncoding>\n | WithExternalID<ExecFileOptionsWithStringEncoding>\n | WithExternalID<ExecFileOptionsWithOtherEncoding>\n | WithExternalID<ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>,\n options?:\n | undefined\n | null\n | WithExternalID<ExecFileOptionsWithBufferEncoding>\n | WithExternalID<ExecFileOptionsWithStringEncoding>\n | WithExternalID<ExecFileOptionsWithOtherEncoding>\n | WithExternalID<ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }> {\n if (\n !!args &&\n typeof args === 'object' &&\n isNotArray<\n | WithExternalID<ExecFileOptionsWithBufferEncoding>\n | WithExternalID<ExecFileOptionsWithStringEncoding>\n | WithExternalID<ExecFileOptionsWithOtherEncoding>\n | WithExternalID<ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n >(args)\n ) {\n options = args\n args = []\n }\n return customPromisify(cpExecFile)(\n file,\n spawnOpts(options || {}, getExclude(k))\n )\n }\n Object.assign(execFile, { [promisify]: __promisify__ })\n /* c8 ignore start */\n}\n/* c8 ignore stop */\n\nexport function execFileSync(file: string): Buffer\nexport function execFileSync(\n file: string,\n options: WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n): string\nexport function execFileSync(\n file: string,\n options: WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n): Buffer\nexport function execFileSync(\n file: string,\n options?: WithExternalID<ExecFileSyncOptions>\n): string | Buffer\nexport function execFileSync(\n file: string,\n args: ReadonlyArray<string>\n): Buffer\nexport function execFileSync(\n file: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n): string\nexport function execFileSync(\n file: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n): Buffer\nexport function execFileSync(\n file: string,\n args?: ReadonlyArray<string>,\n options?: WithExternalID<ExecFileSyncOptions>\n): string | Buffer\nexport function execFileSync(\n file: string,\n args?:\n | ReadonlyArray<string>\n | WithExternalID<ExecFileSyncOptions>\n | WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n | WithExternalID<ExecFileSyncOptionsWithBufferEncoding>,\n options?:\n | WithExternalID<ExecFileSyncOptions>\n | WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n | WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n): string | Buffer {\n if (\n args &&\n typeof args === 'object' &&\n isNotArray<\n | WithExternalID<ExecFileSyncOptions>\n | WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n | WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n >(args)\n ) {\n options = args\n args = []\n }\n return cpExecFileSync(\n file,\n args || [],\n spawnOpts(options || {}, getExclude(k))\n )\n}\n\nexport function fork(\n modulePath: string,\n options?: ForkOptions\n): ChildProcess\nexport function fork(\n modulePath: string,\n args?: ReadonlyArray<string>,\n options?: WithExternalID<ForkOptions>\n): ChildProcess\nexport function fork(\n modulePath: string,\n args?: ForkOptions | ReadonlyArray<string>,\n options?: WithExternalID<ForkOptions>\n): ChildProcess {\n if (isNotArray<ForkOptions>(args)) {\n options = args\n args = []\n }\n return cpFork(modulePath, args, spawnOpts(options || {}, getExclude(k)))\n}\n"]}
|
|
1
|
+
{"version":3,"file":"child_process.js","sourceRoot":"","sources":["../../src/child_process.ts"],"names":[],"mappings":";;;AAAA,0EAA0E;AAC1E,iEAAiE;AACjE,iDAmCsB;AAGtB,qDAA6C;AAC7C,mDAA2D;AAE3D,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;AAO5D,MAAM,eAAe,GAAG,CAAkB,CAAI,EAAE,EAAE;AAChD,uEAAuE;AACvE,qBAAqB;AACpB,CAAW,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,aAAa,CAAA;AAC5C,oBAAoB;AAEpB,MAAM,CAAC,GAAG,6BAA6B,CAAA;AAEvC,iEAAiE;AACjE,MAAM,UAAU,GAAG,CAAiC,CAAM,EAAU,EAAE,CACpE,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AA6GnD,SAAgB,KAAK,CACnB,GAAW,EACX,IAUK,EACL,OASK;IAEL,IAAI,UAAU,CAAe,IAAI,CAAC,EAAE;QAClC,OAAO,GAAG,IAAI,CAAA;QACd,IAAI,GAAG,EAAE,CAAA;KACV;IACD,OAAO,IAAA,qBAAO,EAAC,GAAG,EAAE,IAAI,IAAI,EAAE,EAAE,IAAA,yBAAS,EAAC,OAAO,IAAI,EAAE,EAAE,IAAA,2BAAU,EAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;AAChF,CAAC;AA7BD,sBA6BC;AAmCD,SAAgB,SAAS,CACvB,GAAW,EACX,IAIyB,EACzB,OAGoC;IAEpC,IAAI,UAAU,CAAmB,IAAI,CAAC,EAAE;QACtC,OAAO,GAAG,IAAI,CAAA;QACd,IAAI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,IAAA,yBAAS,EAAC,OAAO,IAAI,EAAE,EAAE,IAAA,2BAAU,EAAC,CAAC,CAAC,EAAE,IAAyB,CAAC,CACnE,CAAA;IACH,CAAC;IA5Ce,sBAAa,gBA4C5B,CAAA;IACD,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,aAAa,EAAE,CAAC,CAAA;IACvD,qBAAqB;AACvB,CAAC,EA5IgB,QAAQ,wBAAR,QAAQ,QA4IxB;AAmCD,SAAgB,YAAY,CAC1B,IAAY,EACZ,IAIyD,EACzD,OAGyD;IAEzD,IACE,IAAI;QACJ,OAAO,IAAI,KAAK,QAAQ;QACxB,UAAU,CAIR,IAAI,CAAC,EACP;QACA,OAAO,GAAG,IAAI,CAAA;QACd,IAAI,GAAG,EAAE,CAAA;KACV;IACD,OAAO,IAAA,4BAAc,EACnB,IAAI,EACJ,IAAI,IAAI,EAAE,EACV,IAAA,yBAAS,EAAC,OAAO,IAAI,EAAE,EAAE,IAAA,2BAAU,EAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAC9C,CAAA;AACH,CAAC;AA7BD,oCA6BC;AAWD,SAAgB,IAAI,CAClB,UAAkB,EAClB,IAA0C,EAC1C,OAAqC;IAErC,IAAI,UAAU,CAAc,IAAI,CAAC,EAAE;QACjC,OAAO,GAAG,IAAI,CAAA;QACd,IAAI,GAAG,EAAE,CAAA;KACV;IACD,OAAO,IAAA,oBAAM,EAAC,UAAU,EAAE,IAAI,EAAE,IAAA,yBAAS,EAAC,OAAO,IAAI,EAAE,EAAE,IAAA,2BAAU,EAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;AAChF,CAAC;AAVD,oBAUC","sourcesContent":["// This wraps all of the various spawn methods such that externalID can be\n// set in the options, and ensuring that the proper envs get set.\nimport {\n ChildProcess,\n ChildProcessByStdio,\n ChildProcessWithoutNullStreams,\n exec as cpExec,\n ExecException,\n execFile as cpExecFile,\n ExecFileException,\n ExecFileOptions,\n ExecFileOptionsWithBufferEncoding,\n ExecFileOptionsWithOtherEncoding,\n ExecFileOptionsWithStringEncoding,\n execFileSync as cpExecFileSync,\n ExecFileSyncOptions,\n ExecFileSyncOptionsWithBufferEncoding,\n ExecFileSyncOptionsWithStringEncoding,\n ExecOptions,\n execSync as cpExecSync,\n ExecSyncOptions,\n ExecSyncOptionsWithBufferEncoding,\n ExecSyncOptionsWithStringEncoding,\n fork as cpFork,\n ForkOptions,\n PromiseWithChild,\n spawn as cpSpawn,\n SpawnOptions,\n SpawnOptionsWithoutStdio,\n SpawnOptionsWithStdioTuple,\n spawnSync as cpSpawnSync,\n SpawnSyncOptions,\n SpawnSyncOptionsWithBufferEncoding,\n SpawnSyncOptionsWithStringEncoding,\n SpawnSyncReturns,\n StdioNull,\n StdioPipe,\n} from 'child_process'\nimport type { ObjectEncodingOptions } from 'fs'\nimport type { Readable, Writable } from 'stream'\nimport { getExclude } from './get-exclude.js'\nimport { spawnOpts, WithExternalID } from './spawn-opts.js'\n\nconst promisify = Symbol.for('nodejs.util.promisify.custom')\n\n// pull the old __promisify__ out of node's declared namespaces\ntype CP<T extends { __promisify__: any }> = T & {\n [promisify]: T['__promisify__']\n}\ntype OldCP = { __promisify__: (...a: any) => any }\nconst customPromisify = <T extends OldCP>(e: T) =>\n // the node types list it as __promisify__ but it's actually the symbol\n /* c8 ignore start */\n (e as CP<T>)[promisify] || e.__promisify__\n/* c8 ignore stop */\n\nconst k = '_TAPJS_PROCESSINFO_EXCLUDE_'\n\n// coercion function when we know it's an array or something else\nconst isNotArray = <T extends { [k: string]: any }>(o: any): o is T =>\n !!o && typeof o === 'object' && !Array.isArray(o)\n\nexport function spawn(\n command: string,\n options?: WithExternalID<SpawnOptionsWithoutStdio>\n): ChildProcessWithoutNullStreams\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>\n >\n): ChildProcessByStdio<Writable, Readable, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>\n >\n): ChildProcessByStdio<Writable, Readable, null>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>\n >\n): ChildProcessByStdio<Writable, null, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>\n >\n): ChildProcessByStdio<null, Readable, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>\n >\n): ChildProcessByStdio<Writable, null, null>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>\n >\n): ChildProcessByStdio<null, Readable, null>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>\n >\n): ChildProcessByStdio<null, null, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>\n >\n): ChildProcessByStdio<null, null, null>\nexport function spawn(\n command: string,\n options: WithExternalID<SpawnOptions>\n): ChildProcess\nexport function spawn(\n command: string,\n args?: ReadonlyArray<string>,\n options?: SpawnOptionsWithoutStdio\n): ChildProcessWithoutNullStreams\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>\n): ChildProcessByStdio<Writable, Readable, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>\n): ChildProcessByStdio<Writable, Readable, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>\n): ChildProcessByStdio<Writable, null, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>\n): ChildProcessByStdio<null, Readable, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>\n): ChildProcessByStdio<Writable, null, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>\n): ChildProcessByStdio<null, Readable, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>\n): ChildProcessByStdio<null, null, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>\n): ChildProcessByStdio<null, null, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptions\n): ChildProcess\n\nexport function spawn(\n cmd: string,\n args?:\n | ReadonlyArray<string>\n | WithExternalID<SpawnOptions>\n | WithExternalID<SpawnOptionsWithoutStdio>\n | WithExternalID<\n SpawnOptionsWithStdioTuple<\n StdioNull | StdioPipe,\n StdioNull | StdioPipe,\n StdioNull | StdioPipe\n >\n >,\n options?:\n | WithExternalID<SpawnOptions>\n | WithExternalID<SpawnOptionsWithoutStdio>\n | WithExternalID<\n SpawnOptionsWithStdioTuple<\n StdioNull | StdioPipe,\n StdioNull | StdioPipe,\n StdioNull | StdioPipe\n >\n >\n): ChildProcess | ChildProcessWithoutNullStreams {\n if (isNotArray<SpawnOptions>(args)) {\n options = args\n args = []\n }\n return cpSpawn(cmd, args || [], spawnOpts(options || {}, getExclude(k), args))\n}\n\nexport function spawnSync(command: string): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n options: WithExternalID<SpawnSyncOptionsWithStringEncoding>\n): SpawnSyncReturns<string>\nexport function spawnSync(\n command: string,\n options: WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n options?: WithExternalID<SpawnSyncOptions>\n): SpawnSyncReturns<string | Buffer>\nexport function spawnSync(\n command: string,\n args: ReadonlyArray<string>\n): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<SpawnSyncOptionsWithStringEncoding>\n): SpawnSyncReturns<string>\nexport function spawnSync(\n command: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n args?: ReadonlyArray<string>,\n options?: WithExternalID<SpawnSyncOptions>\n): SpawnSyncReturns<string | Buffer>\n\nexport function spawnSync(\n cmd: string,\n args?:\n | WithExternalID<SpawnSyncOptionsWithStringEncoding>\n | WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n | WithExternalID<SpawnSyncOptions>\n | ReadonlyArray<string>,\n options?:\n | WithExternalID<SpawnSyncOptionsWithStringEncoding>\n | WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n | WithExternalID<SpawnSyncOptions>\n) {\n if (isNotArray<SpawnSyncOptions>(args)) {\n options = args\n args = []\n }\n return cpSpawnSync(\n cmd,\n args || [],\n spawnOpts(options || {}, getExclude(k), args)\n )\n}\n\nexport type ExecArgs =\n | [\n command: string,\n callback?: (\n error: ExecException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<\n {\n encoding: 'buffer' | null\n } & ExecOptions\n >,\n callback?: (\n error: ExecException | null,\n stdout: Buffer,\n stderr: Buffer\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >,\n callback?: (\n error: ExecException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >,\n callback?: (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<ExecOptions>,\n callback?: (\n error: ExecException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n command: string,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecOptions>\n | undefined\n | null,\n callback?: (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\nexport function exec(...args: ExecArgs): ChildProcess {\n const [cmd, options, callback] = args\n if (typeof options === 'function') {\n return cpExec(cmd, spawnOpts<ExecOptions>({}, getExclude(k), []), options)\n } else if (!options) {\n return cpExec(\n cmd,\n spawnOpts<ExecOptions>({}, getExclude(k), []),\n callback as (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n )\n }\n\n return cpExec(\n cmd,\n spawnOpts(options, getExclude(k), []),\n callback as (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n )\n}\n\nexport namespace exec {\n export function __promisify__(command: string): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n command: string,\n options: WithExternalID<\n {\n encoding: 'buffer' | null\n } & ExecOptions\n >\n ): PromiseWithChild<{\n stdout: Buffer\n stderr: Buffer\n }>\n export function __promisify__(\n command: string,\n options: WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n command: string,\n options: WithExternalID<ExecOptions>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n command: string,\n options?: WithExternalID<ObjectEncodingOptions & ExecOptions> | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n command: string,\n options?:\n | WithExternalID<\n {\n encoding: 'buffer' | null\n } & ExecOptions\n >\n | WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >\n | WithExternalID<ExecOptions>\n | WithExternalID<ObjectEncodingOptions & ExecOptions>\n | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }> {\n return customPromisify(cpExec)(\n command,\n spawnOpts(options || {}, getExclude(k))\n )\n }\n\n Object.assign(exec, { [promisify]: __promisify__ })\n /* c8 ignore start */\n}\n/* c8 ignore stop */\n\nexport function execSync(command: string): Buffer\nexport function execSync(\n command: string,\n options: WithExternalID<ExecSyncOptionsWithStringEncoding>\n): string\nexport function execSync(\n command: string,\n options: WithExternalID<ExecSyncOptionsWithBufferEncoding>\n): Buffer\nexport function execSync(\n command: string,\n options?: WithExternalID<ExecSyncOptions>\n): string | Buffer\nexport function execSync(\n cmd: string,\n options?:\n | WithExternalID<ExecSyncOptions>\n | WithExternalID<ExecSyncOptionsWithBufferEncoding>\n | WithExternalID<ExecSyncOptionsWithStringEncoding>\n | WithExternalID<ExecSyncOptionsWithBufferEncoding>\n): string | Buffer {\n return cpExecSync(\n cmd,\n spawnOpts<ExecSyncOptions>(options || {}, getExclude(k))\n )\n}\n\nexport type ExecFileArgs =\n | []\n | [\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ]\n | [args?: ReadonlyArray<string> | null]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ]\n | [\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: Buffer,\n stderr: Buffer\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: Buffer,\n stderr: Buffer\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptionsWithStringEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithStringEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptions>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptions>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null,\n callback:\n | ((\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void)\n | undefined\n | null\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null,\n callback:\n | ((\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void)\n | undefined\n | null\n ]\nexport function execFile(\n file: string,\n ...execFileArgs: ExecFileArgs\n): ChildProcess {\n let args = []\n let options: WithExternalID<ObjectEncodingOptions & ExecFileOptions> = {}\n let callback: ((...a: any) => any) | undefined = undefined\n for (const arg of execFileArgs) {\n if (Array.isArray(arg)) {\n args = arg\n } else if (\n arg &&\n typeof arg === 'object' &&\n isNotArray<WithExternalID<ObjectEncodingOptions & ExecFileOptions>>(\n arg\n )\n ) {\n options = arg\n } else if (typeof arg === 'function') {\n callback = arg\n }\n }\n return cpExecFile(\n file,\n args,\n spawnOpts(options, getExclude(k), args),\n callback\n )\n}\n\nexport namespace execFile {\n export function __promisify__(file: string): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>\n ): PromiseWithChild<{\n stdout: Buffer\n stderr: Buffer\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>\n ): PromiseWithChild<{\n stdout: Buffer\n stderr: Buffer\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptionsWithStringEncoding>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithStringEncoding>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptions>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptions>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n args?:\n | ReadonlyArray<string>\n | undefined\n | null\n | WithExternalID<ExecFileOptionsWithBufferEncoding>\n | WithExternalID<ExecFileOptionsWithStringEncoding>\n | WithExternalID<ExecFileOptionsWithOtherEncoding>\n | WithExternalID<ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>,\n options?:\n | undefined\n | null\n | WithExternalID<ExecFileOptionsWithBufferEncoding>\n | WithExternalID<ExecFileOptionsWithStringEncoding>\n | WithExternalID<ExecFileOptionsWithOtherEncoding>\n | WithExternalID<ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }> {\n if (\n !!args &&\n typeof args === 'object' &&\n isNotArray<\n | WithExternalID<ExecFileOptionsWithBufferEncoding>\n | WithExternalID<ExecFileOptionsWithStringEncoding>\n | WithExternalID<ExecFileOptionsWithOtherEncoding>\n | WithExternalID<ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n >(args)\n ) {\n options = args\n args = []\n }\n return customPromisify(cpExecFile)(\n file,\n spawnOpts(options || {}, getExclude(k), args as readonly string[])\n )\n }\n Object.assign(execFile, { [promisify]: __promisify__ })\n /* c8 ignore start */\n}\n/* c8 ignore stop */\n\nexport function execFileSync(file: string): Buffer\nexport function execFileSync(\n file: string,\n options: WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n): string\nexport function execFileSync(\n file: string,\n options: WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n): Buffer\nexport function execFileSync(\n file: string,\n options?: WithExternalID<ExecFileSyncOptions>\n): string | Buffer\nexport function execFileSync(\n file: string,\n args: ReadonlyArray<string>\n): Buffer\nexport function execFileSync(\n file: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n): string\nexport function execFileSync(\n file: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n): Buffer\nexport function execFileSync(\n file: string,\n args?: ReadonlyArray<string>,\n options?: WithExternalID<ExecFileSyncOptions>\n): string | Buffer\nexport function execFileSync(\n file: string,\n args?:\n | ReadonlyArray<string>\n | WithExternalID<ExecFileSyncOptions>\n | WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n | WithExternalID<ExecFileSyncOptionsWithBufferEncoding>,\n options?:\n | WithExternalID<ExecFileSyncOptions>\n | WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n | WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n): string | Buffer {\n if (\n args &&\n typeof args === 'object' &&\n isNotArray<\n | WithExternalID<ExecFileSyncOptions>\n | WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n | WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n >(args)\n ) {\n options = args\n args = []\n }\n return cpExecFileSync(\n file,\n args || [],\n spawnOpts(options || {}, getExclude(k), args)\n )\n}\n\nexport function fork(\n modulePath: string,\n options?: ForkOptions\n): ChildProcess\nexport function fork(\n modulePath: string,\n args?: ReadonlyArray<string>,\n options?: WithExternalID<ForkOptions>\n): ChildProcess\nexport function fork(\n modulePath: string,\n args?: ForkOptions | ReadonlyArray<string>,\n options?: WithExternalID<ForkOptions>\n): ChildProcess {\n if (isNotArray<ForkOptions>(args)) {\n options = args\n args = []\n }\n return cpFork(modulePath, args, spawnOpts(options || {}, getExclude(k), args))\n}\n"]}
|
|
@@ -14,7 +14,7 @@ const register_coverage_js_1 = require("./register-coverage.js");
|
|
|
14
14
|
const register_env_js_1 = require("./register-env.js");
|
|
15
15
|
const register_process_end_js_1 = require("./register-process-end.js");
|
|
16
16
|
const register_require_js_1 = require("./register-require.js");
|
|
17
|
-
// this module is hybridized. In node v20.0
|
|
17
|
+
// this module is hybridized. In node v20.0 - v20.6, it's the *commonjs* one
|
|
18
18
|
// that gets loaded, because the esm loader context can't modify the main
|
|
19
19
|
// thread except via communication over the port to the globalPreload env. So,
|
|
20
20
|
// we have to store our singleton on the global.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-process-info.js","sourceRoot":"","sources":["../../src/get-process-info.ts"],"names":[],"mappings":";;;AAAA,sBAAsB;AACtB,MAAM,CAAC,GAAG,OAGT,CAAA;AACD,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAA;AAE5B,+BAAiC;AACjC,+CAAuC;AAGvC,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,sBAAsB,CAAC,CAAC,WAAW,EAAE,GAAG,CAAA;AACtE,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AAC9C,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;AAC/D,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AAErD,iEAAqE;AACrE,uDAA2D;AAC3D,uEAA0E;AAC1E,+DAAmE;AAEnE,6EAA6E;AAC7E,yEAAyE;AACzE,8EAA8E;AAC9E,gDAAgD;AAChD,EAAE;AACF,4EAA4E;AAC5E,mEAAmE;AACnE,EAAE;AACF,2EAA2E;AAE3E,MAAM,YAAY,GAA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,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;KACtC;IACD,oDAAoD;IACpD,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAA;IACtC,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;IACxC,IAAI,UAAU,EAAE;QACd,CAAC,CAAC,YAAY,CAAC,CAAC,UAAU,GAAG,UAAU,CAAA;QACvC,gEAAgE;QAChE,MAAM,CAAC,aAAa,CAAC,CAAA;KACtB;IAED,kDAAkD;IAClD,iEAAiE;IACjE,sCAAsC;IACtC,qBAAqB;IACrB,IACE,OAAO,CAAC,GAAG,CAAC,yCAAyC;QACrD,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EACnB;QACA,IAAA,8BAAe,GAAE,CAAA;QACjB,IAAA,0BAAW,GAAE,CAAA;QACb,IAAA,+BAAgB,GAAE,CAAA;QAClB,IAAA,kCAAkB,GAAE,CAAA;KACrB;IACD,oBAAoB;IAEpB,OAAO,CAAC,CAAC,YAAY,CAAC,CAAA;AACxB,CAAC,CAAA;AAjDY,QAAA,cAAc,kBAiD1B","sourcesContent":["// we always want this\nconst p = process as NodeJS.Process & {\n setSourceMapsEnabled(v: boolean): void\n _eval?: string\n}\np.setSourceMapsEnabled(true)\n\nimport { v4 as uuid } from 'uuid'\nimport { getMain } from './get-main.js'\nimport { ProcessInfoNodeData } from './process-info-node.js'\n\nconst envKey = (k: string) => `_TAPJS_PROCESSINFO_${k.toUpperCase()}_`\nconst getEnv = (k: string) => p.env[envKey(k)]\nconst setEnv = (k: string, v: string) => (p.env[envKey(k)] = v)\nconst delEnv = (k: string) => delete p.env[envKey(k)]\n\nimport { register as registerCoverage } from './register-coverage.js'\nimport { register as registerEnv } from './register-env.js'\nimport { register as registerProcessEnd } from './register-process-end.js'\nimport { register as registerRequire } from './register-require.js'\n\n// this module is hybridized. In node v20.0
|
|
1
|
+
{"version":3,"file":"get-process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ED,kDAAkD;IAClD,iEAAiE;IACjE,sCAAsC;IACtC,qBAAqB;IACrB,IACE,OAAO,CAAC,GAAG,CAAC,yCAAyC;QACrD,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EACnB;QACA,IAAA,8BAAe,GAAE,CAAA;QACjB,IAAA,0BAAW,GAAE,CAAA;QACb,IAAA,+BAAgB,GAAE,CAAA;QAClB,IAAA,kCAAkB,GAAE,CAAA;KACrB;IACD,oBAAoB;IAEpB,OAAO,CAAC,CAAC,YAAY,CAAC,CAAA;AACxB,CAAC,CAAA;AAjDY,QAAA,cAAc,kBAiD1B","sourcesContent":["// we always want this\nconst p = process as NodeJS.Process & {\n setSourceMapsEnabled(v: boolean): void\n _eval?: string\n}\np.setSourceMapsEnabled(true)\n\nimport { v4 as uuid } from 'uuid'\nimport { getMain } from './get-main.js'\nimport { ProcessInfoNodeData } from './process-info-node.js'\n\nconst envKey = (k: string) => `_TAPJS_PROCESSINFO_${k.toUpperCase()}_`\nconst getEnv = (k: string) => p.env[envKey(k)]\nconst setEnv = (k: string, v: string) => (p.env[envKey(k)] = v)\nconst delEnv = (k: string) => delete p.env[envKey(k)]\n\nimport { register as registerCoverage } from './register-coverage.js'\nimport { register as registerEnv } from './register-env.js'\nimport { register as registerProcessEnd } from './register-process-end.js'\nimport { register as registerRequire } from './register-require.js'\n\n// this module is hybridized. In node v20.0 - v20.6, it's the *commonjs* one\n// that gets loaded, because the esm loader context can't modify the main\n// thread except via communication over the port to the globalPreload env. So,\n// we have to store our singleton on the global.\n//\n// If it later loads the esm form of this module, that's fine, because it'll\n// see the global processInfo object, and not re-register anything.\n//\n// CJS registration can be removed once node < 20.6 is no longer supported.\n\nconst kProcessInfo = Symbol.for('@tapjs/processinfo.ProcessInfoNodeData')\nconst g = global as typeof globalThis & {\n [kProcessInfo]?: ProcessInfoNodeData\n}\n\n// only used for tests so we can simulate multiple processes\nexport const reset = () => {\n g[kProcessInfo] = undefined\n return { getProcessInfo }\n}\n\nexport const getProcessInfo = (): ProcessInfoNodeData => {\n if (g[kProcessInfo]) return g[kProcessInfo]\n\n g[kProcessInfo] = {\n hrstart: p.hrtime(),\n date: new Date().toISOString(),\n argv: p.argv,\n execArgv: p.execArgv,\n NODE_OPTIONS: p.env.NODE_OPTIONS,\n cwd: p.cwd(),\n pid: p.pid,\n ppid: p.ppid,\n parent: getEnv('parent') || null,\n uuid: uuid(),\n files: [getMain()],\n sources: Object.create(null),\n }\n\n if (!g[kProcessInfo].parent) {\n g[kProcessInfo].root = g[kProcessInfo].uuid\n setEnv('root', g[kProcessInfo].uuid)\n } else {\n g[kProcessInfo].root = getEnv('root')\n }\n // this is the parent of any further child processes\n setEnv('parent', g[kProcessInfo].uuid)\n const externalID = getEnv('external_id')\n if (externalID) {\n g[kProcessInfo].externalID = externalID\n // externalID only applies to ONE process, not all its children.\n delEnv('external_id')\n }\n\n // switch to turn off registration for some tests.\n // excluded from coverage because that's the reason why it's here\n // in the first place, it confuses c8.\n /* c8 ignore start */\n if (\n process.env.__TAPJS_PROCESSINFO_TESTING_NO_REGISTER__ !==\n String(process.pid)\n ) {\n registerRequire()\n registerEnv()\n registerCoverage()\n registerProcessEnd()\n }\n /* c8 ignore stop */\n\n return g[kProcessInfo]\n}\n"]}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
/// <reference types="node" />
|
|
5
|
-
export declare const nodeOptionsEnv: (env: NodeJS.ProcessEnv) => string;
|
|
5
|
+
export declare const nodeOptionsEnv: (env: NodeJS.ProcessEnv, args: readonly string[]) => string;
|
|
6
6
|
//# sourceMappingURL=node-options-env.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-options-env.d.ts","sourceRoot":"","sources":["../../src/node-options-env.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"node-options-env.d.ts","sourceRoot":"","sources":["../../src/node-options-env.ts"],"names":[],"mappings":";;;;AAoKA,eAAO,MAAM,cAAc,QACpB,OAAO,UAAU,QAChB,SAAS,MAAM,EAAE,WAKxB,CAAA"}
|
|
@@ -27,6 +27,73 @@ const getKeyValue = (args, i) => {
|
|
|
27
27
|
};
|
|
28
28
|
const useImport = !!node_module_1.default
|
|
29
29
|
.register;
|
|
30
|
+
// JUST test if we need to do anything at all with the env.
|
|
31
|
+
// if the loader is set already in the args, even incorrectly, return true
|
|
32
|
+
const hasLoader = (args) => {
|
|
33
|
+
for (let i = 0; i < args.length; i++) {
|
|
34
|
+
const arg = args[i];
|
|
35
|
+
/* c8 ignore start */
|
|
36
|
+
if (typeof arg !== 'string')
|
|
37
|
+
throw new Error('invalid arg');
|
|
38
|
+
/* c8 ignore stop */
|
|
39
|
+
if (!arg.startsWith('--') || arg === '--')
|
|
40
|
+
break;
|
|
41
|
+
const [eq, k, v] = getKeyValue(args, i);
|
|
42
|
+
if (!v) {
|
|
43
|
+
// wasn't a key-value pair
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (!eq)
|
|
47
|
+
i++;
|
|
48
|
+
if ((k === '--experimental-loader' || k === '--loader') &&
|
|
49
|
+
(0, loader_paths_js_1.legacyMatch)(v)) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
if (k === '--import' && (0, loader_paths_js_1.importMatch)(v))
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
};
|
|
57
|
+
const rmLoader = (args) => {
|
|
58
|
+
const doNotWantKeys = ['--experimental-loader', '--loader', '--import'];
|
|
59
|
+
const result = [];
|
|
60
|
+
let doubledash = false;
|
|
61
|
+
for (let i = 0; i < args.length; i++) {
|
|
62
|
+
const arg = args[i];
|
|
63
|
+
/* c8 ignore start */
|
|
64
|
+
if (typeof arg !== 'string')
|
|
65
|
+
throw new Error('invalid arg');
|
|
66
|
+
/* c8 ignore stop */
|
|
67
|
+
if (!arg.startsWith('--') || doubledash) {
|
|
68
|
+
result.push(arg);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (arg === '--') {
|
|
72
|
+
result.push(arg);
|
|
73
|
+
doubledash = true;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const [eq, k, v] = getKeyValue(args, i);
|
|
77
|
+
if (!v) {
|
|
78
|
+
// wasn't a key-value pair
|
|
79
|
+
result.push(arg);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (!eq)
|
|
83
|
+
i++;
|
|
84
|
+
if (doNotWantKeys.includes(k) && ((0, loader_paths_js_1.importMatch)(v) || (0, loader_paths_js_1.legacyMatch)(v))) {
|
|
85
|
+
// it's ours, remove it
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
// not ours, leave it
|
|
89
|
+
result.push(arg);
|
|
90
|
+
const next = args[i];
|
|
91
|
+
if (!eq && typeof next === 'string')
|
|
92
|
+
result.push(next);
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
return result;
|
|
96
|
+
};
|
|
30
97
|
const addLoader = (args) => {
|
|
31
98
|
const addKey = useImport ? '--import' : '--loader';
|
|
32
99
|
const addValue = useImport ? loader_paths_js_1.importLoader : loader_paths_js_1.legacyLoader;
|
|
@@ -35,7 +102,7 @@ const addLoader = (args) => {
|
|
|
35
102
|
useImport ? '--loader' : '--import',
|
|
36
103
|
];
|
|
37
104
|
const test = useImport ? loader_paths_js_1.importMatch : loader_paths_js_1.legacyMatch;
|
|
38
|
-
const
|
|
105
|
+
const result = [];
|
|
39
106
|
let doubledash = false;
|
|
40
107
|
let found = false;
|
|
41
108
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -45,18 +112,18 @@ const addLoader = (args) => {
|
|
|
45
112
|
throw new Error('invalid arg');
|
|
46
113
|
/* c8 ignore stop */
|
|
47
114
|
if (!arg.startsWith('--') || doubledash) {
|
|
48
|
-
|
|
115
|
+
result.push(arg);
|
|
49
116
|
continue;
|
|
50
117
|
}
|
|
51
118
|
if (arg === '--') {
|
|
52
|
-
|
|
119
|
+
result.push(arg);
|
|
53
120
|
doubledash = true;
|
|
54
121
|
continue;
|
|
55
122
|
}
|
|
56
123
|
const [eq, k, v] = getKeyValue(args, i);
|
|
57
124
|
if (!v) {
|
|
58
125
|
// wasn't a key-value pair
|
|
59
|
-
|
|
126
|
+
result.push(arg);
|
|
60
127
|
continue;
|
|
61
128
|
}
|
|
62
129
|
if (!eq)
|
|
@@ -70,31 +137,32 @@ const addLoader = (args) => {
|
|
|
70
137
|
if (found)
|
|
71
138
|
continue;
|
|
72
139
|
found = true;
|
|
73
|
-
|
|
140
|
+
result.push(arg);
|
|
74
141
|
const next = args[i];
|
|
75
142
|
if (!eq && typeof next === 'string')
|
|
76
|
-
|
|
143
|
+
result.push(next);
|
|
77
144
|
}
|
|
78
145
|
else {
|
|
79
146
|
// not ours
|
|
80
|
-
|
|
147
|
+
result.push(arg);
|
|
81
148
|
const next = args[i];
|
|
82
149
|
if (!eq && typeof next === 'string')
|
|
83
|
-
|
|
150
|
+
result.push(next);
|
|
84
151
|
continue;
|
|
85
152
|
}
|
|
86
153
|
}
|
|
87
154
|
if (!found)
|
|
88
|
-
|
|
89
|
-
return !useImport ? addIgnoreLoadersWarning(
|
|
155
|
+
result.push(`${addKey}=${addValue}`);
|
|
156
|
+
return !useImport ? addIgnoreLoadersWarning(result) : result;
|
|
90
157
|
};
|
|
91
158
|
const addIgnoreLoadersWarning = (args) => args.includes('--no-warnings') ||
|
|
92
159
|
args.includes('--no-warnings=ExperimentalLoader')
|
|
93
160
|
? args
|
|
94
161
|
: args.concat('--no-warnings');
|
|
95
|
-
const nodeOptionsEnv = (env) => {
|
|
162
|
+
const nodeOptionsEnv = (env, args) => {
|
|
163
|
+
// if we already have the loader in args, don't add to NODE_OPTIONS
|
|
96
164
|
const no = (0, node_options_to_argv_js_1.nodeOptionsToArgv)(env.NODE_OPTIONS);
|
|
97
|
-
return (0, argv_to_node_options_js_1.argvToNodeOptions)(addLoader(no));
|
|
165
|
+
return (0, argv_to_node_options_js_1.argvToNodeOptions)(hasLoader(args) ? rmLoader(no) : addLoader(no));
|
|
98
166
|
};
|
|
99
167
|
exports.nodeOptionsEnv = nodeOptionsEnv;
|
|
100
168
|
//# sourceMappingURL=node-options-env.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-options-env.js","sourceRoot":"","sources":["../../src/node-options-env.ts"],"names":[],"mappings":";;;;;;AAAA,uEAA6D;AAC7D,uDAK0B;AAC1B,uEAA6D;AAE7D,8DAAgC;AAEhC,MAAM,WAAW,GAAG,CAClB,IAAc,EACd,CAAS,EAC8B,EAAE;IACzC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,qBAAqB;IACrB,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAA;IAC3D,oBAAoB;IACpB,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACrB,MAAM,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAA0B,CAAA;QAC5D,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;KACjC;SAAM,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QAC9B,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;KACjC;SAAM;QACL,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,CAAC,CAAA;KAC/B;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,CAAE,qBAA8C;KAChE,QAAQ,CAAA;AAEX,MAAM,SAAS,GAAG,CAAC,IAAc,EAAE,EAAE;IACnC,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CA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,CAAC,GAAsB,EAAE,EAAE;IACvD,MAAM,EAAE,GAAG,IAAA,2CAAiB,EAAC,GAAG,CAAC,YAAY,CAAC,CAAA;IAC9C,OAAO,IAAA,2CAAiB,EAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAA;AACzC,CAAC,CAAA;AAHY,QAAA,cAAc,kBAG1B","sourcesContent":["import { argvToNodeOptions } from './argv-to-node-options.js'\nimport {\n legacyLoader,\n legacyMatch,\n importLoader,\n importMatch,\n} from './loader-paths.js'\nimport { nodeOptionsToArgv } from './node-options-to-argv.js'\n\nimport Module from 'node:module'\n\nconst getKeyValue = (\n args: string[],\n i: number\n): [boolean, string, string | undefined] => {\n const arg = args[i]\n /* c8 ignore start */\n if (typeof arg !== 'string') throw new Error('invalid arg')\n /* c8 ignore stop */\n if (arg.includes('=')) {\n const [k, ...rest] = arg.split('=') as [string, ...string[]]\n return [true, k, rest.join('=')]\n } else if (i < args.length - 1) {\n return [false, arg, args[i + 1]]\n } else {\n return [false, arg, undefined]\n }\n}\n\nconst useImport = !!(Module as { register?: (...a: any[]) => any })\n .register\n\nconst addLoader = (args: string[]) => {\n const addKey = useImport ? '--import' : '--loader'\n const addValue = useImport ? importLoader : legacyLoader\n const doNotWantKeys = [\n '--experimental-loader',\n useImport ? '--loader' : '--import',\n ]\n const test = useImport ? importMatch : legacyMatch\n\n const added: string[] = []\n\n let doubledash = false\n let found = false\n for (let i = 0; i < args.length; i++) {\n const arg = args[i]\n /* c8 ignore start */\n if (typeof arg !== 'string') throw new Error('invalid arg')\n /* c8 ignore stop */\n if (!arg.startsWith('--') || doubledash) {\n added.push(arg)\n continue\n }\n if (arg === '--') {\n added.push(arg)\n doubledash = true\n continue\n }\n\n const [eq, k, v] = getKeyValue(args, i)\n if (!v) {\n // wasn't a key-value pair\n added.push(arg)\n continue\n }\n if (!eq) i++\n if (doNotWantKeys.includes(k) && (importMatch(v) || legacyMatch(v))) {\n // it's ours, but not how we want it, omit\n continue\n }\n\n if (k === addKey && test(v)) {\n // already present, don't let it be set multiple times.\n if (found) continue\n found = true\n added.push(arg)\n const next = args[i]\n if (!eq && typeof next === 'string') added.push(next)\n } else {\n // not ours\n added.push(arg)\n const next = args[i]\n if (!eq && typeof next === 'string') added.push(next)\n continue\n }\n }\n if (!found) added.push(`${addKey}=${addValue}`)\n return !useImport ? addIgnoreLoadersWarning(added) : added\n}\n\nconst addIgnoreLoadersWarning = (args: readonly string[]) =>\n args.includes('--no-warnings') ||\n args.includes('--no-warnings=ExperimentalLoader')\n ? args\n : args.concat('--no-warnings')\n\nexport const nodeOptionsEnv = (env: NodeJS.ProcessEnv) => {\n const no = nodeOptionsToArgv(env.NODE_OPTIONS)\n return argvToNodeOptions(addLoader(no))\n}\n"]}
|
|
1
|
+
{"version":3,"file":"node-options-env.js","sourceRoot":"","sources":["../../src/node-options-env.ts"],"names":[],"mappings":";;;;;;AAAA,uEAA6D;AAC7D,uDAK0B;AAC1B,uEAA6D;AAE7D,8DAAgC;AAEhC,MAAM,WAAW,GAAG,CAClB,IAAuB,EACvB,CAAS,EAC8B,EAAE;IACzC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,qBAAqB;IACrB,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAA;IAC3D,oBAAoB;IACpB,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACrB,MAAM,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAA0B,CAAA;QAC5D,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;KACjC;SAAM,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QAC9B,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,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eAAe,CAAC;IAC9B,IAAI,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IAC/C,CAAC,CAAC,IAAI;IACN,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAA;AAE3B,MAAM,cAAc,GAAG,CAC5B,GAAsB,EACtB,IAAuB,EACvB,EAAE;IACF,mEAAmE;IACnE,MAAM,EAAE,GAAG,IAAA,2CAAiB,EAAC,GAAG,CAAC,YAAY,CAAC,CAAA;IAC9C,OAAO,IAAA,2CAAiB,EAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAA;AAC1E,CAAC,CAAA;AAPY,QAAA,cAAc,kBAO1B","sourcesContent":["import { argvToNodeOptions } from './argv-to-node-options.js'\nimport {\n importLoader,\n importMatch,\n legacyLoader,\n legacyMatch,\n} from './loader-paths.js'\nimport { nodeOptionsToArgv } from './node-options-to-argv.js'\n\nimport Module from 'node:module'\n\nconst getKeyValue = (\n args: readonly string[],\n i: number\n): [boolean, string, string | undefined] => {\n const arg = args[i]\n /* c8 ignore start */\n if (typeof arg !== 'string') throw new Error('invalid arg')\n /* c8 ignore stop */\n if (arg.includes('=')) {\n const [k, ...rest] = arg.split('=') as [string, ...string[]]\n return [true, k, rest.join('=')]\n } else if (i < args.length - 1) {\n return [false, arg, args[i + 1]]\n } else {\n return [false, arg, undefined]\n }\n}\n\nconst useImport = !!(Module as { register?: (...a: any[]) => any })\n .register\n\n// JUST test if we need to do anything at all with the env.\n// if the loader is set already in the args, even incorrectly, return true\nconst hasLoader = (args: readonly string[]): boolean => {\n for (let i = 0; i < args.length; i++) {\n const arg = args[i]\n /* c8 ignore start */\n if (typeof arg !== 'string') throw new Error('invalid arg')\n /* c8 ignore stop */\n if (!arg.startsWith('--') || arg === '--') break\n const [eq, k, v] = getKeyValue(args, i)\n if (!v) {\n // wasn't a key-value pair\n continue\n }\n if (!eq) i++\n if (\n (k === '--experimental-loader' || k === '--loader') &&\n legacyMatch(v)\n ) {\n return true\n }\n if (k === '--import' && importMatch(v)) return true\n }\n return false\n}\n\nconst rmLoader = (args: string[]) => {\n const doNotWantKeys = ['--experimental-loader', '--loader', '--import']\n\n const result: string[] = []\n\n let doubledash = false\n for (let i = 0; i < args.length; i++) {\n const arg = args[i]\n /* c8 ignore start */\n if (typeof arg !== 'string') throw new Error('invalid arg')\n /* c8 ignore stop */\n if (!arg.startsWith('--') || doubledash) {\n result.push(arg)\n continue\n }\n if (arg === '--') {\n result.push(arg)\n doubledash = true\n continue\n }\n\n const [eq, k, v] = getKeyValue(args, i)\n if (!v) {\n // wasn't a key-value pair\n result.push(arg)\n continue\n }\n if (!eq) i++\n if (doNotWantKeys.includes(k) && (importMatch(v) || legacyMatch(v))) {\n // it's ours, remove it\n continue\n }\n // not ours, leave it\n result.push(arg)\n const next = args[i]\n if (!eq && typeof next === 'string') result.push(next)\n continue\n }\n return result\n}\n\nconst addLoader = (args: string[]) => {\n const addKey = useImport ? '--import' : '--loader'\n const addValue = useImport ? importLoader : legacyLoader\n const doNotWantKeys = [\n '--experimental-loader',\n useImport ? '--loader' : '--import',\n ]\n const test = useImport ? importMatch : legacyMatch\n\n const result: string[] = []\n\n let doubledash = false\n let found = false\n for (let i = 0; i < args.length; i++) {\n const arg = args[i]\n /* c8 ignore start */\n if (typeof arg !== 'string') throw new Error('invalid arg')\n /* c8 ignore stop */\n if (!arg.startsWith('--') || doubledash) {\n result.push(arg)\n continue\n }\n if (arg === '--') {\n result.push(arg)\n doubledash = true\n continue\n }\n\n const [eq, k, v] = getKeyValue(args, i)\n if (!v) {\n // wasn't a key-value pair\n result.push(arg)\n continue\n }\n if (!eq) i++\n if (doNotWantKeys.includes(k) && (importMatch(v) || legacyMatch(v))) {\n // it's ours, but not how we want it, omit\n continue\n }\n\n if (k === addKey && test(v)) {\n // already present, don't let it be set multiple times.\n if (found) continue\n found = true\n result.push(arg)\n const next = args[i]\n if (!eq && typeof next === 'string') result.push(next)\n } else {\n // not ours\n result.push(arg)\n const next = args[i]\n if (!eq && typeof next === 'string') result.push(next)\n continue\n }\n }\n if (!found) result.push(`${addKey}=${addValue}`)\n return !useImport ? addIgnoreLoadersWarning(result) : result\n}\n\nconst addIgnoreLoadersWarning = (args: readonly string[]) =>\n args.includes('--no-warnings') ||\n args.includes('--no-warnings=ExperimentalLoader')\n ? args\n : args.concat('--no-warnings')\n\nexport const nodeOptionsEnv = (\n env: NodeJS.ProcessEnv,\n args: readonly string[]\n) => {\n // if we already have the loader in args, don't add to NODE_OPTIONS\n const no = nodeOptionsToArgv(env.NODE_OPTIONS)\n return argvToNodeOptions(hasLoader(args) ? rmLoader(no) : addLoader(no))\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-coverage.d.ts","sourceRoot":"","sources":["../../src/register-coverage.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"register-coverage.d.ts","sourceRoot":"","sources":["../../src/register-coverage.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AASxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAE5D,eAAO,IAAI,OAAO,EAAE,OAAO,GAAG,SAAqB,CAAA;AAwEnD,eAAO,MAAM,QAAQ,YAYpB,CAAA;AAGD,eAAO,MAAM,oBAAoB,QAC1B,MAAM,eACE,mBAAmB,SAuEjC,CAAA"}
|
|
@@ -9,6 +9,7 @@ const node_fs_1 = require("node:fs");
|
|
|
9
9
|
const node_inspector_1 = require("node:inspector");
|
|
10
10
|
const node_path_1 = require("node:path");
|
|
11
11
|
const node_url_1 = require("node:url");
|
|
12
|
+
const canonical_source_js_1 = require("./canonical-source.js");
|
|
12
13
|
const find_source_map_safe_js_1 = require("./find-source-map-safe.js");
|
|
13
14
|
const get_exclude_js_1 = require("./get-exclude.js");
|
|
14
15
|
const line_lengths_js_1 = require("./line-lengths.js");
|
|
@@ -33,15 +34,25 @@ const uncoveredFiles = cxEnv
|
|
|
33
34
|
.filter(f => !!f);
|
|
34
35
|
const exclude = p.env._TAPJS_PROCESSINFO_COV_EXCLUDE_
|
|
35
36
|
? (0, get_exclude_js_1.getExclude)('_TAPJS_PROCESSINFO_COV_EXCLUDE_', false)
|
|
36
|
-
:
|
|
37
|
+
: /[\\\/]node_modules[\\\/]/;
|
|
38
|
+
const fileEx = (0, get_exclude_js_1.getExclude)('_TAPJS_PROCESSINFO_EXCLUDE_', false);
|
|
37
39
|
const fileCovered = (f, sources = [], files = []) => {
|
|
38
40
|
const testFiles = [f];
|
|
39
41
|
for (const src of sources || []) {
|
|
40
42
|
testFiles.push((0, node_path_1.resolve)(src.startsWith('file://') ? (0, node_url_1.fileURLToPath)(src) : src));
|
|
41
43
|
}
|
|
42
44
|
// never include coverage if the file is fully ignored.
|
|
43
|
-
if (!testFiles.some(f => files.includes(f)))
|
|
44
|
-
|
|
45
|
+
if (!testFiles.some(f => files.includes(f))) {
|
|
46
|
+
// just in case it was missed somehow, make sure it *should* be excluded
|
|
47
|
+
for (const f of testFiles) {
|
|
48
|
+
if (fileEx.test(f)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// otherwise, it was missed by the loader recording somehow
|
|
53
|
+
// this can happen with commonjs transpilations in some cases
|
|
54
|
+
files.push(f);
|
|
55
|
+
}
|
|
45
56
|
// if at least one of them are explicitly covered, then include it,
|
|
46
57
|
// otherwise omit if we explicitly listed
|
|
47
58
|
if (coveredFiles.length) {
|
|
@@ -102,6 +113,7 @@ const coverageOnProcessEnd = (cwd, processInfo) => {
|
|
|
102
113
|
if (!/^file:/.test(obj.url)) {
|
|
103
114
|
return false;
|
|
104
115
|
}
|
|
116
|
+
obj.url = (0, canonical_source_js_1.canonicalSource)(obj.url);
|
|
105
117
|
const f = (0, node_url_1.fileURLToPath)(obj.url);
|
|
106
118
|
// see if it has a source map
|
|
107
119
|
// need to look up via the url, not the file path, because mocks
|
|
@@ -122,7 +134,10 @@ const coverageOnProcessEnd = (cwd, processInfo) => {
|
|
|
122
134
|
//@ts-ignore
|
|
123
135
|
lineLengths: s?.lineLengths || (0, line_lengths_js_1.getLineLengths)(f),
|
|
124
136
|
/* c8 ignore stop */
|
|
125
|
-
data:
|
|
137
|
+
data: {
|
|
138
|
+
...payload,
|
|
139
|
+
sources: payload.sources?.map(s => (0, canonical_source_js_1.canonicalSource)(s)),
|
|
140
|
+
},
|
|
126
141
|
});
|
|
127
142
|
}
|
|
128
143
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-coverage.js","sourceRoot":"","sources":["../../src/register-coverage.ts"],"names":[],"mappings":";;;AAAA,sDAAsD;AACtD,8DAA8D;AAC9D,MAAM,CAAC,GAAG,OAAO,CAAA;AACjB,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,4BAA4B,KAAK,GAAG,CAAA;AAC1D,qCAAkD;AAClD,mDAAwC;AAExC,yCAAmC;AACnC,uCAAwC;AACxC,uEAA6D;AAC7D,qDAA6C;AAC7C,uDAAkD;AAClD,2DAAmD;AAGxC,QAAA,OAAO,GAAwB,SAAS,CAAA;AAEnD,4DAA4D;AAC5D,gEAAgE;AAChE,mEAAmE;AACnE,8DAA8D;AAC9D,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,6BAA6B,IAAI,EAAE,CAAA;AACvD,MAAM,YAAY,GAAa,KAAK;KACjC,IAAI,EAAE;KACN,KAAK,CAAC,IAAI,CAAC;KACX,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAEnB,uDAAuD;AACvD,oDAAoD;AACpD,qDAAqD;AACrD,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,qCAAqC,IAAI,EAAE,CAAA;A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E,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAA;QAC7D,qBAAqB;IACvB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AArEY,QAAA,oBAAoB,wBAqEhC;AACD,oBAAoB","sourcesContent":["// start tracking coverage, unless disabled explicltly\n// export so that we know to collect at the end of the process\nconst p = process\nconst enabled = p.env._TAPJS_PROCESSINFO_COVERAGE_ !== '0'\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { Session } from 'node:inspector'\nimport { SourceMapPayload } from 'node:module'\nimport { resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { findSourceMapSafe } from './find-source-map-safe.js'\nimport { getExclude } from './get-exclude.js'\nimport { getLineLengths } from './line-lengths.js'\nimport { lookupSources } from './lookup-sources.js'\nimport { ProcessInfoNodeData } from './process-info-node.js'\n\nexport let SESSION: Session | undefined = undefined\n\n// This is a \\n delimited list of files to show coverage for\n// If not set, or empty, then coverage is included for all files\n// that pass the exclusion RegExp filter. If included in this list,\n// then coverage will be recorded, even if it matches exclude.\nconst cfEnv = p.env._TAPJS_PROCESSINFO_COV_FILES_ || ''\nconst coveredFiles: string[] = cfEnv\n .trim()\n .split('\\n')\n .filter(f => !!f)\n\n// NB: coverage exclusion is in addition to processinfo\n// exclusion. Only show coverage for a file we care\n// about at least somewhat, but coverage is a subset.\nconst cxEnv = p.env._TAPJS_PROCESSINFO_COV_EXCLUDE_FILES_ || ''\nconst uncoveredFiles: string[] = cxEnv\n .trim()\n .split('\\n')\n .filter(f => !!f)\n\nconst exclude = p.env._TAPJS_PROCESSINFO_COV_EXCLUDE_\n ? getExclude('_TAPJS_PROCESSINFO_COV_EXCLUDE_', false)\n : undefined\n\nconst fileCovered = (\n f: string,\n sources: string[] = [],\n files: string[] = []\n) => {\n const testFiles = [f]\n for (const src of sources || []) {\n testFiles.push(\n resolve(src.startsWith('file://') ? fileURLToPath(src) : src)\n )\n }\n\n // never include coverage if the file is fully ignored.\n if (!testFiles.some(f => files.includes(f))) return false\n\n // if at least one of them are explicitly covered, then include it,\n // otherwise omit if we explicitly listed\n if (coveredFiles.length) {\n return testFiles.some(f => coveredFiles.includes(f))\n }\n\n // if any of the filenames are explicitly excluded, no coverage\n // otherwise, it is covered\n return !testFiles.some(\n f => uncoveredFiles.includes(f) || exclude?.test(f)\n )\n}\n\n// C8 can't see that this function runs, best theory is that it\n// collides with what it's doing with the coverage it's collecting\n// This ignore can possibly be removed once this is being tested\n// with a version of tap that uses this library, but it might just\n// be an unresolveable bootstrap problem.\n// The test does verify that it ran, because otherwise, there would\n// be no coverage, and it verifies that it gets the expected coverage.\n/* c8 ignore start */\nexport const register = () => {\n if (!enabled) return\n p.env._TAPJS_PROCESSINFO_COVERAGE_ = '1'\n\n SESSION = new Session()\n SESSION.connect()\n SESSION.post('Profiler.enable')\n SESSION.post('Runtime.enable')\n SESSION.post('Profiler.startPreciseCoverage', {\n callCount: true,\n detailed: true,\n })\n}\n/* c8 ignore stop */\n\nexport const coverageOnProcessEnd = (\n cwd: string,\n processInfo: ProcessInfoNodeData\n) => {\n // Similar to the coverage tracking bootstrap problem above, c8\n // doesn't see that this function runs, even though it DOES see\n // that the function defined below runs, which is weird.\n /* c8 ignore start */\n if (!SESSION) return\n const session = SESSION\n\n const f = `${cwd}/.tap/coverage/${processInfo.uuid}.json`\n mkdirSync(`${cwd}/.tap/coverage`, { recursive: true })\n\n session.post('Profiler.takePreciseCoverage', (er, cov) => {\n session.post('Profiler.stopPreciseCoverage')\n /* c8 ignore stop */\n\n // something very strange and bad happened\n /* c8 ignore start */\n if (er) {\n throw er\n }\n /* c8 ignore stop */\n\n // Create a source-map-cache that c8 uses in report generation\n const sourceMapCache: {\n [k: string]: {\n lineLengths: number[]\n data: SourceMapPayload\n }\n } = {}\n Object.assign(cov, {\n 'source-map-cache': sourceMapCache,\n })\n\n cov.result = cov.result.filter(obj => {\n if (!/^file:/.test(obj.url)) {\n return false\n }\n const f = fileURLToPath(obj.url)\n // see if it has a source map\n // need to look up via the url, not the file path, because mocks\n // attach a tapmock search param, which is in node's internal key.\n const sources = lookupSources(obj.url, true)\n if (!fileCovered(f, sources, processInfo.files)) {\n return false\n }\n // Most of the time this will be cached at the time of recording, but\n // if it's the last module loaded, or transpiled in-place by ts-node,\n // the sourcemap won't be pre-loaded and will have to be looked up.\n const s = findSourceMapSafe(obj.url)\n const { payload } = s || { payload: null }\n if (payload) {\n sourceMapCache[obj.url] = Object.assign(Object.create(null), {\n /* c8 ignore start */\n // node's SourceMap objects provide this as of 20.5.0\n //@ts-ignore\n lineLengths: s?.lineLengths || getLineLengths(f),\n /* c8 ignore stop */\n data: payload,\n })\n }\n return true\n })\n\n writeFileSync(f, JSON.stringify(cov, null, 2) + '\\n', 'utf8')\n /* c8 ignore start */\n })\n}\n/* c8 ignore stop */\n"]}
|
|
1
|
+
{"version":3,"file":"register-coverage.js","sourceRoot":"","sources":["../../src/register-coverage.ts"],"names":[],"mappings":";;;AAAA,sDAAsD;AACtD,8DAA8D;AAC9D,MAAM,CAAC,GAAG,OAAO,CAAA;AACjB,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,4BAA4B,KAAK,GAAG,CAAA;AAC1D,qCAAkD;AAClD,mDAAwC;AAExC,yCAAmC;AACnC,uCAAwC;AACxC,+DAAuD;AACvD,uEAA6D;AAC7D,qDAA6C;AAC7C,uDAAkD;AAClD,2DAAmD;AAGxC,QAAA,OAAO,GAAwB,SAAS,CAAA;AAEnD,4DAA4D;AAC5D,gEAAgE;AAChE,mEAAmE;AACnE,8DAA8D;AAC9D,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,6BAA6B,IAAI,EAAE,CAAA;AACvD,MAAM,YAAY,GAAa,KAAK;KACjC,IAAI,EAAE;KACN,KAAK,CAAC,IAAI,CAAC;KACX,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAEnB,uDAAuD;AACvD,oDAAoD;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,IAAI,EAAE,CAAA;YAC1C,IAAI,OAAO,EAAE;gBACX,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;oBAC3D,qBAAqB;oBACrB,qDAAqD;oBACrD,YAAY;oBACZ,WAAW,EAAE,CAAC,EAAE,WAAW,IAAI,IAAA,gCAAc,EAAC,CAAC,CAAC;oBAChD,oBAAoB;oBACpB,IAAI,EAAE;wBACJ,GAAG,OAAO;wBACV,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,qCAAe,EAAC,CAAC,CAAC,CAAC;qBACvD;iBACF,CAAC,CAAA;aACH;YACD,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;QAEF,IAAA,uBAAa,EAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAA;QAC7D,qBAAqB;IACvB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAzEY,QAAA,oBAAoB,wBAyEhC;AACD,oBAAoB","sourcesContent":["// start tracking coverage, unless disabled explicltly\n// export so that we know to collect at the end of the process\nconst p = process\nconst enabled = p.env._TAPJS_PROCESSINFO_COVERAGE_ !== '0'\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { Session } from 'node:inspector'\nimport { SourceMapPayload } from 'node:module'\nimport { resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { canonicalSource } from './canonical-source.js'\nimport { findSourceMapSafe } from './find-source-map-safe.js'\nimport { getExclude } from './get-exclude.js'\nimport { getLineLengths } from './line-lengths.js'\nimport { lookupSources } from './lookup-sources.js'\nimport { ProcessInfoNodeData } from './process-info-node.js'\n\nexport let SESSION: Session | undefined = undefined\n\n// This is a \\n delimited list of files to show coverage for\n// If not set, or empty, then coverage is included for all files\n// that pass the exclusion RegExp filter. If included in this list,\n// then coverage will be recorded, even if it matches exclude.\nconst cfEnv = p.env._TAPJS_PROCESSINFO_COV_FILES_ || ''\nconst coveredFiles: string[] = cfEnv\n .trim()\n .split('\\n')\n .filter(f => !!f)\n\n// NB: coverage exclusion is in addition to processinfo\n// exclusion. Only show coverage for a file we care\n// about at least somewhat, but coverage is a subset.\nconst cxEnv = p.env._TAPJS_PROCESSINFO_COV_EXCLUDE_FILES_ || ''\nconst uncoveredFiles: string[] = cxEnv\n .trim()\n .split('\\n')\n .filter(f => !!f)\n\nconst exclude = p.env._TAPJS_PROCESSINFO_COV_EXCLUDE_\n ? getExclude('_TAPJS_PROCESSINFO_COV_EXCLUDE_', false)\n : /[\\\\\\/]node_modules[\\\\\\/]/\nconst fileEx = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_', false)\n\nconst fileCovered = (\n f: string,\n sources: string[] = [],\n files: string[] = []\n) => {\n const testFiles = [f]\n for (const src of sources || []) {\n testFiles.push(\n resolve(src.startsWith('file://') ? fileURLToPath(src) : src)\n )\n }\n\n // never include coverage if the file is fully ignored.\n if (!testFiles.some(f => files.includes(f))) {\n // just in case it was missed somehow, make sure it *should* be excluded\n for (const f of testFiles) {\n if (fileEx.test(f)) {\n return false\n }\n }\n // otherwise, it was missed by the loader recording somehow\n // this can happen with commonjs transpilations in some cases\n files.push(f)\n }\n\n // if at least one of them are explicitly covered, then include it,\n // otherwise omit if we explicitly listed\n if (coveredFiles.length) {\n return testFiles.some(f => coveredFiles.includes(f))\n }\n\n // if any of the filenames are explicitly excluded, no coverage\n // otherwise, it is covered\n return !testFiles.some(\n f => uncoveredFiles.includes(f) || exclude?.test(f)\n )\n}\n\n// C8 can't see that this function runs, best theory is that it\n// collides with what it's doing with the coverage it's collecting\n// This ignore can possibly be removed once this is being tested\n// with a version of tap that uses this library, but it might just\n// be an unresolveable bootstrap problem.\n// The test does verify that it ran, because otherwise, there would\n// be no coverage, and it verifies that it gets the expected coverage.\n/* c8 ignore start */\nexport const register = () => {\n if (!enabled) return\n p.env._TAPJS_PROCESSINFO_COVERAGE_ = '1'\n\n SESSION = new Session()\n SESSION.connect()\n SESSION.post('Profiler.enable')\n SESSION.post('Runtime.enable')\n SESSION.post('Profiler.startPreciseCoverage', {\n callCount: true,\n detailed: true,\n })\n}\n/* c8 ignore stop */\n\nexport const coverageOnProcessEnd = (\n cwd: string,\n processInfo: ProcessInfoNodeData\n) => {\n // Similar to the coverage tracking bootstrap problem above, c8\n // doesn't see that this function runs, even though it DOES see\n // that the function defined below runs, which is weird.\n /* c8 ignore start */\n if (!SESSION) return\n const session = SESSION\n\n const f = `${cwd}/.tap/coverage/${processInfo.uuid}.json`\n mkdirSync(`${cwd}/.tap/coverage`, { recursive: true })\n\n session.post('Profiler.takePreciseCoverage', (er, cov) => {\n session.post('Profiler.stopPreciseCoverage')\n /* c8 ignore stop */\n\n // something very strange and bad happened\n /* c8 ignore start */\n if (er) {\n throw er\n }\n /* c8 ignore stop */\n\n // Create a source-map-cache that c8 uses in report generation\n const sourceMapCache: {\n [k: string]: {\n lineLengths: number[]\n data: SourceMapPayload\n }\n } = {}\n Object.assign(cov, {\n 'source-map-cache': sourceMapCache,\n })\n\n cov.result = cov.result.filter(obj => {\n if (!/^file:/.test(obj.url)) {\n return false\n }\n obj.url = canonicalSource(obj.url)\n const f = fileURLToPath(obj.url)\n // see if it has a source map\n // need to look up via the url, not the file path, because mocks\n // attach a tapmock search param, which is in node's internal key.\n const sources = lookupSources(obj.url, true)\n if (!fileCovered(f, sources, processInfo.files)) {\n return false\n }\n // Most of the time this will be cached at the time of recording, but\n // if it's the last module loaded, or transpiled in-place by ts-node,\n // the sourcemap won't be pre-loaded and will have to be looked up.\n const s = findSourceMapSafe(obj.url)\n const { payload } = s || { payload: null }\n if (payload) {\n sourceMapCache[obj.url] = Object.assign(Object.create(null), {\n /* c8 ignore start */\n // node's SourceMap objects provide this as of 20.5.0\n //@ts-ignore\n lineLengths: s?.lineLengths || getLineLengths(f),\n /* c8 ignore stop */\n data: {\n ...payload,\n sources: payload.sources?.map(s => canonicalSource(s)),\n },\n })\n }\n return true\n })\n\n writeFileSync(f, JSON.stringify(cov, null, 2) + '\\n', 'utf8')\n /* c8 ignore start */\n })\n}\n/* c8 ignore stop */\n"]}
|