push eventdenoland/deno

Kevin (Kun) "Kassimo" Qian

commit sha 1548792fb3530efb63432c0c704a3f0053410eb3

Add more console types formatting support (#1299)

view details

push time in 6 minutes

PR merged denoland/deno

Add more console types formatting support

Noticed that we haven't yet support types such as Map when I was doing some debugging (which is annoying...).

This PR adds formatting support to the following types:

  • Set/Map
  • WeakSet/WeakMap (WeakMap { [items unknown] }, similar behavior to Node)
  • Wrapper objects (Number/Boolean/String)
  • Date
  • RegExp
  • TypedArray (Uint8Array etc.)

Changed:

  • DEFAULT_MAX_DEPTH for nested object printing is increased to 4 (2 is too restrictive)
  • [object] => [Object] for deeply nested objects (as seen in Node)
  • [object] => [Set]/[Map] etc. for deeply nested Set/Map (as seen in Node)
+223 -34

2 comments

2 changed files

kevinkassimo

pr closed time in 6 minutes

issue closeddenoland/deno

Deno should not import remote files without --allow-net flag

Just experimenting with deno so please excuse my instant misbehave.

But isn't the --allow-net flag's purpose is to encapsuate the process from the network and not let the script access the network without permission?

If this is the case, then we should block imports/require from calling remote urls.

This small snippet allowed me to read and send my secret without net access.

As I seen the --allow-read will block me from reading the filesystem but still the netwoking is available with crafted imports.

closed time in 21 minutes

hisorange

issue commentdenoland/deno

Deno should not import remote files without --allow-net flag

Yes, this is a bug. Dynamic import should not be allowed unless --allow-net is specified.

I'm in the process of refactoring how dynamic import works (#975) and will add this constraint in the new implementation.

Duplicate of https://github.com/denoland/deno/issues/712 - let's move the discussion there.

hisorange

comment created time in 21 minutes

pull request commentdenoland/deno

Add more console types formatting support

@kevinkassimo

error: Server does not allow request for unadvertised object

Thanks for the notice. Should be fixed now. It's because git submodules requires the linked revision to be published as the head of a branch (?). I'll think about how to deal with this in the future.

kevinkassimo

comment created time in 27 minutes

create barnchdenoland/deno_net

branch : deno

created branch time in 30 minutes

push eventdenoland/deno_net

木杉

commit sha 7cd4d9f4eaa4b1d167306b9000af30421319600a

supply the directory to serve as CLI argument (#13)

view details

push time in 16 hours

Pull request review commentdenoland/deno

[WIP] Implementation of create file

 test(async function filesToAsyncIterator() {    assertEqual(totalSize, 12); });++testPerm({ write: true }, async function createFile() {+  const tempDir = await deno.makeTempDir();+  const filename = tempDir + "/test.txt";+  let f = await deno.open(filename, deno.OpenMode.Write);+  let fileInfo = deno.statSync(filename);+  assert(fileInfo.isFile());+  assert(fileInfo.len === 0);+  const enc = new TextEncoder();+  const data = enc.encode("Hello");+  await f.write(data);+  fileInfo = deno.statSync(filename);+  assert(fileInfo.len === 5);+  f.close();++  // TODO: test different modes+  await deno.removeAll(tempDir);+});++testPerm({ write: true }, async function openModeWrite() {+  const tempDir = deno.makeTempDirSync();+  const encoder = new TextEncoder();+  const filename = tempDir + "hello.txt";+  const data = encoder.encode("Hello world!\n");++  let file = await deno.open(filename, deno.OpenMode.Write);+  // assert file was created+  let fileInfo = deno.statSync(filename);+  assert(fileInfo.isFile());+  assertEqual(fileInfo.len, 0);+  // write some data+  await file.write(data);+  fileInfo = deno.statSync(filename);+  assertEqual(fileInfo.len, 13);+  // assert we can't read from file+  let thrown = false;+  try {+    const buf = new Uint8Array(20);+    await file.read(buf);+  } catch (e) {+    thrown = true;+  } finally {+    assert(thrown, "OpenMode.Write shouldn't allow to read file");+  }+  file.close();+  // assert that existing file is truncated on open+  file = await deno.open(filename, deno.OpenMode.Write);+  file.close();+  const fileSize = deno.statSync(filename).len;+  assertEqual(fileSize, 0);+  await deno.removeAll(tempDir);+});

Nice tests!

bartlomieju

comment created time in 20 hours

Pull request review commentdenoland/deno

[WIP] Implementation of create file

 test(async function filesToAsyncIterator() {    assertEqual(totalSize, 12); });++testPerm({ write: true }, async function createFile() {+  const tempDir = await deno.makeTempDir();+  const filename = tempDir + "/test.txt";+  let f = await deno.open(filename, deno.OpenMode.Write);

Although I think it's nice to have the OpenMode enum, users are not going to be so explicit - they will use the short hand "w" instead. I think it would be better to use those in the tests.

bartlomieju

comment created time in 20 hours

Pull request review commentdenoland/deno

[WIP] Implementation of create file

 export const stdout = new File(1); /** An instance of `File` for stderr. */ export const stderr = new File(2); -// TODO This is just a placeholder - not final API.-export type OpenMode = "r" | "w" | "w+" | "x";+export enum OpenMode {+  /** Read-only, default mode.+   * Starts at beginning of file.+   */+  Read = "r",+  /** Read-write+   * Start at beginning of file.+   */+  ReadWrite = "r+",+  /** Write-only+   * Opens and truncates existing file or creates new one+   * for writing only.+   */+  Write = "w",+  /** Write-read+   * Opens and truncates existing file or creates new one+   * for writing and reading.+   */+  WriteRead = "w+",+  /** Append-only+   * Opens existing file or creates new one.+   * Each write appends content to file and doesn't overwrite+   * already existing content.+   */+  Append = "a",+  /** Append-read+   * Behaves like `OpenMode.Append` and allows to read from file.+   */+  AppendRead = "a+",+  /** Exclusive create+   * Creates new file only if one doesn't exist already.+   * Allows to write to file.+   */+  ExclusiveCreate = "x",+  /** Exclusive create - read+   * Behaves like `OpenMode.ExclusiveCreate` and allows to read from file.+   */+  ExclusiveCreateRead = "x+"+}

It would be nice if the JSDocs here were single lines... if possible. It seems like many of them could be.

bartlomieju

comment created time in 20 hours

Pull request review commentdenoland/deno

[WIP] Implementation of create file

 export const stdout = new File(1); /** An instance of `File` for stderr. */ export const stderr = new File(2); -// TODO This is just a placeholder - not final API.-export type OpenMode = "r" | "w" | "w+" | "x";+export enum OpenMode {+  /** Read-only, default mode.+   * Starts at beginning of file.+   */+  Read = "r",+  /** Read-write+   * Start at beginning of file.+   */+  ReadWrite = "r+",+  /** Write-only+   * Opens and truncates existing file or creates new one+   * for writing only.+   */+  Write = "w",+  /** Write-read+   * Opens and truncates existing file or creates new one+   * for writing and reading.+   */+  WriteRead = "w+",

The name of this one is strange. WriteTruncate would be better ?

bartlomieju

comment created time in 20 hours

pull request commentdenoland/deno

[WIP] Implementation of create file

@bartlomieju Regarding writeFile and readFile - these ops are fully buffered. They're fine for small files, but if you have a 1 gigabyte file, you might not want to load it all into memory just to read the first few bytes from it. This is the purpose of having raw file handles.

bartlomieju

comment created time in 20 hours

Pull request review commentdenoland/deno

[WIP] Implementation of create file

 test(async function filesToAsyncIterator() {    assertEqual(totalSize, 12); });++testPerm({ write: true }, async function createFile() {+  const tempDir = await deno.makeTempDir();+  const filename = tempDir + "/test.txt";+  let f = await deno.open(filename, deno.OpenMode.Write);+  let fileInfo = deno.statSync(filename);+  assert(fileInfo.isFile());+  assert(fileInfo.len === 0);+  const enc = new TextEncoder();+  const data = enc.encode("Hello");+  await f.write(data);+  fileInfo = deno.statSync(filename);+  assert(fileInfo.len === 5);+  f.close();++  // TODO: test different modes+  await deno.removeAll(tempDir);+});++testPerm({ write: true }, async function openModeWrite() {+  const tempDir = deno.makeTempDirSync();+  const encoder = new TextEncoder();+  const filename = tempDir + "hello.txt";+  const data = encoder.encode("Hello world!\n");++  let file = await deno.open(filename, deno.OpenMode.Write);+  // assert file was created+  let fileInfo = deno.statSync(filename);+  assert(fileInfo.isFile());+  assertEqual(fileInfo.len, 0);+  // write some data+  await file.write(data);+  fileInfo = deno.statSync(filename);+  assertEqual(fileInfo.len, 13);+  // assert we can't read from file+  let thrown = false;+  try {+    const buf = new Uint8Array(20);+    await file.read(buf);+  } catch (e) {+    thrown = true;+  } finally {+    assert(thrown, "OpenMode.Write shouldn't allow to read file");+  }+  file.close();+  // assert that existing file is truncated on open+  file = await deno.open(filename, deno.OpenMode.Write);+  file.close();+  const fileSize = deno.statSync(filename).len;+  assertEqual(fileSize, 0);+  await deno.removeAll(tempDir);+});++testPerm({ write: true }, async function openModeWriteRead() {+  const tempDir = deno.makeTempDirSync();+  const encoder = new TextEncoder();+  const filename = tempDir + "hello.txt";+  const data = encoder.encode("Hello world!\n");++  let file = await deno.open(filename, deno.OpenMode.WriteRead);+  // assert file was created+  let fileInfo = deno.statSync(filename);+  assert(fileInfo.isFile());+  assertEqual(fileInfo.len, 0);+  // write some data+  await file.write(data);+  fileInfo = deno.statSync(filename);+  assertEqual(fileInfo.len, 13);++  // TODO: this test is not working, I expect because+  //  file handle points to the end of file, but ATM+  //  deno has no seek implementation on Rust side+  // assert file can be read+  // const buf = new Uint8Array(20);+  // const result = await file.read(buf);+  // console.log(result.eof, result.nread);+  // assertEqual(result.nread, 13);+  // file.close();+

Yes, I think you're correct. It's fine to leave this as a TODO for now.

bartlomieju

comment created time in 20 hours

issue commentdenoland/deno_install

Unable to find release page for None

I'm unable to repeat the failure. Further debugging would be helpful.

(And you can always download the binary manually at https://github.com/denoland/deno/releases - note that the gzip file contains only the executable binary which will have to be made executable with chmod.)

jerryturcios08

comment created time in 20 hours

push eventdenoland/deno_net

Ryan Dahl

commit sha 721306e7269301bde5dd192f941e0c92a4bd162e

Update travis to use v0.2.2 explicitly

view details

push time in 20 hours

push eventdenoland/registry

Ryan Dahl

commit sha 918aed0c84ba2b3270d98ea3483da168b48182e6

Rename denoland/net to denoland/deno_net

view details

push time in 20 hours

push eventdenoland/registry

Kitson Kelly

commit sha 6404534175b69d53ce586c957f7bff429230b4c7

Add colors package

view details

push time in 20 hours

PR merged denoland/registry

Add colors package

A basic package which provides console colors.

+2 -1

1 comment

1 changed file

kitsonk

pr closed time in 20 hours

push eventdenoland/deno

binaryta

commit sha c427c2df427f477eb1214d8ff3fdfad36e191a6c

Add TooLarge error code for buffers (#1298) In collaboration with @yushimatenjin

view details

push time in 20 hours

PR merged denoland/deno

Apply DenoError TooLarge

I've modified error type in js/buffer.ts to DenoError from Error, so added enum type to msg.fbs.

Test

  • [x] ./tools/test.py
  • [x] ./tools/test.py
  • [x] ./tools/format.py
+26 -2

0 comment

3 changed files

Tnarita0000

pr closed time in 20 hours

push eventdenoland/deno_net

Bartek Iwańczuk

commit sha c8e5d98900884f583d91c7c2526fca8bbc50be1b

Simple file server (#11)

view details

push time in 21 hours

PR merged denoland/deno_net

Simple file server

If you request path ending with slash (localhost:4500/foo/bar) it looks for index.html file in that dir.

Ideas for improvement:

  • addr option (-a/--addr 127.0.0.1:4500)
  • serve HTML page with directory structure if index.html missing

Closes #9

+42 -8

0 comment

2 changed files

bartlomieju

pr closed time in 21 hours

issue closeddenoland/deno_net

wanted: http file server program

I'd love to be able to do

alias file_server="deno https://deno.land/x/net/file_server.ts --allow-net"

and it would serve the cwd() in http. This is useful for developing HTML locally. Like this one https://www.npmjs.com/package/http-server

closed time in 21 hours

ry

push eventbartlomieju/net

Ryan Dahl

commit sha 45e268c235649842241b8183cca6e4dd9b668b49

Add comments to file_server.ts

view details

push time in 21 hours

push eventdenoland/deno_net

Bartek Iwańczuk

commit sha 0e82a4249ead38be9ff0e35b2df97eb6dc8ca139

set content-length for bodyless response

view details

push time in 21 hours

PR merged denoland/deno_net

Set content-length for bodyless response

Right now if you call req.respond({ status: 404 }) then browser keeps on waiting because content-length header is not set.

+6 -7

1 comment

1 changed file

bartlomieju

pr closed time in 21 hours

push eventdenoland/deno

Kevin (Kun) "Kassimo" Qian

commit sha f2447f6a2307369c16322861735a87fdd30f7233

Add more profiling and debugging guides

view details

push time in 2 days

PR merged denoland/deno

Add more profiling and debugging guides

Some discoveries myself when trying to profile and debug deno. I believe it might also be useful for others

+59 -4

0 comment

1 changed file

kevinkassimo

pr closed time in 2 days

issue commentdenoland/deno

Add a variable or func to get the path of the current script, like __dirname in Node.js

@janpot thanks - I didn’t know about that

fengmu456

comment created time in 2 days

issue openeddenoland/deno_net

wanted: http file server program

I'd love to be able to do alias file_server="deno https://deno.land/x/file_server.ts --allow-net" and it would serve the cwd() as a file server like this one https://www.npmjs.com/package/http-server

created time in 3 days

delete branch ry/deno

delete branch : bump_v0.2.2

delete time in 3 days

created tagdenoland/deno

tagv0.2.2

A secure TypeScript runtime on V8

created time in 3 days

push eventdenoland/deno

Ryan Dahl

commit sha e6121762f8bf3c531c4c60229ff4a156ae21d931

v0.2.2 - Don't crash when .mime file not exist in cache (#1291) - Process source maps in Rust instead of JS (#1280) - Use alternate TextEncoder/TextDecoder implementation (#1281) - Upgrade flatbuffers to 80d148 - Fix memory leaks (#1265, #1275)

view details

push time in 3 days

PR merged denoland/deno

v0.2.2
  • Don't crash when .mime file not exist in cache (#1291)
  • Process source maps in Rust instead of JS (#1280)
  • Use alternate TextEncoder/TextDecoder implementation (#1281)
  • Upgrade flatbuffers to 80d148
  • Fix memory leaks (#1265, #1275)
+2 -2

0 comment

2 changed files

ry

pr closed time in 3 days

PR opened denoland/deno

v0.2.2
  • Don't crash when .mime file not exist in cache (#1291)
  • Process source maps in Rust instead of JS (#1280)
  • Use alternate TextEncoder/TextDecoder implementation (#1281)
  • Upgrade flatbuffers to 80d148
  • Fix memory leaks (#1265, #1275)
+2 -2

0 comment

2 changed files

pr created time in 3 days

create barnchry/deno

branch : bump_v0.2.2

created branch time in 3 days

push eventdenoland/deno

Bartek Iwańczuk

commit sha ba429ccde860fa52258f0d5769a8d23f62029ecd

Add benchmark for net/http (#1289)

view details

push time in 3 days

PR merged denoland/deno

Add benchmark for net/http

Benchmark for HTTP server from https://github.com/denoland/net

Results from my machine:

$ ./tools/http_benchmark.py target/debug/deno ./target/debug/hyper_hello
http_benchmark testing DENO.
Listening on 127.0.0.1:4544
third_party/wrk/mac/wrk -d 10s http://127.0.0.1:4544/
Running 10s test @ http://127.0.0.1:4544/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     1.28ms  288.76us  10.82ms   93.95%
    Req/Sec     3.93k   390.48     4.37k    76.00%
  78223 requests in 10.00s, 3.80MB read
Requests/sec:   7822.43
Transfer/sec:    389.59KB

http_benchmark testing DENO using net/http.
Compiling /Users/biwanczuk/dev/deno/tests/xhttp_bench.ts
Downloading https://deno.land/x/net/http_status
Downloading https://deno.land/x/net/util
third_party/wrk/mac/wrk -d 10s http://127.0.0.1:4544/
Running 10s test @ http://127.0.0.1:4544/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     2.20ms  446.88us  17.78ms   94.81%
    Req/Sec     2.29k   160.77     2.39k    92.57%
  45952 requests in 10.10s, 2.19MB read
Requests/sec:   4549.43
Transfer/sec:    222.14KB

http_benchmark testing NODE.
port 4544
third_party/wrk/mac/wrk -d 10s http://127.0.0.1:4544/
Running 10s test @ http://127.0.0.1:4544/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   353.27us  281.79us  14.09ms   97.62%
    Req/Sec    14.55k     1.78k   17.08k    77.72%
  292399 requests in 10.10s, 31.23MB read
Requests/sec:  28949.17
Transfer/sec:      3.09MB

http_benchmark testing node_tcp.js
port 4544
third_party/wrk/mac/wrk -d 10s http://127.0.0.1:4544/
Running 10s test @ http://127.0.0.1:4544/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   156.49us   74.79us   3.37ms   85.96%
    Req/Sec    31.94k     3.12k   37.15k    76.24%
  642134 requests in 10.10s, 31.23MB read
Requests/sec:  63581.47
Transfer/sec:      3.09MB

http_benchmark testing RUST hyper.
Listening on http://127.0.0.1:4544
third_party/wrk/mac/wrk -d 10s http://127.0.0.1:4544/
Running 10s test @ http://127.0.0.1:4544/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   347.32us  302.80us   9.27ms   92.58%
    Req/Sec    15.22k   709.28    16.42k    86.14%
  305713 requests in 10.10s, 25.66MB read
Requests/sec:  30269.37
Transfer/sec:      2.54MB
+30 -3

10 comments

4 changed files

bartlomieju

pr closed time in 3 days

pull request commentdenoland/deno

Add benchmark for net/http

Rebased on top of Kevin's #1291. It's working locally for me now.

bartlomieju

comment created time in 3 days

push eventbartlomieju/deno

Kitson Kelly

commit sha 568ac0c9026b6f4012e2511a026bb5eb31a06020

Add ASCII support to TextDecoder

view details

Ryan Dahl

commit sha c113df1bb8a0c7d0c560ad32c0291c918c7da7b4

Process source maps in Rust instead of JS (#1280) - Improves speed and binary size significantly. - Makes deno_last_exception() output a JSON structure. - Isolate::execute and Isolate::event_loop now return structured, mapped JSError objects on errors. - Removes libdeno functions: libdeno.setGlobalErrorHandler() libdeno.setPromiseRejectHandler() libdeno.setPromiseErrorExaminer() In collaboration with Ryan Dahl.

view details

Kevin (Kun) "Kassimo" Qian

commit sha 0d3584cf4625c78a6f7f7568757d702d32755668

Don't crash when .mime file not exist in cache (#1291)

view details

Bartek Iwańczuk

commit sha 79876ef7d98eeae466be27eafd205fb65069f18f

add benchmark for net/http

view details

Ryan Dahl

commit sha 158c1bcd13b87dcc07dcf928b90bd8613208cc91

Load from submdoule

view details

push time in 3 days

push eventdenoland/deno

Kevin (Kun) "Kassimo" Qian

commit sha 0d3584cf4625c78a6f7f7568757d702d32755668

Don't crash when .mime file not exist in cache (#1291)

view details

push time in 3 days

PR merged denoland/deno

Don't crash when .mime file not exist in cache

This unblocks #1289 . See https://github.com/denoland/deno/pull/1289#issuecomment-445114354 Tested locally, benchmark is working with this fix in place.

+56 -2

3 comments

1 changed file

kevinkassimo

pr closed time in 3 days

Pull request review commentdenoland/deno

Don't crash when .mime file not exist in cache

 impl DenoDir {       (source, map_content_type(&p, Some(&content_type)))     } else {       let source = fs::read_to_string(&p)?;-      let content_type = fs::read_to_string(&mt)?;-      (source, map_content_type(&p, Some(&content_type)))+      // .mime file might not exists with bundled deps+      let maybe_content_type_string = fs::read_to_string(&mt).ok();+      // Option<String> -> Option<&str>+      let maybe_content_type_str =+        maybe_content_type_string.as_ref().map(String::as_str);+      (source, map_content_type(&p, maybe_content_type_str))

Thank you

kevinkassimo

comment created time in 3 days

Pull request review commentdenoland/deno

[WIP] Implementation of create file

 export const stdout = new File(1); /** An instance of `File` for stderr. */ export const stderr = new File(2); -// TODO This is just a placeholder - not final API.-export type OpenMode = "r" | "w" | "w+" | "x";+export enum OpenMode {+  /** Read-only, default mode.+   * Starts at beginning of file.+   */+  Read = "r",+  /** Read-write+   * Start at beginning of file.+   */+  ReadWrite = "r+",+  /** Write-only+   * Opens and truncates existing file or creates new one+   * for writing only.+   */+  Write = "w",+  /** Write-read+   * Opens and truncates existing file or creates new one+   * for writing and reading.+   */+  WriteRead = "w+",+  /** Append-only+   * Opens existing file or creates new one.+   * Each write appends content to file and doesn't overwrite+   * already existing content.+   */+  Append = "a",+  /** Append-read+   * Behaves like `OpenMode.Append` and allows to read from file.+   */+  AppendRead = "a+",+  /** Exclusive create+   * Creates new file only if one doesn't exist already.+   * Allows to write to file.+   */+  ExclusiveCreate = "x",+  /** Exclusive create - read+   * Behaves like `OpenMode.ExclusiveCreate` and allows to read from file.+   */+  ExclusiveCreateRead = "x+"+}  /** A factory function for creating instances of `File` associated with the  * supplied file name.  */ export function create(filename: string): Promise<File> {

Please keep. Default mode is here: https://github.com/golang/go/blob/master/src/os/file.go#L268-L275

bartlomieju

comment created time in 3 days

pull request commentdenoland/deno

[WIP] Implementation of create file

This looks great! r w x a with optional plus on any is the time tested interface.

Can you add some more tests? Add TODOs for the missing ones.

bartlomieju

comment created time in 3 days

Pull request review commentdenoland/deno

Process source maps in Rust instead of JS

 NotFound: Cannot resolve module "./non-existent" from "[WILDCARD]/tests/error_006_import_ext_failure.ts"+    at DenoError ([WILDCARD]/js/errors.ts:[WILDCARD])     at maybeError ([WILDCARD]/js/errors.ts:[WILDCARD])     at maybeThrowError ([WILDCARD]/js/errors.ts:[WILDCARD])     at sendSync ([WILDCARD]/js/dispatch.ts:[WILDCARD])-    at Object.codeFetch ([WILDCARD]/js/os.ts:[WILDCARD])-    at Compiler._resolveModule ([WILDCARD]/js/compiler.ts:[WILDCARD])+    at codeFetch ([WILDCARD]/js/os.ts:[WILDCARD])+    at _resolveModule ([WILDCARD]/js/compiler.ts:[WILDCARD])     at moduleNames.map.name ([WILDCARD]/js/compiler.ts:[WILDCARD])-    at Array.map (<anonymous>)

It seems the C++ API and the JS API do not map to the same thing. Maybe we can hone these down into actual examples and send bugs to them.

ry

comment created time in 3 days

Pull request review commentdenoland/deno

Process source maps in Rust instead of JS

 NotFound: Cannot resolve module "./non-existent" from "[WILDCARD]/tests/error_006_import_ext_failure.ts"+    at DenoError ([WILDCARD]/js/errors.ts:[WILDCARD])     at maybeError ([WILDCARD]/js/errors.ts:[WILDCARD])     at maybeThrowError ([WILDCARD]/js/errors.ts:[WILDCARD])     at sendSync ([WILDCARD]/js/dispatch.ts:[WILDCARD])-    at Object.codeFetch ([WILDCARD]/js/os.ts:[WILDCARD])-    at Compiler._resolveModule ([WILDCARD]/js/compiler.ts:[WILDCARD])+    at codeFetch ([WILDCARD]/js/os.ts:[WILDCARD])+    at _resolveModule ([WILDCARD]/js/compiler.ts:[WILDCARD])     at moduleNames.map.name ([WILDCARD]/js/compiler.ts:[WILDCARD])-    at Array.map (<anonymous>)

anonymous functions are not in the info provided by v8::StackTrace ... that said there's information in the structure that isn't being displaying in the current JSError::to_string() .. so we can probably improve the output. But AFAICS there's no way to know if there's an anonymous stack frame...

ry

comment created time in 3 days

Pull request review commentdenoland/deno

Don't crash when .mime file not exist in cache

 impl DenoDir {       (source, map_content_type(&p, Some(&content_type)))     } else {       let source = fs::read_to_string(&p)?;-      let content_type = fs::read_to_string(&mt)?;-      (source, map_content_type(&p, Some(&content_type)))+      // .mime file might not exists with bundled deps+      let maybe_content_type_string = fs::read_to_string(&mt).ok();+      // Option<String> -> Option<&str>+      let maybe_content_type_str =+        maybe_content_type_string.as_ref().map(String::as_str);+      (source, map_content_type(&p, maybe_content_type_str))

Is it possible to get a test below?

kevinkassimo

comment created time in 3 days

push eventdenoland/deno_third_party

Kitson Kelly

commit sha 6a75dd4d8f54c7cde4663d265cad61838c3b5891

Add serde_json crate

view details

Ryan Dahl

commit sha 7d8c9aa769778140e1619f545e706bf34545509e

Remove source-map-support package.

view details

push time in 3 days

CommitCommentEvent

PR closed denoland/deno_net

Add media types to be able to use as local cache

Fixes an issue blocking denoland/deno#1289. When treating a set of files like a local cache of dependencies, the .mime files need to be provided to ensure that Deno can properly processes the files.

+12 -0

2 comments

12 changed files

kitsonk

pr closed time in 3 days

Pull request review commentdenoland/deno

Process source maps in Rust instead of JS

 static inline v8::Local<v8::String> v8_str(const char* x) {       .ToLocalChecked(); } -void HandleExceptionStr(v8::Local<v8::Context> context,-                        v8::Local<v8::Value> exception,-                        std::string* exception_str) {+std::string EncodeExceptionAsJSON(v8::Local<v8::Context> context,+                                  v8::Local<v8::Value> exception) {   auto* isolate = context->GetIsolate();-  DenoIsolate* d = FromIsolate(isolate);-   v8::HandleScope handle_scope(isolate);   v8::Context::Scope context_scope(context);    auto message = v8::Exception::CreateMessage(isolate, exception);   auto stack_trace = message->GetStackTrace();-  auto line =-      v8::Integer::New(isolate, message->GetLineNumber(context).FromJust());-  auto column =-      v8::Integer::New(isolate, message->GetStartColumn(context).FromJust());--  auto global_error_handler_ = d->global_error_handler_.Get(isolate);--  if (!global_error_handler_.IsEmpty()) {-    // global_error_handler_ is set so we try to handle the exception in-    // javascript.-    v8::Local<v8::Value> args[5];-    args[0] = exception->ToString(context).ToLocalChecked();-    args[1] = message->GetScriptResourceName();-    args[2] = line;-    args[3] = column;-    args[4] = exception;-    global_error_handler_->Call(context->Global(), 5, args);-    /* message, source, lineno, colno, error */ -    return;-  }+  // Encode the exception into a JS object, which we will then turn into JSON.+  auto json_obj = v8::Object::New(isolate);++  auto exception_str = exception->ToString(context).ToLocalChecked();+  // Alternate and very similar string. Not sure which is appropriate.

It's really strange, like maybe "Undefined:" instead of "Error Undefined:" ... it must come from two different sources.

ry

comment created time in 4 days

delete branch ry/deno

delete branch : rust-handle-errors2

delete time in 4 days

push eventdenoland/deno

Ryan Dahl

commit sha c113df1bb8a0c7d0c560ad32c0291c918c7da7b4

Process source maps in Rust instead of JS (#1280) - Improves speed and binary size significantly. - Makes deno_last_exception() output a JSON structure. - Isolate::execute and Isolate::event_loop now return structured, mapped JSError objects on errors. - Removes libdeno functions: libdeno.setGlobalErrorHandler() libdeno.setPromiseRejectHandler() libdeno.setPromiseErrorExaminer() In collaboration with Ryan Dahl.

view details

push time in 4 days

PR merged denoland/deno

Process source maps in Rust instead of JS

This is in collaboration with @kitsonk ( originally #1178 )

This patch reduces binary size on OSX by 27mb

~/src/deno> ls -lh target/release/deno
-rwxr-xr-x  1 rld  staff    40M Dec  5 14:19 target/release/deno
~/src/deno> ls -lh `which deno`
-rwxr--r--  1 rld  staff    67M Nov 30 20:11 /Users/rld/.deno/bin/deno

It speeds up warm startup by 2.5x

> hyperfine --ignore-failure --warmup 3 "target/release/deno tests/002_hello.ts"  "deno tests/002_hello.ts"
Benchmark #1: target/release/deno tests/002_hello.ts

  Time (mean ± σ):      69.7 ms ±   2.1 ms    [User: 44.4 ms, System: 22.4 ms]

  Range (min … max):    66.3 ms …  78.0 ms

Benchmark #2: deno tests/002_hello.ts

  Time (mean ± σ):     174.9 ms ±  15.3 ms    [User: 121.8 ms, System: 48.9 ms]

  Range (min … max):   156.5 ms … 217.0 ms

Summary

  'target/release/deno tests/002_hello.ts' ran
    2.51x faster than 'deno tests/002_hello.ts'

Speeds up cold startup by 1.27x

> hyperfine --ignore-failure --warmup 3 "target/release/deno tests/002_hello.ts --recompile "  "deno tests/002_hello.ts --recompile"
Benchmark #1: target/release/deno tests/002_hello.ts --recompile

  Time (mean ± σ):     472.8 ms ±   9.4 ms    [User: 766.3 ms, System: 42.6 ms]

  Range (min … max):   463.0 ms … 495.5 ms

Benchmark #2: deno tests/002_hello.ts --recompile

  Time (mean ± σ):     601.8 ms ±   8.5 ms    [User: 980.7 ms, System: 74.0 ms]

  Range (min … max):   594.0 ms … 623.9 ms

Summary

  'target/release/deno tests/002_hello.ts --recompile ' ran
    1.27x faster than 'deno tests/002_hello.ts --recompile'

And speeds up exception handling by 1.8x

> hyperfine --ignore-failure --warmup 3 "target/release/deno tests/error_001.ts"  "deno tests/error_001.ts"
Benchmark #1: target/release/deno tests/error_001.ts

  Time (mean ± σ):     106.0 ms ±   1.5 ms    [User: 74.1 ms, System: 28.2 ms]

  Range (min … max):   102.7 ms … 109.1 ms

  Warning: Ignoring non-zero exit code.

Benchmark #2: deno tests/error_001.ts

  Time (mean ± σ):     199.4 ms ±   2.3 ms    [User: 140.0 ms, System: 52.7 ms]

  Range (min … max):   196.5 ms … 203.8 ms

  Warning: Ignoring non-zero exit code.

Summary

  'target/release/deno tests/error_001.ts' ran
    1.88x faster than 'deno tests/error_001.ts'
+857 -810

1 comment

30 changed files

ry

pr closed time in 4 days

push eventry/deno

Ryan Dahl

commit sha 45320beca82518e998614d2cbb4e733a47b7fef9

Upgrade flatbuffers to 80d148

view details

F001

commit sha 60c008d23b2bdad333711b43148a5053e83a62cc

Isolate::from_raw_ptr and other cleanups. `Isolate::from_void_ptr` is renamed to `from_raw_ptr`, to keep consistency with std libs. It is changed to `unsafe` function, because it can't guarantee that the input is valid. This guarantee should be provided by the caller. Its return type is changed to `&Isolate`, because `&mut Isolate` type requires that no other aliases co-exist in this period of time, this does not seem true. So I changed most of the methods to accept shared reference `&Isolate`. It is easier to reason about the correctness of `unsafe` blocks. As long as these shared references are in the same thread, these `unsafe` codes are probably correct.

view details

Kitson Kelly

commit sha 6cc89b9e272440d93b6354f098031c3a22803686

Use alternate TextEncoder/TextDecoder implementation (#1281) This is faster and smaller.

view details

Kitson Kelly

commit sha 0239104df9a3f346e4e4aff02eda400b3d7c186a

Process source maps in Rust instead of JS - Improves speed and binary size significantly. - Makes deno_last_exception() output a JSON structure. - Isolate::execute and Isolate::event_loop now return structured, mapped JSError objects on errors. - Removes libdeno functions: libdeno.setGlobalErrorHandler() libdeno.setPromiseRejectHandler() libdeno.setPromiseErrorExaminer() In collaboration with Ryan Dahl.

view details

Ryan Dahl

commit sha 902cb90528001428760a356f5266af88378eac30

Review comments

view details

Ryan Dahl

commit sha 05d536af4408933f2e57504e2d364dbf12dd1d82

add GlobalErrorHandling test

view details

Ryan Dahl

commit sha 791bf77f8e56039e9df6009f6805cede2ba758f4

Add deno.h API TODO

view details

Ryan Dahl

commit sha ebc3286f1e451f27b2ffc573ab7b800b37375b1a

Fix pre-deno exception printing.

view details

Ryan Dahl

commit sha a4f262b4b72c46a3c13def1ff56b02e4a147c12a

WIP add deno_resolve_cb for ES module support LibDenoTest.ModuleResolution passes

view details

Ryan Dahl

commit sha 1fbce415c751b06a21af3afe104f35c4cc79254a

fixup

view details

Ryan Dahl

commit sha cec97f96e8910f8331758b618dbdc82b06b0efce

wip

view details

Ryan Dahl

commit sha 955ac4b565ede92e854894f64172910ef715b400

compiler worker wip

view details

push time in 4 days

Pull request review commentdenoland/deno

Remove UserDataScope hack

 class DenoIsolate {       isolate_->Dispose();     }     delete array_buffer_allocator_;+    array_buffer_allocator_ = nullptr;+    isolate_ = nullptr;+    shared_ = empty_buf;+    current_args_ = nullptr;+    snapshot_creator_ = nullptr;+    global_import_buf_ptr_ = nullptr;+    pending_promise_events_ = 0;+    recv_cb_ = nullptr;+    next_req_id_ = 0;+    user_data_ = nullptr;

I think neither is useful. This is the purpose of ASAN.

That said, if @F001 wants this for debugging, with the expectation that we will remove it later (when ASAN runs on deno) that's okay with me. I prefer this to memset.

F001

comment created time in 4 days

issue commentdenoland/deno

Add a variable or func to get the path of the current script, like __dirname in Node.js

I think it would be nice if we could do

import { uint8Array } from "./style.css";

that is, statically resolving and including non-javascript files. Maybe that negates the need to have __dirname.

I'm not necessarily against it but I think it would be nice if we could avoid it. Let's add the above feature before doing __dirname.

fengmu456

comment created time in 4 days

push eventdenoland/deno

Kitson Kelly

commit sha 568ac0c9026b6f4012e2511a026bb5eb31a06020

Add ASCII support to TextDecoder

view details

push time in 4 days

PR merged denoland/deno

Add ASCII support to TextDecoder

Fixes #1288

This adds support for single byte decoders and the code point encodings for windows-1252 which is a superset of ascii and us-ascii and latin1 plus a few others. It also makes it easier to add extra decoders in the future if required.

+127 -13

0 comment

2 changed files

kitsonk

pr closed time in 4 days

issue closeddenoland/deno

Support TextDecoder("ascii")

support removed in https://github.com/denoland/deno/pull/1281

cc @kitsonk

closed time in 4 days

ry

pull request commentdenoland/deno

Read version from Cargo.toml

@ruphin You can't set env vars in GN. Pass the version as an argument to https://github.com/denoland/deno/blob/master/build_extra/rust/run.py you can set the env there.

ruphin

comment created time in 4 days

pull request commentdenoland/deno

Add benchmark for net/http

I updated the branch to use submodules. But I'm getting an unexpected error now

~/src/deno> ./tools/http_benchmark.py target/release/deno
http_benchmark testing DENO using net/http.
Compiling /Users/rld/src/deno/js/deps/https/deno.land/x/net/http_bench.ts
Downloading https://deno.land/x/net/http.ts.ts
Downloading https://deno.land/x/net/http.ts.js
NotFound: Cannot resolve module "./http.ts" from "/Users/rld/src/deno/js/deps/https/deno.land/x/net/http_bench.ts"
    at DenoError (deno/js/errors.ts:19:5)
    at maybeError (deno/js/errors.ts:38:12)
    at maybeThrowError (deno/js/errors.ts:26:15)
    at sendSync (deno/js/dispatch.ts:67:5)
    at codeFetch (deno/js/os.ts:41:19)
    at _resolveModule (deno/js/compiler.ts:235:38)
    at moduleNames.map.name (deno/js/compiler.ts:514:31)
bartlomieju

comment created time in 4 days

push eventbartlomieju/deno

Ryan Dahl

commit sha ee8230b64165461ffb7833c86ab0dda9783ba28d

format

view details

push time in 4 days

push eventbartlomieju/deno

Ryan Dahl

commit sha 7b23114eeab4abdcbc171724b3ce7919e4f1e45a

Use http git url

view details

push time in 4 days

push eventbartlomieju/deno

Ryan Dahl

commit sha 41ca31cdc28e16ff071c6738fe3f1ee283adf4d2

Move net_http_bench.ts to net submodule

view details

push time in 4 days

push eventdenoland/deno_net

Ryan Dahl

commit sha 958dadc8752f1aface8cff39c56011b016fb1460

Relative import for http_bench.ts

view details

push time in 4 days

push eventdenoland/deno_net

Ryan Dahl

commit sha 82ceb596f3d1f75b1711117767e26cfac8b64945

Add http_bench.ts

view details

push time in 4 days

push eventdenoland/deno_net

Ryan Dahl

commit sha f3bce9c7b8e75846c33d4b8672510092b92b3139

Format

view details

push time in 4 days

push eventbartlomieju/deno

Ryan Dahl

commit sha 2075fddfcf858348c1da43ab414e36944ab8a315

Load from submdoule

view details

push time in 4 days

push eventry/deno

Ryan Dahl

commit sha 791bf77f8e56039e9df6009f6805cede2ba758f4

Add deno.h API TODO

view details

push time in 4 days

push eventry/deno

Ryan Dahl

commit sha 05d536af4408933f2e57504e2d364dbf12dd1d82

add GlobalErrorHandling test

view details

push time in 4 days

push eventry/deno

Ryan Dahl

commit sha ff7f200e72b76ae2e2913896b12fea0e035e1540

Readd GlobalErrorHandling test

view details

push time in 4 days

push eventdenoland/net

Kevin (Kun) "Kassimo" Qian

commit sha 1bf555ab2f9c6074b07697d72cb93f276ecf5bb1

Unblock server on multiple HTTP requests (#3)

view details

push time in 4 days

PR merged denoland/net

Unblock server on multiple HTTP requests

Closes #1 . Resolve the immediate cause for blocking, by making new conn accept and readRequest of same level and async, with Promise.race. Now http_test.ts should work properly.

(Currently there will be warnings of Promise resolved after resolved. The warning would go away after denoland/deno#1273)

Socket is closed for now once responding. Will need to change this behavior later. Sockets are left open now until EOF.

I'm not quite sure if this fix is proper, and whether I should keep serveConn (since it is exported) I will work more on http based on feedback for this change.

+80 -31

4 comments

2 changed files

kevinkassimo

pr closed time in 4 days

issue closeddenoland/net

http_test.ts

chrome is ok but curl and firefox never response

./deno_osx_x64 --version
deno: 0.1.12
v8: 7.1.302.4
typescript: 3.1.6
import { serve } from "https://deno.land/x/net/http.ts";

const addr = "127.0.0.1:8090";
const s = serve(addr);
console.log(`listening on http://${addr}/`);

const body = (new TextEncoder()).encode("Hello World\n");


async function main() {
  for await (const req of s) {
  await req.respond({ status: 200, body });
  }
}

main();
curl http://127.0.0.1:8090/
curl: (56) Recv failure: Connection reset by peer

closed time in 4 days

wangtxxl

push eventkevinkassimo/deno_net

Ryan Dahl

commit sha 42f36c902bc56e86878cfcf98e8611b683259c00

prettier

view details

push time in 4 days

Pull request review commentdenoland/net

Unblock server on multiple HTTP requests

 import { TextProtoReader } from "./textproto.ts"; import { STATUS_TEXT } from "./http_status"; import { assert } from "./util"; +interface Deferred {+  promise: Promise<{}>;+  resolve: () => void;+  reject: () => void;+}++function deferred(): Deferred {+  let resolve, reject;+  const promise = new Promise((res, rej) => {+    resolve = res;+    reject = rej;+  });+  return {+    promise, resolve, reject,+  };+}++interface ServeEnv {+  reqQueue: ServerRequest[];+  serveDeferred: Deferred;+}++// Continuously read more requests from conn until EOF+// Mutually calling with maybeHandleReq+// TODO: make them async function after this change is done+// https://github.com/tc39/ecma262/pull/1250+// See https://v8.dev/blog/fast-async+export function serveConn(env: ServeEnv, conn: Conn) {+  readRequest(conn).then(maybeHandleReq.bind(null, env, conn));+}+function maybeHandleReq(env: ServeEnv, conn: Conn, maybeReq: any) {

Please run prettier.

kevinkassimo

comment created time in 4 days

Pull request review commentdenoland/net

Unblock server on multiple HTTP requests

 import { TextProtoReader } from "./textproto.ts"; import { STATUS_TEXT } from "./http_status"; import { assert } from "./util"; +interface Deferred {+  promise: Promise<{}>;+  resolve: () => void;+  reject: () => void;+}++function deferred(): Deferred {+  let resolve, reject;+  const promise = new Promise((res, rej) => {+    resolve = res;+    reject = rej;+  });+  return {+    promise, resolve, reject,+  };+}+ export async function* serve(addr: string) {   const listener = listen("tcp", addr);-  while (true) {-    const c = await listener.accept();-    yield* serveConn(c);+  let serveDeferred = deferred();+  let reqQueue: ServerRequest[] = []; // in case multiple promises are ready++  // Continuously read more requests from conn until EOF+  // Mutually calling with handleReq+  const readRequestsFromConn = async (conn: Conn) => {+    const [req, _err] = await readRequest(conn);+    if (_err) {+      conn.close(); // assume EOF, for now+      return;+    }+    handleReq(conn, req);+  }+  const handleReq = (conn: Conn, req: ServerRequest) => {+    reqQueue.push(req); // push req to queue+    readRequestsFromConn(conn); // try read more (reusing connection)+    serveDeferred.resolve(); // signal while loop to process it   }-  listener.close();-} -export async function* serveConn(c: Conn) {-  let bufr = new BufReader(c);-  let bufw = new BufWriter(c);-  try {-    while (true) {-      const [req, err] = await readRequest(bufr);-      if (err == "EOF") {-        break;-      }-      if (err == "ShortWrite") {-        console.log("ShortWrite error");-        break;-      }-      if (err) {-        throw err;-      }-      req.w = bufw;-      yield req;+  // Routine that keeps calling accept+  const acceptRoutine = () => {+    const handleConn = (conn: Conn) => {+      readRequestsFromConn(conn); // don't block+      scheduleAccept(); // schedule next accept+    }+    const scheduleAccept = () => {+      listener.accept().then(handleConn);+    }+    scheduleAccept();+  }++  acceptRoutine();++  // Loop hack to allow yield (yield won't work in callbacks)

Ok. I understand what this is all about now - it's because serve() is a generator...

kevinkassimo

comment created time in 4 days

Pull request review commentdenoland/net

Unblock server on multiple HTTP requests

 import { TextProtoReader } from "./textproto.ts"; import { STATUS_TEXT } from "./http_status"; import { assert } from "./util"; +interface Deferred {+  promise: Promise<{}>;+  resolve: () => void;+  reject: () => void;+}++function deferred(): Deferred {+  let resolve, reject;+  const promise = new Promise((res, rej) => {+    resolve = res;+    reject = rej;+  });+  return {+    promise, resolve, reject,+  };+}+ export async function* serve(addr: string) {   const listener = listen("tcp", addr);-  while (true) {-    const c = await listener.accept();-    yield* serveConn(c);+  let serveDeferred = deferred();+  let reqQueue: ServerRequest[] = []; // in case multiple promises are ready++  // Continuously read more requests from conn until EOF+  // Mutually calling with handleReq+  const readRequestsFromConn = async (conn: Conn) => {

Can you rename this to serveConn (to keep the similar naming as the Go implementation)

Is it possible to make these closures into top-level functions? It would be preferable so that they could be tested independently.

kevinkassimo

comment created time in 4 days

push eventdenoland/net

Ryan Dahl

commit sha 718d1da8535d9ee8c99a33b7f62b6235eb3a6824

Use Utf8 instead of ASCII in TextDecoder See https://github.com/denoland/deno/issues/1288

view details

push time in 4 days

issue openeddenoland/deno

Support TextDecoder("ascii")

cc @kitsonk

created time in 4 days

Pull request review commentdenoland/deno

Process source maps in Rust instead of JS

 impl log::Log for Logger {   fn flush(&self) {} } +fn print_err_and_exit(err: js_errors::JSError) {+  // TODO Currently tests depend on exception going to stdout. It should go+  // to stderr.+  println!("{}", err.to_string());+  std::process::exit(1);

Added link.

ry

comment created time in 4 days

Pull request review commentdenoland/deno

Process source maps in Rust instead of JS

 void PromiseRejectCallback(v8::PromiseRejectMessage promise_reject_message) {   DenoIsolate* d = static_cast<DenoIsolate*>(isolate->GetData(0));   DCHECK_EQ(d->isolate_, isolate);   v8::HandleScope handle_scope(d->isolate_);-  auto exception = promise_reject_message.GetValue();+  auto error = promise_reject_message.GetValue();   auto context = d->context_.Get(d->isolate_);   auto promise = promise_reject_message.GetPromise();-  auto event = promise_reject_message.GetEvent();    v8::Context::Scope context_scope(context);-  auto promise_reject_handler = d->promise_reject_handler_.Get(isolate);--  if (!promise_reject_handler.IsEmpty()) {-    v8::Local<v8::Value> args[3];-    args[1] = v8_str(PromiseRejectStr(event));-    args[2] = promise;-    /* error, event, promise */-    if (event == v8::PromiseRejectEvent::kPromiseRejectWithNoHandler) {-      d->pending_promise_events_++;-      // exception only valid for kPromiseRejectWithNoHandler-      args[0] = exception;-    } else if (event ==-               v8::PromiseRejectEvent::kPromiseHandlerAddedAfterReject) {-      d->pending_promise_events_--;  // unhandled event cancelled-      if (d->pending_promise_events_ < 0) {-        d->pending_promise_events_ = 0;-      }-      // Placeholder, not actually used-      args[0] = v8_str("Promise handler added");-    } else if (event == v8::PromiseRejectEvent::kPromiseResolveAfterResolved) {-      d->pending_promise_events_++;-      args[0] = v8_str("Promise resolved after resolved");-    } else if (event == v8::PromiseRejectEvent::kPromiseRejectAfterResolved) {-      d->pending_promise_events_++;-      args[0] = v8_str("Promise rejected after resolved");-    }-    promise_reject_handler->Call(context->Global(), 3, args);-    return;++  int promise_id = promise->GetIdentityHash();+  switch (promise_reject_message.GetEvent()) {+    case v8::kPromiseRejectWithNoHandler:+      // Insert the error into the pending_promise_map_ using the promise's id+      // as the key.+      d->pending_promise_map_.emplace(std::piecewise_construct,+                                      std::make_tuple(promise_id),+                                      std::make_tuple(d->isolate_, error));+      // rejectMap.set(promise, (error as Error).stack ||+      // "RejectWithNoHandler");+      break;++    case v8::kPromiseHandlerAddedAfterReject:+      // unhandled event cancelled+      d->pending_promise_map_.erase(promise_id);+      // rejectMap.delete(promise);+      break;++    case v8::kPromiseRejectAfterResolved:+      // Should not warn. See #1272

Fixed.

ry

comment created time in 4 days

push eventry/deno

Ryan Dahl

commit sha 902cb90528001428760a356f5266af88378eac30

Review comments

view details

push time in 4 days

push eventry/deno

Kitson Kelly

commit sha 0239104df9a3f346e4e4aff02eda400b3d7c186a

Process source maps in Rust instead of JS - Improves speed and binary size significantly. - Makes deno_last_exception() output a JSON structure. - Isolate::execute and Isolate::event_loop now return structured, mapped JSError objects on errors. - Removes libdeno functions: libdeno.setGlobalErrorHandler() libdeno.setPromiseRejectHandler() libdeno.setPromiseErrorExaminer() In collaboration with Ryan Dahl.

view details

push time in 4 days

push eventry/deno

Kitson Kelly

commit sha 5c62d296a4e7a04313c783d88fd554ca4279640e

Process source maps in Rust instead of JS - Improves speed and binary size significantly. - Makes deno_last_exception() output a JSON structure. - Isolate::execute and Isolate::event_loop now return structured, mapped JSError objects on errors. In collaboration with Ryan Dahl.

view details

push time in 4 days

pull request commentdenoland/deno

WIP Process source maps in Rust instead of JS

I've added a TODO regarding Error.prototype.prepareStackTrace - good point.

ry

comment created time in 4 days

Pull request review commentdenoland/deno

WIP Process source maps in Rust instead of JS

 NotFound: Cannot resolve module "bad-module.ts" from "[WILDCARD]/tests/error_005_missing_dynamic_import.ts"+    at DenoError ([WILDCARD]/js/errors.ts:[WILDCARD])     at maybeError ([WILDCARD]/js/errors.ts:[WILDCARD])     at maybeThrowError ([WILDCARD]/js/errors.ts:[WILDCARD])     at sendSync ([WILDCARD]/js/dispatch.ts:[WILDCARD])-    at Object.codeFetch ([WILDCARD]/js/os.ts:[WILDCARD])-    at Compiler._resolveModule ([WILDCARD]/js/compiler.ts:[WILDCARD])+    at codeFetch ([WILDCARD]/js/os.ts:[WILDCARD])+    at _resolveModule ([WILDCARD]/js/compiler.ts:[WILDCARD])     at moduleNames.map.name ([WILDCARD]/js/compiler.ts:[WILDCARD])-    at Array.map (<anonymous>)-    at Compiler.resolveModuleNames ([WILDCARD]/js/compiler.ts:[WILDCARD])-    at Object.compilerHost.resolveModuleNames (<anonymous>)-    at resolveModuleNamesWorker (<anonymous>)+    at resolveModuleNames ([WILDCARD]/js/compiler.ts:[WILDCARD])+    at compilerHost.resolveModuleNames ([WILDCARD])

I looked hard for it - it's missing. It seems to be an oversight. We'll have to submit a bug to V8 and fix it there.

ry

comment created time in 4 days

Pull request review commentdenoland/deno

WIP Process source maps in Rust instead of JS

+// Copyright 2018 the Deno authors. All rights reserved. MIT license.++// Note that source_map_mappings requires 0-indexed line and column numbers but+// V8 Exceptions are 1-indexed.++#![allow(dead_code)]

Good point. I've added a TODO

ry

comment created time in 4 days

push eventry/deno

Kitson Kelly

commit sha 6cc89b9e272440d93b6354f098031c3a22803686

Use alternate TextEncoder/TextDecoder implementation (#1281) This is faster and smaller.

view details

Kitson Kelly

commit sha 617adbfcf39080311cd1fdfe114a8dad2a779edc

Stage 1: Stacks in RS Stage 2: Remap stacks in Rust Stage 2b: Remap to original bundle position in Rust Rebasing and minor fixes work in stable

view details

Ryan Dahl

commit sha f3b418a1dd90204752288a947c50a83fbc1c008f

Adjust integration tests so they pass

view details

Ryan Dahl

commit sha 3c57bd99201a6129654b4e6eb17d7e2277533cb3

source maps work debug SourceMap::from_json better sourcemap caching Source map improvements promise reject handler reimplemented in c++ replace assert with CHECK Use JSON to encode V8 exceptions. Review comments

view details

push time in 4 days

create barnchdenoland/deno_third_party

branch : 20181206_source_maps

created branch time in 4 days

push eventdenoland/deno_third_party

Kitson Kelly

commit sha e058979631fd3ecc55f8995a02eaa6ff8f35c321

Remove text-encoding

view details

push time in 4 days

push eventdenoland/deno

Kitson Kelly

commit sha 6cc89b9e272440d93b6354f098031c3a22803686

Use alternate TextEncoder/TextDecoder implementation (#1281) This is faster and smaller.

view details

push time in 4 days

PR merged denoland/deno

Integrate TextEncoder/TextDecoder directly

Fixes #1210

This PR removes the npm package text-encoding and integrates a TypeScript authored version of TextEncoder/TextDecoder that only supports UTF8 encoding.

+366 -42

2 comments

9 changed files

kitsonk

pr closed time in 4 days

issue closeddenoland/deno

Replace text-encoding

I worry about the performance of TextEncoder and TextDecorder, especially if we get more reliant upon them for dealing with [ubyte] arrays to strings in the runtime. The author has halted development on it and is no longer maintaining it. It also focused very heavily on spec compliance, versus any sort of performance (as per the authors notes). As I was trawling though the bundle recently, I looked at the code. It has a lot of overhead in there. Specifically the encoding_indexes is a load of data injected in the global namespace to power that support. I think this is what specifically led to the increase in snapshot size.

So I think we either need to replace it, by injecting the native implementations into the isolates somehow, or using fast-text-encoding instead, which only supports UTF8 encoding/decoding anyways (native implementations only support alternative encodings on decode anyways).

closed time in 4 days

kitsonk

push eventry/deno

Ryan Dahl

commit sha a1a17fdc33c1b7633ddf465058493d6860d83a00

source maps work debug SourceMap::from_json better sourcemap caching Source map improvements promise reject handler reimplemented in c++ replace assert with CHECK Use JSON to encode V8 exceptions.

view details

Ryan Dahl

commit sha 8ee4eda7485c6df8fd1f2a3f178cd776d154d1c8

Adjust integration tests so they pass

view details

push time in 4 days

push eventry/deno

Ryan Dahl

commit sha addf6f2634f3fe90c5c5490c25ca69d56a627b4e

Use JSON to encode V8 exceptions.

view details

push time in 4 days

more