@swc/core 1.2.122 → 1.2.126
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 +194 -0
- package/binding.d.ts +14 -0
- package/binding.js +237 -0
- package/index.js +2 -3
- package/package.json +20 -18
- package/types.d.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,194 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
- **(es/minifier)** Fix comparison of objects, numbers and strings (#3172) ([db51ce4](https://github.com/swc-project/swc/commit/db51ce44614e3661c9c25c562d39b7581e521850))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
- **(node-swc)** Recover from ldd not found ([1dfc2ee](https://github.com/swc-project/swc/commit/1dfc2ee1054d20b0d04699ebef3ab09b2f6fc4f8))
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
- **(es/ast)** Add `ModuleExportName` (#3048) ([07c0489](https://github.com/swc-project/swc/commit/07c0489575188846b82b1af3e4bd711466e006ca))
|
|
18
|
+
|
|
19
|
+
## [1.2.125] - 2022-01-02
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
- **(es/compat)** Visit all private class methods (#3150) ([35b6461](https://github.com/swc-project/swc/commit/35b64613bb1f6de52d7362e66d28c50513dbbe12))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
- **(es/compat)** Fix length of async functions (#3136) ([f78d005](https://github.com/swc-project/swc/commit/f78d005a9587d2ea44741c4cef80fa711e8a1d26))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
- **(es/compat)** Fix `new.target` in class properties (#3156) ([e112103](https://github.com/swc-project/swc/commit/e11210309cf2aab4aae77a76e4cdfba0bf9efa40))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
- **(es/minifier)** Fix for modules (#3170) ([790c506](https://github.com/swc-project/swc/commit/790c50631ba1daa124e62bcee299f89031a4ec3d))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
- **(es/typescript)** Fix handling of references in a TypeScript enum (#3163) ([e02307d](https://github.com/swc-project/swc/commit/e02307d4c82e043079131b414198ee5b4b7560e5))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
- **(es/typescript)** Declare the exported variables in a namespace (#3162) ([366dc0e](https://github.com/swc-project/swc/commit/366dc0eec3e19b4e608dc4df8eb728f6d710f9b7))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
- **(es/utils)** Fix handling of `new.target` (#3145) ([356082a](https://github.com/swc-project/swc/commit/356082ad84fa69cf09b5627598a2576bd1b27c36))
|
|
44
|
+
|
|
45
|
+
### Documentation
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
- **(es/ast)** Improve rustdoc (#3142) ([333acb5](https://github.com/swc-project/swc/commit/333acb56223139817c1df0c8b3763190b55a6295))- **general**: Update discord link (#3161) ([fb20480](https://github.com/swc-project/swc/commit/fb2048035f0aa67761aa213c58795accfde7a6d0))
|
|
50
|
+
|
|
51
|
+
### Features
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
- **(es/ast)** Add `rkyv` support (#3166) ([bf751cb](https://github.com/swc-project/swc/commit/bf751cb6905c7520f0846b9f0a6f4f44edecbdb3))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
- **(es/codegen)** Make the output for empty objects and empty statements pretty (#3171) ([5296180](https://github.com/swc-project/swc/commit/52961804d19c413c09ff4e08c327647ffc3d0bea))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
- **(es/diff)** Add a internal CLI program for debugging minifier (#3168) ([1aa55e6](https://github.com/swc-project/swc/commit/1aa55e616a7bc2ffa791600e908ddb10a4009e7b))
|
|
62
|
+
|
|
63
|
+
### Miscellaneous Tasks
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
- **(ci)** Update `github-action-benchmark` (#3148) ([5a3bdc9](https://github.com/swc-project/swc/commit/5a3bdc9ed37ba39a0591c66bd89eddb95f6df850))- **general**: Add `enhancement` label to `feature_request` template (#3164) ([360ad7b](https://github.com/swc-project/swc/commit/360ad7b41c6fa35ce3afc81c2237d9acdae9a549))
|
|
68
|
+
|
|
69
|
+
### Performance
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
- **(es/ast/serde)** Make deserialization faster (#3160) ([7a83c0c](https://github.com/swc-project/swc/commit/7a83c0cb575b0ec6510d8dff6d1bd44d9c97fdb9))
|
|
74
|
+
|
|
75
|
+
### Refactor
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
- **(*)** Drop unused dependencies (#3138) ([72c9636](https://github.com/swc-project/swc/commit/72c963662d63338235378d71ee856c782cdeddfe))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
- **(*)** Use 2021 edition (#3151) ([194b3e9](https://github.com/swc-project/swc/commit/194b3e9b67fb096dee8dbd12fff9167e4217174b))
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
- **(bundler)** Improve test suite (#3144) ([8a1016f](https://github.com/swc-project/swc/commit/8a1016fb406dd04dcf432ccf4e07036f81d4c9c6))
|
|
86
|
+
|
|
87
|
+
### Testing
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
- **(es/parser)** Add tests about null escape (#3147) ([a4e8e53](https://github.com/swc-project/swc/commit/a4e8e53c1958f842206916eade24a269d582d69c))
|
|
92
|
+
|
|
93
|
+
## [1.2.124] - 2021-12-29
|
|
94
|
+
|
|
95
|
+
### Bug Fixes
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
- **(es)** Handle import assertions correctly (#3113) ([c9adf03](https://github.com/swc-project/swc/commit/c9adf0333811b2830fe3f3c06d6fd9706f7bb9ae))
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
- **(es/compat)** Fix handling of hoisted functions in regenerator (#3119) ([ac78a52](https://github.com/swc-project/swc/commit/ac78a527ebba3e8df2342e65b4fd5c2d36240ff0))
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
- **(es/compat)** Fix private methods of a class (#3123) ([1b6ac25](https://github.com/swc-project/swc/commit/1b6ac25d5c6c009c38a7097b910f7b6838ab560b))
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
- **(es/compat)** Fix `computed_properties` (#3120) ([27d3fd9](https://github.com/swc-project/swc/commit/27d3fd93b0ad2b5e305ded8145100b060ac6c2a3))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
- **(es/optimization)** Fix inlining (#3132) ([693c22a](https://github.com/swc-project/swc/commit/693c22aa93ce115aca294f61feefe4582336ada3))
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
- **(es/parser)** Support import assertions in specifier-less imports (#3134) ([2f3ca22](https://github.com/swc-project/swc/commit/2f3ca22ecf7f567256695c39a904f02ff75e2c85))
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
- **(es/renamer)** Fix renamer (#3139) ([43c8cda](https://github.com/swc-project/swc/commit/43c8cda31a89bfc027ea3948bd9653d97d3fc29c))
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
- **(es/utils)** Fix `is_valid_ident` (#3133) ([ec7e0ae](https://github.com/swc-project/swc/commit/ec7e0aee256cc7cc13f81ef22164c29f42bb43be))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
- **(node-swc)** Recover from `ldd` not found (#3125) ([054a195](https://github.com/swc-project/swc/commit/054a19518ce77f36520a17e146c65632aeab3080))
|
|
124
|
+
|
|
125
|
+
### Features
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
- **(es/preset-env)** Upgrade `browserslist-rs` (#3122) ([83f71c2](https://github.com/swc-project/swc/commit/83f71c2c0b8382e70172b1e2d4d9a18852e7a995))
|
|
130
|
+
|
|
131
|
+
### Miscellaneous Tasks
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
- **(ci)** Reduce CI time (#3128) ([61cd7da](https://github.com/swc-project/swc/commit/61cd7da265bd775605a0e48346f70b41adf9a225))
|
|
136
|
+
|
|
137
|
+
### Refactor
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
- **(es/react/fast-refresh)** Use `VisitMut` (#3129) ([f8f04e0](https://github.com/swc-project/swc/commit/f8f04e031e218393abd8ae5ca6469484b0fe90d3))
|
|
142
|
+
|
|
143
|
+
### Security
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
- **(repo)** Configure `cargo-crev` (#3124) ([cec325b](https://github.com/swc-project/swc/commit/cec325be6329bbdc175d7850443de8aabfcf31d6))
|
|
148
|
+
|
|
149
|
+
## [1.2.123] - 2021-12-26
|
|
150
|
+
|
|
151
|
+
### Bug Fixes
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
- **(es/ast)** Fix `Ident::verify_symbol` (#3108) ([e5971f7](https://github.com/swc-project/swc/commit/e5971f77d5861038f7dcd905a9aca72c84b1a035))
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
- **(es/compat)** Fix `classes` pass (#3107) ([d923f89](https://github.com/swc-project/swc/commit/d923f89db19b4343034569595dc3bbbce29b86b0))
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
- **(es/compat)** Fix `destructuring` (#3104) ([9f5a8f7](https://github.com/swc-project/swc/commit/9f5a8f728ade23640430d82f9f4bbcb341e30e2a))
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
- **(es/compat)** Fix handling of class methods with a big int as a key (#3118) ([a1cb4a4](https://github.com/swc-project/swc/commit/a1cb4a4aa57bd54e6718f293a65361952f4ef11d))
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
- **(es/helpers)** Fix decorators (#3105) ([f66c2cd](https://github.com/swc-project/swc/commit/f66c2cd375f78711fdf6a058003010bce8999aed))
|
|
168
|
+
|
|
169
|
+
### Features
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
- **(es/bundler)** Add an option to disable tree-shaking (#3102) ([d98a593](https://github.com/swc-project/swc/commit/d98a59339a0fa2a14f2bcb92c6deeb810ec339be))
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
- **(es/diff)** Initialize a diff tool for ecmascript (#3101) ([ff0b55b](https://github.com/swc-project/swc/commit/ff0b55b7782cfa9c428d88d366520b53307bca42))
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
- **(node)** Upgrade `napi` to v2 (#2958) ([206da12](https://github.com/swc-project/swc/commit/206da128a1f1ecd43c7580a7ad5f58ebc363c812))
|
|
180
|
+
|
|
181
|
+
### Miscellaneous Tasks
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
- **(ci)** Fix script for publishing ([f51314c](https://github.com/swc-project/swc/commit/f51314cd51990b2caf8b18a7d8a647236a0ec893))
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
- **(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))
|
|
189
|
+
|
|
190
|
+
## [1.2.122] - 2021-12-22
|
|
191
|
+
|
|
192
|
+
### Bug Fixes
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
8
196
|
- **(es/compat)** Fix handling of union of the legacy decorator pass (#3057) ([938e544](https://github.com/swc-project/swc/commit/938e544ac55503e91811cfc4e0c333deb2ccc7ed))
|
|
9
197
|
|
|
10
198
|
|
|
@@ -50,9 +238,15 @@
|
|
|
50
238
|
|
|
51
239
|
|
|
52
240
|
|
|
241
|
+
- **(node)** Publish v1.2.122 ([f4cc323](https://github.com/swc-project/swc/commit/f4cc323e08c73f10bd4cc323a81dd5d3778395df))
|
|
242
|
+
|
|
243
|
+
|
|
53
244
|
- **(repo)** Make `git` faster (#3075) ([8afb5af](https://github.com/swc-project/swc/commit/8afb5af517e87b85ae1bdd8156509850c53fa276))
|
|
54
245
|
|
|
55
246
|
|
|
247
|
+
- **(repo)** Add section for the actual behavior to the issue template (#3100) ([0472199](https://github.com/swc-project/swc/commit/047219932fd18e7e78131f44ab5fb3be0518dc04))
|
|
248
|
+
|
|
249
|
+
|
|
56
250
|
- **(scripts)** Use `cargo profile instruments` instead of `cargo instruments` (#3086) ([d482d61](https://github.com/swc-project/swc/commit/d482d61b9fd9997367d0dd27e3b90c662064ae3d))
|
|
57
251
|
|
|
58
252
|
### Performance
|
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)) :
|
|
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.
|
|
3
|
+
"version": "1.2.126",
|
|
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": "
|
|
54
|
-
"@swc/core-darwin-x64": "
|
|
55
|
-
"@swc/core-linux-x64-gnu": "
|
|
56
|
-
"@swc/core-linux-x64-musl": "
|
|
57
|
-
"@swc/core-freebsd-x64": "
|
|
58
|
-
"@swc/core-win32-ia32-msvc": "
|
|
59
|
-
"@swc/core-linux-arm64-gnu": "
|
|
60
|
-
"@swc/core-linux-arm-gnueabihf": "
|
|
61
|
-
"@swc/core-darwin-arm64": "
|
|
62
|
-
"@swc/core-android-arm64": "
|
|
63
|
-
"@swc/core-linux-arm64-musl": "
|
|
64
|
-
"@swc/core-win32-arm64-msvc": "
|
|
54
|
+
"@swc/core-win32-x64-msvc": "1.2.126",
|
|
55
|
+
"@swc/core-darwin-x64": "1.2.126",
|
|
56
|
+
"@swc/core-linux-x64-gnu": "1.2.126",
|
|
57
|
+
"@swc/core-linux-x64-musl": "1.2.126",
|
|
58
|
+
"@swc/core-freebsd-x64": "1.2.126",
|
|
59
|
+
"@swc/core-win32-ia32-msvc": "1.2.126",
|
|
60
|
+
"@swc/core-linux-arm64-gnu": "1.2.126",
|
|
61
|
+
"@swc/core-linux-arm-gnueabihf": "1.2.126",
|
|
62
|
+
"@swc/core-darwin-arm64": "1.2.126",
|
|
63
|
+
"@swc/core-android-arm64": "1.2.126",
|
|
64
|
+
"@swc/core-linux-arm64-musl": "1.2.126",
|
|
65
|
+
"@swc/core-win32-arm64-msvc": "1.2.126",
|
|
66
|
+
"@swc/core-android-arm-eabi": "1.2.126"
|
|
65
67
|
},
|
|
66
68
|
"types": "./index.d.ts",
|
|
67
69
|
"scripts": {
|
|
@@ -69,8 +71,8 @@
|
|
|
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 --
|
|
73
|
-
"build:dev": "tsc -d && napi build --platform --cargo-name 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"
|
|
@@ -85,7 +87,7 @@
|
|
|
85
87
|
"@babel/preset-react": "^7.13.13",
|
|
86
88
|
"@babel/preset-typescript": "^7.13.0",
|
|
87
89
|
"@babel/types": "^7.14.0",
|
|
88
|
-
"@napi-rs/cli": "^
|
|
90
|
+
"@napi-rs/cli": "^2.0.0",
|
|
89
91
|
"@swc/helpers": "^0.2.10",
|
|
90
92
|
"@types/jest": "^26.0.23",
|
|
91
93
|
"@types/node": "^14.14.41",
|
|
@@ -112,7 +114,7 @@
|
|
|
112
114
|
"source-map-support": "^0.5.19",
|
|
113
115
|
"sourcemap-validator": "^2.1.0",
|
|
114
116
|
"terser": "^5.7.1",
|
|
115
|
-
"typescript": "^4.2
|
|
117
|
+
"typescript": "^4.5.2"
|
|
116
118
|
},
|
|
117
119
|
"funding": {
|
|
118
120
|
"type": "opencollective",
|
package/types.d.ts
CHANGED