@vercel/static-build 14.0.0 → 15.0.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.
Files changed (2) hide show
  1. package/dist/index.js +48 -4
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -32461,7 +32461,11 @@ var require_detect_builders = __commonJS({
32461
32461
  return false;
32462
32462
  }
32463
32463
  }
32464
- var BUILDPACK_PROJECT_MARKERS = /* @__PURE__ */ new Map([["ruby", ["Gemfile"]]]);
32464
+ var BUILDPACK_PROJECT_MARKERS = /* @__PURE__ */ new Map([
32465
+ ["ruby", ["Gemfile"]],
32466
+ ["go", ["go.mod"]],
32467
+ ["rust", ["Cargo.toml"]]
32468
+ ]);
32465
32469
  function isBuildpackRuntimeEnabled(runtime) {
32466
32470
  return process.env[`VERCEL_EXPERIMENTAL_BUILDPACK_${runtime.toUpperCase()}`] === "1";
32467
32471
  }
@@ -32751,7 +32755,7 @@ var require_detect_builders = __commonJS({
32751
32755
  builders.push(...apiBuilders);
32752
32756
  }
32753
32757
  if (frontendBuilder) {
32754
- if (isOfficialRuntime2("express", frontendBuilder?.use) || isOfficialRuntime2("hono", frontendBuilder?.use) || isOfficialRuntime2("python", frontendBuilder?.use) || isOfficialRuntime2("go", frontendBuilder?.use) || isOfficialRuntime2("backends", frontendBuilder?.use)) {
32758
+ if (isOfficialRuntime2("express", frontendBuilder?.use) || isOfficialRuntime2("hono", frontendBuilder?.use) || isOfficialRuntime2("python", frontendBuilder?.use) || isOfficialRuntime2("go", frontendBuilder?.use) || isOfficialRuntime2("container", frontendBuilder?.use) && (frontendBuilder.config?.buildpack === "go" || frontendBuilder.config?.buildpack === "rust") || isOfficialRuntime2("backends", frontendBuilder?.use)) {
32755
32759
  builders.push({
32756
32760
  src: "public/**/*",
32757
32761
  use: "@vercel/static",
@@ -36262,12 +36266,17 @@ var require_buildpack_runtimes = __commonJS({
36262
36266
  var buildpack_runtimes_exports = {};
36263
36267
  __export2(buildpack_runtimes_exports, {
36264
36268
  BUILDPACK_PROJECT_MARKERS: () => BUILDPACK_PROJECT_MARKERS,
36269
+ getGoPackageName: () => getGoPackageName,
36265
36270
  hasBuildpackProjectMarker: () => hasBuildpackProjectMarker,
36266
36271
  isBuildpackRuntimeEnabled: () => isBuildpackRuntimeEnabled,
36267
36272
  toBuildpackRuntime: () => toBuildpackRuntime
36268
36273
  });
36269
36274
  module2.exports = __toCommonJS2(buildpack_runtimes_exports);
36270
- var BUILDPACK_PROJECT_MARKERS = /* @__PURE__ */ new Map([["ruby", ["Gemfile"]]]);
36275
+ var BUILDPACK_PROJECT_MARKERS = /* @__PURE__ */ new Map([
36276
+ ["ruby", ["Gemfile"]],
36277
+ ["go", ["go.mod"]],
36278
+ ["rust", ["Cargo.toml"]]
36279
+ ]);
36271
36280
  function isBuildpackRuntimeEnabled(runtime) {
36272
36281
  return process.env[`VERCEL_EXPERIMENTAL_BUILDPACK_${runtime.toUpperCase()}`] === "1";
36273
36282
  }
@@ -36285,6 +36294,26 @@ var require_buildpack_runtimes = __commonJS({
36285
36294
  }
36286
36295
  return false;
36287
36296
  }
36297
+ function getGoPackageName(source) {
36298
+ let rest = source.replace(/^\uFEFF/, "");
36299
+ for (; ; ) {
36300
+ rest = rest.trimStart();
36301
+ if (rest.startsWith("//")) {
36302
+ const newline = rest.indexOf("\n");
36303
+ if (newline === -1)
36304
+ return void 0;
36305
+ rest = rest.slice(newline + 1);
36306
+ } else if (rest.startsWith("/*")) {
36307
+ const end = rest.indexOf("*/", 2);
36308
+ if (end === -1)
36309
+ return void 0;
36310
+ rest = rest.slice(end + 2);
36311
+ } else {
36312
+ break;
36313
+ }
36314
+ }
36315
+ return /^package\s+([\p{L}_][\p{L}\p{N}_]*)/u.exec(rest)?.[1];
36316
+ }
36288
36317
  }
36289
36318
  });
36290
36319
 
@@ -38846,6 +38875,14 @@ var require_resolve_v2 = __commonJS({
38846
38875
  }
38847
38876
  return void 0;
38848
38877
  }
38878
+ async function isGoMainPackage(serviceFs, entrypoint) {
38879
+ try {
38880
+ const source = await serviceFs.readFile(entrypoint);
38881
+ return (0, import_buildpack_runtimes.getGoPackageName)(source.toString("utf8")) === "main";
38882
+ } catch {
38883
+ return false;
38884
+ }
38885
+ }
38849
38886
  function normalizeContainerCommand(command) {
38850
38887
  if (command === void 0) {
38851
38888
  return void 0;
@@ -39044,7 +39081,10 @@ var require_resolve_v2 = __commonJS({
39044
39081
  }
39045
39082
  };
39046
39083
  }
39047
- const buildpackRuntime = flaggedBuildpackRuntime && (!entrypointFile || flaggedBuildpackRuntime === "ruby" && entrypointFile === "config.ru") && !(0, import_framework.isFrontendFramework)(framework) && await (0, import_buildpack_runtimes.hasBuildpackProjectMarker)(
39084
+ const buildpackRuntime = flaggedBuildpackRuntime && (!entrypointFile || // The Ruby buildpack discovers config.ru at the service root itself.
39085
+ flaggedBuildpackRuntime === "ruby" && entrypointFile === "config.ru" || // A Go `package main` entrypoint is a standalone server the buildpack
39086
+ // builds from the entrypoint's package.
39087
+ flaggedBuildpackRuntime === "go" && await isGoMainPackage(serviceFs, entrypointFile)) && !(0, import_framework.isFrontendFramework)(framework) && await (0, import_buildpack_runtimes.hasBuildpackProjectMarker)(
39048
39088
  flaggedBuildpackRuntime,
39049
39089
  (marker) => (0, import_utils.hasFile)(serviceFs, marker)
39050
39090
  ) ? flaggedBuildpackRuntime : void 0;
@@ -39110,6 +39150,10 @@ var require_resolve_v2 = __commonJS({
39110
39150
  }
39111
39151
  if (buildpackRuntime) {
39112
39152
  builderConfig.buildpack = buildpackRuntime;
39153
+ const goEntrypoint = buildpackRuntime === "go" && normalizedEntrypoint ? (0, import_entrypoint.stripTrailingSlash)(normalizedEntrypoint) : void 0;
39154
+ if (goEntrypoint && goEntrypoint !== ".") {
39155
+ builderConfig.buildpackEntrypoint = goEntrypoint;
39156
+ }
39113
39157
  }
39114
39158
  if (config.outputDirectory) {
39115
39159
  builderConfig.outputDirectory = config.outputDirectory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "14.0.0",
3
+ "version": "15.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/build-step",
@@ -14,12 +14,12 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "ts-morph": "12.0.0",
17
+ "@vercel/static-config": "3.4.4",
17
18
  "@vercel/gatsby-plugin-vercel-analytics": "1.0.12",
18
- "@vercel/gatsby-plugin-vercel-builder": "2.2.64",
19
- "@vercel/static-config": "3.4.4"
19
+ "@vercel/gatsby-plugin-vercel-builder": "2.2.65"
20
20
  },
21
21
  "peerDependencies": {
22
- "@vercel/build-utils": "14.14.0"
22
+ "@vercel/build-utils": "14.15.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/aws-lambda": "8.10.64",
@@ -40,11 +40,11 @@
40
40
  "semver": "7.5.2",
41
41
  "tree-kill": "1.2.2",
42
42
  "vitest": "4.1.10",
43
- "@vercel/build-utils": "14.14.0",
44
- "@vercel/error-utils": "2.2.1",
43
+ "@vercel/build-utils": "14.15.0",
45
44
  "@vercel/frameworks": "3.35.0",
45
+ "@vercel/fs-detectors": "7.9.0",
46
46
  "@vercel/routing-utils": "6.6.0",
47
- "@vercel/fs-detectors": "7.8.1"
47
+ "@vercel/error-utils": "2.2.1"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "node ../../utils/build-builder.mjs",