@vercel/static-build 1.0.46 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js 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/v1647366075/front/import/nextjs.png',
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',
@@ -225313,12 +225313,18 @@ async function injectVercelAnalyticsPlugin(dir) {
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)) {
@@ -225371,6 +225377,39 @@ if (!hasPlugin) {
225371
225377
  });
225372
225378
  }
225373
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-vercel" || p.resolve === "gatsby-plugin-vercel")
225403
+ );
225404
+
225405
+ if (!hasPlugin) {
225406
+ vercelConfig.plugins = vercelConfig.plugins.slice();
225407
+ vercelConfig.plugins.push({
225408
+ resolve: "gatsby-plugin-vercel",
225409
+ options: {},
225410
+ });
225411
+ }
225412
+
225374
225413
  export default vercelConfig;
225375
225414
  `);
225376
225415
  }
@@ -38,12 +38,18 @@ async function injectVercelAnalyticsPlugin(dir) {
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)) {
@@ -96,6 +102,39 @@ if (!hasPlugin) {
96
102
  });
97
103
  }
98
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-vercel" || p.resolve === "gatsby-plugin-vercel")
128
+ );
129
+
130
+ if (!hasPlugin) {
131
+ vercelConfig.plugins = vercelConfig.plugins.slice();
132
+ vercelConfig.plugins.push({
133
+ resolve: "gatsby-plugin-vercel",
134
+ options: {},
135
+ });
136
+ }
137
+
99
138
  export default vercelConfig;
100
139
  `);
101
140
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "1.0.46",
3
+ "version": "1.1.0",
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.3",
40
- "@vercel/frameworks": "1.1.17",
39
+ "@vercel/build-utils": "5.7.4",
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": "fc0e6872e51d53fffc137658c95acf2a249ec926"
53
+ "gitHead": "721cd3afcbff994fa96704b4eb79e5f6da7ab73c"
54
54
  }