@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.
Files changed (86) hide show
  1. package/README.md +15 -11
  2. package/lib/api.js +10 -0
  3. package/lib/api.js.map +1 -1
  4. package/lib/api.mjs +3 -2
  5. package/lib/api.mjs.map +1 -1
  6. package/lib/bun-register.d.cts +10 -7
  7. package/lib/bun-register.d.mts +10 -7
  8. package/lib/bun-register.d.ts +10 -7
  9. package/lib/bun-register.js +90 -24
  10. package/lib/bun-register.js.map +1 -1
  11. package/lib/bun-register.mjs +90 -24
  12. package/lib/bun-register.mjs.map +1 -1
  13. package/lib/bun.d.cts +10 -8
  14. package/lib/bun.d.mts +10 -8
  15. package/lib/bun.d.ts +10 -8
  16. package/lib/bun.js +19 -17
  17. package/lib/bun.js.map +1 -1
  18. package/lib/bun.mjs +20 -18
  19. package/lib/bun.mjs.map +1 -1
  20. package/lib/core/index.d.cts +10 -8
  21. package/lib/core/index.d.mts +10 -8
  22. package/lib/core/index.d.ts +10 -8
  23. package/lib/core/index.js +88 -16
  24. package/lib/core/index.js.map +1 -1
  25. package/lib/core/index.mjs +81 -18
  26. package/lib/core/index.mjs.map +1 -1
  27. package/lib/core/projectDiscovery.d.cts +55 -0
  28. package/lib/core/projectDiscovery.d.mts +55 -0
  29. package/lib/core/projectDiscovery.d.ts +55 -0
  30. package/lib/core/projectDiscovery.js +187 -0
  31. package/lib/core/projectDiscovery.js.map +1 -0
  32. package/lib/core/projectDiscovery.mjs +182 -0
  33. package/lib/core/projectDiscovery.mjs.map +1 -0
  34. package/lib/core/sourceExtensions.d.cts +10 -0
  35. package/lib/core/sourceExtensions.d.mts +10 -0
  36. package/lib/core/sourceExtensions.d.ts +10 -0
  37. package/lib/core/sourceExtensions.js +38 -0
  38. package/lib/core/sourceExtensions.js.map +1 -0
  39. package/lib/core/sourceExtensions.mjs +32 -0
  40. package/lib/core/sourceExtensions.mjs.map +1 -0
  41. package/lib/core/transform.d.cts +96 -16
  42. package/lib/core/transform.d.mts +96 -16
  43. package/lib/core/transform.d.ts +96 -16
  44. package/lib/core/transform.js +1295 -309
  45. package/lib/core/transform.js.map +1 -1
  46. package/lib/core/transform.mjs +1290 -310
  47. package/lib/core/transform.mjs.map +1 -1
  48. package/lib/core/tsconfigPaths.d.cts +55 -3
  49. package/lib/core/tsconfigPaths.d.mts +55 -3
  50. package/lib/core/tsconfigPaths.d.ts +55 -3
  51. package/lib/core/tsconfigPaths.js +260 -46
  52. package/lib/core/tsconfigPaths.js.map +1 -1
  53. package/lib/core/tsconfigPaths.mjs +255 -47
  54. package/lib/core/tsconfigPaths.mjs.map +1 -1
  55. package/lib/core/viteServe.d.cts +18 -21
  56. package/lib/core/viteServe.d.mts +18 -21
  57. package/lib/core/viteServe.d.ts +18 -21
  58. package/lib/core/viteServe.js +88 -47
  59. package/lib/core/viteServe.js.map +1 -1
  60. package/lib/core/viteServe.mjs +89 -49
  61. package/lib/core/viteServe.mjs.map +1 -1
  62. package/lib/next.d.cts +7 -0
  63. package/lib/next.d.mts +7 -0
  64. package/lib/next.d.ts +7 -0
  65. package/lib/next.js +186 -54
  66. package/lib/next.js.map +1 -1
  67. package/lib/next.mjs +186 -55
  68. package/lib/next.mjs.map +1 -1
  69. package/lib/turbopack.d.cts +6 -4
  70. package/lib/turbopack.d.mts +6 -4
  71. package/lib/turbopack.d.ts +6 -4
  72. package/lib/turbopack.js +11 -10
  73. package/lib/turbopack.js.map +1 -1
  74. package/lib/turbopack.mjs +11 -10
  75. package/lib/turbopack.mjs.map +1 -1
  76. package/package.json +7 -4
  77. package/src/bun-register.ts +112 -25
  78. package/src/bun.ts +60 -50
  79. package/src/core/index.ts +114 -19
  80. package/src/core/projectDiscovery.ts +256 -0
  81. package/src/core/sourceExtensions.ts +47 -0
  82. package/src/core/transform.ts +1671 -361
  83. package/src/core/tsconfigPaths.ts +406 -46
  84. package/src/core/viteServe.ts +125 -74
  85. package/src/next.ts +230 -54
  86. package/src/turbopack.ts +11 -10
