fix: node 22 wasn't stopped by compat check
This commit is contained in:
parent
4adc2abc47
commit
ff4c861ce1
2 changed files with 25 additions and 20 deletions
|
@ -19,8 +19,6 @@ export const load = createRequire(
|
||||||
};
|
};
|
||||||
export const { cache } = load;
|
export const { cache } = load;
|
||||||
|
|
||||||
load<any>("source-map-support").install({ hookRequire: true });
|
|
||||||
|
|
||||||
// Register extensions by overwriting `require.extensions`
|
// Register extensions by overwriting `require.extensions`
|
||||||
const require = load;
|
const require = load;
|
||||||
const exts = require.extensions;
|
const exts = require.extensions;
|
||||||
|
|
43
run.js
43
run.js
|
@ -3,25 +3,9 @@
|
||||||
import * as util from "node:util";
|
import * as util from "node:util";
|
||||||
import * as zlib from "node:zlib";
|
import * as zlib from "node:zlib";
|
||||||
import * as url from "node:url";
|
import * as url from "node:url";
|
||||||
|
import * as module from "node:module";
|
||||||
import process from "node:process";
|
import process from "node:process";
|
||||||
|
|
||||||
if (!zlib.zstdCompress) {
|
|
||||||
const brand = process.versions.bun
|
|
||||||
? `bun ${process.versions.bun}`
|
|
||||||
: process.versions.deno
|
|
||||||
? `deno ${process.versions.deno}`
|
|
||||||
: null;
|
|
||||||
|
|
||||||
globalThis.console.error(
|
|
||||||
`sitegen depends on a node.js v24. your runtime is missing feature\n` +
|
|
||||||
`this is node.js version ${process.version}${
|
|
||||||
brand ? ` (${brand})` : ""
|
|
||||||
}\n\n` +
|
|
||||||
`get node.js --> https://nodejs.org/en/download/current`,
|
|
||||||
);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable experimental warnings (Type Stripping, etc)
|
// Disable experimental warnings (Type Stripping, etc)
|
||||||
const { emit: originalEmit } = process;
|
const { emit: originalEmit } = process;
|
||||||
const warnings = ["ExperimentalWarning"];
|
const warnings = ["ExperimentalWarning"];
|
||||||
|
@ -31,9 +15,32 @@ process.emit = function (event, error) {
|
||||||
: originalEmit.apply(process, arguments);
|
: originalEmit.apply(process, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
// fails in a runtime without ts support
|
||||||
|
await import("#debug");
|
||||||
|
|
||||||
|
// required APIs
|
||||||
|
ASSERT(zlib.zstdCompress);
|
||||||
|
|
||||||
|
// seems to fail in bun
|
||||||
|
(await import("source-map-support")).install({ hookRequire: true });
|
||||||
|
} catch {
|
||||||
|
const brand = process.versions.bun
|
||||||
|
? `bun ${process.versions.bun}`
|
||||||
|
: process.versions.deno
|
||||||
|
? `deno ${process.versions.deno}`
|
||||||
|
: null;
|
||||||
|
const brandText = brand ? ` (${brand})` : "";
|
||||||
|
globalThis.console.error(
|
||||||
|
`sitegen depends on a node.js v24. your runtime is missing features.\n` +
|
||||||
|
`this is node.js version ${process.version}${brandText}\n\n` +
|
||||||
|
`get node.js --> https://nodejs.org/en/download/current`,
|
||||||
|
);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
// Init hooks
|
// Init hooks
|
||||||
const hot = await import("./framework/hot.ts");
|
const hot = await import("./framework/hot.ts");
|
||||||
await import("#debug");
|
|
||||||
|
|
||||||
const console = hot.load("@paperclover/console");
|
const console = hot.load("@paperclover/console");
|
||||||
globalThis.console["log"] = console.info;
|
globalThis.console["log"] = console.info;
|
||||||
|
|
Loading…
Reference in a new issue