@rushstack/lockfile-explorer 1.7.41 → 1.8.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.
Files changed (62) hide show
  1. package/CHANGELOG.json +55 -0
  2. package/CHANGELOG.md +21 -1
  3. package/build/lfx-shared/IAppContext.d.ts +32 -0
  4. package/build/lfx-shared/IAppContext.js +5 -0
  5. package/build/lfx-shared/IAppContext.js.map +1 -0
  6. package/build/lfx-shared/IJsonLfxGraph.d.ts +51 -0
  7. package/build/lfx-shared/IJsonLfxGraph.js +19 -0
  8. package/build/lfx-shared/IJsonLfxGraph.js.map +1 -0
  9. package/build/lfx-shared/IJsonLfxWorkspace.d.ts +59 -0
  10. package/build/lfx-shared/IJsonLfxWorkspace.js +5 -0
  11. package/build/lfx-shared/IJsonLfxWorkspace.js.map +1 -0
  12. package/build/lfx-shared/LfxGraph.d.ts +96 -0
  13. package/build/lfx-shared/LfxGraph.js +67 -0
  14. package/build/lfx-shared/LfxGraph.js.map +1 -0
  15. package/build/lfx-shared/index.d.ts +6 -0
  16. package/build/lfx-shared/index.js +12 -0
  17. package/build/lfx-shared/index.js.map +1 -0
  18. package/build/lfx-shared/lfxGraphSerializer.d.ts +5 -0
  19. package/build/lfx-shared/lfxGraphSerializer.js +121 -0
  20. package/build/lfx-shared/lfxGraphSerializer.js.map +1 -0
  21. package/dist/531.0e5a24ca1399529aa975.js +2 -0
  22. package/dist/{964.4bbaf68a6f1467df6770.js.LICENSE.txt → 531.0e5a24ca1399529aa975.js.LICENSE.txt} +13 -0
  23. package/dist/app.22259b754540a899e03d.js +1 -0
  24. package/dist/index.html +1 -1
  25. package/lib/cli/explorer/ExplorerCommandLineParser.d.ts.map +1 -1
  26. package/lib/cli/explorer/ExplorerCommandLineParser.js +61 -22
  27. package/lib/cli/explorer/ExplorerCommandLineParser.js.map +1 -1
  28. package/lib/cli/lint/actions/CheckAction.d.ts.map +1 -1
  29. package/lib/cli/lint/actions/CheckAction.js.map +1 -1
  30. package/lib/graph/IPnpmfileModule.d.ts +15 -0
  31. package/lib/graph/IPnpmfileModule.d.ts.map +1 -0
  32. package/lib/graph/IPnpmfileModule.js +5 -0
  33. package/lib/graph/IPnpmfileModule.js.map +1 -0
  34. package/lib/graph/PnpmfileRunner.d.ts +19 -0
  35. package/lib/graph/PnpmfileRunner.d.ts.map +1 -0
  36. package/lib/graph/PnpmfileRunner.js +123 -0
  37. package/lib/graph/PnpmfileRunner.js.map +1 -0
  38. package/lib/graph/lfxGraphLoader.d.ts +9 -0
  39. package/lib/graph/lfxGraphLoader.d.ts.map +1 -0
  40. package/lib/graph/lfxGraphLoader.js +408 -0
  41. package/lib/graph/lfxGraphLoader.js.map +1 -0
  42. package/lib/graph/lockfilePath.d.ts +37 -0
  43. package/lib/graph/lockfilePath.d.ts.map +1 -0
  44. package/lib/graph/lockfilePath.js +123 -0
  45. package/lib/graph/lockfilePath.js.map +1 -0
  46. package/lib/graph/pnpmfileRunnerWorkerThread.d.ts +23 -0
  47. package/lib/graph/pnpmfileRunnerWorkerThread.d.ts.map +1 -0
  48. package/lib/graph/pnpmfileRunnerWorkerThread.js +94 -0
  49. package/lib/graph/pnpmfileRunnerWorkerThread.js.map +1 -0
  50. package/lib/state/index.d.ts +4 -22
  51. package/lib/state/index.d.ts.map +1 -1
  52. package/lib/state/index.js +0 -6
  53. package/lib/state/index.js.map +1 -1
  54. package/lib/utils/init.d.ts +2 -2
  55. package/lib/utils/init.d.ts.map +1 -1
  56. package/lib/utils/init.js +73 -29
  57. package/lib/utils/init.js.map +1 -1
  58. package/lib/utils/shrinkwrap.d.ts.map +1 -1
  59. package/lib/utils/shrinkwrap.js.map +1 -1
  60. package/package.json +14 -12
  61. package/dist/964.4bbaf68a6f1467df6770.js +0 -2
  62. package/dist/app.acf2b912c3f02793012c.js +0 -1
