profile
viewpoint

push eventhayd/deno_docker

Andy Hayden

commit sha ed6f59cac6af84b7eee424304ff5e7a874313fe8

:whale: bump version to 0.6.0

view details

push time in 8 hours

issue commentdenoland/deno_std

[Documentation] Typedoc

Is matching ts version with deno a hard requirement?

zekth

comment created time in 2 days

issue commentdiscordapp/sorted_set_nif

Why not use Vec::split_off?

suggestion on reddit:

pub fn split(&mut self) -> Bucket {
    let at = self.data.len() / 2;
    let mut other = self.data.split_off(at);
    other.reserve_exact(at);
    Bucket { data: other }
}
rokob

comment created time in 3 days

Pull request review commentHomebrew/homebrew-core

deno v0.5.0 (new formula)

 class Deno < Formula-  desc "command-line JavaScript / TypeScript engine"+  desc "Command-line JavaScript / TypeScript engine"   homepage "https://deno.land/"-  url "https://chromium.googlesource.com/chromium/tools/depot_tools.git",-      :revision => "aec259ea62328ce39916607876956239fbce29b8"-  version "0.3.3" # the version of the deno checkout, not a depot_tools version--  # depot_tools/GN require Python 2.7+-  # depends_on "python@2" => :build+  url "https://github.com/denoland/deno.git",+    :tag      => "v0.5.0",+    :revision => "23aca36d52220efbfbc07abbe165bd2c9ade2009" +  depends_on "llvm" => :build+  depends_on "ninja" => :build   depends_on "node" => :build+  depends_on "python@2" => :build # GN require Python 2.7+   depends_on "rust" => :build    # https://bugs.chromium.org/p/chromium/issues/detail?id=620127   depends_on :macos => :el_capitan +  resource "gn" do+    url "https://gn.googlesource.com/gn.git",+      :revision => "64b846c96daeb3eaf08e26d8a84d8451c6cb712b"+  end+   def install-    # Add depot_tools in PATH-    ENV.prepend_path "PATH", buildpath-    # Prevent from updating depot_tools on every call-    # see https://www.chromium.org/developers/how-tos/depottools#TOC-Disabling-auto-update-    ENV["DEPOT_TOOLS_UPDATE"] = "0"-    ENV["CHROMIUM_BUILDTOOLS_PATH"] = buildpath + "/deno/buildtools/"+    # Build gn from source and add it to the PATH+    (buildpath/"gn").install resource("gn")+    cd "gn" do+      system "python", "build/gen.py"+      system "ninja", "-C", "out/", "gn"+    end+    ENV.prepend_path "PATH", buildpath/"gn/out" -    # Initialize and sync gclient-    system "gclient", "root"-    system "gclient", "config", "--spec", <<~EOS-      solutions = [-        {-          "url": "https://github.com/denoland/deno.git",-          "managed": False,-          "name": "deno",-          "custom_deps": {},-        },-      ]-      target_os = [ "mac" ]-      target_os_only = True-      cache_dir = "#{HOMEBREW_CACHE}/gclient_cache"-    EOS+    ENV["DENO_BUILD_MODE"] = "release"+    inreplace "tools/third_party.py" do |s|+      s.gsub! "gn_path = tp(depot_tools_path, \"gn\")", "gn_path = \"#{buildpath}/gn/out/gn\""+      s.gsub! "ninja_path = tp(depot_tools_path, \"ninja\")", "ninja_path = \"#{Formula["ninja"].bin}/ninja\""+    end+    # restore node_modules symlink, which go converted to a copy of the folder by brew (is this a bug?)+    rm_rf "node_modules"+    ln_sf "third_party/node_modules", "node_modules"

Does this mean these lines can go? (since your PR was merged) :)

hayd

comment created time in 3 days

PR opened mvdnes/spin-rs

Remove deprecated ATOMIC_USIZE_INIT and ATOMIC_BOOL_INIT

warning: use of deprecated item 'core::sync::atomic::ATOMIC_USIZE_INIT': the new function is now preferred

+4 -4

0 comment

2 changed files

pr created time in 3 days

create barnchhayd/spin-rs

branch : atomic_inits

created branch time in 3 days

fork hayd/spin-rs

A spinlock for rust

fork in 3 days

delete branch hayd/rustyline

delete branch : patch-1

delete time in 3 days

PR opened kkawakam/rustyline

Replace deprecated ATOMIC_BOOL_INIT

help: use of deprecated item 'std::sync::atomic::ATOMIC_BOOL_INIT': the new function is now preferred

+1 -1

0 comment

1 changed file

pr created time in 3 days

push eventhayd/rustyline

Andy Hayden

commit sha 8825a80f2efbe4bbab4171bb5c8b3dc393688936

Replace deprecated ATOMIC_BOOL_INIT help: use of deprecated item 'std::sync::atomic::ATOMIC_BOOL_INIT': the `new` function is now preferred

view details

push time in 3 days

PR opened alexcrichton/miow

Remove use of deprecated ATOMIC_USIZE_INIT

warning: use of deprecated item 'std::sync::atomic::ATOMIC_USIZE_INIT': the new function is now preferred

+4 -4

0 comment

1 changed file

pr created time in 3 days

push eventhayd/miow

Andy Hayden

commit sha 838163154e0901915137e8a4e2ca56084f304254

Remove use of deprecated ATOMIC_USIZE_INIT warning: use of deprecated item 'std::sync::atomic::ATOMIC_USIZE_INIT': the `new` function is now preferred

view details

push time in 3 days

fork hayd/miow

A zero-overhead Windows I/O library, focusing on IOCP

https://docs.rs/miow/0.1.5/x86_64-pc-windows-msvc/miow/

fork in 3 days

Pull request review commentdenoland/deno

