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

1281 commits

Author SHA1 Message Date
Bartek Iwańczuk
3ba464dbc4
chore: temporarily disable dns tests for Node compat (#26915)
These tests are hitting a remote server which sometimes starts failing
randomly on CI.

They need to be rewritten to use a local server and have `/etc/hosts`
setup that remaps relevants URLs.
2024-11-18 19:27:44 +00:00
Bhuwan Pandit
cff6e280c7
feat(cli): support multiple env file argument (#26527)
Closes #26425 

## Overview

This PR adds support for specifying multiple environment files as
arguments when using the Deno CLI. Subsequent files override
pre-existing variables defined in previous files.

If the same variable is defined in the environment and in the file, the
value from the environment takes precedence.

## Example Usage
```bash
deno run --allow-env --env-file --env-file=".env.one" --env-file=".env.two" script.ts
```

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-17 22:49:35 +00:00
Bartek Iwańczuk
56df61677e
chore: reenable some tests disabled during Deno 1->2 migration (#26898) 2024-11-16 18:15:42 +00:00
Bartek Iwańczuk
f2cd5655c6
fix(ext/node): increase tolerance for interval test (#26899)
Fixes tests added in https://github.com/denoland/deno/pull/26703 by
increasing tolerance due to noisy CI machines.
2024-11-16 16:31:55 +00:00
Bartek Iwańczuk
a1bcdf17a5
feat(jupyter): Add Deno.jupyter.image API (#26284)
This commit adds `Deno.jupyter.image` API to display PNG and JPG images:

```
const data = Deno.readFileSync("./my-image.jpg");
Deno.jupyter.image(data);

Deno.jupyter.image("./my-image.jpg");
```
2024-11-16 15:13:50 +00:00
/usr/bin/cat
8d2960d7cc
fix(ext/node): New async setInterval function to improve the nodejs compatibility (#26703)
Closes #26499
2024-11-16 16:01:19 +01:00
HasanAlrimawi
abf06eb87f
feat(watch): log which file changed on HMR or watch change (#25801)
Closes #25504
2024-11-16 15:59:31 +01:00
Miguel Rodrigues
99d5c6e423
fix(cli): show prefix hint when installing a package globally (#26629)
Closes #26545

Shows a hint when a package is installed globally, otherwise fallbacks
to the existing implementation.
2024-11-16 14:57:14 +01:00
Bartek Iwańczuk
84e1238648
feat(task): support object notation, remove support for JSDocs (#26886)
This commit changes three aspects of `deno task`:
1. Tasks can now be written using object notation like so:
```jsonc
{
  "tasks": {
     "foo": "deno run foo.js",
     "bar": {
        "command": "deno run bar.js"
     }
}
```
2. Support for comments for tasks is now removed. Comments above tasks
will
no longer be printed when running `deno task`.
3. Tasks written using object notation can have "description" field that
replaces
support for comments above tasks:
```jsonc
{
  "tasks": {
     "bar": {
        "description": "This is a bar task"
        "command": "deno run bar.js"
     }
}
```
```
$ deno task
Available tasks:
- bar
    // This is a bar task
    deno run bar.js
```

Pulled most of the changes from
https://github.com/denoland/deno/pull/26467 to
support "dependencies" in tasks. Additionally some cleanup was performed
to make code easier to read.

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-11-16 12:18:17 +01:00
Bartek Iwańczuk
dee94473c4
fix: update message for unsupported schemes with npm and jsr (#26884)
Closes https://github.com/denoland/deno/issues/26596
2024-11-15 17:09:19 +00:00
Luca Casonato
b8cf259924
feat(fetch): accept async iterables for body (#26882)
Reland of #24623, but with a fix for `String` objects.

Co-authored-by: crowlkats <crowlkats@toaxl.com>
2024-11-15 15:54:28 +01:00
Nayeem Rahman
3f26310728
feat(lsp): auto-imports with @deno-types directives (#26821)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-11-15 14:40:32 +00:00
Bartek Iwańczuk
dcc75d5685
chore: remove some unused tests (#26878) 2024-11-15 00:19:12 +00:00
Marvin Hagemeister
de34c7ed29
feat(cli): add --unstable-node-globals flag (#26617)
This PR adds a new `--unstable-node-globals` flag to expose Node globals
by default.

Fixes https://github.com/denoland/deno/issues/26611

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-14 13:11:29 +00:00
snek
4e899d48cf
fix: otel resiliency (#26857)
Improving the breadth of collected data, and ensuring that the collected
data is more likely to be successfully reported.

- Use `log` crate in more places
- Hook up `log` crate to otel
- Switch to process-wide otel processors
- Handle places that use `process::exit`

Also adds a more robust testing framework, with a deterministic tracing
setting.

Refs: https://github.com/denoland/deno/issues/26852
2024-11-14 12:16:28 +00:00
Yusuke Tanaka
15fae19748
fix(cli): preserve comments in doc tests (#26828)
This commit makes comments in code snippets in JSDoc or markdown
preserved when they are executed as tests. In particular, this is needed
to get TypeScript special comments such as `@ts-ignore` or
`@ts-expect-error` to work correctly.

Fixes #26728
2024-11-13 21:04:32 -08:00
David Sherret
f091d1ad69
feat(node): stabilize detecting if CJS via "type": "commonjs" in a package.json (#26439)
This will respect `"type": "commonjs"` in a package.json to determine if
`.js`/`.jsx`/`.ts`/.tsx` files are CJS or ESM. If the file is found to
be ESM it will be loaded as ESM though.
2024-11-13 15:10:09 +00:00
Divy Srivastava
6a4c6d83ba
fix(ext/node): zlib.crc32() (#26856)
Fixes https://github.com/denoland/deno/issues/26845
2024-11-13 20:07:45 +05:30
Divy Srivastava
7d9ba09f5a
fix(ext/node): use ERR_NOT_IMPLEMENTED for notImplemented (#26853) 2024-11-13 19:47:01 +05:30
snek
aa546189be
feat: OpenTelemetry Tracing API and Exporting (#26710)
Initial import of OTEL code supporting tracing. Metrics soon to come.
Implements APIs for https://jsr.io/@deno/otel so that code using
OpenTelemetry.js just works tm.

There is still a lot of work to do with configuration and adding
built-in tracing to core APIs, which will come in followup PRs.

---------

Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-11-13 10:38:46 +00:00
Łukasz Czerniawski
7becd83a38
feat(ext/fs): add ctime to Deno.stats and use it in node compat layer (#24801)
This PR fixes #24453, by introducing a ctime (using ctime for UNIX and
ChangeTime for Windows) to Deno.stats.

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-11-13 13:35:04 +09:00
Divy Srivastava
43812ee8ff
fix(ext/node): process.getBuiltinModule (#26833)
Closes https://github.com/denoland/deno/issues/26832
2024-11-13 08:02:09 +05:30
David Sherret
119910f339
fix(permissions): say to use --allow-run instead of --allow-all (#26842)
For https://github.com/denoland/deno/issues/26839
2024-11-12 17:14:19 -05:00
Nathan Whitaker
c371b2a492
fix(install): re-setup bin entries after running lifecycle scripts (#26752)
Fixes #26677

Some packages (like supabase) declare bin entries that don't exist until
lifecycle scripts are run. For instance, the lifecycle script downloads
a binary file which serves as a bin entrypoint.

Unfortunately you can't just defer setting up the bin entries until
after lifecycle scripts have run, because the scripts may rely on them.

I looked into this, and PNPM just re-links bin entries after running
lifecycle scripts. I think that's about the best we can do as well.

Note that we'll only re-setup bin entries for packages whose lifecycle
scripts we run. This should limit the performance cost, as typically a
given project will not have many lifecycle scripts (and of those, many
of them probably don't have bin entries to set up).
2024-11-12 09:23:39 -08:00
Divy Srivastava
3b99f6833c
fix(ext/websocket): initialize error attribute of WebSocket ErrorEvent (#26796)
Fixes https://github.com/denoland/deno/issues/26216

Not required by the spec but Discord.js depends on it, see
https://github.com/denoland/deno/issues/26216#issuecomment-2466060306
2024-11-12 17:10:07 +05:30
Yoshiya Hinosawa
c3c2b37966
fix(ext/node): add autoSelectFamily option to net.createConnection (#26661) 2024-11-12 19:54:47 +09:00
Yoshiya Hinosawa
b955d03740
test(ext/node): prevent running the same test cases twice (#26812) 2024-11-11 17:16:33 +09:00
Divy Srivastava
ce778a947e
Revert "perf(upgrade): cache downloaded binaries in DENO_DIR" (#26799)
Reverts denoland/deno#26108

Tests are flaky on main
01de331742
2024-11-10 09:00:44 +05:30
Bartek Iwańczuk
01de331742
perf(upgrade): cache downloaded binaries in DENO_DIR (#26108)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-11-09 15:19:46 +00:00
Nathan Whitaker
d4f1bd3dac
fix(install): cache jsr deps from all workspace config files (#26779)
Fixes #26772.

I wasn't aware that the `imports()` method only returned the workspace
root imports
2024-11-08 12:45:30 -08:00
Divy Srivastava
b482a50299
feat(ext/http): abort event when request is cancelled (#26781)
```js
Deno.serve(async (req) => {
  const { promise, resolve } = Promise.withResolvers<void>();

  req.signal.addEventListener("abort", () => {
    resolve();
  });

  await promise;

  return new Response("Ok");
});
```
2024-11-08 18:46:11 +05:30
Nathan Whitaker
bf82c6697a
chore: make commandWithCwdIsAsync test less flaky (#26770) 2024-11-07 15:02:33 -08:00
Divy Srivastava
b9262130fe
feat(ext/http): abort signal when request is cancelled (#26761)
Closes https://github.com/denoland/deno/issues/21653
2024-11-07 17:12:13 +05:30
Nathan Whitaker
742744d498
chore: serve node headers from a test server to fix flaky node-gyp test (#26749)
Fixes https://github.com/denoland/deno/issues/24749

Runs a server that just returns the header tarball and checksum, and
sets the `NODEJS_ORG_MIRROR` env var so that `node-gyp` uses it instead
of `nodejs.org`
2024-11-06 19:52:46 -08:00
Kaveh
db53ec230d
refactor(ext/net): Use hickory dns instead of unmaintained trust-dns (#26741)
This PR replaces the unmaintained and rebranded `trust-dns` to `hickory`
for resolver in `deno_net`.
2024-11-06 15:49:32 -08:00
Satya Rohith
b3a3d84ce2
fix(node:zlib): gzip & gzipSync should accept ArrayBuffer (#26762)
Closes https://github.com/denoland/deno/issues/26638
2024-11-06 15:12:24 +01:00
Bartek Iwańczuk
64e887083a
fix(fmt): don't use self-closing tags in HTML (#26754)
Closes https://github.com/denoland/deno/issues/26748
2024-11-06 13:56:03 +01:00
Nayeem Rahman
5088b25f23
feat(lsp): auto-import completions from byonm dependencies (#26680) 2024-11-06 06:26:46 +00:00
Mohammad Sulaiman
89f0b796bd
chore: deprecate run itests (#26444) 2024-11-05 06:39:05 +00:00
Nathan Whitaker
706b1dfcea
fix(add): better error message when adding package that only has pre-release versions (#26724)
Fixes https://github.com/denoland/deno/issues/26597

A small refactor as well to reduce some code duplication
2024-11-05 02:45:00 +00:00
Nathan Whitaker
44eca0505c
chore: fix serve_watch_all test (#26725)
It's been failing a ton lately, it looks like the test is just
incorrectly using TS syntax in a JS file
https://github.com/denoland/deno/actions/runs/11672972415/job/32502710624?pr=26724#step:43:2791

I'm not really sure how this ever passes
2024-11-05 01:09:17 +00:00
Bartek Iwańczuk
051552172c
fix(workspace): support wildcard packages (#26568)
This commit adds support for wildcard packages in `workspace`
configuration option in `deno.json`. This is now supported:
```
{
  "workspace": [
    "./packages/*"
  ]
}
```

Closes https://github.com/denoland/deno/issues/25783
2024-11-05 00:42:18 +01:00
Nayeem Rahman
d67765b0b4
fix(lsp): scope attribution for lazily loaded assets (#26699) 2024-11-04 20:01:31 +00:00
Bartek Iwańczuk
9a39a98b57
fix(fmt): ignore file directive for YAML files (#26717)
Closes https://github.com/denoland/deno/issues/26712

Support `# deno-fmt-ignore-file` directive for YAML files.

Also added tests for single line ignores.
2024-11-04 17:57:29 +00:00
Kenta Moriuchi
fb1d33a711
chore: update dlint to v0.68.0 for internal (#26711) 2024-11-04 12:17:11 -05:00
Nathan Whitaker
2c8a0e7917
fix(add): only add npm deps to package.json if it's at least as close as deno.json (#26683)
Fixes https://github.com/denoland/deno/issues/26653
2024-11-01 19:10:35 -07:00
David Sherret
826e42a5b5
fix: improved support for cjs and cts modules (#26558)
* cts support
* better cjs/cts type checking
* deno compile cjs/cts support
* More efficient detect cjs (going towards stabilization)
* Determination of whether .js, .ts, .jsx, or .tsx is cjs or esm is only
done after loading
* Support `import x = require(...);`

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-01 12:27:00 -04:00
Divy Srivastava
4774eab64d
chore: upgrade to rust 1.82 and LLVM 19 (#26615)
Upgrade to rust 1.82 and LLVM 19 . Removes one webusb test because
`requestAdapter` not working on new ubuntu 24 runners
2024-11-01 16:13:02 +05:30
Nathan Whitaker
04ae1a5517
fix(cli): set npm_config_user_agent when running npm packages or tasks (#26639)
Fixes #25342.

Still not sure on the exact user agent to set (should it include
`node`?).

After this PR, here's the state of running some `create-*` packages
(just ones I could think of off the top of my head):

| package                  | prints/runs/suggests deno install | notes |
| ---------------- | ------------- | ------ |
| `create-next-app` |  | falls back to npm, needs a PR
([code](c32e280209/packages/create-next-app/helpers/get-pkg-manager.ts (L3)))
| `sv create` |  | uses `package-manager-detector`, needs a PR
([code](https://github.com/antfu-collective/package-manager-detector/tree/main))
| `create-qwik` |  | runs `deno install` but suggests `deno start`
which doesn't work (should be `deno task start` or `deno run start`)
| `create-astro` |  | runs `deno install` but suggests `npm run dev`
later in output, probably needs a PR
| `nuxi init` |  | deno not an option in dialog, needs a PR
([code](f04e2e8944/src/commands/init.ts (L96-L102)))
| `create-react-app` |  | uses npm
| `ng new` (`@angular/cli`) |  | uses npm
| `create-vite` |  | suggests working deno commands 🎉 
| `create-solid` |   | suggests npm commands, needs PR

It's possible that fixing `package-manager-detector` or other packages
might make some of these just work, but haven't looked too carefully at
each
2024-10-31 22:19:19 -07:00
Nathan Whitaker
6c6bbeb974
fix(node): Implement os.userInfo properly, add missing toPrimitive (#24702)
Fixes the implementation of `os.userInfo`, and adds a missing
`toPrimitive` for `tmpdir`. This allows us to enable the corresponding
node_compat test.
2024-10-31 22:18:33 -07:00