Bartek Iwańczuk bartlomieju @Daftcode Warsaw, PL Fullstack developer. Currently interested in @denoland.

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") {

I was pondering it for some time now and @hayd's idea seems pretty ergonomic, but... consider that if there's a whitelist, people will probably want a blacklist as well. Surely this would be solvable by adding some special syntax (maybe -?, eg. --allow-net=127.0.0.1,-0.0.0.0,). But then again that would add some unneeded cognitive overhead and magic... Ideas?

CC @rsp might be interested

afinch7

comment created time in 9 hours

issue commentdenoland/deno

allow-read allow-write permissions constrained to specific directories

Discussion for reference: #2081 Related PR: #2129

ejsmith

comment created time in 9 hours

issue commentdenoland/deno

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

I suggest we not have a default command, as it introduces complexity at the flag parsing layer and makes it unclear what flags belong to "run" vs other subcommands.

I'm all in for that :+1: sooner or later deno <script_name> is gonna bite us on some edge case in clap and using deno run <script_name> eliminates some of issue pointed out by @kevinkassimo in #2102:

Just for disambiguation, I believe something like deno run main.ts could also be introduced: for deno <subcommand> <script-name>, if <subcommand> does not match any existing subcommands, treat <subcommand> as <script-name>.

E.g.

  • deno run main.ts: Runs script of name main.ts
  • deno main.ts: Equivalent to deno run main.ts
  • deno eval "console.log('Hi');": evaluate code console.log('Hi');
  • deno run eval: Runs script of name ./eval
  • deno run run: Runs script of name ./run

(Since we have *.headers.json (previously *.mime) files, it is totally valid to have a file named eval without .ts extension but still treated as a TypeScript file due to content-type)

I also agree that we should promote prefetch and types as subcommands and no longer just flags. Actually, I'm not so sure if we could go even further (fully separating subcommands with flags, and no longer allow prefixing -- to subcommands):

  • subcommands: help, prefetch, version, types, info, run, fmt
  • flags: --allow-*, --log-debug, --reload, and others.

Personally believe this would make the functionalities much clearer. In this case, flags are more or less modifiers, which do not change the general behavior that subcommands dictate but decorate how to run and what to display.

