@proteinjs/reflection-build 2.0.3 → 2.1.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 (176) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/src/ReflectionDoctor.d.ts +6 -1
  3. package/dist/src/ReflectionDoctor.js +53 -51
  4. package/dist/src/ReflectionDoctor.js.map +1 -1
  5. package/dist/src/codegen/CanonicalSourceGraph.d.ts +22 -0
  6. package/dist/src/codegen/CanonicalSourceGraph.js +60 -0
  7. package/dist/src/codegen/CanonicalSourceGraph.js.map +1 -0
  8. package/dist/src/codegen/writeGeneratedIndex.d.ts +12 -3
  9. package/dist/src/codegen/writeGeneratedIndex.js +21 -13
  10. package/dist/src/codegen/writeGeneratedIndex.js.map +1 -1
  11. package/dist/src/parser/PackageSourceFiles.d.ts +30 -0
  12. package/dist/src/parser/PackageSourceFiles.js +151 -0
  13. package/dist/src/parser/PackageSourceFiles.js.map +1 -0
  14. package/dist/src/parser/SharedQualifiedNames.d.ts +43 -0
  15. package/dist/src/parser/SharedQualifiedNames.js +81 -0
  16. package/dist/src/parser/SharedQualifiedNames.js.map +1 -0
  17. package/dist/src/parser/createGraphBuilder.d.ts +6 -1
  18. package/dist/src/parser/createGraphBuilder.js +16 -31
  19. package/dist/src/parser/createGraphBuilder.js.map +1 -1
  20. package/dist/src/parser/createSourceGraph.d.ts +6 -1
  21. package/dist/src/parser/createSourceGraph.js +23 -38
  22. package/dist/src/parser/createSourceGraph.js.map +1 -1
  23. package/dist/test/Class.test.js +1 -1
  24. package/dist/test/Class.test.js.map +1 -1
  25. package/dist/test/ExamplePackageFixture.d.ts +47 -0
  26. package/dist/test/ExamplePackageFixture.js +207 -0
  27. package/dist/test/ExamplePackageFixture.js.map +1 -0
  28. package/dist/test/GraphEmitRelativePaths.test.js +1 -1
  29. package/dist/test/GraphEmitRelativePaths.test.js.map +1 -1
  30. package/dist/test/PackageSourceFiles.test.d.ts +1 -0
  31. package/dist/test/PackageSourceFiles.test.js +57 -0
  32. package/dist/test/PackageSourceFiles.test.js.map +1 -0
  33. package/dist/test/ReflectionDoctor.test.js +55 -18
  34. package/dist/test/ReflectionDoctor.test.js.map +1 -1
  35. package/dist/test/ReproducibleGeneratedIndex.test.d.ts +1 -0
  36. package/dist/test/ReproducibleGeneratedIndex.test.js +224 -0
  37. package/dist/test/ReproducibleGeneratedIndex.test.js.map +1 -0
  38. package/dist/test/SharedQualifiedNames.test.d.ts +1 -0
  39. package/dist/test/SharedQualifiedNames.test.js +186 -0
  40. package/dist/test/SharedQualifiedNames.test.js.map +1 -0
  41. package/dist/test/examples/reproducible/index.d.ts +4 -0
  42. package/dist/test/examples/reproducible/index.js +21 -0
  43. package/dist/test/examples/reproducible/index.js.map +1 -0
  44. package/dist/test/examples/reproducible/src/alpha/Alpha.d.ts +10 -0
  45. package/dist/test/examples/reproducible/src/alpha/Alpha.js +18 -0
  46. package/dist/test/examples/reproducible/src/alpha/Alpha.js.map +1 -0
  47. package/dist/test/examples/reproducible/src/alpha/Defaults.d.ts +2 -0
  48. package/dist/test/examples/reproducible/src/alpha/Defaults.js +6 -0
  49. package/dist/test/examples/reproducible/src/alpha/Defaults.js.map +1 -0
  50. package/dist/test/examples/reproducible/src/beta/Beta.d.ts +5 -0
  51. package/dist/test/examples/reproducible/src/beta/Beta.js +12 -0
  52. package/dist/test/examples/reproducible/src/beta/Beta.js.map +1 -0
  53. package/dist/test/examples/reproducible/src/beta/deep/Gamma.d.ts +4 -0
  54. package/dist/test/examples/reproducible/src/beta/deep/Gamma.js +11 -0
  55. package/dist/test/examples/reproducible/src/beta/deep/Gamma.js.map +1 -0
  56. package/dist/test/examples/reproducible/src/zeta/Defaults.d.ts +2 -0
  57. package/dist/test/examples/reproducible/src/zeta/Defaults.js +6 -0
  58. package/dist/test/examples/reproducible/src/zeta/Defaults.js.map +1 -0
  59. package/dist/test/examples/reproducible/src/zeta/Zeta.d.ts +7 -0
  60. package/dist/test/examples/reproducible/src/zeta/Zeta.js +18 -0
  61. package/dist/test/examples/reproducible/src/zeta/Zeta.js.map +1 -0
  62. package/dist/test/examples/shared-name/index.d.ts +1 -0
  63. package/dist/test/examples/shared-name/index.js +18 -0
  64. package/dist/test/examples/shared-name/index.js.map +1 -0
  65. package/dist/test/examples/shared-name/src/alpha/Widget.d.ts +4 -0
  66. package/dist/test/examples/shared-name/src/alpha/Widget.js +3 -0
  67. package/dist/test/examples/shared-name/src/alpha/Widget.js.map +1 -0
  68. package/dist/test/examples/shared-name/src/beta/Widget.d.ts +3 -0
  69. package/dist/test/examples/shared-name/src/beta/Widget.js +13 -0
  70. package/dist/test/examples/shared-name/src/beta/Widget.js.map +1 -0
  71. package/dist/test/examples/shared-name/src/gamma/Gear.d.ts +7 -0
  72. package/dist/test/examples/shared-name/src/gamma/Gear.js +5 -0
  73. package/dist/test/examples/shared-name/src/gamma/Gear.js.map +1 -0
  74. package/dist/test/examples/shared-name-pruned/index.d.ts +1 -0
  75. package/dist/test/examples/shared-name-pruned/index.js +18 -0
  76. package/dist/test/examples/shared-name-pruned/index.js.map +1 -0
  77. package/dist/test/examples/shared-name-pruned/src/alpha/Limits.d.ts +3 -0
  78. package/dist/test/examples/shared-name-pruned/src/alpha/Limits.js +6 -0
  79. package/dist/test/examples/shared-name-pruned/src/alpha/Limits.js.map +1 -0
  80. package/dist/test/examples/shared-name-pruned/src/alpha/Shape.d.ts +3 -0
  81. package/dist/test/examples/shared-name-pruned/src/alpha/Shape.js +3 -0
  82. package/dist/test/examples/shared-name-pruned/src/alpha/Shape.js.map +1 -0
  83. package/dist/test/examples/shared-name-pruned/src/alpha/Tile.d.ts +7 -0
  84. package/dist/test/examples/shared-name-pruned/src/alpha/Tile.js +11 -0
  85. package/dist/test/examples/shared-name-pruned/src/alpha/Tile.js.map +1 -0
  86. package/dist/test/examples/shared-name-pruned/src/beta/Limits.d.ts +3 -0
  87. package/dist/test/examples/shared-name-pruned/src/beta/Limits.js +6 -0
  88. package/dist/test/examples/shared-name-pruned/src/beta/Limits.js.map +1 -0
  89. package/dist/test/examples/shared-name-pruned/src/beta/Shape.d.ts +3 -0
  90. package/dist/test/examples/shared-name-pruned/src/beta/Shape.js +3 -0
  91. package/dist/test/examples/shared-name-pruned/src/beta/Shape.js.map +1 -0
  92. package/dist/test/examples/source-repository/a/generated/index.js +28 -28
  93. package/dist/test/examples/source-repository/a/generated/index.js.map +1 -1
  94. package/dist/test/examples/source-repository/a/src/ExtendsForeignType.d.ts +1 -1
  95. package/dist/test/examples/source-repository/a/src/ExtendsForeignType.js +5 -5
  96. package/dist/test/examples/source-repository/a/src/ExtendsForeignType.js.map +1 -1
  97. package/dist/test/examples/source-repository/b/generated/index.js +3 -3
  98. package/dist/test/examples/source-repository/b/generated/index.js.map +1 -1
  99. package/package.json +2 -2
  100. package/src/ReflectionDoctor.ts +37 -17
  101. package/src/codegen/CanonicalSourceGraph.ts +50 -0
  102. package/src/codegen/writeGeneratedIndex.ts +35 -9
  103. package/src/parser/PackageSourceFiles.ts +66 -0
  104. package/src/parser/SharedQualifiedNames.ts +76 -0
  105. package/src/parser/createGraphBuilder.ts +25 -10
  106. package/src/parser/createSourceGraph.ts +14 -16
  107. package/test/Class.test.ts +1 -1
  108. package/test/ExamplePackageFixture.ts +142 -0
  109. package/test/GraphEmitRelativePaths.test.ts +1 -1
  110. package/test/PackageSourceFiles.test.ts +42 -0
  111. package/test/ReflectionDoctor.test.ts +50 -12
  112. package/test/ReproducibleGeneratedIndex.test.ts +114 -0
  113. package/test/SharedQualifiedNames.test.ts +89 -0
  114. package/test/examples/reproducible/index.ts +4 -0
  115. package/test/examples/reproducible/src/alpha/Alpha.ts +13 -0
  116. package/test/examples/reproducible/src/alpha/Defaults.ts +4 -0
  117. package/test/examples/reproducible/src/beta/Beta.ts +7 -0
  118. package/test/examples/reproducible/src/beta/deep/Gamma.ts +5 -0
  119. package/test/examples/reproducible/src/zeta/Defaults.ts +4 -0
  120. package/test/examples/reproducible/src/zeta/Zeta.ts +9 -0
  121. package/test/examples/shared-name/index.ts +1 -0
  122. package/test/examples/shared-name/src/alpha/Widget.ts +6 -0
  123. package/test/examples/shared-name/src/beta/Widget.ts +5 -0
  124. package/test/examples/shared-name/src/gamma/Gear.ts +9 -0
  125. package/test/examples/shared-name-pruned/index.ts +1 -0
  126. package/test/examples/shared-name-pruned/src/alpha/Limits.ts +2 -0
  127. package/test/examples/shared-name-pruned/src/alpha/Shape.ts +3 -0
  128. package/test/examples/shared-name-pruned/src/alpha/Tile.ts +9 -0
  129. package/test/examples/shared-name-pruned/src/beta/Limits.ts +2 -0
  130. package/test/examples/shared-name-pruned/src/beta/Shape.ts +4 -0
  131. package/test/examples/source-repository/a/dist/codegen/CanonicalSourceGraph.d.ts +22 -0
  132. package/test/examples/source-repository/a/dist/codegen/CanonicalSourceGraph.js +60 -0
  133. package/test/examples/source-repository/a/dist/codegen/CanonicalSourceGraph.js.map +1 -0
  134. package/test/examples/source-repository/a/dist/codegen/writeGeneratedIndex.d.ts +12 -3
  135. package/test/examples/source-repository/a/dist/codegen/writeGeneratedIndex.js +21 -13
  136. package/test/examples/source-repository/a/dist/codegen/writeGeneratedIndex.js.map +1 -1
  137. package/test/examples/source-repository/a/dist/generated/index.js +28 -28
  138. package/test/examples/source-repository/a/dist/generated/index.js.map +1 -1
  139. package/test/examples/source-repository/a/dist/parser/PackageSourceFiles.d.ts +30 -0
  140. package/test/examples/source-repository/a/dist/parser/PackageSourceFiles.js +151 -0
  141. package/test/examples/source-repository/a/dist/parser/PackageSourceFiles.js.map +1 -0
  142. package/test/examples/source-repository/a/dist/parser/SharedQualifiedNames.d.ts +43 -0
  143. package/test/examples/source-repository/a/dist/parser/SharedQualifiedNames.js +81 -0
  144. package/test/examples/source-repository/a/dist/parser/SharedQualifiedNames.js.map +1 -0
  145. package/test/examples/source-repository/a/dist/parser/createGraphBuilder.d.ts +6 -1
  146. package/test/examples/source-repository/a/dist/parser/createGraphBuilder.js +16 -31
  147. package/test/examples/source-repository/a/dist/parser/createGraphBuilder.js.map +1 -1
  148. package/test/examples/source-repository/a/dist/parser/createSourceGraph.d.ts +6 -1
  149. package/test/examples/source-repository/a/dist/parser/createSourceGraph.js +23 -38
  150. package/test/examples/source-repository/a/dist/parser/createSourceGraph.js.map +1 -1
  151. package/test/examples/source-repository/a/dist/src/ExtendsForeignType.d.ts +1 -1
  152. package/test/examples/source-repository/a/dist/src/ExtendsForeignType.js +5 -5
  153. package/test/examples/source-repository/a/dist/src/ExtendsForeignType.js.map +1 -1
  154. package/test/examples/source-repository/a/generated/index.ts +44 -44
  155. package/test/examples/source-repository/a/src/ExtendsForeignType.ts +1 -1
  156. package/test/examples/source-repository/b/dist/codegen/CanonicalSourceGraph.d.ts +22 -0
  157. package/test/examples/source-repository/b/dist/codegen/CanonicalSourceGraph.js +60 -0
  158. package/test/examples/source-repository/b/dist/codegen/CanonicalSourceGraph.js.map +1 -0
  159. package/test/examples/source-repository/b/dist/codegen/writeGeneratedIndex.d.ts +12 -3
  160. package/test/examples/source-repository/b/dist/codegen/writeGeneratedIndex.js +21 -13
  161. package/test/examples/source-repository/b/dist/codegen/writeGeneratedIndex.js.map +1 -1
  162. package/test/examples/source-repository/b/dist/generated/index.js +3 -3
  163. package/test/examples/source-repository/b/dist/generated/index.js.map +1 -1
  164. package/test/examples/source-repository/b/dist/parser/PackageSourceFiles.d.ts +30 -0
  165. package/test/examples/source-repository/b/dist/parser/PackageSourceFiles.js +151 -0
  166. package/test/examples/source-repository/b/dist/parser/PackageSourceFiles.js.map +1 -0
  167. package/test/examples/source-repository/b/dist/parser/SharedQualifiedNames.d.ts +43 -0
  168. package/test/examples/source-repository/b/dist/parser/SharedQualifiedNames.js +81 -0
  169. package/test/examples/source-repository/b/dist/parser/SharedQualifiedNames.js.map +1 -0
  170. package/test/examples/source-repository/b/dist/parser/createGraphBuilder.d.ts +6 -1
  171. package/test/examples/source-repository/b/dist/parser/createGraphBuilder.js +16 -31
  172. package/test/examples/source-repository/b/dist/parser/createGraphBuilder.js.map +1 -1
  173. package/test/examples/source-repository/b/dist/parser/createSourceGraph.d.ts +6 -1
  174. package/test/examples/source-repository/b/dist/parser/createSourceGraph.js +23 -38
  175. package/test/examples/source-repository/b/dist/parser/createSourceGraph.js.map +1 -1
  176. package/test/examples/source-repository/b/generated/index.ts +6 -6
