workspace-tools 0.38.4 → 0.38.5
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/lib/getPackageInfos.d.ts +14 -0
- package/lib/getPackageInfos.js +17 -20
- package/lib/getPackageInfos.js.map +1 -1
- package/lib/getPackagePaths.d.ts +2 -2
- package/lib/getPackagePaths.js +2 -2
- package/lib/git/gitUtilities.d.ts +132 -3
- package/lib/git/gitUtilities.js +141 -4
- package/lib/git/gitUtilities.js.map +1 -1
- package/lib/graph/createDependencyMap.d.ts +1 -1
- package/lib/graph/createDependencyMap.js.map +1 -1
- package/lib/graph/getPackageDependencies.d.ts +10 -1
- package/lib/graph/getPackageDependencies.js +17 -5
- package/lib/graph/getPackageDependencies.js.map +1 -1
- package/lib/index.d.ts +17 -14
- package/lib/index.js +40 -15
- package/lib/index.js.map +1 -1
- package/lib/lockfile/parseBerryLock.d.ts +3 -0
- package/lib/lockfile/parseBerryLock.js +3 -0
- package/lib/lockfile/parseBerryLock.js.map +1 -1
- package/lib/lockfile/types.d.ts +3 -0
- package/lib/paths.d.ts +3 -0
- package/lib/paths.js +4 -1
- package/lib/paths.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/types/Catalogs.d.ts +30 -0
- package/lib/types/Catalogs.js +3 -0
- package/lib/types/Catalogs.js.map +1 -0
- package/lib/types/PackageInfo.d.ts +19 -1
- package/lib/types/WorkspaceInfo.d.ts +15 -6
- package/lib/workspaces/catalogs.d.ts +28 -0
- package/lib/workspaces/catalogs.js +57 -0
- package/lib/workspaces/catalogs.js.map +1 -0
- package/lib/workspaces/findWorkspacePath.d.ts +5 -5
- package/lib/workspaces/findWorkspacePath.js +3 -3
- package/lib/workspaces/findWorkspacePath.js.map +1 -1
- package/lib/workspaces/getWorkspacePackageInfo.d.ts +12 -9
- package/lib/workspaces/getWorkspacePackageInfo.js +14 -16
- package/lib/workspaces/getWorkspacePackageInfo.js.map +1 -1
- package/lib/workspaces/getWorkspaceRoot.d.ts +18 -2
- package/lib/workspaces/getWorkspaceRoot.js +23 -4
- package/lib/workspaces/getWorkspaceRoot.js.map +1 -1
- package/lib/workspaces/getWorkspaces.d.ts +11 -14
- package/lib/workspaces/getWorkspaces.js +8 -11
- package/lib/workspaces/getWorkspaces.js.map +1 -1
- package/lib/workspaces/implementations/getWorkspaceUtilities.d.ts +16 -9
- package/lib/workspaces/implementations/getWorkspaceUtilities.js.map +1 -1
- package/lib/workspaces/implementations/index.d.ts +2 -2
- package/lib/workspaces/implementations/index.js.map +1 -1
- package/lib/workspaces/implementations/lerna.d.ts +8 -8
- package/lib/workspaces/implementations/lerna.js +5 -5
- package/lib/workspaces/implementations/lerna.js.map +1 -1
- package/lib/workspaces/implementations/npm.d.ts +9 -9
- package/lib/workspaces/implementations/npm.js +6 -6
- package/lib/workspaces/implementations/npm.js.map +1 -1
- package/lib/workspaces/implementations/packageJsonWorkspaces.d.ts +21 -10
- package/lib/workspaces/implementations/packageJsonWorkspaces.js +34 -23
- package/lib/workspaces/implementations/packageJsonWorkspaces.js.map +1 -1
- package/lib/workspaces/implementations/pnpm.d.ts +17 -9
- package/lib/workspaces/implementations/pnpm.js +37 -11
- package/lib/workspaces/implementations/pnpm.js.map +1 -1
- package/lib/workspaces/implementations/rush.d.ts +8 -8
- package/lib/workspaces/implementations/rush.js +5 -5
- package/lib/workspaces/implementations/rush.js.map +1 -1
- package/lib/workspaces/implementations/yarn.d.ts +18 -10
- package/lib/workspaces/implementations/yarn.js +51 -10
- package/lib/workspaces/implementations/yarn.js.map +1 -1
- package/lib/workspaces/listOfWorkspacePackageNames.d.ts +5 -2
- package/lib/workspaces/listOfWorkspacePackageNames.js +3 -0
- package/lib/workspaces/listOfWorkspacePackageNames.js.map +1 -1
- package/lib/workspaces/readPackageInfo.d.ts +13 -0
- package/lib/workspaces/readPackageInfo.js +52 -0
- package/lib/workspaces/readPackageInfo.js.map +1 -0
- package/package.json +2 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDependencyMap.js","sourceRoot":"","sources":["../../src/graph/createDependencyMap.ts"],"names":[],"mappings":";;;AAAA,qEAA8F;
|
|
1
|
+
{"version":3,"file":"createDependencyMap.js","sourceRoot":"","sources":["../../src/graph/createDependencyMap.ts"],"names":[],"mappings":";;;AAAA,qEAA8F;AAQ9F,SAAgB,mBAAmB,CACjC,QAAsB,EACtB,UAAsC,EAAE,mBAAmB,EAAE,IAAI,EAAE,oBAAoB,EAAE,KAAK,EAAE;IAEhG,MAAM,GAAG,GAAG;QACV,YAAY,EAAE,IAAI,GAAG,EAAuB;QAC5C,UAAU,EAAE,IAAI,GAAG,EAAuB;KAC3C,CAAC;IAEF,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAExD,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAClD,MAAM,IAAI,GAAG,IAAA,+CAAsB,EAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC;QACrE,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;gBAC9B,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;aACtC;YACD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAEpC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;gBAC5B,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;aACpC;YACD,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SACnC;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AA1BD,kDA0BC"}
|
|
@@ -4,4 +4,13 @@ export interface PackageDependenciesOptions {
|
|
|
4
4
|
withPeerDependencies?: boolean;
|
|
5
5
|
withOptionalDependencies?: boolean;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Gets the workspace package dependencies for a given package (excluding `file:` or `npm:` versions).
|
|
9
|
+
* It only considers `dependencies` unless options specify otherwise.
|
|
10
|
+
*
|
|
11
|
+
* @param info - The package information containing dependencies
|
|
12
|
+
* @param internalPackages - Set of in-repo package names to consider.
|
|
13
|
+
* @param options - Configuration options for which dependency types to include
|
|
14
|
+
* @returns Subset of `packages` that are dependencies of the given package
|
|
15
|
+
*/
|
|
16
|
+
export declare function getPackageDependencies(info: PackageInfo, internalPackages: Set<string>, options?: PackageDependenciesOptions): string[];
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPackageDependencies = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Verify that `dep`'s version is not specified with `npm:` or `file:` protocol.
|
|
6
|
+
*/
|
|
4
7
|
function isValidDependency(info, dep) {
|
|
5
8
|
// check if the dependency range is specified by an external package like npm: or file:
|
|
6
9
|
const range = info.dependencies?.[dep] ||
|
|
@@ -13,32 +16,41 @@ function isValidDependency(info, dep) {
|
|
|
13
16
|
}
|
|
14
17
|
return !range.startsWith("npm:") && !range.startsWith("file:");
|
|
15
18
|
}
|
|
16
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Gets the workspace package dependencies for a given package (excluding `file:` or `npm:` versions).
|
|
21
|
+
* It only considers `dependencies` unless options specify otherwise.
|
|
22
|
+
*
|
|
23
|
+
* @param info - The package information containing dependencies
|
|
24
|
+
* @param internalPackages - Set of in-repo package names to consider.
|
|
25
|
+
* @param options - Configuration options for which dependency types to include
|
|
26
|
+
* @returns Subset of `packages` that are dependencies of the given package
|
|
27
|
+
*/
|
|
28
|
+
function getPackageDependencies(info, internalPackages, options = { withDevDependencies: true }) {
|
|
17
29
|
const deps = [];
|
|
18
30
|
if (info.dependencies) {
|
|
19
31
|
for (const dep of Object.keys(info.dependencies)) {
|
|
20
|
-
if (dep !== info.name &&
|
|
32
|
+
if (dep !== info.name && internalPackages.has(dep)) {
|
|
21
33
|
deps.push(dep);
|
|
22
34
|
}
|
|
23
35
|
}
|
|
24
36
|
}
|
|
25
37
|
if (info.devDependencies && options.withDevDependencies) {
|
|
26
38
|
for (const dep of Object.keys(info.devDependencies)) {
|
|
27
|
-
if (dep !== info.name &&
|
|
39
|
+
if (dep !== info.name && internalPackages.has(dep)) {
|
|
28
40
|
deps.push(dep);
|
|
29
41
|
}
|
|
30
42
|
}
|
|
31
43
|
}
|
|
32
44
|
if (info.peerDependencies && options.withPeerDependencies) {
|
|
33
45
|
for (const dep of Object.keys(info.peerDependencies)) {
|
|
34
|
-
if (dep !== info.name &&
|
|
46
|
+
if (dep !== info.name && internalPackages.has(dep)) {
|
|
35
47
|
deps.push(dep);
|
|
36
48
|
}
|
|
37
49
|
}
|
|
38
50
|
}
|
|
39
51
|
if (info.optionalDependencies && options.withOptionalDependencies) {
|
|
40
52
|
for (const dep of Object.keys(info.optionalDependencies)) {
|
|
41
|
-
if (dep !== info.name &&
|
|
53
|
+
if (dep !== info.name && internalPackages.has(dep)) {
|
|
42
54
|
deps.push(dep);
|
|
43
55
|
}
|
|
44
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageDependencies.js","sourceRoot":"","sources":["../../src/graph/getPackageDependencies.ts"],"names":[],"mappings":";;;AAQA,SAAS,iBAAiB,CAAC,IAAiB,EAAE,GAAW;IACvD,uFAAuF;IACvF,MAAM,KAAK,GACT,IAAI,CAAC,YAAY,EAAE,CAAC,GAAG,CAAC;QACxB,IAAI,CAAC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CAAC;AA1CD,wDA0CC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
export * from "./dependencies/index";
|
|
2
|
-
export
|
|
2
|
+
export { getPackageInfos, getPackageInfosAsync } from "./getPackageInfos";
|
|
3
3
|
export * from "./git";
|
|
4
4
|
export * from "./graph/index";
|
|
5
5
|
export { setCachingEnabled } from "./isCachingEnabled";
|
|
6
6
|
export * from "./lockfile";
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
7
|
+
export { findGitRoot, findPackageRoot, findProjectRoot, isChildOf, searchUp } from "./paths";
|
|
8
|
+
export { getScopedPackages } from "./scope";
|
|
9
|
+
export type { Catalog, Catalogs, NamedCatalogs } from "./types/Catalogs";
|
|
10
|
+
export type { PackageDependency, PackageGraph } from "./types/PackageGraph";
|
|
11
|
+
export type { PackageInfo, PackageInfos } from "./types/PackageInfo";
|
|
12
|
+
export type { WorkspacePackageInfo, WorkspaceInfos, WorkspaceInfo } from "./types/WorkspaceInfo";
|
|
13
|
+
export { findWorkspacePath } from "./workspaces/findWorkspacePath";
|
|
14
|
+
export { getWorkspaces, getWorkspacesAsync } from "./workspaces/getWorkspaces";
|
|
15
|
+
export { getWorkspacePackagePaths, getWorkspacePackagePathsAsync } from "./workspaces/getWorkspacePackagePaths";
|
|
16
|
+
export { getWorkspaceManagerRoot, getWorkspaceRoot } from "./workspaces/getWorkspaceRoot";
|
|
17
|
+
export { readPackageInfo, readPackageInfoAsync } from "./workspaces/readPackageInfo";
|
|
16
18
|
export { getPnpmWorkspaceRoot, getPnpmWorkspaces } from "./workspaces/implementations/pnpm";
|
|
17
19
|
export { getRushWorkspaceRoot, getRushWorkspaces } from "./workspaces/implementations/rush";
|
|
18
20
|
export { getYarnWorkspaceRoot, getYarnWorkspaces } from "./workspaces/implementations/yarn";
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
21
|
+
export { getChangedPackages, getChangedPackagesBetweenRefs } from "./workspaces/getChangedPackages";
|
|
22
|
+
export { getPackagesByFiles } from "./workspaces/getPackagesByFiles";
|
|
23
|
+
export { listOfWorkspacePackageNames } from "./workspaces/listOfWorkspacePackageNames";
|
|
24
|
+
export { getAllPackageJsonFiles, getAllPackageJsonFilesAsync } from "./workspaces/getAllPackageJsonFiles";
|
|
25
|
+
export { getCatalogs, getCatalogVersion, isCatalogVersion } from "./workspaces/catalogs";
|
package/lib/index.js
CHANGED
|
@@ -14,23 +14,38 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.getYarnWorkspaces = exports.getYarnWorkspaceRoot = exports.getRushWorkspaces = exports.getRushWorkspaceRoot = exports.getPnpmWorkspaces = exports.getPnpmWorkspaceRoot = exports.setCachingEnabled = void 0;
|
|
17
|
+
exports.isCatalogVersion = exports.getCatalogVersion = exports.getCatalogs = exports.getAllPackageJsonFilesAsync = exports.getAllPackageJsonFiles = exports.listOfWorkspacePackageNames = exports.getPackagesByFiles = exports.getChangedPackagesBetweenRefs = exports.getChangedPackages = exports.getYarnWorkspaces = exports.getYarnWorkspaceRoot = exports.getRushWorkspaces = exports.getRushWorkspaceRoot = exports.getPnpmWorkspaces = exports.getPnpmWorkspaceRoot = exports.readPackageInfoAsync = exports.readPackageInfo = exports.getWorkspaceRoot = exports.getWorkspaceManagerRoot = exports.getWorkspacePackagePathsAsync = exports.getWorkspacePackagePaths = exports.getWorkspacesAsync = exports.getWorkspaces = exports.findWorkspacePath = exports.getScopedPackages = exports.searchUp = exports.isChildOf = exports.findProjectRoot = exports.findPackageRoot = exports.findGitRoot = exports.setCachingEnabled = exports.getPackageInfosAsync = exports.getPackageInfos = void 0;
|
|
18
18
|
__exportStar(require("./dependencies/index"), exports);
|
|
19
|
-
|
|
19
|
+
var getPackageInfos_1 = require("./getPackageInfos");
|
|
20
|
+
Object.defineProperty(exports, "getPackageInfos", { enumerable: true, get: function () { return getPackageInfos_1.getPackageInfos; } });
|
|
21
|
+
Object.defineProperty(exports, "getPackageInfosAsync", { enumerable: true, get: function () { return getPackageInfos_1.getPackageInfosAsync; } });
|
|
20
22
|
__exportStar(require("./git"), exports);
|
|
21
23
|
__exportStar(require("./graph/index"), exports);
|
|
22
24
|
var isCachingEnabled_1 = require("./isCachingEnabled");
|
|
23
25
|
Object.defineProperty(exports, "setCachingEnabled", { enumerable: true, get: function () { return isCachingEnabled_1.setCachingEnabled; } });
|
|
24
26
|
__exportStar(require("./lockfile"), exports);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
var paths_1 = require("./paths");
|
|
28
|
+
Object.defineProperty(exports, "findGitRoot", { enumerable: true, get: function () { return paths_1.findGitRoot; } });
|
|
29
|
+
Object.defineProperty(exports, "findPackageRoot", { enumerable: true, get: function () { return paths_1.findPackageRoot; } });
|
|
30
|
+
Object.defineProperty(exports, "findProjectRoot", { enumerable: true, get: function () { return paths_1.findProjectRoot; } });
|
|
31
|
+
Object.defineProperty(exports, "isChildOf", { enumerable: true, get: function () { return paths_1.isChildOf; } });
|
|
32
|
+
Object.defineProperty(exports, "searchUp", { enumerable: true, get: function () { return paths_1.searchUp; } });
|
|
33
|
+
var scope_1 = require("./scope");
|
|
34
|
+
Object.defineProperty(exports, "getScopedPackages", { enumerable: true, get: function () { return scope_1.getScopedPackages; } });
|
|
35
|
+
var findWorkspacePath_1 = require("./workspaces/findWorkspacePath");
|
|
36
|
+
Object.defineProperty(exports, "findWorkspacePath", { enumerable: true, get: function () { return findWorkspacePath_1.findWorkspacePath; } });
|
|
37
|
+
var getWorkspaces_1 = require("./workspaces/getWorkspaces");
|
|
38
|
+
Object.defineProperty(exports, "getWorkspaces", { enumerable: true, get: function () { return getWorkspaces_1.getWorkspaces; } });
|
|
39
|
+
Object.defineProperty(exports, "getWorkspacesAsync", { enumerable: true, get: function () { return getWorkspaces_1.getWorkspacesAsync; } });
|
|
40
|
+
var getWorkspacePackagePaths_1 = require("./workspaces/getWorkspacePackagePaths");
|
|
41
|
+
Object.defineProperty(exports, "getWorkspacePackagePaths", { enumerable: true, get: function () { return getWorkspacePackagePaths_1.getWorkspacePackagePaths; } });
|
|
42
|
+
Object.defineProperty(exports, "getWorkspacePackagePathsAsync", { enumerable: true, get: function () { return getWorkspacePackagePaths_1.getWorkspacePackagePathsAsync; } });
|
|
43
|
+
var getWorkspaceRoot_1 = require("./workspaces/getWorkspaceRoot");
|
|
44
|
+
Object.defineProperty(exports, "getWorkspaceManagerRoot", { enumerable: true, get: function () { return getWorkspaceRoot_1.getWorkspaceManagerRoot; } });
|
|
45
|
+
Object.defineProperty(exports, "getWorkspaceRoot", { enumerable: true, get: function () { return getWorkspaceRoot_1.getWorkspaceRoot; } });
|
|
46
|
+
var readPackageInfo_1 = require("./workspaces/readPackageInfo");
|
|
47
|
+
Object.defineProperty(exports, "readPackageInfo", { enumerable: true, get: function () { return readPackageInfo_1.readPackageInfo; } });
|
|
48
|
+
Object.defineProperty(exports, "readPackageInfoAsync", { enumerable: true, get: function () { return readPackageInfo_1.readPackageInfoAsync; } });
|
|
34
49
|
var pnpm_1 = require("./workspaces/implementations/pnpm");
|
|
35
50
|
Object.defineProperty(exports, "getPnpmWorkspaceRoot", { enumerable: true, get: function () { return pnpm_1.getPnpmWorkspaceRoot; } });
|
|
36
51
|
Object.defineProperty(exports, "getPnpmWorkspaces", { enumerable: true, get: function () { return pnpm_1.getPnpmWorkspaces; } });
|
|
@@ -40,8 +55,18 @@ Object.defineProperty(exports, "getRushWorkspaces", { enumerable: true, get: fun
|
|
|
40
55
|
var yarn_1 = require("./workspaces/implementations/yarn");
|
|
41
56
|
Object.defineProperty(exports, "getYarnWorkspaceRoot", { enumerable: true, get: function () { return yarn_1.getYarnWorkspaceRoot; } });
|
|
42
57
|
Object.defineProperty(exports, "getYarnWorkspaces", { enumerable: true, get: function () { return yarn_1.getYarnWorkspaces; } });
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
var getChangedPackages_1 = require("./workspaces/getChangedPackages");
|
|
59
|
+
Object.defineProperty(exports, "getChangedPackages", { enumerable: true, get: function () { return getChangedPackages_1.getChangedPackages; } });
|
|
60
|
+
Object.defineProperty(exports, "getChangedPackagesBetweenRefs", { enumerable: true, get: function () { return getChangedPackages_1.getChangedPackagesBetweenRefs; } });
|
|
61
|
+
var getPackagesByFiles_1 = require("./workspaces/getPackagesByFiles");
|
|
62
|
+
Object.defineProperty(exports, "getPackagesByFiles", { enumerable: true, get: function () { return getPackagesByFiles_1.getPackagesByFiles; } });
|
|
63
|
+
var listOfWorkspacePackageNames_1 = require("./workspaces/listOfWorkspacePackageNames");
|
|
64
|
+
Object.defineProperty(exports, "listOfWorkspacePackageNames", { enumerable: true, get: function () { return listOfWorkspacePackageNames_1.listOfWorkspacePackageNames; } });
|
|
65
|
+
var getAllPackageJsonFiles_1 = require("./workspaces/getAllPackageJsonFiles");
|
|
66
|
+
Object.defineProperty(exports, "getAllPackageJsonFiles", { enumerable: true, get: function () { return getAllPackageJsonFiles_1.getAllPackageJsonFiles; } });
|
|
67
|
+
Object.defineProperty(exports, "getAllPackageJsonFilesAsync", { enumerable: true, get: function () { return getAllPackageJsonFiles_1.getAllPackageJsonFilesAsync; } });
|
|
68
|
+
var catalogs_1 = require("./workspaces/catalogs");
|
|
69
|
+
Object.defineProperty(exports, "getCatalogs", { enumerable: true, get: function () { return catalogs_1.getCatalogs; } });
|
|
70
|
+
Object.defineProperty(exports, "getCatalogVersion", { enumerable: true, get: function () { return catalogs_1.getCatalogVersion; } });
|
|
71
|
+
Object.defineProperty(exports, "isCatalogVersion", { enumerable: true, get: function () { return catalogs_1.isCatalogVersion; } });
|
|
47
72
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,qDAA0E;AAAjE,kHAAA,eAAe,OAAA;AAAE,uHAAA,oBAAoB,OAAA;AAC9C,wCAAsB;AACtB,gDAA8B;AAC9B,uDAAuD;AAA9C,qHAAA,iBAAiB,OAAA;AAC1B,6CAA2B;AAC3B,iCAA6F;AAApF,oGAAA,WAAW,OAAA;AAAE,wGAAA,eAAe,OAAA;AAAE,wGAAA,eAAe,OAAA;AAAE,kGAAA,SAAS,OAAA;AAAE,iGAAA,QAAQ,OAAA;AAC3E,iCAA4C;AAAnC,0GAAA,iBAAiB,OAAA;AAK1B,oEAAmE;AAA1D,sHAAA,iBAAiB,OAAA;AAC1B,4DAA+E;AAAtE,8GAAA,aAAa,OAAA;AAAE,mHAAA,kBAAkB,OAAA;AAC1C,kFAAgH;AAAvG,oIAAA,wBAAwB,OAAA;AAAE,yIAAA,6BAA6B,OAAA;AAChE,kEAA0F;AAAjF,2HAAA,uBAAuB,OAAA;AAAE,oHAAA,gBAAgB,OAAA;AAClD,gEAAqF;AAA5E,kHAAA,eAAe,OAAA;AAAE,uHAAA,oBAAoB,OAAA;AAC9C,0DAA4F;AAAnF,4GAAA,oBAAoB,OAAA;AAAE,yGAAA,iBAAiB,OAAA;AAChD,0DAA4F;AAAnF,4GAAA,oBAAoB,OAAA;AAAE,yGAAA,iBAAiB,OAAA;AAChD,0DAA4F;AAAnF,4GAAA,oBAAoB,OAAA;AAAE,yGAAA,iBAAiB,OAAA;AAChD,sEAAoG;AAA3F,wHAAA,kBAAkB,OAAA;AAAE,mIAAA,6BAA6B,OAAA;AAC1D,sEAAqE;AAA5D,wHAAA,kBAAkB,OAAA;AAC3B,wFAAuF;AAA9E,0IAAA,2BAA2B,OAAA;AACpC,8EAA0G;AAAjG,gIAAA,sBAAsB,OAAA;AAAE,qIAAA,2BAA2B,OAAA;AAC5D,kDAAyF;AAAhF,uGAAA,WAAW,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAAE,4GAAA,gBAAgB,OAAA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseBerryLock = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Convert a Yarn Berry (v2+) YAML lock file contents into a standardized format.
|
|
6
|
+
*/
|
|
4
7
|
function parseBerryLock(yaml) {
|
|
5
8
|
const results = {};
|
|
6
9
|
if (yaml) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseBerryLock.js","sourceRoot":"","sources":["../../src/lockfile/parseBerryLock.ts"],"names":[],"mappings":";;;AAEA,SAAgB,cAAc,CAAC,IAAmB;IAChD,MAAM,OAAO,GAAsC,EAAE,CAAC;IAEtD,IAAI,IAAI,EAAE;QACR,KAAK,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACxD,IAAI,OAAO,KAAK,YAAY,EAAE;gBAC5B,SAAS;aACV;YAED,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAEjC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;gBACtB,MAAM,aAAa,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;gBACxC,OAAO,CAAC,aAAa,CAAC,GAAG;oBACvB,OAAO,EAAE,UAAU,CAAC,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CAAC,MAAM,CAAC,EAAE;QACxB,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;KAChC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/lib/lockfile/types.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export type ParsedLock = {
|
|
|
11
11
|
[key in string]: LockDependency;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
+
/** pnpm `pnpm-lock.yaml` format */
|
|
14
15
|
export interface PnpmLockFile {
|
|
15
16
|
packages: {
|
|
16
17
|
[name: string]: any;
|
|
@@ -33,6 +34,7 @@ export interface NpmSymlinkInfo {
|
|
|
33
34
|
[key: string]: LockDependency;
|
|
34
35
|
};
|
|
35
36
|
}
|
|
37
|
+
/** npm `package-lock.json` format */
|
|
36
38
|
export interface NpmLockFile {
|
|
37
39
|
name: string;
|
|
38
40
|
version: string;
|
|
@@ -47,6 +49,7 @@ export interface NpmLockFile {
|
|
|
47
49
|
[key: string]: LockDependency;
|
|
48
50
|
};
|
|
49
51
|
}
|
|
52
|
+
/** Yarn Berry (v2+) `yarn.lock` YAML format */
|
|
50
53
|
export interface BerryLockFile {
|
|
51
54
|
__metadata: any;
|
|
52
55
|
[key: string]: {
|
package/lib/paths.d.ts
CHANGED
|
@@ -18,4 +18,7 @@ export declare function findPackageRoot(cwd: string): string | undefined;
|
|
|
18
18
|
* falling back to the git root if no workspace is detected.
|
|
19
19
|
*/
|
|
20
20
|
export declare function findProjectRoot(cwd: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Determines if `child` path is a subdirectory of `parent` path.
|
|
23
|
+
*/
|
|
21
24
|
export declare function isChildOf(child: string, parent: string): boolean;
|
package/lib/paths.js
CHANGED
|
@@ -57,7 +57,7 @@ exports.findPackageRoot = findPackageRoot;
|
|
|
57
57
|
function findProjectRoot(cwd) {
|
|
58
58
|
let workspaceRoot;
|
|
59
59
|
try {
|
|
60
|
-
workspaceRoot = (0, getWorkspaceRoot_1.
|
|
60
|
+
workspaceRoot = (0, getWorkspaceRoot_1.getWorkspaceManagerRoot)(cwd);
|
|
61
61
|
}
|
|
62
62
|
catch (err) {
|
|
63
63
|
(0, logging_1.logVerboseWarning)(`Error getting workspace root for ${cwd}`, err);
|
|
@@ -68,6 +68,9 @@ function findProjectRoot(cwd) {
|
|
|
68
68
|
return workspaceRoot || findGitRoot(cwd);
|
|
69
69
|
}
|
|
70
70
|
exports.findProjectRoot = findProjectRoot;
|
|
71
|
+
/**
|
|
72
|
+
* Determines if `child` path is a subdirectory of `parent` path.
|
|
73
|
+
*/
|
|
71
74
|
function isChildOf(child, parent) {
|
|
72
75
|
const relativePath = path_1.default.relative(child, parent);
|
|
73
76
|
return /^[.\/\\]+$/.test(relativePath);
|
package/lib/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,oEAAwE;AACxE,+BAA4B;AAC5B,uCAA8C;AAE9C;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,QAA2B,EAAE,GAAW;IAC/D,MAAM,KAAK,GAAG,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IACnE,wCAAwC;IACxC,GAAG,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACxB,MAAM,IAAI,GAAG,cAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;IAElC,IAAI,SAA6B,CAAC;IAElC,OAAO,CAAC,SAAS,IAAI,GAAG,KAAK,IAAI,EAAE;QACjC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,C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AqC,GAAG,6BAA6B,CAAC,CAAC;KAC1F;IACD,OAAO,aAAa,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC;AAZD,0CAYC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAC,KAAa,EAAE,MAAc;IACrD,MAAM,YAAY,GAAG,cAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAClD,OAAO,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AACzC,CAAC;AAHD,8BAGC"}
|
package/lib/tsdoc-metadata.json
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mapping from package name to package version.
|
|
3
|
+
* @see https://pnpm.io/catalogs#default-catalog
|
|
4
|
+
* @see https://yarnpkg.com/features/catalogs#basic-usage
|
|
5
|
+
*/
|
|
6
|
+
export interface Catalog {
|
|
7
|
+
[packageName: string]: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Mapping from catalog name (non-default) to catalog definition
|
|
11
|
+
* @see https://pnpm.io/catalogs#named-catalogs
|
|
12
|
+
* @see https://yarnpkg.com/features/catalogs#named-catalogs
|
|
13
|
+
*/
|
|
14
|
+
export interface NamedCatalogs {
|
|
15
|
+
[catalogName: string]: Catalog;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Package version catalogs
|
|
19
|
+
* @see https://pnpm.io/catalogs
|
|
20
|
+
* @see https://yarnpkg.com/features/catalogs
|
|
21
|
+
*/
|
|
22
|
+
export interface Catalogs {
|
|
23
|
+
/**
|
|
24
|
+
* The default catalog if present.
|
|
25
|
+
* (This can't be combined with the named catalogs because "default" could be a catalog name.)
|
|
26
|
+
*/
|
|
27
|
+
default?: Catalog;
|
|
28
|
+
/** Mapping from catalog name to catalog definition, if present */
|
|
29
|
+
named?: NamedCatalogs;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Catalogs.js","sourceRoot":"","sources":["../../src/types/Catalogs.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import type { Catalog, NamedCatalogs } from "./Catalogs";
|
|
2
|
+
/** Contents of `package.json`, plus the `packageJsonPath` */
|
|
1
3
|
export interface PackageInfo {
|
|
2
|
-
|
|
4
|
+
/** Absolute path to this package.json file */
|
|
3
5
|
packageJsonPath: string;
|
|
6
|
+
name: string;
|
|
4
7
|
version: string;
|
|
5
8
|
dependencies?: {
|
|
6
9
|
[dep: string]: string;
|
|
@@ -25,7 +28,22 @@ export interface PackageInfo {
|
|
|
25
28
|
directory?: string;
|
|
26
29
|
};
|
|
27
30
|
[key: string]: any;
|
|
31
|
+
/**
|
|
32
|
+
* Workspace info, only in the root package.json for certain managers.
|
|
33
|
+
* If an array of strings, it's a list of workspace package patterns.
|
|
34
|
+
*/
|
|
35
|
+
workspaces?: string[] | {
|
|
36
|
+
/** List of workspace package patterns */
|
|
37
|
+
packages: string[];
|
|
38
|
+
nohoist?: string[];
|
|
39
|
+
/** `midgard-yarn-strict` catalog definition (yarn4/pnpm use yaml config) */
|
|
40
|
+
catalog?: Catalog;
|
|
41
|
+
/** `midgard-yarn-strict` named catalog definition (yarn4/pnpm use yaml config) */
|
|
42
|
+
catalogs?: NamedCatalogs;
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
28
45
|
}
|
|
46
|
+
/** Mapping from package name to info (`package.json`) for packages within a monorepo. */
|
|
29
47
|
export interface PackageInfos {
|
|
30
48
|
[pkgName: string]: PackageInfo;
|
|
31
49
|
}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { PackageInfo } from "./PackageInfo";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Info about a single package ("workspace" in npm/yarn/pnpm terms) within a monorepo.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* package.json config used by npm/yarn (instead of referring to the entire monorepo).
|
|
5
|
+
* Ideally this should be called just `WorkspaceInfo`, but that name was previously used for the
|
|
6
|
+
* aggregate type.
|
|
8
7
|
*/
|
|
9
|
-
export
|
|
8
|
+
export interface WorkspacePackageInfo {
|
|
9
|
+
/** Package name */
|
|
10
10
|
name: string;
|
|
11
|
+
/** Absolute path to the package root */
|
|
11
12
|
path: string;
|
|
13
|
+
/** `package.json` contents + path */
|
|
12
14
|
packageJson: PackageInfo;
|
|
13
|
-
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Array with names, paths, and package.json contents for each package ("workspace" in
|
|
18
|
+
* npm/yarn/pnpm terms) within a monorepo.
|
|
19
|
+
*/
|
|
20
|
+
export type WorkspaceInfos = WorkspacePackageInfo[];
|
|
21
|
+
/** @deprecated Use `WorkspaceInfos` */
|
|
22
|
+
export type WorkspaceInfo = WorkspaceInfos;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Catalogs } from "../types/Catalogs";
|
|
2
|
+
/**
|
|
3
|
+
* Get version catalogs, if supported by the manager (only pnpm and yarn v4 as of writing).
|
|
4
|
+
* Returns undefined if no catalogs are present or the manager doesn't support them.
|
|
5
|
+
* @see https://pnpm.io/catalogs
|
|
6
|
+
* @see https://yarnpkg.com/features/catalogs
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCatalogs(cwd: string): Catalogs | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Returns true if the version starts with `catalog:`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isCatalogVersion(version: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Given a dependency package name and a version string, if the version starts with `catalog:`,
|
|
15
|
+
* look up the actual version spec from the given catalogs.
|
|
16
|
+
*
|
|
17
|
+
* Throws an error if the version uses `catalog:` but no catalogs are defined, or the version
|
|
18
|
+
* isn't found in the given catalog.
|
|
19
|
+
*
|
|
20
|
+
* Returns undefined if the version doesn't start with `catalog:`.
|
|
21
|
+
* @see https://pnpm.io/catalogs
|
|
22
|
+
* @see https://yarnpkg.com/features/catalogs
|
|
23
|
+
*/
|
|
24
|
+
export declare function getCatalogVersion(params: {
|
|
25
|
+
name: string;
|
|
26
|
+
version: string;
|
|
27
|
+
catalogs: Catalogs | undefined;
|
|
28
|
+
}): string | undefined;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCatalogVersion = exports.isCatalogVersion = exports.getCatalogs = void 0;
|
|
4
|
+
const implementations_1 = require("./implementations");
|
|
5
|
+
/**
|
|
6
|
+
* Get version catalogs, if supported by the manager (only pnpm and yarn v4 as of writing).
|
|
7
|
+
* Returns undefined if no catalogs are present or the manager doesn't support them.
|
|
8
|
+
* @see https://pnpm.io/catalogs
|
|
9
|
+
* @see https://yarnpkg.com/features/catalogs
|
|
10
|
+
*/
|
|
11
|
+
function getCatalogs(cwd) {
|
|
12
|
+
const utils = (0, implementations_1.getWorkspaceUtilities)(cwd);
|
|
13
|
+
return utils?.getCatalogs?.(cwd);
|
|
14
|
+
}
|
|
15
|
+
exports.getCatalogs = getCatalogs;
|
|
16
|
+
const catalogRegex = /^catalog:(.*)$/;
|
|
17
|
+
/**
|
|
18
|
+
* Returns true if the version starts with `catalog:`.
|
|
19
|
+
*/
|
|
20
|
+
function isCatalogVersion(version) {
|
|
21
|
+
return catalogRegex.test(version);
|
|
22
|
+
}
|
|
23
|
+
exports.isCatalogVersion = isCatalogVersion;
|
|
24
|
+
/**
|
|
25
|
+
* Given a dependency package name and a version string, if the version starts with `catalog:`,
|
|
26
|
+
* look up the actual version spec from the given catalogs.
|
|
27
|
+
*
|
|
28
|
+
* Throws an error if the version uses `catalog:` but no catalogs are defined, or the version
|
|
29
|
+
* isn't found in the given catalog.
|
|
30
|
+
*
|
|
31
|
+
* Returns undefined if the version doesn't start with `catalog:`.
|
|
32
|
+
* @see https://pnpm.io/catalogs
|
|
33
|
+
* @see https://yarnpkg.com/features/catalogs
|
|
34
|
+
*/
|
|
35
|
+
function getCatalogVersion(params) {
|
|
36
|
+
const { name, version, catalogs } = params;
|
|
37
|
+
const catalogMatch = version.match(/^catalog:(.*)$/);
|
|
38
|
+
if (!catalogMatch) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
if (!catalogs) {
|
|
42
|
+
throw new Error(`Dependency "${name}" uses a catalog version "${version}" but no catalogs are defined.`);
|
|
43
|
+
}
|
|
44
|
+
const catalogName = catalogMatch[1];
|
|
45
|
+
const checkCatalog = catalogName ? catalogs.named?.[catalogName] : catalogs.default;
|
|
46
|
+
const catalogNameStr = catalogName ? `catalogs.${catalogName}` : "the default catalog";
|
|
47
|
+
if (!checkCatalog) {
|
|
48
|
+
throw new Error(`Dependency "${name}" uses a catalog version "${version}" but ${catalogNameStr} is not defined.`);
|
|
49
|
+
}
|
|
50
|
+
const actualVersion = checkCatalog[name];
|
|
51
|
+
if (!actualVersion) {
|
|
52
|
+
throw new Error(`Dependency "${name}" uses a catalog version "${version}", but ${catalogNameStr} doesn't define a version for "${name}".`);
|
|
53
|
+
}
|
|
54
|
+
return actualVersion;
|
|
55
|
+
}
|
|
56
|
+
exports.getCatalogVersion = getCatalogVersion;
|
|
57
|
+
//# sourceMappingURL=catalogs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalogs.js","sourceRoot":"","sources":["../../src/workspaces/catalogs.ts"],"names":[],"mappings":";;;AACA,uDAA0D;AAE1D;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,MAAM,KAAK,GAAG,IAAA,uCAAqB,EAAC,GAAG,CAAC,CAAC;IACzC,OAAO,KAAK,EAAE,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AAHD,kCAGC;AAED,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAEtC;;GAEG;AACH,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,OAAO,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AAFD,4CAEC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,iBAAiB,CAAC,MAIjC;IACC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAE3C,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACrD,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,6BAA6B,OAAO,gCAAgC,CAAC,CAAC;KAC1G;IAED,MAAM,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;IACpF,MAAM,cAAc,GAAG,WAAW,CAAC,CAAC,CAAC,YAAY,WAAW,EAAE,CAAC,CAAC,CAAC,qBAAqB,CAAC;IAEvF,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,6BAA6B,OAAO,SAAS,cAAc,kBAAkB,CAAC,CAAC;KACnH;IAED,MAAM,aAAa,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,CAAC,aAAa,EAAE;QAClB,MAAM,IAAI,KAAK,CACb,eAAe,IAAI,6BAA6B,OAAO,UAAU,cAAc,kCAAkC,IAAI,IAAI,CAC1H,CAAC;KACH;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AA/BD,8CA+BC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { WorkspaceInfos } from "../types/WorkspaceInfo";
|
|
2
2
|
/**
|
|
3
|
-
* Find the path for a particular package name from an array of info about packages
|
|
4
|
-
*
|
|
5
|
-
* @param workspaces Array of info about packages within a
|
|
3
|
+
* Find the path for a particular package name from an array of info about packages ("workspaces"
|
|
4
|
+
* in npm/yarn/pnpm terms) within a monorepo.
|
|
5
|
+
* @param workspaces Array of info about packages within a monorepo
|
|
6
6
|
* @param packageName Package name to find
|
|
7
7
|
* @returns Package path if found, or undefined
|
|
8
8
|
*/
|
|
9
|
-
export declare function findWorkspacePath(workspaces:
|
|
9
|
+
export declare function findWorkspacePath(workspaces: WorkspaceInfos, packageName: string): string | undefined;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findWorkspacePath = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* Find the path for a particular package name from an array of info about packages
|
|
6
|
-
*
|
|
7
|
-
* @param workspaces Array of info about packages within a
|
|
5
|
+
* Find the path for a particular package name from an array of info about packages ("workspaces"
|
|
6
|
+
* in npm/yarn/pnpm terms) within a monorepo.
|
|
7
|
+
* @param workspaces Array of info about packages within a monorepo
|
|
8
8
|
* @param packageName Package name to find
|
|
9
9
|
* @returns Package path if found, or undefined
|
|
10
10
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findWorkspacePath.js","sourceRoot":"","sources":["../../src/workspaces/findWorkspacePath.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"findWorkspacePath.js","sourceRoot":"","sources":["../../src/workspaces/findWorkspacePath.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAC,UAA0B,EAAE,WAAmB;IAC/E,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,WAAW,CAAC,EAAE,IAAI,CAAC;AACnE,CAAC;AAFD,8CAEC"}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { WorkspaceInfos } from "../types/WorkspaceInfo";
|
|
2
2
|
/**
|
|
3
3
|
* Get an array with names, paths, and package.json contents for each of the given package paths
|
|
4
|
-
* within a
|
|
4
|
+
* ("workspace" paths in npm/yarn/pnpm terms) within a monorepo.
|
|
5
5
|
*
|
|
6
6
|
* This is an internal helper used by `getWorkspaces` implementations for different managers.
|
|
7
|
-
*
|
|
8
|
-
* @param packagePaths Paths to packages within a
|
|
7
|
+
*
|
|
8
|
+
* @param packagePaths Paths to packages within a monorepo
|
|
9
9
|
* @returns Array of workspace package infos
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
|
-
export declare function getWorkspacePackageInfo(packagePaths: string[]):
|
|
12
|
+
export declare function getWorkspacePackageInfo(packagePaths: string[]): WorkspaceInfos;
|
|
13
13
|
/**
|
|
14
14
|
* Get an array with names, paths, and package.json contents for each of the given package paths
|
|
15
|
-
* within a
|
|
15
|
+
* ("workspace" paths in npm/yarn/pnpm terms) within a monorepo.
|
|
16
|
+
*
|
|
17
|
+
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
|
|
18
|
+
* without direct concurrency control.
|
|
16
19
|
*
|
|
17
20
|
* This is an internal helper used by `getWorkspaces` implementations for different managers.
|
|
18
|
-
*
|
|
19
|
-
* @param packagePaths Paths to packages within a
|
|
21
|
+
*
|
|
22
|
+
* @param packagePaths Paths to packages within a monorepo
|
|
20
23
|
* @returns Array of workspace package infos
|
|
21
24
|
* @internal
|
|
22
25
|
*/
|
|
23
|
-
export declare function getWorkspacePackageInfoAsync(packagePaths: string[]): Promise<
|
|
26
|
+
export declare function getWorkspacePackageInfoAsync(packagePaths: string[]): Promise<WorkspaceInfos>;
|