Commit graph

75 commits

Author SHA1 Message Date
David Sherret 4b7c6049ef
refactor: load bytes in deno_graph (#22212)
Upgrades deno_graph to 0.64 where deno_graph is now responsible for
turning bytes into a string. This is in preparation for Wasm modules.
2024-02-01 03:15:22 +00:00
Luca Casonato 745333f073
chore: improve unanalyzable dynamic import diagnostic (#22051) 2024-01-24 14:49:33 +01:00
Luca Casonato 052fd78690
refactor: use parsed source cache when unfurling import map (#22001) 2024-01-23 12:40:23 +01:00
David Sherret 69d5f136ba
feat(lockfile): track JSR and npm dependencies in config file (#22004)
See overview in https://github.com/denoland/deno_lockfile/pull/13
2024-01-22 22:31:12 +01:00
David Sherret 35c1652f56
fix(lsp): regression - formatting was broken on windows (#21972)
~~Waiting on: https://github.com/denoland/deno_config/pull/31~~

Closes #21971
Closes https://github.com/denoland/vscode_deno/issues/1029
2024-01-18 15:57:30 -05:00
David Sherret 4e72ca313a
refactor: use globbing from deno_config (#21925) 2024-01-15 19:15:39 -05:00
David Sherret daed588557
fix(config): regression - handle relative patterns with leading dot slash (#21922)
This is a hacky quick fix. We need to spend more time cleaning up this
code and push more stuff down into deno_config.

Closes #21916
2024-01-13 10:39:22 -05:00
Matt Mastracci a45c1e4ae4
chore: bump deno_core (#21832) 2024-01-10 09:48:40 +05:30
David Sherret e212e1fc35
perf: skip expanding exclude globs (#21817)
We were calling `expand_glob` on our excludes, which is very expensive
and unnecessary because we can pattern match while traversing instead.

1. Doesn't expand "exclude" globs. Instead pattern matches while walking
the directory.
2. Splits up the "include" into base paths and applicable file patterns.
This causes less pattern matching to occur because we're only pattern
matching on patterns that might match and not ones in completely
unrelated directories.
2024-01-08 17:18:42 +00:00
David Sherret 7e72f3af61
chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
Bartek Iwańczuk ece78cfb8a
refactor: nicer warning display (#21547) 2023-12-12 23:45:45 +09:00
David Sherret a1d823e27d
feat(compile): support discovering modules for more dynamic arguments (#21381)
This PR causes Deno to include more files in the graph based on how a
template literal looks that's provided to a dynamic import:

```ts
const file = await import(`./dir/${expr}`);
```

In this case, it will search the `dir` directory and descendant
directories for any .js/jsx/etc modules and include them in the graph.

To opt out of this behaviour, move the template literal to a separate
line:

```ts
const specifier = `./dir/${expr}`
const file = await import(specifier);
```
2023-12-01 20:12:10 +00:00
David Sherret 9ac405d587
feat(compile): support "bring your own node_modules" in deno compile (#21377)
Not tested thoroughly. This is a good start.

Closes #21350
2023-11-29 09:32:23 -05:00
Luca Casonato 7e56a0466f
fix: use correct import map in tar & upload (#21380) 2023-11-29 13:59:30 +00:00
Bartek Iwańczuk 585cf2de89
feat(unstable): tar up directory with deno.json (#21228)
Co-authored-by: David Sherret <dsherret@gmail.com>
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-11-23 23:38:07 +00:00
David Sherret 6e1f3aa013
fix(install): should work with non-existent relative root (#21161)
Closes #21160
2023-11-13 09:44:01 -05:00
Divy Srivastava 0b75a7169b
perf: lazy atexit setup (#21053)
`libc::atexit` incurrs 2% dyld cost at startup on macOS. This PR moves
the setup to when the tty mode is changed using op_stdin_set_raw.
2023-11-04 17:30:12 +05:30
David Sherret 02822d309f
fix(test): --junit-path should handle when the dir doesn't exist (#21044)
Closes https://github.com/denoland/deno/issues/21022
2023-11-01 19:59:51 +00:00
Bartek Iwańczuk 1713df1352
feat: deno run --unstable-hmr (#20876)
This commit adds `--unstable-hmr` flag, that enabled Hot Module Replacement.

This flag works like `--watch` and accepts the same arguments. If
HMR is not possible the process will be restarted instead.

Currently HMR is only supported in `deno run` subcommand.

Upon HMR a `CustomEvent("hmr")` will be dispatched that contains
information which file was changed in its `details` property.

---------

Co-authored-by: Valentin Anger <syrupthinker@gryphno.de>
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-10-31 01:25:58 +01:00
Divy Srivastava 09204107d8
fix: implement node:tty (#20892)
Fixes #21012
Closes https://github.com/denoland/deno/issues/20855
Fixes https://github.com/denoland/deno/issues/20890
Fixes https://github.com/denoland/deno/issues/20611
Fixes https://github.com/denoland/deno/issues/20336
Fixes `create-svelte` from https://github.com/denoland/deno/issues/17248

Fixes more reports here:
- https://github.com/denoland/deno/issues/6529#issuecomment-1432690559
- https://github.com/denoland/deno/issues/6529#issuecomment-1522059006
- https://github.com/denoland/deno/issues/6529#issuecomment-1695803570
2023-10-30 15:53:08 +00:00
Luca Casonato 08b99f3909
chore: update base64 crate (#20877) 2023-10-26 18:39:04 +02:00
Bartek Iwańczuk 8d9fef3b89
refactor: add WatcherCommunicator helper struct (#20927)
This commit introduces "WatcherCommunicator" struct that
is used facilitate bi-directional communication between CLI
file watcher and the watched function.

Prerequisite for https://github.com/denoland/deno/pull/20876
2023-10-19 07:05:00 +02:00
林炳权 7a01799f49
chore: update to Rust 1.73 (#20781) 2023-10-05 14:49:09 -04:00
Nayeem Rahman f5963b6a05
refactor(lsp): cleanup document preload (#20520) 2023-09-18 20:58:16 +01:00
Nayeem Rahman fa18878f54
fix(lsp): include JSON modules in local import completions (#20536) 2023-09-17 07:50:30 +01:00
Matt Mastracci dc505e905e
chore(cli): update chrono to remove broken time dep (#20508)
Fixes the last dependabot security warning
2023-09-14 13:17:38 -06:00
David Sherret e66d3c2c2e
refactor: remove DENO_UNSTABLE_NPM_SYNC_DOWNLOAD and custom sync functionality (#20504)
https://github.com/denoland/deno/pull/20488 enables us to remove this
functionality. This is better because our test suite is now not testing
a separate code path.
2023-09-14 17:51:28 +00:00
David Sherret 12a75e3b43
refactor: move deno_core::TaskQueue to cli::util::sync (#20481)
TaskQueue is being removed from `deno_core` and replaced with an unsync
version in deno_unsyc.

https://github.com/denoland/deno_core/pull/193

This is a change in preparation for that. The remaining
`deno_core::TaskQueue` usage in this repo should be replaced with
`deno_core::unsync::TaskQueue` once upgraded.
2023-09-13 21:53:07 +00:00
Nayeem Rahman 29ff0bfa9f
Reland "refactor(lsp): clean up "enablePaths" handling (#20388)" (#20423) 2023-09-09 15:04:21 +01:00
Nayeem Rahman 17276a1df9
fix: empty include in config file excludes all (#20404) 2023-09-08 15:04:45 +01:00
林炳权 2080669943
chore: update to Rust 1.72 (#20258)
<!--
Before submitting a PR, please read https://deno.com/manual/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->

As the title.

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-26 22:04:12 -06:00
Matt Mastracci c272d26ae8
chore(cli): remove atty crate (#20275)
Removes a crate with an outstanding vulnerability.
2023-08-25 07:43:07 -06:00
Bartek Iwańczuk f9beb92818
refactor: use "deno_config" crate (#20260)
Moved the configuration file to https://github.com/denoland/deno_config
as we will have to use it in other projects.
2023-08-24 11:21:34 +02:00
Matt Mastracci b1ce2e4167
fix(ext/web): add stream tests to detect v8slice split bug (#20253)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-08-23 17:03:05 -06:00
David Sherret b9b0386948
feat(unstable): rename deno_modules to vendor (#20065)
Renames the unstable `deno_modules` directory and corresponding settings
to `vendor` after feedback. Also causes the vendoring of the
`node_modules` directory which can be disabled via
`--node-modules-dir=false` or `"nodeModulesDir": false`.
2023-08-06 21:56:56 -04:00
David Sherret 1cefa831fd
feat(unstable): optional deno_modules directory (#19977)
Closes #15633
2023-08-02 00:49:09 +00:00
Bartek Iwańczuk 67de67a106
chore: update chrono dependency (#19943)
Pulled from https://github.com/denoland/deno/pull/19747

Authored-by: Cooper Benson <skycoop@gmail.com>
2023-07-26 01:40:09 +00:00
Bartek Iwańczuk 8a48fcc9d3
chore: disable rustls logging (#19859)
This commit disables internal logging coming from `rustls` crate.

So messages like:
```
TLS alert received: AlertMessagePayload {
    level: Fatal,
    description: UnknownCA,
}
```
will no longer appear unconditionally.
2023-07-17 16:49:03 -06:00
Martin Fischer 801b9ec62d
chore: fix typos (#19572) 2023-06-26 09:10:27 -04:00
David Sherret 84c793275b
fix: reload config files on watcher restarts (#19487)
Closes #19468
2023-06-14 22:29:19 +00:00
David Sherret 015ea60d25
fix(lsp): don't pre-load documents matched in the config file's "exclude" (#19431)
This prevents documents specified in a deno.json's "exclude" from being
pre-loaded by the lsp.

For example, someone may have something like:

```jsonc
// deno.json
{
  "exclude": [
    "dist" // build directory
  ]
}
```
2023-06-13 15:48:53 -04:00
David Sherret 7f15126f23
chore(tests): test_util - Add PathRef (#19450)
This adds a new `PathRef` struct to test_util for making it easier to
work with paths in test code. I'm going to expand on this more in the
future.
2023-06-10 11:09:45 -04:00
Matt Mastracci 9845361153
refactor(core): bake single-thread assumptions into spawn/spawn_blocking (#19056)
Partially supersedes #19016.

This migrates `spawn` and `spawn_blocking` to `deno_core`, and removes
the requirement for `spawn` tasks to be `Send` given our single-threaded
executor.

While we don't need to technically do anything w/`spawn_blocking`, this
allows us to have a single `JoinHandle` type that works for both cases,
and allows us to more easily experiment with alternative
`spawn_blocking` implementations that do not require tokio (ie: rayon).

Async ops (+~35%):

Before: 

```
time 1310 ms rate 763358
time 1267 ms rate 789265
time 1259 ms rate 794281
time 1266 ms rate 789889
```

After:

```
time 956 ms rate 1046025
time 954 ms rate 1048218
time 924 ms rate 1082251
time 920 ms rate 1086956
```

HTTP serve (+~4.4%):

Before:

```
Running 10s test @ http://localhost:4500
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    68.78us   19.77us   1.43ms   86.84%
    Req/Sec    68.78k     5.00k   73.84k    91.58%
  1381833 requests in 10.10s, 167.36MB read
Requests/sec: 136823.29
Transfer/sec:     16.57MB
```

After:

```
Running 10s test @ http://localhost:4500
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    63.12us   17.43us   1.11ms   85.13%
    Req/Sec    71.82k     3.71k   77.02k    79.21%
  1443195 requests in 10.10s, 174.79MB read
Requests/sec: 142921.99
Transfer/sec:     17.31MB
```

Suggested-By: alice@ryhl.io
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-14 15:40:01 -06:00
Bartek Iwańczuk 226a373c49
fix(lsp): increase default max heap size to 3Gb (#19115) 2023-05-13 19:42:34 +00:00
David Sherret 28aa489de9
feat(compile): unstable npm and node specifier support (#19005)
This is the initial support for npm and node specifiers in `deno
compile`. The npm packages are included in the binary and read from it via
a virtual file system. This also supports the `--node-modules-dir` flag,
dependencies specified in a package.json, and npm binary commands (ex.
`deno compile --unstable npm:cowsay`)

Closes #16632
2023-05-10 20:06:59 -04:00
Matt Mastracci 687a939588
fix(ext/http): Ensure Deno.serve works across --watch restarts (#18998)
Fixes #16699 and #18960 by ensuring that we release our HTTP
`spawn_local` tasks when the HTTP resource is dropped.

Because our cancel handle was being projected from the resource via
`RcMap`, the resource was never `Drop`ped. By splitting the handle out
into its own `Rc`, we can avoid keeping the resource alive and let it
drop to cancel everything.
2023-05-08 09:52:56 +02:00
Bartek Iwańczuk 2f651b2d64
fix(npm): canonicalize filename before returning (#18948)
This commit changes how paths for npm packages are handled,
by canonicalizing them when resolving. This is done so that instead
of returning
"node_modules/<package_name>@<version>/node_modules/<dep>/index.js"
(which is a symlink) we "node_modules/<dep>@<dep_version>/index.js.

Fixes https://github.com/denoland/deno/issues/18924
Fixes https://github.com/bluwy/create-vite-extra/issues/31

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2023-05-02 02:35:33 +02:00
Elijah e2853a955c
test(runtime): support Windows in resolve_from_cwd_absolute (#18379)
`current_dir().unwrap()` joined with a Path is equivalent to the
implementation in `resolve_from_cwd()`. Manually tested on Ubuntu 22.04
and Windows 11.

Signed-off-by: Elijah Conners <business@elijahpepe.com>
2023-04-13 01:45:53 +02:00
David Sherret 8820f6e922
fix(npm): do not "npm install" when npm specifier happens to match package.json entry (#18660) 2023-04-11 18:10:51 -04:00
Matt Mastracci a1764f7690
refactor(core): Improve ergonomics of managing ASCII strings (#18498)
This is a follow-on to the earlier work in reducing string copies,
mainly focused on ensuring that ASCII strings are easy to provide to the
JS runtime.

While we are replacing a 16-byte reference in a number of places with a
24-byte structure (measured via `std::mem::size_of`), the reduction in
copies wins out over the additional size of the arguments passed into
functions.

Benchmarking shows approximately the same if not slightly less wallclock
time/instructions retired, but I believe this continues to open up
further refactoring opportunities.
2023-04-04 06:46:31 -06:00