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

52 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
David Sherret
9d3483d4eb
fix(repl): improve validator to mark more code as incomplete (#17443)
Closes #17442
2023-01-16 09:45:06 -05: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
Geert-Jan Zwiers
052bcc62bb
refactor(cli/tools): reduce cloning (#17309) 2023-01-13 22:39:19 +01:00
Bartek Iwańczuk
fac6447815
refactor(permissions): add PermissionsContainer struct for internal mutability (#17134)
Turns out we were cloning permissions which after prompting were discarded,
so the state of permissions was never preserved. To handle that we need to store
all permissions behind "Arc<Mutex<>>" (because there are situations where we
need to send them to other thread).

Testing and benching code still uses "Permissions" in most places - it's undesirable
to share the same permission set between various test/bench files - otherwise
granting or revoking permissions in one file would influence behavior of other test
files.
2023-01-07 17:25:34 +01:00
Yiyu Lin
896dd56b7a
refactor(cli,core,ext,rt): remove some unnecessary clone or malloc (#17274) 2023-01-05 14:29:50 -05:00
David Sherret
0ee64ad847
fix: upgrade deno_ast to 0.23 (#17269)
Closes #17172
Closes #15669
Closes #8529
2023-01-04 18:54:54 -05:00
David Sherret
10e4b2e140
chore: update copyright year to 2023 (#17247)
Yearly tradition of creating extra noise in git.
2023-01-02 21:00:42 +00:00
sigmaSd
c39550fe52
fix(repl): doing two history searches exiting with ctrl+c should not exit repl (#17079)
fix https://github.com/denoland/deno/issues/16147
2022-12-16 18:39:52 -05:00
Bartek Iwańczuk
efcb93f8b9
fix(npm): fix require resolution if using --node-modules-dir (#17087)
In our `require()` implementation we use a special logic to resolve
"base path" when looking for matching packages, however this logic
is in contradiction to what needs to happen if there's a local
"node_modules"
directory used. This commit changes require implementation to be aware
if we're running off of global node modules cache or a local one.
2022-12-16 23:41:51 +01:00
Bartek Iwańczuk
a202e38316
refactor(core): allow to listen for notifications in LocalInspectorSession (#17040) 2022-12-16 20:12:06 +01:00
Bartek Iwańczuk
ff71ef8175
fix(repl): errors shouldn't terminate repl (#17082)
This commit changes REPL to never surface errors coming
from code execution, but instead print them as errors
to the REPL itself.
2022-12-16 17:11:10 +01:00
Bartek Iwańczuk
435948e470
feat(repl): support npm packages (#16770)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-12-13 13:53:32 +01:00
David Sherret
6541a0a9fd
refactor: cleanup main.rs (#16996)
1. Extracts out some code from main.rs
2. Inlines all the `x_command` functions in main.rs
2022-12-09 09:40:48 -05:00
Bartek Iwańczuk
1a472ad06b
feat(repl): run "deno repl" with no permissions (#16795)
This commit changes "deno repl" command to run with no permissions by
default and accept "--allow-*" flags. 

This change is dictated by the fact that currently there is no way to
run REPL with limited permissions. Technically it's a breaking 
change in the CLI command, but there's agreement in the team 
that it has merit and it's a good solution.

Running just "deno" command still starts the REPL with full permissions
allowed, but now a banner is printed to inform users about that:
2022-12-07 20:21:18 +01:00
Bartek Iwańczuk
d1962e07af
fix(repl): respect --quiet flag (#16875)
This commit changes REPL behavior to respect --quiet flag. Once 
this flag is present REPL will not print a banner at the start.
2022-11-30 23:25:20 +01:00
Bartek Iwańczuk
3a320db270
fix(inspector): send "isDefault" in aux data (#16836)
With trial and error I found that most debuggers expect "isDefault" to be sent
in "auxData" field of "executionContextCreated" notification. This stems from
the fact that Node.js sends this data and eg. VSCode requires it to close
connection to the debugger when the program finishes execution.
2022-11-26 23:09:48 +01:00
David Sherret
0c0af67f89
refactor: DenoDir - move to cache folder and make root_dir private (#16823) 2022-11-26 00:04:30 +00:00
David Sherret
6de3d7f184
refactor: move cdp.rs to tools/repl (#16821) 2022-11-25 18:38:08 -05:00
Bartek Iwańczuk
433f38084b
fix(repl): more reliable history handling (#16797)
This commit changes history handling of the REPL.

There were some situations were history wasn't properly saved and flushed to a
file, making history very spotty. This commit changes it to save every line into
the history file and flush it to disk before being evaluated.

Thanks to this all lines, including "close()" will be stored in the history
file.

If for any reason we're not able to save history file, a single warning will be
printed to the REPL and it will continue to work, even if subsequent tries will
fail to save to disk.
2022-11-25 02:56:47 +01:00
Kayla Washburn
1ef96343a1
feat: allow exiting on two consecutive ctrl+c presses (#15981) 2022-09-22 04:42:09 -04:00
Jason
8178665bd1
fix(cli/repl): await Promise.any([])... (#15623) 2022-09-02 13:38:06 +02:00
sigmaSd
5b2ae25f13
feat(repl): add color to functions for syntax highlighting (#15434) 2022-08-10 12:39:16 -04:00
sigmaSd
1f04cea160
chore(repl): update rustyline to 10.0.0 (#15232) 2022-07-18 20:47:00 +02:00
sigmaSd
efaa149819
fix(repl): use spaces for tab handler on windows (#14931)
There is a bug in rustyline with tabs on Windows, so we insert spaces for now.
2022-06-22 10:28:28 -04:00
David Sherret
7ad0d09228
chore: fix pty_tab_handler test on windows (#14927) 2022-06-21 15:24:50 -04:00
sigmaSd
ac2cf2cb3e
fix(repl): accept tab when previous character is whitespace (#14898) 2022-06-20 18:47:25 -04:00
sigmaSd
8bfa89a478
feat(repl): Add key binding to force a new line (#14536)
This commit adds key binding for "ctrl+s" 
combination that will force a new line in REPL.
2022-06-15 02:19:06 +02:00
David Sherret
1fcecb6789
refactor: upgrade to deno_ast 0.15 (#14680) 2022-05-20 16:40:55 -04:00
Luca Casonato
0ee76da07b
chore: update to rust 1.60.0 & update Cargo.lock (#14260)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-05-13 01:12:55 +02:00
Colin Ihrig
2a93c134dc
feat(repl): add global clear() function (#14332)
This commit adds a clear() function in the REPL which works
similar to console.clear().
2022-04-20 15:48:15 -04:00
Naju Mancheril
3833d37b15
feat(repl): add "--eval-file" flag to execute a script file on startup (#14247)
This commit adds support for "--eval-file" in "deno repl" subcommand.

This flag can be used to pass paths or URLs to files, that will be executed
on REPL startup. All files will be executed in the same context as the REPL
(ie. as "plain old scripts", not ES modules), sharing the global scope.

This feature allows to implement custom REPLs on top of Deno's REPL.
2022-04-20 14:16:37 +02:00
David Sherret
a4c1e1bdcf
fix: upgrade to swc_ecmascript 0.143 (#14238) 2022-04-08 12:31:47 -04:00
David Sherret
3b12afd072
chore: upgrade to Rust 1.59 (#13767) 2022-02-24 20:03:12 -05:00
Leo Kettmeir
4799aaac15
refactor: factor out CDP message types (#13551) 2022-02-07 17:05:49 +01:00
Bartek Iwańczuk
b7b6b9c9e5
Revert "refactor: factor out CDP message types (#13501)" (#13540)
This reverts commit 382a978859.
2022-01-31 14:00:18 +01:00
Leo Kettmeir
382a978859
refactor: factor out CDP message types (#13501) 2022-01-27 15:09:47 +01:00
David Sherret
f12164646b
refactor: move transpiling to deno_ast (#13332) 2022-01-13 11:58:00 -05:00
Ryan Dahl
1fb5858009
chore: update copyright to 2022 (#13306)
Co-authored-by: Erfan Safari <erfanshield@outlook.com>
2022-01-07 22:09:52 -05:00
Bartek Iwańczuk
3db18bf9e6
refactor(repl): factor out ReplEditor and ReplSession (#13131) 2021-12-18 02:18:17 +01:00
David Sherret
6c324acf23
feat: REPL import specifier auto-completions (#13078) 2021-12-15 13:23:43 -05:00
Bartek Iwańczuk
0dec9b4381
fix: op_set_exit_code (#13034)
Fixes "op_set_exit_code" by sharing a single "Arc" between
all workers (via "op state") instead of having a "global" value stored in
"deno_runtime" crate. As a consequence setting an exit code is always
scoped to a tree of workers, instead of being overridable if there are
multiple worker tree (like in "deno test --jobs" subcommand).

Refactored "cli/main.rs" functions to return "Result<i32, AnyError>" instead
of "Result<(), AnyError>" so they can return exit code.
2021-12-11 15:56:45 +01:00