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

parseArgs from node:util doesn't support tokens #23179

Closed
ry opened this issue Apr 2, 2024 · 0 comments · Fixed by #23192
Closed

parseArgs from node:util doesn't support tokens #23179

ry opened this issue Apr 2, 2024 · 0 comments · Fixed by #23192
Labels
bug Something isn't working node API polyfill Related to various "node:*" modules APIs node compat

Comments

@ry
Copy link
Member

ry commented Apr 2, 2024

Version: Deno 1.41.1

https://nodejs.org/api/util.html#parseargs-tokens

Specifically the error is popping up in Observable Framework here https://github.com/observablehq/framework/blob/f85e0d81abcdfd9d1e193d2e18b4c67eb6ae74a4/src/bin/observable.ts#L25-L59

To reproduce:

# npm init @observablehq
# cd hello-framework
# deno task dev
Task dev observable preview
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'find')
    at file:///Users/ry/src/hello-framework/node_modules/.deno/@observablehq+framework@1.2.0/node_modules/@observablehq/framework/dist/bin/observable.js:36:20
@ry ry added node compat bug Something isn't working labels Apr 2, 2024
@bartlomieju bartlomieju added the node API polyfill Related to various "node:*" modules APIs label Apr 2, 2024
nathanwhit added a commit that referenced this issue Apr 2, 2024
…util.parseArgs` (#23192)

Fixes #23179.
Fixes #22454.

Enables passing `{tokens: true}` to `parseArgs` and setting default
values for options.

With this PR, the observable framework works with deno out of the box
(no unstable flags needed).

The existing code was basically copied straight from node, so this PR
mostly just updates that (out of date) vendored code. Also fixes some
issues with error exports (before this PR, in certain error cases we
were attempting to construct error classes that weren't actually in
scope).

The last change (in the second commit) adds a small hack so that we
actually exercise the `test-parse-args.js` node_compat test, previously
it was reported as passing though it should have failed. That test now
passes.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
satyarohith pushed a commit that referenced this issue Apr 11, 2024
…util.parseArgs` (#23192)

Fixes #23179.
Fixes #22454.

Enables passing `{tokens: true}` to `parseArgs` and setting default
values for options.

With this PR, the observable framework works with deno out of the box
(no unstable flags needed).

The existing code was basically copied straight from node, so this PR
mostly just updates that (out of date) vendored code. Also fixes some
issues with error exports (before this PR, in certain error cases we
were attempting to construct error classes that weren't actually in
scope).

The last change (in the second commit) adds a small hack so that we
actually exercise the `test-parse-args.js` node_compat test, previously
it was reported as passing though it should have failed. That test now
passes.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node API polyfill Related to various "node:*" modules APIs node compat
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants