@swc/core 1.3.21 → 1.3.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +235 -0
  2. package/package.json +12 -12
  3. package/types.d.ts +10 -5
package/CHANGELOG.md CHANGED
@@ -5,6 +5,241 @@
5
5
 
6
6
 
7
7
 
8
+ - **(css/minifier)** Fix compressions of transform functions (#6617) ([208fd55](https://github.com/swc-project/swc/commit/208fd559ba383b32c72ffdf5d8ad50cbf9679ec6))
9
+
10
+
11
+ - **(css/minifier)** Fix compression of timing functions (#6618) ([59e8bf4](https://github.com/swc-project/swc/commit/59e8bf49761c9f2434dcfb18153f93234d3d69a7))
12
+
13
+
14
+ - **(css/minifier)** Fix minification of `@supports` at-rule (#6632) ([d3fbfff](https://github.com/swc-project/swc/commit/d3fbfffb32a4bd91c5faa27e708eccb08c8189b9))
15
+
16
+
17
+ - **(es/codegen)** Don't print trailing coma for a rest argument (#6610) ([68d76af](https://github.com/swc-project/swc/commit/68d76afe5d99f834dd4578cc50bd48624f76c21d))
18
+
19
+
20
+ - **(es/codegen)** Fix codegen of TypeScript mapped types (#6621) ([5c53a74](https://github.com/swc-project/swc/commit/5c53a74f55fc9d6ba1f54f9f2ea517853fa62a74))
21
+
22
+
23
+ - **(es/fixer)** Add correct parens to `OptChainExpr` in `MemberExpr` (#6639) ([be5ea7f](https://github.com/swc-project/swc/commit/be5ea7fe170cca1532ba3d18f975d025a9fe038b))
24
+
25
+
26
+ - **(es/minifier)** Abort IIFE invoker on `eval` (#6478) ([8b2e1d1](https://github.com/swc-project/swc/commit/8b2e1d17e59eaf21d4189aa4b9d2773cb10a1ab4))
27
+
28
+
29
+ - **(es/minifier)** Abort sequential inliner on optional chaining (#6637) ([e4e4d6c](https://github.com/swc-project/swc/commit/e4e4d6cf6bbc2645272d590cd6ae83aeb5c19b1c))
30
+
31
+
32
+ - **(es/parser)** Parse types in `CallExpression` inside templates (#6611) ([c44f1d0](https://github.com/swc-project/swc/commit/c44f1d0a7fd31b6c8019e5a17b0f80dab4c9c01c))
33
+
34
+
35
+ - **(html/parser)** Fix parsing of CDATA in the svg context (#6620) ([19c2ee5](https://github.com/swc-project/swc/commit/19c2ee593d1b2c32243dbc5c099f17cea0b9ed26))
36
+
37
+
38
+ - **(node-swc)** Add missing `const_to_let` to the type (#6615) ([7e841a5](https://github.com/swc-project/swc/commit/7e841a5d3061e6ef8b48995bdcd492ffa02b3b8d))
39
+
40
+ ### Features
41
+
42
+
43
+
44
+ - **(css/compat)** Add `Compiler` (#6626) ([b3bbd74](https://github.com/swc-project/swc/commit/b3bbd742bf5a3bc51105e16cf6260b63ef9b124a))
45
+
46
+
47
+ - **(css/compat)** Support custom media queries (#6625) ([a5f7b4b](https://github.com/swc-project/swc/commit/a5f7b4b8aa48d3d920dcebf72d766b6e3f458fb7))
48
+
49
+
50
+ - **(css/compat)** Implement compat pass for media ranges (#6631) ([704b3ce](https://github.com/swc-project/swc/commit/704b3ceb9c1ceb8bafb5dd83717c182c56043198))
51
+
52
+
53
+ - **(css/compat)** Support color with hex alpha (#6643) ([fe06b80](https://github.com/swc-project/swc/commit/fe06b8061c742f0a7ec04cf3f9df6db44deb7174))
54
+
55
+
56
+ - **(css/minifier)** Support `to` and `from` with `initial` (#6613) ([cb49fa6](https://github.com/swc-project/swc/commit/cb49fa6f1ddf2ae37262769c538ef1a51adc404c))
57
+
58
+
59
+ - **(css/minifier)** Remove adjacent identical declarations (#6619) ([fb94694](https://github.com/swc-project/swc/commit/fb94694cf3d95c26cc10aa9824f58e68b73b17ca))
60
+
61
+
62
+ - **(css/prefixer)** Prefix percentage with `opacity` (#6638) ([2fee4d1](https://github.com/swc-project/swc/commit/2fee4d167ac908e04c04f65fe6e4a867a2b7d950))
63
+
64
+
65
+ - **(css/prefixer)** Support `display` (#6640) ([c8b724f](https://github.com/swc-project/swc/commit/c8b724f14db0291fb48cd3d26c925dcf5e730fb8))
66
+
67
+
68
+ - **(css/prefixer)** Support nested calc (#6645) ([5d0dc6e](https://github.com/swc-project/swc/commit/5d0dc6e7319f181e468b40dce218dc15cec8b59f))
69
+
70
+
71
+ - **(dbg-swc)** Kill `creduce` on drop (#6614) ([2bf7805](https://github.com/swc-project/swc/commit/2bf78059801d8f07bf31eab6b077d7fb723837f8))
72
+
73
+ ### Miscellaneous Tasks
74
+
75
+
76
+
77
+ - **(atoms)** Make `sort.sh` cross-platform (#6629) ([3f469ff](https://github.com/swc-project/swc/commit/3f469fff0bdd642d5ed5d3c78bfbd6a36a20dadb))
78
+
79
+
80
+ - **(ci)** Adjust upload of cli binaries (#6624) ([81b352d](https://github.com/swc-project/swc/commit/81b352d9667c8874b1d9d87a92cca5b8d4c9fd41))
81
+
82
+
83
+ - **(es/minifier)** Expose `globals_defs` pass (#6633) ([08ccb83](https://github.com/swc-project/swc/commit/08ccb8384cd186c18100338db35e99cf4de52daa))
84
+
85
+ ### Performance
86
+
87
+
88
+
89
+ - **(html/codegen)** Reduce allocations (#6622) ([bfdafdb](https://github.com/swc-project/swc/commit/bfdafdbb898aa3429172f71c8d018689133e4fd6))
90
+
91
+
92
+ - **(html/minifier)** Reduce allocations (#6623) ([7d3aa66](https://github.com/swc-project/swc/commit/7d3aa66bb8786d6d8cebcc37aa6ed4d486ec4b53))
93
+
94
+ ### Refactor
95
+
96
+
97
+
98
+ - **(dbg-swc)** Cleanup and document reducer (#6647) ([b13a079](https://github.com/swc-project/swc/commit/b13a079481802d7bc44c9b363f63c74599f11a19))
99
+
100
+ ### Testing
101
+
102
+
103
+
104
+ - **(es/minifier)** Enable size tests created from `creduce` (#6646) ([7f3e698](https://github.com/swc-project/swc/commit/7f3e6983e552bc789b7d0331335b760e6d42e51a))
105
+
106
+ ## [1.3.22] - 2022-12-09
107
+
108
+ ### Bug Fixes
109
+
110
+
111
+
112
+ - **(common)** Fix handling of input source maps (#6561) ([4af52c7](https://github.com/swc-project/swc/commit/4af52c79aea73f2e916bd11ce089bb4a4317179c))
113
+
114
+
115
+ - **(common)** Fix `BytePos` -> `CharPos` calculations (#6574) ([a203fdb](https://github.com/swc-project/swc/commit/a203fdb1b62ce2df855421d46905f8b821eeabbd))
116
+
117
+
118
+ - **(css/parser)** Fix recovery more for invalid component values in declaration value (#6560) ([db1eb48](https://github.com/swc-project/swc/commit/db1eb483fda71ca5f88342d8c53cb795707c6221))
119
+
120
+
121
+ - **(css/parser)** Fix parsing of nested rules (#6563) ([a1fe907](https://github.com/swc-project/swc/commit/a1fe9076c231ca1eef05c558f43803ec006559c3))
122
+
123
+
124
+ - **(css/parser)** Fix a small bug (#6591) ([4de378c](https://github.com/swc-project/swc/commit/4de378cb1e170df496b277bc141dacaa1c21738f))
125
+
126
+
127
+ - **(css/parser)** Avoid skipping extra whitespaces (#6592) ([d8936ad](https://github.com/swc-project/swc/commit/d8936ade5b34f682af08e01833d629a67c54f888))
128
+
129
+
130
+ - **(es/compat)** Prepend generated `_loop` to the correct scope (#6604) ([4c2d422](https://github.com/swc-project/swc/commit/4c2d42261ed0382c49e8a564b574362a5ab182a3))
131
+
132
+
133
+ - **(es/parser)** Fix `typeof` in `TSCallSignatureDeclaration` (#6553) ([aa28aa0](https://github.com/swc-project/swc/commit/aa28aa0c7fefcaea063340c711a5ea8a3ba60e7b))
134
+
135
+
136
+ - **(es/parser)** Fix parsing of JSX with ASI (#6577) ([ad95ead](https://github.com/swc-project/swc/commit/ad95ead291640b1ada65860af1adf5e8185c80a4))
137
+
138
+
139
+ - **(es/resolver)** Reset `in_type` flag correctly (#6597) ([29ba05d](https://github.com/swc-project/swc/commit/29ba05d137c606f9e67fec9db8bd2377671900e1))
140
+
141
+
142
+ - **(es/typescript)** Strip inline type declarations (#6600) ([fe0c651](https://github.com/swc-project/swc/commit/fe0c65195d2308b1475e958a7051b5f529bf4580))
143
+
144
+
145
+ - **(node-swc)** Sync types for `jsc.optimizer.globals` (#6603) ([b97aa45](https://github.com/swc-project/swc/commit/b97aa45c5c0ef5cfccc15294767c2bc8f0a7307d))
146
+
147
+
148
+ - **(xml/parser)** Fix parsing of legacy document types (#6555) ([cdf0d8a](https://github.com/swc-project/swc/commit/cdf0d8a8b59a05498b6ca609d8a2ecf3c2f35f28))
149
+
150
+
151
+ - **(xml/parser)** Fix various bugs (#6566) ([01232f0](https://github.com/swc-project/swc/commit/01232f09883de34eb3eb94d364f9bd2a3b985703))
152
+
153
+ ### Features
154
+
155
+
156
+
157
+ - **(css/ast)** Make AST intuitive (#6606) ([b4eef53](https://github.com/swc-project/swc/commit/b4eef53680b0e553f14404f641b521a346e55f1f))
158
+
159
+
160
+ - **(css/plugin)** Prepare Wasm plugins (#6567) ([8cdc28c](https://github.com/swc-project/swc/commit/8cdc28cdfa17f1773bdd30c2187c79e1db0a3ffe))
161
+
162
+
163
+ - **(css/plugin)** Support Wasm plugin (#6568) ([fa8f7b0](https://github.com/swc-project/swc/commit/fa8f7b00fc458c4ee2a74b431fb9004f67e54dde))
164
+
165
+
166
+ - **(es/analyzer)** Extract the analyzer from the minifier to a separate crate (#6586) ([e1d01d8](https://github.com/swc-project/swc/commit/e1d01d8b7aa23d1bf3f3894546691c0b249ab647))
167
+
168
+
169
+ - **(html/parser)** Improve lexer (#6543) ([49b7e9e](https://github.com/swc-project/swc/commit/49b7e9e224c36346a8fe5ccbec623ae76f0cc79d))
170
+
171
+ ### Miscellaneous Tasks
172
+
173
+
174
+
175
+ - **(ci)** Add debug logs for cli binaries (#6556) ([8083484](https://github.com/swc-project/swc/commit/80834843f4180bc292f8b2959b1390a07bec0a77))
176
+
177
+
178
+ - **(ci)** Fix CI (#6558) ([8587589](https://github.com/swc-project/swc/commit/85875897f1fd3e71fe5e5d1877bb0e80458835d9))
179
+
180
+
181
+ - **(ci)** Fix benchmark action (#6582) ([d8adc58](https://github.com/swc-project/swc/commit/d8adc580110e0764686f5aea848425905605daa0))
182
+
183
+
184
+ - **(ci)** Fix benchmark action (#6596) ([154c315](https://github.com/swc-project/swc/commit/154c315d91f20466ae90b83f5300017e57e4a078))
185
+
186
+
187
+ - **(css/lexer)** Fix typo (#6588) ([f383836](https://github.com/swc-project/swc/commit/f383836bad48a791c93d1f6bd5670a2d19a545d8))
188
+
189
+ ### Performance
190
+
191
+
192
+
193
+ - **(css/ast)** Reduce token size (#6569) ([8633d27](https://github.com/swc-project/swc/commit/8633d27df0f429cd024c3b36f686c136b2bb945f))
194
+
195
+
196
+ - **(css/codegen)** Reduce allocations (#6599) ([538d63e](https://github.com/swc-project/swc/commit/538d63eb800506fd8ff44d238d0cb02a1d3cf478))
197
+
198
+
199
+ - **(css/minifier)** Remove redundant clone (#6579) ([70ac028](https://github.com/swc-project/swc/commit/70ac0286e50d8117e918e11131ffb15d77d9ed18))
200
+
201
+
202
+ - **(css/minifier)** Remove more redundant clones (#6580) ([4171ee7](https://github.com/swc-project/swc/commit/4171ee7fb353966c5a11e4701b2bdf28bc895ad1))
203
+
204
+
205
+ - **(css/minifier)** Improve performance (#6583) ([7895599](https://github.com/swc-project/swc/commit/78955995a2fd381a9d56a325e368aa29dcc3c7be))
206
+
207
+
208
+ - **(css/parser)** Reduce clones and allocations (#6585) ([6479670](https://github.com/swc-project/swc/commit/64796701e45a59a9d9ba439064d012b5ad3ce144))
209
+
210
+
211
+ - **(css/parser)** Reduce number of function calls (#6587) ([252edb5](https://github.com/swc-project/swc/commit/252edb550be2464d34c1ccce668d1666f3799878))
212
+
213
+
214
+ - **(css/parser)** Don't allocate for comparisons (#6593) ([08b6eab](https://github.com/swc-project/swc/commit/08b6eab0103ed7b42b6053392161ea8bd4fd597a))
215
+
216
+
217
+ - **(html/parser)** Optimize usage of buffers (#6590) ([d6e9613](https://github.com/swc-project/swc/commit/d6e961368bb231dfa842b7cd37f77e2f0fb9c8c2))
218
+
219
+ ### Refactor
220
+
221
+
222
+
223
+ - **(common)** Cleanup source_map.rs (#6570) ([b3ea52f](https://github.com/swc-project/swc/commit/b3ea52f8637998721f6762f93f486892f7676993))
224
+
225
+
226
+ - **(es/minifier)** Remove unnecessary code (#6575) ([586bfd5](https://github.com/swc-project/swc/commit/586bfd5480aa6e0d37cc50505efa61a6343b1bc8))
227
+
228
+
229
+ - **(xml/parser)** Simplify logic for parsing elements (#6557) ([85a03e7](https://github.com/swc-project/swc/commit/85a03e71b7fe98d6f4f7c3fd0e49ce862130dfcc))
230
+
231
+ ### Testing
232
+
233
+
234
+
235
+ - **(css/parser)** Move vendor tests (#6564) ([4d422b6](https://github.com/swc-project/swc/commit/4d422b6228c0a29e3e540697e805be5ae33f4cf2))
236
+
237
+ ## [1.3.21] - 2022-11-30
238
+
239
+ ### Bug Fixes
240
+
241
+
242
+
8
243
  - **(ci)** Fix publish action for binaries (#6517) ([2ac3201](https://github.com/swc-project/swc/commit/2ac32017bad112956a781b0d003782988655409c))
9
244
 
10
245
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swc/core",
3
- "version": "1.3.21",
3
+ "version": "1.3.23",
4
4
  "description": "Super-fast alternative for babel",
5
5
  "homepage": "https://swc.rs",
6
6
  "main": "./index.js",
@@ -97,7 +97,7 @@
97
97
  "@napi-rs/cli": "^2.10.0",
98
98
  "@swc/core": "=1.2.220",
99
99
  "@swc/helpers": "^0.4.2",
100
- "@swc/plugin-jest": "^1.2.12",
100
+ "@swc/plugin-jest": "1.5.25",
101
101
  "@taplo/cli": "^0.3.2",
102
102
  "@types/jest": "^28.1.4",
103
103
  "@types/node": "^14.14.41",
@@ -141,16 +141,16 @@
141
141
  "url": "https://opencollective.com/swc"
142
142
  },
143
143
  "optionalDependencies": {
144
- "@swc/core-win32-x64-msvc": "1.3.21",
145
- "@swc/core-darwin-x64": "1.3.21",
146
- "@swc/core-linux-x64-gnu": "1.3.21",
147
- "@swc/core-linux-x64-musl": "1.3.21",
148
- "@swc/core-win32-ia32-msvc": "1.3.21",
149
- "@swc/core-linux-arm64-gnu": "1.3.21",
150
- "@swc/core-linux-arm-gnueabihf": "1.3.21",
151
- "@swc/core-darwin-arm64": "1.3.21",
152
- "@swc/core-linux-arm64-musl": "1.3.21",
153
- "@swc/core-win32-arm64-msvc": "1.3.21"
144
+ "@swc/core-win32-x64-msvc": "1.3.23",
145
+ "@swc/core-darwin-x64": "1.3.23",
146
+ "@swc/core-linux-x64-gnu": "1.3.23",
147
+ "@swc/core-linux-x64-musl": "1.3.23",
148
+ "@swc/core-win32-ia32-msvc": "1.3.23",
149
+ "@swc/core-linux-arm64-gnu": "1.3.23",
150
+ "@swc/core-linux-arm-gnueabihf": "1.3.23",
151
+ "@swc/core-darwin-arm64": "1.3.23",
152
+ "@swc/core-linux-arm64-musl": "1.3.23",
153
+ "@swc/core-win32-arm64-msvc": "1.3.23"
154
154
  },
155
155
  "files": [
156
156
  "CHANGELOG.md",
package/types.d.ts CHANGED
@@ -199,6 +199,7 @@ export interface TerserCompressOptions {
199
199
  unsafe_regexp?: boolean;
200
200
  unsafe_undefined?: boolean;
201
201
  unused?: boolean;
202
+ const_to_let?: boolean;
202
203
  module?: boolean;
203
204
  }
204
205
  export interface TerserMangleOptions {
@@ -653,19 +654,23 @@ export interface OptimizerConfig {
653
654
  */
654
655
  export interface GlobalPassOption {
655
656
  /**
656
- * Global variables.
657
+ * Global variables that should be inlined with passed value.
657
658
  *
658
659
  * e.g. `{ __DEBUG__: true }`
659
660
  */
660
- vars?: {
661
- [key: string]: string;
662
- };
661
+ vars?: Record<string, string>;
663
662
  /**
664
- * Name of environment variables to inline.
663
+ * Names of environment variables that should be inlined with the value of corresponding env during build.
665
664
  *
666
665
  * Defaults to `["NODE_ENV", "SWC_ENV"]`
667
666
  */
668
667
  envs?: string[];
668
+ /**
669
+ * Replaces typeof calls for passed variables with corresponding value
670
+ *
671
+ * e.g. `{ window: 'object' }`
672
+ */
673
+ typeofs?: Record<string, string>;
669
674
  }
670
675
  export type ModuleConfig = Es6Config | CommonJsConfig | UmdConfig | AmdConfig | NodeNextConfig | SystemjsConfig;
671
676
  export interface BaseModuleConfig {