1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-02 17:01:14 -05:00
Commit graph

1344 commits

Author SHA1 Message Date
Yoshiya Hinosawa
e943c6a25d
test(ext/node): enable parallel/test-fs-promises-file-handle-stat.js (#27074) 2024-11-27 23:51:23 +09:00
David Sherret
2bbfef137c
feat(unstable): repurpose --unstable-detect-cjs to attempt loading more modules as cjs (#27094)
This resurrects the `--unstable-detect-cjs` flag (which became stable),
and repurposes it to attempt loading .js/.jsx/.ts/.tsx files as CJS in
the following additional scenarios:

1. There is no package.json
1. There is a package.json without a "type" field

Also cleans up the implementation of this in the LSP a lot by hanging
`resolution_mode()` off `Document` (didn't think about doing that until
now).
2024-11-27 09:50:38 -05:00
Divy Srivastava
1e51b650be
perf(ext/webstorage): use object wrap for Storage (#26931)
![image](https://github.com/user-attachments/assets/3f86e2fd-9026-4965-8f3b-512423362f1e)


Depends on:
- https://github.com/denoland/deno_core/pull/970
- https://github.com/denoland/deno_core/pull/976
- https://github.com/denoland/deno_core/pull/980
- https://github.com/denoland/deno_core/pull/981

---------

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-11-27 16:11:57 +05:30
Leo Kettmeir
7400181ecb
fix(tools/doc): HTML resolve main entrypoint from config file (#27103)
Fixes #26901
2024-11-27 02:15:15 -08:00
Marvin Hagemeister
927352bd4e
fix(node/fs): add missing stat path argument validation (#27086)
We didn't validate the `path` argument that's passed to `fs.stat()` and
`fs.statSync()` which lead to wrong errors being thrown. The
`@rollup/plugin-node-resolve` code calls it with `undefined` quite a lot
which lead to `nitro` and `nuxt` failing.

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

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-11-27 08:35:39 +01:00
Leo Kettmeir
42b71d82db
chore(lint): add .out file reference checker (#27078)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-11-26 20:53:20 -08:00
Bartek Iwańczuk
4700f12ddc
fix(task): handle carriage return in task description (#27099)
Ref https://github.com/denoland/deno/pull/27069#discussion_r1857702814
2024-11-27 01:12:47 +00:00
David Sherret
e2f7e031b3
chore: fix flaky specs::publish::npm_workspace_jsr_pkg_with_npm_dep::dep_and_workspace_dep (#27098)
Closes https://github.com/denoland/deno/issues/27097
2024-11-26 19:32:30 -05:00
Kenta Moriuchi
4330ef553f
fix(streams): reject string in ReadableStream.from type (#25116)
WebIDL `async iterable<T>` type rejects `string`

Ref https://github.com/whatwg/webidl/pull/1397, #24623
2024-11-26 19:42:54 +00:00
David Sherret
115a306656
fix(node): correct resolution of dynamic import of esm from cjs (#27071)
Ensures a dynamic import in a CJS file will consider the referrer as an import for node resolution.

Also adds fixes (adds) support for `"resolution-mode"` in TypeScript.
2024-11-26 14:38:24 -05:00
Leo Kettmeir
c443ac5d14
fix(ext/webgpu): normalize limits to number (#27072)
Fixes #22029
2024-11-26 10:45:18 -08:00
Divy Srivastava
93bbbe4184
fix(ext/fetch): don't throw when bodyUsed inspect after upgrade (#27088)
Fixes https://github.com/denoland/deno/issues/27083
2024-11-26 21:38:46 +05:30
David Sherret
4c567677bf
chore(node/tests): increase tolerance of timers test on CI (#27077)
Increases the tolerance of the interval test on the CI.
2024-11-26 09:19:13 -05:00
Yoshiya Hinosawa
4f776a7d49
chore: update node_compat setup script, show remaining percentage (#27053) 2024-11-26 22:51:57 +09:00
Nayeem Rahman
114fe9bf3e
fix(lsp): support task object notation for tasks request (#27076) 2024-11-26 05:57:51 +00:00
Bartek Iwańczuk
d4fe3311a6
fix(task): handle multiline descriptions properly (#27069)
Closes https://github.com/denoland/deno/issues/27049
2024-11-25 22:02:39 -05:00
David Sherret
2b26444584
fix(check): support jsdoc @import tag (#26991)
* https://github.com/denoland/deno_graph/pull/544

Closes https://github.com/denoland/deno/issues/25516
2024-11-25 18:57:05 -05:00
David Sherret
02b480b171
fix(compile): do not error embedding same symlink via multiple methods (#27015)
Closes https://github.com/denoland/deno/issues/27012
2024-11-25 17:08:06 -05:00
Espen Hovlandsdal
7456255cd1
Merge commit from fork
* fix: drop auth headers, cookies on redirect to different origin

* refactor: destructure StringPrototypeEndsWith

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-25 19:07:00 +01:00
ctrl+d
38b618ce35
fix(runtime/ops): Fix watchfs remove event (#27041)
Fix related to #26906. 
Currently, if a file is removed, no event is emitted because the file
path no longer exists. As a result, [this
check](12b377247b/runtime/ops/fs_events.rs (L149))
returns false.

With this PR, an additional check is introduced to verify if the file
exists. If the file does not exist, a custom "remove" event is emitted.
This change is necessary because, based on tests conducted on macOS and
Linux (Ubuntu 24.04.1 LTS), Linux emits a "rename" event instead of a
"remove" event when a file is deleted. Introducing a dedicated "remove"
event ensures consistent and clearer behavior across platforms.
2024-11-25 21:08:52 +05:30
snek
d59bd5e8c9
feat(unstable): Instrument fetch (#27057)
Add basic tracing to `fetch`. Also fix span kinds so that we can
differentiate fetch and serve.
2024-11-25 16:38:07 +01:00
David Sherret
4365f8d999
fix(compile): handle TypeScript file included as asset (#27032)
Closes #27024
2024-11-25 09:37:48 -05:00
Yoshiya Hinosawa
d04d5677d9
chore: update node_compat setup script (#27051)
This PR updates the node_compat setup script. Now the copied version in
each test file is corrected. Also `TODO.md` links to the correct files
in Node.js repo.
2024-11-25 22:35:53 +09:00
snek
8ea95c34b5
feat: Instrument Deno.serve (#26964)
Add basic trace to Deno.serve. Also updates a bit of the testing infra
to make it easier to deal with.
2024-11-25 10:45:06 +01:00
Trevor Manz
6b7e4c331b
fix(ext/node): add fs.promises.fstat and FileHandle#stat (#26719)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-11-25 15:02:38 +09:00
David Sherret
9967e75e7e
chore: update to file_test_runner 0.7.3 (#27016) 2024-11-22 23:30:59 +00:00
João Baptista
9eee2a0e9e
fix(fmt): return None if sql fmt result is the same (#27014)
Similar with https://github.com/denoland/deno/pull/25848, we need to
make `format_sql` to return `None` so we do not flag well formatted sql
files as being wrong.

Signed-off-by: m4rc3l05 <15786310+M4RC3L05@users.noreply.github.com>
2024-11-22 22:57:33 +00:00
Marvin Hagemeister
50538ba35d
fix(node/fs): missing uv error context for readFile (#27011)
Dart's Node wrapper code in `npm:sass` does string slicing on the thrown
error message which broke because of our missing uv error context.

Code in question:

```js
_systemErrorToFileSystemException0(callback) {
  var error, t1, exception, t2;
  try {
    t1 = callback.call$0();
    return t1;
  } catch (exception) {
    error = A.unwrapException(exception);
    if (!type$.JsSystemError._is(error))
      throw exception;
    t1 = error;
    t2 = J.getInterceptor$x(t1);
    throw A.wrapException(new A.FileSystemException0(J.substring$2$s(t2.get$message(t1), (A.S(t2.get$code(t1)) + ": ").length, J.get$length$asx(t2.get$message(t1)) - (", " + A.S(t2.get$syscall(t1)) + " '" + A.S(t2.get$path(t1)) + "'").length), J.get$path$x(error)));
  }
}
```

Fixes https://github.com/denoland/deno/issues/26994
2024-11-22 22:42:27 +01:00
David Sherret
4ded7519e9
fix(compile): correct buffered reading of assets and files (#27008)
Closes #27006
2024-11-22 19:26:38 +00:00
David Sherret
9c0e6369b2
chore(check): add test for Wasm memory and table (#26996) 2024-11-22 10:59:19 -05:00
Bartek Iwańczuk
5ca47ee97a
fix: support non-function exports in Wasm modules (#26992)
Closes https://github.com/denoland/deno/issues/26986
2024-11-22 00:46:23 +00:00
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
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
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
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
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
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
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