package/lib/next.mjs CHANGED
@@ -1,3 +1,7 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { TYPESCRIPT_TRANSFORM_EXTENSIONS, TYPESCRIPT_TURBOPACK_RULE_GLOBS } from './core/sourceExtensions.mjs';
1
5
  import webpack from './webpack.mjs';
2
6
 
3
7
  /** The standalone loader entry Turbopack accepts through `turbopack.rules`. */
@@ -5,11 +9,11 @@ const TURBOPACK_LOADER = "@ttsc/unplugin/turbopack";
5
9
  /**
6
10
  * The globs the loader is wired for.
7
11
  *
8
- * The same two the manual wiring in the README uses. A wider glob would be
9
- * harmless, since `isTransformTarget` declines everything else that reaches the
10
- * loader, but it would also route files through a worker for nothing.
12
+ * The same exact set the manual wiring in the README uses. A wider glob would
13
+ * be harmless, since `isTransformTarget` declines everything else that reaches
14
+ * the loader, but it would also route files through a worker for nothing.
11
15
  */
12
- const TURBOPACK_RULE_GLOBS = ["*.ts", "*.tsx"];
16
+ const TURBOPACK_RULE_GLOBS = TYPESCRIPT_TURBOPACK_RULE_GLOBS;
13
17
  /**
14
18
  * Wrap a Next.js config object so that ttsc runs under whichever bundler
15
19
  * Next.js uses.
@@ -98,35 +102,33 @@ function warnAboutSuppressedWebpackConfig(nextConfig) {
98
102
  */
