Levi
Levi
I have ran `UPDATE=1 cargo test --test projects --test tsc`, but not sure if all of these files should be changed, especially `crates/swc/tests/tsc-references/templateStringInIndexExpressionES6.2.minified.js`, which is now empty.
This is getting a little complicated with property names, since we need to either correctly handle stuff like `[].push` not being replaced, or simply not replace invalid properties at all....
Babel's minify doesn't modify expressions like `[][[]]`, but Babel's `path.evaluate()` API lets you transform these expressions. Should we perhaps make this some sort of API instead? Not sure where to...
> Please move logics to https://github.com/swc-project/swc/blob/8eac0bec49f4f260a261d87f174ed2913c4bee63/crates/swc_ecma_minifier/src/compress/pure/evaluate.rs > > `swc_ecma_utils` is not a good place for this kind of optimizations Do we not care about modified prototypes? For example, in the...
Got it, I will update the minifier accordingly to try use it -- I think that option should be checked here in the aforementioned case
Not sure why this exists, perhaps a bug with side effects? https://github.com/swc-project/swc/blob/56e03a19602b36a7ebac9ccc899065101bb385af/crates/swc_ecma_transforms_optimization/src/simplify/expr/mod.rs#L258 Current test case `fold("[1,2,3,4,5,6,7,8,9,10][4 + []]", "5;");` fails, resulting in `0, 5` instead of just `5`, removing that...
I seem to have fixed this but not sure if it will cause side effects anywhere, will try take a look. It appears as `ArrayLiteral`s being replaced were always being...
Also, CI currently fails because of this. Is this normal? These unit tests don't seem to work on Windows, will try this on Mac later. ``` ---- fixture_tests__terser__compress__evaluate__unsafe_string_bad_index__input_js stdout ----...
Not sure if I got the `span` stuff correct. There is some copy pasta going on here from `simplify::expr`, should probably move that stuff into their own util functions. Where...
Will add `watch` and `unwatch` as exclusions for `Object`, even though they don't exist anymore. This way users can still use pristine_globals=true when using scripts like this to polyfill: https://gist.github.com/eligrey/384583...