@embroider/core 4.6.8 → 4.6.9

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 (119) hide show
  1. package/README.md +17 -0
  2. package/dist/src/app-files.d.ts +34 -0
  3. package/dist/src/app-files.d.ts.map +1 -0
  4. package/dist/src/app-files.js +201 -0
  5. package/dist/src/app-files.js.map +1 -0
  6. package/dist/src/describe-exports.d.ts +7 -0
  7. package/dist/src/describe-exports.d.ts.map +1 -0
  8. package/dist/src/describe-exports.js +52 -0
  9. package/dist/src/describe-exports.js.map +1 -0
  10. package/dist/src/html-entrypoint.d.ts +23 -0
  11. package/dist/src/html-entrypoint.d.ts.map +1 -0
  12. package/dist/src/html-entrypoint.js +185 -0
  13. package/dist/src/html-entrypoint.js.map +1 -0
  14. package/dist/src/html-placeholder.d.ts +40 -0
  15. package/dist/src/html-placeholder.d.ts.map +1 -0
  16. package/dist/src/html-placeholder.js +130 -0
  17. package/dist/src/html-placeholder.js.map +1 -0
  18. package/dist/src/index.d.ts +15 -0
  19. package/dist/src/index.d.ts.map +1 -0
  20. package/dist/src/index.js +50 -0
  21. package/dist/src/index.js.map +1 -0
  22. package/dist/src/js-handlebars.d.ts +2 -0
  23. package/dist/src/js-handlebars.d.ts.map +1 -0
  24. package/dist/src/js-handlebars.js +20 -0
  25. package/dist/src/js-handlebars.js.map +1 -0
  26. package/dist/src/measure-concat.d.ts +14 -0
  27. package/dist/src/measure-concat.d.ts.map +1 -0
  28. package/dist/src/measure-concat.js +33 -0
  29. package/dist/src/measure-concat.js.map +1 -0
  30. package/dist/src/messages.d.ts +9 -0
  31. package/dist/src/messages.d.ts.map +1 -0
  32. package/dist/src/messages.js +74 -0
  33. package/dist/src/messages.js.map +1 -0
  34. package/dist/src/module-request.d.ts +45 -0
  35. package/dist/src/module-request.d.ts.map +1 -0
  36. package/dist/src/module-request.js +87 -0
  37. package/dist/src/module-request.js.map +1 -0
  38. package/dist/src/module-resolver-options.d.ts +43 -0
  39. package/dist/src/module-resolver-options.d.ts.map +1 -0
  40. package/dist/src/module-resolver-options.js +155 -0
  41. package/dist/src/module-resolver-options.js.map +1 -0
  42. package/dist/src/module-resolver.d.ts +71 -0
  43. package/dist/src/module-resolver.d.ts.map +1 -0
  44. package/dist/src/module-resolver.js +1167 -0
  45. package/dist/src/module-resolver.js.map +1 -0
  46. package/dist/src/node-resolve.d.ts +36 -0
  47. package/dist/src/node-resolve.d.ts.map +1 -0
  48. package/dist/src/node-resolve.js +134 -0
  49. package/dist/src/node-resolve.js.map +1 -0
  50. package/dist/src/options.d.ts +26 -0
  51. package/dist/src/options.d.ts.map +1 -0
  52. package/dist/src/options.js +26 -0
  53. package/dist/src/options.js.map +1 -0
  54. package/dist/src/packager.d.ts +20 -0
  55. package/dist/src/packager.d.ts.map +1 -0
  56. package/dist/src/packager.js +34 -0
  57. package/dist/src/packager.js.map +1 -0
  58. package/dist/src/portable.d.ts +26 -0
  59. package/dist/src/portable.d.ts.map +1 -0
  60. package/dist/src/portable.js +231 -0
  61. package/dist/src/portable.js.map +1 -0
  62. package/dist/src/resolvable-extensions.d.ts +2 -0
  63. package/dist/src/resolvable-extensions.d.ts.map +1 -0
  64. package/dist/src/resolvable-extensions.js +13 -0
  65. package/dist/src/resolvable-extensions.js.map +1 -0
  66. package/dist/src/resolver-loader.d.ts +9 -0
  67. package/dist/src/resolver-loader.d.ts.map +1 -0
  68. package/dist/src/resolver-loader.js +54 -0
  69. package/dist/src/resolver-loader.js.map +1 -0
  70. package/dist/src/stage.d.ts +9 -0
  71. package/dist/src/stage.d.ts.map +1 -0
  72. package/dist/src/stage.js +3 -0
  73. package/dist/src/stage.js.map +1 -0
  74. package/dist/src/virtual-content.d.ts +36 -0
  75. package/dist/src/virtual-content.d.ts.map +1 -0
  76. package/dist/src/virtual-content.js +232 -0
  77. package/dist/src/virtual-content.js.map +1 -0
  78. package/dist/src/virtual-entrypoint.d.ts +22 -0
  79. package/dist/src/virtual-entrypoint.d.ts.map +1 -0
  80. package/dist/src/virtual-entrypoint.js +280 -0
  81. package/dist/src/virtual-entrypoint.js.map +1 -0
  82. package/dist/src/virtual-route-entrypoint.d.ts +11 -0
  83. package/dist/src/virtual-route-entrypoint.d.ts.map +1 -0
  84. package/dist/src/virtual-route-entrypoint.js +68 -0
  85. package/dist/src/virtual-route-entrypoint.js.map +1 -0
  86. package/dist/src/virtual-test-support-styles.d.ts +8 -0
  87. package/dist/src/virtual-test-support-styles.d.ts.map +1 -0
  88. package/dist/src/virtual-test-support-styles.js +61 -0
  89. package/dist/src/virtual-test-support-styles.js.map +1 -0
  90. package/dist/src/virtual-test-support.d.ts +8 -0
  91. package/dist/src/virtual-test-support.d.ts.map +1 -0
  92. package/dist/src/virtual-test-support.js +65 -0
  93. package/dist/src/virtual-test-support.js.map +1 -0
  94. package/dist/src/virtual-vendor-styles.d.ts +9 -0
  95. package/dist/src/virtual-vendor-styles.d.ts.map +1 -0
  96. package/dist/src/virtual-vendor-styles.js +84 -0
  97. package/dist/src/virtual-vendor-styles.js.map +1 -0
  98. package/dist/src/virtual-vendor.d.ts +8 -0
  99. package/dist/src/virtual-vendor.d.ts.map +1 -0
  100. package/dist/src/virtual-vendor.js +55 -0
  101. package/dist/src/virtual-vendor.js.map +1 -0
  102. package/dist/src/wait-for-trees.d.ts +14 -0
  103. package/dist/src/wait-for-trees.d.ts.map +1 -0
  104. package/dist/src/wait-for-trees.js +98 -0
  105. package/dist/src/wait-for-trees.js.map +1 -0
  106. package/dist/tests/babel-debug-util.d.ts +2 -0
  107. package/dist/tests/babel-debug-util.d.ts.map +1 -0
  108. package/dist/tests/babel-debug-util.js +36 -0
  109. package/dist/tests/babel-debug-util.js.map +1 -0
  110. package/dist/tests/example-target.d.ts +3 -0
  111. package/dist/tests/example-target.d.ts.map +1 -0
  112. package/dist/tests/example-target.js +10 -0
  113. package/dist/tests/example-target.js.map +1 -0
  114. package/dist/tests/portable.test.d.ts +2 -0
  115. package/dist/tests/portable.test.d.ts.map +1 -0
  116. package/dist/tests/portable.test.js +14 -0
  117. package/dist/tests/portable.test.js.map +1 -0
  118. package/dist/tsconfig.tsbuildinfo +1 -0
  119. package/package.json +5 -5
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portable.d.ts","sourceRoot":"","sources":["../../src/portable.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ,kCAAkC,CAAC;AAGxD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,GAAG,CAAC;IACX,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,OAQlD;AAED,qBAAa,QAAQ;IAEjB,OAAO,CAAC,IAAI;gBAAJ,IAAI,GAAE;QACZ,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,cAAc,GAAG,SAAS,CAAC;QAC7E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK;YAAE,KAAK,EAAE,GAAG,CAAA;SAAE,GAAG,SAAS,CAAC;QAC3E,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;KACnB;IAGR,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,UAAU,GAAE,MAAM,EAAO,GAAG,cAAc;IAqEhE,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,UAAU,GAAE,MAAM,EAAO,GAAG,GAAG;IAiCnD,IACI,UAAU,IAAI,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAavC;CACF"}
@@ -0,0 +1,231 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Portable = exports.protocol = void 0;
13
+ exports.maybeNodeModuleVersion = maybeNodeModuleVersion;
14
+ const mapValues_1 = __importDefault(require("lodash/mapValues"));
15
+ const assert_never_1 = __importDefault(require("assert-never"));
16
+ const typescript_memoize_1 = require("typescript-memoize");
17
+ const resolve_package_path_1 = __importDefault(require("resolve-package-path"));
18
+ exports.protocol = '__embroider_portable_values__';
19
+ const { globalValues, nonce } = setupGlobals();
20
+ const { findUpPackagePath } = resolve_package_path_1.default;
21
+ function maybeNodeModuleVersion(path) {
22
+ const packagePath = findUpPackagePath(path);
23
+ if (packagePath === null) {
24
+ throw new Error(`Could not find package.json for '${path}'`);
25
+ }
26
+ else {
27
+ return require(packagePath).version; // eslint-disable-line @typescript-eslint/no-require-imports
28
+ }
29
+ }
30
+ class Portable {
31
+ opts;
32
+ constructor(opts = {}) {
33
+ this.opts = opts;
34
+ }
35
+ dehydrate(value, accessPath = []) {
36
+ if (this.opts.dehydrate) {
37
+ let result = this.opts.dehydrate.call(this, value, accessPath);
38
+ if (result) {
39
+ return result;
40
+ }
41
+ }
42
+ if (value === null) {
43
+ return { value, isParallelSafe: true, needsHydrate: false };
44
+ }
45
+ let broccoli = maybeBroccoli(value);
46
+ if (broccoli) {
47
+ return { value: broccoli, isParallelSafe: true, needsHydrate: true };
48
+ }
49
+ let htmlbars = maybeHTMLBars(value);
50
+ if (htmlbars) {
51
+ return { value: htmlbars, isParallelSafe: true, needsHydrate: true };
52
+ }
53
+ if (Array.isArray(value)) {
54
+ let results = value.map((element, index) => this.dehydrate(element, accessPath.concat(String(index))));
55
+ return {
56
+ value: results.map(r => r.value),
57
+ isParallelSafe: results.every(r => r.isParallelSafe),
58
+ needsHydrate: results.some(r => r.needsHydrate),
59
+ };
60
+ }
61
+ switch (typeof value) {
62
+ case 'string':
63
+ case 'number':
64
+ case 'boolean':
65
+ case 'undefined':
66
+ return { value, isParallelSafe: true, needsHydrate: false };
67
+ case 'object':
68
+ if (Object.getPrototypeOf(value) === Object.prototype) {
69
+ let isParallelSafe = true;
70
+ let needsHydrate = false;
71
+ let result = (0, mapValues_1.default)(value, (propertyValue, key) => {
72
+ let result = this.dehydrate(propertyValue, accessPath.concat(key));
73
+ isParallelSafe = isParallelSafe && result.isParallelSafe;
74
+ needsHydrate = needsHydrate || result.needsHydrate;
75
+ return result.value;
76
+ });
77
+ return { value: result, isParallelSafe, needsHydrate };
78
+ }
79
+ }
80
+ let found = this.foundHints.get(value);
81
+ if (found) {
82
+ return {
83
+ value: {
84
+ embroiderPlaceholder: true,
85
+ type: 'broccoli-parallel',
86
+ requireFile: found.requireFile,
87
+ packageVersion: maybeNodeModuleVersion(found.requireFile),
88
+ useMethod: found.useMethod,
89
+ },
90
+ isParallelSafe: true,
91
+ needsHydrate: true,
92
+ };
93
+ }
94
+ return globalPlaceholder(value);
95
+ }
96
+ hydrate(input, accessPath = []) {
97
+ if (this.opts.hydrate) {
98
+ let result = this.opts.hydrate.call(this, input, accessPath);
99
+ if (result) {
100
+ return result;
101
+ }
102
+ }
103
+ if (Array.isArray(input)) {
104
+ return input.map((element, index) => this.hydrate(element, accessPath.concat(String(index))));
105
+ }
106
+ if (input && typeof input === 'object') {
107
+ if (input.embroiderPlaceholder) {
108
+ let placeholder = input;
109
+ switch (placeholder.type) {
110
+ case 'global':
111
+ if (placeholder.nonce !== nonce) {
112
+ throw new Error(`unable to use this non-serializable babel config in this node process`);
113
+ }
114
+ return globalValues[placeholder.index];
115
+ case 'broccoli-parallel':
116
+ return buildBroccoli(placeholder);
117
+ case 'htmlbars-parallel':
118
+ return buildHTMLBars(placeholder);
119
+ default:
120
+ (0, assert_never_1.default)(placeholder);
121
+ }
122
+ }
123
+ else {
124
+ return (0, mapValues_1.default)(input, (value, key) => this.hydrate(value, accessPath.concat(key)));
125
+ }
126
+ }
127
+ return input;
128
+ }
129
+ get foundHints() {
130
+ let found = new Map();
131
+ if (this.opts.hints) {
132
+ for (let hint of this.opts.hints) {
133
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
134
+ let mod = require(hint.requireFile);
135
+ if (hint.useMethod) {
136
+ mod = mod[hint.useMethod];
137
+ }
138
+ found.set(mod, hint);
139
+ }
140
+ }
141
+ return found;
142
+ }
143
+ }
144
+ exports.Portable = Portable;
145
+ __decorate([
146
+ (0, typescript_memoize_1.Memoize)()
147
+ ], Portable.prototype, "foundHints", null);
148
+ function setupGlobals() {
149
+ let G = global;
150
+ if (!G[exports.protocol]) {
151
+ G[exports.protocol] = { globalValues: [], nonce: Math.floor(Math.random() * Math.pow(2, 32)) };
152
+ }
153
+ return G[exports.protocol];
154
+ }
155
+ // === broccoli-babel-transpiler support ===
156
+ function maybeBroccoli(object) {
157
+ const type = typeof object;
158
+ const hasProperties = type === 'function' || (type === 'object' && object !== null);
159
+ if (hasProperties &&
160
+ object._parallelBabel !== null &&
161
+ typeof object._parallelBabel === 'object' &&
162
+ typeof object._parallelBabel.requireFile === 'string') {
163
+ return {
164
+ embroiderPlaceholder: true,
165
+ type: 'broccoli-parallel',
166
+ requireFile: object._parallelBabel.requireFile,
167
+ packageVersion: maybeNodeModuleVersion(object._parallelBabel.requireFile),
168
+ buildUsing: object._parallelBabel.buildUsing,
169
+ useMethod: object._parallelBabel.useMethod,
170
+ params: object._parallelBabel.params,
171
+ };
172
+ }
173
+ }
174
+ function buildBroccoli(parallelApiInfo) {
175
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
176
+ let requiredStuff = require(parallelApiInfo.requireFile);
177
+ if (parallelApiInfo.useMethod) {
178
+ if (requiredStuff[parallelApiInfo.useMethod] === undefined) {
179
+ throw new Error("method '" + parallelApiInfo.useMethod + "' does not exist in file " + parallelApiInfo.requireFile);
180
+ }
181
+ return requiredStuff[parallelApiInfo.useMethod];
182
+ }
183
+ if (parallelApiInfo.buildUsing) {
184
+ if (typeof requiredStuff[parallelApiInfo.buildUsing] !== 'function') {
185
+ throw new Error("'" + parallelApiInfo.buildUsing + "' is not a function in file " + parallelApiInfo.requireFile);
186
+ }
187
+ return requiredStuff[parallelApiInfo.buildUsing](parallelApiInfo.params);
188
+ }
189
+ return requiredStuff;
190
+ }
191
+ // ember-cli-htmlbars-inline-precompile support ===
192
+ function maybeHTMLBars(object) {
193
+ const type = typeof object;
194
+ const hasProperties = type === 'function' || (type === 'object' && object !== null);
195
+ if (hasProperties &&
196
+ object.parallelBabel !== null &&
197
+ typeof object.parallelBabel === 'object' &&
198
+ typeof object.parallelBabel.requireFile === 'string') {
199
+ return {
200
+ embroiderPlaceholder: true,
201
+ type: 'htmlbars-parallel',
202
+ requireFile: object.parallelBabel.requireFile,
203
+ packageVersion: maybeNodeModuleVersion(object.parallelBabel.requireFile),
204
+ buildUsing: String(object.parallelBabel.buildUsing),
205
+ params: object.parallelBabel.params,
206
+ };
207
+ }
208
+ }
209
+ function buildHTMLBars(parallelApiInfo) {
210
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
211
+ let requiredStuff = require(parallelApiInfo.requireFile);
212
+ if (typeof requiredStuff[parallelApiInfo.buildUsing] !== 'function') {
213
+ throw new Error("'" + parallelApiInfo.buildUsing + "' is not a function in file " + parallelApiInfo.requireFile);
214
+ }
215
+ return requiredStuff[parallelApiInfo.buildUsing](parallelApiInfo.params);
216
+ }
217
+ function globalPlaceholder(value) {
218
+ let index = globalValues.length;
219
+ globalValues.push(value);
220
+ return {
221
+ value: {
222
+ embroiderPlaceholder: true,
223
+ type: 'global',
224
+ nonce,
225
+ index,
226
+ },
227
+ isParallelSafe: false,
228
+ needsHydrate: true,
229
+ };
230
+ }
231
+ //# sourceMappingURL=portable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portable.js","sourceRoot":"","sources":["../../src/portable.ts"],"names":[],"mappings":";;;;;;;;;;;;AAsBA,wDAQC;AA9BD,iEAAyC;AACzC,gEAAuC;AACvC,2DAA6C;AAC7C,gFAAsD;AAEzC,QAAA,QAAQ,GAAG,+BAA+B,CAAC;AACxD,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,CAAC;AAc/C,MAAM,EAAE,iBAAiB,EAAE,GAAG,8BAAkB,CAAC;AAEjD,SAAgB,sBAAsB,CAAC,IAAY;IACjD,MAAM,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAE5C,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,GAAG,CAAC,CAAC;IAC/D,CAAC;SAAM,CAAC;QACN,OAAO,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,4DAA4D;IACnG,CAAC;AACH,CAAC;AAED,MAAa,QAAQ;IAET;IADV,YACU,OAIJ,EAAE;QAJE,SAAI,GAAJ,IAAI,CAIN;IACL,CAAC;IAEJ,SAAS,CAAC,KAAU,EAAE,aAAuB,EAAE;QAC7C,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACxB,IAAI,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;YAC/D,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,MAAM,CAAC;YAChB,CAAC;QACH,CAAC;QAED,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO,EAAE,KAAK,EAAE,cA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,CAAC,KAAK,CAAC,CAAC;IACzB,OAAO;QACL,KAAK,EAAE;YACL,oBAAoB,EAAE,IAAI;YAC1B,IAAI,EAAE,QAAQ;YACd,KAAK;YACL,KAAK;SACN;QACD,cAAc,EAAE,KAAK;QACrB,YAAY,EAAE,IAAI;KACnB,CAAC;AACJ,CAAC","sourcesContent":["import mapValues from 'lodash/mapValues';\nimport assertNever from 'assert-never';\nimport { Memoize } from 'typescript-memoize';\nimport resolvePackagePath from 'resolve-package-path';\n\nexport const protocol = '__embroider_portable_values__';\nconst { globalValues, nonce } = setupGlobals();\n\nexport interface PortableResult {\n value: any;\n isParallelSafe: boolean;\n needsHydrate: boolean;\n}\n\nexport interface PortableHint {\n requireFile: string;\n packageVersion: string | undefined;\n useMethod?: string;\n}\n\nconst { findUpPackagePath } = resolvePackagePath;\n\nexport function maybeNodeModuleVersion(path: string) {\n const packagePath = findUpPackagePath(path);\n\n if (packagePath === null) {\n throw new Error(`Could not find package.json for '${path}'`);\n } else {\n return require(packagePath).version; // eslint-disable-line @typescript-eslint/no-require-imports\n }\n}\n\nexport class Portable {\n constructor(\n private opts: {\n dehydrate?: (value: any, accessPath: string[]) => PortableResult | undefined;\n hydrate?: (value: any, accessPath: string[]) => { value: any } | undefined;\n hints?: PortableHint[];\n } = {}\n ) {}\n\n dehydrate(value: any, accessPath: string[] = []): PortableResult {\n if (this.opts.dehydrate) {\n let result = this.opts.dehydrate.call(this, value, accessPath);\n if (result) {\n return result;\n }\n }\n\n if (value === null) {\n return { value, isParallelSafe: true, needsHydrate: false };\n }\n\n let broccoli = maybeBroccoli(value);\n if (broccoli) {\n return { value: broccoli, isParallelSafe: true, needsHydrate: true };\n }\n\n let htmlbars = maybeHTMLBars(value);\n if (htmlbars) {\n return { value: htmlbars, isParallelSafe: true, needsHydrate: true };\n }\n\n if (Array.isArray(value)) {\n let results = value.map((element, index) => this.dehydrate(element, accessPath.concat(String(index))));\n return {\n value: results.map(r => r.value),\n isParallelSafe: results.every(r => r.isParallelSafe),\n needsHydrate: results.some(r => r.needsHydrate),\n };\n }\n\n switch (typeof value) {\n case 'string':\n case 'number':\n case 'boolean':\n case 'undefined':\n return { value, isParallelSafe: true, needsHydrate: false };\n case 'object':\n if (Object.getPrototypeOf(value) === Object.prototype) {\n let isParallelSafe = true;\n let needsHydrate = false;\n let result = mapValues(value, (propertyValue, key) => {\n let result = this.dehydrate(propertyValue, accessPath.concat(key));\n isParallelSafe = isParallelSafe && result.isParallelSafe;\n needsHydrate = needsHydrate || result.needsHydrate;\n return result.value;\n });\n return { value: result, isParallelSafe, needsHydrate };\n }\n }\n\n let found = this.foundHints.get(value);\n if (found) {\n return {\n value: {\n embroiderPlaceholder: true,\n type: 'broccoli-parallel',\n requireFile: found.requireFile,\n packageVersion: maybeNodeModuleVersion(found.requireFile),\n useMethod: found.useMethod,\n },\n isParallelSafe: true,\n needsHydrate: true,\n };\n }\n\n return globalPlaceholder(value);\n }\n\n hydrate(input: any, accessPath: string[] = []): any {\n if (this.opts.hydrate) {\n let result = this.opts.hydrate.call(this, input, accessPath);\n if (result) {\n return result;\n }\n }\n if (Array.isArray(input)) {\n return input.map((element, index) => this.hydrate(element, accessPath.concat(String(index))));\n }\n if (input && typeof input === 'object') {\n if (input.embroiderPlaceholder) {\n let placeholder = input as Placeholder;\n switch (placeholder.type) {\n case 'global':\n if (placeholder.nonce !== nonce) {\n throw new Error(`unable to use this non-serializable babel config in this node process`);\n }\n return globalValues[placeholder.index];\n case 'broccoli-parallel':\n return buildBroccoli(placeholder);\n case 'htmlbars-parallel':\n return buildHTMLBars(placeholder);\n default:\n assertNever(placeholder);\n }\n } else {\n return mapValues(input, (value, key) => this.hydrate(value, accessPath.concat(key)));\n }\n }\n return input;\n }\n\n @Memoize()\n get foundHints(): Map<any, PortableHint> {\n let found = new Map();\n if (this.opts.hints) {\n for (let hint of this.opts.hints) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n let mod = require(hint.requireFile);\n if (hint.useMethod) {\n mod = mod[hint.useMethod];\n }\n found.set(mod, hint);\n }\n }\n return found;\n }\n}\n\ninterface GlobalPlaceholder {\n embroiderPlaceholder: true;\n type: 'global';\n nonce: number;\n index: number;\n}\n\ninterface BroccoliParallelPlaceholder {\n embroiderPlaceholder: true;\n type: 'broccoli-parallel';\n requireFile: string;\n packageVersion: string | undefined;\n useMethod: string | undefined;\n buildUsing: string | undefined;\n params: any;\n}\n\ninterface HTMLBarsParallelPlaceholder {\n embroiderPlaceholder: true;\n type: 'htmlbars-parallel';\n packageVersion: string | undefined;\n requireFile: string;\n buildUsing: string;\n params: any;\n}\n\ntype Placeholder = GlobalPlaceholder | BroccoliParallelPlaceholder | HTMLBarsParallelPlaceholder;\n\nfunction setupGlobals() {\n let G = global as any as { [protocol]: { globalValues: any[]; nonce: number } };\n if (!G[protocol]) {\n G[protocol] = { globalValues: [], nonce: Math.floor(Math.random() * Math.pow(2, 32)) };\n }\n return G[protocol];\n}\n\n// === broccoli-babel-transpiler support ===\n\nfunction maybeBroccoli(object: any): BroccoliParallelPlaceholder | undefined {\n const type = typeof object;\n const hasProperties = type === 'function' || (type === 'object' && object !== null);\n\n if (\n hasProperties &&\n object._parallelBabel !== null &&\n typeof object._parallelBabel === 'object' &&\n typeof object._parallelBabel.requireFile === 'string'\n ) {\n return {\n embroiderPlaceholder: true,\n type: 'broccoli-parallel',\n requireFile: object._parallelBabel.requireFile,\n packageVersion: maybeNodeModuleVersion(object._parallelBabel.requireFile),\n buildUsing: object._parallelBabel.buildUsing,\n useMethod: object._parallelBabel.useMethod,\n params: object._parallelBabel.params,\n };\n }\n}\n\nfunction buildBroccoli(parallelApiInfo: BroccoliParallelPlaceholder) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n let requiredStuff = require(parallelApiInfo.requireFile);\n\n if (parallelApiInfo.useMethod) {\n if (requiredStuff[parallelApiInfo.useMethod] === undefined) {\n throw new Error(\n \"method '\" + parallelApiInfo.useMethod + \"' does not exist in file \" + parallelApiInfo.requireFile\n );\n }\n return requiredStuff[parallelApiInfo.useMethod];\n }\n\n if (parallelApiInfo.buildUsing) {\n if (typeof requiredStuff[parallelApiInfo.buildUsing] !== 'function') {\n throw new Error(\"'\" + parallelApiInfo.buildUsing + \"' is not a function in file \" + parallelApiInfo.requireFile);\n }\n return requiredStuff[parallelApiInfo.buildUsing](parallelApiInfo.params);\n }\n\n return requiredStuff;\n}\n\n// ember-cli-htmlbars-inline-precompile support ===\nfunction maybeHTMLBars(object: any): HTMLBarsParallelPlaceholder | undefined {\n const type = typeof object;\n const hasProperties = type === 'function' || (type === 'object' && object !== null);\n\n if (\n hasProperties &&\n object.parallelBabel !== null &&\n typeof object.parallelBabel === 'object' &&\n typeof object.parallelBabel.requireFile === 'string'\n ) {\n return {\n embroiderPlaceholder: true,\n type: 'htmlbars-parallel',\n requireFile: object.parallelBabel.requireFile,\n packageVersion: maybeNodeModuleVersion(object.parallelBabel.requireFile),\n buildUsing: String(object.parallelBabel.buildUsing),\n params: object.parallelBabel.params,\n };\n }\n}\n\nfunction buildHTMLBars(parallelApiInfo: HTMLBarsParallelPlaceholder) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n let requiredStuff = require(parallelApiInfo.requireFile);\n if (typeof requiredStuff[parallelApiInfo.buildUsing] !== 'function') {\n throw new Error(\"'\" + parallelApiInfo.buildUsing + \"' is not a function in file \" + parallelApiInfo.requireFile);\n }\n return requiredStuff[parallelApiInfo.buildUsing](parallelApiInfo.params);\n}\n\nfunction globalPlaceholder(value: any): { value: GlobalPlaceholder; isParallelSafe: false; needsHydrate: true } {\n let index = globalValues.length;\n globalValues.push(value);\n return {\n value: {\n embroiderPlaceholder: true,\n type: 'global',\n nonce,\n index,\n },\n isParallelSafe: false,\n needsHydrate: true,\n };\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function resolvableExtensions(): string[];
2
+ //# sourceMappingURL=resolvable-extensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolvable-extensions.d.ts","sourceRoot":"","sources":["../../src/resolvable-extensions.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAO/C"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolvableExtensions = resolvableExtensions;
4
+ function resolvableExtensions() {
5
+ let fromEnv = process.env.EMBROIDER_RESOLVABLE_EXTENSIONS;
6
+ if (fromEnv) {
7
+ return fromEnv.split(',');
8
+ }
9
+ else {
10
+ return ['.mjs', '.gjs', '.js', '.mts', '.gts', '.ts', '.hbs', '.hbs.js', '.json'];
11
+ }
12
+ }
13
+ //# sourceMappingURL=resolvable-extensions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolvable-extensions.js","sourceRoot":"","sources":["../../src/resolvable-extensions.ts"],"names":[],"mappings":";;AAAA,oDAOC;AAPD,SAAgB,oBAAoB;IAClC,IAAI,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC;IAC1D,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACpF,CAAC;AACH,CAAC","sourcesContent":["export function resolvableExtensions(): string[] {\n let fromEnv = process.env.EMBROIDER_RESOLVABLE_EXTENSIONS;\n if (fromEnv) {\n return fromEnv.split(',');\n } else {\n return ['.mjs', '.gjs', '.js', '.mts', '.gts', '.ts', '.hbs', '.hbs.js', '.json'];\n }\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { Resolver } from './module-resolver';
2
+ export declare class ResolverLoader {
3
+ #private;
4
+ readonly appRoot: string;
5
+ constructor(appRoot: string, watch?: boolean);
6
+ close(): void;
7
+ get resolver(): Resolver;
8
+ }
9
+ //# sourceMappingURL=resolver-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver-loader.d.ts","sourceRoot":"","sources":["../../src/resolver-loader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAQ7C,qBAAa,cAAc;;IAKb,QAAQ,CAAC,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM,EAAE,KAAK,UAAQ;IASnD,KAAK;IAIL,IAAI,QAAQ,IAAI,QAAQ,CAyBvB;CACF"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ResolverLoader = void 0;
4
+ const fs_extra_1 = require("fs-extra");
5
+ const module_resolver_options_1 = require("./module-resolver-options");
6
+ const module_resolver_1 = require("./module-resolver");
7
+ const shared_internals_1 = require("@embroider/shared-internals");
8
+ const path_1 = require("path");
9
+ const fs_1 = require("fs");
10
+ class ResolverLoader {
11
+ appRoot;
12
+ #resolver;
13
+ #configFile;
14
+ #watcher;
15
+ constructor(appRoot, watch = false) {
16
+ this.appRoot = appRoot;
17
+ this.#configFile = (0, path_1.join)((0, shared_internals_1.locateEmbroiderWorkingDir)(this.appRoot), 'resolver.json');
18
+ if (watch) {
19
+ this.#watcher = (0, fs_1.watch)(this.#configFile, { persistent: false }, () => {
20
+ this.#resolver = undefined;
21
+ });
22
+ }
23
+ }
24
+ close() {
25
+ this.#watcher?.close();
26
+ }
27
+ get resolver() {
28
+ if (!this.#resolver) {
29
+ let config;
30
+ if ((0, fs_extra_1.existsSync)(this.#configFile)) {
31
+ let rawConfig = (0, fs_extra_1.readJSONSync)(this.#configFile);
32
+ rawConfig.splitAtRoutes = rawConfig.splitAtRoutes?.map((splitRouteConfig) => {
33
+ if (splitRouteConfig.type === 'regex') {
34
+ const fragments = splitRouteConfig.value.match(/^\/(.*)\/([gimsuy]*)$/);
35
+ if (!fragments) {
36
+ throw new Error(`Unable to parse splitAtRoutes pattern ${splitRouteConfig.value}`);
37
+ }
38
+ const [, parsedPattern, parsedFlags] = fragments;
39
+ return new RegExp(parsedPattern, parsedFlags);
40
+ }
41
+ return splitRouteConfig.value;
42
+ });
43
+ config = rawConfig;
44
+ }
45
+ else {
46
+ config = (0, module_resolver_options_1.buildResolverOptions)({});
47
+ }
48
+ this.#resolver = new module_resolver_1.Resolver(config);
49
+ }
50
+ return this.#resolver;
51
+ }
52
+ }
53
+ exports.ResolverLoader = ResolverLoader;
54
+ //# sourceMappingURL=resolver-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver-loader.js","sourceRoot":"","sources":["../../src/resolver-loader.ts"],"names":[],"mappings":";;;AAAA,uCAAoD;AACpD,uEAA+E;AAC/E,uDAA6C;AAC7C,kEAAwE;AACxE,+BAA4B;AAE5B,2BAAsC;AAItC,MAAa,cAAc;IAKJ;IAJrB,SAAS,CAAuB;IAChC,WAAW,CAAS;IACpB,QAAQ,CAAwB;IAEhC,YAAqB,OAAe,EAAE,KAAK,GAAG,KAAK;QAA9B,YAAO,GAAP,OAAO,CAAQ;QAClC,IAAI,CAAC,WAAW,GAAG,IAAA,WAAI,EAAC,IAAA,4CAAyB,EAAC,IAAI,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,CAAC;QAClF,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,QAAQ,GAAG,IAAA,UAAO,EAAC,IAAI,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE;gBACpE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;YAC7B,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,QAAQ;QACV,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,MAAe,CAAC;YACpB,IAAI,IAAA,qBAAU,EAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;gBACjC,IAAI,SAAS,GAAG,IAAA,uBAAY,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBAE/C,SAAS,CAAC,aAAa,GAAG,SAAS,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,gBAAsC,EAAE,EAAE;oBAChG,IAAI,gBAAgB,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;wBACtC,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;wBACxE,IAAI,CAAC,SAAS,EAAE,CAAC;4BACf,MAAM,IAAI,KAAK,CAAC,yCAAyC,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC;wBACrF,CAAC;wBACD,MAAM,CAAC,EAAE,aAAa,EAAE,WAAW,CAAC,GAAG,SAAS,CAAC;wBACjD,OAAO,IAAI,MAAM,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;oBAChD,CAAC;oBACD,OAAO,gBAAgB,CAAC,KAAK,CAAC;gBAChC,CAAC,CAAC,CAAC;gBAEH,MAAM,GAAG,SAAS,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,IAAA,8CAAoB,EAAC,EAAE,CAAC,CAAC;YACpC,CAAC;YACD,IAAI,CAAC,SAAS,GAAG,IAAI,0BAAQ,CAAC,MAAM,CAAC,CAAC;QACxC,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF;AA5CD,wCA4CC","sourcesContent":["import { existsSync, readJSONSync } from 'fs-extra';\nimport { buildResolverOptions, type Options } from './module-resolver-options';\nimport { Resolver } from './module-resolver';\nimport { locateEmbroiderWorkingDir } from '@embroider/shared-internals';\nimport { join } from 'path';\nimport type { FSWatcher } from 'fs';\nimport { watch as fsWatch } from 'fs';\n\ntype SplitRouteConfigType = { type: 'string'; value: string } | { type: 'regex'; value: string };\n\nexport class ResolverLoader {\n #resolver: Resolver | undefined;\n #configFile: string;\n #watcher: FSWatcher | undefined;\n\n constructor(readonly appRoot: string, watch = false) {\n this.#configFile = join(locateEmbroiderWorkingDir(this.appRoot), 'resolver.json');\n if (watch) {\n this.#watcher = fsWatch(this.#configFile, { persistent: false }, () => {\n this.#resolver = undefined;\n });\n }\n }\n\n close() {\n this.#watcher?.close();\n }\n\n get resolver(): Resolver {\n if (!this.#resolver) {\n let config: Options;\n if (existsSync(this.#configFile)) {\n let rawConfig = readJSONSync(this.#configFile);\n\n rawConfig.splitAtRoutes = rawConfig.splitAtRoutes?.map((splitRouteConfig: SplitRouteConfigType) => {\n if (splitRouteConfig.type === 'regex') {\n const fragments = splitRouteConfig.value.match(/^\\/(.*)\\/([gimsuy]*)$/);\n if (!fragments) {\n throw new Error(`Unable to parse splitAtRoutes pattern ${splitRouteConfig.value}`);\n }\n const [, parsedPattern, parsedFlags] = fragments;\n return new RegExp(parsedPattern, parsedFlags);\n }\n return splitRouteConfig.value;\n });\n\n config = rawConfig;\n } else {\n config = buildResolverOptions({});\n }\n this.#resolver = new Resolver(config);\n }\n return this.#resolver;\n }\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { Node } from 'broccoli-node-api';
2
+ export default interface Stage {
3
+ readonly tree: Node;
4
+ readonly inputPath: string;
5
+ ready(): Promise<{
6
+ readonly outputPath: string;
7
+ }>;
8
+ }
9
+ //# sourceMappingURL=stage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../src/stage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAY9C,MAAM,CAAC,OAAO,WAAW,KAAK;IAI5B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAIpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAI3B,KAAK,IAAI,OAAO,CAAC;QAGf,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;KAC7B,CAAC,CAAC;CACJ"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=stage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stage.js","sourceRoot":"","sources":["../../src/stage.ts"],"names":[],"mappings":"","sourcesContent":["import type { Node } from 'broccoli-node-api';\n\n// A build Stage is _kinda_ like a Broccoli transform, and it interoperates with\n// Broccoli, but it takes a different approach to how stages combine.\n//\n// Conceptually, normal broccoli transforms pass trees by value (meaning they\n// always get copied) whereas Stages pass trees by reference (meaning they can\n// be borrowed and mutated).\n//\n// This would be potentially bad if abused, but we are only using them for\n// precisely three well-defined stages, where each has clear responsibilities.\n//\nexport default interface Stage {\n // this is the broccoli tree that must get built for the Stage to be ready.\n // But! This tree's output path is _not_ necessarily where the Stage's output\n // will be, for that you must wait for `outputPath`.\n readonly tree: Node;\n\n // this is where our stage was reading from. Subsequent stages are also\n // allowed to read from here in addition to reading from our `outputPath`.\n readonly inputPath: string;\n\n // this promise is only guaranteed to resolve if you cause `tree` to be\n // included in a broccoli build.\n ready(): Promise<{\n // This is the actual directory in which the output will be. It's guaranteed\n // to not change once you get it.\n readonly outputPath: string;\n }>;\n}\n"]}
@@ -0,0 +1,36 @@
1
+ import type { Resolver } from '.';
2
+ import { type TestSupportResponse } from './virtual-test-support';
3
+ import { type TestSupportStylesResponse } from './virtual-test-support-styles';
4
+ import { type VirtualVendorResponse } from './virtual-vendor';
5
+ import { type VirtualVendorStylesResponse } from './virtual-vendor-styles';
6
+ import { type EntrypointResponse } from './virtual-entrypoint';
7
+ import { type RouteEntrypointResponse } from './virtual-route-entrypoint';
8
+ export type VirtualResponse = {
9
+ specifier: string;
10
+ } & (FastbootSwitchResponse | ImplicitModulesResponse | EntrypointResponse | RouteEntrypointResponse | TestSupportResponse | TestSupportStylesResponse | VirtualVendorResponse | VirtualVendorStylesResponse | VirtualPairResponse | TemplateOnlyComponentResponse);
11
+ export interface VirtualContentResult {
12
+ src: string;
13
+ watches: string[];
14
+ }
15
+ export declare function virtualContent(response: VirtualResponse, resolver: Resolver): VirtualContentResult;
16
+ export interface VirtualPairResponse {
17
+ type: 'component-pair';
18
+ specifier: string;
19
+ hbsModule: string;
20
+ jsModule: string | null;
21
+ debugName: string;
22
+ }
23
+ interface FastbootSwitchResponse {
24
+ type: 'fastboot-switch';
25
+ names: Set<string>;
26
+ }
27
+ export interface ImplicitModulesResponse {
28
+ type: 'implicit-modules' | 'implicit-test-modules';
29
+ fromFile: string;
30
+ }
31
+ export interface TemplateOnlyComponentResponse {
32
+ type: 'template-only-component-js';
33
+ specifier: string;
34
+ }
35
+ export {};
36
+ //# sourceMappingURL=virtual-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtual-content.d.ts","sourceRoot":"","sources":["../../src/virtual-content.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAyB,MAAM,GAAG,CAAC;AAGzD,OAAO,EAA6B,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,EAA2B,KAAK,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AACxG,OAAO,EAAgB,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAsB,KAAK,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAE/F,OAAO,EAAE,KAAK,kBAAkB,EAAoB,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAyB,KAAK,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAGjG,MAAM,MAAM,eAAe,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,CAClD,sBAAsB,GACtB,uBAAuB,GACvB,kBAAkB,GAClB,uBAAuB,GACvB,mBAAmB,GACnB,yBAAyB,GACzB,qBAAqB,GACrB,2BAA2B,GAC3B,mBAAmB,GACnB,6BAA6B,CAChC,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,GA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