@vercel/build-utils 4.0.0 → 4.0.1-canary.0
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/fs/get-glob-fs.d.ts +6 -0
- package/dist/fs/get-glob-fs.js +71 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1408 -151
- package/dist/types.d.ts +1 -1
- package/dist/workspaces/get-workspace-package-paths.d.ts +11 -0
- package/dist/workspaces/get-workspace-package-paths.js +62 -0
- package/package.json +4 -4
@@ -0,0 +1,71 @@
|
|
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.getGlobFs = void 0;
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
8
|
+
function normalizePath(path) {
|
9
|
+
// on windows, this will return a path like
|
10
|
+
// D:/c/package.json
|
11
|
+
// since we abstract the filesystem, we need to remove windows specific info from the path
|
12
|
+
// and let the FS decide how to process the path
|
13
|
+
// D:/c/package.json => /c/package.json
|
14
|
+
return path.replace(/^[a-zA-Z]:/, '');
|
15
|
+
}
|
16
|
+
function getGlobFs(_fs) {
|
17
|
+
const readdir = (path, callback) => {
|
18
|
+
_fs
|
19
|
+
.readdir(normalizePath(String(path)))
|
20
|
+
.then(stats => callback(null, stats.map(stat => stat.name)))
|
21
|
+
.catch(err => callback(err, []));
|
22
|
+
};
|
23
|
+
const stat = (path, callback) => {
|
24
|
+
_fs
|
25
|
+
.isFile(normalizePath(String(path)))
|
26
|
+
.then(isPathAFile => {
|
27
|
+
callback(null, {
|
28
|
+
ino: 0,
|
29
|
+
mode: 0,
|
30
|
+
nlink: 0,
|
31
|
+
uid: 0,
|
32
|
+
gid: 0,
|
33
|
+
rdev: 0,
|
34
|
+
size: 0,
|
35
|
+
blksize: 0,
|
36
|
+
blocks: 0,
|
37
|
+
atimeMs: 0,
|
38
|
+
mtimeMs: 0,
|
39
|
+
ctimeMs: 0,
|
40
|
+
birthtimeMs: 0,
|
41
|
+
atime: new Date(),
|
42
|
+
mtime: new Date(),
|
43
|
+
ctime: new Date(),
|
44
|
+
birthtime: new Date(),
|
45
|
+
dev: 0,
|
46
|
+
isBlockDevice: () => false,
|
47
|
+
isCharacterDevice: () => false,
|
48
|
+
isDirectory: () => !isPathAFile,
|
49
|
+
isFIFO: () => false,
|
50
|
+
isFile: () => isPathAFile,
|
51
|
+
isSocket: () => false,
|
52
|
+
isSymbolicLink: () => false,
|
53
|
+
});
|
54
|
+
})
|
55
|
+
.catch(err => callback(err, null));
|
56
|
+
};
|
57
|
+
return new Proxy(fs_1.default, {
|
58
|
+
get(_target, prop) {
|
59
|
+
switch (prop) {
|
60
|
+
case 'readdir':
|
61
|
+
return readdir;
|
62
|
+
case 'lstat':
|
63
|
+
case 'stat':
|
64
|
+
return stat;
|
65
|
+
default:
|
66
|
+
throw new Error('Not Implemented');
|
67
|
+
}
|
68
|
+
},
|
69
|
+
});
|
70
|
+
}
|
71
|
+
exports.getGlobFs = getGlobFs;
|
package/dist/index.d.ts
CHANGED
@@ -32,5 +32,6 @@ 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
|
+
export { getWorkspaces, GetWorkspaceOptions, Workspace, WorkspaceType, } from './workspaces/get-workspaces';
|
36
|
+
export { getWorkspacePackagePaths, GetWorkspacePackagePathsOptions, } from './workspaces/get-workspace-package-paths';
|
36
37
|
export { monorepoManagers } from './monorepos/monorepo-managers';
|