@tapjs/processinfo 2.2.4 → 2.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -51,6 +51,14 @@ If you just use the normal `spawn`/`exec` methods from the Node.js
51
51
  `child_process` module, then the relevant environment variables will still
52
52
  be tracked, unless explicitly set to `''` or some other value.
53
53
 
54
+ ### Important
55
+
56
+ In order to properly track `lineLengths` (required for coverage
57
+ reporting on source mapped files), `@tapjs/processinfo` must be
58
+ the **last** loader specified on the command line, so that it can
59
+ get access to the transpiled source that Node.js actually
60
+ executes.
61
+
54
62
  ### Interacting with Process Info
55
63
 
56
64
  To load the process info data, use the exported `ProcessInfo` class.
@@ -49,7 +49,7 @@ exports.exec = exec;
49
49
  exec.__promisify__ = __promisify__;
50
50
  Object.assign(exec, { [promisify]: __promisify__ });
51
51
  /* c8 ignore start */
52
- })(exec = exports.exec || (exports.exec = {}));
52
+ })(exec || (exports.exec = exec = {}));
53
53
  function execSync(cmd, options) {
54
54
  return (0, child_process_1.execSync)(cmd, (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k)));
55
55
  }
@@ -87,7 +87,7 @@ exports.execFile = execFile;
87
87
  execFile.__promisify__ = __promisify__;
88
88
  Object.assign(execFile, { [promisify]: __promisify__ });
89
89
  /* c8 ignore start */
