@verbaly/compiler 0.61.0 → 0.63.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 +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import MagicString from "magic-string";
|
|
|
4
4
|
type Catalog = Record<string, string>;
|
|
5
5
|
type Catalogs = Record<string, Catalog>;
|
|
6
6
|
export declare function readCatalog(cfg: ResolvedConfig, locale: string): Catalog;
|
|
7
|
+
export declare function parseCatalog(content: string): Catalog | undefined;
|
|
7
8
|
export declare function loadCatalogs(cfg: ResolvedConfig): Catalogs;
|
|
8
9
|
export declare function writeCatalog(cfg: ResolvedConfig, locale: string, catalog: Catalog): string;
|
|
9
10
|
export declare function needsIcu(catalogs: Catalogs): boolean;
|
package/dist/index.js
CHANGED
|
@@ -37,6 +37,10 @@ function readTree(cfg, locale) {
|
|
|
37
37
|
if (parsed) return parsed;
|
|
38
38
|
throw new Error(`[verbaly] ${catalogPath(cfg, locale)} is not valid JSON, fix or delete the file`);
|
|
39
39
|
}
|
|
40
|
+
function parseCatalog(content) {
|
|
41
|
+
const tree = parseTree(content);
|
|
42
|
+
return tree === void 0 ? void 0 : flatten(tree);
|
|
43
|
+
}
|
|
40
44
|
function parseTree(content) {
|
|
41
45
|
const body = content.charCodeAt(0) === 65279 ? content.slice(1) : content;
|
|
42
46
|
try {
|
|
@@ -2602,6 +2606,6 @@ function formatCliError(error) {
|
|
|
2602
2606
|
return message.startsWith("[verbaly]") ? message : `[verbaly] ${message}`;
|
|
2603
2607
|
}
|
|
2604
2608
|
//#endregion
|
|
2605
|
-
export { DRAFTS_FILE, LOCALE_MODULE_PREFIX, MessageRegistry, RESOLVED_VIRTUAL_ID, SOURCE_FILE_RE, check, clearDrafts, clientCatalogs, collectOrigins, counted, createSourceFilter, doctor, effectiveDrafts, extractProject, formatCheckResult, formatCheckWarnings, formatCliError, formatDoctorEntry, formatRenderWarnings, formatStatusResult, formatTranslateFailures, generateDts, generateLocaleModule, generateRuntimeModule, init, isTransformTarget, loadCatalogs, loadConfig, loadDrafts, loadVirtualModule, markDrafts, needsIcu, needsRelative, pruneCatalogs, readCatalog, renderSite, resolveConfig, resolveProvider, resolveVirtualId, runBuildGate, saveDrafts, stableKey, status, syncCatalogs, targetLocales, transformCode, transformSource, translateCatalogs, validateMessage, validatePair, wrapProject, writeCatalog, writeDts };
|
|
2609
|
+
export { DRAFTS_FILE, LOCALE_MODULE_PREFIX, MessageRegistry, RESOLVED_VIRTUAL_ID, SOURCE_FILE_RE, check, clearDrafts, clientCatalogs, collectOrigins, counted, createSourceFilter, doctor, effectiveDrafts, extractProject, formatCheckResult, formatCheckWarnings, formatCliError, formatDoctorEntry, formatRenderWarnings, formatStatusResult, formatTranslateFailures, generateDts, generateLocaleModule, generateRuntimeModule, init, isTransformTarget, loadCatalogs, loadConfig, loadDrafts, loadVirtualModule, markDrafts, needsIcu, needsRelative, parseCatalog, pruneCatalogs, readCatalog, renderSite, resolveConfig, resolveProvider, resolveVirtualId, runBuildGate, saveDrafts, stableKey, status, syncCatalogs, targetLocales, transformCode, transformSource, translateCatalogs, validateMessage, validatePair, wrapProject, writeCatalog, writeDts };
|
|
2606
2610
|
|
|
2607
2611
|
//# sourceMappingURL=index.js.map
|