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

12769 commits

Author SHA1 Message Date
Charlie Bellini
8f7787f81b
fix(ext/websocket): don't throw exception when sending to closed socket (#26932)
[The WebSocket specification for the `send`
function](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send)
says:

> The browser will throw an exception if you call `send()` when the
connection is in the `CONNECTING` state. If you call `send()` when the
connection is in the `CLOSING` or `CLOSED` states, the browser will
silently discard the data.

and:

> ### Exceptions
> 
> `InvalidStateError`
[`DOMException`](https://developer.mozilla.org/en-US/docs/Web/API/DOMException)
> 
> Thrown if
[`WebSocket.readyState`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/readyState)
is `CONNECTING`.

This pull request fixes the current behavior to match the specification.
Also, I believe it fixes #17586.
2024-11-22 00:04:47 +01:00
Caleb Cox
a19b3f44d4
fix(cli): remove extraneous comma in task --eval help (#26985) 2024-11-21 20:24:54 +00:00
denobot
8a5609ad73
chore: forward v2.1.1 release commit to main (#26981)
Co-authored-by: dsherret <dsherret@users.noreply.github.com>
2024-11-21 14:35:32 -05:00
Bhuwan Pandit
a875a3785b
docs(cli/add): add clarification to add command (#26968)
Signed-off-by: Bhuwan Pandit <bhuwanpandit109@gmail.com>
2024-11-21 17:27:00 +00:00
David Sherret
6ee8efc5b4
fix(install/global): do not error if path is an npm pkg and relative file (#26975)
Closes https://github.com/denoland/deno/issues/26969
2024-11-21 17:00:10 +00:00
Bartek Iwańczuk
566a6c2ce7
fix(task): update --filter flag description (#26974)
`--recursive` is now implied by `--filter`.
2024-11-21 16:56:46 +00:00
David Sherret
9288081638
fix(node): regression where ts files were sometimes resolved instead of js (#26971) 2024-11-21 16:37:10 +00:00
Luca Casonato
75f8164b04
chore: update url + idna (#26963)
They were pinned to old versions. This commit removes the pin.
2024-11-21 17:30:07 +01:00
Bartek Iwańczuk
bfa9230d3b
fix(watch): don't panic if there's no path provided (#26972)
Closes https://github.com/denoland/deno/issues/26970
2024-11-21 16:29:40 +00:00
Bartek Iwańczuk
aa0ba6580e
fix: Buffer global in --unstable-node-globals (#26973) 2024-11-21 16:27:37 +00:00
Cornelius Krassow
3f3568bd95
fix(cli): Fix typo in doc subcommand help output (#26321) 2024-11-21 07:54:20 -08:00
David Sherret
e515ed23e8
fix(task): ensure root config always looks up dependencies in root (#26959)
We were accidentally looking up dependencies in the member.
2024-11-21 09:43:51 -05:00
David Sherret
0b8df9f24d
chore: fix cargo publish (#26958) 2024-11-21 00:13:47 -05:00
denobot
3da4eca7c1
2.1.0 (#26957)
Bumped versions for 2.1.0

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-11-21 03:05:02 +01:00
David Sherret
be10901dfc
docs: fix casing of Wasm (#26954) 2024-11-21 01:02:58 +00:00
Bartek Iwańczuk
d17f4590a2
feat(init): add --npm flag to initialize npm projects (#26896)
This commit adds support for `deno init --npm <package>`.

Running this will actually call to `npm:create-<package>` package that
is equivalent to running `npm create <package>`.

User will be prompted if they want to allow all permissions and
lifecycle scripts to be executed.
Closes https://github.com/denoland/deno/issues/26461

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-11-21 00:03:11 +00:00
Marvin Hagemeister
f0b245c8ee
feat(task): workspace support with --filter and --recursive (#26949)
This commit adds workspace support to "deno taks".

Two new flags were added:
- "--recursive" - allows to run a specified task in workspace members,
eg. "deno task --recursive dev"
- "--filter" - allows to run a specified task only in specific workspace members,
eg. "deno task --recursive --filter 'client/*' dev"

"--filter" flag implies "--recursive" flag.

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

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Signed-off-by: David Sherret <dsherret@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-11-21 00:35:12 +01:00
Yazan AbdAl-Rahman
b729bf0ad9
feat(permission): support suffix wildcards in --allow-env flag (#25255)
This commit adds support for suffix wildcard for `--allow-env` flag.

Specifying flag like `--allow-env=DENO_*` will enable access to all
environmental variables starting with `DENO_*`.

Closes #24847

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-11-20 23:30:43 +00:00
Nathan Whitaker
56f31628f7
feat: subcommand to view and update outdated dependencies (#26942)
Closes #20487

Currently spelled

```
deno outdated
```
and
```
deno outdated --update
```

Works across package.json and deno.json, and in workspaces.

There's a bit of duplicated code, I'll refactor to reduce this in follow
ups

## Currently supported:
### Printing outdated deps (current output below which basically mimics
pnpm, but requesting feedback / suggestions)

```
deno outdated
```
![Screenshot 2024-11-19 at 2 01
56 PM](https://github.com/user-attachments/assets/51fea83a-181a-4082-b388-163313ce15e7)

### Updating deps

semver compatible:
```
deno outdated --update
```
latest:
```
deno outdated --latest
```
current output is basic, again would love suggestions
![Screenshot 2024-11-19 at 2 13
46 PM](https://github.com/user-attachments/assets/e4c4db87-cd67-4b74-9ea7-4bd80106d5e9)

#### Filters
```
deno outdated --update "@std/*"
deno outdated --update --latest "@std/* "!@std/fmt"
```
#### Update to specific versions
```
deno outdated --update @std/fmt@1.0.2 @std/cli@^1.0.3
```

### Include all workspace members
```
deno outdated --recursive
deno outdated --update --recursive
```

## Future work
- interactive update
- update deps in js/ts files
- better support for transitive deps

Known issues (to be fixed in follow ups):
- If no top level dependencies have changed, we won't update transitive
deps (even if they could be updated)
- Can't filter transitive deps, or update them to specific versions

## TODO (in this PR):
- ~~spec tests for filters~~
- ~~spec test for mixed workspace (have tested manually)~~
- tweak output
- suggestion when you try `deno update`

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-20 15:22:15 -08:00
Bartek Iwańczuk
0670206a2c
chore: use forked sqlformat-rs (#26952)
Some crucial fixes have not yet been released, so I forked it for the
time being.
2024-11-20 23:21:41 +00:00
Leo Kettmeir
cf49599359
feat: permission stack traces in ops (#26938)
This commit improves permission prompts by adding an option
to print a full trace of where the permissions is being requested.

Due to big performance hint of stack trace collection, this is only
enabled when `DENO_TRACE_PERMISSIONS` env var is present.

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

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-20 21:24:04 +00:00
Keith Tan
8f72798622
feat(lint): Add checked files list to the JSON output(#26936)
Fixes #26930
2024-11-20 20:59:43 +01:00
Bartek Iwańczuk
03f47e6cf0
fix(fmt): formatting of .svelte files (#26948)
Closes https://github.com/denoland/deno/issues/26690
Closes https://github.com/denoland/deno/issues/26324
2024-11-20 10:01:56 -08:00
Bartek Iwańczuk
318dd3cbc3
feat(task): add --eval flag (#26943)
This commit adds `--eval` flag to `deno task` subcommand.

This flag allows to evaluate provided "task name" as a task itself,
effectively allowing to use `deno_task_shell` from the command line.

Also fixes shebang parsing for `node_modules/.bin/` entries to handle
`#!/usr/bin/node -S node` in addition to `#!/usr/bin/node node`.

Closes https://github.com/denoland/deno/issues/26918
2024-11-20 02:23:20 +01:00
David Sherret
dabb6775f3
fix(publish): improve error message when missing exports (#26945) 2024-11-20 01:14:49 +00:00
haturau
429f3929fa
feat(info): show location for Web Cache (#26205)
Closes #26181 

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-20 01:04:48 +00:00
David Sherret
fadda6a8fb
fix(lockfile): track dependencies specified in TypeScript compiler options (#26551)
We should track dependencies in `jsxImportSource`,
`jsxImportSourceTypes`, and `types`.

That way, for example, if someone removes or changes the
`jsxImportSource` then we can remove those items from the lockfile.
2024-11-20 00:49:19 +00:00
Cornelius Krassow
9956731ddb
feat(publish): add --set-version <version> flag (#26141) 2024-11-20 00:00:47 +00:00
David Sherret
8be2bbf074
feat: Wasm module support (#26668)
Support for Wasm modules.

Note this implements the standard where the default export is the
instance (not the module). The module will come later with source phase
imports.

```ts
import { add } from "./math.wasm";

console.log(add(1, 2));
```
2024-11-19 18:59:23 -05:00
David Sherret
6b478cd0a3
feat(compile): ability to embed directory in executable (#26939) 2024-11-19 23:20:14 +00:00
David Sherret
46b6037644
feat(compile): ability to embed local data files (#26934)
```
> deno compile --allow-read=. --include data-file.txt main.js
```

This only applies to files on the filesystem. For remote modules, that's
going to have to wait for `import ... from "./data.txt" with { "type":
"bytes" }` or whatever it will be.
2024-11-19 16:19:35 -05:00
João Baptista
c55e936be0
feat(fmt): support SQL (#26750)
This commit adds support for .sql files in "deno fmt" subcommand.

Closes: https://github.com/denoland/deno/issues/25024
---------

Signed-off-by: m4rc3l05 <15786310+M4RC3L05@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-19 21:01:16 +00:00
Leo Kettmeir
628816448e
refactor: update deno_doc, use prismjs, remove internal reference html generation logic (#26885) 2024-11-19 08:56:04 -08:00
David Sherret
186b52731c
fix(node): handle resolving ".//<something>" in npm packages (#26920)
The issue was this package had an import like: `".//index.js"` and we
resolved that as specified, but node normalizes it to `"./index.js"` so
we have to copy node.
2024-11-19 09:57:12 -05:00
David Sherret
661aa22c03
feat(task): dependencies (#26467)
This commit adds support for "dependencies" in `deno task` subcommand:
```jsonc
{
    "tasks": {
        "build": "deno run -RW build.ts",
        "generate": "deno run -RW generate.ts",
        "serve": {
            "command": "deno run -RN server.ts",
            "dependencies": ["build", "generate"]
        }
    }
}
```
Executing `deno task serve` will first execute `build` and `generate`
tasks (in parallel) and once both complete the `serve` task will be executed.

Number of tasks run in parallel is equal to the no of cores on the
machine, and respects `DENO_JOBS` env var if one is specified.

Part of https://github.com/denoland/deno/issues/26462

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2024-11-19 12:45:09 +00:00
Divy Srivastava
069bc15030
feat(ext/node): perf_hooks.monitorEventLoopDelay() (#26905)
Fixes https://github.com/denoland/deno/issues/20961

Depends on https://github.com/denoland/deno_core/pull/965 and
https://github.com/denoland/deno_core/pull/966
2024-11-19 16:49:25 +05:30
Yusuke Tanaka
0e2f6e38e7
feat(ext/fetch): Make fetch client parameters configurable (#26909)
This commit makes HTTP client parameters used in `fetch` API
configurable on the extension initialization via a callback
`client_builder_hook` that users can provide.

The main motivation behind this change is to allow `deno_fetch` users to
tune the HTTP/2 client to suit their needs, although Deno CLI users will
not benefit from it as no JavaScript interface is exposed to set these
parameters currently.

It is up to users whether to provide a hook function. If not provided,
the default configuration from hyper crate will be used.

Ref #26785
2024-11-18 17:48:57 -08:00
Yusuke Tanaka
9f26ca4509
feat(ext/http): Make http server parameters configurable (#26785)
This commit makes http server parameters configurable on the extension
initialization via two callbacks users can provide.

The main motivation behind this change is to allow `deno_http` users to
tune the HTTP/2 server to suit their needs, although Deno CLI users will
not benefit from it as no JavaScript interface is exposed to set these
parameters currently.

It is up to users whether to provide hook functions. If not provided,
the default configuration from hyper crate will be used.
2024-11-18 17:46:24 -08:00
Marvin Hagemeister
df1d36324f
fix(node/crypto): support promisify on generateKeyPair (#26913)
Calling `promisify(generateKeyPair)` didn't work as expected. It
requires a custom promisify implementation.

This was easy to fix thanks to the excellent debugging investigation in
https://github.com/denoland/deno/issues/26910

Fixes https://github.com/denoland/deno/issues/26910

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-19 01:39:40 +01:00
Luca Casonato
594a99817c
feat(runtime): remove public OTEL trace API (#26854)
This PR removes the public Deno.tracing.Span API.
We are not confident we can ship an API that is
better than the `@opentelemetry/api` API, because
V8 CPED does not support us using `using` to
manage span context. If this changes, we can
revisit this decision. For now, users wanting
custom spans can instrument their code using
the `@opentelemetry/api` API and `@deno/otel`.

This PR also speeds up the OTEL trace generation
by a 30% by using Uint8Array instead of
strings for the trace ID and span ID.
2024-11-18 23:55:22 +00:00
Bartek Iwańczuk
106d47a013
feat: fmt and lint respect .gitignore file (#26897)
Closes https://github.com/denoland/deno/issues/26573
2024-11-18 23:54:28 +01:00
Nayeem Rahman
c36f877f8d
fix(lsp): ignore editor indent settings if deno.json is present (#26912) 2024-11-18 21:45:34 +00:00
David Sherret
19bbf83e47
perf(windows): delay load webgpu and some other dlls (#26917)
Before: ~100ms, After: ~40ms for a hello world

Closes https://github.com/denoland/deno/issues/26914
2024-11-18 20:44:17 +00:00
David Sherret
dd4570ed85
perf(compile): code cache (#26528)
Adds a lazily created code cache to `deno compile` by default.

The code cache is created on first run to a single file in the temp
directory and is only written once. After it's been written, the code
cache becomes read only on subsequent runs. Only the modules loaded
during startup are cached (dynamic imports are not code cached).

The code cache can be disabled by compiling with `--no-code-cache`.
2024-11-18 20:09:28 +00:00
Bartek Iwańczuk
3ba464dbc4
chore: temporarily disable dns tests for Node compat (#26915)
These tests are hitting a remote server which sometimes starts failing
randomly on CI.

They need to be rewritten to use a local server and have `/etc/hosts`
setup that remaps relevants URLs.
2024-11-18 19:27:44 +00:00
Bhuwan Pandit
cff6e280c7
feat(cli): support multiple env file argument (#26527)
Closes #26425 

## Overview

This PR adds support for specifying multiple environment files as
arguments when using the Deno CLI. Subsequent files override
pre-existing variables defined in previous files.

If the same variable is defined in the environment and in the file, the
value from the environment takes precedence.

## Example Usage
```bash
deno run --allow-env --env-file --env-file=".env.one" --env-file=".env.two" script.ts
```

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-17 22:49:35 +00:00
Benjamin Swerdlow
73411bb98a
chore: Make ext/net/tcp.rs public (#26891) 2024-11-17 13:36:55 +01:00
reczkok
80098bfeab
fix(ext/webgpu): Create GPUQuerySet converter before usage (#26883)
Converter for `GPUComputePassTimestampWrites` uses converter for
`GPUQuerySet` before it is defined making it impossible to use. This PR
simply reorders converter creation to resolve this issue. Logging the
`GPUQuerySet` still fails (as mentioned in #26769) but it is now usable
inside pass descriptors and works when used.
2024-11-17 08:44:36 +05:30
Bartek Iwańczuk
56df61677e
chore: reenable some tests disabled during Deno 1->2 migration (#26898) 2024-11-16 18:15:42 +00:00
Bartek Iwańczuk
f2cd5655c6
fix(ext/node): increase tolerance for interval test (#26899)
Fixes tests added in https://github.com/denoland/deno/pull/26703 by
increasing tolerance due to noisy CI machines.
2024-11-16 16:31:55 +00:00