90
- })(execFile = exports.execFile || (exports.execFile = {}));
90
+ })(execFile || (exports.execFile = execFile = {}));
91
91
  function execFileSync(file, args, options) {
92
92
  if (args &&
93
93
  typeof args === 'object' &&
@@ -1 +1 @@
1
- {"version":3,"file":"child_process.js","sourceRoot":"","sources":["../../lib/child_process.ts"],"names":[],"mappings":";;;AAAA,0EAA0E;AAC1E,iEAAiE;AACjE,iDAmCsB;AAGtB,qDAA6C;AAC7C,mDAA2D;AAE3D,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;AAO5D,MAAM,eAAe,G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,CAAC,EACP;QACA,OAAO,GAAG,IAAI,CAAA;QACd,IAAI,GAAG,EAAE,CAAA;KACV;IACD,OAAO,IAAA,4BAAc,EACnB,IAAI,EACJ,IAAI,IAAI,EAAE,EACV,IAAA,yBAAS,EAAC,OAAO,IAAI,EAAE,EAAE,IAAA,2BAAU,EAAC,CAAC,CAAC,CAAC,CACxC,CAAA;AACH,CAAC;AA7BD,oCA6BC;AAWD,SAAgB,IAAI,CAClB,UAAkB,EAClB,IAA0C,EAC1C,OAAqC;IAErC,IAAI,UAAU,CAAc,IAAI,CAAC,EAAE;QACjC,OAAO,GAAG,IAAI,CAAA;QACd,IAAI,GAAG,EAAE,CAAA;KACV;IACD,OAAO,IAAA,oBAAM,EAAC,UAAU,EAAE,IAAI,EAAE,IAAA,yBAAS,EAAC,OAAO,IAAI,EAAE,EAAE,IAAA,2BAAU,EAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC1E,CAAC;AAVD,oBAUC","sourcesContent":["// This wraps all of the various spawn methods such that externalID can be\n// set in the options, and ensuring that the proper envs get set.\nimport {\n ChildProcess,\n ChildProcessByStdio,\n ChildProcessWithoutNullStreams,\n exec as cpExec,\n ExecException,\n execFile as cpExecFile,\n ExecFileException,\n ExecFileOptions,\n ExecFileOptionsWithBufferEncoding,\n ExecFileOptionsWithOtherEncoding,\n ExecFileOptionsWithStringEncoding,\n execFileSync as cpExecFileSync,\n ExecFileSyncOptions,\n ExecFileSyncOptionsWithBufferEncoding,\n ExecFileSyncOptionsWithStringEncoding,\n ExecOptions,\n execSync as cpExecSync,\n ExecSyncOptions,\n ExecSyncOptionsWithBufferEncoding,\n ExecSyncOptionsWithStringEncoding,\n fork as cpFork,\n ForkOptions,\n PromiseWithChild,\n spawn as cpSpawn,\n SpawnOptions,\n SpawnOptionsWithoutStdio,\n SpawnOptionsWithStdioTuple,\n spawnSync as cpSpawnSync,\n SpawnSyncOptions,\n SpawnSyncOptionsWithBufferEncoding,\n SpawnSyncOptionsWithStringEncoding,\n SpawnSyncReturns,\n StdioNull,\n StdioPipe,\n} from 'child_process'\nimport type { ObjectEncodingOptions } from 'fs'\nimport type { Readable, Writable } from 'stream'\nimport { getExclude } from './get-exclude.js'\nimport { spawnOpts, WithExternalID } from './spawn-opts.js'\n\nconst promisify = Symbol.for('nodejs.util.promisify.custom')\n\n// pull the old __promisify__ out of node's declared namespaces\ntype CP<T extends { __promisify__: any }> = T & {\n [promisify]: T['__promisify__']\n}\ntype OldCP = { __promisify__: (...a: any) => any }\nconst customPromisify = <T extends OldCP>(e: T) =>\n // the node types list it as __promisify__ but it's actually the symbol\n /* c8 ignore start */\n (e as CP<T>)[promisify] || e.__promisify__\n/* c8 ignore stop */\n\nconst k = '_TAPJS_PROCESSINFO_EXCLUDE_'\n\n// coercion function when we know it's an array or something else\nconst isNotArray = <T extends { [k: string]: any }>(o: any): o is T =>\n !!o && typeof o === 'object' && !Array.isArray(o)\n\nexport function spawn(\n command: string,\n options?: WithExternalID<SpawnOptionsWithoutStdio>\n): ChildProcessWithoutNullStreams\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>\n >\n): ChildProcessByStdio<Writable, Readable, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>\n >\n): ChildProcessByStdio<Writable, Readable, null>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>\n >\n): ChildProcessByStdio<Writable, null, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>\n >\n): ChildProcessByStdio<null, Readable, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>\n >\n): ChildProcessByStdio<Writable, null, null>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>\n >\n): ChildProcessByStdio<null, Readable, null>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>\n >\n): ChildProcessByStdio<null, null, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>\n >\n): ChildProcessByStdio<null, null, null>\nexport function spawn(\n command: string,\n options: WithExternalID<SpawnOptions>\n): ChildProcess\nexport function spawn(\n command: string,\n args?: ReadonlyArray<string>,\n options?: SpawnOptionsWithoutStdio\n): ChildProcessWithoutNullStreams\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>\n): ChildProcessByStdio<Writable, Readable, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>\n): ChildProcessByStdio<Writable, Readable, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>\n): ChildProcessByStdio<Writable, null, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>\n): ChildProcessByStdio<null, Readable, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>\n): ChildProcessByStdio<Writable, null, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>\n): ChildProcessByStdio<null, Readable, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>\n): ChildProcessByStdio<null, null, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>\n): ChildProcessByStdio<null, null, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptions\n): ChildProcess\n\nexport function spawn(\n cmd: string,\n args?:\n | ReadonlyArray<string>\n | WithExternalID<SpawnOptions>\n | WithExternalID<SpawnOptionsWithoutStdio>\n | WithExternalID<\n SpawnOptionsWithStdioTuple<\n StdioNull | StdioPipe,\n StdioNull | StdioPipe,\n StdioNull | StdioPipe\n >\n >,\n options?:\n | WithExternalID<SpawnOptions>\n | WithExternalID<SpawnOptionsWithoutStdio>\n | WithExternalID<\n SpawnOptionsWithStdioTuple<\n StdioNull | StdioPipe,\n StdioNull | StdioPipe,\n StdioNull | StdioPipe\n >\n >\n): ChildProcess | ChildProcessWithoutNullStreams {\n if (isNotArray<SpawnOptions>(args)) {\n options = args\n args = []\n }\n return cpSpawn(cmd, args || [], spawnOpts(options || {}, getExclude(k)))\n}\n\nexport function spawnSync(command: string): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n options: WithExternalID<SpawnSyncOptionsWithStringEncoding>\n): SpawnSyncReturns<string>\nexport function spawnSync(\n command: string,\n options: WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n options?: WithExternalID<SpawnSyncOptions>\n): SpawnSyncReturns<string | Buffer>\nexport function spawnSync(\n command: string,\n args: ReadonlyArray<string>\n): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<SpawnSyncOptionsWithStringEncoding>\n): SpawnSyncReturns<string>\nexport function spawnSync(\n command: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n args?: ReadonlyArray<string>,\n options?: WithExternalID<SpawnSyncOptions>\n): SpawnSyncReturns<string | Buffer>\n\nexport function spawnSync(\n cmd: string,\n args?:\n | WithExternalID<SpawnSyncOptionsWithStringEncoding>\n | WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n | WithExternalID<SpawnSyncOptions>\n | ReadonlyArray<string>,\n options?:\n | WithExternalID<SpawnSyncOptionsWithStringEncoding>\n | WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n | WithExternalID<SpawnSyncOptions>\n) {\n if (isNotArray<SpawnSyncOptions>(args)) {\n options = args\n args = []\n }\n return cpSpawnSync(\n cmd,\n args || [],\n spawnOpts(options || {}, getExclude(k))\n )\n}\n\nexport type ExecArgs =\n | [\n command: string,\n callback?: (\n error: ExecException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<\n {\n encoding: 'buffer' | null\n } & ExecOptions\n >,\n callback?: (\n error: ExecException | null,\n stdout: Buffer,\n stderr: Buffer\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >,\n callback?: (\n error: ExecException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >,\n callback?: (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<ExecOptions>,\n callback?: (\n error: ExecException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n command: string,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecOptions>\n | undefined\n | null,\n callback?: (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\nexport function exec(...args: ExecArgs): ChildProcess {\n const [cmd, options, callback] = args\n if (typeof options === 'function') {\n return cpExec(cmd, spawnOpts<ExecOptions>({}, getExclude(k)), options)\n } else if (!options) {\n return cpExec(\n cmd,\n spawnOpts<ExecOptions>({}, getExclude(k)),\n callback as (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n )\n }\n\n return cpExec(\n cmd,\n spawnOpts(options, getExclude(k)),\n callback as (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n )\n}\n\nexport namespace exec {\n export function __promisify__(command: string): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n command: string,\n options: WithExternalID<\n {\n encoding: 'buffer' | null\n } & ExecOptions\n >\n ): PromiseWithChild<{\n stdout: Buffer\n stderr: Buffer\n }>\n export function __promisify__(\n command: string,\n options: WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n command: string,\n options: WithExternalID<ExecOptions>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n command: string,\n options?: WithExternalID<ObjectEncodingOptions & ExecOptions> | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n command: string,\n options?:\n | WithExternalID<\n {\n encoding: 'buffer' | null\n } & ExecOptions\n >\n | WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >\n | WithExternalID<ExecOptions>\n | WithExternalID<ObjectEncodingOptions & ExecOptions>\n | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }> {\n return customPromisify(cpExec)(\n command,\n spawnOpts(options || {}, getExclude(k))\n )\n }\n\n Object.assign(exec, { [promisify]: __promisify__ })\n /* c8 ignore start */\n}\n/* c8 ignore stop */\n\nexport function execSync(command: string): Buffer\nexport function execSync(\n command: string,\n options: WithExternalID<ExecSyncOptionsWithStringEncoding>\n): string\nexport function execSync(\n command: string,\n options: WithExternalID<ExecSyncOptionsWithBufferEncoding>\n): Buffer\nexport function execSync(\n command: string,\n options?: WithExternalID<ExecSyncOptions>\n): string | Buffer\nexport function execSync(\n cmd: string,\n options?:\n | WithExternalID<ExecSyncOptions>\n | WithExternalID<ExecSyncOptionsWithBufferEncoding>\n | WithExternalID<ExecSyncOptionsWithStringEncoding>\n | WithExternalID<ExecSyncOptionsWithBufferEncoding>\n): string | Buffer {\n return cpExecSync(\n cmd,\n spawnOpts<ExecSyncOptions>(options || {}, getExclude(k))\n )\n}\n\nexport type ExecFileArgs =\n | []\n | [\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ]\n | [args?: ReadonlyArray<string> | null]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ]\n | [\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: Buffer,\n stderr: Buffer\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: Buffer,\n stderr: Buffer\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptionsWithStringEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithStringEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptions>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptions>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null,\n callback:\n | ((\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void)\n | undefined\n | null\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null,\n callback:\n | ((\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void)\n | undefined\n | null\n ]\nexport function execFile(\n file: string,\n ...execFileArgs: ExecFileArgs\n): ChildProcess {\n let args = []\n let options: WithExternalID<ObjectEncodingOptions & ExecFileOptions> = {}\n let callback: ((...a: any) => any) | undefined = undefined\n for (const arg of execFileArgs) {\n if (Array.isArray(arg)) {\n args = arg\n } else if (\n arg &&\n typeof arg === 'object' &&\n isNotArray<WithExternalID<ObjectEncodingOptions & ExecFileOptions>>(\n arg\n )\n ) {\n options = arg\n } else if (typeof arg === 'function') {\n callback = arg\n }\n }\n return cpExecFile(\n file,\n args,\n spawnOpts(options, getExclude(k)),\n callback\n )\n}\n\nexport namespace execFile {\n export function __promisify__(file: string): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>\n ): PromiseWithChild<{\n stdout: Buffer\n stderr: Buffer\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>\n ): PromiseWithChild<{\n stdout: Buffer\n stderr: Buffer\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptionsWithStringEncoding>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithStringEncoding>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptions>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptions>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n args?:\n | ReadonlyArray<string>\n | undefined\n | null\n | WithExternalID<ExecFileOptionsWithBufferEncoding>\n | WithExternalID<ExecFileOptionsWithStringEncoding>\n | WithExternalID<ExecFileOptionsWithOtherEncoding>\n | WithExternalID<ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>,\n options?:\n | undefined\n | null\n | WithExternalID<ExecFileOptionsWithBufferEncoding>\n | WithExternalID<ExecFileOptionsWithStringEncoding>\n | WithExternalID<ExecFileOptionsWithOtherEncoding>\n | WithExternalID<ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }> {\n if (\n !!args &&\n typeof args === 'object' &&\n isNotArray<\n | WithExternalID<ExecFileOptionsWithBufferEncoding>\n | WithExternalID<ExecFileOptionsWithStringEncoding>\n | WithExternalID<ExecFileOptionsWithOtherEncoding>\n | WithExternalID<ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n >(args)\n ) {\n options = args\n args = []\n }\n return customPromisify(cpExecFile)(\n file,\n spawnOpts(options || {}, getExclude(k))\n )\n }\n Object.assign(execFile, { [promisify]: __promisify__ })\n /* c8 ignore start */\n}\n/* c8 ignore stop */\n\nexport function execFileSync(file: string): Buffer\nexport function execFileSync(\n file: string,\n options: WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n): string\nexport function execFileSync(\n file: string,\n options: WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n): Buffer\nexport function execFileSync(\n file: string,\n options?: WithExternalID<ExecFileSyncOptions>\n): string | Buffer\nexport function execFileSync(\n file: string,\n args: ReadonlyArray<string>\n): Buffer\nexport function execFileSync(\n file: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n): string\nexport function execFileSync(\n file: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n): Buffer\nexport function execFileSync(\n file: string,\n args?: ReadonlyArray<string>,\n options?: WithExternalID<ExecFileSyncOptions>\n): string | Buffer\nexport function execFileSync(\n file: string,\n args?:\n | ReadonlyArray<string>\n | WithExternalID<ExecFileSyncOptions>\n | WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n | WithExternalID<ExecFileSyncOptionsWithBufferEncoding>,\n options?:\n | WithExternalID<ExecFileSyncOptions>\n | WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n | WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n): string | Buffer {\n if (\n args &&\n typeof args === 'object' &&\n isNotArray<\n | WithExternalID<ExecFileSyncOptions>\n | WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n | WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n >(args)\n ) {\n options = args\n args = []\n }\n return cpExecFileSync(\n file,\n args || [],\n spawnOpts(options || {}, getExclude(k))\n )\n}\n\nexport function fork(\n modulePath: string,\n options?: ForkOptions\n): ChildProcess\nexport function fork(\n modulePath: string,\n args?: ReadonlyArray<string>,\n options?: WithExternalID<ForkOptions>\n): ChildProcess\nexport function fork(\n modulePath: string,\n args?: ForkOptions | ReadonlyArray<string>,\n options?: WithExternalID<ForkOptions>\n): ChildProcess {\n if (isNotArray<ForkOptions>(args)) {\n options = args\n args = []\n }\n return cpFork(modulePath, args, spawnOpts(options || {}, getExclude(k)))\n}\n"]}
1
+ {"version":3,"file":"child_process.js","sourceRoot":"","sources":["../../lib/child_process.ts"],"names":[],"mappings":";;;AAAA,0EAA0E;AAC1E,iEAAiE;AACjE,iDAmCsB;AAGtB,qDAA6C;AAC7C,mDAA2D;AAE3D,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;AAO5D,MAAM,eAAe,GAAG,CAAkB,CAAI,EAAE,EAAE;AAChD,uEAAuE;AACvE,qBAAqB;AACpB,CAAW,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,aAAa,CAAA;AAC5C,oBAAoB;AAEpB,MAAM,CAAC,GAAG,6BAA6B,CAAA;AAEvC,iEAAiE;AACjE,MAAM,UAAU,GAAG,CAAiC,CAAM,EAAU,EAAE,CACpE,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,K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U,CAAc,IAAI,CAAC,EAAE;QACjC,OAAO,GAAG,IAAI,CAAA;QACd,IAAI,GAAG,EAAE,CAAA;KACV;IACD,OAAO,IAAA,oBAAM,EAAC,UAAU,EAAE,IAAI,EAAE,IAAA,yBAAS,EAAC,OAAO,IAAI,EAAE,EAAE,IAAA,2BAAU,EAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC1E,CAAC;AAVD,oBAUC","sourcesContent":["// This wraps all of the various spawn methods such that externalID can be\n// set in the options, and ensuring that the proper envs get set.\nimport {\n ChildProcess,\n ChildProcessByStdio,\n ChildProcessWithoutNullStreams,\n exec as cpExec,\n ExecException,\n execFile as cpExecFile,\n ExecFileException,\n ExecFileOptions,\n ExecFileOptionsWithBufferEncoding,\n ExecFileOptionsWithOtherEncoding,\n ExecFileOptionsWithStringEncoding,\n execFileSync as cpExecFileSync,\n ExecFileSyncOptions,\n ExecFileSyncOptionsWithBufferEncoding,\n ExecFileSyncOptionsWithStringEncoding,\n ExecOptions,\n execSync as cpExecSync,\n ExecSyncOptions,\n ExecSyncOptionsWithBufferEncoding,\n ExecSyncOptionsWithStringEncoding,\n fork as cpFork,\n ForkOptions,\n PromiseWithChild,\n spawn as cpSpawn,\n SpawnOptions,\n SpawnOptionsWithoutStdio,\n SpawnOptionsWithStdioTuple,\n spawnSync as cpSpawnSync,\n SpawnSyncOptions,\n SpawnSyncOptionsWithBufferEncoding,\n SpawnSyncOptionsWithStringEncoding,\n SpawnSyncReturns,\n StdioNull,\n StdioPipe,\n} from 'child_process'\nimport type { ObjectEncodingOptions } from 'fs'\nimport type { Readable, Writable } from 'stream'\nimport { getExclude } from './get-exclude.js'\nimport { spawnOpts, WithExternalID } from './spawn-opts.js'\n\nconst promisify = Symbol.for('nodejs.util.promisify.custom')\n\n// pull the old __promisify__ out of node's declared namespaces\ntype CP<T extends { __promisify__: any }> = T & {\n [promisify]: T['__promisify__']\n}\ntype OldCP = { __promisify__: (...a: any) => any }\nconst customPromisify = <T extends OldCP>(e: T) =>\n // the node types list it as __promisify__ but it's actually the symbol\n /* c8 ignore start */\n (e as CP<T>)[promisify] || e.__promisify__\n/* c8 ignore stop */\n\nconst k = '_TAPJS_PROCESSINFO_EXCLUDE_'\n\n// coercion function when we know it's an array or something else\nconst isNotArray = <T extends { [k: string]: any }>(o: any): o is T =>\n !!o && typeof o === 'object' && !Array.isArray(o)\n\nexport function spawn(\n command: string,\n options?: WithExternalID<SpawnOptionsWithoutStdio>\n): ChildProcessWithoutNullStreams\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>\n >\n): ChildProcessByStdio<Writable, Readable, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>\n >\n): ChildProcessByStdio<Writable, Readable, null>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>\n >\n): ChildProcessByStdio<Writable, null, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>\n >\n): ChildProcessByStdio<null, Readable, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>\n >\n): ChildProcessByStdio<Writable, null, null>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>\n >\n): ChildProcessByStdio<null, Readable, null>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>\n >\n): ChildProcessByStdio<null, null, Readable>\nexport function spawn(\n command: string,\n options: WithExternalID<\n SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>\n >\n): ChildProcessByStdio<null, null, null>\nexport function spawn(\n command: string,\n options: WithExternalID<SpawnOptions>\n): ChildProcess\nexport function spawn(\n command: string,\n args?: ReadonlyArray<string>,\n options?: SpawnOptionsWithoutStdio\n): ChildProcessWithoutNullStreams\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>\n): ChildProcessByStdio<Writable, Readable, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>\n): ChildProcessByStdio<Writable, Readable, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>\n): ChildProcessByStdio<Writable, null, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>\n): ChildProcessByStdio<null, Readable, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>\n): ChildProcessByStdio<Writable, null, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>\n): ChildProcessByStdio<null, Readable, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>\n): ChildProcessByStdio<null, null, Readable>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>\n): ChildProcessByStdio<null, null, null>\nexport function spawn(\n command: string,\n args: ReadonlyArray<string>,\n options: SpawnOptions\n): ChildProcess\n\nexport function spawn(\n cmd: string,\n args?:\n | ReadonlyArray<string>\n | WithExternalID<SpawnOptions>\n | WithExternalID<SpawnOptionsWithoutStdio>\n | WithExternalID<\n SpawnOptionsWithStdioTuple<\n StdioNull | StdioPipe,\n StdioNull | StdioPipe,\n StdioNull | StdioPipe\n >\n >,\n options?:\n | WithExternalID<SpawnOptions>\n | WithExternalID<SpawnOptionsWithoutStdio>\n | WithExternalID<\n SpawnOptionsWithStdioTuple<\n StdioNull | StdioPipe,\n StdioNull | StdioPipe,\n StdioNull | StdioPipe\n >\n >\n): ChildProcess | ChildProcessWithoutNullStreams {\n if (isNotArray<SpawnOptions>(args)) {\n options = args\n args = []\n }\n return cpSpawn(cmd, args || [], spawnOpts(options || {}, getExclude(k)))\n}\n\nexport function spawnSync(command: string): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n options: WithExternalID<SpawnSyncOptionsWithStringEncoding>\n): SpawnSyncReturns<string>\nexport function spawnSync(\n command: string,\n options: WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n options?: WithExternalID<SpawnSyncOptions>\n): SpawnSyncReturns<string | Buffer>\nexport function spawnSync(\n command: string,\n args: ReadonlyArray<string>\n): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<SpawnSyncOptionsWithStringEncoding>\n): SpawnSyncReturns<string>\nexport function spawnSync(\n command: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n): SpawnSyncReturns<Buffer>\nexport function spawnSync(\n command: string,\n args?: ReadonlyArray<string>,\n options?: WithExternalID<SpawnSyncOptions>\n): SpawnSyncReturns<string | Buffer>\n\nexport function spawnSync(\n cmd: string,\n args?:\n | WithExternalID<SpawnSyncOptionsWithStringEncoding>\n | WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n | WithExternalID<SpawnSyncOptions>\n | ReadonlyArray<string>,\n options?:\n | WithExternalID<SpawnSyncOptionsWithStringEncoding>\n | WithExternalID<SpawnSyncOptionsWithBufferEncoding>\n | WithExternalID<SpawnSyncOptions>\n) {\n if (isNotArray<SpawnSyncOptions>(args)) {\n options = args\n args = []\n }\n return cpSpawnSync(\n cmd,\n args || [],\n spawnOpts(options || {}, getExclude(k))\n )\n}\n\nexport type ExecArgs =\n | [\n command: string,\n callback?: (\n error: ExecException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<\n {\n encoding: 'buffer' | null\n } & ExecOptions\n >,\n callback?: (\n error: ExecException | null,\n stdout: Buffer,\n stderr: Buffer\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >,\n callback?: (\n error: ExecException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >,\n callback?: (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\n | [\n command: string,\n options: WithExternalID<ExecOptions>,\n callback?: (\n error: ExecException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n command: string,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecOptions>\n | undefined\n | null,\n callback?: (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\nexport function exec(...args: ExecArgs): ChildProcess {\n const [cmd, options, callback] = args\n if (typeof options === 'function') {\n return cpExec(cmd, spawnOpts<ExecOptions>({}, getExclude(k)), options)\n } else if (!options) {\n return cpExec(\n cmd,\n spawnOpts<ExecOptions>({}, getExclude(k)),\n callback as (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n )\n }\n\n return cpExec(\n cmd,\n spawnOpts(options, getExclude(k)),\n callback as (\n error: ExecException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n )\n}\n\nexport namespace exec {\n export function __promisify__(command: string): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n command: string,\n options: WithExternalID<\n {\n encoding: 'buffer' | null\n } & ExecOptions\n >\n ): PromiseWithChild<{\n stdout: Buffer\n stderr: Buffer\n }>\n export function __promisify__(\n command: string,\n options: WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n command: string,\n options: WithExternalID<ExecOptions>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n command: string,\n options?: WithExternalID<ObjectEncodingOptions & ExecOptions> | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n command: string,\n options?:\n | WithExternalID<\n {\n encoding: 'buffer' | null\n } & ExecOptions\n >\n | WithExternalID<\n {\n encoding: BufferEncoding\n } & ExecOptions\n >\n | WithExternalID<ExecOptions>\n | WithExternalID<ObjectEncodingOptions & ExecOptions>\n | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }> {\n return customPromisify(cpExec)(\n command,\n spawnOpts(options || {}, getExclude(k))\n )\n }\n\n Object.assign(exec, { [promisify]: __promisify__ })\n /* c8 ignore start */\n}\n/* c8 ignore stop */\n\nexport function execSync(command: string): Buffer\nexport function execSync(\n command: string,\n options: WithExternalID<ExecSyncOptionsWithStringEncoding>\n): string\nexport function execSync(\n command: string,\n options: WithExternalID<ExecSyncOptionsWithBufferEncoding>\n): Buffer\nexport function execSync(\n command: string,\n options?: WithExternalID<ExecSyncOptions>\n): string | Buffer\nexport function execSync(\n cmd: string,\n options?:\n | WithExternalID<ExecSyncOptions>\n | WithExternalID<ExecSyncOptionsWithBufferEncoding>\n | WithExternalID<ExecSyncOptionsWithStringEncoding>\n | WithExternalID<ExecSyncOptionsWithBufferEncoding>\n): string | Buffer {\n return cpExecSync(\n cmd,\n spawnOpts<ExecSyncOptions>(options || {}, getExclude(k))\n )\n}\n\nexport type ExecFileArgs =\n | []\n | [\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ]\n | [args?: ReadonlyArray<string> | null]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ]\n | [\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: Buffer,\n stderr: Buffer\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: Buffer,\n stderr: Buffer\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptionsWithStringEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithStringEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>,\n callback: (\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void\n ]\n | [\n options: WithExternalID<ExecFileOptions>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptions>,\n callback: (\n error: ExecFileException | null,\n stdout: string,\n stderr: string\n ) => void\n ]\n | [\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null,\n callback:\n | ((\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void)\n | undefined\n | null\n ]\n | [\n args: ReadonlyArray<string> | undefined | null,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null,\n callback:\n | ((\n error: ExecFileException | null,\n stdout: string | Buffer,\n stderr: string | Buffer\n ) => void)\n | undefined\n | null\n ]\nexport function execFile(\n file: string,\n ...execFileArgs: ExecFileArgs\n): ChildProcess {\n let args = []\n let options: WithExternalID<ObjectEncodingOptions & ExecFileOptions> = {}\n let callback: ((...a: any) => any) | undefined = undefined\n for (const arg of execFileArgs) {\n if (Array.isArray(arg)) {\n args = arg\n } else if (\n arg &&\n typeof arg === 'object' &&\n isNotArray<WithExternalID<ObjectEncodingOptions & ExecFileOptions>>(\n arg\n )\n ) {\n options = arg\n } else if (typeof arg === 'function') {\n callback = arg\n }\n }\n return cpExecFile(\n file,\n args,\n spawnOpts(options, getExclude(k)),\n callback\n )\n}\n\nexport namespace execFile {\n export function __promisify__(file: string): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>\n ): PromiseWithChild<{\n stdout: Buffer\n stderr: Buffer\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithBufferEncoding>\n ): PromiseWithChild<{\n stdout: Buffer\n stderr: Buffer\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptionsWithStringEncoding>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithStringEncoding>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptionsWithOtherEncoding>\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n options: WithExternalID<ExecFileOptions>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options: WithExternalID<ExecFileOptions>\n ): PromiseWithChild<{\n stdout: string\n stderr: string\n }>\n export function __promisify__(\n file: string,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n args: ReadonlyArray<string> | undefined | null,\n options:\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | undefined\n | null\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }>\n export function __promisify__(\n file: string,\n args?:\n | ReadonlyArray<string>\n | undefined\n | null\n | WithExternalID<ExecFileOptionsWithBufferEncoding>\n | WithExternalID<ExecFileOptionsWithStringEncoding>\n | WithExternalID<ExecFileOptionsWithOtherEncoding>\n | WithExternalID<ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>,\n options?:\n | undefined\n | null\n | WithExternalID<ExecFileOptionsWithBufferEncoding>\n | WithExternalID<ExecFileOptionsWithStringEncoding>\n | WithExternalID<ExecFileOptionsWithOtherEncoding>\n | WithExternalID<ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n ): PromiseWithChild<{\n stdout: string | Buffer\n stderr: string | Buffer\n }> {\n if (\n !!args &&\n typeof args === 'object' &&\n isNotArray<\n | WithExternalID<ExecFileOptionsWithBufferEncoding>\n | WithExternalID<ExecFileOptionsWithStringEncoding>\n | WithExternalID<ExecFileOptionsWithOtherEncoding>\n | WithExternalID<ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n | WithExternalID<ObjectEncodingOptions & ExecFileOptions>\n >(args)\n ) {\n options = args\n args = []\n }\n return customPromisify(cpExecFile)(\n file,\n spawnOpts(options || {}, getExclude(k))\n )\n }\n Object.assign(execFile, { [promisify]: __promisify__ })\n /* c8 ignore start */\n}\n/* c8 ignore stop */\n\nexport function execFileSync(file: string): Buffer\nexport function execFileSync(\n file: string,\n options: WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n): string\nexport function execFileSync(\n file: string,\n options: WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n): Buffer\nexport function execFileSync(\n file: string,\n options?: WithExternalID<ExecFileSyncOptions>\n): string | Buffer\nexport function execFileSync(\n file: string,\n args: ReadonlyArray<string>\n): Buffer\nexport function execFileSync(\n file: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n): string\nexport function execFileSync(\n file: string,\n args: ReadonlyArray<string>,\n options: WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n): Buffer\nexport function execFileSync(\n file: string,\n args?: ReadonlyArray<string>,\n options?: WithExternalID<ExecFileSyncOptions>\n): string | Buffer\nexport function execFileSync(\n file: string,\n args?:\n | ReadonlyArray<string>\n | WithExternalID<ExecFileSyncOptions>\n | WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n | WithExternalID<ExecFileSyncOptionsWithBufferEncoding>,\n options?:\n | WithExternalID<ExecFileSyncOptions>\n | WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n | WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n): string | Buffer {\n if (\n args &&\n typeof args === 'object' &&\n isNotArray<\n | WithExternalID<ExecFileSyncOptions>\n | WithExternalID<ExecFileSyncOptionsWithStringEncoding>\n | WithExternalID<ExecFileSyncOptionsWithBufferEncoding>\n >(args)\n ) {\n options = args\n args = []\n }\n return cpExecFileSync(\n file,\n args || [],\n spawnOpts(options || {}, getExclude(k))\n )\n}\n\nexport function fork(\n modulePath: string,\n options?: ForkOptions\n): ChildProcess\nexport function fork(\n modulePath: string,\n args?: ReadonlyArray<string>,\n options?: WithExternalID<ForkOptions>\n): ChildProcess\nexport function fork(\n modulePath: string,\n args?: ForkOptions | ReadonlyArray<string>,\n options?: WithExternalID<ForkOptions>\n): ChildProcess {\n if (isNotArray<ForkOptions>(args)) {\n options = args\n args = []\n }\n return cpFork(modulePath, args, spawnOpts(options || {}, getExclude(k)))\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const saveLineLengths: (filename: string, content: string) => void;
2
+ export declare const getLineLengths: (filename: string) => number[] | undefined;
3
+ //# sourceMappingURL=line-lengths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line-lengths.d.ts","sourceRoot":"","sources":["../../lib/line-lengths.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,eAAe,aAAc,MAAM,WAAW,MAAM,SAWhE,CAAA;AAED,eAAO,MAAM,cAAc,aAAc,MAAM,yBAG9C,CAAA"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ // TODO: Refactor once https://github.com/nodejs/node/issues/48460 fixed
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.getLineLengths = exports.saveLineLengths = void 0;
5
+ const url_1 = require("url");
6
+ const kLLC = Symbol.for('@tapjs/processinfo lineLength cache');
7
+ const g = global;
8
+ const cache = g[kLLC] || new Map();
9
+ g[kLLC] = cache;
10
+ const sourceMapComment = '//# sourceMappingURL=';
11
+ const saveLineLengths = (filename, content) => {
12
+ if (filename.startsWith('file://'))
13
+ filename = (0, url_1.fileURLToPath)(filename);
14
+ if (cache.has(filename))
15
+ return;
16
+ // no need if it's not sourcemapped
17
+ const ll = !content.includes(sourceMapComment)
18
+ ? []
19
+ : content
20
+ .replace(/[\n\u2028\u2029]$/, '')
21
+ .split(/\n|\u2028|\u2029/)
22
+ .map(l => l.length);
23
+ cache.set(filename, ll);
24
+ };
25
+ exports.saveLineLengths = saveLineLengths;
26
+ const getLineLengths = (filename) => {
27
+ if (filename.startsWith('file://'))
28
+ filename = (0, url_1.fileURLToPath)(filename);
29
+ return cache.get(filename);
30
+ };
31
+ exports.getLineLengths = getLineLengths;
32
+ //# sourceMappingURL=line-lengths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line-lengths.js","sourceRoot":"","sources":["../../lib/line-lengths.ts"],"names":[],"mappings":";AAAA,wEAAwE;;;AAExE,6BAAmC;AAEnC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;AAC9D,MAAM,CAAC,GAAG,MAET,CAAA;AACD,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,EAAoB,CAAA;AACpD,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;AAEf,MAAM,gBAAgB,GAAG,uBAAuB,CAAA;AACzC,MAAM,eAAe,GAAG,CAAC,QAAgB,EAAE,OAAe,EAAE,EAAE;IACnE,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,QAAQ,GAAG,IAAA,mBAAa,EAAC,QAAQ,CAAC,CAAA;IACtE,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC;QAAE,OAAM;IAC/B,mCAAmC;IACnC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QAC5C,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,OAAO;aACJ,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC;aAChC,KAAK,CAAC,kBAAkB,CAAC;aACzB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IACzB,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;AACzB,CAAC,CAAA;AAXY,QAAA,eAAe,mBAW3B;AAEM,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAE,EAAE;IACjD,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,QAAQ,GAAG,IAAA,mBAAa,EAAC,QAAQ,CAAC,CAAA;IACtE,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAC5B,CAAC,CAAA;AAHY,QAAA,cAAc,kBAG1B","sourcesContent":["// TODO: Refactor once https://github.com/nodejs/node/issues/48460 fixed\n\nimport { fileURLToPath } from 'url'\n\nconst kLLC = Symbol.for('@tapjs/processinfo lineLength cache')\nconst g = global as {\n [kLLC]?: Map<string, number[]>\n}\nconst cache = g[kLLC] || new Map<string, number[]>()\ng[kLLC] = cache\n\nconst sourceMapComment = '//# sourceMappingURL='\nexport const saveLineLengths = (filename: string, content: string) => {\n if (filename.startsWith('file://')) filename = fileURLToPath(filename)\n if (cache.has(filename)) return\n // no need if it's not sourcemapped\n const ll = !content.includes(sourceMapComment)\n ? []\n : content\n .replace(/[\\n\\u2028\\u2029]$/, '')\n .split(/\\n|\\u2028|\\u2029/)\n .map(l => l.length)\n cache.set(filename, ll)\n}\n\nexport const getLineLengths = (filename: string) => {\n if (filename.startsWith('file://')) filename = fileURLToPath(filename)\n return cache.get(filename)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"register-cjs.d.ts","sourceRoot":"","sources":["../../lib/register-cjs.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,QAAQ,YAYpB,CAAA"}
1
+ {"version":3,"file":"register-cjs.d.ts","sourceRoot":"","sources":["../../lib/register-cjs.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,QAAQ,YAgBpB,CAAA"}
@@ -5,6 +5,7 @@ exports.register = void 0;
5
5
  const pirates_1 = require("pirates");
6
6
  const get_exclude_js_1 = require("./get-exclude.js");
7
7
  const get_process_info_js_1 = require("./get-process-info.js");
8
+ const line_lengths_js_1 = require("./line-lengths.js");
8
9
  const kRegisterCJS = Symbol.for('@tapjs/processinfo.registerCJS');
9
10
  const g = global;
10
11
  const register = () => {
@@ -15,8 +16,12 @@ const register = () => {
15
16
  const exclude = (0, get_exclude_js_1.getExclude)('_TAPJS_PROCESSINFO_EXCLUDE_', false);
16
17
  (0, pirates_1.addHook)((code, filename) => {
17
18
  (0, get_process_info_js_1.getProcessInfo)().files.push(filename);
19
+ (0, line_lengths_js_1.saveLineLengths)(filename, code);
18
20
  return code;
19
- }, { exts: ['.js', '.cjs'], matcher: filename => !exclude.test(filename) });
21
+ }, {
22
+ exts: ['.js', '.cjs', '.ts', '.cts', '.jsx', '.tsx'],
23
+ matcher: filename => !exclude.test(filename),
24
+ });
20
25
  };
21
26
  exports.register = register;
22
27
  //# sourceMappingURL=register-cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register-cjs.js","sourceRoot":"","sources":["../../lib/register-cjs.ts"],"names":[],"mappings":";;;AAAA,2DAA2D;AAC3D,qCAAiC;AACjC,qDAA6C;AAC7C,+DAAsD;AAEtD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;AACjE,MAAM,CAAC,GAAG,MAET,CAAA;AAEM,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,IAAI,CAAC,CAAC,YAAY,CAAC;QAAE,OAAM;IAC3B,CAAC,CAAC,YAAY,CAAC,GAAG,IAAI,CAAA;IACtB,wDAAwD;IACxD,MAAM,OAAO,GAAG,IAAA,2BAAU,EAAC,6BAA6B,EAAE,KAAK,CAAC,CAAA;IAChE,IAAA,iBAAO,EACL,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE;QACjB,IAAA,oCAAc,GAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrC,OAAO,IAAI,CAAA;IACb,CAAC,EACD,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CACxE,CAAA;AACH,CAAC,CAAA;AAZY,QAAA,QAAQ,YAYpB","sourcesContent":["// commonjs style loader hook, modifying require.extensions\nimport { addHook } from 'pirates'\nimport { getExclude } from './get-exclude.js'\nimport { getProcessInfo } from './get-process-info.js'\n\nconst kRegisterCJS = Symbol.for('@tapjs/processinfo.registerCJS')\nconst g = global as typeof globalThis & {\n [kRegisterCJS]?: boolean\n}\n\nexport const register = () => {\n if (g[kRegisterCJS]) return\n g[kRegisterCJS] = true\n // by default we include everything in processInfo.files\n const exclude = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_', false)\n addHook(\n (code, filename) => {\n getProcessInfo().files.push(filename)\n return code\n },\n { exts: ['.js', '.cjs'], matcher: filename => !exclude.test(filename) }\n )\n}\n"]}
1
+ {"version":3,"file":"register-cjs.js","sourceRoot":"","sources":["../../lib/register-cjs.ts"],"names":[],"mappings":";;;AAAA,2DAA2D;AAC3D,qCAAiC;AACjC,qDAA6C;AAC7C,+DAAsD;AACtD,uDAAmD;AAEnD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;AACjE,MAAM,CAAC,GAAG,MAET,CAAA;AAEM,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,IAAI,CAAC,CAAC,YAAY,CAAC;QAAE,OAAM;IAC3B,CAAC,CAAC,YAAY,CAAC,GAAG,IAAI,CAAA;IACtB,wDAAwD;IACxD,MAAM,OAAO,GAAG,IAAA,2BAAU,EAAC,6BAA6B,EAAE,KAAK,CAAC,CAAA;IAChE,IAAA,iBAAO,EACL,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE;QACjB,IAAA,oCAAc,GAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrC,IAAA,iCAAe,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;QAC/B,OAAO,IAAI,CAAA;IACb,CAAC,EACD;QACE,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QACpD,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;KAC7C,CACF,CAAA;AACH,CAAC,CAAA;AAhBY,QAAA,QAAQ,YAgBpB","sourcesContent":["// commonjs style loader hook, modifying require.extensions\nimport { addHook } from 'pirates'\nimport { getExclude } from './get-exclude.js'\nimport { getProcessInfo } from './get-process-info.js'\nimport { saveLineLengths } from './line-lengths.js'\n\nconst kRegisterCJS = Symbol.for('@tapjs/processinfo.registerCJS')\nconst g = global as typeof globalThis & {\n [kRegisterCJS]?: boolean\n}\n\nexport const register = () => {\n if (g[kRegisterCJS]) return\n g[kRegisterCJS] = true\n // by default we include everything in processInfo.files\n const exclude = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_', false)\n addHook(\n (code, filename) => {\n getProcessInfo().files.push(filename)\n saveLineLengths(filename, code)\n return code\n },\n {\n exts: ['.js', '.cjs', '.ts', '.cts', '.jsx', '.tsx'],\n matcher: filename => !exclude.test(filename),\n }\n )\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"register-coverage.d.ts","sourceRoot":"","sources":["../../lib/register-coverage.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,eAAO,IAAI,OAAO,EAAE,OAAO,GAAG,SAAqB,CAAA;AA8CnD,eAAO,MAAM,QAAQ,YAYpB,CAAA;AAaD,eAAO,MAAM,oBAAoB,QAC1B,MAAM,eACE,mBAAmB,SAyDjC,CAAA"}
1
+ {"version":3,"file":"register-coverage.d.ts","sourceRoot":"","sources":["../../lib/register-coverage.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAG3D,eAAO,IAAI,OAAO,EAAE,OAAO,GAAG,SAAqB,CAAA;AAiDnD,eAAO,MAAM,QAAQ,YAYpB,CAAA;AAGD,eAAO,MAAM,oBAAoB,QAC1B,MAAM,eACE,mBAAmB,SAyDjC,CAAA"}
@@ -9,6 +9,7 @@ const inspector_1 = require("inspector");
9
9
  const module_1 = require("module");
10
10
  const url_1 = require("url");
11
11
  const get_exclude_js_1 = require("./get-exclude.js");
12
+ const line_lengths_js_1 = require("./line-lengths.js");
12
13
  exports.SESSION = undefined;
13
14
  // NB: coverage exclusion is in addition to processinfo
14
15
  // exclusion. Only show coverage for a file we care
@@ -19,7 +20,10 @@ const exclude = (0, get_exclude_js_1.getExclude)('_TAPJS_PROCESSINFO_COV_EXCLUDE
19
20
  // that pass the exclusion RegExp filter. If included in this list,
20
21
  // then coverage will be recorded, even if it matches exclude.
21
22
  const cfEnv = process.env._TAPJS_PROCESSINFO_COV_FILES_ || '';
22
- const coveredFiles = cfEnv.trim().split('\n').filter(f => !!f);
23
+ const coveredFiles = cfEnv
24
+ .trim()
25
+ .split('\n')
26
+ .filter(f => !!f);
23
27
  const fileCovered = (f, s, files = []) => {
24
28
  const testFiles = [f];
25
29
  if (s) {
@@ -63,16 +67,6 @@ const register = () => {
63
67
  };
64
68
  exports.register = register;
65
69
  /* c8 ignore stop */
66
- // NB: this is the *generated* line lengths, not the source
67
- const lineLengths = (f) => {
68
- try {
69
- const content = (0, fs_1.readFileSync)(f, 'utf8');
70
- return content.split(/\n|\u2028|\u2029/).map(l => l.length);
71
- }
72
- catch {
73
- return [];
74
- }
75
- };
76
70
  const coverageOnProcessEnd = (cwd, processInfo) => {
77
71
  // Similar to the coverage tracking bootstrap problem above, c8
78
72
  // doesn't see that this function runs, even though it DOES see
@@ -110,7 +104,7 @@ const coverageOnProcessEnd = (cwd, processInfo) => {
110
104
  if (s) {
111
105
  const { payload } = s;
112
106
  sourceMapCache[obj.url] = Object.assign(Object.create(null), {
113
- lineLengths: lineLengths(f),
107
+ lineLengths: (0, line_lengths_js_1.getLineLengths)(f),
114
108
  data: payload,
115
109
  });
116
110
  }
@@ -1 +1 @@
1
- {"version":3,"file":"register-coverage.js","sourceRoot":"","sources":["../../lib/register-coverage.ts"],"names":[],"mappings":";;;AAAA,sDAAsD;AACtD,8DAA8D;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,KAAK,GAAG,CAAA;AAChE,2BAA2D;AAC3D,yCAAmC;AACnC,mCAAwD;AACxD,6BAAmC;AACnC,qDAA6C;AAGlC,QAAA,OAAO,GAAwB,SAAS,CAAA;AAEnD,uDAAuD;AACvD,oDAAoD;AACpD,qDAAqD;AACrD,MAAM,OAAO,GAAG,IAAA,2BAAU,EAAC,iCAAiC,CAAC,CAAA;AAE7D,4DAA4D;AAC5D,gEAAgE;AAChE,mEAAmE;AACnE,8DAA8D;AAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,IAAI,EAAE,CAAA;AAC7D,MAAM,YAAY,GAAa,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACxE,MAAM,WAAW,GAAG,CAClB,CAAS,EACT,CAAoB,EACpB,QAAkB,EAAE,EACpB,EAAE;IACF,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,CAAA;IACrB,IAAI,CAAC,EAAE;QACL,KAAK,MAAM,GAAG,IAAI,CAAC,CAAC,OAAO,IAAI,EAAE,EAAE;YACjC,SAAS,CAAC,IAAI,CAAC,IAAA,mBAAa,EAAC,GAAG,CAAC,CAAC,CAAA;SACnC;KACF;IACD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAAE,O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AK,CAAC,EAAE;gBAClD,OAAO,KAAK,CAAA;aACb;YACD,IAAI,CAAC,EAAE;gBACL,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,CAAA;gBACrB,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;oBAC3D,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;oBAC3B,IAAI,EAAE,OAAO;iBACd,CAAC,CAAA;aACH;YACD,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;QAEF,IAAA,kBAAa,EAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAA;QAC7D,qBAAqB;IACvB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AA3DY,QAAA,oBAAoB,wBA2DhC;AACD,oBAAoB","sourcesContent":["// start tracking coverage, unless disabled explicltly\n// export so that we know to collect at the end of the process\nconst enabled = process.env._TAPJS_PROCESSINFO_COVERAGE_ !== '0'\nimport { mkdirSync, readFileSync, writeFileSync } from 'fs'\nimport { Session } from 'inspector'\nimport { findSourceMap, SourceMapPayload } from 'module'\nimport { fileURLToPath } from 'url'\nimport { getExclude } from './get-exclude.js'\nimport { ProcessInfoNodeData } from './get-process-info.js'\n\nexport let SESSION: Session | undefined = undefined\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 exclude = getExclude('_TAPJS_PROCESSINFO_COV_EXCLUDE_')\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 = process.env._TAPJS_PROCESSINFO_COV_FILES_ || ''\nconst coveredFiles: string[] = cfEnv.trim().split('\\n').filter(f => !!f)\nconst fileCovered = (\n f: string,\n s?: SourceMapPayload,\n files: string[] = []\n) => {\n const testFiles = [f]\n if (s) {\n for (const src of s.sources || []) {\n testFiles.push(fileURLToPath(src))\n }\n }\n if (!testFiles.some(f => files.includes(f))) return false\n\n // if at least one of them are explicitly covered, then include it,\n // otherwise omit if we explicitly listed\n if (coveredFiles.length) {\n return testFiles.some(f => coveredFiles.includes(f))\n }\n\n for (const f of testFiles) {\n if (!exclude.test(f)) return true\n }\n return false\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 process.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\n// NB: this is the *generated* line lengths, not the source\nconst lineLengths = (f: string): number[] => {\n try {\n const content = readFileSync(f, 'utf8')\n return content.split(/\\n|\\u2028|\\u2029/).map(l => l.length)\n } catch {\n return []\n }\n}\n\nexport const coverageOnProcessEnd = (\n cwd: string,\n processInfo: ProcessInfoNodeData\n) => {\n // Similar to the coverage tracking bootstrap problem above, c8\n // doesn't see that this function runs, even though it DOES see\n // that the function defined below runs, which is weird.\n /* c8 ignore start */\n if (!SESSION) return\n const session = SESSION\n\n const f = `${cwd}/.tap/coverage/${processInfo.uuid}.json`\n mkdirSync(`${cwd}/.tap/coverage`, { recursive: true })\n\n session.post('Profiler.takePreciseCoverage', (er, cov) => {\n session.post('Profiler.stopPreciseCoverage')\n /* c8 ignore stop */\n\n // something very strange and bad happened\n /* c8 ignore start */\n if (er) {\n throw er\n }\n /* c8 ignore stop */\n\n // Create a source-map-cache that c8 uses in report generation\n const sourceMapCache: {\n [k: string]: {\n lineLengths: number[]\n data: SourceMapPayload\n }\n } = {}\n Object.assign(cov, {\n 'source-map-cache': sourceMapCache,\n })\n\n cov.result = cov.result.filter(obj => {\n if (!/^file:/.test(obj.url)) {\n return false\n }\n const f = fileURLToPath(obj.url)\n // see if it has a source map\n const s = findSourceMap(f)\n if (!fileCovered(f, s?.payload, processInfo.files)) {\n return false\n }\n if (s) {\n const { payload } = s\n sourceMapCache[obj.url] = Object.assign(Object.create(null), {\n lineLengths: lineLengths(f),\n data: payload,\n })\n }\n return true\n })\n\n writeFileSync(f, JSON.stringify(cov, null, 2) + '\\n', 'utf8')\n /* c8 ignore start */\n })\n}\n/* c8 ignore stop */\n"]}
1
+ {"version":3,"file":"register-coverage.js","sourceRoot":"","sources":["../../lib/register-coverage.ts"],"names":[],"mappings":";;;AAAA,sDAAsD;AACtD,8DAA8D;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,KAAK,GAAG,CAAA;AAChE,2BAA2D;AAC3D,yCAAmC;AACnC,mCAAmE;AACnE,6BAAmC;AACnC,qDAA6C;AAE7C,uDAAgD;AAErC,QAAA,OAAO,GAAwB,SAAS,CAAA;AAEnD,uDAAuD;AACvD,oDAAoD;AACpD,qDAAqD;AACrD,MAAM,OAAO,GAAG,IAAA,2BAAU,EAAC,iCAAiC,CAAC,CAAA;AAE7D,4DAA4D;AAC5D,gEAAgE;AAChE,mEAAmE;AACnE,8DAA8D;AAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,IAAI,EAAE,CAAA;AAC7D,MAAM,YAAY,GAAa,KAAK;KACjC,IAAI,EAAE;KACN,KAAK,CAAC,IAAI,CAAC;KACX,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACnB,MAAM,WAAW,GAAG,CAClB,CAAS,EACT,CAAoB,EACpB,QAAk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AAE,WAAW,CAAC,KAAK,CAAC,EAAE;gBAClD,OAAO,KAAK,CAAA;aACb;YACD,IAAI,CAAC,EAAE;gBACL,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,CAAA;gBACrB,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;oBAC3D,WAAW,EAAE,IAAA,gCAAc,EAAC,CAAC,CAAC;oBAC9B,IAAI,EAAE,OAAO;iBACd,CAAC,CAAA;aACH;YACD,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;QAEF,IAAA,kBAAa,EAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAA;QAC7D,qBAAqB;IACvB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AA3DY,QAAA,oBAAoB,wBA2DhC;AACD,oBAAoB","sourcesContent":["// start tracking coverage, unless disabled explicltly\n// export so that we know to collect at the end of the process\nconst enabled = process.env._TAPJS_PROCESSINFO_COVERAGE_ !== '0'\nimport { mkdirSync, readFileSync, writeFileSync } from 'fs'\nimport { Session } from 'inspector'\nimport { findSourceMap, SourceMap, SourceMapPayload } from 'module'\nimport { fileURLToPath } from 'url'\nimport { getExclude } from './get-exclude.js'\nimport { ProcessInfoNodeData } from './get-process-info.js'\nimport {getLineLengths} from './line-lengths.js'\n\nexport let SESSION: Session | undefined = undefined\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 exclude = getExclude('_TAPJS_PROCESSINFO_COV_EXCLUDE_')\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 = process.env._TAPJS_PROCESSINFO_COV_FILES_ || ''\nconst coveredFiles: string[] = cfEnv\n .trim()\n .split('\\n')\n .filter(f => !!f)\nconst fileCovered = (\n f: string,\n s?: SourceMapPayload,\n files: string[] = []\n) => {\n const testFiles = [f]\n if (s) {\n for (const src of s.sources || []) {\n testFiles.push(fileURLToPath(src))\n }\n }\n if (!testFiles.some(f => files.includes(f))) return false\n\n // if at least one of them are explicitly covered, then include it,\n // otherwise omit if we explicitly listed\n if (coveredFiles.length) {\n return testFiles.some(f => coveredFiles.includes(f))\n }\n\n for (const f of testFiles) {\n if (!exclude.test(f)) return true\n }\n return false\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 process.env._TAPJS_PROCESSINFO_COVERAGE_ = '1'\n\n SESSION = new Session()\n SESSION.connect()\n SESSION.post('Profiler.enable')\n SESSION.post('Runtime.enable')\n SESSION.post('Profiler.startPreciseCoverage', {\n callCount: true,\n detailed: true,\n })\n}\n/* c8 ignore stop */\n\nexport const coverageOnProcessEnd = (\n cwd: string,\n processInfo: ProcessInfoNodeData\n) => {\n // Similar to the coverage tracking bootstrap problem above, c8\n // doesn't see that this function runs, even though it DOES see\n // that the function defined below runs, which is weird.\n /* c8 ignore start */\n if (!SESSION) return\n const session = SESSION\n\n const f = `${cwd}/.tap/coverage/${processInfo.uuid}.json`\n mkdirSync(`${cwd}/.tap/coverage`, { recursive: true })\n\n session.post('Profiler.takePreciseCoverage', (er, cov) => {\n session.post('Profiler.stopPreciseCoverage')\n /* c8 ignore stop */\n\n // something very strange and bad happened\n /* c8 ignore start */\n if (er) {\n throw er\n }\n /* c8 ignore stop */\n\n // Create a source-map-cache that c8 uses in report generation\n const sourceMapCache: {\n [k: string]: {\n lineLengths: number[]\n data: SourceMapPayload\n }\n } = {}\n Object.assign(cov, {\n 'source-map-cache': sourceMapCache,\n })\n\n cov.result = cov.result.filter(obj => {\n if (!/^file:/.test(obj.url)) {\n return false\n }\n const f = fileURLToPath(obj.url)\n // see if it has a source map\n const s = findSourceMap(f)\n if (!fileCovered(f, s?.payload, processInfo.files)) {\n return false\n }\n if (s) {\n const { payload } = s\n sourceMapCache[obj.url] = Object.assign(Object.create(null), {\n lineLengths: getLineLengths(f),\n data: payload,\n })\n }\n return true\n })\n\n writeFileSync(f, JSON.stringify(cov, null, 2) + '\\n', 'utf8')\n /* c8 ignore start */\n })\n}\n/* c8 ignore stop */\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"esm.d.mts","sourceRoot":"","sources":["../../lib/esm.mts"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAOlD,cAAc,YAAY,CAAA;AAU1B,KAAK,MAAM,GAAG;IACZ,WAAW,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,GAAG,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,aAAa,YAAa;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,WAsBvD,CAAA;AAGD,eAAO,MAAM,IAAI,QACV,MAAM,WACF,GAAG,YACF,QAAQ,iBAyBnB,CAAA"}
1
+ {"version":3,"file":"esm.d.mts","sourceRoot":"","sources":["../../lib/esm.mts"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAQlD,cAAc,YAAY,CAAA;AAU1B,KAAK,MAAM,GAAG;IACZ,WAAW,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,GAAG,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,aAAa,YAAa;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,WAwBvD,CAAA;AAeD,eAAO,MAAM,IAAI,QACV,MAAM,WACF,GAAG,YACF,QAAQ,iBAqBnB,CAAA"}
package/dist/mjs/esm.mjs CHANGED
@@ -3,6 +3,7 @@ import { parse } from 'path';
3
3
  import { fileURLToPath } from 'url';
4
4
  import { getExclude } from './get-exclude.js';
5
5
  import { getProcessInfo } from './get-process-info.js';
6
+ import { saveLineLengths } from './line-lengths.js';
6
7
  import { resolve } from './require-resolve.js';
7
8
  // copy main module so that we can --loader=@tapjs/processinfo and use
8
9
  // this as the entry point as well.
@@ -20,42 +21,52 @@ if (typeof port !== 'undefined') {
20
21
  const { fileURLToPath } = getBuiltin('url')
21
22
  const require = createRequire(${JSON.stringify(base)})
22
23
  const { getProcessInfo } = require('./get-process-info.js')
24
+ const { saveLineLengths } = require('./line-lengths.js')
23
25
  // must be called eagerly here.
24
26
  // this does all the registration as well.
25
27
  const processInfo = getProcessInfo()
26
28
  port.onmessage = (e) => {
27
- const filename = e.data
29
+ const { filename, content } = e.data
28
30
  processInfo.files.push(filename)
31
+ saveLineLengths(filename, content)
29
32
  }
30
33
  port.unref()
31
34
  }
32
35
  `;
33
36
  };
34
37
  const exclude = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_', false);
38
+ const record = (url, content) => {
39
+ const filename = url.startsWith('file://') ? fileURLToPath(url) : url;
40
+ if (exclude.test(filename))
41
+ return;
42
+ if (PORT) {
43
+ PORT.postMessage({ filename, content });
44
+ }
45
+ else {
46
+ // call lazily so we don't double-register
47
+ getProcessInfo().files.push(filename);
48
+ if (content)
49
+ saveLineLengths(filename, content);
50
+ }
51
+ };
35
52
  export const load = async (url, context, nextLoad) => {
36
- if (/^file:/.test(url)) {
53
+ if (url.startsWith('file://')) {
37
54
  const filename = fileURLToPath(url);
38
- if (!exclude.test(filename)) {
39
- if (PORT) {
40
- PORT.postMessage(filename);
41
- }
42
- else {
43
- // call lazily so we don't double-register
44
- getProcessInfo().files.push(filename);
45
- }
46
- }
47
55
  const { ext } = parse(filename);
48
56
  // Package bins will sometimes have an extensionless bin script
49
57
  // instead of just naming their extensioned file and letting npm
50
58
  // symlink it for them. Don't blow up when this happens, just tell
51
59
  // node that it's commonjs.
52
60
  if (!ext) {
61
+ record(url);
53
62
  return {
54
63
  format: 'commonjs',
55
64
  shortCircuit: true,
56
65
  };
57
66
  }
58
67
  }
59
- return nextLoad(url, context);
68
+ const ret = await nextLoad(url, context);
69
+ record(url, String(ret.source));
70
+ return ret;
60
71
  };
61
72
  //# sourceMappingURL=esm.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"esm.mjs","sourceRoot":"","sources":["../../lib/esm.mts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C,sEAAsE;AACtE,mCAAmC;AACnC,cAAc,YAAY,CAAA;AAa1B,IAAI,IAAI,GAAuB,SAAS,CAAA;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAA0B,EAAE,EAAE;IAC1D,2DAA2D;IAC3D,sCAAsC;IACtC,MAAM,IAAI,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IACrC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;IAC9B,IAAI,GAAG,IAAI,CAAA;IACX,OAAO;;;;kCAIyB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;;;;;;;;;;;CAWrD,CAAA;AACD,CAAC,CAAA;AAED,MAAM,OAAO,GAAG,UAAU,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAA;AAChE,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,EACvB,GAAW,EACX,OAAY,EACZ,QAAkB,EAClB,EAAE;IACF,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACtB,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;QACnC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAC3B,IAAI,IAAI,EAAE;gBACR,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;aAC3B;iBAAM;gBACL,0CAA0C;gBAC1C,cAAc,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;aACtC;SACF;QACD,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAA;QAC/B,+DAA+D;QAC/D,gEAAgE;QAChE,kEAAkE;QAClE,2BAA2B;QAC3B,IAAI,CAAC,GAAG,EAAE;YACR,OAAO;gBACL,MAAM,EAAE,UAAU;gBAClB,YAAY,EAAE,IAAI;aACnB,CAAA;SACF;KACF;IACD,OAAO,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;AAC/B,CAAC,CAAA","sourcesContent":["// usage: node '--loader=@tapjs/processinfo/esm' foo.mjs\nimport { parse } from 'path'\nimport { fileURLToPath } from 'url'\nimport type { Serializable } from 'worker_threads'\nimport { getExclude } from './get-exclude.js'\nimport { getProcessInfo } from './get-process-info.js'\nimport { resolve } from './require-resolve.js'\n\n// copy main module so that we can --loader=@tapjs/processinfo and use\n// this as the entry point as well.\nexport * from './index.js'\n\n// on Node v20, loaders are executed in a separate isolated environment\n// As a result, to register coverage and track files, we need to act in\n// the globalPreload function. The load() method posts a message with the\n// filename being loaded, because any registrations that happen in the\n// loader thread will not have any effect.\n// The check for the 'port' being undefined is to allow for support back to\n// 16.12, which had a globalPreload method, but did not have a sendMessage\n// port in that environment.\ntype GPPort = {\n postMessage: (x: Serializable) => any\n}\nlet PORT: undefined | GPPort = undefined\nexport const globalPreload = (context: { port?: GPPort }) => {\n // this will be something like path/to/dist/mjs/lib/esm.mjs\n // but we need path/to/dist/cjs/cjs.js\n const base = resolve('../cjs/cjs.js')\n const { port } = context || {}\n PORT = port\n return `\nif (typeof port !== 'undefined') {\n const { createRequire, findSourceMap } = getBuiltin('module')\n const { fileURLToPath } = getBuiltin('url')\n const require = createRequire(${JSON.stringify(base)})\n const { getProcessInfo } = require('./get-process-info.js')\n // must be called eagerly here.\n // this does all the registration as well.\n const processInfo = getProcessInfo()\n port.onmessage = (e) => {\n const filename = e.data\n processInfo.files.push(filename)\n }\n port.unref()\n}\n`\n}\n\nconst exclude = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_', false)\nexport const load = async (\n url: string,\n context: any,\n nextLoad: Function\n) => {\n if (/^file:/.test(url)) {\n const filename = fileURLToPath(url)\n if (!exclude.test(filename)) {\n if (PORT) {\n PORT.postMessage(filename)\n } else {\n // call lazily so we don't double-register\n getProcessInfo().files.push(filename)\n }\n }\n const { ext } = parse(filename)\n // Package bins will sometimes have an extensionless bin script\n // instead of just naming their extensioned file and letting npm\n // symlink it for them. Don't blow up when this happens, just tell\n // node that it's commonjs.\n if (!ext) {\n return {\n format: 'commonjs',\n shortCircuit: true,\n }\n }\n }\n return nextLoad(url, context)\n}\n"]}
1
+ {"version":3,"file":"esm.mjs","sourceRoot":"","sources":["../../lib/esm.mts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C,sEAAsE;AACtE,mCAAmC;AACnC,cAAc,YAAY,CAAA;AAa1B,IAAI,IAAI,GAAuB,SAAS,CAAA;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAA0B,EAAE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AAC,GAAG,EAAE;YACR,MAAM,CAAC,GAAG,CAAC,CAAA;YACX,OAAO;gBACL,MAAM,EAAE,UAAU;gBAClB,YAAY,EAAE,IAAI;aACnB,CAAA;SACF;KACF;IAED,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IACxC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IAC/B,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA","sourcesContent":["// usage: node '--loader=@tapjs/processinfo/esm' foo.mjs\nimport { parse } from 'path'\nimport { fileURLToPath } from 'url'\nimport type { Serializable } from 'worker_threads'\nimport { getExclude } from './get-exclude.js'\nimport { getProcessInfo } from './get-process-info.js'\nimport { saveLineLengths } from './line-lengths.js'\nimport { resolve } from './require-resolve.js'\n\n// copy main module so that we can --loader=@tapjs/processinfo and use\n// this as the entry point as well.\nexport * from './index.js'\n\n// on Node v20, loaders are executed in a separate isolated environment\n// As a result, to register coverage and track files, we need to act in\n// the globalPreload function. The load() method posts a message with the\n// filename being loaded, because any registrations that happen in the\n// loader thread will not have any effect.\n// The check for the 'port' being undefined is to allow for support back to\n// 16.12, which had a globalPreload method, but did not have a sendMessage\n// port in that environment.\ntype GPPort = {\n postMessage: (x: Serializable) => any\n}\nlet PORT: undefined | GPPort = undefined\nexport const globalPreload = (context: { port?: GPPort }) => {\n // this will be something like path/to/dist/mjs/lib/esm.mjs\n // but we need path/to/dist/cjs/cjs.js\n const base = resolve('../cjs/cjs.js')\n const { port } = context || {}\n PORT = port\n return `\nif (typeof port !== 'undefined') {\n const { createRequire, findSourceMap } = getBuiltin('module')\n const { fileURLToPath } = getBuiltin('url')\n const require = createRequire(${JSON.stringify(base)})\n const { getProcessInfo } = require('./get-process-info.js')\n const { saveLineLengths } = require('./line-lengths.js')\n // must be called eagerly here.\n // this does all the registration as well.\n const processInfo = getProcessInfo()\n port.onmessage = (e) => {\n const { filename, content } = e.data\n processInfo.files.push(filename)\n saveLineLengths(filename, content)\n }\n port.unref()\n}\n`\n}\n\nconst exclude = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_', false)\nconst record = (url: string, content?: string) => {\n const filename = url.startsWith('file://') ? fileURLToPath(url) : url\n if (exclude.test(filename)) return\n if (PORT) {\n PORT.postMessage({ filename, content })\n } else {\n // call lazily so we don't double-register\n getProcessInfo().files.push(filename)\n if (content) saveLineLengths(filename, content)\n }\n}\n\nexport const load = async (\n url: string,\n context: any,\n nextLoad: Function\n) => {\n if (url.startsWith('file://')) {\n const filename = fileURLToPath(url)\n const { ext } = parse(filename)\n // Package bins will sometimes have an extensionless bin script\n // instead of just naming their extensioned file and letting npm\n // symlink it for them. Don't blow up when this happens, just tell\n // node that it's commonjs.\n if (!ext) {\n record(url)\n return {\n format: 'commonjs',\n shortCircuit: true,\n }\n }\n }\n\n const ret = await nextLoad(url, context)\n record(url, String(ret.source))\n return ret\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const saveLineLengths: (filename: string, content: string) => void;
2
+ export declare const getLineLengths: (filename: string) => number[] | undefined;
3
+ //# sourceMappingURL=line-lengths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line-lengths.d.ts","sourceRoot":"","sources":["../../lib/line-lengths.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,eAAe,aAAc,MAAM,WAAW,MAAM,SAWhE,CAAA;AAED,eAAO,MAAM,cAAc,aAAc,MAAM,yBAG9C,CAAA"}
@@ -0,0 +1,27 @@
1
+ // TODO: Refactor once https://github.com/nodejs/node/issues/48460 fixed
2
+ import { fileURLToPath } from 'url';
3
+ const kLLC = Symbol.for('@tapjs/processinfo lineLength cache');
4
+ const g = global;
5
+ const cache = g[kLLC] || new Map();
6
+ g[kLLC] = cache;
7
+ const sourceMapComment = '//# sourceMappingURL=';
8
+ export const saveLineLengths = (filename, content) => {
9
+ if (filename.startsWith('file://'))
10
+ filename = fileURLToPath(filename);
11
+ if (cache.has(filename))
12
+ return;
13
+ // no need if it's not sourcemapped
14
+ const ll = !content.includes(sourceMapComment)
15
+ ? []
16
+ : content
17
+ .replace(/[\n\u2028\u2029]$/, '')
18
+ .split(/\n|\u2028|\u2029/)
19
+ .map(l => l.length);
20
+ cache.set(filename, ll);
21
+ };
22
+ export const getLineLengths = (filename) => {
23
+ if (filename.startsWith('file://'))
24
+ filename = fileURLToPath(filename);
25
+ return cache.get(filename);
26
+ };
27
+ //# sourceMappingURL=line-lengths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line-lengths.js","sourceRoot":"","sources":["../../lib/line-lengths.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;AAC9D,MAAM,CAAC,GAAG,MAET,CAAA;AACD,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,EAAoB,CAAA;AACpD,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;AAEf,MAAM,gBAAgB,GAAG,uBAAuB,CAAA;AAChD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAgB,EAAE,OAAe,EAAE,EAAE;IACnE,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;IACtE,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC;QAAE,OAAM;IAC/B,mCAAmC;IACnC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QAC5C,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,OAAO;aACJ,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC;aAChC,KAAK,CAAC,kBAAkB,CAAC;aACzB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IACzB,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;AACzB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAE,EAAE;IACjD,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;IACtE,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAC5B,CAAC,CAAA","sourcesContent":["// TODO: Refactor once https://github.com/nodejs/node/issues/48460 fixed\n\nimport { fileURLToPath } from 'url'\n\nconst kLLC = Symbol.for('@tapjs/processinfo lineLength cache')\nconst g = global as {\n [kLLC]?: Map<string, number[]>\n}\nconst cache = g[kLLC] || new Map<string, number[]>()\ng[kLLC] = cache\n\nconst sourceMapComment = '//# sourceMappingURL='\nexport const saveLineLengths = (filename: string, content: string) => {\n if (filename.startsWith('file://')) filename = fileURLToPath(filename)\n if (cache.has(filename)) return\n // no need if it's not sourcemapped\n const ll = !content.includes(sourceMapComment)\n ? []\n : content\n .replace(/[\\n\\u2028\\u2029]$/, '')\n .split(/\\n|\\u2028|\\u2029/)\n .map(l => l.length)\n cache.set(filename, ll)\n}\n\nexport const getLineLengths = (filename: string) => {\n if (filename.startsWith('file://')) filename = fileURLToPath(filename)\n return cache.get(filename)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"register-cjs.d.ts","sourceRoot":"","sources":["../../lib/register-cjs.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,QAAQ,YAYpB,CAAA"}
1
+ {"version":3,"file":"register-cjs.d.ts","sourceRoot":"","sources":["../../lib/register-cjs.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,QAAQ,YAgBpB,CAAA"}
@@ -2,6 +2,7 @@
2
2
  import { addHook } from 'pirates';
3
3
  import { getExclude } from './get-exclude.js';
4
4
  import { getProcessInfo } from './get-process-info.js';
5
+ import { saveLineLengths } from './line-lengths.js';
5
6
  const kRegisterCJS = Symbol.for('@tapjs/processinfo.registerCJS');
6
7
  const g = global;
7
8
  export const register = () => {
@@ -12,7 +13,11 @@ export const register = () => {
12
13
  const exclude = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_', false);
13
14
  addHook((code, filename) => {
14
15
  getProcessInfo().files.push(filename);
16
+ saveLineLengths(filename, code);
15
17
  return code;
16
- }, { exts: ['.js', '.cjs'], matcher: filename => !exclude.test(filename) });
18
+ }, {
19
+ exts: ['.js', '.cjs', '.ts', '.cts', '.jsx', '.tsx'],
20
+ matcher: filename => !exclude.test(filename),
21
+ });
17
22
  };
18
23
  //# sourceMappingURL=register-cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register-cjs.js","sourceRoot":"","sources":["../../lib/register-cjs.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;AACjE,MAAM,CAAC,GAAG,MAET,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,IAAI,CAAC,CAAC,YAAY,CAAC;QAAE,OAAM;IAC3B,CAAC,CAAC,YAAY,CAAC,GAAG,IAAI,CAAA;IACtB,wDAAwD;IACxD,MAAM,OAAO,GAAG,UAAU,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAA;IAChE,OAAO,CACL,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE;QACjB,cAAc,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrC,OAAO,IAAI,CAAA;IACb,CAAC,EACD,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CACxE,CAAA;AACH,CAAC,CAAA","sourcesContent":["// commonjs style loader hook, modifying require.extensions\nimport { addHook } from 'pirates'\nimport { getExclude } from './get-exclude.js'\nimport { getProcessInfo } from './get-process-info.js'\n\nconst kRegisterCJS = Symbol.for('@tapjs/processinfo.registerCJS')\nconst g = global as typeof globalThis & {\n [kRegisterCJS]?: boolean\n}\n\nexport const register = () => {\n if (g[kRegisterCJS]) return\n g[kRegisterCJS] = true\n // by default we include everything in processInfo.files\n const exclude = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_', false)\n addHook(\n (code, filename) => {\n getProcessInfo().files.push(filename)\n return code\n },\n { exts: ['.js', '.cjs'], matcher: filename => !exclude.test(filename) }\n )\n}\n"]}
1
+ {"version":3,"file":"register-cjs.js","sourceRoot":"","sources":["../../lib/register-cjs.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;AACjE,MAAM,CAAC,GAAG,MAET,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,IAAI,CAAC,CAAC,YAAY,CAAC;QAAE,OAAM;IAC3B,CAAC,CAAC,YAAY,CAAC,GAAG,IAAI,CAAA;IACtB,wDAAwD;IACxD,MAAM,OAAO,GAAG,UAAU,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAA;IAChE,OAAO,CACL,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE;QACjB,cAAc,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrC,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;QAC/B,OAAO,IAAI,CAAA;IACb,CAAC,EACD;QACE,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QACpD,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;KAC7C,CACF,CAAA;AACH,CAAC,CAAA","sourcesContent":["// commonjs style loader hook, modifying require.extensions\nimport { addHook } from 'pirates'\nimport { getExclude } from './get-exclude.js'\nimport { getProcessInfo } from './get-process-info.js'\nimport { saveLineLengths } from './line-lengths.js'\n\nconst kRegisterCJS = Symbol.for('@tapjs/processinfo.registerCJS')\nconst g = global as typeof globalThis & {\n [kRegisterCJS]?: boolean\n}\n\nexport const register = () => {\n if (g[kRegisterCJS]) return\n g[kRegisterCJS] = true\n // by default we include everything in processInfo.files\n const exclude = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_', false)\n addHook(\n (code, filename) => {\n getProcessInfo().files.push(filename)\n saveLineLengths(filename, code)\n return code\n },\n {\n exts: ['.js', '.cjs', '.ts', '.cts', '.jsx', '.tsx'],\n matcher: filename => !exclude.test(filename),\n }\n )\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"register-coverage.d.ts","sourceRoot":"","sources":["../../lib/register-coverage.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,eAAO,IAAI,OAAO,EAAE,OAAO,GAAG,SAAqB,CAAA;AA8CnD,eAAO,MAAM,QAAQ,YAYpB,CAAA;AAaD,eAAO,MAAM,oBAAoB,QAC1B,MAAM,eACE,mBAAmB,SAyDjC,CAAA"}
1
+ {"version":3,"file":"register-coverage.d.ts","sourceRoot":"","sources":["../../lib/register-coverage.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAG3D,eAAO,IAAI,OAAO,EAAE,OAAO,GAAG,SAAqB,CAAA;AAiDnD,eAAO,MAAM,QAAQ,YAYpB,CAAA;AAGD,eAAO,MAAM,oBAAoB,QAC1B,MAAM,eACE,mBAAmB,SAyDjC,CAAA"}
@@ -1,11 +1,12 @@
1
1
  // start tracking coverage, unless disabled explicltly
2
2
  // export so that we know to collect at the end of the process
3
3
  const enabled = process.env._TAPJS_PROCESSINFO_COVERAGE_ !== '0';
4
- import { mkdirSync, readFileSync, writeFileSync } from 'fs';
4
+ import { mkdirSync, writeFileSync } from 'fs';
5
5
  import { Session } from 'inspector';
6
6
  import { findSourceMap } from 'module';
7
7
  import { fileURLToPath } from 'url';
8
8
  import { getExclude } from './get-exclude.js';
9
+ import { getLineLengths } from './line-lengths.js';
9
10
  export let SESSION = undefined;
10
11
  // NB: coverage exclusion is in addition to processinfo
11
12
  // exclusion. Only show coverage for a file we care
@@ -16,7 +17,10 @@ const exclude = getExclude('_TAPJS_PROCESSINFO_COV_EXCLUDE_');
16
17
  // that pass the exclusion RegExp filter. If included in this list,
17
18
  // then coverage will be recorded, even if it matches exclude.
18
19
  const cfEnv = process.env._TAPJS_PROCESSINFO_COV_FILES_ || '';
19
- const coveredFiles = cfEnv.trim().split('\n').filter(f => !!f);
20
+ const coveredFiles = cfEnv
21
+ .trim()
22
+ .split('\n')
23
+ .filter(f => !!f);
20
24
  const fileCovered = (f, s, files = []) => {
21
25
  const testFiles = [f];
22
26
  if (s) {
@@ -59,16 +63,6 @@ export const register = () => {
59
63
  });
60
64
  };
61
65
  /* c8 ignore stop */
62
- // NB: this is the *generated* line lengths, not the source
63
- const lineLengths = (f) => {
64
- try {
65
- const content = readFileSync(f, 'utf8');
66
- return content.split(/\n|\u2028|\u2029/).map(l => l.length);
67
- }
68
- catch {
69
- return [];
70
- }
71
- };
72
66
  export const coverageOnProcessEnd = (cwd, processInfo) => {
73
67
  // Similar to the coverage tracking bootstrap problem above, c8
74
68
  // doesn't see that this function runs, even though it DOES see
@@ -106,7 +100,7 @@ export const coverageOnProcessEnd = (cwd, processInfo) => {
106
100
  if (s) {
107
101
  const { payload } = s;
108
102
  sourceMapCache[obj.url] = Object.assign(Object.create(null), {
109
- lineLengths: lineLengths(f),
103
+ lineLengths: getLineLengths(f),
110
104
  data: payload,
111
105
  });
112
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"register-coverage.js","sourceRoot":"","sources":["../../lib/register-coverage.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,8DAA8D;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,KAAK,GAAG,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAAoB,MAAM,QAAQ,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAG7C,MAAM,CAAC,IAAI,OAAO,GAAwB,SAAS,CAAA;AAEnD,uDAAuD;AACvD,oDAAoD;AACpD,qDAAqD;AACrD,MAAM,OAAO,GAAG,UAAU,CAAC,iCAAiC,CAAC,CAAA;AAE7D,4DAA4D;AAC5D,gEAAgE;AAChE,mEAAmE;AACnE,8DAA8D;AAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,IAAI,EAAE,CAAA;AAC7D,MAAM,YAAY,GAAa,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,M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AAkB,EAAE,cAAc;SACnC,CAAC,CAAA;QAEF,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;YACnC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;gBAC3B,OAAO,KAAK,CAAA;aACb;YACD,MAAM,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YAChC,6BAA6B;YAC7B,MAAM,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;YAC1B,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE;gBAClD,OAAO,KAAK,CAAA;aACb;YACD,IAAI,CAAC,EAAE;gBACL,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,CAAA;gBACrB,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;oBAC3D,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;oBAC3B,IAAI,EAAE,OAAO;iBACd,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 enabled = process.env._TAPJS_PROCESSINFO_COVERAGE_ !== '0'\nimport { mkdirSync, readFileSync, writeFileSync } from 'fs'\nimport { Session } from 'inspector'\nimport { findSourceMap, SourceMapPayload } from 'module'\nimport { fileURLToPath } from 'url'\nimport { getExclude } from './get-exclude.js'\nimport { ProcessInfoNodeData } from './get-process-info.js'\n\nexport let SESSION: Session | undefined = undefined\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 exclude = getExclude('_TAPJS_PROCESSINFO_COV_EXCLUDE_')\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 = process.env._TAPJS_PROCESSINFO_COV_FILES_ || ''\nconst coveredFiles: string[] = cfEnv.trim().split('\\n').filter(f => !!f)\nconst fileCovered = (\n f: string,\n s?: SourceMapPayload,\n files: string[] = []\n) => {\n const testFiles = [f]\n if (s) {\n for (const src of s.sources || []) {\n testFiles.push(fileURLToPath(src))\n }\n }\n if (!testFiles.some(f => files.includes(f))) return false\n\n // if at least one of them are explicitly covered, then include it,\n // otherwise omit if we explicitly listed\n if (coveredFiles.length) {\n return testFiles.some(f => coveredFiles.includes(f))\n }\n\n for (const f of testFiles) {\n if (!exclude.test(f)) return true\n }\n return false\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 process.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\n// NB: this is the *generated* line lengths, not the source\nconst lineLengths = (f: string): number[] => {\n try {\n const content = readFileSync(f, 'utf8')\n return content.split(/\\n|\\u2028|\\u2029/).map(l => l.length)\n } catch {\n return []\n }\n}\n\nexport const coverageOnProcessEnd = (\n cwd: string,\n processInfo: ProcessInfoNodeData\n) => {\n // Similar to the coverage tracking bootstrap problem above, c8\n // doesn't see that this function runs, even though it DOES see\n // that the function defined below runs, which is weird.\n /* c8 ignore start */\n if (!SESSION) return\n const session = SESSION\n\n const f = `${cwd}/.tap/coverage/${processInfo.uuid}.json`\n mkdirSync(`${cwd}/.tap/coverage`, { recursive: true })\n\n session.post('Profiler.takePreciseCoverage', (er, cov) => {\n session.post('Profiler.stopPreciseCoverage')\n /* c8 ignore stop */\n\n // something very strange and bad happened\n /* c8 ignore start */\n if (er) {\n throw er\n }\n /* c8 ignore stop */\n\n // Create a source-map-cache that c8 uses in report generation\n const sourceMapCache: {\n [k: string]: {\n lineLengths: number[]\n data: SourceMapPayload\n }\n } = {}\n Object.assign(cov, {\n 'source-map-cache': sourceMapCache,\n })\n\n cov.result = cov.result.filter(obj => {\n if (!/^file:/.test(obj.url)) {\n return false\n }\n const f = fileURLToPath(obj.url)\n // see if it has a source map\n const s = findSourceMap(f)\n if (!fileCovered(f, s?.payload, processInfo.files)) {\n return false\n }\n if (s) {\n const { payload } = s\n sourceMapCache[obj.url] = Object.assign(Object.create(null), {\n lineLengths: lineLengths(f),\n data: payload,\n })\n }\n return true\n })\n\n writeFileSync(f, JSON.stringify(cov, null, 2) + '\\n', 'utf8')\n /* c8 ignore start */\n })\n}\n/* c8 ignore stop */\n"]}
1
+ {"version":3,"file":"register-coverage.js","sourceRoot":"","sources":["../../lib/register-coverage.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,8DAA8D;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,KAAK,GAAG,CAAA;AAChE,OAAO,EAAE,SAAS,EAAgB,aAAa,EAAE,MAAM,IAAI,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAA+B,MAAM,QAAQ,CAAA;AACnE,OAAO,EAAE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ect at the end of the process\nconst enabled = process.env._TAPJS_PROCESSINFO_COVERAGE_ !== '0'\nimport { mkdirSync, readFileSync, writeFileSync } from 'fs'\nimport { Session } from 'inspector'\nimport { findSourceMap, SourceMap, SourceMapPayload } from 'module'\nimport { fileURLToPath } from 'url'\nimport { getExclude } from './get-exclude.js'\nimport { ProcessInfoNodeData } from './get-process-info.js'\nimport {getLineLengths} from './line-lengths.js'\n\nexport let SESSION: Session | undefined = undefined\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 exclude = getExclude('_TAPJS_PROCESSINFO_COV_EXCLUDE_')\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 = process.env._TAPJS_PROCESSINFO_COV_FILES_ || ''\nconst coveredFiles: string[] = cfEnv\n .trim()\n .split('\\n')\n .filter(f => !!f)\nconst fileCovered = (\n f: string,\n s?: SourceMapPayload,\n files: string[] = []\n) => {\n const testFiles = [f]\n if (s) {\n for (const src of s.sources || []) {\n testFiles.push(fileURLToPath(src))\n }\n }\n if (!testFiles.some(f => files.includes(f))) return false\n\n // if at least one of them are explicitly covered, then include it,\n // otherwise omit if we explicitly listed\n if (coveredFiles.length) {\n return testFiles.some(f => coveredFiles.includes(f))\n }\n\n for (const f of testFiles) {\n if (!exclude.test(f)) return true\n }\n return false\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 process.env._TAPJS_PROCESSINFO_COVERAGE_ = '1'\n\n SESSION = new Session()\n SESSION.connect()\n SESSION.post('Profiler.enable')\n SESSION.post('Runtime.enable')\n SESSION.post('Profiler.startPreciseCoverage', {\n callCount: true,\n detailed: true,\n })\n}\n/* c8 ignore stop */\n\nexport const coverageOnProcessEnd = (\n cwd: string,\n processInfo: ProcessInfoNodeData\n) => {\n // Similar to the coverage tracking bootstrap problem above, c8\n // doesn't see that this function runs, even though it DOES see\n // that the function defined below runs, which is weird.\n /* c8 ignore start */\n if (!SESSION) return\n const session = SESSION\n\n const f = `${cwd}/.tap/coverage/${processInfo.uuid}.json`\n mkdirSync(`${cwd}/.tap/coverage`, { recursive: true })\n\n session.post('Profiler.takePreciseCoverage', (er, cov) => {\n session.post('Profiler.stopPreciseCoverage')\n /* c8 ignore stop */\n\n // something very strange and bad happened\n /* c8 ignore start */\n if (er) {\n throw er\n }\n /* c8 ignore stop */\n\n // Create a source-map-cache that c8 uses in report generation\n const sourceMapCache: {\n [k: string]: {\n lineLengths: number[]\n data: SourceMapPayload\n }\n } = {}\n Object.assign(cov, {\n 'source-map-cache': sourceMapCache,\n })\n\n cov.result = cov.result.filter(obj => {\n if (!/^file:/.test(obj.url)) {\n return false\n }\n const f = fileURLToPath(obj.url)\n // see if it has a source map\n const s = findSourceMap(f)\n if (!fileCovered(f, s?.payload, processInfo.files)) {\n return false\n }\n if (s) {\n const { payload } = s\n sourceMapCache[obj.url] = Object.assign(Object.create(null), {\n lineLengths: getLineLengths(f),\n data: payload,\n })\n }\n return true\n })\n\n writeFileSync(f, JSON.stringify(cov, null, 2) + '\\n', 'utf8')\n /* c8 ignore start */\n })\n}\n/* c8 ignore stop */\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapjs/processinfo",
3
- "version": "2.2.4",
3
+ "version": "2.2.5",
4
4
  "main": "./dist/cjs/index.js",
5
5
  "types": "./dist/cjs/index.d.ts",
6
6
  "module": "./dist/mjs/esm.mjs",
@@ -85,7 +85,7 @@
85
85
  "tap": "^16.3.0",
86
86
  "ts-node": "^10.9.1",
87
87
  "typedoc": "^0.24.8",
88
- "typescript": "^5.0.4"
88
+ "typescript": "^5.1.3"
89
89
  },
90
90
  "repository": "https://github.com/tapjs/processinfo"
91
91
  }