@lingui/swc-plugin 6.0.0-next.2 → 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
@@ -50,10 +50,9 @@ 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
53
+ //
54
+ // Optional. Controls which descriptor fields are preserved in output.
55
+ // "descriptorFields": "auto" (default) | "all" | "id-only" | "message"
57
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.
@@ -62,6 +61,15 @@ 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
+ // Lingui strips non-essential fields in production builds for performance.
65
+ // You can override the default behavior with:
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
+ // }
65
73
  },
66
74
  ],
67
75
  ],
@@ -70,6 +78,17 @@ https://swc.rs/docs/configuration/swcrc
70
78
  }
71
79
  ```
72
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
+
73
92
  Or Next JS Usage:
74
93
 
75
94
  `next.config.js`
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-next.3",
4
4
  "description": "A SWC Plugin for LinguiJS",
5
5
  "author": {
6
6
  "name": "Timofei Iatsenko",