99
103
  function withTtscTurbopackRules(existing, options) {
100
104
  const rules = { ...(existing?.rules ?? {}) };
105
+ // Package ownership is stable only for this configuration snapshot. A later
106
+ // call may observe an atomic install or a directory-link retarget at the same
107
+ // lexical loader path, so no verdict can escape this invocation.
108
+ const resolvedLoaderResults = new Map();
101
109
  for (const glob of TURBOPACK_RULE_GLOBS) {
102
110
  const rule = rules[glob];
103
- const loaders = selectTurbopackLoaders(rule);
104
- if (loaders.some(referencesTtscLoader)) {
111
+ if (hasUnconditionalTtscLoader(rule, resolvedLoaderResults)) {
105
112
  continue;
106
113
  }
107
114
  // The caller may have written the same file set under a different glob.
108
115
  // Adding ours beside theirs makes every matching module run the loader
109
116
  // twice, and the second pass receives the first pass's output, so the
110
117
  // guard has to cover the spellings a caller plausibly uses rather than
111
- // only the two this wrapper writes (samchon/ttsc#1314).
112
- if (coveredByAnotherRule(rules, glob)) {
118
+ // only the four this wrapper writes (samchon/ttsc#1314).
119
+ if (coveredByAnotherRule(rules, glob, resolvedLoaderResults)) {
113
120
  continue;
114
121
  }
115
122
  const entry = { loader: TURBOPACK_LOADER, options: options ?? {} };
116
- // Appended, not prepended. Turbopack runs a rule's loaders right to left,
117
- // so the last entry is the one that sees the original source. ttsc
118
- // transforms TypeScript into TypeScript, so it has to be that one, which
119
- // is the same position `enforce: "pre"` gives it on the webpack half.
123
+ // Loader shorthand runs right to left, so ttsc is appended there to see
124
+ // the original source. Rule collections run matching items in order, so
125
+ // ttsc becomes an explicit first rule there for the same reason. That is
126
+ // the same position `enforce: "pre"` gives it on the webpack half.
120
127
  //
121
128
  // Measured rather than inferred from webpack's `loader-runner`: two
122
129
  // loaders on one rule, each marking the source, came back marked in the
123
130
  // order that only the last-runs-first chain produces (samchon/ttsc#1319).
124
- rules[glob] =
125
- rule === undefined || loaders.length === 0
126
- ? { loaders: [entry] }
127
- : Array.isArray(rule)
128
- ? { loaders: [...loaders, entry] }
129
- : { ...rule, loaders: [...loaders, entry] };
131
+ rules[glob] = addUnconditionalTtscLoader(rule, entry);
130
132
  }
131
133
  return { ...(existing ?? {}), rules };
132
134
  }
@@ -143,13 +145,13 @@ function withTtscTurbopackRules(existing, options) {
143
145
  * untransformed, which is samchon/ttsc#1310 again and the quieter of the two
144
146
  * failures. {@link matchesExtension} owns the rule and names what it declines.
145
147
  */
146
- function coveredByAnotherRule(rules, glob) {
148
+ function coveredByAnotherRule(rules, glob, resolvedLoaderResults) {
147
149
  const extension = glob.slice(glob.lastIndexOf(".") + 1);
148
150
  return Object.entries(rules).some(([candidate, rule]) => {
149
151
  if (candidate === glob) {
150
152
  return false;
151
153
  }
152
- if (!selectTurbopackLoaders(rule).some(referencesTtscLoader)) {
154
+ if (!hasUnconditionalTtscLoader(rule, resolvedLoaderResults)) {
153
155
  return false;
154
156
  }
155
157
  return matchesExtension(candidate, extension);
@@ -177,7 +179,7 @@ function coveredByAnotherRule(rules, glob) {
177
179
  * spellings, and that document explains why it is a set rather than a rule.
178
180
  */
179
181
  function matchesExtension(glob, extension) {
180
- return PROJECT_WIDE_GLOBS.get(glob.trim())?.includes(extension) === true;
182
+ return PROJECT_WIDE_GLOBS.get(glob)?.includes(extension) === true;
181
183
  }
182
184
  /**
183
185
  * The exact glob spellings a real Turbopack build has shown to name every file
@@ -201,53 +203,182 @@ function matchesExtension(glob, extension) {
201
203
  * if any — is a second registration rather than a module that no loader ever
202
204
  * sees.
203
205
  *
204
- * `experimental/test-unplugin` drives every entry through `next build
205
- * --turbopack` and asserts a nested `.ts`, a root-level `.ts` and a nested
206
- * `.tsx` all came out transformed, and
207
- * `test_next_adapter_does_not_double_register_across_globs` asserts these keys
208
- * and that list are the same set, so an entry cannot be added here without a
209
- * build proving it.
206
+ * `experimental/test-unplugin` reads this exported table from the installed
207
+ * package, drives every entry through one `next build --turbopack`, and asserts
208
+ * root, nested, and deep `.ts`, `.tsx`, `.mts`, and `.cts` sources match
209
+ * exactly the extension family recorded here. An entry therefore cannot be
210
+ * recognised without that same build measuring it.
210
211
  */
211
- const PROJECT_WIDE_GLOBS = new Map([
212
- ["*.ts", ["ts"]],
213
- ["**/*.ts", ["ts"]],
214
- ["{**/,}*.ts", ["ts"]],
215
- ["*.tsx", ["tsx"]],
216
- ["**/*.tsx", ["tsx"]],
217
- ["*.{ts,tsx}", ["ts", "tsx"]],
218
- ["{*.ts,*.tsx}", ["ts", "tsx"]],
219
- ["**/*.{ts,tsx}", ["ts", "tsx"]],
220
- ["**/{*.ts,*.tsx}", ["ts", "tsx"]],
221
- ["**/**/*.{ts,tsx}", ["ts", "tsx"]],
212
+ const TYPESCRIPT_EXTENSION_NAMES = TYPESCRIPT_TRANSFORM_EXTENSIONS.map((extension) => extension.slice(1));
213
+ const TYPESCRIPT_EXTENSION_GROUPS = extensionCombinations(TYPESCRIPT_EXTENSION_NAMES);
214
+ /**
215
+ * Measured project-wide Turbopack globs and the source extensions each covers.
216
+ *
217
+ * Exported so the packed-package E2E can measure the exact production allowlist
218
+ * instead of maintaining a second list that can drift from it.
219
+ */
220
+ const TURBOPACK_PROJECT_WIDE_GLOB_COVERAGE = Object.freeze([
221
+ ...TYPESCRIPT_EXTENSION_NAMES.flatMap((extension) => {
222
+ const extensions = Object.freeze([extension]);
223
+ return [
224
+ Object.freeze([`*.${extension}`, extensions]),
225
+ Object.freeze([`**/*.${extension}`, extensions]),
226
+ Object.freeze([`{**/,}*.${extension}`, extensions]),
227
+ ];
228
+ }),
229
+ ...TYPESCRIPT_EXTENSION_GROUPS.flatMap(projectWideBraceGlobEntries),
222
230
  ]);
231
+ const PROJECT_WIDE_GLOBS = new Map(TURBOPACK_PROJECT_WIDE_GLOB_COVERAGE);
232
+ /** Every source-extension subset of size two or more, in shared-table order. */
233
+ function extensionCombinations(extensions) {
234
+ const output = [];
235
+ const visit = (start, selected) => {
236
+ for (let index = start; index < extensions.length; index += 1) {
237
+ const next = [...selected, extensions[index]];
238
+ if (next.length >= 2)
239
+ output.push(Object.freeze(next));
240
+ visit(index + 1, next);
241
+ }
242
+ };
243
+ visit(0, []);
244
+ return output;
245
+ }
246
+ /** Measured project-wide brace spellings for one extension family. */
247
+ function projectWideBraceGlobEntries(extensions) {
248
+ const suffixes = extensions.join(",");
249
+ const alternatives = extensions
250
+ .map((extension) => `*.${extension}`)
251
+ .join(",");
252
+ return [
253
+ Object.freeze([`*.{${suffixes}}`, extensions]),
254
+ Object.freeze([`{${alternatives}}`, extensions]),
255
+ Object.freeze([`**/*.{${suffixes}}`, extensions]),
256
+ Object.freeze([`**/{${alternatives}}`, extensions]),
257
+ Object.freeze([`**/**/*.{${suffixes}}`, extensions]),
258
+ ];
259
+ }
223
260
  /**
224
- * Read the loader list out of one Turbopack rule.
261
+ * Add one unconditional loader without flattening Next's rule collection.
225
262
  *
226
- * Turbopack accepts a bare array of loaders as well as the object form, and a
227
- * loader is either a module name or a `{ loader, options }` pair, so this
228
- * normalises only enough to answer "what is already here".
263
+ * An array is either loader shorthand or a collection whose entries may be
264
+ * complete conditional rule objects, so it must remain an array. A collection
265
+ * executes every matching rule in order; its unconditional ttsc rule therefore
266
+ * comes first so it sees the original source before any caller rule. A
267
+ * conditioned object becomes that same two-item collection because putting ttsc
268
+ * inside the condition would leave the rest of the glob uncovered. An
269
+ * unconditioned object can keep its own shape while gaining the loader,
270
+ * including when it had no loaders.
229
271
  */
230
- function selectTurbopackLoaders(rule) {
272
+ function addUnconditionalTtscLoader(rule, entry) {
231
273
  if (Array.isArray(rule)) {
232
- return rule;
274
+ return rule.every(isTurbopackLoaderItem)
275
+ ? [...rule, entry]
276
+ : [{ loaders: [entry] }, ...rule];
233
277
  }
234
278
  if (typeof rule === "object" && rule !== null) {
235
- const loaders = rule.loaders;
236
- if (Array.isArray(loaders)) {
237
- return loaders;
279
+ if (rule.condition !== undefined) {
280
+ return [{ loaders: [entry] }, rule];
238
281
  }
282
+ return {
283
+ ...rule,
284
+ loaders: [...selectTurbopackConfigLoaders(rule), entry],
285
+ };
286
+ }
287
+ return { loaders: [entry] };
288
+ }
289
+ /** Read the direct loader list from one Turbopack rule configuration item. */
290
+ function selectTurbopackConfigLoaders(rule) {
291
+ if (typeof rule !== "object" || rule === null || Array.isArray(rule)) {
292
+ return [];
293
+ }
294
+ const loaders = rule.loaders;
295
+ return Array.isArray(loaders) ? loaders : [];
296
+ }
297
+ /** Whether a rule collection provides this loader without a condition. */
298
+ function hasUnconditionalTtscLoader(rule, resolvedLoaderResults) {
299
+ if (Array.isArray(rule)) {
300
+ return rule.some((item) => {
301
+ if (isTurbopackLoaderItem(item)) {
302
+ return referencesTtscLoader(item, resolvedLoaderResults);
303
+ }
304
+ return (typeof item === "object" &&
305
+ item !== null &&
306
+ item.condition === undefined &&
307
+ selectTurbopackConfigLoaders(item).some((loader) => referencesTtscLoader(loader, resolvedLoaderResults)));
308
+ });
239
309
  }
240
- return [];
310
+ return (typeof rule === "object" &&
311
+ rule !== null &&
312
+ rule.condition === undefined &&
313
+ selectTurbopackConfigLoaders(rule).some((loader) => referencesTtscLoader(loader, resolvedLoaderResults)));
314
+ }
315
+ /** Whether one collection item is a direct Turbopack loader. */
316
+ function isTurbopackLoaderItem(item) {
317
+ return (typeof item === "string" ||
318
+ (typeof item === "object" &&
319
+ item !== null &&
320
+ typeof item.loader === "string"));
241
321
  }
242
322
  /** Whether one Turbopack loader entry is already this package's loader. */
243
- function referencesTtscLoader(loader) {
244
- if (typeof loader === "string") {
245
- return loader === TURBOPACK_LOADER;
323
+ function referencesTtscLoader(loader, resolvedLoaderResults) {
324
+ const identity = typeof loader === "string"
325
+ ? loader
326
+ : typeof loader === "object" && loader !== null
327
+ ? loader.loader
328
+ : undefined;
329
+ return (typeof identity === "string" &&
330
+ (identity === TURBOPACK_LOADER ||
331
+ isResolvedTtscLoader(identity, resolvedLoaderResults)));
332
+ }
333
+ /** Whether an absolute path is the Turbopack entry of an @ttsc/unplugin copy. */
334
+ function isResolvedTtscLoader(identity, resolvedLoaderResults) {
335
+ const cached = resolvedLoaderResults.get(identity);
336
+ if (cached !== undefined) {
337
+ return cached;
338
+ }
339
+ let file;
340
+ try {
341
+ file = /^file:/i.test(identity) ? fileURLToPath(identity) : identity;
342
+ }
343
+ catch {
344
+ resolvedLoaderResults.set(identity, false);
345
+ return false;
346
+ }
347
+ if (!path.isAbsolute(file)) {
348
+ resolvedLoaderResults.set(identity, false);
349
+ return false;
350
+ }
351
+ let resolvedFile;
352
+ try {
353
+ resolvedFile = fs.realpathSync.native(file);
354
+ if (!fs.statSync(resolvedFile).isFile()) {
355
+ resolvedLoaderResults.set(identity, false);
356
+ return false;
357
+ }
358
+ }
359
+ catch {
360
+ resolvedLoaderResults.set(identity, false);
361
+ return false;
362
+ }
363
+ const packageRoot = path.dirname(path.dirname(resolvedFile));
364
+ const relative = path
365
+ .relative(packageRoot, resolvedFile)
366
+ .replaceAll(path.sep, "/");
367
+ if (relative !== "lib/turbopack.js" && relative !== "lib/turbopack.mjs") {
368
+ resolvedLoaderResults.set(identity, false);
369
+ return false;
370
+ }
371
+ let matches = false;
372
+ try {
373
+ const manifest = JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "utf8"));
374
+ matches = manifest.name === "@ttsc/unplugin";
375
+ }
376
+ catch {
377
+ // An unreadable or malformed owner cannot prove this package's identity.
246
378
  }
247
- return (typeof loader === "object" &&
248
- loader !== null &&
249
- loader.loader === TURBOPACK_LOADER);
379
+ resolvedLoaderResults.set(identity, matches);
380
+ return matches;
250
381
  }
251
382
 
252
- export { next as default };
383
+ export { TURBOPACK_PROJECT_WIDE_GLOB_COVERAGE, next as default };
253
384
  //# sourceMappingURL=next.mjs.map
package/lib/next.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"next.mjs","sources":["../src/next.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;AACA,MAAM,gBAAgB,GAAG,0BAA0B;AACnD;;;;;;AAMG;AACH,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AAqC9C;;;;;;;;;;;;;;;;;;;AAmBG;AACW,SAAU,IAAI,CAC1B,UAAA,GAA6B,EAAE,EAC/B,OAA6B,EAAA;IAE7B,gCAAgC,CAAC,UAAU,CAAC;IAC5C,OAAO;AACL,QAAA,GAAG,UAAU;QACb,SAAS,EAAE,sBAAsB,CAAC,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC;QAChE,OAAO,CAAC,MAAyB,EAAE,cAAuB,EAAA;YACxD,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,OAAO,GAAG,EAAE;;YAEpE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,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AK,mBAAmB,EAAE;AACvE,QAAA,qBAAqB,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC;AAC1C,QAAA,OAAO,KAAK;IACd;IACA,IAAI,OAAO,GAAG,KAAK;AACnB,IAAA,IAAI;QACF,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CACzB,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAC1C;AACvB,QAAA,OAAO,GAAG,QAAQ,CAAC,IAAI,KAAK,gBAAgB;IAC9C;AAAE,IAAA,MAAM;;IAER;AACA,IAAA,qBAAqB,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC;AAC5C,IAAA,OAAO,OAAO;AAChB;;;;"}
@@ -44,6 +44,8 @@ export interface TtscTurbopackLoaderContext {
44
44
  * rules: {
45
45
  * "*.ts": { loaders: ["@ttsc/unplugin/turbopack"] },
46
46
  * "*.tsx": { loaders: ["@ttsc/unplugin/turbopack"] },
47
+ * "*.mts": { loaders: ["@ttsc/unplugin/turbopack"] },
48
+ * "*.cts": { loaders: ["@ttsc/unplugin/turbopack"] },
47
49
  * },
48
50
  * },
49
51
  * };
@@ -51,9 +53,9 @@ export interface TtscTurbopackLoaderContext {
51
53
  *
52
54
  * Pass {@link TtscUnpluginOptions} through the rule's `options` object. The
53
55
  * loader returns the source unchanged for anything {@link isTransformTarget}
54
- * excludes declaration files, `node_modules` paths, non-TypeScript sources,
55
- * and virtual ids and for transforms that produce no change. It applies that
56
- * shared predicate itself rather than a local copy, because a broad rule glob
57
- * routes everything matching the extension through the loader.
56
+ * excludes: declaration files, `node_modules` paths, non-TypeScript sources,
57
+ * and virtual ids. It also preserves transforms that produce no change and
58
+ * applies the shared predicate itself rather than a local copy, because a broad
59
+ * rule glob routes everything matching the extension through the loader.
58
60
  */
59
61
  export default function turbopack(this: TtscTurbopackLoaderContext, source: string): void;
@@ -44,6 +44,8 @@ export interface TtscTurbopackLoaderContext {
44
44
  * rules: {
45
45
  * "*.ts": { loaders: ["@ttsc/unplugin/turbopack"] },
46
46
  * "*.tsx": { loaders: ["@ttsc/unplugin/turbopack"] },
47
+ * "*.mts": { loaders: ["@ttsc/unplugin/turbopack"] },
48
+ * "*.cts": { loaders: ["@ttsc/unplugin/turbopack"] },
47
49
  * },
48
50
  * },
49
51
  * };
@@ -51,9 +53,9 @@ export interface TtscTurbopackLoaderContext {
51
53
  *
52
54
  * Pass {@link TtscUnpluginOptions} through the rule's `options` object. The
53
55
  * loader returns the source unchanged for anything {@link isTransformTarget}
54
- * excludes declaration files, `node_modules` paths, non-TypeScript sources,
55
- * and virtual ids and for transforms that produce no change. It applies that
56
- * shared predicate itself rather than a local copy, because a broad rule glob
57
- * routes everything matching the extension through the loader.
56
+ * excludes: declaration files, `node_modules` paths, non-TypeScript sources,
57
+ * and virtual ids. It also preserves transforms that produce no change and
58
+ * applies the shared predicate itself rather than a local copy, because a broad
59
+ * rule glob routes everything matching the extension through the loader.
58
60
  */
59
61
  export default function turbopack(this: TtscTurbopackLoaderContext, source: string): void;
@@ -44,6 +44,8 @@ export interface TtscTurbopackLoaderContext {
44
44
  * rules: {
45
45
  * "*.ts": { loaders: ["@ttsc/unplugin/turbopack"] },
46
46
  * "*.tsx": { loaders: ["@ttsc/unplugin/turbopack"] },
47
+ * "*.mts": { loaders: ["@ttsc/unplugin/turbopack"] },
48
+ * "*.cts": { loaders: ["@ttsc/unplugin/turbopack"] },
47
49
  * },
48
50
  * },
49
51
  * };
@@ -51,9 +53,9 @@ export interface TtscTurbopackLoaderContext {
51
53
  *
52
54
  * Pass {@link TtscUnpluginOptions} through the rule's `options` object. The
53
55
  * loader returns the source unchanged for anything {@link isTransformTarget}
54
- * excludes declaration files, `node_modules` paths, non-TypeScript sources,
55
- * and virtual ids and for transforms that produce no change. It applies that
56
- * shared predicate itself rather than a local copy, because a broad rule glob
57
- * routes everything matching the extension through the loader.
56
+ * excludes: declaration files, `node_modules` paths, non-TypeScript sources,
57
+ * and virtual ids. It also preserves transforms that produce no change and
58
+ * applies the shared predicate itself rather than a local copy, because a broad
59
+ * rule glob routes everything matching the extension through the loader.
58
60
  */
59
61
  export default function turbopack(this: TtscTurbopackLoaderContext, source: string): void;
package/lib/turbopack.js CHANGED
@@ -29,6 +29,8 @@ const transformCache = transform.createTtscTransformCache();
29
29
  * rules: {
30
30
  * "*.ts": { loaders: ["@ttsc/unplugin/turbopack"] },
31
31
  * "*.tsx": { loaders: ["@ttsc/unplugin/turbopack"] },
32
+ * "*.mts": { loaders: ["@ttsc/unplugin/turbopack"] },
33
+ * "*.cts": { loaders: ["@ttsc/unplugin/turbopack"] },
32
34
  * },
33
35
  * },
34
36
  * };
@@ -36,20 +38,19 @@ const transformCache = transform.createTtscTransformCache();
36
38
  *
37
39
  * Pass {@link TtscUnpluginOptions} through the rule's `options` object. The
38
40
  * loader returns the source unchanged for anything {@link isTransformTarget}
39
- * excludes declaration files, `node_modules` paths, non-TypeScript sources,
40
- * and virtual ids and for transforms that produce no change. It applies that
41
- * shared predicate itself rather than a local copy, because a broad rule glob
42
- * routes everything matching the extension through the loader.
41
+ * excludes: declaration files, `node_modules` paths, non-TypeScript sources,
42
+ * and virtual ids. It also preserves transforms that produce no change and
43
+ * applies the shared predicate itself rather than a local copy, because a broad
44
+ * rule glob routes everything matching the extension through the loader.
43
45
  */
44
46
  function turbopack(source) {
45
47
  const callback = this.async();
46
48
  const file = transform.stripQuery(this.resourcePath);
47
- // The shared predicate itself, not a copy of part of it. A rule glob wider
48
- // than `*.ts`/`*.tsx` the natural thing to write for a project with mixed
49
- // sources, and the reason a loader needs a filter at all — used to route
50
- // JavaScript and virtual ids into the whole-project transform that every
51
- // other adapter excludes, where the program has no entry for them and the
52
- // delivery fails (samchon/ttsc#1305).
49
+ // The shared predicate itself, not a copy of part of it. A rule wider than
50
+ // the four exact TypeScript source rules is natural for a mixed project, but
51
+ // it used to route JavaScript and virtual ids into the whole-project
52
+ // transform that every other adapter excludes. The program has no entry for
53
+ // them, so delivery fails (samchon/ttsc#1305).
53
54
  if (!index.isTransformTarget(file)) {
54
55
  callback(undefined, source);
55
56
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"turbopack.js","sources":["../src/turbopack.ts"],"sourcesContent":[null],"names":["createTtscTransformCache","stripQuery","isTransformTarget","transformTtsc","resolveOptions"],"mappings":";;;;;;;;AAyCA;;;;;;AAMG;AACH,MAAM,cAAc,GAAGA,kCAAwB,EAAE;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;AACW,SAAU,SAAS,CAE/B,MAAc,EAAA;AAEd,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE;IAC7B,MAAM,IAAI,GAAGC,oBAAU,CAAC,IAAI,CAAC,YAAY,CAAC;;;;;;;AAO1C,IAAA,IAAI,CAACC,uBAAiB,CAAC,IAAI,CAAC,EAAE;AAC5B,QAAA,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B;IACF;;;;;;;;;IASA,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC;IACpD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC;AAC5C,IAAA,MAAM,KAAK,GAAuB;AAChC,QAAA,IAAI,aAAa,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;QACvE,IAAI,SAAS,KAAK;AAChB,cAAE;AACF,cAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;KAC9C;AACD,IAAAC,uBAAa,CACX,IAAI,EACJ,MAAM,EACNC,sBAAc,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC,EACzC,SAAS,EACT,cAAc,EACd,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,GAAG,SAAS,GAAG,KAAK,CACpD,CAAC,IAAI,CACJ,CAAC,MAAM,KAAK,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,IAAI,MAAM,CAAC,EACvD,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAC3B;AACH;;;;"}
1
+ {"version":3,"file":"turbopack.js","sources":["../src/turbopack.ts"],"sourcesContent":[null],"names":["createTtscTransformCache","stripQuery","isTransformTarget","transformTtsc","resolveOptions"],"mappings":";;;;;;;;AAyCA;;;;;;AAMG;AACH,MAAM,cAAc,GAAGA,kCAAwB,EAAE;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACW,SAAU,SAAS,CAE/B,MAAc,EAAA;AAEd,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE;IAC7B,MAAM,IAAI,GAAGC,oBAAU,CAAC,IAAI,CAAC,YAAY,CAAC;;;;;;AAM1C,IAAA,IAAI,CAACC,uBAAiB,CAAC,IAAI,CAAC,EAAE;AAC5B,QAAA,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B;IACF;;;;;;;;;IASA,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC;IACpD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC;AAC5C,IAAA,MAAM,KAAK,GAAuB;AAChC,QAAA,IAAI,aAAa,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;QACvE,IAAI,SAAS,KAAK;AAChB,cAAE;AACF,cAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;KAC9C;AACD,IAAAC,uBAAa,CACX,IAAI,EACJ,MAAM,EACNC,sBAAc,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC,EACzC,SAAS,EACT,cAAc,EACd,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,GAAG,SAAS,GAAG,KAAK,CACpD,CAAC,IAAI,CACJ,CAAC,MAAM,KAAK,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,IAAI,MAAM,CAAC,EACvD,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAC3B;AACH;;;;"}
package/lib/turbopack.mjs CHANGED
@@ -25,6 +25,8 @@ const transformCache = createTtscTransformCache();
25
25
  * rules: {
26
26
  * "*.ts": { loaders: ["@ttsc/unplugin/turbopack"] },
27
27
  * "*.tsx": { loaders: ["@ttsc/unplugin/turbopack"] },
28
+ * "*.mts": { loaders: ["@ttsc/unplugin/turbopack"] },
29
+ * "*.cts": { loaders: ["@ttsc/unplugin/turbopack"] },
28
30
  * },
29
31
  * },
30
32
  * };
@@ -32,20 +34,19 @@ const transformCache = createTtscTransformCache();
32
34
  *
33
35
  * Pass {@link TtscUnpluginOptions} through the rule's `options` object. The
34
36
  * loader returns the source unchanged for anything {@link isTransformTarget}
35
- * excludes declaration files, `node_modules` paths, non-TypeScript sources,
36
- * and virtual ids and for transforms that produce no change. It applies that
37
- * shared predicate itself rather than a local copy, because a broad rule glob
38
- * routes everything matching the extension through the loader.
37
+ * excludes: declaration files, `node_modules` paths, non-TypeScript sources,
38
+ * and virtual ids. It also preserves transforms that produce no change and
39
+ * applies the shared predicate itself rather than a local copy, because a broad
40
+ * rule glob routes everything matching the extension through the loader.
39
41
  */
40
42
  function turbopack(source) {
41
43
  const callback = this.async();
42
44
  const file = stripQuery(this.resourcePath);
43
- // The shared predicate itself, not a copy of part of it. A rule glob wider
44
- // than `*.ts`/`*.tsx` the natural thing to write for a project with mixed
45
- // sources, and the reason a loader needs a filter at all — used to route
46
- // JavaScript and virtual ids into the whole-project transform that every
47
- // other adapter excludes, where the program has no entry for them and the
48
- // delivery fails (samchon/ttsc#1305).
45
+ // The shared predicate itself, not a copy of part of it. A rule wider than
46
+ // the four exact TypeScript source rules is natural for a mixed project, but
47
+ // it used to route JavaScript and virtual ids into the whole-project
48
+ // transform that every other adapter excludes. The program has no entry for
49
+ // them, so delivery fails (samchon/ttsc#1305).
49
50
  if (!isTransformTarget(file)) {
50
51
  callback(undefined, source);
51
52
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"turbopack.mjs","sources":["../src/turbopack.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAyCA;;;;;;AAMG;AACH,MAAM,cAAc,GAAG,wBAAwB,EAAE;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;AACW,SAAU,SAAS,CAE/B,MAAc,EAAA;AAEd,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE;IAC7B,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC;;;;;;;AAO1C,IAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE;AAC5B,QAAA,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B;IACF;;;;;;;;;IASA,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC;IACpD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC;AAC5C,IAAA,MAAM,KAAK,GAAuB;AAChC,QAAA,IAAI,aAAa,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;QACvE,IAAI,SAAS,KAAK;AAChB,cAAE;AACF,cAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;KAC9C;AACD,IAAA,aAAa,CACX,IAAI,EACJ,MAAM,EACN,cAAc,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC,EACzC,SAAS,EACT,cAAc,EACd,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,GAAG,SAAS,GAAG,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KAAK,CACpD,CAAC,IAAI,CACJ,CAAC,MAAM,KAAK,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,IAAI,MAAM,CAAC,EACvD,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,CAC3B;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttsc/unplugin",
3
- "version": "0.28.5",
3
+ "version": "0.29.0",
4
4
  "description": "Bundler adapters for ttsc plugins.",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",
@@ -199,7 +199,7 @@
199
199
  "unplugin": "^2.3.11"
200
200
  },
201
201
  "peerDependencies": {
202
- "ttsc": "^0.28.5"
202
+ "ttsc": "^0.29.0"
203
203
  },
204
204
  "devDependencies": {
205
205
  "@rollup/plugin-commonjs": "^29.0.2",
@@ -213,7 +213,7 @@
213
213
  "tslib": "^2.8.1",
214
214
  "typescript": "^7.0.2",
215
215
  "vite": "^7.3.5",
216
- "ttsc": "0.28.5"
216
+ "ttsc": "0.29.0"
217
217
  },
218
218
  "repository": {
219
219
  "type": "git",
@@ -225,7 +225,10 @@
225
225
  "url": "https://github.com/samchon/ttsc/issues"
226
226
  },
227
227
  "homepage": "https://ttsc.dev",
228
- "sideEffects": false,
228
+ "sideEffects": [
229
+ "./lib/bun-register.js",
230
+ "./lib/bun-register.mjs"
231
+ ],
229
232
  "scripts": {
230
233
  "build": "rimraf lib && tsc --emitDeclarationOnly && node scripts/emit-dual-declarations.mjs && rollup -c"
231
234
  }