@junejs/server 0.1.0-dev.4 → 0.1.0-dev.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.
Files changed (96) hide show
  1. package/dist/adapter.d.ts +55 -0
  2. package/dist/adapter.js +204 -0
  3. package/dist/agent-discover.d.ts +5 -0
  4. package/dist/agent-discover.js +75 -0
  5. package/dist/agent-durable.d.ts +60 -0
  6. package/dist/agent-durable.js +106 -0
  7. package/dist/agent-native.d.ts +40 -0
  8. package/dist/agent-native.js +179 -0
  9. package/dist/app.d.ts +15 -0
  10. package/dist/app.js +218 -0
  11. package/dist/blob.d.ts +23 -0
  12. package/dist/blob.js +78 -0
  13. package/dist/build.d.ts +40 -0
  14. package/dist/build.js +551 -0
  15. package/dist/client-bundle.d.ts +15 -0
  16. package/dist/client-bundle.js +91 -0
  17. package/dist/config-loader.d.ts +9 -0
  18. package/dist/config-loader.js +25 -0
  19. package/dist/content.d.ts +39 -0
  20. package/dist/content.js +201 -0
  21. package/dist/css-modules-ambient.d.ts +10 -0
  22. package/dist/css-modules.d.ts +24 -0
  23. package/dist/css-modules.js +127 -0
  24. package/dist/css.d.ts +14 -0
  25. package/dist/css.js +114 -0
  26. package/dist/d1-BkdUg9kg.d.ts +24 -0
  27. package/dist/d1-migrate.d.ts +31 -0
  28. package/dist/d1-migrate.js +156 -0
  29. package/dist/d1.d.ts +2 -0
  30. package/dist/d1.js +32 -0
  31. package/dist/db.d.ts +11 -0
  32. package/dist/db.js +20 -0
  33. package/dist/deploy.d.ts +25 -0
  34. package/dist/deploy.js +158 -0
  35. package/dist/dev-reload.d.ts +5 -0
  36. package/dist/dev-reload.js +123 -0
  37. package/dist/dev.d.ts +13 -0
  38. package/dist/dev.js +55 -0
  39. package/dist/host.d.ts +25 -0
  40. package/dist/host.js +107 -0
  41. package/dist/index.d.ts +26 -0
  42. package/dist/index.js +26 -0
  43. package/dist/instrumentation.d.ts +4 -0
  44. package/dist/instrumentation.js +15 -0
  45. package/dist/island-registry.d.ts +8 -0
  46. package/dist/island-registry.js +117 -0
  47. package/dist/kv.d.ts +8 -0
  48. package/dist/kv.js +35 -0
  49. package/dist/migrate-BbWt-PuB.d.ts +32 -0
  50. package/dist/migrate.d.ts +2 -0
  51. package/dist/migrate.js +115 -0
  52. package/dist/mysql-driver-BsrWVqbp.d.ts +12 -0
  53. package/dist/mysql-driver.d.ts +2 -0
  54. package/dist/mysql-driver.js +52 -0
  55. package/dist/negotiate.d.ts +11 -0
  56. package/dist/negotiate.js +39 -0
  57. package/dist/pipeline-B2V6tKfO.d.ts +49 -0
  58. package/dist/pipeline.d.ts +2 -0
  59. package/dist/pipeline.js +235 -0
  60. package/dist/postgres-driver-DkkBFikA.d.ts +15 -0
  61. package/dist/postgres-driver.d.ts +2 -0
  62. package/dist/postgres-driver.js +50 -0
  63. package/dist/resources.d.ts +15 -0
  64. package/dist/resources.js +31 -0
  65. package/dist/router.d.ts +32 -0
  66. package/dist/router.js +183 -0
  67. package/dist/rsc-build.d.ts +17 -0
  68. package/dist/rsc-build.js +68 -0
  69. package/dist/rsc-bundle.d.ts +8 -0
  70. package/dist/rsc-bundle.js +39 -0
  71. package/dist/rsc-manifest.d.ts +8 -0
  72. package/dist/rsc-manifest.js +67 -0
  73. package/dist/rsc-runtime/flight-render-routes.d.ts +5 -0
  74. package/dist/rsc-runtime/flight-render-routes.js +26 -0
  75. package/dist/rsc-runtime/flight-render.d.ts +4 -0
  76. package/dist/rsc-runtime/flight-render.js +21 -0
  77. package/dist/rsc-runtime/flight-to-html.d.ts +4 -0
  78. package/dist/rsc-runtime/flight-to-html.js +32 -0
  79. package/dist/rsc-runtime/rsc-worker.d.ts +6 -0
  80. package/dist/rsc-runtime/rsc-worker.js +46 -0
  81. package/dist/rsc-runtime/rsdw-shims.d.ts +42 -0
  82. package/dist/segment.d.ts +14 -0
  83. package/dist/segment.js +33 -0
  84. package/dist/sqlite-driver.d.ts +25 -0
  85. package/dist/sqlite-driver.js +102 -0
  86. package/dist/tsconfig-jsx.d.ts +15 -0
  87. package/dist/tsconfig-jsx.js +35 -0
  88. package/dist/turso-driver-C1wEigMZ.d.ts +22 -0
  89. package/dist/turso-driver.d.ts +2 -0
  90. package/dist/turso-driver.js +68 -0
  91. package/dist/worker.d.ts +55 -0
  92. package/dist/worker.js +209 -0
  93. package/package.json +115 -23
  94. package/src/adapter.ts +4 -4
  95. package/src/client-bundle.ts +3 -1
  96. package/src/rsc-bundle.ts +3 -2