@@ -0,0 +1,224 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __generator = (this && this.__generator) || function (thisArg, body) {
35
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
+ function verb(n) { return function (v) { return step([n, v]); }; }
38
+ function step(op) {
39
+ if (f) throw new TypeError("Generator is already executing.");
40
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
41
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
+ if (y = 0, t) op = [op[0] & 2, t.value];
43
+ switch (op[0]) {
44
+ case 0: case 1: t = op; break;
45
+ case 4: _.label++; return { value: op[1], done: false };
46
+ case 5: _.label++; y = op[1]; op = [0]; continue;
47
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
+ default:
49
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
+ if (t[2]) _.ops.pop();
54
+ _.trys.pop(); continue;
55
+ }
56
+ op = body.call(thisArg, _);
57
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
+ }
60
+ };
61
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
62
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
63
+ if (ar || !(i in from)) {
64
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
65
+ ar[i] = from[i];
66
+ }
67
+ }
68
+ return to.concat(ar || Array.prototype.slice.call(from));
69
+ };
70
+ Object.defineProperty(exports, "__esModule", { value: true });
71
+ var fs = __importStar(require("fs"));
72
+ var path = __importStar(require("path"));
73
+ var ExamplePackageFixture_1 = require("./ExamplePackageFixture");
74
+ /**
75
+ * The same sources build to the same bytes: the generated index, the compiled dist and the
76
+ * packed tarball do not depend on where the package is checked out, nor on the order the
77
+ * filesystem hands the source files back (which varies by filesystem and from run to run).
78
+ *
79
+ * The enumeration is stubbed at the glob the build reads its sources through: the real glob's
80
+ * result in a fixed base order (code-unit sorted — the glob's own order varies from copy to copy,
81
+ * so a reversal of it would not be the same reversal twice), reordered by `mockEnumerationOrder`.
82
+ */
83
+ var mockEnumerationOrder = function (paths) { return paths; };
84
+ jest.mock('globby', function () {
85
+ var actual = jest.requireActual('globby');
86
+ var reordered = function () {
87
+ var args = [];
88
+ for (var _i = 0; _i < arguments.length; _i++) {
89
+ args[_i] = arguments[_i];
90
+ }
91
+ return __awaiter(void 0, void 0, void 0, function () { var _a, _b; return __generator(this, function (_c) {
92
+ switch (_c.label) {
93
+ case 0:
94
+ _a = mockEnumerationOrder;
95
+ _b = [[]];
96
+ return [4 /*yield*/, actual.apply(void 0, args)];
97
+ case 1: return [2 /*return*/, _a.apply(void 0, [__spreadArray.apply(void 0, _b.concat([(_c.sent()), true])).sort()])];
98
+ }
99
+ }); });
100
+ };
101
+ return Object.assign(reordered, actual);
102
+ });
103
+ var BUILD_TIMEOUT_MS = 120 * 1000;
104
+ describe('reproducible generated index', function () {
105
+ var fixture = new ExamplePackageFixture_1.ExamplePackageFixture('reproducible', '@proteinjs/reflection-build-test-reproducible');
106
+ afterEach(function () {
107
+ mockEnumerationOrder = function (paths) { return paths; };
108
+ });
109
+ afterAll(function () { return fixture.dispose(); });
110
+ test('two checkouts at different absolute paths ship byte-identical dist/generated/index.js and tarballs', function () { return __awaiter(void 0, void 0, void 0, function () {
111
+ var shipped, _i, _a, location_1, packageDir, generatedJs;
112
+ return __generator(this, function (_b) {
113
+ switch (_b.label) {
114
+ case 0:
115
+ shipped = [];
116
+ _i = 0, _a = ['one/pkg', 'two/a/much/deeper/checkout/elsewhere'];
117
+ _b.label = 1;
118
+ case 1:
119
+ if (!(_i < _a.length)) return [3 /*break*/, 4];
120
+ location_1 = _a[_i];
121
+ packageDir = fixture.materialize(location_1);
122
+ return [4 /*yield*/, fixture.generate(packageDir)];
123
+ case 2:
124
+ _b.sent();
125
+ fixture.compile(packageDir);
126
+ generatedJs = fs.readFileSync(path.join(packageDir, 'dist', 'generated', 'index.js'));
127
+ expect(generatedJs.toString()).not.toContain(packageDir);
128
+ shipped.push({ generatedJs: fixture.sha256(generatedJs), tarball: fixture.packSha256(packageDir) });
129
+ _b.label = 3;
130
+ case 3:
131
+ _i++;
132
+ return [3 /*break*/, 1];
133
+ case 4:
134
+ expect(shipped[1]).toEqual(shipped[0]);
135
+ return [2 /*return*/];
136
+ }
137
+ });
138
+ }); }, BUILD_TIMEOUT_MS);
139
+ test('the generated index does not depend on the order the source files are enumerated', function () { return __awaiter(void 0, void 0, void 0, function () {
140
+ var orders, generated, _i, _a, name_1, _b, _c;
141
+ return __generator(this, function (_d) {
142
+ switch (_d.label) {
143
+ case 0:
144
+ orders = {
145
+ asEnumerated: function (paths) { return paths; },
146
+ reversed: function (paths) { return __spreadArray([], paths, true).reverse(); },
147
+ rotated: function (paths) { return __spreadArray(__spreadArray([], paths.slice(3), true), paths.slice(0, 3), true); },
148
+ };
149
+ generated = {};
150
+ _i = 0, _a = Object.keys(orders);
151
+ _d.label = 1;
152
+ case 1:
153
+ if (!(_i < _a.length)) return [3 /*break*/, 4];
154
+ name_1 = _a[_i];
155
+ mockEnumerationOrder = orders[name_1];
156
+ _b = generated;
157
+ _c = name_1;
158
+ return [4 /*yield*/, fixture.generate(fixture.materialize("order-".concat(name_1, "/pkg")))];
159
+ case 2:
160
+ _b[_c] = _d.sent();
161
+ _d.label = 3;
162
+ case 3:
163
+ _i++;
164
+ return [3 /*break*/, 1];
165
+ case 4:
166
+ expect(generated.reversed).toBe(generated.asEnumerated);
167
+ expect(generated.rotated).toBe(generated.asEnumerated);
168
+ return [2 /*return*/];
169
+ }
170
+ });
171
+ }); }, BUILD_TIMEOUT_MS);
172
+ test('node filePaths are package-relative, with / separators and no leading ./', function () { return __awaiter(void 0, void 0, void 0, function () {
173
+ var graph, _a, _b, gamma, filePaths;
174
+ var _c;
175
+ return __generator(this, function (_d) {
176
+ switch (_d.label) {
177
+ case 0:
178
+ _b = (_a = fixture).graphOf;
179
+ return [4 /*yield*/, fixture.generate(fixture.materialize('relative/pkg'))];
180
+ case 1:
181
+ graph = _b.apply(_a, [_d.sent()]);
182
+ gamma = graph.nodes.find(function (node) { return node.v === fixture.qualified('GammaPlugin'); });
183
+ expect((_c = gamma === null || gamma === void 0 ? void 0 : gamma.value) === null || _c === void 0 ? void 0 : _c.filePath).toBe('src/beta/deep/Gamma.ts');
184
+ filePaths = graph.nodes.map(function (node) { var _a; return (_a = node.value) === null || _a === void 0 ? void 0 : _a.filePath; }).filter(function (filePath) { return !!filePath; });
185
+ expect(filePaths.length).toBeGreaterThan(0);
186
+ expect(filePaths.filter(function (filePath) { return !/^src\/[A-Za-z]+(\/[A-Za-z]+)*\.ts$/.test(filePath); })).toEqual([]);
187
+ return [2 /*return*/];
188
+ }
189
+ });
190
+ }); }, BUILD_TIMEOUT_MS);
191
+ test('nodes are emitted by file then qualified name, edges by child then parent, source links in node order', function () { return __awaiter(void 0, void 0, void 0, function () {
192
+ var generated, graph, byCodeUnit, nodeKeys, edgeKeys, linkedNames, linkableNodeNames;
193
+ return __generator(this, function (_a) {
194
+ switch (_a.label) {
195
+ case 0: return [4 /*yield*/, fixture.generate(fixture.materialize('canonical/pkg'))];
196
+ case 1:
197
+ generated = _a.sent();
198
+ graph = fixture.graphOf(generated);
199
+ byCodeUnit = function (keys) {
200
+ return __spreadArray([], keys, true).sort(function (a, b) {
201
+ var left = a.join('\0');
202
+ var right = b.join('\0');
203
+ return left < right ? -1 : left > right ? 1 : 0;
204
+ });
205
+ };
206
+ nodeKeys = graph.nodes.map(function (node) { var _a; return [((_a = node.value) === null || _a === void 0 ? void 0 : _a.filePath) || '', node.v]; });
207
+ expect(nodeKeys).toEqual(byCodeUnit(nodeKeys));
208
+ expect(nodeKeys.slice(0, 2)).toEqual([
209
+ ['', '@proteinjs/reflection/Loadable'],
210
+ ['src/alpha/Alpha.ts', fixture.qualified('AardvarkPlugin')],
211
+ ]);
212
+ edgeKeys = graph.edges.map(function (edge) { return [edge.v, edge.w]; });
213
+ expect(edgeKeys).toEqual(byCodeUnit(edgeKeys));
214
+ linkedNames = (generated.match(/^\t'[^']+'/gm) || []).map(function (line) { return line.slice(2, -1); });
215
+ linkableNodeNames = graph.nodes
216
+ .filter(function (node) { return node.value && (node.value.sourceType === 0 || node.value.sourceType === 2); })
217
+ .map(function (node) { return node.v; });
218
+ expect(linkedNames).toEqual(linkableNodeNames);
219
+ return [2 /*return*/];
220
+ }
221
+ });
222
+ }); }, BUILD_TIMEOUT_MS);
223
+ });
224
+ //# sourceMappingURL=ReproducibleGeneratedIndex.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReproducibleGeneratedIndex.test.js","sourceRoot":"","sources":["../../test/ReproducibleGeneratedIndex.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,yCAA6B;AAC7B,iEAAgE;AAEhE;;;;;;;;GAQG;AACH,IAAI,oBAAoB,GAAkC,UAAC,KAAK,IAAK,OAAA,KAAK,EAAL,CAAK,CAAC;AAC3E,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;IAClB,IAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC5C,IAAM,SAAS,GAAG;QAAO,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;;;;o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AAW,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAjB,CAAiB,CAAC,CAAC;oBACvF,iBAAiB,GAAG,KAAK,CAAC,KAAK;yBAClC,MAAM,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,CAAC,CAAC,EAA1E,CAA0E,CAAC;yBAC5F,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,CAAC,EAAN,CAAM,CAAC,CAAC;oBACzB,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;;;;SAChD,EACD,gBAAgB,CACjB,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,186 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __generator = (this && this.__generator) || function (thisArg, body) {
35
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
+ function verb(n) { return function (v) { return step([n, v]); }; }
38
+ function step(op) {
39
+ if (f) throw new TypeError("Generator is already executing.");
40
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
41
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
+ if (y = 0, t) op = [op[0] & 2, t.value];
43
+ switch (op[0]) {
44
+ case 0: case 1: t = op; break;
45
+ case 4: _.label++; return { value: op[1], done: false };
46
+ case 5: _.label++; y = op[1]; op = [0]; continue;
47
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
+ default:
49
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
+ if (t[2]) _.ops.pop();
54
+ _.trys.pop(); continue;
55
+ }
56
+ op = body.call(thisArg, _);
57
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
+ }
60
+ };
61
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
62
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
63
+ if (ar || !(i in from)) {
64
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
65
+ ar[i] = from[i];
66
+ }
67
+ }
68
+ return to.concat(ar || Array.prototype.slice.call(from));
69
+ };
70
+ Object.defineProperty(exports, "__esModule", { value: true });
71
+ var fs = __importStar(require("fs"));
72
+ var path = __importStar(require("path"));
73
+ var ExamplePackageFixture_1 = require("./ExamplePackageFixture");
74
+ /**
75
+ * One qualified name, one declaring file, for every name that reaches the generated index. The
76
+ * index holds one declaration per qualified name, so a name exported by two files would keep only
77
+ * the file parsed last and drop the other without a trace; the build refuses it instead. The rule
78
+ * applies after the prune: a name whose declarations are all pruned (types, consts, interfaces that
79
+ * are not Loadable) never reaches the index and is ordinary TypeScript.
80
+ *
81
+ * The enumeration is stubbed at the glob, as in the reproducible suite: the real glob's result in a
82
+ * fixed base order (code-unit sorted), reordered by `mockEnumerationOrder`.
83
+ */
84
+ var mockEnumerationOrder = function (paths) { return paths; };
85
+ jest.mock('globby', function () {
86
+ var actual = jest.requireActual('globby');
87
+ var reordered = function () {
88
+ var args = [];
89
+ for (var _i = 0; _i < arguments.length; _i++) {
90
+ args[_i] = arguments[_i];
91
+ }
92
+ return __awaiter(void 0, void 0, void 0, function () { var _a, _b; return __generator(this, function (_c) {
93
+ switch (_c.label) {
94
+ case 0:
95
+ _a = mockEnumerationOrder;
96
+ _b = [[]];
97
+ return [4 /*yield*/, actual.apply(void 0, args)];
98
+ case 1: return [2 /*return*/, _a.apply(void 0, [__spreadArray.apply(void 0, _b.concat([(_c.sent()), true])).sort()])];
99
+ }
100
+ }); });
101
+ };
102
+ return Object.assign(reordered, actual);
103
+ });
104
+ var BUILD_TIMEOUT_MS = 120 * 1000;
105
+ /** What one build did: the refusal's message, or the file whose declaration `name` holds in the index it wrote. */
106
+ var outcomeOf = function (fixture, packageDir, name) {
107
+ return fixture.generate(packageDir).then(function (generated) {
108
+ var _a, _b;
109
+ return ({
110
+ built: ((_b = (_a = fixture.graphOf(generated).nodes.find(function (node) { return node.v === fixture.qualified(name); })) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.filePath) || null,
111
+ });
112
+ }, function (error) { return ({ refused: error.message }); });
113
+ };
114
+ describe('a name exported by two files', function () {
115
+ var sharedName = new ExamplePackageFixture_1.ExamplePackageFixture('shared-name', '@proteinjs/reflection-build-test-shared-name');
116
+ var prunedPair = new ExamplePackageFixture_1.ExamplePackageFixture('shared-name-pruned', '@proteinjs/reflection-build-test-shared-name-pruned');
117
+ // Widget is declared by two files. Gear (src/gamma/Gear.ts) is declared twice by ONE file, an
118
+ // interface and a const, and reaches the index too: it is not a shared name, so it is not named.
119
+ var refusal = [
120
+ 'reflection-build refused @proteinjs/reflection-build-test-shared-name: a name that reaches the generated index is declared in more than one file.',
121
+ 'The index holds one declaration per qualified name, so the file parsed last would replace the others without a trace.',
122
+ 'Give each declaration its own name (no index was written):',
123
+ ' @proteinjs/reflection-build-test-shared-name/Widget: src/alpha/Widget.ts, src/beta/Widget.ts',
124
+ ].join('\n');
125
+ afterEach(function () {
126
+ mockEnumerationOrder = function (paths) { return paths; };
127
+ });
128
+ afterAll(function () {
129
+ sharedName.dispose();
130
+ prunedPair.dispose();
131
+ });
132
+ test('reaching the index (an interface that extends Loadable, a class): the build refuses, naming the package, the name and both files, and writes no index', function () { return __awaiter(void 0, void 0, void 0, function () {
133
+ var packageDir, _a;
134
+ return __generator(this, function (_b) {
135
+ switch (_b.label) {
136
+ case 0:
137
+ packageDir = sharedName.materialize('refused/pkg');
138
+ _a = expect;
139
+ return [4 /*yield*/, outcomeOf(sharedName, packageDir, 'Widget')];
140
+ case 1:
141
+ _a.apply(void 0, [_b.sent()]).toEqual({ refused: refusal });
142
+ expect(fs.existsSync(path.join(packageDir, 'generated', 'index.ts'))).toBe(false);
143
+ return [2 /*return*/];
144
+ }
145
+ });
146
+ }); }, BUILD_TIMEOUT_MS);
147
+ test('the refusal names the files in package-relative path order, whatever order they are enumerated in', function () { return __awaiter(void 0, void 0, void 0, function () {
148
+ var _a;
149
+ return __generator(this, function (_b) {
150
+ switch (_b.label) {
151
+ case 0:
152
+ mockEnumerationOrder = function (paths) { return __spreadArray([], paths, true).reverse(); };
153
+ _a = expect;
154
+ return [4 /*yield*/, outcomeOf(sharedName, sharedName.materialize('reversed/pkg'), 'Widget')];
155
+ case 1:
156
+ _a.apply(void 0, [_b.sent()]).toEqual({
157
+ refused: refusal,
158
+ });
159
+ return [2 /*return*/];
160
+ }
161
+ });
162
+ }); }, BUILD_TIMEOUT_MS);
163
+ test('pruned before the index (a type and an interface; two consts): the build writes the index, without the names', function () { return __awaiter(void 0, void 0, void 0, function () {
164
+ var packageDir, _a, _b, _c;
165
+ return __generator(this, function (_d) {
166
+ switch (_d.label) {
167
+ case 0:
168
+ packageDir = prunedPair.materialize('built/pkg');
169
+ _a = expect;
170
+ return [4 /*yield*/, outcomeOf(prunedPair, packageDir, 'Shape')];
171
+ case 1:
172
+ _a.apply(void 0, [_d.sent()]).toEqual({ built: null });
173
+ _b = expect;
174
+ return [4 /*yield*/, outcomeOf(prunedPair, packageDir, 'LIMITS')];
175
+ case 2:
176
+ _b.apply(void 0, [_d.sent()]).toEqual({ built: null });
177
+ _c = expect;
178
+ return [4 /*yield*/, outcomeOf(prunedPair, packageDir, 'SquareTile')];
179
+ case 3:
180
+ _c.apply(void 0, [_d.sent()]).toEqual({ built: 'src/alpha/Tile.ts' });
181
+ return [2 /*return*/];
182
+ }
183
+ });
184
+ }); }, BUILD_TIMEOUT_MS);
185
+ });
186
+ //# sourceMappingURL=SharedQualifiedNames.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SharedQualifiedNames.test.js","sourceRoot":"","sources":["../../test/SharedQualifiedNames.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,yCAA6B;AAC7B,iEAAgE;AAEhE;;;;;;;;;GASG;AACH,IAAI,oBAAoB,GAAkC,UAAC,KAAK,IAAK,OAAA,KAAK,EAAL,CAAK,CAAC;AAC3E,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;IAClB,IAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC5C,IAAM,SAAS,GAAG;QAAO,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;;;;oBAAK,KAAA,oBAAoB,CAAA;;oBAAM,qBAAM,MAAM,eAAI,IAAI,GAAC;wBAA/C,sBAAA,kBAAqB,uCAAI,CAAC,SAAqB,CAAC,UAAE,IAAI,EAAE,EAAC,EAAA;;;KAAA,CAAC;IACtG,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAC1C,CAAC,CAAC,CAAC;AAEH,IAAM,gBAAgB,GAAG,GAAG,GAAG,IAAI,CAAC;AAEpC,mHAAmH;AACnH,IAAM,SAAS,GAAG,UAAC,OAA8B,EAAE,UAAkB,EAAE,IAAY;IACjF,OAAA,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,IAAI,CAC/B,UAAC,SAAS;;QAAK,OAAA,CAAC;YACd,KAAK,EACH,CAAA,MAAA,MAAA,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,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'./src/alpha/Alpha';
2
+ export * from './src/beta/Beta';
3
+ export * from './src/beta/deep/Gamma';
4
+ export * from './src/zeta/Zeta';
@@ -0,0 +1,21 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src/alpha/Alpha"), exports);
18
+ __exportStar(require("./src/beta/Beta"), exports);
19
+ __exportStar(require("./src/beta/deep/Gamma"), exports);
20
+ __exportStar(require("./src/zeta/Zeta"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../test/examples/reproducible/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,kDAAgC;AAChC,wDAAsC;AACtC,kDAAgC"}
@@ -0,0 +1,10 @@
1
+ import { Loadable } from '@proteinjs/reflection';
2
+ export interface Plugin extends Loadable {
3
+ id: string;
4
+ }
5
+ export declare class AlphaPlugin implements Plugin {
6
+ id: string;
7
+ }
8
+ export declare class AardvarkPlugin implements Plugin {
9
+ id: string;
10
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AardvarkPlugin = exports.AlphaPlugin = void 0;
4
+ var AlphaPlugin = /** @class */ (function () {
5
+ function AlphaPlugin() {
6
+ this.id = 'alpha';
7
+ }
8
+ return AlphaPlugin;
9
+ }());
10
+ exports.AlphaPlugin = AlphaPlugin;
11
+ var AardvarkPlugin = /** @class */ (function () {
12
+ function AardvarkPlugin() {
13
+ this.id = 'aardvark';
14
+ }
15
+ return AardvarkPlugin;
16
+ }());
17
+ exports.AardvarkPlugin = AardvarkPlugin;
18
+ //# sourceMappingURL=Alpha.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Alpha.js","sourceRoot":"","sources":["../../../../../../test/examples/reproducible/src/alpha/Alpha.ts"],"names":[],"mappings":";;;AAMA;IAAA;QACE,OAAE,GAAG,OAAO,CAAC;IACf,CAAC;IAAD,kBAAC;AAAD,CAAC,AAFD,IAEC;AAFY,kCAAW;AAIxB;IAAA;QACE,OAAE,GAAG,UAAU,CAAC;IAClB,CAAC;IAAD,qBAAC;AAAD,CAAC,AAFD,IAEC;AAFY,wCAAc"}
@@ -0,0 +1,2 @@
1
+ import { Plugin } from './Alpha';
2
+ export declare const defaults: Plugin;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaults = void 0;
4
+ // The same file name as src/zeta/Defaults.ts, a different exported name: one declaration per qualified name.
5
+ exports.defaults = { id: 'alpha-defaults' };
6
+ //# sourceMappingURL=Defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Defaults.js","sourceRoot":"","sources":["../../../../../../test/examples/reproducible/src/alpha/Defaults.ts"],"names":[],"mappings":";;;AAEA,6GAA6G;AAChG,QAAA,QAAQ,GAAW,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '../alpha/Alpha';
2
+ export declare class BetaPlugin implements Plugin {
3
+ id: string;
4
+ }
5
+ export declare const betaSetting: Plugin;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.betaSetting = exports.BetaPlugin = void 0;
4
+ var BetaPlugin = /** @class */ (function () {
5
+ function BetaPlugin() {
6
+ this.id = 'beta';
7
+ }
8
+ return BetaPlugin;
9
+ }());
10
+ exports.BetaPlugin = BetaPlugin;
11
+ exports.betaSetting = { id: 'beta-setting' };
12
+ //# sourceMappingURL=Beta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Beta.js","sourceRoot":"","sources":["../../../../../../test/examples/reproducible/src/beta/Beta.ts"],"names":[],"mappings":";;;AAEA;IAAA;QACE,OAAE,GAAG,MAAM,CAAC;IACd,CAAC;IAAD,iBAAC;AAAD,CAAC,AAFD,IAEC;AAFY,gCAAU;AAIV,QAAA,WAAW,GAAW,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Plugin } from '../../alpha/Alpha';
2
+ export declare class GammaPlugin implements Plugin {
3
+ id: string;
4
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GammaPlugin = void 0;
4
+ var GammaPlugin = /** @class */ (function () {
5
+ function GammaPlugin() {
6
+ this.id = 'gamma';
7
+ }
8
+ return GammaPlugin;
9
+ }());
10
+ exports.GammaPlugin = GammaPlugin;
11
+ //# sourceMappingURL=Gamma.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Gamma.js","sourceRoot":"","sources":["../../../../../../../test/examples/reproducible/src/beta/deep/Gamma.ts"],"names":[],"mappings":";;;AAEA;IAAA;QACE,OAAE,GAAG,OAAO,CAAC;IACf,CAAC;IAAD,kBAAC;AAAD,CAAC,AAFD,IAEC;AAFY,kCAAW"}
@@ -0,0 +1,2 @@
1
+ import { Plugin } from '../alpha/Alpha';
2
+ export declare const zetaDefaults: Plugin;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.zetaDefaults = void 0;
4
+ // The same file name as src/alpha/Defaults.ts, a different exported name: one declaration per qualified name.
5
+ exports.zetaDefaults = { id: 'zeta-defaults' };
6
+ //# sourceMappingURL=Defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Defaults.js","sourceRoot":"","sources":["../../../../../../test/examples/reproducible/src/zeta/Defaults.ts"],"names":[],"mappings":";;;AAEA,8GAA8G;AACjG,QAAA,YAAY,GAAW,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Plugin } from '../alpha/Alpha';
2
+ export declare class ZetaPlugin implements Plugin {
3
+ id: string;
4
+ }
5
+ export declare class MuPlugin implements Plugin {
6
+ id: string;
7
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MuPlugin = exports.ZetaPlugin = void 0;
4
+ var ZetaPlugin = /** @class */ (function () {
5
+ function ZetaPlugin() {
6
+ this.id = 'zeta';
7
+ }
8
+ return ZetaPlugin;
9
+ }());
10
+ exports.ZetaPlugin = ZetaPlugin;
11
+ var MuPlugin = /** @class */ (function () {
12
+ function MuPlugin() {
13
+ this.id = 'mu';
14
+ }
15
+ return MuPlugin;
16
+ }());
17
+ exports.MuPlugin = MuPlugin;
18
+ //# sourceMappingURL=Zeta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Zeta.js","sourceRoot":"","sources":["../../../../../../test/examples/reproducible/src/zeta/Zeta.ts"],"names":[],"mappings":";;;AAEA;IAAA;QACE,OAAE,GAAG,MAAM,CAAC;IACd,CAAC;IAAD,iBAAC;AAAD,CAAC,AAFD,IAEC;AAFY,gCAAU;AAIvB;IAAA;QACE,OAAE,GAAG,IAAI,CAAC;IACZ,CAAC;IAAD,eAAC;AAAD,CAAC,AAFD,IAEC;AAFY,4BAAQ"}
@@ -0,0 +1 @@
1
+ export * from './src/alpha/Widget';
@@ -0,0 +1,18 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src/alpha/Widget"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../test/examples/shared-name/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}