@junejs/server 1.0.0-dev.28 → 1.0.0-dev.36

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 (75) 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 +20 -19
  4. package/dist/agent-durable.js +41 -6
  5. package/dist/agent-native.d.ts +10 -11
  6. package/dist/agent-native.js +6 -2
  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 +34 -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/css-modules-ambient.d.ts +2 -1
  20. package/dist/css-modules.d.ts +10 -11
  21. package/dist/css.d.ts +9 -10
  22. package/dist/d1-migrate.d.ts +6 -7
  23. package/dist/d1-migrate.js +3 -2
  24. package/dist/db.d.ts +2 -2
  25. package/dist/deploy.d.ts +3 -4
  26. package/dist/deploy.js +3 -2
  27. package/dist/dev-reload.d.ts +3 -4
  28. package/dist/dev.d.ts +4 -5
  29. package/dist/favicon.d.ts +16 -17
  30. package/dist/host.d.ts +5 -5
  31. package/dist/icon-letter.d.ts +2 -3
  32. package/dist/index.d.ts +4 -4
  33. package/dist/instrumentation.d.ts +2 -3
  34. package/dist/instrumentation.js +2 -1
  35. package/dist/island-registry.d.ts +6 -7
  36. package/dist/isolate-local.d.ts +4 -5
  37. package/dist/kv.d.ts +3 -4
  38. package/dist/llms-links.d.ts +9 -0
  39. package/dist/llms-links.js +65 -0
  40. package/dist/{manifest-gcNWqWoI.d.ts → manifest-DSNX4I-G.d.ts} +2 -2
  41. package/dist/manifest.d.ts +1 -1
  42. package/dist/negotiate.d.ts +4 -3
  43. package/dist/negotiate.js +24 -14
  44. package/dist/{pipeline-cCR6MGNK.d.ts → pipeline-BHUjBO0G.d.ts} +5 -1
  45. package/dist/pipeline.d.ts +2 -2
  46. package/dist/pipeline.js +263 -39
  47. package/dist/resources.d.ts +5 -6
  48. package/dist/router.d.ts +12 -13
  49. package/dist/rsc-build.d.ts +6 -7
  50. package/dist/rsc-bundle.d.ts +6 -7
  51. package/dist/rsc-manifest.d.ts +5 -6
  52. package/dist/rsc-runtime/flight-render-routes.d.ts +3 -4
  53. package/dist/rsc-runtime/flight-render.d.ts +2 -3
  54. package/dist/rsc-runtime/flight-to-html.d.ts +2 -3
  55. package/dist/rsc-runtime/flight-to-html.js +3 -2
  56. package/dist/rsc-runtime/rsdw-shims.d.ts +2 -1
  57. package/dist/segment.d.ts +4 -5
  58. package/dist/sqlite-driver.d.ts +10 -11
  59. package/dist/static-files.d.ts +4 -5
  60. package/dist/tsconfig-jsx.d.ts +4 -5
  61. package/dist/turn-events.d.ts +2 -3
  62. package/dist/web-manifest.d.ts +3 -4
  63. package/dist/web-manifest.js +2 -6
  64. package/dist/{worker-BkFHGtxp.d.ts → worker-Dv4l6Ybs.d.ts} +4 -2
  65. package/dist/worker.d.ts +1 -1
  66. package/dist/worker.js +35 -18
  67. package/package.json +5 -5
  68. package/src/agent-durable.ts +39 -10
  69. package/src/agent-native.ts +5 -1
  70. package/src/build.ts +63 -5
  71. package/src/llms-links.ts +96 -0
  72. package/src/negotiate.ts +39 -15
  73. package/src/pipeline.ts +437 -47
  74. package/src/web-manifest.ts +2 -6
  75. package/src/worker.ts +55 -17
@@ -1,5 +1,4 @@
1
1
  //#region src/core-version.d.ts
2
- declare function assertCoreRuntimeVersion(surface: string): void;
3
- declare function checkCoreRuntimeVersion(surface: string, actual: number | undefined, expected?: number): void;
4
- //#endregion
5
- export { assertCoreRuntimeVersion, checkCoreRuntimeVersion };
2
+ export declare function assertCoreRuntimeVersion(surface: string): void;
3
+ export declare function checkCoreRuntimeVersion(surface: string, actual: number | undefined, expected?: number): void;
4
+ //#endregion
@@ -7,4 +7,5 @@
7
7
  declare module "*.module.css" {
8
8
  const classes: Record<string, string>;
9
9
  export default classes;
10
- }
10
+ }
11
+ export {};
@@ -1,24 +1,23 @@
1
1
  //#region src/css-modules.d.ts
