@swc/core 1.2.218 → 1.2.219
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 +128 -26
- package/index.d.ts +1 -0
- package/index.js +49 -27
- package/package.json +15 -14
- package/postinstall.js +5 -1
- package/spack.js +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,119 +1,200 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
-
## [
|
|
2
|
+
## [1.2.219] - 2022-07-27
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
- **(
|
|
8
|
+
- **(css)** Fix parsing of `layer` (#5290) ([83651c2](https://github.com/swc-project/swc/commit/83651c297d4e6b03809b96a87ce1c59f158e28ff))
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
- **(
|
|
11
|
+
- **(css/prefixer)** Generate at-rules based on preset-env (#5294) ([94b4e0a](https://github.com/swc-project/swc/commit/94b4e0a3213e7cd0982eebe2d1b65ac5f10af2f2))
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
- **(es/
|
|
14
|
+
- **(es/codegen)** Add `;` for a generator function (#5292) ([daac26b](https://github.com/swc-project/swc/commit/daac26bcfbc48a732d4b1b831a0f54518401f63b))
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
- **(es/
|
|
17
|
+
- **(es/codegen)** Fix sourcemap of multiline comments (#5299) ([3100bf8](https://github.com/swc-project/swc/commit/3100bf8c6220640006c3238e69f0f5fbd8fce738))
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
- **(es/
|
|
20
|
+
- **(es/compat)** Preserve orders of `import`s and `export`s (#5249) ([2010409](https://github.com/swc-project/swc/commit/2010409bac0f73c5f4d04f6735db6142f621701a))
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
- **(
|
|
23
|
+
- **(es/compat)** Fix capturing of block scoping pass (#5279) ([b423d6f](https://github.com/swc-project/swc/commit/b423d6f936eb1bdc66b2223fe9189a7dcc8ae1d8))
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
- **(
|
|
26
|
+
- **(es/decorators)** Use decorated consturctors (#5263) ([d9877e3](https://github.com/swc-project/swc/commit/d9877e305a3989e88b696135cb7cf16fc63e940f))
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
- **(
|
|
29
|
+
- **(es/fixer)** Wrap `await` and `yield` in callee (#5314) ([b3269fd](https://github.com/swc-project/swc/commit/b3269fda8e8614cc7faaebae0edc2bbb05b7fb0e))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
- **(es/minifier)** Preserve order of side-effects in sequences pass (#5283) ([ee84842](https://github.com/swc-project/swc/commit/ee84842d226df4905fd7edae41bfa8f7d4b48bfb))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
- **(es/modules)** Use a private context for `export from` (#5262) ([c0ace4c](https://github.com/swc-project/swc/commit/c0ace4cb2c63b81dc08e35d6a59f9a9bcd961985))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
- **(es/preset-env)** Realign with `babel-polyfills` (#5293) ([dd0a152](https://github.com/swc-project/swc/commit/dd0a152f49da3acab06dece8eb7982c56e4c23b0))
|
|
30
39
|
|
|
31
|
-
|
|
40
|
+
|
|
41
|
+
- **(es/preset-env)** Don't add instance properties when there's a static property (#5305) ([06677c2](https://github.com/swc-project/swc/commit/06677c26eed5a2320541522b3587e0b81e7ef0e9))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
- **(es/visit)** Disable `serde` by default (#5273) ([a0007e1](https://github.com/swc-project/swc/commit/a0007e11c393dd72bd5a056e7261422a96adc106))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
- **(html/minifier)** Don't break unknown attributes (#5256) ([4f55459](https://github.com/swc-project/swc/commit/4f55459b013eeee8374ee9587e7d7c71d16262ec))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
- **(html/parser)** Fix span (#5312) ([c80b9e1](https://github.com/swc-project/swc/commit/c80b9e106a432a858e40817069862b9a8f235ad3))
|
|
51
|
+
|
|
52
|
+
### Documentation
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
- **(ast_node)** Remove an unnecessary comment (#5304) ([8896dd9](https://github.com/swc-project/swc/commit/8896dd9a66686ddb84a444480f395dcd75a92cba))
|
|
32
57
|
|
|
33
58
|
### Features
|
|
34
59
|
|
|
35
60
|
|
|
36
61
|
|
|
37
|
-
- **(css/
|
|
62
|
+
- **(css/minifier)** Remove duplicate selectors (#5257) ([ce34746](https://github.com/swc-project/swc/commit/ce347461ee4cb14ef0f099abb6a8831c929f958a))
|
|
38
63
|
|
|
39
64
|
|
|
40
|
-
- **(
|
|
65
|
+
- **(css/prefixer)** Implement `preset-env` (#5247) ([e78d23d](https://github.com/swc-project/swc/commit/e78d23d193585bb088f71602a33340d0a1ed1601))
|
|
41
66
|
|
|
42
67
|
|
|
43
|
-
- **(
|
|
68
|
+
- **(es/codegen)** Optimize number and bigint literal (#5223) ([3f0856d](https://github.com/swc-project/swc/commit/3f0856db2ef7dde001cd482088a094f49de7ddac))
|
|
44
69
|
|
|
45
70
|
|
|
46
|
-
- **(
|
|
71
|
+
- **(es/codegen)** Remove extra space before a private method (#5295) ([0f254d5](https://github.com/swc-project/swc/commit/0f254d5ce5c23fa3ec06c074aa1b8acc5d1dbddf))
|
|
47
72
|
|
|
48
73
|
|
|
49
|
-
- **(
|
|
74
|
+
- **(es/minifier)** Calculate correct size (#5253) ([6573324](https://github.com/swc-project/swc/commit/6573324d9c59000c81ae35ad615b0b7428bc75f9))
|
|
50
75
|
|
|
51
76
|
|
|
52
|
-
- **(
|
|
77
|
+
- **(es/plugin)** Add experimental metadata field (#5254) ([bd1c2cc](https://github.com/swc-project/swc/commit/bd1c2cc7e6dcc04c3d8b59f34b4b88be29ec1ccb))
|
|
53
78
|
|
|
54
79
|
|
|
55
|
-
- **(
|
|
80
|
+
- **(es/plugin)** Pass experimental metadata from host (#5261) ([43eeeb3](https://github.com/swc-project/swc/commit/43eeeb35a5ec2a368c3cd215abaff1e1f7fa5a1d))
|
|
56
81
|
|
|
57
82
|
|
|
58
|
-
- **(
|
|
83
|
+
- **(node)** Coerce fallback bindings (#5250) ([7e6ffff](https://github.com/swc-project/swc/commit/7e6ffffbd3834f220e940d447bf1632f70f3b9a7))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
- **(plugin)** Make metadata api lazy (#5310) ([5a164bd](https://github.com/swc-project/swc/commit/5a164bd13741d3871170cefe4778b615640d169d))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
- **(testing/macros)** Generalize test names with regex (#5242) ([ecbf9d6](https://github.com/swc-project/swc/commit/ecbf9d6c36b4f86945a66deb8a7d90d7ae01dc3d))
|
|
59
90
|
|
|
60
91
|
### Miscellaneous Tasks
|
|
61
92
|
|
|
62
93
|
|
|
63
94
|
|
|
64
|
-
- **(ci)**
|
|
95
|
+
- **(ci)** Update macos runner (#5284) ([e8473eb](https://github.com/swc-project/swc/commit/e8473eb8a8d3bebea157d0e06a56d95b2350872c))
|
|
65
96
|
|
|
66
97
|
|
|
67
|
-
- **(
|
|
98
|
+
- **(deps)** Update `bytecheck` (#5296) ([35b1e78](https://github.com/swc-project/swc/commit/35b1e7817974b0e1d7a5af1f9314444fe4070585))- **general**: Fix CI (#5251) ([d229917](https://github.com/swc-project/swc/commit/d229917588a7bfda8bf4023c42c4190552a3b0c6))- **general**: Fix CI ([3421064](https://github.com/swc-project/swc/commit/34210648b06c4e4e4bd7d368a1b9d203535bbc30))
|
|
68
99
|
|
|
69
|
-
###
|
|
100
|
+
### Performance
|
|
70
101
|
|
|
71
102
|
|
|
72
103
|
|
|
73
|
-
- **(
|
|
104
|
+
- **(es/ast)** Use `Atom` in some places (#5271) ([037a53d](https://github.com/swc-project/swc/commit/037a53d5d1ff19514e6f5941fef1ed4b7fe57c31))
|
|
74
105
|
|
|
106
|
+
### Testing
|
|
75
107
|
|
|
76
|
-
- **(es/plugin)** Build plugins for e2e testing (#5210) ([cd94f0a](https://github.com/swc-project/swc/commit/cd94f0a2e9a7331073d20638031ae86d3308760e))
|
|
77
108
|
|
|
78
109
|
|
|
79
|
-
- **(plugin)**
|
|
110
|
+
- **(es/plugin)** Test plugins with different schema versions (#5255) ([b7c7e3a](https://github.com/swc-project/swc/commit/b7c7e3afb069da6804aafc67f5207da11ad36c17))
|
|
80
111
|
|
|
81
112
|
### Build
|
|
82
113
|
|
|
83
114
|
|
|
84
115
|
|
|
85
|
-
- **(
|
|
116
|
+
- **(cargo)** Align dependency versions (#5248) ([0d91741](https://github.com/swc-project/swc/commit/0d91741eb9dc9e2d3ae23f555e3b35c9c448cfc6))
|
|
86
117
|
|
|
87
|
-
## [1.2.
|
|
118
|
+
## [1.2.218] - 2022-07-18
|
|
88
119
|
|
|
89
120
|
### Bug Fixes
|
|
90
121
|
|
|
91
122
|
|
|
92
123
|
|
|
124
|
+
- **(cli)** Emit sourcemap with file inputs (#5213) ([3e3be80](https://github.com/swc-project/swc/commit/3e3be80efda09ae494f8962947562b4411874061))
|
|
125
|
+
|
|
126
|
+
|
|
93
127
|
- **(es)** Check the syntax context of `arguments` (#5174) ([375774d](https://github.com/swc-project/swc/commit/375774d31e690142faeb8422fed4cc996bf1de16))
|
|
94
128
|
|
|
95
129
|
|
|
130
|
+
- **(es)** Fix resolving of symlinks (#5222) ([27cc45d](https://github.com/swc-project/swc/commit/27cc45d50fa035fbb7bbab307752ec55c8d5ed0c))
|
|
131
|
+
|
|
132
|
+
|
|
96
133
|
- **(es/codegen)** Mark bigint as an item starting with number (#5207) ([387d5e4](https://github.com/swc-project/swc/commit/387d5e41db260893297b65d0fd9084f60c71443a))
|
|
97
134
|
|
|
98
135
|
|
|
99
136
|
- **(es/fixer)** Handle invalid numeric literals (#5201) ([436f620](https://github.com/swc-project/swc/commit/436f6200bc05d1d88c9b3fb991f793ed308f607b))
|
|
100
137
|
|
|
101
138
|
|
|
139
|
+
- **(es/lints)** Disallow duplicate export functions (#5234) ([c68d484](https://github.com/swc-project/swc/commit/c68d484305d3dfac3e14e45682c9d5ec10b49a45))
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
- **(es/minifier)** Fix size calculation of numbers (#5232) ([2e9c9be](https://github.com/swc-project/swc/commit/2e9c9bea1ad5c95a1e4867eba2f9bbe53c466fc7))
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
- **(es/modules)** Preserve order for ts import equals (#5215) ([6b1ce09](https://github.com/swc-project/swc/commit/6b1ce09b6f59e53a750a71e447a148aedcef8468))
|
|
146
|
+
|
|
147
|
+
|
|
102
148
|
- **(es/parser)** Fix parsing of export specifiers (#5190) ([ec93783](https://github.com/swc-project/swc/commit/ec9378370dd870c304143219afed04624075141f))
|
|
103
149
|
|
|
150
|
+
|
|
151
|
+
- **(html/parser)** Fix span (#5209) ([b4daa30](https://github.com/swc-project/swc/commit/b4daa3005803be23676bec666bb8f8791f2472b3))
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
- **(html/parser)** Improve span (#5230) ([0f7646c](https://github.com/swc-project/swc/commit/0f7646cc4763f2d79d0b3cb4529a0c7ec7df94e8))
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
- **(testing)** Allow space in file names (#5237) ([de76868](https://github.com/swc-project/swc/commit/de76868cad88b9afe103a60331c1456a3f02e37e))- **general**: Fix(es/lints: Handle ts export import equals (#5225)
|
|
158
|
+
|
|
159
|
+
([04de455](https://github.com/swc-project/swc/commit/04de455a9a34dbcbb193bffc9ab504c0e30e8706))
|
|
160
|
+
|
|
104
161
|
### Features
|
|
105
162
|
|
|
106
163
|
|
|
107
164
|
|
|
165
|
+
- **(css/ast)** Make `raw` optional (#5211) ([b65a16c](https://github.com/swc-project/swc/commit/b65a16c7aa58bca57ad861ca015867f89fb80a79))
|
|
166
|
+
|
|
167
|
+
|
|
108
168
|
- **(es)** Add quote to `swc_ecmascript` (#5199) ([fbfa59b](https://github.com/swc-project/swc/commit/fbfa59b5b78ed76350be246eecba86f8fe8b4234))
|
|
109
169
|
|
|
110
170
|
|
|
171
|
+
- **(es/lints)** Support `ignoreReadBeforeAssign` for `prefer-const` (#4933) ([d035648](https://github.com/swc-project/swc/commit/d0356489cb1dfae8e6ced8dd239643bf6f5b029d))
|
|
172
|
+
|
|
173
|
+
|
|
111
174
|
- **(es/plugin)** Print filename on failure (#5200) ([f69dee7](https://github.com/swc-project/swc/commit/f69dee75f208a6385b64fa79147eef57bd24944e))
|
|
112
175
|
|
|
113
176
|
|
|
177
|
+
- **(html/ast)** Add `raw` to attributes (#5208) ([64237fa](https://github.com/swc-project/swc/commit/64237fa7fb9c95030f92892143f476c2573bed75))
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
- **(html/ast)** Add `raw` to doctype (#5198) ([945510a](https://github.com/swc-project/swc/commit/945510a6954db87f78dcffa888f49b630f4eb74d))
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
- **(html/minifier)** Compress more default attributes (#5182) ([625fc18](https://github.com/swc-project/swc/commit/625fc18da01643d81af535eefd4c636e5a632af0))
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
- **(html/minifier)** Improve minifier (#5227) ([1da6016](https://github.com/swc-project/swc/commit/1da6016da7db783a4207cfff480b057ea911006c))
|
|
187
|
+
|
|
188
|
+
|
|
114
189
|
- **(html/parser)** Add `raw` to comments (#5196) ([dead719](https://github.com/swc-project/swc/commit/dead719550b1ac3024e07f77905ce7b064f102c4))
|
|
115
190
|
|
|
116
191
|
|
|
192
|
+
- **(node)** Use wasm as a fallback (#5233) ([1cebf62](https://github.com/swc-project/swc/commit/1cebf626e66b52f0fe325f679443d8243ab9eba3))
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
- **(plugin)** Pass `unresolved_mark` to plugins (#5212) ([92c0153](https://github.com/swc-project/swc/commit/92c0153cb56a6b3b7d6503216a14d5ed78df71dc))
|
|
196
|
+
|
|
197
|
+
|
|
117
198
|
- **(quote)** Support different types for variables (#5194) ([c91abb2](https://github.com/swc-project/swc/commit/c91abb2ca75ff98e8fad7a4740b6feccec62cd54))
|
|
118
199
|
|
|
119
200
|
### Miscellaneous Tasks
|
|
@@ -128,6 +209,12 @@
|
|
|
128
209
|
|
|
129
210
|
- **(ci)** Disable some tests ([ff949b0](https://github.com/swc-project/swc/commit/ff949b0bc7df790a6d1df11f2129d589b0dd46b8))
|
|
130
211
|
|
|
212
|
+
|
|
213
|
+
- **(ci)** Fix publish script (#5241) ([66550d6](https://github.com/swc-project/swc/commit/66550d6e87582bb3cb34d18c0dffd8f33814d81d))
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
- **(visit)** Specify version of `swc_macros_common` (#5231) ([1aa0223](https://github.com/swc-project/swc/commit/1aa022361e7918f4077eacae6e51899eac007be5))- **general**: Typo (#5239) ([17f1cee](https://github.com/swc-project/swc/commit/17f1cee0a8132c79712c742f645e098df9309999))- **general**: Typo (#5238) ([df426d7](https://github.com/swc-project/swc/commit/df426d7b1d2ca74505051bfe78aa78a2a315e0ab))
|
|
217
|
+
|
|
131
218
|
### Testing
|
|
132
219
|
|
|
133
220
|
|
|
@@ -135,8 +222,23 @@
|
|
|
135
222
|
- **(css/codegen)** Add tests (#5195) ([fa4c2de](https://github.com/swc-project/swc/commit/fa4c2de7064a213eb70cc7712b50d4a41d2bfdfe))
|
|
136
223
|
|
|
137
224
|
|
|
225
|
+
- **(css/parser)** Add a test (#5228) ([8e5efb6](https://github.com/swc-project/swc/commit/8e5efb65d55706883663a25a0e281a4ef013001b))
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
- **(es/plugin)** Build plugins for e2e testing (#5210) ([cd94f0a](https://github.com/swc-project/swc/commit/cd94f0a2e9a7331073d20638031ae86d3308760e))
|
|
229
|
+
|
|
230
|
+
|
|
138
231
|
- **(plugin)** Setup e2e fixture testing for plugins (#5192) ([2fa51ec](https://github.com/swc-project/swc/commit/2fa51ecd7819b460837467d2a9093730671dd3fc))
|
|
139
232
|
|
|
233
|
+
|
|
234
|
+
- **(plugin)** Fix e2e tests on windows (#5216) ([f1ba332](https://github.com/swc-project/swc/commit/f1ba3327cfcc37534484362293cfac19587110da))
|
|
235
|
+
|
|
236
|
+
### Build
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
- **(node)** Use explicit list for package files (#5229) ([b01b6cf](https://github.com/swc-project/swc/commit/b01b6cf57ee2dcd33886ba9196f364bcb9273afe))
|
|
241
|
+
|
|
140
242
|
## [1.2.213] - 2022-07-13
|
|
141
243
|
|
|
142
244
|
### Bug Fixes
|
package/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { BundleInput } from "./spack";
|
|
|
7
7
|
export declare const version: any;
|
|
8
8
|
export declare function plugins(ps: Plugin[]): Plugin;
|
|
9
9
|
export declare class Compiler {
|
|
10
|
+
private fallbackBindingsPluginWarningDisplayed;
|
|
10
11
|
minify(src: string, opts?: JsMinifyOptions): Promise<Output>;
|
|
11
12
|
minifySync(src: string, opts?: JsMinifyOptions): Output;
|
|
12
13
|
parse(src: string, options: ParseOptions & {
|
package/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -82,15 +86,18 @@ function plugins(ps) {
|
|
|
82
86
|
}
|
|
83
87
|
exports.plugins = plugins;
|
|
84
88
|
class Compiler {
|
|
89
|
+
constructor() {
|
|
90
|
+
this.fallbackBindingsPluginWarningDisplayed = false;
|
|
91
|
+
}
|
|
85
92
|
minify(src, opts) {
|
|
86
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
if (
|
|
88
|
-
|
|
94
|
+
if (bindings) {
|
|
95
|
+
return bindings.minify(toBuffer(src), toBuffer(opts !== null && opts !== void 0 ? opts : {}));
|
|
89
96
|
}
|
|
90
|
-
else if (
|
|
91
|
-
|
|
97
|
+
else if (fallbackBindings) {
|
|
98
|
+
return Promise.resolve(fallbackBindings.minifySync(src, opts));
|
|
92
99
|
}
|
|
93
|
-
|
|
100
|
+
throw new Error('Bindings not found.');
|
|
94
101
|
});
|
|
95
102
|
}
|
|
96
103
|
minifySync(src, opts) {
|
|
@@ -112,8 +119,15 @@ class Compiler {
|
|
|
112
119
|
else if (!bindings) {
|
|
113
120
|
throw new Error('Bindings not found.');
|
|
114
121
|
}
|
|
115
|
-
|
|
116
|
-
|
|
122
|
+
if (bindings) {
|
|
123
|
+
const res = yield bindings.parse(src, toBuffer(options), filename);
|
|
124
|
+
return JSON.parse(res);
|
|
125
|
+
}
|
|
126
|
+
else if (fallbackBindings) {
|
|
127
|
+
const res = fallbackBindings.parseSync(src, toBuffer(options), filename);
|
|
128
|
+
return Promise.resolve(JSON.parse(res));
|
|
129
|
+
}
|
|
130
|
+
throw new Error('Bindings not found.');
|
|
117
131
|
});
|
|
118
132
|
}
|
|
119
133
|
parseSync(src, options, filename) {
|
|
@@ -159,13 +173,13 @@ class Compiler {
|
|
|
159
173
|
print(m, options) {
|
|
160
174
|
return __awaiter(this, void 0, void 0, function* () {
|
|
161
175
|
options = options || {};
|
|
162
|
-
if (
|
|
163
|
-
|
|
176
|
+
if (bindings) {
|
|
177
|
+
return bindings.print(JSON.stringify(m), toBuffer(options));
|
|
164
178
|
}
|
|
165
|
-
else if (
|
|
166
|
-
|
|
179
|
+
else if (fallbackBindings) {
|
|
180
|
+
return Promise.resolve(fallbackBindings.printSync(JSON.stringify(m), options));
|
|
167
181
|
}
|
|
168
|
-
|
|
182
|
+
throw new Error('Bindings not found.');
|
|
169
183
|
});
|
|
170
184
|
}
|
|
171
185
|
/**
|
|
@@ -185,25 +199,29 @@ class Compiler {
|
|
|
185
199
|
transform(src, options) {
|
|
186
200
|
var _a, _b, _c;
|
|
187
201
|
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
-
if (!bindings && !!fallbackBindings) {
|
|
189
|
-
throw new Error('Fallback bindings does not support this interface yet.');
|
|
190
|
-
}
|
|
191
|
-
else if (!bindings) {
|
|
192
|
-
throw new Error('Bindings not found.');
|
|
193
|
-
}
|
|
194
202
|
const isModule = typeof src !== "string";
|
|
195
203
|
options = options || {};
|
|
196
204
|
if ((_a = options === null || options === void 0 ? void 0 : options.jsc) === null || _a === void 0 ? void 0 : _a.parser) {
|
|
197
205
|
options.jsc.parser.syntax = (_b = options.jsc.parser.syntax) !== null && _b !== void 0 ? _b : 'ecmascript';
|
|
198
206
|
}
|
|
199
207
|
const { plugin } = options, newOptions = __rest(options, ["plugin"]);
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
208
|
+
if (bindings) {
|
|
209
|
+
if (plugin) {
|
|
210
|
+
const m = typeof src === "string"
|
|
211
|
+
? yield this.parse(src, (_c = options === null || options === void 0 ? void 0 : options.jsc) === null || _c === void 0 ? void 0 : _c.parser, options.filename)
|
|
212
|
+
: src;
|
|
213
|
+
return this.transform(plugin(m), newOptions);
|
|
214
|
+
}
|
|
215
|
+
return bindings.transform(isModule ? JSON.stringify(src) : src, isModule, toBuffer(newOptions));
|
|
216
|
+
}
|
|
217
|
+
else if (fallbackBindings) {
|
|
218
|
+
if (plugin && !this.fallbackBindingsPluginWarningDisplayed) {
|
|
219
|
+
console.warn(`Fallback bindings does not support legacy plugins, it'll be ignored.`);
|
|
220
|
+
this.fallbackBindingsPluginWarningDisplayed = true;
|
|
221
|
+
}
|
|
222
|
+
return Promise.resolve(fallbackBindings.transformSync(src, options));
|
|
205
223
|
}
|
|
206
|
-
|
|
224
|
+
throw new Error('Bindings not found.');
|
|
207
225
|
});
|
|
208
226
|
}
|
|
209
227
|
transformSync(src, options) {
|
|
@@ -213,8 +231,8 @@ class Compiler {
|
|
|
213
231
|
if ((_a = options === null || options === void 0 ? void 0 : options.jsc) === null || _a === void 0 ? void 0 : _a.parser) {
|
|
214
232
|
options.jsc.parser.syntax = (_b = options.jsc.parser.syntax) !== null && _b !== void 0 ? _b : 'ecmascript';
|
|
215
233
|
}
|
|
234
|
+
const { plugin } = options, newOptions = __rest(options, ["plugin"]);
|
|
216
235
|
if (bindings) {
|
|
217
|
-
const { plugin } = options, newOptions = __rest(options, ["plugin"]);
|
|
218
236
|
if (plugin) {
|
|
219
237
|
const m = typeof src === "string" ? this.parseSync(src, (_c = options === null || options === void 0 ? void 0 : options.jsc) === null || _c === void 0 ? void 0 : _c.parser, options.filename) : src;
|
|
220
238
|
return this.transformSync(plugin(m), newOptions);
|
|
@@ -222,6 +240,10 @@ class Compiler {
|
|
|
222
240
|
return bindings.transformSync(isModule ? JSON.stringify(src) : src, isModule, toBuffer(newOptions));
|
|
223
241
|
}
|
|
224
242
|
else if (fallbackBindings) {
|
|
243
|
+
if (plugin && !this.fallbackBindingsPluginWarningDisplayed) {
|
|
244
|
+
console.warn(`Fallback bindings does not support legacy plugins, it'll be ignored.`);
|
|
245
|
+
this.fallbackBindingsPluginWarningDisplayed = true;
|
|
246
|
+
}
|
|
225
247
|
return fallbackBindings.transformSync(src, options);
|
|
226
248
|
}
|
|
227
249
|
throw new Error("Bindings not found");
|
|
@@ -385,7 +407,7 @@ exports.__experimental_registerGlobalTraceConfig = __experimental_registerGlobal
|
|
|
385
407
|
*/
|
|
386
408
|
function getBinaryMetadata() {
|
|
387
409
|
return {
|
|
388
|
-
target: bindings.getTargetTriple()
|
|
410
|
+
target: bindings ? bindings === null || bindings === void 0 ? void 0 : bindings.getTargetTriple() : undefined
|
|
389
411
|
};
|
|
390
412
|
}
|
|
391
413
|
exports.getBinaryMetadata = getBinaryMetadata;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swc/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.219",
|
|
4
4
|
"description": "Super-fast alternative for babel",
|
|
5
5
|
"homepage": "https://swc.rs",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -96,6 +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.218",
|
|
99
100
|
"@swc/helpers": "^0.4.2",
|
|
100
101
|
"@taplo/cli": "^0.3.2",
|
|
101
102
|
"@types/jest": "^28.1.4",
|
|
@@ -137,19 +138,19 @@
|
|
|
137
138
|
"url": "https://opencollective.com/swc"
|
|
138
139
|
},
|
|
139
140
|
"optionalDependencies": {
|
|
140
|
-
"@swc/core-win32-x64-msvc": "1.2.
|
|
141
|
-
"@swc/core-darwin-x64": "1.2.
|
|
142
|
-
"@swc/core-linux-x64-gnu": "1.2.
|
|
143
|
-
"@swc/core-linux-x64-musl": "1.2.
|
|
144
|
-
"@swc/core-freebsd-x64": "1.2.
|
|
145
|
-
"@swc/core-win32-ia32-msvc": "1.2.
|
|
146
|
-
"@swc/core-linux-arm64-gnu": "1.2.
|
|
147
|
-
"@swc/core-linux-arm-gnueabihf": "1.2.
|
|
148
|
-
"@swc/core-darwin-arm64": "1.2.
|
|
149
|
-
"@swc/core-android-arm64": "1.2.
|
|
150
|
-
"@swc/core-linux-arm64-musl": "1.2.
|
|
151
|
-
"@swc/core-win32-arm64-msvc": "1.2.
|
|
152
|
-
"@swc/core-android-arm-eabi": "1.2.
|
|
141
|
+
"@swc/core-win32-x64-msvc": "1.2.219",
|
|
142
|
+
"@swc/core-darwin-x64": "1.2.219",
|
|
143
|
+
"@swc/core-linux-x64-gnu": "1.2.219",
|
|
144
|
+
"@swc/core-linux-x64-musl": "1.2.219",
|
|
145
|
+
"@swc/core-freebsd-x64": "1.2.219",
|
|
146
|
+
"@swc/core-win32-ia32-msvc": "1.2.219",
|
|
147
|
+
"@swc/core-linux-arm64-gnu": "1.2.219",
|
|
148
|
+
"@swc/core-linux-arm-gnueabihf": "1.2.219",
|
|
149
|
+
"@swc/core-darwin-arm64": "1.2.219",
|
|
150
|
+
"@swc/core-android-arm64": "1.2.219",
|
|
151
|
+
"@swc/core-linux-arm64-musl": "1.2.219",
|
|
152
|
+
"@swc/core-win32-arm64-msvc": "1.2.219",
|
|
153
|
+
"@swc/core-android-arm-eabi": "1.2.219"
|
|
153
154
|
},
|
|
154
155
|
"files": [
|
|
155
156
|
"CHANGELOG.md",
|
package/postinstall.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/spack.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|