@astroscope/i18n 0.4.0 → 0.4.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/LICENSE +21 -0
- package/dist/{chunk-IJXSX5DY.js → chunk-T3GRUVHW.js} +10 -8
- package/dist/extraction/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +12 -13
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Simon Bobrov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
|
|
9
9
|
// src/extraction/vite-plugin.ts
|
|
10
10
|
import fs2 from "fs";
|
|
11
|
-
import
|
|
11
|
+
import path2 from "path";
|
|
12
12
|
import MagicString from "magic-string";
|
|
13
13
|
|
|
14
14
|
// src/extraction/extract.ts
|
|
@@ -249,7 +249,7 @@ var KeyStore = class {
|
|
|
249
249
|
|
|
250
250
|
// src/extraction/scan.ts
|
|
251
251
|
import fs from "fs";
|
|
252
|
-
import
|
|
252
|
+
import path from "path";
|
|
253
253
|
var GLOB_PATTERN = `src/**/*.{${ALL_EXTENSIONS.map((e) => e.slice(1)).join(",")}}`;
|
|
254
254
|
async function compileAstro(code, filename) {
|
|
255
255
|
try {
|
|
@@ -263,11 +263,13 @@ async function compileAstro(code, filename) {
|
|
|
263
263
|
async function scan(options) {
|
|
264
264
|
const { projectRoot, logger, consistency } = options;
|
|
265
265
|
const store = new KeyStore(logger, consistency);
|
|
266
|
-
const files =
|
|
266
|
+
const files = [];
|
|
267
|
+
for await (const entry of fs.promises.glob(GLOB_PATTERN, {
|
|
267
268
|
cwd: projectRoot,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
exclude: (name) => name === "node_modules"
|
|
270
|
+
})) {
|
|
271
|
+
files.push(path.resolve(projectRoot, entry));
|
|
272
|
+
}
|
|
271
273
|
const results = await Promise.all(
|
|
272
274
|
files.map(async (file) => {
|
|
273
275
|
let code = await fs.promises.readFile(file, "utf-8");
|
|
@@ -458,8 +460,8 @@ export function getManifest() { return _getManifest(); }
|
|
|
458
460
|
},
|
|
459
461
|
writeBundle(outputOptions) {
|
|
460
462
|
if (this.environment.name === "client" && outputOptions.dir) {
|
|
461
|
-
const chunksDir =
|
|
462
|
-
const manifestPath =
|
|
463
|
+
const chunksDir = path2.resolve(outputOptions.dir, "..", "server", "chunks");
|
|
464
|
+
const manifestPath = path2.join(chunksDir, MANIFEST_FILE_NAME);
|
|
463
465
|
if (fs2.existsSync(chunksDir)) {
|
|
464
466
|
fs2.writeFileSync(manifestPath, JSON.stringify(getManifest()));
|
|
465
467
|
} else {
|
package/dist/extraction/index.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astroscope/i18n",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
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",
|
|
@@ -81,30 +81,29 @@
|
|
|
81
81
|
"url": "https://github.com/smnbbrv/astroscope/issues"
|
|
82
82
|
},
|
|
83
83
|
"homepage": "https://github.com/smnbbrv/astroscope/tree/main/packages/i18n#readme",
|
|
84
|
-
"scripts": {
|
|
85
|
-
"build": "tsup src/index.ts src/internal.ts src/extraction/index.ts src/server/translate.ts src/client/translate.ts src/client/directives/load.ts src/client/directives/idle.ts src/client/directives/visible.ts src/client/directives/media.ts src/client/directives/only.ts src/client/directives/utils.ts --format esm --dts --external astro --external astro/client/load.js --external astro/client/idle.js --external astro/client/visible.js --external astro/client/media.js --external astro/client/only.js --external virtual:@astroscope/i18n/manifest --external @babel/core",
|
|
86
|
-
"typecheck": "tsc --noEmit",
|
|
87
|
-
"lint": "eslint src",
|
|
88
|
-
"lint:fix": "eslint src --fix"
|
|
89
|
-
},
|
|
90
84
|
"dependencies": {
|
|
91
|
-
"@astrojs/compiler": "^3.0.
|
|
85
|
+
"@astrojs/compiler": "^3.0.1",
|
|
92
86
|
"@babel/core": "^7.29.0",
|
|
93
87
|
"@babel/preset-typescript": "^7.28.5",
|
|
94
88
|
"messageformat": "^4.0.0",
|
|
95
|
-
"glob": "^13.0.6",
|
|
96
89
|
"magic-string": "^0.30.21"
|
|
97
90
|
},
|
|
98
91
|
"devDependencies": {
|
|
99
92
|
"@babel/types": "^7.29.0",
|
|
100
93
|
"@types/babel__core": "^7.20.5",
|
|
101
|
-
"astro": "^6.0.
|
|
94
|
+
"astro": "^6.0.7",
|
|
102
95
|
"tsup": "^8.5.1",
|
|
103
96
|
"typescript": "^5.9.3",
|
|
104
97
|
"vite": "^7.3.1"
|
|
105
98
|
},
|
|
106
99
|
"peerDependencies": {
|
|
107
|
-
"
|
|
108
|
-
"
|
|
100
|
+
"astro": "^6.0.0",
|
|
101
|
+
"@astroscope/excludes": "^0.3.0"
|
|
102
|
+
},
|
|
103
|
+
"scripts": {
|
|
104
|
+
"build": "tsup src/index.ts src/internal.ts src/extraction/index.ts src/server/translate.ts src/client/translate.ts src/client/directives/load.ts src/client/directives/idle.ts src/client/directives/visible.ts src/client/directives/media.ts src/client/directives/only.ts src/client/directives/utils.ts --format esm --dts --external astro --external astro/client/load.js --external astro/client/idle.js --external astro/client/visible.js --external astro/client/media.js --external astro/client/only.js --external virtual:@astroscope/i18n/manifest --external @babel/core",
|
|
105
|
+
"typecheck": "tsc --noEmit",
|
|
106
|
+
"lint": "eslint src",
|
|
107
|
+
"lint:fix": "eslint src --fix"
|
|
109
108
|
}
|
|
110
|
-
}
|
|
109
|
+
}
|