@junejs/server 0.1.3 → 0.2.1
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/assets/icon-latin.LICENSE.txt +92 -0
- package/assets/icon-latin.ttf +0 -0
- package/dist/adapter-D0UnYBuN.d.ts +64 -0
- package/dist/adapter.d.ts +2 -56
- package/dist/adapter.js +107 -6
- package/dist/agent-compile.d.ts +38 -0
- package/dist/agent-compile.js +145 -0
- package/dist/agent-discover.d.ts +4 -4
- package/dist/agent-discover.js +30 -44
- package/dist/agent-durable.d.ts +94 -19
- package/dist/agent-durable.js +647 -32
- package/dist/agent-native.d.ts +44 -13
- package/dist/agent-native.js +264 -27
- package/dist/app.d.ts +5 -5
- package/dist/app.js +42 -10
- package/dist/assets.d.ts +23 -0
- package/dist/assets.js +123 -0
- package/dist/blob.d.ts +4 -5
- package/dist/build.d.ts +8 -30
- package/dist/build.js +143 -298
- package/dist/client-bundle.d.ts +8 -9
- package/dist/client-bundle.js +1 -1
- package/dist/config-freeze-r5p-vTWv.d.ts +17 -0
- package/dist/config-freeze.d.ts +2 -0
- package/dist/config-freeze.js +54 -0
- package/dist/config-loader.d.ts +3 -4
- package/dist/connection-auth.d.ts +38 -0
- package/dist/connection-auth.js +31 -0
- package/dist/content-freeze-CyiW2fRK.d.ts +4 -0
- package/dist/content-freeze.d.ts +2 -0
- package/dist/content-freeze.js +83 -0
- package/dist/content.d.ts +22 -9
- package/dist/content.js +43 -3
- package/dist/core-version.d.ts +4 -0
- package/dist/core-version.js +12 -0
- package/dist/css-modules-ambient.d.ts +2 -1
- package/dist/css-modules.d.ts +10 -11
- package/dist/css.d.ts +9 -10
- package/dist/d1-migrate.d.ts +6 -7
- package/dist/d1-migrate.js +3 -2
- package/dist/db.d.ts +2 -2
- package/dist/deploy.d.ts +3 -4
- package/dist/deploy.js +3 -2
- package/dist/dev-reload.d.ts +3 -4
- package/dist/dev.d.ts +8 -5
- package/dist/dev.js +40 -9
- package/dist/favicon.d.ts +37 -0
- package/dist/favicon.js +248 -0
- package/dist/host.d.ts +6 -5
- package/dist/host.js +2 -1
- package/dist/icon-letter.d.ts +3 -0
- package/dist/icon-letter.js +8 -0
- package/dist/index.d.ts +11 -5
- package/dist/index.js +9 -3
- package/dist/instrumentation.d.ts +2 -3
- package/dist/instrumentation.js +2 -1
- package/dist/island-registry.d.ts +6 -7
- package/dist/isolate-local.d.ts +5 -0
- package/dist/isolate-local.js +12 -0
- package/dist/kv.d.ts +3 -4
- package/dist/llms-links.d.ts +9 -0
- package/dist/llms-links.js +65 -0
- package/dist/manifest-CwTT1zVs.d.ts +11 -0
- package/dist/manifest.d.ts +2 -0
- package/dist/manifest.js +113 -0
- package/dist/negotiate.d.ts +4 -3
- package/dist/negotiate.js +24 -14
- package/dist/{pipeline-CCp9idQ4.d.ts → pipeline-BHUjBO0G.d.ts} +13 -1
- package/dist/pipeline.d.ts +2 -2
- package/dist/pipeline.js +286 -35
- package/dist/resources.d.ts +5 -6
- package/dist/route-rank.d.ts +6 -7
- package/dist/route-scan-BMbBzPIB.d.ts +20 -0
- package/dist/route-scan.d.ts +2 -0
- package/dist/route-scan.js +100 -0
- package/dist/router.d.ts +12 -13
- package/dist/router.js +51 -38
- package/dist/rsc-build.d.ts +6 -7
- package/dist/rsc-bundle.d.ts +6 -7
- package/dist/rsc-manifest.d.ts +5 -6
- package/dist/rsc-runtime/flight-render-routes.d.ts +3 -4
- package/dist/rsc-runtime/flight-render.d.ts +2 -3
- package/dist/rsc-runtime/flight-to-html.d.ts +2 -3
- package/dist/rsc-runtime/flight-to-html.js +3 -2
- package/dist/rsc-runtime/rsc-worker.js +11 -8
- package/dist/rsc-runtime/rsdw-shims.d.ts +2 -1
- package/dist/segment.d.ts +4 -5
- package/dist/sqlite-driver.d.ts +11 -11
- package/dist/sqlite-driver.js +17 -4
- package/dist/static-files.d.ts +4 -5
- package/dist/tsconfig-jsx.d.ts +4 -4
- package/dist/tsconfig-jsx.js +1 -1
- package/dist/turn-events.d.ts +4 -0
- package/dist/turn-events.js +46 -0
- package/dist/web-manifest.d.ts +5 -0
- package/dist/web-manifest.js +42 -0
- package/dist/worker-2qbQjj2c.d.ts +64 -0
- package/dist/worker.d.ts +2 -57
- package/dist/worker.js +69 -27
- package/package.json +28 -9
- package/src/adapter.ts +149 -4
- package/src/agent-compile.ts +271 -0
- package/src/agent-discover.ts +77 -63
- package/src/agent-durable.ts +998 -30
- package/src/agent-native.ts +370 -35
- package/src/app.ts +75 -6
- package/src/assets.ts +200 -0
- package/src/build.ts +241 -449
- package/src/config-freeze.ts +109 -0
- package/src/connection-auth.ts +101 -0
- package/src/content-freeze.ts +151 -0
- package/src/content.ts +55 -4
- package/src/core-version.ts +34 -0
- package/src/dev.ts +41 -8
- package/src/favicon.ts +325 -0
- package/src/host.ts +4 -3
- package/src/icon-letter.ts +14 -0
- package/src/index.ts +22 -0
- package/src/isolate-local.ts +33 -0
- package/src/llms-links.ts +96 -0
- package/src/manifest.ts +130 -0
- package/src/negotiate.ts +39 -15
- package/src/pipeline.ts +494 -44
- package/src/route-scan.ts +161 -0
- package/src/router.ts +66 -54
- package/src/rsc-runtime/rsc-worker.tsx +5 -4
- package/src/sqlite-driver.ts +36 -6
- package/src/tsconfig-jsx.ts +2 -2
- package/src/turn-events.ts +43 -0
- package/src/web-manifest.ts +38 -0
- package/src/worker.ts +131 -35
package/dist/router.d.ts
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
//#region src/router.d.ts
|
|
2
|
-
type RouteMatch = {
|
|
2
|
+
export type RouteMatch = {
|
|
3
3
|
file: string;
|
|
4
4
|
params: Record<string, string>;
|
|
5
5
|
};
|
|
6
|
-
type SegmentMatch = {
|
|
6
|
+
export type SegmentMatch = {
|
|
7
7
|
dir: string;
|
|
8
8
|
layout?: string;
|
|
9
9
|
loading?: string;
|
|
10
10
|
error?: string;
|
|
11
11
|
notFound?: string;
|
|
12
12
|
};
|
|
13
|
-
type RouteTreeMatch = {
|
|
13
|
+
export type RouteTreeMatch = {
|
|
14
14
|
file: string;
|
|
15
15
|
params: Record<string, string>;
|
|
16
16
|
segments: SegmentMatch[];
|
|
17
17
|
};
|
|
18
|
-
declare function findMiddlewareFile(appDir: string): string | null;
|
|
19
|
-
type MatchOptions = {
|
|
18
|
+
export declare function findMiddlewareFile(appDir: string): string | null;
|
|
19
|
+
export type MatchOptions = {
|
|
20
20
|
pageConvention?: boolean;
|
|
21
21
|
};
|
|
22
|
-
declare function isResourceFile(file: string): boolean;
|
|
23
|
-
declare function matchRouteTree(appDir: string, pathname: string, options?: MatchOptions): Promise<RouteTreeMatch | null>;
|
|
24
|
-
declare function resolveNotFound(appDir: string, pathname: string): Promise<{
|
|
22
|
+
export declare function isResourceFile(file: string): boolean;
|
|
23
|
+
export declare function matchRouteTree(appDir: string, pathname: string, options?: MatchOptions): Promise<RouteTreeMatch | null>;
|
|
24
|
+
export declare function resolveNotFound(appDir: string, pathname: string): Promise<{
|
|
25
25
|
segments: SegmentMatch[];
|
|
26
26
|
notFound?: string;
|
|
27
27
|
}>;
|
|
28
|
-
declare function routeFiles(appDir: string, options?: MatchOptions): Promise<string[]>;
|
|
29
|
-
declare function listRoutes(appDir: string, options?: MatchOptions): Promise<string[]>;
|
|
30
|
-
declare function matchRoute(appDir: string, pathname: string, options?: MatchOptions): Promise<RouteMatch | null>;
|
|
31
|
-
//#endregion
|
|
32
|
-
export { MatchOptions, RouteMatch, RouteTreeMatch, SegmentMatch, findMiddlewareFile, isResourceFile, listRoutes, matchRoute, matchRouteTree, resolveNotFound, routeFiles };
|
|
28
|
+
export declare function routeFiles(appDir: string, options?: MatchOptions): Promise<string[]>;
|
|
29
|
+
export declare function listRoutes(appDir: string, options?: MatchOptions): Promise<string[]>;
|
|
30
|
+
export declare function matchRoute(appDir: string, pathname: string, options?: MatchOptions): Promise<RouteMatch | null>;
|
|
31
|
+
//#endregion
|
package/dist/router.js
CHANGED
|
@@ -85,63 +85,76 @@ function routePath(appDir, file) {
|
|
|
85
85
|
}
|
|
86
86
|
async function matchRouteTree(appDir, pathname, options = {}) {
|
|
87
87
|
const urlSegments = pathname.split("/").filter(Boolean).map(decodeURIComponent);
|
|
88
|
-
async function
|
|
88
|
+
async function levelAt(dir, chain) {
|
|
89
89
|
const entries = (await listDir(dir)).sort((a, b) => compareSegments(a.name, b.name));
|
|
90
90
|
const segments = [...chain, segmentAt(dir, entries)];
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
const levels = [{
|
|
92
|
+
dir,
|
|
93
|
+
entries,
|
|
94
|
+
segments
|
|
95
|
+
}];
|
|
96
|
+
for (const e of entries) if (e.dir && isRouteGroup(e.name)) levels.push(...await levelAt(join(dir, e.name), segments));
|
|
97
|
+
return levels;
|
|
98
|
+
}
|
|
99
|
+
async function descend(nodes, rest, params) {
|
|
100
|
+
const levels = (await Promise.all(nodes.map((n) => levelAt(n.dir, n.chain)))).flat();
|
|
101
|
+
if (rest.length === 0) for (const base of [["page", "index"], ["route"]]) for (const { dir: d, entries, segments } of levels) {
|
|
102
|
+
const file = base.map((b) => fileFor(entries, d, b)).find(Boolean);
|
|
103
|
+
if (file) return {
|
|
104
|
+
file,
|
|
95
105
|
params,
|
|
96
106
|
segments
|
|
97
107
|
};
|
|
98
|
-
} else if (!options.pageConvention) {
|
|
99
|
-
if (rest.length === 1) {
|
|
100
|
-
const leaf = fileFor(entries, dir, rest[0]);
|
|
101
|
-
if (leaf && !isSpecialFile(leaf) && !isPageFile(leaf)) return {
|
|
102
|
-
file: leaf,
|
|
103
|
-
params,
|
|
104
|
-
segments
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
108
|
}
|
|
108
|
-
for (const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
else if (!options.pageConvention && rest.length === 1) for (const { dir: d, entries, segments } of levels) {
|
|
110
|
+
const leaf = fileFor(entries, d, rest[0]);
|
|
111
|
+
if (leaf && !isSpecialFile(leaf) && !isPageFile(leaf)) return {
|
|
112
|
+
file: leaf,
|
|
113
|
+
params,
|
|
114
|
+
segments
|
|
115
|
+
};
|
|
112
116
|
}
|
|
117
|
+
const children = /* @__PURE__ */ new Map();
|
|
118
|
+
for (const lv of levels) for (const e of lv.entries) {
|
|
119
|
+
if (!e.dir || isRouteGroup(e.name)) continue;
|
|
120
|
+
const node = {
|
|
121
|
+
dir: join(lv.dir, e.name),
|
|
122
|
+
chain: lv.segments
|
|
123
|
+
};
|
|
124
|
+
const same = children.get(e.name);
|
|
125
|
+
if (same) same.push(node);
|
|
126
|
+
else children.set(e.name, [node]);
|
|
127
|
+
}
|
|
128
|
+
const names = [...children.keys()].sort(compareSegments);
|
|
113
129
|
if (rest.length === 0) {
|
|
114
|
-
for (const
|
|
115
|
-
if (!
|
|
116
|
-
const hit = await descend(
|
|
130
|
+
for (const name of names) {
|
|
131
|
+
if (!(isOptionalDir(name) || isOptionalCatchAllDir(name))) continue;
|
|
132
|
+
const hit = await descend(children.get(name), [], params);
|
|
117
133
|
if (hit) return hit;
|
|
118
134
|
}
|
|
119
135
|
return null;
|
|
120
136
|
}
|
|
121
137
|
const [head, ...tail] = rest;
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
for (const e of entries) {
|
|
127
|
-
if (!e.dir || !(isParamDir(e.name) || isOptionalDir(e.name))) continue;
|
|
128
|
-
const hit = await descend(join(dir, e.name), tail, {
|
|
138
|
+
for (const name of names) {
|
|
139
|
+
const into = children.get(name);
|
|
140
|
+
let hit = null;
|
|
141
|
+
if (isParamDir(name) || isOptionalDir(name)) hit = await descend(into, tail, {
|
|
129
142
|
...params,
|
|
130
|
-
[paramName(
|
|
131
|
-
}
|
|
132
|
-
if (
|
|
133
|
-
}
|
|
134
|
-
for (const e of entries) {
|
|
135
|
-
if (!e.dir || !(isCatchAllDir(e.name) || isOptionalCatchAllDir(e.name))) continue;
|
|
136
|
-
const hit = await descend(join(dir, e.name), [], {
|
|
143
|
+
[paramName(name)]: head
|
|
144
|
+
});
|
|
145
|
+
else if (isCatchAllDir(name) || isOptionalCatchAllDir(name)) hit = await descend(into, [], {
|
|
137
146
|
...params,
|
|
138
|
-
[paramName(
|
|
139
|
-
}
|
|
147
|
+
[paramName(name)]: rest.join("/")
|
|
148
|
+
});
|
|
149
|
+
else if (name === head) hit = await descend(into, tail, params);
|
|
140
150
|
if (hit) return hit;
|
|
141
151
|
}
|
|
142
152
|
return null;
|
|
143
153
|
}
|
|
144
|
-
return descend(
|
|
154
|
+
return descend([{
|
|
155
|
+
dir: appDir,
|
|
156
|
+
chain: []
|
|
157
|
+
}], urlSegments, {});
|
|
145
158
|
}
|
|
146
159
|
async function resolveNotFound(appDir, pathname) {
|
|
147
160
|
const urlSegments = pathname.split("/").filter(Boolean).map(decodeURIComponent);
|
package/dist/rsc-build.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { DocumentConfig } from "@junejs/core/document";
|
|
2
2
|
//#region src/rsc-build.d.ts
|
|
3
|
-
type RscRoute = {
|
|
3
|
+
export type RscRoute = {
|
|
4
4
|
path: string;
|
|
5
5
|
file: string;
|
|
6
6
|
};
|
|
7
|
-
declare function findRscRoutes(appDir: string): RscRoute[];
|
|
8
|
-
type RscBuildResult = {
|
|
7
|
+
export declare function findRscRoutes(appDir: string): RscRoute[];
|
|
8
|
+
export type RscBuildResult = {
|
|
9
9
|
worker: string;
|
|
10
10
|
server: string;
|
|
11
11
|
paths: string[];
|
|
12
12
|
} | null;
|
|
13
|
-
declare function buildRsc(appRoot: string, outDir: string, docConfig: DocumentConfig): Promise<RscBuildResult>;
|
|
13
|
+
export declare function buildRsc(appRoot: string, outDir: string, docConfig: DocumentConfig): Promise<RscBuildResult>;
|
|
14
14
|
type Fetcher = (request: Request) => Promise<Response>;
|
|
15
|
-
declare function createRscDispatch(ssrFetch: Fetcher, rscFetch: Fetcher, rscPaths: Iterable<string>): Fetcher;
|
|
16
|
-
//#endregion
|
|
17
|
-
export { RscBuildResult, RscRoute, buildRsc, createRscDispatch, findRscRoutes };
|
|
15
|
+
export declare function createRscDispatch(ssrFetch: Fetcher, rscFetch: Fetcher, rscPaths: Iterable<string>): Fetcher;
|
|
16
|
+
//#endregion
|
package/dist/rsc-bundle.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
//#region src/rsc-bundle.d.ts
|
|
2
|
-
type RscGraph = "server" | "ssr";
|
|
3
|
-
type RscAliases = Record<string, string>;
|
|
4
|
-
declare function bundleServerGraph(entryFile: string, cwd: string, aliases?: RscAliases, appDir?: string): Promise<string>;
|
|
5
|
-
declare function bundleSsrGraph(entryFile: string, cwd: string, aliases?: RscAliases): Promise<string>;
|
|
6
|
-
declare function referencesNodeBuiltins(code: string): boolean;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { RscAliases, RscGraph, bundleServerGraph, bundleSsrGraph, referencesNodeBuiltins };
|
|
2
|
+
export type RscGraph = "server" | "ssr";
|
|
3
|
+
export type RscAliases = Record<string, string>;
|
|
4
|
+
export declare function bundleServerGraph(entryFile: string, cwd: string, aliases?: RscAliases, appDir?: string): Promise<string>;
|
|
5
|
+
export declare function bundleSsrGraph(entryFile: string, cwd: string, aliases?: RscAliases): Promise<string>;
|
|
6
|
+
export declare function referencesNodeBuiltins(code: string): boolean;
|
|
7
|
+
//#endregion
|
package/dist/rsc-manifest.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Plugin } from "rolldown";
|
|
2
2
|
//#region src/rsc-manifest.d.ts
|
|
3
|
-
declare const RSC_SERVER_MANIFEST_FILE = "_rsc-server.gen.ts";
|
|
4
|
-
declare const RSC_CLIENT_MANIFEST_FILE = "_rsc-client.gen.ts";
|
|
5
|
-
declare function rscClientReferencesPlugin(appDir: string): Plugin;
|
|
6
|
-
declare function generateRscManifests(appDir: string): number;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { RSC_CLIENT_MANIFEST_FILE, RSC_SERVER_MANIFEST_FILE, generateRscManifests, rscClientReferencesPlugin };
|
|
3
|
+
export declare const RSC_SERVER_MANIFEST_FILE = "_rsc-server.gen.ts";
|
|
4
|
+
export declare const RSC_CLIENT_MANIFEST_FILE = "_rsc-client.gen.ts";
|
|
5
|
+
export declare function rscClientReferencesPlugin(appDir: string): Plugin;
|
|
6
|
+
export declare function generateRscManifests(appDir: string): number;
|
|
7
|
+
//#endregion
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region src/rsc-runtime/flight-render-routes.d.ts
|
|
2
|
-
declare function renderFlight(path: string): Promise<string | null>;
|
|
3
|
-
declare function rscPaths(): string[];
|
|
4
|
-
//#endregion
|
|
5
|
-
export { renderFlight, rscPaths };
|
|
2
|
+
export declare function renderFlight(path: string): Promise<string | null>;
|
|
3
|
+
export declare function rscPaths(): string[];
|
|
4
|
+
//#endregion
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
//#region src/rsc-runtime/flight-to-html.d.ts
|
|
2
|
-
declare function flightToHtml(flight: string, moduleMap?: Record<string, unknown>): Promise<string>;
|
|
3
|
-
//#endregion
|
|
4
|
-
export { flightToHtml };
|
|
2
|
+
export declare function flightToHtml(flight: string, moduleMap?: Record<string, unknown>): Promise<string>;
|
|
3
|
+
//#endregion
|
|
@@ -20,11 +20,12 @@ async function streamToString(stream) {
|
|
|
20
20
|
}
|
|
21
21
|
async function flightToHtml(flight, moduleMap = {}) {
|
|
22
22
|
const flightStream = new Response(flight).body;
|
|
23
|
-
const
|
|
23
|
+
const tree = createFromReadableStream(flightStream, { serverConsumerManifest: {
|
|
24
24
|
moduleMap,
|
|
25
25
|
serverModuleMap: null,
|
|
26
26
|
moduleLoading: null
|
|
27
|
-
} })
|
|
27
|
+
} });
|
|
28
|
+
const html = await renderToReadableStream(/* @__PURE__ */ jsx(Root, { tree }));
|
|
28
29
|
if (typeof html.allReady?.then === "function") await html.allReady;
|
|
29
30
|
return streamToString(html);
|
|
30
31
|
}
|
|
@@ -21,24 +21,27 @@ async function streamToString(stream) {
|
|
|
21
21
|
out += dec.decode();
|
|
22
22
|
return out;
|
|
23
23
|
}
|
|
24
|
-
async function renderDocument(
|
|
24
|
+
async function renderDocument(url) {
|
|
25
|
+
const path = url.pathname;
|
|
25
26
|
const flight = await (await import(new URL("./server.js", import.meta.url).href)).renderFlight(path);
|
|
26
27
|
if (flight === null) return null;
|
|
27
28
|
const flightStream = new Response(flight).body;
|
|
29
|
+
const tree = createFromReadableStream(flightStream, { serverConsumerManifest: {
|
|
30
|
+
moduleMap: MODULE_MAP,
|
|
31
|
+
serverModuleMap: null,
|
|
32
|
+
moduleLoading: null
|
|
33
|
+
} });
|
|
28
34
|
const html = await renderToReadableStream(/* @__PURE__ */ jsx(Document, {
|
|
29
35
|
config: DOC_CONFIG,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
moduleLoading: null
|
|
34
|
-
} }) })
|
|
36
|
+
pageUrl: url.href,
|
|
37
|
+
isHome: path === "/",
|
|
38
|
+
children: /* @__PURE__ */ jsx(Root, { tree })
|
|
35
39
|
}));
|
|
36
40
|
if (typeof html.allReady?.then === "function") await html.allReady;
|
|
37
41
|
return "<!DOCTYPE html>" + await streamToString(html);
|
|
38
42
|
}
|
|
39
43
|
var rsc_worker_default = { async fetch(request) {
|
|
40
|
-
const
|
|
41
|
-
const body = await renderDocument(path);
|
|
44
|
+
const body = await renderDocument(new URL(request.url));
|
|
42
45
|
if (body === null) return new Response("Not Found", { status: 404 });
|
|
43
46
|
return new Response(body, { headers: { "content-type": "text/html; charset=utf-8" } });
|
|
44
47
|
} };
|
package/dist/segment.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/segment.d.ts
|
|
2
|
-
declare const boundaryWarning: (file: string) => string;
|
|
3
|
-
declare function boundaryKey(file: string): string;
|
|
4
|
-
declare function resolveBoundary<C>(items: Array<{
|
|
2
|
+
export declare const boundaryWarning: (file: string) => string;
|
|
3
|
+
export declare function boundaryKey(file: string): string;
|
|
4
|
+
export declare function resolveBoundary<C>(items: Array<{
|
|
5
5
|
file: string;
|
|
6
6
|
entry: C | null;
|
|
7
7
|
boundary: boolean;
|
|
@@ -10,5 +10,4 @@ declare function resolveBoundary<C>(items: Array<{
|
|
|
10
10
|
boundaryIndex: number | null;
|
|
11
11
|
key: string | null;
|
|
12
12
|
};
|
|
13
|
-
//#endregion
|
|
14
|
-
export { boundaryKey, boundaryWarning, resolveBoundary };
|
|
13
|
+
//#endregion
|
package/dist/sqlite-driver.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JuneDb } from "@junejs/core/resources";
|
|
2
2
|
//#region src/sqlite-driver.d.ts
|
|
3
|
-
type SyncStatement = {
|
|
3
|
+
export type SyncStatement = {
|
|
4
4
|
all(...params: unknown[]): unknown[];
|
|
5
5
|
get(...params: unknown[]): unknown;
|
|
6
6
|
run(...params: unknown[]): {
|
|
@@ -8,18 +8,18 @@ type SyncStatement = {
|
|
|
8
8
|
lastInsertRowid?: number | bigint;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
type SyncSqlite = {
|
|
11
|
+
export type SyncSqlite = {
|
|
12
12
|
query(sql: string): SyncStatement;
|
|
13
13
|
exec(sql: string): void;
|
|
14
14
|
close(): void;
|
|
15
15
|
};
|
|
16
|
-
declare const NODE_SQLITE_MIN_LTS = "22.13.0";
|
|
17
|
-
declare const NODE_SQLITE_MIN_ODD = "23.4.0";
|
|
18
|
-
declare function nodeSqliteHelp(nodeVersion: string): string;
|
|
19
|
-
declare function isNodeSqliteExperimentalWarning(type: unknown, message: string): boolean;
|
|
16
|
+
export declare const NODE_SQLITE_MIN_LTS = "22.13.0";
|
|
17
|
+
export declare const NODE_SQLITE_MIN_ODD = "23.4.0";
|
|
18
|
+
export declare function nodeSqliteHelp(nodeVersion: string): string;
|
|
19
|
+
export declare function isNodeSqliteExperimentalWarning(type: unknown, message: string): boolean;
|
|
20
20
|
type EmitWarning = (warning: string | Error, ...rest: unknown[]) => void;
|
|
21
|
-
declare function makeWarningFilter(original: EmitWarning): EmitWarning;
|
|
22
|
-
declare function
|
|
23
|
-
declare function
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
export declare function makeWarningFilter(original: EmitWarning): EmitWarning;
|
|
22
|
+
export declare function useDurableJournal(db: SyncSqlite, path: string): SyncSqlite;
|
|
23
|
+
export declare function openLocalSqliteSync(path: string): Promise<SyncSqlite>;
|
|
24
|
+
export declare function openLocalSqlite(path: string): Promise<JuneDb>;
|
|
25
|
+
//#endregion
|
package/dist/sqlite-driver.js
CHANGED
|
@@ -72,10 +72,23 @@ function makeWarningFilter(original) {
|
|
|
72
72
|
original(warning, ...rest);
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
+
function useDurableJournal(db, path) {
|
|
76
|
+
if (path === ":memory:" || path === "") return db;
|
|
77
|
+
try {
|
|
78
|
+
db.exec("PRAGMA journal_mode=WAL");
|
|
79
|
+
db.exec("PRAGMA synchronous=FULL");
|
|
80
|
+
} catch (err) {
|
|
81
|
+
try {
|
|
82
|
+
db.close();
|
|
83
|
+
} catch {}
|
|
84
|
+
throw err;
|
|
85
|
+
}
|
|
86
|
+
return db;
|
|
87
|
+
}
|
|
75
88
|
async function openLocalSqliteSync(path) {
|
|
76
89
|
if (typeof Bun !== "undefined") {
|
|
77
90
|
const { Database } = await import("bun:sqlite");
|
|
78
|
-
return new Database(path, { create: true });
|
|
91
|
+
return useDurableJournal(new Database(path, { create: true }), path);
|
|
79
92
|
}
|
|
80
93
|
const specifier = "node:sqlite";
|
|
81
94
|
let mod;
|
|
@@ -89,14 +102,14 @@ async function openLocalSqliteSync(path) {
|
|
|
89
102
|
process.emitWarning = originalEmitWarning;
|
|
90
103
|
}
|
|
91
104
|
const db = new mod.DatabaseSync(path);
|
|
92
|
-
return {
|
|
105
|
+
return useDurableJournal({
|
|
93
106
|
query: (sql) => db.prepare(sql),
|
|
94
107
|
exec: (sql) => db.exec(sql),
|
|
95
108
|
close: () => db.close()
|
|
96
|
-
};
|
|
109
|
+
}, path);
|
|
97
110
|
}
|
|
98
111
|
async function openLocalSqlite(path) {
|
|
99
112
|
return asyncSqlite(await openLocalSqliteSync(path));
|
|
100
113
|
}
|
|
101
114
|
//#endregion
|
|
102
|
-
export { NODE_SQLITE_MIN_LTS, NODE_SQLITE_MIN_ODD, isNodeSqliteExperimentalWarning, makeWarningFilter, nodeSqliteHelp, openLocalSqlite, openLocalSqliteSync };
|
|
115
|
+
export { NODE_SQLITE_MIN_LTS, NODE_SQLITE_MIN_ODD, isNodeSqliteExperimentalWarning, makeWarningFilter, nodeSqliteHelp, openLocalSqlite, openLocalSqliteSync, useDurableJournal };
|
package/dist/static-files.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
//#region src/static-files.d.ts
|
|
2
|
-
declare const RESERVED_PREFIX = "_june";
|
|
3
|
-
declare function contentTypeFor(pathname: string): string;
|
|
4
|
-
declare function safeRelativePath(pathname: string): string | null;
|
|
5
|
-
//#endregion
|
|
6
|
-
export { RESERVED_PREFIX, contentTypeFor, safeRelativePath };
|
|
2
|
+
export declare const RESERVED_PREFIX = "_june";
|
|
3
|
+
export declare function contentTypeFor(pathname: string): string;
|
|
4
|
+
export declare function safeRelativePath(pathname: string): string | null;
|
|
5
|
+
//#endregion
|
package/dist/tsconfig-jsx.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
//#region src/tsconfig-jsx.d.ts
|
|
2
|
+
export declare const stripJsonc: (s: string) => string;
|
|
2
3
|
/** Read the app's tsconfig.json and return compilerOptions.jsxImportSource.
|
|
3
4
|
* Follows one level of `extends` so apps that inherit from a base tsconfig
|
|
4
5
|
* (e.g. "@kurajs/docs/tsconfig.kura.json") are handled correctly.
|
|
5
6
|
* Returns undefined when absent or unreadable. */
|
|
6
|
-
declare function appJsxImportSource(appRoot: string): Promise<string | undefined>;
|
|
7
|
+
export declare function appJsxImportSource(appRoot: string): Promise<string | undefined>;
|
|
7
8
|
/** The transform.jsx both bundles use: June's island JSX runtime, with the explicit importSource
|
|
8
9
|
* skipped when the app's tsconfig already declares it — rolldown then reads it from tsconfig
|
|
9
10
|
* silently instead of warning about the (same-value) override. */
|
|
10
|
-
declare function jsxTransform(appRoot: string): Promise<{
|
|
11
|
+
export declare function jsxTransform(appRoot: string): Promise<{
|
|
11
12
|
runtime: "automatic";
|
|
12
13
|
importSource?: string;
|
|
13
14
|
}>;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { appJsxImportSource, jsxTransform };
|
|
15
|
+
//#endregion
|
package/dist/tsconfig-jsx.js
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region src/turn-events.ts
|
|
2
|
+
function observeTurnEvents(session, turnId) {
|
|
3
|
+
const queue = [];
|
|
4
|
+
let terminal = false;
|
|
5
|
+
let notify;
|
|
6
|
+
const unsub = session.observe((e) => {
|
|
7
|
+
queue.push(e);
|
|
8
|
+
if (e.type === "turn.completed" || e.type === "turn.failed" || e.type === "turn.cancelled" || e.type === "input.requested") terminal = true;
|
|
9
|
+
notify?.();
|
|
10
|
+
}, { turnId });
|
|
11
|
+
return { [Symbol.asyncIterator]() {
|
|
12
|
+
return {
|
|
13
|
+
async next() {
|
|
14
|
+
for (;;) {
|
|
15
|
+
const e = queue.shift();
|
|
16
|
+
if (e) return {
|
|
17
|
+
value: e,
|
|
18
|
+
done: false
|
|
19
|
+
};
|
|
20
|
+
if (terminal) {
|
|
21
|
+
unsub();
|
|
22
|
+
return {
|
|
23
|
+
value: void 0,
|
|
24
|
+
done: true
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
await new Promise((resolve) => {
|
|
28
|
+
notify = resolve;
|
|
29
|
+
});
|
|
30
|
+
notify = void 0;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
async return() {
|
|
34
|
+
unsub();
|
|
35
|
+
terminal = true;
|
|
36
|
+
queue.length = 0;
|
|
37
|
+
return {
|
|
38
|
+
value: void 0,
|
|
39
|
+
done: true
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
} };
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { observeTurnEvents };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { siteShortName } from "@junejs/core/config";
|
|
2
|
+
import { resolveThemeColor } from "@junejs/core/document";
|
|
3
|
+
//#region src/web-manifest.ts
|
|
4
|
+
const shortName = (site) => siteShortName(site);
|
|
5
|
+
function webManifest(config) {
|
|
6
|
+
const base = config.basePath ?? "";
|
|
7
|
+
const theme = resolveThemeColor(config);
|
|
8
|
+
const color = typeof theme === "string" ? theme : void 0;
|
|
9
|
+
const manifest = {
|
|
10
|
+
name: config.site.name,
|
|
11
|
+
short_name: shortName(config.site),
|
|
12
|
+
description: config.site.description,
|
|
13
|
+
start_url: `${base}/`,
|
|
14
|
+
scope: `${base}/`,
|
|
15
|
+
display: "browser",
|
|
16
|
+
...color ? {
|
|
17
|
+
theme_color: color,
|
|
18
|
+
background_color: color
|
|
19
|
+
} : {},
|
|
20
|
+
icons: [
|
|
21
|
+
{
|
|
22
|
+
src: `${base}/icon-192.png`,
|
|
23
|
+
sizes: "192x192",
|
|
24
|
+
type: "image/png"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
src: `${base}/icon-512.png`,
|
|
28
|
+
sizes: "512x512",
|
|
29
|
+
type: "image/png"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
src: `${base}/icon-512.png`,
|
|
33
|
+
sizes: "512x512",
|
|
34
|
+
type: "image/png",
|
|
35
|
+
purpose: "maskable"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
};
|
|
39
|
+
return JSON.stringify(manifest, null, 2) + "\n";
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { shortName, webManifest };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { l as ResourceHandler, n as LayoutComponent, r as LoadingComponent, t as ExtraHandler } from "./pipeline-BHUjBO0G.js";
|
|
2
|
+
import { Channel, ChannelFactory } from "@junejs/core/agent-config";
|
|
3
|
+
import { BrandedRoute } from "@junejs/core/route";
|
|
4
|
+
import { AgentConfig } from "@junejs/core/config";
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { DocumentConfig } from "@junejs/core/document";
|
|
7
|
+
import { I18nConfig } from "@junejs/core/i18n";
|
|
8
|
+
import { Resources } from "@junejs/core/resources";
|
|
9
|
+
//#region src/worker.d.ts
|
|
10
|
+
type WorkerExecutionContext = {
|
|
11
|
+
waitUntil?(p: Promise<unknown>): void;
|
|
12
|
+
};
|
|
13
|
+
type WorkerManifest = {
|
|
14
|
+
routes: Record<string, BrandedRoute>;
|
|
15
|
+
dynamicRoutes?: Array<{
|
|
16
|
+
pattern: string;
|
|
17
|
+
def: BrandedRoute;
|
|
18
|
+
}>;
|
|
19
|
+
resourceRoutes?: Array<{
|
|
20
|
+
pattern: string;
|
|
21
|
+
handler: ResourceHandler;
|
|
22
|
+
}>;
|
|
23
|
+
generatedRoutes?: string[];
|
|
24
|
+
layoutChains?: Record<string, LayoutComponent[]>;
|
|
25
|
+
layoutBoundaries?: Record<string, {
|
|
26
|
+
index: number;
|
|
27
|
+
key: string;
|
|
28
|
+
}>;
|
|
29
|
+
loadings?: Record<string, LoadingComponent>;
|
|
30
|
+
document: DocumentConfig;
|
|
31
|
+
agent: AgentConfig;
|
|
32
|
+
agentName?: string;
|
|
33
|
+
agentChannels?: (Channel | ChannelFactory)[];
|
|
34
|
+
i18n?: I18nConfig;
|
|
35
|
+
earlyHints?: string[];
|
|
36
|
+
htmlCacheControl?: string;
|
|
37
|
+
notFound?: React.ComponentType<{
|
|
38
|
+
pathname: string;
|
|
39
|
+
}>;
|
|
40
|
+
extra?: ExtraHandler;
|
|
41
|
+
resources?: (env?: unknown) => Promise<Resources> | Resources;
|
|
42
|
+
services?: (env?: unknown) => unknown;
|
|
43
|
+
};
|
|
44
|
+
declare function createWorker(manifest: WorkerManifest, opts?: {
|
|
45
|
+
staticBuild?: boolean;
|
|
46
|
+
}): {
|
|
47
|
+
fetch(request: Request, env?: unknown, ctx?: WorkerExecutionContext): Promise<Response>;
|
|
48
|
+
};
|
|
49
|
+
type AssetEnv = {
|
|
50
|
+
ASSETS?: {
|
|
51
|
+
fetch(request: Request): Promise<Response>;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
type FetchPipeline = {
|
|
55
|
+
fetch(request: Request, env?: unknown, ctx?: WorkerExecutionContext): Promise<Response>;
|
|
56
|
+
};
|
|
57
|
+
declare function withAssets(pipeline: FetchPipeline, opts?: {
|
|
58
|
+
link?: string | null;
|
|
59
|
+
}): {
|
|
60
|
+
fetch(request: Request, env?: AssetEnv, ctx?: WorkerExecutionContext): Promise<Response>;
|
|
61
|
+
};
|
|
62
|
+
declare function withDenoAssets(pipeline: FetchPipeline): (request: Request) => Promise<Response>;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { withDenoAssets as a, withAssets as i, WorkerManifest as n, createWorker as r, WorkerExecutionContext as t };
|