@netrojs/fnetro 0.1.4 → 0.1.6
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/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/server.js +18 -5
- package/package.json +2 -2
- package/server.ts +25 -7
package/LICENSE
CHANGED
package/README.md
CHANGED
package/dist/server.js
CHANGED
|
@@ -488,7 +488,7 @@ function buildShell(opts) {
|
|
|
488
488
|
<body>
|
|
489
489
|
<div id="fnetro-app">${opts.pageHtml}</div>
|
|
490
490
|
<script>window.${STATE_KEY}=${opts.stateJson};window.${PARAMS_KEY}=${opts.paramsJson};</script>
|
|
491
|
-
<script type="module" src="/
|
|
491
|
+
<script type="module" src="/client.ts"></script>
|
|
492
492
|
</body>
|
|
493
493
|
</html>`;
|
|
494
494
|
}
|
|
@@ -630,13 +630,24 @@ function fnetroVitePlugin(opts = {}) {
|
|
|
630
630
|
serverExternal = []
|
|
631
631
|
} = opts;
|
|
632
632
|
let isServerBuild = true;
|
|
633
|
-
const
|
|
633
|
+
const jsxTransform = {
|
|
634
634
|
jsx: "automatic",
|
|
635
635
|
jsxImportSource: "hono/jsx"
|
|
636
636
|
};
|
|
637
637
|
const jsxPlugin = {
|
|
638
638
|
name: "fnetro:jsx",
|
|
639
|
-
config: () => ({
|
|
639
|
+
config: () => ({
|
|
640
|
+
// Vite ≤7 (esbuild transform)
|
|
641
|
+
esbuild: jsxTransform,
|
|
642
|
+
// Vite 8+ (oxc / rolldown transform) — jsx property uses JsxOptions object shape
|
|
643
|
+
oxc: {
|
|
644
|
+
jsx: {
|
|
645
|
+
runtime: "automatic",
|
|
646
|
+
importSource: "hono/jsx"
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
// `as any` because JsxOptions typing varies across Vite 8 patch releases
|
|
650
|
+
})
|
|
640
651
|
};
|
|
641
652
|
const serverPlugin = {
|
|
642
653
|
name: "fnetro:server",
|
|
@@ -657,7 +668,8 @@ function fnetroVitePlugin(opts = {}) {
|
|
|
657
668
|
external: (id) => NODE_BUILTINS.test(id) || id === "@hono/node-server" || serverExternal.includes(id)
|
|
658
669
|
}
|
|
659
670
|
},
|
|
660
|
-
|
|
671
|
+
// Vite ≤7 fallback (oxc is set by jsxPlugin for Vite 8+)
|
|
672
|
+
esbuild: jsxTransform
|
|
661
673
|
};
|
|
662
674
|
},
|
|
663
675
|
async closeBundle() {
|
|
@@ -665,7 +677,8 @@ function fnetroVitePlugin(opts = {}) {
|
|
|
665
677
|
const { build } = await import("vite");
|
|
666
678
|
await build({
|
|
667
679
|
configFile: false,
|
|
668
|
-
|
|
680
|
+
// Vite ≤7 fallback (oxc is set by jsxPlugin for Vite 8+)
|
|
681
|
+
esbuild: jsxTransform,
|
|
669
682
|
build: {
|
|
670
683
|
outDir: clientOutDir,
|
|
671
684
|
lib: {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netrojs/fnetro",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Full-stack Hono framework — SSR, SPA, Vue-like reactivity, route groups, middleware and API routes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"author": "
|
|
7
|
+
"author": "Netro Solutions<info@netrosolutions.com>",
|
|
8
8
|
"homepage": "https://github.com/netrosolutions/fnetro",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
package/server.ts
CHANGED
|
@@ -66,7 +66,7 @@ function buildShell(opts: {
|
|
|
66
66
|
<body>
|
|
67
67
|
<div id="fnetro-app">${opts.pageHtml}</div>
|
|
68
68
|
<script>window.${STATE_KEY}=${opts.stateJson};window.${PARAMS_KEY}=${opts.paramsJson};</script>
|
|
69
|
-
<script type="module" src="/
|
|
69
|
+
<script type="module" src="/client.ts"></script>
|
|
70
70
|
</body>
|
|
71
71
|
</html>`
|
|
72
72
|
}
|
|
@@ -329,15 +329,31 @@ export function fnetroVitePlugin(opts: FNetroPluginOptions = {}): Plugin[] {
|
|
|
329
329
|
|
|
330
330
|
let isServerBuild = true // first pass = server
|
|
331
331
|
|
|
332
|
-
|
|
332
|
+
// JSX transform options.
|
|
333
|
+
// Vite 8 deprecated the `esbuild` transform option in favour of `oxc`.
|
|
334
|
+
// We set both so the plugin works with Vite 5 / 6 / 7 (esbuild) and Vite 8+ (oxc).
|
|
335
|
+
const jsxTransform = {
|
|
333
336
|
jsx: 'automatic' as const,
|
|
334
337
|
jsxImportSource: 'hono/jsx',
|
|
335
338
|
}
|
|
336
339
|
|
|
337
|
-
// Common JSX transform
|
|
340
|
+
// Common JSX transform plugin — applied to every build (server + client + dev).
|
|
341
|
+
// Vite ≤7 uses esbuild; Vite 8+ uses oxc (rolldown-based). We configure both.
|
|
342
|
+
// OxcOptions.jsx is NOT the same shape as esbuild's — it takes { runtime, importSource }
|
|
343
|
+
// instead of the string 'automatic'. Using the wrong shape emits a deprecation warning.
|
|
338
344
|
const jsxPlugin: Plugin = {
|
|
339
345
|
name: 'fnetro:jsx',
|
|
340
|
-
config: () => ({
|
|
346
|
+
config: () => ({
|
|
347
|
+
// Vite ≤7 (esbuild transform)
|
|
348
|
+
esbuild: jsxTransform,
|
|
349
|
+
// Vite 8+ (oxc / rolldown transform) — jsx property uses JsxOptions object shape
|
|
350
|
+
oxc: {
|
|
351
|
+
jsx: {
|
|
352
|
+
runtime: 'automatic',
|
|
353
|
+
importSource: 'hono/jsx',
|
|
354
|
+
},
|
|
355
|
+
} as any, // `as any` because JsxOptions typing varies across Vite 8 patch releases
|
|
356
|
+
}),
|
|
341
357
|
}
|
|
342
358
|
|
|
343
359
|
// Server build plugin
|
|
@@ -366,7 +382,8 @@ export function fnetroVitePlugin(opts: FNetroPluginOptions = {}): Plugin[] {
|
|
|
366
382
|
serverExternal.includes(id),
|
|
367
383
|
},
|
|
368
384
|
},
|
|
369
|
-
|
|
385
|
+
// Vite ≤7 fallback (oxc is set by jsxPlugin for Vite 8+)
|
|
386
|
+
esbuild: jsxTransform,
|
|
370
387
|
}
|
|
371
388
|
},
|
|
372
389
|
|
|
@@ -376,7 +393,8 @@ export function fnetroVitePlugin(opts: FNetroPluginOptions = {}): Plugin[] {
|
|
|
376
393
|
const { build } = await import('vite')
|
|
377
394
|
await build({
|
|
378
395
|
configFile: false,
|
|
379
|
-
|
|
396
|
+
// Vite ≤7 fallback (oxc is set by jsxPlugin for Vite 8+)
|
|
397
|
+
esbuild: jsxTransform,
|
|
380
398
|
build: {
|
|
381
399
|
outDir: clientOutDir,
|
|
382
400
|
lib: {
|
|
@@ -412,4 +430,4 @@ export type {
|
|
|
412
430
|
AppConfig, PageDef, GroupDef, LayoutDef, ApiRouteDef, MiddlewareDef,
|
|
413
431
|
Ref, ComputedRef, WritableComputedRef, WatchSource, WatchOptions,
|
|
414
432
|
LoaderCtx, FNetroMiddleware, AnyJSX,
|
|
415
|
-
} from './core'
|
|
433
|
+
} from './core'
|