@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
|
@@ -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.75 | (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,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AE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAQ3E;AAED,iGAAiG;AACjG,wBAAgB,WAAW,IAAI,QAAQ,CAEtC;AAED,2FAA2F;AAC3F,wBAAgB,cAAc,CAAC,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,QAAQ,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.75 | (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.75 | (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.75 | (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.75 | (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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A loader for `@fluixi-ui/image` that targets a `createImageHandler` route.
|
|
3
|
+
*
|
|
4
|
+
* ```tsx
|
|
5
|
+
* import { imageLoader } from '@fluixi/start';
|
|
6
|
+
* const loader = imageLoader({ path: '/api/image' });
|
|
7
|
+
* <Image src="/mug.jpg" loader={loader} widths={[120, 240, 480]} />
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export function imageLoader(options = {}) {
|
|
11
|
+
const path = options.path ?? '/api/image';
|
|
12
|
+
return ({ src, width, quality }) => {
|
|
13
|
+
const params = new URLSearchParams({ url: src, w: String(width) });
|
|
14
|
+
if (quality != null)
|
|
15
|
+
params.set('q', String(quality));
|
|
16
|
+
return `${path}?${params.toString()}`;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/image-loader.ts
|
|
2
|
+
function imageLoader(options = {}) {
|
|
3
|
+
const path = options.path ?? "/api/image";
|
|
4
|
+
return ({ src, width, quality }) => {
|
|
5
|
+
const params = new URLSearchParams({ url: src, w: String(width) });
|
|
6
|
+
if (quality != null) params.set("q", String(quality));
|
|
7
|
+
return `${path}?${params.toString()}`;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
imageLoader
|
|
12
|
+
};
|
package/dist/image.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/*! @fluixi/start v0.1.0-alpha.75 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
1
2
|
"use strict";
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -26,6 +27,18 @@ __export(image_exports, {
|
|
|
26
27
|
module.exports = __toCommonJS(image_exports);
|
|
27
28
|
var import_promises = require("node:fs/promises");
|
|
28
29
|
var import_node_path = require("node:path");
|
|
30
|
+
|
|
31
|
+
// src/image-loader.ts
|
|
32
|
+
function imageLoader(options = {}) {
|
|
33
|
+
const path = options.path ?? "/api/image";
|
|
34
|
+
return ({ src, width, quality }) => {
|
|
35
|
+
const params = new URLSearchParams({ url: src, w: String(width) });
|
|
36
|
+
if (quality != null) params.set("q", String(quality));
|
|
37
|
+
return `${path}?${params.toString()}`;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/image.ts
|
|
29
42
|
var DEFAULT_SIZES = [16, 32, 48, 64, 96, 128, 256, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840];
|
|
30
43
|
var MIME = {
|
|
31
44
|
".jpg": "image/jpeg",
|
|
@@ -131,14 +144,6 @@ function createImageHandler(options = {}) {
|
|
|
131
144
|
return imageResponse(body, contentType, maxAge);
|
|
132
145
|
};
|
|
133
146
|
}
|
|
134
|
-
function imageLoader(options = {}) {
|
|
135
|
-
const path = options.path ?? "/api/image";
|
|
136
|
-
return ({ src, width, quality }) => {
|
|
137
|
-
const params = new URLSearchParams({ url: src, w: String(width) });
|
|
138
|
-
if (quality != null) params.set("q", String(quality));
|
|
139
|
-
return `${path}?${params.toString()}`;
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
147
|
// Annotate the CommonJS export names for ESM import in node:
|
|
143
148
|
0 && (module.exports = {
|
|
144
149
|
createImageHandler,
|
package/dist/image.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export interface ImageHandlerOptions {
|
|
|
35
35
|
*
|
|
36
36
|
* ```ts
|
|
37
37
|
* // src/api/image.ts
|
|
38
|
-
* import { createImageHandler } from '@fluixi/start';
|
|
38
|
+
* import { createImageHandler } from '@fluixi/start/image';
|
|
39
39
|
* export const GET = createImageHandler({ root: 'public', domains: ['cdn.example.com'] });
|
|
40
40
|
* ```
|
|
41
41
|
*
|
|
@@ -43,22 +43,5 @@ export interface ImageHandlerOptions {
|
|
|
43
43
|
* through unchanged (so it's safe to ship either way).
|
|
44
44
|
*/
|
|
45
45
|
export declare function createImageHandler(options?: ImageHandlerOptions): (request: Request) => Promise<Response>;
|
|
46
|
-
export
|
|
47
|
-
/** Path the {@link createImageHandler} route is mounted at. Default `/api/image`. */
|
|
48
|
-
path?: string;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* A loader for `@fluixi-ui/image` that targets a {@link createImageHandler} route.
|
|
52
|
-
*
|
|
53
|
-
* ```tsx
|
|
54
|
-
* import { imageLoader } from '@fluixi/start';
|
|
55
|
-
* const loader = imageLoader({ path: '/api/image' });
|
|
56
|
-
* <Image src="/mug.jpg" loader={loader} widths={[120, 240, 480]} />
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
export declare function imageLoader(options?: ImageLoaderOptions): (args: {
|
|
60
|
-
src: string;
|
|
61
|
-
width: number;
|
|
62
|
-
quality?: number;
|
|
63
|
-
}) => string;
|
|
46
|
+
export { imageLoader, type ImageLoaderOptions } from './image-loader.js';
|
|
64
47
|
//# sourceMappingURL=image.d.ts.map
|
package/dist/image.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,kBAAkB;IACjC,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,UAAU,CAAC;IACtD,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,sFAAsF;AACtF,MAAM,MAAM,cAAc,GAAG,CAC3B,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,kBAAkB,KACrB,OAAO,CAAC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAAC;AAE/D,MAAM,WAAW,mBAAmB;IAClC,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,SAAS,CAAC,E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CAAC,OAAO,GAAE,mBAAwB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAoE7G;AAGD,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/image.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// On-demand image optimization: a Web `Request` → `Response` handler that resizes
|
|
2
2
|
// and re-encodes images (to AVIF/WebP by content negotiation), plus a matching
|
|
3
|
-
// `imageLoader` for `@fluixi-ui/image`. The actual codec is pluggable
|
|
3
|
+
// `imageLoader` for `@fluixi-ui/image`. The actual codec is pluggable, the
|
|
4
4
|
// default uses `sharp` if it's installed, otherwise it streams the source through
|
|
5
5
|
// unchanged (so the framework never hard-depends on a native module).
|
|
6
6
|
import { readFile } from 'node:fs/promises';
|
|
@@ -52,7 +52,7 @@ function imageResponse(body, contentType, maxAge) {
|
|
|
52
52
|
*
|
|
53
53
|
* ```ts
|
|
54
54
|
* // src/api/image.ts
|
|
55
|
-
* import { createImageHandler } from '@fluixi/start';
|
|
55
|
+
* import { createImageHandler } from '@fluixi/start/image';
|
|
56
56
|
* export const GET = createImageHandler({ root: 'public', domains: ['cdn.example.com'] });
|
|
57
57
|
* ```
|
|
58
58
|
*
|
|
@@ -113,7 +113,7 @@ export function createImageHandler(options = {}) {
|
|
|
113
113
|
}
|
|
114
114
|
sourceType = MIME[extname(filePath).toLowerCase()] ?? 'application/octet-stream';
|
|
115
115
|
}
|
|
116
|
-
// Vector / animated sources aren't rasterized
|
|
116
|
+
// Vector / animated sources aren't rasterized, stream them through.
|
|
117
117
|
if (sourceType === 'image/svg+xml' || sourceType === 'image/gif') {
|
|
118
118
|
return imageResponse(input, sourceType, maxAge);
|
|
119
119
|
}
|
|
@@ -134,21 +134,5 @@ export function createImageHandler(options = {}) {
|
|
|
134
134
|
return imageResponse(body, contentType, maxAge);
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
*
|
|
140
|
-
* ```tsx
|
|
141
|
-
* import { imageLoader } from '@fluixi/start';
|
|
142
|
-
* const loader = imageLoader({ path: '/api/image' });
|
|
143
|
-
* <Image src="/mug.jpg" loader={loader} widths={[120, 240, 480]} />
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
export function imageLoader(options = {}) {
|
|
147
|
-
const path = options.path ?? '/api/image';
|
|
148
|
-
return ({ src, width, quality }) => {
|
|
149
|
-
const params = new URLSearchParams({ url: src, w: String(width) });
|
|
150
|
-
if (quality != null)
|
|
151
|
-
params.set('q', String(quality));
|
|
152
|
-
return `${path}?${params.toString()}`;
|
|
153
|
-
};
|
|
154
|
-
}
|
|
137
|
+
// The loader lives apart, so a page can import it without this module's `node:fs`.
|
|
138
|
+
export { imageLoader } from './image-loader.js';
|
package/dist/image.mjs
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
/*! @fluixi/start v0.1.0-alpha.75 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
|
+
|
|
1
3
|
// src/image.ts
|
|
2
4
|
import { readFile } from "node:fs/promises";
|
|
3
5
|
import { resolve as resolvePath, join, extname, sep } from "node:path";
|
|
6
|
+
|
|
7
|
+
// src/image-loader.ts
|
|
8
|
+
function imageLoader(options = {}) {
|
|
9
|
+
const path = options.path ?? "/api/image";
|
|
10
|
+
return ({ src, width, quality }) => {
|
|
11
|
+
const params = new URLSearchParams({ url: src, w: String(width) });
|
|
12
|
+
if (quality != null) params.set("q", String(quality));
|
|
13
|
+
return `${path}?${params.toString()}`;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// src/image.ts
|
|
4
18
|
var DEFAULT_SIZES = [16, 32, 48, 64, 96, 128, 256, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840];
|
|
5
19
|
var MIME = {
|
|
6
20
|
".jpg": "image/jpeg",
|
|
@@ -106,14 +120,6 @@ function createImageHandler(options = {}) {
|
|
|
106
120
|
return imageResponse(body, contentType, maxAge);
|
|
107
121
|
};
|
|
108
122
|
}
|
|
109
|
-
function imageLoader(options = {}) {
|
|
110
|
-
const path = options.path ?? "/api/image";
|
|
111
|
-
return ({ src, width, quality }) => {
|
|
112
|
-
const params = new URLSearchParams({ url: src, w: String(width) });
|
|
113
|
-
if (quality != null) params.set("q", String(quality));
|
|
114
|
-
return `${path}?${params.toString()}`;
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
123
|
export {
|
|
118
124
|
createImageHandler,
|
|
119
125
|
imageLoader
|