@swc/plugin-swc-sdk 11.0.0 → 11.1.1

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @swc/plugin-swc-sdk
2
2
 
3
+ ## 11.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 436381f: Fix jsx handling by using lazy init
8
+
9
+ ## 11.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 1928974: Add a feature to make imports dynamic
14
+
3
15
  ## 11.0.0
4
16
 
5
17
  ### Major Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @swc/plugin-swc-sdk
2
2
 
3
- ## Usage
3
+ # Usage
4
4
 
5
5
  .swcrc:
6
6
 
@@ -14,7 +14,54 @@
14
14
  }
15
15
  ```
16
16
 
17
- ### `markAsPure`
17
+ ## `/*#__DYNAMIC__*/` on imports
18
+
19
+ You can annotate on a normal import statement to make it dynamic import.
20
+
21
+ ### Input
22
+
23
+ ```js
24
+ /*#__DYNAMIC__*/
25
+ import { log } from "./logger";
26
+
27
+ export async function work() {
28
+ if (process.env.NODE_ENV !== "production") {
29
+ await log("Starting work");
30
+ }
31
+
32
+ if (process.env.NODE_ENV !== "production") {
33
+ log("Without await");
34
+ }
35
+ }
36
+
37
+ export function sync() {
38
+ if (process.env.NODE_ENV !== "production") {
39
+ log("Without async");
40
+ }
41
+ }
42
+ ```
43
+
44
+ ### Output
45
+
46
+ ```js
47
+ export function work() {
48
+ if (process.env.NODE_ENV !== "production") {
49
+ await import('./logger').then(m => m.log("Starting work"))
50
+ }
51
+
52
+ if (process.env.NODE_ENV !== "production") {
53
+ import('./logger').then(m => m.log("Without await"))
54
+ }
55
+ }
56
+
57
+ export function sync() {
58
+ if (process.env.NODE_ENV !== "production") {
59
+ import('./logger').then(m => m.log("Without async"))
60
+ }
61
+ }
62
+ ```
63
+
64
+ ## `markAsPure`
18
65
 
19
66
  ```js
20
67
  import { markAsPure } from "@swc/sdk";
@@ -24,6 +71,18 @@ markAsPure(() => console.log("This will be removed by the SWC minifier"));
24
71
 
25
72
  # @swc/plugin-swc-sdk
26
73
 
74
+ ## 11.1.1
75
+
76
+ ### Patch Changes
77
+
78
+ - 436381f: Fix jsx handling by using lazy init
79
+
80
+ ## 11.1.0
81
+
82
+ ### Minor Changes
83
+
84
+ - 1928974: Add a feature to make imports dynamic
85
+
27
86
  ## 11.0.0
28
87
 
29
88
  ### Major Changes
package/README.tmpl.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @swc/plugin-swc-sdk
2
2
 
3
- ## Usage
3
+ # Usage
4
4
 
5
5
  .swcrc:
6
6
 
@@ -14,7 +14,54 @@
14
14
  }
15
15
  ```
16
16
 
17
- ### `markAsPure`
17
+ ## `/*#__DYNAMIC__*/` on imports
18
+
19
+ You can annotate on a normal import statement to make it dynamic import.
20
+
21
+ ### Input
22
+
23
+ ```js
24
+ /*#__DYNAMIC__*/
25
+ import { log } from "./logger";
26
+
27
+ export async function work() {
28
+ if (process.env.NODE_ENV !== "production") {
29
+ await log("Starting work");
30
+ }
31
+
32
+ if (process.env.NODE_ENV !== "production") {
33
+ log("Without await");
34
+ }
35
+ }
36
+
37
+ export function sync() {
38
+ if (process.env.NODE_ENV !== "production") {
39
+ log("Without async");
40
+ }
41
+ }
42
+ ```
43
+
44
+ ### Output
45
+
46
+ ```js
47
+ export function work() {
48
+ if (process.env.NODE_ENV !== "production") {
49
+ await import('./logger').then(m => m.log("Starting work"))
50
+ }
51
+
52
+ if (process.env.NODE_ENV !== "production") {
53
+ import('./logger').then(m => m.log("Without await"))
54
+ }
55
+ }
56
+
57
+ export function sync() {
58
+ if (process.env.NODE_ENV !== "production") {
59
+ import('./logger').then(m => m.log("Without async"))
60
+ }
61
+ }
62
+ ```
63
+
64
+ ## `markAsPure`
18
65
 
19
66
  ```js
20
67
  import { markAsPure } from "@swc/sdk";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swc/plugin-swc-sdk",
3
- "version": "11.0.0",
3
+ "version": "11.1.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
Binary file