vercel 33.0.2 → 33.2.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/index.js +272 -222
- package/package.json +9 -9
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.0.14",
|
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.
|
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",
|
@@ -63600,7 +63600,7 @@ var require_utils8 = __commonJS2({
|
|
63600
63600
|
}
|
63601
63601
|
return { fileList, ignoreList };
|
63602
63602
|
}
|
63603
|
-
async function getVercelIgnore4(
|
63603
|
+
async function getVercelIgnore4(cwd2, prebuilt) {
|
63604
63604
|
const ig = (0, import_ignore.default)();
|
63605
63605
|
let ignores;
|
63606
63606
|
if (prebuilt) {
|
@@ -63640,12 +63640,12 @@ var require_utils8 = __commonJS2({
|
|
63640
63640
|
"venv",
|
63641
63641
|
"CVS"
|
63642
63642
|
];
|
63643
|
-
const cwds = Array.isArray(
|
63643
|
+
const cwds = Array.isArray(cwd2) ? cwd2 : [cwd2];
|
63644
63644
|
const files = await Promise.all(
|
63645
|
-
cwds.map(async (
|
63645
|
+
cwds.map(async (cwd22) => {
|
63646
63646
|
const [vercelignore, nowignore] = await Promise.all([
|
63647
|
-
maybeRead((0, import_path44.join)(
|
63648
|
-
maybeRead((0, import_path44.join)(
|
63647
|
+
maybeRead((0, import_path44.join)(cwd22, ".vercelignore"), ""),
|
63648
|
+
maybeRead((0, import_path44.join)(cwd22, ".nowignore"), "")
|
63649
63649
|
]);
|
63650
63650
|
if (vercelignore && nowignore) {
|
63651
63651
|
throw new import_build_utils19.NowBuildError({
|
@@ -68228,13 +68228,13 @@ var require_tar_fs = __commonJS2({
|
|
68228
68228
|
var normalize4 = !win32 ? echo : function(name) {
|
68229
68229
|
return name.replace(/\\/g, "/").replace(/[:?<>|]/g, "_");
|
68230
68230
|
};
|
68231
|
-
var statAll = function(fs16, stat2,
|
68231
|
+
var statAll = function(fs16, stat2, cwd2, ignore, entries, sort) {
|
68232
68232
|
var queue = entries || ["."];
|
68233
68233
|
return function loop(callback) {
|
68234
68234
|
if (!queue.length)
|
68235
68235
|
return callback();
|
68236
68236
|
var next = queue.shift();
|
68237
|
-
var nextAbs = path11.join(
|
68237
|
+
var nextAbs = path11.join(cwd2, next);
|
68238
68238
|
stat2(nextAbs, function(err, stat3) {
|
68239
68239
|
if (err)
|
68240
68240
|
return callback(err);
|
@@ -68246,7 +68246,7 @@ var require_tar_fs = __commonJS2({
|
|
68246
68246
|
if (sort)
|
68247
68247
|
files.sort();
|
68248
68248
|
for (var i = 0; i < files.length; i++) {
|
68249
|
-
if (!ignore(path11.join(
|
68249
|
+
if (!ignore(path11.join(cwd2, next, files[i])))
|
68250
68250
|
queue.push(path11.join(next, files[i]));
|
68251
68251
|
}
|
68252
68252
|
callback(null, next, stat3);
|
@@ -68264,16 +68264,16 @@ var require_tar_fs = __commonJS2({
|
|
68264
68264
|
return map(header);
|
68265
68265
|
};
|
68266
68266
|
};
|
68267
|
-
exports2.pack = function(
|
68268
|
-
if (!
|
68269
|
-
|
68267
|
+
exports2.pack = function(cwd2, opts) {
|
68268
|
+
if (!cwd2)
|
68269
|
+
cwd2 = ".";
|
68270
68270
|
if (!opts)
|
68271
68271
|
opts = {};
|
68272
68272
|
var xfs = opts.fs || fs15;
|
68273
68273
|
var ignore = opts.ignore || opts.filter || noop;
|
68274
68274
|
var map = opts.map || noop;
|
68275
68275
|
var mapStream = opts.mapStream || echo;
|
68276
|
-
var statNext = statAll(xfs, opts.dereference ? xfs.stat : xfs.lstat,
|
68276
|
+
var statNext = statAll(xfs, opts.dereference ? xfs.stat : xfs.lstat, cwd2, ignore, opts.entries, opts.sort);
|
68277
68277
|
var strict = opts.strict !== false;
|
68278
68278
|
var umask = typeof opts.umask === "number" ? ~opts.umask : ~processUmask();
|
68279
68279
|
var dmode = typeof opts.dmode === "number" ? opts.dmode : 0;
|
@@ -68291,7 +68291,7 @@ var require_tar_fs = __commonJS2({
|
|
68291
68291
|
fmode |= parseInt(222, 8);
|
68292
68292
|
}
|
68293
68293
|
var onsymlink = function(filename, header) {
|
68294
|
-
xfs.readlink(path11.join(
|
68294
|
+
xfs.readlink(path11.join(cwd2, filename), function(err, linkname) {
|
68295
68295
|
if (err)
|
68296
68296
|
return pack.destroy(err);
|
68297
68297
|
header.linkname = normalize4(linkname);
|
@@ -68338,7 +68338,7 @@ var require_tar_fs = __commonJS2({
|
|
68338
68338
|
var entry = pack.entry(header, onnextentry);
|
68339
68339
|
if (!entry)
|
68340
68340
|
return;
|
68341
|
-
var rs = mapStream(xfs.createReadStream(path11.join(
|
68341
|
+
var rs = mapStream(xfs.createReadStream(path11.join(cwd2, filename)), header);
|
68342
68342
|
rs.on("error", function(err2) {
|
68343
68343
|
entry.destroy(err2);
|
68344
68344
|
});
|
@@ -68361,9 +68361,9 @@ var require_tar_fs = __commonJS2({
|
|
68361
68361
|
var processUmask = function() {
|
68362
68362
|
return process.umask ? process.umask() : 0;
|
68363
68363
|
};
|
68364
|
-
exports2.extract = function(
|
68365
|
-
if (!
|
68366
|
-
|
68364
|
+
exports2.extract = function(cwd2, opts) {
|
68365
|
+
if (!cwd2)
|
68366
|
+
cwd2 = ".";
|
68367
68367
|
if (!opts)
|
68368
68368
|
opts = {};
|
68369
68369
|
var xfs = opts.fs || fs15;
|
@@ -68429,7 +68429,7 @@ var require_tar_fs = __commonJS2({
|
|
68429
68429
|
extract.on("entry", function(header, stream, next) {
|
68430
68430
|
header = map(header) || header;
|
68431
68431
|
header.name = normalize4(header.name);
|
68432
|
-
var name = path11.join(
|
68432
|
+
var name = path11.join(cwd2, path11.join("/", header.name));
|
68433
68433
|
if (ignore(name, header)) {
|
68434
68434
|
stream.resume();
|
68435
68435
|
return next();
|
@@ -68456,7 +68456,7 @@ var require_tar_fs = __commonJS2({
|
|
68456
68456
|
if (win32)
|
68457
68457
|
return next();
|
68458
68458
|
xfs.unlink(name, function() {
|
68459
|
-
var srcpath = path11.join(
|
68459
|
+
var srcpath = path11.join(cwd2, path11.join("/", header.linkname));
|
68460
68460
|
xfs.link(srcpath, name, function(err) {
|
68461
68461
|
if (err && err.code === "EPERM" && opts.hardlinkAsFilesFallback) {
|
68462
68462
|
stream = xfs.createReadStream(srcpath);
|
@@ -68488,7 +68488,7 @@ var require_tar_fs = __commonJS2({
|
|
68488
68488
|
}, stat2);
|
68489
68489
|
}
|
68490
68490
|
var dir = path11.dirname(name);
|
68491
|
-
validate2(xfs, dir, path11.join(
|
68491
|
+
validate2(xfs, dir, path11.join(cwd2, "."), function(err, valid) {
|
68492
68492
|
if (err)
|
68493
68493
|
return next(err);
|
68494
68494
|
if (!valid)
|
@@ -129966,7 +129966,7 @@ var require_resolveCommand = __commonJS2({
|
|
129966
129966
|
var getPathKey = require_path_key();
|
129967
129967
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
129968
129968
|
const env = parsed.options.env || process.env;
|
129969
|
-
const
|
129969
|
+
const cwd2 = process.cwd();
|
129970
129970
|
const hasCustomCwd = parsed.options.cwd != null;
|
129971
129971
|
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
129972
129972
|
if (shouldSwitchCwd) {
|
@@ -129984,7 +129984,7 @@ var require_resolveCommand = __commonJS2({
|
|
129984
129984
|
} catch (e2) {
|
129985
129985
|
} finally {
|
129986
129986
|
if (shouldSwitchCwd) {
|
129987
|
-
process.chdir(
|
129987
|
+
process.chdir(cwd2);
|
129988
129988
|
}
|
129989
129989
|
}
|
129990
129990
|
if (resolved) {
|
@@ -148137,10 +148137,10 @@ var require_detect_framework = __commonJS2({
|
|
148137
148137
|
firstMatchPackage.matchPackage
|
148138
148138
|
);
|
148139
148139
|
}
|
148140
|
-
function lookupInstalledVersion(
|
148140
|
+
function lookupInstalledVersion(cwd2, packageName2) {
|
148141
148141
|
try {
|
148142
148142
|
const script = `require('${packageName2}/package.json').version`;
|
148143
|
-
return (0, import_child_process4.spawnSync)(
|
148143
|
+
return (0, import_child_process4.spawnSync)(cwd2, ["-p", script], {
|
148144
148144
|
encoding: "utf-8"
|
148145
148145
|
}).stdout.trim();
|
148146
148146
|
} catch (error4) {
|
@@ -148579,7 +148579,7 @@ var require_get_workspaces = __commonJS2({
|
|
148579
148579
|
async function getWorkspaces3({
|
148580
148580
|
fs: fs15,
|
148581
148581
|
depth = MAX_DEPTH_TRAVERSE,
|
148582
|
-
cwd = "/"
|
148582
|
+
cwd: cwd2 = "/"
|
148583
148583
|
}) {
|
148584
148584
|
if (depth === 0)
|
148585
148585
|
return [];
|
@@ -148597,7 +148597,7 @@ var require_get_workspaces = __commonJS2({
|
|
148597
148597
|
(childDirectory) => getWorkspaces3({
|
148598
148598
|
fs: fs15.chdir(childDirectory.path),
|
148599
148599
|
depth: depth - 1,
|
148600
|
-
cwd: posixPath.join(
|
148600
|
+
cwd: posixPath.join(cwd2, childDirectory.path)
|
148601
148601
|
})
|
148602
148602
|
)
|
148603
148603
|
)).flat();
|
@@ -148605,7 +148605,7 @@ var require_get_workspaces = __commonJS2({
|
|
148605
148605
|
return [
|
148606
148606
|
{
|
148607
148607
|
type: workspaceType,
|
148608
|
-
rootPath:
|
148608
|
+
rootPath: cwd2
|
148609
148609
|
}
|
148610
148610
|
];
|
148611
148611
|
}
|
@@ -152381,12 +152381,12 @@ var require_common4 = __commonJS2({
|
|
152381
152381
|
self2.symlinks = options.symlinks || /* @__PURE__ */ Object.create(null);
|
152382
152382
|
setupIgnores(self2, options);
|
152383
152383
|
self2.changedCwd = false;
|
152384
|
-
var
|
152384
|
+
var cwd2 = process.cwd();
|
152385
152385
|
if (!ownProp(options, "cwd"))
|
152386
|
-
self2.cwd = path11.resolve(
|
152386
|
+
self2.cwd = path11.resolve(cwd2);
|
152387
152387
|
else {
|
152388
152388
|
self2.cwd = path11.resolve(options.cwd);
|
152389
|
-
self2.changedCwd = self2.cwd !==
|
152389
|
+
self2.changedCwd = self2.cwd !== cwd2;
|
152390
152390
|
}
|
152391
152391
|
self2.root = options.root || path11.resolve(self2.cwd, "/");
|
152392
152392
|
self2.root = path11.resolve(self2.root);
|
@@ -163679,8 +163679,8 @@ var init_create_project = __esm({
|
|
163679
163679
|
});
|
163680
163680
|
|
163681
163681
|
// src/util/projects/detect-projects.ts
|
163682
|
-
async function detectProjects(
|
163683
|
-
const fs15 = new import_fs_detectors.LocalFileSystemDetector(
|
163682
|
+
async function detectProjects(cwd2) {
|
163683
|
+
const fs15 = new import_fs_detectors.LocalFileSystemDetector(cwd2);
|
163684
163684
|
const workspaces = await (0, import_fs_detectors.getWorkspaces)({ fs: fs15 });
|
163685
163685
|
const detectedProjects = /* @__PURE__ */ new Map();
|
163686
163686
|
const packagePaths = (await Promise.all(
|
@@ -163833,8 +163833,8 @@ var init_connect_git_provider = __esm({
|
|
163833
163833
|
});
|
163834
163834
|
|
163835
163835
|
// src/util/link/repo.ts
|
163836
|
-
async function getRepoLink(client2,
|
163837
|
-
const rootPath = await findRepoRoot(client2,
|
163836
|
+
async function getRepoLink(client2, cwd2) {
|
163837
|
+
const rootPath = await findRepoRoot(client2, cwd2);
|
163838
163838
|
if (!rootPath)
|
163839
163839
|
return void 0;
|
163840
163840
|
const repoConfigPath = (0, import_path14.join)(rootPath, VERCEL_DIR2, VERCEL_DIR_REPO);
|
@@ -163846,9 +163846,9 @@ async function getRepoLink(client2, cwd) {
|
|
163846
163846
|
);
|
163847
163847
|
return { rootPath, repoConfig, repoConfigPath };
|
163848
163848
|
}
|
163849
|
-
async function ensureRepoLink(client2,
|
163849
|
+
async function ensureRepoLink(client2, cwd2, { yes, overwrite }) {
|
163850
163850
|
const { output: output2 } = client2;
|
163851
|
-
const repoLink = await getRepoLink(client2,
|
163851
|
+
const repoLink = await getRepoLink(client2, cwd2);
|
163852
163852
|
if (repoLink) {
|
163853
163853
|
output2.debug(`Found Git repository root directory: ${repoLink.rootPath}`);
|
163854
163854
|
} else {
|
@@ -164153,8 +164153,8 @@ var init_repo = __esm({
|
|
164153
164153
|
});
|
164154
164154
|
|
164155
164155
|
// src/util/projects/link.ts
|
164156
|
-
function getVercelDirectory(
|
164157
|
-
const possibleDirs = [(0, import_path15.join)(
|
164156
|
+
function getVercelDirectory(cwd2) {
|
164157
|
+
const possibleDirs = [(0, import_path15.join)(cwd2, VERCEL_DIR2), (0, import_path15.join)(cwd2, VERCEL_DIR_FALLBACK)];
|
164158
164158
|
const existingDirs = possibleDirs.filter((d) => isDirectory(d));
|
164159
164159
|
if (existingDirs.length > 1) {
|
164160
164160
|
throw new import_build_utils6.NowBuildError({
|
@@ -164397,7 +164397,7 @@ var init_link2 = __esm({
|
|
164397
164397
|
});
|
164398
164398
|
|
164399
164399
|
// src/util/projects/project-settings.ts
|
164400
|
-
async function writeProjectSettings(
|
164400
|
+
async function writeProjectSettings(cwd2, project, org, isRepoLinked) {
|
164401
164401
|
let analyticsId;
|
164402
164402
|
if (project.analytics?.id && (!project.analytics.disabledAt || project.analytics.enabledAt && project.analytics.enabledAt > project.analytics.disabledAt)) {
|
164403
164403
|
analyticsId = project.analytics.id;
|
@@ -164418,7 +164418,7 @@ async function writeProjectSettings(cwd, project, org, isRepoLinked) {
|
|
164418
164418
|
analyticsId
|
164419
164419
|
}
|
164420
164420
|
};
|
164421
|
-
const path11 = (0, import_path16.join)(
|
164421
|
+
const path11 = (0, import_path16.join)(cwd2, VERCEL_DIR2, VERCEL_DIR_PROJECT);
|
164422
164422
|
return await (0, import_fs_extra8.outputJSON)(path11, projectLinkAndSettings, {
|
164423
164423
|
spaces: 2
|
164424
164424
|
});
|
@@ -164628,7 +164628,7 @@ function tryReadHeadSync(path11, length) {
|
|
164628
164628
|
}
|
164629
164629
|
}
|
164630
164630
|
}
|
164631
|
-
async function pull(client2, link4, project, environment, opts, args2, output2,
|
164631
|
+
async function pull(client2, link4, project, environment, opts, args2, output2, cwd2, source) {
|
164632
164632
|
if (args2.length > 1) {
|
164633
164633
|
output2.error(
|
164634
164634
|
`Invalid number of arguments. Usage: ${getCommandName(`env pull <file>`)}`
|
@@ -164636,7 +164636,7 @@ async function pull(client2, link4, project, environment, opts, args2, output2,
|
|
164636
164636
|
return 1;
|
164637
164637
|
}
|
164638
164638
|
const [filename = ".env.local"] = args2;
|
164639
|
-
const fullPath = (0, import_path17.resolve)(
|
164639
|
+
const fullPath = (0, import_path17.resolve)(cwd2, filename);
|
164640
164640
|
const skipConfirmation = opts["--yes"];
|
164641
164641
|
const gitBranch = opts["--git-branch"];
|
164642
164642
|
const head = tryReadHeadSync(fullPath, Buffer.byteLength(CONTENTS_PREFIX));
|
@@ -164680,7 +164680,7 @@ async function pull(client2, link4, project, environment, opts, args2, output2,
|
|
164680
164680
|
}
|
164681
164681
|
let isGitIgnoreUpdated = false;
|
164682
164682
|
if (filename === ".env.local") {
|
164683
|
-
const rootPath = link4.repoRoot ??
|
164683
|
+
const rootPath = link4.repoRoot ?? cwd2;
|
164684
164684
|
isGitIgnoreUpdated = await addToGitIgnore(rootPath, ".env*.local");
|
164685
164685
|
}
|
164686
164686
|
output2.print(
|
@@ -164852,7 +164852,7 @@ var init_input_project = __esm({
|
|
164852
164852
|
});
|
164853
164853
|
|
164854
164854
|
// src/util/validate-paths.ts
|
164855
|
-
async function validateRootDirectory(output2,
|
164855
|
+
async function validateRootDirectory(output2, cwd2, path11, errorSuffix) {
|
164856
164856
|
const pathStat = await (0, import_fs_extra11.lstat)(path11).catch(() => null);
|
164857
164857
|
const suffix = errorSuffix ? ` ${errorSuffix}` : "";
|
164858
164858
|
if (!pathStat) {
|
@@ -164871,7 +164871,7 @@ async function validateRootDirectory(output2, cwd, path11, errorSuffix) {
|
|
164871
164871
|
);
|
164872
164872
|
return false;
|
164873
164873
|
}
|
164874
|
-
if (!path11.startsWith(
|
164874
|
+
if (!path11.startsWith(cwd2)) {
|
164875
164875
|
output2.error(
|
164876
164876
|
`The provided path ${import_chalk38.default.cyan(
|
164877
164877
|
`\u201C${humanizePath(path11)}\u201D`
|
@@ -164927,7 +164927,7 @@ var init_validate_paths = __esm({
|
|
164927
164927
|
});
|
164928
164928
|
|
164929
164929
|
// src/util/input/input-root-directory.ts
|
164930
|
-
async function inputRootDirectory(client2,
|
164930
|
+
async function inputRootDirectory(client2, cwd2, autoConfirm = false) {
|
164931
164931
|
if (autoConfirm) {
|
164932
164932
|
return null;
|
164933
164933
|
}
|
@@ -164947,10 +164947,10 @@ async function inputRootDirectory(client2, cwd, autoConfirm = false) {
|
|
164947
164947
|
if (normal === "." || normal === "./") {
|
164948
164948
|
return null;
|
164949
164949
|
}
|
164950
|
-
const fullPath = import_path18.default.join(
|
164950
|
+
const fullPath = import_path18.default.join(cwd2, normal);
|
164951
164951
|
if (await validateRootDirectory(
|
164952
164952
|
client2.output,
|
164953
|
-
|
164953
|
+
cwd2,
|
164954
164954
|
fullPath,
|
164955
164955
|
"Please choose a different one."
|
164956
164956
|
) === false) {
|
@@ -165141,14 +165141,14 @@ var init_generate_cert_for_deploy = __esm({
|
|
165141
165141
|
});
|
165142
165142
|
|
165143
165143
|
// src/util/deploy/create-deploy.ts
|
165144
|
-
async function createDeploy(client2, now, contextName, path11, createArgs, org, isSettingUpProject,
|
165144
|
+
async function createDeploy(client2, now, contextName, path11, createArgs, org, isSettingUpProject, cwd2, archive) {
|
165145
165145
|
try {
|
165146
165146
|
return await now.create(
|
165147
165147
|
path11,
|
165148
165148
|
createArgs,
|
165149
165149
|
org,
|
165150
165150
|
isSettingUpProject,
|
165151
|
-
|
165151
|
+
cwd2,
|
165152
165152
|
archive
|
165153
165153
|
);
|
165154
165154
|
} catch (err) {
|
@@ -165214,7 +165214,7 @@ async function createDeploy(client2, now, contextName, path11, createArgs, org,
|
|
165214
165214
|
createArgs,
|
165215
165215
|
org,
|
165216
165216
|
isSettingUpProject,
|
165217
|
-
|
165217
|
+
cwd2
|
165218
165218
|
);
|
165219
165219
|
}
|
165220
165220
|
if (err.code === "not_found") {
|
@@ -165270,7 +165270,7 @@ function printInspectUrl(output2, inspectorUrl, deployStamp) {
|
|
165270
165270
|
}
|
165271
165271
|
async function processDeployment({
|
165272
165272
|
org,
|
165273
|
-
cwd,
|
165273
|
+
cwd: cwd2,
|
165274
165274
|
projectName,
|
165275
165275
|
isSettingUpProject,
|
165276
165276
|
archive,
|
@@ -165365,7 +165365,7 @@ async function processDeployment({
|
|
165365
165365
|
const deployment = event.payload;
|
165366
165366
|
await linkFolderToProject(
|
165367
165367
|
client2,
|
165368
|
-
|
165368
|
+
cwd2,
|
165369
165369
|
{
|
165370
165370
|
orgId: org.id,
|
165371
165371
|
projectId: deployment.projectId
|
@@ -165376,7 +165376,7 @@ async function processDeployment({
|
|
165376
165376
|
now.url = deployment.url;
|
165377
165377
|
output2.stopSpinner();
|
165378
165378
|
printInspectUrl(output2, deployment.inspectorUrl, deployStamp);
|
165379
|
-
const isProdDeployment =
|
165379
|
+
const isProdDeployment = deployment.target === "production";
|
165380
165380
|
const previewUrl = `https://${deployment.url}`;
|
165381
165381
|
output2.print(
|
165382
165382
|
prependEmoji(
|
@@ -165526,7 +165526,7 @@ var init_util = __esm({
|
|
165526
165526
|
skipAutoDetectionConfirmation,
|
165527
165527
|
noWait,
|
165528
165528
|
autoAssignCustomDomains
|
165529
|
-
}, org, isSettingUpProject,
|
165529
|
+
}, org, isSettingUpProject, cwd2, archive) {
|
165530
165530
|
let hashes = {};
|
165531
165531
|
const uploadStamp = stamp_default();
|
165532
165532
|
let requestBody = {
|
@@ -165561,7 +165561,7 @@ var init_util = __esm({
|
|
165561
165561
|
isSettingUpProject,
|
165562
165562
|
archive,
|
165563
165563
|
skipAutoDetectionConfirmation,
|
165564
|
-
cwd,
|
165564
|
+
cwd: cwd2,
|
165565
165565
|
prebuilt,
|
165566
165566
|
rootDirectory,
|
165567
165567
|
noWait
|
@@ -166093,14 +166093,14 @@ var init_setup_and_link = __esm({
|
|
166093
166093
|
});
|
166094
166094
|
|
166095
166095
|
// src/util/link/ensure-link.ts
|
166096
|
-
async function ensureLink(commandName, client2,
|
166096
|
+
async function ensureLink(commandName, client2, cwd2, opts = {}) {
|
166097
166097
|
let { link: link4 } = opts;
|
166098
166098
|
if (!link4) {
|
166099
|
-
link4 = await getLinkedProject(client2,
|
166099
|
+
link4 = await getLinkedProject(client2, cwd2);
|
166100
166100
|
opts.link = link4;
|
166101
166101
|
}
|
166102
166102
|
if (link4.status === "linked" && opts.forceDelete || link4.status === "not_linked") {
|
166103
|
-
link4 = await setupAndLink(client2,
|
166103
|
+
link4 = await setupAndLink(client2, cwd2, opts);
|
166104
166104
|
if (link4.status === "not_linked") {
|
166105
166105
|
return 0;
|
166106
166106
|
}
|
@@ -166221,7 +166221,7 @@ function parseArgs(client2) {
|
|
166221
166221
|
}
|
166222
166222
|
return argv2;
|
166223
166223
|
}
|
166224
|
-
async function pullAllEnvFiles(environment, client2, link4, project, argv2,
|
166224
|
+
async function pullAllEnvFiles(environment, client2, link4, project, argv2, cwd2) {
|
166225
166225
|
const environmentFile = `.env.${environment}.local`;
|
166226
166226
|
return pull(
|
166227
166227
|
client2,
|
@@ -166231,7 +166231,7 @@ async function pullAllEnvFiles(environment, client2, link4, project, argv2, cwd)
|
|
166231
166231
|
argv2,
|
166232
166232
|
[(0, import_path20.join)(".vercel", environmentFile)],
|
166233
166233
|
client2.output,
|
166234
|
-
|
166234
|
+
cwd2,
|
166235
166235
|
"vercel-cli:pull"
|
166236
166236
|
);
|
166237
166237
|
}
|
@@ -166248,16 +166248,16 @@ async function main(client2) {
|
|
166248
166248
|
if (typeof argv2 === "number") {
|
166249
166249
|
return argv2;
|
166250
166250
|
}
|
166251
|
-
let
|
166251
|
+
let cwd2 = argv2._[1] || client2.cwd;
|
166252
166252
|
const autoConfirm = Boolean(argv2["--yes"]);
|
166253
166253
|
const environment = parseEnvironment(argv2["--environment"] || void 0);
|
166254
|
-
const link4 = await ensureLink("pull", client2,
|
166254
|
+
const link4 = await ensureLink("pull", client2, cwd2, { autoConfirm });
|
166255
166255
|
if (typeof link4 === "number") {
|
166256
166256
|
return link4;
|
166257
166257
|
}
|
166258
166258
|
const { project, org, repoRoot } = link4;
|
166259
166259
|
if (repoRoot) {
|
166260
|
-
|
166260
|
+
cwd2 = (0, import_path20.join)(repoRoot, project.rootDirectory || "");
|
166261
166261
|
}
|
166262
166262
|
client2.config.currentTeam = org.type === "team" ? org.id : void 0;
|
166263
166263
|
const pullResultCode = await pullAllEnvFiles(
|
@@ -166266,7 +166266,7 @@ async function main(client2) {
|
|
166266
166266
|
link4,
|
166267
166267
|
project,
|
166268
166268
|
argv2,
|
166269
|
-
|
166269
|
+
cwd2
|
166270
166270
|
);
|
166271
166271
|
if (pullResultCode !== 0) {
|
166272
166272
|
return pullResultCode;
|
@@ -166274,12 +166274,12 @@ async function main(client2) {
|
|
166274
166274
|
client2.output.print("\n");
|
166275
166275
|
client2.output.log("Downloading project settings");
|
166276
166276
|
const isRepoLinked = typeof repoRoot === "string";
|
166277
|
-
await writeProjectSettings(
|
166277
|
+
await writeProjectSettings(cwd2, project, org, isRepoLinked);
|
166278
166278
|
const settingsStamp = stamp_default();
|
166279
166279
|
client2.output.print(
|
166280
166280
|
`${prependEmoji(
|
166281
166281
|
`Downloaded project settings to ${import_chalk44.default.bold(
|
166282
|
-
humanizePath((0, import_path20.join)(
|
166282
|
+
humanizePath((0, import_path20.join)(cwd2, VERCEL_DIR2, VERCEL_DIR_PROJECT))
|
166283
166283
|
)} ${import_chalk44.default.gray(settingsStamp())}`,
|
166284
166284
|
emoji("success")
|
166285
166285
|
)}
|
@@ -168549,12 +168549,18 @@ async function writeBuildResultV2(outputDir, buildResult, build2, vercelConfig)
|
|
168549
168549
|
`The build result from "${build2.use}" is missing the "output" property.${updateMessage}`
|
168550
168550
|
);
|
168551
168551
|
}
|
168552
|
-
const
|
168552
|
+
const existingFunctions = /* @__PURE__ */ new Map();
|
168553
168553
|
const overrides = {};
|
168554
168554
|
for (const [path11, output2] of Object.entries(buildResult.output)) {
|
168555
168555
|
const normalizedPath = stripDuplicateSlashes(path11);
|
168556
168556
|
if (isLambda(output2)) {
|
168557
|
-
await writeLambda(
|
168557
|
+
await writeLambda(
|
168558
|
+
outputDir,
|
168559
|
+
output2,
|
168560
|
+
normalizedPath,
|
168561
|
+
void 0,
|
168562
|
+
existingFunctions
|
168563
|
+
);
|
168558
168564
|
} else if (isPrerender(output2)) {
|
168559
168565
|
if (!output2.lambda) {
|
168560
168566
|
throw new Error(
|
@@ -168566,7 +168572,7 @@ async function writeBuildResultV2(outputDir, buildResult, build2, vercelConfig)
|
|
168566
168572
|
output2.lambda,
|
168567
168573
|
normalizedPath,
|
168568
168574
|
void 0,
|
168569
|
-
|
168575
|
+
existingFunctions
|
168570
168576
|
);
|
168571
168577
|
let fallback = output2.fallback;
|
168572
168578
|
if (fallback) {
|
@@ -168613,7 +168619,12 @@ async function writeBuildResultV2(outputDir, buildResult, build2, vercelConfig)
|
|
168613
168619
|
vercelConfig?.cleanUrls
|
168614
168620
|
);
|
168615
168621
|
} else if (isEdgeFunction(output2)) {
|
168616
|
-
await writeEdgeFunction(
|
168622
|
+
await writeEdgeFunction(
|
168623
|
+
outputDir,
|
168624
|
+
output2,
|
168625
|
+
normalizedPath,
|
168626
|
+
existingFunctions
|
168627
|
+
);
|
168617
168628
|
} else {
|
168618
168629
|
throw new Error(
|
168619
168630
|
`Unsupported output type: "${output2.type}" for ${normalizedPath}`
|
@@ -168679,8 +168690,30 @@ async function writeStaticFile(outputDir, file, path11, overrides, cleanUrls = f
|
|
168679
168690
|
}
|
168680
168691
|
await (0, import_build_utils8.downloadFile)(file, dest);
|
168681
168692
|
}
|
168682
|
-
async function
|
168693
|
+
async function writeFunctionSymlink(outputDir, dest, fn2, existingFunctions) {
|
168694
|
+
const existingPath = existingFunctions.get(fn2);
|
168695
|
+
if (!existingPath)
|
168696
|
+
return false;
|
168697
|
+
const destDir = (0, import_path24.dirname)(dest);
|
168698
|
+
const targetDest = (0, import_path24.join)(outputDir, "functions", `${existingPath}.func`);
|
168699
|
+
const target = (0, import_path24.relative)(destDir, targetDest);
|
168700
|
+
await import_fs_extra15.default.mkdirp(destDir);
|
168701
|
+
await import_fs_extra15.default.symlink(target, dest);
|
168702
|
+
return true;
|
168703
|
+
}
|
168704
|
+
async function writeEdgeFunction(outputDir, edgeFunction, path11, existingFunctions) {
|
168683
168705
|
const dest = (0, import_path24.join)(outputDir, "functions", `${path11}.func`);
|
168706
|
+
if (existingFunctions) {
|
168707
|
+
if (await writeFunctionSymlink(
|
168708
|
+
outputDir,
|
168709
|
+
dest,
|
168710
|
+
edgeFunction,
|
168711
|
+
existingFunctions
|
168712
|
+
)) {
|
168713
|
+
return;
|
168714
|
+
}
|
168715
|
+
existingFunctions.set(edgeFunction, path11);
|
168716
|
+
}
|
168684
168717
|
await import_fs_extra15.default.mkdirp(dest);
|
168685
168718
|
const ops = [];
|
168686
168719
|
ops.push((0, import_build_utils8.download)(edgeFunction.files, dest));
|
@@ -168699,22 +168732,14 @@ async function writeEdgeFunction(outputDir, edgeFunction, path11) {
|
|
168699
168732
|
);
|
168700
168733
|
await Promise.all(ops);
|
168701
168734
|
}
|
168702
|
-
async function writeLambda(outputDir, lambda, path11, functionConfiguration,
|
168735
|
+
async function writeLambda(outputDir, lambda, path11, functionConfiguration, existingFunctions) {
|
168703
168736
|
const dest = (0, import_path24.join)(outputDir, "functions", `${path11}.func`);
|
168704
|
-
|
168705
|
-
|
168706
|
-
|
168707
|
-
|
168708
|
-
|
168709
|
-
"functions",
|
168710
|
-
`${existingLambdaPath}.func`
|
168711
|
-
);
|
168712
|
-
const target = (0, import_path24.relative)(destDir, targetDest);
|
168713
|
-
await import_fs_extra15.default.mkdirp(destDir);
|
168714
|
-
await import_fs_extra15.default.symlink(target, dest);
|
168715
|
-
return;
|
168737
|
+
if (existingFunctions) {
|
168738
|
+
if (await writeFunctionSymlink(outputDir, dest, lambda, existingFunctions)) {
|
168739
|
+
return;
|
168740
|
+
}
|
168741
|
+
existingFunctions.set(lambda, path11);
|
168716
168742
|
}
|
168717
|
-
lambdas?.set(lambda, path11);
|
168718
168743
|
await import_fs_extra15.default.mkdirp(dest);
|
168719
168744
|
const ops = [];
|
168720
168745
|
if (lambda.files) {
|
@@ -169709,8 +169734,8 @@ var init_static_builder = __esm({
|
|
169709
169734
|
});
|
169710
169735
|
|
169711
169736
|
// src/util/build/import-builders.ts
|
169712
|
-
async function importBuilders(builderSpecs,
|
169713
|
-
const buildersDir = (0, import_path25.join)(
|
169737
|
+
async function importBuilders(builderSpecs, cwd2, output2) {
|
169738
|
+
const buildersDir = (0, import_path25.join)(cwd2, VERCEL_DIR2, "builders");
|
169714
169739
|
let importResult = await resolveBuilders(buildersDir, builderSpecs, output2);
|
169715
169740
|
if ("buildersToAdd" in importResult) {
|
169716
169741
|
const installResult = await installBuilders(
|
@@ -170165,10 +170190,10 @@ var init_validate_config = __esm({
|
|
170165
170190
|
});
|
170166
170191
|
|
170167
170192
|
// src/util/build/monorepo.ts
|
170168
|
-
async function setMonorepoDefaultSettings(
|
170169
|
-
const localFileSystem = new import_fs_detectors3.LocalFileSystemDetector(
|
170193
|
+
async function setMonorepoDefaultSettings(cwd2, workPath, projectSettings, output2) {
|
170194
|
+
const localFileSystem = new import_fs_detectors3.LocalFileSystemDetector(cwd2);
|
170170
170195
|
const projectName = (0, import_path27.basename)(workPath);
|
170171
|
-
const relativeToRoot = (0, import_path27.relative)(workPath,
|
170196
|
+
const relativeToRoot = (0, import_path27.relative)(workPath, cwd2);
|
170172
170197
|
const setCommand = (command, value) => {
|
170173
170198
|
if (projectSettings[command]) {
|
170174
170199
|
(0, import_build_utils12.debug)(
|
@@ -170181,7 +170206,7 @@ async function setMonorepoDefaultSettings(cwd, workPath, projectSettings, output
|
|
170181
170206
|
try {
|
170182
170207
|
const result = await (0, import_fs_detectors3.getMonorepoDefaultSettings)(
|
170183
170208
|
projectName,
|
170184
|
-
(0, import_path27.relative)(
|
170209
|
+
(0, import_path27.relative)(cwd2, workPath),
|
170185
170210
|
relativeToRoot,
|
170186
170211
|
localFileSystem
|
170187
170212
|
);
|
@@ -170297,10 +170322,11 @@ var init_scrub_argv = __esm({
|
|
170297
170322
|
// src/commands/build/index.ts
|
170298
170323
|
var build_exports = {};
|
170299
170324
|
__export3(build_exports, {
|
170300
|
-
default: () => main2
|
170325
|
+
default: () => main2,
|
170326
|
+
readInstalledVersion: () => readInstalledVersion
|
170301
170327
|
});
|
170302
170328
|
async function main2(client2) {
|
170303
|
-
let { cwd } = client2;
|
170329
|
+
let { cwd: cwd2 } = client2;
|
170304
170330
|
const { output: output2 } = client2;
|
170305
170331
|
if (process.env.__VERCEL_BUILD_RUNNING) {
|
170306
170332
|
output2.error(
|
@@ -170330,17 +170356,17 @@ async function main2(client2) {
|
|
170330
170356
|
const target = argv2["--prod"] ? "production" : "preview";
|
170331
170357
|
const yes = Boolean(argv2["--yes"]);
|
170332
170358
|
try {
|
170333
|
-
await (0, import_build_utils13.validateNpmrc)(
|
170359
|
+
await (0, import_build_utils13.validateNpmrc)(cwd2);
|
170334
170360
|
} catch (err) {
|
170335
170361
|
output2.prettyError(err);
|
170336
170362
|
return 1;
|
170337
170363
|
}
|
170338
|
-
const link4 = await getProjectLink(client2,
|
170364
|
+
const link4 = await getProjectLink(client2, cwd2);
|
170339
170365
|
const projectRootDirectory = link4?.projectRootDirectory ?? "";
|
170340
170366
|
if (link4?.repoRoot) {
|
170341
|
-
|
170367
|
+
cwd2 = client2.cwd = link4.repoRoot;
|
170342
170368
|
}
|
170343
|
-
const vercelDir = (0, import_path28.join)(
|
170369
|
+
const vercelDir = (0, import_path28.join)(cwd2, projectRootDirectory, VERCEL_DIR2);
|
170344
170370
|
let project = await readProjectSettings(vercelDir);
|
170345
170371
|
const isTTY3 = process.stdin.isTTY;
|
170346
170372
|
while (!project?.settings) {
|
@@ -170368,7 +170394,7 @@ async function main2(client2) {
|
|
170368
170394
|
return 0;
|
170369
170395
|
}
|
170370
170396
|
const { argv: originalArgv } = client2;
|
170371
|
-
client2.cwd = (0, import_path28.join)(
|
170397
|
+
client2.cwd = (0, import_path28.join)(cwd2, projectRootDirectory);
|
170372
170398
|
client2.argv = [
|
170373
170399
|
...originalArgv.slice(0, 2),
|
170374
170400
|
"pull",
|
@@ -170379,11 +170405,11 @@ async function main2(client2) {
|
|
170379
170405
|
if (result !== 0) {
|
170380
170406
|
return result;
|
170381
170407
|
}
|
170382
|
-
client2.cwd =
|
170408
|
+
client2.cwd = cwd2;
|
170383
170409
|
client2.argv = originalArgv;
|
170384
170410
|
project = await readProjectSettings(vercelDir);
|
170385
170411
|
}
|
170386
|
-
const defaultOutputDir = (0, import_path28.join)(
|
170412
|
+
const defaultOutputDir = (0, import_path28.join)(cwd2, projectRootDirectory, OUTPUT_DIR);
|
170387
170413
|
const outputDir = argv2["--output"] ? (0, import_path28.resolve)(argv2["--output"]) : defaultOutputDir;
|
170388
170414
|
await Promise.all([
|
170389
170415
|
import_fs_extra18.default.remove(outputDir),
|
@@ -170398,7 +170424,7 @@ async function main2(client2) {
|
|
170398
170424
|
const envToUnset = /* @__PURE__ */ new Set(["VERCEL", "NOW_BUILDER"]);
|
170399
170425
|
try {
|
170400
170426
|
const envPath = (0, import_path28.join)(
|
170401
|
-
|
170427
|
+
cwd2,
|
170402
170428
|
projectRootDirectory,
|
170403
170429
|
VERCEL_DIR2,
|
170404
170430
|
`.env.${target}.local`
|
@@ -170420,10 +170446,13 @@ async function main2(client2) {
|
|
170420
170446
|
if (project.settings.analyticsId) {
|
170421
170447
|
envToUnset.add("VERCEL_ANALYTICS_ID");
|
170422
170448
|
process.env.VERCEL_ANALYTICS_ID = project.settings.analyticsId;
|
170449
|
+
output2.warn(
|
170450
|
+
"Vercel Speed Insights auto-injection is deprecated in favor of @vercel/speed-insights package. Learn more: https://vercel.link/upgrate-to-speed-insights-package"
|
170451
|
+
);
|
170423
170452
|
}
|
170424
170453
|
process.env.VERCEL = "1";
|
170425
170454
|
process.env.NOW_BUILDER = "1";
|
170426
|
-
await doBuild(client2, project, buildsJson,
|
170455
|
+
await doBuild(client2, project, buildsJson, cwd2, outputDir);
|
170427
170456
|
return 0;
|
170428
170457
|
} catch (err) {
|
170429
170458
|
output2.prettyError(err);
|
@@ -170441,9 +170470,9 @@ async function main2(client2) {
|
|
170441
170470
|
}
|
170442
170471
|
}
|
170443
170472
|
}
|
170444
|
-
async function doBuild(client2, project, buildsJson,
|
170473
|
+
async function doBuild(client2, project, buildsJson, cwd2, outputDir) {
|
170445
170474
|
const { localConfigPath, output: output2 } = client2;
|
170446
|
-
const workPath = (0, import_path28.join)(
|
170475
|
+
const workPath = (0, import_path28.join)(cwd2, project.settings.rootDirectory || ".");
|
170447
170476
|
const [pkg, vercelConfig, nowConfig] = await Promise.all([
|
170448
170477
|
readJSONFile((0, import_path28.join)(workPath, "package.json")),
|
170449
170478
|
readJSONFile(
|
@@ -170472,7 +170501,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170472
170501
|
...pickOverrides(localConfig)
|
170473
170502
|
};
|
170474
170503
|
if (process.env.VERCEL_BUILD_MONOREPO_SUPPORT === "1" && pkg?.scripts?.["vercel-build"] === void 0 && projectSettings.rootDirectory !== null && projectSettings.rootDirectory !== ".") {
|
170475
|
-
await setMonorepoDefaultSettings(
|
170504
|
+
await setMonorepoDefaultSettings(cwd2, workPath, projectSettings, output2);
|
170476
170505
|
}
|
170477
170506
|
const files = (await staticFiles(workPath, client2)).map(
|
170478
170507
|
(f) => (0, import_build_utils13.normalizePath)((0, import_path28.relative)(workPath, f))
|
@@ -170533,7 +170562,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170533
170562
|
zeroConfigRoutes.push(...detectedBuilders.defaultRoutes || []);
|
170534
170563
|
}
|
170535
170564
|
const builderSpecs = new Set(builds.map((b) => b.use));
|
170536
|
-
const buildersWithPkgs = await importBuilders(builderSpecs,
|
170565
|
+
const buildersWithPkgs = await importBuilders(builderSpecs, cwd2, output2);
|
170537
170566
|
const filesMap = {};
|
170538
170567
|
for (const path11 of files) {
|
170539
170568
|
const fsPath = (0, import_path28.join)(workPath, path11);
|
@@ -170543,27 +170572,6 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170543
170572
|
const buildStamp = stamp_default();
|
170544
170573
|
await import_fs_extra18.default.mkdirp(outputDir);
|
170545
170574
|
const ops = [];
|
170546
|
-
const dependencyMap = makeDepencyMap(pkg);
|
170547
|
-
const speedInsighsVersion = dependencyMap.get("@vercel/speed-insights");
|
170548
|
-
if (speedInsighsVersion) {
|
170549
|
-
if (process.env.VERCEL_ANALYTICS_ID) {
|
170550
|
-
output2.warn(
|
170551
|
-
`The \`VERCEL_ANALYTICS_ID\` environment variable is deprecated and will be removed in a future release. Please remove it from your environment variables`
|
170552
|
-
);
|
170553
|
-
delete process.env.VERCEL_ANALYTICS_ID;
|
170554
|
-
}
|
170555
|
-
buildsJson.features = {
|
170556
|
-
...buildsJson.features ?? {},
|
170557
|
-
speedInsightsVersion: speedInsighsVersion
|
170558
|
-
};
|
170559
|
-
}
|
170560
|
-
const webAnalyticsVersion = dependencyMap.get("@vercel/analytics");
|
170561
|
-
if (webAnalyticsVersion) {
|
170562
|
-
buildsJson.features = {
|
170563
|
-
...buildsJson.features ?? {},
|
170564
|
-
webAnalyticsVersion
|
170565
|
-
};
|
170566
|
-
}
|
170567
170575
|
const buildsJsonBuilds = new Map(
|
170568
170576
|
builds.map((build2) => {
|
170569
170577
|
const builderWithPkg = buildersWithPkgs.get(build2.use);
|
@@ -170583,9 +170591,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170583
170591
|
})
|
170584
170592
|
);
|
170585
170593
|
buildsJson.builds = Array.from(buildsJsonBuilds.values());
|
170586
|
-
await
|
170587
|
-
spaces: 2
|
170588
|
-
});
|
170594
|
+
await writeBuildJson(buildsJson, outputDir);
|
170589
170595
|
const meta = {
|
170590
170596
|
skipDownload: true,
|
170591
170597
|
cliVersion: pkg_default.version
|
@@ -170593,7 +170599,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170593
170599
|
const sortedBuilders = sortBuilders(builds);
|
170594
170600
|
const buildResults = /* @__PURE__ */ new Map();
|
170595
170601
|
const overrides = [];
|
170596
|
-
const repoRootPath =
|
170602
|
+
const repoRootPath = cwd2;
|
170597
170603
|
const corepackShimDir = await initCorepack({ repoRootPath });
|
170598
170604
|
for (const build2 of sortedBuilders) {
|
170599
170605
|
if (typeof build2.src !== "string")
|
@@ -170683,6 +170689,32 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170683
170689
|
throw error4;
|
170684
170690
|
}
|
170685
170691
|
}
|
170692
|
+
let needBuildsJsonOverride = false;
|
170693
|
+
const speedInsightsVersion = await readInstalledVersion(
|
170694
|
+
client2,
|
170695
|
+
"@vercel/speed-insights"
|
170696
|
+
);
|
170697
|
+
if (speedInsightsVersion) {
|
170698
|
+
buildsJson.features = {
|
170699
|
+
...buildsJson.features ?? {},
|
170700
|
+
speedInsightsVersion
|
170701
|
+
};
|
170702
|
+
needBuildsJsonOverride = true;
|
170703
|
+
}
|
170704
|
+
const webAnalyticsVersion = await readInstalledVersion(
|
170705
|
+
client2,
|
170706
|
+
"@vercel/analytics"
|
170707
|
+
);
|
170708
|
+
if (webAnalyticsVersion) {
|
170709
|
+
buildsJson.features = {
|
170710
|
+
...buildsJson.features ?? {},
|
170711
|
+
webAnalyticsVersion
|
170712
|
+
};
|
170713
|
+
needBuildsJsonOverride = true;
|
170714
|
+
}
|
170715
|
+
if (needBuildsJsonOverride) {
|
170716
|
+
await writeBuildJson(buildsJson, outputDir);
|
170717
|
+
}
|
170686
170718
|
const configPath = (0, import_path28.join)(outputDir, "config.json");
|
170687
170719
|
const existingConfig = await readJSONFile(configPath);
|
170688
170720
|
if (existingConfig instanceof CantParseJSONFile) {
|
@@ -170725,7 +170757,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170725
170757
|
const mergedWildcard = mergeWildcard(buildResults.values());
|
170726
170758
|
const mergedOverrides = overrides.length > 0 ? Object.assign({}, ...overrides) : void 0;
|
170727
170759
|
const mergedFlags = mergeFlags(buildResults.values());
|
170728
|
-
const framework = await getFramework(
|
170760
|
+
const framework = await getFramework(cwd2, buildResults);
|
170729
170761
|
const config3 = {
|
170730
170762
|
version: 3,
|
170731
170763
|
routes: mergedRoutes,
|
@@ -170737,7 +170769,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170737
170769
|
flags: mergedFlags
|
170738
170770
|
};
|
170739
170771
|
await import_fs_extra18.default.writeJSON((0, import_path28.join)(outputDir, "config.json"), config3, { spaces: 2 });
|
170740
|
-
const relOutputDir = (0, import_path28.relative)(
|
170772
|
+
const relOutputDir = (0, import_path28.relative)(cwd2, outputDir);
|
170741
170773
|
output2.print(
|
170742
170774
|
`${prependEmoji(
|
170743
170775
|
`Build Completed in ${import_chalk45.default.bold(
|
@@ -170748,9 +170780,9 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir) {
|
|
170748
170780
|
`
|
170749
170781
|
);
|
170750
170782
|
}
|
170751
|
-
async function getFramework(
|
170783
|
+
async function getFramework(cwd2, buildResults) {
|
170752
170784
|
const detectedFramework = await (0, import_fs_detectors4.detectFrameworkRecord)({
|
170753
|
-
fs: new import_fs_detectors4.LocalFileSystemDetector(
|
170785
|
+
fs: new import_fs_detectors4.LocalFileSystemDetector(cwd2),
|
170754
170786
|
frameworkList: import_frameworks4.default
|
170755
170787
|
});
|
170756
170788
|
if (!detectedFramework) {
|
@@ -170843,13 +170875,24 @@ function mergeFlags(buildResults) {
|
|
170843
170875
|
return [];
|
170844
170876
|
});
|
170845
170877
|
}
|
170846
|
-
function
|
170847
|
-
|
170848
|
-
...Object.entries(pkg?.devDependencies ?? {}),
|
170849
|
-
...Object.entries(pkg?.dependencies ?? {})
|
170850
|
-
]);
|
170878
|
+
async function writeBuildJson(buildsJson, outputDir) {
|
170879
|
+
await import_fs_extra18.default.writeJSON((0, import_path28.join)(outputDir, "builds.json"), buildsJson, { spaces: 2 });
|
170851
170880
|
}
|
170852
|
-
|
170881
|
+
async function readInstalledVersion({ output: output2 }, pkgName) {
|
170882
|
+
try {
|
170883
|
+
const descriptorPath = require.resolve(`${pkgName}/package.json`, {
|
170884
|
+
paths: [(0, import_process.cwd)()]
|
170885
|
+
});
|
170886
|
+
const descriptor2 = await (0, import_fs_extra18.readJSON)(descriptorPath);
|
170887
|
+
return descriptor2?.version;
|
170888
|
+
} catch (err) {
|
170889
|
+
output2.debug(
|
170890
|
+
`Package ${pkgName} is not installed (failed to read its package.json: ${err})`
|
170891
|
+
);
|
170892
|
+
}
|
170893
|
+
return;
|
170894
|
+
}
|
170895
|
+
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;
|
170853
170896
|
var init_build = __esm({
|
170854
170897
|
"src/commands/build/index.ts"() {
|
170855
170898
|
"use strict";
|
@@ -170887,6 +170930,7 @@ var init_build = __esm({
|
|
170887
170930
|
init_help();
|
170888
170931
|
init_command4();
|
170889
170932
|
init_scrub_argv();
|
170933
|
+
import_process = require("process");
|
170890
170934
|
}
|
170891
170935
|
});
|
170892
170936
|
|
@@ -172046,7 +172090,7 @@ var init_command6 = __esm({
|
|
172046
172090
|
shorthand: null,
|
172047
172091
|
type: "boolean",
|
172048
172092
|
deprecated: false,
|
172049
|
-
description:
|
172093
|
+
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",
|
172050
172094
|
multi: false
|
172051
172095
|
},
|
172052
172096
|
{
|
@@ -172292,7 +172336,7 @@ var init_deploy = __esm({
|
|
172292
172336
|
}
|
172293
172337
|
const { log: log2, debug: debug3, error: error4, prettyError } = output2;
|
172294
172338
|
const quiet = !client2.stdout.isTTY;
|
172295
|
-
let { path:
|
172339
|
+
let { path: cwd2 } = pathValidation;
|
172296
172340
|
const autoConfirm = argv2["--yes"];
|
172297
172341
|
if (argv2["--name"]) {
|
172298
172342
|
output2.print(
|
@@ -172325,7 +172369,7 @@ var init_deploy = __esm({
|
|
172325
172369
|
output2.error(`Format must be one of: ${import_client10.VALID_ARCHIVE_FORMATS.join(", ")}`);
|
172326
172370
|
return 1;
|
172327
172371
|
}
|
172328
|
-
const link4 = await getLinkedProject(client2,
|
172372
|
+
const link4 = await getLinkedProject(client2, cwd2);
|
172329
172373
|
if (link4.status === "error") {
|
172330
172374
|
return link4.exitCode;
|
172331
172375
|
}
|
@@ -172336,7 +172380,7 @@ var init_deploy = __esm({
|
|
172336
172380
|
if (status === "not_linked") {
|
172337
172381
|
const shouldStartSetup = autoConfirm || await confirm(
|
172338
172382
|
client2,
|
172339
|
-
`Set up and deploy ${import_chalk53.default.cyan(`\u201C${humanizePath(
|
172383
|
+
`Set up and deploy ${import_chalk53.default.cyan(`\u201C${humanizePath(cwd2)}\u201D`)}?`,
|
172340
172384
|
true
|
172341
172385
|
);
|
172342
172386
|
if (!shouldStartSetup) {
|
@@ -172370,14 +172414,14 @@ var init_deploy = __esm({
|
|
172370
172414
|
);
|
172371
172415
|
if (typeof projectOrNewProjectName === "string") {
|
172372
172416
|
newProjectName = projectOrNewProjectName;
|
172373
|
-
rootDirectory = await inputRootDirectory(client2,
|
172417
|
+
rootDirectory = await inputRootDirectory(client2, cwd2, autoConfirm);
|
172374
172418
|
} else {
|
172375
172419
|
project = projectOrNewProjectName;
|
172376
172420
|
rootDirectory = project.rootDirectory;
|
172377
172421
|
sourceFilesOutsideRootDirectory = project.sourceFilesOutsideRootDirectory;
|
172378
172422
|
await linkFolderToProject(
|
172379
172423
|
client2,
|
172380
|
-
|
172424
|
+
cwd2,
|
172381
172425
|
{
|
172382
172426
|
projectId: project.id,
|
172383
172427
|
orgId: org.id
|
@@ -172389,16 +172433,16 @@ var init_deploy = __esm({
|
|
172389
172433
|
}
|
172390
172434
|
}
|
172391
172435
|
if (link4.status === "linked" && link4.repoRoot) {
|
172392
|
-
|
172436
|
+
cwd2 = link4.repoRoot;
|
172393
172437
|
}
|
172394
172438
|
if (!org) {
|
172395
172439
|
throw new Error(`"org" is not defined`);
|
172396
172440
|
}
|
172397
172441
|
if (argv2["--prebuilt"]) {
|
172398
172442
|
if (link4.status === "linked" && link4.repoRoot && link4.project.rootDirectory) {
|
172399
|
-
|
172443
|
+
cwd2 = (0, import_path32.join)(cwd2, link4.project.rootDirectory);
|
172400
172444
|
}
|
172401
|
-
const prebuiltExists = await import_fs_extra20.default.pathExists((0, import_path32.join)(
|
172445
|
+
const prebuiltExists = await import_fs_extra20.default.pathExists((0, import_path32.join)(cwd2, ".vercel/output"));
|
172402
172446
|
if (!prebuiltExists) {
|
172403
172447
|
error4(
|
172404
172448
|
`The ${param(
|
@@ -172409,7 +172453,7 @@ var init_deploy = __esm({
|
|
172409
172453
|
);
|
172410
172454
|
return 1;
|
172411
172455
|
}
|
172412
|
-
const prebuiltBuild = await getPrebuiltJson(
|
172456
|
+
const prebuiltBuild = await getPrebuiltJson(cwd2);
|
172413
172457
|
const prebuiltError = prebuiltBuild?.error || prebuiltBuild?.builds?.find((build2) => "error" in build2)?.error;
|
172414
172458
|
if (prebuiltError) {
|
172415
172459
|
output2.log(
|
@@ -172438,17 +172482,17 @@ var init_deploy = __esm({
|
|
172438
172482
|
}
|
172439
172483
|
const contextName = org.slug;
|
172440
172484
|
client2.config.currentTeam = org.type === "team" ? org.id : void 0;
|
172441
|
-
const sourcePath = rootDirectory && !sourceFilesOutsideRootDirectory ? (0, import_path32.join)(
|
172485
|
+
const sourcePath = rootDirectory && !sourceFilesOutsideRootDirectory ? (0, import_path32.join)(cwd2, rootDirectory) : cwd2;
|
172442
172486
|
if (rootDirectory && await validateRootDirectory(
|
172443
172487
|
output2,
|
172444
|
-
|
172488
|
+
cwd2,
|
172445
172489
|
sourcePath,
|
172446
172490
|
project ? `To change your Project Settings, go to https://vercel.com/${org?.slug}/${project.name}/settings` : ""
|
172447
172491
|
) === false) {
|
172448
172492
|
return 1;
|
172449
172493
|
}
|
172450
172494
|
if (rootDirectory) {
|
172451
|
-
const rootDirectoryConfig = readLocalConfig((0, import_path32.join)(
|
172495
|
+
const rootDirectoryConfig = readLocalConfig((0, import_path32.join)(cwd2, rootDirectory));
|
172452
172496
|
if (rootDirectoryConfig) {
|
172453
172497
|
debug3(`Read local config from root directory (${rootDirectory})`);
|
172454
172498
|
localConfig = rootDirectoryConfig;
|
@@ -172508,7 +172552,7 @@ var init_deploy = __esm({
|
|
172508
172552
|
parseMeta(localConfig.meta),
|
172509
172553
|
parseMeta(argv2["--meta"])
|
172510
172554
|
);
|
172511
|
-
const gitMetadata = await createGitMeta(
|
172555
|
+
const gitMetadata = await createGitMeta(cwd2, output2, project);
|
172512
172556
|
const deploymentEnv = Object.assign(
|
172513
172557
|
{},
|
172514
172558
|
parseEnv(localConfig.env),
|
@@ -172583,7 +172627,7 @@ var init_deploy = __esm({
|
|
172583
172627
|
createArgs,
|
172584
172628
|
org,
|
172585
172629
|
!project,
|
172586
|
-
|
172630
|
+
cwd2,
|
172587
172631
|
archive
|
172588
172632
|
);
|
172589
172633
|
if (deployment.code === "missing_project_settings") {
|
@@ -172612,7 +172656,7 @@ var init_deploy = __esm({
|
|
172612
172656
|
createArgs,
|
172613
172657
|
org,
|
172614
172658
|
false,
|
172615
|
-
|
172659
|
+
cwd2
|
172616
172660
|
);
|
172617
172661
|
}
|
172618
172662
|
if (deployment instanceof NotDomainOwner) {
|
@@ -184689,8 +184733,8 @@ var require_src3 = __commonJS2({
|
|
184689
184733
|
sendError
|
184690
184734
|
}, methods);
|
184691
184735
|
module2.exports = async (request, response, config3 = {}, methods = {}) => {
|
184692
|
-
const
|
184693
|
-
const current = config3.public ? path11.resolve(
|
184736
|
+
const cwd2 = process.cwd();
|
184737
|
+
const current = config3.public ? path11.resolve(cwd2, config3.public) : cwd2;
|
184694
184738
|
const handlers = getHandlers(methods);
|
184695
184739
|
let relativePath = null;
|
184696
184740
|
let acceptsJSON = null;
|
@@ -185741,7 +185785,7 @@ Please run \`${await getUpdateCommand()}\` to update to the latest CLI.`
|
|
185741
185785
|
);
|
185742
185786
|
}
|
185743
185787
|
}
|
185744
|
-
async function getBuildMatches(vercelConfig,
|
185788
|
+
async function getBuildMatches(vercelConfig, cwd2, output2, devServer, fileList) {
|
185745
185789
|
const matches = [];
|
185746
185790
|
if (fileList.length === 0) {
|
185747
185791
|
return matches;
|
@@ -185749,7 +185793,7 @@ async function getBuildMatches(vercelConfig, cwd, output2, devServer, fileList)
|
|
185749
185793
|
const noMatches = [];
|
185750
185794
|
const builds = vercelConfig.builds || [{ src: "**", use: "@vercel/static" }];
|
185751
185795
|
const builderSpecs = new Set(builds.map((b) => b.use).filter(Boolean));
|
185752
|
-
const buildersWithPkgs = await importBuilders(builderSpecs,
|
185796
|
+
const buildersWithPkgs = await importBuilders(builderSpecs, cwd2, output2);
|
185753
185797
|
for (const buildConfig of builds) {
|
185754
185798
|
let { src = "**", use, config: config3 = {} } = buildConfig;
|
185755
185799
|
if (!use) {
|
@@ -185764,12 +185808,12 @@ async function getBuildMatches(vercelConfig, cwd, output2, devServer, fileList)
|
|
185764
185808
|
mapToEntrypoint.set(extensionless, src);
|
185765
185809
|
src = extensionless;
|
185766
185810
|
}
|
185767
|
-
const files = fileList.filter((name) => name === src || (0, import_minimatch3.default)(name, src, { dot: true })).map((name) => (0, import_path35.join)(
|
185811
|
+
const files = fileList.filter((name) => name === src || (0, import_minimatch3.default)(name, src, { dot: true })).map((name) => (0, import_path35.join)(cwd2, name));
|
185768
185812
|
if (files.length === 0) {
|
185769
185813
|
noMatches.push(buildConfig);
|
185770
185814
|
}
|
185771
185815
|
for (const file of files) {
|
185772
|
-
src = relative6(
|
185816
|
+
src = relative6(cwd2, file);
|
185773
185817
|
const entrypoint = mapToEntrypoint.get(src) || src;
|
185774
185818
|
if (config3.zeroConfig && config3.outputDirectory) {
|
185775
185819
|
const outputMatch = config3.outputDirectory + "/";
|
@@ -186191,9 +186235,9 @@ function proxyPass(req, res, dest, devServer, requestId, ignorePath = true) {
|
|
186191
186235
|
}
|
186192
186236
|
);
|
186193
186237
|
}
|
186194
|
-
function serveStaticFile(req, res,
|
186238
|
+
function serveStaticFile(req, res, cwd2, opts) {
|
186195
186239
|
return (0, import_serve_handler.default)(req, res, {
|
186196
|
-
public:
|
186240
|
+
public: cwd2,
|
186197
186241
|
cleanUrls: false,
|
186198
186242
|
etag: true,
|
186199
186243
|
...opts
|
@@ -186450,7 +186494,7 @@ var init_server = __esm({
|
|
186450
186494
|
import_frameworks5.default.map((f) => f.useRuntime?.use || "@vercel/static-build")
|
186451
186495
|
);
|
186452
186496
|
DevServer = class {
|
186453
|
-
constructor(
|
186497
|
+
constructor(cwd2, options) {
|
186454
186498
|
this.clearVercelConfigPromise = () => {
|
186455
186499
|
this.getVercelConfigPromise = null;
|
186456
186500
|
};
|
@@ -187095,8 +187139,8 @@ Please ensure that ${cmd(err.path)} is properly installed`;
|
|
187095
187139
|
await this.sendError(req, res, requestId, "UNKNOWN_ASSET_TYPE");
|
187096
187140
|
}
|
187097
187141
|
};
|
187098
|
-
this.cwd =
|
187099
|
-
this.repoRoot = options.repoRoot ??
|
187142
|
+
this.cwd = cwd2;
|
187143
|
+
this.repoRoot = options.repoRoot ?? cwd2;
|
187100
187144
|
this.output = options.output;
|
187101
187145
|
this.envConfigs = { buildEnv: {}, runEnv: {}, allEnv: {} };
|
187102
187146
|
this.envValues = options.envValues || {};
|
@@ -187119,7 +187163,7 @@ Please ensure that ${cmd(err.path)} is properly installed`;
|
|
187119
187163
|
this.stopping = false;
|
187120
187164
|
this.buildMatches = /* @__PURE__ */ new Map();
|
187121
187165
|
this.inProgressBuilds = /* @__PURE__ */ new Map();
|
187122
|
-
this.devCacheDir = (0, import_path36.join)(getVercelDirectory(
|
187166
|
+
this.devCacheDir = (0, import_path36.join)(getVercelDirectory(cwd2), "cache");
|
187123
187167
|
this.vercelConfigWarning = false;
|
187124
187168
|
this.getVercelConfigPromise = null;
|
187125
187169
|
this.blockingBuildsPromise = null;
|
@@ -188036,7 +188080,7 @@ ${error_code}
|
|
188036
188080
|
return this.caseSensitive;
|
188037
188081
|
}
|
188038
188082
|
async runDevCommand() {
|
188039
|
-
const { devCommand: devCommand2, cwd } = this;
|
188083
|
+
const { devCommand: devCommand2, cwd: cwd2 } = this;
|
188040
188084
|
if (devCommand2 === this.currentDevCommand) {
|
188041
188085
|
return;
|
188042
188086
|
}
|
@@ -188067,13 +188111,13 @@ ${error_code}
|
|
188067
188111
|
PORT: `${port}`
|
188068
188112
|
}
|
188069
188113
|
);
|
188070
|
-
const nodeBinPaths = (0, import_build_utils17.getNodeBinPaths)({ base: this.repoRoot, start:
|
188114
|
+
const nodeBinPaths = (0, import_build_utils17.getNodeBinPaths)({ base: this.repoRoot, start: cwd2 });
|
188071
188115
|
const nodeBinPath = nodeBinPaths.join(import_path36.default.delimiter);
|
188072
188116
|
env.PATH = `${nodeBinPath}${import_path36.default.delimiter}${env.PATH}`;
|
188073
188117
|
let command = devCommand2.replace(/\$PORT/g, `${port}`).replace(/%PORT%/g, `${port}`);
|
188074
188118
|
this.output.debug(
|
188075
188119
|
`Starting dev command with parameters: ${JSON.stringify({
|
188076
|
-
cwd,
|
188120
|
+
cwd: cwd2,
|
188077
188121
|
command,
|
188078
188122
|
port
|
188079
188123
|
})}`
|
@@ -188082,7 +188126,7 @@ ${error_code}
|
|
188082
188126
|
const proxyPort = new RegExp(port.toString(), "g");
|
188083
188127
|
const p = (0, import_build_utils17.spawnCommand)(command, {
|
188084
188128
|
stdio: ["inherit", "pipe", "pipe"],
|
188085
|
-
cwd,
|
188129
|
+
cwd: cwd2,
|
188086
188130
|
env
|
188087
188131
|
});
|
188088
188132
|
this.devProcess = p;
|
@@ -188112,11 +188156,11 @@ ${error_code}
|
|
188112
188156
|
async function dev(client2, opts, args2) {
|
188113
188157
|
const { output: output2 } = client2;
|
188114
188158
|
const [dir = "."] = args2;
|
188115
|
-
let
|
188159
|
+
let cwd2 = (0, import_path37.resolve)(dir);
|
188116
188160
|
const listen4 = parseListen(opts["--listen"] || "3000");
|
188117
|
-
let link4 = await getLinkedProject(client2,
|
188161
|
+
let link4 = await getLinkedProject(client2, cwd2);
|
188118
188162
|
if (link4.status === "not_linked" && !process.env.__VERCEL_SKIP_DEV_CMD) {
|
188119
|
-
link4 = await setupAndLink(client2,
|
188163
|
+
link4 = await setupAndLink(client2, cwd2, {
|
188120
188164
|
autoConfirm: opts["--yes"],
|
188121
188165
|
link: link4,
|
188122
188166
|
successEmoji: "link",
|
@@ -188142,16 +188186,16 @@ async function dev(client2, opts, args2) {
|
|
188142
188186
|
if (link4.status === "linked") {
|
188143
188187
|
const { project, org } = link4;
|
188144
188188
|
if (link4.repoRoot) {
|
188145
|
-
repoRoot =
|
188189
|
+
repoRoot = cwd2 = link4.repoRoot;
|
188146
188190
|
}
|
188147
188191
|
client2.config.currentTeam = org.type === "team" ? org.id : void 0;
|
188148
188192
|
projectSettings = project;
|
188149
188193
|
if (project.rootDirectory) {
|
188150
|
-
|
188194
|
+
cwd2 = (0, import_path37.join)(cwd2, project.rootDirectory);
|
188151
188195
|
}
|
188152
188196
|
envValues = (await pullEnvRecords(output2, client2, project.id, "vercel-cli:dev")).env;
|
188153
188197
|
}
|
188154
|
-
const devServer = new DevServer(
|
188198
|
+
const devServer = new DevServer(cwd2, {
|
188155
188199
|
output: output2,
|
188156
188200
|
projectSettings,
|
188157
188201
|
envValues,
|
@@ -188159,7 +188203,7 @@ async function dev(client2, opts, args2) {
|
|
188159
188203
|
});
|
188160
188204
|
process.on("SIGTERM", () => devServer.stop());
|
188161
188205
|
if (!devServer.devCommand) {
|
188162
|
-
const outputDir = (0, import_path37.join)(
|
188206
|
+
const outputDir = (0, import_path37.join)(cwd2, OUTPUT_DIR);
|
188163
188207
|
if (await import_fs_extra22.default.pathExists(outputDir)) {
|
188164
188208
|
output2.log(`Removing ${OUTPUT_DIR}`);
|
188165
188209
|
await import_fs_extra22.default.remove(outputDir);
|
@@ -191948,7 +191992,7 @@ async function main6(client2) {
|
|
191948
191992
|
}
|
191949
191993
|
const subArgs = argv2._.slice(1);
|
191950
191994
|
const { subcommand: subcommand2, args: args2 } = getSubcommand(subArgs, COMMAND_CONFIG6);
|
191951
|
-
const { cwd, output: output2, config: config3 } = client2;
|
191995
|
+
const { cwd: cwd2, output: output2, config: config3 } = client2;
|
191952
191996
|
const target = argv2["--environment"]?.toLowerCase() || "development";
|
191953
191997
|
if (!isValidEnvTarget(target)) {
|
191954
191998
|
output2.error(
|
@@ -191958,7 +192002,7 @@ async function main6(client2) {
|
|
191958
192002
|
);
|
191959
192003
|
return 1;
|
191960
192004
|
}
|
191961
|
-
const link4 = await getLinkedProject(client2,
|
192005
|
+
const link4 = await getLinkedProject(client2, cwd2);
|
191962
192006
|
if (link4.status === "error") {
|
191963
192007
|
return link4.exitCode;
|
191964
192008
|
} else if (link4.status === "not_linked") {
|
@@ -191987,7 +192031,7 @@ async function main6(client2) {
|
|
191987
192031
|
argv2,
|
191988
192032
|
args2,
|
191989
192033
|
output2,
|
191990
|
-
|
192034
|
+
cwd2,
|
191991
192035
|
"vercel-cli:env:pull"
|
191992
192036
|
);
|
191993
192037
|
default:
|
@@ -192028,7 +192072,7 @@ var init_env = __esm({
|
|
192028
192072
|
|
192029
192073
|
// src/commands/git/connect.ts
|
192030
192074
|
async function connect(client2, argv2, args2, project, org) {
|
192031
|
-
const { cwd, output: output2 } = client2;
|
192075
|
+
const { cwd: cwd2, output: output2 } = client2;
|
192032
192076
|
const confirm2 = Boolean(argv2["--yes"]);
|
192033
192077
|
const repoArg = argv2._[1];
|
192034
192078
|
if (args2.length > 1) {
|
@@ -192049,7 +192093,7 @@ async function connect(client2, argv2, args2, project, org) {
|
|
192049
192093
|
}
|
192050
192094
|
const gitProviderLink = project.link;
|
192051
192095
|
client2.config.currentTeam = org.type === "team" ? org.id : void 0;
|
192052
|
-
const gitConfigPath = (0, import_path41.join)(
|
192096
|
+
const gitConfigPath = (0, import_path41.join)(cwd2, ".git/config");
|
192053
192097
|
const gitConfig = await parseGitConfig(gitConfigPath, output2);
|
192054
192098
|
if (repoArg) {
|
192055
192099
|
const parsedUrlArg = parseRepoUrl(repoArg);
|
@@ -192504,8 +192548,8 @@ async function main7(client2) {
|
|
192504
192548
|
subcommand2 = argv2._[0];
|
192505
192549
|
const args2 = argv2._.slice(1);
|
192506
192550
|
const autoConfirm = Boolean(argv2["--yes"]);
|
192507
|
-
const { cwd, output: output2 } = client2;
|
192508
|
-
const linkedProject = await ensureLink("git", client2,
|
192551
|
+
const { cwd: cwd2, output: output2 } = client2;
|
192552
|
+
const linkedProject = await ensureLink("git", client2, cwd2, { autoConfirm });
|
192509
192553
|
if (typeof linkedProject === "number") {
|
192510
192554
|
return linkedProject;
|
192511
192555
|
}
|
@@ -192759,8 +192803,8 @@ ${deployHint}`);
|
|
192759
192803
|
throw e2;
|
192760
192804
|
});
|
192761
192805
|
}
|
192762
|
-
function prepareFolder(
|
192763
|
-
const dest = import_path42.default.join(
|
192806
|
+
function prepareFolder(cwd2, folder, force) {
|
192807
|
+
const dest = import_path42.default.join(cwd2, folder);
|
192764
192808
|
if (import_fs8.default.existsSync(dest)) {
|
192765
192809
|
if (!import_fs8.default.lstatSync(dest).isDirectory()) {
|
192766
192810
|
throw new Error(
|
@@ -192778,7 +192822,7 @@ function prepareFolder(cwd, folder, force) {
|
|
192778
192822
|
)} or ${cmd("-f")} to override it.`
|
192779
192823
|
);
|
192780
192824
|
}
|
192781
|
-
} else if (dest !==
|
192825
|
+
} else if (dest !== cwd2) {
|
192782
192826
|
try {
|
192783
192827
|
import_fs8.default.mkdirSync(dest);
|
192784
192828
|
} catch (e2) {
|
@@ -193566,23 +193610,23 @@ async function link3(client2) {
|
|
193566
193610
|
argv2["--yes"] = argv2["--confirm"];
|
193567
193611
|
}
|
193568
193612
|
const yes = !!argv2["--yes"];
|
193569
|
-
let
|
193570
|
-
if (
|
193613
|
+
let cwd2 = argv2._[1];
|
193614
|
+
if (cwd2) {
|
193571
193615
|
client2.output.warn(
|
193572
193616
|
`The ${cmd("vc link <directory>")} syntax is deprecated, please use ${cmd(
|
193573
|
-
`vc link --cwd ${
|
193617
|
+
`vc link --cwd ${cwd2}`
|
193574
193618
|
)} instead`
|
193575
193619
|
);
|
193576
193620
|
} else {
|
193577
|
-
|
193621
|
+
cwd2 = client2.cwd;
|
193578
193622
|
}
|
193579
193623
|
if (argv2["--repo"]) {
|
193580
193624
|
client2.output.warn(
|
193581
193625
|
`The ${cmd("--repo")} flag is in alpha, please report issues`
|
193582
193626
|
);
|
193583
|
-
await ensureRepoLink(client2,
|
193627
|
+
await ensureRepoLink(client2, cwd2, { yes, overwrite: true });
|
193584
193628
|
} else {
|
193585
|
-
const link4 = await ensureLink("link", client2,
|
193629
|
+
const link4 = await ensureLink("link", client2, cwd2, {
|
193586
193630
|
autoConfirm: yes,
|
193587
193631
|
forceDelete: true,
|
193588
193632
|
projectName: argv2["--project"],
|
@@ -193700,7 +193744,7 @@ async function list2(client2) {
|
|
193700
193744
|
handleError(err);
|
193701
193745
|
return 1;
|
193702
193746
|
}
|
193703
|
-
const { cwd, output: output2, config: config3 } = client2;
|
193747
|
+
const { cwd: cwd2, output: output2, config: config3 } = client2;
|
193704
193748
|
if ("--confirm" in argv2) {
|
193705
193749
|
output2.warn("`--confirm` is deprecated, please use `--yes` instead");
|
193706
193750
|
argv2["--yes"] = argv2["--confirm"];
|
@@ -193717,7 +193761,7 @@ async function list2(client2) {
|
|
193717
193761
|
const autoConfirm = !!argv2["--yes"];
|
193718
193762
|
const meta = parseMeta(argv2["--meta"]);
|
193719
193763
|
const target = argv2["--prod"] ? "production" : typeof argv2["--environment"] === "string" ? argv2["--environment"].toLowerCase() : void 0;
|
193720
|
-
let link4 = await getLinkedProject(client2,
|
193764
|
+
let link4 = await getLinkedProject(client2, cwd2);
|
193721
193765
|
if (link4.status === "error") {
|
193722
193766
|
return link4.exitCode;
|
193723
193767
|
}
|
@@ -193730,7 +193774,7 @@ async function list2(client2) {
|
|
193730
193774
|
return 1;
|
193731
193775
|
}
|
193732
193776
|
if (status === "not_linked" && !app) {
|
193733
|
-
const linkedProject = await ensureLink("list", client2,
|
193777
|
+
const linkedProject = await ensureLink("list", client2, cwd2, {
|
193734
193778
|
autoConfirm,
|
193735
193779
|
link: link4
|
193736
193780
|
});
|
@@ -195159,7 +195203,7 @@ async function getProjectByCwdOrLink({
|
|
195159
195203
|
autoConfirm,
|
195160
195204
|
client: client2,
|
195161
195205
|
commandName,
|
195162
|
-
cwd,
|
195206
|
+
cwd: cwd2,
|
195163
195207
|
projectNameOrId
|
195164
195208
|
}) {
|
195165
195209
|
if (projectNameOrId) {
|
@@ -195169,7 +195213,7 @@ async function getProjectByCwdOrLink({
|
|
195169
195213
|
}
|
195170
195214
|
return project;
|
195171
195215
|
}
|
195172
|
-
const linkedProject = await ensureLink(commandName, client2,
|
195216
|
+
const linkedProject = await ensureLink(commandName, client2, cwd2, {
|
195173
195217
|
autoConfirm
|
195174
195218
|
});
|
195175
195219
|
if (typeof linkedProject === "number") {
|
@@ -198508,16 +198552,16 @@ function createProxy(client2) {
|
|
198508
198552
|
}
|
198509
198553
|
|
198510
198554
|
// src/util/extension/exec.ts
|
198511
|
-
async function execExtension(client2, name, args2,
|
198555
|
+
async function execExtension(client2, name, args2, cwd2) {
|
198512
198556
|
const { debug: debug3, log: log2 } = client2.output;
|
198513
198557
|
const extensionCommand = `vercel-${name}`;
|
198514
|
-
const { packageJsonPath, lockfilePath } = await (0, import_build_utils4.scanParentDirs)(
|
198558
|
+
const { packageJsonPath, lockfilePath } = await (0, import_build_utils4.scanParentDirs)(cwd2);
|
198515
198559
|
const baseFile = lockfilePath || packageJsonPath;
|
198516
198560
|
let extensionPath = null;
|
198517
198561
|
if (baseFile) {
|
198518
198562
|
extensionPath = await (0, import_build_utils4.walkParentDirs)({
|
198519
198563
|
base: (0, import_path8.dirname)(baseFile),
|
198520
|
-
start:
|
198564
|
+
start: cwd2,
|
198521
198565
|
filename: `node_modules/.bin/${extensionCommand}`
|
198522
198566
|
});
|
198523
198567
|
}
|
@@ -198537,7 +198581,7 @@ async function execExtension(client2, name, args2, cwd) {
|
|
198537
198581
|
const VERCEL_API = proxyUrl.href.replace(/\/$/, "");
|
198538
198582
|
debug3(`extension proxy server listening at ${VERCEL_API}`);
|
198539
198583
|
const result = await (0, import_execa.default)(extensionPath, args2, {
|
198540
|
-
cwd,
|
198584
|
+
cwd: cwd2,
|
198541
198585
|
reject: false,
|
198542
198586
|
stdio: "inherit",
|
198543
198587
|
env: {
|
@@ -198837,10 +198881,10 @@ var main13 = async () => {
|
|
198837
198881
|
if (argv2["--cwd"]) {
|
198838
198882
|
client.cwd = argv2["--cwd"];
|
198839
198883
|
}
|
198840
|
-
const { cwd } = client;
|
198884
|
+
const { cwd: cwd2 } = client;
|
198841
198885
|
let subcommand2 = void 0;
|
198842
198886
|
if (targetOrSubcommand) {
|
198843
|
-
const targetPath = (0, import_path43.join)(
|
198887
|
+
const targetPath = (0, import_path43.join)(cwd2, targetOrSubcommand);
|
198844
198888
|
const targetPathExists = (0, import_fs9.existsSync)(targetPath);
|
198845
198889
|
const subcommandExists = GLOBAL_COMMANDS.has(targetOrSubcommand) || commands_default.has(targetOrSubcommand);
|
198846
198890
|
if (targetPathExists && subcommandExists && !argv2["--cwd"] && !process.env.NOW_BUILDER) {
|
@@ -198962,6 +199006,12 @@ var main13 = async () => {
|
|
198962
199006
|
});
|
198963
199007
|
return 1;
|
198964
199008
|
}
|
199009
|
+
if ((0, import_error_utils33.isErrnoException)(err) && err.code === "rate_limited") {
|
199010
|
+
output.prettyError({
|
199011
|
+
message: "Rate limited. Too many requests to the same endpoint: /teams"
|
199012
|
+
});
|
199013
|
+
return 1;
|
199014
|
+
}
|
198965
199015
|
console.error(error("Not able to load teams"));
|
198966
199016
|
return 1;
|
198967
199017
|
}
|
@@ -198988,7 +199038,7 @@ var main13 = async () => {
|
|
198988
199038
|
client,
|
198989
199039
|
targetCommand,
|
198990
199040
|
argv2._.slice(3),
|
198991
|
-
|
199041
|
+
cwd2
|
198992
199042
|
);
|
198993
199043
|
} catch (err) {
|
198994
199044
|
if ((0, import_error_utils33.isErrnoException)(err) && err.code === "ENOENT") {
|