profile
viewpoint

issue commentmicrosoft/TypeScript

Top Level Await

Related: accounting for top-level for-await https://github.com/tc39/proposal-top-level-await/pull/133

kitsonk

comment created time in 4 days

issue commentdenoland/deno

Major features necessary for 1.0

we need to determine what part of the compilation needs to be invalidated and reloaded

I don't follow, one could kill completely and restart. Anyway, agree it's not needed for 1.0.

ry

comment created time in 5 days

issue commentdenoland/deno

Major features necessary for 1.0

@SerkanSipahi 1.) would be quite a small wrapper around #1826, there's already a couple of issues for it.

ry

comment created time in 5 days

issue commentdenoland/registry

Ability to specify "main" in database.json

The default should be mod.ts, this is what most deno modules use (the slight reason why is that main has the connotation of executable vs mod/lib as an importable). That said, I'm not sure what the right key would be (I think main is not correct)... perhaps "entrypoint"?

sholladay

comment created time in 7 days

startedplasma-umass/coz

started time in 9 days

issue commentdenoland/deno

update `rand_core` version to remove dyn warning while building deno

Thanks! Can you bump the version in a PR?

trivikr

comment created time in 10 days

pull request commentdenoland/deno

Rename top-level crates

What about:

Rename "deno_cli_snapshots" to "deno_rt". And move the corresponding //js directory to //runtime. Move //deno_typescript to //typescript (but still keep the "deno_typescript" crate name)

I don't see the benefit of two char dir names... agree surprising ts/ or js/ would be a rust crate, usually one might expect them to contain typescript/javascript files respectively.

ry

comment created time in 12 days

Pull request review commentdenoland/deno

