@vercel/static-build 2.9.22 → 2.9.23

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 +53 -28
  2. package/package.json +12 -10
package/dist/index.js CHANGED
@@ -7192,7 +7192,7 @@ var require_frameworks = __commonJS({
7192
7192
  demo: "https://nextjs-template.vercel.app",
7193
7193
  logo: "https://api-frameworks.vercel.sh/framework-logos/next.svg",
7194
7194
  darkModeLogo: "https://api-frameworks.vercel.sh/framework-logos/next-dark.svg",
7195
- screenshot: "https://assets.vercel.com/image/upload/v1701461207/front/import/nextjs.png",
7195
+ screenshot: "https://py8fhxnkzwtsqdo9.public.blob.vercel-storage.com/front/import/nextjs.png",
7196
7196
  tagline: "Next.js makes you productive with React instantly \u2014 whether you want to build static or dynamic sites.",
7197
7197
  description: "A Next.js app and a Serverless Function API.",
7198
7198
  website: "https://nextjs.org",
@@ -8164,7 +8164,7 @@ var require_frameworks = __commonJS({
8164
8164
  slug: "sveltekit",
8165
8165
  demo: "https://sveltekit-template.vercel.app",
8166
8166
  logo: "https://api-frameworks.vercel.sh/framework-logos/svelte.svg",
8167
- screenshot: "https://assets.vercel.com/image/upload/v1647366075/front/import/sveltekit.png",
8167
+ screenshot: "https://py8fhxnkzwtsqdo9.public.blob.vercel-storage.com/front/import/sveltekit.png",
8168
8168
  tagline: "SvelteKit is a framework for building web applications of all sizes.",
8169
8169
  description: "A SvelteKit legacy app optimized Edge-first.",
8170
8170
  website: "https://kit.svelte.dev",
@@ -8202,7 +8202,7 @@ var require_frameworks = __commonJS({
8202
8202
  slug: "sveltekit-1",
8203
8203
  demo: "https://sveltekit-1-template.vercel.app",
8204
8204
  logo: "https://api-frameworks.vercel.sh/framework-logos/svelte.svg",
8205
- screenshot: "https://assets.vercel.com/image/upload/v1647366075/front/import/sveltekit.png",
8205
+ screenshot: "https://py8fhxnkzwtsqdo9.public.blob.vercel-storage.com/front/import/sveltekit.png",
8206
8206
  tagline: "SvelteKit is a framework for building web applications of all sizes.",
8207
8207
  description: "A SvelteKit app optimized Edge-first.",
8208
8208
  website: "https://kit.svelte.dev",
@@ -8575,7 +8575,7 @@ var require_frameworks = __commonJS({
8575
8575
  slug: "nuxtjs",
8576
8576
  demo: "https://nuxtjs-template.vercel.app",
8577
8577
  logo: "https://api-frameworks.vercel.sh/framework-logos/nuxt.svg",
8578
- screenshot: "https://assets.vercel.com/image/upload/v1647366075/front/import/nuxtjs.png",
8578
+ screenshot: "https://py8fhxnkzwtsqdo9.public.blob.vercel-storage.com/front/import/nuxtjs.png",
8579
8579
  tagline: "Nuxt is the open source framework that makes full-stack development with Vue.js intuitive.",
8580
8580
  description: "A Nuxt app, bootstrapped with create-nuxt-app.",
8581
8581
  website: "https://nuxt.com",
@@ -23037,7 +23037,10 @@ var require_resolve = __commonJS({
23037
23037
  }
23038
23038
  const serviceType = config.type || "web";
23039
23039
  const isJobService = serviceType === "job" || serviceType === "cron";
23040
- const isScheduleJobService = serviceType === "cron" || serviceType === "job" && config.trigger === "schedule";
23040
+ const isScheduleJobService = (0, import_build_utils5.isScheduleTriggeredService)({
23041
+ type: serviceType,
23042
+ trigger: config.trigger
23043
+ });
23041
23044
  const isQueueJobService = serviceType === "job" && config.trigger === "queue";
23042
23045
  const isWorkflowService = serviceType === "job" && config.trigger === "workflow";
23043
23046
  const isNonWebService = serviceType === "worker" || isJobService;
@@ -23282,7 +23285,8 @@ var require_resolve = __commonJS({
23282
23285
  builderUse = config.builder;
23283
23286
  builderSrc = resolvedEntrypointFile || frameworkDefinition?.useRuntime?.src || "package.json";
23284
23287
  } else if (config.framework) {
23285
- if (type === "web" && (0, import_build_utils22.isNodeBackendFramework)(config.framework)) {
23288
+ const isCronService = (0, import_build_utils5.isScheduleTriggeredService)({ type, trigger });
23289
+ if ((0, import_build_utils22.isNodeBackendFramework)(config.framework) && (type === "web" || isCronService)) {
23286
23290
  builderUse = "@vercel/backends";
23287
23291
  } else {
23288
23292
  builderUse = frameworkDefinition?.useRuntime?.use || "@vercel/static-build";
@@ -23295,7 +23299,8 @@ var require_resolve = __commonJS({
23295
23299
  );
23296
23300
  }
23297
23301
  if (inferredRuntime === "node") {
23298
- builderUse = type === "web" ? "@vercel/backends" : "@vercel/node";
23302
+ const isCronService = (0, import_build_utils5.isScheduleTriggeredService)({ type, trigger });
23303
+ builderUse = type === "web" || isCronService ? "@vercel/backends" : "@vercel/node";
23299
23304
  } else {
23300
23305
  builderUse = (0, import_utils.getBuilderForRuntime)(inferredRuntime);
23301
23306
  }
@@ -24048,6 +24053,7 @@ var require_detect_services = __commonJS({
24048
24053
  hostRewrites: [],
24049
24054
  rewrites: [],
24050
24055
  defaults: [],
24056
+ fallbacks: [],
24051
24057
  crons: [],
24052
24058
  workers: []
24053
24059
  };
@@ -24197,6 +24203,7 @@ var require_detect_services = __commonJS({
24197
24203
  const hostRewrites = [];
24198
24204
  const rewrites = [];
24199
24205
  const defaults = [];
24206
+ const fallbacks = [];
24200
24207
  const crons = [];
24201
24208
  const workers = [];
24202
24209
  const sortedWebServices = services.filter(
@@ -24233,13 +24240,12 @@ var require_detect_services = __commonJS({
24233
24240
  }
24234
24241
  if ((0, import_utils.isStaticBuild)(service)) {
24235
24242
  if (routePrefix === "/") {
24236
- defaults.push({ handle: "filesystem" });
24237
- defaults.push({
24243
+ fallbacks.push({
24238
24244
  src: (0, import_routing_utils.scopeRouteSourceToOwnership)("/(.*)", ownershipGuard),
24239
24245
  dest: "/index.html"
24240
24246
  });
24241
24247
  } else {
24242
- rewrites.push({
24248
+ fallbacks.push({
24243
24249
  src: (0, import_routing_utils.scopeRouteSourceToOwnership)(
24244
24250
  `^/${normalizedPrefix}(?:/.*)?$`,
24245
24251
  ownershipGuard
@@ -24277,7 +24283,7 @@ var require_detect_services = __commonJS({
24277
24283
  check: true
24278
24284
  });
24279
24285
  }
24280
- return { hostRewrites, rewrites, defaults, crons, workers };
24286
+ return { hostRewrites, rewrites, defaults, fallbacks, crons, workers };
24281
24287
  }
24282
24288
  function escapeRegex(str) {
24283
24289
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -24539,8 +24545,31 @@ var require_get_services_builders = __commonJS({
24539
24545
  module2.exports = __toCommonJS2(get_services_builders_exports);
24540
24546
  var import_detect_services = require_detect_services();
24541
24547
  var import_local_file_system_detector = require_local_file_system_detector();
24548
+ function isExperimentalServicesAutoDetectionEnabled() {
24549
+ const env = process.env.VERCEL_USE_EXPERIMENTAL_SERVICES;
24550
+ return env === "1" || env?.toLowerCase() === "true";
24551
+ }
24542
24552
  async function getServicesBuilders2(options) {
24543
- const { workPath } = options;
24553
+ const { workPath, configuredServices, projectFramework } = options;
24554
+ const hasServiceDefinitions = configuredServices != null && Object.keys(configuredServices).length > 0;
24555
+ if (projectFramework === "services" && !hasServiceDefinitions && !isExperimentalServicesAutoDetectionEnabled()) {
24556
+ return {
24557
+ builders: null,
24558
+ errors: [
24559
+ {
24560
+ code: "MISSING_EXPERIMENTAL_SERVICES",
24561
+ message: 'Project framework is set to "services", but no services are declared. Add `experimentalServices` to vercel.json with at least one service, or change the project framework setting.'
24562
+ }
24563
+ ],
24564
+ warnings: [],
24565
+ hostRewriteRoutes: null,
24566
+ defaultRoutes: null,
24567
+ fallbackRoutes: null,
24568
+ redirectRoutes: null,
24569
+ rewriteRoutes: null,
24570
+ errorRoutes: null
24571
+ };
24572
+ }
24544
24573
  if (!workPath) {
24545
24574
  return {
24546
24575
  builders: null,
@@ -24553,6 +24582,7 @@ var require_get_services_builders = __commonJS({
24553
24582
  warnings: [],
24554
24583
  hostRewriteRoutes: null,
24555
24584
  defaultRoutes: null,
24585
+ fallbackRoutes: null,
24556
24586
  redirectRoutes: null,
24557
24587
  rewriteRoutes: null,
24558
24588
  errorRoutes: null
@@ -24574,6 +24604,7 @@ var require_get_services_builders = __commonJS({
24574
24604
  warnings: warningResponses,
24575
24605
  hostRewriteRoutes: null,
24576
24606
  defaultRoutes: null,
24607
+ fallbackRoutes: null,
24577
24608
  redirectRoutes: null,
24578
24609
  rewriteRoutes: null,
24579
24610
  errorRoutes: null
@@ -24591,6 +24622,7 @@ var require_get_services_builders = __commonJS({
24591
24622
  warnings: warningResponses,
24592
24623
  hostRewriteRoutes: null,
24593
24624
  defaultRoutes: null,
24625
+ fallbackRoutes: null,
24594
24626
  redirectRoutes: null,
24595
24627
  rewriteRoutes: null,
24596
24628
  errorRoutes: null
@@ -24603,6 +24635,7 @@ var require_get_services_builders = __commonJS({
24603
24635
  warnings: warningResponses,
24604
24636
  hostRewriteRoutes: result.routes.hostRewrites.length > 0 ? result.routes.hostRewrites : null,
24605
24637
  defaultRoutes: result.routes.defaults.length > 0 ? result.routes.defaults : null,
24638
+ fallbackRoutes: result.routes.fallbacks.length > 0 ? result.routes.fallbacks : null,
24606
24639
  redirectRoutes: [],
24607
24640
  rewriteRoutes: result.routes.rewrites.length > 0 || result.routes.workers.length > 0 || result.routes.crons.length > 0 ? [
24608
24641
  ...result.routes.rewrites,
@@ -24718,7 +24751,9 @@ var require_detect_builders = __commonJS({
24718
24751
  const hasServicesConfig = services != null && typeof services === "object";
24719
24752
  if (hasServicesConfig || framework === "services") {
24720
24753
  return (0, import_get_services_builders.getServicesBuilders)({
24721
- workPath: options.workPath
24754
+ workPath: options.workPath,
24755
+ configuredServices: services,
24756
+ projectFramework: framework
24722
24757
  });
24723
24758
  }
24724
24759
  const errors = [];
@@ -25649,11 +25684,9 @@ var require_detect_file_system_api = __commonJS({
25649
25684
  var require_get_project_paths = __commonJS({
25650
25685
  "../fs-detectors/dist/get-project-paths.js"(exports, module2) {
25651
25686
  "use strict";
25652
- var __create2 = Object.create;
25653
25687
  var __defProp2 = Object.defineProperty;
25654
25688
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
25655
25689
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
25656
- var __getProtoOf2 = Object.getPrototypeOf;
25657
25690
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
25658
25691
  var __export2 = (target, all) => {
25659
25692
  for (var name in all)
@@ -25667,14 +25700,6 @@ var require_get_project_paths = __commonJS({
25667
25700
  }
25668
25701
  return to;
25669
25702
  };
25670
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
25671
- // If the importer is in node compatibility mode or this is not an ESM
25672
- // file that has been converted to a CommonJS file using a Babel-
25673
- // compatible transform (i.e. "__esModule" has not been set), then set
25674
- // "default" to the CommonJS "module.exports" for node compatibility.
25675
- isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
25676
- mod
25677
- ));
25678
25703
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
25679
25704
  var get_project_paths_exports = {};
25680
25705
  __export2(get_project_paths_exports, {
@@ -25682,7 +25707,7 @@ var require_get_project_paths = __commonJS({
25682
25707
  });
25683
25708
  module2.exports = __toCommonJS2(get_project_paths_exports);
25684
25709
  var import_detect_framework = require_detect_framework();
25685
- var import_frameworks2 = __toESM2(require_frameworks());
25710
+ var import_frameworks2 = require_frameworks();
25686
25711
  var MAX_DEPTH_TRAVERSE = 3;
25687
25712
  var getProjectPaths2 = async ({
25688
25713
  fs: fs5,
@@ -25699,7 +25724,7 @@ var require_get_project_paths = __commonJS({
25699
25724
  }
25700
25725
  const framework = await (0, import_detect_framework.detectFramework)({
25701
25726
  fs: fs5.chdir(topPath),
25702
- frameworkList: import_frameworks2.default
25727
+ frameworkList: import_frameworks2.frameworkList
25703
25728
  });
25704
25729
  if (framework !== null)
25705
25730
  allPaths.push(topPath);
@@ -33980,7 +34005,7 @@ function getFramework(config, pkg) {
33980
34005
  }
33981
34006
  const { framework: configFramework = null } = config || {};
33982
34007
  if (configFramework) {
33983
- const framework2 = import_frameworks.default.find(({ slug }) => slug === configFramework);
34008
+ const framework2 = import_frameworks.frameworkList.find(({ slug }) => slug === configFramework);
33984
34009
  if (framework2) {
33985
34010
  return framework2;
33986
34011
  }
@@ -33989,7 +34014,7 @@ function getFramework(config, pkg) {
33989
34014
  return;
33990
34015
  }
33991
34016
  const dependencies = Object.assign({}, pkg.dependencies, pkg.devDependencies);
33992
- const framework = import_frameworks.default.find(
34017
+ const framework = import_frameworks.frameworkList.find(
33993
34018
  ({ dependency }) => dependencies[dependency || ""]
33994
34019
  );
33995
34020
  return framework;
@@ -34050,7 +34075,7 @@ var build = async ({
34050
34075
  const localFileSystemDetector = new import_fs_detectors.LocalFileSystemDetector(workPath);
34051
34076
  const { detectedVersion = null } = await (0, import_fs_detectors.detectFrameworkRecord)({
34052
34077
  fs: localFileSystemDetector,
34053
- frameworkList: import_frameworks.default
34078
+ frameworkList: import_frameworks.frameworkList
34054
34079
  }) ?? {};
34055
34080
  const devCommand = getCommand("dev", pkg, config, framework);
34056
34081
  const buildCommand = getCommand("build", pkg, config, framework);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "2.9.22",
3
+ "version": "2.9.23",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/build-step",
@@ -16,13 +16,12 @@
16
16
  "ts-morph": "12.0.0",
17
17
  "@vercel/gatsby-plugin-vercel-analytics": "1.0.11",
18
18
  "@vercel/static-config": "3.3.0",
19
- "@vercel/gatsby-plugin-vercel-builder": "2.2.0"
19
+ "@vercel/gatsby-plugin-vercel-builder": "2.2.1"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/aws-lambda": "8.10.64",
23
23
  "@types/cross-spawn": "6.0.0",
24
24
  "@types/fs-extra": "9.0.13",
25
- "@types/jest": "27.4.1",
26
25
  "@types/ms": "0.7.31",
27
26
  "@types/node": "20.11.0",
28
27
  "@types/node-fetch": "2.5.4",
@@ -32,23 +31,26 @@
32
31
  "fs-extra": "10.0.0",
33
32
  "get-port": "5.0.0",
34
33
  "is-port-reachable": "2.0.1",
35
- "jest-junit": "16.0.0",
36
34
  "ms": "2.1.2",
37
35
  "node-fetch": "2.6.7",
38
36
  "rc9": "1.2.0",
39
37
  "semver": "7.5.2",
40
38
  "tree-kill": "1.2.2",
41
- "@vercel/build-utils": "13.21.0",
42
- "@vercel/frameworks": "3.25.0",
39
+ "vitest": "2.0.3",
40
+ "@vercel/build-utils": "13.22.0",
43
41
  "@vercel/error-utils": "2.1.0",
44
- "@vercel/routing-utils": "6.2.0",
45
- "@vercel/fs-detectors": "6.1.0"
42
+ "@vercel/frameworks": "3.25.1",
43
+ "@vercel/fs-detectors": "6.2.0",
44
+ "@vercel/routing-utils": "6.2.0"
46
45
  },
47
46
  "scripts": {
48
47
  "build": "node ../../utils/build-builder.mjs",
49
- "test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail --runInBand",
48
+ "test": "vitest run --config ../../vitest.config.mts",
50
49
  "test-unit": "pnpm test test/build.test.ts test/hugo.test.ts test/gatsby.test.ts test/prepare-cache.test.ts",
51
50
  "test-e2e": "pnpm test test/integration-*.test.js",
52
- "type-check": "tsc --noEmit"
51
+ "type-check": "tsc --noEmit",
52
+ "vitest-run": "vitest -c ../../vitest.config.mts",
53
+ "vitest-unit": "glob --absolute 'test/build.test.ts' 'test/hugo.test.ts' 'test/gatsby.test.ts' 'test/prepare-cache.test.ts'",
54
+ "vitest-e2e": "glob --absolute 'test/integration-*.test.js'"
53
55
  }
54
56
  }