profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/ry/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.

denoland/deno 74722

A secure JavaScript and TypeScript runtime

ry/deno 405

ry/deno_typescript 31

To generate snapshots of TypeScript files during build.rs

ry/awesome-deno 17

🎉A curated list of awesome things related to Deno

ry/eecs151 12

http://inst.eecs.berkeley.edu/~eecs151/fa19/

ry/go 10

The Go programming language

ry/parcel 10

📦🚀 Blazing fast, zero configuration web application bundler

Pull request review commentdenoland/deno

feat(lsp): Implement textDocument/prepareCallHierarchy

 impl ReferenceEntry {   } } +#[derive(Debug, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct CallHierarchyItem {+  name: String,+  kind: ScriptElementKind,+  #[serde(skip_serializing_if = "Option::is_none")]+  kind_modifiers: Option<String>,+  file: String,+  span: TextSpan,+  selection_span: TextSpan,+  #[serde(skip_serializing_if = "Option::is_none")]+  container_name: Option<String>,+}++impl CallHierarchyItem {+  pub(crate) async fn try_resolve_call_hierarchy_item(+    &self,+    language_server: &mut language_server::Inner,+    maybe_root_path: Option<&Path>,+  ) -> Option<lsp::CallHierarchyItem> {+    let target_specifier = resolve_url(&self.file).unwrap();+    let target_line_index = language_server+      .get_line_index(target_specifier)+      .await+      .ok()?;++    Some(self.to_call_hierarchy_item(+      &target_line_index,+      language_server,+      maybe_root_path,+    ))+  }++  pub(crate) fn to_call_hierarchy_item(+    &self,+    line_index: &LineIndex,+    language_server: &mut language_server::Inner,+    maybe_root_path: Option<&Path>,+  ) -> lsp::CallHierarchyItem {+    let target_specifier = resolve_url(&self.file).unwrap();+    let uri = language_server+      .url_map+      .normalize_specifier(&target_specifier)+      .unwrap();++    let use_file_name = self.is_source_file_item();+    let maybe_file_path = if uri.scheme() == "file" {+      uri.to_file_path().ok()+    } else {+      None+    };+    let name = if use_file_name {+      if let Some(file_path) = maybe_file_path.as_ref() {+        file_path.file_name().unwrap().to_string_lossy().to_string()+      } else {+        uri.to_string()+      }+    } else {+      self.name.clone()+    };+    let detail = if use_file_name {+      if let Some(file_path) = maybe_file_path.as_ref() {+        // TODO: update this to work with multi root workspaces+        let parent_dir = file_path.parent().unwrap();+        if let Some(root_path) = maybe_root_path {+          parent_dir+            .strip_prefix(root_path)+            .unwrap_or(parent_dir)+            .to_string_lossy()+            .to_string()+        } else {+          parent_dir.to_string_lossy().to_string()+        }+      } else {+        String::new()+      }+    } else {+      self.container_name.as_ref().cloned().unwrap_or_default()+    };++    let mut tags: Option<Vec<lsp::SymbolTag>> = None;+    if let Some(modifiers) = self.kind_modifiers.as_ref() {+      let kind_modifiers = parse_kind_modifier(modifiers);+      if kind_modifiers.contains("deprecated") {+        tags = Some(vec![lsp::SymbolTag::Deprecated]);+      }+    }++    lsp::CallHierarchyItem {+      name,+      tags,+      uri,+      detail: Some(detail),+      kind: self.kind.clone().into(),+      range: self.span.to_range(line_index),+      selection_range: self.selection_span.to_range(line_index),+      data: None,
      ..Default::default()

Like I used in the other PR, this helps just ensure we have less "challenges" maintaining code when there are potential changes to the protocol in the future.

jeanp413

comment created time in 10 minutes

issue commentdenoland/rusty_v8

Wrapping Rust objects?

