@swc/plugin-swc-sdk 10.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 +12 -0
- package/README.md +61 -2
- package/README.tmpl.md +49 -2
- package/package.json +1 -1
- package/swc_plugin_swc_sdk.wasm +0 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @swc/plugin-swc-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# Usage
|
|
4
4
|
|
|
5
5
|
.swcrc:
|
|
6
6
|
|
|
@@ -14,7 +14,54 @@
|
|
|
14
14
|
}
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
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.0
|
|
75
|
+
|
|
76
|
+
### Minor Changes
|
|
77
|
+
|
|
78
|
+
- 1928974: Add a feature to make imports dynamic
|
|
79
|
+
|
|
80
|
+
## 11.0.0
|
|
81
|
+
|
|
82
|
+
### Major Changes
|
|
83
|
+
|
|
84
|
+
- 593f438: Update swc_core to v47
|
|
85
|
+
|
|
27
86
|
## 10.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
|
-
|
|
3
|
+
# Usage
|
|
4
4
|
|
|
5
5
|
.swcrc:
|
|
6
6
|
|
|
@@ -14,7 +14,54 @@
|
|
|
14
14
|
}
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
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
package/swc_plugin_swc_sdk.wasm
CHANGED
|
Binary file
|