workspace-tools 0.40.0 → 0.40.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 (59) hide show
  1. package/README.md +1 -1
  2. package/lib/getPackageInfos.d.ts +5 -5
  3. package/lib/getPackageInfos.js +5 -5
  4. package/lib/getPackagePaths.d.ts +2 -2
  5. package/lib/getPackagePaths.js +2 -2
  6. package/lib/graph/getPackageDependencies.d.ts +1 -1
  7. package/lib/graph/getPackageDependencies.js +1 -1
  8. package/lib/index.d.ts +3 -1
  9. package/lib/index.js +8 -5
  10. package/lib/index.js.map +1 -1
  11. package/lib/paths.d.ts +7 -2
  12. package/lib/paths.js +11 -6
  13. package/lib/paths.js.map +1 -1
  14. package/lib/types/Catalogs.d.ts +11 -3
  15. package/lib/workspaces/catalogsToYaml.d.ts +8 -0
  16. package/lib/workspaces/catalogsToYaml.js +29 -0
  17. package/lib/workspaces/catalogsToYaml.js.map +1 -0
  18. package/lib/workspaces/getAllPackageJsonFiles.d.ts +2 -2
  19. package/lib/workspaces/getAllPackageJsonFiles.js +2 -2
  20. package/lib/workspaces/{catalogs.d.ts → getCatalogVersion.d.ts} +0 -7
  21. package/lib/workspaces/{catalogs.js → getCatalogVersion.js} +13 -17
  22. package/lib/workspaces/getCatalogVersion.js.map +1 -0
  23. package/lib/workspaces/getCatalogs.d.ts +9 -0
  24. package/lib/workspaces/getCatalogs.js +17 -0
  25. package/lib/workspaces/getCatalogs.js.map +1 -0
  26. package/lib/workspaces/getWorkspacePackageInfo.d.ts +2 -2
  27. package/lib/workspaces/getWorkspacePackageInfo.js +3 -3
  28. package/lib/workspaces/getWorkspacePackageInfo.js.map +1 -1
  29. package/lib/workspaces/getWorkspacePackagePaths.d.ts +2 -2
  30. package/lib/workspaces/getWorkspacePackagePaths.js +2 -2
  31. package/lib/workspaces/getWorkspaceRoot.d.ts +6 -5
  32. package/lib/workspaces/getWorkspaceRoot.js +6 -5
  33. package/lib/workspaces/getWorkspaceRoot.js.map +1 -1
  34. package/lib/workspaces/getWorkspaces.d.ts +4 -4
  35. package/lib/workspaces/getWorkspaces.js +4 -4
  36. package/lib/workspaces/implementations/getWorkspaceManagerAndRoot.d.ts +5 -5
  37. package/lib/workspaces/implementations/getWorkspaceManagerAndRoot.js +4 -4
  38. package/lib/workspaces/implementations/getWorkspaceUtilities.d.ts +6 -1
  39. package/lib/workspaces/implementations/getWorkspaceUtilities.js +2 -1
  40. package/lib/workspaces/implementations/getWorkspaceUtilities.js.map +1 -1
  41. package/lib/workspaces/implementations/lerna.d.ts +6 -1
  42. package/lib/workspaces/implementations/lerna.js +13 -8
  43. package/lib/workspaces/implementations/lerna.js.map +1 -1
  44. package/lib/workspaces/implementations/npm.js +10 -10
  45. package/lib/workspaces/implementations/npm.js.map +1 -1
  46. package/lib/workspaces/implementations/packageJsonWorkspaces.d.ts +6 -2
  47. package/lib/workspaces/implementations/packageJsonWorkspaces.js +9 -5
  48. package/lib/workspaces/implementations/packageJsonWorkspaces.js.map +1 -1
  49. package/lib/workspaces/implementations/pnpm.d.ts +6 -1
  50. package/lib/workspaces/implementations/pnpm.js +17 -9
  51. package/lib/workspaces/implementations/pnpm.js.map +1 -1
  52. package/lib/workspaces/implementations/rush.d.ts +6 -1
  53. package/lib/workspaces/implementations/rush.js +11 -7
  54. package/lib/workspaces/implementations/rush.js.map +1 -1
  55. package/lib/workspaces/implementations/yarn.d.ts +10 -2
  56. package/lib/workspaces/implementations/yarn.js +25 -12
  57. package/lib/workspaces/implementations/yarn.js.map +1 -1
  58. package/package.json +1 -1
  59. package/lib/workspaces/catalogs.js.map +0 -1
package/README.md CHANGED
@@ -20,7 +20,7 @@ Override the `maxBuffer` value for git processes, for example if the repo is ver
20
20
 
21
21
  ### PREFERRED_WORKSPACE_MANAGER
22
22
 
