0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-20 12:22:52 -05:00
Commit graph

1549 commits

Author SHA1 Message Date
Leo Kettmeir
7253820764
refactor: object wrap WebGPU (#27665)
Fixes #25874
Fixes #26760
Fixes #24288
Fixes #24798
Fixes #25627
Fixes #25915
Fixes #26769
2025-02-12 13:45:41 +00:00
David Sherret
7a112643f5
refactor(lsp): remove Send + Sync requirement (#28035) 2025-02-12 13:37:47 +00:00
Bartek Iwańczuk
d29f9f99dd
fix(lint): Deno.lint.runPlugin throws in deno run (#28063)
This commit changes `Deno.lint.runPlugin` to throw
in non-`deno test` subcommand, instead of returning
`undefined`.
2025-02-12 09:18:55 +00:00
Leo Kettmeir
c1a0d63753
fix(streams): handle Resource stream error (#27975)
Fixes #27715
2025-02-11 09:27:52 -08:00
Bartek Iwańczuk
23540c2825
refactor: remove tsc snapshot (#28056)
This reverts commit acdc7dcdcf
and relands 174e496847.

Closes https://github.com/denoland/deno/issues/28047
Closes https://github.com/denoland/deno/issues/28044
2025-02-11 15:36:07 +01:00
Marvin Hagemeister
aead459fb2
feat(unstable): support multiple fixes from lint plugins (#28040)
This PR supports returning multiple changes from a lint fix. It works
the same way as eslint, see
https://eslint.org/docs/latest/extend/custom-rules#applying-fixes .

- Return a single fix
- Return an array of fixes
- Return a generator function with fixes
2025-02-11 15:24:28 +01:00
Divy Srivastava
196ceb76bb
fix(ext/node): DatabaseSync#exec should execute batch statements (#28053)
Fixes https://github.com/denoland/deno/issues/28050
2025-02-11 19:52:33 +05:30
Bartek Iwańczuk
acdc7dcdcf
Revert "refactor: remove tsc snapshot (#27987)" (#28052)
This reverts commit 174e496847.

That commit caused panic on startup like
https://github.com/denoland/deno/issues/28047
or https://github.com/denoland/deno/issues/28044.

Reverting for now, until we figure out what's going wrong.
2025-02-11 11:18:32 +00:00
Yoshiya Hinosawa
0945634127
test: clean up node_compat test runner (#28028) 2025-02-11 14:00:38 +09:00
Nathan Whitaker
174e496847
refactor: remove tsc snapshot (#27987)
Removes the TSC snapshot to unblock the V8 upgrade (which enables shared
RO heap, and is incompatible with multiple snapshots).


this compresses the sources and declaration files as well, which leads
to a roughly 4.2MB reduction in binary size.

this currently adds about 80ms to deno check times, but code cache isn't
wired up for the extension code (namely `00_typescript.js`) yet

```
❯ hyperfine --warmup 5 -p "rm -rf ~/Library/Caches/deno/check_cache_v2" "../../deno/target/release-lite/deno check main.ts" "deno check main.ts"
Benchmark 1: ../../deno/target/release-lite/deno check main.ts
  Time (mean ± σ):     184.2 ms ±   2.2 ms    [User: 378.3 ms, System: 48.2 ms]
  Range (min … max):   181.5 ms … 189.9 ms    15 runs

Benchmark 2: deno check main.ts
  Time (mean ± σ):     107.4 ms ±   1.2 ms    [User: 155.3 ms, System: 23.9 ms]
  Range (min … max):   105.3 ms … 109.6 ms    26 runs

Summary
  deno check main.ts ran
    1.72 ± 0.03 times faster than ../../deno/target/release-lite/deno check main.ts
```

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-02-10 16:39:18 +00:00
Bartek Iwańczuk
7bd210f9e8
fix(lint): don't show docs URLs for plugins (#28033)
This commit removes the docs URL for diagnostics coming
from JS plugins. Before, we mistakenly printed
URLs pointing to `docs.deno.com`, even though they did not
exist.

An ability to actually specify a custom URL for plugin rules,
will be added in a follow up PR.
2025-02-10 17:32:31 +01:00
Nayeem Rahman
f630057243
ci(lsp): timeout tests after 5 minutes (#28036) 2025-02-10 16:15:43 +00:00
Nayeem Rahman
0ac6165390
ci(lsp): capture and echo stderr by default (#28032) 2025-02-10 14:50:16 +00:00
Nayeem Rahman
7d139ddd60
perf(lsp): cancellation checks in blocking code (#27997) 2025-02-10 11:52:31 +01:00
HasanAlrimawi
a0c5ef8ba8
fix(compile): never include the specified output executable in itself (#27877) 2025-02-06 23:23:10 +00:00
Marvin Hagemeister
dd1ee5821b
feat(unstable): align lint ast with TSEStree (#27996)
This PR fixes deviations in our AST format compared to TSEStree. They
are mostly a leftover for when I first started working on it and based
it off of babel instead.

One of the key changes why the changeset is a bit bigger is that
TSEStree uses `undefined` instead of `null` as the empty value for type
nodes. This is likely influenced by `tsc` which use `undefined`
everywhere. The rest of the nodes use `null` though. It's a little
weird, but for now it might be better to align.

(extracted from https://github.com/denoland/deno/pull/27977)
2025-02-06 21:45:56 +01:00
Bartek Iwańczuk
15cfa05fa6
test: remove one of 'node_unit_tests::tls_test' tests (#27985)
It will be moved to `npm_smoke_tests` repo instead
2025-02-06 17:13:07 +01:00
Marvin Hagemeister
9213215d6d
feat(unstable): add test for lint plugin destroy hook (#27981)
Noticed that we didn't test the `destroy()` hook of lint plugins. This
PR adds a test for that.
2025-02-06 14:04:04 +01:00
Divy Srivastava
4a2b8fc22d
fix(ext/node): expose sqlite changeset constants (#27992)
https://nodejs.org/api/sqlite.html#sqliteconstants
2025-02-06 13:08:40 +05:30
Divy Srivastava
a401a79c75
fix(ext/node): fix missing privateKey.x in curve25519 JWK (#27990)
Fixes https://github.com/denoland/deno/issues/27972
2025-02-06 12:11:42 +05:30
Divy Srivastava
28faaee772
fix(ext/node): throw Session methods when database is closed (#27968) 2025-02-06 08:52:49 +05:30
Divy Srivastava
ece384c094
fix(ext/node): implement DatabaseSync#applyChangeset() (#27967)
https://nodejs.org/api/sqlite.html#databaseapplychangesetchangeset-options

```js
const sourceDb = new DatabaseSync(':memory:');
const targetDb = new DatabaseSync(':memory:');

sourceDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');
targetDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)');

const session = sourceDb.createSession();

const insert = sourceDb.prepare('INSERT INTO data (key, value) VALUES (?, ?)');
insert.run(1, 'hello');
insert.run(2, 'world');

const changeset = session.changeset();
targetDb.applyChangeset(changeset);
// Now that the changeset has been applied, targetDb contains the same data as sourceDb. 
```
2025-02-06 08:52:39 +05:30
Nayeem Rahman
bc8554878e
fix(check): support sloppy imports with "compilerOptions.rootDirs" (#27973) 2025-02-05 23:08:10 +00:00
Bartek Iwańczuk
f08ca6414b
feat(lint): add JavaScript plugin support (#27203)
This commit adds an unstable lint plugin API.

Plugins are specified in the `deno.json` file under
`lint.plugins` option like so:

```
{
  "lint": {
    "plugins": [
      "./plugins/my-plugin.ts",
      "jsr:@deno/lint-plugin1",
      "npm:@deno/lint-plugin2"
    ]
  }
}
```

The API is considered unstable and might be subject
to changes in the future.

Plugin API was modelled after ESLint API for the 
most part, but there are no guarantees for compatibility.
The AST format exposed to plugins is closely modelled
after the AST that `typescript-eslint` uses.

Lint plugins use the visitor pattern and can add
diagnostics like so:

```
export default {
  name: "lint-plugin",
  rules: {
    "plugin-rule": {
      create(context) {
        return {
          Identifier(node) {
            if (node.name === "a") {
              context.report({
                node,
                message: "should be b",
                fix(fixer) {
                  return fixer.replaceText(node, "_b");
                },
              });
            }
          },
        };
      },
    },
  },
} satisfies Deno.lint.Plugin;
```

Besides reporting errors (diagnostics) plugins can provide
automatic fixes that use text replacement to apply changes.

---------

Co-authored-by: Marvin Hagemeister <marvin@deno.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2025-02-05 16:59:24 +01:00
HasanAlrimawi
8a07d38a53
chore: move bench test to spec test (#27970) 2025-02-05 10:49:10 -05:00
Hajime-san
1eb4142143
feat(ext/canvas): enhance createImageBitmap specification compliance (#25517) 2025-02-05 04:10:11 -08:00
Divy Srivastava
28834a89bb
fix(ext/node): implement SQLite Session API (#27909)
https://nodejs.org/api/sqlite.html#class-session

---------

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2025-02-04 21:59:13 +05:30
snek
98339cf327
fix(ext/napi): napi_is_buffer tests for ArrayBufferView (#27956)
use correct type check

Fixes: https://github.com/denoland/deno/issues/27951
2025-02-04 14:30:40 +00:00
Divy Srivastava
c2832d70a1
fix(ext/sqlite): add sourceSQL and expandedSQL getters (#27921) 2025-02-04 17:38:41 +05:30
Divy Srivastava
441b1d307f
fix(ext/node): handle non-ws upgrade headers (#27931) 2025-02-04 17:35:48 +05:30
Divy Srivastava
f28bbcced5
fix(ext/node): expose brotli stream APIs (#27943)
Fixes https://github.com/denoland/deno/issues/27170
2025-02-04 07:47:02 +05:30
Nathan Whitaker
108b6a8bfb
fix(lsp): ignore a few more diagnostics for ambient modules (#27949)
Missed a few resolution errors
2025-02-03 16:13:14 -08:00
David Sherret
e46860a2fd
feat(compile): support sloppy imports (#27944)
Closes https://github.com/denoland/deno/issues/26102
2025-02-03 13:08:08 -05:00
Alvaro Parker
41fa8df197
feat(bench): add --permit-no-files (#27048)
This PR adds the `--permit-no-files` cli options to the `bench`
subcommand. This will cause `deno bench --permit-no-files` to not return
an error when no bench files where found.
2025-02-03 16:18:09 +00:00
Divy Srivastava
b5c3f4f782
fix(ext/node): support read-only database in node:sqlite (#27930)
Implements the `readOnly` option for `DatabaseSync`.

Permissions:
`--allow-read=test.db --allow-write=test.db` => all works
`--allow-read=test.db` => only `readOnly` dbs work, cannot create new db
2025-02-03 16:41:45 +05:30
Divy Srivastava
3c56e6c7cd
fix(ext/node): enforce -RW perms on node:sqlite (#27928)
require RW permission on the database path except when using in-memory
mode.
2025-02-02 15:49:39 +05:30
Rano | Ranadeep
540fe7d9e4
fix(node): resolve module as maybe CJS when it's missing a file extension (#27904) 2025-02-01 13:12:17 -05:00
David Sherret
9cbcb84295
fix(node): show directory import and missing extension suggestions (#27905)
Shows directory import and missing extension suggestions in error
messages similar but not exactly to node.

Closes #26802

Co-authored-by: Hajime-san <Hajime-san@users.noreply.github.com>
2025-02-01 13:07:23 -05:00
Divy Srivastava
7d19668255
fix(ext/node): throw RangeError when sqlite INTEGER is too large (#27907)
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2025-02-01 13:19:53 +05:30
David Sherret
8971064546
feat: TypeScript 5.7 (#27857)
Co-authored-by: Kenta Moriuchi <moriken@kimamass.com>
2025-01-31 16:07:42 -05:00
David Sherret
d5c105b30e
chore: fix some broken pty tests on windows (#27899)
These have been failing locally for some time.
2025-01-31 12:08:29 -05:00
Yoshiya Hinosawa
7643bb71a6
chore: update std in test util (#27892) 2025-01-31 08:52:32 -05:00
Divy Srivastava
1cbaee9f52
fix(ext/node): sqlite bind support bigint values (#27890) 2025-01-31 18:31:05 +05:30
Yoshiya Hinosawa
1cecc0a8b0
fix(ext/node): support proxy http request (#27871) 2025-01-31 21:46:54 +09:00
Divy Srivastava
057f257052
fix(ext/node): represent sqlite blob as Uint8Array (#27889) 2025-01-31 17:53:48 +05:30
Divy Srivastava
08cc22105f
fix(ext/node): set process.env as own property (#27891)
Fixes `gcp-metadata@6.1.1`

```
% deno eval "import 'npm:gcp-metadata@6.1.1'" # main
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'GOOGLE_SDK_NODE_LOGGING')
    at Object.log (file:///Users/divy/Library/Caches/deno/npm/registry.npmjs.org/google-logging-utils/0.0.2/build/src/logging-utils.js:356:36)
    at Object.<anonymous> (file:///Users/divy/Library/Caches/deno/npm/registry.npmjs.org/gcp-metadata/6.1.1/build/src/index.js:52:20)
    at Object.<anonymous> (file:///Users/divy/Library/Caches/deno/npm/registry.npmjs.org/gcp-metadata/6.1.1/build/src/index.js:409:4)
    at Module._compile (node:module:745:34)
    at loadMaybeCjs (node:module:770:10)
    at Object.Module._extensions..js (node:module:755:12)
    at Module.load (node:module:662:32)
    at Function.Module._load (node:module:534:12)
    at Module.require (node:module:681:19)
    at require (node:module:812:16)

% target/debug/deno eval "import 'npm:gcp-metadata@6.1.1'" # this PR
```

---------

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2025-01-31 11:38:26 +05:30
Marvin Hagemeister
c44b05cab5
feat(task): add support for task wildcards (#27007)
This PR adds support for passing wildcard tasks. All matched tasks are
sorted in case they have dependencies. Tasks already in the dependency
tree will be pruned so that every task only runs once.

```json
{
  "tasks": {
    "foo-1": "echo 'foo-1'",
    "foo-2": "echo 'foo-2'"
  }
}
```

```sh
$ deno task "foo-*"
Task foo-1 echo 'foo-1'
foo-1
Task foo-2 echo 'foo-2'
foo-2
```

The changes in the PR look a little bigger than they really are due to
formatting. For the most part, I've only needed to hoist up the task
matching logic.

Closes https://github.com/denoland/deno/issues/26944
Closes https://github.com/denoland/deno/issues/21530

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-01-30 14:37:10 +01:00
Nathan Whitaker
b7456fed70
fix(lsp): ignore errors on ambient module imports (#27855)
This makes it so imports of ambient modules (e.g. `$app/environment` in
svelte, any virtual module in vite, or other module provided by a
bundler) don't error in the LSP.

The way this works is that when we request diagnostics from TSC, we also
respond with the list of ambient modules. Then, in the diagnostics code,
we save diagnostics (produced by deno) that may be invalidated as an
ambient module and wait to publish the diagnostics until we've received
the ambient modules from TSC.

The actual ambient modules you get from TSC can contain globs, e.g.
`*.css`. So when we get new ambient modules, we compile them all into a
regex and check erroring imports against that regex. Ambient modules
should change rarely, so in most cases we should be using a pre-compiled
regex, which executes in linear time (wrt the specifier length).

TODO:
- Ideally we should only publish once, right now we publish with the
filtered specifiers and then the TSC ones
- deno check (#27633)
2025-01-30 00:25:32 +00:00
Nayeem Rahman
0dd334b512
feat(check/lsp): support "compilerOptions.rootDirs" (#27844) 2025-01-30 00:20:25 +00:00
Divy Srivastava
79fa6028d1
fix(ext/node): implement crypto.hash (#27858)
Implement
[`crypto.hash`](https://nodejs.org/api/crypto.html#cryptohashalgorithm-data-outputencoding)
- one-shot version of `createHash`

Fixes #24945
2025-01-29 20:49:43 +05:30