@lingui/swc-plugin 6.2.0 → 6.3.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
@@ -56,7 +56,7 @@ module.exports = nextConfig;
56
56
  ```
57
57
 
58
58
  > **Note**
59
- > Consult with full working example for NextJS in the `/examples` folder in this repo.
59
+ > Consult with [full working example](https://github.com/lingui/js-lingui/tree/main/examples/nextjs-swc) for NextJS with SWC.
60
60
 
61
61
  #### `vite.config.ts`
62
62
 
@@ -128,6 +128,18 @@ When using SWC directly via CLI or a JSON-only configuration, pass options manua
128
128
 
129
129
  ## Options
130
130
 
131
+ ### `corePackage`
132
+
133
+ Defines which module specifiers the plugin should treat as core macro imports.
134
+
135
+ Defaults to `[@lingui/macro, @lingui/core/macro]` for backwards compatibility with the legacy combined macro entrypoint.
136
+
137
+ ### `jsxPackage`
138
+
139
+ Defines which module specifiers the plugin should treat as JSX macro imports.
140
+
141
+ Defaults to `[@lingui/macro, @lingui/react/macro]` for backwards compatibility with the legacy combined macro entrypoint.
142
+
131
143
  ### `descriptorFields`
132
144
 
133
145
  Controls which fields are preserved in the transformed message descriptors. Accepts one of:
package/dist/options.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  export type RuntimeModuleConfig = readonly [modulePath: string, exportName?: string];
2
2
  /** Options accepted by the `@lingui/swc-plugin` WASM plugin. */
3
3
  export type LinguiMacroOptions = {
4
+ /** Module specifiers treated as core macro imports, such as `t`, `msg`, and `defineMessage`. */
5
+ corePackage?: string[];
6
+ /** Module specifiers treated as JSX macro imports, such as `Trans` and `useLingui`. */
7
+ jsxPackage?: string[];
4
8
  /** JSX attribute name used to provide explicit placeholder names inside `<Trans>` content. */
5
9
  jsxPlaceholderAttribute?: string;
6
10
  /** Default placeholder names for JSX tags when no explicit placeholder attribute is present. */
@@ -60,4 +64,4 @@ export type GetConfigOptions = {
60
64
  * @param overrides - Plugin options merged over values derived from the Lingui config.
61
65
  * @param configOptions - Controls how the Lingui config is discovered or loaded.
62
66
  */
63
- export declare function linguiMacroSwcPlugin(overrides?: DeepPartial<LinguiMacroOptions>, configOptions?: GetConfigOptions): (string | LinguiMacroOptions)[];
67
+ export declare function linguiMacroSwcPlugin(overrides?: DeepPartial<LinguiMacroOptions>, configOptions?: GetConfigOptions): [wasmPackage: string, config: LinguiMacroOptions];
package/dist/options.js CHANGED
@@ -19,6 +19,8 @@ import { getConfig } from "@lingui/conf";
19
19
  export function linguiMacroSwcPlugin(overrides, configOptions = {}) {
20
20
  const config = getConfig(configOptions);
21
21
  const macroOptions = {
22
+ corePackage: config.macro.corePackage,
23
+ jsxPackage: config.macro.jsxPackage,
22
24
  jsxPlaceholderAttribute: config.macro.jsxPlaceholderAttribute,
23
25
  jsxPlaceholderDefaults: config.macro.jsxPlaceholderDefaults,
24
26
  ...overrides,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/swc-plugin",
3
- "version": "6.2.0",
3
+ "version": "6.3.0",
4
4
  "description": "A SWC Plugin for LinguiJS",
5
5
  "author": {
6
6
  "name": "Timofei Iatsenko",