@vercel/static-build 2.8.25 → 2.8.27

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 +189 -4
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -20351,6 +20351,168 @@ var require_detect_builders = __commonJS({
20351
20351
  }
20352
20352
  });
20353
20353
 
20354
+ // ../fs-detectors/dist/services/resolve.js
20355
+ var require_resolve = __commonJS({
20356
+ "../fs-detectors/dist/services/resolve.js"(exports2, module2) {
20357
+ "use strict";
20358
+ var __defProp2 = Object.defineProperty;
20359
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
20360
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
20361
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
20362
+ var __export2 = (target, all) => {
20363
+ for (var name in all)
20364
+ __defProp2(target, name, { get: all[name], enumerable: true });
20365
+ };
20366
+ var __copyProps2 = (to, from, except, desc) => {
20367
+ if (from && typeof from === "object" || typeof from === "function") {
20368
+ for (let key of __getOwnPropNames2(from))
20369
+ if (!__hasOwnProp2.call(to, key) && key !== except)
20370
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
20371
+ }
20372
+ return to;
20373
+ };
20374
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
20375
+ var resolve_exports = {};
20376
+ __export2(resolve_exports, {
20377
+ resolveService: () => resolveService,
20378
+ validateServiceConfig: () => validateServiceConfig
20379
+ });
20380
+ module2.exports = __toCommonJS2(resolve_exports);
20381
+ function validateServiceConfig(name, config) {
20382
+ if (config.type === "cron" && !config.schedule) {
20383
+ return {
20384
+ code: "MISSING_CRON_SCHEDULE",
20385
+ message: `Cron service "${name}" is missing required "schedule" field`,
20386
+ serviceName: name
20387
+ };
20388
+ }
20389
+ return null;
20390
+ }
20391
+ function resolveService(name, config, group) {
20392
+ const type = config.type || "web";
20393
+ const workspace = config.workspace || ".";
20394
+ const topic = type === "worker" ? config.topic || "default" : config.topic;
20395
+ const consumer = type === "worker" ? config.consumer || "default" : config.consumer;
20396
+ return {
20397
+ name,
20398
+ type,
20399
+ group,
20400
+ workspace,
20401
+ entrypoint: config.entrypoint,
20402
+ routePrefix: config.routePrefix,
20403
+ framework: config.framework,
20404
+ builder: config.builder,
20405
+ runtime: config.runtime,
20406
+ buildCommand: config.buildCommand,
20407
+ installCommand: config.installCommand,
20408
+ memory: config.memory,
20409
+ maxDuration: config.maxDuration,
20410
+ includeFiles: config.includeFiles,
20411
+ excludeFiles: config.excludeFiles,
20412
+ schedule: config.schedule,
20413
+ topic,
20414
+ consumer
20415
+ };
20416
+ }
20417
+ }
20418
+ });
20419
+
20420
+ // ../fs-detectors/dist/services/types.js
20421
+ var require_types2 = __commonJS({
20422
+ "../fs-detectors/dist/services/types.js"(exports2, module2) {
20423
+ "use strict";
20424
+ var __defProp2 = Object.defineProperty;
20425
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
20426
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
20427
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
20428
+ var __export2 = (target, all) => {
20429
+ for (var name in all)
20430
+ __defProp2(target, name, { get: all[name], enumerable: true });
20431
+ };
20432
+ var __copyProps2 = (to, from, except, desc) => {
20433
+ if (from && typeof from === "object" || typeof from === "function") {
20434
+ for (let key of __getOwnPropNames2(from))
20435
+ if (!__hasOwnProp2.call(to, key) && key !== except)
20436
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
20437
+ }
20438
+ return to;
20439
+ };
20440
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
20441
+ var types_exports = {};
20442
+ __export2(types_exports, {
20443
+ RUNTIME_BUILDERS: () => RUNTIME_BUILDERS
20444
+ });
20445
+ module2.exports = __toCommonJS2(types_exports);
20446
+ var RUNTIME_BUILDERS = {
20447
+ node: "@vercel/node",
20448
+ python: "@vercel/python",
20449
+ go: "@vercel/go",
20450
+ rust: "@vercel/rust",
20451
+ ruby: "@vercel/ruby"
20452
+ };
20453
+ }
20454
+ });
20455
+
20456
+ // ../fs-detectors/dist/services/index.js
20457
+ var require_services = __commonJS({
20458
+ "../fs-detectors/dist/services/index.js"(exports2, module2) {
20459
+ "use strict";
20460
+ var __defProp2 = Object.defineProperty;
20461
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
20462
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
20463
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
20464
+ var __export2 = (target, all) => {
20465
+ for (var name in all)
20466
+ __defProp2(target, name, { get: all[name], enumerable: true });
20467
+ };
20468
+ var __copyProps2 = (to, from, except, desc) => {
20469
+ if (from && typeof from === "object" || typeof from === "function") {
20470
+ for (let key of __getOwnPropNames2(from))
20471
+ if (!__hasOwnProp2.call(to, key) && key !== except)
20472
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
20473
+ }
20474
+ return to;
20475
+ };
20476
+ var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default"));
20477
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
20478
+ var services_exports = {};
20479
+ __export2(services_exports, {
20480
+ detectServices: () => detectServices2
20481
+ });
20482
+ module2.exports = __toCommonJS2(services_exports);
20483
+ var import_resolve = require_resolve();
20484
+ __reExport(services_exports, require_types2(), module2.exports);
20485
+ __reExport(services_exports, require_resolve(), module2.exports);
20486
+ async function detectServices2(options) {
20487
+ const { fs: fs5, workPath = "" } = options;
20488
+ const services = [];
20489
+ const errors = [];
20490
+ const configPath = workPath ? `${workPath}/vercel.json` : "vercel.json";
20491
+ let experimentalServices;
20492
+ try {
20493
+ const configBuffer = await fs5.readFile(configPath);
20494
+ const config = JSON.parse(configBuffer.toString("utf-8"));
20495
+ experimentalServices = config.experimentalServices;
20496
+ } catch {
20497
+ return { services, errors };
20498
+ }
20499
+ if (experimentalServices && typeof experimentalServices === "object") {
20500
+ for (const name of Object.keys(experimentalServices)) {
20501
+ const serviceConfig = experimentalServices[name];
20502
+ const validationError = (0, import_resolve.validateServiceConfig)(name, serviceConfig);
20503
+ if (validationError) {
20504
+ errors.push(validationError);
20505
+ continue;
20506
+ }
20507
+ const resolved = (0, import_resolve.resolveService)(name, serviceConfig);
20508
+ services.push(resolved);
20509
+ }
20510
+ }
20511
+ return { services, errors };
20512
+ }
20513
+ }
20514
+ });
20515
+
20354
20516
  // ../fs-detectors/dist/detect-file-system-api.js
