Commit Graph

241 Commits

Author SHA1 Message Date
Donny/강동윤
eef3d6e3fb
fix(es): Fix simple bugs (#2495)
swc_ecma_parser:
 - Don't panic on `declare declare`. (#2343)

swc_ecma_transforms_react:
 - Don't panic on `createElement()`. (#2492)

swc_bundler:
 - Don't panic on wasm. (#2334)

swc:
 - Disable `inline_globals` if it's not specified. (#2490)
2021-10-20 06:12:21 +00:00
Donny/강동윤
b0361caa58
feat(es/transforms/optimization): Improve inline_globals (#2479)
swc_ecma_transforms_optimization:
 - `inline_globals`: Support inlining into shorthand properties.
 - `inline_globals`: Support replacing member expressions.

swc:
 - Add an option to disable simplifier when using `inline_globals`.

node_swc:
 - Improve error message on panic.
2021-10-19 14:58:10 +00:00
Donny/강동윤
2ca6e5d79b
feat(es/transforms/optimization): Support inlining of typeofs (#2473)
swc_ecma_transforms_optimization:
 - `inline_globals`: Support inlining of `typeof`s.

swc:
 - Change error message for parsing failure to mention `Syntax Error`.
2021-10-19 09:49:18 +00:00
Donny/강동윤
123c1f5d02
chore: Fix typo (#2472) 2021-10-19 08:25:57 +00:00
Donny/강동윤
c9437d3226
fix(es): Fix bugs (#2469)
swc:
 - Fix handling of `envs`.
 - Check for already fixed issues. (#2319)
2021-10-19 06:02:46 +00:00
Donny/강동윤
28f2c7ae5d
feat(swc): Accept map for envs (#2467)
swc:
 - Support specifying map to global inlining pass.
2021-10-19 05:13:21 +00:00
Donny/강동윤
575aa44c25
perf(es/transforms): Improve performance (#2454)
swc_ecma_transforms_macros:
 - `#[parallel]`: Run hooks for single-threaded operations.

swc_ecma_transforms_compat:
 - `shorthand`: Parallel.
 - `exponentation`: Parallel.
 - `parameters`: Parallel.
 - Recover some `#[fast_path]`
2021-10-18 12:07:13 +00:00
Donny
ac772403b2 chore: Add include to swc 2021-10-18 16:49:21 +09:00
Donny/강동윤
9ba68c6863
fix(common): Fix sourcemap (#2457)
swc_common:
 - Include the index to the name in `mappings` of a sourcemap.

swc:
 - Fix handling of `inputSourceMap`.
2021-10-18 06:43:59 +00:00
Donny
7225f90b9c Bump version 2021-10-18 11:09:59 +09:00
Donny/강동윤
3d204b44f0
perf(es/transforms): Make transforms parallel (#2449)
swc_ecma_utils:
 - `collect_decls`: More parallel.

swc_ecma_transforms_macros:
 - Add `Parallel`, which is helper for `#[parallel]`.
 - Add `ParExplode`, which is helper for `#[parallel(explode)]`.

swc_ecma_transforms_macros:
 - Add `#[parllel]`.

swc_ecma_transforms_compat:
 - `sticky_regex`: Parallel.
 - `typeof_symbol`: Parallel.
 - `for_of`: Remove exponential visit.
 - `regenerator`: Remove exponential visit.
 - `object_spread`: Parallel.
 - `instance_of`: Parallel.
 - `duplicate_keys`: Parallel.
 - `logical_assignments`: Parallel.
 - `template_literal`: Parallel.
 - `block_scoped_functions`: Migrate to `VisitMut`.
 - `for_of`: Migrate to `VisitMut`.
 - `destructuring`: Reduce `Visit`.
 - `arrow`: Migrate to `VisitMut`.
 - `function_name`: Parallel.
 - `reserved_words`: Parallel.
 - `for_of`: Parallel.

swc_ecma_transforms_module:
 - `import_analyzer`: Migrate to `VisitMut`.

swc_ecma_transforms_react:
 - `jsx_src`: Parallel.
-  `jsx_self`: Migrate to `VisitMut`.
-  `jsx_self`: Parallel.

swc_ecma_transforms_proposal:
 - `export_default_from`: Migrate to `VisitMut`.

swc_ecma_transforms_optimization:
 - `inline_globals`: Parallel.
 - `json_parse`: Migrate to `VisitMut`.
 - `json_parse`: Parallel.
2021-10-18 00:03:30 +09:00
Donny/강동윤
1645bb30b7
perf(es/transforms): Reduce usage of #[fast_path] (#2442)
swc_ecma_ast:
 - Implement `Take` for `ObjectLit`.
 - Implement `Take` for `ArrayLit`.

swc_ecma_transforms_compat:
 - `nullish_coalescing`: Remove exponential visit.
 - `nullish_coalescing`: Migrate to `VisitMut`.
 - `optional_chaining`: Reduce exponential visit. (But it's not removed)
 - `class_properties`: Remove exponential visit.
 - `jsx_src`: Migrate to `VisitMut`.
 - `optional_chaining`: Mae it parallel.
 - `async_to_generator`: Remove `#[fast_path]`.
 - `arrow`: Remove `#[fast_path]`.
 - `destructuring`: Remove `#[fast_path]`.
 - `block_scoped_functions`:  Remove `#[fast_path]`.
 - `classes`: Remove `#[fast_path]`.
2021-10-16 08:12:02 +00:00
Donny/강동윤
130a47f42c
feat(es/transforms/module): Add an option to preserve dynamic imports (#2441)
swc_ecma_transforms_module:
 - Add `ignoreDyanmic`.
2021-10-15 19:19:14 +09:00
Donny/강동윤
4c983e9158
perf(es/codegen, es/parser): Improve performance (#2406)
ast_node:
 - Make `.span()` inlinable.

swc_ecma_codegen:
 - Reduce call to *heavy* `.span()` calls.

swc_ecma_parser:
 - Reduce `memmove` by using typed-arena.

swc_bundler:
 - Make `Bundle.bundle` take `&mut self`.
 - Make drop concurrent.
2021-10-15 12:49:37 +09:00
Donny/강동윤
51d7a144bb
fix(swc): Fix order of passes (#2427)
swc_ecam_transforms_typescript:
 - Preserve more jsx-related imports.

swc:
 - Change pass ordering.
2021-10-13 16:04:49 +00:00
Donny/강동윤
76de51333d
fix(es/transforms): Fix for react + typescript (#2422)
swc_common:
 - Add `NoopComments`.
 - Implement `Comments` for `Option<C>` where C: `Comments`.
 - Add some helper methods to `Comments`.
 - Deprecate `CommentsExt`.

swc_ecma_transforms_base:
 - `resolver`: Handle `TsImportEqualsDecl`.

swc_ecma_transforms_react:
 - Reduce useless cloning using `Arc`.
 - Expose API for parsing directives like `@jsxPragma`.

swc_ecma_transforms_typescript:
 - Accept `pragma` and `pragmaFrag`.
 - Support jsx directives.
 - Preserve jsx-related imports.

swc:
 - Optimize `SwcComments`.
 - Run`resolver` before everything else.
2021-10-13 22:29:56 +09:00
Donny/강동윤
98cc79a2be
fix(es/minifer): Fix bugs (#2397)
swc_ecma_codegen:
 - Fix sourcemap of `export` tokens.
 - Fix codegen of numeric operands in left of a binary expression.
 - Fix codegen of unary operations.

swc_ecma_minifier:
 - Visit `AssignPatProp.valie`.
 - Move `inline_prevented` to analyzer.
 - Add `Ctx.dont_invoke_iife`.
 - `iife`: Check for `arugments`

swc:
 - `inline_sources_content`: true by default for `minify()`.
2021-10-11 07:44:42 +00:00
Donny/강동윤
897f4b670e
fix(dev/cli): Remove CLI from main swc repositoy (#2393) 2021-10-10 11:17:12 +00:00
Donny
b9b7de0871 chore: Publish 2021-10-10 01:33:22 +09:00
Donny/강동윤
7a31a3f530
feat(plugin/api): Determine plugin api (#2199) 2021-10-09 17:47:42 +09:00
Donny/강동윤
ac3fbd91ac
perf(bundler): Improve performance (#2384)
*:
 - Use `ahash` instread of `rustc-hash`.

swc_ecma_transforms_optimization:
 - Make `dce` parallel.
2021-10-09 08:08:13 +00:00
Donny/강동윤
2c058cb124
fix(es/codegen, es/transforms/typescript): Fix bugs (#2383)
swc_ecma_codegen:
 - Emit sourcemap for `import` tokens.

swc_ecma_transforms_typescript:
 - Strip `react` correctly.
2021-10-09 01:20:59 +00:00
Donny
d19df1379c chore: Publish swc 2021-10-09 00:05:59 +09:00
Donny/강동윤
d0342a5a58
feat(swcpack): Enable concurrent mode (#2356)
swc_common:
 - Use `Mutex` from `parking_lot` instead of it from std.

swc_bundler:
 - Use `fxhash` if possible.
 - Don't `clone()` all modules if the entry has only one item.

swc_ecma_loader:
 - `NodeModulesResolver`: Use `path-clean` instead of `canonicalize`.

swc_ecma_transforms_optimization:
 - Reimplement `dce`

node_bundler:
 - Enable `concurrent` of `swc_bundler`.
2021-10-08 16:47:01 +09:00
Donny/강동윤
656f3e944d
fix(swc): Fix swc as a crate (#2376)
swc_ecma_transforms_typescript:
 - Don't drop imports from `react`.
2021-10-08 03:38:11 +00:00
Donny/강동윤
b0ee9543d4
doc(es/ast): Document identifier mangagement system (#2371) 2021-10-08 01:02:02 +09:00
Donny/강동윤
edc4cb432e
fix(swc): Fix order of custom passes (#2367)
swc_ecma_transform_react:
 - Accept `top_level_mark`.

swc:
 - Fix order of `custom_before_pass`.
2021-10-07 15:13:21 +09:00
Donny/강동윤
9e6a1f431b
fix(es/minifier): Fix minifier (#2355)
swc_ecma_minifier: 
 - `iife`: Don't replace parameters with identifiers in iife.
 - `sequences`: Add `Marks.synthesized_seq`.
 - pure: Drop empty statements.
2021-10-06 07:12:11 +00:00
Donny/강동윤
6d35e7c28d
fix(swc): Fix order of custom passes (#2347)
swc:
 - Invoke `resolver` and `typescript::strip` before applying user passes.
2021-10-05 20:46:49 +00:00
Donny/강동윤
fac6f47863
perf(es/transforms): Improve performance (#2329)
swc_ecma_ast:
 - Implement `Take` for `Function`.
 - Implement `Take` for `FnExpr`.
 - Implement `Take` for `ClassExpr`.

swc_ecma_transforms_compat:
 - Migrate `es2015::duplicate_keys` to `VisitMut`.
 - Migrate `es2015::template_literals` to `VisitMut`.
 - Migrate `es2015::function_name` to `VisitMut`.
 - Add more fast-path to `reserved_words` pass.

swc_ecma_transforms_react:
 - Reduce allocations of `pure_annotations`.
 - Migrate `pure_annotations` to `VisitMut`.
 - Migrate `jsx::display_name` to `VisitMut`.

swc_ecma_transforms_optimization:
 - Migrate `inline_globals` to `VisitMut`.
 - `inline_globals`: Use `Lrc<FxHashMap<K, V>>`.

swc:
 - Cache `current_dir()`.
 - `ModuleConfig::build`: cacnonicalize only if `paths` is used.
2021-10-05 13:31:35 +00:00
Donny/강동윤
8403057268
fix(es/minifier): Don't optimize new String. (#2341)
swc_ecma_transforms_optimization:
 - Don't optimize calls like `new String`.
2021-10-04 06:44:37 +00:00
Donny/강동윤
bbefa0e57e
chore: Improve documentation for rust users (#2340) 2021-10-04 06:10:30 +00:00
Donny/강동윤
6a41e9a0be
fix(es): Fix performance bugs (#2313)
swc_common:
 - Optimize `SourceMap.span_until_char`.

swc_ecma_codegen:
 - Make `Emitter` generic.

swc_ecma_parser:
 - `Lexer`: Reuse allocation of `String`.
 - `Lexer`: Avoid copying useless data.
2021-09-29 12:10:38 +00:00
Donny/강동윤
2c50cde8de
fix(swc): Fix try_with_handler (#2315)
swc:
 - `try_with_handler`: Return `Err` on errors.
2021-09-29 04:55:31 +00:00
Pig Fang
2b292e6d17
feat(es): Support type-only import/export specifiers (#2309) 2021-09-28 22:05:20 +09:00
Donny/강동윤
650e1494d4
fix: Migrate dependencies (#2307)
*:
 - Migrate from `log` to `tracing`. (#2284)
 - Migrate from `fxhash` to `rustc-hash`.

swc_common:
 - Add a cargo feature named `debug`.
2021-09-27 09:19:15 +00:00
Donny/강동윤
e46a842e99
feat(es/parser, es/transform): Implement ergonomic brand checking (#2079)
swc_ecma_parser:
 - Implement parsing of private properties in object literals.

swc_ecma_transforms_base:
 - `fixer`: Handle `const [a = (b, c)]`.

swc_ecma_transforms_compat:
 - `class_properties`: Support ergonomic brand checks. (#2064)

swc_ecma_transforms_proposal:
 - Implement ergonomic brand checks for private fields. (#2064)
2021-09-27 08:03:48 +00:00
Donny/강동윤
ca0d6ddf2e
fix(es/parser): Fix bugs (#2255)
swc_ecma_parser:
 - Treat `{` after an arrow as a brace stmt. (#2237)
 - Handle comments correctly while backtracking. (#2264)
2021-09-23 11:32:40 +00:00
Pig Fang
4d500baaaa
fix(es/transforms/compat): Move the optional catch binding pass to ES2019 (#2247)
swc_ecma_transforms_compat:
 - Move optional chaining pass to `es2019`.

Co-authored-by: Donny <kdy1997.dev@gmail.com>
2021-09-21 21:54:51 +09:00
Donny/강동윤
180dc31550
fix(es/transforms/base): Fix hygiene pass (#2266)
swc_ecma_transforms_base:
 - `hygiene`: Consider nested scopes correctly. (#2211)
 - `hygiene`: Fix handling of constructors.
2021-09-21 12:21:49 +00:00
Heyang Zhou
b82702cf0f
fix(swc): Remove global side effects for rust users. (#2270)
swc:
 - Don't enable `log/release_max_level_info`.
 - Don't depend on `swc_node_base`.
2021-09-19 17:05:36 +09:00
강동윤
48d61039d2
fix(common, node/swc): Allow inlining sourcesContent (#2245)
swc_common:
 - Allow setting `sourceContents` of source map files. (#2218)

swc:
 - Support `inlineSourceContents`. (#2244)
2021-09-14 02:31:32 +00:00
강동윤
9eafd0c6c4
fix(es/loader): Fix support for jsc.paths. (#2227)
swc_ecma_loader:
 - `TsConfigResolver`: Use `baseUrl`. (#2050)

swc:
 - Change type of `JscConfig.base_url` to `PathBuf`.

testing:
 - Improve `NormalizedOutput::compare_to_file`.
2021-09-10 12:29:26 +00:00
강동윤
9ffe47106a
fix(swc): Fix target (#2226)
swc:
 - Fix `target` option. (#2225)
2021-09-10 15:43:14 +09:00
강동윤
2c477780f0
fix(es): Fix bugs (#2222)
swc_ecma_parser:
 - Don't panic on `typeof import(T)`. (#2198)
 - Fix parsing of ternary. (#2196)

swc_ecma_transforms_base:
 - `fixer`: Handle unary in lhs of an exponentation expression. (#2191)

swc_ecma_transforms_compat:
 - Use variable for `this` in arrow expressions. (#2212)

swc_ecma_visit:
 - Add a trait `InjectVars`.

node_swc:
 - Increease recursion limit while deserializing. (#2223)
2021-09-09 20:45:20 +09:00
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
강동윤
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
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
강동윤
18e2232dbc
feat(plugin): Groundwork for rust plugin system (#1893) 2021-08-25 15:07:09 +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
강동윤
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
강동윤
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
강동윤
f6aabfce9c
perf: Use ahash instead of sip hash (#2073)
swc_common:
 - Add `AHashMap`.
 - Add `AHashSet`.
2021-08-14 10:33:16 +00: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
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
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
강동윤
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
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
강동윤
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
강동윤
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
강동윤
85a216ef56
feat(es/parser): Allow stripping out typescript parser (#1962)
swc_ecma_parser:
 - Add a cargo feature to remove typescript parser.
2021-07-25 09:37:59 +00:00
강동윤
204a71ca94
fix(es/transforms): Fix bugs (#1950)
swc_ecma_trasnsforms_base:
 - `fixer`: Don't de-optimize `++foo || bar`.

swc_ecma_trasnsforms_typescript:
 - Allow using properties from a decorated class. (#1869)

swc_ecma_transforms_optimization:
 - Fix infinite loop. (#1901, #1946)
2021-07-22 07:33:00 +00:00
강동윤
ff47e2539e
fix(swc): Fix bugs (#1932)
swc_common:
 - Fix handling of input source map. (#1930)

swc:
 - Respect `paths`. (#1858)

node:
 - Fix typings of `paths`.
2021-07-17 11:16:00 +00:00
David Sherret
6dc6d8a847
refactor(es/dep-graph): Remove SourceMap dependency (#1908) 2021-07-14 00:59:13 +09:00
강동윤
104be9837b
fix(es/transforms): Fix transforms (#1909)
swc_ecma_transforms_compat:
 - `regenerator`: Use es6 import while folding module. (#1641)
 - `typeof_symbol`: Handle `undefined` specially. (#1843)
 - `regenerator`: Do not create useless codes. (#1687)
 - `typeof_symbol`: Migrate to `VisitMut`.

swc_ecma_transforms_module:
 - Add `import_hoister`.
 - Improve import analyzer. (#1682)
 - Allow overriding `export *` wth named exports. (#1714)

swc_ecma_transforms_testing:
 - Add a hack for `regenerator-runtime`.

swc:
 - Run import analyzer ahead of time. (#1682)

misc:
 - Downgrade rustc to the version rust-analyzer supports.
2021-07-10 11:18:28 +00:00
강동윤
19bcb06f73
fix(swc): Fix source path of a source map file (#1902)
swc:
 - Use `output_path` to make sourcemap path relative to the `.map` file. (#1255)
2021-07-08 07:32:06 +00:00
Austaras
76341068d0
fix(es/ast): Fix handling of reserved words (#1891) 2021-07-04 19:44:33 +09:00
강동윤
33f2ab2d79
fix(es/transforms): Fix transforms (#1861)
swc_ecma_transforms_compat:
 - Organize logical assignment pass correctly.

swc_ecma_transforms_optimization:
 - `dead_branch_remover`: Handle nullish coalescing operator correctly. (#1851)
2021-06-26 16:02:15 +09:00
강동윤
737ce63b78
chore(es/ast): Bump version (#1853) 2021-06-25 08:19:15 +00:00
강동윤
ff440d47a4
chore: Organize project (#1849) 2021-06-24 17:01:21 +09:00
강동윤
4cd43375a5
feat(swc): Add import resolvers (#1834)
swc_ecma_loader:
 - Add `Resolve`. 
 - Add `TsConfigResolver`. 

swc_ecma_transforms_module:
 - Use `Resolve` for remapping import paths.
 - Add `ImportResolver`.
 - Add `NodeImprortResolver`.

swc:
 - Add `paths` to `.swcrc`.
 - Use `paths`. (#379, #702)
 - Canonicalize file names.
2021-06-24 06:32:09 +00:00
강동윤
f4249574da
feat(ci): Track binary size and performance (#1840) 2021-06-23 10:50:27 +00:00
강동윤
6ad3f7b90e
feat(es/visit): Groundwork to use VisitMut instead of Fold (#1842)
swc_ecma_transforms:
 - Expose `VisitMut` if possible.

swc_ecma_visit:
 - Implement `VisitMut` for` Folder<V>`.
 - Implement `VisitMut` for `AndThen<A, B>`.
2021-06-23 04:18:41 +00:00
강동윤
5a6c4fd5a0
fix(swc): Fix sourcemap (#1832)
swc_common:
 - `SourceMap`: Don't panic for dummy spans.

swc_ecma_codegen:
 - Use span for `throw`. (#1685)
 - Use span for `var` / `let` / `const`.
 - Use span for `new`.
 - Use span for `if`.
 - Add spans to braces of a block statement. (#1796)

swc_ecma_transforms_compat:
 - `parameters`: Don't drop the span of block statements. (#1796)

swc:
 - Allow specifying input source map in `.swcrc`.
 - Ensure that the inline source map works properly. (#1713)
2021-06-18 11:34:17 +00:00
강동윤
f9bdc7b227
fix(es/parser): Fix panic on debug mode (#1828)
swc_ecma_parser:
 - Handle undefined unicode code point gracefully. (#1813)
2021-06-16 15:55:20 +09:00
강동윤
d3944f5203
fix(swc): Fix bugs (#1820)
swc_ecma_preset_env:
 - [x] Rename directory to be consistant.
 - [x] Add es2020::operators. (#1812)

swc_ecma_transforms_react:
 - [x] Don't escpae unicodes. (#1782)
2021-06-12 15:39:39 +09:00
강동윤
3c3fb359ee
fix(es): Remove UB (#1815)
swc_ecma_parser:
 - Remove UB.

swc_ecma_codegen:
 - Remove codes related to the UB of the parser. (#1782)
2021-06-12 05:17:09 +00:00
강동윤
97ef7c0553
fix(swc): Fix bugs (#1811)
swc_ecma_ast:
 - Add `es2021`. 

swc_ecma_transforms_compat:
 - Handle `||=`. (#1788)
2021-06-11 16:55:34 +09:00
강동윤
0bd2a3a07e
fix(es/transforms): Fix bugs (#1783)
swc_ecma_transforms_base:
- `fixer`: Wrap operand of a unary expression if it's a binary expression. (#1781, #1789)

swc_ecma_transforms_module:
 - Allow multiple `export *` even if it has the same item. (#1780)
2021-06-05 11:13:42 +09:00
Pig Fang
1dbc3644a5
feat(es): Support type-only import equals declaration (#1695)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-05-15 14:26:24 +09:00
Pig Fang
1548f6d799
feat(es/parser): Allow override in parameter properties (#1667)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-05-09 22:17:58 +09:00
Pig Fang
4aed9423de
fix(es/parser): Allow using override with static (#1663) 2021-05-09 21:04:42 +09:00