Kitson Kelly
87f30b21a3
feat(common): Add variants to FileName
( #2202 )
2021-09-03 13:55:31 +09:00
강동윤
77be9f63b9
fix(swc): Improve rust apis ( #2197 )
...
swc_ecma_transforms_testing:
- Make `expected` not affect source map of input.
swc:
- Accept `before` pass.
2021-09-01 23:34:37 +00:00
강동윤
cb2b0c671f
fix(es/transforms/base): Optimize hygiene
( #2193 )
...
swc_ecma_transforms_base:
- `hygiene`: Don't rename if not required. (#1600 )
swc_ecma_minifier:
- Remove `hygiene_optimizer`.
2021-09-01 13:11:55 +00:00
강동윤
a8cb554be5
feat: Expose .take()
( #2190 )
...
swc_common:
- Add `Take`. (#2189 )
swc_ecma_ast:
- Implement `Take` for ast nodes.
swc_ecma_transforms_base:
- Remove `MapWithMut`.
2021-08-31 14:45:48 +00:00
David Sherret
99c35ff980
refactor(es): Use BlockStmt
instead Vec<Stmt>
for static blocks. ( #2188 )
...
swc_ecma_ast:
- Use `BlockStmt` instead of `Vec<Stmt>` for static blocks.
swc_ecma_parser:
- Fix span of static blocks.
2021-08-31 16:12:18 +09:00
강동윤
d58642b70c
feat(common): Implement TypeEq
and EqIgnoreSpan
for tuples ( #2184 )
...
swc_common:
- Implement `TypeEq` and `EqIgnoreSpan` for tuples.
2021-08-30 12:44:46 +00:00
강동윤
11fe35dbd1
feat(es/minifier): Implement static evaluator ( #2176 )
...
swc_ecma_minifier:
- Add an api to evaluate constants statically.
2021-08-30 05:21:38 +00:00
강동윤
c0b0337d1d
fix(es): Fix easy bugs ( #2178 )
...
swc_ecma_parser:
- Fix parsing of complex arrow expressions in a conditional expression. (#2174 )
- Report an error for wrong jsx, instead of `panic!`. (#2173 )
swc_ecma_transforms_react:
- `jsx`: Handle fragment with single child correctly. (#2177 )
swc:
- Ensure that #2170 is an invalid issue. (#2170 )
2021-08-29 20:40:52 +00:00
Sosuke Suzuki
a10118c90f
feat(es/parser, es/codegen, es/visit): Support static blocks in classes ( #2130 )
...
swc_ecma_ast:
- Add support for static blocks in classes.
2021-08-30 00:03:14 +09:00
강동윤
97514a7549
fix(es): Fix some easy bugs ( #2166 )
...
swc_ecma_parser:
- Fix parsing of typescript generics in jsx context. (#2161 )
swc_ecma_transforms_base:
- `fixer`: Handle assignment with patterns in arrow body. (#2163 )
swc_ecma_utils:
- `as_bool`: Handle assignment with operator correctly. (#2165 )
2021-08-27 06:03:06 +00:00
David Sherret
3d58457027
refactor(es/dep_graph): Use dyn
instead of impl
( #2119 )
...
swc_ecma_dep_graph:
- Use `dyn` instead of `impl` in `analyze_dependencies`.
2021-08-27 13:08:48 +09:00
강동윤
d975a197c9
fix(es): Fix source map ( #2159 )
...
swc:
- Fill `names` of sourcemap.
- Don't add `sourceContents` to sourcemap if `sources` is added.
node_swc:
- Handle source map for `minify` correctly.
- `minify`: Accept `{ filename: code }`.
2021-08-26 10:44:38 +00:00
강동윤
e468752ebc
fix(es/minifier): Fix usage via yarn resolution ( #2158 )
...
swc_common:
- Deprecate some unused types.
swc:
- `BoolOrObject`: Improve the error message for deserialization failure.
- `BoolOrObject`: Treat an empty object as `true`.
- `JsMinifyFormatOptions`: Add fields. (#2153 )
node_swc:
- Improve error message for deserialization failure.
2021-08-26 06:18:59 +00:00
강동윤
8c5daeec2a
fix(es/transforms/base): Fix await
expressions. ( #2157 )
...
swc_ecma_transforms_base:
- Preserve parenthesis in `await (a || b)`. (#2155 )
2021-08-26 13:19:12 +09:00
강동윤
18e2232dbc
feat(plugin): Groundwork for rust plugin system ( #1893 )
2021-08-25 15:07:09 +00:00
강동윤
427df9a979
fix(es/codegen): Fix sourcemap ( #2142 )
...
swc_ecma_codegen:
- Use span for `await` token.
- Use span for debugger statements.
- Use span for object literals.
- Use span for object patterns.
- Use span for array literals.
- Use span for `try`.
- Use span for `for`.
- Use span for `return`.
- Use span for `break`.
- Use span for `continue`.
- Use span for `this`.
- Use span for `switch`.
- Use span for `catch`.
- Use span for `case`.
- Use span for `function`.
- Use span for unary expressions.
swc_ecma_minifier:
- Normalize sequences expressions if the length is 1.
2021-08-25 08:23:55 +00:00
강동윤
8c57cf0537
feat(css/parser): Improve parser api ( #2147 )
...
swc_css_parser:
- Add `parse_tokens`.
- Implement `Parse<CompoundSelector>` for the parser.
2021-08-25 02:46:17 +00:00
강동윤
584c44a490
feat(es): Reexport minifier from swc_ecmascript
( #2146 )
2021-08-24 20:38:16 +00:00
강동윤
838a7a8b33
fix(es/minifier): Make use of hygiene optimizer ( #2145 )
...
swc_ecma_ast:
- Implement `Display` for `Ident`.
swc_ecma_minifier:
- Expose `unique_scope`, which is required for `hygiene_optimizer`.
- Improve `hygiene_optimizer`.
swc:
- Use hygiene optimizer. (#1600 , #2137 )
- Add `jsc.experimental.optimizeHygiene`
2021-08-24 15:03:31 +00:00
강동윤
b0278242ba
fix(bundler): Fix handling of reexports from cjs modules ( #2143 )
...
swc_bundler:
- Handle reexports from cjs modules. (#2124 )
- Inject `__spack_require__` helper if required.
2021-08-24 07:20:15 +00:00
강동윤
81061a91bb
fix(css): Fixup ( #2138 )
2021-08-23 14:03:08 +00:00
강동윤
c05a724d84
feat(css): Port stylis ( #2131 )
...
swc_css_ast:
- Add `Value::Comma`.
swc_css_parser:
- Implement more `Parse<T>`.
- Fix parsing of values separated with comma.
swc_css_codegen:
- Fix escaping.
- Fix codegen of `!important`.
swc_stylis:
- Port prefixer.
2021-08-23 12:42:13 +00:00
강동윤
c78baef2cc
fix(es/transforms/compat): Implement new.tartet
( #2129 )
...
swc_ecma_transforms_compat:
- Handle `new.target`. (#1179 )
2021-08-22 06:56:49 +00:00
강동윤
7381644f6b
feat(css): Implement codegen for css ( #2115 )
...
swc_css_ast:
- Remove unused tokens.
- `SubclassSelector::PseudoClass` => `SubclassSelector::Pseudo`.
- Fix `AttrSelectorOp`
- `AttrSelector.value`: `Option<Text>` => `Option<Str>`.
swc_css_codegen:
- Implement a code generator.
swc_css_parser:
- Implement `Parse<Stylesheet>` for the parser.
- Fix parsing of pseudo selectors.
- Fix parsing of unknown at-rules.
2021-08-20 12:38:15 +00:00
강동윤
0d63470eba
feat(css): Groundwork for css processor ( #2105 )
...
swc_css_ast:
- Rename `Values` to `SpaceValues`.
swc_css_parser:
- Add `parse_str`.
- Make `ErrorKind` `#[non_exhaustive]`.
- Fix span.
swc_css_visit:
- Create visitors.
2021-08-20 07:48:08 +00:00
강동윤
6eaf60b8a4
fix(swc): Disable aes
feature ( #2109 )
...
node/swc:
- Disable `aes`. (#1807 )
2021-08-19 12:12:16 +00:00
강동윤
6896a83d54
fix(es/codegen): Fix codegen of ~
( #2104 )
...
swc_ecma_codegen:
- Emit pending semi on `~`. (#2091 )
2021-08-19 17:21:08 +09:00
강동윤
d39acd1d11
feat(css): Implement parser ( #2074 )
2021-08-19 05:16:32 +00:00
Sosuke Suzuki
33bdff0957
feat(es/parser): Emit an error for top-level await in script ( #2094 )
...
swc_ecma_parser:
- Report an error for a top-level await statements.
2021-08-18 00:17:59 +09:00
강동윤
879a0f39a8
feat(swc): Implement format.comments
of terser ( #2095 )
...
swc:
- `minify`: Support `format.comments`.
- `process_js`: Support `jsc.minify.format.comments`.
2021-08-17 14:34:37 +00:00
강동윤
a309b36236
fix(es/transforms): Fix bugs ( #2089 )
...
swc_ecma_minifier:
- Expose hygiene optimizer.
- `mangle_names`: Handle private names in member expressions. (#2086 )
swc_visit:
- Make `Optional::new` const function.
swc:
- Make `es3` optional via cargo feature.
- Ensure that #1554 is already fixed. (#1554 )
2021-08-16 10:33:18 +00:00
muji
e84ed13ffe
feat(es/loader): Support more types for browser
in package.json ( #2060 )
2021-08-16 17:34:53 +09:00
강동윤
0e30deba1a
feat(es/minifier): Implement more rules ( #2058 )
...
swc_ecma_minifier:
- Enable some sequential merging if `collapse_vars` is set.
- Enable sequential merging for top level items.
- `if_return`: Don't inject `void` if it's not exact function body. (#2072 )
- `sequences`: Add some condition for aborting. (#2078 )
swc_ecma_utils:
- Add `collect_decls`.
- Add `collect_decls_with_ctxt`.
swc_ecma_transforms_optimization:
- `inline_globals`: Don't replace if a binding exists. (#1294 )
2021-08-15 13:09:21 +00:00
강동윤
1b0ef756f2
fix(es/parser): Allow using parser with stable rustc ( #2084 )
...
swc_ecma_parser:
- Don't use `#![feature]` for non-test builds. (#2083 )
2021-08-15 10:01:08 +00:00
강동윤
f8aa0509ce
fix(bundler): Fix stack overflow ( #2080 )
...
swc_bundler:
- Prevent infinite recursions. (#1963 )
2021-08-15 02:37:31 +00:00
강동윤
b0067adb9c
fix(es/parser): Fix parsing of function
in property names ( #2076 )
...
swc_ecma_parser:
- Use correct token context when `function` is used as the name of a property. (#2075 )
2021-08-14 15:12:26 +00:00
강동윤
f6aabfce9c
perf: Use ahash instead of sip hash ( #2073 )
...
swc_common:
- Add `AHashMap`.
- Add `AHashSet`.
2021-08-14 10:33:16 +00:00
강동윤
1b9584cfc0
fix(swc): Fix bugs ( #2067 )
...
swc_ecma_transforms_compat:
- Fix optional chaining. (#2063 )
node/swc:
- Fix definition of `ImportDeclaration`. (#2059 )
testing:
- Allow using `testing` with stable `rustc`.
testing_macros:
- Add `#[inline(never)]`.
2021-08-13 10:57:25 +00:00
강동윤
883c1ac4e4
fix(bundler): Prepare renaming of bundler ( #2066 )
...
- Rename `spack` crate to `swc_node_bundler`. (#1113 )
2021-08-13 10:03:04 +00:00
LongYinan
fe2a063525
perf(node/swc): Use mimalloc ( #2068 )
2021-08-13 18:39:13 +09:00
강동윤
c6dce67494
fix(swc): Report error correctly ( #2065 )
...
swc_common:
- Add some utilities for `Handler`.
swc:
- Remove `Compiler.handler`.
- Accept `handler` for each operations. (#2035 )
2021-08-13 07:05:40 +00:00
강동윤
72c9f4373a
fix(es): Fix bugs ( #2055 )
...
swc_ecma_parser:
- Fix panic from span assertion. (#2040 )
swc_ecma_transforms_compat:
- Fix handling of `await for`. (#1918 )
swc_ecma_transforms_base:
- Allow using decorator metadata even if `reflect-metadata` is not imported. (#1362 )
2021-08-12 12:28:58 +00:00
muji
cfc3725dbb
feat(bundler): Support paths
( #2054 )
...
swc_ecma_ast:
- Implement more traits for `TargetEnv`.
swc_ecma_loader:
- `NodeModulesResolver`: Support aliasing.
2021-08-12 14:30:49 +09:00
강동윤
a7cb2aba9d
fix(es/minifier): Fix bugs of the minifier ( #2052 )
...
swc_ecma_minifier:
- Test mangler using execution test suite.
- `mangler`: Preserve `arguments`.
- `mangler`: Handle shorthand. (#2051 )
- `mangler`: Handle object pattern properties.
- `precompress`: Don't drop function declarations if the variable with same name is in different scope. (#2011 )
2021-08-11 07:24:52 +00:00
강동윤
71080dbd26
feat(es/minifier): Implement more rules ( #2039 )
...
swc_ecma_minifier:
- Remove useless `0` in sequence expressions.
- `analyzer`: Don't treat fn decl as fn expr.
- `sequences`: Use sequence expressions in front of `b`.
- `if_return`: Drop else token within same pass. (#2044 )
- Fix counting logic for `pass`. (#2044 )
- `analyzer`: Fix `ref_count`.
- `hygiene`: Implement `visit_prop_name`.
- `ignore_return_value`: Property access to function parameters may have side effects.
- `inline`: Treat `!0` as literal.
- Remove some dead codes if `unused` is enabled.
swc_ecma_utils:
- Fix `may_have_side_effects`.
2021-08-10 08:52:28 +00:00
muji
2151366b93
feat(es/loader): Support target runtime environment. ( #2045 )
...
swc_ecma_ast:
- Add `TargetEnv`.
swc_ecma_loader:
- Support specifying target environment.
2021-08-10 15:36:10 +09:00
강동윤
2c52021ed4
fix(es/transforms/module): Fix paths
bug. ( #2043 )
...
swc_ecma_preset_env:
- Update compat data.
swc_ecma_transforms_module:
- Fix `paths`. (#1934 , #1935 )
2021-08-09 19:21:24 +00:00
강동윤
8cbbddb957
fix(es/parser): Recover from import.meta
in scripts ( #2042 )
...
swc_ecma_parser:
- Recover from `import.meta` in scripts. (#2041 )
- Allow `import.meta` when using `parse_program`.
2021-08-09 16:13:41 +00:00
강동윤
53b031b019
fix(swc): Fix bugs ( #2034 )
...
swc_ecma_transforms_base:
- `resolver`: Handle constructor properties correctly. (#2021 )
swc_ecma_transforms_compat:
- `block_scoping`: Handle arrows in loops. (#2027 )
- `block_scoping`: Handle nested for loops with function between them. (#2027 )
- `regenerator`: Handle rhs of `||` correctly. (#2024 )
swc:
- Add a test for #1734 . (#1734 )
2021-08-09 07:38:46 +00:00
강동윤
9793926cc8
fix(es/minifier): Fix bugs and implement more rules ( #2032 )
...
swc_ecma_minifier:
- Fix an infinite loop. (#2028 )
- Don't remove span hygiene. (#2022 )
swc_ecma_codegen:
- Fix codegen of `return` with `async` arrow. (#2020 )
swc:
- Respect `minify = false`. (#2019 )
2021-08-08 14:19:04 +00:00
강동윤
026c21ec68
feat(es/minifier): Make minifier parallel ( #2009 )
...
swc_ecma_minifier:
- Introduce `bundle` mode, which can be used to parallelize processing of bundled files.
- Add a function analyzer that checks if the function references something from the outer scope.
- Split out parellsizable passes.
- Split `optimzer` into pure / non-pure.
- Run pure optimizations in parallel.
2021-08-07 08:27:52 +00:00
강동윤
4cdb45ff2e
feat(swc): Improve swc as a crate ( #2026 )
...
]swc_ecmascript:
- Expose `swc_ecma_preset_env`.
swc:
- Expose `swc_atoms`.
- Expose `swc_common`.
- Expose `swc_ecmascript`.
2021-08-07 02:41:50 +09:00
강동윤
eb45760697
fix(es/transforms/react): Handle escape correctly ( #2014 )
...
swc_ecma_transforms_react:
- Handle escapes properly. (#2013 )
2021-08-05 08:34:28 +09:00
강동윤
48bc26d3c9
fix(es): Fix codegen & minifier ( #2006 )
...
swc_ecma_codegen:
- Emit a semicolon before `!`.
- Emit a semicolon before `[`. (#2007 )
swc_ecma_minifier:
- Disable buggy passes.
- `iife`: Don't inline async functions. (#2007 )
2021-08-04 10:27:17 +00:00
강동윤
68608db0b3
fix(es/minifier): Improve output of minifier ( #2005 )
...
swc_ecma_minifier:
- Don't reorder import statements.
2021-08-04 07:20:02 +00:00
Sosuke Suzuki
a086a203dd
feat(es/parser): Report an error for import.meta
in script ( #1999 )
2021-08-04 14:38:07 +09:00
강동윤
81abfe55d6
fix(es): Fix bugs ( #2004 )
...
swc_ecma_codegen:
- Fix codegen of regexp where `minify` = `true`. (#2000 )
swc_ecma_transforms_react:
- Respect `@jsxImportSource` in `classic` mode. (#1933 )
swc:
- Upgrade `base64`.
2021-08-04 04:58:10 +00:00
강동윤
f44e25c3af
fix(es/minifier): Improve output of minifier ( #1990 )
...
swc_common:
- Add `Span.has_mark`.
swc_ecma_codegen:
- Emit `1e3` for `1000`.
- Optimize output. (#1986 )
swc_ecma_minifier:
- name mangler: Don't use keywords as an id.
- `properties`: Optimize member expression with string properties.
- `inline`: Inline some function expressions even if it's not fn-local.
- `analyzer`: Track reassignment correctly.
- `analyzer`: Track fn-local correctly.
- `sequences`: Inject `void` if required.
- `inline`: Inline function declarations correctly.
- `sequences`: Merge expressions into test of if statements.
- `sequences`: Reduce calls to an assigned variable.
- Use `Marks` instead of `&dyn Comments`.
swc_ecma_transforms_optimization:
- `expr_simplifier`: Fix infinite loops.
node/swc:
- Ensure that `.transform` performs minification. (#1989 )
2021-08-04 00:52:47 +09:00
강동윤
e916b35dd2
feat(node/swc): Support sourceFileName
( #1976 )
...
swc:
- Support `sourceFileName`.
2021-08-03 00:49:34 +09:00
강동윤
be23e66ca8
fix(es/minifier): Fix minifier ( #1985 )
...
swc_ecma_minifier:
- Don't create an identifier starting with number. (#1983 )
- Fix panic. (#1984 )
- Don't use time api on wasm. (#1982 )
2021-07-31 13:34:16 +00:00
강동윤
d600d52157
fix(build): Increase memory
2021-07-31 19:50:13 +09:00
강동윤
839476dc3c
chore: Publish a new version
2021-07-31 18:32:51 +09:00
강동윤
d1c481790c
feat(swc): Expose minifier api ( #1978 )
...
swc_ecma_codegen:
- Fix codegen of imports when minification is enabled.
swc_ecma_minifier:
- Mangle identifiers used by imports.
swc:
- Support specifing `jsc.minify`. (#704 , #1371 )
swc/node:
- Add `.minify()`.
- Add `.minifySync()`.
swc/wasm:
- Add `.minifySync()`.
2021-07-31 06:30:06 +00:00
강동윤
b02e189d07
feat(es/minifier): Implement more rules ( #1871 )
...
swc_ecma_codegen:
- Fix codegen of `U+0028` and `U+0029`.
swc_ecma_minifier:
- Implement MVP.
swc_ecma_transforms_base:
- `fixer`: Handle seq/await in rhs of for-of.
2021-07-30 10:11:27 +09:00
강동윤
360b4bcc04
fix: Remove println
2021-07-29 14:29:22 +09:00
강동윤
4011703af5
fix(testing): Allow using it with stable rustc ( #1974 )
...
testing_macros:
- Make `#[fixture]` relative to cargo manifest dir.
2021-07-29 14:18:21 +09:00
강동윤
f3603b2cb8
chore: Use correct license for the node package ( #1966 )
2021-07-27 14:59:46 +09:00
강동윤
fb3b52ddbb
ignore Cargo.lock
2018-01-13 19:06:38 +09:00
강동윤
e949c40517
ECMAScript parser ( #1 )
...
- Parser and lexer for lastest ecma spec https://tc39.github.io/ecma262
- Lexer is currently very inefficient
- Use https://github.com/tc39/test262-parser-tests/ for testing.
- Implement proc-macro based ast folder and assert_eq_ignore_span! based on it.
- Some utilities for proc macro at /macros/common
2018-01-12 16:53:06 +09:00