@tapjs/processinfo 3.1.6 → 3.1.8

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.
Files changed (41) hide show
  1. package/dist/commonjs/child_process.js +9 -9
  2. package/dist/commonjs/child_process.js.map +1 -1
  3. package/dist/commonjs/get-process-info.d.ts.map +1 -1
  4. package/dist/commonjs/get-process-info.js +6 -1
  5. package/dist/commonjs/get-process-info.js.map +1 -1
  6. package/dist/commonjs/node-options-env.d.ts +1 -1
  7. package/dist/commonjs/node-options-env.d.ts.map +1 -1
  8. package/dist/commonjs/node-options-env.js +80 -12
  9. package/dist/commonjs/node-options-env.js.map +1 -1
  10. package/dist/commonjs/package.json +3 -1
  11. package/dist/commonjs/register-coverage.d.ts.map +1 -1
  12. package/dist/commonjs/register-coverage.js +10 -1
  13. package/dist/commonjs/register-coverage.js.map +1 -1
  14. package/dist/commonjs/register-env.js +3 -3
  15. package/dist/commonjs/register-env.js.map +1 -1
  16. package/dist/commonjs/spawn-opts.d.ts +1 -1
  17. package/dist/commonjs/spawn-opts.d.ts.map +1 -1
  18. package/dist/commonjs/spawn-opts.js +8 -2
  19. package/dist/commonjs/spawn-opts.js.map +1 -1
  20. package/dist/esm/child_process.js +9 -9
  21. package/dist/esm/child_process.js.map +1 -1
  22. package/dist/esm/get-process-info.d.ts.map +1 -1
  23. package/dist/esm/get-process-info.js +6 -1
  24. package/dist/esm/get-process-info.js.map +1 -1
  25. package/dist/esm/node-options-env.d.ts +1 -1
  26. package/dist/esm/node-options-env.d.ts.map +1 -1
  27. package/dist/esm/node-options-env.js +81 -13
  28. package/dist/esm/node-options-env.js.map +1 -1
  29. package/dist/esm/package.json +3 -1
  30. package/dist/esm/register-coverage.d.ts.map +1 -1
  31. package/dist/esm/register-coverage.js +10 -1
  32. package/dist/esm/register-coverage.js.map +1 -1
  33. package/dist/esm/register-env.js +3 -3
  34. package/dist/esm/register-env.js.map +1 -1
  35. package/dist/esm/spawn-opts.d.ts +1 -1
  36. package/dist/esm/spawn-opts.d.ts.map +1 -1
  37. package/dist/esm/spawn-opts.js +8 -2
  38. package/dist/esm/spawn-opts.js.map +1 -1
  39. package/package.json +2 -2
  40. package/dist/commonjs/get-import-meta-url.d.ts.map +0 -1
  41. package/dist/commonjs/get-import-meta-url.js.map +0 -1
@@ -3,10 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.spawnOpts = void 0;
4
4
  const node_options_env_js_1 = require("./node-options-env.js");
5
5
  const p = process;
