@vercel/static-build 2.8.44 → 2.8.46
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 +198 -47
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -8421,10 +8421,10 @@ var require_frameworks = __commonJS({
|
|
|
8421
8421
|
const nowRoutes = JSON.parse(content);
|
|
8422
8422
|
try {
|
|
8423
8423
|
await unlink(nowRoutesPath);
|
|
8424
|
-
} catch (
|
|
8424
|
+
} catch (_err) {
|
|
8425
8425
|
}
|
|
8426
8426
|
return nowRoutes;
|
|
8427
|
-
} catch (
|
|
8427
|
+
} catch (_err) {
|
|
8428
8428
|
return [
|
|
8429
8429
|
{
|
|
8430
8430
|
src: "^/static/(.*)$",
|
|
@@ -10407,6 +10407,11 @@ var require_frameworks = __commonJS({
|
|
|
10407
10407
|
{
|
|
10408
10408
|
path: "Pipfile",
|
|
10409
10409
|
matchContent: "[Dd]jango"
|
|
10410
|
+
},
|
|
10411
|
+
{
|
|
10412
|
+
// a default django project will create a manage.py which sets DJANGO_SETTINGS_MODULE
|
|
10413
|
+
path: "manage.py",
|
|
10414
|
+
matchContent: "DJANGO_SETTINGS_MODULE"
|
|
10410
10415
|
}
|
|
10411
10416
|
]
|
|
10412
10417
|
},
|
|
@@ -20683,7 +20688,7 @@ var require_superstatic = __commonJS({
|
|
|
20683
20688
|
route.missing = r.missing;
|
|
20684
20689
|
}
|
|
20685
20690
|
return route;
|
|
20686
|
-
} catch (
|
|
20691
|
+
} catch (_e) {
|
|
20687
20692
|
throw new Error(`Failed to parse redirect: ${JSON.stringify(r)}`);
|
|
20688
20693
|
}
|
|
20689
20694
|
});
|
|
@@ -20716,7 +20721,7 @@ var require_superstatic = __commonJS({
|
|
|
20716
20721
|
route.status = r.statusCode;
|
|
20717
20722
|
}
|
|
20718
20723
|
return route;
|
|
20719
|
-
} catch (
|
|
20724
|
+
} catch (_e) {
|
|
20720
20725
|
throw new Error(`Failed to parse rewrite: ${JSON.stringify(r)}`);
|
|
20721
20726
|
}
|
|
20722
20727
|
});
|
|
@@ -20927,7 +20932,7 @@ var require_superstatic = __commonJS({
|
|
|
20927
20932
|
if (attemptDirectCompile) {
|
|
20928
20933
|
try {
|
|
20929
20934
|
return (0, import_path_to_regexp.compile)(value, { validate: false })(indexes);
|
|
20930
|
-
} catch (
|
|
20935
|
+
} catch (_e) {
|
|
20931
20936
|
}
|
|
20932
20937
|
}
|
|
20933
20938
|
for (const key of Object.keys(indexes)) {
|
|
@@ -21524,6 +21529,7 @@ var require_schemas = __commonJS({
|
|
|
21524
21529
|
}
|
|
21525
21530
|
}
|
|
21526
21531
|
},
|
|
21532
|
+
// biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then keyword
|
|
21527
21533
|
then: {
|
|
21528
21534
|
required: ["args"]
|
|
21529
21535
|
}
|
|
@@ -21547,6 +21553,7 @@ var require_schemas = __commonJS({
|
|
|
21547
21553
|
}
|
|
21548
21554
|
]
|
|
21549
21555
|
},
|
|
21556
|
+
// biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then keyword
|
|
21550
21557
|
then: {
|
|
21551
21558
|
properties: {
|
|
21552
21559
|
target: {
|
|
@@ -21555,6 +21562,7 @@ var require_schemas = __commonJS({
|
|
|
21555
21562
|
if: {
|
|
21556
21563
|
type: "string"
|
|
21557
21564
|
},
|
|
21565
|
+
// biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then keyword
|
|
21558
21566
|
then: {
|
|
21559
21567
|
pattern: "^[a-zA-Z0-9_-]+$"
|
|
21560
21568
|
}
|
|
@@ -22123,7 +22131,7 @@ var require_dist6 = __commonJS({
|
|
|
22123
22131
|
function checkRegexSyntax(type, index, src) {
|
|
22124
22132
|
try {
|
|
22125
22133
|
new RegExp(src);
|
|
22126
|
-
} catch (
|
|
22134
|
+
} catch (_err) {
|
|
22127
22135
|
const prop = type === "Route" ? "src`/`source" : "source";
|
|
22128
22136
|
return `${type} at index ${index} has invalid \`${prop}\` regular expression "${src}".`;
|
|
22129
22137
|
}
|
|
@@ -22138,7 +22146,7 @@ var require_dist6 = __commonJS({
|
|
|
22138
22146
|
const destinationSegments = /* @__PURE__ */ new Set();
|
|
22139
22147
|
try {
|
|
22140
22148
|
sourceSegments = new Set((0, import_superstatic.sourceToRegex)(source).segments);
|
|
22141
|
-
} catch (
|
|
22149
|
+
} catch (_err) {
|
|
22142
22150
|
return {
|
|
22143
22151
|
message: `${type} at index ${index} has invalid \`source\` pattern "${source}".`,
|
|
22144
22152
|
link: "https://vercel.link/invalid-route-source-pattern"
|
|
@@ -22159,7 +22167,7 @@ var require_dist6 = __commonJS({
|
|
|
22159
22167
|
(name) => destinationSegments.add(name)
|
|
22160
22168
|
);
|
|
22161
22169
|
}
|
|
22162
|
-
} catch (
|
|
22170
|
+
} catch (_err) {
|
|
22163
22171
|
}
|
|
22164
22172
|
const hasSegments = (0, import_superstatic.collectHasSegments)(has);
|
|
22165
22173
|
for (const segment of destinationSegments) {
|
|
@@ -22445,9 +22453,15 @@ var require_utils4 = __commonJS({
|
|
|
22445
22453
|
var utils_exports = {};
|
|
22446
22454
|
__export2(utils_exports, {
|
|
22447
22455
|
INTERNAL_SERVICE_PREFIX: () => INTERNAL_SERVICE_PREFIX2,
|
|
22456
|
+
filterFrameworksByRuntime: () => filterFrameworksByRuntime,
|
|
22448
22457
|
getBuilderForRuntime: () => getBuilderForRuntime,
|
|
22458
|
+
getInternalServiceCronPath: () => getInternalServiceCronPath2,
|
|
22459
|
+
getInternalServiceCronPathPrefix: () => getInternalServiceCronPathPrefix2,
|
|
22449
22460
|
getInternalServiceFunctionPath: () => getInternalServiceFunctionPath2,
|
|
22461
|
+
getInternalServiceWorkerPath: () => getInternalServiceWorkerPath2,
|
|
22462
|
+
getInternalServiceWorkerPathPrefix: () => getInternalServiceWorkerPathPrefix2,
|
|
22450
22463
|
hasFile: () => hasFile,
|
|
22464
|
+
inferRuntimeFromFramework: () => inferRuntimeFromFramework,
|
|
22451
22465
|
inferServiceRuntime: () => inferServiceRuntime,
|
|
22452
22466
|
isRouteOwningBuilder: () => isRouteOwningBuilder2,
|
|
22453
22467
|
isStaticBuild: () => isStaticBuild2,
|
|
@@ -22467,6 +22481,24 @@ var require_utils4 = __commonJS({
|
|
|
22467
22481
|
function getInternalServiceFunctionPath2(serviceName) {
|
|
22468
22482
|
return `${INTERNAL_SERVICE_PREFIX2}/${serviceName}/index`;
|
|
22469
22483
|
}
|
|
22484
|
+
function normalizeInternalServiceEntrypoint(entrypoint) {
|
|
22485
|
+
const normalized = entrypoint.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\.[^/.]+$/, "");
|
|
22486
|
+
return normalized || "index";
|
|
22487
|
+
}
|
|
22488
|
+
function getInternalServiceWorkerPathPrefix2(serviceName) {
|
|
22489
|
+
return `${INTERNAL_SERVICE_PREFIX2}/${serviceName}/workers`;
|
|
22490
|
+
}
|
|
22491
|
+
function getInternalServiceCronPathPrefix2(serviceName) {
|
|
22492
|
+
return `${INTERNAL_SERVICE_PREFIX2}/${serviceName}/crons`;
|
|
22493
|
+
}
|
|
22494
|
+
function getInternalServiceWorkerPath2(serviceName, entrypoint, handler = "worker") {
|
|
22495
|
+
const normalizedEntrypoint = normalizeInternalServiceEntrypoint(entrypoint);
|
|
22496
|
+
return `${getInternalServiceWorkerPathPrefix2(serviceName)}/${normalizedEntrypoint}/${handler}`;
|
|
22497
|
+
}
|
|
22498
|
+
function getInternalServiceCronPath2(serviceName, entrypoint, handler = "cron") {
|
|
22499
|
+
const normalizedEntrypoint = normalizeInternalServiceEntrypoint(entrypoint);
|
|
22500
|
+
return `${getInternalServiceCronPathPrefix2(serviceName)}/${normalizedEntrypoint}/${handler}`;
|
|
22501
|
+
}
|
|
22470
22502
|
function getBuilderForRuntime(runtime) {
|
|
22471
22503
|
const builder = import_types.RUNTIME_BUILDERS[runtime];
|
|
22472
22504
|
if (!builder) {
|
|
@@ -22480,19 +22512,37 @@ var require_utils4 = __commonJS({
|
|
|
22480
22512
|
function isRouteOwningBuilder2(service) {
|
|
22481
22513
|
return import_types.ROUTE_OWNING_BUILDERS.has(service.builder.use);
|
|
22482
22514
|
}
|
|
22483
|
-
function
|
|
22484
|
-
if (
|
|
22485
|
-
return
|
|
22515
|
+
function inferRuntimeFromFramework(framework) {
|
|
22516
|
+
if (!framework) {
|
|
22517
|
+
return void 0;
|
|
22486
22518
|
}
|
|
22487
|
-
if (
|
|
22488
|
-
return
|
|
22519
|
+
if (framework in import_types.RUNTIME_BUILDERS) {
|
|
22520
|
+
return framework;
|
|
22489
22521
|
}
|
|
22490
|
-
if ((0, import_framework_helpers.isPythonFramework)(
|
|
22522
|
+
if ((0, import_framework_helpers.isPythonFramework)(framework)) {
|
|
22491
22523
|
return "python";
|
|
22492
22524
|
}
|
|
22493
|
-
if ((0, import_framework_helpers.isBackendFramework)(
|
|
22525
|
+
if ((0, import_framework_helpers.isBackendFramework)(framework)) {
|
|
22494
22526
|
return "node";
|
|
22495
22527
|
}
|
|
22528
|
+
return void 0;
|
|
22529
|
+
}
|
|
22530
|
+
function filterFrameworksByRuntime(frameworks2, runtime) {
|
|
22531
|
+
if (!runtime) {
|
|
22532
|
+
return [...frameworks2];
|
|
22533
|
+
}
|
|
22534
|
+
return frameworks2.filter(
|
|
22535
|
+
(framework) => inferRuntimeFromFramework(framework.slug) === runtime
|
|
22536
|
+
);
|
|
22537
|
+
}
|
|
22538
|
+
function inferServiceRuntime(config) {
|
|
22539
|
+
if (config.runtime && config.runtime in import_types.RUNTIME_BUILDERS) {
|
|
22540
|
+
return config.runtime;
|
|
22541
|
+
}
|
|
22542
|
+
const frameworkRuntime = inferRuntimeFromFramework(config.framework);
|
|
22543
|
+
if (frameworkRuntime) {
|
|
22544
|
+
return frameworkRuntime;
|
|
22545
|
+
}
|
|
22496
22546
|
if (config.builder) {
|
|
22497
22547
|
for (const [runtime, builderName] of Object.entries(import_types.RUNTIME_BUILDERS)) {
|
|
22498
22548
|
if (config.builder === builderName) {
|
|
@@ -22829,6 +22879,16 @@ var require_resolve = __commonJS({
|
|
|
22829
22879
|
var import_detect_framework = require_detect_framework();
|
|
22830
22880
|
var import_routing_utils = require_dist6();
|
|
22831
22881
|
var frameworksBySlug = new Map(import_frameworks2.default.map((f) => [f.slug, f]));
|
|
22882
|
+
var PYTHON_MODULE_ATTR_RE = /^([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)*):([A-Za-z_][\w]*)$/;
|
|
22883
|
+
function parsePyModuleAttrEntrypoint(entrypoint) {
|
|
22884
|
+
const match = PYTHON_MODULE_ATTR_RE.exec(entrypoint);
|
|
22885
|
+
if (!match)
|
|
22886
|
+
return null;
|
|
22887
|
+
return {
|
|
22888
|
+
attrName: match[2],
|
|
22889
|
+
filePath: match[1].replace(/\./g, "/") + ".py"
|
|
22890
|
+
};
|
|
22891
|
+
}
|
|
22832
22892
|
var SERVICE_NAME_REGEX = /^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$/;
|
|
22833
22893
|
function normalizeServiceEntrypoint(entrypoint) {
|
|
22834
22894
|
const normalized = import_path7.posix.normalize(entrypoint);
|
|
@@ -22914,12 +22974,14 @@ var require_resolve = __commonJS({
|
|
|
22914
22974
|
async function detectFrameworkFromWorkspace({
|
|
22915
22975
|
fs: fs5,
|
|
22916
22976
|
workspace,
|
|
22917
|
-
serviceName
|
|
22977
|
+
serviceName,
|
|
22978
|
+
runtime
|
|
22918
22979
|
}) {
|
|
22919
22980
|
const serviceFs = workspace === "." ? fs5 : fs5.chdir(workspace);
|
|
22981
|
+
const frameworkCandidates = (0, import_utils.filterFrameworksByRuntime)(import_frameworks2.default, runtime);
|
|
22920
22982
|
const frameworks2 = await (0, import_detect_framework.detectFrameworks)({
|
|
22921
22983
|
fs: serviceFs,
|
|
22922
|
-
frameworkList:
|
|
22984
|
+
frameworkList: frameworkCandidates
|
|
22923
22985
|
});
|
|
22924
22986
|
if (frameworks2.length > 1) {
|
|
22925
22987
|
const frameworkNames = frameworks2.map((f) => f.name).join(", ");
|
|
@@ -23000,6 +23062,16 @@ var require_resolve = __commonJS({
|
|
|
23000
23062
|
serviceName: name
|
|
23001
23063
|
};
|
|
23002
23064
|
}
|
|
23065
|
+
if (config.runtime && config.framework) {
|
|
23066
|
+
const frameworkRuntime = (0, import_utils.inferRuntimeFromFramework)(config.framework);
|
|
23067
|
+
if (frameworkRuntime && frameworkRuntime !== config.runtime) {
|
|
23068
|
+
return {
|
|
23069
|
+
code: "RUNTIME_FRAMEWORK_MISMATCH",
|
|
23070
|
+
message: `Service "${name}" has conflicting runtime/framework: runtime "${config.runtime}" is incompatible with framework "${config.framework}" (runtime "${frameworkRuntime}").`,
|
|
23071
|
+
serviceName: name
|
|
23072
|
+
};
|
|
23073
|
+
}
|
|
23074
|
+
}
|
|
23003
23075
|
const hasFramework = Boolean(config.framework);
|
|
23004
23076
|
const hasBuilderOrRuntime = Boolean(config.builder || config.runtime);
|
|
23005
23077
|
const hasEntrypoint = Boolean(config.entrypoint);
|
|
@@ -23021,7 +23093,9 @@ var require_resolve = __commonJS({
|
|
|
23021
23093
|
}
|
|
23022
23094
|
function validateServiceEntrypoint(name, config, resolvedEntrypoint) {
|
|
23023
23095
|
if (!resolvedEntrypoint.isDirectory && !config.builder && !config.runtime && !config.framework) {
|
|
23024
|
-
const runtime = (0, import_utils.inferServiceRuntime)({
|
|
23096
|
+
const runtime = (0, import_utils.inferServiceRuntime)({
|
|
23097
|
+
entrypoint: resolvedEntrypoint.normalized
|
|
23098
|
+
});
|
|
23025
23099
|
if (!runtime) {
|
|
23026
23100
|
const supported = Object.keys(import_types.ENTRYPOINT_EXTENSIONS).join(", ");
|
|
23027
23101
|
return {
|
|
@@ -23044,12 +23118,14 @@ var require_resolve = __commonJS({
|
|
|
23044
23118
|
} = options;
|
|
23045
23119
|
const type = config.type || "web";
|
|
23046
23120
|
const rawEntrypoint = config.entrypoint;
|
|
23121
|
+
const moduleAttrParsed = typeof rawEntrypoint === "string" && type === "cron" ? parsePyModuleAttrEntrypoint(rawEntrypoint) : null;
|
|
23047
23122
|
let resolvedEntrypointPath = resolvedEntrypoint;
|
|
23048
23123
|
if (!resolvedEntrypointPath && typeof rawEntrypoint === "string") {
|
|
23124
|
+
const entrypointToResolve = moduleAttrParsed ? moduleAttrParsed.filePath : rawEntrypoint;
|
|
23049
23125
|
const resolved = await resolveEntrypointPath({
|
|
23050
23126
|
fs: fs5,
|
|
23051
23127
|
serviceName: name,
|
|
23052
|
-
entrypoint:
|
|
23128
|
+
entrypoint: entrypointToResolve
|
|
23053
23129
|
});
|
|
23054
23130
|
resolvedEntrypointPath = resolved.entrypoint;
|
|
23055
23131
|
}
|
|
@@ -23125,6 +23201,9 @@ var require_resolve = __commonJS({
|
|
|
23125
23201
|
if (config.framework) {
|
|
23126
23202
|
builderConfig.framework = config.framework;
|
|
23127
23203
|
}
|
|
23204
|
+
if (moduleAttrParsed) {
|
|
23205
|
+
builderConfig.handlerFunction = moduleAttrParsed.attrName;
|
|
23206
|
+
}
|
|
23128
23207
|
return {
|
|
23129
23208
|
name,
|
|
23130
23209
|
type,
|
|
@@ -23143,6 +23222,7 @@ var require_resolve = __commonJS({
|
|
|
23143
23222
|
buildCommand: config.buildCommand,
|
|
23144
23223
|
installCommand: config.installCommand,
|
|
23145
23224
|
schedule: config.schedule,
|
|
23225
|
+
handlerFunction: moduleAttrParsed?.attrName,
|
|
23146
23226
|
topic,
|
|
23147
23227
|
consumer
|
|
23148
23228
|
};
|
|
@@ -23159,11 +23239,14 @@ var require_resolve = __commonJS({
|
|
|
23159
23239
|
continue;
|
|
23160
23240
|
}
|
|
23161
23241
|
let resolvedEntrypoint;
|
|
23242
|
+
const serviceType = serviceConfig.type || "web";
|
|
23162
23243
|
if (typeof serviceConfig.entrypoint === "string") {
|
|
23244
|
+
const moduleAttr = serviceType === "cron" ? parsePyModuleAttrEntrypoint(serviceConfig.entrypoint) : null;
|
|
23245
|
+
const entrypointToResolve = moduleAttr ? moduleAttr.filePath : serviceConfig.entrypoint;
|
|
23163
23246
|
const resolvedPath = await resolveEntrypointPath({
|
|
23164
23247
|
fs: fs5,
|
|
23165
23248
|
serviceName: name,
|
|
23166
|
-
entrypoint:
|
|
23249
|
+
entrypoint: entrypointToResolve
|
|
23167
23250
|
});
|
|
23168
23251
|
if (resolvedPath.error) {
|
|
23169
23252
|
errors.push(resolvedPath.error);
|
|
@@ -23183,30 +23266,56 @@ var require_resolve = __commonJS({
|
|
|
23183
23266
|
}
|
|
23184
23267
|
}
|
|
23185
23268
|
let resolvedConfig = serviceConfig;
|
|
23186
|
-
|
|
23187
|
-
|
|
23188
|
-
|
|
23189
|
-
|
|
23190
|
-
|
|
23191
|
-
|
|
23192
|
-
serviceName: name
|
|
23193
|
-
});
|
|
23194
|
-
if (error) {
|
|
23195
|
-
errors.push(error);
|
|
23196
|
-
continue;
|
|
23197
|
-
}
|
|
23198
|
-
if (!framework) {
|
|
23199
|
-
errors.push({
|
|
23200
|
-
code: "MISSING_SERVICE_FRAMEWORK",
|
|
23201
|
-
message: `Service "${name}" uses directory entrypoint "${serviceConfig.entrypoint}" but no framework could be detected in "${workspace}". Specify "framework" explicitly or use a file entrypoint.`,
|
|
23269
|
+
if (!serviceConfig.framework && resolvedEntrypoint) {
|
|
23270
|
+
if (resolvedEntrypoint.isDirectory) {
|
|
23271
|
+
const workspace = resolvedEntrypoint.normalized;
|
|
23272
|
+
const { framework, error } = await detectFrameworkFromWorkspace({
|
|
23273
|
+
fs: fs5,
|
|
23274
|
+
workspace,
|
|
23202
23275
|
serviceName: name
|
|
23203
23276
|
});
|
|
23204
|
-
|
|
23277
|
+
if (error) {
|
|
23278
|
+
errors.push(error);
|
|
23279
|
+
continue;
|
|
23280
|
+
}
|
|
23281
|
+
if (!framework) {
|
|
23282
|
+
errors.push({
|
|
23283
|
+
code: "MISSING_SERVICE_FRAMEWORK",
|
|
23284
|
+
message: `Service "${name}" uses directory entrypoint "${serviceConfig.entrypoint}" but no framework could be detected in "${workspace}". Specify "framework" explicitly or use a file entrypoint.`,
|
|
23285
|
+
serviceName: name
|
|
23286
|
+
});
|
|
23287
|
+
continue;
|
|
23288
|
+
}
|
|
23289
|
+
resolvedConfig = {
|
|
23290
|
+
...resolvedConfig,
|
|
23291
|
+
framework
|
|
23292
|
+
};
|
|
23293
|
+
} else {
|
|
23294
|
+
const inferredRuntime = (0, import_utils.inferServiceRuntime)({
|
|
23295
|
+
...serviceConfig,
|
|
23296
|
+
entrypoint: resolvedEntrypoint.normalized
|
|
23297
|
+
});
|
|
23298
|
+
if (inferredRuntime) {
|
|
23299
|
+
const inferredWorkspace = await inferWorkspaceFromNearestManifest({
|
|
23300
|
+
fs: fs5,
|
|
23301
|
+
entrypoint: resolvedEntrypoint.normalized,
|
|
23302
|
+
runtime: inferredRuntime
|
|
23303
|
+
});
|
|
23304
|
+
const workspace = inferredWorkspace ?? import_path7.posix.dirname(resolvedEntrypoint.normalized);
|
|
23305
|
+
const detection = await detectFrameworkFromWorkspace({
|
|
23306
|
+
fs: fs5,
|
|
23307
|
+
workspace,
|
|
23308
|
+
serviceName: name,
|
|
23309
|
+
runtime: inferredRuntime
|
|
23310
|
+
});
|
|
23311
|
+
if (detection.framework) {
|
|
23312
|
+
resolvedConfig = {
|
|
23313
|
+
...resolvedConfig,
|
|
23314
|
+
framework: detection.framework
|
|
23315
|
+
};
|
|
23316
|
+
}
|
|
23317
|
+
}
|
|
23205
23318
|
}
|
|
23206
|
-
resolvedConfig = {
|
|
23207
|
-
...serviceConfig,
|
|
23208
|
-
framework
|
|
23209
|
-
};
|
|
23210
23319
|
}
|
|
23211
23320
|
const service = await resolveConfiguredService({
|
|
23212
23321
|
name,
|
|
@@ -23354,6 +23463,9 @@ var require_auto_detect = __commonJS({
|
|
|
23354
23463
|
if (backendResult.error) {
|
|
23355
23464
|
return { services: null, errors: [backendResult.error] };
|
|
23356
23465
|
}
|
|
23466
|
+
if (Object.keys(backendResult.services).length === 0) {
|
|
23467
|
+
return { services: null, errors: [] };
|
|
23468
|
+
}
|
|
23357
23469
|
Object.assign(services, backendResult.services);
|
|
23358
23470
|
return { services, errors: [] };
|
|
23359
23471
|
}
|
|
@@ -23621,11 +23733,42 @@ var require_detect_services = __commonJS({
|
|
|
23621
23733
|
});
|
|
23622
23734
|
}
|
|
23623
23735
|
} else {
|
|
23624
|
-
continue;
|
|
23625
23736
|
}
|
|
23626
23737
|
}
|
|
23738
|
+
const workerServices = services.filter((s) => s.type === "worker");
|
|
23739
|
+
for (const service of workerServices) {
|
|
23740
|
+
const workerEntrypoint = service.entrypoint || service.builder.src || "index";
|
|
23741
|
+
const workerPath = (0, import_utils.getInternalServiceWorkerPath)(
|
|
23742
|
+
service.name,
|
|
23743
|
+
workerEntrypoint
|
|
23744
|
+
);
|
|
23745
|
+
const functionPath = (0, import_utils.getInternalServiceFunctionPath)(service.name);
|
|
23746
|
+
workers.push({
|
|
23747
|
+
src: `^${escapeRegex(workerPath)}$`,
|
|
23748
|
+
dest: functionPath,
|
|
23749
|
+
check: true
|
|
23750
|
+
});
|
|
23751
|
+
}
|
|
23752
|
+
const cronServices = services.filter((s) => s.type === "cron");
|
|
23753
|
+
for (const service of cronServices) {
|
|
23754
|
+
const cronEntrypoint = service.entrypoint || service.builder.src || "index";
|
|
23755
|
+
const cronPath = (0, import_utils.getInternalServiceCronPath)(
|
|
23756
|
+
service.name,
|
|
23757
|
+
cronEntrypoint,
|
|
23758
|
+
service.handlerFunction || "cron"
|
|
23759
|
+
);
|
|
23760
|
+
const functionPath = (0, import_utils.getInternalServiceFunctionPath)(service.name);
|
|
23761
|
+
crons.push({
|
|
23762
|
+
src: `^${escapeRegex(cronPath)}$`,
|
|
23763
|
+
dest: functionPath,
|
|
23764
|
+
check: true
|
|
23765
|
+
});
|
|
23766
|
+
}
|
|
23627
23767
|
return { rewrites, defaults, crons, workers };
|
|
23628
23768
|
}
|
|
23769
|
+
function escapeRegex(str) {
|
|
23770
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
23771
|
+
}
|
|
23629
23772
|
function getWebRoutePrefixes(services) {
|
|
23630
23773
|
const unique = /* @__PURE__ */ new Set();
|
|
23631
23774
|
for (const service of services) {
|
|
@@ -23925,7 +24068,11 @@ var require_get_services_builders = __commonJS({
|
|
|
23925
24068
|
warnings: warningResponses,
|
|
23926
24069
|
defaultRoutes: result.routes.defaults.length > 0 ? result.routes.defaults : null,
|
|
23927
24070
|
redirectRoutes: [],
|
|
23928
|
-
rewriteRoutes: result.routes.rewrites.length > 0
|
|
24071
|
+
rewriteRoutes: result.routes.rewrites.length > 0 || result.routes.workers.length > 0 || result.routes.crons.length > 0 ? [
|
|
24072
|
+
...result.routes.rewrites,
|
|
24073
|
+
...result.routes.workers,
|
|
24074
|
+
...result.routes.crons
|
|
24075
|
+
] : null,
|
|
23929
24076
|
errorRoutes: [],
|
|
23930
24077
|
services: result.services
|
|
23931
24078
|
};
|
|
@@ -32191,7 +32338,11 @@ var require_dist7 = __commonJS({
|
|
|
32191
32338
|
detectOutputDirectory: () => import_detect_builders.detectOutputDirectory,
|
|
32192
32339
|
detectServices: () => import_detect_services.detectServices,
|
|
32193
32340
|
generateServicesRoutes: () => import_detect_services.generateServicesRoutes,
|
|
32341
|
+
getInternalServiceCronPath: () => import_utils.getInternalServiceCronPath,
|
|
32342
|
+
getInternalServiceCronPathPrefix: () => import_utils.getInternalServiceCronPathPrefix,
|
|
32194
32343
|
getInternalServiceFunctionPath: () => import_utils.getInternalServiceFunctionPath,
|
|
32344
|
+
getInternalServiceWorkerPath: () => import_utils.getInternalServiceWorkerPath,
|
|
32345
|
+
getInternalServiceWorkerPathPrefix: () => import_utils.getInternalServiceWorkerPathPrefix,
|
|
32195
32346
|
getProjectPaths: () => import_get_project_paths.getProjectPaths,
|
|
32196
32347
|
getServicesBuilders: () => import_get_services_builders.getServicesBuilders,
|
|
32197
32348
|
getWorkspacePackagePaths: () => import_get_workspace_package_paths.getWorkspacePackagePaths,
|
|
@@ -32264,7 +32415,7 @@ async function readPackageJson(entryPath) {
|
|
|
32264
32415
|
const packagePath = import_path.default.join(entryPath, "package.json");
|
|
32265
32416
|
try {
|
|
32266
32417
|
return JSON.parse(await import_fs.promises.readFile(packagePath, "utf8"));
|
|
32267
|
-
} catch (
|
|
32418
|
+
} catch (_err) {
|
|
32268
32419
|
return {};
|
|
32269
32420
|
}
|
|
32270
32421
|
}
|
|
@@ -32528,7 +32679,7 @@ async function readBuildOutputDirectory2({
|
|
|
32528
32679
|
const project = new import_ts_morph.Project();
|
|
32529
32680
|
const config = (0, import_static_config.getConfig)(project, middleware.file.fsPath);
|
|
32530
32681
|
return config?.regions;
|
|
32531
|
-
} catch (
|
|
32682
|
+
} catch (_err) {
|
|
32532
32683
|
return void 0;
|
|
32533
32684
|
}
|
|
32534
32685
|
})()
|
|
@@ -33126,7 +33277,7 @@ function validateDistDir(distDir, workPath) {
|
|
|
33126
33277
|
try {
|
|
33127
33278
|
const vercelJson = JSON.parse((0, import_fs4.readFileSync)(vercelJsonPath, "utf8"));
|
|
33128
33279
|
buildCommandExists = vercelJson.buildCommand !== void 0;
|
|
33129
|
-
} catch (
|
|
33280
|
+
} catch (_e) {
|
|
33130
33281
|
}
|
|
33131
33282
|
}
|
|
33132
33283
|
let message = `No Output Directory named "${distDirName}" found after the Build completed.`;
|
|
@@ -33602,7 +33753,7 @@ var build = async ({
|
|
|
33602
33753
|
nowDevChildProcesses.add(child);
|
|
33603
33754
|
try {
|
|
33604
33755
|
await checkForPort(devPort, DEV_SERVER_PORT_BIND_TIMEOUT);
|
|
33605
|
-
} catch (
|
|
33756
|
+
} catch (_err) {
|
|
33606
33757
|
throw new Error(
|
|
33607
33758
|
`Failed to detect a server running on port ${devPort}.
|
|
33608
33759
|
Details: https://err.sh/vercel/vercel/now-static-build-failed-to-detect-a-server`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/static-build",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.46",
|
|
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.144",
|
|
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.7.0",
|
|
42
42
|
"@vercel/error-utils": "2.0.3",
|
|
43
|
-
"@vercel/frameworks": "3.
|
|
44
|
-
"@vercel/
|
|
45
|
-
"@vercel/
|
|
43
|
+
"@vercel/frameworks": "3.20.0",
|
|
44
|
+
"@vercel/routing-utils": "6.0.2",
|
|
45
|
+
"@vercel/fs-detectors": "5.9.0"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "node ../../utils/build-builder.mjs",
|