Commit Graph

187 Commits

Author SHA1 Message Date
magic-akari
9e162dcbae
fix(es/modules): Improve compatibility with cjs lexer (#5080) 2022-07-01 08:37:04 +00:00
magic-akari
1e33dbab24
feat(es/modules): Support node interop (#5069) 2022-07-01 03:28:03 +00:00
magic-akari
2cc229e6fb
feat(es/modules): Optimize a dynamic import with a literal path (#5049) 2022-06-28 06:31:24 +00:00
magic-akari
7d4e6bef96
fix(node-swc/types): Add nodenext config type (#5044) 2022-06-28 06:03:37 +00:00
magic-akari
fa68cbd74a
refactor(es/module): Implement new module transformer (#4758) 2022-06-27 12:32:06 +00:00
Andrew Bradley
e30449b097
fix(node/types): Add ignoreDynamic to typescript types (#4832) 2022-05-28 19:23:56 +00:00
Donny/강동윤
c31b0a38ea
chore(ci): Fix CI (#4779) 2022-05-24 23:39:08 +09:00
Donny/강동윤
b8d2fb8546
feat(es/helpers): Import only used helpers (#4767) 2022-05-24 04:09:59 +00:00
Donny/강동윤
417b2182ce
fix(es/loader): Fix jsc.paths on windows (#4739) 2022-05-22 20:12:22 +00:00
Donny/강동윤
9966e98ac6
fix(es/config): Respect .swcrc (#4735) 2022-05-21 23:18:43 +09:00
Donny/강동윤
ad309f4050
fix(es/config): Auto-detect tsx (#4696) 2022-05-18 10:21:45 +00:00
Donny/강동윤
53ff81ccd6
test(es): Add a test for merging configurations (#4617) 2022-05-11 07:08:52 +00:00
Donny/강동윤
3b2b8c4512
fix(es/config): Merge jsc.transform correctly (#4615) 2022-05-11 14:28:40 +09:00
Donny/강동윤
c68dec9448 chore: Publish v1.2.181 2022-05-10 04:52:51 +09:00
Donny/강동윤
7fc9bbccd9
feat(config): Make all configuration overridable (#4575) 2022-05-09 05:38:27 +00:00
즈눅
3ed1538bfe
fix(node/types): Add types for jsc.minify.format (#4492) 2022-05-01 03:46:13 +00:00
즈눅
b63cd53ca6
chore(node/types): Add unsafe to compress options (#4362) 2022-04-18 09:39:18 +00:00
Donny/강동윤
ba5f7436c1
chore(es/minifier): Add full benchmark for .minify() (#4341) 2022-04-15 22:31:15 +00:00
那里好脏不可以
37a8c90750
chore(*): Typo + fomatting (#4304) 2022-04-11 18:45:58 +00:00
Yorkie Liu
1a48732e78
fix(node-swc/types): Add isTypeOnly to types (#4303) 2022-04-11 13:04:37 +00:00
Alexander Akait
f39d3aca4d
feat(es/ast): Add raw to Num (#4245) 2022-04-05 12:46:35 +00:00
Alexander Akait
634d732803
feat(es/ast): Add raw to Str (#4071) 2022-03-22 07:54:08 +00:00
Donny/강동윤
61f1a37492
fix(es/codegen): Fix codes related to sourcemap (#4106) 2022-03-21 05:14:45 +00:00
OJ Kwon
5a2a6037d4
feat(node-swc): Embed target triple string (#4058) 2022-03-17 07:57:16 +00:00
Alexander Akait
bd444c0ceb
fix(es/codegen): Fix codegen of string literals (#4037) 2022-03-16 14:25:26 +00:00
Donny/강동윤
834cd4f7b6
fix(es/modules): Use correct span for ExportAlls (#4038) 2022-03-16 17:10:47 +09:00
Donny/강동윤
48f2fd8e1b
fix(es): Change error message as it can be misleading (#3982) 2022-03-12 14:32:00 +09:00
David Campion
c5a0c9a0ab
feat(es): Add an option to preserve all comments (#3815) 2022-03-11 07:25:59 +00:00
nikaple
70a68a7850
fix(node-swc/types): Add reserved to TerserMangleOptions (#3959) 2022-03-11 04:31:13 +00:00
Austaras
26abc6ba7e
refactor(es/ast): Remove useless fields in private property (#3868) 2022-03-05 23:51:04 +09:00
Austaras
6f076e4927
feat(es/transform): Unify logic for handling class properties (#3766) 2022-03-05 06:46:09 +00:00
Menci
bde7577098
fix(node-swc/types): Add a missing field of ExportNamedDeclaration (#3822) 2022-03-03 06:46:30 +00:00
Menci
4d123c3789
fix(node-swc): Fix handling of OptionalChainingExpression in Visitor (#3809) 2022-03-02 10:54:53 +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
b485a2fc26
build(node-swc): Rename entrypoint to avoid artifact collision (#3806) 2022-03-02 12:23:01 +09:00
OJ Kwon
95ecc013fe
fix(node-swc/cli): Correctly expose swcx entrypoint (#3784) 2022-03-01 08:41:45 +00:00
OJ Kwon
a454996314
feat(node-swc): Add experimental trace support in @swc/core (#3731) 2022-02-25 04:06:45 +00:00
magic-akari
1743302819
feat(es/typescript): Inline typescript enums (#3647) 2022-02-24 09:19:49 +00:00
OJ Kwon
2b5eba16c3
fix(node-swc/types): Fix experimental config options (#3603) 2022-02-17 05:41:51 +00:00
OJ Kwon
07485d372e
refactor(node-swc/types): Provide typed configuration for plugins (#3584) 2022-02-16 10:10:05 +00:00
Menci
bf68155e56
fix(node-swc/types): Change StringLiteral.has_escape to StringLiteral.hasEscape (#3581) 2022-02-16 14:39:30 +09:00
Donny/강동윤
3fc16cdc1c
doc(plugin): Fix typo (#3547) 2022-02-13 01:16:52 +09:00
LongYinan
9608605772
build(node-swc): Fix GLIBC < 2.18 compatible issues and android arm binary loading issue (#3314) 2022-01-20 02:21:24 +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
Donny
e19fe7d33b chore(ci): Remove redudant plugin test 2022-01-06 18:01:08 +09:00
Donny
1dfc2ee105 fix(node-swc): Recover from ldd not found 2022-01-03 18:24:29 +09:00
Donny
29f05b55fc chore: Publish crates 2022-01-02 05:02:48 +09:00
Andreu Botella
c9adf03338
fix(es): Handle import assertions correctly (#3113)
swc_ecma_codegen:
 - Implement codegen for static import assertions.

swc_ecma_transforms_proposal:
  - `import_assertions`: Support `export`s.

swc:
 - Add `jsc.experimental.keep_import_assertions`.

node-swc:
 - Fix typo.
2021-12-28 11:18:33 +00:00
Idan Attias
054a19518c
fix(node-swc): Recover from ldd not found (#3125) 2021-12-27 17:05:36 +09:00
LongYinan
206da128a1
feat(node): Upgrade napi to v2 (#2958) 2021-12-24 02:21:24 +00:00
Yunfei He
bdea89dd95
type(node/swc): Allow null for NamedExportSpecifier.exported (#3010) 2021-12-11 16:23:41 +09:00
Alex Eagle
c02dd9935e
fix(node/swc): Allow using custom bindings (#2983) 2021-12-08 06:57:40 +00:00
Sukka
1f6d8302c1
fix(node/swc): Add baseUrl to JscConfig (#2968) 2021-12-04 19:19:07 +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
Sven
65d376a91b
feat(swc): Add IsModule (#2601)
swc:
 - Allow parsing input as a `Program`. (Closes #2541)
2021-11-16 10:31:02 +00: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
magic-akari
b6a5656f69
fix(node/types): Add es6 to ModuleConfig (#2648) 2021-11-04 11:43:48 +00:00
LongYinan
1a659d3214
ci: Sync to latest napi workflow (#2592) 2021-10-31 10:04:18 +09:00
zEh-
ef3c9a7422
chore: Fix typo (#2586) 2021-10-30 14:18:43 +09:00
Donny/강동윤
8494f6583c
fix(swc): Allow overriding specified parser config using .swcrc (#2547)
swc:
 - Merge parser config by enabling each feature. (#2546)
2021-10-26 22:39:06 +00:00
Sosuke Suzuki
ecd617af39
feat(es/transforms): Move class_properties to es2022 (#2512) 2021-10-23 23:25:14 +09: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/강동윤
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/강동윤
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/강동윤
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
Amos Wong
f42616698c
fix(node/bundler): Prevent spreading string into return (#2335) 2021-10-03 23:16:48 +09:00
즈눅
2580f1a372
feat(node/swc): Add a named export for Visitor (#2291) 2021-09-26 19:41:22 +09: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
즈눅
4846c32303
fix(node/swc): Allow JsMinifyOptions type for JscConfig.minify (#2287) 2021-09-23 13:44:36 +09:00
즈눅
dd3f18b760
chore: Fix typo (#2288) 2021-09-23 13:43:31 +09:00
강동윤
48d61039d2
fix(common, node/swc): Allow inlining sourcesContent (#2245)
swc_common:
 - Allow setting `sourceContents` of source map files. (#2218)

swc:
 - Support `inlineSourceContents`. (#2244)
2021-09-14 02:31:32 +00:00
Iron Lu
4ca85ec79c
feat(node/swc): Enable tsx automatically based on the extension (#2230) 2021-09-14 10:47:53 +09:00
강동윤
9eafd0c6c4
fix(es/loader): Fix support for jsc.paths. (#2227)
swc_ecma_loader:
 - `TsConfigResolver`: Use `baseUrl`. (#2050)

swc:
 - Change type of `JscConfig.base_url` to `PathBuf`.

testing:
 - Improve `NormalizedOutput::compare_to_file`.
2021-09-10 12:29:26 +00:00
강동윤
cb2b0c671f
fix(es/transforms/base): Optimize hygiene (#2193)
swc_ecma_transforms_base:
 - `hygiene`: Don't rename if not required. (#1600)

swc_ecma_minifier:
 - Remove `hygiene_optimizer`.
2021-09-01 13:11:55 +00:00
강동윤
d975a197c9
fix(es): Fix source map (#2159)
swc:
 - Fill `names` of sourcemap.
 - Don't add `sourceContents` to sourcemap if `sources` is added.

node_swc:
 - Handle source map for `minify` correctly.
 - `minify`: Accept `{ filename: code }`.
2021-08-26 10:44:38 +00:00
강동윤
838a7a8b33
fix(es/minifier): Make use of hygiene optimizer (#2145)
swc_ecma_ast:
 - Implement `Display` for `Ident`.

swc_ecma_minifier:
 - Expose `unique_scope`, which is required for `hygiene_optimizer`.
 - Improve `hygiene_optimizer`.

swc:
 - Use hygiene optimizer. (#1600, #2137)
 - Add `jsc.experimental.optimizeHygiene`
2021-08-24 15:03:31 +00:00
Ifiok Jr
1d71a8ea95
chore: Fix typo (#2135) 2021-08-23 18:08:01 +09:00
Ifiok Jr
84cda8a9f5
chore: Fix typo (#2136) 2021-08-23 18:07:35 +09:00
Songkeys
91c239bc74
chore: Fix typo in type definition (#2116) 2021-08-20 21:53:47 +09:00
강동윤
949a4d9716
fix(es): Fix simple bugs (#2077)
swc_ecma_visit:
 - Ensure that #1967 is wrong. (#1967)

swc:
 - Add a test for #1107. (#1107)

node:
 - Make optional fields optional. (#1947)
2021-08-14 18:34:14 +00:00
강동윤
1b9584cfc0
fix(swc): Fix bugs (#2067)
swc_ecma_transforms_compat:
 - Fix optional chaining. (#2063)

node/swc:
 - Fix definition of `ImportDeclaration`. (#2059)

testing:
 - Allow using `testing` with stable `rustc`.

testing_macros:
 - Add `#[inline(never)]`.
2021-08-13 10:57:25 +00:00
강동윤
883c1ac4e4
fix(bundler): Prepare renaming of bundler (#2066)
- Rename `spack` crate to `swc_node_bundler`. (#1113)
2021-08-13 10:03:04 +00:00
muji
2151366b93
feat(es/loader): Support target runtime environment. (#2045)
swc_ecma_ast:
 - Add `TargetEnv`.

swc_ecma_loader:
 - Support specifying target environment.
2021-08-10 15:36:10 +09:00
강동윤
9793926cc8
fix(es/minifier): Fix bugs and implement more rules (#2032)
swc_ecma_minifier:
 - Fix an infinite loop. (#2028)
 - Don't remove span hygiene. (#2022)

swc_ecma_codegen:
 - Fix codegen of `return` with `async` arrow. (#2020)

swc:
 - Respect `minify = false`. (#2019)
2021-08-08 14:19:04 +00:00
Sosuke Suzuki
f4e0e91f64
feat(es/parser): Always enable features in ES spec (#2029) 2021-08-08 22:53:41 +09:00
OJ Kwon
abb1451061
fix(node/swc): Allow specifying filename when parsing (#2031) 2021-08-08 20:14:45 +09:00
강동윤
f44e25c3af
fix(es/minifier): Improve output of minifier (#1990)
swc_common:
 - Add `Span.has_mark`.

swc_ecma_codegen:
 - Emit `1e3` for `1000`.
 - Optimize output. (#1986)

swc_ecma_minifier:
 - name mangler: Don't use keywords as an id.
 - `properties`: Optimize member expression with string properties.
 - `inline`: Inline some function expressions even if it's not fn-local.
 - `analyzer`: Track reassignment correctly.
 - `analyzer`: Track fn-local correctly.
 - `sequences`: Inject `void` if required.
 - `inline`: Inline function declarations correctly.
 - `sequences`: Merge expressions into test of if statements.
 - `sequences`: Reduce calls to an assigned variable.
 - Use `Marks` instead of `&dyn Comments`.


swc_ecma_transforms_optimization:
 - `expr_simplifier`: Fix infinite loops.

node/swc:
 - Ensure that `.transform` performs minification. (#1989)
2021-08-04 00:52:47 +09:00
강동윤
d1c481790c
feat(swc): Expose minifier api (#1978)
swc_ecma_codegen:
 - Fix codegen of imports when minification is enabled.

swc_ecma_minifier:
 - Mangle identifiers used by imports.

swc:
 - Support specifing `jsc.minify`. (#704, #1371)

swc/node:
 - Add `.minify()`.
 - Add `.minifySync()`.

swc/wasm:
 - Add `.minifySync()`.
2021-07-31 06:30:06 +00:00
Sosuke Suzuki
eecaac12a0
fix(node/swc): Fix typings for parser options (#1971) 2021-07-30 12:49:55 +09:00
plylrnsdy
d5cdf444e8
fix(node/swc): Fix field name (#1923)
node/swc:
 - Rename `member` of `TsEnumDeclaration` to `members`.
2021-07-18 19:40:01 +09:00
강동윤
ff47e2539e
fix(swc): Fix bugs (#1932)
swc_common:
 - Fix handling of input source map. (#1930)

swc:
 - Respect `paths`. (#1858)

node:
 - Fix typings of `paths`.
2021-07-17 11:16:00 +00:00
강동윤
19bcb06f73
fix(swc): Fix source path of a source map file (#1902)
swc:
 - Use `output_path` to make sourcemap path relative to the `.map` file. (#1255)
2021-07-08 07:32:06 +00:00
강동윤
69186eb74d
fix(es/transforms): Fix transforms (#1900)
node-swc:
 - Use proper field name in `ObjectPattern`. (#1886)

swc_ecma_codegen:
 - Fix codegen of private properties. (#1898)

swc_ecma_transforms_compat:
 - Fix optional chaining expressions in a single-line arrow expression. (#1836)
 - `regenerator`: Preserve `ExportDefaultDecl`. (#1799)

swc_ecma_transforms_module:
 - Fix `export default function`. (#1799)
2021-07-08 04:54:57 +00:00
강동윤
211e208219
fix(node-swc): Fix visitor (#1890)
node/binding:
 - Fix visitor methods for array elements. (#1819, #1888)
 - Fix for const assertion. (#1625)
 - Verify object properties. (#906)
2021-07-04 12:35:25 +00:00
강동윤
c79db252dc
fix(swc): Fix bugs (#1753)
swc_ecma_parser:
 - Allow class members to be declared. (#1751)

node-swc:
 - Fix typescript type definitions. (#1746)
2021-05-27 11:59:04 +09:00
LongYinan
c2bd3195e8
fix(node-swc): Fix typescript definitions for react options (#1720) 2021-05-21 10:22:11 +09:00
nuintun
0cdabeb4c0
fix(node-swc): Fixed parseFile (#1654) 2021-05-09 07:03:09 +00:00
vemoo
304b57cdd4
fix(node-swc): Fix definition of JSXOpeningElement (#1608)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-05-06 19:30:14 +09:00
강동윤
82ef06afb8
feat(babel/compat): Improve performance of babelify (#1626)
swc_babel_compat:
 - Optimize.

swc:
 - Improve performance of comment storage.
2021-05-06 14:56:54 +09:00