23
- Sometimes if multiple workspace manager files are checked in, it's necessary to hint which manager is used: `npm`, `yarn`, `pnpm`, `rush`, or `lerna`.
23
+ Sometimes if multiple workspace/monorepo manager files are checked in, it's necessary to hint which manager is used: `npm`, `yarn`, `pnpm`, `rush`, or `lerna`.
24
24
 
25
25
  ### VERBOSE
26
26
 
@@ -1,17 +1,17 @@
1
1
  import { PackageInfos } from "./types/PackageInfo";
2
2
  /**
3
- * Read all the package.json files in a monorepo. Only works for monorepos which
4
- * use a supported workspace manager.
5
- * @param cwd Start looking for the workspace manager config from here
3
+ * Read all the package.json files in a monorepo.
4
+ * Only works for monorepos which use a supported workspace/monorepo manager.
5
+ * @param cwd Start looking for the manager config from here
6
6
  */
7
7
  export declare function getPackageInfos(cwd: string): PackageInfos;
8
8
  /**
9
9
  * Read all the package.json files in a monorepo. Only works for monorepos which
10
- * use a supported workspace manager.
10
+ * use a supported workspace/monorepo manager.
11
11
  *
12
12
  * NOTE: As of writing, this will start promises to read all package.json files in parallel,
13
13
  * without direct concurrency control.
14
14
  *
15
- * @param cwd Start looking for the workspace manager config from here
15
+ * @param cwd Start looking for the manager config from here
16
16
  */
17
17
  export declare function getPackageInfosAsync(cwd: string): Promise<PackageInfos>;
@@ -4,9 +4,9 @@ exports.getPackageInfosAsync = exports.getPackageInfos = void 0;
4
4
  const getWorkspaces_1 = require("./workspaces/getWorkspaces");
5
5
  const getPackageInfo_1 = require("./getPackageInfo");
6
6
  /**
7
- * Read all the package.json files in a monorepo. Only works for monorepos which
8
- * use a supported workspace manager.
9
- * @param cwd Start looking for the workspace manager config from here
7
+ * Read all the package.json files in a monorepo.
8
+ * Only works for monorepos which use a supported workspace/monorepo manager.
9
+ * @param cwd Start looking for the manager config from here
10
10
  */
