bunsai
Advanced tools
Comparing version 2.3.1 to 2.3.2
{ | ||
"name": "bunsai", | ||
"version": "2.3.1", | ||
"version": "2.3.2", | ||
"module": "./src/core/index.ts", | ||
@@ -5,0 +5,0 @@ "description": "SSR Engine for Bun", |
@@ -17,3 +17,3 @@ <p align="center"><img width="300rem" height="300rem" src="https://github.com/levii-pires/bunsai2/blob/main/assets/logo.png?raw=true"></p> | ||
- At the current version of Bun (v1.1.8) on Windows, the asset path on the browser version is not resolved correctly, throwing a hydration warning on React and completly breaking the asset path on Svelte. ([Github issue](https://github.com/oven-sh/bun/issues/11181)) | ||
- At the current version of Bun (v1.1.9) on Windows, the asset path on the browser version is not resolved correctly, throwing a hydration warning on React and completly breaking the asset path on Svelte. ([Github issue](https://github.com/oven-sh/bun/issues/11181)) | ||
@@ -53,2 +53,3 @@ ## Quick start | ||
# .env | ||
# possible values: 'on', 'verbose' or 'silent' | ||
DEBUG=on | ||
@@ -55,0 +56,0 @@ ``` |
@@ -38,3 +38,3 @@ import { getCSSArtifactPath } from "./css"; | ||
const cbt = time.debug("client build time"); | ||
const cbt = time.loud("client build time"); | ||
@@ -80,14 +80,12 @@ const { logs, outputs, success } = await Bun.build({ | ||
const extra = Array.from(registry.values()) | ||
.filter(({ $m_meta }) => $m_meta.css) | ||
.map(({ $m_meta }) => ({ | ||
object: () => | ||
new Blob([$m_meta.css!], { | ||
type: "text/css;charset=utf-8", | ||
}), | ||
path: createPath({ | ||
prefix, | ||
artifactPath: getCSSArtifactPath($m_meta), | ||
const extra = Array.from(registry.values()).map(({ $m_meta }) => ({ | ||
object: () => | ||
new Blob([$m_meta.css || ""], { | ||
type: "text/css;charset=utf-8", | ||
}), | ||
})); | ||
path: createPath({ | ||
prefix, | ||
artifactPath: getCSSArtifactPath($m_meta), | ||
}), | ||
})); | ||
@@ -94,0 +92,0 @@ return { |
@@ -78,3 +78,4 @@ /// <reference path="./global.d.ts"/> | ||
log.debug("client endpoints (", paths.join(" | "), ")"); | ||
log.debug("client endpoints:", paths.length); | ||
log.verbose("endpoint: ", paths.join("\nendpoint: ")); | ||
@@ -81,0 +82,0 @@ return result; |
@@ -9,3 +9,4 @@ /** | ||
export function debug(...data: any[]) { | ||
if (Bun.env.DEBUG) console.log("[bunsai2]:", ...data); | ||
if (Bun.env.DEBUG && Bun.env.DEBUG != "silent") | ||
console.log("[bunsai2]:", ...data); | ||
} | ||
@@ -36,3 +37,3 @@ | ||
export function debug(label?: string) { | ||
if (Bun.env.DEBUG) { | ||
if (Bun.env.DEBUG && Bun.env.DEBUG != "silent") { | ||
const initial = performance.now(); | ||
@@ -39,0 +40,0 @@ |
@@ -36,6 +36,6 @@ import type { BunPlugin } from "bun"; | ||
log.verbose(preprocess, code); | ||
const name = "$" + Bun.hash(args.path, 0).toString(36); | ||
const dev = IsDev(); | ||
const { | ||
@@ -48,3 +48,3 @@ css: { code: css, map: cssMap }, | ||
hydratable, | ||
dev: IsDev(), | ||
dev, | ||
filename: args.path, | ||
@@ -56,3 +56,5 @@ generate: "ssr", | ||
warnings.forEach((w) => log.loud("[svelte]:", w.filename, w.message)); | ||
warnings.forEach((w) => | ||
log.verbose("[svelte]:", w.filename, w.message) | ||
); | ||
@@ -75,8 +77,6 @@ return { | ||
`\nconst $m_meta = {` + | ||
(IsDev() ? `jsMap: ${JSON.stringify(jsMap)},` : "jsMap: null") + | ||
(dev ? `jsMap: ${JSON.stringify(jsMap)},` : "jsMap: null") + | ||
"css: _css," + | ||
"cssHash: _css && Bun.hash(path + _css, 1).toString(36)," + | ||
(IsDev() | ||
? `cssMap: ${JSON.stringify(cssMap)},` | ||
: "cssMap: null") + | ||
"cssHash: Bun.hash(path + _css, 1).toString(36)," + | ||
(dev ? `cssMap: ${JSON.stringify(cssMap)},` : "cssMap: null") + | ||
"path," + | ||
@@ -88,3 +88,6 @@ "};" + | ||
"\nconst render = $sv_reg({$m_meta,$m_render,$m_symbol,$m_gen_script});" + | ||
`\nObject.assign(${name},{$m_meta,$m_render,$m_symbol,$m_gen_script,render})`, | ||
`\nObject.assign(${name},{$m_meta,$m_render,$m_symbol,$m_gen_script,render})` + | ||
(dev | ||
? "\nconst __debug={$m_meta,$m_render,$m_symbol,$m_gen_script};" | ||
: ""), | ||
loader: "js", | ||
@@ -108,4 +111,2 @@ }; | ||
log.verbose(code); | ||
const name = "$" + Bun.hash(args.path, 0).toString(36); | ||
@@ -126,3 +127,5 @@ | ||
warnings.forEach((w) => log.loud("[svelte]:", w.filename, w.message)); | ||
warnings.forEach((w) => | ||
log.verbose("[svelte]:", w.filename, w.message) | ||
); | ||
@@ -129,0 +132,0 @@ return { |
50590
1314
196