Commit Graph

194 Commits

Author SHA1 Message Date
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
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/강동윤
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/강동윤
a25d67bfbf
chore: Check for issues already fixed (#2429)
- Closes #2372.
 - Closes #2351.
2021-10-14 04:15:10 +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/강동윤
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
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
Donny/강동윤
6366d05fd3
fix(es): Fix bugs (#2403)
swc:
 - Ensure that #2114 is fixed.
 - Ensure that #2310 is fixed.
2021-10-11 16:27:57 +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/강동윤
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/강동윤
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
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/강동윤
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/강동윤
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/강동윤
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/강동윤
bd92d89306
fix(es/codegen): Fix codegen of numbers (#2317)
swc_ecma_codegen:
 - Fix codegen of numbers when minification is enabled. (#2294)
2021-09-29 11:08:59 +00:00
Donny/강동윤
1b2e6706bd
fix(swc): Fix simple bugs (#2292)
swc:
 - Ensure that #2154 is not the case. (#2154)

node_swc:
 - Verify `sourceMaps: true` in `.swcrc`. (#2120, #2194)
2021-09-23 08:10:12 +00:00
Donny/강동윤
2156364121
fix(es/transforms/base): Fix hygiene (#2282)
swc_ecma_transforms_base:
 - `hygiene`: Handle decl-ref conflict. (#2211)
2021-09-22 06:56:04 +00:00
Donny/강동윤
e5f46a6800
fix(wasm): Fix bugs (#2279)
swc:
 - Ensure that #2281 is fixed. (#2281)

wasm:
 - Fix `baseUrl` and `paths` support.
 - Apply `hygiene` pass.
2021-09-21 15:24:03 +00: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
강동윤
ce01b8a9b7
fix(es): Fix bugs (#2256)
swc_ecma_codegen:
 - Fix source map of string literals. (#2253)

swc_ecma_transforms_typescript:
 - Allow using same name for a module with function. (#2243)
2021-09-18 07:52:08 +00:00
강동윤
20ce326909
feat(es/minifer): Improve minifier (#2229)
swc_ecma_minifier:
 - `if_return`: Allow side-effect-free statements to come after `if_return`.
 - `collapse_vars`: Move variables without init to first.
 - `analyzer`: Remove useless fields.
 - Don't drop `return` tokens if there's a finally block.
 - `drop_return_value`: Drop side-effect-free return arguments.
 - `make_sequences`: Don't inject `void 0` to return args.
 - `if_terminate`: Move to the pure optimizer.
 - Fix a bug related to `RegExp`.
2021-09-16 04:23:33 +00:00
강동윤
6f33c327cb
fix(es/transforms): Fix bugs (#2249)
swc_ecma_transforms_compat:
 - Fix `this` in class properties. (#2228)

swc_ecma_transforms_typescript:
 - Handle `import =` correctly. (#2234)
 - Ensure that #1653 is not the case anymore. (#1653)

swc:
 - Ensure that #2232 is not the case. (#2232)
2021-09-15 07:46:03 +00:00