@astroscope/i18n 0.3.4 → 0.4.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 +17 -0
- package/dist/{chunk-A2XW2S6Z.js → chunk-IJXSX5DY.js} +1 -3
- package/dist/{chunk-P4IZCU3H.js → chunk-LXW5WYBS.js} +5 -0
- package/dist/extraction/index.js +1 -1
- package/dist/index.js +2 -2
- package/dist/internal.js +1 -1
- package/dist/server/translate.js +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -421,6 +421,23 @@ For `:currency` and `:unit`, the required option (`currency` or `unit`) can be:
|
|
|
421
421
|
- `'throw'` — Throw an error
|
|
422
422
|
- `(key, meta) => string` — Custom function
|
|
423
423
|
|
|
424
|
+
## ESLint Plugin
|
|
425
|
+
|
|
426
|
+
Use [`@astroscope/eslint-plugin-i18n`](../eslint-plugin-i18n) to enforce correct `t()` usage, catch build-time extraction issues, and ensure i18n-aware hydration directives.
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
npm install -D @astroscope/eslint-plugin-i18n
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
```js
|
|
433
|
+
// eslint.config.js
|
|
434
|
+
import i18n from '@astroscope/eslint-plugin-i18n';
|
|
435
|
+
|
|
436
|
+
export default [
|
|
437
|
+
i18n.configs.recommended,
|
|
438
|
+
];
|
|
439
|
+
```
|
|
440
|
+
|
|
424
441
|
## License
|
|
425
442
|
|
|
426
443
|
MIT
|
|
@@ -313,7 +313,6 @@ function i18nVitePlugin(options) {
|
|
|
313
313
|
state.version++;
|
|
314
314
|
};
|
|
315
315
|
let isBuild = false;
|
|
316
|
-
let isSSR = false;
|
|
317
316
|
let projectRoot = "";
|
|
318
317
|
return {
|
|
319
318
|
name: "@astroscope/i18n/extract",
|
|
@@ -322,7 +321,6 @@ function i18nVitePlugin(options) {
|
|
|
322
321
|
const state = getGlobalState();
|
|
323
322
|
state.projectRoot = config.root;
|
|
324
323
|
isBuild = config.command === "build";
|
|
325
|
-
isSSR = !!config.build.ssr;
|
|
326
324
|
projectRoot = config.root;
|
|
327
325
|
},
|
|
328
326
|
async configureServer(server) {
|
|
@@ -459,7 +457,7 @@ export function getManifest() { return _getManifest(); }
|
|
|
459
457
|
}
|
|
460
458
|
},
|
|
461
459
|
writeBundle(outputOptions) {
|
|
462
|
-
if (
|
|
460
|
+
if (this.environment.name === "client" && outputOptions.dir) {
|
|
463
461
|
const chunksDir = path.resolve(outputOptions.dir, "..", "server", "chunks");
|
|
464
462
|
const manifestPath = path.join(chunksDir, MANIFEST_FILE_NAME);
|
|
465
463
|
if (fs2.existsSync(chunksDir)) {
|
|
@@ -113,6 +113,11 @@ var I18nSingleton = class {
|
|
|
113
113
|
this.compiledCache.delete(locale);
|
|
114
114
|
this.hashCache.delete(locale);
|
|
115
115
|
this.scriptCache.delete(locale);
|
|
116
|
+
for (const key of this.chunkCache.keys()) {
|
|
117
|
+
if (key.startsWith(`${locale}:`)) {
|
|
118
|
+
this.chunkCache.delete(key);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
116
121
|
const { chunks } = this.getManifest();
|
|
117
122
|
if (Object.keys(chunks).length > 0) {
|
|
118
123
|
this.hashCache.set(locale, computeAllChunkHashes(raw, chunks));
|
package/dist/extraction/index.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
i18nVitePlugin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IJXSX5DY.js";
|
|
4
4
|
import {
|
|
5
5
|
i18n,
|
|
6
6
|
runWithContext
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LXW5WYBS.js";
|
|
8
8
|
import "./chunk-33JVAFGQ.js";
|
|
9
9
|
import "./chunk-FYKC3DAZ.js";
|
|
10
10
|
import "./chunk-4A5BKHFN.js";
|
package/dist/internal.js
CHANGED
package/dist/server/translate.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astroscope/i18n",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "i18n for Astro + React islands — MessageFormat 2, automatic tree-shaking, parallel loading, any translation source",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -88,23 +88,23 @@
|
|
|
88
88
|
"lint:fix": "eslint src --fix"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@astrojs/compiler": "^
|
|
91
|
+
"@astrojs/compiler": "^3.0.0",
|
|
92
92
|
"@babel/core": "^7.29.0",
|
|
93
93
|
"@babel/preset-typescript": "^7.28.5",
|
|
94
94
|
"messageformat": "^4.0.0",
|
|
95
|
-
"glob": "^13.0.
|
|
95
|
+
"glob": "^13.0.6",
|
|
96
96
|
"magic-string": "^0.30.21"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@babel/types": "^7.29.0",
|
|
100
100
|
"@types/babel__core": "^7.20.5",
|
|
101
|
-
"astro": "^
|
|
101
|
+
"astro": "^6.0.2",
|
|
102
102
|
"tsup": "^8.5.1",
|
|
103
103
|
"typescript": "^5.9.3",
|
|
104
|
-
"vite": "^
|
|
104
|
+
"vite": "^7.3.1"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
|
-
"@astroscope/excludes": "^0.
|
|
108
|
-
"astro": "^
|
|
107
|
+
"@astroscope/excludes": "^0.3.0",
|
|
108
|
+
"astro": "^6.0.0"
|
|
109
109
|
}
|
|
110
110
|
}
|