Commit Graph

242 Commits

Author SHA1 Message Date
OJ Kwon
dab2002a2e
refactor(plugin/runner): Split modules and introduce feature flags (#4035) 2022-03-15 22:45:40 +00:00
Donny/강동윤
40b8a4e596
feat(common): Implement a pretty error reporter (#3946) 2022-03-13 19:07:18 +00:00
OJ Kwon
ffb2ee85e6
fix(node-swc): Correctly close trace spans after completion (#3811) 2022-03-02 10:03:00 +00:00
OJ Kwon
7fd0eeecb8
perf(plugin/runner): Optimize write_into_memory_view (#3797) 2022-03-01 08:20:56 +00:00
OJ Kwon
05aecf507e
fix(plugin): Fix caching of wasm modulee (#3616) 2022-02-18 05:50:51 +00:00
OJ Kwon
88e07b21d1
refactor(plugin): Remove direct dependency to once_cell (#3582) 2022-02-16 14:43:25 +09:00
OJ Kwon
a96217feaa
feat(plugin): Add PluginContext (#3568) 2022-02-15 08:03:17 +00:00
OJ Kwon
a4d914dab5
chore(build): Remove version pinning of parking_lot_core (#3537) 2022-02-12 14:24:49 +09:00
OJ Kwon
6ed089e1cf
feat(cli): Add a command for scaffolding a new plugin (#3536) 2022-02-12 13:48:40 +09:00
OJ Kwon
bc250262f2
feat(plugin): implement proxy for Mark and SyntaxContext (#3511) 2022-02-10 06:57:42 +00:00
OJ Kwon
494b4c8203
feat(swc/plugin): Implement proxy for Mark::fresh (#3492) 2022-02-09 13:56:39 +09:00
OJ Kwon
d473a65976
feat(plugin): Support global HANDLER in the plugin context (#3478) 2022-02-08 14:06:10 +09:00
OJ Kwon
a8debc17f6
feat(plugin): Pass host context to plugins for diagnostics emission (#3359) 2022-01-25 08:13:39 +00:00
OJ Kwon
438649818f
refactor(plugin): Remove multivalue polyfill (#3346) 2022-01-24 15:13:30 +09:00
OJ Kwon
7ba8a83881
test(plugin/runner): Pin dependencies for the integration test (#3306) 2022-01-19 05:01:45 +00:00
OJ Kwon
c6ffdc8717
feat(plugin): Add PluginError (#3300) 2022-01-18 12:26:04 +09:00
OJ Kwon
66d1a92635
feat(plugin/runner): Free allocated memory on errors (#3270) 2022-01-15 05:10:19 +00:00
OJ Kwon
a4c497464d
feat(plugin/runnner): Support wasm32-wasi targets (#3271) 2022-01-15 04:40:00 +00:00
OJ Kwon
432d5d3fb7
feat(plugin/macro): Add safe API for plugins based on a proc-macro (#3240) 2022-01-12 09:32:52 +00:00
OJ Kwon
a2f2b5ac89
feat(plugin): Don't serialize/deserialize needlessly (#3227)
swc_common:
 - Add `Serialized`.

swc_plugin_runner:
 - Accept `Serialized` instead of `Program`.
 - Pass `Serialized` from previous plugin instead of deserializing it.
2022-01-11 10:11:04 +00:00
Austaras
f58b50bea7
refactor(es/ast): Change types of member-like expressions (#3178)
swc_ecma_ast:
 - Split `MemberExpr` into `MemberExpr` and `SuperPropExpr`.
 - Use `Box<Expr>` for `MemberExpr.obj`.
 - Use ad-hoc type for `MemberExpr.prop`.
 - Use ad-hoc type for `SuperPropExpr.prop`.
 - Use `Callee` instead of  `ExprOrSpread` for `CallExpr`.
 - Simplify types for meta property expressions.
2022-01-10 13:54:42 +00:00
OJ Kwon
7e7421ea52
feat(plugin): Perform actual transforms in plugins (#3220) 2022-01-10 21:34:16 +09:00
OJ Kwon
c9ded9b720
feat(plugin): Allow multi-value for the plugin signature (#3216) 2022-01-09 15:02:56 +09:00
OJ Kwon
92de2c7884
feat(plugin): Pass serialized ast to a wasm file (#3199)
swc_common:
 - Use correct cargo feature for plugin apis.

swc_plugin:
 - Add hidden functions required for memory operations from host.

swc_plugin_runner:
 - Pass serialized AST to a wasm file.
2022-01-07 15:13:46 +09:00
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