@tapjs/processinfo
Advanced tools
Comparing version 2.2.3 to 2.2.4
@@ -7,2 +7,3 @@ "use strict"; | ||
p.setSourceMapsEnabled(true); | ||
const node_url_1 = require("node:url"); | ||
const uuid_1 = require("uuid"); | ||
@@ -13,6 +14,6 @@ const envKey = (k) => `_TAPJS_PROCESSINFO_${k.toUpperCase()}_`; | ||
const delEnv = (k) => delete process.env[envKey(k)]; | ||
const register_cjs_js_1 = require("./register-cjs.js"); | ||
const register_coverage_js_1 = require("./register-coverage.js"); | ||
const register_env_js_1 = require("./register-env.js"); | ||
const register_process_end_js_1 = require("./register-process-end.js"); | ||
const register_cjs_js_1 = require("./register-cjs.js"); | ||
// this module is hybridized. In node v20, it's the *commonjs* one that | ||
@@ -36,2 +37,7 @@ // gets loaded, because the esm loader context can't modify the main thread | ||
return g[kProcessInfo]; | ||
const argv1 = process.argv[1]; | ||
// we only test this in CJS, but file:// only prepended in ESM | ||
/* c8 ignore start */ | ||
const main = argv1.startsWith('file://') ? (0, node_url_1.fileURLToPath)(argv1) : argv1; | ||
/* c8 ignore stop */ | ||
g[kProcessInfo] = { | ||
@@ -48,3 +54,3 @@ hrstart: process.hrtime(), | ||
uuid: (0, uuid_1.v4)(), | ||
files: [], | ||
files: [main], | ||
sources: Object.create(null), | ||
@@ -51,0 +57,0 @@ }; |
@@ -14,10 +14,12 @@ "use strict"; | ||
// in self-test scenario. | ||
const e = env || process.env; | ||
return Object.fromEntries(Object.entries(e) | ||
.filter(([k]) => !hasOwnProperty.call(env || {}, k) && envRE.test(k)) | ||
.concat([['NODE_OPTIONS', (0, node_options_env_js_1.nodeOptionsEnv)(e, process.execArgv)]])); | ||
// copy all of OUR envs, if not specifically set on the env object | ||
return Object.fromEntries(Object.entries(process.env) | ||
.filter(([k]) => !(env && hasOwnProperty.call(env, k)) && envRE.test(k)) | ||
.concat([ | ||
['NODE_OPTIONS', (0, node_options_env_js_1.nodeOptionsEnv)(process.env, process.execArgv)], | ||
])); | ||
}; | ||
const register = () => { | ||
process_on_spawn_1.default.addListener(obj => { | ||
obj.env = Object.assign(obj.env || {}, getEnvs(obj.env)); | ||
obj.env = Object.assign(obj.env || { ...process.env }, getEnvs(obj.env)); | ||
return obj; | ||
@@ -24,0 +26,0 @@ }); |
// we always want this | ||
const p = process; | ||
p.setSourceMapsEnabled(true); | ||
import { fileURLToPath } from 'node:url'; | ||
import { v4 as uuid } from 'uuid'; | ||
@@ -9,6 +10,6 @@ const envKey = (k) => `_TAPJS_PROCESSINFO_${k.toUpperCase()}_`; | ||
const delEnv = (k) => delete process.env[envKey(k)]; | ||
import { register as registerCJS } from './register-cjs.js'; | ||
import { register as registerCoverage } from './register-coverage.js'; | ||
import { register as registerEnv } from './register-env.js'; | ||
import { register as registerProcessEnd } from './register-process-end.js'; | ||
import { register as registerCJS } from './register-cjs.js'; | ||
// this module is hybridized. In node v20, it's the *commonjs* one that | ||
@@ -31,2 +32,7 @@ // gets loaded, because the esm loader context can't modify the main thread | ||
return g[kProcessInfo]; | ||
const argv1 = process.argv[1]; | ||
// we only test this in CJS, but file:// only prepended in ESM | ||
/* c8 ignore start */ | ||
const main = argv1.startsWith('file://') ? fileURLToPath(argv1) : argv1; | ||
/* c8 ignore stop */ | ||
g[kProcessInfo] = { | ||
@@ -43,3 +49,3 @@ hrstart: process.hrtime(), | ||
uuid: uuid(), | ||
files: [], | ||
files: [main], | ||
sources: Object.create(null), | ||
@@ -46,0 +52,0 @@ }; |
@@ -8,10 +8,12 @@ import processOnSpawn from 'process-on-spawn'; | ||
// in self-test scenario. | ||
const e = env || process.env; | ||
return Object.fromEntries(Object.entries(e) | ||
.filter(([k]) => !hasOwnProperty.call(env || {}, k) && envRE.test(k)) | ||
.concat([['NODE_OPTIONS', nodeOptionsEnv(e, process.execArgv)]])); | ||
// copy all of OUR envs, if not specifically set on the env object | ||
return Object.fromEntries(Object.entries(process.env) | ||
.filter(([k]) => !(env && hasOwnProperty.call(env, k)) && envRE.test(k)) | ||
.concat([ | ||
['NODE_OPTIONS', nodeOptionsEnv(process.env, process.execArgv)], | ||
])); | ||
}; | ||
export const register = () => { | ||
processOnSpawn.addListener(obj => { | ||
obj.env = Object.assign(obj.env || {}, getEnvs(obj.env)); | ||
obj.env = Object.assign(obj.env || { ...process.env }, getEnvs(obj.env)); | ||
return obj; | ||
@@ -18,0 +20,0 @@ }); |
{ | ||
"name": "@tapjs/processinfo", | ||
"version": "2.2.3", | ||
"version": "2.2.4", | ||
"main": "./dist/cjs/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./dist/cjs/index.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
310380
2388
46