@ttsc/metro 0.20.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/transformer.js +5 -5
- package/lib/transformer.mjs +5 -5
- package/package.json +3 -3
- package/src/transformer.ts +5 -5
package/README.md
CHANGED
|
@@ -72,11 +72,11 @@ For each TypeScript file Metro asks to transform:
|
|
|
72
72
|
1. `@ttsc/metro` runs the `ttsc` plugin pass (reusing `@ttsc/unplugin`'s transform core) → transformed **TypeScript** source.
|
|
73
73
|
2. The transformed source is handed to the upstream Expo/React-Native Babel transformer, which strips types, applies the RN transforms, and returns the Babel AST Metro consumes.
|
|
74
74
|
|
|
75
|
-
The plugin contract
|
|
75
|
+
The plugin contract and `tsconfig` discovery match the Unplugin integrations. Metro's worker has no build-start callback, so its shared transform cache validates the complete project snapshot on every hit instead of using a build-scoped first-delivery shortcut.
|
|
76
76
|
|
|
77
77
|
## Cache invalidation
|
|
78
78
|
|
|
79
|
-
Metro keys its transform cache on each file's own content plus one static transformer key, and its babel-transformer contract has no per-file dependency registration. A `ttsc` transform can depend on a _type_ in another file, so `@ttsc/metro` folds a project fingerprint into that static key: every
|
|
79
|
+
Metro keys its transform cache on each file's own content plus one static transformer key, and its babel-transformer contract has no per-file dependency registration. A `ttsc` transform can depend on a _type_ in another file, so `@ttsc/metro` folds a project fingerprint into that static key: every regular file reached by the non-following project walk, plus reference-graph inputs outside that walk (`node_modules` declarations, monorepo sibling sources, files reached through symlinks or Windows junctions, and out-of-root tsconfig `extends` ancestry) recorded under `node_modules/.cache/ttsc-metro`. Editing any of them re-keys the next run, so `metro bundle` and dev-server starts pick up cross-file type changes without `--reset-cache`.
|
|
80
80
|
|
|
81
81
|
The granularity is project-level by necessity: Metro evaluates the transformer key once per run, so any fingerprinted change re-transforms every file on the next run. What remains outside the mechanism's reach:
|
|
82
82
|
|
package/lib/transformer.js
CHANGED
|
@@ -20,11 +20,11 @@ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentS
|
|
|
20
20
|
* (strips types, RN transforms) -> Babel AST (what Metro consumes)
|
|
21
21
|
*
|
|
22
22
|
* The ttsc pass reuses `@ttsc/unplugin`'s `transformTtsc`, so the plugin
|
|
23
|
-
* contract
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
23
|
+
* contract and tsconfig discovery are identical to the bundler integrations.
|
|
24
|
+
* Its per-worker cache has no build-start signal and therefore validates every
|
|
25
|
+
* generation hit. Cross-file invalidation also rides the project fingerprint
|
|
26
|
+
* {@link getCacheKey} folds into Metro's static transformer key (see
|
|
27
|
+
* `core/fingerprint.ts`).
|
|
28
28
|
*/
|
|
29
29
|
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
30
|
/**
|
package/lib/transformer.mjs
CHANGED
|
@@ -17,11 +17,11 @@ import { resolveUpstreamTransformer } from './core/upstream.mjs';
|
|
|
17
17
|
* (strips types, RN transforms) -> Babel AST (what Metro consumes)
|
|
18
18
|
*
|
|
19
19
|
* The ttsc pass reuses `@ttsc/unplugin`'s `transformTtsc`, so the plugin
|
|
20
|
-
* contract
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
20
|
+
* contract and tsconfig discovery are identical to the bundler integrations.
|
|
21
|
+
* Its per-worker cache has no build-start signal and therefore validates every
|
|
22
|
+
* generation hit. Cross-file invalidation also rides the project fingerprint
|
|
23
|
+
* {@link getCacheKey} folds into Metro's static transformer key (see
|
|
24
|
+
* `core/fingerprint.ts`).
|
|
25
25
|
*/
|
|
26
26
|
const nodeRequire = createRequire(import.meta.url);
|
|
27
27
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttsc/metro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "Metro (React Native / Expo) adapter for ttsc plugins.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.mjs",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"src"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ttsc/unplugin": "^0.
|
|
38
|
+
"@ttsc/unplugin": "^0.21.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@expo/metro-config": "*",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"tinyglobby": "^0.2.16",
|
|
63
63
|
"tslib": "^2.8.1",
|
|
64
64
|
"typescript": "^7.0.2",
|
|
65
|
-
"ttsc": "0.
|
|
65
|
+
"ttsc": "0.21.0"
|
|
66
66
|
},
|
|
67
67
|
"repository": {
|
|
68
68
|
"type": "git",
|
package/src/transformer.ts
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
* (strips types, RN transforms) -> Babel AST (what Metro consumes)
|
|
10
10
|
*
|
|
11
11
|
* The ttsc pass reuses `@ttsc/unplugin`'s `transformTtsc`, so the plugin
|
|
12
|
-
* contract
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* contract and tsconfig discovery are identical to the bundler integrations.
|
|
13
|
+
* Its per-worker cache has no build-start signal and therefore validates every
|
|
14
|
+
* generation hit. Cross-file invalidation also rides the project fingerprint
|
|
15
|
+
* {@link getCacheKey} folds into Metro's static transformer key (see
|
|
16
|
+
* `core/fingerprint.ts`).
|
|
17
17
|
*/
|
|
18
18
|
import {
|
|
19
19
|
createTtscTransformCache,
|