diff --git a/src/presets/cloudflare.ts b/src/presets/cloudflare.ts index 757f9be..939c542 100644 --- a/src/presets/cloudflare.ts +++ b/src/presets/cloudflare.ts @@ -16,8 +16,6 @@ const cloudflareNodeCompatModules = [ "diagnostics_channel", "events", "path", - "path/posix", - "path/win32", "querystring", "stream", "stream/consumers", diff --git a/test/workerd/tests.mjs b/test/workerd/tests.mjs index fdee1dc..6a9bc41 100644 --- a/test/workerd/tests.mjs +++ b/test/workerd/tests.mjs @@ -102,3 +102,20 @@ export const util_implements = { assert.strictEqual(types.isAnyArrayBuffer(new ArrayBuffer(0)), true); }, }; + +// --- node:path + +export const unenv_polyfills_path = { + async test() { + const pathWin32 = await import("unenv/runtime/node/path/win32"); + assert.strictEqual(typeof pathWin32.resolve, "function"); + // Note: unenv uses `unjs/pathe` which behavior differs from Node.js + // See https://github.com/unjs/pathe + assert.strictEqual(pathWin32.sep, "/"); + assert.strictEqual(pathWin32.delimiter, ":"); + const pathPosix = await import("unenv/runtime/node/path/posix"); + assert.strictEqual(typeof pathPosix.resolve, "function"); + assert.strictEqual(pathPosix.sep, "/"); + assert.strictEqual(pathPosix.delimiter, ":"); + }, +};