@vercel/static-build 1.0.46 → 1.1.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 +46 -7
- package/dist/utils/gatsby.js +45 -6
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -209290,7 +209290,7 @@ exports.frameworks = [
|
|
|
209290
209290
|
demo: 'https://nextjs-template.vercel.app',
|
|
209291
209291
|
logo: 'https://api-frameworks.vercel.sh/framework-logos/next.svg',
|
|
209292
209292
|
darkModeLogo: 'https://api-frameworks.vercel.sh/framework-logos/next-dark.svg',
|
|
209293
|
-
screenshot: 'https://assets.vercel.com/image/upload/
|
|
209293
|
+
screenshot: 'https://assets.vercel.com/image/upload/v1673027027/front/import/nextjs.png',
|
|
209294
209294
|
tagline: 'Next.js makes you productive with React instantly — whether you want to build static or dynamic sites.',
|
|
209295
209295
|
description: 'A Next.js app and a Serverless Function API.',
|
|
209296
209296
|
website: 'https://nextjs.org',
|
|
@@ -225298,27 +225298,33 @@ exports.injectVercelAnalyticsPlugin = void 0;
|
|
|
225298
225298
|
const fs_1 = __webpack_require__(5747);
|
|
225299
225299
|
const path = __importStar(__webpack_require__(5622));
|
|
225300
225300
|
const _shared_1 = __webpack_require__(2229);
|
|
225301
|
+
const GATSBY_PLUGIN_PACKAGE_NAME = '@vercel/gatsby-plugin-vercel-analytics';
|
|
225301
225302
|
const DEFAULT_CONFIG = {
|
|
225302
225303
|
plugins: [
|
|
225303
225304
|
{
|
|
225304
|
-
resolve:
|
|
225305
|
+
resolve: GATSBY_PLUGIN_PACKAGE_NAME,
|
|
225305
225306
|
options: {},
|
|
225306
225307
|
},
|
|
225307
225308
|
],
|
|
225308
225309
|
};
|
|
225309
|
-
const GATSBY_PLUGIN_PACKAGE_NAME = 'gatsby-plugin-vercel';
|
|
225310
225310
|
const GATSBY_CONFIG_FILE = 'gatsby-config';
|
|
225311
225311
|
async function injectVercelAnalyticsPlugin(dir) {
|
|
225312
225312
|
// Gatsby requires a special variable name for environment variables to be
|
|
225313
225313
|
// exposed to the client-side JavaScript bundles:
|
|
225314
225314
|
process.env.GATSBY_VERCEL_ANALYTICS_ID = process.env.VERCEL_ANALYTICS_ID;
|
|
225315
225315
|
const gatsbyConfigPathJs = path.join(dir, `${GATSBY_CONFIG_FILE}.js`);
|
|
225316
|
+
const gatsbyConfigPathMjs = path.join(dir, `${GATSBY_CONFIG_FILE}.mjs`);
|
|
225316
225317
|
const gatsbyConfigPathTs = path.join(dir, `${GATSBY_CONFIG_FILE}.ts`);
|
|
225317
225318
|
if (await _shared_1.fileExists(gatsbyConfigPathTs)) {
|
|
225318
225319
|
console.log(`Injecting Gatsby.js analytics plugin "${GATSBY_PLUGIN_PACKAGE_NAME}" to \`${gatsbyConfigPathTs}\``);
|
|
225319
225320
|
await addGatsbyPackage(dir);
|
|
225320
225321
|
return updateGatsbyTsConfig(gatsbyConfigPathTs);
|
|
225321
225322
|
}
|
|
225323
|
+
if (await _shared_1.fileExists(gatsbyConfigPathMjs)) {
|
|
225324
|
+
console.log(`Injecting Gatsby.js analytics plugin "${GATSBY_PLUGIN_PACKAGE_NAME}" to \`${gatsbyConfigPathMjs}\``);
|
|
225325
|
+
await addGatsbyPackage(dir);
|
|
225326
|
+
return updateGatsbyMjsConfig(gatsbyConfigPathMjs);
|
|
225327
|
+
}
|
|
225322
225328
|
console.log(`Injecting Gatsby.js analytics plugin "${GATSBY_PLUGIN_PACKAGE_NAME}" to \`${gatsbyConfigPathJs}\``);
|
|
225323
225329
|
await addGatsbyPackage(dir);
|
|
225324
225330
|
if (await _shared_1.fileExists(gatsbyConfigPathJs)) {
|
|
@@ -225360,13 +225366,46 @@ if (!vercelConfig.plugins) {
|
|
|
225360
225366
|
|
|
225361
225367
|
const hasPlugin = vercelConfig.plugins.find(
|
|
225362
225368
|
(p: PluginRef) =>
|
|
225363
|
-
p && (p === "
|
|
225369
|
+
p && (p === "${GATSBY_PLUGIN_PACKAGE_NAME}" || p.resolve === "${GATSBY_PLUGIN_PACKAGE_NAME}")
|
|
225370
|
+
);
|
|
225371
|
+
|
|
225372
|
+
if (!hasPlugin) {
|
|
225373
|
+
vercelConfig.plugins = vercelConfig.plugins.slice();
|
|
225374
|
+
vercelConfig.plugins.push({
|
|
225375
|
+
resolve: "${GATSBY_PLUGIN_PACKAGE_NAME}",
|
|
225376
|
+
options: {},
|
|
225377
|
+
});
|
|
225378
|
+
}
|
|
225379
|
+
|
|
225380
|
+
export default vercelConfig;
|
|
225381
|
+
`);
|
|
225382
|
+
}
|
|
225383
|
+
async function updateGatsbyMjsConfig(configPath) {
|
|
225384
|
+
await fs_1.promises.rename(configPath, configPath + '.__vercel_builder_backup__.mjs');
|
|
225385
|
+
await fs_1.promises.writeFile(configPath, `import userConfig from "./gatsby-config.mjs.__vercel_builder_backup__.mjs";
|
|
225386
|
+
|
|
225387
|
+
// https://github.com/gatsbyjs/gatsby/blob/354003fb2908e02ff12109ca3a02978a5a6e608c/packages/gatsby/src/bootstrap/prefer-default.ts
|
|
225388
|
+
const preferDefault = (m) => (m && m.default) || m;
|
|
225389
|
+
|
|
225390
|
+
const vercelConfig = Object.assign(
|
|
225391
|
+
{},
|
|
225392
|
+
|
|
225393
|
+
// https://github.com/gatsbyjs/gatsby/blob/a6ecfb2b01d761e8a3612b8ea132c698659923d9/packages/gatsby/src/services/initialize.ts#L113-L117
|
|
225394
|
+
preferDefault(userConfig)
|
|
225395
|
+
);
|
|
225396
|
+
if (!vercelConfig.plugins) {
|
|
225397
|
+
vercelConfig.plugins = [];
|
|
225398
|
+
}
|
|
225399
|
+
|
|
225400
|
+
const hasPlugin = vercelConfig.plugins.find(
|
|
225401
|
+
(p) =>
|
|
225402
|
+
p && (p === "${GATSBY_PLUGIN_PACKAGE_NAME}" || p.resolve === "${GATSBY_PLUGIN_PACKAGE_NAME}")
|
|
225364
225403
|
);
|
|
225365
225404
|
|
|
225366
225405
|
if (!hasPlugin) {
|
|
225367
225406
|
vercelConfig.plugins = vercelConfig.plugins.slice();
|
|
225368
225407
|
vercelConfig.plugins.push({
|
|
225369
|
-
resolve: "
|
|
225408
|
+
resolve: "${GATSBY_PLUGIN_PACKAGE_NAME}",
|
|
225370
225409
|
options: {},
|
|
225371
225410
|
});
|
|
225372
225411
|
}
|
|
@@ -225393,12 +225432,12 @@ if (!vercelConfig.plugins) {
|
|
|
225393
225432
|
|
|
225394
225433
|
const hasPlugin = vercelConfig.plugins.find(
|
|
225395
225434
|
(p) =>
|
|
225396
|
-
p && (p === "
|
|
225435
|
+
p && (p === "${GATSBY_PLUGIN_PACKAGE_NAME}" || p.resolve === "${GATSBY_PLUGIN_PACKAGE_NAME}")
|
|
225397
225436
|
);
|
|
225398
225437
|
if (!hasPlugin) {
|
|
225399
225438
|
vercelConfig.plugins = vercelConfig.plugins.slice();
|
|
225400
225439
|
vercelConfig.plugins.push({
|
|
225401
|
-
resolve: "
|
|
225440
|
+
resolve: "${GATSBY_PLUGIN_PACKAGE_NAME}",
|
|
225402
225441
|
options: {},
|
|
225403
225442
|
});
|
|
225404
225443
|
}
|
package/dist/utils/gatsby.js
CHANGED
|
@@ -23,27 +23,33 @@ exports.injectVercelAnalyticsPlugin = void 0;
|
|
|
23
23
|
const fs_1 = require("fs");
|
|
24
24
|
const path = __importStar(require("path"));
|
|
25
25
|
const _shared_1 = require("./_shared");
|
|
26
|
+
const GATSBY_PLUGIN_PACKAGE_NAME = '@vercel/gatsby-plugin-vercel-analytics';
|
|
26
27
|
const DEFAULT_CONFIG = {
|
|
27
28
|
plugins: [
|
|
28
29
|
{
|
|
29
|
-
resolve:
|
|
30
|
+
resolve: GATSBY_PLUGIN_PACKAGE_NAME,
|
|
30
31
|
options: {},
|
|
31
32
|
},
|
|
32
33
|
],
|
|
33
34
|
};
|
|
34
|
-
const GATSBY_PLUGIN_PACKAGE_NAME = 'gatsby-plugin-vercel';
|
|
35
35
|
const GATSBY_CONFIG_FILE = 'gatsby-config';
|
|
36
36
|
async function injectVercelAnalyticsPlugin(dir) {
|
|
37
37
|
// Gatsby requires a special variable name for environment variables to be
|
|
38
38
|
// exposed to the client-side JavaScript bundles:
|
|
39
39
|
process.env.GATSBY_VERCEL_ANALYTICS_ID = process.env.VERCEL_ANALYTICS_ID;
|
|
40
40
|
const gatsbyConfigPathJs = path.join(dir, `${GATSBY_CONFIG_FILE}.js`);
|
|
41
|
+
const gatsbyConfigPathMjs = path.join(dir, `${GATSBY_CONFIG_FILE}.mjs`);
|
|
41
42
|
const gatsbyConfigPathTs = path.join(dir, `${GATSBY_CONFIG_FILE}.ts`);
|
|
42
43
|
if (await _shared_1.fileExists(gatsbyConfigPathTs)) {
|
|
43
44
|
console.log(`Injecting Gatsby.js analytics plugin "${GATSBY_PLUGIN_PACKAGE_NAME}" to \`${gatsbyConfigPathTs}\``);
|
|
44
45
|
await addGatsbyPackage(dir);
|
|
45
46
|
return updateGatsbyTsConfig(gatsbyConfigPathTs);
|
|
46
47
|
}
|
|
48
|
+
if (await _shared_1.fileExists(gatsbyConfigPathMjs)) {
|
|
49
|
+
console.log(`Injecting Gatsby.js analytics plugin "${GATSBY_PLUGIN_PACKAGE_NAME}" to \`${gatsbyConfigPathMjs}\``);
|
|
50
|
+
await addGatsbyPackage(dir);
|
|
51
|
+
return updateGatsbyMjsConfig(gatsbyConfigPathMjs);
|
|
52
|
+
}
|
|
47
53
|
console.log(`Injecting Gatsby.js analytics plugin "${GATSBY_PLUGIN_PACKAGE_NAME}" to \`${gatsbyConfigPathJs}\``);
|
|
48
54
|
await addGatsbyPackage(dir);
|
|
49
55
|
if (await _shared_1.fileExists(gatsbyConfigPathJs)) {
|
|
@@ -85,13 +91,46 @@ if (!vercelConfig.plugins) {
|
|
|
85
91
|
|
|
86
92
|
const hasPlugin = vercelConfig.plugins.find(
|
|
87
93
|
(p: PluginRef) =>
|
|
88
|
-
p && (p === "
|
|
94
|
+
p && (p === "${GATSBY_PLUGIN_PACKAGE_NAME}" || p.resolve === "${GATSBY_PLUGIN_PACKAGE_NAME}")
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
if (!hasPlugin) {
|
|
98
|
+
vercelConfig.plugins = vercelConfig.plugins.slice();
|
|
99
|
+
vercelConfig.plugins.push({
|
|
100
|
+
resolve: "${GATSBY_PLUGIN_PACKAGE_NAME}",
|
|
101
|
+
options: {},
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export default vercelConfig;
|
|
106
|
+
`);
|
|
107
|
+
}
|
|
108
|
+
async function updateGatsbyMjsConfig(configPath) {
|
|
109
|
+
await fs_1.promises.rename(configPath, configPath + '.__vercel_builder_backup__.mjs');
|
|
110
|
+
await fs_1.promises.writeFile(configPath, `import userConfig from "./gatsby-config.mjs.__vercel_builder_backup__.mjs";
|
|
111
|
+
|
|
112
|
+
// https://github.com/gatsbyjs/gatsby/blob/354003fb2908e02ff12109ca3a02978a5a6e608c/packages/gatsby/src/bootstrap/prefer-default.ts
|
|
113
|
+
const preferDefault = (m) => (m && m.default) || m;
|
|
114
|
+
|
|
115
|
+
const vercelConfig = Object.assign(
|
|
116
|
+
{},
|
|
117
|
+
|
|
118
|
+
// https://github.com/gatsbyjs/gatsby/blob/a6ecfb2b01d761e8a3612b8ea132c698659923d9/packages/gatsby/src/services/initialize.ts#L113-L117
|
|
119
|
+
preferDefault(userConfig)
|
|
120
|
+
);
|
|
121
|
+
if (!vercelConfig.plugins) {
|
|
122
|
+
vercelConfig.plugins = [];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const hasPlugin = vercelConfig.plugins.find(
|
|
126
|
+
(p) =>
|
|
127
|
+
p && (p === "${GATSBY_PLUGIN_PACKAGE_NAME}" || p.resolve === "${GATSBY_PLUGIN_PACKAGE_NAME}")
|
|
89
128
|
);
|
|
90
129
|
|
|
91
130
|
if (!hasPlugin) {
|
|
92
131
|
vercelConfig.plugins = vercelConfig.plugins.slice();
|
|
93
132
|
vercelConfig.plugins.push({
|
|
94
|
-
resolve: "
|
|
133
|
+
resolve: "${GATSBY_PLUGIN_PACKAGE_NAME}",
|
|
95
134
|
options: {},
|
|
96
135
|
});
|
|
97
136
|
}
|
|
@@ -118,12 +157,12 @@ if (!vercelConfig.plugins) {
|
|
|
118
157
|
|
|
119
158
|
const hasPlugin = vercelConfig.plugins.find(
|
|
120
159
|
(p) =>
|
|
121
|
-
p && (p === "
|
|
160
|
+
p && (p === "${GATSBY_PLUGIN_PACKAGE_NAME}" || p.resolve === "${GATSBY_PLUGIN_PACKAGE_NAME}")
|
|
122
161
|
);
|
|
123
162
|
if (!hasPlugin) {
|
|
124
163
|
vercelConfig.plugins = vercelConfig.plugins.slice();
|
|
125
164
|
vercelConfig.plugins.push({
|
|
126
|
-
resolve: "
|
|
165
|
+
resolve: "${GATSBY_PLUGIN_PACKAGE_NAME}",
|
|
127
166
|
options: {},
|
|
128
167
|
});
|
|
129
168
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/static-build",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/build-step",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@types/ms": "0.7.31",
|
|
37
37
|
"@types/node-fetch": "2.5.4",
|
|
38
38
|
"@types/promise-timeout": "1.3.0",
|
|
39
|
-
"@vercel/build-utils": "5.7.
|
|
40
|
-
"@vercel/frameworks": "1.1.
|
|
39
|
+
"@vercel/build-utils": "5.7.5",
|
|
40
|
+
"@vercel/frameworks": "1.1.18",
|
|
41
41
|
"@vercel/ncc": "0.24.0",
|
|
42
42
|
"@vercel/routing-utils": "2.1.3",
|
|
43
43
|
"@vercel/static-config": "2.0.6",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"tree-kill": "1.2.2",
|
|
51
51
|
"typescript": "4.3.4"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "4c3bc0532216f21f354623ada76b2315ef8ba519"
|
|
54
54
|
}
|