@swc/core 1.2.120 → 1.2.124

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,242 @@
5
5
 
6
6
 
7
7
 
8
+ - **(es)** Handle import assertions correctly (#3113) ([c9adf03](https://github.com/swc-project/swc/commit/c9adf0333811b2830fe3f3c06d6fd9706f7bb9ae))
9
+
10
+
11
+ - **(es/compat)** Fix handling of hoisted functions in regenerator (#3119) ([ac78a52](https://github.com/swc-project/swc/commit/ac78a527ebba3e8df2342e65b4fd5c2d36240ff0))
12
+
13
+
14
+ - **(es/compat)** Fix private methods of a class (#3123) ([1b6ac25](https://github.com/swc-project/swc/commit/1b6ac25d5c6c009c38a7097b910f7b6838ab560b))
15
+
16
+
17
+ - **(es/compat)** Fix `computed_properties` (#3120) ([27d3fd9](https://github.com/swc-project/swc/commit/27d3fd93b0ad2b5e305ded8145100b060ac6c2a3))
18
+
19
+
20
+ - **(es/optimization)** Fix inlining (#3132) ([693c22a](https://github.com/swc-project/swc/commit/693c22aa93ce115aca294f61feefe4582336ada3))
21
+
22
+
23
+ - **(es/parser)** Support import assertions in specifier-less imports (#3134) ([2f3ca22](https://github.com/swc-project/swc/commit/2f3ca22ecf7f567256695c39a904f02ff75e2c85))
24
+
25
+
26
+ - **(es/utils)** Fix `is_valid_ident` (#3133) ([ec7e0ae](https://github.com/swc-project/swc/commit/ec7e0aee256cc7cc13f81ef22164c29f42bb43be))
27
+
28
+
29
+ - **(node-swc)** Recover from `ldd` not found (#3125) ([054a195](https://github.com/swc-project/swc/commit/054a19518ce77f36520a17e146c65632aeab3080))
30
+
31
+ ### Features
32
+
33
+
34
+
35
+ - **(es/preset-env)** Upgrade `browserslist-rs` (#3122) ([83f71c2](https://github.com/swc-project/swc/commit/83f71c2c0b8382e70172b1e2d4d9a18852e7a995))
36
+
37
+ ### Miscellaneous Tasks
38
+
39
+
40
+
41
+ - **(ci)** Reduce CI time (#3128) ([61cd7da](https://github.com/swc-project/swc/commit/61cd7da265bd775605a0e48346f70b41adf9a225))
42
+
43
+ ### Refactor
44
+
45
+
46
+
47
+ - **(es/react/fast-refresh)** Use `VisitMut` (#3129) ([f8f04e0](https://github.com/swc-project/swc/commit/f8f04e031e218393abd8ae5ca6469484b0fe90d3))
48
+
49
+ ### Security
50
+
51
+
52
+
53
+ - **(repo)** Configure `cargo-crev` (#3124) ([cec325b](https://github.com/swc-project/swc/commit/cec325be6329bbdc175d7850443de8aabfcf31d6))
54
+
55
+ ## [1.2.123] - 2021-12-26
56
+
57
+ ### Bug Fixes
58
+
59
+
60
+
61
+ - **(es/ast)** Fix `Ident::verify_symbol` (#3108) ([e5971f7](https://github.com/swc-project/swc/commit/e5971f77d5861038f7dcd905a9aca72c84b1a035))
62
+
63
+
64
+ - **(es/compat)** Fix `classes` pass (#3107) ([d923f89](https://github.com/swc-project/swc/commit/d923f89db19b4343034569595dc3bbbce29b86b0))
65
+
66
+
67
+ - **(es/compat)** Fix `destructuring` (#3104) ([9f5a8f7](https://github.com/swc-project/swc/commit/9f5a8f728ade23640430d82f9f4bbcb341e30e2a))
68
+
69
+
70
+ - **(es/compat)** Fix handling of class methods with a big int as a key (#3118) ([a1cb4a4](https://github.com/swc-project/swc/commit/a1cb4a4aa57bd54e6718f293a65361952f4ef11d))
71
+
72
+
73
+ - **(es/helpers)** Fix decorators (#3105) ([f66c2cd](https://github.com/swc-project/swc/commit/f66c2cd375f78711fdf6a058003010bce8999aed))
74
+
75
+ ### Features
76
+
77
+
78
+
79
+ - **(es/bundler)** Add an option to disable tree-shaking (#3102) ([d98a593](https://github.com/swc-project/swc/commit/d98a59339a0fa2a14f2bcb92c6deeb810ec339be))
80
+
81
+
82
+ - **(es/diff)** Initialize a diff tool for ecmascript (#3101) ([ff0b55b](https://github.com/swc-project/swc/commit/ff0b55b7782cfa9c428d88d366520b53307bca42))
83
+
84
+
85
+ - **(node)** Upgrade `napi` to v2 (#2958) ([206da12](https://github.com/swc-project/swc/commit/206da128a1f1ecd43c7580a7ad5f58ebc363c812))
86
+
87
+ ### Miscellaneous Tasks
88
+
89
+
90
+
91
+ - **(ci)** Fix script for publishing ([f51314c](https://github.com/swc-project/swc/commit/f51314cd51990b2caf8b18a7d8a647236a0ec893))
92
+
93
+
94
+ - **(xi)** Fix publishing script ([e0e7f74](https://github.com/swc-project/swc/commit/e0e7f749551c15eae875457d584b869088794aea))- **general**: Fix `package.json` ([999df43](https://github.com/swc-project/swc/commit/999df436f7b9317167a822d6e0602324c8871dae))
95
+
96
+ ## [1.2.122] - 2021-12-22
97
+
98
+ ### Bug Fixes
99
+
100
+
101
+
102
+ - **(es/compat)** Fix handling of union of the legacy decorator pass (#3057) ([938e544](https://github.com/swc-project/swc/commit/938e544ac55503e91811cfc4e0c333deb2ccc7ed))
103
+
104
+
105
+ - **(es/loader)** Prefer ESM (#3089) ([ba2563f](https://github.com/swc-project/swc/commit/ba2563f59ed819e67a56e39cdcf38a7ccabd8f47))
106
+
107
+
108
+ - **(es/loader)** Update `lru` (#3092) ([15cbe4f](https://github.com/swc-project/swc/commit/15cbe4fcaad7b7b2f7bcc9fd413594a18ede25d8))
109
+
110
+
111
+ - **(es/transforms)** Fix `descturcturing` (#3098) ([df87c2b](https://github.com/swc-project/swc/commit/df87c2b30221f990cdd63125c9ef6036f370145e))
112
+
113
+
114
+ - **(es/typescript)** Export destructured properties in typescript namespaces (#3084) ([31dea3d](https://github.com/swc-project/swc/commit/31dea3dd319a19b75554b061cb1374d12718af24))
115
+
116
+ ### Features
117
+
118
+
119
+
120
+ - **(cli)** Setup packages for CLI (#3070) ([2e89a4f](https://github.com/swc-project/swc/commit/2e89a4f5a8fda133a8d990ecfc0104e64075d15c))
121
+
122
+
123
+ - **(es/dep-graph)** Add `DependencyDescriptor::dynamic_import_assertions` (#3095) ([7d57eb2](https://github.com/swc-project/swc/commit/7d57eb2dc490b4dd7c24c35f4a4df9c13f267d56))
124
+
125
+
126
+ - **(es/lints)** Implement simple validations (#2763) ([f21af5b](https://github.com/swc-project/swc/commit/f21af5bcd600aa94f8bd99b1250524bbc823662c))
127
+
128
+
129
+ - **(es/preset-env)** Upgrade `browserslist-rs` (#3069) ([a1b315a](https://github.com/swc-project/swc/commit/a1b315a114d63aa06856de63d02070d471c271d0))
130
+
131
+
132
+ - **(es/preset-env)** Add ES2022 features to `preset-env` (#3072) ([7beaabd](https://github.com/swc-project/swc/commit/7beaabd533c9f5f368da8baa7365c7e1a30f9512))
133
+
134
+
135
+ - **(es/preset-env)** Add `.js` to generated imports (#3077) ([7d125f5](https://github.com/swc-project/swc/commit/7d125f5cdb0c078cb02958c6d168f9c993f3e830))
136
+
137
+
138
+ - **(node)** Report correct error when `swc_v1` and `swc_v2` is enabled at the same time (#3080) ([f1b8126](https://github.com/swc-project/swc/commit/f1b81266cf895dac28f68151b9c16eaa9401ec43))
139
+
140
+
141
+ - **(node/core)** Include noop swc binaries (#3088) ([42046e1](https://github.com/swc-project/swc/commit/42046e104dfa301a803f3dfd85da2801b0ebad66))
142
+
143
+ ### Miscellaneous Tasks
144
+
145
+
146
+
147
+ - **(node)** Publish v1.2.122 ([f4cc323](https://github.com/swc-project/swc/commit/f4cc323e08c73f10bd4cc323a81dd5d3778395df))
148
+
149
+
150
+ - **(repo)** Make `git` faster (#3075) ([8afb5af](https://github.com/swc-project/swc/commit/8afb5af517e87b85ae1bdd8156509850c53fa276))
151
+
152
+
153
+ - **(repo)** Add section for the actual behavior to the issue template (#3100) ([0472199](https://github.com/swc-project/swc/commit/047219932fd18e7e78131f44ab5fb3be0518dc04))
154
+
155
+
156
+ - **(scripts)** Use `cargo profile instruments` instead of `cargo instruments` (#3086) ([d482d61](https://github.com/swc-project/swc/commit/d482d61b9fd9997367d0dd27e3b90c662064ae3d))
157
+
158
+ ### Performance
159
+
160
+
161
+
162
+ - **(es/hygiene)** Fix performance bug (#3090) ([a81661c](https://github.com/swc-project/swc/commit/a81661c74a59376b15b1211385e95891102d2928))
163
+
164
+ ### Refactor
165
+
166
+
167
+
168
+ - **(es/minifier)** Use `swc_timer` (#3087) ([0e4dce6](https://github.com/swc-project/swc/commit/0e4dce694da75f6fb3848a2f0479410bf3076412))
169
+
170
+ ### Testing
171
+
172
+
173
+
174
+ - **(es/codegen)** Add some tests for sourcemap (#3078) ([0e58950](https://github.com/swc-project/swc/commit/0e5895043ffdc76857f798e0daabc05797ff22ac))
175
+
176
+ ## [1.2.121] - 2021-12-19
177
+
178
+ ### Bug Fixes
179
+
180
+
181
+
182
+ - **(es/compat)** Fix `block_scoping` (#3058) ([a381fb8](https://github.com/swc-project/swc/commit/a381fb8bce0ed82e7b0a201bb175acb13ce90205))
183
+
184
+
185
+ - **(es/compat)** Transform an optional eval call as an indirect eval call (#3068) ([ff1aab7](https://github.com/swc-project/swc/commit/ff1aab710c3593ca127032b41b419ecc1a4038d5))
186
+
187
+
188
+ - **(es/lexer)** Don't report lexer errors while backtracking (#3051) ([61e9b5f](https://github.com/swc-project/swc/commit/61e9b5f84115ded8c5361e6674d10e5826fd1635))
189
+
190
+
191
+ - **(es/lexer)** Fix lexing of numbers with large exponent (#3061) ([0c813ae](https://github.com/swc-project/swc/commit/0c813ae4530b34b4203ae844b470786c0305d268))
192
+
193
+
194
+ - **(es/loader)** Support fully-specified ESM import specifiers (#3050) ([d5c7fb8](https://github.com/swc-project/swc/commit/d5c7fb898fd0f92c51e04b09e8a77098dbd098ac))
195
+
196
+
197
+ - **(es/parser)** Allow assignment assertions in typescript classes (#3047) ([23a59db](https://github.com/swc-project/swc/commit/23a59db9bbbeee2ec8ccd3cdfe681e704480f97a))
198
+
199
+
200
+ - **(webpack/ast)** Fix `webpackAST` (#3040) ([15ea98b](https://github.com/swc-project/swc/commit/15ea98bf65c9993f07e226b1490bd31e81f09663))
201
+
202
+
203
+ - **(webpack/ast)** Handle typescript (#3045) ([24179bd](https://github.com/swc-project/swc/commit/24179bd9beeb8ac519186db4a71a6919852afa43))
204
+
205
+
206
+ - **(webpack/ast)** Expose fields of `AstOutput` (#3046) ([0892018](https://github.com/swc-project/swc/commit/08920189ba62cee4f836a417bffcef014e97becb))
207
+
208
+ ### Features
209
+
210
+
211
+
212
+ - **(es/parser)** Report an error for `export type * from "mod";` (#3064) ([f1a2832](https://github.com/swc-project/swc/commit/f1a28329cbfa6cdda275ca16615c82472bda5121))
213
+
214
+ ### Miscellaneous Tasks
215
+
216
+
217
+
218
+ - **(crates)** Use interactive bump ([276d74f](https://github.com/swc-project/swc/commit/276d74f2e9b508cd96e53c6798f28a7bb47afaed))
219
+
220
+
221
+ - **(node)** Publish v1.2.121 ([806c9db](https://github.com/swc-project/swc/commit/806c9db1a1c40e26402a08010ca74bc0f4221dab))
222
+
223
+ ### Performance
224
+
225
+
226
+
227
+ - **(es/compat)** Migrate `regenerator` to `VisitMut` (#3037) ([29eb71a](https://github.com/swc-project/swc/commit/29eb71aaf9b1154aba1a28c408aaa1a2bd7a8ec7))
228
+
229
+
230
+ - **(es/parser)** Improve performance (#3059) ([b4d95b4](https://github.com/swc-project/swc/commit/b4d95b44a7465941e58ec66a13c800e00409b188))
231
+
232
+ ### Refactor
233
+
234
+
235
+
236
+ - **(es/ast)** Change type or the `key` of `ClassProp` to `PropName` (#3038) ([38955c0](https://github.com/swc-project/swc/commit/38955c0c8d687866755e0d594871da449faf1da1))
237
+
238
+ ## [1.2.120] - 2021-12-13
239
+
240
+ ### Bug Fixes
241
+
242
+
243
+
8
244
  - **(css/parser)** Fix lexing of value starting with `-` (#3011) ([e0c8bbf](https://github.com/swc-project/swc/commit/e0c8bbf7a0b24f3fe36f04886346a4709b5e09d9))
9
245
 
10
246
 
File without changes
package/binding.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ export const bundle: any;
2
+ export const minify: any;
3
+ export const minifySync: any;
4
+ export const parse: any;
5
+ export const parseSync: any;
6
+ export const parseFileSync: any;
7
+ export const parseFile: any;
8
+ export const print: any;
9
+ export const printSync: any;
10
+ export const transform: any;
11
+ export const transformSync: any;
12
+ export const transformFile: any;
13
+ export const transformFileSync: any;
14
+ export const Compiler: any;
package/binding.js ADDED
@@ -0,0 +1,237 @@
1
+ "use strict";
2
+ const { existsSync, readFileSync } = require('fs');
3
+ const { join } = require('path');
4
+ const { platform, arch } = process;
5
+ let nativeBinding = null;
6
+ let localFileExisted = false;
7
+ let loadError = null;
8
+ const isMusl = () => {
9
+ try {
10
+ const isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl');
11
+ return isMusl;
12
+ }
13
+ catch (e) {
14
+ return false;
15
+ }
16
+ };
17
+ switch (platform) {
18
+ case 'android':
19
+ if (arch !== 'arm64') {
20
+ throw new Error(`Unsupported architecture on Android ${arch}`);
21
+ }
22
+ localFileExisted = existsSync(join(__dirname, 'swc.android-arm64.node'));
23
+ try {
24
+ if (localFileExisted) {
25
+ nativeBinding = require('./swc.android-arm64.node');
26
+ }
27
+ else {
28
+ nativeBinding = require('@swc/core-android-arm64');
29
+ }
30
+ }
31
+ catch (e) {
32
+ loadError = e;
33
+ }
34
+ break;
35
+ case 'win32':
36
+ switch (arch) {
37
+ case 'x64':
38
+ localFileExisted = existsSync(join(__dirname, 'swc.win32-x64-msvc.node'));
39
+ try {
40
+ if (localFileExisted) {
41
+ nativeBinding = require('./swc.win32-x64-msvc.node');
42
+ }
43
+ else {
44
+ nativeBinding = require('@swc/core-win32-x64-msvc');
45
+ }
46
+ }
47
+ catch (e) {
48
+ loadError = e;
49
+ }
50
+ break;
51
+ case 'ia32':
52
+ localFileExisted = existsSync(join(__dirname, 'swc.win32-ia32-msvc.node'));
53
+ try {
54
+ if (localFileExisted) {
55
+ nativeBinding = require('./swc.win32-ia32-msvc.node');
56
+ }
57
+ else {
58
+ nativeBinding = require('@swc/core-win32-ia32-msvc');
59
+ }
60
+ }
61
+ catch (e) {
62
+ loadError = e;
63
+ }
64
+ break;
65
+ case 'arm64':
66
+ localFileExisted = existsSync(join(__dirname, 'swc.win32-arm64-msvc.node'));
67
+ try {
68
+ if (localFileExisted) {
69
+ nativeBinding = require('./swc.win32-arm64-msvc.node');
70
+ }
71
+ else {
72
+ nativeBinding = require('@swc/core-win32-arm64-msvc');
73
+ }
74
+ }
75
+ catch (e) {
76
+ loadError = e;
77
+ }
78
+ break;
79
+ default:
80
+ throw new Error(`Unsupported architecture on Windows: ${arch}`);
81
+ }
82
+ break;
83
+ case 'darwin':
84
+ switch (arch) {
85
+ case 'x64':
86
+ localFileExisted = existsSync(join(__dirname, 'swc.darwin-x64.node'));
87
+ try {
88
+ if (localFileExisted) {
89
+ nativeBinding = require('./swc.darwin-x64.node');
90
+ }
91
+ else {
92
+ nativeBinding = require('@swc/core-darwin-x64');
93
+ }
94
+ }
95
+ catch (e) {
96
+ loadError = e;
97
+ }
98
+ break;
99
+ case 'arm64':
100
+ localFileExisted = existsSync(join(__dirname, 'swc.darwin-arm64.node'));
101
+ try {
102
+ if (localFileExisted) {
103
+ nativeBinding = require('./swc.darwin-arm64.node');
104
+ }
105
+ else {
106
+ nativeBinding = require('@swc/core-darwin-arm64');
107
+ }
108
+ }
109
+ catch (e) {
110
+ loadError = e;
111
+ }
112
+ break;
113
+ default:
114
+ throw new Error(`Unsupported architecture on macOS: ${arch}`);
115
+ }
116
+ break;
117
+ case 'freebsd':
118
+ if (arch !== 'x64') {
119
+ throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);
120
+ }
121
+ localFileExisted = existsSync(join(__dirname, 'swc.freebsd-x64.node'));
122
+ try {
123
+ if (localFileExisted) {
124
+ nativeBinding = require('./swc.freebsd-x64.node');
125
+ }
126
+ else {
127
+ nativeBinding = require('@swc/core-freebsd-x64');
128
+ }
129
+ }
130
+ catch (e) {
131
+ loadError = e;
132
+ }
133
+ break;
134
+ case 'linux':
135
+ switch (arch) {
136
+ case 'x64':
137
+ if (isMusl()) {
138
+ localFileExisted = existsSync(join(__dirname, 'swc.linux-x64-musl.node'));
139
+ try {
140
+ if (localFileExisted) {
141
+ nativeBinding = require('./swc.linux-x64-musl.node');
142
+ }
143
+ else {
144
+ nativeBinding = require('@swc/core-linux-x64-musl');
145
+ }
146
+ }
147
+ catch (e) {
148
+ loadError = e;
149
+ }
150
+ }
151
+ else {
152
+ localFileExisted = existsSync(join(__dirname, 'swc.linux-x64-gnu.node'));
153
+ try {
154
+ if (localFileExisted) {
155
+ nativeBinding = require('./swc.linux-x64-gnu.node');
156
+ }
157
+ else {
158
+ nativeBinding = require('@swc/core-linux-x64-gnu');
159
+ }
160
+ }
161
+ catch (e) {
162
+ loadError = e;
163
+ }
164
+ }
165
+ break;
166
+ case 'arm64':
167
+ if (isMusl()) {
168
+ localFileExisted = existsSync(join(__dirname, 'swc.linux-arm64-musl.node'));
169
+ try {
170
+ if (localFileExisted) {
171
+ nativeBinding = require('./swc.linux-arm64-musl.node');
172
+ }
173
+ else {
174
+ nativeBinding = require('@swc/core-linux-arm64-musl');
175
+ }
176
+ }
177
+ catch (e) {
178
+ loadError = e;
179
+ }
180
+ }
181
+ else {
182
+ localFileExisted = existsSync(join(__dirname, 'swc.linux-arm64-gnu.node'));
183
+ try {
184
+ if (localFileExisted) {
185
+ nativeBinding = require('./swc.linux-arm64-gnu.node');
186
+ }
187
+ else {
188
+ nativeBinding = require('@swc/core-linux-arm64-gnu');
189
+ }
190
+ }
191
+ catch (e) {
192
+ loadError = e;
193
+ }
194
+ }
195
+ break;
196
+ case 'arm':
197
+ localFileExisted = existsSync(join(__dirname, 'swc.linux-arm-gnueabihf.node'));
198
+ try {
199
+ if (localFileExisted) {
200
+ nativeBinding = require('./swc.linux-arm-gnueabihf.node');
201
+ }
202
+ else {
203
+ nativeBinding = require('@swc/core-linux-arm-gnueabihf');
204
+ }
205
+ }
206
+ catch (e) {
207
+ loadError = e;
208
+ }
209
+ break;
210
+ default:
211
+ throw new Error(`Unsupported architecture on Linux: ${arch}`);
212
+ }
213
+ break;
214
+ default:
215
+ throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);
216
+ }
217
+ if (!nativeBinding) {
218
+ if (loadError) {
219
+ throw loadError;
220
+ }
221
+ throw new Error(`Failed to load native binding`);
222
+ }
223
+ const { bundle, minify, minifySync, parse, parseSync, parseFileSync, parseFile, print, printSync, transform, transformSync, transformFile, transformFileSync, Compiler } = nativeBinding;
224
+ module.exports.bundle = bundle;
225
+ module.exports.minify = minify;
226
+ module.exports.minifySync = minifySync;
227
+ module.exports.parse = parse;
228
+ module.exports.parseSync = parseSync;
229
+ module.exports.parseFileSync = parseFileSync;
230
+ module.exports.parseFile = parseFile;
231
+ module.exports.print = print;
232
+ module.exports.printSync = printSync;
233
+ module.exports.transform = transform;
234
+ module.exports.transformSync = transformSync;
235
+ module.exports.transformFile = transformFile;
236
+ module.exports.transformFileSync = transformFileSync;
237
+ module.exports.Compiler = Compiler;
package/index.js CHANGED
@@ -34,10 +34,9 @@ exports.DEFAULT_EXTENSIONS = exports.minifySync = exports.minify = exports.bundl
34
34
  const path_1 = require("path");
35
35
  __exportStar(require("./types"), exports);
36
36
  const spack_1 = require("./spack");
37
- const helper_1 = require("@node-rs/helper");
38
37
  // Allow overrides to the location of the .node binding file
39
38
  const bindingsOverride = process.env["SWC_BINARY_PATH"];
40
- const bindings = !!bindingsOverride ? require(path_1.resolve(bindingsOverride)) : helper_1.loadBinding(__dirname, "swc", "@swc/core");
39
+ const bindings = !!bindingsOverride ? require((0, path_1.resolve)(bindingsOverride)) : require('./binding');
41
40
  /**
42
41
  * Version of the swc binding.
43
42
  */
@@ -169,7 +168,7 @@ class Compiler {
169
168
  }
170
169
  bundle(options) {
171
170
  return __awaiter(this, void 0, void 0, function* () {
172
- const opts = yield spack_1.compileBundleOptions(options);
171
+ const opts = yield (0, spack_1.compileBundleOptions)(options);
173
172
  if (Array.isArray(opts)) {
174
173
  const all = yield Promise.all(opts.map((opt) => __awaiter(this, void 0, void 0, function* () {
175
174
  return this.bundle(opt);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swc/core",
3
- "version": "1.2.120",
3
+ "version": "1.2.124",
4
4
  "description": "Super-fast alternative for babel",
5
5
  "homepage": "https://swc.rs",
6
6
  "main": "./index.js",
@@ -38,7 +38,8 @@
38
38
  "aarch64-apple-darwin",
39
39
  "aarch64-linux-android",
40
40
  "aarch64-unknown-linux-musl",
41
- "aarch64-pc-windows-msvc"
41
+ "aarch64-pc-windows-msvc",
42
+ "armv7-linux-androideabi"
42
43
  ]
43
44
  }
44
45
  },
@@ -50,18 +51,19 @@
50
51
  "@node-rs/helper": "^1.0.0"
51
52
  },
52
53
  "optionalDependencies": {
53
- "@swc/core-win32-x64-msvc": "^1.2.120",
54
- "@swc/core-darwin-x64": "^1.2.120",
55
- "@swc/core-linux-x64-gnu": "^1.2.120",
56
- "@swc/core-linux-x64-musl": "^1.2.120",
57
- "@swc/core-freebsd-x64": "^1.2.120",
58
- "@swc/core-win32-ia32-msvc": "^1.2.120",
59
- "@swc/core-linux-arm64-gnu": "^1.2.120",
60
- "@swc/core-linux-arm-gnueabihf": "^1.2.120",
61
- "@swc/core-darwin-arm64": "^1.2.120",
62
- "@swc/core-android-arm64": "^1.2.120",
63
- "@swc/core-linux-arm64-musl": "^1.2.120",
64
- "@swc/core-win32-arm64-msvc": "^1.2.120"
54
+ "@swc/core-win32-x64-msvc": "1.2.124",
55
+ "@swc/core-darwin-x64": "1.2.124",
56
+ "@swc/core-linux-x64-gnu": "1.2.124",
57
+ "@swc/core-linux-x64-musl": "1.2.124",
58
+ "@swc/core-freebsd-x64": "1.2.124",
59
+ "@swc/core-win32-ia32-msvc": "1.2.124",
60
+ "@swc/core-linux-arm64-gnu": "1.2.124",
61
+ "@swc/core-linux-arm-gnueabihf": "1.2.124",
62
+ "@swc/core-darwin-arm64": "1.2.124",
63
+ "@swc/core-android-arm64": "1.2.124",
64
+ "@swc/core-linux-arm64-musl": "1.2.124",
65
+ "@swc/core-win32-arm64-msvc": "1.2.124",
66
+ "@swc/core-android-arm-eabi": "1.2.124"
65
67
  },
66
68
  "types": "./index.d.ts",
67
69
  "scripts": {
@@ -69,13 +71,14 @@
69
71
  "prepare": "husky install && git config feature.manyFiles true",
70
72
  "artifacts": "napi artifacts --dist scripts/npm",
71
73
  "prepublishOnly": "tsc -d && napi prepublish -p scripts/npm --tagstyle npm",
72
- "build": "tsc -d && napi build --platform --release --cargo-name node --cargo-flags=\"-p node\"",
73
- "build:dev": "tsc -d && napi build --platform --cargo-name node --cargo-flags=\"-p node\"",
74
+ "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",
75
+ "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",
74
76
  "build:ts": "tsc -d",
75
77
  "test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest node-swc/__tests__",
76
78
  "version": "napi version -p scripts/npm"
77
79
  },
78
80
  "devDependencies": {
81
+ "@babel/compat-data": "^7.16.4",
79
82
  "@babel/core": "^7.13.16",
80
83
  "@babel/plugin-proposal-class-properties": "^7.13.0",
81
84
  "@babel/plugin-proposal-decorators": "^7.13.15",
@@ -84,7 +87,7 @@
84
87
  "@babel/preset-react": "^7.13.13",
85
88
  "@babel/preset-typescript": "^7.13.0",
86
89
  "@babel/types": "^7.14.0",
87
- "@napi-rs/cli": "^1.0.4",
90
+ "@napi-rs/cli": "^2.0.0",
88
91
  "@swc/helpers": "^0.2.10",
89
92
  "@types/jest": "^26.0.23",
90
93
  "@types/node": "^14.14.41",
@@ -111,7 +114,7 @@
111
114
  "source-map-support": "^0.5.19",
112
115
  "sourcemap-validator": "^2.1.0",
113
116
  "terser": "^5.7.1",
114
- "typescript": "^4.2.0-beta"
117
+ "typescript": "^4.5.2"
115
118
  },
116
119
  "funding": {
117
120
  "type": "opencollective",
package/types.d.ts CHANGED
@@ -325,8 +325,9 @@ export interface JscConfig {
325
325
  * Keep class names.
326
326
  */
327
327
  keepClassNames?: boolean;
328
- experimetal?: {
328
+ experimental?: {
329
329
  optimizeHygiene?: boolean;
330
+ keepImportAssertions?: boolean;
330
331
  };
331
332
  baseUrl?: string;
332
333
  paths?: {
package/.mocha.setup.js DELETED
@@ -1,3 +0,0 @@
1
- // Inject jest's assertion (expect) into global scope for the Mocha
2
- // to use same assertion between node-swc & rest.
3
- global.expect = require('expect');
package/.mocharc.js DELETED
@@ -1,12 +0,0 @@
1
- /**
2
- * https://github.com/swc-project/swc/pull/3009
3
- *
4
- * There are 2 test runners in this repo:
5
- * - jest is being used for unit testing node-swc packages with javascript test cases
6
- * - mocha is being used for cargo's test requires js runtime to validate its transform.
7
- *
8
- * This config is for the mocha test runner invoked by cargo to resolve its global setup file.
9
- */
10
- module.exports = {
11
- require: require.resolve('./.mocha.setup.js')
12
- };
package/LICENSE-MIT DELETED
@@ -1,25 +0,0 @@
1
- Copyright (c) 2017 The swc Project Developers
2
-
3
- Permission is hereby granted, free of charge, to any
4
- person obtaining a copy of this software and associated
5
- documentation files (the "Software"), to deal in the
6
- Software without restriction, including without
7
- limitation the rights to use, copy, modify, merge,
8
- publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software
10
- is furnished to do so, subject to the following
11
- conditions:
12
-
13
- The above copyright notice and this permission notice
14
- shall be included in all copies or substantial portions
15
- of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
18
- ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
- TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
20
- PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
21
- SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
24
- IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
- DEALINGS IN THE SOFTWARE.
package/cliff.toml DELETED
@@ -1,71 +0,0 @@
1
- # configuration file for git-cliff (0.1.0)
2
-
3
- [changelog]
4
- # changelog header
5
- header = """
6
- # Changelog
7
- """
8
- # template for the changelog body
9
- # https://tera.netlify.app/docs/#introduction
10
- body = """
11
- {% if version %}\
12
- ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
13
- {% else %}\
14
- ## [unreleased]
15
- {% endif %}\
16
- {% for group, commits in commits | group_by(attribute="group") %}
17
- ### {{ group | upper_first }}
18
- {% for commit in commits
19
- | filter(attribute="scope")
20
- | sort(attribute="scope") %}
21
- \n
22
- - **({{commit.scope}})** {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/swc-project/swc/commit/{{ commit.id }}))
23
- {%- if commit.breaking %}
24
- {% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
25
- {%- endif -%}
26
- {%- endfor -%}
27
- \n\n
28
- {%- for commit in commits %}
29
- {%- if commit.scope -%}
30
- {% else -%}
31
- \n
32
- - **general**: {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/swc-project/swc/commit/{{ commit.id }}))
33
- {%- if commit.breaking %}
34
- {% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
35
- {%- endif -%}
36
- {% endif -%}
37
- {% endfor -%}
38
- {% raw %}\n{% endraw %}\
39
- {% endfor %}\n
40
- """
41
- # remove the leading and trailing whitespaces from the template
42
- trim = true
43
- # changelog footer
44
- footer = """
45
- <!-- generated by git-cliff -->
46
- """
47
-
48
- [git]
49
- # allow only conventional commits
50
- # https://www.conventionalcommits.org
51
- conventional_commits = true
52
- filter_unconventional = false
53
- # regex for parsing and grouping commits
54
- commit_parsers = [
55
- {message = "^feat", group = "Features"},
56
- {message = "^fix", group = "Bug Fixes"},
57
- {message = "^doc", group = "Documentation"},
58
- {message = "^perf", group = "Performance"},
59
- {message = "^refactor", group = "Refactor"},
60
- {message = "^style", group = "Styling"},
61
- {message = "^test", group = "Testing"},
62
- {message = "^chore: Publish", skip = true},
63
- {message = "^chore", group = "Miscellaneous Tasks"},
64
- {body = ".*security", group = "Security"},
65
- ]
66
- # filter out the commits that are not matched by commit parsers
67
- filter_commits = false
68
- # glob pattern for matching git tags
69
- tag_pattern = "v[0-9]*"
70
- # regex for skipping tags
71
- skip_tags = "v0.1.0-beta.1"
package/jest.config.js DELETED
@@ -1,11 +0,0 @@
1
- module.exports = {
2
- testMatch: ["**/__tests__/**/*.[jt]s?(x)", "**/__tests__/**/*.m[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"],
3
- transform: {
4
- },
5
- // transform: {
6
- // "^.+\\.jsx?$": "babel-jest",
7
- // "^.+\\.mjs$": "babel-jest",
8
- // },
9
- testPathIgnorePatterns: ["<rootDir>/build/", "<rootDir>/node_modules/"],
10
- moduleFileExtensions: ["js", "jsx", "mjs"]
11
- }