@junejs/server 1.0.0-dev.29 → 1.0.0-dev.42

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.
Files changed (77) hide show
  1. package/dist/agent-compile.d.ts +8 -9
  2. package/dist/agent-discover.d.ts +3 -4
  3. package/dist/agent-durable.d.ts +38 -20
  4. package/dist/agent-durable.js +159 -13
  5. package/dist/agent-native.d.ts +15 -12
  6. package/dist/agent-native.js +72 -8
  7. package/dist/app.d.ts +4 -5
  8. package/dist/app.js +2 -1
  9. package/dist/blob.d.ts +4 -5
  10. package/dist/build.d.ts +6 -6
  11. package/dist/build.js +38 -7
  12. package/dist/client-bundle.d.ts +8 -9
  13. package/dist/{config-freeze-DwI-Rmvq.d.ts → config-freeze-ZWC_Qd4h.d.ts} +1 -1
  14. package/dist/config-freeze.d.ts +1 -1
  15. package/dist/config-loader.d.ts +3 -4
  16. package/dist/connection-auth.d.ts +8 -9
  17. package/dist/content.d.ts +9 -10
  18. package/dist/core-version.d.ts +3 -4
  19. package/dist/core-version.js +1 -1
  20. package/dist/css-modules-ambient.d.ts +2 -1
  21. package/dist/css-modules.d.ts +10 -11
  22. package/dist/css.d.ts +9 -10
  23. package/dist/d1-migrate.d.ts +6 -7
  24. package/dist/d1-migrate.js +3 -2
  25. package/dist/db.d.ts +2 -2
  26. package/dist/deploy.d.ts +3 -4
  27. package/dist/deploy.js +3 -2
  28. package/dist/dev-reload.d.ts +3 -4
  29. package/dist/dev.d.ts +4 -5
  30. package/dist/favicon.d.ts +16 -17
  31. package/dist/host.d.ts +5 -5
  32. package/dist/icon-letter.d.ts +2 -3
  33. package/dist/index.d.ts +4 -4
  34. package/dist/instrumentation.d.ts +2 -3
  35. package/dist/instrumentation.js +2 -1
  36. package/dist/island-registry.d.ts +6 -7
  37. package/dist/isolate-local.d.ts +4 -5
  38. package/dist/kv.d.ts +3 -4
  39. package/dist/llms-links.d.ts +8 -5
  40. package/dist/llms-links.js +31 -1
  41. package/dist/{manifest-gcNWqWoI.d.ts → manifest-DSNX4I-G.d.ts} +2 -2
  42. package/dist/manifest.d.ts +1 -1
  43. package/dist/negotiate.d.ts +4 -3
  44. package/dist/negotiate.js +24 -14
  45. package/dist/{pipeline-cCR6MGNK.d.ts → pipeline-BHUjBO0G.d.ts} +5 -1
  46. package/dist/pipeline.d.ts +2 -2
  47. package/dist/pipeline.js +260 -41
  48. package/dist/resources.d.ts +5 -6
  49. package/dist/router.d.ts +12 -13
  50. package/dist/rsc-build.d.ts +6 -7
  51. package/dist/rsc-bundle.d.ts +6 -7
  52. package/dist/rsc-manifest.d.ts +5 -6
  53. package/dist/rsc-runtime/flight-render-routes.d.ts +3 -4
  54. package/dist/rsc-runtime/flight-render.d.ts +2 -3
  55. package/dist/rsc-runtime/flight-to-html.d.ts +2 -3
  56. package/dist/rsc-runtime/flight-to-html.js +3 -2
  57. package/dist/rsc-runtime/rsdw-shims.d.ts +2 -1
  58. package/dist/segment.d.ts +4 -5
  59. package/dist/sqlite-driver.d.ts +10 -11
  60. package/dist/static-files.d.ts +4 -5
  61. package/dist/tsconfig-jsx.d.ts +4 -5
  62. package/dist/turn-events.d.ts +2 -3
  63. package/dist/web-manifest.d.ts +3 -4
  64. package/dist/web-manifest.js +2 -6
  65. package/dist/{worker-BkFHGtxp.d.ts → worker-Dv4l6Ybs.d.ts} +4 -2
  66. package/dist/worker.d.ts +1 -1
  67. package/dist/worker.js +35 -18
  68. package/package.json +5 -5
  69. package/src/agent-durable.ts +203 -21
  70. package/src/agent-native.ts +94 -7
  71. package/src/build.ts +67 -5
  72. package/src/core-version.ts +1 -1
  73. package/src/llms-links.ts +46 -1
  74. package/src/negotiate.ts +39 -15
  75. package/src/pipeline.ts +433 -45
  76. package/src/web-manifest.ts +2 -6
  77. package/src/worker.ts +55 -17
