Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tapjs/processinfo

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tapjs/processinfo - npm Package Compare versions

Comparing version 3.1.6 to 3.1.7

18

dist/commonjs/child_process.js

@@ -23,3 +23,3 @@ "use strict";

}
return (0, child_process_1.spawn)(cmd, args || [], (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k)));
return (0, child_process_1.spawn)(cmd, args || [], (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k), args));
}

@@ -32,3 +32,3 @@ exports.spawn = spawn;

}
return (0, child_process_1.spawnSync)(cmd, args || [], (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k)));
return (0, child_process_1.spawnSync)(cmd, args || [], (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k), args));
}

@@ -39,8 +39,8 @@ exports.spawnSync = spawnSync;

if (typeof options === 'function') {
return (0, child_process_1.exec)(cmd, (0, spawn_opts_js_1.spawnOpts)({}, (0, get_exclude_js_1.getExclude)(k)), options);
return (0, child_process_1.exec)(cmd, (0, spawn_opts_js_1.spawnOpts)({}, (0, get_exclude_js_1.getExclude)(k), []), options);
}
else if (!options) {
return (0, child_process_1.exec)(cmd, (0, spawn_opts_js_1.spawnOpts)({}, (0, get_exclude_js_1.getExclude)(k)), callback);
return (0, child_process_1.exec)(cmd, (0, spawn_opts_js_1.spawnOpts)({}, (0, get_exclude_js_1.getExclude)(k), []), callback);
}
return (0, child_process_1.exec)(cmd, (0, spawn_opts_js_1.spawnOpts)(options, (0, get_exclude_js_1.getExclude)(k)), callback);
return (0, child_process_1.exec)(cmd, (0, spawn_opts_js_1.spawnOpts)(options, (0, get_exclude_js_1.getExclude)(k), []), callback);
}

@@ -77,3 +77,3 @@ exports.exec = exec;

}
return (0, child_process_1.execFile)(file, args, (0, spawn_opts_js_1.spawnOpts)(options, (0, get_exclude_js_1.getExclude)(k)), callback);
return (0, child_process_1.execFile)(file, args, (0, spawn_opts_js_1.spawnOpts)(options, (0, get_exclude_js_1.getExclude)(k), args), callback);
}

@@ -89,3 +89,3 @@ exports.execFile = execFile;

}
return customPromisify(child_process_1.execFile)(file, (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k)));
return customPromisify(child_process_1.execFile)(file, (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k), args));
}

@@ -103,3 +103,3 @@ execFile.__promisify__ = __promisify__;

}
return (0, child_process_1.execFileSync)(file, args || [], (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k)));
return (0, child_process_1.execFileSync)(file, args || [], (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k), args));
}

@@ -112,5 +112,5 @@ exports.execFileSync = execFileSync;

}
return (0, child_process_1.fork)(modulePath, args, (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k)));
return (0, child_process_1.fork)(modulePath, args, (0, spawn_opts_js_1.spawnOpts)(options || {}, (0, get_exclude_js_1.getExclude)(k), args));
}
exports.fork = fork;
//# sourceMappingURL=child_process.js.map

@@ -17,3 +17,3 @@ "use strict";

const register_require_js_1 = require("./register-require.js");
// this module is hybridized. In node v20.0 = v20.6, it's the *commonjs* one
// this module is hybridized. In node v20.0 - v20.6, it's the *commonjs* one
// that gets loaded, because the esm loader context can't modify the main

@@ -20,0 +20,0 @@ // thread except via communication over the port to the globalPreload env. So,

@@ -5,3 +5,3 @@ /// <reference types="node" />

/// <reference types="node" />
export declare const nodeOptionsEnv: (env: NodeJS.ProcessEnv) => string;
export declare const nodeOptionsEnv: (env: NodeJS.ProcessEnv, args: readonly string[]) => string;
//# sourceMappingURL=node-options-env.d.ts.map

@@ -30,2 +30,69 @@ "use strict";

