Skip to content

Commit

Permalink
Add the auto-import plugin to the default collector.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpojer committed Dec 12, 2024
1 parent b56aa10 commit b1f9247
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nkzw/fbtee-internal",
"version": "0.0.3",
"version": "0.0.4",
"private": true,
"license": "MIT",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-fbtee/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nkzw/babel-fbtee",
"version": "0.0.3",
"version": "0.0.4",
"description": "The JavaScript & React Internationalization Framework.",
"keywords": [
"fbt",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-fbtee-auto-import/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nkzw/babel-plugin-fbtee-auto-import",
"version": "0.0.3",
"version": "0.0.4",
"description": "The JavaScript & React Internationalization Framework.",
"keywords": [
"fbt",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-fbtee-runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nkzw/babel-plugin-fbtee-runtime",
"version": "0.0.3",
"version": "0.0.4",
"description": "The JavaScript & React Internationalization Framework.",
"keywords": [
"fbt",
Expand Down
3 changes: 2 additions & 1 deletion packages/babel-plugin-fbtee/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nkzw/babel-plugin-fbtee",
"version": "0.0.3",
"version": "0.0.4",
"description": "The JavaScript & React Internationalization Framework.",
"keywords": [
"fbt",
Expand Down Expand Up @@ -35,6 +35,7 @@
"@babel/preset-typescript": "^7.26.0",
"@babel/traverse": "^7.26.4",
"@babel/types": "^7.26.3",
"@nkzw/babel-plugin-fbtee-auto-import": "workspace:*",
"glob": "^11.0.0",
"invariant": "^2.2.4",
"jest-docblock": "^30.0.0-alpha.6",
Expand Down
3 changes: 2 additions & 1 deletion packages/babel-plugin-fbtee/src/bin/FbtCollector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { PluginItem } from '@babel/core';
import { transformSync } from '@babel/core';
import presetReact from '@babel/preset-react';
import presetTypescript from '@babel/preset-typescript';
import fbtAutoImport from '@nkzw/babel-plugin-fbtee-auto-import';
import type { PlainFbtNode } from '../fbt-nodes/FbtNode.tsx';
import { FbtCommonMap } from '../FbtCommon.tsx';
import type { FbtOptionConfig } from '../FbtConstants.tsx';
Expand Down Expand Up @@ -71,7 +72,7 @@ const transform = (
ast: false,
code: false,
filename: options.filename,
plugins: [[fbt, options], ...plugins],
plugins: [fbtAutoImport, [fbt, options], ...plugins],
presets: [
presetTypescript,
[
Expand Down
18 changes: 8 additions & 10 deletions packages/babel-plugin-fbtee/src/bin/collect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,15 @@ if (argv.help) {
? (await import(transformPath)).default
: null;

const commonFile = argv[args.COMMON_STRINGS];
const commonFile = argv[args.COMMON_STRINGS]?.length
? resolve(process.cwd(), argv[args.COMMON_STRINGS])
: null;
const fbtCommon = commonFile?.length
? (
await import(
resolve(process.cwd(), commonFile),
commonFile.endsWith('.json')
? {
with: { type: 'json' },
}
: {}
)
? (commonFile.endsWith('.json')
? await import(commonFile, {
with: { type: 'json' },
})
: await import(commonFile)
).default
: null;

Expand Down
2 changes: 1 addition & 1 deletion packages/fbtee/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fbtee",
"version": "0.0.3",
"version": "0.0.4",
"description": "The JavaScript & React Internationalization Framework.",
"keywords": [
"fbt",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b1f9247

Please sign in to comment.