20355
20517
  var require_detect_file_system_api = __commonJS({
20356
20518
  "../fs-detectors/dist/detect-file-system-api.js"(exports2, module2) {
@@ -28240,6 +28402,7 @@ var require_dist4 = __commonJS({
28240
28402
  detectFrameworks: () => import_detect_framework.detectFrameworks,
28241
28403
  detectInstrumentation: () => import_detect_instrumentation.detectInstrumentation,
28242
28404
  detectOutputDirectory: () => import_detect_builders.detectOutputDirectory,
28405
+ detectServices: () => import_services.detectServices,
28243
28406
  getProjectPaths: () => import_get_project_paths.getProjectPaths,
28244
28407
  getWorkspacePackagePaths: () => import_get_workspace_package_paths.getWorkspacePackagePaths,
28245
28408
  getWorkspaces: () => import_get_workspaces.getWorkspaces,
@@ -28251,6 +28414,7 @@ var require_dist4 = __commonJS({
28251
28414
  });
28252
28415
  module2.exports = __toCommonJS2(src_exports2);
28253
28416
  var import_detect_builders = require_detect_builders();
28417
+ var import_services = require_services();
28254
28418
  var import_detect_file_system_api = require_detect_file_system_api();
28255
28419
  var import_detect_framework = require_detect_framework();
28256
28420
  var import_get_project_paths = require_get_project_paths();
@@ -29379,6 +29543,7 @@ var build = async ({
29379
29543
  let isNpmInstall = false;
29380
29544
  let isBundleInstall = false;
29381
29545
  let isPipInstall = false;
29546
+ let pipTargetDir;
29382
29547
  let output = {};
29383
29548
  let images;
29384
29549
  const routes = [];
@@ -29534,13 +29699,16 @@ var build = async ({
29534
29699
  if ((0, import_fs4.existsSync)(requirementsPath)) {
29535
29700
  (0, import_build_utils4.debug)("Detected requirements.txt");
29536
29701
  printInstall();
29537
- await (0, import_build_utils4.runPipInstall)(
29702
+ const pipResult = await (0, import_build_utils4.runPipInstall)(
29538
29703
  workPath,
29539
29704
  ["-r", requirementsPath],
29540
29705
  void 0,
29541
29706
  meta
29542
29707
  );
29543
- isPipInstall = true;
29708
+ if (pipResult.installed) {
29709
+ pipTargetDir = pipResult.targetDir;
29710
+ isPipInstall = true;
29711
+ }
29544
29712
  }
29545
29713
  if (pkg) {
29546
29714
  await (0, import_build_utils4.runNpmInstall)(
@@ -29584,17 +29752,34 @@ var build = async ({
29584
29752
  if (rubyVersion.status === 0 && typeof rubyVersion.stdout === "string") {
29585
29753
  gemHome = import_path6.default.join(dir, rubyVersion.stdout.trim());
29586
29754
  (0, import_build_utils4.debug)(`Set GEM_HOME="${gemHome}" because a Gemfile was found`);
29755
+ const gemBin = import_path6.default.join(gemHome, "bin");
29756
+ pathList.push(gemBin);
29757
+ (0, import_build_utils4.debug)(`Added "${gemBin}" to PATH env because a Gemfile was found`);
29587
29758
  }
29588
29759
  }
29589
- if (isPipInstall) {
29760
+ if (isPipInstall && pipTargetDir) {
29761
+ const pipBinDir = import_path6.default.join(pipTargetDir, "bin");
29762
+ pathList.push(pipBinDir);
29763
+ (0, import_build_utils4.debug)(
29764
+ `Added "${pipBinDir}" to PATH env because a requirements.txt was found`
29765
+ );
29590
29766
  }
29591
29767
  if (spawnEnv.PATH) {
29592
29768
  pathList.push(spawnEnv.PATH);
29593
29769
  }
29770
+ let pythonPath;
29771
+ if (isPipInstall && pipTargetDir) {
29772
+ const existingPythonPath = process.env.PYTHONPATH;
29773
+ pythonPath = existingPythonPath ? `${pipTargetDir}${import_path6.default.delimiter}${existingPythonPath}` : pipTargetDir;
29774
+ (0, import_build_utils4.debug)(
29775
+ `Set PYTHONPATH="${pythonPath}" because a requirements.txt was found`
29776
+ );
29777
+ }
29594
29778
  const cliEnv = {
29595
29779
  ...process.env,
29596
29780
  PATH: pathList.join(import_path6.default.delimiter),
29597
- GEM_HOME: gemHome
29781
+ GEM_HOME: gemHome,
29782
+ ...pythonPath && { PYTHONPATH: pythonPath }
29598
29783
  };
29599
29784
  if (meta.isDev && (devCommand || pkg && devScript && pkg.scripts && pkg.scripts[devScript])) {
29600
29785
  let devPort = nowDevScriptPorts.get(entrypoint);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "2.8.25",
3
+ "version": "2.8.27",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/build-step",
@@ -15,7 +15,7 @@
15
15
  "dependencies": {
16
16
  "ts-morph": "12.0.0",
17
17
  "@vercel/gatsby-plugin-vercel-analytics": "1.0.11",
18
- "@vercel/gatsby-plugin-vercel-builder": "2.0.124",
18
+ "@vercel/gatsby-plugin-vercel-builder": "2.0.126",
19
19
  "@vercel/static-config": "3.1.2"
20
20
  },
21
21
  "devDependencies": {
@@ -24,7 +24,7 @@
24
24
  "@types/fs-extra": "9.0.13",
25
25
  "@types/jest": "27.4.1",
26
26
  "@types/ms": "0.7.31",
27
- "@types/node": "14.18.33",
27
+ "@types/node": "20.11.0",
28
28
  "@types/node-fetch": "2.5.4",
29
29
  "@types/promise-timeout": "1.3.0",
30
30
  "@types/semver": "7.3.13",
@@ -38,10 +38,10 @@
38
38
  "rc9": "1.2.0",
39
39
  "semver": "7.5.2",
40
40
  "tree-kill": "1.2.2",
41
- "@vercel/build-utils": "13.2.13",
42
- "@vercel/routing-utils": "5.3.2",
41
+ "@vercel/build-utils": "13.2.15",
43
42
  "@vercel/error-utils": "2.0.3",
44
- "@vercel/fs-detectors": "5.7.15",
43
+ "@vercel/fs-detectors": "5.7.16",
44
+ "@vercel/routing-utils": "5.3.2",
45
45
  "@vercel/frameworks": "3.15.7"
46
46
  },
47
47
  "scripts": {