@ttsc/metro 0.30.4 → 0.31.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 (62) hide show
  1. package/README.md +11 -6
  2. package/lib/core/SnapshotReadOperations.d.ts +119 -0
  3. package/lib/core/SnapshotReadOperations.js +3 -0
  4. package/lib/core/SnapshotReadOperations.js.map +1 -0
  5. package/lib/core/SnapshotReadOperations.mjs +2 -0
  6. package/lib/core/SnapshotReadOperations.mjs.map +1 -0
  7. package/lib/core/TtscMetroOptions.d.ts +119 -0
  8. package/lib/core/TtscMetroOptions.js +3 -0
  9. package/lib/core/TtscMetroOptions.js.map +1 -0
  10. package/lib/core/TtscMetroOptions.mjs +2 -0
  11. package/lib/core/TtscMetroOptions.mjs.map +1 -0
  12. package/lib/core/TtscMetroProjectView.d.ts +64 -0
  13. package/lib/core/TtscMetroProjectView.js +3 -0
  14. package/lib/core/TtscMetroProjectView.js.map +1 -0
  15. package/lib/core/TtscMetroProjectView.mjs +2 -0
  16. package/lib/core/TtscMetroProjectView.mjs.map +1 -0
  17. package/lib/core/UpstreamTransformer.d.ts +127 -0
  18. package/lib/core/UpstreamTransformer.js +3 -0
  19. package/lib/core/UpstreamTransformer.js.map +1 -0
  20. package/lib/core/UpstreamTransformer.mjs +2 -0
  21. package/lib/core/UpstreamTransformer.mjs.map +1 -0
  22. package/lib/core/fingerprint.d.ts +442 -97
  23. package/lib/core/fingerprint.js +838 -83
  24. package/lib/core/fingerprint.js.map +1 -1
  25. package/lib/core/fingerprint.mjs +839 -84
  26. package/lib/core/fingerprint.mjs.map +1 -1
  27. package/lib/core/options.d.ts +81 -58
  28. package/lib/core/options.js +81 -4
  29. package/lib/core/options.js.map +1 -1
  30. package/lib/core/options.mjs +81 -4
  31. package/lib/core/options.mjs.map +1 -1
  32. package/lib/core/remapAstLocations.d.ts +76 -0
  33. package/lib/core/remapAstLocations.js +205 -0
  34. package/lib/core/remapAstLocations.js.map +1 -0
  35. package/lib/core/remapAstLocations.mjs +203 -0
  36. package/lib/core/remapAstLocations.mjs.map +1 -0
  37. package/lib/core/upstream.d.ts +97 -27
  38. package/lib/core/upstream.js +109 -8
  39. package/lib/core/upstream.js.map +1 -1
  40. package/lib/core/upstream.mjs +109 -9
  41. package/lib/core/upstream.mjs.map +1 -1
  42. package/lib/index.d.ts +50 -2
  43. package/lib/index.js +88 -24
  44. package/lib/index.js.map +1 -1
  45. package/lib/index.mjs +89 -25
  46. package/lib/index.mjs.map +1 -1
  47. package/lib/transformer.d.ts +183 -6
  48. package/lib/transformer.js +209 -14
  49. package/lib/transformer.js.map +1 -1
  50. package/lib/transformer.mjs +211 -16
  51. package/lib/transformer.mjs.map +1 -1
  52. package/package.json +7 -18
  53. package/src/core/SnapshotReadOperations.ts +121 -0
  54. package/src/core/TtscMetroOptions.ts +127 -0
  55. package/src/core/TtscMetroProjectView.ts +74 -0
  56. package/src/core/UpstreamTransformer.ts +126 -0
  57. package/src/core/fingerprint.ts +987 -109
  58. package/src/core/options.ts +85 -62
  59. package/src/core/remapAstLocations.ts +219 -0
  60. package/src/core/upstream.ts +110 -26
  61. package/src/index.ts +99 -28
  62. package/src/transformer.ts +214 -17
