@vercel/fs-detectors 5.0.1 → 5.0.3

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 (31) hide show
  1. package/dist/detect-builders.js +701 -748
  2. package/dist/detect-builders.js.map +7 -1
  3. package/dist/detect-file-system-api.js +177 -154
  4. package/dist/detect-file-system-api.js.map +7 -1
  5. package/dist/detect-framework.js +196 -143
  6. package/dist/detect-framework.js.map +7 -1
  7. package/dist/detectors/filesystem.js +106 -109
  8. package/dist/detectors/filesystem.js.map +7 -1
  9. package/dist/detectors/local-file-system-detector.js +90 -63
  10. package/dist/detectors/local-file-system-detector.js.map +7 -1
  11. package/dist/get-project-paths.js +74 -35
  12. package/dist/get-project-paths.js.map +7 -1
  13. package/dist/index.js +85 -48
  14. package/dist/index.js.map +7 -1
  15. package/dist/is-official-runtime.js +34 -19
  16. package/dist/is-official-runtime.js.map +7 -1
  17. package/dist/monorepos/get-monorepo-default-settings.js +154 -150
  18. package/dist/monorepos/get-monorepo-default-settings.js.map +7 -1
  19. package/dist/monorepos/monorepo-managers.js +112 -100
  20. package/dist/monorepos/monorepo-managers.js.map +7 -1
  21. package/dist/package-managers/package-managers.js +79 -55
  22. package/dist/package-managers/package-managers.js.map +7 -1
  23. package/dist/workspaces/get-glob-fs.js +90 -66
  24. package/dist/workspaces/get-glob-fs.js.map +7 -1
  25. package/dist/workspaces/get-workspace-package-paths.js +130 -79
  26. package/dist/workspaces/get-workspace-package-paths.js.map +7 -1
  27. package/dist/workspaces/get-workspaces.js +71 -31
  28. package/dist/workspaces/get-workspaces.js.map +7 -1
  29. package/dist/workspaces/workspace-managers.js +104 -92
  30. package/dist/workspaces/workspace-managers.js.map +7 -1
  31. package/package.json +5 -5
