1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-02 09:34:19 -04:00
Commit graph

2110 commits

Author SHA1 Message Date
Yoshiya Hinosawa
3187e4e909
fix(ext/node): util.types.isSharedArrayBuffer (#17836) 2023-02-26 11:23:53 +09:00
David Sherret
da5b5d4688 chore: fix flaky package_json_basic tests (#17940)
https://github.com/denoland/deno/actions/runs/4267836955/jobs/7429836369

Closes #17946
2023-02-25 13:56:39 +00:00
David Sherret
033b70af19
fix(npm): lazily install package.json dependencies only when necessary (#17931)
This lazily does an "npm install" when any package name matches what's
found in the package.json or when running a script from package.json
with deno task.

Part of #17916

Closes #17928
2023-02-24 19:35:43 -05:00
Leo Kettmeir
484b6fe2fa
refactor(flash): move remoteAddr to options bag (#17913)
Applies suggestion from #17912
2023-02-24 23:36:07 +01:00
David Sherret
9aebc8bc19
fix: ensure concurrent non-statically analyzable dynamic imports do not sometimes fail (#17923)
Closes #17918
2023-02-24 14:42:45 -05:00
David Sherret
a27d0885f4
feat: add DENO_NO_PACKAGE_JSON env var (#17926)
Depends on #17924

Part of #17916
2023-02-24 19:23:07 +00:00
David Sherret
7ad64283a1
fix(npm): package.json auto-discovery should respect --no-config and --no-npm (#17924)
Part of #17916
2023-02-24 13:51:21 -05:00
David Sherret
e57b38f8b2
fix(npm): allow resolving from package.json when an import map exists (#17905) 2023-02-23 23:20:23 +01:00
Bartek Iwańczuk
4773d07974
feat(task): adjust warning (#17904)
Put it on a single line and remove coloring.
2023-02-23 20:43:18 +01:00
Leo Kettmeir
451b45ee3a
fix(webgpu): don't default to 0 for setVertexBuffer.size & properly use webidl.setlike (#17800) 2023-02-23 19:05:50 +01:00
David Sherret
6233c0aff0
fix(npm): support bare specifiers in package.json having a path (#17903)
For example `import * as test from "package/path.js"`
2023-02-23 17:33:23 +00:00
David Sherret
344317ec50
feat(npm): support bare specifiers from package.json in more subcommands and language server (#17891) 2023-02-23 10:58:10 -05:00
Bartek Iwańczuk
214bdbbc2b
feat(task): add warning about package.json scripts support (#17900) 2023-02-23 16:41:28 +01:00
David Sherret
998aeff3d4
feat(npm): support npm specifiers in remote modules without --unstable (#17889)
Closes #17455
2023-02-23 09:48:29 -05:00
Yoshiya Hinosawa
6de815859b
fix(ext/node): fix npm module resolution when --node-modules-dir specified (#17896) 2023-02-23 22:28:12 +09:00
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
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
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
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
b56b8c8a75
feat(ext/ffi): Replace pointer integers with v8::External objects (#16889) 2023-02-22 19:32:38 +02: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
Yoshiya Hinosawa
860b6cbd23
fix(ext/node): fix webcrypto export (#17838) 2023-02-22 12:40:36 +09:00
Yoshiya Hinosawa
608c855f11
fix(ext/node): fix process.uptime (#17839) 2023-02-22 00:14:15 +09: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
Divy Srivastava
ea7ca00c89
perf: use ops for node:crypto ciphers (#17819)
Towards #17809
2023-02-20 22:22:28 +05:30
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
Yoshiya Hinosawa
a01af067d7
test: add node compat tests (#17805) 2023-02-17 23:58:52 +09: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
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
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
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
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
Leo Kettmeir
c7535950b6
feat(flash): add 2nd param to handler to get remote address (#17633)
Closes #17583
2023-02-15 16:37:41 +01:00
Bartek Iwańczuk
1d00bbe47e
fix: loading built-in Node modules embedded in the binary (#17777)
Fixes bug introduced in ed3a7ce2f7 that
caused errors when loading built-in Node modules, when using "deno_graph".
2023-02-14 16:48:27 +01:00
Bartek Iwańczuk
0f1349bca8
feat: Deprecate 'deno bundle' subcommand (#17695)
This commit adds a deprecation warning when using "deno bundle"
subcommand and removes it from the output of "deno help".
2023-02-14 02:13:44 +01:00
Leo Kettmeir
8b5be962f5
fix: add WouldBlock error (#17339) 2023-02-12 23:14:33 +01:00
David Sherret
dc66fdc11e
perf(http): remove allocations checking upgrade and connection header values (#17727) 2023-02-12 20:51:07 +00:00
Kamil Ogórek
d4e5a295f2
fix(ext/flash): Always send correct number of bytes when handling HEAD requests (#17740)
This was not caught in the previous test case, as the response body was
smaller than the size of `HEAD` response.
This made `nwritten < responseLen` check in `writeFixedResponse` to
fail, and not trigger `op_flash_respond_async` as a result.

When the response body is larger than the `HEAD` though, as in the
updated test case (`HEAD` i 120 bytes, where our response is 300 bytes),
it would think that we still have something to send, and effectively
panic, as `op_flash_respond` already removed the request from the pool.

This change, makes the `handleResponse` function always calculate the
number of bytes to transmit when `HEAD` request is encountered.
Effectively ignoring `Content-Length` of the body, but still setting it
correctly in the request header itself.

Fixes https://github.com/denoland/deno/issues/17737
2023-02-12 16:13:05 +05:30
Nayeem Rahman
13493d9121
fix(cli/graph_util): don't append referrer info for root module errors (#17730) 2023-02-11 10:36:29 -05:00
Leo Kettmeir
a55f0eb2fc
feat: add signal option to Deno.resolveDns (#17384)
Closes #14406
2023-02-11 14:14:02 +00:00
Leo Kettmeir
e22ebc6b6b
feat: add more variants to Deno.build.os (#17340)
Closes #14799
2023-02-11 14:25:45 +01:00
Kamil Ogórek
0164959d34
fix(ops): Always close cancel handles for read_async/write_async (#17736)
Fixes https://github.com/denoland/deno/issues/17734
2023-02-11 14:19:13 +02:00
David Sherret
b3e88e0681
refactor: deno_graph 0.43 upgrade (#17692) 2023-02-09 22:00:23 -05:00
Kamil Ogórek
ef9b66950f
fix: use static Reflect methods in nodeGlobalThis proxy (#17696)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-02-08 19:11:12 -05:00
Waldir Pimenta
19543ffec3
fix(ext/console): Only right-align integers in console.table() (#17389) 2023-02-08 18:14:40 +09:00
Leo Kettmeir
49af1ab18d
refactor: remove prefix from include_js_files & use extension name (#17683) 2023-02-07 21:09:50 +00:00
Leo Kettmeir
b4aa153097
refactor: Use ES modules for internal runtime code (#17648)
This PR refactors all internal js files (except core) to be written as
ES modules.
`__bootstrap`has been mostly replaced with static imports in form in
`internal:[path to file from repo root]`.
To specify if files are ESM, an `esm` method has been added to
`Extension`, similar to the `js` method.
A new ModuleLoader called `InternalModuleLoader` has been added to
enable the loading of internal specifiers, which is used in all
situations except when a snapshot is only loaded, and not a new one is
created from it.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-07 20:22:46 +01:00
Bartek Iwańczuk
65500f36e8
chore: upgrade rusty_v8 to 0.62.2 (#17604)
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2023-02-07 13:36:41 +01:00
denobot
a4988d00da
chore: forward v1.30.3 release commit to main (#17677)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-07 04:15:38 +00:00
Bartek Iwańczuk
4d7145dd5a
chore: update std submodule to 0.176.0 (#17668) 2023-02-06 23:22:52 +01:00
Leo Kettmeir
7f23063329
fix: revert lsp related internal specifiers (#17673)
To fix reports of breakage from #17655
2023-02-06 22:49:49 +01:00
Leo Kettmeir
84a96110cd
refactor: rename deno specifiers to internal (#17655) 2023-02-05 17:49:20 +01:00
Gasman
0eb5be9a12
fix(ext/console): log class for class constructor (#17615)
Co-authored-by: tannal <tannal.cn@gmail.com>
2023-02-05 00:34:36 +01:00
Nayeem Rahman
a635c9700c
refactor: reland "preserve ProcState::file_fetcher between restarts" (#17636)
Just some watcher init step that I thought would be "cloned over" but
needs to be done again on reset.
2023-02-03 20:15:16 +01:00
David Sherret
dc854e83a4
fix(repl): handle @types/node not being cached in the repl (#17617)
Closes #17599
2023-02-01 16:37:05 -05:00
David Sherret
f6f76a76b2
fix(lockfile): emit trailing newline (#17618) 2023-02-01 15:57:02 -05:00
Bartek Iwańczuk
d318e38b76
Revert "fix(watch): preserve ProcState::file_fetcher between restarts (#15466) (#17591)
This reverts commit 3545bff678.
2023-01-30 16:22:17 +01:00
Kenta Moriuchi
266915d5ce
fix(ext): internal structuredClone for ArrayBuffer and TypedArray subclasses (#17431) 2023-01-29 15:15:01 +01:00
David Sherret
fe11df09b1
fix(lsp): update document dependencies on configuration change (#17556) 2023-01-28 10:18:32 -05:00
David Sherret
2b247be517
fix: ensure "fs" -> "node:fs" error/quick fix works when user has import map (#17566)
Closes #17563
2023-01-27 22:36:23 +00:00
David Sherret
f5840bdcd3
chore: upgrade to Rust 1.67 (#17548)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-27 10:43:16 -05:00
David Sherret
34c14dbf99
fix: support import map specified as data uri (#17531) 2023-01-25 16:51:04 -05:00
Bartek Iwańczuk
c6c8c91a6e
feat: embed import map in the config file (#17478)
This commit changes handling of config file to enable
specifying "imports" and "scopes" objects effectively making
the configuration file an import map.

"imports" and "scopes" take precedence over "importMap" configuration,
but have lower priority than "--importmap" CLI flag.

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-01-25 21:13:40 +01:00
David Sherret
b5b4887c4a
feat(fmt): make semi-colon option a boolean (#17527) 2023-01-25 15:06:00 -05:00
David Sherret
83642976bf
fix: remove leftover Deno.spawn references (#17524) 2023-01-25 12:28:08 -05:00
Bartek Iwańczuk
8b7023bc7e
Revert "chore: upgrade rusty_v8 to 0.62.0 (#17200)" (#17523)
This reverts commit e2d75491d5.
2023-01-25 15:36:10 +01:00
Bartek Iwańczuk
e2d75491d5
chore: upgrade rusty_v8 to 0.62.0 (#17200) 2023-01-25 12:22:27 +00:00
Leo Kettmeir
f3711f28f4
feat(cli): add DENO_V8_FLAGS env var (#17313)
Closes #5669
2023-01-25 05:03:03 +01:00
Asher Gomez
900929f65c
feat: Add sync APIs for "Deno.permissions" (#17019)
This commit adds sync versions of async APIs to "Deno.permissions"
namespace.

Following APIs were added:
- "Deno.permissions.querySync"
- "Deno.permissions.requestSync"
- "Deno.permissions.revokeSync"
2023-01-25 00:42:44 +01:00
David Sherret
f14ea3d4d4
feat: suggest adding a "node:" prefix for bare specifiers that look like built-in Node modules (#17519) 2023-01-24 15:14:49 -05:00
Bartek Iwańczuk
e1c51f3c0d
feat(fmt): add ability to configure semicolons (#17292)
Allows to change behavior of `deno fmt` to use "ASI" setting for
semicolons instead of always prefering them, this is done
by "--options-semi=asi" flag or `"semi": "asi"` setting
in the config file.
2023-01-24 21:07:00 +01:00
Bartek Iwańczuk
abd9610530
refactor: remove Deno.core (#16881)
This commit removes "Deno.core" namespace. It is strictly private API
that has no stability guarantees, we were supposed to remove it long time ago.

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-01-24 18:54:10 +01:00
Leo Kettmeir
1084027d50
fix: update expected output for config auto-discovery debug log (#17514) 2023-01-24 17:28:22 +01:00
Leo Kettmeir
0204071e30
feat: log detection of config file (#17338)
Closes #14578
2023-01-24 15:41:22 +01:00
Leo Kettmeir
2027d98a8e
feat: allow first arg in test step to be a function (#17096) 2023-01-24 15:41:01 +01:00
Bartek Iwańczuk
fc2e00152b
feat: support node built-in module imports (#17264)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-01-24 09:05:54 -05:00
Leo Kettmeir
cadeaae045
feat(runtime/command): make stdin default to inherit for spawn() (#17334)
Closes #17230
2023-01-24 15:03:46 +01:00
David Sherret
654e177c91
refactor(deno_graph): remove unused Resolved::Ok#kind usage (#17504)
See https://github.com/denoland/deno_graph/pull/205 for more details.
2023-01-24 08:23:19 -05:00
Bartek Iwańczuk
bf237c6241
refactor: Move lockfile to a separate crate (#17503)
Moves the lockfile implementation to a separate crate so other projects
like Deploy can use it as well.
2023-01-23 23:41:02 +01:00
Leo Kettmeir
18e8ce4ca5
feat(runtime): add bigint to seek typings (#17314) 2023-01-19 05:30:56 +01:00
Andreu Botella
69ec45eac7
refactor(cli): Integrate standalone mode cert handling into Flags (#17419)
The way the standalone mode handles the `--cert` flag is different to
all other modes. This is because `--cert` takes a path to the
certificate file, which is directly added to the root cert store; except
for compile mode, where its byte contents are stored in the standalone
metadata, and they are added to the root cert store after the
`ProcState` is created.

This change instead changes `Flags::ca_file` (an `Option<String>`) into
`Flags::ca_data`, which can represent a `String` file path or a
`Vec<u8>` with the certificate contents. That way, standalone mode can
create a `ProcState` whose root cert store alreay contains the
certificate.

This change also adds a tests for certificates in standalone mode, since
there weren't any before.

This refactor will help with implementing web workers in standalone mode
in the future.
2023-01-18 01:18:24 +01:00
Kenta Moriuchi
6da958d7ec
chore: update dlint to v0.37.0 for GitHub Actions (#17295)
Updated third_party dlint to v0.37.0 for GitHub Actions. This PR
includes following changes:
 
* fix(prefer-primordials): Stop using array pattern assignments
* fix(prefer-primordials): Stop using global intrinsics except for
`SharedArrayBuffer`
* feat(guard-for-in): Apply new guard-for-in rule
2023-01-16 17:17:18 +01:00
Leo Kettmeir
df4d0c55c0
fix(cli/fmt): show filepath for InvalidData error (#17361) 2023-01-16 00:30:52 +00:00
Asher Gomez
7683ba5e90
chore: update std submodule and its imports (#17408) 2023-01-15 21:09:26 +01:00
Divy Srivastava
d5634164cb
chore: use rustfmt imports_granularity option (#17421)
Closes https://github.com/denoland/deno/issues/2699
Closes https://github.com/denoland/deno/issues/2347

Uses unstable rustfmt features. Since dprint invokes `rustfmt` we do not
need to switch the cargo toolchain to nightly. Do we care about
formatting stability of our codebase across Rust versions? (I don't)
2023-01-14 23:18:58 -05:00
Isaiah Gamble
efcbfd5206
fix(ext/fetch) Fix request clone error in flash server (#16174) 2023-01-15 05:08:34 +01:00
Kamil Ogórek
1d7203c24c
fix(ext/flash): Correctly handle errors for chunked responses (#17303)
The leading cause of the problem was that `handleResponse` has
`tryRespondChunked` passed as an argument, which in turn is implemented
as a call to `core.ops.op_try_flash_respond_chuncked`, that throws in
the repro code.

`handleResponse` was not handled correctly, as it not returned any
value, and had no `catch` attached to it.
It also effectively was never correctly handled inside two other blocks
with `resp.then` and `PromisePrototypeCatch(PromisePrototypeThen(resp,
"..."))` as well, as it just short-circuited the promise with an empty
resolve, instead of relying on the last `(async () => {})` block.

This change makes `handleResponse` return a correct value and attach
`onError` handler to the "non-thenable" variant of response handling
code.
2023-01-14 15:06:28 +01:00
Divy Srivastava
ae2981d7ac
fix(runtime/fs): preserve permissions in copyFileSync for macOS (#17412)
Fixes https://github.com/denoland/deno/issues/16921
2023-01-14 13:45:30 +00:00
Kiryl Dziamura
934ed8e7d1
fix(npm): use original node regex in npm resolution (#17404)
Fixes regex for matching conditional exports in a package.
Updated to the same regex Node.js uses.
2023-01-14 00:57:24 +01:00
Bartek Iwańczuk
1b17985c5a
fix(permissions): lock stdio streams when prompt is shown (#17392)
This commit changes permission prompt to lock stdio streams when prompt
is shown.
2023-01-13 10:05:07 -05:00
Bartek Iwańczuk
9644220df2
tests: Disable flaky flash_shutdown test (#17390) 2023-01-13 15:19:20 +01:00
Yiyu Lin
a00e432297
chore: add copyright_checker tool and add the missing copyright (#17285) 2023-01-13 16:51:32 +09:00
Bartek Iwańczuk
9e282155b7
tests: move integration tests to a single module (#17380)
Effectively reverts changes done in
https://github.com/denoland/deno/pull/16816
2023-01-13 02:59:13 +01:00
Bartek Iwańczuk
4d66be1e05
Revert "test: fix flaky deno_land_unsafe_ssl test (#17357)" (#17368)
This reverts commit ee2c6cb04a.

Closes https://github.com/denoland/deno/issues/17359
2023-01-12 15:25:20 +01:00
Leo Kettmeir
cc806cdf21
fix: check if BroadcastChannel is open before sending (#17366)
Fixes #16978
2023-01-12 13:43:36 +01:00