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

48 commits

Author SHA1 Message Date
Nayeem Rahman
3f26310728
feat(lsp): auto-imports with @deno-types directives (#26821)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-11-15 14:40:32 +00:00
David Sherret
617350e79c
refactor(resolver): move more resolution code into deno_resolver (#26873)
Follow-up to cjs refactor.

This moves most of the resolution code into the deno_resolver crate.
Still pending is the npm resolution code.
2024-11-14 15:24:25 -05:00
David Sherret
f091d1ad69
feat(node): stabilize detecting if CJS via "type": "commonjs" in a package.json (#26439)
This will respect `"type": "commonjs"` in a package.json to determine if
`.js`/`.jsx`/`.ts`/.tsx` files are CJS or ESM. If the file is found to
be ESM it will be loaded as ESM though.
2024-11-13 15:10:09 +00:00
Nayeem Rahman
5088b25f23
feat(lsp): auto-import completions from byonm dependencies (#26680) 2024-11-06 06:26:46 +00:00
David Sherret
826e42a5b5
fix: improved support for cjs and cts modules (#26558)
* cts support
* better cjs/cts type checking
* deno compile cjs/cts support
* More efficient detect cjs (going towards stabilization)
* Determination of whether .js, .ts, .jsx, or .tsx is cjs or esm is only
done after loading
* Support `import x = require(...);`

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-01 12:27:00 -04:00
Nayeem Rahman
2f0c25d33f
fix(lsp): include unstable features from editor settings (#26655) 2024-10-31 10:52:43 +00:00
Nayeem Rahman
3881b71734
feat(lsp): quick fix for @deno-types="npm:@types/*" (#25954) 2024-10-01 22:55:02 +01:00
David Sherret
69ab720025
refactor: move ByonmNpmResolver to deno_resolver (#25937)
Some more slow progress on moving all the resolution code into
deno_resolver.
2024-09-30 13:33:32 +00:00
David Sherret
fc739dc5eb
refactor: use deno_path_util (#25918) 2024-09-28 07:55:01 -04:00
Yazan AbdAl-Rahman
bed46474b2
fix: do not panic running invalid file specifier (#25530)
Co-authored-by: Bedis Nbiba <bedisnbiba@gmail.com>
2024-09-18 14:51:39 +01: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
David Sherret
c21f42c825
fix(lsp): don't always use byonm resolver when DENO_FUTURE=1 (#24865)
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2024-08-09 09:50:37 +02:00
David Sherret
04473c04ed
fix(compile): support workspace members importing other members (#24909) 2024-08-07 07:43:05 +00:00
David Sherret
3bf147fe28
refactor: decouple node resolution from deno_core (#24724) 2024-07-25 19:08:14 -04:00
David Sherret
763f05e74d
fix(unstable): move sloppy-import warnings to lint rule (#24710)
Adds a new `no-sloppy-imports` lint rule and cleans up the lint code.

Closes #22844
Closes https://github.com/denoland/deno_lint/issues/1293
2024-07-25 09:07:59 -04:00
David Sherret
afcae364be
refactor: update to deno_config 0.25 (#24645)
- Gets rid of WorkspaceMemberContext. It's now `Workspace` and
`WorkspaceDirectory`
- Uses the workspace cache in the lsp

* https://github.com/denoland/deno_config/pull/95
* https://github.com/denoland/deno_config/pull/96
2024-07-19 15:56:07 -04:00
David Sherret
3bda8eb4fe
fix(lsp): support npm workspaces and fix some resolution issues (#24627)
Makes the lsp use the same code as the rest of the cli.
2024-07-18 18:16:35 -04:00
David Sherret
f4b9d85862
fix(workspace): support resolving bare specifiers to npm pkgs within a workspace (#24611)
This makes bare specifiers for npm packages work when inside a
workspace, which emulates the same behaviour as when there's a
node_modules directory. The bare specifier can be overwritten by
specifying an import map entry or package.json dependency entry.

* https://github.com/denoland/deno_config/pull/88

Closes #24605
2024-07-17 09:13:22 -04: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
David Sherret
4d2d764816
feat(jsr): support publishing jsr packages in npm workspaces (#24507)
Supports publishing an npm workspace with a directory structure similar
to the following:

- workspace
  - package.json
  - package-a
    - package.json
    - jsr.json
  - package-b
    - package.json
    - jsr.json

deno_config PR: https://github.com/denoland/deno_config/pull/77

Closes https://github.com/denoland/deno/issues/23638
2024-07-10 14:46:09 -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
839caf6faf
refactor: use concrete error types for node resolution (#24470)
This will help clean up some of the code in the CLI because we'll be
able to tell how the resolution failed (not part of this PR).
2024-07-09 12:15:03 -04: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
Bartek Iwańczuk
b0cd43b5f3
fix(lsp): use CliLockfile (#24387)
The build broke in https://github.com/denoland/deno/pull/24365.
2024-07-01 22:14:17 +00:00
Nayeem Rahman
38a6be2e8e
fix(lsp): respect lockfile redirects entries for resolution (#24365) 2024-07-01 22:08:32 +01:00
Nayeem Rahman
67dcd6db51
feat(lsp): ts language service scopes (#24345) 2024-06-26 23:47:01 +01:00
David Sherret
0da01c0ca6
refactor: move PackageJson to deno_config (#24348) 2024-06-26 21:24:10 +00:00
Nayeem Rahman
5dec3fd4b7
feat(lsp): multi deno.json resolver scopes (#24206) 2024-06-17 21:54:23 +01:00
Satya Rohith
0f48313565
chore: upgrade to rust 1.79 (#24207) 2024-06-14 17:10:57 +05:30
Nayeem Rahman
0c199acb88
refactor(lsp): collect npm reqs by scope (#24172) 2024-06-11 18:14:36 +01: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
Nayeem Rahman
7c5dbd5d54
feat(lsp): workspace jsr resolution (#24121) 2024-06-10 17:03:17 +01:00
David Sherret
386d5c8310
refactor: remove PermissionsContainer in deno_runtime (#24119)
Also removes permissions being passed in for node resolution. It was
completely useless because we only checked it for reading package.json
files, but Deno reading package.json files for resolution is perfectly
fine.

My guess is this is also a perf improvement because Deno is doing less
work.
2024-06-06 23:37:53 -04:00
David Sherret
7ed90a20d0
fix: better handling of npm resolution occurring on workers (#24094)
Closes https://github.com/denoland/deno/issues/24063
2024-06-05 17:04:16 +02:00
David Sherret
3341c50b6a
refactor: don't share reqwest::HttpClient across tokio runtimes (#24092)
This also fixes several issues where we weren't properly creating http
clients with the user's settings.
2024-06-03 21:17:08 +00:00
Nayeem Rahman
14a74600de
perf(lsp): lock out requests until init is complete (#23998) 2024-05-29 01:26:43 +01: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
0a30897925
refactor(lsp): determine file referrer for each document (#23867) 2024-05-23 17:31:56 +01:00
Nayeem Rahman
a5111fbc4d
fix(cli): use CliNodeResolver::resolve() for managed node_modules (#23902) 2024-05-21 17:54:15 +01:00
Nayeem Rahman
88529f0b47
refactor(lsp): reuse CliGraphResolverOptions::sloppy_imports_resolver (#23764) 2024-05-13 17:55:31 +01:00
Nayeem Rahman
439b3b8db9
refactor(lsp): unify caching into LspCache (#23746) 2024-05-09 20:22:27 +01:00
Nathan Whitaker
dc29986ae5
fix(lsp): move sloppy import resolution from loader to resolver (#23751)
Moves sloppy import resolution from the loader to the resolver.

Also adds some test helper functions to make the lsp tests less verbose

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-05-09 14:17:31 +00:00
Nayeem Rahman
cbb78e138f
refactor(lsp): reland move resolver fields to LspResolver (#23685) 2024-05-07 03:20:15 +01:00
Divy Srivastava
7f80d90f1c
Revert "refactor(lsp): move fields from Documents to LspResolver" (#23626)
This reverts commit 5cae343991.


![image](https://github.com/denoland/deno/assets/34997667/e68e40a1-7baf-453b-80d9-f8b6aae186c7)

Caused a +3.3s regression in one of the LSP benchmarks at
deno.land/benchmarks.
2024-05-01 05:54:25 +00:00
Nayeem Rahman
5cae343991
refactor(lsp): move fields from Documents to LspResolver (#23585) 2024-04-30 02:41:19 +01:00
Nayeem Rahman
f8ddcc4f78
refactor(lsp): unify resolver types into LspResolver (#23514) 2024-04-26 21:39:33 +01:00
Kitson Kelly
f5eb177f50
feat(cli): support React 17 JSX transforms (#12631)
Closes #8440
2021-11-09 12:26:39 +11:00
Kitson Kelly
34a9ddff09
refactor(lsp): use deno_graph and single document struct (#12535)
Closes #12473
2021-10-29 10:56:01 +11:00