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
7d326c269c
fix(lsp): skip code action edits that can't be converted ( #26831 )
2024-11-12 13:15:32 +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
d92d2fe9b0
fix(lsp): make missing import action fix infallible ( #26539 )
2024-10-25 21:52:50 +01:00
David Sherret
3fc9e49613
refactor: remove usage of full_range ( #26065 )
...
For https://github.com/denoland/deno_graph/pull/538/files
This was removed because the deserialization was not backwards
compatible.
2024-10-08 11:48:29 +00:00
Nayeem Rahman
053894b9e0
fix(lsp): exclude missing import quick fixes with bad resolutions ( #26025 )
2024-10-07 18:20:45 +01:00
Nayeem Rahman
3881b71734
feat(lsp): quick fix for @deno-types="npm:@types/*" ( #25954 )
2024-10-01 22:55:02 +01: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
Nayeem Rahman
97d1635343
fix(lsp): panic on url_to_uri() ( #25238 )
2024-08-28 05:15:48 +01:00
Nayeem Rahman
2ab4afc6b8
refactor(lsp): changes for lsp_types 0.97.0 ( #25169 )
2024-08-24 01:21:21 +01:00
Nayeem Rahman
4eff1e8ec4
fix(lsp): import map lookup for jsr subpath auto import ( #25025 )
2024-08-14 22:38:18 +01: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
Nayeem Rahman
a45a40533e
fix(lsp): rewrite import for 'infer return type' action ( #24685 )
2024-07-23 19:39:14 +01:00
Nayeem Rahman
b30e5c0985
fix(lsp): strip .js before probing for valid import fix ( #24188 )
2024-06-12 22:22:57 +01: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
Luca Casonato
e084fe10a9
feat(lint): add no-boolean-literal-for-arguments
rule and enable no-unused-vars
for jsx files ( #24034 )
...
* https://github.com/denoland/deno_lint/pull/1271
* https://github.com/denoland/deno_lint/pull/1277
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-30 00:09:16 +00:00
Nayeem Rahman
0a30897925
refactor(lsp): determine file referrer for each document ( #23867 )
2024-05-23 17:31:56 +01: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
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
Igor Zinkovsky
b3d7df5535
perf: v8 code cache ( #23081 )
...
This PR enables V8 code cache for ES modules and for `require` scripts
through `op_eval_context`. Code cache artifacts are transparently stored
and fetched using sqlite db and are passed to V8. `--no-code-cache` can
be used to disable.
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-04-17 07:19:55 -07:00
Nayeem Rahman
9a31698207
fix(lsp): slice strings by byte index in code actions ( #23387 )
...
Fixes #23361 .
2024-04-16 01:07:32 +02:00
Nayeem Rahman
2b1c6e172e
feat(lsp): respect nested deno.json for fmt and lint config ( #23159 )
2024-04-02 23:02:50 +01:00
Nayeem Rahman
e1e1da2a04
fix(lsp): prefer cache over tsc quick fixes ( #23093 )
2024-03-27 03:10:23 +00:00
Nayeem Rahman
3b61104e2a
refactor(lsp): unify config file data into ConfigTree ( #23032 )
2024-03-26 15:52:20 +00:00
David Sherret
ffbcad3800
feat(lint): deno lint --fix
and lsp quick fixes ( #22615 )
...
Adds a `--fix` option to deno lint. This currently doesn't work for
basically any rules, but we can add them over time to deno lint.
2024-03-21 14:18:59 -07:00
David Sherret
3eaf174bfc
fix(node): improve cjs tracking ( #22673 )
...
We were missing saying that a file is CJS when some Deno code imported
from the node_modules directory at runtime.
2024-03-06 00:23:51 +00:00
Nayeem Rahman
e32c704970
feat(lsp): auto-import completions for jsr specifiers ( #22462 )
2024-02-21 02:45:00 +00:00
David Sherret
e5e2c45998
fix: upgrade to deno_ast 0.33 ( #22341 )
...
* Uses diagnostics from deno_ast
* Real fix for https://github.com/denoland/deno/pull/22310
* Moves `deno lint --json` code here
* Upgrades swc
Closes #22117
Closes #22109
Closes #21927
Closes #20993
2024-02-09 01:40:26 +00:00
David Sherret
fbfeedb68b
fix(lsp): improved npm specifier to import map entry mapping ( #22016 )
...
Upgrades to the latest deno_semver
2024-01-21 17:19:10 -05:00
Bartek Iwańczuk
69959aa01f
fix: update deno_lint and swc ( #21718 )
...
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-01-09 23:20:52 +00:00
林炳权
96b581bdd2
chore: update to Rust 1.75 ( #21731 )
2024-01-01 23:22:48 +01:00
David Sherret
7e72f3af61
chore: update copyright to 2024 ( #21753 )
2024-01-01 19:58:21 +00:00
David Sherret
e4c947dd2b
fix(node): use closest package.json to resolve package.json imports ( #21075 )
2023-11-04 16:41:51 +00:00
David Sherret
be97170a19
feat(unstable): ability to npm install
then deno run main.ts
( #20967 )
...
This PR adds a new unstable "bring your own node_modules" (BYONM)
functionality currently behind a `--unstable-byonm` flag (`"unstable":
["byonm"]` in a deno.json).
This enables users to run a separate install command (ex. `npm install`,
`pnpm install`) then run `deno run main.ts` and Deno will respect the
layout of the node_modules directory as setup by the separate install
command. It also works with npm/yarn/pnpm workspaces.
For this PR, the behaviour is opted into by specifying
`--unstable-byonm`/`"unstable": ["byonm"]`, but in the future we may
make this the default behaviour as outlined in
https://github.com/denoland/deno/issues/18967#issuecomment-1761248941
This is an extremely rough initial implementation. Errors are
terrible in this and the LSP requires frequent restarts. Improvements
will be done in follow up PRs.
2023-10-25 14:39:00 -04:00
David Sherret
148694eb35
refactor(npm): make NpmCache
, CliNpmRegistryApi
, and NpmResolution
internal to npm::managed
( #20764 )
2023-10-02 17:53:55 -04:00
David Sherret
8d24be1a59
refactor(npm): create cli::npm::managed
module ( #20740 )
...
Creates the `cli::npm::managed` module and starts moving more
functionality into it.
2023-09-30 12:06:38 -04:00
David Sherret
5edd102f3f
refactor(cli): make CliNpmResolver
a trait ( #20732 )
...
This makes `CliNpmResolver` a trait. The terminology used is:
- **managed** - Deno manages the node_modules folder and does an
auto-install (ex. `ManagedCliNpmResolver`)
- **byonm** - "Bring your own node_modules" (ex. `ByonmCliNpmResolver`,
which is in this PR, but unimplemented at the moment)
Part of #18967
2023-09-29 09:26:25 -04:00
David Sherret
d43e48c4e9
refactor(ext/node): remove dependency on deno_npm and deno_semver ( #20718 )
...
This is required from BYONM (bring your own node_modules).
Part of #18967
2023-09-28 22:43:45 +02:00
David Sherret
dcb00bb9b8
chore: slight cleanup in npm resolvers ( #20692 )
2023-09-26 16:42:39 -04:00
Nayeem Rahman
bb4b00df92
feat(lsp): cache all dependencies quick fix ( #20665 )
2023-09-24 23:33:52 +01:00
Nayeem Rahman
87ddd1f04d
fix(lsp): restore tsc's quick fix ordering ( #20545 )
2023-09-18 17:39:28 +01:00
Bartek Iwańczuk
4fcd9a0de8
fix(lsp): sort quickfix actions ( #17221 )
...
This commit changes ordering of quickfix actions, by sorting them in
following order:
- TSC fixes
- Deno fixes
- deno_lint fixes
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2023-09-17 19:05:19 +01:00
David Sherret
5834d282d4
refactor: upgrade deno_ast 0.28 and deno_semver 0.4 ( #20193 )
2023-08-21 09:53:52 +00:00