-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
add open package #492
add open package #492
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
@@ -36,7 +36,7 @@ npm i -g zx | |||
## Goods | |||
|
|||
[$](#command-) · [cd()](#cd) · [fetch()](#fetch) · [question()](#question) · [sleep()](#sleep) · [echo()](#echo) · [stdin()](#stdin) · [within()](#within) · | |||
[chalk](#chalk-package) · [fs](#fs-package) · [os](#os-package) · [path](#path-package) · [glob](#globby-package) · [yaml](#yaml-package) · [minimist](#minimist-package) · [which](#which-package) · | |||
[chalk](#chalk-package) · [fs](#fs-package) · [opn](#open-package) · [os](#os-package) · [path](#path-package) · [glob](#globby-package) · [yaml](#yaml-package) · [minimist](#minimist-package) · [which](#which-package) · |
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.
Is there a reason why it's called opn
instead of open
? I think the later is clearer.
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.
Some weird compilation error. It looks like the open keyword is reserved, so I'm not able to use it.
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.
You are right, I tried it and had this error
Duplicate identifier 'open'.ts(2300)
lib.dom.d.ts(17754, 18): 'open' was also declared here.
It seems that Typescript considers the global object to have properties of window
in the browser, which has an open
method.
This also explains why fetch
is not declared in the globals.ts
file, because it's already part of window
(and was also added to node
global context).
I don't see the "DOM" lib on tsconfig.json
so I am not sure where is it coming from ...
I found a related issue on Typescript microsoft/TypeScript#43990
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.
From node-fetch =(
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.
Ah, I see. Do we really need node-fetch
now that node
has fetch
by default?
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.
node has fetch by default
We can! But right now zx support >= node16. So until the next major zx we can't change it.
Let's not add this to zx. Zx already really big. I'm thinking of adding something like await npm('open').open(...) |
Interesting, it reminds me of the |
So, if I understand correctly, it will be possible to use npm dependencies without having a If that's the case, it will be awesome! |
I found this library which tackle the "import at runtime" issue: https://www.npmjs.com/package/live-plugin-manager |
closed in favour of #498 |
Fixes #491