@vercel/static-build 17.0.0 → 19.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 +144 -35
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -48191,7 +48191,8 @@ var require_get_workspace_package_paths = __commonJS({
48191
48191
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
48192
48192
  var get_workspace_package_paths_exports = {};
48193
48193
  __export2(get_workspace_package_paths_exports, {
48194
- getWorkspacePackagePaths: () => getWorkspacePackagePaths2
48194
+ getWorkspacePackagePaths: () => getWorkspacePackagePaths2,
48195
+ getWorkspacePatterns: () => getWorkspacePatterns
48195
48196
  });
48196
48197
  module2.exports = __toCommonJS2(get_workspace_package_paths_exports);
48197
48198
  var import_path7 = __toESM2(require("path"));
@@ -48207,22 +48208,13 @@ var require_get_workspace_package_paths = __commonJS({
48207
48208
  const { type, rootPath } = workspace;
48208
48209
  const workspaceFs = fs5.chdir(rootPath);
48209
48210
  let results = [];
48210
- switch (type) {
48211
- case "yarn":
48212
- case "npm":
48213
- results = await getPackageJsonWorkspacePackagePaths({ fs: workspaceFs });
48214
- break;
48215
- case "pnpm":
48216
- results = await getPnpmWorkspacePackagePaths({ fs: workspaceFs });
48217
- break;
48218
- case "nx":
48219
- results = await getNxWorkspacePackagePaths({ fs: workspaceFs });
48220
- break;
48221
- case "rush":
48222
- results = await getRushWorkspacePackagePaths({ fs: workspaceFs });
48223
- break;
48224
- default:
48225
- throw new Error(`Unknown workspace implementation: ${type}`);
48211
+ if (type === "nx") {
48212
+ results = await getNxWorkspacePackagePaths({ fs: workspaceFs });
48213
+ } else if (type === "rush") {
48214
+ results = await getRushWorkspacePackagePaths({ fs: workspaceFs });
48215
+ } else {
48216
+ const patterns = await getWorkspacePatterns({ fs: workspaceFs, type });
48217
+ results = await getPackagePaths(patterns, workspaceFs);
48226
48218
  }
48227
48219
  return results.map((packagePath) => {
48228
48220
  return posixPath.join(rootPath, posixPath.dirname(packagePath));
@@ -48251,20 +48243,27 @@ var require_get_workspace_package_paths = __commonJS({
48251
48243
  )
48252
48244
  )).flat();
48253
48245
  }
48254
- async function getPackageJsonWorkspacePackagePaths({
48255
- fs: fs5
48246
+ async function getWorkspacePatterns({
48247
+ fs: fs5,
48248
+ type
48256
48249
  }) {
48250
+ const stringPatterns = (value) => Array.isArray(value) ? value.filter(
48251
+ (pattern) => typeof pattern === "string"
48252
+ ) : [];
48253
+ if (type === "pnpm") {
48254
+ const pnpmWorkspaceAsBuffer = await fs5.readFile("pnpm-workspace.yaml");
48255
+ const { packages = [] } = import_js_yaml.default.load(
48256
+ pnpmWorkspaceAsBuffer.toString()
48257
+ );
48258
+ return stringPatterns(packages);
48259
+ }
48257
48260
  const packageJsonAsBuffer = await fs5.readFile("package.json");
48258
48261
  const { workspaces } = JSON.parse(
48259
48262
  packageJsonAsBuffer.toString()
48260
48263
  );
48261
- let packages = [];
48262
- if (Array.isArray(workspaces)) {
48263
- packages = workspaces;
48264
- } else {
48265
- packages = workspaces?.packages ?? [];
48266
- }
48267
- return getPackagePaths(packages, fs5);
48264
+ return stringPatterns(
48265
+ Array.isArray(workspaces) ? workspaces : workspaces?.packages
48266
+ );
48268
48267
  }
48269
48268
  async function getNxWorkspacePackagePaths({
48270
48269
  fs: fs5
@@ -48274,15 +48273,6 @@ var require_get_workspace_package_paths = __commonJS({
48274
48273
  const packages = Object.values(projects);
48275
48274
  return getPackagePaths(packages, fs5);
48276
48275
  }
48277
- async function getPnpmWorkspacePackagePaths({
48278
- fs: fs5
48279
- }) {
48280
- const pnpmWorkspaceAsBuffer = await fs5.readFile("pnpm-workspace.yaml");
48281
- const { packages = [] } = import_js_yaml.default.load(
48282
- pnpmWorkspaceAsBuffer.toString()
48283
- );
48284
- return getPackagePaths(packages, fs5);
48285
- }
48286
48276
  async function getRushWorkspacePackagePaths({
48287
48277
  fs: fs5
48288
48278
  }) {
@@ -48300,6 +48290,123 @@ var require_get_workspace_package_paths = __commonJS({
48300
48290
  }
48301
48291
  });
48302
48292
 
48293
+ // ../fs-detectors/dist/workspaces/resolve-workspace-package-targets.js
48294
+ var require_resolve_workspace_package_targets = __commonJS({
48295
+ "../fs-detectors/dist/workspaces/resolve-workspace-package-targets.js"(exports, module2) {
48296
+ "use strict";
48297
+ var __create2 = Object.create;
48298
+ var __defProp2 = Object.defineProperty;
48299
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
48300
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
48301
+ var __getProtoOf2 = Object.getPrototypeOf;
48302
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
48303
+ var __export2 = (target, all) => {
48304
+ for (var name in all)
48305
+ __defProp2(target, name, { get: all[name], enumerable: true });
48306
+ };
48307
+ var __copyProps2 = (to, from, except, desc) => {
48308
+ if (from && typeof from === "object" || typeof from === "function") {
48309
+ for (let key of __getOwnPropNames2(from))
48310
+ if (!__hasOwnProp2.call(to, key) && key !== except)
48311
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
48312
+ }
48313
+ return to;
48314
+ };
48315
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
48316
+ // If the importer is in node compatibility mode or this is not an ESM
48317
+ // file that has been converted to a CommonJS file using a Babel-
48318
+ // compatible transform (i.e. "__esModule" has not been set), then set
48319
+ // "default" to the CommonJS "module.exports" for node compatibility.
48320
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
48321
+ mod
48322
+ ));
48323
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
48324
+ var resolve_workspace_package_targets_exports = {};
48325
+ __export2(resolve_workspace_package_targets_exports, {
48326
+ resolveWorkspacePackageTargets: () => resolveWorkspacePackageTargets2
48327
+ });
48328
+ module2.exports = __toCommonJS2(resolve_workspace_package_targets_exports);
48329
+ var import_path7 = require("path");
48330
+ var import_minimatch = __toESM2(require_minimatch());
48331
+ var import_get_workspace_package_paths = require_get_workspace_package_paths();
48332
+ function normalize(value) {
48333
+ return value.replace(/\\/g, "/").replace(/^\.\//, "").replace(/^\//, "");
48334
+ }
48335
+ function matchesWorkspace(relativePath, patterns) {
48336
+ const positives = patterns.filter((pattern) => !pattern.startsWith("!")).map(normalize);
48337
+ const negatives = patterns.filter((pattern) => pattern.startsWith("!")).map((pattern) => normalize(pattern.slice(1)));
48338
+ return positives.some((pattern) => (0, import_minimatch.default)(relativePath, pattern)) && !negatives.some((pattern) => (0, import_minimatch.default)(relativePath, pattern));
48339
+ }
48340
+ async function readPackage(fs5, packageJsonPath) {
48341
+ try {
48342
+ const packageJson = JSON.parse(
48343
+ (await fs5.readFile(packageJsonPath)).toString()
48344
+ );
48345
+ return {
48346
+ name: typeof packageJson.name === "string" ? packageJson.name : void 0
48347
+ };
48348
+ } catch {
48349
+ return null;
48350
+ }
48351
+ }
48352
+ async function findPackage(fs5, targetPath) {
48353
+ if (targetPath.startsWith("/") || /^[A-Za-z]:[\\/]/.test(targetPath) || normalize(targetPath) === ".." || normalize(targetPath).startsWith("../")) {
48354
+ return null;
48355
+ }
48356
+ let relativePath = normalize(targetPath);
48357
+ while (relativePath && relativePath !== ".") {
48358
+ const packageJsonPath = import_path7.posix.join(relativePath, "package.json");
48359
+ const packageJson = await readPackage(fs5, packageJsonPath);
48360
+ if (packageJson) {
48361
+ return {
48362
+ name: packageJson.name,
48363
+ packageJsonPath,
48364
+ relativePath
48365
+ };
48366
+ }
48367
+ const parent = import_path7.posix.dirname(relativePath);
48368
+ if (parent === relativePath || parent === ".")
48369
+ return null;
48370
+ relativePath = parent;
48371
+ }
48372
+ return null;
48373
+ }
48374
+ async function resolveWorkspacePackageTargets2({
48375
+ fs: fs5,
48376
+ targetPaths,
48377
+ type
48378
+ }) {
48379
+ let patterns;
48380
+ try {
48381
+ patterns = await (0, import_get_workspace_package_paths.getWorkspacePatterns)({ fs: fs5, type });
48382
+ } catch {
48383
+ return null;
48384
+ }
48385
+ if (patterns.length === 0)
48386
+ return null;
48387
+ const targets = /* @__PURE__ */ new Map();
48388
+ for (const targetPath of targetPaths) {
48389
+ const target = await findPackage(fs5, targetPath);
48390
+ if (!target || !matchesWorkspace(target.relativePath, patterns))
48391
+ return null;
48392
+ targets.set(target.packageJsonPath, target);
48393
+ }
48394
+ const rootPackageJson = await readPackage(fs5, "package.json");
48395
+ if (rootPackageJson) {
48396
+ targets.set("package.json", {
48397
+ isRoot: true,
48398
+ name: rootPackageJson.name,
48399
+ packageJsonPath: "package.json",
48400
+ relativePath: "."
48401
+ });
48402
+ }
48403
+ return Array.from(targets.values()).sort(
48404
+ (a, b) => a.relativePath.localeCompare(b.relativePath)
48405
+ );
48406
+ }
48407
+ }
48408
+ });
48409
+
48303
48410
  // ../fs-detectors/dist/monorepos/monorepo-managers.js
48304
48411
  var require_monorepo_managers = __commonJS({
48305
48412
  "../fs-detectors/dist/monorepos/monorepo-managers.js"(exports, module2) {
@@ -48897,6 +49004,7 @@ var require_dist9 = __commonJS({
48897
49004
  resolveAllConfiguredServices: () => import_resolve.resolveAllConfiguredServices,
48898
49005
  resolveAllConfiguredServicesV2: () => import_resolve_v2.resolveAllConfiguredServicesV2,
48899
49006
  resolveConfiguredServiceV2: () => import_resolve_v2.resolveConfiguredServiceV2,
49007
+ resolveWorkspacePackageTargets: () => import_resolve_workspace_package_targets.resolveWorkspacePackageTargets,
48900
49008
  validateProxy: () => import_detect_builders.validateProxy,
48901
49009
  validateProxyConfig: () => import_detect_builders.validateProxyConfig,
48902
49010
  validateServiceConfigV2: () => import_resolve_v2.validateServiceConfigV2,
@@ -48919,6 +49027,7 @@ var require_dist9 = __commonJS({
48919
49027
  var import_workspace_managers = require_workspace_managers();
48920
49028
  var import_get_workspaces = require_get_workspaces();
48921
49029
  var import_get_workspace_package_paths = require_get_workspace_package_paths();
49030
+ var import_resolve_workspace_package_targets = require_resolve_workspace_package_targets();
48922
49031
  var import_monorepo_managers = require_monorepo_managers();
48923
49032
  var import_is_official_runtime = require_is_official_runtime();
48924
49033
  var import_package_managers = require_package_managers();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "17.0.0",
3
+ "version": "19.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/gatsby-plugin-vercel-analytics": "1.0.12",
17
+ "@vercel/gatsby-plugin-vercel-builder": "2.2.69",
18
18
  "@vercel/static-config": "3.4.4",
19
- "@vercel/gatsby-plugin-vercel-builder": "2.2.67"
19
+ "@vercel/gatsby-plugin-vercel-analytics": "1.0.12"
20
20
  },
21
21
  "peerDependencies": {
22
- "@vercel/build-utils": "14.17.0"
22
+ "@vercel/build-utils": "14.19.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.17.0",
44
- "@vercel/error-utils": "2.2.1",
43
+ "@vercel/build-utils": "14.19.0",
45
44
  "@vercel/frameworks": "3.35.0",
46
- "@vercel/fs-detectors": "7.9.2",
47
- "@vercel/routing-utils": "6.6.0"
45
+ "@vercel/routing-utils": "6.6.0",
46
+ "@vercel/fs-detectors": "7.9.4",
47
+ "@vercel/error-utils": "2.2.1"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "node ../../utils/build-builder.mjs",