1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00
Commit graph

12364 commits

Author SHA1 Message Date
Marvin Hagemeister
bf05615047 chore: update comment 2024-09-23 10:44:40 +02:00
Marvin Hagemeister
7946daaabc fix: managed globals length 2024-09-23 10:43:49 +02:00
Marvin Hagemeister
2a8db23fd8 feat(cli): expose node global everywhere 2024-09-23 10:39:51 +02:00
Volker Schlecht
37cedefb4d
fix(ext/node): stub cpu_info() for OpenBSD (#25807)
Add an implementation of cpu_info() for OpenBSD, that returns a
correctly-sized array. Since Rust's libc bindings for OpenBSD do not
contain all symbols necessary for a full implementation and it is not
planned to add them, this solution at least avoids problems with code
that relies on cpu_info() purely for the size of the returned array to
derive the number of available CPUs.

This addresses https://github.com/denoland/deno/issues/25621
2024-09-23 09:08:16 +05:30
Bartek Iwańczuk
ef3e4a8f74
feat: Show hints when using window global (#25805)
This commit adds better handling for terminal errors when
`window` global is used. This global is removed in Deno 2,
and while we have lints to help with that, an information and
hints are helpful to guide users to working code.

Ref https://github.com/denoland/deno/issues/25797
2024-09-23 00:05:42 +02:00
Divy Srivastava
0cb00a6e89
BREAKING(webgpu/unstable): move width and height options to UnsafeWindowSurface constructor (#24200)
Fixes https://github.com/denoland/deno/issues/23508

`width` and `height` are required to configure the wgpu surface because
Deno is headless and depends on user to create a window. The options
were non-standard extension of `GPUCanvasConfiguration#configure`.

This PR adds a required options parameter with the `width` and `height`
options to `Deno.UnsafeWindowSurface` constructor.

```typescript
// Old, non-standard extension of GPUCanvasConfiguration
const surface = new Deno.UnsafeWindowSurface("x11", displayHandle, windowHandle);

const context  = surface.getContext();
context.configure({ width: 600, height: 800, /* ... */ });
```

```typescript
// New
const surface = new Deno.UnsafeWindowSurface({
  system: "x11",
  windowHandle,
  displayHandle,
  width: 600,
  height: 800,
});

const context  = surface.getContext();
context.configure({ /* ... */ });
```
2024-09-22 09:10:54 +05:30
Nathan Whitaker
9be8dce0c7
fix(node): Include "node" condition during CJS re-export analysis (#25785)
Fixes #25777.

We were missing the "node" condition, so we were resolving to the wrong
conditional export, causing our analysis to be incorrect.
2024-09-21 16:10:38 -07:00
Nathan Whitaker
4b022103a1
chore: Revert child_process close ordering change (#25781)
From
https://github.com/denoland/deno/commit/18b89d948dcb849c4dc577478794c3d5fb23b59

May have caused the recent flakiness of
parallel/test-child-process-ipc-next-tick.js
2024-09-20 23:46:42 +00:00
carles escrig royo
88a469e823
perf(ext/web): optimize performance.measure() (#25774)
This PR optimizes the case when `performance.measure()` needs to find
the startMark by name. It is a simple change on `findMostRecent` fn to
avoiding copying and reversing the complete entries list.

Adds minor missing tests for:
- `clearMarks()`, general
- `clearMeasures()`, general
- `measure()`, case when the startMarks name exists more than once

### Benchmarks

#### main

```
    CPU | AMD Ryzen 7 PRO 6850U with Radeon Graphics
Runtime | Deno 2.0.0-rc.4 (x86_64-unknown-linux-gnu)

benchmark              time/iter (avg)        iter/s      (min … max)           p75      p99     p995
---------------------- ----------------------------- --------------------- --------------------------
worst case measure()            2.1 ms         486.9 (  1.7 ms …   2.4 ms)   2.2 ms   2.4 ms   2.4 ms
```

#### this PR

```
    CPU | AMD Ryzen 7 PRO 6850U with Radeon Graphics
Runtime | Deno 2.0.0-rc.4 (x86_64-unknown-linux-gnu)

benchmark              time/iter (avg)        iter/s      (min … max)           p75      p99     p995
---------------------- ----------------------------- --------------------- --------------------------
worst case measure()          966.3 µs         1,035 (876.9 µs …   1.1 ms)   1.0 ms   1.1 ms   1.1 ms
```

```ts
Deno.bench("worst case measure()", (b) => {
  performance.mark('start');

  for (let i = 0; i < 1e5; i += 1) {
    performance.mark(crypto.randomUUID());
  }

  b.start();

  performance.measure('total', 'start');

  b.end();

  performance.clearMarks();
  performance.clearMeasures();
});
```
2024-09-20 16:24:59 -07:00
Bartek Iwańczuk
55c22ee1bd
fix: panic when require(esm) (#25769)
Upgrades `deno_core`.

Closes https://github.com/denoland/deno/issues/25761
Closes https://github.com/denoland/deno/issues/25738
2024-09-20 23:16:10 +02:00
Pig Fang
20ed4f5718
feat(fmt): upgrade markup_fmt (#25768)
Fixes #25259 
Fixes #25687
2024-09-20 21:11:34 +00:00
Nathan Whitaker
4b131d24a7
fix(cli): Default to auto with --node-modules-dir flag (#25772)
Fixes a regression where we were ignoring `--node-modules-dir` if there
was no value passed with it. We should instead default to "auto", to
maintain compat with deno 1
2024-09-20 13:55:33 -07:00
Satya Rohith
94bdebe399
refactor(tests): migrate npm itests to specs (#25764)
Towards https://github.com/denoland/deno/issues/25241
2024-09-20 22:38:32 +02:00
Leo Kettmeir
3e053f8f06
fix(flags): properly error out for urls (#25770)
Closes https://github.com/denoland/deno/issues/25760
2024-09-20 11:10:46 -07:00
Divy Srivastava
92fc702cec
fix(ext/crypto): ensure EC public keys are exported uncompressed (#25766)
Fixes https://github.com/denoland/deno/issues/18050
2024-09-20 20:59:05 +05:30
Bartek Iwańczuk
471a15ecff
test: make specs::test::doc_success less flaky (#25765)
Missed this line in https://github.com/denoland/deno/pull/25726
2024-09-20 13:14:02 +00:00
Divy Srivastava
a92ebd95a1
fix(ext/crypto): reject empty usages in SubtleCrypto#importKey (#25759)
Fixes https://github.com/denoland/deno/issues/19051
2024-09-20 18:02:28 +05:30
Divy Srivastava
cbdeb35891
chore: update tools allow-run list (#25756) 2024-09-20 14:32:25 +05:30
Divy Srivastava
1fb482863e
chore: update sui to 0.3.1 (#25758) 2024-09-20 14:32:15 +05:30
Yoshiya Hinosawa
66fb81ea85
fix(coverage): ignore urls from doc testing (#25736) 2024-09-20 15:04:22 +09:00
snek
a01dce3a25
fix: cjs resolution cases (#25739)
Fixes cjs modules being loaded as esm.
2024-09-19 21:10:34 -07:00
Nathan Whitaker
f1ba266613
fix(node): Don't error out if we fail to statically analyze CJS re-export (#25748)
Fixes rsbuild running in deno.

You can look at the test to see what was failing, the gist is that we
were trying to statically analyze the re-exports of a CJS script, and if
we couldn't find the source for the re-exported file we would fail.

Instead, we should just treat these as if they were too dynamic to
analyze, and let it fail (or succeed) at runtime. This aligns with
node's behavior.
2024-09-19 18:37:36 -07:00
Bartek Iwańczuk
5bcea1a9f4
ci: increase timeout to 180 minutes (#25750)
Mac aarch64 is failing with timeout after 150 minutes :( we'll address
it after Deno 2 is released but for now just increase the timeout.
2024-09-20 00:05:20 +00:00
Nathan Whitaker
6a04bbe076
fix(cli): Only set allow net flag for deno serve if not already allowed all (#25743)
Fixes #25740
2024-09-19 15:03:57 -07:00
Bartek Iwańczuk
dad5678baa
v2.0.0-rc.4 (#25728) 2024-09-19 17:59:53 +02:00
Bartek Iwańczuk
dcc95112f7
ci: revert changed to canary uploads (#25733)
All these changes made CI fail consistently with random exit code 1
after successful upload.
2024-09-19 13:54:59 +00:00
Divy Srivastava
e97f00f6f6
fix(ext/node): support x509 certificates in createPublicKey (#25731)
Fixes https://github.com/denoland/deno/issues/25681
2024-09-19 19:12:23 +05:30
Luca Casonato
159ac45a85
fix(ext/console): more precision in console.time (#25723) 2024-09-19 14:41:05 +02:00
Bartek Iwańczuk
236a298f9d
ci: fix 'promote_to_release' script (#25727)
This CI action was using wrong variable to create release directory.
2024-09-19 13:48:06 +02:00
Bartek Iwańczuk
d7aafda243
test: make specs::test::doc_success less flaky (#25726)
On Windows some of these steps were taking more than 1s
2024-09-19 13:47:52 +02:00
Bartek Iwańczuk
51cac074dc
ci: Fix uploading latest canary version (#25725) 2024-09-19 11:46:40 +00:00
Leo Kettmeir
bb45446fa7
fix: don't include extensionless files in file collection for lint & fmt by default (#25721)
When using the `ext` flag, it will still attempt formatting them with
the provided extension
2024-09-19 11:25:48 +02:00
Sean McArthur
68065351df
fix(ext/fetch): fix lowercase http_proxy classified as https (#25686)
While investigating something else, I noticed this typo which treated
`http_proxy` as `Filter::Https`.
2024-09-19 08:03:07 +00:00
Ian Bull
d420829908
refactor(ext/kv): align error messages (#25500)
Towards https://github.com/denoland/deno/issues/25269
2024-09-19 13:20:09 +05:30
Ian Bull
3035cdddb8
refactor(ext/webidl): align error messages (#25625)
Towards https://github.com/denoland/deno/issues/25269
2024-09-19 13:03:32 +05:30
Yusuke Tanaka
0ea71abdef
fix(cli): handle edge cases around exports in doc tests and default export (#25720)
This commit fixes issues with the pseudo test file generation logic,
namely:

- `export`s declared in snippets
- auto import insertion for `default export`

## Case 1: `export`s declared in snippets

In the previous implementation, `export`s declared in snippets were
moved to the top level of the module in the generated pseudo test file.
This is required because `export` must be at the top level.

This becomes a problem if such a `export` has a body, containing a
reference to a local variable. Suppose we extract this snippet from
JSDoc:

```ts
const logger = createLogger("my-awesome-module");

export function sum(a: number, b: number): number {
  logger.debug("sum called");
  return a + b;
}
```

This gets converted into the following invalid code (note that `export
function sum` is moved to the top level, but its body references
`logger` variable which can't be referenced from here):

```ts
export function sum(a: number, b: number): number {
  logger.debug("sum called");
  return a + b;
}

Deno.test("./base.ts$1-7.ts", async () => {
  const logger = createLogger("my-awesome-module");
});
```

To resolve this issue, this commit adds a logic to remove the `export`
keyword, allowing the exported items to stay in the `Deno.test` block
scope, like so:

```ts
Deno.test("./base.ts$1-7.ts", async () => {
  const logger = createLogger("my-awesome-module");

  function sum(a: number, b: number): number {
    logger.debug("sum called");
    return a + b;
  }
});
```

## Case 2: default export

Previously `default export foo` was not captured by the export
collector, so auto import insertion didn't work for this case. To put it
concretely, the following code snippet didn't work when run with `deno
test --doc` because `import foo from "file:///path/to/mod.ts"` didn't
get inserted automatically:

```ts
/**
 * ```ts
 * console.log(foo);
 * ```
 * 
 * @module
 */

const foo = 42;
export default foo;
```

This commit fixes this issue and the above example works fine.

---

Fixes #25718
2024-09-19 00:19:40 -07:00
Ian Bull
486cb18fc5
refactor(ext/webgpu): align error messages (#25719)
Aligns the error messages in the ext/webgpu folder to be in-line with
the Deno style guide.

https://github.com/denoland/deno/issues/25269
2024-09-19 09:14:54 +02:00
Yoshiya Hinosawa
f460188e58
fix(ext/node): don't throw error for unsupported signal binding on windows (#25699) 2024-09-19 12:22:01 +09:00
Ian Bull
282c4c262d
refactor(ext): align error messages (#25496)
Aligns the error messages in the ext/http and a few messages in the
ext/fetch folder to be in-line with the Deno style guide.

This change-set also removes some unnecessary checks in the 00_serve.ts.
These options were recently removed, so it doesn't make sense to check
for them anymore.

https://github.com/denoland/deno/issues/25269
2024-09-18 18:19:45 -07:00
Bartek Iwańczuk
fd23e8ec4f
ci: bump fetch depth to unblock canary uploads (#25716)
Current mac arm canaries are failing to upload because the existing
latest commit hash
is more that 5 commits behind and it's not in the git history.
2024-09-19 00:37:13 +00:00
Bartek Iwańczuk
c3bc692842
v2.0.0-rc.3 (#25704) 2024-09-18 23:21:45 +02:00
Marvin Hagemeister
28dd928962
fix: update nodeModulesDir config JSON schema (#25653)
Ref https://github.com/denoland/deno/issues/25380
2024-09-18 22:38:09 +02:00
Bartek Iwańczuk
315baeb50a
ci: fix uploading canary (#25715)
If a newer version was available the script was exiting with code 1.
2024-09-18 20:17:12 +00:00
Asher Gomez
5057f58145
feat: suggest deno install --entrypoint instead of deno cache (#25228)
Hides `deno cache` from `--help` output.

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-18 19:55:50 +00:00
Leo Kettmeir
a1d0a427e8
feat: default to TS for file extension and support ext flag in more scenarios (#25472)
Closes #11220
Currently does lint, fmt, and repl
2024-09-18 21:15:13 +02:00
Luca Casonato
7a41a93997
fix(ext/http): gracefully handle Response.error responses (#25712)
Fixes #14371
2024-09-18 21:14:40 +02:00
Luca Casonato
ab1e391e1d
feat(ext/node): add rootCertificates to node:tls (#25707)
Closes https://github.com/denoland/deno/issues/25604

Signed-off-by: Satya Rohith <me@satyarohith.com>
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-09-18 21:14:26 +02:00
Bartek Iwańczuk
5b14c71daf
feat: improve warnings for deprecations and lifecycle script for npm packages (#25694)
This commit improves warning messages for deprecated npm packages
and packages that rely on lifecycle script.
2024-09-18 19:04:25 +00:00
Divy Srivastava
fd860260ad
feat(lint): add no-process-global lint rule (#25709)
Closes https://github.com/denoland/deno/issues/25679
2024-09-18 20:50:42 +02:00
Marvin Hagemeister
f347e779e0
fix: error on unsupported compiler options (#25714)
Update the config schema to error when adding unsupported
`compilerOptions`.

Fixes https://github.com/denoland/deno/issues/25696
2024-09-18 20:49:16 +02:00