Commit graph

996 commits

Author SHA1 Message Date
Leo Kettmeir 286e5d0be9
refactor: internal runtime code TS support (#17672)
This is a proof of concept for being able to snapshot TypeScript files.

Currently only a single runtime file is authored in TypeScript -
"runtime/js/01_version.ts".

Not needed infrastructure was removed from "core/snapshot_util.rs".

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-08 22:40:18 +01:00
Bartek Iwańczuk 65500f36e8
chore: upgrade rusty_v8 to 0.62.2 (#17604)
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2023-02-07 13:36:41 +01:00
denobot a4988d00da
chore: forward v1.30.3 release commit to main (#17677)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-07 04:15:38 +00:00
denobot f8ecd236fb
chore: forward v1.30.2 release commit to main (#17641)
This is the release commit being forwarded back to main for 1.30.2

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-02-03 16:26:43 +00:00
denobot 65755a115a
chore: forward v1.30.1 release commit to main (#17623)
This is the release commit being forwarded back to main for 1.30.1
2023-02-02 16:28:40 +00:00
Leo Kettmeir 3035dee9f1
chore: update webgpu (#17534) 2023-01-30 15:14:16 +01:00
David Sherret 1803df7d3a
fix(fmt): semiColons: false - handle prop with following generator and do while with no block body (#17567)
Closes #17559
2023-01-28 10:06:37 -05:00
denobot a6f915c22f
1.30.0 (#17532)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-26 00:15:08 +01:00
Bartek Iwańczuk c6c8c91a6e
feat: embed import map in the config file (#17478)
This commit changes handling of config file to enable
specifying "imports" and "scopes" objects effectively making
the configuration file an import map.

"imports" and "scopes" take precedence over "importMap" configuration,
but have lower priority than "--importmap" CLI flag.

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-01-25 21:13:40 +01:00
Bartek Iwańczuk 8b7023bc7e
Revert "chore: upgrade rusty_v8 to 0.62.0 (#17200)" (#17523)
This reverts commit e2d75491d5.
2023-01-25 15:36:10 +01:00
Bartek Iwańczuk e2d75491d5
chore: upgrade rusty_v8 to 0.62.0 (#17200) 2023-01-25 12:22:27 +00:00
David Sherret 654e177c91
refactor(deno_graph): remove unused Resolved::Ok#kind usage (#17504)
See https://github.com/denoland/deno_graph/pull/205 for more details.
2023-01-24 08:23:19 -05:00
Bartek Iwańczuk bf237c6241
refactor: Move lockfile to a separate crate (#17503)
Moves the lockfile implementation to a separate crate so other projects
like Deploy can use it as well.
2023-01-23 23:41:02 +01:00
Jun Jiang c230a95551
chore: upgrade tokio to 1.24.2 (#17467)
Tokio 1.24.2 fixed an unsoundness issue
https://github.com/tokio-rs/tokio/pull/5375
2023-01-19 21:57:13 +05:30
Kyle Willmon 84e9794970
chore(ext/crypto): Update rsa to 0.7.0 (#16327)
Bump the rsa crate to 0.7.0

The API for the `rsa` crate has changed significantly, but I have
verified that tests continue to pass throughout this update.
2023-01-18 15:18:41 +00:00
Nugine 9686a00419
chore: upgrade base64-simd to 0.8.0 (#17463)
This PR upgrades the `base64-simd` dependency of `deno_web`.

base64-simd v0.8 supports `forgiving_decode` in ["copy"
mode](https://docs.rs/base64-simd/0.8.0/base64_simd/fn.forgiving_decode.html),
["inplace"
mode](https://docs.rs/base64-simd/0.8.0/base64_simd/fn.forgiving_decode_inplace.html)
or ["alloc"
mode](https://docs.rs/base64-simd/0.8.0/base64_simd/fn.forgiving_decode_to_vec.html).
When #17159 resolves, they can be used to reduce unnecessary allocations
and copies.

base64-simd v0.8 also supports AArch64 SIMD out of box.
2023-01-18 20:05:24 +05:30
denobot f2a5f6d7f0
chore: forward v1.29.4 release commit to main (#17453)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-17 00:30:33 +01:00
Divy Srivastava 8f321a8a39
chore(ext/webidl): Add dictionary converter microbenchmark (#17435)
This commits add a `webidl.createDictionaryConverter` converter
microbenchmark.

There are 2 PRs currently open that need a microbenchmark for webidl
dictionary converter. See https://github.com/denoland/deno/pull/16594
and https://github.com/denoland/deno/pull/16407

Closes https://github.com/denoland/deno/issues/17436
2023-01-15 13:36:12 +00:00
Bartek Iwańczuk d0f88fc1ca
chore: upgrade rusty_v8 to 0.60.1 (#17407)
Required for https://github.com/denoland/deno/pull/17306
2023-01-14 10:36:42 +05:30
David Sherret 377f593273
chore: forward 1.29.3 release back to main (#17401) 2023-01-13 13:36:51 -05:00
David Sherret 8c3c02354d
fix(fmt): better handling of link reference definitions when formatting markdown (#17352)
Two fixes:

- https://github.com/dprint/dprint-plugin-markdown/pull/75
- https://github.com/dprint/dprint-plugin-markdown/pull/73
2023-01-11 18:35:45 +00:00
Leo Kettmeir c41d4ff90e
feat(core): allow specifying name and dependencies of an Extension (#17301) 2023-01-08 23:48:46 +01:00
Dj ad82918f56
feat(ext/ffi): structs by value (#15060)
Adds support for passing and returning structs as buffers to FFI. This does not implement fastapi support for structs. Needed for certain system APIs such as AppKit on macOS.
2023-01-08 09:28:10 +05:30
Jun Jiang f26700862a
chore: upgrade tokio to 1.24.0 (#17271) 2023-01-06 16:37:23 +01:00
denobot fa271b70db
chore: forward v1.29.2 release commit to main (#17277)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-05 16:48:19 +01:00
David Sherret 0ee64ad847
fix: upgrade deno_ast to 0.23 (#17269)
Closes #17172
Closes #15669
Closes #8529
2023-01-04 18:54:54 -05:00
Ryan Dahl 400cd331fb
chore: bump deno_fetch and deno_http versions (#17124)
https://github.com/denoland/deno/pull/17081
https://github.com/denoland/deno/pull/17126
2022-12-20 04:54:27 -08:00
Luca Casonato 8e947bb674
fix(ext/http): close stream on resp body error (#17126)
Previously, errored streaming response bodies did not cause the HTTP
stream to be aborted. It instead caused the stream to be closed gracefully,
which had the result that the client could not detect the difference
between a successful response and an errored response.

This commit fixes the issue by aborting the stream on error.
2022-12-20 08:46:45 +00:00
Divy Srivastava 5a8adc342b
chore(test_util): use pty2 instead of pty (#17131)
Fixes https://github.com/denoland/deno/issues/484

Removes dependency on winapi 0.2.x versions.
2022-12-19 18:12:45 +00:00
David Sherret 2afac5bf78
refactor(progress bars): global control for drawing (#17091)
This PR adds the concept of a global `DrawThread`, which can receive
multiple renderers to draw information on the screen (note: the
underlying thread is released back to tokio when it's not rendering). It
also separates the concept of progress bars from the existing "draw
thread". This makes it trivial for us to do stuff like show permission
prompts and progress bars at the same time in the future.

The reason this is global is because the process' tty stderr is also a
global concept.
2022-12-19 11:19:33 -05:00
denobot b9527f5020
chore: forward v1.29.1 release commit to main (#17067)
Co-authored-by: dsherret <dsherret@users.noreply.github.com>
2022-12-15 13:30:55 -05:00
denobot 0d4e4af7ac
1.29.0 (#17052)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-12-15 00:22:54 +01:00
David Sherret 392cca87a8
fix(fmt): panic in yaml header with multi-byte characters (#17042)
Closes #17010
2022-12-13 23:36:02 +00:00
Bartek Iwańczuk 12626b11f7
chore: upgrade rusty_v8 to 0.60.0 (#17033) 2022-12-13 17:07:18 +01:00
Bartek Iwańczuk 8c026dab92
feat: improve download progress bar (#16984)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-12-12 20:52:10 -05:00
David Sherret dac30af151
feat(fmt): improve width calculation (#16982)
Formats code according to Unicode Standard Annex #11 rules
(https://crates.io/crates/unicode-width).

This aligns `deno fmt` more with prettier.
2022-12-07 17:32:24 -05:00
David Sherret 192f07bb7e
feat(flags): add deno check --all as new preferred alias for --remote (#16702)
Closes #16374
2022-12-07 13:33:26 -05:00
David Sherret c03e0f3853
refactor: remove deno_graph::Locker usage (#16877)
This is just a straight refactor and doesn't make any improvements to
the code that could now be made.

Closes #16493
2022-12-06 14:12:51 -05:00
David Sherret a7dd28a07c
fix(task): improve word parsing (#16911)
Ref https://github.com/denoland/deno_task_shell/pull/67
2022-12-05 19:02:20 -05:00
Rui Chen c3b75c692c
chore(build): bump textwrap to 0.15.2 (#16906)
As [textwrap 0.15.1 got
yanked](https://github.com/mgeisler/textwrap/issues/484), it caused some
build issue [in the homebrew
side](https://github.com/Homebrew/homebrew-core/pull/116662), bumping
the dependency to 0.15.2.

Signed-off-by: Rui Chen <rui@chenrui.dev>
2022-12-02 14:43:03 -05:00
David Sherret b638bc183d
fix(task): support redirects in pipe sequences (#16903)
Categorizing this as a fix because it currently fails silently.
2022-12-02 12:02:44 -05:00
denobot 98d062e3dc
chore: forward v1.28.3 release commit to main (#16884)
Co-authored-by: kt3k <kt3k@users.noreply.github.com>
2022-12-01 22:46:27 +09:00
Bartek Iwańczuk 381932ce1e
chore: upgrade rusty_v8 to 0.58.0 (#16879) 2022-11-30 22:20:18 +00:00
Bartek Iwańczuk 3f71c0dcf5
chore: upgrade rusty_v8 to 0.57.0 (#16871) 2022-11-30 00:45:33 +00:00
David Sherret 73f8c820f3
fix(fmt/markdown): fix emoji width calculation in tables (#16870)
https://github.com/dprint/dprint-plugin-markdown/pull/67
2022-11-30 00:34:38 +00:00
Leo Kettmeir 6344b9e0a5
chore: update deno_doc (#16838) 2022-11-26 22:28:20 +00:00
Bartek Iwańczuk d8ab492d01
chore: update rusty_v8 to 0.56.1 (#16835) 2022-11-26 20:11:27 +01:00
Bartek Iwańczuk 55da1a2e72
chore: update rusty_v8 to 0.56.0 (#16814)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-11-26 16:35:46 +01:00
Divy Srivastava 8fc62f93bf
fix(ops): circular dependency in deno_ops test (#16809) 2022-11-25 20:17:21 +05:30
David Sherret e6a9588b43
fix(task): output encoding issues on windows (#16794)
Closes #16792
2022-11-24 19:37:02 -05:00
denobot 72dd7ad807
chore: forward v1.28.2 release commit to main (#16796)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-11-24 23:59:42 +01:00
David Sherret f2330fcd9b
fix(fmt/markdown): scenario where whitespace was being incorrectly stripped in inline links (#16769)
https://github.com/dprint/dprint-plugin-markdown/pull/69

Closes #16730
2022-11-23 12:44:57 -05:00
Leo Kettmeir 13e3acf71d
chore: workspace inheritance (#16343) 2022-11-22 21:07:35 +01:00
Bartek Iwańczuk f077c4f248
chore: update import_map and deno_doc (#16755) 2022-11-22 16:19:41 +01:00
Bartek Iwańczuk d232746928
feat(core): Ability to create snapshots from existing snapshots (#16597)
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2022-11-21 14:36:26 +01:00
denobot 483c10c94b
chore: forward v1.28.1 release commit to main (#16678)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-11-17 02:17:19 +01:00
David Sherret 40a72f3555
fix(npm): support non-all lowercase package names (#16669)
Supports package names that aren't all lowercase.

This stores the package with a leading underscore (since that's not
allowed in npm's registry and no package exists with a leading
underscore) then base32 encoded (A-Z0-9) so it can be lowercased and
avoid collisions.

Global cache dir:

```
$DENO_DIR/npm/registry.npmjs.org/_{base32_encode(package_name).to_lowercase()}/{version}
```

node_modules dir `.deno` folder:

```
node_modules/.deno/_{base32_encode(package_name).to_lowercase()}@{version}/node_modules/<package-name>
```

Within node_modules folder:

```
node_modules/<package-name>
```

So, direct childs of the node_modules folder can have collisions between
packages like `JSON` vs `json`, but this is already something npm itself
doesn't handle well. Plus, Deno doesn't actually ever resolve to the
`node_modules/<package-name>` folder, but just has that for
compatibility. Additionally, packages in the `.deno` dir could have
collissions if they have multiple dependencies that only differ in
casing or a dependency that has different casing, but if someone is
doing that then they're already going to have trouble with npm and they
are asking for trouble in general.
2022-11-16 18:44:31 +00:00
denobot 916598f8a7
1.28.0 (#16620)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-11-13 15:31:36 -05:00
Bartek Iwańczuk b88b7c9244
chore: upgrade rusty_v8 to 0.55.0 (#16604)
<!--
Before submitting a PR, please read http://deno.land/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.
-->
2022-11-12 05:37:37 +01:00
Bartek Iwańczuk fd32f75da9
chore: update crates (#16588) 2022-11-10 17:20:46 +01:00
Divy Srivastava 110a0ebe69
perf(core): minimize trivial heap allocations in resolve_async_ops (#16584)
* Use stack allocated array for 16 promises and spill rest to heap. the
exact number can change, maybe 128? (tokio's coop budget limit)
* Avoid v8::Global::clone for global context.
* Do not open global opresolve when its not needed.
2022-11-10 17:26:02 +05:30
Divy Srivastava bc33a4b2e0
refactor(ops): Rewrite fast call optimizer and codegen (#16514) 2022-11-10 17:23:31 +05:30
denobot c08fcd96c1
chore: forward v1.27.2 release commit to main (#16572)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-11-09 00:27:51 +01:00
David Sherret cbb3f85433
feat(unstable/npm): support peer dependencies (#16561)
This adds support for peer dependencies in npm packages.

1. If not found higher in the tree (ancestor and ancestor siblings),
peer dependencies are resolved like a dependency similar to npm 7.
2. Optional peer dependencies are only resolved if found higher in the
tree.
3. This creates "copy packages" or duplicates of a package when a
package has different resolution due to peer dependency resolution—see
https://pnpm.io/how-peers-are-resolved. Unlike pnpm though, duplicates
of packages will have `_1`, `_2`, etc. added to the end of the package
version in the directory in order to minimize the chance of hitting the
max file path limit on Windows. This is done for both the local
"node_modules" directory and also the global npm cache. The files are
hard linked in this case to reduce hard drive space.

This is a first pass and the code is definitely more inefficient than it
could be.

Closes #15823
2022-11-08 14:17:24 -05:00
denobot 61fbfabe44
chore: forward v1.27.1 release commit to main (#16533)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-11-04 00:40:23 +01:00
Leo Kettmeir 5140795662
chore: update deno_doc (#16515) 2022-11-02 18:51:37 +01:00
Divy Srivastava ab7e80bde4
chore(runtime): remove dependency on sys-info crate (#16441)
Fixes #9862 

`loadavg`

| Target family | Syscall | Description |
| ------------- | ------- | ----------- |
| Linux | `sysinfo` | - |
| Windows | - | Returns `DEFAULT_LOADAVG`. There is no concept of
loadavg on Windows |
| macOS, BSD | `getloadavg` |
https://www.freebsd.org/cgi/man.cgi?query=getloadavg |

`os_release`

| Target family | Syscall | Description |
| ------------- | ------- | ----------- |
| Linux | `/proc/sys/kernel/osrelease` | - |
| Windows |
[`RtlGetVersion`](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlgetversion)
| dwMajorVersion . dwMinorVersion . dwBuildNumber |
| macOS | `sysctl([CTL_KERN, KERN_OSRELEASE])` | - |

`hostname`

| Target family | Syscall | Description |
| ------------- | ------- | ----------- |
| Unix | `gethostname(sysconf(_SC_HOST_NAME_MAX))` | - |
| Windows | `GetHostNameW` | - |

`mem_info`

| Target family | Syscall | Description |
| ------------- | ------- | ----------- |
| Linux | sysinfo | - |
| Windows | `sysinfoapi::GlobalMemoryStatusEx` | - |
| macOS | <br> <pre> sysctl([CTL_HW, HW_MEMSIZE]); <br> sysctl([CTL_VM,
VM_SWAPUSAGE]); <br> host_statistics64(mach_host_self(), HOST_VM_INFO64)
</pre> | - |
2022-11-02 12:47:00 +05:30
David Sherret 5cd82b84bb
chore: pin lsp types due to unstable "proposed" feature (#16467)
The "proposed" feature that we depend upon in tower-lsp, turns on the
"proposed" feature in lsp-types which has breaking changes in patch
releases because it's explicitly unstable. We need to pin it to prevent
it breaking cargo publish.
2022-10-28 11:38:56 -04:00
Bartek Iwańczuk c27942fee4
fix(lsp): add ServerCapabilities::encoding (#16444)
This caused v1.27.0 publishing to fail.
2022-10-27 19:34:44 +02:00
denobot b0fb8fa9dc
1.27.0 (#16442)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-27 17:13:26 +02:00
David Sherret 4d166e638f
feat(task): support sleep suffixes (#16425)
Co-authored-by: sigmaSd <sigmasd@users.noreply.github.com>
2022-10-25 21:14:08 -04:00
David Sherret e203bd9c5a
fix: upgrade swc_ecma_parser to 0.122.19 - deno_ast 0.20 (#16406) 2022-10-25 11:55:57 -04:00
David Sherret bcfe279fba
feat(unstable/npm): initial type checking of npm specifiers (#16332) 2022-10-21 15:20:18 +00:00
Bartek Iwańczuk 869acee8fb
chore: upgrade rusty_v8 to 0.54.0 (#16368)
<!--
Before submitting a PR, please read http://deno.land/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.
-->
2022-10-20 21:01:49 +02:00
David Sherret 6fbd95630a
feat(unstable/task): fail task on async command failure (#16301)
Tests and implementation are found here:
https://github.com/denoland/deno_task_shell/pull/59

This is a breaking change, but `deno task` is unstable.

> This changes async commands so that on non-zero exit code they will
fail the entire task. For example:
> 
> ```jsonc
> // task that asynchronously starts a server and starts a watcher for
the frontend
> "dev": "deno task server & deno task frontend:watch"
> ```
> 
> Previously when running `deno task dev`, if `deno task server` failed,
the entire command would not fail, which kept in line with `sh`, but
it's not very practical. This change causes `deno task dev` to fail.
> 
> To opt out, developers can add an `|| exit 0`:
> 
> ```jsonc
> "dev": "deno task server || exit 0 & deno task frontend:watch"
> ```
2022-10-18 14:23:53 +02:00
Bartek Iwańczuk 204c46dcc1
chore: forward v1.26.2 to main (#16331)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>

<!--
Before submitting a PR, please read http://deno.land/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.
-->

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-10-17 23:11:16 +02:00
Bartek Iwańczuk 60dd84a5a0
bench: don't send data to grafana (#16324)
ci / bench release ubuntu-20.04-xl (pull_request) went from 24m to 23m
2022-10-17 17:49:03 +02:00
David Sherret 698ae4bfed
feat(unstable/npm): support providing npm dist-tag in npm package specifier (#16293) 2022-10-17 09:16:19 -04:00
Bartek Iwańczuk edaba4d06b
chore: upgrade rusty_v8 to 0.53.1 (#16303)
This commit fixes startup time regression, caused by update
to rusty_v8 v0.50.0.
2022-10-16 13:26:06 +02:00
Luke Channings fa22956a86
refactor(build): better handle old glibc (#16238)
Follow-up to #16208.

- Refactors build.rs behaviour to use `-exported_symbols_list` /
`--export-dynamic-symbol-list`
- Since all build systems now rely on a symbols list file, I have added
`generate_exported_symbols_list`, which derives the symbol list file
depending on the platform, which makes `tools/napi/generate_link_win.js`
redundant.
- Fixes a missed instance of `i8` being used instead of `c_char`

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-10-15 20:51:04 +05:30
Bartek Iwańczuk e7d7585065
chore: upgrade rusty_v8 to 0.53.0 (#16272) 2022-10-15 01:53:13 +02:00
Luca Casonato 3b6b75bb46
feat(core): improve resource read & write traits (#16115)
This commit introduces two new buffer wrapper types to `deno_core`. The
main benefit of these new wrappers is that they can wrap a number of
different underlying buffer types. This allows for a more flexible read
and write API on resources that will require less copying of data
between different buffer representations.

- `BufView` is a read-only view onto a buffer. It can be backed by
`ZeroCopyBuf`, `Vec<u8>`, and `bytes::Bytes`.
- `BufViewMut` is a read-write view onto a buffer. It can be cheaply
converted into a `BufView`. It can be backed by `ZeroCopyBuf` or
`Vec<u8>`.

Both new buffer views have a cursor. This means that the start point of
the view can be constrained to write / read from just a slice of the
view. Only the start point of the slice can be adjusted. The end point
is fixed. To adjust the end point, the underlying buffer needs to be
truncated.

Readable resources have been changed to better cater to resources that
do not support BYOB reads. The basic `read` method now returns a
`BufView` instead of taking a `ZeroCopyBuf` to fill. This allows the
operation to return buffers that the resource has already allocated,
instead of forcing the caller to allocate the buffer. BYOB reads are
still very useful for resources that support them, so a new `read_byob`
method has been added that takes a `BufViewMut` to fill. `op_read`
attempts to use `read_byob` if the resource supports it, which falls
back to `read` and performs an additional copy if it does not. For
Rust->JS reads this change should have no impact, but for Rust->Rust
reads, this allows the caller to avoid an additional copy in many
scenarios. This combined with the support for `BufView` to be backed by
`bytes::Bytes` allows us to avoid one data copy when piping from a
`fetch` response into an `ext/http` response.

Writable resources have been changed to take a `BufView` instead of a
`ZeroCopyBuf` as an argument. This allows for less copying of data in
certain scenarios, as described above. Additionally a new
`Resource::write_all` method has been added that takes a `BufView` and
continually attempts to write the resource until the entire buffer has
been written. Certain resources like files can override this method to
provide a more efficient `write_all` implementation.
2022-10-09 14:49:25 +00:00
Bartek Iwańczuk 5733de8a2e
chore: upgrade rusty_v8 to 0.52.0 (#16183) 2022-10-07 09:21:56 +05:30
denobot afeacb8328
chore: forward v1.26.1 release commit to main (#16178)
This is the release commit being forwarded back to main for 1.26.1

Please ensure:
- [x] Everything looks ok in the PR
- [x] The release has been published

To make edits to this PR:
```shell
git fetch upstream forward_v1.26.1 && git checkout -b forward_v1.26.1 upstream/forward_v1.26.1
```

Don't need this PR? Close it.

cc @cjihrig

Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
2022-10-06 16:49:40 -04:00
Divy Srivastava cd1c63ad71
fix(build): don't export all symbols to dynamic symbol table (#16171)
Currently, we use `-rdynamic` for exporting Node API symbols to the
symbol table. `-rdynamic` will export *all* symbols, that means
previously unused functions will not be optimized away introducing a lot
of binary bloat. 

This patch uses `-exported_symbol` and `--export-dynamic-symbol` link
flags (not as universal as `-rdynamic`) to only mark Node API symbols to
be put in the dynamic symbol table.
2022-10-06 21:20:00 +05:30
Divy Srivastava 0b016a7fb8
feat(npm): implement Node API (#13633)
This PR implements the NAPI for loading native modules into Deno. 

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: DjDeveloper <43033058+DjDeveloperr@users.noreply.github.com>
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2022-10-05 19:36:44 +05:30
Satya Rohith eacd6a7f29
chore(ext/cache): make helper functions public (#16117) 2022-10-03 10:52:54 +05:30
denobot d8827514ff
1.26.0
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-09-29 00:10:44 +02:00
Divy Srivastava e64af6260a
feat(ext/flash): add reuseport option on Linux (#16022) 2022-09-28 23:16:29 +05:30
Satya Rohith b312279e58
feat: implement Web Cache API (#15829) 2022-09-28 17:41:12 +05:30
David Sherret a44c83a3d6
fix(npm): use ntfs junctions in node_modules folder on Windows (#16061) 2022-09-27 18:02:35 -04:00
Divy Srivastava f02f2425d5
feat(ext/crypto): add x25519 and Ed25519 CFRG curves (#14119) 2022-09-27 17:43:42 +05:30
David Sherret 1628dba6db
fix(fmt): keep type args in type queries and keep empty array expr element's trailing comma (#16034) 2022-09-26 12:57:50 -04:00
David Sherret 1b04ff0782
chore: forward v1.25.4 release commit to main (#16001) 2022-09-22 15:58:43 -04:00
David Sherret 716005a0d4
feat(npm): add flag for creating and resolving npm packages to a local node_modules folder (#15971) 2022-09-22 11:17:02 -04:00
Aapo Alasuutari 707e9e3580
feat(ops): Automatic fast ops creation (#15527) 2022-09-22 10:05:24 +05:30
Ben Noordhuis 79aee3668d
chore(runtime): upgrade netif crate (#15867)
v0.1.3 contains code that will stop working with newer versions of
libstd because the layout of some std::net types changed.

Refs: https://github.com/bnoordhuis/netif/pull/10
2022-09-19 14:12:03 -04:00
David Sherret a4a894fa1e
fix(doc): deno doc should parse modules if they haven't been parsed before (#15941) 2022-09-18 13:59:33 -04:00
Darshan Sen e7934432ce
chore: upgrade rusty_v8 to v0.50.0 (#15762)
Signed-off-by: Darshan Sen <raisinten@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-09-17 11:55:19 +02:00
Ryan Dahl 684841a18c
upgrade deps (#15914) 2022-09-16 19:11:30 -04:00