@gringow/gringow-nextjs 0.2.0 → 0.2.2

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
@@ -9,7 +9,7 @@
9
9
 
10
10
  This package is in early development and provides basic functionality. For production use, consider:
11
11
  - **[@gringow/gringow-vite](https://www.npmjs.com/package/@gringow/gringow-vite)** - Production-ready Vite plugin
12
- - **[@gringow/cli](https://www.npmjs.com/package/@gringow/gringow-cli)** - CLI cache builder
12
+ - **[@gringow/gringow-cli](https://www.npmjs.com/package/@gringow/gringow-cli)** - CLI cache builder
13
13
 
14
14
  ## Features
15
15
 
@@ -47,7 +47,7 @@ yarn add @gringow/gringow-nextjs @gringow/gringow @gringow/gringow-react
47
47
  ```typescript
48
48
  // next.config.ts
49
49
  import type { NextConfig } from 'next'
50
- import GringowNextjsPlugin from '@gringow/gringow-nextjs'
50
+ import GringowNextjsPlugin from '@gringow/gringow-nextjs/plugin'
51
51
 
52
52
  const withGringow = GringowNextjsPlugin({
53
53
  debug: process.env.NODE_ENV === 'development'
@@ -69,8 +69,9 @@ export default withGringow(nextConfig)
69
69
  // gringow.config.js
70
70
  export default {
71
71
  llm: {
72
- choice: 'huggingface',
73
- model: 'Xenova/nllb-200-distilled-600M',
72
+ provider: 'openai',
73
+ apiKey: process.env.OPENAI_API_KEY,
74
+ model: 'gpt-4o-mini',
74
75
  },
75
76
  languages: ['pt-BR', 'es-ES', 'fr-CA'],
76
77
  sourceLanguage: 'en-US',
@@ -196,7 +197,6 @@ import { useEffect } from 'react'
196
197
  export function LanguageSwitcher() {
197
198
  useEffect(() => {
198
199
  // Initialize Gringow store on client
199
- import('@gringow/gringow-react/browser')
200
200
  import('@gringow/gringow-react/store').then(({ GringowStore }) => {
201
201
  GringowStore.cacheUrl = '/gringow/gringow.json'
202
202
  GringowStore.language = 'en-US'
@@ -292,11 +292,14 @@ pnpm run watch
292
292
 
293
293
  ## Related Packages
294
294
 
295
+ Gringow provides a complete ecosystem for AI-powered translation:
296
+
295
297
  - **[@gringow/gringow](https://www.npmjs.com/package/@gringow/gringow)** - Core translation library
296
- - **[@gringow/gringow-react](https://www.npmjs.com/package/@gringow/gringow-react)** - React bindings
297
- - **[@gringow/gringow-vite](https://www.npmjs.com/package/@gringow/gringow-vite)** - Production-ready Vite plugin (recommended)
298
+ - **[@gringow/gringow-vite](https://www.npmjs.com/package/@gringow/gringow-vite)** - Vite plugin for build-time extraction
299
+ - **[@gringow/gringow-react](https://www.npmjs.com/package/@gringow/gringow-react)** - React hooks and components
298
300
  - **[@gringow/gringow-shadow](https://www.npmjs.com/package/@gringow/gringow-shadow)** - Web Component layer
299
- - **[@gringow/cli](https://www.npmjs.com/package/@gringow/gringow-cli)** - CLI tool
301
+ - **[@gringow/gringow-cli](https://www.npmjs.com/package/@gringow/gringow-cli)** - CLI tool
302
+ - **[@gringow/gringow-nextjs](https://www.npmjs.com/package/@gringow/gringow-nextjs)** - Next.js plugin (experimental)
300
303
 
301
304
  ## Resources
302
305
 
@@ -6,7 +6,7 @@ import fs from 'fs/promises';
6
6
 
7
7
  // src/get-matches-in-code.ts
8
8
  function getMatchesInCode(code) {
9
- const regex = /g`((?:\\`|[^`])+)`/g;
9
+ const regex = /g(?:id)?`((?:\\`|[^`])+)`/g;
10
10
  return [...new Set([...code.matchAll(regex)].map(([, value = ""]) => value))];
11
11
  }
12
12
 
@@ -4,7 +4,7 @@ import fs from 'fs/promises';
4
4
 
5
5
  // src/get-matches-in-code.ts
6
6
  function getMatchesInCode(code) {
7
- const regex = /g`((?:\\`|[^`])+)`/g;
7
+ const regex = /g(?:id)?`((?:\\`|[^`])+)`/g;
8
8
  return [...new Set([...code.matchAll(regex)].map(([, value = ""]) => value))];
9
9
  }
10
10
 
@@ -1,6 +1,6 @@
1
1
  // src/get-matches-in-code.ts
2
2
  function getMatchesInCode(code) {
3
- const regex = /g`((?:\\`|[^`])+)`/g;
3
+ const regex = /g(?:id)?`((?:\\`|[^`])+)`/g;
4
4
  return [...new Set([...code.matchAll(regex)].map(([, value = ""]) => value))];
5
5
  }
6
6
 
@@ -6,7 +6,7 @@ import fs from 'fs/promises';
6
6
 
7
7
  // src/get-matches-in-code.ts
8
8
  function getMatchesInCode(code) {
9
- const regex = /g`((?:\\`|[^`])+)`/g;
9
+ const regex = /g(?:id)?`((?:\\`|[^`])+)`/g;
10
10
  return [...new Set([...code.matchAll(regex)].map(([, value = ""]) => value))];
11
11
  }
12
12
 
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import fs from 'fs/promises';
6
6
 
7
7
  // src/get-matches-in-code.ts
8
8
  function getMatchesInCode(code) {
9
- const regex = /g`((?:\\`|[^`])+)`/g;
9
+ const regex = /g(?:id)?`((?:\\`|[^`])+)`/g;
10
10
  return [...new Set([...code.matchAll(regex)].map(([, value = ""]) => value))];
11
11
  }
12
12
 
package/dist/plugin.mjs CHANGED
@@ -6,7 +6,7 @@ import fs from 'fs/promises';
6
6
 
7
7
  // src/get-matches-in-code.ts
8
8
  function getMatchesInCode(code) {
9
- const regex = /g`((?:\\`|[^`])+)`/g;
9
+ const regex = /g(?:id)?`((?:\\`|[^`])+)`/g;
10
10
  return [...new Set([...code.matchAll(regex)].map(([, value = ""]) => value))];
11
11
  }
12
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gringow/gringow-nextjs",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A Next.js plugin for Gringow AI-powered translation tool",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",
@@ -42,8 +42,8 @@
42
42
  "globby": "14.1.0",
43
43
  "react": "^19.2.0",
44
44
  "webpack": "^5.102.1",
45
- "@gringow/gringow": "0.2.0",
46
- "@gringow/gringow-react": "0.2.0"
45
+ "@gringow/gringow": "0.2.2",
46
+ "@gringow/gringow-react": "0.2.2"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "next": ">=15.0.0"