open-index/open-npm huggingface dataset:
npm package: @i18nflow/core
Description: Core interfaces and types for i18nflow
Author: erweixin
Latest version: 0.2.2-beta.0

# @i18nflow/core

核心接口和类型定义包。

## 功能

提供 i18nflow 的核心接口和类型定义：

- **ITransformAdapter**: Transform 适配器接口（编译时转换）
- **IRuntimeAdapter**: Runtime 适配器接口（运行时包装）
- **IFileAdapter**: 文件适配器接口（文件读写）
- **类型定义**: 框架类型、检测规则、配置类型等

## 安装

```bash
pnpm add @i18nflow/core
```

## 使用

```typescript
import type { ITransformAdapter, AdapterConfig } from '@i18nflow/core';

// 实现自定义适配器
class MyTransformAdapter implements ITransformAdapter {
  name = 'my-adapter';

  createBabelPlugin(config?: TransformAdapterConfig) {
    // 实现 Babel 插件
  }
}
```

## License

MIT
npm package: @i18nflow/react-i18next
Description: Complete react-i18next solution for i18nflow
Author: erweixin
Latest version: 0.2.2-beta.0

# @i18nflow/react-i18next

完整的 react-i18next 可视化调试解决方案。

> 🚧 **Beta 版本**: 目前处于 Beta 阶段，API 可能会发生变化。欢迎尝试并反馈问题。

## 特性

- ✨ **运行时 Proxy** - 自动为翻译内容添加 `data-i18n-key` 标记
- 🔧 **编译时转换** - Babel 插件自动识别 `t()` 调用和 `<Trans>` 组件
- 🎯 **可视化调试** - 按住快捷键点击翻译内容即可编辑
- 🚀 **即时生效** - 修改后自动写入文件并触发 HMR
- 🌍 **多框架支持** - 支持 Next.js、Vite 等主流框架

## 安装

```bash
pnpm add -D @i18nflow/react-i18next
```

## 快速开始

### Next.js

```typescript
// next.config.js
const { ReactI18nextNextPlugin } = require('@i18nflow/react-i18next/plugin-next');

module.exports = {
  // ... 其他配置
  webpack: (config, { dev }) => {
    if (dev) {
      config.plugins.push(
        new ReactI18nextNextPlugin({
          localeDir: 'src/i18n/locales',
          locales: ['zh-CN', 'en-US'],
        })
      );
    }
    return config;
  },
};
```

### Vite

```typescript
// vite.config.ts
import { ReactI18nextVitePlugin } from '@i18nflow/react-i18next/plugin-vite';

export default defineConfig({
  plugins: [
    ReactI18nextVitePlugin({
      localeDir: 'src/i18n/locales',
      locales: ['zh-CN', 'en-US'],
    }),
  ],
});
```

### 在应用中使用

#### 方式 1：自闭合标签（推荐 - 可在服务端组件中使用）

```tsx
import { I18nDebugProvider } from '@i18nflow/react-i18next';

// Next.js App Router - 保持服务端组件
export default function Layout({ children }) {
  return (
    <html>
      <body>
        {children}
        {/* 不需要包裹 children，使用自闭合标签 */}
        <I18nDebugProvider enabled={process.env.NODE_ENV === 'development'} />
      </body>
    </html>
  );
}
```

#### 方式 2：包裹 children（兼容旧版）

```tsx
'use client'; // 需要添加 'use client' 指令

import { I18nDebugProvider } from '@i18nflow/react-i18next';

function App() {
  return (
    <I18nDebugProvider enabled={process.env.NODE_ENV === 'development'}>
      {/* 你的应用 */}
    </I18nDebugProvider>
  );
}
```

## 工作原理

1. **编译时**：Babel 插件识别 `t()` 调用和 `<Trans>` 组件，提取翻译 key
2. **运行时**：Proxy 包装 i18next 实例，为翻译内容添加 `data-i18n-key` 属性
3. **交互时**：按住快捷键（Ctrl/Cmd）点击翻译内容，打开编辑弹窗
4. **更新时**：修改保存后，自动写入翻译文件并触发 HMR

## License

MIT
npm package: @i18nflow/shared
Description: Shared utilities and tools for i18nflow
Author: erweixin
Latest version: 0.2.2-beta.0

# @i18nflow/shared

通用工具和逻辑包。

## 功能

提供 i18nflow 的通用工具：

- **AST 工具**: Babel AST 解析、生成、遍历
- **文件工具**: 文件读写、路径解析
- **检测器**: i18n 方案检测引擎
- **Server 中间件**: Dev Server 中间件基础工具

## 安装

```bash
pnpm add @i18nflow/shared
```

## 使用

