workspace-tools 0.41.0 → 0.41.1
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/README.md +1 -1
- package/lib/dependencies/index.d.ts +2 -2
- package/lib/dependencies/index.js +31 -12
- package/lib/dependencies/index.js.map +1 -1
- package/lib/dependencies/transitiveDeps.d.ts +1 -1
- package/lib/dependencies/transitiveDeps.js +59 -38
- package/lib/dependencies/transitiveDeps.js.map +1 -1
- package/lib/getPackageInfo.d.ts +1 -1
- package/lib/getPackageInfo.js +46 -40
- package/lib/getPackageInfo.js.map +1 -1
- package/lib/getPackageInfos.d.ts +4 -2
- package/lib/getPackageInfos.js +35 -53
- package/lib/getPackageInfos.js.map +1 -1
- package/lib/git/config.d.ts +1 -1
- package/lib/git/config.js +15 -12
- package/lib/git/config.js.map +1 -1
- package/lib/git/getDefaultRemote.js +45 -30
- package/lib/git/getDefaultRemote.js.map +1 -1
- package/lib/git/getDefaultRemoteBranch.d.ts +1 -1
- package/lib/git/getDefaultRemoteBranch.js +35 -24
- package/lib/git/getDefaultRemoteBranch.js.map +1 -1
- package/lib/git/getRepositoryName.d.ts +1 -1
- package/lib/git/getRepositoryName.js +17 -19
- package/lib/git/getRepositoryName.js.map +1 -1
- package/lib/git/git.d.ts +2 -5
- package/lib/git/git.js +62 -64
- package/lib/git/git.js.map +1 -1
- package/lib/git/gitUtilities.d.ts +3 -3
- package/lib/git/gitUtilities.js +377 -147
- package/lib/git/gitUtilities.js.map +1 -1
- package/lib/git/index.d.ts +5 -5
- package/lib/git/index.js +50 -28
- package/lib/git/index.js.map +1 -1
- package/lib/git/types.js +4 -3
- package/lib/git/types.js.map +1 -1
- package/lib/graph/createDependencyMap.d.ts +2 -2
- package/lib/graph/createDependencyMap.js +18 -18
- package/lib/graph/createDependencyMap.js.map +1 -1
- package/lib/graph/createPackageGraph.d.ts +3 -3
- package/lib/graph/createPackageGraph.js +58 -45
- package/lib/graph/createPackageGraph.js.map +1 -1
- package/lib/graph/getPackageDependencies.d.ts +1 -1
- package/lib/graph/getPackageDependencies.js +17 -17
- package/lib/graph/getPackageDependencies.js.map +1 -1
- package/lib/graph/index.d.ts +4 -4
- package/lib/graph/index.js +25 -27
- package/lib/graph/index.js.map +1 -1
- package/lib/index.d.ts +29 -26
- package/lib/index.js +154 -70
- package/lib/index.js.map +1 -1
- package/lib/isCachingEnabled.js +17 -6
- package/lib/isCachingEnabled.js.map +1 -1
- package/lib/lockfile/nameAtVersion.js +9 -4
- package/lib/lockfile/nameAtVersion.js.map +1 -1
- package/lib/lockfile/parseBerryLock.d.ts +1 -1
- package/lib/lockfile/parseBerryLock.js +13 -11
- package/lib/lockfile/parseBerryLock.js.map +1 -1
- package/lib/lockfile/parseLockFile.d.ts +2 -0
- package/lib/lockfile/parseLockFile.js +87 -0
- package/lib/lockfile/parseLockFile.js.map +1 -0
- package/lib/lockfile/parseNpmLock.d.ts +1 -1
- package/lib/lockfile/parseNpmLock.js +15 -7
- package/lib/lockfile/parseNpmLock.js.map +1 -1
- package/lib/lockfile/parsePnpmLock.d.ts +1 -1
- package/lib/lockfile/parsePnpmLock.js +14 -9
- package/lib/lockfile/parsePnpmLock.js.map +1 -1
- package/lib/lockfile/queryLockFile.d.ts +1 -1
- package/lib/lockfile/queryLockFile.js +11 -6
- package/lib/lockfile/queryLockFile.js.map +1 -1
- package/lib/lockfile/readYaml.js +17 -9
- package/lib/lockfile/readYaml.js.map +1 -1
- package/lib/lockfile/types.js +3 -2
- package/lib/lockfile/types.js.map +1 -1
- package/lib/logging.js +10 -6
- package/lib/logging.js.map +1 -1
- package/lib/paths.d.ts +1 -1
- package/lib/paths.js +59 -59
- package/lib/paths.js.map +1 -1
- package/lib/scope.js +30 -21
- package/lib/scope.js.map +1 -1
- package/lib/types/Catalogs.js +8 -3
- package/lib/types/Catalogs.js.map +1 -1
- package/lib/types/PackageGraph.js +4 -3
- package/lib/types/PackageGraph.js.map +1 -1
- package/lib/types/PackageInfo.d.ts +1 -1
- package/lib/types/PackageInfo.js +3 -2
- package/lib/types/PackageInfo.js.map +1 -1
- package/lib/types/WorkspaceInfo.d.ts +1 -1
- package/lib/types/WorkspaceInfo.js +3 -2
- package/lib/types/WorkspaceInfo.js.map +1 -1
- package/lib/types/WorkspaceManager.js +3 -2
- package/lib/types/WorkspaceManager.js.map +1 -1
- package/lib/workspaces/catalogsToYaml.d.ts +1 -1
- package/lib/workspaces/catalogsToYaml.js +12 -10
- package/lib/workspaces/catalogsToYaml.js.map +1 -1
- package/lib/workspaces/findWorkspacePath.d.ts +2 -1
- package/lib/workspaces/findWorkspacePath.js +10 -12
- package/lib/workspaces/findWorkspacePath.js.map +1 -1
- package/lib/workspaces/getAllPackageJsonFiles.js +32 -28
- package/lib/workspaces/getAllPackageJsonFiles.js.map +1 -1
- package/lib/workspaces/getCatalogVersion.d.ts +1 -1
- package/lib/workspaces/getCatalogVersion.js +19 -32
- package/lib/workspaces/getCatalogVersion.js.map +1 -1
- package/lib/workspaces/getCatalogs.d.ts +2 -2
- package/lib/workspaces/getCatalogs.js +17 -22
- package/lib/workspaces/getCatalogs.js.map +1 -1
- package/lib/workspaces/getChangedPackages.d.ts +1 -1
- package/lib/workspaces/getChangedPackages.js +47 -30
- package/lib/workspaces/getChangedPackages.js.map +1 -1
- package/lib/workspaces/getPackagesByFiles.js +29 -24
- package/lib/workspaces/getPackagesByFiles.js.map +1 -1
- package/lib/workspaces/getWorkspaceInfos.d.ts +2 -2
- package/lib/workspaces/getWorkspaceInfos.js +43 -58
- package/lib/workspaces/getWorkspaceInfos.js.map +1 -1
- package/lib/workspaces/getWorkspaceManagerRoot.d.ts +1 -1
- package/lib/workspaces/getWorkspaceManagerRoot.js +16 -13
- package/lib/workspaces/getWorkspaceManagerRoot.js.map +1 -1
- package/lib/workspaces/getWorkspacePackagePaths.d.ts +1 -1
- package/lib/workspaces/getWorkspacePackagePaths.js +86 -72
- package/lib/workspaces/getWorkspacePackagePaths.js.map +1 -1
- package/lib/workspaces/getWorkspacePatterns.d.ts +1 -1
- package/lib/workspaces/getWorkspacePatterns.js +18 -20
- package/lib/workspaces/getWorkspacePatterns.js.map +1 -1
- package/lib/workspaces/implementations/WorkspaceUtilities.d.ts +1 -1
- package/lib/workspaces/implementations/WorkspaceUtilities.js +3 -2
- package/lib/workspaces/implementations/WorkspaceUtilities.js.map +1 -1
- package/lib/workspaces/implementations/getPackageJsonWorkspacePatterns.d.ts +1 -1
- package/lib/workspaces/implementations/getPackageJsonWorkspacePatterns.js +24 -22
- package/lib/workspaces/implementations/getPackageJsonWorkspacePatterns.js.map +1 -1
- package/lib/workspaces/implementations/getWorkspaceManagerAndRoot.d.ts +1 -1
- package/lib/workspaces/implementations/getWorkspaceManagerAndRoot.js +38 -43
- package/lib/workspaces/implementations/getWorkspaceManagerAndRoot.js.map +1 -1
- package/lib/workspaces/implementations/getWorkspaceUtilities.d.ts +2 -2
- package/lib/workspaces/implementations/getWorkspaceUtilities.js +25 -13
- package/lib/workspaces/implementations/getWorkspaceUtilities.js.map +1 -1
- package/lib/workspaces/implementations/index.d.ts +2 -2
- package/lib/workspaces/implementations/index.js +19 -7
- package/lib/workspaces/implementations/index.js.map +1 -1
- package/lib/workspaces/implementations/lerna.d.ts +1 -1
- package/lib/workspaces/implementations/lerna.js +55 -31
- package/lib/workspaces/implementations/lerna.js.map +1 -1
- package/lib/workspaces/implementations/npm.d.ts +1 -1
- package/lib/workspaces/implementations/npm.js +12 -7
- package/lib/workspaces/implementations/npm.js.map +1 -1
- package/lib/workspaces/implementations/pnpm.d.ts +1 -1
- package/lib/workspaces/implementations/pnpm.js +28 -17
- package/lib/workspaces/implementations/pnpm.js.map +1 -1
- package/lib/workspaces/implementations/rush.d.ts +1 -1
- package/lib/workspaces/implementations/rush.js +27 -16
- package/lib/workspaces/implementations/rush.js.map +1 -1
- package/lib/workspaces/implementations/yarn.d.ts +1 -1
- package/lib/workspaces/implementations/yarn.js +34 -26
- package/lib/workspaces/implementations/yarn.js.map +1 -1
- package/lib/workspaces/wrapWorkspaceUtility.d.ts +1 -1
- package/lib/workspaces/wrapWorkspaceUtility.js +25 -27
- package/lib/workspaces/wrapWorkspaceUtility.js.map +1 -1
- package/package.json +21 -12
- package/lib/lockfile/index.d.ts +0 -6
- package/lib/lockfile/index.js +0 -105
- package/lib/lockfile/index.js.map +0 -1
package/lib/types/Catalogs.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
+
*/ "use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/types/Catalogs.ts"],"sourcesContent":["/**\n * Mapping from package name to package version.\n * @see https://pnpm.io/catalogs#default-catalog\n * @see https://yarnpkg.com/features/catalogs#basic-usage\n */\nexport interface Catalog {\n [packageName: string]: string;\n}\n\n/**\n * Mapping from catalog name (non-default) to catalog definition\n * @see https://pnpm.io/catalogs#named-catalogs\n * @see https://yarnpkg.com/features/catalogs#named-catalogs\n */\nexport interface NamedCatalogs {\n [catalogName: string]: Catalog;\n}\n\n/**\n * Package version catalogs\n * @see https://pnpm.io/catalogs\n * @see https://yarnpkg.com/features/catalogs\n */\nexport interface Catalogs {\n /**\n * The default catalog (`catalog:`) if present.\n *\n * Whether this is equivalent to `catalogs.default` depends on the package manager:\n * they're the same in pnpm, but different in yarn. If there was a pnpm catalog named \"default\",\n * it will be stored under this property instead (but `getCatalogVersion` supports either syntax).\n */\n default?: Catalog;\n\n /**\n * Mapping from catalog name to catalog definition, if present.\n *\n * (For pnpm, if there was a catalog named \"default\", it will be under `Catalogs.default`\n * and omitted here.)\n */\n named?: NamedCatalogs;\n}\n"],"names":[],"mappings":"AAAA;;;;CAIC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
1
|
+
/** A package graph edge that defines a single package name and one of its dependency */ "use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/types/PackageGraph.ts"],"sourcesContent":["/** A package graph edge that defines a single package name and one of its dependency */\nexport interface PackageDependency {\n /** Name of a package */\n name: string;\n /** A dependency of `name` */\n dependency: string;\n}\n\n/** The graph is defined by as a list of package names as nodes, and a list of dependencies as edges */\nexport interface PackageGraph {\n /** Nodes: list of package names */\n packages: string[];\n\n /** Edges: list of package dependencies */\n dependencies: PackageDependency[];\n}\n"],"names":[],"mappings":"AAAA,sFAAsF"}
|
package/lib/types/PackageInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "catalogsToYaml", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return catalogsToYaml;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
7
11
|
function catalogsToYaml(catalogs, options = {}) {
|
|
8
12
|
const { named, default: defaultCatalog } = catalogs;
|
|
9
13
|
const lines = [];
|
|
10
14
|
const indent = typeof options.indent === "string" ? options.indent : " ".repeat(options.indent ?? 2);
|
|
11
15
|
if (defaultCatalog) {
|
|
12
16
|
lines.push("catalog:");
|
|
13
|
-
for (const [pkg, version] of Object.entries(defaultCatalog))
|
|
17
|
+
for (const [pkg, version] of Object.entries(defaultCatalog)){
|
|
14
18
|
lines.push(`${indent}${pkg}: ${version}`);
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
21
|
if (named) {
|
|
18
22
|
lines.push("catalogs:");
|
|
19
|
-
for (const [catalogName, catalogEntries] of Object.entries(named))
|
|
23
|
+
for (const [catalogName, catalogEntries] of Object.entries(named)){
|
|
20
24
|
lines.push(`${indent}${catalogName}:`);
|
|
21
|
-
for (const [pkg, version] of Object.entries(catalogEntries))
|
|
25
|
+
for (const [pkg, version] of Object.entries(catalogEntries)){
|
|
22
26
|
lines.push(`${indent}${indent}${pkg}: ${version}`);
|
|
23
27
|
}
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
return lines.join("\n");
|
|
27
31
|
}
|
|
28
|
-
exports.catalogsToYaml = catalogsToYaml;
|
|
29
|
-
//# sourceMappingURL=catalogsToYaml.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/workspaces/catalogsToYaml.ts"],"sourcesContent":["import type { Catalogs } from \"../types/Catalogs.js\";\n\n/**\n * Convert catalogs to the yaml format used by yarn v4 and pnpm.\n */\nexport function catalogsToYaml(\n catalogs: Catalogs,\n options: {\n /** Number of spaces (default 2), or another indentation character */\n indent?: number | string;\n } = {}\n): string {\n const { named, default: defaultCatalog } = catalogs;\n const lines: string[] = [];\n const indent = typeof options.indent === \"string\" ? options.indent : \" \".repeat(options.indent ?? 2);\n\n if (defaultCatalog) {\n lines.push(\"catalog:\");\n for (const [pkg, version] of Object.entries(defaultCatalog)) {\n lines.push(`${indent}${pkg}: ${version}`);\n }\n }\n\n if (named) {\n lines.push(\"catalogs:\");\n for (const [catalogName, catalogEntries] of Object.entries(named)) {\n lines.push(`${indent}${catalogName}:`);\n for (const [pkg, version] of Object.entries(catalogEntries)) {\n lines.push(`${indent}${indent}${pkg}: ${version}`);\n }\n }\n }\n\n return lines.join(\"\\n\");\n}\n"],"names":["catalogsToYaml","catalogs","options","named","default","defaultCatalog","lines","indent","repeat","push","pkg","version","Object","entries","catalogName","catalogEntries","join"],"mappings":";;;;+BAKgBA;;;eAAAA;;;AAAT,SAASA,eACdC,QAAkB,EAClBC,UAGI,CAAC,CAAC;IAEN,MAAM,EAAEC,KAAK,EAAEC,SAASC,cAAc,EAAE,GAAGJ;IAC3C,MAAMK,QAAkB,EAAE;IAC1B,MAAMC,SAAS,OAAOL,QAAQK,MAAM,KAAK,WAAWL,QAAQK,MAAM,GAAG,IAAIC,MAAM,CAACN,QAAQK,MAAM,IAAI;IAElG,IAAIF,gBAAgB;QAClBC,MAAMG,IAAI,CAAC;QACX,KAAK,MAAM,CAACC,KAAKC,QAAQ,IAAIC,OAAOC,OAAO,CAACR,gBAAiB;YAC3DC,MAAMG,IAAI,CAAC,GAAGF,SAASG,IAAI,EAAE,EAAEC,SAAS;QAC1C;IACF;IAEA,IAAIR,OAAO;QACTG,MAAMG,IAAI,CAAC;QACX,KAAK,MAAM,CAACK,aAAaC,eAAe,IAAIH,OAAOC,OAAO,CAACV,OAAQ;YACjEG,MAAMG,IAAI,CAAC,GAAGF,SAASO,YAAY,CAAC,CAAC;YACrC,KAAK,MAAM,CAACJ,KAAKC,QAAQ,IAAIC,OAAOC,OAAO,CAACE,gBAAiB;gBAC3DT,MAAMG,IAAI,CAAC,GAAGF,SAASA,SAASG,IAAI,EAAE,EAAEC,SAAS;YACnD;QACF;IACF;IAEA,OAAOL,MAAMU,IAAI,CAAC;AACpB"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { WorkspaceInfos } from "../types/WorkspaceInfo";
|
|
1
|
+
import type { WorkspaceInfos } from "../types/WorkspaceInfo.js";
|
|
2
2
|
/**
|
|
3
3
|
* Find the path for a particular package name from an array of info about packages ("workspaces"
|
|
4
4
|
* in npm/yarn/pnpm terms) within a monorepo.
|
|
5
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
|
+
* @deprecated Just write `workspaces.find(({ name }) => name === packageName)?.path` instead
|
|
8
9
|
*/
|
|
9
10
|
export declare function findWorkspacePath(workspaces: WorkspaceInfos, packageName: string): string | undefined;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "findWorkspacePath", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return findWorkspacePath;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
11
|
function findWorkspacePath(workspaces, packageName) {
|
|
12
|
-
return workspaces.find(({ name })
|
|
12
|
+
return workspaces.find(({ name })=>name === packageName)?.path;
|
|
13
13
|
}
|
|
14
|
-
exports.findWorkspacePath = findWorkspacePath;
|
|
15
|
-
//# sourceMappingURL=findWorkspacePath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/workspaces/findWorkspacePath.ts"],"sourcesContent":["import type { WorkspaceInfos } from \"../types/WorkspaceInfo.js\";\n\n/**\n * Find the path for a particular package name from an array of info about packages (\"workspaces\"\n * in npm/yarn/pnpm terms) within a monorepo.\n * @param workspaces Array of info about packages within a monorepo\n * @param packageName Package name to find\n * @returns Package path if found, or undefined\n * @deprecated Just write `workspaces.find(({ name }) => name === packageName)?.path` instead\n */\nexport function findWorkspacePath(workspaces: WorkspaceInfos, packageName: string): string | undefined {\n return workspaces.find(({ name }) => name === packageName)?.path;\n}\n"],"names":["findWorkspacePath","workspaces","packageName","find","name","path"],"mappings":";;;;+BAUgBA;;;eAAAA;;;AAAT,SAASA,kBAAkBC,UAA0B,EAAEC,WAAmB;IAC/E,OAAOD,WAAWE,IAAI,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA,SAASF,cAAcG;AAC9D"}
|
|
@@ -1,45 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get _resetPackageJsonFilesCache () {
|
|
13
|
+
return _resetPackageJsonFilesCache;
|
|
14
|
+
},
|
|
15
|
+
get getAllPackageJsonFiles () {
|
|
16
|
+
return getAllPackageJsonFiles;
|
|
17
|
+
},
|
|
18
|
+
get getAllPackageJsonFilesAsync () {
|
|
19
|
+
return getAllPackageJsonFilesAsync;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
23
|
+
const _getWorkspacePackagePaths = require("./getWorkspacePackagePaths.js");
|
|
24
|
+
const _isCachingEnabled = require("../isCachingEnabled.js");
|
|
25
|
+
function _interop_require_default(obj) {
|
|
26
|
+
return obj && obj.__esModule ? obj : {
|
|
27
|
+
default: obj
|
|
28
|
+
};
|
|
29
|
+
}
|
|
10
30
|
const cache = new Map();
|
|
11
|
-
/**
|
|
12
|
-
* Get paths to every package.json in the monorepo, given a cwd, with caching.
|
|
13
|
-
*
|
|
14
|
-
* @returns Array of package.json paths, or undefined if there's any issue
|
|
15
|
-
* (logs verbose warnings instead of throwing on error)
|
|
16
|
-
*/
|
|
17
31
|
function getAllPackageJsonFiles(cwd) {
|
|
18
|
-
if ((0,
|
|
32
|
+
if ((0, _isCachingEnabled.isCachingEnabled)() && cache.has(cwd)) {
|
|
19
33
|
return cache.get(cwd);
|
|
20
34
|
}
|
|
21
|
-
const packageJsonFiles = (0,
|
|
35
|
+
const packageJsonFiles = (0, _getWorkspacePackagePaths.getWorkspacePackagePaths)(cwd)?.map((packagePath)=>_path.default.join(packagePath, "package.json"));
|
|
22
36
|
cache.set(cwd, packageJsonFiles);
|
|
23
37
|
return packageJsonFiles;
|
|
24
38
|
}
|
|
25
|
-
exports.getAllPackageJsonFiles = getAllPackageJsonFiles;
|
|
26
39
|
function _resetPackageJsonFilesCache() {
|
|
27
40
|
cache.clear();
|
|
28
41
|
}
|
|
29
|
-
exports._resetPackageJsonFilesCache = _resetPackageJsonFilesCache;
|
|
30
|
-
/**
|
|
31
|
-
* Get paths to every package.json in the monorepo, given a cwd, with caching.
|
|
32
|
-
*
|
|
33
|
-
* @returns Array of package.json paths, or undefined if there's any issue
|
|
34
|
-
* (logs verbose warnings instead of throwing on error)
|
|
35
|
-
*/
|
|
36
42
|
async function getAllPackageJsonFilesAsync(cwd) {
|
|
37
|
-
if ((0,
|
|
43
|
+
if ((0, _isCachingEnabled.isCachingEnabled)() && cache.has(cwd)) {
|
|
38
44
|
return cache.get(cwd);
|
|
39
45
|
}
|
|
40
|
-
const packageJsonFiles = (await (0,
|
|
46
|
+
const packageJsonFiles = (await (0, _getWorkspacePackagePaths.getWorkspacePackagePathsAsync)(cwd))?.map((packagePath)=>_path.default.join(packagePath, "package.json"));
|
|
41
47
|
cache.set(cwd, packageJsonFiles);
|
|
42
48
|
return packageJsonFiles;
|
|
43
49
|
}
|
|
44
|
-
exports.getAllPackageJsonFilesAsync = getAllPackageJsonFilesAsync;
|
|
45
|
-
//# sourceMappingURL=getAllPackageJsonFiles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/workspaces/getAllPackageJsonFiles.ts"],"sourcesContent":["import path from \"path\";\nimport { getWorkspacePackagePaths, getWorkspacePackagePathsAsync } from \"./getWorkspacePackagePaths.js\";\nimport { isCachingEnabled } from \"../isCachingEnabled.js\";\n\nconst cache = new Map<string, string[] | undefined>();\n\n/**\n * Get paths to every package.json in the monorepo, given a cwd, with caching.\n *\n * @returns Array of package.json paths, or undefined if there's any issue\n * (logs verbose warnings instead of throwing on error)\n */\nexport function getAllPackageJsonFiles(cwd: string): string[] | undefined {\n if (isCachingEnabled() && cache.has(cwd)) {\n return cache.get(cwd)!;\n }\n\n const packageJsonFiles = getWorkspacePackagePaths(cwd)?.map((packagePath) => path.join(packagePath, \"package.json\"));\n\n cache.set(cwd, packageJsonFiles);\n\n return packageJsonFiles;\n}\n\nexport function _resetPackageJsonFilesCache(): void {\n cache.clear();\n}\n\n/**\n * Get paths to every package.json in the monorepo, given a cwd, with caching.\n *\n * @returns Array of package.json paths, or undefined if there's any issue\n * (logs verbose warnings instead of throwing on error)\n */\nexport async function getAllPackageJsonFilesAsync(cwd: string): Promise<string[] | undefined> {\n if (isCachingEnabled() && cache.has(cwd)) {\n return cache.get(cwd)!;\n }\n\n const packageJsonFiles = (await getWorkspacePackagePathsAsync(cwd))?.map((packagePath) =>\n path.join(packagePath, \"package.json\")\n );\n\n cache.set(cwd, packageJsonFiles);\n\n return packageJsonFiles;\n}\n"],"names":["_resetPackageJsonFilesCache","getAllPackageJsonFiles","getAllPackageJsonFilesAsync","cache","Map","cwd","isCachingEnabled","has","get","packageJsonFiles","getWorkspacePackagePaths","map","packagePath","path","join","set","clear","getWorkspacePackagePathsAsync"],"mappings":";;;;;;;;;;;QAwBgBA;eAAAA;;QAZAC;eAAAA;;QAsBMC;eAAAA;;;6DAlCL;0CACuD;kCACvC;;;;;;AAEjC,MAAMC,QAAQ,IAAIC;AAQX,SAASH,uBAAuBI,GAAW;IAChD,IAAIC,IAAAA,kCAAgB,OAAMH,MAAMI,GAAG,CAACF,MAAM;QACxC,OAAOF,MAAMK,GAAG,CAACH;IACnB;IAEA,MAAMI,mBAAmBC,IAAAA,kDAAwB,EAACL,MAAMM,IAAI,CAACC,cAAgBC,aAAI,CAACC,IAAI,CAACF,aAAa;IAEpGT,MAAMY,GAAG,CAACV,KAAKI;IAEf,OAAOA;AACT;AAEO,SAAST;IACdG,MAAMa,KAAK;AACb;AAQO,eAAed,4BAA4BG,GAAW;IAC3D,IAAIC,IAAAA,kCAAgB,OAAMH,MAAMI,GAAG,CAACF,MAAM;QACxC,OAAOF,MAAMK,GAAG,CAACH;IACnB;IAEA,MAAMI,mBAAoB,CAAA,MAAMQ,IAAAA,uDAA6B,EAACZ,IAAG,GAAIM,IAAI,CAACC,cACxEC,aAAI,CAACC,IAAI,CAACF,aAAa;IAGzBT,MAAMY,GAAG,CAACV,KAAKI;IAEf,OAAOA;AACT"}
|
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get getCatalogVersion () {
|
|
13
|
+
return getCatalogVersion;
|
|
14
|
+
},
|
|
15
|
+
get isCatalogVersion () {
|
|
16
|
+
return isCatalogVersion;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
4
19
|
const catalogPrefix = "catalog:";
|
|
5
|
-
/**
|
|
6
|
-
* Returns true if the version starts with `catalog:`.
|
|
7
|
-
*/
|
|
8
20
|
function isCatalogVersion(version) {
|
|
9
21
|
return version.startsWith(catalogPrefix);
|
|
10
22
|
}
|
|
11
|
-
exports.isCatalogVersion = isCatalogVersion;
|
|
12
|
-
/**
|
|
13
|
-
* Given a dependency package name and a version spec string, if the version starts with `catalog:`,
|
|
14
|
-
* look up the actual version spec (not the final resolved version) from the given catalogs.
|
|
15
|
-
*
|
|
16
|
-
* Throws an error if there's anything invalid about the catalog spec (no catalogs defined,
|
|
17
|
-
* no matching catalog, catalog doesn't contain `name`, recursive catalog version).
|
|
18
|
-
*
|
|
19
|
-
* Returns undefined if the version doesn't start with `catalog:`.
|
|
20
|
-
* @see https://pnpm.io/catalogs
|
|
21
|
-
* @see https://yarnpkg.com/features/catalogs
|
|
22
|
-
*
|
|
23
|
-
* @param name - Dependency package name
|
|
24
|
-
* @param version - Dependency version spec, e.g. `catalog:my-catalog` or `catalog:`,
|
|
25
|
-
* or some non-catalog spec like `^1.2.3`
|
|
26
|
-
* @returns Actual version spec from the catalog, or undefined if not a catalog version
|
|
27
|
-
*/
|
|
28
23
|
function getCatalogVersion(params) {
|
|
29
24
|
const { name, version, catalogs } = params;
|
|
30
25
|
if (!isCatalogVersion(version)) {
|
|
@@ -34,17 +29,11 @@ function getCatalogVersion(params) {
|
|
|
34
29
|
throw new Error(`Dependency "${name}" uses a catalog version "${version}" but no catalogs are defined.`);
|
|
35
30
|
}
|
|
36
31
|
const catalogName = version.slice(catalogPrefix.length);
|
|
37
|
-
const checkCatalog =
|
|
38
|
-
// Explicit catalog:default refers to the default catalog in pnpm, or a catalog named "default"
|
|
32
|
+
const checkCatalog = // Explicit catalog:default refers to the default catalog in pnpm, or a catalog named "default"
|
|
39
33
|
// in yarn... Check for the yarn case first or fall back to .default. (getCatalogs should have
|
|
40
34
|
// removed the named "default" catalog from namedCatalogs in managers where they're the same,
|
|
41
35
|
// 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;
|
|
36
|
+
catalogName === "default" ? catalogs.named?.default || catalogs.default : catalogName ? catalogs.named?.[catalogName] : catalogs.default;
|
|
48
37
|
const catalogNameStr = catalogName ? `catalogs.${catalogName}` : "the default catalog";
|
|
49
38
|
if (!checkCatalog) {
|
|
50
39
|
throw new Error(`Dependency "${name}" uses a catalog version "${version}" but ${catalogNameStr} is not defined.`);
|
|
@@ -58,5 +47,3 @@ function getCatalogVersion(params) {
|
|
|
58
47
|
}
|
|
59
48
|
return actualSpec;
|
|
60
49
|
}
|
|
61
|
-
exports.getCatalogVersion = getCatalogVersion;
|
|
62
|
-
//# sourceMappingURL=getCatalogVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/workspaces/getCatalogVersion.ts"],"sourcesContent":["import type { Catalogs } from \"../types/Catalogs.js\";\n\nconst catalogPrefix = \"catalog:\";\n\n/**\n * Returns true if the version starts with `catalog:`.\n */\nexport function isCatalogVersion(version: string): boolean {\n return version.startsWith(catalogPrefix);\n}\n\n/**\n * Given a dependency package name and a version spec string, if the version starts with `catalog:`,\n * look up the actual version spec (not the final resolved version) from the given catalogs.\n *\n * Throws an error if there's anything invalid about the catalog spec (no catalogs defined,\n * no matching catalog, catalog doesn't contain `name`, recursive catalog version).\n *\n * Returns undefined if the version doesn't start with `catalog:`.\n * @see https://pnpm.io/catalogs\n * @see https://yarnpkg.com/features/catalogs\n *\n * @param name - Dependency package name\n * @param version - Dependency version spec, e.g. `catalog:my-catalog` or `catalog:`,\n * or some non-catalog spec like `^1.2.3`\n * @returns Actual version spec from the catalog, or undefined if not a catalog version\n */\nexport function getCatalogVersion(params: {\n name: string;\n version: string;\n catalogs: Catalogs | undefined;\n}): string | undefined {\n const { name, version, catalogs } = params;\n\n if (!isCatalogVersion(version)) {\n return undefined;\n }\n\n if (!catalogs) {\n throw new Error(`Dependency \"${name}\" uses a catalog version \"${version}\" but no catalogs are defined.`);\n }\n\n const catalogName = version.slice(catalogPrefix.length);\n const checkCatalog =\n // Explicit catalog:default refers to the default catalog in pnpm, or a catalog named \"default\"\n // in yarn... Check for the yarn case first or fall back to .default. (getCatalogs should have\n // removed the named \"default\" catalog from namedCatalogs in managers where they're the same,\n // and yarn install would have errored if a named catalog \"default\" was referenced but not defined.)\n catalogName === \"default\"\n ? catalogs.named?.default || catalogs.default\n : // Otherwise use either the given named catalog, or the default if no name was specified\n catalogName\n ? catalogs.named?.[catalogName]\n : catalogs.default;\n const catalogNameStr = catalogName ? `catalogs.${catalogName}` : \"the default catalog\";\n\n if (!checkCatalog) {\n throw new Error(`Dependency \"${name}\" uses a catalog version \"${version}\" but ${catalogNameStr} is not defined.`);\n }\n\n const actualSpec = checkCatalog[name];\n if (!actualSpec) {\n throw new Error(\n `Dependency \"${name}\" uses a catalog version \"${version}\", but ${catalogNameStr} doesn't define a version for \"${name}\".`\n );\n }\n\n if (isCatalogVersion(actualSpec)) {\n throw new Error(\n `Dependency \"${name}\" resolves to a recursive catalog version \"${actualSpec}\", which is not supported.`\n );\n }\n\n return actualSpec;\n}\n"],"names":["getCatalogVersion","isCatalogVersion","catalogPrefix","version","startsWith","params","name","catalogs","undefined","Error","catalogName","slice","length","checkCatalog","named","default","catalogNameStr","actualSpec"],"mappings":";;;;;;;;;;;QA2BgBA;eAAAA;;QApBAC;eAAAA;;;AALhB,MAAMC,gBAAgB;AAKf,SAASD,iBAAiBE,OAAe;IAC9C,OAAOA,QAAQC,UAAU,CAACF;AAC5B;AAkBO,SAASF,kBAAkBK,MAIjC;IACC,MAAM,EAAEC,IAAI,EAAEH,OAAO,EAAEI,QAAQ,EAAE,GAAGF;IAEpC,IAAI,CAACJ,iBAAiBE,UAAU;QAC9B,OAAOK;IACT;IAEA,IAAI,CAACD,UAAU;QACb,MAAM,IAAIE,MAAM,CAAC,YAAY,EAAEH,KAAK,0BAA0B,EAAEH,QAAQ,8BAA8B,CAAC;IACzG;IAEA,MAAMO,cAAcP,QAAQQ,KAAK,CAACT,cAAcU,MAAM;IACtD,MAAMC,eACJ,+FAA+F;IAC/F,8FAA8F;IAC9F,6FAA6F;IAC7F,oGAAoG;IACpGH,gBAAgB,YACZH,SAASO,KAAK,EAAEC,WAAWR,SAASQ,OAAO,GAE3CL,cACEH,SAASO,KAAK,EAAE,CAACJ,YAAY,GAC7BH,SAASQ,OAAO;IACxB,MAAMC,iBAAiBN,cAAc,CAAC,SAAS,EAAEA,aAAa,GAAG;IAEjE,IAAI,CAACG,cAAc;QACjB,MAAM,IAAIJ,MAAM,CAAC,YAAY,EAAEH,KAAK,0BAA0B,EAAEH,QAAQ,MAAM,EAAEa,eAAe,gBAAgB,CAAC;IAClH;IAEA,MAAMC,aAAaJ,YAAY,CAACP,KAAK;IACrC,IAAI,CAACW,YAAY;QACf,MAAM,IAAIR,MACR,CAAC,YAAY,EAAEH,KAAK,0BAA0B,EAAEH,QAAQ,OAAO,EAAEa,eAAe,+BAA+B,EAAEV,KAAK,EAAE,CAAC;IAE7H;IAEA,IAAIL,iBAAiBgB,aAAa;QAChC,MAAM,IAAIR,MACR,CAAC,YAAY,EAAEH,KAAK,2CAA2C,EAAEW,WAAW,0BAA0B,CAAC;IAE3G;IAEA,OAAOA;AACT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Catalogs } from "../types/Catalogs";
|
|
2
|
-
import type { WorkspaceManager } from "../types/WorkspaceManager";
|
|
1
|
+
import type { Catalogs } from "../types/Catalogs.js";
|
|
2
|
+
import type { WorkspaceManager } from "../types/WorkspaceManager.js";
|
|
3
3
|
/**
|
|
4
4
|
* Get version catalogs, if supported by the manager (only pnpm and yarn v4 as of writing).
|
|
5
5
|
* Returns undefined if no catalogs are present or the manager doesn't support them.
|
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* @param managerOverride Workspace/monorepo manager to use instead of auto-detecting
|
|
14
|
-
*
|
|
15
|
-
* @returns Catalogs if defined, or undefined if not available
|
|
16
|
-
* (logs verbose warnings instead of throwing on error)
|
|
17
|
-
*/
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "getCatalogs", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return getCatalogs;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _implementations = require("./implementations");
|
|
12
|
+
const _wrapWorkspaceUtility = require("./wrapWorkspaceUtility.js");
|
|
18
13
|
function getCatalogs(cwd, managerOverride) {
|
|
19
|
-
return (0,
|
|
14
|
+
return (0, _wrapWorkspaceUtility.wrapWorkspaceUtility)({
|
|
20
15
|
cwd,
|
|
21
16
|
managerOverride,
|
|
22
17
|
description: "catalogs",
|
|
23
|
-
impl: ({ manager, root })
|
|
18
|
+
impl: ({ manager, root })=>{
|
|
24
19
|
// There is no default implementation for catalogs, since not all managers support it
|
|
25
|
-
return (0,
|
|
26
|
-
|
|
20
|
+
return (0, _implementations.getWorkspaceUtilities)(manager).getCatalogs?.({
|
|
21
|
+
root
|
|
22
|
+
});
|
|
23
|
+
}
|
|
27
24
|
});
|
|
28
25
|
}
|
|
29
|
-
exports.getCatalogs = getCatalogs;
|
|
30
|
-
//# sourceMappingURL=getCatalogs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/workspaces/getCatalogs.ts"],"sourcesContent":["import type { Catalogs } from \"../types/Catalogs.js\";\nimport type { WorkspaceManager } from \"../types/WorkspaceManager.js\";\nimport { getWorkspaceUtilities } from \"./implementations\";\nimport { wrapWorkspaceUtility } from \"./wrapWorkspaceUtility.js\";\n\n/**\n * Get version catalogs, if supported by the manager (only pnpm and yarn v4 as of writing).\n * Returns undefined if no catalogs are present or the manager doesn't support them.\n * @see https://pnpm.io/catalogs\n * @see https://yarnpkg.com/features/catalogs\n *\n * @param cwd - Current working directory. It will search up from here to find the root, with caching.\n * @param managerOverride Workspace/monorepo manager to use instead of auto-detecting\n *\n * @returns Catalogs if defined, or undefined if not available\n * (logs verbose warnings instead of throwing on error)\n */\nexport function getCatalogs(cwd: string, managerOverride?: WorkspaceManager): Catalogs | undefined {\n return wrapWorkspaceUtility({\n cwd,\n managerOverride,\n description: \"catalogs\",\n impl: ({ manager, root }) => {\n // There is no default implementation for catalogs, since not all managers support it\n return getWorkspaceUtilities(manager).getCatalogs?.({ root });\n },\n });\n}\n"],"names":["getCatalogs","cwd","managerOverride","wrapWorkspaceUtility","description","impl","manager","root","getWorkspaceUtilities"],"mappings":";;;;+BAiBgBA;;;eAAAA;;;iCAfsB;sCACD;AAc9B,SAASA,YAAYC,GAAW,EAAEC,eAAkC;IACzE,OAAOC,IAAAA,0CAAoB,EAAC;QAC1BF;QACAC;QACAE,aAAa;QACbC,MAAM,CAAC,EAAEC,OAAO,EAAEC,IAAI,EAAE;YACtB,qFAAqF;YACrF,OAAOC,IAAAA,sCAAqB,EAACF,SAASN,WAAW,GAAG;gBAAEO;YAAK;QAC7D;IACF;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GitCommonOptions, type GetChangesBetweenRefsOptions } from "../git/types";
|
|
1
|
+
import { type GitCommonOptions, type GetChangesBetweenRefsOptions } from "../git/types.js";
|
|
2
2
|
type GetChangedPackagesOptions = GitCommonOptions & {
|
|
3
3
|
/** The `merge-base` branch (must have been fetched locally) */
|
|
4
4
|
target?: string;
|
|
@@ -1,52 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get getChangedPackages () {
|
|
13
|
+
return getChangedPackages;
|
|
14
|
+
},
|
|
15
|
+
get getChangedPackagesBetweenRefs () {
|
|
16
|
+
return getChangedPackagesBetweenRefs;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _git = require("../git");
|
|
20
|
+
const _getPackagesByFiles = require("./getPackagesByFiles.js");
|
|
6
21
|
function getChangedPackagesBetweenRefs(paramsOrCwd, _fromRef, _toRef, _ignoreGlobs, _returnAllPackagesOnNoMatch) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
: paramsOrCwd;
|
|
22
|
+
var _gitOptions;
|
|
23
|
+
const params = typeof paramsOrCwd === "string" ? {
|
|
24
|
+
cwd: paramsOrCwd,
|
|
25
|
+
fromRef: _fromRef,
|
|
26
|
+
toRef: _toRef,
|
|
27
|
+
ignoreGlobs: _ignoreGlobs,
|
|
28
|
+
returnAllPackagesOnNoMatch: _returnAllPackagesOnNoMatch
|
|
29
|
+
} : paramsOrCwd;
|
|
16
30
|
const { fromRef, toRef, ignoreGlobs, returnAllPackagesOnNoMatch = true, ...gitOptions } = params;
|
|
17
|
-
gitOptions.throwOnError ?? (
|
|
31
|
+
(_gitOptions = gitOptions).throwOnError ?? (_gitOptions.throwOnError = true);
|
|
18
32
|
const changes = [
|
|
19
33
|
...new Set([
|
|
20
|
-
...(0,
|
|
21
|
-
...(0,
|
|
22
|
-
...(0,
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
...(0, _git.getUntrackedChanges)(gitOptions),
|
|
35
|
+
...(0, _git.getUnstagedChanges)(gitOptions),
|
|
36
|
+
...(0, _git.getChangesBetweenRefs)({
|
|
37
|
+
fromRef,
|
|
38
|
+
toRef,
|
|
39
|
+
...gitOptions
|
|
40
|
+
}),
|
|
41
|
+
...(0, _git.getStagedChanges)(gitOptions)
|
|
42
|
+
])
|
|
25
43
|
];
|
|
26
|
-
return (0,
|
|
44
|
+
return (0, _getPackagesByFiles.getPackagesByFiles)({
|
|
27
45
|
root: gitOptions.cwd,
|
|
28
46
|
files: changes,
|
|
29
47
|
ignoreGlobs,
|
|
30
|
-
returnAllPackagesOnNoMatch
|
|
48
|
+
returnAllPackagesOnNoMatch
|
|
31
49
|
});
|
|
32
50
|
}
|
|
33
|
-
exports.getChangedPackagesBetweenRefs = getChangedPackagesBetweenRefs;
|
|
34
51
|
function getChangedPackages(cwdOrOptions, target, ignoreGlobs, returnAllPackagesOnNoMatch) {
|
|
52
|
+
var _gitOptions;
|
|
35
53
|
let gitOptions;
|
|
36
54
|
if (typeof cwdOrOptions === "string") {
|
|
37
|
-
gitOptions = {
|
|
38
|
-
|
|
39
|
-
|
|
55
|
+
gitOptions = {
|
|
56
|
+
cwd: cwdOrOptions
|
|
57
|
+
};
|
|
58
|
+
} else {
|
|
40
59
|
({ target, ignoreGlobs, returnAllPackagesOnNoMatch, ...gitOptions } = cwdOrOptions);
|
|
41
60
|
}
|
|
42
|
-
gitOptions.throwOnError ?? (
|
|
43
|
-
const targetBranch = target || (0,
|
|
61
|
+
(_gitOptions = gitOptions).throwOnError ?? (_gitOptions.throwOnError = true);
|
|
62
|
+
const targetBranch = target || (0, _git.getDefaultRemoteBranch)(gitOptions);
|
|
44
63
|
return getChangedPackagesBetweenRefs({
|
|
45
64
|
fromRef: targetBranch,
|
|
46
65
|
...gitOptions,
|
|
47
66
|
ignoreGlobs,
|
|
48
|
-
returnAllPackagesOnNoMatch
|
|
67
|
+
returnAllPackagesOnNoMatch
|
|
49
68
|
});
|
|
50
69
|
}
|
|
51
|
-
exports.getChangedPackages = getChangedPackages;
|
|
52
|
-
//# sourceMappingURL=getChangedPackages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/workspaces/getChangedPackages.ts"],"sourcesContent":["import {\n getChangesBetweenRefs,\n getDefaultRemoteBranch,\n getStagedChanges,\n getUnstagedChanges,\n getUntrackedChanges,\n} from \"../git\";\nimport { type GitCommonOptions, type GetChangesBetweenRefsOptions } from \"../git/types.js\";\nimport { getPackagesByFiles } from \"./getPackagesByFiles.js\";\n\ntype GetChangedPackagesOptions = GitCommonOptions & {\n /** The `merge-base` branch (must have been fetched locally) */\n target?: string;\n /** Glob patterns to ignore */\n ignoreGlobs?: string[];\n /** If true (the default), return all packages if no matches are found for any file. */\n returnAllPackagesOnNoMatch?: boolean;\n};\n\ntype GetChangedPackagesBetweenRefsOptions = Omit<GetChangedPackagesOptions, \"target\"> &\n Pick<GetChangesBetweenRefsOptions, \"fromRef\" | \"toRef\">;\n\n/**\n * Finds all packages that had been changed between two refs in the repo under cwd,\n * by executing `git diff $fromRef...$toRef`.\n *\n * **NOTE: The new object params version will throw if any of the git operations error.**\n * Disabling this behavior is not recommended due to the potential for hiding other issues,\n * but can be done by setting `throwOnError: false` in the options.\n *\n * Note that by default, if a repo-wide file such as the root package.json has changed,\n * all packages are assumed to have changed. (This is highly lage-specific behavior.)\n * Disable by setting `returnAllPackagesOnNoMatch` to `false`.\n *\n * Explanation of the three dots:\n *\n * ```txt\n * git diff [--options] <commit>...<commit> [--] [<path>...]\n *\n * This form is to view the changes on the branch containing and up to\n * the second <commit>, starting at a common ancestor of both\n * <commit>. \"git diff A...B\" is equivalent to \"git diff\n * $(git-merge-base A B) B\". You can omit any one of <commit>, which\n * has the same effect as using HEAD instead.\n * ```\n *\n * @returns list of package names that have changed\n */\nexport function getChangedPackagesBetweenRefs(params: GetChangedPackagesBetweenRefsOptions): string[];\n/** @deprecated Use object params version */\nexport function getChangedPackagesBetweenRefs(\n cwd: string,\n fromRef: string,\n toRef?: string,\n ignoreGlobs?: string[],\n returnAllPackagesOnNoMatch?: boolean\n): string[];\nexport function getChangedPackagesBetweenRefs(\n paramsOrCwd: GetChangedPackagesBetweenRefsOptions | string,\n _fromRef?: string,\n _toRef?: string,\n _ignoreGlobs?: string[],\n _returnAllPackagesOnNoMatch?: boolean\n): string[] {\n const params: GetChangedPackagesBetweenRefsOptions =\n typeof paramsOrCwd === \"string\"\n ? {\n cwd: paramsOrCwd,\n fromRef: _fromRef!,\n toRef: _toRef,\n ignoreGlobs: _ignoreGlobs,\n returnAllPackagesOnNoMatch: _returnAllPackagesOnNoMatch,\n }\n : paramsOrCwd;\n const { fromRef, toRef, ignoreGlobs, returnAllPackagesOnNoMatch = true, ...gitOptions } = params;\n gitOptions.throwOnError ??= true;\n\n const changes = [\n ...new Set([\n ...getUntrackedChanges(gitOptions),\n ...getUnstagedChanges(gitOptions),\n ...getChangesBetweenRefs({ fromRef, toRef, ...gitOptions }),\n ...getStagedChanges(gitOptions),\n ]),\n ];\n\n return getPackagesByFiles({\n root: gitOptions.cwd,\n files: changes,\n ignoreGlobs,\n returnAllPackagesOnNoMatch,\n });\n}\n\n/**\n * Finds all packages that had been changed in the repo under cwd, by executing\n * `git diff $target...`.\n *\n * **NOTE: The new object params version will throw if any of the git operations error.**\n * Disabling this behavior is not recommended due to the potential for hiding other issues,\n * but can be done by setting `throwOnError: false` in the options.\n *\n * Note that by default, if a repo-wide file such as the root package.json has changed,\n * all packages are assumed to have changed. (This is highly lage-specific behavior.)\n * Disable by setting `returnAllPackagesOnNoMatch` to `false`.\n *\n * Explanation of the three dots:\n *\n * ```txt\n * git diff [--options] <commit>...<commit> [--] [<path>...]\n *\n * This form is to view the changes on the branch containing and up to\n * the second <commit>, starting at a common ancestor of both\n * <commit>. \"git diff A...B\" is equivalent to \"git diff\n * $(git-merge-base A B) B\". You can omit any one of <commit>, which\n * has the same effect as using HEAD instead.\n * ```\n *\n * @returns list of package names that have changed\n */\nexport function getChangedPackages(params: GetChangedPackagesOptions): string[];\n/** @deprecated Use object params version */\nexport function getChangedPackages(\n cwd: string,\n target?: string,\n ignoreGlobs?: string[],\n returnAllPackagesOnNoMatch?: boolean\n): string[];\nexport function getChangedPackages(\n cwdOrOptions: string | GetChangedPackagesOptions,\n target?: string,\n ignoreGlobs?: string[],\n returnAllPackagesOnNoMatch?: boolean\n): string[] {\n let gitOptions: GitCommonOptions;\n if (typeof cwdOrOptions === \"string\") {\n gitOptions = { cwd: cwdOrOptions };\n } else {\n ({ target, ignoreGlobs, returnAllPackagesOnNoMatch, ...gitOptions } = cwdOrOptions);\n }\n gitOptions.throwOnError ??= true;\n\n const targetBranch = target || getDefaultRemoteBranch(gitOptions);\n\n return getChangedPackagesBetweenRefs({\n fromRef: targetBranch,\n ...gitOptions,\n ignoreGlobs,\n returnAllPackagesOnNoMatch,\n });\n}\n"],"names":["getChangedPackages","getChangedPackagesBetweenRefs","paramsOrCwd","_fromRef","_toRef","_ignoreGlobs","_returnAllPackagesOnNoMatch","gitOptions","params","cwd","fromRef","toRef","ignoreGlobs","returnAllPackagesOnNoMatch","throwOnError","changes","Set","getUntrackedChanges","getUnstagedChanges","getChangesBetweenRefs","getStagedChanges","getPackagesByFiles","root","files","cwdOrOptions","target","targetBranch","getDefaultRemoteBranch"],"mappings":";;;;;;;;;;;QAgIgBA;eAAAA;;QAvEAC;eAAAA;;;qBAnDT;oCAE4B;AAiD5B,SAASA,8BACdC,WAA0D,EAC1DC,QAAiB,EACjBC,MAAe,EACfC,YAAuB,EACvBC,2BAAqC;QAarCC;IAXA,MAAMC,SACJ,OAAON,gBAAgB,WACnB;QACEO,KAAKP;QACLQ,SAASP;QACTQ,OAAOP;QACPQ,aAAaP;QACbQ,4BAA4BP;IAC9B,IACAJ;IACN,MAAM,EAAEQ,OAAO,EAAEC,KAAK,EAAEC,WAAW,EAAEC,6BAA6B,IAAI,EAAE,GAAGN,YAAY,GAAGC;IAC1FD,CAAAA,cAAAA,YAAWO,YAAY,KAAvBP,YAAWO,YAAY,GAAK;IAE5B,MAAMC,UAAU;WACX,IAAIC,IAAI;eACNC,IAAAA,wBAAmB,EAACV;eACpBW,IAAAA,uBAAkB,EAACX;eACnBY,IAAAA,0BAAqB,EAAC;gBAAET;gBAASC;gBAAO,GAAGJ,UAAU;YAAC;eACtDa,IAAAA,qBAAgB,EAACb;SACrB;KACF;IAED,OAAOc,IAAAA,sCAAkB,EAAC;QACxBC,MAAMf,WAAWE,GAAG;QACpBc,OAAOR;QACPH;QACAC;IACF;AACF;AAoCO,SAASb,mBACdwB,YAAgD,EAChDC,MAAe,EACfb,WAAsB,EACtBC,0BAAoC;QAQpCN;IANA,IAAIA;IACJ,IAAI,OAAOiB,iBAAiB,UAAU;QACpCjB,aAAa;YAAEE,KAAKe;QAAa;IACnC,OAAO;QACJ,CAAA,EAAEC,MAAM,EAAEb,WAAW,EAAEC,0BAA0B,EAAE,GAAGN,YAAY,GAAGiB,YAAW;IACnF;IACAjB,CAAAA,cAAAA,YAAWO,YAAY,KAAvBP,YAAWO,YAAY,GAAK;IAE5B,MAAMY,eAAeD,UAAUE,IAAAA,2BAAsB,EAACpB;IAEtD,OAAON,8BAA8B;QACnCS,SAASgB;QACT,GAAGnB,UAAU;QACbK;QACAC;IACF;AACF"}
|