0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-01 12:16:11 -05:00
Commit graph

7091 commits

Author SHA1 Message Date
denobot
46e2f9a47e
2.1.9 (#27886)
Bumped versions for 2.1.9

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-01-31 01:21:43 +01:00
denobot
318646f767
2.1.8 (#27878)
Bumped versions for 2.1.8

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-01-30 19:19:27 +01:00
Nathan Whitaker
c31b670323
fix(lsp): ignore errors on ambient module imports (#27855)
This makes it so imports of ambient modules (e.g. `$app/environment` in
svelte, any virtual module in vite, or other module provided by a
bundler) don't error in the LSP.

The way this works is that when we request diagnostics from TSC, we also
respond with the list of ambient modules. Then, in the diagnostics code,
we save diagnostics (produced by deno) that may be invalidated as an
ambient module and wait to publish the diagnostics until we've received
the ambient modules from TSC.

The actual ambient modules you get from TSC can contain globs, e.g.
`*.css`. So when we get new ambient modules, we compile them all into a
regex and check erroring imports against that regex. Ambient modules
should change rarely, so in most cases we should be using a pre-compiled
regex, which executes in linear time (wrt the specifier length).

TODO:
- Ideally we should only publish once, right now we publish with the
filtered specifiers and then the TSC ones
- deno check (#27633)
2025-01-30 15:34:59 +01:00
David Sherret
ea837b678e
fix(init): correct dev task for --lib (#27860) 2025-01-30 15:34:59 +01:00
David Sherret
7dd8e40f60
fix(check): compiler options from workspace members (#27785)
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2025-01-30 15:34:58 +01:00
David Sherret
55b19e3e7a
perf(node_resolver): reduce url to/from path conversions (#27839)
Extracted out of https://github.com/denoland/deno/pull/27838/files

Reduces some allocations by accepting either a pathbuf or url for the
referrer for resolution and returning either a pathbuf or url at the
end, which the caller can then convert into to their preferred state.

This is about 4% faster when still converting the final result to a url
and 6% faster when keeping the result as a path in a benchmark I ran.
2025-01-30 15:34:56 +01:00
David Sherret
690da479dd
fix(install/global): warn about not including auto-discovered config file (#27745)
Closes #17855
2025-01-30 15:34:56 +01:00
Divy Srivastava
a2d0368444
fix(core): handle dyn imports exceeding call stack size (#27825)
Fixes https://github.com/denoland/deno/issues/27736
2025-01-30 15:34:55 +01:00
Bartek Iwańczuk
244bf5c2be
perf(lsp): cache completion item resolution during request (#27831)
This commit adds a simple HashMap cache to completion requests.

On a test project the time to compute completions went from 1200ms
to 75ms and the cache contained ~300 entries when 8000 completion
items were produced by the TSC.

This is a short-lived cache and is discarded once the completion
request is finished. In a follow up commits we could make it persist
between requests.
2025-01-30 15:34:55 +01:00
David Sherret
20a910e5f8
fix(node): align type stripping in node_modules error message with Node (#27809) 2025-01-30 15:34:54 +01:00
Kenta Moriuchi
84429352da
fix(types): Deno.readDirSync's type returns an IteratorObject (#27805) 2025-01-30 15:34:54 +01:00
David Sherret
d7b1f99d7a
refactor: make PackageJsonCache injectable (#27800)
This used to be complicated to do, but is now trivial.
2025-01-30 15:34:54 +01:00
Yoshiya Hinosawa
134f5e1282
chore: update ensure_registry_files_local to handle scoped packages (#27801) 2025-01-30 15:34:54 +01:00
Bartek Iwańczuk
0273f30974
refactor(tsc): remove TS program creation during snapshotting (#27797)
This commit refactors how a snapshot is created for the TypeScript
compiler.

Instead of having 4 ops, only a single op ("op_load") is left. This is
achieved by not creating a "ts.Program" during snapshotting, that during
benchmarking doesn't provide much benefit.

This greatly simplifies build script for the TS snapshot and opens up
way to simplify it even further in follow up PRs.
2025-01-30 15:34:54 +01:00
David Sherret
a63f614ba1
refactor: add WorkspaceFactory and ResolverFactory (#27766)
Allows easily constructing a `DenoResolver` using the exact same logic
that we use in the CLI (useful for dnt and for external bundlers). This
code is then used in the CLI to ensure the logic is always up-to-date.

```rs
use std::rc::Rc;

use deno_resolver:🏭:ResolverFactory;
use deno_resolver:🏭:WorkspaceFactory;
use sys_traits::impls::RealSys;

let sys = RealSys;
let cwd = sys.env_current_dir()?;
let workspace_factory = Rc::new(WorkspaceFactory::new(sys, cwd, Default::default()));
let resolver_factory = ResolverFactory::new(workspace_factory.clone(), Default::default());
let deno_resolver = resolver_factory.deno_resolver().await?;
```
2025-01-30 15:34:53 +01:00
David Sherret
f81debe9f6
fix: do not log cache creation failure on readonly file system (#27794) 2025-01-30 15:34:53 +01:00
Luca Casonato
e01719ba60
fix(publish): unfurl sloppy imports in d.ts files and type imports (#27793)
Fixes a bug discovered while trying to publish a package with .js +
.d.ts with sloppy imports.
2025-01-30 15:34:53 +01:00
Bartek Iwańczuk
212b6e7a21
refactor(tsc): split TS compiler into multiple files, use ESM (#27784)
This is a pure refactor, the `99_main_compiler.js` file
was getting out of hand, being over 1500 lines and serving
3 distinct purposes:
- snapshotting
- type-checking
- running LSP

The file was split into:
- 97_ts_host.js
- 98_lsp.js
- 99_main_compiler.js
2025-01-30 15:34:53 +01:00
David Sherret
d29d4ca648
refactor: use DataUrl from deno_media_type (#27783)
This was moved from deno_graph to deno_media_type.
2025-01-30 15:34:52 +01:00
David Sherret
26ced754fd
chore: fix hmr build (#27781)
Closes #27761
2025-01-30 15:34:52 +01:00
Nayeem Rahman
984a775f89
fix(lsp): silence debug error for 'move to a new file' action (#27780) 2025-01-30 15:34:52 +01:00
Ian Bull
0589e7d73f
chore: note in flags output that unstable is deprecated (#27334) 2025-01-30 15:34:51 +01:00
crowlkats
379079d904
fix: use serde feature for log crate in cli/lib 2025-01-22 01:51:38 +01:00
denobot
1c02412270
2.1.7 (#27765)
Bumped versions for 2.1.7

Please ensure:
- [x] Target branch is correct (`vX.XX` if a patch release, `main` if
minor)
- [x] Crate versions are bumped correctly
- [x] Releases.md is updated correctly (think relevancy and remove
reverts)

To make edits to this PR:
```shell
git fetch upstream release_2_1.7 && git checkout -b release_2_1.7 upstream/release_2_1.7
```

cc @crowlKats

Co-authored-by: crowlKats <crowlKats@users.noreply.github.com>
2025-01-21 16:13:36 -08:00
David Sherret
a4476b4677
fix(install/global): remove importMap field from specified config file (#27744)
Closes https://github.com/denoland/deno/issues/27734

(cherry picked from commit 0d3d4f5466)
2025-01-22 00:24:23 +01:00
David Sherret
32e5941d91
perf(compile): remove swc from denort (#27721)
This is achieved by storing CJS export analysis ahead of time in the
executable, which should also improve the performance of `denort` by
this never being done anymore (I'm too lazy atm to bench this, but it
will be significant for some programs).

(cherry picked from commit 9aa02769c8)
2025-01-22 00:24:21 +01:00
David Sherret
2a4346ce23
chore: fix canary version (#27723)
Broken by
57dd66ec3d

Closes https://github.com/denoland/deno/issues/27719

(cherry picked from commit b962b87cfe)
2025-01-22 00:24:20 +01:00
David Sherret
39d9047834
refactor: move denort to separate crate (#27688)
This slightly degrades the performance of CJS export analysis on
subsequent runs because I changed it to no longer cache in the DENO_DIR
with this PR (denort now properly has no idea about the DENO_DIR). We'll
have to change it to embed this data in the binary and that will also
allow us to get rid of swc in denort (will do that in a follow-up PR).

(cherry picked from commit 57dd66ec3d)
2025-01-22 00:24:19 +01:00
Leo Kettmeir
4fe353c961
refactor: update deno_core and use more concrete errors (#27620)
waiting for https://github.com/denoland/deno_core/pull/1043

Fixes #27672

(cherry picked from commit 054075730c)
2025-01-22 00:24:19 +01:00
Bartek Iwańczuk
b197dcf4e9
refactor: add 'deno_process' crate (#27680)
Untangled the whole `runtime/ops/process.rs` from `ext/node/` and moved
to a separate `ext/process` crate.

(cherry picked from commit 0050857f51)
2025-01-22 00:24:16 +01:00
Bartek Iwańczuk
77218dfa2d
fix: use 'getrandom' feature for 'sys_traits' crate 2025-01-17 01:17:11 +01:00
denobot
4ee86d8d12
2.1.6 (#27704)
Bumped versions for 2.1.6

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-01-17 00:35:01 +01:00
Nathan Whitaker
5ed8092948
fix(outdated): Use latest tag even when it's the same as the current version (#27699)
Fixes https://github.com/denoland/deno/issues/27696.

Just a `>` that should've been a `>=`. Also made sure to filter out
deprecated versions.
2025-01-16 23:32:14 +01:00
Nathan Whitaker
4fb82de38e
fix(outdated): retain strict semver specifier when updating (#27701)
Fixes https://github.com/denoland/deno/issues/27697

If it's a strict bound (e.g. `1.0.0` as opposed to `^1.0.0` or other),
retain the strictness when we update
2025-01-16 23:32:13 +01:00
Nathan Whitaker
56fd15d92e
fix(check/lsp): fix bugs with tsc type resolution, allow npm packages to augment ImportMeta (#27690)
Fixes #26224.
Fixes #27042.

There were three bugs here:
- we were only resolving `/// <reference types` directives starting with
`npm:`, which meant we failed to resolve bare specifiers (this broke the
`/// <reference types="vite/client">` directive in most of the vite
templates)
- the `$node_modules` workaround caused us to fail to read files for
tsc. For instance tsc would construct new paths based on specifiers
containing `$node_modules`, and since we hadn't created those we weren't
mapping them back to the original (this broke some type resolution
within `vite/client`)
- our separation of `ImportMeta` across node and deno globals in tsc
meant that npm packages couldn't augment `ImportMeta` (this broke
`vite/client`'s augmentation to add `import.meta.env` and others)


After this, the only remaining issue in the vanilla vite template is our
error on `/vite.svg` (which is an ambient module), and I'll look into
that next.
2025-01-16 23:32:13 +01:00
Jo Franchetti
9534112073
docs: adding jsdocs info for console interface (#27666)
Signed-off-by: Jo Franchetti <jofranchetti@gmail.com>
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2025-01-16 23:32:13 +01:00
Phil Hawksworth
48f2587954
docs: JSDocs examples for prompt, confirm, and alert (#27695)
Adds examples
2025-01-16 23:32:13 +01:00
Phil Hawksworth
59ca3c6c57
docs:Adds examples in JSDocs for localStorage and sessionStorage (#27668)
Improves docs for:

- http://docs.deno.com/api/web/~/localStorage
- http://docs.deno.com/api/web/~/sessionStorage
2025-01-16 23:32:13 +01:00
Nathan Whitaker
d2a3319939
fix(check/lsp): correctly resolve compilerOptions.types (#27686)
Fixes https://github.com/denoland/deno/issues/27062

In the LSP we were passing `npm` specifiers to TSC as roots, but TSC
needs fully resolved specifiers (like the actual file path).

In `deno check` we were often excluding the specifiers entirely from the
roots.

In both cases, we need to resolve the specifiers fully and then pass
them to tsc
2025-01-16 23:32:12 +01:00
David Sherret
7e495dde58
refactor: create deno_lib crate (#27673)
Shifts just some code down for now. I'll do the rest of the refactor in
the next pr, but didn't want to drop a huge refactor.
2025-01-16 23:32:12 +01:00
Bartek Iwańczuk
e763b374ef
refactor: add 'deno_os' crate (#27655)
This commit creates "deno_os" extension crate and moves
numerous ops from "runtime/" crate to the new crate.
2025-01-16 23:32:11 +01:00
David Sherret
1bd66b09cc
refactor: move CliNpmResolver to deno_resolver::npm::NpmResolver (#27659)
As title. After this PR all npm resolution will be out of the CLI crate.
2025-01-16 23:32:11 +01:00
Marvin Hagemeister
526c66dd4e
feat(unstable): refactor js lint plugin AST (#27615)
This PR changes the underlying buffer backed AST format we use for
JavaScript-based linting plugins. It adds support for various new types,
makes traversal code a lot easier and is more polished compared to
previous iterations.

Here is a quick summary (in no particular order):

- Node prop data is separate from traversal, which makes traversal code
so much easier to reason about. Previously, it was interleaved with node
prop data
- spans are in a separate table as well, as they are rarely needed.
- schema is separate from SWC conversion logic, which makes 
- supports recursive plain objects
- supports numbers
- supports bigint
- supports regex
- adds all SWC nodes

Apologies, this is kinda a big PR, but it's worth it imo.

_Marking as draft because I need to update some tests tomorrow._
2025-01-16 23:32:11 +01:00
David Sherret
f6820dec52
refactor: deno_config 0.45 (#27660) 2025-01-16 23:32:11 +01:00
David Sherret
72124bb854
fix(compile/windows): better handling of deno_dir on different drive letter than code (#27654)
Closes https://github.com/denoland/deno/issues/27651
2025-01-16 23:32:10 +01:00
David Sherret
8b5b6cd561
refactor: create NpmInstaller (#27626)
This separates npm resolution code from npm installation (more work
towards moving resolution code out of the CLI and cleaning up this
code).
2025-01-16 23:32:10 +01:00
David Sherret
d5d1353084
fix(compile): store embedded fs case sensitivity (#27653) 2025-01-16 23:32:10 +01:00
Benjamin Swerdlow
428456681f
refactor(node_resolver): make conditions_from_resolution_mode configurable (#27596) 2025-01-16 23:32:09 +01:00
Nayeem Rahman
6fc6f5ebee
fix(lsp): handle pathless untitled URIs (#27637) 2025-01-16 23:32:09 +01:00
Nathan Whitaker
53d7f039ef
fix(lsp/check): don't resolve unknown media types to a .js extension (#27631)
Fixes https://github.com/denoland/deno/issues/25762. Note that some of
the things in that issue are not resolved (vite/client types not working
properly which has other root causes), but the wildcard module
augmentation specifically is fixed by this.

We were telling TSC that files with unknown media types had an extension
of `.js`, so the ambient module declarations weren't applying. Instead,
just don't resolve them, so the ambient declaration applies.
2025-01-16 23:32:09 +01:00