-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix: Use node
-prefixed requires for builtins
#2170
Conversation
Fixes and closes tj#2169 by using Node-prefixed imports. Signed-off-by: Sam Gammon <sam@elide.dev>
const EventEmitter = require('events').EventEmitter; | ||
const childProcess = require('child_process'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const process = require('process'); | ||
const EventEmitter = require('node:events').EventEmitter; | ||
const childProcess = require('node:child_process'); | ||
const path = require('node:path'); | ||
const fs = require('node:fs'); | ||
const process = require('node:process'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the whole pr
- feat: support all popular js runtimes - patches for `glob`, `minipass`, and `path-scurry` - upstream prs (listed below) - test entrypoint commands - test: add test entrypoints for each major runtime - test: add scripts to test entrypoint with each major runtime - chore: sync lockfiles Related Issues - isaacs/node-glob#580 - isaacs/path-scurry#16 - isaacs/minipass#54 - tj/commander.js#2169 Upstream PRs - isaacs/node-glob#581 - isaacs/minipass#55 - isaacs/path-scurry#17 - tj/commander.js#2170 Signed-off-by: Sam Gammon <sam@elide.dev>
- feat: support all popular js runtimes - patches for `glob`, `minipass`, and `path-scurry` - upstream prs (listed below) - test entrypoint commands - test: add test entrypoints for each major runtime - test: add scripts to test entrypoint with each major runtime - chore: sync lockfiles Related Issues - isaacs/node-glob#580 - isaacs/path-scurry#16 - isaacs/minipass#54 - tj/commander.js#2169 Upstream PRs - isaacs/node-glob#581 - isaacs/minipass#55 - isaacs/path-scurry#17 - tj/commander.js#2170 Signed-off-by: Sam Gammon <sam@elide.dev>
- feat: support all popular js runtimes - patches for `glob`, `minipass`, and `path-scurry` - upstream prs (listed below) - test entrypoint commands - test: add test entrypoints for each major runtime - test: add scripts to test entrypoint with each major runtime - chore: sync lockfiles Related Issues - isaacs/node-glob#580 - isaacs/path-scurry#16 - isaacs/minipass#54 - tj/commander.js#2169 Upstream PRs - isaacs/node-glob#581 - isaacs/minipass#55 - isaacs/path-scurry#17 - tj/commander.js#2170 Signed-off-by: Sam Gammon <sam@elide.dev>
* feat: support all runtimes - feat: support all popular js runtimes - patches for `glob`, `minipass`, and `path-scurry` - upstream prs (listed below) - test entrypoint commands - test: add test entrypoints for each major runtime - test: add scripts to test entrypoint with each major runtime - chore: sync lockfiles Related Issues - isaacs/node-glob#580 - isaacs/path-scurry#16 - isaacs/minipass#54 - tj/commander.js#2169 Upstream PRs - isaacs/node-glob#581 - isaacs/minipass#55 - isaacs/path-scurry#17 - tj/commander.js#2170 Signed-off-by: Sam Gammon <sam@elide.dev> * chore: version bump → `1.0.3` Signed-off-by: Sam Gammon <sam@elide.ventures> --------- Signed-off-by: Sam Gammon <sam@elide.dev> Signed-off-by: Sam Gammon <sam@elide.ventures>
Commander v12 requires node v18 or higher, so node compatibility for using the Line 77 in 83c3f4e
|
This issue only shows up because of bundling then running with Deno, and the change to fix it is only likely to break similar workflows involving transpiling and bundling tools not supporting the "node:" prefix for built-in modules. The
So I think normal uses of Commander won't be affected by this change, and if it breaks some more exotic uses then we will roll it back. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Adopt changes from tj/commander.js#2170 Signed-off-by: Sam Gammon <sam@elide.ventures>
* fix: postinstall script Signed-off-by: Sam Gammon <sam@elide.ventures> * chore: version bump → `1.0.4` Signed-off-by: Sam Gammon <sam@elide.ventures> * chore: update to commander.js `develop` branch Adopt changes from tj/commander.js#2170 Signed-off-by: Sam Gammon <sam@elide.ventures> * fix: disable distcheck (tmp) Signed-off-by: Sam Gammon <sam@elide.ventures> * chore: update all node deps Signed-off-by: Sam Gammon <sam@elide.ventures> --------- Signed-off-by: Sam Gammon <sam@elide.ventures>
Released in v12.1.0 |
@shadowspawn Thank you for the ping! I'll go ahead and adopt. 🥳 |
Pull Request
Problem
I want to use a Commander-based CLI tool from Deno, as explained in #2169
Solution
Fixes and closes #2169 by using Node-prefixed imports.
Note: Node-prefixed imports are supported on Node 16+, so this may break older apps on very old versions of Node. As a result I would suggest a major version bump to signal a compatibility change. Node 16 has reached EOL, so people really should be upgrading if they can.
No code was changed in Commander itself; just imports.
ChangeLog
node:
-prefixed requires; this may break compatibility with older versions of Node (up to 15). Please upgrade Node, bundle your app with rewriting to remove thenode:
prefix on requires, or avoid upgrading Commander if Node cannot be upgraded.