Commit Graph

218 Commits

Author SHA1 Message Date
Donny/강동윤
91ef3cc16e
feat(plugin): Enable plugin support under experimental flag (#2894)
swc_plugin_runner:
 - Add plugin resolver.
 - Implement cache for resolver.
 - Add some integration tests.

swc:
 - Add a cargo feature named `plugin`.
 - Add an experimental option for plugins.

node:
 - Enable `plugin`.
 - Add some integration tests.
2021-11-28 17:02:14 +09:00
Donny
2be8559e35 chore: Publish crates 2021-11-10 13:58:42 +09:00
Donny/강동윤
687305f280
refactor: Flatten crates (#2697) 2021-11-09 20:42:49 +09:00
RiESAEX
7ab3b5b0b8
fix(es/transforms/react): Fix handling of whitespaces (#2638)
swc_ecma_transforms_react:
 - `jsx`: Preserve more whitespaces in input. (Closes #2208)
2021-11-09 06:10:23 +00:00
OJ Kwon
94cb4303ae
refactor: Remove trailing whitespace (#2668) 2021-11-07 20:46:12 +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/강동윤
808d57822b
fix(es/minifier): Fix for @emotion/react and murmur2 (#2637)
swc_ecma_minifier:
 - Check for the operator while folding binary assignments. 
 - `sequences`: More check before inlining into operator assignments.
2021-11-03 22:46:25 +09:00
Donny/강동윤
f4efd7ad92
fix(es/transforms): Fix detection of this (#2634)
swc_ecma_utils:
 - `contains_this_expr`: Exclude `this` in object properties.

swc_ecma_transforms_compat:
 - `arrow`: Exclude `this` in object properties. (https://github.com/vercel/next.js/issues/30592)
 - `parameters`: Exclude `this` in object properties.
2021-11-03 13:53:23 +09:00
Donny/강동윤
550584f93c
fix(es/compat): Fix order of transforms (#2629)
swc_ecma_transforms_compat:
 - Change order of `regenerator` and `destructring`. (https://github.com/vercel/next.js/issues/30683, Closes https://github.com/swc-project/swc/issues/2413)
2021-11-03 13:18:43 +09:00
OJ Kwon
12be4b1799
fix(es/transforms/typescript): Allow (foo as any) = bar (#2631)
swc_ecma_transforms_typescript:
 - `strip`: Handle paren in the LHS of assignment expressions properly. (Closes https://github.com/swc-project/swc/issues/2606)
2021-11-03 11:25:18 +09:00
OJ Kwon
d2f2409528
fix(es/transforms/strip): Strip types for typescript export equals (#2623)
swc_ecma_transforms_typescript:
 - `strip`: Visit the RHS of typescript export equals.
2021-11-02 05:50:42 +00:00
OJ Kwon
5b141ee80a
fix(es/transforms/cjs): Allow using multiple export * (#2598)
swc_ecma_transforms_module:
 - Preserve order of imports for reexports. (#2594)
2021-11-02 13:59:33 +09:00
Jeremy Grieshop
7e3fb0a0ab
fix(es/transforms/cjs): Allow mixing named exports and export stars. (#2583)
swc_ecma_transforms_module:
 - `common_js`: Fix _exportNames when exporting aliases and using `export *`s . (#2548)
2021-10-31 09:12:36 +00:00
Kaciras
4327d11d41
fix(swc): Use standard base64 charset for inlined source maps (#2585) 2021-10-30 16:21:29 +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/강동윤
f9a8ad386d
chore: Make cargo test --all work (#2580) 2021-10-29 11:54:30 +00:00
Donny/강동윤
69cfa98c50
fix(es/minifier): Fix block unwrapping issue (#2570)
swc_ecma_minifier:
 - Check more before removing `{` and `}`.
2021-10-28 10:58:26 +00:00
Donny/강동윤
7e29685a17
chore: Fix failing tests and improve CI scripts (#2563) 2021-10-28 02:55:49 +00:00
Donny/강동윤
79a426e0d8
fix(es/minifier): Don't treat catch clause as a scope (#2557)
swc_ecma_minifier:
 - Don't treat a catch clause as a scope.
2021-10-27 11:19:30 +00:00
Donny/강동윤
5f0524c54e
fix(es/transforms/react): Revert #2542 (#2552) 2021-10-27 04:42:12 +00:00
Donny/강동윤
f81b60fd1b
fix(es/minifier): Fix minifier (#2551)
swc_ecma_minifier:
 - `hoist_props`: Check for infection. (#2506)
2021-10-27 04:19:14 +00:00
Donny/강동윤
70f55833e9
feat(es/transforms/react): Improve development more (#2542)
swc_ecma_transforms_react:
 - `jsx_src`: Add column to `__source`.
 - `jsx`: Support `jsxDEV`.
 - `jsx`: Handle `__source` and `__self` specially.
2021-10-26 11:09:09 +00:00
Donny/강동윤
b8933e3db9
fix(swc): Fix bugs (#2538)
swc_ecma_transforms_base:
 - `unique_scopes`: Handle method properties.
 - `hygiene`: Fix handling of method properties. (#2539)

swc_ecma_transforms_compat:
  - Fold children of for-of/in statements. (#2531)

swc_ecma_minifier:
 - `name_mangler`: Fix handling of method properties.
2021-10-26 07:43:32 +00:00
Donny/강동윤
e7189fbdbd
fix(es/transforms/compat): Fix async_to_generator (#2526)
swc_ecma_transforms_compat:
 - `async_to_generator`: Handle `for-await` correctly. (#2306)
2021-10-25 05:37:13 +00: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/강동윤
f33d3218cd
feat(es/transforms/compat): Add single-property optimization to destructuring (#2511)
swc_ecma_transforms_compat:
 - `destructuring`: Convert single-property destructuring to direct field access.
2021-10-22 13:46:29 +00:00
Donny/강동윤
175c997676
fix(es/transforms/react): Fix hygiene of react fast refresh (#2501)
swc_ecma_trasnforms_react:
 - `refresh`: Use span hygiene system.
2021-10-21 14:09:00 +00:00
Donny/강동윤
9e215769cc
fix(es/minifier): Fix minifier using Deno test suite (#2503)
swc_ecma_codegen:
 - Emit `;` after private class properties.

swc_ecma_minifier:
 - `pure`: Drop more invalid expressions.
 - `sequences`: Drop more invalid expressions.
 - `strings`: Fix concat.
 - `inline`: Inline into `b` in `a[b] = foo`.
2021-10-21 11:56:48 +00:00
Nayeem Rahman
c29a6e11c9
fix(es/transforms/typescript): Fix strip (#2496)
swc_ecma_transforms_typescript:
 - Visit the RHS of import equals declaration properly.
2021-10-21 15:12:51 +09:00
Donny/강동윤
26944e159d
fix(es/transforms/base): Reimplement hygiene (#2408)
swc_ecma_transforms_base:
 - Reimplement `hygiene`.
2021-10-21 05:12:50 +00: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/강동윤
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/강동윤
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/강동윤
ee880d63ae
fix(swc): Change default value of inlineSourcesContent (#2471)
swc:
 - Make `inlineSourcesContent` `true` by default. (#2470)
2021-10-19 06:37:58 +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/강동윤
01e171a4b4
test(es): Freeze as es2015 to verify base transforms (#2468) 2021-10-19 05:31:12 +00: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/강동윤
675c0e714f
test(es): Use typescript test suite as a golden testing (#2456) 2021-10-18 04:07:23 +00: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