Commit graph

403 commits

Author SHA1 Message Date
Asher Gomez 0f7f987951
feat(unstable): Deno.FsFile.lock[Sync]() and Deno.FsFile.unlock[Sync]() (#22235)
Closes #22178.
2024-02-05 00:11:54 +01:00
Dan Rose 6c6e49629c
chore: fix typo in docs (#22232)
Signed-off-by: Dan Rose <danoftheroses@gmail.com>
2024-02-02 21:50:58 +01:00
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
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
Divy Srivastava cc0a372127
feat(unstable): implement navigator.gpu.getPreferredCanvasFormat() (#22149) 2024-01-27 23:10:09 +05:30
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
Asher Gomez 300eeb343e
feat: deprecate Deno.{stdin,stdout,stderr}.rid (#22073)
For removal in Deno v2. There are two issues:
1. Any script being run causes the output of `warnOnDeprecatedApi()` to
be printed, even when none of the `rid` properties are called.
2. `.rid` of these classes is used in multiple tests. I'm not sure how
to account for that. I thought of having `STDIN_RID`, and friends,
constants, whose values can be shared between the tests and the classes
themselves. Should we go with that or do something else?

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-24 20:09:49 +01:00
Asher Gomez 547468e625
feat: deprecate Deno.FsWatcher.rid (#22074)
For removal in Deno v2. I've also updated the deprecation of
`Deno.FsWatcher.return()`, which, to be clear, I'm not in favour of
deprecating. I mention this in #15499. Either way, it's safe to merge
this PR, then decide against the deprecation.
2024-01-24 18:57:28 +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
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
Bartek Iwańczuk 064a6c048a
feat: Add warnings for more deprecated APIs (#21992)
Follow up to https://github.com/denoland/deno/pull/21939 that adds
deprecation warnings to more `Deno` APIs:

- `Deno.copy()`
- `Deno.iter()`
- `Deno.iterSync()`
- `new Deno.Buffer()`
- `Deno.readAll()`
- `Deno.readAllSync()`
- `Deno.writeAll()`
- `Deno.writeAllSync()`
- `Deno.FsWatcher.return`
- `Deno.serveHttp()`
- `Deno.metrics()`

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-01-24 14:57:54 +01:00
Asher Gomez aac0ad32bd
feat: deprecate Deno.FsFile constructor and Deno.FsFile.rid (#22072) 2024-01-24 13:36:35 +01:00
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 ea48bee3f7
feat: deprecate Deno.seek() and Deno.seekSync() (#22065)
For removal in Deno v2.
2024-01-24 09:39:56 +05:30
Asher Gomez 4c5ce90883
chore: update Deno.{fsync,fsyncSync}() deprecation notices (#22071)
To align with other deprecations.
2024-01-24 09:38:59 +05:30
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
Bartek Iwańczuk 60688c563e
feat: import.meta.filename and import.meta.dirname (#22061)
This commit adds `import.meta.filename` and `import.meta.dirname` APIs.

These APIs return string representation of filename and containing
dirname.
They are only defined for local modules (modules that have `file:///`
scheme).

Example:

```ts
console.log(import.meta.filename, import.meta.dirname)
```

Unix:
```
$ deno run /dev/my_module.ts
/dev/my_module.ts /dev/
```

Windows:
```
$ deno run C:\dev\my_module.ts
C:\dev\my_module.ts C:\
```
2024-01-23 23:51:07 +01:00
Bartek Iwańczuk 13d5c6420e
chore: upgrade deno_core to 0.249.0 (#22058) 2024-01-23 22:56:56 +01:00
Asher Gomez 5aa25f08be
feat: Add deprecation warning for Deno.customInspect (#22027)
This change sets the removal version of `Deno.customInspect` for Deno
v2.

Towards #22021

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-23 21:46:59 +00:00
Asher Gomez d6d437c4dc
BREAKING(unstable): remove Deno.cron() overload (#22035)
This change removes the currently deprecated `Deno.cron()` overload with
`options` as a potential last argument.

This might be fine to do now, in a major release, as `Deno.cron()` is an
unstable API. I thought of doing this while working on #22021. If this
is not ready to remove, I can instead set the removal version of this
overload for Deno v2.

Note: this overload was deprecated in Deno v1.38.2 (#21225). So it's
been deprecated for over 2 months.
2024-01-23 17:37:54 +05:30
Bartek Iwańczuk 01b6e38baf
feat: Stabilize Deno.listen for 'unix' transport (#21938) 2024-01-23 17:32:25 +05:30
Asher Gomez 7e4145df25
refactor: set removal version for Deno.RequestEvent, Deno.HttpConn and Deno.serveHttp() (#22034)
This change:
1. Sets the removal version for `Deno.RequestEvent`, `Deno.HttpConn` and
`Deno.serveHttp()` for Deno v2. I thought it might be worth calling
`warnOnDeprecatedApi()` within `Deno.Request` and `Deno.HttpConn`
methods, but I thought just having it called within `Deno.serveHttp()`
might be sufficient.
2. Removes some possibly unneeded related benchmarks.

Towards #22021
2024-01-23 03:24:03 +00:00
Asher Gomez 6059731594
refactor: set removal version for Deno.Server (#22024)
This change sets the removal version for the deprecated `Deno.Server`
interface for Deno 2.0.

Towards #22021
2024-01-23 02:19:49 +01:00
Bartek Iwańczuk 71551c80a1
feat(unstable): remove Deno.upgradeHttp API (#21856)
Closes https://github.com/denoland/deno/issues/21828.

This API is a huge footgun. And given that "Deno.serveHttp" is a
deprecated API that is discouraged to use (use "Deno.serve()" 
instead); it makes no sense to keep this API around.

This is a step towards fully migrating to Hyper 1.
2024-01-22 21:35:39 +00:00
Leo Kettmeir 8f76762793
feat(web): ImageBitmap (#21898) 2024-01-22 12:08:01 +01:00
Asher Gomez 983c745d4f
chore: use FsFile[Symbol.dispose]() (#22007)
This change takes advantage of explicit resources management for
`FsFile` instances and tweaks documentation to encourage the use of it.

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-01-22 00:20:59 +01:00
Asher Gomez 35fc6f3ab9
chore: use Deno.readTextFile() where appropriate (#22018) 2024-01-21 23:41:28 +01:00
Asher Gomez e58462dbb9
chore: use Deno.writeTextFile() where appropriate (#22008) 2024-01-21 21:58:24 +01:00
Divy Srivastava 1b9f0cb452
chore: add types for Deno.UnsafeWindowSurface (#22010) 2024-01-21 21:51:45 +01:00
Jérôme Benoit 99f9fa5556
fix(types): align global deno worker type with deno.worker/webworker one (#21936)
Transpiler doing type checking such as the ones used in dnt or bundler
fail because of incompatible Worker types if env like browser are
targeted.

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
2024-01-18 22:42:04 +00:00
king8fisher 7d29eb0f63
docs(ns): add a notice on file order returned by readDir (#21953) 2024-01-16 13:57:06 +09:00
Bartek Iwańczuk 5143b9e7d3
feat(unstable): add Temporal API support (#21738)
This commit adds support for [Stage 3 Temporal API
proposal](https://tc39.es/proposal-temporal/docs/).

The API is available when `--unstable-temporal` flag is passed.

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
Co-authored-by: Kenta Moriuchi <moriken@kimamass.com>
2024-01-15 01:26:57 +01:00
Asher Gomez f46c03d6b4
chore: define removal version for Deno.metrics() (#21872)
Sets the removal version for `Deno.metrics()` to be v2.
2024-01-15 00:50:08 +01:00
Bartek Iwańczuk fc17ddbcc4
feat: Stabilize Deno.connect for 'unix' transport (#21937) 2024-01-14 21:50:58 +00:00
Asher Gomez 658b559657
chore: define removal version for Deno.run() (#21863)
This change sets the removal for `Deno.run()` in v2.
2024-01-14 22:25:23 +01:00
Bartek Iwańczuk a25055356c
feat: Deprecate 'Deno.serveHttp' API (#21874)
`Deno.serveHttp` is now deprecated. 

Users should migrate to `Deno.serve` API.
2024-01-14 22:17:50 +01:00
Bartek Iwańczuk 0d51c1f90e
feat: remove conditional unstable type-checking (#21825)
This commit removes conditional type-checking of unstable APIs.

Before this commit `deno check` (or any other type-checking command and
the LSP) would error out if there was an unstable API in the code, but not
`--unstable` flag provided.

This situation hinders DX and makes it harder to configure Deno. Failing
during runtime unless `--unstable` flag is provided is enough in this case.
2024-01-14 18:29:17 +01:00
Bartek Iwańczuk f3bb0a1a0e
feat: stabilize Deno.connectTls options and Deno.TlsConn.handshake (#21889) 2024-01-14 17:06:26 +00:00
Bartek Iwańczuk 7471587d29
feat: "rejectionhandled" Web event and "rejectionHandled" Node event (#21875)
This commit adds support for "rejectionhandled" Web Event and
"rejectionHandled" Node event.

```js
import process from "node:process";

process.on("rejectionHandled", (promise) => {
  console.log("rejectionHandled", reason, promise);
});

window.addEventListener("rejectionhandled", (event) => {
  console.log("rejectionhandled", event.reason, event.promise);
});
```

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-01-12 22:10:42 +00:00
David Sherret 70ac06138c
feat(unstable): fast subset type checking of JSR dependencies (#21873) 2024-01-10 22:40:30 +00:00
Nayeem Rahman 0234eb23dd
fix(lsp): implement host.getGlobalTypingsCacheLocation() (#21882) 2024-01-10 13:16:30 +00:00
cions 881a62869d
fix: android support (#19437)
<!--
Before submitting a PR, please read https://deno.com/manual/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-01-10 06:04:14 -07:00
Nayeem Rahman ee45d5bf8f
perf(lsp): use host-owned cache for auto-import completions (#21852) 2024-01-08 17:05:05 +00:00