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

193 commits

Author SHA1 Message Date
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
Luca Casonato
318dcc33af
Revert "feat(cli): enable useUnknownInCatchVariables by default" (#12643)
This partially reverts commit a065604155.

Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2021-11-04 11:30:37 +01:00
Ryan Dahl
7c2abb9d57
fix: Deno.emit crashes with BorrowMutError (#12627)
Warn on await_holding_refcell_ref clippy rule to avoid this in the future.

Fixes #12453
2021-11-03 09:27:36 -04:00
Bartek Iwańczuk
e06515c5a9
feat(test): better formatting for test elapsed time (#12610)
This commit changes formatting of elapsed time in test
runner output.

Instead of "XXXms", reporter outputs one of:
- "XXXms" for <1000ms
- "XXs" for <60s
- "XXXmYYs" for >=60s
2021-10-30 22:49:46 +02:00
Bartek Iwańczuk
f77c5701f7
feat(compat): integrate import map and classic resolutions in ESM resolution (#12549)
This commit integrates import map and "classic" resolutions in
the "--compat" mode when using ES modules; in effect
"http:", "https:" and "blob:" imports now work in compat mode.

The algorithm works as follows:

1. If there's an import map, try to resolve using it and if succeeded
return the specifier
2. Try to resolve using "Node ESM resolution", and if succeeded return
the specifier
3. Fall back to regular ESM resolution
2021-10-28 10:11:38 +02:00
Kitson Kelly
a065604155
feat(cli): enable useUnknownInCatchVariables by default (#12547)
Closes #11826

**BREAKING CHANGE** this behaviour was disable when introduced in Deno 1.14/TypeScript 4.4. It will highlight code that unsafely handles variables that are caught, and will cause type errors in unsafe code.
2021-10-28 08:43:40 +11:00
Kitson Kelly
b44b26c884
fix(cli): no-check respects inlineSources compiler option (#12559)
Fixes #12064
2021-10-27 17:18:53 +11:00
Kitson Kelly
1c739470b5
feat(ext/webstorage): use implied origin when --location not set (#12548)
Closes #11882

BREAKING CHANGE: Previously when `--location` was set, the unique storage key was derived from the the URL of the location instead of just the origin. This change correctly uses just the origin. This may cause previously persisted storage to change its key and data to not be available with the same location as before.
2021-10-27 11:10:27 +11:00
Kitson Kelly
56d9a020d9
fix(cli): do not cache emit when diagnostics present (#12541)
Fixes #12471
2021-10-26 10:34:16 +11:00
Nayeem Rahman
e8ee5da459
fix(core/bindings): use is_instance_of_error() instead of is_native_error() (#12479) 2021-10-19 18:26:45 +02:00
Bartek Iwańczuk
617eeabe83
feat(unstable): Node CJS and ESM resolvers for compat mode (#12424)
This commit adds CJS and ESM Node resolvers to the "--compat" mode.

The functionality is spread across "cli/compat" module and Node compatibility
layer in "deno_std/node"; this stems from the fact that ES module resolution
can only be implemented in Rust as it needs to directly integrated with 
"deno_core"; however "deno_std/node" already provided CJS module resolution.

Currently this resolution is only active when running a files using 
"deno run --compat --unstable <filename>", and is not available in other
subcommands, which will be changed in follow up commits.
2021-10-18 19:36:28 +02:00
Nayeem Rahman
5a48d41bdd
fix(cli/fmt_errors): don't panic on source line formatting errors (#12449)
Returns empty values in case of errors, source lines are non-essential anyway. These errors can happen e.g. when source files change at runtime. A warning is also printed to help us track when it happens in unexpected cases besides this.
2021-10-18 18:05:36 +02:00
Kitson Kelly
34418884f4
fix(cli): re-enable allowSyntheticDefaultImports for tsc (#12435)
Fixes #12434
2021-10-14 21:13:15 +11:00
Nayeem Rahman
86f7bf89c5
fix(cli/tests): move worker test assertions out of message handlers (#12439) 2021-10-14 11:44:33 +02:00
Nayeem Rahman
7a22df9b76
fix(runtime/ops/worker_host): move permission arg parsing to Rust (#12297) 2021-10-13 13:04:44 -04:00
David Sherret
43a63530ac
chore: test for bundling export specifier with alias (#12421) 2021-10-13 08:55:28 -04:00
David Sherret
d5a7a6d575
chore: fix flaky steps_invalid_usage tests (#12422) 2021-10-13 08:55:12 -04:00
Bartek Iwańczuk
f332d72f16
fix(lsp): lint diagnostics respect config file (#12338)
This commit fixes problem with LSP where diagnostics coming
from "deno lint" don't respect configuration file.

LSP was changed to store "Option<ConfigFile>", "Option<LintConfig>"
and "Option<FmtConfig>" on "Inner"; as well as storing "Option<LintConfig>"
and "Option<FmtConfig>" on "StateSnapshot".

Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2021-10-12 00:02:33 +02:00
Andreu Botella
fbcbbd7ae3
fix(runtime): Declare Window.self and DedicatedWorkerGlobalScope.name with util.writable() (#12378)
`Window`'s `self` property and `DedicatedWorkerGlobalScope`'s `name`
property are defined as Web IDL read-only attributes with the
`[Replaceable]` extended attribute, meaning that their setter will
redefine the property as a data property with the set value, rather than
changing some internal state. Deno currently defines them as read-only
data properties instead.

Given that Web IDL requires all attributes to be accessor properties
rather than data properties, but Deno exposes almost all of those
properties as either read-only or writable data properties, it makes
sense to expose `[Replaceable]` properties as writable as well – as is
already the case with `WindowOrWorkerGlobalScope`'s `performance`
property.
2021-10-11 18:50:18 +02:00
Casper Beyer
1683044ed9
feat: provide ops details for ops sanitizer failures (#12188) 2021-10-11 17:00:33 +02:00
David Sherret
426ebf854a
feat(unstable/test): imperative test steps API (#12190) 2021-10-11 09:45:02 -04:00
Kitson Kelly
a7baf5f2bb
refactor: integrate deno_graph into CLI (#12369) 2021-10-11 08:26:22 +11:00
Andreu Botella
5edd277161
feat: Show the URL of streaming WASM modules in stack traces (#12268)
WebAssembly modules compiled through `WebAssembly.compile()` and similar
non-streaming APIs don't have a URL associated to them, because they
have been compiled from a buffer source. In stack traces, V8 will use
a URL such as `wasm://wasm/d1c677ea`, with a hash of the module.

However, wasm modules compiled through streaming APIs, like
`WebAssembly.compileStreaming()`, do have a known URL, which can be
obtained from the `Response` object passed into the streaming APIs. And
as per the developer-facing display conventions in the WebAssembly
Web API spec, this URL should be used in stack traces. This change
implements that.
2021-10-10 16:03:23 +02:00
Satya Rohith
25771b3d9b
feat(ext/net): relevant errors for resolveDns (#12370) 2021-10-10 15:44:45 +05:30
Nayeem Rahman
330aaae936
tests: make worker test deterministic (#12361) 2021-10-07 22:53:09 +02:00
Bartek Iwańczuk
4e3068be63
Revert "fix(cli): ensure empty lines don't count towards coverage (#11957)" (#12348)
This reverts commit d5b38a9929.
2021-10-06 19:28:28 +02:00
Bartek Iwańczuk
b686907a45
feat(compat): inject Node globals (#12342)
This commit adds automatic injection of Node globals when "--compat" flag
is present.

This is done by executing "https://deno.land/std/node/global.ts" as a "side module",
before main module is executed.

This commit makes "--compat" required to be used with "--unstable" flag, as some
of Node globals require unstable Deno APIs.
2021-10-06 19:07:04 +02:00
Casper Beyer
d5b38a9929
fix(cli): ensure empty lines don't count towards coverage (#11957) 2021-10-06 07:05:18 +02:00
Bartek Iwańczuk
37a24c7bdf
feat(compat): add support for node: prefixed built-ins (#12337)
Adds support for "node:" prefix for Node built-ins in "--compat" mode.

As per https://nodejs.org/api/esm.html#esm_node_imports
2021-10-06 01:25:13 +02:00
CGQAQ
c555b31d40
feat(lint): add support for --watch flag (#11983) 2021-10-05 23:07:38 +02:00