6
- const spawnOpts = (options, exclude) => {
6
+ const spawnOpts = (options, exclude, args) => {
7
7
  const { externalID, ...rest } = options;
8
8
  const env = { ...(options.env || p.env) };
9
- env.NODE_OPTIONS = (0, node_options_env_js_1.nodeOptionsEnv)(env);
9
+ // only add if lacking in args, but this can come in multiple ways
10
+ const a = [
11
+ ...(options.execArgv ?? []),
12
+ ...(args ?? []),
13
+ ...(options.args ?? []),
14
+ ];
15
+ env.NODE_OPTIONS = (0, node_options_env_js_1.nodeOptionsEnv)(env, a);
10
16
  if (externalID) {
11
17
  env._TAPJS_PROCESSINFO_EXTERNAL_ID_ = externalID;
12
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"spawn-opts.js","sourceRoot":"","sources":["../../src/spawn-opts.ts"],"names":[],"mappings":";;;AACA,+DAAsD;AAGtD,MAAM,CAAC,GAAG,OAAO,CAAA;AAEV,MAAM,SAAS,GAAG,CACvB,OAA0B,EAC1B,OAAyB,EAC2B,EAAE;IACtD,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IACvC,MAAM,GAAG,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAA;IACzC,GAAG,CAAC,YAAY,GAAG,IAAA,oCAAc,EAAC,GAAG,CAAC,CAAA;IACtC,IAAI,UAAU,EAAE;QACd,GAAG,CAAC,+BAA+B,GAAG,UAAU,CAAA;KACjD;IACD,IAAI,OAAO,EAAE;QACX,GAAG,CAAC,2BAA2B,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;KAClD;IACD,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,CAAA;AACzB,CAAC,CAAA;AAdY,QAAA,SAAS,aAcrB","sourcesContent":["import { ProcessEnvOptions } from 'child_process'\nimport { nodeOptionsEnv } from './node-options-env.js'\n\nexport type WithExternalID<T> = T & { externalID?: string }\nconst p = process\n\nexport const spawnOpts = <T extends { [k: string]: any }>(\n options: WithExternalID<T>,\n exclude?: RegExp | string\n): Omit<T, 'externalID'> & { env: ProcessEnvOptions } => {\n const { externalID, ...rest } = options\n const env = { ...(options.env || p.env) }\n env.NODE_OPTIONS = nodeOptionsEnv(env)\n if (externalID) {\n env._TAPJS_PROCESSINFO_EXTERNAL_ID_ = externalID\n }\n if (exclude) {\n env._TAPJS_PROCESSINFO_EXCLUDE_ = String(exclude)\n }\n return { ...rest, env }\n}\n"]}
1
+ {"version":3,"file":"spawn-opts.js","sourceRoot":"","sources":["../../src/spawn-opts.ts"],"names":[],"mappings":";;;AACA,+DAAsD;AAGtD,MAAM,CAAC,GAAG,OAAO,CAAA;AAEV,MAAM,SAAS,GAAG,CACvB,OAA0B,EAC1B,OAAyB,EACzB,IAAwB,EAC4B,EAAE;IACtD,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IACvC,MAAM,GAAG,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAA;IACzC,kEAAkE;IAClE,MAAM,CAAC,GAAG;QACR,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;QAC3B,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;QACf,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;KACxB,CAAA;IACD,GAAG,CAAC,YAAY,GAAG,IAAA,oCAAc,EAAC,GAAG,EAAE,CAAC,CAAC,CAAA;IACzC,IAAI,UAAU,EAAE;QACd,GAAG,CAAC,+BAA+B,GAAG,UAAU,CAAA;KACjD;IACD,IAAI,OAAO,EAAE;QACX,GAAG,CAAC,2BAA2B,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;KAClD;IACD,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,CAAA;AACzB,CAAC,CAAA;AArBY,QAAA,SAAS,aAqBrB","sourcesContent":["import { ProcessEnvOptions } from 'child_process'\nimport { nodeOptionsEnv } from './node-options-env.js'\n\nexport type WithExternalID<T> = T & { externalID?: string }\nconst p = process\n\nexport const spawnOpts = <T extends { [k: string]: any }>(\n options: WithExternalID<T>,\n exclude?: RegExp | string,\n args?: readonly string[]\n): Omit<T, 'externalID'> & { env: ProcessEnvOptions } => {\n const { externalID, ...rest } = options\n const env = { ...(options.env || p.env) }\n // only add if lacking in args, but this can come in multiple ways\n const a = [\n ...(options.execArgv ?? []),\n ...(args ?? []),\n ...(options.args ?? []),\n ]\n env.NODE_OPTIONS = nodeOptionsEnv(env, a)\n if (externalID) {\n env._TAPJS_PROCESSINFO_EXTERNAL_ID_ = externalID\n }\n if (exclude) {\n env._TAPJS_PROCESSINFO_EXCLUDE_ = String(exclude)\n }\n return { ...rest, env }\n}\n"]}
@@ -17,24 +17,24 @@ export function spawn(cmd, args, options) {
17
17
  options = args;
18
18
  args = [];
19
19
  }
20
- return cpSpawn(cmd, args || [], spawnOpts(options || {}, getExclude(k)));
20
+ return cpSpawn(cmd, args || [], spawnOpts(options || {}, getExclude(k), args));
21
21
  }
22
22
  export function spawnSync(cmd, args, options) {
23
23
  if (isNotArray(args)) {
24
24
  options = args;
25
25
  args = [];
26
26
  }
27
- return cpSpawnSync(cmd, args || [], spawnOpts(options || {}, getExclude(k)));
27
+ return cpSpawnSync(cmd, args || [], spawnOpts(options || {}, getExclude(k), args));
28
28
  }
29
29
  export function exec(...args) {
30
30
  const [cmd, options, callback] = args;
31
31
  if (typeof options === 'function') {
32
- return cpExec(cmd, spawnOpts({}, getExclude(k)), options);
32
+ return cpExec(cmd, spawnOpts({}, getExclude(k), []), options);
33
33
  }
34
34
  else if (!options) {
35
- return cpExec(cmd, spawnOpts({}, getExclude(k)), callback);
35
+ return cpExec(cmd, spawnOpts({}, getExclude(k), []), callback);
36
36
  }
37
- return cpExec(cmd, spawnOpts(options, getExclude(k)), callback);
37
+ return cpExec(cmd, spawnOpts(options, getExclude(k), []), callback);
38
38
  }
39
39
  (function (exec) {
40
40
  function __promisify__(command, options) {
@@ -64,7 +64,7 @@ export function execFile(file, ...execFileArgs) {
64
64
  callback = arg;
65
65
  }
66
66
  }
67
- return cpExecFile(file, args, spawnOpts(options, getExclude(k)), callback);
67
+ return cpExecFile(file, args, spawnOpts(options, getExclude(k), args), callback);
68
68
  }
69
69
  (function (execFile) {
70
70
  function __promisify__(file, args, options) {
@@ -74,7 +74,7 @@ export function execFile(file, ...execFileArgs) {
74
74
  options = args;
75
75
  args = [];
76
76
  }
77
- return customPromisify(cpExecFile)(file, spawnOpts(options || {}, getExclude(k)));
77
+ return customPromisify(cpExecFile)(file, spawnOpts(options || {}, getExclude(k), args));
78
78
  }
79
79
  execFile.__promisify__ = __promisify__;
80
80
  Object.assign(execFile, { [promisify]: __promisify__ });
@@ -87,13 +87,13 @@ export function execFileSync(file, args, options) {
87
87
  options = args;
88
88
  args = [];
89
89
  }
90
- return cpExecFileSync(file, args || [], spawnOpts(options || {}, getExclude(k)));
90
+ return cpExecFileSync(file, args || [], spawnOpts(options || {}, getExclude(k), args));
91
91
  }
92
92
  export function fork(modulePath, args, options) {
93
93
  if (isNotArray(args)) {
94
94
  options = args;
95
95
  args = [];
96
96
  }
97
- return cpFork(modulePath, args, spawnOpts(options || {}, getExclude(k)));
97
+ return cpFork(modulePath, args, spawnOpts(options || {}, getExclude(k), args));
98
98
  }
99
99
  //# sourceMappingURL=child_process.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"child_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E,aAAa,EAAE,CAAC,CAAA;IACvD,qBAAqB;AACvB,CAAC,EA5IgB,QAAQ,KAAR,QAAQ,QA4IxB;AAmCD,MAAM,UAAU,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,cAAc,CACnB,IAAI,EACJ,IAAI,IAAI,EAAE,EACV,SAAS,CAAC,OAAO,IAAI,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CACxC,CAAA;AACH,CAAC;AAWD,MAAM,UAAU,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,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC,OAAO,IAAI,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC1E,CAAC","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,OAAO,EAIL,IAAI,IAAI,MAAM,EAEd,QAAQ,IAAI,UAAU,EAMtB,YAAY,IAAI,cAAc,EAK9B,QAAQ,IAAI,UAAU,EAItB,IAAI,IAAI,MAAM,EAGd,KAAK,IAAI,OAAO,EAIhB,SAAS,IAAI,WAAW,GAOzB,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,SAAS,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GAAG,EAAE,CAAA;KACV;IACD,OAAO,cAAc,CACnB,IAAI,EACJ,IAAI,IAAI,EAAE,EACV,SAAS,CAAC,OAAO,IAAI,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAC9C,CAAA;AACH,CAAC;AAWD,MAAM,UAAU,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,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC,OAAO,IAAI,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;AAChF,CAAC","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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"get-process-info.d.ts","sourceRoot":"","sources":["../../src/get-process-info.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AA4B5D,eAAO,MAAM,KAAK;0BAKgB,mBAAmB;CAFpD,CAAA;AAED,eAAO,MAAM,cAAc,QAAO,mBAiDjC,CAAA"}
1
+ {"version":3,"file":"get-process-info.d.ts","sourceRoot":"","sources":["../../src/get-process-info.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AA4B5D,eAAO,MAAM,KAAK;0BAKgB,mBAAmB;CAFpD,CAAA;AAED,eAAO,MAAM,cAAc,QAAO,mBAqDjC,CAAA"}
@@ -1,6 +1,7 @@
1
1
  // we always want this
2
2
  const p = process;
3
3
  p.setSourceMapsEnabled(true);
4
+ import { resolve } from 'path';
4
5
  import { v4 as uuid } from 'uuid';
5
6
  import { getMain } from './get-main.js';
6
7
  const envKey = (k) => `_TAPJS_PROCESSINFO_${k.toUpperCase()}_`;
@@ -11,7 +12,7 @@ import { register as registerCoverage } from './register-coverage.js';
11
12
  import { register as registerEnv } from './register-env.js';
12
13
  import { register as registerProcessEnd } from './register-process-end.js';
13
14
  import { register as registerRequire } from './register-require.js';
14
- // this module is hybridized. In node v20.0 = v20.6, it's the *commonjs* one
15
+ // this module is hybridized. In node v20.0 - v20.6, it's the *commonjs* one
15
16
  // that gets loaded, because the esm loader context can't modify the main
16
17
  // thread except via communication over the port to the globalPreload env. So,
17
18
  // we have to store our singleton on the global.
@@ -44,6 +45,10 @@ export const getProcessInfo = () => {
44
45
  files: [getMain()],
45
46
  sources: Object.create(null),
46
47
  };
48
+ if (process.env.TAP_BEFORE)
49
+ g[kProcessInfo].files.push(resolve(process.env.TAP_BEFORE));
50
+ if (process.env.TAP_AFTER)
51
+ g[kProcessInfo].files.push(resolve(process.env.TAP_AFTER));
47
52
  if (!g[kProcessInfo].parent) {
48
53
  g[kProcessInfo].root = g[kProcessInfo].uuid;
49
54
  setEnv('root', g[kProcessInfo].uuid);
@@ -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,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;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,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B;IAEpB,OAAO,CAAC,CAAC,YAAY,CAAC,CAAA;AACxB,CAAC,CAAA","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"]}
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,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9B,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;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,G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AAC,GAAG,CAAC,EACnB;QACA,eAAe,EAAE,CAAA;QACjB,WAAW,EAAE,CAAA;QACb,gBAAgB,EAAE,CAAA;QAClB,kBAAkB,EAAE,CAAA;KACrB;IACD,oBAAoB;IAEpB,OAAO,CAAC,CAAC,YAAY,CAAC,CAAA;AACxB,CAAC,CAAA","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 { resolve } from 'path'\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 if (process.env.TAP_BEFORE)\n g[kProcessInfo].files.push(resolve(process.env.TAP_BEFORE))\n if (process.env.TAP_AFTER)\n g[kProcessInfo].files.push(resolve(process.env.TAP_AFTER))\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" resolution-mode="require"/>
3
3
  /// <reference types="node" resolution-mode="require"/>
4
4
  /// <reference types="node" resolution-mode="require"/>
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":";;;;AAiGA,eAAO,MAAM,cAAc,QAAS,OAAO,UAAU,WAGpD,CAAA"}
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"}
@@ -1,5 +1,5 @@
1
1
  import { argvToNodeOptions } from './argv-to-node-options.js';
2
- import { legacyLoader, legacyMatch, importLoader, importMatch, } from './loader-paths.js';
2
+ import { importLoader, importMatch, legacyLoader, legacyMatch, } from './loader-paths.js';
3
3
  import { nodeOptionsToArgv } from './node-options-to-argv.js';
4
4
  import Module from 'node:module';
5
5
  const getKeyValue = (args, i) => {
@@ -21,6 +21,73 @@ const getKeyValue = (args, i) => {
21
21
  };
22
22
  const useImport = !!Module
23
23
  .register;
24
+ // JUST test if we need to do anything at all with the env.
25
+ // if the loader is set already in the args, even incorrectly, return true
26
+ const hasLoader = (args) => {
27
+ for (let i = 0; i < args.length; i++) {
28
+ const arg = args[i];
29
+ /* c8 ignore start */
30
+ if (typeof arg !== 'string')
31
+ throw new Error('invalid arg');
32
+ /* c8 ignore stop */
33
+ if (!arg.startsWith('--') || arg === '--')
34
+ break;
35
+ const [eq, k, v] = getKeyValue(args, i);
36
+ if (!v) {
37
+ // wasn't a key-value pair
38
+ continue;
39
+ }
40
+ if (!eq)
41
+ i++;
42
+ if ((k === '--experimental-loader' || k === '--loader') &&
43
+ legacyMatch(v)) {
44
+ return true;
45
+ }
46
+ if (k === '--import' && importMatch(v))
47
+ return true;
48
+ }
49
+ return false;
50
+ };
51
+ const rmLoader = (args) => {
52
+ const doNotWantKeys = ['--experimental-loader', '--loader', '--import'];
53
+ const result = [];
54
+ let doubledash = false;
55
+ for (let i = 0; i < args.length; i++) {
56
+ const arg = args[i];
57
+ /* c8 ignore start */
58
+ if (typeof arg !== 'string')
59
+ throw new Error('invalid arg');
60
+ /* c8 ignore stop */
61
+ if (!arg.startsWith('--') || doubledash) {
62
+ result.push(arg);
63
+ continue;
64
+ }
65
+ if (arg === '--') {
66
+ result.push(arg);
67
+ doubledash = true;
68
+ continue;
69
+ }
70
+ const [eq, k, v] = getKeyValue(args, i);
71
+ if (!v) {
72
+ // wasn't a key-value pair
73
+ result.push(arg);
74
+ continue;
75
+ }
76
+ if (!eq)
77
+ i++;
78
+ if (doNotWantKeys.includes(k) && (importMatch(v) || legacyMatch(v))) {
79
+ // it's ours, remove it
80
+ continue;
81
+ }
82
+ // not ours, leave it
83
+ result.push(arg);
84
+ const next = args[i];
85
+ if (!eq && typeof next === 'string')
86
+ result.push(next);
87
+ continue;
88
+ }
89
+ return result;
90
+ };
24
91
  const addLoader = (args) => {
25
92
  const addKey = useImport ? '--import' : '--loader';
26
93
  const addValue = useImport ? importLoader : legacyLoader;
@@ -29,7 +96,7 @@ const addLoader = (args) => {
29
96
  useImport ? '--loader' : '--import',
30
97
  ];
31
98
  const test = useImport ? importMatch : legacyMatch;
32
- const added = [];
99
+ const result = [];
33
100
  let doubledash = false;
34
101
  let found = false;
35
102
  for (let i = 0; i < args.length; i++) {
@@ -39,18 +106,18 @@ const addLoader = (args) => {
39
106
  throw new Error('invalid arg');
40
107
  /* c8 ignore stop */
41
108
  if (!arg.startsWith('--') || doubledash) {
42
- added.push(arg);
109
+ result.push(arg);
43
110
  continue;
44
111
  }
45
112
  if (arg === '--') {
46
- added.push(arg);
113
+ result.push(arg);
47
114
  doubledash = true;
48
115
  continue;
49
116
  }
50
117
  const [eq, k, v] = getKeyValue(args, i);
51
118
  if (!v) {
52
119
  // wasn't a key-value pair
53
- added.push(arg);
120
+ result.push(arg);
54
121
  continue;
55
122
  }
56
123
  if (!eq)
@@ -64,30 +131,31 @@ const addLoader = (args) => {
64
131
  if (found)
65
132
  continue;
66
133
  found = true;
67
- added.push(arg);
134
+ result.push(arg);
68
135
  const next = args[i];
69
136
  if (!eq && typeof next === 'string')
70
- added.push(next);
137
+ result.push(next);
71
138
  }
72
139
  else {
73
140
  // not ours
74
- added.push(arg);
141
+ result.push(arg);
75
142
  const next = args[i];
76
143
  if (!eq && typeof next === 'string')
77
- added.push(next);
144
+ result.push(next);
78
145
  continue;
79
146
  }
80
147
  }
81
148
  if (!found)
82
- added.push(`${addKey}=${addValue}`);
83
- return !useImport ? addIgnoreLoadersWarning(added) : added;
149
+ result.push(`${addKey}=${addValue}`);
150
+ return !useImport ? addIgnoreLoadersWarning(result) : result;
84
151
  };
85
152
  const addIgnoreLoadersWarning = (args) => args.includes('--no-warnings') ||
86
153
  args.includes('--no-warnings=ExperimentalLoader')
87
154
  ? args
88
155
  : args.concat('--no-warnings');
89
- export const nodeOptionsEnv = (env) => {
156
+ export const nodeOptionsEnv = (env, args) => {
157
+ // if we already have the loader in args, don't add to NODE_OPTIONS
90
158
  const no = nodeOptionsToArgv(env.NODE_OPTIONS);
91
- return argvToNodeOptions(addLoader(no));
159
+ return argvToNodeOptions(hasLoader(args) ? rmLoader(no) : addLoader(no));
92
160
  };
93
161
  //# 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,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EACL,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,GACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAE7D,OAAO,MAAM,MAAM,aAAa,CAAA;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,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AAI,CAAC,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,IAAI,QAAQ,EAAE,CAAC,CAAA;IAC/C,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;AAC5D,CAAC,CAAA;AAED,MAAM,uBAAuB,GAAG,CAAC,IAAuB,EAAE,EAAE,CAC1D,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;IAC9B,IAAI,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IAC/C,CAAC,CAAC,IAAI;IACN,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAA;AAElC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAsB,EAAE,EAAE;IACvD,MAAM,EAAE,GAAG,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;IAC9C,OAAO,iBAAiB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAA;AACzC,CAAC,CAAA","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,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EACL,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,GACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAE7D,OAAO,MAAM,MAAM,aAAa,CAAA;AAEhC,MAAM,WAAW,GAAG,CAClB,IAAu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;YACL,WAAW;YACX,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YAChB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;YACpB,IAAI,CAAC,EAAE,IAAI,OAAO,IAAI,KAAK,QAAQ;gBAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACtD,SAAQ;SACT;KACF;IACD,IAAI,CAAC,KAAK;QAAE,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,IAAI,QAAQ,EAAE,CAAC,CAAA;IAChD,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;AAC9D,CAAC,CAAA;AAED,MAAM,uBAAuB,GAAG,CAAC,IAAuB,EAAE,EAAE,CAC1D,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;IAC9B,IAAI,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IAC/C,CAAC,CAAC,IAAI;IACN,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAA;AAElC,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,GAAsB,EACtB,IAAuB,EACvB,EAAE;IACF,mEAAmE;IACnE,MAAM,EAAE,GAAG,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;IAC9C,OAAO,iBAAiB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAA;AAC1E,CAAC,CAAA","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,3 @@
1
- {"type":"module"}
1
+ {
2
+ "type": "module"
3
+ }
@@ -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;AASxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAE5D,eAAO,IAAI,OAAO,EAAE,OAAO,GAAG,SAAqB,CAAA;AA+DnD,eAAO,MAAM,QAAQ,YAYpB,CAAA;AAGD,eAAO,MAAM,oBAAoB,QAC1B,MAAM,eACE,mBAAmB,SAuEjC,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"}
@@ -32,6 +32,7 @@ const uncoveredFiles = cxEnv
32
32
  const exclude = p.env._TAPJS_PROCESSINFO_COV_EXCLUDE_
33
33
  ? getExclude('_TAPJS_PROCESSINFO_COV_EXCLUDE_', false)
34
34
  : /[\\\/]node_modules[\\\/]/;
35
+ const fileEx = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_', false);
35
36
  const fileCovered = (f, sources = [], files = []) => {
36
37
  const testFiles = [f];
37
38
  for (const src of sources || []) {
@@ -39,7 +40,15 @@ const fileCovered = (f, sources = [], files = []) => {
39
40
  }
40
41
  // never include coverage if the file is fully ignored.
41
42
  if (!testFiles.some(f => files.includes(f))) {
42
- return false;
43
+ // just in case it was missed somehow, make sure it *should* be excluded
44
+ for (const f of testFiles) {
45
+ if (fileEx.test(f)) {
46
+ return false;
47
+ }
48
+ }
49
+ // otherwise, it was missed by the loader recording somehow
50
+ // this can happen with commonjs transpilations in some cases
51
+ files.push(f);
43
52
  }
44
53
  // if at least one of them are explicitly covered, then include it,
45
54
  // otherwise omit if we explicitly listed
@@ -1 +1 @@
1
- {"version":3,"file":"register-coverage.js","sourceRoot":"","sources":["../../src/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EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAA;QAC7D,qBAAqB;IACvB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;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[\\\\\\/]/\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 return false\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"]}
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,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM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,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;YAC5C,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE;gBAC/C,OAAO,KAAK,CAAA;aACb;YACD,qEAAqE;YACrE,qEAAqE;YACrE,mEAAmE;YACnE,MAAM,CAAC,GAAG,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACpC,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,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,cAAc,CAAC,CAAC,CAAC;oBAChD,oBAAoB;oBACpB,IAAI,EAAE;wBACJ,GAAG,OAAO;wBACV,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;qBACvD;iBACF,CAAC,CAAA;aACH;YACD,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;QAEF,aAAa,CAAC,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;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"]}