2
- declare const MODULE_STYLES_URL = "/_june/modules.css";
3
- declare const isModuleCss: (id: string) => boolean;
4
- declare function stableKey(appRoot: string, file: string): string;
5
- declare function transformCssModule(file: string, appRoot: string): Promise<{
2
+ export declare const MODULE_STYLES_URL = "/_june/modules.css";
3
+ export declare const isModuleCss: (id: string) => boolean;
4
+ export declare function stableKey(appRoot: string, file: string): string;
5
+ export declare function transformCssModule(file: string, appRoot: string): Promise<{
6
6
  map: Record<string, string>;
7
7
  css: string;
8
8
  }>;
9
- declare const moduleJs: (map: Record<string, string>) => string;
10
- type ModuleMaps = Record<string, Record<string, string>>;
11
- declare function buildModuleCss(appDir: string, appRoot: string): Promise<{
9
+ export declare const moduleJs: (map: Record<string, string>) => string;
10
+ export type ModuleMaps = Record<string, Record<string, string>>;
11
+ export declare function buildModuleCss(appDir: string, appRoot: string): Promise<{
12
12
  maps: ModuleMaps;
13
13
  css: string | null;
14
14
  }>;
15
- declare function rolldownCssModulesPlugin(maps: ModuleMaps): {
15
+ export declare function rolldownCssModulesPlugin(maps: ModuleMaps): {
16
16
  name: string;
17
17
  load(id: string): {
18
18
  code: string;
19
19
  moduleType: "js";
20
20
  } | null;
21
21
  };
22
- declare function registerCssModules(maps: ModuleMaps): Promise<void>;
23
- //#endregion
24
- export { MODULE_STYLES_URL, ModuleMaps, buildModuleCss, isModuleCss, moduleJs, registerCssModules, rolldownCssModulesPlugin, stableKey, transformCssModule };
22
+ export declare function registerCssModules(maps: ModuleMaps): Promise<void>;
23
+ //#endregion
package/dist/css.d.ts CHANGED
@@ -1,14 +1,13 @@
1
1
  import { Targets } from "lightningcss";
2
2
  //#region src/css.d.ts
3
- declare const STYLES_URL = "/_june/global.css";
4
- declare function findGlobalCss(appDir: string): string | null;
5
- declare function globalCssUsesTailwind(appDir: string): boolean;
6
- declare function cssTargets(appDir: string): Promise<Targets>;
7
- declare function processCssCached(appDir: string): Promise<string | null>;
8
- declare function invalidateCss(): void;
9
- declare function minifyCss(css: string, filename?: string, targets?: Targets): Promise<string>;
10
- declare function processCss(appDir: string, opts?: {
3
+ export declare const STYLES_URL = "/_june/global.css";
4
+ export declare function findGlobalCss(appDir: string): string | null;
5
+ export declare function globalCssUsesTailwind(appDir: string): boolean;
6
+ export declare function cssTargets(appDir: string): Promise<Targets>;
7
+ export declare function processCssCached(appDir: string): Promise<string | null>;
8
+ export declare function invalidateCss(): void;
9
+ export declare function minifyCss(css: string, filename?: string, targets?: Targets): Promise<string>;
10
+ export declare function processCss(appDir: string, opts?: {
11
11
  minify?: boolean;
12
12
  }): Promise<string | null>;
13
- //#endregion
14
- export { STYLES_URL, cssTargets, findGlobalCss, globalCssUsesTailwind, invalidateCss, minifyCss, processCss, processCssCached };
13
+ //#endregion
@@ -1,7 +1,7 @@
1
1
  import { n as MigrateResult } from "./migrate-BbWt-PuB.js";
2
2
  import { JuneDb } from "@junejs/core/resources";
3
3
  //#region src/d1-migrate.d.ts
4
- type D1Exec = (req: {
4
+ export type D1Exec = (req: {
5
5
  sql: string;
6
6
  mode: "command" | "file";
7
7
  json: boolean;
@@ -10,16 +10,16 @@ type D1Exec = (req: {
10
10
  stderr: string;
11
11
  exitCode: number;
12
12
  }>;
13
- declare function inlineParams(sql: string, params: readonly unknown[]): string;
14
- declare function wranglerD1(opts: {
13
+ export declare function inlineParams(sql: string, params: readonly unknown[]): string;
14
+ export declare function wranglerD1(opts: {
15
15
  database: string;
16
16
  configPath: string;
17
17
  cwd: string;
18
18
  wranglerVersion?: string;
19
19
  exec?: D1Exec;
20
20
  }): JuneDb;
21
- declare function resolveD1Database(appRoot: string, configPath: string): Promise<string | null>;
22
- declare function migrateD1(opts: {
21
+ export declare function resolveD1Database(appRoot: string, configPath: string): Promise<string | null>;
22
+ export declare function migrateD1(opts: {
23
23
  appRoot: string;
24
24
  database: string;
25
25
  configPath: string;
@@ -27,5 +27,4 @@ declare function migrateD1(opts: {
27
27
  exec?: D1Exec;
28
28
  now?: string;
29
29
  }): Promise<MigrateResult>;
30
- //#endregion
31
- export { D1Exec, inlineParams, migrateD1, resolveD1Database, wranglerD1 };
30
+ //#endregion
@@ -142,12 +142,13 @@ async function resolveD1Database(appRoot, configPath) {
142
142
  return `${(pkgName ?? basename(appRoot)).replace(/[^a-z0-9-]/gi, "-").toLowerCase()}-db`;
143
143
  }
144
144
  async function migrateD1(opts) {
145
- return migrate(wranglerD1({
145
+ const db = wranglerD1({
146
146
  database: opts.database,
147
147
  configPath: opts.configPath,
148
148
  cwd: opts.appRoot,
149
149
  exec: opts.exec
150
- }), join(opts.appRoot, "db", "migrations"), {
150
+ });
151
+ return migrate(db, join(opts.appRoot, "db", "migrations"), {
151
152
  allowDestructive: opts.allowDestructive,
152
153
  now: opts.now
153
154
  });
package/dist/db.d.ts CHANGED
@@ -4,8 +4,8 @@ import { n as mysql, r as mysqlJuneDb, t as MysqlConnLike } from "./mysql-driver
4
4
  import { i as turso, r as libsqlJuneDb, t as LibsqlClientLike } from "./turso-driver-C1wEigMZ.js";
5
5
  import { DbFactory } from "@junejs/core/resources";
6
6
  //#region src/db.d.ts
7
- declare function sqlite(opts?: {
7
+ export declare function sqlite(opts?: {
8
8
  path?: string;
9
9
  }): DbFactory;
10
10
  //#endregion
11
- export { type D1Database, type LibsqlClientLike, type MysqlConnLike, type PgClientLike, d1, libsqlJuneDb, mysql, mysqlJuneDb, pgJuneDb, postgres, sqlite, turso };
11
+ export { type D1Database, type LibsqlClientLike, type MysqlConnLike, type PgClientLike, d1, libsqlJuneDb, mysql, mysqlJuneDb, pgJuneDb, postgres, turso };
package/dist/deploy.d.ts CHANGED
@@ -5,7 +5,7 @@ type CliRun = (args: string[], cwd: string) => Promise<{
5
5
  stderr: string;
6
6
  exitCode: number;
7
7
  }>;
8
- type DeployResult = {
8
+ export type DeployResult = {
9
9
  url: string | null;
10
10
  dryRun: boolean;
11
11
  configPath: string;
@@ -20,6 +20,5 @@ type DeployOptions = {
20
20
  d1Exec?: D1Exec;
21
21
  runCli?: CliRun;
22
22
  };
23
- declare function juneDeploy(appRoot: string, options?: DeployOptions): Promise<DeployResult>;
24
- //#endregion
25
- export { DeployResult, juneDeploy };
23
+ export declare function juneDeploy(appRoot: string, options?: DeployOptions): Promise<DeployResult>;
24
+ //#endregion
package/dist/deploy.js CHANGED
@@ -49,6 +49,7 @@ async function deployStatic(appRoot) {
49
49
  migrated: []
50
50
  };
51
51
  }
52
+ const DENO_CREATE_HINT = "first deploy? provision the app in dynamic mode (auto-detect won't find an entrypoint):\n deno deploy create --org=<org> --app=<app> --source=local \\\n --do-not-use-detected-build-config --runtime-mode=dynamic --entrypoint=worker.js";
52
53
  async function deployDeno(appRoot, cfg, options, run) {
53
54
  const dist = join(appRoot, "dist");
54
55
  if (!existsSync(join(dist, "worker.js"))) throw new Error(`no built bundle (expected ${join(dist, "worker.js")}) — run june build first`);
@@ -68,8 +69,8 @@ async function deployDeno(appRoot, cfg, options, run) {
68
69
  if (stdout.trim()) console.log(stdout.trimEnd());
69
70
  if (exitCode !== 0) {
70
71
  const out = stderr + stdout;
71
- if (/token|login|unauthorized|forbidden|organization was not found|app.*not found/i.test(out)) throw new Error("Deno Deploy auth/org failed — set DENO_DEPLOY_TOKEN (or `deno deploy login`) and the\n org/app in deno({ org, app }).\n first deploy? provision the app in dynamic mode (auto-detect won't find an entrypoint):\n deno deploy create --org=<org> --app=<app> --source=local \\\n --do-not-use-detected-build-config --runtime-mode=dynamic --entrypoint=worker.js\n" + stderr.trim());
72
- if (/no runtime entrypoint|build config/i.test(out)) throw new Error("Deno Deploy build failed — first deploy? provision the app in dynamic mode (auto-detect won't find an entrypoint):\n deno deploy create --org=<org> --app=<app> --source=local \\\n --do-not-use-detected-build-config --runtime-mode=dynamic --entrypoint=worker.js\n" + stderr.trim());
72
+ if (/token|login|unauthorized|forbidden|organization was not found|app.*not found/i.test(out)) throw new Error("Deno Deploy auth/org failed — set DENO_DEPLOY_TOKEN (or `deno deploy login`) and the\n org/app in deno({ org, app }).\n " + DENO_CREATE_HINT + "\n" + stderr.trim());
73
+ if (/no runtime entrypoint|build config/i.test(out)) throw new Error("Deno Deploy build failed — " + DENO_CREATE_HINT + "\n" + stderr.trim());
73
74
  throw new Error(`deno deploy failed (exit ${exitCode})\n${stderr.trim()}`);
74
75
  }
75
76
  return {
@@ -1,5 +1,4 @@
1
1
  //#region src/dev-reload.d.ts
2
- declare function notifyCssChange(): void;
3
- declare function withLiveReload(fetchApp: (req: Request) => Promise<Response>): (req: Request) => Promise<Response>;
4
- //#endregion
5
- export { notifyCssChange, withLiveReload };
2
+ export declare function notifyCssChange(): void;
3
+ export declare function withLiveReload(fetchApp: (req: Request) => Promise<Response>): (req: Request) => Promise<Response>;
4
+ //#endregion
package/dist/dev.d.ts CHANGED
@@ -1,13 +1,12 @@
1
1
  import { JuneHost, ServeHandle } from "./host.js";
2
2
  //#region src/dev.d.ts
3
- type DevServerOptions = {
3
+ export type DevServerOptions = {
4
4
  appDir: string;
5
5
  port?: number;
6
6
  host?: JuneHost;
7
7
  };
8
- type DevServer = ServeHandle & {
8
+ export type DevServer = ServeHandle & {
9
9
  url: string;
10
10
  };
11
- declare function startDevServer({ appDir, port, host }: DevServerOptions): Promise<DevServer>;
12
- //#endregion
13
- export { DevServer, DevServerOptions, startDevServer };
11
+ export declare function startDevServer({ appDir, port, host }: DevServerOptions): Promise<DevServer>;
12
+ //#endregion
package/dist/favicon.d.ts CHANGED
@@ -1,26 +1,26 @@
1
1
  import { DocumentConfig } from "@junejs/core/document";
2
2
  //#region src/favicon.d.ts
3
3
  type Site = DocumentConfig["site"];
4
- declare const ICON_BG = "#1d1d1f";
5
- declare const ICON_FG = "#fbfbf8";
6
- declare const GENERATED_ICONS: readonly ["apple-touch-icon.png", "icon.png", "favicon.ico", "icon-192.png", "icon-512.png"];
7
- type GeneratedIconFile = (typeof GENERATED_ICONS)[number];
8
- declare function publicFileCheck(publicDir: string): (file: string) => boolean;
9
- declare function resolveIcons(site: Site, inPublic: (file: string) => boolean): {
4
+ export declare const ICON_BG = "#1d1d1f";
5
+ export declare const ICON_FG = "#fbfbf8";
6
+ export declare const GENERATED_ICONS: readonly ["apple-touch-icon.png", "icon.png", "favicon.ico", "icon-192.png", "icon-512.png"];
7
+ export type GeneratedIconFile = (typeof GENERATED_ICONS)[number];
8
+ export declare function publicFileCheck(publicDir: string): (file: string) => boolean;
9
+ export declare function resolveIcons(site: Site, inPublic: (file: string) => boolean): {
10
10
  generate: boolean;
11
11
  icons: NonNullable<DocumentConfig["icons"]>;
12
12
  };
13
- declare function hanFamily(lang: string | undefined): string;
14
- declare function iconFamily(ch: string, lang: string | undefined): string | null | undefined;
15
- type FontFetcher = (family: string, text: string) => Promise<Uint8Array | null>;
16
- declare function googleFontFetcher(cacheDir: string, opts?: {
13
+ export declare function hanFamily(lang: string | undefined): string;
14
+ export declare function iconFamily(ch: string, lang: string | undefined): string | null | undefined;
15
+ export type FontFetcher = (family: string, text: string) => Promise<Uint8Array | null>;
16
+ export declare function googleFontFetcher(cacheDir: string, opts?: {
17
17
  fetch?: typeof fetch;
18
18
  timeoutMs?: number;
19
19
  }): FontFetcher;
20
- declare const INK_H = 28;
21
- declare const INK_W = 40;
22
- declare function pngToIco(png: Uint8Array, size: number): Uint8Array<ArrayBuffer>;
23
- type GeneratedIcons = {
20
+ export declare const INK_H = 28;
21
+ export declare const INK_W = 40;
22
+ export declare function pngToIco(png: Uint8Array, size: number): Uint8Array<ArrayBuffer>;
23
+ export type GeneratedIcons = {
24
24
  "apple-touch-icon.png": Uint8Array<ArrayBuffer>;
25
25
  "icon.png": Uint8Array<ArrayBuffer>;
26
26
  "favicon.ico": Uint8Array<ArrayBuffer>;
@@ -29,10 +29,9 @@ type GeneratedIcons = {
29
29
  letter: string;
30
30
  family: string | null;
31
31
  };
32
- declare function renderIcons(opts: {
32
+ export declare function renderIcons(opts: {
33
33
  site: Site;
34
34
  fetchFont: FontFetcher;
35
35
  warn?: (msg: string) => void;
36
36
  }): Promise<GeneratedIcons>;
37
- //#endregion
38
- export { FontFetcher, GENERATED_ICONS, GeneratedIconFile, GeneratedIcons, ICON_BG, ICON_FG, INK_H, INK_W, googleFontFetcher, hanFamily, iconFamily, pngToIco, publicFileCheck, renderIcons, resolveIcons };
37
+ //#endregion
package/dist/host.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import { JuneDb, RunResult } from "@junejs/core/resources";
2
2
  //#region src/host.d.ts
3
- type ServeHandle = {
3
+ export type ServeHandle = {
4
4
  port: number;
5
5
  stop(force?: boolean): void;
6
6
  };
7
- type SpawnedModule = {
7
+ export type SpawnedModule = {
8
8
  stdout: ReadableStream<Uint8Array>;
9
9
  stderrText(): Promise<string>;
10
10
  exited: Promise<number>;
11
11
  };
12
- interface JuneHost {
12
+ export interface JuneHost {
13
13
  readonly name: "bun" | "node";
14
14
  serve(handler: (req: Request) => Promise<Response>, opts: {
15
15
  port: number;
@@ -20,6 +20,6 @@ interface JuneHost {
20
20
  }): SpawnedModule;
21
21
  openDb(path: string): Promise<JuneDb>;
22
22
  }
23
- declare const host: JuneHost;
23
+ export declare const host: JuneHost;
24
24
  //#endregion
25
- export { type JuneDb, JuneHost, type RunResult, ServeHandle, SpawnedModule, host };
25
+ export type { JuneDb, RunResult };
@@ -1,4 +1,3 @@
1
1
  //#region src/icon-letter.d.ts
2
- declare function iconLetter(name: string | undefined): string;
3
- //#endregion
4
- export { iconLetter };
2
+ export declare function iconLetter(name: string | undefined): string;
3
+ //#endregion
package/dist/index.d.ts CHANGED
@@ -4,10 +4,10 @@ import { CreateAppOptions, JuneApp, createApp } from "./app.js";
4
4
  import { R2Bucket, localBlob, r2 } from "./blob.js";
5
5
  import { r as scanRoutes } from "./route-scan-DMlwoESy.js";
6
6
  import { t as generateContent } from "./content-freeze-CyiW2fRK.js";
7
- import { a as Pipeline, d as createPipeline, n as LayoutComponent, o as PipelineConfig, s as Resolved, u as RouteResolver } from "./pipeline-cCR6MGNK.js";
8
- import { n as WorkerManifest, r as createWorker } from "./worker-BkFHGtxp.js";
9
- import { t as freezeConfig } from "./config-freeze-DwI-Rmvq.js";
10
- import { n as buildManifest } from "./manifest-gcNWqWoI.js";
7
+ import { a as Pipeline, d as createPipeline, n as LayoutComponent, o as PipelineConfig, s as Resolved, u as RouteResolver } from "./pipeline-BHUjBO0G.js";
8
+ import { n as WorkerManifest, r as createWorker } from "./worker-Dv4l6Ybs.js";
9
+ import { t as freezeConfig } from "./config-freeze-ZWC_Qd4h.js";
10
+ import { n as buildManifest } from "./manifest-DSNX4I-G.js";
11
11
  import { BuildResult, juneBuild } from "./build.js";
12
12
  import { loadJuneConfig } from "./config-loader.js";
13
13
  import { AccountTokenStore, BetterAuthLike, ConnectionAuth, LinkedAccountAuthOptions, betterAuthAccessToken, betterAuthAccountTokenStore, linkedAccountAuth } from "./connection-auth.js";
@@ -1,4 +1,3 @@
1
1
  //#region src/instrumentation.d.ts
2
- declare function installAsyncContext(): Promise<boolean>;
3
- //#endregion
4
- export { installAsyncContext };
2
+ export declare function installAsyncContext(): Promise<boolean>;
3
+ //#endregion
@@ -4,7 +4,8 @@ let installed = false;
4
4
  async function installAsyncContext() {
5
5
  if (installed) return true;
6
6
  try {
7
- installTraceContext(new (await (import("node:async_hooks"))).AsyncLocalStorage());
7
+ const mod = await import("node:async_hooks");
8
+ installTraceContext(new mod.AsyncLocalStorage());
8
9
  installed = true;
9
10
  return true;
10
11
  } catch {
@@ -1,8 +1,7 @@
1
1
  //#region src/island-registry.d.ts
2
- declare const ISLAND_REGISTRY_FILE = "_islands.gen.ts";
3
- declare function walk(dir: string): string[];
4
- declare function firstStatementIsDirective(src: string, directive: string): boolean;
5
- declare function exportNames(src: string): string[];
6
- declare function generateIslandRegistry(appDir: string): Promise<number>;
7
- //#endregion
8
- export { ISLAND_REGISTRY_FILE, exportNames, firstStatementIsDirective, generateIslandRegistry, walk };
2
+ export declare const ISLAND_REGISTRY_FILE = "_islands.gen.ts";
3
+ export declare function walk(dir: string): string[];
4
+ export declare function firstStatementIsDirective(src: string, directive: string): boolean;
5
+ export declare function exportNames(src: string): string[];
6
+ export declare function generateIslandRegistry(appDir: string): Promise<number>;
7
+ //#endregion
@@ -1,6 +1,5 @@
1
1
  //#region src/isolate-local.d.ts
2
- type IsolateLocal = <T>(key: string | symbol, make: () => T) => T;
3
- declare function makeIsolateLocalFallback(): IsolateLocal;
4
- declare const isolateLocal: IsolateLocal;
5
- //#endregion
6
- export { IsolateLocal, isolateLocal, makeIsolateLocalFallback };
2
+ export type IsolateLocal = <T>(key: string | symbol, make: () => T) => T;
3
+ export declare function makeIsolateLocalFallback(): IsolateLocal;
4
+ export declare const isolateLocal: IsolateLocal;
5
+ //#endregion
package/dist/kv.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { KvFactory } from "@junejs/core/resources";
2
2
  //#region src/kv.d.ts
3
- declare function memoryKv(): KvFactory;
4
- declare function redisKv(opts: {
3
+ export declare function memoryKv(): KvFactory;
4
+ export declare function redisKv(opts: {
5
5
  url: string;
6
6
  }): KvFactory;
7
- //#endregion
8
- export { memoryKv, redisKv };
7
+ //#endregion
@@ -0,0 +1,9 @@
1
+ import { u as RouteResolver } from "./pipeline-BHUjBO0G.js";
2
+ import { LlmsLink, SitemapPage } from "@junejs/core/discovery";
3
+ //#region src/llms-links.d.ts
4
+ export declare function collectLlmsLinks(origin: string, routes: string[], resolve: RouteResolver): Promise<LlmsLink[]>;
5
+ export declare function collectSitemapPages(routes: string[], resolve: RouteResolver, opts?: {
6
+ i18n?: boolean;
7
+ staticPaths?: boolean;
8
+ }): Promise<SitemapPage[]>;
9
+ //#endregion
@@ -0,0 +1,65 @@
1
+ //#region src/llms-links.ts
2
+ const DEFAULT_SECTION = "Pages";
3
+ const mdPath = (path) => path === "/" ? "/index.md" : `${path.replace(/\/+$/, "")}.md`;
4
+ async function collectLlmsLinks(origin, routes, resolve) {
5
+ const links = [];
6
+ const seen = /* @__PURE__ */ new Set();
7
+ for (const route of routes) {
8
+ const resolved = await resolve(route);
9
+ if (!resolved || !("def" in resolved)) continue;
10
+ const { def } = resolved;
11
+ if (def.llms === false) continue;
12
+ const dynamic = route.includes("[");
13
+ const declared = typeof def.llms === "function" ? await def.llms() : def.llms;
14
+ const entries = declared ? Array.isArray(declared) ? declared : [declared] : dynamic ? [] : [{}];
15
+ const meta = typeof def.metadata === "object" ? def.metadata : void 0;
16
+ for (const entry of entries) {
17
+ const path = entry.path ?? (dynamic ? void 0 : route);
18
+ if (!path) continue;
19
+ const url = origin + (def.md === false ? path : mdPath(path));
20
+ if (seen.has(url)) continue;
21
+ seen.add(url);
22
+ const own = path === route;
23
+ links.push({
24
+ title: entry.title ?? (own ? meta?.title : void 0) ?? path,
25
+ url,
26
+ description: entry.description ?? (own ? meta?.description : void 0),
27
+ section: entry.section ?? DEFAULT_SECTION,
28
+ optional: entry.optional === true
29
+ });
30
+ }
31
+ }
32
+ return links;
33
+ }
34
+ async function collectSitemapPages(routes, resolve, opts = {}) {
35
+ const pages = /* @__PURE__ */ new Map();
36
+ const add = (path, lastModified) => {
37
+ const key = path === "/" ? "/" : path.replace(/\/+$/, "");
38
+ const prev = pages.get(key);
39
+ if (!prev) pages.set(key, lastModified ? {
40
+ path: key,
41
+ lastModified
42
+ } : { path: key });
43
+ else if (lastModified && !prev.lastModified) prev.lastModified = lastModified;
44
+ };
45
+ for (const route of routes) {
46
+ const resolved = await resolve(route);
47
+ if (!resolved || !("def" in resolved)) continue;
48
+ const { def } = resolved;
49
+ const dynamic = route.includes("[");
50
+ const declared = def.llms ? typeof def.llms === "function" ? await def.llms() : def.llms : void 0;
51
+ const entries = declared ? Array.isArray(declared) ? declared : [declared] : [];
52
+ if (!dynamic) {
53
+ add(route, entries.find((e) => (e.path ?? route) === route)?.lastModified);
54
+ continue;
55
+ }
56
+ for (const e of entries) if (e.path) add(e.path, e.lastModified);
57
+ if (opts.staticPaths && !opts.i18n && def.staticPaths) {
58
+ const sp = typeof def.staticPaths === "function" ? await def.staticPaths() : def.staticPaths;
59
+ for (const p of sp) add(p);
60
+ }
61
+ }
62
+ return [...pages.values()];
63
+ }
64
+ //#endregion
65
+ export { collectLlmsLinks, collectSitemapPages };
@@ -1,5 +1,5 @@
1
- import { n as LayoutComponent } from "./pipeline-cCR6MGNK.js";
2
- import { n as WorkerManifest } from "./worker-BkFHGtxp.js";
1
+ import { n as LayoutComponent } from "./pipeline-BHUjBO0G.js";
2
+ import { n as WorkerManifest } from "./worker-Dv4l6Ybs.js";
3
3
  //#region src/manifest.d.ts
4
4
  type ImportedLayout = {
5
5
  component: LayoutComponent;
@@ -1,2 +1,2 @@
1
- import { n as buildManifest, r as importLayout, t as ImportedLayout } from "./manifest-gcNWqWoI.js";
1
+ import { n as buildManifest, r as importLayout, t as ImportedLayout } from "./manifest-DSNX4I-G.js";
2
2
  export { ImportedLayout, buildManifest, importLayout };
@@ -1,11 +1,12 @@
1
1
  import { RenderTarget } from "@junejs/core/route";
2
2
  import { FRAGMENT_ACCEPT, SEGMENT_HEADER, TITLE_HEADER, encodeTitle } from "@junejs/core/nav-protocol";
3
3
  //#region src/negotiate.d.ts
4
- type Negotiated = {
4
+ export declare function acceptTarget(accept: string): RenderTarget | null;
5
+ export type Negotiated = {
5
6
  target: RenderTarget;
6
7
  pathname: string;
7
8
  speculative: boolean;
8
9
  };
9
- declare function negotiate(url: URL, request: Request, basePath?: string): Negotiated;
10
+ export declare function negotiate(url: URL, request: Request, basePath?: string): Negotiated;
10
11
  //#endregion
11
- export { FRAGMENT_ACCEPT, Negotiated, SEGMENT_HEADER, TITLE_HEADER, encodeTitle, negotiate };
12
+ export { FRAGMENT_ACCEPT, SEGMENT_HEADER, TITLE_HEADER, encodeTitle };
package/dist/negotiate.js CHANGED
@@ -1,14 +1,30 @@
1
- import { FRAGMENT_ACCEPT, SEGMENT_HEADER, TITLE_HEADER, encodeTitle } from "@junejs/core/nav-protocol";
1
+ import { FRAGMENT_ACCEPT, FRAGMENT_ACCEPT as FRAGMENT_ACCEPT$1, SEGMENT_HEADER, TITLE_HEADER, encodeTitle } from "@junejs/core/nav-protocol";
2
2
  //#region src/negotiate.ts
3
3
  const EXT_TARGET = {
4
4
  ".json": "json",
5
5
  ".md": "md"
6
6
  };
7
- const ACCEPT_TARGET = [
8
- [/text\/vnd\.june\.fragment\+html/, "fragment"],
9
- [/text\/markdown/, "md"],
10
- [/application\/json/, "json"]
11
- ];
7
+ const QVALUE = /^(?:0(?:\.\d{0,3})?|1(?:\.0{0,3})?)$/;
8
+ function acceptRanges(accept) {
9
+ const ranges = /* @__PURE__ */ new Map();
10
+ for (const part of accept.split(",")) {
11
+ const [type, ...params] = part.split(";").map((s) => s.trim().toLowerCase());
12
+ if (!type) continue;
13
+ const raw = params.find((p) => p.startsWith("q="))?.slice(2).trim();
14
+ ranges.set(type, raw !== void 0 && QVALUE.test(raw) ? Number(raw) : 1);
15
+ }
16
+ return ranges;
17
+ }
18
+ function acceptTarget(accept) {
19
+ const ranges = acceptRanges(accept);
20
+ if ((ranges.get(FRAGMENT_ACCEPT$1) ?? 0) > 0) return "fragment";
21
+ const html = ranges.get("text/html") ?? ranges.get("text/*") ?? ranges.get("*/*") ?? 0;
22
+ const md = ranges.get("text/markdown") ?? 0;
23
+ const json = ranges.get("application/json") ?? 0;
24
+ const best = Math.max(md, json);
25
+ if (best <= 0 || best < html) return null;
26
+ return md >= json ? "md" : "json";
27
+ }
12
28
  function negotiate(url, request, basePath) {
13
29
  const original = basePath ?? url.pathname;
14
30
  let pathname = original;
@@ -20,13 +36,7 @@ function negotiate(url, request, basePath) {
20
36
  }
21
37
  if (pathname === "/index") pathname = "/";
22
38
  else if (target && pathname === "/") pathname = original;
23
- if (!target) {
24
- const accept = request.headers.get("accept") ?? "";
25
- for (const [re, t] of ACCEPT_TARGET) if (re.test(accept)) {
26
- target = t;
27
- break;
28
- }
29
- }
39
+ if (!target) target = acceptTarget(request.headers.get("accept") ?? "");
30
40
  const purpose = request.headers.get("sec-purpose") ?? "";
31
41
  const speculative = /prefetch|prerender/.test(purpose);
32
42
  return {
@@ -36,4 +46,4 @@ function negotiate(url, request, basePath) {
36
46
  };
37
47
  }
38
48
  //#endregion
39
- export { FRAGMENT_ACCEPT, SEGMENT_HEADER, TITLE_HEADER, encodeTitle, negotiate };
49
+ export { FRAGMENT_ACCEPT, SEGMENT_HEADER, TITLE_HEADER, acceptTarget, encodeTitle, negotiate };
@@ -31,6 +31,7 @@ type PipelineConfig = {
31
31
  i18n?: I18nConfig;
32
32
  routeList: () => Promise<string[]> | string[];
33
33
  resolve: RouteResolver;
34
+ staticBuild?: boolean;
34
35
  resources?: () => Promise<Resources> | Resources;
35
36
  services?: () => Promise<unknown> | unknown;
36
37
  identity?: (request: Request) => Promise<{
@@ -53,6 +54,9 @@ type ExtraHandler = MiddlewareHandler;
53
54
  type Pipeline = {
54
55
  fetch(request: Request): Promise<Response>;
55
56
  };
57
+ declare function markdownPath(pathname: string, isHome: boolean): string;
58
+ declare function htmlPath(pathname: string, isHome: boolean): string;
59
+ declare function isDecodablePath(pathname: string): boolean;
56
60
  declare function createPipeline(cfg: PipelineConfig): Pipeline;
57
61
  //#endregion
58
- export { Pipeline as a, ResolvedResource as c, createPipeline as d, MiddlewareHandler as i, ResourceHandler as l, LayoutComponent as n, PipelineConfig as o, LoadingComponent as r, Resolved as s, ExtraHandler as t, RouteResolver as u };
62
+ export { Pipeline as a, ResolvedResource as c, createPipeline as d, htmlPath as f, MiddlewareHandler as i, ResourceHandler as l, markdownPath as m, LayoutComponent as n, PipelineConfig as o, isDecodablePath as p, LoadingComponent as r, Resolved as s, ExtraHandler as t, RouteResolver as u };
@@ -1,2 +1,2 @@
1
- import { a as Pipeline, c as ResolvedResource, d as createPipeline, i as MiddlewareHandler, l as ResourceHandler, n as LayoutComponent, o as PipelineConfig, r as LoadingComponent, s as Resolved, t as ExtraHandler, u as RouteResolver } from "./pipeline-cCR6MGNK.js";
2
- export { ExtraHandler, LayoutComponent, LoadingComponent, MiddlewareHandler, Pipeline, PipelineConfig, Resolved, ResolvedResource, ResourceHandler, RouteResolver, createPipeline };
1
+ import { a as Pipeline, c as ResolvedResource, d as createPipeline, f as htmlPath, i as MiddlewareHandler, l as ResourceHandler, m as markdownPath, n as LayoutComponent, o as PipelineConfig, p as isDecodablePath, r as LoadingComponent, s as Resolved, t as ExtraHandler, u as RouteResolver } from "./pipeline-BHUjBO0G.js";
2
+ export { ExtraHandler, LayoutComponent, LoadingComponent, MiddlewareHandler, Pipeline, PipelineConfig, Resolved, ResolvedResource, ResourceHandler, RouteResolver, createPipeline, htmlPath, isDecodablePath, markdownPath };