@@ -6,6 +6,7 @@ var node_module = require('node:module');
6
6
  var path = require('node:path');
7
7
  var fingerprint = require('./core/fingerprint.js');
8
8
  var options$1 = require('./core/options.js');
9
+ var remapAstLocations = require('./core/remapAstLocations.js');
9
10
  var upstream = require('./core/upstream.js');
10
11
 
11
12
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
@@ -25,6 +26,11 @@ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentS
25
26
  * generation hit. Cross-file invalidation also rides the project fingerprint
26
27
  * {@link getCacheKey} folds into Metro's static transformer key (see
27
28
  * `core/fingerprint.ts`).
29
+ *
30
+ * The adapter passes no `watching` declaration in its hooks, so a project whose
31
+ * plugin observations are unavailable (a generation the core can only serve
32
+ * fresh) fails the transform with an explicit error instead of caching it: the
33
+ * core refuses fresh-only output unless the host states it is not watching.
28
34
  */
29
35
  const nodeRequire = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('transformer.js', document.baseURI).href)));
30
36
  /**
@@ -36,6 +42,9 @@ const nodeRequire = node_module.createRequire((typeof document === 'undefined' ?
36
42
  let resolved;
37
43
  let unpluginOptions;
38
44
  const cache = api.createTtscTransformCache();
45
+ // Metro's workers share each compile through the session `withTtsc` opened
46
+ // (samchon/ttsc#1390).
47
+ api.shareTtscTransformCache(cache, api.readTtscTransformSession());
39
48
  let snapshotRecorder;
40
49
  /** Lazily resolve the worker-side options (from {@link resolveOptionsFromEnv}). */
