Commit Graph

211 Commits

Author SHA1 Message Date
Donny/강동윤
c2bbdbe9d6
feat(webpack): Add ast reducer (#2875)
swc_estree_compat:
 - Fix stack overflow related to object patterns.

swc_webpack_}ast:
 - Implement AST reducer.
2021-11-26 15:04:41 +09:00
Donny/강동윤
790a262c07
refactor(es/estree): Rename: babel => estree (#2846)
swc_babel_ast:
 - Rename as `swc_estree_ast`.

swc_babel_compat:
 - Rename as `swc_estree_compat`.

swc_babel_visit:
 - Rename as `swc_estree_visit`.
2021-11-24 05:34:41 +09:00
Donny/강동윤
6b96a3d8ed
feat: Enable logging of timings (#2833)
swc_timer:
 - Add `Timer`.
 - Add `timer!()`.

node:
 - Enable logging.
2021-11-22 21:01:08 +09:00
Donny/강동윤
1d518fe381
refactor: Flatten css (#2731) 2021-11-12 19:37:05 +09:00
Donny/강동윤
2b2f6955f2
refactor: Flatten ecmascript (#2708) 2021-11-10 19:00:54 +09:00
Donny/강동윤
4f70ee6d98
refactor: Flatten more packages (#2706) 2021-11-10 16:39:01 +09:00
Donny/강동윤
687305f280
refactor: Flatten crates (#2697) 2021-11-09 20:42:49 +09:00
Donny/강동윤
bf0007bec0
feat(rplugin): Implement general AST processing plugin system (#2671)
swc_common:
 - Implement `StableAbi` for `BytePos`.
 - Implement `StableAbi` for `Span`.

rplugin:
 - Add `StableAst`.

swc_plugin_api:
 - Drop unused dependencies.

swc_ecma_plugin_ast:
 - Initialize crate.
2021-11-09 18:46:24 +09:00
Donny/강동윤
22ce68cfaa
fix(swc): Don't print same error twice (#2692) 2021-11-09 15:18:11 +09:00
Donny/강동윤
3dc1e765e9
feat(swc): Provide &Program to pass creator (#2665)
swc:
 - Use `impl |prorgram: &Program| -> impl Fold` instead of `impl Fold`. (Closes https://github.com/swc-project/swc/issues/2664)
2021-11-06 18:05:10 +09:00
Donny/강동윤
994c9655c8
feat(es/ast): Add utils (#2657)
swc_ecma_ast:
 - Add `as_ident` to `PatOrExpr`.
 - Add `as_ident_mut` to `PatOrExpr`.
 - Replace `Is` macro for `ParOrExpr` with custom impl.
2021-11-05 16:09:08 +09:00
Donny/강동윤
3280b4cd7a
refactor(es/parser): Deprecate JscTarget (#2600)
swc_ecma_parser:
 - Deprecate `JscTarget`.
2021-10-31 12:25:15 +00:00
Donny/강동윤
e589d00f62
refactor: Move HANDLER to swc_common (#2599)
swc_common:
 - Add `HANDLER`.

swc_ecma_utils:
 - Replace `HANDLER` with one from `swc_common`.
 - Make `StmtLike` `: Send + Sync`.
2021-10-31 20:41:36 +09:00
Donny/강동윤
33bc3d2b91
feat(es/transforms/regenerator): Allow configuring import path (#2581)
swc_ecma_transforms_compat:
 - `regenerator`: Allow configuring import path of `regenerator-runtime`.
2021-10-29 14:36:11 +00:00
Donny/강동윤
4b2903e3b4
fix(es/minifier): Fix minifier (#2564)
swc_ecma_minifier:
 - Don't change depth of function while negating if statements. (#2558)

swc_ecma_transforms_optimization:
 - `dead_branch_remover`: Preserve `this`. (#2465, #2466)

swc:
 - Make `toplevel` default to true if `module` is true. (#2254)
2021-10-28 04:35:45 +00:00
Donny/강동윤
8494f6583c
fix(swc): Allow overriding specified parser config using .swcrc (#2547)
swc:
 - Merge parser config by enabling each feature. (#2546)
2021-10-26 22:39:06 +00:00
Sosuke Suzuki
65c83e8cb4
feat(es/transforms): Move stage 4 proposals to es2022 (#2519) 2021-10-24 21:28:40 +09:00
Donny/강동윤
fce3b79e79
fix(es/minifier): Improve name mangler (#2509)
swc_ecma_transforms_base:
 - Expose renamer.

swc_ecma_minifier:
 - Improve name mangler.

swc:
 - Disable hygiene if mangler is enabled.
2021-10-24 10:52:09 +00:00
Sosuke Suzuki
ecd617af39
feat(es/transforms): Move class_properties to es2022 (#2512) 2021-10-23 23:25:14 +09:00
Donny/강동윤
ecf0d7507c
feat(swc): Allow removing filename from error output (#2498)
swc:
 - Add an option to exclude filename from error messages.
2021-10-21 04:45:12 +00:00
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