@vercel/remix-builder 5.8.1 → 5.8.3
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 +30 -7
- package/package.json +4 -6
package/dist/index.js
CHANGED
|
@@ -2637,6 +2637,10 @@ function getReactRouterDataPaths(path) {
|
|
|
2637
2637
|
}
|
|
2638
2638
|
return paths;
|
|
2639
2639
|
}
|
|
2640
|
+
function findPrerenderedHtmlFile(path, staticFileKeys) {
|
|
2641
|
+
const candidates = path === "index" ? ["index.html"] : [`${path}.html`, `${path}/index.html`];
|
|
2642
|
+
return candidates.find((c) => staticFileKeys.has(c));
|
|
2643
|
+
}
|
|
2640
2644
|
async function chdirAndReadConfig(remixRunDevPath, dir, packageJsonPath) {
|
|
2641
2645
|
const { readConfig } = await import((0, import_path.join)(remixRunDevPath, "dist/config.js"));
|
|
2642
2646
|
const originalCwd = process.cwd();
|
|
@@ -3159,12 +3163,10 @@ var build = async ({
|
|
|
3159
3163
|
}
|
|
3160
3164
|
const output = staticFiles;
|
|
3161
3165
|
const assetsDir = viteConfig?.build?.assetsDir || "assets";
|
|
3162
|
-
const routes = [
|
|
3163
|
-
{
|
|
3164
|
-
handle: "filesystem"
|
|
3165
|
-
}
|
|
3166
|
-
];
|
|
3167
3166
|
const isReactRouter = frameworkSettings.slug === "react-router";
|
|
3167
|
+
const staticFileKeys = new Set(Object.keys(staticFiles));
|
|
3168
|
+
const prerenderRewrites = [];
|
|
3169
|
+
const routes = [];
|
|
3168
3170
|
for (const [id, functionId] of Object.entries(
|
|
3169
3171
|
buildManifest.routeIdToServerBundleId ?? {}
|
|
3170
3172
|
)) {
|
|
@@ -3173,6 +3175,18 @@ var build = async ({
|
|
|
3173
3175
|
if (!path) {
|
|
3174
3176
|
continue;
|
|
3175
3177
|
}
|
|
3178
|
+
if (isReactRouter) {
|
|
3179
|
+
const htmlFile = findPrerenderedHtmlFile(path, staticFileKeys);
|
|
3180
|
+
if (htmlFile) {
|
|
3181
|
+
if (path !== "index") {
|
|
3182
|
+
prerenderRewrites.push({
|
|
3183
|
+
src: `^/${path}/?$`,
|
|
3184
|
+
dest: `/${htmlFile}`
|
|
3185
|
+
});
|
|
3186
|
+
}
|
|
3187
|
+
continue;
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3176
3190
|
const func = functionsMap.get(functionId);
|
|
3177
3191
|
if (!func) {
|
|
3178
3192
|
throw new Error(`Could not determine server bundle for "${id}"`);
|
|
@@ -3200,6 +3214,7 @@ var build = async ({
|
|
|
3200
3214
|
});
|
|
3201
3215
|
}
|
|
3202
3216
|
}
|
|
3217
|
+
routes.unshift(...prerenderRewrites, { handle: "filesystem" });
|
|
3203
3218
|
routes.push({
|
|
3204
3219
|
src: "/(.*)",
|
|
3205
3220
|
dest: "/"
|
|
@@ -3212,7 +3227,11 @@ var build = async ({
|
|
|
3212
3227
|
headers: { "cache-control": "public, max-age=31536000, immutable" },
|
|
3213
3228
|
continue: true
|
|
3214
3229
|
});
|
|
3215
|
-
return {
|
|
3230
|
+
return {
|
|
3231
|
+
routes,
|
|
3232
|
+
output,
|
|
3233
|
+
framework: { slug: "remix", version: frameworkVersion }
|
|
3234
|
+
};
|
|
3216
3235
|
};
|
|
3217
3236
|
async function traceEdgeFiles({
|
|
3218
3237
|
handlerPath,
|
|
@@ -3869,7 +3888,11 @@ module.exports = config;`;
|
|
|
3869
3888
|
headers: { "cache-control": "public, max-age=31536000, immutable" },
|
|
3870
3889
|
continue: true
|
|
3871
3890
|
});
|
|
3872
|
-
return {
|
|
3891
|
+
return {
|
|
3892
|
+
routes,
|
|
3893
|
+
output,
|
|
3894
|
+
framework: { slug: "remix", version: remixVersion }
|
|
3895
|
+
};
|
|
3873
3896
|
};
|
|
3874
3897
|
function hasScript2(scriptName, pkg) {
|
|
3875
3898
|
const scripts = pkg && pkg.scripts || {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/remix-builder",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"homepage": "https://vercel.com/docs",
|
|
@@ -20,22 +20,20 @@
|
|
|
20
20
|
"path-to-regexp": "6.1.0",
|
|
21
21
|
"ts-morph": "12.0.0",
|
|
22
22
|
"@vercel/error-utils": "2.1.0",
|
|
23
|
-
"@vercel/static-config": "3.
|
|
23
|
+
"@vercel/static-config": "3.4.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@types/jest": "27.5.1",
|
|
27
26
|
"@types/node": "20.11.0",
|
|
28
27
|
"@types/semver": "7.3.13",
|
|
29
28
|
"glob": "10.3.16",
|
|
30
|
-
"jest-junit": "16.0.0",
|
|
31
29
|
"semver": "7.5.2",
|
|
32
30
|
"vitest": "2.0.1",
|
|
33
|
-
"@vercel/build-utils": "13.
|
|
31
|
+
"@vercel/build-utils": "13.26.3"
|
|
34
32
|
},
|
|
35
33
|
"VERCEL_REMIX_RUN_DEV_MAX_VERSION": "2.16.6",
|
|
36
34
|
"scripts": {
|
|
37
35
|
"build": "node ../../utils/build-builder.mjs",
|
|
38
|
-
"test": "
|
|
36
|
+
"test": "vitest run --config ../../vitest.config.mts",
|
|
39
37
|
"vitest-run": "vitest -c ../../vitest.config.mts",
|
|
40
38
|
"vitest-unit": "glob --absolute 'test/unit.*.test.ts'",
|
|
41
39
|
"vitest-e2e": "glob --absolute 'test/integration-*.test.ts'",
|