@swc/core 1.2.172 → 1.2.175
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 +159 -0
- package/package.json +15 -15
- package/types.d.ts +121 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,165 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
- **(css/prefixer)** Add prefix for `print-color-adjust` (#4503) ([90ac93a](https://github.com/swc-project/swc/commit/90ac93af12b9fb8d50f15ce98a7af5c5ce21d77b))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
- **(es/bugfixes)** Fix handling of syntax context (#4490) ([a444726](https://github.com/swc-project/swc/commit/a444726fe3014c1a241439d8126188c0c5fe5212))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
- **(es/compat)** Support updating a private field with bigint value (#4136) ([1e1d081](https://github.com/swc-project/swc/commit/1e1d081805e51d494d2d22568b656698a28849f0))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
- **(es/compat)** Visit default export in `static_block` (#4500) ([c4b156c](https://github.com/swc-project/swc/commit/c4b156ce1f4910189cc796c483c7bab92ebd290d))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
- **(es/decorators)** Make legacy decorator identical to `tsc` (#4496) ([f30ffdf](https://github.com/swc-project/swc/commit/f30ffdf200555ba59afe88c3dc4ba6fa89d76fe6))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
- **(html/parser)** Fix adoption agency algorithm (#4487) ([00358e1](https://github.com/swc-project/swc/commit/00358e10fc00e9118e933da8a8674e347d0d60f0))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
- **(html/parser)** Fix bugs (#4502) ([fca84eb](https://github.com/swc-project/swc/commit/fca84eb0f27cec0821b1dd63a331de9b7d1118b4))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
- **(html/parser)** Fix parsing of `select` (#4504) ([b8588c4](https://github.com/swc-project/swc/commit/b8588c4a4511373abf53ed303f975b7c9eeaec61))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
- **(html/parser)** Fix parsing of a table with a table (#4506) ([efe87bc](https://github.com/swc-project/swc/commit/efe87bcbf65c5fe7ebf8dd219842ca792f823292))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
- **(node/types)** Add types for `jsc.minify.format` (#4492) ([3ed1538](https://github.com/swc-project/swc/commit/3ed1538bfe3cc8fb008b34c7a78dc239115f4159))
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
- **(es/compat)** Verify private property access (#4465) ([de53a6f](https://github.com/swc-project/swc/commit/de53a6fa9d3e983773d458f0d7e6df561f7cb5d3))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
- **(es/lints)** Implement `no-var` (#4485) ([17f237d](https://github.com/swc-project/swc/commit/17f237d3ba97fc14d098cef2038bb846ac2b7c8d))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
- **(es/parser)** Reject private field called `#constructor` (#4491) ([857e798](https://github.com/swc-project/swc/commit/857e798194e18ec874ddd51c27d136ca1e5298b8))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
- **(es/preset-env)** Update data (#4497) ([5c5337d](https://github.com/swc-project/swc/commit/5c5337d342b442c7ebbe1293b7ab705d74e482bc))
|
|
51
|
+
|
|
52
|
+
### Refactor
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
- **(es/minifier)** Cleanup (#4489) ([50b2049](https://github.com/swc-project/swc/commit/50b20496cdd1d5fb2dd119c633b5dc7608cb638c))
|
|
57
|
+
|
|
58
|
+
### Testing
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
- **(es/decorators)** Migrate some tests to file-based fixture tests (#4510) ([8629e0c](https://github.com/swc-project/swc/commit/8629e0c665bf493c480ebb81112667fc0b4abc83))
|
|
63
|
+
|
|
64
|
+
## [1.2.174] - 2022-04-30
|
|
65
|
+
|
|
66
|
+
### Bug Fixes
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
- **(es/helpers)** Update `_interopRequireWildcard` (#4479) ([7d40208](https://github.com/swc-project/swc/commit/7d40208377133b0fcd153c5bfcf47f6b489113c1))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
- **(es/minifier)** Disable some passes for `hoist_props` (#4468) ([effc85d](https://github.com/swc-project/swc/commit/effc85df572609a180f9a28177a5b37ed960c860))
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
- **(es/minifier)** Fix skipping logic of sequential inliner (#4469) ([233c4d5](https://github.com/swc-project/swc/commit/233c4d5b860d557710bfe654f76d7901e5d0b3a0))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
- **(html)** Fix bugs of parser and codegen (#4461) ([8bdfcd9](https://github.com/swc-project/swc/commit/8bdfcd996aa5abde0e50743b90f4d36fd25003ba))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
- **(html/parser)** Fix bugs (#4459) ([2098228](https://github.com/swc-project/swc/commit/20982288fb05dcb4e2c72e5ea4c0888a0e946580))
|
|
83
|
+
|
|
84
|
+
### Features
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
- **(es/lints)** Implement `no-throw-literal` (#4477) ([3a8cade](https://github.com/swc-project/swc/commit/3a8cade2091bea83769b5140a92dad7b2a277ce0))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
- **(es/minifier)** Drop more returns (#4471) ([2739546](https://github.com/swc-project/swc/commit/273954640aa2d22d0e65f4d186bcb6add0844cb1))
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
- **(es/minifier)** Consider cost of functions for inlining (#4470) ([7a584d7](https://github.com/swc-project/swc/commit/7a584d755aa0dc70c8c367f1c0c4b61e2dbc34df))
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
- **(es/minifier)** Drop pure `new` calls (#4478) ([918c9c8](https://github.com/swc-project/swc/commit/918c9c8a21c248617aef4474380c94f9f98df1dc))
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
- **(es/minifier)** Add `pristine_globals` (#4480) ([09ba3c0](https://github.com/swc-project/swc/commit/09ba3c0e688b2bd66e707836ecba23feee93fb8c))
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
- **(html/minifier)** Remove `javascript:` prefix (#4460) ([a1877e7](https://github.com/swc-project/swc/commit/a1877e740acf6bf51421b97c27236b0f208eaf9d))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
- **(html/minifier)** Remove duplicate attributes (#4474) ([750d655](https://github.com/swc-project/swc/commit/750d6551fcbdf9c0664bfa6ad97d394ba6c641de))
|
|
107
|
+
|
|
108
|
+
### Miscellaneous Tasks
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
- **(es/minifier)** Update debugging utils (#4467) ([c45b0df](https://github.com/swc-project/swc/commit/c45b0df8770727b84ede1c3348c9769f5d4367c2))
|
|
113
|
+
|
|
114
|
+
## [1.2.173] - 2022-04-28
|
|
115
|
+
|
|
116
|
+
### Bug Fixes
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
- **(es)** Remove wrong debug assertion (#4445) ([962cf4a](https://github.com/swc-project/swc/commit/962cf4a08caaee6dc0579aed556df55bc60bf093))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
- **(es/async-generator)** Fix `yield*` in async generators (#4452) ([0bc0bae](https://github.com/swc-project/swc/commit/0bc0bae90dcf6f448f45d35edc02ce025c0d8114))
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
- **(es/parser)** Throw syntax error for missing function expr body (#4462) ([393cfa8](https://github.com/swc-project/swc/commit/393cfa84b65264a07f90387a0f7852535d87cd6d))
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
- **(es/preset-env)** Do not import new features when using old core-js (#4458) ([4262874](https://github.com/swc-project/swc/commit/4262874ce458260fc6a7d363522b5c6591df93b3))
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
- **(html/parser)** Fix a bug with nested tags (#4438) ([8c4dc4c](https://github.com/swc-project/swc/commit/8c4dc4cc46e73265ad45e63fecd513f4ba4cf7bb))
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
- **(html/parser)** Parse table including broken one (#4451) ([6e60813](https://github.com/swc-project/swc/commit/6e6081336714861055a1ae148f1305e2ab180efc))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
- **(html/parser)** Fix fosting logic for text nodes (#4457) ([65a158a](https://github.com/swc-project/swc/commit/65a158a66b2a394f70757ae363ab329ced71436f))
|
|
139
|
+
|
|
140
|
+
### Features
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
- **(es/parser)** Reject indirect opt chain in assignment (#4447) ([df7b3f6](https://github.com/swc-project/swc/commit/df7b3f611a7bf5509e143cf81a69e0443cf80288))
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
- **(html/minifier)** Compress whitespaces (#4463) ([0ae4350](https://github.com/swc-project/swc/commit/0ae43502f3f54ad7d77b790c9f1ad2af63d32090))
|
|
148
|
+
|
|
149
|
+
### Miscellaneous Tasks
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
- **(es/minifier)** Don't run tests with infinite loops (#4448) ([ec7dfb9](https://github.com/swc-project/swc/commit/ec7dfb92098897d9b8dbe5726bef78ea2a868053))
|
|
154
|
+
|
|
155
|
+
### Testing
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
- **(html/codegen)** Improve fixture testing (#4450) ([f30e771](https://github.com/swc-project/swc/commit/f30e7717a20348af2f6ef65bb7ff800fbffeadb4))
|
|
160
|
+
|
|
161
|
+
## [1.2.172] - 2022-04-26
|
|
162
|
+
|
|
163
|
+
### Bug Fixes
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
8
167
|
- **(es/ast)** Fix tag of `BigInt` (#4440) ([2813eaa](https://github.com/swc-project/swc/commit/2813eaadcd0703b9f8c11d77f91c70cd002c9296))
|
|
9
168
|
|
|
10
169
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swc/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.175",
|
|
4
4
|
"description": "Super-fast alternative for babel",
|
|
5
5
|
"homepage": "https://swc.rs",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@babel/preset-typescript": "^7.13.0",
|
|
84
84
|
"@babel/types": "^7.14.0",
|
|
85
85
|
"@napi-rs/cli": "^2.4.5",
|
|
86
|
-
"@swc/helpers": "^0.
|
|
86
|
+
"@swc/helpers": "^0.3.8",
|
|
87
87
|
"@taplo/cli": "^0.3.2",
|
|
88
88
|
"@types/jest": "^26.0.23",
|
|
89
89
|
"@types/node": "^14.14.41",
|
|
@@ -121,18 +121,18 @@
|
|
|
121
121
|
"url": "https://opencollective.com/swc"
|
|
122
122
|
},
|
|
123
123
|
"optionalDependencies": {
|
|
124
|
-
"@swc/core-win32-x64-msvc": "1.2.
|
|
125
|
-
"@swc/core-darwin-x64": "1.2.
|
|
126
|
-
"@swc/core-linux-x64-gnu": "1.2.
|
|
127
|
-
"@swc/core-linux-x64-musl": "1.2.
|
|
128
|
-
"@swc/core-freebsd-x64": "1.2.
|
|
129
|
-
"@swc/core-win32-ia32-msvc": "1.2.
|
|
130
|
-
"@swc/core-linux-arm64-gnu": "1.2.
|
|
131
|
-
"@swc/core-linux-arm-gnueabihf": "1.2.
|
|
132
|
-
"@swc/core-darwin-arm64": "1.2.
|
|
133
|
-
"@swc/core-android-arm64": "1.2.
|
|
134
|
-
"@swc/core-linux-arm64-musl": "1.2.
|
|
135
|
-
"@swc/core-win32-arm64-msvc": "1.2.
|
|
136
|
-
"@swc/core-android-arm-eabi": "1.2.
|
|
124
|
+
"@swc/core-win32-x64-msvc": "1.2.175",
|
|
125
|
+
"@swc/core-darwin-x64": "1.2.175",
|
|
126
|
+
"@swc/core-linux-x64-gnu": "1.2.175",
|
|
127
|
+
"@swc/core-linux-x64-musl": "1.2.175",
|
|
128
|
+
"@swc/core-freebsd-x64": "1.2.175",
|
|
129
|
+
"@swc/core-win32-ia32-msvc": "1.2.175",
|
|
130
|
+
"@swc/core-linux-arm64-gnu": "1.2.175",
|
|
131
|
+
"@swc/core-linux-arm-gnueabihf": "1.2.175",
|
|
132
|
+
"@swc/core-darwin-arm64": "1.2.175",
|
|
133
|
+
"@swc/core-android-arm64": "1.2.175",
|
|
134
|
+
"@swc/core-linux-arm64-musl": "1.2.175",
|
|
135
|
+
"@swc/core-win32-arm64-msvc": "1.2.175",
|
|
136
|
+
"@swc/core-android-arm-eabi": "1.2.175"
|
|
137
137
|
}
|
|
138
138
|
}
|
package/types.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare type ParseOptions = ParserConfig & {
|
|
|
12
12
|
export declare type TerserEcmaVersion = 5 | 2015 | 2016 | string | number;
|
|
13
13
|
export interface JsMinifyOptions {
|
|
14
14
|
compress?: TerserCompressOptions | boolean;
|
|
15
|
+
format?: JsFormatOptions & ToSnakeCaseProperties<JsFormatOptions>;
|
|
15
16
|
mangle?: TerserMangleOptions | boolean;
|
|
16
17
|
ecma?: TerserEcmaVersion;
|
|
17
18
|
keep_classnames?: boolean;
|
|
@@ -23,6 +24,126 @@ export interface JsMinifyOptions {
|
|
|
23
24
|
outputPath?: string;
|
|
24
25
|
inlineSourcesContent?: boolean;
|
|
25
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* @example ToSnakeCase<'indentLevel'> == 'indent_level'
|
|
29
|
+
*/
|
|
30
|
+
declare type ToSnakeCase<T extends string> = T extends `${infer A}${infer B}` ? `${A extends Lowercase<A> ? A : `_${Lowercase<A>}`}${ToSnakeCase<B>}` : T;
|
|
31
|
+
/**
|
|
32
|
+
* @example ToSnakeCaseProperties<{indentLevel: 3}> == {indent_level: 3}
|
|
33
|
+
*/
|
|
34
|
+
declare type ToSnakeCaseProperties<T> = {
|
|
35
|
+
[K in keyof T as (K extends string ? ToSnakeCase<K> : K)]: T[K];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* These properties are mostly not implemented yet,
|
|
39
|
+
* but it exists to support passing terser config to swc minify
|
|
40
|
+
* without modification.
|
|
41
|
+
*/
|
|
42
|
+
export interface JsFormatOptions {
|
|
43
|
+
/**
|
|
44
|
+
* Currently noop.
|
|
45
|
+
* @default false
|
|
46
|
+
* @alias ascii_only
|
|
47
|
+
*/
|
|
48
|
+
asciiOnly?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Currently noop.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
beautify?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Currently noop.
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
braces?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* - `false`: removes all comments
|
|
61
|
+
* - `'some'`: preserves some comments
|
|
62
|
+
* - `'all'`: preserves all comments
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
comments?: false | 'some' | 'all';
|
|
66
|
+
/**
|
|
67
|
+
* Currently noop.
|
|
68
|
+
* @default 5
|
|
69
|
+
*/
|
|
70
|
+
ecma?: TerserEcmaVersion;
|
|
71
|
+
/**
|
|
72
|
+
* Currently noop.
|
|
73
|
+
* @alias indent_level
|
|
74
|
+
*/
|
|
75
|
+
indentLevel?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Currently noop.
|
|
78
|
+
* @alias indent_start
|
|
79
|
+
*/
|
|
80
|
+
indentStart?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Currently noop.
|
|
83
|
+
* @alias inline_script
|
|
84
|
+
*/
|
|
85
|
+
inlineScript?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Currently noop.
|
|
88
|
+
* @alias keep_numbers
|
|
89
|
+
*/
|
|
90
|
+
keepNumbers?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Currently noop.
|
|
93
|
+
* @alias keep_quoted_props
|
|
94
|
+
*/
|
|
95
|
+
keepQuotedProps?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Currently noop.
|
|
98
|
+
* @alias max_line_len
|
|
99
|
+
*/
|
|
100
|
+
maxLineLen?: number | false;
|
|
101
|
+
/**
|
|
102
|
+
* Currently noop.
|
|
103
|
+
*/
|
|
104
|
+
preamble?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Currently noop.
|
|
107
|
+
* @alias quote_keys
|
|
108
|
+
*/
|
|
109
|
+
quoteKeys?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Currently noop.
|
|
112
|
+
* @alias quote_style
|
|
113
|
+
*/
|
|
114
|
+
quoteStyle?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Currently noop.
|
|
117
|
+
* @alias preserve_annotations
|
|
118
|
+
*/
|
|
119
|
+
preserveAnnotations?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Currently noop.
|
|
122
|
+
*/
|
|
123
|
+
safari10?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Currently noop.
|
|
126
|
+
*/
|
|
127
|
+
semicolons?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Currently noop.
|
|
130
|
+
*/
|
|
131
|
+
shebang?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Currently noop.
|
|
134
|
+
*/
|
|
135
|
+
webkit?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Currently noop.
|
|
138
|
+
* @alias wrap_iife
|
|
139
|
+
*/
|
|
140
|
+
wrapIife?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Currently noop.
|
|
143
|
+
* @alias wrap_func_args
|
|
144
|
+
*/
|
|
145
|
+
wrapFuncArgs?: boolean;
|
|
146
|
+
}
|
|
26
147
|
export interface TerserCompressOptions {
|
|
27
148
|
arguments?: boolean;
|
|
28
149
|
arrows?: boolean;
|