@vercel/static-build 2.8.24 → 2.8.26

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 +217 -4
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -11947,6 +11947,7 @@ var require_frameworks = __commonJS({
11947
11947
  name: "Python",
11948
11948
  slug: "python",
11949
11949
  experimental: true,
11950
+ runtimeFramework: true,
11950
11951
  logo: "https://api-frameworks.vercel.sh/framework-logos/python.svg",
11951
11952
  tagline: "Python is a programming language that lets you work quickly and integrate systems more effectively.",
11952
11953
  description: "A generic Python application deployed as a serverless function.",
@@ -11993,6 +11994,33 @@ var require_frameworks = __commonJS({
11993
11994
  }
11994
11995
  ]
11995
11996
  },
11997
+ {
11998
+ name: "Services",
11999
+ slug: "services",
12000
+ experimental: true,
12001
+ logo: "https://api-frameworks.vercel.sh/framework-logos/other.svg",
12002
+ tagline: "Multiple services deployed as serverless functions within your project.",
12003
+ description: "Multiple services deployed as serverless functions within your project.",
12004
+ website: "https://vercel.com",
12005
+ detectors: {},
12006
+ settings: {
12007
+ installCommand: {
12008
+ placeholder: "None"
12009
+ },
12010
+ buildCommand: {
12011
+ placeholder: "None",
12012
+ value: null
12013
+ },
12014
+ devCommand: {
12015
+ placeholder: "None",
12016
+ value: null
12017
+ },
12018
+ outputDirectory: {
12019
+ value: "N/A"
12020
+ }
12021
+ },
12022
+ getOutputDirName: async () => "public"
12023
+ },
11996
12024
  {
11997
12025
  name: "Other",
11998
12026
  slug: null,
@@ -20323,6 +20351,168 @@ var require_detect_builders = __commonJS({
20323
20351
  }
20324
20352
  });
20325
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
+
20326
20516
  // ../fs-detectors/dist/detect-file-system-api.js
20327
20517
  var require_detect_file_system_api = __commonJS({
20328
20518
  "../fs-detectors/dist/detect-file-system-api.js"(exports2, module2) {
@@ -28212,6 +28402,7 @@ var require_dist4 = __commonJS({
28212
28402
  detectFrameworks: () => import_detect_framework.detectFrameworks,
28213
28403
  detectInstrumentation: () => import_detect_instrumentation.detectInstrumentation,
28214
28404
  detectOutputDirectory: () => import_detect_builders.detectOutputDirectory,
28405
+ detectServices: () => import_services.detectServices,
28215
28406
  getProjectPaths: () => import_get_project_paths.getProjectPaths,
28216
28407
  getWorkspacePackagePaths: () => import_get_workspace_package_paths.getWorkspacePackagePaths,
28217
28408
  getWorkspaces: () => import_get_workspaces.getWorkspaces,
@@ -28223,6 +28414,7 @@ var require_dist4 = __commonJS({
28223
28414
  });
28224
28415
  module2.exports = __toCommonJS2(src_exports2);
28225
28416
  var import_detect_builders = require_detect_builders();
28417
+ var import_services = require_services();
28226
28418
  var import_detect_file_system_api = require_detect_file_system_api();
28227
28419
  var import_detect_framework = require_detect_framework();
28228
28420
  var import_get_project_paths = require_get_project_paths();
@@ -29351,6 +29543,7 @@ var build = async ({
29351
29543
  let isNpmInstall = false;
29352
29544
  let isBundleInstall = false;
29353
29545
  let isPipInstall = false;
29546
+ let pipTargetDir;
29354
29547
  let output = {};
29355
29548
  let images;
29356
29549
  const routes = [];
@@ -29506,13 +29699,16 @@ var build = async ({
29506
29699
  if ((0, import_fs4.existsSync)(requirementsPath)) {
29507
29700
  (0, import_build_utils4.debug)("Detected requirements.txt");
29508
29701
  printInstall();
29509
- await (0, import_build_utils4.runPipInstall)(
29702
+ const pipResult = await (0, import_build_utils4.runPipInstall)(
29510
29703
  workPath,
29511
29704
  ["-r", requirementsPath],
29512
29705
  void 0,
29513
29706
  meta
29514
29707
  );
29515
- isPipInstall = true;
29708
+ if (pipResult.installed) {
29709
+ pipTargetDir = pipResult.targetDir;
29710
+ isPipInstall = true;
29711
+ }
29516
29712
  }
29517
29713
  if (pkg) {
29518
29714
  await (0, import_build_utils4.runNpmInstall)(
@@ -29556,17 +29752,34 @@ var build = async ({
29556
29752
  if (rubyVersion.status === 0 && typeof rubyVersion.stdout === "string") {
29557
29753
  gemHome = import_path6.default.join(dir, rubyVersion.stdout.trim());
29558
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`);
29559
29758
  }
29560
29759
  }
29561
- 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
+ );
29562
29766
  }
29563
29767
  if (spawnEnv.PATH) {
29564
29768
  pathList.push(spawnEnv.PATH);
29565
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
+ }
29566
29778
  const cliEnv = {
29567
29779
  ...process.env,
29568
29780
  PATH: pathList.join(import_path6.default.delimiter),
29569
- GEM_HOME: gemHome
29781
+ GEM_HOME: gemHome,
29782
+ ...pythonPath && { PYTHONPATH: pythonPath }
29570
29783
  };
29571
29784
  if (meta.isDev && (devCommand || pkg && devScript && pkg.scripts && pkg.scripts[devScript])) {
29572
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.24",
3
+ "version": "2.8.26",
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
  "ts-morph": "12.0.0",
17
- "@vercel/gatsby-plugin-vercel-builder": "2.0.123",
17
+ "@vercel/gatsby-plugin-vercel-builder": "2.0.125",
18
18
  "@vercel/static-config": "3.1.2",
19
19
  "@vercel/gatsby-plugin-vercel-analytics": "1.0.11"
20
20
  },
@@ -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,11 +38,11 @@
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.14",
41
42
  "@vercel/error-utils": "2.0.3",
42
- "@vercel/build-utils": "13.2.12",
43
- "@vercel/fs-detectors": "5.7.14",
44
- "@vercel/frameworks": "3.15.6",
45
- "@vercel/routing-utils": "5.3.2"
43
+ "@vercel/fs-detectors": "5.7.16",
44
+ "@vercel/routing-utils": "5.3.2",
45
+ "@vercel/frameworks": "3.15.7"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "node ../../utils/build-builder.mjs",