@ttsc/unplugin 0.28.5 → 0.29.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 +15 -11
- package/lib/api.js +10 -0
- package/lib/api.js.map +1 -1
- package/lib/api.mjs +3 -2
- package/lib/api.mjs.map +1 -1
- package/lib/bun-register.d.cts +10 -7
- package/lib/bun-register.d.mts +10 -7
- package/lib/bun-register.d.ts +10 -7
- package/lib/bun-register.js +90 -24
- package/lib/bun-register.js.map +1 -1
- package/lib/bun-register.mjs +90 -24
- package/lib/bun-register.mjs.map +1 -1
- package/lib/bun.d.cts +10 -8
- package/lib/bun.d.mts +10 -8
- package/lib/bun.d.ts +10 -8
- package/lib/bun.js +19 -17
- package/lib/bun.js.map +1 -1
- package/lib/bun.mjs +20 -18
- package/lib/bun.mjs.map +1 -1
- package/lib/core/index.d.cts +10 -8
- package/lib/core/index.d.mts +10 -8
- package/lib/core/index.d.ts +10 -8
- package/lib/core/index.js +88 -16
- package/lib/core/index.js.map +1 -1
- package/lib/core/index.mjs +81 -18
- package/lib/core/index.mjs.map +1 -1
- package/lib/core/projectDiscovery.d.cts +55 -0
- package/lib/core/projectDiscovery.d.mts +55 -0
- package/lib/core/projectDiscovery.d.ts +55 -0
- package/lib/core/projectDiscovery.js +187 -0
- package/lib/core/projectDiscovery.js.map +1 -0
- package/lib/core/projectDiscovery.mjs +182 -0
- package/lib/core/projectDiscovery.mjs.map +1 -0
- package/lib/core/sourceExtensions.d.cts +10 -0
- package/lib/core/sourceExtensions.d.mts +10 -0
- package/lib/core/sourceExtensions.d.ts +10 -0
- package/lib/core/sourceExtensions.js +38 -0
- package/lib/core/sourceExtensions.js.map +1 -0
- package/lib/core/sourceExtensions.mjs +32 -0
- package/lib/core/sourceExtensions.mjs.map +1 -0
- package/lib/core/transform.d.cts +96 -16
- package/lib/core/transform.d.mts +96 -16
- package/lib/core/transform.d.ts +96 -16
- package/lib/core/transform.js +1295 -309
- package/lib/core/transform.js.map +1 -1
- package/lib/core/transform.mjs +1290 -310
- package/lib/core/transform.mjs.map +1 -1
- package/lib/core/tsconfigPaths.d.cts +55 -3
- package/lib/core/tsconfigPaths.d.mts +55 -3
- package/lib/core/tsconfigPaths.d.ts +55 -3
- package/lib/core/tsconfigPaths.js +260 -46
- package/lib/core/tsconfigPaths.js.map +1 -1
- package/lib/core/tsconfigPaths.mjs +255 -47
- package/lib/core/tsconfigPaths.mjs.map +1 -1
- package/lib/core/viteServe.d.cts +18 -21
- package/lib/core/viteServe.d.mts +18 -21
- package/lib/core/viteServe.d.ts +18 -21
- package/lib/core/viteServe.js +88 -47
- package/lib/core/viteServe.js.map +1 -1
- package/lib/core/viteServe.mjs +89 -49
- package/lib/core/viteServe.mjs.map +1 -1
- package/lib/next.d.cts +7 -0
- package/lib/next.d.mts +7 -0
- package/lib/next.d.ts +7 -0
- package/lib/next.js +186 -54
- package/lib/next.js.map +1 -1
- package/lib/next.mjs +186 -55
- package/lib/next.mjs.map +1 -1
- package/lib/turbopack.d.cts +6 -4
- package/lib/turbopack.d.mts +6 -4
- package/lib/turbopack.d.ts +6 -4
- package/lib/turbopack.js +11 -10
- package/lib/turbopack.js.map +1 -1
- package/lib/turbopack.mjs +11 -10
- package/lib/turbopack.mjs.map +1 -1
- package/package.json +7 -4
- package/src/bun-register.ts +112 -25
- package/src/bun.ts +60 -50
- package/src/core/index.ts +114 -19
- package/src/core/projectDiscovery.ts +256 -0
- package/src/core/sourceExtensions.ts +47 -0
- package/src/core/transform.ts +1671 -361
- package/src/core/tsconfigPaths.ts +406 -46
- package/src/core/viteServe.ts +125 -74
- package/src/next.ts +230 -54
- package/src/turbopack.ts +11 -10
package/src/turbopack.ts
CHANGED
|
@@ -63,6 +63,8 @@ const transformCache = createTtscTransformCache();
|
|
|
63
63
|
* rules: {
|
|
64
64
|
* "*.ts": { loaders: ["@ttsc/unplugin/turbopack"] },
|
|
65
65
|
* "*.tsx": { loaders: ["@ttsc/unplugin/turbopack"] },
|
|
66
|
+
* "*.mts": { loaders: ["@ttsc/unplugin/turbopack"] },
|
|
67
|
+
* "*.cts": { loaders: ["@ttsc/unplugin/turbopack"] },
|
|
66
68
|
* },
|
|
67
69
|
* },
|
|
68
70
|
* };
|
|
@@ -70,10 +72,10 @@ const transformCache = createTtscTransformCache();
|
|
|
70
72
|
*
|
|
71
73
|
* Pass {@link TtscUnpluginOptions} through the rule's `options` object. The
|
|
72
74
|
* loader returns the source unchanged for anything {@link isTransformTarget}
|
|
73
|
-
* excludes
|
|
74
|
-
* and virtual ids
|
|
75
|
-
* shared predicate itself rather than a local copy, because a broad
|
|
76
|
-
* routes everything matching the extension through the loader.
|
|
75
|
+
* excludes: declaration files, `node_modules` paths, non-TypeScript sources,
|
|
76
|
+
* and virtual ids. It also preserves transforms that produce no change and
|
|
77
|
+
* applies the shared predicate itself rather than a local copy, because a broad
|
|
78
|
+
* rule glob routes everything matching the extension through the loader.
|
|
77
79
|
*/
|
|
78
80
|
export default function turbopack(
|
|
79
81
|
this: TtscTurbopackLoaderContext,
|
|
@@ -81,12 +83,11 @@ export default function turbopack(
|
|
|
81
83
|
): void {
|
|
82
84
|
const callback = this.async();
|
|
83
85
|
const file = stripQuery(this.resourcePath);
|
|
84
|
-
// The shared predicate itself, not a copy of part of it. A rule
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
// delivery fails (samchon/ttsc#1305).
|
|
86
|
+
// The shared predicate itself, not a copy of part of it. A rule wider than
|
|
87
|
+
// the four exact TypeScript source rules is natural for a mixed project, but
|
|
88
|
+
// it used to route JavaScript and virtual ids into the whole-project
|
|
89
|
+
// transform that every other adapter excludes. The program has no entry for
|
|
90
|
+
// them, so delivery fails (samchon/ttsc#1305).
|
|
90
91
|
if (!isTransformTarget(file)) {
|
|
91
92
|
callback(undefined, source);
|
|
92
93
|
return;
|