Skip to content

Commit 17a695f

Browse files
committed
Skip nodeHardenFlags for pnpm < 11
1 parent e27c5f8 commit 17a695f

File tree

5 files changed

+122
-79
lines changed

5 files changed

+122
-79
lines changed

.dep-stats.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@socketregistry/is-interactive": "1.0.5",
1111
"@socketregistry/packageurl-js": "1.0.5",
1212
"@socketsecurity/config": "2.1.3",
13-
"@socketsecurity/registry": "1.0.141",
13+
"@socketsecurity/registry": "1.0.142",
1414
"@socketsecurity/sdk": "1.4.28",
1515
"browserslist": "4.24.4",
1616
"chalk-table": "1.0.2",

package-lock.json

Lines changed: 112 additions & 73 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"@socketregistry/is-interactive": "1.0.5",
8787
"@socketregistry/packageurl-js": "1.0.5",
8888
"@socketsecurity/config": "2.1.3",
89-
"@socketsecurity/registry": "1.0.141",
89+
"@socketsecurity/registry": "1.0.142",
9090
"@socketsecurity/sdk": "1.4.28",
9191
"browserslist": "4.24.4",
9292
"chalk-table": "1.0.2",

src/commands/optimize/run-agent.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { safeNpmInstall } from '../../utils/npm'
77

88
import type { EnvDetails } from '../../utils/package-environment'
99

10-
const { NPM } = constants
10+
const { NPM, PNPM } = constants
1111

1212
type SpawnOption = Exclude<Parameters<typeof spawn>[2], undefined>
1313
type SpawnResult = ReturnType<typeof spawn>
@@ -34,15 +34,19 @@ export function runAgentInstall(
3434
spinner,
3535
...spawnOptions
3636
} = { __proto__: null, ...options } as AgentInstallOptions
37+
const skipNodeHardenFlags =
38+
pkgEnvDetails.agent === PNPM && pkgEnvDetails.agentVersion.major < 11
3739
return spawn(agentExecPath, ['install', ...args], {
3840
spinner,
3941
stdio: 'inherit',
4042
...spawnOptions,
4143
env: {
4244
...process.env,
4345
NODE_OPTIONS: cmdFlagsToString([
44-
// Lazily access constants.nodeHardenFlags.
45-
...constants.nodeHardenFlags,
46+
...(skipNodeHardenFlags
47+
? []
48+
: // Lazily access constants.nodeHardenFlags.
49+
constants.nodeHardenFlags),
4650
// Lazily access constants.nodeNoWarningsFlags.
4751
...constants.nodeNoWarningsFlags
4852
]),

src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ const lazyNodeHardenFlags = () =>
359359
// Node's --frozen-intrinsics workable.
360360
// √ https://github.com/SBoudrias/Inquirer.js/pull/1683
361361
// √ https://github.com/pnpm/components/pull/23
362-
['--disable-proto', 'delete', '--frozen-intrinsics', '--no-deprecation']
362+
['--disable-proto', 'throw', '--frozen-intrinsics', '--no-deprecation']
363363

364364
const lazyRootBinPath = () =>
365365
// Lazily access constants.rootPath.

0 commit comments

Comments
 (0)