Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support util.promisify.custom as a global symbol #31647

Closed
ExE-Boss opened this issue Feb 5, 2020 · 0 comments
Closed

Support util.promisify.custom as a global symbol #31647

ExE-Boss opened this issue Feb 5, 2020 · 0 comments

Comments

@ExE-Boss
Copy link
Contributor

ExE-Boss commented Feb 5, 2020

Is your feature request related to a problem? Please describe.

Currently, util.promisify supports the util.promisify.custom symbol to provide a custom promisified version of the callback-taking function, this however doesn’t work cross‑realm and doesn’t work for packages that intend to support browsers.

There are currently several packages that provide util.promisify, but aren’t interoperable because of this (ex.: @nodejs’s built‑in util.promisify, @browserify’s util.promisify and @ljharb’s util.promisify)

Describe the solution you'd like

The best solution would be to expose this as a shared symbol using Symbol.for, like how #20821 (#20857) was done for util.inspect.custom.

The shared symbol would preferably be obtained using Symbol.for("nodejs.util.promisify.custom").

Describe alternatives you've considered

Keep the status quo and use a package like @mafintosh’s inspect‑custom‑symbol.

ExE-Boss added a commit to ExE-Boss/node that referenced this issue Feb 7, 2020
Define `util.promisify.custom`
as `Symbol.for("nodejs.util.inspect.custom")`, rather than
as `Symbol("util.inspect.custom")`.

This allows custom `promisify` wrappers to easily/safely be defined
in non‑Node.js environments.

Fixes: nodejs#31647
ExE-Boss added a commit to ExE-Boss/util.promisify that referenced this issue Feb 8, 2020
Define `util.promisify.custom`
as `Symbol.for(nodejs.util.inspect.custom)`, rather than
as `Symbol(util.inspect.custom)`.

This allows custom `promisify` wrappers to easily/safely be defined
in non‑Node.js environments.

Refs: nodejs/node#31647
Refs: nodejs/node#31672
ExE-Boss added a commit to EB-Forks/node-util that referenced this issue Feb 8, 2020
Define `util.promisify.custom`
as `Symbol.for(nodejs.util.inspect.custom)`, rather than
as `Symbol(util.inspect.custom)`.

This allows custom `promisify` wrappers to easily/safely be defined
in non‑Node.js environments.

Refs: nodejs/node#31647
Refs: nodejs/node#31672
ExE-Boss added a commit to ExE-Boss/util.promisify that referenced this issue Feb 8, 2020
Define `util.promisify.custom`
as `Symbol.for("nodejs.util.inspect.custom")`, rather than
as `Symbol("util.inspect.custom")`.

This allows custom `promisify` wrappers to easily/safely be defined
in non‑Node.js environments.

Refs: nodejs/node#31647
Refs: nodejs/node#31672
ExE-Boss added a commit to EB-Forks/node-util that referenced this issue Feb 8, 2020
Define `util.promisify.custom`
as `Symbol.for("nodejs.util.inspect.custom")`, rather than
as `Symbol("util.inspect.custom")`.

This allows custom `promisify` wrappers to easily/safely be defined
in non‑Node.js environments.

Refs: nodejs/node#31647
Refs: nodejs/node#31672
BridgeAR pushed a commit that referenced this issue Mar 17, 2020
Define `util.promisify.custom`
as `Symbol.for("nodejs.util.inspect.custom")`, rather than
as `Symbol("util.inspect.custom")`.

This allows custom `promisify` wrappers to easily/safely be defined
in non‑Node.js environments.

Fixes: #31647

PR-URL: #31672
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
MylesBorins pushed a commit that referenced this issue Mar 24, 2020
Define `util.promisify.custom`
as `Symbol.for("nodejs.util.inspect.custom")`, rather than
as `Symbol("util.inspect.custom")`.

This allows custom `promisify` wrappers to easily/safely be defined
in non‑Node.js environments.

Fixes: #31647

PR-URL: #31672
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
MylesBorins pushed a commit to MylesBorins/node that referenced this issue Apr 1, 2020
Define `util.promisify.custom`
as `Symbol.for("nodejs.util.inspect.custom")`, rather than
as `Symbol("util.inspect.custom")`.

This allows custom `promisify` wrappers to easily/safely be defined
in non‑Node.js environments.

Fixes: nodejs#31647

PR-URL: nodejs#31672
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
ExE-Boss added a commit to ExE-Boss/node that referenced this issue Apr 1, 2020
Define `util.promisify.custom`
as `Symbol.for("nodejs.util.inspect.custom")`, rather than
as `Symbol("util.inspect.custom")`.

This allows custom `promisify` wrappers to easily/safely be defined
in non‑Node.js environments.

Fixes: nodejs#31647

PR-URL: nodejs#31672
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
MylesBorins pushed a commit that referenced this issue Apr 2, 2020
Define `util.promisify.custom`
as `Symbol.for("nodejs.util.inspect.custom")`, rather than
as `Symbol("util.inspect.custom")`.

This allows custom `promisify` wrappers to easily/safely be defined
in non‑Node.js environments.

Fixes: #31647

Backport-PR-URL: #32349
PR-URL: #31672
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
ExE-Boss added a commit to ExE-Boss/util.promisify that referenced this issue Jan 6, 2021
Define `util.promisify.custom`
as `Symbol.for("nodejs.util.inspect.custom")`, rather than
as `Symbol("util.inspect.custom")`.

This allows custom `promisify` wrappers to easily/safely be defined
in non‑Node.js environments.

Refs: nodejs/node#31647
Refs: nodejs/node#31672
ExE-Boss added a commit to ExE-Boss/util.promisify that referenced this issue Jan 6, 2021
Define `util.promisify.custom`
as `Symbol.for("nodejs.util.inspect.custom")`, rather than
as `Symbol("util.inspect.custom")`.

This allows custom `promisify` wrappers to easily/safely be defined
in non‑Node.js environments.

Refs: nodejs/node#31647
Refs: nodejs/node#31672
ljharb pushed a commit to ExE-Boss/util.promisify that referenced this issue Jan 6, 2021
Define `util.promisify.custom` as `Symbol.for("nodejs.util.inspect.custom")`, rather than as `Symbol("util.inspect.custom")`.

This allows custom `promisify` wrappers to easily/safely be defined in non‑Node.js environments.

Refs: nodejs/node#31647
Refs: nodejs/node#31672
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant