@@ -248,6 +248,26 @@ const lazyNmBinPath = () =>
248248 // Lazily access constants.rootPath.
249249 path . join ( constants . rootPath , `${ NODE_MODULES } /.bin` )
250250
251+ const lazyNodeHardenFlags = ( ) =>
252+ // The '@rollup/plugin-replace' will replace "process.env[INLINED_SOCKET_CLI_SENTRY_BUILD]".
253+ process . env [ INLINED_SOCKET_CLI_SENTRY_BUILD ]
254+ ? [ ]
255+ : // Harden Node security.
256+ // https://nodejs.org/en/learn/getting-started/security-best-practices
257+ [
258+ '--disable-proto' ,
259+ 'delete' ,
260+ // Lazily access constants.WIN32.
261+ constants . WIN32
262+ ? // We have contributed the following patches to our dependencies to make
263+ // Node's --frozen-intrinsics workable.
264+ // √ https://github.com/SBoudrias/Inquirer.js/pull/1683
265+ // √ https://github.com/pnpm/components/pull/23
266+ [ '--frozen-intrinsics' ]
267+ : [ ] ,
268+ '--no-deprecation'
269+ ]
270+
251271const lazyRootBinPath = ( ) =>
252272 // Lazily access constants.rootPath.
253273 path . join ( constants . rootPath , 'bin' )
@@ -271,23 +291,6 @@ const lazyZshRcPath = () =>
271291 // Lazily access constants.homePath.
272292 path . join ( constants . homePath , '.zshrc' )
273293
274- // Harden Node security.
275- // https://nodejs.org/en/learn/getting-started/security-best-practices
276- const nodeHardenFlags : string [ ] =
277- // The '@rollup/plugin-replace' will replace "process.env[INLINED_SOCKET_CLI_SENTRY_BUILD]".
278- process . env [ INLINED_SOCKET_CLI_SENTRY_BUILD ]
279- ? [ ]
280- : [
281- '--disable-proto' ,
282- 'delete' ,
283- // We have contributed the following patches to our dependencies to make
284- // Node's --frozen-intrinsics workable.
285- // √ https://github.com/SBoudrias/Inquirer.js/pull/1683
286- // √ https://github.com/pnpm/components/pull/23
287- '--frozen-intrinsics' ,
288- '--no-deprecation'
289- ]
290-
291294const constants = createConstantsObject (
292295 {
293296 ALERT_TYPE_CRITICAL_CVE ,
@@ -350,7 +353,7 @@ const constants = createConstantsObject(
350353 distShadowNpmInjectPath : undefined ,
351354 homePath : undefined ,
352355 nmBinPath : undefined ,
353- nodeHardenFlags,
356+ nodeHardenFlags : undefined ,
354357 rootBinPath : undefined ,
355358 rootDistPath : undefined ,
356359 rootPath : undefined ,
@@ -370,6 +373,7 @@ const constants = createConstantsObject(
370373 distShadowNpmInjectPath : lazyDistShadowNpmInjectPath ,
371374 homePath : lazyHomePath ,
372375 nmBinPath : lazyNmBinPath ,
376+ nodeHardenFlags : lazyNodeHardenFlags ,
373377 rootBinPath : lazyRootBinPath ,
374378 rootDistPath : lazyRootDistPath ,
375379 rootPath : lazyRootPath ,
0 commit comments