@vercel/static-build 2.9.25 → 2.9.27
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 +110 -27
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -8955,9 +8955,10 @@ var require_frameworks = __commonJS({
|
|
|
8955
8955
|
website: "https://tanstack.com/start",
|
|
8956
8956
|
supersedes: ["ionic-react", "vite"],
|
|
8957
8957
|
detectors: {
|
|
8958
|
-
every: [
|
|
8959
|
-
|
|
8960
|
-
{ matchPackage: "
|
|
8958
|
+
every: [{ matchPackage: "@tanstack/router-plugin" }],
|
|
8959
|
+
some: [
|
|
8960
|
+
{ matchPackage: "@tanstack/react-start" },
|
|
8961
|
+
{ matchPackage: "@tanstack/solid-start" }
|
|
8961
8962
|
]
|
|
8962
8963
|
},
|
|
8963
8964
|
settings: {
|
|
@@ -22856,7 +22857,7 @@ var require_resolve = __commonJS({
|
|
|
22856
22857
|
}
|
|
22857
22858
|
var SERVICE_NAME_REGEX = /^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$/;
|
|
22858
22859
|
var DNS_LABEL_RE = /^(?!-)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;
|
|
22859
|
-
var
|
|
22860
|
+
var ENV_VAR_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
22860
22861
|
var ENTRYPOINT_REQUIRED_RUNTIMES = /* @__PURE__ */ new Set([
|
|
22861
22862
|
"node",
|
|
22862
22863
|
"python",
|
|
@@ -23235,14 +23236,46 @@ var require_resolve = __commonJS({
|
|
|
23235
23236
|
};
|
|
23236
23237
|
}
|
|
23237
23238
|
}
|
|
23238
|
-
if (config.
|
|
23239
|
-
if (
|
|
23239
|
+
if (config.env !== void 0) {
|
|
23240
|
+
if (typeof config.env !== "object" || Array.isArray(config.env)) {
|
|
23240
23241
|
return {
|
|
23241
|
-
code: "
|
|
23242
|
-
message: `Service "${name}" has invalid
|
|
23242
|
+
code: "INVALID_ENV_VARS",
|
|
23243
|
+
message: `Service "${name}" has invalid "env". Must be an object keyed by environment variable name.`,
|
|
23243
23244
|
serviceName: name
|
|
23244
23245
|
};
|
|
23245
23246
|
}
|
|
23247
|
+
for (const [envVarName, envVar] of Object.entries(config.env)) {
|
|
23248
|
+
if (!ENV_VAR_NAME_RE.test(envVarName)) {
|
|
23249
|
+
return {
|
|
23250
|
+
code: "INVALID_ENV_VAR_NAME",
|
|
23251
|
+
message: `Service "${name}" has invalid env key "${envVarName}". Must match /^[A-Za-z_][A-Za-z0-9_]*$/.`,
|
|
23252
|
+
serviceName: name
|
|
23253
|
+
};
|
|
23254
|
+
}
|
|
23255
|
+
if (!envVar || typeof envVar !== "object" || Array.isArray(envVar)) {
|
|
23256
|
+
return {
|
|
23257
|
+
code: "INVALID_ENV_VAR",
|
|
23258
|
+
message: `Service "${name}" has invalid env["${envVarName}"]. Must be an object with a "type" discriminator.`,
|
|
23259
|
+
serviceName: name
|
|
23260
|
+
};
|
|
23261
|
+
}
|
|
23262
|
+
const envVarType = envVar.type;
|
|
23263
|
+
if (envVarType !== "service-ref") {
|
|
23264
|
+
return {
|
|
23265
|
+
code: "INVALID_ENV_VAR_TYPE",
|
|
23266
|
+
message: `Service "${name}" env["${envVarName}"] has unknown type "${envVarType}".`,
|
|
23267
|
+
serviceName: name
|
|
23268
|
+
};
|
|
23269
|
+
}
|
|
23270
|
+
const refService = envVar.service;
|
|
23271
|
+
if (typeof refService !== "string" || refService.length === 0) {
|
|
23272
|
+
return {
|
|
23273
|
+
code: "INVALID_ENV_VAR_REF",
|
|
23274
|
+
message: `Service "${name}" env["${envVarName}"] must specify "service" as a non-empty string.`,
|
|
23275
|
+
serviceName: name
|
|
23276
|
+
};
|
|
23277
|
+
}
|
|
23278
|
+
}
|
|
23246
23279
|
}
|
|
23247
23280
|
if (config.runtime && !(config.runtime in import_types.RUNTIME_BUILDERS)) {
|
|
23248
23281
|
return {
|
|
@@ -23463,10 +23496,11 @@ var require_resolve = __commonJS({
|
|
|
23463
23496
|
runtime,
|
|
23464
23497
|
buildCommand: config.buildCommand,
|
|
23465
23498
|
installCommand: config.installCommand,
|
|
23499
|
+
preDeployCommand: config.preDeployCommand,
|
|
23466
23500
|
schedule: config.schedule,
|
|
23467
23501
|
handlerFunction: moduleAttrParsed?.attrName,
|
|
23468
23502
|
topics,
|
|
23469
|
-
|
|
23503
|
+
env: config.env
|
|
23470
23504
|
};
|
|
23471
23505
|
}
|
|
23472
23506
|
async function resolveAllConfiguredServices(services, fs5, routePrefixSource = "configured", options = {}) {
|
|
@@ -23614,8 +23648,49 @@ var require_resolve = __commonJS({
|
|
|
23614
23648
|
}
|
|
23615
23649
|
resolved.push(service);
|
|
23616
23650
|
}
|
|
23651
|
+
const servicesByName = new Map(resolved.map((s) => [s.name, s]));
|
|
23652
|
+
for (const service of resolved) {
|
|
23653
|
+
if (!service.env)
|
|
23654
|
+
continue;
|
|
23655
|
+
validateEnvRefs(
|
|
23656
|
+
service.env,
|
|
23657
|
+
`Service "${service.name}" env`,
|
|
23658
|
+
servicesByName,
|
|
23659
|
+
errors,
|
|
23660
|
+
service.name
|
|
23661
|
+
);
|
|
23662
|
+
}
|
|
23663
|
+
if (options.rootEnv) {
|
|
23664
|
+
validateEnvRefs(options.rootEnv, "env", servicesByName, errors);
|
|
23665
|
+
for (const service of resolved) {
|
|
23666
|
+
service.env = { ...options.rootEnv, ...service.env ?? {} };
|
|
23667
|
+
}
|
|
23668
|
+
}
|
|
23617
23669
|
return { services: resolved, errors };
|
|
23618
23670
|
}
|
|
23671
|
+
function validateEnvRefs(env, pathPrefix, servicesByName, errors, serviceName) {
|
|
23672
|
+
for (const [envVarName, envVar] of Object.entries(env)) {
|
|
23673
|
+
if (envVar.type !== "service-ref")
|
|
23674
|
+
continue;
|
|
23675
|
+
const refName = envVar.service;
|
|
23676
|
+
const target = servicesByName.get(refName);
|
|
23677
|
+
if (!target) {
|
|
23678
|
+
errors.push({
|
|
23679
|
+
code: "UNKNOWN_SERVICE_REF",
|
|
23680
|
+
message: `${pathPrefix}["${envVarName}"] references unknown service "${refName}".`,
|
|
23681
|
+
...serviceName ? { serviceName } : {}
|
|
23682
|
+
});
|
|
23683
|
+
continue;
|
|
23684
|
+
}
|
|
23685
|
+
if (target.type !== "web") {
|
|
23686
|
+
errors.push({
|
|
23687
|
+
code: "INVALID_SERVICE_REF_TYPE",
|
|
23688
|
+
message: `${pathPrefix}["${envVarName}"] references service "${refName}" which is a ${target.type} service and has no URL. Only web services can be referenced.`,
|
|
23689
|
+
...serviceName ? { serviceName } : {}
|
|
23690
|
+
});
|
|
23691
|
+
}
|
|
23692
|
+
}
|
|
23693
|
+
}
|
|
23619
23694
|
}
|
|
23620
23695
|
});
|
|
23621
23696
|
|
|
@@ -23994,12 +24069,12 @@ var require_detect_railway = __commonJS({
|
|
|
23994
24069
|
if (cf.dirPath !== ".") {
|
|
23995
24070
|
serviceConfig.entrypoint = cf.dirPath;
|
|
23996
24071
|
}
|
|
23997
|
-
|
|
23998
|
-
cf.config.build
|
|
23999
|
-
|
|
24000
|
-
|
|
24001
|
-
if (
|
|
24002
|
-
serviceConfig.
|
|
24072
|
+
if (cf.config.build?.buildCommand) {
|
|
24073
|
+
serviceConfig.buildCommand = cf.config.build.buildCommand;
|
|
24074
|
+
}
|
|
24075
|
+
const railwayPreDeploy = cf.config.deploy?.preDeployCommand;
|
|
24076
|
+
if (railwayPreDeploy) {
|
|
24077
|
+
serviceConfig.preDeployCommand = Array.isArray(railwayPreDeploy) ? railwayPreDeploy.join(" && ") : railwayPreDeploy;
|
|
24003
24078
|
}
|
|
24004
24079
|
services[serviceName] = serviceConfig;
|
|
24005
24080
|
}
|
|
@@ -24096,16 +24171,6 @@ var require_detect_railway = __commonJS({
|
|
|
24096
24171
|
const segments = dirPath.split("/");
|
|
24097
24172
|
return segments[segments.length - 1];
|
|
24098
24173
|
}
|
|
24099
|
-
function combineBuildCommand(buildCommand, preDeployCommand) {
|
|
24100
|
-
const preDeploy = Array.isArray(preDeployCommand) ? preDeployCommand.join(" && ") : preDeployCommand;
|
|
24101
|
-
if (preDeploy && buildCommand) {
|
|
24102
|
-
return `${buildCommand} && ${preDeploy}`;
|
|
24103
|
-
} else if (preDeploy) {
|
|
24104
|
-
return preDeploy;
|
|
24105
|
-
} else {
|
|
24106
|
-
return buildCommand;
|
|
24107
|
-
}
|
|
24108
|
-
}
|
|
24109
24174
|
function assignRoutePrefixes(services) {
|
|
24110
24175
|
const warnings = [];
|
|
24111
24176
|
const names = Object.keys(services);
|
|
@@ -24181,10 +24246,17 @@ var require_detect_services = __commonJS({
|
|
|
24181
24246
|
workers: []
|
|
24182
24247
|
};
|
|
24183
24248
|
}
|
|
24249
|
+
function isEnvVars(env) {
|
|
24250
|
+
if (!env)
|
|
24251
|
+
return false;
|
|
24252
|
+
const first = Object.values(env)[0];
|
|
24253
|
+
return typeof first === "object" && first !== null;
|
|
24254
|
+
}
|
|
24184
24255
|
function withResolvedResult(resolved, inferred = null) {
|
|
24185
24256
|
return {
|
|
24186
24257
|
services: resolved.services,
|
|
24187
24258
|
source: resolved.source,
|
|
24259
|
+
useImplicitEnvInjection: resolved.useImplicitEnvInjection,
|
|
24188
24260
|
routes: resolved.routes,
|
|
24189
24261
|
errors: resolved.errors,
|
|
24190
24262
|
warnings: resolved.warnings,
|
|
@@ -24220,6 +24292,7 @@ var require_detect_services = __commonJS({
|
|
|
24220
24292
|
return withResolvedResult({
|
|
24221
24293
|
services: [],
|
|
24222
24294
|
source: "configured",
|
|
24295
|
+
useImplicitEnvInjection: true,
|
|
24223
24296
|
routes: emptyRoutes(),
|
|
24224
24297
|
errors: [configError],
|
|
24225
24298
|
warnings: []
|
|
@@ -24234,6 +24307,7 @@ var require_detect_services = __commonJS({
|
|
|
24234
24307
|
return withResolvedResult({
|
|
24235
24308
|
services: [],
|
|
24236
24309
|
source: "auto-detected",
|
|
24310
|
+
useImplicitEnvInjection: true,
|
|
24237
24311
|
routes: emptyRoutes(),
|
|
24238
24312
|
errors: railwayResult.errors,
|
|
24239
24313
|
warnings: railwayResult.warnings
|
|
@@ -24255,6 +24329,7 @@ var require_detect_services = __commonJS({
|
|
|
24255
24329
|
{
|
|
24256
24330
|
services: [],
|
|
24257
24331
|
source: "auto-detected",
|
|
24332
|
+
useImplicitEnvInjection: true,
|
|
24258
24333
|
routes: emptyRoutes(),
|
|
24259
24334
|
errors: result2.errors,
|
|
24260
24335
|
warnings: railwayResult.warnings
|
|
@@ -24273,6 +24348,7 @@ var require_detect_services = __commonJS({
|
|
|
24273
24348
|
const resolved = {
|
|
24274
24349
|
services: result2.services,
|
|
24275
24350
|
source: "auto-detected",
|
|
24351
|
+
useImplicitEnvInjection: true,
|
|
24276
24352
|
routes: routes2,
|
|
24277
24353
|
errors: result2.errors,
|
|
24278
24354
|
warnings: []
|
|
@@ -24291,6 +24367,7 @@ var require_detect_services = __commonJS({
|
|
|
24291
24367
|
return withResolvedResult({
|
|
24292
24368
|
services: [],
|
|
24293
24369
|
source: "auto-detected",
|
|
24370
|
+
useImplicitEnvInjection: true,
|
|
24294
24371
|
routes: emptyRoutes(),
|
|
24295
24372
|
errors: autoResult.errors,
|
|
24296
24373
|
warnings: []
|
|
@@ -24299,6 +24376,7 @@ var require_detect_services = __commonJS({
|
|
|
24299
24376
|
return withResolvedResult({
|
|
24300
24377
|
services: [],
|
|
24301
24378
|
source: "auto-detected",
|
|
24379
|
+
useImplicitEnvInjection: true,
|
|
24302
24380
|
routes: emptyRoutes(),
|
|
24303
24381
|
errors: [
|
|
24304
24382
|
{
|
|
@@ -24316,13 +24394,17 @@ var require_detect_services = __commonJS({
|
|
|
24316
24394
|
{
|
|
24317
24395
|
requireFileEntrypointForBackendRuntimes: Boolean(
|
|
24318
24396
|
hasNonEmptyPublicServicesConfig
|
|
24319
|
-
)
|
|
24397
|
+
),
|
|
24398
|
+
rootEnv: isEnvVars(vercelConfig?.env) ? vercelConfig?.env : void 0
|
|
24320
24399
|
}
|
|
24321
24400
|
);
|
|
24322
24401
|
const routes = generateServicesRoutes2(result.services);
|
|
24323
24402
|
return withResolvedResult({
|
|
24324
24403
|
services: result.services,
|
|
24325
24404
|
source: "configured",
|
|
24405
|
+
// GA `services` opts into explicit `env`; experimentalServices keeps
|
|
24406
|
+
// the legacy `{NAME}_URL` injection.
|
|
24407
|
+
useImplicitEnvInjection: !hasNonEmptyPublicServicesConfig,
|
|
24326
24408
|
routes,
|
|
24327
24409
|
errors: result.errors,
|
|
24328
24410
|
warnings: []
|
|
@@ -24772,7 +24854,8 @@ var require_get_services_builders = __commonJS({
|
|
|
24772
24854
|
...result.routes.crons
|
|
24773
24855
|
] : null,
|
|
24774
24856
|
errorRoutes: [],
|
|
24775
|
-
services: result.services
|
|
24857
|
+
services: result.services,
|
|
24858
|
+
useImplicitEnvInjection: result.useImplicitEnvInjection
|
|
24776
24859
|
};
|
|
24777
24860
|
}
|
|
24778
24861
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/static-build",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.27",
|
|
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-builder": "2.2.3",
|
|
18
17
|
"@vercel/gatsby-plugin-vercel-analytics": "1.0.11",
|
|
19
|
-
"@vercel/static-config": "3.3.0"
|
|
18
|
+
"@vercel/static-config": "3.3.0",
|
|
19
|
+
"@vercel/gatsby-plugin-vercel-builder": "2.2.5"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/aws-lambda": "8.10.64",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"semver": "7.5.2",
|
|
38
38
|
"tree-kill": "1.2.2",
|
|
39
39
|
"vitest": "2.0.3",
|
|
40
|
-
"@vercel/build-utils": "13.23.0",
|
|
41
40
|
"@vercel/error-utils": "2.1.0",
|
|
42
|
-
"@vercel/frameworks": "3.26.
|
|
43
|
-
"@vercel/
|
|
44
|
-
"@vercel/routing-utils": "6.2.0"
|
|
41
|
+
"@vercel/frameworks": "3.26.1",
|
|
42
|
+
"@vercel/build-utils": "13.25.0",
|
|
43
|
+
"@vercel/routing-utils": "6.2.0",
|
|
44
|
+
"@vercel/fs-detectors": "6.4.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "node ../../utils/build-builder.mjs",
|