@vercel/redwood 2.3.6 → 2.4.1
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 +55 -21
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -821,7 +821,7 @@ var require_superstatic = __commonJS({
|
|
|
821
821
|
convertTrailingSlash: () => convertTrailingSlash,
|
|
822
822
|
getCleanUrls: () => getCleanUrls2,
|
|
823
823
|
pathToRegexp: () => pathToRegexp,
|
|
824
|
-
sourceToRegex: () =>
|
|
824
|
+
sourceToRegex: () => sourceToRegex2
|
|
825
825
|
});
|
|
826
826
|
module2.exports = __toCommonJS2(superstatic_exports);
|
|
827
827
|
var import_url = require("url");
|
|
@@ -899,7 +899,7 @@ var require_superstatic = __commonJS({
|
|
|
899
899
|
}
|
|
900
900
|
function convertRedirects(redirects, defaultStatus = 308) {
|
|
901
901
|
return redirects.map((r) => {
|
|
902
|
-
const { src, segments } =
|
|
902
|
+
const { src, segments } = sourceToRegex2(r.source);
|
|
903
903
|
const hasSegments = collectHasSegments(r.has);
|
|
904
904
|
normalizeHasKeys(r.has);
|
|
905
905
|
normalizeHasKeys(r.missing);
|
|
@@ -932,7 +932,7 @@ var require_superstatic = __commonJS({
|
|
|
932
932
|
}
|
|
933
933
|
function convertRewrites(rewrites, internalParamNames) {
|
|
934
934
|
return rewrites.map((r) => {
|
|
935
|
-
const { src, segments } =
|
|
935
|
+
const { src, segments } = sourceToRegex2(r.source);
|
|
936
936
|
const hasSegments = collectHasSegments(r.has);
|
|
937
937
|
normalizeHasKeys(r.has);
|
|
938
938
|
normalizeHasKeys(r.missing);
|
|
@@ -963,7 +963,7 @@ var require_superstatic = __commonJS({
|
|
|
963
963
|
function convertHeaders(headers) {
|
|
964
964
|
return headers.map((h) => {
|
|
965
965
|
const obj = {};
|
|
966
|
-
const { src, segments } =
|
|
966
|
+
const { src, segments } = sourceToRegex2(h.source);
|
|
967
967
|
const hasSegments = collectHasSegments(h.has);
|
|
968
968
|
normalizeHasKeys(h.has);
|
|
969
969
|
normalizeHasKeys(h.missing);
|
|
@@ -1025,7 +1025,7 @@ var require_superstatic = __commonJS({
|
|
|
1025
1025
|
}
|
|
1026
1026
|
return routes;
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1028
|
+
function sourceToRegex2(source) {
|
|
1029
1029
|
const keys = [];
|
|
1030
1030
|
const r = pathToRegexp("632", source, keys, {
|
|
1031
1031
|
strict: true,
|
|
@@ -1040,7 +1040,7 @@ var require_superstatic = __commonJS({
|
|
|
1040
1040
|
});
|
|
1041
1041
|
return { src: r.source, segments };
|
|
1042
1042
|
}
|
|
1043
|
-
var namedGroupsRegex = /\(\?<([a-zA-Z][a-zA-Z0-
|
|
1043
|
+
var namedGroupsRegex = /\(\?<([a-zA-Z][a-zA-Z0-9_]*)>/g;
|
|
1044
1044
|
var normalizeHasKeys = (hasItems = []) => {
|
|
1045
1045
|
for (const hasItem of hasItems) {
|
|
1046
1046
|
if ("key" in hasItem && hasItem.type === "header") {
|
|
@@ -1407,6 +1407,7 @@ var require_schemas = __commonJS({
|
|
|
1407
1407
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
1408
1408
|
var schemas_exports = {};
|
|
1409
1409
|
__export2(schemas_exports, {
|
|
1410
|
+
bulkRedirectsSchema: () => bulkRedirectsSchema,
|
|
1410
1411
|
cleanUrlsSchema: () => cleanUrlsSchema,
|
|
1411
1412
|
hasSchema: () => hasSchema,
|
|
1412
1413
|
headersSchema: () => headersSchema,
|
|
@@ -1983,6 +1984,44 @@ var require_schemas = __commonJS({
|
|
|
1983
1984
|
description: "When `false`, visiting a path that ends with a forward slash will respond with a `308` status code and redirect to the path without the trailing slash.",
|
|
1984
1985
|
type: "boolean"
|
|
1985
1986
|
};
|
|
1987
|
+
var bulkRedirectsSchema = {
|
|
1988
|
+
type: "array",
|
|
1989
|
+
description: "A list of bulk redirect definitions.",
|
|
1990
|
+
items: {
|
|
1991
|
+
type: "object",
|
|
1992
|
+
additionalProperties: false,
|
|
1993
|
+
required: ["source", "destination"],
|
|
1994
|
+
properties: {
|
|
1995
|
+
source: {
|
|
1996
|
+
description: "The exact URL path or pattern to match.",
|
|
1997
|
+
type: "string",
|
|
1998
|
+
maxLength: 2048
|
|
1999
|
+
},
|
|
2000
|
+
destination: {
|
|
2001
|
+
description: "The target URL path where traffic should be redirected.",
|
|
2002
|
+
type: "string",
|
|
2003
|
+
maxLength: 2048
|
|
2004
|
+
},
|
|
2005
|
+
permanent: {
|
|
2006
|
+
description: "A boolean to toggle between permanent and temporary redirect. When `true`, the status code is `308`. When `false` the status code is `307`.",
|
|
2007
|
+
type: "boolean"
|
|
2008
|
+
},
|
|
2009
|
+
statusCode: {
|
|
2010
|
+
description: "An optional integer to define the status code of the redirect.",
|
|
2011
|
+
type: "integer",
|
|
2012
|
+
enum: [301, 302, 307, 308]
|
|
2013
|
+
},
|
|
2014
|
+
sensitive: {
|
|
2015
|
+
description: "A boolean to toggle between case-sensitive and case-insensitive redirect. When `true`, the redirect is case-sensitive. When `false` the redirect is case-insensitive.",
|
|
2016
|
+
type: "boolean"
|
|
2017
|
+
},
|
|
2018
|
+
query: {
|
|
2019
|
+
description: "Whether the query string should be preserved by the redirect. The default is `false`.",
|
|
2020
|
+
type: "boolean"
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
};
|
|
1986
2025
|
}
|
|
1987
2026
|
});
|
|
1988
2027
|
|
|
@@ -2038,7 +2077,8 @@ var require_dist3 = __commonJS({
|
|
|
2038
2077
|
isHandler: () => isHandler,
|
|
2039
2078
|
isValidHandleValue: () => isValidHandleValue,
|
|
2040
2079
|
mergeRoutes: () => import_merge.mergeRoutes,
|
|
2041
|
-
normalizeRoutes: () => normalizeRoutes
|
|
2080
|
+
normalizeRoutes: () => normalizeRoutes,
|
|
2081
|
+
sourceToRegex: () => import_superstatic2.sourceToRegex
|
|
2042
2082
|
});
|
|
2043
2083
|
module2.exports = __toCommonJS2(src_exports2);
|
|
2044
2084
|
var import_url = require("url");
|
|
@@ -2418,22 +2458,17 @@ var build = async ({
|
|
|
2418
2458
|
config,
|
|
2419
2459
|
meta
|
|
2420
2460
|
);
|
|
2421
|
-
const spawnOpts = (0, import_build_utils.getSpawnOptions)(meta, nodeVersion);
|
|
2422
|
-
if (!spawnOpts.env) {
|
|
2423
|
-
spawnOpts.env = {};
|
|
2424
|
-
}
|
|
2425
2461
|
const {
|
|
2426
2462
|
cliType,
|
|
2427
2463
|
lockfileVersion,
|
|
2428
2464
|
packageJsonPackageManager,
|
|
2429
2465
|
turboSupportsCorepackHome
|
|
2430
2466
|
} = await (0, import_build_utils.scanParentDirs)(entrypointFsDirname, true);
|
|
2431
|
-
|
|
2467
|
+
const spawnEnv = (0, import_build_utils.getEnvForPackageManager)({
|
|
2432
2468
|
cliType,
|
|
2433
2469
|
lockfileVersion,
|
|
2434
2470
|
packageJsonPackageManager,
|
|
2435
|
-
|
|
2436
|
-
env: spawnOpts.env || {},
|
|
2471
|
+
env: process.env,
|
|
2437
2472
|
turboSupportsCorepackHome,
|
|
2438
2473
|
projectCreatedAt: config.projectSettings?.createdAt
|
|
2439
2474
|
});
|
|
@@ -2441,7 +2476,7 @@ var build = async ({
|
|
|
2441
2476
|
if (installCommand.trim()) {
|
|
2442
2477
|
console.log(`Running "install" command: \`${installCommand}\`...`);
|
|
2443
2478
|
await (0, import_build_utils.execCommand)(installCommand, {
|
|
2444
|
-
|
|
2479
|
+
env: spawnEnv,
|
|
2445
2480
|
cwd: entrypointFsDirname
|
|
2446
2481
|
});
|
|
2447
2482
|
} else {
|
|
@@ -2451,9 +2486,8 @@ var build = async ({
|
|
|
2451
2486
|
await (0, import_build_utils.runNpmInstall)(
|
|
2452
2487
|
entrypointFsDirname,
|
|
2453
2488
|
[],
|
|
2454
|
-
|
|
2489
|
+
{ env: spawnEnv },
|
|
2455
2490
|
meta,
|
|
2456
|
-
nodeVersion,
|
|
2457
2491
|
config.projectSettings?.createdAt
|
|
2458
2492
|
);
|
|
2459
2493
|
}
|
|
@@ -2467,7 +2501,7 @@ var build = async ({
|
|
|
2467
2501
|
if (buildCommand) {
|
|
2468
2502
|
(0, import_build_utils.debug)(`Executing build command "${buildCommand}"`);
|
|
2469
2503
|
await (0, import_build_utils.execCommand)(buildCommand, {
|
|
2470
|
-
|
|
2504
|
+
env: spawnEnv,
|
|
2471
2505
|
cwd: workPath
|
|
2472
2506
|
});
|
|
2473
2507
|
} else if (hasScript("vercel-build", pkg)) {
|
|
@@ -2475,7 +2509,7 @@ var build = async ({
|
|
|
2475
2509
|
await (0, import_build_utils.runPackageJsonScript)(
|
|
2476
2510
|
workPath,
|
|
2477
2511
|
"vercel-build",
|
|
2478
|
-
|
|
2512
|
+
{ env: spawnEnv },
|
|
2479
2513
|
config.projectSettings?.createdAt
|
|
2480
2514
|
);
|
|
2481
2515
|
} else if (hasScript("build", pkg)) {
|
|
@@ -2483,7 +2517,7 @@ var build = async ({
|
|
|
2483
2517
|
await (0, import_build_utils.runPackageJsonScript)(
|
|
2484
2518
|
workPath,
|
|
2485
2519
|
"build",
|
|
2486
|
-
|
|
2520
|
+
{ env: spawnEnv },
|
|
2487
2521
|
config.projectSettings?.createdAt
|
|
2488
2522
|
);
|
|
2489
2523
|
} else {
|
|
@@ -2501,7 +2535,7 @@ var build = async ({
|
|
|
2501
2535
|
cmd = "yarn rw deploy vercel";
|
|
2502
2536
|
}
|
|
2503
2537
|
await (0, import_build_utils.execCommand)(cmd, {
|
|
2504
|
-
|
|
2538
|
+
env: spawnEnv,
|
|
2505
2539
|
cwd: workPath
|
|
2506
2540
|
});
|
|
2507
2541
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/redwood",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://vercel.com/docs",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"@types/aws-lambda": "8.10.19",
|
|
23
23
|
"@types/node": "14.18.33",
|
|
24
24
|
"@types/semver": "6.0.0",
|
|
25
|
-
"@vercel/build-utils": "
|
|
26
|
-
"@vercel/routing-utils": "5.
|
|
25
|
+
"@vercel/build-utils": "13.0.0",
|
|
26
|
+
"@vercel/routing-utils": "5.2.1",
|
|
27
27
|
"execa": "3.2.0",
|
|
28
28
|
"fs-extra": "11.1.0",
|
|
29
29
|
"jest-junit": "16.0.0"
|