@intlayer/core 2.0.0 → 2.0.1

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.
Files changed (70) hide show
  1. package/dist/cjs/index.cjs +3 -0
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/index.d.ts +5 -3
  4. package/dist/cjs/transpiler/content_transformers/index.d.ts +0 -1
  5. package/dist/cjs/transpiler/content_transformers/translation/getTranslationContent.d.ts +0 -1
  6. package/dist/cjs/transpiler/content_transformers/translation/index.d.ts +0 -1
  7. package/dist/cjs/transpiler/content_transformers/translation/translation.d.ts +0 -1
  8. package/dist/cjs/transpiler/content_transformers/translation/types.cjs.map +1 -1
  9. package/dist/cjs/transpiler/content_transformers/translation/types.d.ts +1 -2
  10. package/dist/cjs/transpiler/index.d.ts +0 -1
  11. package/dist/cjs/types/declarationContent.cjs +17 -0
  12. package/dist/cjs/types/declarationContent.cjs.map +1 -0
  13. package/dist/cjs/types/{contentModule.d.ts → declarationContent.d.ts} +9 -4
  14. package/dist/cjs/types/{contentModule.cjs → dictionary.cjs} +3 -3
  15. package/dist/cjs/types/dictionary.cjs.map +1 -0
  16. package/dist/cjs/types/dictionary.d.ts +17 -0
  17. package/dist/cjs/types/index.cjs.map +1 -1
  18. package/dist/cjs/types/index.d.ts +4 -3
  19. package/dist/cjs/types/keyPath.cjs.map +1 -1
  20. package/dist/cjs/types/keyPath.d.ts +6 -2
  21. package/dist/cjs/utils/{getStackTraceInfo.cjs → isSameKeyPath.cjs} +9 -23
  22. package/dist/cjs/utils/isSameKeyPath.cjs.map +1 -0
  23. package/dist/cjs/utils/isSameKeyPath.d.ts +6 -0
  24. package/dist/esm/index.d.mts +5 -3
  25. package/dist/esm/index.mjs +2 -0
  26. package/dist/esm/index.mjs.map +1 -1
  27. package/dist/esm/transpiler/content_transformers/index.d.mts +0 -1
  28. package/dist/esm/transpiler/content_transformers/translation/getTranslationContent.d.mts +0 -1
  29. package/dist/esm/transpiler/content_transformers/translation/index.d.mts +0 -1
  30. package/dist/esm/transpiler/content_transformers/translation/translation.d.mts +0 -1
  31. package/dist/esm/transpiler/content_transformers/translation/types.d.mts +1 -2
  32. package/dist/esm/transpiler/index.d.mts +0 -1
  33. package/dist/esm/types/{contentModule.d.mts → declarationContent.d.mts} +9 -4
  34. package/dist/esm/types/declarationContent.mjs +1 -0
  35. package/dist/esm/types/dictionary.d.mts +17 -0
  36. package/dist/esm/types/dictionary.mjs +1 -0
  37. package/dist/esm/types/dictionary.mjs.map +1 -0
  38. package/dist/esm/types/index.d.mts +4 -3
  39. package/dist/esm/types/index.mjs.map +1 -1
  40. package/dist/esm/types/keyPath.d.mts +6 -2
  41. package/dist/esm/utils/isSameKeyPath.d.mts +6 -0
  42. package/dist/esm/utils/isSameKeyPath.mjs +7 -0
  43. package/dist/esm/utils/isSameKeyPath.mjs.map +1 -0
  44. package/package.json +2 -3
  45. package/src/index.ts +6 -1
  46. package/dist/cjs/types/contentModule.cjs.map +0 -1
  47. package/dist/cjs/utils/getStackTraceInfo.cjs.map +0 -1
  48. package/dist/cjs/utils/getStackTraceInfo.d.ts +0 -12
  49. package/dist/esm/types/contentModule.mjs +0 -1
  50. package/dist/esm/utils/getStackTraceInfo.d.mts +0 -12
  51. package/dist/esm/utils/getStackTraceInfo.mjs +0 -21
  52. package/dist/esm/utils/getStackTraceInfo.mjs.map +0 -1
  53. package/src/getLocaleName.ts +0 -463
  54. package/src/localeList.ts +0 -229
  55. package/src/transpiler/content_transformers/enumeration/enumeration.ts +0 -66
  56. package/src/transpiler/content_transformers/enumeration/findMatchingCondition.ts +0 -64
  57. package/src/transpiler/content_transformers/enumeration/getEnumerationContent.ts +0 -38
  58. package/src/transpiler/content_transformers/enumeration/index.ts +0 -3
  59. package/src/transpiler/content_transformers/index.ts +0 -2
  60. package/src/transpiler/content_transformers/translation/getTranslationContent.ts +0 -33
  61. package/src/transpiler/content_transformers/translation/index.ts +0 -3
  62. package/src/transpiler/content_transformers/translation/translation.ts +0 -49
  63. package/src/transpiler/content_transformers/translation/types.ts +0 -71
  64. package/src/transpiler/index.ts +0 -1
  65. package/src/types/contentModule.ts +0 -33
  66. package/src/types/index.ts +0 -14
  67. package/src/types/keyPath.ts +0 -13
  68. package/src/types/nodeType.ts +0 -4
  69. package/src/utils/getStackTraceInfo.ts +0 -39
  70. /package/dist/esm/types/{contentModule.mjs.map → declarationContent.mjs.map} +0 -0
