profile
viewpoint
Atty Eleti athyuttamre @stripe San Francisco, CA http://athyuttamre.com

athyuttamre/locale-switcher 9

Chrome Extension to quickly switch your browser locale.

athyuttamre/accessible-facebook-ui 5

Accessible version of Facebook, built for eye-tracking devices.

athyuttamre/epik 2

An over-engineered todo-app.

athyuttamre/attylove 1

Send love to my pulsating heart-shaped desk lamp.

athyuttamre/drink-guage 1

Android app to calculate blood alcohol percentage.

athyuttamre/hello-world 1

An example Koa app.

athyuttamre/microblog 1

A microblog in Flask.

athyuttamre/athyuttamre.github.io 0

My personal website.

athyuttamre/chatroom 0

Chatroom web-app based on continuous polling.

issue commentprettier/prettier

JSON range formatting throws syntax error

Also ran into the same issue. Not a blocker since I can format the whole file for my use case, but was hoping to get a performance boost by only formatting part of the file that changed.

trevorah

comment created time in 2 months

issue openedmicrosoft/monaco-editor

Better docs on website

In implementing a project using Monaco, I've found the lack of dedicated docs (quickstarts, guides, references, recipes, etc.) a problem. I've mostly found my way around by reading old issues, StackOverflow answers, and searching in the API reference, but more prose would have been helpful.

Is there a plan to create a dedicated docs site? https://docusaurus.io makes this somewhat easy, if we wanted to use it. I'm happy to help contribute some initial text.

created time in 2 months

startedmicrosoft/monaco-languages

started time in 2 months

startedbolinfest/monaco-tm

started time in 2 months

issue commentmicrosoft/monaco-editor

Revisit WebAssembly to support TextMate grammars

Would love to see this as well. I found this blog post from the creator of CodeSandbox where they got this working, and now support VSCode themes in Monaco: https://medium.com/@compuives/introducing-themes-e6818088bfc2.

CitrusFruits

comment created time in 2 months

startedbrijeshb42/monaco-themes

started time in 2 months

startedjamiebuilds/the-super-tiny-compiler

started time in 2 months

startedrsms/graphviz

started time in 2 months

startedrsms/markdown-wasm

started time in 2 months

startedbaryla/packager

started time in 2 months

issue closedevanw/esbuild

Should not eliminate dead code if `new Function(...)` exists

Hey Evan! I found an issue with dead code elimination in an edge case that involves declaring a function using new Function(...). I'm using commit 25b92bfbb7278e1ce1f9005367eccaf3cf1d9d48 locally.

Context: In addition to the normal function f() {...} and const f = () => {...} syntax for declaring functions, JS also allows declaring functions via an eval-like format: const f = new Function('return 1') (docs on MDN). Functions declared like this can only operate in the global scope.

Our test case:

// demo/new-function.js
function foo() { return 1; }
const callFoo = new Function('return foo()');
console.log(callFoo());

Running esbuild --bundle demo/new-function.js has the effect of removing foo() altogether:

$ ./esbuild --bundle demo/new-function.js
(() => {
  // demo/new-function.js
  const callFoo = new Function("return foo()");
  console.log(callFoo());
})();
$

I think this is a logic error, and has to do with dead code elimination assuming that foo() is not used anywhere. Doing something like what we do with eval is likely to fix this (but only in the global scope, since these functions only operate there).

https://github.com/evanw/esbuild/blob/25b92bfbb7278e1ce1f9005367eccaf3cf1d9d48/internal/ast/ast.go#L1092-L1095

While I wasn't able to repro simply, the same issue might also show up via minification (imagine that we kept the function, but renamed it to a(); the code would still fail).

I'm happy to help fix this if I could get some pointers on where to start. Totally ok if you prefer to just fix it too.

Thanks for all the great work with esbuild!


One caveat is that the test case doesn't actually run in Node, but does run in the browser (at least in WebKit in Safari, where I tested).

Node.js:

$ node --version
v14.4.0
$ node demo/new-function.js
undefined:3
return foo()
^

ReferenceError: foo is not defined
    at eval (eval at <anonymous> (/Users/athyuttamre/Work/github/esbuild/demo/new-function.js:2:17), <anonymous>:3:1)
    at Object.<anonymous> (/Users/athyuttamre/Work/github/esbuild/demo/new-function.js:3:13)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
