@@ -248,6 +248,26 @@ const lazyNmBinPath = () =>
248
248
// Lazily access constants.rootPath.
249
249
path . join ( constants . rootPath , `${ NODE_MODULES } /.bin` )
250
250
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
+
251
271
const lazyRootBinPath = ( ) =>
252
272
// Lazily access constants.rootPath.
253
273
path . join ( constants . rootPath , 'bin' )
@@ -271,23 +291,6 @@ const lazyZshRcPath = () =>
271
291
// Lazily access constants.homePath.
272
292
path . join ( constants . homePath , '.zshrc' )
273
293
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
-
291
294
const constants = createConstantsObject (
292
295
{
293
296
ALERT_TYPE_CRITICAL_CVE ,
@@ -350,7 +353,7 @@ const constants = createConstantsObject(
350
353
distShadowNpmInjectPath : undefined ,
351
354
homePath : undefined ,
352
355
nmBinPath : undefined ,
353
- nodeHardenFlags,
356
+ nodeHardenFlags : undefined ,
354
357
rootBinPath : undefined ,
355
358
rootDistPath : undefined ,
356
359
rootPath : undefined ,
@@ -370,6 +373,7 @@ const constants = createConstantsObject(
370
373
distShadowNpmInjectPath : lazyDistShadowNpmInjectPath ,
371
374
homePath : lazyHomePath ,
372
375
nmBinPath : lazyNmBinPath ,
376
+ nodeHardenFlags : lazyNodeHardenFlags ,
373
377
rootBinPath : lazyRootBinPath ,
374
378
rootDistPath : lazyRootDistPath ,
375
379
rootPath : lazyRootPath ,
0 commit comments