Use xeval from deno_std

 itest!(_029_eval {   output: "029_eval.out", }); -itest!(_030_xeval {-  args: "xeval console.log($.toUpperCase())",

aren't the tests still valuable?

nayeemrmn

comment created time in 13 days

pull request commentdenoland/deno

Support top-level-await in TypeScript

Is top level for-await a distinct typescript/V8 issue?

ry

comment created time in 16 days

issue commentdenoland/deno

Default test file name: foo_test.ts or foo.test.ts ?

I think there are two distinct questions here:

  1. what standard should deno/deno_std use?
  2. should test runner match just that "standard" (restricted subset) or match as many as possible?

I don't have an opinion on 1. but for 2. I think that the test runner needn't enforce whatever choice is made. (I don't see a downside to having a large glob.)

ry

comment created time in 18 days

push eventhayd/deno

Andy Hayden

commit sha db5356f43219959c9ffef6b4cf5c1a15ad093501

fix clippy unnecessary_unwrap

view details

push time in 19 days

pull request commentdenoland/deno_std

Bump v0.19.0

needs a tag ⚡️

ry

comment created time in 20 days

pull request commentdenoland/deno

Update rust stable to 1.38.0

The build error looks to be update required for sccache (that fixed https://github.com/mozilla/sccache/issues/488).

hayd

comment created time in 20 days

PR opened denoland/deno

Update rust stable to 1.38.0

Note: This addresses all but one of the new clippy errors. But I think there is one remaining:

https://github.com/denoland/deno/blob/d36391ad20afe56aaa6e42fd63597221636fdfcb/cli/source_maps.rs#L123-L133

I'm not sure what it wants since the if let Some(x) = y && let Some(a) = b isn't stable.

+12 -18

0 comment

8 changed files

pr created time in 20 days

create barnchhayd/deno

branch : rust_v1.38.0

created branch time in 20 days

Pull request review commentdenoland/deno

Tree reorg

+# //src

👍

This would be really useful for //third_party (and perhaps //tools) too!

ry

comment created time in 20 days

Pull request review commentdenoland/deno

WIP Add benchmarks to github actions

 jobs:         run: cargo build --release --locked --all-targets        - name: Test+        if: matrix.kind == 'test'         run: cargo test --release --locked --all-targets +      - name: Run Benchmarks+        if: matrix.kind == 'bench'+        run: python ./tools/benchmark.py target/release++      - name: Post Benchmarks+        if: matrix.kind == 'bench' && (github.ref == 'refs/heads/master' || github.ref == 'refs/pull/3008/merge')+        env:+          GH_PAT: ${{ secrets.GH_PAT }}+        run: |+          # Note gh-pages branch is cloned into //gh-pages/ by+          # tools/benchmark.py, hence the following copy is ok:+          cp -r website/* gh-pages/+          cd gh-pages+          # git remote add origin-ssh git@github.com:denoland/deno.git+          git remote add origin2 https://$GH_PAT@github.com/denoland/deno.git

$GH_PAT is an access token for this user?

ry

comment created time in 20 days

Pull request review commentdenoland/deno

WIP Add benchmarks to github actions

 jobs:         run: cargo build --release --locked --all-targets        - name: Test+        if: matrix.kind == 'test'         run: cargo test --release --locked --all-targets +      - name: Run Benchmarks+        if: matrix.kind == 'bench'+        run: python ./tools/benchmark.py target/release++      - name: Post Benchmarks+        if: matrix.kind == 'bench' && (github.ref == 'refs/heads/master' || github.ref == 'refs/pull/3008/merge')+        env:+          GH_PAT: ${{ secrets.GH_PAT }}+        run: |+          # Note gh-pages branch is cloned into //gh-pages/ by+          # tools/benchmark.py, hence the following copy is ok:+          cp -r website/* gh-pages/+          cd gh-pages+          # git remote add origin-ssh git@github.com:denoland/deno.git+          git remote add origin2 https://$GH_PAT@github.com/denoland/deno.git

username:password@ username:token@

ry

comment created time in 20 days

issue commentdenoland/deno

Integration tests that ensure dependencies are recompiled or not recompiled depending on mtime

I wonder if a solution to this may also present a solution to #200 (an "integrity" hash on the dep tree to match against).

ry

comment created time in 21 days

pull request commentdenoland/deno_std

flip the order of the arguments of listen and dial.

@ry this (and a release) is needed for 0.19.0 support in std/http.

diasbruno

comment created time in 21 days

Pull request review commentdenoland/deno

feat: Minimal op registration in isolate

+// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.+pub use crate::libdeno::OpId;+use crate::PinnedBuf;+use futures::Future;+use std::collections::HashMap;++pub type Buf = Box<[u8]>;++pub type OpAsyncFuture<E> = Box<dyn Future<Item = Buf, Error = E> + Send>;++pub(crate) type PendingOpFuture =+  Box<dyn Future<Item = (OpId, Buf), Error = CoreError> + Send>;++pub type OpResult<E> = Result<Op<E>, E>;++pub enum Op<E> {+  Sync(Buf),+  Async(OpAsyncFuture<E>),+}++pub type CoreError = ();++pub type CoreOp = Op<CoreError>;++/// Main type describing op+pub type CoreOpHandler = dyn Fn(&[u8], Option<PinnedBuf>) -> CoreOp;++#[derive(Default)]+pub struct OpRegistry {+  pub ops: Vec<Box<CoreOpHandler>>,+  pub op_map: HashMap<String, OpId>,+}++fn op_noop(_control: &[u8], _zero_copy_buf: Option<PinnedBuf>) -> CoreOp {+  Op::Sync(Box::new([]))+}++fn op_get_op_map(op_registry: &OpRegistry) -> CoreOp {+  let op_map = op_registry.get_op_map();+  let op_map_json = serde_json::to_string(&op_map).unwrap();+  let buf = op_map_json.as_bytes().to_owned().into_boxed_slice();+  Op::Sync(buf)+}++impl OpRegistry {+  pub fn new() -> Self {+    let mut registry = Self::default();+    // Add single noop symbolizing "get_op_map" function. The actual+    // handling is done in `call_op` method.+    let op_id = registry.register_op("get_op_map", Box::new(op_noop));

could you move the Box::new into register_op?

bartlomieju

comment created time in 21 days

issue commentdenoland/deno

Can't build on master

I think this may be a bug here:

https://github.com/denoland/deno/blob/045e74bb39d7743b774cfd2b889bc6ce1e1ad245/tools/setup.py#L130-L132

docs for find_executable say:

Returns the complete filename or None if not found.

so perhaps should be if not cacher: ?

kitsonk

comment created time in 23 days

issue commentdenoland/deno

Bundling V2

It seems like there's three independent environment targeting issues:

  • bundle for both browsers and deno (already if don't use Deno?)
  • support node code in deno (efforts made already with denolib/node)
  • bundle for node or other non-browser platforms (won't fix)

Perhaps I'm missing something... But bundling for node seems redundant/pointless (just use deno). If you want to bundle node code for node, don't use deno!

kitsonk

comment created time in 23 days

issue commentdenoland/deno

assert and CFA

Update: This is merged to TS.

kitsonk

comment created time in 23 days

Pull request review commentdenoland/deno

feat: Minimal op registration in isolate

 const responseBuf = new Uint8Array( const promiseMap = new Map(); let nextPromiseId = 1; -const opRegistry = [];--class Op {-  constructor(name, handler) {-    this.name = name;-    this.handler = handler;-    this.opId = 0;-    opRegistry.push(this);-  }--  setOpId(opId) {-    this.opId = opId;-  }--  /** Returns i32 number */-  sendSync(arg, zeroCopy = null) {-    const buf = send(0, this.opId, arg, zeroCopy);

i think the idea behind this being a class method was the opId could be private (and perhaps not exposed)...

bartlomieju

comment created time in a month

pull request commentdenoland/deno_std

Add TypeScript (3.5.1)

Can this be a git submodule? Then when deno_std is migrated to deno it could be a symlink.

kitsonk

comment created time in a month

issue commentdenoland/deno

Further work now that "cargo test" is the test runner

Related port tools/http_server.py to rust #1453 .

ry

comment created time in a month

Pull request review commentdenoland/deno

WIP http_server.py in Rust

 mod tests {       assert_eq!(&(r4.media_type), &msg::MediaType::TypeScript);       assert!(fs::read_to_string(&headers_file_name).is_err());     });+    drop(http_server_guard);

Isn't the point of Drop that you don't need to call drop explicitly?

ry

comment created time in a month

issue commentdenoland/deno

Never create more than one Tokio runtime. Remove tokio_util::block_on

Is the issue we should be using .await instead block_on (and rewrite higher up the stack in terms of futures), or is there something fundamental I'm missing ?

ry

comment created time in a month

Pull request review commentdenoland/deno

Reorg tests

 def main():      enable_ansi_colors() -    test_cases = [-        TestSetup,-        TestUtil,-        TestTarget,-        JsUnitTests,-        TestFetch,-        TestRepl,-        TestDenoDir,-        TestBenchmark,-        TestIsTty,-    ]-    test_cases += permission_prompt_tests()-    test_cases += complex_permissions_tests()-    # It is very slow, so do TestFmt at the end.-    test_cases += [TestFmt]--    with http_server.spawn():-        run_tests(test_cases)

Previously the -p pattern matched the method as well as the class (file).

kt3k

comment created time in a month

Pull request review commentdenoland/deno

Reorg tests

 def main():      enable_ansi_colors() -    test_cases = [-        TestSetup,-        TestUtil,-        TestTarget,-        JsUnitTests,-        TestFetch,-        TestRepl,-        TestDenoDir,-        TestBenchmark,-        TestIsTty,-    ]-    test_cases += permission_prompt_tests()-    test_cases += complex_permissions_tests()-    # It is very slow, so do TestFmt at the end.-    test_cases += [TestFmt]--    with http_server.spawn():-        run_tests(test_cases)

This removes the pattern matching functionality of test.py, which can be useful...

I couldn't see any matching functionality in cargo test ootb .

kt3k

comment created time in a month

pull request commentdenoland/deno

flip the order of the arguments in dial() and listen()...

👍. There should be a test(s) for the single argument use. (This will be the preferred way to listen/dial tcp.)

diasbruno

comment created time in a month

Pull request review commentdenoland/deno

Maintain our own copy of pylint

 def test_inside_project_dir(self):             ["--allow-" + self.test_type + "=" + root_path],             [self.test_type, "package.json", "tests/subdir/config.json"])         assert code == 0-        assert not PROMPT_PATTERN in stderr-        assert not PERMISSION_DENIED_PATTERN in stderr+        assert PROMPT_PATTERN not in stderr+        assert PERMISSION_DENIED_PATTERN not in stderr      def test_outside_test_dir(self):         code, _stdout, stderr = self._run_deno([             "--allow-" + self.test_type + "=" + os.path.join(                 root_path, "tests")         ], [self.test_type, "package.json"])         assert code == 1-        assert not PROMPT_PATTERN in stderr+        assert PROMPT_PATTERN not in stderr

Aside. we should probably be using self.assertIn(PROMPT_PATTERN, stderr), which would give a nicer error message when this fails (it'd show stderr).

ry

comment created time in a month

issue commentdenoland/deno

Support python3

@cclauss I bet I can do the deno part of the port in under an hour, certainly less than a day. I've ported large modules to python 3... deno is very small. I suppose it would help to enumerate precisely which python v8 scripts need to be ported in order for deno to work, I can do that.

ry

comment created time in a month

issue commentdenoland/deno

Support python3

I'm happy to do this, I think it'll be straightforward, but it's probably worth waiting for v8 support to be completed.

ry

comment created time in a month

pull request commentdenoland/deno

[WIP] Move fs ops to standalone crate.

But couldn't that lookup be moved into the class constructor? Then it's only done once and avoids the accessor. On the ts side it's more "lookup" than "register"? Perhaps I'm just not following, I'll reread.

This is an exciting change, looking forward to it.

afinch7

comment created time in a month

issue commentdenoland/deno

Running setup script runs into multiple issues if Python 2 isn't setup as Path env var

The issue is actually that anaconda python2 is not supported (it is upstream, perhaps unreleased?, in Luci go). So in a future release this will work, but for now you'll need to use system python (2). Note this is only for setup.py, once this has been run anaconda python2 works fine for build.

joncwong

comment created time in a month

Pull request review commentdenoland/deno

[WIP] Move fs ops to standalone crate.

 // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.-import { sendSync, sendAsync } from "./dispatch_json.ts";-import * as dispatch from "./dispatch.ts";+import { JsonOp } from "deno_dispatch_json";+import { opNamespace } from "./namespace.ts";++const OP_CHOWN = new JsonOp(opNamespace, "chown");

The opNamespace (which is always "builtin" seems uncessary), maybe export a function that wraps this:

const OP_CHOWN = builtinOp("chown")
// which also allows (if one op in the file)
const { sendSync, sendAsync } = builtinOp("chown")
afinch7

comment created time in a month

Pull request review commentdenoland/deno

[WIP] Move fs ops to standalone crate.

 // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.-use super::dispatch_json::{Deserialize, JsonOp, Value};+use super::dispatch_json::{wrap_json_op, Deserialize, JsonOp}; use crate::assets;+use crate::state::DenoOpDispatcher; use crate::state::ThreadSafeState; use crate::tokio_util; use deno::*; +// Cache

These comments are unnecessary.

afinch7

comment created time in a month

Pull request review commentdenoland/deno

[WIP] Move fs ops to standalone crate.

 // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import * as minimal from "./dispatch_minimal.ts";-import * as json from "./dispatch_json.ts";+import * as json from "deno_dispatch_json";+import { core, ops } from "deno_util"; -// These consts are shared with Rust. Update with care.-export const OP_READ = 1;-export const OP_WRITE = 2;-export const OP_EXIT = 3;-export const OP_IS_TTY = 4;-export const OP_ENV = 5;-export const OP_EXEC_PATH = 6;-export const OP_UTIME = 7;-export const OP_SET_ENV = 8;-export const OP_HOME_DIR = 9;-export const OP_START = 10;-export const OP_APPLY_SOURCE_MAP = 11;-export const OP_FORMAT_ERROR = 12;-export const OP_CACHE = 13;-export const OP_FETCH_SOURCE_FILE = 14;-export const OP_OPEN = 15;-export const OP_CLOSE = 16;-export const OP_SEEK = 17;-export const OP_FETCH = 18;-export const OP_METRICS = 19;-export const OP_REPL_START = 20;-export const OP_REPL_READLINE = 21;-export const OP_ACCEPT = 22;-export const OP_DIAL = 23;-export const OP_SHUTDOWN = 24;-export const OP_LISTEN = 25;-export const OP_RESOURCES = 26;-export const OP_GET_RANDOM_VALUES = 27;-export const OP_GLOBAL_TIMER_STOP = 28;-export const OP_GLOBAL_TIMER = 29;-export const OP_NOW = 30;-export const OP_PERMISSIONS = 31;-export const OP_REVOKE_PERMISSION = 32;-export const OP_CREATE_WORKER = 33;-export const OP_HOST_GET_WORKER_CLOSED = 34;-export const OP_HOST_POST_MESSAGE = 35;-export const OP_HOST_GET_MESSAGE = 36;-export const OP_WORKER_POST_MESSAGE = 37;-export const OP_WORKER_GET_MESSAGE = 38;-export const OP_RUN = 39;-export const OP_RUN_STATUS = 40;-export const OP_KILL = 41;-export const OP_CHDIR = 42;-export const OP_MKDIR = 43;-export const OP_CHMOD = 44;-export const OP_CHOWN = 45;-export const OP_REMOVE = 46;-export const OP_COPY_FILE = 47;-export const OP_STAT = 48;-export const OP_READ_DIR = 49;-export const OP_RENAME = 50;-export const OP_LINK = 51;-export const OP_SYMLINK = 52;-export const OP_READ_LINK = 53;-export const OP_TRUNCATE = 54;-export const OP_MAKE_TEMP_DIR = 55;-export const OP_CWD = 56;-export const OP_FETCH_ASSET = 57;+const opNamespace = ops.builtins;++type MaybeOpId = number | undefined; -export function asyncMsgFromRust(opId: number, ui8: Uint8Array): void {-  switch (opId) {-    case OP_WRITE:-    case OP_READ:-      minimal.asyncMsgFromRust(opId, ui8);-      break;-    case OP_EXIT:-    case OP_IS_TTY:-    case OP_ENV:-    case OP_EXEC_PATH:-    case OP_UTIME:-    case OP_OPEN:-    case OP_SEEK:-    case OP_FETCH:-    case OP_REPL_START:-    case OP_REPL_READLINE:-    case OP_ACCEPT:-    case OP_DIAL:-    case OP_GLOBAL_TIMER:-    case OP_HOST_GET_WORKER_CLOSED:-    case OP_HOST_GET_MESSAGE:-    case OP_WORKER_GET_MESSAGE:-    case OP_RUN_STATUS:-    case OP_MKDIR:-    case OP_CHMOD:-    case OP_CHOWN:-    case OP_REMOVE:-    case OP_COPY_FILE:-    case OP_STAT:-    case OP_READ_DIR:-    case OP_RENAME:-    case OP_LINK:-    case OP_SYMLINK:-    case OP_READ_LINK:-    case OP_TRUNCATE:-    case OP_MAKE_TEMP_DIR:-      json.asyncMsgFromRust(opId, ui8);-      break;-    default:-      throw Error("bad async opId");-  }-}+type OpId = number;++// These consts are shared with Rust. Update with care.+export let OP_READ: OpId;+opNamespace.read = (id: MaybeOpId): void => {+  OP_READ = id!;+  core.setAsyncHandler(+    id!,+    (buf: Uint8Array): void => minimal.asyncMsgFromRust(id!, buf)+  );+};+export let OP_WRITE: OpId;+opNamespace.write = (id: MaybeOpId): void => {+  OP_WRITE = id!;+  core.setAsyncHandler(+    id!,+    (buf: Uint8Array): void => minimal.asyncMsgFromRust(id!, buf)+  );+};+export let OP_EXIT: OpId;+opNamespace.exit = (id: MaybeOpId): void => {+  OP_EXIT = id!;+  core.setAsyncHandler(id!, json.asyncMsgFromRust);+};+export let OP_IS_TTY: OpId;+opNamespace.isTty = (id: MaybeOpId): void => {+  OP_IS_TTY = id!;+  core.setAsyncHandler(id!, json.asyncMsgFromRust);+};+export let OP_ENV: OpId;+opNamespace.env = (id: MaybeOpId): void => {+  OP_ENV = id!;+  core.setAsyncHandler(id!, json.asyncMsgFromRust);+};+export let OP_EXEC_PATH: OpId;+opNamespace.execPath = (id: MaybeOpId): void => {+  OP_EXEC_PATH = id!;+  core.setAsyncHandler(id!, json.asyncMsgFromRust);+};+export let OP_SET_ENV: OpId;+opNamespace.setEnv = (id: MaybeOpId): void => {+  OP_SET_ENV = id!;+  core.setAsyncHandler(id!, json.asyncMsgFromRust);+};+export let OP_HOME_DIR: OpId;+opNamespace.homeDir = (id: MaybeOpId): void => {+  OP_HOME_DIR = id!;+  core.setAsyncHandler(id!, json.asyncMsgFromRust);+};+export let OP_START: OpId;+opNamespace.start = (id: MaybeOpId): void => {+  OP_START = id!;+  core.setAsyncHandler(id!, json.asyncMsgFromRust);

This API is strange...

afinch7

comment created time in a month

Pull request review commentdenoland/deno

[WIP] Move fs ops to standalone crate.

 fn main() {   let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());   let o = PathBuf::from(env::var_os("OUT_DIR").unwrap());   let js_dir = c.join("../js");+  let import_maps = vec![+    deno_ops_fs_bundle::get_import_map(),+    deno_bundle_util::get_import_map(),+    deno_dispatch_json_bundle::get_import_map(),

I don't really understand the purpose/necessity of this import map stuff.

afinch7

comment created time in a month

Pull request review commentdenoland/deno

[WIP] Move fs ops to standalone crate.

 export async function sendAsync(   const res = await promise;   return unwrapResponse(res); }++export class JsonOp {++  private opId?: number; +  +  constructor(+    private readonly opNamespace: string,+    private readonly opName: string,+  ) {+    ops[this.opNamespace][this.opName] = (id?: number): void => {+      this.opId = id;+      if (id !== undefined) {

This should throw if id === undefined (not sure if that case is possible).

afinch7

comment created time in a month

Pull request review commentdenoland/deno

[WIP] Move fs ops to standalone crate.

 mod resources; mod timers; mod workers; -// Warning! These values are duplicated in the TypeScript code (js/dispatch.ts),-// update with care.-pub const OP_READ: OpId = 1;-pub const OP_WRITE: OpId = 2;-pub const OP_EXIT: OpId = 3;-pub const OP_IS_TTY: OpId = 4;-pub const OP_ENV: OpId = 5;-pub const OP_EXEC_PATH: OpId = 6;-pub const OP_UTIME: OpId = 7;-pub const OP_SET_ENV: OpId = 8;-pub const OP_HOME_DIR: OpId = 9;-pub const OP_START: OpId = 10;-pub const OP_APPLY_SOURCE_MAP: OpId = 11;-pub const OP_FORMAT_ERROR: OpId = 12;-pub const OP_CACHE: OpId = 13;-pub const OP_FETCH_SOURCE_FILE: OpId = 14;-pub const OP_OPEN: OpId = 15;-pub const OP_CLOSE: OpId = 16;-pub const OP_SEEK: OpId = 17;-pub const OP_FETCH: OpId = 18;-pub const OP_METRICS: OpId = 19;-pub const OP_REPL_START: OpId = 20;-pub const OP_REPL_READLINE: OpId = 21;-pub const OP_ACCEPT: OpId = 22;-pub const OP_DIAL: OpId = 23;-pub const OP_SHUTDOWN: OpId = 24;-pub const OP_LISTEN: OpId = 25;-pub const OP_RESOURCES: OpId = 26;-pub const OP_GET_RANDOM_VALUES: OpId = 27;-pub const OP_GLOBAL_TIMER_STOP: OpId = 28;-pub const OP_GLOBAL_TIMER: OpId = 29;-pub const OP_NOW: OpId = 30;-pub const OP_PERMISSIONS: OpId = 31;-pub const OP_REVOKE_PERMISSION: OpId = 32;-pub const OP_CREATE_WORKER: OpId = 33;-pub const OP_HOST_GET_WORKER_CLOSED: OpId = 34;-pub const OP_HOST_POST_MESSAGE: OpId = 35;-pub const OP_HOST_GET_MESSAGE: OpId = 36;-pub const OP_WORKER_POST_MESSAGE: OpId = 37;-pub const OP_WORKER_GET_MESSAGE: OpId = 38;-pub const OP_RUN: OpId = 39;-pub const OP_RUN_STATUS: OpId = 40;-pub const OP_KILL: OpId = 41;-pub const OP_CHDIR: OpId = 42;-pub const OP_MKDIR: OpId = 43;-pub const OP_CHMOD: OpId = 44;-pub const OP_CHOWN: OpId = 45;-pub const OP_REMOVE: OpId = 46;-pub const OP_COPY_FILE: OpId = 47;-pub const OP_STAT: OpId = 48;-pub const OP_READ_DIR: OpId = 49;-pub const OP_RENAME: OpId = 50;-pub const OP_LINK: OpId = 51;-pub const OP_SYMLINK: OpId = 52;-pub const OP_READ_LINK: OpId = 53;-pub const OP_TRUNCATE: OpId = 54;-pub const OP_MAKE_TEMP_DIR: OpId = 55;-pub const OP_CWD: OpId = 56;-pub const OP_FETCH_ASSET: OpId = 57;+const OP_NAMESPACE: &str = "builtins"; -pub fn dispatch(-  state: &ThreadSafeState,-  op_id: OpId,-  control: &[u8],-  zero_copy: Option<PinnedBuf>,-) -> CoreOp {-  let bytes_sent_control = control.len();-  let bytes_sent_zero_copy = zero_copy.as_ref().map(|b| b.len()).unwrap_or(0);+pub fn setup_dispatcher_registry(state: ThreadSafeState) -> Arc<OpDisReg> {+  let registry = Arc::new(OpDisReg::new()); -  let op = match op_id {-    OP_READ => {-      dispatch_minimal::dispatch(io::op_read, state, control, zero_copy)-    }-    OP_WRITE => {-      dispatch_minimal::dispatch(io::op_write, state, control, zero_copy)-    }-    OP_EXIT => dispatch_json::dispatch(os::op_exit, state, control, zero_copy),-    OP_IS_TTY => {-      dispatch_json::dispatch(os::op_is_tty, state, control, zero_copy)-    }-    OP_ENV => dispatch_json::dispatch(os::op_env, state, control, zero_copy),-    OP_EXEC_PATH => {-      dispatch_json::dispatch(os::op_exec_path, state, control, zero_copy)-    }-    OP_HOME_DIR => {-      dispatch_json::dispatch(os::op_home_dir, state, control, zero_copy)-    }-    OP_UTIME => {-      dispatch_json::dispatch(fs::op_utime, state, control, zero_copy)-    }-    OP_SET_ENV => {-      dispatch_json::dispatch(os::op_set_env, state, control, zero_copy)-    }-    OP_START => {-      dispatch_json::dispatch(os::op_start, state, control, zero_copy)-    }-    OP_APPLY_SOURCE_MAP => dispatch_json::dispatch(-      errors::op_apply_source_map,-      state,-      control,-      zero_copy,-    ),-    OP_FORMAT_ERROR => dispatch_json::dispatch(-      errors::op_format_error,-      state,-      control,-      zero_copy,-    ),-    OP_CACHE => {-      dispatch_json::dispatch(compiler::op_cache, state, control, zero_copy)-    }-    OP_FETCH_SOURCE_FILE => dispatch_json::dispatch(-      compiler::op_fetch_source_file,-      state,-      control,-      zero_copy,-    ),-    OP_OPEN => {-      dispatch_json::dispatch(files::op_open, state, control, zero_copy)-    }-    OP_CLOSE => {-      dispatch_json::dispatch(files::op_close, state, control, zero_copy)-    }-    OP_SEEK => {-      dispatch_json::dispatch(files::op_seek, state, control, zero_copy)-    }-    OP_METRICS => {-      dispatch_json::dispatch(metrics::op_metrics, state, control, zero_copy)-    }-    OP_FETCH => {-      dispatch_json::dispatch(fetch::op_fetch, state, control, zero_copy)-    }-    OP_REPL_START => {-      dispatch_json::dispatch(repl::op_repl_start, state, control, zero_copy)-    }-    OP_REPL_READLINE => {-      dispatch_json::dispatch(repl::op_repl_readline, state, control, zero_copy)-    }-    OP_ACCEPT => {-      dispatch_json::dispatch(net::op_accept, state, control, zero_copy)-    }-    OP_DIAL => dispatch_json::dispatch(net::op_dial, state, control, zero_copy),-    OP_SHUTDOWN => {-      dispatch_json::dispatch(net::op_shutdown, state, control, zero_copy)-    }-    OP_LISTEN => {-      dispatch_json::dispatch(net::op_listen, state, control, zero_copy)-    }-    OP_RESOURCES => dispatch_json::dispatch(-      resources::op_resources,-      state,-      control,-      zero_copy,-    ),-    OP_GET_RANDOM_VALUES => dispatch_json::dispatch(-      random::op_get_random_values,-      state,-      control,-      zero_copy,-    ),-    OP_GLOBAL_TIMER_STOP => dispatch_json::dispatch(-      timers::op_global_timer_stop,-      state,-      control,-      zero_copy,-    ),-    OP_GLOBAL_TIMER => dispatch_json::dispatch(-      timers::op_global_timer,-      state,-      control,-      zero_copy,-    ),-    OP_NOW => {-      dispatch_json::dispatch(performance::op_now, state, control, zero_copy)-    }-    OP_PERMISSIONS => dispatch_json::dispatch(-      permissions::op_permissions,-      state,-      control,-      zero_copy,-    ),-    OP_REVOKE_PERMISSION => dispatch_json::dispatch(-      permissions::op_revoke_permission,-      state,-      control,-      zero_copy,-    ),-    OP_CREATE_WORKER => dispatch_json::dispatch(-      workers::op_create_worker,-      state,-      control,-      zero_copy,-    ),-    OP_HOST_GET_WORKER_CLOSED => dispatch_json::dispatch(-      workers::op_host_get_worker_closed,-      state,-      control,-      zero_copy,-    ),-    OP_HOST_POST_MESSAGE => dispatch_json::dispatch(-      workers::op_host_post_message,-      state,-      control,-      zero_copy,-    ),-    OP_HOST_GET_MESSAGE => dispatch_json::dispatch(-      workers::op_host_get_message,-      state,-      control,-      zero_copy,-    ),-    // TODO: make sure these two ops are only accessible to appropriate Workers-    OP_WORKER_POST_MESSAGE => dispatch_json::dispatch(-      workers::op_worker_post_message,-      state,-      control,-      zero_copy,-    ),-    OP_WORKER_GET_MESSAGE => dispatch_json::dispatch(-      workers::op_worker_get_message,-      state,-      control,-      zero_copy,-    ),-    OP_RUN => {-      dispatch_json::dispatch(process::op_run, state, control, zero_copy)-    }-    OP_RUN_STATUS => {-      dispatch_json::dispatch(process::op_run_status, state, control, zero_copy)-    }-    OP_KILL => {-      dispatch_json::dispatch(process::op_kill, state, control, zero_copy)-    }-    OP_CHDIR => {-      dispatch_json::dispatch(fs::op_chdir, state, control, zero_copy)-    }-    OP_MKDIR => {-      dispatch_json::dispatch(fs::op_mkdir, state, control, zero_copy)-    }-    OP_CHMOD => {-      dispatch_json::dispatch(fs::op_chmod, state, control, zero_copy)-    }-    OP_CHOWN => {-      dispatch_json::dispatch(fs::op_chown, state, control, zero_copy)-    }-    OP_REMOVE => {-      dispatch_json::dispatch(fs::op_remove, state, control, zero_copy)-    }-    OP_COPY_FILE => {-      dispatch_json::dispatch(fs::op_copy_file, state, control, zero_copy)-    }-    OP_STAT => dispatch_json::dispatch(fs::op_stat, state, control, zero_copy),-    OP_READ_DIR => {-      dispatch_json::dispatch(fs::op_read_dir, state, control, zero_copy)-    }-    OP_RENAME => {-      dispatch_json::dispatch(fs::op_rename, state, control, zero_copy)-    }-    OP_LINK => dispatch_json::dispatch(fs::op_link, state, control, zero_copy),-    OP_SYMLINK => {-      dispatch_json::dispatch(fs::op_symlink, state, control, zero_copy)-    }-    OP_READ_LINK => {-      dispatch_json::dispatch(fs::op_read_link, state, control, zero_copy)-    }-    OP_TRUNCATE => {-      dispatch_json::dispatch(fs::op_truncate, state, control, zero_copy)-    }-    OP_MAKE_TEMP_DIR => {-      dispatch_json::dispatch(fs::op_make_temp_dir, state, control, zero_copy)-    }-    OP_CWD => dispatch_json::dispatch(fs::op_cwd, state, control, zero_copy),-    OP_FETCH_ASSET => dispatch_json::dispatch(-      compiler::op_fetch_asset,-      state,-      control,-      zero_copy,-    ),-    _ => panic!("bad op_id"),-  };+  // Compiler+  registry.register_op(OP_NAMESPACE, state.wrap_op(compiler::OpCache));+  registry+    .register_op(OP_NAMESPACE, state.wrap_op(compiler::OpFetchSourceFile));+  registry.register_op(OP_NAMESPACE, state.wrap_op(compiler::OpFetchAsset)); -  state.metrics_op_dispatched(bytes_sent_control, bytes_sent_zero_copy);+  // Errors+  registry.register_op(OP_NAMESPACE, state.wrap_op(errors::OpFormatError));+  registry.register_op(OP_NAMESPACE, state.wrap_op(errors::OpApplySourceMap)); -  match op {-    Op::Sync(buf) => {-      state.metrics_op_completed(buf.len());-      Op::Sync(buf)-    }-    Op::Async(fut) => {-      use crate::futures::Future;-      let state = state.clone();-      let result_fut = Box::new(fut.map(move |buf: Buf| {-        state.clone().metrics_op_completed(buf.len());-        buf-      }));-      Op::Async(result_fut)-    }-  }+  // Fetch+  registry.register_op(OP_NAMESPACE, state.wrap_op(fetch::OpFetch));++  // Files+  registry.register_op(OP_NAMESPACE, state.wrap_op(files::OpOpen));+  registry.register_op(OP_NAMESPACE, state.wrap_op(files::OpClose));+  registry.register_op(OP_NAMESPACE, state.wrap_op(files::OpSeek));

perhaps can pass an array of ops to a function...

afinch7

comment created time in a month

pull request commentdenoland/deno

[WIP] Move fs ops to standalone crate.

I feel like a nicer API on the ts side would be:

class CopyFile extends ??? {
    NAME = "copyFile"  // this is from the rust (used to lazily (?) lookup the opId)
}

export function copyFileSync(from: string, to: string): void {
    CopyFile.sendSync({ from, to });
}

export async function copyFile(from: string, to: string): Promise<void> {
    await CopyFile.sendAsync({ from, to });
}
afinch7

comment created time in a month

pull request commentdenoland/registry

add bwt

can you add a license?

chiefbiiko

comment created time in 2 months

pull request commentdenoland/registry

Directory listing

The “Parent directory” seems redundant since e.g. the std is clickable above it.

Clickable directory links

(from https://deno.land/std/http/ )

Note: github uses .. without a logo.

j-f1

comment created time in 2 months

pull request commentdenoland/deno

New dispatcher infrastructure.

Perhaps a silly question, but why is Named a separate trait? Could NAME be moved to DenoOpDispatcher?

afinch7

comment created time in 2 months

issue commentdenoland/deno

implement `console` follow the whatwg spec

Displays an interactive tree of the descendant elements of the specified XML/HTML element. If it is not possible to display as an element the JavaScript Object view is shown instead.

So this seems reasonable.

justjavac

comment created time in 2 months

Pull request review commentdenoland/deno_std

JSDOM port

+import { jsdom as instance } from "./vendor/jsdom.js";+import { jsdom } from "./types/jsdom.ts";++export const JSDOM = instance.JSDOM as jsdom.JSDOM;

.d.ts support is in 0.16.

MarkTiedemann

comment created time in 2 months

startedPyO3/pyo3

started time in 2 months

Pull request review commentdenoland/deno_std

feat: test runner

+#!/usr/bin/env deno -A+// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.+import { parse } from "../flags/mod.ts";+import { glob, walk } from "../fs/mod.ts";+import { runTests } from "./mod.ts";+const { args, cwd } = Deno;++// TODO: settle on list of default globs

I think this should include test.ts and test.js too.

(This is looking great)

bartlomieju

comment created time in 2 months

Pull request review commentdenoland/deno_std

feat: test runner

+#!/usr/bin/env deno -A+// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.+import { parse } from "../flags/mod.ts";+import { glob, walk } from "../fs/mod.ts";+import { runTests } from "./mod.ts";+const { args } = Deno;+++const { cwd } = Deno;+const DEFAULT_GLOB = "**/*_test.ts";

Should also test test.ts

bartlomieju

comment created time in 2 months

issue commentaws/aws-cli

Elastic Beanstalk with CloudWatch logs and Nginx

Did this question ever get an answer on Stack Overflow/elsewhere?

chemitaxis

comment created time in 3 months

pull request commentdenoland/deno

To solve problem of timer apocalypse, changing type of dueMap to Map

...

7k8m

comment created time in 3 months

pull request commentdenoland/deno

To solve problem of timer apocalypse, changing type of dueMap to Map

Is an alternative, if you need to insert a timer for T >= APOCALYPSE, to insert a thunk for APOCALYPSE - 1 which itself adds another timer for T - APOCALYPSE + 1 etc?

It is unclear the usecase for such long timers...

7k8m

comment created time in 3 months

more