1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00
Commit graph

36 commits

Author SHA1 Message Date
David Sherret
af2d992ecd
feat: TypeScript 5.6 and npm:@types/node@22 (#25614) 2024-09-14 11:58:47 +01:00
David Sherret
8539cacbbe
chore: update more registry.json files (#25615)
Extracted out of https://github.com/denoland/deno/pull/25614

It's better for these to be non-minified because then diffs are better
when adding new versions.
2024-09-13 15:27:20 +01:00
David Sherret
b0265eaf8f
chore(test): add script for pruning registry.json files (#25594) 2024-09-12 12:15:38 +00:00
snek
f9007d3386
feat: require(esm) (#25501)
implement require(esm) using `op_import_sync` from deno_core.

possible future changes:
- cts and mts
- replace Deno.core.evalContext to optimize esm syntax detection

Fixes: https://github.com/denoland/deno/issues/25487
2024-09-10 20:12:36 +00:00
David Sherret
c6d1b0a1cc
fix(byonm): resolve npm deps of jsr deps (#25399)
This allows using npm deps of jsr deps without having to add them to the
root package.json.

Works by taking the package requirement and scanning the
`node_modules/.deno` directory for the best matching package, so it
relies on deno's node_modules structure.

Additionally to make the transition from package.json to deno.json
easier, Deno now:

1. Installs npm deps in a deno.json at the same time as installing npm
deps from a package.json.
2. Uses the alias in the import map for `node_modules/<alias>` for
better package.json compatiblity.
2024-09-04 14:00:44 +00:00
Luca Casonato
b333dccee8
feat(cli): give access to process global everywhere (#25291) 2024-09-04 11:04:06 +02:00
Luca Casonato
64037b1f02
refactor: don't virtualize the console global for node mode (#25263)
Turns out we only virtualized it so one could have a `Console` property,
and the other one not. We can just make this `console.Console` available
everywhere.
2024-08-28 21:13:34 +02:00
Nathan Whitaker
48da3c17ea
fix(add): Handle packages without root exports (#25102)
Fixes #24607.

This PR makes the logic that caches top level dependencies (things
present in import map) smarter, so we handle JSR dependencies without
root exports.
2024-08-21 15:23:32 -07:00
HasanAlrimawi
0704454755
feat: Print deprecation message for npm packages (#24992)
This commit adds ability to print deprecation notices
for npm packages that have been marked as deprecated.

Closes #24013
2024-08-20 19:53:53 +02:00
Hajime-san
19bcb40059
feat(cli/tools): add a subcommand --hide-stacktraces for test (#24095) 2024-08-20 01:27:36 +00:00
Yoshiya Hinosawa
b6cdb31c05
fix(ext/node): fix prismjs compatibiliy in Web Worker (#25062)
PrismJS uses `WorkerGlobalScope` and `self` for detecting browser's Web
Worker context:
59e5a34713/prism.js (L11)

Now the detection logic above is broken when it's imported from Deno's
Web Worker context because we only hide `self` (Prism assumes when
`WorkerGlobalScope` is available, `self` is also available).

This change fixes the above by also hiding `WorkerGlobalScope` global in
Node compat mode.

closes #25008
2024-08-17 11:16:43 +09:00
Yoshiya Hinosawa
105d27bc7d
fix(ext/node): improve shelljs compat with managed npm execution (#24912)
This change improves the Node.js compatibility in managed npm resolution
mode by disabling the discovery of `node_modules` when the
main specifier is inside of `DENO_DIR`.

closes #22732
closes #24589
2024-08-16 12:48:48 +09:00
Nayeem Rahman
4eff1e8ec4
fix(lsp): import map lookup for jsr subpath auto import (#25025) 2024-08-14 22:38:18 +01:00
Bartek Iwańczuk
ffe1bfd54c
feat: deno init --serve (#24897)
This commit adds "--serve" flag to "deno init" subcommand,
that provides a template for quick starting a project using
"deno serve".

---------

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-08-08 16:54:39 +00:00
Luca Casonato
1faac2dce3
fix(ext/node): handle node child_process with --v8-options flag (#24804)
Makes `v8flags` package from NPM work.
2024-07-31 16:28:08 +02:00
David Sherret
fe884c557a
fix(compile/windows): handle cjs re-export of relative path with parent component (#24795)
Closes https://github.com/denoland/deno/issues/24785
2024-07-30 16:46:15 -04:00
Yoshiya Hinosawa
76b8ecbb6d
fix(ext/node): do not expose self global in node (#24637)
closes #23727
2024-07-19 12:37:08 +09:00
Nathan Whitaker
c9da27e147
fix(cli): Create child node_modules for conflicting dependency versions, respect aliases in package.json (#24609)
Fixes #24419.
2024-07-16 20:30:28 +00:00
Nathan Whitaker
04f9db5b22
fix(node): Fix --allow-scripts with no deno.json (#24533)
We would resolve the wrong package.json, resulting in an inability to
run CJS (or other node-mode) scripts
2024-07-15 12:11:09 -07:00
David Sherret
8754a01d43
fix(init): use bare specifier for jsr:@std/assert (#24581)
Closes #24580
2024-07-14 13:22:43 -04:00
Nathan Whitaker
3d0e1b65b1
fix(node): Ignore broken default install scripts (#24534)
NPM inserts a default install script when a package has a `binding.gyp`
file.

It's possible, however, for the package to exclude the `binding.gyp`
file when they publish, and in this case the install script will never
succeed for a user of the package.

This happens with `fsevents`, for instance. They don't include the
`binding.gyp` file in their published tarball, but the default install
script appears in the manifest served by `npm`.

This causes us to warn that `fsevents` has an install script, but when
you try to run it it fails due to `binding.gyp` not existing.
2024-07-11 18:39:45 +00:00
David Sherret
a49d0bd10b
fix(check): CJS types importing dual ESM/CJS package should prefer CJS types (#24492)
Closes #16370
2024-07-10 14:46:25 -04:00
Nathan Whitaker
ce7dc2be92
feat(node): Support executing npm package lifecycle scripts (preinstall/install/postinstall) (#24487)
Adds support for running npm package lifecycle scripts, opted into via a
new `--allow-scripts` flag.

With this PR, when running `deno cache` (or `DENO_FUTURE=1 deno
install`) you can specify the `--allow-scripts=pkg1,pkg2` flag to run
lifecycle scripts attached to the given packages.

Note at the moment this only works when `nodeModulesDir` is true (using
the local resolver).

When a package with un-run lifecycle scripts is encountered, we emit a
warning suggesting things may not work and to try running lifecycle
scripts. Additionally, if a package script implicitly requires
`node-gyp` and it's not found on the system, we emit a warning.

Extra things in this PR:
- Extracted out bits of `task.rs` into a separate module for reuse
- Added a couple fields to `process.config` in order to support
`node-gyp` (it relies on a few variables being there)
- Drive by fix to downloading new npm packages to test registry

---

TODO:
- [x] validation for allow-scripts args (make sure it looks like an npm
package)
- [x] make allow-scripts matching smarter
- [ ] figure out what issues this closes

---
Review notes:
- This adds a bunch of deps to our test registry due to using
`node-gyp`, so it's pretty noisy
2024-07-10 03:06:08 +00:00
David Sherret
147411e64b
feat: npm workspace and better Deno workspace support (#24334)
Adds much better support for the unstable Deno workspaces as well as
support for npm workspaces. npm workspaces is still lacking in that we
only install packages into the root node_modules folder. We'll make it
smarter over time in order for it to figure out when to add node_modules
folders within packages.

This includes a breaking change in config file resolution where we stop
searching for config files on the first found package.json unless it's
in a workspace. For the previous behaviour, the root deno.json needs to
be updated to be a workspace by adding `"workspace":
["./path-to-pkg-json-folder-goes-here"]`. See details in
https://github.com/denoland/deno_config/pull/66

Closes #24340
Closes #24159
Closes #24161
Closes #22020
Closes #18546
Closes #16106
Closes #24160
2024-07-04 00:54:33 +00:00
David Sherret
4bc96c5d2a
fix(npm): resolve dynamic npm imports individually (#24170)
* https://github.com/denoland/deno_npm/pull/57
* https://github.com/denoland/deno_graph/pull/498

Closes https://github.com/denoland/deno/issues/17802
2024-06-11 08:55:12 -04:00
Luca Casonato
c1f23c5788
fix(ext/node): lossy UTF-8 read node_modules files (#24140)
Previously various reads of files in `node_modules` would error on
invalid UTF-8. These were cases involving:

- reading package.json from Rust
- reading package.json from JS
- reading CommonJS files from JS
- reading CommonJS files from Rust (for ESM translation)
- reading ESM files from Rust
2024-06-08 18:36:13 +02:00
David Sherret
566adb7c0a
fix(npm): use configured auth for tarball urls instead of scope auth (#24111)
Deno was using the scope auth for the tarball urls, which is not always
correct. We are going to do a release immediately for this issue.
2024-06-05 21:24:52 +00:00
Nathan Whitaker
a379009bfd
fix(cli): Prefer npm bin entries provided by packages closer to the root (#24024)
Fixes #24012.

In the case of multiple packages providing a binary with a same name, we
were basically leaving the results undefined (since we set up things in
parallel, and whichever got set up first won). In addition, we were
warning about these cases, even though it's a situation that's expected
to occur.

Instead, in the case of a collision in the binary names, we prefer the
binary provided by the package with the least depth in the dependency
tree.

While I was at it, I also took moved more code to `bin_entries.rs` since
it was starting to get a bit cluttered.
2024-05-29 17:45:22 -07:00
David Sherret
448fe67b7a
feat(vendor): support modifying remote files in vendor folder without checksum errors (#23979)
Includes:

* https://github.com/denoland/deno_graph/pull/486
* https://github.com/denoland/deno_graph/pull/488
* https://github.com/denoland/deno_lockfile/pull/25
* https://github.com/denoland/deno_lockfile/pull/22
* https://github.com/denoland/deno_graph/pull/483
* https://github.com/denoland/deno_graph/pull/470
2024-05-28 14:58:43 -04:00
Bartek Iwańczuk
92a8d09e49
fix(npm): set up node_modules/.bin/ entries for package that provide bin entrypoints (#23496)
Closes https://github.com/denoland/deno/issues/23036

---------

Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-05-23 23:43:38 +00:00
Bartek Iwańczuk
959739f609
FUTURE: initial support for .npmrc file (#23560)
This commit adds initial support for ".npmrc" files.

Currently we only discover ".npmrc" files next to "package.json" files
and discovering these files in user home dir is left for a follow up.

This pass supports "_authToken" and "_auth" configuration
for providing authentication.

LSP support has been left for a follow up PR.

Towards https://github.com/denoland/deno/issues/16105
2024-05-23 23:26:23 +02:00
Nayeem Rahman
cc8c0609eb
fix(lsp): apply import fix to missing declaration code action (#23924) 2024-05-21 21:15:16 +01:00
Nayeem Rahman
a5111fbc4d
fix(cli): use CliNodeResolver::resolve() for managed node_modules (#23902) 2024-05-21 17:54:15 +01:00
David Sherret
a9708037c9
fix(node): better cjs re-export handling (#23760)
Closes #23458
2024-05-10 09:55:20 -04:00
David Sherret
998036b399
chore: fix flaky net_listen_allow_localhost_4555 (#23726)
Moves the test npm registry server port from `4558` to `426x`
2024-05-07 17:21:56 +00:00
David Sherret
1587387bcc
chore(test): move npm registries to separate servers and to the tests/registry folder (#23717)
1. Moves the npm registries to their own dedicated ports.
2. Moves the data files out of `tests/testdata/npm/registry` to
`tests/registry/npm`.
2024-05-07 01:06:01 +00:00