@@ -75,10 +75,8 @@ const requireUrlAssignmentRegExp =
7575const splitUrlRequiresRegExp = / r e q u i r e \( [ " ' ] u [ " ' ] \s * \+ \s * [ " ' ] r l [ " ' ] \) / g
7676
7777function isAncestorsExternal ( id , depStats ) {
78- const { rootPackageJsonPath } = constants
79-
80- const { dependencies : pkgDeps } = require ( rootPackageJsonPath )
81-
78+ // Lazily access constants.rootPackageJsonPath.
79+ const { dependencies : pkgDeps } = require ( constants . rootPackageJsonPath )
8280 let currNmIndex = id . indexOf ( SLASH_NODE_MODULES_SLASH )
8381 while ( currNmIndex !== - 1 ) {
8482 const nextNmIndex = id . indexOf ( SLASH_NODE_MODULES_SLASH , currNmIndex + 1 )
@@ -97,7 +95,7 @@ function isAncestorsExternal(id, depStats) {
9795 dependencies = { } ,
9896 optionalDependencies = { } ,
9997 peerDependencies = { }
100- } = readPackageJsonSync ( ` ${ id . slice ( 0 , nameEnd ) } /package.json` )
98+ } = readPackageJsonSync ( id . slice ( 0 , nameEnd ) )
10199 const range =
102100 dependencies [ name ] ??
103101 optionalDependencies [ name ] ??
@@ -113,23 +111,17 @@ function isAncestorsExternal(id, depStats) {
113111}
114112
115113export default function baseConfig ( extendConfig = { } ) {
116- // Lazily access constants props.
117- const {
118- babelConfigPath,
119- rootPackageJsonPath,
120- rootPath,
121- rootSrcPath,
122- tsconfigPath
123- } = constants
124-
114+ // Lazily access constants.rootSrcPath.
115+ const { rootSrcPath } = constants
125116 const {
126117 dependencies : pkgDeps ,
127118 devDependencies : pkgDevDeps ,
128119 overrides : pkgOverrides
129- } = require ( rootPackageJsonPath )
130-
120+ // Lazily access constants. rootPackageJsonPath.
121+ } = require ( constants . rootPackageJsonPath )
131122 const constantsSrcPath = path . join ( rootSrcPath , `${ CONSTANTS } .ts` )
132- const babelConfig = require ( babelConfigPath )
123+ // Lazily access constants.babelConfigPath.
124+ const babelConfig = require ( constants . babelConfigPath )
133125 const tsPlugin = require ( 'rollup-plugin-ts' )
134126
135127 const depStats = {
@@ -197,9 +189,7 @@ export default function baseConfig(extendConfig = {}) {
197189 dependencies = { } ,
198190 optionalDependencies = { } ,
199191 peerDependencies = { }
200- } = readPackageJsonSync (
201- `${ parentId . slice ( 0 , parentNameEnd ) } /package.json`
202- )
192+ } = readPackageJsonSync ( parentId . slice ( 0 , parentNameEnd ) )
203193 const range =
204194 dependencies [ name ] ??
205195 optionalDependencies [ name ] ??
@@ -229,7 +219,8 @@ export default function baseConfig(extendConfig = {}) {
229219 transpileOnly : true ,
230220 exclude : [ '**/*.json' ] ,
231221 babelConfig,
232- tsconfig : tsconfigPath
222+ // Lazily access constants.tsconfigPath.
223+ tsconfig : constants . tsconfigPath
233224 } ) ,
234225 purgePolyfills . rollup ( {
235226 replacements : { }
@@ -338,7 +329,8 @@ function ${SOCKET_INTEROP}(e) {
338329 delimiters : [ '(?<=["\'])' , '/' ] ,
339330 preventAssignment : false ,
340331 values : {
341- [ rootPath ] : '../../'
332+ // Lazily access constants.rootPath.
333+ [ constants . rootPath ] : '../../'
342334 }
343335 } )
344336 return { name, renderChunk }
0 commit comments