```typescript
import { parseCode, generateCode, detectInProject } from '@i18nflow/shared';

// 解析代码
const ast = parseCode('const a = 1;');

// 生成代码
const { code } = generateCode(ast);

// 检测项目
const detected = detectInProject(process.cwd(), [{ type: 'call', name: 'KiwiIntl.init' }]);
```

## License

MIT
npm package: @i18nflow/ui-react
Description: React UI components for i18nflow
Author: erweixin
Latest version: 0.2.2-beta.0

# @i18nflow/ui-react

React UI 组件包，提供可视化调试功能。

## 功能

- **I18nDebugProvider**: Context Provider，启用调试模式
- **I18nEditModal**: 编辑翻译的 Modal 组件
- **useI18nDebug**: 调试功能 Hook（读取/更新翻译、AI 翻译）

## 安装

```bash
pnpm add @i18nflow/ui-react
```

## 使用

```tsx
import { I18nDebugProvider } from '@i18nflow/ui-react';

function App() {
  return (
    <I18nDebugProvider enabled={process.env.NODE_ENV === 'development'}>
      {/* 你的应用 */}
    </I18nDebugProvider>
  );
}
```

### 使用 Hook

```tsx
import { useI18nDebug } from '@i18nflow/ui-react';

function MyComponent() {
  const { readI18nValue, updateI18nValue, translateText } = useI18nDebug();

  // 读取翻译
  const values = await readI18nValue('components.title');

  // 更新翻译
  await updateI18nValue('components.title', {
    'zh-CN': '标题',
    'en-US': 'Title',
  });

  // AI 翻译
  const translations = await translateText('你好', 3);
}
```

## 调试方式

1. 按住 `Ctrl + Shift`（Windows/Linux）或 `Cmd + Shift`（Mac）
2. 点击页面上的文案
3. 在弹出的 Modal 中编辑翻译
4. 保存后自动更新源文件并刷新页面

## License

MIT
npm package: @i18nflow/ui-vanilla
Description: Framework-agnostic UI for i18nflow debugging (Vanilla JS)
Author: erweixin
Latest version: 0.2.2-beta.0

# @i18nflow/ui-vanilla

Framework-agnostic debugging UI for i18nflow. Built with vanilla JavaScript, no dependencies on React, Vue, or any other framework.

## Features

- ✅ **Framework Agnostic** - Works with any framework or vanilla JS
- ✅ **Zero Dependencies** - No React, Vue, or other framework dependencies
- ✅ **Lightweight** - Small bundle size
- ✅ **TypeScript Support** - Full TypeScript definitions
- ✅ **Easy Integration** - Simple API, auto-injection support

## Installation

```bash
npm install @i18nflow/ui-vanilla
# or
pnpm add @i18nflow/ui-vanilla
```

## Usage

### Manual Initialization

```typescript
import { I18nDebugUI } from '@i18nflow/ui-vanilla';

// Create instance
const debugUI = new I18nDebugUI({
  enabled: process.env.NODE_ENV === 'development',
  apiBase: '/api/i18n', // optional, default: '/api/i18n'
});

// When you're done, you can destroy it
// debugUI.destroy();
```

### Convenience Method

```typescript
import { initI18nDebugUI } from '@i18nflow/ui-vanilla';

initI18nDebugUI({
  enabled: process.env.NODE_ENV === 'development',
});
```

## How It Works

1. Press and hold `Ctrl/Cmd + Shift`
2. Click on any text with `data-i18n-key` attribute
3. Edit the translation in the modal
4. Save and the page will auto-reload

## API

### `I18nDebugUI`

```typescript
class I18nDebugUI {
  constructor(options?: I18nDebugUIOptions);
  destroy(): void;
}

interface I18nDebugUIOptions {
  enabled?: boolean; // default: true
  apiBase?: string; // default: '/api/i18n'
}
```

### `initI18nDebugUI`

```typescript
function initI18nDebugUI(options?: { enabled?: boolean; apiBase?: string }): I18nDebugUI | null;
```

## License

MIT
npm package: @i18nguard/adapters
Description: Framework adapters for i18nGuard (i18next, FormatJS, Lingui)
Author: i18nGuard Team
Latest version: 1.0.3

# @i18nguard/adapters (beta)

Adapters for popular i18n libraries: i18next, FormatJS (react-intl), Lingui.

## Install

```sh
npm i @i18nguard/adapters@beta
```

## Usage with core

```ts
import { Scanner, mergeConfig } from '@i18nguard/core'
import { I18nextAdapter } from '@i18nguard/adapters/i18next'

const config = mergeConfig({
  library: 'i18next',
  src: ['src/**/*.{ts,tsx,js,jsx}'],
  locales: ['en', 'fr'],
  defaultLocale: 'en',
  catalogs: {
    i18next: {
      pathPattern: 'public/locales/{locale}/{ns}.json',
      namespaces: ['common']
    }
  },
})

const adapter = new I18nextAdapter()
const scanner = new Scanner(config, adapter)
const result = await scanner.scan()
```

