@tapjs/processinfo 1.0.12 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -11
- package/dist/cjs/argv-to-node-options.d.ts +2 -0
- package/dist/cjs/argv-to-node-options.d.ts.map +1 -0
- package/dist/cjs/argv-to-node-options.js +6 -0
- package/dist/cjs/argv-to-node-options.js.map +1 -0
- package/dist/cjs/child_process.d.ts +205 -0
- package/dist/cjs/child_process.d.ts.map +1 -0
- package/dist/cjs/child_process.js +109 -0
- package/dist/cjs/child_process.js.map +1 -0
- package/dist/cjs/cjs.d.ts +2 -0
- package/dist/cjs/cjs.d.ts.map +1 -0
- package/dist/cjs/cjs.js +5 -0
- package/dist/cjs/cjs.js.map +1 -0
- package/dist/cjs/get-exclude.d.ts +3 -0
- package/dist/cjs/get-exclude.d.ts.map +1 -0
- package/dist/cjs/get-exclude.js +23 -0
- package/dist/cjs/get-exclude.js.map +1 -0
- package/dist/cjs/get-process-info.d.ts +25 -0
- package/dist/cjs/get-process-info.d.ts.map +1 -0
- package/dist/cjs/get-process-info.js +69 -0
- package/dist/cjs/get-process-info.js.map +1 -0
- package/dist/cjs/index.d.ts +44 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +148 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/json-file.d.ts +3 -0
- package/dist/cjs/json-file.d.ts.map +1 -0
- package/dist/cjs/json-file.js +20 -0
- package/dist/cjs/json-file.js.map +1 -0
- package/dist/cjs/loader-paths.d.ts +5 -0
- package/dist/cjs/loader-paths.d.ts.map +1 -0
- package/dist/cjs/loader-paths.js +35 -0
- package/dist/cjs/loader-paths.js.map +1 -0
- package/dist/cjs/node-options-env.d.ts +6 -0
- package/dist/cjs/node-options-env.d.ts.map +1 -0
- package/dist/cjs/node-options-env.js +58 -0
- package/dist/cjs/node-options-env.js.map +1 -0
- package/dist/cjs/node-options-to-argv.d.ts +2 -0
- package/dist/cjs/node-options-to-argv.d.ts.map +1 -0
- package/dist/cjs/node-options-to-argv.js +58 -0
- package/dist/cjs/node-options-to-argv.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/process-info-node.d.ts +24 -0
- package/dist/cjs/process-info-node.d.ts.map +1 -0
- package/dist/cjs/process-info-node.js +100 -0
- package/dist/cjs/process-info-node.js.map +1 -0
- package/dist/cjs/register-cjs.d.ts +2 -0
- package/dist/cjs/register-cjs.d.ts.map +1 -0
- package/dist/cjs/register-cjs.js +21 -0
- package/dist/cjs/register-cjs.js.map +1 -0
- package/dist/cjs/register-coverage.d.ts +7 -0
- package/dist/cjs/register-coverage.d.ts.map +1 -0
- package/dist/cjs/register-coverage.js +94 -0
- package/dist/cjs/register-coverage.js.map +1 -0
- package/dist/cjs/register-env.d.ts +2 -0
- package/dist/cjs/register-env.d.ts.map +1 -0
- package/dist/cjs/register-env.js +26 -0
- package/dist/cjs/register-env.js.map +1 -0
- package/dist/cjs/register-process-end.d.ts +2 -0
- package/dist/cjs/register-process-end.d.ts.map +1 -0
- package/dist/cjs/register-process-end.js +30 -0
- package/dist/cjs/register-process-end.js.map +1 -0
- package/dist/cjs/require-resolve-cjs.d.ts.map +1 -0
- package/dist/cjs/require-resolve-cjs.js.map +1 -0
- package/dist/cjs/require-resolve.d.ts +3 -0
- package/dist/cjs/require-resolve.js +9 -0
- package/dist/cjs/spawn-opts.d.ts +10 -0
- package/dist/cjs/spawn-opts.d.ts.map +1 -0
- package/dist/cjs/spawn-opts.js +18 -0
- package/dist/cjs/spawn-opts.js.map +1 -0
- package/dist/cjs/x.d.ts +2 -0
- package/dist/cjs/x.d.ts.map +1 -0
- package/dist/cjs/x.js +5 -0
- package/dist/cjs/x.js.map +1 -0
- package/dist/mjs/argv-to-node-options.d.ts +2 -0
- package/dist/mjs/argv-to-node-options.d.ts.map +1 -0
- package/dist/mjs/argv-to-node-options.js +2 -0
- package/dist/mjs/argv-to-node-options.js.map +1 -0
- package/dist/mjs/child_process.d.ts +205 -0
- package/dist/mjs/child_process.d.ts.map +1 -0
- package/dist/mjs/child_process.js +99 -0
- package/dist/mjs/child_process.js.map +1 -0
- package/dist/mjs/esm.d.mts +11 -0
- package/dist/mjs/esm.d.mts.map +1 -0
- package/dist/mjs/esm.mjs +45 -0
- package/dist/mjs/esm.mjs.map +1 -0
- package/dist/mjs/get-exclude.d.ts +3 -0
- package/dist/mjs/get-exclude.d.ts.map +1 -0
- package/dist/mjs/get-exclude.js +19 -0
- package/dist/mjs/get-exclude.js.map +1 -0
- package/dist/mjs/get-process-info.d.ts +25 -0
- package/dist/mjs/get-process-info.d.ts.map +1 -0
- package/dist/mjs/get-process-info.js +64 -0
- package/dist/mjs/get-process-info.js.map +1 -0
- package/dist/mjs/index.d.ts +44 -0
- package/dist/mjs/index.d.ts.map +1 -0
- package/dist/mjs/index.js +130 -0
- package/dist/mjs/index.js.map +1 -0
- package/dist/mjs/json-file.d.ts +3 -0
- package/dist/mjs/json-file.d.ts.map +1 -0
- package/dist/mjs/json-file.js +15 -0
- package/dist/mjs/json-file.js.map +1 -0
- package/dist/mjs/loader-paths.d.ts +5 -0
- package/dist/mjs/loader-paths.d.ts.map +1 -0
- package/dist/mjs/loader-paths.js +30 -0
- package/dist/mjs/loader-paths.js.map +1 -0
- package/dist/mjs/node-options-env.d.ts +6 -0
- package/dist/mjs/node-options-env.d.ts.map +1 -0
- package/dist/mjs/node-options-env.js +54 -0
- package/dist/mjs/node-options-env.js.map +1 -0
- package/dist/mjs/node-options-to-argv.d.ts +2 -0
- package/dist/mjs/node-options-to-argv.d.ts.map +1 -0
- package/dist/mjs/node-options-to-argv.js +54 -0
- package/dist/mjs/node-options-to-argv.js.map +1 -0
- package/dist/mjs/package.json +3 -0
- package/dist/mjs/process-info-node.d.ts +24 -0
- package/dist/mjs/process-info-node.d.ts.map +1 -0
- package/dist/mjs/process-info-node.js +96 -0
- package/dist/mjs/process-info-node.js.map +1 -0
- package/dist/mjs/register-cjs.d.ts +2 -0
- package/dist/mjs/register-cjs.d.ts.map +1 -0
- package/dist/mjs/register-cjs.js +17 -0
- package/dist/mjs/register-cjs.js.map +1 -0
- package/dist/mjs/register-coverage.d.ts +7 -0
- package/dist/mjs/register-coverage.d.ts.map +1 -0
- package/dist/mjs/register-coverage.js +89 -0
- package/dist/mjs/register-coverage.js.map +1 -0
- package/dist/mjs/register-env.d.ts +2 -0
- package/dist/mjs/register-env.d.ts.map +1 -0
- package/dist/mjs/register-env.js +19 -0
- package/dist/mjs/register-env.js.map +1 -0
- package/dist/mjs/register-process-end.d.ts +2 -0
- package/dist/mjs/register-process-end.d.ts.map +1 -0
- package/dist/mjs/register-process-end.js +26 -0
- package/dist/mjs/register-process-end.js.map +1 -0
- package/dist/mjs/require-resolve.d.ts +3 -0
- package/dist/mjs/require-resolve.d.ts.map +1 -0
- package/dist/mjs/require-resolve.js +9 -0
- package/dist/mjs/require-resolve.js.map +1 -0
- package/dist/mjs/spawn-opts.d.ts +10 -0
- package/dist/mjs/spawn-opts.d.ts.map +1 -0
- package/dist/mjs/spawn-opts.js +14 -0
- package/dist/mjs/spawn-opts.js.map +1 -0
- package/dist/mjs/x.d.ts +2 -0
- package/dist/mjs/x.d.ts.map +1 -0
- package/dist/mjs/x.js +2 -0
- package/dist/mjs/x.js.map +1 -0
- package/package.json +49 -19
- package/index.d.ts +0 -208
- package/lib/argv-to-node-options.cjs +0 -2
- package/lib/child_process.cjs +0 -81
- package/lib/cjs.cjs +0 -16
- package/lib/esm.mjs +0 -74
- package/lib/get-exclude.cjs +0 -21
- package/lib/get-process-info.cjs +0 -45
- package/lib/index.cjs +0 -163
- package/lib/index.d.cts +0 -208
- package/lib/index.d.ts +0 -208
- package/lib/json-file.cjs +0 -19
- package/lib/node-options-env.cjs +0 -100
- package/lib/node-options-to-argv.cjs +0 -52
- package/lib/process-info-node.cjs +0 -84
- package/lib/register-coverage.cjs +0 -74
- package/lib/register-env.cjs +0 -21
- package/lib/register-process-end.cjs +0 -29
- package/lib/spawn-opts.cjs +0 -16
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProcessInfoNode = void 0;
|
|
4
|
+
class ProcessInfoNode {
|
|
5
|
+
date;
|
|
6
|
+
argv;
|
|
7
|
+
execArgv;
|
|
8
|
+
NODE_OPTIONS;
|
|
9
|
+
cwd;
|
|
10
|
+
pid;
|
|
11
|
+
ppid;
|
|
12
|
+
uuid;
|
|
13
|
+
files = [];
|
|
14
|
+
parent = null;
|
|
15
|
+
root = null;
|
|
16
|
+
children = null;
|
|
17
|
+
externalID = null;
|
|
18
|
+
#data;
|
|
19
|
+
constructor(data) {
|
|
20
|
+
this.#data = data;
|
|
21
|
+
Object.assign(this, data);
|
|
22
|
+
}
|
|
23
|
+
toJSON() {
|
|
24
|
+
return Object.fromEntries(Object.entries(this)
|
|
25
|
+
.filter(([_, val]) => val !== null && val !== undefined)
|
|
26
|
+
.map(([key, val]) => val instanceof ProcessInfoNode
|
|
27
|
+
? [key, val.uuid]
|
|
28
|
+
: key === 'children'
|
|
29
|
+
? [key, [...val].map(c => c.uuid)]
|
|
30
|
+
: [key, val]));
|
|
31
|
+
}
|
|
32
|
+
link(db) {
|
|
33
|
+
db.uuids.set(this.uuid, this);
|
|
34
|
+
if (this.#data.parent) {
|
|
35
|
+
this.parent = db.uuids.get(this.#data.parent) || this.parent;
|
|
36
|
+
}
|
|
37
|
+
if (this.#data.root) {
|
|
38
|
+
this.root = db.uuids.get(this.#data.root) ?? this.root;
|
|
39
|
+
}
|
|
40
|
+
if (this.parent === null) {
|
|
41
|
+
this.root = this;
|
|
42
|
+
const pendingRoot = db.pendingRoot.get(this.uuid);
|
|
43
|
+
if (pendingRoot) {
|
|
44
|
+
for (const n of pendingRoot) {
|
|
45
|
+
n.root = this;
|
|
46
|
+
}
|
|
47
|
+
db.pendingRoot.delete(this.uuid);
|
|
48
|
+
}
|
|
49
|
+
db.roots.add(this);
|
|
50
|
+
}
|
|
51
|
+
else if (typeof this.root === 'string') {
|
|
52
|
+
const pendingRoot = db.pendingRoot.get(this.root);
|
|
53
|
+
if (pendingRoot) {
|
|
54
|
+
pendingRoot.add(this);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
db.pendingRoot.set(this.root, new Set([this]));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (typeof this.parent === 'string') {
|
|
61
|
+
const pendingParent = db.pendingParent.get(this.parent);
|
|
62
|
+
if (pendingParent) {
|
|
63
|
+
pendingParent.add(this);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
db.pendingParent.set(this.parent, new Set([this]));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else if (this.parent) {
|
|
70
|
+
if (!this.parent.children) {
|
|
71
|
+
this.parent.children = new Set([this]);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
this.parent.children.add(this);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const pendingParent = db.pendingParent.get(this.uuid);
|
|
78
|
+
if (pendingParent) {
|
|
79
|
+
this.children = pendingParent;
|
|
80
|
+
for (const n of this.children) {
|
|
81
|
+
n.parent = this;
|
|
82
|
+
}
|
|
83
|
+
db.pendingParent.delete(this.uuid);
|
|
84
|
+
}
|
|
85
|
+
for (const f of this.files) {
|
|
86
|
+
const files = db.files.get(f);
|
|
87
|
+
if (!files) {
|
|
88
|
+
db.files.set(f, new Set([this]));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
files.add(this);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (this.externalID) {
|
|
95
|
+
db.externalIDs.set(this.externalID, this);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.ProcessInfoNode = ProcessInfoNode;
|
|
100
|
+
//# sourceMappingURL=process-info-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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aAClD;iBAAM;gBACL,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;aAChB;SACF;QAED,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;SAC1C;IACH,CAAC;CACF;AArGD,0CAqGC","sourcesContent":["import type { ProcessInfo } from './index.js'\nimport type { ProcessInfoNodeData } from './get-process-info.js'\n\nexport class ProcessInfoNode {\n date!: string\n argv!: string[]\n execArgv!: string[]\n NODE_OPTIONS?: string\n cwd!: string\n pid!: number\n ppid!: number\n uuid!: string\n files: string[] = []\n parent?: ProcessInfoNode | null = null\n root?: ProcessInfoNode | null = null\n children?: Set<ProcessInfoNode> | null = null\n externalID: string | null = null\n\n #data: ProcessInfoNodeData\n\n constructor(data: ProcessInfoNodeData) {\n this.#data = data\n Object.assign(this, data)\n }\n\n toJSON() {\n return Object.fromEntries(\n Object.entries(this)\n .filter(([_, val]) => val !== null && val !== undefined)\n .map(([key, val]) =>\n val instanceof ProcessInfoNode\n ? [key, val.uuid]\n : key === 'children'\n ? [key, [...val].map(c => c.uuid)]\n : [key, val]\n )\n )\n }\n\n link(db: ProcessInfo) {\n db.uuids.set(this.uuid, this)\n if (this.#data.parent) {\n this.parent = db.uuids.get(this.#data.parent) || this.parent\n }\n if (this.#data.root) {\n this.root = db.uuids.get(this.#data.root) ?? this.root\n }\n\n if (this.parent === null) {\n this.root = this\n const pendingRoot = db.pendingRoot.get(this.uuid)\n if (pendingRoot) {\n for (const n of pendingRoot) {\n n.root = this\n }\n db.pendingRoot.delete(this.uuid)\n }\n db.roots.add(this)\n } else if (typeof this.root === 'string') {\n const pendingRoot = db.pendingRoot.get(this.root)\n if (pendingRoot) {\n pendingRoot.add(this)\n } else {\n db.pendingRoot.set(this.root, new Set([this]))\n }\n }\n\n if (typeof this.parent === 'string') {\n const pendingParent = db.pendingParent.get(this.parent)\n if (pendingParent) {\n pendingParent.add(this)\n } else {\n db.pendingParent.set(this.parent, new Set([this]))\n }\n } else if (this.parent) {\n if (!this.parent.children) {\n this.parent.children = new Set([this])\n } else {\n this.parent.children.add(this)\n }\n }\n\n const pendingParent = db.pendingParent.get(this.uuid)\n if (pendingParent) {\n this.children = pendingParent\n for (const n of this.children) {\n n.parent = this\n }\n db.pendingParent.delete(this.uuid)\n }\n\n for (const f of this.files as string[]) {\n const files = db.files.get(f)\n if (!files) {\n db.files.set(f, new Set<ProcessInfoNode>([this]))\n } else {\n files.add(this)\n }\n }\n\n if (this.externalID) {\n db.externalIDs.set(this.externalID, this)\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-cjs.d.ts","sourceRoot":"","sources":["../../lib/register-cjs.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,QAAQ,YAWpB,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.register = void 0;
|
|
4
|
+
// commonjs style loader hook, modifying require.extensions
|
|
5
|
+
const pirates_1 = require("pirates");
|
|
6
|
+
const get_exclude_js_1 = require("./get-exclude.js");
|
|
7
|
+
const get_process_info_js_1 = require("./get-process-info.js");
|
|
8
|
+
const kRegisterCJS = Symbol.for('@tapjs/processinfo.registerCJS');
|
|
9
|
+
const g = global;
|
|
10
|
+
const register = () => {
|
|
11
|
+
if (g[kRegisterCJS])
|
|
12
|
+
return;
|
|
13
|
+
g[kRegisterCJS] = true;
|
|
14
|
+
const exclude = (0, get_exclude_js_1.getExclude)('_TAPJS_PROCESSINFO_EXCLUDE_');
|
|
15
|
+
(0, pirates_1.addHook)((code, filename) => {
|
|
16
|
+
(0, get_process_info_js_1.getProcessInfo)().files.push(filename);
|
|
17
|
+
return code;
|
|
18
|
+
}, { exts: ['.js', '.cjs'], matcher: filename => !exclude.test(filename) });
|
|
19
|
+
};
|
|
20
|
+
exports.register = register;
|
|
21
|
+
//# sourceMappingURL=register-cjs.js.map
|
|
@@ -0,0 +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,MAAM,OAAO,GAAG,IAAA,2BAAU,EAAC,6BAA6B,CAAC,CAAA;IACzD,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;AAXY,QAAA,QAAQ,YAWpB","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 const exclude = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_')\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"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Session } from 'inspector';
|
|
3
|
+
import { ProcessInfoNodeData } from './get-process-info.js';
|
|
4
|
+
export declare let SESSION: Session | undefined;
|
|
5
|
+
export declare const register: () => void;
|
|
6
|
+
export declare const coverageOnProcessEnd: (cwd: string, processInfo: ProcessInfoNodeData) => void;
|
|
7
|
+
//# sourceMappingURL=register-coverage.d.ts.map
|
|
@@ -0,0 +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;AAenD,eAAO,MAAM,QAAQ,YAYpB,CAAA;AAUD,eAAO,MAAM,oBAAoB,QAC1B,MAAM,eACE,mBAAmB,SAyDjC,CAAA"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coverageOnProcessEnd = exports.register = exports.SESSION = void 0;
|
|
4
|
+
// start tracking coverage, unless disabled explicltly
|
|
5
|
+
// export so that we know to collect at the end of the process
|
|
6
|
+
const enabled = process.env._TAPJS_PROCESSINFO_COVERAGE_ !== '0';
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const inspector_1 = require("inspector");
|
|
9
|
+
const module_1 = require("module");
|
|
10
|
+
const url_1 = require("url");
|
|
11
|
+
const get_exclude_js_1 = require("./get-exclude.js");
|
|
12
|
+
exports.SESSION = undefined;
|
|
13
|
+
// NB: coverage exclusion is in addition to processinfo
|
|
14
|
+
// exclusion. Only show coverage for a file we care
|
|
15
|
+
// about at least somewhat, but coverage is a subset.
|
|
16
|
+
const exclude = (0, get_exclude_js_1.getExclude)('_TAPJS_PROCESSINFO_COV_EXCLUDE_');
|
|
17
|
+
// C8 can't see that this function runs, best theory is that it
|
|
18
|
+
// collides with what it's doing with the coverage it's collecting
|
|
19
|
+
// This ignore can possibly be removed once this is being tested
|
|
20
|
+
// with a version of tap that uses this library, but it might just
|
|
21
|
+
// be an unresolveable bootstrap problem.
|
|
22
|
+
// The test does verify that it ran, because otherwise, there would
|
|
23
|
+
// be no coverage, and it verifies that it gets the expected coverage.
|
|
24
|
+
/* c8 ignore start */
|
|
25
|
+
const register = () => {
|
|
26
|
+
if (!enabled)
|
|
27
|
+
return;
|
|
28
|
+
process.env._TAPJS_PROCESSINFO_COVERAGE_ = '1';
|
|
29
|
+
exports.SESSION = new inspector_1.Session();
|
|
30
|
+
exports.SESSION.connect();
|
|
31
|
+
exports.SESSION.post('Profiler.enable');
|
|
32
|
+
exports.SESSION.post('Runtime.enable');
|
|
33
|
+
exports.SESSION.post('Profiler.startPreciseCoverage', {
|
|
34
|
+
callCount: true,
|
|
35
|
+
detailed: true,
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
exports.register = register;
|
|
39
|
+
/* c8 ignore stop */
|
|
40
|
+
// only read the file again if we don't already have the content
|
|
41
|
+
// in the source map itself.
|
|
42
|
+
const lineLengths = (f, content) => !content
|
|
43
|
+
? lineLengths(f, (0, fs_1.readFileSync)(f, 'utf8'))
|
|
44
|
+
: content.split(/\n|\u2028|\u2029/).map(l => l.length);
|
|
45
|
+
const coverageOnProcessEnd = (cwd, processInfo) => {
|
|
46
|
+
// Similar to the coverage tracking bootstrap problem above, c8
|
|
47
|
+
// doesn't see that this function runs, even though it DOES see
|
|
48
|
+
// that the function defined below runs, which is weird.
|
|
49
|
+
/* c8 ignore start */
|
|
50
|
+
if (!exports.SESSION)
|
|
51
|
+
return;
|
|
52
|
+
const session = exports.SESSION;
|
|
53
|
+
const f = `${cwd}/.tap/coverage/${processInfo.uuid}.json`;
|
|
54
|
+
(0, fs_1.mkdirSync)(`${cwd}/.tap/coverage`, { recursive: true });
|
|
55
|
+
session.post('Profiler.takePreciseCoverage', (er, cov) => {
|
|
56
|
+
session.post('Profiler.stopPreciseCoverage');
|
|
57
|
+
/* c8 ignore stop */
|
|
58
|
+
// something very strange and bad happened
|
|
59
|
+
/* c8 ignore start */
|
|
60
|
+
if (er) {
|
|
61
|
+
throw er;
|
|
62
|
+
}
|
|
63
|
+
/* c8 ignore stop */
|
|
64
|
+
// Create a source-map-cache that c8 uses in report generation
|
|
65
|
+
const sourceMapCache = {};
|
|
66
|
+
Object.assign(cov, {
|
|
67
|
+
'source-map-cache': sourceMapCache,
|
|
68
|
+
});
|
|
69
|
+
cov.result = cov.result.filter(obj => {
|
|
70
|
+
if (!/^file:/.test(obj.url)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
const f = (0, url_1.fileURLToPath)(obj.url);
|
|
74
|
+
if (!processInfo.files.includes(f) || exclude.test(f)) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
// see if it has a source map
|
|
78
|
+
const s = (0, module_1.findSourceMap)(f);
|
|
79
|
+
if (s) {
|
|
80
|
+
const { payload } = s;
|
|
81
|
+
sourceMapCache[obj.url] = Object.assign(Object.create(null), {
|
|
82
|
+
lineLengths: lineLengths(f, payload.sourcesContent?.join('')),
|
|
83
|
+
data: payload,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
});
|
|
88
|
+
(0, fs_1.writeFileSync)(f, JSON.stringify(cov, null, 2) + '\n', 'utf8');
|
|
89
|
+
/* c8 ignore start */
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
exports.coverageOnProcessEnd = coverageOnProcessEnd;
|
|
93
|
+
/* c8 ignore stop */
|
|
94
|
+
//# sourceMappingURL=register-coverage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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K,CAAA;aACb;YACD,6BAA6B;YAC7B,MAAM,CAAC,GAAG,IAAA,sBAAa,EAAC,CAAC,CAAC,CAAA;YAC1B,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,EAAE,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;oBAC7D,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// 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// only read the file again if we don't already have the content\n// in the source map itself.\nconst lineLengths = (f: string, content?: string): number[] =>\n !content\n ? lineLengths(f, readFileSync(f, 'utf8'))\n : content.split(/\\n|\\u2028|\\u2029/).map(l => l.length)\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 if (!processInfo.files.includes(f) || exclude.test(f)) {\n return false\n }\n // see if it has a source map\n const s = findSourceMap(f)\n if (s) {\n const { payload } = s\n sourceMapCache[obj.url] = Object.assign(Object.create(null), {\n lineLengths: lineLengths(f, payload.sourcesContent?.join('')),\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-env.d.ts","sourceRoot":"","sources":["../../lib/register-env.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,QAAQ,YAMpB,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.register = void 0;
|
|
7
|
+
const process_on_spawn_1 = __importDefault(require("process-on-spawn"));
|
|
8
|
+
const node_options_env_js_1 = require("./node-options-env.js");
|
|
9
|
+
const envRE = /^_TAPJS_PROCESSINFO_/;
|
|
10
|
+
const { hasOwnProperty } = Object.prototype;
|
|
11
|
+
const getEnvs = (env) => {
|
|
12
|
+
// load it here so that it isn't cached before the loader attaches
|
|
13
|
+
// in self-test scenario.
|
|
14
|
+
return Object.fromEntries(Object.entries(process.env)
|
|
15
|
+
.filter(([k]) => !hasOwnProperty.call(env, k) && envRE.test(k))
|
|
16
|
+
.concat([['NODE_OPTIONS', (0, node_options_env_js_1.nodeOptionsEnv)(env, process.execArgv)]]));
|
|
17
|
+
};
|
|
18
|
+
const register = () => {
|
|
19
|
+
process_on_spawn_1.default.addListener(obj => {
|
|
20
|
+
const env = obj.env || {};
|
|
21
|
+
obj.env = Object.assign(env, getEnvs(env));
|
|
22
|
+
return obj;
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
exports.register = register;
|
|
26
|
+
//# sourceMappingURL=register-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-env.js","sourceRoot":"","sources":["../../lib/register-env.ts"],"names":[],"mappings":";;;;;;AAAA,wEAA6C;AAC7C,+DAAsD;AAEtD,MAAM,KAAK,GAAG,sBAAsB,CAAA;AACpC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC,SAAS,CAAA;AAE3C,MAAM,OAAO,GAAG,CAAC,GAAsB,EAAE,EAAE;IACzC,kEAAkE;IAClE,yBAAyB;IACzB,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC;SACxB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAC9D,MAAM,CAAC,CAAC,CAAC,cAAc,EAAE,IAAA,oCAAc,EAAC,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CACrE,CAAA;AACH,CAAC,CAAA;AAEM,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,0BAAc,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE;QAC/B,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,EAAE,CAAA;QACzB,GAAG,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;QAC1C,OAAO,GAAG,CAAA;IACZ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AANY,QAAA,QAAQ,YAMpB","sourcesContent":["import processOnSpawn from 'process-on-spawn'\nimport { nodeOptionsEnv } from './node-options-env.js'\n\nconst envRE = /^_TAPJS_PROCESSINFO_/\nconst { hasOwnProperty } = Object.prototype\n\nconst getEnvs = (env: NodeJS.ProcessEnv) => {\n // load it here so that it isn't cached before the loader attaches\n // in self-test scenario.\n return Object.fromEntries(\n Object.entries(process.env)\n .filter(([k]) => !hasOwnProperty.call(env, k) && envRE.test(k))\n .concat([['NODE_OPTIONS', nodeOptionsEnv(env, process.execArgv)]])\n )\n}\n\nexport const register = () => {\n processOnSpawn.addListener(obj => {\n const env = obj.env || {}\n obj.env = Object.assign(env, getEnvs(env))\n return obj\n })\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-process-end.d.ts","sourceRoot":"","sources":["../../lib/register-process-end.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,QAAQ,YAsBpB,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.register = void 0;
|
|
4
|
+
const signal_exit_1 = require("signal-exit");
|
|
5
|
+
const get_process_info_js_1 = require("./get-process-info.js");
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const register_coverage_js_1 = require("./register-coverage.js");
|
|
8
|
+
const cwd = process.cwd();
|
|
9
|
+
const globals = new Set(Object.keys(global));
|
|
10
|
+
const register = () => {
|
|
11
|
+
(0, signal_exit_1.onExit)((code, signal) => {
|
|
12
|
+
const processInfo = (0, get_process_info_js_1.getProcessInfo)();
|
|
13
|
+
processInfo.code = code;
|
|
14
|
+
processInfo.signal = signal;
|
|
15
|
+
const runtime = process.hrtime(processInfo.hrstart);
|
|
16
|
+
delete processInfo.hrstart;
|
|
17
|
+
processInfo.files = [...new Set(processInfo.files)];
|
|
18
|
+
processInfo.runtime = runtime[0] * 1e3 + runtime[1] / 1e6;
|
|
19
|
+
const globalsAdded = Object.keys(global).filter(k => !globals.has(k));
|
|
20
|
+
if (globalsAdded.length) {
|
|
21
|
+
processInfo.globalsAdded = globalsAdded;
|
|
22
|
+
}
|
|
23
|
+
const f = `${cwd}/.tap/processinfo/${processInfo.uuid}.json`;
|
|
24
|
+
(0, fs_1.mkdirSync)(`${cwd}/.tap/processinfo`, { recursive: true });
|
|
25
|
+
(0, fs_1.writeFileSync)(f, JSON.stringify(processInfo, null, 2) + '\n', 'utf8');
|
|
26
|
+
(0, register_coverage_js_1.coverageOnProcessEnd)(cwd, processInfo);
|
|
27
|
+
}, { alwaysLast: true });
|
|
28
|
+
};
|
|
29
|
+
exports.register = register;
|
|
30
|
+
//# sourceMappingURL=register-process-end.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-process-end.js","sourceRoot":"","sources":["../../lib/register-process-end.ts"],"names":[],"mappings":";;;AAAA,6CAAoC;AACpC,+DAAsD;AAEtD,2BAA6C;AAC7C,iEAA6D;AAC7D,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;AACzB,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;AAErC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,IAAA,oBAAM,EACJ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;QACf,MAAM,WAAW,GAAG,IAAA,oCAAc,GAAE,CAAA;QACpC,WAAW,CAAC,IAAI,GAAG,IAAI,CAAA;QACvB,WAAW,CAAC,MAAM,GAAG,MAAM,CAAA;QAC3B,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;QACnD,OAAO,WAAW,CAAC,OAAO,CAAA;QAC1B,WAAW,CAAC,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAA;QACnD,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;QACzD,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QACrE,IAAI,YAAY,CAAC,MAAM,EAAE;YACvB,WAAW,CAAC,YAAY,GAAG,YAAY,CAAA;SACxC;QAED,MAAM,CAAC,GAAG,GAAG,GAAG,qBAAqB,WAAW,CAAC,IAAI,OAAO,CAAA;QAC5D,IAAA,cAAS,EAAC,GAAG,GAAG,mBAAmB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACzD,IAAA,kBAAa,EAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAA;QACrE,IAAA,2CAAoB,EAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IACxC,CAAC,EACD,EAAE,UAAU,EAAE,IAAI,EAAE,CACrB,CAAA;AACH,CAAC,CAAA;AAtBY,QAAA,QAAQ,YAsBpB","sourcesContent":["import { onExit } from 'signal-exit'\nimport { getProcessInfo } from './get-process-info.js'\n\nimport { mkdirSync, writeFileSync } from 'fs'\nimport { coverageOnProcessEnd } from './register-coverage.js'\nconst cwd = process.cwd()\nconst globals = new Set(Object.keys(global))\n\nexport const register = () => {\n onExit(\n (code, signal) => {\n const processInfo = getProcessInfo()\n processInfo.code = code\n processInfo.signal = signal\n const runtime = process.hrtime(processInfo.hrstart)\n delete processInfo.hrstart\n processInfo.files = [...new Set(processInfo.files)]\n processInfo.runtime = runtime[0] * 1e3 + runtime[1] / 1e6\n const globalsAdded = Object.keys(global).filter(k => !globals.has(k))\n if (globalsAdded.length) {\n processInfo.globalsAdded = globalsAdded\n }\n\n const f = `${cwd}/.tap/processinfo/${processInfo.uuid}.json`\n mkdirSync(`${cwd}/.tap/processinfo`, { recursive: true })\n writeFileSync(f, JSON.stringify(processInfo, null, 2) + '\\n', 'utf8')\n coverageOnProcessEnd(cwd, processInfo)\n },\n { alwaysLast: true }\n )\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-resolve-cjs.d.ts","sourceRoot":"","sources":["../../lib/require-resolve-cjs.ts"],"names":[],"mappings":";AAIA,eAAO,MAAQ,OAAO,uBAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-resolve-cjs.js","sourceRoot":"","sources":["../../lib/require-resolve-cjs.ts"],"names":[],"mappings":";;;AAAA,8DAA8D;AAC9D,wEAAwE;AACxE,yEAAyE;AACzE,2BAA2B;AACZ,eAAO,GAAK,OAAO,SAAA","sourcesContent":["// This is the CJS version which overwrites require-resolve.js\n// This only works because all of this package's modules are in the same\n// folder, so effectively have the same require.resolve results. It's not\n// intended to be portable!\nexport const { resolve } = require\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolve = void 0;
|
|
4
|
+
// This is the CJS version which overwrites require-resolve.js
|
|
5
|
+
// This only works because all of this package's modules are in the same
|
|
6
|
+
// folder, so effectively have the same require.resolve results. It's not
|
|
7
|
+
// intended to be portable!
|
|
8
|
+
exports.resolve = require.resolve;
|
|
9
|
+
//# sourceMappingURL=require-resolve-cjs.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ProcessEnvOptions } from 'child_process';
|
|
2
|
+
export type WithExternalID<T> = T & {
|
|
3
|
+
externalID?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const spawnOpts: <T extends {
|
|
6
|
+
[k: string]: any;
|
|
7
|
+
}>(options: WithExternalID<T>, exclude?: RegExp | string) => Omit<T, "externalID"> & {
|
|
8
|
+
env: ProcessEnvOptions;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=spawn-opts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn-opts.d.ts","sourceRoot":"","sources":["../../lib/spawn-opts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAGjD,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3D,eAAO,MAAM,SAAS;;yCAEV,MAAM,GAAG,MAAM;SACO,iBAAiB;CAWlD,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.spawnOpts = void 0;
|
|
4
|
+
const node_options_env_js_1 = require("./node-options-env.js");
|
|
5
|
+
const spawnOpts = (options, exclude) => {
|
|
6
|
+
const { externalID, ...rest } = options;
|
|
7
|
+
const env = { ...(options.env || process.env) };
|
|
8
|
+
env.NODE_OPTIONS = (0, node_options_env_js_1.nodeOptionsEnv)(env, []);
|
|
9
|
+
if (externalID) {
|
|
10
|
+
env._TAPJS_PROCESSINFO_EXTERNAL_ID_ = externalID;
|
|
11
|
+
}
|
|
12
|
+
if (exclude) {
|
|
13
|
+
env._TAPJS_PROCESSINFO_EXCLUDE_ = String(exclude);
|
|
14
|
+
}
|
|
15
|
+
return { ...rest, env };
|
|
16
|
+
};
|
|
17
|
+
exports.spawnOpts = spawnOpts;
|
|
18
|
+
//# sourceMappingURL=spawn-opts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn-opts.js","sourceRoot":"","sources":["../../lib/spawn-opts.ts"],"names":[],"mappings":";;;AACA,+DAAsD;AAI/C,MAAM,SAAS,GAAG,CACvB,OAA0B,EAC1B,OAAyB,EAC2B,EAAE;IACtD,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IACvC,MAAM,GAAG,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAA;IAC/C,GAAG,CAAC,YAAY,GAAG,IAAA,oCAAc,EAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IAC1C,IAAI,UAAU,EAAE;QACd,GAAG,CAAC,+BAA+B,GAAG,UAAU,CAAA;KACjD;IACD,IAAI,OAAO,EAAE;QACX,GAAG,CAAC,2BAA2B,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;KAClD;IACD,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,CAAA;AACzB,CAAC,CAAA;AAdY,QAAA,SAAS,aAcrB","sourcesContent":["import { ProcessEnvOptions } from 'child_process'\nimport { nodeOptionsEnv } from './node-options-env.js'\n\nexport type WithExternalID<T> = T & { externalID?: string }\n\nexport const spawnOpts = <T extends { [k: string]: any }>(\n options: WithExternalID<T>,\n exclude?: RegExp | string\n): Omit<T, 'externalID'> & { env: ProcessEnvOptions } => {\n const { externalID, ...rest } = options\n const env = { ...(options.env || process.env) }\n env.NODE_OPTIONS = nodeOptionsEnv(env, [])\n if (externalID) {\n env._TAPJS_PROCESSINFO_EXTERNAL_ID_ = externalID\n }\n if (exclude) {\n env._TAPJS_PROCESSINFO_EXCLUDE_ = String(exclude)\n }\n return { ...rest, env }\n}\n"]}
|
package/dist/cjs/x.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x.d.ts","sourceRoot":"","sources":["../../lib/x.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG,QAAQ,CAAA"}
|
package/dist/cjs/x.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x.js","sourceRoot":"","sources":["../../lib/x.ts"],"names":[],"mappings":";;;AAAa,QAAA,GAAG,GAAG,KAAK,CAAA","sourcesContent":["export const foo = 'bar'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argv-to-node-options.d.ts","sourceRoot":"","sources":["../../lib/argv-to-node-options.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,SAAU,MAAM,EAAE,WACQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argv-to-node-options.js","sourceRoot":"","sources":["../../lib/argv-to-node-options.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAc,EAAE,EAAE,CAClD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA","sourcesContent":["export const argvToNodeOptions = (argv: string[]) =>\n argv.map(o => `\"${o.replace(/\"/g, '\\\\\"')}\"`).join(' ')\n"]}
|