@vercel/gatsby-plugin-vercel-builder 2.0.12 → 2.0.13
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 +26 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -62,7 +62,8 @@ import_compiler.TypeCompiler.Compile(GatsbyFunctionSchema);
|
|
|
62
62
|
var GatsbyRedirectSchema = import_typebox.Type.Object({
|
|
63
63
|
fromPath: import_typebox.Type.String(),
|
|
64
64
|
toPath: import_typebox.Type.String(),
|
|
65
|
-
isPermanent: import_typebox.Type.Optional(import_typebox.Type.Boolean())
|
|
65
|
+
isPermanent: import_typebox.Type.Optional(import_typebox.Type.Boolean()),
|
|
66
|
+
statusCode: import_typebox.Type.Optional(import_typebox.Type.Number())
|
|
66
67
|
});
|
|
67
68
|
var GatsbyConfigSchema = import_typebox.Type.Object({
|
|
68
69
|
trailingSlash: import_typebox.Type.Optional(
|
|
@@ -300,7 +301,7 @@ async function generateVercelBuildOutputAPI3Output({
|
|
|
300
301
|
};
|
|
301
302
|
if (validateGatsbyState.Check(state)) {
|
|
302
303
|
console.log("\u25B2 Creating Vercel build output");
|
|
303
|
-
const { pages,
|
|
304
|
+
const { pages, functions, config: gatsbyConfig } = state;
|
|
304
305
|
const { pathPrefix = "" } = gatsbyConfig;
|
|
305
306
|
const ssrRoutes = pages.map((p) => p[1]).filter((page) => page.mode === "SSR" || page.mode === "DSG");
|
|
306
307
|
const ops = [];
|
|
@@ -318,13 +319,31 @@ async function generateVercelBuildOutputAPI3Output({
|
|
|
318
319
|
} else if (gatsbyConfig.trailingSlash === "never") {
|
|
319
320
|
trailingSlash = false;
|
|
320
321
|
}
|
|
322
|
+
const redirects = [];
|
|
323
|
+
const rewrites = [];
|
|
324
|
+
for (const {
|
|
325
|
+
fromPath,
|
|
326
|
+
toPath,
|
|
327
|
+
isPermanent,
|
|
328
|
+
statusCode
|
|
329
|
+
} of state.redirects) {
|
|
330
|
+
if (statusCode === 200) {
|
|
331
|
+
rewrites.push({
|
|
332
|
+
source: fromPath,
|
|
333
|
+
destination: toPath
|
|
334
|
+
});
|
|
335
|
+
} else {
|
|
336
|
+
redirects.push({
|
|
337
|
+
source: fromPath,
|
|
338
|
+
destination: toPath,
|
|
339
|
+
permanent: isPermanent
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}
|
|
321
343
|
const routes = (0, import_routing_utils.getTransformedRoutes)({
|
|
322
344
|
trailingSlash,
|
|
323
|
-
redirects
|
|
324
|
-
|
|
325
|
-
destination: toPath,
|
|
326
|
-
permanent: isPermanent
|
|
327
|
-
}))
|
|
345
|
+
redirects,
|
|
346
|
+
rewrites
|
|
328
347
|
}).routes || [];
|
|
329
348
|
routes.push({
|
|
330
349
|
handle: "error"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/gatsby-plugin-vercel-builder",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.13",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@sinclair/typebox": "0.25.24",
|
|
17
|
-
"@vercel/build-utils": "7.
|
|
17
|
+
"@vercel/build-utils": "7.4.0",
|
|
18
18
|
"@vercel/routing-utils": "3.1.0",
|
|
19
19
|
"esbuild": "0.14.47",
|
|
20
20
|
"etag": "1.8.1",
|