### FormatJS example

```ts
import { FormatJSAdapter } from '@i18nguard/adapters/formatjs'

const config = mergeConfig({
  library: 'formatjs',
  src: ['src/**/*.{ts,tsx,js,jsx}'],
  locales: ['en', 'fr'],
  defaultLocale: 'en',
  catalogs: {
    formatjs: { messagesGlobs: ['public/locales/{locale}/messages.json'] }
  }
})
```

## License

MIT
npm package: @i18nguard/cli
Description: Command-line interface for i18nGuard
Author: i18nGuard Team
Latest version: 1.0.3

# @i18nguard/cli (beta)

Command-line interface for i18nGuard.

## Install

```sh
npm i -g @i18nguard/cli@beta
```

## Quick start

- Create `i18nscan.config.ts` (or .js/.mjs/.cjs/.json) at project root:

```ts
export default {
  library: 'i18next', // or 'formatjs' | 'lingui' | 'auto'
  src: ['src/**/*.{ts,tsx,js,jsx}'],
  locales: ['en', 'fr'],
  defaultLocale: 'en',
  catalogs: {
    i18next: {
      pathPattern: 'public/locales/{locale}/{ns}.json',
      namespaces: ['common']
    }
  },
  ignore: ['node_modules/**', 'dist/**'],
  keygen: { strategy: 'filePathSlug', maxLen: 60 },
  report: { formats: ['json'], outputDir: 'i18n-reports' }
}
```

- Run a scan (auto-detects config):

```sh
i18nguard scan
```

- Generate a report from a saved JSON:

```sh
i18nguard report -i i18n-reports/report.json -f html -o i18n-reports/report.html
```

## Troubleshooting

- If no files are scanned, adjust `src` globs and run from your project root.
- For i18next, ensure `catalogs.i18next.pathPattern` uses `{locale}` and `{ns}` and points to real files.
- For FormatJS, set `catalogs.formatjs.messagesGlobs` to match your message JSON files with `{locale}`.

## License

MIT
npm package: @i18nguard/core
Description: Core engine and rule system for i18nGuard
Author: i18nGuard Team
Latest version: 1.0.3

# @i18nguard/core (beta)

Core engine and rule system for i18nGuard.

## Install

```sh
npm i @i18nguard/core@beta
```

## Usage

Programmatic API example:

```ts
import { Scanner, mergeConfig } from '@i18nguard/core'
import { I18nextAdapter } from '@i18nguard/adapters/i18next'

const config = mergeConfig({
  library: 'i18next',
  src: ['src/**/*.{ts,tsx,js,jsx}'],
  locales: ['en', 'fr'],
  defaultLocale: 'en',
  catalogs: {
    i18next: {
      pathPattern: 'public/locales/{locale}/{ns}.json',
      namespaces: ['common']
    }
  },
  keygen: { strategy: 'filePathSlug', maxLen: 60 },
  report: { formats: ['json'], outputDir: 'i18n-reports' },
  budgets: { coverage: { en: 0.9, fr: 0.8 } },
  ignore: ['node_modules/**', 'dist/**']
})

const adapter = new I18nextAdapter()
const scanner = new Scanner(config, adapter)
const result = await scanner.scan()
console.log(result.summary)
```

## Config shape

See `I18nGuardConfig` in `src/types/index.ts` for full shape.

## License

MIT
npm package: @i18nguard/reporter
Description: Report generators for i18nGuard (JSON, SARIF, HTML)
Author: i18nGuard Team
Latest version: 1.0.3

# @i18nguard/reporter (beta)

Reports for i18nGuard: JSON, SARIF, HTML.

## Install

```sh
npm i @i18nguard/reporter@beta
```

## Usage

```ts
import { generateReport } from '@i18nguard/reporter'

// result: ScanResult from @i18nguard/core
await generateReport(result, 'json', 'i18n-reports/report.json')
await generateReport(result, 'html', 'i18n-reports/report.html')
```

## License

MIT
npm package: @i1k/memory-cache-client
Description: Memory cache client with the same interface as @ik/smart-cache-manager.
Author: Ivan Kazantsev
Latest version: 0.0.12

# @i1k/memory-cache-client