@@ -1 +1,7 @@
1
- {"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../../src/detectors/filesystem.ts"],"names":[],"mappings":";;;AAAA,+BAA0C;AAO1C;;;;;;;;;;;;;;;;;;;;;;;;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,KAAK,CAAC,CAAC,CAAC;iBAC1D;aACF;YAED,OAAO,CAAC,CAAC;QACX,CAAC,CAAC;QAEF;;WAEG;QACI,UAAK,GAAG,CAAC,IAAY,EAAsB,EAAE;YAClD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC;QAEF;;;;WAIG;QACI,cAAS,GAAG,KAAK,EAAE,IAAY,EAAE,OAAe,EAAiB,EAAE;YACxE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACpE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;YAChD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAClD,CAAC,CAAC;QA7FA,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;IAChC,CAAC;CA0FF;AA3GD,gDA2GC"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/detectors/filesystem.ts"],
4
+ "sourcesContent": ["import { posix as posixPath } from 'path';\n\nexport interface DetectorFilesystemStat {\n name: string;\n path: string;\n type: 'file' | 'dir';\n}\n/**\n * `DetectorFilesystem` is an abstract class that represents a virtual filesystem\n * to perform read-only operations on in order to detect which framework is being\n * used.\n *\n * Its abstract methods must be implemented by a subclass that perform the actual\n * FS operations. Example subclasses could be implemented as:\n *\n * - Local filesystem, which proxies the FS operations to the equivalent `fs`\n * module functions.\n * - HTTP filesystem, which implements the FS operations over an HTTP server\n * and does not require a local copy of the files.\n * - `Files` filesystem, which operates on a virtual `Files` object (i.e. from\n * the `glob()` function) which could include `FileFsRef`, `FileBlob`, etc.\n *\n * This base class implements various helper functions for common tasks (i.e.\n * read and parse a JSON file). It also includes caching for all FS operations\n * so that multiple detector functions de-dup read operations on the same file\n * to reduce network/filesystem overhead.\n *\n * **NOTE:** It's important that all instance methods in this base class are\n * bound to `this` so that the `fs` object may be destructured in the detector\n * functions. The easiest way to do this is to use the `=` syntax when defining\n * methods in this class definition.\n */\nexport abstract class DetectorFilesystem {\n protected abstract _hasPath(name: string): Promise<boolean>;\n protected abstract _readFile(name: string): Promise<Buffer>;\n protected abstract _isFile(name: string): Promise<boolean>;\n protected abstract _readdir(name: string): Promise<DetectorFilesystemStat[]>;\n protected abstract _chdir(name: string): DetectorFilesystem;\n\n private pathCache: Map<string, Promise<boolean>>;\n private fileCache: Map<string, Promise<boolean>>;\n private readFileCache: Map<string, Promise<Buffer>>;\n private readdirCache: Map<string, Promise<DetectorFilesystemStat[]>>;\n\n constructor() {\n this.pathCache = new Map();\n this.fileCache = new Map();\n this.readFileCache = new Map();\n this.readdirCache = new Map();\n }\n\n public hasPath = async (path: string): Promise<boolean> => {\n let p = this.pathCache.get(path);\n if (!p) {\n p = this._hasPath(path);\n this.pathCache.set(path, p);\n }\n return p;\n };\n\n public isFile = async (name: string): Promise<boolean> => {\n let p = this.fileCache.get(name);\n if (!p) {\n p = this._isFile(name);\n this.fileCache.set(name, p);\n }\n return p;\n };\n\n public readFile = async (name: string): Promise<Buffer> => {\n let p = this.readFileCache.get(name);\n if (!p) {\n p = this._readFile(name);\n this.readFileCache.set(name, p);\n }\n return p;\n };\n\n /**\n * Returns a list of Stat objects from the current working directory.\n * @param dirPath The path of the directory to read.\n * @param options.potentialFiles optional. Array of potential file names (relative to the path). If provided, these will be used to mark the filesystem caches as existing or not existing.\n */\n public readdir = async (\n dirPath: string,\n options?: { potentialFiles?: string[] }\n ): Promise<DetectorFilesystemStat[]> => {\n let p = this.readdirCache.get(dirPath);\n if (!p) {\n p = this._readdir(dirPath);\n this.readdirCache.set(dirPath, p);\n }\n\n const directoryContent = await p;\n const directoryFiles = new Set<string>();\n\n for (const file of directoryContent) {\n if (file.type === 'file') {\n // we know this file exists, mark it as so on the filesystem\n this.fileCache.set(file.path, Promise.resolve(true));\n this.pathCache.set(file.path, Promise.resolve(true));\n directoryFiles.add(file.name);\n }\n }\n\n if (options?.potentialFiles) {\n // calculate the set of paths that truly do not exist\n const filesThatDoNotExist = options.potentialFiles.filter(\n path => !directoryFiles.has(path)\n );\n for (const filePath of filesThatDoNotExist) {\n const fullFilePath =\n dirPath === '/' ? filePath : posixPath.join(dirPath, filePath);\n // we know this file does not exist, mark it as so on the filesystem\n this.fileCache.set(fullFilePath, Promise.resolve(false));\n this.pathCache.set(fullFilePath, Promise.resolve(false));\n }\n }\n\n return p;\n };\n\n /**\n * Changes the current directory to the specified path and returns a new instance of DetectorFilesystem.\n */\n public chdir = (name: string): DetectorFilesystem => {\n return this._chdir(name);\n };\n\n /**\n * Writes a file to the filesystem cache.\n * @param name the name of the file to write\n * @param content The content of the file\n */\n public writeFile = async (name: string, content: string): Promise<void> => {\n this.readFileCache.set(name, Promise.resolve(Buffer.from(content)));\n this.fileCache.set(name, Promise.resolve(true));\n this.pathCache.set(name, Promise.resolve(true));\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmC;AAgC5B,MAAe,mBAAmB;AAAA,EAYvC,cAAc;AAOd,SAAO,UAAU,OAAO,SAAmC;AACzD,UAAI,IAAI,KAAK,UAAU,IAAI,IAAI;AAC/B,UAAI,CAAC,GAAG;AACN,YAAI,KAAK,SAAS,IAAI;AACtB,aAAK,UAAU,IAAI,MAAM,CAAC;AAAA,MAC5B;AACA,aAAO;AAAA,IACT;AAEA,SAAO,SAAS,OAAO,SAAmC;AACxD,UAAI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,IACT;AAKA;AAAA;AAAA;AAAA,SAAO,QAAQ,CAAC,SAAqC;AACnD,aAAO,KAAK,OAAO,IAAI;AAAA,IACzB;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAO,YAAY,OAAO,MAAc,YAAmC;AACzE,WAAK,cAAc,IAAI,MAAM,QAAQ,QAAQ,OAAO,KAAK,OAAO,CAAC,CAAC;AAClE,WAAK,UAAU,IAAI,MAAM,QAAQ,QAAQ,IAAI,CAAC;AAC9C,WAAK,UAAU,IAAI,MAAM,QAAQ,QAAQ,IAAI,CAAC;AAAA,IAChD;AA7FE,SAAK,YAAY,oBAAI,IAAI;AACzB,SAAK,YAAY,oBAAI,IAAI;AACzB,SAAK,gBAAgB,oBAAI,IAAI;AAC7B,SAAK,eAAe,oBAAI,IAAI;AAAA,EAC9B;AA0FF;",
6
+ "names": ["posixPath"]
7
+ }
@@ -1,68 +1,95 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
4
11
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LocalFileSystemDetector = void 0;
7
- const promises_1 = __importDefault(require("fs/promises"));
8
- const path_1 = require("path");
9
- const filesystem_1 = require("./filesystem");
10
- const error_utils_1 = require("@vercel/error-utils");
11
- class LocalFileSystemDetector extends filesystem_1.DetectorFilesystem {
12
- constructor(rootPath) {
13
- super();
14
- this.rootPath = rootPath;
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var local_file_system_detector_exports = {};
30
+ __export(local_file_system_detector_exports, {
31
+ LocalFileSystemDetector: () => LocalFileSystemDetector
32
+ });
33
+ module.exports = __toCommonJS(local_file_system_detector_exports);
34
+ var import_promises = __toESM(require("fs/promises"));
35
+ var import_path = require("path");
36
+ var import_filesystem = require("./filesystem");
37
+ var import_error_utils = require("@vercel/error-utils");
38
+ class LocalFileSystemDetector extends import_filesystem.DetectorFilesystem {
39
+ constructor(rootPath) {
40
+ super();
41
+ this.rootPath = rootPath;
42
+ }
43
+ async _hasPath(name) {
44
+ try {
45
+ await import_promises.default.stat(this.getFilePath(name));
46
+ return true;
47
+ } catch (err) {
48
+ if ((0, import_error_utils.isErrnoException)(err) && err.code === "ENOENT") {
49
+ return false;
50
+ }
51
+ throw err;
15
52
  }
16
- async _hasPath(name) {
17
- try {
18
- await promises_1.default.stat(this.getFilePath(name));
19
- return true;
20
- }
21
- catch (err) {
22
- if ((0, error_utils_1.isErrnoException)(err) && err.code === 'ENOENT') {
23
- return false;
24
- }
25
- throw err;
53
+ }
54
+ _readFile(name) {
55
+ return import_promises.default.readFile(this.getFilePath(name));
56
+ }
57
+ async _isFile(name) {
58
+ const stat = await import_promises.default.stat(this.getFilePath(name));
59
+ return stat.isFile();
60
+ }
61
+ async _readdir(dir) {
62
+ const dirPath = this.getFilePath(dir);
63
+ const files = await import_promises.default.readdir(dirPath);
64
+ return Promise.all(
65
+ files.map(async (name) => {
66
+ const absPath = (0, import_path.join)(this.rootPath, dir, name);
67
+ const path = (0, import_path.join)(this.getRelativeFilePath(dir), name);
68
+ const stat = await import_promises.default.stat(absPath);
69
+ let type;
70
+ if (stat.isFile()) {
71
+ type = "file";
72
+ } else if (stat.isDirectory()) {
73
+ type = "dir";
74
+ } else {
75
+ throw new Error(`Dirent was neither file nor directory: ${path}`);
26
76
  }
27
- }
28
- _readFile(name) {
29
- return promises_1.default.readFile(this.getFilePath(name));
30
- }
31
- async _isFile(name) {
32
- const stat = await promises_1.default.stat(this.getFilePath(name));
33
- return stat.isFile();
34
- }
35
- async _readdir(dir) {
36
- const dirPath = this.getFilePath(dir);
37
- const files = await promises_1.default.readdir(dirPath);
38
- return Promise.all(files.map(async (name) => {
39
- const absPath = (0, path_1.join)(this.rootPath, dir, name);
40
- const path = (0, path_1.join)(this.getRelativeFilePath(dir), name);
41
- const stat = await promises_1.default.stat(absPath);
42
- let type;
43
- if (stat.isFile()) {
44
- type = 'file';
45
- }
46
- else if (stat.isDirectory()) {
47
- type = 'dir';
48
- }
49
- else {
50
- throw new Error(`Dirent was neither file nor directory: ${path}`);
51
- }
52
- return { name, path, type };
53
- }));
54
- }
55
- _chdir(name) {
56
- return new LocalFileSystemDetector(this.getFilePath(name));
57
- }
58
- getRelativeFilePath(name) {
59
- return name.startsWith(this.rootPath)
60
- ? (0, path_1.relative)(this.rootPath, name)
61
- : name;
62
- }
63
- getFilePath(name) {
64
- return (0, path_1.join)(this.rootPath, this.getRelativeFilePath(name));
65
- }
77
+ return { name, path, type };
78
+ })
79
+ );
80
+ }
81
+ _chdir(name) {
82
+ return new LocalFileSystemDetector(this.getFilePath(name));
83
+ }
84
+ getRelativeFilePath(name) {
85
+ return name.startsWith(this.rootPath) ? (0, import_path.relative)(this.rootPath, name) : name;
86
+ }
87
+ getFilePath(name) {
88
+ return (0, import_path.join)(this.rootPath, this.getRelativeFilePath(name));
89
+ }
66
90
  }
67
- exports.LocalFileSystemDetector = LocalFileSystemDetector;
68
- //# sourceMappingURL=local-file-system-detector.js.map
91
+ // Annotate the CommonJS export names for ESM import in node:
92
+ 0 && (module.exports = {
93
+ LocalFileSystemDetector
94
+ });
95
+ //# sourceMappingURL=local-file-system-detector.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"local-file-system-detector.js","sourceRoot":"","sources":["../../src/detectors/local-file-system-detector.ts"],"names":[],"mappings":";;;;;;AAAA,2DAA6B;AAC7B,+BAAsC;AACtC,6CAA0E;AAC1E,qDAAuD;AAEvD,MAAa,uBAAwB,SAAQ,+BAAkB;IAG7D,YAAY,QAAgB;QAC1B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,IAAY;QACzB,IAAI;YACF,MAAM,kBAAE,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC;SACb;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,IAAA,8BAAgB,EAAC,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAClD,OAAO,KAAK,CAAC;aACd;YACD,MAAM,GAAG,CAAC;SACX;IACH,CAAC;IAED,SAAS,CAAC,IAAY;QACpB,OAAO,kBAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAY;QACxB,MAAM,IAAI,GAAG,MAAM,kBAAE,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,MAAM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I,CAAC;IACX,CAAC;IAEO,WAAW,CAAC,IAAY;QAC9B,OAAO,IAAA,WAAI,EAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,CAAC;CACF;AAjED,0DAiEC"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/detectors/local-file-system-detector.ts"],
4
+ "sourcesContent": ["import fs from 'fs/promises';\nimport { join, relative } from 'path';\nimport { DetectorFilesystem, DetectorFilesystemStat } from './filesystem';\nimport { isErrnoException } from '@vercel/error-utils';\n\nexport class LocalFileSystemDetector extends DetectorFilesystem {\n private rootPath: string;\n\n constructor(rootPath: string) {\n super();\n this.rootPath = rootPath;\n }\n\n async _hasPath(name: string): Promise<boolean> {\n try {\n await fs.stat(this.getFilePath(name));\n return true;\n } catch (err) {\n if (isErrnoException(err) && err.code === 'ENOENT') {\n return false;\n }\n throw err;\n }\n }\n\n _readFile(name: string): Promise<Buffer> {\n return fs.readFile(this.getFilePath(name));\n }\n\n async _isFile(name: string): Promise<boolean> {\n const stat = await fs.stat(this.getFilePath(name));\n return stat.isFile();\n }\n\n async _readdir(dir: string): Promise<DetectorFilesystemStat[]> {\n const dirPath = this.getFilePath(dir);\n const files = await fs.readdir(dirPath);\n return Promise.all(\n files.map(async name => {\n const absPath = join(this.rootPath, dir, name);\n const path = join(this.getRelativeFilePath(dir), name);\n\n const stat = await fs.stat(absPath);\n let type: DetectorFilesystemStat['type'];\n if (stat.isFile()) {\n type = 'file';\n } else if (stat.isDirectory()) {\n type = 'dir';\n } else {\n throw new Error(`Dirent was neither file nor directory: ${path}`);\n }\n\n return { name, path, type };\n })\n );\n }\n\n _chdir(name: string): DetectorFilesystem {\n return new LocalFileSystemDetector(this.getFilePath(name));\n }\n\n private getRelativeFilePath(name: string) {\n return name.startsWith(this.rootPath)\n ? relative(this.rootPath, name)\n : name;\n }\n\n private getFilePath(name: string) {\n return join(this.rootPath, this.getRelativeFilePath(name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E;AAEA,eAAO,EAAE,MAAM,MAAM,KAAK;AAAA,MAC5B,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEA,OAAO,MAAkC;AACvC,WAAO,IAAI,wBAAwB,KAAK,YAAY,IAAI,CAAC;AAAA,EAC3D;AAAA,EAEQ,oBAAoB,MAAc;AACxC,WAAO,KAAK,WAAW,KAAK,QAAQ,QAChC,sBAAS,KAAK,UAAU,IAAI,IAC5B;AAAA,EACN;AAAA,EAEQ,YAAY,MAAc;AAChC,eAAO,kBAAK,KAAK,UAAU,KAAK,oBAAoB,IAAI,CAAC;AAAA,EAC3D;AACF;",
6
+ "names": ["fs"]
7
+ }
@@ -1,40 +1,79 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
4
11
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getProjectPaths = void 0;
7
- const detect_framework_1 = require("./detect-framework");
8
- const frameworks_1 = __importDefault(require("@vercel/frameworks"));
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var get_project_paths_exports = {};
30
+ __export(get_project_paths_exports, {
31
+ getProjectPaths: () => getProjectPaths
32
+ });
33
+ module.exports = __toCommonJS(get_project_paths_exports);
34
+ var import_detect_framework = require("./detect-framework");
35
+ var import_frameworks = __toESM(require("@vercel/frameworks"));
9
36
  const MAX_DEPTH_TRAVERSE = 3;
10
- const getProjectPaths = async ({ fs, path, skipPaths, depth = MAX_DEPTH_TRAVERSE, }) => {
11
- if (depth === 0)
12
- return [];
13
- const allPaths = [];
14
- const topPath = path ?? './';
15
- if (path && skipPaths?.includes(path)) {
16
- return allPaths;
17
- }
18
- const framework = await (0, detect_framework_1.detectFramework)({
19
- fs: fs.chdir(topPath),
20
- frameworkList: frameworks_1.default,
21
- });
22
- if (framework !== null)
23
- allPaths.push(topPath);
24
- if (depth > 1) {
25
- const directoryContents = await fs.readdir(topPath);
26
- const childDirectories = directoryContents.filter(stat => stat.type === 'dir' && !skipPaths?.includes(stat.path));
27
- const paths = (await Promise.all(childDirectories.map(({ path }) => {
28
- return (0, exports.getProjectPaths)({
29
- fs,
30
- path,
31
- depth: depth - 1,
32
- skipPaths,
33
- });
34
- }))).flat();
35
- return [...paths, ...allPaths];
36
- }
37
+ const getProjectPaths = async ({
38
+ fs,
39
+ path,
40
+ skipPaths,
41
+ depth = MAX_DEPTH_TRAVERSE
42
+ }) => {
43
+ if (depth === 0)
44
+ return [];
45
+ const allPaths = [];
46
+ const topPath = path ?? "./";
47
+ if (path && skipPaths?.includes(path)) {
37
48
  return allPaths;
49
+ }
50
+ const framework = await (0, import_detect_framework.detectFramework)({
51
+ fs: fs.chdir(topPath),
52
+ frameworkList: import_frameworks.default
53
+ });
54
+ if (framework !== null)
55
+ allPaths.push(topPath);
56
+ if (depth > 1) {
57
+ const directoryContents = await fs.readdir(topPath);
58
+ const childDirectories = directoryContents.filter(
59
+ (stat) => stat.type === "dir" && !skipPaths?.includes(stat.path)
60
+ );
61
+ const paths = (await Promise.all(
62
+ childDirectories.map(({ path: path2 }) => {
63
+ return getProjectPaths({
64
+ fs,
65
+ path: path2,
66
+ depth: depth - 1,
67
+ skipPaths
68
+ });
69
+ })
70
+ )).flat();
71
+ return [...paths, ...allPaths];
72
+ }
73
+ return allPaths;
38
74
  };
39
- exports.getProjectPaths = getProjectPaths;
40
- //# sourceMappingURL=get-project-paths.js.map
75
+ // Annotate the CommonJS export names for ESM import in node:
76
+ 0 && (module.exports = {
77
+ getProjectPaths
78
+ });
79
+ //# sourceMappingURL=get-project-paths.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"get-project-paths.js","sourceRoot":"","sources":["../src/get-project-paths.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAqD;AAErD,oEAA4C;AAE5C,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAWtB,MAAM,eAAe,GAAG,KAAK,EAAE,EACpC,EAAE,EACF,IAAI,EACJ,SAAS,EACT,KAAK,GAAG,kBAAkB,GACH,EAA0B,EAAE;IACnD,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE3B,MAAM,QAAQ,GAAuB,EAAE,CAAC;IACxC,MAAM,OAAO,GAAW,IAAI,IAAI,IAAI,CAAC;IAErC,IAAI,IAAI,IAAI,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;QACrC,OAAO,QAAQ,CAAC;KACjB;IACD,MAAM,SAAS,GAAG,MAAM,IAAA,kCAAe,EAAC;QACtC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;QACrB,aAAa,EAAE,oBAAU;KAC1B,CAAC,CAAC;IAEH,IAAI,SAAS,KAAK,IAAI;QAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE/C,IAAI,KAAK,GAAG,CAAC,EAAE;QACb,MAAM,iBAAiB,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACpD,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,MAAM,CAC/C,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAC/D,CAAC;QAEF,MAAM,KAAK,GAAG,CACZ,MAAM,OAAO,CAAC,GAAG,CACf,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;YAChC,OAAO,IAAA,uBAAe,EAAC;gBACrB,EAAE;gBACF,IAAI;gBACJ,KAAK,EAAE,KAAK,GAAG,CAAC;gBAChB,SAAS;aACV,CAAC,CAAC;QACL,CAAC,CAAC,CACH,CACF,CAAC,IAAI,EAAE,CAAC;QAET,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,QAAQ,CAAC,CAAC;KAChC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AA5CW,QAAA,eAAe,mBA4C1B"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/get-project-paths.ts"],
4
+ "sourcesContent": ["import { detectFramework } from './detect-framework';\nimport { DetectorFilesystem } from './detectors/filesystem';\nimport frameworks from '@vercel/frameworks';\n\nconst MAX_DEPTH_TRAVERSE = 3;\n\nexport interface GetProjectPathsOptions {\n fs: DetectorFilesystem;\n path?: string;\n skipPaths?: string[];\n depth?: number;\n}\n\nexport type ProjectPath = string;\n\nexport const getProjectPaths = async ({\n fs,\n path,\n skipPaths,\n depth = MAX_DEPTH_TRAVERSE,\n}: GetProjectPathsOptions): Promise<ProjectPath[]> => {\n if (depth === 0) return [];\n\n const allPaths: Array<ProjectPath> = [];\n const topPath: string = path ?? './';\n\n if (path && skipPaths?.includes(path)) {\n return allPaths;\n }\n const framework = await detectFramework({\n fs: fs.chdir(topPath),\n frameworkList: frameworks,\n });\n\n if (framework !== null) allPaths.push(topPath);\n\n if (depth > 1) {\n const directoryContents = await fs.readdir(topPath);\n const childDirectories = directoryContents.filter(\n stat => stat.type === 'dir' && !skipPaths?.includes(stat.path)\n );\n\n const paths = (\n await Promise.all(\n childDirectories.map(({ path }) => {\n return getProjectPaths({\n fs,\n path,\n depth: depth - 1,\n skipPaths,\n });\n })\n )\n ).flat();\n\n return [...paths, ...allPaths];\n }\n\n return allPaths;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAgC;AAEhC,wBAAuB;AAEvB,MAAM,qBAAqB;AAWpB,MAAM,kBAAkB,OAAO;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AACV,MAAsD;AACpD,MAAI,UAAU;AAAG,WAAO,CAAC;AAEzB,QAAM,WAA+B,CAAC;AACtC,QAAM,UAAkB,QAAQ;AAEhC,MAAI,QAAQ,WAAW,SAAS,IAAI,GAAG;AACrC,WAAO;AAAA,EACT;AACA,QAAM,YAAY,UAAM,yCAAgB;AAAA,IACtC,IAAI,GAAG,MAAM,OAAO;AAAA,IACpB,eAAe,kBAAAA;AAAA,EACjB,CAAC;AAED,MAAI,cAAc;AAAM,aAAS,KAAK,OAAO;AAE7C,MAAI,QAAQ,GAAG;AACb,UAAM,oBAAoB,MAAM,GAAG,QAAQ,OAAO;AAClD,UAAM,mBAAmB,kBAAkB;AAAA,MACzC,UAAQ,KAAK,SAAS,SAAS,CAAC,WAAW,SAAS,KAAK,IAAI;AAAA,IAC/D;AAEA,UAAM,SACJ,MAAM,QAAQ;AAAA,MACZ,iBAAiB,IAAI,CAAC,EAAE,MAAAC,MAAK,MAAM;AACjC,eAAO,gBAAgB;AAAA,UACrB;AAAA,UACA,MAAAA;AAAA,UACA,OAAO,QAAQ;AAAA,UACf;AAAA,QACF,CAAC;AAAA,MACH,CAAC;AAAA,IACH,GACA,KAAK;AAEP,WAAO,CAAC,GAAG,OAAO,GAAG,QAAQ;AAAA,EAC/B;AAEA,SAAO;AACT;",
6
+ "names": ["frameworks", "path"]
7
+ }
package/dist/index.js CHANGED
@@ -1,50 +1,87 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
15
9
  };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.packageManagers = exports.isStaticRuntime = exports.isOfficialRuntime = exports.monorepoManagers = exports.getWorkspacePackagePaths = exports.getWorkspaces = exports.workspaceManagers = exports.LocalFileSystemDetector = exports.DetectorFilesystem = exports.getProjectPaths = exports.detectFrameworkVersion = exports.detectFrameworkRecord = exports.detectFrameworks = exports.detectFramework = exports.detectFileSystemAPI = exports.detectApiExtensions = exports.detectApiDirectory = exports.detectOutputDirectory = exports.detectBuilders = void 0;
18
- var detect_builders_1 = require("./detect-builders");
19
- Object.defineProperty(exports, "detectBuilders", { enumerable: true, get: function () { return detect_builders_1.detectBuilders; } });
20
- Object.defineProperty(exports, "detectOutputDirectory", { enumerable: true, get: function () { return detect_builders_1.detectOutputDirectory; } });
21
- Object.defineProperty(exports, "detectApiDirectory", { enumerable: true, get: function () { return detect_builders_1.detectApiDirectory; } });
22
- Object.defineProperty(exports, "detectApiExtensions", { enumerable: true, get: function () { return detect_builders_1.detectApiExtensions; } });
23
- var detect_file_system_api_1 = require("./detect-file-system-api");
24
- Object.defineProperty(exports, "detectFileSystemAPI", { enumerable: true, get: function () { return detect_file_system_api_1.detectFileSystemAPI; } });
25
- var detect_framework_1 = require("./detect-framework");
26
- Object.defineProperty(exports, "detectFramework", { enumerable: true, get: function () { return detect_framework_1.detectFramework; } });
27
- Object.defineProperty(exports, "detectFrameworks", { enumerable: true, get: function () { return detect_framework_1.detectFrameworks; } });
28
- Object.defineProperty(exports, "detectFrameworkRecord", { enumerable: true, get: function () { return detect_framework_1.detectFrameworkRecord; } });
29
- Object.defineProperty(exports, "detectFrameworkVersion", { enumerable: true, get: function () { return detect_framework_1.detectFrameworkVersion; } });
30
- var get_project_paths_1 = require("./get-project-paths");
31
- Object.defineProperty(exports, "getProjectPaths", { enumerable: true, get: function () { return get_project_paths_1.getProjectPaths; } });
32
- var filesystem_1 = require("./detectors/filesystem");
33
- Object.defineProperty(exports, "DetectorFilesystem", { enumerable: true, get: function () { return filesystem_1.DetectorFilesystem; } });
34
- var local_file_system_detector_1 = require("./detectors/local-file-system-detector");
35
- Object.defineProperty(exports, "LocalFileSystemDetector", { enumerable: true, get: function () { return local_file_system_detector_1.LocalFileSystemDetector; } });
36
- var workspace_managers_1 = require("./workspaces/workspace-managers");
37
- Object.defineProperty(exports, "workspaceManagers", { enumerable: true, get: function () { return workspace_managers_1.workspaceManagers; } });
38
- var get_workspaces_1 = require("./workspaces/get-workspaces");
39
- Object.defineProperty(exports, "getWorkspaces", { enumerable: true, get: function () { return get_workspaces_1.getWorkspaces; } });
40
- var get_workspace_package_paths_1 = require("./workspaces/get-workspace-package-paths");
41
- Object.defineProperty(exports, "getWorkspacePackagePaths", { enumerable: true, get: function () { return get_workspace_package_paths_1.getWorkspacePackagePaths; } });
42
- var monorepo_managers_1 = require("./monorepos/monorepo-managers");
43
- Object.defineProperty(exports, "monorepoManagers", { enumerable: true, get: function () { return monorepo_managers_1.monorepoManagers; } });
44
- var is_official_runtime_1 = require("./is-official-runtime");
45
- Object.defineProperty(exports, "isOfficialRuntime", { enumerable: true, get: function () { return is_official_runtime_1.isOfficialRuntime; } });
46
- Object.defineProperty(exports, "isStaticRuntime", { enumerable: true, get: function () { return is_official_runtime_1.isStaticRuntime; } });
47
- var package_managers_1 = require("./package-managers/package-managers");
48
- Object.defineProperty(exports, "packageManagers", { enumerable: true, get: function () { return package_managers_1.packageManagers; } });
49
- __exportStar(require("./monorepos/get-monorepo-default-settings"), exports);
50
- //# sourceMappingURL=index.js.map
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var src_exports = {};
21
+ __export(src_exports, {
22
+ DetectorFilesystem: () => import_filesystem.DetectorFilesystem,
23
+ GetWorkspaceOptions: () => import_get_workspaces.GetWorkspaceOptions,
24
+ GetWorkspacePackagePathsOptions: () => import_get_workspace_package_paths.GetWorkspacePackagePathsOptions,
25
+ LocalFileSystemDetector: () => import_local_file_system_detector.LocalFileSystemDetector,
26
+ Workspace: () => import_get_workspaces.Workspace,
27
+ WorkspaceType: () => import_get_workspaces.WorkspaceType,
28
+ detectApiDirectory: () => import_detect_builders.detectApiDirectory,
29
+ detectApiExtensions: () => import_detect_builders.detectApiExtensions,
30
+ detectBuilders: () => import_detect_builders.detectBuilders,
31
+ detectFileSystemAPI: () => import_detect_file_system_api.detectFileSystemAPI,
32
+ detectFramework: () => import_detect_framework.detectFramework,
33
+ detectFrameworkRecord: () => import_detect_framework.detectFrameworkRecord,
34
+ detectFrameworkVersion: () => import_detect_framework.detectFrameworkVersion,
35
+ detectFrameworks: () => import_detect_framework.detectFrameworks,
36
+ detectOutputDirectory: () => import_detect_builders.detectOutputDirectory,
37
+ getProjectPaths: () => import_get_project_paths.getProjectPaths,
38
+ getWorkspacePackagePaths: () => import_get_workspace_package_paths.getWorkspacePackagePaths,
39
+ getWorkspaces: () => import_get_workspaces.getWorkspaces,
40
+ isOfficialRuntime: () => import_is_official_runtime.isOfficialRuntime,
41
+ isStaticRuntime: () => import_is_official_runtime.isStaticRuntime,
42
+ monorepoManagers: () => import_monorepo_managers.monorepoManagers,
43
+ packageManagers: () => import_package_managers.packageManagers,
44
+ workspaceManagers: () => import_workspace_managers.workspaceManagers
45
+ });
46
+ module.exports = __toCommonJS(src_exports);
47
+ var import_detect_builders = require("./detect-builders");
48
+ var import_detect_file_system_api = require("./detect-file-system-api");
49
+ var import_detect_framework = require("./detect-framework");
50
+ var import_get_project_paths = require("./get-project-paths");
51
+ var import_filesystem = require("./detectors/filesystem");
52
+ var import_local_file_system_detector = require("./detectors/local-file-system-detector");
53
+ var import_workspace_managers = require("./workspaces/workspace-managers");
54
+ var import_get_workspaces = require("./workspaces/get-workspaces");
55
+ var import_get_workspace_package_paths = require("./workspaces/get-workspace-package-paths");
56
+ var import_monorepo_managers = require("./monorepos/monorepo-managers");
57
+ var import_is_official_runtime = require("./is-official-runtime");
58
+ var import_package_managers = require("./package-managers/package-managers");
59
+ __reExport(src_exports, require("./monorepos/get-monorepo-default-settings"), module.exports);
60
+ // Annotate the CommonJS export names for ESM import in node:
61
+ 0 && (module.exports = {
62
+ DetectorFilesystem,
63
+ GetWorkspaceOptions,
64
+ GetWorkspacePackagePathsOptions,
65
+ LocalFileSystemDetector,
66
+ Workspace,
67
+ WorkspaceType,
68
+ detectApiDirectory,
69
+ detectApiExtensions,
70
+ detectBuilders,
71
+ detectFileSystemAPI,
72
+ detectFramework,
73
+ detectFrameworkRecord,
74
+ detectFrameworkVersion,
75
+ detectFrameworks,
76
+ detectOutputDirectory,
77
+ getProjectPaths,
78
+ getWorkspacePackagePaths,
79
+ getWorkspaces,
80
+ isOfficialRuntime,
81
+ isStaticRuntime,
82
+ monorepoManagers,
83
+ packageManagers,
84
+ workspaceManagers,
85
+ ...require("./monorepos/get-monorepo-default-settings")
86
+ });
87
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAK2B;AAJzB,iHAAA,cAAc,OAAA;AACd,wHAAA,qBAAqB,OAAA;AACrB,qHAAA,kBAAkB,OAAA;AAClB,sHAAA,mBAAmB,OAAA;AAErB,mEAA+D;AAAtD,6HAAA,mBAAmB,OAAA;AAC5B,uDAK4B;AAJ1B,mHAAA,eAAe,OAAA;AACf,oHAAA,gBAAgB,OAAA;AAChB,yHAAA,qBAAqB,OAAA;AACrB,0HAAA,sBAAsB,OAAA;AAExB,yDAAsD;AAA7C,oHAAA,eAAe,OAAA;AACxB,qDAA4D;AAAnD,gHAAA,kBAAkB,OAAA;AAC3B,qFAAiF;AAAxE,qIAAA,uBAAuB,OAAA;AAChC,sEAAoE;AAA3D,uHAAA,iBAAiB,OAAA;AAC1B,8DAKqC;AAJnC,+GAAA,aAAa,OAAA;AAKf,wFAGkD;AAFhD,uIAAA,wBAAwB,OAAA;AAG1B,mEAAiE;AAAxD,qHAAA,gBAAgB,OAAA;AACzB,6DAA2E;AAAlE,wHAAA,iBAAiB,OAAA;AAAE,sHAAA,eAAe,OAAA;AAC3C,wEAAsE;AAA7D,mHAAA,eAAe,OAAA;AACxB,4EAA0D"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["export {\n detectBuilders,\n detectOutputDirectory,\n detectApiDirectory,\n detectApiExtensions,\n} from './detect-builders';\nexport { detectFileSystemAPI } from './detect-file-system-api';\nexport {\n detectFramework,\n detectFrameworks,\n detectFrameworkRecord,\n detectFrameworkVersion,\n} from './detect-framework';\nexport { getProjectPaths } from './get-project-paths';\nexport { DetectorFilesystem } from './detectors/filesystem';\nexport { LocalFileSystemDetector } from './detectors/local-file-system-detector';\nexport { workspaceManagers } from './workspaces/workspace-managers';\nexport {\n getWorkspaces,\n GetWorkspaceOptions,\n Workspace,\n WorkspaceType,\n} from './workspaces/get-workspaces';\nexport {\n getWorkspacePackagePaths,\n GetWorkspacePackagePathsOptions,\n} from './workspaces/get-workspace-package-paths';\nexport { monorepoManagers } from './monorepos/monorepo-managers';\nexport { isOfficialRuntime, isStaticRuntime } from './is-official-runtime';\nexport { packageManagers } from './package-managers/package-managers';\nexport * from './monorepos/get-monorepo-default-settings';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAKO;AACP,oCAAoC;AACpC,8BAKO;AACP,+BAAgC;AAChC,wBAAmC;AACnC,wCAAwC;AACxC,gCAAkC;AAClC,4BAKO;AACP,yCAGO;AACP,+BAAiC;AACjC,iCAAmD;AACnD,8BAAgC;AAChC,wBAAc,sDA9Bd;",
6
+ "names": []
7
+ }
@@ -1,24 +1,39 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isStaticRuntime = exports.isOfficialRuntime = void 0;
4
- /*
5
- * Helper function to support both `@vercel` and legacy `@now` official Runtimes.
6
- */
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var is_official_runtime_exports = {};
20
+ __export(is_official_runtime_exports, {
21
+ isOfficialRuntime: () => isOfficialRuntime,
22
+ isStaticRuntime: () => isStaticRuntime
23
+ });
24
+ module.exports = __toCommonJS(is_official_runtime_exports);
7
25
  const isOfficialRuntime = (desired, name) => {
8
- if (typeof name !== 'string') {
9
- return false;
10
- }
11
- return (name === `@vercel/${desired}` ||
12
- name === `@now/${desired}` ||
13
- name.startsWith(`@vercel/${desired}@`) ||
14
- name.startsWith(`@now/${desired}@`));
26
+ if (typeof name !== "string") {
27
+ return false;
28
+ }
29
+ return name === `@vercel/${desired}` || name === `@now/${desired}` || name.startsWith(`@vercel/${desired}@`) || name.startsWith(`@now/${desired}@`);
15
30
  };
16
- exports.isOfficialRuntime = isOfficialRuntime;
17
- /*
18
- * Helper function to detect both `@vercel/static` and legacy `@now/static` official Runtimes.
19
- */
20
31
  const isStaticRuntime = (name) => {
21
- return (0, exports.isOfficialRuntime)('static', name);
32
+ return isOfficialRuntime("static", name);
22
33
  };
23
- exports.isStaticRuntime = isStaticRuntime;
24
- //# sourceMappingURL=is-official-runtime.js.map
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ isOfficialRuntime,
37
+ isStaticRuntime
38
+ });
39
+ //# sourceMappingURL=is-official-runtime.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"is-official-runtime.js","sourceRoot":"","sources":["../src/is-official-runtime.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAE,IAAa,EAAW,EAAE;IAC3E,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO,KAAK,CAAC;KACd;IACD,OAAO,CACL,IAAI,KAAK,WAAW,OAAO,EAAE;QAC7B,IAAI,KAAK,QAAQ,OAAO,EAAE;QAC1B,IAAI,CAAC,UAAU,CAAC,WAAW,OAAO,GAAG,CAAC;QACtC,IAAI,CAAC,UAAU,CAAC,QAAQ,OAAO,GAAG,CAAC,CACpC,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,iBAAiB,qBAU5B;AAEF;;GAEG;AACI,MAAM,eAAe,GAAG,CAAC,IAAa,EAAW,EAAE;IACxD,OAAO,IAAA,yBAAiB,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC3C,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/is-official-runtime.ts"],
4
+ "sourcesContent": ["/*\n * Helper function to support both `@vercel` and legacy `@now` official Runtimes.\n */\nexport const isOfficialRuntime = (desired: string, name?: string): boolean => {\n if (typeof name !== 'string') {\n return false;\n }\n return (\n name === `@vercel/${desired}` ||\n name === `@now/${desired}` ||\n name.startsWith(`@vercel/${desired}@`) ||\n name.startsWith(`@now/${desired}@`)\n );\n};\n\n/*\n * Helper function to detect both `@vercel/static` and legacy `@now/static` official Runtimes.\n */\nexport const isStaticRuntime = (name?: string): boolean => {\n return isOfficialRuntime('static', name);\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,oBAAoB,CAAC,SAAiB,SAA2B;AAC5E,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO;AAAA,EACT;AACA,SACE,SAAS,WAAW,OAAO,MAC3B,SAAS,QAAQ,OAAO,MACxB,KAAK,WAAW,WAAW,OAAO,GAAG,KACrC,KAAK,WAAW,QAAQ,OAAO,GAAG;AAEtC;AAKO,MAAM,kBAAkB,CAAC,SAA2B;AACzD,SAAO,kBAAkB,UAAU,IAAI;AACzC;",
6
+ "names": []
7
+ }