@pnpm/exec.lifecycle 1100.0.18 → 1100.1.1
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/lib/index.d.ts +4 -1
- package/lib/index.js +27 -3
- package/package.json +12 -12
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { runLifecycleHook, type RunLifecycleHookOptions } from './runLifecycleHook.js';
|
|
2
2
|
import { runLifecycleHooksConcurrently, type RunLifecycleHooksConcurrentlyOptions } from './runLifecycleHooksConcurrently.js';
|
|
3
|
-
export declare function makeNodeRequireOption(modulePath: string): {
|
|
3
|
+
export declare function makeNodeRequireOption(modulePath: string, env?: Record<string, string | undefined>): {
|
|
4
|
+
NODE_OPTIONS: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function makeNodePackageMapOption(packageMapPath: string, env?: Record<string, string | undefined>): {
|
|
4
7
|
NODE_OPTIONS: string;
|
|
5
8
|
};
|
|
6
9
|
export { runLifecycleHook, type RunLifecycleHookOptions, runLifecycleHooksConcurrently, type RunLifecycleHooksConcurrentlyOptions, };
|
package/lib/index.js
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
import { safeReadPackageJsonFromDir } from '@pnpm/pkg-manifest.reader';
|
|
2
2
|
import { runLifecycleHook } from './runLifecycleHook.js';
|
|
3
3
|
import { runLifecycleHooksConcurrently } from './runLifecycleHooksConcurrently.js';
|
|
4
|
-
export function makeNodeRequireOption(modulePath) {
|
|
5
|
-
let { NODE_OPTIONS } = process.env;
|
|
6
|
-
NODE_OPTIONS = `${NODE_OPTIONS ?? ''} --require=${modulePath}`.trim();
|
|
4
|
+
export function makeNodeRequireOption(modulePath, env) {
|
|
5
|
+
let { NODE_OPTIONS } = env ?? process.env;
|
|
6
|
+
NODE_OPTIONS = `${NODE_OPTIONS ?? process.env.NODE_OPTIONS ?? ''} --require=${quotePathIfNeeded(modulePath)}`.trim();
|
|
7
7
|
return { NODE_OPTIONS };
|
|
8
8
|
}
|
|
9
|
+
export function makeNodePackageMapOption(packageMapPath, env) {
|
|
10
|
+
let { NODE_OPTIONS } = env ?? process.env;
|
|
11
|
+
NODE_OPTIONS = `${removeNodePackageMapOption(NODE_OPTIONS ?? process.env.NODE_OPTIONS ?? '')} --experimental-package-map=${quotePathIfNeeded(packageMapPath)}`.trim();
|
|
12
|
+
return { NODE_OPTIONS };
|
|
13
|
+
}
|
|
14
|
+
// Node's NODE_OPTIONS tokenizer splits on whitespace, treats `'` and `"` as
|
|
15
|
+
// quote delimiters, and uses `\` as an escape character. A bare path with a
|
|
16
|
+
// space, quote, or backslash (e.g. any Windows path) would therefore be
|
|
17
|
+
// mis-parsed. Wrap such paths in double quotes and escape `\` and `"` so the
|
|
18
|
+
// tokenizer reconstructs the literal path.
|
|
19
|
+
function quotePathIfNeeded(path) {
|
|
20
|
+
if (!/[\s"'\\]/.test(path))
|
|
21
|
+
return path;
|
|
22
|
+
return `"${path.replace(/(["\\])/g, '\\$1')}"`;
|
|
23
|
+
}
|
|
24
|
+
function removeNodePackageMapOption(nodeOptions) {
|
|
25
|
+
// The quoted-value patterns span backslash escapes (`\"`), matching the
|
|
26
|
+
// escaping `makeNodePackageMapOption` emits, so an existing flag whose path
|
|
27
|
+
// contains a quote is still stripped in full.
|
|
28
|
+
return nodeOptions
|
|
29
|
+
.replace(/(?:^|\s)--experimental-package-map=(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\S+)/g, '')
|
|
30
|
+
.replace(/(?:^|\s)--experimental-package-map\s+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\S+)/g, '')
|
|
31
|
+
.trim();
|
|
32
|
+
}
|
|
9
33
|
export { runLifecycleHook, runLifecycleHooksConcurrently, };
|
|
10
34
|
export async function runPostinstallHooks(opts) {
|
|
11
35
|
const pkg = await safeReadPackageJsonFromDir(opts.pkgRoot);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/exec.lifecycle",
|
|
3
|
-
"version": "1100.
|
|
3
|
+
"version": "1100.1.1",
|
|
4
4
|
"description": "Package lifecycle hook runner",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"funding": "https://opencollective.com/pnpm",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "https://github.com/pnpm/pnpm/tree/main/exec/lifecycle"
|
|
15
|
+
"url": "https://github.com/pnpm/pnpm/tree/main/pnpm11/exec/lifecycle"
|
|
16
16
|
},
|
|
17
|
-
"homepage": "https://github.com/pnpm/pnpm/tree/main/exec/lifecycle#readme",
|
|
17
|
+
"homepage": "https://github.com/pnpm/pnpm/tree/main/pnpm11/exec/lifecycle#readme",
|
|
18
18
|
"bugs": {
|
|
19
19
|
"url": "https://github.com/pnpm/pnpm/issues"
|
|
20
20
|
},
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"path-exists": "^5.0.0",
|
|
36
36
|
"run-groups": "^5.0.0",
|
|
37
37
|
"shlex": "^3.0.0",
|
|
38
|
-
"@pnpm/bins.linker": "1100.0.
|
|
38
|
+
"@pnpm/bins.linker": "1100.0.16",
|
|
39
|
+
"@pnpm/error": "1100.0.1",
|
|
39
40
|
"@pnpm/core-loggers": "1100.2.1",
|
|
40
|
-
"@pnpm/error": "1100.0.0",
|
|
41
|
-
"@pnpm/pkg-manifest.reader": "1100.0.8",
|
|
42
41
|
"@pnpm/store.cafs-types": "1100.0.1",
|
|
43
|
-
"@pnpm/
|
|
44
|
-
"@pnpm/
|
|
45
|
-
"@pnpm/
|
|
42
|
+
"@pnpm/pkg-manifest.reader": "1100.0.9",
|
|
43
|
+
"@pnpm/store.controller-types": "1100.1.6",
|
|
44
|
+
"@pnpm/fetching.directory-fetcher": "1100.0.18",
|
|
45
|
+
"@pnpm/types": "1101.3.2"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@pnpm/logger": "^1100.0.0"
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"@types/is-windows": "^1.0.2",
|
|
53
53
|
"@zkochan/rimraf": "^4.0.0",
|
|
54
54
|
"load-json-file": "^7.0.1",
|
|
55
|
-
"@pnpm/exec.lifecycle": "1100.0.18",
|
|
56
55
|
"@pnpm/logger": "1100.0.0",
|
|
57
|
-
"@pnpm/
|
|
56
|
+
"@pnpm/exec.lifecycle": "1100.1.1",
|
|
58
57
|
"@pnpm/test-ipc-server": "1100.0.0",
|
|
59
|
-
"@pnpm/
|
|
58
|
+
"@pnpm/test-fixtures": "1100.0.0",
|
|
59
|
+
"@pnpm/prepare": "1100.0.17"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=22.13"
|