.register;
// JUST test if we need to do anything at all with the env.
// if the loader is set already in the args, even incorrectly, return true
const hasLoader = (args) => {
for (let i = 0; i < args.length; i++) {
const arg = args[i];
/* c8 ignore start */
if (typeof arg !== 'string')
throw new Error('invalid arg');
/* c8 ignore stop */
if (!arg.startsWith('--') || arg === '--')
break;
const [eq, k, v] = getKeyValue(args, i);
if (!v) {
// wasn't a key-value pair
continue;
}
if (!eq)
i++;
if ((k === '--experimental-loader' || k === '--loader') &&
(0, loader_paths_js_1.legacyMatch)(v)) {
return true;
}
if (k === '--import' && (0, loader_paths_js_1.importMatch)(v))
return true;
}
return false;
};
const rmLoader = (args) => {
const doNotWantKeys = ['--experimental-loader', '--loader', '--import'];
const result = [];
let doubledash = false;
for (let i = 0; i < args.length; i++) {
const arg = args[i];
/* c8 ignore start */
if (typeof arg !== 'string')
throw new Error('invalid arg');
/* c8 ignore stop */
if (!arg.startsWith('--') || doubledash) {
result.push(arg);
continue;
}
if (arg === '--') {
result.push(arg);
doubledash = true;
continue;
}
const [eq, k, v] = getKeyValue(args, i);
if (!v) {
// wasn't a key-value pair
result.push(arg);
continue;
}
if (!eq)
i++;
if (doNotWantKeys.includes(k) && ((0, loader_paths_js_1.importMatch)(v) || (0, loader_paths_js_1.legacyMatch)(v))) {
// it's ours, remove it
continue;
}
// not ours, leave it
result.push(arg);
const next = args[i];
if (!eq && typeof next === 'string')
result.push(next);
continue;
}
return result;
};
const addLoader = (args) => {

@@ -39,3 +106,3 @@ const addKey = useImport ? '--import' : '--loader';

const test = useImport ? loader_paths_js_1.importMatch : loader_paths_js_1.legacyMatch;
const added = [];
const result = [];
let doubledash = false;

@@ -50,7 +117,7 @@ let found = false;

if (!arg.startsWith('--') || doubledash) {
added.push(arg);
result.push(arg);
continue;
}
if (arg === '--') {
added.push(arg);
result.push(arg);
doubledash = true;

@@ -62,3 +129,3 @@ continue;

// wasn't a key-value pair
added.push(arg);
result.push(arg);
continue;

@@ -77,13 +144,13 @@ }

found = true;
added.push(arg);
result.push(arg);
const next = args[i];
if (!eq && typeof next === 'string')
added.push(next);
result.push(next);
}
else {
// not ours
added.push(arg);
result.push(arg);
const next = args[i];
if (!eq && typeof next === 'string')
added.push(next);
result.push(next);
continue;

@@ -93,4 +160,4 @@ }

if (!found)
added.push(`${addKey}=${addValue}`);
return !useImport ? addIgnoreLoadersWarning(added) : added;
result.push(`${addKey}=${addValue}`);
return !useImport ? addIgnoreLoadersWarning(result) : result;
};

@@ -101,7 +168,8 @@ const addIgnoreLoadersWarning = (args) => args.includes('--no-warnings') ||

