@rushstack/lockfile-explorer 1.8.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +17 -0
- package/CHANGELOG.md +12 -1
- package/build/lfx-shared/IJsonLfxGraph.d.ts +4 -3
- package/build/lfx-shared/IJsonLfxGraph.js.map +1 -1
- package/build/lfx-shared/LfxGraph.d.ts +49 -16
- package/build/lfx-shared/LfxGraph.js +5 -10
- package/build/lfx-shared/LfxGraph.js.map +1 -1
- package/build/lfx-shared/lfxGraphSerializer.js +8 -6
- package/build/lfx-shared/lfxGraphSerializer.js.map +1 -1
- package/dist/{app.22259b754540a899e03d.js → app.9d79482549580f813d48.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/rush-themed-ui.js +1 -1
- package/lib/cli/explorer/ExplorerCommandLineParser.d.ts.map +1 -1
- package/lib/cli/explorer/ExplorerCommandLineParser.js +3 -3
- package/lib/cli/explorer/ExplorerCommandLineParser.js.map +1 -1
- package/lib/cli/lint/LintCommandLineParser.d.ts.map +1 -1
- package/lib/cli/lint/LintCommandLineParser.js +1 -1
- package/lib/cli/lint/LintCommandLineParser.js.map +1 -1
- package/lib/cli/lint/actions/CheckAction.d.ts.map +1 -1
- package/lib/cli/lint/actions/CheckAction.js +6 -6
- package/lib/cli/lint/actions/CheckAction.js.map +1 -1
- package/lib/cli/lint/actions/InitAction.d.ts.map +1 -1
- package/lib/cli/lint/actions/InitAction.js +3 -3
- package/lib/cli/lint/actions/InitAction.js.map +1 -1
- package/lib/graph/PnpmfileRunner.d.ts.map +1 -1
- package/lib/graph/PnpmfileRunner.js.map +1 -1
- package/lib/graph/lfxGraphLoader.d.ts.map +1 -1
- package/lib/graph/lfxGraphLoader.js +201 -114
- package/lib/graph/lfxGraphLoader.js.map +1 -1
- package/lib/graph/pnpmfileRunnerWorkerThread.d.ts.map +1 -1
- package/lib/graph/pnpmfileRunnerWorkerThread.js.map +1 -1
- package/lib/utils/init.d.ts.map +1 -1
- package/lib/utils/init.js +7 -7
- package/lib/utils/init.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/lockfile-explorer",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "2.0.0",
|
|
6
|
+
"tag": "@rushstack/lockfile-explorer_v2.0.0",
|
|
7
|
+
"date": "Fri, 03 Oct 2025 17:28:43 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"major": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Add support for PNPM 10 lockfile format"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"patch": [
|
|
15
|
+
{
|
|
16
|
+
"comment": "Numerous improvements to the lockfile parser"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
4
21
|
{
|
|
5
22
|
"version": "1.8.1",
|
|
6
23
|
"tag": "@rushstack/lockfile-explorer_v1.8.1",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
# Change Log - @rushstack/lockfile-explorer
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 03 Oct 2025 17:28:43 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 2.0.0
|
|
6
|
+
Fri, 03 Oct 2025 17:28:43 GMT
|
|
7
|
+
|
|
8
|
+
### Breaking changes
|
|
9
|
+
|
|
10
|
+
- Add support for PNPM 10 lockfile format
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Numerous improvements to the lockfile parser
|
|
4
15
|
|
|
5
16
|
## 1.8.1
|
|
6
17
|
Tue, 30 Sep 2025 23:57:45 GMT
|
|
@@ -12,11 +12,12 @@ export interface IJsonPeerDependencyMeta {
|
|
|
12
12
|
}
|
|
13
13
|
export interface IJsonLfxDependency {
|
|
14
14
|
name: string;
|
|
15
|
-
|
|
15
|
+
versionPath: string;
|
|
16
16
|
entryId: string;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
originalSpecifier: string;
|
|
18
|
+
dependencyKind: LfxDependencyKind;
|
|
19
19
|
peerDependencyMeta: IJsonPeerDependencyMeta;
|
|
20
|
+
resolvedEntryJsonId?: number;
|
|
20
21
|
}
|
|
21
22
|
export declare enum LfxDependencyKind {
|
|
22
23
|
Regular = "regular",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IJsonLfxGraph.js","sourceRoot":"","sources":["../../../src/packlets/lfx-shared/IJsonLfxGraph.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,+DAAW,CAAA;IACX,+DAAW,CAAA;IACX,qEAAc,CAAA;IACd,yEAAgB,CAAA;AAClB,CAAC,EALW,iBAAiB,iCAAjB,iBAAiB,QAK5B;AAmBD,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,gCAAW,CAAA;IACX,kCAAa,CAAA;AACf,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { IJsonLfxWorkspace } from './IJsonLfxWorkspace';\n\nexport enum LfxGraphEntryKind {\n Project = 1,\n Package = 2,\n SideBySide = 3,\n Doppelganger = 4\n}\n\nexport interface IJsonPeerDependencyMeta {\n name?: string;\n version?: string;\n optional?: boolean;\n}\n\nexport interface IJsonLfxDependency {\n name: string;\n
|
|
1
|
+
{"version":3,"file":"IJsonLfxGraph.js","sourceRoot":"","sources":["../../../src/packlets/lfx-shared/IJsonLfxGraph.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,+DAAW,CAAA;IACX,+DAAW,CAAA;IACX,qEAAc,CAAA;IACd,yEAAgB,CAAA;AAClB,CAAC,EALW,iBAAiB,iCAAjB,iBAAiB,QAK5B;AAmBD,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,gCAAW,CAAA;IACX,kCAAa,CAAA;AACf,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { IJsonLfxWorkspace } from './IJsonLfxWorkspace';\n\nexport enum LfxGraphEntryKind {\n Project = 1,\n Package = 2,\n SideBySide = 3,\n Doppelganger = 4\n}\n\nexport interface IJsonPeerDependencyMeta {\n name?: string;\n version?: string;\n optional?: boolean;\n}\n\nexport interface IJsonLfxDependency {\n name: string;\n versionPath: string;\n entryId: string;\n originalSpecifier: string;\n dependencyKind: LfxDependencyKind;\n peerDependencyMeta: IJsonPeerDependencyMeta;\n\n resolvedEntryJsonId?: number;\n}\n\nexport enum LfxDependencyKind {\n Regular = 'regular',\n Dev = 'dev',\n Peer = 'peer'\n}\n\nexport interface IJsonLfxEntry {\n /**\n * A unique ID used when serializing graph links.\n *\n * @remarks\n * This is just the `IJsonLfxGraph.entries` array index, but debugging is easier if we include\n * it in the serialized representation.\n */\n jsonId: number;\n\n kind: LfxGraphEntryKind;\n entryId: string;\n rawEntryId: string;\n packageJsonFolderPath: string;\n entryPackageName: string;\n displayText: string;\n entryPackageVersion: string;\n entrySuffix: string;\n\n // Lists\n dependencies: IJsonLfxDependency[];\n transitivePeerDependencies: string[];\n referrerJsonIds: number[];\n}\n\nexport interface IJsonLfxGraph {\n workspace: IJsonLfxWorkspace;\n entries: IJsonLfxEntry[];\n}\n"]}
|
|
@@ -2,28 +2,56 @@ import type { LfxDependencyKind, IJsonPeerDependencyMeta, LfxGraphEntryKind } fr
|
|
|
2
2
|
import type { IJsonLfxWorkspace } from './IJsonLfxWorkspace';
|
|
3
3
|
export interface ILfxGraphDependencyOptions {
|
|
4
4
|
name: string;
|
|
5
|
-
|
|
6
|
-
dependencyType: LfxDependencyKind;
|
|
7
|
-
containingEntry: LfxGraphEntry;
|
|
8
|
-
peerDependencyMeta: IJsonPeerDependencyMeta;
|
|
5
|
+
versionPath: string;
|
|
9
6
|
entryId: string;
|
|
7
|
+
originalSpecifier: string;
|
|
8
|
+
dependencyKind: LfxDependencyKind;
|
|
9
|
+
peerDependencyMeta: IJsonPeerDependencyMeta;
|
|
10
|
+
containingEntry: LfxGraphEntry;
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
|
-
* Represents
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
* Each dependency listed under a package in the lockfile should have a separate entry. These Dependencies
|
|
16
|
-
* will link to the "containingEntry", which is the LockfileEntry that specified this dependency.
|
|
17
|
-
* The "resolvedEntry" field is the corresponding LockfileEntry for this dependency, as all dependencies also have
|
|
18
|
-
* their own entries in the pnpm lockfile.
|
|
13
|
+
* Represents an graph edge, which is an exact dependency version obtained from the lockfile.
|
|
19
14
|
*/
|
|
20
15
|
export declare class LfxGraphDependency {
|
|
16
|
+
/**
|
|
17
|
+
* The referenced package name.
|
|
18
|
+
* Example: `@scope/package-name`
|
|
19
|
+
*/
|
|
21
20
|
readonly name: string;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The lockfile's raw string that either indicates an external reference such as `link:../target-folder`,
|
|
23
|
+
* or else can be combined with the `name` field to construct an `entryId` found in the lockfile.
|
|
24
|
+
* The exact syntax varies between lockfile file format versions.
|
|
25
|
+
*
|
|
26
|
+
* Example: `link:../target-folder`
|
|
27
|
+
*
|
|
28
|
+
* Example: `1.0.0`
|
|
29
|
+
*
|
|
30
|
+
* Example: `1.0.0_@rushstack+m@1.0.0` (version 5.4)
|
|
31
|
+
* Example: `1.0.0(@rushstack/m@1.0.0)` (version 6.0 and 9.0)
|
|
32
|
+
*/
|
|
33
|
+
readonly versionPath: string;
|
|
34
|
+
/**
|
|
35
|
+
* If this dependency refers to an entry in the lockfile, this field should match a corresponding
|
|
36
|
+
* {@link LfxGraphEntry.entryId} and `resolvedEntry` will be defined (unless the loader encountered an error).
|
|
37
|
+
*
|
|
38
|
+
* For external references such as `link:../target-folder`, the `entryId` is the empty string.
|
|
39
|
+
*/
|
|
25
40
|
readonly entryId: string;
|
|
41
|
+
/**
|
|
42
|
+
* The lockfile sometimes records the original SemVer specifier that was used to choose the versionPath,
|
|
43
|
+
* usually either because it can change (e.g. a workspace project's dependencies) or because it's a peer dependency
|
|
44
|
+
* that affects graph relationships beyond the current node. If not, then `originalSpecifier` will be the
|
|
45
|
+
* empty string.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* Because this field is only available for certain dependencies, it is generally less useful than specifiers
|
|
49
|
+
* obtained from the package.json files.
|
|
50
|
+
*/
|
|
51
|
+
readonly originalSpecifier: string;
|
|
52
|
+
readonly dependencyKind: LfxDependencyKind;
|
|
26
53
|
readonly peerDependencyMeta: IJsonPeerDependencyMeta;
|
|
54
|
+
readonly containingEntry: LfxGraphEntry;
|
|
27
55
|
resolvedEntry: LfxGraphEntry | undefined;
|
|
28
56
|
constructor(options: ILfxGraphDependencyOptions);
|
|
29
57
|
}
|
|
@@ -50,13 +78,18 @@ export declare class LfxGraphEntry {
|
|
|
50
78
|
*/
|
|
51
79
|
readonly kind: LfxGraphEntryKind;
|
|
52
80
|
/**
|
|
53
|
-
* A unique
|
|
54
|
-
*
|
|
81
|
+
* A unique identifier for this lockfile entry, based on `rawEntryId` but adjusted to be unique for both
|
|
82
|
+
* project and external package entries.
|
|
55
83
|
*/
|
|
56
84
|
readonly entryId: string;
|
|
57
85
|
/**
|
|
58
86
|
* The unique identifier assigned to this project/package in the lockfile.
|
|
59
87
|
* e.g. `/@emotion/core/10.3.1_qjwx5m6wssz3lnb35xwkc3pz6q:`
|
|
88
|
+
*
|
|
89
|
+
* @remarks
|
|
90
|
+
* In the `pnpm-lock.yaml` file, "importers" (workspace projects) and "packages" (external packages)
|
|
91
|
+
* are tracked separately, so it's not required for their keys to be unique. `entryId` solves this problem
|
|
92
|
+
* by adding a `project:` prefix for importers.
|
|
60
93
|
*/
|
|
61
94
|
readonly rawEntryId: string;
|
|
62
95
|
/**
|
|
@@ -4,23 +4,18 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.LfxGraph = exports.LfxGraphEntry = exports.LfxGraphDependency = void 0;
|
|
6
6
|
/**
|
|
7
|
-
* Represents
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* Each dependency listed under a package in the lockfile should have a separate entry. These Dependencies
|
|
11
|
-
* will link to the "containingEntry", which is the LockfileEntry that specified this dependency.
|
|
12
|
-
* The "resolvedEntry" field is the corresponding LockfileEntry for this dependency, as all dependencies also have
|
|
13
|
-
* their own entries in the pnpm lockfile.
|
|
7
|
+
* Represents an graph edge, which is an exact dependency version obtained from the lockfile.
|
|
14
8
|
*/
|
|
15
9
|
class LfxGraphDependency {
|
|
16
10
|
constructor(options) {
|
|
17
11
|
this.resolvedEntry = undefined;
|
|
18
12
|
this.name = options.name;
|
|
19
|
-
this.
|
|
20
|
-
this.dependencyType = options.dependencyType;
|
|
21
|
-
this.containingEntry = options.containingEntry;
|
|
13
|
+
this.versionPath = options.versionPath;
|
|
22
14
|
this.entryId = options.entryId;
|
|
15
|
+
this.originalSpecifier = options.originalSpecifier;
|
|
16
|
+
this.dependencyKind = options.dependencyKind;
|
|
23
17
|
this.peerDependencyMeta = options.peerDependencyMeta;
|
|
18
|
+
this.containingEntry = options.containingEntry;
|
|
24
19
|
}
|
|
25
20
|
}
|
|
26
21
|
exports.LfxGraphDependency = LfxGraphDependency;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LfxGraph.js","sourceRoot":"","sources":["../../../src/packlets/lfx-shared/LfxGraph.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;
|
|
1
|
+
{"version":3,"file":"LfxGraph.js","sourceRoot":"","sources":["../../../src/packlets/lfx-shared/LfxGraph.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAkB3D;;GAEG;AACH,MAAa,kBAAkB;IA8C7B,YAAmB,OAAmC;QAF/C,kBAAa,GAA8B,SAAS,CAAC;QAG1D,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACnD,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QAErD,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IACjD,CAAC;CACF;AAxDD,gDAwDC;AAaD;;;;;;GAMG;AACH,MAAa,aAAa;IAyDxB,YAAmB,OAA8B;QAhBjD;;;WAGG;QACa,iBAAY,GAAyB,EAAE,CAAC;QAExD;;WAEG;QACa,+BAA0B,GAAgB,IAAI,GAAG,EAAE,CAAC;QAEpE;;WAEG;QACa,cAAS,GAAoB,EAAE,CAAC;QAG9C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;QAC3D,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;QACvD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACzC,CAAC;CACF;AAnED,sCAmEC;AAED,MAAa,QAAQ;IAInB,YAAmB,SAA4B;QAF/B,YAAO,GAAoB,EAAE,CAAC;QAG5C,IAAI,CAAC,SAAS,qBAAQ,SAAS,CAAE,CAAC;IACpC,CAAC;CACF;AAPD,4BAOC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { LfxDependencyKind, IJsonPeerDependencyMeta, LfxGraphEntryKind } from './IJsonLfxGraph';\nimport type { IJsonLfxWorkspace } from './IJsonLfxWorkspace';\n\nexport interface ILfxGraphDependencyOptions {\n name: string;\n versionPath: string;\n\n entryId: string;\n\n originalSpecifier: string;\n dependencyKind: LfxDependencyKind;\n peerDependencyMeta: IJsonPeerDependencyMeta;\n\n containingEntry: LfxGraphEntry;\n}\n\n/**\n * Represents an graph edge, which is an exact dependency version obtained from the lockfile.\n */\nexport class LfxGraphDependency {\n /**\n * The referenced package name.\n * Example: `@scope/package-name`\n */\n public readonly name: string;\n\n /**\n * The lockfile's raw string that either indicates an external reference such as `link:../target-folder`,\n * or else can be combined with the `name` field to construct an `entryId` found in the lockfile.\n * The exact syntax varies between lockfile file format versions.\n *\n * Example: `link:../target-folder`\n *\n * Example: `1.0.0`\n *\n * Example: `1.0.0_@rushstack+m@1.0.0` (version 5.4)\n * Example: `1.0.0(@rushstack/m@1.0.0)` (version 6.0 and 9.0)\n */\n public readonly versionPath: string;\n\n /**\n * If this dependency refers to an entry in the lockfile, this field should match a corresponding\n * {@link LfxGraphEntry.entryId} and `resolvedEntry` will be defined (unless the loader encountered an error).\n *\n * For external references such as `link:../target-folder`, the `entryId` is the empty string.\n */\n public readonly entryId: string;\n\n /**\n * The lockfile sometimes records the original SemVer specifier that was used to choose the versionPath,\n * usually either because it can change (e.g. a workspace project's dependencies) or because it's a peer dependency\n * that affects graph relationships beyond the current node. If not, then `originalSpecifier` will be the\n * empty string.\n *\n * @remarks\n * Because this field is only available for certain dependencies, it is generally less useful than specifiers\n * obtained from the package.json files.\n */\n public readonly originalSpecifier: string;\n public readonly dependencyKind: LfxDependencyKind;\n public readonly peerDependencyMeta: IJsonPeerDependencyMeta;\n\n public readonly containingEntry: LfxGraphEntry;\n public resolvedEntry: LfxGraphEntry | undefined = undefined;\n\n public constructor(options: ILfxGraphDependencyOptions) {\n this.name = options.name;\n this.versionPath = options.versionPath;\n this.entryId = options.entryId;\n this.originalSpecifier = options.originalSpecifier;\n this.dependencyKind = options.dependencyKind;\n this.peerDependencyMeta = options.peerDependencyMeta;\n\n this.containingEntry = options.containingEntry;\n }\n}\n\nexport interface ILfxGraphEntryOptions {\n kind: LfxGraphEntryKind;\n entryId: string;\n rawEntryId: string;\n packageJsonFolderPath: string;\n entryPackageName: string;\n displayText: string;\n entryPackageVersion: string;\n entrySuffix: string;\n}\n\n/**\n * Represents a project or package listed in the pnpm lockfile.\n *\n * @remarks\n * Each project or package will have its own LockfileEntry, which is created when the lockfile is first parsed.\n * The fields for the LockfileEntry are outlined below:\n */\nexport class LfxGraphEntry {\n /**\n * Whether this entry is a project or a package (specified by importers or packages in the lockfile).\n */\n public readonly kind: LfxGraphEntryKind;\n\n /**\n * A unique identifier for this lockfile entry, based on `rawEntryId` but adjusted to be unique for both\n * project and external package entries.\n */\n public readonly entryId: string;\n\n /**\n * The unique identifier assigned to this project/package in the lockfile.\n * e.g. `/@emotion/core/10.3.1_qjwx5m6wssz3lnb35xwkc3pz6q:`\n *\n * @remarks\n * In the `pnpm-lock.yaml` file, \"importers\" (workspace projects) and \"packages\" (external packages)\n * are tracked separately, so it's not required for their keys to be unique. `entryId` solves this problem\n * by adding a `project:` prefix for importers.\n */\n public readonly rawEntryId: string;\n\n /**\n * Where the package.json is for this project or package.\n */\n public readonly packageJsonFolderPath: string;\n\n /**\n * Just the name of the package with no specifiers.\n */\n public readonly entryPackageName: string;\n\n /**\n * A human friendly name for the project or package.\n */\n public readonly displayText: string;\n\n public readonly entryPackageVersion: string;\n public readonly entrySuffix: string;\n\n /**\n * A list of all the dependencies for this entry.\n * Note that dependencies, dev dependencies, as well as peer dependencies are all included.\n */\n public readonly dependencies: LfxGraphDependency[] = [];\n\n /**\n * A list of dependencies that are listed under the \"transitivePeerDependencies\" in the pnpm lockfile.\n */\n public readonly transitivePeerDependencies: Set<string> = new Set();\n\n /**\n * A list of entries that specify this entry as a dependency.\n */\n public readonly referrers: LfxGraphEntry[] = [];\n\n public constructor(options: ILfxGraphEntryOptions) {\n this.kind = options.kind;\n this.entryId = options.entryId;\n this.rawEntryId = options.rawEntryId;\n this.packageJsonFolderPath = options.packageJsonFolderPath;\n this.entryPackageName = options.entryPackageName;\n this.displayText = options.displayText;\n this.entryPackageVersion = options.entryPackageVersion;\n this.entrySuffix = options.entrySuffix;\n }\n}\n\nexport class LfxGraph {\n public readonly workspace: IJsonLfxWorkspace;\n public readonly entries: LfxGraphEntry[] = [];\n\n public constructor(workspace: IJsonLfxWorkspace) {\n this.workspace = { ...workspace };\n }\n}\n"]}
|
|
@@ -43,9 +43,10 @@ function serializeToJson(graph) {
|
|
|
43
43
|
for (const dependency of entry.dependencies) {
|
|
44
44
|
const jsonLfxDependency = {
|
|
45
45
|
name: dependency.name,
|
|
46
|
-
|
|
46
|
+
versionPath: dependency.versionPath,
|
|
47
47
|
entryId: dependency.entryId,
|
|
48
|
-
|
|
48
|
+
originalSpecifier: dependency.originalSpecifier,
|
|
49
|
+
dependencyKind: dependency.dependencyKind,
|
|
49
50
|
peerDependencyMeta: {
|
|
50
51
|
name: dependency.peerDependencyMeta.name,
|
|
51
52
|
version: dependency.peerDependencyMeta.version,
|
|
@@ -94,15 +95,16 @@ function deserializeFromJson(jsonLfxGraph) {
|
|
|
94
95
|
for (const jsonLfxDependency of jsonLfxEntry.dependencies) {
|
|
95
96
|
const dependency = new LfxGraph_1.LfxGraphDependency({
|
|
96
97
|
name: jsonLfxDependency.name,
|
|
97
|
-
|
|
98
|
-
dependencyType: jsonLfxDependency.dependencyType,
|
|
99
|
-
containingEntry: entry,
|
|
98
|
+
versionPath: jsonLfxDependency.versionPath,
|
|
100
99
|
entryId: jsonLfxDependency.entryId,
|
|
100
|
+
originalSpecifier: jsonLfxDependency.originalSpecifier,
|
|
101
|
+
dependencyKind: jsonLfxDependency.dependencyKind,
|
|
101
102
|
peerDependencyMeta: {
|
|
102
103
|
name: jsonLfxDependency.peerDependencyMeta.name,
|
|
103
104
|
version: jsonLfxDependency.peerDependencyMeta.version,
|
|
104
105
|
optional: jsonLfxDependency.peerDependencyMeta.optional
|
|
105
|
-
}
|
|
106
|
+
},
|
|
107
|
+
containingEntry: entry
|
|
106
108
|
});
|
|
107
109
|
if (jsonLfxDependency.resolvedEntryJsonId) {
|
|
108
110
|
dependency.resolvedEntry = fromJsonId(jsonLfxDependency.resolvedEntryJsonId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lfxGraphSerializer.js","sourceRoot":"","sources":["../../../src/packlets/lfx-shared/lfxGraphSerializer.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAK3D,
|
|
1
|
+
{"version":3,"file":"lfxGraphSerializer.js","sourceRoot":"","sources":["../../../src/packlets/lfx-shared/lfxGraphSerializer.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAK3D,0CAoEC;AAED,kDAmEC;AA3ID,yCAAqG;AAErG,SAAgB,eAAe,CAAC,KAAe;IAC7C,MAAM,cAAc,GAAoB,EAAE,CAAC;IAE3C,MAAM,aAAa,GAA+B,IAAI,GAAG,EAAE,CAAC;IAE5D,SAAS,QAAQ,CAAC,KAAoB;QACpC,MAAM,MAAM,GAAuB,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC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AAiB,CAAC,kBAAkB,CAAC,OAAO;oBACrD,QAAQ,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,QAAQ;iBACxD;gBACD,eAAe,EAAE,KAAK;aACvB,CAAC,CAAC;YAEH,IAAI,iBAAiB,CAAC,mBAAmB,EAAE,CAAC;gBAC1C,UAAU,CAAC,aAAa,GAAG,UAAU,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;YAC/E,CAAC;YAED,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACtC,CAAC;QAED,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,0BAA0B,EAAE,CAAC;YAC3D,KAAK,CAAC,0BAA0B,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;QAED,KAAK,MAAM,cAAc,IAAI,YAAY,CAAC,eAAe,EAAE,CAAC;YAC1D,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { IJsonLfxDependency, IJsonLfxEntry, IJsonLfxGraph } from './IJsonLfxGraph';\nimport { type ILfxGraphEntryOptions, LfxGraph, LfxGraphDependency, LfxGraphEntry } from './LfxGraph';\n\nexport function serializeToJson(graph: LfxGraph): IJsonLfxGraph {\n const jsonLfxEntries: IJsonLfxEntry[] = [];\n\n const jsonIdByEntry: Map<LfxGraphEntry, number> = new Map();\n\n function toJsonId(entry: LfxGraphEntry): number {\n const result: number | undefined = jsonIdByEntry.get(entry);\n if (result === undefined) {\n throw new Error('Attempt to serialize disconnected object');\n }\n return result;\n }\n\n // First create the jsonId mapping\n for (const entry of graph.entries) {\n const nextIndex: number = jsonLfxEntries.length;\n\n const jsonLfxEntry: IJsonLfxEntry = {\n jsonId: nextIndex,\n\n kind: entry.kind,\n entryId: entry.entryId,\n rawEntryId: entry.rawEntryId,\n packageJsonFolderPath: entry.packageJsonFolderPath,\n entryPackageName: entry.entryPackageName,\n displayText: entry.displayText,\n entryPackageVersion: entry.entryPackageVersion,\n entrySuffix: entry.entrySuffix,\n\n // Lists will be added in the second loop\n dependencies: [],\n transitivePeerDependencies: [],\n referrerJsonIds: []\n };\n\n jsonLfxEntries.push(jsonLfxEntry);\n jsonIdByEntry.set(entry, jsonLfxEntry.jsonId);\n }\n\n // Use the jsonId mapping to serialize the lists\n for (let i: number = 0; i < jsonLfxEntries.length; ++i) {\n const jsonLfxEntry: IJsonLfxEntry = jsonLfxEntries[i];\n const entry: LfxGraphEntry = graph.entries[i];\n\n for (const dependency of entry.dependencies) {\n const jsonLfxDependency: IJsonLfxDependency = {\n name: dependency.name,\n versionPath: dependency.versionPath,\n entryId: dependency.entryId,\n originalSpecifier: dependency.originalSpecifier,\n dependencyKind: dependency.dependencyKind,\n peerDependencyMeta: {\n name: dependency.peerDependencyMeta.name,\n version: dependency.peerDependencyMeta.version,\n optional: dependency.peerDependencyMeta.optional\n }\n };\n if (dependency.resolvedEntry) {\n jsonLfxDependency.resolvedEntryJsonId = toJsonId(dependency.resolvedEntry);\n }\n\n jsonLfxEntry.dependencies.push(jsonLfxDependency);\n }\n jsonLfxEntry.transitivePeerDependencies = Array.from(entry.transitivePeerDependencies);\n jsonLfxEntry.referrerJsonIds = entry.referrers.map((x) => toJsonId(x));\n }\n\n return { workspace: graph.workspace, entries: jsonLfxEntries };\n}\n\nexport function deserializeFromJson(jsonLfxGraph: IJsonLfxGraph): LfxGraph {\n const graph: LfxGraph = new LfxGraph(jsonLfxGraph.workspace);\n\n const entries: LfxGraphEntry[] = graph.entries;\n\n function fromJsonId(jsonId: number): LfxGraphEntry {\n const result: LfxGraphEntry | undefined = entries[jsonId];\n if (result === undefined) {\n throw new Error('Invalid jsonId');\n }\n return result;\n }\n\n const jsonLfxEntries: IJsonLfxEntry[] = jsonLfxGraph.entries;\n\n // First create the jsonId mapping\n for (const jsonLfxEntry of jsonLfxEntries) {\n const options: ILfxGraphEntryOptions = {\n kind: jsonLfxEntry.kind,\n entryId: jsonLfxEntry.entryId,\n rawEntryId: jsonLfxEntry.rawEntryId,\n packageJsonFolderPath: jsonLfxEntry.packageJsonFolderPath,\n entryPackageName: jsonLfxEntry.entryPackageName,\n displayText: jsonLfxEntry.displayText,\n entryPackageVersion: jsonLfxEntry.entryPackageVersion,\n entrySuffix: jsonLfxEntry.entrySuffix\n };\n entries.push(new LfxGraphEntry(options));\n }\n\n // Use the jsonId mapping to deserialize the lists\n for (let i: number = 0; i < jsonLfxEntries.length; ++i) {\n const jsonLfxEntry: IJsonLfxEntry = jsonLfxEntries[i];\n const entry: LfxGraphEntry = graph.entries[i];\n\n for (const jsonLfxDependency of jsonLfxEntry.dependencies) {\n const dependency: LfxGraphDependency = new LfxGraphDependency({\n name: jsonLfxDependency.name,\n versionPath: jsonLfxDependency.versionPath,\n entryId: jsonLfxDependency.entryId,\n originalSpecifier: jsonLfxDependency.originalSpecifier,\n dependencyKind: jsonLfxDependency.dependencyKind,\n peerDependencyMeta: {\n name: jsonLfxDependency.peerDependencyMeta.name,\n version: jsonLfxDependency.peerDependencyMeta.version,\n optional: jsonLfxDependency.peerDependencyMeta.optional\n },\n containingEntry: entry\n });\n\n if (jsonLfxDependency.resolvedEntryJsonId) {\n dependency.resolvedEntry = fromJsonId(jsonLfxDependency.resolvedEntryJsonId);\n }\n\n entry.dependencies.push(dependency);\n }\n\n for (const item of jsonLfxEntry.transitivePeerDependencies) {\n entry.transitivePeerDependencies.add(item);\n }\n\n for (const referrerJsonId of jsonLfxEntry.referrerJsonIds) {\n entry.referrers.push(fromJsonId(referrerJsonId));\n }\n }\n\n return graph;\n}\n"]}
|