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

8750 commits

Author SHA1 Message Date
Yoshiya Hinosawa
6de815859b
fix(ext/node): fix npm module resolution when --node-modules-dir specified (#17896) 2023-02-23 22:28:12 +09:00
Kenta Moriuchi
38f9aa0f9c
fix(ext/flash): wrong order of arguments passed to http1Response (#17893) 2023-02-23 18:25:40 +05:30
Bartek Iwańczuk
d5f053dabf
feat(bench): change --json output format (#17888)
Closes https://github.com/denoland/deno/issues/17775
2023-02-23 12:59:23 +01:00
David Sherret
b15f9e60a0
feat(task): support scripts in package.json (#17887)
This is a super basic initial implementation. We don't create a
`node_modules/.bin` folder at the moment and add it to the PATH like we
should which is necessary to make command name resolution in the
subprocess work properly (ex. you run a script that launches another
script that then tries to launch an "npx command"... this won't work
atm).

Closes #17492
2023-02-22 22:45:35 -05:00
Yoshiya Hinosawa
cc8e4a00aa
test(ext/node): add tty_test and util_test (#17868) 2023-02-23 12:28:19 +09:00
Yoshiya Hinosawa
3ca23cb642
test(ext/node): add tls_test (#17871) 2023-02-23 12:27:29 +09:00
Bartek Iwańczuk
93a712fbac
Revert "test(wpt): implement process timeout (#17872)" (#17886)
This reverts commit 5fcbdd6228.
2023-02-23 02:34:19 +01:00
David Sherret
ddc350780d
fix(npm): resolve node_modules dir relative to package.json instead of cwd (#17885) 2023-02-22 20:16:16 -05:00
David Sherret
a31d8869ea
perf: remove current_dir() call in Deno.mainModule (#17883) 2023-02-22 18:22:24 -05:00
Bartek Iwańczuk
1c14127c4f
feat: support bare specifier resolution with package.json (#17864)
This commit enables resolution of "bare specifiers" (eg. "import express
from 'express';") if a "package.json" file is discovered. 

It's a step towards being able to run projects authored for Node.js 
without any changes.

With this commit we are able to successfully run Vite projects without
any changes to the user code.

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2023-02-22 23:21:05 +01:00
Asher Gomez
c18e0d1d37
feat(permissions): grant all permission for a group in permission prompt (#17140)
This commit adds new "A" option to the interactive permission prompt, that will
allow all subsequent permissions for given group (domain). Ie. when querying for
permissions to access eg. env variables responding with "A" will allow access
to all environmental variables.

This works for all permission domains and should make permission prompts
more ergonomic for users.
2023-02-22 23:02:10 +01:00
Filip Skokan
5fcbdd6228
test(wpt): implement process timeout (#17872)
```
response-consume-stream.any.js
Blob-stream.any.js
```

These tests just hang whenever they get to use byob mode. This PR adds a
timeout to the spawned process so that the WPTs finish running.

This first broke the daily run due to
7b49c547d4

Also fixes "Untitled" test names in
https://wpt.fyi/results/dom/events/Event-constructors.any.html?label=experimental&label=master&product=deno&product=chrome&aligned&view=subtest
2023-02-22 21:45:21 +01:00
David Sherret
a6ca4d0d61
refactor: use deno_graph for npm specifiers (#17858)
This changes npm specifiers to be handled by deno_graph and resolved to
an npm package name and version when the specifier is encountered. It
also slightly changes how npm specifier resolution occurs—previously it
would collect all the npm specifiers and resolve them all at once, but
now it resolves them on the fly as they are encountered in the module
graph.

https://github.com/denoland/deno_graph/pull/232

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-22 14:15:25 -05:00
Aapo Alasuutari
0f9daaeacb
fix(ext/ffi): Fix re-ref'ing UnsafeCallback (#17704) 2023-02-22 19:09:59 +00:00
David Sherret
9b8992d4b4
feat: start caching npm package version's "bin" entry from npm registry (#17881) 2023-02-22 13:16:40 -05:00
Aapo Alasuutari
b56b8c8a75
feat(ext/ffi): Replace pointer integers with v8::External objects (#16889) 2023-02-22 19:32:38 +02:00
Bartek Iwańczuk
2bd7482295
fix(core): rebuild when JS sources for snapshotting change (#17876) 2023-02-22 18:21:07 +01:00
David Sherret
b4b718d6ae
fix(lint): revert no-deprecated-api for Deno.run (#17880) 2023-02-22 16:14:53 +00:00
Yoshiya Hinosawa
a2d942a778
fix(ext/node): fix node stream (#17874) 2023-02-22 23:30:58 +09:00
Ryan Dahl
4afa150f21
Revert "feat: Deprecate Deno.run API in favor of Deno.Command (#17630)" (#17875)
Deno.Command needs to be stabilized first and allow people to upgrade to
it before we can deprecate Deno.run. Otherwise lint will suddenly fail
with deprecated errors without giving people a chance to update.
2023-02-22 07:27:00 -05:00
David Sherret
2f98c3e1a6
chore: remove base64 encoding code from typescript snapshot (#17862)
This code is no longer used because we use swc for this now.
2023-02-21 22:56:58 -05:00
Yoshiya Hinosawa
860b6cbd23
fix(ext/node): fix webcrypto export (#17838) 2023-02-22 12:40:36 +09:00
Bartek Iwańczuk
4c6db7aa14
perf(core, runtime): Further improve startup time (#17860)
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-22 06:25:31 +05:30
David Sherret
5becfd6381
fix(npm): filter out duplicate packages names in resolution (#17857) 2023-02-21 15:19:09 -05:00
Bartek Iwańczuk
69c0b05f7a
refactor(core): More efficient serde for ES modules in snapshot (#17856)
Instead of relying on "serde_v8" which is very inefficient in
serializing enums, I'm hand rolling serde for "ModuleMap" data 
that is stored in the V8 snapshot to make ES modules 
snapshottable.

```
// this branch
Benchmark #2: ./target/release/deno run empty.js

  Time (mean ± σ):      21.4 ms ±   0.9 ms    [User: 15.6 ms, System: 6.4 ms]

  Range (min … max):    20.2 ms …  24.4 ms

// main branch
Benchmark #2: ./target/release/deno run empty.js

  Time (mean ± σ):      23.1 ms ±   1.2 ms    [User: 17.0 ms, System: 6.2 ms]

  Range (min … max):    21.0 ms …  26.0 ms

```
2023-02-21 21:12:22 +01:00
David Sherret
3479bc7661
fix(npm): improve peer dependency resolution (#17835)
This PR fixes peer dependency resolution to only resolve peers based on
the current graph traversal path. Previously, it would resolve a peers
by looking at a graph node's ancestors, which is not correct because
graph nodes are shared by different resolutions.

It also stores more information about peer dependency resolution in the
lockfile.
2023-02-21 12:03:48 -05:00
Yoshiya Hinosawa
608c855f11
fix(ext/node): fix process.uptime (#17839) 2023-02-22 00:14:15 +09:00
Bartek Iwańczuk
914b08fc19
build: add "include_js_files_for_snapshotting" Cargo feature (#17826)
This allows to not include source code into the binary (because
it will already be included in the V8 snapshot).

Nothing changes for the embedders - everything should still build the
same.

This commit brings the binary size from 87Mb to 82Mb on M1.

Alternative to https://github.com/denoland/deno/pull/17820 and
https://github.com/denoland/deno/pull/17653

---------

Co-authored-by: Leo Kettmeir <crowlkats@toaxl.com>
2023-02-20 21:45:34 +01:00
Bartek Iwańczuk
4d1a14ca7f
feat: auto-discover package.json for npm dependencies (#17272)
This commits adds auto-discovery of "package.json" file when running
"deno run" and "deno task" subcommands. In case of "deno run" the
"package.json" is being looked up starting from the directory of the
script that is being run, stopping early if "deno.json(c)" file is found
(ie. FS tree won't be traversed "up" from "deno.json").

When "package.json" is discovered the "--node-modules-dir" flag is
implied, leading to creation of local "node_modules/" directory - we
did that, because most tools relying on "package.json" will expect
"node_modules/" directory to be present (eg. Vite). Additionally 
"dependencies" and "devDependencies" specified in the "package.json"
are downloaded on startup. 

This is a stepping stone to supporting bare specifier imports, but
the actual integration will be done in a follow up commit.

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2023-02-20 19:14:06 +01:00
Leo Kettmeir
88f6fc6a16
refactor: use ops for idna & punycode (#17817)
Towards https://github.com/denoland/deno/issues/17809
2023-02-20 18:47:42 +01:00
Divy Srivastava
ea7ca00c89
perf: use ops for node:crypto ciphers (#17819)
Towards #17809
2023-02-20 22:22:28 +05:30
Leo Kettmeir
a16c11c5d1
refactor: move webgpu files to ext root (#17832)
Required for #17826
2023-02-20 16:48:02 +00:00
Yoshiya Hinosawa
6915a9b7a7
test(ext/node): more node compat tests (#17827)
This PR adds the remaining ~650 Node.js compat test cases from std/node.

Among these 650 cases, about 130 cases are now failing. These failing
cases are prefixed with `TODO:` in `tests/node_compat/config.json`.
These will be addressed in later PRs.
2023-02-20 16:35:04 +01:00
Bartek Iwańczuk
a1cd2a5915
refactor(core): definition of "ExtensionFileSource" (#17823)
This commit changes definition of "ExtensionFileSource", by changing
"code" field to being "ExtensionFileSourceCode" enum. Currently the enum
has only a single variant "IncludedInBinary". It is done in preparation
to allow embedders to decide if they want to include the source code in the
binary when snapshotting (in most cases they shouldn't do that).

In the follow up commit we'll add more variants to
"ExtensionFileSourceCode".

"include_js_files_dir!" macro was removed in favor "include_js_files!"
macro which can now accept "dir" option.
2023-02-20 01:11:56 +01:00
Yoshiya Hinosawa
a01af067d7
test: add node compat tests (#17805) 2023-02-17 23:58:52 +09:00
Bartek Iwańczuk
1a7666a6ca
chore: remove unneeded files from ext/node (#17810) 2023-02-17 15:58:31 +01:00
David Sherret
610b8cc2bf
refactor: add NpmPackageId back from deno_graph as NpmPackageNodeId (#17804)
The `NpmPackageId` struct is being renamed to `NpmPackageNodeId`. In a
future PR it will be moved down into only npm dependency resolution and
a `NpmPackageId` struct will be introduced in `deno_graph` that only has
the name and version of the package (no peer dependency identifier
information). So a `NpmPackageReq` will map to an `NpmPackageId`, which
will map to an `NpmPackageNodeId` in the npm resolution.
2023-02-17 09:12:22 -05:00
Divy Srivastava
f8435d20b0
feat(ext/node): implement node:v8 (#17806)
Closes https://github.com/denoland/deno/issues/17115 

Implements `cachedDataVersionTag` and `getHeapStatistics`.
2023-02-17 18:48:09 +05:30
AntonioFCG
7ce1a68637
fix(ext/node): add support for BYOB streams (#17803) 2023-02-17 18:14:59 +09:00
Bartek Iwańczuk
e0074b5afd
chore: upgrade tokio to 1.25.0 (#17590)
Upgrades "tokio" dependency to version 1.25.0.
2023-02-17 00:34:12 +01:00
Kamil Ogórek
f82e917860
ref(core): Refactor core:fs error mapping to use unified format (#17719) 2023-02-16 21:21:03 +02:00
Kamil Ogórek
6e1b737400
ref(cli): Add better error message when powershell is missing during upgrade (#17759)
Closes https://github.com/denoland/deno/issues/17756
2023-02-16 21:14:57 +02:00
Divy Srivastava
0aeb8bc759
perf(ext/node): move winerror binding to rust (#17792)
16873 lines of JS removed from the snapshot.
2023-02-16 19:19:32 +05:30
Bartek Iwańczuk
4c2380af5c
test: add unit tests from std/node (#17794)
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-16 14:30:14 +01:00
Bartek Iwańczuk
848e2c0d57
feat: Deprecate Deno.run API in favor of Deno.Command (#17630) 2023-02-16 12:11:32 +01:00
Bartek Iwańczuk
e215656865
test: ignore inspector tests for npm integration (#17796)
I will revisit and fix the test after we move along with "ext/node"
integration.

eg.
https://github.com/denoland/deno/actions/runs/4189205563/jobs/7261246149
2023-02-16 11:44:16 +01:00
Geert-Jan Zwiers
ff2e66aa38
chore(cli/test): stabilize coverage, doc, shuffle flags (#17661)
This PR removes the `UNSTABLE` mentions from the CLI docs for `deno test
--coverage/doc/shuffle`.
2023-02-16 00:50:30 +01:00
Bartek Iwańczuk
75209e12f1
feat: wire up ext/node to the Node compatibility layer (#17785)
This PR changes Node.js/npm compatibility layer to use polyfills for
built-in Node.js
embedded in the snapshot (that are coming from "ext/node" extension).

As a result loading `std/node`, either from
"https://deno.land/std@<latest>/" or
from "DENO_NODE_COMPAT_URL" env variable were removed. All code that is
imported via "npm:" specifiers now uses code embedded in the snapshot.

Several fixes were applied to various modules in "ext/node" to make
tests pass.

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-02-15 19:44:52 +01:00
David Sherret
c4b9a91e27
refactor: use deno_graph's semver and npm structs (#17791) 2023-02-15 13:20:40 -05:00
David Sherret
b34e751a5b
refactor: make resolver required (#17783)
Makes the resolver required and prints a warning when vendoring and a
dynamic import can't be resolved.

Closes #16522
2023-02-15 11:30:54 -05:00