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
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "pnpmUtilities", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return pnpmUtilities;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
12
|
+
const _readYaml = require("../../lockfile/readYaml.js");
|
|
13
|
+
const _getWorkspaceManagerAndRoot = require("./getWorkspaceManagerAndRoot.js");
|
|
14
|
+
function _interop_require_default(obj) {
|
|
15
|
+
return obj && obj.__esModule ? obj : {
|
|
16
|
+
default: obj
|
|
17
|
+
};
|
|
18
|
+
}
|
|
10
19
|
function getPnpmWorkspaceYaml(params) {
|
|
11
|
-
const pnpmWorkspacesFile =
|
|
12
|
-
return (0,
|
|
20
|
+
const pnpmWorkspacesFile = _path.default.join(params.root, _getWorkspaceManagerAndRoot.managerFiles.pnpm);
|
|
21
|
+
return (0, _readYaml.readYaml)(pnpmWorkspacesFile);
|
|
13
22
|
}
|
|
14
|
-
|
|
15
|
-
getWorkspacePatterns: (params)
|
|
23
|
+
const pnpmUtilities = {
|
|
24
|
+
getWorkspacePatterns: (params)=>{
|
|
16
25
|
const { packages } = getPnpmWorkspaceYaml(params);
|
|
17
|
-
return packages ? {
|
|
26
|
+
return packages ? {
|
|
27
|
+
patterns: packages,
|
|
28
|
+
type: "pattern"
|
|
29
|
+
} : undefined;
|
|
18
30
|
},
|
|
19
31
|
// See https://pnpm.io/catalogs
|
|
20
|
-
getCatalogs: (params)
|
|
32
|
+
getCatalogs: (params)=>{
|
|
21
33
|
const workspaceYaml = getPnpmWorkspaceYaml(params);
|
|
22
34
|
if (!workspaceYaml.catalog && !workspaceYaml.catalogs) {
|
|
23
35
|
return undefined;
|
|
@@ -27,8 +39,7 @@ exports.pnpmUtilities = {
|
|
|
27
39
|
const { default: namedDefaultCatalog, ...namedCatalogs } = workspaceYaml.catalogs || {};
|
|
28
40
|
return {
|
|
29
41
|
default: workspaceYaml.catalog || namedDefaultCatalog,
|
|
30
|
-
named: Object.keys(namedCatalogs).length ? namedCatalogs : undefined
|
|
42
|
+
named: Object.keys(namedCatalogs).length ? namedCatalogs : undefined
|
|
31
43
|
};
|
|
32
|
-
}
|
|
44
|
+
}
|
|
33
45
|
};
|
|
34
|
-
//# sourceMappingURL=pnpm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/workspaces/implementations/pnpm.ts"],"sourcesContent":["import path from \"path\";\nimport { readYaml } from \"../../lockfile/readYaml.js\";\nimport type { Catalog, NamedCatalogs } from \"../../types/Catalogs.js\";\nimport { managerFiles } from \"./getWorkspaceManagerAndRoot.js\";\nimport type { WorkspaceUtilities } from \"./WorkspaceUtilities.js\";\n\ntype PnpmWorkspaceYaml = {\n packages: string[];\n // Format per https://pnpm.io/catalogs\n catalog?: Catalog;\n catalogs?: NamedCatalogs;\n};\n\nfunction getPnpmWorkspaceYaml(params: { root: string }) {\n const pnpmWorkspacesFile = path.join(params.root, managerFiles.pnpm);\n return readYaml<PnpmWorkspaceYaml>(pnpmWorkspacesFile);\n}\n\nexport const pnpmUtilities: WorkspaceUtilities = {\n getWorkspacePatterns: (params) => {\n const { packages } = getPnpmWorkspaceYaml(params);\n return packages ? { patterns: packages, type: \"pattern\" } : undefined;\n },\n\n // See https://pnpm.io/catalogs\n getCatalogs: (params) => {\n const workspaceYaml = getPnpmWorkspaceYaml(params);\n if (!workspaceYaml.catalog && !workspaceYaml.catalogs) {\n return undefined;\n }\n // pnpm treats catalog: and catalog:default as the same (and errors if both are defined),\n // so treat the catalog named \"default\" as the default if present.\n const { default: namedDefaultCatalog, ...namedCatalogs } = workspaceYaml.catalogs || {};\n return {\n default: workspaceYaml.catalog || namedDefaultCatalog,\n named: Object.keys(namedCatalogs).length ? namedCatalogs : undefined,\n };\n },\n};\n"],"names":["pnpmUtilities","getPnpmWorkspaceYaml","params","pnpmWorkspacesFile","path","join","root","managerFiles","pnpm","readYaml","getWorkspacePatterns","packages","patterns","type","undefined","getCatalogs","workspaceYaml","catalog","catalogs","default","namedDefaultCatalog","namedCatalogs","named","Object","keys","length"],"mappings":";;;;+BAkBaA;;;eAAAA;;;6DAlBI;0BACQ;4CAEI;;;;;;AAU7B,SAASC,qBAAqBC,MAAwB;IACpD,MAAMC,qBAAqBC,aAAI,CAACC,IAAI,CAACH,OAAOI,IAAI,EAAEC,wCAAY,CAACC,IAAI;IACnE,OAAOC,IAAAA,kBAAQ,EAAoBN;AACrC;AAEO,MAAMH,gBAAoC;IAC/CU,sBAAsB,CAACR;QACrB,MAAM,EAAES,QAAQ,EAAE,GAAGV,qBAAqBC;QAC1C,OAAOS,WAAW;YAAEC,UAAUD;YAAUE,MAAM;QAAU,IAAIC;IAC9D;IAEA,+BAA+B;IAC/BC,aAAa,CAACb;QACZ,MAAMc,gBAAgBf,qBAAqBC;QAC3C,IAAI,CAACc,cAAcC,OAAO,IAAI,CAACD,cAAcE,QAAQ,EAAE;YACrD,OAAOJ;QACT;QACA,yFAAyF;QACzF,kEAAkE;QAClE,MAAM,EAAEK,SAASC,mBAAmB,EAAE,GAAGC,eAAe,GAAGL,cAAcE,QAAQ,IAAI,CAAC;QACtF,OAAO;YACLC,SAASH,cAAcC,OAAO,IAAIG;YAClCE,OAAOC,OAAOC,IAAI,CAACH,eAAeI,MAAM,GAAGJ,gBAAgBP;QAC7D;IACF;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { WorkspaceUtilities } from "./WorkspaceUtilities";
|
|
1
|
+
import type { WorkspaceUtilities } from "./WorkspaceUtilities.js";
|
|
2
2
|
export declare const rushUtilities: WorkspaceUtilities;
|
|
@@ -1,19 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "rushUtilities", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return rushUtilities;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
|
+
const _jju = /*#__PURE__*/ _interop_require_default(require("jju"));
|
|
13
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
14
|
+
const _getWorkspaceManagerAndRoot = require("./getWorkspaceManagerAndRoot.js");
|
|
15
|
+
function _interop_require_default(obj) {
|
|
16
|
+
return obj && obj.__esModule ? obj : {
|
|
17
|
+
default: obj
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const rushUtilities = {
|
|
21
|
+
getWorkspacePatterns: ({ root })=>{
|
|
22
|
+
const rushConfig = _jju.default.parse(_fs.default.readFileSync(_path.default.join(root, _getWorkspaceManagerAndRoot.managerFiles.rush), "utf-8"));
|
|
14
23
|
// The rush config "projects" are single folder paths
|
|
15
|
-
const patterns = rushConfig.projects.map((p)
|
|
16
|
-
return {
|
|
17
|
-
|
|
24
|
+
const patterns = rushConfig.projects.map((p)=>p.projectFolder);
|
|
25
|
+
return {
|
|
26
|
+
patterns,
|
|
27
|
+
type: "path"
|
|
28
|
+
};
|
|
29
|
+
}
|
|
18
30
|
};
|
|
19
|
-
//# sourceMappingURL=rush.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/workspaces/implementations/rush.ts"],"sourcesContent":["import fs from \"fs\";\nimport jju from \"jju\";\nimport path from \"path\";\nimport { managerFiles } from \"./getWorkspaceManagerAndRoot.js\";\nimport type { WorkspaceUtilities } from \"./WorkspaceUtilities.js\";\n\nexport const rushUtilities: WorkspaceUtilities = {\n getWorkspacePatterns: ({ root }) => {\n const rushConfig = jju.parse(fs.readFileSync(path.join(root, managerFiles.rush), \"utf-8\")) as {\n projects: Array<{ projectFolder: string }>;\n };\n // The rush config \"projects\" are single folder paths\n const patterns = rushConfig.projects.map((p) => p.projectFolder);\n return { patterns, type: \"path\" };\n },\n};\n"],"names":["rushUtilities","getWorkspacePatterns","root","rushConfig","jju","parse","fs","readFileSync","path","join","managerFiles","rush","patterns","projects","map","p","projectFolder","type"],"mappings":";;;;+BAMaA;;;eAAAA;;;2DANE;4DACC;6DACC;4CACY;;;;;;AAGtB,MAAMA,gBAAoC;IAC/CC,sBAAsB,CAAC,EAAEC,IAAI,EAAE;QAC7B,MAAMC,aAAaC,YAAG,CAACC,KAAK,CAACC,WAAE,CAACC,YAAY,CAACC,aAAI,CAACC,IAAI,CAACP,MAAMQ,wCAAY,CAACC,IAAI,GAAG;QAGjF,qDAAqD;QACrD,MAAMC,WAAWT,WAAWU,QAAQ,CAACC,GAAG,CAAC,CAACC,IAAMA,EAAEC,aAAa;QAC/D,OAAO;YAAEJ;YAAUK,MAAM;QAAO;IAClC;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { WorkspaceUtilities } from "./WorkspaceUtilities";
|
|
1
|
+
import type { WorkspaceUtilities } from "./WorkspaceUtilities.js";
|
|
2
2
|
export declare const yarnUtilities: WorkspaceUtilities;
|
|
@@ -1,41 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "yarnUtilities", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return yarnUtilities;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
|
+
const _getPackageInfo = require("../../getPackageInfo.js");
|
|
14
|
+
const _readYaml = require("../../lockfile/readYaml.js");
|
|
15
|
+
const _getPackageJsonWorkspacePatterns = require("./getPackageJsonWorkspacePatterns.js");
|
|
16
|
+
function _interop_require_default(obj) {
|
|
17
|
+
return obj && obj.__esModule ? obj : {
|
|
18
|
+
default: obj
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const yarnUtilities = {
|
|
22
|
+
getWorkspacePatterns: _getPackageJsonWorkspacePatterns.getPackageJsonWorkspacePatterns,
|
|
14
23
|
// See https://yarnpkg.com/features/catalogs
|
|
15
|
-
getCatalogs: ({ root })
|
|
16
|
-
const yarnrcYmlPath =
|
|
17
|
-
if (
|
|
18
|
-
const yarnrcYml = (0,
|
|
24
|
+
getCatalogs: ({ root })=>{
|
|
25
|
+
const yarnrcYmlPath = _path.default.join(root, ".yarnrc.yml");
|
|
26
|
+
if (_fs.default.existsSync(yarnrcYmlPath)) {
|
|
27
|
+
const yarnrcYml = (0, _readYaml.readYaml)(yarnrcYmlPath);
|
|
19
28
|
if (yarnrcYml?.catalog || yarnrcYml?.catalogs) {
|
|
20
29
|
// Yarn v4+ format
|
|
21
|
-
return {
|
|
30
|
+
return {
|
|
31
|
+
default: yarnrcYml.catalog,
|
|
32
|
+
named: yarnrcYml.catalogs
|
|
33
|
+
};
|
|
22
34
|
}
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
35
|
+
} else {
|
|
25
36
|
// Check for midgard-yarn-strict definition of catalogs in package.json
|
|
26
|
-
const workspaceSettings = (0,
|
|
27
|
-
if (workspaceSettings &&
|
|
28
|
-
!Array.isArray(workspaceSettings) &&
|
|
29
|
-
(workspaceSettings?.catalog || workspaceSettings?.catalogs)) {
|
|
37
|
+
const workspaceSettings = (0, _getPackageInfo.getPackageInfo)(root)?.workspaces;
|
|
38
|
+
if (workspaceSettings && !Array.isArray(workspaceSettings) && (workspaceSettings?.catalog || workspaceSettings?.catalogs)) {
|
|
30
39
|
// This probably handles a catalog named "default" as the default catalog
|
|
31
40
|
const { default: namedDefaultCatalog, ...namedCatalogs } = workspaceSettings.catalogs || {};
|
|
32
41
|
return {
|
|
33
42
|
default: workspaceSettings.catalog || namedDefaultCatalog,
|
|
34
|
-
named: Object.keys(namedCatalogs).length ? namedCatalogs : undefined
|
|
43
|
+
named: Object.keys(namedCatalogs).length ? namedCatalogs : undefined
|
|
35
44
|
};
|
|
36
45
|
}
|
|
37
46
|
}
|
|
38
47
|
return undefined;
|
|
39
|
-
}
|
|
48
|
+
}
|
|
40
49
|
};
|
|
41
|
-
//# sourceMappingURL=yarn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/workspaces/implementations/yarn.ts"],"sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport { getPackageInfo } from \"../../getPackageInfo.js\";\nimport type { Catalog, NamedCatalogs } from \"../../types/Catalogs.js\";\nimport { readYaml } from \"../../lockfile/readYaml.js\";\nimport type { WorkspaceUtilities } from \"./WorkspaceUtilities.js\";\nimport { getPackageJsonWorkspacePatterns } from \"./getPackageJsonWorkspacePatterns.js\";\n\nexport const yarnUtilities: WorkspaceUtilities = {\n getWorkspacePatterns: getPackageJsonWorkspacePatterns,\n\n // See https://yarnpkg.com/features/catalogs\n getCatalogs: ({ root }) => {\n const yarnrcYmlPath = path.join(root, \".yarnrc.yml\");\n if (fs.existsSync(yarnrcYmlPath)) {\n const yarnrcYml = readYaml<{ catalog?: Catalog; catalogs?: NamedCatalogs }>(yarnrcYmlPath);\n if (yarnrcYml?.catalog || yarnrcYml?.catalogs) {\n // Yarn v4+ format\n return { default: yarnrcYml.catalog, named: yarnrcYml.catalogs };\n }\n } else {\n // Check for midgard-yarn-strict definition of catalogs in package.json\n const workspaceSettings = getPackageInfo(root)?.workspaces;\n if (\n workspaceSettings &&\n !Array.isArray(workspaceSettings) &&\n (workspaceSettings?.catalog || workspaceSettings?.catalogs)\n ) {\n // This probably handles a catalog named \"default\" as the default catalog\n const { default: namedDefaultCatalog, ...namedCatalogs } = workspaceSettings.catalogs || {};\n return {\n default: workspaceSettings.catalog || namedDefaultCatalog,\n named: Object.keys(namedCatalogs).length ? namedCatalogs : undefined,\n };\n }\n }\n return undefined;\n },\n};\n"],"names":["yarnUtilities","getWorkspacePatterns","getPackageJsonWorkspacePatterns","getCatalogs","root","yarnrcYmlPath","path","join","fs","existsSync","yarnrcYml","readYaml","catalog","catalogs","default","named","workspaceSettings","getPackageInfo","workspaces","Array","isArray","namedDefaultCatalog","namedCatalogs","Object","keys","length","undefined"],"mappings":";;;;+BAQaA;;;eAAAA;;;2DARE;6DACE;gCACc;0BAEN;iDAEuB;;;;;;AAEzC,MAAMA,gBAAoC;IAC/CC,sBAAsBC,gEAA+B;IAErD,4CAA4C;IAC5CC,aAAa,CAAC,EAAEC,IAAI,EAAE;QACpB,MAAMC,gBAAgBC,aAAI,CAACC,IAAI,CAACH,MAAM;QACtC,IAAII,WAAE,CAACC,UAAU,CAACJ,gBAAgB;YAChC,MAAMK,YAAYC,IAAAA,kBAAQ,EAAkDN;YAC5E,IAAIK,WAAWE,WAAWF,WAAWG,UAAU;gBAC7C,kBAAkB;gBAClB,OAAO;oBAAEC,SAASJ,UAAUE,OAAO;oBAAEG,OAAOL,UAAUG,QAAQ;gBAAC;YACjE;QACF,OAAO;YACL,uEAAuE;YACvE,MAAMG,oBAAoBC,IAAAA,8BAAc,EAACb,OAAOc;YAChD,IACEF,qBACA,CAACG,MAAMC,OAAO,CAACJ,sBACdA,CAAAA,mBAAmBJ,WAAWI,mBAAmBH,QAAO,GACzD;gBACA,yEAAyE;gBACzE,MAAM,EAAEC,SAASO,mBAAmB,EAAE,GAAGC,eAAe,GAAGN,kBAAkBH,QAAQ,IAAI,CAAC;gBAC1F,OAAO;oBACLC,SAASE,kBAAkBJ,OAAO,IAAIS;oBACtCN,OAAOQ,OAAOC,IAAI,CAACF,eAAeG,MAAM,GAAGH,gBAAgBI;gBAC7D;YACF;QACF;QACA,OAAOA;IACT;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WorkspaceManager } from "../types/WorkspaceManager";
|
|
1
|
+
import type { WorkspaceManager } from "../types/WorkspaceManager.js";
|
|
2
2
|
import { type WorkspaceManagerAndRoot } from "./implementations";
|
|
3
3
|
interface WrappedUtilityParams {
|
|
4
4
|
/** Search for the root from here */
|
|
@@ -1,49 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 wrapAsyncWorkspaceUtility () {
|
|
13
|
+
return wrapAsyncWorkspaceUtility;
|
|
14
|
+
},
|
|
15
|
+
get wrapWorkspaceUtility () {
|
|
16
|
+
return wrapWorkspaceUtility;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _logging = require("../logging.js");
|
|
20
|
+
const _implementations = require("./implementations");
|
|
12
21
|
function wrapWorkspaceUtility(params) {
|
|
13
22
|
const { cwd, description, impl } = params;
|
|
14
23
|
let managerInfo;
|
|
15
24
|
try {
|
|
16
|
-
managerInfo = (0,
|
|
25
|
+
managerInfo = (0, _implementations.getWorkspaceManagerAndRoot)(cwd, undefined, params.managerOverride);
|
|
17
26
|
if (managerInfo) {
|
|
18
27
|
return impl(managerInfo);
|
|
19
28
|
}
|
|
20
|
-
}
|
|
21
|
-
catch (err) {
|
|
29
|
+
} catch (err) {
|
|
22
30
|
const manager = params.managerOverride || managerInfo?.manager || "unknown manager";
|
|
23
|
-
(0,
|
|
31
|
+
(0, _logging.logVerboseWarning)(`Error getting ${manager} ${description} for ${cwd}:`, err);
|
|
24
32
|
}
|
|
25
33
|
}
|
|
26
|
-
exports.wrapWorkspaceUtility = wrapWorkspaceUtility;
|
|
27
|
-
/**
|
|
28
|
-
* Wrap a workspace utility function with common error handling and messaging.
|
|
29
|
-
* Also handle getting the manager and root.
|
|
30
|
-
*
|
|
31
|
-
* @returns The utility's return value, or undefined on error (will verbose log on error)
|
|
32
|
-
*/
|
|
33
34
|
async function wrapAsyncWorkspaceUtility(params) {
|
|
34
35
|
const { cwd, description, impl } = params;
|
|
35
36
|
let managerInfo;
|
|
36
37
|
try {
|
|
37
|
-
managerInfo = (0,
|
|
38
|
+
managerInfo = (0, _implementations.getWorkspaceManagerAndRoot)(cwd, undefined, params.managerOverride);
|
|
38
39
|
if (managerInfo) {
|
|
39
40
|
return await impl(managerInfo);
|
|
40
41
|
}
|
|
41
|
-
}
|
|
42
|
-
catch (err) {
|
|
42
|
+
} catch (err) {
|
|
43
43
|
const manager = params.managerOverride || managerInfo?.manager || "unknown manager";
|
|
44
|
-
(0,
|
|
44
|
+
(0, _logging.logVerboseWarning)(`Error getting ${manager} ${description} for ${cwd}:`, err);
|
|
45
45
|
}
|
|
46
46
|
return undefined;
|
|
47
47
|
}
|
|
48
|
-
exports.wrapAsyncWorkspaceUtility = wrapAsyncWorkspaceUtility;
|
|
49
|
-
//# sourceMappingURL=wrapWorkspaceUtility.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/workspaces/wrapWorkspaceUtility.ts"],"sourcesContent":["import { logVerboseWarning } from \"../logging.js\";\nimport type { WorkspaceManager } from \"../types/WorkspaceManager.js\";\nimport { getWorkspaceManagerAndRoot, type WorkspaceManagerAndRoot } from \"./implementations\";\n\ninterface WrappedUtilityParams {\n /** Search for the root from here */\n cwd: string;\n /** Optional manager to use instead of auto-detecting */\n managerOverride: WorkspaceManager | undefined;\n /** What the utility is getting (for logging) */\n description: string;\n}\n\n/**\n * Wrap a workspace utility function with common error handling and messaging.\n * Also handle getting the manager and root.\n *\n * @returns The utility's return value, or undefined on error (will verbose log on error)\n */\nexport function wrapWorkspaceUtility<TReturn>(\n params: WrappedUtilityParams & {\n /** Implementation of the utility, which receives the detected manager and root */\n impl: (params: WorkspaceManagerAndRoot) => TReturn | undefined;\n }\n): TReturn | undefined {\n const { cwd, description, impl } = params;\n let managerInfo: WorkspaceManagerAndRoot | undefined;\n try {\n managerInfo = getWorkspaceManagerAndRoot(cwd, undefined, params.managerOverride);\n if (managerInfo) {\n return impl(managerInfo);\n }\n } catch (err) {\n const manager = params.managerOverride || managerInfo?.manager || \"unknown manager\";\n logVerboseWarning(`Error getting ${manager} ${description} for ${cwd}:`, err);\n }\n}\n\n/**\n * Wrap a workspace utility function with common error handling and messaging.\n * Also handle getting the manager and root.\n *\n * @returns The utility's return value, or undefined on error (will verbose log on error)\n */\nexport async function wrapAsyncWorkspaceUtility<TReturn>(\n params: WrappedUtilityParams & {\n /** Implementation of the utility, which receives the detected manager and root */\n impl: (params: WorkspaceManagerAndRoot) => Promise<TReturn | undefined>;\n }\n): Promise<TReturn | undefined> {\n const { cwd, description, impl } = params;\n let managerInfo: WorkspaceManagerAndRoot | undefined;\n try {\n managerInfo = getWorkspaceManagerAndRoot(cwd, undefined, params.managerOverride);\n if (managerInfo) {\n return await impl(managerInfo);\n }\n } catch (err) {\n const manager = params.managerOverride || managerInfo?.manager || \"unknown manager\";\n logVerboseWarning(`Error getting ${manager} ${description} for ${cwd}:`, err);\n }\n return undefined;\n}\n"],"names":["wrapAsyncWorkspaceUtility","wrapWorkspaceUtility","params","cwd","description","impl","managerInfo","getWorkspaceManagerAndRoot","undefined","managerOverride","err","manager","logVerboseWarning"],"mappings":";;;;;;;;;;;QA4CsBA;eAAAA;;QAzBNC;eAAAA;;;yBAnBkB;iCAEuC;AAiBlE,SAASA,qBACdC,MAGC;IAED,MAAM,EAAEC,GAAG,EAAEC,WAAW,EAAEC,IAAI,EAAE,GAAGH;IACnC,IAAII;IACJ,IAAI;QACFA,cAAcC,IAAAA,2CAA0B,EAACJ,KAAKK,WAAWN,OAAOO,eAAe;QAC/E,IAAIH,aAAa;YACf,OAAOD,KAAKC;QACd;IACF,EAAE,OAAOI,KAAK;QACZ,MAAMC,UAAUT,OAAOO,eAAe,IAAIH,aAAaK,WAAW;QAClEC,IAAAA,0BAAiB,EAAC,CAAC,cAAc,EAAED,QAAQ,CAAC,EAAEP,YAAY,KAAK,EAAED,IAAI,CAAC,CAAC,EAAEO;IAC3E;AACF;AAQO,eAAeV,0BACpBE,MAGC;IAED,MAAM,EAAEC,GAAG,EAAEC,WAAW,EAAEC,IAAI,EAAE,GAAGH;IACnC,IAAII;IACJ,IAAI;QACFA,cAAcC,IAAAA,2CAA0B,EAACJ,KAAKK,WAAWN,OAAOO,eAAe;QAC/E,IAAIH,aAAa;YACf,OAAO,MAAMD,KAAKC;QACpB;IACF,EAAE,OAAOI,KAAK;QACZ,MAAMC,UAAUT,OAAOO,eAAe,IAAIH,aAAaK,WAAW;QAClEC,IAAAA,0BAAiB,EAAC,CAAC,cAAc,EAAED,QAAQ,CAAC,EAAEP,YAAY,KAAK,EAAED,IAAI,CAAC,CAAC,EAAEO;IAC3E;IACA,OAAOF;AACT"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "workspace-tools",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://github.com/microsoft/
|
|
7
|
+
"url": "https://github.com/microsoft/lage",
|
|
8
|
+
"directory": "packages/workspace-tools"
|
|
8
9
|
},
|
|
9
10
|
"main": "lib/index.js",
|
|
10
11
|
"types": "lib/index.d.ts",
|
|
@@ -13,21 +14,29 @@
|
|
|
13
14
|
"lib/!(__*)/**/*"
|
|
14
15
|
],
|
|
15
16
|
"scripts": {
|
|
16
|
-
"api": "
|
|
17
|
-
"build": "
|
|
18
|
-
"
|
|
19
|
-
"
|
|
17
|
+
"api": "monorepo-scripts api",
|
|
18
|
+
"build": "yarn types && yarn transpile",
|
|
19
|
+
"transpile": "monorepo-scripts transpile",
|
|
20
|
+
"types": "yarn run -T tsc",
|
|
21
|
+
"test": "yarn run -T jest",
|
|
22
|
+
"lint": "monorepo-scripts lint"
|
|
20
23
|
},
|
|
21
24
|
"dependencies": {
|
|
22
25
|
"@yarnpkg/lockfile": "^1.1.0",
|
|
23
|
-
"fast-glob": "^3.3.
|
|
24
|
-
"git-url-parse": "^16.
|
|
25
|
-
"globby": "^11.0.0",
|
|
26
|
+
"fast-glob": "^3.3.3",
|
|
27
|
+
"git-url-parse": "^16.1.0",
|
|
26
28
|
"jju": "^1.4.0",
|
|
27
|
-
"js-yaml": "^4.1.
|
|
28
|
-
"micromatch": "^4.0.
|
|
29
|
+
"js-yaml": "^4.1.1",
|
|
30
|
+
"micromatch": "^4.0.8"
|
|
29
31
|
},
|
|
30
32
|
"devDependencies": {
|
|
31
|
-
"@
|
|
33
|
+
"@lage-run/monorepo-scripts": "^1.0.0",
|
|
34
|
+
"@lage-run/test-utilities": "^0.1.0",
|
|
35
|
+
"@types/git-url-parse": "^16.0.0",
|
|
36
|
+
"@types/jju": "^1.4.2",
|
|
37
|
+
"@types/js-yaml": "^4.0.5",
|
|
38
|
+
"@types/micromatch": "^4.0.0",
|
|
39
|
+
"@types/yarnpkg__lockfile": "^1.1.5",
|
|
40
|
+
"ts-dedent": "^2.2.0"
|
|
32
41
|
}
|
|
33
42
|
}
|
package/lib/lockfile/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ParsedLock } from "./types";
|
|
2
|
-
import { nameAtVersion } from "./nameAtVersion";
|
|
3
|
-
export declare function parseLockFile(packageRoot: string): Promise<ParsedLock>;
|
|
4
|
-
export { nameAtVersion };
|
|
5
|
-
export { queryLockFile } from "./queryLockFile";
|
|
6
|
-
export * from "./types";
|
package/lib/lockfile/index.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
-
};
|
|
28
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
-
};
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.queryLockFile = exports.nameAtVersion = exports.parseLockFile = void 0;
|
|
33
|
-
// NOTE: never place the import of lockfile implementation here, as it slows down the library as a whole
|
|
34
|
-
const fs_1 = __importDefault(require("fs"));
|
|
35
|
-
const path_1 = __importDefault(require("path"));
|
|
36
|
-
const nameAtVersion_1 = require("./nameAtVersion");
|
|
37
|
-
Object.defineProperty(exports, "nameAtVersion", { enumerable: true, get: function () { return nameAtVersion_1.nameAtVersion; } });
|
|
38
|
-
const paths_1 = require("../paths");
|
|
39
|
-
const parsePnpmLock_1 = require("./parsePnpmLock");
|
|
40
|
-
const parseNpmLock_1 = require("./parseNpmLock");
|
|
41
|
-
const readYaml_1 = require("./readYaml");
|
|
42
|
-
const parseBerryLock_1 = require("./parseBerryLock");
|
|
43
|
-
const memoization = {};
|
|
44
|
-
async function parseLockFile(packageRoot) {
|
|
45
|
-
const yarnLockPath = (0, paths_1.searchUp)(["yarn.lock", "common/config/rush/yarn.lock"], packageRoot);
|
|
46
|
-
// First, test out whether this works for yarn
|
|
47
|
-
if (yarnLockPath) {
|
|
48
|
-
if (memoization[yarnLockPath]) {
|
|
49
|
-
return memoization[yarnLockPath];
|
|
50
|
-
}
|
|
51
|
-
const yarnLock = fs_1.default.readFileSync(yarnLockPath, "utf-8");
|
|
52
|
-
const isBerry = yarnLock.includes("__metadata") || fs_1.default.existsSync(path_1.default.resolve(yarnLock.replace("yarn.lock", ".yarnrc.yml")));
|
|
53
|
-
let parsed = {
|
|
54
|
-
type: "success",
|
|
55
|
-
object: {},
|
|
56
|
-
};
|
|
57
|
-
if (isBerry) {
|
|
58
|
-
const yaml = (0, readYaml_1.readYaml)(yarnLockPath);
|
|
59
|
-
parsed = (0, parseBerryLock_1.parseBerryLock)(yaml);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
const parseYarnLock = (await Promise.resolve().then(() => __importStar(require("@yarnpkg/lockfile")))).parse;
|
|
63
|
-
parsed = parseYarnLock(yarnLock);
|
|
64
|
-
}
|
|
65
|
-
memoization[yarnLockPath] = parsed;
|
|
66
|
-
return parsed;
|
|
67
|
-
}
|
|
68
|
-
// Second, test out whether this works for pnpm
|
|
69
|
-
let pnpmLockPath = (0, paths_1.searchUp)(["pnpm-lock.yaml", "common/config/rush/pnpm-lock.yaml"], packageRoot);
|
|
70
|
-
if (pnpmLockPath) {
|
|
71
|
-
if (memoization[pnpmLockPath]) {
|
|
72
|
-
return memoization[pnpmLockPath];
|
|
73
|
-
}
|
|
74
|
-
const yaml = (0, readYaml_1.readYaml)(pnpmLockPath);
|
|
75
|
-
const parsed = (0, parsePnpmLock_1.parsePnpmLock)(yaml);
|
|
76
|
-
memoization[pnpmLockPath] = parsed;
|
|
77
|
-
return memoization[pnpmLockPath];
|
|
78
|
-
}
|
|
79
|
-
// Third, try for npm workspaces
|
|
80
|
-
let npmLockPath = (0, paths_1.searchUp)("package-lock.json", packageRoot);
|
|
81
|
-
if (npmLockPath) {
|
|
82
|
-
if (memoization[npmLockPath]) {
|
|
83
|
-
return memoization[npmLockPath];
|
|
84
|
-
}
|
|
85
|
-
let npmLockJson;
|
|
86
|
-
try {
|
|
87
|
-
npmLockJson = fs_1.default.readFileSync(npmLockPath, "utf-8");
|
|
88
|
-
}
|
|
89
|
-
catch {
|
|
90
|
-
throw new Error("Couldn't read package-lock.json");
|
|
91
|
-
}
|
|
92
|
-
const npmLock = JSON.parse(npmLockJson.toString());
|
|
93
|
-
if (!npmLock?.lockfileVersion || npmLock.lockfileVersion < 2) {
|
|
94
|
-
throw new Error(`Your package-lock.json version is not supported: lockfileVersion is ${npmLock.lockfileVersion}. You need npm version 7 or above and package-lock version 2 or above. Please, upgrade npm or choose a different package manager.`);
|
|
95
|
-
}
|
|
96
|
-
memoization[npmLockPath] = (0, parseNpmLock_1.parseNpmLock)(npmLock);
|
|
97
|
-
return memoization[npmLockPath];
|
|
98
|
-
}
|
|
99
|
-
throw new Error("You do not have yarn.lock, pnpm-lock.yaml or package-lock.json. Please use one of these package managers.");
|
|
100
|
-
}
|
|
101
|
-
exports.parseLockFile = parseLockFile;
|
|
102
|
-
var queryLockFile_1 = require("./queryLockFile");
|
|
103
|
-
Object.defineProperty(exports, "queryLockFile", { enumerable: true, get: function () { return queryLockFile_1.queryLockFile; } });
|
|
104
|
-
__exportStar(require("./types"), exports);
|
|
105
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lockfile/index.ts"],"names":[],"mappings":"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"}
|