@vercel/build-utils 2.16.1-canary.0 → 2.16.1-canary.1

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.
package/dist/index.d.ts CHANGED
@@ -11,11 +11,10 @@ import rename from './fs/rename';
11
11
  import { execAsync, spawnAsync, execCommand, spawnCommand, walkParentDirs, getScriptName, installDependencies, runPackageJsonScript, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getSpawnOptions, getNodeBinPath, scanParentDirs } from './fs/run-user-scripts';
12
12
  import { getLatestNodeVersion, getDiscontinuedNodeVersions } from './fs/node-version';
13
13
  import streamToBuffer from './fs/stream-to-buffer';
14
- import shouldServe from './should-serve';
15
14
  import debug from './debug';
16
15
  import getIgnoreFilter from './get-ignore-filter';
17
16
  import { getPlatformEnv } from './get-platform-env';
18
- export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, execAsync, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, streamToBuffer, shouldServe, debug, isSymbolicLink, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, };
17
+ export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, execAsync, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, streamToBuffer, debug, isSymbolicLink, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, };
19
18
  export { EdgeFunction } from './edge-function';
20
19
  export { detectBuilders, detectOutputDirectory, detectApiDirectory, detectApiExtensions, } from './detect-builders';
21
20
  export { detectFileSystemAPI } from './detect-file-system-api';
@@ -23,6 +22,7 @@ export { detectFramework } from './detect-framework';
23
22
  export { DetectorFilesystem } from './detectors/filesystem';
24
23
  export { readConfigFile } from './fs/read-config-file';
25
24
  export { normalizePath } from './fs/normalize-path';
25
+ export * from './should-serve';
26
26
  export * from './schemas';
27
27
  export * from './types';
28
28
  export * from './errors';
@@ -31,3 +31,4 @@ export * from './errors';
31
31
  */
32
32
  export declare const isOfficialRuntime: (desired: string, name?: string | undefined) => boolean;
33
33
  export declare const isStaticRuntime: (name?: string | undefined) => boolean;
34
+ export { workspaceManagers } from './workspaces/workspace-managers';
package/dist/index.js CHANGED
@@ -35446,7 +35446,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35446
35446
  return (mod && mod.__esModule) ? mod : { "default": mod };
35447
35447
  };
35448
35448
  Object.defineProperty(exports, "__esModule", ({ value: true }));
35449
- exports.isStaticRuntime = exports.isOfficialRuntime = exports.normalizePath = exports.readConfigFile = exports.DetectorFilesystem = exports.detectFramework = exports.detectFileSystemAPI = exports.detectApiExtensions = exports.detectApiDirectory = exports.detectOutputDirectory = exports.detectBuilders = exports.EdgeFunction = exports.getIgnoreFilter = exports.scanParentDirs = exports.getLambdaOptionsFromFunction = exports.isSymbolicLink = exports.debug = exports.shouldServe = exports.streamToBuffer = exports.getPlatformEnv = exports.getSpawnOptions = exports.getDiscontinuedNodeVersions = exports.getLatestNodeVersion = exports.getNodeVersion = exports.getEnvForPackageManager = exports.runCustomInstallCommand = exports.runShellScript = exports.runPipInstall = exports.runBundleInstall = exports.runNpmInstall = exports.getNodeBinPath = exports.walkParentDirs = exports.spawnCommand = exports.execCommand = exports.runPackageJsonScript = exports.installDependencies = exports.getScriptName = exports.spawnAsync = exports.execAsync = exports.rename = exports.glob = exports.getWriteableDirectory = exports.download = exports.Prerender = exports.createLambda = exports.NodejsLambda = exports.Lambda = exports.FileRef = exports.FileFsRef = exports.FileBlob = void 0;
35449
+ exports.workspaceManagers = exports.isStaticRuntime = exports.isOfficialRuntime = exports.normalizePath = exports.readConfigFile = exports.DetectorFilesystem = exports.detectFramework = exports.detectFileSystemAPI = exports.detectApiExtensions = exports.detectApiDirectory = exports.detectOutputDirectory = exports.detectBuilders = exports.EdgeFunction = exports.getIgnoreFilter = exports.scanParentDirs = exports.getLambdaOptionsFromFunction = exports.isSymbolicLink = exports.debug = exports.streamToBuffer = exports.getPlatformEnv = exports.getSpawnOptions = exports.getDiscontinuedNodeVersions = exports.getLatestNodeVersion = exports.getNodeVersion = exports.getEnvForPackageManager = exports.runCustomInstallCommand = exports.runShellScript = exports.runPipInstall = exports.runBundleInstall = exports.runNpmInstall = exports.getNodeBinPath = exports.walkParentDirs = exports.spawnCommand = exports.execCommand = exports.runPackageJsonScript = exports.installDependencies = exports.getScriptName = exports.spawnAsync = exports.execAsync = exports.rename = exports.glob = exports.getWriteableDirectory = exports.download = exports.Prerender = exports.createLambda = exports.NodejsLambda = exports.Lambda = exports.FileRef = exports.FileFsRef = exports.FileBlob = void 0;
35450
35450
  const file_blob_1 = __importDefault(__webpack_require__(2397));