@@ -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,17 @@ 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 openLocalSqliteSync(path: string): Promise<SyncSqlite>;
23
- declare function openLocalSqlite(path: string): Promise<JuneDb>;
24
- //#endregion
25
- export { NODE_SQLITE_MIN_LTS, NODE_SQLITE_MIN_ODD, SyncSqlite, SyncStatement, isNodeSqliteExperimentalWarning, makeWarningFilter, nodeSqliteHelp, openLocalSqlite, openLocalSqliteSync };
21
+ export declare function makeWarningFilter(original: EmitWarning): EmitWarning;
22
+ export declare function openLocalSqliteSync(path: string): Promise<SyncSqlite>;
23
+ export declare function openLocalSqlite(path: string): Promise<JuneDb>;
24
+ //#endregion
@@ -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
@@ -1,16 +1,15 @@
1
1
  //#region src/tsconfig-jsx.d.ts
2
- declare const stripJsonc: (s: string) => string;
2
+ export declare const stripJsonc: (s: string) => string;
3
3
  /** Read the app's tsconfig.json and return compilerOptions.jsxImportSource.
4
4
  * Follows one level of `extends` so apps that inherit from a base tsconfig
5
5
  * (e.g. "@kurajs/docs/tsconfig.kura.json") are handled correctly.
6
6
  * Returns undefined when absent or unreadable. */
7
- declare function appJsxImportSource(appRoot: string): Promise<string | undefined>;
7
+ export declare function appJsxImportSource(appRoot: string): Promise<string | undefined>;
8
8
  /** The transform.jsx both bundles use: June's island JSX runtime, with the explicit importSource
9
9
  * skipped when the app's tsconfig already declares it — rolldown then reads it from tsconfig
10
10
  * silently instead of warning about the (same-value) override. */
