@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 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 (!isSSR && outputOptions.dir) {
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));
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  i18nVitePlugin
3
- } from "../chunk-A2XW2S6Z.js";
3
+ } from "../chunk-IJXSX5DY.js";
4
4
  import {
5
5
  getManifest
6
6
  } from "../chunk-FYKC3DAZ.js";
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  i18nVitePlugin
3
- } from "./chunk-A2XW2S6Z.js";
3
+ } from "./chunk-IJXSX5DY.js";
4
4
  import {
5
5
  i18n,
6
6
  runWithContext
7
- } from "./chunk-P4IZCU3H.js";
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
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getContext,
3
3
  i18n
4
- } from "./chunk-P4IZCU3H.js";
4
+ } from "./chunk-LXW5WYBS.js";
5
5
  import "./chunk-33JVAFGQ.js";
6
6
  import "./chunk-FYKC3DAZ.js";
7
7
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getContext,
3
3
  i18n
4
- } from "../chunk-P4IZCU3H.js";
4
+ } from "../chunk-LXW5WYBS.js";
5
5
  import {
6
6
  normalizeMeta,
7
7
  partsToNodes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astroscope/i18n",
3
- "version": "0.3.4",
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": "^2.13.0",
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.1",
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": "^5.17.1",
101
+ "astro": "^6.0.2",
102
102
  "tsup": "^8.5.1",
103
103
  "typescript": "^5.9.3",
104
- "vite": "^6.4.1"
104
+ "vite": "^7.3.1"
105
105
  },
106
106
  "peerDependencies": {
107
- "@astroscope/excludes": "^0.2.0",
108
- "astro": "^5.0.0"
107
+ "@astroscope/excludes": "^0.3.0",
108
+ "astro": "^6.0.0"
109
109
  }
110
110
  }