@@ -24,6 +24,7 @@ __export(src_exports, {
24
24
  getEnumerationContent: () => import_content_transformers.getEnumerationContent,
25
25
  getLocaleName: () => import_getLocaleName.getLocaleName,
26
26
  getTranslationContent: () => import_content_transformers.getTranslationContent,
27
+ isSameKeyPath: () => import_isSameKeyPath.isSameKeyPath,
27
28
  localeList: () => import_localeList.localeList,
28
29
  t: () => import_content_transformers.t
29
30
  });
@@ -32,6 +33,7 @@ var import_content_transformers = require('./transpiler/content_transformers/ind
32
33
  var import_types = require('./types/index.cjs');
33
34
  var import_getLocaleName = require('./getLocaleName.cjs');
34
35
  var import_localeList = require('./localeList.cjs');
36
+ var import_isSameKeyPath = require('./utils/isSameKeyPath.cjs');
35
37
  // Annotate the CommonJS export names for ESM import in node:
36
38
  0 && (module.exports = {
37
39
  NodeType,
@@ -40,6 +42,7 @@ var import_localeList = require('./localeList.cjs');
40
42
  getEnumerationContent,
41
43
  getLocaleName,
42
44
  getTranslationContent,
45
+ isSameKeyPath,
43
46
  localeList,
44
47
  t
45
48
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type {\n CustomizableLanguageContent,\n LanguageContent,\n TranslationContent,\n EnumerationContent,\n QuantityContent,\n CustomLocales as Locales,\n} from './transpiler/content_transformers/index';\nexport {\n t,\n enu,\n getTranslationContent,\n findMatchingCondition,\n getEnumerationContent,\n} from './transpiler/content_transformers/index';\nexport type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n ContentModule,\n KeyPath,\n ObjectExpressionNode,\n TranslationOrEnumerationNode,\n} from './types/index';\nexport { NodeType } from './types/index';\nexport { getLocaleName } from './getLocaleName';\nexport { localeList } from './localeList';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,kCAMO;AAYP,mBAAyB;AACzB,2BAA8B;AAC9B,wBAA2B;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type {\n CustomizableLanguageContent,\n LanguageContent,\n TranslationContent,\n EnumerationContent,\n QuantityContent,\n CustomLocales as Locales,\n} from './transpiler/content_transformers/index';\nexport {\n t,\n enu,\n getTranslationContent,\n findMatchingCondition,\n getEnumerationContent,\n} from './transpiler/content_transformers/index';\nexport type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n DeclarationContent,\n ContentValueArray,\n KeyPath,\n ObjectExpressionNode,\n ArrayExpressionNode,\n TranslationOrEnumerationNode,\n DictionaryValue,\n Dictionary,\n} from './types/index';\nexport { NodeType } from './types/index';\nexport { getLocaleName } from './getLocaleName';\nexport { localeList } from './localeList';\nexport { isSameKeyPath } from './utils/isSameKeyPath';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,kCAMO;AAgBP,mBAAyB;AACzB,2BAA8B;AAC9B,wBAA2B;AAC3B,2BAA8B;","names":[]}
@@ -4,11 +4,13 @@ export { CustomizableLanguageContent, LanguageContent, CustomLocales as Locales,
4
4
  export { EnumerationContent, QuantityContent, enu } from './transpiler/content_transformers/enumeration/enumeration.js';
5
5
  export { getEnumerationContent } from './transpiler/content_transformers/enumeration/getEnumerationContent.js';
6
6
  export { findMatchingCondition } from './transpiler/content_transformers/enumeration/findMatchingCondition.js';
7
- export { Content, ContentModule, ContentValue, FlatContent, FlatContentValue, TypedNode } from './types/contentModule.js';
7
+ export { Content, ContentValue, ContentValueArray, DeclarationContent, FlatContent, FlatContentValue, TypedNode } from './types/declarationContent.js';
8
8
  export { NodeType } from './types/nodeType.js';
9
- export { KeyPath, ObjectExpressionNode, TranslationOrEnumerationNode } from './types/keyPath.js';
9
+ export { ArrayExpressionNode, KeyPath, ObjectExpressionNode, TranslationOrEnumerationNode } from './types/keyPath.js';
10
+ export { Dictionary, DictionaryValue } from './types/dictionary.js';
10
11
  export { getLocaleName } from './getLocaleName.js';
11
12
  export { localeList } from './localeList.js';
13
+ export { isSameKeyPath } from './utils/isSameKeyPath.js';
12
14
  import '@intlayer/config/client';
13
15
  import 'intlayer';
14
- import './utils/getStackTraceInfo.js';
16
+ import 'react';
@@ -7,4 +7,3 @@ export { findMatchingCondition } from './enumeration/findMatchingCondition.js';
7
7
  import '@intlayer/config/client';
8
8
  import 'intlayer';
9
9
  import '../../types/nodeType.js';
10
- import '../../utils/getStackTraceInfo.js';
@@ -2,7 +2,6 @@ import { Locales } from '@intlayer/config/client';
2
2
  import { CustomizableLanguageContent } from './types.js';
3
3
  import 'intlayer';
4
4
  import '../../../types/nodeType.js';
5
- import '../../../utils/getStackTraceInfo.js';
6
5
 
7
6
  type GetTranslationContent = <Content = string>(languageContent: CustomizableLanguageContent<Content>, locale: Locales) => Content;
8
7
  /**
@@ -4,4 +4,3 @@ export { ConfigLocales, CustomLocales, CustomizableLanguageContent, LanguageCont
4
4
  import '@intlayer/config/client';
5
5
  import 'intlayer';
6
6
  import '../../../types/nodeType.js';
7
- import '../../../utils/getStackTraceInfo.js';
@@ -2,7 +2,6 @@ import { TranslationContent } from './types.js';
2
2
  import '@intlayer/config/client';
3
3
  import 'intlayer';
4
4
  import '../../../types/nodeType.js';
5
- import '../../../utils/getStackTraceInfo.js';
6
5
 
7
6
  /**
8
7
  *
@@ -1 +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>>;\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 : IConfigLocales<Content>;\n\nexport type TranslationContent<Content> = LanguageContent<Content> &\n NoteStackTraceInfo & {\n nodeType: NodeType.Translation;\n };\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
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';\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>>;\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 : IConfigLocales<Content>;\n\nexport type TranslationContent<Content> = LanguageContent<Content> & {\n nodeType: NodeType.Translation;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,7 +1,6 @@
1
1
  import { LocalesValues } from '@intlayer/config/client';
2
2
  import { IConfigLocales } from 'intlayer';
3
3
  import { NodeType } from '../../../types/nodeType.js';
4
- import { NoteStackTraceInfo } from '../../../utils/getStackTraceInfo.js';
5
4
 
6
5
  /**
7
6
  * If module augmented, it will return the configured locales such as Locales.ENGLISH | Locales.FRENCH | Locales.SPANISH | ...
@@ -55,7 +54,7 @@ type LanguageContent<Content> = Partial<Record<LocalesValues, Content>>;
55
54
  *
56
55
  */
57
56
  type CustomizableLanguageContent<Content = string> = ConfigLocales extends never ? LanguageContent<Content> : IConfigLocales<Content>;
58
- type TranslationContent<Content> = LanguageContent<Content> & NoteStackTraceInfo & {
57
+ type TranslationContent<Content> = LanguageContent<Content> & {
59
58
  nodeType: NodeType.Translation;
60
59
  };
61
60
 
@@ -7,4 +7,3 @@ export { findMatchingCondition } from './content_transformers/enumeration/findMa
7
7
  import '@intlayer/config/client';
8
8
  import 'intlayer';
9
9
  import '../types/nodeType.js';
10
- import '../utils/getStackTraceInfo.js';
@@ -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 declarationContent_exports = {};
16
+ module.exports = __toCommonJS(declarationContent_exports);
17
+ //# sourceMappingURL=declarationContent.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/declarationContent.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type {\n EnumerationContent,\n TranslationContent,\n} from '../transpiler/index';\n\nexport type TypedNode =\n | TranslationContent<unknown>\n | EnumerationContent<unknown>;\n\ntype ArrayOfSameType<T> = T extends (infer U)[]\n ? U extends T[number]\n ? T\n : never\n : never;\n\nexport type ContentValueArray = ArrayOfSameType<ContentValue[]>;\n\nexport type ContentValue =\n | string\n | {\n [key: string]: ContentValue;\n }\n | (() => ContentValue)\n | Promise<ContentValue>\n | TypedNode;\n\nexport type Content = Record<\n string,\n ContentValue | ContentValueArray | undefined\n>;\n\nexport type FlatContentValue =\n | string\n | {\n [key: string]: FlatContentValue;\n }\n | TypedNode;\n\nexport type FlatContent = Record<string, FlatContentValue | undefined>;\n\n// Utility type that performs recursive replacement\ntype ReplaceContentValue<T> = {\n [P in keyof T]: T[P] extends string | number | boolean | null | ReactNode\n ? ContentValue\n : T[P] extends object\n ? ReplaceContentValue<T[P]>\n : T[P];\n};\n\nexport type DeclarationContent<T = undefined> = (T extends undefined // Applying the generic to replace ContentValue with Replacement\n ? Content\n : ReplaceContentValue<T>) & {\n id: string;\n filePath?: string;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,22 +1,27 @@
1
+ import { ReactNode } from 'react';
1
2
  import { TranslationContent } from '../transpiler/content_transformers/translation/types.js';
2
3
  import { EnumerationContent } from '../transpiler/content_transformers/enumeration/enumeration.js';
3
4
  import '@intlayer/config/client';
4
5
  import 'intlayer';
5
6
  import './nodeType.js';
6
- import '../utils/getStackTraceInfo.js';
7
7
 
8
8
  type TypedNode = TranslationContent<unknown> | EnumerationContent<unknown>;
9
+ type ArrayOfSameType<T> = T extends (infer U)[] ? U extends T[number] ? T : never : never;
10
+ type ContentValueArray = ArrayOfSameType<ContentValue[]>;
9
11
  type ContentValue = string | {
10
12
  [key: string]: ContentValue;
11
13
  } | (() => ContentValue) | Promise<ContentValue> | TypedNode;
12
- type Content = Record<string, ContentValue | undefined>;
14
+ type Content = Record<string, ContentValue | ContentValueArray | undefined>;
13
15
  type FlatContentValue = string | {
14
16
  [key: string]: FlatContentValue;
15
17
  } | TypedNode;
16
18
  type FlatContent = Record<string, FlatContentValue | undefined>;
17
- type ContentModule = Content & {
19
+ type ReplaceContentValue<T> = {
20
+ [P in keyof T]: T[P] extends string | number | boolean | null | ReactNode ? ContentValue : T[P] extends object ? ReplaceContentValue<T[P]> : T[P];
21
+ };
22
+ type DeclarationContent<T = undefined> = (T extends undefined ? Content : ReplaceContentValue<T>) & {
18
23
  id: string;
19
24
  filePath?: string;
20
25
  };
21
26
 
22
- export type { Content, ContentModule, ContentValue, FlatContent, FlatContentValue, TypedNode };
27
+ export type { Content, ContentValue, ContentValueArray, DeclarationContent, FlatContent, FlatContentValue, TypedNode };
@@ -12,6 +12,6 @@ var __copyProps = (to, from, except, desc) => {
12
12
  return to;
13
13
  };
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var contentModule_exports = {};
16
- module.exports = __toCommonJS(contentModule_exports);
17
- //# sourceMappingURL=contentModule.cjs.map
15
+ var dictionary_exports = {};
16
+ module.exports = __toCommonJS(dictionary_exports);
17
+ //# sourceMappingURL=dictionary.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/types/dictionary.ts"],"sourcesContent":["import type {\n EnumerationContent,\n TranslationContent,\n} from '../transpiler/index';\n\nexport type RecursiveDictionaryValue =\n | number\n | string\n | { [paramKey: string]: RecursiveDictionaryValue }\n | RecursiveDictionaryValue[];\n\nexport type DictionaryValue =\n | RecursiveDictionaryValue\n | TranslationContent<RecursiveDictionaryValue>\n | EnumerationContent<RecursiveDictionaryValue>;\n\nexport type Dictionary = {\n id: string;\n filePath: string;\n [key: string]: DictionaryValue;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,17 @@
1
+ import { TranslationContent } from '../transpiler/content_transformers/translation/types.js';
2
+ import { EnumerationContent } from '../transpiler/content_transformers/enumeration/enumeration.js';
3
+ import '@intlayer/config/client';
4
+ import 'intlayer';
5
+ import './nodeType.js';
6
+
7
+ type RecursiveDictionaryValue = number | string | {
8
+ [paramKey: string]: RecursiveDictionaryValue;
9
+ } | RecursiveDictionaryValue[];
10
+ type DictionaryValue = RecursiveDictionaryValue | TranslationContent<RecursiveDictionaryValue> | EnumerationContent<RecursiveDictionaryValue>;
11
+ type Dictionary = {
12
+ id: string;
13
+ filePath: string;
14
+ [key: string]: DictionaryValue;
15
+ };
16
+
17
+ export type { Dictionary, DictionaryValue, RecursiveDictionaryValue };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/types/index.ts"],"sourcesContent":["export type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n ContentModule,\n} from './contentModule';\nexport { NodeType } from './nodeType';\nexport type {\n KeyPath,\n ObjectExpressionNode,\n TranslationOrEnumerationNode,\n} from './keyPath';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,sBAAyB;","names":[]}
1
+ {"version":3,"sources":["../../../src/types/index.ts"],"sourcesContent":["export type {\n ContentValue,\n ContentValueArray,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n DeclarationContent,\n} from './declarationContent';\nexport { NodeType } from './nodeType';\nexport type {\n KeyPath,\n ObjectExpressionNode,\n ArrayExpressionNode,\n TranslationOrEnumerationNode,\n} from './keyPath';\nexport type { DictionaryValue, Dictionary } from './dictionary';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,sBAAyB;","names":[]}
@@ -1,8 +1,9 @@
1
- export { Content, ContentModule, ContentValue, FlatContent, FlatContentValue, TypedNode } from './contentModule.js';
1
+ export { Content, ContentValue, ContentValueArray, DeclarationContent, FlatContent, FlatContentValue, TypedNode } from './declarationContent.js';
2
2
  export { NodeType } from './nodeType.js';
3
- export { KeyPath, ObjectExpressionNode, TranslationOrEnumerationNode } from './keyPath.js';
3
+ export { ArrayExpressionNode, KeyPath, ObjectExpressionNode, TranslationOrEnumerationNode } from './keyPath.js';
4
+ export { Dictionary, DictionaryValue } from './dictionary.js';
5
+ import 'react';
4
6
  import '../transpiler/content_transformers/translation/types.js';
5
7
  import '@intlayer/config/client';
6
8
  import 'intlayer';
7
- import '../utils/getStackTraceInfo.js';
8
9
  import '../transpiler/content_transformers/enumeration/enumeration.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/types/keyPath.ts"],"sourcesContent":["import type { NodeType } from './nodeType';\n\nexport type ObjectExpressionNode = {\n type: 'ObjectExpression';\n key: string;\n};\n\nexport type TranslationOrEnumerationNode = {\n type: NodeType;\n key: string;\n};\n\nexport type KeyPath = ObjectExpressionNode | TranslationOrEnumerationNode;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../../src/types/keyPath.ts"],"sourcesContent":["import type { NodeType } from './nodeType';\n\nexport type ObjectExpressionNode = {\n type: 'ObjectExpression';\n key: string;\n};\n\nexport type ArrayExpressionNode = {\n type: 'ArrayExpression';\n key: number;\n};\n\nexport type TranslationOrEnumerationNode = {\n type: NodeType;\n key: string;\n};\n\nexport type KeyPath =\n | ObjectExpressionNode\n | ArrayExpressionNode\n | TranslationOrEnumerationNode;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -4,10 +4,14 @@ type ObjectExpressionNode = {
4
4
  type: 'ObjectExpression';
5
5
  key: string;
6
6
  };
7
+ type ArrayExpressionNode = {
8
+ type: 'ArrayExpression';
9
+ key: number;
10
+ };
7
11
  type TranslationOrEnumerationNode = {
8
12
  type: NodeType;
9
13
  key: string;
10
14
  };
11
- type KeyPath = ObjectExpressionNode | TranslationOrEnumerationNode;
15
+ type KeyPath = ObjectExpressionNode | ArrayExpressionNode | TranslationOrEnumerationNode;
12
16
 
13
- export type { KeyPath, ObjectExpressionNode, TranslationOrEnumerationNode };
17
+ export type { ArrayExpressionNode, KeyPath, ObjectExpressionNode, TranslationOrEnumerationNode };
@@ -16,30 +16,16 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var getStackTraceInfo_exports = {};
20
- __export(getStackTraceInfo_exports, {
21
- getStackTraceInfo: () => getStackTraceInfo
19
+ var isSameKeyPath_exports = {};
20
+ __export(isSameKeyPath_exports, {
21
+ isSameKeyPath: () => isSameKeyPath
22
22
  });
23
- module.exports = __toCommonJS(getStackTraceInfo_exports);
24
- const getStackTraceInfo = () => {
25
- const err = new Error();
26
- const stack = err.stack ?? "";
27
- const stackLines = stack.split("\n");
28
- const callerLine = stackLines[2] ?? "";
29
- const match = callerLine.match(/at\s[^(:]+\([^:]+:(\d+):(\d+)\)?/);
30
- const line = match?.[1];
31
- const column = match?.[2];
32
- if (match) {
33
- return {
34
- // file,
35
- line,
36
- column
37
- };
38
- }
39
- return {};
40
- };
23
+ module.exports = __toCommonJS(isSameKeyPath_exports);
24
+ const isSameKeyPath = (keyPath1, keyPath2) => keyPath1.every(
25
+ (element, index) => keyPath2[index] && keyPath2[index].key === element.key && keyPath2[index].type === element.type
26
+ );
41
27
  // Annotate the CommonJS export names for ESM import in node:
42
28
  0 && (module.exports = {
43
- getStackTraceInfo
29
+ isSameKeyPath
44
30
  });
45
- //# sourceMappingURL=getStackTraceInfo.cjs.map
31
+ //# sourceMappingURL=isSameKeyPath.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/isSameKeyPath.ts"],"sourcesContent":["import type { KeyPath } from '../types';\n\nexport const isSameKeyPath = (keyPath1: KeyPath[], keyPath2: KeyPath[]) =>\n keyPath1.every(\n (element, index) =>\n keyPath2[index] &&\n keyPath2[index].key === element.key &&\n keyPath2[index].type === element.type\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,gBAAgB,CAAC,UAAqB,aACjD,SAAS;AAAA,EACP,CAAC,SAAS,UACR,SAAS,KAAK,KACd,SAAS,KAAK,EAAE,QAAQ,QAAQ,OAChC,SAAS,KAAK,EAAE,SAAS,QAAQ;AACrC;","names":[]}
@@ -0,0 +1,6 @@
1
+ import { KeyPath } from '../types/keyPath.js';
2
+ import '../types/nodeType.js';
3
+
4
+ declare const isSameKeyPath: (keyPath1: KeyPath[], keyPath2: KeyPath[]) => boolean;
5
+
6
+ export { isSameKeyPath };
@@ -4,11 +4,13 @@ export { CustomizableLanguageContent, LanguageContent, CustomLocales as Locales,
4
4
  export { EnumerationContent, QuantityContent, enu } from './transpiler/content_transformers/enumeration/enumeration.mjs';
5
5
  export { getEnumerationContent } from './transpiler/content_transformers/enumeration/getEnumerationContent.mjs';
6
6
  export { findMatchingCondition } from './transpiler/content_transformers/enumeration/findMatchingCondition.mjs';
7
- export { Content, ContentModule, ContentValue, FlatContent, FlatContentValue, TypedNode } from './types/contentModule.mjs';
7
+ export { Content, ContentValue, ContentValueArray, DeclarationContent, FlatContent, FlatContentValue, TypedNode } from './types/declarationContent.mjs';
8
8
  export { NodeType } from './types/nodeType.mjs';
9
- export { KeyPath, ObjectExpressionNode, TranslationOrEnumerationNode } from './types/keyPath.mjs';
9
+ export { ArrayExpressionNode, KeyPath, ObjectExpressionNode, TranslationOrEnumerationNode } from './types/keyPath.mjs';
10
+ export { Dictionary, DictionaryValue } from './types/dictionary.mjs';
10
11
  export { getLocaleName } from './getLocaleName.mjs';
11
12
  export { localeList } from './localeList.mjs';
13
+ export { isSameKeyPath } from './utils/isSameKeyPath.mjs';
12
14
  import '@intlayer/config/client';
13
15
  import 'intlayer';
14
- import './utils/getStackTraceInfo.mjs';
16
+ import 'react';
@@ -8,6 +8,7 @@ import {
8
8
  import { NodeType } from './types/index.mjs';
9
9
  import { getLocaleName } from './getLocaleName.mjs';
10
10
  import { localeList } from './localeList.mjs';
11
+ import { isSameKeyPath } from './utils/isSameKeyPath.mjs';
11
12
  export {
12
13
  NodeType,
13
14
  enu,
@@ -15,6 +16,7 @@ export {
15
16
  getEnumerationContent,
16
17
  getLocaleName,
17
18
  getTranslationContent,
19
+ isSameKeyPath,
18
20
  localeList,
19
21
  t
20
22
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type {\n CustomizableLanguageContent,\n LanguageContent,\n TranslationContent,\n EnumerationContent,\n QuantityContent,\n CustomLocales as Locales,\n} from './transpiler/content_transformers/index';\nexport {\n t,\n enu,\n getTranslationContent,\n findMatchingCondition,\n getEnumerationContent,\n} from './transpiler/content_transformers/index';\nexport type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n ContentModule,\n KeyPath,\n ObjectExpressionNode,\n TranslationOrEnumerationNode,\n} from './types/index';\nexport { NodeType } from './types/index';\nexport { getLocaleName } from './getLocaleName';\nexport { localeList } from './localeList';\n"],"mappings":"AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAYP,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type {\n CustomizableLanguageContent,\n LanguageContent,\n TranslationContent,\n EnumerationContent,\n QuantityContent,\n CustomLocales as Locales,\n} from './transpiler/content_transformers/index';\nexport {\n t,\n enu,\n getTranslationContent,\n findMatchingCondition,\n getEnumerationContent,\n} from './transpiler/content_transformers/index';\nexport type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n DeclarationContent,\n ContentValueArray,\n KeyPath,\n ObjectExpressionNode,\n ArrayExpressionNode,\n TranslationOrEnumerationNode,\n DictionaryValue,\n Dictionary,\n} from './types/index';\nexport { NodeType } from './types/index';\nexport { getLocaleName } from './getLocaleName';\nexport { localeList } from './localeList';\nexport { isSameKeyPath } from './utils/isSameKeyPath';\n"],"mappings":"AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgBP,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;","names":[]}
@@ -7,4 +7,3 @@ export { findMatchingCondition } from './enumeration/findMatchingCondition.mjs';
7
7
  import '@intlayer/config/client';
8
8
  import 'intlayer';
9
9
  import '../../types/nodeType.mjs';
10
- import '../../utils/getStackTraceInfo.mjs';
@@ -2,7 +2,6 @@ import { Locales } from '@intlayer/config/client';
2
2
  import { CustomizableLanguageContent } from './types.mjs';
3
3
  import 'intlayer';
4
4
  import '../../../types/nodeType.mjs';
5
- import '../../../utils/getStackTraceInfo.mjs';
6
5
 
7
6
  type GetTranslationContent = <Content = string>(languageContent: CustomizableLanguageContent<Content>, locale: Locales) => Content;
8
7
  /**
@@ -4,4 +4,3 @@ export { ConfigLocales, CustomLocales, CustomizableLanguageContent, LanguageCont
4
4
  import '@intlayer/config/client';
5
5
  import 'intlayer';
6
6
  import '../../../types/nodeType.mjs';
7
- import '../../../utils/getStackTraceInfo.mjs';
@@ -2,7 +2,6 @@ import { TranslationContent } from './types.mjs';
2
2
  import '@intlayer/config/client';
3
3
  import 'intlayer';
4
4
  import '../../../types/nodeType.mjs';
5
- import '../../../utils/getStackTraceInfo.mjs';
6
5
 
7
6
  /**
8
7
  *
@@ -1,7 +1,6 @@
1
1
  import { LocalesValues } from '@intlayer/config/client';
2
2
  import { IConfigLocales } from 'intlayer';
3
3
  import { NodeType } from '../../../types/nodeType.mjs';
4
- import { NoteStackTraceInfo } from '../../../utils/getStackTraceInfo.mjs';
5
4
 
6
5
  /**
7
6
  * If module augmented, it will return the configured locales such as Locales.ENGLISH | Locales.FRENCH | Locales.SPANISH | ...
@@ -55,7 +54,7 @@ type LanguageContent<Content> = Partial<Record<LocalesValues, Content>>;
55
54
  *
56
55
  */
57
56
  type CustomizableLanguageContent<Content = string> = ConfigLocales extends never ? LanguageContent<Content> : IConfigLocales<Content>;
58
- type TranslationContent<Content> = LanguageContent<Content> & NoteStackTraceInfo & {
57
+ type TranslationContent<Content> = LanguageContent<Content> & {
59
58
  nodeType: NodeType.Translation;
60
59
  };
61
60
 
@@ -7,4 +7,3 @@ export { findMatchingCondition } from './content_transformers/enumeration/findMa
7
7
  import '@intlayer/config/client';
8
8
  import 'intlayer';
9
9
  import '../types/nodeType.mjs';
10
- import '../utils/getStackTraceInfo.mjs';
@@ -1,22 +1,27 @@
1
+ import { ReactNode } from 'react';
1
2
  import { TranslationContent } from '../transpiler/content_transformers/translation/types.mjs';
2
3
  import { EnumerationContent } from '../transpiler/content_transformers/enumeration/enumeration.mjs';
3
4
  import '@intlayer/config/client';
4
5
  import 'intlayer';
5
6
  import './nodeType.mjs';
6
- import '../utils/getStackTraceInfo.mjs';
7
7
 
8
8
  type TypedNode = TranslationContent<unknown> | EnumerationContent<unknown>;
9
+ type ArrayOfSameType<T> = T extends (infer U)[] ? U extends T[number] ? T : never : never;
10
+ type ContentValueArray = ArrayOfSameType<ContentValue[]>;
9
11
  type ContentValue = string | {
10
12
  [key: string]: ContentValue;
11
13
  } | (() => ContentValue) | Promise<ContentValue> | TypedNode;
12
- type Content = Record<string, ContentValue | undefined>;
14
+ type Content = Record<string, ContentValue | ContentValueArray | undefined>;
13
15
  type FlatContentValue = string | {
14
16
  [key: string]: FlatContentValue;
15
17
  } | TypedNode;
16
18
  type FlatContent = Record<string, FlatContentValue | undefined>;
17
- type ContentModule = Content & {
19
+ type ReplaceContentValue<T> = {
20
+ [P in keyof T]: T[P] extends string | number | boolean | null | ReactNode ? ContentValue : T[P] extends object ? ReplaceContentValue<T[P]> : T[P];
21
+ };
22
+ type DeclarationContent<T = undefined> = (T extends undefined ? Content : ReplaceContentValue<T>) & {
18
23
  id: string;
19
24
  filePath?: string;
20
25
  };
21
26
 
22
- export type { Content, ContentModule, ContentValue, FlatContent, FlatContentValue, TypedNode };
27
+ export type { Content, ContentValue, ContentValueArray, DeclarationContent, FlatContent, FlatContentValue, TypedNode };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=declarationContent.mjs.map
@@ -0,0 +1,17 @@
1
+ import { TranslationContent } from '../transpiler/content_transformers/translation/types.mjs';
2
+ import { EnumerationContent } from '../transpiler/content_transformers/enumeration/enumeration.mjs';
3
+ import '@intlayer/config/client';
4
+ import 'intlayer';
5
+ import './nodeType.mjs';
6
+
7
+ type RecursiveDictionaryValue = number | string | {
8
+ [paramKey: string]: RecursiveDictionaryValue;
9
+ } | RecursiveDictionaryValue[];
10
+ type DictionaryValue = RecursiveDictionaryValue | TranslationContent<RecursiveDictionaryValue> | EnumerationContent<RecursiveDictionaryValue>;
11
+ type Dictionary = {
12
+ id: string;
13
+ filePath: string;
14
+ [key: string]: DictionaryValue;
15
+ };
16
+
17
+ export type { Dictionary, DictionaryValue, RecursiveDictionaryValue };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=dictionary.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,8 +1,9 @@
1
- export { Content, ContentModule, ContentValue, FlatContent, FlatContentValue, TypedNode } from './contentModule.mjs';
1
+ export { Content, ContentValue, ContentValueArray, DeclarationContent, FlatContent, FlatContentValue, TypedNode } from './declarationContent.mjs';
2
2
  export { NodeType } from './nodeType.mjs';
3
- export { KeyPath, ObjectExpressionNode, TranslationOrEnumerationNode } from './keyPath.mjs';
3
+ export { ArrayExpressionNode, KeyPath, ObjectExpressionNode, TranslationOrEnumerationNode } from './keyPath.mjs';
4
+ export { Dictionary, DictionaryValue } from './dictionary.mjs';
5
+ import 'react';
4
6
  import '../transpiler/content_transformers/translation/types.mjs';
5
7
  import '@intlayer/config/client';
6
8
  import 'intlayer';
7
- import '../utils/getStackTraceInfo.mjs';
8
9
  import '../transpiler/content_transformers/enumeration/enumeration.mjs';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/types/index.ts"],"sourcesContent":["export type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n ContentModule,\n} from './contentModule';\nexport { NodeType } from './nodeType';\nexport type {\n KeyPath,\n ObjectExpressionNode,\n TranslationOrEnumerationNode,\n} from './keyPath';\n"],"mappings":"AAQA,SAAS,gBAAgB;","names":[]}
1
+ {"version":3,"sources":["../../../src/types/index.ts"],"sourcesContent":["export type {\n ContentValue,\n ContentValueArray,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n DeclarationContent,\n} from './declarationContent';\nexport { NodeType } from './nodeType';\nexport type {\n KeyPath,\n ObjectExpressionNode,\n ArrayExpressionNode,\n TranslationOrEnumerationNode,\n} from './keyPath';\nexport type { DictionaryValue, Dictionary } from './dictionary';\n"],"mappings":"AASA,SAAS,gBAAgB;","names":[]}
@@ -4,10 +4,14 @@ type ObjectExpressionNode = {
4
4
  type: 'ObjectExpression';
5
5
  key: string;
6
6
  };
7
+ type ArrayExpressionNode = {
8
+ type: 'ArrayExpression';
9
+ key: number;
10
+ };
7
11
  type TranslationOrEnumerationNode = {
8
12
  type: NodeType;
9
13
  key: string;
10
14
  };
11
- type KeyPath = ObjectExpressionNode | TranslationOrEnumerationNode;
15
+ type KeyPath = ObjectExpressionNode | ArrayExpressionNode | TranslationOrEnumerationNode;
12
16
 
13
- export type { KeyPath, ObjectExpressionNode, TranslationOrEnumerationNode };
17
+ export type { ArrayExpressionNode, KeyPath, ObjectExpressionNode, TranslationOrEnumerationNode };
@@ -0,0 +1,6 @@
1
+ import { KeyPath } from '../types/keyPath.mjs';
2
+ import '../types/nodeType.mjs';
3
+
4
+ declare const isSameKeyPath: (keyPath1: KeyPath[], keyPath2: KeyPath[]) => boolean;
5
+
6
+ export { isSameKeyPath };
@@ -0,0 +1,7 @@
1
+ const isSameKeyPath = (keyPath1, keyPath2) => keyPath1.every(
2
+ (element, index) => keyPath2[index] && keyPath2[index].key === element.key && keyPath2[index].type === element.type
3
+ );
4
+ export {
5
+ isSameKeyPath
6
+ };
7
+ //# sourceMappingURL=isSameKeyPath.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/isSameKeyPath.ts"],"sourcesContent":["import type { KeyPath } from '../types';\n\nexport const isSameKeyPath = (keyPath1: KeyPath[], keyPath2: KeyPath[]) =>\n keyPath1.every(\n (element, index) =>\n keyPath2[index] &&\n keyPath2[index].key === element.key &&\n keyPath2[index].type === element.type\n );\n"],"mappings":"AAEO,MAAM,gBAAgB,CAAC,UAAqB,aACjD,SAAS;AAAA,EACP,CAAC,SAAS,UACR,SAAS,KAAK,KACd,SAAS,KAAK,EAAE,QAAQ,QAAQ,OAChC,SAAS,KAAK,EAAE,SAAS,QAAQ;AACrC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/core",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "private": false,
5
5
  "description": "IntLayer - Layer of abstraction between the business logic and the data access layer. Manage internationalization in a simple way, through TypeScript, JavaScript or JSON declaration file.",
6
6
  "keywords": [
@@ -46,12 +46,11 @@
46
46
  },
47
47
  "files": [
48
48
  "./dist",
49
- "./src",
50
49
  "./package.json"
51
50
  ],
52
51
  "dependencies": {
53
52
  "chokidar": "^3.6.0",
54
- "@intlayer/config": "^2.0.0"
53
+ "@intlayer/config": "^2.0.1"
55
54
  },
56
55
  "devDependencies": {
57
56
  "@types/node": "^20.12.7",
package/src/index.ts CHANGED
@@ -19,11 +19,16 @@ export type {
19
19
  FlatContentValue,
20
20
  FlatContent,
21
21
  TypedNode,
22
- ContentModule,
22
+ DeclarationContent,
23
+ ContentValueArray,
23
24
  KeyPath,
24
25
  ObjectExpressionNode,
26
+ ArrayExpressionNode,
25
27
  TranslationOrEnumerationNode,
28
+ DictionaryValue,
29
+ Dictionary,
26
30
  } from './types/index';
27
31
  export { NodeType } from './types/index';
28
32
  export { getLocaleName } from './getLocaleName';
29
33
  export { localeList } from './localeList';
34
+ export { isSameKeyPath } from './utils/isSameKeyPath';
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/types/contentModule.ts"],"sourcesContent":["import type {\n EnumerationContent,\n TranslationContent,\n} from '../transpiler/index';\n\nexport type TypedNode =\n | TranslationContent<unknown>\n | EnumerationContent<unknown>;\n\nexport type ContentValue =\n | string\n | {\n [key: string]: ContentValue;\n }\n | (() => ContentValue)\n | Promise<ContentValue>\n | TypedNode;\n\nexport type Content = Record<string, ContentValue | undefined>;\n\nexport type FlatContentValue =\n | string\n | {\n [key: string]: FlatContentValue;\n }\n | TypedNode;\n\nexport type FlatContent = Record<string, FlatContentValue | undefined>;\n\nexport type ContentModule = Content & {\n id: string;\n filePath?: string;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1 +0,0 @@
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":[]}
@@ -1,12 +0,0 @@
1
- type NoteStackTraceInfo = {
2
- file?: string;
3
- line?: string;
4
- column?: string;
5
- };
6
- /**
7
- * Get the file path, line number, and column number of the caller of this function
8
- * Return an object containing file, line, and column numbers
9
- */
10
- declare const getStackTraceInfo: () => NoteStackTraceInfo;
11
-
12
- export { type NoteStackTraceInfo, getStackTraceInfo };
@@ -1 +0,0 @@
1
- //# sourceMappingURL=contentModule.mjs.map