From b6bc6b2d2468b8d4578602d899f9ffbd7e314151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9rill=20T=C3=A9terel?= Date: Tue, 23 Jun 2026 08:11:06 +0200 Subject: [PATCH 1/2] fix: use synchronous registerHooks --- esm_loader.mjs | 7 +++---- pnpmfile.cjs | 6 ++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/esm_loader.mjs b/esm_loader.mjs index 56b840a..9d712c1 100644 --- a/esm_loader.mjs +++ b/esm_loader.mjs @@ -6,9 +6,9 @@ const extraNodePaths = (process.env.NODE_PATH || '') .split(delimiter) .filter(Boolean) -export async function resolve(specifier, context, defaultResolve) { +export function resolve(specifier, context, nextResolve) { try { - return await defaultResolve(specifier, context, defaultResolve) + return nextResolve(specifier, context) } catch (originalError) { if (specifier.startsWith('.') || specifier.startsWith('/') || specifier.match(/^node:/)) { // Don't handle relative, absolute, or node: specifiers @@ -19,7 +19,7 @@ export async function resolve(specifier, context, defaultResolve) { const require = createRequire(pathToFileURL(basePath).href) try { const resolved = require.resolve(specifier) - return { url: pathToFileURL(resolved).href } + return { url: pathToFileURL(resolved).href, shortCircuit: true } } catch { // Skip and try next } @@ -29,4 +29,3 @@ export async function resolve(specifier, context, defaultResolve) { throw originalError } } - diff --git a/pnpmfile.cjs b/pnpmfile.cjs index 9a02fdb..c4ba6f8 100644 --- a/pnpmfile.cjs +++ b/pnpmfile.cjs @@ -1,5 +1,5 @@ const path = require('node:path') -const { pathToFileURL } = require('node:url'); +const { pathToFileURL } = require('node:url') module.exports = { hooks: { @@ -7,10 +7,9 @@ module.exports = { // Resolve paths and convert to proper file URLs const loaderPath = path.resolve(__dirname, 'esm_loader.mjs') const loaderUrl = pathToFileURL(loaderPath).href - const baseUrl = pathToFileURL(path.resolve('./')).href // Build the registration code - const registrationCode = `import{register}from'node:module';register('${loaderUrl}','${baseUrl}');` + const registrationCode = `import{registerHooks}from'node:module';import{resolve}from'${loaderUrl}';registerHooks({resolve});` // Create NODE_OPTIONS with properly encoded data URL const importFlag = `--import=data:text/javascript,${encodeURIComponent(registrationCode)}` @@ -19,4 +18,3 @@ module.exports = { }, }, } - From adb6627c351af4615303daf5581374e6c78e814f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9rill=20T=C3=A9terel?= Date: Tue, 23 Jun 2026 08:50:22 +0200 Subject: [PATCH 2/2] chore: set minimum node version to 22.15.0 --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 4db68bf..f4935df 100644 --- a/package.json +++ b/package.json @@ -8,5 +8,8 @@ "pnpm" ], "license": "MIT", + "engines": { + "node": ">=22.15.0" + }, "packageManager": "pnpm@10.12.1" }