0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-31 09:14:20 -04:00
Commit graph

4443 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
d47147fb6a
feat(ext/node): embed std/node into the snapshot (#17724)
This commit moves "deno_std/node" in "ext/node" crate. The code is
transpiled and snapshotted during the build process.

During the first pass a minimal amount of work was done to create the
snapshot, a lot of code in "ext/node" depends on presence of "Deno"
global. This code will be gradually fixed in the follow up PRs to migrate
it to import relevant APIs from "internal:" modules.

Currently the code from snapshot is not used in any way, and all
Node/npm compatibility still uses code from 
"https://deno.land/std/node" (or from the location specified by 
"DENO_NODE_COMPAT_URL"). This will also be handled in a follow 
up PRs.

---------

Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-02-14 17:38:45 +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
b3c85c3548
feat(node): stabilize Node-API (#17553)
This commit stabilizes Node-API, the "--unstable" flag is no longer
required to load native extensions. "--allow-ffi" permission is still 
required to load them.
2023-02-14 15:53:00 +01:00
Bartek Iwańczuk
201737c518
feat: stabilize Deno.osUptime() (#17554)
This commit stabilizes "Deno.osUptime()" API. The "--unstable" flag is
no longer required to use this API.
2023-02-14 12:35:38 +01:00
Bartek Iwańczuk
2502a37d41
chore(build): don't compress TSC snapshot in debug build (#17772)
Compressing the TSC snapshot in debug build took
~45s on M1 MacBook Pro; without compression it took ~1s.
Thus we're not not using compressed snapshot, trading off
a lot of build time for some startup time in debug build.
2023-02-14 02:46:32 +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
Bartek Iwańczuk
f917d2e2c1
feat: Stabilize Deno.Command API (#17628)
This commit stabilizes "Deno.Command" API with all its related APIs.

"--unstable" flag is no longer required to use this API.
2023-02-13 19:25:00 +01:00
Bartek Iwańczuk
f80a1fa7e9
refactor(runtime): reorganize build script for snapshot (#17760)
This commit reorganizes "runtime/build.rs" to properly create an
extension and conditionally include "99_main.js" in the snapshot.
2023-02-13 15:34:32 +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
Serhiy Barhamon
fc843d035c
feat(bench): Add JSON reporter for "deno bench" subcommand (#17595) 2023-02-12 17:40:45 +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
aryan02420
bbcb144a6d
fix(fmt): make fmt options CLI args less verbose (#17550)
Make deno fmt options CLI args less verbose #17546
2023-02-11 19:39:56 +02:00
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
Kamil Ogórek
68008bee51
fix(dts): make Deno.Command accept readonly prop in options.args (#17718) 2023-02-10 18:09:02 +01:00
Divy Srivastava
39f131cd76
fix(cli/napi): correct name handling in napi property descriptor (#17716)
Fixes https://github.com/denoland/deno/issues/17712
2023-02-10 21:46:56 +05:30
Bartek Iwańczuk
46817a0e3d
refactor: clean up "cli/node/mod.rs" and "ext/node" (#17713)
This commit moves some code around from "cli/node/mod.rs" to
"ext/node". Additionally "ext/node" was changed to factor out
"ops.rs" and "polyfill.rs" modules.
2023-02-10 10:26:39 -05:00
Kamil Ogórek
5778e1196e
feat(install): follow redirects for urls with no path (#17449)
This change makes absolute urls, that contain no path like `deno install
https://my-cli.io` to follow redirects and extract the name from it.

It allows modifies `test_util` server listener on port `4550`
(`REDIRECT_ABSOLUTE_PORT`) to allow for specifying `redirect_to` query
param, that fill use that value for it's next redirect.

Fixes https://github.com/denoland/deno/issues/17409
2023-02-10 10:11:11 -05:00
Divy Srivastava
4baaa246a2
fix(cli/napi): handle all property variants in napi_define_properties (#17680)
Fixes https://github.com/denoland/deno/issues/17509

This fixes the bug that blocked loading `fsevents` in Deno.
2023-02-10 12:50:47 +00:00
Bartek Iwańczuk
ed3a7ce2f7
refactor: allow to provide polyfills for Node modules from the snapshot (#17706)
This commit does preparatory work to allow snapshotting Node.js
compatibility layer, that currently lives in `std/node`. The logic was 
changed to allow loading some modules from the snapshot and 
some from the remote URL.

Additionally "module_es_shim.js" that provides exports for "node:module"
is now snapshotted.
2023-02-10 11:40:45 +00:00
David Sherret
b3e88e0681
refactor: deno_graph 0.43 upgrade (#17692) 2023-02-09 22:00:23 -05:00
David Sherret
717daf4748
perf: module info cache - avoid MediaType.to_string() allocation (#17699)
Micro optimization because these allocations were coming up on a flame
graph I was looking at (only 0.28% of total).
2023-02-09 09:17:48 -05:00
David Sherret
8b0a612e30
perf: disable fetching graph cache info except for deno info (#17698) 2023-02-08 19:45:04 -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
Leo Kettmeir
286e5d0be9
refactor: internal runtime code TS support (#17672)
This is a proof of concept for being able to snapshot TypeScript files.

Currently only a single runtime file is authored in TypeScript -
"runtime/js/01_version.ts".

Not needed infrastructure was removed from "core/snapshot_util.rs".

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-08 22:40:18 +01:00
Waldir Pimenta
19543ffec3
fix(ext/console): Only right-align integers in console.table() (#17389) 2023-02-08 18:14:40 +09:00
Ikko Eltociear Ashimine
0597499e9e
chore(cli/tools): fix typo in upgrade.rs (#17690)
vesion -> version
2023-02-08 03:32:30 +00: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
David Sherret
1e75e5ecc7
refactor: remove old cjs_esm_translations in graph_util (#17643)
This isn't used.
2023-02-03 23:00:50 -05: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
b16a958c4f
fix(lsp): prevent crash analyzing module (#17642)
Closes #17640
2023-02-03 14:10:51 -05:00
denobot
f8ecd236fb
chore: forward v1.30.2 release commit to main (#17641)
This is the release commit being forwarded back to main for 1.30.2

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-02-03 16:26:43 +00:00
denobot
65755a115a
chore: forward v1.30.1 release commit to main (#17623)
This is the release commit being forwarded back to main for 1.30.1
2023-02-02 16:28:40 +00: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
Divy Srivastava
690b6ac39e
fix(napi): remove wrong length check in napi_create_function (#17614)
This check is not needed. 

This PR + #17613 makes `npm:ref-napi` work with Deno.
2023-02-01 20:18:03 +05:30
Divy Srivastava
524bccdf6a
fix(napi): return node globalThis from napi_get_global (#17613)
Fixes https://github.com/denoland/deno/issues/17587
2023-02-01 15:41:04 +01:00
David Sherret
600fff79cd
refactor(semver): generalize semver related structs (#17605)
- Generalizes the npm version code (ex. `NpmVersion` -> `Version`,
`NpmVersionReq` -> `VersionReq`). This is a slow refactor towards
extracting out this code for deno specifiers and better usage in
deno_graph.
- Removes `SpecifierVersionReq`. Consolidates `NpmVersionReq` and
`SpecifierVersionReq` to just `VersionReq`
- Removes `NpmVersionMatcher`. This now just looks at `VersionReq`.
- Paves the way to allow us to create `NpmPackageReference`'s from a
package.json's dependencies/dev dependencies
(`VersionReq::parse_from_npm`).
2023-01-31 21:27:40 -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
Leo Kettmeir
3035dee9f1
chore: update webgpu (#17534) 2023-01-30 15:14:16 +01:00
Kenta Moriuchi
266915d5ce
fix(ext): internal structuredClone for ArrayBuffer and TypedArray subclasses (#17431) 2023-01-29 15:15:01 +01:00
RA80533
50ba8ae6b2
docs: fix typos in WriteFileOptions's JSDoc (#17507) 2023-01-28 22:10:06 +01:00
David Sherret
8b35229da3
fix(install): tsconfig.json -> deno.json for config file suffix (#17573)
Closes #17571
2023-01-28 14:51:11 -05:00
David Sherret
fe11df09b1
fix(lsp): update document dependencies on configuration change (#17556) 2023-01-28 10:18:32 -05:00
David Sherret
1803df7d3a
fix(fmt): semiColons: false - handle prop with following generator and do while with no block body (#17567)
Closes #17559
2023-01-28 10:06:37 -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
Geert-Jan Zwiers
1a1faff2f6
chore(cli/cache): fewer string allocations (#17549) 2023-01-27 20:46:38 +05:30
Geert-Jan Zwiers
7f38f30a5c
refactor(lsp): fewer clones (#17551) 2023-01-26 23:24:03 +01:00
David Sherret
21065797f6
fix(upgrade): ensure temp dir cleanup on failure (#17535)
Closes #17533
2023-01-26 09:02:25 -05:00
denobot
a6f915c22f
1.30.0 (#17532)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-26 00:15:08 +01: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
Leo Kettmeir
b71d224d11
fix(upgrade): don't display release information for canary (#17516) 2023-01-25 16:29:27 +01: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
Asher Gomez
0d1471282b
feat(upgrade): link to release notes & blog post (#17073)
This change prints a link to the release notes to `deno upgrade` output
and its variations.

Release notes aren't printed for commands relating to canary versions.

Closes #16350.
2023-01-24 13:30:45 +01: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
Divy Srivastava
cd19231306
fix(napi): improve napi_adjust_external_memory (#17501)
<!--
Before submitting a PR, please read http://deno.land/manual/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->
2023-01-23 19:00:01 +05:30
Divy Srivastava
b96bbc32c8
fix(napi): improve napi_is_detached_arraybuffer (#17498) 2023-01-23 14:22:18 +05:30
Divy Srivastava
2e1df62380
fix(napi): improve napi_detach_arraybuffer (#17499) 2023-01-23 14:21:55 +05:30
Divy Srivastava
c3e3694b9d
fix(napi): correctly handle name in napi_create_function (#17489)
Fixes https://github.com/denoland/deno/issues/17472
2023-01-22 15:04:18 +05:30
Bartek Iwańczuk
da23f7f876
feat: Stabilize Deno.Listener.ref/unref (#17477) 2023-01-20 16:32:55 +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
denobot
f2a5f6d7f0
chore: forward v1.29.4 release commit to main (#17453)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-17 00:30:33 +01:00
Geert-Jan Zwiers
e023a6e3f0
refactor(cli): fewer clones (#17450) 2023-01-16 15:27:41 -05:00
David Sherret
40527526e5
refactor(npm): avoid cloning snapshot for lockfile (#17451) 2023-01-16 19:46:30 +00: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
David Sherret
9d3483d4eb
fix(repl): improve validator to mark more code as incomplete (#17443)
Closes #17442
2023-01-16 09:45:06 -05: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
Yiyu Lin
fd85f840cd
refactor: clean up unwrap and clone (#17282)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-01-15 09:36:46 +05:30
Bartek Iwańczuk
df8bfa26be
fix(napi): functions related to errors (#17370)
This commits fixes various NAPI functions related to creation and
throwing of errors.
2023-01-15 09:06:55 +05:30
David Sherret
7cd249db10
fix(npm): handle an npm package that has itself as a dependency (#17425)
I'm not sure this properly handles scenarios where an npm package uses
an alias that resolves to itself, we can fix that if we find a package
that actually depends on that behavior.

Closes #17420
2023-01-14 15:10:07 -05:00
David Sherret
01e02d3123
refactor: create enum for --builtin doc flag (#17423) 2023-01-14 12:39:56 -05:00
David Sherret
1712a88e69
refactor(tsc): do not store some typescript declaration file text in multiple places (#17410) 2023-01-14 09:36:19 -05: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
Divy Srivastava
b9cd19a1e8
chore(napi): Remove unstable libuv methods (#17416)
This commit removes the libuv pollyfills introduced with Node-API
support.

It is too much Node-specific. Most Node-API modules that depend on libuv
are already giving up the benefits of Node-API. We should rather
encourage modules to use `ThreadSafeFunction` or `AsyncWork` to
interface with the event loop.

Relevant discussion a few months ago:
https://github.com/denoland/deno/pull/13633#discussion_r904916178

cc @bartlomieju
2023-01-14 13:02:42 +00:00
Bartek Iwańczuk
b4ce48c80a
fix(napi): correct arguments for napi_get_typedarray_info (#17306) 2023-01-14 13:00:48 +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
Max Coplan
b23b4e231c
refactor(bench/http): Use optional chaining instead of || fallthrough (#17317) 2023-01-14 00:51:57 +01:00
Geert-Jan Zwiers
6557642fc8
refactor(coverage): use FileFlags struct (#17388) 2023-01-13 16:56:29 -05:00
Geert-Jan Zwiers
052bcc62bb
refactor(cli/tools): reduce cloning (#17309) 2023-01-13 22:39:19 +01:00
Lino Le Van
d4767a1a87
fix(napi): update node version to lts (#17399) 2023-01-13 22:10:53 +01:00
David Sherret
377f593273
chore: forward 1.29.3 release back to main (#17401) 2023-01-13 13:36:51 -05: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
Bartek Iwańczuk
291dcc31f7
fix(napi): date and unwrap handling (#17369) 2023-01-13 12:53:45 +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
Divy Srivastava
dd2829be0c
fix(napi): Implement napi_threadsafe_function ref and unref (#17304)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-12 13:47:55 +01:00
Leo Kettmeir
cc806cdf21
fix: check if BroadcastChannel is open before sending (#17366)
Fixes #16978
2023-01-12 13:43:36 +01:00
Leo Kettmeir
a6b3910bdf
feat: allow passing a ReadableStream to Deno.writeFile/Deno.writeTextFile (#17329)
Closes #13229
2023-01-12 03:37:23 +01:00
Leo Kettmeir
692f9af14a
fix: don't unwrap in test pipe handling logic (#17341)
Fixes #14746
2023-01-12 02:30:23 +01:00
Bartek Iwańczuk
ee2c6cb04a
test: fix flaky deno_land_unsafe_ssl test (#17357) 2023-01-12 01:04:25 +01:00
Leo Kettmeir
b0e0e4f24b
fix: don't panic on resolveDns if unsupported record type is specified (#17336)
Fixes #14373
2023-01-11 21:31:14 +01:00
David Sherret
8c3c02354d
fix(fmt): better handling of link reference definitions when formatting markdown (#17352)
Two fixes:

- https://github.com/dprint/dprint-plugin-markdown/pull/75
- https://github.com/dprint/dprint-plugin-markdown/pull/73
2023-01-11 18:35:45 +00:00
Bartek Iwańczuk
14ada3dce2
fix(napi): support for env cleanup hooks (#17324)
This commit adds support for "napi_add_env_cleanup_hook" and
"napi_remove_env_cleanup_hook" function for Node-API.
2023-01-10 19:15:10 +01:00
Nayeem Rahman
71ea4ef274
fix(watch): preserve ProcState::file_fetcher between restarts (#15466)
This commit changes "ProcState" to store "file_fetcher" field in an "Arc",
allowing it to be preserved between restarts and thus keeping the state
alive between the restarts. File watchers for "deno test" and "deno bench"
now reset "ProcState" between restarts.
2023-01-10 16:28:10 +01:00
Bartek Iwańczuk
0329bc69da
fix(napi): handle static properties in classes (#17320)
Adds support for static properties when using "napi_define_class".
2023-01-10 15:35:46 +01:00
Bartek Iwańczuk
636352e0ca
fix(npm): allow to read package.json if permissions are granted (#17209)
This commit changes signature of "deno_core::ModuleLoader::resolve" to pass
an enum indicating whether or not we're resolving a specifier for dynamic import.

Additionally "CliModuleLoader" was changes to store both "parent permissions" (or
"root permissions") as well as "dynamic permissions" that allow to check for permissions
in top-level module load an dynamic imports.

Then all code paths that have anything to do with Node/npm compat are now checking
for permissions which are passed from module loader instance associated with given
worker.
2023-01-10 14:35:44 +01:00
Leo Kettmeir
e6c49d14b1
feat(runtime/os): add Deno.env.has() (#17315) 2023-01-09 20:19:55 +01:00
Geert-Jan Zwiers
fa175d8cda
fix(cli/args): update value_name of inspect args to resolve broken completions (#17287)
This PR updates the name used in `clap::Arg::value_name` for the
`--inspect*` flags from `HOST:PORT` to `HOST_AND_PORT` because the
former causes an arguments error when using shell completions in the
`zsh` shell.
2023-01-09 13:29:43 +01:00