1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
Commit graph

4485 commits

Author SHA1 Message Date
Bartek Iwańczuk
48ede89f1f
refactor(core): resolve_url_or_path and resolve_url_or_path_deprecated (#18170)
This commit changes current "deno_core::resolve_url_or_path" API to
"resolve_url_or_path_deprecated" and adds new "resolve_url_or_path"
API that requires to explicitly pass the directory from which paths
should be resolved to. 

Some of the call sites were updated to use the new API, the reminder
of them will be updated in a follow up PR.

Towards landing https://github.com/denoland/deno/pull/15454
2023-03-14 01:12:09 +00:00
Bartek Iwańczuk
c4771356f2
refactor: Remove call sites of "deno_core::resolve_url_or_path" (#18169)
These call sites didn't need to use "resolve_url_or_path".

Towards landing https://github.com/denoland/deno/pull/15454
2023-03-13 19:31:03 -04:00
David Sherret
a35c8e6588
fix(info/doc): add missing --no-lock and --lock flags (#18166)
Closes #18159
2023-03-13 17:04:00 -04:00
David Sherret
44b0d4cb11
fix(npm): show a progress bar when initializing the node_modules folder (#18136)
Creating the node_modules folder when the packages are already
downloaded can take a bit of time and not knowing what is going on can
be confusing. It's better to show a progress bar.
2023-03-13 18:18:29 +00:00
Bartek Iwańczuk
e8f22c0765
refactor(core): pass cwd explicitly to resolve_path (#18092)
Towards landing #15454
2023-03-13 18:50:23 +01:00
David Sherret
11f225ef7d
fix: ensure no node_modules directory is created when a package.json exists and no npm dependencies are used (#18134)
Closes #18133
Closes #18038
2023-03-13 14:03:19 +00:00
Geert-Jan Zwiers
983447e860
chore(cli/tests): use test builder in more integration tests (#18031) 2023-03-13 09:40:46 -04:00
Ryan Dahl
224cff7a2f
Revert "feat(core): prevent isolate drop for CLI main worker (#18059)" (#18157)
Fixes https://github.com/denoland/deno/issues/18120
https://github.com/denoland/deno/issues/18137
https://github.com/denoland/fresh/issues/1073

This reverts commit 0cce9c2bcc.
2023-03-13 12:58:17 +00:00
Kenta Moriuchi
e5673f5ed8
fix(core): SafePromiseAll to be unaffected by Array#@@iterator (#17542) 2023-03-13 19:24:31 +09:00
David Sherret
bcb6ee9d08
refactor(npm): push npm struct creation to a higher level (#18139)
This has been bothering me for a while and it became more painful while
working on #18136 because injecting the shared progress bar became very
verbose. Basically we should move the creation of all these npm structs
up to a higher level.

This is a stepping stone for a future refactor where we can improve how
we create all our structs.
2023-03-12 23:32:59 -04:00
David Sherret
8db853514c
fix(check): regression where config "types" entries caused type checking errors (#18124)
Closes #18117
Closes #18121 (this is just over 10ms faster in a directory one up from
the root folder)

cc @nayeemrmn
2023-03-11 11:43:45 -05:00
Ikko Eltociear Ashimine
e4430400ce
chore: typo (#18128) 2023-03-11 08:58:55 -05:00
denobot
857393d934
chore: forward v1.31.2 release commit to main (#18114)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-03-10 17:39:29 +09:00
Lino Le Van
c7a5f928d3
chore(cli): fix outdated comment (#18106) 2023-03-09 21:13:53 -05:00
Bartek Iwańczuk
d1685b120b
refactor(core): remove RuntimeOptions::extensions_with_js (#18099)
This commit removes "deno_core::RuntimeOptions::extensions_with_js".

Now it's embedders' responsibility to properly register extensions
that will not contains JavaScript sources when running from an existing
snapshot.

Prerequisite for https://github.com/denoland/deno/pull/18080
2023-03-09 19:22:27 -05:00
Bartek Iwańczuk
78d430103a
fix(prompt): better output with control chars (#18108) 2023-03-10 01:09:14 +01:00
Bartek Iwańczuk
44e67df1cd
fix: Split extension registration and snapshotting (#18098)
This commit partially reverts changes from
https://github.com/denoland/deno/pull/18095.

Turns out I made a mistake that became apparent when working
on removing "RuntimeOptions::extensions_with_js" in a follow up.
2023-03-09 21:09:45 +01:00
David Sherret
47012bd931
refactor(tests/lsp): consolidate more into test LspClient and reduce verbosity (#18100) 2023-03-09 15:09:03 -05:00
Bartek Iwańczuk
bb07e230d1
chore: update Rust to 1.68.0 (#18102) 2023-03-09 19:18:00 +00:00
Bartek Iwańczuk
8f207c0f3f
refactor: Split extension registration for runtime and snapshotting (#18095)
This commit splits "<ext_name>::init" functions into "init_ops" and
"init_ops_and_esm". That way we don't have to construct list of
ESM sources on each startup if we're running with a snapshot.

In a follow up commit "deno_core" will be changed to not have a split
between "extensions" and "extensions_with_js" - it will be embedders'
responsibility to pass appropriately configured extensions.

Prerequisite for https://github.com/denoland/deno/pull/18080
2023-03-09 14:56:19 +00:00
Divy Srivastava
99da8a69e7
fix(ext/webstorage): check size of inputs before insert (#18087) 2023-03-09 12:28:51 +00:00
David Sherret
25d98ca289
refactor(lsp): improve test client initialization (#18015) 2023-03-08 23:15:20 +00:00
David Sherret
23e1ba7e2d
fix(npm): improve peer dependency resolution with circular dependencies (#18069)
This improves peer dependency resolution yet again. We did not handle
scenarios like the following:

```
// a -> b -> c -> d -> c -> b (peer)
```

...which would maybe work ok the first time its run in some cases, but
then lead to a lockfile that would error on load.

This now keeps track of circular dependencies and updates nodes
accordingly. That said, there is still a lurking bug in this code
somewhere that I've added a comment for (there is a mitigation on the
tail end that seems to work well). The current state is much better than
before and I can look into it later. I think it's something small that's
incorrect.
2023-03-08 12:22:08 -05:00
Divy Srivastava
0cce9c2bcc
feat(core): prevent isolate drop for CLI main worker (#18059)
```
Benchmark 1: deno run -A ../empty.js
  Time (mean ± σ):      20.5 ms ±   0.5 ms    [User: 13.4 ms, System: 5.1 ms]
  Range (min … max):    19.8 ms …  24.0 ms    119 runs

Benchmark 2: target/release/deno run -A ../empty.js
  Time (mean ± σ):      18.8 ms ±   0.3 ms    [User: 13.0 ms, System: 4.9 ms]
  Range (min … max):    18.3 ms …  19.9 ms    129 runs
  ```

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-08 22:21:14 +05:30
Bartek Iwańczuk
06a12341c6
chore: update tempfile dependency (#18077) 2023-03-08 16:46:27 +00:00
Bartek Iwańczuk
0e8fc4dc6c
Revert "perf: disable snapshot compression (#18061)" (#18074)
This reverts commit d12b039e1a.

It was landed as an experiment and it confirms much faster startup
if not compression is applied.
2023-03-08 21:14:04 +05:30
David Sherret
88b5fd9088
fix: attempt to only allow one deno process to update the node_modules folder at a time (#18058)
This is implemented in such a way that it should still allow processes
to go through when a file lock wasn't properly cleaned up and the OS
hasn't released it yet (but with a 200ms-ish delay).

Closes #18039
2023-03-08 15:13:13 +00:00
Bartek Iwańczuk
72fe9bb470
refactor: rename InternalModuleLoader to ExtModuleLoader, use ext: scheme for snapshotted modules (#18041)
This commit renames "deno_core::InternalModuleLoader" to
"ExtModuleLoader" and changes the specifiers used by the 
modules loaded from this loader to "ext:".

"internal:" scheme was really ambiguous and it's more characters than
"ext:", which should result in slightly smaller snapshot size.

Closes https://github.com/denoland/deno/issues/18020
2023-03-08 12:44:54 +01:00
Bartek Iwańczuk
d24c6ea27f
refactor(runtime): conditionally register Extension with source files (#18068)
Since we are snapshotting extension source at build time, there's no
need to define list of sources for the extension at runtime.

This commit changes "deno_node" extension by removing "init_polyfill"
function in favor of "init_polyfill_ops_and_esm()" and "init_polyfill_ops()".

The former is used during snapshot and when "deno_runtime" is compiled
with "dont_create_runtime_snapshot" cargo feature flag. The latter is used
when running a worker from an existing snapshot.

This is a start of a bigger refactor to all extensions - thanks to this
change, we don't have to iterate over all defined source files for extension at
runtime, and because of that we don't have to create a filepath for each of the
source files. It's not a big deal, but we are iterating over 300 files on each start,
and concatenating 3 strings before creating a "PathBuf" for ~200 of them.
This is already visible on the startup flamegraphs and should be avoided.
2023-03-08 12:43:26 +01:00
Bartek Iwańczuk
b32a6f8ad2
refactor(core): don't use Result in ExtensionBuilder::state (#18066)
There's no point for this API to expect result. If something fails it should
result in a panic during build time to signal to embedder that setup is
wrong.
2023-03-07 22:37:37 +01:00
Caleb Cox
0e3affcd5b
fix(cli): add space after period in --v8-flags (#18063)
Add space between period and "Any" in `--v8-flags` help text.
2023-03-07 17:07:28 +01:00
ayame113
08591d052a
chore(docs): Fixed manual link (#18060) 2023-03-07 08:01:56 -05:00
Bartek Iwańczuk
d12b039e1a
perf: disable snapshot compression (#18061)
This commit disables snapshot compression for the CLI snapshot.]

Decompressing the snapshot on startup takes ~2.5ms.
2023-03-07 13:57:58 +01:00
Bartek Iwańczuk
fe368b72c1
refactor: Add "deno_fs" extension crate (#18040)
This commit factors out APIs related to file system from "runtime/"
to a separate "deno_fs" extension crate.
2023-03-07 18:13:44 +09:00
Nick Hanley
64354f4112
chore(tests): use temp dir in test missing_deno_dir (#18057)
Fixes #18056
2023-03-07 00:00:51 -05:00
David Sherret
ff4b03f233
chore(tests): ability to capture stdout and stderr separately (#18035)
This is to allow making assertions on stdout and stderr separately.
2023-03-06 09:16:50 -05:00
Bartek Iwańczuk
5f34c9be91
refactor: move definition of Deno.build from "runtime" to "core" (#18036)
We use information about build in several extension crates like
"ext/node" or "runtime/". In an effort to move "fs" APIs to a separate 
crate it is a prerequisite to have this information available outside 
of the "runtime/" crate.

This commit moves definition of "build" object to "Deno.core" that is 
later forwarded to "Deno.build".
2023-03-05 22:18:13 +00:00
Nayeem Rahman
273777f7d9
fix(check): include dts files in tsc roots (#18026) 2023-03-05 12:47:04 -05:00
Filip Skokan
7d13d65468
fix(ext/crypto): correctly limit ECDSA and hash algorithms (#18030)
Closes #18029
2023-03-05 12:34:07 +00:00
Bartek Iwańczuk
888ceac7fd
refactor(runtime): remove 40_files.js, 40_write_file.js and 40_read_file.js (#18018)
JavaScript APIs from "runtime/js/40_files.js" combined abstractions
for stdio streams ("Stdout", "Stderr", "Stdin") and file system file
("File", "FsFile"). APIs from "runtime/js/40_read_file.js" and 
"runtime/js/40_write_file.js" were implemented using ops from 
"runtime/ops/fs.rs".

This file was removed and relevant APIs were moved to "deno_io/12_io.js"
and "runtime/js/30_fs.js".

This work is meant to enable factoring out "deno_fs" crate.
2023-03-05 03:37:37 +00:00
Bartek Iwańczuk
b40086fd7d
refactor(core): include_js_files! 'dir' option doesn't change specifiers (#18019)
This commit changes "include_js_files!" macro from "deno_core"
in a way that "dir" option doesn't cause specifiers to be rewritten 
to include it.

Example:
```
include_js_files! {
  dir "js",
  "hello.js",
}
```

The above definition required embedders to use:
`import ... from "internal:<ext_name>/js/hello.js"`. 
But with this change, the "js" directory in which the files are stored
is an implementation detail, which for embedders results in: 
`import ... from "internal:<ext_name>/hello.js"`.

The directory the files are stored in, is an implementation detail and 
in some cases might result in a significant size difference for the 
snapshot. As an example, in "deno_node" extension, we store the 
source code in "polyfills" directory; which resulted in each specifier 
to look like "internal:deno_node/polyfills/<module_name>", but with 
this change it's "internal:deno_node/<module_name>". 

Given that "deno_node" has over 100 files, many of them having 
several import specifiers to the same extension, this change removes
10 characters from each import specifier.
2023-03-05 02:31:38 +00:00
Andreu Botella
01028fcdf4
test(compile): Add a test for dynamic imports in deno compile (#18017)
denoland/eszip#115 added support for statically-analyzed dynamic imports
in eszip, which made `deno compile` support dynamic imports starting
from #17858. This PR adds a test for it.

----

This test is adapted from PR #17663.

Closes #17908
2023-03-05 01:37:54 +00:00
David Sherret
2f7222da8a
refactor: remove Semaphore::new(1) and use TaskQueue (#18014) 2023-03-04 20:07:11 -05:00
Bartek Iwańczuk
7afa3aceb0
refactor(runtime): factor out deno_io extension crate (#18001)
This is a prerequisite to factor out FS ops to a separate crate.
2023-03-05 00:39:48 +00:00
Geert-Jan Zwiers
58ec963bf1
refactor: simplify to string calls (#18011) 2023-03-04 08:05:07 -04:00
Geert-Jan Zwiers
399a22db88
chore(docs): add note about loadavg returning 0 on windows (#18006) 2023-03-04 05:31:55 -04:00
David Sherret
84bafd11d5
fix: lazily surface errors in package.json deps parsing (#17974)
Closes #17941
2023-03-03 18:27:05 -04:00
Bartek Iwańczuk
5c43e2a665
chore: update deno_std submodule to 0.178.0 (#18003) 2023-03-03 19:11:10 +00:00
Divy Srivastava
38555a6a0f
feat(ops): reland fast zero copy string arguments (#17996)
Reland https://github.com/denoland/deno/pull/16777

The codegen is disabled in async ops and when fallback to slow call is
possible (return type is a Result) to avoid hitting this V8 bug:
https://github.com/denoland/deno/issues/17159
2023-03-03 19:04:10 +05:30
Yusuke Tanaka
88c9a999f7
chore(cli): update deno_lint to 0.41.0 (#17997)
<!--
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.
-->

This commit updates deno_lint crate to 0.41.0. The new version contains
a braking change that requries a minor code fix here, which is also
addressed in this commit.
2023-03-02 21:50:17 +00:00
Kenta Moriuchi
55833cf799
fix(core): introduce SafeRegExp to primordials (#17592) 2023-03-01 08:14:16 +09:00
David Sherret
ea1cb4c2fa
chore(test): remove TestCommandOutput macros (#17975) 2023-02-28 15:10:12 -04:00
David Sherret
7c090b1b14
chore: test builders for integration tests (#17965)
Start of adding test builders to simplify integration tests.

I only updated a few test files. We can complete upgrading over time.
2023-02-27 16:52:49 -04:00
Yoshiya Hinosawa
92ba46c384
chore(ext/node): suppress node compat tests stdout by default (#17909) 2023-02-27 19:39:33 +09:00
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
denobot
3cd24fa8d0
chore: forward v1.31.1 release commit to main (#17939)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-02-24 22:37:46 -05:00
David Sherret
b5b331e31a
fix(npm): skip analyzing more specifiers in package.json (#17938) 2023-02-25 02:16:26 +00:00
David Sherret
d6192ce8fd
fix: regression remapping remote specifier to local file (#17935)
Tests added to deno_graph, which were previously not there.

Closes #17932
2023-02-25 01:23:51 +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
David Sherret
5683daf1aa
fix: ignore workspace specifiers in package.json (#17934)
Part of #17916
2023-02-24 19:27:50 -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
6472afd12b
fix: remote modules should be allowed to import data urls (#17920)
This was a regression that has already been broken for some time, but
that also became broken for when using an import map 1.31.

Closes #17914
2023-02-24 12:50:03 -05:00
denobot
c26fbe38d5
1.31.0 (#17906)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-24 00:16:04 +01: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
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
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
David Sherret
5becfd6381
fix(npm): filter out duplicate packages names in resolution (#17857) 2023-02-21 15:19:09 -05: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
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