[![npm version](https://img.shields.io/npm/v/@i1k/memory-cache-client/latest.svg)](https://www.npmjs.com/package/@i1k/memory-cache-client)
[![codecov](https://codecov.io/gh/i1kazantsev/memory-cache-client/branch/main/graph/badge.svg?token=J9BZS9JURU)](https://codecov.io/gh/i1kazantsev/memory-cache-client)

Memory cache client with the same interface as [@i1k/smart-cache-manager](https://github.com/ivan1kazantsev/smart-cache-manager#readme).
Uses [lru-cache](https://github.com/isaacs/node-lru-cache#readme) under the hood.

## Installation

```bash
# using pnpm
pnpm i @i1k/memory-cache-client

# using npm
npm i @i1k/memory-cache-client
```

## Usage

```typescript
import MemoryCacheClient from '@i1k/memory-cache-client'

// supports all lru-cache options
const cacheClient = new MemoryCacheClient({ max: 10 })

cacheClient.set('key', 'value')
```

## API Reference

```typescript
interface ICacheClient {
  set: (key: string, value: string) => Promise<'OK'>
  get: (key: string) => Promise<string | null>
  del: (key: StringOrGlobPattern | StringOrGlobPattern[]) => Promise<string[]>
  clear: () => Promise<string[]>
  keys: (pattern: StringOrGlobPattern | StringOrGlobPattern[]) => Promise<string[]>
}
```

### set

To set a key-value pair.

```typescript
cacheClient.set('foo', 'bar')
// => Promise<'OK'>

cacheClient.set('foo/main', 'bar')
// => Promise<'OK'>
```

### get

To get a value by key.

```typescript
cacheClient.get('foo')
// => Promise<'bar'>

cacheClient.get('bar')
// => Promise<null>
```

### del

To delete a key-value pair by a specific key or a glob pattern.

```typescript
cacheClient.del('foo')
// => Promise<['foo']>

cacheClient.del('foo*')
// => Promise<['foo', 'foo/main']>

cacheClient.del(['foo', 'foo/*'])
// => Promise<['foo', 'foo/main']>
```

### clear

To clear the store.

```typescript
cacheClient.clear()
// => Promise<['foo', 'foo/main']>
```

### keys

To get keys by a specific key or a glob pattern.

```typescript
cacheClient.keys('foo')
// => Promise<['foo']>

cacheClient.keys('foo*')
// => Promise<['foo', 'foo/main']>

cacheClient.keys(['foo', 'foo/*'])
// => Promise<['foo', 'foo/main']>
```

## License

[MIT](./LICENSE)
npm package: @i1k/redis-cache-client
Description: Redis cache client with the same interface as @ik/smart-cache-manager.
Author: Ivan Kazantsev
Latest version: 0.0.11

# @i1k/redis-cache-client

[![npm version](https://img.shields.io/npm/v/@i1k/redis-cache-client/latest.svg)](https://www.npmjs.com/package/@i1k/redis-cache-client)
[![codecov](https://codecov.io/gh/i1kazantsev/redis-cache-client/branch/main/graph/badge.svg?token=4HOPG3NH5Z)](https://codecov.io/gh/i1kazantsev/redis-cache-client)

Redis cache client with the same interface as [@i1k/smart-cache-manager](https://github.com/ivan1kazantsev/smart-cache-manager#readme).
Uses [ioredis](https://github.com/luin/ioredis#readme) under the hood.

## Installation

```bash
# using pnpm
pnpm i @i1k/redis-cache-client

# using npm
npm i @i1k/redis-cache-client
```

## Usage

```typescript
import RedisCacheClient from '@i1k/redis-cache-client'

// supports all ioredis options
const cacheClient = new RedisCacheClient()

cacheClient.set('key', 'value')
```

## API Reference

```typescript
interface ICacheClient {
  set: (key: string, value: string) => Promise<'OK'>
  get: (key: string) => Promise<string | null>
  del: (key: StringOrGlobPattern | StringOrGlobPattern[]) => Promise<string[]>
  clear: () => Promise<string[]>
  keys: (pattern: StringOrGlobPattern | StringOrGlobPattern[]) => Promise<string[]>
}
```

### set

To set a key-value pair.

```typescript
cacheClient.set('foo', 'bar')
// => Promise<'OK'>

cacheClient.set('foo/main', 'bar')
// => Promise<'OK'>
```

### get

To get a value by key.

```typescript
cacheClient.get('foo')
// => Promise<'bar'>

cacheClient.get('bar')
// => Promise<null>
```

### del

To delete a key-value pair by a specific key or a glob pattern.

```typescript
cacheClient.del('foo')
// => Promise<['foo']>

cacheClient.del('foo*')
// => Promise<['foo', 'foo/main']>

cacheClient.del(['foo', 'foo/*'])
// => Promise<['foo', 'foo/main']>
```

### clear

To clear the store.

```typescript
cacheClient.clear()
// => Promise<['foo', 'foo/main']>
```

### keys

To get keys by a specific key or a glob pattern.

```typescript
cacheClient.keys('foo')
// => Promise<['foo']>

cacheClient.keys('foo*')
// => Promise<['foo', 'foo/main']>

cacheClient.keys(['foo', 'foo/*'])
// => Promise<['foo', 'foo/main']>
```

## License

[MIT](./LICENSE)