@vercel/static-build 1.3.25 → 1.3.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +186 -158
- package/dist/utils/build-output-v1.js +7 -7
- package/dist/utils/build-output-v2.js +16 -12
- package/dist/utils/build-output-v3.js +4 -4
- package/dist/utils/gatsby.js +17 -13
- package/dist/utils/nuxt.js +4 -4
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -237283,7 +237283,11 @@ exports.isSpawnError = isSpawnError;
|
|
|
237283
237283
|
|
|
237284
237284
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
237285
237285
|
if (k2 === undefined) k2 = k;
|
|
237286
|
-
Object.
|
|
237286
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
237287
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
237288
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
237289
|
+
}
|
|
237290
|
+
Object.defineProperty(o, k2, desc);
|
|
237287
237291
|
}) : (function(o, m, k, k2) {
|
|
237288
237292
|
if (k2 === undefined) k2 = k;
|
|
237289
237293
|
o[k2] = m[k];
|
|
@@ -237428,7 +237432,7 @@ exports.frameworks = [
|
|
|
237428
237432
|
defaultRoutes: async (dirPrefix) => {
|
|
237429
237433
|
// This file could be generated by gatsby-plugin-now or gatsby-plugin-zeit-now
|
|
237430
237434
|
try {
|
|
237431
|
-
const nowRoutesPath = path_1.join(dirPrefix, 'public', '__now_routes_g4t5bY.json');
|
|
237435
|
+
const nowRoutesPath = (0, path_1.join)(dirPrefix, 'public', '__now_routes_g4t5bY.json');
|
|
237432
237436
|
const content = await readFile(nowRoutesPath, 'utf8');
|
|
237433
237437
|
const nowRoutes = JSON.parse(content);
|
|
237434
237438
|
try {
|
|
@@ -237663,11 +237667,11 @@ exports.frameworks = [
|
|
|
237663
237667
|
getOutputDirName: async (dirPrefix) => {
|
|
237664
237668
|
const base = 'build';
|
|
237665
237669
|
try {
|
|
237666
|
-
const location = path_1.join(dirPrefix, base);
|
|
237670
|
+
const location = (0, path_1.join)(dirPrefix, base);
|
|
237667
237671
|
const content = await readdir(location, { withFileTypes: true });
|
|
237668
237672
|
// If there is only one file in it that is a dir we'll use it as dist dir
|
|
237669
237673
|
if (content.length === 1 && content[0].isDirectory()) {
|
|
237670
|
-
return path_1.join(base, content[0].name);
|
|
237674
|
+
return (0, path_1.join)(base, content[0].name);
|
|
237671
237675
|
}
|
|
237672
237676
|
}
|
|
237673
237677
|
catch (error) {
|
|
@@ -237746,11 +237750,11 @@ exports.frameworks = [
|
|
|
237746
237750
|
getOutputDirName: async (dirPrefix) => {
|
|
237747
237751
|
const base = 'build';
|
|
237748
237752
|
try {
|
|
237749
|
-
const location = path_1.join(dirPrefix, base);
|
|
237753
|
+
const location = (0, path_1.join)(dirPrefix, base);
|
|
237750
237754
|
const content = await readdir(location, { withFileTypes: true });
|
|
237751
237755
|
// If there is only one file in it that is a dir we'll use it as dist dir
|
|
237752
237756
|
if (content.length === 1 && content[0].isDirectory()) {
|
|
237753
|
-
return path_1.join(base, content[0].name);
|
|
237757
|
+
return (0, path_1.join)(base, content[0].name);
|
|
237754
237758
|
}
|
|
237755
237759
|
}
|
|
237756
237760
|
catch (error) {
|
|
@@ -237875,7 +237879,7 @@ exports.frameworks = [
|
|
|
237875
237879
|
},
|
|
237876
237880
|
},
|
|
237877
237881
|
dependency: '@dojo/cli',
|
|
237878
|
-
getOutputDirName: async () => path_1.join('output', 'dist'),
|
|
237882
|
+
getOutputDirName: async () => (0, path_1.join)('output', 'dist'),
|
|
237879
237883
|
defaultRoutes: [
|
|
237880
237884
|
{
|
|
237881
237885
|
handle: 'filesystem',
|
|
@@ -238110,11 +238114,11 @@ exports.frameworks = [
|
|
|
238110
238114
|
getOutputDirName: async (dirPrefix) => {
|
|
238111
238115
|
const base = 'dist';
|
|
238112
238116
|
try {
|
|
238113
|
-
const location = path_1.join(dirPrefix, base);
|
|
238117
|
+
const location = (0, path_1.join)(dirPrefix, base);
|
|
238114
238118
|
const content = await readdir(location, { withFileTypes: true });
|
|
238115
238119
|
// If there is only one file in it that is a dir we'll use it as dist dir
|
|
238116
238120
|
if (content.length === 1 && content[0].isDirectory()) {
|
|
238117
|
-
return path_1.join(base, content[0].name);
|
|
238121
|
+
return (0, path_1.join)(base, content[0].name);
|
|
238118
238122
|
}
|
|
238119
238123
|
}
|
|
238120
238124
|
catch (error) {
|
|
@@ -238167,10 +238171,10 @@ exports.frameworks = [
|
|
|
238167
238171
|
getOutputDirName: async (dirPrefix) => {
|
|
238168
238172
|
const base = 'build';
|
|
238169
238173
|
try {
|
|
238170
|
-
const location = path_1.join(dirPrefix, base);
|
|
238174
|
+
const location = (0, path_1.join)(dirPrefix, base);
|
|
238171
238175
|
const content = await readdir(location);
|
|
238172
238176
|
const paths = content.filter(item => !item.includes('.'));
|
|
238173
|
-
return path_1.join(base, paths[0]);
|
|
238177
|
+
return (0, path_1.join)(base, paths[0]);
|
|
238174
238178
|
}
|
|
238175
238179
|
catch (error) {
|
|
238176
238180
|
console.error(`Error detecting output directory: `, error);
|
|
@@ -238782,8 +238786,8 @@ exports.frameworks = [
|
|
|
238782
238786
|
},
|
|
238783
238787
|
},
|
|
238784
238788
|
getOutputDirName: async (dirPrefix) => {
|
|
238785
|
-
const config = await read_config_file_1.readConfigFile(['config.json', 'config.yaml', 'config.toml'].map(fileName => {
|
|
238786
|
-
return path_1.join(dirPrefix, fileName);
|
|
238789
|
+
const config = await (0, read_config_file_1.readConfigFile)(['config.json', 'config.yaml', 'config.toml'].map(fileName => {
|
|
238790
|
+
return (0, path_1.join)(dirPrefix, fileName);
|
|
238787
238791
|
}));
|
|
238788
238792
|
return (config && config.publishDir) || 'public';
|
|
238789
238793
|
},
|
|
@@ -238821,7 +238825,7 @@ exports.frameworks = [
|
|
|
238821
238825
|
},
|
|
238822
238826
|
},
|
|
238823
238827
|
getOutputDirName: async (dirPrefix) => {
|
|
238824
|
-
const config = await read_config_file_1.readConfigFile(path_1.join(dirPrefix, '_config.yml'));
|
|
238828
|
+
const config = await (0, read_config_file_1.readConfigFile)((0, path_1.join)(dirPrefix, '_config.yml'));
|
|
238825
238829
|
return (config && config.destination) || '_site';
|
|
238826
238830
|
},
|
|
238827
238831
|
cachePattern: '{vendor/bin,vendor/cache,vendor/bundle}/**',
|
|
@@ -239213,15 +239217,19 @@ exports.readConfigFile = void 0;
|
|
|
239213
239217
|
const js_yaml_1 = __importDefault(__webpack_require__(1452));
|
|
239214
239218
|
const toml_1 = __importDefault(__webpack_require__(207));
|
|
239215
239219
|
const fs_1 = __webpack_require__(5747);
|
|
239220
|
+
const error_utils_1 = __webpack_require__(9799);
|
|
239216
239221
|
const { readFile } = fs_1.promises;
|
|
239217
239222
|
async function readFileOrNull(file) {
|
|
239218
239223
|
try {
|
|
239219
239224
|
const data = await readFile(file);
|
|
239220
239225
|
return data;
|
|
239221
239226
|
}
|
|
239222
|
-
catch (
|
|
239223
|
-
if (
|
|
239224
|
-
throw
|
|
239227
|
+
catch (error) {
|
|
239228
|
+
if (!(0, error_utils_1.isErrnoException)(error)) {
|
|
239229
|
+
throw error;
|
|
239230
|
+
}
|
|
239231
|
+
if (error.code !== 'ENOENT') {
|
|
239232
|
+
throw error;
|
|
239225
239233
|
}
|
|
239226
239234
|
}
|
|
239227
239235
|
return null;
|
|
@@ -239285,7 +239293,7 @@ exports.sortFiles = sortFiles;
|
|
|
239285
239293
|
function detectApiExtensions(builders) {
|
|
239286
239294
|
return new Set(builders
|
|
239287
239295
|
.filter((b) => Boolean(b.config && b.config.zeroConfig && b.src?.startsWith('api/')))
|
|
239288
|
-
.map(b => path_1.extname(b.src))
|
|
239296
|
+
.map(b => (0, path_1.extname)(b.src))
|
|
239289
239297
|
.filter(Boolean));
|
|
239290
239298
|
}
|
|
239291
239299
|
exports.detectApiExtensions = detectApiExtensions;
|
|
@@ -239300,7 +239308,7 @@ exports.detectApiDirectory = detectApiDirectory;
|
|
|
239300
239308
|
function getPublicBuilder(builders) {
|
|
239301
239309
|
for (const builder of builders) {
|
|
239302
239310
|
if (typeof builder.src === 'string' &&
|
|
239303
|
-
is_official_runtime_1.isOfficialRuntime('static', builder.use) &&
|
|
239311
|
+
(0, is_official_runtime_1.isOfficialRuntime)('static', builder.use) &&
|
|
239304
239312
|
/^.*\/\*\*\/\*$/.test(builder.src) &&
|
|
239305
239313
|
builder.config?.zeroConfig === true) {
|
|
239306
239314
|
return builder;
|
|
@@ -239490,7 +239498,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
|
239490
239498
|
if (frontendBuilder) {
|
|
239491
239499
|
builders.push(frontendBuilder);
|
|
239492
239500
|
if (hasNextApiFiles &&
|
|
239493
|
-
apiBuilders.some(b => is_official_runtime_1.isOfficialRuntime('node', b.use))) {
|
|
239501
|
+
apiBuilders.some(b => (0, is_official_runtime_1.isOfficialRuntime)('node', b.use))) {
|
|
239494
239502
|
warnings.push({
|
|
239495
239503
|
code: 'conflicting_files',
|
|
239496
239504
|
message: 'When using Next.js, it is recommended to place Node.js Serverless Functions inside of the `pages/api` (provided by Next.js) directory instead of `api` (provided by Vercel).',
|
|
@@ -239534,7 +239542,7 @@ function maybeGetApiBuilder(fileName, apiMatches, options) {
|
|
|
239534
239542
|
return null;
|
|
239535
239543
|
}
|
|
239536
239544
|
const match = apiMatches.find(({ src = '**' }) => {
|
|
239537
|
-
return src === fileName || minimatch_1.default(fileName, src);
|
|
239545
|
+
return src === fileName || (0, minimatch_1.default)(fileName, src);
|
|
239538
239546
|
});
|
|
239539
239547
|
const { fnPattern, func } = getFunction(fileName, options);
|
|
239540
239548
|
const use = func?.runtime || match?.use;
|
|
@@ -239566,7 +239574,7 @@ function getFunction(fileName, { functions = {} }) {
|
|
|
239566
239574
|
if (!keys.length) {
|
|
239567
239575
|
return { fnPattern: null, func: null };
|
|
239568
239576
|
}
|
|
239569
|
-
const func = keys.find(key => key === fileName || minimatch_1.default(fileName, key));
|
|
239577
|
+
const func = keys.find(key => key === fileName || (0, minimatch_1.default)(fileName, key));
|
|
239570
239578
|
return func
|
|
239571
239579
|
? { fnPattern: func, func: functions[func] }
|
|
239572
239580
|
: { fnPattern: null, func: null };
|
|
@@ -239706,7 +239714,7 @@ function validateFunctions({ functions = {} }) {
|
|
|
239706
239714
|
}
|
|
239707
239715
|
if (func.runtime !== undefined) {
|
|
239708
239716
|
const tag = `${func.runtime}`.split('@').pop();
|
|
239709
|
-
if (!tag || !semver_1.valid(tag)) {
|
|
239717
|
+
if (!tag || !(0, semver_1.valid)(tag)) {
|
|
239710
239718
|
return {
|
|
239711
239719
|
code: 'invalid_function_runtime',
|
|
239712
239720
|
message: 'Function Runtimes must have a valid version, for example `now-php@1.0.0`.',
|
|
@@ -239738,9 +239746,12 @@ function checkUnusedFunctions(frontendBuilder, usedFunctions, options) {
|
|
|
239738
239746
|
return null;
|
|
239739
239747
|
}
|
|
239740
239748
|
// Next.js can use functions only for `src/pages` or `pages`
|
|
239741
|
-
if (frontendBuilder && is_official_runtime_1.isOfficialRuntime('next', frontendBuilder.use)) {
|
|
239749
|
+
if (frontendBuilder && (0, is_official_runtime_1.isOfficialRuntime)('next', frontendBuilder.use)) {
|
|
239742
239750
|
for (const fnKey of unusedFunctions.values()) {
|
|
239743
|
-
if (fnKey.startsWith('pages/') ||
|
|
239751
|
+
if (fnKey.startsWith('pages/') ||
|
|
239752
|
+
fnKey.startsWith('src/pages') ||
|
|
239753
|
+
fnKey.startsWith('app/') ||
|
|
239754
|
+
fnKey.startsWith('src/app/')) {
|
|
239744
239755
|
unusedFunctions.delete(fnKey);
|
|
239745
239756
|
}
|
|
239746
239757
|
else {
|
|
@@ -239819,14 +239830,14 @@ function getConflictingSegment(filePath) {
|
|
|
239819
239830
|
// It will return `null` if there are no brackets
|
|
239820
239831
|
// and therefore no segment.
|
|
239821
239832
|
function getSegmentName(segment) {
|
|
239822
|
-
const { name } = path_1.parse(segment);
|
|
239833
|
+
const { name } = (0, path_1.parse)(segment);
|
|
239823
239834
|
if (name.startsWith('[') && name.endsWith(']')) {
|
|
239824
239835
|
return name.slice(1, -1);
|
|
239825
239836
|
}
|
|
239826
239837
|
return null;
|
|
239827
239838
|
}
|
|
239828
239839
|
function getAbsolutePath(unresolvedPath) {
|
|
239829
|
-
const { dir, name } = path_1.parse(unresolvedPath);
|
|
239840
|
+
const { dir, name } = (0, path_1.parse)(unresolvedPath);
|
|
239830
239841
|
const parts = joinPath(dir, name).split('/');
|
|
239831
239842
|
return parts.map(part => part.replace(/\[.*\]/, '1')).join('/');
|
|
239832
239843
|
}
|
|
@@ -239916,7 +239927,7 @@ function createRouteFromPath(filePath, featHandleMiss, cleanUrls) {
|
|
|
239916
239927
|
return `([^/]+)`;
|
|
239917
239928
|
}
|
|
239918
239929
|
else if (isLast) {
|
|
239919
|
-
const { name: fileName, ext } = path_1.parse(segment);
|
|
239930
|
+
const { name: fileName, ext } = (0, path_1.parse)(segment);
|
|
239920
239931
|
const isIndex = fileName === 'index';
|
|
239921
239932
|
const prefix = isIndex ? '/' : '';
|
|
239922
239933
|
const names = [
|
|
@@ -239933,7 +239944,7 @@ function createRouteFromPath(filePath, featHandleMiss, cleanUrls) {
|
|
|
239933
239944
|
}
|
|
239934
239945
|
return segment;
|
|
239935
239946
|
});
|
|
239936
|
-
const { name: fileName, ext } = path_1.parse(filePath);
|
|
239947
|
+
const { name: fileName, ext } = (0, path_1.parse)(filePath);
|
|
239937
239948
|
const isIndex = fileName === 'index';
|
|
239938
239949
|
const queryString = `${query.length ? '?' : ''}${query.join('&')}`;
|
|
239939
239950
|
const src = isIndex
|
|
@@ -239962,7 +239973,7 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
|
|
|
239962
239973
|
const rewriteRoutes = [];
|
|
239963
239974
|
const errorRoutes = [];
|
|
239964
239975
|
const framework = frontendBuilder?.config?.framework || '';
|
|
239965
|
-
const isNextjs = framework === 'nextjs' || is_official_runtime_1.isOfficialRuntime('next', frontendBuilder?.use);
|
|
239976
|
+
const isNextjs = framework === 'nextjs' || (0, is_official_runtime_1.isOfficialRuntime)('next', frontendBuilder?.use);
|
|
239966
239977
|
const ignoreRuntimes = slugToFramework.get(framework)?.ignoreRuntimes;
|
|
239967
239978
|
if (apiRoutes && apiRoutes.length > 0) {
|
|
239968
239979
|
if (options.featHandleMiss) {
|
|
@@ -240026,7 +240037,7 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
|
|
|
240026
240037
|
if (outputDirectory &&
|
|
240027
240038
|
frontendBuilder &&
|
|
240028
240039
|
!options.featHandleMiss &&
|
|
240029
|
-
is_official_runtime_1.isOfficialRuntime('static', frontendBuilder.use)) {
|
|
240040
|
+
(0, is_official_runtime_1.isOfficialRuntime)('static', frontendBuilder.use)) {
|
|
240030
240041
|
defaultRoutes.push({
|
|
240031
240042
|
src: '/(.*)',
|
|
240032
240043
|
dest: `/${outputDirectory}/$1`,
|
|
@@ -240142,13 +240153,13 @@ async function detectFileSystemAPI({ files, projectSettings, builders, vercelCon
|
|
|
240142
240153
|
};
|
|
240143
240154
|
}
|
|
240144
240155
|
const invalidBuilder = builders.find(({ use }) => {
|
|
240145
|
-
const valid = _1.isOfficialRuntime('go', use) ||
|
|
240146
|
-
_1.isOfficialRuntime('python', use) ||
|
|
240147
|
-
_1.isOfficialRuntime('ruby', use) ||
|
|
240148
|
-
_1.isOfficialRuntime('node', use) ||
|
|
240149
|
-
_1.isOfficialRuntime('next', use) ||
|
|
240150
|
-
_1.isOfficialRuntime('static', use) ||
|
|
240151
|
-
_1.isOfficialRuntime('static-build', use);
|
|
240156
|
+
const valid = (0, _1.isOfficialRuntime)('go', use) ||
|
|
240157
|
+
(0, _1.isOfficialRuntime)('python', use) ||
|
|
240158
|
+
(0, _1.isOfficialRuntime)('ruby', use) ||
|
|
240159
|
+
(0, _1.isOfficialRuntime)('node', use) ||
|
|
240160
|
+
(0, _1.isOfficialRuntime)('next', use) ||
|
|
240161
|
+
(0, _1.isOfficialRuntime)('static', use) ||
|
|
240162
|
+
(0, _1.isOfficialRuntime)('static-build', use);
|
|
240152
240163
|
return !valid;
|
|
240153
240164
|
});
|
|
240154
240165
|
if (invalidBuilder) {
|
|
@@ -240161,7 +240172,7 @@ async function detectFileSystemAPI({ files, projectSettings, builders, vercelCon
|
|
|
240161
240172
|
for (const lang of ['go', 'python', 'ruby']) {
|
|
240162
240173
|
for (const { use } of builders) {
|
|
240163
240174
|
const plugin = 'vercel-plugin-' + lang;
|
|
240164
|
-
if (_1.isOfficialRuntime(lang, use) && !deps[plugin]) {
|
|
240175
|
+
if ((0, _1.isOfficialRuntime)(lang, use) && !deps[plugin]) {
|
|
240165
240176
|
return {
|
|
240166
240177
|
metadata,
|
|
240167
240178
|
fsApiBuilder: null,
|
|
@@ -240227,9 +240238,9 @@ async function detectFileSystemAPI({ files, projectSettings, builders, vercelCon
|
|
|
240227
240238
|
}
|
|
240228
240239
|
}
|
|
240229
240240
|
}
|
|
240230
|
-
const frontendBuilder = builders.find(({ use }) => _1.isOfficialRuntime('next', use) ||
|
|
240231
|
-
_1.isOfficialRuntime('static', use) ||
|
|
240232
|
-
_1.isOfficialRuntime('static-build', use));
|
|
240241
|
+
const frontendBuilder = builders.find(({ use }) => (0, _1.isOfficialRuntime)('next', use) ||
|
|
240242
|
+
(0, _1.isOfficialRuntime)('static', use) ||
|
|
240243
|
+
(0, _1.isOfficialRuntime)('static-build', use));
|
|
240233
240244
|
const config = frontendBuilder?.config || {};
|
|
240234
240245
|
const withTag = tag ? `@${tag}` : '';
|
|
240235
240246
|
const fsApiBuilder = {
|
|
@@ -240378,7 +240389,7 @@ exports.detectFrameworkVersion = detectFrameworkVersion;
|
|
|
240378
240389
|
function lookupInstalledVersion(cwd, packageName) {
|
|
240379
240390
|
try {
|
|
240380
240391
|
const script = `require('${packageName}/package.json').version`;
|
|
240381
|
-
return child_process_1.spawnSync(cwd, ['-p', script], {
|
|
240392
|
+
return (0, child_process_1.spawnSync)(cwd, ['-p', script], {
|
|
240382
240393
|
encoding: 'utf-8',
|
|
240383
240394
|
}).stdout.trim();
|
|
240384
240395
|
}
|
|
@@ -240535,7 +240546,7 @@ class LocalFileSystemDetector extends filesystem_1.DetectorFilesystem {
|
|
|
240535
240546
|
return true;
|
|
240536
240547
|
}
|
|
240537
240548
|
catch (err) {
|
|
240538
|
-
if (error_utils_1.isErrnoException(err) && err.code === 'ENOENT') {
|
|
240549
|
+
if ((0, error_utils_1.isErrnoException)(err) && err.code === 'ENOENT') {
|
|
240539
240550
|
return false;
|
|
240540
240551
|
}
|
|
240541
240552
|
throw err;
|
|
@@ -240603,7 +240614,7 @@ const getProjectPaths = async ({ fs, path, skipPaths, depth = MAX_DEPTH_TRAVERSE
|
|
|
240603
240614
|
if (path && skipPaths?.includes(path)) {
|
|
240604
240615
|
return allPaths;
|
|
240605
240616
|
}
|
|
240606
|
-
const framework = await detect_framework_1.detectFramework({
|
|
240617
|
+
const framework = await (0, detect_framework_1.detectFramework)({
|
|
240607
240618
|
fs: fs.chdir(topPath),
|
|
240608
240619
|
frameworkList: frameworks_1.default,
|
|
240609
240620
|
});
|
|
@@ -240613,7 +240624,7 @@ const getProjectPaths = async ({ fs, path, skipPaths, depth = MAX_DEPTH_TRAVERSE
|
|
|
240613
240624
|
const directoryContents = await fs.readdir(topPath);
|
|
240614
240625
|
const childDirectories = directoryContents.filter(stat => stat.type === 'dir' && !skipPaths?.includes(stat.path));
|
|
240615
240626
|
const paths = (await Promise.all(childDirectories.map(({ path }) => {
|
|
240616
|
-
return exports.getProjectPaths({
|
|
240627
|
+
return (0, exports.getProjectPaths)({
|
|
240617
240628
|
fs,
|
|
240618
240629
|
path,
|
|
240619
240630
|
depth: depth - 1,
|
|
@@ -240636,7 +240647,11 @@ exports.getProjectPaths = getProjectPaths;
|
|
|
240636
240647
|
|
|
240637
240648
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
240638
240649
|
if (k2 === undefined) k2 = k;
|
|
240639
|
-
Object.
|
|
240650
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
240651
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
240652
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
240653
|
+
}
|
|
240654
|
+
Object.defineProperty(o, k2, desc);
|
|
240640
240655
|
}) : (function(o, m, k, k2) {
|
|
240641
240656
|
if (k2 === undefined) k2 = k;
|
|
240642
240657
|
o[k2] = m[k];
|
|
@@ -240705,7 +240720,7 @@ exports.isOfficialRuntime = isOfficialRuntime;
|
|
|
240705
240720
|
* Helper function to detect both `@vercel/static` and legacy `@now/static` official Runtimes.
|
|
240706
240721
|
*/
|
|
240707
240722
|
const isStaticRuntime = (name) => {
|
|
240708
|
-
return exports.isOfficialRuntime('static', name);
|
|
240723
|
+
return (0, exports.isOfficialRuntime)('static', name);
|
|
240709
240724
|
};
|
|
240710
240725
|
exports.isStaticRuntime = isStaticRuntime;
|
|
240711
240726
|
//# sourceMappingURL=is-official-runtime.js.map
|
|
@@ -240751,11 +240766,11 @@ function supportsRootCommand(turboSemVer) {
|
|
|
240751
240766
|
}
|
|
240752
240767
|
async function getMonorepoDefaultSettings(projectName, projectPath, relativeToRoot, detectorFilesystem) {
|
|
240753
240768
|
const [monorepoManager, packageManager] = await Promise.all([
|
|
240754
|
-
detect_framework_1.detectFramework({
|
|
240769
|
+
(0, detect_framework_1.detectFramework)({
|
|
240755
240770
|
fs: detectorFilesystem,
|
|
240756
240771
|
frameworkList: monorepo_managers_1.monorepoManagers,
|
|
240757
240772
|
}),
|
|
240758
|
-
detect_framework_1.detectFramework({
|
|
240773
|
+
(0, detect_framework_1.detectFramework)({
|
|
240759
240774
|
fs: detectorFilesystem,
|
|
240760
240775
|
frameworkList: package_managers_1.packageManagers,
|
|
240761
240776
|
}),
|
|
@@ -240822,10 +240837,10 @@ async function getMonorepoDefaultSettings(projectName, projectPath, relativeToRo
|
|
|
240822
240837
|
if (!nxJSON?.targetDefaults?.build) {
|
|
240823
240838
|
const [projectJSONBuf, packageJSONBuf] = await Promise.all([
|
|
240824
240839
|
detectorFilesystem
|
|
240825
|
-
.readFile(path_1.join(projectPath, 'project.json'))
|
|
240840
|
+
.readFile((0, path_1.join)(projectPath, 'project.json'))
|
|
240826
240841
|
.catch(() => null),
|
|
240827
240842
|
detectorFilesystem
|
|
240828
|
-
.readFile(path_1.join(projectPath, 'package.json'))
|
|
240843
|
+
.readFile((0, path_1.join)(projectPath, 'package.json'))
|
|
240829
240844
|
.catch(() => null),
|
|
240830
240845
|
]);
|
|
240831
240846
|
let hasBuildTarget = false;
|
|
@@ -241189,9 +241204,9 @@ const isWin = process.platform === 'win32';
|
|
|
241189
241204
|
const normalizePath = (p) => (isWin ? p.replace(/\\/g, '/') : p);
|
|
241190
241205
|
async function getPackagePaths(packages, fs) {
|
|
241191
241206
|
return (await Promise.all(packages.map(packageGlob => new Promise((resolve, reject) => {
|
|
241192
|
-
glob_1.default(normalizePath(posixPath.join(packageGlob, 'package.json')), {
|
|
241207
|
+
(0, glob_1.default)(normalizePath(posixPath.join(packageGlob, 'package.json')), {
|
|
241193
241208
|
cwd: '/',
|
|
241194
|
-
fs: get_glob_fs_1.getGlobFs(fs),
|
|
241209
|
+
fs: (0, get_glob_fs_1.getGlobFs)(fs),
|
|
241195
241210
|
}, (err, matches) => {
|
|
241196
241211
|
if (err)
|
|
241197
241212
|
reject(err);
|
|
@@ -241258,7 +241273,7 @@ const posixPath = path_1.default.posix;
|
|
|
241258
241273
|
async function getWorkspaces({ fs, depth = MAX_DEPTH_TRAVERSE, cwd = '/', }) {
|
|
241259
241274
|
if (depth === 0)
|
|
241260
241275
|
return [];
|
|
241261
|
-
const workspaceType = await detect_framework_1.detectFramework({
|
|
241276
|
+
const workspaceType = await (0, detect_framework_1.detectFramework)({
|
|
241262
241277
|
fs,
|
|
241263
241278
|
frameworkList: workspace_managers_1.workspaceManagers,
|
|
241264
241279
|
});
|
|
@@ -241421,7 +241436,7 @@ function getConfig(project, sourcePath, schema) {
|
|
|
241421
241436
|
return null;
|
|
241422
241437
|
const config = getValue(configNode);
|
|
241423
241438
|
// @ts-ignore
|
|
241424
|
-
return validation_1.validate(schema || exports.BaseFunctionConfigSchema, config);
|
|
241439
|
+
return (0, validation_1.validate)(schema || exports.BaseFunctionConfigSchema, config);
|
|
241425
241440
|
}
|
|
241426
241441
|
exports.getConfig = getConfig;
|
|
241427
241442
|
function getConfigNode(sourceFile) {
|
|
@@ -241514,6 +241529,7 @@ function validate(schema, data) {
|
|
|
241514
241529
|
// TODO: better error message
|
|
241515
241530
|
throw new Error('Invalid data');
|
|
241516
241531
|
}
|
|
241532
|
+
// @ts-expect-error - this seems to work just fine, but TS complains it could be infinite nesting
|
|
241517
241533
|
return data;
|
|
241518
241534
|
}
|
|
241519
241535
|
exports.validate = validate;
|
|
@@ -241528,7 +241544,11 @@ exports.validate = validate;
|
|
|
241528
241544
|
|
|
241529
241545
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
241530
241546
|
if (k2 === undefined) k2 = k;
|
|
241531
|
-
Object.
|
|
241547
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
241548
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
241549
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
241550
|
+
}
|
|
241551
|
+
Object.defineProperty(o, k2, desc);
|
|
241532
241552
|
}) : (function(o, m, k, k2) {
|
|
241533
241553
|
if (k2 === undefined) k2 = k;
|
|
241534
241554
|
o[k2] = m[k];
|
|
@@ -241567,21 +241587,21 @@ const NuxtUtils = __importStar(__webpack_require__(3360));
|
|
|
241567
241587
|
const tree_kill_1 = __importDefault(__webpack_require__(8384));
|
|
241568
241588
|
const fs_detectors_1 = __webpack_require__(8995);
|
|
241569
241589
|
const sleep = (n) => new Promise(resolve => setTimeout(resolve, n));
|
|
241570
|
-
const DEV_SERVER_PORT_BIND_TIMEOUT = ms_1.default('5m');
|
|
241590
|
+
const DEV_SERVER_PORT_BIND_TIMEOUT = (0, ms_1.default)('5m');
|
|
241571
241591
|
async function checkForPort(port, timeout) {
|
|
241572
241592
|
const start = Date.now();
|
|
241573
|
-
while (!(await is_port_reachable_1.default(port))) {
|
|
241593
|
+
while (!(await (0, is_port_reachable_1.default)(port))) {
|
|
241574
241594
|
if (Date.now() - start > timeout) {
|
|
241575
|
-
throw new Error(`Detecting port ${port} timed out after ${ms_1.default(timeout)}`);
|
|
241595
|
+
throw new Error(`Detecting port ${port} timed out after ${(0, ms_1.default)(timeout)}`);
|
|
241576
241596
|
}
|
|
241577
241597
|
await sleep(100);
|
|
241578
241598
|
}
|
|
241579
241599
|
}
|
|
241580
241600
|
function validateDistDir(distDir) {
|
|
241581
241601
|
const distDirName = path_1.default.basename(distDir);
|
|
241582
|
-
const exists = () => fs_1.existsSync(distDir);
|
|
241583
|
-
const isDirectory = () => fs_1.statSync(distDir).isDirectory();
|
|
241584
|
-
const isEmpty = () => fs_1.readdirSync(distDir).length === 0;
|
|
241602
|
+
const exists = () => (0, fs_1.existsSync)(distDir);
|
|
241603
|
+
const isDirectory = () => (0, fs_1.statSync)(distDir).isDirectory();
|
|
241604
|
+
const isEmpty = () => (0, fs_1.readdirSync)(distDir).length === 0;
|
|
241585
241605
|
const link = 'https://vercel.link/missing-public-directory';
|
|
241586
241606
|
if (!exists()) {
|
|
241587
241607
|
throw new build_utils_1.NowBuildError({
|
|
@@ -241660,8 +241680,8 @@ const nowDevChildProcesses = new Set();
|
|
|
241660
241680
|
['SIGINT', 'SIGTERM'].forEach(signal => {
|
|
241661
241681
|
process.once(signal, async () => {
|
|
241662
241682
|
for (const child of nowDevChildProcesses) {
|
|
241663
|
-
build_utils_1.debug(`Got ${signal}, killing dev server child process (pid=${child.pid})`);
|
|
241664
|
-
await new Promise(resolve => tree_kill_1.default(child.pid, signal, resolve));
|
|
241683
|
+
(0, build_utils_1.debug)(`Got ${signal}, killing dev server child process (pid=${child.pid})`);
|
|
241684
|
+
await new Promise(resolve => (0, tree_kill_1.default)(child.pid, signal, resolve));
|
|
241665
241685
|
}
|
|
241666
241686
|
process.exit(0);
|
|
241667
241687
|
});
|
|
@@ -241695,7 +241715,7 @@ function getPkg(entrypoint, workPath) {
|
|
|
241695
241715
|
}
|
|
241696
241716
|
try {
|
|
241697
241717
|
const pkgPath = path_1.default.join(workPath, entrypoint);
|
|
241698
|
-
const pkg = JSON.parse(fs_1.readFileSync(pkgPath, 'utf8'));
|
|
241718
|
+
const pkg = JSON.parse((0, fs_1.readFileSync)(pkgPath, 'utf8'));
|
|
241699
241719
|
return pkg;
|
|
241700
241720
|
}
|
|
241701
241721
|
catch (err) {
|
|
@@ -241723,7 +241743,7 @@ function getFramework(config, pkg) {
|
|
|
241723
241743
|
return framework;
|
|
241724
241744
|
}
|
|
241725
241745
|
async function fetchBinary(url, framework, version) {
|
|
241726
|
-
const res = await node_fetch_1.default(url);
|
|
241746
|
+
const res = await (0, node_fetch_1.default)(url);
|
|
241727
241747
|
if (res.status === 404) {
|
|
241728
241748
|
throw new build_utils_1.NowBuildError({
|
|
241729
241749
|
code: 'STATIC_BUILD_BINARY_NOT_FOUND',
|
|
@@ -241731,7 +241751,7 @@ async function fetchBinary(url, framework, version) {
|
|
|
241731
241751
|
link: 'https://vercel.link/framework-versioning',
|
|
241732
241752
|
});
|
|
241733
241753
|
}
|
|
241734
|
-
await build_utils_1.spawnAsync(`curl -sSL ${url} | tar -zx -C /usr/local/bin`, [], {
|
|
241754
|
+
await (0, build_utils_1.spawnAsync)(`curl -sSL ${url} | tar -zx -C /usr/local/bin`, [], {
|
|
241735
241755
|
shell: true,
|
|
241736
241756
|
});
|
|
241737
241757
|
}
|
|
@@ -241745,16 +241765,16 @@ async function getUpdatedDistPath(framework, outputDirPrefix, entrypointDir, dis
|
|
|
241745
241765
|
if (!config || !config.distDir) {
|
|
241746
241766
|
// Select either `dist` or `public` as directory
|
|
241747
241767
|
const publicPath = path_1.default.join(entrypointDir, 'public');
|
|
241748
|
-
if (!fs_1.existsSync(distPath) &&
|
|
241749
|
-
fs_1.existsSync(publicPath) &&
|
|
241750
|
-
fs_1.statSync(publicPath).isDirectory()) {
|
|
241768
|
+
if (!(0, fs_1.existsSync)(distPath) &&
|
|
241769
|
+
(0, fs_1.existsSync)(publicPath) &&
|
|
241770
|
+
(0, fs_1.statSync)(publicPath).isDirectory()) {
|
|
241751
241771
|
return publicPath;
|
|
241752
241772
|
}
|
|
241753
241773
|
}
|
|
241754
241774
|
return undefined;
|
|
241755
241775
|
}
|
|
241756
241776
|
const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
241757
|
-
await build_utils_1.download(files, workPath, meta);
|
|
241777
|
+
await (0, build_utils_1.download)(files, workPath, meta);
|
|
241758
241778
|
const mountpoint = path_1.default.dirname(entrypoint);
|
|
241759
241779
|
const entrypointDir = path_1.default.join(workPath, mountpoint);
|
|
241760
241780
|
let distPath = path_1.default.join(workPath, path_1.default.dirname(entrypoint), config.distDir || config.outputDirectory || 'dist');
|
|
@@ -241762,7 +241782,7 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
241762
241782
|
const devScript = pkg ? getScriptName(pkg, 'dev', config) : null;
|
|
241763
241783
|
const framework = getFramework(config, pkg);
|
|
241764
241784
|
const localFileSystemDetector = new fs_detectors_1.LocalFileSystemDetector(workPath);
|
|
241765
|
-
const { detectedVersion = null } = (await fs_detectors_1.detectFrameworkRecord({
|
|
241785
|
+
const { detectedVersion = null } = (await (0, fs_detectors_1.detectFrameworkRecord)({
|
|
241766
241786
|
fs: localFileSystemDetector,
|
|
241767
241787
|
frameworkList: frameworks_1.default,
|
|
241768
241788
|
})) ?? {};
|
|
@@ -241802,8 +241822,8 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
241802
241822
|
distPath = path_1.default.join(workPath, path_1.default.dirname(entrypoint), config.outputDirectory || 'public');
|
|
241803
241823
|
}
|
|
241804
241824
|
if (framework) {
|
|
241805
|
-
build_utils_1.debug(`Detected ${framework.name} framework. Optimizing your deployment...`);
|
|
241806
|
-
const prefixedEnvs = build_utils_1.getPrefixedEnvVars({
|
|
241825
|
+
(0, build_utils_1.debug)(`Detected ${framework.name} framework. Optimizing your deployment...`);
|
|
241826
|
+
const prefixedEnvs = (0, build_utils_1.getPrefixedEnvVars)({
|
|
241807
241827
|
envPrefix: framework.envPrefix,
|
|
241808
241828
|
envs: process.env,
|
|
241809
241829
|
});
|
|
@@ -241820,13 +241840,13 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
241820
241840
|
await NuxtUtils.injectVercelAnalyticsPlugin(frameworkDirectory);
|
|
241821
241841
|
break;
|
|
241822
241842
|
default:
|
|
241823
|
-
build_utils_1.debug(`No Web Vitals plugin injected for framework ${framework.slug}`);
|
|
241843
|
+
(0, build_utils_1.debug)(`No Web Vitals plugin injected for framework ${framework.slug}`);
|
|
241824
241844
|
break;
|
|
241825
241845
|
}
|
|
241826
241846
|
}
|
|
241827
241847
|
}
|
|
241828
|
-
const nodeVersion = await build_utils_1.getNodeVersion(entrypointDir, undefined, config, meta);
|
|
241829
|
-
const spawnOpts = build_utils_1.getSpawnOptions(meta, nodeVersion);
|
|
241848
|
+
const nodeVersion = await (0, build_utils_1.getNodeVersion)(entrypointDir, undefined, config, meta);
|
|
241849
|
+
const spawnOpts = (0, build_utils_1.getSpawnOptions)(meta, nodeVersion);
|
|
241830
241850
|
if (!spawnOpts.env) {
|
|
241831
241851
|
spawnOpts.env = {};
|
|
241832
241852
|
}
|
|
@@ -241842,15 +241862,15 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
241842
241862
|
if (framework?.slug === 'create-react-app') {
|
|
241843
241863
|
spawnOpts.env.CI = 'false';
|
|
241844
241864
|
}
|
|
241845
|
-
const { cliType, lockfileVersion } = await build_utils_1.scanParentDirs(entrypointDir);
|
|
241846
|
-
spawnOpts.env = build_utils_1.getEnvForPackageManager({
|
|
241865
|
+
const { cliType, lockfileVersion } = await (0, build_utils_1.scanParentDirs)(entrypointDir);
|
|
241866
|
+
spawnOpts.env = (0, build_utils_1.getEnvForPackageManager)({
|
|
241847
241867
|
cliType,
|
|
241848
241868
|
lockfileVersion,
|
|
241849
241869
|
nodeVersion,
|
|
241850
241870
|
env: spawnOpts.env || {},
|
|
241851
241871
|
});
|
|
241852
241872
|
if (meta.isDev) {
|
|
241853
|
-
build_utils_1.debug('Skipping dependency installation because dev mode is enabled');
|
|
241873
|
+
(0, build_utils_1.debug)('Skipping dependency installation because dev mode is enabled');
|
|
241854
241874
|
}
|
|
241855
241875
|
else {
|
|
241856
241876
|
let hasPrintedInstall = false;
|
|
@@ -241861,14 +241881,14 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
241861
241881
|
}
|
|
241862
241882
|
};
|
|
241863
241883
|
if (!config.zeroConfig) {
|
|
241864
|
-
build_utils_1.debug('Detected "builds" - not zero config');
|
|
241865
|
-
await build_utils_1.runNpmInstall(entrypointDir, [], spawnOpts, meta, nodeVersion);
|
|
241884
|
+
(0, build_utils_1.debug)('Detected "builds" - not zero config');
|
|
241885
|
+
await (0, build_utils_1.runNpmInstall)(entrypointDir, [], spawnOpts, meta, nodeVersion);
|
|
241866
241886
|
isNpmInstall = true;
|
|
241867
241887
|
}
|
|
241868
241888
|
else if (typeof installCommand === 'string') {
|
|
241869
241889
|
if (installCommand.trim()) {
|
|
241870
241890
|
console.log(`Running "install" command: \`${installCommand}\`...`);
|
|
241871
|
-
await build_utils_1.execCommand(installCommand, {
|
|
241891
|
+
await (0, build_utils_1.execCommand)(installCommand, {
|
|
241872
241892
|
...spawnOpts,
|
|
241873
241893
|
cwd: entrypointDir,
|
|
241874
241894
|
});
|
|
@@ -241882,33 +241902,33 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
241882
241902
|
}
|
|
241883
241903
|
}
|
|
241884
241904
|
else {
|
|
241885
|
-
if (fs_1.existsSync(gemfilePath)) {
|
|
241886
|
-
build_utils_1.debug('Detected Gemfile');
|
|
241905
|
+
if ((0, fs_1.existsSync)(gemfilePath)) {
|
|
241906
|
+
(0, build_utils_1.debug)('Detected Gemfile');
|
|
241887
241907
|
printInstall();
|
|
241888
241908
|
const opts = {
|
|
241889
|
-
env: build_utils_1.cloneEnv(process.env, {
|
|
241909
|
+
env: (0, build_utils_1.cloneEnv)(process.env, {
|
|
241890
241910
|
// See more: https://github.com/rubygems/rubygems/blob/a82d04856deba58be6b90f681a5e42a7c0f2baa7/bundler/lib/bundler/man/bundle-config.1.ronn
|
|
241891
241911
|
BUNDLE_BIN: 'vendor/bin',
|
|
241892
241912
|
BUNDLE_CACHE_PATH: 'vendor/cache',
|
|
241893
241913
|
BUNDLE_PATH: 'vendor/bundle',
|
|
241894
241914
|
BUNDLE_RETRY: '5',
|
|
241895
|
-
BUNDLE_JOBS: String(os_1.cpus().length || 1),
|
|
241915
|
+
BUNDLE_JOBS: String((0, os_1.cpus)().length || 1),
|
|
241896
241916
|
BUNDLE_SILENCE_ROOT_WARNING: '1',
|
|
241897
241917
|
BUNDLE_DISABLE_SHARED_GEMS: '1',
|
|
241898
241918
|
BUNDLE_DISABLE_VERSION_CHECK: '1',
|
|
241899
241919
|
}),
|
|
241900
241920
|
};
|
|
241901
|
-
await build_utils_1.runBundleInstall(workPath, [], opts, meta);
|
|
241921
|
+
await (0, build_utils_1.runBundleInstall)(workPath, [], opts, meta);
|
|
241902
241922
|
isBundleInstall = true;
|
|
241903
241923
|
}
|
|
241904
|
-
if (fs_1.existsSync(requirementsPath)) {
|
|
241905
|
-
build_utils_1.debug('Detected requirements.txt');
|
|
241924
|
+
if ((0, fs_1.existsSync)(requirementsPath)) {
|
|
241925
|
+
(0, build_utils_1.debug)('Detected requirements.txt');
|
|
241906
241926
|
printInstall();
|
|
241907
|
-
await build_utils_1.runPipInstall(workPath, ['-r', requirementsPath], undefined, meta);
|
|
241927
|
+
await (0, build_utils_1.runPipInstall)(workPath, ['-r', requirementsPath], undefined, meta);
|
|
241908
241928
|
isPipInstall = true;
|
|
241909
241929
|
}
|
|
241910
241930
|
if (pkg) {
|
|
241911
|
-
await build_utils_1.runNpmInstall(entrypointDir, [], spawnOpts, meta, nodeVersion);
|
|
241931
|
+
await (0, build_utils_1.runNpmInstall)(entrypointDir, [], spawnOpts, meta, nodeVersion);
|
|
241912
241932
|
isNpmInstall = true;
|
|
241913
241933
|
}
|
|
241914
241934
|
}
|
|
@@ -241919,21 +241939,21 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
241919
241939
|
let gemHome = undefined;
|
|
241920
241940
|
const pathList = [];
|
|
241921
241941
|
if (isNpmInstall || (pkg && (buildCommand || devCommand))) {
|
|
241922
|
-
const nodeBinPath = await build_utils_1.getNodeBinPath({ cwd: entrypointDir });
|
|
241942
|
+
const nodeBinPath = await (0, build_utils_1.getNodeBinPath)({ cwd: entrypointDir });
|
|
241923
241943
|
pathList.push(nodeBinPath); // Add `./node_modules/.bin`
|
|
241924
|
-
build_utils_1.debug(`Added "${nodeBinPath}" to PATH env because a package.json file was found`);
|
|
241944
|
+
(0, build_utils_1.debug)(`Added "${nodeBinPath}" to PATH env because a package.json file was found`);
|
|
241925
241945
|
}
|
|
241926
241946
|
if (isBundleInstall) {
|
|
241927
241947
|
const vendorBin = path_1.default.join(workPath, 'vendor', 'bin');
|
|
241928
241948
|
pathList.push(vendorBin); // Add `./vendor/bin`
|
|
241929
|
-
build_utils_1.debug(`Added "${vendorBin}" to PATH env because a Gemfile was found`);
|
|
241949
|
+
(0, build_utils_1.debug)(`Added "${vendorBin}" to PATH env because a Gemfile was found`);
|
|
241930
241950
|
const dir = path_1.default.join(workPath, 'vendor', 'bundle', 'ruby');
|
|
241931
|
-
const rubyVersion = fs_1.existsSync(dir) && fs_1.statSync(dir).isDirectory()
|
|
241932
|
-
? fs_1.readdirSync(dir)[0]
|
|
241951
|
+
const rubyVersion = (0, fs_1.existsSync)(dir) && (0, fs_1.statSync)(dir).isDirectory()
|
|
241952
|
+
? (0, fs_1.readdirSync)(dir)[0]
|
|
241933
241953
|
: '';
|
|
241934
241954
|
if (rubyVersion) {
|
|
241935
241955
|
gemHome = path_1.default.join(dir, rubyVersion); // Add `./vendor/bundle/ruby/2.7.0`
|
|
241936
|
-
build_utils_1.debug(`Set GEM_HOME="${gemHome}" because a Gemfile was found`);
|
|
241956
|
+
(0, build_utils_1.debug)(`Set GEM_HOME="${gemHome}" because a Gemfile was found`);
|
|
241937
241957
|
}
|
|
241938
241958
|
}
|
|
241939
241959
|
if (isPipInstall) {
|
|
@@ -241953,12 +241973,12 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
241953
241973
|
(pkg && devScript && pkg.scripts && pkg.scripts[devScript]))) {
|
|
241954
241974
|
let devPort = nowDevScriptPorts.get(entrypoint);
|
|
241955
241975
|
if (typeof devPort === 'number') {
|
|
241956
|
-
build_utils_1.debug('`%s` server already running for %j', devCommand || devScript, entrypoint);
|
|
241976
|
+
(0, build_utils_1.debug)('`%s` server already running for %j', devCommand || devScript, entrypoint);
|
|
241957
241977
|
}
|
|
241958
241978
|
else {
|
|
241959
241979
|
// Run the `now-dev` or `dev` script out-of-bounds, since it is assumed that
|
|
241960
241980
|
// it will launch a dev server that never "completes"
|
|
241961
|
-
devPort = await get_port_1.default();
|
|
241981
|
+
devPort = await (0, get_port_1.default)();
|
|
241962
241982
|
nowDevScriptPorts.set(entrypoint, devPort);
|
|
241963
241983
|
const opts = {
|
|
241964
241984
|
cwd: entrypointDir,
|
|
@@ -241966,7 +241986,7 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
241966
241986
|
env: { ...spawnOpts.env, PORT: String(devPort) },
|
|
241967
241987
|
};
|
|
241968
241988
|
const cmd = devCommand || `yarn run ${devScript}`;
|
|
241969
|
-
const child = build_utils_1.spawnCommand(cmd, opts);
|
|
241989
|
+
const child = (0, build_utils_1.spawnCommand)(cmd, opts);
|
|
241970
241990
|
child.on('close', () => nowDevScriptPorts.delete(entrypoint));
|
|
241971
241991
|
nowDevChildProcesses.add(child);
|
|
241972
241992
|
// Wait for the server to have listened on `$PORT`, after which we
|
|
@@ -241978,7 +241998,7 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
241978
241998
|
catch (err) {
|
|
241979
241999
|
throw new Error(`Failed to detect a server running on port ${devPort}.\nDetails: https://err.sh/vercel/vercel/now-static-build-failed-to-detect-a-server`);
|
|
241980
242000
|
}
|
|
241981
|
-
build_utils_1.debug('Detected dev server for %j', entrypoint);
|
|
242001
|
+
(0, build_utils_1.debug)('Detected dev server for %j', entrypoint);
|
|
241982
242002
|
}
|
|
241983
242003
|
let srcBase = mountpoint.replace(/^\.\/?/, '');
|
|
241984
242004
|
if (srcBase.length > 0) {
|
|
@@ -241994,14 +242014,14 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
241994
242014
|
}
|
|
241995
242015
|
else {
|
|
241996
242016
|
if (meta.isDev) {
|
|
241997
|
-
build_utils_1.debug(`WARN: A dev script is missing`);
|
|
242017
|
+
(0, build_utils_1.debug)(`WARN: A dev script is missing`);
|
|
241998
242018
|
}
|
|
241999
242019
|
if (buildCommand) {
|
|
242000
|
-
build_utils_1.debug(`Executing "${buildCommand}"`);
|
|
242020
|
+
(0, build_utils_1.debug)(`Executing "${buildCommand}"`);
|
|
242001
242021
|
}
|
|
242002
242022
|
try {
|
|
242003
242023
|
const found = typeof buildCommand === 'string'
|
|
242004
|
-
? await build_utils_1.execCommand(buildCommand, {
|
|
242024
|
+
? await (0, build_utils_1.execCommand)(buildCommand, {
|
|
242005
242025
|
...spawnOpts,
|
|
242006
242026
|
// Yarn v2 PnP mode may be activated, so force
|
|
242007
242027
|
// "node-modules" linker style
|
|
@@ -242011,7 +242031,7 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
242011
242031
|
},
|
|
242012
242032
|
cwd: entrypointDir,
|
|
242013
242033
|
})
|
|
242014
|
-
: await build_utils_1.runPackageJsonScript(entrypointDir, ['vercel-build', 'now-build', 'build'], spawnOpts);
|
|
242034
|
+
: await (0, build_utils_1.runPackageJsonScript)(entrypointDir, ['vercel-build', 'now-build', 'build'], spawnOpts);
|
|
242015
242035
|
if (!found) {
|
|
242016
242036
|
throw new Error(`Missing required "${buildCommand || 'vercel-build'}" script in "${entrypoint}"`);
|
|
242017
242037
|
}
|
|
@@ -242072,21 +242092,21 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
242072
242092
|
'package.json',
|
|
242073
242093
|
'.vercel_build_output',
|
|
242074
242094
|
];
|
|
242075
|
-
build_utils_1.debug(`Using ignore: ${JSON.stringify(ignore)}`);
|
|
242095
|
+
(0, build_utils_1.debug)(`Using ignore: ${JSON.stringify(ignore)}`);
|
|
242076
242096
|
}
|
|
242077
|
-
output = await build_utils_1.glob('**', { cwd: distPath, ignore }, mountpoint);
|
|
242097
|
+
output = await (0, build_utils_1.glob)('**', { cwd: distPath, ignore }, mountpoint);
|
|
242078
242098
|
Object.assign(output, extraOutputs.functions);
|
|
242079
242099
|
}
|
|
242080
242100
|
}
|
|
242081
242101
|
return { routes, images, output };
|
|
242082
242102
|
}
|
|
242083
242103
|
if (!config.zeroConfig && entrypoint.endsWith('.sh')) {
|
|
242084
|
-
build_utils_1.debug(`Running build script "${entrypoint}"`);
|
|
242085
|
-
const nodeVersion = await build_utils_1.getNodeVersion(entrypointDir, undefined, config, meta);
|
|
242086
|
-
const spawnOpts = build_utils_1.getSpawnOptions(meta, nodeVersion);
|
|
242087
|
-
await build_utils_1.runShellScript(path_1.default.join(workPath, entrypoint), [], spawnOpts);
|
|
242104
|
+
(0, build_utils_1.debug)(`Running build script "${entrypoint}"`);
|
|
242105
|
+
const nodeVersion = await (0, build_utils_1.getNodeVersion)(entrypointDir, undefined, config, meta);
|
|
242106
|
+
const spawnOpts = (0, build_utils_1.getSpawnOptions)(meta, nodeVersion);
|
|
242107
|
+
await (0, build_utils_1.runShellScript)(path_1.default.join(workPath, entrypoint), [], spawnOpts);
|
|
242088
242108
|
validateDistDir(distPath);
|
|
242089
|
-
const output = await build_utils_1.glob('**', distPath, mountpoint);
|
|
242109
|
+
const output = await (0, build_utils_1.glob)('**', distPath, mountpoint);
|
|
242090
242110
|
return {
|
|
242091
242111
|
output,
|
|
242092
242112
|
routes: [],
|
|
@@ -242105,7 +242125,7 @@ const prepareCache = async ({ entrypoint, repoRootPath, workPath, config, }) =>
|
|
|
242105
242125
|
const configV3 = await BuildOutputV3.readConfig(workPath);
|
|
242106
242126
|
if (configV3?.cache && Array.isArray(configV3.cache)) {
|
|
242107
242127
|
for (const cacheGlob of configV3.cache) {
|
|
242108
|
-
Object.assign(cacheFiles, await build_utils_1.glob(cacheGlob, workPath));
|
|
242128
|
+
Object.assign(cacheFiles, await (0, build_utils_1.glob)(cacheGlob, workPath));
|
|
242109
242129
|
}
|
|
242110
242130
|
return cacheFiles;
|
|
242111
242131
|
}
|
|
@@ -242116,17 +242136,17 @@ const prepareCache = async ({ entrypoint, repoRootPath, workPath, config, }) =>
|
|
|
242116
242136
|
});
|
|
242117
242137
|
if (buildConfigV1?.cache && Array.isArray(buildConfigV1.cache)) {
|
|
242118
242138
|
for (const cacheGlob of buildConfigV1.cache) {
|
|
242119
|
-
Object.assign(cacheFiles, await build_utils_1.glob(cacheGlob, workPath));
|
|
242139
|
+
Object.assign(cacheFiles, await (0, build_utils_1.glob)(cacheGlob, workPath));
|
|
242120
242140
|
}
|
|
242121
242141
|
return cacheFiles;
|
|
242122
242142
|
}
|
|
242123
242143
|
// Default cache files
|
|
242124
|
-
Object.assign(cacheFiles, await build_utils_1.glob('**/{.shadow-cljs,node_modules}/**', repoRootPath || workPath));
|
|
242144
|
+
Object.assign(cacheFiles, await (0, build_utils_1.glob)('**/{.shadow-cljs,node_modules}/**', repoRootPath || workPath));
|
|
242125
242145
|
// Framework cache files
|
|
242126
242146
|
const pkg = getPkg(entrypoint, workPath);
|
|
242127
242147
|
const framework = getFramework(config, pkg);
|
|
242128
242148
|
if (framework?.cachePattern) {
|
|
242129
|
-
Object.assign(cacheFiles, await build_utils_1.glob(framework.cachePattern, workPath));
|
|
242149
|
+
Object.assign(cacheFiles, await (0, build_utils_1.glob)(framework.cachePattern, workPath));
|
|
242130
242150
|
}
|
|
242131
242151
|
return cacheFiles;
|
|
242132
242152
|
};
|
|
@@ -242221,8 +242241,8 @@ async function readBuildOutputDirectory({ workPath, nodeVersion, }) {
|
|
|
242221
242241
|
configFileName: 'build.json',
|
|
242222
242242
|
});
|
|
242223
242243
|
const outputs = {
|
|
242224
|
-
staticFiles: _shared_1.isObjectEmpty(staticFiles) ? null : staticFiles,
|
|
242225
|
-
functions: _shared_1.isObjectEmpty(functions) ? null : functions,
|
|
242244
|
+
staticFiles: (0, _shared_1.isObjectEmpty)(staticFiles) ? null : staticFiles,
|
|
242245
|
+
functions: (0, _shared_1.isObjectEmpty)(functions) ? null : functions,
|
|
242226
242246
|
routes: routes.length ? routes : null,
|
|
242227
242247
|
images,
|
|
242228
242248
|
build,
|
|
@@ -242247,7 +242267,7 @@ async function readBuildOutputDirectory({ workPath, nodeVersion, }) {
|
|
|
242247
242267
|
exports.readBuildOutputDirectory = readBuildOutputDirectory;
|
|
242248
242268
|
async function readStaticFiles({ workPath, }) {
|
|
242249
242269
|
const staticFilePath = path_1.default.join(workPath, VERCEL_BUILD_OUTPUT, 'static');
|
|
242250
|
-
const staticFiles = await build_utils_1.glob('**', {
|
|
242270
|
+
const staticFiles = await (0, build_utils_1.glob)('**', {
|
|
242251
242271
|
cwd: staticFilePath,
|
|
242252
242272
|
});
|
|
242253
242273
|
return staticFiles;
|
|
@@ -242257,12 +242277,12 @@ async function readFunctions({ workPath, functionsMountPath, nodeVersion, }) {
|
|
|
242257
242277
|
const functionsConfig = await readFunctionsConfig({ workPath });
|
|
242258
242278
|
// Find all entrypoints and create a Lambda for each of them.
|
|
242259
242279
|
let functionsPath = path_1.default.join(workPath, VERCEL_BUILD_OUTPUT, 'functions');
|
|
242260
|
-
let functionEntrypoints = await build_utils_1.glob('*/index{,.*}', { cwd: functionsPath });
|
|
242280
|
+
let functionEntrypoints = await (0, build_utils_1.glob)('*/index{,.*}', { cwd: functionsPath });
|
|
242261
242281
|
let isLegacyFunctions = false;
|
|
242262
242282
|
// To not break existing projects, we have to keep supporting the `functions/node` folder.
|
|
242263
242283
|
if (!Object.keys(functionEntrypoints).length) {
|
|
242264
242284
|
functionsPath = path_1.default.join(functionsPath, 'node');
|
|
242265
|
-
functionEntrypoints = await build_utils_1.glob('*/index.{js,mjs}', {
|
|
242285
|
+
functionEntrypoints = await (0, build_utils_1.glob)('*/index.{js,mjs}', {
|
|
242266
242286
|
cwd: functionsPath,
|
|
242267
242287
|
});
|
|
242268
242288
|
isLegacyFunctions = true;
|
|
@@ -242272,7 +242292,7 @@ async function readFunctions({ workPath, functionsMountPath, nodeVersion, }) {
|
|
|
242272
242292
|
const functionName = path_1.default.dirname(entrypointFile);
|
|
242273
242293
|
const lambdaConfig = functionsConfig.get(functionName) || {};
|
|
242274
242294
|
const { runtime, handler, ...config } = lambdaConfig;
|
|
242275
|
-
const lambdaFiles = await build_utils_1.glob('**', {
|
|
242295
|
+
const lambdaFiles = await (0, build_utils_1.glob)('**', {
|
|
242276
242296
|
cwd: path_1.default.join(functionsPath, functionName),
|
|
242277
242297
|
});
|
|
242278
242298
|
if (!lambdaConfig.runtime && isLegacyFunctions) {
|
|
@@ -242310,7 +242330,7 @@ async function readFunctions({ workPath, functionsMountPath, nodeVersion, }) {
|
|
|
242310
242330
|
? path_1.default.join(functionsMountPath, parsed.dir, parsed.name)
|
|
242311
242331
|
: path_1.default.join(functionsMountPath, functionName);
|
|
242312
242332
|
output[newPath] = lambda;
|
|
242313
|
-
build_utils_1.debug(`Created Lambda "${newPath}" from "${path_1.default.join(functionsPath, entrypointFile)}".`);
|
|
242333
|
+
(0, build_utils_1.debug)(`Created Lambda "${newPath}" from "${path_1.default.join(functionsPath, entrypointFile)}".`);
|
|
242314
242334
|
}
|
|
242315
242335
|
return output;
|
|
242316
242336
|
}
|
|
@@ -242400,6 +242420,7 @@ const build_utils_1 = __webpack_require__(3445);
|
|
|
242400
242420
|
const _shared_1 = __webpack_require__(54);
|
|
242401
242421
|
const ts_morph_1 = __webpack_require__(3817);
|
|
242402
242422
|
const static_config_1 = __webpack_require__(6199);
|
|
242423
|
+
const error_utils_1 = __webpack_require__(9799);
|
|
242403
242424
|
const BUILD_OUTPUT_DIR = '.output';
|
|
242404
242425
|
const BRIDGE_MIDDLEWARE_V2_TO_V3 = `
|
|
242405
242426
|
|
|
@@ -242426,7 +242447,7 @@ async function getBuildOutputDirectory(workingDir) {
|
|
|
242426
242447
|
const outputDir = path_1.default.join(workingDir, BUILD_OUTPUT_DIR);
|
|
242427
242448
|
// check for one of several config files
|
|
242428
242449
|
const finderPromises = CONFIG_FILES.map(configFile => {
|
|
242429
|
-
return fs_extra_1.pathExists(path_1.default.join(outputDir, configFile));
|
|
242450
|
+
return (0, fs_extra_1.pathExists)(path_1.default.join(outputDir, configFile));
|
|
242430
242451
|
});
|
|
242431
242452
|
const finders = await Promise.all(finderPromises);
|
|
242432
242453
|
if (finders.some(found => found)) {
|
|
@@ -242457,7 +242478,7 @@ async function readBuildOutputDirectory({ workPath, }) {
|
|
|
242457
242478
|
regions: (() => {
|
|
242458
242479
|
try {
|
|
242459
242480
|
const project = new ts_morph_1.Project();
|
|
242460
|
-
const config = static_config_1.getConfig(project, middleware.file.fsPath);
|
|
242481
|
+
const config = (0, static_config_1.getConfig)(project, middleware.file.fsPath);
|
|
242461
242482
|
return config?.regions;
|
|
242462
242483
|
}
|
|
242463
242484
|
catch (err) {
|
|
@@ -242468,18 +242489,18 @@ async function readBuildOutputDirectory({ workPath, }) {
|
|
|
242468
242489
|
}
|
|
242469
242490
|
const staticFiles = await readStaticFiles({ workPath });
|
|
242470
242491
|
const outputs = {
|
|
242471
|
-
staticFiles: _shared_1.isObjectEmpty(staticFiles) ? null : staticFiles,
|
|
242472
|
-
functions: _shared_1.isObjectEmpty(functions) ? null : functions,
|
|
242492
|
+
staticFiles: (0, _shared_1.isObjectEmpty)(staticFiles) ? null : staticFiles,
|
|
242493
|
+
functions: (0, _shared_1.isObjectEmpty)(functions) ? null : functions,
|
|
242473
242494
|
routes: routes.length ? routes : null,
|
|
242474
242495
|
};
|
|
242475
242496
|
if (outputs.functions) {
|
|
242476
|
-
build_utils_1.debug(`Detected Serverless Functions in "${BUILD_OUTPUT_DIR}"`);
|
|
242497
|
+
(0, build_utils_1.debug)(`Detected Serverless Functions in "${BUILD_OUTPUT_DIR}"`);
|
|
242477
242498
|
}
|
|
242478
242499
|
if (outputs.staticFiles) {
|
|
242479
|
-
build_utils_1.debug(`Detected Static Assets in "${BUILD_OUTPUT_DIR}"`);
|
|
242500
|
+
(0, build_utils_1.debug)(`Detected Static Assets in "${BUILD_OUTPUT_DIR}"`);
|
|
242480
242501
|
}
|
|
242481
242502
|
if (outputs.routes) {
|
|
242482
|
-
build_utils_1.debug(`Detected Routes Configuration in "${BUILD_OUTPUT_DIR}"`);
|
|
242503
|
+
(0, build_utils_1.debug)(`Detected Routes Configuration in "${BUILD_OUTPUT_DIR}"`);
|
|
242483
242504
|
}
|
|
242484
242505
|
return outputs;
|
|
242485
242506
|
}
|
|
@@ -242487,19 +242508,22 @@ exports.readBuildOutputDirectory = readBuildOutputDirectory;
|
|
|
242487
242508
|
async function getMiddleware(workPath) {
|
|
242488
242509
|
const manifestPath = path_1.default.join(workPath, BUILD_OUTPUT_DIR, 'functions-manifest.json');
|
|
242489
242510
|
try {
|
|
242490
|
-
const manifest = await fs_extra_1.readJson(manifestPath);
|
|
242511
|
+
const manifest = await (0, fs_extra_1.readJson)(manifestPath);
|
|
242491
242512
|
if (manifest.pages['_middleware.js'].runtime !== 'web') {
|
|
242492
242513
|
return;
|
|
242493
242514
|
}
|
|
242494
242515
|
}
|
|
242495
242516
|
catch (error) {
|
|
242496
|
-
if (error
|
|
242517
|
+
if (!(0, error_utils_1.isErrnoException)(error)) {
|
|
242497
242518
|
throw error;
|
|
242498
|
-
|
|
242519
|
+
}
|
|
242520
|
+
if (error.code !== 'ENOENT') {
|
|
242521
|
+
throw error;
|
|
242522
|
+
}
|
|
242499
242523
|
}
|
|
242500
242524
|
const middlewareRelativePath = path_1.default.join(BUILD_OUTPUT_DIR, 'server/pages/_middleware.js');
|
|
242501
242525
|
const middlewareAbsoluatePath = path_1.default.join(workPath, middlewareRelativePath);
|
|
242502
|
-
await fs_extra_1.appendFile(middlewareAbsoluatePath, BRIDGE_MIDDLEWARE_V2_TO_V3);
|
|
242526
|
+
await (0, fs_extra_1.appendFile)(middlewareAbsoluatePath, BRIDGE_MIDDLEWARE_V2_TO_V3);
|
|
242503
242527
|
const route = {
|
|
242504
242528
|
src: '/(.*)',
|
|
242505
242529
|
middlewarePath: 'middleware',
|
|
@@ -242514,7 +242538,7 @@ async function getMiddleware(workPath) {
|
|
|
242514
242538
|
}
|
|
242515
242539
|
async function readStaticFiles({ workPath, }) {
|
|
242516
242540
|
const staticFilePath = path_1.default.join(workPath, BUILD_OUTPUT_DIR, 'static');
|
|
242517
|
-
const staticFiles = await build_utils_1.glob('**', {
|
|
242541
|
+
const staticFiles = await (0, build_utils_1.glob)('**', {
|
|
242518
242542
|
cwd: staticFilePath,
|
|
242519
242543
|
});
|
|
242520
242544
|
return staticFiles;
|
|
@@ -242555,8 +242579,8 @@ const BUILD_OUTPUT_DIR = '.vercel/output';
|
|
|
242555
242579
|
*/
|
|
242556
242580
|
async function getBuildOutputDirectory(path) {
|
|
242557
242581
|
try {
|
|
242558
|
-
const outputDir = path_1.join(path, BUILD_OUTPUT_DIR);
|
|
242559
|
-
const configPath = path_1.join(outputDir, 'config.json');
|
|
242582
|
+
const outputDir = (0, path_1.join)(path, BUILD_OUTPUT_DIR);
|
|
242583
|
+
const configPath = (0, path_1.join)(outputDir, 'config.json');
|
|
242560
242584
|
await fs_1.promises.stat(configPath);
|
|
242561
242585
|
return outputDir;
|
|
242562
242586
|
}
|
|
@@ -242569,8 +242593,8 @@ async function getBuildOutputDirectory(path) {
|
|
|
242569
242593
|
exports.getBuildOutputDirectory = getBuildOutputDirectory;
|
|
242570
242594
|
async function readConfig(path) {
|
|
242571
242595
|
try {
|
|
242572
|
-
const outputDir = path_1.join(path, BUILD_OUTPUT_DIR);
|
|
242573
|
-
const configPath = path_1.join(outputDir, 'config.json');
|
|
242596
|
+
const outputDir = (0, path_1.join)(path, BUILD_OUTPUT_DIR);
|
|
242597
|
+
const configPath = (0, path_1.join)(outputDir, 'config.json');
|
|
242574
242598
|
return JSON.parse(await fs_1.promises.readFile(configPath, 'utf8'));
|
|
242575
242599
|
}
|
|
242576
242600
|
catch (err) {
|
|
@@ -242608,7 +242632,11 @@ exports.createBuildOutput = createBuildOutput;
|
|
|
242608
242632
|
|
|
242609
242633
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
242610
242634
|
if (k2 === undefined) k2 = k;
|
|
242611
|
-
Object.
|
|
242635
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
242636
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
242637
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
242638
|
+
}
|
|
242639
|
+
Object.defineProperty(o, k2, desc);
|
|
242612
242640
|
}) : (function(o, m, k, k2) {
|
|
242613
242641
|
if (k2 === undefined) k2 = k;
|
|
242614
242642
|
o[k2] = m[k];
|
|
@@ -242681,13 +242709,13 @@ async function updateGatsbyConfig(dir, plugins) {
|
|
|
242681
242709
|
const gatsbyConfigPathTs = path.join(dir, `${GATSBY_CONFIG_FILE}.ts`);
|
|
242682
242710
|
const gatsbyConfigPathMjs = path.join(dir, `${GATSBY_CONFIG_FILE}.mjs`);
|
|
242683
242711
|
const gatsbyConfigPathJs = path.join(dir, `${GATSBY_CONFIG_FILE}.js`);
|
|
242684
|
-
if (await _shared_1.fileExists(gatsbyConfigPathTs)) {
|
|
242712
|
+
if (await (0, _shared_1.fileExists)(gatsbyConfigPathTs)) {
|
|
242685
242713
|
await updateGatsbyConfigTs(gatsbyConfigPathTs, plugins);
|
|
242686
242714
|
}
|
|
242687
|
-
else if (await _shared_1.fileExists(gatsbyConfigPathMjs)) {
|
|
242715
|
+
else if (await (0, _shared_1.fileExists)(gatsbyConfigPathMjs)) {
|
|
242688
242716
|
await updateGatsbyConfigMjs(gatsbyConfigPathMjs, plugins);
|
|
242689
242717
|
}
|
|
242690
|
-
else if (await _shared_1.fileExists(gatsbyConfigPathJs)) {
|
|
242718
|
+
else if (await (0, _shared_1.fileExists)(gatsbyConfigPathJs)) {
|
|
242691
242719
|
await updateGatsbyConfigJs(gatsbyConfigPathJs, plugins);
|
|
242692
242720
|
}
|
|
242693
242721
|
else {
|
|
@@ -242698,7 +242726,7 @@ module.exports = ${JSON.stringify({ plugins })}`);
|
|
|
242698
242726
|
const GENERATED_FILE_COMMENT = `// This file was generated by @vercel/static-build`;
|
|
242699
242727
|
async function updateGatsbyConfigTs(configPath, plugins) {
|
|
242700
242728
|
const renamedPath = `${configPath}.__vercel_builder_backup__.ts`;
|
|
242701
|
-
if (!(await _shared_1.fileExists(renamedPath))) {
|
|
242729
|
+
if (!(await (0, _shared_1.fileExists)(renamedPath))) {
|
|
242702
242730
|
await fs_extra_1.default.rename(configPath, renamedPath);
|
|
242703
242731
|
}
|
|
242704
242732
|
await fs_extra_1.default.writeFile(configPath, `${GENERATED_FILE_COMMENT}
|
|
@@ -242733,7 +242761,7 @@ export default vercelConfig;
|
|
|
242733
242761
|
}
|
|
242734
242762
|
async function updateGatsbyConfigMjs(configPath, plugins) {
|
|
242735
242763
|
const renamedPath = `${configPath}.__vercel_builder_backup__.mjs`;
|
|
242736
|
-
if (!(await _shared_1.fileExists(renamedPath))) {
|
|
242764
|
+
if (!(await (0, _shared_1.fileExists)(renamedPath))) {
|
|
242737
242765
|
await fs_extra_1.default.rename(configPath, renamedPath);
|
|
242738
242766
|
}
|
|
242739
242767
|
await fs_extra_1.default.writeFile(configPath, `${GENERATED_FILE_COMMENT}
|
|
@@ -242766,7 +242794,7 @@ export default vercelConfig;
|
|
|
242766
242794
|
}
|
|
242767
242795
|
async function updateGatsbyConfigJs(configPath, plugins) {
|
|
242768
242796
|
const renamedPath = `${configPath}.__vercel_builder_backup__.js`;
|
|
242769
|
-
if (!(await _shared_1.fileExists(renamedPath))) {
|
|
242797
|
+
if (!(await (0, _shared_1.fileExists)(renamedPath))) {
|
|
242770
242798
|
await fs_extra_1.default.rename(configPath, renamedPath);
|
|
242771
242799
|
}
|
|
242772
242800
|
await fs_extra_1.default.writeFile(configPath, `${GENERATED_FILE_COMMENT}
|
|
@@ -242800,13 +242828,13 @@ async function updateGatsbyNode(dir) {
|
|
|
242800
242828
|
const gatsbyNodePathTs = path.join(dir, `${GATSBY_NODE_FILE}.ts`);
|
|
242801
242829
|
const gatsbyNodePathMjs = path.join(dir, `${GATSBY_NODE_FILE}.mjs`);
|
|
242802
242830
|
const gatsbyNodePathJs = path.join(dir, `${GATSBY_NODE_FILE}.js`);
|
|
242803
|
-
if (await _shared_1.fileExists(gatsbyNodePathTs)) {
|
|
242831
|
+
if (await (0, _shared_1.fileExists)(gatsbyNodePathTs)) {
|
|
242804
242832
|
await updateGatsbyNodeTs(gatsbyNodePathTs);
|
|
242805
242833
|
}
|
|
242806
|
-
else if (await _shared_1.fileExists(gatsbyNodePathMjs)) {
|
|
242834
|
+
else if (await (0, _shared_1.fileExists)(gatsbyNodePathMjs)) {
|
|
242807
242835
|
await updateGatsbyNodeMjs(gatsbyNodePathMjs);
|
|
242808
242836
|
}
|
|
242809
|
-
else if (await _shared_1.fileExists(gatsbyNodePathJs)) {
|
|
242837
|
+
else if (await (0, _shared_1.fileExists)(gatsbyNodePathJs)) {
|
|
242810
242838
|
await updateGatsbyNodeJs(gatsbyNodePathJs);
|
|
242811
242839
|
}
|
|
242812
242840
|
else {
|
|
@@ -242816,7 +242844,7 @@ module.exports = require('@vercel/gatsby-plugin-vercel-builder/gatsby-node.js');
|
|
|
242816
242844
|
}
|
|
242817
242845
|
async function updateGatsbyNodeTs(configPath) {
|
|
242818
242846
|
const renamedPath = `${configPath}.__vercel_builder_backup__.ts`;
|
|
242819
|
-
if (!(await _shared_1.fileExists(renamedPath))) {
|
|
242847
|
+
if (!(await (0, _shared_1.fileExists)(renamedPath))) {
|
|
242820
242848
|
await fs_extra_1.default.rename(configPath, renamedPath);
|
|
242821
242849
|
}
|
|
242822
242850
|
await fs_extra_1.default.writeFile(configPath, `${GENERATED_FILE_COMMENT}
|
|
@@ -242836,7 +242864,7 @@ export const onPostBuild: GatsbyNode['onPostBuild'] = async (args, options) => {
|
|
|
242836
242864
|
}
|
|
242837
242865
|
async function updateGatsbyNodeMjs(configPath) {
|
|
242838
242866
|
const renamedPath = `${configPath}.__vercel_builder_backup__.mjs`;
|
|
242839
|
-
if (!(await _shared_1.fileExists(renamedPath))) {
|
|
242867
|
+
if (!(await (0, _shared_1.fileExists)(renamedPath))) {
|
|
242840
242868
|
await fs_extra_1.default.rename(configPath, renamedPath);
|
|
242841
242869
|
}
|
|
242842
242870
|
await fs_extra_1.default.writeFile(configPath, `${GENERATED_FILE_COMMENT}
|
|
@@ -242855,7 +242883,7 @@ export const onPostBuild = async (args, options) => {
|
|
|
242855
242883
|
}
|
|
242856
242884
|
async function updateGatsbyNodeJs(configPath) {
|
|
242857
242885
|
const renamedPath = `${configPath}.__vercel_builder_backup__.js`;
|
|
242858
|
-
if (!(await _shared_1.fileExists(renamedPath))) {
|
|
242886
|
+
if (!(await (0, _shared_1.fileExists)(renamedPath))) {
|
|
242859
242887
|
await fs_extra_1.default.rename(configPath, renamedPath);
|
|
242860
242888
|
}
|
|
242861
242889
|
await fs_extra_1.default.writeFile(configPath, `${GENERATED_FILE_COMMENT}
|
|
@@ -242924,23 +242952,23 @@ const ANALYTICS_PLUGIN_PACKAGE = '@nuxtjs/web-vitals';
|
|
|
242924
242952
|
async function injectVercelAnalyticsPlugin(dir) {
|
|
242925
242953
|
// First update the `.nuxtrc` file to inject the Speed Insights (formerly Analytics) plugin.
|
|
242926
242954
|
// See: https://gist.github.com/pi0/23b5253ac19b4ed5a70add3b971545c9
|
|
242927
|
-
const nuxtrcPath = path_1.join(dir, '.nuxtrc');
|
|
242955
|
+
const nuxtrcPath = (0, path_1.join)(dir, '.nuxtrc');
|
|
242928
242956
|
console.log(`Injecting Nuxt.js Speed Insights plugin "${ANALYTICS_PLUGIN_PACKAGE}" to \`${nuxtrcPath}\``);
|
|
242929
|
-
rc9_1.update({
|
|
242957
|
+
(0, rc9_1.update)({
|
|
242930
242958
|
'modules[]': ANALYTICS_PLUGIN_PACKAGE,
|
|
242931
242959
|
}, {
|
|
242932
242960
|
name: nuxtrcPath,
|
|
242933
242961
|
});
|
|
242934
242962
|
// The dependency needs to be listed in `package.json` as well so
|
|
242935
242963
|
// that `npm i` installs the package.
|
|
242936
|
-
const pkgJson = (await _shared_1.readPackageJson(dir));
|
|
242964
|
+
const pkgJson = (await (0, _shared_1.readPackageJson)(dir));
|
|
242937
242965
|
if (!pkgJson.dependencies) {
|
|
242938
242966
|
pkgJson.dependencies = {};
|
|
242939
242967
|
}
|
|
242940
242968
|
if (!pkgJson.dependencies[ANALYTICS_PLUGIN_PACKAGE]) {
|
|
242941
242969
|
pkgJson.dependencies[ANALYTICS_PLUGIN_PACKAGE] = 'latest';
|
|
242942
242970
|
console.log(`Adding "${ANALYTICS_PLUGIN_PACKAGE}" to \`package.json\` "dependencies"`);
|
|
242943
|
-
await _shared_1.writePackageJson(dir, pkgJson);
|
|
242971
|
+
await (0, _shared_1.writePackageJson)(dir, pkgJson);
|
|
242944
242972
|
}
|
|
242945
242973
|
}
|
|
242946
242974
|
exports.injectVercelAnalyticsPlugin = injectVercelAnalyticsPlugin;
|