@swc/core 1.2.207 → 1.2.208

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/package.json +14 -14
  3. package/types.d.ts +89 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,71 @@
5
5
 
6
6
 
7
7
 
8
+ - **(es/compat)** Preserve this in function with block scoped vars (#5056) ([18ea2b5](https://github.com/swc-project/swc/commit/18ea2b577011d610fbb06bb6728a86be8366703a))
9
+
10
+
11
+ - **(es/modules)** Handle `this` in class methods (#5065) ([ef543b1](https://github.com/swc-project/swc/commit/ef543b1b22b9cf29add68984318fe19620240888))
12
+
13
+
14
+ - **(es/modules)** Improve compatibility with cjs lexer (#5080) ([9e162dc](https://github.com/swc-project/swc/commit/9e162dcbae91a3dd4cef47ab0d80de14ada6d70d))
15
+
16
+
17
+ - **(html/minifier)** Fix smart mode (#5058) ([e9bad20](https://github.com/swc-project/swc/commit/e9bad20898df92f7d0dd898ab1924229d5113251))
18
+
19
+
20
+ - **(html/minifier)** Minify `meta` element (#5075) ([214c60a](https://github.com/swc-project/swc/commit/214c60a313162218c9acb007b8747dbc8f39ac8a))
21
+
22
+ ### Documentation
23
+
24
+
25
+
26
+ - **(contributing)** Add `--features memory_cache` to test steps (#5074) ([9d8beb0](https://github.com/swc-project/swc/commit/9d8beb02b7161a6af604cf187f2a53d91cd336ea))
27
+
28
+ ### Features
29
+
30
+
31
+
32
+ - **(atoms)** Improve atoms (#5066) ([34f4f5a](https://github.com/swc-project/swc/commit/34f4f5a3bc7797e2b9b192671cf68b63ea0dd25c))
33
+
34
+
35
+ - **(es/modules)** Support node interop (#5069) ([1e33dba](https://github.com/swc-project/swc/commit/1e33dbab24a534477ed1046b57a0c9daeb84e3ca))
36
+
37
+
38
+ - **(es/parser)** Add `allow_return_outside_function` to options (#5046) ([37eb366](https://github.com/swc-project/swc/commit/37eb366a1f554668fd7011869ec8f58c67e9ce9f))
39
+
40
+
41
+ - **(html/minifier)** Allow minifying custom script contents (#5043) ([d7a5f71](https://github.com/swc-project/swc/commit/d7a5f710730063c51deb91c9aa937f7d5a33e582))
42
+
43
+
44
+ - **(html/minifier)** Sort unordered values in attributes (#5035) ([26cfeff](https://github.com/swc-project/swc/commit/26cfeff79cbae9c7b998690ed6b59d2336cf2430))
45
+
46
+
47
+ - **(html/minifier)** Improve `collapse_whitespaces` (#5070) ([144314d](https://github.com/swc-project/swc/commit/144314dcc2e98baba79502be6f82ea39aa71f560))
48
+
49
+
50
+ - **(plugin)** Add versioned wrapper struct (#5062) ([e34a864](https://github.com/swc-project/swc/commit/e34a864390dc6a8a0d78cc60af458be37031e30f))
51
+
52
+
53
+ - **(plugin)** Allow taking the inner data from versioned (#5071) ([e1aa937](https://github.com/swc-project/swc/commit/e1aa937183ca3c803be9665ec0a683b679bfc29f))
54
+
55
+ ### Miscellaneous Tasks
56
+
57
+
58
+
59
+ - **(deps)** Update `rkyv` (#5057) ([374366d](https://github.com/swc-project/swc/commit/374366d56ca431dc892b390efaf090ee4d116100))- **general**: Workaround cargo mono bug ([60424db](https://github.com/swc-project/swc/commit/60424db67b3c9bc0d36012249e16ebaa2100f299))
60
+
61
+ ### Performance
62
+
63
+
64
+
65
+ - **(atoms)** More groundwork for replacing `JsWord` with `Atom` (#5064) ([2e139f1](https://github.com/swc-project/swc/commit/2e139f144126636a5d44ae3866cf858426a1bb8e))
66
+
67
+ ## [1.2.207] - 2022-06-28
68
+
69
+ ### Bug Fixes
70
+
71
+
72
+
8
73
  - **(es/compat)** Handle classes with accessors and a method with the same name (#5039) ([25bd520](https://github.com/swc-project/swc/commit/25bd5206205d76c1ff93e67b67b3aeca551113d6))
9
74
 
10
75
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swc/core",
3
- "version": "1.2.207",
3
+ "version": "1.2.208",
4
4
  "description": "Super-fast alternative for babel",
5
5
  "homepage": "https://swc.rs",
6
6
  "main": "./index.js",
@@ -135,18 +135,18 @@
135
135
  "url": "https://opencollective.com/swc"
136
136
  },
137
137
  "optionalDependencies": {
138
- "@swc/core-win32-x64-msvc": "1.2.207",
139
- "@swc/core-darwin-x64": "1.2.207",
140
- "@swc/core-linux-x64-gnu": "1.2.207",
141
- "@swc/core-linux-x64-musl": "1.2.207",
142
- "@swc/core-freebsd-x64": "1.2.207",
143
- "@swc/core-win32-ia32-msvc": "1.2.207",
144
- "@swc/core-linux-arm64-gnu": "1.2.207",
145
- "@swc/core-linux-arm-gnueabihf": "1.2.207",
146
- "@swc/core-darwin-arm64": "1.2.207",
147
- "@swc/core-android-arm64": "1.2.207",
148
- "@swc/core-linux-arm64-musl": "1.2.207",
149
- "@swc/core-win32-arm64-msvc": "1.2.207",
150
- "@swc/core-android-arm-eabi": "1.2.207"
138
+ "@swc/core-win32-x64-msvc": "1.2.208",
139
+ "@swc/core-darwin-x64": "1.2.208",
140
+ "@swc/core-linux-x64-gnu": "1.2.208",
141
+ "@swc/core-linux-x64-musl": "1.2.208",
142
+ "@swc/core-freebsd-x64": "1.2.208",
143
+ "@swc/core-win32-ia32-msvc": "1.2.208",
144
+ "@swc/core-linux-arm64-gnu": "1.2.208",
145
+ "@swc/core-linux-arm-gnueabihf": "1.2.208",
146
+ "@swc/core-darwin-arm64": "1.2.208",
147
+ "@swc/core-android-arm64": "1.2.208",
148
+ "@swc/core-linux-arm64-musl": "1.2.208",
149
+ "@swc/core-win32-arm64-msvc": "1.2.208",
150
+ "@swc/core-android-arm-eabi": "1.2.208"
151
151
  }
152
152
  }
package/types.d.ts CHANGED
@@ -721,6 +721,8 @@ export interface BaseModuleConfig {
721
721
  */
722
722
  lazy?: boolean | string[];
723
723
  /**
724
+ * @deprecated Use the `importInterop` option instead.
725
+ *
724
726
  * By default, when using exports with swc a non-enumerable __esModule property is exported.
725
727
  * This property is then used to determine if the import is the default export or if
726
728
  * it contains the default export.
@@ -731,6 +733,93 @@ export interface BaseModuleConfig {
731
733
  * Defaults to `false`.
732
734
  */
733
735
  noInterop?: boolean;
736
+ /**
737
+ * Defaults to `swc`.
738
+ *
739
+ * CommonJS modules and ECMAScript modules are not fully compatible.
740
+ * However, compilers, bundlers and JavaScript runtimes developed different strategies
741
+ * to make them work together as well as possible.
742
+ *
743
+ * - `swc` (alias: `babel`)
744
+ *
745
+ * When using exports with `swc` a non-enumerable `__esModule` property is exported
746
+ * This property is then used to determine if the import is the default export
747
+ * or if it contains the default export.
748
+ *
749
+ * ```javascript
750
+ * import foo from "foo";
751
+ * import { bar } from "bar";
752
+ * foo;
753
+ * bar;
754
+ *
755
+ * // Is compiled to ...
756
+ *
757
+ * "use strict";
758
+ *
759
+ * function _interopRequireDefault(obj) {
760
+ * return obj && obj.__esModule ? obj : { default: obj };
761
+ * }
762
+ *
763
+ * var _foo = _interopRequireDefault(require("foo"));
764
+ * var _bar = require("bar");
765
+ *
766
+ * _foo.default;
767
+ * _bar.bar;
768
+ * ```
769
+ *
770
+ * When this import interop is used, if both the imported and the importer module are compiled
771
+ * with swc they behave as if none of them was compiled.
772
+ *
773
+ * This is the default behavior.
774
+ *
775
+ * - `node`
776
+ *
777
+ * When importing CommonJS files (either directly written in CommonJS, or generated with a compiler)
778
+ * Node.js always binds the `default` export to the value of `module.exports`.
779
+ *
780
+ * ```javascript
781
+ * import foo from "foo";
782
+ * import { bar } from "bar";
783
+ * foo;
784
+ * bar;
785
+ *
786
+ * // Is compiled to ...
787
+ *
788
+ * "use strict";
789
+ *
790
+ * var _foo = require("foo");
791
+ * var _bar = require("bar");
792
+ *
793
+ * _foo;
794
+ * _bar.bar;
795
+ * ```
796
+ * This is not exactly the same as what Node.js does since swc allows accessing any property of `module.exports`
797
+ * as a named export, while Node.js only allows importing statically analyzable properties of `module.exports`.
798
+ * However, any import working in Node.js will also work when compiled with swc using `importInterop: "node"`.
799
+ *
800
+ * - `none`
801
+ *
802
+ * If you know that the imported file has been transformed with a compiler that stores the `default` export on
803
+ * `exports.default` (such as swc or Babel), you can safely omit the `_interopRequireDefault` helper.
804
+ *
805
+ * ```javascript
806
+ * import foo from "foo";
807
+ * import { bar } from "bar";
808
+ * foo;
809
+ * bar;
810
+ *
811
+ * // Is compiled to ...
812
+ *
813
+ * "use strict";
814
+ *
815
+ * var _foo = require("foo");
816
+ * var _bar = require("bar");
817
+ *
818
+ * _foo.default;
819
+ * _bar.bar;
820
+ * ```
821
+ */
822
+ importInterop?: "swc" | "babel" | "node" | "none";
734
823
  /**
735
824
  * If set to true, dynamic imports will be preserved.
736
825
  */