@vocab/core 1.6.3 → 1.6.5-fix-messageformat-import-20250923004826
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/dist/chunk-nOFOJqeH.js +30 -0
- package/dist/icu-handler-9mldObYa.js +29 -0
- package/dist/icu-handler-9mldObYa.js.map +1 -0
- package/dist/icu-handler-COUleaeZ.mjs +22 -0
- package/dist/icu-handler-COUleaeZ.mjs.map +1 -0
- package/dist/icu-handler.d.mts +7 -0
- package/dist/icu-handler.d.ts +7 -0
- package/dist/icu-handler.js +3 -0
- package/dist/icu-handler.mjs +3 -0
- package/dist/index.d.mts +53 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +679 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +660 -0
- package/dist/index.mjs.map +1 -0
- package/dist/runtime.d.mts +8 -0
- package/dist/runtime.d.ts +8 -0
- package/dist/runtime.js +13 -0
- package/dist/runtime.js.map +1 -0
- package/dist/runtime.mjs +12 -0
- package/dist/runtime.mjs.map +1 -0
- package/dist/translation-file-BEIJ1-3N.js +34 -0
- package/dist/translation-file-BEIJ1-3N.js.map +1 -0
- package/dist/translation-file-CAOIsAU9.d.mts +7 -0
- package/dist/translation-file-DQOiWtfV.d.ts +7 -0
- package/dist/translation-file-Dn19n2oY.mjs +28 -0
- package/dist/translation-file-Dn19n2oY.mjs.map +1 -0
- package/dist/translation-file.d.mts +3 -0
- package/dist/translation-file.d.ts +3 -0
- package/dist/translation-file.js +3 -0
- package/dist/translation-file.mjs +3 -0
- package/dist/types-DFxEF4pq.d.mts +146 -0
- package/dist/types-Di9uIscO.d.ts +146 -0
- package/package.json +17 -28
- package/README.md +0 -724
- package/dist/declarations/src/compile.d.ts +0 -6
- package/dist/declarations/src/config.d.ts +0 -4
- package/dist/declarations/src/icu-handler.d.ts +0 -2
- package/dist/declarations/src/index.d.ts +0 -6
- package/dist/declarations/src/load-translations.d.ts +0 -32
- package/dist/declarations/src/runtime.d.ts +0 -3
- package/dist/declarations/src/translation-file.d.ts +0 -2
- package/dist/declarations/src/types.d.ts +0 -143
- package/dist/declarations/src/utils.d.ts +0 -26
- package/dist/declarations/src/validate/index.d.ts +0 -3
- package/dist/vocab-core.cjs.d.ts +0 -2
- package/dist/vocab-core.cjs.dev.js +0 -893
- package/dist/vocab-core.cjs.js +0 -7
- package/dist/vocab-core.cjs.prod.js +0 -893
- package/dist/vocab-core.esm.js +0 -866
- package/icu-handler/dist/vocab-core-icu-handler.cjs.d.ts +0 -2
- package/icu-handler/dist/vocab-core-icu-handler.cjs.dev.js +0 -31
- package/icu-handler/dist/vocab-core-icu-handler.cjs.js +0 -7
- package/icu-handler/dist/vocab-core-icu-handler.cjs.prod.js +0 -31
- package/icu-handler/dist/vocab-core-icu-handler.esm.js +0 -23
- package/icu-handler/package.json +0 -4
- package/runtime/dist/vocab-core-runtime.cjs.d.ts +0 -2
- package/runtime/dist/vocab-core-runtime.cjs.dev.js +0 -15
- package/runtime/dist/vocab-core-runtime.cjs.js +0 -7
- package/runtime/dist/vocab-core-runtime.cjs.prod.js +0 -15
- package/runtime/dist/vocab-core-runtime.esm.js +0 -10
- package/runtime/package.json +0 -4
- package/translation-file/dist/vocab-core-translation-file.cjs.d.ts +0 -2
- package/translation-file/dist/vocab-core-translation-file.cjs.dev.js +0 -35
- package/translation-file/dist/vocab-core-translation-file.cjs.js +0 -7
- package/translation-file/dist/vocab-core-translation-file.cjs.prod.js +0 -35
- package/translation-file/dist/vocab-core-translation-file.esm.js +0 -31
- package/translation-file/package.json +0 -4
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(exports, '__toESM', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return __toESM;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
|
+
let intl_messageformat = require("intl-messageformat");
|
|
3
|
+
intl_messageformat = require_chunk.__toESM(intl_messageformat);
|
|
4
|
+
|
|
5
|
+
//#region src/icu-handler.ts
|
|
6
|
+
const moduleCache = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
const getParsedICUMessages = (m, locale) => {
|
|
8
|
+
const moduleCachedResult = moduleCache.get(m);
|
|
9
|
+
if (moduleCachedResult && moduleCachedResult[locale]) return moduleCachedResult[locale];
|
|
10
|
+
const parsedICUMessages = {};
|
|
11
|
+
for (const translation of Object.keys(m)) {
|
|
12
|
+
const intlMessageFormat = new intl_messageformat.default(m[translation], locale);
|
|
13
|
+
parsedICUMessages[translation] = { format: (params) => intlMessageFormat.format(params) };
|
|
14
|
+
}
|
|
15
|
+
moduleCache.set(m, {
|
|
16
|
+
...moduleCachedResult,
|
|
17
|
+
[locale]: parsedICUMessages
|
|
18
|
+
});
|
|
19
|
+
return parsedICUMessages;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
Object.defineProperty(exports, 'getParsedICUMessages', {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () {
|
|
26
|
+
return getParsedICUMessages;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=icu-handler-9mldObYa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icu-handler-9mldObYa.js","names":["parsedICUMessages: ParsedICUMessages<any>","IntlMessageFormat"],"sources":["../src/icu-handler.ts"],"sourcesContent":["import type { ParsedICUMessages, TranslationMessagesByKey } from './types';\nimport IntlMessageFormat from 'intl-messageformat';\n\ntype ICUMessagesByLocale = Record<string, ParsedICUMessages<any>>;\n\nconst moduleCache = new WeakMap<\n TranslationMessagesByKey,\n ICUMessagesByLocale\n>();\n\nexport const getParsedICUMessages = (\n m: TranslationMessagesByKey,\n locale: string,\n): ParsedICUMessages<any> => {\n const moduleCachedResult = moduleCache.get(m);\n\n if (moduleCachedResult && moduleCachedResult[locale]) {\n return moduleCachedResult[locale];\n }\n\n const parsedICUMessages: ParsedICUMessages<any> = {};\n\n for (const translation of Object.keys(m)) {\n const intlMessageFormat = new IntlMessageFormat(m[translation], locale);\n parsedICUMessages[translation] = {\n format: (params: any) => intlMessageFormat.format(params),\n };\n }\n\n moduleCache.set(m, { ...moduleCachedResult, [locale]: parsedICUMessages });\n\n return parsedICUMessages;\n};\n"],"mappings":";;;;;AAKA,MAAM,8BAAc,IAAI,SAGrB;AAEH,MAAa,wBACX,GACA,WAC2B;CAC3B,MAAM,qBAAqB,YAAY,IAAI,EAAE;AAE7C,KAAI,sBAAsB,mBAAmB,QAC3C,QAAO,mBAAmB;CAG5B,MAAMA,oBAA4C,EAAE;AAEpD,MAAK,MAAM,eAAe,OAAO,KAAK,EAAE,EAAE;EACxC,MAAM,oBAAoB,IAAIC,2BAAkB,EAAE,cAAc,OAAO;AACvE,oBAAkB,eAAe,EAC/B,SAAS,WAAgB,kBAAkB,OAAO,OAAO,EAC1D;;AAGH,aAAY,IAAI,GAAG;EAAE,GAAG;GAAqB,SAAS;EAAmB,CAAC;AAE1E,QAAO"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import IntlMessageFormat from "intl-messageformat";
|
|
2
|
+
|
|
3
|
+
//#region src/icu-handler.ts
|
|
4
|
+
const moduleCache = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
const getParsedICUMessages = (m, locale) => {
|
|
6
|
+
const moduleCachedResult = moduleCache.get(m);
|
|
7
|
+
if (moduleCachedResult && moduleCachedResult[locale]) return moduleCachedResult[locale];
|
|
8
|
+
const parsedICUMessages = {};
|
|
9
|
+
for (const translation of Object.keys(m)) {
|
|
10
|
+
const intlMessageFormat = new IntlMessageFormat(m[translation], locale);
|
|
11
|
+
parsedICUMessages[translation] = { format: (params) => intlMessageFormat.format(params) };
|
|
12
|
+
}
|
|
13
|
+
moduleCache.set(m, {
|
|
14
|
+
...moduleCachedResult,
|
|
15
|
+
[locale]: parsedICUMessages
|
|
16
|
+
});
|
|
17
|
+
return parsedICUMessages;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getParsedICUMessages };
|
|
22
|
+
//# sourceMappingURL=icu-handler-COUleaeZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icu-handler-COUleaeZ.mjs","names":["parsedICUMessages: ParsedICUMessages<any>"],"sources":["../src/icu-handler.ts"],"sourcesContent":["import type { ParsedICUMessages, TranslationMessagesByKey } from './types';\nimport IntlMessageFormat from 'intl-messageformat';\n\ntype ICUMessagesByLocale = Record<string, ParsedICUMessages<any>>;\n\nconst moduleCache = new WeakMap<\n TranslationMessagesByKey,\n ICUMessagesByLocale\n>();\n\nexport const getParsedICUMessages = (\n m: TranslationMessagesByKey,\n locale: string,\n): ParsedICUMessages<any> => {\n const moduleCachedResult = moduleCache.get(m);\n\n if (moduleCachedResult && moduleCachedResult[locale]) {\n return moduleCachedResult[locale];\n }\n\n const parsedICUMessages: ParsedICUMessages<any> = {};\n\n for (const translation of Object.keys(m)) {\n const intlMessageFormat = new IntlMessageFormat(m[translation], locale);\n parsedICUMessages[translation] = {\n format: (params: any) => intlMessageFormat.format(params),\n };\n }\n\n moduleCache.set(m, { ...moduleCachedResult, [locale]: parsedICUMessages });\n\n return parsedICUMessages;\n};\n"],"mappings":";;;AAKA,MAAM,8BAAc,IAAI,SAGrB;AAEH,MAAa,wBACX,GACA,WAC2B;CAC3B,MAAM,qBAAqB,YAAY,IAAI,EAAE;AAE7C,KAAI,sBAAsB,mBAAmB,QAC3C,QAAO,mBAAmB;CAG5B,MAAMA,oBAA4C,EAAE;AAEpD,MAAK,MAAM,eAAe,OAAO,KAAK,EAAE,EAAE;EACxC,MAAM,oBAAoB,IAAI,kBAAkB,EAAE,cAAc,OAAO;AACvE,oBAAkB,eAAe,EAC/B,SAAS,WAAgB,kBAAkB,OAAO,OAAO,EAC1D;;AAGH,aAAY,IAAI,GAAG;EAAE,GAAG;GAAqB,SAAS;EAAmB,CAAC;AAE1E,QAAO"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ParsedICUMessages, TranslationMessagesByKey } from "./types-DFxEF4pq.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/icu-handler.d.ts
|
|
4
|
+
declare const getParsedICUMessages: (m: TranslationMessagesByKey, locale: string) => ParsedICUMessages<any>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { getParsedICUMessages };
|
|
7
|
+
//# sourceMappingURL=icu-handler.d.mts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ParsedICUMessages, TranslationMessagesByKey } from "./types-Di9uIscO.js";
|
|
2
|
+
|
|
3
|
+
//#region src/icu-handler.d.ts
|
|
4
|
+
declare const getParsedICUMessages: (m: TranslationMessagesByKey, locale: string) => ParsedICUMessages<any>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { getParsedICUMessages };
|
|
7
|
+
//# sourceMappingURL=icu-handler.d.ts.map
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { FormatXMLElementFn, GeneratedLanguageTarget, LanguageName, LanguageTarget, LoadedTranslation, MessageGenerator, ParsedFormatFn, ParsedFormatFnByKey, ParsedICUMessages, StringWithSuggestions, Tags, TranslationData, TranslationFile, TranslationFileContents, TranslationFileMetadata, TranslationKey, TranslationKeys, TranslationMessage, TranslationMessagesByKey, TranslationModule, TranslationModuleByLanguage, TranslationsByKey, TranslationsByLanguage, UserConfig } from "./types-DFxEF4pq.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/compile.d.ts
|
|
4
|
+
declare function watch(config: UserConfig): () => Promise<void>;
|
|
5
|
+
declare function compile({
|
|
6
|
+
watch: shouldWatch
|
|
7
|
+
}: {
|
|
8
|
+
watch?: boolean | undefined;
|
|
9
|
+
} | undefined, config: UserConfig): Promise<(() => Promise<void>) | undefined>;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/validate/index.d.ts
|
|
12
|
+
declare function validate(config: UserConfig): Promise<boolean>;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/config.d.ts
|
|
15
|
+
declare function validateConfig(c: UserConfig): boolean;
|
|
16
|
+
declare function resolveConfig(customConfigFilePath?: string): Promise<UserConfig | null>;
|
|
17
|
+
declare function resolveConfigSync(customConfigFilePath?: string): UserConfig | null;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/utils.d.ts
|
|
20
|
+
type Fallback = 'none' | 'valid' | 'all';
|
|
21
|
+
declare function getAltLanguages({
|
|
22
|
+
devLanguage,
|
|
23
|
+
languages
|
|
24
|
+
}: {
|
|
25
|
+
devLanguage: LanguageName;
|
|
26
|
+
languages: LanguageTarget[];
|
|
27
|
+
}): string[];
|
|
28
|
+
declare function getDevLanguageFileFromTsFile(tsFilePath: string): string;
|
|
29
|
+
declare function getAltLanguageFilePath(devLanguageFilePath: string, language: string): string;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/load-translations.d.ts
|
|
32
|
+
declare function getUniqueKey(key: string, namespace: string): string;
|
|
33
|
+
declare function loadTranslation({
|
|
34
|
+
filePath,
|
|
35
|
+
fallbacks,
|
|
36
|
+
withTags
|
|
37
|
+
}: {
|
|
38
|
+
filePath: string;
|
|
39
|
+
fallbacks: Fallback;
|
|
40
|
+
withTags?: boolean;
|
|
41
|
+
}, userConfig: UserConfig): LoadedTranslation;
|
|
42
|
+
declare function loadAllTranslations({
|
|
43
|
+
fallbacks,
|
|
44
|
+
includeNodeModules,
|
|
45
|
+
withTags
|
|
46
|
+
}: {
|
|
47
|
+
fallbacks: Fallback;
|
|
48
|
+
includeNodeModules: boolean;
|
|
49
|
+
withTags?: boolean;
|
|
50
|
+
}, config: UserConfig): Promise<LoadedTranslation[]>;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { FormatXMLElementFn, GeneratedLanguageTarget, LanguageName, LanguageTarget, LoadedTranslation, MessageGenerator, ParsedFormatFn, ParsedFormatFnByKey, ParsedICUMessages, StringWithSuggestions, Tags, TranslationData, TranslationFile, TranslationFileContents, TranslationFileMetadata, TranslationKey, TranslationKeys, TranslationMessage, TranslationMessagesByKey, TranslationModule, TranslationModuleByLanguage, TranslationsByKey, TranslationsByLanguage, UserConfig, compile, getAltLanguageFilePath, getAltLanguages, getDevLanguageFileFromTsFile, getUniqueKey, loadAllTranslations, loadTranslation, resolveConfig, resolveConfigSync, validate, validateConfig, watch };
|
|
53
|
+
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { FormatXMLElementFn, GeneratedLanguageTarget, LanguageName, LanguageTarget, LoadedTranslation, MessageGenerator, ParsedFormatFn, ParsedFormatFnByKey, ParsedICUMessages, StringWithSuggestions, Tags, TranslationData, TranslationFile, TranslationFileContents, TranslationFileMetadata, TranslationKey, TranslationKeys, TranslationMessage, TranslationMessagesByKey, TranslationModule, TranslationModuleByLanguage, TranslationsByKey, TranslationsByLanguage, UserConfig } from "./types-Di9uIscO.js";
|
|
2
|
+
|
|
3
|
+
//#region src/compile.d.ts
|
|
4
|
+
declare function watch(config: UserConfig): () => Promise<void>;
|
|
5
|
+
declare function compile({
|
|
6
|
+
watch: shouldWatch
|
|
7
|
+
}: {
|
|
8
|
+
watch?: boolean | undefined;
|
|
9
|
+
} | undefined, config: UserConfig): Promise<(() => Promise<void>) | undefined>;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/validate/index.d.ts
|
|
12
|
+
declare function validate(config: UserConfig): Promise<boolean>;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/config.d.ts
|
|
15
|
+
declare function validateConfig(c: UserConfig): boolean;
|
|
16
|
+
declare function resolveConfig(customConfigFilePath?: string): Promise<UserConfig | null>;
|
|
17
|
+
declare function resolveConfigSync(customConfigFilePath?: string): UserConfig | null;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/utils.d.ts
|
|
20
|
+
type Fallback = 'none' | 'valid' | 'all';
|
|
21
|
+
declare function getAltLanguages({
|
|
22
|
+
devLanguage,
|
|
23
|
+
languages
|
|
24
|
+
}: {
|
|
25
|
+
devLanguage: LanguageName;
|
|
26
|
+
languages: LanguageTarget[];
|
|
27
|
+
}): string[];
|
|
28
|
+
declare function getDevLanguageFileFromTsFile(tsFilePath: string): string;
|
|
29
|
+
declare function getAltLanguageFilePath(devLanguageFilePath: string, language: string): string;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/load-translations.d.ts
|
|
32
|
+
declare function getUniqueKey(key: string, namespace: string): string;
|
|
33
|
+
declare function loadTranslation({
|
|
34
|
+
filePath,
|
|
35
|
+
fallbacks,
|
|
36
|
+
withTags
|
|
37
|
+
}: {
|
|
38
|
+
filePath: string;
|
|
39
|
+
fallbacks: Fallback;
|
|
40
|
+
withTags?: boolean;
|
|
41
|
+
}, userConfig: UserConfig): LoadedTranslation;
|
|
42
|
+
declare function loadAllTranslations({
|
|
43
|
+
fallbacks,
|
|
44
|
+
includeNodeModules,
|
|
45
|
+
withTags
|
|
46
|
+
}: {
|
|
47
|
+
fallbacks: Fallback;
|
|
48
|
+
includeNodeModules: boolean;
|
|
49
|
+
withTags?: boolean;
|
|
50
|
+
}, config: UserConfig): Promise<LoadedTranslation[]>;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { FormatXMLElementFn, GeneratedLanguageTarget, LanguageName, LanguageTarget, LoadedTranslation, MessageGenerator, ParsedFormatFn, ParsedFormatFnByKey, ParsedICUMessages, StringWithSuggestions, Tags, TranslationData, TranslationFile, TranslationFileContents, TranslationFileMetadata, TranslationKey, TranslationKeys, TranslationMessage, TranslationMessagesByKey, TranslationModule, TranslationModuleByLanguage, TranslationsByKey, TranslationsByLanguage, UserConfig, compile, getAltLanguageFilePath, getAltLanguages, getDevLanguageFileFromTsFile, getUniqueKey, loadAllTranslations, loadTranslation, resolveConfig, resolveConfigSync, validate, validateConfig, watch };
|
|
53
|
+
//# sourceMappingURL=index.d.ts.map
|