@swc/core 1.2.164 → 1.2.168

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,209 @@
5
5
 
6
6
 
7
7
 
8
+ - **(es/codegen)** Emit decorators before export (#4349) ([4953ce4](https://github.com/swc-project/swc/commit/4953ce466fcb008aa356d88489786b7bff3f2395))
9
+
10
+
11
+ - **(es/minifier)** Preserve vars in dead branches (#4345) ([5a5e41a](https://github.com/swc-project/swc/commit/5a5e41aaaa3791f76de9c73aa29c714fa097c773))
12
+
13
+ ### Features
14
+
15
+
16
+
17
+ - **(es/minifier)** `const` => `let` (#3654) ([b3b95ac](https://github.com/swc-project/swc/commit/b3b95acc75f765af433b0c7f887821403561378f))
18
+
19
+ ### Miscellaneous Tasks
20
+
21
+
22
+
23
+ - **(es/minifier)** Organize scripts (#4347) ([14c74f5](https://github.com/swc-project/swc/commit/14c74f50c0b21d65d9604b58a2ce348baeb1baa3))
24
+
25
+
26
+ - **(es/minifier)** Improve scripts (#4339) ([2563c7f](https://github.com/swc-project/swc/commit/2563c7f8ff5bb86131f642b6cca948955d795820))
27
+
28
+
29
+ - **(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))
30
+
31
+ ### Performance
32
+
33
+
34
+
35
+ - **(es)** Disable wrong parallelization (#4354) ([da6fa60](https://github.com/swc-project/swc/commit/da6fa602310c0a56825723d83585fb258b88c931))
36
+
37
+
38
+ - **(es/minifier)** Split frequently used functions (#4352) ([42e15ae](https://github.com/swc-project/swc/commit/42e15aedc2b7c0ccdd9d6db58cc425a1e781cdd8))
39
+
40
+ ## [1.2.167] - 2022-04-17
41
+
42
+ ### Bug Fixes
43
+
44
+
45
+
46
+ - **(es/parser)** Reject optional constructor call (#4340) ([31b3336](https://github.com/swc-project/swc/commit/31b3336cd5881ff8f99d791254ee02ff4fa23fcc))
47
+
48
+ ### Miscellaneous Tasks
49
+
50
+
51
+
52
+ - **(ci)** Fix wasm publish script ([1900d35](https://github.com/swc-project/swc/commit/1900d3506efb8bc319dece4219789e2509ecf67c))
53
+
54
+ ### Performance
55
+
56
+
57
+
58
+ - **(es/minifier)** Make name mangler faster (#4342) ([66ff7b8](https://github.com/swc-project/swc/commit/66ff7b8a09bc504d3912d12b4a8ebea3a96d4e4b))
59
+
60
+ ## [1.2.166] - 2022-04-15
61
+
62
+ ### Bug Fixes
63
+
64
+
65
+
66
+ - **(css/parser)** Parse legacy `calc`s (#4320) ([81370d1](https://github.com/swc-project/swc/commit/81370d16cb405d43aeb9198e1fce4aa11009045f))
67
+
68
+
69
+ - **(css/prefixer)** Don't prefix if it's already prefixed (#4307) ([690ce26](https://github.com/swc-project/swc/commit/690ce2628c988a3d1823cbcf4f786203e548cb84))
70
+
71
+
72
+ - **(css/prefixer)** Handle at-rules and don't generate unnecessary prefixes (#4318) ([ac4f14a](https://github.com/swc-project/swc/commit/ac4f14ad7b70e67c41507cafd997f6b4e346e815))
73
+
74
+
75
+ - **(css/prefixer)** Fix more bugs (#4330) ([405e5ed](https://github.com/swc-project/swc/commit/405e5ed0b3bbcf8076c80d1383588bfee1cf8d22))
76
+
77
+
78
+ - **(es/codegen)** Fix overflow of numeric literals (#4321) ([0245e26](https://github.com/swc-project/swc/commit/0245e26af5f984cf89a2f474d89f6b3dfe2f0eff))
79
+
80
+
81
+ - **(es/codegen)** Fix codegen of arrow expressions (#4306) ([4c99730](https://github.com/swc-project/swc/commit/4c9973010a5c2b865e6ed676a4e0364234cf5d88))
82
+
83
+
84
+ - **(es/compat)** Fix renaming bug of `block_scoping` (#4310) ([6c9882e](https://github.com/swc-project/swc/commit/6c9882ec68fee9b702f5e4749482eca74fbd87e8))
85
+
86
+
87
+ - **(es/lints)** Check parameters in the duplicate binding rule (#4288) ([e4a565c](https://github.com/swc-project/swc/commit/e4a565c2d4c90dc23267b44e8f4aee2e0cc79c23))
88
+
89
+
90
+ - **(es/loader)** Fix traversal of node modules resolver (#4327) ([780de70](https://github.com/swc-project/swc/commit/780de7095e1ea6b71204017f708f8370ed4531a8))
91
+
92
+
93
+ - **(es/minifier)** Fix inlining of uninitialized variables (#4292) ([b990b19](https://github.com/swc-project/swc/commit/b990b19ed130ce1dc57f76b883bf638ace64c4f4))
94
+
95
+
96
+ - **(es/minifier)** Respect `dead_code` (#4328) ([8886a4b](https://github.com/swc-project/swc/commit/8886a4b572c4b24091aa3db38fdc7b486334c069))
97
+
98
+
99
+ - **(es/minifier)** Inline before cloning (#4338) ([4110fcb](https://github.com/swc-project/swc/commit/4110fcb9612ceeba0c52f539896075a571c9a619))
100
+
101
+
102
+ - **(es/parser)** Enable static blocks by default (#4334) ([7599fe7](https://github.com/swc-project/swc/commit/7599fe74317f790cce8f8638e84c320c5ebbc4c2))
103
+
104
+
105
+ - **(es/parser)** Make parsing of TS InstantiationExpr more permissive (#4332) ([ea466af](https://github.com/swc-project/swc/commit/ea466afdc8dc6b64be81244a8c0261ac34f22157))
106
+
107
+
108
+ - **(node-swc/types)** Add `isTypeOnly` to types (#4303) ([1a48732](https://github.com/swc-project/swc/commit/1a48732e78b9c650f93320f4d6f7be57a9f4a6c4))
109
+
110
+ ### Features
111
+
112
+
113
+
114
+ - **(css/minifier)** Compress colors (#4308) ([65b18ee](https://github.com/swc-project/swc/commit/65b18ee602506d455ce10c6ca2bd599d57d29d14))
115
+
116
+
117
+ - **(es)** Support `typeof` with private fields (#4302) ([d0de5a6](https://github.com/swc-project/swc/commit/d0de5a63a01ef45101cdd10f90546ec7950ce7ac))
118
+
119
+
120
+ - **(es/minifier)** Enable `conditionals` by default (#4301) ([7e8f613](https://github.com/swc-project/swc/commit/7e8f6132729ca3ddf7884f1b246964921cde1c35))
121
+
122
+
123
+ - **(es/minifier)** Enable `dead_code` by default (#4309) ([74a5087](https://github.com/swc-project/swc/commit/74a5087989173f833517cb6f6bf51afcf9642286))
124
+
125
+
126
+ - **(es/minifier)** Improve sequential inliner (#4335) ([f92242d](https://github.com/swc-project/swc/commit/f92242dcb17a7b6dc25dac63d052df9e3d7042bc))
127
+
128
+
129
+ - **(es/parser)** Support `extends` clause to `infer` type (#4326) ([1c3d1af](https://github.com/swc-project/swc/commit/1c3d1af01cdfdf6794e73e32bb0062698d4910be))
130
+
131
+ ### Miscellaneous Tasks
132
+
133
+
134
+
135
+ - **(*)** Typo + fomatting (#4304) ([37a8c90](https://github.com/swc-project/swc/commit/37a8c90750d778edcd69ffdd85fe990a27efc75d))
136
+
137
+
138
+ - **(ci)** Fix CI (#4299) ([adea17d](https://github.com/swc-project/swc/commit/adea17dbe3b17e397d79a7dae1f469bf38f0185f))
139
+
140
+
141
+ - **(es/minifier)** Update terser test references (#4297) ([df0d572](https://github.com/swc-project/swc/commit/df0d572b4ff250be037ca9a04b6bcd95329f9f3b))
142
+
143
+
144
+ - **(es/minifier)** Add full benchmark for `.minify()` (#4341) ([ba5f743](https://github.com/swc-project/swc/commit/ba5f7436c18b7e3845bc2935aca6cdb76477b686))
145
+
146
+ ### Refactor
147
+
148
+
149
+
150
+ - **(bindings)** Rename crates (#4337) ([83a8f48](https://github.com/swc-project/swc/commit/83a8f489ec5b7010a762a75dc31a63b2fb060372))
151
+
152
+
153
+ - **(es/minifier)** Clean up logging (#4322) ([2002554](https://github.com/swc-project/swc/commit/2002554fa26c1ebd683f71d87263f26fd95d00f1))
154
+
155
+
156
+ - **(es/parser)** Simplify logic (#4329) ([37aec5b](https://github.com/swc-project/swc/commit/37aec5b19965bedbe67fa1b454be6a7017ccedec))
157
+
158
+ ## [1.2.165] - 2022-04-09
159
+
160
+ ### Bug Fixes
161
+
162
+
163
+
164
+ - **(css/prefixer)** FIx a bug related to `writing-mode` (#4278) ([7f38e06](https://github.com/swc-project/swc/commit/7f38e06e0209216200182555c7c7ddb11499e45d))
165
+
166
+
167
+ - **(es/minifier)** Fix handling of `eval` (#4273) ([c961371](https://github.com/swc-project/swc/commit/c961371c312f85553ab17eb1b67f0721861bcbf5))
168
+
169
+
170
+ - **(es/module)** Support top-level await in dynamic imports (#4277) ([720244f](https://github.com/swc-project/swc/commit/720244fff9f3fcf5cb0ed4bcfc6e2a5795ad3be1))
171
+
172
+
173
+ - **(es/optimization)** Don't create invalid sequence expressions (#4285) ([4868c73](https://github.com/swc-project/swc/commit/4868c73d5bc5eb3ffbbc2fd31c485e3e22795550))
174
+
175
+ ### Features
176
+
177
+
178
+
179
+ - **(html)** Add raw fields (#4281) ([ee108af](https://github.com/swc-project/swc/commit/ee108af3d0bf81cfa101d8b52ee4d072705b04f4))
180
+
181
+
182
+ - **(plugin)** Implement `Copy` and `Clone` for the comment proxy (#4280) ([3c4e520](https://github.com/swc-project/swc/commit/3c4e5204ecb51dd67c73ae5556c886b303891a23))
183
+
184
+
185
+ - **(plugin)** Make more types serializable (#4289) ([281db2c](https://github.com/swc-project/swc/commit/281db2cc4f9af29577095038b37af5855a1e5aa5))
186
+
187
+
188
+ - **(plugin/runner)** Allow fs access from wasi plugin (#4279) ([fc3a2d0](https://github.com/swc-project/swc/commit/fc3a2d0cf9a4767076dda3fac929b24a50144730))
189
+
190
+ ### Miscellaneous Tasks
191
+
192
+
193
+
194
+ - **(plugin)** Align version of `swc_common` to include dummy comment api (#4270) ([fad652f](https://github.com/swc-project/swc/commit/fad652f879d12a1015b4500f0a512232c9433c2d))
195
+
196
+ ### Refactor
197
+
198
+
199
+
200
+ - **(es/minifier)** Merge code for multi-replacer (#4269) ([434dcf4](https://github.com/swc-project/swc/commit/434dcf4af786a7d31827f7b078dea40efc35b64f))
201
+
202
+
203
+ - **(plugin/api)** Expand the proxy crate (#4290) ([cf7ca50](https://github.com/swc-project/swc/commit/cf7ca5076a7f0b33f3587fb34f2eddcb2d316e5d))
204
+
205
+ ## [1.2.164] - 2022-04-07
206
+
207
+ ### Bug Fixes
208
+
209
+
210
+
8
211
  - **(es/codegen)** Commit `;` before a template literal (#4252) ([8cd903b](https://github.com/swc-project/swc/commit/8cd903b3b006b823cc5d3a61d40a1311fc97276c))
9
212
 
10
213
 
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.164",
3
+ "version": "1.2.168",
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.164",
125
- "@swc/core-darwin-x64": "1.2.164",
126
- "@swc/core-linux-x64-gnu": "1.2.164",
127
- "@swc/core-linux-x64-musl": "1.2.164",
128
- "@swc/core-freebsd-x64": "1.2.164",
129
- "@swc/core-win32-ia32-msvc": "1.2.164",
130
- "@swc/core-linux-arm64-gnu": "1.2.164",
131
- "@swc/core-linux-arm-gnueabihf": "1.2.164",
132
- "@swc/core-darwin-arm64": "1.2.164",
133
- "@swc/core-android-arm64": "1.2.164",
134
- "@swc/core-linux-arm64-musl": "1.2.164",
135
- "@swc/core-win32-arm64-msvc": "1.2.164",
136
- "@swc/core-android-arm-eabi": "1.2.164"
124
+ "@swc/core-win32-x64-msvc": "1.2.168",
125
+ "@swc/core-darwin-x64": "1.2.168",
126
+ "@swc/core-linux-x64-gnu": "1.2.168",
127
+ "@swc/core-linux-x64-musl": "1.2.168",
128
+ "@swc/core-freebsd-x64": "1.2.168",
129
+ "@swc/core-win32-ia32-msvc": "1.2.168",
130
+ "@swc/core-linux-arm64-gnu": "1.2.168",
131
+ "@swc/core-linux-arm-gnueabihf": "1.2.168",
132
+ "@swc/core-darwin-arm64": "1.2.168",
133
+ "@swc/core-android-arm64": "1.2.168",
134
+ "@swc/core-linux-arm64-musl": "1.2.168",
135
+ "@swc/core-win32-arm64-msvc": "1.2.168",
136
+ "@swc/core-android-arm-eabi": "1.2.168"
137
137
  }
138
138
  }
package/types.d.ts CHANGED
@@ -140,7 +140,7 @@ export interface Options extends Config {
140
140
  *
141
141
  * "root" - Passes the "root" value through as unchanged.
142
142
  * "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
143
+ * containing a swc.config.js file, and throws an error if a swc.config.js
144
144
  * is not found.
145
145
  * "upward-optional" - Walk upward from the "root" directory, looking for
146
146
  * a directory containing a swc.config.js file, and falls back to "root"
@@ -198,7 +198,7 @@ export interface Options extends Config {
198
198
  * a package that matches one of the "swcrcRoots" packages.
199
199
  *
200
200
  *
201
- * Defaults to true as long as the filename option has been specificed
201
+ * Defaults to true as long as the filename option has been specified
202
202
  */
203
203
  swcrc?: boolean;
204
204
  /**
@@ -258,11 +258,11 @@ export declare type Swcrc = Config | Config[];
258
258
  */
259
259
  export interface Config {
260
260
  /**
261
- * Note: The type is string because it follow rust's regex syntax.
261
+ * Note: The type is string because it follows rust's regex syntax.
262
262
  */
263
263
  test?: string | string[];
264
264
  /**
265
- * Note: The type is string because it follow rust's regex syntax.
265
+ * Note: The type is string because it follows rust's regex syntax.
266
266
  */
267
267
  exclude?: string | string[];
268
268
  env?: EnvConfig;
@@ -303,7 +303,7 @@ export interface EnvConfig {
303
303
  path?: string;
304
304
  shippedProposals?: boolean;
305
305
  /**
306
- * Enable all trnasforms
306
+ * Enable all transforms
307
307
  */
308
308
  forceAllTransforms?: boolean;
309
309
  }
@@ -319,7 +319,7 @@ export interface JscConfig {
319
319
  */
320
320
  externalHelpers?: boolean;
321
321
  /**
322
- * Defaults to `es3` (which enableds **all** pass).
322
+ * Defaults to `es3` (which enabled **all** pass).
323
323
  */
324
324
  target?: JscTarget;
325
325
  /**
@@ -330,7 +330,7 @@ export interface JscConfig {
330
330
  optimizeHygiene?: boolean;
331
331
  keepImportAssertions?: boolean;
332
332
  /**
333
- * Specify the location where SWC stores its intermidiate cache files.
333
+ * Specify the location where SWC stores its intermediate cache files.
334
334
  * Currently only transform plugin uses this. If not specified, SWC will
335
335
  * create `.swc` directories.
336
336
  */
@@ -1061,6 +1061,7 @@ export interface NamedImportSpecifier extends Node, HasSpan {
1061
1061
  type: "ImportSpecifier";
1062
1062
  local: Identifier;
1063
1063
  imported: Identifier | null;
1064
+ isTypeOnly?: boolean;
1064
1065
  }
1065
1066
  export declare type ExportSpecifier = ExportNamespaceSpecifier | ExportDefaultSpecifier | NamedExportSpecifier;
1066
1067
  /**
@@ -1081,6 +1082,7 @@ export interface NamedExportSpecifier extends Node, HasSpan {
1081
1082
  * `Some(bar)` in `export { foo as bar }`
1082
1083
  */
1083
1084
  exported: Identifier | null;
1085
+ isTypeOnly?: boolean;
1084
1086
  }
1085
1087
  interface HasInterpreter {
1086
1088
  /**