vercel 59.4.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-FQMB3XPM.js → add-4GQZ22ZN.js} +20 -16
- package/dist/chunks/{add-73X2SKBH.js → add-HJSEM4YJ.js} +17 -13
- package/dist/chunks/{add-QJ3WT4FW.js → add-SIGUSM3Y.js} +21 -17
- package/dist/chunks/{build-YUYCLCXD.js → build-XOMJDX4M.js} +18 -15
- package/dist/chunks/{chunk-F7OXZLY2.js → chunk-26XDDLXM.js} +2 -2
- package/dist/chunks/{chunk-VCE6QKFE.js → chunk-2O5J3KMT.js} +4 -4
- package/dist/chunks/{chunk-XI6NJLI4.js → chunk-2YRAWYGE.js} +3 -3
- package/dist/chunks/{chunk-X6O6XJEA.js → chunk-37V5P4VO.js} +16 -14
- package/dist/chunks/{chunk-EB7NJKPL.js → chunk-3F5EGINT.js} +3 -3
- package/dist/chunks/{chunk-RIB4S2IB.js → chunk-3HZLXCVL.js} +1 -1
- package/dist/chunks/{chunk-KQRVZWJU.js → chunk-3T7WSWZH.js} +1 -1
- package/dist/chunks/{chunk-3KNPVXJ3.js → chunk-4KD5BYHB.js} +1 -1
- package/dist/chunks/{chunk-XLKFJPMT.js → chunk-57RHXXXG.js} +1 -1
- package/dist/chunks/chunk-5GGUB4EO.js +31 -0
- package/dist/chunks/{chunk-R6IGDGX3.js → chunk-5XECIWME.js} +1 -1
- package/dist/chunks/{chunk-KAYSW4CJ.js → chunk-6JPVTPTU.js} +3 -3
- package/dist/chunks/{chunk-ZFWNMVNR.js → chunk-6M2KZUED.js} +19 -8
- package/dist/chunks/{chunk-HT2XWSAJ.js → chunk-7AEEQOD4.js} +2 -29
- package/dist/chunks/{chunk-HURL5EBN.js → chunk-7HE63HCR.js} +124 -161
- package/dist/chunks/chunk-7Q45OKWR.js +149 -0
- package/dist/chunks/{chunk-RI7KKKII.js → chunk-7R6M3BHM.js} +4 -18
- package/dist/chunks/{chunk-XBN2O34P.js → chunk-7ST552E3.js} +17 -4
- package/dist/chunks/{chunk-JKQWQA2T.js → chunk-AINIBIP4.js} +1 -1
- package/dist/chunks/{chunk-CV4S27SS.js → chunk-ASBP32T6.js} +1 -1
- package/dist/chunks/chunk-AYLY3ZVL.js +104 -0
- package/dist/chunks/{chunk-SOFC4MLS.js → chunk-BMKU5KEL.js} +9 -569
- package/dist/chunks/{chunk-KDYRLN6H.js → chunk-C5HKWXRR.js} +1 -1
- package/dist/chunks/{chunk-2MF3ZAVW.js → chunk-CJV7J7B5.js} +6 -6
- package/dist/chunks/{chunk-HJVTLJHO.js → chunk-DE7MBNHQ.js} +6 -6
- package/dist/chunks/{chunk-3L2YLLHC.js → chunk-DWIC7MRV.js} +2 -2
- package/dist/chunks/{chunk-GFCTRJI5.js → chunk-EZKW5YJ2.js} +1 -1
- package/dist/chunks/{chunk-MWYQ24FO.js → chunk-FRAXI2WT.js} +3 -3
- package/dist/chunks/{chunk-DDIZGOCK.js → chunk-FRZULOVH.js} +8 -6
- package/dist/chunks/{chunk-Y3J4VU2H.js → chunk-FWKSJYDV.js} +2 -2
- package/dist/chunks/chunk-FXD67VN5.js +467 -0
- package/dist/chunks/{chunk-EB5NBVTV.js → chunk-GISTGGBO.js} +8 -8
- package/dist/chunks/chunk-GY5I4AYD.js +122 -0
- package/dist/chunks/{chunk-PD4DYNSB.js → chunk-GZQQNLF5.js} +5 -5
- package/dist/chunks/{chunk-PIMIKY4X.js → chunk-IJ4X426J.js} +1 -1
- package/dist/chunks/{chunk-KSZ4MNHO.js → chunk-JH4WQRIU.js} +2 -2
- package/dist/chunks/{chunk-TVXCXIRO.js → chunk-L3UXB2CW.js} +1 -1
- package/dist/chunks/{chunk-O5DLWLT7.js → chunk-LXZVOR6F.js} +9 -9
- package/dist/chunks/{chunk-EG5BSAXD.js → chunk-MTWHQEXI.js} +1 -1
- package/dist/chunks/{chunk-WC7IINFV.js → chunk-NFU4XJIR.js} +1 -1
- package/dist/chunks/{chunk-TH2XUVDP.js → chunk-NGGLYKNU.js} +30 -6
- package/dist/chunks/{chunk-2PX6N4FE.js → chunk-NGNN6WF2.js} +10 -10
- package/dist/chunks/{chunk-GGPE5377.js → chunk-O26N2UPI.js} +1 -1
- package/dist/chunks/chunk-O75LSD3C.js +34 -0
- package/dist/chunks/{chunk-BBSS3XIW.js → chunk-OQ3C5VXZ.js} +1 -1
- package/dist/chunks/{chunk-M22O6CYY.js → chunk-POOO7W47.js} +1 -1
- package/dist/chunks/{chunk-LKTQR5JE.js → chunk-PRH6KRUT.js} +2 -2
- package/dist/chunks/chunk-Q2DGFCO7.js +579 -0
- package/dist/chunks/{chunk-OX7KI3LF.js → chunk-QFAS4OVW.js} +18 -0
- package/dist/chunks/{chunk-CHEZBD7H.js → chunk-R5PULMHT.js} +3 -3
- package/dist/chunks/{chunk-VAFU7DXZ.js → chunk-RKDCNQ4S.js} +1 -91
- package/dist/chunks/{chunk-BLYBHFIE.js → chunk-SF3AYAIF.js} +61 -24
- package/dist/chunks/{chunk-GMWRTZVZ.js → chunk-SLPSPYVR.js} +1 -1
- package/dist/chunks/{chunk-J5Y2QGGU.js → chunk-SWI6F4X3.js} +2 -2
- package/dist/chunks/chunk-V3MDDR2X.js +249 -0
- package/dist/chunks/{chunk-HMJVUXE6.js → chunk-VJ5NAOWB.js} +867 -625
- package/dist/chunks/{chunk-O5GNPPTU.js → chunk-VP5Y3SZG.js} +1 -1
- package/dist/chunks/{chunk-G75NFPIT.js → chunk-WNAKOXGK.js} +1 -1
- package/dist/chunks/{chunk-NP6BQPCN.js → chunk-WZ2S3A2A.js} +8 -6
- package/dist/chunks/{chunk-7QVJTI5H.js → chunk-XDGOOW3K.js} +1 -1
- package/dist/chunks/{chunk-UMA66MKW.js → chunk-XM3LOQIX.js} +1 -1
- package/dist/chunks/{chunk-CYNB6LL4.js → chunk-XNFHNTS2.js} +1 -1
- package/dist/chunks/{chunk-VDJN4WKH.js → chunk-XRWOTCDO.js} +1 -1
- package/dist/chunks/{chunk-UV2ZMFVG.js → chunk-YJKZQEHS.js} +2 -2
- package/dist/chunks/{chunk-STPH4Y62.js → chunk-YJUO3EKH.js} +1 -1
- package/dist/chunks/{chunk-Y42SPI2H.js → chunk-ZNMTDLYH.js} +6 -6
- package/dist/chunks/{chunk-VLPLCJZC.js → chunk-ZSFEACZU.js} +1 -1
- package/dist/chunks/{clear-USQM5VW5.js → clear-BWT2FJY4.js} +17 -13
- package/dist/chunks/{compile-vercel-config-2JNYMI6W.js → compile-vercel-config-DGM4NISW.js} +10 -7
- package/dist/chunks/{config-VTRIDLY4.js → config-NJAN3RMU.js} +20 -16
- package/dist/chunks/config-RSE6Z4LB.js +122 -0
- package/dist/chunks/{constants-YMCRE6IG.js → constants-WEQVJSYS.js} +1 -1
- package/dist/chunks/{delete-ILLSBCVQ.js → delete-LROBRBAH.js} +15 -11
- package/dist/chunks/{delete-VTPHK3EB.js → delete-SSL2PK2F.js} +12 -9
- package/dist/chunks/{disable-VTOMO64V.js → disable-ASG5JDZR.js} +12 -9
- package/dist/chunks/{discard-ZIOZ34ZI.js → discard-PV47B6IL.js} +12 -9
- package/dist/chunks/{edit-E3AMR4KM.js → edit-5ATYIOLX.js} +14 -11
- package/dist/chunks/{edit-JMZ5XWVW.js → edit-REI7HXGG.js} +16 -12
- package/dist/chunks/{enable-A4PMZ7QZ.js → enable-LZXL7XAG.js} +12 -9
- package/dist/chunks/{exec-CNBOV577.js → exec-XH4K34JM.js} +3 -3
- package/dist/chunks/{export-Y6AJ3WRZ.js → export-ZAZFQU2E.js} +12 -9
- package/dist/chunks/{image-26BKPAUB.js → image-QPHN5V7L.js} +7 -6
- package/dist/chunks/{import-builders-3H7J2SEK.js → import-builders-W3YE2V6A.js} +12 -9
- package/dist/chunks/{inspect-7DGKYHKW.js → inspect-BFGK72WY.js} +18 -14
- package/dist/chunks/{inspect-OEY4DJRI.js → inspect-FRXJRM6T.js} +18 -14
- package/dist/chunks/{inspect-ZW5N6O5P.js → inspect-RDMC2Z3Q.js} +17 -13
- package/dist/chunks/{inspect-GJFVAZIJ.js → inspect-SJEZVGPK.js} +20 -16
- package/dist/chunks/{inspect-N3E2PO6K.js → inspect-SSOM3FXS.js} +17 -13
- package/dist/chunks/{list-MIQ5D6PM.js → list-2HTR7Q3J.js} +18 -14
- package/dist/chunks/{list-2VTCNQEB.js → list-PHDUZVMR.js} +15 -11
- package/dist/chunks/{list-DTJBW7OQ.js → list-W33GXKDA.js} +18 -14
- package/dist/chunks/{login-L34UHAU5.js → login-JWAFHVDG.js} +30 -17
- package/dist/chunks/{ls-OBUDC4SB.js → ls-3AN2DZHN.js} +20 -15
- package/dist/chunks/{ls-SXJFBLUT.js → ls-3MH2OCP3.js} +20 -15
- package/dist/chunks/ls-D2POUHI7.js +176 -0
- package/dist/chunks/{ls-VDYUFSSC.js → ls-KDFU224B.js} +20 -15
- package/dist/chunks/{ls-OKO4IHWB.js → ls-KX2VBOGV.js} +18 -14
- package/dist/chunks/{ls-NCPQY4FV.js → ls-RWKNJQNT.js} +23 -18
- package/dist/chunks/{open-V5JDGXUP.js → open-IEYRB6RL.js} +15 -11
- package/dist/chunks/{permissions-6CPRPPBY.js → permissions-ZWZUMEHR.js} +10 -9
- package/dist/chunks/{publish-R27DPHFO.js → publish-UWZYBDHK.js} +12 -9
- package/dist/chunks/{push-VLVTBS42.js → push-IAEQ3FBF.js} +18 -15
- package/dist/chunks/{query-IVVRYMJN.js → query-NNOZYSED.js} +18 -14
- package/dist/chunks/{reorder-LJ2RBZM2.js → reorder-TKBM244W.js} +12 -9
- package/dist/chunks/{reply-USAISZYC.js → reply-FLBSBMTW.js} +16 -12
- package/dist/chunks/{resolve-CRCJYVS5.js → resolve-GJYPMWUE.js} +15 -11
- package/dist/chunks/{restore-6PBPEAMU.js → restore-PNI3TM3U.js} +12 -9
- package/dist/chunks/{rm-HHELZB7R.js → rm-76CSSSSV.js} +17 -13
- package/dist/chunks/{rm-TWU3JR6Z.js → rm-FN7LTIIL.js} +17 -13
- package/dist/chunks/{rm-KGOEOWVK.js → rm-FTE33UHE.js} +16 -12
- package/dist/chunks/rm-FXA5DLXQ.js +315 -0
- package/dist/chunks/{rm-EOD7RDSO.js → rm-PGJ4KR6U.js} +20 -16
- package/dist/chunks/{routes-SZI2G4SE.js → routes-2OLIBRYX.js} +3 -3
- package/dist/chunks/{rule-inspect-WFTVRK6B.js → rule-inspect-LJIGPTWS.js} +18 -14
- package/dist/chunks/{rules-AQYTFJI6.js → rules-6BMNO6M5.js} +11 -10
- package/dist/chunks/{schema-LUVFYPWN.js → schema-45SJNY5L.js} +9 -7
- package/dist/chunks/{schema-ZCDCJC7E.js → schema-HATXEQDP.js} +14 -11
- package/dist/chunks/set-C3UQUQ42.js +243 -0
- package/dist/chunks/{tags-RCNRFX7U.js → tags-BTVDROFG.js} +6 -5
- package/dist/chunks/{types-AJHILHO5.js → types-JGANJ5EQ.js} +12 -8
- package/dist/chunks/{update-I7QGAOYF.js → update-B6PSOHUW.js} +19 -15
- package/dist/commands/build/builder-worker.cjs +281 -0
- package/dist/commands/build/index.js +695 -236
- package/dist/commands/deploy/index.js +131 -50
- package/dist/commands/dev/index.js +677 -144
- package/dist/commands/env/index.js +1199 -565
- package/dist/commands/link/index.js +27 -22
- package/dist/commands/list/index.js +21 -14
- package/dist/commands-bulk.js +2051 -1019
- package/dist/help.js +1 -1
- package/dist/index.js +39 -33
- package/dist/version.mjs +1 -1
- package/package.json +48 -48
|
@@ -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,25 +63,29 @@ import {
|
|
|
63
63
|
resolveProjectCwd,
|
|
64
64
|
ua_default,
|
|
65
65
|
validateConfig
|
|
66
|
-
} from "../../chunks/chunk-
|
|
66
|
+
} from "../../chunks/chunk-VJ5NAOWB.js";
|
|
67
|
+
import "../../chunks/chunk-FXD67VN5.js";
|
|
67
68
|
import {
|
|
68
69
|
TelemetryClient
|
|
69
|
-
} from "../../chunks/chunk-
|
|
70
|
+
} from "../../chunks/chunk-XNFHNTS2.js";
|
|
70
71
|
import {
|
|
71
72
|
AGENT_REASON,
|
|
72
73
|
AGENT_STATUS,
|
|
73
74
|
outputAgentError
|
|
74
|
-
} from "../../chunks/chunk-
|
|
75
|
+
} from "../../chunks/chunk-NGGLYKNU.js";
|
|
75
76
|
import "../../chunks/chunk-GGP5R3FU.js";
|
|
76
77
|
import {
|
|
77
78
|
printError,
|
|
78
79
|
toEnumerableError
|
|
79
|
-
} from "../../chunks/chunk-
|
|
80
|
+
} from "../../chunks/chunk-AYLY3ZVL.js";
|
|
80
81
|
import {
|
|
81
82
|
parseArguments
|
|
82
|
-
} from "../../chunks/chunk-
|
|
83
|
+
} from "../../chunks/chunk-57RHXXXG.js";
|
|
84
|
+
import "../../chunks/chunk-RKDCNQ4S.js";
|
|
85
|
+
import {
|
|
86
|
+
CantParseJSONFile
|
|
87
|
+
} from "../../chunks/chunk-BMKU5KEL.js";
|
|
83
88
|
import {
|
|
84
|
-
CantParseJSONFile,
|
|
85
89
|
cmd,
|
|
86
90
|
getCommandName,
|
|
87
91
|
getCommandNamePlain,
|
|
@@ -89,7 +93,7 @@ import {
|
|
|
89
93
|
getGlobalFlagsFromArgs,
|
|
90
94
|
packageName,
|
|
91
95
|
require_lib as require_lib2
|
|
92
|
-
} from "../../chunks/chunk-
|
|
96
|
+
} from "../../chunks/chunk-Q2DGFCO7.js";
|
|
93
97
|
import {
|
|
94
98
|
pkg_default
|
|
95
99
|
} from "../../chunks/chunk-P4QNYOFB.js";
|
|
@@ -98,7 +102,7 @@ import {
|
|
|
98
102
|
emoji,
|
|
99
103
|
output_manager_default,
|
|
100
104
|
prependEmoji
|
|
101
|
-
} from "../../chunks/chunk-
|
|
105
|
+
} from "../../chunks/chunk-QFAS4OVW.js";
|
|
102
106
|
import {
|
|
103
107
|
require_source
|
|
104
108
|
} from "../../chunks/chunk-S7KYDPEM.js";
|
|
@@ -108,6 +112,57 @@ import {
|
|
|
108
112
|
__toESM
|
|
109
113
|
} from "../../chunks/chunk-TZ2YI2VH.js";
|
|
110
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
|
+
|
|
111
166
|
// ../../internals/builder-orchestration/dist/sort-builders.js
|
|
112
167
|
var require_sort_builders = __commonJS({
|
|
113
168
|
"../../internals/builder-orchestration/dist/sort-builders.js"(exports, module) {
|
|
@@ -179,16 +234,28 @@ var require_execute_builder = __commonJS({
|
|
|
179
234
|
});
|
|
180
235
|
module.exports = __toCommonJS(execute_builder_exports);
|
|
181
236
|
var import_sort_builders = require_sort_builders();
|
|
237
|
+
var import_build_runner2 = require_build_runner();
|
|
182
238
|
async function executeBuilder2({
|
|
183
239
|
builder,
|
|
184
240
|
buildOptions,
|
|
185
241
|
span,
|
|
186
242
|
isFrontendBuilder,
|
|
187
243
|
hasDetectedServices,
|
|
188
|
-
framework
|
|
244
|
+
framework,
|
|
245
|
+
runner
|
|
189
246
|
}) {
|
|
190
|
-
const
|
|
191
|
-
|
|
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;
|
|
192
259
|
if (!hasDetectedServices && buildOptions.config.zeroConfig && isFrontendBuilder && "output" in buildResult && !buildResult.routes && framework) {
|
|
193
260
|
buildResult.routes = await getFrameworkRoutes(
|
|
194
261
|
framework,
|
|
@@ -234,7 +301,7 @@ var require_backend_rewrite_warning = __commonJS({
|
|
|
234
301
|
hasBackendRewriteBehaviorChange: () => hasBackendRewriteBehaviorChange
|
|
235
302
|
});
|
|
236
303
|
module.exports = __toCommonJS(backend_rewrite_warning_exports);
|
|
237
|
-
var
|
|
304
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
238
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.";
|
|
239
306
|
function hasInternalPathRewrite(rewrites) {
|
|
240
307
|
return rewrites?.some(
|
|
@@ -242,7 +309,7 @@ var require_backend_rewrite_warning = __commonJS({
|
|
|
242
309
|
) ?? false;
|
|
243
310
|
}
|
|
244
311
|
function isAffectedFramework(framework) {
|
|
245
|
-
return framework === "go" || framework === "container" || (0,
|
|
312
|
+
return framework === "go" || framework === "container" || (0, import_build_utils3.isPythonFramework)(framework) || (0, import_build_utils3.isNodeBackendFramework)(framework);
|
|
246
313
|
}
|
|
247
314
|
function hasBackendRewriteBehaviorChange({
|
|
248
315
|
projectRewrites,
|
|
@@ -346,13 +413,13 @@ var require_validate_cron_secret = __commonJS({
|
|
|
346
413
|
validateCronSecret: () => validateCronSecret
|
|
347
414
|
});
|
|
348
415
|
module.exports = __toCommonJS(validate_cron_secret_exports);
|
|
349
|
-
var
|
|
416
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
350
417
|
function validateCronSecret(cronSecret) {
|
|
351
418
|
if (!cronSecret) {
|
|
352
419
|
return null;
|
|
353
420
|
}
|
|
354
421
|
if (cronSecret !== cronSecret.trim()) {
|
|
355
|
-
return new
|
|
422
|
+
return new import_build_utils3.NowBuildError({
|
|
356
423
|
code: "INVALID_CRON_SECRET",
|
|
357
424
|
message: "The `CRON_SECRET` environment variable contains leading or trailing whitespace, which is not allowed in HTTP header values.",
|
|
358
425
|
link: "https://vercel.link/securing-cron-jobs",
|
|
@@ -384,7 +451,7 @@ var require_validate_cron_secret = __commonJS({
|
|
|
384
451
|
});
|
|
385
452
|
const moreCount = invalidChars.length - 3;
|
|
386
453
|
const moreText = moreCount > 0 ? `, and ${moreCount} more` : "";
|
|
387
|
-
return new
|
|
454
|
+
return new import_build_utils3.NowBuildError({
|
|
388
455
|
code: "INVALID_CRON_SECRET",
|
|
389
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.`,
|
|
390
457
|
link: "https://vercel.link/securing-cron-jobs",
|
|
@@ -433,9 +500,9 @@ var require_validate_package_manifest = __commonJS({
|
|
|
433
500
|
});
|
|
434
501
|
module.exports = __toCommonJS(validate_package_manifest_exports);
|
|
435
502
|
var import_ajv = __toESM2(require_ajv());
|
|
436
|
-
var
|
|
503
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
437
504
|
var ajv = new import_ajv.default();
|
|
438
|
-
var validate = ajv.compile(
|
|
505
|
+
var validate = ajv.compile(import_build_utils3.packageManifestSchema);
|
|
439
506
|
function validatePackageManifest(data) {
|
|
440
507
|
if (validate(data)) {
|
|
441
508
|
return null;
|
|
@@ -473,7 +540,7 @@ var require_manifest = __commonJS({
|
|
|
473
540
|
});
|
|
474
541
|
module.exports = __toCommonJS(manifest_exports);
|
|
475
542
|
var import_path2 = __require("path");
|
|
476
|
-
var
|
|
543
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
477
544
|
async function writeManifests(packageManifests, diagnostics, ops, outputDir) {
|
|
478
545
|
if (packageManifests.length === 0)
|
|
479
546
|
return;
|
|
@@ -495,8 +562,8 @@ var require_manifest = __commonJS({
|
|
|
495
562
|
builder: builderUse,
|
|
496
563
|
framework,
|
|
497
564
|
serviceName: service?.name,
|
|
498
|
-
serviceType: service && (0,
|
|
499
|
-
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
|
|
500
567
|
};
|
|
501
568
|
const { version: _version, ...manifestWithoutVersion } = manifest;
|
|
502
569
|
deployManifestBuilds[key] = {
|
|
@@ -512,19 +579,19 @@ var require_manifest = __commonJS({
|
|
|
512
579
|
} else {
|
|
513
580
|
deployManifestServices[service.name] = {
|
|
514
581
|
builds: [key],
|
|
515
|
-
bindings: (0,
|
|
582
|
+
bindings: (0, import_build_utils3.isExperimentalServiceV2)(service) ? service.bindings : void 0
|
|
516
583
|
};
|
|
517
584
|
}
|
|
518
585
|
}
|
|
519
586
|
}
|
|
520
587
|
if (Object.keys(projectManifest).length === 0)
|
|
521
588
|
return;
|
|
522
|
-
const projectManifestBlob = new
|
|
589
|
+
const projectManifestBlob = new import_build_utils3.FileBlob({
|
|
523
590
|
data: JSON.stringify(projectManifest)
|
|
524
591
|
});
|
|
525
592
|
diagnostics["project-manifest.json"] = projectManifestBlob;
|
|
526
593
|
ops.push(
|
|
527
|
-
(0,
|
|
594
|
+
(0, import_build_utils3.downloadFile)(
|
|
528
595
|
projectManifestBlob,
|
|
529
596
|
(0, import_path2.join)(outputDir, "diagnostics", "project-manifest.json")
|
|
530
597
|
).then(
|
|
@@ -532,7 +599,7 @@ var require_manifest = __commonJS({
|
|
|
532
599
|
(err) => err
|
|
533
600
|
)
|
|
534
601
|
);
|
|
535
|
-
const deployManifestBlob = new
|
|
602
|
+
const deployManifestBlob = new import_build_utils3.FileBlob({
|
|
536
603
|
data: JSON.stringify({
|
|
537
604
|
manifestVersion: "2.0",
|
|
538
605
|
builds: deployManifestBuilds,
|
|
@@ -541,7 +608,7 @@ var require_manifest = __commonJS({
|
|
|
541
608
|
});
|
|
542
609
|
diagnostics["deploy-manifest.json"] = deployManifestBlob;
|
|
543
610
|
ops.push(
|
|
544
|
-
(0,
|
|
611
|
+
(0, import_build_utils3.downloadFile)(
|
|
545
612
|
deployManifestBlob,
|
|
546
613
|
(0, import_path2.join)(outputDir, "diagnostics", "deploy-manifest.json")
|
|
547
614
|
).then(
|
|
@@ -579,7 +646,7 @@ var require_build_embedding = __commonJS({
|
|
|
579
646
|
shouldEmbedFlagsDefinitions: () => shouldEmbedFlagsDefinitions
|
|
580
647
|
});
|
|
581
648
|
module.exports = __toCommonJS(build_embedding_exports);
|
|
582
|
-
var
|
|
649
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
583
650
|
function isFlagsEmbedOption(input) {
|
|
584
651
|
return input === "force-on" || input === "force-off";
|
|
585
652
|
}
|
|
@@ -601,8 +668,8 @@ var require_build_embedding = __commonJS({
|
|
|
601
668
|
if (envHasSdkKey()) {
|
|
602
669
|
return true;
|
|
603
670
|
}
|
|
604
|
-
const hasVercelFlags = await (0,
|
|
605
|
-
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);
|
|
606
673
|
if (hasVercelFlags || hasFlagsCore) {
|
|
607
674
|
return true;
|
|
608
675
|
}
|
|
@@ -650,49 +717,86 @@ var require_validate_build_output = __commonJS({
|
|
|
650
717
|
module.exports = __toCommonJS(validate_build_output_exports);
|
|
651
718
|
var import_fs_extra2 = __toESM2(require_lib());
|
|
652
719
|
var import_path2 = __require("path");
|
|
653
|
-
var
|
|
720
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
654
721
|
function logDebug(message, output) {
|
|
655
722
|
output?.debug(message);
|
|
656
|
-
(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
|
+
}
|
|
657
750
|
}
|
|
658
751
|
async function validateBuildOutput(outputDir, output) {
|
|
659
752
|
const problems = [];
|
|
660
753
|
logDebug(`Validating build output at "${outputDir}"`, output);
|
|
661
754
|
try {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
problems
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
severity: "error",
|
|
676
|
-
message: `Build output config.json is not valid JSON: ${err instanceof Error ? err.message : String(err)}.`
|
|
677
|
-
});
|
|
678
|
-
}
|
|
679
|
-
if (config && config.version !== 3) {
|
|
680
|
-
problems.push({
|
|
681
|
-
severity: "warning",
|
|
682
|
-
message: `Build output config.json has unexpected version "${config.version}" (expected 3).`
|
|
683
|
-
});
|
|
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;
|
|
684
768
|
}
|
|
685
769
|
}
|
|
686
770
|
const [hasFunctions, hasStatic] = await Promise.all([
|
|
687
771
|
import_fs_extra2.default.pathExists((0, import_path2.join)(outputDir, "functions")),
|
|
688
772
|
import_fs_extra2.default.pathExists((0, import_path2.join)(outputDir, "static"))
|
|
689
773
|
]);
|
|
690
|
-
|
|
774
|
+
const hasServices = serviceNames.length > 0;
|
|
775
|
+
if (!hasFunctions && !hasStatic && !hasServices) {
|
|
691
776
|
problems.push({
|
|
692
777
|
severity: "warning",
|
|
693
|
-
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.'
|
|
694
779
|
});
|
|
695
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
|
+
}
|
|
696
800
|
logDebug(
|
|
697
801
|
`Build output validation found ${problems.length} problem(s)` + (problems.length ? `: ${problems.map((p) => `${p.severity}: ${p.message}`).join("; ")}` : ""),
|
|
698
802
|
output
|
|
@@ -751,10 +855,10 @@ var require_framework_detection = __commonJS({
|
|
|
751
855
|
module.exports = __toCommonJS(framework_detection_exports);
|
|
752
856
|
var import_fs_detectors = require_dist2();
|
|
753
857
|
var import_frameworks = require_frameworks();
|
|
754
|
-
var
|
|
858
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
755
859
|
function logDebug(message, output) {
|
|
756
860
|
output?.debug(message);
|
|
757
|
-
(0,
|
|
861
|
+
(0, import_build_utils3.debug)(message);
|
|
758
862
|
}
|
|
759
863
|
function isFrameworkDetectionEnabled(output) {
|
|
760
864
|
const raw = process.env.VERCEL_FRAMEWORK_DETECTION;
|
|
@@ -775,7 +879,7 @@ var require_framework_detection = __commonJS({
|
|
|
775
879
|
return result;
|
|
776
880
|
}
|
|
777
881
|
async function detectFirstDeploymentFramework(options) {
|
|
778
|
-
const { workPath, projectSettings, output } = options;
|
|
882
|
+
const { workPath, projectSettings, frameworkExplicitlyConfigured, output } = options;
|
|
779
883
|
logDebug(
|
|
780
884
|
`First deployment: evaluating framework detection (workPath="${workPath}", configuredFramework=${projectSettings.framework ? `"${projectSettings.framework}"` : "<none>"})`,
|
|
781
885
|
output
|
|
@@ -787,7 +891,7 @@ var require_framework_detection = __commonJS({
|
|
|
787
891
|
);
|
|
788
892
|
return { status: "skipped" };
|
|
789
893
|
}
|
|
790
|
-
if (projectSettings.framework) {
|
|
894
|
+
if (frameworkExplicitlyConfigured || projectSettings.framework) {
|
|
791
895
|
logDebug(
|
|
792
896
|
`First deployment: skipping framework detection because a framework is already configured ("${projectSettings.framework}")`,
|
|
793
897
|
output
|
|
@@ -984,14 +1088,14 @@ var require_monorepo = __commonJS({
|
|
|
984
1088
|
var import_path2 = __require("path");
|
|
985
1089
|
var import_fs_detectors = require_dist2();
|
|
986
1090
|
var import_title = __toESM2(require_lib2());
|
|
987
|
-
var
|
|
1091
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
988
1092
|
async function setMonorepoDefaultSettings(cwd, workPath, projectSettings, output) {
|
|
989
1093
|
const localFileSystem = new import_fs_detectors.LocalFileSystemDetector(cwd);
|
|
990
1094
|
const projectName = (0, import_path2.basename)(workPath);
|
|
991
1095
|
const relativeToRoot = (0, import_path2.relative)(workPath, cwd);
|
|
992
1096
|
const setCommand = (command, value) => {
|
|
993
1097
|
if (projectSettings[command]) {
|
|
994
|
-
(0,
|
|
1098
|
+
(0, import_build_utils3.debug)(
|
|
995
1099
|
`Skipping auto-assignment of ${command} as it is already set via project settings or configuration overrides.`
|
|
996
1100
|
);
|
|
997
1101
|
} else {
|
|
@@ -1074,7 +1178,7 @@ var require_corepack = __commonJS({
|
|
|
1074
1178
|
});
|
|
1075
1179
|
module.exports = __toCommonJS(corepack_exports);
|
|
1076
1180
|
var import_path2 = __require("path");
|
|
1077
|
-
var
|
|
1181
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
1078
1182
|
var import_fs_extra2 = __toESM2(require_lib());
|
|
1079
1183
|
async function initCorepack({
|
|
1080
1184
|
repoRootPath,
|
|
@@ -1109,7 +1213,7 @@ var require_corepack = __commonJS({
|
|
|
1109
1213
|
process.env.COREPACK_HOME = corepackHomeDir;
|
|
1110
1214
|
process.env.PATH = `${corepackShimDir}${import_path2.delimiter}${process.env.PATH}`;
|
|
1111
1215
|
const pkgManagerName = pkg.packageManager.split("@")[0];
|
|
1112
|
-
await (0,
|
|
1216
|
+
await (0, import_build_utils3.spawnAsync)(
|
|
1113
1217
|
"corepack",
|
|
1114
1218
|
["enable", pkgManagerName, "--install-directory", corepackShimDir],
|
|
1115
1219
|
{
|
|
@@ -1174,7 +1278,7 @@ var require_do_build = __commonJS({
|
|
|
1174
1278
|
var import_minimatch2 = __toESM2(require_minimatch());
|
|
1175
1279
|
var import_path2 = __require("path");
|
|
1176
1280
|
var import_semver = __toESM2(require_semver());
|
|
1177
|
-
var
|
|
1281
|
+
var import_build_utils3 = __require("@vercel/build-utils");
|
|
1178
1282
|
var import_client = require_dist();
|
|
1179
1283
|
var import_frameworks = require_frameworks();
|
|
1180
1284
|
var import_fs_detectors = require_dist2();
|
|
@@ -1182,6 +1286,7 @@ var require_do_build = __commonJS({
|
|
|
1182
1286
|
var import_detect_builders_with_services = require_detect_builders_with_services();
|
|
1183
1287
|
var import_routing_utils = require_dist3();
|
|
1184
1288
|
var import_write_build_result3 = require_write_build_result();
|
|
1289
|
+
var import_build_runner2 = require_build_runner();
|
|
1185
1290
|
var import_execute_builder = require_execute_builder();
|
|
1186
1291
|
var import_backend_rewrite_warning = require_backend_rewrite_warning();
|
|
1187
1292
|
var import_service_route_ownership = require_service_route_ownership();
|
|
@@ -1243,6 +1348,7 @@ var require_do_build = __commonJS({
|
|
|
1243
1348
|
} = request;
|
|
1244
1349
|
const {
|
|
1245
1350
|
output,
|
|
1351
|
+
createBuildRunner: createBuildRunner2,
|
|
1246
1352
|
importBuilders: importBuilders2,
|
|
1247
1353
|
formatResolvedBuilders: formatResolvedBuilders2,
|
|
1248
1354
|
writeBuildResult: writeBuildResult2,
|
|
@@ -1274,7 +1380,7 @@ var require_do_build = __commonJS({
|
|
|
1274
1380
|
if (typeof installCommand === "string") {
|
|
1275
1381
|
if (installCommand.trim()) {
|
|
1276
1382
|
output.log(`Running install command before config compilation...`);
|
|
1277
|
-
installRan = await (0,
|
|
1383
|
+
installRan = await (0, import_build_utils3.runCustomInstallCommand)({
|
|
1278
1384
|
destPath: workPath,
|
|
1279
1385
|
installCommand,
|
|
1280
1386
|
spawnOpts: { env: process.env },
|
|
@@ -1285,7 +1391,7 @@ var require_do_build = __commonJS({
|
|
|
1285
1391
|
}
|
|
1286
1392
|
} else {
|
|
1287
1393
|
output.log(`Installing dependencies before config compilation...`);
|
|
1288
|
-
installRan = await (0,
|
|
1394
|
+
installRan = await (0, import_build_utils3.runNpmInstall)(
|
|
1289
1395
|
workPath,
|
|
1290
1396
|
[],
|
|
1291
1397
|
{ env: process.env },
|
|
@@ -1297,7 +1403,7 @@ var require_do_build = __commonJS({
|
|
|
1297
1403
|
installDepsSpan.stop();
|
|
1298
1404
|
}
|
|
1299
1405
|
if (installRan) {
|
|
1300
|
-
const { packageJsonPath } = await (0,
|
|
1406
|
+
const { packageJsonPath } = await (0, import_build_utils3.scanParentDirs)(workPath, false);
|
|
1301
1407
|
if (packageJsonPath) {
|
|
1302
1408
|
process.env.VERCEL_INSTALL_COMPLETED_PATH = packageJsonPath;
|
|
1303
1409
|
}
|
|
@@ -1348,6 +1454,10 @@ var require_do_build = __commonJS({
|
|
|
1348
1454
|
const result = await (0, import_framework_detection.detectFirstDeploymentFramework)({
|
|
1349
1455
|
workPath,
|
|
1350
1456
|
projectSettings,
|
|
1457
|
+
frameworkExplicitlyConfigured: Object.prototype.hasOwnProperty.call(
|
|
1458
|
+
localConfig,
|
|
1459
|
+
"framework"
|
|
1460
|
+
),
|
|
1351
1461
|
output
|
|
1352
1462
|
});
|
|
1353
1463
|
s.setAttributes({
|
|
@@ -1378,7 +1488,7 @@ var require_do_build = __commonJS({
|
|
|
1378
1488
|
});
|
|
1379
1489
|
const files = await span.child("vc.getFiles").trace(async (s) => {
|
|
1380
1490
|
const result = (await (0, import_get_files.staticFiles)(workPath, {}, output)).map(
|
|
1381
|
-
(f) => (0,
|
|
1491
|
+
(f) => (0, import_build_utils3.normalizePath)((0, import_path2.relative)(workPath, f))
|
|
1382
1492
|
);
|
|
1383
1493
|
s.setAttributes({ fileCount: String(result.length) });
|
|
1384
1494
|
return result;
|
|
@@ -1409,7 +1519,7 @@ var require_do_build = __commonJS({
|
|
|
1409
1519
|
throw routesResult.error;
|
|
1410
1520
|
}
|
|
1411
1521
|
if (localConfig.builds && localConfig.functions) {
|
|
1412
|
-
throw new
|
|
1522
|
+
throw new import_build_utils3.NowBuildError({
|
|
1413
1523
|
code: "bad_request",
|
|
1414
1524
|
message: "The `functions` property cannot be used in conjunction with the `builds` property. Please remove one of them.",
|
|
1415
1525
|
link: "https://vercel.link/functions-and-builds"
|
|
@@ -1464,14 +1574,14 @@ var require_do_build = __commonJS({
|
|
|
1464
1574
|
}
|
|
1465
1575
|
detectedResolvedServices = detectedBuilders.services;
|
|
1466
1576
|
servicesToRecord = detectedResolvedServices;
|
|
1467
|
-
detectedServices = detectedBuilders.services?.filter(
|
|
1577
|
+
detectedServices = detectedBuilders.services?.filter(import_build_utils3.isExperimentalService);
|
|
1468
1578
|
const autoDetectedV2Config = detectedBuilders.experimentalServicesV2;
|
|
1469
1579
|
if (!hasExperimentalServicesV2ConfiguredInVercelConfig && autoDetectedV2Config) {
|
|
1470
1580
|
nestExperimentalServicesV2Output = true;
|
|
1471
1581
|
detectedExperimentalServicesV2Config = autoDetectedV2Config;
|
|
1472
1582
|
}
|
|
1473
1583
|
if (detectedBuilders.useImplicitEnvInjection && detectedServices && detectedServices.length > 0) {
|
|
1474
|
-
const serviceUrlEnvVars = (0,
|
|
1584
|
+
const serviceUrlEnvVars = (0, import_build_utils3.getExperimentalServiceUrlEnvVars)({
|
|
1475
1585
|
services: detectedServices,
|
|
1476
1586
|
frameworkList: import_frameworks.frameworkList,
|
|
1477
1587
|
currentEnv: process.env,
|
|
@@ -1529,7 +1639,7 @@ var require_do_build = __commonJS({
|
|
|
1529
1639
|
for (const path of files) {
|
|
1530
1640
|
const fsPath = (0, import_path2.join)(workPath, path);
|
|
1531
1641
|
const { mode } = await import_fs_extra2.default.stat(fsPath);
|
|
1532
|
-
map[path] = new
|
|
1642
|
+
map[path] = new import_build_utils3.FileFsRef({ mode, fsPath });
|
|
1533
1643
|
}
|
|
1534
1644
|
s.setAttributes({ fileCount: String(files.length) });
|
|
1535
1645
|
return map;
|
|
@@ -1576,7 +1686,8 @@ var require_do_build = __commonJS({
|
|
|
1576
1686
|
};
|
|
1577
1687
|
const meta = {
|
|
1578
1688
|
skipDownload: true,
|
|
1579
|
-
cliVersion
|
|
1689
|
+
cliVersion,
|
|
1690
|
+
runNpmInstallSet: /* @__PURE__ */ new Set()
|
|
1580
1691
|
};
|
|
1581
1692
|
const executedBuilds = [];
|
|
1582
1693
|
const buildResults = /* @__PURE__ */ new Map();
|
|
@@ -1604,6 +1715,7 @@ var require_do_build = __commonJS({
|
|
|
1604
1715
|
}
|
|
1605
1716
|
}
|
|
1606
1717
|
const preDeployEntries = [];
|
|
1718
|
+
const liveRunners = /* @__PURE__ */ new Set();
|
|
1607
1719
|
const runBuilders = async (buildsToRun) => {
|
|
1608
1720
|
await addBuildsToBuildJson(buildsToRun);
|
|
1609
1721
|
for (const build of (0, import_execute_builder.sortBuildsForExecution)(buildsToRun)) {
|
|
@@ -1616,8 +1728,8 @@ var require_do_build = __commonJS({
|
|
|
1616
1728
|
try {
|
|
1617
1729
|
const { builder, pkg: builderPkg } = builderWithPkg;
|
|
1618
1730
|
const service = getHasDetectedServices() ? serviceByBuilder.get(build) : void 0;
|
|
1619
|
-
const legacyExperimentalService = service && (0,
|
|
1620
|
-
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;
|
|
1621
1733
|
const stripServiceRoutePrefix = !!legacyExperimentalService?.routePrefix && legacyExperimentalService.routePrefix !== "/";
|
|
1622
1734
|
let buildWorkPath = workPath;
|
|
1623
1735
|
let buildEntrypoint = build.src;
|
|
@@ -1671,7 +1783,7 @@ var require_do_build = __commonJS({
|
|
|
1671
1783
|
// `service.functions` isn't on `build.config`, so builders that
|
|
1672
1784
|
// read `config.functions` (e.g. Next.js) would otherwise miss it;
|
|
1673
1785
|
// `serviceName` scopes the derived v2beta consumer.
|
|
1674
|
-
...(0,
|
|
1786
|
+
...(0, import_build_utils3.isExperimentalServiceV2)(service) && service.functions ? { functions: service.functions, serviceName: service.name } : void 0,
|
|
1675
1787
|
// Override project-level settings with service-specific ones.
|
|
1676
1788
|
// The project-level framework is "services" which must NOT be
|
|
1677
1789
|
// propagated to individual builders.
|
|
@@ -1752,7 +1864,7 @@ var require_do_build = __commonJS({
|
|
|
1752
1864
|
);
|
|
1753
1865
|
const restoreEnv = /* @__PURE__ */ new Map();
|
|
1754
1866
|
if (detectedServices && legacyExperimentalService?.env) {
|
|
1755
|
-
const perServiceEnv = (0,
|
|
1867
|
+
const perServiceEnv = (0, import_build_utils3.getServiceUrlEnvVars)({
|
|
1756
1868
|
requestedEnv: legacyExperimentalService.env,
|
|
1757
1869
|
consumerService: legacyExperimentalService,
|
|
1758
1870
|
services: detectedServices,
|
|
@@ -1773,6 +1885,21 @@ var require_do_build = __commonJS({
|
|
|
1773
1885
|
}
|
|
1774
1886
|
let buildResult;
|
|
1775
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);
|
|
1776
1903
|
try {
|
|
1777
1904
|
({ buildResult, rawBuildResult } = await (0, import_execute_builder.executeBuilder)({
|
|
1778
1905
|
builder,
|
|
@@ -1782,7 +1909,8 @@ var require_do_build = __commonJS({
|
|
|
1782
1909
|
hasDetectedServices: getHasDetectedServices(),
|
|
1783
1910
|
framework: import_frameworks.frameworkList.find(
|
|
1784
1911
|
(framework2) => framework2.slug === buildConfig.framework
|
|
1785
|
-
)
|
|
1912
|
+
),
|
|
1913
|
+
runner
|
|
1786
1914
|
}));
|
|
1787
1915
|
} finally {
|
|
1788
1916
|
for (const [key, prior] of restoreEnv) {
|
|
@@ -1793,9 +1921,7 @@ var require_do_build = __commonJS({
|
|
|
1793
1921
|
}
|
|
1794
1922
|
}
|
|
1795
1923
|
try {
|
|
1796
|
-
const builderDiagnostics = await
|
|
1797
|
-
return await builder.diagnostics?.(buildOptions);
|
|
1798
|
-
});
|
|
1924
|
+
const builderDiagnostics = await runner.diagnostics();
|
|
1799
1925
|
if (builderDiagnostics) {
|
|
1800
1926
|
const prefix = service && serviceWorkspace && serviceWorkspace !== "." ? serviceWorkspace + "/" + builderPkg.name + "/" : "";
|
|
1801
1927
|
for (const [key, value] of Object.entries(builderDiagnostics)) {
|
|
@@ -1850,15 +1976,15 @@ var require_do_build = __commonJS({
|
|
|
1850
1976
|
}
|
|
1851
1977
|
if (buildResult && "output" in buildResult && "runtime" in buildResult.output && "type" in buildResult.output && buildResult.output.type === "Lambda") {
|
|
1852
1978
|
const lambdaRuntime = buildResult.output.runtime;
|
|
1853
|
-
if ((0,
|
|
1854
|
-
throw new
|
|
1979
|
+
if ((0, import_build_utils3.getDiscontinuedNodeVersions)().some((o) => o.runtime === lambdaRuntime)) {
|
|
1980
|
+
throw new import_build_utils3.NowBuildError({
|
|
1855
1981
|
code: "NODEJS_DISCONTINUED_VERSION",
|
|
1856
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.`,
|
|
1857
1983
|
link: "https://vercel.link/function-runtimes"
|
|
1858
1984
|
});
|
|
1859
1985
|
}
|
|
1860
1986
|
}
|
|
1861
|
-
if ("output" in buildResult && buildResult.output && ((0,
|
|
1987
|
+
if ("output" in buildResult && buildResult.output && ((0, import_build_utils3.isBackendBuilder)(build) || build.use === "@vercel/python")) {
|
|
1862
1988
|
const routesJsonPath = (0, import_path2.join)(buildWorkPath, ".vercel", "routes.json");
|
|
1863
1989
|
if ((0, import_fs_extra2.existsSync)(routesJsonPath)) {
|
|
1864
1990
|
try {
|
|
@@ -1908,13 +2034,13 @@ var require_do_build = __commonJS({
|
|
|
1908
2034
|
allServices: detectedServices
|
|
1909
2035
|
});
|
|
1910
2036
|
}
|
|
1911
|
-
if (legacyExperimentalService && (0,
|
|
2037
|
+
if (legacyExperimentalService && (0, import_build_utils3.isQueueBackedService)(legacyExperimentalService) && "output" in buildResult) {
|
|
1912
2038
|
attachQueueServiceTrigger(
|
|
1913
2039
|
buildResult.output,
|
|
1914
2040
|
legacyExperimentalService
|
|
1915
2041
|
);
|
|
1916
2042
|
}
|
|
1917
|
-
if (legacyExperimentalService && (0,
|
|
2043
|
+
if (legacyExperimentalService && (0, import_build_utils3.isScheduleTriggeredService)(legacyExperimentalService) && !("crons" in buildResult && buildResult.crons?.length)) {
|
|
1918
2044
|
const staticSchedules = (0, import_service_schedules.getStaticServiceSchedules)(
|
|
1919
2045
|
legacyExperimentalService.schedule
|
|
1920
2046
|
);
|
|
@@ -1922,7 +2048,7 @@ var require_do_build = __commonJS({
|
|
|
1922
2048
|
const cronEntrypoint = legacyExperimentalService.entrypoint || legacyExperimentalService.builder.src || "index";
|
|
1923
2049
|
for (const schedule of staticSchedules) {
|
|
1924
2050
|
synthesizedServiceCrons.push({
|
|
1925
|
-
path: (0,
|
|
2051
|
+
path: (0, import_build_utils3.getInternalServiceCronPath)(
|
|
1926
2052
|
legacyExperimentalService.name,
|
|
1927
2053
|
cronEntrypoint,
|
|
1928
2054
|
legacyExperimentalService.handlerFunction || "cron"
|
|
@@ -1931,7 +2057,7 @@ var require_do_build = __commonJS({
|
|
|
1931
2057
|
});
|
|
1932
2058
|
}
|
|
1933
2059
|
} else {
|
|
1934
|
-
throw new
|
|
2060
|
+
throw new import_build_utils3.NowBuildError({
|
|
1935
2061
|
code: "CRON_SERVICE_NO_CRONS",
|
|
1936
2062
|
message: `Scheduled service "${legacyExperimentalService.name}" did not produce any cron entries. The builder "${builderPkg.name}" may not support scheduled services.`
|
|
1937
2063
|
});
|
|
@@ -2038,7 +2164,7 @@ var require_do_build = __commonJS({
|
|
|
2038
2164
|
throw err;
|
|
2039
2165
|
} finally {
|
|
2040
2166
|
ops.push(
|
|
2041
|
-
(0,
|
|
2167
|
+
(0, import_build_utils3.download)(diagnostics, (0, import_path2.join)(outputDir, "diagnostics")).then(
|
|
2042
2168
|
() => void 0,
|
|
2043
2169
|
(err) => err
|
|
2044
2170
|
)
|
|
@@ -2054,7 +2180,7 @@ var require_do_build = __commonJS({
|
|
|
2054
2180
|
}
|
|
2055
2181
|
}
|
|
2056
2182
|
};
|
|
2057
|
-
const normalizeBuilderSrc = (src) => typeof src === "string" ? (0,
|
|
2183
|
+
const normalizeBuilderSrc = (src) => typeof src === "string" ? (0, import_build_utils3.normalizePath)(src).replace(/^\.\//, "") : void 0;
|
|
2058
2184
|
const getBuilderIdentity = (build) => {
|
|
2059
2185
|
const normalizedSrc = normalizeBuilderSrc(build.src);
|
|
2060
2186
|
return normalizedSrc ? `${build.use}:${normalizedSrc}` : void 0;
|
|
@@ -2091,123 +2217,135 @@ var require_do_build = __commonJS({
|
|
|
2091
2217
|
zeroConfigFallbackRoutes.push(...serviceRoutes.fallbacks);
|
|
2092
2218
|
}
|
|
2093
2219
|
};
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
const defaultGeneratedOutputDir = (0, import_path2.join)(workPath, import_write_build_result3.OUTPUT_DIR);
|
|
2103
|
-
const generatedConfigs = [generatedConfig];
|
|
2104
|
-
if ((0, import_path2.resolve)(outputDir) !== (0, import_path2.resolve)(defaultGeneratedOutputDir)) {
|
|
2105
|
-
const defaultGeneratedConfig = await readJSONFile2(
|
|
2106
|
-
(0, import_path2.join)(defaultGeneratedOutputDir, "config.json")
|
|
2107
|
-
);
|
|
2108
|
-
if (isCantParseJSONFile(defaultGeneratedConfig)) {
|
|
2109
|
-
throw defaultGeneratedConfig;
|
|
2110
|
-
}
|
|
2111
|
-
generatedConfigs.push(defaultGeneratedConfig);
|
|
2112
|
-
}
|
|
2113
|
-
const generatedServicesConfig = getGeneratedServicesConfig([
|
|
2114
|
-
...generatedConfigs,
|
|
2115
|
-
...buildResults.values()
|
|
2116
|
-
]);
|
|
2117
|
-
const generatedExperimentalServicesV1Config = getGeneratedExperimentalServicesV1Config([
|
|
2118
|
-
...generatedConfigs,
|
|
2119
|
-
...buildResults.values()
|
|
2120
|
-
]);
|
|
2121
|
-
if (generatedServicesConfig || generatedExperimentalServicesV1Config) {
|
|
2122
|
-
if (generatedServicesConfig) {
|
|
2123
|
-
nestExperimentalServicesV2Output = true;
|
|
2124
|
-
}
|
|
2125
|
-
detectedExperimentalServicesV1Config = generatedExperimentalServicesV1Config;
|
|
2126
|
-
detectedExperimentalServicesV2Config = generatedServicesConfig;
|
|
2127
|
-
detectedExperimentalServicesV2RootRoutes = generatedServicesConfig ? generatedConfigs.find(
|
|
2128
|
-
(config2) => (hasGeneratedServicesConfig(config2) || hasNonEmptyObject(config2?.experimentalServicesV2)) && Array.isArray(config2?.routes)
|
|
2129
|
-
)?.routes : void 0;
|
|
2130
|
-
const generatedBuilders = await span.child("vc.detectGeneratedServices").trace(
|
|
2131
|
-
() => (0, import_detect_builders_with_services.detectBuildersWithServices)(files, pkg, {
|
|
2132
|
-
...localConfig,
|
|
2133
|
-
...generatedServicesConfig ? {
|
|
2134
|
-
services: generatedServicesConfig,
|
|
2135
|
-
experimentalServicesV2: void 0
|
|
2136
|
-
} : {
|
|
2137
|
-
experimentalServicesV2: void 0,
|
|
2138
|
-
experimentalServices: generatedExperimentalServicesV1Config
|
|
2139
|
-
},
|
|
2140
|
-
projectSettings,
|
|
2141
|
-
ignoreBuildScript: true,
|
|
2142
|
-
featHandleMiss: true,
|
|
2143
|
-
workPath
|
|
2144
|
-
})
|
|
2145
|
-
);
|
|
2146
|
-
if (generatedBuilders.errors && generatedBuilders.errors.length > 0) {
|
|
2147
|
-
throw generatedBuilders.errors[0];
|
|
2148
|
-
}
|
|
2149
|
-
for (const w of generatedBuilders.warnings) {
|
|
2150
|
-
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;
|
|
2151
2228
|
}
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
detectedServices = detectedResolvedServices.filter(
|
|
2158
|
-
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")
|
|
2159
2234
|
);
|
|
2160
|
-
if (
|
|
2161
|
-
|
|
2235
|
+
if (isCantParseJSONFile(defaultGeneratedConfig)) {
|
|
2236
|
+
throw defaultGeneratedConfig;
|
|
2162
2237
|
}
|
|
2238
|
+
generatedConfigs.push(defaultGeneratedConfig);
|
|
2163
2239
|
}
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
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;
|
|
2174
2251
|
}
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
const
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
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);
|
|
2184
2315
|
continue;
|
|
2185
2316
|
}
|
|
2186
|
-
|
|
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
|
+
}
|
|
2187
2323
|
recordedServices.push(service);
|
|
2188
|
-
continue;
|
|
2189
2324
|
}
|
|
2190
|
-
|
|
2191
|
-
if (
|
|
2192
|
-
|
|
2193
|
-
seenBuildsToRun.add(serviceBuilderIdentity);
|
|
2194
|
-
buildsToRun.push(service.builder);
|
|
2325
|
+
servicesToRecord = recordedServices.length > 0 ? recordedServices : void 0;
|
|
2326
|
+
if (buildsToRun.length > 0) {
|
|
2327
|
+
await runBuilders(buildsToRun);
|
|
2195
2328
|
}
|
|
2196
|
-
recordedServices.push(service);
|
|
2197
2329
|
}
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
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
|
+
);
|
|
2201
2338
|
}
|
|
2202
2339
|
}
|
|
2203
|
-
}
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
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
|
+
}
|
|
2211
2349
|
}
|
|
2212
2350
|
}
|
|
2213
2351
|
await (0, import_manifest.writeManifests)(packageManifests, diagnostics, ops, outputDir);
|
|
@@ -2217,7 +2355,7 @@ var require_do_build = __commonJS({
|
|
|
2217
2355
|
const collectSpan = span.child("vc.finalizeBuildOutput");
|
|
2218
2356
|
await flushOps();
|
|
2219
2357
|
let needBuildsJsonOverride = false;
|
|
2220
|
-
const speedInsightsVersion = await (0,
|
|
2358
|
+
const speedInsightsVersion = await (0, import_build_utils3.getInstalledPackageVersion)(
|
|
2221
2359
|
"@vercel/speed-insights"
|
|
2222
2360
|
);
|
|
2223
2361
|
if (speedInsightsVersion) {
|
|
@@ -2227,7 +2365,7 @@ var require_do_build = __commonJS({
|
|
|
2227
2365
|
};
|
|
2228
2366
|
needBuildsJsonOverride = true;
|
|
2229
2367
|
}
|
|
2230
|
-
const webAnalyticsVersion = await (0,
|
|
2368
|
+
const webAnalyticsVersion = await (0, import_build_utils3.getInstalledPackageVersion)("@vercel/analytics");
|
|
2231
2369
|
if (webAnalyticsVersion) {
|
|
2232
2370
|
buildsJson.features = {
|
|
2233
2371
|
...buildsJson.features ?? {},
|
|
@@ -2247,14 +2385,14 @@ var require_do_build = __commonJS({
|
|
|
2247
2385
|
if ("deploymentId" in existingConfig && typeof existingConfig.deploymentId === "string") {
|
|
2248
2386
|
const deploymentId = existingConfig.deploymentId;
|
|
2249
2387
|
if (deploymentId.length > 32) {
|
|
2250
|
-
throw new
|
|
2388
|
+
throw new import_build_utils3.NowBuildError({
|
|
2251
2389
|
code: "INVALID_DEPLOYMENT_ID",
|
|
2252
2390
|
message: `The deploymentId "${deploymentId}" must be 32 characters or less. Please choose a shorter deploymentId in your config.`,
|
|
2253
2391
|
link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
|
|
2254
2392
|
});
|
|
2255
2393
|
}
|
|
2256
2394
|
if (!VALID_DEPLOYMENT_ID_PATTERN.test(deploymentId)) {
|
|
2257
|
-
throw new
|
|
2395
|
+
throw new import_build_utils3.NowBuildError({
|
|
2258
2396
|
code: "INVALID_DEPLOYMENT_ID",
|
|
2259
2397
|
message: `The deploymentId "${deploymentId}" contains invalid characters. Only alphanumeric characters (a-z, A-Z, 0-9), hyphens (-), and underscores (_) are allowed.`,
|
|
2260
2398
|
link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
|
|
@@ -2278,7 +2416,7 @@ var require_do_build = __commonJS({
|
|
|
2278
2416
|
let entrypoint = build.src;
|
|
2279
2417
|
if (getHasDetectedServices() && typeof build.src === "string") {
|
|
2280
2418
|
const service = serviceByBuilder.get(build);
|
|
2281
|
-
if (service && (0,
|
|
2419
|
+
if (service && (0, import_build_utils3.isExperimentalService)(service) && service.type === "web" && typeof service.routePrefix === "string") {
|
|
2282
2420
|
entrypoint = getServicesMergeEntrypoint(service, build.src);
|
|
2283
2421
|
}
|
|
2284
2422
|
}
|
|
@@ -2324,14 +2462,14 @@ var require_do_build = __commonJS({
|
|
|
2324
2462
|
);
|
|
2325
2463
|
if (mergedDeploymentId) {
|
|
2326
2464
|
if (mergedDeploymentId.length > 32) {
|
|
2327
|
-
throw new
|
|
2465
|
+
throw new import_build_utils3.NowBuildError({
|
|
2328
2466
|
code: "INVALID_DEPLOYMENT_ID",
|
|
2329
2467
|
message: `The deploymentId "${mergedDeploymentId}" must be 32 characters or less. Please choose a shorter deploymentId in your config.`,
|
|
2330
2468
|
link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
|
|
2331
2469
|
});
|
|
2332
2470
|
}
|
|
2333
2471
|
if (!VALID_DEPLOYMENT_ID_PATTERN.test(mergedDeploymentId)) {
|
|
2334
|
-
throw new
|
|
2472
|
+
throw new import_build_utils3.NowBuildError({
|
|
2335
2473
|
code: "INVALID_DEPLOYMENT_ID",
|
|
2336
2474
|
message: `The deploymentId "${mergedDeploymentId}" contains invalid characters. Only alphanumeric characters (a-z, A-Z, 0-9), hyphens (-), and underscores (_) are allowed.`,
|
|
2337
2475
|
link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
|
|
@@ -2448,7 +2586,7 @@ var require_do_build = __commonJS({
|
|
|
2448
2586
|
}
|
|
2449
2587
|
function expandBuild(files, build) {
|
|
2450
2588
|
if (!build.use) {
|
|
2451
|
-
throw new
|
|
2589
|
+
throw new import_build_utils3.NowBuildError({
|
|
2452
2590
|
code: `invalid_build_specification`,
|
|
2453
2591
|
message: "Field `use` is missing in build specification",
|
|
2454
2592
|
link: "https://vercel.com/docs/concepts/projects/project-configuration#builds",
|
|
@@ -2457,7 +2595,7 @@ var require_do_build = __commonJS({
|
|
|
2457
2595
|
}
|
|
2458
2596
|
let src = (0, import_path2.normalize)(build.src || "**").split(import_path2.sep).join("/");
|
|
2459
2597
|
if (src === "." || src === "./") {
|
|
2460
|
-
throw new
|
|
2598
|
+
throw new import_build_utils3.NowBuildError({
|
|
2461
2599
|
code: `invalid_build_specification`,
|
|
2462
2600
|
message: "A build `src` path resolves to an empty string",
|
|
2463
2601
|
link: "https://vercel.com/docs/concepts/projects/project-configuration#builds",
|
|
@@ -2747,9 +2885,9 @@ var require_do_build = __commonJS({
|
|
|
2747
2885
|
return `svc:${sortKey}:${normalized}:${service.name}:${buildSrc}`;
|
|
2748
2886
|
}
|
|
2749
2887
|
function attachQueueServiceTrigger(buildOutput, service) {
|
|
2750
|
-
const topics = (0,
|
|
2751
|
-
const consumer = (0,
|
|
2752
|
-
(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)
|
|
2753
2891
|
);
|
|
2754
2892
|
if (service.builder.use !== "@vercel/python" && topics.length > 1) {
|
|
2755
2893
|
throw new Error(
|
|
@@ -2828,11 +2966,14 @@ var require_dist5 = __commonJS({
|
|
|
2828
2966
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2829
2967
|
var src_exports = {};
|
|
2830
2968
|
__export(src_exports, {
|
|
2969
|
+
BuildRunner: () => import_build_runner2.BuildRunner,
|
|
2970
|
+
InprocessBuildRunner: () => import_build_runner2.InprocessBuildRunner,
|
|
2831
2971
|
doBuild: () => import_do_build.doBuild,
|
|
2832
2972
|
executeBuilder: () => import_execute_builder.executeBuilder,
|
|
2833
2973
|
sortBuildsForExecution: () => import_execute_builder.sortBuildsForExecution
|
|
2834
2974
|
});
|
|
2835
2975
|
module.exports = __toCommonJS(src_exports);
|
|
2976
|
+
var import_build_runner2 = require_build_runner();
|
|
2836
2977
|
var import_execute_builder = require_execute_builder();
|
|
2837
2978
|
var import_do_build = require_do_build();
|
|
2838
2979
|
}
|
|
@@ -2842,7 +2983,7 @@ var require_dist5 = __commonJS({
|
|
|
2842
2983
|
var import_chalk = __toESM(require_source(), 1);
|
|
2843
2984
|
var import_dotenv = __toESM(require_main(), 1);
|
|
2844
2985
|
var import_fs_extra = __toESM(require_lib(), 1);
|
|
2845
|
-
import { dirname as dirname2, join as
|
|
2986
|
+
import { dirname as dirname2, join as join3, relative as relative2, resolve } from "path";
|
|
2846
2987
|
import { readdirSync, statSync } from "fs";
|
|
2847
2988
|
import {
|
|
2848
2989
|
normalizePath,
|
|
@@ -2854,6 +2995,311 @@ import {
|
|
|
2854
2995
|
} from "@vercel/build-utils";
|
|
2855
2996
|
var import_cli_builder_integration = __toESM(require_dist5(), 1);
|
|
2856
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
|
+
|
|
2857
3303
|
// src/util/build/scrub-argv.ts
|
|
2858
3304
|
function scrubArgv(argv) {
|
|
2859
3305
|
const clonedArgv = [...argv];
|
|
@@ -2913,8 +3359,8 @@ var BuildTelemetryClient = class extends TelemetryClient {
|
|
|
2913
3359
|
};
|
|
2914
3360
|
|
|
2915
3361
|
// src/util/build/repo-root.ts
|
|
2916
|
-
import { existsSync, readFileSync } from "fs";
|
|
2917
|
-
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";
|
|
2918
3364
|
var import_minimatch = __toESM(require_minimatch(), 1);
|
|
2919
3365
|
function findWorkspaceRootCandidates(startDir) {
|
|
2920
3366
|
const { root } = parse(startDir);
|
|
@@ -2935,13 +3381,13 @@ function findWorkspaceRootCandidates(startDir) {
|
|
|
2935
3381
|
return candidates;
|
|
2936
3382
|
}
|
|
2937
3383
|
function workspaceTypeOf(dir) {
|
|
2938
|
-
if (existsSync(
|
|
3384
|
+
if (existsSync(join2(dir, "pnpm-workspace.yaml"))) {
|
|
2939
3385
|
return "pnpm";
|
|
2940
3386
|
}
|
|
2941
|
-
const pkgPath =
|
|
3387
|
+
const pkgPath = join2(dir, "package.json");
|
|
2942
3388
|
if (existsSync(pkgPath)) {
|
|
2943
3389
|
try {
|
|
2944
|
-
const pkg = JSON.parse(
|
|
3390
|
+
const pkg = JSON.parse(readFileSync2(pkgPath, "utf8"));
|
|
2945
3391
|
const { workspaces } = pkg;
|
|
2946
3392
|
if (Array.isArray(workspaces) && workspaces.length > 0 || workspaces && typeof workspaces === "object" && Array.isArray(workspaces.packages) && workspaces.packages.length > 0) {
|
|
2947
3393
|
return "npm";
|
|
@@ -2955,13 +3401,13 @@ function readWorkspacePatterns(candidate) {
|
|
|
2955
3401
|
try {
|
|
2956
3402
|
if (candidate.type === "pnpm") {
|
|
2957
3403
|
const doc = js_yaml_default.load(
|
|
2958
|
-
|
|
3404
|
+
readFileSync2(join2(candidate.dir, "pnpm-workspace.yaml"), "utf8")
|
|
2959
3405
|
);
|
|
2960
3406
|
const packages2 = doc?.packages;
|
|
2961
3407
|
return Array.isArray(packages2) ? packages2.filter((p) => typeof p === "string") : null;
|
|
2962
3408
|
}
|
|
2963
3409
|
const pkg = JSON.parse(
|
|
2964
|
-
|
|
3410
|
+
readFileSync2(join2(candidate.dir, "package.json"), "utf8")
|
|
2965
3411
|
);
|
|
2966
3412
|
const { workspaces } = pkg;
|
|
2967
3413
|
const packages = Array.isArray(workspaces) ? workspaces : workspaces?.packages;
|
|
@@ -2992,7 +3438,7 @@ function workspaceClaims(candidate, memberDir) {
|
|
|
2992
3438
|
if (!positives.some(matches) || negatives.some(matches)) {
|
|
2993
3439
|
return false;
|
|
2994
3440
|
}
|
|
2995
|
-
return existsSync(
|
|
3441
|
+
return existsSync(join2(memberDir, "package.json"));
|
|
2996
3442
|
}
|
|
2997
3443
|
function resolvePerDirectoryLinkRoot(anchorDir, rootDirectorySetting) {
|
|
2998
3444
|
let repoRoot = anchorDir;
|
|
@@ -3010,18 +3456,18 @@ function resolvePerDirectoryLinkRoot(anchorDir, rootDirectorySetting) {
|
|
|
3010
3456
|
if (setting === "") {
|
|
3011
3457
|
return { repoRoot, resolvedRootDirectory: linkLocation };
|
|
3012
3458
|
}
|
|
3013
|
-
if (existsSync(
|
|
3459
|
+
if (existsSync(join2(anchorDir, setting))) {
|
|
3014
3460
|
return {
|
|
3015
3461
|
repoRoot,
|
|
3016
3462
|
resolvedRootDirectory: normalizeRelative(
|
|
3017
|
-
relative(repoRoot,
|
|
3463
|
+
relative(repoRoot, join2(anchorDir, setting))
|
|
3018
3464
|
)
|
|
3019
3465
|
};
|
|
3020
3466
|
}
|
|
3021
3467
|
return {
|
|
3022
3468
|
repoRoot,
|
|
3023
3469
|
resolvedRootDirectory: linkLocation,
|
|
3024
|
-
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.`
|
|
3025
3471
|
};
|
|
3026
3472
|
}
|
|
3027
3473
|
function normalizeRelative(p) {
|
|
@@ -3030,6 +3476,18 @@ function normalizeRelative(p) {
|
|
|
3030
3476
|
}
|
|
3031
3477
|
|
|
3032
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
|
+
}
|
|
3033
3491
|
function buildCommandWithGlobalFlags(baseSubcommand, argv) {
|
|
3034
3492
|
const globalFlags = getGlobalFlagsFromArgs(argv.slice(2));
|
|
3035
3493
|
const full = globalFlags.length ? `${baseSubcommand} ${globalFlags.join(" ")}` : baseSubcommand;
|
|
@@ -3134,7 +3592,7 @@ async function main(client) {
|
|
|
3134
3592
|
if (link?.repoRoot) {
|
|
3135
3593
|
cwd = client.cwd = link.repoRoot;
|
|
3136
3594
|
}
|
|
3137
|
-
const vercelDir =
|
|
3595
|
+
const vercelDir = join3(cwd, projectRootDirectory, VERCEL_DIR);
|
|
3138
3596
|
let project = await rootSpan.child("vc.readProjectSettings").trace(() => readProjectSettings(vercelDir));
|
|
3139
3597
|
const isTTY = process.stdin.isTTY;
|
|
3140
3598
|
while (!project?.settings) {
|
|
@@ -3201,7 +3659,7 @@ async function main(client) {
|
|
|
3201
3659
|
return 0;
|
|
3202
3660
|
}
|
|
3203
3661
|
const { argv: originalArgv } = client;
|
|
3204
|
-
client.cwd =
|
|
3662
|
+
client.cwd = join3(cwd, projectRootDirectory);
|
|
3205
3663
|
client.setArgv([
|
|
3206
3664
|
...originalArgv.slice(0, 2),
|
|
3207
3665
|
"pull",
|
|
@@ -3240,9 +3698,9 @@ async function main(client) {
|
|
|
3240
3698
|
cwd = client.cwd = resolved.repoRoot;
|
|
3241
3699
|
}
|
|
3242
3700
|
}
|
|
3243
|
-
const defaultOutputDir =
|
|
3701
|
+
const defaultOutputDir = join3(cwd, projectRootDirectory, import_write_build_result.OUTPUT_DIR);
|
|
3244
3702
|
const outputDir = parsedArgs.flags["--output"] ? resolve(parsedArgs.flags["--output"]) : defaultOutputDir;
|
|
3245
|
-
client.traceDiagnosticsPath =
|
|
3703
|
+
client.traceDiagnosticsPath = join3(
|
|
3246
3704
|
outputDir,
|
|
3247
3705
|
"diagnostics",
|
|
3248
3706
|
"cli_traces.json"
|
|
@@ -3287,7 +3745,7 @@ async function main(client) {
|
|
|
3287
3745
|
`Loaded ${Object.keys(buildEnv).length} environment variables from deployment ${deploymentId}`
|
|
3288
3746
|
);
|
|
3289
3747
|
} else {
|
|
3290
|
-
const envPath =
|
|
3748
|
+
const envPath = join3(
|
|
3291
3749
|
cwd,
|
|
3292
3750
|
projectRootDirectory,
|
|
3293
3751
|
VERCEL_DIR,
|
|
@@ -3334,6 +3792,7 @@ async function main(client) {
|
|
|
3334
3792
|
},
|
|
3335
3793
|
{
|
|
3336
3794
|
output: output_manager_default,
|
|
3795
|
+
createBuildRunner,
|
|
3337
3796
|
importBuilders,
|
|
3338
3797
|
formatResolvedBuilders: import_import_builders.formatResolvedBuilders,
|
|
3339
3798
|
writeBuildResult,
|
|
@@ -3420,8 +3879,8 @@ async function main(client) {
|
|
|
3420
3879
|
}
|
|
3421
3880
|
output_manager_default.prettyError(err);
|
|
3422
3881
|
buildsJson.error = toEnumerableError(err);
|
|
3423
|
-
const buildsJsonPath =
|
|
3424
|
-
const configJsonPath =
|
|
3882
|
+
const buildsJsonPath = join3(outputDir, "builds.json");
|
|
3883
|
+
const configJsonPath = join3(outputDir, "config.json");
|
|
3425
3884
|
await import_fs_extra.default.outputJSON(buildsJsonPath, buildsJson, {
|
|
3426
3885
|
spaces: 2
|
|
3427
3886
|
});
|
|
@@ -3466,7 +3925,7 @@ async function analyzeVcConfigFiles(cwd, outputDir) {
|
|
|
3466
3925
|
const filesObject = await glob("**/.vc-config.json", {
|
|
3467
3926
|
cwd: outputDir
|
|
3468
3927
|
});
|
|
3469
|
-
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));
|
|
3470
3929
|
if (vcConfigFiles.length === 0) {
|
|
3471
3930
|
output_manager_default.print("No functions to analyze.\n");
|
|
3472
3931
|
return;
|
|
@@ -3534,7 +3993,7 @@ async function analyzeSingleFunction(file, cwd, outputDir) {
|
|
|
3534
3993
|
(entry) => typeof entry[1] === "string"
|
|
3535
3994
|
).map(([bundlePath, sourcePath]) => ({
|
|
3536
3995
|
bundlePath,
|
|
3537
|
-
sourcePath:
|
|
3996
|
+
sourcePath: join3(cwd, sourcePath)
|
|
3538
3997
|
})) : [];
|
|
3539
3998
|
const fsRefStats = getTotalFileSizeInMB(filePathMap);
|
|
3540
3999
|
const totalSize = funcDirStats.size + fsRefStats.size;
|
|
@@ -3573,7 +4032,7 @@ function getDirectorySizeInMB(dir) {
|
|
|
3573
4032
|
const entries = readdirSync(dir, { recursive: true });
|
|
3574
4033
|
for (const entry of entries) {
|
|
3575
4034
|
const entryPath = typeof entry === "string" ? entry : entry.toString();
|
|
3576
|
-
const fullPath =
|
|
4035
|
+
const fullPath = join3(dir, entryPath);
|
|
3577
4036
|
try {
|
|
3578
4037
|
const stats = statSync(fullPath);
|
|
3579
4038
|
if (stats.isFile()) {
|