vercel 33.1.0 → 33.3.0
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/builder-worker.js +12 -0
- package/dist/index.js +287 -212
- package/package.json +10 -10
package/dist/index.js
CHANGED
@@ -140,12 +140,12 @@ var require_polyfills = __commonJS2({
|
|
140
140
|
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports2, module2) {
|
141
141
|
var constants = require("constants");
|
142
142
|
var origCwd = process.cwd;
|
143
|
-
var
|
143
|
+
var cwd2 = null;
|
144
144
|
var platform2 = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
145
145
|
process.cwd = function() {
|
146
|
-
if (!
|
147
|
-
|
148
|
-
return
|
146
|
+
if (!cwd2)
|
147
|
+
cwd2 = origCwd.call(process);
|
148
|
+
return cwd2;
|
149
149
|
};
|
150
150
|
try {
|
151
151
|
process.cwd();
|
@@ -154,7 +154,7 @@ var require_polyfills = __commonJS2({
|
|
154
154
|
if (typeof process.chdir === "function") {
|
155
155
|
chdir = process.chdir;
|
156
156
|
process.chdir = function(d) {
|
157
|
-
|
157
|
+
cwd2 = null;
|
158
158
|
chdir.call(process, d);
|
159
159
|
};
|
160
160
|
if (Object.setPrototypeOf)
|
@@ -12008,7 +12008,7 @@ var require_ansi_escapes = __commonJS2({
|
|
12008
12008
|
return ret + ":" + buffer.toString("base64") + BEL;
|
12009
12009
|
};
|
12010
12010
|
ansiEscapes4.iTerm = {
|
12011
|
-
setCwd: (
|
12011
|
+
setCwd: (cwd2 = process.cwd()) => `${OSC}50;CurrentDir=${cwd2}${BEL}`,
|
12012
12012
|
annotation: (message2, options = {}) => {
|
12013
12013
|
let ret = `${OSC}1337;`;
|
12014
12014
|
const hasX = typeof options.x !== "undefined";
|
@@ -52631,12 +52631,12 @@ var require_polyfills2 = __commonJS2({
|
|
52631
52631
|
"../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js"(exports2, module2) {
|
52632
52632
|
var constants = require("constants");
|
52633
52633
|
var origCwd = process.cwd;
|
52634
|
-
var
|
52634
|
+
var cwd2 = null;
|
52635
52635
|
var platform2 = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
52636
52636
|
process.cwd = function() {
|
52637
|
-
if (!
|
52638
|
-
|
52639
|
-
return
|
52637
|
+
if (!cwd2)
|
52638
|
+
cwd2 = origCwd.call(process);
|
52639
|
+
return cwd2;
|
52640
52640
|
};
|
52641
52641
|
try {
|
52642
52642
|
process.cwd();
|
@@ -52645,7 +52645,7 @@ var require_polyfills2 = __commonJS2({
|
|
52645
52645
|
if (typeof process.chdir === "function") {
|
52646
52646
|
chdir = process.chdir;
|
52647
52647
|
process.chdir = function(d) {
|
52648
|
-
|
52648
|
+
cwd2 = null;
|
52649
52649
|
chdir.call(process, d);
|
52650
52650
|
};
|
52651
52651
|
if (Object.setPrototypeOf)
|
@@ -62513,7 +62513,7 @@ var require_package = __commonJS2({
|
|
62513
62513
|
"../client/package.json"(exports2, module2) {
|
62514
62514
|
module2.exports = {
|
62515
62515
|
name: "@vercel/client",
|
62516
|
-
version: "13.0
|
62516
|
+
version: "13.1.0",
|
62517
62517
|
main: "dist/index.js",
|
62518
62518
|
typings: "dist/index.d.ts",
|
62519
62519
|
homepage: "https://vercel.com",
|
@@ -62550,7 +62550,7 @@ var require_package = __commonJS2({
|
|
62550
62550
|
typescript: "4.9.5"
|
62551
62551
|
},
|
62552
62552
|
dependencies: {
|
62553
|
-
"@vercel/build-utils": "7.5.
|
62553
|
+
"@vercel/build-utils": "7.5.1",
|
62554
62554
|
"@vercel/routing-utils": "3.1.0",
|
62555
62555
|
"@zeit/fetch": "5.2.0",
|
62556
62556
|
"async-retry": "1.2.3",
|
@@ -63590,6 +63590,26 @@ var require_utils8 = __commonJS2({
|
|
63590
63590
|
return ignored;
|
63591
63591
|
};
|
63592
63592
|
fileList = await (0, import_readdir_recursive.default)(path11, [ignores2]);
|
63593
|
+
if (prebuilt) {
|
63594
|
+
const refs = /* @__PURE__ */ new Set();
|
63595
|
+
const vcConfigFilePaths = fileList.filter(
|
63596
|
+
(file) => (0, import_path44.basename)(file) === ".vc-config.json"
|
63597
|
+
);
|
63598
|
+
await Promise.all(
|
63599
|
+
vcConfigFilePaths.map(async (p) => {
|
63600
|
+
const configJson = await (0, import_fs_extra24.readFile)(p, "utf8");
|
63601
|
+
const config3 = JSON.parse(configJson);
|
63602
|
+
if (!config3.filePathMap)
|
63603
|
+
return;
|
63604
|
+
for (const v of Object.values(config3.filePathMap)) {
|
63605
|
+
refs.add((0, import_path44.join)(path11, v));
|
63606
|
+
}
|
63607
|
+
})
|
63608
|
+
);
|
63609
|
+
if (refs.size > 0) {
|
63610
|
+
fileList = fileList.concat(Array.from(refs));
|
63611
|
+
}
|
63612
|
+
}
|
63593
63613
|
debug3(`Found ${fileList.length} files in the specified directory`);
|
63594
63614
|
} else if (Array.isArray(path11)) {
|
63595
63615
|
fileList = path11;
|
@@ -63600,7 +63620,7 @@ var require_utils8 = __commonJS2({
|
|
63600
63620
|
}
|
63601
63621
|
return { fileList, ignoreList };
|
63602
63622
|
}
|
63603
|
-
async function getVercelIgnore4(
|
63623
|
+
async function getVercelIgnore4(cwd2, prebuilt) {
|
63604
63624
|
const ig = (0, import_ignore.default)();
|
63605
63625
|
let ignores;
|
63606
63626
|
if (prebuilt) {
|
@@ -63640,12 +63660,12 @@ var require_utils8 = __commonJS2({
|
|
63640
63660
|
"venv",
|
63641
63661
|
"CVS"
|
63642
63662
|
];
|
63643
|
-
const cwds = Array.isArray(
|
63663
|
+
const cwds = Array.isArray(cwd2) ? cwd2 : [cwd2];
|
63644
63664
|
const files = await Promise.all(
|
63645
|
-
cwds.map(async (
|
63665
|
+
cwds.map(async (cwd22) => {
|
63646
63666
|
const [vercelignore, nowignore] = await Promise.all([
|
63647
|
-
maybeRead((0, import_path44.join)(
|
63648
|
-
maybeRead((0, import_path44.join)(
|
63667
|
+
maybeRead((0, import_path44.join)(cwd22, ".vercelignore"), ""),
|
63668
|
+
maybeRead((0, import_path44.join)(cwd22, ".nowignore"), "")
|
63649
63669
|
]);
|
63650
63670
|
if (vercelignore && nowignore) {
|
63651
63671
|
throw new import_build_utils19.NowBuildError({
|
@@ -68228,13 +68248,13 @@ var require_tar_fs = __commonJS2({
|
|
68228
68248
|
var normalize4 = !win32 ? echo : function(name) {
|
68229
68249
|
return name.replace(/\\/g, "/").replace(/[:?<>|]/g, "_");
|
68230
68250
|
};
|
68231
|
-
var statAll = function(fs16, stat2,
|
68251
|
+
var statAll = function(fs16, stat2, cwd2, ignore, entries, sort) {
|
68232
68252
|
var queue = entries || ["."];
|
68233
68253
|
return function loop(callback) {
|
68234
68254
|
if (!queue.length)
|
68235
68255
|
return callback();
|
68236
68256
|
var next = queue.shift();
|
68237
|
-
var nextAbs = path11.join(
|
68257
|
+
var nextAbs = path11.join(cwd2, next);
|
68238
68258
|
stat2(nextAbs, function(err, stat3) {
|
68239
68259
|
if (err)
|
68240
68260
|
return callback(err);
|
@@ -68246,7 +68266,7 @@ var require_tar_fs = __commonJS2({
|
|
68246
68266
|
if (sort)
|
68247
68267
|
files.sort();
|
68248
68268
|
for (var i = 0; i < files.length; i++) {
|
68249
|
-
if (!ignore(path11.join(
|
68269
|
+
if (!ignore(path11.join(cwd2, next, files[i])))
|
68250
68270
|
queue.push(path11.join(next, files[i]));
|
68251
68271
|
}
|
68252
68272
|
callback(null, next, stat3);
|
@@ -68264,16 +68284,16 @@ var require_tar_fs = __commonJS2({
|
|
68264
68284
|
return map(header);
|
68265
68285
|
};
|
68266
68286
|
};
|
68267
|
-
exports2.pack = function(
|
68268
|
-
if (!
|
68269
|
-
|
68287
|
+
exports2.pack = function(cwd2, opts) {
|
68288
|
+
if (!cwd2)
|
68289
|
+
cwd2 = ".";
|
68270
68290
|
if (!opts)
|
68271
68291
|
opts = {};
|
68272
68292
|
var xfs = opts.fs || fs15;
|
68273
68293
|
var ignore = opts.ignore || opts.filter || noop;
|
68274
68294
|
var map = opts.map || noop;
|
68275
68295
|
var mapStream = opts.mapStream || echo;
|
68276
|
-
var statNext = statAll(xfs, opts.dereference ? xfs.stat : xfs.lstat,
|
68296
|
+
var statNext = statAll(xfs, opts.dereference ? xfs.stat : xfs.lstat, cwd2, ignore, opts.entries, opts.sort);
|
68277
68297
|
var strict = opts.strict !== false;
|
68278
68298
|
var umask = typeof opts.umask === "number" ? ~opts.umask : ~processUmask();
|
68279
68299
|
var dmode = typeof opts.dmode === "number" ? opts.dmode : 0;
|
@@ -68291,7 +68311,7 @@ var require_tar_fs = __commonJS2({
|
|
68291
68311
|
fmode |= parseInt(222, 8);
|
68292
68312
|
}
|
68293
68313
|
var onsymlink = function(filename, header) {
|
68294
|
-
xfs.readlink(path11.join(
|
68314
|
+
xfs.readlink(path11.join(cwd2, filename), function(err, linkname) {
|
68295
68315
|
if (err)
|
68296
68316
|
return pack.destroy(err);
|
68297
68317
|
header.linkname = normalize4(linkname);
|
@@ -68338,7 +68358,7 @@ var require_tar_fs = __commonJS2({
|
|
68338
68358
|
var entry = pack.entry(header, onnextentry);
|
68339
68359
|
if (!entry)
|
68340
68360
|
return;
|
68341
|
-
var rs = mapStream(xfs.createReadStream(path11.join(
|
68361
|
+
var rs = mapStream(xfs.createReadStream(path11.join(cwd2, filename)), header);
|
68342
68362
|
rs.on("error", function(err2) {
|
68343
68363
|
entry.destroy(err2);
|
68344
68364
|
});
|
@@ -68361,9 +68381,9 @@ var require_tar_fs = __commonJS2({
|
|
68361
68381
|
var processUmask = function() {
|
68362
68382
|
return process.umask ? process.umask() : 0;
|
68363
68383
|
};
|
68364
|
-
exports2.extract = function(
|
68365
|
-
if (!
|
68366
|
-
|
68384
|
+
exports2.extract = function(cwd2, opts) {
|
68385
|
+
if (!cwd2)
|
68386
|
+
cwd2 = ".";
|
68367
68387
|
if (!opts)
|
68368
68388
|
opts = {};
|
68369
68389
|
var xfs = opts.fs || fs15;
|
@@ -68429,7 +68449,7 @@ var require_tar_fs = __commonJS2({
|
|
68429
68449
|
extract.on("entry", function(header, stream, next) {
|
68430
68450
|
header = map(header) || header;
|
68431
68451
|
header.name = normalize4(header.name);
|
68432
|
-
var name = path11.join(
|
68452
|
+
var name = path11.join(cwd2, path11.join("/", header.name));
|
68433
68453
|
if (ignore(name, header)) {
|
68434
68454
|
stream.resume();
|
68435
68455
|
return next();
|
@@ -68456,7 +68476,7 @@ var require_tar_fs = __commonJS2({
|
|
68456
68476
|
if (win32)
|
68457
68477
|
return next();
|
68458
68478
|
xfs.unlink(name, function() {
|
68459
|
-
var srcpath = path11.join(
|
68479
|
+
var srcpath = path11.join(cwd2, path11.join("/", header.linkname));
|
68460
68480
|
xfs.link(srcpath, name, function(err) {
|
68461
68481
|
if (err && err.code === "EPERM" && opts.hardlinkAsFilesFallback) {
|
68462
68482
|
stream = xfs.createReadStream(srcpath);
|
@@ -68488,7 +68508,7 @@ var require_tar_fs = __commonJS2({
|
|
68488
68508
|
}, stat2);
|
68489
68509
|
}
|
68490
68510
|
var dir = path11.dirname(name);
|
68491
|
-
validate2(xfs, dir, path11.join(
|
68511
|
+
validate2(xfs, dir, path11.join(cwd2, "."), function(err, valid) {
|
68492
68512
|
if (err)
|
68493
68513
|
return next(err);
|
68494
68514
|
if (!valid)
|
@@ -129966,7 +129986,7 @@ var require_resolveCommand = __commonJS2({
|
|
129966
129986
|
var getPathKey = require_path_key();
|
129967
129987
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
129968
129988
|
const env = parsed.options.env || process.env;
|
129969
|
-
const
|
129989
|
+
const cwd2 = process.cwd();
|
129970
129990
|
const hasCustomCwd = parsed.options.cwd != null;
|
129971
129991
|
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
129972
129992
|
if (shouldSwitchCwd) {
|
@@ -129984,7 +130004,7 @@ var require_resolveCommand = __commonJS2({
|
|
129984
130004
|
} catch (e2) {
|
129985
130005
|
} finally {
|
129986
130006
|
if (shouldSwitchCwd) {
|
129987
|
-
process.chdir(
|
130007
|
+
process.chdir(cwd2);
|
129988
130008
|
}
|
129989
130009
|
}
|
129990
130010
|
if (resolved) {
|
@@ -148137,10 +148157,10 @@ var require_detect_framework = __commonJS2({
|
|
148137
148157
|
firstMatchPackage.matchPackage
|
148138
148158
|
);
|
148139
148159
|
}
|
148140
|
-
function lookupInstalledVersion(
|
148160
|
+
function lookupInstalledVersion(cwd2, packageName2) {
|
148141
148161
|
try {
|
148142
148162
|
const script = `require('${packageName2}/package.json').version`;
|
148143
|
-
return (0, import_child_process4.spawnSync)(
|
148163
|
+
return (0, import_child_process4.spawnSync)(cwd2, ["-p", script], {
|
148144
148164
|
encoding: "utf-8"
|
148145
148165
|
}).stdout.trim();
|
148146
148166
|
} catch (error4) {
|
@@ -148579,7 +148599,7 @@ var require_get_workspaces = __commonJS2({
|
|
148579
148599
|
async function getWorkspaces3({
|
148580
148600
|
fs: fs15,
|
148581
148601
|
depth = MAX_DEPTH_TRAVERSE,
|
148582
|
-
cwd = "/"
|
148602
|
+
cwd: cwd2 = "/"
|
148583
148603
|
}) {
|
148584
148604
|
if (depth === 0)
|
148585
148605
|
return [];
|
@@ -148597,7 +148617,7 @@ var require_get_workspaces = __commonJS2({
|
|
148597
148617
|
(childDirectory) => getWorkspaces3({
|
148598
148618
|
fs: fs15.chdir(childDirectory.path),
|
148599
148619
|
depth: depth - 1,
|
148600
|
-
cwd: posixPath.join(
|
148620
|
+
cwd: posixPath.join(cwd2, childDirectory.path)
|
148601
148621
|
})
|
148602
148622
|
)
|
148603
148623
|
)).flat();
|
@@ -148605,7 +148625,7 @@ var require_get_workspaces = __commonJS2({
|
|
148605
148625
|
return [
|
148606
148626
|
{
|
148607
148627
|
type: workspaceType,
|
148608
|
-
rootPath:
|
148628
|
+
rootPath: cwd2
|
148609
148629
|
}
|
148610
148630
|
];
|
148611
148631
|
}
|
@@ -152381,12 +152401,12 @@ var require_common4 = __commonJS2({
|
|
152381
152401
|
self2.symlinks = options.symlinks || /* @__PURE__ */ Object.create(null);
|
152382
152402
|
setupIgnores(self2, options);
|
152383
152403
|
self2.changedCwd = false;
|
152384
|
-
var
|
152404
|
+
var cwd2 = process.cwd();
|
152385
152405
|
if (!ownProp(options, "cwd"))
|
152386
|
-
self2.cwd = path11.resolve(
|
152406
|
+
self2.cwd = path11.resolve(cwd2);
|
152387
152407
|
else {
|
152388
152408
|
self2.cwd = path11.resolve(options.cwd);
|
152389
|
-
self2.changedCwd = self2.cwd !==
|
152409
|
+
self2.changedCwd = self2.cwd !== cwd2;
|
152390
152410
|
}
|
152391
152411
|
self2.root = options.root || path11.resolve(self2.cwd, "/");
|
152392
152412
|
self2.root = path11.resolve(self2.root);
|
@@ -163679,8 +163699,8 @@ var init_create_project = __esm({
|
|
163679
163699
|
});
|
163680
163700
|
|
163681
163701
|
// src/util/projects/detect-projects.ts
|
163682
|
-
async function detectProjects(
|
163683
|
-
const fs15 = new import_fs_detectors.LocalFileSystemDetector(
|
163702
|
+
async function detectProjects(cwd2) {
|
163703
|
+
const fs15 = new import_fs_detectors.LocalFileSystemDetector(cwd2);
|
163684
163704
|
const workspaces = await (0, import_fs_detectors.getWorkspaces)({ fs: fs15 });
|
163685
163705
|
const detectedProjects = /* @__PURE__ */ new Map();
|
163686
163706
|
const packagePaths = (await Promise.all(
|
@@ -163833,8 +163853,8 @@ var init_connect_git_provider = __esm({
|
|
163833
163853
|
});
|
163834
163854
|
|
163835
163855
|
// src/util/link/repo.ts
|
163836
|
-
async function getRepoLink(client2,
|
163837
|
-
const rootPath = await findRepoRoot(client2,
|
163856
|
+
async function getRepoLink(client2, cwd2) {
|
163857
|
+
const rootPath = await findRepoRoot(client2, cwd2);
|
163838
163858
|
if (!rootPath)
|
163839
163859
|
return void 0;
|
163840
163860
|
const repoConfigPath = (0, import_path14.join)(rootPath, VERCEL_DIR2, VERCEL_DIR_REPO);
|
@@ -163846,9 +163866,9 @@ async function getRepoLink(client2, cwd) {
|
|
163846
163866
|
);
|
163847
163867
|
return { rootPath, repoConfig, repoConfigPath };
|
163848
163868
|
}
|
163849
|
-
async function ensureRepoLink(client2,
|
163869
|
+
async function ensureRepoLink(client2, cwd2, { yes, overwrite }) {
|
163850
163870
|
const { output: output2 } = client2;
|
163851
|
-
const repoLink = await getRepoLink(client2,
|
163871
|
+
const repoLink = await getRepoLink(client2, cwd2);
|
163852
163872
|
if (repoLink) {
|
163853
163873
|
output2.debug(`Found Git repository root directory: ${repoLink.rootPath}`);
|
163854
163874
|
} else {
|
@@ -164153,8 +164173,8 @@ var init_repo = __esm({
|
|
164153
164173
|
});
|
164154
164174
|
|
164155
164175
|
// src/util/projects/link.ts
|
164156
|
-
function getVercelDirectory(
|
164157
|
-
const possibleDirs = [(0, import_path15.join)(
|
164176
|
+
function getVercelDirectory(cwd2) {
|
164177
|
+
const possibleDirs = [(0, import_path15.join)(cwd2, VERCEL_DIR2), (0, import_path15.join)(cwd2, VERCEL_DIR_FALLBACK)];
|
164158
164178
|
const existingDirs = possibleDirs.filter((d) => isDirectory(d));
|
164159
164179
|
if (existingDirs.length > 1) {
|
164160
164180
|
throw new import_build_utils6.NowBuildError({
|
@@ -164397,7 +164417,7 @@ var init_link2 = __esm({
|
|
164397
164417
|
});
|
164398
164418
|
|
164399
164419
|
// src/util/projects/project-settings.ts
|
164400
|
-
async function writeProjectSettings(
|
164420
|
+
async function writeProjectSettings(cwd2, project, org, isRepoLinked) {
|
164401
164421
|
let analyticsId;
|
164402
164422
|
if (project.analytics?.id && (!project.analytics.disabledAt || project.analytics.enabledAt && project.analytics.enabledAt > project.analytics.disabledAt)) {
|
164403
164423
|
analyticsId = project.analytics.id;
|
@@ -164418,7 +164438,7 @@ async function writeProjectSettings(cwd, project, org, isRepoLinked) {
|
|
164418
164438
|
analyticsId
|
164419
164439
|
}
|
164420
164440
|
};
|
164421
|
-
const path11 = (0, import_path16.join)(
|
164441
|
+
const path11 = (0, import_path16.join)(cwd2, VERCEL_DIR2, VERCEL_DIR_PROJECT);
|
164422
164442
|
return await (0, import_fs_extra8.outputJSON)(path11, projectLinkAndSettings, {
|
164423
164443
|
spaces: 2
|
164424
164444
|
});
|
@@ -164628,7 +164648,7 @@ function tryReadHeadSync(path11, length) {
|
|
164628
164648
|
}
|
164629
164649
|
}
|
164630
164650
|
}
|
164631
|
-
async function pull(client2, link4, project, environment, opts, args2, output2,
|
164651
|
+
async function pull(client2, link4, project, environment, opts, args2, output2, cwd2, source) {
|
164632
164652
|
if (args2.length > 1) {
|
164633
164653
|
output2.error(
|
164634
164654
|
`Invalid number of arguments. Usage: ${getCommandName(`env pull <file>`)}`
|
@@ -164636,7 +164656,7 @@ async function pull(client2, link4, project, environment, opts, args2, output2,
|
|
164636
164656
|
return 1;
|
164637
164657
|
}
|
164638
164658
|
const [filename = ".env.local"] = args2;
|
164639
|
-
const fullPath = (0, import_path17.resolve)(
|
164659
|
+
const fullPath = (0, import_path17.resolve)(cwd2, filename);
|
164640
164660
|
const skipConfirmation = opts["--yes"];
|
164641
164661
|
const gitBranch = opts["--git-branch"];
|
164642
164662
|
const head = tryReadHeadSync(fullPath, Buffer.byteLength(CONTENTS_PREFIX));
|
@@ -164680,7 +164700,7 @@ async function pull(client2, link4, project, environment, opts, args2, output2,
|
|
164680
164700
|
}
|
164681
164701
|
let isGitIgnoreUpdated = false;
|
164682
164702
|
if (filename === ".env.local") {
|
164683
|
-
const rootPath = link4.repoRoot ??
|
164703
|
+
const rootPath = link4.repoRoot ?? cwd2;
|
164684
164704
|
isGitIgnoreUpdated = await addToGitIgnore(rootPath, ".env*.local");
|
164685
164705
|
}
|
164686
164706
|
output2.print(
|
@@ -164852,7 +164872,7 @@ var init_input_project = __esm({
|
|
164852
164872
|
});
|
164853
164873
|
|
164854
164874
|
// src/util/validate-paths.ts
|
164855
|
-
async function validateRootDirectory(output2,
|
164875
|
+
async function validateRootDirectory(output2, cwd2, path11, errorSuffix) {
|
164856
164876
|
const pathStat = await (0, import_fs_extra11.lstat)(path11).catch(() => null);
|
164857
164877
|
const suffix = errorSuffix ? ` ${errorSuffix}` : "";
|
164858
164878
|
if (!pathStat) {
|
@@ -164871,7 +164891,7 @@ async function validateRootDirectory(output2, cwd, path11, errorSuffix) {
|
|
164871
164891
|
);
|
164872
164892
|
return false;
|
164873
164893
|
}
|
164874
|
-
if (!path11.startsWith(
|
164894
|
+
if (!path11.startsWith(cwd2)) {
|
164875
164895
|
output2.error(
|
164876
164896
|
`The provided path ${import_chalk38.default.cyan(
|
164877
164897
|
`\u201C${humanizePath(path11)}\u201D`
|
@@ -164927,7 +164947,7 @@ var init_validate_paths = __esm({
|
|
164927
164947
|
});
|
164928
164948
|
|
164929
164949
|
// src/util/input/input-root-directory.ts
|
164930
|
-
async function inputRootDirectory(client2,
|
164950
|
+
async function inputRootDirectory(client2, cwd2, autoConfirm = false) {
|
164931
164951
|
if (autoConfirm) {
|
164932
164952
|
return null;
|
164933
164953
|
}
|
@@ -164947,10 +164967,10 @@ async function inputRootDirectory(client2, cwd, autoConfirm = false) {
|
|
164947
164967
|
if (normal === "." || normal === "./") {
|
164948
164968
|
return null;
|
164949
164969
|
}
|
164950
|
-
const fullPath = import_path18.default.join(
|
164970
|
+
const fullPath = import_path18.default.join(cwd2, normal);
|
164951
164971
|
if (await validateRootDirectory(
|
164952
164972
|
client2.output,
|
164953
|
-
|
164973
|
+
cwd2,
|
164954
164974
|
fullPath,
|
164955
164975
|
"Please choose a different one."
|
164956
164976
|
) === false) {
|
@@ -165141,14 +165161,14 @@ var init_generate_cert_for_deploy = __esm({
|
|
165141
165161
|
});
|
165142
165162
|
|
165143
165163
|
// src/util/deploy/create-deploy.ts
|
165144
|
-
async function createDeploy(client2, now, contextName, path11, createArgs, org, isSettingUpProject,
|
165164
|
+
async function createDeploy(client2, now, contextName, path11, createArgs, org, isSettingUpProject, cwd2, archive) {
|
165145
165165
|
try {
|
165146
165166
|
return await now.create(
|
165147
165167
|
path11,
|
165148
165168
|
createArgs,
|
165149
165169
|
org,
|
165150
165170
|
isSettingUpProject,
|
165151
|
-
|
165171
|
+
cwd2,
|
165152
165172
|
archive
|
165153
165173
|
);
|
165154
165174
|
} catch (err) {
|
@@ -165214,7 +165234,7 @@ async function createDeploy(client2, now, contextName, path11, createArgs, org,
|
|
165214
165234
|
createArgs,
|
165215
165235
|
org,
|
165216
165236
|
isSettingUpProject,
|
165217
|
-
|
165237
|
+
cwd2
|
165218
165238
|
);
|
165219
165239
|
}
|
165220
165240
|
if (err.code === "not_found") {
|
@@ -165270,7 +165290,7 @@ function printInspectUrl(output2, inspectorUrl, deployStamp) {
|
|
165270
165290
|
}
|
165271
165291
|
async function processDeployment({
|
165272
165292
|
org,
|
165273
|
-
cwd,
|
165293
|
+
cwd: cwd2,
|
165274
165294
|
projectName,
|
165275
165295
|
isSettingUpProject,
|
165276
165296
|
archive,
|
@@ -165365,7 +165385,7 @@ async function processDeployment({
|
|
165365
165385
|
const deployment = event.payload;
|
165366
165386
|
await linkFolderToProject(
|
165367
165387
|
client2,
|
165368
|
-
|
165388
|
+
cwd2,
|
165369
165389
|
{
|
165370
165390
|
orgId: org.id,
|
165371
165391
|
projectId: deployment.projectId
|
@@ -165526,7 +165546,7 @@ var init_util = __esm({
|
|
165526
165546
|
skipAutoDetectionConfirmation,
|
165527
165547
|
noWait,
|
165528
165548
|
autoAssignCustomDomains
|
165529
|
-
}, org, isSettingUpProject,
|
165549
|
+
}, org, isSettingUpProject, cwd2, archive) {
|
165530
165550
|
let hashes = {};
|
165531
165551
|
const uploadStamp = stamp_default();
|
165532
165552
|
let requestBody = {
|
@@ -165561,7 +165581,7 @@ var init_util = __esm({
|
|
165561
165581
|
isSettingUpProject,
|
165562
165582
|
archive,
|
165563
165583
|
skipAutoDetectionConfirmation,
|
165564
|
-
cwd,
|
165584
|
+
cwd: cwd2,
|
165565
165585
|
prebuilt,
|
165566
165586
|
rootDirectory,
|
165567
165587
|
noWait
|
@@ -166093,14 +166113,14 @@ var init_setup_and_link = __esm({
|
|
166093
166113
|
});
|
166094
166114
|
|
166095
166115
|
// src/util/link/ensure-link.ts
|
166096
|
-
async function ensureLink(commandName, client2,
|
166116
|
+
async function ensureLink(commandName, client2, cwd2, opts = {}) {
|
166097
166117
|
let { link: link4 } = opts;
|
166098
166118
|
if (!link4) {
|
166099
|
-
link4 = await getLinkedProject(client2,
|
166119
|
+
link4 = await getLinkedProject(client2, cwd2);
|
166100
166120
|
opts.link = link4;
|
166101
166121
|
}
|
166102
166122
|
if (link4.status === "linked" && opts.forceDelete || link4.status === "not_linked") {
|
166103
|
-
link4 = await setupAndLink(client2,
|
166123
|
+
link4 = await setupAndLink(client2, cwd2, opts);
|
166104
166124
|
if (link4.status === "not_linked") {
|
166105
166125
|
return 0;
|
166106
166126
|
}
|
@@ -166221,7 +166241,7 @@ function parseArgs(client2) {
|
|
166221
166241
|
}
|
166222
166242
|
return argv2;
|
166223
166243
|
}
|
166224
|
-
async function pullAllEnvFiles(environment, client2, link4, project, argv2,
|
166244
|
+
async function pullAllEnvFiles(environment, client2, link4, project, argv2, cwd2) {
|
166225
166245
|
const environmentFile = `.env.${environment}.local`;
|
166226
166246
|
return pull(
|
166227
166247
|
client2,
|
@@ -166231,7 +166251,7 @@ async function pullAllEnvFiles(environment, client2, link4, project, argv2, cwd)
|
|
166231
166251
|
argv2,
|
166232
166252
|
[(0, import_path20.join)(".vercel", environmentFile)],
|
166233
166253
|
client2.output,
|
166234
|
-
|
166254
|
+
cwd2,
|
166235
166255
|
"vercel-cli:pull"
|
166236
166256
|
);
|
166237
166257
|
}
|
@@ -166248,16 +166268,16 @@ async function main(client2) {
|
|
166248
166268
|
if (typeof argv2 === "number") {
|
166249
166269
|
return argv2;
|
166250
166270
|
}
|
166251
|
-
let
|
166271
|
+
let cwd2 = argv2._[1] || client2.cwd;
|
166252
166272
|
const autoConfirm = Boolean(argv2["--yes"]);
|
166253
166273
|
const environment = parseEnvironment(argv2["--environment"] || void 0);
|
166254
|
-
const link4 = await ensureLink("pull", client2,
|
166274
|
+
const link4 = await ensureLink("pull", client2, cwd2, { autoConfirm });
|
166255
166275
|
if (typeof link4 === "number") {
|
166256
166276
|
return link4;
|
166257
166277
|
}
|
166258
166278
|
const { project, org, repoRoot } = link4;
|
166259
166279
|
if (repoRoot) {
|
166260
|
-
|
166280
|
+
cwd2 = (0, import_path20.join)(repoRoot, project.rootDirectory || "");
|
166261
166281
|
}
|
166262
166282
|
client2.config.currentTeam = org.type === "team" ? org.id : void 0;
|
166263
166283
|
const pullResultCode = await pullAllEnvFiles(
|
@@ -166266,7 +166286,7 @@ async function main(client2) {
|
|
166266
166286
|
link4,
|
166267
166287
|
project,
|
166268
166288
|
argv2,
|
166269
|
-
|
166289
|
+
cwd2
|
166270
166290
|
);
|
166271
166291
|
if (pullResultCode !== 0) {
|
166272
166292
|
return pullResultCode;
|
@@ -166274,12 +166294,12 @@ async function main(client2) {
|
|
166274
166294
|
client2.output.print("\n");
|
166275
166295
|
client2.output.log("Downloading project settings");
|
166276
166296
|
const isRepoLinked = typeof repoRoot === "string";
|
166277
|
-
await writeProjectSettings(
|
166297
|
+
await writeProjectSettings(cwd2, project, org, isRepoLinked);
|
166278
166298
|
const settingsStamp = stamp_default();
|
166279
166299
|
client2.output.print(
|
166280
166300
|
`${prependEmoji(
|
166281
166301
|
`Downloaded project settings to ${import_chalk44.default.bold(
|
166282
|
-
humanizePath((0, import_path20.join)(
|
166302
|
+
humanizePath((0, import_path20.join)(cwd2, VERCEL_DIR2, VERCEL_DIR_PROJECT))
|
166283
166303
|
)} ${import_chalk44.default.gray(settingsStamp())}`,
|
166284
166304
|
emoji("success")
|
166285
166305
|
)}
|
@@ -168500,10 +168520,11 @@ var init_unzip = __esm({
|
|
168500
168520
|
});
|
168501
168521
|
|
168502
168522
|
// src/util/build/write-build-result.ts
|
168503
|
-
async function writeBuildResult(outputDir, buildResult, build2, builder, builderPkg, vercelConfig) {
|
168523
|
+
async function writeBuildResult(repoRootPath, outputDir, buildResult, build2, builder, builderPkg, vercelConfig) {
|
168504
168524
|
const { version: version2 } = builder;
|
168505
168525
|
if (typeof version2 !== "number" || version2 === 2) {
|
168506
168526
|
return writeBuildResultV2(
|
168527
|
+
repoRootPath,
|
168507
168528
|
outputDir,
|
168508
168529
|
buildResult,
|
168509
168530
|
build2,
|
@@ -168511,6 +168532,7 @@ async function writeBuildResult(outputDir, buildResult, build2, builder, builder
|
|
168511
168532
|
);
|
168512
168533
|
} else if (version2 === 3) {
|
168513
168534
|
return writeBuildResultV3(
|
168535
|
+
repoRootPath,
|
168514
168536
|
outputDir,
|
168515
168537
|
buildResult,
|
168516
168538
|
build2,
|
@@ -168537,7 +168559,7 @@ function isFile(v) {
|
|
168537
168559
|
function stripDuplicateSlashes(path11) {
|
168538
168560
|
return normalize2(path11).replace(/(^\/|\/$)/g, "");
|
168539
168561
|
}
|
168540
|
-
async function writeBuildResultV2(outputDir, buildResult, build2, vercelConfig) {
|
168562
|
+
async function writeBuildResultV2(repoRootPath, outputDir, buildResult, build2, vercelConfig) {
|
168541
168563
|
if ("buildOutputPath" in buildResult) {
|
168542
168564
|
await mergeBuilderOutput(outputDir, buildResult);
|
168543
168565
|
return;
|
@@ -168555,6 +168577,7 @@ async function writeBuildResultV2(outputDir, buildResult, build2, vercelConfig)
|
|
168555
168577
|
const normalizedPath = stripDuplicateSlashes(path11);
|
168556
168578
|
if (isLambda(output2)) {
|
168557
168579
|
await writeLambda(
|
168580
|
+
repoRootPath,
|
168558
168581
|
outputDir,
|
168559
168582
|
output2,
|
168560
168583
|
normalizedPath,
|
@@ -168568,6 +168591,7 @@ async function writeBuildResultV2(outputDir, buildResult, build2, vercelConfig)
|
|
168568
168591
|
);
|
168569
168592
|
}
|
168570
168593
|
await writeLambda(
|
168594
|
+
repoRootPath,
|
168571
168595
|
outputDir,
|
168572
168596
|
output2.lambda,
|
168573
168597
|
normalizedPath,
|
@@ -168620,6 +168644,7 @@ async function writeBuildResultV2(outputDir, buildResult, build2, vercelConfig)
|
|
168620
168644
|
);
|
168621
168645
|
} else if (isEdgeFunction(output2)) {
|
168622
168646
|
await writeEdgeFunction(
|
168647
|
+
repoRootPath,
|
168623
168648
|
outputDir,
|
168624
168649
|
output2,
|
168625
168650
|
normalizedPath,
|
@@ -168633,7 +168658,7 @@ async function writeBuildResultV2(outputDir, buildResult, build2, vercelConfig)
|
|
168633
168658
|
}
|
168634
168659
|
return Object.keys(overrides).length > 0 ? overrides : void 0;
|
168635
168660
|
}
|
168636
|
-
async function writeBuildResultV3(outputDir, buildResult, build2, vercelConfig) {
|
168661
|
+
async function writeBuildResultV3(repoRootPath, outputDir, buildResult, build2, vercelConfig) {
|
168637
168662
|
const { output: output2 } = buildResult;
|
168638
168663
|
const src = build2.src;
|
168639
168664
|
if (typeof src !== "string") {
|
@@ -168648,9 +168673,15 @@ async function writeBuildResultV3(outputDir, buildResult, build2, vercelConfig)
|
|
168648
168673
|
build2.config?.zeroConfig ? src.substring(0, src.length - ext.length) : src
|
168649
168674
|
);
|
168650
168675
|
if (isLambda(output2)) {
|
168651
|
-
await writeLambda(
|
168676
|
+
await writeLambda(
|
168677
|
+
repoRootPath,
|
168678
|
+
outputDir,
|
168679
|
+
output2,
|
168680
|
+
path11,
|
168681
|
+
functionConfiguration
|
168682
|
+
);
|
168652
168683
|
} else if (isEdgeFunction(output2)) {
|
168653
|
-
await writeEdgeFunction(outputDir, output2, path11);
|
168684
|
+
await writeEdgeFunction(repoRootPath, outputDir, output2, path11);
|
168654
168685
|
} else {
|
168655
168686
|
throw new Error(
|
168656
168687
|
`Unsupported output type: "${output2.type}" for ${build2.src}`
|
@@ -168701,7 +168732,7 @@ async function writeFunctionSymlink(outputDir, dest, fn2, existingFunctions) {
|
|
168701
168732
|
await import_fs_extra15.default.symlink(target, dest);
|
168702
168733
|
return true;
|
168703
168734
|
}
|
168704
|
-
async function writeEdgeFunction(outputDir, edgeFunction, path11, existingFunctions) {
|
168735
|
+
async function writeEdgeFunction(repoRootPath, outputDir, edgeFunction, path11, existingFunctions) {
|
168705
168736
|
const dest = (0, import_path24.join)(outputDir, "functions", `${path11}.func`);
|
168706
168737
|
if (existingFunctions) {
|
168707
168738
|
if (await writeFunctionSymlink(
|
@@ -168716,11 +168747,16 @@ async function writeEdgeFunction(outputDir, edgeFunction, path11, existingFuncti
|
|
168716
168747
|
}
|
168717
168748
|
await import_fs_extra15.default.mkdirp(dest);
|
168718
168749
|
const ops = [];
|
168719
|
-
|
168750
|
+
const { files, filePathMap } = filesWithoutFsRefs(
|
168751
|
+
edgeFunction.files,
|
168752
|
+
repoRootPath
|
168753
|
+
);
|
168754
|
+
ops.push((0, import_build_utils8.download)(files, dest));
|
168720
168755
|
const config3 = {
|
168721
168756
|
runtime: "edge",
|
168722
168757
|
...edgeFunction,
|
168723
168758
|
entrypoint: (0, import_build_utils8.normalizePath)(edgeFunction.entrypoint),
|
168759
|
+
filePathMap,
|
168724
168760
|
files: void 0,
|
168725
168761
|
type: void 0
|
168726
168762
|
};
|
@@ -168732,7 +168768,7 @@ async function writeEdgeFunction(outputDir, edgeFunction, path11, existingFuncti
|
|
168732
168768
|
);
|
168733
168769
|
await Promise.all(ops);
|
168734
168770
|
}
|
168735
|
-
async function writeLambda(outputDir, lambda, path11, functionConfiguration, existingFunctions) {
|
168771
|
+
async function writeLambda(repoRootPath, outputDir, lambda, path11, functionConfiguration, existingFunctions) {
|
168736
168772
|
const dest = (0, import_path24.join)(outputDir, "functions", `${path11}.func`);
|
168737
168773
|
if (existingFunctions) {
|
168738
168774
|
if (await writeFunctionSymlink(outputDir, dest, lambda, existingFunctions)) {
|
@@ -168742,8 +168778,11 @@ async function writeLambda(outputDir, lambda, path11, functionConfiguration, exi
|
|
168742
168778
|
}
|
168743
168779
|
await import_fs_extra15.default.mkdirp(dest);
|
168744
168780
|
const ops = [];
|
168781
|
+
let filePathMap;
|
168745
168782
|
if (lambda.files) {
|
168746
|
-
|
168783
|
+
const f = filesWithoutFsRefs(lambda.files, repoRootPath);
|
168784
|
+
filePathMap = f.filePathMap;
|
168785
|
+
ops.push((0, import_build_utils8.download)(f.files, dest));
|
168747
168786
|
} else if (lambda.zipBuffer) {
|
168748
168787
|
ops.push(unzip(lambda.zipBuffer, dest));
|
168749
168788
|
} else {
|
@@ -168756,6 +168795,7 @@ async function writeLambda(outputDir, lambda, path11, functionConfiguration, exi
|
|
168756
168795
|
handler: (0, import_build_utils8.normalizePath)(lambda.handler),
|
168757
168796
|
memory,
|
168758
168797
|
maxDuration,
|
168798
|
+
filePathMap,
|
168759
168799
|
type: void 0,
|
168760
168800
|
files: void 0,
|
168761
168801
|
zipBuffer: void 0
|
@@ -168828,6 +168868,20 @@ async function* findDirs(name, dir, root = dir) {
|
|
168828
168868
|
}
|
168829
168869
|
}
|
168830
168870
|
}
|
168871
|
+
function filesWithoutFsRefs(files, repoRootPath) {
|
168872
|
+
let filePathMap;
|
168873
|
+
const out = {};
|
168874
|
+
for (const [path11, file] of Object.entries(files)) {
|
168875
|
+
if (file.type === "FileFsRef") {
|
168876
|
+
if (!filePathMap)
|
168877
|
+
filePathMap = {};
|
168878
|
+
filePathMap[path11] = (0, import_path24.relative)(repoRootPath, file.fsPath);
|
168879
|
+
} else {
|
168880
|
+
out[path11] = file;
|
168881
|
+
}
|
168882
|
+
}
|
168883
|
+
return { files: out, filePathMap };
|
168884
|
+
}
|
168831
168885
|
var import_fs_extra15, import_mime_types, import_path24, import_build_utils8, import_promisepipe2, import_client6, normalize2, OUTPUT_DIR;
|
168832
168886
|
var init_write_build_result = __esm({
|
168833
168887
|
"src/util/build/write-build-result.ts"() {
|
@@ -169734,8 +169788,8 @@ var init_static_builder = __esm({
|
|
169734
169788
|
});
|
169735
169789
|
|
169736
169790
|
// src/util/build/import-builders.ts
|
169737
|
-
async function importBuilders(builderSpecs,
|
169738
|
-
const buildersDir = (0, import_path25.join)(
|
169791
|
+
async function importBuilders(builderSpecs, cwd2, output2) {
|
169792
|
+
const buildersDir = (0, import_path25.join)(cwd2, VERCEL_DIR2, "builders");
|
169739
169793
|
let importResult = await resolveBuilders(buildersDir, builderSpecs, output2);
|
169740
169794
|
if ("buildersToAdd" in importResult) {
|
169741
169795
|
const installResult = await installBuilders(
|
@@ -170190,10 +170244,10 @@ var init_validate_config = __esm({
|
|
170190
170244
|
});
|
170191
170245
|
|
170192
170246
|
// src/util/build/monorepo.ts
|
170193
|
-
async function setMonorepoDefaultSettings(
|
170194
|
-
const localFileSystem = new import_fs_detectors3.LocalFileSystemDetector(
|
170247
|
+
async function setMonorepoDefaultSettings(cwd2, workPath, projectSettings, output2) {
|
170248
|
+
const localFileSystem = new import_fs_detectors3.LocalFileSystemDetector(cwd2);
|
170195
170249
|
const projectName = (0, import_path27.basename)(workPath);
|
170196
|
-
const relativeToRoot = (0, import_path27.relative)(workPath,
|
170250
|
+
const relativeToRoot = (0, import_path27.relative)(workPath, cwd2);
|
170197
170251
|
const setCommand = (command, value) => {
|
170198
170252
|
if (projectSettings[command]) {
|
170199
170253
|
(0, import_build_utils12.debug)(
|
@@ -170206,7 +170260,7 @@ async function setMonorepoDefaultSettings(cwd, workPath, projectSettings, output
|
|
170206
170260
|
try {
|
170207
170261
|
const result = await (0, import_fs_detectors3.getMonorepoDefaultSettings)(
|
170208
170262
|
projectName,
|
170209
|
-
(0, import_path27.relative)(
|
170263
|
+
(0, import_path27.relative)(cwd2, workPath),
|
170210
170264
|
relativeToRoot,
|
170211
170265
|
localFileSystem
|
170212
170266
|
);
|
@@ -170322,10 +170376,11 @@ var init_scrub_argv = __esm({
|
|
170322
170376
|
// src/commands/build/index.ts
|
170323
170377
|
var build_exports = {};
|
170324
170378
|
__export3(build_exports, {
|
170325
|
-
default: () => main2
|
170379
|
+
default: () => main2,
|
170380
|
+
readInstalledVersion: () => readInstalledVersion
|
170326
170381
|
});
|
170327
170382
|
async function main2(client2) {
|
170328
|
-
let { cwd } = client2;
|
170383
|
+
let { cwd: cwd2 } = client2;
|
170329
170384
|
const { output: output2 } = client2;
|
170330
170385
|
if (process.env.__VERCEL_BUILD_RUNNING) {
|
170331
170386
|
output2.error(
|
@@ -170355,17 +170410,17 @@ async function main2(client2) {
|
|
170355
170410
|
const target = argv2["--prod"] ? "production" : "preview";
|
170356
170411
|
const yes = Boolean(argv2["--yes"]);
|
170357
170412
|
try {
|
170358
|
-
await (0, import_build_utils13.validateNpmrc)(
|
170413
|
+
await (0, import_build_utils13.validateNpmrc)(cwd2);
|
170359
170414
|
} catch (err) {
|
170360
170415
|
output2.prettyError(err);
|
170361
170416
|
return 1;
|
170362
170417
|
}
|
170363
|
-
const link4 = await getProjectLink(client2,
|
170418
|
+
const link4 = await getProjectLink(client2, cwd2);
|
170364
170419
|
const projectRootDirectory = link4?.projectRootDirectory ?? "";
|
170365
170420
|
if (link4?.repoRoot) {
|
170366
|
-
|
170421
|
+
cwd2 = client2.cwd = link4.repoRoot;
|
170367
170422
|
}
|
170368
|
-
const vercelDir = (0, import_path28.join)(
|
170423
|
+
const vercelDir = (0, import_path28.join)(cwd2, projectRootDirectory, VERCEL_DIR2);
|
170369
170424
|
let project = await readProjectSettings(vercelDir);
|
170370
170425
|
const isTTY3 = process.stdin.isTTY;
|
170371
170426
|
while (!project?.settings) {
|
@@ -170393,7 +170448,7 @@ async function main2(client2) {
|
|
170393
170448
|
return 0;
|
170394
170449
|
}
|
170395
170450
|
const { argv: originalArgv } = client2;
|
170396
|
-
client2.cwd = (0, import_path28.join)(
|
170451
|
+
client2.cwd = (0, import_path28.join)(cwd2, projectRootDirectory);
|
170397
170452
|
client2.argv = [
|
170398
170453
|
...originalArgv.slice(0, 2),
|
170399
170454
|
"pull",
|
@@ -170404,11 +170459,11 @@ async function main2(client2) {
|
|
170404
170459
|
if (result !== 0) {
|
170405
170460
|
return result;
|
170406
170461
|
}
|
170407
|
-
client2.cwd =
|
170462
|
+
client2.cwd = cwd2;
|
170408
170463
|
client2.argv = originalArgv;
|
170409
170464
|
project = await readProjectSettings(vercelDir);
|
170410
170465
|
}
|
170411
|
-
const defaultOutputDir = (0, import_path28.join)(
|
170466
|
+
const defaultOutputDir = (0, import_path28.join)(cwd2, projectRootDirectory, OUTPUT_DIR);
|
170412
170467
|
const outputDir = argv2["--output"] ? (0, import_path28.resolve)(argv2["--output"]) : defaultOutputDir;
|
170413
170468
|
await Promise.all([
|
170414
170469
|
import_fs_extra18.default.remove(outputDir),
|
@@ -170423,7 +170478,7 @@ async function main2(client2) {
|
|
170423
170478
|
const envToUnset = /* @__PURE__ */ new Set(["VERCEL", "NOW_BUILDER"]);
|
170424
170479
|
try {
|
170425
170480
|
const envPath = (0, import_path28.join)(
|
170426
|
-
|
170481
|
+
cwd2,
|
170427
170482
|
projectRootDirectory,
|
170428
170483
|
VERCEL_DIR2,
|
170429
170484
|
`.env.${target}.local`
|
@@ -170445,10 +170500,13 @@ async function main2(client2) {
|
|
170445
170500
|
if (project.settings.analyticsId) {
|
170446
170501
|
envToUnset.add("VERCEL_ANALYTICS_ID");
|
170447
170502
|
process.env.VERCEL_ANALYTICS_ID = project.settings.analyticsId;
|
170503
|
+
output2.warn(
|
170504
|
+
"Vercel Speed Insights auto-injection is deprecated in favor of @vercel/speed-insights package. Learn more: https://vercel.link/upgrate-to-speed-insights-package"
|
170505
|
+
);
|
170448
170506
|
}
|
170449
170507
|
process.env.VERCEL = "1";
|
170450
170508
|
process.env.NOW_BUILDER = "1";
|
170451
|
-
await doBuild(client2, project, buildsJson,
|
170509
|
+
await doBuild(client2, project, buildsJson, cwd2, outputDir);
|
170452
170510
|
return 0;
|
170453
170511
|
} catch (err) {
|
170454
170512
|
output2.prettyError(err);
|
@@ -170466,9 +170524,9 @@ async function main2(client2) {
|
|
170466
170524
|
}
|
170467
170525
|
}
|
170468
170526
|
}
|
170469
|
-
async function doBuild(client2, project, buildsJson,
|
170527
|
+
async function doBuild(client2, project, buildsJson, cwd2, outputDir) {
|
170470
170528
|
const { localConfigPath, output: output2 } = client2;
|
170471
|
-
const workPath = (0, import_path28.join)(
|
170529
|
+
const workPath = (0, import_path28.join)(cwd2, project.settings.rootDirectory || ".");
|
170472
170530
|
const [pkg, vercelConfig, nowConfig] = await Promise.all([
|
170473
170531
|
readJSONFile((0, import_path28.join)(workPath, "package.json")),
|
170474
170532
|
readJSONFile(
|
@@ -170497,7 +170555,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170497
170555
|
...pickOverrides(localConfig)
|
170498
170556
|
};
|
170499
170557
|
if (process.env.VERCEL_BUILD_MONOREPO_SUPPORT === "1" && pkg?.scripts?.["vercel-build"] === void 0 && projectSettings.rootDirectory !== null && projectSettings.rootDirectory !== ".") {
|
170500
|
-
await setMonorepoDefaultSettings(
|
170558
|
+
await setMonorepoDefaultSettings(cwd2, workPath, projectSettings, output2);
|
170501
170559
|
}
|
170502
170560
|
const files = (await staticFiles(workPath, client2)).map(
|
170503
170561
|
(f) => (0, import_build_utils13.normalizePath)((0, import_path28.relative)(workPath, f))
|
@@ -170558,7 +170616,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170558
170616
|
zeroConfigRoutes.push(...detectedBuilders.defaultRoutes || []);
|
170559
170617
|
}
|
170560
170618
|
const builderSpecs = new Set(builds.map((b) => b.use));
|
170561
|
-
const buildersWithPkgs = await importBuilders(builderSpecs,
|
170619
|
+
const buildersWithPkgs = await importBuilders(builderSpecs, cwd2, output2);
|
170562
170620
|
const filesMap = {};
|
170563
170621
|
for (const path11 of files) {
|
170564
170622
|
const fsPath = (0, import_path28.join)(workPath, path11);
|
@@ -170568,27 +170626,6 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170568
170626
|
const buildStamp = stamp_default();
|
170569
170627
|
await import_fs_extra18.default.mkdirp(outputDir);
|
170570
170628
|
const ops = [];
|
170571
|
-
const dependencyMap = makeDepencyMap(pkg);
|
170572
|
-
const speedInsighsVersion = dependencyMap.get("@vercel/speed-insights");
|
170573
|
-
if (speedInsighsVersion) {
|
170574
|
-
if (process.env.VERCEL_ANALYTICS_ID) {
|
170575
|
-
output2.warn(
|
170576
|
-
`The \`VERCEL_ANALYTICS_ID\` environment variable is deprecated and will be removed in a future release. Please remove it from your environment variables`
|
170577
|
-
);
|
170578
|
-
delete process.env.VERCEL_ANALYTICS_ID;
|
170579
|
-
}
|
170580
|
-
buildsJson.features = {
|
170581
|
-
...buildsJson.features ?? {},
|
170582
|
-
speedInsightsVersion: speedInsighsVersion
|
170583
|
-
};
|
170584
|
-
}
|
170585
|
-
const webAnalyticsVersion = dependencyMap.get("@vercel/analytics");
|
170586
|
-
if (webAnalyticsVersion) {
|
170587
|
-
buildsJson.features = {
|
170588
|
-
...buildsJson.features ?? {},
|
170589
|
-
webAnalyticsVersion
|
170590
|
-
};
|
170591
|
-
}
|
170592
170629
|
const buildsJsonBuilds = new Map(
|
170593
170630
|
builds.map((build2) => {
|
170594
170631
|
const builderWithPkg = buildersWithPkgs.get(build2.use);
|
@@ -170608,9 +170645,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170608
170645
|
})
|
170609
170646
|
);
|
170610
170647
|
buildsJson.builds = Array.from(buildsJsonBuilds.values());
|
170611
|
-
await
|
170612
|
-
spaces: 2
|
170613
|
-
});
|
170648
|
+
await writeBuildJson(buildsJson, outputDir);
|
170614
170649
|
const meta = {
|
170615
170650
|
skipDownload: true,
|
170616
170651
|
cliVersion: pkg_default.version
|
@@ -170618,7 +170653,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170618
170653
|
const sortedBuilders = sortBuilders(builds);
|
170619
170654
|
const buildResults = /* @__PURE__ */ new Map();
|
170620
170655
|
const overrides = [];
|
170621
|
-
const repoRootPath =
|
170656
|
+
const repoRootPath = cwd2;
|
170622
170657
|
const corepackShimDir = await initCorepack({ repoRootPath });
|
170623
170658
|
for (const build2 of sortedBuilders) {
|
170624
170659
|
if (typeof build2.src !== "string")
|
@@ -170677,6 +170712,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170677
170712
|
buildResults.set(build2, buildResult);
|
170678
170713
|
ops.push(
|
170679
170714
|
writeBuildResult(
|
170715
|
+
repoRootPath,
|
170680
170716
|
outputDir,
|
170681
170717
|
buildResult,
|
170682
170718
|
build2,
|
@@ -170708,6 +170744,32 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170708
170744
|
throw error4;
|
170709
170745
|
}
|
170710
170746
|
}
|
170747
|
+
let needBuildsJsonOverride = false;
|
170748
|
+
const speedInsightsVersion = await readInstalledVersion(
|
170749
|
+
client2,
|
170750
|
+
"@vercel/speed-insights"
|
170751
|
+
);
|
170752
|
+
if (speedInsightsVersion) {
|
170753
|
+
buildsJson.features = {
|
170754
|
+
...buildsJson.features ?? {},
|
170755
|
+
speedInsightsVersion
|
170756
|
+
};
|
170757
|
+
needBuildsJsonOverride = true;
|
170758
|
+
}
|
170759
|
+
const webAnalyticsVersion = await readInstalledVersion(
|
170760
|
+
client2,
|
170761
|
+
"@vercel/analytics"
|
170762
|
+
);
|
170763
|
+
if (webAnalyticsVersion) {
|
170764
|
+
buildsJson.features = {
|
170765
|
+
...buildsJson.features ?? {},
|
170766
|
+
webAnalyticsVersion
|
170767
|
+
};
|
170768
|
+
needBuildsJsonOverride = true;
|
170769
|
+
}
|
170770
|
+
if (needBuildsJsonOverride) {
|
170771
|
+
await writeBuildJson(buildsJson, outputDir);
|
170772
|
+
}
|
170711
170773
|
const configPath = (0, import_path28.join)(outputDir, "config.json");
|
170712
170774
|
const existingConfig = await readJSONFile(configPath);
|
170713
170775
|
if (existingConfig instanceof CantParseJSONFile) {
|
@@ -170750,7 +170812,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170750
170812
|
const mergedWildcard = mergeWildcard(buildResults.values());
|
170751
170813
|
const mergedOverrides = overrides.length > 0 ? Object.assign({}, ...overrides) : void 0;
|
170752
170814
|
const mergedFlags = mergeFlags(buildResults.values());
|
170753
|
-
const framework = await getFramework(
|
170815
|
+
const framework = await getFramework(cwd2, buildResults);
|
170754
170816
|
const config3 = {
|
170755
170817
|
version: 3,
|
170756
170818
|
routes: mergedRoutes,
|
@@ -170762,7 +170824,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170762
170824
|
flags: mergedFlags
|
170763
170825
|
};
|
170764
170826
|
await import_fs_extra18.default.writeJSON((0, import_path28.join)(outputDir, "config.json"), config3, { spaces: 2 });
|
170765
|
-
const relOutputDir = (0, import_path28.relative)(
|
170827
|
+
const relOutputDir = (0, import_path28.relative)(cwd2, outputDir);
|
170766
170828
|
output2.print(
|
170767
170829
|
`${prependEmoji(
|
170768
170830
|
`Build Completed in ${import_chalk45.default.bold(
|
@@ -170773,9 +170835,9 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170773
170835
|
`
|
170774
170836
|
);
|
170775
170837
|
}
|
170776
|
-
async function getFramework(
|
170838
|
+
async function getFramework(cwd2, buildResults) {
|
170777
170839
|
const detectedFramework = await (0, import_fs_detectors4.detectFrameworkRecord)({
|
170778
|
-
fs: new import_fs_detectors4.LocalFileSystemDetector(
|
170840
|
+
fs: new import_fs_detectors4.LocalFileSystemDetector(cwd2),
|
170779
170841
|
frameworkList: import_frameworks4.default
|
170780
170842
|
});
|
170781
170843
|
if (!detectedFramework) {
|
@@ -170868,13 +170930,24 @@ function mergeFlags(buildResults) {
|
|
170868
170930
|
return [];
|
170869
170931
|
});
|
170870
170932
|
}
|
170871
|
-
function
|
170872
|
-
|
170873
|
-
|
170874
|
-
|
170875
|
-
|
170933
|
+
async function writeBuildJson(buildsJson, outputDir) {
|
170934
|
+
await import_fs_extra18.default.writeJSON((0, import_path28.join)(outputDir, "builds.json"), buildsJson, { spaces: 2 });
|
170935
|
+
}
|
170936
|
+
async function readInstalledVersion({ output: output2 }, pkgName) {
|
170937
|
+
try {
|
170938
|
+
const descriptorPath = require.resolve(`${pkgName}/package.json`, {
|
170939
|
+
paths: [(0, import_process.cwd)()]
|
170940
|
+
});
|
170941
|
+
const descriptor2 = await (0, import_fs_extra18.readJSON)(descriptorPath);
|
170942
|
+
return descriptor2?.version;
|
170943
|
+
} catch (err) {
|
170944
|
+
output2.debug(
|
170945
|
+
`Package ${pkgName} is not installed (failed to read its package.json: ${err})`
|
170946
|
+
);
|
170947
|
+
}
|
170948
|
+
return;
|
170876
170949
|
}
|
170877
|
-
var import_fs_extra18, import_chalk45, import_dotenv, import_semver3, import_minimatch2, import_path28, import_frameworks4, import_build_utils13, import_fs_detectors4, import_routing_utils2, import_client8;
|
170950
|
+
var import_fs_extra18, import_chalk45, import_dotenv, import_semver3, import_minimatch2, import_path28, import_frameworks4, import_build_utils13, import_fs_detectors4, import_routing_utils2, import_client8, import_process;
|
170878
170951
|
var init_build = __esm({
|
170879
170952
|
"src/commands/build/index.ts"() {
|
170880
170953
|
"use strict";
|
@@ -170912,6 +170985,7 @@ var init_build = __esm({
|
|
170912
170985
|
init_help();
|
170913
170986
|
init_command4();
|
170914
170987
|
init_scrub_argv();
|
170988
|
+
import_process = require("process");
|
170915
170989
|
}
|
170916
170990
|
});
|
170917
170991
|
|
@@ -172071,7 +172145,7 @@ var init_command6 = __esm({
|
|
172071
172145
|
shorthand: null,
|
172072
172146
|
type: "boolean",
|
172073
172147
|
deprecated: false,
|
172074
|
-
description:
|
172148
|
+
description: "Disable the automatic promotion (aliasing) of the relevant domains to a new production deployment. You can use `vc promote` to complete the domain-assignment process later",
|
172075
172149
|
multi: false
|
172076
172150
|
},
|
172077
172151
|
{
|
@@ -172317,7 +172391,7 @@ var init_deploy = __esm({
|
|
172317
172391
|
}
|
172318
172392
|
const { log: log2, debug: debug3, error: error4, prettyError } = output2;
|
172319
172393
|
const quiet = !client2.stdout.isTTY;
|
172320
|
-
let { path:
|
172394
|
+
let { path: cwd2 } = pathValidation;
|
172321
172395
|
const autoConfirm = argv2["--yes"];
|
172322
172396
|
if (argv2["--name"]) {
|
172323
172397
|
output2.print(
|
@@ -172350,7 +172424,7 @@ var init_deploy = __esm({
|
|
172350
172424
|
output2.error(`Format must be one of: ${import_client10.VALID_ARCHIVE_FORMATS.join(", ")}`);
|
172351
172425
|
return 1;
|
172352
172426
|
}
|
172353
|
-
const link4 = await getLinkedProject(client2,
|
172427
|
+
const link4 = await getLinkedProject(client2, cwd2);
|
172354
172428
|
if (link4.status === "error") {
|
172355
172429
|
return link4.exitCode;
|
172356
172430
|
}
|
@@ -172361,7 +172435,7 @@ var init_deploy = __esm({
|
|
172361
172435
|
if (status === "not_linked") {
|
172362
172436
|
const shouldStartSetup = autoConfirm || await confirm(
|
172363
172437
|
client2,
|
172364
|
-
`Set up and deploy ${import_chalk53.default.cyan(`\u201C${humanizePath(
|
172438
|
+
`Set up and deploy ${import_chalk53.default.cyan(`\u201C${humanizePath(cwd2)}\u201D`)}?`,
|
172365
172439
|
true
|
172366
172440
|
);
|
172367
172441
|
if (!shouldStartSetup) {
|
@@ -172395,14 +172469,14 @@ var init_deploy = __esm({
|
|
172395
172469
|
);
|
172396
172470
|
if (typeof projectOrNewProjectName === "string") {
|
172397
172471
|
newProjectName = projectOrNewProjectName;
|
172398
|
-
rootDirectory = await inputRootDirectory(client2,
|
172472
|
+
rootDirectory = await inputRootDirectory(client2, cwd2, autoConfirm);
|
172399
172473
|
} else {
|
172400
172474
|
project = projectOrNewProjectName;
|
172401
172475
|
rootDirectory = project.rootDirectory;
|
172402
172476
|
sourceFilesOutsideRootDirectory = project.sourceFilesOutsideRootDirectory;
|
172403
172477
|
await linkFolderToProject(
|
172404
172478
|
client2,
|
172405
|
-
|
172479
|
+
cwd2,
|
172406
172480
|
{
|
172407
172481
|
projectId: project.id,
|
172408
172482
|
orgId: org.id
|
@@ -172414,16 +172488,16 @@ var init_deploy = __esm({
|
|
172414
172488
|
}
|
172415
172489
|
}
|
172416
172490
|
if (link4.status === "linked" && link4.repoRoot) {
|
172417
|
-
|
172491
|
+
cwd2 = link4.repoRoot;
|
172418
172492
|
}
|
172419
172493
|
if (!org) {
|
172420
172494
|
throw new Error(`"org" is not defined`);
|
172421
172495
|
}
|
172422
172496
|
if (argv2["--prebuilt"]) {
|
172423
172497
|
if (link4.status === "linked" && link4.repoRoot && link4.project.rootDirectory) {
|
172424
|
-
|
172498
|
+
cwd2 = (0, import_path32.join)(cwd2, link4.project.rootDirectory);
|
172425
172499
|
}
|
172426
|
-
const prebuiltExists = await import_fs_extra20.default.pathExists((0, import_path32.join)(
|
172500
|
+
const prebuiltExists = await import_fs_extra20.default.pathExists((0, import_path32.join)(cwd2, ".vercel/output"));
|
172427
172501
|
if (!prebuiltExists) {
|
172428
172502
|
error4(
|
172429
172503
|
`The ${param(
|
@@ -172434,7 +172508,7 @@ var init_deploy = __esm({
|
|
172434
172508
|
);
|
172435
172509
|
return 1;
|
172436
172510
|
}
|
172437
|
-
const prebuiltBuild = await getPrebuiltJson(
|
172511
|
+
const prebuiltBuild = await getPrebuiltJson(cwd2);
|
172438
172512
|
const prebuiltError = prebuiltBuild?.error || prebuiltBuild?.builds?.find((build2) => "error" in build2)?.error;
|
172439
172513
|
if (prebuiltError) {
|
172440
172514
|
output2.log(
|
@@ -172463,17 +172537,17 @@ var init_deploy = __esm({
|
|
172463
172537
|
}
|
172464
172538
|
const contextName = org.slug;
|
172465
172539
|
client2.config.currentTeam = org.type === "team" ? org.id : void 0;
|
172466
|
-
const sourcePath = rootDirectory && !sourceFilesOutsideRootDirectory ? (0, import_path32.join)(
|
172540
|
+
const sourcePath = rootDirectory && !sourceFilesOutsideRootDirectory ? (0, import_path32.join)(cwd2, rootDirectory) : cwd2;
|
172467
172541
|
if (rootDirectory && await validateRootDirectory(
|
172468
172542
|
output2,
|
172469
|
-
|
172543
|
+
cwd2,
|
172470
172544
|
sourcePath,
|
172471
172545
|
project ? `To change your Project Settings, go to https://vercel.com/${org?.slug}/${project.name}/settings` : ""
|
172472
172546
|
) === false) {
|
172473
172547
|
return 1;
|
172474
172548
|
}
|
172475
172549
|
if (rootDirectory) {
|
172476
|
-
const rootDirectoryConfig = readLocalConfig((0, import_path32.join)(
|
172550
|
+
const rootDirectoryConfig = readLocalConfig((0, import_path32.join)(cwd2, rootDirectory));
|
172477
172551
|
if (rootDirectoryConfig) {
|
172478
172552
|
debug3(`Read local config from root directory (${rootDirectory})`);
|
172479
172553
|
localConfig = rootDirectoryConfig;
|
@@ -172533,7 +172607,7 @@ var init_deploy = __esm({
|
|
172533
172607
|
parseMeta(localConfig.meta),
|
172534
172608
|
parseMeta(argv2["--meta"])
|
172535
172609
|
);
|
172536
|
-
const gitMetadata = await createGitMeta(
|
172610
|
+
const gitMetadata = await createGitMeta(cwd2, output2, project);
|
172537
172611
|
const deploymentEnv = Object.assign(
|
172538
172612
|
{},
|
172539
172613
|
parseEnv(localConfig.env),
|
@@ -172608,7 +172682,7 @@ var init_deploy = __esm({
|
|
172608
172682
|
createArgs,
|
172609
172683
|
org,
|
172610
172684
|
!project,
|
172611
|
-
|
172685
|
+
cwd2,
|
172612
172686
|
archive
|
172613
172687
|
);
|
172614
172688
|
if (deployment.code === "missing_project_settings") {
|
@@ -172637,7 +172711,7 @@ var init_deploy = __esm({
|
|
172637
172711
|
createArgs,
|
172638
172712
|
org,
|
172639
172713
|
false,
|
172640
|
-
|
172714
|
+
cwd2
|
172641
172715
|
);
|
172642
172716
|
}
|
172643
172717
|
if (deployment instanceof NotDomainOwner) {
|
@@ -184714,8 +184788,8 @@ var require_src3 = __commonJS2({
|
|
184714
184788
|
sendError
|
184715
184789
|
}, methods);
|
184716
184790
|
module2.exports = async (request, response, config3 = {}, methods = {}) => {
|
184717
|
-
const
|
184718
|
-
const current = config3.public ? path11.resolve(
|
184791
|
+
const cwd2 = process.cwd();
|
184792
|
+
const current = config3.public ? path11.resolve(cwd2, config3.public) : cwd2;
|
184719
184793
|
const handlers = getHandlers(methods);
|
184720
184794
|
let relativePath = null;
|
184721
184795
|
let acceptsJSON = null;
|
@@ -185740,8 +185814,9 @@ Please run \`${await getUpdateCommand()}\` to update to the latest CLI.`
|
|
185740
185814
|
if (oldAsset && oldAsset.type === "Lambda" && oldAsset.fn) {
|
185741
185815
|
await oldAsset.fn.destroy();
|
185742
185816
|
}
|
185817
|
+
const ZipFile2 = asset.zipBuffer || await asset.createZip();
|
185743
185818
|
asset.fn = await (0, import_fun.createFunction)({
|
185744
|
-
Code: { ZipFile:
|
185819
|
+
Code: { ZipFile: ZipFile2 },
|
185745
185820
|
Handler: asset.handler,
|
185746
185821
|
Runtime: asset.runtime,
|
185747
185822
|
MemorySize: asset.memory || 3008,
|
@@ -185766,7 +185841,7 @@ Please run \`${await getUpdateCommand()}\` to update to the latest CLI.`
|
|
185766
185841
|
);
|
185767
185842
|
}
|
185768
185843
|
}
|
185769
|
-
async function getBuildMatches(vercelConfig,
|
185844
|
+
async function getBuildMatches(vercelConfig, cwd2, output2, devServer, fileList) {
|
185770
185845
|
const matches = [];
|
185771
185846
|
if (fileList.length === 0) {
|
185772
185847
|
return matches;
|
@@ -185774,7 +185849,7 @@ async function getBuildMatches(vercelConfig, cwd, output2, devServer, fileList)
|
|
185774
185849
|
const noMatches = [];
|
185775
185850
|
const builds = vercelConfig.builds || [{ src: "**", use: "@vercel/static" }];
|
185776
185851
|
const builderSpecs = new Set(builds.map((b) => b.use).filter(Boolean));
|
185777
|
-
const buildersWithPkgs = await importBuilders(builderSpecs,
|
185852
|
+
const buildersWithPkgs = await importBuilders(builderSpecs, cwd2, output2);
|
185778
185853
|
for (const buildConfig of builds) {
|
185779
185854
|
let { src = "**", use, config: config3 = {} } = buildConfig;
|
185780
185855
|
if (!use) {
|
@@ -185789,12 +185864,12 @@ async function getBuildMatches(vercelConfig, cwd, output2, devServer, fileList)
|
|
185789
185864
|
mapToEntrypoint.set(extensionless, src);
|
185790
185865
|
src = extensionless;
|
185791
185866
|
}
|
185792
|
-
const files = fileList.filter((name) => name === src || (0, import_minimatch3.default)(name, src, { dot: true })).map((name) => (0, import_path35.join)(
|
185867
|
+
const files = fileList.filter((name) => name === src || (0, import_minimatch3.default)(name, src, { dot: true })).map((name) => (0, import_path35.join)(cwd2, name));
|
185793
185868
|
if (files.length === 0) {
|
185794
185869
|
noMatches.push(buildConfig);
|
185795
185870
|
}
|
185796
185871
|
for (const file of files) {
|
185797
|
-
src = relative6(
|
185872
|
+
src = relative6(cwd2, file);
|
185798
185873
|
const entrypoint = mapToEntrypoint.get(src) || src;
|
185799
185874
|
if (config3.zeroConfig && config3.outputDirectory) {
|
185800
185875
|
const outputMatch = config3.outputDirectory + "/";
|
@@ -186216,9 +186291,9 @@ function proxyPass(req, res, dest, devServer, requestId, ignorePath = true) {
|
|
186216
186291
|
}
|
186217
186292
|
);
|
186218
186293
|
}
|
186219
|
-
function serveStaticFile(req, res,
|
186294
|
+
function serveStaticFile(req, res, cwd2, opts) {
|
186220
186295
|
return (0, import_serve_handler.default)(req, res, {
|
186221
|
-
public:
|
186296
|
+
public: cwd2,
|
186222
186297
|
cleanUrls: false,
|
186223
186298
|
etag: true,
|
186224
186299
|
...opts
|
@@ -186475,7 +186550,7 @@ var init_server = __esm({
|
|
186475
186550
|
import_frameworks5.default.map((f) => f.useRuntime?.use || "@vercel/static-build")
|
186476
186551
|
);
|
186477
186552
|
DevServer = class {
|
186478
|
-
constructor(
|
186553
|
+
constructor(cwd2, options) {
|
186479
186554
|
this.clearVercelConfigPromise = () => {
|
186480
186555
|
this.getVercelConfigPromise = null;
|
186481
186556
|
};
|
@@ -187120,8 +187195,8 @@ Please ensure that ${cmd(err.path)} is properly installed`;
|
|
187120
187195
|
await this.sendError(req, res, requestId, "UNKNOWN_ASSET_TYPE");
|
187121
187196
|
}
|
187122
187197
|
};
|
187123
|
-
this.cwd =
|
187124
|
-
this.repoRoot = options.repoRoot ??
|
187198
|
+
this.cwd = cwd2;
|
187199
|
+
this.repoRoot = options.repoRoot ?? cwd2;
|
187125
187200
|
this.output = options.output;
|
187126
187201
|
this.envConfigs = { buildEnv: {}, runEnv: {}, allEnv: {} };
|
187127
187202
|
this.envValues = options.envValues || {};
|
@@ -187144,7 +187219,7 @@ Please ensure that ${cmd(err.path)} is properly installed`;
|
|
187144
187219
|
this.stopping = false;
|
187145
187220
|
this.buildMatches = /* @__PURE__ */ new Map();
|
187146
187221
|
this.inProgressBuilds = /* @__PURE__ */ new Map();
|
187147
|
-
this.devCacheDir = (0, import_path36.join)(getVercelDirectory(
|
187222
|
+
this.devCacheDir = (0, import_path36.join)(getVercelDirectory(cwd2), "cache");
|
187148
187223
|
this.vercelConfigWarning = false;
|
187149
187224
|
this.getVercelConfigPromise = null;
|
187150
187225
|
this.blockingBuildsPromise = null;
|
@@ -188061,7 +188136,7 @@ ${error_code}
|
|
188061
188136
|
return this.caseSensitive;
|
188062
188137
|
}
|
188063
188138
|
async runDevCommand() {
|
188064
|
-
const { devCommand: devCommand2, cwd } = this;
|
188139
|
+
const { devCommand: devCommand2, cwd: cwd2 } = this;
|
188065
188140
|
if (devCommand2 === this.currentDevCommand) {
|
188066
188141
|
return;
|
188067
188142
|
}
|
@@ -188092,13 +188167,13 @@ ${error_code}
|
|
188092
188167
|
PORT: `${port}`
|
188093
188168
|
}
|
188094
188169
|
);
|
188095
|
-
const nodeBinPaths = (0, import_build_utils17.getNodeBinPaths)({ base: this.repoRoot, start:
|
188170
|
+
const nodeBinPaths = (0, import_build_utils17.getNodeBinPaths)({ base: this.repoRoot, start: cwd2 });
|
188096
188171
|
const nodeBinPath = nodeBinPaths.join(import_path36.default.delimiter);
|
188097
188172
|
env.PATH = `${nodeBinPath}${import_path36.default.delimiter}${env.PATH}`;
|
188098
188173
|
let command = devCommand2.replace(/\$PORT/g, `${port}`).replace(/%PORT%/g, `${port}`);
|
188099
188174
|
this.output.debug(
|
188100
188175
|
`Starting dev command with parameters: ${JSON.stringify({
|
188101
|
-
cwd,
|
188176
|
+
cwd: cwd2,
|
188102
188177
|
command,
|
188103
188178
|
port
|
188104
188179
|
})}`
|
@@ -188107,7 +188182,7 @@ ${error_code}
|
|
188107
188182
|
const proxyPort = new RegExp(port.toString(), "g");
|
188108
188183
|
const p = (0, import_build_utils17.spawnCommand)(command, {
|
188109
188184
|
stdio: ["inherit", "pipe", "pipe"],
|
188110
|
-
cwd,
|
188185
|
+
cwd: cwd2,
|
188111
188186
|
env
|
188112
188187
|
});
|
188113
188188
|
this.devProcess = p;
|
@@ -188137,11 +188212,11 @@ ${error_code}
|
|
188137
188212
|
async function dev(client2, opts, args2) {
|
188138
188213
|
const { output: output2 } = client2;
|
188139
188214
|
const [dir = "."] = args2;
|
188140
|
-
let
|
188215
|
+
let cwd2 = (0, import_path37.resolve)(dir);
|
188141
188216
|
const listen4 = parseListen(opts["--listen"] || "3000");
|
188142
|
-
let link4 = await getLinkedProject(client2,
|
188217
|
+
let link4 = await getLinkedProject(client2, cwd2);
|
188143
188218
|
if (link4.status === "not_linked" && !process.env.__VERCEL_SKIP_DEV_CMD) {
|
188144
|
-
link4 = await setupAndLink(client2,
|
188219
|
+
link4 = await setupAndLink(client2, cwd2, {
|
188145
188220
|
autoConfirm: opts["--yes"],
|
188146
188221
|
link: link4,
|
188147
188222
|
successEmoji: "link",
|
@@ -188167,16 +188242,16 @@ async function dev(client2, opts, args2) {
|
|
188167
188242
|
if (link4.status === "linked") {
|
188168
188243
|
const { project, org } = link4;
|
188169
188244
|
if (link4.repoRoot) {
|
188170
|
-
repoRoot =
|
188245
|
+
repoRoot = cwd2 = link4.repoRoot;
|
188171
188246
|
}
|
188172
188247
|
client2.config.currentTeam = org.type === "team" ? org.id : void 0;
|
188173
188248
|
projectSettings = project;
|
188174
188249
|
if (project.rootDirectory) {
|
188175
|
-
|
188250
|
+
cwd2 = (0, import_path37.join)(cwd2, project.rootDirectory);
|
188176
188251
|
}
|
188177
188252
|
envValues = (await pullEnvRecords(output2, client2, project.id, "vercel-cli:dev")).env;
|
188178
188253
|
}
|
188179
|
-
const devServer = new DevServer(
|
188254
|
+
const devServer = new DevServer(cwd2, {
|
188180
188255
|
output: output2,
|
188181
188256
|
projectSettings,
|
188182
188257
|
envValues,
|
@@ -188184,7 +188259,7 @@ async function dev(client2, opts, args2) {
|
|
188184
188259
|
});
|
188185
188260
|
process.on("SIGTERM", () => devServer.stop());
|
188186
188261
|
if (!devServer.devCommand) {
|
188187
|
-
const outputDir = (0, import_path37.join)(
|
188262
|
+
const outputDir = (0, import_path37.join)(cwd2, OUTPUT_DIR);
|
188188
188263
|
if (await import_fs_extra22.default.pathExists(outputDir)) {
|
188189
188264
|
output2.log(`Removing ${OUTPUT_DIR}`);
|
188190
188265
|
await import_fs_extra22.default.remove(outputDir);
|
@@ -191973,7 +192048,7 @@ async function main6(client2) {
|
|
191973
192048
|
}
|
191974
192049
|
const subArgs = argv2._.slice(1);
|
191975
192050
|
const { subcommand: subcommand2, args: args2 } = getSubcommand(subArgs, COMMAND_CONFIG6);
|
191976
|
-
const { cwd, output: output2, config: config3 } = client2;
|
192051
|
+
const { cwd: cwd2, output: output2, config: config3 } = client2;
|
191977
192052
|
const target = argv2["--environment"]?.toLowerCase() || "development";
|
191978
192053
|
if (!isValidEnvTarget(target)) {
|
191979
192054
|
output2.error(
|
@@ -191983,7 +192058,7 @@ async function main6(client2) {
|
|
191983
192058
|
);
|
191984
192059
|
return 1;
|
191985
192060
|
}
|
191986
|
-
const link4 = await getLinkedProject(client2,
|
192061
|
+
const link4 = await getLinkedProject(client2, cwd2);
|
191987
192062
|
if (link4.status === "error") {
|
191988
192063
|
return link4.exitCode;
|
191989
192064
|
} else if (link4.status === "not_linked") {
|
@@ -192012,7 +192087,7 @@ async function main6(client2) {
|
|
192012
192087
|
argv2,
|
192013
192088
|
args2,
|
192014
192089
|
output2,
|
192015
|
-
|
192090
|
+
cwd2,
|
192016
192091
|
"vercel-cli:env:pull"
|
192017
192092
|
);
|
192018
192093
|
default:
|
@@ -192053,7 +192128,7 @@ var init_env = __esm({
|
|
192053
192128
|
|
192054
192129
|
// src/commands/git/connect.ts
|
192055
192130
|
async function connect(client2, argv2, args2, project, org) {
|
192056
|
-
const { cwd, output: output2 } = client2;
|
192131
|
+
const { cwd: cwd2, output: output2 } = client2;
|
192057
192132
|
const confirm2 = Boolean(argv2["--yes"]);
|
192058
192133
|
const repoArg = argv2._[1];
|
192059
192134
|
if (args2.length > 1) {
|
@@ -192074,7 +192149,7 @@ async function connect(client2, argv2, args2, project, org) {
|
|
192074
192149
|
}
|
192075
192150
|
const gitProviderLink = project.link;
|
192076
192151
|
client2.config.currentTeam = org.type === "team" ? org.id : void 0;
|
192077
|
-
const gitConfigPath = (0, import_path41.join)(
|
192152
|
+
const gitConfigPath = (0, import_path41.join)(cwd2, ".git/config");
|
192078
192153
|
const gitConfig = await parseGitConfig(gitConfigPath, output2);
|
192079
192154
|
if (repoArg) {
|
192080
192155
|
const parsedUrlArg = parseRepoUrl(repoArg);
|
@@ -192529,8 +192604,8 @@ async function main7(client2) {
|
|
192529
192604
|
subcommand2 = argv2._[0];
|
192530
192605
|
const args2 = argv2._.slice(1);
|
192531
192606
|
const autoConfirm = Boolean(argv2["--yes"]);
|
192532
|
-
const { cwd, output: output2 } = client2;
|
192533
|
-
const linkedProject = await ensureLink("git", client2,
|
192607
|
+
const { cwd: cwd2, output: output2 } = client2;
|
192608
|
+
const linkedProject = await ensureLink("git", client2, cwd2, { autoConfirm });
|
192534
192609
|
if (typeof linkedProject === "number") {
|
192535
192610
|
return linkedProject;
|
192536
192611
|
}
|
@@ -192784,8 +192859,8 @@ ${deployHint}`);
|
|
192784
192859
|
throw e2;
|
192785
192860
|
});
|
192786
192861
|
}
|
192787
|
-
function prepareFolder(
|
192788
|
-
const dest = import_path42.default.join(
|
192862
|
+
function prepareFolder(cwd2, folder, force) {
|
192863
|
+
const dest = import_path42.default.join(cwd2, folder);
|
192789
192864
|
if (import_fs8.default.existsSync(dest)) {
|
192790
192865
|
if (!import_fs8.default.lstatSync(dest).isDirectory()) {
|
192791
192866
|
throw new Error(
|
@@ -192803,7 +192878,7 @@ function prepareFolder(cwd, folder, force) {
|
|
192803
192878
|
)} or ${cmd("-f")} to override it.`
|
192804
192879
|
);
|
192805
192880
|
}
|
192806
|
-
} else if (dest !==
|
192881
|
+
} else if (dest !== cwd2) {
|
192807
192882
|
try {
|
192808
192883
|
import_fs8.default.mkdirSync(dest);
|
192809
192884
|
} catch (e2) {
|
@@ -193591,23 +193666,23 @@ async function link3(client2) {
|
|
193591
193666
|
argv2["--yes"] = argv2["--confirm"];
|
193592
193667
|
}
|
193593
193668
|
const yes = !!argv2["--yes"];
|
193594
|
-
let
|
193595
|
-
if (
|
193669
|
+
let cwd2 = argv2._[1];
|
193670
|
+
if (cwd2) {
|
193596
193671
|
client2.output.warn(
|
193597
193672
|
`The ${cmd("vc link <directory>")} syntax is deprecated, please use ${cmd(
|
193598
|
-
`vc link --cwd ${
|
193673
|
+
`vc link --cwd ${cwd2}`
|
193599
193674
|
)} instead`
|
193600
193675
|
);
|
193601
193676
|
} else {
|
193602
|
-
|
193677
|
+
cwd2 = client2.cwd;
|
193603
193678
|
}
|
193604
193679
|
if (argv2["--repo"]) {
|
193605
193680
|
client2.output.warn(
|
193606
193681
|
`The ${cmd("--repo")} flag is in alpha, please report issues`
|
193607
193682
|
);
|
193608
|
-
await ensureRepoLink(client2,
|
193683
|
+
await ensureRepoLink(client2, cwd2, { yes, overwrite: true });
|
193609
193684
|
} else {
|
193610
|
-
const link4 = await ensureLink("link", client2,
|
193685
|
+
const link4 = await ensureLink("link", client2, cwd2, {
|
193611
193686
|
autoConfirm: yes,
|
193612
193687
|
forceDelete: true,
|
193613
193688
|
projectName: argv2["--project"],
|
@@ -193725,7 +193800,7 @@ async function list2(client2) {
|
|
193725
193800
|
handleError(err);
|
193726
193801
|
return 1;
|
193727
193802
|
}
|
193728
|
-
const { cwd, output: output2, config: config3 } = client2;
|
193803
|
+
const { cwd: cwd2, output: output2, config: config3 } = client2;
|
193729
193804
|
if ("--confirm" in argv2) {
|
193730
193805
|
output2.warn("`--confirm` is deprecated, please use `--yes` instead");
|
193731
193806
|
argv2["--yes"] = argv2["--confirm"];
|
@@ -193742,7 +193817,7 @@ async function list2(client2) {
|
|
193742
193817
|
const autoConfirm = !!argv2["--yes"];
|
193743
193818
|
const meta = parseMeta(argv2["--meta"]);
|
193744
193819
|
const target = argv2["--prod"] ? "production" : typeof argv2["--environment"] === "string" ? argv2["--environment"].toLowerCase() : void 0;
|
193745
|
-
let link4 = await getLinkedProject(client2,
|
193820
|
+
let link4 = await getLinkedProject(client2, cwd2);
|
193746
193821
|
if (link4.status === "error") {
|
193747
193822
|
return link4.exitCode;
|
193748
193823
|
}
|
@@ -193755,7 +193830,7 @@ async function list2(client2) {
|
|
193755
193830
|
return 1;
|
193756
193831
|
}
|
193757
193832
|
if (status === "not_linked" && !app) {
|
193758
|
-
const linkedProject = await ensureLink("list", client2,
|
193833
|
+
const linkedProject = await ensureLink("list", client2, cwd2, {
|
193759
193834
|
autoConfirm,
|
193760
193835
|
link: link4
|
193761
193836
|
});
|
@@ -195184,7 +195259,7 @@ async function getProjectByCwdOrLink({
|
|
195184
195259
|
autoConfirm,
|
195185
195260
|
client: client2,
|
195186
195261
|
commandName,
|
195187
|
-
cwd,
|
195262
|
+
cwd: cwd2,
|
195188
195263
|
projectNameOrId
|
195189
195264
|
}) {
|
195190
195265
|
if (projectNameOrId) {
|
@@ -195194,7 +195269,7 @@ async function getProjectByCwdOrLink({
|
|
195194
195269
|
}
|
195195
195270
|
return project;
|
195196
195271
|
}
|
195197
|
-
const linkedProject = await ensureLink(commandName, client2,
|
195272
|
+
const linkedProject = await ensureLink(commandName, client2, cwd2, {
|
195198
195273
|
autoConfirm
|
195199
195274
|
});
|
195200
195275
|
if (typeof linkedProject === "number") {
|
@@ -198533,16 +198608,16 @@ function createProxy(client2) {
|
|
198533
198608
|
}
|
198534
198609
|
|
198535
198610
|
// src/util/extension/exec.ts
|
198536
|
-
async function execExtension(client2, name, args2,
|
198611
|
+
async function execExtension(client2, name, args2, cwd2) {
|
198537
198612
|
const { debug: debug3, log: log2 } = client2.output;
|
198538
198613
|
const extensionCommand = `vercel-${name}`;
|
198539
|
-
const { packageJsonPath, lockfilePath } = await (0, import_build_utils4.scanParentDirs)(
|
198614
|
+
const { packageJsonPath, lockfilePath } = await (0, import_build_utils4.scanParentDirs)(cwd2);
|
198540
198615
|
const baseFile = lockfilePath || packageJsonPath;
|
198541
198616
|
let extensionPath = null;
|
198542
198617
|
if (baseFile) {
|
198543
198618
|
extensionPath = await (0, import_build_utils4.walkParentDirs)({
|
198544
198619
|
base: (0, import_path8.dirname)(baseFile),
|
198545
|
-
start:
|
198620
|
+
start: cwd2,
|
198546
198621
|
filename: `node_modules/.bin/${extensionCommand}`
|
198547
198622
|
});
|
198548
198623
|
}
|
@@ -198562,7 +198637,7 @@ async function execExtension(client2, name, args2, cwd) {
|
|
198562
198637
|
const VERCEL_API = proxyUrl.href.replace(/\/$/, "");
|
198563
198638
|
debug3(`extension proxy server listening at ${VERCEL_API}`);
|
198564
198639
|
const result = await (0, import_execa.default)(extensionPath, args2, {
|
198565
|
-
cwd,
|
198640
|
+
cwd: cwd2,
|
198566
198641
|
reject: false,
|
198567
198642
|
stdio: "inherit",
|
198568
198643
|
env: {
|
@@ -198862,10 +198937,10 @@ var main13 = async () => {
|
|
198862
198937
|
if (argv2["--cwd"]) {
|
198863
198938
|
client.cwd = argv2["--cwd"];
|
198864
198939
|
}
|
198865
|
-
const { cwd } = client;
|
198940
|
+
const { cwd: cwd2 } = client;
|
198866
198941
|
let subcommand2 = void 0;
|
198867
198942
|
if (targetOrSubcommand) {
|
198868
|
-
const targetPath = (0, import_path43.join)(
|
198943
|
+
const targetPath = (0, import_path43.join)(cwd2, targetOrSubcommand);
|
198869
198944
|
const targetPathExists = (0, import_fs9.existsSync)(targetPath);
|
198870
198945
|
const subcommandExists = GLOBAL_COMMANDS.has(targetOrSubcommand) || commands_default.has(targetOrSubcommand);
|
198871
198946
|
if (targetPathExists && subcommandExists && !argv2["--cwd"] && !process.env.NOW_BUILDER) {
|
@@ -199019,7 +199094,7 @@ var main13 = async () => {
|
|
199019
199094
|
client,
|
199020
199095
|
targetCommand,
|
199021
199096
|
argv2._.slice(3),
|
199022
|
-
|
199097
|
+
cwd2
|
199023
199098
|
);
|
199024
199099
|
} catch (err) {
|
199025
199100
|
if ((0, import_error_utils33.isErrnoException)(err) && err.code === "ENOENT") {
|