@junejs/server 0.0.10 → 0.0.12
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/package.json +3 -3
- package/src/adapter.ts +14 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junejs/server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
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",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"typecheck": "tsc --noEmit"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@junejs/core": "0.0.
|
|
34
|
-
"@junejs/db": "0.0.
|
|
33
|
+
"@junejs/core": "0.0.12",
|
|
34
|
+
"@junejs/db": "0.0.12",
|
|
35
35
|
"marked": "^18.0.5",
|
|
36
36
|
"rolldown": "^1.1.0",
|
|
37
37
|
"postcss": "^8.4.0",
|
package/src/adapter.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// `workers()` is the zero-config default (this file, no import). Other targets
|
|
8
8
|
// are explicit `deploy: { adapter: vercel() }` from their own package.
|
|
9
9
|
import { existsSync } from "node:fs";
|
|
10
|
-
import { cp, copyFile, mkdir, rm, writeFile } from "node:fs/promises";
|
|
10
|
+
import { cp, copyFile, mkdir, readdir, rm, writeFile } from "node:fs/promises";
|
|
11
11
|
import { basename, join } from "node:path";
|
|
12
12
|
|
|
13
13
|
import type { JuneConfig } from "@junejs/core/config";
|
|
@@ -151,7 +151,12 @@ export function vercel(opts?: { regions?: string[] }): JuneAdapter {
|
|
|
151
151
|
return {
|
|
152
152
|
name: "vercel",
|
|
153
153
|
capabilities: { runtime: "edge", persistentConnections: false, assets: "platform" },
|
|
154
|
-
|
|
154
|
+
// NO "worker"/"browser": react-dom's ./server exports map "worker" → the
|
|
155
|
+
// BROWSER SSR build (server.browser.js), listed BEFORE "edge-light", so
|
|
156
|
+
// requesting "worker" pulls the wrong renderer and the edge function crashes
|
|
157
|
+
// at invocation. "edge-light" → server.edge.js (the same build workerd gets
|
|
158
|
+
// via "workerd"). Mirrors workers()'s shape: <runtime>, edge, import, default.
|
|
159
|
+
conditions: ["edge-light", "edge", "import", "default"],
|
|
155
160
|
|
|
156
161
|
validate({ plan }) {
|
|
157
162
|
if (plan.db) {
|
|
@@ -181,12 +186,16 @@ export function vercel(opts?: { regions?: string[] }): JuneAdapter {
|
|
|
181
186
|
await rm(out, { recursive: true, force: true }); // clean — no stale outputs
|
|
182
187
|
await mkdir(fnDir, { recursive: true });
|
|
183
188
|
|
|
184
|
-
// the edge function = June's portable worker bundle
|
|
185
|
-
|
|
189
|
+
// the edge function = June's portable worker bundle. Rolldown code-splits
|
|
190
|
+
// (worker.js imports ./cache-*.js, ./instrumentation-*.js, …), so copy EVERY
|
|
191
|
+
// top-level .js — the chunks must sit beside the entry or Vercel rejects the
|
|
192
|
+
// function ("referencing unsupported modules"). assets/ is handled below.
|
|
193
|
+
const jsFiles = (await readdir(outDir)).filter((f) => f.endsWith(".js"));
|
|
194
|
+
for (const f of jsFiles) await copyFile(join(outDir, f), join(fnDir, f));
|
|
186
195
|
await writeFile(
|
|
187
196
|
join(fnDir, ".vc-config.json"),
|
|
188
197
|
JSON.stringify(
|
|
189
|
-
{ runtime: "edge", entrypoint: "
|
|
198
|
+
{ runtime: "edge", entrypoint: "worker.js", ...(opts?.regions ? { regions: opts.regions } : {}) },
|
|
190
199
|
null,
|
|
191
200
|
2,
|
|
192
201
|
) + "\n",
|