E.g. The following seems very clear to me about what kind of output to expect:

  • deno run --allow-all main.ts
  • deno info main.ts
  • deno info --log-debug main.ts (we still want to show info, but we also want to show some Deno debug messages`

Originally posted by @kevinkassimo in https://github.com/denoland/deno/pull/2102#issuecomment-482781130

Naturally, I'll work on that :)

ry

comment created time in a day

push eventbartlomieju/personal-website

Frieder Bluemle

commit sha 3ed8f0271fcefe36b911f03a92fe6cd9603c295a

Delete generated code

view details

Aung Myo Kyaw

commit sha 56c0b06f49c0b199c63d0e599a6cface22a960a0

feat: sort repo by pushed date

view details

Marko Kunic

commit sha ac0c7b9eebece5724e180b642e6fce9b8f1b2141

Add links to stargazers and forks

view details

ccsplit

commit sha f48504a97f58657f78becd81cec6b718eb0816a1

Add Language colors for the repositories. Used colors.json from https://github.com/ozh/github-colors/blob/master/colors.json to get the latest colors for each of the languages and then added to the repo-card with the language and a circle for the color. Add link around the Language to be the same as the Stars and forks. Change the order of the language to match GitHub.

view details

Ullaakut

commit sha b668a327421fae3f7158096bf161297a5edd8a46

Make stargazers and forks stick to bottom of repo cards

view details

Sreekanth Boddireddy

commit sha 3f0c44165a6998bbf4abfeb00b31264284ffb51b

remove duplicated repository owner name all over the site showing the repo owner name repeatedly is not adding any value for the site.

view details

James Ives

commit sha 70e0a6a01a1960877214f49420b0d75df23ba974

Adds Description Tag

view details

James Ives

commit sha 528fa94d3b6854f8583e333a418d5f94c7ad1a2c

Escaping XML

view details

ccsplit

commit sha 01f774607bcf59eaa8748737255f55d8989755be

Change top style {1 => 2}px. The color did not appear to be even with the text therefore, changed the color to have a top of 2px instead of 1px.

view details

Wilfried JEANNIARD

commit sha f5c4f2089f705d5b40706aeb80bb95c588084f5f

feat: enable rouge highlighter

view details

Francisc Furdui

commit sha 6dae0531024b90c8086ace3a0f200a7c0a158814

Fix spelling mistake in description

view details

Esteban De la Rosa

commit sha 9252a90b49a6f87a82cc90fe177f2ceff481a45c

Add missing command to steps to serve the website Add `bundle install` command to steps list in order to get the website running

view details

monomagentaeggroll

commit sha 5a53672e143d3188f469a6166e8481755eb49df3

Update README.md

view details

Brandon Rosage

commit sha 66b02d466c2862d35d7ce0c00629aa979b538d28

Merge pull request #51 from monomagentaeggroll/master Update README.md

view details

Brandon Rosage

commit sha 333f719aef90898e9e181380b56fce2059cf0fe8

Merge pull request #44 from gabbanaesteban/patch-1 Add missing command to steps to serve the website

view details

Brandon Rosage

commit sha 72409e4ff8a13d7c5131440b302540870014a343

Merge pull request #43 from skyrol/patch-1 Fix spelling mistake in description

view details

Brandon Rosage

commit sha e31471ef9bdcd2c533bc31407003cf60da126a23

Merge pull request #36 from JamesIves/master Adds Meta Description Tag

view details

Brandon Rosage

commit sha 08d27ab3acb7767ba92dd5be669ac59319c0743f

Merge pull request #35 from codemenow/patch-1 remove duplicated repository owner name all over the site

view details

Brandon Rosage

commit sha 6b704e9056bffd025fdc822059a640a6ff516648

replaced absolute positioning approach with flexbox

view details

Brandon Rosage

commit sha ccf25e159dcad0b70335abd673cc7cd76b282f19

Merge branch 'master' into pr/31

view details

push time in 2 days

push eventbartlomieju/deno-postgres

Wes Johnson

commit sha 7b769e53d4cc99aa025d7d248454125d095918c4

make QueryResult.rowDescription public

view details

Bartek Iwańczuk

commit sha 36edcc11269658f7602b93f231f36e10c9ae20b1

Merge pull request #41 from sterlingwes/master Make QueryResult.rowDescription public

view details

push time in 3 days

PR merged bartlomieju/deno-postgres

Make QueryResult.rowDescription public

Hello! Thanks for the lib 🙏

Wondering if there was a reason QueryResult.rowDescription was private? Since the result rows come back to the caller in the form of an array, this info is particularly useful for mapping a single row result back into an object with column names for keys, a la:

export const mapResult = (result: QueryResult) =>
  result.rows.map(row =>
    row.reduce((record, column, index) => {
      const columnName = result.rowDescription.columns[index].name;
      return {
        ...record,
        [columnName]: column
      };
    })
  );
+1 -1

0 comment

1 changed file

sterlingwes

pr closed time in 3 days

delete branch bartlomieju/deno

delete branch : refactor_cli_entry_point

delete time in 3 days

pull request commentdenoland/deno

Refactor CLI entry point

@ry no problem, I can add it in an hour or so. I understand you want to add deno help as an alias for deno --help, right?

bartlomieju

comment created time in 3 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha 59b5e0a1511dd2447d2c367703c5236e31ddff4f

update manual.md

view details

push time in 3 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha c9ce8b451ac7a61de84b6be989d6a9731ad0cf8e

review changes

view details

Bartek Iwańczuk

commit sha aedd90fe7fd6a4efa07fc8f1e9309f7051ce495f

additional test case for DenoFlags

view details

push time in 4 days

Pull request review commentdenoland/deno

Refactor CLI entry point

 fn create_cli_app<'a, 'b>() -> App<'a, 'b> {     ) } +/// Parse ArgMatches into internal DenoFlags structure.+/// This method should not make any side effects. #[cfg_attr(feature = "cargo-clippy", allow(stutter))]-pub fn set_flags(-  args: Vec<String>,-) -> Result<(DenoFlags, Vec<String>), String> {-  let mut rest_argv: Vec<String> = vec!["deno".to_string()];-  let cli_app = create_cli_app();-  let matches = cli_app.get_matches_from(args);+pub fn parse_flags(matches: ArgMatches) -> DenoFlags {+  let mut flags = DenoFlags::default(); -  match matches.subcommand() {-    ("eval", Some(info_match)) => {-      let code: &str = info_match.value_of("code").unwrap();-      rest_argv.extend(vec![code.to_string()]);-    }-    ("info", Some(info_match)) => {-      let file: &str = info_match.value_of("file").unwrap();-      rest_argv.extend(vec![file.to_string()]);-    }-    ("fmt", Some(fmt_match)) => {-      let files: Vec<String> = fmt_match-        .values_of("files")-        .unwrap()-        .map(String::from)-        .collect();-      rest_argv.extend(files);-    }-    (script, Some(script_match)) => {-      rest_argv.extend(vec![script.to_string()]);-      // check if there are any extra arguments that should-      // be passed to script-      if script_match.is_present("") {-        let script_args: Vec<String> = script_match-          .values_of("")-          .unwrap()-          .map(String::from)-          .collect();-        rest_argv.extend(script_args);-      }-    }-    _ => {}+  if matches.is_present("log-debug") {+    flags.log_debug = true;+  }+  if matches.is_present("version") {+    flags.version = true;+  }+  if matches.is_present("reload") {+    flags.reload = true;+  }+  if matches.is_present("allow-read") {+    flags.allow_read = true;+  }+  if matches.is_present("allow-write") {+    flags.allow_write = true;+  }+  if matches.is_present("allow-net") {+    flags.allow_net = true;+  }+  if matches.is_present("allow-env") {+    flags.allow_env = true;+  }+  if matches.is_present("allow-run") {+    flags.allow_run = true;+  }+  if matches.is_present("allow-high-precision") {+    flags.allow_high_precision = true;+  }+  if matches.is_present("allow-all") {+    flags.allow_read = true;+    flags.allow_env = true;+    flags.allow_net = true;+    flags.allow_run = true;+    flags.allow_read = true;+    flags.allow_write = true;+    flags.allow_high_precision = true;+  }+  if matches.is_present("no-prompt") {+    flags.no_prompts = true;   }-   if matches.is_present("v8-options") {-    // display v8 help and exit-    // TODO(bartlomieju): this relies on `v8_set_flags` to swap `--v8-options` to help-    v8_set_flags(vec!["deno".to_string(), "--v8-options".to_string()]);+    flags.v8_help = true;   }-   if matches.is_present("v8-flags") {-    let mut v8_flags: Vec<String> = matches+    let v8_flags: Vec<String> = matches       .values_of("v8-flags")       .unwrap()       .map(String::from)       .collect(); -    v8_flags.insert(1, "deno".to_string());-    v8_set_flags(v8_flags);+    flags.v8_flags = Some(v8_flags);   } -  let flags = DenoFlags::from(matches);-  Ok((flags, rest_argv))+  flags } -#[test]-fn test_set_flags_1() {-  let (flags, rest) = set_flags(svec!["deno", "--version"]).unwrap();-  assert_eq!(rest, svec!["deno"]);-  assert_eq!(-    flags,-    DenoFlags {-      version: true,-      ..DenoFlags::default()-    }-  );-}+#[cfg(test)]+mod tests {+  use super::*; -#[test]-fn test_set_flags_2() {-  let (flags, rest) =-    set_flags(svec!["deno", "-r", "-D", "script.ts"]).unwrap();-  assert_eq!(rest, svec!["deno", "script.ts"]);-  assert_eq!(-    flags,-    DenoFlags {-      log_debug: true,-      reload: true,-      ..DenoFlags::default()-    }-  );-}+  fn flags_from_vec(args: Vec<String>) -> DenoFlags {

Alternatively parse_flags may return DenoFlags, ArgMatches to handle both cases

bartlomieju

comment created time in 4 days

Pull request review commentdenoland/deno

Refactor CLI entry point

 fn create_cli_app<'a, 'b>() -> App<'a, 'b> {     ) } +/// Parse ArgMatches into internal DenoFlags structure.+/// This method should not make any side effects. #[cfg_attr(feature = "cargo-clippy", allow(stutter))]-pub fn set_flags(-  args: Vec<String>,-) -> Result<(DenoFlags, Vec<String>), String> {-  let mut rest_argv: Vec<String> = vec!["deno".to_string()];-  let cli_app = create_cli_app();-  let matches = cli_app.get_matches_from(args);+pub fn parse_flags(matches: ArgMatches) -> DenoFlags {+  let mut flags = DenoFlags::default(); -  match matches.subcommand() {-    ("eval", Some(info_match)) => {-      let code: &str = info_match.value_of("code").unwrap();-      rest_argv.extend(vec![code.to_string()]);-    }-    ("info", Some(info_match)) => {-      let file: &str = info_match.value_of("file").unwrap();-      rest_argv.extend(vec![file.to_string()]);-    }-    ("fmt", Some(fmt_match)) => {-      let files: Vec<String> = fmt_match-        .values_of("files")-        .unwrap()-        .map(String::from)-        .collect();-      rest_argv.extend(files);-    }-    (script, Some(script_match)) => {-      rest_argv.extend(vec![script.to_string()]);-      // check if there are any extra arguments that should-      // be passed to script-      if script_match.is_present("") {-        let script_args: Vec<String> = script_match-          .values_of("")-          .unwrap()-          .map(String::from)-          .collect();-        rest_argv.extend(script_args);-      }-    }-    _ => {}+  if matches.is_present("log-debug") {+    flags.log_debug = true;+  }+  if matches.is_present("version") {+    flags.version = true;+  }+  if matches.is_present("reload") {+    flags.reload = true;+  }+  if matches.is_present("allow-read") {+    flags.allow_read = true;+  }+  if matches.is_present("allow-write") {+    flags.allow_write = true;+  }+  if matches.is_present("allow-net") {+    flags.allow_net = true;+  }+  if matches.is_present("allow-env") {+    flags.allow_env = true;+  }+  if matches.is_present("allow-run") {+    flags.allow_run = true;+  }+  if matches.is_present("allow-high-precision") {+    flags.allow_high_precision = true;+  }+  if matches.is_present("allow-all") {+    flags.allow_read = true;+    flags.allow_env = true;+    flags.allow_net = true;+    flags.allow_run = true;+    flags.allow_read = true;+    flags.allow_write = true;+    flags.allow_high_precision = true;+  }+  if matches.is_present("no-prompt") {+    flags.no_prompts = true;   }-   if matches.is_present("v8-options") {-    // display v8 help and exit-    // TODO(bartlomieju): this relies on `v8_set_flags` to swap `--v8-options` to help-    v8_set_flags(vec!["deno".to_string(), "--v8-options".to_string()]);+    flags.v8_help = true;   }-   if matches.is_present("v8-flags") {-    let mut v8_flags: Vec<String> = matches+    let v8_flags: Vec<String> = matches       .values_of("v8-flags")       .unwrap()       .map(String::from)       .collect(); -    v8_flags.insert(1, "deno".to_string());-    v8_set_flags(v8_flags);+    flags.v8_flags = Some(v8_flags);   } -  let flags = DenoFlags::from(matches);-  Ok((flags, rest_argv))+  flags } -#[test]-fn test_set_flags_1() {-  let (flags, rest) = set_flags(svec!["deno", "--version"]).unwrap();-  assert_eq!(rest, svec!["deno"]);-  assert_eq!(-    flags,-    DenoFlags {-      version: true,-      ..DenoFlags::default()-    }-  );-}+#[cfg(test)]+mod tests {+  use super::*; -#[test]-fn test_set_flags_2() {-  let (flags, rest) =-    set_flags(svec!["deno", "-r", "-D", "script.ts"]).unwrap();-  assert_eq!(rest, svec!["deno", "script.ts"]);-  assert_eq!(-    flags,-    DenoFlags {-      log_debug: true,-      reload: true,-      ..DenoFlags::default()-    }-  );-}+  fn flags_from_vec(args: Vec<String>) -> DenoFlags {

Yeah, I had similar feeling about it, but that means we no longer have matches var available in main(), that gives nice switch on matches.subcommand().

bartlomieju

comment created time in 4 days

CommitCommentEvent
CommitCommentEvent
CommitCommentEvent
CommitCommentEvent

issue commentdenoland/deno

Function to kill a running process

@hayd any update on this?

hayd

comment created time in 4 days

issue commentdenoland/deno

the import path cannot end with'. ts'extension

CC @ry this is stale

iwe7

comment created time in 4 days

issue commentdenoland/deno

Are there any examples of setting up an http server like express?

CC @ry this is stale

alshdavid

comment created time in 4 days

issue commentdenoland/deno

Error on sync_third_party.py

CC @ry this is stale, can we close it?

daynin

comment created time in 4 days

issue commentdenoland/deno

combine --reload and --prefetch into --load

CC @ry, no longer valid with combined --reload and --prefetch flags?

ry

comment created time in 4 days

issue commentdenoland/deno

Rust duplicates setup of cache when spinning up compiler

Just check with v0.3.8 and I believe this is no longer the case

kitsonk

comment created time in 4 days

issue commentdenoland/deno

command line tool proposal

So we set a rule: Executable files are only stored in the bin directory

This introduces another "rule" which is somewhat magical. Right now the same effect can be achieved using simple bash aliases:

alias pm2='deno https://deno.land/x/pm2'
axetroy

comment created time in 4 days

issue commentdenoland/deno

Embedding deno in other projects

FYI @hephex Deno is available as a crate since late March

hephex

comment created time in 4 days

issue commentdenoland/deno

Question: Is Deno limited to a single thread per OS Process?

FYI @akircher Web Workers were released with Deno v0.3.6

akircher

comment created time in 4 days

issue commentdenoland/deno

Space on website isn't distributed well

This issue is stale. There had been some tweaks to site's CSS and it looks like there are no immediate plans for rewrite.

Can this issue be closed? CC @ry

sh7dm

comment created time in 4 days

issue commentdenoland/deno

Potential security issues with shebang script with flags

@kevinkassimo FYI, with new CLI parsing flags passed after script name, are forwarded to Deno.args, so ./gotcha --no-all would not work. This issue still holds, but we need a different solution.

kevinkassimo

comment created time in 4 days

issue commentdenoland/deno

Don't die on uncaught exceptions in REPL

Tried in v0.3.8 and REPL does not die with uncaught exception:

$ deno
> foobar()
<unknown>:1:0
foobar()
^
Uncaught ReferenceError: foobar is not defined
    at <unknown>:1:1
    at evaluate (js/repl.ts:87:34)
    at replLoop (js/repl.ts:145:13)

I guess we can close this now @sh7dm

sh7dm

comment created time in 4 days

issue commentdenoland/deno

print JS stack unexpected signal like ctrl+c

For reference, tokio has tokio-signal which can be used to intercept signals

ry

comment created time in 4 days

pull request commentdenoland/deno

Add path and name to FileInfo from stat and lstat

@ry is this PR landable?

hayd

comment created time in 4 days

pull request commentdenoland/deno

WIP Fix eslint warnings

@ry I've fixed remaining errors in console.ts and console_test.ts - you can merge it from this branch. Once you land #2160 CI should be all green

ry

comment created time in 4 days

create barnchbartlomieju/deno

branch : fix_eslint

created branch time in 4 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha dff6a25593a8569e3719be70c01516557762a388

reset CI

view details

push time in 4 days

issue commentdenoland/deno

Move web assembly lib to assets.ts

@kitsonk I took a stab at it, here's what I found:

  1. lib: [ "esnext", "web_assembly" ] - this is illegal now, TS compiler accepts lib values listed here
  2. We can safely move lib.web_assembly.d.ts to assets.ts, the only difference I found is that deno --types will no longer show WebAssembly declarations (which is expected AFAICT, since they are part of global TS declaration after moving to assets)

Do you still want to proceed with this issue?

kitsonk

comment created time in 4 days

issue commentdenoland/deno

re-enable tests that were disabled during core integration

FYI tests/error_* are enabled and passing, only repl_test are disabled.

ry

comment created time in 4 days

issue commentdenoland/deno

deno cannot import file from url without context

@Chococrok have you made progress with this issue? Feel free to ping me if you need any help

Chococrok

comment created time in 4 days

issue commentdenoland/deno

--v8-flags not passing flags to v8

This issue will be resolved by #2157

kevinkassimo

comment created time in 4 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha 80ef15dd3ffe23599403d246a7c857ca0e52debb

rename rest_argv to argv

view details

push time in 4 days

Pull request review commentdenoland/deno

Refactor CLI entry point

 pub fn print_file_info(worker: &Worker, url: &str) {   } } -fn main() {-  #[cfg(windows)]-  ansi_term::enable_ansi_support().ok(); // For Windows 10+fn get_worker_and_state(+  flags: DenoFlags,+  rest_argv: Vec<String>,+) -> (Worker, ThreadSafeState) {+  let state = ThreadSafeState::new(flags, rest_argv, ops::op_selector_std);+  let worker = Worker::new(+    "main".to_string(),+    startup_data::deno_isolate_init(),+    state.clone(),+  ); -  log::set_logger(&LOGGER).unwrap();-  let args = env::args().collect();-  let (mut flags, mut rest_argv) =-    flags::set_flags(args).unwrap_or_else(|err| {-      eprintln!("{}", err);-      std::process::exit(1)-    });+  (worker, state)+} -  log::set_max_level(if flags.log_debug {-    LevelFilter::Debug-  } else {-    LevelFilter::Warn-  });+fn types_command() {+  let p = Path::new(concat!(+    env!("GN_OUT_DIR"),+    "/gen/cli/lib/lib.deno_runtime.d.ts"+  ));+  let content_bytes = std::fs::read(p).unwrap();+  let content = std::str::from_utf8(&content_bytes[..]).unwrap(); -  if flags.fmt {-    rest_argv.insert(1, "https://deno.land/std/prettier/main.ts".to_string());-    flags.allow_read = true;-    flags.allow_write = true;-  }+  println!("{}", content); -  let should_prefetch = flags.prefetch || flags.info;-  let should_display_info = flags.info;+  std::process::exit(0);+} -  let state = ThreadSafeState::new(flags, rest_argv, ops::op_selector_std);-  let mut worker = Worker::new(-    "main".to_string(),-    startup_data::deno_isolate_init(),-    state.clone(),+fn prefetch_or_info_command(+  flags: DenoFlags,+  argv: Vec<String>,+  print_info: bool,+) {+  let (mut worker, state) = get_worker_and_state(flags, argv);++  let main_module = state.main_module().unwrap();+  let main_future = lazy(move || {+    // Setup runtime.+    js_check(worker.execute("denoMain()"));+    debug!("main_module {}", main_module);++    let main_url = root_specifier_to_url(&main_module).unwrap();++    worker+      .execute_mod_async(&main_url, true)+      .and_then(move |worker| {+        if print_info {+          print_file_info(&worker, &main_module);+        }+        worker.then(|result| {+          js_check(result);+          Ok(())+        })+      }).map_err(|(err, _worker)| print_err_and_exit(err))+  });+  tokio_util::run(main_future);+}++fn eval_command(flags: DenoFlags, argv: Vec<String>) {+  let (mut worker, state) = get_worker_and_state(flags, argv);+  // Wrap provided script in async function so asynchronous methods+  // work. This is required until top-level await is not supported.+  let js_source = format!(+    "async function _topLevelWrapper(){{+        {}+      }}+      _topLevelWrapper();+      ",+    &state.argv[1]   ); -  // TODO(ry) somehow combine the two branches below. They're very similar but-  // it's difficult to get the types to workout.--  if state.flags.eval {-    let main_future = lazy(move || {-      js_check(worker.execute("denoMain()"));-      // Wrap provided script in async function so asynchronous methods-      // work. This is required until top-level await is not supported.-      let js_source = format!(-        "async function _topLevelWrapper(){{-          {}-        }}-        _topLevelWrapper();-        ",-        &state.argv[1]-      );-      // ATM imports in `deno eval` are not allowed-      // TODO Support ES modules once Worker supports evaluating anonymous modules.-      js_check(worker.execute(&js_source));-      worker.then(|result| {+  let main_future = lazy(move || {+    js_check(worker.execute("denoMain()"));+    // ATM imports in `deno eval` are not allowed+    // TODO Support ES modules once Worker supports evaluating anonymous modules.+    js_check(worker.execute(&js_source));+    worker.then(|result| {+      js_check(result);+      Ok(())+    })+  });+  tokio_util::run(main_future);+}++fn run_repl(flags: DenoFlags, argv: Vec<String>) {+  let (mut worker, _state) = get_worker_and_state(flags, argv);++  // REPL situation.+  let main_future = lazy(move || {+    // Setup runtime.+    js_check(worker.execute("denoMain()"));+    worker+      .then(|result| {         js_check(result);         Ok(())+      }).map_err(|(err, _worker): (RustOrJsError, Worker)| {+        print_err_and_exit(err)       })-    });-    tokio_util::run(main_future);-  } else if let Some(main_module) = state.main_module() {-    // Normal situation of executing a module.--    let main_future = lazy(move || {-      // Setup runtime.-      js_check(worker.execute("denoMain()"));-      debug!("main_module {}", main_module);--      let main_url = root_specifier_to_url(&main_module).unwrap();--      worker-        .execute_mod_async(&main_url, should_prefetch)-        .and_then(move |worker| {-          if should_display_info {-            // Display file info and exit. Do not run file-            print_file_info(&worker, &main_module);-            std::process::exit(0);-          }-          worker.then(|result| {-            js_check(result);-            Ok(())-          })-        }).map_err(|(err, _worker)| print_err_and_exit(err))-    });-    tokio_util::run(main_future);-  } else {-    // REPL situation.-    let main_future = lazy(move || {-      // Setup runtime.-      js_check(worker.execute("denoMain()"));-      worker-        .then(|result| {+  });+  tokio_util::run(main_future);+}++fn run_script(flags: DenoFlags, argv: Vec<String>) {+  let (mut worker, state) = get_worker_and_state(flags, argv);++  let main_module = state.main_module().unwrap();+  // Normal situation of executing a module.+  let main_future = lazy(move || {+    // Setup runtime.+    js_check(worker.execute("denoMain()"));+    debug!("main_module {}", main_module);++    let main_url = root_specifier_to_url(&main_module).unwrap();++    worker+      .execute_mod_async(&main_url, false)+      .and_then(move |worker| {+        worker.then(|result| {           js_check(result);           Ok(())-        }).map_err(|(err, _worker): (RustOrJsError, Worker)| {-          print_err_and_exit(err)         })-    });-    tokio_util::run(main_future);+      }).map_err(|(err, _worker)| print_err_and_exit(err))+  });+  tokio_util::run(main_future);+}++fn fmt_command(mut flags: DenoFlags, mut argv: Vec<String>) {+  argv.insert(1, "https://deno.land/std/prettier/main.ts".to_string());+  flags.allow_read = true;+  flags.allow_write = true;+  run_script(flags, argv);+}++fn main() {+  #[cfg(windows)]+  ansi_term::enable_ansi_support().ok(); // For Windows 10++  log::set_logger(&LOGGER).unwrap();+  let args: Vec<String> = env::args().collect();+  let cli_app = create_cli_app();+  let matches = cli_app.get_matches_from(args);+  let flags = flags::parse_flags(matches.clone());++  if flags.v8_help {+    // show v8 help and exit+    // TODO(bartlomieju): this relies on `v8_set_flags` to swap `--v8-options` for "--help"+    v8_set_flags(vec!["--v8-options".to_string()]);

Thanks @ry. This is now ready for review.

bartlomieju

comment created time in 4 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha cff7811519e971e0b2d4e4f89c92a56a56caa32d

remove v8_set_flags_preprocess

view details

Bartek Iwańczuk

commit sha 51c43e50f0cabc126ddd9d78fbe75318b8ee683e

rename rest_argv to argv

view details

push time in 4 days

issue commentbartlomieju/deno-postgres

LISTEN/NOTIFY support

I made one pass reading pg-listen - I'll keep you posted today, this is something we definitely want to support. Functionality itself is pretty straight-forward, but we need to improve testing for this project, so it'd be good if there was a thorough test suite.

ddibiase

comment created time in 4 days

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"];

--ignore is argument that is parsed inside deno_std/prettier/main.ts - it's not handled by Deno CLI itself, to -- informs clap's parser that the rest should be forwarded to the script without being parsed

bartlomieju

comment created time in 4 days

Pull request review commentdenoland/deno

Refactor CLI entry point

 pub fn print_file_info(worker: &Worker, url: &str) {   } } -fn main() {-  #[cfg(windows)]-  ansi_term::enable_ansi_support().ok(); // For Windows 10+fn get_worker_and_state(+  flags: DenoFlags,+  rest_argv: Vec<String>,+) -> (Worker, ThreadSafeState) {+  let state = ThreadSafeState::new(flags, rest_argv, ops::op_selector_std);+  let worker = Worker::new(+    "main".to_string(),+    startup_data::deno_isolate_init(),+    state.clone(),+  ); -  log::set_logger(&LOGGER).unwrap();-  let args = env::args().collect();-  let (mut flags, mut rest_argv) =-    flags::set_flags(args).unwrap_or_else(|err| {-      eprintln!("{}", err);-      std::process::exit(1)-    });+  (worker, state)+} -  log::set_max_level(if flags.log_debug {-    LevelFilter::Debug-  } else {-    LevelFilter::Warn-  });+fn types_command() {+  let p = Path::new(concat!(+    env!("GN_OUT_DIR"),+    "/gen/cli/lib/lib.deno_runtime.d.ts"+  ));+  let content_bytes = std::fs::read(p).unwrap();+  let content = std::str::from_utf8(&content_bytes[..]).unwrap(); -  if flags.fmt {-    rest_argv.insert(1, "https://deno.land/std/prettier/main.ts".to_string());-    flags.allow_read = true;-    flags.allow_write = true;-  }+  println!("{}", content); -  let should_prefetch = flags.prefetch || flags.info;-  let should_display_info = flags.info;+  std::process::exit(0);+} -  let state = ThreadSafeState::new(flags, rest_argv, ops::op_selector_std);-  let mut worker = Worker::new(-    "main".to_string(),-    startup_data::deno_isolate_init(),-    state.clone(),+fn prefetch_or_info_command(+  flags: DenoFlags,+  argv: Vec<String>,+  print_info: bool,+) {+  let (mut worker, state) = get_worker_and_state(flags, argv);++  let main_module = state.main_module().unwrap();+  let main_future = lazy(move || {+    // Setup runtime.+    js_check(worker.execute("denoMain()"));+    debug!("main_module {}", main_module);++    let main_url = root_specifier_to_url(&main_module).unwrap();++    worker+      .execute_mod_async(&main_url, true)+      .and_then(move |worker| {+        if print_info {+          print_file_info(&worker, &main_module);+        }+        worker.then(|result| {+          js_check(result);+          Ok(())+        })+      }).map_err(|(err, _worker)| print_err_and_exit(err))+  });+  tokio_util::run(main_future);+}++fn eval_command(flags: DenoFlags, argv: Vec<String>) {+  let (mut worker, state) = get_worker_and_state(flags, argv);+  // Wrap provided script in async function so asynchronous methods+  // work. This is required until top-level await is not supported.+  let js_source = format!(+    "async function _topLevelWrapper(){{+        {}+      }}+      _topLevelWrapper();+      ",+    &state.argv[1]   ); -  // TODO(ry) somehow combine the two branches below. They're very similar but-  // it's difficult to get the types to workout.--  if state.flags.eval {-    let main_future = lazy(move || {-      js_check(worker.execute("denoMain()"));-      // Wrap provided script in async function so asynchronous methods-      // work. This is required until top-level await is not supported.-      let js_source = format!(-        "async function _topLevelWrapper(){{-          {}-        }}-        _topLevelWrapper();-        ",-        &state.argv[1]-      );-      // ATM imports in `deno eval` are not allowed-      // TODO Support ES modules once Worker supports evaluating anonymous modules.-      js_check(worker.execute(&js_source));-      worker.then(|result| {+  let main_future = lazy(move || {+    js_check(worker.execute("denoMain()"));+    // ATM imports in `deno eval` are not allowed+    // TODO Support ES modules once Worker supports evaluating anonymous modules.+    js_check(worker.execute(&js_source));+    worker.then(|result| {+      js_check(result);+      Ok(())+    })+  });+  tokio_util::run(main_future);+}++fn run_repl(flags: DenoFlags, argv: Vec<String>) {+  let (mut worker, _state) = get_worker_and_state(flags, argv);++  // REPL situation.+  let main_future = lazy(move || {+    // Setup runtime.+    js_check(worker.execute("denoMain()"));+    worker+      .then(|result| {         js_check(result);         Ok(())+      }).map_err(|(err, _worker): (RustOrJsError, Worker)| {+        print_err_and_exit(err)       })-    });-    tokio_util::run(main_future);-  } else if let Some(main_module) = state.main_module() {-    // Normal situation of executing a module.--    let main_future = lazy(move || {-      // Setup runtime.-      js_check(worker.execute("denoMain()"));-      debug!("main_module {}", main_module);--      let main_url = root_specifier_to_url(&main_module).unwrap();--      worker-        .execute_mod_async(&main_url, should_prefetch)-        .and_then(move |worker| {-          if should_display_info {-            // Display file info and exit. Do not run file-            print_file_info(&worker, &main_module);-            std::process::exit(0);-          }-          worker.then(|result| {-            js_check(result);-            Ok(())-          })-        }).map_err(|(err, _worker)| print_err_and_exit(err))-    });-    tokio_util::run(main_future);-  } else {-    // REPL situation.-    let main_future = lazy(move || {-      // Setup runtime.-      js_check(worker.execute("denoMain()"));-      worker-        .then(|result| {+  });+  tokio_util::run(main_future);+}++fn run_script(flags: DenoFlags, argv: Vec<String>) {+  let (mut worker, state) = get_worker_and_state(flags, argv);++  let main_module = state.main_module().unwrap();+  // Normal situation of executing a module.+  let main_future = lazy(move || {+    // Setup runtime.+    js_check(worker.execute("denoMain()"));+    debug!("main_module {}", main_module);++    let main_url = root_specifier_to_url(&main_module).unwrap();++    worker+      .execute_mod_async(&main_url, false)+      .and_then(move |worker| {+        worker.then(|result| {           js_check(result);           Ok(())-        }).map_err(|(err, _worker): (RustOrJsError, Worker)| {-          print_err_and_exit(err)         })-    });-    tokio_util::run(main_future);+      }).map_err(|(err, _worker)| print_err_and_exit(err))+  });+  tokio_util::run(main_future);+}++fn fmt_command(mut flags: DenoFlags, mut argv: Vec<String>) {+  argv.insert(1, "https://deno.land/std/prettier/main.ts".to_string());+  flags.allow_read = true;+  flags.allow_write = true;+  run_script(flags, argv);+}++fn main() {+  #[cfg(windows)]+  ansi_term::enable_ansi_support().ok(); // For Windows 10++  log::set_logger(&LOGGER).unwrap();+  let args: Vec<String> = env::args().collect();+  let cli_app = create_cli_app();+  let matches = cli_app.get_matches_from(args);+  let flags = flags::parse_flags(matches.clone());++  if flags.v8_help {+    // show v8 help and exit+    // TODO(bartlomieju): this relies on `v8_set_flags` to swap `--v8-options` for "--help"+    v8_set_flags(vec!["--v8-options".to_string()]);

Other than this file only core/examples/http_bench.rs uses v8_set_flags. I guess we can now rid it of v8_set_flags_preprocess and remove this obscure swapping logic?

bartlomieju

comment created time in 4 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha c67707aaaf121deaf38424738811a43943d4c32d

combine DenoFlags::from and parse_flags

view details

push time in 4 days

delete branch bartlomieju/deno

delete branch : cli_v8_flags

delete time in 4 days

Pull request review commentdenoland/deno

Refactor CLI entry point

 pub fn set_flags(   }

So based on this comment I'm gonna add v8_help and v8_flags fields to DenoFlags and call v8_set_flags in main.rs::main()

bartlomieju

comment created time in 4 days

Pull request review commentdenoland/deno

Refactor CLI entry point

 fn create_cli_app<'a, 'b>() -> App<'a, 'b> { }  #[cfg_attr(feature = "cargo-clippy", allow(stutter))]-pub fn set_flags(-  args: Vec<String>,-) -> Result<(DenoFlags, Vec<String>), String> {-  let mut rest_argv: Vec<String> = vec!["deno".to_string()];-  let cli_app = create_cli_app();-  let matches = cli_app.get_matches_from(args);--  match matches.subcommand() {-    ("eval", Some(info_match)) => {-      let code: &str = info_match.value_of("code").unwrap();-      rest_argv.extend(vec![code.to_string()]);-    }-    ("info", Some(info_match)) => {-      let file: &str = info_match.value_of("file").unwrap();-      rest_argv.extend(vec![file.to_string()]);-    }-    ("fmt", Some(fmt_match)) => {-      let files: Vec<String> = fmt_match-        .values_of("files")-        .unwrap()-        .map(String::from)-        .collect();-      rest_argv.extend(files);-    }-    (script, Some(script_match)) => {-      rest_argv.extend(vec![script.to_string()]);-      // check if there are any extra arguments that should-      // be passed to script-      if script_match.is_present("") {-        let script_args: Vec<String> = script_match-          .values_of("")-          .unwrap()-          .map(String::from)-          .collect();-        rest_argv.extend(script_args);-      }-    }-    _ => {}-  }-+pub fn set_flags(matches: ArgMatches) -> Result<DenoFlags, String> {

Yep, will do

bartlomieju

comment created time in 4 days

pull request commentdenoland/deno

fix CLI arg for v8 flags

@ry thanks for reply, regarding cleanup, please see #2157 - I did some heavy refactors regarding flag parsing there.

bartlomieju

comment created time in 4 days

issue commentdenoland/deno

Ability to modify TS config

@sh7dm can you close this issue to minimize noise?

sh7dm

comment created time in 4 days

created tagbartlomieju/deno-postgres

tagv0.1.2

PostgreSQL driver for Deno

created time in 4 days

release bartlomieju/deno-postgres

v0.1.2

released time in 4 days

push eventbartlomieju/deno-postgres

Bartek Iwańczuk

commit sha eb8e3edfee9400a1f40333331500aa3222017c22

bump Deno to v0.3.8

view details

Bartek Iwańczuk

commit sha b4361c93e0282314c5c3b02709c446b9f6c05ee1

update format.ts

view details

Bartek Iwańczuk

commit sha 6947e1b79130e263601368679e2ac5dcd7ad0ea8

update .travis.yml

view details

Bartek Iwańczuk

commit sha 2ee18506fe23d25113173b586e8d34becb033670

Merge pull request #40 from bartlomieju/deno_v038 bump Deno to v0.3.8

view details

push time in 4 days

push eventbartlomieju/deno-postgres

Bartek Iwańczuk

commit sha 6947e1b79130e263601368679e2ac5dcd7ad0ea8

update .travis.yml

view details

push time in 4 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha aa9b7056a658fd7b463454ab4cda53e657458bfb

reset CI

view details

push time in 4 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha e9f8aa1c067e2b58975defcc80f633cc524439f3

remove integration test for v8-flags

view details

push time in 4 days

push eventbartlomieju/deno-postgres

Bartek Iwańczuk

commit sha b4361c93e0282314c5c3b02709c446b9f6c05ee1

update format.ts

view details

push time in 4 days

PR opened bartlomieju/deno-postgres

bump Deno to v0.3.8
+2 -3

0 comment

1 changed file

pr created time in 4 days

create barnchbartlomieju/deno-postgres

branch : deno_v038

created branch time in 4 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha 9d8c7d37dfc45543f0c26b6ffd4c798a4254d819

change deno --prefetch to deno prefetch

view details

push time in 4 days

pull request commentdenoland/deno

fix CLI arg for v8 flags

@ry that makes sense. I'll try to do that - my first thought was to mock out v8_set_flags but it looks like it's not so straight-forward in Rust. If you had something concrete in mind any tip would be much appreciated 😅

bartlomieju

comment created time in 4 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha 691aea7411be3a86b8d99d0ab0fe8920a80cc142

change deno --prefetch to deno prefetch

view details

push time in 4 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha c51aed87c2588e86ea8ca9f357df64af597fcf0c

change deno --prefetch to deno prefetch

view details

push time in 5 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha b2e877ec5eca872a5e4d1e2f3eac39715bbf6a07

change deno --types to deno types

view details

push time in 5 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha 5d61aead97c9faf7d0869eefe3e61ba4b537211b

change deno --types to deno types

view details

push time in 5 days

pull request commentdenoland/deno

fix CLI arg for v8 flags

@ry I've added integration test, is it sufficient?

bartlomieju

comment created time in 5 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha 97ae247cc371afa9ada4cbe3ed41c2b3bd3aa5cc

fix v8-flags test

view details

push time in 5 days

Pull request review commentdenoland/deno

[WIP] Refactor CLI entry point

 pub fn print_file_info(worker: &Worker, url: &str) {   } } -fn main() {-  #[cfg(windows)]-  ansi_term::enable_ansi_support().ok(); // For Windows 10+fn get_worker_and_state(+  flags: DenoFlags,+  rest_argv: Vec<String>,+) -> (Worker, ThreadSafeState) {+  let state = ThreadSafeState::new(flags, rest_argv, ops::op_selector_std);+  let worker = Worker::new(+    "main".to_string(),+    startup_data::deno_isolate_init(),+    state.clone(),+  ); -  log::set_logger(&LOGGER).unwrap();-  let args = env::args().collect();-  let (mut flags, mut rest_argv) =-    flags::set_flags(args).unwrap_or_else(|err| {-      eprintln!("{}", err);-      std::process::exit(1)-    });+  (worker, state)+} -  log::set_max_level(if flags.log_debug {-    LevelFilter::Debug-  } else {-    LevelFilter::Warn-  });+fn info_command(flags: DenoFlags, argv: Vec<String>) {+  let (mut worker, state) = get_worker_and_state(flags, argv); -  if flags.fmt {-    rest_argv.insert(1, "https://deno.land/std/prettier/main.ts".to_string());-    flags.allow_read = true;-    flags.allow_write = true;-  }+  let main_module = state.main_module().unwrap();+  let main_future = lazy(move || {+    // Setup runtime.+    js_check(worker.execute("denoMain()"));+    debug!("main_module {}", main_module); -  let should_prefetch = flags.prefetch || flags.info;-  let should_display_info = flags.info;+    let main_url = root_specifier_to_url(&main_module).unwrap(); -  let state = ThreadSafeState::new(flags, rest_argv, ops::op_selector_std);-  let mut worker = Worker::new(-    "main".to_string(),-    startup_data::deno_isolate_init(),-    state.clone(),+    worker+      .execute_mod_async(&main_url, true)+      .and_then(move |worker| {+        print_file_info(&worker, &main_module);+        worker.then(|result| {+          js_check(result);+          Ok(())+        })+      }).map_err(|(err, _worker)| print_err_and_exit(err))+  });+  tokio_util::run(main_future);+}

@ry PTAL at it. It seem that execute_mod_async does not evaluate and run file if prefetch is set to true, so simple letting worker finish the job seems to work fine. I'm not sure though

bartlomieju

comment created time in 5 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha 962523732492d078cc0b5baa66eb678c4096cebd

cleanup deno info

view details

push time in 5 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha 172d927f48f55ceaf818066a9badb82dab0e0eac

remove no longer needed DenoFlags fields

view details

push time in 5 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha 6e2f8d945773866bce8600a9d5e1d670a502cab5

remove no longer needed DenoFlags fields

view details

push time in 5 days

PR opened denoland/deno

[WIP] Refactor CLI entry point

This PR refactors main.rs to use dedicated functions for different deno <subcommand>, as discussed in #2084

+287 -235

0 comment

4 changed files

pr created time in 5 days

create barnchbartlomieju/deno

branch : refactor_cli_entry_point

created branch time in 5 days

push eventbartlomieju/deno

Kevin (Kun) "Kassimo" Qian

commit sha afabb3f833c80af380432193881769b8a6c1c88d

Fix redirects under async load (#2133)

view details

Yoshiya Hinosawa

commit sha 2be7e4440339f616a37b9535cc38936f80efc0e1

chore: update eslint plugin (#2146)

view details

迷渡

commit sha d0cd7a39a2d05343c5501dc286bb59096659654f

avoid prototype builtin hasOwnProperty (#2144)

view details

Ryan Dahl

commit sha e026320c73fa419b852f00e79e0c602c622d92c3

Improve test slow_never_ready_modules (#2145)

view details

Ryan Dahl

commit sha 5e5c8553e70cfd092cb5ce8a1c77a29fbba770bf

core: test Modules::deps and handle error cases better (#2141)

view details

Ryan Dahl

commit sha 0796a8f2f75005df95ef6115a4bdf6dd66e58dc3

v0.3.8

view details

Kevin (Kun) "Kassimo" Qian

commit sha c8db224efed08d7722c9951cde048d731db050d3

Make Deno/Deno.core not deletable/writable (#2153)

view details

push time in 5 days

issue commentdenoland/deno

Ability to modify TS config

This is already WIP by @kistonk in denoland/deno#2089

sh7dm

comment created time in 5 days

issue commentbartlomieju/deno-postgres

LISTEN/NOTIFY support

Hey @ddibiase, there is not LISTEN/NOTIFY support yet, but it's on my roadmap. I expect it should land during next month or two. Feel free to contribute!

ddibiase

comment created time in 6 days

push eventbartlomieju/deno

迷渡

commit sha ea1b0519f58887f0019ead942bf3de4490e7bc11

Update `deno -h` output in manual (#2099)

view details

Yoshiya Hinosawa

commit sha e0edcc9c1b025c2b02eb5b50ae7a86089d1c4d61

fix: re-expose DomFile (#2100)

view details

andy finch

commit sha d3bd5879c3b1a26cc09a5374bf2b5ee63071fe29

better wait for removed_from_resource_table_on_close test (#2104)

view details

Bartek Iwańczuk

commit sha 591b5e4a7dfc1c3537c7a2c7091ebe3890271780

Add deno eval subcommand (#2102)

view details

Yoshiya Hinosawa

commit sha 635ad2a18ecd26690e611f54062ae899fe307f96

fix absolute path resolution from remote (#2109)

view details

Ryan Dahl

commit sha a51e78215547f5b10498041a1c58b5fa29c22cbe

Upgrade deno_std (#2111)

view details

tanakaworld

commit sha b413cd5afd6b74b3e50bf6dbb5972ea7df9f34fd

docs: add a pixelated animation logo (#2110)

view details

Ryan Dahl

commit sha c7e1f8fabdc87d3622fd94769c57197d5dfecad3

Fix silent error, add custom panic handler (#2098) This is to work around Tokio's panic recovery feature. Ref https://github.com/tokio-rs/tokio/issues/495 Ref https://github.com/tokio-rs/tokio/issues/209 Ref https://github.com/denoland/deno/issues/1311 Fixes #2097

view details

Bert Belder

commit sha 64fb86c0cf6190d72096e58b71eca03ee10b6ed4

third_party: patch hyper to reduce worst-case response latency

view details

Bert Belder

commit sha 3bea62dd0e05d2081750ef2371c072b18a4bb69f

third_party: fix bug in hyper latency patch

view details

JaePil Jung

commit sha 9cb959ec95fed60f4a5e54fd09a0506fbbe4d9c9

Small fixes in manual.md (#2118)

view details

Bert Belder

commit sha 97f0fe7437ad4277afbdabf6cac214a40b637cd1

third_party: upgrade rust crates

view details

Dmitry Sharshakov

commit sha 0c463582206881b6461742633a67f51632db614e

Add max memory benchmark (#2061)

view details

Ryan Dahl

commit sha 1bfb44336914a775cd01120165517394d30aec23

Implement async module loading in CLI (#2084)

view details

Bert Belder

commit sha 2719631038918577c66db2558bbba457c8f4cfd9

core/http_bench: support -D flag to enable logging

view details

Bert Belder

commit sha dd595220abed9e4f9dd88e14110eb67f4f5e77be

core: run isolate tests within a task This change is made in preparation for using FuturesUnordered to track futures that are spawned by the isolate. FuturesUnordered sets up notififications for every future that it finds to be not ready when polled, which causes a crash if attempted outside of a task context.

view details

Bert Belder

commit sha 7807afa97274d3b0645d70475fecb37f5dc8ba14

core: make Isolate use FuturesUnordered to track ops Additionally, instead of polling ops in a loop until none of them are ready, the isolate will now yield to the task system after delivering the first batch of completed ops to the javascript side. Although this makes performance a bit worse (about 15% fewer requests/second on the 'deno_core_http_bench' benchmark), we feel that the advantages are worth it: * It resolves the extremely high worst-case latency that we were seeing on deno_core_http_bench, in particular when using the multi-threaded Tokio runtime, which would sometimes exceed a full second. * Before this patch, the implementation of Isolate::poll() had to loop through all sub-futures and poll each one of them, which doesn't scale well as the number of futures managed by the isolate goes up. This could lead to poor performance when e.g. a server is servicing thousands of connected clients.

view details

Ryan Dahl

commit sha 79a974229ad533bc8880a5ce067b4310002c9572

Move deno_core_http_bench into examples dir (#2127)

view details

Bert Belder

commit sha 90c2b10f47ab123f0ea7d71f3eeb3ee9172f7000

Add cli dependency on tokio-rustls

view details

Bert Belder

commit sha 8477daa8b970ae8ef042a5242aee705003b63fc1

Fix clippy warnings

view details

push time in 6 days

push eventbartlomieju/deno

tanakaworld

commit sha b413cd5afd6b74b3e50bf6dbb5972ea7df9f34fd

docs: add a pixelated animation logo (#2110)

view details

Ryan Dahl

commit sha c7e1f8fabdc87d3622fd94769c57197d5dfecad3

Fix silent error, add custom panic handler (#2098) This is to work around Tokio's panic recovery feature. Ref https://github.com/tokio-rs/tokio/issues/495 Ref https://github.com/tokio-rs/tokio/issues/209 Ref https://github.com/denoland/deno/issues/1311 Fixes #2097

view details

Bert Belder

commit sha 64fb86c0cf6190d72096e58b71eca03ee10b6ed4

third_party: patch hyper to reduce worst-case response latency

view details

Bert Belder

commit sha 3bea62dd0e05d2081750ef2371c072b18a4bb69f

third_party: fix bug in hyper latency patch

view details

JaePil Jung

commit sha 9cb959ec95fed60f4a5e54fd09a0506fbbe4d9c9

Small fixes in manual.md (#2118)

view details

Bert Belder

commit sha 97f0fe7437ad4277afbdabf6cac214a40b637cd1

third_party: upgrade rust crates

view details

Dmitry Sharshakov

commit sha 0c463582206881b6461742633a67f51632db614e

Add max memory benchmark (#2061)

view details

Ryan Dahl

commit sha 1bfb44336914a775cd01120165517394d30aec23

Implement async module loading in CLI (#2084)

view details

Bert Belder

commit sha 2719631038918577c66db2558bbba457c8f4cfd9

core/http_bench: support -D flag to enable logging

view details

Bert Belder

commit sha dd595220abed9e4f9dd88e14110eb67f4f5e77be

core: run isolate tests within a task This change is made in preparation for using FuturesUnordered to track futures that are spawned by the isolate. FuturesUnordered sets up notififications for every future that it finds to be not ready when polled, which causes a crash if attempted outside of a task context.

view details

Bert Belder

commit sha 7807afa97274d3b0645d70475fecb37f5dc8ba14

core: make Isolate use FuturesUnordered to track ops Additionally, instead of polling ops in a loop until none of them are ready, the isolate will now yield to the task system after delivering the first batch of completed ops to the javascript side. Although this makes performance a bit worse (about 15% fewer requests/second on the 'deno_core_http_bench' benchmark), we feel that the advantages are worth it: * It resolves the extremely high worst-case latency that we were seeing on deno_core_http_bench, in particular when using the multi-threaded Tokio runtime, which would sometimes exceed a full second. * Before this patch, the implementation of Isolate::poll() had to loop through all sub-futures and poll each one of them, which doesn't scale well as the number of futures managed by the isolate goes up. This could lead to poor performance when e.g. a server is servicing thousands of connected clients.

view details

Ryan Dahl

commit sha 79a974229ad533bc8880a5ce067b4310002c9572

Move deno_core_http_bench into examples dir (#2127)

view details

Bert Belder

commit sha 90c2b10f47ab123f0ea7d71f3eeb3ee9172f7000

Add cli dependency on tokio-rustls

view details

Bert Belder

commit sha 8477daa8b970ae8ef042a5242aee705003b63fc1

Fix clippy warnings

view details

Ryan Dahl

commit sha f20b05af24a5e1308e240f2c9af0fa75eefb131f

benchmarks: fix max_memory and clean up (#2137)

view details

Ryan Dahl

commit sha 1a69df4a051b9407ab341a82d65d4355f77ad16b

Fix flaky tests (#2139)

view details

Ryan Dahl

commit sha f03280ead1bec16b2c0c33fb980e2db7f58a5933

benchmarks: improve syscall and thread count (#2140)

view details

push time in 6 days

pull request commentdenoland/deno

fix CLI arg for v8 flags

@ry yes, that's why I didn't want it merged. I was caught up in work this week, but should be able to finish it today/tomorrow.

bartlomieju

comment created time in 7 days

issue commentdenoland/deno

Deno hangs in Ubuntu

  • Only 1 cpu core available on the system (like in a VM with 1 vCPU.) Deno needs more than 1 thread to compile code.

This sounds like a bug, but still single CPU machine should be able to run more than 1 thread?

pietvanzoen

comment created time in 8 days

Pull request review commentdenoland/deno_std

[Testing] Pretty output + disable log handling

 export async function runTests({   };   const results: TestResults = createTestResults(tests);   console.log(`running ${tests.length} tests`);+  const start = performance.now();   if (parallel) {-    await runTestsParallel(stats, results, tests, exitOnFail);+    await runTestsParallel(stats, results, tests, disableLog, exitOnFail);

Order or arguments is different compared to runTestsSerial, this should be changed

zekth

comment created time in 8 days

Pull request review commentdenoland/deno_std

[Testing] Pretty output + disable log handling

 async function createTestCase( ): Promise<void> {   const result: TestResult = results.cases.get(results.keys.get(name));   try {+    let start, end;

Any reason for using let instead of const?

zekth

comment created time in 8 days

issue commentdenoland/deno

Arguments array - should the program name be included?

@rsp agreed. Deno.args[0] is hard coded on Rust side so it's always "deno". Deno.args[1] is script name that is optional (if you start REPL with deno). Maybe it's worth considering moving it to Deno.scriptName/Deno.entryPoint?

rsp

comment created time in 9 days

Pull request review commentdenoland/deno

Implement async module loading in CLI

 fn main() {   let should_display_info = flags.info;    let state = ThreadSafeState::new(flags, rest_argv, ops::op_selector_std);-  let mut main_worker = Worker::new(+  let mut worker = Worker::new(     "main".to_string(),     startup_data::deno_isolate_init(),     state.clone(),   ); -  let main_future = lazy(move || {-    // Setup runtime.-    js_check(main_worker.execute("denoMain()"));+  // TODO(ry) somehow combine the two branches below. They're very similar but+  // it's difficult to get the types to workout.

Maybe split those conditional branches into separate functions? Then combined with clap's parsing we'd get:

  match matches.subcommand() {
    ("eval", Some(info_match)) => {
      eval_command(...);
    }
    ("info", Some(info_match)) => {
       info_command(...);
    }
    ("fmt", Some(fmt_match)) => {
       fmt_command(...);
    }
    (script, Some(script_match)) => {
      run_script_command();
    }
    _ => {}
  }

I can do that in follow-up PR

ry

comment created time in 9 days

issue commentdenoland/deno

Arguments array - should the program name be included?

@rsp just for clarification with recent changes to CLI Deno behaves like example no. 2

deno run -RWX script.ts arg
// Deno.args
["deno", "script.ts", "arg"]
rsp

comment created time in 9 days

pull request commentdenoland/deno

fix CLI arg for v8 flags

@ry please don't merge yet

bartlomieju

comment created time in 11 days

push eventbartlomieju/deno

迷渡

commit sha ea1b0519f58887f0019ead942bf3de4490e7bc11

Update `deno -h` output in manual (#2099)

view details

Yoshiya Hinosawa

commit sha e0edcc9c1b025c2b02eb5b50ae7a86089d1c4d61

fix: re-expose DomFile (#2100)

view details

andy finch

commit sha d3bd5879c3b1a26cc09a5374bf2b5ee63071fe29

better wait for removed_from_resource_table_on_close test (#2104)

view details

Bartek Iwańczuk

commit sha 591b5e4a7dfc1c3537c7a2c7091ebe3890271780

Add deno eval subcommand (#2102)

view details

Yoshiya Hinosawa

commit sha 635ad2a18ecd26690e611f54062ae899fe307f96

fix absolute path resolution from remote (#2109)

view details

Ryan Dahl

commit sha a51e78215547f5b10498041a1c58b5fa29c22cbe

Upgrade deno_std (#2111)

view details

push time in 11 days

PR opened denoland/deno

fix CLI arg for v8 flags

This PR resolves problem from #2112

CC @kevinkassimo you can apply this fix now, I'll figure out a way to test it properly in the morning

+2 -1

0 comment

1 changed file

pr created time in 11 days

create barnchbartlomieju/deno

branch : cli_v8_flags

created branch time in 11 days

issue commentdenoland/deno

--v8-flags not passing flags to v8

I've spotted the problem, fixing it now

kevinkassimo

comment created time in 11 days

issue commentdenoland/deno

Req/Sec benchmark is missing `node_http`

Can be closed CC @ry

zaynv

comment created time in 11 days

issue commentdenoland/deno

[Windows] Wrong path on deno.platform

@zekth is this still the issue with Deno.build?

zekth

comment created time in 11 days

issue commentdenoland/deno

Move I/O interfaces into deno_std

@ry do you still want to do it?

ry

comment created time in 11 days

issue commentdenoland/deno

deno size

Can we close this one now?

cup

comment created time in 11 days

Pull request review commentdenoland/deno

Add deno eval command

 pub fn set_flags(         .long("prefetch")         .help("Prefetch the dependencies"),     ).subcommand(-      // TODO(bartlomieju): version is not handled properly       SubCommand::with_name("info")+        .setting(AppSettings::DisableVersion)         .about("Show source file related info")         .arg(Arg::with_name("file").takes_value(true).required(true)),     ).subcommand(-      // TODO(bartlomieju): version is not handled properly-      SubCommand::with_name("fmt").about("Format files").arg(-        Arg::with_name("files")-          .takes_value(true)-          .multiple(true)-          .required(true),-      ),+      SubCommand::with_name("eval")+        .setting(AppSettings::DisableVersion)+        .about("Eval script")+        .arg(Arg::with_name("script").takes_value(true).required(true)),

Changed to code

bartlomieju

comment created time in 12 days

push eventbartlomieju/deno

Bartek Iwańczuk

commit sha 34718f7cefb97d9ddc2b98fa2303db9aafccd154

review feedback

view details

push time in 12 days

issue commentdenoland/deno

deno eval

To extend @rsp's example of CLI args: we talked about "permission maps" which essentially could be a JSON file similar in structure to import-map. It would allow to granularly specify what is allowed for package and its imports. Example:

deno --permission-map=perms.json script.ts
// perms.json
{
    "https://deno.land/": {
       // standard modules have full permissions
        "read": true,
        "write": true,
        "net": true,
        "run": true,
        "env": true
    },
    "https://deno.land/x/postgres": {
        // allow `dial` but only for these adresses
        "net": [
            "0.0.0.0",
            "127.0.0.1",
            "192.168.1.1/24"
        ],
        "env": true
    },
    "<some_other_package>": {
        "write": [
            "/var/www"
        ],
        "read": [
            "/var/www",
            "/var/server"
        ]
    },
    // catch-all for unknown packages, deny all
    "*": {
        "read": false,
        "write": false,
        "net": false,
        "run": false,
        "env": false
    }
}

This solution requires that permissions are "contextful" - during op we'd need to know which module issue this call and resolve it against the map. That's probably a good place to move discussion to dedicated issue for that.

ry

comment created time in 12 days

pull request commentdenoland/deno

Add Deno.lines

@johnsonjo4531 thanks I appreciate it.

I agree with you, we can solve it simply with: Deno.byteLines and Deno.lines (where lines just decodes lines yielded by byteLines

bartlomieju

comment created time in 12 days

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");

@johnsonjo4531 you're right, that's where your implementation is better :) let's wait on BufReader it should solve this issue.

bartlomieju

comment created time in 12 days

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)) {

It looks like BufReader provides a nice way to solve lines :+1:

Reading line by line is such a common operation that IMHO it should be Deno.lines instead of living in deno_std.

It's greatly illustrated by @ry's example. This is super simple:

cat /etc/passwd |  deno eval " \
  for await (let line of Deno.lines(Deno.stdin) { \
    console.log(line.split(':')[0]) }"

This is not:

cat /etc/passwd |  deno eval " \
  import { lines } from "https://deno.land/x/io/mod.ts; \
  for await (let line of Deno.lines(Deno.stdin) { \
    console.log(line.split(':')[0]) }"
bartlomieju

comment created time in 12 days

more