@vercel/static-build 2.8.41 → 2.8.42
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 +82 -46
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -2918,12 +2918,12 @@ var require_lib2 = __commonJS({
|
|
|
2918
2918
|
const dest = new URL$1(destination).hostname;
|
|
2919
2919
|
return orig === dest || orig[orig.length - dest.length - 1] === "." && orig.endsWith(dest);
|
|
2920
2920
|
};
|
|
2921
|
-
function
|
|
2922
|
-
if (!
|
|
2921
|
+
function fetch(url, opts) {
|
|
2922
|
+
if (!fetch.Promise) {
|
|
2923
2923
|
throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
|
|
2924
2924
|
}
|
|
2925
|
-
Body.Promise =
|
|
2926
|
-
return new
|
|
2925
|
+
Body.Promise = fetch.Promise;
|
|
2926
|
+
return new fetch.Promise(function(resolve, reject) {
|
|
2927
2927
|
const request = new Request(url, opts);
|
|
2928
2928
|
const options = getNodeRequestOptions(request);
|
|
2929
2929
|
const send = (options.protocol === "https:" ? https : http).request;
|
|
@@ -2973,7 +2973,7 @@ var require_lib2 = __commonJS({
|
|
|
2973
2973
|
req.on("response", function(res) {
|
|
2974
2974
|
clearTimeout(reqTimeout);
|
|
2975
2975
|
const headers = createHeadersLenient(res.headers);
|
|
2976
|
-
if (
|
|
2976
|
+
if (fetch.isRedirect(res.statusCode)) {
|
|
2977
2977
|
const location = headers.get("Location");
|
|
2978
2978
|
let locationURL = null;
|
|
2979
2979
|
try {
|
|
@@ -3035,7 +3035,7 @@ var require_lib2 = __commonJS({
|
|
|
3035
3035
|
requestOpts.body = void 0;
|
|
3036
3036
|
requestOpts.headers.delete("content-length");
|
|
3037
3037
|
}
|
|
3038
|
-
resolve(
|
|
3038
|
+
resolve(fetch(new Request(locationURL, requestOpts)));
|
|
3039
3039
|
finalize();
|
|
3040
3040
|
return;
|
|
3041
3041
|
}
|
|
@@ -3095,11 +3095,11 @@ var require_lib2 = __commonJS({
|
|
|
3095
3095
|
writeToStream(req, request);
|
|
3096
3096
|
});
|
|
3097
3097
|
}
|
|
3098
|
-
|
|
3098
|
+
fetch.isRedirect = function(code) {
|
|
3099
3099
|
return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
|
|
3100
3100
|
};
|
|
3101
|
-
|
|
3102
|
-
module2.exports = exports2 =
|
|
3101
|
+
fetch.Promise = global.Promise;
|
|
3102
|
+
module2.exports = exports2 = fetch;
|
|
3103
3103
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3104
3104
|
exports2.default = exports2;
|
|
3105
3105
|
exports2.Headers = Headers;
|
|
@@ -21584,24 +21584,31 @@ var require_schemas = __commonJS({
|
|
|
21584
21584
|
};
|
|
21585
21585
|
var routesSchema = {
|
|
21586
21586
|
type: "array",
|
|
21587
|
-
deprecated: true,
|
|
21588
21587
|
description: "A list of routes objects used to rewrite paths to point towards other internal or external paths",
|
|
21589
21588
|
example: [{ dest: "https://docs.example.com", src: "/docs" }],
|
|
21590
21589
|
items: {
|
|
21591
21590
|
anyOf: [
|
|
21592
21591
|
{
|
|
21593
21592
|
type: "object",
|
|
21594
|
-
required: ["src"],
|
|
21593
|
+
anyOf: [{ required: ["src"] }, { required: ["source"] }],
|
|
21595
21594
|
additionalProperties: false,
|
|
21596
21595
|
properties: {
|
|
21597
21596
|
src: {
|
|
21598
21597
|
type: "string",
|
|
21599
21598
|
maxLength: 4096
|
|
21600
21599
|
},
|
|
21600
|
+
source: {
|
|
21601
|
+
type: "string",
|
|
21602
|
+
maxLength: 4096
|
|
21603
|
+
},
|
|
21601
21604
|
dest: {
|
|
21602
21605
|
type: "string",
|
|
21603
21606
|
maxLength: 4096
|
|
21604
21607
|
},
|
|
21608
|
+
destination: {
|
|
21609
|
+
type: "string",
|
|
21610
|
+
maxLength: 4096
|
|
21611
|
+
},
|
|
21605
21612
|
headers: {
|
|
21606
21613
|
type: "object",
|
|
21607
21614
|
additionalProperties: false,
|
|
@@ -21626,6 +21633,7 @@ var require_schemas = __commonJS({
|
|
|
21626
21633
|
type: "boolean"
|
|
21627
21634
|
},
|
|
21628
21635
|
important: {
|
|
21636
|
+
deprecated: true,
|
|
21629
21637
|
type: "boolean"
|
|
21630
21638
|
},
|
|
21631
21639
|
user: {
|
|
@@ -21635,6 +21643,7 @@ var require_schemas = __commonJS({
|
|
|
21635
21643
|
type: "boolean"
|
|
21636
21644
|
},
|
|
21637
21645
|
override: {
|
|
21646
|
+
deprecated: true,
|
|
21638
21647
|
type: "boolean"
|
|
21639
21648
|
},
|
|
21640
21649
|
check: {
|
|
@@ -21648,6 +21657,11 @@ var require_schemas = __commonJS({
|
|
|
21648
21657
|
minimum: 100,
|
|
21649
21658
|
maximum: 999
|
|
21650
21659
|
},
|
|
21660
|
+
statusCode: {
|
|
21661
|
+
type: "integer",
|
|
21662
|
+
minimum: 100,
|
|
21663
|
+
maximum: 999
|
|
21664
|
+
},
|
|
21651
21665
|
locale: {
|
|
21652
21666
|
type: "object",
|
|
21653
21667
|
additionalProperties: false,
|
|
@@ -21713,6 +21727,7 @@ var require_schemas = __commonJS({
|
|
|
21713
21727
|
},
|
|
21714
21728
|
{
|
|
21715
21729
|
type: "object",
|
|
21730
|
+
deprecated: true,
|
|
21716
21731
|
required: ["handle"],
|
|
21717
21732
|
additionalProperties: false,
|
|
21718
21733
|
properties: {
|
|
@@ -21986,6 +22001,35 @@ var require_dist6 = __commonJS({
|
|
|
21986
22001
|
function isValidHandleValue(handle) {
|
|
21987
22002
|
return validHandleValues.has(handle);
|
|
21988
22003
|
}
|
|
22004
|
+
function convertRouteAliases(route, index) {
|
|
22005
|
+
if (route.source !== void 0) {
|
|
22006
|
+
if (route.src !== void 0) {
|
|
22007
|
+
throw new Error(
|
|
22008
|
+
`Route at index ${index} cannot define both \`src\` and \`source\`. Please use only one.`
|
|
22009
|
+
);
|
|
22010
|
+
}
|
|
22011
|
+
route.src = route.source;
|
|
22012
|
+
delete route.source;
|
|
22013
|
+
}
|
|
22014
|
+
if (route.destination !== void 0) {
|
|
22015
|
+
if (route.dest !== void 0) {
|
|
22016
|
+
throw new Error(
|
|
22017
|
+
`Route at index ${index} cannot define both \`dest\` and \`destination\`. Please use only one.`
|
|
22018
|
+
);
|
|
22019
|
+
}
|
|
22020
|
+
route.dest = route.destination;
|
|
22021
|
+
delete route.destination;
|
|
22022
|
+
}
|
|
22023
|
+
if (route.statusCode !== void 0) {
|
|
22024
|
+
if (route.status !== void 0) {
|
|
22025
|
+
throw new Error(
|
|
22026
|
+
`Route at index ${index} cannot define both \`status\` and \`statusCode\`. Please use only one.`
|
|
22027
|
+
);
|
|
22028
|
+
}
|
|
22029
|
+
route.status = route.statusCode;
|
|
22030
|
+
delete route.statusCode;
|
|
22031
|
+
}
|
|
22032
|
+
}
|
|
21989
22033
|
function normalizeRoutes(inputRoutes) {
|
|
21990
22034
|
if (!inputRoutes || inputRoutes.length === 0) {
|
|
21991
22035
|
return { routes: inputRoutes, error: null };
|
|
@@ -21996,6 +22040,13 @@ var require_dist6 = __commonJS({
|
|
|
21996
22040
|
inputRoutes.forEach((r, i) => {
|
|
21997
22041
|
const route = { ...r };
|
|
21998
22042
|
routes.push(route);
|
|
22043
|
+
if (!isHandler(route)) {
|
|
22044
|
+
try {
|
|
22045
|
+
convertRouteAliases(route, i);
|
|
22046
|
+
} catch (err) {
|
|
22047
|
+
errors.push(err.message);
|
|
22048
|
+
}
|
|
22049
|
+
}
|
|
21999
22050
|
const keys = Object.keys(route);
|
|
22000
22051
|
if (isHandler(route)) {
|
|
22001
22052
|
const { handle } = route;
|
|
@@ -22031,12 +22082,12 @@ var require_dist6 = __commonJS({
|
|
|
22031
22082
|
if (handleValue === "hit") {
|
|
22032
22083
|
if (route.dest) {
|
|
22033
22084
|
errors.push(
|
|
22034
|
-
`Route at index ${i} cannot define \`dest\` after \`handle: hit\`.`
|
|
22085
|
+
`Route at index ${i} cannot define \`dest\`/\`destination\` after \`handle: hit\`.`
|
|
22035
22086
|
);
|
|
22036
22087
|
}
|
|
22037
22088
|
if (route.status) {
|
|
22038
22089
|
errors.push(
|
|
22039
|
-
`Route at index ${i} cannot define \`status\` after \`handle: hit\`.`
|
|
22090
|
+
`Route at index ${i} cannot define \`status\`/\`statusCode\` after \`handle: hit\`.`
|
|
22040
22091
|
);
|
|
22041
22092
|
}
|
|
22042
22093
|
if (!route.continue) {
|
|
@@ -22057,7 +22108,7 @@ var require_dist6 = __commonJS({
|
|
|
22057
22108
|
}
|
|
22058
22109
|
} else {
|
|
22059
22110
|
errors.push(
|
|
22060
|
-
`Route at index ${i} must define either \`
|
|
22111
|
+
`Route at index ${i} must define either \`src\` or \`source\` property.`
|
|
22061
22112
|
);
|
|
22062
22113
|
}
|
|
22063
22114
|
});
|
|
@@ -22073,7 +22124,7 @@ var require_dist6 = __commonJS({
|
|
|
22073
22124
|
try {
|
|
22074
22125
|
new RegExp(src);
|
|
22075
22126
|
} catch (err) {
|
|
22076
|
-
const prop = type === "Route" ? "src" : "source";
|
|
22127
|
+
const prop = type === "Route" ? "src`/`source" : "source";
|
|
22077
22128
|
return `${type} at index ${index} has invalid \`${prop}\` regular expression "${src}".`;
|
|
22078
22129
|
}
|
|
22079
22130
|
return null;
|
|
@@ -22146,20 +22197,8 @@ var require_dist6 = __commonJS({
|
|
|
22146
22197
|
}
|
|
22147
22198
|
function getTransformedRoutes(vercelConfig) {
|
|
22148
22199
|
const { cleanUrls, rewrites, redirects, headers, trailingSlash } = vercelConfig;
|
|
22149
|
-
|
|
22150
|
-
|
|
22151
|
-
const hasNewProperties = typeof cleanUrls !== "undefined" || typeof trailingSlash !== "undefined" || typeof redirects !== "undefined" || typeof headers !== "undefined" || typeof rewrites !== "undefined";
|
|
22152
|
-
if (hasNewProperties) {
|
|
22153
|
-
const error = createError(
|
|
22154
|
-
"invalid_mixed_routes",
|
|
22155
|
-
"If `rewrites`, `redirects`, `headers`, `cleanUrls` or `trailingSlash` are used, then `routes` cannot be present.",
|
|
22156
|
-
"https://vercel.link/mix-routing-props",
|
|
22157
|
-
"Learn More"
|
|
22158
|
-
);
|
|
22159
|
-
return { routes, error };
|
|
22160
|
-
}
|
|
22161
|
-
return normalizeRoutes(routes);
|
|
22162
|
-
}
|
|
22200
|
+
const { routes: userRoutes = null } = vercelConfig;
|
|
22201
|
+
let routes = null;
|
|
22163
22202
|
if (typeof cleanUrls !== "undefined") {
|
|
22164
22203
|
const normalized = normalizeRoutes(
|
|
22165
22204
|
(0, import_superstatic.convertCleanUrls)(cleanUrls, trailingSlash)
|
|
@@ -22180,6 +22219,14 @@ var require_dist6 = __commonJS({
|
|
|
22180
22219
|
routes = routes || [];
|
|
22181
22220
|
routes.push(...normalized.routes || []);
|
|
22182
22221
|
}
|
|
22222
|
+
if (userRoutes) {
|
|
22223
|
+
const normalized = normalizeRoutes(userRoutes);
|
|
22224
|
+
if (normalized.error) {
|
|
22225
|
+
return { routes, error: normalized.error };
|
|
22226
|
+
}
|
|
22227
|
+
routes = routes || [];
|
|
22228
|
+
routes.push(...normalized.routes || []);
|
|
22229
|
+
}
|
|
22183
22230
|
if (typeof redirects !== "undefined") {
|
|
22184
22231
|
const code = "invalid_redirect";
|
|
22185
22232
|
const regexErrorMessage = redirects.map((r, i) => checkRegexSyntax("Redirect", i, r.source)).find(notEmpty);
|
|
@@ -23462,6 +23509,7 @@ var require_detect_services = __commonJS({
|
|
|
23462
23509
|
if (configError) {
|
|
23463
23510
|
return {
|
|
23464
23511
|
services: [],
|
|
23512
|
+
source: "configured",
|
|
23465
23513
|
routes: { rewrites: [], defaults: [], crons: [], workers: [] },
|
|
23466
23514
|
errors: [configError],
|
|
23467
23515
|
warnings: []
|
|
@@ -23474,6 +23522,7 @@ var require_detect_services = __commonJS({
|
|
|
23474
23522
|
if (autoResult.errors.length > 0) {
|
|
23475
23523
|
return {
|
|
23476
23524
|
services: [],
|
|
23525
|
+
source: "auto-detected",
|
|
23477
23526
|
routes: { rewrites: [], defaults: [], crons: [], workers: [] },
|
|
23478
23527
|
errors: autoResult.errors,
|
|
23479
23528
|
warnings: []
|
|
@@ -23488,6 +23537,7 @@ var require_detect_services = __commonJS({
|
|
|
23488
23537
|
const routes2 = generateServicesRoutes2(result2.services);
|
|
23489
23538
|
return {
|
|
23490
23539
|
services: result2.services,
|
|
23540
|
+
source: "auto-detected",
|
|
23491
23541
|
routes: routes2,
|
|
23492
23542
|
errors: result2.errors,
|
|
23493
23543
|
warnings: []
|
|
@@ -23495,6 +23545,7 @@ var require_detect_services = __commonJS({
|
|
|
23495
23545
|
}
|
|
23496
23546
|
return {
|
|
23497
23547
|
services: [],
|
|
23548
|
+
source: "auto-detected",
|
|
23498
23549
|
routes: { rewrites: [], defaults: [], crons: [], workers: [] },
|
|
23499
23550
|
errors: [
|
|
23500
23551
|
{
|
|
@@ -23513,6 +23564,7 @@ var require_detect_services = __commonJS({
|
|
|
23513
23564
|
const routes = generateServicesRoutes2(result.services);
|
|
23514
23565
|
return {
|
|
23515
23566
|
services: result.services,
|
|
23567
|
+
source: "configured",
|
|
23516
23568
|
routes,
|
|
23517
23569
|
errors: result.errors,
|
|
23518
23570
|
warnings: []
|
|
@@ -24414,23 +24466,7 @@ var require_detect_builders = __commonJS({
|
|
|
24414
24466
|
}
|
|
24415
24467
|
}
|
|
24416
24468
|
if (frontendBuilder && ((0, import_is_official_runtime.isOfficialRuntime)("express", frontendBuilder.use) || (0, import_is_official_runtime.isOfficialRuntime)("hono", frontendBuilder.use) || (0, import_is_official_runtime.isOfficialRuntime)("backends", frontendBuilder.use))) {
|
|
24417
|
-
|
|
24418
|
-
"app",
|
|
24419
|
-
"index",
|
|
24420
|
-
"server",
|
|
24421
|
-
"src/app",
|
|
24422
|
-
"src/index",
|
|
24423
|
-
"src/server"
|
|
24424
|
-
];
|
|
24425
|
-
const validExtensions = ["js", "cjs", "mjs", "ts", "cts", "mts"];
|
|
24426
|
-
const validEntrypoints = validFilenames.flatMap(
|
|
24427
|
-
(filename) => validExtensions.map((extension) => `${filename}.${extension}`)
|
|
24428
|
-
);
|
|
24429
|
-
for (const fnKey of unusedFunctions.values()) {
|
|
24430
|
-
if (validEntrypoints.includes(fnKey)) {
|
|
24431
|
-
unusedFunctions.delete(fnKey);
|
|
24432
|
-
}
|
|
24433
|
-
}
|
|
24469
|
+
return null;
|
|
24434
24470
|
}
|
|
24435
24471
|
if (unusedFunctions.size) {
|
|
24436
24472
|
const [fnKey] = Array.from(unusedFunctions);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/static-build",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.42",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/build-step",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"ts-morph": "12.0.0",
|
|
17
17
|
"@vercel/gatsby-plugin-vercel-analytics": "1.0.11",
|
|
18
|
-
"@vercel/gatsby-plugin-vercel-builder": "2.0.
|
|
18
|
+
"@vercel/gatsby-plugin-vercel-builder": "2.0.140",
|
|
19
19
|
"@vercel/static-config": "3.1.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"rc9": "1.2.0",
|
|
39
39
|
"semver": "7.5.2",
|
|
40
40
|
"tree-kill": "1.2.2",
|
|
41
|
-
"@vercel/build-utils": "13.
|
|
41
|
+
"@vercel/build-utils": "13.6.0",
|
|
42
42
|
"@vercel/error-utils": "2.0.3",
|
|
43
|
-
"@vercel/
|
|
44
|
-
"@vercel/fs-detectors": "5.8.
|
|
45
|
-
"@vercel/
|
|
43
|
+
"@vercel/routing-utils": "6.0.0",
|
|
44
|
+
"@vercel/fs-detectors": "5.8.12",
|
|
45
|
+
"@vercel/frameworks": "3.19.1"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "node ../../utils/build-builder.mjs",
|