@swc/core 1.2.165 → 1.2.169

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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,227 @@
5
5
 
6
6
 
7
7
 
8
+ - **(es/lexer)** Fix handling of object properties with the name `function` (#4374) ([3bdf5a8](https://github.com/swc-project/swc/commit/3bdf5a89600ecbc81be4eba162c09820a8a6550c))
9
+
10
+
11
+ - **(es/minifier)** Fix default values of `toplevel` (#4366) ([128175c](https://github.com/swc-project/swc/commit/128175c3297e036ad38e8faa68aa149a94f5ee29))
12
+
13
+
14
+ - **(es/minifier)** Apply name mangler as much as we can (#4365) ([a8ed5ba](https://github.com/swc-project/swc/commit/a8ed5ba357d735657245e5bcd266ba9bda341099))
15
+
16
+
17
+ - **(es/minifier)** Apply name mangler even more (#4368) ([4b1590e](https://github.com/swc-project/swc/commit/4b1590e72fb2dbae6af135d8c284d4c1a875045a))
18
+
19
+
20
+ - **(es/modules/cjs)** Fix order of statements (#4361) ([5c1ce0b](https://github.com/swc-project/swc/commit/5c1ce0ba051de3320e90b0992d57a965a6c2dd8a))
21
+
22
+ ### Features
23
+
24
+
25
+
26
+ - **(cli)** Support configuring output file extension (#4343) ([c4f01c6](https://github.com/swc-project/swc/commit/c4f01c6d6000890f5d3e0bb2e0e9531cff9c8c6b))
27
+
28
+
29
+ - **(es/minifier)** Implement more evaluation rules (#4356) ([e13b862](https://github.com/swc-project/swc/commit/e13b8625f2f67c98c36ac975f3739b304706201b))
30
+
31
+
32
+ - **(es/minifier)** Improve evaluation of template literals (#4359) ([2e095fa](https://github.com/swc-project/swc/commit/2e095face5b6873d50f20babca88a632e5b70d76))
33
+
34
+
35
+ - **(es/minifier)** Implement all template literal evaluation rules (#4360) ([e60ae2a](https://github.com/swc-project/swc/commit/e60ae2a486cdbe4e652f9b7f3a62b4b7dea9c4fb))
36
+
37
+
38
+ - **(plugin)** Support `lookup_char_pos` of `SourceMap` (#4364) ([f06c862](https://github.com/swc-project/swc/commit/f06c862a9ff2c6510c3b88b4d5bd4807a11b5bfb))
39
+
40
+ ### Miscellaneous Tasks
41
+
42
+
43
+
44
+ - **(es)** Rename benchmarks (#4355) ([8309440](https://github.com/swc-project/swc/commit/83094400080bef161b4b106aa3840efc7f2dfecd))
45
+
46
+
47
+ - **(es/minifier)** Setup correct benchmark (#4372) ([5d179bf](https://github.com/swc-project/swc/commit/5d179bfd7d41731a2322854c7aafc93b008eb5f8))
48
+
49
+
50
+ - **(node/types)** Add `unsafe` to compress options (#4362) ([b63cd53](https://github.com/swc-project/swc/commit/b63cd53ca6cb230f7724a03ffaebe2362c80d35b))- **general**: Remove an incorrect link in `CONTRIBUTING.md` (#4363) ([c661d5f](https://github.com/swc-project/swc/commit/c661d5f6f6b613cfed22545cc7cde7411dbd5747))
51
+
52
+ ### Performance
53
+
54
+
55
+
56
+ - **(es/minifier)** Make `base54` use stack-allocated vector (#4371) ([6300b9c](https://github.com/swc-project/swc/commit/6300b9cdb19150686bc71c08386e11d7899a0764))
57
+
58
+
59
+ - **(es/minifier)** Change default value of `passes` to `3` (#4373) ([a8eb00c](https://github.com/swc-project/swc/commit/a8eb00cc540c0bfdfc7d0b922fe34bea2cf8ef45))
60
+
61
+ ### Testing
62
+
63
+
64
+
65
+ - **(es/parser)** Add a test for a fixed issue (#4357) ([bf76175](https://github.com/swc-project/swc/commit/bf761752f1b62635e973da7fb8150ddc323dea9b))
66
+
67
+ ## [1.2.168] - 2022-04-17
68
+
69
+ ### Bug Fixes
70
+
71
+
72
+
73
+ - **(es/codegen)** Emit decorators before export (#4349) ([4953ce4](https://github.com/swc-project/swc/commit/4953ce466fcb008aa356d88489786b7bff3f2395))
74
+
75
+
76
+ - **(es/minifier)** Preserve vars in dead branches (#4345) ([5a5e41a](https://github.com/swc-project/swc/commit/5a5e41aaaa3791f76de9c73aa29c714fa097c773))
77
+
78
+ ### Features
79
+
80
+
81
+
82
+ - **(es/minifier)** `const` => `let` (#3654) ([b3b95ac](https://github.com/swc-project/swc/commit/b3b95acc75f765af433b0c7f887821403561378f))
83
+
84
+ ### Miscellaneous Tasks
85
+
86
+
87
+
88
+ - **(es/minifier)** Organize scripts (#4347) ([14c74f5](https://github.com/swc-project/swc/commit/14c74f50c0b21d65d9604b58a2ce348baeb1baa3))
89
+
90
+
91
+ - **(es/minifier)** Improve scripts (#4339) ([2563c7f](https://github.com/swc-project/swc/commit/2563c7f8ff5bb86131f642b6cca948955d795820))
92
+
93
+
94
+ - **(repo)** Make git commit faster (#4353) ([f7df3d8](https://github.com/swc-project/swc/commit/f7df3d8f24a0571b1766e6187d2305fdf566b08a))- **general**: Fix CI script ([a953455](https://github.com/swc-project/swc/commit/a953455ada2604c65493db7a04dcfbdd2ef5ca78))
95
+
96
+ ### Performance
97
+
98
+
99
+
100
+ - **(es)** Disable wrong parallelization (#4354) ([da6fa60](https://github.com/swc-project/swc/commit/da6fa602310c0a56825723d83585fb258b88c931))
101
+
102
+
103
+ - **(es/minifier)** Split frequently used functions (#4352) ([42e15ae](https://github.com/swc-project/swc/commit/42e15aedc2b7c0ccdd9d6db58cc425a1e781cdd8))
104
+
105
+ ## [1.2.167] - 2022-04-17
106
+
107
+ ### Bug Fixes
108
+
109
+
110
+
111
+ - **(es/parser)** Reject optional constructor call (#4340) ([31b3336](https://github.com/swc-project/swc/commit/31b3336cd5881ff8f99d791254ee02ff4fa23fcc))
112
+
113
+ ### Miscellaneous Tasks
114
+
115
+
116
+
117
+ - **(ci)** Fix wasm publish script ([1900d35](https://github.com/swc-project/swc/commit/1900d3506efb8bc319dece4219789e2509ecf67c))
118
+
119
+ ### Performance
120
+
121
+
122
+
123
+ - **(es/minifier)** Make name mangler faster (#4342) ([66ff7b8](https://github.com/swc-project/swc/commit/66ff7b8a09bc504d3912d12b4a8ebea3a96d4e4b))
124
+
125
+ ## [1.2.166] - 2022-04-15
126
+
127
+ ### Bug Fixes
128
+
129
+
130
+
131
+ - **(css/parser)** Parse legacy `calc`s (#4320) ([81370d1](https://github.com/swc-project/swc/commit/81370d16cb405d43aeb9198e1fce4aa11009045f))
132
+
133
+
134
+ - **(css/prefixer)** Don't prefix if it's already prefixed (#4307) ([690ce26](https://github.com/swc-project/swc/commit/690ce2628c988a3d1823cbcf4f786203e548cb84))
135
+
136
+
137
+ - **(css/prefixer)** Handle at-rules and don't generate unnecessary prefixes (#4318) ([ac4f14a](https://github.com/swc-project/swc/commit/ac4f14ad7b70e67c41507cafd997f6b4e346e815))
138
+
139
+
140
+ - **(css/prefixer)** Fix more bugs (#4330) ([405e5ed](https://github.com/swc-project/swc/commit/405e5ed0b3bbcf8076c80d1383588bfee1cf8d22))
141
+
142
+
143
+ - **(es/codegen)** Fix overflow of numeric literals (#4321) ([0245e26](https://github.com/swc-project/swc/commit/0245e26af5f984cf89a2f474d89f6b3dfe2f0eff))
144
+
145
+
146
+ - **(es/codegen)** Fix codegen of arrow expressions (#4306) ([4c99730](https://github.com/swc-project/swc/commit/4c9973010a5c2b865e6ed676a4e0364234cf5d88))
147
+
148
+
149
+ - **(es/compat)** Fix renaming bug of `block_scoping` (#4310) ([6c9882e](https://github.com/swc-project/swc/commit/6c9882ec68fee9b702f5e4749482eca74fbd87e8))
150
+
151
+
152
+ - **(es/lints)** Check parameters in the duplicate binding rule (#4288) ([e4a565c](https://github.com/swc-project/swc/commit/e4a565c2d4c90dc23267b44e8f4aee2e0cc79c23))
153
+
154
+
155
+ - **(es/loader)** Fix traversal of node modules resolver (#4327) ([780de70](https://github.com/swc-project/swc/commit/780de7095e1ea6b71204017f708f8370ed4531a8))
156
+
157
+
158
+ - **(es/minifier)** Fix inlining of uninitialized variables (#4292) ([b990b19](https://github.com/swc-project/swc/commit/b990b19ed130ce1dc57f76b883bf638ace64c4f4))
159
+
160
+
161
+ - **(es/minifier)** Respect `dead_code` (#4328) ([8886a4b](https://github.com/swc-project/swc/commit/8886a4b572c4b24091aa3db38fdc7b486334c069))
162
+
163
+
164
+ - **(es/minifier)** Inline before cloning (#4338) ([4110fcb](https://github.com/swc-project/swc/commit/4110fcb9612ceeba0c52f539896075a571c9a619))
165
+
166
+
167
+ - **(es/parser)** Enable static blocks by default (#4334) ([7599fe7](https://github.com/swc-project/swc/commit/7599fe74317f790cce8f8638e84c320c5ebbc4c2))
168
+
169
+
170
+ - **(es/parser)** Make parsing of TS InstantiationExpr more permissive (#4332) ([ea466af](https://github.com/swc-project/swc/commit/ea466afdc8dc6b64be81244a8c0261ac34f22157))
171
+
172
+
173
+ - **(node-swc/types)** Add `isTypeOnly` to types (#4303) ([1a48732](https://github.com/swc-project/swc/commit/1a48732e78b9c650f93320f4d6f7be57a9f4a6c4))
174
+
175
+ ### Features
176
+
177
+
178
+
179
+ - **(css/minifier)** Compress colors (#4308) ([65b18ee](https://github.com/swc-project/swc/commit/65b18ee602506d455ce10c6ca2bd599d57d29d14))
180
+
181
+
182
+ - **(es)** Support `typeof` with private fields (#4302) ([d0de5a6](https://github.com/swc-project/swc/commit/d0de5a63a01ef45101cdd10f90546ec7950ce7ac))
183
+
184
+
185
+ - **(es/minifier)** Enable `conditionals` by default (#4301) ([7e8f613](https://github.com/swc-project/swc/commit/7e8f6132729ca3ddf7884f1b246964921cde1c35))
186
+
187
+
188
+ - **(es/minifier)** Enable `dead_code` by default (#4309) ([74a5087](https://github.com/swc-project/swc/commit/74a5087989173f833517cb6f6bf51afcf9642286))
189
+
190
+
191
+ - **(es/minifier)** Improve sequential inliner (#4335) ([f92242d](https://github.com/swc-project/swc/commit/f92242dcb17a7b6dc25dac63d052df9e3d7042bc))
192
+
193
+
194
+ - **(es/parser)** Support `extends` clause to `infer` type (#4326) ([1c3d1af](https://github.com/swc-project/swc/commit/1c3d1af01cdfdf6794e73e32bb0062698d4910be))
195
+
196
+ ### Miscellaneous Tasks
197
+
198
+
199
+
200
+ - **(*)** Typo + fomatting (#4304) ([37a8c90](https://github.com/swc-project/swc/commit/37a8c90750d778edcd69ffdd85fe990a27efc75d))
201
+
202
+
203
+ - **(ci)** Fix CI (#4299) ([adea17d](https://github.com/swc-project/swc/commit/adea17dbe3b17e397d79a7dae1f469bf38f0185f))
204
+
205
+
206
+ - **(es/minifier)** Update terser test references (#4297) ([df0d572](https://github.com/swc-project/swc/commit/df0d572b4ff250be037ca9a04b6bcd95329f9f3b))
207
+
208
+
209
+ - **(es/minifier)** Add full benchmark for `.minify()` (#4341) ([ba5f743](https://github.com/swc-project/swc/commit/ba5f7436c18b7e3845bc2935aca6cdb76477b686))
210
+
211
+ ### Refactor
212
+
213
+
214
+
215
+ - **(bindings)** Rename crates (#4337) ([83a8f48](https://github.com/swc-project/swc/commit/83a8f489ec5b7010a762a75dc31a63b2fb060372))
216
+
217
+
218
+ - **(es/minifier)** Clean up logging (#4322) ([2002554](https://github.com/swc-project/swc/commit/2002554fa26c1ebd683f71d87263f26fd95d00f1))
219
+
220
+
221
+ - **(es/parser)** Simplify logic (#4329) ([37aec5b](https://github.com/swc-project/swc/commit/37aec5b19965bedbe67fa1b454be6a7017ccedec))
222
+
223
+ ## [1.2.165] - 2022-04-09
224
+
225
+ ### Bug Fixes
226
+
227
+
228
+
8
229
  - **(css/prefixer)** FIx a bug related to `writing-mode` (#4278) ([7f38e06](https://github.com/swc-project/swc/commit/7f38e06e0209216200182555c7c7ddb11499e45d))
9
230
 
10
231
 
package/Visitor.d.ts CHANGED
@@ -107,7 +107,7 @@ export declare class Visitor {
107
107
  visitExpression(n: Expression): Expression;
108
108
  visitOptionalChainingExpression(n: OptionalChainingExpression): Expression;
109
109
  visitAssignmentExpression(n: AssignmentExpression): Expression;
110
- visitPatternOrExpressison(n: Pattern | Expression): Pattern | Expression;
110
+ visitPatternOrExpression(n: Pattern | Expression): Pattern | Expression;
111
111
  visitYieldExpression(n: YieldExpression): Expression;
112
112
  visitUpdateExpression(n: UpdateExpression): Expression;
113
113
  visitUnaryExpression(n: UnaryExpression): Expression;
package/Visitor.js CHANGED
@@ -773,11 +773,11 @@ class Visitor {
773
773
  return n;
774
774
  }
775
775
  visitAssignmentExpression(n) {
776
- n.left = this.visitPatternOrExpressison(n.left);
776
+ n.left = this.visitPatternOrExpression(n.left);
777
777
  n.right = this.visitExpression(n.right);
778
778
  return n;
779
779
  }
780
- visitPatternOrExpressison(n) {
780
+ visitPatternOrExpression(n) {
781
781
  switch (n.type) {
782
782
  case "ObjectPattern":
783
783
  case "ArrayPattern":
package/index.d.ts CHANGED
@@ -97,7 +97,7 @@ export declare function __experimental_registerGlobalTraceConfig(traceConfig: {
97
97
  *
98
98
  * Returns current binary's metadata to determine which binary is actually loaded.
99
99
  *
100
- * This is undocumented interface, does not gaurantee stability across `@swc/core`'s semver
100
+ * This is undocumented interface, does not guarantee stability across `@swc/core`'s semver
101
101
  * as internal representation may change anytime. Use it with caution.
102
102
  */
103
103
  export declare function getBinaryMetadata(): {
package/index.js CHANGED
@@ -268,7 +268,7 @@ exports.__experimental_registerGlobalTraceConfig = __experimental_registerGlobal
268
268
  *
269
269
  * Returns current binary's metadata to determine which binary is actually loaded.
270
270
  *
271
- * This is undocumented interface, does not gaurantee stability across `@swc/core`'s semver
271
+ * This is undocumented interface, does not guarantee stability across `@swc/core`'s semver
272
272
  * as internal representation may change anytime. Use it with caution.
273
273
  */
274
274
  function getBinaryMetadata() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swc/core",
3
- "version": "1.2.165",
3
+ "version": "1.2.169",
4
4
  "description": "Super-fast alternative for babel",
5
5
  "homepage": "https://swc.rs",
6
6
  "main": "./index.js",
@@ -59,8 +59,8 @@
59
59
  "pack": "wasm-pack",
60
60
  "build:ts": "tsc -d",
61
61
  "build:wasm": "npm-run-all \"pack -- build ./crates/wasm --scope swc {1} -t {2} --features plugin\" --",
62
- "build": "tsc -d && napi build --platform --cargo-name node --js ./node-swc/src/binding.js --dts ./node-swc/src/binding.d.ts -p node --release",
63
- "build:dev": "tsc -d && napi build --platform --cargo-name node --js ./node-swc/src/binding.js --dts ./node-swc/src/binding.d.ts -p node",
62
+ "build": "tsc -d && napi build --platform --cargo-name binding_core_node --js ./node-swc/src/binding.js --dts ./node-swc/src/binding.d.ts -p binding_core_node --release",
63
+ "build:dev": "tsc -d && napi build --platform --cargo-name binding_core_node --js ./node-swc/src/binding.js --dts ./node-swc/src/binding.d.ts -p binding_core_node",
64
64
  "test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest node-swc/__tests__",
65
65
  "version": "napi version -p scripts/npm"
66
66
  },
@@ -121,18 +121,18 @@
121
121
  "url": "https://opencollective.com/swc"
122
122
  },
123
123
  "optionalDependencies": {
124
- "@swc/core-win32-x64-msvc": "1.2.165",
125
- "@swc/core-darwin-x64": "1.2.165",
126
- "@swc/core-linux-x64-gnu": "1.2.165",
127
- "@swc/core-linux-x64-musl": "1.2.165",
128
- "@swc/core-freebsd-x64": "1.2.165",
129
- "@swc/core-win32-ia32-msvc": "1.2.165",
130
- "@swc/core-linux-arm64-gnu": "1.2.165",
131
- "@swc/core-linux-arm-gnueabihf": "1.2.165",
132
- "@swc/core-darwin-arm64": "1.2.165",
133
- "@swc/core-android-arm64": "1.2.165",
134
- "@swc/core-linux-arm64-musl": "1.2.165",
135
- "@swc/core-win32-arm64-msvc": "1.2.165",
136
- "@swc/core-android-arm-eabi": "1.2.165"
124
+ "@swc/core-win32-x64-msvc": "1.2.169",
125
+ "@swc/core-darwin-x64": "1.2.169",
126
+ "@swc/core-linux-x64-gnu": "1.2.169",
127
+ "@swc/core-linux-x64-musl": "1.2.169",
128
+ "@swc/core-freebsd-x64": "1.2.169",
129
+ "@swc/core-win32-ia32-msvc": "1.2.169",
130
+ "@swc/core-linux-arm64-gnu": "1.2.169",
131
+ "@swc/core-linux-arm-gnueabihf": "1.2.169",
132
+ "@swc/core-darwin-arm64": "1.2.169",
133
+ "@swc/core-android-arm64": "1.2.169",
134
+ "@swc/core-linux-arm64-musl": "1.2.169",
135
+ "@swc/core-win32-arm64-msvc": "1.2.169",
136
+ "@swc/core-android-arm-eabi": "1.2.169"
137
137
  }
138
138
  }
package/types.d.ts CHANGED
@@ -66,6 +66,7 @@ export interface TerserCompressOptions {
66
66
  top_retain?: any;
67
67
  toplevel?: any;
68
68
  typeofs?: boolean;
69
+ unsafe?: boolean;
69
70
  unsafe_passes?: boolean;
70
71
  unsafe_arrows?: boolean;
71
72
  unsafe_comps?: boolean;
@@ -140,7 +141,7 @@ export interface Options extends Config {
140
141
  *
141
142
  * "root" - Passes the "root" value through as unchanged.
142
143
  * "upward" - Walks upward from the "root" directory, looking for a directory
143
- * containinga swc.config.js file, and throws an error if a swc.config.js
144
+ * containing a swc.config.js file, and throws an error if a swc.config.js
144
145
  * is not found.
145
146
  * "upward-optional" - Walk upward from the "root" directory, looking for
146
147
  * a directory containing a swc.config.js file, and falls back to "root"
@@ -198,7 +199,7 @@ export interface Options extends Config {
198
199
  * a package that matches one of the "swcrcRoots" packages.
199
200
  *
200
201
  *
201
- * Defaults to true as long as the filename option has been specificed
202
+ * Defaults to true as long as the filename option has been specified
202
203
  */
203
204
  swcrc?: boolean;
204
205
  /**
@@ -258,11 +259,11 @@ export declare type Swcrc = Config | Config[];
258
259
  */
259
260
  export interface Config {
260
261
  /**
261
- * Note: The type is string because it follow rust's regex syntax.
262
+ * Note: The type is string because it follows rust's regex syntax.
262
263
  */
263
264
  test?: string | string[];
264
265
  /**
265
- * Note: The type is string because it follow rust's regex syntax.
266
+ * Note: The type is string because it follows rust's regex syntax.
266
267
  */
267
268
  exclude?: string | string[];
268
269
  env?: EnvConfig;
@@ -303,7 +304,7 @@ export interface EnvConfig {
303
304
  path?: string;
304
305
  shippedProposals?: boolean;
305
306
  /**
306
- * Enable all trnasforms
307
+ * Enable all transforms
307
308
  */
308
309
  forceAllTransforms?: boolean;
309
310
  }
@@ -319,7 +320,7 @@ export interface JscConfig {
319
320
  */
320
321
  externalHelpers?: boolean;
321
322
  /**
322
- * Defaults to `es3` (which enableds **all** pass).
323
+ * Defaults to `es3` (which enabled **all** pass).
323
324
  */
324
325
  target?: JscTarget;
325
326
  /**
@@ -330,7 +331,7 @@ export interface JscConfig {
330
331
  optimizeHygiene?: boolean;
331
332
  keepImportAssertions?: boolean;
332
333
  /**
333
- * Specify the location where SWC stores its intermidiate cache files.
334
+ * Specify the location where SWC stores its intermediate cache files.
334
335
  * Currently only transform plugin uses this. If not specified, SWC will
335
336
  * create `.swc` directories.
336
337
  */
@@ -1061,6 +1062,7 @@ export interface NamedImportSpecifier extends Node, HasSpan {
1061
1062
  type: "ImportSpecifier";
1062
1063
  local: Identifier;
1063
1064
  imported: Identifier | null;
1065
+ isTypeOnly?: boolean;
1064
1066
  }
1065
1067
  export declare type ExportSpecifier = ExportNamespaceSpecifier | ExportDefaultSpecifier | NamedExportSpecifier;
1066
1068
  /**
@@ -1081,6 +1083,7 @@ export interface NamedExportSpecifier extends Node, HasSpan {
1081
1083
  * `Some(bar)` in `export { foo as bar }`
1082
1084
  */
1083
1085
  exported: Identifier | null;
1086
+ isTypeOnly?: boolean;
1084
1087
  }
1085
1088
  interface HasInterpreter {
1086
1089
  /**