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

282 commits

Author SHA1 Message Date
David Sherret
a4c1e1bdcf
fix: upgrade to swc_ecmascript 0.143 (#14238) 2022-04-08 12:31:47 -04:00
Jason
a6e4b4297d
refactor(lsp): migrate from lspower back to tower-lsp (#14163) 2022-04-03 14:17:30 +10:00
David Sherret
1535fdd949
chore: fix main (#14175) 2022-04-01 11:49:16 -04:00
David Sherret
1c37ac3352
chore(tests): use custom temp dir creation for the tests (#14153) 2022-04-01 11:15:37 -04:00
Divy Srivastava
b0f974fbfd
fix(compile): follow redirects when resolving (#14161) 2022-03-31 14:11:30 +05:30
David Sherret
d069360c46
chore(tests): add more lsp tests for formatting (#14155) 2022-03-30 18:44:47 -04:00
Kitson Kelly
061090de7e
feat(lsp): add experimental testing API (#13798)
Ref: denoland/vscode_deno#629
2022-03-30 09:59:27 +11:00
TrickyPi
85e16a08c7
feat(cli/fmt): ignore .git folder when formatting files (#14138) 2022-03-29 14:57:42 -04:00
Kitson Kelly
5a6a1eeb39
feat(lsp): support API for config file (#14139)
Closes: #13910
2022-03-29 11:27:43 +11:00
David Sherret
89dd5dac62
chore: fix compile_windows_ext test (#14142) 2022-03-28 14:38:15 -04:00
Luca Casonato
25b73a366f
fix(ext/ffi): enforce unstable check on ops (#14115) 2022-03-25 12:29:54 +01:00
Kitson Kelly
c755548e02
tests(cli): ignore previously unignored test (#14104)
Ref: #14103
2022-03-24 12:45:45 +11:00
Bartek Iwańczuk
b82ded84d3
fix(bench): require --unstable flag in JavaScript (#14091) 2022-03-23 16:33:42 +01:00
Bartek Iwańczuk
c3f306d778
fix(test): don't error on missing op details (#14074) 2022-03-23 00:24:45 +01:00
David Sherret
6268a1a6fd
chore: replace .expect("...") calls with .unwrap() in test code (#14081) 2022-03-22 15:10:00 -04:00
David Sherret
e46b5f738d
fix(tests): do not use global env vars in install tests (#14078) 2022-03-22 13:37:15 -04:00
Nayeem Rahman
d2c099ce34
fix(ext/fetch): Connect async error stack with user code (#13899) 2022-03-22 18:08:33 +01:00
Andreu Botella
12d28dffc6
fix(fetch): Fix uncaught rejection panic with WebAssembly.instantiateStreaming (#13925)
When an exception is thrown during the processing of streaming WebAssembly,
`op_wasm_streaming_abort` is called. This op calls into V8, which synchronously
rejects the promise and calls into the promise rejection handler, if applicable.
But calling an op borrows the isolate's `JsRuntimeState` for the duration of the
op, which means it is borrowed when V8 calls into `promise_reject_callback`,
which tries to borrow it again, panicking.

This change changes `op_wasm_streaming_abort` from an op to a binding
(`Deno.core.abortWasmStreaming`). Although that binding must borrow the
`JsRuntimeState` in order to access the `WasmStreamingResource` stored in the
`OpTable`, it also takes ownership of that `WasmStreamingResource` instance,
which means it can drop any borrows of the `JsRuntimeState` before calling into
V8.
2022-03-22 11:33:29 +01:00
David Sherret
b410937556
chore: fix development issues on Windows (#14030) 2022-03-21 14:30:43 +01:00
Kitson Kelly
1414dc503b
feat(lsp): support deno.enablePaths setting (#13978)
Ref: denoland/vscode_deno#633
2022-03-21 12:33:37 +11:00
TrickyPi
b01bc7faff
fix(cli): improve deno compile error messages (#13944)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-03-18 19:18:50 -04:00
David Sherret
748aff1e94
feat(task): add unstable warning to deno task (#13966) 2022-03-15 21:24:07 -04:00
Ryan Dahl
163e1d6192
disable flakes (#13962) 2022-03-15 11:19:59 -04:00
Bartek Iwańczuk
9d9e60b694
feat(task): log task script (#13922)
Logs task name and associated script with additional args.
This is disabled if "--quiet/-q" flag is present.
2022-03-12 02:35:18 +01:00
Bartek Iwańczuk
1a764790f2
test: fix flaky compat tests (#13921) 2022-03-12 02:08:55 +01:00
Bartek Iwańczuk
09ae512ccb
feat: "deno bench" subcommand (#13713)
This commit adds "deno bench" subcommand and "Deno.bench()"
API that allows to register bench cases. 

The API is modelled after "Deno.test()" and "deno test" subcommand.

Currently the output is rudimentary and bench cases and not
subject to "ops" and "resource" sanitizers.

Co-authored-by: evan <github@evan.lol>
2022-03-11 23:07:02 +01:00
Bartek Iwańczuk
47f22777be
feat: "deno task" subcommand (#13725)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-03-10 20:56:14 -05:00
Bartek Iwańczuk
808f797633
fix(compat): cjs/esm interop for dynamic imports (#13792)
This commit fixes CJS/ESM interop in compat mode for dynamically
imported modules.

"ProcState::prepare_module_load" was changed to accept a list
of "graph roots" without associated "module kind". That module kind
was always hardcoded to "ESM" which is not true for CJS/ESM interop -
a CommonJs module might be imported using "import()" function. In
such case the root of the graph should have "CommonJs" module kind
instead of "ESM".
2022-03-11 02:33:02 +01:00
Geert-Jan Zwiers
8db3a9546b
fix(test): skip typechecking for blocks inside HTML comments (#13889) 2022-03-11 02:14:32 +01:00
Geert-Jan Zwiers
e53b6c16bc
fix(test): typecheck blocks annotated with long js/ts notations (#13785) 2022-03-08 02:10:40 +01:00
Yoshiya Hinosawa
b751e97a01
fix(repl): fix null eval result (#13804)
Co-authored-by: Satya Rohith <me@satyarohith.com>
2022-03-02 13:39:08 +09:00
Bartek Iwańczuk
a65ce33fab
feat(compat): CJS/ESM interoperability (#13553)
This commit adds CJS/ESM interoperability when running in --compat mode.

Before executing files, they are analyzed and all CommonJS modules are
transformed on the fly to a ES modules. This is done by utilizing analyze_cjs()
functionality from deno_ast. After discovering exports and reexports, an ES
module is rendered and saved in memory for later use.

There's a caveat that all files ending with ".js" extension are considered as
CommonJS modules (unless there's a related "package.json" with "type": "module").
2022-02-27 14:38:45 +01:00
Bartek Iwańczuk
4bea1d06c7
fix(test): use --no-prompt by default (#13777)
This commit changes "deno test" subcommand, to
always never prompt for permissions (ie. as if "deno test"
was run with "--no-prompt" flag).
2022-02-26 14:49:50 +01:00
Bartek Iwańczuk
d332bf1132
feat: deno test --trace-ops (#13770)
This commit adds "--trace-ops" flag to "deno test" subcommand.

This flag enables saving of stack traces for async ops, that before were always
saved. While the feature proved to be very useful it comes with a significant performance
hit, it's caused by excessive source mapping of stack frames.
2022-02-25 16:14:46 +01:00
Yoshiya Hinosawa
111c343281
fix(cli): disable config discovery for remote script (#13745) 2022-02-25 14:39:18 +09:00
Divy Srivastava
03c55b4970
fix(compile): Support import maps (#13756) 2022-02-24 18:58:00 +05:30
Kitson Kelly
ee27b9dd7e
feat: allow specification of import map in config file (#13739)
Closes: #12800
2022-02-23 10:51:14 +11:00
Ryan Dahl
57f4b0e5af
feat: Add hint to permission prompt to display allow flag (#13695) 2022-02-17 00:14:46 +01:00
David Sherret
b98afb59ae
feat: deno vendor (#13670) 2022-02-16 13:14:19 -05:00
Luca Casonato
be9c2fe267
tests: deflake a bunch of net related tests (#13685) 2022-02-16 16:51:32 +01:00
William Tetlow
7b893bd57f
feat(cli): Replace bundling with eszip in deno compile (#13563)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-02-15 18:03:46 +05:30
Ryan Dahl
a5d204d425
feat: permission prompt by default (#13650) 2022-02-12 22:13:21 -05:00
Bartek Iwańczuk
2fa0096821
compat: support --compat in web workers (#13629)
Adds another callback to WebWorkerOptions that allows to execute
some modules before actual worker code executes. This allows to set up Node
global using std/node.
2022-02-11 13:41:56 +01:00
Kitson Kelly
2f2c778a07
feat(lsp): support linking to symbols in JSDoc on hover (#13631)
Closes #13198
2022-02-10 10:08:53 +11:00
Kitson Kelly
773f882e5e
feat(lsp): provide completions from import map if available (#13624)
Closes #13619
2022-02-10 07:13:50 +11:00
Leo Kettmeir
4799aaac15
refactor: factor out CDP message types (#13551) 2022-02-07 17:05:49 +01:00
Kitson Kelly
af5a373e00
feat(lsp): add redirect diagnostic and quick fix (#13580)
Ref: #12864
2022-02-04 18:14:57 +11:00
Luca Casonato
681c3be18d
fix: don't crash when $HOME is a relative path (#13581)
Absolutize the cache/home dir before use in DenoDir.
2022-02-03 14:08:17 +01:00
David Sherret
ed3086e4b1
refactor(lsp): remove circular dependency between LanguageServer and DiagnosticsServer (#13577) 2022-02-02 18:02:59 -05:00
Kitson Kelly
de5a4a1757
fix(cli): handle local files with query params on emit (#13568)
Fixes #13562
2022-02-03 06:48:54 +11:00
Zheyu Zhang
5490cfed20
feat(cli): add "--no-clear-screen" flag (#13454)
This commit adds "--no-clear-screen" flag which can be used
with "--watch" flag to disable clearing of terminal screen on
each file change.
2022-01-31 17:39:39 +01:00
Kitson Kelly
68c8c66b0f
fix(cli): handle extensionless imports better (#13548)
Fixes #13526
2022-01-31 20:32:49 +11:00
Luca Casonato
b53997273d
feat(test): better errors for resource sanitizer (#13296)
This commit makes the errors produced from the resource sanitizer much
more human readable. It does this by using real words rather than our
"resource names" when referring to resources, and by giving helpful
hints on how to clean up each of the resources.
2022-01-25 17:03:38 +01:00
David Sherret
2f72c44e1d
fix(lsp): independent diagnostic publishing should include all diagnostic sources on each publish (#13483) 2022-01-24 18:04:24 -05:00
David Sherret
bc8de78da3
perf(lsp): independent diagnostic source publishes (#13427) 2022-01-24 15:30:01 -05:00
Bartek Iwańczuk
23d2b34d4b
tests: Add inspector tests for "Memory" and "Profile" tabs (#13476) 2022-01-24 16:07:08 +01:00
Kitson Kelly
3ec248cff8
fix(lsp): respect DENO_CERT and other options related to TLS certs (#13467)
Fixes #13437
2022-01-24 11:27:52 +11:00
David Sherret
0f3a53e5d4
feat: stabilize test steps API (#13400) 2022-01-18 15:02:56 -05:00
Ryan Dahl
39ea4abff4
feat: auto-discover config file (#13313) 2022-01-17 20:10:17 -05:00
Bartek Iwańczuk
b10563cb20
fix(runtime): don't crash when window is deleted (#13392)
This commit fixes an error when user deletes "window" global JS
variable. Instead of relying on "window" or "globalThis" to dispatch
"load" and "unload" events, we are default to global scope of the
worker.
2022-01-18 00:13:14 +01:00
Bartek Iwańczuk
bc666e42a8
fix(ext/console): don't depend on globalThis present (#13387) 2022-01-17 23:23:49 +01:00
Andreu Botella
9def44979a
fix(cli): Don't strip shebangs from modules (#13220)
Deno's module loader currently strips a shebang if a module file
starts with one. However, this is no longer necessary, since there is
a stage-3 TC39 that adds support for shebangs (or "hashbangs") to the
language (https://github.com/tc39/proposal-hashbang), and V8, `tsc`
and `swc` all support it.

Furthermore, stripping shebangs causes a correctness bug with JSON
modules, since a JSON file with a shebang should not parse as a JSON
module, yet it does with this stripping. This change fixes this.
2022-01-16 16:48:32 +01:00
Bartek Iwańczuk
dc58063d00
test: type check lib.deno_core.d.ts (#13356) 2022-01-14 19:05:16 +01:00
juju
50e8ab8a86
feat(cli): add ignore directives to bundled code (#13309)
This commit adds lint and fmt ignore directives to bundled
code as well as a comment stating that the code was bundled
and shouldn't be edited manually.
2022-01-12 13:05:06 +01:00
Bartek Iwańczuk
13751d9de6
fix(coverage): merge coverage ranges (#13334)
Covered ranges were not merged and thus it appeared that some lines
might be uncovered. To fix this I used "v8-coverage" that takes care
of merging the ranges properly. With this change, coverage collected
from a file by multiple entrypoints is now correctly calculated.

I ended up forking https://github.com/demurgos/v8-coverage and adding
"cli/tools/coverage/merge.rs" and "cli/tools/coverage/range_tree.rs".
2022-01-11 21:17:25 +01:00
Rabin Gaire
605b8db8f6
cli(compile): fix output flag behaviour on compile command (#13299) 2022-01-10 23:24:39 -05:00
Bartek Iwańczuk
a3b3a792b5
fix(coverage): don't type check (#13324)
This commit changes "deno coverage" command not to type check.

Instead of relying on infrastructure for module loading in "deno run";
the code now directly reaches into cache for original and transpiled
sources. In case sources are not available the error is returned to the
user, suggesting to first run "deno test --coverage" command.
2022-01-10 17:36:58 +01:00
Bartek Iwańczuk
bd53567acf
test: add inspector test with ts files (#13312) 2022-01-09 17:44:36 +01: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
Kitson Kelly
57bfa87b2c
feat(lsp): provide registry details on hover if present (#13294)
Closes: #13272
2022-01-07 11:27:13 +11:00
Leo Kettmeir
2067820714
feat(ext/websocket): server automatically handle ping/pong for incoming WebSocket (#13172) 2022-01-06 17:41:16 +01:00
VishnuJin
d9b130410b
feat(compat) preload Node.js built-in modules in global vars REPL (#13127)
This commit adds preloading of built-in Node.js modules in
the REPL if running with "deno repl --compat --unstable".
2022-01-03 20:10:17 +01:00
Steven Guerrero
39a6c94071
feat(test): Add support for "deno test --compat" (#13235) 2021-12-30 17:18:30 +01:00
Bartek Iwańczuk
1adf8ee545
fix(core): inspector works if no "Runtime.runIfWaitingForDebugger" message is sent (#13191)
This commit changes flow in inspector code to no longer require 
"Runtime.runIfWaitingForDebugger" message to complete a handshake.

Even though clients like Chrome DevTools always send this message on startup,
it is against the protocol to require this message to start an inspector
session.

Instead "Runtime.runIfWaitingForDebugger" is required only when running with
"--inspect-brk" flag, which matches behavior of Node.js.
2021-12-30 16:47:58 +01:00
Leo Kettmeir
167982be9e
feat: output cause on JS runtime errors (#13209) 2021-12-29 19:34:13 +01:00
David Sherret
7ebbda7fd7
fix(coverage): use only string byte indexes and 0-indexed line numbers (#13190) 2021-12-23 20:02:54 -05:00
Kitson Kelly
37dbe5249c
fix(cli): include JSON modules in bundle (#13188)
Fixes #13150
2021-12-24 09:38:20 +11:00
Kitson Kelly
8547a37132
chore: update deno_graph and deno_doc (#13173) 2021-12-22 14:25:06 +01:00
David Sherret
ac06797fa8
chore(tests): remove pty_complete_imports test for deleting the cwd (#13164) 2021-12-21 12:21:07 -05:00
Bartek Iwańczuk
f3cd9a94b5
fix: inspector prompts (#13123)
This commit fixes prompts printed to the terminal when
running with "--inspect" or "--inspect-brk" flags.

When debugger disconnects error is no longer printed as
users don't care about the reason debugger did disconnect.

A message suggesting to go to "chrome://inspect" is printed
if debugger is active.

Additionally and information that process is waiting for
debugger to connect is printed if running with "--inspect-brk"
flag.
2021-12-17 18:43:25 +01:00
Nayeem Rahman
9ffc7edc23
refactor(cli): use GraphData for check and emit (#12960) 2021-12-16 21:45:41 +11:00
Kitson Kelly
e28fb70aee
fix(lsp): provide diagnostics for import assertions (#13105)
Fixes: #13099
2021-12-16 14:53:17 +11:00
Jesper van den Ende
0f53b82cd2
fix(test): wait for inspector session in side modules (#13065)
This commit fixes inspector integration with "deno test" subcommand
by waiting for inspector sessions to connect if "--inspect-brk" flag
is passed.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-12-16 00:38:27 +01:00
Jesper van den Ende
5a3ded6611
feat(watch): support watching external files (#13087) 2021-12-15 16:04:43 -05:00
David Sherret
6c324acf23
feat: REPL import specifier auto-completions (#13078) 2021-12-15 13:23:43 -05:00
Bartek Iwańczuk
a1f0796fcc
feat: Add support for import assertions and JSON modules (#12866)
This commit adds proper support for import assertions and JSON modules.

Implementation of "core/modules.rs" was changed to account for multiple possible
module types, instead of always assuming that the code is an "ES module". In
effect "ModuleMap" now has knowledge about each modules' type (stored via
"ModuleType" enum). Module loading pipeline now stores information about
expected module type for each request and validates that expected type matches
discovered module type based on file's "MediaType".

Relevant tests were added to "core/modules.rs" and integration tests,
additionally multiple WPT tests were enabled.

There are still some rough edges in the implementation and not all WPT were
enabled, due to:
a) unclear BOM handling in source code by "FileFetcher"
b) design limitation of Deno's "FileFetcher" that doesn't download the same
module multiple times in a single run

Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2021-12-15 19:22:36 +01:00
Yoshiya Hinosawa
308813ae29
fix(ext/web): set location undefined when --location is not specified (#13046) 2021-12-14 00:35:59 +09: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
Bartek Iwańczuk
13d7d57227
feat(watcher): clear screen on each restart (#12613)
This commit adds automatic clearing of terminal screen after
restarting execution on file change.
2021-12-11 01:12:25 +01:00
David Sherret
f530189c50
fix(watch): mitigate race condition between file write by other process and watch read (#13038) 2021-12-09 20:24:37 -05:00
Kitson Kelly
345f0fbe5c
feat(cli): update to TypeScript 4.5 (#12410)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-12-10 09:12:21 +11:00
David Sherret
1507b8c984
fix: upgrade swc fixing many bundling and --no-check bugs (#13025) 2021-12-08 19:12:14 -05:00
Andreu Botella
33da15ae5a
refactor(timers): refactor timers to use one async op per timer (#12862)
This change also makes the timers implementation closer to the spec, and
sets up the stage to implement AbortSignal.timeout() (whatwg/dom#1032).

Fixes #8965
Fixes #10974
Fixes #11398
2021-12-07 13:39:58 +01:00
Ryan Dahl
a2f1357fe8
chore: upgrade to rustls 0.20 (#12488)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2021-12-07 00:48:11 +01:00
Andreu Botella
9a10668694
fix(test): Improve reliability of deno test's op sanitizer with timers (#12934)
Although not easy to replicate in the wild, the `deno test` op sanitizer
can fail when there are intervals that started before a test runs, since
the op sanitizer can end up running in the time between the timer op for
an interval's run resolves and the op for the next run starts.

This change fixes that by adding a new macrotask callback that will run
after the timer macrotask queue has drained. This ensures that there is
a timer op if there are any timers which are unresolved by the time the
op sanitizer runs.
2021-11-30 01:27:30 +01:00
Kitson Kelly
18a63dd977
feat: add --no-check=remote flag (#12766)
Closes #11970
2021-11-30 09:23:30 +11:00
Andreu Botella
4a13c320d7
fix(workers): Make worker.terminate() not immediately kill the isolate (#12831)
Due to a bug in V8, terminating an isolate while a module with top-level
await is being evaluated would crash the process. This change makes it
so calling `worker.terminate()` will signal the worker to terminate at
the next iteration of the event loop, and it schedules a proper
termination of the worker's isolate after 2 seconds.
2021-11-29 13:37:44 +01:00
Bartek Iwańczuk
5178e093ed
Revert "fix(test): Improve reliability of deno test's op sanitizer with timers (#12908)" (#12929)
This reverts commit d335343a79.
2021-11-29 12:07:47 +01:00
Andreu Botella
d335343a79
fix(test): Improve reliability of deno test's op sanitizer with timers (#12908)
Although not easy to replicate in the wild, the `deno test` op sanitizer
can fail when there are intervals that started before a test runs, since
the op sanitizer can end up running in the time between the timer op for
an interval's run resolves and the op for the next run starts.

This change fixes that by adding a new macrotask callback that will run
after the timer macrotask queue has drained. This ensures that there is
a timer op if there are any timers which are unresolved by the time the
op sanitizer runs.
2021-11-28 16:40:38 +01:00
Ben Noordhuis
993a1dd41a
feat(runtime): add op_set_exit_code (#12911)
Set the exit code to use if none is provided to Deno.exit(), or when
Deno exits naturally.

Needed for process.exitCode Node compat. Paves the way for #12888.
2021-11-28 00:45:38 +01:00