Luca Casonato
971f09abe4
fix(runtime): use more null proto objects ( #23921 )
...
This is a primordialization effort to improve resistance against users
tampering with the global `Object` prototype.
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-23 00:03:35 +02:00
David Sherret
e39b94f3aa
fix(runtime): output to stderr with colors if a tty and stdout is piped ( #23813 )
...
This also fixes a bug where Deno would output to stderr with colours
when piped and stdout was not piped.
2024-05-14 17:32:09 -04:00
Bartek Iwańczuk
77b90f408c
Revert "fix(console): support NO_COLOR and colors option in all scena… ( #22507 )
...
…rios (#21910 )"
This reverts commit bd1358efab
.
This change caused https://github.com/denoland/deno/issues/22496 and
https://github.com/denoland/deno/issues/22445
2024-02-21 00:17:50 +00:00
Leo Kettmeir
bd1358efab
fix(console): support NO_COLOR and colors option in all scenarios ( #21910 )
...
Noticed in #21607
2024-02-12 14:35:23 +01:00
Bartek Iwańczuk
345423cf76
refactor: Use virtul ops module ( #22175 )
...
Follow up to #22157 .
This leaves us with 4 usages of `ensureFastOps()` in `deno` itself.
There's also about 150 usages of `Deno.core.ops.<op_name>` left as well.
2024-01-29 22:02:26 +01:00
Bartek Iwańczuk
5143b9e7d3
feat(unstable): add Temporal API support ( #21738 )
...
This commit adds support for [Stage 3 Temporal API
proposal](https://tc39.es/proposal-temporal/docs/ ).
The API is available when `--unstable-temporal` flag is passed.
---------
Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
Co-authored-by: Kenta Moriuchi <moriken@kimamass.com>
2024-01-15 01:26:57 +01:00
Kenta Moriuchi
515a34b4de
refactor: use core.ensureFastOps()
( #21888 )
2024-01-10 15:37:25 -07:00
Kenta Moriuchi
b2cd254c35
fix: strict type check for cross realms ( #21669 )
...
Deno v1.39 introduces `vm.runInNewContext`. This may cause problems when
using `Object.prototype.isPrototypeOf` to check built-in types.
```js
import vm from "node:vm";
const err = new Error();
const crossErr = vm.runInNewContext(`new Error()`);
console.assert( !(crossErr instanceof Error) );
console.assert( Object.getPrototypeOf(err) !== Object.getPrototypeOf(crossErr) );
```
This PR changes to check using internal slots solves them.
---
current:
```
> import vm from "node:vm";
undefined
> vm.runInNewContext(`new Error("message")`)
Error {}
> vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`)
Date {}
```
this PR:
```
> import vm from "node:vm";
undefined
> vm.runInNewContext(`new Error("message")`)
Error: message
at <anonymous>:1:1
> vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`)
2018-12-10T02:26:59.002Z
```
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-04 09:42:38 +05:30
David Sherret
7e72f3af61
chore: update copyright to 2024 ( #21753 )
2024-01-01 19:58:21 +00:00
Bartek Iwańczuk
f85d65e066
chore: update deno_core to 0.240.0 ( #21726 )
2023-12-28 19:30:07 +00:00
Kenta Moriuchi
68241234fa
fix(console): inspect for {Set,Map}Iterator
and Weak{Set,Map}
( #21554 )
2023-12-19 15:05:49 +09:00
Bartek Iwańczuk
c1fc7b2cd5
refactor: pull 'core', 'internals', 'primordials' from ES module ( #21462 )
...
This commit refactors how we access "core", "internals" and
"primordials" objects coming from `deno_core`, in our internal JavaScript code.
Instead of capturing them from "globalThis.__bootstrap" namespace, we
import them from recently added "ext:core/mod.js" file.
2023-12-07 14:21:01 +01:00
Jordan Harband
334c118c97
refactor (parseCssColor): use parseInt, avoid unnecessary coercion ( #20856 )
...
Upstream some changes from https://github.com/nodejs/node/pull/49205
Signed-off-by: Jordan Harband <ljharb@gmail.com>
2023-11-30 18:33:44 +00:00
Leo Kettmeir
32c041c8d7
Reland "fix(ext/console): fix inspecting iterators error. ( #20720 )" ( #21370 )
2023-11-28 16:07:48 +01:00
Bartek Iwańczuk
9b9ec44db7
Revert "fix(ext/console): fix inspecting iterators error. ( #20720 )" ( #21191 )
...
This reverts commit 0209f7b469
.
Reverting because it causes failures on `main`:
https://github.com/denoland/deno/pull/20720#issuecomment-1809166755
2023-11-13 22:16:23 +00:00
Chen Su
0209f7b469
fix(ext/console): fix inspecting iterators error. ( #20720 )
...
Fixes #19776 and #20676 .
2023-11-13 20:13:20 +01:00
Divy Srivastava
1ef617e8f3
perf: lazy bootstrap options - first pass ( #21164 )
...
Move most runtime options to be lazily loaded. Constant options will be
covered in a different PR.
Towards https://github.com/denoland/deno/issues/21133
2023-11-13 04:52:59 +00:00
Matt Mastracci
612818d043
fix(cli): ensure that an exception in getOwnPropertyDescriptor('constructor') doesn't break Deno.inspect ( #20568 )
...
Fixes #20561
2023-09-19 18:24:19 +00:00
Nicholas Berlette
b6253370cc
fix(console): correct the parseCssColor algorithm ( #19645 )
...
This is a fix for issue #19644 , concerning the `parseCssColor` function
in the file `ext/console/01_console.js`. Changes made on lines
2756-2758. To sum it up:
> The internal `parseCssColor` function currently parses 3/4-digit hex
colors incorrectly. For example, it parses the string `#FFFFFF` as
`[255, 255, 255]` (as expected), but returns `[240, 240, 240]` for
`#FFF`, when it should return the same triplet as the former.
While it's not going to cause a fatal runtime error, it did bug me
enough to fix it real quick.
2023-06-28 19:46:30 -06:00
Leo Kettmeir
558eb9f132
fix(console): add assert function ( #19635 )
2023-06-28 17:29:16 +02:00
Martin Fischer
801b9ec62d
chore: fix typos ( #19572 )
2023-06-26 09:10:27 -04:00
ud2
2052ba343c
fix(ext/console): fix inspecting large ArrayBuffers ( #19373 )
2023-06-06 11:06:00 +02:00
Kenta Moriuchi
d54ef02dfe
chore: update deno_lint to 0.46.0 ( #19372 )
2023-06-05 15:57:01 -04:00
Leo Kettmeir
08bd23970d
feat: add more options to Deno.inspect ( #19337 )
...
For https://github.com/denoland/deno_std/issues/3404
---------
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-06-05 12:25:47 +02:00
Nayeem Rahman
ffb0318e4a
fix(console): handle error when inspecting promise-like ( #19083 )
...
Fixes
https://discord.com/channels/684898665143206084/684911491035430919/1105900195406958672 .
This was caused by:
- A `TypeError` from `core.getPromiseDetails()` for promise-likes which
also lead to that code path.
- Swallowing internal formatting errors by returning `undefined`. I've
made it so that a special message is formatted in that case instead
(note that this case is fixed now):
![image](https://github.com/denoland/deno/assets/29990554/65bb9612-60b2-4e31-bf5e-e20976601593 )
2023-05-11 15:08:17 +02:00
Kenta Moriuchi
49eb887cc6
refactor(core): Use ObjectHasOwn
instead of ObjectPrototypeHasOwnProperty
( #18952 )
...
ES2022 `Object.hasOwn` can be used in snapshot, so I migrate to use it.
2023-05-02 12:15:45 +02:00
Kenta Moriuchi
6728ad4203
fix(core): Use primordials for methods ( #18839 )
...
I would like to get this change into Deno before merging
https://github.com/denoland/deno_lint/pull/1152
2023-05-01 15:30:02 +02:00
Leo Kettmeir
59825a95b4
refactor: remove ext/console/01_colors.js ( #18927 )
2023-04-30 09:11:37 +00:00