mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 11:29:02 +00:00
Fix bake codegen on windows (#17654)
This commit is contained in:
@@ -125,6 +125,7 @@ interface CodePreview {
|
||||
|
||||
interface RemappedFrame extends Frame {}
|
||||
|
||||
declare const OVERLAY_CSS: string;
|
||||
/**
|
||||
* Initial mount is done lazily. The modal starts invisible, controlled
|
||||
* by `setModalVisible`.
|
||||
@@ -144,7 +145,7 @@ function mountModal() {
|
||||
});
|
||||
const shadow = domShadowRoot.attachShadow({ mode: "open" });
|
||||
const sheet = new CSSStyleSheet();
|
||||
sheet.replace(css("client/overlay.css", IS_BUN_DEVELOPMENT));
|
||||
sheet.replace(OVERLAY_CSS);
|
||||
shadow.adoptedStyleSheets = [sheet];
|
||||
|
||||
const root = elem("div", { class: "root" }, [
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
// @ts-ignore
|
||||
export async function css(file: string, is_development: boolean): string {
|
||||
const { success, stdout, stderr } = await Bun.spawnSync({
|
||||
cmd: [process.execPath, "build", file, "--minify"],
|
||||
cwd: import.meta.dir,
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
});
|
||||
if (!success) throw new Error(stderr.toString("utf-8"));
|
||||
return stdout.toString("utf-8");
|
||||
}
|
||||
@@ -30,6 +30,16 @@ function convertZigEnum(zig: string, names: string[]) {
|
||||
return output;
|
||||
}
|
||||
|
||||
function css(file: string, is_development: boolean): string {
|
||||
const { success, stdout, stderr } = Bun.spawnSync({
|
||||
cmd: [process.execPath, "build", file, "--minify"],
|
||||
cwd: import.meta.dir,
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
});
|
||||
if (!success) throw new Error(stderr.toString("utf-8"));
|
||||
return stdout.toString("utf-8");
|
||||
}
|
||||
|
||||
async function run() {
|
||||
const devServerZig = readFileSync(join(base_dir, "DevServer.zig"), "utf-8");
|
||||
writeIfNotChanged(join(base_dir, "generated.ts"), convertZigEnum(devServerZig, ["IncomingMessageId", "MessageId"]));
|
||||
@@ -43,6 +53,7 @@ async function run() {
|
||||
side: JSON.stringify(side),
|
||||
IS_ERROR_RUNTIME: String(file === "error"),
|
||||
IS_BUN_DEVELOPMENT: String(!!debug),
|
||||
OVERLAY_CSS: css("../bake/client/overlay.css", !!debug),
|
||||
},
|
||||
minify: {
|
||||
syntax: !debug,
|
||||
|
||||
Reference in New Issue
Block a user