profile
viewpoint
Bartek Iwańczuk bartlomieju @denoland Warsaw, PL

denoland/deno_lint 495

Blazing fast linter for JavaScript and TypeScript written in Rust

deno-postgres/deno-postgres 288

PostgreSQL driver for Deno

denoland/doc_website 128

Auto-generated documentation for Deno modules

bartlomieju/parseargs 27

Migrated to https://github.com/denoland/deno_std

dprint/dprint-plugin-typescript 18

TypeScript and JavaScript code formatting plugin for dprint.

bartlomieju/deno 2

A secure TypeScript runtime on V8

hayd/deno 2

A secure TypeScript runtime on V8

bartlomieju/deno_doc 1

Documentation generator for Deno

bartlomieju/bartlomieju.github.io 0

Code that'll help you kickstart a personal website that showcases your work as a software developer.

Pull request review commentdenoland/deno

fix(cli): use rid getter for stdio

 declare namespace Deno {   }    /** A handle for `stdin`. */-  export const stdin: Reader & ReaderSync & Closer & { rid: number };+  export const stdin: Reader & ReaderSync & Closer & { readonly rid: number };   /** A handle for `stdout`. */-  export const stdout: Writer & WriterSync & Closer & { rid: number };+  export const stdout: Writer & WriterSync & Closer & { readonly rid: number };   /** A handle for `stderr`. */-  export const stderr: Writer & WriterSync & Closer & { rid: number };+  export const stderr: Writer & WriterSync & Closer & { readonly rid: number };

@caspervonb that's true, I'm only afraid it's gonna cause type checking havoc, hopefully not many users access rid of stdio objects.

caspervonb

comment created time in an hour

PullRequestReviewEvent

push eventdenoland/deno

Casper Beyer

commit sha c488468b32ef3869a233190437641e5ec8ef11b6