package/CHANGELOG.json CHANGED
@@ -1,6 +1,61 @@
1
1
  {
2
2
  "name": "@rushstack/lockfile-explorer",
3
3
  "entries": [
4
+ {
5
+ "version": "1.8.0",
6
+ "tag": "@rushstack/lockfile-explorer_v1.8.0",
7
+ "date": "Tue, 30 Sep 2025 20:33:51 GMT",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "comment": "Bump \"express\" to 4.21.1 to address reported vulnerabilities in 4.20.0."
12
+ },
13
+ {
14
+ "comment": "Upgraded `js-yaml` dependency"
15
+ },
16
+ {
17
+ "comment": "Improve support for PNPM lockfile format V6.0"
18
+ },
19
+ {
20
+ "comment": "Refactoring to support future work"
21
+ }
22
+ ],
23
+ "minor": [
24
+ {
25
+ "comment": "Add syntax highlighter"
26
+ },
27
+ {
28
+ "comment": "Isolate .pnpmcfile.cjs evaluation"
29
+ }
30
+ ],
31
+ "dependency": [
32
+ {
33
+ "comment": "Updating dependency \"@rushstack/node-core-library\" to `5.15.0`"
34
+ },
35
+ {
36
+ "comment": "Updating dependency \"@rushstack/terminal\" to `0.17.0`"
37
+ },
38
+ {
39
+ "comment": "Updating dependency \"@rushstack/ts-command-line\" to `5.0.4`"
40
+ },
41
+ {
42
+ "comment": "Updating dependency \"@rushstack/heft\" to `0.75.0`"
43
+ }
44
+ ]
45
+ }
46
+ },
47
+ {
48
+ "version": "1.7.42",
49
+ "tag": "@rushstack/lockfile-explorer_v1.7.42",
50
+ "date": "Fri, 12 Sep 2025 15:13:07 GMT",
51
+ "comments": {
52
+ "dependency": [
53
+ {
54
+ "comment": "Updating dependency \"@rushstack/heft\" to `0.74.5`"
55
+ }
56
+ ]
57
+ }
58
+ },
4
59
  {
5
60
  "version": "1.7.41",
6
61
  "tag": "@rushstack/lockfile-explorer_v1.7.41",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,26 @@
1
1
  # Change Log - @rushstack/lockfile-explorer
2
2
 
3
- This log was last generated on Thu, 11 Sep 2025 00:22:31 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 30 Sep 2025 20:33:51 GMT and should not be manually modified.
4
+
5
+ ## 1.8.0
6
+ Tue, 30 Sep 2025 20:33:51 GMT
7
+
8
+ ### Minor changes
9
+
10
+ - Add syntax highlighter
11
+ - Isolate .pnpmcfile.cjs evaluation
12
+
13
+ ### Patches
14
+
15
+ - Bump "express" to 4.21.1 to address reported vulnerabilities in 4.20.0.
16
+ - Upgraded `js-yaml` dependency
17
+ - Improve support for PNPM lockfile format V6.0
18
+ - Refactoring to support future work
19
+
20
+ ## 1.7.42
21
+ Fri, 12 Sep 2025 15:13:07 GMT
22
+
23
+ _Version update only_
4
24
 
5
25
  ## 1.7.41
6
26
  Thu, 11 Sep 2025 00:22:31 GMT
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Describes the `window.appContext` object that the Node.js service uses
3
+ * to communicate runtime configuration to the web app.
4
+ *
5
+ * @remarks
6
+ * The `dist/index.html` page loads a script `initappcontext.js` to initialize
7
+ * this object before the web app starts.
8
+ *
9
+ * When the app is hosted by Webpack dev server, this is implemented by
10
+ * `lockfile-explorer-web/src/stub/initappcontext.ts`.
11
+ *
12
+ * When the app is hosted by the CLI front end, the `initappcontext.js` content
13
+ * is generated by an Express route.
14
+ */
15
+ export interface IAppContext {
16
+ /**
17
+ * The service URL, without the trailing slash.
18
+ *
19
+ * @example
20
+ * Example: `http://localhost:8091`
21
+ */
22
+ serviceUrl: string;
23
+ /**
24
+ * The `package.json` version for the app.
25
+ */
26
+ appVersion: string;
27
+ /**
28
+ * Whether the CLI was invoked with the `--debug` parameter.
29
+ */
30
+ debugMode: boolean;
31
+ }
32
+ //# sourceMappingURL=IAppContext.d.ts.map
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=IAppContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAppContext.js","sourceRoot":"","sources":["../../../src/packlets/lfx-shared/IAppContext.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * Describes the `window.appContext` object that the Node.js service uses\n * to communicate runtime configuration to the web app.\n *\n * @remarks\n * The `dist/index.html` page loads a script `initappcontext.js` to initialize\n * this object before the web app starts.\n *\n * When the app is hosted by Webpack dev server, this is implemented by\n * `lockfile-explorer-web/src/stub/initappcontext.ts`.\n *\n * When the app is hosted by the CLI front end, the `initappcontext.js` content\n * is generated by an Express route.\n */\nexport interface IAppContext {\n /**\n * The service URL, without the trailing slash.\n *\n * @example\n * Example: `http://localhost:8091`\n */\n serviceUrl: string;\n\n /**\n * The `package.json` version for the app.\n */\n appVersion: string;\n\n /**\n * Whether the CLI was invoked with the `--debug` parameter.\n */\n debugMode: boolean;\n}\n"]}
@@ -0,0 +1,51 @@
1
+ import type { IJsonLfxWorkspace } from './IJsonLfxWorkspace';
2
+ export declare enum LfxGraphEntryKind {
3
+ Project = 1,
4
+ Package = 2,
5
+ SideBySide = 3,
6
+ Doppelganger = 4
7
+ }
8
+ export interface IJsonPeerDependencyMeta {
9
+ name?: string;
10
+ version?: string;
11
+ optional?: boolean;
12
+ }
13
+ export interface IJsonLfxDependency {
14
+ name: string;
15
+ version: string;
16
+ entryId: string;
17
+ dependencyType: LfxDependencyKind;
18
+ resolvedEntryJsonId?: number;
19
+ peerDependencyMeta: IJsonPeerDependencyMeta;
20
+ }
21
+ export declare enum LfxDependencyKind {
22
+ Regular = "regular",
23
+ Dev = "dev",
24
+ Peer = "peer"
25
+ }
26
+ export interface IJsonLfxEntry {
27
+ /**
28
+ * A unique ID used when serializing graph links.
29
+ *
30
+ * @remarks
31
+ * This is just the `IJsonLfxGraph.entries` array index, but debugging is easier if we include
32
+ * it in the serialized representation.
33
+ */
34
+ jsonId: number;
35
+ kind: LfxGraphEntryKind;
36
+ entryId: string;
37
+ rawEntryId: string;
38
+ packageJsonFolderPath: string;
39
+ entryPackageName: string;
40
+ displayText: string;
41
+ entryPackageVersion: string;
42
+ entrySuffix: string;
43
+ dependencies: IJsonLfxDependency[];
44
+ transitivePeerDependencies: string[];
45
+ referrerJsonIds: number[];
46
+ }
47
+ export interface IJsonLfxGraph {
48
+ workspace: IJsonLfxWorkspace;
49
+ entries: IJsonLfxEntry[];
50
+ }
51
+ //# sourceMappingURL=IJsonLfxGraph.d.ts.map
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.LfxDependencyKind = exports.LfxGraphEntryKind = void 0;
6
+ var LfxGraphEntryKind;
7
+ (function (LfxGraphEntryKind) {
8
+ LfxGraphEntryKind[LfxGraphEntryKind["Project"] = 1] = "Project";
9
+ LfxGraphEntryKind[LfxGraphEntryKind["Package"] = 2] = "Package";
10
+ LfxGraphEntryKind[LfxGraphEntryKind["SideBySide"] = 3] = "SideBySide";
11
+ LfxGraphEntryKind[LfxGraphEntryKind["Doppelganger"] = 4] = "Doppelganger";
12
+ })(LfxGraphEntryKind || (exports.LfxGraphEntryKind = LfxGraphEntryKind = {}));
13
+ var LfxDependencyKind;
14
+ (function (LfxDependencyKind) {
15
+ LfxDependencyKind["Regular"] = "regular";
16
+ LfxDependencyKind["Dev"] = "dev";
17
+ LfxDependencyKind["Peer"] = "peer";
18
+ })(LfxDependencyKind || (exports.LfxDependencyKind = LfxDependencyKind = {}));
19
+ //# sourceMappingURL=IJsonLfxGraph.js.map
@@ -0,0 +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 version: string;\n entryId: string;\n dependencyType: LfxDependencyKind;\n\n resolvedEntryJsonId?: number;\n\n peerDependencyMeta: IJsonPeerDependencyMeta;\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"]}
@@ -0,0 +1,59 @@
1
+ export interface IJsonLfxWorkspaceRushConfig {
2
+ /**
3
+ * The `rushVersion` field from rush.json.
4
+ */
5
+ readonly rushVersion: string;
6
+ /**
7
+ * If the subspaces feature is enabled and a subspace was loaded, the name of the subspace.
8
+ * Otherwise this will be an empty string.
9
+ */
10
+ readonly subspaceName: string;
11
+ /**
12
+ * The path to Rush's input file `.pnpmfile.cjs`, relative to `workspaceRootFullPath`
13
+ * and normalized to use forward slashes without a leading slash. In a Rush workspace,
14
+ * {@link IJsonLfxWorkspace.pnpmfilePath} is a temporary file that is generated from `rushPnpmfilePath`.
15
+ *
16
+ * @example `"common/config/my-subspace/pnpm-lock.yaml"`
17
+ */
18
+ readonly rushPnpmfilePath: string;
19
+ }
20
+ export interface IJsonLfxWorkspace {
21
+ /**
22
+ * Absolute path to the workspace folder that is opened by the app, normalized to use forward slashes
23
+ * without a trailing slash.
24
+ *
25
+ * @example `"C:/path/to/MyRepo"`
26
+ */
27
+ readonly workspaceRootFullPath: string;
28
+ /**
29
+ * The path to the "pnpm-lock.yaml" file, relative to `workspaceRootFullPath`
30
+ * and normalized to use forward slashes without a leading slash.
31
+ *
32
+ * @example `"common/temp/my-subspace/pnpm-lock.yaml"`
33
+ * @example `"pnpm-lock.yaml"`
34
+ */
35
+ readonly pnpmLockfilePath: string;
36
+ /**
37
+ * The path to the folder of "pnpm-lock.yaml" file, relative to `workspaceRootFullPath`
38
+ * and normalized to use forward slashes without a leading slash.
39
+ *
40
+ * If `pnpm-lack.yaml` is in the `workspaceRootFullPath` folder, then pnpmLockfileFolder
41
+ * is the empty string.
42
+ *
43
+ * @example `"common/temp/my-subspace"`
44
+ * @example `""`
45
+ */
46
+ readonly pnpmLockfileFolder: string;
47
+ /**
48
+ * The path to the `.pnpmfile.cjs` file that is loaded by PNPM. In a Rush workspace,
49
+ * this is a temporary file that is generated from `rushPnpmfilePath`.
50
+ *
51
+ * @example `"common/temp/my-subspace/.pnpmfile.cjs"`
52
+ */
53
+ readonly pnpmfilePath: string;
54
+ /**
55
+ * This section will be defined only if this is a Rush workspace (versus a plain PNPM workspace).
56
+ */
57
+ readonly rushConfig: IJsonLfxWorkspaceRushConfig | undefined;
58
+ }
59
+ //# sourceMappingURL=IJsonLfxWorkspace.d.ts.map
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=IJsonLfxWorkspace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IJsonLfxWorkspace.js","sourceRoot":"","sources":["../../../src/packlets/lfx-shared/IJsonLfxWorkspace.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport interface IJsonLfxWorkspaceRushConfig {\n /**\n * The `rushVersion` field from rush.json.\n */\n readonly rushVersion: string;\n\n /**\n * If the subspaces feature is enabled and a subspace was loaded, the name of the subspace.\n * Otherwise this will be an empty string.\n */\n readonly subspaceName: string;\n\n /**\n * The path to Rush's input file `.pnpmfile.cjs`, relative to `workspaceRootFullPath`\n * and normalized to use forward slashes without a leading slash. In a Rush workspace,\n * {@link IJsonLfxWorkspace.pnpmfilePath} is a temporary file that is generated from `rushPnpmfilePath`.\n *\n * @example `\"common/config/my-subspace/pnpm-lock.yaml\"`\n */\n readonly rushPnpmfilePath: string;\n}\n\nexport interface IJsonLfxWorkspace {\n /**\n * Absolute path to the workspace folder that is opened by the app, normalized to use forward slashes\n * without a trailing slash.\n *\n * @example `\"C:/path/to/MyRepo\"`\n */\n readonly workspaceRootFullPath: string;\n\n /**\n * The path to the \"pnpm-lock.yaml\" file, relative to `workspaceRootFullPath`\n * and normalized to use forward slashes without a leading slash.\n *\n * @example `\"common/temp/my-subspace/pnpm-lock.yaml\"`\n * @example `\"pnpm-lock.yaml\"`\n */\n readonly pnpmLockfilePath: string;\n\n /**\n * The path to the folder of \"pnpm-lock.yaml\" file, relative to `workspaceRootFullPath`\n * and normalized to use forward slashes without a leading slash.\n *\n * If `pnpm-lack.yaml` is in the `workspaceRootFullPath` folder, then pnpmLockfileFolder\n * is the empty string.\n *\n * @example `\"common/temp/my-subspace\"`\n * @example `\"\"`\n */\n readonly pnpmLockfileFolder: string;\n\n /**\n * The path to the `.pnpmfile.cjs` file that is loaded by PNPM. In a Rush workspace,\n * this is a temporary file that is generated from `rushPnpmfilePath`.\n *\n * @example `\"common/temp/my-subspace/.pnpmfile.cjs\"`\n */\n readonly pnpmfilePath: string;\n\n /**\n * This section will be defined only if this is a Rush workspace (versus a plain PNPM workspace).\n */\n readonly rushConfig: IJsonLfxWorkspaceRushConfig | undefined;\n}\n"]}
@@ -0,0 +1,96 @@
1
+ import type { LfxDependencyKind, IJsonPeerDependencyMeta, LfxGraphEntryKind } from './IJsonLfxGraph';
2
+ import type { IJsonLfxWorkspace } from './IJsonLfxWorkspace';
3
+ export interface ILfxGraphDependencyOptions {
4
+ name: string;
5
+ version: string;
6
+ dependencyType: LfxDependencyKind;
7
+ containingEntry: LfxGraphEntry;
8
+ peerDependencyMeta: IJsonPeerDependencyMeta;
9
+ entryId: string;
10
+ }
11
+ /**
12
+ * Represents a dependency listed under a LockfileEntry
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.
19
+ */
20
+ export declare class LfxGraphDependency {
21
+ readonly name: string;
22
+ readonly version: string;
23
+ readonly dependencyType: LfxDependencyKind;
24
+ readonly containingEntry: LfxGraphEntry;
25
+ readonly entryId: string;
26
+ readonly peerDependencyMeta: IJsonPeerDependencyMeta;
27
+ resolvedEntry: LfxGraphEntry | undefined;
28
+ constructor(options: ILfxGraphDependencyOptions);
29
+ }
30
+ export interface ILfxGraphEntryOptions {
31
+ kind: LfxGraphEntryKind;
32
+ entryId: string;
33
+ rawEntryId: string;
34
+ packageJsonFolderPath: string;
35
+ entryPackageName: string;
36
+ displayText: string;
37
+ entryPackageVersion: string;
38
+ entrySuffix: string;
39
+ }
40
+ /**
41
+ * Represents a project or package listed in the pnpm lockfile.
42
+ *
43
+ * @remarks
44
+ * Each project or package will have its own LockfileEntry, which is created when the lockfile is first parsed.
45
+ * The fields for the LockfileEntry are outlined below:
46
+ */
47
+ export declare class LfxGraphEntry {
48
+ /**
49
+ * Whether this entry is a project or a package (specified by importers or packages in the lockfile).
50
+ */
51
+ readonly kind: LfxGraphEntryKind;
52
+ /**
53
+ * A unique (human-readable) identifier for this lockfile entry. For projects, this is just
54
+ * `Project:` + the package json path for this project.
55
+ */
56
+ readonly entryId: string;
57
+ /**
58
+ * The unique identifier assigned to this project/package in the lockfile.
59
+ * e.g. `/@emotion/core/10.3.1_qjwx5m6wssz3lnb35xwkc3pz6q:`
60
+ */
61
+ readonly rawEntryId: string;
62
+ /**
63
+ * Where the package.json is for this project or package.
64
+ */
65
+ readonly packageJsonFolderPath: string;
66
+ /**
67
+ * Just the name of the package with no specifiers.
68
+ */
69
+ readonly entryPackageName: string;
70
+ /**
71
+ * A human friendly name for the project or package.
72
+ */
73
+ readonly displayText: string;
74
+ readonly entryPackageVersion: string;
75
+ readonly entrySuffix: string;
76
+ /**
77
+ * A list of all the dependencies for this entry.
78
+ * Note that dependencies, dev dependencies, as well as peer dependencies are all included.
79
+ */
80
+ readonly dependencies: LfxGraphDependency[];
81
+ /**
82
+ * A list of dependencies that are listed under the "transitivePeerDependencies" in the pnpm lockfile.
83
+ */
84
+ readonly transitivePeerDependencies: Set<string>;
85
+ /**
86
+ * A list of entries that specify this entry as a dependency.
87
+ */
88
+ readonly referrers: LfxGraphEntry[];
89
+ constructor(options: ILfxGraphEntryOptions);
90
+ }
91
+ export declare class LfxGraph {
92
+ readonly workspace: IJsonLfxWorkspace;
93
+ readonly entries: LfxGraphEntry[];
94
+ constructor(workspace: IJsonLfxWorkspace);
95
+ }
96
+ //# sourceMappingURL=LfxGraph.d.ts.map
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.LfxGraph = exports.LfxGraphEntry = exports.LfxGraphDependency = void 0;
6
+ /**
7
+ * Represents a dependency listed under a LockfileEntry
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.
14
+ */
15
+ class LfxGraphDependency {
16
+ constructor(options) {
17
+ this.resolvedEntry = undefined;
18
+ this.name = options.name;
19
+ this.version = options.version;
20
+ this.dependencyType = options.dependencyType;
21
+ this.containingEntry = options.containingEntry;
22
+ this.entryId = options.entryId;
23
+ this.peerDependencyMeta = options.peerDependencyMeta;
24
+ }
25
+ }
26
+ exports.LfxGraphDependency = LfxGraphDependency;
27
+ /**
28
+ * Represents a project or package listed in the pnpm lockfile.
29
+ *
30
+ * @remarks
31
+ * Each project or package will have its own LockfileEntry, which is created when the lockfile is first parsed.
32
+ * The fields for the LockfileEntry are outlined below:
33
+ */
34
+ class LfxGraphEntry {
35
+ constructor(options) {
36
+ /**
37
+ * A list of all the dependencies for this entry.
38
+ * Note that dependencies, dev dependencies, as well as peer dependencies are all included.
39
+ */
40
+ this.dependencies = [];
41
+ /**
42
+ * A list of dependencies that are listed under the "transitivePeerDependencies" in the pnpm lockfile.
43
+ */
44
+ this.transitivePeerDependencies = new Set();
45
+ /**
46
+ * A list of entries that specify this entry as a dependency.
47
+ */
48
+ this.referrers = [];
49
+ this.kind = options.kind;
50
+ this.entryId = options.entryId;
51
+ this.rawEntryId = options.rawEntryId;
52
+ this.packageJsonFolderPath = options.packageJsonFolderPath;
53
+ this.entryPackageName = options.entryPackageName;
54
+ this.displayText = options.displayText;
55
+ this.entryPackageVersion = options.entryPackageVersion;
56
+ this.entrySuffix = options.entrySuffix;
57
+ }
58
+ }
59
+ exports.LfxGraphEntry = LfxGraphEntry;
60
+ class LfxGraph {
61
+ constructor(workspace) {
62
+ this.entries = [];
63
+ this.workspace = Object.assign({}, workspace);
64
+ }
65
+ }
66
+ exports.LfxGraph = LfxGraph;
67
+ //# sourceMappingURL=LfxGraph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LfxGraph.js","sourceRoot":"","sources":["../../../src/packlets/lfx-shared/LfxGraph.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAc3D;;;;;;;;GAQG;AACH,MAAa,kBAAkB;IAU7B,YAAmB,OAAmC;QAF/C,kBAAa,GAA8B,SAAS,CAAC;QAG1D,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IACvD,CAAC;CACF;AAlBD,gDAkBC;AAaD;;;;;;GAMG;AACH,MAAa,aAAa;IAoDxB,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;AA9DD,sCA8DC;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 version: string;\n dependencyType: LfxDependencyKind;\n containingEntry: LfxGraphEntry;\n peerDependencyMeta: IJsonPeerDependencyMeta;\n entryId: string;\n}\n\n/**\n * Represents a dependency listed under a LockfileEntry\n *\n * @remarks\n * Each dependency listed under a package in the lockfile should have a separate entry. These Dependencies\n * will link to the \"containingEntry\", which is the LockfileEntry that specified this dependency.\n * The \"resolvedEntry\" field is the corresponding LockfileEntry for this dependency, as all dependencies also have\n * their own entries in the pnpm lockfile.\n */\nexport class LfxGraphDependency {\n public readonly name: string;\n public readonly version: string;\n public readonly dependencyType: LfxDependencyKind;\n public readonly containingEntry: LfxGraphEntry;\n public readonly entryId: string;\n public readonly peerDependencyMeta: IJsonPeerDependencyMeta;\n\n public resolvedEntry: LfxGraphEntry | undefined = undefined;\n\n public constructor(options: ILfxGraphDependencyOptions) {\n this.name = options.name;\n this.version = options.version;\n this.dependencyType = options.dependencyType;\n this.containingEntry = options.containingEntry;\n this.entryId = options.entryId;\n this.peerDependencyMeta = options.peerDependencyMeta;\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 (human-readable) identifier for this lockfile entry. For projects, this is just\n * `Project:` + the package json path for this project.\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 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"]}
@@ -0,0 +1,6 @@
1
+ export * from './IAppContext';
2
+ export * from './IJsonLfxGraph';
3
+ export * from './IJsonLfxWorkspace';
4
+ export * from './LfxGraph';
5
+ export * as lfxGraphSerializer from './lfxGraphSerializer';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.lfxGraphSerializer = void 0;
6
+ const tslib_1 = require("tslib");
7
+ tslib_1.__exportStar(require("./IAppContext"), exports);
8
+ tslib_1.__exportStar(require("./IJsonLfxGraph"), exports);
9
+ tslib_1.__exportStar(require("./IJsonLfxWorkspace"), exports);
10
+ tslib_1.__exportStar(require("./LfxGraph"), exports);
11
+ exports.lfxGraphSerializer = tslib_1.__importStar(require("./lfxGraphSerializer"));
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/lfx-shared/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;AAE3D,wDAA8B;AAC9B,0DAAgC;AAChC,8DAAoC;AACpC,qDAA2B;AAC3B,mFAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport * from './IAppContext';\nexport * from './IJsonLfxGraph';\nexport * from './IJsonLfxWorkspace';\nexport * from './LfxGraph';\nexport * as lfxGraphSerializer from './lfxGraphSerializer';\n"]}
@@ -0,0 +1,5 @@
1
+ import type { IJsonLfxGraph } from './IJsonLfxGraph';
2
+ import { LfxGraph } from './LfxGraph';
3
+ export declare function serializeToJson(graph: LfxGraph): IJsonLfxGraph;
4
+ export declare function deserializeFromJson(jsonLfxGraph: IJsonLfxGraph): LfxGraph;
5
+ //# sourceMappingURL=lfxGraphSerializer.d.ts.map
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.serializeToJson = serializeToJson;
6
+ exports.deserializeFromJson = deserializeFromJson;
7
+ const LfxGraph_1 = require("./LfxGraph");
8
+ function serializeToJson(graph) {
9
+ const jsonLfxEntries = [];
10
+ const jsonIdByEntry = new Map();
11
+ function toJsonId(entry) {
12
+ const result = jsonIdByEntry.get(entry);
13
+ if (result === undefined) {
14
+ throw new Error('Attempt to serialize disconnected object');
15
+ }
16
+ return result;
17
+ }
18
+ // First create the jsonId mapping
19
+ for (const entry of graph.entries) {
20
+ const nextIndex = jsonLfxEntries.length;
21
+ const jsonLfxEntry = {
22
+ jsonId: nextIndex,
23
+ kind: entry.kind,
24
+ entryId: entry.entryId,
25
+ rawEntryId: entry.rawEntryId,
26
+ packageJsonFolderPath: entry.packageJsonFolderPath,
27
+ entryPackageName: entry.entryPackageName,
28
+ displayText: entry.displayText,
29
+ entryPackageVersion: entry.entryPackageVersion,
30
+ entrySuffix: entry.entrySuffix,
31
+ // Lists will be added in the second loop
32
+ dependencies: [],
33
+ transitivePeerDependencies: [],
34
+ referrerJsonIds: []
35
+ };
36
+ jsonLfxEntries.push(jsonLfxEntry);
37
+ jsonIdByEntry.set(entry, jsonLfxEntry.jsonId);
38
+ }
39
+ // Use the jsonId mapping to serialize the lists
40
+ for (let i = 0; i < jsonLfxEntries.length; ++i) {
41
+ const jsonLfxEntry = jsonLfxEntries[i];
42
+ const entry = graph.entries[i];
43
+ for (const dependency of entry.dependencies) {
44
+ const jsonLfxDependency = {
45
+ name: dependency.name,
46
+ version: dependency.version,
47
+ entryId: dependency.entryId,
48
+ dependencyType: dependency.dependencyType,
49
+ peerDependencyMeta: {
50
+ name: dependency.peerDependencyMeta.name,
51
+ version: dependency.peerDependencyMeta.version,
52
+ optional: dependency.peerDependencyMeta.optional
53
+ }
54
+ };
55
+ if (dependency.resolvedEntry) {
56
+ jsonLfxDependency.resolvedEntryJsonId = toJsonId(dependency.resolvedEntry);
57
+ }
58
+ jsonLfxEntry.dependencies.push(jsonLfxDependency);
59
+ }
60
+ jsonLfxEntry.transitivePeerDependencies = Array.from(entry.transitivePeerDependencies);
61
+ jsonLfxEntry.referrerJsonIds = entry.referrers.map((x) => toJsonId(x));
62
+ }
63
+ return { workspace: graph.workspace, entries: jsonLfxEntries };
64
+ }
65
+ function deserializeFromJson(jsonLfxGraph) {
66
+ const graph = new LfxGraph_1.LfxGraph(jsonLfxGraph.workspace);
67
+ const entries = graph.entries;
68
+ function fromJsonId(jsonId) {
69
+ const result = entries[jsonId];
70
+ if (result === undefined) {
71
+ throw new Error('Invalid jsonId');
72
+ }
73
+ return result;
74
+ }
75
+ const jsonLfxEntries = jsonLfxGraph.entries;
76
+ // First create the jsonId mapping
77
+ for (const jsonLfxEntry of jsonLfxEntries) {
78
+ const options = {
79
+ kind: jsonLfxEntry.kind,
80
+ entryId: jsonLfxEntry.entryId,
81
+ rawEntryId: jsonLfxEntry.rawEntryId,
82
+ packageJsonFolderPath: jsonLfxEntry.packageJsonFolderPath,
83
+ entryPackageName: jsonLfxEntry.entryPackageName,
84
+ displayText: jsonLfxEntry.displayText,
85
+ entryPackageVersion: jsonLfxEntry.entryPackageVersion,
86
+ entrySuffix: jsonLfxEntry.entrySuffix
87
+ };
88
+ entries.push(new LfxGraph_1.LfxGraphEntry(options));
89
+ }
90
+ // Use the jsonId mapping to deserialize the lists
91
+ for (let i = 0; i < jsonLfxEntries.length; ++i) {
92
+ const jsonLfxEntry = jsonLfxEntries[i];
93
+ const entry = graph.entries[i];
94
+ for (const jsonLfxDependency of jsonLfxEntry.dependencies) {
95
+ const dependency = new LfxGraph_1.LfxGraphDependency({
96
+ name: jsonLfxDependency.name,
97
+ version: jsonLfxDependency.version,
98
+ dependencyType: jsonLfxDependency.dependencyType,
99
+ containingEntry: entry,
100
+ entryId: jsonLfxDependency.entryId,
101
+ peerDependencyMeta: {
102
+ name: jsonLfxDependency.peerDependencyMeta.name,
103
+ version: jsonLfxDependency.peerDependencyMeta.version,
104
+ optional: jsonLfxDependency.peerDependencyMeta.optional
105
+ }
106
+ });
107
+ if (jsonLfxDependency.resolvedEntryJsonId) {
108
+ dependency.resolvedEntry = fromJsonId(jsonLfxDependency.resolvedEntryJsonId);
109
+ }
110
+ entry.dependencies.push(dependency);
111
+ }
112
+ for (const item of jsonLfxEntry.transitivePeerDependencies) {
113
+ entry.transitivePeerDependencies.add(item);
114
+ }
115
+ for (const referrerJsonId of jsonLfxEntry.referrerJsonIds) {
116
+ entry.referrers.push(fromJsonId(referrerJsonId));
117
+ }
118
+ }
119
+ return graph;
120
+ }
121
+ //# sourceMappingURL=lfxGraphSerializer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lfxGraphSerializer.js","sourceRoot":"","sources":["../../../src/packlets/lfx-shared/lfxGraphSerializer.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;AAK3D,0CAmEC;AAED,kDAkEC;AAzID,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;QAC5D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,MAAM,CAAC;IAChB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AAU,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 version: dependency.version,\n entryId: dependency.entryId,\n dependencyType: dependency.dependencyType,\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 version: jsonLfxDependency.version,\n dependencyType: jsonLfxDependency.dependencyType,\n containingEntry: entry,\n entryId: jsonLfxDependency.entryId,\n peerDependencyMeta: {\n name: jsonLfxDependency.peerDependencyMeta.name,\n version: jsonLfxDependency.peerDependencyMeta.version,\n optional: jsonLfxDependency.peerDependencyMeta.optional\n }\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"]}