summaryrefslogtreecommitdiff
path: root/core
AgeCommit message (Collapse)Author
2023-01-05refactor(cli,core,ext,rt): remove some unnecessary `clone` or `malloc` (#17274)Yiyu Lin
2023-01-05chore: forward v1.29.2 release commit to main (#17277)denobot
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-02chore: update copyright year to 2023 (#17247)David Sherret
Yearly tradition of creating extra noise in git.
2022-12-26chore(core): Make `OpCtx` instances be realm-specific (#17174)Andreu Botella
2022-12-23fix(core): run macrotasks and next ticks after polling dynamic imports (#17173)Bartek Iwańczuk
This commit fixes handling of rejected promises in dynamic imports evaluation. Previously we were running callbacks for next ticks and macrotasks _before_ polling dynamic imports and checked for unhandled rejections immediately after. This is wrong, as `unhandledrejection` event is dispatched and its callbacks are run as macrotasks. This commit changes order of actions performed by the event loop to following: - poll async ops - poll dynamic imports - run next tick callbacks - run macrotask callbacks - check for unhandled promise rejections
2022-12-22fix: rejected dynamic import should retain error context (#17160)Bartek Iwańczuk
Found this while debugging https://github.com/denoland/deno/issues/16280. Before: ``` TypeError: Could not resolve 'file:///Users/ib/dev/test_rollup/mocha/rollup.config.js' from 'file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js'. at async getConfigFileExport (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js:432:17) at async Object.loadConfigFile (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js:391:59) at async getConfigs (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/bin/rollup:1679:39) at async runRollup (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/bin/rollup:1656:43) ``` After: ``` TypeError: Could not resolve 'file:///Users/ib/dev/test_rollup/mocha/rollup.config.js' from 'file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js'. Caused by: Reading /Users/ib/dev/test_rollup/mocha/package.json is not allowed at async getConfigFileExport (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js:432:17) at async Object.loadConfigFile (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js:391:59) at async getConfigs (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/bin/rollup:1679:39) at async runRollup (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/bin/rollup:1656:43) ```
2022-12-21fix(core): Do not print errors prop for non-AggregateError errors (#17123)Kamil Ogórek
This commit fixes formatting of JSError with "errors" property. Before this commit all instances of "Error" were treated as if they were "AggregateError" if they had "errors" property. After this commit only actual instances of "AggregateError" are formatted in such a way, while instances of "Error" that have "errors" property are formatted without showing details of "errors".
2022-12-20fix(core): Have custom errors be created in the right realm (#17050)Andreu Botella
Although PR #16366 did not fully revert `deno_core`'s support for realms, since `JsRealm` still existed after that, it did remove the `ContextState` struct, originally introduced in #14734. This change made `js_build_custom_error_cb`, among other properties, a per-runtime callback, rather than per-realm, which cause a bug where errors thrown from an op would always be constructed in the main realm, rather than in the current one. This change adds back `ContextState` to fix this bug, adds back the `known_realms` field of `JsRuntimeState` (needed to be able to drop the callback when snapshotting), and also relands #14750, which adds the `js_realm_sync_ops` test for this bug that was removed in #16366.
2022-12-20chore: Update dlint (#17031)Kenta Moriuchi
Introduces `SafeSetIterator` and `SafeMapIterator` to primordials
2022-12-19fix(runtime): expose `extensions_with_js` from WorkerOptions (#17109)Leo Kettmeir
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-12-17fix(runtime): `Deno.memoryUsage().rss` should return correct value (#17088)David Sherret
This commit changes implementation of "Deno.memoryUsage()" to return correct value for "rss" field. To do that we implement a specialized function per os to retrieve this information.
2022-12-17chore: update to Rust 1.66.0 (#17078)linbingquan
2022-12-17chore(core): Small realm-related fixes (#17044)Andreu Botella
- `JsRuntime::built_from_snapshot` was removed because it was redundant with `JsRuntime::snapshot_options`. - Updates to stale documentation of `JsRuntime::create_realm`. - `JsRuntime::create_realm` now calls `JsRuntime::init_extension_js` unconditionally, since if the runtime was built from a snapshot, `init_extension_js` will be a no-op. - Typo fix in the documentation for `JsRealm`.
2022-12-16refactor(core): allow to listen for notifications in LocalInspectorSession ↵Bartek Iwańczuk
(#17040)
2022-12-15chore: forward v1.29.1 release commit to main (#17067)denobot
Co-authored-by: dsherret <dsherret@users.noreply.github.com>
2022-12-15Revert "feat(ops): Fast zero copy string arguments (#16777)" (#17063)Bartek Iwańczuk
This reverts commit 9b2b8df927ac23cfa99016a684179f2a3198ba2e. Closes https://github.com/dsherret/ts-morph/issues/1372 Closes https://github.com/denoland/deno/issues/16979
2022-12-151.29.0 (#17052)denobot
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-12-13chore(core): Deduplicate `event_loop_pending_state` (#17039)Andreu Botella
2022-12-13refactor(core): add more information when unable to build error (#17027)Bartek Iwańczuk
This should help debug problem in https://github.com/denoland/deno/issues/16963
2022-12-12feat: add `--inspect-wait` flag (#17001)Bartek Iwańczuk
This commit adds new "--inspect-wait" flag which works similarly to "--inspect-brk" in that it waits for inspector session to be established before running code. However it doesn't break on the first statement of user code, but instead runs it as soon as a session is established.
2022-12-06fix(test): handle scenario where --trace-ops would cause an unhandled ↵David Sherret
promise rejection (#16970) Closes #16969
2022-12-06npm: ensure runtime exceptions are surfaced when debugger is attached (#16943)Bartek Iwańczuk
Currently runtime exception are only displayed at the program end in terminal, which makes it only a partial fix, as a full fix requires https://github.com/denoland/rusty_v8/pull/1149 which adds new bindings to the inspector that allows to notify it about thrown exceptions. This will be handled in a follow up commit.
2022-12-04revert: Inspector changes (#16939)Bartek Iwańczuk
Reverts 66dc54a7f and e2a0c3f0 Closes https://github.com/denoland/deno/issues/16926
2022-12-03fix(inspector): even if already woken, always schedule an interrupt (#16910)Bert Belder
2022-12-02fix(inspector): allow to poll session with reentry (#16863)Bartek Iwańczuk
This commit completely rewrites inspector session polling. Until now, there was a single function responsible for polling inspector sessions which could have been called when polling the "JsRuntime" as well as from internal inspector functions. There are some cases where it's required to have reentrant polling of sessions (eg. when "debugger" statement is run) which should be blocking until inspector sends appropriate message to continue execution. This was not possible before, because polling of sessions didn't have reentry ability. As a consequence, session polling was split into two separate functions: a) one to be used when polling from async context (on each tick of event loop in "JsRuntime") b) one to be used when polling synchronously and potentially blocking (used by various inspector methods). There are further cleanups and simplifications to be made in inspector code, but this rewrite solves the problem at hand (being able to evaluate "debugger" JS statement and continue inspector functionality). Co-authored-by: Bert Belder <bertbelder@gmail.com>
2022-12-02feat(ops): Fast zero copy string arguments (#16777)Divy Srivastava
Uses SeqOneByteString optimization to do zero-copy `&str` arguments in fast calls. - [x] Depends on https://github.com/denoland/rusty_v8/pull/1129 - [x] Depends on https://chromium-review.googlesource.com/c/v8/v8/+/4036884 - [x] Disable in async ops - [x] Make it work with owned `String` with an extra alloc in fast path. - [x] Support `Cow<'_, str>`. Owned for slow case, Borrowed for fast case ```rust #[op] fn op_string_len(s: &str) -> u32 { str.len() as u32 } ```
2022-12-01chore: forward v1.28.3 release commit to main (#16884)denobot
Co-authored-by: kt3k <kt3k@users.noreply.github.com>
2022-11-30chore: upgrade rusty_v8 to 0.58.0 (#16879)Bartek Iwańczuk
2022-11-30chore: remove unnecessary lifetimes (#16878)David Sherret
It seems we don't really need to allow these clippy rules.
2022-11-28feat(core): show unresolved promise origin (#16650)Bartek Iwańczuk
This commit updates unhelpful messages that are raised when event loop stalls on unresolved top-level promises. Instead of "Module evaluation is still pending but there are no pending ops or dynamic imports. This situation is often caused by unresolved promises." and "Dynamically imported module evaluation is still pending but there are no pending ops. This situation is often caused by unresolved promises." we are now printing a message like: error: Top-level await promise never resolved [SOURCE LINE] ^ at [FUNCTION NAME] ([FILENAME]) eg: error: Top-level await promise never resolved await new Promise((_resolve, _reject) => {}); ^ at <anonymous> (file:///Users/ib/dev/deno/cli/tests/testdata/test/unresolved_promise.ts:1:1) Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2022-11-27feat(ops): fast calls for Wasm (#16776)Divy Srivastava
This PR introduces Wasm ops. These calls are optimized for entry from Wasm land. The `#[op(wasm)]` attribute is opt-in. Last parameter `Option<&mut [u8]>` is the memory slice of the Wasm module *when entered from a Fast API call*. Otherwise, the user is expected to implement logic to obtain the memory if `None` ```rust #[op(wasm)] pub fn op_args_get( offset: i32, buffer_offset: i32, memory: Option<&mut [u8]>, ) { // ... } ```
2022-11-27feat(core): support initializing extensions with and without JS (#16789)Bartek Iwańczuk
This commit allows to execute more JS code from extensions when creating a snapshot from an existing snapshot. "deno_core::RuntimeOptions::extensions_with_js" field was added that is used to pass a list of extensions whose both "ops" and associated JS source should be executed upon start. Co-authored-by: crowlkats <crowlkats@toaxl.com>
2022-11-27feat(core): send "executionContextDestroyed" notification on program end ↵Bartek Iwańczuk
(#16831) This commit changes "JsRuntime" to send "executionContextDestroyed" notification when the program finishes and shows a prompt informing that runtime is waiting for inspector to disconnect.
2022-11-26fix(inspector): send "isDefault" in aux data (#16836)Bartek Iwańczuk
With trial and error I found that most debuggers expect "isDefault" to be sent in "auxData" field of "executionContextCreated" notification. This stems from the fact that Node.js sends this data and eg. VSCode requires it to close connection to the debugger when the program finishes execution.
2022-11-26chore: update rusty_v8 to 0.56.1 (#16835)Bartek Iwańczuk
2022-11-24chore: forward v1.28.2 release commit to main (#16796)denobot
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-11-24refactor(core): fix typo in ops_builtin.rs (#16613)Ikko Ashimine
2022-11-22chore: workspace inheritance (#16343)Leo Kettmeir
2022-11-21feat(core): Ability to create snapshots from existing snapshots (#16597)Bartek Iwańczuk
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2022-11-18chore: use Rust 1.65.0 (#16688)Aaron O'Mullan
2022-11-17chore: forward v1.28.1 release commit to main (#16678)denobot
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-11-131.28.0 (#16620)denobot
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-11-12chore: upgrade rusty_v8 to 0.55.0 (#16604)Bartek Iwańczuk
<!-- 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-11fix(npm): disable npm specifiers in import.meta.resolve() (#16599)Bartek Iwańczuk
2022-11-11feat(ops): implement fast lazy async ops (#16579)Divy Srivastava
Implements fast scheduling of deferred op futures. ```rs #[op(fast)] async fn op_read( state: Rc<RefCell<OpState>>, rid: ResourceId, buf: &mut [u8], ) -> Result<u32, Error> { // ... } ``` The future is scheduled via a fast API call and polled by the event loop after being woken up by its waker.
2022-11-10perf(core): minimize trivial heap allocations in `resolve_async_ops` (#16584)Divy Srivastava
* 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-09chore: forward v1.27.2 release commit to main (#16572)denobot
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-11-08refactor: simplify deno_core's grab_global and ensure_objs (#16564)Ryan Dahl
- refactor: remove JsRuntime::ensure_objs - refactor: Replace JsRuntime::grab_global with JsRuntime::eval
2022-11-04chore: forward v1.27.1 release commit to main (#16533)denobot
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-29fix(core): fix APIs not to be affected by `Promise.prototype.then` ↵Kenta Moriuchi
modification (#16326)