@vercel/build-utils 3.1.1-canary.1 → 3.1.1-canary.2
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 +1 -0
- package/dist/index.js +46 -1
- package/dist/workspaces/get-workspaces.d.ts +12 -0
- package/dist/workspaces/get-workspaces.js +35 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
@@ -32,4 +32,5 @@ export * from './errors';
|
|
32
32
|
export declare const isOfficialRuntime: (desired: string, name?: string | undefined) => boolean;
|
33
33
|
export declare const isStaticRuntime: (name?: string | undefined) => boolean;
|
34
34
|
export { workspaceManagers } from './workspaces/workspace-managers';
|
35
|
+
export { getWorkspaces } from './workspaces/get-workspaces';
|
35
36
|
export { monorepoManagers } from './monorepos/monorepo-managers';
|
package/dist/index.js
CHANGED
@@ -35223,7 +35223,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35223
35223
|
};
|
35224
35224
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
35225
35225
|
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;
|
35226
|
-
exports.monorepoManagers = void 0;
|
35226
|
+
exports.monorepoManagers = exports.getWorkspaces = void 0;
|
35227
35227
|
const file_blob_1 = __importDefault(__webpack_require__(2397));
|
35228
35228
|
exports.FileBlob = file_blob_1.default;
|
35229
35229
|
const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
|
@@ -35317,6 +35317,8 @@ const isStaticRuntime = (name) => {
|
|
35317
35317
|
exports.isStaticRuntime = isStaticRuntime;
|
35318
35318
|
var workspace_managers_1 = __webpack_require__(4896);
|
35319
35319
|
Object.defineProperty(exports, "workspaceManagers", ({ enumerable: true, get: function () { return workspace_managers_1.workspaceManagers; } }));
|
35320
|
+
var get_workspaces_1 = __webpack_require__(9740);
|
35321
|
+
Object.defineProperty(exports, "getWorkspaces", ({ enumerable: true, get: function () { return get_workspaces_1.getWorkspaces; } }));
|
35320
35322
|
var monorepo_managers_1 = __webpack_require__(6418);
|
35321
35323
|
Object.defineProperty(exports, "monorepoManagers", ({ enumerable: true, get: function () { return monorepo_managers_1.monorepoManagers; } }));
|
35322
35324
|
|
@@ -35681,6 +35683,49 @@ function hasProp(obj, key) {
|
|
35681
35683
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
35682
35684
|
|
35683
35685
|
|
35686
|
+
/***/ }),
|
35687
|
+
|
35688
|
+
/***/ 9740:
|
35689
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
35690
|
+
|
35691
|
+
"use strict";
|
35692
|
+
|
35693
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
35694
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
35695
|
+
};
|
35696
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
35697
|
+
exports.getWorkspaces = void 0;
|
35698
|
+
const path_1 = __importDefault(__webpack_require__(5622));
|
35699
|
+
const workspace_managers_1 = __webpack_require__(4896);
|
35700
|
+
const detect_framework_1 = __webpack_require__(5224);
|
35701
|
+
const MAX_DEPTH_TRAVERSE = 3;
|
35702
|
+
const posixPath = path_1.default.posix;
|
35703
|
+
async function getWorkspaces({ fs, depth = MAX_DEPTH_TRAVERSE, cwd = '/', }) {
|
35704
|
+
if (depth === 0)
|
35705
|
+
return [];
|
35706
|
+
const workspaceType = await detect_framework_1.detectFramework({
|
35707
|
+
fs,
|
35708
|
+
frameworkList: workspace_managers_1.workspaceManagers,
|
35709
|
+
});
|
35710
|
+
if (workspaceType === null) {
|
35711
|
+
const directoryContents = await fs.readdir('./');
|
35712
|
+
const childDirectories = directoryContents.filter(stat => stat.type === 'dir');
|
35713
|
+
return (await Promise.all(childDirectories.map(childDirectory => getWorkspaces({
|
35714
|
+
fs: fs.chdir(childDirectory.path),
|
35715
|
+
depth: depth - 1,
|
35716
|
+
cwd: posixPath.join(cwd, childDirectory.path),
|
35717
|
+
})))).flat();
|
35718
|
+
}
|
35719
|
+
return [
|
35720
|
+
{
|
35721
|
+
type: workspaceType,
|
35722
|
+
rootPath: cwd,
|
35723
|
+
},
|
35724
|
+
];
|
35725
|
+
}
|
35726
|
+
exports.getWorkspaces = getWorkspaces;
|
35727
|
+
|
35728
|
+
|
35684
35729
|
/***/ }),
|
35685
35730
|
|
35686
35731
|
/***/ 4896:
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { DetectorFilesystem } from '../detectors/filesystem';
|
2
|
+
export interface GetWorkspaceOptions {
|
3
|
+
fs: DetectorFilesystem;
|
4
|
+
depth?: number;
|
5
|
+
cwd?: string;
|
6
|
+
}
|
7
|
+
export declare type WorkspaceType = 'yarn' | 'pnpm' | 'npm';
|
8
|
+
export declare type Workspace = {
|
9
|
+
type: WorkspaceType;
|
10
|
+
rootPath: string;
|
11
|
+
};
|
12
|
+
export declare function getWorkspaces({ fs, depth, cwd, }: GetWorkspaceOptions): Promise<Workspace[]>;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.getWorkspaces = void 0;
|
7
|
+
const path_1 = __importDefault(require("path"));
|
8
|
+
const workspace_managers_1 = require("./workspace-managers");
|
9
|
+
const detect_framework_1 = require("../detect-framework");
|
10
|
+
const MAX_DEPTH_TRAVERSE = 3;
|
11
|
+
const posixPath = path_1.default.posix;
|
12
|
+
async function getWorkspaces({ fs, depth = MAX_DEPTH_TRAVERSE, cwd = '/', }) {
|
13
|
+
if (depth === 0)
|
14
|
+
return [];
|
15
|
+
const workspaceType = await detect_framework_1.detectFramework({
|
16
|
+
fs,
|
17
|
+
frameworkList: workspace_managers_1.workspaceManagers,
|
18
|
+
});
|
19
|
+
if (workspaceType === null) {
|
20
|
+
const directoryContents = await fs.readdir('./');
|
21
|
+
const childDirectories = directoryContents.filter(stat => stat.type === 'dir');
|
22
|
+
return (await Promise.all(childDirectories.map(childDirectory => getWorkspaces({
|
23
|
+
fs: fs.chdir(childDirectory.path),
|
24
|
+
depth: depth - 1,
|
25
|
+
cwd: posixPath.join(cwd, childDirectory.path),
|
26
|
+
})))).flat();
|
27
|
+
}
|
28
|
+
return [
|
29
|
+
{
|
30
|
+
type: workspaceType,
|
31
|
+
rootPath: cwd,
|
32
|
+
},
|
33
|
+
];
|
34
|
+
}
|
35
|
+
exports.getWorkspaces = getWorkspaces;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "3.1.1-canary.
|
3
|
+
"version": "3.1.1-canary.2",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -50,5 +50,5 @@
|
|
50
50
|
"typescript": "4.3.4",
|
51
51
|
"yazl": "2.5.1"
|
52
52
|
},
|
53
|
-
"gitHead": "
|
53
|
+
"gitHead": "be74f79fa06e3252519a9c0a8fd8564ab5676bae"
|
54
54
|
}
|