@fluixi/start 0.1.0-alpha.74 → 0.1.0-alpha.75
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/dist/adapter.cjs +5 -3
- package/dist/adapter.d.ts +9 -9
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +10 -10
- package/dist/adapter.mjs +5 -3
- package/dist/adapters/entry.cjs +1 -1
- package/dist/adapters/entry.js +1 -1
- package/dist/adapters/entry.mjs +1 -1
- package/dist/adapters/platforms.cjs +1 -1
- package/dist/adapters/platforms.d.ts +2 -2
- package/dist/adapters/platforms.js +8 -8
- package/dist/adapters/platforms.mjs +1 -1
- package/dist/{api-RH6E5UTH.mjs → api-HD7KU3BS.mjs} +1 -1
- package/dist/api.cjs +2 -2
- package/dist/api.js +1 -1
- package/dist/api.mjs +2 -2
- package/dist/commands/{api-RH6E5UTH.mjs → api-HD7KU3BS.mjs} +1 -1
- package/dist/commands/{api-4IYNQRKG.mjs → api-PBT4QZ34.mjs} +1 -1
- package/dist/commands/{api-23MJFSYL.mjs → api-PJL37LV3.mjs} +2 -2
- package/dist/commands/build.cjs +13 -6
- package/dist/commands/build.js +6 -6
- package/dist/commands/build.mjs +13 -6
- package/dist/commands/{chunk-OCPCK4ZJ.mjs → chunk-GFQ4MUIC.mjs} +2 -2
- package/dist/commands/{chunk-NS5GR2GX.mjs → chunk-MTM6M3TC.mjs} +1 -1
- package/dist/commands/dev.cjs +11 -4
- package/dist/commands/dev.js +3 -3
- package/dist/commands/dev.mjs +12 -5
- package/dist/commands/index.cjs +14 -7
- package/dist/commands/index.d.ts +1 -1
- package/dist/commands/index.js +1 -1
- package/dist/commands/index.mjs +15 -8
- package/dist/commands/prerender.cjs +2 -0
- package/dist/commands/prerender.d.ts +1 -1
- package/dist/commands/prerender.js +2 -2
- package/dist/commands/prerender.mjs +2 -0
- package/dist/commands/start.cjs +2 -0
- package/dist/commands/start.d.ts +1 -1
- package/dist/commands/start.js +2 -2
- package/dist/commands/start.mjs +2 -0
- package/dist/config.cjs +7 -1
- package/dist/config.d.ts +24 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +8 -6
- package/dist/config.mjs +7 -1
- package/dist/define-config.cjs +32 -0
- package/dist/define-config.d.ts +12 -0
- package/dist/define-config.d.ts.map +1 -0
- package/dist/define-config.js +3 -0
- package/dist/define-config.mjs +7 -0
- package/dist/di.cjs +1 -1
- package/dist/di.d.ts +4 -4
- package/dist/di.d.ts.map +1 -1
- package/dist/di.js +9 -9
- package/dist/di.mjs +1 -1
- package/dist/document.d.ts +1 -1
- package/dist/document.js +1 -1
- package/dist/generated-api.cjs +1 -1
- package/dist/generated-api.js +1 -1
- package/dist/generated-api.mjs +1 -1
- package/dist/generated-server-fns.cjs +1 -1
- package/dist/generated-server-fns.mjs +1 -1
- package/dist/handler-core.cjs +1 -1
- package/dist/handler-core.d.ts +2 -2
- package/dist/handler-core.js +2 -2
- package/dist/handler-core.mjs +1 -1
- package/dist/handler.cjs +1 -0
- package/dist/handler.d.ts +3 -3
- package/dist/handler.js +3 -3
- package/dist/handler.mjs +2 -0
- package/dist/head.cjs +1 -1
- package/dist/head.d.ts +1 -1
- package/dist/head.js +1 -1
- package/dist/head.mjs +1 -1
- package/dist/image-loader.cjs +37 -0
- package/dist/image-loader.d.ts +25 -0
- package/dist/image-loader.d.ts.map +1 -0
- package/dist/image-loader.js +18 -0
- package/dist/image-loader.mjs +12 -0
- package/dist/image.cjs +13 -8
- package/dist/image.d.ts +2 -19
- package/dist/image.d.ts.map +1 -1
- package/dist/image.js +5 -21
- package/dist/image.mjs +14 -8
- package/dist/index.cjs +5 -738
- package/dist/index.d.ts +28 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -17
- package/dist/index.mjs +4 -710
- package/dist/interceptors.cjs +1 -0
- package/dist/interceptors.js +1 -1
- package/dist/interceptors.mjs +2 -0
- package/dist/internal.cjs +9 -4
- package/dist/internal.d.ts +6 -6
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +23 -15
- package/dist/internal.mjs +9 -4
- package/dist/middleware.d.ts +3 -3
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +1 -1
- package/dist/preload.cjs +1 -1
- package/dist/preload.js +1 -1
- package/dist/preload.mjs +1 -1
- package/dist/router.cjs +1 -1
- package/dist/router.d.ts +3 -3
- package/dist/router.js +3 -3
- package/dist/router.mjs +1 -1
- package/dist/server-fn-setup.cjs +1 -1
- package/dist/server-fn-setup.d.ts +1 -1
- package/dist/server-fn-setup.js +2 -2
- package/dist/server-fn-setup.mjs +1 -1
- package/dist/server-fn.cjs +1 -1
- package/dist/server-fn.d.ts +2 -2
- package/dist/server-fn.js +2 -2
- package/dist/server-fn.mjs +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +1 -1
- package/dist/ui.mjs +1 -1
- package/package.json +25 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/start v0.1.0-alpha.
|
|
1
|
+
/*! @fluixi/start v0.1.0-alpha.75 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
|
|
3
3
|
// src/api.ts
|
|
4
4
|
import { readdirSync, statSync } from "node:fs";
|
|
@@ -75,7 +75,7 @@ function apiRoutesVitePlugin(opts) {
|
|
|
75
75
|
return {
|
|
76
76
|
name: "fluixi-api",
|
|
77
77
|
// Must beat node resolution: '@fluixi/start/api-routes' is a real file in this package,
|
|
78
|
-
// so without `pre` Vite resolves the typed stub and the generated table never loads
|
|
78
|
+
// so without `pre` Vite resolves the typed stub and the generated table never loads ,
|
|
79
79
|
// the app builds and every API route 404s.
|
|
80
80
|
enforce: "pre",
|
|
81
81
|
configResolved(config) {
|
|
@@ -73,7 +73,7 @@ function apiRoutesVitePlugin(opts) {
|
|
|
73
73
|
return {
|
|
74
74
|
name: "fluixi-api",
|
|
75
75
|
// Must beat node resolution: '@fluixi/start/api-routes' is a real file in this package,
|
|
76
|
-
// so without `pre` Vite resolves the typed stub and the generated table never loads
|
|
76
|
+
// so without `pre` Vite resolves the typed stub and the generated table never loads ,
|
|
77
77
|
// the app builds and every API route 404s.
|
|
78
78
|
enforce: "pre",
|
|
79
79
|
configResolved(config) {
|
package/dist/commands/dev.cjs
CHANGED
|
@@ -110,7 +110,7 @@ function apiRoutesVitePlugin(opts) {
|
|
|
110
110
|
return {
|
|
111
111
|
name: "fluixi-api",
|
|
112
112
|
// Must beat node resolution: '@fluixi/start/api-routes' is a real file in this package,
|
|
113
|
-
// so without `pre` Vite resolves the typed stub and the generated table never loads
|
|
113
|
+
// so without `pre` Vite resolves the typed stub and the generated table never loads ,
|
|
114
114
|
// the app builds and every API route 404s.
|
|
115
115
|
enforce: "pre",
|
|
116
116
|
configResolved(config) {
|
|
@@ -179,6 +179,8 @@ function resolveConfig(config = {}) {
|
|
|
179
179
|
middleware: config.middleware ?? "src/middleware.ts",
|
|
180
180
|
ssrNoExternal: config.ssrNoExternal ?? [],
|
|
181
181
|
resolve: config.resolve ?? [],
|
|
182
|
+
vitePlugin: config.vitePlugin ?? {},
|
|
183
|
+
plugins: config.plugins ?? [],
|
|
182
184
|
adapter: config.adapter,
|
|
183
185
|
i18n: resolveI18n(config.i18n),
|
|
184
186
|
prerender: resolvePrerender(config.prerender)
|
|
@@ -363,7 +365,7 @@ function startTypesPlugin(cfg) {
|
|
|
363
365
|
const blocks = [];
|
|
364
366
|
if (cfg.i18n) blocks.push(...i18nTypeBlock(root, cfg.i18n));
|
|
365
367
|
if (blocks.length === 0) return;
|
|
366
|
-
const content = `// Auto-generated by @fluixi/start
|
|
368
|
+
const content = `// Auto-generated by @fluixi/start, do not edit.
|
|
367
369
|
${blocks.join("\n")}
|
|
368
370
|
`;
|
|
369
371
|
const file = (0, import_node_path3.resolve)(root, "src/fluixi-start-env.d.ts");
|
|
@@ -384,10 +386,15 @@ async function fluixiPlugins(cfg) {
|
|
|
384
386
|
// app has no way to say where an unimported tag comes from.
|
|
385
387
|
//
|
|
386
388
|
// `fluixi()` and not `createVitePlugin()`: the latter is the bare compiler integration,
|
|
387
|
-
// and the reactive graph
|
|
389
|
+
// and the reactive graph: agent, source marks, /__fluixi/graph, is composed on top of
|
|
388
390
|
// it by the former. A start app got no graph at all until this changed.
|
|
389
|
-
|
|
391
|
+
// Everything the app declared for the compiler, with `resolve` still usable on its
|
|
392
|
+
// own because it is the one most apps set. A start app never writes
|
|
393
|
+
// `fluixi()` itself, so without this passthrough the plugin's other options
|
|
394
|
+
// (propsDestructure and the rest) had nowhere to be declared.
|
|
395
|
+
fluixi({ ...cfg.vitePlugin ?? {}, ...cfg.resolve ? { resolve: cfg.resolve } : {} })
|
|
390
396
|
];
|
|
397
|
+
if (cfg.plugins?.length) plugins.push(...cfg.plugins);
|
|
391
398
|
if (cfg.i18n) plugins.push(i18nVitePlugin(cfg.i18n));
|
|
392
399
|
const { apiRoutesVitePlugin: apiRoutesVitePlugin2 } = await Promise.resolve().then(() => (init_api(), api_exports));
|
|
393
400
|
plugins.push(apiRoutesVitePlugin2({ dir: cfg.apiDir }));
|
package/dist/commands/dev.js
CHANGED
|
@@ -12,7 +12,7 @@ const STYLE_FILE = /\.(css|scss|sass|less|styl|stylus|pcss|postcss)(\?|$)/;
|
|
|
12
12
|
* Stylesheets the SSR render pulled in, walked from the server entry.
|
|
13
13
|
*
|
|
14
14
|
* Without these, dev serves a fully rendered page with no CSS at all and the styles
|
|
15
|
-
* arrive with the client bundle
|
|
15
|
+
* arrive with the client bundle: a flash of unstyled content on every load, in the one
|
|
16
16
|
* environment you look at most. The build has no such gap: Vite emits real `<link>`s.
|
|
17
17
|
*
|
|
18
18
|
* Dev serves a `.css` URL as a JS module that injects a style tag, so `?direct` is what
|
|
@@ -75,13 +75,13 @@ export async function dev(config = {}) {
|
|
|
75
75
|
const path = url.pathname + url.search;
|
|
76
76
|
// Server-function RPC: auto-wired. Load the registry vmod (registers every "use server"
|
|
77
77
|
// fn + wires the request-context runner + re-exports the dispatcher) and route /_server
|
|
78
|
-
// through it
|
|
78
|
+
// through it: no need for the app's entry-server to re-export anything.
|
|
79
79
|
if (url.pathname === '/_server') {
|
|
80
80
|
const sf = await vite.ssrLoadModule(SERVER_FNS_VMOD);
|
|
81
81
|
if (sf.isServerFnRequest(request))
|
|
82
82
|
return sf.handleServerFn(request);
|
|
83
83
|
}
|
|
84
|
-
// File-based API routes (src/api/** → /api/*)
|
|
84
|
+
// File-based API routes (src/api/** → /api/*), auto-wired, no entry change needed.
|
|
85
85
|
if (isApiPath(url.pathname)) {
|
|
86
86
|
const api = await vite.ssrLoadModule(API_VIRTUAL_MODULE);
|
|
87
87
|
if (api.isApiRequest(request))
|
package/dist/commands/dev.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
API_VIRTUAL_MODULE,
|
|
3
3
|
isApiPath
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MTM6M3TC.mjs";
|
|
5
5
|
|
|
6
6
|
// src/commands/dev.ts
|
|
7
7
|
import { createServer as createHttp } from "node:http";
|
|
@@ -25,6 +25,8 @@ function resolveConfig(config = {}) {
|
|
|
25
25
|
middleware: config.middleware ?? "src/middleware.ts",
|
|
26
26
|
ssrNoExternal: config.ssrNoExternal ?? [],
|
|
27
27
|
resolve: config.resolve ?? [],
|
|
28
|
+
vitePlugin: config.vitePlugin ?? {},
|
|
29
|
+
plugins: config.plugins ?? [],
|
|
28
30
|
adapter: config.adapter,
|
|
29
31
|
i18n: resolveI18n(config.i18n),
|
|
30
32
|
prerender: resolvePrerender(config.prerender)
|
|
@@ -209,7 +211,7 @@ function startTypesPlugin(cfg) {
|
|
|
209
211
|
const blocks = [];
|
|
210
212
|
if (cfg.i18n) blocks.push(...i18nTypeBlock(root, cfg.i18n));
|
|
211
213
|
if (blocks.length === 0) return;
|
|
212
|
-
const content = `// Auto-generated by @fluixi/start
|
|
214
|
+
const content = `// Auto-generated by @fluixi/start, do not edit.
|
|
213
215
|
${blocks.join("\n")}
|
|
214
216
|
`;
|
|
215
217
|
const file = resolvePath(root, "src/fluixi-start-env.d.ts");
|
|
@@ -230,12 +232,17 @@ async function fluixiPlugins(cfg) {
|
|
|
230
232
|
// app has no way to say where an unimported tag comes from.
|
|
231
233
|
//
|
|
232
234
|
// `fluixi()` and not `createVitePlugin()`: the latter is the bare compiler integration,
|
|
233
|
-
// and the reactive graph
|
|
235
|
+
// and the reactive graph: agent, source marks, /__fluixi/graph, is composed on top of
|
|
234
236
|
// it by the former. A start app got no graph at all until this changed.
|
|
235
|
-
|
|
237
|
+
// Everything the app declared for the compiler, with `resolve` still usable on its
|
|
238
|
+
// own because it is the one most apps set. A start app never writes
|
|
239
|
+
// `fluixi()` itself, so without this passthrough the plugin's other options
|
|
240
|
+
// (propsDestructure and the rest) had nowhere to be declared.
|
|
241
|
+
fluixi({ ...cfg.vitePlugin ?? {}, ...cfg.resolve ? { resolve: cfg.resolve } : {} })
|
|
236
242
|
];
|
|
243
|
+
if (cfg.plugins?.length) plugins.push(...cfg.plugins);
|
|
237
244
|
if (cfg.i18n) plugins.push(i18nVitePlugin(cfg.i18n));
|
|
238
|
-
const { apiRoutesVitePlugin } = await import("./api-
|
|
245
|
+
const { apiRoutesVitePlugin } = await import("./api-PBT4QZ34.mjs");
|
|
239
246
|
plugins.push(apiRoutesVitePlugin({ dir: cfg.apiDir }));
|
|
240
247
|
plugins.push(startTypesPlugin(cfg));
|
|
241
248
|
return plugins;
|
package/dist/commands/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/start v0.1.0-alpha.
|
|
1
|
+
/*! @fluixi/start v0.1.0-alpha.75 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -111,7 +111,7 @@ function apiRoutesVitePlugin(opts) {
|
|
|
111
111
|
return {
|
|
112
112
|
name: "fluixi-api",
|
|
113
113
|
// Must beat node resolution: '@fluixi/start/api-routes' is a real file in this package,
|
|
114
|
-
// so without `pre` Vite resolves the typed stub and the generated table never loads
|
|
114
|
+
// so without `pre` Vite resolves the typed stub and the generated table never loads ,
|
|
115
115
|
// the app builds and every API route 404s.
|
|
116
116
|
enforce: "pre",
|
|
117
117
|
configResolved(config) {
|
|
@@ -185,6 +185,8 @@ function resolveConfig(config = {}) {
|
|
|
185
185
|
middleware: config.middleware ?? "src/middleware.ts",
|
|
186
186
|
ssrNoExternal: config.ssrNoExternal ?? [],
|
|
187
187
|
resolve: config.resolve ?? [],
|
|
188
|
+
vitePlugin: config.vitePlugin ?? {},
|
|
189
|
+
plugins: config.plugins ?? [],
|
|
188
190
|
adapter: config.adapter,
|
|
189
191
|
i18n: resolveI18n(config.i18n),
|
|
190
192
|
prerender: resolvePrerender(config.prerender)
|
|
@@ -381,7 +383,7 @@ function startTypesPlugin(cfg) {
|
|
|
381
383
|
const blocks = [];
|
|
382
384
|
if (cfg.i18n) blocks.push(...i18nTypeBlock(root, cfg.i18n));
|
|
383
385
|
if (blocks.length === 0) return;
|
|
384
|
-
const content = `// Auto-generated by @fluixi/start
|
|
386
|
+
const content = `// Auto-generated by @fluixi/start, do not edit.
|
|
385
387
|
${blocks.join("\n")}
|
|
386
388
|
`;
|
|
387
389
|
const file = (0, import_node_path3.resolve)(root, "src/fluixi-start-env.d.ts");
|
|
@@ -402,10 +404,15 @@ async function fluixiPlugins(cfg) {
|
|
|
402
404
|
// app has no way to say where an unimported tag comes from.
|
|
403
405
|
//
|
|
404
406
|
// `fluixi()` and not `createVitePlugin()`: the latter is the bare compiler integration,
|
|
405
|
-
// and the reactive graph
|
|
407
|
+
// and the reactive graph: agent, source marks, /__fluixi/graph, is composed on top of
|
|
406
408
|
// it by the former. A start app got no graph at all until this changed.
|
|
407
|
-
|
|
409
|
+
// Everything the app declared for the compiler, with `resolve` still usable on its
|
|
410
|
+
// own because it is the one most apps set. A start app never writes
|
|
411
|
+
// `fluixi()` itself, so without this passthrough the plugin's other options
|
|
412
|
+
// (propsDestructure and the rest) had nowhere to be declared.
|
|
413
|
+
fluixi({ ...cfg.vitePlugin ?? {}, ...cfg.resolve ? { resolve: cfg.resolve } : {} })
|
|
408
414
|
];
|
|
415
|
+
if (cfg.plugins?.length) plugins.push(...cfg.plugins);
|
|
409
416
|
if (cfg.i18n) plugins.push(i18nVitePlugin(cfg.i18n));
|
|
410
417
|
const { apiRoutesVitePlugin: apiRoutesVitePlugin2 } = await Promise.resolve().then(() => (init_api(), api_exports));
|
|
411
418
|
plugins.push(apiRoutesVitePlugin2({ dir: cfg.apiDir }));
|
|
@@ -870,7 +877,7 @@ function ssrBuildOptions(cfg) {
|
|
|
870
877
|
const external = frameworkDeps(cfg.root).filter((name) => !cfg.ssrNoExternal.includes(name)).flatMap((name) => withSubpaths(cfg.root, name));
|
|
871
878
|
if (!external.length) {
|
|
872
879
|
console.warn(
|
|
873
|
-
` fluixi: adapter "${cfg.adapter?.name}" builds an externalized server, but no fluixi or @fluixi/* dependency was found in ${(0, import_node_path6.join)(cfg.root, "package.json")}
|
|
880
|
+
` fluixi: adapter "${cfg.adapter?.name}" builds an externalized server, but no fluixi or @fluixi/* dependency was found in ${(0, import_node_path6.join)(cfg.root, "package.json")}, bundling everything.`
|
|
874
881
|
);
|
|
875
882
|
}
|
|
876
883
|
return { noExternal, external: external.length ? external : void 0 };
|
|
@@ -1096,7 +1103,7 @@ async function bundleEntry(cfg, plugins, source, outFile) {
|
|
|
1096
1103
|
output: {
|
|
1097
1104
|
entryFileNames: (0, import_node_path8.basename)(outFile),
|
|
1098
1105
|
// One file, no chunks. A lazy route would otherwise be split out beside
|
|
1099
|
-
// the entry
|
|
1106
|
+
// the entry: and for Cloudflare that directory is the published one, so
|
|
1100
1107
|
// every server chunk would be a public download.
|
|
1101
1108
|
inlineDynamicImports: true
|
|
1102
1109
|
}
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Kept off the package root deliberately: these reach the dev server, the build
|
|
5
5
|
* and the prerenderer, and a module that only wants `defineMiddleware` should not
|
|
6
|
-
* be able to pull a bundler in behind it. That matters at build time
|
|
6
|
+
* be able to pull a bundler in behind it. That matters at build time, a deploy
|
|
7
7
|
* adapter inlines everything the entry can reach, and reaching this would put
|
|
8
8
|
* vite in a worker.
|
|
9
9
|
*/
|
package/dist/commands/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Kept off the package root deliberately: these reach the dev server, the build
|
|
5
5
|
* and the prerenderer, and a module that only wants `defineMiddleware` should not
|
|
6
|
-
* be able to pull a bundler in behind it. That matters at build time
|
|
6
|
+
* be able to pull a bundler in behind it. That matters at build time, a deploy
|
|
7
7
|
* adapter inlines everything the entry can reach, and reaching this would put
|
|
8
8
|
* vite in a worker.
|
|
9
9
|
*/
|
package/dist/commands/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @fluixi/start v0.1.0-alpha.
|
|
1
|
+
/*! @fluixi/start v0.1.0-alpha.75 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
import {
|
|
3
3
|
API_VIRTUAL_MODULE,
|
|
4
4
|
isApiPath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GFQ4MUIC.mjs";
|
|
6
6
|
|
|
7
7
|
// src/commands/dev.ts
|
|
8
8
|
import { createServer as createHttp } from "node:http";
|
|
@@ -26,6 +26,8 @@ function resolveConfig(config = {}) {
|
|
|
26
26
|
middleware: config.middleware ?? "src/middleware.ts",
|
|
27
27
|
ssrNoExternal: config.ssrNoExternal ?? [],
|
|
28
28
|
resolve: config.resolve ?? [],
|
|
29
|
+
vitePlugin: config.vitePlugin ?? {},
|
|
30
|
+
plugins: config.plugins ?? [],
|
|
29
31
|
adapter: config.adapter,
|
|
30
32
|
i18n: resolveI18n(config.i18n),
|
|
31
33
|
prerender: resolvePrerender(config.prerender)
|
|
@@ -222,7 +224,7 @@ function startTypesPlugin(cfg) {
|
|
|
222
224
|
const blocks = [];
|
|
223
225
|
if (cfg.i18n) blocks.push(...i18nTypeBlock(root, cfg.i18n));
|
|
224
226
|
if (blocks.length === 0) return;
|
|
225
|
-
const content = `// Auto-generated by @fluixi/start
|
|
227
|
+
const content = `// Auto-generated by @fluixi/start, do not edit.
|
|
226
228
|
${blocks.join("\n")}
|
|
227
229
|
`;
|
|
228
230
|
const file = resolvePath(root, "src/fluixi-start-env.d.ts");
|
|
@@ -243,12 +245,17 @@ async function fluixiPlugins(cfg) {
|
|
|
243
245
|
// app has no way to say where an unimported tag comes from.
|
|
244
246
|
//
|
|
245
247
|
// `fluixi()` and not `createVitePlugin()`: the latter is the bare compiler integration,
|
|
246
|
-
// and the reactive graph
|
|
248
|
+
// and the reactive graph: agent, source marks, /__fluixi/graph, is composed on top of
|
|
247
249
|
// it by the former. A start app got no graph at all until this changed.
|
|
248
|
-
|
|
250
|
+
// Everything the app declared for the compiler, with `resolve` still usable on its
|
|
251
|
+
// own because it is the one most apps set. A start app never writes
|
|
252
|
+
// `fluixi()` itself, so without this passthrough the plugin's other options
|
|
253
|
+
// (propsDestructure and the rest) had nowhere to be declared.
|
|
254
|
+
fluixi({ ...cfg.vitePlugin ?? {}, ...cfg.resolve ? { resolve: cfg.resolve } : {} })
|
|
249
255
|
];
|
|
256
|
+
if (cfg.plugins?.length) plugins.push(...cfg.plugins);
|
|
250
257
|
if (cfg.i18n) plugins.push(i18nVitePlugin(cfg.i18n));
|
|
251
|
-
const { apiRoutesVitePlugin } = await import("./api-
|
|
258
|
+
const { apiRoutesVitePlugin } = await import("./api-PJL37LV3.mjs");
|
|
252
259
|
plugins.push(apiRoutesVitePlugin({ dir: cfg.apiDir }));
|
|
253
260
|
plugins.push(startTypesPlugin(cfg));
|
|
254
261
|
return plugins;
|
|
@@ -708,7 +715,7 @@ function ssrBuildOptions(cfg) {
|
|
|
708
715
|
const external = frameworkDeps(cfg.root).filter((name) => !cfg.ssrNoExternal.includes(name)).flatMap((name) => withSubpaths(cfg.root, name));
|
|
709
716
|
if (!external.length) {
|
|
710
717
|
console.warn(
|
|
711
|
-
` fluixi: adapter "${cfg.adapter?.name}" builds an externalized server, but no fluixi or @fluixi/* dependency was found in ${join2(cfg.root, "package.json")}
|
|
718
|
+
` fluixi: adapter "${cfg.adapter?.name}" builds an externalized server, but no fluixi or @fluixi/* dependency was found in ${join2(cfg.root, "package.json")}, bundling everything.`
|
|
712
719
|
);
|
|
713
720
|
}
|
|
714
721
|
return { noExternal, external: external.length ? external : void 0 };
|
|
@@ -934,7 +941,7 @@ async function bundleEntry(cfg, plugins, source, outFile) {
|
|
|
934
941
|
output: {
|
|
935
942
|
entryFileNames: basename(outFile),
|
|
936
943
|
// One file, no chunks. A lazy route would otherwise be split out beside
|
|
937
|
-
// the entry
|
|
944
|
+
// the entry: and for Cloudflare that directory is the published one, so
|
|
938
945
|
// every server chunk would be a public download.
|
|
939
946
|
inlineDynamicImports: true
|
|
940
947
|
}
|
|
@@ -45,6 +45,8 @@ function resolveConfig(config = {}) {
|
|
|
45
45
|
middleware: config.middleware ?? "src/middleware.ts",
|
|
46
46
|
ssrNoExternal: config.ssrNoExternal ?? [],
|
|
47
47
|
resolve: config.resolve ?? [],
|
|
48
|
+
vitePlugin: config.vitePlugin ?? {},
|
|
49
|
+
plugins: config.plugins ?? [],
|
|
48
50
|
adapter: config.adapter,
|
|
49
51
|
i18n: resolveI18n(config.i18n),
|
|
50
52
|
prerender: resolvePrerender(config.prerender)
|
|
@@ -2,7 +2,7 @@ import type { FluixiConfig } from '../config.js';
|
|
|
2
2
|
export declare function htmlPath(url: string): string;
|
|
3
3
|
export declare function extractLinks(html: string): string[];
|
|
4
4
|
/**
|
|
5
|
-
* Render routes to static HTML in dist/client, via the real prod handler
|
|
5
|
+
* Render routes to static HTML in dist/client, via the real prod handler, so each page is
|
|
6
6
|
* byte-identical to what `fluixi start` would serve (assets, __FX_DATA__, hydration), it just
|
|
7
7
|
* lives on disk. Seeds from `prerender.routes` (default `/`) and, when `crawl`, follows internal
|
|
8
8
|
* links. Returns the written route paths.
|
|
@@ -8,7 +8,7 @@ export function htmlPath(url) {
|
|
|
8
8
|
const clean = url.split(/[?#]/)[0].replace(/\/+$/, '');
|
|
9
9
|
return clean === '' ? 'index.html' : `${clean.replace(/^\//, '')}/index.html`;
|
|
10
10
|
}
|
|
11
|
-
// internal links from rendered HTML
|
|
11
|
+
// internal links from rendered HTML: skip files (.js/.css/…), anchors, queries, external
|
|
12
12
|
export function extractLinks(html) {
|
|
13
13
|
const out = new Set();
|
|
14
14
|
for (const m of html.matchAll(/href=["'](\/[^"'#?]*)["']/g)) {
|
|
@@ -24,7 +24,7 @@ const norm = (u) => {
|
|
|
24
24
|
return p || '/';
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
|
-
* Render routes to static HTML in dist/client, via the real prod handler
|
|
27
|
+
* Render routes to static HTML in dist/client, via the real prod handler, so each page is
|
|
28
28
|
* byte-identical to what `fluixi start` would serve (assets, __FX_DATA__, hydration), it just
|
|
29
29
|
* lives on disk. Seeds from `prerender.routes` (default `/`) and, when `crawl`, follows internal
|
|
30
30
|
* links. Returns the written route paths.
|
|
@@ -19,6 +19,8 @@ function resolveConfig(config = {}) {
|
|
|
19
19
|
middleware: config.middleware ?? "src/middleware.ts",
|
|
20
20
|
ssrNoExternal: config.ssrNoExternal ?? [],
|
|
21
21
|
resolve: config.resolve ?? [],
|
|
22
|
+
vitePlugin: config.vitePlugin ?? {},
|
|
23
|
+
plugins: config.plugins ?? [],
|
|
22
24
|
adapter: config.adapter,
|
|
23
25
|
i18n: resolveI18n(config.i18n),
|
|
24
26
|
prerender: resolvePrerender(config.prerender)
|
package/dist/commands/start.cjs
CHANGED
|
@@ -52,6 +52,8 @@ function resolveConfig(config = {}) {
|
|
|
52
52
|
middleware: config.middleware ?? "src/middleware.ts",
|
|
53
53
|
ssrNoExternal: config.ssrNoExternal ?? [],
|
|
54
54
|
resolve: config.resolve ?? [],
|
|
55
|
+
vitePlugin: config.vitePlugin ?? {},
|
|
56
|
+
plugins: config.plugins ?? [],
|
|
55
57
|
adapter: config.adapter,
|
|
56
58
|
i18n: resolveI18n(config.i18n),
|
|
57
59
|
prerender: resolvePrerender(config.prerender)
|
package/dist/commands/start.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { FluixiConfig } from '../config.js';
|
|
|
3
3
|
* Production server: build the runtime-neutral SSR fetch handler from the `fluixi
|
|
4
4
|
* build` output and serve it via the Node adapter (static files from dist/client +
|
|
5
5
|
* SSR for everything else). Other runtimes (edge/Bun/Deno) use the same
|
|
6
|
-
* `createProdHandler` with their own adapter
|
|
6
|
+
* `createProdHandler` with their own adapter: `export default { fetch }`.
|
|
7
7
|
*/
|
|
8
8
|
export declare function start(config?: FluixiConfig): Promise<void>;
|
|
9
9
|
//# sourceMappingURL=start.d.ts.map
|
package/dist/commands/start.js
CHANGED
|
@@ -6,7 +6,7 @@ import { createProdHandler, nodeAdapter } from '../adapter.js';
|
|
|
6
6
|
* Production server: build the runtime-neutral SSR fetch handler from the `fluixi
|
|
7
7
|
* build` output and serve it via the Node adapter (static files from dist/client +
|
|
8
8
|
* SSR for everything else). Other runtimes (edge/Bun/Deno) use the same
|
|
9
|
-
* `createProdHandler` with their own adapter
|
|
9
|
+
* `createProdHandler` with their own adapter: `export default { fetch }`.
|
|
10
10
|
*/
|
|
11
11
|
export async function start(config = {}) {
|
|
12
12
|
const cfg = resolveConfig(config);
|
|
@@ -15,7 +15,7 @@ export async function start(config = {}) {
|
|
|
15
15
|
const clientDir = resolve(cfg.root, 'dist/client');
|
|
16
16
|
const handler = await createProdHandler(cfg);
|
|
17
17
|
// The configured adapter, or node when there is none. An adapter that returns
|
|
18
|
-
// `{ fetch }` has no process to run
|
|
18
|
+
// `{ fetch }` has no process to run: its output is a module the platform imports ,
|
|
19
19
|
// so say that instead of exiting as if the server had started.
|
|
20
20
|
const adapter = cfg.adapter ?? nodeAdapter;
|
|
21
21
|
const served = await adapter.serve({ handler, cfg, clientDir });
|
package/dist/commands/start.mjs
CHANGED
|
@@ -18,6 +18,8 @@ function resolveConfig(config = {}) {
|
|
|
18
18
|
middleware: config.middleware ?? "src/middleware.ts",
|
|
19
19
|
ssrNoExternal: config.ssrNoExternal ?? [],
|
|
20
20
|
resolve: config.resolve ?? [],
|
|
21
|
+
vitePlugin: config.vitePlugin ?? {},
|
|
22
|
+
plugins: config.plugins ?? [],
|
|
21
23
|
adapter: config.adapter,
|
|
22
24
|
i18n: resolveI18n(config.i18n),
|
|
23
25
|
prerender: resolvePrerender(config.prerender)
|
package/dist/config.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/start v0.1.0-alpha.
|
|
1
|
+
/*! @fluixi/start v0.1.0-alpha.75 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -40,9 +40,13 @@ var import_node_url = require("node:url");
|
|
|
40
40
|
var import_node_fs = require("node:fs");
|
|
41
41
|
var import_promises = require("node:fs/promises");
|
|
42
42
|
var import_node_path = require("node:path");
|
|
43
|
+
|
|
44
|
+
// src/define-config.ts
|
|
43
45
|
function defineConfig(config) {
|
|
44
46
|
return config;
|
|
45
47
|
}
|
|
48
|
+
|
|
49
|
+
// src/config.ts
|
|
46
50
|
function resolveConfig(config = {}) {
|
|
47
51
|
const root = (0, import_node_path.resolve)(config.root ?? process.cwd());
|
|
48
52
|
return {
|
|
@@ -58,6 +62,8 @@ function resolveConfig(config = {}) {
|
|
|
58
62
|
middleware: config.middleware ?? "src/middleware.ts",
|
|
59
63
|
ssrNoExternal: config.ssrNoExternal ?? [],
|
|
60
64
|
resolve: config.resolve ?? [],
|
|
65
|
+
vitePlugin: config.vitePlugin ?? {},
|
|
66
|
+
plugins: config.plugins ?? [],
|
|
61
67
|
adapter: config.adapter,
|
|
62
68
|
i18n: resolveI18n(config.i18n),
|
|
63
69
|
prerender: resolvePrerender(config.prerender)
|
package/dist/config.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Adapter } from './adapter.js';
|
|
|
2
2
|
import type { ComponentResolverRule } from '@fluixi/compiler';
|
|
3
3
|
/**
|
|
4
4
|
* Fluixi app config. Place in `fluixi.config.{ts,js,mjs}` at the app root and wrap
|
|
5
|
-
* with `defineConfig` for types. Everything is optional
|
|
5
|
+
* with `defineConfig` for types. Everything is optional, the defaults match the
|
|
6
6
|
* conventional layout (src/entry-server.ts, src/entry-client.ts, index.html).
|
|
7
7
|
*/
|
|
8
8
|
export interface FluixiConfig {
|
|
@@ -10,7 +10,7 @@ export interface FluixiConfig {
|
|
|
10
10
|
root?: string;
|
|
11
11
|
/**
|
|
12
12
|
* Render mode. `true` (default) = SSR: the server entry renders HTML per request. `false`
|
|
13
|
-
* = SPA: the server serves the static shell and the client renders
|
|
13
|
+
* = SPA: the server serves the static shell and the client renders, but you still get the
|
|
14
14
|
* full @fluixi/start server (file routing, middleware, env, and `/_server` server functions).
|
|
15
15
|
* The same app code runs either way; flip this to choose where the first paint happens.
|
|
16
16
|
*/
|
|
@@ -31,7 +31,7 @@ export interface FluixiConfig {
|
|
|
31
31
|
apiDir?: string;
|
|
32
32
|
/** Request middleware module (default-exports `defineMiddleware([...])`). Default: src/middleware.ts */
|
|
33
33
|
middleware?: string;
|
|
34
|
-
/** SSR deps Vite must bundle (no-external)
|
|
34
|
+
/** SSR deps Vite must bundle (no-external), e.g. ESM packages without file extensions. */
|
|
35
35
|
ssrNoExternal?: string[];
|
|
36
36
|
/**
|
|
37
37
|
* Where a capitalised tag with no import in scope comes from.
|
|
@@ -41,9 +41,26 @@ export interface FluixiConfig {
|
|
|
41
41
|
* so a whole directory is one rule rather than a list to maintain.
|
|
42
42
|
*
|
|
43
43
|
* Only needed for tags you don't import. A `load:` directive works on your own import
|
|
44
|
-
* too
|
|
44
|
+
* too: see the docs on load strategies.
|
|
45
45
|
*/
|
|
46
46
|
resolve?: readonly ComponentResolverRule[];
|
|
47
|
+
/**
|
|
48
|
+
* Options handed to the fluixi vite plugin.
|
|
49
|
+
*
|
|
50
|
+
* A start app does not write `fluixi()` into a vite config, the framework adds the
|
|
51
|
+
* plugin itself, so this is where its options go: `propsDestructure`, and anything
|
|
52
|
+
* else the compiler takes. `resolve` above is the shorthand for the one most apps
|
|
53
|
+
* set, and wins over a `resolve` given here.
|
|
54
|
+
*/
|
|
55
|
+
vitePlugin?: Record<string, unknown>;
|
|
56
|
+
/**
|
|
57
|
+
* Extra vite plugins, appended after the framework's own.
|
|
58
|
+
*
|
|
59
|
+
* A start app has no vite config of its own, so a plugin it needs but the framework
|
|
60
|
+
* does not ship, a css engine for instance, is declared here instead of forcing a
|
|
61
|
+
* second config file into the project.
|
|
62
|
+
*/
|
|
63
|
+
plugins?: unknown[];
|
|
47
64
|
/**
|
|
48
65
|
* Deploy target. Decides how `fluixi build` bundles the server (see the adapter's
|
|
49
66
|
* `bundle` mode) and how `fluixi start` serves it. Unset keeps Vite's own bundling
|
|
@@ -54,7 +71,7 @@ export interface FluixiConfig {
|
|
|
54
71
|
* Built-in i18n auto-discovery. Scans `<dir>/<locale>.json` and exposes them as
|
|
55
72
|
* `virtual:fluixi-i18n` (`{ messages, locales, defaultLocale }`) to feed `createI18n`.
|
|
56
73
|
* `false` disables it; an object configures the folder / locales / default. Default: enabled
|
|
57
|
-
* with `src/i18n
|
|
74
|
+
* with `src/i18n`: a no-op until that folder has `*.json` files, so it's effectively opt-in.
|
|
58
75
|
*/
|
|
59
76
|
i18n?: boolean | {
|
|
60
77
|
dir?: string;
|
|
@@ -91,13 +108,13 @@ export type ResolvedConfig = Required<Omit<FluixiConfig, 'ssrNoExternal' | 'i18n
|
|
|
91
108
|
adapter?: Adapter;
|
|
92
109
|
};
|
|
93
110
|
/** Identity helper for editor types in `fluixi.config.ts`. */
|
|
94
|
-
export
|
|
111
|
+
export { defineConfig } from './define-config.js';
|
|
95
112
|
/** Apply defaults. */
|
|
96
113
|
export declare function resolveConfig(config?: FluixiConfig): ResolvedConfig;
|
|
97
114
|
/**
|
|
98
115
|
* Load `fluixi.config.{ts,mts,mjs,js}` from the app root. TypeScript configs are
|
|
99
116
|
* bundled on the fly with esbuild and imported; plain ESM is imported directly.
|
|
100
|
-
* No config is fine too
|
|
117
|
+
* No config is fine too: every field has a default.
|
|
101
118
|
*/
|
|
102
119
|
export declare function loadConfig(root?: string): Promise<FluixiConfig>;
|
|
103
120
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mGAAmG;IACnG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6GAA6G;IAC7G,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wGAAwG;IACxG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mGAAmG;IACnG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6GAA6G;IAC7G,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wGAAwG;IACxG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0FAA0F;IAC1F,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC3C;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC9E;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC9D;AAED,iEAAiE;AACjE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,sDAAsD;AACtD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,CACnC,IAAI,CAAC,YAAY,EAAE,eAAe,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC,CACvE,GAAG;IACF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,EAAE,YAAY,GAAG,KAAK,CAAC;IAC3B,SAAS,EAAE,iBAAiB,GAAG,KAAK,CAAC;IACrC,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,8DAA8D;AAG9D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,sBAAsB;AACtB,wBAAgB,aAAa,CAAC,MAAM,GAAE,YAAiB,GAAG,cAAc,CAqBvE;AAgCD;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,IAAI,SAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CAM5E"}
|
package/dist/config.js
CHANGED
|
@@ -3,9 +3,9 @@ import { existsSync } from 'node:fs';
|
|
|
3
3
|
import { writeFile, unlink } from 'node:fs/promises';
|
|
4
4
|
import { resolve, isAbsolute } from 'node:path';
|
|
5
5
|
/** Identity helper for editor types in `fluixi.config.ts`. */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
6
|
+
// One implementation, re-exported: the root entry needs it without this module's
|
|
7
|
+
// `node:fs`, and two copies of an identity function is how their signatures drift.
|
|
8
|
+
export { defineConfig } from './define-config.js';
|
|
9
9
|
/** Apply defaults. */
|
|
10
10
|
export function resolveConfig(config = {}) {
|
|
11
11
|
const root = resolve(config.root ?? process.cwd());
|
|
@@ -22,6 +22,8 @@ export function resolveConfig(config = {}) {
|
|
|
22
22
|
middleware: config.middleware ?? 'src/middleware.ts',
|
|
23
23
|
ssrNoExternal: config.ssrNoExternal ?? [],
|
|
24
24
|
resolve: config.resolve ?? [],
|
|
25
|
+
vitePlugin: config.vitePlugin ?? {},
|
|
26
|
+
plugins: config.plugins ?? [],
|
|
25
27
|
adapter: config.adapter,
|
|
26
28
|
i18n: resolveI18n(config.i18n),
|
|
27
29
|
prerender: resolvePrerender(config.prerender),
|
|
@@ -59,7 +61,7 @@ const CONFIG_NAMES = [
|
|
|
59
61
|
/**
|
|
60
62
|
* Load `fluixi.config.{ts,mts,mjs,js}` from the app root. TypeScript configs are
|
|
61
63
|
* bundled on the fly with esbuild and imported; plain ESM is imported directly.
|
|
62
|
-
* No config is fine too
|
|
64
|
+
* No config is fine too: every field has a default.
|
|
63
65
|
*/
|
|
64
66
|
export async function loadConfig(root = process.cwd()) {
|
|
65
67
|
for (const name of CONFIG_NAMES) {
|
|
@@ -70,12 +72,12 @@ export async function loadConfig(root = process.cwd()) {
|
|
|
70
72
|
return {};
|
|
71
73
|
}
|
|
72
74
|
async function loadConfigFile(file) {
|
|
73
|
-
// Plain ESM (.mjs/.js)
|
|
75
|
+
// Plain ESM (.mjs/.js), import directly, no transform needed.
|
|
74
76
|
if (!/\.[mc]?ts$/.test(file)) {
|
|
75
77
|
const mod = await import(/* @vite-ignore */ pathToFileURL(file).href);
|
|
76
78
|
return (mod.default ?? mod);
|
|
77
79
|
}
|
|
78
|
-
// TypeScript
|
|
80
|
+
// TypeScript: bundle with esbuild, keeping bare specifiers external so
|
|
79
81
|
// `import { defineConfig } from '@fluixi/start'` and node builtins resolve from
|
|
80
82
|
// the app. Relative imports (shared constants, env helpers) ARE bundled in. The
|
|
81
83
|
// output is written to a temp `.mjs` beside the source so those externals resolve
|
package/dist/config.mjs
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
/*! @fluixi/start v0.1.0-alpha.
|
|
1
|
+
/*! @fluixi/start v0.1.0-alpha.75 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
|
|
3
3
|
// src/config.ts
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import { existsSync } from "node:fs";
|
|
6
6
|
import { writeFile, unlink } from "node:fs/promises";
|
|
7
7
|
import { resolve, isAbsolute } from "node:path";
|
|
8
|
+
|
|
9
|
+
// src/define-config.ts
|
|
8
10
|
function defineConfig(config) {
|
|
9
11
|
return config;
|
|
10
12
|
}
|
|
13
|
+
|
|
14
|
+
// src/config.ts
|
|
11
15
|
function resolveConfig(config = {}) {
|
|
12
16
|
const root = resolve(config.root ?? process.cwd());
|
|
13
17
|
return {
|
|
@@ -23,6 +27,8 @@ function resolveConfig(config = {}) {
|
|
|
23
27
|
middleware: config.middleware ?? "src/middleware.ts",
|
|
24
28
|
ssrNoExternal: config.ssrNoExternal ?? [],
|
|
25
29
|
resolve: config.resolve ?? [],
|
|
30
|
+
vitePlugin: config.vitePlugin ?? {},
|
|
31
|
+
plugins: config.plugins ?? [],
|
|
26
32
|
adapter: config.adapter,
|
|
27
33
|
i18n: resolveI18n(config.i18n),
|
|
28
34
|
prerender: resolvePrerender(config.prerender)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/define-config.ts
|
|
21
|
+
var define_config_exports = {};
|
|
22
|
+
__export(define_config_exports, {
|
|
23
|
+
defineConfig: () => defineConfig
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(define_config_exports);
|
|
26
|
+
function defineConfig(config) {
|
|
27
|
+
return config;
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
defineConfig
|
|
32
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `defineConfig`, alone, away from the loader.
|
|
3
|
+
*
|
|
4
|
+
* It is an identity function that exists for the types, and it belongs to the root
|
|
5
|
+
* export because a config file is the first thing an app writes. Keeping it here rather
|
|
6
|
+
* than in `config.ts` is what lets the root entry stay importable in a browser: that
|
|
7
|
+
* module reads the filesystem to find and load a config, and a single value imported
|
|
8
|
+
* from it drags `node:fs` into the client bundle.
|
|
9
|
+
*/
|
|
10
|
+
import type { FluixiConfig } from './config.js';
|
|
11
|
+
export declare function defineConfig(config: FluixiConfig): FluixiConfig;
|
|
12
|
+
//# sourceMappingURL=define-config.d.ts.map
|