@useavalon/avalon 0.1.4 → 0.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useavalon/avalon",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Multi-framework islands architecture for the modern web",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -284,11 +284,15 @@ export async function avalon(config?: AvalonPluginConfig): Promise<PluginOption[
284
284
  enforce: "pre",
285
285
 
286
286
  config() {
287
- // Vite 8 uses OXC for TS/JSX transform. When the project tsconfig sets
288
- // jsx: "react-jsx", Vite passes jsx options to OXC for ALL .ts files
289
- // including those in node_modules/@useavalon. OXC rejects this for plain
290
- // .ts files that don't contain JSX. Exclude @useavalon packages from OXC.
287
+ // @useavalon packages ship raw .ts source. Mark them as noExternal so
288
+ // Vite processes them through the transform pipeline. Also exclude them
289
+ // from Vite's built-in OXC transform (which applies the project's jsx
290
+ // config and fails on plain .ts files). Our own transform hook below
291
+ // handles TS stripping for these files instead.
291
292
  return {
293
+ ssr: {
294
+ noExternal: [/^@useavalon\//],
295
+ },
292
296
  oxc: {
293
297
  exclude: [/node_modules\/@useavalon\//],
294
298
  },
@@ -315,6 +319,20 @@ export async function avalon(config?: AvalonPluginConfig): Promise<PluginOption[
315
319
  return null;
316
320
  },
317
321
 
322
+ async transform(code: string, id: string) {
323
+ // Vite 8's OXC transform applies the project's jsx config to ALL .ts files,
324
+ // including those in node_modules/@useavalon. OXC rejects jsx options for
325
+ // plain .ts files. Strip TypeScript ourselves for @useavalon packages so
326
+ // Vite's built-in OXC doesn't need to touch them.
327
+ if (id.includes('node_modules/@useavalon/') && /\.tsx?$/.test(id)) {
328
+ const { transform: oxcTransform } = await import('oxc-transform');
329
+ const result = await oxcTransform(id, code, {
330
+ typescript: { onlyRemoveTypeImports: false },
331
+ });
332
+ return { code: result.code, map: result.map };
333
+ }
334
+ },
335
+
318
336
  async buildStart() {
319
337
  await runAutoDiscovery(resolvedConfig, viteConfig?.root, activeIntegrations);
320
338
  runValidation(resolvedConfig, activeIntegrations);