35451
35451
  exports.FileBlob = file_blob_1.default;
35452
35452
  const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
@@ -35494,8 +35494,6 @@ Object.defineProperty(exports, "getLatestNodeVersion", ({ enumerable: true, get:
35494
35494
  Object.defineProperty(exports, "getDiscontinuedNodeVersions", ({ enumerable: true, get: function () { return node_version_1.getDiscontinuedNodeVersions; } }));
35495
35495
  const stream_to_buffer_1 = __importDefault(__webpack_require__(2560));
35496
35496
  exports.streamToBuffer = stream_to_buffer_1.default;
35497
- const should_serve_1 = __importDefault(__webpack_require__(2564));
35498
- exports.shouldServe = should_serve_1.default;
35499
35497
  const debug_1 = __importDefault(__webpack_require__(1868));
35500
35498
  exports.debug = debug_1.default;
35501
35499
  const get_ignore_filter_1 = __importDefault(__webpack_require__(1148));
@@ -35519,6 +35517,7 @@ var read_config_file_1 = __webpack_require__(7792);
35519
35517
  Object.defineProperty(exports, "readConfigFile", ({ enumerable: true, get: function () { return read_config_file_1.readConfigFile; } }));
35520
35518
  var normalize_path_1 = __webpack_require__(6261);
35521
35519
  Object.defineProperty(exports, "normalizePath", ({ enumerable: true, get: function () { return normalize_path_1.normalizePath; } }));
35520
+ __exportStar(__webpack_require__(2564), exports);
35522
35521
  __exportStar(__webpack_require__(2416), exports);
35523
35522
  __exportStar(__webpack_require__(5748), exports);
35524
35523
  __exportStar(__webpack_require__(3983), exports);
@@ -35539,6 +35538,8 @@ const isStaticRuntime = (name) => {
35539
35538
  return exports.isOfficialRuntime('static', name);
35540
35539
  };
35541
35540
  exports.isStaticRuntime = isStaticRuntime;
35541
+ var workspace_managers_1 = __webpack_require__(4896);
35542
+ Object.defineProperty(exports, "workspaceManagers", ({ enumerable: true, get: function () { return workspace_managers_1.workspaceManagers; } }));
35542
35543
 
35543
35544
 
35544
35545
  /***/ }),
@@ -35829,8 +35830,9 @@ exports.buildsSchema = {
35829
35830
  "use strict";
35830
35831
 
35831
35832
  Object.defineProperty(exports, "__esModule", ({ value: true }));
35833
+ exports.shouldServe = void 0;
35832
35834
  const path_1 = __webpack_require__(5622);
35833
- function shouldServe({ entrypoint, files, requestPath, }) {
35835
+ const shouldServe = ({ entrypoint, files, requestPath, }) => {
35834
35836
  requestPath = requestPath.replace(/\/$/, ''); // sanitize trailing '/'
35835
35837
  entrypoint = entrypoint.replace(/\\/, '/'); // windows compatibility
35836
35838
  if (entrypoint === requestPath && hasProp(files, entrypoint)) {
@@ -35841,8 +35843,8 @@ function shouldServe({ entrypoint, files, requestPath, }) {
35841
35843
  return true;
35842
35844
  }
35843
35845
  return false;
35844
- }
35845
- exports.default = shouldServe;
35846
+ };
35847
+ exports.shouldServe = shouldServe;
35846
35848
  function hasProp(obj, key) {
35847
35849
  return Object.hasOwnProperty.call(obj, key);
35848
35850
  }
@@ -35858,6 +35860,141 @@ function hasProp(obj, key) {
35858
35860
  Object.defineProperty(exports, "__esModule", ({ value: true }));
35859
35861
 
35860
35862
 
35863
+ /***/ }),
35864
+
35865
+ /***/ 4896:
35866
+ /***/ ((__unused_webpack_module, exports) => {
35867
+
35868
+ "use strict";
35869
+
35870
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
35871
+ exports.workspaceManagers = void 0;
35872
+ /**
35873
+ * The supported list of workspace managers.
35874
+ *
35875
+ * This list is designed to work with the @see {@link detectFramework} function.
35876
+ *
35877
+ * @example
35878
+ * import { workspaceManagers as frameworkList } from '@vercel/build-utils/workspaces'
35879
+ * import { detectFramework } from '@vercel/build-utils'
35880
+ *
35881
+ * const fs = new GitDetectorFilesystem(...)
35882
+ * detectFramwork({ fs, frameworkList }) // returns the 'slug' field if detected, otherwise null
35883
+ *
35884
+ * @todo Will be used by the detect-eligible-projects API endpoint for a given git url.
35885
+ */
35886
+ exports.workspaceManagers = [
35887
+ {
35888
+ name: 'Yarn',
35889
+ slug: 'yarn',
35890
+ detectors: {
35891
+ every: [
35892
+ {
35893
+ path: 'package.json',
35894
+ matchContent: '"workspaces":\\s*(?:\\[[^\\]]*]|{[^}]*"packages":[^}]*})',
35895
+ },
35896
+ {
35897
+ path: 'yarn.lock',
35898
+ },
35899
+ ],
35900
+ },
35901
+ // unused props - needed for typescript
35902
+ description: '',
35903
+ logo: '',
35904
+ settings: {
35905
+ buildCommand: {
35906
+ value: '',
35907
+ placeholder: '',
35908
+ },
35909
+ devCommand: {
35910
+ value: '',
35911
+ placeholder: '',
35912
+ },
35913
+ installCommand: {
35914
+ value: '',
35915
+ placeholder: '',
35916
+ },
35917
+ outputDirectory: {
35918
+ value: '',
35919
+ placeholder: '',
35920
+ },
35921
+ },
35922
+ getOutputDirName: () => Promise.resolve(''),
35923
+ },
35924
+ {
35925
+ name: 'pnpm',
35926
+ slug: 'pnpm',
35927
+ detectors: {
35928
+ every: [
35929
+ {
35930
+ path: 'pnpm-workspace.yaml',
35931
+ },
35932
+ ],
35933
+ },
35934
+ // unused props - needed for typescript
35935
+ description: '',
35936
+ logo: '',
35937
+ settings: {
35938
+ buildCommand: {
35939
+ value: '',
35940
+ placeholder: '',
35941
+ },
35942
+ devCommand: {
35943
+ value: '',
35944
+ placeholder: '',
35945
+ },
35946
+ installCommand: {
35947
+ value: '',
35948
+ placeholder: '',
35949
+ },
35950
+ outputDirectory: {
35951
+ value: '',
35952
+ placeholder: '',
35953
+ },
35954
+ },
35955
+ getOutputDirName: () => Promise.resolve(''),
35956
+ },
35957
+ {
35958
+ name: 'npm',
35959
+ slug: 'npm',
35960
+ detectors: {
35961
+ every: [
35962
+ {
35963
+ path: 'package.json',
35964
+ matchContent: '"workspaces":\\s*(?:\\[[^\\]]*]|{[^}]*"packages":[^}]*})',
35965
+ },
35966
+ {
35967
+ path: 'package-lock.json',
35968
+ },
35969
+ ],
35970
+ },
35971
+ // unused props - needed for typescript
35972
+ description: '',
35973
+ logo: '',
35974
+ settings: {
35975
+ buildCommand: {
35976
+ value: '',
35977
+ placeholder: '',
35978
+ },
35979
+ devCommand: {
35980
+ value: '',
35981
+ placeholder: '',
35982
+ },
35983
+ installCommand: {
35984
+ value: '',
35985
+ placeholder: '',
35986
+ },
35987
+ outputDirectory: {
35988
+ value: '',
35989
+ placeholder: '',
35990
+ },
35991
+ },
35992
+ getOutputDirName: () => Promise.resolve(''),
35993
+ },
35994
+ ];
35995
+ exports.default = exports.workspaceManagers;
35996
+
35997
+
35861
35998
  /***/ }),
35862
35999
 
35863
36000
  /***/ 5685:
@@ -1,2 +1,2 @@
1
- import { ShouldServeOptions } from './types';
2
- export default function shouldServe({ entrypoint, files, requestPath, }: ShouldServeOptions): boolean;
1
+ import type { ShouldServe } from './types';
2
+ export declare const shouldServe: ShouldServe;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shouldServe = void 0;
3
4
  const path_1 = require("path");
4
- function shouldServe({ entrypoint, files, requestPath, }) {
5
+ const shouldServe = ({ entrypoint, files, requestPath, }) => {
5
6
  requestPath = requestPath.replace(/\/$/, ''); // sanitize trailing '/'
6
7
  entrypoint = entrypoint.replace(/\\/, '/'); // windows compatibility
7
8
  if (entrypoint === requestPath && hasProp(files, entrypoint)) {
@@ -12,8 +13,8 @@ function shouldServe({ entrypoint, files, requestPath, }) {
12
13
  return true;
13
14
  }
14
15
  return false;
15
- }
16
- exports.default = shouldServe;
16
+ };
17
+ exports.shouldServe = shouldServe;
17
18
  function hasProp(obj, key) {
18
19
  return Object.hasOwnProperty.call(obj, key);
19
20
  }
package/dist/types.d.ts CHANGED
@@ -305,6 +305,7 @@ export interface BuilderV3 {
305
305
  version: 3;
306
306
  build: BuildV3;
307
307
  prepareCache?: PrepareCache;
308
+ shouldServe?: ShouldServe;
308
309
  startDevServer?: StartDevServer;
309
310
  }
310
311
  declare type ImageFormat = 'image/avif' | 'image/webp';
@@ -353,5 +354,6 @@ export interface BuildResultV3 {
353
354
  export declare type BuildV2 = (options: BuildOptions) => Promise<BuildResultV2>;
354
355
  export declare type BuildV3 = (options: BuildOptions) => Promise<BuildResultV3>;
355
356
  export declare type PrepareCache = (options: PrepareCacheOptions) => Promise<Files>;
357
+ export declare type ShouldServe = (options: ShouldServeOptions) => boolean | Promise<boolean>;
356
358
  export declare type StartDevServer = (options: StartDevServerOptions) => Promise<StartDevServerResult>;
357
359
  export {};
@@ -0,0 +1,17 @@
1
+ import type { Framework } from '@vercel/frameworks';
2
+ /**
3
+ * The supported list of workspace managers.
4
+ *
5
+ * This list is designed to work with the @see {@link detectFramework} function.
6
+ *
7
+ * @example
8
+ * import { workspaceManagers as frameworkList } from '@vercel/build-utils/workspaces'
9
+ * import { detectFramework } from '@vercel/build-utils'
10
+ *
11
+ * const fs = new GitDetectorFilesystem(...)
12
+ * detectFramwork({ fs, frameworkList }) // returns the 'slug' field if detected, otherwise null
13
+ *
14
+ * @todo Will be used by the detect-eligible-projects API endpoint for a given git url.
15
+ */
16
+ export declare const workspaceManagers: Array<Framework>;
17
+ export default workspaceManagers;
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.workspaceManagers = void 0;
4
+ /**
5
+ * The supported list of workspace managers.
6
+ *
7
+ * This list is designed to work with the @see {@link detectFramework} function.
8
+ *
9
+ * @example
10
+ * import { workspaceManagers as frameworkList } from '@vercel/build-utils/workspaces'
11
+ * import { detectFramework } from '@vercel/build-utils'
12
+ *
13
+ * const fs = new GitDetectorFilesystem(...)
14
+ * detectFramwork({ fs, frameworkList }) // returns the 'slug' field if detected, otherwise null
15
+ *
16
+ * @todo Will be used by the detect-eligible-projects API endpoint for a given git url.
17
+ */
18
+ exports.workspaceManagers = [
19
+ {
20
+ name: 'Yarn',
21
+ slug: 'yarn',
22
+ detectors: {
23
+ every: [
24
+ {
25
+ path: 'package.json',
26
+ matchContent: '"workspaces":\\s*(?:\\[[^\\]]*]|{[^}]*"packages":[^}]*})',
27
+ },
28
+ {
29
+ path: 'yarn.lock',
30
+ },
31
+ ],
32
+ },
33
+ // unused props - needed for typescript
34
+ description: '',
35
+ logo: '',
36
+ settings: {
37
+ buildCommand: {
38
+ value: '',
39
+ placeholder: '',
40
+ },
41
+ devCommand: {
42
+ value: '',
43
+ placeholder: '',
44
+ },
45
+ installCommand: {
46
+ value: '',
47
+ placeholder: '',
48
+ },
49
+ outputDirectory: {
50
+ value: '',
51
+ placeholder: '',
52
+ },
53
+ },
54
+ getOutputDirName: () => Promise.resolve(''),
55
+ },
56
+ {
57
+ name: 'pnpm',
58
+ slug: 'pnpm',
59
+ detectors: {
60
+ every: [
61
+ {
62
+ path: 'pnpm-workspace.yaml',
63
+ },
64
+ ],
65
+ },
66
+ // unused props - needed for typescript
67
+ description: '',
68
+ logo: '',
69
+ settings: {
70
+ buildCommand: {
71
+ value: '',
72
+ placeholder: '',
73
+ },
74
+ devCommand: {
75
+ value: '',
76
+ placeholder: '',
77
+ },
78
+ installCommand: {
79
+ value: '',
80
+ placeholder: '',
81
+ },
82
+ outputDirectory: {
83
+ value: '',
84
+ placeholder: '',
85
+ },
86
+ },
87
+ getOutputDirName: () => Promise.resolve(''),
88
+ },
89
+ {
90
+ name: 'npm',
91
+ slug: 'npm',
92
+ detectors: {
93
+ every: [
94
+ {
95
+ path: 'package.json',
96
+ matchContent: '"workspaces":\\s*(?:\\[[^\\]]*]|{[^}]*"packages":[^}]*})',
97
+ },
98
+ {
99
+ path: 'package-lock.json',
100
+ },
101
+ ],
102
+ },
103
+ // unused props - needed for typescript
104
+ description: '',
105
+ logo: '',
106
+ settings: {
107
+ buildCommand: {
108
+ value: '',
109
+ placeholder: '',
110
+ },
111
+ devCommand: {
112
+ value: '',
113
+ placeholder: '',
114
+ },
115
+ installCommand: {
116
+ value: '',
117
+ placeholder: '',
118
+ },
119
+ outputDirectory: {
120
+ value: '',
121
+ placeholder: '',
122
+ },
123
+ },
124
+ getOutputDirName: () => Promise.resolve(''),
125
+ },
126
+ ];
127
+ exports.default = exports.workspaceManagers;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "2.16.1-canary.0",
3
+ "version": "2.16.1-canary.1",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -49,5 +49,5 @@
49
49
  "typescript": "4.3.4",
50
50
  "yazl": "2.5.1"
51
51
  },
52
- "gitHead": "8eabbfc6667399fce2a9060fd48a0d7c635a2a62"
52
+ "gitHead": "f88c862e9d9d4ad385e54d5fecaa0306a6ed5612"
53
53
  }