Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/lazy-oranges-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@cloudflare/unenv-preset": patch
---

Remove removed functions from node:util polyfills

These function were removed from Node.js before the current LTS versions.
56 changes: 2 additions & 54 deletions packages/unenv-preset/src/runtime/node/util/index.ts
Original file line number Diff line number Diff line change
@@ -1,51 +1,15 @@
// https://nodejs.org/api/util.html
import {
_errnoException,
_exceptionWithHostPort,
getSystemErrorMap,
getSystemErrorName,
isArray,
isBoolean,
isBuffer,
isDate,
isDeepStrictEqual,
isError,
isFunction,
isNull,
isNullOrUndefined,
isNumber,
isObject,
isPrimitive,
isRegExp,
isString,
isSymbol,
isUndefined,
parseEnv,
styleText,
} from "unenv/runtime/node/util/index";
import type nodeUtil from "node:util";

export {
_errnoException,
_exceptionWithHostPort,
getSystemErrorMap,
getSystemErrorName,
isArray,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: isArray is not removed from Node and the timeline to remove the other functions is Node 23.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isArray is available and implemented on workerd

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have commented on l94 instead.
What I meant is that isArray is not part of the functions removed in Node23.

But if we have some of the functions here implemented in workerd (and not going away) we should definitely use the workerd version instead - I guess it will be a different PR.

Thanks

isBoolean,
isBuffer,
isDate,
isDeepStrictEqual,
isError,
isFunction,
isNull,
isNullOrUndefined,
isNumber,
isObject,
isPrimitive,
isRegExp,
isString,
isSymbol,
isUndefined,
parseEnv,
styleText,
} from "unenv/runtime/node/util/index";
Expand All @@ -71,6 +35,7 @@ export const {
getCallSite,
inherits,
inspect,
isDeepStrictEqual,
log,
parseArgs,
promisify,
Expand All @@ -86,27 +51,9 @@ export default {
/**
* manually unroll unenv-polyfilled-symbols to make it tree-shakeable
*/
// @ts-expect-error undocumented public API
_errnoException,
_exceptionWithHostPort,
getSystemErrorMap,
getSystemErrorName,
isArray,
isBoolean,
isBuffer,
isDate,
isDeepStrictEqual,
isError,
isFunction,
isNull,
isNullOrUndefined,
isNumber,
isObject,
isPrimitive,
isRegExp,
isString,
isSymbol,
isUndefined,
parseEnv,
styleText,

Expand All @@ -117,6 +64,7 @@ export default {
MIMEType,
TextDecoder,
TextEncoder,
// @ts-expect-error missing types?
_extend,
aborted,
callbackify,
Expand Down
Loading