@@ -0,0 +1,68 @@
1
+ //#region src/turso-driver.ts
2
+ function libsqlJuneDb(client) {
3
+ const self = {
4
+ dialect: "sqlite",
5
+ async query(sql, params = []) {
6
+ return (await client.execute({
7
+ sql,
8
+ args: params
9
+ })).rows;
10
+ },
11
+ async get(sql, params = []) {
12
+ return (await client.execute({
13
+ sql,
14
+ args: params
15
+ })).rows[0] ?? void 0;
16
+ },
17
+ async run(sql, params = []) {
18
+ const r = await client.execute({
19
+ sql,
20
+ args: params
21
+ });
22
+ return {
23
+ changes: r.rowsAffected ?? 0,
24
+ lastInsertRowid: Number(r.lastInsertRowid ?? 0)
25
+ };
26
+ },
27
+ async exec(sql) {
28
+ if (client.executeMultiple) await client.executeMultiple(sql);
29
+ else await client.execute(sql);
30
+ },
31
+ async transaction(fn) {
32
+ await client.execute("BEGIN");
33
+ try {
34
+ const out = await fn(self);
35
+ await client.execute("COMMIT");
36
+ return out;
37
+ } catch (e) {
38
+ await client.execute("ROLLBACK");
39
+ throw e;
40
+ }
41
+ },
42
+ async close() {
43
+ await client.close();
44
+ }
45
+ };
46
+ return self;
47
+ }
48
+ function turso(opts = {}) {
49
+ return {
50
+ kind: "turso",
51
+ open: async () => {
52
+ const url = opts.url ?? readEnv("TURSO_DATABASE_URL");
53
+ const authToken = opts.authToken ?? readEnv("TURSO_AUTH_TOKEN");
54
+ if (!url) throw new Error("turso(): no database url — pass { url } or set TURSO_DATABASE_URL in the environment.");
55
+ const mod = await import("@libsql/client/web");
56
+ const createClient = (mod.default ?? mod).createClient;
57
+ return libsqlJuneDb(createClient({
58
+ url,
59
+ authToken
60
+ }));
61
+ }
62
+ };
63
+ }
64
+ function readEnv(name) {
65
+ return typeof process !== "undefined" && process.env ? process.env[name] : void 0;
66
+ }
67
+ //#endregion
68
+ export { libsqlJuneDb, turso };
@@ -0,0 +1,55 @@
1
+ import { l as ResourceHandler, n as LayoutComponent, r as LoadingComponent, t as ExtraHandler } from "./pipeline-B2V6tKfO.js";
2
+ import { BrandedRoute } from "@junejs/core/route";
3
+ import { AgentConfig } from "@junejs/core/config";
4
+ import React from "react";
5
+ import { DocumentConfig } from "@junejs/core/document";
6
+ import { I18nConfig } from "@junejs/core/i18n";
7
+ import { Resources } from "@junejs/core/resources";
8
+ //#region src/worker.d.ts
9
+ type WorkerManifest = {
10
+ routes: Record<string, BrandedRoute>;
11
+ dynamicRoutes?: Array<{
12
+ pattern: string;
13
+ def: BrandedRoute;
14
+ }>;
15
+ resourceRoutes?: Array<{
16
+ pattern: string;
17
+ handler: ResourceHandler;
18
+ }>;
19
+ layoutChains?: Record<string, LayoutComponent[]>;
20
+ layoutBoundaries?: Record<string, {
21
+ index: number;
22
+ key: string;
23
+ }>;
24
+ loadings?: Record<string, LoadingComponent>;
25
+ document: DocumentConfig;
26
+ agent: AgentConfig;
27
+ agentName?: string;
28
+ i18n?: I18nConfig;
29
+ earlyHints?: string[];
30
+ htmlCacheControl?: string;
31
+ notFound?: React.ComponentType<{
32
+ pathname: string;
33
+ }>;
34
+ extra?: ExtraHandler;
35
+ resources?: (env?: unknown) => Promise<Resources> | Resources;
36
+ };
37
+ declare function createWorker(manifest: WorkerManifest): {
38
+ fetch(request: Request, env?: unknown): Promise<Response>;
39
+ };
40
+ type AssetEnv = {
41
+ ASSETS?: {
42
+ fetch(request: Request): Promise<Response>;
43
+ };
44
+ };
45
+ type FetchPipeline = {
46
+ fetch(request: Request, env?: unknown): Promise<Response>;
47
+ };
48
+ declare function withAssets(pipeline: FetchPipeline, opts?: {
49
+ link?: string | null;
50
+ }): {
51
+ fetch(request: Request, env?: AssetEnv): Promise<Response>;
52
+ };
53
+ declare function withDenoAssets(pipeline: FetchPipeline): (request: Request) => Promise<Response>;
54
+ //#endregion
55
+ export { WorkerManifest, createWorker, withAssets, withDenoAssets };
package/dist/worker.js ADDED
@@ -0,0 +1,209 @@
1
+ import { durableAgentSurface } from "./agent-durable.js";
2
+ import { createPipeline } from "./pipeline.js";
3
+ //#region src/worker.ts
4
+ function compilePattern(pattern) {
5
+ const names = [];
6
+ let source = "";
7
+ let allOptional = true;
8
+ for (const seg of pattern.split("/").filter(Boolean)) {
9
+ const oca = seg.match(/^\[\[\.\.\.(\w+)\]\]$/);
10
+ if (oca) {
11
+ names.push(oca[1]);
12
+ source += "(?:/(.+))?";
13
+ continue;
14
+ }
15
+ const ca = seg.match(/^\[\.\.\.(\w+)\]$/);
16
+ if (ca) {
17
+ names.push(ca[1]);
18
+ source += "/(.+)";
19
+ allOptional = false;
20
+ continue;
21
+ }
22
+ const op = seg.match(/^\[\[(\w+)\]\]$/);
23
+ if (op) {
24
+ names.push(op[1]);
25
+ source += "(?:/([^/]+))?";
26
+ continue;
27
+ }
28
+ const p = seg.match(/^\[(\w+)\]$/);
29
+ if (p) {
30
+ names.push(p[1]);
31
+ source += "/([^/]+)";
32
+ allOptional = false;
33
+ continue;
34
+ }
35
+ source += "/" + seg.replace(/[.*+?^${}()|\\]/g, "\\$&");
36
+ allOptional = false;
37
+ }
38
+ if (source === "") return {
39
+ regex: /^\/$/,
40
+ names
41
+ };
42
+ return {
43
+ regex: new RegExp(allOptional ? `^(?:${source}|/)$` : `^${source}$`),
44
+ names
45
+ };
46
+ }
47
+ function createWorker(manifest) {
48
+ const dynamic = (manifest.dynamicRoutes ?? []).map((d) => ({
49
+ ...compilePattern(d.pattern),
50
+ def: d.def,
51
+ pattern: d.pattern
52
+ }));
53
+ const resources = (manifest.resourceRoutes ?? []).map((r) => ({
54
+ ...compilePattern(r.pattern),
55
+ handler: r.handler,
56
+ pattern: r.pattern
57
+ }));
58
+ const routeList = [...Object.keys(manifest.routes), ...(manifest.dynamicRoutes ?? []).map((d) => d.pattern)].sort();
59
+ const chainFor = (key) => manifest.layoutChains?.[key] ?? [];
60
+ const loadingFor = (key) => manifest.loadings?.[key];
61
+ const boundaryFor = (key) => manifest.layoutBoundaries?.[key] ?? null;
62
+ let currentEnv;
63
+ const provider = manifest.resources;
64
+ const agentSurface = manifest.agent.runtime.enabled && manifest.agentName ? (() => {
65
+ const route = durableAgentSurface(() => currentEnv?.AGENT, {
66
+ agentName: manifest.agentName,
67
+ chatPath: manifest.agent.runtime.chat.path
68
+ });
69
+ return (req) => route(req);
70
+ })() : void 0;
71
+ const pipeline = createPipeline({
72
+ docConfig: manifest.document,
73
+ agent: manifest.agent,
74
+ agentSurface,
75
+ i18n: manifest.i18n,
76
+ routeList: () => routeList,
77
+ earlyHints: manifest.earlyHints,
78
+ htmlCacheControl: manifest.htmlCacheControl,
79
+ notFoundComponent: manifest.notFound,
80
+ extra: manifest.extra,
81
+ resources: provider ? () => provider(currentEnv) : void 0,
82
+ resolve: async (pathname) => {
83
+ const staticDef = manifest.routes[pathname];
84
+ if (staticDef) {
85
+ const b = boundaryFor(pathname);
86
+ return {
87
+ def: staticDef,
88
+ params: {},
89
+ chain: chainFor(pathname),
90
+ boundaryIndex: b?.index ?? null,
91
+ boundaryKey: b?.key ?? null,
92
+ loading: loadingFor(pathname)
93
+ };
94
+ }
95
+ for (const d of dynamic) {
96
+ const m = pathname.match(d.regex);
97
+ if (m) {
98
+ const params = Object.fromEntries(d.names.flatMap((n, i) => {
99
+ const v = m[i + 1];
100
+ return v === void 0 ? [] : [[n, decodeURIComponent(v)]];
101
+ }));
102
+ const b = boundaryFor(d.pattern);
103
+ return {
104
+ def: d.def,
105
+ params,
106
+ chain: chainFor(d.pattern),
107
+ boundaryIndex: b?.index ?? null,
108
+ boundaryKey: b?.key ?? null,
109
+ loading: loadingFor(d.pattern)
110
+ };
111
+ }
112
+ }
113
+ for (const r of resources) {
114
+ const m = pathname.match(r.regex);
115
+ if (m) {
116
+ const params = Object.fromEntries(r.names.flatMap((n, i) => {
117
+ const v = m[i + 1];
118
+ return v === void 0 ? [] : [[n, decodeURIComponent(v)]];
119
+ }));
120
+ return {
121
+ handler: r.handler,
122
+ params
123
+ };
124
+ }
125
+ }
126
+ return null;
127
+ }
128
+ });
129
+ return { fetch(request, env) {
130
+ currentEnv = env;
131
+ return pipeline.fetch(request);
132
+ } };
133
+ }
134
+ const estimateTokens = (s) => String(Math.ceil(s.length / 4));
135
+ function withAssets(pipeline, opts = {}) {
136
+ return { async fetch(request, env) {
137
+ const assets = env?.ASSETS;
138
+ const url = new URL(request.url);
139
+ const isPagePath = !/\.[a-z0-9]+$/i.test(url.pathname);
140
+ const accept = request.headers.get("accept") ?? "";
141
+ if (assets && request.method === "GET" && isPagePath && /text\/markdown/.test(accept)) {
142
+ const base = url.pathname === "/" ? "/index" : url.pathname.replace(/\/+$/, "");
143
+ const mdUrl = new URL(url);
144
+ mdUrl.pathname = `${base}.md`;
145
+ const a = await assets.fetch(new Request(mdUrl.toString(), { headers: request.headers }));
146
+ if (a.ok) {
147
+ const body = await a.text();
148
+ const headers = new Headers(a.headers);
149
+ headers.set("content-type", "text/markdown; charset=utf-8");
150
+ headers.set("x-markdown-tokens", estimateTokens(body));
151
+ if (opts.link) headers.set("link", opts.link);
152
+ return new Response(body, {
153
+ status: 200,
154
+ headers
155
+ });
156
+ }
157
+ }
158
+ if (assets) {
159
+ const a = await assets.fetch(request);
160
+ if (a.status !== 404) {
161
+ const ct = a.headers.get("content-type") ?? "";
162
+ const addLink = !!opts.link && ct.includes("text/html") && !a.headers.has("link");
163
+ const immutable = /\.[a-f0-9]{8,}\.(css|js)$/.test(url.pathname);
164
+ if (addLink || immutable) {
165
+ const headers = new Headers(a.headers);
166
+ if (addLink) headers.set("link", opts.link);
167
+ if (immutable) headers.set("cache-control", "public, max-age=31536000, immutable");
168
+ return new Response(a.body, {
169
+ status: a.status,
170
+ headers
171
+ });
172
+ }
173
+ return a;
174
+ }
175
+ }
176
+ return pipeline.fetch(request, env);
177
+ } };
178
+ }
179
+ const ASSET_CONTENT_TYPES = {
180
+ css: "text/css; charset=utf-8",
181
+ js: "text/javascript; charset=utf-8",
182
+ json: "application/json; charset=utf-8",
183
+ map: "application/json; charset=utf-8",
184
+ svg: "image/svg+xml",
185
+ png: "image/png",
186
+ jpg: "image/jpeg",
187
+ jpeg: "image/jpeg",
188
+ webp: "image/webp",
189
+ avif: "image/avif",
190
+ ico: "image/x-icon",
191
+ woff2: "font/woff2",
192
+ woff: "font/woff"
193
+ };
194
+ function withDenoAssets(pipeline) {
195
+ return async (request) => {
196
+ const url = new URL(request.url);
197
+ if (request.method === "GET" && url.pathname.startsWith("/_june/")) try {
198
+ const file = await Deno.readFile(new URL(`./assets${url.pathname}`, import.meta.url));
199
+ const ext = url.pathname.split(".").pop()?.toLowerCase() ?? "";
200
+ return new Response(file, { headers: {
201
+ "content-type": ASSET_CONTENT_TYPES[ext] ?? "application/octet-stream",
202
+ "cache-control": "public, max-age=31536000, immutable"
203
+ } });
204
+ } catch {}
205
+ return pipeline.fetch(request);
206
+ };
207
+ }
208
+ //#endregion
209
+ export { createWorker, withAssets, withDenoAssets };
package/package.json CHANGED
@@ -1,40 +1,132 @@
1
1
  {
2
2
  "name": "@junejs/server",
3
- "version": "0.1.0-dev.4",
3
+ "version": "0.1.0-dev.5",
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",
7
7
  "homepage": "https://june.build",
8
8
  "exports": {
9
- ".": "./src/index.ts",
10
- "./host": "./src/host.ts",
11
- "./agent-native": "./src/agent-native.ts",
12
- "./agent-durable": "./src/agent-durable.ts",
13
- "./agent-discover": "./src/agent-discover.ts",
14
- "./db": "./src/db.ts",
15
- "./kv": "./src/kv.ts",
16
- "./blob": "./src/blob.ts",
17
- "./resources": "./src/resources.ts",
18
- "./config": "./src/config-loader.ts",
19
- "./content": "./src/content.ts",
20
- "./router": "./src/router.ts",
21
- "./instrumentation": "./src/instrumentation.ts",
22
- "./pipeline": "./src/pipeline.ts",
23
- "./worker": "./src/worker.ts",
24
- "./build": "./src/build.ts",
25
- "./deploy": "./src/deploy.ts",
26
- "./dev": "./src/dev.ts"
9
+ ".": {
10
+ "source": "./src/index.ts",
11
+ "bun": "./src/index.ts",
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "./host": {
16
+ "source": "./src/host.ts",
17
+ "bun": "./src/host.ts",
18
+ "types": "./dist/host.d.ts",
19
+ "default": "./dist/host.js"
20
+ },
21
+ "./agent-native": {
22
+ "source": "./src/agent-native.ts",
23
+ "bun": "./src/agent-native.ts",
24
+ "types": "./dist/agent-native.d.ts",
25
+ "default": "./dist/agent-native.js"
26
+ },
27
+ "./agent-durable": {
28
+ "source": "./src/agent-durable.ts",
29
+ "bun": "./src/agent-durable.ts",
30
+ "types": "./dist/agent-durable.d.ts",
31
+ "default": "./dist/agent-durable.js"
32
+ },
33
+ "./agent-discover": {
34
+ "source": "./src/agent-discover.ts",
35
+ "bun": "./src/agent-discover.ts",
36
+ "types": "./dist/agent-discover.d.ts",
37
+ "default": "./dist/agent-discover.js"
38
+ },
39
+ "./db": {
40
+ "source": "./src/db.ts",
41
+ "bun": "./src/db.ts",
42
+ "types": "./dist/db.d.ts",
43
+ "default": "./dist/db.js"
44
+ },
45
+ "./kv": {
46
+ "source": "./src/kv.ts",
47
+ "bun": "./src/kv.ts",
48
+ "types": "./dist/kv.d.ts",
49
+ "default": "./dist/kv.js"
50
+ },
51
+ "./blob": {
52
+ "source": "./src/blob.ts",
53
+ "bun": "./src/blob.ts",
54
+ "types": "./dist/blob.d.ts",
55
+ "default": "./dist/blob.js"
56
+ },
57
+ "./resources": {
58
+ "source": "./src/resources.ts",
59
+ "bun": "./src/resources.ts",
60
+ "types": "./dist/resources.d.ts",
61
+ "default": "./dist/resources.js"
62
+ },
63
+ "./config": {
64
+ "source": "./src/config-loader.ts",
65
+ "bun": "./src/config-loader.ts",
66
+ "types": "./dist/config-loader.d.ts",
67
+ "default": "./dist/config-loader.js"
68
+ },
69
+ "./content": {
70
+ "source": "./src/content.ts",
71
+ "bun": "./src/content.ts",
72
+ "types": "./dist/content.d.ts",
73
+ "default": "./dist/content.js"
74
+ },
75
+ "./router": {
76
+ "source": "./src/router.ts",
77
+ "bun": "./src/router.ts",
78
+ "types": "./dist/router.d.ts",
79
+ "default": "./dist/router.js"
80
+ },
81
+ "./instrumentation": {
82
+ "source": "./src/instrumentation.ts",
83
+ "bun": "./src/instrumentation.ts",
84
+ "types": "./dist/instrumentation.d.ts",
85
+ "default": "./dist/instrumentation.js"
86
+ },
87
+ "./pipeline": {
88
+ "source": "./src/pipeline.ts",
89
+ "bun": "./src/pipeline.ts",
90
+ "types": "./dist/pipeline.d.ts",
91
+ "default": "./dist/pipeline.js"
92
+ },
93
+ "./worker": {
94
+ "source": "./src/worker.ts",
95
+ "bun": "./src/worker.ts",
96
+ "types": "./dist/worker.d.ts",
97
+ "default": "./dist/worker.js"
98
+ },
99
+ "./build": {
100
+ "source": "./src/build.ts",
101
+ "bun": "./src/build.ts",
102
+ "types": "./dist/build.d.ts",
103
+ "default": "./dist/build.js"
104
+ },
105
+ "./deploy": {
106
+ "source": "./src/deploy.ts",
107
+ "bun": "./src/deploy.ts",
108
+ "types": "./dist/deploy.d.ts",
109
+ "default": "./dist/deploy.js"
110
+ },
111
+ "./dev": {
112
+ "source": "./src/dev.ts",
113
+ "bun": "./src/dev.ts",
114
+ "types": "./dist/dev.d.ts",
115
+ "default": "./dist/dev.js"
116
+ }
27
117
  },
28
118
  "files": [
29
- "src"
119
+ "src",
120
+ "dist"
30
121
  ],
31
122
  "scripts": {
32
123
  "test": "bun test",
33
- "typecheck": "tsc --noEmit"
124
+ "typecheck": "tsc --noEmit",
125
+ "build": "tsdown"
34
126
  },
35
127
  "dependencies": {
36
- "@junejs/core": ">=0.1.0-dev.3",
37
- "@junejs/db": ">=0.0.33-dev.0",
128
+ "@junejs/core": ">=0.1.0-dev.4",
129
+ "@junejs/db": ">=0.0.33-dev.1",
38
130
  "@momiji-rs/sparkdown": "^0.0.4",
39
131
  "lightningcss": "^1.27.0",
40
132
  "oxc-parser": "^0.137.0",
package/src/adapter.ts CHANGED
@@ -80,7 +80,7 @@ export function workers(opts?: { name?: string; domain?: string }): JuneAdapter
80
80
  return {
81
81
  name: "workers",
82
82
  capabilities: { runtime: "edge", persistentConnections: true, assets: "platform" },
83
- conditions: ["workerd", "edge", "import", "default"],
83
+ conditions: ["source", "workerd", "edge", "import", "default"],
84
84
  // workers-og is a workerd-native WASM package: rolldown cannot bundle its
85
85
  // .wasm assets (wrangler's own bundler applies the CompiledWasm rule). Mark
86
86
  // it external here so user apps never need `build: { external: ["workers-og"] }`.
@@ -183,7 +183,7 @@ export function vercel(opts?: { runtime?: "node" | "edge"; regions?: string[] })
183
183
  // listed BEFORE "edge-light", so requesting "worker" pulls the wrong renderer.
184
184
  // "edge-light" → server.edge.js, which uses Web Streams (renderToReadableStream)
185
185
  // and runs on workerd AND Node alike. Mirrors workers()'s shape.
186
- conditions: ["edge-light", "edge", "import", "default"],
186
+ conditions: ["source", "edge-light", "edge", "import", "default"],
187
187
 
188
188
  validate({ config }) {
189
189
  // turso() is libsql over HTTPS — it runs on Vercel (the build bundles the web
@@ -293,7 +293,7 @@ export function deno(opts?: { org?: string; app?: string }): JuneAdapter {
293
293
  capabilities: { runtime: "edge", persistentConnections: true, assets: "server" },
294
294
  // "deno" first (a dep may ship a Deno-specific build); else edge-light →
295
295
  // server.edge.js (Web Streams + fetch, which Deno has).
296
- conditions: ["deno", "edge-light", "edge", "import", "default"],
296
+ conditions: ["source", "deno", "edge-light", "edge", "import", "default"],
297
297
 
298
298
  validate({ config }) {
299
299
  const kind = config.resources?.db?.kind;
@@ -365,7 +365,7 @@ export function staticSite(): JuneAdapter {
365
365
  capabilities: { runtime: "static", persistentConnections: false, assets: "none" },
366
366
  // edge-light → react-dom resolves to server.edge.js (Web Streams), which the
367
367
  // build host (Bun/Node) runs during prerender — the same choice as vercel()/deno().
368
- conditions: ["edge-light", "edge", "import", "default"],
368
+ conditions: ["source", "edge-light", "edge", "import", "default"],
369
369
  // Defensive: if an OG/image route ever slips into a static build, keep the WASM
370
370
  // renderer external so the bundle still builds (Kura drops the OG route on static).
371
371
  buildExternal: ["workers-og"],
@@ -68,7 +68,9 @@ async function bundleClient(entryFile: string, cwd: string, mode: BundleMode, ma
68
68
  // CONFIGURATION_FIELD_CONFLICT, value-independent). See tsconfig-jsx.ts.
69
69
  jsx: await jsxTransform(cwd),
70
70
  },
71
- resolve: { conditionNames: ["browser", "import", "default"] },
71
+ // "source" first so @junejs/* resolves to its src/*.ts (never a pre-built
72
+ // dist) — the client graph bundles June's own runtime (e.g. islands-client).
73
+ resolve: { conditionNames: ["source", "browser", "import", "default"] },
72
74
  onLog(level, log, handler) {
73
75
  if (isExpectedClientLog(log)) return;
74
76
  handler(level, log);
package/src/rsc-bundle.ts CHANGED
@@ -19,8 +19,9 @@ import { rscClientReferencesPlugin } from "./rsc-manifest";
19
19
  export type RscGraph = "server" | "ssr";
20
20
 
21
21
  // edge-first conditions shared by both graphs; the server graph prepends
22
- // "react-server" so React resolves to the server build.
23
- const EDGE_CONDITIONS = ["workerd", "edge-light", "import", "default"];
22
+ // "react-server" so React resolves to the server build. "source" leads so
23
+ // @junejs/* resolves to its src/*.ts (never a pre-built dist).
24
+ const EDGE_CONDITIONS = ["source", "workerd", "edge-light", "import", "default"];
24
25
 
25
26
  // Generic-entry virtuals the build resolves to real app modules (so one runtime
26
27
  // entry serves any app): "june:app" (the app root), "june:rsc-client" (the