@lingui/swc-plugin 6.0.0-next.2 → 6.0.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/README.md CHANGED
@@ -50,11 +50,10 @@ https://swc.rs/docs/configuration/swcrc
50
50
  // "i18n": ["@lingui/core", "i18n"],
51
51
  // "trans": ["@lingui/react", "Trans"]
52
52
  // }
53
- // Lingui strips non-essential fields in production builds for performance.
54
- // Docs https://lingui.dev/guides/optimizing-bundle-size
55
- // You can override the default behavior with:
56
- // "stripNonEssentialFields": false/true
57
-
53
+ //
54
+ // Optional. Controls which descriptor fields are preserved in output.
55
+ // "descriptorFields": "auto" (default) | "all" | "id-only" | "message"
56
+ //
58
57
  // Compatibility option allows to use v6.* SWC Plugin release channel with @lingui/cli@5.*
59
58
  // Controls the BASE64 alphabet used for generating message IDs.
60
59
  // - false (default): Uses URL-safe BASE64 alphabet (Lingui v6 behavior)
@@ -62,6 +61,13 @@ https://swc.rs/docs/configuration/swcrc
62
61
  //
63
62
  // IMPORTANT: This option is temporal and will be removed in the next major release.
64
63
  // "useLinguiV5IdGeneration": true
64
+ //
65
+ // To configure custom JSX placeholder attribute and its defaults:
66
+ // "jsxPlaceholderAttribute": "_t",
67
+ // "jsxPlaceholderDefaults": {
68
+ // "a": "link",
69
+ // "em": "em"
70
+ // }
65
71
  },
66
72
  ],
67
73
  ],
@@ -70,6 +76,17 @@ https://swc.rs/docs/configuration/swcrc
70
76
  }
