Commit Graph

1282 Commits

Author SHA1 Message Date
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
강동윤
a309b36236
fix(es/transforms): Fix bugs (#2089)
swc_ecma_minifier:
 - Expose hygiene optimizer.
 - `mangle_names`: Handle private names in member expressions. (#2086)

swc_visit:
 - Make `Optional::new` const function.

swc:
 - Make `es3` optional via cargo feature.
 - Ensure that #1554 is already fixed. (#1554)
2021-08-16 10:33:18 +00:00
muji
e84ed13ffe
feat(es/loader): Support more types for browser in package.json (#2060) 2021-08-16 17:34:53 +09:00
강동윤
0e30deba1a
feat(es/minifier): Implement more rules (#2058)
swc_ecma_minifier:
 - Enable some sequential merging if `collapse_vars` is set.
 - Enable sequential merging for top level items.
 - `if_return`: Don't inject `void` if it's not exact function body. (#2072)
 - `sequences`: Add some condition for aborting. (#2078)

swc_ecma_utils:
 - Add `collect_decls`.
 - Add `collect_decls_with_ctxt`.

swc_ecma_transforms_optimization:
 - `inline_globals`: Don't replace if a binding exists. (#1294)
2021-08-15 13:09:21 +00:00
강동윤
1b0ef756f2
fix(es/parser): Allow using parser with stable rustc (#2084)
swc_ecma_parser:
 - Don't use `#![feature]` for non-test builds. (#2083)
2021-08-15 10:01:08 +00:00
Iron Lu
ddb2dc7380
test(es/ext/jest): Add tests for jest (#2082) 2021-08-15 18:36:23 +09:00
강동윤
f8aa0509ce
fix(bundler): Fix stack overflow (#2080)
swc_bundler:
 - Prevent infinite recursions. (#1963)
2021-08-15 02:37:31 +00: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
강동윤
b0067adb9c
fix(es/parser): Fix parsing of function in property names (#2076)
swc_ecma_parser:
 - Use correct token context when `function` is used as the name of a property. (#2075)
2021-08-14 15:12:26 +00:00
강동윤
f6aabfce9c
perf: Use ahash instead of sip hash (#2073)
swc_common:
 - Add `AHashMap`.
 - Add `AHashSet`.
2021-08-14 10:33:16 +00:00
강동윤
b0c41bb3f2
chore: Cleanup codes for fixture testing (#2070) 2021-08-14 06:34:04 +00:00
nicholas
035ff77f1a
fix(node/swc): Fix incorrect field package.json (#2069) 2021-08-14 02:17:54 +09: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
LongYinan
fe2a063525
perf(node/swc): Use mimalloc (#2068) 2021-08-13 18:39:13 +09:00
강동윤
c6dce67494
fix(swc): Report error correctly (#2065)
swc_common:
  - Add some utilities for `Handler`.

swc:
 - Remove `Compiler.handler`.
 - Accept `handler` for each operations. (#2035)
2021-08-13 07:05:40 +00:00
강동윤
72c9f4373a
fix(es): Fix bugs (#2055)
swc_ecma_parser:
 - Fix panic from span assertion. (#2040)

swc_ecma_transforms_compat:
 - Fix handling of `await for`. (#1918)

swc_ecma_transforms_base:
 - Allow using decorator metadata even if `reflect-metadata` is not imported. (#1362)
2021-08-12 12:28:58 +00:00
muji
cfc3725dbb
feat(bundler): Support paths (#2054)
swc_ecma_ast:
 - Implement more traits for `TargetEnv`.

swc_ecma_loader:
 - `NodeModulesResolver`: Support aliasing.
2021-08-12 14:30:49 +09:00
강동윤
a7cb2aba9d
fix(es/minifier): Fix bugs of the minifier (#2052)
swc_ecma_minifier:
 - Test mangler using execution test suite.
 - `mangler`: Preserve `arguments`.
 - `mangler`: Handle shorthand. (#2051)
 - `mangler`: Handle object pattern properties.
 - `precompress`: Don't drop function declarations if the variable with same name is in different scope. (#2011)
2021-08-11 07:24:52 +00:00
Iron Lu
a26071f99d
feat(es/transforms): Improve module transform (#2053)
swc_ecma_transforms_module:
 - Make output mockable. (#2049)
2021-08-11 15:32:21 +09:00
강동윤
71080dbd26
feat(es/minifier): Implement more rules (#2039)
swc_ecma_minifier:
 - Remove useless `0` in sequence expressions.
 - `analyzer`: Don't treat fn decl as fn expr.
 - `sequences`: Use sequence expressions in front of `b`.
 - `if_return`: Drop else token within same pass. (#2044)
 - Fix counting logic for `pass`. (#2044)
 - `analyzer`: Fix `ref_count`.
 - `hygiene`: Implement `visit_prop_name`.
 - `ignore_return_value`: Property access to function parameters may have side effects.
 - `inline`: Treat `!0` as literal.
 - Remove some dead codes if `unused` is enabled.

swc_ecma_utils:
 - Fix `may_have_side_effects`.
2021-08-10 08:52:28 +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