oxc-transform 0.66.0 → 0.67.0
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/index.d.ts +84 -0
- package/package.json +11 -11
package/index.d.ts
CHANGED
|
@@ -24,6 +24,47 @@ export interface CompilerAssumptions {
|
|
|
24
24
|
noDocumentAll?: boolean
|
|
25
25
|
objectRestNoSymbols?: boolean
|
|
26
26
|
pureGetters?: boolean
|
|
27
|
+
/**
|
|
28
|
+
* When using public class fields, assume that they don't shadow any getter in the current class,
|
|
29
|
+
* in its subclasses or in its superclass. Thus, it's safe to assign them rather than using
|
|
30
|
+
* `Object.defineProperty`.
|
|
31
|
+
*
|
|
32
|
+
* For example:
|
|
33
|
+
*
|
|
34
|
+
* Input:
|
|
35
|
+
* ```js
|
|
36
|
+
* class Test {
|
|
37
|
+
* field = 2;
|
|
38
|
+
*
|
|
39
|
+
* static staticField = 3;
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* When `set_public_class_fields` is `true`, the output will be:
|
|
44
|
+
* ```js
|
|
45
|
+
* class Test {
|
|
46
|
+
* constructor() {
|
|
47
|
+
* this.field = 2;
|
|
48
|
+
* }
|
|
49
|
+
* }
|
|
50
|
+
* Test.staticField = 3;
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* Otherwise, the output will be:
|
|
54
|
+
* ```js
|
|
55
|
+
* import _defineProperty from "@oxc-project/runtime/helpers/defineProperty";
|
|
56
|
+
* class Test {
|
|
57
|
+
* constructor() {
|
|
58
|
+
* _defineProperty(this, "field", 2);
|
|
59
|
+
* }
|
|
60
|
+
* }
|
|
61
|
+
* _defineProperty(Test, "staticField", 3);
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* NOTE: For TypeScript, if you wanted behavior is equivalent to `useDefineForClassFields: false`, you should
|
|
65
|
+
* set both `set_public_class_fields` and [`crate::TypeScriptOptions::remove_class_fields_without_initializer`]
|
|
66
|
+
* to `true`.
|
|
67
|
+
*/
|
|
27
68
|
setPublicClassFields?: boolean
|
|
28
69
|
}
|
|
29
70
|
|
|
@@ -426,7 +467,50 @@ export interface TypeScriptOptions {
|
|
|
426
467
|
jsxPragmaFrag?: string
|
|
427
468
|
onlyRemoveTypeImports?: boolean
|
|
428
469
|
allowNamespaces?: boolean
|
|
470
|
+
/**
|
|
471
|
+
* When enabled, type-only class fields are only removed if they are prefixed with the declare modifier:
|
|
472
|
+
*
|
|
473
|
+
* @deprecated
|
|
474
|
+
*
|
|
475
|
+
* Allowing `declare` fields is built-in support in Oxc without any option. If you want to remove class fields
|
|
476
|
+
* without initializer, you can use `remove_class_fields_without_initializer: true` instead.
|
|
477
|
+
*/
|
|
429
478
|
allowDeclareFields?: boolean
|
|
479
|
+
/**
|
|
480
|
+
* When enabled, class fields without initializers are removed.
|
|
481
|
+
*
|
|
482
|
+
* For example:
|
|
483
|
+
* ```ts
|
|
484
|
+
* class Foo {
|
|
485
|
+
* x: number;
|
|
486
|
+
* y: number = 0;
|
|
487
|
+
* }
|
|
488
|
+
* ```
|
|
489
|
+
* // transform into
|
|
490
|
+
* ```js
|
|
491
|
+
* class Foo {
|
|
492
|
+
* x: number;
|
|
493
|
+
* }
|
|
494
|
+
* ```
|
|
495
|
+
*
|
|
496
|
+
* The option is used to align with the behavior of TypeScript's `useDefineForClassFields: false` option.
|
|
497
|
+
* When you want to enable this, you also need to set [`crate::CompilerAssumptions::set_public_class_fields`]
|
|
498
|
+
* to `true`. The `set_public_class_fields: true` + `remove_class_fields_without_initializer: true` is
|
|
499
|
+
* equivalent to `useDefineForClassFields: false` in TypeScript.
|
|
500
|
+
*
|
|
501
|
+
* When `set_public_class_fields` is true and class-properties plugin is enabled, the above example transforms into:
|
|
502
|
+
*
|
|
503
|
+
* ```js
|
|
504
|
+
* class Foo {
|
|
505
|
+
* constructor() {
|
|
506
|
+
* this.y = 0;
|
|
507
|
+
* }
|
|
508
|
+
* }
|
|
509
|
+
* ```
|
|
510
|
+
*
|
|
511
|
+
* Defaults to `false`.
|
|
512
|
+
*/
|
|
513
|
+
removeClassFieldsWithoutInitializer?: boolean
|
|
430
514
|
/**
|
|
431
515
|
* Also generate a `.d.ts` declaration file for TypeScript files.
|
|
432
516
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxc-transform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.67.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"browser": "browser.js",
|
|
6
6
|
"engines": {
|
|
@@ -57,16 +57,16 @@
|
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"optionalDependencies": {
|
|
60
|
-
"@oxc-transform/binding-win32-x64-msvc": "0.
|
|
61
|
-
"@oxc-transform/binding-win32-arm64-msvc": "0.
|
|
62
|
-
"@oxc-transform/binding-linux-x64-gnu": "0.
|
|
63
|
-
"@oxc-transform/binding-linux-x64-musl": "0.
|
|
64
|
-
"@oxc-transform/binding-linux-arm64-gnu": "0.
|
|
65
|
-
"@oxc-transform/binding-linux-arm64-musl": "0.
|
|
66
|
-
"@oxc-transform/binding-linux-arm-gnueabihf": "0.
|
|
67
|
-
"@oxc-transform/binding-darwin-x64": "0.
|
|
68
|
-
"@oxc-transform/binding-darwin-arm64": "0.
|
|
69
|
-
"@oxc-transform/binding-wasm32-wasi": "0.
|
|
60
|
+
"@oxc-transform/binding-win32-x64-msvc": "0.67.0",
|
|
61
|
+
"@oxc-transform/binding-win32-arm64-msvc": "0.67.0",
|
|
62
|
+
"@oxc-transform/binding-linux-x64-gnu": "0.67.0",
|
|
63
|
+
"@oxc-transform/binding-linux-x64-musl": "0.67.0",
|
|
64
|
+
"@oxc-transform/binding-linux-arm64-gnu": "0.67.0",
|
|
65
|
+
"@oxc-transform/binding-linux-arm64-musl": "0.67.0",
|
|
66
|
+
"@oxc-transform/binding-linux-arm-gnueabihf": "0.67.0",
|
|
67
|
+
"@oxc-transform/binding-darwin-x64": "0.67.0",
|
|
68
|
+
"@oxc-transform/binding-darwin-arm64": "0.67.0",
|
|
69
|
+
"@oxc-transform/binding-wasm32-wasi": "0.67.0"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
72
|
"build-dev": "napi --no-dts-cache build --platform",
|