summaryrefslogtreecommitdiff
path: root/ext/node/global.rs
AgeCommit message (Collapse)Author
2024-09-04feat(cli): give access to `process` global everywhere (#25291)Luca Casonato
2024-08-28refactor: don't virtualize the `console` global for node mode (#25263)Luca Casonato
Turns out we only virtualized it so one could have a `Console` property, and the other one not. We can just make this `console.Console` available everywhere.
2024-08-17fix(ext/node): fix prismjs compatibiliy in Web Worker (#25062)Yoshiya Hinosawa
PrismJS uses `WorkerGlobalScope` and `self` for detecting browser's Web Worker context: https://github.com/PrismJS/prism/blob/59e5a3471377057de1f401ba38337aca27b80e03/prism.js#L11 Now the detection logic above is broken when it's imported from Deno's Web Worker context because we only hide `self` (Prism assumes when `WorkerGlobalScope` is available, `self` is also available). This change fixes the above by also hiding `WorkerGlobalScope` global in Node compat mode. closes #25008
2024-08-05feat: upgrade deno_core (#24886)snek
Fixes: https://github.com/denoland/deno/issues/24869 Includes changes for `node:vm` rewrite.
2024-07-31feat: upgrade V8 to 12.8 (#24693)snek
- upgrade to v8 12.8 - optimizes DataView bigint methods - fixes global interceptors - includes CPED methods for ALS - fix global resolution - makes global resolution consistent using host_defined_options. originally a separate patch but due to the global interceptor bug it needs to be included in this pr for all tests to pass.
2024-07-25refactor: decouple node resolution from deno_core (#24724)David Sherret
2024-07-19fix(ext/node): do not expose `self` global in node (#24637)Yoshiya Hinosawa
closes #23727
2024-07-09fix: do not return undefined for missing global properties (#24474)snek
accessing e.g. `Buffer` in `Mode::Deno` mode should throw, not return undefined. --------- Signed-off-by: snek <snek@deno.com>
2024-06-12fix(ext/node): fix vm memory usage and context initialization (#23976)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/22441 Fixes https://github.com/denoland/deno/issues/23913 Fixes https://github.com/denoland/deno/issues/23852 Fixes https://github.com/denoland/deno/issues/23917
2024-06-07fix: upgrade deno_core (#24128)Bartek Iwańczuk
Includes https://github.com/denoland/deno_core/pull/770 necessary for https://github.com/denoland/deno/pull/24101. Also includes https://github.com/denoland/deno_core/pull/769 that fixes https://github.com/denoland/deno/issues/24098 and https://github.com/denoland/deno/issues/24069 and https://github.com/denoland/deno/issues/24089.
2024-06-06refactor: remove `PermissionsContainer` in deno_runtime (#24119)David Sherret
Also removes permissions being passed in for node resolution. It was completely useless because we only checked it for reading package.json files, but Deno reading package.json files for resolution is perfectly fine. My guess is this is also a perf improvement because Deno is doing less work.
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-12-07fix(ext/node): include non-enumerable keys in `Reflect.ownKeys(globalThis)` ↵ud2
(#21485) Closes #21484.
2023-08-26chore: update to Rust 1.72 (#20258)林炳权
<!-- Before submitting a PR, please read https://deno.com/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. 7. Open as a draft PR if your work is still in progress. The CI won't run all steps, but you can add '[ci]' to a commit message to force it to. 8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label. --> As the title. --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-16feat(ext/node): eagerly bootstrap node (#20153)Matt Mastracci
To fix bugs around detection of when node emulation is required, we will just eagerly initialize it. The improvements we make to reduce the impact of the startup time: - [x] Process stdin/stdout/stderr are lazily created - [x] node.js global proxy no longer allocates on each access check - [x] Process checks for `beforeExit` listeners before doing expensive shutdown work - [x] Process should avoid adding global event handlers until listeners are added Benchmarking this PR (`89de7e1ff`) vs main (`41cad2179`) ``` 12:36 $ third_party/prebuilt/mac/hyperfine --warmup 100 -S none './deno-41cad2179 run ./empty.js' './deno-89de7e1ff run ./empty.js' Benchmark 1: ./deno-41cad2179 run ./empty.js Time (mean ± σ): 24.3 ms ± 1.6 ms [User: 16.2 ms, System: 6.0 ms] Range (min … max): 21.1 ms … 29.1 ms 115 runs Benchmark 2: ./deno-89de7e1ff run ./empty.js Time (mean ± σ): 24.0 ms ± 1.4 ms [User: 16.3 ms, System: 5.6 ms] Range (min … max): 21.3 ms … 28.6 ms 126 runs ``` Fixes https://github.com/denoland/deno/issues/20142 Fixes https://github.com/denoland/deno/issues/15826 Fixes https://github.com/denoland/deno/issues/20028
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-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-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>