71
77
  ```
72
78
 
79
+ ### `descriptorFields`
80
+
81
+ Controls which fields are preserved in the transformed message descriptors. Accepts one of:
82
+
83
+ - **`"auto"`** (default) — In production (`NODE_ENV=production`), behaves like `"id-only"`. Otherwise, behaves like `"all"`.
84
+ - **`"all"`** — Keeps `id`, `message`, `context`, and `comment`. Use this for extraction (replaces the old `extract: true` from the Babel plugin).
85
+ - **`"id-only"`** — Keeps only the `id`. Most optimized for production bundles.
86
+ - **`"message"`** — Keeps `id`, `message`, and `context` (but not `comment`). Useful when you need message content at runtime.
87
+
88
+ Check [this article](https://lingui.dev/guides/optimizing-bundle-size) for more info about this configuration.
89
+
73
90
  Or Next JS Usage:
74
91
 
75
92
  `next.config.js`
@@ -102,29 +119,29 @@ Below is a table referencing the `swc_core` version used during the plugin build
102
119
 
103
120
  To learn more about SWC Plugins compatibility check this issue https://github.com/lingui/swc-plugin/issues/179
104
121
 
105
- | Plugin Version | used `swc_core` |
106
- |---------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
107
- | `0.1.0`, `4.0.0-next.0` | `0.52.8` |
108
- | `0.2.*`, `4.0.0-next.1` ~ `4.0.0-next.3` | `0.56.1` |
109
- | `4.0.0` | `0.75.33` |
110
- | `4.0.1` | `0.76.0` |
111
- | `4.0.2` | `0.76.41` |
112
- | `4.0.3` | `0.78.28` |
113
- | `4.0.4` | `0.79.x` |
114
- | `4.0.5`, `4.0.6` | [`0.87.x`](https://plugins.swc.rs/versions/range/10) |
115
- | `4.0.7`, `4.0.8`, `5.0.0-next.0` ~ `5.0.0-next.1` | [`0.90.35`](https://plugins.swc.rs/versions/range/12) |
116
- | `4.0.9` | [`0.96.9`](https://plugins.swc.rs/versions/range/15) |
117
- | `4.0.10` | [`0.101.4`](https://plugins.swc.rs/versions/range/94) |
118
- | `4.1.0`, `5.0.0` ~ `5.2.0` | [`0.106.3`](https://plugins.swc.rs/versions/range/95) |
119
- | `5.3.0` | [`5.0.4`](https://plugins.swc.rs/versions/range/116) |
120
- | `5.4.0` | [`14.1.0`](https://plugins.swc.rs/versions/range/138) |
121
- | `5.5.0` ~ `5.5.2` | [`15.0.1`](https://plugins.swc.rs/versions/range/271) |
122
- | `5.6.0` ~ `5.6.1` | [`27.0.6`](https://plugins.swc.rs/versions/range/364) |
123
- | `5.7.0` | [`39.0.3`](https://plugins.swc.rs/versions/range/426) |
124
- | `5.8.0` | [`45.0.2`](https://plugins.swc.rs/versions/range/497) |
125
- | `5.9.0` | [`46.0.3`](https://plugins.swc.rs/versions/range/713) |
126
- | `5.10.0` | [`50.2.3`](https://plugins.swc.rs/versions/range/768) |
127
- | `5.10.1`, `5.11.0` | [`50.2.3`](https://plugins.swc.rs/versions/range/768) with [`--cfg=swc_ast_unknown`](https://swc.rs/docs/plugin/ecmascript/compatibility#make-your-plugin-compatible) |
122
+ | Plugin Version | used `swc_core` |
123
+ |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
124
+ | `0.1.0`, `4.0.0-next.0` | `0.52.8` |
125
+ | `0.2.*`, `4.0.0-next.1` ~ `4.0.0-next.3` | `0.56.1` |
126
+ | `4.0.0` | `0.75.33` |
127
+ | `4.0.1` | `0.76.0` |
128
+ | `4.0.2` | `0.76.41` |
129
+ | `4.0.3` | `0.78.28` |
130
+ | `4.0.4` | `0.79.x` |
131
+ | `4.0.5`, `4.0.6` | [`0.87.x`](https://plugins.swc.rs/versions/range/10) |
132
+ | `4.0.7`, `4.0.8`, `5.0.0-next.0` ~ `5.0.0-next.1` | [`0.90.35`](https://plugins.swc.rs/versions/range/12) |
133
+ | `4.0.9` | [`0.96.9`](https://plugins.swc.rs/versions/range/15) |
134
+ | `4.0.10` | [`0.101.4`](https://plugins.swc.rs/versions/range/94) |
135
+ | `4.1.0`, `5.0.0` ~ `5.2.0` | [`0.106.3`](https://plugins.swc.rs/versions/range/95) |
136
+ | `5.3.0` | [`5.0.4`](https://plugins.swc.rs/versions/range/116) |
137
+ | `5.4.0` | [`14.1.0`](https://plugins.swc.rs/versions/range/138) |
138
+ | `5.5.0` ~ `5.5.2` | [`15.0.1`](https://plugins.swc.rs/versions/range/271) |
139
+ | `5.6.0` ~ `5.6.1` | [`27.0.6`](https://plugins.swc.rs/versions/range/364) |
140
+ | `5.7.0` | [`39.0.3`](https://plugins.swc.rs/versions/range/426) |
141
+ | `5.8.0` | [`45.0.2`](https://plugins.swc.rs/versions/range/497) |
142
+ | `5.9.0` | [`46.0.3`](https://plugins.swc.rs/versions/range/713) |
143
+ | `5.10.0` | [`50.2.3`](https://plugins.swc.rs/versions/range/768) |
144
+ | `5.10.1` ~ `*` <br/> Starting from this version Wasm plugins are compatible between `@swc/core` versions to some extent. Read more [here](https://swc.rs/docs/plugin/ecmascript/compatibility#make-your-plugin-compatible). | [`50.2.3`](https://plugins.swc.rs/versions/range/768) with [`--cfg=swc_ast_unknown`](https://swc.rs/docs/plugin/ecmascript/compatibility#make-your-plugin-compatible) |
128
145
 
129
146
 
130
147
  > **Note**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/swc-plugin",
3
- "version": "6.0.0-next.2",
3
+ "version": "6.0.0",
4
4
  "description": "A SWC Plugin for LinguiJS",
5
5
  "author": {
6
6
  "name": "Timofei Iatsenko",
@@ -19,7 +19,7 @@
19
19
  "icu",
20
20
  "message-format",
21
21
  "i18n",
22
- "internalization"
22
+ "internationalization"
23
23
  ],
24
24
  "main": "target/wasm32-wasip1/release/lingui_macro_plugin.wasm",
25
25
  "exports": {