@vercel/static-build 0.23.2-canary.0 → 0.23.2-canary.1
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
CHANGED
|
@@ -13731,7 +13731,8 @@ const frameworks_1 = __importDefault(__webpack_require__(8438));
|
|
|
13731
13731
|
const fs_1 = __webpack_require__(5747);
|
|
13732
13732
|
const os_1 = __webpack_require__(2087);
|
|
13733
13733
|
const build_utils_1 = __webpack_require__(3445);
|
|
13734
|
-
const
|
|
13734
|
+
const BuildOutputV1 = __importStar(__webpack_require__(5497));
|
|
13735
|
+
const BuildOutputV3 = __importStar(__webpack_require__(8939));
|
|
13735
13736
|
const GatsbyUtils = __importStar(__webpack_require__(8573));
|
|
13736
13737
|
const NuxtUtils = __importStar(__webpack_require__(431));
|
|
13737
13738
|
const sleep = (n) => new Promise(resolve => setTimeout(resolve, n));
|
|
@@ -14009,10 +14010,7 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
14009
14010
|
};
|
|
14010
14011
|
if (!config.zeroConfig) {
|
|
14011
14012
|
build_utils_1.debug('Detected "builds" - not zero config');
|
|
14012
|
-
printInstall();
|
|
14013
|
-
const installTime = Date.now();
|
|
14014
14013
|
await build_utils_1.runNpmInstall(entrypointDir, [], spawnOpts, meta, nodeVersion);
|
|
14015
|
-
build_utils_1.debug(`Install complete [${Date.now() - installTime}ms]`);
|
|
14016
14014
|
isNpmInstall = true;
|
|
14017
14015
|
}
|
|
14018
14016
|
else if (typeof installCommand === 'string') {
|
|
@@ -14076,11 +14074,7 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
14076
14074
|
isPipInstall = true;
|
|
14077
14075
|
}
|
|
14078
14076
|
if (pkg) {
|
|
14079
|
-
console.log('Detected package.json');
|
|
14080
|
-
printInstall();
|
|
14081
|
-
const installTime = Date.now();
|
|
14082
14077
|
await build_utils_1.runNpmInstall(entrypointDir, [], spawnOpts, meta, nodeVersion);
|
|
14083
|
-
build_utils_1.debug(`Install complete [${Date.now() - installTime}ms]`);
|
|
14084
14078
|
isNpmInstall = true;
|
|
14085
14079
|
}
|
|
14086
14080
|
}
|
|
@@ -14184,6 +14178,27 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
14184
14178
|
throw new Error(`Missing required "${buildCommand || 'vercel-build'}" script in "${entrypoint}"`);
|
|
14185
14179
|
}
|
|
14186
14180
|
const outputDirPrefix = path_1.default.join(workPath, path_1.default.dirname(entrypoint));
|
|
14181
|
+
// If the Build Command or Framework output files according to the
|
|
14182
|
+
// Build Output v3 API, then stop processing here in `static-build`
|
|
14183
|
+
// since the output is already in its final form.
|
|
14184
|
+
const buildOutputPath = await BuildOutputV3.getBuildOutputDirectory(outputDirPrefix);
|
|
14185
|
+
if (buildOutputPath) {
|
|
14186
|
+
// Ensure that `vercel build` is being used for this Deployment
|
|
14187
|
+
if (!meta.cliVersion) {
|
|
14188
|
+
let buildCommandName;
|
|
14189
|
+
if (buildCommand)
|
|
14190
|
+
buildCommandName = `"${buildCommand}"`;
|
|
14191
|
+
else if (framework)
|
|
14192
|
+
buildCommandName = framework.name;
|
|
14193
|
+
else
|
|
14194
|
+
buildCommandName = 'the "build" script';
|
|
14195
|
+
throw new Error(`Detected Build Output v3 from ${buildCommandName}, but this Deployment is not using \`vercel build\`.\nPlease set the \`ENABLE_VC_BUILD=1\` environment variable.`);
|
|
14196
|
+
}
|
|
14197
|
+
return {
|
|
14198
|
+
buildOutputVersion: 3,
|
|
14199
|
+
buildOutputPath,
|
|
14200
|
+
};
|
|
14201
|
+
}
|
|
14187
14202
|
if (framework) {
|
|
14188
14203
|
const outputDirName = config.outputDirectory
|
|
14189
14204
|
? config.outputDirectory
|
|
@@ -14199,7 +14214,7 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
|
|
|
14199
14214
|
distPath = publicPath;
|
|
14200
14215
|
}
|
|
14201
14216
|
}
|
|
14202
|
-
const extraOutputs = await
|
|
14217
|
+
const extraOutputs = await BuildOutputV1.readBuildOutputDirectory({
|
|
14203
14218
|
workPath,
|
|
14204
14219
|
nodeVersion,
|
|
14205
14220
|
});
|
|
@@ -14265,7 +14280,7 @@ exports.build = build;
|
|
|
14265
14280
|
const prepareCache = async ({ entrypoint, workPath, config, }) => {
|
|
14266
14281
|
const cacheFiles = {};
|
|
14267
14282
|
// File System API v1 cache files
|
|
14268
|
-
const buildConfig = await
|
|
14283
|
+
const buildConfig = await BuildOutputV1.readBuildOutputConfig({
|
|
14269
14284
|
workPath,
|
|
14270
14285
|
configFileName: 'build.json',
|
|
14271
14286
|
});
|
|
@@ -14337,141 +14352,7 @@ exports.isObjectEmpty = isObjectEmpty;
|
|
|
14337
14352
|
|
|
14338
14353
|
/***/ }),
|
|
14339
14354
|
|
|
14340
|
-
/***/
|
|
14341
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
14342
|
-
|
|
14343
|
-
"use strict";
|
|
14344
|
-
|
|
14345
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14346
|
-
if (k2 === undefined) k2 = k;
|
|
14347
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
14348
|
-
}) : (function(o, m, k, k2) {
|
|
14349
|
-
if (k2 === undefined) k2 = k;
|
|
14350
|
-
o[k2] = m[k];
|
|
14351
|
-
}));
|
|
14352
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14353
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14354
|
-
}) : function(o, v) {
|
|
14355
|
-
o["default"] = v;
|
|
14356
|
-
});
|
|
14357
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
14358
|
-
if (mod && mod.__esModule) return mod;
|
|
14359
|
-
var result = {};
|
|
14360
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
14361
|
-
__setModuleDefault(result, mod);
|
|
14362
|
-
return result;
|
|
14363
|
-
};
|
|
14364
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14365
|
-
exports.injectVercelAnalyticsPlugin = void 0;
|
|
14366
|
-
const fs_1 = __webpack_require__(5747);
|
|
14367
|
-
const path = __importStar(__webpack_require__(5622));
|
|
14368
|
-
const _shared_1 = __webpack_require__(2229);
|
|
14369
|
-
const defaultConfig = {
|
|
14370
|
-
plugins: [
|
|
14371
|
-
{
|
|
14372
|
-
resolve: 'gatsby-plugin-vercel',
|
|
14373
|
-
options: {},
|
|
14374
|
-
},
|
|
14375
|
-
],
|
|
14376
|
-
};
|
|
14377
|
-
async function injectVercelAnalyticsPlugin(dir) {
|
|
14378
|
-
// Gatsby requires a special variable name for environment variables to be
|
|
14379
|
-
// exposed to the client-side JavaScript bundles:
|
|
14380
|
-
process.env.GATSBY_VERCEL_ANALYTICS_ID = process.env.VERCEL_ANALYTICS_ID;
|
|
14381
|
-
const gatsbyConfigName = 'gatsby-config.js';
|
|
14382
|
-
const gatsbyPluginPackageName = 'gatsby-plugin-vercel';
|
|
14383
|
-
const gatsbyConfigPath = path.join(dir, gatsbyConfigName);
|
|
14384
|
-
console.log(`Injecting Gatsby.js analytics plugin "${gatsbyPluginPackageName}" to \`${gatsbyConfigPath}\``);
|
|
14385
|
-
const pkgJson = (await _shared_1.readPackageJson(dir));
|
|
14386
|
-
if (!pkgJson.dependencies) {
|
|
14387
|
-
pkgJson.dependencies = {};
|
|
14388
|
-
}
|
|
14389
|
-
if (!pkgJson.dependencies[gatsbyPluginPackageName]) {
|
|
14390
|
-
console.log(`Adding "${gatsbyPluginPackageName}" to \`package.json\` "dependencies"`);
|
|
14391
|
-
pkgJson.dependencies[gatsbyPluginPackageName] = 'latest';
|
|
14392
|
-
await _shared_1.writePackageJson(dir, pkgJson);
|
|
14393
|
-
}
|
|
14394
|
-
if (await _shared_1.fileExists(gatsbyConfigPath)) {
|
|
14395
|
-
await fs_1.promises.rename(gatsbyConfigPath, gatsbyConfigPath + '.__vercel_builder_backup__.js');
|
|
14396
|
-
await fs_1.promises.writeFile(gatsbyConfigPath, `const userConfig = require("./gatsby-config.js.__vercel_builder_backup__.js");
|
|
14397
|
-
|
|
14398
|
-
// https://github.com/gatsbyjs/gatsby/blob/354003fb2908e02ff12109ca3a02978a5a6e608c/packages/gatsby/src/bootstrap/prefer-default.ts
|
|
14399
|
-
const preferDefault = m => (m && m.default) || m;
|
|
14400
|
-
|
|
14401
|
-
const vercelConfig = Object.assign(
|
|
14402
|
-
{},
|
|
14403
|
-
|
|
14404
|
-
// https://github.com/gatsbyjs/gatsby/blob/a6ecfb2b01d761e8a3612b8ea132c698659923d9/packages/gatsby/src/services/initialize.ts#L113-L117
|
|
14405
|
-
preferDefault(userConfig)
|
|
14406
|
-
);
|
|
14407
|
-
if (!vercelConfig.plugins) {
|
|
14408
|
-
vercelConfig.plugins = [];
|
|
14409
|
-
}
|
|
14410
|
-
|
|
14411
|
-
const hasPlugin = vercelConfig.plugins.find(
|
|
14412
|
-
(p) =>
|
|
14413
|
-
p && (p === "gatsby-plugin-vercel" || p.resolve === "gatsby-plugin-vercel")
|
|
14414
|
-
);
|
|
14415
|
-
if (!hasPlugin) {
|
|
14416
|
-
vercelConfig.plugins = vercelConfig.plugins.slice();
|
|
14417
|
-
vercelConfig.plugins.push({
|
|
14418
|
-
resolve: "gatsby-plugin-vercel",
|
|
14419
|
-
options: {},
|
|
14420
|
-
});
|
|
14421
|
-
}
|
|
14422
|
-
|
|
14423
|
-
module.exports = vercelConfig;
|
|
14424
|
-
`);
|
|
14425
|
-
}
|
|
14426
|
-
else {
|
|
14427
|
-
await fs_1.promises.writeFile(gatsbyConfigPath, `module.exports = ${JSON.stringify(defaultConfig)}`);
|
|
14428
|
-
}
|
|
14429
|
-
}
|
|
14430
|
-
exports.injectVercelAnalyticsPlugin = injectVercelAnalyticsPlugin;
|
|
14431
|
-
|
|
14432
|
-
|
|
14433
|
-
/***/ }),
|
|
14434
|
-
|
|
14435
|
-
/***/ 431:
|
|
14436
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
14437
|
-
|
|
14438
|
-
"use strict";
|
|
14439
|
-
|
|
14440
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14441
|
-
exports.injectVercelAnalyticsPlugin = void 0;
|
|
14442
|
-
const path_1 = __webpack_require__(5622);
|
|
14443
|
-
const rc9_1 = __webpack_require__(6649);
|
|
14444
|
-
const _shared_1 = __webpack_require__(2229);
|
|
14445
|
-
// https://github.com/nuxt-community/web-vitals-module
|
|
14446
|
-
const ANALYTICS_PLUGIN_PACKAGE = '@nuxtjs/web-vitals';
|
|
14447
|
-
async function injectVercelAnalyticsPlugin(dir) {
|
|
14448
|
-
// First update the `.nuxtrc` file to inject the analytics plugin.
|
|
14449
|
-
// See: https://gist.github.com/pi0/23b5253ac19b4ed5a70add3b971545c9
|
|
14450
|
-
const nuxtrcPath = path_1.join(dir, '.nuxtrc');
|
|
14451
|
-
console.log(`Injecting Nuxt.js analytics plugin "${ANALYTICS_PLUGIN_PACKAGE}" to \`${nuxtrcPath}\``);
|
|
14452
|
-
rc9_1.update({
|
|
14453
|
-
'modules[]': ANALYTICS_PLUGIN_PACKAGE,
|
|
14454
|
-
}, {
|
|
14455
|
-
name: nuxtrcPath,
|
|
14456
|
-
});
|
|
14457
|
-
// The dependency needs to be listed in `package.json` as well so
|
|
14458
|
-
// that `npm i` installs the package.
|
|
14459
|
-
const pkgJson = (await _shared_1.readPackageJson(dir));
|
|
14460
|
-
if (!pkgJson.dependencies) {
|
|
14461
|
-
pkgJson.dependencies = {};
|
|
14462
|
-
}
|
|
14463
|
-
if (!pkgJson.dependencies[ANALYTICS_PLUGIN_PACKAGE]) {
|
|
14464
|
-
pkgJson.dependencies[ANALYTICS_PLUGIN_PACKAGE] = 'latest';
|
|
14465
|
-
console.log(`Adding "${ANALYTICS_PLUGIN_PACKAGE}" to \`package.json\` "dependencies"`);
|
|
14466
|
-
await _shared_1.writePackageJson(dir, pkgJson);
|
|
14467
|
-
}
|
|
14468
|
-
}
|
|
14469
|
-
exports.injectVercelAnalyticsPlugin = injectVercelAnalyticsPlugin;
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
/***/ }),
|
|
14473
|
-
|
|
14474
|
-
/***/ 315:
|
|
14355
|
+
/***/ 5497:
|
|
14475
14356
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
14476
14357
|
|
|
14477
14358
|
"use strict";
|
|
@@ -14671,6 +14552,173 @@ async function readBuildOutputConfig({ workPath, configFileName, }) {
|
|
|
14671
14552
|
exports.readBuildOutputConfig = readBuildOutputConfig;
|
|
14672
14553
|
|
|
14673
14554
|
|
|
14555
|
+
/***/ }),
|
|
14556
|
+
|
|
14557
|
+
/***/ 8939:
|
|
14558
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
14559
|
+
|
|
14560
|
+
"use strict";
|
|
14561
|
+
|
|
14562
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14563
|
+
exports.getBuildOutputDirectory = void 0;
|
|
14564
|
+
const path_1 = __webpack_require__(5622);
|
|
14565
|
+
const fs_1 = __webpack_require__(5747);
|
|
14566
|
+
const BUILD_OUTPUT_DIR = '.vercel/output';
|
|
14567
|
+
/**
|
|
14568
|
+
* Returns the path to the Build Output v3 directory when the
|
|
14569
|
+
* `config.json` file was created by the framework / build script,
|
|
14570
|
+
* or `undefined` if the framework did not create the v3 output.
|
|
14571
|
+
*/
|
|
14572
|
+
async function getBuildOutputDirectory(path) {
|
|
14573
|
+
try {
|
|
14574
|
+
const outputDir = path_1.join(path, BUILD_OUTPUT_DIR);
|
|
14575
|
+
const configPath = path_1.join(outputDir, 'config.json');
|
|
14576
|
+
await fs_1.promises.stat(configPath);
|
|
14577
|
+
return outputDir;
|
|
14578
|
+
}
|
|
14579
|
+
catch (err) {
|
|
14580
|
+
if (err.code !== 'ENOENT')
|
|
14581
|
+
throw err;
|
|
14582
|
+
}
|
|
14583
|
+
return undefined;
|
|
14584
|
+
}
|
|
14585
|
+
exports.getBuildOutputDirectory = getBuildOutputDirectory;
|
|
14586
|
+
|
|
14587
|
+
|
|
14588
|
+
/***/ }),
|
|
14589
|
+
|
|
14590
|
+
/***/ 8573:
|
|
14591
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
14592
|
+
|
|
14593
|
+
"use strict";
|
|
14594
|
+
|
|
14595
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14596
|
+
if (k2 === undefined) k2 = k;
|
|
14597
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
14598
|
+
}) : (function(o, m, k, k2) {
|
|
14599
|
+
if (k2 === undefined) k2 = k;
|
|
14600
|
+
o[k2] = m[k];
|
|
14601
|
+
}));
|
|
14602
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14603
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14604
|
+
}) : function(o, v) {
|
|
14605
|
+
o["default"] = v;
|
|
14606
|
+
});
|
|
14607
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
14608
|
+
if (mod && mod.__esModule) return mod;
|
|
14609
|
+
var result = {};
|
|
14610
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
14611
|
+
__setModuleDefault(result, mod);
|
|
14612
|
+
return result;
|
|
14613
|
+
};
|
|
14614
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14615
|
+
exports.injectVercelAnalyticsPlugin = void 0;
|
|
14616
|
+
const fs_1 = __webpack_require__(5747);
|
|
14617
|
+
const path = __importStar(__webpack_require__(5622));
|
|
14618
|
+
const _shared_1 = __webpack_require__(2229);
|
|
14619
|
+
const defaultConfig = {
|
|
14620
|
+
plugins: [
|
|
14621
|
+
{
|
|
14622
|
+
resolve: 'gatsby-plugin-vercel',
|
|
14623
|
+
options: {},
|
|
14624
|
+
},
|
|
14625
|
+
],
|
|
14626
|
+
};
|
|
14627
|
+
async function injectVercelAnalyticsPlugin(dir) {
|
|
14628
|
+
// Gatsby requires a special variable name for environment variables to be
|
|
14629
|
+
// exposed to the client-side JavaScript bundles:
|
|
14630
|
+
process.env.GATSBY_VERCEL_ANALYTICS_ID = process.env.VERCEL_ANALYTICS_ID;
|
|
14631
|
+
const gatsbyConfigName = 'gatsby-config.js';
|
|
14632
|
+
const gatsbyPluginPackageName = 'gatsby-plugin-vercel';
|
|
14633
|
+
const gatsbyConfigPath = path.join(dir, gatsbyConfigName);
|
|
14634
|
+
console.log(`Injecting Gatsby.js analytics plugin "${gatsbyPluginPackageName}" to \`${gatsbyConfigPath}\``);
|
|
14635
|
+
const pkgJson = (await _shared_1.readPackageJson(dir));
|
|
14636
|
+
if (!pkgJson.dependencies) {
|
|
14637
|
+
pkgJson.dependencies = {};
|
|
14638
|
+
}
|
|
14639
|
+
if (!pkgJson.dependencies[gatsbyPluginPackageName]) {
|
|
14640
|
+
console.log(`Adding "${gatsbyPluginPackageName}" to \`package.json\` "dependencies"`);
|
|
14641
|
+
pkgJson.dependencies[gatsbyPluginPackageName] = 'latest';
|
|
14642
|
+
await _shared_1.writePackageJson(dir, pkgJson);
|
|
14643
|
+
}
|
|
14644
|
+
if (await _shared_1.fileExists(gatsbyConfigPath)) {
|
|
14645
|
+
await fs_1.promises.rename(gatsbyConfigPath, gatsbyConfigPath + '.__vercel_builder_backup__.js');
|
|
14646
|
+
await fs_1.promises.writeFile(gatsbyConfigPath, `const userConfig = require("./gatsby-config.js.__vercel_builder_backup__.js");
|
|
14647
|
+
|
|
14648
|
+
// https://github.com/gatsbyjs/gatsby/blob/354003fb2908e02ff12109ca3a02978a5a6e608c/packages/gatsby/src/bootstrap/prefer-default.ts
|
|
14649
|
+
const preferDefault = m => (m && m.default) || m;
|
|
14650
|
+
|
|
14651
|
+
const vercelConfig = Object.assign(
|
|
14652
|
+
{},
|
|
14653
|
+
|
|
14654
|
+
// https://github.com/gatsbyjs/gatsby/blob/a6ecfb2b01d761e8a3612b8ea132c698659923d9/packages/gatsby/src/services/initialize.ts#L113-L117
|
|
14655
|
+
preferDefault(userConfig)
|
|
14656
|
+
);
|
|
14657
|
+
if (!vercelConfig.plugins) {
|
|
14658
|
+
vercelConfig.plugins = [];
|
|
14659
|
+
}
|
|
14660
|
+
|
|
14661
|
+
const hasPlugin = vercelConfig.plugins.find(
|
|
14662
|
+
(p) =>
|
|
14663
|
+
p && (p === "gatsby-plugin-vercel" || p.resolve === "gatsby-plugin-vercel")
|
|
14664
|
+
);
|
|
14665
|
+
if (!hasPlugin) {
|
|
14666
|
+
vercelConfig.plugins = vercelConfig.plugins.slice();
|
|
14667
|
+
vercelConfig.plugins.push({
|
|
14668
|
+
resolve: "gatsby-plugin-vercel",
|
|
14669
|
+
options: {},
|
|
14670
|
+
});
|
|
14671
|
+
}
|
|
14672
|
+
|
|
14673
|
+
module.exports = vercelConfig;
|
|
14674
|
+
`);
|
|
14675
|
+
}
|
|
14676
|
+
else {
|
|
14677
|
+
await fs_1.promises.writeFile(gatsbyConfigPath, `module.exports = ${JSON.stringify(defaultConfig)}`);
|
|
14678
|
+
}
|
|
14679
|
+
}
|
|
14680
|
+
exports.injectVercelAnalyticsPlugin = injectVercelAnalyticsPlugin;
|
|
14681
|
+
|
|
14682
|
+
|
|
14683
|
+
/***/ }),
|
|
14684
|
+
|
|
14685
|
+
/***/ 431:
|
|
14686
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
14687
|
+
|
|
14688
|
+
"use strict";
|
|
14689
|
+
|
|
14690
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14691
|
+
exports.injectVercelAnalyticsPlugin = void 0;
|
|
14692
|
+
const path_1 = __webpack_require__(5622);
|
|
14693
|
+
const rc9_1 = __webpack_require__(6649);
|
|
14694
|
+
const _shared_1 = __webpack_require__(2229);
|
|
14695
|
+
// https://github.com/nuxt-community/web-vitals-module
|
|
14696
|
+
const ANALYTICS_PLUGIN_PACKAGE = '@nuxtjs/web-vitals';
|
|
14697
|
+
async function injectVercelAnalyticsPlugin(dir) {
|
|
14698
|
+
// First update the `.nuxtrc` file to inject the analytics plugin.
|
|
14699
|
+
// See: https://gist.github.com/pi0/23b5253ac19b4ed5a70add3b971545c9
|
|
14700
|
+
const nuxtrcPath = path_1.join(dir, '.nuxtrc');
|
|
14701
|
+
console.log(`Injecting Nuxt.js analytics plugin "${ANALYTICS_PLUGIN_PACKAGE}" to \`${nuxtrcPath}\``);
|
|
14702
|
+
rc9_1.update({
|
|
14703
|
+
'modules[]': ANALYTICS_PLUGIN_PACKAGE,
|
|
14704
|
+
}, {
|
|
14705
|
+
name: nuxtrcPath,
|
|
14706
|
+
});
|
|
14707
|
+
// The dependency needs to be listed in `package.json` as well so
|
|
14708
|
+
// that `npm i` installs the package.
|
|
14709
|
+
const pkgJson = (await _shared_1.readPackageJson(dir));
|
|
14710
|
+
if (!pkgJson.dependencies) {
|
|
14711
|
+
pkgJson.dependencies = {};
|
|
14712
|
+
}
|
|
14713
|
+
if (!pkgJson.dependencies[ANALYTICS_PLUGIN_PACKAGE]) {
|
|
14714
|
+
pkgJson.dependencies[ANALYTICS_PLUGIN_PACKAGE] = 'latest';
|
|
14715
|
+
console.log(`Adding "${ANALYTICS_PLUGIN_PACKAGE}" to \`package.json\` "dependencies"`);
|
|
14716
|
+
await _shared_1.writePackageJson(dir, pkgJson);
|
|
14717
|
+
}
|
|
14718
|
+
}
|
|
14719
|
+
exports.injectVercelAnalyticsPlugin = injectVercelAnalyticsPlugin;
|
|
14720
|
+
|
|
14721
|
+
|
|
14674
14722
|
/***/ }),
|
|
14675
14723
|
|
|
14676
14724
|
/***/ 5685:
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBuildOutputDirectory = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const BUILD_OUTPUT_DIR = '.vercel/output';
|
|
7
|
+
/**
|
|
8
|
+
* Returns the path to the Build Output v3 directory when the
|
|
9
|
+
* `config.json` file was created by the framework / build script,
|
|
10
|
+
* or `undefined` if the framework did not create the v3 output.
|
|
11
|
+
*/
|
|
12
|
+
async function getBuildOutputDirectory(path) {
|
|
13
|
+
try {
|
|
14
|
+
const outputDir = path_1.join(path, BUILD_OUTPUT_DIR);
|
|
15
|
+
const configPath = path_1.join(outputDir, 'config.json');
|
|
16
|
+
await fs_1.promises.stat(configPath);
|
|
17
|
+
return outputDir;
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
if (err.code !== 'ENOENT')
|
|
21
|
+
throw err;
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
exports.getBuildOutputDirectory = getBuildOutputDirectory;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/static-build",
|
|
3
|
-
"version": "0.23.2-canary.
|
|
3
|
+
"version": "0.23.2-canary.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/build-step",
|
|
@@ -14,17 +14,28 @@
|
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "node build",
|
|
17
|
-
"test-unit": "jest --env node --verbose --
|
|
17
|
+
"test-unit": "jest --env node --verbose --bail test/build.test.ts test/prepare-cache.test.ts",
|
|
18
18
|
"test-integration-once": "jest --env node --verbose --runInBand --bail test/integration.test.js",
|
|
19
19
|
"prepublishOnly": "node build"
|
|
20
20
|
},
|
|
21
|
+
"jest": {
|
|
22
|
+
"preset": "ts-jest/presets/default",
|
|
23
|
+
"testEnvironment": "node",
|
|
24
|
+
"globals": {
|
|
25
|
+
"ts-jest": {
|
|
26
|
+
"diagnostics": true,
|
|
27
|
+
"isolatedModules": true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
21
31
|
"devDependencies": {
|
|
22
32
|
"@types/aws-lambda": "8.10.64",
|
|
23
33
|
"@types/cross-spawn": "6.0.0",
|
|
34
|
+
"@types/jest": "27.4.1",
|
|
24
35
|
"@types/ms": "0.7.31",
|
|
25
36
|
"@types/node-fetch": "2.5.4",
|
|
26
37
|
"@types/promise-timeout": "1.3.0",
|
|
27
|
-
"@vercel/build-utils": "2.15.2-canary.
|
|
38
|
+
"@vercel/build-utils": "2.15.2-canary.1",
|
|
28
39
|
"@vercel/frameworks": "0.7.1",
|
|
29
40
|
"@vercel/ncc": "0.24.0",
|
|
30
41
|
"@vercel/routing-utils": "1.13.1",
|
|
@@ -34,5 +45,5 @@
|
|
|
34
45
|
"node-fetch": "2.6.1",
|
|
35
46
|
"rc9": "1.2.0"
|
|
36
47
|
},
|
|
37
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "71b83d5587b549a1458697b50596a5534cb783d3"
|
|
38
49
|
}
|