Commit Graph

1048 Commits

Author SHA1 Message Date
Donny/강동윤
26944e159d
fix(es/transforms/base): Reimplement hygiene (#2408)
swc_ecma_transforms_base:
 - Reimplement `hygiene`.
2021-10-21 05:12:50 +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
Sosuke Suzuki
bb1cc974c7
feat(es/trasform): Support static blocks (#2474)
swc_ecma_transforms_proposal:
 - Add transform for static blocks, which is stage 3.
2021-10-20 14:18:55 +09:00
Donny/강동윤
cef2c8666e
fix(es/minifier): Fix join_vars (#2494)
swc_ecma_minifier:
 - Don't join `let`/`const` into narrower scope.
2021-10-20 05:17:14 +00:00
David Sherret
3886eeddd5
fix(es/parser): Fix parsing of a property named async (#2485) 2021-10-20 04:31:52 +09:00
Donny/강동윤
7c5b6cafd8
fix(es/minifier): Fix regexp handling (#2489)
swc_ecma_minifier:
 - Use allowlist of characters for optimizing RegExp calls.
2021-10-19 19:30:20 +00:00
Donny/강동윤
bf886bac73
perf(es/parser): Make typescript parser faster (#2483)
swc_ecma_parser:
 - Check for option before backtracking.
2021-10-20 00:00:48 +09: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/강동윤
9b96885171
fix(es/transforms/compat): Fix handling of private static properties (#2478)
swc_ecma_transforms_compat:
 - `class_properties`: Replace `this` in private static property initializers. (#2476)
2021-10-19 11:21:13 +00:00
Donny/강동윤
0020e16370
fix(es/minifier): Fix minifier (#2477)
swc_ecma_minifier:
 - `MultiReplacer`: Handle inlining into shorthands.
 - `ExprReplacer`: Handle inlining into shorthands.
2021-10-19 11:00:51 +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
98a18e306a chore: Publish swc_ecma_transforms_compat 2021-10-19 00:43:00 +09:00
Donny/강동윤
201c0fcfd0
fix(es/regenerator): Fix for nested try (#2463)
swc_ecma_transforms_compat:
 - `regenerator`: Use correct order for try locations array.
2021-10-18 15:40:53 +00:00
Donny/강동윤
5bcabb0471
fix(es/transforms/compat): Fix regenerator (#2460) 2021-10-18 12:35:26 +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/강동윤
06ca25f3d0
fix(es/minifier): Check for conditional usages while inlining (#2459)
swc_ecma_minifier:
 - `hoist_props`: Check for `used_in_cond` before inlining.
2021-10-18 07:34:17 +00: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/강동윤
de368f6bb7
fix(es/codegen): Escape backtick of synthesized template literals (#2453)
swc_ecma_codegen:
 - Escape backtick of a template literal if it's synthesized.
2021-10-17 20:44:21 +09:00
Donny/강동윤
63ad4b4322
fix(es/minifier): Fix minification of react hooks (#2450)
swc_ecma_minifier:
 - `analyze`: Track for conditional usages.
 - `collapse_vars`: Don't inline a variable if usage it conditinal.
2021-10-17 15:24:17 +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/강동윤
7ab07ab0b9
fix(es/transforms/base): Fix resolver (#2448)
swc_ecma_transforms_base:
 - `resolver`: Handle `AssignPatProp` from `Hoister`.
2021-10-16 15:12:53 +09:00
Donny/강동윤
ee9177b753
fix(es): Fix bugs (#2447)
swc_ecma_parser:
 - Fix parsing of jsx escapes.

swc_ecma_minifier:
 - Don't mangle name as `const` or `let`. (#2446)

swc_ecma_transforms_react:
 - Fix handling of jsx escapes. (#2351)
2021-10-16 04:25:54 +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/강동윤
e722bd4887
perf(es/transforms): Reduce usage of #[fast_path] (#2439)
swc_ecma_transforms_compat:
 - Remove `#[fast_path]` from passes.
 - Migrate some passes to `VisitMut`.
2021-10-15 10:18:27 +00:00
Donny/강동윤
d045244089
fix(es/codegen): Fix codegen of synthesized template literals. (#2440)
swc_ecma_codegen:
 - Don't handle synthesized backtick specially.
2021-10-15 09:12:40 +00: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/강동윤
0e48284afb
fix(es/minifier): Fix bugs (#2433)
swc_ecma_minifier:
 - `sequences`: Stop searching for candidates if a dependency issue is found.
2021-10-14 13:48:14 +00:00
Donny/강동윤
f8995848b8
fix(es/transforms/proposal): Fix type detection (#2431)
swc_ecma_transforms_proposal:
 - Try the type of the LHS of an assignment pattern. (#2428)
2021-10-14 06:19:34 +00:00
Donny/강동윤
647d3ed36a
chore(doc): Add an example of stripping out types (#2430) 2021-10-14 04:43:55 +00: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/강동윤
aff6670856
fix(es/minifier): Fix infinite loop (#2424)
swc_ecma_minifier:
 - Prevent infinite loop of post-optimize inliner.
2021-10-13 19:26:47 +09:00
Donny/강동윤
8074c72ce9
fix(es/transforms/base): Fix hyigiene (#2421)
swc_ecma_transforms_base:
 - `hygiene`: Considering scoping of `var`.
 - `hygiene`: Avoid creating too many `JsWord` by caching index.
2021-10-13 17:32:37 +09:00
Bojan Đurđević
029cf056f2
fix(es/transforms/react): Fix escape of quote in HTML entities (#2419)
swc_ecma_transforms_react:
 - Handle escape of `"` correctly.
2021-10-13 14:33:15 +09:00
Donny/강동윤
62f7f655a9
fix(es/minifier): Fix iteration order (#2412)
swc_ecma_minifier:
 - Don't use `AHashMap::drain` for inlining variables.
2021-10-12 10:19:20 +00:00
Pig Fang
9446a037cb
fix(es/parser): Fix class getter/setter ASI bugs (#2409) 2021-10-12 18:47:40 +09:00
David Sherret
d114e7d364
refactor(es/parser): Cleanup codes for the comment buffer (#2410) 2021-10-12 12:08:06 +09:00
David Sherret
4d4771109a
fix(es/parser): Ensure that comments are collected (#2407) 2021-10-12 11:07:52 +09:00
Pig Fang
4ad25d2155
refactor(es/parser): Simplify parsing logic (#2405) 2021-10-11 23:09:45 +09:00
Donny/강동윤
b5f832193a
perf(bundler): Improve performance (#2394)
swc_ecma_utils:
 - Make `collect_decls` parallel. (with threshold of 128)

swc_bundler:
 - Make inlining of synthesized variables parallel.
2021-10-11 13:00:02 +00: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/강동윤
f5607891e4
fix(es/transforms/testing): Fix test_fixture (#2400)
swc_ecma_transforms_testing:
 - Make logic depends on `NormalizedOutput::compare_to_file`.
2021-10-11 05:03:57 +00:00
Pig Fang
d7f570ff7c
fix(es/parser): Fix async function in SeqExpr (#2399) 2021-10-11 12:38:35 +09:00
Pig Fang
4458f9c74d
fix(es/parser): Allow async in TsAsExpr (#2395) 2021-10-10 20:22:42 +09:00
Donny/강동윤
ff2baf75b4
fix(swc): Fix bugs (#2396)
swc_ecma_codegen:
 - Check for comments deeply while emitting a return statement.

swc_ecma_transforms_react:
 - Fix handling of texts in attributes.
2021-10-10 09:19:47 +00:00
Donny/강동윤
a33032279a
perf(es/transforms/base): Make resolver faster (#2392)
swc_ecma_transforms_base:
 - `resolver`: Don't use `Mark::parent()`.
2021-10-10 05:06:07 +00:00