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

1279 commits

Author SHA1 Message Date
Asher Gomez
3285801429
test: remove DENO_FUTURE (#25587) 2024-09-12 11:30:12 +10:00
Asher Gomez
8476bbff9a
feat: stabilize Deno.createHttpClient() (#25569)
Closes #25518
2024-09-12 10:46:48 +10:00
HasanAlrimawi
1463a4ad58
chore: deprecate task itests (#25558)
This PR is part of #22907
2024-09-11 17:39:47 +02:00
Bartek Iwańczuk
c64aa50c0e
feat(upgrade): better error message on failure (#25503)
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2024-09-11 17:19:45 +02:00
Yoshiya Hinosawa
aae3a6bcb4
fix(ext/node): fix Cipheriv#update(string, undefined) (#25571) 2024-09-11 19:24:17 +09:00
Yoshiya Hinosawa
200145a09a
fix(ext/node): avoid showing UNKNOWN error from TCP handle (#25550) 2024-09-11 19:19:02 +09:00
Nayeem Rahman
ad30703e8e
fix(lsp): encode url parts before parsing as uri (#25509) 2024-09-11 11:11:39 +01:00
Yoshiya Hinosawa
8bdd364dd5
fix(ext/node): add FileHandle#writeFile (#25555)
This PR adds `writeFile` methods of `FileHandle` class
https://nodejs.org/api/fs.html#filehandlewritefiledata-options
2024-09-11 11:08:40 +02:00
Yoshiya Hinosawa
ef2d98fe11
fix(ext/node): validate input lengths in Cipheriv and Decipheriv (#25570)
addresses the first part of #25279
2024-09-11 13:27:07 +09:00
Nayeem Rahman
f959297dcd
feat(lsp): unstable setting as list (#25552) 2024-09-11 00:20:03 +01:00
Asher Gomez
4865ae13e1
BREAKING(net): remove Deno.[Tls]Listener.prototype.rid (#25556)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-11 01:14:50 +02:00
Asher Gomez
ace1202227
BREAKING(net): remove Deno.ConnectTlsOptions.{certChain,certFile,privateKey} and Deno.ListenTlsOptions.certChain,certFile,keyFile} (#25525)
Towards #22079
2024-09-10 21:55:42 +00:00
Nathan Whitaker
be0ba6d84f
fix(ext/node): Rewrite node:v8 serialize/deserialize (#25439)
Closes #20613.

Reimplements the serialization on top of the v8 APIs instead of
deno_core. Implements `v8.Serializer`, `v8.DefaultSerializer`,
`v8.Deserializer`, and `v8.DefaultSerializer`.
2024-09-10 21:50:21 +00:00
Kenta Moriuchi
e522f4b65a
BREAKING(temporal/unstable): Remove obsoleted Temporal APIs part 2 (#25505)
Mainly I removed `Temporal.Calendar` and `Temporal.TimeZone` and
replaced them to APIs that handle calendar and timezone as strings.
https://github.com/tc39/proposal-temporal/pull/2925

Related #24836
2024-09-10 21:36:43 +00:00
Asher Gomez
a69b1e699e
BREAKING(fs): remove Deno.FsFile.prototype.rid (#25499)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-11 07:19:34 +10:00
snek
f9007d3386
feat: require(esm) (#25501)
implement require(esm) using `op_import_sync` from deno_core.

possible future changes:
- cts and mts
- replace Deno.core.evalContext to optimize esm syntax detection

Fixes: https://github.com/denoland/deno/issues/25487
2024-09-10 20:12:36 +00:00
Luca Casonato
7bfcb4dd10
feat(cli): use NotCapable error for permission errors (#25431)
Closes #7394

---------

Co-authored-by: snek <snek@deno.com>
2024-09-10 11:12:24 -07:00
Leo Kettmeir
c2f97494f7
refactor: move WebGPU, FFI and FS typings from unstable to stable (#25488)
Closes #25377
2024-09-10 05:04:59 -07:00
Bartek Iwańczuk
9a169e3cf1
test: remove usage of --unstable flag (#25549)
This commit removes all occurrences of `--unstable` flag
from all the tests that are run in CI.

Turns out none of the tests actually required that flag
anymore.
2024-09-10 11:28:59 +00:00
HasanAlrimawi
3f6afd1947
fix: update malva in deno to support astro css comments (#25553)
This PR addresses issue #25534 

**Code Changes**
- Updated malva version to the latest in cli/Cargo.toml.
- Updated LanguageOptions to match new Malva config.
- Added test case same as the issue to assure changes success.
2024-09-10 12:54:43 +02:00
Asher Gomez
a445ebd74f
BREAKING(fs): remove Deno.fsync[Sync]() (#25448)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-09 22:39:56 +00:00
Bartek Iwańczuk
064a73f7a0
BREAKING: Remove --unstable flag (#25522)
This commit effectively removes the --unstable flag.

It's still being parsed, but it only prints a warning that a granular
flag should be used instead and doesn't actually enable any
unstable feature.

Closes https://github.com/denoland/deno/issues/25485
Closes https://github.com/denoland/deno/issues/23237
2024-09-09 23:44:29 +02:00
David Sherret
560ad0331b
fix(node/byonm): do not accidentally resolve bare node built-ins (#25543)
This was accidentally enabled in byonm, but it requires the
`--unstable-bare-node-builtins` flag.

Closes #25358
2024-09-09 21:35:41 +00:00
Asher Gomez
aadcf3346c
BREAKING(io): remove Deno.{Reader,Writer}[Sync] and Deno.Closer (#25524) 2024-09-10 07:07:12 +10:00
Bartek Iwańczuk
04a9cc95ac
feat: Add better error messages for unstable APIs (#25519)
This commit improves error messages for unstable APIs:
- `--unstable-broadcast-channel`
- `--unstable-cron`
- `--unstable-http`
- `--unstable-kv`
- `--unstable-temporal`

By providing information and hints what went wrong and how the
error can be fixed. It reuses the same infra that was added in 
https://github.com/denoland/deno/pull/21764.
2024-09-09 22:51:55 +02:00
David Sherret
72f025c743
fix: remove recently added deno.json node_modules aliasing (#25542)
This was initially added in #25399 in order to make transitioning over
from package.json to deno.json more easy, but it causes some problems
that are shown in the issue and it also means that the output of `deno
install` would have different resolution than `npm install`. Overall, I
think it's too much complexity to be smarter about this and it's
probably best to not do it. If someone needs an aliased folder then they
should keep using a package.json

Closes #25538
2024-09-09 20:19:29 +00:00
David Sherret
1e0ac609b5
BREAKING: remove deprecated files config (#25535)
The long form "files" config has been flattened into the parent.

Old:

```json
{
  "test": {
    "files": {
      "include": ["**/*.ts"],
      "exclude": ["ignore.ts"]
    }
  }
}
```

New:

```json
{
  "test": {
    "include": ["**/*.ts"],
    "exclude": ["ignore.ts"]
  }
}
```

This was deprecated some time ago, but we're removing it now in Deno
2.0.

Closes #25415
2024-09-09 16:33:09 +00:00
Mohammad Sulaiman
582be0adc2
chore: Deprecate worker itests (#25514) 2024-09-09 11:07:41 -04:00
Satya Rohith
5126ccb842
fix(ext/node): Stream should be instance of EventEmitter (#25527)
Closes https://github.com/denoland/deno/issues/25526
2024-09-09 15:06:56 +02:00
Asher Gomez
39f2704bd7
BREAKING(fs): remove Deno.fdatasync[Sync]() (#25520) 2024-09-09 21:09:57 +10:00
Yoshiya Hinosawa
ce1d668929
fix(ext/node): delay accept() call 2 ticks in net.Server#listen (#25481)
A workaround for the issue #25480

`Deno.Listener` can't be closed synchronously after `accept()` is
called. This PR delays the `accept` call 2 ticks (The listener callback
is called 1 tick later. So the 1 tick delay is not enough), and makes
`net.Server` capable of being closed synchronously.

This unblocks `npm:detect-port` and `npm:portfinder`

closes #18301 
closes #25175
2024-09-08 12:22:18 +09:00
Nathan Whitaker
98e8e2f8bc
feat(add/install): Flag to add dev dependency to package.json (#25495)
```
deno install --dev npm:chalk
```
Adds to `devDependencies` if a `package.json` is present, otherwise it
just adds to `imports` in `deno.json`
2024-09-07 02:22:27 -07:00
Asher Gomez
a9ed06b832
BREAKING(net): remove Deno.{Conn,TlsConn,TcpConn,UnixConn}.prototype.rid (#25446)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-06 23:01:36 +00:00
Asher Gomez
5bac4075c3
chore: soft-remove Deno.{stdin,stderr,stdout}.rid (#25479)
Towards #22079
2024-09-07 08:37:35 +10:00
Nathan Whitaker
292344af42
fix(install): Make sure target node_modules exists when symlinking (#25494)
Fixes https://github.com/denoland/deno/issues/25493
2024-09-06 19:08:56 +00:00
Nathan Whitaker
51f5f5789b
feat(add): Add npm packages to package.json if present (#25477)
Closes https://github.com/denoland/deno/issues/25321

Ended up being a larger refactoring, since we're now juggling
(potentially) two config files in the same `add`, instead of choosing
one. I don't love the shape of the code, but I think it's good enough

Some smaller side improvements:
- `deno remove` supports `jsonc`
- `deno install --dev` will be a really simple change
- if `deno remove` removes the last import/dependency in the
`imports`/`dependencies`/`devDependencies` field, it removes the field
instead of leaving an empty object
2024-09-06 17:18:13 +00:00
Kenta Moriuchi
8ef08f1d29
feat(lsp): turn on useUnknownInCatchVariables (#25474) 2024-09-06 12:23:59 +02:00
Marvin Hagemeister
73ab32c551
fix: invalid ipv6 hostname on deno serve (#25482)
This PR fixes an invalid URL being printed when running `deno serve`

Before: invalid URL

```sh
$ deno serve --host localhost
deno serve: Listening on http://::1:8000/
```

After: valid URL

```sh
$ deno serve --host localhost
deno serve: Listening on http://[::1]:8000/
```
2024-09-06 09:22:52 +00:00
Asher Gomez
d8f3123c36
BREAKING(buffer): remove Deno.Buffer (#25441)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-06 18:28:05 +10:00
Asher Gomez
7937ae3f2f
chore(net): soft-remove Deno.serveHttp() (#25451)
Towards #22079

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-06 08:15:00 +10:00
David Sherret
c678550a17
BREAKING: remove "emit" and "map" from deno info output (#25468)
The map field has been empty for years now and we don't want the emit
file to be exposed so it allows us to iterate on making the cache
faster. Additionally, it's racy/unreliable to rely on this information.
Instead, people should emit the TS files themselves using tools like
deno_emit, typescript, esbuild, etc.

Closes https://github.com/denoland/deno/issues/17703
2024-09-05 14:22:13 +00:00
David Sherret
15fce5b290
feat(check): turn on useUnknownInCatchVariables (#25465)
Part of #25162

Closes #11826
2024-09-05 15:22:31 +02:00
Bartek Iwańczuk
794d347ec6
fix: add suggestion how to fix importing CJS module (#21764)
```
$ cat exports_error.js
Object.defineProperty(exports, "__esModule", { value: true });

$ deno exports_error.js
error: Uncaught (in promise) ReferenceError: exports is not defined
Object.defineProperty(exports, "__esModule", { value: true });
                      ^
    at file:///exports_error.js:1:23

    info: Deno doesn't support CommonJS modules without `.cjs` extension.
    hint: Rewrite this module to ESM or change the file extension to `.cjs`.
```
2024-09-05 12:49:07 +00:00
Yoshiya Hinosawa
dda6328745
fix(ext/node): stub process.cpuUsage() (#25462)
closes #23401
2024-09-05 21:21:29 +09:00
Bartek Iwańczuk
5319b85f14
feat(uninstall): alias to 'deno remove' if -g flag missing (#25461)
Close https://github.com/denoland/deno/issues/25457
2024-09-05 13:51:37 +02:00
Asher Gomez
7d95c5c062
BREAKING(fs): remove Deno.funlock[Sync]() (#25442)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-05 11:23:37 +00:00
Asher Gomez
c73b4a0877
BREAKING(fs): remove Deno.seek[Sync]() (#25449)
Towards #22079
2024-09-05 20:37:28 +10:00
Yoshiya Hinosawa
b01578ae1f
chore(tests): reduce the use of --unstable flag in test util (#25443) 2024-09-05 18:34:12 +09:00
Bartek Iwańczuk
5dc907df87
fix: update hint for deno add <package> (#25455)
Follow up to https://github.com/denoland/deno/pull/25430
2024-09-05 11:08:22 +02:00
Kamil Ogórek
2c4d99a458
feat: include version number in all --json based outputs (#25335)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-05 08:51:40 +00:00
Mohammad Sulaiman
49340b96f6
chore: deprecate doc itests (#25452) 2024-09-05 08:09:09 +00:00
Bartek Iwańczuk
dfc5eec43c
feat: Allow importing .cjs files (#25426)
This commit adds support for executing top-level `.cjs` files, 
as well as import `.cjs` files from within npm packages.

This works only for `.cjs` files, the contents of sibling `package.json`
are not consulted for the `"type"` field.

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

---------

Signed-off-by: David Sherret <dsherret@users.noreply.github.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-09-05 07:59:12 +00:00
Luca Casonato
49e3ee010c
feat(ext/node): add abort helpers, process & streams fix (#25262)
This commit adds:

- `addAbortListener` in `node:events`
- `aborted` in `node:util`
- `execPath` and `execvArgs` named export from `node:process`
- `getDefaultHighWaterMark` from `node:stream`

The `execPath` is very hacky - because module namespaces can not have
real getters, `execPath` is an object with a `toString()` method that on
call returns the actual `execPath`, and replaces the `execPath` binding
with the string. This is done so that we don't require the `execPath`
permission on startup.
2024-09-05 09:22:52 +02:00
Ian Bull
17b5e98b82
refactor(ext/cron): align error messages (#25300)
Aligns the error messages in the cron extension to be in-line with the
Deno style guide.

https://github.com/denoland/deno/issues/25269
2024-09-05 08:27:58 +02:00
Bartek Iwańczuk
acd01eb2b4
feat: Add a hint on error about 'Relative import path ... not prefixed with ...' (#25430)
Running a file like:
```
import "@std/dotenv/load";
```
Without a mapping in `imports` field of `deno.json` or `dependencies` of
`package.json`
will now error out with a hint:
```
error: Relative import path "@std/dotenv/load" not prefixed with / or ./ or ../
  hint: Try running `deno add @std/dotenv/load`
    at [WILDCARD]bare_specifier_without_import/main.ts:1:8

```

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

---------

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-09-05 08:25:56 +02:00
Asher Gomez
105c2e336a
BREAKING(fs): remove Deno.FsWatcher.prototype.rid (#25444)
Towards #22079
2024-09-05 16:23:28 +10:00
Asher Gomez
713ed065e7
BREAKING(fs): remove Deno.File (#25447)
Towards #22079
2024-09-05 16:22:47 +10:00
Yoshiya Hinosawa
e799c2857c
fix(ext/http): do not set localhost to hostname unnecessarily (#24777)
This commit changes when to cause the hostname substition of `0.0.0.0` ->
`localhost`.

Currently we substitute `localhost` to the hostname on windows before
calling `options.onListen`, which prevents the users to do more advanced
thing using hostname string like
https://github.com/denoland/std/issues/5558. This PR changes it not to
substitute it when the user provide `onListen` callback.

closes #24776
unblocks https://github.com/denoland/std/issues/5558
2024-09-05 14:13:06 +09:00
Yoshiya Hinosawa
186f7484da
fix(ext/node): close upgraded socket when the underlying http connection is closed (#25387)
This change fixes the handling of upgraded socket from `node:http` module.

In `op_node_http_fetch_response_upgrade`, we create DuplexStream paired
with `hyper::upgrade::Upgraded`. When the connection is closed from the
server, the read result from `Upgraded` becomes 0. However because we
don't close the paired DuplexStream at that point, the Socket object in
JS side keeps alive even after the server closed. That caused the issue
#20179

This change fixes it by closing the paired DuplexStream when the
`Upgraded` stream returns 0 read result.

closes #20179
2024-09-05 13:30:18 +09:00
David Sherret
dd208a6df0
fix(regression): do not expose resolved path in Deno.Command permission denied error (#25434)
Regression from https://github.com/denoland/deno/pull/25370
2024-09-04 22:57:49 +00:00
Asher Gomez
195b17ae12
BREAKING(types): soft-remove Deno.run() (#25403)
Towards #22079
2024-09-05 08:45:55 +10:00
Nathan Whitaker
c32d692a8f
feat(install): deno install with entrypoint (#25411)
```
deno install --entrypoint one.ts two.ts
```

effectively equivalent to `deno cache`
2024-09-04 13:06:16 -07:00
David Sherret
07ad47da53
BREAKING(config): make supported compilerOptions an allow list (#25432)
Deno has been using a deny list, which doesn't make sense because a lot
of these options don't even work.

Closes #25363
2024-09-04 17:39:30 +02:00
David Sherret
5400f1af6c
fix(windows): Deno.Command - align binary resolution with linux and mac (#25429) 2024-09-04 16:03:09 +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
Bartek Iwańczuk
c58a628e2f
feat(add): strip package subpath when adding a package (#25419)
These now works:
```
$ deno add @std/dotenv/load
$ deno add npm:preact/hooks
```
Previously we were erroring out, because this is a "package reference"
including
a subpath.

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

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-09-04 12:55:30 +00:00
David Sherret
74fc66da11
fix: lock down allow-run permissions more (#25370)
`--allow-run` even with an allow list has essentially been
`--allow-all`... this locks it down more.

1. Resolves allow list for `--allow-run=` on startup to an absolute
path, then uses these paths when evaluating if a command can execute.
Also, adds these paths to `--deny-write`
1. Resolves the environment (cwd and env vars) before evaluating
permissions and before executing a command. Then uses this environment
to evaluate the permissions and then evaluate the command.
2024-09-04 14:51:24 +02:00
Nayeem Rahman
84dc375b2d
fix(lsp): update diagnostics on npm install (#25352) 2024-09-04 13:22:30 +01:00
Bartek Iwańczuk
0e0a5c24ea
test: run js_unit_tests with --unstable-* flags (#25394) 2024-09-04 14:21:02 +02:00
Asher Gomez
31ecc09b5a
BREAKING(io): remove Deno.read[Sync]() (#25409)
Towards #22079

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-04 09:34:40 +00:00
Luca Casonato
b333dccee8
feat(cli): give access to process global everywhere (#25291) 2024-09-04 11:04:06 +02:00
Asher Gomez
4c3b17b547
BREAKING(io): remove Deno.write[Sync]() (#25408)
Towards #22079

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-04 08:57:34 +00:00
Asher Gomez
7e11dbb3ac
BEAKING(buffer): remove Deno.readAll[Sync]() (#25386)
Towards #22079

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-04 08:54:50 +00:00
Asher Gomez
3d36cbd056
BREAKING(fs): remove Deno.ftruncate[Sync]() (#25412)
Towards #22079

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-04 08:53:43 +00:00
Asher Gomez
ac33fc2892
chore(tty): soft-remove Deno.isatty() (#25410)
Towards #22079
2024-09-04 18:12:11 +10:00
Ian Bull
cb454351d4
refactor(ext): align error messages (#25310) 2024-09-04 09:23:19 +02:00
Ian Bull
939c23f9fe
refactor(cli/js): align error messages (#25406)
Aligns the error messages in the cli/js folder to be in-line with the
Deno style guide.
2024-09-04 09:19:55 +02:00
Asher Gomez
072bf5d379
BREAKING(buffer): remove Deno.writeAll[Sync]() (#25407) 2024-09-04 17:16:48 +10:00
Ian Bull
ce6b675102
refactor(ext/fetch): align error messages (#25374)
Aligns the error messages in the ext/fetch folder to be in-line with the
Deno style guide.

https://github.com/denoland/deno/issues/25269
2024-09-04 09:05:29 +02:00
Asher Gomez
7079acd74d
chore: update WPT (#25250)
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2024-09-03 23:15:34 -07:00
Asher Gomez
b72d1a7256
BREAKING(fs): remove Deno.fstat[Sync]() (#25351)
Towards #22079

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-04 01:28:15 +00:00
Leo Kettmeir
9a36b6fb04
fix(flags): require global flag for permission flags in install subcommand (#25391)
Also rewrites some of the subcommands help text

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

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-03 12:40:50 -07:00
Bartek Iwańczuk
81e941bc92
fix(install): recommend using deno install -g when using a single http url (#25388)
Closes https://github.com/denoland/deno/issues/25361
2024-09-03 17:55:29 +02:00
HasanAlrimawi
1d04c84c8f
chore: deprecate eval itests (#25382)
This PR serves as a part of #22907 .

---------

Signed-off-by: David Sherret <dsherret@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-09-03 15:14:19 +00:00
David Sherret
b8ed6f8221
fix(task): correct name for scoped npm package binaries (#25390)
This is for when not using a node_modules directory or when using auto
install for a node_modules dir.
2024-09-03 13:56:39 +00:00
Bartek Iwańczuk
7c59402325
test: fix info::info_import_map test (#25389)
esm.sh provided a fix for `window` not existing in Deno anymore.
2024-09-03 13:18:51 +00:00
Asher Gomez
03d8e474d7
BREAKING(io): remove Deno.copy() (#25345)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-03 10:46:13 +00:00
Bartek Iwańczuk
241fa7bc97
test: reenable frozen_lockfile tests (#25381)
Ref https://github.com/denoland/deno/issues/25241
2024-09-03 06:43:10 -04:00
Luca Casonato
5cf97f539b
BREAKING(permissions): remove --allow-hrtime (#25367)
Remove `--allow-hrtime` and `--deny-hrtime`. We are doing this because
it is already possible to get access to high resolution timers through
workers and SharedArrayBuffer.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-03 11:24:25 +02:00
David Sherret
b5695d02df
fix: only enable byonm if workspace root has pkg json (#25379)
Closes #25355
2024-09-03 09:18:37 +00:00
Asher Gomez
1a82b0f808
BREAKING(console): remove Deno.customInspect (#25348)
Note: this is implemented on Deploy. However, according to @magurotuna,
a thin compatibility layer might be in the works that'd prevent
breakages for PRs such as this one.

Towards #22079
2024-09-03 09:07:19 +00:00
Bartek Iwańczuk
71e4ac774b
BREAKING(unstable): drop support for Deno.run.{clearEnv,gid,uid} (#25371)
These are unstable options and the APIs is now deprecated. To limit
amount of unstable flags we elected to have these APIs removed.
2024-09-03 11:07:02 +02:00
David Sherret
bf7571a6f9
fix: make some warnings more standard (#25324) 2024-09-03 10:45:01 +02:00
Asher Gomez
9bf10aa1e0
chore(fs): remove Deno.flock[Sync]() (#25350)
Towards #22079
2024-09-03 18:39:37 +10:00
Bartek Iwańczuk
1f51b5310f
feat: support DENO_LOG env var instead of RUST_LOG (#25356)
Instead of `RUST_LOG` env var, we now support `DENO_LOG` env var.
This is done to be able to set a setting specific to `deno` that
wouldn't impact
other binaries written in Rust.

Ref
https://github.com/denoland/deno/issues/10558#issuecomment-2324300211
2024-09-03 10:36:28 +02:00
Asher Gomez
45c1737531
BREAKING(io): remove Deno.iter[Sync]() (#25346)
Towards #22079
2024-09-03 18:35:54 +10:00
Asher Gomez
259752537f
BREAKING: remove Deno.close() (#25347)
Towards #22079
2024-09-03 18:33:26 +10:00
Asher Gomez
5f08d634f7
BREAKING: remove deno vendor (#25343) 2024-09-03 17:00:57 +10:00
Coty
2533d68cab
fix(cli/tools): correct deno init --serve template behavior (#25318) 2024-09-02 23:01:36 +00:00
Asher Gomez
f6eab6c4bd
BREAKING: remove --allow-none flag (#25337)
Towards #22079

Signed-off-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-09-02 22:06:27 +00:00
Nayeem Rahman
e804175a0a
feat(lsp): html/css/yaml file formatting (#25353) 2024-09-02 18:27:25 +01:00
Asher Gomez
c62829fc03
BREAKING: remove --trace-ops (#25344)
Towards #22079
2024-09-02 18:26:05 +02:00
David Sherret
3015f16fbf
fix: remove entrypoint hack for Deno 2.0 (#25332) 2024-09-02 15:33:07 +00:00
Asher Gomez
bc51eca700
BREAKING: remove deno bundle (#25339)
`deno bundle` now produces:
```
error: ⚠️ `deno bundle` was removed in Deno 2.

See the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations
```

`deno bundle --help` now produces:
```
⚠️ `deno bundle` was removed in Deno 2.

See the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations

Usage: deno bundle [OPTIONS]

Options:
  -q, --quiet     Suppress diagnostic output
      --unstable  Enable all unstable features and APIs. Instead of using this flag, consider enabling individual unstable features
                    To view the list of individual unstable feature flags, run this command again with --help=unstable
```
2024-09-02 17:27:37 +02:00
Asher Gomez
4c35668d90
BREAKING: remove --jobs flag (#25336) 2024-09-02 17:26:42 +02:00
Bartek Iwańczuk
42cf762cf4
chore: cleanup code for unstable tests (#25330)
Towards https://github.com/denoland/deno/issues/25241

Removes code for tests of unstable APIs that were stabilized with Deno
2.0.0-rc.0.
2024-08-31 23:38:21 +02:00
Bartek Iwańczuk
4e19474129
chore: remove DENO_FUTURE=1 from spec tests (#25329)
Towards https://github.com/denoland/deno/issues/25241
2024-08-31 21:25:32 +00:00
Asher Gomez
b536ed1a74
chore(fs): remove Deno.futime[Sync]() (#25252) 2024-08-31 13:13:23 +10:00
Bartek Iwańczuk
c29e5b9d1e
fix(upgrade): more informative information on invalid version (#25319)
Before:
```
$ deno upgrade v1.xx
error: Invalid version passed
```

After:
```
$ deno upgrade v1.xx
error: Invalid version passed (v1.xx)

Example usage:
  deno upgrade | deno upgrade 1.46 | deno upgrade canary
```

Also updates help text to use "shorthand version" without flags, but a
positional arg.
2024-08-31 00:22:20 +00:00
Asher Gomez
a527b3a5de
chore(net): remove Deno.shutdown() (#25253) 2024-08-31 09:46:02 +10:00
Asher Gomez
8e478a1a7d
chore: remove Deno.resources() (#25251) 2024-08-31 09:34:09 +10:00
Asher Gomez
504ae362d5
chore: remove Deno.metrics() (#25167) 2024-08-31 08:43:32 +10:00
David Sherret
35074a10c6
fix(lint): support linting jsr pkg without version field (#25230) 2024-08-30 18:05:44 -04:00
David Sherret
f891e73bbf
refactor: remove DENO_FUTURE (#25314) 2024-08-30 21:58:24 +00:00
David Sherret
4a5642779e
fix: upgrade deno_ast 0.42 (#25313) 2024-08-30 17:12:13 -04:00
Bartek Iwańczuk
b1c6142f74
BREAKING: DENO_FUTURE=1 by default, or welcome to Deno 2.0 (#25213)
This commit effectively turns Deno into Deno 2.0.

This is done by forcing `DENO_FUTURE=1` env var, that was available in
the past few months to try Deno 2 changes.

This commit contains several breaking changes scheduled for Deno 2:
- all deprecated JavaScript APIs are not available any more, mostly
`Deno.*` APIs
- `window` global is removed
- FFI, WebGPU and FS APIs are now stable and don't require
`--unstable-*` flags
- import assertions are no longer supported
- "bring your own node modules" is enabled by default

This is the first commit in a series that are scheduled before the Deno
2 release.

Follow up work is tracked in
https://github.com/denoland/deno/issues/25241.

---------

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-08-30 13:58:58 -04:00
Caleb Lloyd
4639ae655e
fix(ext/node): session close during stream setup (#25170)
Signed-off-by: Caleb Lloyd <caleblloyd@gmail.com>
2024-08-30 23:16:17 +05:30
Yoshiya Hinosawa
d71eebba0d
test(ext/node): check hostname option has precedence over host option (#25292) 2024-08-30 13:25:33 +09:00
Nathan Whitaker
86d5b919d8
feat(config): Node modules option for 2.0 (#25299) 2024-08-29 15:57:43 -07:00
snek
f7556d8962
fix: reland async context (#25140)
This reverts commit 71ca61e189.

Now uses a shared implementation from deno_core.
2024-08-29 02:25:38 +00:00
snek
01eb017ed4
fix: upgrade deno_core to 0.307.0 (#25287)
- fix for https://github.com/denoland/deno/issues/25160
- changes needed to land https://github.com/denoland/deno/pull/25140
2024-08-29 01:17:26 +00:00
David Sherret
c6793f52b9
fix(permissions): disallow any LD_ or DYLD_ prefixed env var without full --allow-run permissions (#25271)
Follow up to https://github.com/denoland/deno/pull/25221

I looked into what the list was and it was quite extensive, so I think
as suggested in
https://github.com/denoland/deno/issues/11964#issuecomment-2314585135 we
should disallow this for any `LD_` prefixed env var.
2024-08-28 21:11:37 -04:00
David Sherret
2afbc1aa39
feat: deprecate import assertions (#25281)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-08-29 01:06:09 +00:00
Bartek Iwańczuk
27d0897841
test: run specs::npm::exec_file_inside_npm_package with DENO_FUTURE=1 (#25282)
The test is failing if run with `DENO_FUTURE=1` which is blocking
https://github.com/denoland/deno/pull/25213.

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-08-29 02:21:59 +02:00
Bartek Iwańczuk
52fb6582e7
test: run node_unit_tests with DENO_FUTURE=1 (#25285)
This is blocking https://github.com/denoland/deno/pull/25213.

Turns out a bunch of FS APIs are completely broken because they
use RIDs (resource IDs) instead of FDs (file descriptors).
2024-08-29 00:09:06 +00:00
Bartek Iwańczuk
57541b48ba
test: replace usage of window with globalThis (#25284)
Fixes several tests blocking https://github.com/denoland/deno/pull/25213
by replacing `window` global that is gone in Deno 2 with `globalThis`.

Also adjusted a few tests using deprecated `rid` field.
2024-08-29 01:56:15 +02:00
Bartek Iwańczuk
231bdc0aa0
test: Don't run unit tests with and without DENO_FUTURE=1 (#25273)
This is still flaky and won't be needed anyway once
https://github.com/denoland/deno/pull/25213 lands.
2024-08-28 19:37:54 +00:00
Luca Casonato
64037b1f02
refactor: don't virtualize the console global for node mode (#25263)
Turns out we only virtualized it so one could have a `Console` property,
and the other one not. We can just make this `console.Console` available
everywhere.
2024-08-28 21:13:34 +02:00
David Sherret
b708a13eb0
feat: improve lockfile v4 to store normalized version constraints and be more terse (#25247)
Stores normalized version constraints in the lockfile, which will
improve reproducibility and will fix a bug with duplicate specifiers
ending up in the lockfile. Also, gets rid of some duplicate data in the
specifiers area of the lockfile.
2024-08-28 14:17:47 -04:00
Nathan Whitaker
7dd861aa36
fix(napi): Fix worker threads importing already-loaded NAPI addon (#25245)
Part of #20613.

If a node addon is using the legacy `napi_module_register` on ctor
approach to module registration, we have to store the registered module
so that other threads can load the addon (because `napi_module_register`
will only be called once per process).
2024-08-28 10:33:47 -07:00
Divy Srivastava
0e50bb1d4a
fix(ext/node): import RSA JWK keys (#25267)
Fixes https://github.com/denoland/deno/issues/24129
2024-08-28 20:56:11 +05:30
Divy Srivastava
b9c144df6f
fix(ext/node): export JWK public key (#25239)
Fixes https://github.com/denoland/deno/issues/18928

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-08-28 15:03:02 +00:00
Divy Srivastava
553bd7dec3
fix(ext/node): import EC JWK keys (#25266) 2024-08-28 19:54:49 +05:30
Luca Casonato
14a34a0cd7
tests: fix wpt_epoch job (#25264) 2024-08-28 14:16:10 +00:00
Divy Srivastava
3394c4df75
fix(ext/node): update aead-gcm-stream to 0.3 (#25261)
Fixes https://github.com/denoland/deno/issues/25260
Fixes https://github.com/denoland/deno/issues/25254
Fixes https://github.com/denoland/deno/issues/23693

Verified that `web-push` GCM decryption works in the browser. See
`aead-gcm-stream` changes
[here](a9ffd0c07c)
2024-08-28 18:34:18 +05:30
Bartek Iwańczuk
efcabce1c1
feat: remove --lock-write flag (#25214)
This commit remove `--lock-write` that was deprecated in v1.45 release.

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

---------

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-08-28 13:23:51 +10:00
Nathan Whitaker
511d13abaf
fix(ext/node): emit online event after worker thread is initialized (#25243)
Fixes #23281. Part of #20613.

We were emitting the `online` event in the constructor, so the caller
could never receive it (since there was no time for them to add a
listener). Instead, emit the event where it's intended – after the
worker is initialized.

---

After this parcel no longer freezes, but still will fail due to other
bugs (which will be fixed in other PRs)
2024-08-28 03:05:32 +00:00
Bartek Iwańczuk
3dba98532a
fix: replace npm install hint with deno install hint (#25244)
Needed for https://github.com/denoland/deno/pull/25213.

With Deno 2, we should suggest using `deno install` instead of `npm
install`.
2024-08-28 02:31:41 +00:00
David Sherret
1a6fd38f2f
fix(permissions): disallow launching subprocess with LD_PRELOAD env var without full run permissions (#25221)
Ref https://github.com/denoland/deno/pull/25215

Closes https://github.com/denoland/deno/issues/11964
2024-08-27 22:03:09 -04:00
Bartek Iwańczuk
b1b72a8a49
test: add supporting for ignoring spec tests (#25242)
You can now specify `"ignore": true` for either the whole file,
concrete test, or concrete step.
2024-08-28 00:19:29 +00:00
Marvin Hagemeister
7e68cce815
fix(task): support tasks with colons in name in deno run (#25233)
Fix task names containing a colon not being found with `deno run`. We
were only checking for a `module not found` error message, but strings
containing a colon throw a different error.

Fixes https://github.com/denoland/deno/issues/25232
2024-08-27 11:27:10 +02:00
Marvin Hagemeister
b6dbe1e256
chore: ignore lint warning in test (#25234)
Noticed this when working on another PR. The test code predates the
addition of our `no-console` rule.
2024-08-27 08:48:15 +00:00
David Sherret
c89a20b428
perf(cache): single cache file for remote modules (#24983)
This changes the global cache to store the cache file for remote modules
in one file instead of two.
2024-08-26 23:59:17 +00:00
David Sherret
e13230226f
feat: lockfile v4 by default (#25165)
This won't be fully stabilized until 2.0 is released.
2024-08-26 23:01:50 +00:00
Bartek Iwańczuk
ba58628601
Reland "test: run unit tests with DENO_FUTURE=1" (#25212)
Reverted in https://github.com/denoland/deno/pull/25060
2024-08-26 23:58:28 +02:00
Luca Casonato
e53678fd58
Revert "feat(fetch): accept async iterables for body" (#25207)
Unfortunately this caused a regression:
https://github.com/denoland/deno/issues/25203.

Need to do some more upstream spec work to fix this before this can be
re-landed.

Reverts denoland/deno#24623
2024-08-26 12:24:27 +02:00
Armaan Salam
675539c7ab
fix(bench): Fix table column alignments and NO_COLOR=1 (#25190)
Fix table layout for `deno bench` command with and without color
(`NO_COLOR=1`).

Fixes issue in #25156
2024-08-26 11:56:04 +02:00
Marvin Hagemeister
1dad29aa04
fix(node/cluster): improve stubs to make log4js work (#25146)
- Add missing exports to `node:cluster`
- Fix default export not being an instance of `EventEmitter`
- Fix aliasing of properties
- Fix `disconnected` -> `disconnect` export naming

This makes `log4js` work in Deno. `karma` starts too, but somehow the
server isn't responding. That looks like a different issue.

Fixes https://github.com/denoland/deno/issues/24858
2024-08-26 11:19:58 +02:00
Nayeem Rahman
2ab4afc6b8
refactor(lsp): changes for lsp_types 0.97.0 (#25169) 2024-08-24 01:21:21 +01:00
Divy Srivastava
38bc4021e6
fix(ext/crypto): throw DataError for invalid EC key import (#25181)
Fixes https://github.com/denoland/deno/issues/20931
2024-08-23 22:06:40 +05:30
Divy Srivastava
d9a7b30d1f
fix(ext/node): import JWK octet key pairs (#25180)
Ref https://github.com/denoland/deno/issues/24129

`kty: "okp"` is defined in
[rfc8037](https://www.rfc-editor.org/rfc/rfc8037.html)
2024-08-23 22:06:28 +05:30
Yusuke Tanaka
d54d29662f
chore: enable log feature for tracing crate (#25078)
This commit enables the `log` feature for the `tracing` crate.

This allows us to examine additional detailed logs emitted by third party crates
that use `tracing` crate for logging by setting `RUST_LOG` env var or passing
`-L` option in command line.

Closes #25045
2024-08-22 19:15:10 -07:00
Nathan Whitaker
f606402677
fix(install): Use relative symlinks in deno install (#25164)
Fixes https://github.com/denoland/deno/issues/25161
2024-08-22 21:55:17 +00:00
Leo Kettmeir
9bc7de9b13
fix(urlpattern): fallback to empty string for undefined group values (#25151)
This change was introduced in #24741, but due to the change in
behaviour, we will revert it and re-introduce it in 2.0
2024-08-22 05:44:09 -07:00
Divy Srivastava
2531204a34
fix(ext/node): register node:wasi built-in (#25134)
Fixes https://github.com/denoland/deno/issues/23531
2024-08-22 09:03:52 +05:30
Nathan Whitaker
48da3c17ea
fix(add): Handle packages without root exports (#25102)
Fixes #24607.

This PR makes the logic that caches top level dependencies (things
present in import map) smarter, so we handle JSR dependencies without
root exports.
2024-08-21 15:23:32 -07:00
Nayeem Rahman
c22ff197db
fix(lsp): resolve jsx import source with types mode (#25064) 2024-08-21 20:00:23 +01:00
David Sherret
1d4169204c
fix: warn about import assertions when using typescript (#25135)
1. On emit, checks for the prescence of import assertions.
1. Warns and doesn't store the parsed source in the emit cache in this
case.
2024-08-21 17:12:56 +00:00
Nayeem Rahman
76990df6fa
chore(lsp): use 'install' terminology for jsr and npm packages (#25119) 2024-08-21 15:10:28 +01:00
Satya Rohith
e920835417
fix(ext/node): pass content-disposition header as string instead of bytes (#25128)
Closes https://github.com/denoland/deno/issues/25117
2024-08-21 10:13:17 +00:00
seb
a3a54bc747
fix(ext/net): validate port in Deno.{connect,serve,listen} (#24399)
Co-authored-by: Will Leach <4619280+melbourne2991@users.noreply.github.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-08-20 21:25:41 +00:00
David Sherret
37279e0b0a
fix(add): error when config file contains importMap field (#25115)
The "imports" field has higher precedence than "importMap", so we should
error when `deno add` goes to add an `"imports"` field.

Closes https://github.com/denoland/deno/issues/24264
Closes https://github.com/denoland/deno/pull/24478
2024-08-20 16:32:01 -04:00
David Sherret
a7c002ae63
chore: enable no-console dlint rule (#25113) 2024-08-20 15:14:37 -04:00
Nayeem Rahman
acba2cd48c
fix(lsp): include scoped import map keys in completions (#25047) 2024-08-20 19:38:47 +01:00
Yazan AbdAl-Rahman
a7c8bb1596
feat: glob and directory support for deno check and deno cache cli arg paths (#25001)
Closes #24668
Closes #20813

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-08-20 18:38:06 +00:00
Bartek Iwańczuk
1f47248143
fix: adjust suggestion for lockfile regeneration (#25107)
Ref https://github.com/denoland/deno/pull/24436#issuecomment-2288568645
2024-08-20 20:13:17 +02:00
HasanAlrimawi
0704454755
feat: Print deprecation message for npm packages (#24992)
This commit adds ability to print deprecation notices
for npm packages that have been marked as deprecated.

Closes #24013
2024-08-20 19:53:53 +02:00
Nathan Whitaker
5168700be6
feat(config): Support frozen lockfile config option in deno.json (#25100)
Closes #24544
2024-08-20 14:55:47 +00:00
David Sherret
f1c58ec041
feat(unstable): ability to use a local copy of jsr packages (#25068) 2024-08-20 14:11:43 +00:00
Hajime-san
19bcb40059
feat(cli/tools): add a subcommand --hide-stacktraces for test (#24095) 2024-08-20 01:27:36 +00:00
Yazan AbdAl-Rahman
4f49f703c1
fix(cli): update permission prompt message for compiled binaries (#24081)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-08-20 01:20:06 +00:00
melbourne2991
0eba180fdb
fix(repl): Prevent panic on broken pipe (#21945) 2024-08-20 00:21:12 +00:00
Yazan AbdAl-Rahman
4285cb339d
fix(lint): support linting tsx/jsx from stdin (#24955)
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-08-19 20:42:13 +00:00
Bartek Iwańczuk
b5051e25c2
feat: Deprecate "import assertions" with a warning (#24743)
This commit deprecates "import assertions" proposal that has been
replaced with "import attributes".

Any time an import assertion is encountered a warning will be printed
to the terminal. This warning will be printed for both local and 
remote files (ie. user code and dependencies).

Import assertions support will be removed in Deno 2.
2024-08-19 22:36:35 +02:00
David Sherret
bf510544ef
chore: improve accessing special file test (#25099) 2024-08-19 16:21:27 -04:00
Bedis Nbiba
ee2b6899a1
fix: add permission name when accessing a special file errors (#25085) 2024-08-19 17:45:10 +00:00
David Sherret
c9edb15f15
fix(compile): make output more deterministic (#25092)
Closes https://github.com/denoland/deno/issues/25084
2024-08-19 16:41:11 +00:00
Marvin Hagemeister
48701c19f8
fix(node/tty): fix tty.WriteStream.hasColor with different args (#25094)
The check in `tty.WriteStream.prototype.hasColors()` was incorrect
leading to the
[`yoctocolors`](https://github.com/sindresorhus/yoctocolors) package not
printing any colors.

Fixes https://github.com/denoland/deno/issues/24407
2024-08-19 17:13:09 +02:00
David Sherret
526f39fbb9
feat(FUTURE): terse lockfile (v4) (#25059) 2024-08-19 03:01:39 +00:00
Luca Casonato
9bc2dd29ad
fix: clean up flag help output (#24686)
Permission flags are unified in a clearer and concise output.
Unstable flags are hidden by default with exception of the `unstable`
flag itself. the remaining unstable flags can be seen with a
`--help=unstable`.
This also cleans up to show unstable flags only for subcommands that
actually need them.
Also sorts flags alphabetically, and gorups various flags together in a
set of categories.

---------

Co-authored-by: crowlkats <crowlkats@toaxl.com>
2024-08-18 15:39:53 -07:00
Marvin Hagemeister
558d2a098b
fix(node/http): wrong req.url value (#25081)
This PR addresses a regression introduced in
https://github.com/denoland/deno/pull/25021 that would cause the
`req.url` parameter in Node's http server to always be a single
character instead of the expected value. The regression was caused by
effectively calling `.indexOf()` on an empty string and thus passing the
wrong index for slicing.

```js
"".indexOf("/") // -> -1
request.url.slice(-1) // effectively only giving us the last character
```

Fixes https://github.com/denoland/deno/issues/25080
2024-08-18 15:37:39 +00:00
Yoshiya Hinosawa
b6cdb31c05
fix(ext/node): fix prismjs compatibiliy in Web Worker (#25062)
PrismJS uses `WorkerGlobalScope` and `self` for detecting browser's Web
Worker context:
59e5a34713/prism.js (L11)

Now the detection logic above is broken when it's imported from Deno's
Web Worker context because we only hide `self` (Prism assumes when
`WorkerGlobalScope` is available, `self` is also available).

This change fixes the above by also hiding `WorkerGlobalScope` global in
Node compat mode.

closes #25008
2024-08-17 11:16:43 +09:00
Nathan Whitaker
ff4226a3cd
fix(node/fs): Use correct offset and length in node:fs.read and write (#25049)
My fix in #25030 was buggy, I forgot to pass the `byteOffset` and
`byteLength`. Whoops.

I also discovered that fs.read was not respecting the `offset` argument,
and we were constructing a new `Buffer` for the callback instead of just
passing the original one (which is what node does, and the @types/node
definitions also indicate the callback should get the same type).
Fixes #25028.
2024-08-16 09:48:57 -07:00
David Sherret
4d1b263e91
feat(publish): suggest importing jsr:@std/ for deno.land/std urls (#25046) 2024-08-16 10:42:11 -04:00
David Sherret
57cd2951f1
feat(config/jsr): add license field (#25056)
1. Adds a new "license" field.
1. Adds this field by default when doing `deno init --lib`
2024-08-16 13:12:52 +00:00
Yoshiya Hinosawa
105d27bc7d
fix(ext/node): improve shelljs compat with managed npm execution (#24912)
This change improves the Node.js compatibility in managed npm resolution
mode by disabling the discovery of `node_modules` when the
main specifier is inside of `DENO_DIR`.

closes #22732
closes #24589
2024-08-16 12:48:48 +09:00
Bartek Iwańczuk
b6c74aab24
Revert "test: run unit tests with DENO_FUTURE=1 (#24400)" (#25060)
This reverts commit 22a834ff5b.

Appears this commit might have broken tests on `main`.
2024-08-15 23:30:06 +00:00
Nathan Whitaker
a58494483a
chore: Disable part of parallel serve test on macos (flaky) (#25057)
MacOS tends to not distribute evenly, so just don't assert that requests
were served by > 1 worker on mac.

Also added a check that all workers start, so we at least check that on
macos.
2024-08-15 21:48:35 +00:00
Nathan Whitaker
5ec3c5c3a4
feat(lint): Add lint for usage of node globals (with autofix) (#25048)
From upgrading `deno_lint`.

Previously if you had a node project that used a bunch of node globals
(`process.env`, etc), you would have to fix the errors by hand. This PR
includes a new lint that detects usages of node globals (`process`,
`setImmediate`, `Buffer`, etc.) and provides an autofix to import the
correct value. For instance:

```ts
// main.ts
const _foo = process.env.FOO;
```

`deno lint` gives you

```ts
error[no-node-globals]: NodeJS globals are not available in Deno
 --> /home/foo.ts:1:14
  |
1 | const _foo = process.env.FOO;
  |              ^^^^^^^
  = hint: Add `import process from "node:process";`

  docs: https://lint.deno.land/rules/no-node-globals


Found 1 problem (1 fixable via --fix)
Checked 1 file
```
And `deno lint --fix` adds the import for you:

```ts
// main.ts
import process from "node:process";
const _foo = process.env.FOO;
```
2024-08-15 20:43:04 +00:00
Nathan Whitaker
8749d651fb
fix(node): Create additional pipes for child processes (#25016)
Linux/macos only currently.

Part of https://github.com/denoland/deno/issues/23524 (fixes it on
platforms other than windows).
Part of #16899  (fixes it on platforms other than windows).

After this PR, playwright is functional on mac/linux.
2024-08-15 09:38:46 -07:00
Nathan Whitaker
e92a05b551
feat(serve): Opt-in parallelism for deno serve (#24920)
Adds a `parallel` flag to `deno serve`. When present, we spawn multiple
workers to parallelize serving requests.


```bash
deno serve --parallel main.ts
```

Currently on linux we use `SO_REUSEPORT` and rely on the fact that the
kernel will distribute connections in a round-robin manner.

On mac and windows, we sort of emulate this by cloning the underlying
file descriptor and passing a handle to each worker. The connections
will not be guaranteed to be fairly distributed (and in practice almost
certainly won't be), but the distribution is still spread enough to
provide a significant performance increase.

---
(Run on an Macbook Pro with an M3 Max, serving `deno.com`

baseline::
```
❯ wrk -d 30s -c 125 --latency http://127.0.0.1:8000
Running 30s test @ http://127.0.0.1:8000
  2 threads and 125 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   239.78ms   13.56ms 330.54ms   79.12%
    Req/Sec   258.58     35.56   360.00     70.64%
  Latency Distribution
     50%  236.72ms
     75%  248.46ms
     90%  256.84ms
     99%  268.23ms
  15458 requests in 30.02s, 2.47GB read
Requests/sec:    514.89
Transfer/sec:     84.33MB
```

this PR (`with --parallel` flag)
```
❯ wrk -d 30s -c 125 --latency http://127.0.0.1:8000
Running 30s test @ http://127.0.0.1:8000
  2 threads and 125 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   117.40ms  142.84ms 590.45ms   79.07%
    Req/Sec     1.33k   175.19     1.77k    69.00%
  Latency Distribution
     50%   22.34ms
     75%  223.67ms
     90%  357.32ms
     99%  460.50ms
  79636 requests in 30.07s, 12.74GB read
Requests/sec:   2647.96
Transfer/sec:    433.71MB
```
2024-08-14 22:26:21 +00:00
Sean McArthur
875ee618d3
feat(ext/node): support http2session.socket (#24786)
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-08-14 21:59:22 +00:00
Nayeem Rahman
4eff1e8ec4
fix(lsp): import map lookup for jsr subpath auto import (#25025) 2024-08-14 22:38:18 +01:00
Pig Fang
3a3315cc7f
feat(fmt): support HTML, Svelte, Vue, Astro and Angular (#25019)
This commit adds capability to format HTML, Svelte, Vue, Astro and Angular
files.

"--unstable-html" is required to format HTML files, and "--unstable-component"
flag is needed to format other formats. These can also be specified in the config
file.

Close #25015
2024-08-14 22:58:48 +02:00
Bartek Iwańczuk
22a834ff5b
test: run unit tests with DENO_FUTURE=1 (#24400)
This commit adds another test suite that runs all Deno unit tests
with `DENO_FUTURE=1` flag to ensure all APIs are working as
expected, once Deno 2 is released.

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-08-14 22:50:06 +02:00
Asher Gomez
f89b531149
feat(node): support username and _password in .npmrc file (#24793)
Closes #23950
2024-08-14 18:53:15 +02:00
Nathan Whitaker
1f2d48cd97
fix(node/fs): node:fs.read and write should accept typed arrays other than Uint8Array (#25030)
Part of #25028.

Our underlying read/write operations in `io` assume the buffer is a
Uint8Array, but we were passing in other typed arrays (in the case above
it was `Int8Array`).
2024-08-14 09:42:31 -07:00
Marvin Hagemeister
c765d9ad2f
fix(node/inspector): Session constructor should not throw (#25041)
There is no constructor code when creating an inspector `Session`
instance in Node. Also get rid of some symbols which should've been
private properties. This PR doesn't yet add any new implementations
though as these are mostly cosmetic changes.
2024-08-14 13:34:24 +00:00
Luca Casonato
130a2592f1
fix(cli): support --watch when running cjs npm packages (#25038) 2024-08-14 15:21:11 +02:00
Marvin Hagemeister
533d31bc4e
fix: node:inspector not being registered (#25007)
For some reason we didn't register the `node:inspector` module, which
lead to a panic when trying to import it. This PR registers it.

Related: https://github.com/denoland/deno/issues/25004
2024-08-14 12:33:42 +00:00
Bartek Iwańczuk
b325bf0a35
feat(clean): add progress bar (#25026)
Closes https://github.com/denoland/deno/issues/25020
2024-08-14 13:04:07 +02:00
Łukasz Czerniawski
e2faf50375
feat(coverage): add breadcrumbs to deno coverage --html report (#24860) 2024-08-14 16:37:19 +09:00
David Sherret
39a21fd78e
feat(publish): error on missing license file (#25011)
Closes https://github.com/denoland/deno/issues/24676
2024-08-12 19:51:58 -04:00
David Sherret
d3ced2fe43
chore: mark upgrade_prompt as flaky (#25009) 2024-08-12 23:04:00 +02:00
David Sherret
085058cfff
feat: deno remove (#24952)
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-08-12 16:17:25 -04:00
Kenta Moriuchi
76f4f202e7
chore: update the copyright of c, mjs, and jsx (#25005) 2024-08-12 12:41:32 -04:00
Leo Kettmeir
e5f0058b74
feat: better help output (#24958) 2024-08-12 08:55:33 -07:00
Luca Casonato
56e8ed5eb1
fix(ext/node): don't concat set-cookie in ServerResponse.appendHeader (#25000)
Follow-on to
https://github.com/denoland/deno/pull/24216/files#r1642188672
2024-08-12 12:01:37 +02:00
Bartek Iwańczuk
004b74c8c6
feat: Rename --unstable-hmr to --watch-hmr (#24975)
This commit stabilizes HMR functionality and renames
`--unstable-hmr` to `--watch-hmr`. The `--unstable-hmr`
flag is still working, but hidden from the help output.
It will be removed in Deno 2.

Once https://github.com/denoland/deno/pull/24958 lands
we should improve grouping of `--watch` and `--watch-hmr`
flags.
2024-08-12 00:10:55 +02:00
Divy Srivastava
d6f662ac82
fix(ext/node): support ieee-p1363 ECDSA signatures and pss salt len (#24981)
Fixes https://github.com/denoland/deno/issues/22919
2024-08-11 14:59:53 +05:30
Divy Srivastava
feba133711
fix(ext/node): createBrotliCompress params (#24984)
Fixes https://github.com/denoland/deno/issues/24416
2024-08-11 14:26:30 +05:30
Pig Fang
82884348cb
feat(fmt): support CSS, SCSS, Sass and Less (#24870)
This PR integrates [Malva](https://github.com/g-plane/malva) into `deno
fmt`, which introduces the ability to format CSS, SCSS, Sass and Less
files.

On Linux x64 6.10, this PR increases about 800KiB:

```                                                                                                                                                                      
❯ wc -c target/release/deno
125168728 target/release/deno

❯ wc -c target/release/deno
124349456 target/release/deno
```
2024-08-09 18:52:23 +02:00
Nathan Whitaker
218ee1b1ff
fix(add): Better error message when missing npm specifier (#24970)
Before:
<img width="278" alt="Screenshot 2024-08-09 at 3 15 01 PM"
src="https://github.com/user-attachments/assets/91b0ada6-93ee-4be6-a996-078aef98c2a9">

After:
<img width="888" alt="Screenshot 2024-08-09 at 3 52 15 PM"
src="https://github.com/user-attachments/assets/3c88a0e8-c761-4f70-88bf-109355ac12f0">
2024-08-09 14:29:11 +00:00
Nathan Whitaker
854c7ba198
fix(install): Properly handle dist tags when setting up node_modules (#24968)
Fixes https://github.com/denoland/deno/issues/24966.
Fixes https://github.com/denoland/deno/issues/24932.
2024-08-09 13:35:54 +00:00
Marvin Hagemeister
f474c4f4ff
fix: stub node:module.register() (#24965)
This is commonly used to register loading non standard file types. But
some libs also register TS loaders which Deno supports natively, like
the npm `payload` package. This PR unblocks those.

Fixes https://github.com/denoland/deno/issues/24902
2024-08-09 14:25:33 +02:00
Bartek Iwańczuk
ffe1bfd54c
feat: deno init --serve (#24897)
This commit adds "--serve" flag to "deno init" subcommand,
that provides a template for quick starting a project using
"deno serve".

---------

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-08-08 16:54:39 +00:00
Nathan Whitaker
3f692bed0a
fix(add): Support dist tags in deno add (#24960)
Fixes #24956.
2024-08-08 16:45:41 +00:00
Yusuke Tanaka
e36b1a3aa8
fix(ext/fetch): include TCP src/dst socket info in error messages (#24939)
This commit makes `fetch` error messages include source and destination TCP
socket info i.e. port number and IP address for better debuggability.

Closes #24922
2024-08-08 08:47:15 -07:00
Bartek Iwańczuk
c94d1b10f8
feat(install): change 'Add ...' message (#24949)
Changes messages printed by `deno add` from
`Add @oak/oak - jsr:@oak/oak^16.1.0` to
`Add jsr:@oak/oak16.1.0`.
2024-08-08 16:25:05 +02:00
Birk Skyum
4c56353594
feat(cli): Add --env-file as alternative to --env (#24555) 2024-08-08 06:50:57 -07:00
Bartek Iwańczuk
ab8802f49b
feat(permissions): link to docs in permission prompt (#24948)
This commit updates permission prompt to add a link
to the documentation for particular flag.

Additionally the box drawings around the prompt have been slightly
altered for better visibility.

<img width="737" alt="Screenshot 2024-08-08 at 12 42 32"
src="https://github.com/user-attachments/assets/6ae748cd-4f29-439d-b0ee-f28f565f211a">
2024-08-08 15:39:31 +02:00
David Sherret
e9e3ab4628
feat: deno clean (#24950)
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-08-08 13:22:18 +00:00
Marvin Hagemeister
f50d38869d
fix(node/util): add missing debug alias of debuglog (#24944)
Add the missing `node:util.debug` export which is an alias of
`node:util.debuglog`, see
https://nodejs.org/api/util.html#utildebugsection
2024-08-08 13:52:14 +02:00
Satya Rohith
65224786d2
fix(ext/node): client closing streaming request shouldn't terminate http server (#24946)
Closes https://github.com/denoland/deno/issues/22820
2024-08-08 10:22:58 +00:00
David Sherret
6fce23c54e
perf: skip saving to emit cache after first failure (#24896) 2024-08-08 09:41:30 +00:00
Yusuke Tanaka
4e4c96bf66
fix(ext/fetch): include URL and error details on fetch failures (#24910)
This commit improves error messages that `fetch` generates on failure.

Fixes #24835
2024-08-07 23:18:33 -07:00
Marvin Hagemeister
9d6da1036d
fix: rename watch event missing (#24893)
This PR ensures that we forward a `rename` event in our file watcher.
The rust lib we use combines that with the `modify` event.

This fixes a compatibility issue with Node too, which sends the `rename`
event as well.

Fixes https://github.com/denoland/deno/issues/24880
2024-08-07 18:15:57 +02:00
David Sherret
04473c04ed
fix(compile): support workspace members importing other members (#24909) 2024-08-07 07:43:05 +00:00
Luca Casonato
4fa8869f24
feat(ext/node): rewrite crypto keys (#24463)
This completely rewrites how we handle key material in ext/node. Changes
in this
PR:

- **Signing**
  - RSA
  - RSA-PSS 🆕
  - DSA 🆕
  - EC
  - ED25519 🆕
- **Verifying**
  - RSA
  - RSA-PSS 🆕
  - DSA 🆕
  - EC 🆕
  - ED25519 🆕
- **Private key import**
  - Passphrase encrypted private keys 🆕
  - RSA
    - PEM
    - DER (PKCS#1) 🆕
    - DER (PKCS#8) 🆕
  - RSA-PSS
    - PEM
    - DER (PKCS#1) 🆕
    - DER (PKCS#8) 🆕
  - DSA 🆕
  - EC
    - PEM
    - DER (SEC1) 🆕
    - DER (PKCS#8) 🆕
  - X25519 🆕
  - ED25519 🆕
  - DH
- **Public key import**
  - RSA
    - PEM
    - DER (PKCS#1) 🆕
    - DER (PKCS#8) 🆕
  - RSA-PSS 🆕
  - DSA 🆕
  - EC 🆕
  - X25519 🆕
  - ED25519 🆕
  - DH 🆕
- **Private key export**
  - RSA 🆕
  - DSA 🆕
  - EC 🆕
  - X25519 🆕
  - ED25519 🆕
  - DH 🆕
- **Public key export**
  - RSA
  - DSA 🆕
  - EC 🆕
  - X25519 🆕
  - ED25519 🆕
  - DH 🆕
- **Key pair generation**
  - Overhauled, but supported APIs unchanged

This PR adds a lot of new individual functionality. But most importantly
because
of the new key material representation, it is now trivial to add new
algorithms
(as shown by this PR).

Now, when adding a new algorithm, it is also widely supported - for
example
previously we supported ED25519 key pair generation, but we could not
import,
export, sign or verify with ED25519. We can now do all of those things.
2024-08-07 08:43:58 +02:00
Nayeem Rahman
9a83efa04b
feat(lsp): node specifier completions (#24904) 2024-08-06 16:30:34 +01:00
Satya Rohith
b3f1f3ba04
feat: deno run <task> (#24891)
This PR updates `deno run` to fallback to executing tasks when there is
no script with the specified name. If there are both script and a task
with the same name then `deno run` will prioritise executing the script.
2024-08-06 20:35:30 +05:30
snek
897159dc6e
feat: vm rewrite (#24596)
rewrite vm implementation to increase compat.
vm.Module+importModuleDynamically callbacks should be added in a
followup.
2024-08-06 12:52:53 +00:00
HasanAlrimawi
bbf23190d4
fix: update dry run success message (#24885) 2024-08-06 08:14:06 +00:00
Leo Kettmeir
ba40347a35
feat(fetch): accept async iterables for body (#24623)
Implements https://github.com/whatwg/webidl/pull/1397
Fixes #21454 
Closes #24849
2024-08-06 00:13:02 -07:00
Bartek Iwańczuk
3e1f98236f
feat: Add Deno.ServeDefaultExport type (#24879)
Closes https://github.com/denoland/deno/issues/23725
2024-08-05 23:19:09 +02:00
Leo Kettmeir
27ea23ea69
feat(urlpattern): add ignoreCase option & hasRegExpGroups property, and fix spec discrepancies (#24741)
Fixes #20906
Fixes #24266
Closes #21073

---------

Signed-off-by: Leo Kettmeir <crowlkats@toaxl.com>
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
2024-08-05 01:49:28 -07:00
snek
71ca61e189
Revert "feat: async context" (#24856)
Reverts denoland/deno#24402

deno_web can't depend on code in runtime
2024-08-02 18:16:59 +00:00
snek
3a1a1cc030
feat: async context (#24402)
We are switching to ContinuationPreservedEmbedderData. This allows
adding async context tracking to the various async operations that deno
provides.

Fixes: https://github.com/denoland/deno/issues/7010
Fixes: https://github.com/denoland/deno/issues/22886
Fixes: https://github.com/denoland/deno/issues/24368
2024-08-02 08:14:35 -07:00
Bartek Iwańczuk
b82a2f114c
fix(ext/node): node:zlib coerces quality 10 to 9.5 (#24850)
Fixes https://github.com/denoland/deno/issues/24572
2024-08-02 16:44:32 +02:00
Luca Casonato
7495bcbf77
Revert "perf(ext/node): improve Buffer from string performance" (#24851) 2024-08-02 16:23:21 +02:00
David Sherret
0da81205d5
feat(unstable/fmt): move yaml formatting behind unstable flag (#24848)
This moves YAML formatting behind an unstable flag for Deno 1.46. This
will make it opt-in to start and then we can remove the flag to make it
on by default in version of Deno after that.

This can be specified by doing `deno fmt --unstable-yaml` or by
specifying the following in a deno.json file:

```json
{
  "unstable": ["fmt-yaml"]
}
```
2024-08-02 13:52:48 +00:00
Luca Casonato
84ff418265
feat(test): rename --allow-none to --permit-no-files (#24809) 2024-08-02 13:18:59 +00:00
Pig Fang
124a13280e
feat(fmt): support YAML (#24717) 2024-08-02 12:12:51 +00:00
David Sherret
2ca9940f00
chore: mark upgrade_invalid_canary_version as flaky (#24833) 2024-08-02 12:28:21 +02:00
Hajime-san
ba93278281
fix(ext/webgpu): assign missing constants property of shader about GPUDevice.createRenderPipeline[Async] (#24803)
fixes https://github.com/denoland/deno/issues/24287
2024-08-01 11:19:25 -07:00
Leo Kettmeir
6db5f1bb6e
fix(ext/console): render properties of Intl.Locale (#24827)
Fixes #21271

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-08-01 09:45:05 -07:00
Luca Casonato
4eda9e64e9
fix(ext/http): correctly consume response body in Deno.serve (#24811)
Prior to this commit, you could return a `Response` created from a
string or Uint8Array multiple times.

Now you can't do that anymore.
2024-08-01 15:46:05 +02:00
Ryan Dahl
c79cb339ef
chore: upgrade flaky_test, fastwebsockets, base64, base32, notify (#24746) 2024-08-01 08:35:35 -04:00
Divy Srivastava
9f27bf9144
fix(compile): adhoc codesign mach-o by default (#24824) 2024-08-01 02:11:24 -07:00
Luca Casonato
f1fc708d81
fix(ext/crypto): respect offsets when writing into ab views in randomFillSync (#24816) 2024-08-01 09:38:46 +02:00
snek
f57745fe21
feat: upgrade V8 to 12.8 (#24693)
- upgrade to v8 12.8
  - optimizes DataView bigint methods
  - fixes global interceptors
  - includes CPED methods for ALS
- fix global resolution
- makes global resolution consistent using host_defined_options.
originally a separate patch but due to the global interceptor bug it
needs to be included in this pr for all tests to pass.
2024-07-31 23:22:34 +00:00
Luca Casonato
1faac2dce3
fix(ext/node): handle node child_process with --v8-options flag (#24804)
Makes `v8flags` package from NPM work.
2024-07-31 16:28:08 +02:00
Marvin Hagemeister
9e6288ec61
fix(node/fs/promises): watch should be async iterable (#24805)
The way `fs.watch` works is different in `node:fs/promises` than
`node:fs`. It has a different function signature and it returns an async
iterable instead, see
https://nodejs.org/api/fs.html#fspromiseswatchfilename-options

Fixes https://github.com/denoland/deno/issues/24661
2024-07-31 13:07:49 +02:00
Marvin Hagemeister
1e2581e57b
fix(node/timers/promises): add scheduler APIs (#24802)
This PR adds the experimental `scheduler` APIs in Node's
`timers/promises` module. See
https://nodejs.org/api/timers.html#timerspromisesschedulerwaitdelay-options

Fixes https://github.com/denoland/deno/issues/24800
2024-07-31 12:00:01 +02:00
Nathan Whitaker
cd59fc53a5
fix(node): Rework node:child_process IPC (#24763)
Fixes https://github.com/denoland/deno/issues/24756. Fixes
https://github.com/denoland/deno/issues/24796.

This also gets vitest working when using
[`--pool=forks`](https://vitest.dev/guide/improving-performance#pool)
(which is the default as of vitest 2.0). Ref
https://github.com/denoland/deno/issues/23882.

---

This PR resolves a handful of issues with child_process IPC. In
particular:

- We didn't support sending typed array views over IPC
- Opening an IPC channel resulted in the event loop never exiting
- Sending a `null` over IPC would terminate the channel
- There was some UB in the read implementation (transmuting an `&[u8]`
to `&mut [u8]`)
- The `send` method wasn't returning anything, so there was no way to
signal backpressure (this also resulted in the benchmark
`child_process_ipc.mjs` being misleading, as it tried to respect
backpressure. That gave node much worse results at larger message sizes,
and gave us much worse results at smaller message sizes).
- We weren't setting up the `channel` property on the `process` global
(or on the `ChildProcess` object), and also didn't have a way to
ref/unref the channel
- Calling `kill` multiple times (or disconnecting the channel, then
calling kill) would throw an error
- Node couldn't spawn a deno subprocess and communicate with it over IPC
2024-07-30 16:13:24 -07:00
David Sherret
fe884c557a
fix(compile/windows): handle cjs re-export of relative path with parent component (#24795)
Closes https://github.com/denoland/deno/issues/24785
2024-07-30 16:46:15 -04:00
David Sherret
7a3810195d
fix(node): support wildcards in package.json imports (#24794) 2024-07-30 17:14:07 +00:00
Divy Srivastava
1ba88a7892
perf(ext/node): improve Buffer from string performance (#24567)
Fixes https://github.com/denoland/deno/issues/24323

- Use a Buffer pool for `fromString`
- Implement fast call base64 writes
- Direct from string `create` method for each encoding op

```
$ deno bench -A bench.mjs # 1.45.1+fee4d3a
cpu: Apple M1 Pro
runtime: deno 1.45.1+fee4d3a (aarch64-apple-darwin)

benchmark                time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------- -----------------------------
Buffer.from base64      550 ns/iter     (490 ns … 1'265 ns)    572 ns    606 ns  1'265 ns
Buffer#write base64     285 ns/iter       (259 ns … 371 ns)    307 ns    347 ns    360 ns

$ ~/gh/deno/target/release/deno bench -A bench.mjs # this PR
cpu: Apple M1 Pro
runtime: deno dev (aarch64-apple-darwin)

benchmark                time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------- -----------------------------
Buffer.from base64      151 ns/iter       (145 ns … 770 ns)    148 ns    184 ns    648 ns
Buffer#write base64   62.58 ns/iter     (60.79 ns … 157 ns)  61.65 ns  75.79 ns    141 ns

$ node bench.mjs # v22.4.0
cpu: Apple M1 Pro
runtime: node v22.4.0 (arm64-darwin)

benchmark                time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------- -----------------------------
Buffer.from base64      163 ns/iter     (96.92 ns … 375 ns)  99.45 ns    127 ns    220 ns
Buffer#write base64   75.48 ns/iter     (74.97 ns … 134 ns)  75.17 ns  81.83 ns  96.84 ns
```
2024-07-30 18:09:55 +05:30
David Sherret
38a363dc7c
chore: mark upgrade invalid lockfile as flaky (#24760)
Closes #24759
2024-07-29 16:18:25 -04:00
Satya Rohith
8c2f1f5a55
chore: upgrade to rust 1.80 (#24778) 2024-07-29 12:58:04 -04:00
Satya Rohith
8bab761bcc
fix(ext/node): prevent panic in http2.connect with uppercase header names (#24780)
Closes https://github.com/denoland/deno/issues/24678
2024-07-29 13:33:55 +02:00
Yazan AbdAl-Rahman
41f8988dc7
fix(http): Adjust hostname display for Windows when using 0.0.0.0 (#24698)
Fixes #24687

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-07-28 23:04:05 +02:00
David Sherret
50fa4d7ef5
fix: actually add missing node:readline/promises module (#24772)
Closes #24768
2024-07-28 15:41:10 -04:00
Yoshiya Hinosawa
99e811f5eb
test(ext/node): reduce http_test flakiness (#24742) 2024-07-27 22:47:47 +09:00
Kyle Kelley
63f8218a7d
fix: adapt to new jupyter runtime API and include session IDs (#24762)
Closes #24737, #24437.
2024-07-27 10:39:08 +02:00
David Sherret
06b6352292
fix(unstable/compile): handle byonm import in sub dir (#24755)
Regression in 1.45.0 caused by storing relative paths instead of
absolute paths in the binary.

Closes #24654
2024-07-26 15:53:53 -04:00
David Sherret
bee16c54ab
fix(publish): workspace included license file had incorrect path (#24747)
Also fixes the issue where we say a package was successfully published
before it wasn't.

Bug in https://github.com/denoland/deno/pull/24714
2024-07-26 15:35:29 +00:00
David Sherret
7907265590
fix(node): cjs pkg dynamically importing esm-only pkg fails (#24730) 2024-07-25 21:40:10 -04:00
Marvin Hagemeister
0cf7f268a7
fix(node/worker_threads): support port.once() (#24725)
Support `MessagePort.once` in Node mode and enable relevant
`worker_threads` test. Noticed that another Node test was passing as
well, so I enabled that too.
2024-07-25 23:06:19 +02: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
Asher Gomez
5f44148e83
chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
David Sherret
84b7504d0f
fix(workspaces/publish): include the license file from the workspace root if not in pkg (#24714) 2024-07-25 01:43:30 +00:00
Bartek Iwańczuk
5f5f662a68
fix: upgrade deno_core to 0.298.0 (#24709)
Fixes percent-encoded filenames in stack traces:
- https://github.com/denoland/deno_core/pull/759

Closes #18983
2024-07-25 03:36:34 +02:00
Asher Gomez
f248050cb4
chore: use @std prefix for internal module specifiers (#24543)
This change aims to replace all relative import specifiers targeted at
`tests/util/std` with mapped ones (using a `deno.json` file). Towards
updating the `std` git submodule.
2024-07-25 10:26:54 +10:00
Nathan Whitaker
795ed23b35
fix(future): Emit deno install warning less often, suggest deno install in error message (#24706)
Two small changes:

- In our BYONM errors, suggest running `deno install` instead of `npm
install` if `DENO_FUTURE` is set
- Only emit warning about `deno install` changes if you do `deno install
<foo>` with deno_future unset
2024-07-24 23:37:13 +00:00
Bartek Iwańczuk
1fad6eb2ac
fix(ext/fetch): respect authority from URL (#24705)
This commit fixes handling of "authority" in the URL by properly
sending "Authorization Basic..." header in `fetch` API.

This is a regression from https://github.com/denoland/deno/pull/24593
Fixes https://github.com/denoland/deno/issues/24697

CC @seanmonstar
2024-07-24 23:22:43 +02:00
Leo Kettmeir
b305ba3e1c
perf: update deno_doc (#24700)
Ref https://github.com/denoland/deno_doc/pull/616
2024-07-24 12:23:16 -07:00
HasanAlrimawi
fcd9bbe8ee
fix: update lsp error message of 'relative import path' to 'use deno add' for npm/jsr packages (#24524) 2024-07-24 16:12:42 +01:00
Yoshiya Hinosawa
199a8ca4c5
fix(ext/node/net): emit error before close when connection is refused (#24656) 2024-07-24 20:33:45 +09:00
Nathan Whitaker
29934d558c
fix(node): Run node compat tests listed in the ignore field (and fix the ones that fail) (#24631)
The intent is that those tests will be executed, but our check that the
files are up to date won't overwrite the contents of the tests. This is
useful when a test needs some manual edits to work.

It turns out we weren't actually running them.

---

This ended up turning into a couple of small bug fixes to get the tests
passing:

- We weren't canonicalizing the exec path properly (it sometimes still
had `..` or `.` in it)
- We weren't accepting strings in `process.exit`

There was one failure I couldn't figure out quickly, so I disabled the
test for now, and filed a follow up issue: #24694
2024-07-24 03:12:08 +00:00
David Sherret
52ababc4bf
fix(node): better detection for when to surface node resolution errors (#24653) 2024-07-24 00:22:24 +00:00
Bartek Iwańczuk
445e05a39d
Reland "fix: CFunctionInfo and CTypeInfo leaks (#24634)" (#24692)
Reverted in
95847f4e94.
2024-07-24 02:11:38 +02:00
David Sherret
9114a2df69
fix(upgrade): do not error if config in cwd invalid (#24689)
```
> deno upgrade
error: Unsupported lockfile version 'invalid'. Try upgrading Deno or recreating the lockfile.
V:\scratch
> V:\deno\target\debug\deno upgrade
Looking up latest version
Local deno version 1.45.3 is the most recent release
```

Closes #24517
Closes #20729
2024-07-23 19:00:48 -04:00
HasanAlrimawi
f0df54fc70
fix: enable the reporting of parsing related problems when running deno lint (#24332) 2024-07-23 21:17:17 +00:00
Nayeem Rahman
a45a40533e
fix(lsp): rewrite import for 'infer return type' action (#24685) 2024-07-23 19:39:14 +01:00
Bartek Iwańczuk
8a7ed17ea2
Revert "fix(cli): add NAPI support in standalone mode (#24642)" (#24682)
This reverts commit 4e8f5875bc.

Reverting because, it caused a failure during v1.45.3 publish:

https://github.com/denoland/deno/actions/runs/10048730693/job/27773718095

CC @Mutefish0
2024-07-23 02:42:26 +02:00
Kenta Moriuchi
715675565a
fix(types): Conform lib.deno_web.d.ts to lib.dom.d.ts and lib.webworker.d.ts (#24599)
Fix #24578
Fix #21981
2024-07-22 22:02:39 +02:00
David Sherret
6960637b5c
fix(publish): warn about missing license file (#24677)
Part of https://github.com/denoland/deno/issues/24676 , but just a
warning for now.
2024-07-22 15:46:37 -04:00
Nayeem Rahman
5a696551b7
fix(lsp): scope attribution for asset documents (#24663) 2024-07-22 15:06:08 +01:00
Bartek Iwańczuk
95847f4e94
Revert "fix: CFunctionInfo and CTypeInfo leaks (#24634)" (#24665)
This reverts commit 6c5905dbc3.

Reverting because of errors like this in CI:
```
#
# Fatal error in , line 0
# Check failed: FastApiCallNode::ArityForArgc(c_arg_count, slow_arg_count) == value_input_count.
#
#
#
#FailureMessage Object: 0x7fd5b3ffd9d0
==== C stack trace ===============================

    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1111883) [0x55b8d2107883]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1110b6b) [0x55b8d2106b6b]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x110c6f9) [0x55b8d21026f9]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x20413cd) [0x55b8d30373cd]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x2034222) [0x55b8d302a222]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x202ff44) [0x55b8d3025f44]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1e0b253) [0x55b8d2e01253]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1dfcd96) [0x55b8d2df2d96]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1df92aa) [0x55b8d2def2aa]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1df8b71) [0x55b8d2deeb71]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x11ce49b) [0x55b8d21c449b]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x121fb23) [0x55b8d2215b23]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1221359) [0x55b8d2217359]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1112f3b) [0x55b8d2108f3b]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x111792b) [0x55b8d210d92b]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x110df0f) [0x55b8d2103f0f]
    /lib/x86_64-linux-gnu/libc.so.6(+0x94ac3) [0x7fd5cb294ac3]
    /lib/x86_64-linux-gnu/libc.so.6(+0x126850) [0x7fd5cb326850]
```
2024-07-22 14:58:58 +02:00
MujahedSafaa
994b6327d3
fix(ext/console): Error Cause Not Inspect-Formatted when printed (#24526)
This pull request addresses an issue where the Error.cause property was
not formatted correctly when printed using console.log, leading to
confusion.

solution:
Implemented a fix to ensure that Error.cause is formatted properly when
printed by console.log, and the fix done by using JSON.stringify

This PR fixes https://github.com/denoland/deno/issues/23416

---------

Signed-off-by: MujahedSafaa <168719085+MujahedSafaa@users.noreply.github.com>
2024-07-22 04:18:49 -07:00
Ivancing
4e8f5875bc
fix(cli): add NAPI support in standalone mode (#24642)
Currently, importing Node-Addons modules in a standalone binary results
in a `missing symbol called` error
(https://github.com/denoland/deno/issues/24614). Because the NAPI
symbols are not exported in this mode. This PR should fix the issue.
2024-07-21 10:40:42 -07:00
Divy Srivastava
6c5905dbc3
fix: CFunctionInfo and CTypeInfo leaks (#24634)
Trying out the deno_core patch

Ref https://github.com/denoland/deno_core/pull/832

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

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-21 03:05:35 +02:00
Nathan Whitaker
a4c76add56
fix(cli): Respect implied BYONM from DENO_FUTURE in deno task (#24652)
Regression from
04f9db5b22

Originally I thought to fix the issue in the PR we needed to explicitly
pass through the `node-modules-dir` flag, but after applying the correct
fix that david pointed out (setting `NPM_PROCESS_STATE`) that wasn't
necessary (or correct).

We had a test for deno task with BYONM, but it only tested with
`"unstable": ["byonm"]` in deno.json, so it didn't catch this.
2024-07-19 18:59:04 +00:00
Marvin Hagemeister
ee2e693340
fix(node): support tty.hasColors() and tty.getColorDepth() (#24619)
This PR adds support for
[`tty.WriteStream.prototype.hasColors()`](https://nodejs.org/api/tty.html#writestreamhascolorscount-env)
and
[`tty.WriteStream.prototype.getColorDepth()`](https://nodejs.org/api/tty.html#writestreamgetcolordepthenv).

I couldn't find any usage on GitHub which passes parameters to it.
Therefore I've skipped adding support for the `env` parameter to keep
our snapshot size small.

Based on https://github.com/denoland/deno_terminal/pull/3

Fixes https://github.com/denoland/deno/issues/24616
2024-07-19 12:39:05 +02:00
Yoshiya Hinosawa
76b8ecbb6d
fix(ext/node): do not expose self global in node (#24637)
closes #23727
2024-07-19 12:37:08 +09: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
d80d0cea7c
chore: fix ci (#24633) 2024-07-18 04:21:57 +00:00
David Sherret
ecd4f900c6
fix(publish): surface syntax errors when using --no-check (#24620) 2024-07-17 23:06:30 -04:00
Nathan Whitaker
f122845445
chore: fix flakey lifecycle scripts test (#24629)
Failed in
https://github.com/denoland/deno/actions/runs/9982978127/job/27589707376
2024-07-18 03:54:13 +02:00