Commit graph

181 commits

Author SHA1 Message Date
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 91443bbc0b
fix(compile): ensure import map is used when specified in deno config file (#16990)
Closes #14246
2022-12-08 11:50:09 -05:00
David Sherret 2d4c46c975
refactor: create util folder, move nap_sym to napi/sym, move http_cache to cache folder (#16857) 2022-11-28 17:28:54 -05:00
Bartek Iwańczuk fd51b2e506
fix(npm): allow to inspect npm modules with --inspect-brk (#16841) 2022-11-28 21:59:36 +01:00
David Sherret 0c0af67f89
refactor: DenoDir - move to cache folder and make root_dir private (#16823) 2022-11-26 00:04:30 +00: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
David Sherret d6fd171394
fix(install): support npm specifiers (#16634)
Supports npm specifiers for `deno install`. This will by default always
use a lockfile (which is generated on first run) unless `--no-lock` is
specified.
2022-11-14 22:40:05 -05:00
Mathias Lafeldt 92764c0dec
feat(runtime): support creating workers with custom v8 snapshots (#16553)
This PR makes it possible for applications to create workers from custom
snapshots to improve runtime performance (without having to fork/copy
`runtime/workers.rs`).
2022-11-10 12:46:26 +01:00
Bartek Iwańczuk 2c674dcd20
refactor(npm): reorganize initialization of compat layer (#16471)
Ensures that "std/node" graph is analyzed only once.
2022-10-28 21:53:55 +02:00
Luca Matei Pintilie 1a0c7edeba
feat: introduce navigator.language (#12322)
Link to the spec:
https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-language-dev

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-18 15:33:35 +02:00
David Sherret d677ba67f5
feat(npm): functionality to support child_process.fork (#15891) 2022-09-28 13:04:16 -04:00
Satya Rohith b312279e58
feat: implement Web Cache API (#15829) 2022-09-28 17:41:12 +05:30
Mathias Lafeldt 4b01ef5c23
chore: use Rust 1.64.0 (#16035) 2022-09-26 21:52:16 +02:00
Divy Srivastava 6154188786
perf(ext/console): avoid wrapConsole when not inspecting (#15931) 2022-09-17 15:34:43 +05:30
David Sherret 73efed218f
refactor(npm): create general use NpmPackageResolver (#15882) 2022-09-13 11:59:01 -04:00
Nayeem Rahman 118dd47ad0
fix(watch): ignore unload errors on drop (#15782) 2022-09-06 13:18:23 +02:00
Bartek Iwańczuk d20e80fa50
refactor(npm): reorganize remapping built-in Node modules to remote URLs (#15755)
Changes how built-in Node modules are mapped to polyfills
from "deno_std". Instead of intertwining this logic into Node
resolution logic, we map them to "NodeResolution::BuiltIn"
which are remapped to "deno_std" URLs in ProcState.
2022-09-06 12:57:28 +02:00
Bartek Iwańczuk e324151520
BREAKING(unstable): remove --compat mode (#15678)
This commit removes "compat" mode. We shipped support for "npm:" specifier
support in v1.25 and that is preferred way to interact with Node code that we
will iterate and improve upon.
2022-09-03 18:19:30 +02:00
Christian Dürr 63b8089bda
refactor: move JsError formatting to deno_runtime (#15345)
This takes the existing `fmt_error` module from cli and puts it as a
public module into `deno_runtime`.
2022-09-02 22:53:23 +02:00
Nayeem Rahman 4f8dea100e
refactor(test): grab runTests() and runBenchmarks() from __bootstrap (#15420) 2022-09-02 19:44:45 +02:00
David Sherret 452df99222
feat(npm): support packages with multiple command names (#15565) 2022-08-23 22:01:21 -04:00
David Sherret e7367044d9
feat: binary npm commands (#15542) 2022-08-23 10:39:19 -04:00
David Sherret 87f80ff6be
feat(unstable): initial support for npm specifiers (#15484)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-08-20 11:31:33 -04:00
David Sherret 868c7e38bf
feat(runtime): add pre_execute_module_cb (#15485) 2022-08-16 21:00:35 -04:00
David Sherret 8eed24cd3d
fix(coverage): ensure coverage is only collected in certain situations (#15467) 2022-08-12 15:21:17 -04:00
David Sherret c3b04683c5
refactor(cli): consolidate most MainWorker related code to the same place (#15459) 2022-08-11 16:59:12 -04:00
Bartek Iwańczuk 2e74f164b6
refactor: deno_runtime crate (#8640)
This commit moves Deno JS runtime, ops, permissions and
inspector implementation to new "deno_runtime" crate located
in "runtime/" directory.

Details in "runtime/README.md".

Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-12-13 19:45:53 +01:00
Bartek Iwańczuk 31935c6b8d
refactor(cli): more options on Worker (#8724) 2020-12-12 00:36:18 +01:00
Bartek Iwańczuk 65e72b68ac
refactor(cli): decouple ops from ProgramState and Flags (#8659)
This commit does major refactor of "Worker" and "WebWorker",
in order to decouple them from "ProgramState" and "Flags".
The main points of interest are "create_main_worker()" and
"create_web_worker_callback()" functions which are responsible
for creating "Worker" and "WebWorker" in CLI context.
As a result it is now possible to factor out common "runtime"
functionality into a separate crate.
2020-12-11 18:49:26 +01:00
Bartek Iwańczuk c8e9b2654e
refactor(cli): Simplify choosing type lib in CliModuleLoader (#8637) 2020-12-07 11:03:03 +01:00
Bartek Iwańczuk c0ccbcdaee
refactor(cli): Reorganize worker code, use stronger memory ordering (#8638) 2020-12-07 04:30:40 +01:00
Bartek Iwańczuk f49d955601
fix(compile): disable source mapping of errors (#8581)
This commit disables source mapping of errors
for standalone binaries. Since applying source
maps relies on using file fetcher infrastructure
it's not feasible to use it for standalone binaries
that are not supposed to use that infrastructure.
2020-12-01 23:33:44 +01:00
Luca Casonato 6aa692fece
feat: deno compile (#8539) 2020-11-30 20:35:12 +01:00
Bartek Iwańczuk 85a5a081b2
refactor(cli): reorganize main.rs and split workers (#8495)
Factored out "init_v8_flags", "init_logger" and 
"get_subcommand" from "main" function.

Also "Worker" was removed in favor of moving 
logic to "MainWorker" and "WebWorker" respectively.
2020-11-26 15:17:45 +01:00
Bartek Iwańczuk 04f4201f30
refactor(corr): accept get_error_class_fn in RuntimeOptions (#8444)
This commit adds "get_error_class_fn" field to "RuntimeOptions"
struct in order to unify configuration of "JsRuntime".
2020-11-21 15:56:14 +01:00
Bartek Iwańczuk e582796f42
refactor(cli): rename fmt_errors::JsError to PrettyJsError (#8435)
This commit renames "fmt_errors::JsError" to "PrettyJsError"
to avoid confusion with "deno_core::JsError".

Consequently "CoreJsError" aliases to "deno_core::JsError"
were removed.

Additionally source mapping step has been removed from
"PrettyJsError::create" to better separate domains.
2020-11-19 20:37:22 +01:00
Divy Srivastava d5661f677e
refactor: deno_crypto op crate (#7956)
This commit factors out "deno_crypto" op crate.

"rand" crate dependency was consequently moved to 
"deno_crypto" crate and reexported.
2020-11-13 22:01:57 +01:00
Bartek Iwańczuk c3dd19c5d3
refactor(cli): remove ProgramState::permissions (#8228)
This commit removes ProgramState::permissions field.

Having permissions parsed from CLI flags stored on globally
accessible state object made it easy to mistakenly use these
permissions in situations which required "runtime" permissions.
2020-11-02 23:37:55 +01:00
Kitson Kelly 7e2c7fb6c5
refactor(cli): migrate run and cache to new infrastructure (#7996)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-10-23 11:50:15 +11:00
Nayeem Rahman 7aba07cc77
fix(cli/worker): Print error stacks from the origin Worker (#7987)
Fixes #4728
2020-10-20 15:05:42 +11:00
Bartek Iwańczuk 135053486c
fix: top-level-await module execution (#7946)
This commit changes implementation of top-level-await in "deno_core".

Previously promise returned from module evaluation was not awaited,
leading to out-of-order execution of modules that have TLA. It's been
fixed by changing "JsRuntime::mod_evaluate" to be an async function
that resolves when the promise returned from module evaluation also
resolves. When waiting for promise resolution event loop is polled
repeatedly, until there are no more dynamic imports or pending
ops.
2020-10-14 14:04:09 +02:00
Bartek Iwańczuk 0bd3cea0ff
refactor(cli): rename GlobalState to ProgramState (#7914) 2020-10-13 13:35:35 +02:00
Kitson Kelly 26639b3bac
chore(cli): remove dead code (#7941) 2020-10-12 22:25:25 +11:00
Bartek Iwańczuk 527628e186
reland JsRuntime/Worker is not a Future (#7924) 2020-10-11 13:20:40 +02:00
Ryan Dahl 08bb8b3d53
Fix 100% CPU idling problem by reverting #7672 (#7911)
* Revert "refactor: Worker is not a Future (#7895)"

This reverts commit f4357f0ff9.

* Revert "refactor(core): JsRuntime is not a Future (#7855)"

This reverts commit d8879feb8c.

* Revert "fix(core): module execution with top level await (#7672)"

This reverts commit c7c7677825.
2020-10-10 11:41:11 +02:00
Bartek Iwańczuk f4357f0ff9
refactor: Worker is not a Future (#7895)
This commit rewrites deno::Worker to not implement Future
trait.

Instead there are two separate methods:
- Worker::poll_event_loop() - does single tick of event loop
- Worker::run_event_loop() - runs event loop to completion

Additionally some cleanup to Worker's field visibility was done.
2020-10-09 19:08:10 +02:00
Bartek Iwańczuk d8879feb8c
refactor(core): JsRuntime is not a Future (#7855)
This commit rewrites deno_core::JsRuntime to not implement Future
trait.

Instead there are two separate methods:
- JsRuntime::poll_event_loop() - does single tick of event loop
- JsRuntime::run_event_loop() - runs event loop to completion
2020-10-07 22:30:06 +02:00
Bartek Iwańczuk 9b70f2f345
refactor: rename isolate to js_runtime (#7858)
This commit renames occurrences of "isolate" variable name
to "js_runtime". This was outstanding debt after renaming
deno_core::CoreIsolate to JsRuntime.
2020-10-07 17:20:20 +02:00
Bartek Iwańczuk 83f6def3c6
refactor(core): JsRuntime doesn't defer to OwnedIsolate (#7853)
Remove Deref and DeferMut implementations for JsRuntime.
2020-10-07 15:56:52 +02:00
Bartek Iwańczuk c7c7677825
fix(core): module execution with top level await (#7672)
This commit fixes implementation of top level await in "deno_core".

Previously promise returned from module execution was ignored causing to execute
modules out-of-order.

With this commit promise returned from module execution is stored on "JsRuntime"
and event loop is polled until the promise resolves.
2020-10-06 10:18:22 +02:00