: args.concat('--no-warnings');
const nodeOptionsEnv = (env) => {
const nodeOptionsEnv = (env, args) => {
// if we already have the loader in args, don't add to NODE_OPTIONS
const no = (0, node_options_to_argv_js_1.nodeOptionsToArgv)(env.NODE_OPTIONS);
return (0, argv_to_node_options_js_1.argvToNodeOptions)(addLoader(no));
return (0, argv_to_node_options_js_1.argvToNodeOptions)(hasLoader(args) ? rmLoader(no) : addLoader(no));
};
exports.nodeOptionsEnv = nodeOptionsEnv;
//# sourceMappingURL=node-options-env.js.map

@@ -38,2 +38,3 @@ "use strict";

: /[\\\/]node_modules[\\\/]/;
const fileEx = (0, get_exclude_js_1.getExclude)('_TAPJS_PROCESSINFO_EXCLUDE_', false);
const fileCovered = (f, sources = [], files = []) => {

@@ -46,3 +47,11 @@ const testFiles = [f];

if (!testFiles.some(f => files.includes(f))) {
return false;
// just in case it was missed somehow, make sure it *should* be excluded
for (const f of testFiles) {
if (fileEx.test(f)) {
return false;
}
}
// otherwise, it was missed by the loader recording somehow
// this can happen with commonjs transpilations in some cases
files.push(f);
}

@@ -49,0 +58,0 @@ // if at least one of them are explicitly covered, then include it,

@@ -12,3 +12,3 @@ "use strict";

const { hasOwnProperty } = Object.prototype;
const getEnvs = (env) => {
const getEnvs = (env, args = []) => {
// load it here so that it isn't cached before the loader attaches

@@ -20,3 +20,3 @@ // in self-test scenario.

.concat([
['NODE_OPTIONS', (0, node_options_env_js_1.nodeOptionsEnv)(env?.NODE_OPTIONS ? env : p.env)],
['NODE_OPTIONS', (0, node_options_env_js_1.nodeOptionsEnv)(env?.NODE_OPTIONS ? env : p.env, args)],
]));

@@ -28,3 +28,3 @@ };

...(obj.env || p.env),
...getEnvs(obj.env),
...getEnvs(obj.env, obj.args),
};

@@ -31,0 +31,0 @@ return obj;

@@ -7,5 +7,5 @@ import { ProcessEnvOptions } from 'child_process';

[k: string]: any;
}>(options: WithExternalID<T>, exclude?: RegExp | string) => Omit<T, "externalID"> & {
}>(options: WithExternalID<T>, exclude?: RegExp | string, args?: readonly string[]) => Omit<T, "externalID"> & {
env: ProcessEnvOptions;
};
//# sourceMappingURL=spawn-opts.d.ts.map

@@ -6,6 +6,12 @@ "use strict";

const p = process;
const spawnOpts = (options, exclude) => {
const spawnOpts = (options, exclude, args) => {
const { externalID, ...rest } = options;
const env = { ...(options.env || p.env) };
env.NODE_OPTIONS = (0, node_options_env_js_1.nodeOptionsEnv)(env);
// only add if lacking in args, but this can come in multiple ways
const a = [
...(options.execArgv ?? []),
...(args ?? []),
...(options.args ?? []),
];
env.NODE_OPTIONS = (0, node_options_env_js_1.nodeOptionsEnv)(env, a);
if (externalID) {

@@ -12,0 +18,0 @@ env._TAPJS_PROCESSINFO_EXTERNAL_ID_ = externalID;

@@ -20,3 +20,3 @@ // This wraps all of the various spawn methods such that externalID can be

}
return cpSpawn(cmd, args || [], spawnOpts(options || {}, getExclude(k)));
return cpSpawn(cmd, args || [], spawnOpts(options || {}, getExclude(k), args));
}

@@ -28,3 +28,3 @@ export function spawnSync(cmd, args, options) {

}
return cpSpawnSync(cmd, args || [], spawnOpts(options || {}, getExclude(k)));
return cpSpawnSync(cmd, args || [], spawnOpts(options || {}, getExclude(k), args));
}

@@ -34,8 +34,8 @@ export function exec(...args) {

if (typeof options === 'function') {
return cpExec(cmd, spawnOpts({}, getExclude(k)), options);
return cpExec(cmd, spawnOpts({}, getExclude(k), []), options);
}
else if (!options) {
return cpExec(cmd, spawnOpts({}, getExclude(k)), callback);
return cpExec(cmd, spawnOpts({}, getExclude(k), []), callback);
}
return cpExec(cmd, spawnOpts(options, getExclude(k)), callback);
return cpExec(cmd, spawnOpts(options, getExclude(k), []), callback);
}

@@ -70,3 +70,3 @@ (function (exec) {

}
return cpExecFile(file, args, spawnOpts(options, getExclude(k)), callback);
return cpExecFile(file, args, spawnOpts(options, getExclude(k), args), callback);
}

@@ -81,3 +81,3 @@ (function (execFile) {

}
return customPromisify(cpExecFile)(file, spawnOpts(options || {}, getExclude(k)));
return customPromisify(cpExecFile)(file, spawnOpts(options || {}, getExclude(k), args));
}

