@teyik0/furin 0.2.0-alpha.4 → 0.2.0-alpha.5
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/bun.d.ts +17 -1
- package/dist/adapter/package.d.ts +26 -0
- package/dist/build/client.d.ts +1 -1
- package/dist/build/compile-entry.d.ts +3 -3
- package/dist/build/compile-entry.ts +88 -83
- package/dist/build/entry-template.d.ts +35 -9
- package/dist/build/entry-template.ts +106 -56
- package/dist/build/hydrate.d.ts +1 -1
- package/dist/build/index.js +643 -247
- package/dist/build/scan-server.d.ts +10 -4
- package/dist/build/server-routes-entry.d.ts +3 -3
- package/dist/build/server-routes-entry.ts +5 -11
- package/dist/build/ssg-cache.d.ts +1 -1
- package/dist/build/types.d.ts +36 -1
- package/dist/cli/config.d.ts +6 -1
- package/dist/cli/index.js +662 -260
- package/dist/config.d.ts +11 -2
- package/dist/config.js +5 -1
- package/dist/furin.d.ts +36 -18
- package/dist/furin.js +630 -310
- package/dist/server/auto-invalidate/registry.d.ts +8 -1
- package/dist/server/cache/dev-loader.d.ts +3 -2
- package/dist/server/cache/invalidation.d.ts +19 -0
- package/dist/server/cache/isr.d.ts +6 -2
- package/dist/server/cache/registry.d.ts +3 -3
- package/dist/server/cache/ssg.d.ts +6 -2
- package/dist/server/cache/store-view.d.ts +11 -0
- package/dist/server/instance.d.ts +86 -0
- package/dist/server/internal.d.ts +16 -1
- package/dist/server/internal.js +72 -5
- package/dist/server/render/template.d.ts +3 -2
- package/dist/server/sync/config.d.ts +11 -0
- package/dist/server/sync/stream.d.ts +8 -1
- package/dist/shared/prefix.d.ts +15 -0
- package/package.json +6 -1
- package/src/adapter/bun.ts +113 -50
- package/src/adapter/package.ts +206 -0
- package/src/build/client.ts +9 -3
- package/src/build/compile-entry.ts +88 -83
- package/src/build/entry-template.ts +106 -56
- package/src/build/hydrate.ts +4 -2
- package/src/build/index.ts +99 -28
- package/src/build/scan-server.ts +23 -7
- package/src/build/server-routes-entry.ts +5 -11
- package/src/build/ssg-cache.ts +6 -2
- package/src/build/types.ts +37 -1
- package/src/cli/config.ts +9 -3
- package/src/cli/index.ts +21 -3
- package/src/config.ts +14 -1
- package/src/furin.ts +297 -143
- package/src/server/auto-invalidate/registry.ts +23 -1
- package/src/server/auto-invalidate/runtime.ts +29 -4
- package/src/server/cache/dev-loader.ts +77 -38
- package/src/server/cache/invalidation.ts +71 -30
- package/src/server/cache/isr.ts +20 -5
- package/src/server/cache/registry.ts +17 -20
- package/src/server/cache/ssg.ts +19 -4
- package/src/server/cache/store-view.ts +30 -0
- package/src/server/instance.ts +252 -0
- package/src/server/internal.ts +100 -5
- package/src/server/render/not-found.ts +9 -3
- package/src/server/render/ssr.ts +16 -4
- package/src/server/render/template.ts +57 -24
- package/src/server/sync/config.ts +32 -1
- package/src/server/sync/plugin.ts +4 -5
- package/src/server/sync/stream.ts +19 -9
- package/src/shared/prefix.ts +38 -0
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BunPlugin } from "bun";
|
|
2
|
-
export declare const BUILD_TARGETS: readonly ["bun", "node", "vercel", "cloudflare", "static"];
|
|
2
|
+
export declare const BUILD_TARGETS: readonly ["bun", "node", "vercel", "cloudflare", "static", "package"];
|
|
3
3
|
export type BuildTarget = (typeof BUILD_TARGETS)[number];
|
|
4
4
|
/**
|
|
5
5
|
* Configuration for the `static` build target.
|
|
@@ -29,6 +29,15 @@ export interface StaticExportConfig {
|
|
|
29
29
|
export declare const configSchema: import("@sinclair/typebox").TObject<{
|
|
30
30
|
rootDir: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
31
31
|
pagesDir: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
32
|
+
/**
|
|
33
|
+
* Multi-instance builds: one entry per mounted furin app. Overrides
|
|
34
|
+
* `pagesDir` and server-entry auto-detection. `prefix` must match the
|
|
35
|
+
* `furin({ prefix })` the app is mounted with (`""`/absent = root).
|
|
36
|
+
*/
|
|
37
|
+
apps: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
38
|
+
pagesDir: import("@sinclair/typebox").TString;
|
|
39
|
+
prefix: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
40
|
+
}>>>;
|
|
32
41
|
serverEntry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
33
42
|
/**
|
|
34
43
|
* Initialize the browser HTTP log drain in the hydration entry. Off by
|
|
@@ -37,7 +46,7 @@ export declare const configSchema: import("@sinclair/typebox").TObject<{
|
|
|
37
46
|
* via the `furin({ logger })` plugin option).
|
|
38
47
|
*/
|
|
39
48
|
clientLogging: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
40
|
-
targets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"bun" | "node" | "vercel" | "cloudflare" | "static">[]>>>;
|
|
49
|
+
targets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"bun" | "node" | "vercel" | "cloudflare" | "static" | "package">[]>>>;
|
|
41
50
|
bun: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
42
51
|
compile: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"server">, import("@sinclair/typebox").TLiteral<"embed">]>>;
|
|
43
52
|
}>>;
|
package/dist/config.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/config.ts
|
|
3
3
|
import { t } from "elysia";
|
|
4
|
-
var BUILD_TARGETS = ["bun", "node", "vercel", "cloudflare", "static"];
|
|
4
|
+
var BUILD_TARGETS = ["bun", "node", "vercel", "cloudflare", "static", "package"];
|
|
5
5
|
var buildTargetSchema = t.Union(BUILD_TARGETS.map((v) => t.Literal(v)));
|
|
6
6
|
var compileTargetSchema = t.Union([t.Literal("server"), t.Literal("embed")]);
|
|
7
7
|
var configSchema = t.Object({
|
|
8
8
|
rootDir: t.Optional(t.String()),
|
|
9
9
|
pagesDir: t.Optional(t.String()),
|
|
10
|
+
apps: t.Optional(t.Array(t.Object({
|
|
11
|
+
pagesDir: t.String(),
|
|
12
|
+
prefix: t.Optional(t.String())
|
|
13
|
+
}))),
|
|
10
14
|
serverEntry: t.Optional(t.String()),
|
|
11
15
|
clientLogging: t.Optional(t.Boolean()),
|
|
12
16
|
targets: t.Optional(t.Array(buildTargetSchema)),
|
package/dist/furin.d.ts
CHANGED
|
@@ -4,23 +4,16 @@ import { type FurinSyncOption } from "./server/sync/index.ts";
|
|
|
4
4
|
export interface FurinCacheTags {
|
|
5
5
|
}
|
|
6
6
|
export type CacheTag = keyof FurinCacheTags extends never ? string : keyof FurinCacheTags;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* .use(await furin({ ... }))
|
|
18
|
-
* .listen(3000)
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare function furin({ pagesDir, logger, clientLogging, sync, }: {
|
|
22
|
-
pagesDir?: string;
|
|
23
|
-
logger?: EvlogElysiaOptions;
|
|
7
|
+
export { clientDirNameForPrefix } from "./shared/prefix.ts";
|
|
8
|
+
/** Options for the {@link furin} plugin. */
|
|
9
|
+
export interface FurinOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Production only: explicit directory holding this app's built client
|
|
12
|
+
* assets (chunks + index.html template). Packaged furin apps pass their own
|
|
13
|
+
* `dist/furin/client` here; when omitted the directory is auto-resolved
|
|
14
|
+
* next to the server artifact.
|
|
15
|
+
*/
|
|
16
|
+
clientDir?: string;
|
|
24
17
|
/**
|
|
25
18
|
* Initialize the browser HTTP log drain in the hydration entry. Off by
|
|
26
19
|
* default — enabling it adds `evlog/http` drain setup and points browser
|
|
@@ -28,13 +21,38 @@ export declare function furin({ pagesDir, logger, clientLogging, sync, }: {
|
|
|
28
21
|
* and unaffected.
|
|
29
22
|
*/
|
|
30
23
|
clientLogging?: boolean;
|
|
24
|
+
logger?: EvlogElysiaOptions;
|
|
25
|
+
pagesDir?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Mount prefix for this app, e.g. `"/admin"`. All pages, framework
|
|
28
|
+
* endpoints (`/_furin/*`) and client assets (`/_client/*`) are served under
|
|
29
|
+
* it, and the client bundle is built with the matching basePath. Defaults
|
|
30
|
+
* to `""` (root). Mounting two furin instances on the same prefix throws.
|
|
31
|
+
*/
|
|
32
|
+
prefix?: string;
|
|
31
33
|
/**
|
|
32
34
|
* Enables Furin's built-in sync event stream. The opinionated default mounts
|
|
33
35
|
* Server-Sent Events at `/_furin/sync`; pass an object only for constrained
|
|
34
36
|
* reverse-proxy deployments that need a custom internal path.
|
|
35
37
|
*/
|
|
36
38
|
sync?: FurinSyncOption;
|
|
37
|
-
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Main Furin plugin.
|
|
42
|
+
*
|
|
43
|
+
* Returns a standalone Elysia instance (async function) so that routes are
|
|
44
|
+
* properly registered in Elysia's router for SPA navigation to work.
|
|
45
|
+
*
|
|
46
|
+
* ## Usage
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* new Elysia()
|
|
50
|
+
* .use(await furin({ pagesDir: "./src/pages" }))
|
|
51
|
+
* .use(await furin({ pagesDir: "./src/admin", prefix: "/admin" }))
|
|
52
|
+
* .listen(3000)
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function furin({ pagesDir, prefix: rawPrefix, clientDir: explicitClientDir, logger, clientLogging, sync, }?: FurinOptions): Promise<Elysia<"", {
|
|
38
56
|
decorator: {};
|
|
39
57
|
store: {};
|
|
40
58
|
derive: {};
|