@vercel/gatsby-plugin-vercel-builder 2.0.139 → 2.0.140
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 +67 -20
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1829,24 +1829,31 @@ var require_schemas = __commonJS({
|
|
|
1829
1829
|
};
|
|
1830
1830
|
var routesSchema = {
|
|
1831
1831
|
type: "array",
|
|
1832
|
-
deprecated: true,
|
|
1833
1832
|
description: "A list of routes objects used to rewrite paths to point towards other internal or external paths",
|
|
1834
1833
|
example: [{ dest: "https://docs.example.com", src: "/docs" }],
|
|
1835
1834
|
items: {
|
|
1836
1835
|
anyOf: [
|
|
1837
1836
|
{
|
|
1838
1837
|
type: "object",
|
|
1839
|
-
required: ["src"],
|
|
1838
|
+
anyOf: [{ required: ["src"] }, { required: ["source"] }],
|
|
1840
1839
|
additionalProperties: false,
|
|
1841
1840
|
properties: {
|
|
1842
1841
|
src: {
|
|
1843
1842
|
type: "string",
|
|
1844
1843
|
maxLength: 4096
|
|
1845
1844
|
},
|
|
1845
|
+
source: {
|
|
1846
|
+
type: "string",
|
|
1847
|
+
maxLength: 4096
|
|
1848
|
+
},
|
|
1846
1849
|
dest: {
|
|
1847
1850
|
type: "string",
|
|
1848
1851
|
maxLength: 4096
|
|
1849
1852
|
},
|
|
1853
|
+
destination: {
|
|
1854
|
+
type: "string",
|
|
1855
|
+
maxLength: 4096
|
|
1856
|
+
},
|
|
1850
1857
|
headers: {
|
|
1851
1858
|
type: "object",
|
|
1852
1859
|
additionalProperties: false,
|
|
@@ -1871,6 +1878,7 @@ var require_schemas = __commonJS({
|
|
|
1871
1878
|
type: "boolean"
|
|
1872
1879
|
},
|
|
1873
1880
|
important: {
|
|
1881
|
+
deprecated: true,
|
|
1874
1882
|
type: "boolean"
|
|
1875
1883
|
},
|
|
1876
1884
|
user: {
|
|
@@ -1880,6 +1888,7 @@ var require_schemas = __commonJS({
|
|
|
1880
1888
|
type: "boolean"
|
|
1881
1889
|
},
|
|
1882
1890
|
override: {
|
|
1891
|
+
deprecated: true,
|
|
1883
1892
|
type: "boolean"
|
|
1884
1893
|
},
|
|
1885
1894
|
check: {
|
|
@@ -1893,6 +1902,11 @@ var require_schemas = __commonJS({
|
|
|
1893
1902
|
minimum: 100,
|
|
1894
1903
|
maximum: 999
|
|
1895
1904
|
},
|
|
1905
|
+
statusCode: {
|
|
1906
|
+
type: "integer",
|
|
1907
|
+
minimum: 100,
|
|
1908
|
+
maximum: 999
|
|
1909
|
+
},
|
|
1896
1910
|
locale: {
|
|
1897
1911
|
type: "object",
|
|
1898
1912
|
additionalProperties: false,
|
|
@@ -1958,6 +1972,7 @@ var require_schemas = __commonJS({
|
|
|
1958
1972
|
},
|
|
1959
1973
|
{
|
|
1960
1974
|
type: "object",
|
|
1975
|
+
deprecated: true,
|
|
1961
1976
|
required: ["handle"],
|
|
1962
1977
|
additionalProperties: false,
|
|
1963
1978
|
properties: {
|
|
@@ -2231,6 +2246,35 @@ var require_dist3 = __commonJS({
|
|
|
2231
2246
|
function isValidHandleValue(handle) {
|
|
2232
2247
|
return validHandleValues.has(handle);
|
|
2233
2248
|
}
|
|
2249
|
+
function convertRouteAliases(route, index) {
|
|
2250
|
+
if (route.source !== void 0) {
|
|
2251
|
+
if (route.src !== void 0) {
|
|
2252
|
+
throw new Error(
|
|
2253
|
+
`Route at index ${index} cannot define both \`src\` and \`source\`. Please use only one.`
|
|
2254
|
+
);
|
|
2255
|
+
}
|
|
2256
|
+
route.src = route.source;
|
|
2257
|
+
delete route.source;
|
|
2258
|
+
}
|
|
2259
|
+
if (route.destination !== void 0) {
|
|
2260
|
+
if (route.dest !== void 0) {
|
|
2261
|
+
throw new Error(
|
|
2262
|
+
`Route at index ${index} cannot define both \`dest\` and \`destination\`. Please use only one.`
|
|
2263
|
+
);
|
|
2264
|
+
}
|
|
2265
|
+
route.dest = route.destination;
|
|
2266
|
+
delete route.destination;
|
|
2267
|
+
}
|
|
2268
|
+
if (route.statusCode !== void 0) {
|
|
2269
|
+
if (route.status !== void 0) {
|
|
2270
|
+
throw new Error(
|
|
2271
|
+
`Route at index ${index} cannot define both \`status\` and \`statusCode\`. Please use only one.`
|
|
2272
|
+
);
|
|
2273
|
+
}
|
|
2274
|
+
route.status = route.statusCode;
|
|
2275
|
+
delete route.statusCode;
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2234
2278
|
function normalizeRoutes(inputRoutes) {
|
|
2235
2279
|
if (!inputRoutes || inputRoutes.length === 0) {
|
|
2236
2280
|
return { routes: inputRoutes, error: null };
|
|
@@ -2241,6 +2285,13 @@ var require_dist3 = __commonJS({
|
|
|
2241
2285
|
inputRoutes.forEach((r, i) => {
|
|
2242
2286
|
const route = { ...r };
|
|
2243
2287
|
routes.push(route);
|
|
2288
|
+
if (!isHandler(route)) {
|
|
2289
|
+
try {
|
|
2290
|
+
convertRouteAliases(route, i);
|
|
2291
|
+
} catch (err) {
|
|
2292
|
+
errors.push(err.message);
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2244
2295
|
const keys = Object.keys(route);
|
|
2245
2296
|
if (isHandler(route)) {
|
|
2246
2297
|
const { handle } = route;
|
|
@@ -2276,12 +2327,12 @@ var require_dist3 = __commonJS({
|
|
|
2276
2327
|
if (handleValue === "hit") {
|
|
2277
2328
|
if (route.dest) {
|
|
2278
2329
|
errors.push(
|
|
2279
|
-
`Route at index ${i} cannot define \`dest\` after \`handle: hit\`.`
|
|
2330
|
+
`Route at index ${i} cannot define \`dest\`/\`destination\` after \`handle: hit\`.`
|
|
2280
2331
|
);
|
|
2281
2332
|
}
|
|
2282
2333
|
if (route.status) {
|
|
2283
2334
|
errors.push(
|
|
2284
|
-
`Route at index ${i} cannot define \`status\` after \`handle: hit\`.`
|
|
2335
|
+
`Route at index ${i} cannot define \`status\`/\`statusCode\` after \`handle: hit\`.`
|
|
2285
2336
|
);
|
|
2286
2337
|
}
|
|
2287
2338
|
if (!route.continue) {
|
|
@@ -2302,7 +2353,7 @@ var require_dist3 = __commonJS({
|
|
|
2302
2353
|
}
|
|
2303
2354
|
} else {
|
|
2304
2355
|
errors.push(
|
|
2305
|
-
`Route at index ${i} must define either \`
|
|
2356
|
+
`Route at index ${i} must define either \`src\` or \`source\` property.`
|
|
2306
2357
|
);
|
|
2307
2358
|
}
|
|
2308
2359
|
});
|
|
@@ -2318,7 +2369,7 @@ var require_dist3 = __commonJS({
|
|
|
2318
2369
|
try {
|
|
2319
2370
|
new RegExp(src);
|
|
2320
2371
|
} catch (err) {
|
|
2321
|
-
const prop = type === "Route" ? "src" : "source";
|
|
2372
|
+
const prop = type === "Route" ? "src`/`source" : "source";
|
|
2322
2373
|
return `${type} at index ${index} has invalid \`${prop}\` regular expression "${src}".`;
|
|
2323
2374
|
}
|
|
2324
2375
|
return null;
|
|
@@ -2391,20 +2442,8 @@ var require_dist3 = __commonJS({
|
|
|
2391
2442
|
}
|
|
2392
2443
|
function getTransformedRoutes2(vercelConfig) {
|
|
2393
2444
|
const { cleanUrls, rewrites, redirects, headers, trailingSlash } = vercelConfig;
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
const hasNewProperties = typeof cleanUrls !== "undefined" || typeof trailingSlash !== "undefined" || typeof redirects !== "undefined" || typeof headers !== "undefined" || typeof rewrites !== "undefined";
|
|
2397
|
-
if (hasNewProperties) {
|
|
2398
|
-
const error = createError(
|
|
2399
|
-
"invalid_mixed_routes",
|
|
2400
|
-
"If `rewrites`, `redirects`, `headers`, `cleanUrls` or `trailingSlash` are used, then `routes` cannot be present.",
|
|
2401
|
-
"https://vercel.link/mix-routing-props",
|
|
2402
|
-
"Learn More"
|
|
2403
|
-
);
|
|
2404
|
-
return { routes, error };
|
|
2405
|
-
}
|
|
2406
|
-
return normalizeRoutes(routes);
|
|
2407
|
-
}
|
|
2445
|
+
const { routes: userRoutes = null } = vercelConfig;
|
|
2446
|
+
let routes = null;
|
|
2408
2447
|
if (typeof cleanUrls !== "undefined") {
|
|
2409
2448
|
const normalized = normalizeRoutes(
|
|
2410
2449
|
(0, import_superstatic.convertCleanUrls)(cleanUrls, trailingSlash)
|
|
@@ -2425,6 +2464,14 @@ var require_dist3 = __commonJS({
|
|
|
2425
2464
|
routes = routes || [];
|
|
2426
2465
|
routes.push(...normalized.routes || []);
|
|
2427
2466
|
}
|
|
2467
|
+
if (userRoutes) {
|
|
2468
|
+
const normalized = normalizeRoutes(userRoutes);
|
|
2469
|
+
if (normalized.error) {
|
|
2470
|
+
return { routes, error: normalized.error };
|
|
2471
|
+
}
|
|
2472
|
+
routes = routes || [];
|
|
2473
|
+
routes.push(...normalized.routes || []);
|
|
2474
|
+
}
|
|
2428
2475
|
if (typeof redirects !== "undefined") {
|
|
2429
2476
|
const code = "invalid_redirect";
|
|
2430
2477
|
const regexErrorMessage = redirects.map((r, i) => checkRegexSyntax("Redirect", i, r.source)).find(notEmpty);
|
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.140",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"esbuild": "0.27.0",
|
|
18
18
|
"etag": "1.8.1",
|
|
19
19
|
"fs-extra": "11.1.0",
|
|
20
|
-
"@vercel/build-utils": "13.
|
|
20
|
+
"@vercel/build-utils": "13.6.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/etag": "1.8.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@types/react": "18.0.26",
|
|
28
28
|
"jest-junit": "16.0.0",
|
|
29
29
|
"typescript": "4.9.5",
|
|
30
|
-
"@vercel/routing-utils": "
|
|
30
|
+
"@vercel/routing-utils": "6.0.0"
|
|
31
31
|
},
|
|
32
32
|
"license": "Apache-2.0",
|
|
33
33
|
"scripts": {
|