@bractjs/bractjs 0.1.12 → 0.1.14
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/bin/cli.ts +3 -0
- package/package.json +1 -1
- package/src/build/bundler.ts +7 -3
- package/src/client/ClientRouter.tsx +4 -1
package/bin/cli.ts
CHANGED
|
@@ -77,6 +77,9 @@ switch (command) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
case "start": {
|
|
80
|
+
// Default to production so SSR-side gates (e.g. <LiveReload/>) emit prod
|
|
81
|
+
// output. Users can still override with `NODE_ENV=staging bractjs start`.
|
|
82
|
+
if (!process.env.NODE_ENV) process.env.NODE_ENV = "production";
|
|
80
83
|
const { createServer } = await import("../src/server/serve.ts");
|
|
81
84
|
createServer({ port: 3000, buildDir: "./build" });
|
|
82
85
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bractjs/bractjs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Production-grade SSR framework for Bun + React 19. File-based routing, streaming SSR, server actions, typed routes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/bractjs/bractjs#readme",
|
package/src/build/bundler.ts
CHANGED
|
@@ -62,7 +62,11 @@ export async function runBuild(config: BractJSConfig): Promise<void> {
|
|
|
62
62
|
const rootBase = basename(rootFilePath, extname(rootFilePath)); // "root"
|
|
63
63
|
|
|
64
64
|
for (const artifact of clientResult.outputs) {
|
|
65
|
-
|
|
65
|
+
// Only rename entry points. Bun's split chunks (kind === "chunk") already
|
|
66
|
+
// have content-hashed basenames (e.g. chunk-189z661a.js); renaming them
|
|
67
|
+
// would break sibling import refs, which Bun bakes in at bundle time and
|
|
68
|
+
// does NOT rewrite after rename.
|
|
69
|
+
if (artifact.kind !== "entry-point") continue;
|
|
66
70
|
const hash = await contentHash(artifact.path);
|
|
67
71
|
const ext = artifact.path.slice(artifact.path.lastIndexOf("."));
|
|
68
72
|
const base = artifact.path.slice(0, artifact.path.lastIndexOf("."));
|
|
@@ -78,9 +82,9 @@ export async function runBuild(config: BractJSConfig): Promise<void> {
|
|
|
78
82
|
const rel = absPath.startsWith(outdirAbs + "/") ? absPath.slice(outdirAbs.length + 1) : basename(artifact.path);
|
|
79
83
|
const outBase = basename(artifact.path, extname(artifact.path));
|
|
80
84
|
|
|
81
|
-
if (
|
|
85
|
+
if (outBase === entryBase) {
|
|
82
86
|
clientEntry = publicPath;
|
|
83
|
-
} else if (
|
|
87
|
+
} else if (outBase === rootBase) {
|
|
84
88
|
rootChunk = publicPath;
|
|
85
89
|
} else {
|
|
86
90
|
const matched = routes.find((r) => {
|
|
@@ -155,7 +155,10 @@ export function ClientRouter({ children, initialData, initialModule = null }: Cl
|
|
|
155
155
|
// Update DevTools state (dev-only — no-op in prod since the import fails).
|
|
156
156
|
const w = window as unknown as { __BRACT_DEV__?: boolean };
|
|
157
157
|
if (w.__BRACT_DEV__ === true) {
|
|
158
|
-
|
|
158
|
+
// Use the dev-only HTTP endpoint (registered in serve.ts) rather than
|
|
159
|
+
// a relative source-path import — Bun preserves dynamic-import paths
|
|
160
|
+
// as runtime URLs, and a relative .ts path 404s in the browser.
|
|
161
|
+
void import(/* @vite-ignore */ "/_bractjs/devtools.js").then(({ updateDevtoolsState }) => {
|
|
159
162
|
updateDevtoolsState({
|
|
160
163
|
route: toPathname,
|
|
161
164
|
loaderData: data,
|