@vercel/static-build 1.4.0 → 2.0.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.
Files changed (2) hide show
  1. package/dist/index.js +30 -7
  2. package/package.json +10 -9
package/dist/index.js CHANGED
@@ -234352,6 +234352,7 @@ exports.frameworks = [
234352
234352
  description: 'A new Remix app — the result of running `npx create-remix`.',
234353
234353
  website: 'https://remix.run',
234354
234354
  sort: 6,
234355
+ supersedes: 'hydrogen',
234355
234356
  useRuntime: { src: 'package.json', use: '@vercel/remix-builder' },
234356
234357
  ignoreRuntimes: ['@vercel/node'],
234357
234358
  detectors: {
@@ -235810,6 +235811,7 @@ exports.frameworks = [
235810
235811
  tagline: 'React framework for headless commerce',
235811
235812
  description: 'React framework for headless commerce',
235812
235813
  website: 'https://hydrogen.shopify.dev',
235814
+ supersedes: 'vite',
235813
235815
  useRuntime: { src: 'package.json', use: '@vercel/hydrogen' },
235814
235816
  envPrefix: 'PUBLIC_',
235815
235817
  detectors: {
@@ -236884,6 +236886,7 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
236884
236886
  const rewriteRoutes = [];
236885
236887
  const errorRoutes = [];
236886
236888
  const framework = frontendBuilder?.config?.framework || '';
236889
+ const isGatsby = framework === 'gatsby';
236887
236890
  const isNextjs = framework === 'nextjs' || (0, is_official_runtime_1.isOfficialRuntime)('next', frontendBuilder?.use);
236888
236891
  const ignoreRuntimes = slugToFramework.get(framework)?.ignoreRuntimes;
236889
236892
  if (apiRoutes && apiRoutes.length > 0) {
@@ -236954,8 +236957,8 @@ function getRouteResult(apiRoutes, dynamicRoutes, outputDirectory, apiBuilders,
236954
236957
  dest: `/${outputDirectory}/$1`,
236955
236958
  });
236956
236959
  }
236957
- if (options.featHandleMiss && !isNextjs) {
236958
- // Exclude Next.js to avoid overriding custom error page
236960
+ if (options.featHandleMiss && !isNextjs && !isGatsby) {
236961
+ // Exclude Next.js (and Gatsby) to avoid overriding custom error page
236959
236962
  // https://nextjs.org/docs/advanced-features/custom-error-page
236960
236963
  errorRoutes.push({
236961
236964
  status: 404,
@@ -237179,7 +237182,7 @@ exports.detectFileSystemAPI = detectFileSystemAPI;
237179
237182
  "use strict";
237180
237183
 
237181
237184
  Object.defineProperty(exports, "__esModule", ({ value: true }));
237182
- exports.detectFrameworkVersion = exports.detectFrameworkRecord = exports.detectFrameworks = exports.detectFramework = void 0;
237185
+ exports.detectFrameworkVersion = exports.detectFrameworkRecord = exports.detectFrameworks = exports.detectFramework = exports.removeSupersededFrameworks = void 0;
237183
237186
  const child_process_1 = __webpack_require__(7004);
237184
237187
  async function matches(fs, framework) {
237185
237188
  const { detectors } = framework;
@@ -237258,15 +237261,34 @@ async function matches(fs, framework) {
237258
237261
  detectedVersion,
237259
237262
  };
237260
237263
  }
237264
+ function removeSupersededFramework(matches, slug) {
237265
+ const index = matches.findIndex(f => f?.slug === slug);
237266
+ const framework = matches[index];
237267
+ if (framework) {
237268
+ if (framework.supersedes) {
237269
+ removeSupersededFramework(matches, framework.supersedes);
237270
+ }
237271
+ matches.splice(index, 1);
237272
+ }
237273
+ }
237274
+ function removeSupersededFrameworks(matches) {
237275
+ for (const match of matches.slice()) {
237276
+ if (match?.supersedes) {
237277
+ removeSupersededFramework(matches, match.supersedes);
237278
+ }
237279
+ }
237280
+ }
237281
+ exports.removeSupersededFrameworks = removeSupersededFrameworks;
237261
237282
  // TODO: Deprecate and replace with `detectFrameworkRecord`
237262
237283
  async function detectFramework({ fs, frameworkList, }) {
237263
237284
  const result = await Promise.all(frameworkList.map(async (frameworkMatch) => {
237264
237285
  if (await matches(fs, frameworkMatch)) {
237265
- return frameworkMatch.slug;
237286
+ return frameworkMatch;
237266
237287
  }
237267
237288
  return null;
237268
237289
  }));
237269
- return result.find(res => res !== null) ?? null;
237290
+ removeSupersededFrameworks(result);
237291
+ return result.find(res => res !== null)?.slug ?? null;
237270
237292
  }
237271
237293
  exports.detectFramework = detectFramework;
237272
237294
  /**
@@ -237279,6 +237301,7 @@ async function detectFrameworks({ fs, frameworkList, }) {
237279
237301
  }
237280
237302
  return null;
237281
237303
  }));
237304
+ removeSupersededFrameworks(result);
237282
237305
  return result.filter(res => res !== null);
237283
237306
  }
237284
237307
  exports.detectFrameworks = detectFrameworks;
@@ -237294,8 +237317,8 @@ async function detectFrameworkRecord({ fs, frameworkList, }) {
237294
237317
  }
237295
237318
  return null;
237296
237319
  }));
237297
- const frameworkRecord = result.find(res => res !== null) ?? null;
237298
- return frameworkRecord;
237320
+ removeSupersededFrameworks(result);
237321
+ return result.find(res => res !== null) ?? null;
237299
237322
  }
237300
237323
  exports.detectFrameworkRecord = detectFrameworkRecord;
237301
237324
  function detectFrameworkVersion(frameworkRecord) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "1.4.0",
3
+ "version": "2.0.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/build-step",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@vercel/gatsby-plugin-vercel-analytics": "1.0.10",
17
- "@vercel/gatsby-plugin-vercel-builder": "1.3.18"
17
+ "@vercel/gatsby-plugin-vercel-builder": "2.0.1"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@types/aws-lambda": "8.10.64",
@@ -26,17 +26,18 @@
26
26
  "@types/node-fetch": "2.5.4",
27
27
  "@types/promise-timeout": "1.3.0",
28
28
  "@types/semver": "7.3.13",
29
- "@vercel/build-utils": "6.8.3",
30
- "@vercel/error-utils": "1.0.10",
31
- "@vercel/frameworks": "1.6.0",
32
- "@vercel/fs-detectors": "4.1.3",
29
+ "@vercel/build-utils": "7.0.0",
30
+ "@vercel/error-utils": "2.0.1",
31
+ "@vercel/frameworks": "2.0.1",
32
+ "@vercel/fs-detectors": "5.0.1",
33
33
  "@vercel/ncc": "0.24.0",
34
- "@vercel/routing-utils": "2.2.1",
35
- "@vercel/static-config": "2.0.17",
34
+ "@vercel/routing-utils": "3.0.0",
35
+ "@vercel/static-config": "3.0.0",
36
36
  "execa": "3.2.0",
37
37
  "fs-extra": "10.0.0",
38
38
  "get-port": "5.0.0",
39
39
  "is-port-reachable": "2.0.1",
40
+ "jest-junit": "16.0.0",
40
41
  "ms": "2.1.2",
41
42
  "node-fetch": "2.6.7",
42
43
  "rc9": "1.2.0",
@@ -46,7 +47,7 @@
46
47
  },
47
48
  "scripts": {
48
49
  "build": "node build",
49
- "test": "jest --env node --verbose --bail --runInBand",
50
+ "test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail --runInBand",
50
51
  "test-unit": "pnpm test test/build.test.ts test/gatsby.test.ts test/prepare-cache.test.ts",
51
52
  "test-e2e": "pnpm test test/integration-*.test.js"
52
53
  }