summaryrefslogtreecommitdiff
path: root/runtime/js
AgeCommit message (Collapse)Author
2023-06-29feat: add more Deno.errors classes (#19514)Bartek Iwańczuk
This commit adds following new error classes: - `Deno.errors.NotADirectory` - `Deno.errors.FilesystemLoop` - `Deno.errors.IsADirectory` - `Deno.errors.NetworkUnreachable` Closes https://github.com/denoland/deno/issues/19408
2023-06-14perf: don't run microtask checkpoint if macrotask callback did no work (#19492)Bartek Iwańczuk
Most of the time there's no firing timers, nor pending promise rejections, so it's wasteful to run microtask checkpoint additionally twice on each tick of the event loop. Closes https://github.com/denoland/deno/issues/18871 Ref https://github.com/denoland/deno/issues/19451
2023-05-30feat(runtime): add `WorkerLogLevel` (#19316)David Sherret
This is not really used yet, but provides some infrastructure for doing more fine grained logging in JS. I will add warn messages in a future PR.
2023-05-24fix(node): fire 'unhandledrejection' event when using node: or npm: imports ↵Bartek Iwańczuk
(#19235) This commit fixes emitting "unhandledrejection" event when there are "node:" or "npm:" imports. Before this commit the Node "unhandledRejection" event was emitted using a regular listener for Web "unhandledrejection" event. This listener was installed before any user listener had a chance to be installed which effectively prevent emitting "unhandledrejection" events to user code. Closes https://github.com/denoland/deno/issues/16928
2023-05-22fix(runtime): JS debug log to stderr (#19217)David Sherret
Debug logs should all go to stderr.
2023-05-11fix(runtime): `ChildProcess::kill()` doesn't require additional perms (#15339)Nayeem Rahman
Fixes #15217.
2023-05-01perf: lazily retrieve ppid (#18940)David Sherret
This is very apparent on Windows. Before: 45.74ms (Hello world) After: 33.92ms Closes #18939
2023-05-01fix(core): Use primordials for methods (#18839)Kenta Moriuchi
I would like to get this change into Deno before merging https://github.com/denoland/deno_lint/pull/1152
2023-05-01refactor(webidl): move prefix & context out of converters options bag (#18931)Leo Kettmeir
2023-04-30refactor: remove ext/console/01_colors.js (#18927)Leo Kettmeir
2023-04-30refactor: merge Deno & Node inspectors (#18691)Leo Kettmeir
2023-04-28Revert "refactor: don't expose Deno[Deno.internal].core namespace" (#18881)Bartek Iwańczuk
Also conditionally disabled one test if there's not enough space on device.
2023-04-26refactor: don't expose Deno[Deno.internal].core namespace (#18816)Bartek Iwańczuk
2023-04-14fix(core): Use safe primordials wrappers (#18687)Kenta Moriuchi
2023-04-03refactor: remove "ext/flash" (#18578)Bartek Iwańczuk
With https://github.com/denoland/deno/pull/18568 landed we no longer need "ext/flash". This commit removes "deno_flash" extension completely. This should have some impact on the binary and snapshot size. Closes https://github.com/denoland/deno/issues/17356
2023-04-03refactor: "Deno.serve()" API uses "Deno.serveHttp()" internally (#18568)Bartek Iwańczuk
This commit changes implementation of "Deno.serve()" API to use "Deno.serveHttp()" under the hood. This change will allow us to remove the "flash" server implementation, bringing stability to the "Deno.serve()" API. "cli/tests/unit/flash_test.ts" was renamed to "serve_test.ts". Closes https://github.com/denoland/deno/issues/15574 Closes https://github.com/denoland/deno/issues/15504 Closes https://github.com/denoland/deno/issues/15646 Closes https://github.com/denoland/deno/issues/15909 Closes https://github.com/denoland/deno/issues/15911 Closes https://github.com/denoland/deno/issues/16828 Closes https://github.com/denoland/deno/issues/18046 Closes https://github.com/denoland/deno/issues/15869
2023-04-02chore: Turn back on dlintPreferPrimordials (#17715)Kenta Moriuchi
Closes #17709
2023-03-28chore: restore pty tests and make them run on the Linux CI (#18424)David Sherret
1. Rewrites the tests to be more back and forth rather than getting the output all at once (which I believe was causing the hangs on linux and maybe mac) 2. Runs the pty tests on the linux ci. 3. Fixes a bunch of tests that were just wrong. 4. Adds timeouts on the pty tests.
2023-03-28Reland "refactor: remove Deno[Deno.internal].nodeUnstable namespace" (#18475)Bartek Iwańczuk
This reverts commit 357bcfcf79fee92195e37bb3f05e247908f207c5.
2023-03-28refactor(runtime): manual serialization of bootstrap data (#18448)Bartek Iwańczuk
This commit changes how data required to bootstrap main and worker runtime is serialized. Instead of relying on serde_v8 and using JSON object, we're doing manual serialization to a "v8::Array". This limits number of V8 strings that need to be serialized by 16. It also made it clear that some data could be obtained during snapshotting instead of during bootstrap.
2023-03-27Revert "refactor: remove Deno[Deno.internal].nodeUnstable namespace (… ↵Bartek Iwańczuk
(#18458) …#18449)" This reverts commit d1a9c4cd7ce0c19ddf9c7c52c0d35d6124a7677d. Appears this made CI very flaky on macOS, but I can't repeat it locally yet
2023-03-27refactor: remove Deno[Deno.internal].nodeUnstable namespace (#18449)Bartek Iwańczuk
Since we can preserve ops in the snapshot these days, we no longer need to have "Deno[Deno.internal].nodeUnstable" namespace. Instead, various built-in Node.js modules can use appropriate APIs directly.
2023-03-22Revert "refactor: rename Deno.openKv() to Deno.kv() (#18349)" (#18362)Ryan Dahl
This reverts commit 50b793c9ed866ee29e8f04b4fa24b485b01a2b74.
2023-03-22refactor: rename Deno.openKv() to Deno.kv() (#18349)Ryan Dahl
2023-03-22feat(ext/kv): key-value store (#18232)Heyang Zhou
This commit adds unstable "Deno.openKv()" API that allows to open a key-value database at a specified path. --------- Co-authored-by: Luca Casonato <hello@lcas.dev> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-17BREAKING(unstable): remove WebGPU (#18094)Leo Kettmeir
This PR _**temporarily**_ removes WebGPU (which has behind the `--unstable` flag in Deno), due to performance complications due to its presence. It will be brought back in the future; as a point of reference, Chrome will ship WebGPU to stable on 26/04/2023. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-09fix(rumtime): Add `Deno.` prefix for registered symbols (#18086)Kenta Moriuchi
2023-03-09perf: don't add unload event listener (#18082)Bartek Iwańczuk
This commit changes how "unload" event is handled - before this commit an event listener was added unconditionally in the runtime bootstrapping function, which for some reason was very expensive (0.3ms). Instead of adding an event listener, a check was added to "dispatchEvent" function that performs the same action (so it's only called if there's an event dispatched).
2023-03-08refactor: rename InternalModuleLoader to ExtModuleLoader, use ext: scheme ↵Bartek Iwańczuk
for snapshotted modules (#18041) This commit renames "deno_core::InternalModuleLoader" to "ExtModuleLoader" and changes the specifiers used by the modules loaded from this loader to "ext:". "internal:" scheme was really ambiguous and it's more characters than "ext:", which should result in slightly smaller snapshot size. Closes https://github.com/denoland/deno/issues/18020
2023-03-08perf: move setting up Deno namespace to snapshot time (#18067)Bartek Iwańczuk
No need to do it on startup every time.
2023-03-07perf: move runtime bootstrap code to snapshot time (#18062)Bartek Iwańczuk
This commit moves some of the code from "99_main.js" to be executed during the snapshot time instead of on each worker bootstrap. These should minimally help with startup time benchmark.
2023-03-07refactor: Add "deno_fs" extension crate (#18040)Bartek Iwańczuk
This commit factors out APIs related to file system from "runtime/" to a separate "deno_fs" extension crate.
2023-03-05refactor: move "pathFromURL" to deno_web extension (#18037)Bartek Iwańczuk
This API is required by several extensions like "ext/node", "ext/ffi" and also FS APIs that we want to move to a separate crate. Because of that "pathFromURL" API was moved to "deno_web" extension so other extension crates can rely on it.
2023-03-05refactor: move definition of Deno.build from "runtime" to "core" (#18036)Bartek Iwańczuk
We use information about build in several extension crates like "ext/node" or "runtime/". In an effort to move "fs" APIs to a separate crate it is a prerequisite to have this information available outside of the "runtime/" crate. This commit moves definition of "build" object to "Deno.core" that is later forwarded to "Deno.build".
2023-03-05refactor(runtime): merge "spawn" into "process" (#18022)Bartek Iwańczuk
This commit merges "runtime/js/40_spawn.js" into "runtime/js/40_process.js", and "runtime::ops::spawn" into "runtime::ops::process". It makes little sense to have them separated given that we want to factor out these APIs into a separate extension crate.
2023-03-05refactor(runtime): remove 40_files.js, 40_write_file.js and 40_read_file.js ↵Bartek Iwańczuk
(#18018) JavaScript APIs from "runtime/js/40_files.js" combined abstractions for stdio streams ("Stdout", "Stderr", "Stdin") and file system file ("File", "FsFile"). APIs from "runtime/js/40_read_file.js" and "runtime/js/40_write_file.js" were implemented using ops from "runtime/ops/fs.rs". This file was removed and relevant APIs were moved to "deno_io/12_io.js" and "runtime/js/30_fs.js". This work is meant to enable factoring out "deno_fs" crate.
2023-03-05refactor: remove unused 40_diagnostics.js file (#18021)Bartek Iwańczuk
This file was not used anywhere - even though it exposed an unstable "Deno.DiagnosticCategory" API. Seems like a left over from when we had "Deno.emit" API.
2023-03-05refactor(core): include_js_files! 'dir' option doesn't change specifiers ↵Bartek Iwańczuk
(#18019) This commit changes "include_js_files!" macro from "deno_core" in a way that "dir" option doesn't cause specifiers to be rewritten to include it. Example: ``` include_js_files! { dir "js", "hello.js", } ``` The above definition required embedders to use: `import ... from "internal:<ext_name>/js/hello.js"`. But with this change, the "js" directory in which the files are stored is an implementation detail, which for embedders results in: `import ... from "internal:<ext_name>/hello.js"`. The directory the files are stored in, is an implementation detail and in some cases might result in a significant size difference for the snapshot. As an example, in "deno_node" extension, we store the source code in "polyfills" directory; which resulted in each specifier to look like "internal:deno_node/polyfills/<module_name>", but with this change it's "internal:deno_node/<module_name>". Given that "deno_node" has over 100 files, many of them having several import specifiers to the same extension, this change removes 10 characters from each import specifier.
2023-03-05refactor(runtime): factor out deno_io extension crate (#18001)Bartek Iwańczuk
This is a prerequisite to factor out FS ops to a separate crate.
2023-03-01fix(core): introduce `SafeRegExp` to primordials (#17592)Kenta Moriuchi
2023-02-23fix(core): remove async op inlining optimization (#17899)Divy Srivastava
Runtime generation of async op wrappers contributed to increased startup time and core became unusable with `--disallow-code-generation-from-strings` flag. The optimization only affects very small microbenchmarks so this revert will not cause any regressions.
2023-02-22perf(core, runtime): Further improve startup time (#17860)Bartek Iwańczuk
This commit further improves startup time by: - no relying on "JsRuntime::execute_script" for runtime bootstrapping, this is instead done using V8 APIs directly - registering error classes during the snapshot time, instead of on startup Further improvements can be made, mainly around removing "core.initializeAsyncOps()" which takes around 2ms. This commit should result in ~1ms startup time improvement.
2023-02-16test: add unit tests from std/node (#17794)Bartek Iwańczuk
Adds two test files: "cli/tests/unit_node/process_test.ts" and "cli/tests/unit_node/child_process_test.ts" --------- Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-02-14feat(ext/node): embed std/node into the snapshot (#17724)Bartek Iwańczuk
This commit moves "deno_std/node" in "ext/node" crate. The code is transpiled and snapshotted during the build process. During the first pass a minimal amount of work was done to create the snapshot, a lot of code in "ext/node" depends on presence of "Deno" global. This code will be gradually fixed in the follow up PRs to migrate it to import relevant APIs from "internal:" modules. Currently the code from snapshot is not used in any way, and all Node/npm compatibility still uses code from "https://deno.land/std/node" (or from the location specified by "DENO_NODE_COMPAT_URL"). This will also be handled in a follow up PRs. --------- Co-authored-by: crowlkats <crowlkats@toaxl.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com> Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-02-14feat: stabilize Deno.osUptime() (#17554)Bartek Iwańczuk
This commit stabilizes "Deno.osUptime()" API. The "--unstable" flag is no longer required to use this API.
2023-02-13feat: Stabilize Deno.Command API (#17628)Bartek Iwańczuk
This commit stabilizes "Deno.Command" API with all its related APIs. "--unstable" flag is no longer required to use this API.
2023-02-12fix: add WouldBlock error (#17339)Leo Kettmeir
2023-02-08refactor: internal runtime code TS support (#17672)Leo Kettmeir
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-07 refactor: remove prefix from include_js_files & use extension name (#17683)Leo Kettmeir
2023-02-07refactor: Use ES modules for internal runtime code (#17648)Leo Kettmeir
This PR refactors all internal js files (except core) to be written as ES modules. `__bootstrap`has been mostly replaced with static imports in form in `internal:[path to file from repo root]`. To specify if files are ESM, an `esm` method has been added to `Extension`, similar to the `js` method. A new ModuleLoader called `InternalModuleLoader` has been added to enable the loading of internal specifiers, which is used in all situations except when a snapshot is only loaded, and not a new one is created from it. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>