@lage-run/hasher 0.1.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.
Files changed (73) hide show
  1. package/.eslintignore +2 -0
  2. package/CHANGELOG.json +20 -0
  3. package/CHANGELOG.md +13 -0
  4. package/README.md +2 -0
  5. package/jest.config.js +1 -0
  6. package/lib/__fixtures__/config/backfill.config.d.ts +1 -0
  7. package/lib/__fixtures__/config/backfill.config.js +5 -0
  8. package/lib/__fixtures__/config/backfill.config.js.map +1 -0
  9. package/lib/__fixtures__/config/packages/package-1/backfill.config.d.ts +0 -0
  10. package/lib/__fixtures__/config/packages/package-1/backfill.config.js +2 -0
  11. package/lib/__fixtures__/config/packages/package-1/backfill.config.js.map +1 -0
  12. package/lib/__tests__/createPackageHashes.test.d.ts +1 -0
  13. package/lib/__tests__/createPackageHashes.test.js +43 -0
  14. package/lib/__tests__/createPackageHashes.test.js.map +1 -0
  15. package/lib/__tests__/getPackageDeps.test.d.ts +1 -0
  16. package/lib/__tests__/getPackageDeps.test.js +287 -0
  17. package/lib/__tests__/getPackageDeps.test.js.map +1 -0
  18. package/lib/__tests__/getRepoDeps.test.d.ts +1 -0
  19. package/lib/__tests__/getRepoDeps.test.js +238 -0
  20. package/lib/__tests__/getRepoDeps.test.js.map +1 -0
  21. package/lib/__tests__/getRepoState.test.d.ts +1 -0
  22. package/lib/__tests__/getRepoState.test.js +67 -0
  23. package/lib/__tests__/getRepoState.test.js.map +1 -0
  24. package/lib/__tests__/hashOfFiles.test.d.ts +1 -0
  25. package/lib/__tests__/hashOfFiles.test.js +100 -0
  26. package/lib/__tests__/hashOfFiles.test.js.map +1 -0
  27. package/lib/__tests__/helpers.test.d.ts +1 -0
  28. package/lib/__tests__/helpers.test.js +27 -0
  29. package/lib/__tests__/helpers.test.js.map +1 -0
  30. package/lib/__tests__/index.test.d.ts +1 -0
  31. package/lib/__tests__/index.test.js +87 -0
  32. package/lib/__tests__/index.test.js.map +1 -0
  33. package/lib/__tests__/resolveDependenciesHelper.d.ts +3 -0
  34. package/lib/__tests__/resolveDependenciesHelper.js +41 -0
  35. package/lib/__tests__/resolveDependenciesHelper.js.map +1 -0
  36. package/lib/__tests__/resolveExternalDependencies.test.d.ts +1 -0
  37. package/lib/__tests__/resolveExternalDependencies.test.js +108 -0
  38. package/lib/__tests__/resolveExternalDependencies.test.js.map +1 -0
  39. package/lib/__tests__/resolveInternalDependencies.test.d.ts +1 -0
  40. package/lib/__tests__/resolveInternalDependencies.test.js +100 -0
  41. package/lib/__tests__/resolveInternalDependencies.test.js.map +1 -0
  42. package/lib/createPackageHashes.d.ts +4 -0
  43. package/lib/createPackageHashes.js +41 -0
  44. package/lib/createPackageHashes.js.map +1 -0
  45. package/lib/getPackageDeps.d.ts +45 -0
  46. package/lib/getPackageDeps.js +254 -0
  47. package/lib/getPackageDeps.js.map +1 -0
  48. package/lib/getRepoState.d.ts +76 -0
  49. package/lib/getRepoState.js +271 -0
  50. package/lib/getRepoState.js.map +1 -0
  51. package/lib/hashOfFiles.d.ts +14 -0
  52. package/lib/hashOfFiles.js +65 -0
  53. package/lib/hashOfFiles.js.map +1 -0
  54. package/lib/hashOfPackage.d.ts +9 -0
  55. package/lib/hashOfPackage.js +52 -0
  56. package/lib/hashOfPackage.js.map +1 -0
  57. package/lib/helpers.d.ts +3 -0
  58. package/lib/helpers.js +31 -0
  59. package/lib/helpers.js.map +1 -0
  60. package/lib/index.d.ts +13 -0
  61. package/lib/index.js +66 -0
  62. package/lib/index.js.map +1 -0
  63. package/lib/repoInfo.d.ts +26 -0
  64. package/lib/repoInfo.js +68 -0
  65. package/lib/repoInfo.js.map +1 -0
  66. package/lib/resolveExternalDependencies.d.ts +11 -0
  67. package/lib/resolveExternalDependencies.js +59 -0
  68. package/lib/resolveExternalDependencies.js.map +1 -0
  69. package/lib/resolveInternalDependencies.d.ts +6 -0
  70. package/lib/resolveInternalDependencies.js +15 -0
  71. package/lib/resolveInternalDependencies.js.map +1 -0
  72. package/package.json +30 -0
  73. package/tsconfig.json +7 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveDependenciesHelper.js","sourceRoot":"","sources":["../../src/__tests__/resolveDependenciesHelper.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,iEAAsD;AACtD,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;AAEhE,qDAA0F;AAEnF,KAAK,UAAU,+BAA+B,CAAC,OAAe,EAAE,cAAmB;IACxF,MAAM,QAAQ,GAAG,IAAI,2BAAQ,CAAC,UAAU,CAAC,CAAC;IAC1C,MAAM,QAAQ,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC;IAElC,MAAM,qBAAqB,GAAG,IAAA,mCAAiB,EAAC,WAAW,CAAC,CAAC;IAE7D,MAAM,YAAY,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;IAE5D,MAAM,oBAAoB,GAAG,cAAc,CAAC,YAAY,EAAE,qBAAqB,CAAC,CAAC;IAEjF,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAZD,0EAYC;AAEM,KAAK,UAAU,+BAA+B,CAAC,OAAe,EAAE,cAAmB;IACxF,MAAM,QAAQ,GAAG,IAAI,2BAAQ,CAAC,UAAU,CAAC,CAAC;IAC1C,MAAM,QAAQ,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC;IAElC,MAAM,qBAAqB,GAAG,IAAA,mCAAiB,EAAC,WAAW,CAAC,CAAC;IAE7D,MAAM,YAAY,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;IAE5D,MAAM,oBAAoB,GAAG,cAAc,CAAC,YAAY,EAAE,qBAAqB,CAAC,CAAC;IAEjF,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAZD,0EAYC;AAEM,KAAK,UAAU,+BAA+B,CAAC,OAAe,EAAE,cAAmB;IACxF,MAAM,QAAQ,GAAG,IAAI,2BAAQ,CAAC,UAAU,CAAC,CAAC;IAC1C,MAAM,QAAQ,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC;IAElC,MAAM,qBAAqB,GAAG,IAAA,mCAAiB,EAAC,WAAW,CAAC,CAAC;IAE7D,MAAM,YAAY,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;IAE5D,MAAM,oBAAoB,GAAG,cAAc,CAAC,YAAY,EAAE,qBAAqB,CAAC,CAAC;IAEjF,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAZD,0EAYC"}
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const workspace_tools_1 = require("workspace-tools");
7
+ const resolveExternalDependencies_1 = require("../resolveExternalDependencies");
8
+ const resolveDependenciesHelper_1 = require("./resolveDependenciesHelper");
9
+ const path_1 = __importDefault(require("path"));
10
+ const monorepo_fixture_1 = require("@lage-run/monorepo-fixture");
11
+ const fixturesPath = path_1.default.join(__dirname, "..", "__fixtures__");
12
+ describe("filterExternalDependencies()", () => {
13
+ it("only lists external dependencies", async () => {
14
+ const results = await (0, resolveDependenciesHelper_1.filterDependenciesInYarnFixture)("monorepo", resolveExternalDependencies_1.filterExternalDependencies);
15
+ expect(results).toEqual({ foo: "1.0.0" });
16
+ });
17
+ it("identifies all dependencies as external packages if there are no workspaces", async () => {
18
+ const results = await (0, resolveDependenciesHelper_1.filterDependenciesInYarnFixture)("basic", resolveExternalDependencies_1.filterExternalDependencies);
19
+ expect(results).toEqual({ foo: "1.0.0", "package-a": "1.0.0" });
20
+ });
21
+ });
22
+ describe("addToQueue()", () => {
23
+ it("adds external dependencies to queue", () => {
24
+ const externalDependencies = { foo: "1.0.0" };
25
+ const done = [];
26
+ const queue = [];
27
+ (0, resolveExternalDependencies_1.addToQueue)(externalDependencies, done, queue);
28
+ const expectedQueue = [["foo", "1.0.0"]];
29
+ expect(queue).toEqual(expectedQueue);
30
+ });
31
+ it("doesn't add to the queue if the dependency has been visited", () => {
32
+ const externalDependencies = { foo: "1.0.0" };
33
+ const done = ["foo@1.0.0"];
34
+ const queue = [];
35
+ (0, resolveExternalDependencies_1.addToQueue)(externalDependencies, done, queue);
36
+ expect(queue).toEqual([]);
37
+ });
38
+ it("doesn't add to queue if the dependency is already in the queue", () => {
39
+ const externalDependencies = { foo: "1.0.0" };
40
+ const done = [];
41
+ const queue = [["foo", "1.0.0"]];
42
+ (0, resolveExternalDependencies_1.addToQueue)(externalDependencies, done, queue);
43
+ const expectedQueue = [["foo", "1.0.0"]];
44
+ expect(queue).toEqual(expectedQueue);
45
+ });
46
+ });
47
+ describe("resolveExternalDependencies() - yarn", () => {
48
+ it("given a list of external dependencies and a parsed Lock file, add all dependencies, transitively", async () => {
49
+ const monorepo = new monorepo_fixture_1.Monorepo("monorepo");
50
+ await monorepo.init(path_1.default.join(fixturesPath, "monorepo"));
51
+ const packageRoot = monorepo.root;
52
+ const workspaces = (0, workspace_tools_1.getYarnWorkspaces)(packageRoot);
53
+ const allDependencies = { "package-a": "1.0.0", foo: "1.0.0" };
54
+ const parsedLockFile = await (0, workspace_tools_1.parseLockFile)(packageRoot);
55
+ const resolvedDependencies = (0, resolveExternalDependencies_1.resolveExternalDependencies)(allDependencies, workspaces, parsedLockFile);
56
+ expect(resolvedDependencies).toEqual(["foo@1.0.0", "bar@^1.0.0"]);
57
+ await monorepo.cleanup();
58
+ });
59
+ });
60
+ describe("resolveExternalDependencies() - pnpm", () => {
61
+ it("given a list of external dependencies and a parsed Lock file, add all dependencies, transitively", async () => {
62
+ const monorepo = new monorepo_fixture_1.Monorepo("monorepo");
63
+ await monorepo.init(path_1.default.join(fixturesPath, "monorepo-pnpm"));
64
+ const packageRoot = monorepo.root;
65
+ const workspaces = (0, workspace_tools_1.getPnpmWorkspaces)(packageRoot);
66
+ const allDependencies = {
67
+ "package-a": "1.0.0",
68
+ once: "1.4.0",
69
+ };
70
+ const parsedLockFile = await (0, workspace_tools_1.parseLockFile)(packageRoot);
71
+ const resolvedDependencies = (0, resolveExternalDependencies_1.resolveExternalDependencies)(allDependencies, workspaces, parsedLockFile);
72
+ expect(resolvedDependencies).toEqual(["once@1.4.0", "wrappy@1.0.2"]);
73
+ await monorepo.cleanup();
74
+ });
75
+ });
76
+ describe("resolveExternalDependencies() - rush+pnpm", () => {
77
+ it("given a list of external dependencies and a parsed Lock file, add all dependencies, transitively", async () => {
78
+ const monorepo = new monorepo_fixture_1.Monorepo("monorepo");
79
+ await monorepo.init(path_1.default.join(fixturesPath, "monorepo-rush-pnpm"));
80
+ const packageRoot = monorepo.root;
81
+ const workspaces = (0, workspace_tools_1.getRushWorkspaces)(packageRoot);
82
+ const allDependencies = {
83
+ "package-a": "1.0.0",
84
+ once: "1.4.0",
85
+ };
86
+ const parsedLockFile = await (0, workspace_tools_1.parseLockFile)(packageRoot);
87
+ const resolvedDependencies = (0, resolveExternalDependencies_1.resolveExternalDependencies)(allDependencies, workspaces, parsedLockFile);
88
+ expect(resolvedDependencies).toEqual(["once@1.4.0", "wrappy@1.0.2"]);
89
+ await monorepo.cleanup();
90
+ });
91
+ });
92
+ describe("resolveExternalDependencies() - rush+yarn", () => {
93
+ it("given a list of external dependencies and a parsed Lock file, add all dependencies, transitively", async () => {
94
+ const monorepo = new monorepo_fixture_1.Monorepo("monorepo");
95
+ await monorepo.init(path_1.default.join(fixturesPath, "monorepo-rush-yarn"));
96
+ const packageRoot = monorepo.root;
97
+ const workspaces = (0, workspace_tools_1.getRushWorkspaces)(packageRoot);
98
+ const allDependencies = {
99
+ "package-a": "1.0.0",
100
+ once: "1.4.0",
101
+ };
102
+ const parsedLockFile = await (0, workspace_tools_1.parseLockFile)(packageRoot);
103
+ const resolvedDependencies = (0, resolveExternalDependencies_1.resolveExternalDependencies)(allDependencies, workspaces, parsedLockFile);
104
+ expect(resolvedDependencies).toEqual(["once@1.4.0", "wrappy@1.0.2"]);
105
+ await monorepo.cleanup();
106
+ });
107
+ });
108
+ //# sourceMappingURL=resolveExternalDependencies.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveExternalDependencies.test.js","sourceRoot":"","sources":["../../src/__tests__/resolveExternalDependencies.test.ts"],"names":[],"mappings":";;;;;AAAA,qDAAyG;AAEzG,gFAAqH;AACrH,2EAA8E;AAC9E,gDAAwB;AACxB,iEAAsD;AACtD,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;AAEhE,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAChD,MAAM,OAAO,GAAG,MAAM,IAAA,2DAA+B,EAAC,UAAU,EAAE,wDAA0B,CAAC,CAAC;QAC9F,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6EAA6E,EAAE,KAAK,IAAI,EAAE;QAC3F,MAAM,OAAO,GAAG,MAAM,IAAA,2DAA+B,EAAC,OAAO,EAAE,wDAA0B,CAAC,CAAC;QAC3F,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,EA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,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,2CAA2C,EAAE,GAAG,EAAE;IACzD,EAAE,CAAC,kGAAkG,EAAE,KAAK,IAAI,EAAE;QAChH,MAAM,QAAQ,GAAG,IAAI,2BAAQ,CAAC,UAAU,CAAC,CAAC;QAC1C,MAAM,QAAQ,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC;QAClC,MAAM,UAAU,GAAG,IAAA,mCAAiB,EAAC,WAAW,CAAC,CAAC;QAElD,MAAM,eAAe,GAAG;YACtB,WAAW,EAAE,OAAO;YACpB,IAAI,EAAE,OAAO;SACd,CAAC;QACF,MAAM,cAAc,GAAG,MAAM,IAAA,+BAAa,EAAC,WAAW,CAAC,CAAC;QAExD,MAAM,oBAAoB,GAAG,IAAA,yDAA2B,EAAC,eAAe,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;QAEtG,MAAM,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC;QACrE,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const workspace_tools_1 = require("workspace-tools");
7
+ const resolveInternalDependencies_1 = require("../resolveInternalDependencies");
8
+ const resolveDependenciesHelper_1 = require("./resolveDependenciesHelper");
9
+ const path_1 = __importDefault(require("path"));
10
+ const monorepo_fixture_1 = require("@lage-run/monorepo-fixture");
11
+ const fixturesPath = path_1.default.join(__dirname, "..", "__fixtures__");
12
+ describe("filterInternalDependencies() for yarn", () => {
13
+ it("only lists internal dependencies", async () => {
14
+ const results = await (0, resolveDependenciesHelper_1.filterDependenciesInYarnFixture)("monorepo", resolveInternalDependencies_1.filterInternalDependencies);
15
+ expect(results).toEqual(["package-a"]);
16
+ });
17
+ it("lists no internal packages if there are no workspaces", async () => {
18
+ const results = await (0, resolveDependenciesHelper_1.filterDependenciesInYarnFixture)("basic", resolveInternalDependencies_1.filterInternalDependencies);
19
+ expect(results).toEqual([]);
20
+ });
21
+ });
22
+ describe("resolveInternalDependencies() for yarn", () => {
23
+ it("adds internal dependency names to the processedPackages list", async () => {
24
+ const monorepo = new monorepo_fixture_1.Monorepo("monorepo");
25
+ await monorepo.init(path_1.default.join(fixturesPath, "monorepo"));
26
+ const packageRoot = monorepo.root;
27
+ const workspaces = (0, workspace_tools_1.getYarnWorkspaces)(packageRoot);
28
+ const dependencies = { "package-a": "1.0.0", foo: "1.0.0" };
29
+ const resolvedDependencies = (0, resolveInternalDependencies_1.resolveInternalDependencies)(dependencies, workspaces);
30
+ expect(resolvedDependencies).toEqual(["package-a"]);
31
+ await monorepo.cleanup();
32
+ });
33
+ });
34
+ describe("filterInternalDependencies() for pnpm", () => {
35
+ it("only lists internal dependencies", async () => {
36
+ const results = await (0, resolveDependenciesHelper_1.filterDependenciesInPnpmFixture)("monorepo-pnpm", resolveInternalDependencies_1.filterInternalDependencies);
37
+ expect(results).toEqual(["package-a"]);
38
+ });
39
+ it("lists no internal packages if there are no workspaces", async () => {
40
+ const results = await (0, resolveDependenciesHelper_1.filterDependenciesInPnpmFixture)("basic", resolveInternalDependencies_1.filterInternalDependencies);
41
+ expect(results).toEqual([]);
42
+ });
43
+ });
44
+ describe("resolveInternalDependencies() for pnpm", () => {
45
+ it("adds internal dependency names to the processedPackages list", async () => {
46
+ const monorepo = new monorepo_fixture_1.Monorepo("monorepo");
47
+ await monorepo.init(path_1.default.join(fixturesPath, "monorepo-pnpm"));
48
+ const packageRoot = monorepo.root;
49
+ const workspaces = (0, workspace_tools_1.getPnpmWorkspaces)(packageRoot);
50
+ const dependencies = { "package-a": "1.0.0", foo: "1.0.0" };
51
+ const resolvedDependencies = (0, resolveInternalDependencies_1.resolveInternalDependencies)(dependencies, workspaces);
52
+ expect(resolvedDependencies).toEqual(["package-a"]);
53
+ await monorepo.cleanup();
54
+ });
55
+ });
56
+ describe("filterInternalDependencies() for rush+pnpm", () => {
57
+ it("only lists internal dependencies", async () => {
58
+ const results = await (0, resolveDependenciesHelper_1.filterDependenciesInRushFixture)("monorepo-rush-pnpm", resolveInternalDependencies_1.filterInternalDependencies);
59
+ expect(results).toEqual(["package-a"]);
60
+ });
61
+ it("lists no internal packages if there are no workspaces", async () => {
62
+ const results = await (0, resolveDependenciesHelper_1.filterDependenciesInRushFixture)("basic", resolveInternalDependencies_1.filterInternalDependencies);
63
+ expect(results).toEqual([]);
64
+ });
65
+ });
66
+ describe("resolveInternalDependencies() for rush+pnpm", () => {
67
+ it("adds internal dependency names to the processedPackages list", async () => {
68
+ const monorepo = new monorepo_fixture_1.Monorepo("monorepo");
69
+ await monorepo.init(path_1.default.join(fixturesPath, "monorepo-rush-pnpm"));
70
+ const packageRoot = monorepo.root;
71
+ const workspaces = (0, workspace_tools_1.getRushWorkspaces)(packageRoot);
72
+ const dependencies = { "package-a": "1.0.0", foo: "1.0.0" };
73
+ const resolvedDependencies = (0, resolveInternalDependencies_1.resolveInternalDependencies)(dependencies, workspaces);
74
+ expect(resolvedDependencies).toEqual(["package-a"]);
75
+ await monorepo.cleanup();
76
+ });
77
+ });
78
+ describe("filterInternalDependencies() for rush+yarn", () => {
79
+ it("only lists internal dependencies", async () => {
80
+ const results = await (0, resolveDependenciesHelper_1.filterDependenciesInRushFixture)("monorepo-rush-yarn", resolveInternalDependencies_1.filterInternalDependencies);
81
+ expect(results).toEqual(["package-a"]);
82
+ });
83
+ it("lists no internal packages if there are no workspaces", async () => {
84
+ const results = await (0, resolveDependenciesHelper_1.filterDependenciesInRushFixture)("basic", resolveInternalDependencies_1.filterInternalDependencies);
85
+ expect(results).toEqual([]);
86
+ });
87
+ });
88
+ describe("resolveInternalDependencies() for rush+yarn", () => {
89
+ it("adds internal dependency names to the processedPackages list", async () => {
90
+ const monorepo = new monorepo_fixture_1.Monorepo("monorepo");
91
+ await monorepo.init(path_1.default.join(fixturesPath, "monorepo-rush-yarn"));
92
+ const packageRoot = monorepo.root;
93
+ const workspaces = (0, workspace_tools_1.getRushWorkspaces)(packageRoot);
94
+ const dependencies = { "package-a": "1.0.0", foo: "1.0.0" };
95
+ const resolvedDependencies = (0, resolveInternalDependencies_1.resolveInternalDependencies)(dependencies, workspaces);
96
+ expect(resolvedDependencies).toEqual(["package-a"]);
97
+ await monorepo.cleanup();
98
+ });
99
+ });
100
+ //# sourceMappingURL=resolveInternalDependencies.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveInternalDependencies.test.js","sourceRoot":"","sources":["../../src/__tests__/resolveInternalDependencies.test.ts"],"names":[],"mappings":";;;;;AAAA,qDAA0F;AAE1F,gFAAyG;AACzG,2EAIqC;AACrC,gDAAwB;AACxB,iEAAsD;AACtD,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;AAEhE,QAAQ,CAAC,uCAAuC,EAAE,GAAG,EAAE;IACrD,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAChD,MAAM,OAAO,GAAG,MAAM,IAAA,2DAA+B,EAAC,UAAU,EAAE,wDAA0B,CAAC,CAAC;QAE9F,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uDAAuD,EAAE,KAAK,IAAI,EAAE;QACrE,MAAM,OAAO,GAAG,MAAM,IAAA,2DAA+B,EAAC,OAAO,EAAE,wDAA0B,CAAC,CAAC;QAE3F,MAAM,CAAC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,CAAC,CAAC;QAE3F,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,6CAA6C,EAAE,GAAG,EAAE;IAC3D,EAAE,CAAC,8DAA8D,EAAE,KAAK,IAAI,EAAE;QAC5E,MAAM,QAAQ,GAAG,IAAI,2BAAQ,CAAC,UAAU,CAAC,CAAC;QAC1C,MAAM,QAAQ,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC;QAClC,MAAM,UAAU,GAAG,IAAA,mCAAiB,EAAC,WAAW,CAAC,CAAC;QAElD,MAAM,YAAY,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;QAE5D,MAAM,oBAAoB,GAAG,IAAA,yDAA2B,EAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QAEnF,MAAM,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;QACpD,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { WorkspaceInfo } from "workspace-tools";
2
+ export declare function createPackageHashes(root: string, workspaceInfo: WorkspaceInfo, repoHashes: {
3
+ [key: string]: string;
4
+ }): Record<string, [string, string][]>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createPackageHashes = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ function createPackageHashes(root, workspaceInfo, repoHashes) {
9
+ const pathTree = {};
10
+ // Generate path tree of all packages in workspace (scale: ~2000 * ~3)
11
+ for (const workspace of workspaceInfo) {
12
+ const pathParts = path_1.default.relative(root, workspace.path).split(/[\\/]/);
13
+ let currentNode = pathTree;
14
+ for (const part of pathParts) {
15
+ currentNode[part] = currentNode[part] || {};
16
+ currentNode = currentNode[part];
17
+ }
18
+ }
19
+ // key: path/to/package (packageRoot), value: array of a tuple of [file, hash]
20
+ const packageHashes = {};
21
+ for (const [entry, value] of Object.entries(repoHashes)) {
22
+ const pathParts = entry.split(/[\\/]/);
23
+ let node = pathTree;
24
+ const packagePathParts = [];
25
+ for (const part of pathParts) {
26
+ if (node[part]) {
27
+ node = node[part];
28
+ packagePathParts.push(part);
29
+ }
30
+ else {
31
+ break;
32
+ }
33
+ }
34
+ const packageRoot = packagePathParts.join("/");
35
+ packageHashes[packageRoot] = packageHashes[packageRoot] || [];
36
+ packageHashes[packageRoot].push([entry, value]);
37
+ }
38
+ return packageHashes;
39
+ }
40
+ exports.createPackageHashes = createPackageHashes;
41
+ //# sourceMappingURL=createPackageHashes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPackageHashes.js","sourceRoot":"","sources":["../src/createPackageHashes.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGxB,SAAgB,mBAAmB,CAAC,IAAY,EAAE,aAA4B,EAAE,UAAqC;IAenH,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,sEAAsE;IACtE,KAAK,MAAM,SAAS,IAAI,aAAa,EAAE;QACrC,MAAM,SAAS,GAAG,cAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAErE,IAAI,WAAW,GAAG,QAAQ,CAAC;QAE3B,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE;YAC5B,WAAW,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5C,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;SACjC;KACF;IAED,8EAA8E;IAC9E,MAAM,aAAa,GAAuC,EAAE,CAAC;IAE7D,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QACvD,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEvC,IAAI,IAAI,GAAG,QAAQ,CAAC;QACpB,MAAM,gBAAgB,GAAa,EAAE,CAAC;QAEtC,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE;YAC5B,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE;gBACd,IAAI,GAAG,IAAI,CAAC,IAAI,CAAa,CAAC;gBAC9B,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC7B;iBAAM;gBACL,MAAM;aACP;SACF;QAED,MAAM,WAAW,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,aAAa,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAC9D,aAAa,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;KACjD;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AArDD,kDAqDC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Parses a quoted filename sourced from the output of the "git status" command.
3
+ *
4
+ * Paths with non-standard characters will be enclosed with double-quotes, and non-standard
5
+ * characters will be backslash escaped (ex. double-quotes, non-ASCII characters). The
6
+ * escaped chars can be included in one of two ways:
7
+ * - backslash-escaped chars (ex. \")
8
+ * - octal encoded chars (ex. \347)
9
+ *
10
+ * See documentation: https://git-scm.com/docs/git-status
11
+ */
12
+ export declare function parseGitFilename(filename: string): string;
13
+ /**
14
+ * Parses the output of the "git ls-tree" command
15
+ */
16
+ export declare function parseGitLsTree(output: string): Map<string, string>;
17
+ /**
18
+ * Parses the output of the "git status" command
19
+ */
20
+ export declare function parseGitStatus(output: string): Map<string, string>;
21
+ /**
22
+ * Takes a list of files and returns the current git hashes for them
23
+ *
24
+ * @public
25
+ */
26
+ export declare function getGitHashForFiles(filesToHash: string[], packagePath: string, gitPath?: string): Map<string, string>;
27
+ /**
28
+ * Executes "git ls-tree" in a folder
29
+ */
30
+ export declare function gitLsTree(path: string, gitPath?: string): string;
31
+ /**
32
+ * Executes "git status" in a folder
33
+ */
34
+ export declare function gitStatus(path: string, gitPath?: string): string;
35
+ /**
36
+ * Builds an object containing hashes for the files under the specified `packagePath` folder.
37
+ * @param packagePath - The folder path to derive the package dependencies from. This is typically the folder
38
+ * containing package.json. If omitted, the default value is the current working directory.
39
+ * @param excludedPaths - An optional array of file path exclusions. If a file should be omitted from the list
40
+ * of dependencies, use this to exclude it.
41
+ * @returns the package-deps.json file content
42
+ *
43
+ * @public
44
+ */
45
+ export declare function getPackageDeps(packagePath?: string, excludedPaths?: string[], gitPath?: string): Map<string, string>;
@@ -0,0 +1,254 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.getPackageDeps = exports.gitStatus = exports.gitLsTree = exports.getGitHashForFiles = exports.parseGitStatus = exports.parseGitLsTree = exports.parseGitFilename = void 0;
30
+ const path = __importStar(require("path"));
31
+ const getRepoState_js_1 = require("./getRepoState.js");
32
+ const execa_1 = __importDefault(require("execa"));
33
+ /**
34
+ * Parses a quoted filename sourced from the output of the "git status" command.
35
+ *
36
+ * Paths with non-standard characters will be enclosed with double-quotes, and non-standard
37
+ * characters will be backslash escaped (ex. double-quotes, non-ASCII characters). The
38
+ * escaped chars can be included in one of two ways:
39
+ * - backslash-escaped chars (ex. \")
40
+ * - octal encoded chars (ex. \347)
41
+ *
42
+ * See documentation: https://git-scm.com/docs/git-status
43
+ */
44
+ function parseGitFilename(filename) {
45
+ // If there are no double-quotes around the string, then there are no escaped characters
46
+ // to decode, so just return
47
+ if (!filename.match(/^".+"$/)) {
48
+ return filename;
49
+ }
50
+ // Need to hex encode '%' since we will be decoding the converted octal values from hex
51
+ filename = filename.replace(/%/g, "%25");
52
+ // Replace all instances of octal literals with percent-encoded hex (ex. '\347\275\221' -> '%E7%BD%91').
53
+ // This is done because the octal literals represent UTF-8 bytes, and by converting them to percent-encoded
54
+ // hex, we can use decodeURIComponent to get the Unicode chars.
55
+ filename = filename.replace(/(?:\\(\d{1,3}))/g, (match, ...[octalValue, index, source]) => {
56
+ // We need to make sure that the backslash is intended to escape the octal value. To do this, walk
57
+ // backwards from the match to ensure that it's already escaped.
58
+ const trailingBackslashes = source.slice(0, index).match(/\\*$/);
59
+ return trailingBackslashes && trailingBackslashes.length > 0 && trailingBackslashes[0].length % 2 === 0
60
+ ? `%${parseInt(octalValue, 8).toString(16)}`
61
+ : match;
62
+ });
63
+ // Finally, decode the filename and unescape the escaped UTF-8 chars
64
+ return JSON.parse(decodeURIComponent(filename));
65
+ }
66
+ exports.parseGitFilename = parseGitFilename;
67
+ /**
68
+ * Parses the output of the "git ls-tree" command
69
+ */
70
+ function parseGitLsTree(output) {
71
+ const changes = new Map();
72
+ if (output) {
73
+ // A line is expected to look like:
74
+ // 100644 blob 3451bccdc831cb43d7a70ed8e628dcf9c7f888c8 src/typings/tsd.d.ts
75
+ // 160000 commit c5880bf5b0c6c1f2e2c43c95beeb8f0a808e8bac rushstack
76
+ const gitRegex = /([0-9]{6})\s(blob|commit)\s([a-f0-9]{40})\s*(.*)/;
77
+ // Note: The output of git ls-tree uses \n newlines regardless of OS.
78
+ const outputLines = output.trim().split("\n");
79
+ for (const line of outputLines) {
80
+ if (line) {
81
+ // Take everything after the "100644 blob", which is just the hash and filename
82
+ const matches = line.match(gitRegex);
83
+ if (matches && matches[3] && matches[4]) {
84
+ const hash = matches[3];
85
+ const filename = parseGitFilename(matches[4]);
86
+ changes.set(filename, hash);
87
+ }
88
+ else {
89
+ throw new Error(`Cannot parse git ls-tree input: "${line}"`);
90
+ }
91
+ }
92
+ }
93
+ }
94
+ return changes;
95
+ }
96
+ exports.parseGitLsTree = parseGitLsTree;
97
+ /**
98
+ * Parses the output of the "git status" command
99
+ */
100
+ function parseGitStatus(output) {
101
+ const changes = new Map();
102
+ /*
103
+ * Typically, output will look something like:
104
+ * M temp_modules/rush-package-deps-hash/package.json
105
+ * D package-deps-hash/src/index.ts
106
+ */
107
+ // If there was an issue with `git ls-tree`, or there are no current changes, processOutputBlocks[1]
108
+ // will be empty or undefined
109
+ if (!output) {
110
+ return changes;
111
+ }
112
+ // Note: The output of git hash-object uses \n newlines regardless of OS.
113
+ const outputLines = output.trim().split("\n");
114
+ for (const line of outputLines) {
115
+ /*
116
+ * changeType is in the format of "XY" where "X" is the status of the file in the index and "Y" is the status of
117
+ * the file in the working tree. Some example statuses:
118
+ * - 'D' == deletion
119
+ * - 'M' == modification
120
+ * - 'A' == addition
121
+ * - '??' == untracked
122
+ * - 'R' == rename
123
+ * - 'RM' == rename with modifications
124
+ * - '[MARC]D' == deleted in work tree
125
+ * Full list of examples: https://git-scm.com/docs/git-status#_short_format
126
+ */
127
+ const match = line.match(/("(\\"|[^"])+")|(\S+\s*)/g);
128
+ if (match && match.length > 1) {
129
+ const [changeType, ...filenameMatches] = match;
130
+ // We always care about the last filename in the filenames array. In the case of non-rename changes,
131
+ // the filenames array only contains one file, so we can join all segments that were split on spaces.
132
+ // In the case of rename changes, the last item in the array is the path to the file in the working tree,
133
+ // which is the only one that we care about. It is also surrounded by double-quotes if spaces are
134
+ // included, so no need to worry about joining different segments
135
+ let lastFilename = changeType.startsWith("R") ? filenameMatches[filenameMatches.length - 1] : filenameMatches.join("");
136
+ lastFilename = parseGitFilename(lastFilename);
137
+ changes.set(lastFilename, changeType.trimRight());
138
+ }
139
+ }
140
+ return changes;
141
+ }
142
+ exports.parseGitStatus = parseGitStatus;
143
+ /**
144
+ * Takes a list of files and returns the current git hashes for them
145
+ *
146
+ * @public
147
+ */
148
+ function getGitHashForFiles(filesToHash, packagePath, gitPath) {
149
+ const changes = new Map();
150
+ if (filesToHash.length) {
151
+ // Use --stdin-paths arg to pass the list of files to git in order to avoid issues with
152
+ // command length
153
+ const result = execa_1.default.sync(gitPath || "git", ["hash-object", "--stdin-paths"], {
154
+ input: filesToHash.map((x) => path.resolve(packagePath, x)).join("\n"),
155
+ });
156
+ if (result.exitCode !== 0) {
157
+ (0, getRepoState_js_1.ensureGitMinimumVersion)(gitPath);
158
+ throw new Error(`git hash-object exited with status ${result.exitCode}: ${result.stderr}`);
159
+ }
160
+ const hashStdout = result.stdout.trim();
161
+ // The result of "git hash-object" will be a list of file hashes delimited by newlines
162
+ const hashes = hashStdout.split("\n");
163
+ if (hashes.length !== filesToHash.length) {
164
+ throw new Error(`Passed ${filesToHash.length} file paths to Git to hash, but received ${hashes.length} hashes.`);
165
+ }
166
+ for (let i = 0; i < hashes.length; i++) {
167
+ const hash = hashes[i];
168
+ const filePath = filesToHash[i];
169
+ changes.set(filePath, hash);
170
+ }
171
+ }
172
+ return changes;
173
+ }
174
+ exports.getGitHashForFiles = getGitHashForFiles;
175
+ /**
176
+ * Executes "git ls-tree" in a folder
177
+ */
178
+ function gitLsTree(path, gitPath) {
179
+ const result = execa_1.default.sync(gitPath || "git", ["ls-tree", "HEAD", "-r"], {
180
+ cwd: path,
181
+ });
182
+ if (result.exitCode !== 0) {
183
+ (0, getRepoState_js_1.ensureGitMinimumVersion)(gitPath);
184
+ throw new Error(`git ls-tree exited with status ${result.exitCode}: ${result.stderr}`);
185
+ }
186
+ return result.stdout;
187
+ }
188
+ exports.gitLsTree = gitLsTree;
189
+ /**
190
+ * Executes "git status" in a folder
191
+ */
192
+ function gitStatus(path, gitPath) {
193
+ /**
194
+ * -s - Short format. Will be printed as 'XY PATH' or 'XY ORIG_PATH -> PATH'. Paths with non-standard
195
+ * characters will be escaped using double-quotes, and non-standard characters will be backslash
196
+ * escaped (ex. spaces, tabs, double-quotes)
197
+ * -u - Untracked files are included
198
+ *
199
+ * See documentation here: https://git-scm.com/docs/git-status
200
+ */
201
+ const result = execa_1.default.sync(gitPath || "git", ["status", "-s", "-u", "."], {
202
+ cwd: path,
203
+ });
204
+ if (result.exitCode !== 0) {
205
+ (0, getRepoState_js_1.ensureGitMinimumVersion)(gitPath);
206
+ throw new Error(`git status exited with status ${result.exitCode}: ${result.stderr}`);
207
+ }
208
+ return result.stdout;
209
+ }
210
+ exports.gitStatus = gitStatus;
211
+ /**
212
+ * Builds an object containing hashes for the files under the specified `packagePath` folder.
213
+ * @param packagePath - The folder path to derive the package dependencies from. This is typically the folder
214
+ * containing package.json. If omitted, the default value is the current working directory.
215
+ * @param excludedPaths - An optional array of file path exclusions. If a file should be omitted from the list
216
+ * of dependencies, use this to exclude it.
217
+ * @returns the package-deps.json file content
218
+ *
219
+ * @public
220
+ */
221
+ function getPackageDeps(packagePath = process.cwd(), excludedPaths, gitPath) {
222
+ const gitLsOutput = gitLsTree(packagePath, gitPath);
223
+ // Add all the checked in hashes
224
+ const result = parseGitLsTree(gitLsOutput);
225
+ // Remove excluded paths
226
+ if (excludedPaths) {
227
+ for (const excludedPath of excludedPaths) {
228
+ result.delete(excludedPath);
229
+ }
230
+ }
231
+ // Update the checked in hashes with the current repo status
232
+ const gitStatusOutput = gitStatus(packagePath, gitPath);
233
+ const currentlyChangedFiles = parseGitStatus(gitStatusOutput);
234
+ const filesToHash = [];
235
+ const excludedPathSet = new Set(excludedPaths);
236
+ for (const [filename, changeType] of currentlyChangedFiles) {
237
+ // See comments inside parseGitStatus() for more information
238
+ if (changeType === "D" || (changeType.length === 2 && changeType.charAt(1) === "D")) {
239
+ result.delete(filename);
240
+ }
241
+ else {
242
+ if (!excludedPathSet.has(filename)) {
243
+ filesToHash.push(filename);
244
+ }
245
+ }
246
+ }
247
+ const currentlyChangedFileHashes = getGitHashForFiles(filesToHash, packagePath, gitPath);
248
+ for (const [filename, hash] of currentlyChangedFileHashes) {
249
+ result.set(filename, hash);
250
+ }
251
+ return result;
252
+ }
253
+ exports.getPackageDeps = getPackageDeps;
254
+ //# sourceMappingURL=getPackageDeps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPackageDeps.js","sourceRoot":"","sources":["../src/getPackageDeps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAE7B,uDAA4D;AAC5D,kDAA0B;AAE1B;;;;;;;;;;GAUG;AACH,SAAgB,gBAAgB,CAAC,QAAgB;IAC/C,wFAAwF;IACxF,4BAA4B;IAC5B,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;QAC7B,OAAO,QAAQ,CAAC;KACjB;IAED,uFAAuF;IACvF,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzC,wG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