summaryrefslogtreecommitdiff
path: root/ext
AgeCommit message (Collapse)Author
2023-08-09refactor(ext/fetch): Remove FetchRequestBodyResource from FetchHandler ↵Matt Mastracci
interface (#20100) This is unused and will allow us to remove `FetchRequestBodyResource` in a future PR.
2023-08-08chore: rename some helpers on the Fs trait (#20097)Luca Casonato
Rename some of the helper methods on the Fs trait to be suffixed with `_sync` / `_async`, in preparation of the introduction of more async methods for some helpers. Also adds a `read_text_file_async` helper to complement the renamed `read_text_file_sync` helper.
2023-08-08fix(fmt): do not insert expr stmt leading semi-colon in do while stmt body ↵David Sherret
(#20093) This is for when semiColons: false Closes #20089
2023-08-08fix(ext/abort): trigger AbortSignal events in correct order (#20095)Marcos Casagrande
This PR ensures that the original signal event is fired before any dependent signal events. --- The enabled tests fail on `main`: ``` assert_array_equals: Abort events fired in correct order expected property 0 to be "original-aborted" but got "clone-aborted" (expected array ["original-aborted", "clone-aborted"] got ["clone-aborted", "original-aborted"]) ```
2023-08-06build: allow disabling snapshots for dev (#20048)Nayeem Rahman
Closes #19399 (running without snapshots at all was suggested as an alternative solution). Adds a `__runtime_js_sources` pseudo-private feature to load extension JS sources at runtime for faster development, instead of building and loading snapshots or embedding sources in the binary. Will only work in a development environment obviously. Try running `cargo test --features __runtime_js_sources integration::node_unit_tests::os_test`. Then break some behaviour in `ext/node/polyfills/os.ts` e.g. make `function cpus() {}` return an empty array, and run it again. Fix and then run again. No more build time in between.
2023-08-04fix(ext/http): serveHttp brotli compression level should be fastest (#20058)Matt Mastracci
Use brotli's fastest mode rather than default mode
2023-08-04chore(cargo): update async-compression/flate2/miniz to latest (#20049)Luca Bruno
This bumps `async-compression` dependency in `deno_http` to latest, in order to avoid having multiple duplicate versions. Related, it also unpin a stale `flate2` dependency so that the whole chain of `async-compression` -> `flate2` -> `miniz_oxide` can surface up to current versions. The lockfile entries for all of the above crates have been update accordingly; the new tree of dependencies looks like this: ``` $ cargo tree -i -p miniz_oxide miniz_oxide v0.7.1 └── flate2 v1.0.26 └── async-compression v0.4.1 ```
2023-08-04fix(ext/http): unify default gzip compression level (#20050)Luca Bruno
This tweaks the HTTP response-writer in order to align the two possible execution flows into using the same gzip default compression level, that is `1` (otherwise the implicit default level is `6`).
2023-08-04fix(node): polyfill process.title (#20044)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/19777
2023-08-04fix(node): repl._builtinLibs (#20046)Bartek Iwańczuk
Ref https://github.com/denoland/deno/issues/19733
2023-08-04fix(ext/file): resolve unresolved Promise in Blob.stream (#20039)Marcos Casagrande
This PR fixes some crashing WPT tests due to an unresolved promise. --- This could be a [stream spec](https://streams.spec.whatwg.org) bug When `controller.close` is called on a byob stream, there's no cleanup of pending `readIntoRequests`. The only cleanup of pending `readIntoRequests` happen when `.byobRequest.respond(0)` is called, it happens here:https://github.com/denoland/deno/blob/6ba245fe2570b29e35a4fd296a196a58870b1e3c/ext/web/06_streams.js#L2026 which ends up calling `readIntoRequest.closeSteps(chunk);` in https://github.com/denoland/deno/blob/6ba245fe2570b29e35a4fd296a196a58870b1e3c/ext/web/06_streams.js#L2070 To reproduce: ```js async function byobRead() { const input = [new Uint8Array([8, 241, 48, 123, 151])]; const stream = new ReadableStream({ type: "bytes", async pull(controller) { if(input.length === 0) { controller.close(); // controller.byobRequest.respond(0); // uncomment for fix return } controller.enqueue(input.shift()) }, }); const reader = stream.getReader({ mode: 'byob' }); const r1 = await reader.read(new Uint8Array(64)); console.log(r1); const r2 = await reader.read(new Uint8Array(64)); console.log(r2); } await byobRead(); ``` Running the script triggers: ``` error: Top-level await promise never resolved ```
2023-08-03refactor: rewrite http_next ops to use op2 macro (#19934)Bartek Iwańczuk
Ref #19915 --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-03refactor(ext/fetch): refactor fetch to use new write_error method (#20029)Matt Mastracci
This is a prerequisite for fast streams work -- this particular resource used a custom `mpsc`-style stream, and this work will allow us to unify it with the streams in `ext/http` in time. Instead of using Option as an internal semaphore for "correctly completed EOF", we allow code to propagate errors into the channel which can be picked up by downstream sinks like Hyper. EOF is signalled using a more standard sender drop.
2023-08-031.36.0 (#20036)denobot
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2023-08-03feat(permissions): add "--deny-*" flags (#19070)Asher Gomez
This commit adds new "--deny-*" permission flags. These are complimentary to "--allow-*" flags. These flags can be used to restrict access to certain resources, even if they were granted using "--allow-*" flags or the "--allow-all" ("-A") flag. Eg. specifying "--allow-read --deny-read" will result in a permission error, while "--allow-read --deny-read=/etc" will allow read access to all FS but the "/etc" directory. Runtime permissions APIs ("Deno.permissions") were adjusted as well, mainly by adding, a new "PermissionStatus.partial" field. This field denotes that while permission might be granted to requested resource, it's only partial (ie. a "--deny-*" flag was specified that excludes some of the requested resources). Eg. specifying "--allow-read=foo/ --deny-read=foo/bar" and then querying for permissions like "Deno.permissions.query({ name: "read", path: "foo/" })" will return "PermissionStatus { state: "granted", onchange: null, partial: true }", denoting that some of the subpaths don't have read access. Closes #18804. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2023-08-02fix(node): node:test reports correct location (#20025)Bartek Iwańczuk
Also removed some noisy output that caused test flakiness.
2023-08-01fix(ext/node): fix import json using npm specifier (#19723)await-ovo
2023-08-02feat(node): add polyfill for node:test module (#20002)Bartek Iwańczuk
This commit provides basic polyfill for "node:test" module. Currently only top-level "test" function is polyfilled, all remaining functions from that module throw not implemented errors.
2023-08-01ci: lint on all operating systems (#20012)David Sherret
2023-08-01refactor(runtime): use new fd methods from resource table (#20010)Matt Mastracci
Prereq for fast streams work. No longer need `#[cfg]` around `backing_fd`.
2023-07-31fix: call setIsTrusted for generated events (MessageEvent) (#19919)Ricardo Iván Vieitez Parra
This addresses issue #19918. ## Issue description Event messages have the wrong isTrusted value when they are not triggered by user interaction, which differs from the browser. In particular, all MessageEvents created by Deno have isTrusted set to false, even though it should be true. This is my first ever contribution to Deno, so I might be missing something.
2023-07-31feat(node/os): implement getPriority, setPriority & userInfo (#19370)Leo Kettmeir
Takes #4202 over Closes #17850 --------- Co-authored-by: ecyrbe <ecyrbe@gmail.com>
2023-07-31perf: faster node globals access in cjs (#19997)Luca Casonato
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-07-31refactor: update core extension api usage (#19952)Nayeem Rahman
2023-07-31refactor: NodeCodeTranslator - optional source to translate_cjs_to_esm (#20000)David Sherret
2023-07-31feat(ext/http): Upgrade to hyper1.0-rc4 (#19987)Matt Mastracci
Includes a lightly-modified version of hyper-util's `TokioIo` utility. Hyper changes: v1.0.0-rc.4 (2023-07-10) Bug Fixes http1: http1 server graceful shutdown fix (#3261) ([f4b51300](https://github.com/hyperium/hyper/commit/f4b513009d81083081d1c60c1981847bbb17dd5d)) send error on Incoming body when connection errors (#3256) ([52f19259](https://github.com/hyperium/hyper/commit/52f192593fb9ebcf6d3894e0c85cbf710da4decd), closes https://github.com/hyperium/hyper/issues/3253) properly end chunked bodies when it was known to be empty (#3254) ([fec64cf0](https://github.com/hyperium/hyper/commit/fec64cf0abdc678e30ca5f1b310c5118b2e01999), closes https://github.com/hyperium/hyper/issues/3252) Features client: Make clients able to use non-Send executor (#3184) ([d977f209](https://github.com/hyperium/hyper/commit/d977f209bc6068d8f878b22803fc42d90c887fcc), closes https://github.com/hyperium/hyper/issues/3017) rt: replace IO traits with hyper::rt ones (#3230) ([f9f65b7a](https://github.com/hyperium/hyper/commit/f9f65b7aa67fa3ec0267fe015945973726285bc2), closes https://github.com/hyperium/hyper/issues/3110) add downcast on Sleep trait (#3125) ([d92d3917](https://github.com/hyperium/hyper/commit/d92d3917d950e4c61c37c2170f3ce273d2a0f7d1), closes https://github.com/hyperium/hyper/issues/3027) service: change Service::call to take &self (#3223) ([d894439e](https://github.com/hyperium/hyper/commit/d894439e009aa75103f6382a7ba98fb17da72f02), closes https://github.com/hyperium/hyper/issues/3040) Breaking Changes Any IO transport type provided must not implement hyper::rt::{Read, Write} instead of tokio::io traits. You can grab a helper type from hyper-util to wrap Tokio types, or implement the traits yourself, if it's a custom type. ([f9f65b7a](https://github.com/hyperium/hyper/commit/f9f65b7aa67fa3ec0267fe015945973726285bc2)) client::conn::http2 types now use another generic for an Executor. Code that names Connection needs to include the additional generic parameter. ([d977f209](https://github.com/hyperium/hyper/commit/d977f209bc6068d8f878b22803fc42d90c887fcc)) The Service::call function no longer takes a mutable reference to self. The FnMut trait bound on the service::util::service_fn function and the trait bound on the impl for the ServiceFn struct were changed from FnMut to Fn.
2023-07-30perf(ext/ffi): Avoid receiving on FFI async work channel when no ↵Aapo Alasuutari
UnsafeCallback exists (#19454)
2023-07-30fix(ext/compression): throw TypeError on corrupt input (#19979)Marcos Casagrande
`TypeError` should be thrown when decompressing a corrupt input
2023-07-30fix(Deno.serve): accessing .url on cloned request throws (#19869)Felipe Baltor
This PR fixes #19818. The problem was that the new InnerRequest class does not initialize the fields urlList and urlListProcessed that are used during a request clone. The solution aims to be straightforward by simply initializing the missing properties during the clone process. I also implemented a "cache" to the url getter of the new InnerRequest, avoiding the cost of calling op_http_get_request_method_and_url.
2023-07-28fix(npm): improve declaration resolution for filename with different ↵David Sherret
extensions (#19966) postcss was importing `./index.js` from `./index.d.mts` where there also existed a `./index.d.ts`. Closes #19575
2023-07-28chore: remove unused dependencies (#19962)Divy Srivastava
2023-07-28feat: Deno.createHttpClient allowHost (#19689)Leo Kettmeir
This adds an option to allow using the host header in a fetch call. Closes https://github.com/denoland/deno/issues/16840 Ref https://github.com/denoland/deno/issues/11017
2023-07-28feat(ext/websocket): allow HTTP(S) protocol in URL (#19862)Leo Kettmeir
Closes #19093
2023-07-27fix(node): package path not exported error - add if types resolution was ↵David Sherret
occurring (#19963)
2023-07-26fix(ext/fs): fix MaybeArc when not sync_fs (#19950)Matt Mastracci
2023-07-261.35.3 (#19947)denobot
Bumped versions for 1.35.3 Co-authored-by: mmastrac <mmastrac@users.noreply.github.com>
2023-07-25fix(ext/http): Quietly ignore invalid status codes (#19936)Matt Mastracci
2023-07-25perf: cache node resolution when accesing a global (#19930)Bartek Iwańczuk
Reclaims some of the performance hit introduced by https://github.com/denoland/deno/pull/19307.
2023-07-25fix(node): add writable and readable fields to FakeSocket (#19931)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/19927
2023-07-25fix(ext/net): fix string port number handling in listen (#19921)Yoshiya Hinosawa
While string `port` is not allowed in typing, it seems we used to support that and now it's broken. ref: https://github.com/denoland/deno/issues/10064#issuecomment-1637427260 This PR restores the support of string port number in `listen` and `listenTls`
2023-07-24refactor(ext/node): CjsCodeAnalyzer - analyze_cjs optionally pass source ↵David Sherret
text (#19896)
2023-07-24fix(node_compat): Wrap require resolve exports in try catch block (#19592)Vedant Pandey
Potentially closes #19499
2023-07-24fix(ext/node): inspector with seggregated globals (#19917)Luca Casonato
V8 doesn't like having internal slots on the "real" globalThis object. This commit works around this limitation by storing the inner globalThis objects for segregated globals in a context slot.
2023-07-22chore: update commonjs loading docs (#19904)sigmaSd
2023-07-21fix(node/http): add encrypted field to FakeSocket (#19886)Leo Kettmeir
Fixes #19557
2023-07-20refactor(ext/http): Use const thread-local initializer for slightly better ↵Matt Mastracci
perf (#19881) Benchmarking shows numbers are pretty close, however this is recommended for the best possible thread-local performance and may improve in future Rust compiler revisions.
2023-07-20chore: forward v1.35.2 release commit to main (#19887)denobot
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-07-19fix(ext/http): Error on deprecated/unavailable features (#19880)Matt Mastracci
Throws an error when user code attempts to use unsupported options (may help reduce confusion when migrating to Deno.serve)
2023-07-19feat(ext/node): properly segregate node globals (#19307)Luca Casonato
Code run within Deno-mode and Node-mode should have access to a slightly different set of globals. Previously this was done through a compile time code-transform for Node-mode, but this is not ideal and has many edge cases, for example Node's globalThis having a different identity than Deno's globalThis. This commit makes the `globalThis` of the entire runtime a semi-proxy. This proxy returns a different set of globals depending on the caller's mode. This is not a full proxy, because it is shadowed by "real" properties on globalThis. This is done to avoid the overhead of a full proxy for all globalThis operations. The globals between Deno-mode and Node-mode are now properly segregated. This means that code running in Deno-mode will not have access to Node's globals, and vice versa. Deleting a managed global in Deno-mode will NOT delete the corresponding global in Node-mode, and vice versa. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
2023-07-19fix(node/http): call callback after request is sent (#19871)Leo Kettmeir
Fixes #19762