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

999 commits

Author SHA1 Message Date
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