$

Webkit in Safari: Screen Shot 2020-06-24 at 12 41 25 AM

closed time in 2 months

athyuttamre

issue commentevanw/esbuild

Should not eliminate dead code if `new Function(...)` exists

Ah, that does make sense, thanks for responding!

(Not that this was a real use case; I was just reading through the code and wondered if there were any other eval-like features in JS and stumbled upon this. The detailed comments throughout really helped my comprehension!)

athyuttamre

comment created time in 2 months

issue openedevanw/esbuild

Should not eliminate dead code if `new Function(...)` exists

Hey Evan! I found an issue with dead code elimination in an edge case that involves declaring a function using new Function(...). I'm using commit 25b92bfbb7278e1ce1f9005367eccaf3cf1d9d48 locally.

Context: In addition to the normal function f() {...} and const f = () => {...} syntax for declaring functions, JS also allows declaring functions via an eval-like format: const f = new Function('return 1') (docs on MDN). Functions declared like this can only operate in the global scope.

Our test case:

// demo/new-function.js
function foo() { return 1; }
const callFoo = new Function('return foo()');
console.log(callFoo());

Running esbuild --bundle demo/new-function.js has the effect of removing the function altogether:

$ ./esbuild --bundle demo/new-function.js
(() => {
  // demo/new-function.js
  const callFoo = new Function("return foo()");
  console.log(callFoo());
})();
$

I think this is a logic error, and has to do with dead code elimination assuming that foo() is not used anywhere. Doing something like what we do with eval is likely to fix this (but only in the global scope, since these functions only operate there).

https://github.com/evanw/esbuild/blob/25b92bfbb7278e1ce1f9005367eccaf3cf1d9d48/internal/ast/ast.go#L1092-L1095

While I wasn't able to repro simply, the same issue might also show up via minification (imagine that we kept the function, but renamed it to a(); the code would still fail).

I'm happy to help fix this if I could get some pointers on where to start. Totally ok if you prefer to just fix it too.

Thanks for all the great work with esbuild!


One caveat is that the test case doesn't actually run in Node, but does run in the browser (at least in WebKit in Safari, where I tested).

Node.js:

$ node --version
v14.4.0
$ node demo/new-function.js
undefined:3
return foo()
^

ReferenceError: foo is not defined
    at eval (eval at <anonymous> (/Users/athyuttamre/Work/github/esbuild/demo/new-function.js:2:17), <anonymous>:3:1)
    at Object.<anonymous> (/Users/athyuttamre/Work/github/esbuild/demo/new-function.js:3:13)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
$

Webkit in Safari: Screen Shot 2020-06-24 at 12 41 25 AM

created time in 2 months

push eventathyuttamre/esbuild

Evan Wallace

commit sha 717b448cdba7150acbfab78488a928a812dc5f32

introduce the "ast.Assign" helper

view details

Evan Wallace

commit sha 92b3a3038b008cf6bdac8800ef5327dfed56517e

implement lowering for object rest bindings

view details

Evan Wallace

commit sha 76fb5e0eca41bb4f6de1037b7925eff59e4127ef

publish 0.5.10 to npm

view details

Evan Wallace

commit sha 00afb7828a62faa0f2847f7d2842e1dfed6d3055

updates to destructuring fuzzer

view details

Evan Wallace

commit sha 5da0b2bb4db4f90bb7c1c8aa044be3c09e165b48

fix a crash for node 10.x

view details

Evan Wallace

commit sha 60e1d6156367fb3e0a8fb1f5efc0fa93adfe118a

publish 0.5.11 to npm

view details

Evan Wallace

commit sha 1d42a0363a68bf2dd26b4892164430c25451d90f

Update README.md

view details

Evan Wallace

commit sha f80520b29928c63952f4c489e6343cf6bed8aeeb

split apart top-level comma chains for readability

view details

push time in 2 months

fork athyuttamre/esbuild

An extremely fast JavaScript bundler and minifier

fork in 2 months

startedapple/swift-argument-parser

started time in 3 months

startedvercel/serve

started time in 3 months

startedonevcat/Rainbow

started time in 3 months

startedhttpswift/swifter

started time in 3 months

more