@swc/plugin-swc-sdk 11.0.0 → 11.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @swc/plugin-swc-sdk
2
2
 
3
+ ## 11.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1928974: Add a feature to make imports dynamic
8
+
3
9
  ## 11.0.0
4
10
 
5
11
  ### 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,12 @@ markAsPure(() => console.log("This will be removed by the SWC minifier"));
24
71
 
25
72
  # @swc/plugin-swc-sdk
26
73
 
74
+ ## 11.1.0
75
+
76
+ ### Minor Changes
77
+
78
+ - 1928974: Add a feature to make imports dynamic
79
+
27
80
  ## 11.0.0
28
81
 
29
82
  ### 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.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
Binary file