From 692bc30864b34cdc3fe5297a7186605fbc73337f Mon Sep 17 00:00:00 2001 From: clover caruso Date: Wed, 15 Oct 2025 23:36:01 -0700 Subject: [PATCH] fix: node v22 wasnt getting hit by the startup check additionally block Deno since it can't run sitegen --- framework/hot.ts | 2 ++ run.js | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/framework/hot.ts b/framework/hot.ts index 3ba4d39ef6637261d0957424d78b3572613d9cd4..5ce9f43c15e68ae7bcad14a471b41583f9cca8b2 100644 --- a/framework/hot.ts +++ b/framework/hot.ts @@ -8,6 +8,8 @@ export const projectRoot = path.resolve(import.meta.dirname, "../"); export const projectSrc = path.resolve(projectRoot, "src"); +using _ = null; + // Create a project-relative require. For convenience, it is generic-typed. export const load = createRequire( pathToFileURL(path.join(projectRoot, "run.js")).toString(), diff --git a/run.js b/run.js index 6bb117ad7277390fa6f5eb679f1f1b3c5c4334a1..8a49513db19709dab9786210a099306318c3dc3b 100644 --- a/run.js +++ b/run.js @@ -16,12 +16,17 @@ process.emit = function (event, error) { : originalEmit.apply(process, arguments); }; +let hot; try { // required APIs - assert(zlib.zstdCompress); + await new Promise((resolve) => zlib.zstdCompress(new Uint8Array(), resolve)); // seems to fail in bun (await import("source-map-support")).install({ hookRequire: true }); + + // Init hooks + hot = await import("./framework/hot.ts"); + hot.load("./lib/log.ts"); } catch (e) { const brand = process.versions.bun ? `bun ${process.versions.bun}` @@ -34,13 +39,11 @@ try { `this is node.js version ${process.version}${brandText}\n\n` + `get node.js --> https://nodejs.org/en/download/current\n`, ); - console.error(e); + globalThis.console.error(e); process.exit(1); + await new Promise(() => {}); } -// Init hooks -const hot = await import("./framework/hot.ts"); - const log = hot.load("./lib/log.ts"); console.info = log.info; console.warn = log.warn; -- 2.54.0