Commit Graph

191 Commits

Author SHA1 Message Date
Donny/강동윤
01e171a4b4
test(es): Freeze as es2015 to verify base transforms (#2468) 2021-10-19 05:31:12 +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
98a18e306a chore: Publish swc_ecma_transforms_compat 2021-10-19 00:43:00 +09: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
ac772403b2 chore: Add include to swc 2021-10-18 16:49:21 +09: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/강동윤
675c0e714f
test(es): Use typescript test suite as a golden testing (#2456) 2021-10-18 04:07:23 +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
Alexander Akait
4f2dbd816c
fix(css/parser): Fix parsing of numbers (#2444) 2021-10-17 23:24:28 +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/강동윤
7f04ef4715
feat(css/parser): Allow invalid line comments (#2443)
swc_css_parser:
 - Accept line comments with an option.
2021-10-15 23:21:33 +09:00
Alexander Akait
c2ce89c0fb
feat(css): Add BadUrl token (#2426)
swc_css_ast:
 - Add `BadUrl` to `Token`.

swc_css_parser:
 - Implement error recovery for bad urls.
2021-10-15 22:36:54 +09:00
Donny
dcf42771ad chore: Publish 2021-10-15 19:21:25 +09: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
Alexander Akait
e2e4f2f64f
fix(css/ast): Fix delimiter token (#2415) 2021-10-14 13:22:51 +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
Alexander Akait
f7b065ef0b
fix(css/parser): Fix parsing of comments (#2414) 2021-10-13 20:48:15 +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
Alexander Akait
fb4869f413
feat(css/ast): Add delim token (#2398) 2021-10-12 20:47:17 +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
David Sherret
d114e7d364
refactor(es/parser): Cleanup codes for the comment buffer (#2410) 2021-10-12 12:08:06 +09:00
Donny/강동윤
4411d1d3a5
perf(atoms): Update string_cache (#2411)
swc_atoms:
 - Use `string_cache` with `parking_lot` patch applied.

wasm:
 - Pin `parking_lot_core` to `=0.8.0` to workaround https://github.com/Amanieu/parking_lot/issues/269.
2021-10-12 03:05:17 +00: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
Alexander Akait
2678c34488
feat(css/ast): Add raw to Url (#2389) 2021-10-11 12:33:11 +09:00
Pig Fang
4458f9c74d
fix(es/parser): Allow async in TsAsExpr (#2395) 2021-10-10 20:22:42 +09:00
Donny
fd08a27f0c chore(plugin): Publish 2021-10-10 20:18:19 +09:00
Donny/강동윤
897f4b670e
fix(dev/cli): Remove CLI from main swc repositoy (#2393) 2021-10-10 11:17:12 +00: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
Donny/강동윤
ab687a0f98
fix(es/minifer): Fix handling of callable expressions (#2379)
swc_ecma_minifier:
 - `sequences`: Don't inline into arrow expression or function expressions.
 - Inject variables to arrow expressions correctly.
2021-10-10 03:47:11 +00:00