Not in general, I think. Restricting the type of a v8::FunctionTemplate receiver through a v8::Signature gives a modicum of runtime safety but that's not compile-time safety, of course.

Is there a way to do this in rusty_v8? I've looked at both the docs and the source, and I couldn't find any way to create a v8::Signature, so I'm wondering if there's something I missed or it just isn't implemented yet.

3c1u

comment created time in 13 minutes

Pull request review commentdenoland/deno

feat(lsp): Implement textDocument/documentSymbol

 pub fn server_capabilities(     )),     references_provider: Some(OneOf::Left(true)),     document_highlight_provider: Some(OneOf::Left(true)),-    document_symbol_provider: None,+    document_symbol_provider: Some(OneOf::Left(true)),

We should set a label here, but the lsp-types crate doesn't contain it at the moment. I opened PR https://github.com/gluon-lang/lsp-types/pull/207 to add it, but obviously it will take a way to work through, so we should update this when the dependencies get updated. Maybe add a TODO for now (or create a tracking issue)?

jeanp413

comment created time in 22 minutes

Pull request review commentdenoland/deno

feat(lsp): Implement textDocument/documentSymbol

 impl NavigationTree {     }   } +  pub fn collect_document_symbols(+    &self,+    line_index: &LineIndex,+    document_symbols: &mut Vec<lsp::DocumentSymbol>,+  ) -> bool {+    let mut should_include = self.should_include_entry();+    if !should_include+      && self.child_items.as_ref().map_or(true, |v| v.is_empty())+    {+      return false;+    }++    let children = self+      .child_items+      .as_ref()+      .map_or(&[] as &[NavigationTree], |v| v.as_slice());+    for span in self.spans.iter() {+      let range = TextRange::at(span.start.into(), span.length.into());+      let mut symbol_children = Vec::<lsp::DocumentSymbol>::new();+      for child in children.iter() {+        let should_traverse_child = child+          .spans+          .iter()+          .map(|child_span| {+            TextRange::at(child_span.start.into(), child_span.length.into())+          })+          .any(|child_range| range.intersect(child_range).is_some());+        if should_traverse_child {+          let included_child =+            child.collect_document_symbols(line_index, &mut symbol_children);+          should_include = should_include || included_child;+        }+      }++      if should_include {+        let mut selection_span = span;+        if let Some(name_span) = self.name_span.as_ref() {+          let name_range =+            TextRange::at(name_span.start.into(), name_span.length.into());+          if range.contains_range(name_range) {+            selection_span = name_span;+          }+        }++        let mut tags: Option<Vec<lsp::SymbolTag>> = None;+        let kind_modifiers = parse_kind_modifier(&self.kind_modifiers);+        if kind_modifiers.contains("deprecated") {+          tags = Some(vec![lsp::SymbolTag::Deprecated]);+        }++        let children = if !symbol_children.is_empty() {+          Some(symbol_children)+        } else {+          None+        };++        document_symbols.push(lsp::DocumentSymbol {+          name: self.text.clone(),+          kind: self.kind.clone().into(),+          range: span.to_range(line_index),+          selection_range: selection_span.to_range(line_index),+          tags,+          children,+          detail: None,+          deprecated: None,+        })
        document_symbols.push(lsp::DocumentSymbol {
          name: self.text.clone(),
          kind: self.kind.clone().into(),
          range: span.to_range(line_index),
          selection_range: selection_span.to_range(line_index),
          tags,
          children,
          ..Default::default()
        })

I believe this should allow you to remove the #[allow(deprecated)].

jeanp413

comment created time in 19 minutes

issue commentdenoland/deno

respond to http request from onmessage

Could you please provide a more complete replication.

Did this same code work in previous versions of Deno?

alexanderGalushka

comment created time in an hour

issue openeddenoland/deno

respond to http request from onmessage

deno: 1.9.0

responding to http request from onmessage (response from worker) in the main thread

getting this error:

error: Uncaught (in promise) BadResource: Bad resource ID
          numBytesWritten = await this.writer.write(data);
                            ^
    at unwrapOpResult (deno:core/core.js:100:13)
    at async write (deno:runtime/js/12_io.js:107:12)
    at async BufWriter.write (https://deno.land/std@0.93.0/io/bufio.ts:501:29)
    at async writeResponse (https://deno.land/std@0.93.0/http/_io.ts:275:15)
    at async ServerRequest.respond (https://deno.land/std@0.93.0/http/server.ts:87:7)

created time in 2 hours

push eventdenoland/deno

Luca Casonato

commit sha 0552eaf569ef910b0d132b6e60758f17a4519d91

chore: align `Headers` to spec (#10199) This commit aligns `Headers` to spec. It also removes the now unused 03_dom_iterable.js file. We now pass all relevant `Headers` WPT. We do not implement any sort of header filtering, as we are a server side runtime. This is likely not the most efficient implementation of `Headers` yet. It is however spec compliant. Once all the APIs in the `HTTP` hot loop are correct we can start optimizing them. It is likely that this commit reduces bench throughput temporarily.

view details

push time in 3 hours

PR merged denoland/deno

chore: align `Headers` to spec

This commit aligns Headers to spec. It also removes the now unused 03_dom_iterable.js file. We now pass all relevant Headers WPT. We do not implement any sort of header filtering, as we are a server side runtime.

This is likely not the most efficient implementation of Headers yet. It is however spec compliant. Once all the APIs in the HTTP hot loop are correct we can start optimizing them. It is likely that this reduces bench throughput temporarily.

+544 -506

1 comment

14 changed files

lucacasonato

pr closed time in 3 hours

PR opened denoland/deno

docs(manual/wasm): add more example code.

Adds example code for how to use deno with .wasm files.

Not sure if something else is preffered over readAll() from io/util.ts, but it's what worked for me.

+16 -0

0 comment

1 changed file

pr created time in 4 hours

PR opened denoland/vscode_deno

feat: add environment variables support on deno.path

Adds the possibility to use environment variables on the Deno path in settings.

Resolves #377

+22 -0

0 comment

1 changed file

pr created time in 4 hours

issue openeddenoland/deno

Windows' importing seems to work different from Linux and MacOS resulting in a "Cannot resolve module" error

The error comes from the following sample code:

// A.ts
import { b1 } from "./B.ts";

export const a1 = () => {
    console.log(b1);
}

export const a2 = () => {
    "a2";
}
//B.ts
import { a2 } from "./A.ts";

export const b1 = "b1";

export const b2 = () => {
    console.log(a2);
}
// main.ts
import { a1 } from "./A.ts"

a1();

When running deno run main.ts on either Linux or MacOS it outputs b1 which is expected, however on Windows it outputs the following error:

error: Cannot resolve module "file:///.../A" from "file:///.../main.ts".
    at file:///.../main.ts:1:0

Seems like the import on main is causing problems, that is because A.ts and B.ts are importing modules from each other however it's not the same modules, so it can't be a circular dependency. That error though Cannot resolve module seems to occur when the runtime gives up on importing the module; from my research, it can occur in cases of circular dependency. Maybe on the Windows environment, it thinks it's a circular dependency, not entirely sure though.

created time in 4 hours

issue openeddenoland/deno

1.9.0 Build Fails on stable-aarch64-apple-darwin

deno_build.txt

cargo install deno produces the attached output, here is the error:

   Compiling deno_runtime v0.11.0
error[E0004]: non-exhaustive patterns: `MaxFilesWatch` not covered
  --> /Users/geordi/.cargo/registry/src/github.com-1ecc6299db9ec823/deno_runtime-0.11.0/errors.rs:75:9
   |
75 |   match error.kind {
   |         ^^^^^^^^^^ pattern `MaxFilesWatch` not covered
   | 
  ::: /Users/geordi/.cargo/registry/src/github.com-1ecc6299db9ec823/notify-5.0.0-pre.7/src/error.rs:34:5
   |
34 |     MaxFilesWatch,
   |     ------------- not covered
   |
   = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
   = note: the matched value is of type `notify::ErrorKind`

error: aborting due to previous error

created time in 5 hours

issue commentdenoland/deno

Native HTTP/2 web server does not work within a WebWorker

@cztomsik Plugins are broken in 1.9 due to the substantial op-layer changes. There are efforts to improve plugins for 1.10, migrating them over to the new ops, access to ResourceTable/OpState, etc...

starkpsmichael

comment created time in 6 hours

issue commentdenoland/deno

Native HTTP/2 web server does not work within a WebWorker

it's here https://github.com/cztomsik/graffiti but I think it's because ABI changed so I will check that first (I copied "headers" to the project so I don't need to depend on rusty_v8 https://github.com/cztomsik/graffiti/blob/30a9aa89f01a3ac121be024feef238c115e92704/libgraffiti/src/bindings/deno.rs#L88)

starkpsmichael

comment created time in 6 hours

pull request commentdenoland/deno

fix(op_crates/fetch): type check Request init

@lucacasonato Really? I had quite the opposite thinking, I believe that it should be easier for you to refactor the internals, knowing that all types passed to the internal code will be receiving the correct types, at least.

But if you disagree, I doubt that this PR will be of much use, considering that a correct implementation of the fetch spec expects all input to be normalised and casted to WebIDL types. Maybe we'd be better off if you just copy & pasted (most of) the converters over, and we close this PR?

CrimsonCodes0

comment created time in 7 hours

issue commentdenoland/deno

deno run --no-check causes stack trace bug

deno eval $code does not emit stack trace item for throw statement itself.

@kdy1 Stack traces show the construction site of the error, so it should point to the new.

node -e $code emits stack proper stack trace

What do you mean by this? Is there a way I can check that behaviour?

ihack2712

comment created time in 9 hours

push eventdenoland/deno

David Sherret

commit sha 0c5ecec8f60d4f1586e56b4e6e36ca973c555830

fix(install): use first `deno` executable on PATH rather than deno.exe (#10247)

view details

push time in 9 hours

PR merged denoland/deno

fix(cli): Windows - `deno install` shim should use first Deno executable on PATH rather than explictly deno.exe

Right now, deno install produces a shim like the following:

% generated by deno install %
@deno.exe "run" "--allow-read" "--allow-write" "--allow-net" "--allow-env" "--allow-run" "--no-check" "https://deno.land/x/deploy/deployctl.ts" %*

This is incorrect because the deno command might not be deno.exe (as is the case on my system where it runs from deno.cmd or deno.ps1 via bvm).

This fix does the following:

  1. It uses the first deno executable on the PATH, so it works the same way as executing the deno command.
  2. It supports more than just a deno.exe executable being on the path.
+1 -1

0 comment

1 changed file

dsherret

pr closed time in 9 hours

issue commentdenoland/deno

deno run --no-check causes stack trace bug

I tried fixing it, but I'm not sure if it's issue of swc. node -e $code emits stack proper stack trace, so it seems like the source map is correct, but deno eval $code does not emit stack trace item for throw statement itself.

Test code is at https://github.com/swc-project/swc/blob/67a853285d7e37204d61aae8e9b130fcf1686e79/tests/source_map.rs

ihack2712

comment created time in 10 hours

fork rtsuk/hf2-rs

Microsoft HF2 HID Flashing Format for UF2 Bootloaders

fork in 10 hours

issue commentdenoland/deno

Native HTTP/2 web server does not work within a WebWorker

I'm getting this with native plugin after last upgrade

Not sure what you mean, please provide reproduction.

starkpsmichael

comment created time in 10 hours

issue commentdenoland/deno

Native HTTP/2 web server does not work within a WebWorker

I'm getting this with native plugin after last upgrade

starkpsmichael

comment created time in 11 hours

PR opened denoland/deno

fix(cli): Windows - `deno install` shim should use first Deno executable on PATH rather than explictly deno.exe

Right now, deno install produces a shim like the following:

% generated by deno install %
@deno.exe "run" "--allow-read" "--allow-write" "--allow-net" "--allow-env" "--allow-run" "--no-check" "https://deno.land/x/deploy/deployctl.ts" %*

This is incorrect because the deno command might not be deno.exe (as is the case on my system where it runs from deno.cmd via bvm).

This fix does the following:

  1. It uses the first deno executable on the PATH, so it works the same way as executing the deno command.
  2. It supports more than just a deno.exe executable being on the path.
+1 -1

0 comment

1 changed file

pr created time in 11 hours

pull request commentdenoland/deno_std

feat(node): Basic support for child_process.spawn

The problem causing the "operation canceled" error has been resolved by 9e38473. However, the canary build seems to be failing... :thinking: :cry:

uki00a

comment created time in 11 hours

Pull request review commentdenoland/deno_std

feat(node): Basic support for child_process.spawn

 nativeModulePolyfill.set(   "constants",   createNativeModule("constants", nodeConstants), );+nativeModulePolyfill.set(+  "child_process",+  createNativeModule("child_process", nodeChildProcess),+);

Done!

uki00a

comment created time in 11 hours

Pull request review commentdenoland/deno

fix(runtime/cli): do not panic on not found cwd

 console.log("finish");     assert!(stderr.contains("BadResource"));   } +  #[cfg(not(windows))]

The bug the PR is fixing doesn't seem to be a bug on windows as per https://github.com/denoland/deno/runs/2373907680?check_suite_focus=true#step:28:2087 hence not running the test on windows.

satyarohith

comment created time in 11 hours

PR opened denoland/deno

build: use split-debuginfo

Stumbled upon in https://jakedeichert.com/blog/reducing-rust-incremental-compilation-times-on-macos-by-70-percent/

It lowers incremental debug build from about 1m10s to 30s on my machine.

+2 -0

0 comment

1 changed file

pr created time in 12 hours

PR opened denoland/deno

bench(url): basic url_ops bench

This PR adds url parsing benches in op_crates/url named url_ops, which allow for scoped & fast iteration on url parsing performance (since the builds take ~30x less time to build than full deno bins).

This does a decent job at showcasing bench_util (#10223) outside of op_baseline and how in ~30 lines you can put together benches to track performance that also generate clean profiles when flamebench'd.

Sample output

test bench_url_parse ... bench:   5,822,207 ns/iter (+/- 231,035)

Note: this follows the same convention of 1000 real iters per bench iter as op_baseline, so just right shift 3 digits when reading these results.

As a sanity check we can see that these benches ~match the output of deno_common:

url_parse:           	n = 50000, dt = 0.290s, r = 172414/s, t = 5799ns/op
+37 -0

0 comment

3 changed files

pr created time in 12 hours

issue openeddenoland/deno

Support for Named Pipes in Deno.connect

Currently, Deno.connect only supports IPC for unix (using unstable transport: "unix"). There should be named pipes support too, which would allow IPC on Windows (as NodeJS' net mode does).

created time in 12 hours

Pull request review commentdenoland/deno

fix(runtime): include HTTP op in WebWorker

+// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.+import { assert, unitTest } from "./test_util.ts";++unitTest(+  { perms: { net: true, read: true } },+  async function nativeHttpWorkerSupport() {+    const w = new Worker(+      new URL(+        "../workers/http_worker.ts",+        import.meta.url,+      ).href,+      {+        type: "module",+        deno: {+          namespace: true,+          permissions: {+            net: true,+          },+        },+      },+    );++    assert(w);+    const response = await fetch("http://localhost");+    assert(await response.text());+    w.terminate();+  },+);

Please move this test to cli/tests/workers/test.ts

satyarohith

comment created time in 12 hours