Node 18 and Node 20 are end-of-life and receive no security patches, so supporting them before RC.1 would mean promising a runtime nobody can patch. Node 22 is the oldest line still maintained. engines.node moves to >=22, @types/node to ^22, the tsup target to node22, and CI's build job from Node 18 to 22, so every workflow now runs Node 22 only. The docs, the bug report example and the comments that stated 18 as the floor follow. The node:crypto fallback in the HTTP core existed only for Node 18, which lacked the global crypto; it goes with its regression test, which said as much. The ws fallback for the WebSocket client stays: Node 22 has the global, but it can still be switched off with a flag. Moving off Node 18 and 20 also unblocks vitest 4, which the remaining dev audit advisories need. BREAKING CHANGE: Node 18 and Node 20 are no longer supported. The minimum is Node 22. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
23 lines
982 B
TypeScript
23 lines
982 B
TypeScript
import { defineConfig } from 'tsup';
|
|
|
|
// Dual build: CJS (dist/index.js) + ESM (dist/index.mjs) + type declarations, from one entry.
|
|
// tsup injects a createRequire shim into the ESM output so the lazy require('ws') / require('busboy')
|
|
// (optional peer deps) keep working there. reflect-metadata and the peer deps stay external.
|
|
export default defineConfig({
|
|
entry: ['src/index.ts', 'src/deno.ts', 'src/bun.ts', 'src/edge.ts'],
|
|
format: ['cjs', 'esm'],
|
|
dts: true,
|
|
clean: true,
|
|
sourcemap: true,
|
|
target: 'node22',
|
|
// Give the ESM output a real `require` (via createRequire) so the lazy require('ws') / require('busboy')
|
|
// (optional peer deps) resolve instead of hitting esbuild's "Dynamic require not supported" stub.
|
|
esbuildOptions(options, context) {
|
|
if (context.format === 'esm') {
|
|
options.banner = {
|
|
js: "import { createRequire as _createRequire } from 'node:module'; const require = _createRequire(import.meta.url);",
|
|
};
|
|
}
|
|
},
|
|
});
|