| ... | ... | @@ -3,37 +3,44 @@ |
| 3 | 3 | import * as util from "node:util"; |
| 4 | 4 | import * as zlib from "node:zlib"; |
| 5 | 5 | import * as url from "node:url"; |
| 6 | import * as module from "node:module"; |
| 6 | 7 | import process from "node:process"; |
| 7 | 8 | |
| 8 | | if (!zlib.zstdCompress) { |
| 9 | // Disable experimental warnings (Type Stripping, etc) |
| 10 | const { emit: originalEmit } = process; |
| 11 | const warnings = ["ExperimentalWarning"]; |
| 12 | process.emit = function (event, error) { |
| 13 | return event === "warning" && warnings.includes(error.name) |
| 14 | ? false |
| 15 | : originalEmit.apply(process, arguments); |
| 16 | }; |
| 17 | |
| 18 | try { |
| 19 | // fails in a runtime without ts support |
| 20 | await import("#debug"); |
| 21 | |
| 22 | // required APIs |
| 23 | ASSERT(zlib.zstdCompress); |
| 24 | |
| 25 | // seems to fail in bun |
| 26 | (await import("source-map-support")).install({ hookRequire: true }); |
| 27 | } catch { |
| 9 | 28 | const brand = process.versions.bun |
| 10 | 29 | ? `bun ${process.versions.bun}` |
| 11 | 30 | : process.versions.deno |
| 12 | 31 | ? `deno ${process.versions.deno}` |
| 13 | 32 | : null; |
| 14 | | |
| 33 | const brandText = brand ? ` (${brand})` : ""; |
| 15 | 34 | globalThis.console.error( |
| 16 | | `sitegen depends on a node.js v24. your runtime is missing feature\n` + |
| 17 | | `this is node.js version ${process.version}${ |
| 18 | | brand ? ` (${brand})` : "" |
| 19 | | }\n\n` + |
| 35 | `sitegen depends on a node.js v24. your runtime is missing features.\n` + |
| 36 | `this is node.js version ${process.version}${brandText}\n\n` + |
| 20 | 37 | `get node.js --> https://nodejs.org/en/download/current`, |
| 21 | 38 | ); |
| 22 | 39 | process.exit(1); |
| 23 | 40 | } |
| 24 | 41 | |
| 25 | | // Disable experimental warnings (Type Stripping, etc) |
| 26 | | const { emit: originalEmit } = process; |
| 27 | | const warnings = ["ExperimentalWarning"]; |
| 28 | | process.emit = function (event, error) { |
| 29 | | return event === "warning" && warnings.includes(error.name) |
| 30 | | ? false |
| 31 | | : originalEmit.apply(process, arguments); |
| 32 | | }; |
| 33 | | |
| 34 | 42 | // Init hooks |
| 35 | 43 | const hot = await import("./framework/hot.ts"); |
| 36 | | await import("#debug"); |
| 37 | 44 | |
| 38 | 45 | const console = hot.load("@paperclover/console"); |
| 39 | 46 | globalThis.console["log"] = console.info; |