@lingui/swc-plugin 6.0.0-next.1 → 6.0.0-next.3

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div align="center">
4
4
 
5
- A Rust versions of [LinguiJS Macro](https://lingui.dev/ref/macro) [<img src="https://img.shields.io/badge/beta-yellow"/>](https://github.com/lingui/swc-plugin)
5
+ A Rust version of [LinguiJS Macro](https://lingui.dev/ref/macro) [<img src="https://img.shields.io/badge/beta-yellow"/>](https://github.com/lingui/swc-plugin)
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/@lingui/swc-plugin?logo=npm&cacheSeconds=1800)](https://www.npmjs.com/package/@lingui/swc-plugin)
8
8
  [![npm](https://img.shields.io/npm/dt/@lingui/swc-plugin?cacheSeconds=500)](https://www.npmjs.com/package/@lingui/swc-plugin)
@@ -50,9 +50,26 @@ https://swc.rs/docs/configuration/swcrc
50
50
  // "i18n": ["@lingui/core", "i18n"],
51
51
  // "trans": ["@lingui/react", "Trans"]
52
52
  // }
53
+ //
54
+ // Optional. Controls which descriptor fields are preserved in output.
55
+ // "descriptorFields": "auto" (default) | "all" | "id-only" | "message"
56
+
57
+ // Compatibility option allows to use v6.* SWC Plugin release channel with @lingui/cli@5.*
58
+ // Controls the BASE64 alphabet used for generating message IDs.
59
+ // - false (default): Uses URL-safe BASE64 alphabet (Lingui v6 behavior)
60
+ // - true: Uses standard BASE64 alphabet (Lingui v5 behavior for compatibility)
61
+ //
62
+ // IMPORTANT: This option is temporal and will be removed in the next major release.
63
+ // "useLinguiV5IdGeneration": true
53
64
  // Lingui strips non-essential fields in production builds for performance.
54
65
  // You can override the default behavior with:
55
66
  // "stripNonEssentialFields": false/true
67
+ // To configure custom JSX placeholder attribute and its defaults:
68
+ // "jsxPlaceholderAttribute": "_t",
69
+ // "jsxPlaceholderDefaults": {
70
+ // "a": "link",
71
+ // "em": "em"
72
+ // }
56
73
  },
57
74
  ],
58
75
  ],
@@ -61,6 +78,17 @@ https://swc.rs/docs/configuration/swcrc
61
78
  }
62
79
  ```
63
80
 
81
+ ### `descriptorFields`
82
+
83
+ Controls which fields are preserved in the transformed message descriptors. Accepts one of:
84
+
85
+ - **`"auto"`** (default) — In production (`NODE_ENV=production`), behaves like `"id-only"`. Otherwise, behaves like `"all"`.
86
+ - **`"all"`** — Keeps `id`, `message`, `context`, and `comment`. Use this for extraction (replaces the old `extract: true` from the Babel plugin).
87
+ - **`"id-only"`** — Keeps only the `id`. Most optimized for production bundles.
88
+ - **`"message"`** — Keeps `id`, `message`, and `context` (but not `comment`). Useful when you need message content at runtime.
89
+
90
+ Check [this article](https://lingui.dev/guides/optimizing-bundle-size) for more info about this configuration.
91
+
64
92
  Or Next JS Usage:
65
93
 
66
94
  `next.config.js`
@@ -127,6 +155,7 @@ To learn more about SWC Plugins compatibility check this issue https://github.co
127
155
  - Version `0.1.0` ~ `0.*` compatible with `@lingui/core@3.*`
128
156
  - Version `4.*` compatible with `@lingui/core@4.*`
129
157
  - Version `5.*` compatible with `@lingui/core@5.*`
158
+ - Version `6.*` compatible with `@lingui/core@5.*` with `useLinguiV5IdGeneration: true` and `@lingui/core@6.*`
130
159
 
131
160
  ## License
132
161
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/swc-plugin",
3
- "version": "6.0.0-next.1",
3
+ "version": "6.0.0-next.3",
4
4
  "description": "A SWC Plugin for LinguiJS",
5
5
  "author": {
6
6
  "name": "Timofei Iatsenko",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "files": [],
33
33
  "peerDependencies": {
34
- "@lingui/core": "6"
34
+ "@lingui/core": "5 || 6"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "@swc/core": {