feat(cli/repl): add tab completion (#7827) This commit adds tab completion in REPL. Currently it works only for global identifiers and object properties.

view details

push time in an hour

PR merged denoland/deno

feat(cli/repl) add tab completion

This adds tab completion for global identifiers and object properties.

Closes https://github.com/denoland/deno/issues/3086

+152 -28

6 comments

1 changed file

caspervonb

pr closed time in an hour

issue closeddenoland/deno

Add tab completion in REPL

One of the things that always bothers me about Node is that tab completion in the REPL doesn't work like PowerShell. I believe there is an opportunity to correct this with Deno.

In PowerShell, I can simply start the name of a command/file/etc... and cycle through of all the matches with tab (and in reverse order with shift + tab). For instance, typing in Get-P and pressing shift will cycle through Get-Package, Get-PackageProvider, Get-PackageSource, etc... This is extremely helpful when searching for a command in the middle of writing some long pipeline, such as:

Get-Process | Where cpu -gt 15 | Select name,cpu,description | ConvertTo-Json

If for some reason I didn't remember ConvertTo-Json, which is the command for converting the objects in the pipeline to a JSON formatted string, all I would have to do is type in convert and press shift a few times. This would quickly lead me to ConvertTo-Json without having to stop mid-way through to look up the commandlet.

I see a properly implemented tab completion as extremely useful as it greatly speeds up the process of writing short scripts in the REPL. Wouldn't it be nice in Deno if you could type in any arbitrary string, like con, and then press tab (and shift+tab to reverse) to cycle through all matching objects/variables until you found console. From there you type the period, i.e. console., and then again press tab to cycle through all of the available properties/methods (console.log, console.warn, console.dir, etc...).

closed time in an hour

sszczepa

Pull request review commentdenoland/deno

fix(cli): Handling of relative importmaps while using watch

 fn run_watch() {   drop(t); } +#[test]+fn run_watch_with_importmap_and_relative_paths() {+  fn create_relative_tmp_file(+    directory: &TempDir,+    filename: &'static str,+    filecontent: &'static str,+  ) -> std::path::PathBuf {+    let absolute_path = directory.path().join(filename);+    std::fs::write(&absolute_path, filecontent).expect("error writing file");+    let relative_path = absolute_path+      .strip_prefix(util::root_path())+      .expect("unable to create relative temporary file")+      .to_owned();+    assert!(relative_path.is_relative());+    relative_path+  }+  let temp_directory =+    TempDir::new_in(util::root_path()).expect("tempdir fail");+  let file_to_watch = create_relative_tmp_file(+    &temp_directory,+    "file_to_watch.js",

Nice test

Absebo

comment created time in an hour

PullRequestReviewEvent
PullRequestReviewEvent

push eventAbsebo/deno

Ryan Dahl

commit sha 374d433f1f4885686dc5c166be3a25c839e22959

Remove dead code (#7963)

view details

Kitson Kelly

commit sha 10654fa95553866c63a56a7f84c7ec47fb7aac9c

refactor(cli): add tsc2 (#7942) Ref #7225

view details

Bartek Iwańczuk

commit sha 135053486c4bd112ebd7d0b25c94a8dd346472e6

fix: top-level-await module execution (#7946) This commit changes implementation of top-level-await in "deno_core". Previously promise returned from module evaluation was not awaited, leading to out-of-order execution of modules that have TLA. It's been fixed by changing "JsRuntime::mod_evaluate" to be an async function that resolves when the promise returned from module evaluation also resolves. When waiting for promise resolution event loop is polled repeatedly, until there are no more dynamic imports or pending ops.

view details

Casper Beyer

commit sha e2a1a7c937b67d050e7e3287d7e5dbc6ffd9b168

refactor(cli/repl): clean up prelude injection (#7967) This extracts prelude injection into a helper function and moves the prelude string literal into a top level static string to help trim some of the fat out of the run function.

view details

Yoshiya Hinosawa

commit sha e9f02c231473ba42f506a895734d445cd31d379f

fix(console): fix the test cases of function inspections (#7965)

view details

Bartek Iwańczuk

commit sha 12e700bddfad8c23f6b55baca4ca4afb8337af26

fix(test): return error when awaiting unresolved promise (#7968) This commit fixes test runner by awaitning "Deno.runTests()" call, which ensures proper error is returned when there's an unresolved promise that's being awaited.

view details

vwkd

commit sha f9489e9acb0e3121bbd71ef0cf1826320d0c0995

fix typos (#7964)

view details

TTtie

commit sha f75bd89aff7cffafceb394d629995479af54a156

feat(cli/console): inspect with colors regardless of Deno.noColor (#7778) This commit adds the ability for users to inspect items stylized with ANSI colors regardless of the value of Deno.noColor.

view details

ali ahmed

commit sha 5bed06fb94214db70a27cca8fa8eff717d537dba

feat(std/fs/node): adding some functions (#7921)

view details

Bartek Iwańczuk

commit sha 81635c59e66b81a4c85aed6775aff4beedf71f14

Revert "feat(cli/console): inspect with colors regardless of Deno.noColor (#7778)" (#7973) This reverts commit f75bd89aff7cffafceb394d629995479af54a156.

view details

Bartek Iwańczuk

commit sha bd0c64b9aeeb75eea25402b0ebd5aecc2cec8e3a

Reland feat(cli/console): inspect with colors regardless of Deno.noColor (#7976)

view details

Kitson Kelly

commit sha bbe4474d39aecfabed52bd080e73d34978b6481b

fix(cli): ModuleGraph2 properly handles redirects (#7981)

view details

William Perron

commit sha 943b0980c7ff97cb6096291efa5e3d5dbfe10805

feat(cli/ops): add the sleep_sync op (#7974)

view details

Ben Noordhuis

commit sha 46b892ad37df9ba9bed77fb923a1cfe284b208dc

refactor(core): more control over isolate creation (#8000) Make JSRuntime::new() accept a custom v8::CreateParams object to tune the v8::Isolate it creates. Subsumes the functionality of HeapLimits, which I therefore removed.

view details

Bartek Iwańczuk

commit sha c1c760130406405c8fde9a74bd88c62ca721967b

upgrade: deno_doc, deno_lint, dprint, swc (#8009)

view details

Casper Beyer

commit sha b33e8d5d427934544fa6e0de44df8793aae63c9d

refactor(cli/repl): extract is_closing to a function (#8015) This extracts is closing into a function so that it can easily be used as the condition for the loop.

view details

Bartek Iwańczuk

commit sha 8f9da368f78b0dcd55e701b30daea8b45102a491

refactor(lint): show hint for lint errors (#8016) This commit adds formatting of optional "hint" that can be present in lint diagnostic.

view details

Ryan Dahl

commit sha 3e51610bbb5d5d63863b9989690ca1e8127fdf88

Remove github actions cache (#8020) Running into issues with cache when trying to upgrade V8. Based on the analysis in https://github.com/denoland/deno/pull/7903#issuecomment-706252380 we know the cache is not providing much benefit.

view details

Casper Beyer

commit sha 065db9df19fa9f1f598fc3a5c7fd978b484428de

test(std/io): use a real tempdir (#8019) This replaces a case of a temp file in the working tree with a tempfile in a real temporary directory avoiding pollution of the working directory.

view details

Ryan Dahl

commit sha 59888ff0b27f75feb3ea88cdea943bf9fbd345fd

upgrade rusty_v8 (#8017)

view details

push time in an hour

push eventbartlomieju/deno

Casper Beyer

commit sha 9d664f8375856be228e4f98b8381ac934d84604b

fix(cli/repl): ignore pair matching inside literals (#8037)

view details

Nayeem Rahman

commit sha 3f5513758d9e237d7c3775165c4164db89a95d31

feat(cli/installer): Add missing flags for deno install (#7601) This commit adds support for following flags: - deno install --importmap - deno install --no-remote - deno install --lock - deno install --lock-write - deno install --cached-only - deno install --v8-flags - deno install --seed

view details

push time in an hour

issue commentdenoland/deno

Test case failures in URLSearchParams constructor

CC @nayeemrmn

lala7573

comment created time in an hour

Pull request review commentdenoland/deno

fix(cli): use rid getter for stdio

 declare namespace Deno {   }    /** A handle for `stdin`. */-  export const stdin: Reader & ReaderSync & Closer & { rid: number };+  export const stdin: Reader & ReaderSync & Closer & { readonly rid: number };   /** A handle for `stdout`. */-  export const stdout: Writer & WriterSync & Closer & { rid: number };+  export const stdout: Writer & WriterSync & Closer & { readonly rid: number };   /** A handle for `stderr`. */-  export const stderr: Writer & WriterSync & Closer & { rid: number };+  export const stderr: Writer & WriterSync & Closer & { readonly rid: number };

This is breaking change 😬

caspervonb

comment created time in an hour

PullRequestReviewEvent

push eventdenoland/deno

Nayeem Rahman

commit sha 3f5513758d9e237d7c3775165c4164db89a95d31

feat(cli/installer): Add missing flags for deno install (#7601) This commit adds support for following flags: - deno install --importmap - deno install --no-remote - deno install --lock - deno install --lock-write - deno install --cached-only - deno install --v8-flags - deno install --seed

view details

push time in 2 hours

PR merged denoland/deno

feat(cli/installer): Add missing flags for deno install

Adds:

  • deno install --importmap
  • deno install --no-remote
  • deno install --lock
  • deno install --lock-write
  • deno install --cached-only
  • deno install --v8-flags
  • deno install --seed
  • deno install --inspect
  • deno install --inspect-brk

Closes #3929. Closes #7354.

+110 -167

1 comment

9 changed files

nayeemrmn

pr closed time in 2 hours

issue closeddenoland/deno

`deno install` does not support import maps

The deno install command should support the --importmap flag so that you would be able to write:

deno install --importmap import_map.json asd asd.ts

without it complaining about Found argument '--importmap' which wasn't expected, or isn't valid in this context.

closed time in 2 hours

eliassjogreen
PullRequestReviewEvent

push eventCodingCarter/deno

Ryan Dahl

commit sha 68099acbc6d816170ac60d33e4cd730d88dad5de

Don't expose ErrWithV8Handle from deno_core

view details

Ryan Dahl

commit sha b2fa903d64c74d64685397bbf4e98b031371d346

cli/msg.rs -> cli/media_type.rs

view details

Ryan Dahl

commit sha 0715803b7fdf6399f447f9fd2fdd2aa8b41beac7

Remove http_client from CliState, store in OpState directly (#7497)

view details

Casper Beyer

commit sha 35ed3ce8d914f46a0b5cdc66d05f6cecf895b966

ci: remove wasm target installation step (#7512)

view details

Sidd Sridharan

commit sha aa81bc73d96729f6593d55d2c1e66000e115dfe4

docs: fix typo assertAsyncThrows -> assertThrowsAsync (#7506)

view details

Pig Fang

commit sha aa657d6493cb0f36a5e2aa29e6352c9a9991ad2b

fix(std/testing): assertion diff color (#7499)

view details

Bartek Iwańczuk

commit sha d4a24c870e87b55dab425bc2c320aa88a6224030

Revert "fix(cli/http_utils): accept a single key-multiple values headers (#7375)" (#7515) This reverts commit f5c84920c225579af9c249bdac4a59a046ef8683.

view details

bartOssh

commit sha 81ca7096c5e8830cf8707c77fd244672e7e67c79

refactor(unstable): deno info --json output (#7417) Provide flat JSON structured output. Fix BrokenPipe error when piping out to "head".

view details

Ryan Dahl

commit sha f58b10ec646533bb573e9fcc61160e31cb21ae05

simplify global properties (#7502)

view details

Bert Belder

commit sha 21f2e45b0d4932bb1f2db31171b6a4d1b4e7f35e

Revert "feat(install): bundle before installation" (#7522) This reverts the changes introduced by PR #5276, which made `deno install «script»` automatically bundle the script's dependencies. It broke the `deno install` command for a large number of scripts. This reverts commit 34e98fa59cd70f7ce64e587bef41fac536a3076b. Closes: #7492

view details

Ryan Dahl

commit sha 0cb64cef767170827806974e59075dc56c2eafe5

Remove unnecessary serde_derive dependency

view details

Ryan Dahl

commit sha c3ef358c01956bfa44a7427a2548943c3f045138

Remove unnecessary extern statements

view details

Ryan Dahl

commit sha 104aebdfb5d01f7482bacef6d58c2ce16da44334

Re-export deno_core::url (#7525) Also re-exports deno_core::futures and deno_core::serde_json but these are not yet used in the CLI.

view details

Bartek Iwańczuk

commit sha 6c4da0e429eb47dae6a220c5576a39f137615bb8

refactor: remove dispatch_json.js from cli/rt and cli/tsc (#7521) Instead use Deno.core.jsonOpSync and Deno.core.jsonOpAsync

view details

Casper Beyer

commit sha 1e6d37f88c80ab3cb2d6fe43206feb61135ff574

test(std/wasi): add sched_yield test (#7511)

view details

Ryan Dahl

commit sha 46bf660e361c854c7a139b488a4630a2eb1cab28

refactor: make fetch use op_fetch_read instead of op_read (#7529)

view details

Ryan Dahl

commit sha 3e98d9091f678eb8a1673fef933ace0eadbe1b2a

fix: Use Buffer.writeSync in MultipartBuilder (#7542)

view details

Luca Casonato

commit sha 303ebc0df4fc889d8c1d3bb4375eeb57aedfe3ce

chore: remove readJson/writeJson from manual (#7541)

view details

Bartek Iwańczuk

commit sha 3421f4dbbd5cabb3a0866ebb3b8aeae5b62730ef

refactor: disable URL.createObjectUrl (#7543)

view details

Bartek Iwańczuk

commit sha bda937938550a0969588a6878d2fb6d72c17b22d

refactor: move op_resources and op_close to deno_core (#7539) Moves op_close and op_resources to deno_core::ops and exports them. Adds serde dependency to deno_core and reexports it. Moves JS implementation of those ops to Deno.core and reexports them in Deno.

view details

push time in 2 hours

PullRequestReviewEvent

PR closed denoland/deno

BREAKING(std/log): remove string formatter

<!-- Before submitting a PR, please read https://github.com/denoland/deno/blob/master/docs/contributing.md --> Breaking change: remove string based formatter in favor of function based formatter and template strings.

+59 -38

5 comments

7 changed files

timreichen

pr closed time in 2 hours

pull request commentdenoland/deno

BREAKING(std/log): remove string formatter

Closing in favor of #7293

timreichen

comment created time in 2 hours

pull request commentdenoland/deno

fix(op_crates/web): Change TypeError to RangeError

@l2ig thanks for the contribution, please sign the CLA and add a test case exercising this fix.

l2ig

comment created time in 2 hours

push eventjosh-hemphill/deno

Bartek Iwańczuk

commit sha b75b22a9114fa7084fcd7730e06596f9fc574fd4

fmt

view details

push time in 2 hours

push eventjosh-hemphill/deno

Casper Beyer

commit sha b33e8d5d427934544fa6e0de44df8793aae63c9d

refactor(cli/repl): extract is_closing to a function (#8015) This extracts is closing into a function so that it can easily be used as the condition for the loop.

view details

Bartek Iwańczuk

commit sha 8f9da368f78b0dcd55e701b30daea8b45102a491

refactor(lint): show hint for lint errors (#8016) This commit adds formatting of optional "hint" that can be present in lint diagnostic.

view details

Ryan Dahl

commit sha 3e51610bbb5d5d63863b9989690ca1e8127fdf88

Remove github actions cache (#8020) Running into issues with cache when trying to upgrade V8. Based on the analysis in https://github.com/denoland/deno/pull/7903#issuecomment-706252380 we know the cache is not providing much benefit.

view details

Casper Beyer

commit sha 065db9df19fa9f1f598fc3a5c7fd978b484428de

test(std/io): use a real tempdir (#8019) This replaces a case of a temp file in the working tree with a tempfile in a real temporary directory avoiding pollution of the working directory.

view details

Ryan Dahl

commit sha 59888ff0b27f75feb3ea88cdea943bf9fbd345fd

upgrade rusty_v8 (#8017)

view details

Ryan Dahl

commit sha fb2cae9687569fc891c13ab4a2862b9e66902a75

deno_core 0.64.0 (#8025)

view details

Casper Beyer

commit sha f91c1155f0cccef9a49efdcc489be3f258000957

docs(tools): add repl section (#8011) This adds a section on the repl with the keybindings that we support out of the box.

view details

Marcos Casagrande

commit sha d3dea24560f7434bd1020f0d9dc4c787f79479da

fix(std/tar): fix constant condition (#8010)

view details

Casper Beyer

commit sha f5c23f8058ed7ce85846c6b1e623329a09fa1a76

fix(cli/repl): write all results to stdout (#7893) This writes all evaluaton results to stdout regardless if the result is an error or not. This matches the behavior of other read-eval-print-loops like Node.

view details

Casper Beyer

commit sha 8eb44537ecb35aebf2aa95018ab8806ab899e0f7

fix(cli/repl): keyboard interrupt should continue (#7960) This changes the behavior of keyboard interrupts (ctrl+c) to continue, clearing the current line instead of exiting. Exit can still be done with ctrl+d or by calling close().

view details

Yoshiya Hinosawa

commit sha 342b151b5d9d6c97926588dd118b59032f3b0e40

docs(std/datetime): document toIMF, isLeap, difference, and constants (#7931)

view details

Nayeem Rahman

commit sha 19b918d112c786b1db17fe2d83be79f1114ba240

feat(std/path): Add toFileUrl() (#7971)

view details

Casper Beyer

commit sha e58763737e82db481a05e34ad883b1cd286dd05d

docs(getting_started): fix WebAssembly example (#8028)

view details

vwkd

commit sha e432db70e9b5628990517baa689b74721f6da8e1

docs: readTextFile / readTextFileSync throw when reading directory (#7999)

view details

Casper Beyer

commit sha 35028db5e571b4232dd58293cea7e5a8ec2e3571

fix(cli/repl): unterminated string literal should invalidate (#7896) This adds the grave character to the pair matching so that template string literals trigger multi-line edits.

view details

Luca Casonato

commit sha 08441b855d8cfbe7edd41811c8c719e5fae01f83

fix(op_crates/fetch): Body.body should be stream of Uint8Array (#8030)

view details

Bartek Iwańczuk

commit sha 17aad6a5f0ce6906a346479c7f658b1a2c54026c

Merge branch 'master' into josh_patch_1

view details

push time in 2 hours

pull request commentdenoland/deno

feat(std/testing): Add support for object assertion against object subset

Thanks for the contribution @lowlighter! Is there some prior art for this assertion?

@nayeemrmn PTAL

lowlighter

comment created time in 2 hours

push eventlittledivy/deno

Bartek Iwańczuk

commit sha c85fb7bc387b88a1bb6546d0060afe0c8a92392a

fix

view details

push time in 2 hours

push eventlittledivy/deno

Kitson Kelly

commit sha bbe4474d39aecfabed52bd080e73d34978b6481b

fix(cli): ModuleGraph2 properly handles redirects (#7981)

view details

William Perron

commit sha 943b0980c7ff97cb6096291efa5e3d5dbfe10805

feat(cli/ops): add the sleep_sync op (#7974)

view details

Ben Noordhuis

commit sha 46b892ad37df9ba9bed77fb923a1cfe284b208dc

refactor(core): more control over isolate creation (#8000) Make JSRuntime::new() accept a custom v8::CreateParams object to tune the v8::Isolate it creates. Subsumes the functionality of HeapLimits, which I therefore removed.

view details

Bartek Iwańczuk

commit sha c1c760130406405c8fde9a74bd88c62ca721967b

upgrade: deno_doc, deno_lint, dprint, swc (#8009)

view details

Casper Beyer

commit sha b33e8d5d427934544fa6e0de44df8793aae63c9d

refactor(cli/repl): extract is_closing to a function (#8015) This extracts is closing into a function so that it can easily be used as the condition for the loop.

view details

Bartek Iwańczuk

commit sha 8f9da368f78b0dcd55e701b30daea8b45102a491

refactor(lint): show hint for lint errors (#8016) This commit adds formatting of optional "hint" that can be present in lint diagnostic.

view details

Ryan Dahl

commit sha 3e51610bbb5d5d63863b9989690ca1e8127fdf88

Remove github actions cache (#8020) Running into issues with cache when trying to upgrade V8. Based on the analysis in https://github.com/denoland/deno/pull/7903#issuecomment-706252380 we know the cache is not providing much benefit.

view details

Casper Beyer

commit sha 065db9df19fa9f1f598fc3a5c7fd978b484428de

test(std/io): use a real tempdir (#8019) This replaces a case of a temp file in the working tree with a tempfile in a real temporary directory avoiding pollution of the working directory.

view details

Ryan Dahl

commit sha 59888ff0b27f75feb3ea88cdea943bf9fbd345fd

upgrade rusty_v8 (#8017)

view details

Ryan Dahl

commit sha fb2cae9687569fc891c13ab4a2862b9e66902a75

deno_core 0.64.0 (#8025)

view details

Casper Beyer

commit sha f91c1155f0cccef9a49efdcc489be3f258000957

docs(tools): add repl section (#8011) This adds a section on the repl with the keybindings that we support out of the box.

view details

Marcos Casagrande

commit sha d3dea24560f7434bd1020f0d9dc4c787f79479da

fix(std/tar): fix constant condition (#8010)

view details

Casper Beyer

commit sha f5c23f8058ed7ce85846c6b1e623329a09fa1a76

fix(cli/repl): write all results to stdout (#7893) This writes all evaluaton results to stdout regardless if the result is an error or not. This matches the behavior of other read-eval-print-loops like Node.

view details

Casper Beyer

commit sha 8eb44537ecb35aebf2aa95018ab8806ab899e0f7

fix(cli/repl): keyboard interrupt should continue (#7960) This changes the behavior of keyboard interrupts (ctrl+c) to continue, clearing the current line instead of exiting. Exit can still be done with ctrl+d or by calling close().

view details

Yoshiya Hinosawa

commit sha 342b151b5d9d6c97926588dd118b59032f3b0e40

docs(std/datetime): document toIMF, isLeap, difference, and constants (#7931)

view details

Nayeem Rahman

commit sha 19b918d112c786b1db17fe2d83be79f1114ba240

feat(std/path): Add toFileUrl() (#7971)

view details

Casper Beyer

commit sha e58763737e82db481a05e34ad883b1cd286dd05d

docs(getting_started): fix WebAssembly example (#8028)

view details

vwkd

commit sha e432db70e9b5628990517baa689b74721f6da8e1

docs: readTextFile / readTextFileSync throw when reading directory (#7999)

view details

Casper Beyer

commit sha 35028db5e571b4232dd58293cea7e5a8ec2e3571

fix(cli/repl): unterminated string literal should invalidate (#7896) This adds the grave character to the pair matching so that template string literals trigger multi-line edits.

view details

Luca Casonato

commit sha 08441b855d8cfbe7edd41811c8c719e5fae01f83

fix(op_crates/fetch): Body.body should be stream of Uint8Array (#8030)

view details

push time in 2 hours

PullRequestReviewEvent

push eventcaspervonb/deno

Bartek Iwańczuk

commit sha c1c760130406405c8fde9a74bd88c62ca721967b

upgrade: deno_doc, deno_lint, dprint, swc (#8009)

view details

Casper Beyer

commit sha b33e8d5d427934544fa6e0de44df8793aae63c9d

refactor(cli/repl): extract is_closing to a function (#8015) This extracts is closing into a function so that it can easily be used as the condition for the loop.

view details

Bartek Iwańczuk

commit sha 8f9da368f78b0dcd55e701b30daea8b45102a491

refactor(lint): show hint for lint errors (#8016) This commit adds formatting of optional "hint" that can be present in lint diagnostic.

view details

Ryan Dahl

commit sha 3e51610bbb5d5d63863b9989690ca1e8127fdf88

Remove github actions cache (#8020) Running into issues with cache when trying to upgrade V8. Based on the analysis in https://github.com/denoland/deno/pull/7903#issuecomment-706252380 we know the cache is not providing much benefit.

view details

Casper Beyer

commit sha 065db9df19fa9f1f598fc3a5c7fd978b484428de

test(std/io): use a real tempdir (#8019) This replaces a case of a temp file in the working tree with a tempfile in a real temporary directory avoiding pollution of the working directory.

view details

Ryan Dahl

commit sha 59888ff0b27f75feb3ea88cdea943bf9fbd345fd

upgrade rusty_v8 (#8017)

view details

Ryan Dahl

commit sha fb2cae9687569fc891c13ab4a2862b9e66902a75

deno_core 0.64.0 (#8025)

view details

Casper Beyer

commit sha f91c1155f0cccef9a49efdcc489be3f258000957

docs(tools): add repl section (#8011) This adds a section on the repl with the keybindings that we support out of the box.

view details

Marcos Casagrande

commit sha d3dea24560f7434bd1020f0d9dc4c787f79479da

fix(std/tar): fix constant condition (#8010)

view details

Casper Beyer

commit sha f5c23f8058ed7ce85846c6b1e623329a09fa1a76

fix(cli/repl): write all results to stdout (#7893) This writes all evaluaton results to stdout regardless if the result is an error or not. This matches the behavior of other read-eval-print-loops like Node.

view details

Casper Beyer

commit sha 8eb44537ecb35aebf2aa95018ab8806ab899e0f7

fix(cli/repl): keyboard interrupt should continue (#7960) This changes the behavior of keyboard interrupts (ctrl+c) to continue, clearing the current line instead of exiting. Exit can still be done with ctrl+d or by calling close().

view details

Yoshiya Hinosawa

commit sha 342b151b5d9d6c97926588dd118b59032f3b0e40

docs(std/datetime): document toIMF, isLeap, difference, and constants (#7931)

view details

Nayeem Rahman

commit sha 19b918d112c786b1db17fe2d83be79f1114ba240

feat(std/path): Add toFileUrl() (#7971)

view details

Casper Beyer

commit sha e58763737e82db481a05e34ad883b1cd286dd05d

docs(getting_started): fix WebAssembly example (#8028)

view details

vwkd

commit sha e432db70e9b5628990517baa689b74721f6da8e1

docs: readTextFile / readTextFileSync throw when reading directory (#7999)

view details

Casper Beyer

commit sha 35028db5e571b4232dd58293cea7e5a8ec2e3571

fix(cli/repl): unterminated string literal should invalidate (#7896) This adds the grave character to the pair matching so that template string literals trigger multi-line edits.

view details

Luca Casonato

commit sha 08441b855d8cfbe7edd41811c8c719e5fae01f83

fix(op_crates/fetch): Body.body should be stream of Uint8Array (#8030)

view details

Bartek Iwańczuk

commit sha aa03fafff6259b611010dd50b401c191afbf370b

Merge branch 'master' into feat-cli-repl-tab-completion

view details

push time in 2 hours

PR closed denoland/deno

fix: #7772 changes documentation url

Closes #7772

  • fixes documentation url.
+2 -1

3 comments

1 changed file

shajanjp

pr closed time in 2 hours

pull request commentdenoland/deno

fix: #7772 changes documentation url

It's already fixed on master, closing without merge, but thanks anyway @shajanjp

shajanjp

comment created time in 2 hours

issue closeddenoland/deno

Documentation link on README.md is broken

Current : https://github.com/denoland/deno/blob/master/doc.deno.land Expected: https://doc.deno.land/builtin/stable

closed time in 2 hours

shajanjp

issue commentdenoland/deno

Documentation link on README.md is broken

Already fixed

shajanjp

comment created time in 2 hours

push eventshajanjp/deno

Bartek Iwańczuk

commit sha 1285d60ab027b00089231444a895f1206c5b8172

fmt

view details

push time in 2 hours

Pull request review commentdenoland/deno

feat(cli/installer): Add missing flags for deno install

 itest!(_033_import_map {   output: "033_import_map.out", }); -itest!(import_map_no_unstable {-  args:-    "run --quiet --reload --importmap=importmaps/import_map.json importmaps/test.ts",-  output: "import_map_no_unstable.out",-  exit_code: 70,-});

Nice 👍 thanks

nayeemrmn

comment created time in 2 hours

PullRequestReviewEvent

pull request commentdenoland/deno

deno bundle supports export * exports

@kitsonk do you want to pursue landing this PR or is it something that will be addressed in compiler refactor?

JordanMajd

comment created time in 2 hours

PR closed denoland/deno

feat(install): Add support for --importmap

adding to deno install command support to the --importmap flag so that you would be able to write:

deno install --importmap import_map.json asd asd.ts

without it complaining about Found argument '--importmap' which wasn't expected, or isn't valid in this context.

Closes #3929

+28 -0

18 comments

1 changed file

ntedgi

pr closed time in 2 hours

pull request commentdenoland/deno

feat(install): Add support for --importmap

Thanks for contribution @ntedgi! I'm gonna close this one without merge as it's already part of https://github.com/denoland/deno/pull/7601

ntedgi

comment created time in 2 hours

push eventnayeemrmn/deno

Bartek Iwańczuk

commit sha bd0c64b9aeeb75eea25402b0ebd5aecc2cec8e3a

Reland feat(cli/console): inspect with colors regardless of Deno.noColor (#7976)

view details

Kitson Kelly

commit sha bbe4474d39aecfabed52bd080e73d34978b6481b

fix(cli): ModuleGraph2 properly handles redirects (#7981)

view details

William Perron

commit sha 943b0980c7ff97cb6096291efa5e3d5dbfe10805

feat(cli/ops): add the sleep_sync op (#7974)

view details

Ben Noordhuis

commit sha 46b892ad37df9ba9bed77fb923a1cfe284b208dc

refactor(core): more control over isolate creation (#8000) Make JSRuntime::new() accept a custom v8::CreateParams object to tune the v8::Isolate it creates. Subsumes the functionality of HeapLimits, which I therefore removed.

view details

Bartek Iwańczuk

commit sha c1c760130406405c8fde9a74bd88c62ca721967b

upgrade: deno_doc, deno_lint, dprint, swc (#8009)

view details

Casper Beyer

commit sha b33e8d5d427934544fa6e0de44df8793aae63c9d

refactor(cli/repl): extract is_closing to a function (#8015) This extracts is closing into a function so that it can easily be used as the condition for the loop.

view details

Bartek Iwańczuk

commit sha 8f9da368f78b0dcd55e701b30daea8b45102a491

refactor(lint): show hint for lint errors (#8016) This commit adds formatting of optional "hint" that can be present in lint diagnostic.

view details

Ryan Dahl

commit sha 3e51610bbb5d5d63863b9989690ca1e8127fdf88

Remove github actions cache (#8020) Running into issues with cache when trying to upgrade V8. Based on the analysis in https://github.com/denoland/deno/pull/7903#issuecomment-706252380 we know the cache is not providing much benefit.

view details

Casper Beyer

commit sha 065db9df19fa9f1f598fc3a5c7fd978b484428de

test(std/io): use a real tempdir (#8019) This replaces a case of a temp file in the working tree with a tempfile in a real temporary directory avoiding pollution of the working directory.

view details

Ryan Dahl

commit sha 59888ff0b27f75feb3ea88cdea943bf9fbd345fd

upgrade rusty_v8 (#8017)

view details

Ryan Dahl

commit sha fb2cae9687569fc891c13ab4a2862b9e66902a75

deno_core 0.64.0 (#8025)

view details

Casper Beyer

commit sha f91c1155f0cccef9a49efdcc489be3f258000957

docs(tools): add repl section (#8011) This adds a section on the repl with the keybindings that we support out of the box.

view details

Marcos Casagrande

commit sha d3dea24560f7434bd1020f0d9dc4c787f79479da

fix(std/tar): fix constant condition (#8010)

view details

Casper Beyer

commit sha f5c23f8058ed7ce85846c6b1e623329a09fa1a76

fix(cli/repl): write all results to stdout (#7893) This writes all evaluaton results to stdout regardless if the result is an error or not. This matches the behavior of other read-eval-print-loops like Node.

view details

Casper Beyer

commit sha 8eb44537ecb35aebf2aa95018ab8806ab899e0f7

fix(cli/repl): keyboard interrupt should continue (#7960) This changes the behavior of keyboard interrupts (ctrl+c) to continue, clearing the current line instead of exiting. Exit can still be done with ctrl+d or by calling close().

view details

Yoshiya Hinosawa

commit sha 342b151b5d9d6c97926588dd118b59032f3b0e40

docs(std/datetime): document toIMF, isLeap, difference, and constants (#7931)

view details

Nayeem Rahman

commit sha 19b918d112c786b1db17fe2d83be79f1114ba240

feat(std/path): Add toFileUrl() (#7971)

view details

Casper Beyer

commit sha e58763737e82db481a05e34ad883b1cd286dd05d

docs(getting_started): fix WebAssembly example (#8028)

view details

vwkd

commit sha e432db70e9b5628990517baa689b74721f6da8e1

docs: readTextFile / readTextFileSync throw when reading directory (#7999)

view details

Casper Beyer

commit sha 35028db5e571b4232dd58293cea7e5a8ec2e3571

fix(cli/repl): unterminated string literal should invalidate (#7896) This adds the grave character to the pair matching so that template string literals trigger multi-line edits.

view details

push time in 2 hours

Pull request review commentdenoland/deno

feat(cli/installer): Add missing flags for deno install

 itest!(_033_import_map {   output: "033_import_map.out", }); -itest!(import_map_no_unstable {-  args:-    "run --quiet --reload --importmap=importmaps/import_map.json importmaps/test.ts",-  output: "import_map_no_unstable.out",-  exit_code: 70,-});

Why remove this test?

nayeemrmn

comment created time in 2 hours

PullRequestReviewEvent
PullRequestReviewEvent

push eventnayeemrmn/deno

Bartek Iwańczuk

commit sha bd0c64b9aeeb75eea25402b0ebd5aecc2cec8e3a

Reland feat(cli/console): inspect with colors regardless of Deno.noColor (#7976)

view details

Kitson Kelly

commit sha bbe4474d39aecfabed52bd080e73d34978b6481b

fix(cli): ModuleGraph2 properly handles redirects (#7981)

view details

William Perron

commit sha 943b0980c7ff97cb6096291efa5e3d5dbfe10805

feat(cli/ops): add the sleep_sync op (#7974)

view details

Ben Noordhuis

commit sha 46b892ad37df9ba9bed77fb923a1cfe284b208dc

refactor(core): more control over isolate creation (#8000) Make JSRuntime::new() accept a custom v8::CreateParams object to tune the v8::Isolate it creates. Subsumes the functionality of HeapLimits, which I therefore removed.

view details

Bartek Iwańczuk

commit sha c1c760130406405c8fde9a74bd88c62ca721967b

upgrade: deno_doc, deno_lint, dprint, swc (#8009)

view details

Casper Beyer

commit sha b33e8d5d427934544fa6e0de44df8793aae63c9d

refactor(cli/repl): extract is_closing to a function (#8015) This extracts is closing into a function so that it can easily be used as the condition for the loop.

view details

Bartek Iwańczuk

commit sha 8f9da368f78b0dcd55e701b30daea8b45102a491

refactor(lint): show hint for lint errors (#8016) This commit adds formatting of optional "hint" that can be present in lint diagnostic.

view details

Ryan Dahl

commit sha 3e51610bbb5d5d63863b9989690ca1e8127fdf88

Remove github actions cache (#8020) Running into issues with cache when trying to upgrade V8. Based on the analysis in https://github.com/denoland/deno/pull/7903#issuecomment-706252380 we know the cache is not providing much benefit.

view details

Casper Beyer

commit sha 065db9df19fa9f1f598fc3a5c7fd978b484428de

test(std/io): use a real tempdir (#8019) This replaces a case of a temp file in the working tree with a tempfile in a real temporary directory avoiding pollution of the working directory.

view details

Ryan Dahl

commit sha 59888ff0b27f75feb3ea88cdea943bf9fbd345fd

upgrade rusty_v8 (#8017)

view details

Ryan Dahl

commit sha fb2cae9687569fc891c13ab4a2862b9e66902a75

deno_core 0.64.0 (#8025)

view details

Casper Beyer

commit sha f91c1155f0cccef9a49efdcc489be3f258000957

docs(tools): add repl section (#8011) This adds a section on the repl with the keybindings that we support out of the box.

view details

Marcos Casagrande

commit sha d3dea24560f7434bd1020f0d9dc4c787f79479da

fix(std/tar): fix constant condition (#8010)

view details

Casper Beyer

commit sha f5c23f8058ed7ce85846c6b1e623329a09fa1a76

fix(cli/repl): write all results to stdout (#7893) This writes all evaluaton results to stdout regardless if the result is an error or not. This matches the behavior of other read-eval-print-loops like Node.

view details

Casper Beyer

commit sha 8eb44537ecb35aebf2aa95018ab8806ab899e0f7

fix(cli/repl): keyboard interrupt should continue (#7960) This changes the behavior of keyboard interrupts (ctrl+c) to continue, clearing the current line instead of exiting. Exit can still be done with ctrl+d or by calling close().

view details

Yoshiya Hinosawa

commit sha 342b151b5d9d6c97926588dd118b59032f3b0e40

docs(std/datetime): document toIMF, isLeap, difference, and constants (#7931)

view details

Nayeem Rahman

commit sha 19b918d112c786b1db17fe2d83be79f1114ba240

feat(std/path): Add toFileUrl() (#7971)

view details

Casper Beyer

commit sha e58763737e82db481a05e34ad883b1cd286dd05d

docs(getting_started): fix WebAssembly example (#8028)

view details

vwkd

commit sha e432db70e9b5628990517baa689b74721f6da8e1

docs: readTextFile / readTextFileSync throw when reading directory (#7999)

view details

Casper Beyer

commit sha 35028db5e571b4232dd58293cea7e5a8ec2e3571

fix(cli/repl): unterminated string literal should invalidate (#7896) This adds the grave character to the pair matching so that template string literals trigger multi-line edits.

view details

push time in 2 hours

Pull request review commentdenoland/deno

feat(unstable): add Deno.systemCpuInfo()

 declare namespace Deno {     swapFree: number;   } +  /** **Unstable** new API. yet to be vetted.+   *+   * Returns the total number of logical cpus in the system along with+   * the speed measured in MHz+   *+   * ```ts+   * console.log(Deno.systemCpuInfo());+   * ```+   *+   * Requires `allow-env` permission.+   *+   */+  export function systemCpuInfo(): SystemCpuInfo;++  export interface SystemCpuInfo {+    /** Total number of logical cpus in the system */+    cores: number;+    /** The speed of the cpu measured in MHz */+    speed: number;

Seems like both of those fields are omitted when an error occurs - it should be reflected in the types and doc comment

eliassjogreen

comment created time in 2 hours

PullRequestReviewEvent
PullRequestReviewEvent

push eventjsejcksn/deno

Ryan Dahl

commit sha 374d433f1f4885686dc5c166be3a25c839e22959

Remove dead code (#7963)

view details

Kitson Kelly

commit sha 10654fa95553866c63a56a7f84c7ec47fb7aac9c

refactor(cli): add tsc2 (#7942) Ref #7225

view details

Bartek Iwańczuk

commit sha 135053486c4bd112ebd7d0b25c94a8dd346472e6

fix: top-level-await module execution (#7946) This commit changes implementation of top-level-await in "deno_core". Previously promise returned from module evaluation was not awaited, leading to out-of-order execution of modules that have TLA. It's been fixed by changing "JsRuntime::mod_evaluate" to be an async function that resolves when the promise returned from module evaluation also resolves. When waiting for promise resolution event loop is polled repeatedly, until there are no more dynamic imports or pending ops.

view details

Casper Beyer

commit sha e2a1a7c937b67d050e7e3287d7e5dbc6ffd9b168

refactor(cli/repl): clean up prelude injection (#7967) This extracts prelude injection into a helper function and moves the prelude string literal into a top level static string to help trim some of the fat out of the run function.

view details

Yoshiya Hinosawa

commit sha e9f02c231473ba42f506a895734d445cd31d379f

fix(console): fix the test cases of function inspections (#7965)

view details

Bartek Iwańczuk

commit sha 12e700bddfad8c23f6b55baca4ca4afb8337af26

fix(test): return error when awaiting unresolved promise (#7968) This commit fixes test runner by awaitning "Deno.runTests()" call, which ensures proper error is returned when there's an unresolved promise that's being awaited.

view details

vwkd

commit sha f9489e9acb0e3121bbd71ef0cf1826320d0c0995

fix typos (#7964)

view details

TTtie

commit sha f75bd89aff7cffafceb394d629995479af54a156

feat(cli/console): inspect with colors regardless of Deno.noColor (#7778) This commit adds the ability for users to inspect items stylized with ANSI colors regardless of the value of Deno.noColor.

view details

ali ahmed

commit sha 5bed06fb94214db70a27cca8fa8eff717d537dba

feat(std/fs/node): adding some functions (#7921)

view details

Bartek Iwańczuk

commit sha 81635c59e66b81a4c85aed6775aff4beedf71f14

Revert "feat(cli/console): inspect with colors regardless of Deno.noColor (#7778)" (#7973) This reverts commit f75bd89aff7cffafceb394d629995479af54a156.

view details

Bartek Iwańczuk

commit sha bd0c64b9aeeb75eea25402b0ebd5aecc2cec8e3a

Reland feat(cli/console): inspect with colors regardless of Deno.noColor (#7976)

view details

Kitson Kelly

commit sha bbe4474d39aecfabed52bd080e73d34978b6481b

fix(cli): ModuleGraph2 properly handles redirects (#7981)

view details

William Perron

commit sha 943b0980c7ff97cb6096291efa5e3d5dbfe10805

feat(cli/ops): add the sleep_sync op (#7974)

view details

Ben Noordhuis

commit sha 46b892ad37df9ba9bed77fb923a1cfe284b208dc

refactor(core): more control over isolate creation (#8000) Make JSRuntime::new() accept a custom v8::CreateParams object to tune the v8::Isolate it creates. Subsumes the functionality of HeapLimits, which I therefore removed.

view details

Bartek Iwańczuk

commit sha c1c760130406405c8fde9a74bd88c62ca721967b

upgrade: deno_doc, deno_lint, dprint, swc (#8009)

view details

Casper Beyer

commit sha b33e8d5d427934544fa6e0de44df8793aae63c9d

refactor(cli/repl): extract is_closing to a function (#8015) This extracts is closing into a function so that it can easily be used as the condition for the loop.

view details

Bartek Iwańczuk

commit sha 8f9da368f78b0dcd55e701b30daea8b45102a491

refactor(lint): show hint for lint errors (#8016) This commit adds formatting of optional "hint" that can be present in lint diagnostic.

view details

Ryan Dahl

commit sha 3e51610bbb5d5d63863b9989690ca1e8127fdf88

Remove github actions cache (#8020) Running into issues with cache when trying to upgrade V8. Based on the analysis in https://github.com/denoland/deno/pull/7903#issuecomment-706252380 we know the cache is not providing much benefit.

view details

Casper Beyer

commit sha 065db9df19fa9f1f598fc3a5c7fd978b484428de

test(std/io): use a real tempdir (#8019) This replaces a case of a temp file in the working tree with a tempfile in a real temporary directory avoiding pollution of the working directory.

view details

Ryan Dahl

commit sha 59888ff0b27f75feb3ea88cdea943bf9fbd345fd

upgrade rusty_v8 (#8017)

view details

push time in 3 hours

push eventeliassjogreen/deno

tokiedokie

commit sha 5590b97670206df957c43742f47601356982c658

refactor(std/testing): Get rid of default export and make std/testing/diff.ts private (#7592)

view details

Casper Beyer

commit sha 4c779b5e8ca427faf24c26443a8054004827d450

refactor(repl): use an inspector session (#7763) This ports the REPL over to Rust and makes use of an inspector session to run a REPL on top of any isolate which lets make full use of rustylines various things like validators and completors without having to introduce a bunch of hard to test internal ops and glue code. An accidental but good side effect of this is that the multiple line input we previously had is now an editable multi-line input prompt that is correctly stored in the history as a single entry.

view details

j4qfrost

commit sha d96e7226dd8909351c230b6f9820f952dddb0ece

refactor: use parentheses in print statements in python (#7779)

view details

Casper Beyer

commit sha 454de99680db7fdf93bcf0f41beb81d594e17271

chore(core): remove experimental wasm bigint flag (#7790) This removes the experimental bigint flag as it is enabled by default now and is no longer necessary.

view details

Casper Beyer

commit sha 6825d7f13d51006967c2638b4433fb582cd6ddbc

fix(cli/repl): use a default referrer when empty (#7794) This makes use of a default referrer when its empty in repl mode so that dynamic imports work in the global evaluation context. Co-authored-by: Bartek Iwanczuk <biwanczuk@gmail.com>

view details

Casper Beyer

commit sha 5cd29b37f7946ac05783bae777be8503182a8b8e

feat(cli/repl): enable await and let re-declarations (#7784) This enables `replMode` during evaluations which allows for top level await and let re-declarations.

view details

Bartek Iwańczuk

commit sha e5348a6a38b3c06a916223ad0b99e8cfe47725b1

upgrade: swc, deno_doc, deno_lint, dprint (#7793)

view details

Bartek Iwańczuk

commit sha 63efa5f15dccf48d7a27f7d55344f1de63f786af

v1.4.3

view details

Casper Beyer

commit sha 4c7f53b04bc631525a4512576fc0d7dca05dec09

fix(cli/repl): enable colors on inspected values (#7798)

view details

CGQAQ

commit sha 59312f393690817ed1d4e2ba1c940eafc56b3588

fix(cli): update type definitions to align to TS dom (#7791) Fixes #7746

view details

Casper Beyer

commit sha c191ca1aeb58a07fe13e5806a7c443ce93e57dd5

fix(cli/repl): put the thread to sleep when idle (#7804)

view details

Bartek Iwańczuk

commit sha ae1ed2d16687413381fc7e6b55dca9b1676855f6

v1.4.4

view details

Casper Beyer

commit sha e8b93674eda5e337587d596f23745c81511e1f0a

docs(std/wasi): fix usage example (#7808) The usage example is a bit out of date and not compatible with the stricter definition of the WebAssembly namespace. This fixes that and makes it a bit cleaner.

view details

Nayeem Rahman

commit sha 315724b856eb15a8335acda2596611c0fc4f87d5

feat(unstable): revert "enable importsNotUsedAsValues by default #7413" (#7800) This reverts commit fbb18d40d3cfd0d24262e8e73b97f22770734572.

view details

Casper Beyer

commit sha f9973364ddcb784b9514dbed025f793415c263cb

docs(std/wasi): remove outdated testing section (#7812)

view details

Atakan Ermiş

commit sha 920c0b35153cd8058165125ba0af228416835e67

docs(std/encoding): add missing JSDoc (#7809)

view details

Trivikram Kamat

commit sha 391eed42f41bd277fff936192b474bfd52eaa1a0

docs: update location of unit tests folder (#7814)

view details

Trivikram Kamat

commit sha d0eb179132c60a7c2513c9d19db03e3d5ca00c70

docs: end sentences with a period in markdown (#7813)

view details

tokiedokie

commit sha ec963238230c7f92a29da27ced0a2ec706af92d0

chore(std/http): rename http_bench.ts -> bench.ts (#7509)

view details

tokiedokie

commit sha 3d65177dbcaf6d08c7e4a412beece8ee6939d466

docs(std): version all imports in README (#7442) Use $STD_VERSION in std/ README files to automatically display proper version.

view details

push time in 3 hours

push eventdenoland/deno

Casper Beyer

commit sha 9d664f8375856be228e4f98b8381ac934d84604b

fix(cli/repl): ignore pair matching inside literals (#8037)

view details

push time in 4 hours

PR merged denoland/deno

fix(cli/repl): ignore pair matching inside literals

This ignores brace pairs until a literal sequence has been finished when validating readline input.

Fixes #7978 Fixes #8034

+43 -9

0 comment

2 changed files

caspervonb

pr closed time in 4 hours

issue closeddenoland/deno

REPL incorrect behaviour on specific RegExp match

The following RegExp causes the REPL to jump to a new line (expecting more input?) without executing the line, though more simple RegExp seem to work fine. Using Deno 1.4.6 on Linux.

console.log("{test1} abc {test2} def {{test3}}".match(/{([^{].+?)}/));

I've narrowed it down to the [^{] condition. Taking out the [^{] condition allows the REPL to run the RegExp without the new line/more input needed behaviour. Also the original RegExp works fine when run via deno run.

closed time in 4 hours

cknight

issue closeddenoland/deno

repl hangs on unclosed braces in string literals.

What the title says. Steps to reproduce:

$ ./deno --version⏎
deno 1.4.6
v8 8.7.220.3
typescript 4.0.3

$ ./deno repl⏎
Deno 1.4.6
exit using ctrl+d or close()
> let a = "{"⏎   // ... silence

Fails independently of quote " ' backtick and brace [ ( { and with let, var and const as well as with naked literals ( if (a !== "{") console.log("here") )

I imagine this is some sort of completion gone terribly wrong. No well versed enough in deno internals to spontaneously dig deeper at the moment sorry.

closed time in 4 hours

a2800276
PullRequestReviewEvent

Pull request review commentdenoland/deno

feat: deno test --docs support

+// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.++use crate::ast::{self, Location};+use crate::flags::Flags;+use crate::media_type::MediaType;+use crate::program_state::ProgramState;+use deno_core::serde_json::json;+use deno_core::url::Url;+use deno_core::{error::AnyError, ModuleSpecifier};+use deno_doc::DocParser;+use jsdoc::ast::Tag;+use jsdoc::Input;+use regex::Regex;+use std::borrow::BorrowMut;+use std::cell::RefCell;+use std::collections::HashSet;+use std::ffi::OsStr;+use std::path::{Path, PathBuf};+use std::rc::Rc;+use swc_common::{comments::SingleThreadedComments, SourceMap, Span};+use swc_ecmascript::visit::Visit;+use swc_ecmascript::{+  ast::{Class, Decl, ExportDecl, Expr, Function, VarDecl},+  visit::Node,+};++use crate::test_runner::is_supported;++lazy_static! {+  // matches non-dynamic js imports+  static ref IMPORT_PATTERN: Regex =+    Regex::new(r#"import\s+?(?:(?:(?:[\w*\s{},]*)\s+from\s+?)|)(?:(?:".*?")|(?:'.*?'))[\s]*?(?:;|$|)"#).unwrap();+  static ref TEST_TAG_PATTERN: Regex = Regex::new(r"```(\w+)?").unwrap();+  static ref AWAIT_PATTERN: Regex = Regex::new(r"\Wawait\s").unwrap();+  // matches jsdoc example caption+  static ref CAPTION_PATTERN: Regex =+      Regex::new(r"<caption>([\s\w\W]+)</caption>").unwrap();+}++struct DocTestVisitor {+  comments: SingleThreadedComments,+  source_map: Rc<SourceMap>,+  examples: RefCell<Vec<(Location, String)>>,+}++struct DocTester {+  doctest_visitor: DocTestVisitor,+  parsed_module: ast::ParsedModule,+}++impl DocTester {+  fn new(parsed_module: ast::ParsedModule) -> Self {+    Self {+      doctest_visitor: DocTestVisitor::new(+        parsed_module.comments.clone(),+        Rc::clone(&parsed_module.source_map),+      ),+      parsed_module,+    }+  }+  pub fn get_comments(&mut self) -> Vec<(Location, String)> {+    let visitor = self.doctest_visitor.borrow_mut();+    visitor+      .visit_module(&self.parsed_module.module, &self.parsed_module.module);+    visitor.examples.clone().into_inner()+  }+}++impl DocTestVisitor {+  fn new(comments: SingleThreadedComments, source_map: Rc<SourceMap>) -> Self {+    Self {+      comments,+      source_map,+      examples: RefCell::new(vec![]),+    }+  }++  fn get_span_location(&self, span: Span) -> Location {+    self.source_map.lookup_char_pos(span.lo()).into()+  }++  fn parse_span_comments(&mut self, span: Span) {+    let comments = self+      .comments+      .with_leading(span.lo, |comments| comments.to_vec());+    let examples = comments+      .iter()+      .filter_map(|comment| {+        jsdoc::parse(Input::from(comment)).map(|op| op.1).ok()+      })+      .flat_map(|js_doc| {+        js_doc+          .tags+          .into_iter()+          .filter_map(|tag_item| match tag_item.tag {+            Tag::Example(ex_tag) => Some((+              self.get_span_location(ex_tag.span),+              ex_tag.text.value.to_string(),+            )),+            _ => None,+          })+      });+    self.examples.borrow_mut().extend(examples);+  }++  fn check_var_decl(+    &mut self,+    var_decl: &VarDecl,+    opt_export_decl: Option<&ExportDecl>,+  ) {+    var_decl.decls.iter().for_each(|decl| {+      if let Some(expr) = &decl.init {+        match &**expr {+          Expr::Object(_) | Expr::Fn(_) | Expr::Class(_) | Expr::Arrow(_) => {+            if let Some(export_decl) = opt_export_decl {+              self.parse_span_comments(export_decl.span);+            } else {+              self.parse_span_comments(var_decl.span);+            }+          }+          _ => {}+        }+      }+    });+  }+}++impl Visit for DocTestVisitor {+  fn visit_class(&mut self, class: &Class, parent: &dyn Node) {+    self.parse_span_comments(class.span);+    swc_ecmascript::visit::visit_class(self, class, parent);+  }++  fn visit_function(&mut self, function: &Function, parent: &dyn Node) {+    self.parse_span_comments(function.span);+    swc_ecmascript::visit::visit_function(self, function, parent);+  }++  fn visit_var_decl(&mut self, var_decl: &VarDecl, parent: &dyn Node) {+    self.check_var_decl(var_decl, None);+    swc_ecmascript::visit::visit_var_decl(self, var_decl, parent);+  }++  fn visit_export_decl(&mut self, export_decl: &ExportDecl, parent: &dyn Node) {+    match &export_decl.decl {+      Decl::Var(var_decl) => self.check_var_decl(var_decl, Some(export_decl)),+      Decl::Class(_) | Decl::Fn(_) => {+        self.parse_span_comments(export_decl.span)+      }+      _ => {}+    }+    swc_ecmascript::visit::visit_export_decl(self, export_decl, parent);+  }+}++pub async fn parse_jsdocs(+  source_files: &[Url],+  flags: Flags,+) -> Result<Vec<(Location, String)>, AnyError> {+  let program_state = ProgramState::new(flags.clone())?;+  let loader = Box::new(program_state.file_fetcher.clone());++  let doc_parser = DocParser::new(loader, false);+  let mut results = vec![];+  for url in source_files {+    let source_code =+      doc_parser.loader.load_source_code(&url.to_string()).await?;+    let path = PathBuf::from(&url.to_string());+    let media_type = MediaType::from(&path);+    let specifier = ModuleSpecifier::resolve_url(&url.to_string())?;+    let parsed_module = ast::parse(&specifier, &source_code, &media_type)?;+    let mut doc_tester = DocTester::new(parsed_module);+    results.extend(doc_tester.get_comments());+  }+  Ok(results)+}++pub fn prepare_doctests(+  jsdocs: Vec<(Location, String)>,+  fail_fast: bool,+  quiet: bool,+  filter: Option<String>,+) -> Result<String, AnyError> {+  let mut test_file =  "import * as assert from \"https://deno.land/std@0.70.0/testing/asserts.ts\";\n".to_string();+  let mut import_set = HashSet::new();++  let cwd = std::env::current_dir()?;+  let cwd_url_str = Url::from_directory_path(cwd)+    .map(|url| url.to_string())+    .unwrap_or_else(|_| "".to_string());++  let tests: String = jsdocs+    .into_iter()+    .filter_map(|(loc, example)| {+      let ex_str = clean_string(&example);+      let test_tag = extract_test_tag(&ex_str);+      if test_tag == Some("text") {+        return  None;+      }+      let ignore = test_tag == Some("ignore");+      extract_imports(&ex_str).into_iter().for_each(|import| { import_set.insert(import.to_string()); });+      let caption = extract_caption(&ex_str);+      let code_body = extract_code_body(&ex_str);+      let is_async = has_await(&ex_str);+      let res = format!(+        "\nDeno.test({{\n\tname: \"{} - {} (line {})\",\n\tignore: {},\n\t{} fn() {{\n{}\n}}\n}});\n",+        loc.filename.replace(&cwd_url_str, ""),+        caption.unwrap_or(""),+        loc.line,+        ignore,+        if is_async { "async"} else {""},+        code_body+    );+    Some(res)+    })+    .collect();+  let imports_str = import_set.into_iter().collect::<Vec<_>>().join("\n");+  test_file.push_str(&imports_str);+  test_file.push_str("\n");+  test_file.push_str(&tests);++  let options = if let Some(filter) = filter {+    json!({ "failFast": fail_fast, "reportToConsole": !quiet, "disableLog": quiet, "isDoctest": true, "filter": filter })+  } else {+    json!({ "failFast": fail_fast, "reportToConsole": !quiet, "disableLog": quiet, "isDoctest": true })+  };++  let run_tests_cmd = format!(+    "\n// @ts-ignore\nDeno[Deno.internal].runTests({});\n",+    options+  );++  test_file.push_str(&run_tests_cmd);+  Ok(test_file)+}++fn clean_string(input: &str) -> String {+  input+    .lines()+    .map(|line| {+      if line.trim().starts_with('*') {+        &line.trim()[1..]+      } else {+        line.trim()+      }+    })+    .filter(|line| !line.is_empty())+    .collect::<Vec<_>>()+    .join("\n")+}++pub fn is_supported_doctest(path: &Path) -> bool {+  let valid_ext = ["ts", "tsx", "js", "jsx"];+  path+    .extension()+    .and_then(OsStr::to_str)+    .map(|ext| valid_ext.contains(&ext) && !is_supported(path))+    .unwrap_or(false)+}++fn extract_test_tag(input: &str) -> Option<&str> {+  TEST_TAG_PATTERN+    .captures(input)+    .and_then(|m| m.get(1).map(|c| c.as_str()))+}++fn extract_caption(input: &str) -> Option<&str> {+  CAPTION_PATTERN+    .captures(input)+    .and_then(|m| m.get(1).map(|c| c.as_str()))+}++fn extract_imports(input: &str) -> Vec<&str> {+  IMPORT_PATTERN+    .captures_iter(input)+    .filter_map(|caps| caps.get(0).map(|m| m.as_str()))+    .collect()+}++fn has_await(input: &str) -> bool {+  AWAIT_PATTERN.find(input).is_some()+}

Those utils seems a little brittle 😬 we should probably leverage SWC for this purpose, but I guess it's alright for first pass

iykekings

comment created time in 4 hours

Pull request review commentdenoland/deno

feat: deno test --docs support

+// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.++use crate::ast::{self, Location};+use crate::flags::Flags;+use crate::media_type::MediaType;+use crate::program_state::ProgramState;+use deno_core::serde_json::json;+use deno_core::url::Url;+use deno_core::{error::AnyError, ModuleSpecifier};+use deno_doc::DocParser;+use jsdoc::ast::Tag;+use jsdoc::Input;+use regex::Regex;+use std::borrow::BorrowMut;+use std::cell::RefCell;+use std::collections::HashSet;+use std::ffi::OsStr;+use std::path::{Path, PathBuf};+use std::rc::Rc;+use swc_common::{comments::SingleThreadedComments, SourceMap, Span};+use swc_ecmascript::visit::Visit;+use swc_ecmascript::{+  ast::{Class, Decl, ExportDecl, Expr, Function, VarDecl},+  visit::Node,+};++use crate::test_runner::is_supported;++lazy_static! {+  // matches non-dynamic js imports+  static ref IMPORT_PATTERN: Regex =+    Regex::new(r#"import\s+?(?:(?:(?:[\w*\s{},]*)\s+from\s+?)|)(?:(?:".*?")|(?:'.*?'))[\s]*?(?:;|$|)"#).unwrap();+  static ref TEST_TAG_PATTERN: Regex = Regex::new(r"```(\w+)?").unwrap();+  static ref AWAIT_PATTERN: Regex = Regex::new(r"\Wawait\s").unwrap();+  // matches jsdoc example caption+  static ref CAPTION_PATTERN: Regex =+      Regex::new(r"<caption>([\s\w\W]+)</caption>").unwrap();+}++struct DocTestVisitor {+  comments: SingleThreadedComments,+  source_map: Rc<SourceMap>,+  examples: RefCell<Vec<(Location, String)>>,+}++struct DocTester {+  doctest_visitor: DocTestVisitor,+  parsed_module: ast::ParsedModule,+}++impl DocTester {+  fn new(parsed_module: ast::ParsedModule) -> Self {+    Self {+      doctest_visitor: DocTestVisitor::new(+        parsed_module.comments.clone(),+        Rc::clone(&parsed_module.source_map),+      ),+      parsed_module,+    }+  }+  pub fn get_comments(&mut self) -> Vec<(Location, String)> {+    let visitor = self.doctest_visitor.borrow_mut();+    visitor+      .visit_module(&self.parsed_module.module, &self.parsed_module.module);+    visitor.examples.clone().into_inner()+  }+}++impl DocTestVisitor {+  fn new(comments: SingleThreadedComments, source_map: Rc<SourceMap>) -> Self {+    Self {+      comments,+      source_map,+      examples: RefCell::new(vec![]),+    }+  }++  fn get_span_location(&self, span: Span) -> Location {+    self.source_map.lookup_char_pos(span.lo()).into()+  }++  fn parse_span_comments(&mut self, span: Span) {+    let comments = self+      .comments+      .with_leading(span.lo, |comments| comments.to_vec());+    let examples = comments+      .iter()+      .filter_map(|comment| {+        jsdoc::parse(Input::from(comment)).map(|op| op.1).ok()+      })+      .flat_map(|js_doc| {+        js_doc+          .tags+          .into_iter()+          .filter_map(|tag_item| match tag_item.tag {+            Tag::Example(ex_tag) => Some((+              self.get_span_location(ex_tag.span),+              ex_tag.text.value.to_string(),+            )),+            _ => None,+          })+      });+    self.examples.borrow_mut().extend(examples);+  }++  fn check_var_decl(+    &mut self,+    var_decl: &VarDecl,+    opt_export_decl: Option<&ExportDecl>,+  ) {+    var_decl.decls.iter().for_each(|decl| {+      if let Some(expr) = &decl.init {+        match &**expr {+          Expr::Object(_) | Expr::Fn(_) | Expr::Class(_) | Expr::Arrow(_) => {+            if let Some(export_decl) = opt_export_decl {+              self.parse_span_comments(export_decl.span);+            } else {+              self.parse_span_comments(var_decl.span);+            }+          }+          _ => {}+        }+      }+    });+  }+}++impl Visit for DocTestVisitor {+  fn visit_class(&mut self, class: &Class, parent: &dyn Node) {+    self.parse_span_comments(class.span);+    swc_ecmascript::visit::visit_class(self, class, parent);+  }++  fn visit_function(&mut self, function: &Function, parent: &dyn Node) {+    self.parse_span_comments(function.span);+    swc_ecmascript::visit::visit_function(self, function, parent);+  }++  fn visit_var_decl(&mut self, var_decl: &VarDecl, parent: &dyn Node) {+    self.check_var_decl(var_decl, None);+    swc_ecmascript::visit::visit_var_decl(self, var_decl, parent);+  }++  fn visit_export_decl(&mut self, export_decl: &ExportDecl, parent: &dyn Node) {+    match &export_decl.decl {+      Decl::Var(var_decl) => self.check_var_decl(var_decl, Some(export_decl)),+      Decl::Class(_) | Decl::Fn(_) => {+        self.parse_span_comments(export_decl.span)+      }+      _ => {}+    }+    swc_ecmascript::visit::visit_export_decl(self, export_decl, parent);+  }+}++pub async fn parse_jsdocs(+  source_files: &[Url],+  flags: Flags,+) -> Result<Vec<(Location, String)>, AnyError> {+  let program_state = ProgramState::new(flags.clone())?;+  let loader = Box::new(program_state.file_fetcher.clone());++  let doc_parser = DocParser::new(loader, false);+  let mut results = vec![];+  for url in source_files {+    let source_code =+      doc_parser.loader.load_source_code(&url.to_string()).await?;+    let path = PathBuf::from(&url.to_string());+    let media_type = MediaType::from(&path);+    let specifier = ModuleSpecifier::resolve_url(&url.to_string())?;+    let parsed_module = ast::parse(&specifier, &source_code, &media_type)?;+    let mut doc_tester = DocTester::new(parsed_module);+    results.extend(doc_tester.get_comments());+  }+  Ok(results)+}++pub fn prepare_doctests(+  jsdocs: Vec<(Location, String)>,+  fail_fast: bool,+  quiet: bool,+  filter: Option<String>,+) -> Result<String, AnyError> {+  let mut test_file =  "import * as assert from \"https://deno.land/std@0.70.0/testing/asserts.ts\";\n".to_string();+  let mut import_set = HashSet::new();++  let cwd = std::env::current_dir()?;+  let cwd_url_str = Url::from_directory_path(cwd)+    .map(|url| url.to_string())+    .unwrap_or_else(|_| "".to_string());++  let tests: String = jsdocs+    .into_iter()+    .filter_map(|(loc, example)| {+      let ex_str = clean_string(&example);+      let test_tag = extract_test_tag(&ex_str);+      if test_tag == Some("text") {+        return  None;+      }+      let ignore = test_tag == Some("ignore");+      extract_imports(&ex_str).into_iter().for_each(|import| { import_set.insert(import.to_string()); });+      let caption = extract_caption(&ex_str);+      let code_body = extract_code_body(&ex_str);+      let is_async = has_await(&ex_str);+      let res = format!(+        "\nDeno.test({{\n\tname: \"{} - {} (line {})\",\n\tignore: {},\n\t{} fn() {{\n{}\n}}\n}});\n",+        loc.filename.replace(&cwd_url_str, ""),+        caption.unwrap_or(""),+        loc.line,+        ignore,+        if is_async { "async"} else {""},+        code_body+    );+    Some(res)+    })+    .collect();+  let imports_str = import_set.into_iter().collect::<Vec<_>>().join("\n");+  test_file.push_str(&imports_str);+  test_file.push_str("\n");+  test_file.push_str(&tests);++  let options = if let Some(filter) = filter {+    json!({ "failFast": fail_fast, "reportToConsole": !quiet, "disableLog": quiet, "isDoctest": true, "filter": filter })+  } else {+    json!({ "failFast": fail_fast, "reportToConsole": !quiet, "disableLog": quiet, "isDoctest": true })+  };++  let run_tests_cmd = format!(+    "\n// @ts-ignore\nDeno[Deno.internal].runTests({});\n",+    options+  );++  test_file.push_str(&run_tests_cmd);+  Ok(test_file)+}++fn clean_string(input: &str) -> String {+  input+    .lines()+    .map(|line| {+      if line.trim().starts_with('*') {+        &line.trim()[1..]+      } else {+        line.trim()+      }+    })+    .filter(|line| !line.is_empty())+    .collect::<Vec<_>>()+    .join("\n")+}++pub fn is_supported_doctest(path: &Path) -> bool {+  let valid_ext = ["ts", "tsx", "js", "jsx"];+  path+    .extension()+    .and_then(OsStr::to_str)+    .map(|ext| valid_ext.contains(&ext) && !is_supported(path))+    .unwrap_or(false)+}

Not really sure what's going on here, @iykekings please explain

iykekings

comment created time in 4 hours

Pull request review commentdenoland/deno

feat: deno test --docs support

+// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.++use crate::ast::{self, Location};+use crate::flags::Flags;+use crate::media_type::MediaType;+use crate::program_state::ProgramState;+use deno_core::serde_json::json;+use deno_core::url::Url;+use deno_core::{error::AnyError, ModuleSpecifier};+use deno_doc::DocParser;+use jsdoc::ast::Tag;+use jsdoc::Input;+use regex::Regex;+use std::borrow::BorrowMut;+use std::cell::RefCell;+use std::collections::HashSet;+use std::ffi::OsStr;+use std::path::{Path, PathBuf};+use std::rc::Rc;+use swc_common::{comments::SingleThreadedComments, SourceMap, Span};+use swc_ecmascript::visit::Visit;+use swc_ecmascript::{+  ast::{Class, Decl, ExportDecl, Expr, Function, VarDecl},+  visit::Node,+};++use crate::test_runner::is_supported;++lazy_static! {+  // matches non-dynamic js imports+  static ref IMPORT_PATTERN: Regex =+    Regex::new(r#"import\s+?(?:(?:(?:[\w*\s{},]*)\s+from\s+?)|)(?:(?:".*?")|(?:'.*?'))[\s]*?(?:;|$|)"#).unwrap();+  static ref TEST_TAG_PATTERN: Regex = Regex::new(r"```(\w+)?").unwrap();+  static ref AWAIT_PATTERN: Regex = Regex::new(r"\Wawait\s").unwrap();+  // matches jsdoc example caption+  static ref CAPTION_PATTERN: Regex =+      Regex::new(r"<caption>([\s\w\W]+)</caption>").unwrap();+}++struct DocTestVisitor {+  comments: SingleThreadedComments,+  source_map: Rc<SourceMap>,+  examples: RefCell<Vec<(Location, String)>>,+}++struct DocTester {+  doctest_visitor: DocTestVisitor,+  parsed_module: ast::ParsedModule,+}++impl DocTester {+  fn new(parsed_module: ast::ParsedModule) -> Self {+    Self {+      doctest_visitor: DocTestVisitor::new(+        parsed_module.comments.clone(),+        Rc::clone(&parsed_module.source_map),+      ),+      parsed_module,+    }+  }+  pub fn get_comments(&mut self) -> Vec<(Location, String)> {+    let visitor = self.doctest_visitor.borrow_mut();+    visitor+      .visit_module(&self.parsed_module.module, &self.parsed_module.module);+    visitor.examples.clone().into_inner()+  }+}++impl DocTestVisitor {+  fn new(comments: SingleThreadedComments, source_map: Rc<SourceMap>) -> Self {+    Self {+      comments,+      source_map,+      examples: RefCell::new(vec![]),+    }+  }++  fn get_span_location(&self, span: Span) -> Location {+    self.source_map.lookup_char_pos(span.lo()).into()+  }++  fn parse_span_comments(&mut self, span: Span) {+    let comments = self+      .comments+      .with_leading(span.lo, |comments| comments.to_vec());+    let examples = comments+      .iter()+      .filter_map(|comment| {+        jsdoc::parse(Input::from(comment)).map(|op| op.1).ok()+      })+      .flat_map(|js_doc| {+        js_doc+          .tags+          .into_iter()+          .filter_map(|tag_item| match tag_item.tag {+            Tag::Example(ex_tag) => Some((+              self.get_span_location(ex_tag.span),+              ex_tag.text.value.to_string(),+            )),+            _ => None,+          })+      });+    self.examples.borrow_mut().extend(examples);+  }++  fn check_var_decl(+    &mut self,+    var_decl: &VarDecl,+    opt_export_decl: Option<&ExportDecl>,+  ) {+    var_decl.decls.iter().for_each(|decl| {+      if let Some(expr) = &decl.init {+        match &**expr {+          Expr::Object(_) | Expr::Fn(_) | Expr::Class(_) | Expr::Arrow(_) => {+            if let Some(export_decl) = opt_export_decl {+              self.parse_span_comments(export_decl.span);+            } else {+              self.parse_span_comments(var_decl.span);+            }+          }+          _ => {}+        }+      }+    });+  }+}++impl Visit for DocTestVisitor {+  fn visit_class(&mut self, class: &Class, parent: &dyn Node) {+    self.parse_span_comments(class.span);+    swc_ecmascript::visit::visit_class(self, class, parent);+  }++  fn visit_function(&mut self, function: &Function, parent: &dyn Node) {+    self.parse_span_comments(function.span);+    swc_ecmascript::visit::visit_function(self, function, parent);+  }++  fn visit_var_decl(&mut self, var_decl: &VarDecl, parent: &dyn Node) {+    self.check_var_decl(var_decl, None);+    swc_ecmascript::visit::visit_var_decl(self, var_decl, parent);+  }++  fn visit_export_decl(&mut self, export_decl: &ExportDecl, parent: &dyn Node) {+    match &export_decl.decl {+      Decl::Var(var_decl) => self.check_var_decl(var_decl, Some(export_decl)),+      Decl::Class(_) | Decl::Fn(_) => {+        self.parse_span_comments(export_decl.span)+      }+      _ => {}+    }+    swc_ecmascript::visit::visit_export_decl(self, export_decl, parent);+  }+}++pub async fn parse_jsdocs(+  source_files: &[Url],+  flags: Flags,+) -> Result<Vec<(Location, String)>, AnyError> {+  let program_state = ProgramState::new(flags.clone())?;+  let loader = Box::new(program_state.file_fetcher.clone());++  let doc_parser = DocParser::new(loader, false);+  let mut results = vec![];+  for url in source_files {+    let source_code =+      doc_parser.loader.load_source_code(&url.to_string()).await?;+    let path = PathBuf::from(&url.to_string());+    let media_type = MediaType::from(&path);+    let specifier = ModuleSpecifier::resolve_url(&url.to_string())?;+    let parsed_module = ast::parse(&specifier, &source_code, &media_type)?;+    let mut doc_tester = DocTester::new(parsed_module);+    results.extend(doc_tester.get_comments());+  }+  Ok(results)+}++pub fn prepare_doctests(+  jsdocs: Vec<(Location, String)>,+  fail_fast: bool,+  quiet: bool,+  filter: Option<String>,+) -> Result<String, AnyError> {+  let mut test_file =  "import * as assert from \"https://deno.land/std@0.70.0/testing/asserts.ts\";\n".to_string();

Having asserts namespace available by default is probably useful, but @ry and I think we shouldn't do that for the first pass of this feature

iykekings

comment created time in 4 hours

Pull request review commentdenoland/deno

feat: deno test --docs support

+// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.++use crate::ast::{self, Location};+use crate::flags::Flags;+use crate::media_type::MediaType;+use crate::program_state::ProgramState;+use deno_core::serde_json::json;+use deno_core::url::Url;+use deno_core::{error::AnyError, ModuleSpecifier};+use deno_doc::DocParser;+use jsdoc::ast::Tag;+use jsdoc::Input;+use regex::Regex;+use std::borrow::BorrowMut;+use std::cell::RefCell;+use std::collections::HashSet;+use std::ffi::OsStr;+use std::path::{Path, PathBuf};+use std::rc::Rc;+use swc_common::{comments::SingleThreadedComments, SourceMap, Span};+use swc_ecmascript::visit::Visit;+use swc_ecmascript::{+  ast::{Class, Decl, ExportDecl, Expr, Function, VarDecl},+  visit::Node,+};++use crate::test_runner::is_supported;++lazy_static! {+  // matches non-dynamic js imports+  static ref IMPORT_PATTERN: Regex =+    Regex::new(r#"import\s+?(?:(?:(?:[\w*\s{},]*)\s+from\s+?)|)(?:(?:".*?")|(?:'.*?'))[\s]*?(?:;|$|)"#).unwrap();+  static ref TEST_TAG_PATTERN: Regex = Regex::new(r"```(\w+)?").unwrap();+  static ref AWAIT_PATTERN: Regex = Regex::new(r"\Wawait\s").unwrap();+  // matches jsdoc example caption+  static ref CAPTION_PATTERN: Regex =+      Regex::new(r"<caption>([\s\w\W]+)</caption>").unwrap();+}++struct DocTestVisitor {+  comments: SingleThreadedComments,+  source_map: Rc<SourceMap>,+  examples: RefCell<Vec<(Location, String)>>,+}++struct DocTester {+  doctest_visitor: DocTestVisitor,+  parsed_module: ast::ParsedModule,+}++impl DocTester {+  fn new(parsed_module: ast::ParsedModule) -> Self {+    Self {+      doctest_visitor: DocTestVisitor::new(+        parsed_module.comments.clone(),+        Rc::clone(&parsed_module.source_map),+      ),+      parsed_module,+    }+  }+  pub fn get_comments(&mut self) -> Vec<(Location, String)> {+    let visitor = self.doctest_visitor.borrow_mut();+    visitor+      .visit_module(&self.parsed_module.module, &self.parsed_module.module);+    visitor.examples.clone().into_inner()+  }+}++impl DocTestVisitor {+  fn new(comments: SingleThreadedComments, source_map: Rc<SourceMap>) -> Self {+    Self {+      comments,+      source_map,+      examples: RefCell::new(vec![]),+    }+  }++  fn get_span_location(&self, span: Span) -> Location {+    self.source_map.lookup_char_pos(span.lo()).into()+  }++  fn parse_span_comments(&mut self, span: Span) {+    let comments = self+      .comments+      .with_leading(span.lo, |comments| comments.to_vec());+    let examples = comments+      .iter()+      .filter_map(|comment| {+        jsdoc::parse(Input::from(comment)).map(|op| op.1).ok()+      })+      .flat_map(|js_doc| {+        js_doc+          .tags+          .into_iter()+          .filter_map(|tag_item| match tag_item.tag {+            Tag::Example(ex_tag) => Some((+              self.get_span_location(ex_tag.span),+              ex_tag.text.value.to_string(),+            )),+            _ => None,+          })+      });+    self.examples.borrow_mut().extend(examples);+  }++  fn check_var_decl(+    &mut self,+    var_decl: &VarDecl,+    opt_export_decl: Option<&ExportDecl>,+  ) {+    var_decl.decls.iter().for_each(|decl| {+      if let Some(expr) = &decl.init {+        match &**expr {+          Expr::Object(_) | Expr::Fn(_) | Expr::Class(_) | Expr::Arrow(_) => {+            if let Some(export_decl) = opt_export_decl {+              self.parse_span_comments(export_decl.span);+            } else {+              self.parse_span_comments(var_decl.span);+            }+          }+          _ => {}+        }+      }+    });+  }+}++impl Visit for DocTestVisitor {+  fn visit_class(&mut self, class: &Class, parent: &dyn Node) {+    self.parse_span_comments(class.span);+    swc_ecmascript::visit::visit_class(self, class, parent);+  }++  fn visit_function(&mut self, function: &Function, parent: &dyn Node) {+    self.parse_span_comments(function.span);+    swc_ecmascript::visit::visit_function(self, function, parent);+  }++  fn visit_var_decl(&mut self, var_decl: &VarDecl, parent: &dyn Node) {+    self.check_var_decl(var_decl, None);+    swc_ecmascript::visit::visit_var_decl(self, var_decl, parent);+  }++  fn visit_export_decl(&mut self, export_decl: &ExportDecl, parent: &dyn Node) {+    match &export_decl.decl {+      Decl::Var(var_decl) => self.check_var_decl(var_decl, Some(export_decl)),+      Decl::Class(_) | Decl::Fn(_) => {+        self.parse_span_comments(export_decl.span)+      }+      _ => {}+    }+    swc_ecmascript::visit::visit_export_decl(self, export_decl, parent);+  }+}++pub async fn parse_jsdocs(+  source_files: &[Url],+  flags: Flags,+) -> Result<Vec<(Location, String)>, AnyError> {+  let program_state = ProgramState::new(flags.clone())?;+  let loader = Box::new(program_state.file_fetcher.clone());++  let doc_parser = DocParser::new(loader, false);+  let mut results = vec![];+  for url in source_files {+    let source_code =+      doc_parser.loader.load_source_code(&url.to_string()).await?;+    let path = PathBuf::from(&url.to_string());+    let media_type = MediaType::from(&path);+    let specifier = ModuleSpecifier::resolve_url(&url.to_string())?;+    let parsed_module = ast::parse(&specifier, &source_code, &media_type)?;+    let mut doc_tester = DocTester::new(parsed_module);+    results.extend(doc_tester.get_comments());+  }+  Ok(results)+}++pub fn prepare_doctests(+  jsdocs: Vec<(Location, String)>,+  fail_fast: bool,+  quiet: bool,+  filter: Option<String>,+) -> Result<String, AnyError> {+  let mut test_file =  "import * as assert from \"https://deno.land/std@0.70.0/testing/asserts.ts\";\n".to_string();+  let mut import_set = HashSet::new();++  let cwd = std::env::current_dir()?;+  let cwd_url_str = Url::from_directory_path(cwd)+    .map(|url| url.to_string())+    .unwrap_or_else(|_| "".to_string());++  let tests: String = jsdocs+    .into_iter()+    .filter_map(|(loc, example)| {+      let ex_str = clean_string(&example);+      let test_tag = extract_test_tag(&ex_str);+      if test_tag == Some("text") {+        return  None;+      }+      let ignore = test_tag == Some("ignore");+      extract_imports(&ex_str).into_iter().for_each(|import| { import_set.insert(import.to_string()); });+      let caption = extract_caption(&ex_str);+      let code_body = extract_code_body(&ex_str);+      let is_async = has_await(&ex_str);+      let res = format!(+        "\nDeno.test({{\n\tname: \"{} - {} (line {})\",\n\tignore: {},\n\t{} fn() {{\n{}\n}}\n}});\n",+        loc.filename.replace(&cwd_url_str, ""),+        caption.unwrap_or(""),+        loc.line,+        ignore,+        if is_async { "async"} else {""},+        code_body+    );+    Some(res)+    })+    .collect();+  let imports_str = import_set.into_iter().collect::<Vec<_>>().join("\n");+  test_file.push_str(&imports_str);+  test_file.push_str("\n");+  test_file.push_str(&tests);++  let options = if let Some(filter) = filter {+    json!({ "failFast": fail_fast, "reportToConsole": !quiet, "disableLog": quiet, "isDoctest": true, "filter": filter })+  } else {+    json!({ "failFast": fail_fast, "reportToConsole": !quiet, "disableLog": quiet, "isDoctest": true })+  };++  let run_tests_cmd = format!(+    "\n// @ts-ignore\nDeno[Deno.internal].runTests({});\n",

await Deno[Deno.internal].runTests()

iykekings

comment created time in 4 hours

Pull request review commentdenoland/deno

feat: deno test --docs support

 use std::rc::Rc; use std::sync::Arc; use upgrade::upgrade_command; +impl DocFileLoader for SourceFileFetcher {

There's already an implementation called DocLoader - prefer to use it with import map set to None

iykekings

comment created time in 4 hours

PullRequestReviewEvent
PullRequestReviewEvent

push eventiykekings/deno

Yoshiya Hinosawa

commit sha 0dcaea72aeec52a566764b41b10d8fd1854d6fa4

feat: add alert, confirm, and prompt (#7507) This commit adds "alert", "confirm" and "prompt" functions from web standards.

view details

Casper Beyer

commit sha bbf7b2ee72ae7dede26e4ef48b384404525f389e

feat(cli/repl): add regex based syntax highlighter (#7811) This commit adds a simple regex replace based highlighter to the REPL editor. It tries to match the color palette of Deno.inspect()

view details

Nayeem Rahman

commit sha d0c2714c033b010cbd174138638881dc65abef06

fix(op_crates/web/url): apply backslash replacement to the pathname setter (#7937)

view details

Grant Timmerman

commit sha 47eeb889e18cb5be5465a150b05b409d7f77fcb3

docs: fix runtime docs link in README (#7926)

view details

sakas

commit sha f42d0fc99e37bb0583cddeca5367a1dcf83d53b8

docs: fix links to examples (#7919)

view details

Ryan Dahl

commit sha 374d433f1f4885686dc5c166be3a25c839e22959

Remove dead code (#7963)

view details

Kitson Kelly

commit sha 10654fa95553866c63a56a7f84c7ec47fb7aac9c

refactor(cli): add tsc2 (#7942) Ref #7225

view details

Bartek Iwańczuk

commit sha 135053486c4bd112ebd7d0b25c94a8dd346472e6

fix: top-level-await module execution (#7946) This commit changes implementation of top-level-await in "deno_core". Previously promise returned from module evaluation was not awaited, leading to out-of-order execution of modules that have TLA. It's been fixed by changing "JsRuntime::mod_evaluate" to be an async function that resolves when the promise returned from module evaluation also resolves. When waiting for promise resolution event loop is polled repeatedly, until there are no more dynamic imports or pending ops.

view details

Casper Beyer

commit sha e2a1a7c937b67d050e7e3287d7e5dbc6ffd9b168

refactor(cli/repl): clean up prelude injection (#7967) This extracts prelude injection into a helper function and moves the prelude string literal into a top level static string to help trim some of the fat out of the run function.

view details

Yoshiya Hinosawa

commit sha e9f02c231473ba42f506a895734d445cd31d379f

fix(console): fix the test cases of function inspections (#7965)

view details

Bartek Iwańczuk

commit sha 12e700bddfad8c23f6b55baca4ca4afb8337af26

fix(test): return error when awaiting unresolved promise (#7968) This commit fixes test runner by awaitning "Deno.runTests()" call, which ensures proper error is returned when there's an unresolved promise that's being awaited.

view details

vwkd

commit sha f9489e9acb0e3121bbd71ef0cf1826320d0c0995

fix typos (#7964)

view details

TTtie

commit sha f75bd89aff7cffafceb394d629995479af54a156

feat(cli/console): inspect with colors regardless of Deno.noColor (#7778) This commit adds the ability for users to inspect items stylized with ANSI colors regardless of the value of Deno.noColor.

view details

ali ahmed

commit sha 5bed06fb94214db70a27cca8fa8eff717d537dba

feat(std/fs/node): adding some functions (#7921)

view details

Bartek Iwańczuk

commit sha 81635c59e66b81a4c85aed6775aff4beedf71f14

Revert "feat(cli/console): inspect with colors regardless of Deno.noColor (#7778)" (#7973) This reverts commit f75bd89aff7cffafceb394d629995479af54a156.

view details

Bartek Iwańczuk

commit sha bd0c64b9aeeb75eea25402b0ebd5aecc2cec8e3a

Reland feat(cli/console): inspect with colors regardless of Deno.noColor (#7976)

view details

Kitson Kelly

commit sha bbe4474d39aecfabed52bd080e73d34978b6481b

fix(cli): ModuleGraph2 properly handles redirects (#7981)

view details

William Perron

commit sha 943b0980c7ff97cb6096291efa5e3d5dbfe10805

feat(cli/ops): add the sleep_sync op (#7974)

view details

Ben Noordhuis

commit sha 46b892ad37df9ba9bed77fb923a1cfe284b208dc

refactor(core): more control over isolate creation (#8000) Make JSRuntime::new() accept a custom v8::CreateParams object to tune the v8::Isolate it creates. Subsumes the functionality of HeapLimits, which I therefore removed.

view details

Bartek Iwańczuk

commit sha c1c760130406405c8fde9a74bd88c62ca721967b

upgrade: deno_doc, deno_lint, dprint, swc (#8009)

view details

push time in 4 hours

push eventbartlomieju/deno

Ryan Dahl

commit sha 3e51610bbb5d5d63863b9989690ca1e8127fdf88

Remove github actions cache (#8020) Running into issues with cache when trying to upgrade V8. Based on the analysis in https://github.com/denoland/deno/pull/7903#issuecomment-706252380 we know the cache is not providing much benefit.

view details

Casper Beyer

commit sha 065db9df19fa9f1f598fc3a5c7fd978b484428de

test(std/io): use a real tempdir (#8019) This replaces a case of a temp file in the working tree with a tempfile in a real temporary directory avoiding pollution of the working directory.

view details

Ryan Dahl

commit sha 59888ff0b27f75feb3ea88cdea943bf9fbd345fd

upgrade rusty_v8 (#8017)

view details

Ryan Dahl

commit sha fb2cae9687569fc891c13ab4a2862b9e66902a75

deno_core 0.64.0 (#8025)

view details

Casper Beyer

commit sha f91c1155f0cccef9a49efdcc489be3f258000957

docs(tools): add repl section (#8011) This adds a section on the repl with the keybindings that we support out of the box.

view details

Marcos Casagrande

commit sha d3dea24560f7434bd1020f0d9dc4c787f79479da

fix(std/tar): fix constant condition (#8010)

view details

Casper Beyer

commit sha f5c23f8058ed7ce85846c6b1e623329a09fa1a76

fix(cli/repl): write all results to stdout (#7893) This writes all evaluaton results to stdout regardless if the result is an error or not. This matches the behavior of other read-eval-print-loops like Node.

view details

Casper Beyer

commit sha 8eb44537ecb35aebf2aa95018ab8806ab899e0f7

fix(cli/repl): keyboard interrupt should continue (#7960) This changes the behavior of keyboard interrupts (ctrl+c) to continue, clearing the current line instead of exiting. Exit can still be done with ctrl+d or by calling close().

view details

Yoshiya Hinosawa

commit sha 342b151b5d9d6c97926588dd118b59032f3b0e40

docs(std/datetime): document toIMF, isLeap, difference, and constants (#7931)

view details

Nayeem Rahman

commit sha 19b918d112c786b1db17fe2d83be79f1114ba240

feat(std/path): Add toFileUrl() (#7971)

view details

Casper Beyer

commit sha e58763737e82db481a05e34ad883b1cd286dd05d

docs(getting_started): fix WebAssembly example (#8028)

view details

vwkd

commit sha e432db70e9b5628990517baa689b74721f6da8e1

docs: readTextFile / readTextFileSync throw when reading directory (#7999)

view details

Casper Beyer

commit sha 35028db5e571b4232dd58293cea7e5a8ec2e3571

fix(cli/repl): unterminated string literal should invalidate (#7896) This adds the grave character to the pair matching so that template string literals trigger multi-line edits.

view details

Luca Casonato

commit sha 08441b855d8cfbe7edd41811c8c719e5fae01f83

fix(op_crates/fetch): Body.body should be stream of Uint8Array (#8030)

view details

push time in 4 hours

pull request commentdenoland/deno

feat(cli/main): Add deno cache --test

@nayeemrmn could you address https://github.com/denoland/deno/issues/6753 as part of this PR as well?

nayeemrmn

comment created time in 4 hours

pull request commentdenoland/deno

[WIP] refactor(cli): migrate run and cache to new infrastructure

Still a work in progress, the biggest challenge is with dynamic imports. I need to do some thinking about how best to integrate these in a way that is clean in the new infrastructure.

Can you elaborate what's the hurdle with dynamic imports?

kitsonk

comment created time in 4 hours

Pull request review commentdenoland/deno

feat(cli): add support for bundle --no-check

 pub fn parse(   }) } +/// A low level function which transpiles a source module into an swc+/// SourceFile.+pub fn transpile_module(+  filename: &str,+  src: &str,+  media_type: &MediaType,+  emit_options: &EmitOptions,+  cm: Rc<SourceMap>,+) -> Result<(Rc<SourceFile>, Module), AnyError> {+  let comments = SingleThreadedComments::default();+  let syntax = get_syntax(media_type);+  let source_file =+    cm.new_source_file(FileName::Custom(filename.to_string()), src.to_string());+  let lexer = Lexer::new(+    syntax,+    TARGET,+    StringInput::from(&*source_file),+    Some(&comments),+  );+  let mut parser = swc_ecmascript::parser::Parser::new_from(lexer);+  // TODO(@kitsonk) this seems to be a problem with the type of result+  // from `.parse_module` that cannot be coerced.+  let module = match parser.parse_module() {+    Ok(m) => m,+    Err(err) => bail!("Parsing failed: {:?}", err),+  };

Need to be mapped to DiagnosticBuffer like in parse function - why isn't parse function from this module used in this function?

kitsonk

comment created time in 4 hours

Pull request review commentdenoland/deno

feat(cli): add support for bundle --no-check

 impl Default for TranspileOptions {   } } +impl From<tsc_config::TsConfig> for EmitOptions {+  fn from(config: tsc_config::TsConfig) -> Self {+    let options: tsc_config::EmitConfigOptions =+      serde_json::from_value(config.0).unwrap();+    EmitOptions {+      check_js: options.check_js,+      emit_metadata: options.emit_decorator_metadata,+      inline_source_map: true,+      jsx_factory: options.jsx_factory,+      jsx_fragment_factory: options.jsx_fragment_factory,+      transform_jsx: options.jsx == "react",+    }+  }+}+

Thank you

kitsonk

comment created time in 5 hours

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentdenoland/deno_lint

add Camelcase rule

Output from linting deno/std/:

(camelcase) Identifier 'Sha3_224' is not in camel case.
export class Sha3_224 extends Sponge {
             ^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/_sha3/sha3.ts:7:13

    hint: Consider renaming `Sha3_224` to `SHA3_224`

(camelcase) Identifier 'Sha3_256' is not in camel case.
export class Sha3_256 extends Sponge {
             ^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/_sha3/sha3.ts:19:13

    hint: Consider renaming `Sha3_256` to `SHA3_256`

(camelcase) Identifier 'Sha3_384' is not in camel case.
export class Sha3_384 extends Sponge {
             ^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/_sha3/sha3.ts:31:13

    hint: Consider renaming `Sha3_384` to `SHA3_384`

(camelcase) Identifier 'Sha3_512' is not in camel case.
export class Sha3_512 extends Sponge {
             ^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/_sha3/sha3.ts:43:13

    hint: Consider renaming `Sha3_512` to `SHA3_512`

(camelcase) Identifier 'Sha3_224' is not in camel case.
  Sha3_224,
  ^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/sha3_test.ts:9:2

    hint: Consider replacing `{ Sha3_224 }` with `{ Sha3_224 as SHA3_224 }`

(camelcase) Identifier 'Sha3_256' is not in camel case.
  Sha3_256,
  ^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/sha3_test.ts:10:2

    hint: Consider replacing `{ Sha3_256 }` with `{ Sha3_256 as SHA3_256 }`

(camelcase) Identifier 'Sha3_384' is not in camel case.
  Sha3_384,
  ^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/sha3_test.ts:11:2

    hint: Consider replacing `{ Sha3_384 }` with `{ Sha3_384 as SHA3_384 }`

(camelcase) Identifier 'Sha3_512' is not in camel case.
  Sha3_512,
  ^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/sha3_test.ts:12:2

    hint: Consider replacing `{ Sha3_512 }` with `{ Sha3_512 as SHA3_512 }`

(camelcase) Identifier 'testSetSha3_224' is not in camel case.
const testSetSha3_224 = [
      ^^^^^^^^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/sha3_test.ts:20:6

    hint: Consider renaming `testSetSha3_224` to `TESTSETSHA3_224`

(camelcase) Identifier 'testSetSha3_256' is not in camel case.
const testSetSha3_256 = [
      ^^^^^^^^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/sha3_test.ts:34:6

    hint: Consider renaming `testSetSha3_256` to `TESTSETSHA3_256`

(camelcase) Identifier 'testSetSha3_384' is not in camel case.
const testSetSha3_384 = [
      ^^^^^^^^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/sha3_test.ts:51:6

    hint: Consider renaming `testSetSha3_384` to `TESTSETSHA3_384`

(camelcase) Identifier 'testSetSha3_512' is not in camel case.
const testSetSha3_512 = [
      ^^^^^^^^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/sha3_test.ts:74:6

    hint: Consider renaming `testSetSha3_512` to `TESTSETSHA3_512`

(camelcase) Identifier 'testSetShake128_224' is not in camel case.
const testSetShake128_224 = [
      ^^^^^^^^^^^^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/sha3_test.ts:168:6

    hint: Consider renaming `testSetShake128_224` to `TESTSETSHAKE128_224`

(camelcase) Identifier 'testSetShake128_2048' is not in camel case.
const testSetShake128_2048 = [
      ^^^^^^^^^^^^^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/sha3_test.ts:178:6

    hint: Consider renaming `testSetShake128_2048` to `TESTSETSHAKE128_2048`

(camelcase) Identifier 'testSetShake256_128' is not in camel case.
const testSetShake256_128 = [
      ^^^^^^^^^^^^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/sha3_test.ts:210:6

    hint: Consider renaming `testSetShake256_128` to `TESTSETSHAKE256_128`

(camelcase) Identifier 'testSetShake256_384' is not in camel case.
const testSetShake256_384 = [
      ^^^^^^^^^^^^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/sha3_test.ts:220:6

    hint: Consider renaming `testSetShake256_384` to `TESTSETSHAKE256_384`

(camelcase) Identifier 'testSetShake256_512' is not in camel case.
const testSetShake256_512 = [
      ^^^^^^^^^^^^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/hash/sha3_test.ts:239:6

    hint: Consider renaming `testSetShake256_512` to `TESTSETSHAKE256_512`

(camelcase) Identifier 'to_BigInt' is not in camel case.
function to_BigInt(num?: number | null) {
         ^^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/node/_fs/_fs_stat_test.ts:27:9

    hint: Consider renaming `to_BigInt` to `TO_BIGINT`

(camelcase) Identifier 'test_data' is not in camel case.
    const test_data = new TextEncoder().encode("hello world");
          ^^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/node/_fs/_fs_appendFile_test.ts:214:10

    hint: Consider renaming `test_data` to `testData`

(camelcase) Identifier 'test_data' is not in camel case.
    const test_data = new TextEncoder().encode("hello world");
          ^^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/node/_fs/_fs_appendFile_test.ts:227:10

    hint: Consider renaming `test_data` to `testData`

(camelcase) Identifier 'to_BigInt' is not in camel case.
function to_BigInt(number?: number | null) {
         ^^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/node/_fs/_fs_stat.ts:186:9

    hint: Consider renaming `to_BigInt` to `TO_BIGINT`

(camelcase) Identifier 'temp_dir' is not in camel case.
const temp_dir = parse(Deno.makeTempFileSync()).dir;
      ^^^^^^^^
    at /Users/biwanczuk/dev/deno/std/node/_fs/_fs_open_test.ts:12:6

    hint: Consider renaming `temp_dir` to `tempDir`

All of them are ok besides first three (class declarations)

magurotuna

comment created time in 5 hours

Pull request review commentdenoland/deno_lint

add Camelcase rule

+// Copyright 2020 the Deno authors. All rights reserved. MIT license.+use super::Context;+use super::LintRule;+use crate::swc_util::Key;+use regex::{Captures, Regex};+use std::collections::{BTreeMap, BTreeSet};+use swc_common::{Span, Spanned};+use swc_ecmascript::ast::{+  ArrayPat, AssignPat, AssignPatProp, ClassDecl, ClassExpr,+  ExportNamespaceSpecifier, Expr, FnDecl, FnExpr, GetterProp, Ident,+  ImportDefaultSpecifier, ImportNamedSpecifier, ImportStarAsSpecifier,+  KeyValuePatProp, KeyValueProp, MethodProp, Module, ObjectLit, ObjectPat,+  ObjectPatProp, Param, Pat, Prop, PropName, PropOrSpread, RestPat, SetterProp,+  VarDeclarator,+};+use swc_ecmascript::visit::{noop_visit_type, Node, Visit, VisitWith};++pub struct Camelcase;++impl LintRule for Camelcase {+  fn new() -> Box<Self> {+    Box::new(Camelcase)+  }++  fn tags(&self) -> &[&'static str] {+    &["recommended"]+  }++  fn code(&self) -> &'static str {+    "camelcase"+  }++  fn lint_module(&self, context: &mut Context, module: &Module) {+    let mut visitor = CamelcaseVisitor::new(context);+    visitor.visit_module(module, module);+    visitor.report_errors();+  }+}++/// Check if it contains underscores, except for leading and trailing ones+fn is_underscored(ident_name: &str) -> bool {+  let trimmed_ident = ident_name.trim_matches('_');+  trimmed_ident.contains('_')+    && trimmed_ident != trimmed_ident.to_ascii_uppercase()+}++/// Convert the name of identifier into camel case. If the name is originally in camel case, return+/// the name as it is. For more detail, see the test cases below.+fn to_camelcase(ident_name: &str) -> String {+  if !is_underscored(ident_name) {+    return ident_name.to_string();+  }++  lazy_static! {+    static ref UNDERSCORE_CHAR_RE: Regex =+      Regex::new(r"([^_])_([a-z])").unwrap();+  }++  let result = UNDERSCORE_CHAR_RE.replace_all(ident_name, |caps: &Captures| {+    format!("{}{}", &caps[1], caps[2].to_ascii_uppercase())+  });++  if result != ident_name {+    return result.into_owned();+  }++  ident_name.to_ascii_uppercase()+}++enum IdentToCheck {+  /// Normal variable name e.g. `foo` in `const foo = 42;`+  Variable(String),+  /// Function name e.g. `foo` in `function foo() {}`+  Function(String),+  /// Class name e.g. `Foo` in `class Foo {}`+  Class(String),+  /// Key and value name in object pattern, for example:+  ///+  /// ```typescript+  /// const { foo } = obj1; // key_name: foo, value_name: None+  ///+  /// const { foo: bar } = obj2; // key_name: foo, value_name: Some(bar)+  ///+  /// const { foo: bar = default_value } = obj3; // key_name: foo, value_name: Some(bar)+  ///+  /// function f({ foo }) {} // key_name: foo, value_name: None+  /// ```+  ObjectPat {+    key_name: String,+    value_name: Option<String>,+  },+  /// Local name and imported name in named import, for example:+  ///+  /// ```typescript+  /// import { foo } from 'mod.ts'; // local: foo, imported: None+  ///+  /// import { foo as bar } from 'mod.ts'; // local: bar, imported: Some(foo)+  /// ```+  NamedImport {+    local: String,+    imported: Option<String>,+  },+}

👍 very nice

magurotuna

comment created time in 5 hours

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentdenoland/deno_lint

add Camelcase rule

@bartlomieju I've added assertions for messages and hints.

I have one more concern now. Given the code:

const { no_camelcased = false } = bar;

we get a hint that looks like:

Consider replacing `{ no_camelcased }` with `{ no_camelcased: noCamelcased }`

We would be happier if hint was the following

Consider replacing `{ no_camelcased }` with `{ no_camelcased: noCamelcased = false }`

Do you think this should be fixed before it's landed?

Looks great! I'm fine with landing as is - this edge case can be addressed in follow up PR.

magurotuna

comment created time in 5 hours

PullRequestReviewEvent

push eventdenoland/deno

Casper Beyer

commit sha 35028db5e571b4232dd58293cea7e5a8ec2e3571

fix(cli/repl): unterminated string literal should invalidate (#7896) This adds the grave character to the pair matching so that template string literals trigger multi-line edits.

view details

push time in 6 hours

PR merged denoland/deno

fix(cli/repl): unterminated string literal should invalidate

This adds the grave character to the pair matching so that template string literals trigger multi-line edits.

+70 -4

0 comment

2 changed files

caspervonb

pr closed time in 6 hours

PullRequestReviewEvent

pull request commentdenoland/deno

[WIP] handle SWC recoverable errors

@kdy1 thanks for detailed explanation, I'll revisit the topic after SWC updates its recovery

bartlomieju

comment created time in 8 hours

delete branch bartlomieju/deno

delete branch : refactor_swc_recoverable_errors

delete time in 8 hours

issue closeddenoland/deno

Handle recoverable errors from SWC

Much like TSC, SWC can recover from number of errors during parsing. Currently we treat any error as terminal and don't proceed to work on AST.

Parser.take_errors() can be used to obtain recoverable errors.

This issue can be treated as an umbrella issue for dependency analysis, deno doc and deno lint.

CC @kdy1

closed time in 8 hours

bartlomieju

issue commentdenoland/deno

Handle recoverable errors from SWC

After conversation with @kdy1 it turns out it's not really needed.

bartlomieju

comment created time in 8 hours

PR closed denoland/deno

[WIP] handle SWC recoverable errors

Closes https://github.com/denoland/deno/issues/7246

Need to come up with some test before landing

+22 -3

1 comment

1 changed file

bartlomieju

pr closed time in 8 hours

pull request commentdenoland/deno

[WIP] handle SWC recoverable errors

After conversation with @kdy1 it turns out it's not really needed.

bartlomieju

comment created time in 8 hours

pull request commentdenoland/deno

feat(std/testing): Add assertExists that the target is neither null nor undefined

Looks good to me, waiting on @kitsonk's approval

getspooky

comment created time in 8 hours

pull request commentdenoland/deno

chores(cli/fmt): make --ignore stable

@littledivy could you check if there are any tests that use this flag?

littledivy

comment created time in 8 hours

issue commentdenoland/deno_lint

Implement RuleVisitor

@kdy1 both of the solutions sound good to me, I guess it's a matter of your preference and which one would produce smaller binary ;)

bartlomieju

comment created time in 8 hours

push eventdenoland/deno

Yoshiya Hinosawa

commit sha 342b151b5d9d6c97926588dd118b59032f3b0e40

docs(std/datetime): document toIMF, isLeap, difference, and constants (#7931)

view details

push time in 8 hours

PR merged denoland/deno

docs(std/datetime): document toIMF, isLeap, difference, and constants

This PR adds the documents of toIMF, isLeap, difference, and constants to std/datetime/README.md.

+101 -0

0 comment

1 changed file

kt3k

pr closed time in 8 hours

PullRequestReviewEvent

pull request commentdenoland/deno_lint

feat: dlint plugin POC

@littledivy thanks for opening the PR. My idea for JS plugin support is as follows:

  • add deno_core as dev dependency
  • accept some flag (--plugins) that collects path to JS files containing JS visitors
  • create JsRuntime and execute visitor code in global scope (this is hacky, but way simpler to implement than using modules)
  • obtain JSON AST from Rust
  • load provided plugin files
  • for each loaded plugin file run its visitor and collect diagnostics
  • return diagnostics to Rust for further processing
littledivy

comment created time in 8 hours

Pull request review commentdenoland/deno_lint

feat: dlint plugin POC

+// Copyright 2020 the Deno authors. All rights reserved. MIT license.+use deno_lint::linter::Context;+use deno_lint::rules::LintRule;+use swc_ecmascript::ast::ImportDecl;+use swc_ecmascript::visit::Node;+use swc_ecmascript::visit::Visit;++pub struct WarnRawGitImport;++impl LintRule for WarnRawGitImport {+  fn new() -> Box<Self> {+    Box::new(WarnRawGitImport)+  }++  fn code(&self) -> &'static str {+    "no-raw-git-import"+  }++  fn lint_module(+    &self,

It's a regular rule, just outside of deno_lint lib

littledivy

comment created time in 8 hours

PullRequestReviewEvent
PullRequestReviewEvent

issue commentdenoland/deno_lint

Implement RuleVisitor

@kdy1 that would be very useful, if you're fine with having it in SWC, I might look into implementing that in the coming days.

bartlomieju

comment created time in 9 hours

push eventdenoland/deno

Casper Beyer

commit sha 8eb44537ecb35aebf2aa95018ab8806ab899e0f7

fix(cli/repl): keyboard interrupt should continue (#7960) This changes the behavior of keyboard interrupts (ctrl+c) to continue, clearing the current line instead of exiting. Exit can still be done with ctrl+d or by calling close().

view details

push time in 9 hours

PR merged denoland/deno

fix(cli/repl): keyboard interrupt should continue

This changes the behavior of keyboard interrupts (ctrl+c) to continue, clearing the current line instead of exiting.

Exit can still be done with ctrl+d or by calling close().

+2 -1

8 comments

1 changed file

caspervonb

pr closed time in 9 hours

PullRequestReviewEvent

issue openeddenoland/deno

Update docs for "deno_core" crate

Docs for deno_core are either outdated or lacking.

created time in 9 hours

pull request commentdenoland/deno_lint

example(dlint): use annotate-snippets for diagnostic formatting

@Stupremee which problems are you referring to? I actually managed to fix these problems:

- first 4 lines of source file are displayed for each error
- line number next to file is wrong - not sure what's the problem here - it's computed from SourceAnnotation which properly underlines offending token

That was done by adding little utility function. That said I will look into rslint_errors soon.

bartlomieju

comment created time in 9 hours

more