@intlayer/core 1.0.0 → 1.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/dist/cjs/getLocaleName.cjs +8 -13
- package/dist/cjs/getLocaleName.d.ts +1 -1
- package/dist/cjs/index.cjs +20 -27
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +12 -25
- package/dist/cjs/localeList.cjs +9 -14
- package/dist/cjs/localeList.d.ts +1 -1
- package/dist/cjs/transpiler/content_transformers/enumeration/enumeration.cjs +12 -17
- package/dist/cjs/transpiler/content_transformers/enumeration/enumeration.cjs.map +1 -1
- package/dist/cjs/transpiler/content_transformers/enumeration/enumeration.d.ts +21 -16
- package/dist/cjs/transpiler/content_transformers/enumeration/getEnumerationContent.cjs +14 -34
- package/dist/cjs/transpiler/content_transformers/enumeration/getEnumerationContent.cjs.map +1 -1
- package/dist/cjs/transpiler/content_transformers/enumeration/getEnumerationContent.d.ts +27 -7
- package/dist/cjs/transpiler/content_transformers/enumeration/index.cjs +11 -23
- package/dist/cjs/transpiler/content_transformers/enumeration/index.d.ts +4 -4
- package/dist/cjs/transpiler/content_transformers/index.cjs +11 -27
- package/dist/cjs/transpiler/content_transformers/index.d.ts +9 -15
- package/dist/cjs/transpiler/content_transformers/translation/getTranslationContent.cjs +9 -15
- package/dist/cjs/transpiler/content_transformers/translation/getTranslationContent.cjs.map +1 -1
- package/dist/cjs/transpiler/content_transformers/translation/getTranslationContent.d.ts +25 -8
- package/dist/cjs/transpiler/content_transformers/translation/index.cjs +13 -23
- package/dist/cjs/transpiler/content_transformers/translation/index.cjs.map +1 -1
- package/dist/cjs/transpiler/content_transformers/translation/index.d.ts +7 -5
- package/dist/cjs/transpiler/content_transformers/translation/{translations.cjs → translation.cjs} +17 -22
- package/dist/cjs/transpiler/content_transformers/translation/translation.cjs.map +1 -0
- package/dist/cjs/transpiler/content_transformers/translation/translation.d.ts +27 -0
- package/dist/cjs/transpiler/content_transformers/translation/types.cjs +17 -0
- package/dist/cjs/transpiler/content_transformers/translation/types.cjs.map +1 -0
- package/dist/cjs/transpiler/content_transformers/translation/types.d.ts +63 -0
- package/dist/cjs/transpiler/index.cjs +9 -22
- package/dist/cjs/transpiler/index.cjs.map +1 -1
- package/dist/cjs/transpiler/index.d.ts +9 -13
- package/dist/cjs/types/contentModule.cjs +4 -8
- package/dist/cjs/types/contentModule.d.ts +14 -28
- package/dist/cjs/types/index.cjs +9 -14
- package/dist/cjs/types/index.d.ts +7 -13
- package/dist/cjs/types/nodeType.cjs +8 -13
- package/dist/cjs/types/nodeType.d.ts +2 -2
- package/dist/cjs/utils/getStackTraceInfo.cjs +9 -14
- package/dist/cjs/utils/getStackTraceInfo.cjs.map +1 -1
- package/dist/cjs/utils/getStackTraceInfo.d.ts +4 -4
- package/dist/esm/getLocaleName.d.mts +1 -1
- package/dist/esm/getLocaleName.mjs +4 -2
- package/dist/esm/index.d.mts +12 -25
- package/dist/esm/index.mjs +7 -7
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/localeList.d.mts +1 -1
- package/dist/esm/localeList.mjs +5 -3
- package/dist/esm/transpiler/content_transformers/enumeration/enumeration.d.mts +21 -16
- package/dist/esm/transpiler/content_transformers/enumeration/enumeration.mjs +10 -6
- package/dist/esm/transpiler/content_transformers/enumeration/enumeration.mjs.map +1 -1
- package/dist/esm/transpiler/content_transformers/enumeration/getEnumerationContent.d.mts +27 -7
- package/dist/esm/transpiler/content_transformers/enumeration/getEnumerationContent.mjs +10 -23
- package/dist/esm/transpiler/content_transformers/enumeration/getEnumerationContent.mjs.map +1 -1
- package/dist/esm/transpiler/content_transformers/enumeration/index.d.mts +4 -4
- package/dist/esm/transpiler/content_transformers/enumeration/index.mjs +3 -3
- package/dist/esm/transpiler/content_transformers/index.d.mts +9 -15
- package/dist/esm/transpiler/content_transformers/index.mjs +3 -3
- package/dist/esm/transpiler/content_transformers/translation/getTranslationContent.d.mts +25 -8
- package/dist/esm/transpiler/content_transformers/translation/getTranslationContent.mjs +8 -5
- package/dist/esm/transpiler/content_transformers/translation/getTranslationContent.mjs.map +1 -1
- package/dist/esm/transpiler/content_transformers/translation/index.d.mts +7 -5
- package/dist/esm/transpiler/content_transformers/translation/index.mjs +4 -3
- package/dist/esm/transpiler/content_transformers/translation/index.mjs.map +1 -1
- package/dist/esm/transpiler/content_transformers/translation/translation.d.mts +27 -0
- package/dist/esm/transpiler/content_transformers/translation/{translations.mjs → translation.mjs} +10 -7
- package/dist/esm/transpiler/content_transformers/translation/translation.mjs.map +1 -0
- package/dist/esm/transpiler/content_transformers/translation/types.d.mts +63 -0
- package/dist/esm/transpiler/content_transformers/translation/types.mjs +1 -0
- package/dist/esm/transpiler/content_transformers/translation/types.mjs.map +1 -0
- package/dist/esm/transpiler/index.d.mts +9 -13
- package/dist/esm/transpiler/index.mjs +2 -3
- package/dist/esm/transpiler/index.mjs.map +1 -1
- package/dist/esm/types/contentModule.d.mts +14 -28
- package/dist/esm/types/contentModule.mjs +1 -1
- package/dist/esm/types/index.d.mts +7 -13
- package/dist/esm/types/index.mjs +5 -3
- package/dist/esm/types/nodeType.d.mts +2 -2
- package/dist/esm/types/nodeType.mjs +4 -2
- package/dist/esm/utils/getStackTraceInfo.d.mts +4 -4
- package/dist/esm/utils/getStackTraceInfo.mjs +5 -3
- package/dist/esm/utils/getStackTraceInfo.mjs.map +1 -1
- package/package.json +12 -8
- package/src/index.ts +2 -0
- package/src/transpiler/content_transformers/enumeration/enumeration.ts +15 -1
- package/src/transpiler/content_transformers/enumeration/getEnumerationContent.ts +23 -0
- package/src/transpiler/content_transformers/translation/getTranslationContent.ts +27 -5
- package/src/transpiler/content_transformers/translation/index.ts +2 -1
- package/src/transpiler/content_transformers/translation/translation.ts +50 -0
- package/src/transpiler/content_transformers/translation/types.ts +72 -0
- package/src/transpiler/index.ts +1 -7
- package/src/utils/getStackTraceInfo.ts +1 -1
- package/dist/cjs/transpiler/content_transformers/translation/translations.cjs.map +0 -1
- package/dist/cjs/transpiler/content_transformers/translation/translations.d.ts +0 -17
- package/dist/esm/transpiler/content_transformers/translation/translations.d.mts +0 -17
- package/dist/esm/transpiler/content_transformers/translation/translations.mjs.map +0 -1
- package/src/transpiler/content_transformers/translation/translations.ts +0 -42
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/content_transformers/translation/getTranslationContent.ts"],"sourcesContent":["import {\n type Locales,\n intlayerIntlConfiguration,\n} from '@intlayer/config/client';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/transpiler/content_transformers/translation/getTranslationContent.ts"],"sourcesContent":["import {\n type Locales,\n intlayerIntlConfiguration,\n} from '@intlayer/config/client';\nimport type { CustomizableLanguageContent } from './types';\n\nconst defaultLocale = intlayerIntlConfiguration.defaultLocale;\n\ntype GetTranslationContent = <Content = string>(\n languageContent: CustomizableLanguageContent<Content>,\n locale: Locales\n) => Content;\n\n/**\n *\n * Allow to pick a content based on a locale.\n * If not locale found, it will return the content related to the default locale.\n *\n * Usage:\n *\n * const content = getTranslationContent({\n * en: 'Hello',\n * fr: 'Bonjour',\n * },\n * 'fr');\n * // 'Bonjour'\n *\n * Using TypeScript:\n * - this function will require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nexport const getTranslationContent: GetTranslationContent = <Content = string>(\n languageContent: CustomizableLanguageContent<Content>,\n locale: Locales\n) => languageContent[locale ?? defaultLocale] ?? languageContent[defaultLocale];\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAGO;AAGP,MAAM,gBAAgB,wCAA0B;AAyBzC,MAAM,wBAA+C,CAC1D,iBACA,WACG,gBAAgB,UAAU,aAAa,KAAK,gBAAgB,aAAa;","names":[]}
|
|
@@ -1,11 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { Locales } from '@intlayer/config/client';
|
|
2
|
+
import { CustomizableLanguageContent } from './types.js';
|
|
3
|
+
import 'intlayer';
|
|
4
|
+
import '../../../utils/getStackTraceInfo.js';
|
|
5
|
+
import '../../../types/nodeType.js';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
type GetTranslationContent = <Content = string>(languageContent: CustomizableLanguageContent<Content>, locale: Locales) => Content;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* Allow to pick a content based on a locale.
|
|
11
|
+
* If not locale found, it will return the content related to the default locale.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
*
|
|
15
|
+
* const content = getTranslationContent({
|
|
16
|
+
* en: 'Hello',
|
|
17
|
+
* fr: 'Bonjour',
|
|
18
|
+
* },
|
|
19
|
+
* 'fr');
|
|
20
|
+
* // 'Bonjour'
|
|
21
|
+
*
|
|
22
|
+
* Using TypeScript:
|
|
23
|
+
* - this function will require each locale to be defined if defined in the project configuration.
|
|
24
|
+
* - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
|
|
25
|
+
*/
|
|
26
|
+
declare const getTranslationContent: GetTranslationContent;
|
|
10
27
|
|
|
11
28
|
export { getTranslationContent };
|
|
@@ -4,34 +4,24 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
8
|
for (let key of __getOwnPropNames(from))
|
|
9
9
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, {
|
|
11
|
-
get: () => from[key],
|
|
12
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
13
|
-
});
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
11
|
}
|
|
15
12
|
return to;
|
|
16
13
|
};
|
|
17
|
-
var __reExport = (target, mod, secondTarget) => (
|
|
18
|
-
|
|
19
|
-
secondTarget && __copyProps(secondTarget, mod, "default")
|
|
20
|
-
);
|
|
21
|
-
var __toCommonJS = (mod) =>
|
|
22
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
16
|
var translation_exports = {};
|
|
24
17
|
module.exports = __toCommonJS(translation_exports);
|
|
25
|
-
__reExport(translation_exports, require(
|
|
26
|
-
__reExport(
|
|
27
|
-
|
|
28
|
-
require("./getTranslationContent.cjs"),
|
|
29
|
-
module.exports
|
|
30
|
-
);
|
|
18
|
+
__reExport(translation_exports, require('./translation.cjs'), module.exports);
|
|
19
|
+
__reExport(translation_exports, require('./getTranslationContent.cjs'), module.exports);
|
|
20
|
+
__reExport(translation_exports, require('./types.cjs'), module.exports);
|
|
31
21
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
-
0 &&
|
|
33
|
-
(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
//# sourceMappingURL=index.cjs.map
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require('./translation.cjs'),
|
|
24
|
+
...require('./getTranslationContent.cjs'),
|
|
25
|
+
...require('./types.cjs')
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/content_transformers/translation/index.ts"],"sourcesContent":["export * from './
|
|
1
|
+
{"version":3,"sources":["../../../../../src/transpiler/content_transformers/translation/index.ts"],"sourcesContent":["export * from './translation';\nexport * from './getTranslationContent';\nexport * from './types';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,gCAAc,0BAAd;AACA,gCAAc,oCADd;AAEA,gCAAc,oBAFd;","names":[]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { getTranslationContent } from
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
export { t } from './translation.js';
|
|
2
|
+
export { getTranslationContent } from './getTranslationContent.js';
|
|
3
|
+
export { ConfigLanguageContent, ConfigLocales, CustomLocales, CustomizableLanguageContent, LanguageContent, TranslationContent } from './types.js';
|
|
4
|
+
import '@intlayer/config/client';
|
|
5
|
+
import 'intlayer';
|
|
6
|
+
import '../../../utils/getStackTraceInfo.js';
|
|
7
|
+
import '../../../types/nodeType.js';
|
package/dist/cjs/transpiler/content_transformers/translation/{translations.cjs → translation.cjs}
RENAMED
|
@@ -8,47 +8,42 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
12
|
for (let key of __getOwnPropNames(from))
|
|
13
13
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, {
|
|
15
|
-
get: () => from[key],
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
17
|
-
});
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
15
|
}
|
|
19
16
|
return to;
|
|
20
17
|
};
|
|
21
|
-
var __toCommonJS = (mod) =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
t: () => translations,
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var translation_exports = {};
|
|
20
|
+
__export(translation_exports, {
|
|
21
|
+
t: () => translation
|
|
26
22
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(translation_exports);
|
|
28
24
|
var import_client = require("@intlayer/config/client");
|
|
29
|
-
var import_types = require(
|
|
30
|
-
var import_getStackTraceInfo = require(
|
|
31
|
-
const
|
|
25
|
+
var import_types = require('../../../types/index.cjs');
|
|
26
|
+
var import_getStackTraceInfo = require('../../../utils/getStackTraceInfo.cjs');
|
|
27
|
+
const { defaultLocale } = import_client.intlayerConfiguration.internationalization;
|
|
28
|
+
const translation = (content) => {
|
|
32
29
|
const stackTraceInfo = (0, import_getStackTraceInfo.getStackTraceInfo)();
|
|
33
30
|
if (typeof content === "string") {
|
|
34
31
|
const result2 = {
|
|
35
32
|
nodeType: import_types.NodeType.Translation,
|
|
36
33
|
...stackTraceInfo,
|
|
37
|
-
[
|
|
38
|
-
content,
|
|
34
|
+
[defaultLocale]: content
|
|
39
35
|
};
|
|
40
36
|
return result2;
|
|
41
37
|
}
|
|
42
38
|
const result = {
|
|
43
39
|
nodeType: import_types.NodeType.Translation,
|
|
44
40
|
...stackTraceInfo,
|
|
45
|
-
...content
|
|
41
|
+
...content
|
|
46
42
|
};
|
|
47
43
|
return result;
|
|
48
44
|
};
|
|
49
45
|
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
-
0 &&
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
//# sourceMappingURL=translations.cjs.map
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
t
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=translation.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/transpiler/content_transformers/translation/translation.ts"],"sourcesContent":["import { intlayerConfiguration } from '@intlayer/config/client';\nimport { NodeType } from '../../../types/index';\nimport { getStackTraceInfo } from '../../../utils/getStackTraceInfo';\nimport type { CustomizableLanguageContent, TranslationContent } from './types';\n\nconst { defaultLocale } = intlayerConfiguration.internationalization;\n\n/**\n *\n * Function intended to be used to build intlayer dictionaries.\n *\n * Get the content of a translation based on the locale.\n *\n * Usage:\n *\n * translation<string>({\n * \"en\": \"Hello\",\n * \"fr\": \"Bonjour\",\n * // ... any other available locale\n * })\n *\n * Using TypeScript:\n * - this function require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nconst translation = <Content = string>(\n content?: CustomizableLanguageContent<Content>\n) => {\n const stackTraceInfo = getStackTraceInfo();\n\n if (typeof content === 'string') {\n const result: TranslationContent<Content> = {\n nodeType: NodeType.Translation,\n ...stackTraceInfo,\n [defaultLocale]: content,\n } as TranslationContent<Content>;\n\n return result;\n }\n\n const result: TranslationContent<Content> = {\n nodeType: NodeType.Translation,\n ...stackTraceInfo,\n ...(content as unknown as object),\n } as TranslationContent<Content>;\n\n return result;\n};\n\nexport { translation as t };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAsC;AACtC,mBAAyB;AACzB,+BAAkC;AAGlC,MAAM,EAAE,cAAc,IAAI,oCAAsB;AAoBhD,MAAM,cAAc,CAClB,YACG;AACH,QAAM,qBAAiB,4CAAkB;AAEzC,MAAI,OAAO,YAAY,UAAU;AAC/B,UAAMA,UAAsC;AAAA,MAC1C,UAAU,sBAAS;AAAA,MACnB,GAAG;AAAA,MACH,CAAC,aAAa,GAAG;AAAA,IACnB;AAEA,WAAOA;AAAA,EACT;AAEA,QAAM,SAAsC;AAAA,IAC1C,UAAU,sBAAS;AAAA,IACnB,GAAG;AAAA,IACH,GAAI;AAAA,EACN;AAEA,SAAO;AACT;","names":["result"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CustomizableLanguageContent, TranslationContent } from './types.js';
|
|
2
|
+
import '@intlayer/config/client';
|
|
3
|
+
import 'intlayer';
|
|
4
|
+
import '../../../utils/getStackTraceInfo.js';
|
|
5
|
+
import '../../../types/nodeType.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* Function intended to be used to build intlayer dictionaries.
|
|
10
|
+
*
|
|
11
|
+
* Get the content of a translation based on the locale.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
*
|
|
15
|
+
* translation<string>({
|
|
16
|
+
* "en": "Hello",
|
|
17
|
+
* "fr": "Bonjour",
|
|
18
|
+
* // ... any other available locale
|
|
19
|
+
* })
|
|
20
|
+
*
|
|
21
|
+
* Using TypeScript:
|
|
22
|
+
* - this function require each locale to be defined if defined in the project configuration.
|
|
23
|
+
* - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
|
|
24
|
+
*/
|
|
25
|
+
declare const translation: <Content = string>(content?: CustomizableLanguageContent<Content>) => TranslationContent<Content>;
|
|
26
|
+
|
|
27
|
+
export { translation as t };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/transpiler/content_transformers/translation/types.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config/client';\n// @ts-expect-error intlayer declared for module augmentation\nimport type { IConfigLocales } from 'intlayer';\nimport type { NodeType } from '../../../types';\nimport type { NoteStackTraceInfo } from '../../../utils/getStackTraceInfo';\n\n/**\n * If module augmented, it will return the configured locales such as Locales.ENGLISH | Locales.FRENCH | Locales.SPANISH | ...\n * If not, it will return never\n */\nexport type ConfigLocales = keyof IConfigLocales<unknown>;\n\n/**\n * If module augmented, it will return the configured locales such as Locales.ENGLISH | Locales.FRENCH | Locales.SPANISH | ...\n * If not, it will return all available locales such as Locales.ENGLISH | Locales.FRENCH | Locales.SPANISH | ...\n */\nexport type CustomLocales = ConfigLocales extends never\n ? LocalesValues\n : ConfigLocales;\n\n/**\n * Record of locales and content\n *\n * const myVar1: LanguageContent<string> = {\n * \"en\": \"\",\n * \"fr\": \"\"\n * }\n *\n * const myVar2: LanguageContent<{age: number, name: string}> = {\n * \"en\": {age: 1, name: \"test\"},\n * \"fr\": {age: 1, name: \"test\"}\n * }\n */\nexport type LanguageContent<Content> = Partial<Record<LocalesValues, Content>>;\nexport type ConfigLanguageContent<Content> = Record<ConfigLocales, Content>;\n\n/**\n * Valid\n * const test: CustomizableLanguageContent<string, Locales.ENGLISH | Locales.FRENCH> = {\n * \"en\": \"test\",\n * \"fr\": \"test\"\n * }\n *\n * const test: CustomizableLanguageContent<number> = {\n * \"fr\": 1,\n * \"en\": 1,\n * ... any other available locale\n * }\n *\n * Invalid\n *\n * const test: CustomizableLanguageContent<string> = {\n * \"en\": \"test\",\n * \"fr\": \"test\",\n * \"sss\": \"test\" // Does not exist in Locales\n * }\n *\n * const test: CustomizableLanguageContent<string, Locales.ENGLISH | Locales.FRENCH> = {\n * \"fr\": \"test\"\n * // Locales.ENGLISH is missing\n * }\n *\n */\nexport type CustomizableLanguageContent<Content = string> =\n ConfigLocales extends never\n ? LanguageContent<Content>\n : ConfigLanguageContent<Content>;\n\nexport type TranslationContent<Content> = LanguageContent<Content> &\n NoteStackTraceInfo & {\n nodeType: NodeType.Translation;\n };\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { LocalesValues } from '@intlayer/config/client';
|
|
2
|
+
import { IConfigLocales } from 'intlayer';
|
|
3
|
+
import { NoteStackTraceInfo } from '../../../utils/getStackTraceInfo.js';
|
|
4
|
+
import { NodeType } from '../../../types/nodeType.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* If module augmented, it will return the configured locales such as Locales.ENGLISH | Locales.FRENCH | Locales.SPANISH | ...
|
|
8
|
+
* If not, it will return never
|
|
9
|
+
*/
|
|
10
|
+
type ConfigLocales = keyof IConfigLocales<unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* If module augmented, it will return the configured locales such as Locales.ENGLISH | Locales.FRENCH | Locales.SPANISH | ...
|
|
13
|
+
* If not, it will return all available locales such as Locales.ENGLISH | Locales.FRENCH | Locales.SPANISH | ...
|
|
14
|
+
*/
|
|
15
|
+
type CustomLocales = ConfigLocales extends never ? LocalesValues : ConfigLocales;
|
|
16
|
+
/**
|
|
17
|
+
* Record of locales and content
|
|
18
|
+
*
|
|
19
|
+
* const myVar1: LanguageContent<string> = {
|
|
20
|
+
* "en": "",
|
|
21
|
+
* "fr": ""
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* const myVar2: LanguageContent<{age: number, name: string}> = {
|
|
25
|
+
* "en": {age: 1, name: "test"},
|
|
26
|
+
* "fr": {age: 1, name: "test"}
|
|
27
|
+
* }
|
|
28
|
+
*/
|
|
29
|
+
type LanguageContent<Content> = Partial<Record<LocalesValues, Content>>;
|
|
30
|
+
type ConfigLanguageContent<Content> = Record<ConfigLocales, Content>;
|
|
31
|
+
/**
|
|
32
|
+
* Valid
|
|
33
|
+
* const test: CustomizableLanguageContent<string, Locales.ENGLISH | Locales.FRENCH> = {
|
|
34
|
+
* "en": "test",
|
|
35
|
+
* "fr": "test"
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* const test: CustomizableLanguageContent<number> = {
|
|
39
|
+
* "fr": 1,
|
|
40
|
+
* "en": 1,
|
|
41
|
+
* ... any other available locale
|
|
42
|
+
* }
|
|
43
|
+
*
|
|
44
|
+
* Invalid
|
|
45
|
+
*
|
|
46
|
+
* const test: CustomizableLanguageContent<string> = {
|
|
47
|
+
* "en": "test",
|
|
48
|
+
* "fr": "test",
|
|
49
|
+
* "sss": "test" // Does not exist in Locales
|
|
50
|
+
* }
|
|
51
|
+
*
|
|
52
|
+
* const test: CustomizableLanguageContent<string, Locales.ENGLISH | Locales.FRENCH> = {
|
|
53
|
+
* "fr": "test"
|
|
54
|
+
* // Locales.ENGLISH is missing
|
|
55
|
+
* }
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
type CustomizableLanguageContent<Content = string> = ConfigLocales extends never ? LanguageContent<Content> : ConfigLanguageContent<Content>;
|
|
59
|
+
type TranslationContent<Content> = LanguageContent<Content> & NoteStackTraceInfo & {
|
|
60
|
+
nodeType: NodeType.Translation;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export type { ConfigLanguageContent, ConfigLocales, CustomLocales, CustomizableLanguageContent, LanguageContent, TranslationContent };
|
|
@@ -3,34 +3,21 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
6
|
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
8
|
for (let key of __getOwnPropNames(from))
|
|
13
9
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, {
|
|
15
|
-
get: () => from[key],
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
17
|
-
});
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
11
|
}
|
|
19
12
|
return to;
|
|
20
13
|
};
|
|
21
|
-
var
|
|
22
|
-
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
16
|
var transpiler_exports = {};
|
|
24
|
-
__export(transpiler_exports, {
|
|
25
|
-
enu: () => import_content_transformers.enu,
|
|
26
|
-
t: () => import_content_transformers.t,
|
|
27
|
-
});
|
|
28
17
|
module.exports = __toCommonJS(transpiler_exports);
|
|
29
|
-
|
|
18
|
+
__reExport(transpiler_exports, require('./content_transformers/index.cjs'), module.exports);
|
|
30
19
|
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
-
0 &&
|
|
32
|
-
(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=index.cjs.map
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require('./content_transformers/index.cjs')
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/transpiler/index.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["../../../src/transpiler/index.ts"],"sourcesContent":["export * from './content_transformers/index';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,yCAAd;","names":[]}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "./content_transformers/enumeration/enumeration.js";
|
|
11
|
-
import "@intlayer/config/client";
|
|
12
|
-
import "../utils/getStackTraceInfo.js";
|
|
13
|
-
import "../types/nodeType.js";
|
|
1
|
+
export { t } from './content_transformers/translation/translation.js';
|
|
2
|
+
export { getTranslationContent } from './content_transformers/translation/getTranslationContent.js';
|
|
3
|
+
export { ConfigLanguageContent, ConfigLocales, CustomLocales, CustomizableLanguageContent, LanguageContent, TranslationContent } from './content_transformers/translation/types.js';
|
|
4
|
+
export { EnumerationContent, QuantityContent, enu } from './content_transformers/enumeration/enumeration.js';
|
|
5
|
+
export { getEnumerationContent } from './content_transformers/enumeration/getEnumerationContent.js';
|
|
6
|
+
import '@intlayer/config/client';
|
|
7
|
+
import 'intlayer';
|
|
8
|
+
import '../utils/getStackTraceInfo.js';
|
|
9
|
+
import '../types/nodeType.js';
|
|
@@ -4,18 +4,14 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
8
|
for (let key of __getOwnPropNames(from))
|
|
9
9
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, {
|
|
11
|
-
get: () => from[key],
|
|
12
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
13
|
-
});
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
11
|
}
|
|
15
12
|
return to;
|
|
16
13
|
};
|
|
17
|
-
var __toCommonJS = (mod) =>
|
|
18
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
15
|
var contentModule_exports = {};
|
|
20
16
|
module.exports = __toCommonJS(contentModule_exports);
|
|
21
|
-
//# sourceMappingURL=contentModule.cjs.map
|
|
17
|
+
//# sourceMappingURL=contentModule.cjs.map
|
|
@@ -1,35 +1,21 @@
|
|
|
1
|
-
import { TranslationContent } from
|
|
2
|
-
import { EnumerationContent } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { TranslationContent } from '../transpiler/content_transformers/translation/types.js';
|
|
2
|
+
import { EnumerationContent } from '../transpiler/content_transformers/enumeration/enumeration.js';
|
|
3
|
+
import './nodeType.js';
|
|
4
|
+
import '@intlayer/config/client';
|
|
5
|
+
import 'intlayer';
|
|
6
|
+
import '../utils/getStackTraceInfo.js';
|
|
6
7
|
|
|
7
8
|
type TypedNode = TranslationContent<unknown> | EnumerationContent<unknown>;
|
|
8
|
-
type ContentValue =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[key: string]: ContentValue;
|
|
12
|
-
}
|
|
13
|
-
| (() => ContentValue)
|
|
14
|
-
| Promise<ContentValue>
|
|
15
|
-
| TypedNode;
|
|
9
|
+
type ContentValue = string | {
|
|
10
|
+
[key: string]: ContentValue;
|
|
11
|
+
} | (() => ContentValue) | Promise<ContentValue> | TypedNode;
|
|
16
12
|
type Content = Record<string, ContentValue | undefined>;
|
|
17
|
-
type FlatContentValue =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
[key: string]: FlatContentValue;
|
|
21
|
-
}
|
|
22
|
-
| TypedNode;
|
|
13
|
+
type FlatContentValue = string | {
|
|
14
|
+
[key: string]: FlatContentValue;
|
|
15
|
+
} | TypedNode;
|
|
23
16
|
type FlatContent = Record<string, FlatContentValue | undefined>;
|
|
24
17
|
type ContentModule = Content & {
|
|
25
|
-
|
|
18
|
+
id: string;
|
|
26
19
|
};
|
|
27
20
|
|
|
28
|
-
export type {
|
|
29
|
-
Content,
|
|
30
|
-
ContentModule,
|
|
31
|
-
ContentValue,
|
|
32
|
-
FlatContent,
|
|
33
|
-
FlatContentValue,
|
|
34
|
-
TypedNode,
|
|
35
|
-
};
|
|
21
|
+
export type { Content, ContentModule, ContentValue, FlatContent, FlatContentValue, TypedNode };
|
package/dist/cjs/types/index.cjs
CHANGED
|
@@ -8,27 +8,22 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
12
|
for (let key of __getOwnPropNames(from))
|
|
13
13
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, {
|
|
15
|
-
get: () => from[key],
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
17
|
-
});
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
15
|
}
|
|
19
16
|
return to;
|
|
20
17
|
};
|
|
21
|
-
var __toCommonJS = (mod) =>
|
|
22
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
19
|
var types_exports = {};
|
|
24
20
|
__export(types_exports, {
|
|
25
|
-
NodeType: () => import_nodeType.NodeType
|
|
21
|
+
NodeType: () => import_nodeType.NodeType
|
|
26
22
|
});
|
|
27
23
|
module.exports = __toCommonJS(types_exports);
|
|
28
|
-
var import_nodeType = require(
|
|
24
|
+
var import_nodeType = require('./nodeType.cjs');
|
|
29
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
-
0 &&
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
//# sourceMappingURL=index.cjs.map
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
NodeType
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "./contentModule.js";
|
|
9
|
-
export { NodeType } from "./nodeType.js";
|
|
10
|
-
import "../transpiler/content_transformers/translation/translations.js";
|
|
11
|
-
import "@intlayer/config/client";
|
|
12
|
-
import "../utils/getStackTraceInfo.js";
|
|
13
|
-
import "../transpiler/content_transformers/enumeration/enumeration.js";
|
|
1
|
+
export { Content, ContentModule, ContentValue, FlatContent, FlatContentValue, TypedNode } from './contentModule.js';
|
|
2
|
+
export { NodeType } from './nodeType.js';
|
|
3
|
+
import '../transpiler/content_transformers/translation/types.js';
|
|
4
|
+
import '@intlayer/config/client';
|
|
5
|
+
import 'intlayer';
|
|
6
|
+
import '../utils/getStackTraceInfo.js';
|
|
7
|
+
import '../transpiler/content_transformers/enumeration/enumeration.js';
|
|
@@ -8,21 +8,17 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
12
|
for (let key of __getOwnPropNames(from))
|
|
13
13
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, {
|
|
15
|
-
get: () => from[key],
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
17
|
-
});
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
15
|
}
|
|
19
16
|
return to;
|
|
20
17
|
};
|
|
21
|
-
var __toCommonJS = (mod) =>
|
|
22
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
19
|
var nodeType_exports = {};
|
|
24
20
|
__export(nodeType_exports, {
|
|
25
|
-
NodeType: () => NodeType
|
|
21
|
+
NodeType: () => NodeType
|
|
26
22
|
});
|
|
27
23
|
module.exports = __toCommonJS(nodeType_exports);
|
|
28
24
|
var NodeType = /* @__PURE__ */ ((NodeType2) => {
|
|
@@ -31,8 +27,7 @@ var NodeType = /* @__PURE__ */ ((NodeType2) => {
|
|
|
31
27
|
return NodeType2;
|
|
32
28
|
})(NodeType || {});
|
|
33
29
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
-
0 &&
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=nodeType.cjs.map
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
NodeType
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=nodeType.cjs.map
|
|
@@ -8,21 +8,17 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
12
|
for (let key of __getOwnPropNames(from))
|
|
13
13
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, {
|
|
15
|
-
get: () => from[key],
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
17
|
-
});
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
15
|
}
|
|
19
16
|
return to;
|
|
20
17
|
};
|
|
21
|
-
var __toCommonJS = (mod) =>
|
|
22
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
19
|
var getStackTraceInfo_exports = {};
|
|
24
20
|
__export(getStackTraceInfo_exports, {
|
|
25
|
-
getStackTraceInfo: () => getStackTraceInfo
|
|
21
|
+
getStackTraceInfo: () => getStackTraceInfo
|
|
26
22
|
});
|
|
27
23
|
module.exports = __toCommonJS(getStackTraceInfo_exports);
|
|
28
24
|
const getStackTraceInfo = () => {
|
|
@@ -37,14 +33,13 @@ const getStackTraceInfo = () => {
|
|
|
37
33
|
return {
|
|
38
34
|
// file,
|
|
39
35
|
line,
|
|
40
|
-
column
|
|
36
|
+
column
|
|
41
37
|
};
|
|
42
38
|
}
|
|
43
39
|
return {};
|
|
44
40
|
};
|
|
45
41
|
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
-
0 &&
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=getStackTraceInfo.cjs.map
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
getStackTraceInfo
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=getStackTraceInfo.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/getStackTraceInfo.ts"],"sourcesContent":["export type NoteStackTraceInfo = {\n file?: string;\n line?: string;\n column?: string;\n};\n\n/**\n * Get the file path, line number, and column number of the caller of this function\n *
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/getStackTraceInfo.ts"],"sourcesContent":["export type NoteStackTraceInfo = {\n file?: string;\n line?: string;\n column?: string;\n};\n\n/**\n * Get the file path, line number, and column number of the caller of this function\n * Return an object containing file, line, and column numbers\n */\nexport const getStackTraceInfo = (): NoteStackTraceInfo => {\n // Create a new Error object to capture the stack trace\n const err = new Error();\n const stack = err.stack ?? '';\n\n // Split the stack trace into lines and find the line where this function was called\n // Adjust the line index as necessary based on how your environment's stack trace format\n const stackLines = stack.split('\\n');\n const callerLine = stackLines[2] ?? ''; // Adjust the index 2 if needed\n\n // Extract file path, line number, and column number using a regular expression\n // This regex pattern might need adjustments based on your environment\n const match = callerLine.match(/at\\s[^(:]+\\([^:]+:(\\d+):(\\d+)\\)?/);\n\n // const file = match?.[1];\n const line = match?.[1];\n const column = match?.[2];\n\n if (match) {\n return {\n // file,\n line,\n column,\n };\n }\n\n // Return empty object if parsing fails\n return {};\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,MAAM,oBAAoB,MAA0B;AAEzD,QAAM,MAAM,IAAI,MAAM;AACtB,QAAM,QAAQ,IAAI,SAAS;AAI3B,QAAM,aAAa,MAAM,MAAM,IAAI;AACnC,QAAM,aAAa,WAAW,CAAC,KAAK;AAIpC,QAAM,QAAQ,WAAW,MAAM,kCAAkC;AAGjE,QAAM,OAAO,QAAQ,CAAC;AACtB,QAAM,SAAS,QAAQ,CAAC;AAExB,MAAI,OAAO;AACT,WAAO;AAAA;AAAA,MAEL;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAGA,SAAO,CAAC;AACV;","names":[]}
|