0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-15 10:06:23 -05:00
Commit graph

13141 commits

Author SHA1 Message Date
Nayeem Rahman
7d139ddd60
perf(lsp): cancellation checks in blocking code (#27997) 2025-02-10 11:52:31 +01:00
David Sherret
e94581d272
fix(lint): clear plugin diagnostics on each lint file run (#28011)
This clears the diagnostics whenever a file is about to run. For
example, what could previously occur is an error and the diagnostics
would be leftover from the previous run.
2025-02-07 17:47:28 +00:00
Marvin Hagemeister
615bf8a4b0
feat(unstable): type lint plugin visitor (#28005)
This PR strongly types the JS plugin visitor.

```ts
export default {
  name: "foo",
  rules: {
    bar: {
      create(ctx) {
        return {
          // Plain ast node visitor
          Identifier(node) {},

          // Exit visitor
          "Identifier:exit"(node) {},

          // Custom selectors, `node` needs to be typed manually
          "FunctionDeclaration > Identifier"(node: Deno.lint.Identifier) {}
        }
      }
    }
  }
}

```

Follow up to https://github.com/denoland/deno/pull/27977
2025-02-07 13:01:33 +01:00
Marvin Hagemeister
703fdd8607
fix: panic with js lint plugins and invalid js syntax (#28006)
Noticed that the LSP might panic during serialization when working on a
file with a syntax error.

This PR changes the serialization so that invalid nodes are simply
serialized to the invalid node `0`. The plugin code treats the node with
id `0` as an invalid node and will ignore it during visiting.

I'm not sure how to write a test for the LSP.
2025-02-07 12:35:44 +01:00
David Sherret
a82326d029
perf(compile): use bytes already in memory after downloading executable (#28000)
Not sure if this will help https://github.com/denoland/deno/issues/27988
but it's better anyway.
2025-02-06 23:24:06 -05: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
Marvin Hagemeister
89b1969f02
feat(unstable): add lint plugin ast types (#27977)
Add type definition for all TSEstree AST nodes in the JS lint plugin
system
2025-02-06 21:45:45 +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
Luca Casonato
6619210509
fix(otel): custom span start + end times are fractional ms (#27995)
Previously they were treated as fractional seconds.
2025-02-06 14:53:43 +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
Marvin Hagemeister
df02af27fd
feat(unstable): add lint.plugins to config schema (#27982)
Not sure what our handling of unstable properties in `deno.json` is.
This PR adds it to the config schema.

---------

Signed-off-by: Marvin Hagemeister <marvinhagemeister50@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-02-06 08:00:23 +00: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
Yoshiya Hinosawa
78fceb4a33
fix(ext/node): fix twitter-api-v2 compatibility (#27971) 2025-02-06 16:35:55 +09:00
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
David Sherret
408d581fc1
chore: fix lockfile on main (#27978)
Every time I run `cargo test` or whatever the lockfile changes to this.
2025-02-05 19:03:45 +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
Nathan Whitaker
b440d2d4f7
feat(outdated): interactive update (#27812)
interactively select which packages to upgrade. a future improvement
could be to add a way to select the version as well, though not sure how
valuable that would be.
2025-02-04 15:41:56 -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
Yoshiya Hinosawa
4405f47a4f
refactor(ext/fetch): do not share error instance (#27941) 2025-02-04 13:38:07 +09:00
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
David Sherret
61faa32920
perf: node resolution cache (#27838)
This adds a cache for node resolution, which makes repeat lookups about
15x faster.
2025-02-03 20:25:10 -05:00
David Sherret
073caf5fe9
refactor: extract out utf16 map from lsp to cli::util module (#27950) 2025-02-03 20:24:26 -05:00
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
7107c358a1
fix(ext/node): set process fields on own instance (#27927)
Ref https://github.com/denoland/deno/pull/27891#issuecomment-2626286689

```
% deno eval 'console.log(Object.getOwnPropertyNames(process))'
[
  "_events",
  "_eventsCount",
  "_maxListeners",
  "versions",
  "stdin",
  "stdout",
  "stderr"
]

% target/debug/deno eval 'console.log(Object.getOwnPropertyNames(process))'
[
  "_events",
  "_eventsCount",
  "_maxListeners",
  "release",
  "arch",
  "report",
  "title",
  "argv",
  "argv0",
  "chdir",
  "config",
  "cpuUsage",
  "cwd",
  "env",
  "execArgv",
  "exit",
  "abort",
  "reallyExit",
  "_exiting",
  "exitCode",
  "mainModule",
  "nextTick",
  "dlopen",
  "pid",
  "ppid",
  "platform",
  "setSourceMapsEnabled",
  "hrtime",
  "_kill",
  "kill",
  "memoryUsage",
  "stderr",
  "stdin",
  "stdout",
  "version",
  "versions",
  "emitWarning",
  "binding",
  "umask",
  "getgid",
  "getuid",
  "getegid",
  "geteuid",
  "getBuiltinModule",
  "_eval",
  "execPath",
  "uptime",
  "allowedNodeEnvironmentFlags",
  "features",
  "noDeprecation"
]
```
2025-02-03 16:39:04 +05:30
Bartek Iwańczuk
8bdcbec5d7
fix(publish): correct coloring in --help (#27939) 2025-02-03 01:41:09 +00:00
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
Nayeem Rahman
9da6a20e57
Revert "fix(lsp): silence debug error for 'move to a new file' action (#27780)" (#27903) 2025-02-01 02:53:24 +00:00
David Sherret
8971064546
feat: TypeScript 5.7 (#27857)
Co-authored-by: Kenta Moriuchi <moriken@kimamass.com>
2025-01-31 16:07:42 -05:00
Timothy
8d824182be
docs: Temporal plaintime docs link (#27879) 2025-01-31 12:23:38 -08:00
Bartek Iwańczuk
1ef341c397
ci: update release template (#27901) 2025-01-31 14:02:24 -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
Divy Srivastava
b8a878cfc2
fix(cli): Fix panic in load_native_certs (#27863)
Fixes https://github.com/denoland/deno/issues/27528

Can't really trigger the panic myself hence no test.
2025-01-31 18:29:37 +05:30
Yoshiya Hinosawa
1cecc0a8b0
fix(ext/node): support proxy http request (#27871) 2025-01-31 21:46:54 +09:00