@swc/core 1.2.220 → 1.2.224

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,186 @@
5
5
 
6
6
 
7
7
 
8
+ - **(es/codegen)** Emit extra dot if a float is too large (#5407) ([6dca81e](https://github.com/swc-project/swc/commit/6dca81e368f060d8247de0dd5183ea0826142b0f))
9
+
10
+
11
+ - **(es/fixer)** Preserve parens for optional chaining expressions (#5388) ([9443419](https://github.com/swc-project/swc/commit/9443419591a47931bf27958ef5f69599484157a5))
12
+
13
+
14
+ - **(es/minifier)** Inline vars declared in conditional paths (#5392) ([ca21fd0](https://github.com/swc-project/swc/commit/ca21fd0c4d0d7c074a1821d6d4c862f8dd5f611c))
15
+
16
+
17
+ - **(es/modules)** Use an indirect call for a tagged template (#5382) ([cdb6164](https://github.com/swc-project/swc/commit/cdb6164937b285aa294a8d68459a2c39862d941f))
18
+
19
+ ### Features
20
+
21
+
22
+
23
+ - **(es/codegen)** Remove more whitespaces from `BinExpr` (#5380) ([e37b7e8](https://github.com/swc-project/swc/commit/e37b7e8caa05fd98fdfe7b3918cb7b09147bbae7))
24
+
25
+
26
+ - **(swc_core)** Expand features to support node bindings (#5387) ([038a543](https://github.com/swc-project/swc/commit/038a543be9b9b5922e4207cc9079e4f32435e475))
27
+
28
+
29
+ - **(swc_core)** Expose `quote!` macros (#5400) ([8ca736f](https://github.com/swc-project/swc/commit/8ca736f8ee390bef676ab9ef7472b11b3c3dc941))
30
+
31
+ ### Testing
32
+
33
+
34
+
35
+ - **(es/minifier)** Update the golden list (#5378) ([84a1ef8](https://github.com/swc-project/swc/commit/84a1ef856af287c2272a4f3e553b248148e15d33))
36
+
37
+
38
+ - **(es/minifier)** Add snapshots of compressed libraries (#5389) ([a46669d](https://github.com/swc-project/swc/commit/a46669d334755f4de1a02fbc32dfbee6f01d433d))
39
+
40
+
41
+ - **(es/minifier)** Organize simple size tests (#5403) ([86da544](https://github.com/swc-project/swc/commit/86da5441e6c510aa8513a796f482d08923362681))
42
+
43
+ ## [1.2.223] - 2022-08-03
44
+
45
+ ### Bug Fixes
46
+
47
+
48
+
49
+ - **(es/fixer)** Don't insert extra paren when left of `BinExpr` is `UpdateExpr` (#5376) ([77497e4](https://github.com/swc-project/swc/commit/77497e4fbe9bf10c5ffd510e932a6ff404da1760))
50
+
51
+
52
+ - **(es/lints)** Ignore TS module declare blocks (#5363) ([daaa8b5](https://github.com/swc-project/swc/commit/daaa8b5c4a86cf39ab34bc46b239719fab8b9916))
53
+
54
+
55
+ - **(es/minifier)** Drop more comments (#5361) ([27cdc65](https://github.com/swc-project/swc/commit/27cdc65a51af28e8a6073c325fe549d270b3f7dc))
56
+
57
+
58
+ - **(es/minifier)** Optimize inlining function calls with a literal in arguments (#5365) ([b221f90](https://github.com/swc-project/swc/commit/b221f90117a77f684dc6b9ae5296c6bd1a2d8349))
59
+
60
+ ### Documentation
61
+
62
+
63
+
64
+ - **(rustdoc)** FIx CI (#5370) ([cf3de12](https://github.com/swc-project/swc/commit/cf3de124d621c8735c551637136b325104c5668e))
65
+
66
+ ### Features
67
+
68
+
69
+
70
+ - **(es/minifier)** Remove duplicate `var` declarations (#5373) ([4fdbe40](https://github.com/swc-project/swc/commit/4fdbe40c74e618a9bdf00253f970e27e20c6b6eb))
71
+
72
+
73
+ - **(es/minifier)** Consider char frequencies (#5375) ([3943eb2](https://github.com/swc-project/swc/commit/3943eb24d11540928d436f63c4ffd6421400fcaf))
74
+
75
+
76
+ - **(swc_core)** Introduce package (#5364) ([27b464d](https://github.com/swc-project/swc/commit/27b464d90a410b5fb6dca438442e1e8669a28e32))
77
+
78
+
79
+ - **(swc_core)** Expand features and use it from wasm and cli (#5369) ([8b9dd6f](https://github.com/swc-project/swc/commit/8b9dd6f026e13fa850a7adcca52e285d874d4390))
80
+
81
+ ### Miscellaneous Tasks
82
+ - **general**: Update toml formatting (#5368) ([12fd737](https://github.com/swc-project/swc/commit/12fd7373265df570aa129ce8c92ce5953db79254))
83
+
84
+ ### Performance
85
+
86
+
87
+
88
+ - **(es/minifier)** Make postcompress pass parallel (#5374) ([6552d1a](https://github.com/swc-project/swc/commit/6552d1a6f77e5a69cf3c21de9606653b1dcc285a))
89
+
90
+ ## [1.2.222] - 2022-08-01
91
+
92
+ ### Bug Fixes
93
+
94
+
95
+
96
+ - **(css/ast)** Support list of component values (#5321) ([8f81104](https://github.com/swc-project/swc/commit/8f811043809a8cc51bb717b678906576bb6eccc3))
97
+
98
+
99
+ - **(css/prefixer)** Generate prefixes for selectors using env (#5307) ([b18172d](https://github.com/swc-project/swc/commit/b18172d7613c2ecee85f559b9b317aeb2f9bfda7))
100
+
101
+
102
+ - **(es/codegen)** Emit type parameters of class super expression (#5338) ([42d8ad2](https://github.com/swc-project/swc/commit/42d8ad26ce5b56d9c26d342e8b6af8844b85bd17))
103
+
104
+
105
+ - **(es/minifier)** Change default es version to `es5` (#5333) ([64a9946](https://github.com/swc-project/swc/commit/64a99461ecc24b074e9b674c98c1cec12b687159))
106
+
107
+
108
+ - **(es/minifier)** Check if an inlined value is mutated (#5318) ([11f495a](https://github.com/swc-project/swc/commit/11f495ad37cbaf56359174a206e97f0874cc0d15))
109
+
110
+
111
+ - **(es/minifier)** Ignore member expression without side-effects in assign position (#5344) ([8611161](https://github.com/swc-project/swc/commit/8611161c02223f6b1fb8734e648392794f2b1d81))
112
+
113
+
114
+ - **(es/minifier)** Allow single-thread mode (#5353) ([fbdc9af](https://github.com/swc-project/swc/commit/fbdc9af5ca51e7e2a0ba42997dd9ffd14d5059f4))
115
+
116
+
117
+ - **(es/utils)** Fix `contains_top_level_await` (#5335) ([1d10c3e](https://github.com/swc-project/swc/commit/1d10c3e83725276fa466393fb7a3139f07fa66c7))
118
+
119
+ ### Features
120
+
121
+
122
+
123
+ - **(css/prefixer)** Prefix more properties (#5340) ([8e12e52](https://github.com/swc-project/swc/commit/8e12e52a5735dafe1336d0bdc83e91dd7cca9d7d))
124
+
125
+
126
+ - **(css/prefixer)** Avoid prefixing general functions (#5319) ([07732d6](https://github.com/swc-project/swc/commit/07732d6a0a3684697ebfd263749b12a083029db9))
127
+
128
+
129
+ - **(wasm)** Add interfaces for wasm bindings (#5341) ([c16b6b7](https://github.com/swc-project/swc/commit/c16b6b72300a4e4952398c136ef834b8ca2f4b41))
130
+
131
+
132
+ - **(wasm)** Enable string interning (#5351) ([b0cb35a](https://github.com/swc-project/swc/commit/b0cb35abaad7ca2a2e58462285548959d3e2c0fc))
133
+
134
+
135
+ - **(wasm)** Expose async facade interfaces (#5352) ([281bdd9](https://github.com/swc-project/swc/commit/281bdd9e9741ec7375497b390058a86a4f199029))
136
+
137
+
138
+ - **(xml)** Add xml crates (#5329) ([83e5023](https://github.com/swc-project/swc/commit/83e502367b5224be8e147d2e255e1ea3b7be4faa))
139
+
140
+ ### Miscellaneous Tasks
141
+
142
+
143
+
144
+ - **(ci)** Set MSRV to `1.60` (#5354) ([d3ecfd3](https://github.com/swc-project/swc/commit/d3ecfd36cd79e25334f36119da3233be53fa7e10))
145
+
146
+
147
+ - **(ci)** Fix publish action (#5358) ([4c461d1](https://github.com/swc-project/swc/commit/4c461d1ba7d389cc1275884dc037ec51cd3e48b7))
148
+
149
+ ### Performance
150
+
151
+
152
+
153
+ - **(es/minifier)** Make name mangler faster (#5336) ([b378c06](https://github.com/swc-project/swc/commit/b378c060816411dd1990a1dae4977703d3c80748))
154
+
155
+
156
+ - **(html/parser)** Apply small memory optimizations (#5345) ([2a499de](https://github.com/swc-project/swc/commit/2a499de61decdb836a4a51bc0fa5631568b77015))
157
+
158
+ ### Refactor
159
+
160
+
161
+
162
+ - **(wasm)** Use async interfaces for fallback bindings (#5356) ([74e7486](https://github.com/swc-project/swc/commit/74e748617e288b98b80e4b71aee15ed6fda1c48d))
163
+
164
+ ### Testing
165
+
166
+
167
+
168
+ - **(es)** Support tsc multi-file unit tests (#5316) ([81ac366](https://github.com/swc-project/swc/commit/81ac36604edda1d38329cf10fc65720eedf48cb9))
169
+
170
+
171
+ - **(es)** Update test cases (#5334) ([add1b75](https://github.com/swc-project/swc/commit/add1b75f61683f129b148fa14942e10a6514a0f3))
172
+
173
+ ### Build
174
+
175
+
176
+
177
+ - **(cargo)** Update packages (#5331) ([5c9ea16](https://github.com/swc-project/swc/commit/5c9ea16b2a5e003a5fa0198f3101e93efceab3b0))
178
+
179
+
180
+ - **(node)** Include fallback binding as a dependency (#5322) ([0782d25](https://github.com/swc-project/swc/commit/0782d250746eae97426ce7db9a24308efddcccf0))
181
+
182
+ ## [1.2.220] - 2022-07-28
183
+
184
+ ### Bug Fixes
185
+
186
+
187
+
8
188
  - **(atoms)** Workaround a bug of `rkyv` (#5323) ([14894ed](https://github.com/swc-project/swc/commit/14894ed4c970b7d283e36acd6001339e7d0d04fd))
9
189
 
10
190
 
package/index.d.ts CHANGED
@@ -102,6 +102,6 @@ export declare function __experimental_registerGlobalTraceConfig(traceConfig: {
102
102
  * as internal representation may change anytime. Use it with caution.
103
103
  */
104
104
  export declare function getBinaryMetadata(): {
105
- target: any;
105
+ target: string | undefined;
106
106
  };
107
107
  export declare const DEFAULT_EXTENSIONS: readonly string[];
package/index.js CHANGED
@@ -53,6 +53,7 @@ const spack_1 = require("./spack");
53
53
  const assert = __importStar(require("assert"));
54
54
  // Allow overrides to the location of the .node binding file
55
55
  const bindingsOverride = process.env["SWC_BINARY_PATH"];
56
+ // `@swc/core` includes d.ts for the `@swc/wasm` to provide typed fallback bindings
56
57
  let fallbackBindings;
57
58
  const bindings = (() => {
58
59
  let binding;
@@ -95,7 +96,7 @@ class Compiler {
95
96
  return bindings.minify(toBuffer(src), toBuffer(opts !== null && opts !== void 0 ? opts : {}));
96
97
  }
97
98
  else if (fallbackBindings) {
98
- return Promise.resolve(fallbackBindings.minifySync(src, opts));
99
+ return fallbackBindings.minify(src, opts);
99
100
  }
100
101
  throw new Error('Bindings not found.');
101
102
  });
@@ -124,8 +125,7 @@ class Compiler {
124
125
  return JSON.parse(res);
125
126
  }
126
127
  else if (fallbackBindings) {
127
- const res = fallbackBindings.parseSync(src, toBuffer(options), filename);
128
- return Promise.resolve(JSON.parse(res));
128
+ return fallbackBindings.parse(src, options);
129
129
  }
130
130
  throw new Error('Bindings not found.');
131
131
  });
@@ -137,7 +137,7 @@ class Compiler {
137
137
  return JSON.parse(bindings.parseSync(src, toBuffer(options), filename));
138
138
  }
139
139
  else if (fallbackBindings) {
140
- return JSON.parse(fallbackBindings.parseSync(src, options));
140
+ return fallbackBindings.parseSync(src, options);
141
141
  }
142
142
  throw new Error('Bindings not found.');
143
143
  }
@@ -177,7 +177,7 @@ class Compiler {
177
177
  return bindings.print(JSON.stringify(m), toBuffer(options));
178
178
  }
179
179
  else if (fallbackBindings) {
180
- return Promise.resolve(fallbackBindings.printSync(JSON.stringify(m), options));
180
+ return fallbackBindings.print(m, options);
181
181
  }
182
182
  throw new Error('Bindings not found.');
183
183
  });
@@ -192,7 +192,7 @@ class Compiler {
192
192
  return bindings.printSync(JSON.stringify(m), toBuffer(options));
193
193
  }
194
194
  else if (fallbackBindings) {
195
- return fallbackBindings.printSync(JSON.stringify(m), options);
195
+ return fallbackBindings.printSync(m, options);
196
196
  }
197
197
  throw new Error('Bindings not found.');
198
198
  }
@@ -219,7 +219,7 @@ class Compiler {
219
219
  console.warn(`Fallback bindings does not support legacy plugins, it'll be ignored.`);
220
220
  this.fallbackBindingsPluginWarningDisplayed = true;
221
221
  }
222
- return Promise.resolve(fallbackBindings.transformSync(src, options));
222
+ return fallbackBindings.transform(src, options);
223
223
  }
224
224
  throw new Error('Bindings not found.');
225
225
  });
@@ -244,7 +244,7 @@ class Compiler {
244
244
  console.warn(`Fallback bindings does not support legacy plugins, it'll be ignored.`);
245
245
  this.fallbackBindingsPluginWarningDisplayed = true;
246
246
  }
247
- return fallbackBindings.transformSync(src, options);
247
+ return fallbackBindings.transformSync(isModule ? JSON.stringify(src) : src, options);
248
248
  }
249
249
  throw new Error("Bindings not found");
250
250
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swc/core",
3
- "version": "1.2.220",
3
+ "version": "1.2.224",
4
4
  "description": "Super-fast alternative for babel",
5
5
  "homepage": "https://swc.rs",
6
6
  "main": "./index.js",
@@ -59,7 +59,7 @@
59
59
  "prepublishOnly": "tsc -d && napi prepublish -p scripts/npm --tagstyle npm",
60
60
  "pack": "wasm-pack",
61
61
  "build:ts": "tsc -d",
62
- "build:wasm": "npm-run-all \"pack -- build ./crates/wasm --scope swc {1} -t {2} --features plugin\" --",
62
+ "build:wasm": "npm-run-all \"pack -- build ./crates/binding_core_wasm --scope swc {1} -t {2} --features plugin\" --",
63
63
  "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",
64
64
  "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",
65
65
  "test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --config ./node-swc/jest.config.js",
@@ -96,7 +96,7 @@
96
96
  "@babel/preset-typescript": "^7.13.0",
97
97
  "@babel/types": "^7.14.0",
98
98
  "@napi-rs/cli": "^2.10.0",
99
- "@swc/core": "^1.2.219",
99
+ "@swc/core": "^1.2.220",
100
100
  "@swc/helpers": "^0.4.2",
101
101
  "@taplo/cli": "^0.3.2",
102
102
  "@types/jest": "^28.1.4",
@@ -138,19 +138,19 @@
138
138
  "url": "https://opencollective.com/swc"
139
139
  },
140
140
  "optionalDependencies": {
141
- "@swc/core-win32-x64-msvc": "1.2.220",
142
- "@swc/core-darwin-x64": "1.2.220",
143
- "@swc/core-linux-x64-gnu": "1.2.220",
144
- "@swc/core-linux-x64-musl": "1.2.220",
145
- "@swc/core-freebsd-x64": "1.2.220",
146
- "@swc/core-win32-ia32-msvc": "1.2.220",
147
- "@swc/core-linux-arm64-gnu": "1.2.220",
148
- "@swc/core-linux-arm-gnueabihf": "1.2.220",
149
- "@swc/core-darwin-arm64": "1.2.220",
150
- "@swc/core-android-arm64": "1.2.220",
151
- "@swc/core-linux-arm64-musl": "1.2.220",
152
- "@swc/core-win32-arm64-msvc": "1.2.220",
153
- "@swc/core-android-arm-eabi": "1.2.220"
141
+ "@swc/core-win32-x64-msvc": "1.2.224",
142
+ "@swc/core-darwin-x64": "1.2.224",
143
+ "@swc/core-linux-x64-gnu": "1.2.224",
144
+ "@swc/core-linux-x64-musl": "1.2.224",
145
+ "@swc/core-freebsd-x64": "1.2.224",
146
+ "@swc/core-win32-ia32-msvc": "1.2.224",
147
+ "@swc/core-linux-arm64-gnu": "1.2.224",
148
+ "@swc/core-linux-arm-gnueabihf": "1.2.224",
149
+ "@swc/core-darwin-arm64": "1.2.224",
150
+ "@swc/core-android-arm64": "1.2.224",
151
+ "@swc/core-linux-arm64-musl": "1.2.224",
152
+ "@swc/core-win32-arm64-msvc": "1.2.224",
153
+ "@swc/core-android-arm-eabi": "1.2.224"
154
154
  },
155
155
  "files": [
156
156
  "CHANGELOG.md",
@@ -170,6 +170,7 @@
170
170
  "package.json",
171
171
  "spack.d.ts",
172
172
  "types.js",
173
- "postinstall.js"
173
+ "postinstall.js",
174
+ "crates/binding_core_wasm/pkg/binding_core_wasm.d.ts"
174
175
  ]
175
176
  }