digest function based on webcrypto API

 table RunStatusRes {   exit_signal: int; } +table WebCryptoDigest {+  algorithm: string;+  data: [ubyte];

@ry if we update to the Pinned[Buf] does that alleviate the zero copy concern? (The streaming issue is a slightly larger problem, I'm not sure how to resolve it... can rust access ReadableStreams? what streamable type are you thinking of here?)

keroxp

comment created time in 3 days

issue commentdenoland/deno

Replace YAPF with black

YAPF is probably the worst code formatted in existence...

What's the problem(s) with yapf?

ry

comment created time in 3 days

pull request commentdenoland/deno

Don't print new line if progress bar was not used

additionally I'd like to suggest that ProgressBar.done resets progress bar's state

👍

Do you think this should also be atty only?

bartlomieju

comment created time in 3 days

Pull request review commentHomebrew/homebrew-core

deno v0.5.0 (new formula)

 class Deno < Formula-  desc "command-line JavaScript / TypeScript engine"+  desc "Command-line JavaScript / TypeScript engine"   homepage "https://deno.land/"-  url "https://chromium.googlesource.com/chromium/tools/depot_tools.git",-      :revision => "aec259ea62328ce39916607876956239fbce29b8"-  version "0.3.3" # the version of the deno checkout, not a depot_tools version--  # depot_tools/GN require Python 2.7+-  # depends_on "python@2" => :build+  url "https://github.com/denoland/deno.git",+    :tag      => "v0.5.0",+    :revision => "23aca36d52220efbfbc07abbe165bd2c9ade2009" +  depends_on "llvm" => :build+  depends_on "ninja" => :build   depends_on "node" => :build+  depends_on "python@2" => :build # GN require Python 2.7+   depends_on "rust" => :build    # https://bugs.chromium.org/p/chromium/issues/detail?id=620127   depends_on :macos => :el_capitan +  resource "gn" do+    url "https://gn.googlesource.com/gn.git",+      :revision => "64b846c96daeb3eaf08e26d8a84d8451c6cb712b"+  end+   def install-    # Add depot_tools in PATH-    ENV.prepend_path "PATH", buildpath-    # Prevent from updating depot_tools on every call-    # see https://www.chromium.org/developers/how-tos/depottools#TOC-Disabling-auto-update-    ENV["DEPOT_TOOLS_UPDATE"] = "0"-    ENV["CHROMIUM_BUILDTOOLS_PATH"] = buildpath + "/deno/buildtools/"+    # Build gn from source and add it to the PATH+    (buildpath/"gn").install resource("gn")+    cd "gn" do+      system "python", "build/gen.py"+      system "ninja", "-C", "out/", "gn"+    end+    ENV.prepend_path "PATH", buildpath/"gn/out" -    # Initialize and sync gclient-    system "gclient", "root"-    system "gclient", "config", "--spec", <<~EOS-      solutions = [-        {-          "url": "https://github.com/denoland/deno.git",-          "managed": False,-          "name": "deno",-          "custom_deps": {},-        },-      ]-      target_os = [ "mac" ]-      target_os_only = True-      cache_dir = "#{HOMEBREW_CACHE}/gclient_cache"-    EOS+    ENV["DENO_BUILD_MODE"] = "release"+    inreplace "tools/third_party.py" do |s|+      s.gsub! "gn_path = tp(depot_tools_path, \"gn\")", "gn_path = \"#{buildpath}/gn/out/gn\""+      s.gsub! "ninja_path = tp(depot_tools_path, \"ninja\")", "ninja_path = \"#{Formula["ninja"].bin}/ninja\""+    end+    # restore node_modules symlink, which go converted to a copy of the folder by brew (is this a bug?)+    rm_rf "node_modules"+    ln_sf "third_party/node_modules", "node_modules"

Hmmm, I wonder why there's no jenkins CI build on your last commit.

hayd

comment created time in 4 days

Pull request review commentHomebrew/homebrew-core

deno v0.5.0 (new formula)

+class Deno < Formula+  desc "command-line JavaScript / TypeScript engine"+  homepage "https://deno.land/"+  url "https://chromium.googlesource.com/chromium/tools/depot_tools.git",+      :revision => "aec259ea62328ce39916607876956239fbce29b8"+  version "0.3.3" # the version of the deno checkout, not a depot_tools version++  # depot_tools/GN require Python 2.7++  # depends_on "python@2" => :build++  depends_on "node" => :build+  depends_on "rust" => :build++  # https://bugs.chromium.org/p/chromium/issues/detail?id=620127+  depends_on :macos => :el_capitan++  def install+    # Add depot_tools in PATH+    ENV.prepend_path "PATH", buildpath

Previously symlinks needed, see commit, to be removed before anything else (a bug I couldn't recreate locally, only on jenkins... seemingly the git clone of the symlinks screws up) i.e. try the rm before running gn etc. ?

hayd

comment created time in 4 days

Pull request review commentHomebrew/homebrew-core

deno v0.5.0 (new formula)

+class Deno < Formula+  desc "command-line JavaScript / TypeScript engine"+  homepage "https://deno.land/"+  url "https://chromium.googlesource.com/chromium/tools/depot_tools.git",+      :revision => "aec259ea62328ce39916607876956239fbce29b8"+  version "0.3.3" # the version of the deno checkout, not a depot_tools version++  # depot_tools/GN require Python 2.7++  # depends_on "python@2" => :build++  depends_on "node" => :build+  depends_on "rust" => :build++  # https://bugs.chromium.org/p/chromium/issues/detail?id=620127+  depends_on :macos => :el_capitan++  def install+    # Add depot_tools in PATH+    ENV.prepend_path "PATH", buildpath

Maybe the symlink isn't working correctly?

I remember this was an issue in this commit https://github.com/Homebrew/homebrew-core/pull/35645/commits/548d280656b246b5169bff27692e16c999f8e778 (perhaps it's still unresolved, or this rm was moved to a python file that's no longer called?)

hayd

comment created time in 4 days

Pull request review commentHomebrew/homebrew-core

deno v0.5.0 (new formula)

+class Deno < Formula+  desc "command-line JavaScript / TypeScript engine"+  homepage "https://deno.land/"+  url "https://chromium.googlesource.com/chromium/tools/depot_tools.git",+      :revision => "aec259ea62328ce39916607876956239fbce29b8"+  version "0.3.3" # the version of the deno checkout, not a depot_tools version++  # depot_tools/GN require Python 2.7++  # depends_on "python@2" => :build++  depends_on "node" => :build+  depends_on "rust" => :build++  # https://bugs.chromium.org/p/chromium/issues/detail?id=620127+  depends_on :macos => :el_capitan++  def install+    # Add depot_tools in PATH+    ENV.prepend_path "PATH", buildpath

Wow, well done! Yeah, this definitely feels weird.

hayd

comment created time in 4 days

Pull request review commentHomebrew/homebrew-core

deno v0.3.0 (new formula)

+class Deno < Formula+  desc "command-line JavaScript / TypeScript engine"+  homepage "https://deno.land/"+  url "https://chromium.googlesource.com/chromium/tools/depot_tools.git",+      :revision => "aec259ea62328ce39916607876956239fbce29b8"+  version "0.3.3" # the version of the deno checkout, not a depot_tools version++  # depot_tools/GN require Python 2.7++  # depends_on "python@2" => :build++  depends_on "node" => :build+  depends_on "rust" => :build++  # https://bugs.chromium.org/p/chromium/issues/detail?id=620127+  depends_on :macos => :el_capitan++  def install+    # Add depot_tools in PATH+    ENV.prepend_path "PATH", buildpath

ry suggested on gitter it could be that node_modules isn't symlinked to third_party/node_modules. This is one of the things that setup.py/build.py does this I think (but can't see where).

In early versions of this formula I remember having to do strange things with that. https://github.com/Homebrew/homebrew-core/pull/35645/commits/267aadb894ff384e206c6236b307d7b430d0d596

hayd

comment created time in 4 days

issue commentdenoland/deno

WASM Support

It'd be great to have a working documented example like this for deno: https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm

kevinkassimo

comment created time in 5 days

MemberEvent

issue commentdenoland/deno_std

import https://github.com/lucascaro/deno-uuid into deno_std

Is the deno one based on this gist? https://gist.github.com/jed/982883#gistcomment-2661313

ry

comment created time in 6 days

Pull request review commentHomebrew/homebrew-core

deno v0.3.0 (new formula)

+class Deno < Formula+  desc "command-line JavaScript / TypeScript engine"+  homepage "https://deno.land/"+  url "https://chromium.googlesource.com/chromium/tools/depot_tools.git",+      :revision => "aec259ea62328ce39916607876956239fbce29b8"+  version "0.3.3" # the version of the deno checkout, not a depot_tools version++  # depot_tools/GN require Python 2.7++  # depends_on "python@2" => :build++  depends_on "node" => :build+  depends_on "rust" => :build++  # https://bugs.chromium.org/p/chromium/issues/detail?id=620127+  depends_on :macos => :el_capitan++  def install+    # Add depot_tools in PATH+    ENV.prepend_path "PATH", buildpath

@chrmoritz you should be able to push to this branch now. Please can you try with deno 0.5.0 and we'll see if we can debug?

hayd

comment created time in 6 days

pull request commentHomebrew/homebrew-core

deno v0.3.0 (new formula)

@chrmoritz There's now a --no-binary-download for build.py, does that help?

hayd

comment created time in 7 days

issue commentdenoland/deno

deno v0.5.0 prints additional new line

One difference with ninja is: ninja does the build, and the build only. Deno is building and then executing. I think it's quite surprising to not have idempotence here* (running deno run foo.ts outputs the compile output the first time, the second time it doesn't)... that said perhaps we're doing the same as rustc (what does cargo run do)?

*This has always been the case for deno.

MarkTiedemann

comment created time in 7 days

pull request commentdenoland/deno

Add validate to Deno.read(), Deno.write()

This is similar to runtime checks in all Deno functions (I think this has come up before), the complaint is not runtime performance but code overhead of doing this around every function.

Rust-side should not be panicing... no matter what. That's why I think it must be fixed on the rust-side, by removing these unwraps, that way the ts-check will be redundant.

I also appreciate the PR, sorry if my comment came across as dismissive (it wasn't the intention).

rusty-cat-life

comment created time in 7 days

issue commentdenoland/deno

deno v0.5.0 prints additional new line

I wonder if should be three things here:

  • No progress "bar" if not atty.
  • scrub the last line [n/n], which would also fix the above (no need for the final eprintln!).
  • verbose option to show every line (-D?)

cc @ry

MarkTiedemann

comment created time in 7 days

issue commentdenoland/deno_install

Install via npm

So, the sage continues, @YounGoat refuses to cede ownership:

The request is not only about adding @ry as owner, but also about changing the usage of the deno package as I am used to. As you can see in the issue, I have expressed my opinion. However, I have made clear explanation in README.md of latest version, and added link to the semi-official package get-deno. And, I also agree to implement npx deno in future version if possible. But I DO NOT AGREE TO GIVE UP THE OWNERSHIP OF THE deno PACKAGE.

MarkTiedemann

comment created time in 8 days

issue closedhayd/deno_docker

Doesn't work anymore

Compiling file:///app/main.ts
Downloading https://deno.land/std/net/http.ts
thread 'tokio-runtime-worker-1' panicked at 'assertion failed: result.is_some()', ../../cli/compiler.rs:145:3
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Uncaught NotFound: Cannot resolve module "https://deno.land/std/net/http.ts" from "/app/main.ts"
    at DenoError (deno/js/errors.ts:22:5)
    at maybeError (deno/js/errors.ts:33:12)
    at maybeThrowError (deno/js/errors.ts:39:15)
    at sendSync (deno/js/dispatch.ts:82:5)
    at fetchModuleMetaData (deno/js/os.ts:75:19)
    at _resolveModule (deno/js/compiler.ts:249:38)
    at resolveModuleNames (deno/js/compiler.ts:479:35)
    at compilerHost.resolveModuleNames (deno/third_party/node_modules/typescript/lib/typescript.js:118650:138)
    at resolveModuleNamesWorker (deno/third_party/node_modules/typescript/lib/typescript.js:86767:127)
    at resolveModuleNamesReusingOldState (deno/third_party/node_modules/typescript/lib/typescript.js:87001:24)thread '
tokio-runtime-worker-0' panicked at 'called `Result::unwrap()` on an `Err` value: Canceled', src/libcore/result.rs:997:5

closed time in 9 days

asyncanup

pull request commentdenoland/deno

Add validate to Deno.read(), Deno.write()

This should be addressed in rust.

rusty-cat-life

comment created time in 9 days

issue commentdenoland/deno

option to import default .ts file

What do you mean by "default"?

Deno will always require imports include their file extension (if the file has a file extension).

lab4quant

comment created time in 11 days

issue commentdenoland/deno_std

Wrong normalization of unix-style paths

@zhmushan why does /// become / ?

Nautigsam

comment created time in 11 days

pull request commentdenoland/deno_std

Use performance.now in benching module

Bump!

sh7dm

comment created time in 11 days

issue commentdenoland/deno

Add "deno runa" as an alias to "deno run -A"

ry: we need better security, let's require explicit permissions for js programs. also ry: runs everything with -A.

😂

ry

comment created time in 11 days

issue commentdenoland/deno

Providing a CSPRNG

https://medium.com/@betable/tifu-by-using-math-random-f1c308c4fd9d

chiefbiiko

comment created time in 11 days

Pull request review commentdenoland/deno

Permissions whitelist

 impl DenoPermissions {   pub fn check_read(&self, filename: &str) -> DenoResult<()> {     match self.allow_read.get_state() {       PermissionAccessorState::Allow => Ok(()),-      PermissionAccessorState::Ask => match self-        .try_permissions_prompt(&format!("read access to \"{}\"", filename))-      {-        Err(e) => Err(e),-        Ok(v) => {-          self.allow_read.update_with_prompt_result(&v);-          v.check()?;+      state => {+        if check_path_white_list(filename, &self.read_whitelist) {           Ok(())+        } else {+          match state {+            // This shouldn't be possible but I guess rust doesn't realize.+            PermissionAccessorState::Allow => unreachable!(),+            PermissionAccessorState::Ask => match self.try_permissions_prompt(+              &format!("read access to \"{}\"", filename),+            ) {+              Err(e) => Err(e),+              Ok(v) => {+                self.allow_read.update_with_prompt_result(&v);+                v.check()?;+                Ok(())+              }+            },+            PermissionAccessorState::Deny => Err(permission_denied()),+          }         }-      },-      PermissionAccessorState::Deny => Err(permission_denied()),+      }     }   }    pub fn check_write(&self, filename: &str) -> DenoResult<()> {     match self.allow_write.get_state() {       PermissionAccessorState::Allow => Ok(()),-      PermissionAccessorState::Ask => match self-        .try_permissions_prompt(&format!("write access to \"{}\"", filename))-      {-        Err(e) => Err(e),-        Ok(v) => {-          self.allow_write.update_with_prompt_result(&v);-          v.check()?;+      state => {+        if check_path_white_list(filename, &self.write_whitelist) {           Ok(())+        } else {+          match state {+            // This shouldn't be possible but I guess rust doesn't realize.+            PermissionAccessorState::Allow => unreachable!(),+            PermissionAccessorState::Ask => match self.try_permissions_prompt(+              &format!("write access to \"{}\"", filename),+            ) {+              Err(e) => Err(e),+              Ok(v) => {+                self.allow_write.update_with_prompt_result(&v);+                v.check()?;+                Ok(())+              }+            },+            PermissionAccessorState::Deny => Err(permission_denied()),+          }         }-      },-      PermissionAccessorState::Deny => Err(permission_denied()),+      }     }   } -  pub fn check_net(&self, domain_name: &str) -> DenoResult<()> {+  pub fn check_net(&self, url_str: &str) -> DenoResult<()> {

Thinking about it host+port is probably sufficient for requests, I was confusing this with imports which is less relevant here.

afinch7

comment created time in 12 days

Pull request review commentdenoland/deno

chore: Refactor unit tests

+#!/usr/bin/env deno run --reload --allow-run+// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.+import "./unit_tests.ts";+import { permissionCombinations, parseUnitTestOutput } from "./test_util.ts";++function permsToCliFlags(perms: Deno.Permissions): string[] {+  return Object.keys(perms)+    .map(+      (key): string => {+        if (!perms[key]) return "";++        const cliFlag = key.replace(+          /\.?([A-Z])/g,+          (x, y): string => `-${y.toLowerCase()}`+        );+        return `--allow-${cliFlag}`;+      }+    )+    .filter((e): boolean => e.length > 0);+}++function fmtPerms(perms: Deno.Permissions): string {+  let fmt = permsToCliFlags(perms).join(" ");++  if (!fmt) {+    fmt = "<no permissions>";+  }++  return fmt;+}++async function main(): Promise<void> {+  console.log(+    "Discovered permission combinations for tests:",+    permissionCombinations.size+  );++  for (const perms of permissionCombinations.values()) {+    console.log("\t" + fmtPerms(perms));+  }++  const testResults = new Set();++  for (const perms of permissionCombinations.values()) {+    const permsFmt = fmtPerms(perms);+    console.log(`Running tests for: ${permsFmt}`);+    const cliPerms = permsToCliFlags(perms);+    // run subsequent tests using same deno executable+    const args = [+      Deno.execPath,+      "run",+      "--no-prompt",+      ...cliPerms,+      "js/unit_tests.ts"+    ];++    const p = Deno.run({+      args,+      stdout: "piped"+    });++    await p.status();

@zekth Can you create an issue/test case for the Deno.run error? (assuming it's a bug!)

bartlomieju

comment created time in 12 days

issue commentdenoland/deno

Rename xeval?

I propose eval-lines, I know this doen't relay alternative delimiters but seems a lot clearer. Otherwise eval-each would also be good: more explicit than each.

ry

comment created time in 12 days

issue commenthayd/deno_docker

Doesn't work anymore

I also updated the run entry points and tested the Dockerfile in /examples which seems to work now (after a couple of edits). Apologies for not keeping that up to date!

@asyncanup that is the issue above (although the error is a little gnarly), https://deno.land/std/net/http.ts is now/should be https://deno.land/std/http/server.ts.

asyncanup

comment created time in 12 days

push eventhayd/deno_docker

Andy Hayden

commit sha 7caef27dfc7a23eac49dd708c3c2c7c6e4e0c589

Use deno_std http server endpoint and deno run in entrypoint

view details

Andy Hayden

commit sha a8f404420e79fc8c923428026234d233a1b01de5

Use deno run subcommand in entrypoints

view details

push time in 12 days

Pull request review commentdenoland/deno

Permissions whitelist

 impl DenoPermissions {   pub fn check_read(&self, filename: &str) -> DenoResult<()> {     match self.allow_read.get_state() {       PermissionAccessorState::Allow => Ok(()),-      PermissionAccessorState::Ask => match self-        .try_permissions_prompt(&format!("read access to \"{}\"", filename))-      {-        Err(e) => Err(e),-        Ok(v) => {-          self.allow_read.update_with_prompt_result(&v);-          v.check()?;+      state => {+        if check_path_white_list(filename, &self.read_whitelist) {           Ok(())+        } else {+          match state {+            // This shouldn't be possible but I guess rust doesn't realize.+            PermissionAccessorState::Allow => unreachable!(),+            PermissionAccessorState::Ask => match self.try_permissions_prompt(+              &format!("read access to \"{}\"", filename),+            ) {+              Err(e) => Err(e),+              Ok(v) => {+                self.allow_read.update_with_prompt_result(&v);+                v.check()?;+                Ok(())+              }+            },+            PermissionAccessorState::Deny => Err(permission_denied()),+          }         }-      },-      PermissionAccessorState::Deny => Err(permission_denied()),+      }     }   }    pub fn check_write(&self, filename: &str) -> DenoResult<()> {     match self.allow_write.get_state() {       PermissionAccessorState::Allow => Ok(()),-      PermissionAccessorState::Ask => match self-        .try_permissions_prompt(&format!("write access to \"{}\"", filename))-      {-        Err(e) => Err(e),-        Ok(v) => {-          self.allow_write.update_with_prompt_result(&v);-          v.check()?;+      state => {+        if check_path_white_list(filename, &self.write_whitelist) {           Ok(())+        } else {+          match state {+            // This shouldn't be possible but I guess rust doesn't realize.+            PermissionAccessorState::Allow => unreachable!(),+            PermissionAccessorState::Ask => match self.try_permissions_prompt(+              &format!("write access to \"{}\"", filename),+            ) {+              Err(e) => Err(e),+              Ok(v) => {+                self.allow_write.update_with_prompt_result(&v);+                v.check()?;+                Ok(())+              }+            },+            PermissionAccessorState::Deny => Err(permission_denied()),+          }         }-      },-      PermissionAccessorState::Deny => Err(permission_denied()),+      }     }   } -  pub fn check_net(&self, domain_name: &str) -> DenoResult<()> {+  pub fn check_net(&self, url_str: &str) -> DenoResult<()> {

One reason url might be useful is restricting libs, e.g. deno.land/std or deno.land/x/oak (rather than everything in the registry deno.land/x/).

afinch7

comment created time in 12 days

issue commentdenoland/deno

Confusing FileInfo interface

Unfortunately I think this logic needs to be moved to something in std. I don't really understand @ry's decision as I think it's useful, trivial and without perf impact, but looks like this convenience needs to be wrapped around every fs function in std (with a FileInfo type defined there which includes both path/name fields). 🙄

bartlomieju

comment created time in 12 days

push eventhayd/deno_docker

Andy Hayden

commit sha 0b32a2b4408373b0b421618734a71a91826c3cb6

:whale: bump version to 0.4.0

view details

push time in 13 days

issue commenthayd/deno_docker

Doesn't work anymore

@asyncanup 0.4 should be available now, which hopefully will fix?

asyncanup

comment created time in 13 days

issue commentdenoland/deno

Wanted: A simple TS/JS code formatter using the TS compiler

@JLarky This could be supported in deno_std, even if not with deno fmt.

ry

comment created time in 14 days

issue commentdenoland/deno

Discussion: CLI cache clean commands

clear > clean.

kevinkassimo

comment created time in 14 days

issue commentdenoland/deno

Centos 7 GLIBC_2.18 not found

Having a binary without glic requirement should allow deploying an aws lambda function. Awesome! I'll have a play with this later in the week.

Maxim-Mazurok

comment created time in 16 days

pull request commentdenoland/deno

digest function based on webcrypto API

I think this will be a good approach to add in the future (preferable to algos in ts) using new ops.

keroxp

comment created time in 16 days

issue commentdenoland/deno

Centos 7 GLIBC_2.18 not found

Do you have to install glibc-static package? https://forums.aws.amazon.com/thread.jspa?threadID=271828

For AWS Lambda I wonder if it's possible to include this binary in the bundle?

Maxim-Mazurok

comment created time in 16 days

Pull request review commentdenoland/deno_std

Added strings/wordCount

+// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
+
+const cleanString = (input: string): string =>
+  input.trim().replace(/\s+/g, " ");
+
+/** Helper to count words in a given string */
+export function wordCount(input: string): number {
+  if (input.length == 0) return 0;
+
+  const cleanedInput = cleanString(input);
+
+  return cleanedInput.split(" ").length;

Does (input.trim().match(/\s+/g) || []).length also work here? (Not sure which performs better.)

dshubhadeep

comment created time in 16 days

Pull request review commentdenoland/deno

feat(cli cmd): deno xeval

 Prettier dependencies on first run.             .multiple(true)             .required(true),         ),+    ).subcommand(+      SubCommand::with_name("xeval")+        .setting(AppSettings::DisableVersion)+        .about("Eval a script on text segments from stdin")+        .long_about(+          "+Eval a script on lines (or chunks split under delimiter) from stdin.++Read from standard input and eval code on each whitespace-delimited+string chunks.++-I/--replvar optionally set variable name for input to be used in eval.+Otherwise '$' will be used as default variable name.++  cat /etc/passwd | deno xeval \"a = $.split(':'); if (a) console.log(a[0])\"+  git branch | deno xeval -I 'line' \"if (line.startsWith('*')) console.log(line.slice(2))\"+  cat LICENSE | deno xeval -d ' ' \"if ($ === 'MIT') console.log('MIT licensed')\"+",+        ).arg(+          Arg::with_name("replvar")+            .long("replvar")+            .short("I")+            .help("Set variable name to be used in eval, defaults to $")+            .takes_value(true),+        ).arg(+          Arg::with_name("delim")+            .long("delim")+            .short("d")+            .help("Set delimiter, defaults to newline")

Is it newline or whitespace? The subcommand help says "whitespace-delimited".

(IMO line sep seems more useful as a default... but okay.)

kevinkassimo

comment created time in 16 days

pull request commentdenoland/deno

Permissions whitelist

@bartlomieju I think blacklist should be a follow up (personally I prefer using whitelists). --no-net or --deny-net seem okay, --no is more consistent with other args but semantically it's a little clunky.

afinch7

comment created time in 16 days

issue commentdenoland/deno

Restart server automatically when making changes

After #1826 this can be added to the webserver / can write a nodemon-like deno application.

LaurenceM10

comment created time in 17 days

pull request commentdenoland/deno

feat(cli cmd): deno xeval

eval-lines seems more explicit, has the benefit of sitting next to eval in help/tab-completion.

👍 to _ assuming line is too verbose 😄

kevinkassimo

comment created time in 17 days

pull request commentdenoland/deno

Rewrite flags.rs::parse_flags

You're right, case for --version isn't compelling.

But --help is something people are likely to do on the binary, so imo would be good if it showed a reasonable message. Maybe it already does, apologies for the noise if so!

bartlomieju

comment created time in 22 days

pull request commentdenoland/deno

Rewrite flags.rs::parse_flags

I wonder if --help and --version could be supported behind a Hidden flag (so they don't appear in the help message but still work as you'd expect).

bartlomieju

comment created time in 22 days

issue commentdenoland/deno

Discussion : Warnings on imports

Perhaps this could be in a linter be rather than compiler warning?

When there is dependencies as json you could recursively loop through every dep url and assert it's a tagged url.

zekth

comment created time in 23 days

issue commentdenoland/deno_install

Install via npm

Maybe, but it would be much much better if this was under ry's controller rather than someone else.

@YounGoat What about calling yours require("deno-api") ?

MarkTiedemann

comment created time in 23 days

Pull request review commentdenoland/deno

[WIP] permissions whitelist

 pub fn parse_flags(matches: ArgMatches) -> DenoFlags {   if matches.is_present("allow-read") {     flags.allow_read = true;   }+  if let Some(read_wl) = matches.values_of("read-wl") {+    flags.read_whitelist = read_wl.map(|s| s.to_string()).collect();+  }   if matches.is_present("allow-write") {     flags.allow_write = true;   }+  if let Some(write_wl) = matches.values_of("write-wl") {+    flags.write_whitelist = write_wl.map(|s| s.to_string()).collect();+  }   if matches.is_present("allow-net") {     flags.allow_net = true;   }+  if let Some(net_wl) = matches.values_of("net-wl") {

--no-net could also work for blacklisting (consistent with other flags e.g. --no-prompt) ie. --no-net=facebook.com and --no-read=/etc/passwd

afinch7

comment created time in 25 days

issue commentdenoland/deno

Rename "deno prefetch" to "deno fetch"

What about "compile" instead? (Since this is both a fetch and compile...)

ry

comment created time in 25 days

Pull request review commentdenoland/deno

[WIP] permissions whitelist

 pub fn parse_flags(matches: ArgMatches) -> DenoFlags {   if matches.is_present("allow-read") {     flags.allow_read = true;   }+  if let Some(read_wl) = matches.values_of("read-wl") {+    flags.read_whitelist = read_wl.map(|s| s.to_string()).collect();+  }   if matches.is_present("allow-write") {     flags.allow_write = true;   }+  if let Some(write_wl) = matches.values_of("write-wl") {+    flags.write_whitelist = write_wl.map(|s| s.to_string()).collect();+  }   if matches.is_present("allow-net") {     flags.allow_net = true;   }+  if let Some(net_wl) = matches.values_of("net-wl") {

Semantically using - under --allow-net to signify blacklist is a bit of a stretch. Also imo one char difference is too small.

Another flag for --reject-net or something?

afinch7

comment created time in a month

Pull request review commentdenoland/deno

[WIP] permissions whitelist

 pub fn parse_flags(matches: ArgMatches) -> DenoFlags {   if matches.is_present("allow-read") {     flags.allow_read = true;   }+  if let Some(read_wl) = matches.values_of("read-wl") {+    flags.read_whitelist = read_wl.map(|s| s.to_string()).collect();+  }   if matches.is_present("allow-write") {     flags.allow_write = true;   }+  if let Some(write_wl) = matches.values_of("write-wl") {+    flags.write_whitelist = write_wl.map(|s| s.to_string()).collect();+  }   if matches.is_present("allow-net") {     flags.allow_net = true;   }+  if let Some(net_wl) = matches.values_of("net-wl") {

Naming wise why not reuse the original, so that --allow-net is equivalent to --allow-net=*.

afinch7

comment created time in a month

issue commentpandas-dev/pandas

columns comparison with Enum column name triggers TypeError

Same issue: https://stackoverflow.com/q/55822555/1240268

s-wakaba

comment created time in a month

issue commentdenoland/deno

Add run subcommand: "deno run script.ts" instead of "deno script.ts"

Should repl also be a subcommand?

ry

comment created time in a month

pull request commentHomebrew/homebrew-core

deno v0.3.0 (new formula)

This is WIP. @ry is still working on this.

hayd

comment created time in a month

issue commentdenoland/deno_std

BigInt's

Is this available in v8?

cc @kevinkassimo

nivida

comment created time in a month

issue commentbartlomieju/deno-postgres

LISTEN/NOTIFY support

@ddibiase yes please!

ddibiase

comment created time in a month

Pull request review commentbartlomieju/deno-postgres

bump Deno to v0.3.8

 import { parse } from "https://deno.land/x/flags/mod.ts"; const { exit, args, run } = Deno;  async function main(opts) {-  const args = ["deno", "--allow-run", "--fmt", "--ignore", "lib"];+  const args = ["deno", "fmt", "--", "--ignore", "lib"];

Is the -- needed? (Is this a deno bug?)

bartlomieju

comment created time in a month

issue commentdenoland/deno

Refactor stringified Perm from unit test

what about (instead of unix file permissions style) you use no-perms vs perms-rw perms-ne etc. I find the current scheme very hard to read; most of the time you can about what permission is present not what permission is not present, hence perms-rw over perms_R1W1N0E0H0. perms-RWneh is also an alternative but probably too cute.

This is minor to the main refactoring issue.

zekth

comment created time in a month

issue commentdenoland/deno

Deno hangs in repl osx

Is that an example which hangs?

cllty

comment created time in a month

pull request commentdenoland/deno

[WIP] permissions whitelist

Is it possible to reuse --allow-net etc for this? To optionally pass args. Maybe using min_values(0)? https://github.com/clap-rs/clap/issues/892

I think that's a cleaner API ... and benefits from no additional flags.

afinch7

comment created time in a month

issue commentdenoland/deno_install

Install via npm

I sent an email to @YounGoat and cc'd support@npm following https://www.npmjs.com/policies/disputes, hopefully they will transfer to @ry one way or the other. 🤞

MarkTiedemann

comment created time in a month

issue commentdenoland/deno_install

Install via npm

cc @youngoat

MarkTiedemann

comment created time in a month

issue commentdenoland/deno_install

Install via npm

The deno package name is squatted? https://www.npmjs.com/package/deno

👍 If it allowed deno foo.ts and deno@0.3.7 foo.ts that'd be really nice.

MarkTiedemann

comment created time in a month

pull request commentdenoland/deno

Improve error when running listen with not enough args

IMO This should be on all ops or no ops. Doing this just for listen is bizarre.

Typescript catches this so my personal preference is to suggest use of typescript unless there is an easy and low-burden method to wrap. Perhaps we could add a deno-std wrapper for deno functions with JavaScript runtime type safety, though unclear how much of a development burden (for little payoff).

sh7dm

comment created time in a month

pull request commentHomebrew/homebrew-core

Add formula for gn

@mikemcquaid

Otherwise please suggest a course of action.

This is required for deno and seemingly required for v8 too (if it wasn't to use a fetched binary). What is the way forward here?

ry

comment created time in a month

issue commentdenoland/deno

expose more globals

It would be a long list but I imagine the vast majority will be labelled "intentionally omitted"!

JamesKyburz

comment created time in a month

issue commentdenoland/deno

expose more globals

Is there a way to generate a list of globals in chrome/Firefox/deno? That way could enumerate what is intentionally omitted vs what is awaiting implementation.

This would also be nice as documentation...

JamesKyburz

comment created time in a month

Pull request review commentdenoland/deno

Add Deno.core.setGCObserver() for callbacks invoked on GC

 declare interface DenoCore {   evalContext(code: string): [any, EvalErrorInfo | null];    errorToJSON: (e: Error) => string;++  // eslint-disable-next-line @typescript-eslint/no-explicit-any+  setGCObserver: <T>(o: T, callback: (o: T) => void) => T;

Does explicit gc ensure it calls? Ry's doc/comment suggests there's an "if" here too.

I like the idea of an explicit gc call prior to exit.

kevinkassimo

comment created time in a month

Pull request review commentdenoland/deno

Add Deno.core.setGCObserver() for callbacks invoked on GC

 declare interface DenoCore {   evalContext(code: string): [any, EvalErrorInfo | null];    errorToJSON: (e: Error) => string;++  // eslint-disable-next-line @typescript-eslint/no-explicit-any+  setGCObserver: <T>(o: T, callback: (o: T) => void) => T;

Is it really so bad? Is it guaranteed to execute prior to the program exiting? What then should / can this be used for?

kevinkassimo

comment created time in a month

issue commentdenoland/deno

deno eval

The other issue with the json is does write access (to that file) imply permissions could be increased on subsequent executions. So would you need to write protect it somehow (I guess you could have a blacklist of write access as well as a whitelist).

Is there a standard within CSP?

Kevin had a good solution for 1. having run as (the default) subcommand, that way you can use deno run eval if you need to disambiguate (run a file named eval). Alternatively perhaps you'd use ./eval ?

ry

comment created time in a month

pull request commentdenoland/deno

Add deno eval command

@bartlomieju you could also have --help and --version as hidden args, so they work as expected but aren't in the help text.

bartlomieju

comment created time in a month

pull request commentdenoland/deno

Add Deno.core.setGCObserver() for callbacks invoked on GC

Is IIFE required and not scope just for tests/the gc call or something fundamental? What happens if you do something silly inside the callback like push c back into an array/somewhere live?

Perhaps this could be called onDrop 😬

kevinkassimo

comment created time in a month

pull request commentdenoland/deno

Add deno eval command

As an aside should --types and --prefetch also be subcommands? (Perhaps prefetch could be "compile"...)

bartlomieju

comment created time in a month

Pull request review commentdenoland/deno

Add Deno.lines

 export function toAsyncIterator(r: Reader): AsyncIterableIterator<Uint8Array> {     }   }; }++/** Read lines asynchronously from `r`.+ *+ *      for await (const line of Deno.lines(reader)) {+ *          console.log(line);+ *      }+ */+export async function* lines(r: Reader): AsyncIterableIterator<string> {+  const decoder = new TextDecoder();+  let scratch = "";++  for await (const chunk of toAsyncIterator(r)) {+    scratch += decoder.decode(chunk);++    let newLineIndex = scratch.indexOf("\n");++    if (newLineIndex > -1) {+      const line = scratch.slice(0, newLineIndex);+      scratch = scratch.slice(newLineIndex + 1);+      yield line;

doesn't only one yield per chunk mean scratch could grow linearly? I think this newLineIndex/yield should be in a while loop.

bartlomieju

comment created time in a month

Pull request review commentdenoland/deno

fix: expose File

 import "./event_target_test.ts"; import "./fetch_test.ts"; // TODO The global "File" has been temporarily disabled. See the note in

This comment is stale :)

kt3k

comment created time in a month

issue commentdenoland/deno

Discussion: using BigInt for certain fs related values

AtomicU64 is stabilized in rust 1.34, so should be able to define AtomicSafeInteger too. (So is try_from.)

kevinkassimo

comment created time in a month

pull request commentdenoland/deno

[WIP] Add support for loading tsconfig.json

+     actual_out = actual_out.replace(os.path.sep, '/')

above or before here, should fix, but might be overkill...

kitsonk

comment created time in a month

issue commentdenoland/deno

Deno.listen(":8000") gives an indecipherable error message

The issue is that it applies to every op. I think that was @kitsonk 's perf concern, also this is going to potentially be a lot of boilerplate code wrapping every op.

ry

comment created time in a month

issue commentdenoland/deno_install

TLS 1.0 support

I believe (3) is a CloudFront setting https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValues-security-policy

but (1) also seems fine.

MarkTiedemann

comment created time in a month

pull request commentdenoland/deno

Add path and name to FileInfo from stat and lstat

Maybe also helps with https://github.com/denoland/deno_std/pull/329

hayd

comment created time in a month

issue commentdenoland/deno

Discussion: using BigInt for certain fs related values

If we use i64/u64 and Number, but assert < Number.MAX_SAFE_INTEGER would that suffice? This could be coerced prior to sending via the new core dispatcher (e.g. a SafeInteger type in rust).

kevinkassimo

comment created time in a month

Pull request review commentdenoland/deno

Merge Worker and Isolate types

 mod tests {     })   } -  /*   #[test]   fn removed_from_resource_table_on_close() {     tokio_util::init(|| {-      let worker = create_test_worker();+      let mut worker = create_test_worker();+      js_check(worker.execute("onmessage = () => close();"));

Note: This (or one of these) errors even though the tests pass:

onmessage = () => close();
                  ^
Uncaught ReferenceError: close is not defined
    at onmessage (<anonymous>:1:19)
ry

comment created time in a month

push eventhayd/deno-using

Andy Hayden

commit sha 0adeacc073656bddd2655099645b43657579f7f0

Support deno 0.3+ only

view details

push time in a month

Pull request review commentdenoland/deno

High precision flag

 def run_unit_test(deno_exe, permStr, flags=None): # tests by the special string. permW0N0 means allow-write but not allow-net. # See js/test_util.ts for more details. def unit_tests(deno_exe):-    run_unit_test(deno_exe, "permR0W0N0E0U0", ["--reload"])-    run_unit_test(deno_exe, "permR1W0N0E0U0", ["--allow-read"])-    run_unit_test(deno_exe, "permR0W1N0E0U0", ["--allow-write"])-    run_unit_test(deno_exe, "permR1W1N0E0U0",+    run_unit_test(deno_exe, "permR0W0N0E0U0H0", ["--reload"])+    run_unit_test(deno_exe, "permR1W0N0E0U0H0", ["--allow-read"])

As an aside (for another time), I feel like r----- rw---- etc would be a little clearer/more concise here.

zekth

comment created time in a month

pull request commentdenoland/deno

High precision flag

I think benchmarking is the main usecase. Sometimes it's difficult to run with repeats esp. if you're hitting cached IO where the second hit is much faster than the first. It can be useful to accurately time each request or specific function calls to assess where bottlenecks are. In general you don't want this on, but when testing perf you do.

zekth

comment created time in a month

issue openedfrewsxcv/rust-notifica

optionally specify an image

I'm not sure what a cross platform API could look like for this.

it could be an enum rather than arbitrary images...

created time in a month

Pull request review commentdenoland/deno

Testing a tokio hack

 impl<B: Behavior> Future for Isolate<B> {        let mut overflow_response: Option<Buf> = None; +      let start_index = thread_rng().gen::<usize>() % self.pending_ops.len();

I think you can use https://docs.rs/rand/*/rand/trait.Rng.html#method.gen_range here (may be slightly more efficient)

piscisaureus

comment created time in a month

more