@junejs/server 0.0.10 → 0.0.11

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 (2) hide show
  1. package/package.json +3 -3
  2. package/src/adapter.ts +8 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junejs/server",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
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.10",
34
- "@junejs/db": "0.0.10",
33
+ "@junejs/core": "0.0.11",
34
+ "@junejs/db": "0.0.11",
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";
@@ -181,12 +181,16 @@ export function vercel(opts?: { regions?: string[] }): JuneAdapter {
181
181
  await rm(out, { recursive: true, force: true }); // clean — no stale outputs
182
182
  await mkdir(fnDir, { recursive: true });
183
183
 
184
- // the edge function = June's portable worker bundle, verbatim
185
- await copyFile(join(outDir, "worker.js"), join(fnDir, "index.js"));
184
+ // the edge function = June's portable worker bundle. Rolldown code-splits
185
+ // (worker.js imports ./cache-*.js, ./instrumentation-*.js, …), so copy EVERY
186
+ // top-level .js — the chunks must sit beside the entry or Vercel rejects the
187
+ // function ("referencing unsupported modules"). assets/ is handled below.
188
+ const jsFiles = (await readdir(outDir)).filter((f) => f.endsWith(".js"));
189
+ for (const f of jsFiles) await copyFile(join(outDir, f), join(fnDir, f));
186
190
  await writeFile(
187
191
  join(fnDir, ".vc-config.json"),
188
192
  JSON.stringify(
189
- { runtime: "edge", entrypoint: "index.js", ...(opts?.regions ? { regions: opts.regions } : {}) },
193
+ { runtime: "edge", entrypoint: "worker.js", ...(opts?.regions ? { regions: opts.regions } : {}) },
190
194
  null,
191
195
  2,
192
196
  ) + "\n",