@vercel/static-build 2.8.40 → 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 +90 -47
- package/package.json +9 -9
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);
|
|
@@ -22437,6 +22484,9 @@ var require_utils4 = __commonJS({
|
|
|
22437
22484
|
if (config.runtime && config.runtime in import_types.RUNTIME_BUILDERS) {
|
|
22438
22485
|
return config.runtime;
|
|
22439
22486
|
}
|
|
22487
|
+
if (config.framework && config.framework in import_types.RUNTIME_BUILDERS) {
|
|
22488
|
+
return config.framework;
|
|
22489
|
+
}
|
|
22440
22490
|
if ((0, import_framework_helpers.isPythonFramework)(config.framework)) {
|
|
22441
22491
|
return "python";
|
|
22442
22492
|
}
|
|
@@ -23230,6 +23280,9 @@ var require_auto_detect = __commonJS({
|
|
|
23230
23280
|
var BACKEND_DIR = "backend";
|
|
23231
23281
|
var SERVICES_DIR = "services";
|
|
23232
23282
|
var FRONTEND_LOCATIONS = [FRONTEND_DIR, APPS_WEB_DIR];
|
|
23283
|
+
var DETECTION_FRAMEWORKS = import_frameworks2.default.filter(
|
|
23284
|
+
(framework) => !framework.experimental || framework.runtimeFramework
|
|
23285
|
+
);
|
|
23233
23286
|
async function autoDetectServices2(options) {
|
|
23234
23287
|
const { fs: fs5 } = options;
|
|
23235
23288
|
const rootFrameworks = await (0, import_detect_framework.detectFrameworks)({
|
|
@@ -23390,7 +23443,8 @@ var require_auto_detect = __commonJS({
|
|
|
23390
23443
|
const serviceFs = fs5.chdir(dirPath);
|
|
23391
23444
|
const frameworks2 = await (0, import_detect_framework.detectFrameworks)({
|
|
23392
23445
|
fs: serviceFs,
|
|
23393
|
-
frameworkList:
|
|
23446
|
+
frameworkList: DETECTION_FRAMEWORKS,
|
|
23447
|
+
useExperimentalFrameworks: true
|
|
23394
23448
|
});
|
|
23395
23449
|
if (frameworks2.length > 1) {
|
|
23396
23450
|
const frameworkNames = frameworks2.map((f) => f.name).join(", ");
|
|
@@ -23455,6 +23509,7 @@ var require_detect_services = __commonJS({
|
|
|
23455
23509
|
if (configError) {
|
|
23456
23510
|
return {
|
|
23457
23511
|
services: [],
|
|
23512
|
+
source: "configured",
|
|
23458
23513
|
routes: { rewrites: [], defaults: [], crons: [], workers: [] },
|
|
23459
23514
|
errors: [configError],
|
|
23460
23515
|
warnings: []
|
|
@@ -23467,6 +23522,7 @@ var require_detect_services = __commonJS({
|
|
|
23467
23522
|
if (autoResult.errors.length > 0) {
|
|
23468
23523
|
return {
|
|
23469
23524
|
services: [],
|
|
23525
|
+
source: "auto-detected",
|
|
23470
23526
|
routes: { rewrites: [], defaults: [], crons: [], workers: [] },
|
|
23471
23527
|
errors: autoResult.errors,
|
|
23472
23528
|
warnings: []
|
|
@@ -23481,6 +23537,7 @@ var require_detect_services = __commonJS({
|
|
|
23481
23537
|
const routes2 = generateServicesRoutes2(result2.services);
|
|
23482
23538
|
return {
|
|
23483
23539
|
services: result2.services,
|
|
23540
|
+
source: "auto-detected",
|
|
23484
23541
|
routes: routes2,
|
|
23485
23542
|
errors: result2.errors,
|
|
23486
23543
|
warnings: []
|
|
@@ -23488,6 +23545,7 @@ var require_detect_services = __commonJS({
|
|
|
23488
23545
|
}
|
|
23489
23546
|
return {
|
|
23490
23547
|
services: [],
|
|
23548
|
+
source: "auto-detected",
|
|
23491
23549
|
routes: { rewrites: [], defaults: [], crons: [], workers: [] },
|
|
23492
23550
|
errors: [
|
|
23493
23551
|
{
|
|
@@ -23506,6 +23564,7 @@ var require_detect_services = __commonJS({
|
|
|
23506
23564
|
const routes = generateServicesRoutes2(result.services);
|
|
23507
23565
|
return {
|
|
23508
23566
|
services: result.services,
|
|
23567
|
+
source: "configured",
|
|
23509
23568
|
routes,
|
|
23510
23569
|
errors: result.errors,
|
|
23511
23570
|
warnings: []
|
|
@@ -24407,23 +24466,7 @@ var require_detect_builders = __commonJS({
|
|
|
24407
24466
|
}
|
|
24408
24467
|
}
|
|
24409
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))) {
|
|
24410
|
-
|
|
24411
|
-
"app",
|
|
24412
|
-
"index",
|
|
24413
|
-
"server",
|
|
24414
|
-
"src/app",
|
|
24415
|
-
"src/index",
|
|
24416
|
-
"src/server"
|
|
24417
|
-
];
|
|
24418
|
-
const validExtensions = ["js", "cjs", "mjs", "ts", "cts", "mts"];
|
|
24419
|
-
const validEntrypoints = validFilenames.flatMap(
|
|
24420
|
-
(filename) => validExtensions.map((extension) => `${filename}.${extension}`)
|
|
24421
|
-
);
|
|
24422
|
-
for (const fnKey of unusedFunctions.values()) {
|
|
24423
|
-
if (validEntrypoints.includes(fnKey)) {
|
|
24424
|
-
unusedFunctions.delete(fnKey);
|
|
24425
|
-
}
|
|
24426
|
-
}
|
|
24469
|
+
return null;
|
|
24427
24470
|
}
|
|
24428
24471
|
if (unusedFunctions.size) {
|
|
24429
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",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"ts-morph": "12.0.0",
|
|
17
|
-
"@vercel/gatsby-plugin-vercel-
|
|
18
|
-
"@vercel/
|
|
19
|
-
"@vercel/
|
|
17
|
+
"@vercel/gatsby-plugin-vercel-analytics": "1.0.11",
|
|
18
|
+
"@vercel/gatsby-plugin-vercel-builder": "2.0.140",
|
|
19
|
+
"@vercel/static-config": "3.1.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/aws-lambda": "8.10.64",
|
|
@@ -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/
|
|
42
|
-
"@vercel/
|
|
43
|
-
"@vercel/
|
|
44
|
-
"@vercel/fs-detectors": "5.8.
|
|
45
|
-
"@vercel/
|
|
41
|
+
"@vercel/build-utils": "13.6.0",
|
|
42
|
+
"@vercel/error-utils": "2.0.3",
|
|
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",
|