Commit graph

2927 commits

Author SHA1 Message Date
Asher Gomez 3f4639c330
docs: point to new "Deno 1.x to 2.x Migration Guide" (#22199)
Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-02-02 02:32:46 +01:00
Divy Srivastava 4f914dd161
fix(fs): copyFile NUL path on macOS (#22216)
Fixes https://github.com/denoland/deno/issues/22211
2024-02-01 10:06:09 +05:30
Leo Kettmeir e58b1900a7
fix(publish): add node specifiers (#22213) 2024-02-01 05:18:44 +01:00
Yusuke Tanaka 66e6ed65e9
fix(node): add ppid getter for node:process (#22167)
This commit adds `ppid` getter for `node:process` to improve Node
compatibility one step further.

There is one problem though, which is that `Deno.ppid`, which
`process.ppid` internally calls, is actually of type `bigint` although
it's supposed to be `number`. I filed an issue for this (#22166). For
the time being, explciit type conversion from `bigint` to `number` is
applied to match the Node.js behavior.
2024-02-01 09:18:27 +05:30
Asher Gomez 6512be458f
fix(ext/node): add aes256 algorithm support (#22198)
Towards #21804
2024-02-01 09:13:24 +05:30
Divy Srivastava 02c65fad45
fix(node): util.callbackify (#22200)
Fixes https://github.com/denoland/deno/issues/22180

Matches the Node.js implementation more closely. Removed types, they do
not help just make it harder to debug with stack traces.
2024-02-01 08:51:10 +05:30
David Sherret 4b7c6049ef
refactor: load bytes in deno_graph (#22212)
Upgrades deno_graph to 0.64 where deno_graph is now responsible for
turning bytes into a string. This is in preparation for Wasm modules.
2024-02-01 03:15:22 +00:00
Bartek Iwańczuk 830d096b66
fix(publish): rename --no-fast-check to --no-zap (#22214)
Also prints an information about the flag when there are `zap` errors.
2024-02-01 02:16:52 +00:00
Bartek Iwańczuk fddbb018c1
chore: temporarily disable deprecation warnings (#22204) 2024-01-31 23:18:14 +01:00
Bartek Iwańczuk 13a91a69f8
refactor: remove imported ops from Deno.core.ops (#22194)
This commit adds a list of ops to `runtime/99_main.js` that are
currently relying on getting them from `Deno.core.ops`. All ops that are not
present in the list are removed from `Deno.core.ops` on startup (they are
imported from "virtual op module" - `ext:core/ops`) making them effectively
inaccessible to user code.

This change lowers the number of ops exposed to user code from 650 to
around 260. This number should be gradually decreased in follow-up PRs.
2024-01-31 22:39:56 +01:00
Bartek Iwańczuk 54d18f3d28
chore: disable test-fs-watchfile.js on Mac ARM (#22209)
This is super flaky on new Mac ARM runner. Disabling for now to unblock
main branch.
2024-01-31 17:01:14 +00:00
Bartek Iwańczuk 560390c93c
chore(publish): add --no-fast-check flag (#22203) 2024-01-31 16:10:31 +01:00
Nayeem Rahman d730956f49
fix(lsp): don't normalize urls in cache command params (#22182) 2024-01-30 17:17:34 +00:00
David Sherret 0e1cae32b3
fix(lockfile): only consider package.json beside lockfile in workspace property (#22179)
Closes https://github.com/denoland/deno/issues/22176 (see detail there)
2024-01-30 09:26:30 -05:00
Yusuke Tanaka ab8b1b11d7
fix(runtime): return number from op_ppid instead of bigint (#22169)
Fixes #22166
2024-01-30 15:34:31 +09:00
Nayeem Rahman aed5e4997d
chore(lsp): rename client-side command invocations (#22140) 2024-01-28 21:56:45 +00:00
Bartek Iwańczuk 7281775381
Revert "refactor(cli): use new sanitizer for resources (#22125)" (#22153) 2024-01-27 20:37:36 +01:00
Divy Srivastava cc0a372127
feat(unstable): implement navigator.gpu.getPreferredCanvasFormat() (#22149) 2024-01-27 23:10:09 +05:30
Matt Mastracci 84fb2ad71b
refactor(cli): use new sanitizer for resources (#22125)
Step 1 of the Rustification of sanitizers, which unblocks the faster
timers.

This replaces the resource sanitizer with a Rust one, using the new APIs
in deno_core.
2024-01-26 17:24:16 -05:00
Bartek Iwańczuk 9e0495baa7
fix: make deprecation warnings less verbose (#22128)
This commit makes deprecation warnings less verbose by default.

Only a single warnings is issued per deprecated API use.

`DENO_VERBOSE_WARNINGS` env var can be provided to enable more detailed
logging for each use of API including a stack trace.

https://github.com/denoland/deno/assets/13602871/9c036c84-0044-4cb6-9c8e-deb641f43712
2024-01-26 16:41:16 +01:00
Matt Mastracci c66f7b6d8d
fix(ext/http): smarter handling of Accept-Encoding (#22130) 2024-01-26 15:33:55 +00:00
Nayeem Rahman 9a5b4b0395
feat(lsp): complete parameters as tab stops and placeholders (#22126) 2024-01-26 13:41:12 +00:00
Bartek Iwańczuk 9951506506
fix(node): remove deprecation warnings (#22120)
Closes https://github.com/denoland/deno/issues/22116
2024-01-26 00:36:03 +01:00
Bartek Iwańczuk 0b0fb94ce2
fix(fs): instanceof check for Deno.FsFile (#22121)
Regression caused by https://github.com/denoland/deno/pull/22072.

I added a relevant test so we don't regress again.

Fixes https://github.com/denoland/deno/issues/22115
2024-01-25 23:51:29 +01:00
Bartek Iwańczuk 2fd26de396
fix(lsp): disable experimentalDecorators by default (#22101)
Follow up to https://github.com/denoland/deno/pull/22040.

By mistake I forgot to disable "experimental decorators" in the LSP.
2024-01-25 14:39:21 +00:00
Bartek Iwańczuk ac2da1e9ff
Revert "chore: bump rustls-tokio-stream and rustls (#21955)" (#22097)
This reverts commit 971eb0e5e8.

To unblock v1.40 release.
2024-01-25 04:47:45 +01:00
Bartek Iwańczuk 44f8b05f5b
feat: Expand 'imports' section of deno.json (#22087)
This commit adds automatic expansion of "imports" field in "deno.json"
file.

If "npm:" or "jsr:" imports are encountered we automatically try to add
a "directory" remapping.

Previously users had to specify entries for both `foo` and `foo/` to be
able to import like
`import { symbol1 } from "foo";` and `import { symbol2 } from
"foo/some_file.js"`:
```
{
  "imports": {
    "foo": "npm:@foo/bar",
    "foo/": "npm:/@foo/bar/",
}
```

With this change users can only add entry for `foo`:
```
{
  "imports": {
    "foo": "npm:@foo/bar",
}
```
The entry for `foo/` will be provided automatically.

Similarly if user provides "directory" remapping explicitly, we will not
overwrite it.
2024-01-24 23:44:06 +01:00
Bartek Iwańczuk 801ed74118
revert: Remove deprecations of file sync APIs (#22085)
- `Deno.FsFile.dataSync` -> `Deno.FsFile.syncData`
- `Deno.FsFile.dataSyncSync` -> `Deno.FsFile.syncDataSync`

Also marks these APIs as unstable
2024-01-24 23:38:18 +01:00
Luca Casonato 316093fec4
feat(publish): error on invalid external imports (#22088) 2024-01-24 21:59:18 +00:00
Luca Casonato 52ad1ef154
feat(publish): give diagnostic on invalid package files (#22082) 2024-01-24 21:24:52 +00:00
Asher Gomez fc176c4dea
feat: deprecate Deno.{Conn,TcpConn,TlsConn,UnixConn}.rid (#22077)
For removal in Deno v2.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-24 22:12:10 +01:00
Luca Casonato 176118a046
feat(publish): exclude and include (#22055) 2024-01-24 20:30:08 +00:00
Bartek Iwańczuk 8e67bf829a
Revert "feat: deprecate window global (#22057)" (#22084)
This reverts commit 930ce20870.

This is producing false-positives that are not actionable to users.
We're gonna address this in another release.
2024-01-24 20:43:31 +01:00
Asher Gomez 48c19d0bab
feat: deprecate Deno.fstat() and Deno.fstatSync() (#22068)
For removal in Deno v2.
2024-01-24 18:53:20 +01:00
Asher Gomez f5097d9d3b
feat: Deno.FsFile.{utime,utimeSync}() and deprecate Deno.{futime,futimeSync} (#22070)
For removal in Deno v2.

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-24 17:26:49 +01:00
Dean Srebnik 6b5c9764ac
chore: fix Deno.UnsafeWindowSurface typings (#22081)
- changed `Deno.UnsafeWindowSurface` typings from accepting
`Deno.UnsafePointerView` to `Deno.PointerValue`
- added width and height to `GPUCanvasConfiguration`
2024-01-24 21:17:28 +05:30
Asher Gomez a5a973e93c
feat: deprecate Deno.write() and Deno.writeSync() (#22064)
For removal in Deno v2.
2024-01-24 16:36:13 +01:00
Bartek Iwańczuk 50eaeabefb
feat: Change deprecation warning formatting (#22080)
Removes weird "frame like" characters and simplifies the output:

```
warning: Use of deprecated "Deno.isatty()" API. This API will be removed in Deno 2.

Stack trace:
  at file:///Users/ib/dev/deno/foo.js:2:8

hint: Use `stdStream.isTerminal()` instead.

warning: Use of deprecated "Deno.isatty()" API. This API will be removed in Deno 2.

Stack trace:
  at file:///Users/ib/dev/deno/foo.js:7:8

hint: Use `stdStream.isTerminal()` instead.

```

https://github.com/denoland/deno/assets/13602871/7a6e24bf-44ec-4dbf-ac96-2af1db9f2ab9
2024-01-24 16:35:47 +01:00
Asher Gomez 62786cfebb
feat: deprecate Deno.close() (#22066)
For removal in Deno v2.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-24 15:59:55 +01:00
Asher Gomez 4af121687c
feat: deprecate Deno.ftruncate() and Deno.ftruncateSync() (#22069)
For removal in Deno 2.0.
2024-01-24 15:12:22 +01:00
Luca Casonato 745333f073
chore: improve unanalyzable dynamic import diagnostic (#22051) 2024-01-24 14:49:33 +01:00
Bartek Iwańczuk 930ce20870
feat: deprecate window global (#22057)
This commit deprecates `window` global and adds deprecation
notice on each use of `window`.

We decided to proceed with removal of `window` global variable in Deno
2.0. There's a lot of code
in the wild that uses pattern like this:
```
if (typeof window !== "undefined) {
  ...
}
```
to check if the code is being run in browser. However, this check passes
fine in Deno and
most often libraries that do this check try to access some browser API
that is not available
in Deno, or use DOM APIs (which are also not available in Deno).

This situation has occurred multiple times already
and it's unfeasible to expect the whole ecosystem to migrate to new
check (and even if that
happened there's a ton of code that's already shipped and won't change).

The migration is straightfoward - replace all usages of `window` with
`globalThis` or `self`.
When Deno encounters use of `window` global it will now issue a warning,
steering users
towards required changes:

```
Warning
├ Use of deprecated "window" API.
│
├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then.
│
├ Suggestion: Use `globalThis` or `self` instead.
│
├ Suggestion: You can provide `window` in the current scope with: `const window = globalThis`.
│
└ Stack trace:
  └─ at file:///Users/ib/dev/deno/foo.js:7:1
```

Ref https://github.com/denoland/deno/issues/13367.
2024-01-24 14:20:51 +01:00
Bartek Iwańczuk b66f5ed00e
feat: TC39 decorator proposal support (#22040)
This commit adds support for [TC39 Decorator
Proposal](https://github.com/tc39/proposal-decorators).

These decorators are only available in transpiled sources - ie.
non-JavaScript files (because of lack of support in V8).

This entails that "experimental TypeScript decorators" are not available
by default
and require to be configured, with a configuration like this:
```
{
  "compilerOptions": {
    "experimentalDecorators": true
  }
}
```


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

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-01-24 18:46:23 +05:30
Asher Gomez c98ab51746
feat: deprecate Deno.read() and Deno.readSync() (#22063)
For removal in Deno v2.
2024-01-24 09:42:03 +05:30
Asher Gomez 4c0b66baab
refactor: set removal version for deno bundle (#22062)
This change sets the removal version for the `deno bundle` sub-command
for Deno v2. The warnings appear when `deno bundle` is run and in the
`--help` menu.
2024-01-24 02:36:51 +01:00
Igor Zinkovsky 46b91eceb1
fix(ext/cron): automatically override unspecified values (#22042)
Fixes #22041
2024-01-24 00:45:11 +00:00
Asher Gomez 47620641e7
feat: FsFile.sync() and FsFile.syncSync() (#22017)
This change:
1. Implements `Deno.FsFile.sync()` and `Deno.FsFile.syncSync()`.
2. Deprecates `Deno.fsync()` and `Deno.fsyncSync()` for removal in Deno
v2, in favour of the above corresponding methods.

Related #21995

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-24 01:07:06 +01:00
Asher Gomez 2f47ec6c3a
feat: Deno.FsFile.dataSync() and Deno.FsFile.dataSyncSync() (#22019)
This change:
1. Implements `Deno.FsFile.dataSync()` and `Deno.FsFile.dataSyncSync()`.
2. Deprecates `Deno.fdatasync()` and `Deno.fdatasyncSync()` for removal
in Deno v2, in favour of the above corresponding methods.
3. Replaces use of `Deno.fdatasync()` and `Deno.fdatasyncSync()` with
the above instance methods.

Related #21995
2024-01-24 00:31:52 +01:00
Asher Gomez 947ce41e99
feat: deprecate Deno.resources() (#22059)
Most uses of `Deno.resources()` within tests, as they previously checked
for leaked resources. This is not needed as the test runner does this
automatically. Other internal uses of this API have been replaced with
the internal `Deno[Deno.internal].core.resources()`.
2024-01-24 00:27:29 +01:00
Asher Gomez 4eedac3604
feat: Deno.{stdin,stdout,stderr}.isTerminal(), deprecate Deno.isatty() (#22011)
This change:
1. Implements `Deno.stdin.isTerminal()`, `Deno.stdout.isTerminal()` and
`Deno.stderr.isTerminal()`.
2. Deprecates `Deno.isatty()` for removal in Deno v2, in favour of the
above instance methods.
3. Replaces use of `Deno.isatty()` with the above instance methods.

Related #21995

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-01-24 00:01:56 +01:00