Skip to content

Commit ad1ad5d

Browse files
committed
fixup! chore: add some validation to bundling to ensure we don't produce duplicate/inling of regional-blob-store module in unexptected built modules
1 parent 14ce8e3 commit ad1ad5d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/build.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ await Promise.all([
132132
async function ensureNoRegionalBlobsModuleDuplicates() {
133133
const REGIONAL_BLOB_STORE_CONTENT_TO_FIND = 'fetchBeforeNextPatchedIt'
134134

135-
const filesToTest = await glob(join(OUT_DIR, '**/*.{js,cjs}'))
135+
const filesToTest = await glob(`${OUT_DIR}/**/*.{js,cjs}`)
136136
const unexpectedModulesContainingFetchBeforeNextPatchedIt = []
137137
let foundInExpectedModule = false
138138
for (const fileToTest of filesToTest) {
139139
const content = await readFile(fileToTest, 'utf-8')
140140
if (content.includes(REGIONAL_BLOB_STORE_CONTENT_TO_FIND)) {
141-
if (fileToTest.endsWith(join('run', 'regional-blob-store.cjs'))) {
141+
if (fileToTest.endsWith('run/regional-blob-store.cjs')) {
142142
foundInExpectedModule = true
143143
} else {
144144
unexpectedModulesContainingFetchBeforeNextPatchedIt.push(fileToTest)
@@ -147,12 +147,12 @@ async function ensureNoRegionalBlobsModuleDuplicates() {
147147
}
148148
if (!foundInExpectedModule) {
149149
throw new Error(
150-
'Expected to find fetchBeforeNextPatchedIt in run/regional-blob-store.cjs, but it was not found. This might indicate setup change that require bundling validation to be adjusted.',
150+
'Expected to find "fetchBeforeNextPatchedIt" variable in "run/regional-blob-store.cjs", but it was not found. This might indicate setup change that require bundling validation in "tools/build.js" to be adjusted.',
151151
)
152152
}
153153
if (unexpectedModulesContainingFetchBeforeNextPatchedIt.length !== 0) {
154154
throw new Error(
155-
`Bundling produced unexpected duplicates of 'regional-blob-store' module in following built modules:\n${unexpectedModulesContainingFetchBeforeNextPatchedIt.map((filePath) => ` - ${filePath}`).join('\n')}`,
155+
`Bundling produced unexpected duplicates of "regional-blob-store" module in following built modules:\n${unexpectedModulesContainingFetchBeforeNextPatchedIt.map((filePath) => ` - ${filePath}`).join('\n')}`,
156156
)
157157
}
158158
}

0 commit comments

Comments
 (0)