@useavalon/avalon 0.1.8 → 0.1.9

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.8",
3
+ "version": "0.1.9",
4
4
  "description": "Multi-framework islands architecture for the modern web",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -282,14 +282,20 @@ export async function avalon(config?: AvalonPluginConfig): Promise<PluginOption[
282
282
  enforce: "pre",
283
283
 
284
284
  config() {
285
- // @useavalon packages ship raw .ts source. Mark them as noExternal so
286
- // Vite processes them through the transform pipeline (SSR).
287
- // For client-side, Vite's built-in OXC plugin handles .ts stripping
288
- // and sets moduleType: 'js' automatically.
285
+ // @useavalon packages ship raw .ts source.
286
+ // - noExternal: Vite processes them through the transform pipeline (SSR)
287
+ // - oxc.exclude: Prevent Vite's built-in OXC from processing them.
288
+ // Integration plugins (react, preact, etc.) set jsx: 'automatic' which
289
+ // OXC then applies to ALL files including plain .ts — causing
290
+ // "Invalid jsx option: automatic" errors. Our transform hook below
291
+ // strips TypeScript without applying any JSX config.
289
292
  return {
290
293
  ssr: {
291
294
  noExternal: [/^@useavalon\//],
292
295
  },
296
+ oxc: {
297
+ exclude: [/node_modules\/@useavalon\//],
298
+ },
293
299
  };
294
300
  },
295
301
 
@@ -318,6 +324,21 @@ export async function avalon(config?: AvalonPluginConfig): Promise<PluginOption[
318
324
  return null;
319
325
  },
320
326
 
327
+ async transform(code: string, id: string) {
328
+ // Strip TypeScript from @useavalon packages in node_modules.
329
+ // We exclude these from Vite's OXC (via oxc.exclude) because integration
330
+ // plugins set jsx: 'automatic' which OXC applies to all files, breaking
331
+ // plain .ts files. We handle TS stripping ourselves with no JSX config.
332
+ if (id.includes('node_modules/@useavalon/') && /\.tsx?$/.test(id)) {
333
+ const { transform: oxcTransform } = await import('oxc-transform');
334
+ const result = await oxcTransform(id, code, {
335
+ sourcemap: true,
336
+ typescript: { onlyRemoveTypeImports: false },
337
+ });
338
+ return { code: result.code, map: result.map, moduleType: 'js' };
339
+ }
340
+ },
341
+
321
342
  async buildStart() {
322
343
  await runAutoDiscovery(resolvedConfig, viteConfig?.root, activeIntegrations);
323
344
  runValidation(resolvedConfig, activeIntegrations);