@@ -95,3 +95,3 @@ execFile.__promisify__ = __promisify__;

}
return cpExecFileSync(file, args || [], spawnOpts(options || {}, getExclude(k)));
return cpExecFileSync(file, args || [], spawnOpts(options || {}, getExclude(k), args));
}

@@ -103,4 +103,4 @@ export function fork(modulePath, args, options) {

}
return cpFork(modulePath, args, spawnOpts(options || {}, getExclude(k)));
return cpFork(modulePath, args, spawnOpts(options || {}, getExclude(k), args));
}
//# sourceMappingURL=child_process.js.map

@@ -14,3 +14,3 @@ // we always want this

import { register as registerRequire } from './register-require.js';
// this module is hybridized. In node v20.0 = v20.6, it's the *commonjs* one
// this module is hybridized. In node v20.0 - v20.6, it's the *commonjs* one
// that gets loaded, because the esm loader context can't modify the main

@@ -17,0 +17,0 @@ // thread except via communication over the port to the globalPreload env. So,

@@ -5,3 +5,3 @@ /// <reference types="node" resolution-mode="require"/>

/// <reference types="node" resolution-mode="require"/>
export declare const nodeOptionsEnv: (env: NodeJS.ProcessEnv) => string;
export declare const nodeOptionsEnv: (env: NodeJS.ProcessEnv, args: readonly string[]) => string;
//# sourceMappingURL=node-options-env.d.ts.map
import { argvToNodeOptions } from './argv-to-node-options.js';
import { legacyLoader, legacyMatch, importLoader, importMatch, } from './loader-paths.js';
import { importLoader, importMatch, legacyLoader, legacyMatch, } from './loader-paths.js';
import { nodeOptionsToArgv } from './node-options-to-argv.js';

@@ -24,2 +24,69 @@ import Module from 'node:module';

.register;
// JUST test if we need to do anything at all with the env.
// if the loader is set already in the args, even incorrectly, return true
const hasLoader = (args) => {
for (let i = 0; i < args.length; i++) {
const arg = args[i];
/* c8 ignore start */
if (typeof arg !== 'string')
throw new Error('invalid arg');
/* c8 ignore stop */
if (!arg.startsWith('--') || arg === '--')
break;
const [eq, k, v] = getKeyValue(args, i);
if (!v) {
// wasn't a key-value pair
continue;
}
if (!eq)
i++;
if ((k === '--experimental-loader' || k === '--loader') &&
legacyMatch(v)) {
return true;
}
if (k === '--import' && importMatch(v))
return true;
}
return false;
};
const rmLoader = (args) => {
const doNotWantKeys = ['--experimental-loader', '--loader', '--import'];
const result = [];
let doubledash = false;
for (let i = 0; i < args.length; i++) {
const arg = args[i];
/* c8 ignore start */
if (typeof arg !== 'string')
throw new Error('invalid arg');
/* c8 ignore stop */
if (!arg.startsWith('--') || doubledash) {
result.push(arg);
continue;
}
if (arg === '--') {
result.push(arg);
doubledash = true;
continue;
}
const [eq, k, v] = getKeyValue(args, i);
if (!v) {
// wasn't a key-value pair
result.push(arg);
continue;
}
if (!eq)
i++;
if (doNotWantKeys.includes(k) && (importMatch(v) || legacyMatch(v))) {
// it's ours, remove it
continue;
}
// not ours, leave it
result.push(arg);
const next = args[i];
if (!eq && typeof next === 'string')
result.push(next);
continue;
}
return result;
};
const addLoader = (args) => {

@@ -33,3 +100,3 @@ const addKey = useImport ? '--import' : '--loader';

const test = useImport ? importMatch : legacyMatch;
const added = [];
const result = [];
let doubledash = false;

@@ -44,7 +111,7 @@ let found = false;

if (!arg.startsWith('--') || doubledash) {
added.push(arg);
result.push(arg);
continue;
}
if (arg === '--') {
added.push(arg);
result.push(arg);
doubledash = true;

@@ -56,3 +123,3 @@ continue;

// wasn't a key-value pair
added.push(arg);
result.push(arg);
continue;

@@ -71,13 +138,13 @@ }

found = true;
added.push(arg);
result.push(arg);
const next = args[i];
if (!eq && typeof next === 'string')
added.push(next);
result.push(next);
}
else {
// not ours
added.push(arg);
result.push(arg);
const next = args[i];
if (!eq && typeof next === 'string')
added.push(next);
result.push(next);
continue;

@@ -87,4 +154,4 @@ }

