@fluixi/start 0.1.0-alpha.74 → 0.1.0-alpha.76
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 +6 -4
- package/dist/adapter.d.ts +9 -9
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +13 -11
- package/dist/adapter.mjs +6 -4
- 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-23MJFSYL.mjs → api-LTOLCZPE.mjs} +2 -2
- package/dist/commands/{api-4IYNQRKG.mjs → api-PBT4QZ34.mjs} +1 -1
- package/dist/commands/build.cjs +14 -7
- package/dist/commands/build.js +6 -6
- package/dist/commands/build.mjs +14 -7
- package/dist/commands/{chunk-OCPCK4ZJ.mjs → chunk-JACRXSN7.mjs} +2 -2
- package/dist/commands/{chunk-NS5GR2GX.mjs → chunk-MTM6M3TC.mjs} +1 -1
- package/dist/commands/dev.cjs +17 -5
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +9 -4
- package/dist/commands/dev.mjs +18 -6
- package/dist/commands/index.cjs +21 -9
- package/dist/commands/index.d.ts +1 -1
- package/dist/commands/index.js +1 -1
- package/dist/commands/index.mjs +22 -10
- 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
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,CAA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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.76 | (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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-config.d.ts","sourceRoot":"","sources":["../src/define-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAE/D"}
|
package/dist/di.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/start v0.1.0-alpha.
|
|
1
|
+
/*! @fluixi/start v0.1.0-alpha.76 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/dist/di.d.ts
CHANGED
|
@@ -44,20 +44,20 @@ export declare class Injector {
|
|
|
44
44
|
export declare function inject<T>(token: Token<T>): T;
|
|
45
45
|
/**
|
|
46
46
|
* Provide services for the CURRENT component/route and its descendants (owner-scoped). The
|
|
47
|
-
* injector is disposed
|
|
47
|
+
* injector is disposed: running each service's `onDestroy()`, when the component unmounts.
|
|
48
48
|
*/
|
|
49
49
|
export declare function provide(providers: ReadonlyArray<Provider>): Injector;
|
|
50
50
|
/**
|
|
51
51
|
* Provide app-wide services. On the client these are singletons; during SSR each request gets
|
|
52
|
-
* its OWN instances (the root injector is per-request)
|
|
52
|
+
* its OWN instances (the root injector is per-request), so a stateful root service can never
|
|
53
53
|
* leak between concurrent requests. Call at module load (e.g. in entry-client / entry-server).
|
|
54
54
|
*/
|
|
55
55
|
export declare function provideRoot(providers: ReadonlyArray<Provider>): void;
|
|
56
56
|
/** Run `fn` with an explicit injector as the injection context (e.g. inside a server function). */
|
|
57
57
|
export declare function runInInjectionContext<R>(injector: Injector, fn: () => R): R;
|
|
58
|
-
/** The injector for the current scope (advanced
|
|
58
|
+
/** The injector for the current scope (advanced: for passing to runInInjectionContext later). */
|
|
59
59
|
export declare function getInjector(): Injector;
|
|
60
|
-
/** A standalone injector (parent defaults to the root)
|
|
60
|
+
/** A standalone injector (parent defaults to the root), for tests / manual hierarchies. */
|
|
61
61
|
export declare function createInjector(providers: ReadonlyArray<Provider>, parent?: Injector | null): Injector;
|
|
62
62
|
export {};
|
|
63
63
|
//# sourceMappingURL=di.d.ts.map
|
package/dist/di.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"di.d.ts","sourceRoot":"","sources":["../src/di.ts"],"names":[],"mappings":"AAiCA,MAAM,WAAW,KAAK,CAAC,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mGAAmG;IACnG,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC;CAC5B;AAED,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAEzF;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,GAAG,IACxB;IAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAAC,QAAQ,EAAE,CAAC,CAAA;CAAE,GACl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,CAErG"}
|
package/dist/di.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fluixi/start/di
|
|
2
|
+
* @fluixi/start/di: dependency injection, the Angular way, but SSR-correct and reactive.
|
|
3
3
|
*
|
|
4
4
|
* Three things make this distinct from Angular's DI:
|
|
5
5
|
*
|
|
6
6
|
* 1. **SSR request isolation, for free.** A "root" provider is a singleton on the CLIENT but
|
|
7
|
-
* a fresh instance PER REQUEST on the server
|
|
7
|
+
* a fresh instance PER REQUEST on the server, because the root injector lives in the
|
|
8
8
|
* per-request `RequestContext` (the same machinery that isolates resources/markers). So
|
|
9
9
|
* a stateful root service (a per-user cache, a DB unit-of-work) never leaks across two
|
|
10
10
|
* concurrent SSR requests. No zone, no `providedIn` ceremony, no manual request injectors.
|
|
11
11
|
*
|
|
12
12
|
* 2. **The reactive owner tree IS the injector hierarchy.** `provide()` in a component
|
|
13
13
|
* attaches a child injector to that component's reactive owner; descendants `inject()`
|
|
14
|
-
* by walking the owner chain
|
|
14
|
+
* by walking the owner chain: exactly how context resolves. Component-scoped services
|
|
15
15
|
* are disposed with the component (their `onDestroy()` runs on owner cleanup).
|
|
16
16
|
*
|
|
17
17
|
* 3. **Function injection, tree-shakable tokens.** No decorators/reflect-metadata. A token
|
|
@@ -119,7 +119,7 @@ const _reqInjectors = new WeakMap(); // per-request root (server)
|
|
|
119
119
|
const _ownerInjectors = new WeakMap(); // per reactive owner (component scope)
|
|
120
120
|
let _clientRoot = null;
|
|
121
121
|
let _explicit = null;
|
|
122
|
-
/** The root injector
|
|
122
|
+
/** The root injector: per-request during SSR (isolated), a module singleton on the client. */
|
|
123
123
|
function rootInjector() {
|
|
124
124
|
const ctx = getRequestContext();
|
|
125
125
|
if (ctx) {
|
|
@@ -130,7 +130,7 @@ function rootInjector() {
|
|
|
130
130
|
}
|
|
131
131
|
return (_clientRoot ??= new Injector(null).register(_rootProviders));
|
|
132
132
|
}
|
|
133
|
-
/** Nearest ancestor owner injector, else the root
|
|
133
|
+
/** Nearest ancestor owner injector, else the root, the parent of a new component injector. */
|
|
134
134
|
function parentInjectorOf(owner) {
|
|
135
135
|
let o = owner?.parent;
|
|
136
136
|
while (o) {
|
|
@@ -161,7 +161,7 @@ export function inject(token) {
|
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
163
|
* Provide services for the CURRENT component/route and its descendants (owner-scoped). The
|
|
164
|
-
* injector is disposed
|
|
164
|
+
* injector is disposed: running each service's `onDestroy()`, when the component unmounts.
|
|
165
165
|
*/
|
|
166
166
|
export function provide(providers) {
|
|
167
167
|
const owner = getOwner();
|
|
@@ -179,7 +179,7 @@ export function provide(providers) {
|
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* Provide app-wide services. On the client these are singletons; during SSR each request gets
|
|
182
|
-
* its OWN instances (the root injector is per-request)
|
|
182
|
+
* its OWN instances (the root injector is per-request), so a stateful root service can never
|
|
183
183
|
* leak between concurrent requests. Call at module load (e.g. in entry-client / entry-server).
|
|
184
184
|
*/
|
|
185
185
|
export function provideRoot(providers) {
|
|
@@ -200,11 +200,11 @@ export function runInInjectionContext(injector, fn) {
|
|
|
200
200
|
_explicit = prev;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
/** The injector for the current scope (advanced
|
|
203
|
+
/** The injector for the current scope (advanced: for passing to runInInjectionContext later). */
|
|
204
204
|
export function getInjector() {
|
|
205
205
|
return currentInjector();
|
|
206
206
|
}
|
|
207
|
-
/** A standalone injector (parent defaults to the root)
|
|
207
|
+
/** A standalone injector (parent defaults to the root), for tests / manual hierarchies. */
|
|
208
208
|
export function createInjector(providers, parent) {
|
|
209
209
|
return new Injector(parent === undefined ? rootInjector() : parent).register(providers);
|
|
210
210
|
}
|
package/dist/di.mjs
CHANGED
package/dist/document.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare function splitTemplate(template: string, mountId?: string): {
|
|
|
19
19
|
* Reference the files this route needs in the document that renders it.
|
|
20
20
|
*
|
|
21
21
|
* A lazily-imported route is its own chunk with its own stylesheet, mentioned nowhere
|
|
22
|
-
* in the shell
|
|
22
|
+
* in the shell: without these the browser discovers them when hydration runs the
|
|
23
23
|
* dynamic import, so the markup paints before the CSS arrives.
|
|
24
24
|
*
|
|
25
25
|
* Files already named in the template are skipped: the entry chunk is in there from
|
package/dist/document.js
CHANGED
|
@@ -57,7 +57,7 @@ export function splitTemplate(template, mountId = 'root') {
|
|
|
57
57
|
* Reference the files this route needs in the document that renders it.
|
|
58
58
|
*
|
|
59
59
|
* A lazily-imported route is its own chunk with its own stylesheet, mentioned nowhere
|
|
60
|
-
* in the shell
|
|
60
|
+
* in the shell: without these the browser discovers them when hydration runs the
|
|
61
61
|
* dynamic import, so the markup paints before the CSS arrives.
|
|
62
62
|
*
|
|
63
63
|
* Files already named in the template are skipped: the entry chunk is in there from
|
package/dist/generated-api.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/start v0.1.0-alpha.
|
|
1
|
+
/*! @fluixi/start v0.1.0-alpha.76 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/dist/generated-api.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Named `api-routes` because `@fluixi/start/api` is already the API plumbing you call
|
|
9
9
|
* directly (`createApiHandler`, `imageLoader`, …); this is the generated route table.
|
|
10
10
|
*
|
|
11
|
-
* A typed stand-in
|
|
11
|
+
* A typed stand-in: the scan plugin serves the real one. `virtual:fluixi-api` still
|
|
12
12
|
* resolves.
|
|
13
13
|
*/
|
|
14
14
|
function missingPlugin() {
|
package/dist/generated-api.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/start v0.1.0-alpha.
|
|
1
|
+
/*! @fluixi/start v0.1.0-alpha.76 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/dist/handler-core.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/start v0.1.0-alpha.
|
|
1
|
+
/*! @fluixi/start v0.1.0-alpha.76 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/dist/handler-core.d.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* The request handler, assembled from things already in memory.
|
|
3
3
|
*
|
|
4
4
|
* `createProdHandler` reads the template off disk and imports the server entry by
|
|
5
|
-
* path
|
|
5
|
+
* path: fine on Node, impossible in a worker, where there is no filesystem and
|
|
6
6
|
* every module has to be part of the bundle. So the assembly lives here and takes
|
|
7
7
|
* the template and the module as arguments; the platform entry a deploy adapter
|
|
8
8
|
* generates imports both statically and calls this.
|
|
9
9
|
*
|
|
10
10
|
* One assembly, so an edge deploy cannot quietly behave differently from `fluixi
|
|
11
|
-
* start
|
|
11
|
+
* start`: the dispatch order (server functions, then API routes, then render,
|
|
12
12
|
* all under middleware) is a property of the framework, not of the host.
|
|
13
13
|
*/
|
|
14
14
|
import type { ResolvedConfig } from './config.js';
|
package/dist/handler-core.js
CHANGED
|
@@ -8,7 +8,7 @@ export function createHandlerFrom({ template, mod, cfg, middleware, preload }) {
|
|
|
8
8
|
let core;
|
|
9
9
|
if (!cfg.ssr) {
|
|
10
10
|
// SPA: the page is the static shell; the client entry renders it. Server functions +
|
|
11
|
-
// middleware still run through this handler
|
|
11
|
+
// middleware still run through this handler: there's just no SSR render pass. The
|
|
12
12
|
// path is still known, though, and the route it names still loads its own chunk, so
|
|
13
13
|
// the shell can say so and save the client a round trip it would otherwise start
|
|
14
14
|
// only after the router had booted.
|
|
@@ -18,7 +18,7 @@ export function createHandlerFrom({ template, mod, cfg, middleware, preload }) {
|
|
|
18
18
|
core = async (request) => {
|
|
19
19
|
const url = new URL(request.url);
|
|
20
20
|
// Split per request rather than once: the preload links belong in the head, and
|
|
21
|
-
// the head is the part that flushes before the body is known
|
|
21
|
+
// the head is the part that flushes before the body is known, which is the whole
|
|
22
22
|
// reason streaming wants them, since the browser can start fetching the route's
|
|
23
23
|
// chunk while the server is still awaiting data for it.
|
|
24
24
|
const { head, tail } = splitTemplate(withPreload(template, url.pathname), cfg.mountId);
|
package/dist/handler-core.mjs
CHANGED
package/dist/handler.cjs
CHANGED
package/dist/handler.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type IncomingMessage, type ServerResponse, type Server } from 'node:htt
|
|
|
2
2
|
/**
|
|
3
3
|
* The runtime-neutral request layer. Everything renders through a Web
|
|
4
4
|
* `Request → Response` handler, so the same core works in Node, Bun, Deno, and
|
|
5
|
-
* edge/worker runtimes
|
|
5
|
+
* edge/worker runtimes: only the *bridge* (Node http here) is platform-specific.
|
|
6
6
|
* This is the seam deploy adapters plug into.
|
|
7
7
|
*/
|
|
8
8
|
/** Produce page HTML for a request URL (pathname + search). */
|
|
@@ -15,7 +15,7 @@ export type StreamRenderFn = (url: string, request: Request) => ReadableStream<U
|
|
|
15
15
|
* Compose a streamed HTML Response: flush `head` immediately (browser starts fetching
|
|
16
16
|
* assets while the server awaits data), then pipe the app `body` stream into the mount
|
|
17
17
|
* point, then `tail` (client script + closing tags). A render error after the head is
|
|
18
|
-
* flushed can only error the stream (status is already 200)
|
|
18
|
+
* flushed can only error the stream (status is already 200), truncated HTML; callers
|
|
19
19
|
* should guard the pre-flush path for a real 500.
|
|
20
20
|
*/
|
|
21
21
|
export declare function streamDocument(head: string, body: ReadableStream<Uint8Array>, tail: string): Response;
|
|
@@ -34,7 +34,7 @@ export interface ServeNodeOptions {
|
|
|
34
34
|
/** The reference **Node adapter**: serve a `FetchHandler` over `node:http`. */
|
|
35
35
|
export declare function serveNode(handler: FetchHandler, opts?: ServeNodeOptions): Server;
|
|
36
36
|
/**
|
|
37
|
-
* Wrap a handler to serve static files from `dir` first (for filesystem runtimes
|
|
37
|
+
* Wrap a handler to serve static files from `dir` first (for filesystem runtimes ,
|
|
38
38
|
* Node/Bun/Deno). Edge runtimes serve assets via the platform, so they use the bare
|
|
39
39
|
* handler instead.
|
|
40
40
|
*/
|
package/dist/handler.js
CHANGED
|
@@ -7,7 +7,7 @@ import { join, extname } from 'node:path';
|
|
|
7
7
|
* Compose a streamed HTML Response: flush `head` immediately (browser starts fetching
|
|
8
8
|
* assets while the server awaits data), then pipe the app `body` stream into the mount
|
|
9
9
|
* point, then `tail` (client script + closing tags). A render error after the head is
|
|
10
|
-
* flushed can only error the stream (status is already 200)
|
|
10
|
+
* flushed can only error the stream (status is already 200), truncated HTML; callers
|
|
11
11
|
* should guard the pre-flush path for a real 500.
|
|
12
12
|
*/
|
|
13
13
|
export function streamDocument(head, body, tail) {
|
|
@@ -70,7 +70,7 @@ export function nodeToRequest(req) {
|
|
|
70
70
|
const method = req.method ?? 'GET';
|
|
71
71
|
const init = { method, headers };
|
|
72
72
|
if (method !== 'GET' && method !== 'HEAD') {
|
|
73
|
-
init.body = req; // Node readable
|
|
73
|
+
init.body = req; // Node readable: fine for undici/Node fetch
|
|
74
74
|
init.duplex = 'half';
|
|
75
75
|
}
|
|
76
76
|
return new Request(url, init);
|
|
@@ -124,7 +124,7 @@ const MIME = {
|
|
|
124
124
|
'.ico': 'image/x-icon', '.woff': 'font/woff', '.woff2': 'font/woff2', '.map': 'application/json',
|
|
125
125
|
};
|
|
126
126
|
/**
|
|
127
|
-
* Wrap a handler to serve static files from `dir` first (for filesystem runtimes
|
|
127
|
+
* Wrap a handler to serve static files from `dir` first (for filesystem runtimes ,
|
|
128
128
|
* Node/Bun/Deno). Edge runtimes serve assets via the platform, so they use the bare
|
|
129
129
|
* handler instead.
|
|
130
130
|
*/
|
package/dist/handler.mjs
CHANGED
package/dist/head.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/start v0.1.0-alpha.
|
|
1
|
+
/*! @fluixi/start v0.1.0-alpha.76 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/dist/head.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@fluixi/start/head
|
|
2
|
+
* `@fluixi/start/head`: the app-facing SEO & document-head surface, re-exported from the
|
|
3
3
|
* framework-agnostic `@fluixi/head` engine. Importing from the meta-framework gives apps a single,
|
|
4
4
|
* stable dependency (like `@fluixi/start/router`) instead of reaching into the engine directly:
|
|
5
5
|
*
|
package/dist/head.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@fluixi/start/head
|
|
2
|
+
* `@fluixi/start/head`: the app-facing SEO & document-head surface, re-exported from the
|
|
3
3
|
* framework-agnostic `@fluixi/head` engine. Importing from the meta-framework gives apps a single,
|
|
4
4
|
* stable dependency (like `@fluixi/start/router`) instead of reaching into the engine directly:
|
|
5
5
|
*
|
package/dist/head.mjs
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
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/image-loader.ts
|
|
21
|
+
var image_loader_exports = {};
|
|
22
|
+
__export(image_loader_exports, {
|
|
23
|
+
imageLoader: () => imageLoader
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(image_loader_exports);
|
|
26
|
+
function imageLoader(options = {}) {
|
|
27
|
+
const path = options.path ?? "/api/image";
|
|
28
|
+
return ({ src, width, quality }) => {
|
|
29
|
+
const params = new URLSearchParams({ url: src, w: String(width) });
|
|
30
|
+
if (quality != null) params.set("q", String(quality));
|
|
31
|
+
return `${path}?${params.toString()}`;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
imageLoader
|
|
37
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The client half of the image support.
|
|
3
|
+
*
|
|
4
|
+
* `imageLoader` builds a URL; `createImageHandler` reads files and transforms them. Only
|
|
5
|
+
* the first belongs in a page, so it lives apart from the half that imports `node:fs`.
|
|
6
|
+
*/
|
|
7
|
+
export interface ImageLoaderOptions {
|
|
8
|
+
/** Path the image handler route is mounted at. Default `/api/image`. */
|
|
9
|
+
path?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A loader for `@fluixi-ui/image` that targets a `createImageHandler` route.
|
|
13
|
+
*
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { imageLoader } from '@fluixi/start';
|
|
16
|
+
* const loader = imageLoader({ path: '/api/image' });
|
|
17
|
+
* <Image src="/mug.jpg" loader={loader} widths={[120, 240, 480]} />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function imageLoader(options?: ImageLoaderOptions): (args: {
|
|
21
|
+
src: string;
|
|
22
|
+
width: number;
|
|
23
|
+
quality?: number;
|
|
24
|
+
}) => string;
|
|
25
|
+
//# sourceMappingURL=image-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-loader.d.ts","sourceRoot":"","sources":["../src/image-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,OAAO,GAAE,kBAAuB,GAC/B,CAAC,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,MAAM,CAOpE"}
|