11
- declare function jsxTransform(appRoot: string): Promise<{
11
+ export declare function jsxTransform(appRoot: string): Promise<{
12
12
  runtime: "automatic";
13
13
  importSource?: string;
14
14
  }>;
15
- //#endregion
16
- export { appJsxImportSource, jsxTransform, stripJsonc };
15
+ //#endregion
@@ -1,5 +1,4 @@
1
1
  import { AgentSession, TurnEvent } from "@junejs/core/agent-runtime";
2
2
  //#region src/turn-events.d.ts
3
- declare function observeTurnEvents(session: AgentSession, turnId: string): AsyncIterable<TurnEvent>;
4
- //#endregion
5
- export { observeTurnEvents };
3
+ export declare function observeTurnEvents(session: AgentSession, turnId: string): AsyncIterable<TurnEvent>;
4
+ //#endregion
@@ -1,6 +1,5 @@
1
1
  import { DocumentConfig } from "@junejs/core/document";
2
2
  //#region src/web-manifest.d.ts
3
- declare function shortName(site: DocumentConfig["site"]): string | undefined;
4
- declare function webManifest(config: DocumentConfig): string;
5
- //#endregion
6
- export { shortName, webManifest };
3
+ export declare const shortName: (site: DocumentConfig["site"]) => string | undefined;
4
+ export declare function webManifest(config: DocumentConfig): string;
5
+ //#endregion
@@ -1,11 +1,7 @@
1
+ import { siteShortName } from "@junejs/core/config";
1
2
  import { resolveThemeColor } from "@junejs/core/document";
2
3
  //#region src/web-manifest.ts
3
- function shortName(site) {
4
- if (site.shortName) return site.shortName;
5
- const name = site.name?.trim();
6
- if (!name) return void 0;
7
- return name.split(/\s+[—–|-]\s+|:\s+/)[0].trim() || name;
8
- }
4
+ const shortName = (site) => siteShortName(site);
9
5
  function webManifest(config) {
10
6
  const base = config.basePath ?? "";
11
7
  const theme = resolveThemeColor(config);
@@ -1,4 +1,4 @@
1
- import { l as ResourceHandler, n as LayoutComponent, r as LoadingComponent, t as ExtraHandler } from "./pipeline-cCR6MGNK.js";
1
+ import { l as ResourceHandler, n as LayoutComponent, r as LoadingComponent, t as ExtraHandler } from "./pipeline-BHUjBO0G.js";
2
2
  import { Channel, ChannelFactory } from "@junejs/core/agent-config";
3
3
  import { BrandedRoute } from "@junejs/core/route";
4
4
  import { AgentConfig } from "@junejs/core/config";
@@ -40,7 +40,9 @@ type WorkerManifest = {
40
40
  resources?: (env?: unknown) => Promise<Resources> | Resources;
41
41
  services?: (env?: unknown) => unknown;
42
42
  };
43
- declare function createWorker(manifest: WorkerManifest): {
43
+ declare function createWorker(manifest: WorkerManifest, opts?: {
44
+ staticBuild?: boolean;
45
+ }): {
44
46
  fetch(request: Request, env?: unknown, ctx?: WorkerExecutionContext): Promise<Response>;
45
47
  };
46
48
  type AssetEnv = {
package/dist/worker.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as withDenoAssets, i as withAssets, n as WorkerManifest, r as createWorker, t as WorkerExecutionContext } from "./worker-BkFHGtxp.js";
1
+ import { a as withDenoAssets, i as withAssets, n as WorkerManifest, r as createWorker, t as WorkerExecutionContext } from "./worker-Dv4l6Ybs.js";
2
2
  export { WorkerExecutionContext, WorkerManifest, createWorker, withAssets, withDenoAssets };
package/dist/worker.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { durableAgentSurface, durableChannelSurface } from "./agent-durable.js";
2
+ import { acceptTarget } from "./negotiate.js";
2
3
  import { createPipeline } from "./pipeline.js";
3
4
  import { RESERVED_PREFIX, contentTypeFor, safeRelativePath } from "./static-files.js";
4
5
  //#region src/worker.ts
@@ -45,7 +46,7 @@ function compilePattern(pattern) {
45
46
  names
46
47
  };
47
48
  }
48
- function createWorker(manifest) {
49
+ function createWorker(manifest, opts = {}) {
49
50
  const dynamic = (manifest.dynamicRoutes ?? []).map((d) => ({
50
51
  ...compilePattern(d.pattern),
51
52
  def: d.def,
@@ -92,6 +93,7 @@ function createWorker(manifest) {
92
93
  agentSurface,
93
94
  i18n: manifest.i18n,
94
95
  routeList: () => routeList,
96
+ staticBuild: opts.staticBuild,
95
97
  earlyHints: manifest.earlyHints,
96
98
  htmlCacheControl: manifest.htmlCacheControl,
97
99
  notFoundComponent: manifest.notFound,
@@ -155,28 +157,41 @@ function createWorker(manifest) {
155
157
  } };
156
158
  }
157
159
  const estimateTokens = (s) => String(Math.ceil(s.length / 4));
160
+ function varyAccept(headers) {
161
+ const vary = headers.get("vary");
162
+ if (!vary) headers.set("vary", "accept");
163
+ else if (vary.trim() !== "*" && !vary.split(",").some((v) => v.trim().toLowerCase() === "accept")) headers.set("vary", `${vary}, accept`);
164
+ }
158
165
  function withAssets(pipeline, opts = {}) {
159
166
  return { async fetch(request, env, ctx) {
160
167
  const assets = env?.ASSETS;
161
168
  const url = new URL(request.url);
162
169
  const isPagePath = !/\.[a-z0-9]+$/i.test(url.pathname);
163
- const accept = request.headers.get("accept") ?? "";
164
- if (assets && request.method === "GET" && isPagePath && /text\/markdown/.test(accept)) {
165
- const base = url.pathname === "/" ? "/index" : url.pathname.replace(/\/+$/, "");
166
- const mdUrl = new URL(url);
167
- mdUrl.pathname = `${base}.md`;
168
- const a = await assets.fetch(new Request(mdUrl.toString(), { headers: request.headers }));
169
- if (a.ok) {
170
- const body = await a.text();
171
- const headers = new Headers(a.headers);
172
- headers.set("content-type", "text/markdown; charset=utf-8");
173
- headers.set("x-markdown-tokens", estimateTokens(body));
174
- if (opts.link) headers.set("link", opts.link);
175
- return new Response(body, {
176
- status: 200,
177
- headers
178
- });
170
+ const target = isPagePath ? acceptTarget(request.headers.get("accept") ?? "") : null;
171
+ if (target && (request.method === "GET" || request.method === "HEAD")) {
172
+ if (assets && request.method === "GET" && (target === "md" || target === "json")) {
173
+ const base = url.pathname === "/" ? "/index" : url.pathname.replace(/\/+$/, "");
174
+ const assetUrl = new URL(url);
175
+ assetUrl.pathname = `${base}.${target}`;
176
+ const a = await assets.fetch(new Request(assetUrl.toString(), { headers: request.headers }));
177
+ if (a.ok) {
178
+ const headers = new Headers(a.headers);
179
+ if (opts.link) headers.set("link", opts.link);
180
+ varyAccept(headers);
181
+ if (target === "json") return new Response(a.body, {
182
+ status: 200,
183
+ headers
184
+ });
185
+ const body = await a.text();
186
+ headers.set("content-type", "text/markdown; charset=utf-8");
187
+ headers.set("x-markdown-tokens", estimateTokens(body));
188
+ return new Response(body, {
189
+ status: 200,
190
+ headers
191
+ });
192
+ }
179
193
  }
194
+ return pipeline.fetch(request, env, ctx);
180
195
  }
181
196
  if (assets && (request.method === "GET" || request.method === "HEAD")) {
182
197
  const a = await assets.fetch(request);
@@ -184,10 +199,12 @@ function withAssets(pipeline, opts = {}) {
184
199
  const ct = a.headers.get("content-type") ?? "";
185
200
  const addLink = !!opts.link && ct.includes("text/html") && !a.headers.has("link");
186
201
  const immutable = /\.[a-f0-9]{8,}\.(css|js)$/.test(url.pathname);
187
- if (addLink || immutable) {
202
+ const negotiated = isPagePath && ct.includes("text/html");
203
+ if (addLink || immutable || negotiated) {
188
204
  const headers = new Headers(a.headers);
189
205
  if (addLink) headers.set("link", opts.link);
190
206
  if (immutable) headers.set("cache-control", "public, max-age=31536000, immutable");
207
+ if (negotiated) varyAccept(headers);
191
208
  return new Response(a.body, {
192
209
  status: a.status,
193
210
  headers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junejs/server",
3
- "version": "1.0.0-dev.29",
3
+ "version": "1.0.0-dev.42",
4
4
  "description": "June host adapters + dev server. Host-coupled; depends on the pure @junejs/core contract layer.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -136,14 +136,14 @@
136
136
  "@momiji-rs/sparkdown": "^0.0.4",
137
137
  "@resvg/resvg-wasm": "^2.6.2",
138
138
  "lightningcss": "^1.27.0",
139
- "oxc-parser": "^0.137.0",
139
+ "oxc-parser": "^0.151.0",
140
140
  "rolldown": "^1.1.0"
141
141
  },
142
142
  "peerDependencies": {
143
- "@junejs/core": ">=0.2.0-dev.50",
143
+ "@junejs/core": ">=0.2.0-dev.63",
144
144
  "react": "^19.2.0",
145
145
  "react-dom": "^19.2.0",
146
- "react-server-dom-webpack": "19.2.7",
146
+ "react-server-dom-webpack": "19.3.0",
147
147
  "pg": "^8.0.0",
148
148
  "mysql2": "^3.0.0",
149
149
  "@libsql/client": "^0.14.0 || ^0.15.0 || ^0.16.0 || ^0.17.0",
@@ -176,6 +176,6 @@
176
176
  "@types/pg": "^8.20.0",
177
177
  "mysql2": "^3.22.5",
178
178
  "pg": "^8.21.0",
179
- "react-server-dom-webpack": "19.2.7"
179
+ "react-server-dom-webpack": "19.3.0"
180
180
  }
181
181
  }