@vercel/remix-builder 5.8.4 → 5.8.5
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 +19 -8
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2641,6 +2641,18 @@ function findPrerenderedHtmlFile(path, staticFileKeys) {
|
|
|
2641
2641
|
const candidates = path === "index" ? ["index.html"] : [`${path}.html`, `${path}/index.html`];
|
|
2642
2642
|
return candidates.find((c) => staticFileKeys.has(c));
|
|
2643
2643
|
}
|
|
2644
|
+
function getPrerenderDocumentRewrite(path, htmlFile) {
|
|
2645
|
+
return {
|
|
2646
|
+
src: path === "index" ? "^/$" : `^/${path}/?$`,
|
|
2647
|
+
dest: `/${htmlFile}`
|
|
2648
|
+
};
|
|
2649
|
+
}
|
|
2650
|
+
function shouldRegisterSsrForPrerenderedRoute(path) {
|
|
2651
|
+
return path === "index";
|
|
2652
|
+
}
|
|
2653
|
+
function getReactRouterCatchAllDest() {
|
|
2654
|
+
return "index";
|
|
2655
|
+
}
|
|
2644
2656
|
async function chdirAndReadConfig(remixRunDevPath, dir, packageJsonPath) {
|
|
2645
2657
|
const { readConfig } = await import((0, import_path.join)(remixRunDevPath, "dist/config.js"));
|
|
2646
2658
|
const originalCwd = process.cwd();
|
|
@@ -3178,13 +3190,10 @@ var build = async ({
|
|
|
3178
3190
|
if (isReactRouter) {
|
|
3179
3191
|
const htmlFile = findPrerenderedHtmlFile(path, staticFileKeys);
|
|
3180
3192
|
if (htmlFile) {
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
dest: `/${htmlFile}`
|
|
3185
|
-
});
|
|
3193
|
+
prerenderRewrites.push(getPrerenderDocumentRewrite(path, htmlFile));
|
|
3194
|
+
if (!shouldRegisterSsrForPrerenderedRoute(path)) {
|
|
3195
|
+
continue;
|
|
3186
3196
|
}
|
|
3187
|
-
continue;
|
|
3188
3197
|
}
|
|
3189
3198
|
}
|
|
3190
3199
|
const func = functionsMap.get(functionId);
|
|
@@ -3194,7 +3203,9 @@ var build = async ({
|
|
|
3194
3203
|
output[path] = func;
|
|
3195
3204
|
if (isReactRouter) {
|
|
3196
3205
|
for (const dataPath of getReactRouterDataPaths(path)) {
|
|
3197
|
-
|
|
3206
|
+
if (!staticFileKeys.has(dataPath)) {
|
|
3207
|
+
output[dataPath] = func;
|
|
3208
|
+
}
|
|
3198
3209
|
}
|
|
3199
3210
|
}
|
|
3200
3211
|
const re = getRegExpFromPath(rePath);
|
|
@@ -3217,7 +3228,7 @@ var build = async ({
|
|
|
3217
3228
|
routes.unshift(...prerenderRewrites, { handle: "filesystem" });
|
|
3218
3229
|
routes.push({
|
|
3219
3230
|
src: "/(.*)",
|
|
3220
|
-
dest: "/"
|
|
3231
|
+
dest: isReactRouter ? getReactRouterCatchAllDest() : "/"
|
|
3221
3232
|
});
|
|
3222
3233
|
routes.push({
|
|
3223
3234
|
handle: "hit"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/remix-builder",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"homepage": "https://vercel.com/docs",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"path-to-regexp-updated": "npm:path-to-regexp@6.3.0",
|
|
20
20
|
"path-to-regexp": "6.1.0",
|
|
21
21
|
"ts-morph": "12.0.0",
|
|
22
|
-
"@vercel/
|
|
23
|
-
"@vercel/
|
|
22
|
+
"@vercel/static-config": "3.4.0",
|
|
23
|
+
"@vercel/error-utils": "2.1.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "20.11.0",
|