@nkzw/eslint-plugin-fbtee 3.3.0 → 4.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 +8 -26
- package/lib/index.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,14 +10,14 @@ const Greeting = ({ name }) => (
|
|
|
10
10
|
);
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
_fbtee_ is a modern continuation of Facebook's `fbt`, rebuilt for TypeScript, ESM, React 19, Vite, Next.js,
|
|
13
|
+
_fbtee_ is a modern continuation of Facebook's `fbt`, rebuilt for TypeScript, ESM, React 19, Vite, Next.js, and Oxc.
|
|
14
14
|
|
|
15
15
|
## Features
|
|
16
16
|
|
|
17
17
|
- **Inline translations for Better Developer Experience:** Embed translations directly into your code. No need to manage translation keys or wrap your code with `t()` functions. **fbtee** uses a compiler to extract strings from your code and prepare them for translation providers.
|
|
18
18
|
- **Proven in Production:** Built on Facebook's `fbt`, with over a decade of production usage serving billions of users, plus years in production at [Athena Crisis](https://athenacrisis.com).
|
|
19
19
|
- **Optimized Performance with IR:** Compiles translations into an Intermediate Representation (IR) for extracting strings, then optimizes the runtime output for performance.
|
|
20
|
-
- **Easy Setup:** Quick integration with Vite, Next.js,
|
|
20
|
+
- **Easy Setup:** Quick integration with Vite, Next.js, Oxc, and Expo.
|
|
21
21
|
|
|
22
22
|
## Getting Started
|
|
23
23
|
|
|
@@ -87,22 +87,6 @@ export default withFbtee({
|
|
|
87
87
|
|
|
88
88
|
The plugin runs the native Oxc transform before Next.js compilation. It works with the default Turbopack compiler and with `next build --webpack`, so it does not require Babel or custom compiler configuration.
|
|
89
89
|
|
|
90
|
-
### Babel
|
|
91
|
-
|
|
92
|
-
Install the Babel preset and the CLI:
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
npm install -D @nkzw/babel-preset-fbtee @nkzw/fbtee-cli
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
Add the preset to your Babel configuration:
|
|
99
|
-
|
|
100
|
-
```js
|
|
101
|
-
export default {
|
|
102
|
-
presets: ['@nkzw/babel-preset-fbtee'],
|
|
103
|
-
};
|
|
104
|
-
```
|
|
105
|
-
|
|
106
90
|
### Low-level Oxc Transform
|
|
107
91
|
|
|
108
92
|
For custom build-system integrations, install the native Oxc transform:
|
|
@@ -325,18 +309,16 @@ See the [Next.js fbtee example](https://github.com/cpojer/nextjs-fbtee-example)
|
|
|
325
309
|
|
|
326
310
|
## Translation Workflow
|
|
327
311
|
|
|
328
|
-
|
|
312
|
+
The CLI is a native Rust executable and uses the Oxc compiler pipeline by default:
|
|
329
313
|
|
|
330
314
|
```bash
|
|
331
|
-
pnpm fbtee collect
|
|
332
|
-
pnpm fbtee prepare-translations --
|
|
333
|
-
pnpm fbtee translate --
|
|
334
|
-
pnpm fbtee migrate-locales --
|
|
315
|
+
pnpm fbtee collect
|
|
316
|
+
pnpm fbtee prepare-translations --source-strings source_strings.json --output-dir translations
|
|
317
|
+
pnpm fbtee translate --source-strings source_strings.json --translations 'translations/*.json' --output-dir src/translations
|
|
318
|
+
pnpm fbtee migrate-locales --to bcp47 --dir translations --dir src/translations
|
|
335
319
|
```
|
|
336
320
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
The Oxc collector also cannot run plugins or presets from a Babel configuration file or apply `.babelignore`. If it detects Babel configuration or ignore rules, it stops instead of silently collecting different source. Use the Babel collector when that preprocessing is required, or pass `--disable-babel-config` to explicitly collect the unmodified source with Oxc. All other documented options are supported.
|
|
321
|
+
fbtee 4 removes the legacy Babel compiler and JavaScript CLI. Babel-specific extensions (`--custom-collector`, `--transform`, `--generate-fbt-nodes`, and `--hash-module`) are no longer supported. The collector also cannot execute Babel configuration or apply `.babelignore`; it stops with a clear diagnostic if either is detected. Remove that legacy configuration, or pass `--disable-babel-config` to explicitly collect the unmodified source.
|
|
340
322
|
|
|
341
323
|
Extract source strings:
|
|
342
324
|
|
package/lib/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
2
|
//#region package.json
|
|
3
3
|
var name = "@nkzw/eslint-plugin-fbtee";
|
|
4
|
-
var version = "
|
|
4
|
+
var version = "4.0.0";
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/utils.tsx
|
|
7
7
|
const createRule = ESLintUtils.RuleCreator((name) => `https://github.com/nkzw-tech/fbtee/blob/main/packages/eslint-plugin-fbtee/docs/rules/${name}.md`);
|