Commit Graph

1303 Commits

Author SHA1 Message Date
강동윤
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
강동윤
9ffe47106a
fix(swc): Fix target (#2226)
swc:
 - Fix `target` option. (#2225)
2021-09-10 15:43:14 +09:00
강동윤
2c477780f0
fix(es): Fix bugs (#2222)
swc_ecma_parser:
 - Don't panic on `typeof import(T)`. (#2198)
 - Fix parsing of ternary. (#2196)

swc_ecma_transforms_base:
 - `fixer`: Handle unary in lhs of an exponentation expression. (#2191)

swc_ecma_transforms_compat:
 - Use variable for `this` in arrow expressions. (#2212)

swc_ecma_visit:
 - Add a trait `InjectVars`.

node_swc:
 - Increease recursion limit while deserializing. (#2223)
2021-09-09 20:45:20 +09:00
강동윤
a9573b9a5f
fix(css/parser): Fix parsing of selectors (#2221)
swc_css_parser:
 - Allow parsing `foo` as selector.
2021-09-09 05:36:56 +00:00
강동윤
b4796d9d54
fix: Fix simple bugs (#2220)
swc_ecma_utils:
 - Don't panic on jsx.

swc_ecma_transforms_typescript:
 - Drop type-only reexports. (#2219)
2021-09-09 05:06:03 +00:00
강동윤
c8b46bf6db
feat(es/minifier): Implement more rules (#2183)
swc_ecma_codegen:
 - Don't panic on `Pat::Invalid`.
 - Fix codegen of unary minus. (#2213)

swc_ecma_minifier:
 - Remove identifier of function expressions if a variable with same name exists.
 - `sequences`: Merge into the argument of a throw statement.
 - Use `ignore_return_value` for `void` expressions.
 - Improve inlining.
 - Drop last `return` if the return value is not used.
 - `sequences`: Merge `c++; use(c)` as `use(++c)`.
 - `sequences`: Merge assignments with an operator.
 - `comparisons`: Optimize the comparison operator if type is equivalent.
 - Fix `negate_cost`.
 - `unused`: Fix order or variable initalizer when variables are dropped.
 - Fix `top_retain` option.
 - `if_return`: Don't merge nested if it's wrong to do so. (#2214)
 - Fix negation of `if_return`.
2021-09-08 09:45:39 +00:00
강동윤
d8ae4c4e90
fix(css/parser): Fix parsing of selectors (#2217)
swc_css_parser:
 - Remove `Parse<CompoundSelector>` implementation.
 - Add `Parse<ComplexSelector>` implementation.
 - Add `Parse<Vec<ComplexSelector>>` implementation.
 - Verify tokens input.
2021-09-08 01:19:14 +00:00
Sosuke Suzuki
cbc8230310
fix(es/parser): Fix parsing of static blocks (#2200)
swc_ecma_parser:
 - Fix parsing of static blocks with line breaks. (#2195)
2021-09-03 14:57:23 +09:00
Kitson Kelly
87f30b21a3
feat(common): Add variants to FileName (#2202) 2021-09-03 13:55:31 +09:00
강동윤
77be9f63b9
fix(swc): Improve rust apis (#2197)
swc_ecma_transforms_testing:
 - Make `expected` not affect source map of input.

swc:
 - Accept `before` pass.
2021-09-01 23:34:37 +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
muji
55f065b78a
doc(common): Improve doc of Take (#2192) 2021-09-01 12:52:07 +09:00
강동윤
a8cb554be5
feat: Expose .take() (#2190)
swc_common:
 - Add `Take`. (#2189)

swc_ecma_ast:
 - Implement `Take` for ast nodes. 

swc_ecma_transforms_base:
 - Remove `MapWithMut`.
2021-08-31 14:45:48 +00:00
David Sherret
99c35ff980
refactor(es): Use BlockStmt instead Vec<Stmt> for static blocks. (#2188)
swc_ecma_ast:
 - Use `BlockStmt` instead of `Vec<Stmt>` for static blocks.

swc_ecma_parser:
 - Fix span of static blocks.
2021-08-31 16:12:18 +09:00
David Sherret
2f2e35af69
fix(es/parser): Remove static_blocks from TsConfig (#2186) 2021-08-31 14:52:51 +09:00
강동윤
d58642b70c
feat(common): Implement TypeEq and EqIgnoreSpan for tuples (#2184)
swc_common:
 - Implement `TypeEq` and `EqIgnoreSpan` for tuples.
2021-08-30 12:44:46 +00:00
muji
361bc70065
fix(es/loader): Improve handling of base_dir (#2182) 2021-08-30 21:21:52 +09:00
강동윤
11fe35dbd1
feat(es/minifier): Implement static evaluator (#2176)
swc_ecma_minifier:
 - Add an api to evaluate constants statically.
2021-08-30 05:21:38 +00:00
강동윤
ee16139a19
fix(es/transforms): Fix bugs (#2181)
swc_ecma_transforms_compat:
 - `regenerator`: Fix variable hoisting for for-in/of loops. (#2164)
 - Ensure #2071 is fixed. (#2071)
2021-08-30 04:08:24 +00:00
Sosuke Suzuki
b2c99719fd
feat(es/parser): Add tests for static blocks (#2180)
swc_ecma_parser:
 - Add tests for multiple static blocks in a class.
2021-08-30 12:45:41 +09:00
강동윤
c0b0337d1d
fix(es): Fix easy bugs (#2178)
swc_ecma_parser:
 - Fix parsing of complex arrow expressions in a conditional expression. (#2174)
 - Report an error for wrong jsx, instead of `panic!`. (#2173)

swc_ecma_transforms_react:
 - `jsx`: Handle fragment with single child correctly. (#2177)

swc:
 - Ensure that #2170 is an invalid issue. (#2170)
2021-08-29 20:40:52 +00:00
Sosuke Suzuki
a10118c90f
feat(es/parser, es/codegen, es/visit): Support static blocks in classes (#2130)
swc_ecma_ast:
 - Add support for static blocks in classes.
2021-08-30 00:03:14 +09:00
muji
5d702835e8
fix(es/loader): Fix node resolver (#2172)
swc_ecma_module_loader:
 - Use correct base directory.
2021-08-29 17:47:15 +09:00
강동윤
97514a7549
fix(es): Fix some easy bugs (#2166)
swc_ecma_parser:
 - Fix parsing of typescript generics in jsx context. (#2161)

swc_ecma_transforms_base:
 - `fixer`: Handle assignment with patterns in arrow body. (#2163)

swc_ecma_utils:
 - `as_bool`: Handle assignment with operator correctly. (#2165)
2021-08-27 06:03:06 +00:00
David Sherret
3d58457027
refactor(es/dep_graph): Use dyn instead of impl (#2119)
swc_ecma_dep_graph:
 - Use `dyn` instead of `impl` in `analyze_dependencies`.
2021-08-27 13:08:48 +09: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
강동윤
e468752ebc
fix(es/minifier): Fix usage via yarn resolution (#2158)
swc_common:
 - Deprecate some unused types.

swc:
 - `BoolOrObject`: Improve the error message for deserialization failure.
 - `BoolOrObject`: Treat an empty object as `true`.
 - `JsMinifyFormatOptions`: Add fields. (#2153)

node_swc:
 - Improve error message for deserialization failure.
2021-08-26 06:18:59 +00:00
강동윤
8c5daeec2a
fix(es/transforms/base): Fix await expressions. (#2157)
swc_ecma_transforms_base:
 - Preserve parenthesis in `await (a || b)`. (#2155)
2021-08-26 13:19:12 +09:00
강동윤
18e2232dbc
feat(plugin): Groundwork for rust plugin system (#1893) 2021-08-25 15:07:09 +00:00
강동윤
427df9a979
fix(es/codegen): Fix sourcemap (#2142)
swc_ecma_codegen:
 - Use span for `await` token.
 - Use span for debugger statements.
 - Use span for object literals.
 - Use span for object patterns.
 - Use span for array literals.
 - Use span for `try`.
 - Use span for `for`.
 - Use span for `return`.
 - Use span for `break`.
 - Use span for `continue`.
 - Use span for `this`.
 - Use span for `switch`.
 - Use span for `catch`.
 - Use span for `case`.
 - Use span for `function`.
 - Use span for unary expressions.

swc_ecma_minifier:
 - Normalize sequences expressions if the length is 1.
2021-08-25 08:23:55 +00:00
Shinobu Hayashi
78a7c6befe
chore(es/parser): Update an error message (#2148)
swc_ecma_parser:
 - Update an error message to match one of `tsc`.
2021-08-25 17:02:14 +09:00
강동윤
8c57cf0537
feat(css/parser): Improve parser api (#2147)
swc_css_parser:
 - Add `parse_tokens`.
 - Implement `Parse<CompoundSelector>` for the parser.
2021-08-25 02:46:17 +00:00
강동윤
584c44a490
feat(es): Reexport minifier from swc_ecmascript (#2146) 2021-08-24 20:38:16 +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
강동윤
b0278242ba
fix(bundler): Fix handling of reexports from cjs modules (#2143)
swc_bundler:
 - Handle reexports from cjs modules. (#2124)
 - Inject `__spack_require__` helper if required.
2021-08-24 07:20:15 +00:00
강동윤
81061a91bb
fix(css): Fixup (#2138) 2021-08-23 14:03:08 +00:00
강동윤
c05a724d84
feat(css): Port stylis (#2131)
swc_css_ast:
 - Add `Value::Comma`.

swc_css_parser:
 - Implement more `Parse<T>`.
 - Fix parsing of values separated with comma.

swc_css_codegen:
 - Fix escaping.
 - Fix codegen of `!important`.

swc_stylis:
 - Port prefixer.
2021-08-23 12:42:13 +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
강동윤
c78baef2cc
fix(es/transforms/compat): Implement new.tartet (#2129)
swc_ecma_transforms_compat:
 - Handle `new.target`. (#1179)
2021-08-22 06:56:49 +00:00
muji
61e58d7329
feat(bundler): Support replacing any environment variables (#2121) 2021-08-21 16:45:59 +09:00
Sosuke Suzuki
e3e2908139
feat(es/parser): Report an early error for await used in wrong contexts (#2098) 2021-08-21 04:46:22 +09:00
Songkeys
91c239bc74
chore: Fix typo in type definition (#2116) 2021-08-20 21:53:47 +09:00
강동윤
7381644f6b
feat(css): Implement codegen for css (#2115)
swc_css_ast:
 - Remove unused tokens.
 - `SubclassSelector::PseudoClass` => `SubclassSelector::Pseudo`.
 - Fix `AttrSelectorOp`
 - `AttrSelector.value`: `Option<Text>` => `Option<Str>`.

swc_css_codegen:
 - Implement a code generator.

swc_css_parser:
 - Implement `Parse<Stylesheet>` for the parser.
 - Fix parsing of pseudo selectors.
 - Fix parsing of unknown at-rules.
2021-08-20 12:38:15 +00:00
강동윤
0d63470eba
feat(css): Groundwork for css processor (#2105)
swc_css_ast:
 - Rename `Values` to `SpaceValues`.

swc_css_parser:
 - Add `parse_str`.
 - Make `ErrorKind` `#[non_exhaustive]`.
 - Fix span.

swc_css_visit:
 - Create visitors.
2021-08-20 07:48:08 +00:00
강동윤
6eaf60b8a4
fix(swc): Disable aes feature (#2109)
node/swc:
 - Disable `aes`. (#1807)
2021-08-19 12:12:16 +00:00
강동윤
6896a83d54
fix(es/codegen): Fix codegen of ~ (#2104)
swc_ecma_codegen:
 - Emit pending semi on `~`. (#2091)
2021-08-19 17:21:08 +09:00
강동윤
d39acd1d11
feat(css): Implement parser (#2074) 2021-08-19 05:16:32 +00:00
Sosuke Suzuki
33bdff0957
feat(es/parser): Emit an error for top-level await in script (#2094)
swc_ecma_parser:
 - Report an error for a top-level await statements.
2021-08-18 00:17:59 +09:00
강동윤
879a0f39a8
feat(swc): Implement format.comments of terser (#2095)
swc:
 - `minify`: Support `format.comments`.
 - `process_js`: Support `jsc.minify.format.comments`.
2021-08-17 14:34:37 +00:00