@trebired/bundler 4.1.0 → 4.2.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/CHANGELOG.md +7 -0
- package/README.md +6 -2
- package/dist/plugins/i18n/validate.d.ts +0 -1
- package/dist/plugins/i18n/validate.d.ts.map +1 -1
- package/dist/plugins/i18n/validate.js +35 -83
- package/dist/plugins/i18n/validate.js.map +1 -1
- package/dist/src/plugins/i18n/validate.d.ts +0 -1
- package/dist/src/plugins/i18n/validate.d.ts.map +1 -1
- package/dist/src/plugins/i18n/validate.js +35 -83
- package/dist/src/plugins/i18n/validate.js.map +1 -1
- package/package.json +6 -4
- package/dist/plugins/i18n/parse.d.ts +0 -8
- package/dist/plugins/i18n/parse.d.ts.map +0 -1
- package/dist/plugins/i18n/parse.js +0 -162
- package/dist/plugins/i18n/parse.js.map +0 -1
- package/dist/src/plugins/i18n/parse.d.ts +0 -8
- package/dist/src/plugins/i18n/parse.d.ts.map +0 -1
- package/dist/src/plugins/i18n/parse.js +0 -162
- package/dist/src/plugins/i18n/parse.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ All notable changes to `@trebired/bundler` will be documented here.
|
|
|
4
4
|
|
|
5
5
|
This project follows semantic versioning once published.
|
|
6
6
|
|
|
7
|
+
## 4.2.0
|
|
8
|
+
|
|
9
|
+
- Switched colocated i18n validation to the shared `@trebired/i18n/checker` parser and checker APIs so message-file grammar has one package-owned source of truth.
|
|
10
|
+
- Removed bundler-local message parsing while keeping bundler focused on local-translator detection, sibling folder resolution, static language imports, transform output, and watch metadata.
|
|
11
|
+
- Accepted static TypeScript message expressions supported by `@trebired/i18n`, including string concatenation across whitespace and comments.
|
|
12
|
+
- Prepared Code Discipline generated path metadata before typecheck/build scripts so fresh checkouts work with generated files ignored.
|
|
13
|
+
|
|
7
14
|
## 4.1.0
|
|
8
15
|
|
|
9
16
|
- Added frontend app build targets for `all`, `client`, and `ssr` so callers can build either side without local branching wrappers.
|
package/README.md
CHANGED
|
@@ -149,11 +149,14 @@ some-feature/
|
|
|
149
149
|
import { defineMessages } from "@trebired/i18n";
|
|
150
150
|
|
|
151
151
|
export default defineMessages({
|
|
152
|
-
|
|
152
|
+
description:
|
|
153
|
+
"First part " +
|
|
154
|
+
"second part",
|
|
155
|
+
title: `Title`,
|
|
153
156
|
});
|
|
154
157
|
```
|
|
155
158
|
|
|
156
|
-
During browser, node, and neutral builds, the bundler rewrites the local translator call to a normal `createTranslator()` call with static sibling imports for the configured language files. The source tree does not need local `i18n/index.ts` files, JSON dictionaries, app-wide registries, or checked-in generated source.
|
|
159
|
+
During browser, node, and neutral builds, the bundler rewrites the local translator call to a normal `createTranslator()` call with static sibling imports for the configured language files. Message-file parsing and key validation come from `@trebired/i18n/checker`, so the same static TypeScript grammar is used by the CLI and the bundler. The source tree does not need local `i18n/index.ts` files, JSON dictionaries, app-wide registries, or checked-in generated source.
|
|
157
160
|
|
|
158
161
|
Builds fail when a used colocated folder is invalid:
|
|
159
162
|
|
|
@@ -161,6 +164,7 @@ Builds fail when a used colocated folder is invalid:
|
|
|
161
164
|
- a language file is not in `supportedLanguages`
|
|
162
165
|
- language keys do not match the English fallback file
|
|
163
166
|
- a language file does not default-export `defineMessages({ ... })`
|
|
167
|
+
- message values are not static strings or nested message objects
|
|
164
168
|
|
|
165
169
|
Options:
|
|
166
170
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/plugins/i18n/validate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/plugins/i18n/validate.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAGlE,KAAK,0BAA0B,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,0BAA0B,EAAE,CAAC;CACvC,CAAC;AAEF,iBAAe,iBAAiB,CAAC,IAAI,EAAE;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAO9B;AAqED,OAAO,EACL,iBAAiB,GAClB,CAAC;AACF,YAAY,EACV,kBAAkB,EAClB,0BAA0B,GAC3B,CAAC"}
|
|
@@ -1,93 +1,54 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { checkColocatedI18n, formatI18nCheckViolations, } from "@package/i18n/checker";
|
|
4
4
|
import { normalizeLanguage, toRootRelative } from "./shared.js";
|
|
5
5
|
async function resolveI18nFolder(args) {
|
|
6
6
|
const folderPath = path.join(path.dirname(args.callerPath), args.i18n.dirName);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const languages = expectedLanguages(files, args.i18n);
|
|
13
|
-
validateExpectedFiles(folderPath, files, languages, args.i18n, args.rootDir, violations);
|
|
14
|
-
const modules = await loadLanguageModules(folderPath, files, languages, args.rootDir, violations);
|
|
15
|
-
validateLanguageKeys(folderPath, modules, args.i18n, args.rootDir, violations);
|
|
16
|
-
if (violations.length > 0)
|
|
17
|
-
throwI18nFolderError(folderPath, args.rootDir, violations);
|
|
18
|
-
return { folderPath, modules };
|
|
7
|
+
await assertValidI18nFolder(folderPath, args);
|
|
8
|
+
return {
|
|
9
|
+
folderPath,
|
|
10
|
+
modules: await collectLanguageModules(folderPath, args.i18n, args.rootDir),
|
|
11
|
+
};
|
|
19
12
|
}
|
|
20
|
-
async function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
async function assertValidI18nFolder(folderPath, args) {
|
|
14
|
+
const result = await checkColocatedI18n({
|
|
15
|
+
defaultLanguage: args.i18n.defaultLanguage,
|
|
16
|
+
dirName: args.i18n.dirName,
|
|
17
|
+
dirs: [folderPath],
|
|
18
|
+
extensions: args.i18n.extensions,
|
|
19
|
+
rootDir: args.rootDir,
|
|
20
|
+
supportedLanguages: args.i18n.supportedLanguages,
|
|
21
|
+
});
|
|
22
|
+
if (!result.ok)
|
|
23
|
+
throwI18nFolderError(folderPath, args.rootDir, formatI18nCheckViolations(result.violations, result.rootDir));
|
|
24
|
+
}
|
|
25
|
+
async function collectLanguageModules(folderPath, i18n, rootDir) {
|
|
26
|
+
const files = await collectLanguageFiles(folderPath, i18n);
|
|
27
|
+
return resolveLanguages(files, i18n).map((language) => {
|
|
28
|
+
const filePath = files.get(language) || "";
|
|
29
|
+
return {
|
|
30
|
+
filePath,
|
|
31
|
+
language,
|
|
32
|
+
rootRel: toRootRelative(rootDir, filePath),
|
|
33
|
+
};
|
|
34
|
+
});
|
|
28
35
|
}
|
|
29
|
-
function collectLanguageFiles(folderPath,
|
|
36
|
+
async function collectLanguageFiles(folderPath, i18n) {
|
|
30
37
|
const files = new Map();
|
|
38
|
+
const entries = await fs.readdir(folderPath, { withFileTypes: true });
|
|
31
39
|
for (const entry of entries) {
|
|
32
|
-
const filePath = path.join(folderPath, entry.name);
|
|
33
40
|
const language = entry.isFile() ? languageFromFileName(entry.name, i18n) : "";
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
files.set(language, filePath);
|
|
41
|
+
if (language)
|
|
42
|
+
files.set(language, path.join(folderPath, entry.name));
|
|
39
43
|
}
|
|
40
44
|
return files;
|
|
41
45
|
}
|
|
42
|
-
function
|
|
46
|
+
function resolveLanguages(files, i18n) {
|
|
43
47
|
if (i18n.supportedLanguages)
|
|
44
48
|
return i18n.supportedLanguages;
|
|
45
49
|
const inferred = Array.from(files.keys()).sort();
|
|
46
50
|
return inferred.includes(i18n.defaultLanguage) ? inferred : [i18n.defaultLanguage, ...inferred];
|
|
47
51
|
}
|
|
48
|
-
function validateExpectedFiles(folderPath, files, languages, i18n, rootDir, violations) {
|
|
49
|
-
for (const language of languages) {
|
|
50
|
-
if (files.has(language))
|
|
51
|
-
continue;
|
|
52
|
-
const filePath = path.join(folderPath, `${language}${i18n.extensions[0]}`);
|
|
53
|
-
violations.push(`missing-language-file :: ${language} :: ${toRootRelative(rootDir, filePath)}`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
async function loadLanguageModules(folderPath, files, languages, rootDir, violations) {
|
|
57
|
-
const modules = [];
|
|
58
|
-
for (const language of languages) {
|
|
59
|
-
const filePath = files.get(language);
|
|
60
|
-
if (!filePath)
|
|
61
|
-
continue;
|
|
62
|
-
try {
|
|
63
|
-
const source = await fs.readFile(filePath, "utf8");
|
|
64
|
-
modules.push({
|
|
65
|
-
filePath,
|
|
66
|
-
keys: flattenMessageKeys(parseMessagesSource(source, filePath)),
|
|
67
|
-
language,
|
|
68
|
-
rootRel: toRootRelative(rootDir, filePath),
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
violations.push(`invalid-default-export :: ${toRootRelative(rootDir, filePath)} :: ${formatError(error)}`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return modules;
|
|
76
|
-
}
|
|
77
|
-
function validateLanguageKeys(folderPath, modules, i18n, rootDir, violations) {
|
|
78
|
-
const fallback = modules.find((item) => item.language === i18n.defaultLanguage);
|
|
79
|
-
if (!fallback)
|
|
80
|
-
return;
|
|
81
|
-
for (const item of modules) {
|
|
82
|
-
if (item.language === i18n.defaultLanguage)
|
|
83
|
-
continue;
|
|
84
|
-
const missing = fallback.keys.filter((key) => !item.keys.includes(key));
|
|
85
|
-
const extra = item.keys.filter((key) => !fallback.keys.includes(key));
|
|
86
|
-
if (missing.length === 0 && extra.length === 0)
|
|
87
|
-
continue;
|
|
88
|
-
violations.push(`key-mismatch :: ${toRootRelative(rootDir, folderPath)} :: ${item.language} :: ${formatKeyDiff(missing, extra)}`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
52
|
function languageFromFileName(fileName, i18n) {
|
|
92
53
|
const extension = i18n.extensions.find((item) => fileName.endsWith(item));
|
|
93
54
|
if (!extension)
|
|
@@ -95,20 +56,11 @@ function languageFromFileName(fileName, i18n) {
|
|
|
95
56
|
const language = normalizeLanguage(fileName.slice(0, -extension.length));
|
|
96
57
|
return /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(language) ? language : "";
|
|
97
58
|
}
|
|
98
|
-
function
|
|
99
|
-
return [
|
|
100
|
-
missing.length ? `missing=${missing.join(",")}` : "",
|
|
101
|
-
extra.length ? `extra=${extra.join(",")}` : "",
|
|
102
|
-
].filter(Boolean).join(" :: ");
|
|
103
|
-
}
|
|
104
|
-
function throwI18nFolderError(folderPath, rootDir, violations) {
|
|
59
|
+
function throwI18nFolderError(folderPath, rootDir, formattedViolations) {
|
|
105
60
|
throw new Error([
|
|
106
61
|
`bundler-i18n-invalid-folder :: ${toRootRelative(rootDir, folderPath)}`,
|
|
107
|
-
|
|
62
|
+
formattedViolations,
|
|
108
63
|
].join("\n"));
|
|
109
64
|
}
|
|
110
|
-
function formatError(error) {
|
|
111
|
-
return error instanceof Error ? error.message : String(error);
|
|
112
|
-
}
|
|
113
65
|
export { resolveI18nFolder, };
|
|
114
66
|
//# sourceMappingURL=validate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../src/plugins/i18n/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":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D,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,QAAQ,CAAC,CAAC;AAClG,CAAC;AAED,SAAS,oBAAoB,CAAC,QAAgB,EAAE,IAAkC;IAChF,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1E,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,CAAC;IAC1B,MAAM,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IACzE,OAAO,kCAAkC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3E,CAAC;AAED,SAAS,oBAAoB,CAAC,UAAkB,EAAE,OAAe,EAAE,mBAA2B;IAC5F,MAAM,IAAI,KAAK,CAAC;QACd,kCAAkC,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE;QACvE,mBAAmB;KACpB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAChB,CAAC;AAED,OAAO,EACL,iBAAiB,GAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/plugins/i18n/validate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/plugins/i18n/validate.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAGlE,KAAK,0BAA0B,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,0BAA0B,EAAE,CAAC;CACvC,CAAC;AAEF,iBAAe,iBAAiB,CAAC,IAAI,EAAE;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAO9B;AAqED,OAAO,EACL,iBAAiB,GAClB,CAAC;AACF,YAAY,EACV,kBAAkB,EAClB,0BAA0B,GAC3B,CAAC"}
|
|
@@ -1,93 +1,54 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { checkColocatedI18n, formatI18nCheckViolations, } from "@package/i18n/checker";
|
|
4
4
|
import { normalizeLanguage, toRootRelative } from "./shared.js";
|
|
5
5
|
async function resolveI18nFolder(args) {
|
|
6
6
|
const folderPath = path.join(path.dirname(args.callerPath), args.i18n.dirName);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const languages = expectedLanguages(files, args.i18n);
|
|
13
|
-
validateExpectedFiles(folderPath, files, languages, args.i18n, args.rootDir, violations);
|
|
14
|
-
const modules = await loadLanguageModules(folderPath, files, languages, args.rootDir, violations);
|
|
15
|
-
validateLanguageKeys(folderPath, modules, args.i18n, args.rootDir, violations);
|
|
16
|
-
if (violations.length > 0)
|
|
17
|
-
throwI18nFolderError(folderPath, args.rootDir, violations);
|
|
18
|
-
return { folderPath, modules };
|
|
7
|
+
await assertValidI18nFolder(folderPath, args);
|
|
8
|
+
return {
|
|
9
|
+
folderPath,
|
|
10
|
+
modules: await collectLanguageModules(folderPath, args.i18n, args.rootDir),
|
|
11
|
+
};
|
|
19
12
|
}
|
|
20
|
-
async function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
async function assertValidI18nFolder(folderPath, args) {
|
|
14
|
+
const result = await checkColocatedI18n({
|
|
15
|
+
defaultLanguage: args.i18n.defaultLanguage,
|
|
16
|
+
dirName: args.i18n.dirName,
|
|
17
|
+
dirs: [folderPath],
|
|
18
|
+
extensions: args.i18n.extensions,
|
|
19
|
+
rootDir: args.rootDir,
|
|
20
|
+
supportedLanguages: args.i18n.supportedLanguages,
|
|
21
|
+
});
|
|
22
|
+
if (!result.ok)
|
|
23
|
+
throwI18nFolderError(folderPath, args.rootDir, formatI18nCheckViolations(result.violations, result.rootDir));
|
|
24
|
+
}
|
|
25
|
+
async function collectLanguageModules(folderPath, i18n, rootDir) {
|
|
26
|
+
const files = await collectLanguageFiles(folderPath, i18n);
|
|
27
|
+
return resolveLanguages(files, i18n).map((language) => {
|
|
28
|
+
const filePath = files.get(language) || "";
|
|
29
|
+
return {
|
|
30
|
+
filePath,
|
|
31
|
+
language,
|
|
32
|
+
rootRel: toRootRelative(rootDir, filePath),
|
|
33
|
+
};
|
|
34
|
+
});
|
|
28
35
|
}
|
|
29
|
-
function collectLanguageFiles(folderPath,
|
|
36
|
+
async function collectLanguageFiles(folderPath, i18n) {
|
|
30
37
|
const files = new Map();
|
|
38
|
+
const entries = await fs.readdir(folderPath, { withFileTypes: true });
|
|
31
39
|
for (const entry of entries) {
|
|
32
|
-
const filePath = path.join(folderPath, entry.name);
|
|
33
40
|
const language = entry.isFile() ? languageFromFileName(entry.name, i18n) : "";
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
files.set(language, filePath);
|
|
41
|
+
if (language)
|
|
42
|
+
files.set(language, path.join(folderPath, entry.name));
|
|
39
43
|
}
|
|
40
44
|
return files;
|
|
41
45
|
}
|
|
42
|
-
function
|
|
46
|
+
function resolveLanguages(files, i18n) {
|
|
43
47
|
if (i18n.supportedLanguages)
|
|
44
48
|
return i18n.supportedLanguages;
|
|
45
49
|
const inferred = Array.from(files.keys()).sort();
|
|
46
50
|
return inferred.includes(i18n.defaultLanguage) ? inferred : [i18n.defaultLanguage, ...inferred];
|
|
47
51
|
}
|
|
48
|
-
function validateExpectedFiles(folderPath, files, languages, i18n, rootDir, violations) {
|
|
49
|
-
for (const language of languages) {
|
|
50
|
-
if (files.has(language))
|
|
51
|
-
continue;
|
|
52
|
-
const filePath = path.join(folderPath, `${language}${i18n.extensions[0]}`);
|
|
53
|
-
violations.push(`missing-language-file :: ${language} :: ${toRootRelative(rootDir, filePath)}`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
async function loadLanguageModules(folderPath, files, languages, rootDir, violations) {
|
|
57
|
-
const modules = [];
|
|
58
|
-
for (const language of languages) {
|
|
59
|
-
const filePath = files.get(language);
|
|
60
|
-
if (!filePath)
|
|
61
|
-
continue;
|
|
62
|
-
try {
|
|
63
|
-
const source = await fs.readFile(filePath, "utf8");
|
|
64
|
-
modules.push({
|
|
65
|
-
filePath,
|
|
66
|
-
keys: flattenMessageKeys(parseMessagesSource(source, filePath)),
|
|
67
|
-
language,
|
|
68
|
-
rootRel: toRootRelative(rootDir, filePath),
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
violations.push(`invalid-default-export :: ${toRootRelative(rootDir, filePath)} :: ${formatError(error)}`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return modules;
|
|
76
|
-
}
|
|
77
|
-
function validateLanguageKeys(folderPath, modules, i18n, rootDir, violations) {
|
|
78
|
-
const fallback = modules.find((item) => item.language === i18n.defaultLanguage);
|
|
79
|
-
if (!fallback)
|
|
80
|
-
return;
|
|
81
|
-
for (const item of modules) {
|
|
82
|
-
if (item.language === i18n.defaultLanguage)
|
|
83
|
-
continue;
|
|
84
|
-
const missing = fallback.keys.filter((key) => !item.keys.includes(key));
|
|
85
|
-
const extra = item.keys.filter((key) => !fallback.keys.includes(key));
|
|
86
|
-
if (missing.length === 0 && extra.length === 0)
|
|
87
|
-
continue;
|
|
88
|
-
violations.push(`key-mismatch :: ${toRootRelative(rootDir, folderPath)} :: ${item.language} :: ${formatKeyDiff(missing, extra)}`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
52
|
function languageFromFileName(fileName, i18n) {
|
|
92
53
|
const extension = i18n.extensions.find((item) => fileName.endsWith(item));
|
|
93
54
|
if (!extension)
|
|
@@ -95,20 +56,11 @@ function languageFromFileName(fileName, i18n) {
|
|
|
95
56
|
const language = normalizeLanguage(fileName.slice(0, -extension.length));
|
|
96
57
|
return /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(language) ? language : "";
|
|
97
58
|
}
|
|
98
|
-
function
|
|
99
|
-
return [
|
|
100
|
-
missing.length ? `missing=${missing.join(",")}` : "",
|
|
101
|
-
extra.length ? `extra=${extra.join(",")}` : "",
|
|
102
|
-
].filter(Boolean).join(" :: ");
|
|
103
|
-
}
|
|
104
|
-
function throwI18nFolderError(folderPath, rootDir, violations) {
|
|
59
|
+
function throwI18nFolderError(folderPath, rootDir, formattedViolations) {
|
|
105
60
|
throw new Error([
|
|
106
61
|
`bundler-i18n-invalid-folder :: ${toRootRelative(rootDir, folderPath)}`,
|
|
107
|
-
|
|
62
|
+
formattedViolations,
|
|
108
63
|
].join("\n"));
|
|
109
64
|
}
|
|
110
|
-
function formatError(error) {
|
|
111
|
-
return error instanceof Error ? error.message : String(error);
|
|
112
|
-
}
|
|
113
65
|
export { resolveI18nFolder, };
|
|
114
66
|
//# sourceMappingURL=validate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../src/plugins/i18n/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|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E,CAAC,CAAC,IAAI,EAAE,CAAC;IACjD,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,QAAQ,CAAC,CAAC;AAClG,CAAC;AAED,SAAS,oBAAoB,CAAC,QAAgB,EAAE,IAAkC;IAChF,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1E,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,CAAC;IAC1B,MAAM,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IACzE,OAAO,kCAAkC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3E,CAAC;AAED,SAAS,oBAAoB,CAAC,UAAkB,EAAE,OAAe,EAAE,mBAA2B;IAC5F,MAAM,IAAI,KAAK,CAAC;QACd,kCAAkC,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE;QACvE,mBAAmB;KACpB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAChB,CAAC;AAED,OAAO,EACL,iBAAiB,GAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trebired/bundler",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Discover-only esbuild bundler wrapper with SCSS support, watch mode, and runtime asset manifests.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -33,23 +33,25 @@
|
|
|
33
33
|
"README.md"
|
|
34
34
|
],
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "rm -rf dist && tsc -p tsconfig.build.json && node ./scripts/prepare-dist.mjs",
|
|
36
|
+
"build": "bun run prepare:generated && rm -rf dist && tsc -p tsconfig.build.json && node ./scripts/prepare-dist.mjs",
|
|
37
37
|
"demo": "bun run examples/dummy.ts",
|
|
38
|
+
"prepare:generated": "node ./scripts/build/generated/tsconfig.mjs",
|
|
38
39
|
"prepublishOnly": "bun run typecheck && bun run build && bun run verify:pack && bun run verify:i18n && bun run verify:bundler && bun run verify:frontend-app",
|
|
39
|
-
"typecheck": "tsc --noEmit",
|
|
40
|
+
"typecheck": "bun run prepare:generated && tsc --noEmit",
|
|
40
41
|
"verify:bundler": "node ./scripts/verify/bundler.mjs",
|
|
41
42
|
"verify:frontend-app": "node ./scripts/verify/frontend-app.mjs",
|
|
42
43
|
"verify:i18n": "node ./scripts/verify/i18n.mjs",
|
|
43
44
|
"verify:pack": "node ./scripts/verify/pack.mjs"
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
47
|
+
"@package/i18n": "npm:@trebired/i18n@^0.3.0",
|
|
46
48
|
"@package/logger-adapter": "npm:@trebired/logger-adapter@^0.2.5",
|
|
47
49
|
"@package/result": "npm:@trebired/result@^1.1.1",
|
|
48
50
|
"esbuild": "^0.28.0",
|
|
49
51
|
"sass-embedded": "^1.100.0"
|
|
50
52
|
},
|
|
51
53
|
"devDependencies": {
|
|
52
|
-
"@trebired/code-discipline": "^4.
|
|
54
|
+
"@trebired/code-discipline": "^4.8.0",
|
|
53
55
|
"@types/bun": "^1.3.4",
|
|
54
56
|
"@types/node": "^24.10.1",
|
|
55
57
|
"typescript": "^6.0.2"
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type MessageDictionary = {
|
|
2
|
-
[key: string]: string | MessageDictionary;
|
|
3
|
-
};
|
|
4
|
-
declare function parseMessagesSource(source: string, filePath: string): MessageDictionary;
|
|
5
|
-
declare function flattenMessageKeys(messages: MessageDictionary): string[];
|
|
6
|
-
export { flattenMessageKeys, parseMessagesSource, };
|
|
7
|
-
export type { MessageDictionary, };
|
|
8
|
-
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/plugins/i18n/parse.ts"],"names":[],"mappings":"AAAA,KAAK,iBAAiB,GAAG;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAAC;CAC3C,CAAC;AAiJF,iBAAS,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAEhF;AAED,iBAAS,kBAAkB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,EAAE,CAIjE;AAaD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,CAAC;AACF,YAAY,EACV,iBAAiB,GAClB,CAAC"}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
class MessageFileParser {
|
|
2
|
-
constructor(source, filePath) {
|
|
3
|
-
this.source = source;
|
|
4
|
-
this.filePath = filePath;
|
|
5
|
-
this.index = 0;
|
|
6
|
-
}
|
|
7
|
-
parse() {
|
|
8
|
-
this.index = this.findMessagesObjectStart();
|
|
9
|
-
return this.readObject();
|
|
10
|
-
}
|
|
11
|
-
findMessagesObjectStart() {
|
|
12
|
-
const match = /\bexport\s+default\s+defineMessages\s*\(/u.exec(this.source);
|
|
13
|
-
if (!match)
|
|
14
|
-
this.fail("expected default export defineMessages({...})");
|
|
15
|
-
const objectStart = this.source.indexOf("{", match.index + match[0].length);
|
|
16
|
-
if (objectStart === -1)
|
|
17
|
-
this.fail("expected messages object literal");
|
|
18
|
-
return objectStart;
|
|
19
|
-
}
|
|
20
|
-
readObject() {
|
|
21
|
-
const messages = {};
|
|
22
|
-
this.expect("{");
|
|
23
|
-
this.skipTrivia();
|
|
24
|
-
while (!this.consume("}")) {
|
|
25
|
-
const key = this.readKey();
|
|
26
|
-
this.skipTrivia();
|
|
27
|
-
this.expect(":");
|
|
28
|
-
messages[key] = this.readValue();
|
|
29
|
-
this.skipTrivia();
|
|
30
|
-
if (this.consume(",")) {
|
|
31
|
-
this.skipTrivia();
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
if (this.peek() !== "}")
|
|
35
|
-
this.fail("expected comma or closing brace");
|
|
36
|
-
}
|
|
37
|
-
return messages;
|
|
38
|
-
}
|
|
39
|
-
readValue() {
|
|
40
|
-
this.skipTrivia();
|
|
41
|
-
const char = this.peek();
|
|
42
|
-
if (char === "\"" || char === "'")
|
|
43
|
-
return this.readQuotedString();
|
|
44
|
-
if (char === "`")
|
|
45
|
-
return this.readTemplateString();
|
|
46
|
-
if (char === "{")
|
|
47
|
-
return this.readObject();
|
|
48
|
-
this.fail("expected string or nested messages object");
|
|
49
|
-
}
|
|
50
|
-
readKey() {
|
|
51
|
-
this.skipTrivia();
|
|
52
|
-
const char = this.peek();
|
|
53
|
-
if (char === "\"" || char === "'")
|
|
54
|
-
return this.readQuotedString();
|
|
55
|
-
const match = /^[$A-Za-z_][$A-Za-z0-9_]*/u.exec(this.source.slice(this.index));
|
|
56
|
-
if (match) {
|
|
57
|
-
this.index += match[0].length;
|
|
58
|
-
return match[0];
|
|
59
|
-
}
|
|
60
|
-
const numeric = /^[0-9]+/u.exec(this.source.slice(this.index));
|
|
61
|
-
if (numeric) {
|
|
62
|
-
this.index += numeric[0].length;
|
|
63
|
-
return numeric[0];
|
|
64
|
-
}
|
|
65
|
-
this.fail("expected property key");
|
|
66
|
-
}
|
|
67
|
-
readQuotedString() {
|
|
68
|
-
const quote = this.source[this.index];
|
|
69
|
-
this.index += 1;
|
|
70
|
-
let value = "";
|
|
71
|
-
while (this.index < this.source.length) {
|
|
72
|
-
const char = this.source[this.index++];
|
|
73
|
-
if (char === quote)
|
|
74
|
-
return value;
|
|
75
|
-
if (char === "\\") {
|
|
76
|
-
value += char;
|
|
77
|
-
if (this.index < this.source.length)
|
|
78
|
-
value += this.source[this.index++];
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
value += char;
|
|
82
|
-
}
|
|
83
|
-
this.fail("unterminated string literal");
|
|
84
|
-
}
|
|
85
|
-
readTemplateString() {
|
|
86
|
-
this.index += 1;
|
|
87
|
-
let value = "";
|
|
88
|
-
while (this.index < this.source.length) {
|
|
89
|
-
const char = this.source[this.index++];
|
|
90
|
-
if (char === "`")
|
|
91
|
-
return value;
|
|
92
|
-
if (char === "$" && this.peek() === "{")
|
|
93
|
-
this.fail("template expressions are not supported");
|
|
94
|
-
if (char === "\\") {
|
|
95
|
-
value += char;
|
|
96
|
-
if (this.index < this.source.length)
|
|
97
|
-
value += this.source[this.index++];
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
value += char;
|
|
101
|
-
}
|
|
102
|
-
this.fail("unterminated template literal");
|
|
103
|
-
}
|
|
104
|
-
skipTrivia() {
|
|
105
|
-
while (this.index < this.source.length) {
|
|
106
|
-
if (/\s/u.test(this.peek())) {
|
|
107
|
-
this.index += 1;
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
if (this.consume("//")) {
|
|
111
|
-
while (this.index < this.source.length && this.peek() !== "\n")
|
|
112
|
-
this.index += 1;
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
if (this.consume("/*")) {
|
|
116
|
-
const end = this.source.indexOf("*/", this.index);
|
|
117
|
-
if (end === -1)
|
|
118
|
-
this.fail("unterminated block comment");
|
|
119
|
-
this.index = end + 2;
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
expect(value) {
|
|
126
|
-
this.skipTrivia();
|
|
127
|
-
if (!this.consume(value))
|
|
128
|
-
this.fail(`expected ${value}`);
|
|
129
|
-
}
|
|
130
|
-
consume(value) {
|
|
131
|
-
if (!this.source.startsWith(value, this.index))
|
|
132
|
-
return false;
|
|
133
|
-
this.index += value.length;
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
peek() {
|
|
137
|
-
return this.source[this.index] || "";
|
|
138
|
-
}
|
|
139
|
-
fail(message) {
|
|
140
|
-
throw new Error(`${message} :: ${this.filePath}`);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function parseMessagesSource(source, filePath) {
|
|
144
|
-
return new MessageFileParser(source, filePath).parse();
|
|
145
|
-
}
|
|
146
|
-
function flattenMessageKeys(messages) {
|
|
147
|
-
const keys = new Set();
|
|
148
|
-
collectMessageKeys(messages, "", keys);
|
|
149
|
-
return Array.from(keys).sort();
|
|
150
|
-
}
|
|
151
|
-
function collectMessageKeys(messages, prefix, keys) {
|
|
152
|
-
for (const [key, value] of Object.entries(messages)) {
|
|
153
|
-
const nextKey = prefix ? `${prefix}.${key}` : key;
|
|
154
|
-
if (typeof value === "string") {
|
|
155
|
-
keys.add(nextKey);
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
collectMessageKeys(value, nextKey, keys);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
export { flattenMessageKeys, parseMessagesSource, };
|
|
162
|
-
//# sourceMappingURL=parse.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/plugins/i18n/parse.ts"],"names":[],"mappings":"AAIA,MAAM,iBAAiB;IAGrB,YACmB,MAAc,EACd,QAAgB;QADhB,WAAM,GAAN,MAAM,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAQ;QAJ3B,UAAK,GAAG,CAAC,CAAC;IAKf,CAAC;IAEJ,KAAK;QACH,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;IAEO,uBAAuB;QAC7B,MAAM,KAAK,GAAG,2CAA2C,CAAC,IAAI,CAAC,IAA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AAED,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type MessageDictionary = {
|
|
2
|
-
[key: string]: string | MessageDictionary;
|
|
3
|
-
};
|
|
4
|
-
declare function parseMessagesSource(source: string, filePath: string): MessageDictionary;
|
|
5
|
-
declare function flattenMessageKeys(messages: MessageDictionary): string[];
|
|
6
|
-
export { flattenMessageKeys, parseMessagesSource, };
|
|
7
|
-
export type { MessageDictionary, };
|
|
8
|
-
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/plugins/i18n/parse.ts"],"names":[],"mappings":"AAAA,KAAK,iBAAiB,GAAG;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAAC;CAC3C,CAAC;AAiJF,iBAAS,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAEhF;AAED,iBAAS,kBAAkB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,EAAE,CAIjE;AAaD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,CAAC;AACF,YAAY,EACV,iBAAiB,GAClB,CAAC"}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
class MessageFileParser {
|
|
2
|
-
constructor(source, filePath) {
|
|
3
|
-
this.source = source;
|
|
4
|
-
this.filePath = filePath;
|
|
5
|
-
this.index = 0;
|
|
6
|
-
}
|
|
7
|
-
parse() {
|
|
8
|
-
this.index = this.findMessagesObjectStart();
|
|
9
|
-
return this.readObject();
|
|
10
|
-
}
|
|
11
|
-
findMessagesObjectStart() {
|
|
12
|
-
const match = /\bexport\s+default\s+defineMessages\s*\(/u.exec(this.source);
|
|
13
|
-
if (!match)
|
|
14
|
-
this.fail("expected default export defineMessages({...})");
|
|
15
|
-
const objectStart = this.source.indexOf("{", match.index + match[0].length);
|
|
16
|
-
if (objectStart === -1)
|
|
17
|
-
this.fail("expected messages object literal");
|
|
18
|
-
return objectStart;
|
|
19
|
-
}
|
|
20
|
-
readObject() {
|
|
21
|
-
const messages = {};
|
|
22
|
-
this.expect("{");
|
|
23
|
-
this.skipTrivia();
|
|
24
|
-
while (!this.consume("}")) {
|
|
25
|
-
const key = this.readKey();
|
|
26
|
-
this.skipTrivia();
|
|
27
|
-
this.expect(":");
|
|
28
|
-
messages[key] = this.readValue();
|
|
29
|
-
this.skipTrivia();
|
|
30
|
-
if (this.consume(",")) {
|
|
31
|
-
this.skipTrivia();
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
if (this.peek() !== "}")
|
|
35
|
-
this.fail("expected comma or closing brace");
|
|
36
|
-
}
|
|
37
|
-
return messages;
|
|
38
|
-
}
|
|
39
|
-
readValue() {
|
|
40
|
-
this.skipTrivia();
|
|
41
|
-
const char = this.peek();
|
|
42
|
-
if (char === "\"" || char === "'")
|
|
43
|
-
return this.readQuotedString();
|
|
44
|
-
if (char === "`")
|
|
45
|
-
return this.readTemplateString();
|
|
46
|
-
if (char === "{")
|
|
47
|
-
return this.readObject();
|
|
48
|
-
this.fail("expected string or nested messages object");
|
|
49
|
-
}
|
|
50
|
-
readKey() {
|
|
51
|
-
this.skipTrivia();
|
|
52
|
-
const char = this.peek();
|
|
53
|
-
if (char === "\"" || char === "'")
|
|
54
|
-
return this.readQuotedString();
|
|
55
|
-
const match = /^[$A-Za-z_][$A-Za-z0-9_]*/u.exec(this.source.slice(this.index));
|
|
56
|
-
if (match) {
|
|
57
|
-
this.index += match[0].length;
|
|
58
|
-
return match[0];
|
|
59
|
-
}
|
|
60
|
-
const numeric = /^[0-9]+/u.exec(this.source.slice(this.index));
|
|
61
|
-
if (numeric) {
|
|
62
|
-
this.index += numeric[0].length;
|
|
63
|
-
return numeric[0];
|
|
64
|
-
}
|
|
65
|
-
this.fail("expected property key");
|
|
66
|
-
}
|
|
67
|
-
readQuotedString() {
|
|
68
|
-
const quote = this.source[this.index];
|
|
69
|
-
this.index += 1;
|
|
70
|
-
let value = "";
|
|
71
|
-
while (this.index < this.source.length) {
|
|
72
|
-
const char = this.source[this.index++];
|
|
73
|
-
if (char === quote)
|
|
74
|
-
return value;
|
|
75
|
-
if (char === "\\") {
|
|
76
|
-
value += char;
|
|
77
|
-
if (this.index < this.source.length)
|
|
78
|
-
value += this.source[this.index++];
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
value += char;
|
|
82
|
-
}
|
|
83
|
-
this.fail("unterminated string literal");
|
|
84
|
-
}
|
|
85
|
-
readTemplateString() {
|
|
86
|
-
this.index += 1;
|
|
87
|
-
let value = "";
|
|
88
|
-
while (this.index < this.source.length) {
|
|
89
|
-
const char = this.source[this.index++];
|
|
90
|
-
if (char === "`")
|
|
91
|
-
return value;
|
|
92
|
-
if (char === "$" && this.peek() === "{")
|
|
93
|
-
this.fail("template expressions are not supported");
|
|
94
|
-
if (char === "\\") {
|
|
95
|
-
value += char;
|
|
96
|
-
if (this.index < this.source.length)
|
|
97
|
-
value += this.source[this.index++];
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
value += char;
|
|
101
|
-
}
|
|
102
|
-
this.fail("unterminated template literal");
|
|
103
|
-
}
|
|
104
|
-
skipTrivia() {
|
|
105
|
-
while (this.index < this.source.length) {
|
|
106
|
-
if (/\s/u.test(this.peek())) {
|
|
107
|
-
this.index += 1;
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
if (this.consume("//")) {
|
|
111
|
-
while (this.index < this.source.length && this.peek() !== "\n")
|
|
112
|
-
this.index += 1;
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
if (this.consume("/*")) {
|
|
116
|
-
const end = this.source.indexOf("*/", this.index);
|
|
117
|
-
if (end === -1)
|
|
118
|
-
this.fail("unterminated block comment");
|
|
119
|
-
this.index = end + 2;
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
expect(value) {
|
|
126
|
-
this.skipTrivia();
|
|
127
|
-
if (!this.consume(value))
|
|
128
|
-
this.fail(`expected ${value}`);
|
|
129
|
-
}
|
|
130
|
-
consume(value) {
|
|
131
|
-
if (!this.source.startsWith(value, this.index))
|
|
132
|
-
return false;
|
|
133
|
-
this.index += value.length;
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
peek() {
|
|
137
|
-
return this.source[this.index] || "";
|
|
138
|
-
}
|
|
139
|
-
fail(message) {
|
|
140
|
-
throw new Error(`${message} :: ${this.filePath}`);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function parseMessagesSource(source, filePath) {
|
|
144
|
-
return new MessageFileParser(source, filePath).parse();
|
|
145
|
-
}
|
|
146
|
-
function flattenMessageKeys(messages) {
|
|
147
|
-
const keys = new Set();
|
|
148
|
-
collectMessageKeys(messages, "", keys);
|
|
149
|
-
return Array.from(keys).sort();
|
|
150
|
-
}
|
|
151
|
-
function collectMessageKeys(messages, prefix, keys) {
|
|
152
|
-
for (const [key, value] of Object.entries(messages)) {
|
|
153
|
-
const nextKey = prefix ? `${prefix}.${key}` : key;
|
|
154
|
-
if (typeof value === "string") {
|
|
155
|
-
keys.add(nextKey);
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
collectMessageKeys(value, nextKey, keys);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
export { flattenMessageKeys, parseMessagesSource, };
|
|
162
|
-
//# sourceMappingURL=parse.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/plugins/i18n/parse.ts"],"names":[],"mappings":"AAIA,MAAM,iBAAiB;IAGrB,YACmB,MAAc,EACd,QAAgB;QADhB,WAAM,GAAN,MAAM,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAQ;QAJ3B,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