vercel 59.5.0 → 59.6.2
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/chunks/{add-W3FFMTX4.js → add-4GQZ22ZN.js} +11 -11
- package/dist/chunks/{add-MH3WV6PV.js → add-HJSEM4YJ.js} +11 -11
- package/dist/chunks/{add-Z5FM6TFI.js → add-SIGUSM3Y.js} +12 -12
- package/dist/chunks/{build-VYYFBJL7.js → build-XOMJDX4M.js} +11 -11
- package/dist/chunks/{chunk-NSU2BTRS.js → chunk-2O5J3KMT.js} +4 -4
- package/dist/chunks/{chunk-RZ5NP6HN.js → chunk-2YRAWYGE.js} +1 -1
- package/dist/chunks/{chunk-JNU3DTEV.js → chunk-37V5P4VO.js} +9 -9
- package/dist/chunks/{chunk-LLM3ZNXJ.js → chunk-3F5EGINT.js} +2 -2
- package/dist/chunks/{chunk-KQRVZWJU.js → chunk-3T7WSWZH.js} +1 -1
- package/dist/chunks/{chunk-R6IGDGX3.js → chunk-5XECIWME.js} +1 -1
- package/dist/chunks/{chunk-AWSLWAOC.js → chunk-6JPVTPTU.js} +3 -3
- package/dist/chunks/{chunk-M3OSDZPY.js → chunk-6M2KZUED.js} +16 -7
- package/dist/chunks/{chunk-HT2XWSAJ.js → chunk-7AEEQOD4.js} +2 -29
- package/dist/chunks/{chunk-QG4PCM45.js → chunk-7HE63HCR.js} +102 -15
- package/dist/chunks/{chunk-V4YLY44R.js → chunk-7R6M3BHM.js} +2 -2
- package/dist/chunks/{chunk-XBN2O34P.js → chunk-7ST552E3.js} +17 -4
- package/dist/chunks/{chunk-CV4S27SS.js → chunk-ASBP32T6.js} +1 -1
- package/dist/chunks/{chunk-CQJRLNTX.js → chunk-AYLY3ZVL.js} +2 -2
- package/dist/chunks/{chunk-AWCID36T.js → chunk-BMKU5KEL.js} +1 -1
- package/dist/chunks/{chunk-UUVMIXT4.js → chunk-DE7MBNHQ.js} +4 -4
- package/dist/chunks/{chunk-YIHOS3ZF.js → chunk-FRAXI2WT.js} +1 -1
- package/dist/chunks/{chunk-FA3MO56Q.js → chunk-FRZULOVH.js} +5 -5
- package/dist/chunks/{chunk-7XX4ZEOV.js → chunk-FWKSJYDV.js} +1 -1
- package/dist/chunks/{chunk-OHER4DGX.js → chunk-FXD67VN5.js} +25 -9
- package/dist/chunks/{chunk-TIWAL2YU.js → chunk-GISTGGBO.js} +6 -6
- package/dist/chunks/{chunk-CSCSGSQG.js → chunk-GZQQNLF5.js} +5 -5
- package/dist/chunks/{chunk-PIMIKY4X.js → chunk-IJ4X426J.js} +1 -1
- package/dist/chunks/{chunk-TDXNNIZ6.js → chunk-JH4WQRIU.js} +2 -2
- package/dist/chunks/{chunk-TVXCXIRO.js → chunk-L3UXB2CW.js} +1 -1
- package/dist/chunks/{chunk-4JTF6RD7.js → chunk-LXZVOR6F.js} +4 -4
- package/dist/chunks/{chunk-L7CEMAJG.js → chunk-NGGLYKNU.js} +27 -5
- package/dist/chunks/{chunk-VWYNSJXI.js → chunk-NGNN6WF2.js} +8 -8
- package/dist/chunks/{chunk-GGPE5377.js → chunk-O26N2UPI.js} +1 -1
- package/dist/chunks/{chunk-5LX2JDZP.js → chunk-O75LSD3C.js} +1 -1
- package/dist/chunks/{chunk-MRMNMFMD.js → chunk-PRH6KRUT.js} +1 -1
- package/dist/chunks/{chunk-OX7KI3LF.js → chunk-QFAS4OVW.js} +18 -0
- package/dist/chunks/{chunk-PBHBX6UL.js → chunk-R5PULMHT.js} +3 -3
- package/dist/chunks/{chunk-PPUWG2UB.js → chunk-SF3AYAIF.js} +58 -25
- package/dist/chunks/{chunk-TAZ5ZAKG.js → chunk-SWI6F4X3.js} +2 -2
- package/dist/chunks/{chunk-ZKUHCL6O.js → chunk-V3MDDR2X.js} +5 -5
- package/dist/chunks/{chunk-E6LFKMI2.js → chunk-VJ5NAOWB.js} +791 -122
- package/dist/chunks/{chunk-G75NFPIT.js → chunk-WNAKOXGK.js} +1 -1
- package/dist/chunks/{chunk-JJQP3PYM.js → chunk-WZ2S3A2A.js} +5 -5
- package/dist/chunks/{chunk-CYNB6LL4.js → chunk-XNFHNTS2.js} +1 -1
- package/dist/chunks/{chunk-47VQ6H2S.js → chunk-YJKZQEHS.js} +2 -2
- package/dist/chunks/{chunk-GUWPUX2Y.js → chunk-ZNMTDLYH.js} +4 -4
- package/dist/chunks/{chunk-VLPLCJZC.js → chunk-ZSFEACZU.js} +1 -1
- package/dist/chunks/{clear-TNGRDA7D.js → clear-BWT2FJY4.js} +11 -11
- package/dist/chunks/{compile-vercel-config-ERLXKKWW.js → compile-vercel-config-DGM4NISW.js} +7 -7
- package/dist/chunks/{config-H22EE765.js → config-NJAN3RMU.js} +11 -11
- package/dist/chunks/{config-7EDKML5Q.js → config-RSE6Z4LB.js} +9 -9
- package/dist/chunks/{constants-YMCRE6IG.js → constants-WEQVJSYS.js} +1 -1
- package/dist/chunks/{delete-Q4S5F2AI.js → delete-LROBRBAH.js} +9 -9
- package/dist/chunks/{delete-LORYIZHY.js → delete-SSL2PK2F.js} +8 -8
- package/dist/chunks/{disable-HKWCBDJC.js → disable-ASG5JDZR.js} +8 -8
- package/dist/chunks/{discard-UCCRF2JQ.js → discard-PV47B6IL.js} +8 -8
- package/dist/chunks/{edit-AWL35PYQ.js → edit-5ATYIOLX.js} +10 -10
- package/dist/chunks/{edit-6IM6VRBR.js → edit-REI7HXGG.js} +10 -10
- package/dist/chunks/{enable-GN3D3L3V.js → enable-LZXL7XAG.js} +8 -8
- package/dist/chunks/{exec-CNBOV577.js → exec-XH4K34JM.js} +3 -3
- package/dist/chunks/{export-HHRVFALV.js → export-ZAZFQU2E.js} +8 -8
- package/dist/chunks/{image-4DCU4VPP.js → image-QPHN5V7L.js} +6 -6
- package/dist/chunks/{import-builders-DVG3HOTF.js → import-builders-W3YE2V6A.js} +9 -9
- package/dist/chunks/{inspect-TUW67CFZ.js → inspect-BFGK72WY.js} +10 -10
- package/dist/chunks/{inspect-TGOJDKIT.js → inspect-FRXJRM6T.js} +9 -9
- package/dist/chunks/{inspect-B3OWUFLH.js → inspect-RDMC2Z3Q.js} +11 -11
- package/dist/chunks/{inspect-VPME6UC7.js → inspect-SJEZVGPK.js} +11 -11
- package/dist/chunks/{inspect-VLGKNHJW.js → inspect-SSOM3FXS.js} +11 -11
- package/dist/chunks/{list-K552ITMK.js → list-2HTR7Q3J.js} +9 -9
- package/dist/chunks/{list-TK2JO7BK.js → list-PHDUZVMR.js} +8 -8
- package/dist/chunks/{list-2DPKDHRV.js → list-W33GXKDA.js} +10 -10
- package/dist/chunks/{login-HRWEKW5P.js → login-JWAFHVDG.js} +21 -12
- package/dist/chunks/{ls-M5TYGFP5.js → ls-3AN2DZHN.js} +11 -11
- package/dist/chunks/{ls-YIF3KLF3.js → ls-3MH2OCP3.js} +11 -11
- package/dist/chunks/{ls-TM6NTZEB.js → ls-D2POUHI7.js} +9 -9
- package/dist/chunks/{ls-JSV2WZVF.js → ls-KDFU224B.js} +11 -11
- package/dist/chunks/{ls-IOXGXEY4.js → ls-KX2VBOGV.js} +10 -10
- package/dist/chunks/{ls-O2WYF5UL.js → ls-RWKNJQNT.js} +11 -11
- package/dist/chunks/{open-FWAVEWGU.js → open-IEYRB6RL.js} +9 -9
- package/dist/chunks/{permissions-DPFYL47Z.js → permissions-ZWZUMEHR.js} +7 -7
- package/dist/chunks/{publish-63CGFKQR.js → publish-UWZYBDHK.js} +8 -8
- package/dist/chunks/{push-T5ZTBW3P.js → push-IAEQ3FBF.js} +11 -11
- package/dist/chunks/{query-B6O3EMEV.js → query-NNOZYSED.js} +11 -11
- package/dist/chunks/{reorder-ANV4NMKH.js → reorder-TKBM244W.js} +8 -8
- package/dist/chunks/{reply-C73KGOCG.js → reply-FLBSBMTW.js} +10 -10
- package/dist/chunks/{resolve-IHSIVPEE.js → resolve-GJYPMWUE.js} +9 -9
- package/dist/chunks/{restore-GSUNXP2O.js → restore-PNI3TM3U.js} +8 -8
- package/dist/chunks/{rm-4O74PS4Q.js → rm-76CSSSSV.js} +11 -11
- package/dist/chunks/{rm-M7IJC2WZ.js → rm-FN7LTIIL.js} +11 -11
- package/dist/chunks/{rm-YDTK5ESZ.js → rm-FTE33UHE.js} +10 -10
- package/dist/chunks/{rm-RV5SQFQA.js → rm-FXA5DLXQ.js} +11 -13
- package/dist/chunks/{rm-PRINF4OU.js → rm-PGJ4KR6U.js} +11 -11
- package/dist/chunks/{routes-SZI2G4SE.js → routes-2OLIBRYX.js} +3 -3
- package/dist/chunks/{rule-inspect-ZZC53FLP.js → rule-inspect-LJIGPTWS.js} +10 -10
- package/dist/chunks/{rules-SAOSSGFI.js → rules-6BMNO6M5.js} +10 -10
- package/dist/chunks/{schema-23ZFAKDU.js → schema-45SJNY5L.js} +4 -4
- package/dist/chunks/{schema-2Q3QRMRO.js → schema-HATXEQDP.js} +9 -9
- package/dist/chunks/{set-L47ZCZBJ.js → set-C3UQUQ42.js} +9 -9
- package/dist/chunks/{tags-2TWLM77N.js → tags-BTVDROFG.js} +5 -5
- package/dist/chunks/{types-G3PEUIJH.js → types-JGANJ5EQ.js} +3 -3
- package/dist/chunks/{update-SZH2VBD6.js → update-B6PSOHUW.js} +12 -12
- package/dist/commands/build/builder-worker.cjs +281 -0
- package/dist/commands/build/index.js +690 -235
- package/dist/commands/deploy/index.js +103 -31
- package/dist/commands/dev/index.js +669 -140
- package/dist/commands/env/index.js +1167 -542
- package/dist/commands/link/index.js +10 -10
- package/dist/commands/list/index.js +10 -10
- package/dist/commands-bulk.js +1978 -953
- package/dist/index.js +18 -18
- package/dist/version.mjs +1 -1
- package/package.json +47 -47
- package/dist/chunks/chunk-HGRWPPYB.js +0 -18
|
@@ -11,33 +11,33 @@ import {
|
|
|
11
11
|
require_service_schedules,
|
|
12
12
|
require_write_build_result,
|
|
13
13
|
writeBuildResult
|
|
14
|
-
} from "../../chunks/chunk-
|
|
14
|
+
} from "../../chunks/chunk-SWI6F4X3.js";
|
|
15
15
|
import {
|
|
16
16
|
importBuilders,
|
|
17
17
|
import_import_builders
|
|
18
|
-
} from "../../chunks/chunk-
|
|
18
|
+
} from "../../chunks/chunk-WZ2S3A2A.js";
|
|
19
19
|
import {
|
|
20
20
|
js_yaml_default,
|
|
21
21
|
pullCommandLogic
|
|
22
|
-
} from "../../chunks/chunk-
|
|
22
|
+
} from "../../chunks/chunk-NGNN6WF2.js";
|
|
23
23
|
import {
|
|
24
24
|
require_semver
|
|
25
25
|
} from "../../chunks/chunk-IB5L4LKZ.js";
|
|
26
26
|
import {
|
|
27
27
|
readProjectSettings
|
|
28
|
-
} from "../../chunks/chunk-
|
|
29
|
-
import "../../chunks/chunk-
|
|
30
|
-
import "../../chunks/chunk-
|
|
28
|
+
} from "../../chunks/chunk-JH4WQRIU.js";
|
|
29
|
+
import "../../chunks/chunk-7AEEQOD4.js";
|
|
30
|
+
import "../../chunks/chunk-5XECIWME.js";
|
|
31
31
|
import {
|
|
32
32
|
stamp_default
|
|
33
33
|
} from "../../chunks/chunk-64IF634X.js";
|
|
34
34
|
import "../../chunks/chunk-VXYGCOKL.js";
|
|
35
35
|
import {
|
|
36
36
|
buildCommand
|
|
37
|
-
} from "../../chunks/chunk-
|
|
37
|
+
} from "../../chunks/chunk-FWKSJYDV.js";
|
|
38
38
|
import {
|
|
39
39
|
help
|
|
40
|
-
} from "../../chunks/chunk-
|
|
40
|
+
} from "../../chunks/chunk-2YRAWYGE.js";
|
|
41
41
|
import {
|
|
42
42
|
DEFAULT_VERCEL_CONFIG_FILENAME,
|
|
43
43
|
VERCEL_DIR,
|
|
@@ -63,28 +63,28 @@ import {
|
|
|
63
63
|
resolveProjectCwd,
|
|
64
64
|
ua_default,
|
|
65
65
|
validateConfig
|
|
66
|
-
} from "../../chunks/chunk-
|
|
67
|
-
import "../../chunks/chunk-
|
|
66
|
+
} from "../../chunks/chunk-VJ5NAOWB.js";
|
|
67
|
+
import "../../chunks/chunk-FXD67VN5.js";
|
|
68
68
|
import {
|
|
69
69
|
TelemetryClient
|
|
70
|
-
} from "../../chunks/chunk-
|
|
70
|
+
} from "../../chunks/chunk-XNFHNTS2.js";
|
|
71
71
|
import {
|
|
72
72
|
AGENT_REASON,
|
|
73
73
|
AGENT_STATUS,
|
|
74
74
|
outputAgentError
|
|
75
|
-
} from "../../chunks/chunk-
|
|
75
|
+
} from "../../chunks/chunk-NGGLYKNU.js";
|
|
76
76
|
import "../../chunks/chunk-GGP5R3FU.js";
|
|
77
77
|
import {
|
|
78
78
|
printError,
|
|
79
79
|
toEnumerableError
|
|
80
|
-
} from "../../chunks/chunk-
|
|
80
|
+
} from "../../chunks/chunk-AYLY3ZVL.js";
|
|
81
81
|
import {
|
|
82
82
|
parseArguments
|
|
83
83
|
} from "../../chunks/chunk-57RHXXXG.js";
|
|
84
84
|
import "../../chunks/chunk-RKDCNQ4S.js";
|
|
85
85
|
import {
|
|
86
86
|
CantParseJSONFile
|
|
87
|
-
} from "../../chunks/chunk-
|
|
87
|
+
} from "../../chunks/chunk-BMKU5KEL.js";
|
|
88
88
|
import {
|
|
89
89
|
cmd,
|
|
90
90
|
getCommandName,
|
|
@@ -102,7 +102,7 @@ import {
|
|
|
102
102
|
emoji,
|
|
103
103
|
output_manager_default,
|
|
104
104
|
prependEmoji
|
|
105
|
-
} from "../../chunks/chunk-
|
|
105
|
+
} from "../../chunks/chunk-QFAS4OVW.js";
|
|
106
106
|
import {
|
|
107
107
|
require_source
|
|
108
108
|
} from "../../chunks/chunk-S7KYDPEM.js";
|
|
@@ -112,6 +112,57 @@ import {
|
|
|
112
112
|
__toESM
|
|
113
113
|
} from "../../chunks/chunk-TZ2YI2VH.js";
|
|
114
114
|
|
|
115
|
+
// ../../internals/cli-builder-integration/dist/build-runner.js
|
|
116
|
+
var require_build_runner = __commonJS({
|
|
117
|
+
"../../internals/cli-builder-integration/dist/build-runner.js"(exports, module) {
|
|
118
|
+
"use strict";
|
|
119
|
+
var __defProp = Object.defineProperty;
|
|
120
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
121
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
122
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
123
|
+
var __export = (target, all) => {
|
|
124
|
+
for (var name in all)
|
|
125
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
126
|
+
};
|
|
127
|
+
var __copyProps = (to, from, except, desc) => {
|
|
128
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
129
|
+
for (let key of __getOwnPropNames(from))
|
|
130
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
131
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
132
|
+
}
|
|
133
|
+
return to;
|
|
134
|
+
};
|
|
135
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
136
|
+
var build_runner_exports = {};
|
|
137
|
+
__export(build_runner_exports, {
|
|
138
|
+
BuildRunner: () => BuildRunner3,
|
|
139
|
+
InprocessBuildRunner: () => InprocessBuildRunner2
|
|
140
|
+
});
|
|
141
|
+
module.exports = __toCommonJS(build_runner_exports);
|
|
142
|
+
var BuildRunner3 = class {
|
|
143
|
+
constructor(ctx) {
|
|
144
|
+
this.ctx = ctx;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
var InprocessBuildRunner2 = class extends BuildRunner3 {
|
|
148
|
+
constructor(ctx, builder) {
|
|
149
|
+
super(ctx);
|
|
150
|
+
this.builder = builder;
|
|
151
|
+
}
|
|
152
|
+
async build() {
|
|
153
|
+
return await this.builder.build(this.ctx.buildOptions);
|
|
154
|
+
}
|
|
155
|
+
async diagnostics() {
|
|
156
|
+
return await this.ctx.builderSpan.child("vc.builder.diagnostics").trace(
|
|
157
|
+
async () => await this.builder.diagnostics?.(this.ctx.buildOptions)
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
teardown() {
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
115
166
|
// ../../internals/builder-orchestration/dist/sort-builders.js
|
|
116
167
|
var require_sort_builders = __commonJS({
|
|
117
168
|
"../../internals/builder-orchestration/dist/sort-builders.js"(exports, module) {
|
|
@@ -183,16 +234,28 @@ var require_execute_builder = __commonJS({
|
|
|
183
234
|
});
|
|
184
235
|
module.exports = __toCommonJS(execute_builder_exports);
|
|
185
236
|
var import_sort_builders = require_sort_builders();
|
|
237
|
+
var import_build_runner2 = require_build_runner();
|
|
186
238
|
async function executeBuilder2({
|
|
187
239
|
builder,
|
|
188
240
|
buildOptions,
|
|
189
241
|
span,
|
|
190
242
|
isFrontendBuilder,
|
|
191
243
|
hasDetectedServices,
|
|
192
|
-
framework
|
|
244
|
+
framework,
|
|
245
|
+
runner
|
|
193
246
|
}) {
|
|
194
|
-
const
|
|
195
|
-
|
|
247
|
+
const buildRunner = runner ?? new import_build_runner2.InprocessBuildRunner(
|
|
248
|
+
{
|
|
249
|
+
requirePath: "",
|
|
250
|
+
buildOptions,
|
|
251
|
+
cwd: buildOptions.workPath,
|
|
252
|
+
expectsPreDeploy: false,
|
|
253
|
+
builderSpan: span
|
|
254
|
+
},
|
|
255
|
+
builder
|
|
256
|
+
);
|
|
257
|
+
const rawBuildResult = await span.trace(() => buildRunner.build());
|
|
258
|
+
const buildResult = builder.version === -1 && "resultVersion" in rawBuildResult ? rawBuildResult.result : rawBuildResult;
|
|
196
259
|
if (!hasDetectedServices && buildOptions.config.zeroConfig && isFrontendBuilder && "output" in buildResult && !buildResult.routes && framework) {
|
|
197
260
|
buildResult.routes = await getFrameworkRoutes(
|
|
198
261
|
framework,
|
|
@@ -238,7 +301,7 @@ var require_backend_rewrite_warning = __commonJS({
|
|
|
238
301
|
hasBackendRewriteBehaviorChange: () => hasBackendRewriteBehaviorChange
|
|
239
302
|
});
|
|
240
303
|
module.exports = __toCommonJS(backend_rewrite_warning_exports);
|
|
241
|
-
var
|
|
304
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
242
305
|
var BACKEND_REWRITE_BEHAVIOR_WARNING = "Internal rewrites in backend framework projects now route requests using the rewritten destination path. This behavior was previously unsupported and may change which application route handles a request. Review your rewrite configuration to ensure this behavior is expected.";
|
|
243
306
|
function hasInternalPathRewrite(rewrites) {
|
|
244
307
|
return rewrites?.some(
|
|
@@ -246,7 +309,7 @@ var require_backend_rewrite_warning = __commonJS({
|
|
|
246
309
|
) ?? false;
|
|
247
310
|
}
|
|
248
311
|
function isAffectedFramework(framework) {
|
|
249
|
-
return framework === "go" || framework === "container" || (0,
|
|
312
|
+
return framework === "go" || framework === "container" || (0, import_build_utils3.isPythonFramework)(framework) || (0, import_build_utils3.isNodeBackendFramework)(framework);
|
|
250
313
|
}
|
|
251
314
|
function hasBackendRewriteBehaviorChange({
|
|
252
315
|
projectRewrites,
|
|
@@ -350,13 +413,13 @@ var require_validate_cron_secret = __commonJS({
|
|
|
350
413
|
validateCronSecret: () => validateCronSecret
|
|
351
414
|
});
|
|
352
415
|
module.exports = __toCommonJS(validate_cron_secret_exports);
|
|
353
|
-
var
|
|
416
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
354
417
|
function validateCronSecret(cronSecret) {
|
|
355
418
|
if (!cronSecret) {
|
|
356
419
|
return null;
|
|
357
420
|
}
|
|
358
421
|
if (cronSecret !== cronSecret.trim()) {
|
|
359
|
-
return new
|
|
422
|
+
return new import_build_utils3.NowBuildError({
|
|
360
423
|
code: "INVALID_CRON_SECRET",
|
|
361
424
|
message: "The `CRON_SECRET` environment variable contains leading or trailing whitespace, which is not allowed in HTTP header values.",
|
|
362
425
|
link: "https://vercel.link/securing-cron-jobs",
|
|
@@ -388,7 +451,7 @@ var require_validate_cron_secret = __commonJS({
|
|
|
388
451
|
});
|
|
389
452
|
const moreCount = invalidChars.length - 3;
|
|
390
453
|
const moreText = moreCount > 0 ? `, and ${moreCount} more` : "";
|
|
391
|
-
return new
|
|
454
|
+
return new import_build_utils3.NowBuildError({
|
|
392
455
|
code: "INVALID_CRON_SECRET",
|
|
393
456
|
message: `The \`CRON_SECRET\` environment variable contains characters that are not valid in HTTP headers: ${descriptions.join(", ")}${moreText}. Only visible ASCII characters (letters, digits, symbols), spaces, and tabs are allowed.`,
|
|
394
457
|
link: "https://vercel.link/securing-cron-jobs",
|
|
@@ -437,9 +500,9 @@ var require_validate_package_manifest = __commonJS({
|
|
|
437
500
|
});
|
|
438
501
|
module.exports = __toCommonJS(validate_package_manifest_exports);
|
|
439
502
|
var import_ajv = __toESM2(require_ajv());
|
|
440
|
-
var
|
|
503
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
441
504
|
var ajv = new import_ajv.default();
|
|
442
|
-
var validate = ajv.compile(
|
|
505
|
+
var validate = ajv.compile(import_build_utils3.packageManifestSchema);
|
|
443
506
|
function validatePackageManifest(data) {
|
|
444
507
|
if (validate(data)) {
|
|
445
508
|
return null;
|
|
@@ -477,7 +540,7 @@ var require_manifest = __commonJS({
|
|
|
477
540
|
});
|
|
478
541
|
module.exports = __toCommonJS(manifest_exports);
|
|
479
542
|
var import_path2 = __require("path");
|
|
480
|
-
var
|
|
543
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
481
544
|
async function writeManifests(packageManifests, diagnostics, ops, outputDir) {
|
|
482
545
|
if (packageManifests.length === 0)
|
|
483
546
|
return;
|
|
@@ -499,8 +562,8 @@ var require_manifest = __commonJS({
|
|
|
499
562
|
builder: builderUse,
|
|
500
563
|
framework,
|
|
501
564
|
serviceName: service?.name,
|
|
502
|
-
serviceType: service && (0,
|
|
503
|
-
routePrefix: service && (0,
|
|
565
|
+
serviceType: service && (0, import_build_utils3.isExperimentalService)(service) ? service.type : void 0,
|
|
566
|
+
routePrefix: service && (0, import_build_utils3.isExperimentalService)(service) ? service.routePrefix : void 0
|
|
504
567
|
};
|
|
505
568
|
const { version: _version, ...manifestWithoutVersion } = manifest;
|
|
506
569
|
deployManifestBuilds[key] = {
|
|
@@ -516,19 +579,19 @@ var require_manifest = __commonJS({
|
|
|
516
579
|
} else {
|
|
517
580
|
deployManifestServices[service.name] = {
|
|
518
581
|
builds: [key],
|
|
519
|
-
bindings: (0,
|
|
582
|
+
bindings: (0, import_build_utils3.isExperimentalServiceV2)(service) ? service.bindings : void 0
|
|
520
583
|
};
|
|
521
584
|
}
|
|
522
585
|
}
|
|
523
586
|
}
|
|
524
587
|
if (Object.keys(projectManifest).length === 0)
|
|
525
588
|
return;
|
|
526
|
-
const projectManifestBlob = new
|
|
589
|
+
const projectManifestBlob = new import_build_utils3.FileBlob({
|
|
527
590
|
data: JSON.stringify(projectManifest)
|
|
528
591
|
});
|
|
529
592
|
diagnostics["project-manifest.json"] = projectManifestBlob;
|
|
530
593
|
ops.push(
|
|
531
|
-
(0,
|
|
594
|
+
(0, import_build_utils3.downloadFile)(
|
|
532
595
|
projectManifestBlob,
|
|
533
596
|
(0, import_path2.join)(outputDir, "diagnostics", "project-manifest.json")
|
|
534
597
|
).then(
|
|
@@ -536,7 +599,7 @@ var require_manifest = __commonJS({
|
|
|
536
599
|
(err) => err
|
|
537
600
|
)
|
|
538
601
|
);
|
|
539
|
-
const deployManifestBlob = new
|
|
602
|
+
const deployManifestBlob = new import_build_utils3.FileBlob({
|
|
540
603
|
data: JSON.stringify({
|
|
541
604
|
manifestVersion: "2.0",
|
|
542
605
|
builds: deployManifestBuilds,
|
|
@@ -545,7 +608,7 @@ var require_manifest = __commonJS({
|
|
|
545
608
|
});
|
|
546
609
|
diagnostics["deploy-manifest.json"] = deployManifestBlob;
|
|
547
610
|
ops.push(
|
|
548
|
-
(0,
|
|
611
|
+
(0, import_build_utils3.downloadFile)(
|
|
549
612
|
deployManifestBlob,
|
|
550
613
|
(0, import_path2.join)(outputDir, "diagnostics", "deploy-manifest.json")
|
|
551
614
|
).then(
|
|
@@ -583,7 +646,7 @@ var require_build_embedding = __commonJS({
|
|
|
583
646
|
shouldEmbedFlagsDefinitions: () => shouldEmbedFlagsDefinitions
|
|
584
647
|
});
|
|
585
648
|
module.exports = __toCommonJS(build_embedding_exports);
|
|
586
|
-
var
|
|
649
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
587
650
|
function isFlagsEmbedOption(input) {
|
|
588
651
|
return input === "force-on" || input === "force-off";
|
|
589
652
|
}
|
|
@@ -605,8 +668,8 @@ var require_build_embedding = __commonJS({
|
|
|
605
668
|
if (envHasSdkKey()) {
|
|
606
669
|
return true;
|
|
607
670
|
}
|
|
608
|
-
const hasVercelFlags = await (0,
|
|
609
|
-
const hasFlagsCore = await (0,
|
|
671
|
+
const hasVercelFlags = await (0, import_build_utils3.isPackageInstalled)("@flags-sdk/vercel", cwd);
|
|
672
|
+
const hasFlagsCore = await (0, import_build_utils3.isPackageInstalled)("@vercel/flags-core", cwd);
|
|
610
673
|
if (hasVercelFlags || hasFlagsCore) {
|
|
611
674
|
return true;
|
|
612
675
|
}
|
|
@@ -654,49 +717,86 @@ var require_validate_build_output = __commonJS({
|
|
|
654
717
|
module.exports = __toCommonJS(validate_build_output_exports);
|
|
655
718
|
var import_fs_extra2 = __toESM2(require_lib());
|
|
656
719
|
var import_path2 = __require("path");
|
|
657
|
-
var
|
|
720
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
658
721
|
function logDebug(message, output) {
|
|
659
722
|
output?.debug(message);
|
|
660
|
-
(0,
|
|
723
|
+
(0, import_build_utils3.debug)(message);
|
|
724
|
+
}
|
|
725
|
+
async function validateOutputConfig(configPath, label, problems) {
|
|
726
|
+
const configExists = await import_fs_extra2.default.pathExists(configPath);
|
|
727
|
+
if (!configExists) {
|
|
728
|
+
problems.push({
|
|
729
|
+
severity: "error",
|
|
730
|
+
message: `${label} is missing config.json.`
|
|
731
|
+
});
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
let config;
|
|
735
|
+
try {
|
|
736
|
+
config = await import_fs_extra2.default.readJSON(configPath);
|
|
737
|
+
} catch (err) {
|
|
738
|
+
problems.push({
|
|
739
|
+
severity: "error",
|
|
740
|
+
message: `${label} config.json is not valid JSON: ${err instanceof Error ? err.message : String(err)}.`
|
|
741
|
+
});
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
if (config && config.version !== 3) {
|
|
745
|
+
problems.push({
|
|
746
|
+
severity: "warning",
|
|
747
|
+
message: `${label} config.json has unexpected version "${config.version}" (expected 3).`
|
|
748
|
+
});
|
|
749
|
+
}
|
|
661
750
|
}
|
|
662
751
|
async function validateBuildOutput(outputDir, output) {
|
|
663
752
|
const problems = [];
|
|
664
753
|
logDebug(`Validating build output at "${outputDir}"`, output);
|
|
665
754
|
try {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
problems
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
severity: "error",
|
|
680
|
-
message: `Build output config.json is not valid JSON: ${err instanceof Error ? err.message : String(err)}.`
|
|
681
|
-
});
|
|
682
|
-
}
|
|
683
|
-
if (config && config.version !== 3) {
|
|
684
|
-
problems.push({
|
|
685
|
-
severity: "warning",
|
|
686
|
-
message: `Build output config.json has unexpected version "${config.version}" (expected 3).`
|
|
687
|
-
});
|
|
755
|
+
await validateOutputConfig(
|
|
756
|
+
(0, import_path2.join)(outputDir, "config.json"),
|
|
757
|
+
"Build output",
|
|
758
|
+
problems
|
|
759
|
+
);
|
|
760
|
+
const servicesDir = (0, import_path2.join)(outputDir, "services");
|
|
761
|
+
let serviceNames = [];
|
|
762
|
+
try {
|
|
763
|
+
const entries = await import_fs_extra2.default.readdir(servicesDir, { withFileTypes: true });
|
|
764
|
+
serviceNames = entries.filter((e) => e.isDirectory()).map((e) => e.name);
|
|
765
|
+
} catch (err) {
|
|
766
|
+
if (err?.code !== "ENOENT") {
|
|
767
|
+
throw err;
|
|
688
768
|
}
|
|
689
769
|
}
|
|
690
770
|
const [hasFunctions, hasStatic] = await Promise.all([
|
|
691
771
|
import_fs_extra2.default.pathExists((0, import_path2.join)(outputDir, "functions")),
|
|
692
772
|
import_fs_extra2.default.pathExists((0, import_path2.join)(outputDir, "static"))
|
|
693
773
|
]);
|
|
694
|
-
|
|
774
|
+
const hasServices = serviceNames.length > 0;
|
|
775
|
+
if (!hasFunctions && !hasStatic && !hasServices) {
|
|
695
776
|
problems.push({
|
|
696
777
|
severity: "warning",
|
|
697
|
-
message: 'Build output contains no "functions" or "
|
|
778
|
+
message: 'Build output contains no "functions", "static", or "services" directory; the build may not have produced any deployable output.'
|
|
698
779
|
});
|
|
699
780
|
}
|
|
781
|
+
for (const name of serviceNames) {
|
|
782
|
+
const serviceDir = (0, import_path2.join)(servicesDir, name);
|
|
783
|
+
const label = `Build output service "${name}"`;
|
|
784
|
+
await validateOutputConfig(
|
|
785
|
+
(0, import_path2.join)(serviceDir, "config.json"),
|
|
786
|
+
label,
|
|
787
|
+
problems
|
|
788
|
+
);
|
|
789
|
+
const [svcHasFunctions, svcHasStatic] = await Promise.all([
|
|
790
|
+
import_fs_extra2.default.pathExists((0, import_path2.join)(serviceDir, "functions")),
|
|
791
|
+
import_fs_extra2.default.pathExists((0, import_path2.join)(serviceDir, "static"))
|
|
792
|
+
]);
|
|
793
|
+
if (!svcHasFunctions && !svcHasStatic) {
|
|
794
|
+
problems.push({
|
|
795
|
+
severity: "warning",
|
|
796
|
+
message: `${label} contains no "functions" or "static" directory; the service may not have produced any deployable output.`
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
}
|
|
700
800
|
logDebug(
|
|
701
801
|
`Build output validation found ${problems.length} problem(s)` + (problems.length ? `: ${problems.map((p) => `${p.severity}: ${p.message}`).join("; ")}` : ""),
|
|
702
802
|
output
|
|
@@ -755,10 +855,10 @@ var require_framework_detection = __commonJS({
|
|
|
755
855
|
module.exports = __toCommonJS(framework_detection_exports);
|
|
756
856
|
var import_fs_detectors = require_dist2();
|
|
757
857
|
var import_frameworks = require_frameworks();
|
|
758
|
-
var
|
|
858
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
759
859
|
function logDebug(message, output) {
|
|
760
860
|
output?.debug(message);
|
|
761
|
-
(0,
|
|
861
|
+
(0, import_build_utils3.debug)(message);
|
|
762
862
|
}
|
|
763
863
|
function isFrameworkDetectionEnabled(output) {
|
|
764
864
|
const raw = process.env.VERCEL_FRAMEWORK_DETECTION;
|
|
@@ -779,7 +879,7 @@ var require_framework_detection = __commonJS({
|
|
|
779
879
|
return result;
|
|
780
880
|
}
|
|
781
881
|
async function detectFirstDeploymentFramework(options) {
|
|
782
|
-
const { workPath, projectSettings, output } = options;
|
|
882
|
+
const { workPath, projectSettings, frameworkExplicitlyConfigured, output } = options;
|
|
783
883
|
logDebug(
|
|
784
884
|
`First deployment: evaluating framework detection (workPath="${workPath}", configuredFramework=${projectSettings.framework ? `"${projectSettings.framework}"` : "<none>"})`,
|
|
785
885
|
output
|
|
@@ -791,7 +891,7 @@ var require_framework_detection = __commonJS({
|
|
|
791
891
|
);
|
|
792
892
|
return { status: "skipped" };
|
|
793
893
|
}
|
|
794
|
-
if (projectSettings.framework) {
|
|
894
|
+
if (frameworkExplicitlyConfigured || projectSettings.framework) {
|
|
795
895
|
logDebug(
|
|
796
896
|
`First deployment: skipping framework detection because a framework is already configured ("${projectSettings.framework}")`,
|
|
797
897
|
output
|
|
@@ -988,14 +1088,14 @@ var require_monorepo = __commonJS({
|
|
|
988
1088
|
var import_path2 = __require("path");
|
|
989
1089
|
var import_fs_detectors = require_dist2();
|
|
990
1090
|
var import_title = __toESM2(require_lib2());
|
|
991
|
-
var
|
|
1091
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
992
1092
|
async function setMonorepoDefaultSettings(cwd, workPath, projectSettings, output) {
|
|
993
1093
|
const localFileSystem = new import_fs_detectors.LocalFileSystemDetector(cwd);
|
|
994
1094
|
const projectName = (0, import_path2.basename)(workPath);
|
|
995
1095
|
const relativeToRoot = (0, import_path2.relative)(workPath, cwd);
|
|
996
1096
|
const setCommand = (command, value) => {
|
|
997
1097
|
if (projectSettings[command]) {
|
|
998
|
-
(0,
|
|
1098
|
+
(0, import_build_utils3.debug)(
|
|
999
1099
|
`Skipping auto-assignment of ${command} as it is already set via project settings or configuration overrides.`
|
|
1000
1100
|
);
|
|
1001
1101
|
} else {
|
|
@@ -1078,7 +1178,7 @@ var require_corepack = __commonJS({
|
|
|
1078
1178
|
});
|
|
1079
1179
|
module.exports = __toCommonJS(corepack_exports);
|
|
1080
1180
|
var import_path2 = __require("path");
|
|
1081
|
-
var
|
|
1181
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
1082
1182
|
var import_fs_extra2 = __toESM2(require_lib());
|
|
1083
1183
|
async function initCorepack({
|
|
1084
1184
|
repoRootPath,
|
|
@@ -1113,7 +1213,7 @@ var require_corepack = __commonJS({
|
|
|
1113
1213
|
process.env.COREPACK_HOME = corepackHomeDir;
|
|
1114
1214
|
process.env.PATH = `${corepackShimDir}${import_path2.delimiter}${process.env.PATH}`;
|
|
1115
1215
|
const pkgManagerName = pkg.packageManager.split("@")[0];
|
|
1116
|
-
await (0,
|
|
1216
|
+
await (0, import_build_utils3.spawnAsync)(
|
|
1117
1217
|
"corepack",
|
|
1118
1218
|
["enable", pkgManagerName, "--install-directory", corepackShimDir],
|
|
1119
1219
|
{
|
|
@@ -1178,7 +1278,7 @@ var require_do_build = __commonJS({
|
|
|
1178
1278
|
var import_minimatch2 = __toESM2(require_minimatch());
|
|
1179
1279
|
var import_path2 = __require("path");
|
|
1180
1280
|
var import_semver = __toESM2(require_semver());
|
|
1181
|
-
var
|
|
1281
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
1182
1282
|
var import_client = require_dist();
|
|
1183
1283
|
var import_frameworks = require_frameworks();
|
|
1184
1284
|
var import_fs_detectors = require_dist2();
|
|
@@ -1186,6 +1286,7 @@ var require_do_build = __commonJS({
|
|
|
1186
1286
|
var import_detect_builders_with_services = require_detect_builders_with_services();
|
|
1187
1287
|
var import_routing_utils = require_dist3();
|
|
1188
1288
|
var import_write_build_result3 = require_write_build_result();
|
|
1289
|
+
var import_build_runner2 = require_build_runner();
|
|
1189
1290
|
var import_execute_builder = require_execute_builder();
|
|
1190
1291
|
var import_backend_rewrite_warning = require_backend_rewrite_warning();
|
|
1191
1292
|
var import_service_route_ownership = require_service_route_ownership();
|
|
@@ -1247,6 +1348,7 @@ var require_do_build = __commonJS({
|
|
|
1247
1348
|
} = request;
|
|
1248
1349
|
const {
|
|
1249
1350
|
output,
|
|
1351
|
+
createBuildRunner: createBuildRunner2,
|
|
1250
1352
|
importBuilders: importBuilders2,
|
|
1251
1353
|
formatResolvedBuilders: formatResolvedBuilders2,
|
|
1252
1354
|
writeBuildResult: writeBuildResult2,
|
|
@@ -1278,7 +1380,7 @@ var require_do_build = __commonJS({
|
|
|
1278
1380
|
if (typeof installCommand === "string") {
|
|
1279
1381
|
if (installCommand.trim()) {
|
|
1280
1382
|
output.log(`Running install command before config compilation...`);
|
|
1281
|
-
installRan = await (0,
|
|
1383
|
+
installRan = await (0, import_build_utils3.runCustomInstallCommand)({
|
|
1282
1384
|
destPath: workPath,
|
|
1283
1385
|
installCommand,
|
|
1284
1386
|
spawnOpts: { env: process.env },
|
|
@@ -1289,7 +1391,7 @@ var require_do_build = __commonJS({
|
|
|
1289
1391
|
}
|
|
1290
1392
|
} else {
|
|
1291
1393
|
output.log(`Installing dependencies before config compilation...`);
|
|
1292
|
-
installRan = await (0,
|
|
1394
|
+
installRan = await (0, import_build_utils3.runNpmInstall)(
|
|
1293
1395
|
workPath,
|
|
1294
1396
|
[],
|
|
1295
1397
|
{ env: process.env },
|
|
@@ -1301,7 +1403,7 @@ var require_do_build = __commonJS({
|
|
|
1301
1403
|
installDepsSpan.stop();
|
|
1302
1404
|
}
|
|
1303
1405
|
if (installRan) {
|
|
1304
|
-
const { packageJsonPath } = await (0,
|
|
1406
|
+
const { packageJsonPath } = await (0, import_build_utils3.scanParentDirs)(workPath, false);
|
|
1305
1407
|
if (packageJsonPath) {
|
|
1306
1408
|
process.env.VERCEL_INSTALL_COMPLETED_PATH = packageJsonPath;
|
|
1307
1409
|
}
|
|
@@ -1352,6 +1454,10 @@ var require_do_build = __commonJS({
|
|
|
1352
1454
|
const result = await (0, import_framework_detection.detectFirstDeploymentFramework)({
|
|
1353
1455
|
workPath,
|
|
1354
1456
|
projectSettings,
|
|
1457
|
+
frameworkExplicitlyConfigured: Object.prototype.hasOwnProperty.call(
|
|
1458
|
+
localConfig,
|
|
1459
|
+
"framework"
|
|
1460
|
+
),
|
|
1355
1461
|
output
|
|
1356
1462
|
});
|
|
1357
1463
|
s.setAttributes({
|
|
@@ -1382,7 +1488,7 @@ var require_do_build = __commonJS({
|
|
|
1382
1488
|
});
|
|
1383
1489
|
const files = await span.child("vc.getFiles").trace(async (s) => {
|
|
1384
1490
|
const result = (await (0, import_get_files.staticFiles)(workPath, {}, output)).map(
|
|
1385
|
-
(f) => (0,
|
|
1491
|
+
(f) => (0, import_build_utils3.normalizePath)((0, import_path2.relative)(workPath, f))
|
|
1386
1492
|
);
|
|
1387
1493
|
s.setAttributes({ fileCount: String(result.length) });
|
|
1388
1494
|
return result;
|
|
@@ -1413,7 +1519,7 @@ var require_do_build = __commonJS({
|
|
|
1413
1519
|
throw routesResult.error;
|
|
1414
1520
|
}
|
|
1415
1521
|
if (localConfig.builds && localConfig.functions) {
|
|
1416
|
-
throw new
|
|
1522
|
+
throw new import_build_utils3.NowBuildError({
|
|
1417
1523
|
code: "bad_request",
|
|
1418
1524
|
message: "The `functions` property cannot be used in conjunction with the `builds` property. Please remove one of them.",
|
|
1419
1525
|
link: "https://vercel.link/functions-and-builds"
|
|
@@ -1468,14 +1574,14 @@ var require_do_build = __commonJS({
|
|
|
1468
1574
|
}
|
|
1469
1575
|
detectedResolvedServices = detectedBuilders.services;
|
|
1470
1576
|
servicesToRecord = detectedResolvedServices;
|
|
1471
|
-
detectedServices = detectedBuilders.services?.filter(
|
|
1577
|
+
detectedServices = detectedBuilders.services?.filter(import_build_utils3.isExperimentalService);
|
|
1472
1578
|
const autoDetectedV2Config = detectedBuilders.experimentalServicesV2;
|
|
1473
1579
|
if (!hasExperimentalServicesV2ConfiguredInVercelConfig && autoDetectedV2Config) {
|
|
1474
1580
|
nestExperimentalServicesV2Output = true;
|
|
1475
1581
|
detectedExperimentalServicesV2Config = autoDetectedV2Config;
|
|
1476
1582
|
}
|
|
1477
1583
|
if (detectedBuilders.useImplicitEnvInjection && detectedServices && detectedServices.length > 0) {
|
|
1478
|
-
const serviceUrlEnvVars = (0,
|
|
1584
|
+
const serviceUrlEnvVars = (0, import_build_utils3.getExperimentalServiceUrlEnvVars)({
|
|
1479
1585
|
services: detectedServices,
|
|
1480
1586
|
frameworkList: import_frameworks.frameworkList,
|
|
1481
1587
|
currentEnv: process.env,
|
|
@@ -1533,7 +1639,7 @@ var require_do_build = __commonJS({
|
|
|
1533
1639
|
for (const path of files) {
|
|
1534
1640
|
const fsPath = (0, import_path2.join)(workPath, path);
|
|
1535
1641
|
const { mode } = await import_fs_extra2.default.stat(fsPath);
|
|
1536
|
-
map[path] = new
|
|
1642
|
+
map[path] = new import_build_utils3.FileFsRef({ mode, fsPath });
|
|
1537
1643
|
}
|
|
1538
1644
|
s.setAttributes({ fileCount: String(files.length) });
|
|
1539
1645
|
return map;
|
|
@@ -1580,7 +1686,8 @@ var require_do_build = __commonJS({
|
|
|
1580
1686
|
};
|
|
1581
1687
|
const meta = {
|
|
1582
1688
|
skipDownload: true,
|
|
1583
|
-
cliVersion
|
|
1689
|
+
cliVersion,
|
|
1690
|
+
runNpmInstallSet: /* @__PURE__ */ new Set()
|
|
1584
1691
|
};
|
|
1585
1692
|
const executedBuilds = [];
|
|
1586
1693
|
const buildResults = /* @__PURE__ */ new Map();
|
|
@@ -1608,6 +1715,7 @@ var require_do_build = __commonJS({
|
|
|
1608
1715
|
}
|
|
1609
1716
|
}
|
|
1610
1717
|
const preDeployEntries = [];
|
|
1718
|
+
const liveRunners = /* @__PURE__ */ new Set();
|
|
1611
1719
|
const runBuilders = async (buildsToRun) => {
|
|
1612
1720
|
await addBuildsToBuildJson(buildsToRun);
|
|
1613
1721
|
for (const build of (0, import_execute_builder.sortBuildsForExecution)(buildsToRun)) {
|
|
@@ -1620,8 +1728,8 @@ var require_do_build = __commonJS({
|
|
|
1620
1728
|
try {
|
|
1621
1729
|
const { builder, pkg: builderPkg } = builderWithPkg;
|
|
1622
1730
|
const service = getHasDetectedServices() ? serviceByBuilder.get(build) : void 0;
|
|
1623
|
-
const legacyExperimentalService = service && (0,
|
|
1624
|
-
const serviceWorkspace = service ? (0,
|
|
1731
|
+
const legacyExperimentalService = service && (0, import_build_utils3.isExperimentalService)(service) ? service : void 0;
|
|
1732
|
+
const serviceWorkspace = service ? (0, import_build_utils3.isExperimentalService)(service) ? service.workspace : service.root : void 0;
|
|
1625
1733
|
const stripServiceRoutePrefix = !!legacyExperimentalService?.routePrefix && legacyExperimentalService.routePrefix !== "/";
|
|
1626
1734
|
let buildWorkPath = workPath;
|
|
1627
1735
|
let buildEntrypoint = build.src;
|
|
@@ -1675,7 +1783,7 @@ var require_do_build = __commonJS({
|
|
|
1675
1783
|
// `service.functions` isn't on `build.config`, so builders that
|
|
1676
1784
|
// read `config.functions` (e.g. Next.js) would otherwise miss it;
|
|
1677
1785
|
// `serviceName` scopes the derived v2beta consumer.
|
|
1678
|
-
...(0,
|
|
1786
|
+
...(0, import_build_utils3.isExperimentalServiceV2)(service) && service.functions ? { functions: service.functions, serviceName: service.name } : void 0,
|
|
1679
1787
|
// Override project-level settings with service-specific ones.
|
|
1680
1788
|
// The project-level framework is "services" which must NOT be
|
|
1681
1789
|
// propagated to individual builders.
|
|
@@ -1756,7 +1864,7 @@ var require_do_build = __commonJS({
|
|
|
1756
1864
|
);
|
|
1757
1865
|
const restoreEnv = /* @__PURE__ */ new Map();
|
|
1758
1866
|
if (detectedServices && legacyExperimentalService?.env) {
|
|
1759
|
-
const perServiceEnv = (0,
|
|
1867
|
+
const perServiceEnv = (0, import_build_utils3.getServiceUrlEnvVars)({
|
|
1760
1868
|
requestedEnv: legacyExperimentalService.env,
|
|
1761
1869
|
consumerService: legacyExperimentalService,
|
|
1762
1870
|
services: detectedServices,
|
|
@@ -1777,6 +1885,21 @@ var require_do_build = __commonJS({
|
|
|
1777
1885
|
}
|
|
1778
1886
|
let buildResult;
|
|
1779
1887
|
let rawBuildResult;
|
|
1888
|
+
const runnerContext = {
|
|
1889
|
+
requirePath: builderWithPkg.path,
|
|
1890
|
+
buildOptions,
|
|
1891
|
+
cwd: buildWorkPath,
|
|
1892
|
+
expectsPreDeploy: Boolean(preDeployCmd),
|
|
1893
|
+
builderSpan
|
|
1894
|
+
};
|
|
1895
|
+
const runner = createBuildRunner2?.({
|
|
1896
|
+
ctx: runnerContext,
|
|
1897
|
+
builder,
|
|
1898
|
+
hasDetectedServices: getHasDetectedServices(),
|
|
1899
|
+
builderPath: builderWithPkg.path,
|
|
1900
|
+
hasBuildCallback: Boolean(buildOptions.buildCallback)
|
|
1901
|
+
}) ?? new import_build_runner2.InprocessBuildRunner(runnerContext, builder);
|
|
1902
|
+
liveRunners.add(runner);
|
|
1780
1903
|
try {
|
|
1781
1904
|
({ buildResult, rawBuildResult } = await (0, import_execute_builder.executeBuilder)({
|
|
1782
1905
|
builder,
|
|
@@ -1786,7 +1909,8 @@ var require_do_build = __commonJS({
|
|
|
1786
1909
|
hasDetectedServices: getHasDetectedServices(),
|
|
1787
1910
|
framework: import_frameworks.frameworkList.find(
|
|
1788
1911
|
(framework2) => framework2.slug === buildConfig.framework
|
|
1789
|
-
)
|
|
1912
|
+
),
|
|
1913
|
+
runner
|
|
1790
1914
|
}));
|
|
1791
1915
|
} finally {
|
|
1792
1916
|
for (const [key, prior] of restoreEnv) {
|
|
@@ -1797,9 +1921,7 @@ var require_do_build = __commonJS({
|
|
|
1797
1921
|
}
|
|
1798
1922
|
}
|
|
1799
1923
|
try {
|
|
1800
|
-
const builderDiagnostics = await
|
|
1801
|
-
return await builder.diagnostics?.(buildOptions);
|
|
1802
|
-
});
|
|
1924
|
+
const builderDiagnostics = await runner.diagnostics();
|
|
1803
1925
|
if (builderDiagnostics) {
|
|
1804
1926
|
const prefix = service && serviceWorkspace && serviceWorkspace !== "." ? serviceWorkspace + "/" + builderPkg.name + "/" : "";
|
|
1805
1927
|
for (const [key, value] of Object.entries(builderDiagnostics)) {
|
|
@@ -1854,15 +1976,15 @@ var require_do_build = __commonJS({
|
|
|
1854
1976
|
}
|
|
1855
1977
|
if (buildResult && "output" in buildResult && "runtime" in buildResult.output && "type" in buildResult.output && buildResult.output.type === "Lambda") {
|
|
1856
1978
|
const lambdaRuntime = buildResult.output.runtime;
|
|
1857
|
-
if ((0,
|
|
1858
|
-
throw new
|
|
1979
|
+
if ((0, import_build_utils3.getDiscontinuedNodeVersions)().some((o) => o.runtime === lambdaRuntime)) {
|
|
1980
|
+
throw new import_build_utils3.NowBuildError({
|
|
1859
1981
|
code: "NODEJS_DISCONTINUED_VERSION",
|
|
1860
1982
|
message: `The Runtime "${build.use}" is using "${lambdaRuntime}", which is discontinued. Please upgrade your Runtime to a more recent version or consult the author for more details.`,
|
|
1861
1983
|
link: "https://vercel.link/function-runtimes"
|
|
1862
1984
|
});
|
|
1863
1985
|
}
|
|
1864
1986
|
}
|
|
1865
|
-
if ("output" in buildResult && buildResult.output && ((0,
|
|
1987
|
+
if ("output" in buildResult && buildResult.output && ((0, import_build_utils3.isBackendBuilder)(build) || build.use === "@vercel/python")) {
|
|
1866
1988
|
const routesJsonPath = (0, import_path2.join)(buildWorkPath, ".vercel", "routes.json");
|
|
1867
1989
|
if ((0, import_fs_extra2.existsSync)(routesJsonPath)) {
|
|
1868
1990
|
try {
|
|
@@ -1912,13 +2034,13 @@ var require_do_build = __commonJS({
|
|
|
1912
2034
|
allServices: detectedServices
|
|
1913
2035
|
});
|
|
1914
2036
|
}
|
|
1915
|
-
if (legacyExperimentalService && (0,
|
|
2037
|
+
if (legacyExperimentalService && (0, import_build_utils3.isQueueBackedService)(legacyExperimentalService) && "output" in buildResult) {
|
|
1916
2038
|
attachQueueServiceTrigger(
|
|
1917
2039
|
buildResult.output,
|
|
1918
2040
|
legacyExperimentalService
|
|
1919
2041
|
);
|
|
1920
2042
|
}
|
|
1921
|
-
if (legacyExperimentalService && (0,
|
|
2043
|
+
if (legacyExperimentalService && (0, import_build_utils3.isScheduleTriggeredService)(legacyExperimentalService) && !("crons" in buildResult && buildResult.crons?.length)) {
|
|
1922
2044
|
const staticSchedules = (0, import_service_schedules.getStaticServiceSchedules)(
|
|
1923
2045
|
legacyExperimentalService.schedule
|
|
1924
2046
|
);
|
|
@@ -1926,7 +2048,7 @@ var require_do_build = __commonJS({
|
|
|
1926
2048
|
const cronEntrypoint = legacyExperimentalService.entrypoint || legacyExperimentalService.builder.src || "index";
|
|
1927
2049
|
for (const schedule of staticSchedules) {
|
|
1928
2050
|
synthesizedServiceCrons.push({
|
|
1929
|
-
path: (0,
|
|
2051
|
+
path: (0, import_build_utils3.getInternalServiceCronPath)(
|
|
1930
2052
|
legacyExperimentalService.name,
|
|
1931
2053
|
cronEntrypoint,
|
|
1932
2054
|
legacyExperimentalService.handlerFunction || "cron"
|
|
@@ -1935,7 +2057,7 @@ var require_do_build = __commonJS({
|
|
|
1935
2057
|
});
|
|
1936
2058
|
}
|
|
1937
2059
|
} else {
|
|
1938
|
-
throw new
|
|
2060
|
+
throw new import_build_utils3.NowBuildError({
|
|
1939
2061
|
code: "CRON_SERVICE_NO_CRONS",
|
|
1940
2062
|
message: `Scheduled service "${legacyExperimentalService.name}" did not produce any cron entries. The builder "${builderPkg.name}" may not support scheduled services.`
|
|
1941
2063
|
});
|
|
@@ -2042,7 +2164,7 @@ var require_do_build = __commonJS({
|
|
|
2042
2164
|
throw err;
|
|
2043
2165
|
} finally {
|
|
2044
2166
|
ops.push(
|
|
2045
|
-
(0,
|
|
2167
|
+
(0, import_build_utils3.download)(diagnostics, (0, import_path2.join)(outputDir, "diagnostics")).then(
|
|
2046
2168
|
() => void 0,
|
|
2047
2169
|
(err) => err
|
|
2048
2170
|
)
|
|
@@ -2058,7 +2180,7 @@ var require_do_build = __commonJS({
|
|
|
2058
2180
|
}
|
|
2059
2181
|
}
|
|
2060
2182
|
};
|
|
2061
|
-
const normalizeBuilderSrc = (src) => typeof src === "string" ? (0,
|
|
2183
|
+
const normalizeBuilderSrc = (src) => typeof src === "string" ? (0, import_build_utils3.normalizePath)(src).replace(/^\.\//, "") : void 0;
|
|
2062
2184
|
const getBuilderIdentity = (build) => {
|
|
2063
2185
|
const normalizedSrc = normalizeBuilderSrc(build.src);
|
|
2064
2186
|
return normalizedSrc ? `${build.use}:${normalizedSrc}` : void 0;
|
|
@@ -2095,123 +2217,135 @@ var require_do_build = __commonJS({
|
|
|
2095
2217
|
zeroConfigFallbackRoutes.push(...serviceRoutes.fallbacks);
|
|
2096
2218
|
}
|
|
2097
2219
|
};
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
const defaultGeneratedOutputDir = (0, import_path2.join)(workPath, import_write_build_result3.OUTPUT_DIR);
|
|
2107
|
-
const generatedConfigs = [generatedConfig];
|
|
2108
|
-
if ((0, import_path2.resolve)(outputDir) !== (0, import_path2.resolve)(defaultGeneratedOutputDir)) {
|
|
2109
|
-
const defaultGeneratedConfig = await readJSONFile2(
|
|
2110
|
-
(0, import_path2.join)(defaultGeneratedOutputDir, "config.json")
|
|
2111
|
-
);
|
|
2112
|
-
if (isCantParseJSONFile(defaultGeneratedConfig)) {
|
|
2113
|
-
throw defaultGeneratedConfig;
|
|
2114
|
-
}
|
|
2115
|
-
generatedConfigs.push(defaultGeneratedConfig);
|
|
2116
|
-
}
|
|
2117
|
-
const generatedServicesConfig = getGeneratedServicesConfig([
|
|
2118
|
-
...generatedConfigs,
|
|
2119
|
-
...buildResults.values()
|
|
2120
|
-
]);
|
|
2121
|
-
const generatedExperimentalServicesV1Config = getGeneratedExperimentalServicesV1Config([
|
|
2122
|
-
...generatedConfigs,
|
|
2123
|
-
...buildResults.values()
|
|
2124
|
-
]);
|
|
2125
|
-
if (generatedServicesConfig || generatedExperimentalServicesV1Config) {
|
|
2126
|
-
if (generatedServicesConfig) {
|
|
2127
|
-
nestExperimentalServicesV2Output = true;
|
|
2128
|
-
}
|
|
2129
|
-
detectedExperimentalServicesV1Config = generatedExperimentalServicesV1Config;
|
|
2130
|
-
detectedExperimentalServicesV2Config = generatedServicesConfig;
|
|
2131
|
-
detectedExperimentalServicesV2RootRoutes = generatedServicesConfig ? generatedConfigs.find(
|
|
2132
|
-
(config2) => (hasGeneratedServicesConfig(config2) || hasNonEmptyObject(config2?.experimentalServicesV2)) && Array.isArray(config2?.routes)
|
|
2133
|
-
)?.routes : void 0;
|
|
2134
|
-
const generatedBuilders = await span.child("vc.detectGeneratedServices").trace(
|
|
2135
|
-
() => (0, import_detect_builders_with_services.detectBuildersWithServices)(files, pkg, {
|
|
2136
|
-
...localConfig,
|
|
2137
|
-
...generatedServicesConfig ? {
|
|
2138
|
-
services: generatedServicesConfig,
|
|
2139
|
-
experimentalServicesV2: void 0
|
|
2140
|
-
} : {
|
|
2141
|
-
experimentalServicesV2: void 0,
|
|
2142
|
-
experimentalServices: generatedExperimentalServicesV1Config
|
|
2143
|
-
},
|
|
2144
|
-
projectSettings,
|
|
2145
|
-
ignoreBuildScript: true,
|
|
2146
|
-
featHandleMiss: true,
|
|
2147
|
-
workPath
|
|
2148
|
-
})
|
|
2149
|
-
);
|
|
2150
|
-
if (generatedBuilders.errors && generatedBuilders.errors.length > 0) {
|
|
2151
|
-
throw generatedBuilders.errors[0];
|
|
2152
|
-
}
|
|
2153
|
-
for (const w of generatedBuilders.warnings) {
|
|
2154
|
-
output.warn(w.message, null, w.link, w.action || "Learn More");
|
|
2220
|
+
try {
|
|
2221
|
+
await runBuilders(builds);
|
|
2222
|
+
await flushOps();
|
|
2223
|
+
if (!hasExperimentalServicesV1ConfiguredInVercelConfig && !hasExperimentalServicesV2ConfiguredInVercelConfig) {
|
|
2224
|
+
const generatedConfigPath = (0, import_path2.join)(outputDir, "config.json");
|
|
2225
|
+
const generatedConfig = await readJSONFile2(generatedConfigPath);
|
|
2226
|
+
if (isCantParseJSONFile(generatedConfig)) {
|
|
2227
|
+
throw generatedConfig;
|
|
2155
2228
|
}
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
detectedServices = detectedResolvedServices.filter(
|
|
2162
|
-
import_build_utils2.isExperimentalService
|
|
2229
|
+
const defaultGeneratedOutputDir = (0, import_path2.join)(workPath, import_write_build_result3.OUTPUT_DIR);
|
|
2230
|
+
const generatedConfigs = [generatedConfig];
|
|
2231
|
+
if ((0, import_path2.resolve)(outputDir) !== (0, import_path2.resolve)(defaultGeneratedOutputDir)) {
|
|
2232
|
+
const defaultGeneratedConfig = await readJSONFile2(
|
|
2233
|
+
(0, import_path2.join)(defaultGeneratedOutputDir, "config.json")
|
|
2163
2234
|
);
|
|
2164
|
-
if (
|
|
2165
|
-
|
|
2235
|
+
if (isCantParseJSONFile(defaultGeneratedConfig)) {
|
|
2236
|
+
throw defaultGeneratedConfig;
|
|
2166
2237
|
}
|
|
2238
|
+
generatedConfigs.push(defaultGeneratedConfig);
|
|
2167
2239
|
}
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2240
|
+
const generatedServicesConfig = getGeneratedServicesConfig([
|
|
2241
|
+
...generatedConfigs,
|
|
2242
|
+
...buildResults.values()
|
|
2243
|
+
]);
|
|
2244
|
+
const generatedExperimentalServicesV1Config = getGeneratedExperimentalServicesV1Config([
|
|
2245
|
+
...generatedConfigs,
|
|
2246
|
+
...buildResults.values()
|
|
2247
|
+
]);
|
|
2248
|
+
if (generatedServicesConfig || generatedExperimentalServicesV1Config) {
|
|
2249
|
+
if (generatedServicesConfig) {
|
|
2250
|
+
nestExperimentalServicesV2Output = true;
|
|
2178
2251
|
}
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
const
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2252
|
+
detectedExperimentalServicesV1Config = generatedExperimentalServicesV1Config;
|
|
2253
|
+
detectedExperimentalServicesV2Config = generatedServicesConfig;
|
|
2254
|
+
detectedExperimentalServicesV2RootRoutes = generatedServicesConfig ? generatedConfigs.find(
|
|
2255
|
+
(config2) => (hasGeneratedServicesConfig(config2) || hasNonEmptyObject(config2?.experimentalServicesV2)) && Array.isArray(config2?.routes)
|
|
2256
|
+
)?.routes : void 0;
|
|
2257
|
+
const generatedBuilders = await span.child("vc.detectGeneratedServices").trace(
|
|
2258
|
+
() => (0, import_detect_builders_with_services.detectBuildersWithServices)(files, pkg, {
|
|
2259
|
+
...localConfig,
|
|
2260
|
+
...generatedServicesConfig ? {
|
|
2261
|
+
services: generatedServicesConfig,
|
|
2262
|
+
experimentalServicesV2: void 0
|
|
2263
|
+
} : {
|
|
2264
|
+
experimentalServicesV2: void 0,
|
|
2265
|
+
experimentalServices: generatedExperimentalServicesV1Config
|
|
2266
|
+
},
|
|
2267
|
+
projectSettings,
|
|
2268
|
+
ignoreBuildScript: true,
|
|
2269
|
+
featHandleMiss: true,
|
|
2270
|
+
workPath
|
|
2271
|
+
})
|
|
2272
|
+
);
|
|
2273
|
+
if (generatedBuilders.errors && generatedBuilders.errors.length > 0) {
|
|
2274
|
+
throw generatedBuilders.errors[0];
|
|
2275
|
+
}
|
|
2276
|
+
for (const w of generatedBuilders.warnings) {
|
|
2277
|
+
output.warn(w.message, null, w.link, w.action || "Learn More");
|
|
2278
|
+
}
|
|
2279
|
+
detectedResolvedServices = generatedBuilders.services;
|
|
2280
|
+
if (!detectedResolvedServices || detectedResolvedServices.length === 0) {
|
|
2281
|
+
detectedResolvedServices = void 0;
|
|
2282
|
+
detectedServices = void 0;
|
|
2283
|
+
} else {
|
|
2284
|
+
detectedServices = detectedResolvedServices.filter(
|
|
2285
|
+
import_build_utils3.isExperimentalService
|
|
2286
|
+
);
|
|
2287
|
+
if (detectedServices.length > 0) {
|
|
2288
|
+
appendExperimentalServicesV1Routes(detectedServices);
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
if (detectedServices && detectedServices.length > 0 && generatedBuilders.useImplicitEnvInjection) {
|
|
2292
|
+
const serviceUrlEnvVars = (0, import_build_utils3.getExperimentalServiceUrlEnvVars)({
|
|
2293
|
+
services: detectedServices,
|
|
2294
|
+
frameworkList: import_frameworks.frameworkList,
|
|
2295
|
+
currentEnv: process.env,
|
|
2296
|
+
deploymentUrl: process.env.VERCEL_URL
|
|
2297
|
+
});
|
|
2298
|
+
for (const [key, value] of Object.entries(serviceUrlEnvVars)) {
|
|
2299
|
+
process.env[key] = value;
|
|
2300
|
+
output.debug(`Injected service URL env var: ${key}=${value}`);
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
const buildsToRun = [];
|
|
2304
|
+
const seenBuildsToRun = /* @__PURE__ */ new Set();
|
|
2305
|
+
const recordedServices = [];
|
|
2306
|
+
for (const service of detectedResolvedServices || []) {
|
|
2307
|
+
const alreadyExecutedBuild = getAlreadyExecutedBuild(service.builder);
|
|
2308
|
+
if (alreadyExecutedBuild) {
|
|
2309
|
+
if (generatedServicesConfig) {
|
|
2310
|
+
output.warn(getGeneratedServiceAlreadyBuiltWarning(service));
|
|
2311
|
+
continue;
|
|
2312
|
+
}
|
|
2313
|
+
serviceByBuilder.set(alreadyExecutedBuild, service);
|
|
2314
|
+
recordedServices.push(service);
|
|
2188
2315
|
continue;
|
|
2189
2316
|
}
|
|
2190
|
-
|
|
2317
|
+
const serviceBuilderIdentity = getBuilderIdentity(service.builder);
|
|
2318
|
+
if (serviceBuilderIdentity && !seenBuildsToRun.has(serviceBuilderIdentity)) {
|
|
2319
|
+
serviceByBuilder.set(service.builder, service);
|
|
2320
|
+
seenBuildsToRun.add(serviceBuilderIdentity);
|
|
2321
|
+
buildsToRun.push(service.builder);
|
|
2322
|
+
}
|
|
2191
2323
|
recordedServices.push(service);
|
|
2192
|
-
continue;
|
|
2193
2324
|
}
|
|
2194
|
-
|
|
2195
|
-
if (
|
|
2196
|
-
|
|
2197
|
-
seenBuildsToRun.add(serviceBuilderIdentity);
|
|
2198
|
-
buildsToRun.push(service.builder);
|
|
2325
|
+
servicesToRecord = recordedServices.length > 0 ? recordedServices : void 0;
|
|
2326
|
+
if (buildsToRun.length > 0) {
|
|
2327
|
+
await runBuilders(buildsToRun);
|
|
2199
2328
|
}
|
|
2200
|
-
recordedServices.push(service);
|
|
2201
2329
|
}
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2330
|
+
}
|
|
2331
|
+
for (const entry of preDeployEntries) {
|
|
2332
|
+
if (entry.callback) {
|
|
2333
|
+
await entry.callback();
|
|
2334
|
+
} else {
|
|
2335
|
+
output.warn(
|
|
2336
|
+
`Service "${entry.service}" has a preDeployCommand but its builder does not support it. The command was not executed.`
|
|
2337
|
+
);
|
|
2205
2338
|
}
|
|
2206
2339
|
}
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2340
|
+
} finally {
|
|
2341
|
+
for (const runner of liveRunners) {
|
|
2342
|
+
try {
|
|
2343
|
+
runner.teardown();
|
|
2344
|
+
} catch (err) {
|
|
2345
|
+
output.debug(
|
|
2346
|
+
`Runner teardown failed: ${err instanceof Error ? err.message : String(err)}`
|
|
2347
|
+
);
|
|
2348
|
+
}
|
|
2215
2349
|
}
|
|
2216
2350
|
}
|
|
2217
2351
|
await (0, import_manifest.writeManifests)(packageManifests, diagnostics, ops, outputDir);
|
|
@@ -2221,7 +2355,7 @@ var require_do_build = __commonJS({
|
|
|
2221
2355
|
const collectSpan = span.child("vc.finalizeBuildOutput");
|
|
2222
2356
|
await flushOps();
|
|
2223
2357
|
let needBuildsJsonOverride = false;
|
|
2224
|
-
const speedInsightsVersion = await (0,
|
|
2358
|
+
const speedInsightsVersion = await (0, import_build_utils3.getInstalledPackageVersion)(
|
|
2225
2359
|
"@vercel/speed-insights"
|
|
2226
2360
|
);
|
|
2227
2361
|
if (speedInsightsVersion) {
|
|
@@ -2231,7 +2365,7 @@ var require_do_build = __commonJS({
|
|
|
2231
2365
|
};
|
|
2232
2366
|
needBuildsJsonOverride = true;
|
|
2233
2367
|
}
|
|
2234
|
-
const webAnalyticsVersion = await (0,
|
|
2368
|
+
const webAnalyticsVersion = await (0, import_build_utils3.getInstalledPackageVersion)("@vercel/analytics");
|
|
2235
2369
|
if (webAnalyticsVersion) {
|
|
2236
2370
|
buildsJson.features = {
|
|
2237
2371
|
...buildsJson.features ?? {},
|
|
@@ -2251,14 +2385,14 @@ var require_do_build = __commonJS({
|
|
|
2251
2385
|
if ("deploymentId" in existingConfig && typeof existingConfig.deploymentId === "string") {
|
|
2252
2386
|
const deploymentId = existingConfig.deploymentId;
|
|
2253
2387
|
if (deploymentId.length > 32) {
|
|
2254
|
-
throw new
|
|
2388
|
+
throw new import_build_utils3.NowBuildError({
|
|
2255
2389
|
code: "INVALID_DEPLOYMENT_ID",
|
|
2256
2390
|
message: `The deploymentId "${deploymentId}" must be 32 characters or less. Please choose a shorter deploymentId in your config.`,
|
|
2257
2391
|
link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
|
|
2258
2392
|
});
|
|
2259
2393
|
}
|
|
2260
2394
|
if (!VALID_DEPLOYMENT_ID_PATTERN.test(deploymentId)) {
|
|
2261
|
-
throw new
|
|
2395
|
+
throw new import_build_utils3.NowBuildError({
|
|
2262
2396
|
code: "INVALID_DEPLOYMENT_ID",
|
|
2263
2397
|
message: `The deploymentId "${deploymentId}" contains invalid characters. Only alphanumeric characters (a-z, A-Z, 0-9), hyphens (-), and underscores (_) are allowed.`,
|
|
2264
2398
|
link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
|
|
@@ -2282,7 +2416,7 @@ var require_do_build = __commonJS({
|
|
|
2282
2416
|
let entrypoint = build.src;
|
|
2283
2417
|
if (getHasDetectedServices() && typeof build.src === "string") {
|
|
2284
2418
|
const service = serviceByBuilder.get(build);
|
|
2285
|
-
if (service && (0,
|
|
2419
|
+
if (service && (0, import_build_utils3.isExperimentalService)(service) && service.type === "web" && typeof service.routePrefix === "string") {
|
|
2286
2420
|
entrypoint = getServicesMergeEntrypoint(service, build.src);
|
|
2287
2421
|
}
|
|
2288
2422
|
}
|
|
@@ -2328,14 +2462,14 @@ var require_do_build = __commonJS({
|
|
|
2328
2462
|
);
|
|
2329
2463
|
if (mergedDeploymentId) {
|
|
2330
2464
|
if (mergedDeploymentId.length > 32) {
|
|
2331
|
-
throw new
|
|
2465
|
+
throw new import_build_utils3.NowBuildError({
|
|
2332
2466
|
code: "INVALID_DEPLOYMENT_ID",
|
|
2333
2467
|
message: `The deploymentId "${mergedDeploymentId}" must be 32 characters or less. Please choose a shorter deploymentId in your config.`,
|
|
2334
2468
|
link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
|
|
2335
2469
|
});
|
|
2336
2470
|
}
|
|
2337
2471
|
if (!VALID_DEPLOYMENT_ID_PATTERN.test(mergedDeploymentId)) {
|
|
2338
|
-
throw new
|
|
2472
|
+
throw new import_build_utils3.NowBuildError({
|
|
2339
2473
|
code: "INVALID_DEPLOYMENT_ID",
|
|
2340
2474
|
message: `The deploymentId "${mergedDeploymentId}" contains invalid characters. Only alphanumeric characters (a-z, A-Z, 0-9), hyphens (-), and underscores (_) are allowed.`,
|
|
2341
2475
|
link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
|
|
@@ -2452,7 +2586,7 @@ var require_do_build = __commonJS({
|
|
|
2452
2586
|
}
|
|
2453
2587
|
function expandBuild(files, build) {
|
|
2454
2588
|
if (!build.use) {
|
|
2455
|
-
throw new
|
|
2589
|
+
throw new import_build_utils3.NowBuildError({
|
|
2456
2590
|
code: `invalid_build_specification`,
|
|
2457
2591
|
message: "Field `use` is missing in build specification",
|
|
2458
2592
|
link: "https://vercel.com/docs/concepts/projects/project-configuration#builds",
|
|
@@ -2461,7 +2595,7 @@ var require_do_build = __commonJS({
|
|
|
2461
2595
|
}
|
|
2462
2596
|
let src = (0, import_path2.normalize)(build.src || "**").split(import_path2.sep).join("/");
|
|
2463
2597
|
if (src === "." || src === "./") {
|
|
2464
|
-
throw new
|
|
2598
|
+
throw new import_build_utils3.NowBuildError({
|
|
2465
2599
|
code: `invalid_build_specification`,
|
|
2466
2600
|
message: "A build `src` path resolves to an empty string",
|
|
2467
2601
|
link: "https://vercel.com/docs/concepts/projects/project-configuration#builds",
|
|
@@ -2751,9 +2885,9 @@ var require_do_build = __commonJS({
|
|
|
2751
2885
|
return `svc:${sortKey}:${normalized}:${service.name}:${buildSrc}`;
|
|
2752
2886
|
}
|
|
2753
2887
|
function attachQueueServiceTrigger(buildOutput, service) {
|
|
2754
|
-
const topics = (0,
|
|
2755
|
-
const consumer = (0,
|
|
2756
|
-
(0,
|
|
2888
|
+
const topics = (0, import_build_utils3.getServiceQueueTopicConfigs)(service);
|
|
2889
|
+
const consumer = (0, import_build_utils3.sanitizeConsumerName)(
|
|
2890
|
+
(0, import_build_utils3.getInternalServiceFunctionPath)(service.name)
|
|
2757
2891
|
);
|
|
2758
2892
|
if (service.builder.use !== "@vercel/python" && topics.length > 1) {
|
|
2759
2893
|
throw new Error(
|
|
@@ -2832,11 +2966,14 @@ var require_dist5 = __commonJS({
|
|
|
2832
2966
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2833
2967
|
var src_exports = {};
|
|
2834
2968
|
__export(src_exports, {
|
|
2969
|
+
BuildRunner: () => import_build_runner2.BuildRunner,
|
|
2970
|
+
InprocessBuildRunner: () => import_build_runner2.InprocessBuildRunner,
|
|
2835
2971
|
doBuild: () => import_do_build.doBuild,
|
|
2836
2972
|
executeBuilder: () => import_execute_builder.executeBuilder,
|
|
2837
2973
|
sortBuildsForExecution: () => import_execute_builder.sortBuildsForExecution
|
|
2838
2974
|
});
|
|
2839
2975
|
module.exports = __toCommonJS(src_exports);
|
|
2976
|
+
var import_build_runner2 = require_build_runner();
|
|
2840
2977
|
var import_execute_builder = require_execute_builder();
|
|
2841
2978
|
var import_do_build = require_do_build();
|
|
2842
2979
|
}
|
|
@@ -2846,7 +2983,7 @@ var require_dist5 = __commonJS({
|
|
|
2846
2983
|
var import_chalk = __toESM(require_source(), 1);
|
|
2847
2984
|
var import_dotenv = __toESM(require_main(), 1);
|
|
2848
2985
|
var import_fs_extra = __toESM(require_lib(), 1);
|
|
2849
|
-
import { dirname as dirname2, join as
|
|
2986
|
+
import { dirname as dirname2, join as join3, relative as relative2, resolve } from "path";
|
|
2850
2987
|
import { readdirSync, statSync } from "fs";
|
|
2851
2988
|
import {
|
|
2852
2989
|
normalizePath,
|
|
@@ -2858,6 +2995,311 @@ import {
|
|
|
2858
2995
|
} from "@vercel/build-utils";
|
|
2859
2996
|
var import_cli_builder_integration = __toESM(require_dist5(), 1);
|
|
2860
2997
|
|
|
2998
|
+
// src/util/build/builder-process.ts
|
|
2999
|
+
var import_build_runner = __toESM(require_build_runner(), 1);
|
|
3000
|
+
import { fork } from "child_process";
|
|
3001
|
+
import { readFileSync, unlinkSync } from "fs";
|
|
3002
|
+
import { join } from "path";
|
|
3003
|
+
import {
|
|
3004
|
+
Lambda,
|
|
3005
|
+
FileBlob,
|
|
3006
|
+
FileFsRef,
|
|
3007
|
+
FileRef
|
|
3008
|
+
} from "@vercel/build-utils";
|
|
3009
|
+
function toError(error) {
|
|
3010
|
+
if (error instanceof Error)
|
|
3011
|
+
return error;
|
|
3012
|
+
return Object.assign(new Error(), error);
|
|
3013
|
+
}
|
|
3014
|
+
function canBuildInSubprocess({
|
|
3015
|
+
hasDetectedServices,
|
|
3016
|
+
builderPath,
|
|
3017
|
+
hasBuildCallback
|
|
3018
|
+
}) {
|
|
3019
|
+
return hasDetectedServices && Boolean(builderPath) && !hasBuildCallback;
|
|
3020
|
+
}
|
|
3021
|
+
function rehydrateFile(obj) {
|
|
3022
|
+
if (obj.type === "FileBlob") {
|
|
3023
|
+
const blob = Object.assign(
|
|
3024
|
+
Object.create(FileBlob.prototype),
|
|
3025
|
+
obj
|
|
3026
|
+
);
|
|
3027
|
+
if (obj.dataPath) {
|
|
3028
|
+
blob.data = readFileSync(obj.dataPath);
|
|
3029
|
+
try {
|
|
3030
|
+
unlinkSync(obj.dataPath);
|
|
3031
|
+
} catch {
|
|
3032
|
+
}
|
|
3033
|
+
delete blob.dataPath;
|
|
3034
|
+
}
|
|
3035
|
+
return blob;
|
|
3036
|
+
}
|
|
3037
|
+
if (obj.type === "FileRef") {
|
|
3038
|
+
return Object.assign(Object.create(FileRef.prototype), obj);
|
|
3039
|
+
}
|
|
3040
|
+
return Object.assign(Object.create(FileFsRef.prototype), obj);
|
|
3041
|
+
}
|
|
3042
|
+
function rehydrateFiles(files) {
|
|
3043
|
+
if (!files)
|
|
3044
|
+
return;
|
|
3045
|
+
for (const name of Object.keys(files)) {
|
|
3046
|
+
files[name] = rehydrateFile(files[name]);
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
function rehydrateDiagnostics(diagnostics) {
|
|
3050
|
+
const result = {};
|
|
3051
|
+
for (const [name, file] of Object.entries(diagnostics)) {
|
|
3052
|
+
result[name] = rehydrateFile(file);
|
|
3053
|
+
}
|
|
3054
|
+
return result;
|
|
3055
|
+
}
|
|
3056
|
+
function rehydrateOutput(output, seen) {
|
|
3057
|
+
if (!output || typeof output !== "object" || seen.has(output))
|
|
3058
|
+
return;
|
|
3059
|
+
seen.add(output);
|
|
3060
|
+
const obj = output;
|
|
3061
|
+
if (obj.type === "Lambda") {
|
|
3062
|
+
rehydrateFiles(obj.files);
|
|
3063
|
+
Object.setPrototypeOf(obj, Lambda.prototype);
|
|
3064
|
+
} else if (obj.type === "EdgeFunction") {
|
|
3065
|
+
rehydrateFiles(obj.files);
|
|
3066
|
+
} else if (obj.type === "Prerender") {
|
|
3067
|
+
if (obj.lambda)
|
|
3068
|
+
rehydrateOutput(obj.lambda, seen);
|
|
3069
|
+
if (obj.fallback)
|
|
3070
|
+
rehydrateOutput(obj.fallback, seen);
|
|
3071
|
+
} else if (obj.type === "FileFsRef" || obj.type === "FileBlob" || obj.type === "FileRef") {
|
|
3072
|
+
const rehydrated = rehydrateFile(obj);
|
|
3073
|
+
Object.assign(obj, rehydrated);
|
|
3074
|
+
Object.setPrototypeOf(obj, Object.getPrototypeOf(rehydrated));
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
function rehydrateResult(result, outputVersion) {
|
|
3078
|
+
const unwrapped = result && "resultVersion" in result ? result.result : result;
|
|
3079
|
+
const output = unwrapped.output;
|
|
3080
|
+
if (!output)
|
|
3081
|
+
return;
|
|
3082
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3083
|
+
if (outputVersion === 3) {
|
|
3084
|
+
rehydrateOutput(output, seen);
|
|
3085
|
+
} else {
|
|
3086
|
+
for (const value of Object.values(output)) {
|
|
3087
|
+
rehydrateOutput(value, seen);
|
|
3088
|
+
}
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3091
|
+
var SubprocessBuildRunner = class extends import_build_runner.BuildRunner {
|
|
3092
|
+
/**
|
|
3093
|
+
* Fork a worker, run one build, and return the deserialized result. `buildOptions.span` is
|
|
3094
|
+
* dropped (a class instance that can't be serialized); the caller keeps its own tracing.
|
|
3095
|
+
*
|
|
3096
|
+
* The child inherits stdout/stderr so its build output reaches the terminal directly, matching
|
|
3097
|
+
* the previous in-process behavior. When the build registers a pre-deploy command, the worker
|
|
3098
|
+
* is kept alive: its `registerPreDeploy` callback runs the command in the worker later, when the
|
|
3099
|
+
* command invokes the deferred callback. Teardown is owned by the caller (via `teardown()`), so
|
|
3100
|
+
* a kept-alive worker is released even if that deferred callback is never reached.
|
|
3101
|
+
*/
|
|
3102
|
+
async build() {
|
|
3103
|
+
const workerPath = join(__dirname, "builder-worker.cjs");
|
|
3104
|
+
const child = fork(workerPath, [], {
|
|
3105
|
+
cwd: this.ctx.cwd,
|
|
3106
|
+
execArgv: [],
|
|
3107
|
+
env: process.env,
|
|
3108
|
+
// V8 structured clone (not the default JSON) so the build result rides across with its
|
|
3109
|
+
// Buffers, cycles (e.g. `@vercel/next`'s `childProcesses`), and shared object identity
|
|
3110
|
+
// (one Lambda referenced by many outputs stays one instance) intact.
|
|
3111
|
+
serialization: "advanced"
|
|
3112
|
+
});
|
|
3113
|
+
this.child = child;
|
|
3114
|
+
await new Promise((resolve2, reject) => {
|
|
3115
|
+
function onMessage(data) {
|
|
3116
|
+
cleanup();
|
|
3117
|
+
if (data !== null && typeof data === "object" && data.type !== "ready") {
|
|
3118
|
+
reject(new Error('Did not get "ready" event from builder'));
|
|
3119
|
+
} else {
|
|
3120
|
+
resolve2();
|
|
3121
|
+
}
|
|
3122
|
+
}
|
|
3123
|
+
function onError(err) {
|
|
3124
|
+
cleanup();
|
|
3125
|
+
reject(err);
|
|
3126
|
+
}
|
|
3127
|
+
function onExit(code, signal) {
|
|
3128
|
+
cleanup();
|
|
3129
|
+
reject(
|
|
3130
|
+
new Error(
|
|
3131
|
+
`Builder exited with ${signal || code} before sending ready event`
|
|
3132
|
+
)
|
|
3133
|
+
);
|
|
3134
|
+
}
|
|
3135
|
+
function cleanup() {
|
|
3136
|
+
child.removeListener("message", onMessage);
|
|
3137
|
+
child.removeListener("error", onError);
|
|
3138
|
+
child.removeListener("close", onExit);
|
|
3139
|
+
}
|
|
3140
|
+
child.on("message", onMessage);
|
|
3141
|
+
child.on("error", onError);
|
|
3142
|
+
child.on("close", onExit);
|
|
3143
|
+
});
|
|
3144
|
+
try {
|
|
3145
|
+
const message = await this._runBuild();
|
|
3146
|
+
const buildResult = message.result;
|
|
3147
|
+
rehydrateResult(buildResult, message.outputVersion);
|
|
3148
|
+
if (this.ctx.buildOptions.meta && message.meta) {
|
|
3149
|
+
Object.assign(this.ctx.buildOptions.meta, message.meta);
|
|
3150
|
+
}
|
|
3151
|
+
if (message.hasPreDeploy) {
|
|
3152
|
+
child.on("close", (code, signal) => {
|
|
3153
|
+
this.childExit ??= { code, signal };
|
|
3154
|
+
});
|
|
3155
|
+
child.on("error", () => {
|
|
3156
|
+
this.childExit ??= { code: null, signal: null };
|
|
3157
|
+
});
|
|
3158
|
+
this.ctx.buildOptions.registerPreDeploy?.(
|
|
3159
|
+
() => this._runPreDeploy().finally(() => this.teardown())
|
|
3160
|
+
);
|
|
3161
|
+
} else {
|
|
3162
|
+
this.teardown();
|
|
3163
|
+
}
|
|
3164
|
+
return buildResult;
|
|
3165
|
+
} catch (err) {
|
|
3166
|
+
this.teardown();
|
|
3167
|
+
throw err;
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
_runBuild() {
|
|
3171
|
+
const child = this.child;
|
|
3172
|
+
if (!child) {
|
|
3173
|
+
throw new Error("subprocess not initialised before build");
|
|
3174
|
+
}
|
|
3175
|
+
const {
|
|
3176
|
+
span: _span,
|
|
3177
|
+
registerPreDeploy: _registerPreDeploy,
|
|
3178
|
+
...serializableBuildOptions
|
|
3179
|
+
} = this.ctx.buildOptions;
|
|
3180
|
+
const builderSpan = this.ctx.builderSpan;
|
|
3181
|
+
const captureDiagnostics = (msg) => {
|
|
3182
|
+
if (msg.diagnostics) {
|
|
3183
|
+
this.diagnosticsResult = rehydrateDiagnostics(msg.diagnostics);
|
|
3184
|
+
}
|
|
3185
|
+
};
|
|
3186
|
+
child.send({
|
|
3187
|
+
type: "build",
|
|
3188
|
+
requirePath: this.ctx.requirePath,
|
|
3189
|
+
buildOptions: serializableBuildOptions,
|
|
3190
|
+
expectsPreDeploy: Boolean(this.ctx.expectsPreDeploy)
|
|
3191
|
+
});
|
|
3192
|
+
return new Promise((resolve2, reject) => {
|
|
3193
|
+
function onMessage(msg) {
|
|
3194
|
+
cleanup();
|
|
3195
|
+
if (msg.type === "buildResult") {
|
|
3196
|
+
if (msg.traceEvents) {
|
|
3197
|
+
builderSpan?.reportChildEvents(msg.traceEvents);
|
|
3198
|
+
}
|
|
3199
|
+
captureDiagnostics(msg);
|
|
3200
|
+
if (msg.result) {
|
|
3201
|
+
resolve2(
|
|
3202
|
+
msg
|
|
3203
|
+
);
|
|
3204
|
+
} else {
|
|
3205
|
+
reject(toError(msg.error));
|
|
3206
|
+
}
|
|
3207
|
+
} else {
|
|
3208
|
+
reject(new Error(`Got unexpected message type: ${msg.type}`));
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
function onExit(code, signal) {
|
|
3212
|
+
cleanup();
|
|
3213
|
+
reject(
|
|
3214
|
+
new Error(
|
|
3215
|
+
`Builder exited with ${signal || code} before sending build result`
|
|
3216
|
+
)
|
|
3217
|
+
);
|
|
3218
|
+
}
|
|
3219
|
+
function cleanup() {
|
|
3220
|
+
child.removeListener("close", onExit);
|
|
3221
|
+
child.removeListener("message", onMessage);
|
|
3222
|
+
}
|
|
3223
|
+
child.once("close", onExit);
|
|
3224
|
+
child.once("message", onMessage);
|
|
3225
|
+
});
|
|
3226
|
+
}
|
|
3227
|
+
_runPreDeploy() {
|
|
3228
|
+
const child = this.child;
|
|
3229
|
+
if (!child) {
|
|
3230
|
+
throw new Error("subprocess not initialised before predeploy");
|
|
3231
|
+
}
|
|
3232
|
+
if (this.childExit || !child.connected) {
|
|
3233
|
+
const { code = null, signal = null } = this.childExit ?? {};
|
|
3234
|
+
return Promise.reject(
|
|
3235
|
+
new Error(
|
|
3236
|
+
`Builder exited with ${signal || code} before running pre-deploy`
|
|
3237
|
+
)
|
|
3238
|
+
);
|
|
3239
|
+
}
|
|
3240
|
+
const builderSpan = this.ctx.builderSpan;
|
|
3241
|
+
return new Promise((resolve2, reject) => {
|
|
3242
|
+
function onMessage(msg) {
|
|
3243
|
+
if (msg.type !== "preDeployResult")
|
|
3244
|
+
return;
|
|
3245
|
+
cleanup();
|
|
3246
|
+
if (msg.traceEvents) {
|
|
3247
|
+
builderSpan?.reportChildEvents(msg.traceEvents);
|
|
3248
|
+
}
|
|
3249
|
+
if (msg.error) {
|
|
3250
|
+
reject(toError(msg.error));
|
|
3251
|
+
} else
|
|
3252
|
+
resolve2();
|
|
3253
|
+
}
|
|
3254
|
+
function onExit(code, signal) {
|
|
3255
|
+
cleanup();
|
|
3256
|
+
reject(
|
|
3257
|
+
new Error(
|
|
3258
|
+
`Builder exited with ${signal || code} before running pre-deploy`
|
|
3259
|
+
)
|
|
3260
|
+
);
|
|
3261
|
+
}
|
|
3262
|
+
function onError(err) {
|
|
3263
|
+
cleanup();
|
|
3264
|
+
reject(err);
|
|
3265
|
+
}
|
|
3266
|
+
function cleanup() {
|
|
3267
|
+
child.removeListener("close", onExit);
|
|
3268
|
+
child.removeListener("message", onMessage);
|
|
3269
|
+
child.removeListener("error", onError);
|
|
3270
|
+
}
|
|
3271
|
+
child.on("close", onExit);
|
|
3272
|
+
child.on("message", onMessage);
|
|
3273
|
+
child.on("error", onError);
|
|
3274
|
+
try {
|
|
3275
|
+
child.send({ type: "runPreDeploy" }, (err) => {
|
|
3276
|
+
if (err)
|
|
3277
|
+
onError(err);
|
|
3278
|
+
});
|
|
3279
|
+
} catch (err) {
|
|
3280
|
+
onError(err);
|
|
3281
|
+
}
|
|
3282
|
+
});
|
|
3283
|
+
}
|
|
3284
|
+
async diagnostics() {
|
|
3285
|
+
return this.diagnosticsResult;
|
|
3286
|
+
}
|
|
3287
|
+
teardown() {
|
|
3288
|
+
const { child } = this;
|
|
3289
|
+
if (!child)
|
|
3290
|
+
return;
|
|
3291
|
+
if (child.connected)
|
|
3292
|
+
child.disconnect();
|
|
3293
|
+
if (child.exitCode === null && child.signalCode === null) {
|
|
3294
|
+
child.kill();
|
|
3295
|
+
}
|
|
3296
|
+
output_manager_default.debug(
|
|
3297
|
+
`Build subprocess for "${this.ctx.buildOptions.entrypoint}" finished`
|
|
3298
|
+
);
|
|
3299
|
+
this.child = void 0;
|
|
3300
|
+
}
|
|
3301
|
+
};
|
|
3302
|
+
|
|
2861
3303
|
// src/util/build/scrub-argv.ts
|
|
2862
3304
|
function scrubArgv(argv) {
|
|
2863
3305
|
const clonedArgv = [...argv];
|
|
@@ -2917,8 +3359,8 @@ var BuildTelemetryClient = class extends TelemetryClient {
|
|
|
2917
3359
|
};
|
|
2918
3360
|
|
|
2919
3361
|
// src/util/build/repo-root.ts
|
|
2920
|
-
import { existsSync, readFileSync } from "fs";
|
|
2921
|
-
import { dirname, join, parse, relative } from "path";
|
|
3362
|
+
import { existsSync, readFileSync as readFileSync2 } from "fs";
|
|
3363
|
+
import { dirname, join as join2, parse, relative } from "path";
|
|
2922
3364
|
var import_minimatch = __toESM(require_minimatch(), 1);
|
|
2923
3365
|
function findWorkspaceRootCandidates(startDir) {
|
|
2924
3366
|
const { root } = parse(startDir);
|
|
@@ -2939,13 +3381,13 @@ function findWorkspaceRootCandidates(startDir) {
|
|
|
2939
3381
|
return candidates;
|
|
2940
3382
|
}
|
|
2941
3383
|
function workspaceTypeOf(dir) {
|
|
2942
|
-
if (existsSync(
|
|
3384
|
+
if (existsSync(join2(dir, "pnpm-workspace.yaml"))) {
|
|
2943
3385
|
return "pnpm";
|
|
2944
3386
|
}
|
|
2945
|
-
const pkgPath =
|
|
3387
|
+
const pkgPath = join2(dir, "package.json");
|
|
2946
3388
|
if (existsSync(pkgPath)) {
|
|
2947
3389
|
try {
|
|
2948
|
-
const pkg = JSON.parse(
|
|
3390
|
+
const pkg = JSON.parse(readFileSync2(pkgPath, "utf8"));
|
|
2949
3391
|
const { workspaces } = pkg;
|
|
2950
3392
|
if (Array.isArray(workspaces) && workspaces.length > 0 || workspaces && typeof workspaces === "object" && Array.isArray(workspaces.packages) && workspaces.packages.length > 0) {
|
|
2951
3393
|
return "npm";
|
|
@@ -2959,13 +3401,13 @@ function readWorkspacePatterns(candidate) {
|
|
|
2959
3401
|
try {
|
|
2960
3402
|
if (candidate.type === "pnpm") {
|
|
2961
3403
|
const doc = js_yaml_default.load(
|
|
2962
|
-
|
|
3404
|
+
readFileSync2(join2(candidate.dir, "pnpm-workspace.yaml"), "utf8")
|
|
2963
3405
|
);
|
|
2964
3406
|
const packages2 = doc?.packages;
|
|
2965
3407
|
return Array.isArray(packages2) ? packages2.filter((p) => typeof p === "string") : null;
|
|
2966
3408
|
}
|
|
2967
3409
|
const pkg = JSON.parse(
|
|
2968
|
-
|
|
3410
|
+
readFileSync2(join2(candidate.dir, "package.json"), "utf8")
|
|
2969
3411
|
);
|
|
2970
3412
|
const { workspaces } = pkg;
|
|
2971
3413
|
const packages = Array.isArray(workspaces) ? workspaces : workspaces?.packages;
|
|
@@ -2996,7 +3438,7 @@ function workspaceClaims(candidate, memberDir) {
|
|
|
2996
3438
|
if (!positives.some(matches) || negatives.some(matches)) {
|
|
2997
3439
|
return false;
|
|
2998
3440
|
}
|
|
2999
|
-
return existsSync(
|
|
3441
|
+
return existsSync(join2(memberDir, "package.json"));
|
|
3000
3442
|
}
|
|
3001
3443
|
function resolvePerDirectoryLinkRoot(anchorDir, rootDirectorySetting) {
|
|
3002
3444
|
let repoRoot = anchorDir;
|
|
@@ -3014,18 +3456,18 @@ function resolvePerDirectoryLinkRoot(anchorDir, rootDirectorySetting) {
|
|
|
3014
3456
|
if (setting === "") {
|
|
3015
3457
|
return { repoRoot, resolvedRootDirectory: linkLocation };
|
|
3016
3458
|
}
|
|
3017
|
-
if (existsSync(
|
|
3459
|
+
if (existsSync(join2(anchorDir, setting))) {
|
|
3018
3460
|
return {
|
|
3019
3461
|
repoRoot,
|
|
3020
3462
|
resolvedRootDirectory: normalizeRelative(
|
|
3021
|
-
relative(repoRoot,
|
|
3463
|
+
relative(repoRoot, join2(anchorDir, setting))
|
|
3022
3464
|
)
|
|
3023
3465
|
};
|
|
3024
3466
|
}
|
|
3025
3467
|
return {
|
|
3026
3468
|
repoRoot,
|
|
3027
3469
|
resolvedRootDirectory: linkLocation,
|
|
3028
|
-
advisory: `Ignoring "rootDirectory" setting "${setting}" for the project linked in "${anchorDir}": "${
|
|
3470
|
+
advisory: `Ignoring "rootDirectory" setting "${setting}" for the project linked in "${anchorDir}": "${join2(anchorDir, setting)}" does not exist, so the build will use the linked directory "${linkLocation}" instead. Remove the "rootDirectory" setting, or configure it at the repository root.`
|
|
3029
3471
|
};
|
|
3030
3472
|
}
|
|
3031
3473
|
function normalizeRelative(p) {
|
|
@@ -3034,6 +3476,18 @@ function normalizeRelative(p) {
|
|
|
3034
3476
|
}
|
|
3035
3477
|
|
|
3036
3478
|
// src/commands/build/index.ts
|
|
3479
|
+
function createBuildRunner({
|
|
3480
|
+
ctx,
|
|
3481
|
+
hasDetectedServices,
|
|
3482
|
+
builderPath,
|
|
3483
|
+
hasBuildCallback
|
|
3484
|
+
}) {
|
|
3485
|
+
return canBuildInSubprocess({
|
|
3486
|
+
hasDetectedServices,
|
|
3487
|
+
builderPath,
|
|
3488
|
+
hasBuildCallback
|
|
3489
|
+
}) ? new SubprocessBuildRunner(ctx) : void 0;
|
|
3490
|
+
}
|
|
3037
3491
|
function buildCommandWithGlobalFlags(baseSubcommand, argv) {
|
|
3038
3492
|
const globalFlags = getGlobalFlagsFromArgs(argv.slice(2));
|
|
3039
3493
|
const full = globalFlags.length ? `${baseSubcommand} ${globalFlags.join(" ")}` : baseSubcommand;
|
|
@@ -3138,7 +3592,7 @@ async function main(client) {
|
|
|
3138
3592
|
if (link?.repoRoot) {
|
|
3139
3593
|
cwd = client.cwd = link.repoRoot;
|
|
3140
3594
|
}
|
|
3141
|
-
const vercelDir =
|
|
3595
|
+
const vercelDir = join3(cwd, projectRootDirectory, VERCEL_DIR);
|
|
3142
3596
|
let project = await rootSpan.child("vc.readProjectSettings").trace(() => readProjectSettings(vercelDir));
|
|
3143
3597
|
const isTTY = process.stdin.isTTY;
|
|
3144
3598
|
while (!project?.settings) {
|
|
@@ -3205,7 +3659,7 @@ async function main(client) {
|
|
|
3205
3659
|
return 0;
|
|
3206
3660
|
}
|
|
3207
3661
|
const { argv: originalArgv } = client;
|
|
3208
|
-
client.cwd =
|
|
3662
|
+
client.cwd = join3(cwd, projectRootDirectory);
|
|
3209
3663
|
client.setArgv([
|
|
3210
3664
|
...originalArgv.slice(0, 2),
|
|
3211
3665
|
"pull",
|
|
@@ -3244,9 +3698,9 @@ async function main(client) {
|
|
|
3244
3698
|
cwd = client.cwd = resolved.repoRoot;
|
|
3245
3699
|
}
|
|
3246
3700
|
}
|
|
3247
|
-
const defaultOutputDir =
|
|
3701
|
+
const defaultOutputDir = join3(cwd, projectRootDirectory, import_write_build_result.OUTPUT_DIR);
|
|
3248
3702
|
const outputDir = parsedArgs.flags["--output"] ? resolve(parsedArgs.flags["--output"]) : defaultOutputDir;
|
|
3249
|
-
client.traceDiagnosticsPath =
|
|
3703
|
+
client.traceDiagnosticsPath = join3(
|
|
3250
3704
|
outputDir,
|
|
3251
3705
|
"diagnostics",
|
|
3252
3706
|
"cli_traces.json"
|
|
@@ -3291,7 +3745,7 @@ async function main(client) {
|
|
|
3291
3745
|
`Loaded ${Object.keys(buildEnv).length} environment variables from deployment ${deploymentId}`
|
|
3292
3746
|
);
|
|
3293
3747
|
} else {
|
|
3294
|
-
const envPath =
|
|
3748
|
+
const envPath = join3(
|
|
3295
3749
|
cwd,
|
|
3296
3750
|
projectRootDirectory,
|
|
3297
3751
|
VERCEL_DIR,
|
|
@@ -3338,6 +3792,7 @@ async function main(client) {
|
|
|
3338
3792
|
},
|
|
3339
3793
|
{
|
|
3340
3794
|
output: output_manager_default,
|
|
3795
|
+
createBuildRunner,
|
|
3341
3796
|
importBuilders,
|
|
3342
3797
|
formatResolvedBuilders: import_import_builders.formatResolvedBuilders,
|
|
3343
3798
|
writeBuildResult,
|
|
@@ -3424,8 +3879,8 @@ async function main(client) {
|
|
|
3424
3879
|
}
|
|
3425
3880
|
output_manager_default.prettyError(err);
|
|
3426
3881
|
buildsJson.error = toEnumerableError(err);
|
|
3427
|
-
const buildsJsonPath =
|
|
3428
|
-
const configJsonPath =
|
|
3882
|
+
const buildsJsonPath = join3(outputDir, "builds.json");
|
|
3883
|
+
const configJsonPath = join3(outputDir, "config.json");
|
|
3429
3884
|
await import_fs_extra.default.outputJSON(buildsJsonPath, buildsJson, {
|
|
3430
3885
|
spaces: 2
|
|
3431
3886
|
});
|
|
@@ -3470,7 +3925,7 @@ async function analyzeVcConfigFiles(cwd, outputDir) {
|
|
|
3470
3925
|
const filesObject = await glob("**/.vc-config.json", {
|
|
3471
3926
|
cwd: outputDir
|
|
3472
3927
|
});
|
|
3473
|
-
const vcConfigFiles = Object.keys(filesObject).filter((relativePath) => !relativePath.includes(".rsc.func")).map((relativePath) =>
|
|
3928
|
+
const vcConfigFiles = Object.keys(filesObject).filter((relativePath) => !relativePath.includes(".rsc.func")).map((relativePath) => join3(outputDir, relativePath));
|
|
3474
3929
|
if (vcConfigFiles.length === 0) {
|
|
3475
3930
|
output_manager_default.print("No functions to analyze.\n");
|
|
3476
3931
|
return;
|
|
@@ -3538,7 +3993,7 @@ async function analyzeSingleFunction(file, cwd, outputDir) {
|
|
|
3538
3993
|
(entry) => typeof entry[1] === "string"
|
|
3539
3994
|
).map(([bundlePath, sourcePath]) => ({
|
|
3540
3995
|
bundlePath,
|
|
3541
|
-
sourcePath:
|
|
3996
|
+
sourcePath: join3(cwd, sourcePath)
|
|
3542
3997
|
})) : [];
|
|
3543
3998
|
const fsRefStats = getTotalFileSizeInMB(filePathMap);
|
|
3544
3999
|
const totalSize = funcDirStats.size + fsRefStats.size;
|
|
@@ -3577,7 +4032,7 @@ function getDirectorySizeInMB(dir) {
|
|
|
3577
4032
|
const entries = readdirSync(dir, { recursive: true });
|
|
3578
4033
|
for (const entry of entries) {
|
|
3579
4034
|
const entryPath = typeof entry === "string" ? entry : entry.toString();
|
|
3580
|
-
const fullPath =
|
|
4035
|
+
const fullPath = join3(dir, entryPath);
|
|
3581
4036
|
try {
|
|
3582
4037
|
const stats = statSync(fullPath);
|
|
3583
4038
|
if (stats.isFile()) {
|