0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-31 09:14:20 -04:00
Commit graph

1154 commits

Author SHA1 Message Date
Waldir Pimenta
a09296322e
chore(core): improve error message in module loader example (#17654)
Just a small tweak to the error message to avoid confusion.
2023-02-05 13:15:58 +05:30
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
Bartek Iwańczuk
3f8c217bb1
Revert "chore(core): remove have_unpolled_ops on rt state (#17601)" (#17631)
This reverts commit e85ca8be0d.

This commit caused a huge spike in various benchmarks we track at
https://deno.land/benchmarks
2023-02-03 00:24:20 +01: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
Luca Casonato
e85ca8be0d
chore(core): remove have_unpolled_ops on rt state (#17601)
It's not needed - `!state.have_unpolled_ops.is_empty()` does the same
thing.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-31 01:17:51 +01:00
Kenta Moriuchi
266915d5ce
fix(ext): internal structuredClone for ArrayBuffer and TypedArray subclasses (#17431) 2023-01-29 15:15:01 +01:00
Satya Rohith
2c78550144
refactor(core): derive equality traits for ResolutionKind enum (#17578)
The commit derives Eq, PartialEq, and Debug traits for the
`ResolutionKind` enum to make it possible for external
implementors to assert ResolutionKind.
2023-01-29 17:39:43 +05:30
David Sherret
f5840bdcd3
chore: upgrade to Rust 1.67 (#17548)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-27 10:43:16 -05:00
Kenta Moriuchi
7b6339da6a
fix(core): Add lint check for core (#17223)
The prefer-primordials lint was skipped for `core/*.js`.
2023-01-26 16:56:42 +05:30
Ikko Eltociear Ashimine
67a3b5f72a
chore(core): fix typo in runtime.rs (#17537)
determinstic -> deterministic
2023-01-26 06:54:01 +00: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
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
Kenta Moriuchi
023f028186
refactor(core): Overwrite ArrayPrototypeToString in primordials (#17470) 2023-01-19 21:52:18 +05:30
Leo Kettmeir
f85b006628
refactor: cleanup ModuleMap (#17469)
- changes module id to be usize & 0 based instead of 1 based
- merges `ids_by_handle` & `handles_by_id` to be a single `handles`
vector
- removes `next_module_id`, as vector is used
- turns `info` into a vector
2023-01-19 13:47:41 +01:00
Leo Kettmeir
8dbf7d7866
feat: ES module snapshotting (#17460)
This commit adds support for snapshotting ES modules. This is done by
adding an ability to serialize and deserialize a "ModuleMap" and attach
it
to the snapshot, using "add_context_data" API.

This has been tested with 400 modules and seems to not have a limit on
the number of modules that might be snapshotted.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-19 10:00:35 +01:00
Divy Srivastava
f418be4f57
Optimize http_bench_json_ops example (#16505) 2023-01-18 15:09:54 +00:00
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
Andreu Botella
f0c79a676c
refactor(core): Move pending_promise_rejections to ContextState (#17447)
This is a requirement before supporting modules in realms.
2023-01-16 22:06:42 +05:30
Bartek Iwańczuk
40134ffc99
refactor(core): rename pending_promise_exception to pending_promise_rejection (#17441)
These are technically rejections - a rejection can then raise an
exception.
2023-01-16 15:19:04 +00:00
Kenta Moriuchi
1dc3609ff2
fix(core): Add Generator and AsyncGenerator to promordials (#17241) 2023-01-15 04:26:05 +00:00
Divy Srivastava
d5634164cb
chore: use rustfmt imports_granularity option (#17421)
Closes https://github.com/denoland/deno/issues/2699
Closes https://github.com/denoland/deno/issues/2347

Uses unstable rustfmt features. Since dprint invokes `rustfmt` we do not
need to switch the cargo toolchain to nightly. Do we care about
formatting stability of our codebase across Rust versions? (I don't)
2023-01-14 23:18:58 -05:00
Yiyu Lin
fd85f840cd
refactor: clean up unwrap and clone (#17282)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-01-15 09:36:46 +05:30
Andreu Botella
05ef925eb0
refactor(core): Move optional callbacks from JsRuntimeState to ContextState (#17422)
The `JsRuntimeState` struct stores a number of JS callbacks that are
used either in the event loop or when interacting with V8. Some of these
callback fields are vectors of callbacks, and therefore could plausibly
store at least one callback per realm. However, some of those fields are
`Option<v8::Global<v8::Function>>`, which would make the callbacks set
by a realm override the one that might have been set by a different
realm.

As it turns out, all of the current such optional callbacks
(`js_promise_reject_cb`, `js_format_exception_cb` and
`js_wasm_streaming_cb`) are only used from inside a realm, and therefore
this change makes it so such callbacks can only be set from inside a
realm, and will only affect that realm.

This is a reland of #15599.

Towards #13239.
2023-01-15 09:09:00 +05:30
Andreu Botella
68782346d0
feat(core): Reland support for async ops in realms (#17204)
Currently realms are supported on `deno_core`, but there was no support
for async ops anywhere other than the main realm. The main issue is that
the `js_recv_cb` callback, which resolves promises corresponding to
async ops, was only set for the main realm, so async ops in other realms
would never resolve. Furthermore, promise ID's are specific to each
realm, which meant that async ops from other realms would result in a
wrong promise from the main realm being resolved.

This change takes the `ContextState` struct added in #17050, and adds to
it a `js_recv_cb` callback for each realm. Combined with the fact that
that same PR also added a list of known realms to `JsRuntimeState`, and
that #17174 made `OpCtx` instances realm-specific and had them include
an index into that list of known realms, this makes it possible to know
the current realm in the `queue_async_op` and `queue_fast_async_op`
methods, and therefore to send the results of promises for each realm to
that realm, and prevent the ID's from getting mixed up.

Additionally, since promise ID's are no longer unique to the isolate,
having a single set of unrefed ops doesn't work. This change therefore
also moves `unrefed_ops` from `JsRuntimeState` to `ContextState`, and
adds the lengths of the unrefed op sets for all known realms to get the
total number of unrefed ops to compare in the event loop.

This PR is a reland of #14734 after it was reverted in #16366, except
that `ContextState` and `JsRuntimeState::known_realms` were previously
relanded in #17050. Another significant difference with the original PR
is passing around an index into `JsRuntimeState::known_realms` instead
of a `v8::Global<v8::Context>` to identify the realm, because async op
queuing in fast calls cannot call into V8, and therefore cannot have
access to V8 globals. This also simplified the implementation of
`resolve_async_ops`.

Co-authored-by: Luis Malheiro <luismalheiro@gmail.com>
2023-01-14 14:40:16 +01:00
David Sherret
377f593273
chore: forward 1.29.3 release back to main (#17401) 2023-01-13 13:36:51 -05:00
Yiyu Lin
a00e432297
chore: add copyright_checker tool and add the missing copyright (#17285) 2023-01-13 16:51:32 +09:00
Bartek Iwańczuk
636352e0ca
fix(npm): allow to read package.json if permissions are granted (#17209)
This commit changes signature of "deno_core::ModuleLoader::resolve" to pass
an enum indicating whether or not we're resolving a specifier for dynamic import.

Additionally "CliModuleLoader" was changes to store both "parent permissions" (or
"root permissions") as well as "dynamic permissions" that allow to check for permissions
in top-level module load an dynamic imports.

Then all code paths that have anything to do with Node/npm compat are now checking
for permissions which are passed from module loader instance associated with given
worker.
2023-01-10 14:35:44 +01:00
Leo Kettmeir
c41d4ff90e
feat(core): allow specifying name and dependencies of an Extension (#17301) 2023-01-08 23:48:46 +01:00
Chengzhong Wu
82e930726e
fix(core): get v8 console from context extra bindings (#17243)
Explicitly get `console` object from V8 instead of relying on `console`
defined on the global object.
2023-01-06 22:37:42 +01:00
Yiyu Lin
896dd56b7a
refactor(cli,core,ext,rt): remove some unnecessary clone or malloc (#17274) 2023-01-05 14:29:50 -05: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
10e4b2e140
chore: update copyright year to 2023 (#17247)
Yearly tradition of creating extra noise in git.
2023-01-02 21:00:42 +00:00
Andreu Botella
a67fd3e23e
chore(core): Make OpCtx instances be realm-specific (#17174) 2022-12-26 17:00:13 +01:00
Bartek Iwańczuk
208c91b68f
fix(core): run macrotasks and next ticks after polling dynamic imports (#17173)
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-23 19:46:24 +01:00
Bartek Iwańczuk
a8d1ffa281
fix: rejected dynamic import should retain error context (#17160)
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-22 06:26:28 +01:00
Kamil Ogórek
6a47ffa4d3
fix(core): Do not print errors prop for non-AggregateError errors (#17123)
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-21 01:18:49 +01:00
Andreu Botella
fcca54d3ba
fix(core): Have custom errors be created in the right realm (#17050)
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-20 20:09:16 +01:00
Kenta Moriuchi
948f85216a
chore: Update dlint (#17031)
Introduces `SafeSetIterator` and `SafeMapIterator` to primordials
2022-12-20 03:37:50 +01:00
Leo Kettmeir
1d18b65edc
fix(runtime): expose extensions_with_js from WorkerOptions (#17109)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-12-19 03:55:50 +01:00
David Sherret
e9ecfdd20a
fix(runtime): Deno.memoryUsage().rss should return correct value (#17088)
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-17 23:25:51 +01:00
linbingquan
f46df3e359
chore: update to Rust 1.66.0 (#17078) 2022-12-17 23:20:15 +01:00
Andreu Botella
bb8a49993b
chore(core): Small realm-related fixes (#17044)
- `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-17 00:54:00 +01:00
Bartek Iwańczuk
a202e38316
refactor(core): allow to listen for notifications in LocalInspectorSession (#17040) 2022-12-16 20:12:06 +01: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
Bartek Iwańczuk
585ec1218f
Revert "feat(ops): Fast zero copy string arguments (#16777)" (#17063)
This reverts commit 9b2b8df927.

Closes https://github.com/dsherret/ts-morph/issues/1372
Closes https://github.com/denoland/deno/issues/16979
2022-12-15 15:26:10 +00: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
Andreu Botella
929847c722
chore(core): Deduplicate event_loop_pending_state (#17039) 2022-12-13 23:28:38 +01:00
Bartek Iwańczuk
3551955b63
refactor(core): add more information when unable to build error (#17027)
This should help debug problem in
https://github.com/denoland/deno/issues/16963
2022-12-13 22:59:21 +01:00
Bartek Iwańczuk
4a17c93088
feat: add --inspect-wait flag (#17001)
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-12 15:33:30 +01:00
David Sherret
5dbc07935d
fix(test): handle scenario where --trace-ops would cause an unhandled promise rejection (#16970)
Closes #16969
2022-12-06 15:58:18 -05:00
Bartek Iwańczuk
79285fa83b
npm: ensure runtime exceptions are surfaced when debugger is attached (#16943)
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-06 02:00:10 +01:00
Bartek Iwańczuk
83b6085604
revert: Inspector changes (#16939)
Reverts 66dc54a7f and e2a0c3f0

Closes https://github.com/denoland/deno/issues/16926
2022-12-04 21:08:53 +01:00
Bert Belder
66dc54a7f5
fix(inspector): even if already woken, always schedule an interrupt (#16910) 2022-12-03 01:18:21 +01:00
Bartek Iwańczuk
e2a0c3f0dc
fix(inspector): allow to poll session with reentry (#16863)
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-02 23:17:02 +01:00
Divy Srivastava
9b2b8df927
feat(ops): Fast zero copy string arguments (#16777)
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-02 05:29:15 +00: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
David Sherret
623dbe7a57
chore: remove unnecessary lifetimes (#16878)
It seems we don't really need to allow these clippy rules.
2022-11-30 19:19:32 +00:00
Bartek Iwańczuk
f526513d74
feat(core): show unresolved promise origin (#16650)
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-28 23:07:23 +01:00
Divy Srivastava
ca66978a5a
feat(ops): fast calls for Wasm (#16776)
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-27 19:24:28 +05:30
Bartek Iwańczuk
28b5a7e2ec
feat(core): support initializing extensions with and without JS (#16789)
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-27 00:58:23 +01:00
Bartek Iwańczuk
d4f659d1d3
feat(core): send "executionContextDestroyed" notification on program end (#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-27 00:44:39 +01:00
Bartek Iwańczuk
3a320db270
fix(inspector): send "isDefault" in aux data (#16836)
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-26 23:09:48 +01:00
Bartek Iwańczuk
d8ab492d01
chore: update rusty_v8 to 0.56.1 (#16835) 2022-11-26 20:11:27 +01: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
Ikko Ashimine
04afc06b00
refactor(core): fix typo in ops_builtin.rs (#16613) 2022-11-24 15:22:39 +01:00
Leo Kettmeir
13e3acf71d
chore: workspace inheritance (#16343) 2022-11-22 21:07:35 +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
Aaron O'Mullan
238590aa9f
chore: use Rust 1.65.0 (#16688) 2022-11-18 02:59:10 +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
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
06bd9e9e16
fix(npm): disable npm specifiers in import.meta.resolve() (#16599) 2022-11-11 18:20:13 +01:00
Divy Srivastava
5b9620df7a
feat(ops): implement fast lazy async ops (#16579)
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-11 19:14:53 +05:30
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
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
Ryan Dahl
3019c45f87
refactor: simplify deno_core's grab_global and ensure_objs (#16564)
- refactor: remove JsRuntime::ensure_objs
- refactor: Replace JsRuntime::grab_global with JsRuntime::eval
2022-11-08 02:39:48 +01: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
Kenta Moriuchi
59ac110edd
fix(core): fix APIs not to be affected by Promise.prototype.then modification (#16326) 2022-10-29 18:25:23 +09:00
Bartek Iwańczuk
e202f890f0
feat(core): support creating snapshots from existing snapshots (#14744) 2022-10-28 21:31:01 +02:00
Divy Srivastava
e18950284f
Reland "perf(core): generate inlined wrappers for async ops" (#16455)
Reland https://github.com/denoland/deno/pull/16428
2022-10-28 16:50:17 +05:30
Divy Srivastava
d9e425a947
chore(core): remove TODO in bindings.rs (#16456) 2022-10-28 11:26:16 +05:30
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
Divy Srivastava
115cc1e6ae
Revert "perf(core): generate inlined wrappers for async ops (#16428)" (#16443) 2022-10-27 16:58:27 +02:00
Divy Srivastava
02187966c1
perf(core): generate inlined wrappers for async ops (#16428)
V8's JIT can do a better job knowing the argument count and also enable
fast call path (in future).

This also lets us call async ops without `opAsync`:

```js
const { ops } = Deno.core;
await ops.op_void_async();
```

this patch: 4405286 ops/sec
main: 3508771 ops/sec
2022-10-27 19:10:48 +05:30
Jan Špaček
642118fdeb
fix(core) Include causes when converting anyhow errors to JS exceptions (#16397)
When an op returns an `anyhow` error with a cause (usually added using
the `.context()` method), the `Error` thrown into JavaScript contains
only the message of the outernmost error in the chain.

This PR simply changes the formatting of `anyhow::Error` from `"{}"` to
`"{:#}"`:

This significantly improves errors for code that embeds Deno and defines
custom ops. For example, in
[chiselstrike/chiselstrike](https://github.com/chiselstrike/chiselstrike),
this PR improves an error message like

```
Error: could not plan migration
```

to

```
Error: could not plan migration: could not migrate table for entity "E": could not add column for field "title": the field does not have a default value
```
2022-10-26 17:30:44 +02:00
Bartek Iwańczuk
a57faa8a0a
core: enable --harmony-change-array-by-copy V8 flag (#16429)
Enables [Change Array by copy
proposal](https://github.com/tc39/proposal-change-array-by-copy) via a
V8 flag.
2022-10-26 16:54:22 +02:00
Cre3per
193b8828c5
feat(cli): show error cause recursion information (#16384) 2022-10-26 15:37:45 +02:00
Divy Srivastava
851db03a6e
perf(core): do not drive JsInspector by default (#16410)
Part of https://github.com/denoland/deno/pull/16377
2022-10-26 17:07:50 +05:30
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
Divy Srivastava
f242d98280
perf(core): avoid isolate slots for ModuleMap (#16409) 2022-10-25 17:57:33 +05:30
Marcos Casagrande
34fb380ed3
feat(ext/web): use ArrayBuffer.was_detached() (#16307)
This PR adds a way to reliably check if an ArrayBuffer was detached
2022-10-25 14:22:37 +02:00
Marcos Casagrande
b7d86b4bed
perf(ext/streams): fast path when consuming body of tee'd stream (#16329)
Add a fast path for consuming the body of cloned `Request`/`Response`,
which is very common specially when using `cache` API.
2022-10-24 13:13:20 +02:00
Divy Srivastava
d461a784b2
perf(core): don't access isolate slots for JsRuntimeState (#16376)
example writeFile benchmark:

```
# before
time 188 ms rate 53191
time 168 ms rate 59523
time 167 ms rate 59880
time 166 ms rate 60240
time 168 ms rate 59523
time 173 ms rate 57803
time 183 ms rate 54644

# after
time 157 ms rate 63694
time 152 ms rate 65789
time 151 ms rate 66225
time 151 ms rate 66225
time 152 ms rate 65789
```
2022-10-21 19:43:42 +05:30
Divy Srivastava
0f27b84a5c
chore(core): remove core.opSync (#16379)
This patch removes the last uses of `core.opSync` from Deno.

The new and JIT-friendly way to call sync ops is `core.ops.op_name()`.
2022-10-21 19:35:23 +05:30
Divy Srivastava
c007657cfd
Revert realms from deno_core (#16366)
This revert has been discussed at length out-of-band (including with
@andreubotella). The realms work in impeding ongoing event loop and
performance work. We very much want to land realms but it needs to wait
until these lower-level refactors are complete. We hope to bring realms
back in a couple weeks.
2022-10-21 08:24:22 +05:30
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
Divy Srivastava
d3736f12b5
perf(core): avoid creating global handles in op_queue_microtask (#16359) 2022-10-20 16:03:47 +05:30
Yusuke Tanaka
44a89dd6dc
fix(ext/net): return an error from startTls and serveHttp if the original connection is captured elsewhere (#16242)
This commit removes the calls to `expect()` on `std::rc::Rc`, which caused
Deno to panic under certain situations. We now return an error if `Rc`
is referenced by other variables.

Fixes #9360
Fixes #13345
Fixes #13926
Fixes #16241

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-18 11:28:27 +09:00