magic-akari
72048ae1ce
feat(es/ast): Support import phase ( #8279 )
...
**Description:**
- https://github.com/tc39/proposal-source-phase-imports
2024-01-21 12:05:46 +09:00
Redfire
c2d1a6c9fe
chore(deps): Update base64
to v0.21
( #8369 )
2023-12-02 11:40:56 +00:00
Bin Xin
58568fa23b
fix(es/react): Make jsx with single spread child static ( #8339 )
...
**Description:**
Example:
```js
<h1>{...a}</h1>
```
Before:
```js
_jsx("h1", {
children: [
...a
]
})
```
After:
```js
_jsxs("h1", {
children: [
...a
]
})
```
Following the implementation in [Typescript](d4fbc9b57d/src/compiler/transformers/jsx.ts (L340)
), jsx with a single spread child should also be considered as static jsx.
Live examples:
[Typescript](https://www.typescriptlang.org/play?target=99&jsx=4#code/MYewdgzgLgBAhjAvDAPACwIwD4DeA6AgbQwCYBmAXQF8UB6TLAKCA )
[Esbuild](https://esbuild.github.io/try/#dAAwLjE5LjcAewogIGxvYWRlcjogJ2pzeCcsCiAganN4OiAnYXV0b21hdGljJywKfQA8ZGl2PnsuLi5bXX08L2Rpdj4 )
[SWC](https://play.swc.rs/?version=1.3.100-nightly-20231124.1&code=H4sIAAAAAAAAA0vOzysuUUhUsFWwSckss6vW09OLjq210QdxAHOBudocAAAA&config=H4sIAAAAAAAAA1WOMQrDMAxF95zCaO5QPPY2wijFIbaDJENL8N0rO2lJN%2F33kPT3yTlYJMDD7TZa2JCF%2BJeNyDsrvowAhYQSOG4Kt69dpCvlSoO0Q8BaipCJGVehkyljlrlwul5nwqAX0FHNGlPfBqxaEmoMcOr290WRn6Sjmvi796NWm9oHTYlQ69cAAAA%3D )
2023-11-26 00:48:51 +00:00
Donny/강동윤
14ea705f27
build(cargo): Update rustc to nightly-2023-11-04
( #8221 )
...
**Breaking Changes**:
- `Mark::default()` is now identical as `Mark::new()`.
**Description:**
I want to see if inlining is improved
2023-11-04 21:47:10 +00:00
Donny/강동윤
47733a951c
fix(es/react): Visit children nodes in jsx-src
pass ( #8212 )
...
**Related issue:**
- Closes #8210
2023-11-03 08:29:16 +09:00
Donny/강동윤
c061356b63
fix(es/transforms): Do not add PURE
comment to BytePos(0)
( #8207 )
...
**Related issue:**
- https://github.com/vercel/next.js/pull/57904 (CI failed)
2023-11-02 03:29:59 +00:00
Donny/강동윤
dd805e95a4
feat(es/minifier): Respect inline level and preserve native names ( #8205 )
...
**Description:**
Note: Preserving native names is a hack, but it's used by `terser` and it's the only way to preserve the name of `class AbortSignal` while mangling without `keep_classnames: true`. We can special case `AbortSignal`, but let's just follow `terser`.
**Related issue:**
- https://github.com/vercel/next.js/pull/57904
2023-11-02 08:59:59 +09:00
Donny/강동윤
0aafa75fef
feat(es/testing): Use __swc_snapshots__
for test!
macro ( #8191 )
...
**Description:**
This implements something similar to `__snapshots__` of `jest`. Instead of storing the expected result as a string literal, we now store it in `$crate/tests/__swc_snapshots__/$path_to_test__$test_name.js`.
**Related issue:**
- Closes #4509
2023-10-30 10:38:59 +09:00
Donny/강동윤
84cec8766d
refactor(atoms): Remove usage of js_word!
to drop string-cache
( #7976 )
...
**Description:**
This PR is to prepare removal of `string-cache`. Actually, this PR does not remove it. Instead, this PR only removes direct usages of `js_word!`s, especially in patterns.
**Related issue:**
- #4946 .
2023-10-08 00:39:51 +00:00
Donny/강동윤
ee7575695d
feat(es/codegen): Add an option to print assert
for import attributes ( #7914 )
...
**Description:**
- `jsc.experimental.keepImportAssertions` is renamed to `jsc.experimental.keepImportAttributes`.
- `jsc.experimental.emitAssertForImportAttributes` is added.
**Related issue:**
- Closes #7908
2023-09-05 21:24:25 +09:00
Donny/강동윤
aa6495519b
fix(common): Fix logic for excluding FileName
from source maps ( #7900 )
...
**Description:**
This PR also modifies React transform to use `FileName::Internal` and makes `SourceMapGenConfig` skips `FileName::Internal`.
**Related issue:**
- Closes #5272
2023-08-31 13:23:11 +00:00
Donny/강동윤
4d3fcb86e4
feat(es/ast): Support import attributes proposal ( #7868 )
...
**Related issue:**
- Closes #7179
2023-08-28 00:29:45 +00:00
Donny/강동윤
b34f1adbcc
build(cargo): Update rustc
to 2023-07-03
( #7623 )
2023-07-05 03:50:43 +00:00
Austaras
8e933c8a9f
fix(es/react): Default to empty string when emitting refresh signature ( #7514 )
...
**Related issue:**
- Closes #7471 .
2023-06-12 02:22:31 +00:00
Donny/강동윤
248fd374e6
perf(es/react): Don't use regex ( #7284 )
...
**Description:**
It's causing a performance problem in concurrent scenarios.
x-ref: https://linear.app/vercel/issue/WEB-921
x-ref: https://vercel.slack.com/archives/C02HY34AKME/p1681757237489689
2023-04-18 02:45:08 +00:00
magic-akari
3ca954b9f9
fix(es/helpers): Use snake_case for helpers ( #7147 )
...
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/7144 .
- Closes https://github.com/swc-project/swc/issues/7118 .
2023-03-31 15:15:21 +09:00
Donny/강동윤
0259a7465f
build(cargo): Update rustc
to nightly-2023-03-20
( #7170 )
...
**Description:**
This PR also updates `rkyv` to `=0.7.40`.
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/6807 .
2023-03-30 08:06:02 +00:00
Donny/강동윤
12546c853a
build(cargo): Revert rustc upgrade ( #7162 )
...
**Description:**
The `rkyv` bug is not fixed.
2023-03-29 17:48:45 +09:00
Donny/강동윤
e445502072
build(cargo): Update rustc
to nightly-2023-03-28
( #7154 )
...
**Description:**
This PR also updates `rkyv` to `=0.7.40`.
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/6807 .
2023-03-29 06:24:19 +00:00
Fy
05a2815e6c
feat(es/react): Support script within automatic runtime ( #7126 )
...
**Description:**
Inject `const { jsx: _jsx} = require("react/jsx-runtime")` when sourceType is `script`
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/7119 .
2023-03-27 06:39:37 +00:00
magic-akari
5d7acfd9cb
fix(es/react): Respect import_source
in new jsx ( #7128 )
...
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/6987 .
2023-03-23 03:58:28 +00:00
Austaras
0f09e356c3
feat(es/resolver): Make scope context identical to the vars ( #7095 )
2023-03-19 11:57:14 +09:00
magic-akari
7b491a69a5
fix(es/react): Align to babel@8
behavior ( #7081 )
...
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/7044 .
2023-03-16 03:35:17 +00:00
Donny/강동윤
14454c9dbd
fix(es/react): Don't panic on key
without a value ( #6945 )
...
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/6939 .
2023-02-15 04:31:02 +00:00
Donny/강동윤
a9b25aaf4a
fix(es/react): Fix handling of whitespaces ( #6935 )
...
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/6931 .
2023-02-12 21:35:55 +00:00
HeYunfei
36b26d3496
fix(es/react): Force refresh if code contains @refresh reset
( #6749 )
2023-01-04 14:17:01 +00:00
Donny/강동윤
90aa6c8318
fix(es/react): Allow spread children ( #6505 )
...
**Related issue:**
- Closes https://github.com/swc-project/swc/issues/2037 .
2022-11-24 15:21:51 +00:00
Donny/강동윤
e6b1dd4731
feat(es/testing): Add an option to test sourcemap ( #6079 )
2022-10-07 05:52:22 +00:00
Donny/강동윤
1a182ef8d9
perf(es): Optimize memory layout of AST ( #5829 )
2022-09-20 12:47:21 +09:00
Donny/강동윤
1085667049
perf(es/minifier): Enable parallel processing ( #5705 )
2022-09-01 13:36:30 +09:00
Alex Kirszenberg
14606d9222
feat(es/react): Add VisitMut
bound to the return type of react preset ( #5499 )
2022-08-17 17:34:32 +09:00
Donny/강동윤
3eb1f4b2b1
chore(ci): Fix lints ( #5462 )
2022-08-12 13:13:35 +00:00
Donny/강동윤
037a53d5d1
perf(es/ast): Use Atom
in some places ( #5271 )
2022-07-22 20:09:25 +09:00
Austaras
375774d31e
fix(es): Check the syntax context of arguments
( #5174 )
2022-07-13 10:29:03 +00:00
magic-akari
cc555ef225
fix(es/react): Don't panic on invalid react pragma ( #5101 )
2022-07-04 11:55:08 +00:00
magic-akari
4d5783d9cd
feat(es/modules): Add pure annotations to interop functions ( #5087 )
2022-07-03 05:54:07 +00:00
magic-akari
9e162dcbae
fix(es/modules): Improve compatibility with cjs lexer ( #5080 )
2022-07-01 08:37:04 +00:00
magic-akari
fa68cbd74a
refactor(es/module): Implement new module transformer ( #4758 )
2022-06-27 12:32:06 +00:00
Donny/강동윤
36d960c7e9
perf(es/hygiene): Make hygiene
faster ( #4952 )
2022-06-15 14:36:57 +00:00
LongYinan
db9f7a5ad4
chore(ci): Fix publish build on Windows ( #4970 )
2022-06-14 15:58:10 +00:00
Donny/강동윤
3e03ebf8bb
fix(es/parser): Don't assume the length of char ( #4967 )
2022-06-14 07:05:35 +00:00
Donny/강동윤
35c93be60f
perf(es/transforms): Make transforms parallel ( #4939 )
2022-06-11 07:42:43 +00:00
OJ Kwon
6bc33cb042
feat(es/codegen): Support other source map implementations ( #4879 )
2022-06-05 14:40:55 +00:00
Donny/강동윤
a487fc1d28
refactor(es/transforms): Remove concurrent
( #4808 )
2022-05-26 15:58:19 +00:00
Donny/강동윤
5f45a3d496
fix(es/react): Fix span of error messages ( #4704 )
2022-05-18 21:34:36 +00:00
Donny/강동윤
da49f810db
feat(es): Add check for BytePos::DUMMY
( #4675 )
2022-05-16 03:29:24 +00:00
Donny/강동윤
98e4845fce
build(repo): Update rustc
( #4667 )
2022-05-15 09:03:54 +00:00
Austaras
1150e842ed
refactor(es/react): Use proper ident scope for react refresh ( #4649 )
2022-05-15 03:51:25 +00:00
Donny/강동윤
3b2b8c4512
fix(es/config): Merge jsc.transform
correctly ( #4615 )
2022-05-11 14:28:40 +09:00
Donny/강동윤
6a97c7bef8
fix(es/utils): Fix wrong apis ( #4604 )
...
# API Changes
## `swc_ecma_utils`
### Renames
- `find_ids` => `find_pat_ids`
- `prepend` => `prepend_stmt`
- `as_bool` => `cast_to_bool`
- `as_number` => `as_pure_number`
- `as_string` => `cast_to_string`
- (`as_pure_bool`, `cast_to_number` is not renamed)
- `UsageFinder` => `IdentUsageFinder`.
- `IdentFinder` => `IdentRefFinder`.
## Changes
- Re-export of `HANDLER` from `swc_common::errors` is removed. Use `swc_common::error::HANDLER` instead.
- Re-export of `Id` from `swc_ecma_ast` is removed. Use `swc_ecma_ast::Id` instead.
- `ExprCtx` is used for apis related to `Expr`.
- `preserve_effects` is now a method of `ExprCtx`. It was a top-level function.
- `extract_side_effects_to` is now a method of `ExprCtx`. It was a top-level function.
- `IdentUsageFinder` (previously `UsageFinder`) now takes `Id` instead of `Ident`.
- `IdentRefFinder` (previously `IdentFinder`) now takes `Id` instead of `Ident`.
- `ExprExt::is_ident_ref_to` is removed.
- `Expr::is_global_ref_to` is added.
- `:🆔 :id` is removed. Use `Ident::to_id()` instead.
2022-05-11 04:36:22 +00:00