@astrojs/cloudflare 10.2.2 → 10.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -274,8 +274,13 @@ export default function createIntegration(args) {
|
|
|
274
274
|
// Those modules are build only for prerendering routes.
|
|
275
275
|
const chunksToDelete = chunkAnalyzer.getNonServerChunks();
|
|
276
276
|
for (const chunk of chunksToDelete) {
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
try {
|
|
278
|
+
// Chunks are located on `./_worker.js` directory inside of the output directory
|
|
279
|
+
await unlink(new URL(`./_worker.js/${chunk}`, _config.outDir));
|
|
280
|
+
}
|
|
281
|
+
catch (error) {
|
|
282
|
+
logger.warn(`Issue while trying to delete unused file from server bundle: ${new URL(`./_worker.js/${chunk}`, _config.outDir).toString()}`);
|
|
283
|
+
}
|
|
279
284
|
}
|
|
280
285
|
},
|
|
281
286
|
},
|
|
@@ -114,6 +114,9 @@ export async function createRoutesFile(_config, logger, routes, pages, redirects
|
|
|
114
114
|
[{ content: '', dynamic: true, spread: false }],
|
|
115
115
|
], _config);
|
|
116
116
|
excludePaths.push(assetsPath);
|
|
117
|
+
for (const redirect of redirects) {
|
|
118
|
+
excludePaths.push(segmentsToCfSyntax(redirect, _config));
|
|
119
|
+
}
|
|
117
120
|
if (existsSync(fileURLToPath(_config.publicDir))) {
|
|
118
121
|
const staticFiles = await glob(`${fileURLToPath(_config.publicDir)}/**/*`, {
|
|
119
122
|
cwd: fileURLToPath(_config.publicDir),
|
|
@@ -133,9 +136,6 @@ export async function createRoutesFile(_config, logger, routes, pages, redirects
|
|
|
133
136
|
excludePaths.push(segmentsToCfSyntax(segments, _config));
|
|
134
137
|
}
|
|
135
138
|
}
|
|
136
|
-
for (const redirect of redirects) {
|
|
137
|
-
excludePaths.push(segmentsToCfSyntax(redirect, _config));
|
|
138
|
-
}
|
|
139
139
|
let hasPrerendered404 = false;
|
|
140
140
|
for (const route of routes) {
|
|
141
141
|
const convertedPath = segmentsToCfSyntax(route.segments, _config);
|
package/dist/utils/index.js
CHANGED
|
@@ -18,6 +18,13 @@ export function mutatePageMapInPlace(node, constsToRemove, s) {
|
|
|
18
18
|
if (arrayExpression.start && arrayExpression.end) {
|
|
19
19
|
// @ts-expect-error - @types/estree seem to be wrong
|
|
20
20
|
s.remove(arrayExpression.start, arrayExpression.end);
|
|
21
|
+
// We need to check if there are any leftover commas, which are not part of the `ArrayExpression` node
|
|
22
|
+
// @ts-expect-error - @types/estree seem to be wrong
|
|
23
|
+
const endChar = s.slice(arrayExpression.end, arrayExpression.end + 1);
|
|
24
|
+
if (endChar.includes(',')) {
|
|
25
|
+
// @ts-expect-error - @types/estree seem to be wrong
|
|
26
|
+
s.remove(arrayExpression.end, arrayExpression.end + 1);
|
|
27
|
+
}
|
|
21
28
|
}
|
|
22
29
|
}
|
|
23
30
|
}
|