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

npm specifiers roadmap #15960

Closed
23 of 25 tasks
Tracked by #2
dsherret opened this issue Sep 19, 2022 · 21 comments
Closed
23 of 25 tasks
Tracked by #2

npm specifiers roadmap #15960

dsherret opened this issue Sep 19, 2022 · 21 comments

Comments

@dsherret
Copy link
Member

dsherret commented Sep 19, 2022

@ry ry pinned this issue Sep 19, 2022
@dsherret dsherret added feat new feature (which has been agreed to/accepted) cli related to cli/ dir node compat and removed feat new feature (which has been agreed to/accepted) cli related to cli/ dir labels Sep 19, 2022
@loynoir
Copy link

loynoir commented Oct 1, 2022

FYI, you may also try https://esm.sh/{{npm_package}}@{{version}}, that is self-hostable, and support types with zero config.
For private module, you can combine with verdaccio, and docker to save your time.
This workflow is network base. Easy to use/cache in container.

@kidonng
Copy link
Contributor

kidonng commented Oct 1, 2022

@loynoir off-topic, but I'd like to mention that esm.sh is developed by a Deno team member. Better support for npm specifiers is going to eliminate the need to resort to third-party solutions like such.

@AnInternetTroll
Copy link
Contributor

@kidonng I don't want to repeat what was said in #13703, but esm.sh absolutely has it's place in the deno ecosystem. Writing browser compatible code is a goal we should strive for when we can, and esm.sh does it perfectly imo

@deckchairlabs
Copy link

Just a question regarding import.meta.resolve. How will this work if I pass an npm specifier? Will it resolve to the npm registry URL?

@dsherret
Copy link
Member Author

dsherret commented Oct 5, 2022

@deckchairlabs let's discuss in #16089 -- probably returns the cached path

@MarkBennett
Copy link

Is there any plan to support directly running code meant for node?

For example, I'm trying to run mocha.js which targets commonjs and uses require statements. Is this supported? Is there a way to use an npm specifier to import from a local file?

@catuhana
Copy link
Contributor

Any reason why https://github.com/denoland/deno/blob/main/cli/npm/cache.rs#L222 isn't being tracked here?

@dsherret
Copy link
Member Author

@tuhanayim I added it just now. Curious what package you ran into that wasn't all lowercase?

@catuhana
Copy link
Contributor

catuhana commented Nov 14, 2022

@dsherret @commitlint/cli. I don't think it's a lower/uppercase mismatch though, it just panics there.

@catuhana
Copy link
Contributor

catuhana commented Nov 14, 2022

Ok, it's because of a module named JSONStream. Dependency flow: @commitlint/cli > @commitlint/lint > @commitlint/parse > conventional-commits-parser > JSONStream

@h76oeI6pMxU9g4p8aCpc6Q
Copy link

h76oeI6pMxU9g4p8aCpc6Q commented Nov 15, 2022

When I using bitcoinjs-lib and bip32 with deno npm specifiers.

(Skipped some code, only showing the related)

import bitcoin from 'npm:bitcoinjs-lib'
import { BIP32Factory as bip32 } from 'npm:bip32'
import bip39 from 'npm:bip39'
import * as ecc from 'npm:tiny-secp256k1'

let mnemonic = 'mnemonic'
let seed = bip39.mnemonicToSeedSync(mnemonic)
let root = bip32(ecc).fromSeed(seed)

This code throw error from fromSeed() function which is using hmac SHA512
"error: Uncaught Error: Not implemented: crypto.Hmac"

Because of this, I can't using bitcoinjs-lib with deno.
I temporarily using node.js instead until deno implemented crypto.Hmac.

@oscarotero
Copy link
Contributor

Is there any work planned for the task automatic acquisition of @types package for type checking? I think this is the cause of TSX warnings about JSX.IntrinsicElements in React, if the jsxImportSource is configured to "npm:react" (it doesn't happen with npm:preact).

@dsherret
Copy link
Member Author

dsherret commented Nov 15, 2022

@Bzvwf16WSDKoSZd8 there is an open issue here denoland/std#2557 also there is #16107

Is there any plan to support directly running code meant for node?

@MarkBennett not at the moment. That would mean supporting applications written with CommonJS in Deno and having Node globals, which we want to avoid. It would be ideal for Deno to remain ESM only. We probably will support specifiers like node:fs in the future though.

I think this is the cause of TSX warnings about JSX.IntrinsicElements in React, if the jsxImportSource is configured to "npm:react" (it doesn't happen with npm:preact).

@oscarotero would you be able to open an issue for this one? Sounds like there's a pain point here. Thanks.

@oscarotero
Copy link
Contributor

@dsherret Done! #16653

@h76oeI6pMxU9g4p8aCpc6Q
Copy link

h76oeI6pMxU9g4p8aCpc6Q commented Nov 16, 2022

not at the moment. That would mean supporting applications written with CommonJS in Deno and having Node globals, which we want to avoid. It would be ideal for Deno to remain ESM only. We probably will support specifiers like node:fs in the future though.

@dsherret I agree. To maintain consistency with the browser code, Deno should only keep the ESM.

@dsherret
Copy link
Member Author

@tuhanayim non-all lowercase package name support will be in 1.28.1 (releasing later today) #16669

@catuhana
Copy link
Contributor

@tuhanayim non-all lowercase package name support will be in 1.28.1 (releasing later today) #16669

That was quick! Thanks 🙏

@cmoog
Copy link
Contributor

cmoog commented Nov 16, 2022

Is compatibility with NextJS planned / being tracked?

@dsherret
Copy link
Member Author

@cmoog that's something we're looking into, but I recommend opening an issue about anything not working.

@denoland denoland locked and limited conversation to collaborators Nov 16, 2022
@dsherret
Copy link
Member Author

dsherret commented Nov 16, 2022

If anyone has a question or issue with npm compatibility I recommend opening an issue so that we can track everything individually within issues. That also helps make everything more searchable for others. Going to lock this issue to encourage that.

@bartlomieju bartlomieju unpinned this issue Feb 21, 2023
@dsherret
Copy link
Member Author

Going to close this one as it doesn't seem worth tracking anymore. deno compile and vendor support will come in 1.34.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants