Skip to content

Commit f992ba4

Browse files
committed
Merge branch 'main' into vitest_poc
2 parents b18277b + 16daba1 commit f992ba4

File tree

15 files changed

+262
-172
lines changed

15 files changed

+262
-172
lines changed

.config/rollup.base.config.mjs

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,11 @@ const {
3737
ROLLUP_ENTRY_SUFFIX,
3838
ROLLUP_EXTERNAL_SUFFIX,
3939
SLASH_NODE_MODULES_SLASH,
40-
VENDOR,
41-
babelConfigPath,
42-
rootPackageJsonPath,
43-
rootPath,
44-
rootSrcPath,
45-
tsconfigPath
40+
VENDOR
4641
} = constants
4742

4843
const SOCKET_INTEROP = '_socketInterop'
4944

50-
const constantsSrcPath = path.join(rootSrcPath, `${CONSTANTS}.ts`)
51-
52-
const babelConfig = require(babelConfigPath)
53-
const tsPlugin = require('rollup-plugin-ts')
54-
const rootPackageJson = require(rootPackageJsonPath)
55-
56-
const {
57-
dependencies: pkgDeps,
58-
devDependencies: pkgDevDeps,
59-
overrides: pkgOverrides
60-
} = rootPackageJson
61-
6245
const builtinAliases = builtinModules.reduce((o, n) => {
6346
o[n] = `node:${n}`
6447
return o
@@ -92,6 +75,10 @@ const requireUrlAssignmentRegExp =
9275
const splitUrlRequiresRegExp = /require\(["']u["']\s*\+\s*["']rl["']\)/g
9376

9477
function isAncestorsExternal(id, depStats) {
78+
const { rootPackageJsonPath } = constants
79+
80+
const { dependencies: pkgDeps } = require(rootPackageJsonPath)
81+
9582
let currNmIndex = id.indexOf(SLASH_NODE_MODULES_SLASH)
9683
while (currNmIndex !== -1) {
9784
const nextNmIndex = id.indexOf(SLASH_NODE_MODULES_SLASH, currNmIndex + 1)
@@ -126,6 +113,25 @@ function isAncestorsExternal(id, depStats) {
126113
}
127114

128115
export default function baseConfig(extendConfig = {}) {
116+
// Lazily access constants props.
117+
const {
118+
babelConfigPath,
119+
rootPackageJsonPath,
120+
rootPath,
121+
rootSrcPath,
122+
tsconfigPath
123+
} = constants
124+
125+
const {
126+
dependencies: pkgDeps,
127+
devDependencies: pkgDevDeps,
128+
overrides: pkgOverrides
129+
} = require(rootPackageJsonPath)
130+
131+
const constantsSrcPath = path.join(rootSrcPath, `${CONSTANTS}.ts`)
132+
const babelConfig = require(babelConfigPath)
133+
const tsPlugin = require('rollup-plugin-ts')
134+
129135
const depStats = {
130136
dependencies: { __proto__: null },
131137
devDependencies: { __proto__: null },

0 commit comments

Comments
 (0)