11
11
  function getPackageInfos(cwd) {
12
12
  const packageInfos = {};
@@ -27,12 +27,12 @@ function getPackageInfos(cwd) {
27
27
  exports.getPackageInfos = getPackageInfos;
28
28
  /**
29
29
  * Read all the package.json files in a monorepo. Only works for monorepos which
30
- * use a supported workspace manager.
30
+ * use a supported workspace/monorepo manager.
31
31
  *
32
32
  * NOTE: As of writing, this will start promises to read all package.json files in parallel,
33
33
  * without direct concurrency control.
34
34
  *
35
- * @param cwd Start looking for the workspace manager config from here
35
+ * @param cwd Start looking for the manager config from here
36
36
  */
37
37
  async function getPackageInfosAsync(cwd) {
38
38
  const packageInfos = {};
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Given package folder globs (such as those from package.json `workspaces`) and a workspace root
2
+ * Given package folder globs (such as those from package.json `workspaces`) and a monorepo root
3
3
  * directory, get absolute paths to actual package folders.
4
4
  */
5
5
  export declare function getPackagePaths(root: string, packageGlobs: string[]): string[];
6
6
  /**
7
- * Given package folder globs (such as those from package.json `workspaces`) and a workspace root
7
+ * Given package folder globs (such as those from package.json `workspaces`) and a monorepo root
8
8
  * directory, get absolute paths to actual package folders.
9
9
  */
10
10
  export declare function getPackagePathsAsync(root: string, packageGlobs: string[]): Promise<string[]>;
@@ -14,7 +14,7 @@ const globOptions = {
14
14
  stats: false,
15
15
  };
16
16
  /**
17
- * Given package folder globs (such as those from package.json `workspaces`) and a workspace root
17
+ * Given package folder globs (such as those from package.json `workspaces`) and a monorepo root
18
18
  * directory, get absolute paths to actual package folders.
19
19
  */
20
20
  function getPackagePaths(root, packageGlobs) {
@@ -28,7 +28,7 @@ function getPackagePaths(root, packageGlobs) {
28
28
  }
29
29
  exports.getPackagePaths = getPackagePaths;
30
30
  /**
31
- * Given package folder globs (such as those from package.json `workspaces`) and a workspace root
31
+ * Given package folder globs (such as those from package.json `workspaces`) and a monorepo root
32
32
  * directory, get absolute paths to actual package folders.
33
33
  */
34
34
  async function getPackagePathsAsync(root, packageGlobs) {
@@ -5,7 +5,7 @@ export interface PackageDependenciesOptions {
5
5
  withOptionalDependencies?: boolean;
6
6
  }
7
7
  /**
8
- * Gets the workspace package dependencies for a given package (excluding `file:` or `npm:` versions).
8
+ * Gets the monorepo package dependencies for a given package (excluding `file:` or `npm:` versions).
9
9
  * It only considers `dependencies` unless options specify otherwise.
10
10
  *
11
11
  * @param info - The package information containing dependencies
@@ -17,7 +17,7 @@ function isValidDependency(info, dep) {
17
17
  return !range.startsWith("npm:") && !range.startsWith("file:");
18
18
  }
19
19
  /**
20
- * Gets the workspace package dependencies for a given package (excluding `file:` or `npm:` versions).
20
+ * Gets the monorepo package dependencies for a given package (excluding `file:` or `npm:` versions).
21
21
  * It only considers `dependencies` unless options specify otherwise.
22
22
  *
23
23
  * @param info - The package information containing dependencies
package/lib/index.d.ts CHANGED
@@ -22,4 +22,6 @@ export { getChangedPackages, getChangedPackagesBetweenRefs } from "./workspaces/
22
22
  export { getPackagesByFiles } from "./workspaces/getPackagesByFiles";
23
23
  export { listOfWorkspacePackageNames } from "./workspaces/listOfWorkspacePackageNames";
24
24
  export { getAllPackageJsonFiles, getAllPackageJsonFilesAsync } from "./workspaces/getAllPackageJsonFiles";
25
- export { getCatalogs, getCatalogVersion, isCatalogVersion } from "./workspaces/catalogs";
25
+ export { catalogsToYaml } from "./workspaces/catalogsToYaml";
26
+ export { getCatalogVersion, isCatalogVersion } from "./workspaces/getCatalogVersion";
27
+ export { getCatalogs } from "./workspaces/getCatalogs";
package/lib/index.js CHANGED
@@ -14,7 +14,7 @@ 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.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.getPackageInfoAsync = exports.getPackageInfo = 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;
17
+ exports.getCatalogs = exports.isCatalogVersion = exports.getCatalogVersion = exports.catalogsToYaml = 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.getPackageInfoAsync = exports.getPackageInfo = 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
20
  Object.defineProperty(exports, "getPackageInfos", { enumerable: true, get: function () { return getPackageInfos_1.getPackageInfos; } });
@@ -65,8 +65,11 @@ Object.defineProperty(exports, "listOfWorkspacePackageNames", { enumerable: true
65
65
  var getAllPackageJsonFiles_1 = require("./workspaces/getAllPackageJsonFiles");
66
66
  Object.defineProperty(exports, "getAllPackageJsonFiles", { enumerable: true, get: function () { return getAllPackageJsonFiles_1.getAllPackageJsonFiles; } });
67
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; } });
68
+ var catalogsToYaml_1 = require("./workspaces/catalogsToYaml");
69
+ Object.defineProperty(exports, "catalogsToYaml", { enumerable: true, get: function () { return catalogsToYaml_1.catalogsToYaml; } });
70
+ var getCatalogVersion_1 = require("./workspaces/getCatalogVersion");
71
+ Object.defineProperty(exports, "getCatalogVersion", { enumerable: true, get: function () { return getCatalogVersion_1.getCatalogVersion; } });
72
+ Object.defineProperty(exports, "isCatalogVersion", { enumerable: true, get: function () { return getCatalogVersion_1.isCatalogVersion; } });
73
+ var getCatalogs_1 = require("./workspaces/getCatalogs");
74
+ Object.defineProperty(exports, "getCatalogs", { enumerable: true, get: function () { return getCatalogs_1.getCatalogs; } });
72
75
  //# 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,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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E,mHAAA,kBAAkB,OAAA;AAC1C,kFAAgH;AAAvG,oIAAA,wBAAwB,OAAA;AAAE,yIAAA,6BAA6B,OAAA;AAChE,kEAA0F;AAAjF,2HAAA,uBAAuB,OAAA;AAAE,oHAAA,gBAAgB,OAAA;AAClD,mDAAuE;AAA9D,gHAAA,cAAc,OAAA;AAAE,qHAAA,mBAAmB,OAAA;AAC5C,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,8DAA6D;AAApD,gHAAA,cAAc,OAAA;AACvB,oEAAqF;AAA5E,sHAAA,iBAAiB,OAAA;AAAE,qHAAA,gBAAgB,OAAA;AAC5C,wDAAuD;AAA9C,0GAAA,WAAW,OAAA"}
package/lib/paths.d.ts CHANGED
@@ -14,8 +14,13 @@ export declare function findGitRoot(cwd: string): string;
14
14
  */
15
15
  export declare function findPackageRoot(cwd: string): string | undefined;
16
16
  /**
17
- * Starting from `cwd`, searches up the directory hierarchy for the workspace root,
18
- * falling back to the git root if no workspace is detected.
17
+ * Starting from `cwd`, searches up the directory hierarchy for the project root (workspace/monorepo
18
+ * manager root), falling back to the git root if no manager root is detected. Results are cached by
19
+ * `cwd`, and an error is thrown if no project root is found and it's not a git repo.
20
+ *
21
+ * To skip the git root fallback, use `getWorkspaceManagerRoot`. Usually the monorepo manager root
22
+ * is the same as the git root, but this may not be the case with multiple "monorepos" in a single
23
+ * git repo, or in project structures with multiple languages where the JS is not at the root.
19
24
  */
20
25
  export declare function findProjectRoot(cwd: string): string;
21
26
  /**
package/lib/paths.js CHANGED
@@ -51,19 +51,24 @@ function findPackageRoot(cwd) {
51
51
  }
52
52
  exports.findPackageRoot = findPackageRoot;
53
53
  /**
54
- * Starting from `cwd`, searches up the directory hierarchy for the workspace root,
55
- * falling back to the git root if no workspace is detected.
54
+ * Starting from `cwd`, searches up the directory hierarchy for the project root (workspace/monorepo
55
+ * manager root), falling back to the git root if no manager root is detected. Results are cached by
56
+ * `cwd`, and an error is thrown if no project root is found and it's not a git repo.
57
+ *
58
+ * To skip the git root fallback, use `getWorkspaceManagerRoot`. Usually the monorepo manager root
59
+ * is the same as the git root, but this may not be the case with multiple "monorepos" in a single
60
+ * git repo, or in project structures with multiple languages where the JS is not at the root.
56
61
  */
57
62
  function findProjectRoot(cwd) {
58
63
  let workspaceRoot;
59
64
  try {
60
65
  workspaceRoot = (0, getWorkspaceRoot_1.getWorkspaceManagerRoot)(cwd);
66
+ if (!workspaceRoot) {
67
+ (0, logging_1.logVerboseWarning)(`Could not find workspace manager root for ${cwd}. Falling back to git root.`);
68
+ }
61
69
  }
62
70
  catch (err) {
63
- (0, logging_1.logVerboseWarning)(`Error getting workspace root for ${cwd}`, err);
64
- }
65
- if (!workspaceRoot) {
66
- (0, logging_1.logVerboseWarning)(`Could not find workspace root for ${cwd}. Falling back to git root.`);
71
+ (0, logging_1.logVerboseWarning)(`Error getting workspace manager root for ${cwd} (will fall back to git root)`, err);
67
72
  }
68
73
  return workspaceRoot || findGitRoot(cwd);
69
74
  }
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,oEAAwE;AACxE,+BAA4B;AAC5B,uCAA8C;AAE9C;;;;GAIG;AACH,SAAgB,QAAQ,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AAA,2BAAiB,EAAC,6CAA6C,GAAG,6BAA6B,CAAC,CAAC;SAClG;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,2BAAiB,EAAC,4CAA4C,GAAG,+BAA+B,EAAE,GAAG,CAAC,CAAC;KACxG;IAED,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"}
@@ -21,10 +21,18 @@ export interface NamedCatalogs {
21
21
  */
22
22
  export interface Catalogs {
23
23
  /**
24
- * The default catalog if present.
25
- * (This can't be combined with the named catalogs because "default" could be a catalog name.)
24
+ * The default catalog (`catalog:`) if present.
25
+ *
26
+ * Whether this is equivalent to `catalogs.default` depends on the package manager:
27
+ * they're the same in pnpm, but different in yarn. If there was a pnpm catalog named "default",
28
+ * it will be stored under this property instead (but `getCatalogVersion` supports either syntax).
26
29
  */
27
30
  default?: Catalog;
28
- /** Mapping from catalog name to catalog definition, if present */
31
+ /**
32
+ * Mapping from catalog name to catalog definition, if present.
33
+ *
34
+ * (For pnpm, if there was a catalog named "default", it will be under `Catalogs.default`
35
+ * and omitted here.)
36
+ */
29
37
  named?: NamedCatalogs;
30
38
  }
@@ -0,0 +1,8 @@
1
+ import type { Catalogs } from "../types/Catalogs";
2
+ /**
3
+ * Convert catalogs to the yaml format used by yarn v4 and pnpm.
4
+ */
5
+ export declare function catalogsToYaml(catalogs: Catalogs, options?: {
6
+ /** Number of spaces (default 2), or another indentation character */
7
+ indent?: number | string;
8
+ }): string;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.catalogsToYaml = void 0;
4
+ /**
5
+ * Convert catalogs to the yaml format used by yarn v4 and pnpm.
6
+ */
7
+ function catalogsToYaml(catalogs, options = {}) {
8
+ const { named, default: defaultCatalog } = catalogs;
9
+ const lines = [];
10
+ const indent = typeof options.indent === "string" ? options.indent : " ".repeat(options.indent ?? 2);
11
+ if (defaultCatalog) {
12
+ lines.push("catalog:");
13
+ for (const [pkg, version] of Object.entries(defaultCatalog)) {
14
+ lines.push(`${indent}${pkg}: ${version}`);
15
+ }
16
+ }
17
+ if (named) {
18
+ lines.push("catalogs:");
19
+ for (const [catalogName, catalogEntries] of Object.entries(named)) {
20
+ lines.push(`${indent}${catalogName}:`);
21
+ for (const [pkg, version] of Object.entries(catalogEntries)) {
22
+ lines.push(`${indent}${indent}${pkg}: ${version}`);
23
+ }
24
+ }
25
+ }
26
+ return lines.join("\n");
27
+ }
28
+ exports.catalogsToYaml = catalogsToYaml;
29
+ //# sourceMappingURL=catalogsToYaml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogsToYaml.js","sourceRoot":"","sources":["../../src/workspaces/catalogsToYaml.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,SAAgB,cAAc,CAC5B,QAAkB,EAClB,UAGI,EAAE;IAEN,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,QAAQ,CAAC;IACpD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;IAErG,IAAI,cAAc,EAAE;QAClB,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACvB,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE;YAC3D,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,GAAG,KAAK,OAAO,EAAE,CAAC,CAAC;SAC3C;KACF;IAED,IAAI,KAAK,EAAE;QACT,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACxB,KAAK,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACjE,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,WAAW,GAAG,CAAC,CAAC;YACvC,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE;gBAC3D,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,MAAM,GAAG,GAAG,KAAK,OAAO,EAAE,CAAC,CAAC;aACpD;SACF;KACF;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AA7BD,wCA6BC"}
@@ -1,9 +1,9 @@
1
1
  /**
2
- * Get paths to every package.json in the workspace, given a cwd.
2
+ * Get paths to every package.json in the monorepo, given a cwd.
3
3
  */
4
4
  export declare function getAllPackageJsonFiles(cwd: string): string[];
5
5
  export declare function _resetPackageJsonFilesCache(): void;
6
6
  /**
7
- * Get paths to every package.json in the workspace, given a cwd.
7
+ * Get paths to every package.json in the monorepo, given a cwd.
8
8
  */
9
9
  export declare function getAllPackageJsonFilesAsync(cwd: string): Promise<string[]>;
@@ -9,7 +9,7 @@ const getWorkspacePackagePaths_1 = require("./getWorkspacePackagePaths");
9
9
  const isCachingEnabled_1 = require("../isCachingEnabled");
10
10
  const cache = new Map();
11
11
  /**
12
- * Get paths to every package.json in the workspace, given a cwd.
12
+ * Get paths to every package.json in the monorepo, given a cwd.
13
13
  */
14
14
  function getAllPackageJsonFiles(cwd) {
15
15
  if ((0, isCachingEnabled_1.isCachingEnabled)() && cache.has(cwd)) {
@@ -25,7 +25,7 @@ function _resetPackageJsonFilesCache() {
25
25
  }
26
26
  exports._resetPackageJsonFilesCache = _resetPackageJsonFilesCache;
27
27
  /**
28
- * Get paths to every package.json in the workspace, given a cwd.
28
+ * Get paths to every package.json in the monorepo, given a cwd.
29
29
  */
30
30
  async function getAllPackageJsonFilesAsync(cwd) {
31
31
  if ((0, isCachingEnabled_1.isCachingEnabled)() && cache.has(cwd)) {
@@ -1,11 +1,4 @@
1
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
2
  /**
10
3
  * Returns true if the version starts with `catalog:`.
11
4
  */
@@ -1,18 +1,6 @@
1
1
  "use strict";
2
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;
3
+ exports.getCatalogVersion = exports.isCatalogVersion = void 0;
16
4
  const catalogPrefix = "catalog:";
17
5
  /**
18
6
  * Returns true if the version starts with `catalog:`.
@@ -46,9 +34,17 @@ function getCatalogVersion(params) {
46
34
  throw new Error(`Dependency "${name}" uses a catalog version "${version}" but no catalogs are defined.`);
47
35
  }
48
36
  const catalogName = version.slice(catalogPrefix.length);
49
- // If there's no name specified after "catalog:", use the default catalog.
50
- // Otherwise use the named catalog.
51
- const checkCatalog = catalogName ? catalogs.named?.[catalogName] : catalogs.default;
37
+ const checkCatalog =
38
+ // Explicit catalog:default refers to the default catalog in pnpm, or a catalog named "default"
39
+ // in yarn... Check for the yarn case first or fall back to .default. (getCatalogs should have
40
+ // removed the named "default" catalog from namedCatalogs in managers where they're the same,
41
+ // and yarn install would have errored if a named catalog "default" was referenced but not defined.)
42
+ catalogName === "default"
43
+ ? catalogs.named?.default || catalogs.default
44
+ : // Otherwise use either the given named catalog, or the default if no name was specified
45
+ catalogName
46
+ ? catalogs.named?.[catalogName]
47
+ : catalogs.default;
52
48
  const catalogNameStr = catalogName ? `catalogs.${catalogName}` : "the default catalog";
53
49
  if (!checkCatalog) {
54
50
  throw new Error(`Dependency "${name}" uses a catalog version "${version}" but ${catalogNameStr} is not defined.`);
@@ -63,4 +59,4 @@ function getCatalogVersion(params) {
63
59
  return actualSpec;
64
60
  }
65
61
  exports.getCatalogVersion = getCatalogVersion;
66
- //# sourceMappingURL=catalogs.js.map
62
+ //# sourceMappingURL=getCatalogVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCatalogVersion.js","sourceRoot":"","sources":["../../src/workspaces/getCatalogVersion.ts"],"names":[],"mappings":";;;AAEA,MAAM,aAAa,GAAG,UAAU,CAAC;AAEjC;;GAEG;AACH,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,OAAO,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAC3C,CAAC;AAFD,4CAEC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,iBAAiB,CAAC,MAIjC;IACC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAE3C,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE;QAC9B,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,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACxD,MAAM,YAAY;IAChB,+FAA+F;IAC/F,8FAA8F;IAC9F,6FAA6F;IAC7F,oGAAoG;IACpG,WAAW,KAAK,SAAS;QACvB,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,IAAI,QAAQ,CAAC,OAAO;QAC7C,CAAC,CAAC,wFAAwF;YACxF,WAAW;gBACX,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,WAAW,CAAC;gBAC/B,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,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,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CACb,eAAe,IAAI,6BAA6B,OAAO,UAAU,cAAc,kCAAkC,IAAI,IAAI,CAC1H,CAAC;KACH;IAED,IAAI,gBAAgB,CAAC,UAAU,CAAC,EAAE;QAChC,MAAM,IAAI,KAAK,CACb,eAAe,IAAI,8CAA8C,UAAU,4BAA4B,CACxG,CAAC;KACH;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AA/CD,8CA+CC"}
@@ -0,0 +1,9 @@
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
+ * @param cwd - Current working directory. It will search up from here to find the root, with caching.
8
+ */
9
+ export declare function getCatalogs(cwd: string): Catalogs | undefined;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ 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
+ * @param cwd - Current working directory. It will search up from here to find the root, with caching.
11
+ */
12
+ function getCatalogs(cwd) {
13
+ const utils = (0, implementations_1.getWorkspaceUtilities)(cwd);
14
+ return utils?.getCatalogs?.(cwd);
15
+ }
16
+ exports.getCatalogs = getCatalogs;
17
+ //# sourceMappingURL=getCatalogs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCatalogs.js","sourceRoot":"","sources":["../../src/workspaces/getCatalogs.ts"],"names":[],"mappings":";;;AACA,uDAA0D;AAE1D;;;;;;GAMG;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"}
@@ -6,7 +6,7 @@ import type { WorkspaceInfos } from "../types/WorkspaceInfo";
6
6
  * This is an internal helper used by `getWorkspaces` implementations for different managers.
7
7
  *
8
8
  * @param packagePaths Paths to packages within a monorepo
9
- * @returns Array of workspace package infos
9
+ * @returns Array of monorepo package infos
10
10
  * @internal
11
11
  */
12
12
  export declare function getWorkspacePackageInfo(packagePaths: string[]): WorkspaceInfos;
@@ -20,7 +20,7 @@ export declare function getWorkspacePackageInfo(packagePaths: string[]): Workspa
20
20
  * This is an internal helper used by `getWorkspaces` implementations for different managers.
21
21
  *
22
22
  * @param packagePaths Paths to packages within a monorepo
23
- * @returns Array of workspace package infos
23
+ * @returns Array of monorepo package infos
24
24
  * @internal
25
25
  */
26
26
  export declare function getWorkspacePackageInfoAsync(packagePaths: string[]): Promise<WorkspaceInfos>;
@@ -16,7 +16,7 @@ const getPackageInfo_1 = require("../getPackageInfo");
16
16
  * This is an internal helper used by `getWorkspaces` implementations for different managers.
17
17
  *
18
18
  * @param packagePaths Paths to packages within a monorepo
19
- * @returns Array of workspace package infos
19
+ * @returns Array of monorepo package infos
20
20
  * @internal
21
21
  */
22
22
  function getWorkspacePackageInfo(packagePaths) {
@@ -48,7 +48,7 @@ exports.getWorkspacePackageInfo = getWorkspacePackageInfo;
48
48
  * This is an internal helper used by `getWorkspaces` implementations for different managers.
49
49
  *
50
50
  * @param packagePaths Paths to packages within a monorepo
51
- * @returns Array of workspace package infos
51
+ * @returns Array of monorepo package infos
52
52
  * @internal
53
53
  */
54
54
  async function getWorkspacePackageInfoAsync(packagePaths) {
@@ -66,7 +66,7 @@ async function getWorkspacePackageInfoAsync(packagePaths) {
66
66
  };
67
67
  }
68
68
  catch (err) {
69
- (0, logging_1.logVerboseWarning)(`Error reading or parsing ${packageJsonPath} while getting workspace package info`, err);
69
+ (0, logging_1.logVerboseWarning)(`Error reading or parsing ${packageJsonPath} while getting monorepo package info`, err);
70
70
  return null;
71
71
  }
72
72
  });
@@ -1 +1 @@
1
- {"version":3,"file":"getWorkspacePackageInfo.js","sourceRoot":"","sources":["../../src/workspaces/getWorkspacePackageInfo.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,2DAAqC;AAGrC,wCAA+C;AAC/C,gEAA6D;AAC7D,sDAAmD;AAEnD;;;;;;;;;GASG;AACH,SAAgB,uBAAuB,CAAC,YAAsB;IAC5D,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,EAAE,CAAC;KACX;IAED,OAAO,YAAY;SAChB,GAAG,CAA8B,CAAC,aAAa,EAAE,EAAE;QAClD,MAAM,WAAW,GAAG,IAAA,+BAAc,EAAC,aAAa,CAAC,CAA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IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAmB,CAAC;AACrF,CAAC;AAtBD,oEAsBC"}
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Get a list of package folder paths in the workspace. The list of included packages is based on
2
+ * Get a list of package folder paths in the monorepo. The list of included packages is based on
3
3
  * the manager's config file and matching package folders (which must contain package.json) on disk.
4
4
  */
5
5
  export declare function getWorkspacePackagePaths(cwd: string): string[];
6
6
  /**
7
- * Get a list of package folder paths in the workspace. The list of included packages is based on
7
+ * Get a list of package folder paths in the monorepo. The list of included packages is based on
8
8
  * the manager's config file and matching package folders (which must contain package.json) on disk.
9
9
  */
10
10
  export declare function getWorkspacePackagePathsAsync(cwd: string): Promise<string[]>;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getWorkspacePackagePathsAsync = exports.getWorkspacePackagePaths = void 0;
4
4
  const implementations_1 = require("./implementations");
5
5
  /**
6
- * Get a list of package folder paths in the workspace. The list of included packages is based on
6
+ * Get a list of package folder paths in the monorepo. The list of included packages is based on
7
7
  * the manager's config file and matching package folders (which must contain package.json) on disk.
8
8
  */
9
9
  function getWorkspacePackagePaths(cwd) {
@@ -12,7 +12,7 @@ function getWorkspacePackagePaths(cwd) {
12
12
  }
13
13
  exports.getWorkspacePackagePaths = getWorkspacePackagePaths;
14
14
  /**
15
- * Get a list of package folder paths in the workspace. The list of included packages is based on
15
+ * Get a list of package folder paths in the monorepo. The list of included packages is based on
16
16
  * the manager's config file and matching package folders (which must contain package.json) on disk.
17
17
  */
18
18
  async function getWorkspacePackagePathsAsync(cwd) {
@@ -1,9 +1,9 @@
1
1
  import { WorkspaceManager } from "./WorkspaceManager";
2
2
  /**
3
- * Get the root directory of a monorepo, defined as the directory where the workspace manager
4
- * config file is located.
3
+ * Get the root directory of a monorepo, defined as the directory where the workspace/monorepo manager
4
+ * config file is located. (Does not rely in any way on git, and the result is cached by `cwd`.)
5
5
  *
6
- * NOTE: "Workspace" here refers to the entire project, not an individual package the way it does
6
+ * NOTE: "Workspace" here refers to the entire project/monorepo, not an individual package the way it does
7
7
  * in e.g. npm/yarn/pnpm "workspaces."
8
8
  *
9
9
  * @param cwd Start searching from here
@@ -15,10 +15,11 @@ import { WorkspaceManager } from "./WorkspaceManager";
15
15
  */
16
16
  export declare function getWorkspaceRoot(cwd: string, preferredManager?: WorkspaceManager): string | undefined;
17
17
  /**
18
- * Get the root directory of a monorepo, defined as the directory where the workspace manager
19
- * config file is located.
18
+ * Get the root directory of a monorepo, defined as the directory where the workspace/monorepo manager
19
+ * config file is located. (Does not rely in any way on git, and the result is cached by `cwd`.)
20
20
  *
21
21
  * @param cwd Start searching from here
22
22
  * @param preferredManager Search for only this manager's config file
23
+ * @returns Workspace manager root directory, or undefined if not found
23
24
  */
24
25
  export declare function getWorkspaceManagerRoot(cwd: string, preferredManager?: WorkspaceManager): string | undefined;
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getWorkspaceManagerRoot = exports.getWorkspaceRoot = void 0;
4
4
  const implementations_1 = require("./implementations");
5
5
  /**
6
- * Get the root directory of a monorepo, defined as the directory where the workspace manager
7
- * config file is located.
6
+ * Get the root directory of a monorepo, defined as the directory where the workspace/monorepo manager
7
+ * config file is located. (Does not rely in any way on git, and the result is cached by `cwd`.)
8
8
  *
9
- * NOTE: "Workspace" here refers to the entire project, not an individual package the way it does
9
+ * NOTE: "Workspace" here refers to the entire project/monorepo, not an individual package the way it does
10
10
  * in e.g. npm/yarn/pnpm "workspaces."
11
11
  *
12
12
  * @param cwd Start searching from here
@@ -21,11 +21,12 @@ function getWorkspaceRoot(cwd, preferredManager) {
21
21
  }
22
22
  exports.getWorkspaceRoot = getWorkspaceRoot;
23
23
  /**
24
- * Get the root directory of a monorepo, defined as the directory where the workspace manager
25
- * config file is located.
24
+ * Get the root directory of a monorepo, defined as the directory where the workspace/monorepo manager
25
+ * config file is located. (Does not rely in any way on git, and the result is cached by `cwd`.)
26
26
  *
27
27
  * @param cwd Start searching from here
28
28
  * @param preferredManager Search for only this manager's config file
29
+ * @returns Workspace manager root directory, or undefined if not found
29
30
  */
30
31
  function getWorkspaceManagerRoot(cwd, preferredManager) {
31
32
  return (0, implementations_1.getWorkspaceManagerAndRoot)(cwd, undefined, preferredManager)?.root;
@@ -1 +1 @@
1
- {"version":3,"file":"getWorkspaceRoot.js","sourceRoot":"","sources":["../../src/workspaces/getWorkspaceRoot.ts"],"names":[],"mappings":";;;AACA,uDAA+D;AAE/D;;;;;;;;;;;;;GAaG;AACH,SAAgB,gBAAgB,CAAC,GAAW,EAAE,gBAAmC;IAC/E,OAAO,uBAAuB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AACxD,CAAC;AAFD,4CAEC;AAED;;;;;;GAMG;AACH,SAAgB,uBAAuB,CAAC,GAAW,EAAE,gBAAmC;IACtF,OAAO,IAAA,4CAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,gBAAgB,CAAC,EAAE,IAAI,CAAC;AAC5E,CAAC;AAFD,0DAEC"}
1
+ {"version":3,"file":"getWorkspaceRoot.js","sourceRoot":"","sources":["../../src/workspaces/getWorkspaceRoot.ts"],"names":[],"mappings":";;;AACA,uDAA+D;AAE/D;;;;;;;;;;;;;GAaG;AACH,SAAgB,gBAAgB,CAAC,GAAW,EAAE,gBAAmC;IAC/E,OAAO,uBAAuB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AACxD,CAAC;AAFD,4CAEC;AAED;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CAAC,GAAW,EAAE,gBAAmC;IACtF,OAAO,IAAA,4CAA0B,EAAC,GAAG,EAAE,SAAS,EAAE,gBAAgB,CAAC,EAAE,IAAI,CAAC;AAC5E,CAAC;AAFD,0DAEC"}
@@ -1,14 +1,14 @@
1
1
  import type { WorkspaceInfos } from "../types/WorkspaceInfo";
2
2
  /**
3
3
  * Get an array with names, paths, and package.json contents for each package ("workspace" in
4
- * npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the workspace
5
- * manager's config file.
4
+ * npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the
5
+ * workspace/monorepo manager's config file.
6
6
  */
7
7
  export declare function getWorkspaces(cwd: string): WorkspaceInfos;
8
8
  /**
9
9
  * Get an array with names, paths, and package.json contents for each package ("workspace" in
10
- * npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the workspace
11
- * manager's config file.
10
+ * npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the
11
+ * workspace/monorepo manager's config file.
12
12
  *
13
13
  * NOTE: As of writing, this will start promises to read all package.json files in parallel,
14
14
  * without direct concurrency control.
@@ -4,8 +4,8 @@ exports.getWorkspacesAsync = exports.getWorkspaces = void 0;
4
4
  const implementations_1 = require("./implementations");
5
5
  /**
6
6
  * Get an array with names, paths, and package.json contents for each package ("workspace" in
7
- * npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the workspace
8
- * manager's config file.
7
+ * npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the
8
+ * workspace/monorepo manager's config file.
9
9
  */
10
10
  function getWorkspaces(cwd) {
11
11
  const utils = (0, implementations_1.getWorkspaceUtilities)(cwd);
@@ -14,8 +14,8 @@ function getWorkspaces(cwd) {
14
14
  exports.getWorkspaces = getWorkspaces;
15
15
  /**
16
16
  * Get an array with names, paths, and package.json contents for each package ("workspace" in
17
- * npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the workspace
18
- * manager's config file.
17
+ * npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the
18
+ * workspace/monorepo manager's config file.
19
19
  *
20
20
  * NOTE: As of writing, this will start promises to read all package.json files in parallel,
21
21
  * without direct concurrency control.