File tree Expand file tree Collapse file tree 3 files changed +2
-9
lines changed Expand file tree Collapse file tree 3 files changed +2
-9
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,6 @@ const { shellouts } = require('./utils/cmd-list.js')
4242let warnedNonDashArg = false
4343const _runCmd = Symbol ( '_runCmd' )
4444const _load = Symbol ( '_load' )
45- const _flatOptions = Symbol ( '_flatOptions' )
4645const _tmpFolder = Symbol ( '_tmpFolder' )
4746const _title = Symbol ( '_title' )
4847const npm = module . exports = new class extends EventEmitter {
@@ -140,9 +139,6 @@ const npm = module.exports = new class extends EventEmitter {
140139 if ( ! er && this . config . get ( 'force' ) )
141140 this . log . warn ( 'using --force' , 'Recommended protections disabled.' )
142141
143- if ( ! er && ! this [ _flatOptions ] )
144- this [ _flatOptions ] = require ( './utils/flat-options.js' ) ( this )
145-
146142 process . emit ( 'timeEnd' , 'npm:load' )
147143 this . emit ( 'load' , er )
148144 } )
@@ -203,7 +199,7 @@ const npm = module.exports = new class extends EventEmitter {
203199 }
204200
205201 get flatOptions ( ) {
206- return this [ _flatOptions ]
202+ return require ( './utils/flat-options.js' ) ( this )
207203 }
208204
209205 get lockfileVersion ( ) {
Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ const flatten = obj => ({
190190 noProxy : obj . noproxy ,
191191} )
192192
193- const flatOptions = npm => npm . flatOptions || Object . freeze ( {
193+ const flatOptions = npm => Object . freeze ( {
194194 // flatten the config object
195195 ...flatten ( npm . config . list [ 0 ] ) ,
196196
Original file line number Diff line number Diff line change @@ -150,9 +150,6 @@ t.test('basic', t => {
150150 // test the object is frozen
151151 generatedFlat . newField = 'asdf'
152152 t . equal ( generatedFlat . newField , undefined , 'object is frozen' )
153- const preExistingOpts = { flat : 'options' }
154- npm . flatOptions = preExistingOpts
155- t . equal ( flatOptions ( npm ) , preExistingOpts , 'use pre-existing npm.flatOptions' )
156153 t . end ( )
157154} )
158155
You can’t perform that action at this time.
0 commit comments