41
50
  function options() {
@@ -57,6 +66,39 @@ function recorder() {
57
66
  * monorepos and when Metro is launched from a parent directory. Getting this
58
67
  * wrong makes every file look "outside the project" and silently skips the
59
68
  * plugin pass.
69
+ *
70
+ * @evidence contracts/common.md#principled-implementation
71
+ * Node path.isAbsolute/path.resolve implement Metro's filename contract.
72
+ * Absolute input is retained; relative input is anchored at supplied
73
+ * projectRoot, with cwd only for callers lacking that option.
74
+ *
75
+ * @evidence contracts/common.md#clear-and-simple-design
76
+ * This helper owns the single relative-to-absolute boundary, keeping Metro's
77
+ * original filename separate from the compiler address.
78
+ *
79
+ * @evidenceExclude contracts/performance.md#efficient-algorithms
80
+ * This operation chooses a base and delegates native path resolution;
81
+ * it owns no input collection or processing strategy.
82
+ *
83
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work
84
+ * It maps one filename and supplied options without shared computation.
85
+ *
86
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources
87
+ * The returned path transfers to its caller; no resource is retained.
88
+ *
89
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
90
+ * This correct owning anchor avoids monorepo misrouting without matching
91
+ * error text or special-casing fixture names.
92
+ *
93
+ * @evidence contracts/portability.md#os-neutral-implementation
94
+ * Node path handles native separators, roots and drive letters. No URLs or
95
+ * shell commands are mixed with filenames and no filesystem is changed.
96
+ *
97
+ * @evidence contracts/common.md#meaningful-documentation
98
+ * The native JSDoc explains the project-relative input, absolute result and
99
+ * cwd fallback reason. Checked against the documentation skill: separate
100
+ * paragraphs state the contract and why its nonobvious boundary matters;
101
+ * field comments retain their own useful facts.
60
102
  */
61
103
  function resolveAbsoluteFilename(filename, options) {
62
104
  if (path.isAbsolute(filename)) {
@@ -74,7 +116,60 @@ function resolveAbsoluteFilename(filename, options) {
74
116
  * Expo/React-Native Babel transformer to produce the AST Metro expects. The
75
117
  * upstream call receives Metro's original params (notably the project-relative
76
118
  * `filename`, which Babel expects); only `src` is replaced with the
77
- * ttsc-transformed source.
119
+ * ttsc-transformed source. When the adapter returns a source map for that
120
+ * source, the upstream AST's locations are moved back through it to the
121
+ * author's lines, because Metro maps the AST against the file it read
122
+ * (samchon/ttsc#1392).
123
+ *
124
+ * An explicit `project` option selects its tsconfig. Otherwise the adapter
125
+ * discovers the nearest tsconfig and follows its references to the project
126
+ * admitting the file, using Metro's `projectRoot` or the current working
127
+ * directory to resolve a relative file.
128
+ *
129
+ * @evidence contracts/common.md#principled-implementation
130
+ * Metro's transformer callback composes the shared Unplugin transform core
131
+ * with the selected Babel transformer. One resolved project view is frozen
132
+ * into compilation and recorder inputs. Noneligible or out-of-program files
133
+ * follow the shared core contract; genuine compiler/load failures propagate.
134
+ *
135
+ * @evidence contracts/common.md#clear-and-simple-design
136
+ * The entry point gates delivery, freezes one project view for compilation
137
+ * and recording, then delegates to Babel. Shared core helpers own checking
138
+ * and caching; the adapter owns only Metro transport and AST remapping.
139
+ *
140
+ * @evidence contracts/performance.md#efficient-algorithms
141
+ * Filtering runs before compilation. Eligible deliveries resolve one view
142
+ * and record their inputs in a single batch; compiler and AST traversal
143
+ * costs belong to their delegated owners rather than repeated per input.
144
+ *
145
+ * @evidence contracts/performance.md#reuse-equivalent-work
146
+ * The worker's shared transform cache validates project state on each hit,
147
+ * while the inherited session shares compilation across workers. The same
148
+ * project view and options feed compilation and generation recording; Babel
149
+ * is invoked for the actual delivery and is not memoized by this adapter.
150
+ *
151
+ * @evidence contracts/performance.md#bound-retention-and-release-resources
152
+ * Worker singletons own resolved options, the transform cache and recorder
153
+ * until process termination. The shared core owns cached generations and
154
+ * session storage; the recorder owns its cumulative paths. This entry point
155
+ * exposes no disposal signal from Metro and does not claim a fixed byte bound.
156
+ *
157
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
158
+ * Only the returned AST's owned locations are updated, with no patched
159
+ * loader or test-specific production behavior.
160
+ *
161
+ * @evidence contracts/portability.md#os-neutral-implementation
162
+ * Metro-relative filenames drive substring filters; Node path.resolve
163
+ * produces absolute compiler addresses. The shared core owns native
164
+ * compiler/session access, while Babel retains the original filename.
165
+ * Worker transport is JSON and no shell command is constructed here.
166
+ *
167
+ * @evidence contracts/common.md#meaningful-documentation
168
+ * The native JSDoc explains pass order, original parameter preservation,
169
+ * project selection and AST location mutation. Checked against the
170
+ * documentation skill: separate paragraphs state the contract and why its
171
+ * nonobvious boundary matters; field comments retain their own useful
172
+ * facts.
78
173
  */
79
174
  async function transform(params) {
80
175
  const opts = options();
@@ -87,6 +182,8 @@ async function transform(params) {
87
182
  return upstream$1.transform(params);
88
183
  }
89
184
  let transformedSrc = params.src;
185
+ let transformedMap;
186
+ let absoluteFilename = params.filename;
90
187
  {
91
188
  unpluginOptions ??= api.resolveOptions(opts.ttsc);
92
189
  const projectRoot = typeof params.options.projectRoot === "string"
@@ -94,6 +191,7 @@ async function transform(params) {
94
191
  : undefined;
95
192
  const explicitProject = typeof opts.ttsc.project === "string" ? opts.ttsc.project : undefined;
96
193
  const filename = resolveAbsoluteFilename(params.filename, params.options);
194
+ absoluteFilename = filename;
97
195
  const project = fingerprint.resolveProjectView({
98
196
  compilerOptions: opts.ttsc.compilerOptions,
99
197
  explicitProject,
@@ -139,9 +237,16 @@ async function transform(params) {
139
237
  // Genuine compile and type failures still propagate so Metro surfaces them.
140
238
  if (result !== undefined && typeof result.code === "string") {
141
239
  transformedSrc = result.code;
240
+ transformedMap = result.map;
142
241
  }
143
242
  }
144
- return upstream$1.transform({ ...params, src: transformedSrc });
243
+ const output = await upstream$1.transform({ ...params, src: transformedSrc });
244
+ // Metro maps the returned AST against the file it read, so the upstream's
245
+ // positions in the transformed text are moved back to the author's lines.
246
+ if (transformedMap !== undefined) {
247
+ remapAstLocations.remapAstLocations(output.ast, transformedMap, absoluteFilename);
248
+ }
249
+ return output;
145
250
  }
146
251
  /**
147
252
  * Metro transform-cache key.
@@ -162,23 +267,70 @@ async function transform(params) {
162
267
  * A change to any fingerprinted input re-keys every transformed file at
163
268
  * project-level granularity, forced by Metro's single static key, replacing the
164
269
  * former manual `--reset-cache` step. Resolving the upstream is deliberately
165
- * non-fatal here: a missing peer must not crash cache-key computation. See the
166
- * README "Caveats" and samchon/ttsc#721.
270
+ * non-fatal here: a missing peer must not crash cache-key computation, but a
271
+ * failed upstream key withdraws reuse with a nonce. See the README "Caveats"
272
+ * and samchon/ttsc#721.
273
+ *
274
+ * @evidence contracts/common.md#principled-implementation
275
+ * Node sha256 combines package identity, stable resolved options, forwarded
276
+ * upstream key and the project fingerprint required by Metro's
277
+ * one-static-key contract. Failed upstream loads or callbacks contribute a
278
+ * nonce; an absent optional callback contributes no additional key.
279
+ * Forwarded compiler and plugin records retain their JSON property order
280
+ * because the compiler or a plugin can give that order semantic meaning.
281
+ * Fingerprint failure disables reuse through a nonce rather
282
+ * than fabricating a proven generation.
283
+ *
284
+ * @evidence contracts/common.md#clear-and-simple-design
285
+ * One hash assembly combines options, upstream contribution and the project
286
+ * fingerprint. The fingerprint owner handles persistence and validity;
287
+ * cacheKeyProjectRoot extracts Metro's argument without duplicating discovery.
288
+ *
289
+ * @evidence contracts/performance.md#efficient-algorithms
290
+ * One static key per Metro run hashes encoded options, the upstream key
291
+ * and one project fingerprint. Key assembly is linear in their string bytes;
292
+ * the fingerprint owner accounts for project scans and config traversal.
293
+ *
294
+ * @evidence contracts/performance.md#reuse-equivalent-work
295
+ * Options, adapter version, upstream key and exact project state contribute
296
+ * to the shared key. Project observation failures withdraw reuse through a
297
+ * nonce. A failing upstream load or key uses a nonce too, preserving the
298
+ * nonfatal keying boundary without pretending its external state is known.
299
+ *
300
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources
301
+ * The hash is local to this call. Worker singletons are owned by transform
302
+ * and persisted baseline files by prepareSnapshot, not the hash assembler.
303
+ *
304
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
305
+ * Decision values come from the documented inputs and product protocol
306
+ * rather than expected test answers. No compensating path is introduced to
307
+ * make a known example pass.
308
+ *
309
+ * @evidence contracts/portability.md#os-neutral-implementation
310
+ * Native project roots are interpreted by the fingerprint owner and Node
311
+ * module loading reads package identity. Hash input has deterministic
312
+ * string representation across OSes; filesystem content and identity remain
313
+ * deliberately host-specific.
314
+ *
315
+ * @evidence contracts/common.md#meaningful-documentation
316
+ * The native JSDoc explains one key per run, all contributions,
317
+ * project-wide invalidation and nonfatal upstream key policy. Checked
318
+ * against the documentation skill: separate paragraphs state the contract
319
+ * and why its nonobvious boundary matters; field comments retain their own
320
+ * useful facts.
167
321
  */
168
322
  function getCacheKey(...args) {
169
323
  const opts = options();
170
324
  const hash = node_crypto.createHash("sha256");
171
325
  hash.update(`@ttsc/metro:${packageVersion()}`);
172
326
  hash.update(fingerprint.stableStringify({
173
- ttsc: opts.ttsc,
327
+ ttsc: JSON.stringify(opts.ttsc),
174
328
  include: opts.include,
175
329
  exclude: opts.exclude,
176
330
  upstreamTransformer: opts.upstreamTransformer ?? null,
177
331
  }));
178
332
  const upstreamKey = upstreamCacheKey(opts.upstreamTransformer, args);
179
- if (upstreamKey.length !== 0) {
180
- hash.update(upstreamKey);
181
- }
333
+ hash.update(upstreamKey ?? `nonce:${node_crypto.randomBytes(32).toString("hex")}`);
182
334
  hash.update(fingerprint.computeProjectFingerprint({
183
335
  // The same overlay `transform` hands the recorder. Both read these
184
336
  // options from `options()`, so the walk and the recorder judge one
@@ -211,8 +363,9 @@ function cacheKeyProjectRoot(args) {
211
363
  * Fold the upstream transformer's cache key in, defensively. Forwards Metro's
212
364
  * own `getCacheKey` arguments so the upstream's babelrc-derived key is
213
365
  * preserved, and never throws: a missing peer or a throwing upstream
214
- * `getCacheKey` yields an empty contribution rather than failing the whole
215
- * build's cache keying.
366
+ * `getCacheKey` yields `undefined`, withdrawing cross-run reuse without failing
367
+ * the whole build's cache keying. An absent optional callback still contributes
368
+ * the empty string.
216
369
  */
217
370
  function upstreamCacheKey(upstreamTransformer, args) {
218
371
  let upstream$1;
@@ -220,7 +373,7 @@ function upstreamCacheKey(upstreamTransformer, args) {
220
373
  upstream$1 = upstream.resolveUpstreamTransformer(upstreamTransformer);
221
374
  }
222
375
  catch {
223
- return "";
376
+ return undefined;
224
377
  }
225
378
  if (upstream$1.getCacheKey === undefined) {
226
379
  return "";
@@ -229,14 +382,56 @@ function upstreamCacheKey(upstreamTransformer, args) {
229
382
  return String(upstream$1.getCacheKey(...args) ?? "");
230
383
  }
231
384
  catch {
232
- return "";
385
+ return undefined;
233
386
  }
234
387
  }
235
388
  /**
236
389
  * Decide whether a file should run through the ttsc pass. Only TypeScript
237
390
  * sources (`.ts`/`.tsx`/`.mts`/`.cts`, excluding every declaration form)
238
- * qualify; `exclude` substrings win over `include`, and an empty `include`
239
- * means "all TypeScript". Exported for unit testing.
391
+ * qualify, and a file below a `node_modules` directory never does, whatever
392
+ * `include` says, because the shared `isTransformTarget` predicate rejects it
393
+ * first. `exclude` substrings win over `include`, and an empty `include` means
394
+ * "all eligible TypeScript". Patterns use the supplied project-relative
395
+ * filename literally; this operation does not normalize separators or
396
+ * filesystem case.
397
+ *
398
+ * @evidence contracts/common.md#principled-implementation
399
+ * The shared isTransformTarget predicate owns supported TypeScript
400
+ * extensions, declaration exclusions, virtual-module and node_modules
401
+ * exclusions. Literal substring filters apply to Metro's project-relative
402
+ * filename, with exclusion taking precedence.
403
+ *
404
+ * @evidence contracts/common.md#clear-and-simple-design
405
+ * This predicate orders extension eligibility, exclusion and inclusion as
406
+ * early returns. Compiler execution remains outside the filtering policy.
407
+ *
408
+ * @evidence contracts/performance.md#efficient-algorithms
409
+ * Extension matching precedes substring scans; exclusion returns early and
410
+ * inclusion stops at its first match. Cost follows pattern count and supplied
411
+ * filename length without allocating a normalized copy for literal matching.
412
+ *
413
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work
414
+ * This inexpensive predicate coordinates no shared computation and accepts
415
+ * caller-owned, potentially mutable option arrays.
416
+ *
417
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources
418
+ * Filtering retains no caller data and opens no native resource.
419
+ *
420
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
421
+ * This pure decision neither invokes compilation nor mutates options, and
422
+ * has no fixture or test-mode branch.
423
+ *
424
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation
425
+ * This predicate matches TypeScript extensions and caller-supplied literal
426
+ * substrings. It defines no filesystem identity or native path
427
+ * normalization contract.
428
+ *
429
+ * @evidence contracts/common.md#meaningful-documentation
430
+ * The native JSDoc explains eligible extensions, declaration and
431
+ * node_modules exclusion, empty include and exclusion precedence. Checked
432
+ * against the documentation skill: separate paragraphs state the contract
433
+ * and why its nonobvious boundary matters; field comments retain their own
434
+ * useful facts.
240
435
  */
241
436
  function shouldTransform(filename, opts) {
242
437
  if (!api.isTransformTarget(filename)) {
@@ -1 +1 @@
1
- {"version":3,"file":"transformer.js","sources":["../src/transformer.ts"],"sourcesContent":[null],"names":["createRequire","createTtscTransformCache","resolveOptionsFromEnv","createSnapshotRecorder","upstream","resolveUpstreamTransformer","resolveOptions","resolveProjectView","transformTtsc","createHash","stableStringify","computeProjectFingerprint","isTransformTarget"],"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;AAgBG;AAqBH,MAAM,WAAW,GAAGA,yBAAa,CAAC,gQAA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;AAC3E,QAAA,OAAO,GAAG,CAAC,OAAO,IAAI,GAAG;IAC3B;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,GAAG;IACZ;AACF;;;;;;;"}
1
+ {"version":3,"file":"transformer.js","sources":["../src/transformer.ts"],"sourcesContent":[null],"names":["createRequire","createTtscTransformCache","shareTtscTransformCache","readTtscTransformSession","resolveOptionsFromEnv","createSnapshotRecorder","upstream","resolveUpstreamTransformer","resolveOptions","resolveProjectView","transformTtsc","remapAstLocations","createHash","stableStringify","randomBytes","computeProjectFingerprint","isTransformTarget"],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAwBH,MAAM,WAAW,GAAGA,yBAAa,CAAC,gQAAe,CAAC;AAElD;;;;;AAKG;AACH,IAAI,QAA8C;AAClD,IAAI,eAA8D;AAClE,MAAM,KAAK,GAAGC,4BAAwB,EAAE;AACxC;AACA;AACAC,2BAAuB,CAAC,KAAK,EAAEC,4BAAwB,EAAE,CAAC;AAC1D,IAAI,gBAAuE;AAE3E;AACA,SAAS,OAAO,GAAA;AACd,IAAA,QAAQ,QAAQ,KAAKC,+BAAqB,EAAE;AAC9C;AAEA;AACA,SAAS,QAAQ,GAAA;AACf,IAAA,MAAM,IAAI,GAAG,OAAO,EAAE;IACtB,QAAQ,gBAAgB,KAAKC,kCAAsB,CAAC,IAAI,CAAC,aAAa,CAAC;AACzE;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CG;AACG,SAAU,uBAAuB,CACrC,QAAgB,EAChB,OAAiC,EAAA;AAEjC,IAAA,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;AAC7B,QAAA,OAAO,QAAQ;IACjB;IACA,MAAM,WAAW,GACf,OAAO,KAAK,SAAS,IAAI,OAAO,OAAO,CAAC,WAAW,KAAK;UACpD,OAAO,CAAC;AACV,UAAE,OAAO,CAAC,GAAG,EAAE;IACnB,OAAO,IAAI,C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