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

222 commits

Author SHA1 Message Date
Geert-Jan Zwiers
e53b6c16bc
fix(test): typecheck blocks annotated with long js/ts notations (#13785) 2022-03-08 02:10:40 +01:00
Kitson Kelly
7fc5bfe51b
feat(cli): update to TypeScript 4.6.2 (#13474) 2022-03-02 07:44:43 +11: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
Simon Lecoq
c59152e400
feat(cli): support data url (#13667)
Closes #11141
2022-02-25 11:26:13 +11: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
Bartek Iwańczuk
551ace40cc
v1.19.0 2022-02-17 01:54:07 +01:00
Luca Casonato
53088e16de
feat(test): improved op sanitizer errors + traces (#13676)
This commit improves the error messages for the `deno test` async op
sanitizer. It does this in two ways:
- it uses handwritten error messages for each op that could be leaking
- it includes traces showing where each op was started

This "async op tracing" functionality is a new feature in deno_core.
It likely has a significant performance impact, which is why it is only
enabled in tests.
2022-02-16 19:53:17 +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
Andreu Botella
760f4c9e24
chore(ext/timers): move ext/timers to ext/web (#13665) 2022-02-15 12:17:30 +01: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
773f882e5e
feat(lsp): provide completions from import map if available (#13624)
Closes #13619
2022-02-10 07:13:50 +11:00
Bartek Iwańczuk
82284d8052
chore: forward v1.18.2 to main (#13595) 2022-02-04 21:44:38 +01:00
Kitson Kelly
af5a373e00
feat(lsp): add redirect diagnostic and quick fix (#13580)
Ref: #12864
2022-02-04 18:14:57 +11: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
Kitson Kelly
26f5c223df
fix(lsp): properly display x-deno-warning with redirects (#13554)
Fixes: #13472
2022-02-02 13:04:26 +11:00
Kitson Kelly
7d356250e8
refactor: integrate deno_graph breaking changes (#13495)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-02-01 09:33:57 +11:00
Kitson Kelly
68c8c66b0f
fix(cli): handle extensionless imports better (#13548)
Fixes #13526
2022-01-31 20:32:49 +11:00
Bartek Iwańczuk
5cf23176dc
chore: forward v1.18.1 to main (#13514) 2022-01-27 18:52:34 +01: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
Aaron O'Mullan
bd5d445da9
chore: re-enable wgpu_sync (#13453) 2022-01-24 23:47:05 +01: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
Divy Srivastava
2ea535c8c1
1.18.0 2022-01-20 21:49:30 +05:30
Aaron O'Mullan
3ab68bd0a2
revert(#13402): experiment: wgpu sync (#13439) 2022-01-20 15:23:53 +01:00
Yoshiya Hinosawa
4c1053ad33
chore: update copyright year (#13434) 2022-01-20 16:10:16 +09:00
Aaron O'Mullan
2ab21dafa7
experiment: wgpu sync (#13402) 2022-01-19 13:38:51 +01: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
9975ede773
chore: forward v1.17.3 to main (#13364) 2022-01-13 20:47:42 +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
Rodney van den Velden
c487b7ed54
fix: expose "Deno.memoryUsage()" in worker context (#13293) 2022-01-09 23:42:14 +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
Bartek Iwańczuk
46f2ff1205
chore: forward 1.17.2 to main (#13295) 2022-01-06 13:20:42 +01:00
Leo Kettmeir
c40419b55b
feat(ext/websocket): add header support to WebSocketStream (#11887) 2022-01-05 17:41:44 +01:00
David Sherret
19c8cd3a45
fix: upgrade swc_ecmascript to 0.103 (#13284) 2022-01-04 17:02:56 -05:00
Kitson Kelly
01ff7a8784
fix(lsp): handle repeating patterns in registry correctly (#13275) 2022-01-04 17:42:33 +11:00
Bartek Iwańczuk
a721c34c19
chore: update std submodule to efa94f2 (#13260) 2022-01-02 14:04:40 +01:00
Kitson Kelly
0ae46a975c
fix(lsp): properly generate data URLs for completion items (#13246) 2022-01-02 16:25:42 +11:00
Steven Guerrero
39a6c94071
feat(test): Add support for "deno test --compat" (#13235) 2021-12-30 17:18:30 +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
Bartek Iwańczuk
9391ba1098
chore: merge v1.17.1 into main (#13184) 2021-12-22 22:20:17 +01:00
Kitson Kelly
8547a37132
chore: update deno_graph and deno_doc (#13173) 2021-12-22 14:25:06 +01:00
Jesper van den Ende
0888ba7a8d
feat(lsp): add code lens for debugging tests (#13138)
Closes: #13130
2021-12-20 16:00:38 +11:00
Bartek Iwańczuk
5f11f87495
v1.17.0 2021-12-16 19:24:16 +01:00
Andreu Botella
01a6b66034
feat: support abort reasons in Deno APIs and WebSocketStream (#13066) 2021-12-16 12:57:26 +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
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
Kitson Kelly
e8d7b430ce
chore: updates to support deno_graph API changes (#13080) 2021-12-15 07:39:20 +11:00
Kitson Kelly
a54fc7a129
feat(lsp): improve registry completion suggestions (#13023)
Resolves #10051
2021-12-14 06:24:11 +11: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
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
Luca Casonato
72e9720e91
chore: merge v1.16.4 into main (#12984) 2021-12-04 01:26:54 +01:00
KnorpelSenf
4c36fa1fdf
chore: Fix typo in no-pending-ops error message (#12948) 2021-12-01 15:22: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
Andreu Botella
1974eb1021
fix(websocket): bad rid on WebSocketStream abort(#12913)
Fix a bad resource ID error when aborting a WebSocketStream immediately
after its creation.
2021-11-28 12:25:49 +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
Ben Noordhuis
47cf7b0b2e
fix(cli): fix slow test, unbreak ci (#12897)
Reduce the number of iterations from 1,024 to 128.

On my big bruiser of a desktop machine it already takes up close to a
minute to complete when nothing else is running so no way it's going to
finish in the allotted time on the CI.

The fact that the test used to pass may be indicative of a performance
regression somewhere but it's not clear to me when or where that would
have been introduced.

Fixes #12887.
2021-11-25 14:25:22 +01:00
Bert Belder
c6f3493f18
chore: merge v1.16.3 into main (#12892) 2021-11-24 15:56:18 -08:00
David Sherret
adc5974333
fix(lsp): lsp should respect include/exclude files in format config (#12876) 2021-11-24 15:14:19 -05:00
Bartek Iwańczuk
1117d2db39
compat: support compat mode in REPL (#12882)
This commit introduces "ProcState::maybe_resolver" field, which
stores a single instance of resolver for the whole lifetime of the
process, instead of creating these resolvers for each creation
of module graph. As a result, this resolver can be used in fallback
case where graph is not constructed (REPL, loading modules using
"require") unifying resolution logic.
2021-11-24 16:55:10 +01:00
Bartek Iwańczuk
d2c53e7f10
tests: remove 'fmt_check_tests_dir' test (#12875) 2021-11-23 18:36:13 +01:00
Bartek Iwańczuk
bedb2adfb0
refactor: remove "unitTest" wrapper from cli/tests/unit (#12750) 2021-11-23 17:45:18 +01:00
David Sherret
51e3db956a
fix(cli): config file should resolve paths relative to the config file (#12867)
* Add `specifier_to_file_path` to support converting a ModuleSpecifier with a unix-style path to a PathBuf on Windows.
2021-11-23 10:38:11 -05:00
Bartek Iwańczuk
d8afd56838
feat(test): Add more overloads for "Deno.test" (#12749)
This commit adds 4 more overloads to "Deno.test()" API.

```
// Deno.test(function testName() { });
export function test(fn: (t: TestContext) => void | Promise<void>): void;

// Deno.test("test name", { only: true }, function() { });
export function test(
  name: string,
  options: Omit<TestDefinition, "name">,
  fn: (t: TestContext) => void | Promise<void>,
): void;

// Deno.test({ name: "test name" }, function() { });
export function test(
  options: Omit<TestDefinition, "fn">,
  fn: (t: TestContext) => void | Promise<void>,
): void;

// Deno.test({ only: true }, function testName() { });
export function test(
  options: Omit<TestDefinition, "fn" | "name">,
  fn: (t: TestContext) => void | Promise<void>,
): void;
```
2021-11-23 14:57:51 +01:00
Kitson Kelly
bf5657cd59
feat(lsp): add workspace symbol provider (#12787) 2021-11-23 11:08:56 +11:00
David Sherret
4836ab769c
1.16.2 (#12794) 2021-11-17 11:00:58 -05:00
Nayeem Rahman
cd9193f126
fix(cli): short-circuit in prepare_module_load() (#12604) 2021-11-16 10:25:52 +11:00
David Sherret
ec9f5d5af2
feat(unstable/test): include test step pass/fail/ignore counts in final report (#12432) 2021-11-15 10:20:37 -05:00
Geert-Jan Zwiers
58e7b290dc
fix(test): support typechecking docs with CRLF line endings (#12748) 2021-11-15 09:58:04 -05:00
Luca Casonato
fdf890a68d
v1.16.1 2021-11-11 11:59:29 +01:00
Bartek Iwańczuk
8ce53dd22b
fix: update unstable Deno props for signal API (#12723) 2021-11-10 14:30:20 +01:00
Kitson Kelly
31fde9deba
chore(lsp): align ScriptElementKind to current versions of TypeScript/vscode (#12663) 2021-11-09 21:45:40 +11:00
Kitson Kelly
f5eb177f50
feat(cli): support React 17 JSX transforms (#12631)
Closes #8440
2021-11-09 12:26:39 +11:00
Yoshiya Hinosawa
8e010b6844
feat(compat): add .code to dyn import error (#12633) 2021-11-08 16:02:40 +09:00
Zheyu Zhang
efe956b4fd
fix(lint): use recommended tag if there is no tags in config file or flags (#12644) 2021-11-04 11:12:12 -04:00