@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
@@ -22,14 +22,55 @@ const UPSTREAM_CANDIDATES = [
22
22
  * 1. An explicit `customPath` (the `upstreamTransformer` option);
23
23
  * 2. Each of {@link UPSTREAM_CANDIDATES} in turn.
24
24
  *
25
- * These are declared as optional peers and resolved at runtime against the
26
- * consumer project, so the adapter carries no Metro/Expo dependency itself.
27
- * Resolution is not memoised: Node's own module cache already makes the
28
- * repeated `require` a cheap lookup, and keeping no module-level state lets a
29
- * changed `upstreamTransformer` always take effect.
30
- *
31
- * `load` is injectable purely so the resolution order and the not-found path
32
- * can be tested deterministically; production always uses the real `require`.
25
+ * `withTtsc` resolves an explicit specifier and the automatic candidates from
26
+ * the consuming project in the Metro config process, and publishes the absolute
27
+ * path it found (see {@link locateProjectUpstreamTransformer}). This worker-side
28
+ * lookup, rooted in the adapter's own location, is what remains for a specifier
29
+ * the project could not resolve, so the adapter carries no Metro/Expo
30
+ * dependency itself. Resolution is not memoised: Node's own module cache
31
+ * already makes the repeated `require` a cheap lookup, and keeping no
32
+ * module-level state lets a changed `upstreamTransformer` always take effect.
33
+ *
34
+ * `load` is the explicit module-loading boundary. Its default uses Node's real
35
+ * `require`; an injected loader must preserve absence versus failure
36
+ * semantics.
37
+ *
38
+ * @evidence contracts/common.md#principled-implementation
39
+ * Node createRequire loads the configured module or documented
40
+ * Expo/React-Native candidates. Resolution is separated from execution: only
41
+ * known entry-absence codes permit another automatic candidate;
42
+ * installed-module initialization failures preserve their cause.
43
+ *
44
+ * @evidence contracts/common.md#clear-and-simple-design
45
+ * Explicit selection and ordered detection share the loading boundary.
46
+ * tryRequire owns absence classification, leaving this function to choose
47
+ * the transformer and attach contextual errors.
48
+ *
49
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
50
+ * The loader argument is an explicit dependency-injection boundary, not a
51
+ * test-only runtime branch or a patched require.
52
+ *
53
+ * @evidence contracts/portability.md#os-neutral-implementation
54
+ * Node resolution accepts project-resolved absolute paths on Windows and
55
+ * POSIX. createRequire is rooted at this module via import.meta.url; no
56
+ * path is turned into a shell command. Runtime errors propagate through the
57
+ * same policy on every OS.
58
+ *
59
+ * @evidence contracts/common.md#meaningful-documentation
60
+ * The native JSDoc explains candidate order, project versus worker
61
+ * resolution and absence versus initialization failures. Checked against
62
+ * the documentation skill: separate paragraphs state the contract and why
63
+ * its nonobvious boundary matters; field comments retain their own useful
64
+ * facts.
65
+ *
66
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources
67
+ * Keeps no state between calls; loaded modules belong to Node's module cache.
68
+ *
69
+ * @evidenceExclude contracts/performance.md#efficient-algorithms
70
+ * At most three candidate probes per call, each a require.resolve followed by one require.
71
+ *
72
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work
73
+ * Deliberately unmemoised: Node's module cache makes a repeated require cheap and a changed option must take effect.
33
74
  */
34
75
  function resolveUpstreamTransformer(customPath, load = tryRequire) {
35
76
  if (customPath !== undefined && customPath.length !== 0) {
@@ -69,6 +110,65 @@ function resolveUpstreamTransformer(customPath, load = tryRequire) {
69
110
  "(React Native), or set the `upstreamTransformer` option to an explicit " +
70
111
  "module path.");
71
112
  }
113
+ /**
114
+ * Locate the automatic upstream transformer the consuming project installed,
115
+ * without executing it.
116
+ *
117
+ * The candidates belong to the app, not to this adapter: under pnpm or a linked
118
+ * workspace the adapter sits outside the app's `node_modules` ancestry, so a
119
+ * lookup rooted in the adapter cannot see a transformer only the app installed.
120
+ * `resolve` is rooted in the project; each candidate is tried in
121
+ * {@link UPSTREAM_CANDIDATES} order and an absent one is skipped, exactly as the
122
+ * worker's probe skips it. Only resolution runs here, so a broken installation
123
+ * still fails where the worker loads it, with its own error.
124
+ *
125
+ * @param resolve Resolves a module specifier from the project.
126
+ * @returns The absolute path of the first installed candidate, or `undefined`.
127
+ * @evidence contracts/common.md#principled-implementation
128
+ * The supplied project resolver uses Node module resolution without
129
+ * executing candidate code. Only recognized entry-absence errors continue
130
+ * probing; other resolver failures propagate.
131
+ *
132
+ * @evidence contracts/common.md#clear-and-simple-design
133
+ * Project discovery resolves only the shared candidate list; execution is
134
+ * deferred to the worker loader that owns initialization failures.
135
+ *
136
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
137
+ * The documented optional-peer order is a product default, not a
138
+ * fixture-specific answer. No module methods are replaced.
139
+ *
140
+ * @evidence contracts/portability.md#os-neutral-implementation
141
+ * The injected resolver owns project filesystem resolution on the host OS.
142
+ * This operation compares module specifiers and returns its absolute result
143
+ * without inventing separators or quoting a command.
144
+ *
145
+ * @evidence contracts/common.md#meaningful-documentation
146
+ * The native JSDoc explains project ownership, ordered probing,
147
+ * nonexecution and the absent result. Checked against the documentation
148
+ * skill: separate paragraphs state the contract and why its nonobvious
149
+ * boundary matters; field comments retain their own useful facts.
150
+ *
151
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources
152
+ * Resolves paths without executing a candidate and retains nothing.
153
+ *
154
+ * @evidenceExclude contracts/performance.md#efficient-algorithms
155
+ * At most three resolutions, stopping at the first one that succeeds.
156
+ *
157
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work
158
+ * Runs once per withTtsc call, in the config process only.
159
+ */
160
+ function locateProjectUpstreamTransformer(resolve) {
161
+ for (const candidate of UPSTREAM_CANDIDATES) {
162
+ try {
163
+ return resolve(candidate);
164
+ }
165
+ catch (error) {
166
+ if (!isCandidateAbsent(error))
167
+ throw error;
168
+ }
169
+ }
170
+ return undefined;
171
+ }
72
172
  /**
73
173
  * Load an upstream transformer module, separating genuine absence from a broken
74
174
  * installation.
@@ -132,5 +232,6 @@ function errorMessage(error) {
132
232
  }
133
233
 
134
234
  exports.UPSTREAM_CANDIDATES = UPSTREAM_CANDIDATES;
235
+ exports.locateProjectUpstreamTransformer = locateProjectUpstreamTransformer;
135
236
  exports.resolveUpstreamTransformer = resolveUpstreamTransformer;
136
237
  //# sourceMappingURL=upstream.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"upstream.js","sources":["../../src/core/upstream.ts"],"sourcesContent":[null],"names":["createRequire"],"mappings":";;;;;AAEA,MAAM,WAAW,GAAGA,yBAAa,CAAC,kQAAe,CAAC;AAqBlD;;;;AAIG;AACI,MAAM,mBAAmB,GAAG;IACjC,sCAAsC;IACtC,uCAAuC;IACvC,sCAAsC;;AAGxC;;;;;;;;;;;;;;;;AAgBG;SACa,0BAA0B,CACxC,UAAmB,EACnB,OAAgE,UAAU,EAAA;IAE1E,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;AACvD,QAAA,IAAI,QAAyC;AAC7C,QAAA,IAAI;AACF,YAAA,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC;QAC7B;QAAE,OAAO,KAAK,EAAE;;;;AAId,YAAA,MAAM,IAAI,KAAK,CACb,CAAA,kEAAA,EAAqE,UA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,IAAA,IAAI,KAAK,YAAY,KAAK,EAAE;QAC1B,OAAO,KAAK,CAAC,OAAO;IACtB;AACA,IAAA,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB;;;;;;"}
@@ -19,14 +19,55 @@ const UPSTREAM_CANDIDATES = [
19
19
  * 1. An explicit `customPath` (the `upstreamTransformer` option);
20
20
  * 2. Each of {@link UPSTREAM_CANDIDATES} in turn.
21
21
  *
22
- * These are declared as optional peers and resolved at runtime against the
23
- * consumer project, so the adapter carries no Metro/Expo dependency itself.
24
- * Resolution is not memoised: Node's own module cache already makes the
25
- * repeated `require` a cheap lookup, and keeping no module-level state lets a
26
- * changed `upstreamTransformer` always take effect.
27
- *
28
- * `load` is injectable purely so the resolution order and the not-found path
29
- * can be tested deterministically; production always uses the real `require`.
22
+ * `withTtsc` resolves an explicit specifier and the automatic candidates from
23
+ * the consuming project in the Metro config process, and publishes the absolute
24
+ * path it found (see {@link locateProjectUpstreamTransformer}). This worker-side
25
+ * lookup, rooted in the adapter's own location, is what remains for a specifier
26
+ * the project could not resolve, so the adapter carries no Metro/Expo
27
+ * dependency itself. Resolution is not memoised: Node's own module cache
28
+ * already makes the repeated `require` a cheap lookup, and keeping no
29
+ * module-level state lets a changed `upstreamTransformer` always take effect.
30
+ *
31
+ * `load` is the explicit module-loading boundary. Its default uses Node's real
32
+ * `require`; an injected loader must preserve absence versus failure
33
+ * semantics.
34
+ *
35
+ * @evidence contracts/common.md#principled-implementation
36
+ * Node createRequire loads the configured module or documented
37
+ * Expo/React-Native candidates. Resolution is separated from execution: only
38
+ * known entry-absence codes permit another automatic candidate;
39
+ * installed-module initialization failures preserve their cause.
40
+ *
41
+ * @evidence contracts/common.md#clear-and-simple-design
42
+ * Explicit selection and ordered detection share the loading boundary.
43
+ * tryRequire owns absence classification, leaving this function to choose
44
+ * the transformer and attach contextual errors.
45
+ *
46
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
47
+ * The loader argument is an explicit dependency-injection boundary, not a
48
+ * test-only runtime branch or a patched require.
49
+ *
50
+ * @evidence contracts/portability.md#os-neutral-implementation
51
+ * Node resolution accepts project-resolved absolute paths on Windows and
52
+ * POSIX. createRequire is rooted at this module via import.meta.url; no
53
+ * path is turned into a shell command. Runtime errors propagate through the
54
+ * same policy on every OS.
55
+ *
56
+ * @evidence contracts/common.md#meaningful-documentation
57
+ * The native JSDoc explains candidate order, project versus worker
58
+ * resolution and absence versus initialization failures. Checked against
59
+ * the documentation skill: separate paragraphs state the contract and why
60
+ * its nonobvious boundary matters; field comments retain their own useful
61
+ * facts.
62
+ *
63
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources
64
+ * Keeps no state between calls; loaded modules belong to Node's module cache.
65
+ *
66
+ * @evidenceExclude contracts/performance.md#efficient-algorithms
67
+ * At most three candidate probes per call, each a require.resolve followed by one require.
68
+ *
69
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work
70
+ * Deliberately unmemoised: Node's module cache makes a repeated require cheap and a changed option must take effect.
30
71
  */
31
72
  function resolveUpstreamTransformer(customPath, load = tryRequire) {
32
73
  if (customPath !== undefined && customPath.length !== 0) {
@@ -66,6 +107,65 @@ function resolveUpstreamTransformer(customPath, load = tryRequire) {
66
107
  "(React Native), or set the `upstreamTransformer` option to an explicit " +
67
108
  "module path.");
68
109
  }
110
+ /**
111
+ * Locate the automatic upstream transformer the consuming project installed,
112
+ * without executing it.
113
+ *
114
+ * The candidates belong to the app, not to this adapter: under pnpm or a linked
115
+ * workspace the adapter sits outside the app's `node_modules` ancestry, so a
116
+ * lookup rooted in the adapter cannot see a transformer only the app installed.
117
+ * `resolve` is rooted in the project; each candidate is tried in
118
+ * {@link UPSTREAM_CANDIDATES} order and an absent one is skipped, exactly as the
119
+ * worker's probe skips it. Only resolution runs here, so a broken installation
120
+ * still fails where the worker loads it, with its own error.
121
+ *
122
+ * @param resolve Resolves a module specifier from the project.
123
+ * @returns The absolute path of the first installed candidate, or `undefined`.
124
+ * @evidence contracts/common.md#principled-implementation
125
+ * The supplied project resolver uses Node module resolution without
126
+ * executing candidate code. Only recognized entry-absence errors continue
127
+ * probing; other resolver failures propagate.
128
+ *
129
+ * @evidence contracts/common.md#clear-and-simple-design
130
+ * Project discovery resolves only the shared candidate list; execution is
131
+ * deferred to the worker loader that owns initialization failures.
132
+ *
133
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
134
+ * The documented optional-peer order is a product default, not a
135
+ * fixture-specific answer. No module methods are replaced.
136
+ *
137
+ * @evidence contracts/portability.md#os-neutral-implementation
138
+ * The injected resolver owns project filesystem resolution on the host OS.
139
+ * This operation compares module specifiers and returns its absolute result
140
+ * without inventing separators or quoting a command.
141
+ *
142
+ * @evidence contracts/common.md#meaningful-documentation
143
+ * The native JSDoc explains project ownership, ordered probing,
144
+ * nonexecution and the absent result. Checked against the documentation
145
+ * skill: separate paragraphs state the contract and why its nonobvious
146
+ * boundary matters; field comments retain their own useful facts.
147
+ *
148
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources
149
+ * Resolves paths without executing a candidate and retains nothing.
150
+ *
151
+ * @evidenceExclude contracts/performance.md#efficient-algorithms
152
+ * At most three resolutions, stopping at the first one that succeeds.
153
+ *
154
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work
155
+ * Runs once per withTtsc call, in the config process only.
156
+ */
157
+ function locateProjectUpstreamTransformer(resolve) {
158
+ for (const candidate of UPSTREAM_CANDIDATES) {
159
+ try {
160
+ return resolve(candidate);
161
+ }
162
+ catch (error) {
163
+ if (!isCandidateAbsent(error))
164
+ throw error;
165
+ }
166
+ }
167
+ return undefined;
168
+ }
69
169
  /**
70
170
  * Load an upstream transformer module, separating genuine absence from a broken
71
171
  * installation.
@@ -128,5 +228,5 @@ function errorMessage(error) {
128
228
  return String(error);
129
229
  }
130
230
 
131
- export { UPSTREAM_CANDIDATES, resolveUpstreamTransformer };
231
+ export { UPSTREAM_CANDIDATES, locateProjectUpstreamTransformer, resolveUpstreamTransformer };
132
232
  //# sour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C5C;IACF;AACA,IAAA,OAAO,SAAS;AAClB;AAEA;;;;;;;;;;;;AAYG;AACH,SAAS,UAAU,CAAC,UAAkB,EAAA;AACpC,IAAA,IAAI;AACF,QAAA,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC;IACjC;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE;AAC5B,YAAA,OAAO,SAAS;QAClB;;;;AAIA,QAAA,MAAM,KAAK;IACb;AACA,IAAA,OAAO,WAAW,CAAC,UAAU,CAAwB;AACvD;AAEA;;;;;;;;;;;;;;;;;;;AAmBG;AACH,SAAS,iBAAiB,CAAC,KAAc,EAAA;AACvC,IAAA,MAAM,IAAI,GAAI,KAA+C,EAAE,IAAI;IACnE,QACE,IAAI,KAAK,kBAAkB;AAC3B,QAAA,IAAI,KAAK,sBAAsB;QAC/B,IAAI,KAAK,+BAA+B;AAE5C;AAEA;AACA,SAAS,YAAY,CAAC,KAAc,EAAA;AAClC,IAAA,IAAI,KAAK,YAAY,KAAK,EAAE;QAC1B,OAAO,KAAK,CAAC,OAAO;IACtB;AACA,IAAA,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB;;;;"}
package/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { TtscMetroOptions } from "./core/options";
2
- export type { ResolvedTtscMetroOptions, TtscMetroOptions, } from "./core/options";
1
+ import type { TtscMetroOptions } from "./core/TtscMetroOptions";
2
+ export type { ResolvedTtscMetroOptions, TtscMetroOptions, } from "./core/TtscMetroOptions";
3
3
  /**
4
4
  * Minimal structural type for a Metro config object, avoids a hard dependency
5
5
  * on Metro's types while letting {@link withTtsc} preserve the caller's exact
@@ -32,5 +32,53 @@ interface MetroConfigLike {
32
32
  * `.svg` to the auto-detected Expo default instead, with the build still
33
33
  * succeeding (samchon/ttsc#1321). An explicit `upstreamTransformer` option
34
34
  * still wins, since that is the caller saying it outright.
35
+ *
36
+ * The call also has side effects beyond the returned config, all before Metro
37
+ * forks its workers. It prepares the cache-key snapshot under
38
+ * `<projectRoot>/node_modules/.cache/ttsc-metro` (creating it, merging the
39
+ * previous workers' records into it under a lock, and sweeping stale files),
40
+ * and it opens the shared compile session whose path the workers inherit
41
+ * through the environment. A snapshot that cannot be prepared never fails the
42
+ * call: the run takes a private token that makes its cache key non-reusable.
43
+ *
44
+ * @evidence contracts/common.md#principled-implementation
45
+ * Metro's supported babelTransformerPath boundary installs this adapter by
46
+ * cloning the config. Node project resolution preserves an existing upstream
47
+ * unless explicitly overridden, and realpath/package ownership filters
48
+ * inherited self-selection; explicit upstream choices remain caller-owned.
49
+ * Only the owned option/session environment channels are published before
50
+ * workers start; foreign loaders and methods are not patched.
51
+ *
52
+ * @evidence contracts/common.md#clear-and-simple-design
53
+ * The entry point prepares run ownership and worker transport, then clones
54
+ * the config's transformer field. Separate helpers own upstream inheritance
55
+ * and module identity instead of repeating those policies in workers.
56
+ *
57
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
58
+ * Decision values come from the documented inputs and product protocol
59
+ * rather than expected test answers. No compensating path is introduced to
60
+ * make a known example pass.
61
+ *
62
+ * @evidence contracts/portability.md#os-neutral-implementation
63
+ * Node paths, createRequire and fileURLToPath resolve native paths and module
64
+ * URLs. The shared filesystem-identity resolver handles links and actual
65
+ * directory case capabilities in the recursion guard, instead of folding
66
+ * all names by OS. Worker options use JSON environment inheritance.
67
+ *
68
+ * @evidence contracts/common.md#meaningful-documentation
69
+ * The native JSDoc explains config preservation, upstream precedence, JSON
70
+ * worker transport and preparation side effects. Checked against the
71
+ * documentation skill: separate paragraphs state the contract and why its
72
+ * nonobvious boundary matters; field comments retain their own useful
73
+ * facts.
74
+ *
75
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources
76
+ * The compaction lock it takes is released in prepareSnapshot's finally block and the session store is owned by its opener; withTtsc retains no handle itself.
77
+ *
78
+ * @evidenceExclude contracts/performance.md#efficient-algorithms
79
+ * Constant work per call besides the snapshot preparation that prepareSnapshot owns.
80
+ *
81
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work
82
+ * Runs once per Metro config load; the snapshot and compile session it opens are what the workers share.
35
83
  */
36
84
  export declare function withTtsc<T extends MetroConfigLike>(config: T, options?: TtscMetroOptions): T;
package/lib/index.js CHANGED
@@ -1,11 +1,14 @@
1
1
  'use strict';
2
2
 
3
+ var api = require('@ttsc/unplugin/api');
3
4
  var fs = require('node:fs');
4
5
  var node_module = require('node:module');
5
6
  var path = require('node:path');
6
7
  var node_url = require('node:url');
8
+ var pathIdentity = require('ttsc/path-identity');
7
9
  var fingerprint = require('./core/fingerprint.js');
8
10
  var options = require('./core/options.js');
11
+ var upstream = require('./core/upstream.js');
9
12
 
10
13
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
11
14
  /**
@@ -57,14 +60,65 @@ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentS
57
60
  * `.svg` to the auto-detected Expo default instead, with the build still
58
61
  * succeeding (samchon/ttsc#1321). An explicit `upstreamTransformer` option
59
62
  * still wins, since that is the caller saying it outright.
63
+ *
64
+ * The call also has side effects beyond the returned config, all before Metro
65
+ * forks its workers. It prepares the cache-key snapshot under
66
+ * `<projectRoot>/node_modules/.cache/ttsc-metro` (creating it, merging the
67
+ * previous workers' records into it under a lock, and sweeping stale files),
68
+ * and it opens the shared compile session whose path the workers inherit
69
+ * through the environment. A snapshot that cannot be prepared never fails the
70
+ * call: the run takes a private token that makes its cache key non-reusable.
71
+ *
72
+ * @evidence contracts/common.md#principled-implementation
73
+ * Metro's supported babelTransformerPath boundary installs this adapter by
74
+ * cloning the config. Node project resolution preserves an existing upstream
75
+ * unless explicitly overridden, and realpath/package ownership filters
76
+ * inherited self-selection; explicit upstream choices remain caller-owned.
77
+ * Only the owned option/session environment channels are published before
78
+ * workers start; foreign loaders and methods are not patched.
79
+ *
80
+ * @evidence contracts/common.md#clear-and-simple-design
81
+ * The entry point prepares run ownership and worker transport, then clones
82
+ * the config's transformer field. Separate helpers own upstream inheritance
83
+ * and module identity instead of repeating those policies in workers.
84
+ *
85
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts
86
+ * Decision values come from the documented inputs and product protocol
87
+ * rather than expected test answers. No compensating path is introduced to
88
+ * make a known example pass.
89
+ *
90
+ * @evidence contracts/portability.md#os-neutral-implementation
91
+ * Node paths, createRequire and fileURLToPath resolve native paths and module
92
+ * URLs. The shared filesystem-identity resolver handles links and actual
93
+ * directory case capabilities in the recursion guard, instead of folding
94
+ * all names by OS. Worker options use JSON environment inheritance.
95
+ *
96
+ * @evidence contracts/common.md#meaningful-documentation
97
+ * The native JSDoc explains config preservation, upstream precedence, JSON
98
+ * worker transport and preparation side effects. Checked against the
99
+ * documentation skill: separate paragraphs state the contract and why its
100
+ * nonobvious boundary matters; field comments retain their own useful
101
+ * facts.
102
+ *
103
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources
104
+ * The compaction lock it takes is released in prepareSnapshot's finally block and the session store is owned by its opener; withTtsc retains no handle itself.
105
+ *
106
+ * @evidenceExclude contracts/performance.md#efficient-algorithms
107
+ * Constant work per call besides the snapshot preparation that prepareSnapshot owns.
108
+ *
109
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work
110
+ * Runs once per Metro config load; the snapshot and compile session it opens are what the workers share.
60
111
  */
61
112
  function withTtsc(config, options$1 = {}) {
62
113
  // Prepare the reference-graph snapshot backing the transformer's cache-key
63
114
  // fingerprint (see `core/fingerprint.ts`). This runs in the single Metro
64
- // config process before any worker exists, so it is the race-free moment to
65
- // mint the snapshot epoch and compact the previous run's worker files.
115
+ // config process before its workers exist. The snapshot owner serializes
116
+ // concurrent config processes while compacting the previous worker records.
66
117
  const snapshotRunId = fingerprint.prepareSnapshot(typeof config.projectRoot === "string" ? config.projectRoot : undefined);
67
118
  process.env[options.ENV_KEY] = options.serializeOptions(inheritConfiguredTransformer(config, options$1), snapshotRunId);
119
+ // The workers Metro forks next inherit the session, so the pool compiles
120
+ // each generation once between them (samchon/ttsc#1390).
121
+ api.openTtscTransformSession();
68
122
  return {
69
123
  ...config,
70
124
  transformer: {
@@ -87,11 +141,24 @@ function withTtsc(config, options$1 = {}) {
87
141
  * and delegate into itself.
88
142
  */
89
143
  function inheritConfiguredTransformer(config, options) {
144
+ // An explicit option is the caller's module, so it resolves from the project
145
+ // as a declared `babelTransformerPath` does; an empty one asks for detection.
146
+ if (options.upstreamTransformer !== undefined &&
147
+ options.upstreamTransformer.length !== 0) {
148
+ return {
149
+ ...options,
150
+ upstreamTransformer: resolveFromProject(options.upstreamTransformer, config),
151
+ };
152
+ }
90
153
  const declared = config.transformer?.babelTransformerPath;
91
- if (options.upstreamTransformer !== undefined ||
92
- typeof declared !== "string" ||
93
- declared.length === 0) {
94
- return options;
154
+ if (typeof declared !== "string" || declared.length === 0) {
155
+ // Automatic detection belongs here too: the candidates are the app's
156
+ // packages, and only this process knows the project to look in. Nothing
157
+ // found leaves the worker's own probe to report it.
158
+ const located = upstream.locateProjectUpstreamTransformer((specifier) => projectRequire(config).resolve(specifier));
159
+ return located === undefined
160
+ ? options
161
+ : { ...options, upstreamTransformer: located };
95
162
  }
96
163
  // Resolve before judging. Ownership is a property of the module, not of the
97
164
  // string, and every spelling has to become one absolute path before either
@@ -129,16 +196,20 @@ function inheritConfiguredTransformer(config, options) {
129
196
  * somewhere less legible.
130
197
  */
131
198
  function resolveFromProject(declared, config) {
132
- const base = typeof config.projectRoot === "string" && config.projectRoot.length !== 0
133
- ? config.projectRoot
134
- : process.cwd();
135
199
  try {
136
- return node_module.createRequire(path.join(path.resolve(base), "package.json")).resolve(declared);
200
+ return projectRequire(config).resolve(declared);
137
201
  }
138
202
  catch {
139
203
  return declared;
140
204
  }
141
205
  }
206
+ /** A `require` rooted in the Metro project, the owner of its transformers. */
207
+ function projectRequire(config) {
208
+ const base = typeof config.projectRoot === "string" && config.projectRoot.length !== 0
209
+ ? config.projectRoot
210
+ : process.cwd();
211
+ return node_module.createRequire(path.join(path.resolve(base), "package.json"));
212
+ }
142
213
  /**
143
214
  * Whether a `babelTransformerPath` already points at a `@ttsc/metro`
144
215
  * transformer — this copy or any other.
@@ -176,22 +247,15 @@ function isOwnTransformer(declared) {
176
247
  /**
177
248
  * Whether two paths name the same file on disk.
178
249
  *
179
- * Resolved through `realpath` so a symlinked install and its target compare
180
- * equal, and case-folded on Windows, where `D:\` and `d:\` and a differently
181
- * cased base name all address one file.
250
+ * The shared resolver observes physical spelling and directory capabilities
251
+ * within this comparison. Symlinks can identify the same installed file while
252
+ * case-sensitive native names remain distinct.
182
253
  */
183
254
  function sameRealPath(left, right) {
184
- const identity = (file) => {
185
- let resolved = path.resolve(file);
186
- try {
187
- resolved = fs.realpathSync.native(resolved);
188
- }
189
- catch {
190
- // Not on disk: the resolved spelling is the best identity available.
191
- }
192
- return process.platform === "win32" ? resolved.toLowerCase() : resolved;
193
- };
194
- return identity(left) === identity(right);
255
+ const identities = pathIdentity.createFilesystemPathIdentityContext({
256
+ throwOnRealpathError: false,
257
+ });
258
+ return identities.resolve(left).key === identities.resolve(right).key;
195
259
  }
196
260
  /**
197
261
  * Absolute path to the built transformer module Metro will `require`.
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":[null],"names":["options","prepareSnapshot","ENV_KEY","serializeOptions","createRequire","join","resolve","basename","dirname","readFileSync","realpathSync","fileURLToPath"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AA4BH;;;;;;;;;;;;;;;;;;;;AAoBG;SACa,QAAQ,CACtB,MAAS,EACTA,YAA4B,EAAE,EAAA;;;;;IAM9B,MAAM,aAAa,GAAGC,2BAAe,CACnC,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,GAAG,MAAM,CAAC,WAAW,GAAG,SAAS,CACxE;AACD,IAAA,OAAO,CAAC,GAAG,CAACC,eAAO,CAAC,GAAGC,wBAAgB,CACrC,4B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cesContent":[null],"names":["options","prepareSnapshot","ENV_KEY","serializeOptions","openTtscTransformSession","locateProjectUpstreamTransformer","createRequire","join","resolve","basename","dirname","readFileSync","createFilesystemPathIdentityContext","fileURLToPath"],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AA+BH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEG;SACa,QAAQ,CACtB,MAAS,EACTA,YAA4B,EAAE,EAAA;;;;;IAM9B,MAAM,aAAa,GAAGC,2BAAe,CACnC,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,GAAG,MAAM,CAAC,WAAW,GAAG,SAAS,CACxE;AACD,IAAA,OAAO,CAAC,GAAG,CAACC,eAAO,CAAC,GAAGC,wBAAgB,CACrC,4BAA4B,CAAC,MAAM,EAAEH,SAAO,CAAC,EAC7C,aAAa,CACd;;;AAGD,IAAAI,4BAAwB,EAAE;IAC1B,OAAO;AACL,QAAA,GAAG,MAAM;AACT,QAAA,WAAW,EAAE;YACX,GAAG,MAAM,CAAC,WAAW;YACrB,oBAAoB,EAAE,qBAAqB,EAAE;AAC9C,SAAA;KACG;AACR;AAEA;;;;;;;;;;;;AAYG;AACH,SAAS,4BAA4B,CACnC,MAAuB,EACvB,OAAyB,EAAA;;;AAIzB,IAAA,IACE,OAAO,CAAC,mBAAmB,KAAK,SAAS;AACzC,QAAA,OAAO,CAAC,mBAAmB,CAAC,MAAM,KAAK,CAAC,EACxC;QACA,OAAO;AACL,YAAA,GAAG,OAAO;YACV,mBAAmB,EAAE,kBAAkB,CACrC,OAAO,CAAC,mBAAmB,EAC3B,MAAM,CACP;SACF;IACH;AACA,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,EAAE,oBAAoB;IACzD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;;;;AAIz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