@useavalon/avalon 0.1.6 → 0.1.7
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 +1 -1
- package/src/build/prop-extractors/index.ts +11 -11
- package/src/build/prop-extractors/lit.ts +1 -1
- package/src/build/prop-extractors/qwik.ts +2 -2
- package/src/build/prop-extractors/solid.ts +1 -1
- package/src/build/prop-extractors/svelte.ts +1 -1
- package/src/schemas/routing.ts +2 -2
- package/src/vite-plugin/nitro-integration.ts +1 -1
- package/src/vite-plugin/plugin.ts +20 -16
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export { type PropExtractionResult, FALLBACK_PROPS, extractVueProps } from "./vue";
|
|
2
|
-
export { extractSvelteProps } from "./svelte";
|
|
3
|
-
export { extractLitProps } from "./lit";
|
|
4
|
-
export { extractSolidProps } from "./solid";
|
|
5
|
-
export { extractQwikProps } from "./qwik";
|
|
1
|
+
export { type PropExtractionResult, FALLBACK_PROPS, extractVueProps } from "./vue.ts";
|
|
2
|
+
export { extractSvelteProps } from "./svelte.ts";
|
|
3
|
+
export { extractLitProps } from "./lit.ts";
|
|
4
|
+
export { extractSolidProps } from "./solid.ts";
|
|
5
|
+
export { extractQwikProps } from "./qwik.ts";
|
|
6
6
|
|
|
7
|
-
import type { PropExtractionResult } from "./vue";
|
|
8
|
-
import { extractVueProps } from "./vue";
|
|
9
|
-
import { extractSvelteProps } from "./svelte";
|
|
10
|
-
import { extractLitProps } from "./lit";
|
|
11
|
-
import { extractSolidProps } from "./solid";
|
|
12
|
-
import { extractQwikProps } from "./qwik";
|
|
7
|
+
import type { PropExtractionResult } from "./vue.ts";
|
|
8
|
+
import { extractVueProps } from "./vue.ts";
|
|
9
|
+
import { extractSvelteProps } from "./svelte.ts";
|
|
10
|
+
import { extractLitProps } from "./lit.ts";
|
|
11
|
+
import { extractSolidProps } from "./solid.ts";
|
|
12
|
+
import { extractQwikProps } from "./qwik.ts";
|
|
13
13
|
|
|
14
14
|
/** Maps framework name to its prop extractor function */
|
|
15
15
|
export const EXTRACTOR_MAP: Record<string, (source: string) => PropExtractionResult> = {
|
package/src/schemas/routing.ts
CHANGED
|
@@ -362,7 +362,7 @@ export type {
|
|
|
362
362
|
ValidRoutePattern,
|
|
363
363
|
ValidRouteExtension,
|
|
364
364
|
PageComponentProps,
|
|
365
|
-
} from '../types/routing';
|
|
365
|
+
} from '../types/routing.ts';
|
|
366
366
|
|
|
367
367
|
export {
|
|
368
368
|
isValidRouteParams,
|
|
@@ -373,4 +373,4 @@ export {
|
|
|
373
373
|
createTypedMetadataGenerator,
|
|
374
374
|
createTypedPageLoader,
|
|
375
375
|
createTypedApiHandler,
|
|
376
|
-
} from '../types/routing';
|
|
376
|
+
} from '../types/routing.ts';
|
|
@@ -43,7 +43,7 @@ function resolveAvalonPackagePath(relativePath: string): string {
|
|
|
43
43
|
* Resolves the absolute path to a file inside an @useavalon/<name> integration package.
|
|
44
44
|
*/
|
|
45
45
|
function resolveIntegrationPackagePath(name: string, relativePath: string): string {
|
|
46
|
-
const require = createRequire(
|
|
46
|
+
const require = createRequire(join(process.cwd(), 'package.json'));
|
|
47
47
|
const modEntry = require.resolve(`@useavalon/${name}`);
|
|
48
48
|
const pkgRoot = dirname(modEntry);
|
|
49
49
|
return join(pkgRoot, relativePath);
|
|
@@ -269,14 +269,12 @@ export async function avalon(config?: AvalonPluginConfig): Promise<PluginOption[
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
// Resolve /@useavalon/*/client virtual imports used by main.js
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
}
|
|
272
|
+
// These are resolved dynamically in the resolveId hook using Vite's resolver
|
|
273
|
+
const integrationClientIds = new Set(
|
|
274
|
+
['preact', 'react', 'vue', 'svelte', 'solid', 'lit', 'qwik'].map(
|
|
275
|
+
name => `/@useavalon/${name}/client`
|
|
276
|
+
)
|
|
277
|
+
);
|
|
280
278
|
|
|
281
279
|
// The main Avalon plugin
|
|
282
280
|
const avalonPlugin: Plugin = {
|
|
@@ -309,27 +307,33 @@ export async function avalon(config?: AvalonPluginConfig): Promise<PluginOption[
|
|
|
309
307
|
checkDirectoriesExist(resolvedConfig, resolvedViteConfig.root);
|
|
310
308
|
},
|
|
311
309
|
|
|
312
|
-
resolveId(id: string) {
|
|
310
|
+
async resolveId(id: string) {
|
|
313
311
|
if (id === "/src/client/main.js" && clientMainResolved) {
|
|
314
312
|
return clientMainResolved;
|
|
315
313
|
}
|
|
316
|
-
|
|
317
|
-
|
|
314
|
+
// /@useavalon/*/client — resolve through Vite's pipeline so it finds
|
|
315
|
+
// workspace-linked or npm-installed integration packages from the
|
|
316
|
+
// consuming project's node_modules, not from avalon's own context.
|
|
317
|
+
if (integrationClientIds.has(id)) {
|
|
318
|
+
const packageId = id.slice(1); // strip leading /
|
|
319
|
+
const resolved = await this.resolve(packageId);
|
|
320
|
+
return resolved?.id ?? null;
|
|
318
321
|
}
|
|
319
322
|
return null;
|
|
320
323
|
},
|
|
321
324
|
|
|
322
325
|
async transform(code: string, id: string) {
|
|
323
|
-
// Vite 8's OXC
|
|
324
|
-
//
|
|
325
|
-
//
|
|
326
|
-
//
|
|
326
|
+
// Vite 8's built-in OXC plugin returns { moduleType: "js" } so the dev
|
|
327
|
+
// server knows the output is JavaScript. Because we exclude @useavalon
|
|
328
|
+
// packages from that plugin (via oxc.exclude), we must strip TypeScript
|
|
329
|
+
// ourselves AND set moduleType so the browser receives valid JS.
|
|
327
330
|
if (id.includes('node_modules/@useavalon/') && /\.tsx?$/.test(id)) {
|
|
328
331
|
const { transform: oxcTransform } = await import('oxc-transform');
|
|
329
332
|
const result = await oxcTransform(id, code, {
|
|
333
|
+
sourcemap: true,
|
|
330
334
|
typescript: { onlyRemoveTypeImports: false },
|
|
331
335
|
});
|
|
332
|
-
return { code: result.code, map: result.map };
|
|
336
|
+
return { code: result.code, map: result.map, moduleType: 'js' };
|
|
333
337
|
}
|
|
334
338
|
},
|
|
335
339
|
|