if (!found)
added.push(`${addKey}=${addValue}`);
return !useImport ? addIgnoreLoadersWarning(added) : added;
result.push(`${addKey}=${addValue}`);
return !useImport ? addIgnoreLoadersWarning(result) : result;
};

@@ -95,6 +162,7 @@ const addIgnoreLoadersWarning = (args) => args.includes('--no-warnings') ||

: args.concat('--no-warnings');
export const nodeOptionsEnv = (env) => {
export const nodeOptionsEnv = (env, args) => {
// if we already have the loader in args, don't add to NODE_OPTIONS
const no = nodeOptionsToArgv(env.NODE_OPTIONS);
return argvToNodeOptions(addLoader(no));
return argvToNodeOptions(hasLoader(args) ? rmLoader(no) : addLoader(no));
};
//# sourceMappingURL=node-options-env.js.map

@@ -35,2 +35,3 @@ // start tracking coverage, unless disabled explicltly

: /[\\\/]node_modules[\\\/]/;
const fileEx = getExclude('_TAPJS_PROCESSINFO_EXCLUDE_', false);
const fileCovered = (f, sources = [], files = []) => {

@@ -43,3 +44,11 @@ const testFiles = [f];

if (!testFiles.some(f => files.includes(f))) {
return false;
// just in case it was missed somehow, make sure it *should* be excluded
for (const f of testFiles) {
if (fileEx.test(f)) {
return false;
}
}
// otherwise, it was missed by the loader recording somehow
// this can happen with commonjs transpilations in some cases
files.push(f);
}

@@ -46,0 +55,0 @@ // if at least one of them are explicitly covered, then include it,

@@ -6,3 +6,3 @@ import processOnSpawn from 'process-on-spawn';

const { hasOwnProperty } = Object.prototype;
const getEnvs = (env) => {
const getEnvs = (env, args = []) => {
// load it here so that it isn't cached before the loader attaches

@@ -14,3 +14,3 @@ // in self-test scenario.

.concat([
['NODE_OPTIONS', nodeOptionsEnv(env?.NODE_OPTIONS ? env : p.env)],
['NODE_OPTIONS', nodeOptionsEnv(env?.NODE_OPTIONS ? env : p.env, args)],
]));

@@ -22,3 +22,3 @@ };

...(obj.env || p.env),
...getEnvs(obj.env),
...getEnvs(obj.env, obj.args),
};

@@ -25,0 +25,0 @@ return obj;

@@ -7,5 +7,5 @@ import { ProcessEnvOptions } from 'child_process';

[k: string]: any;
}>(options: WithExternalID<T>, exclude?: RegExp | string) => Omit<T, "externalID"> & {
}>(options: WithExternalID<T>, exclude?: RegExp | string, args?: readonly string[]) => Omit<T, "externalID"> & {
env: ProcessEnvOptions;
};
//# sourceMappingURL=spawn-opts.d.ts.map
import { nodeOptionsEnv } from './node-options-env.js';
const p = process;
export const spawnOpts = (options, exclude) => {
export const spawnOpts = (options, exclude, args) => {
const { externalID, ...rest } = options;
const env = { ...(options.env || p.env) };
env.NODE_OPTIONS = nodeOptionsEnv(env);
// only add if lacking in args, but this can come in multiple ways
const a = [
...(options.execArgv ?? []),
...(args ?? []),
...(options.args ?? []),
];
env.NODE_OPTIONS = nodeOptionsEnv(env, a);
if (externalID) {

@@ -8,0 +14,0 @@ env._TAPJS_PROCESSINFO_EXTERNAL_ID_ = externalID;

{
"name": "@tapjs/processinfo",
"version": "3.1.6",
"version": "3.1.7",
"files": [

@@ -5,0 +5,0 @@ "dist"

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

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc