@intlayer/core 2.0.0 → 2.0.2
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/index.cjs +3 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +5 -3
- package/dist/cjs/transpiler/content_transformers/enumeration/enumeration.cjs +2 -2
- package/dist/cjs/transpiler/content_transformers/enumeration/enumeration.cjs.map +1 -1
- package/dist/cjs/transpiler/content_transformers/enumeration/enumeration.d.ts +2 -1
- package/dist/cjs/transpiler/content_transformers/index.d.ts +0 -1
- package/dist/cjs/transpiler/content_transformers/translation/getTranslationContent.d.ts +0 -1
- package/dist/cjs/transpiler/content_transformers/translation/index.d.ts +0 -1
- package/dist/cjs/transpiler/content_transformers/translation/translation.cjs +2 -2
- package/dist/cjs/transpiler/content_transformers/translation/translation.cjs.map +1 -1
- package/dist/cjs/transpiler/content_transformers/translation/translation.d.ts +0 -1
- package/dist/cjs/transpiler/content_transformers/translation/types.cjs.map +1 -1
- package/dist/cjs/transpiler/content_transformers/translation/types.d.ts +2 -2
- package/dist/cjs/transpiler/index.d.ts +0 -1
- package/dist/cjs/types/declarationContent.cjs +17 -0
- package/dist/cjs/types/declarationContent.cjs.map +1 -0
- package/dist/cjs/types/declarationContent.d.ts +26 -0
- package/dist/cjs/types/{contentModule.cjs → dictionary.cjs} +3 -3
- package/dist/cjs/types/dictionary.cjs.map +1 -0
- package/dist/cjs/types/dictionary.d.ts +17 -0
- package/dist/cjs/types/index.cjs.map +1 -1
- package/dist/cjs/types/index.d.ts +4 -3
- package/dist/cjs/types/keyPath.cjs.map +1 -1
- package/dist/cjs/types/keyPath.d.ts +6 -2
- package/dist/cjs/utils/{getStackTraceInfo.cjs → isSameKeyPath.cjs} +9 -23
- package/dist/cjs/utils/isSameKeyPath.cjs.map +1 -0
- package/dist/cjs/utils/isSameKeyPath.d.ts +6 -0
- package/dist/esm/index.d.mts +5 -3
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/transpiler/content_transformers/enumeration/enumeration.d.mts +2 -1
- package/dist/esm/transpiler/content_transformers/enumeration/enumeration.mjs +2 -2
- package/dist/esm/transpiler/content_transformers/enumeration/enumeration.mjs.map +1 -1
- package/dist/esm/transpiler/content_transformers/index.d.mts +0 -1
- package/dist/esm/transpiler/content_transformers/translation/getTranslationContent.d.mts +0 -1
- package/dist/esm/transpiler/content_transformers/translation/index.d.mts +0 -1
- package/dist/esm/transpiler/content_transformers/translation/translation.d.mts +0 -1
- package/dist/esm/transpiler/content_transformers/translation/translation.mjs +2 -2
- package/dist/esm/transpiler/content_transformers/translation/translation.mjs.map +1 -1
- package/dist/esm/transpiler/content_transformers/translation/types.d.mts +2 -2
- package/dist/esm/transpiler/index.d.mts +0 -1
- package/dist/esm/types/declarationContent.d.mts +26 -0
- package/dist/esm/types/declarationContent.mjs +1 -0
- package/dist/esm/types/dictionary.d.mts +17 -0
- package/dist/esm/types/dictionary.mjs +1 -0
- package/dist/esm/types/dictionary.mjs.map +1 -0
- package/dist/esm/types/index.d.mts +4 -3
- package/dist/esm/types/index.mjs.map +1 -1
- package/dist/esm/types/keyPath.d.mts +6 -2
- package/dist/esm/utils/isSameKeyPath.d.mts +6 -0
- package/dist/esm/utils/isSameKeyPath.mjs +7 -0
- package/dist/esm/utils/isSameKeyPath.mjs.map +1 -0
- package/package.json +9 -10
- package/src/index.ts +5 -1
- package/dist/cjs/types/contentModule.cjs.map +0 -1
- package/dist/cjs/types/contentModule.d.ts +0 -22
- package/dist/cjs/utils/getStackTraceInfo.cjs.map +0 -1
- package/dist/cjs/utils/getStackTraceInfo.d.ts +0 -12
- package/dist/esm/types/contentModule.d.mts +0 -22
- package/dist/esm/types/contentModule.mjs +0 -1
- package/dist/esm/utils/getStackTraceInfo.d.mts +0 -12
- package/dist/esm/utils/getStackTraceInfo.mjs +0 -21
- package/dist/esm/utils/getStackTraceInfo.mjs.map +0 -1
- package/src/getLocaleName.ts +0 -463
- package/src/localeList.ts +0 -229
- package/src/transpiler/content_transformers/enumeration/enumeration.ts +0 -66
- package/src/transpiler/content_transformers/enumeration/findMatchingCondition.ts +0 -64
- package/src/transpiler/content_transformers/enumeration/getEnumerationContent.ts +0 -38
- package/src/transpiler/content_transformers/enumeration/index.ts +0 -3
- package/src/transpiler/content_transformers/index.ts +0 -2
- package/src/transpiler/content_transformers/translation/getTranslationContent.ts +0 -33
- package/src/transpiler/content_transformers/translation/index.ts +0 -3
- package/src/transpiler/content_transformers/translation/translation.ts +0 -49
- package/src/transpiler/content_transformers/translation/types.ts +0 -71
- package/src/transpiler/index.ts +0 -1
- package/src/types/contentModule.ts +0 -33
- package/src/types/index.ts +0 -14
- package/src/types/keyPath.ts +0 -13
- package/src/types/nodeType.ts +0 -4
- package/src/utils/getStackTraceInfo.ts +0 -39
- /package/dist/esm/types/{contentModule.mjs.map → declarationContent.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { Content,
|
|
1
|
+
export { Content, ContentValue, 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
|
|
1
|
+
{"version":3,"sources":["../../../src/types/index.ts"],"sourcesContent":["export type {\n ContentValue,\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":"AAQA,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 @@
|
|
|
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.
|
|
3
|
+
"version": "2.0.2",
|
|
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,22 +46,21 @@
|
|
|
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.
|
|
53
|
+
"@intlayer/config": "^2.0.2"
|
|
55
54
|
},
|
|
56
55
|
"devDependencies": {
|
|
57
|
-
"@types/node": "^20.
|
|
58
|
-
"@types/react": "^18.
|
|
59
|
-
"react": "^18.
|
|
56
|
+
"@types/node": "^20.14.9",
|
|
57
|
+
"@types/react": "^18.3.3",
|
|
58
|
+
"react": "^18.3.1",
|
|
60
59
|
"rimraf": "5.0.5",
|
|
61
|
-
"tsup": "^8.0
|
|
62
|
-
"typescript": "^5.
|
|
63
|
-
"@utils/eslint-config": "^1.0.
|
|
64
|
-
"@utils/ts-config": "^1.0.
|
|
60
|
+
"tsup": "^8.1.0",
|
|
61
|
+
"typescript": "^5.5.2",
|
|
62
|
+
"@utils/eslint-config": "^1.0.2",
|
|
63
|
+
"@utils/ts-config": "^1.0.2"
|
|
65
64
|
},
|
|
66
65
|
"peerDependencies": {
|
|
67
66
|
"react": "^18.2.0"
|
package/src/index.ts
CHANGED
|
@@ -19,11 +19,15 @@ export type {
|
|
|
19
19
|
FlatContentValue,
|
|
20
20
|
FlatContent,
|
|
21
21
|
TypedNode,
|
|
22
|
-
|
|
22
|
+
DeclarationContent,
|
|
23
23
|
KeyPath,
|
|
24
24
|
ObjectExpressionNode,
|
|
25
|
+
ArrayExpressionNode,
|
|
25
26
|
TranslationOrEnumerationNode,
|
|
27
|
+
DictionaryValue,
|
|
28
|
+
Dictionary,
|
|
26
29
|
} from './types/index';
|
|
27
30
|
export { NodeType } from './types/index';
|
|
28
31
|
export { getLocaleName } from './getLocaleName';
|
|
29
32
|
export { localeList } from './localeList';
|
|
33
|
+
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,22 +0,0 @@
|
|
|
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
|
-
import '../utils/getStackTraceInfo.js';
|
|
7
|
-
|
|
8
|
-
type TypedNode = TranslationContent<unknown> | EnumerationContent<unknown>;
|
|
9
|
-
type ContentValue = string | {
|
|
10
|
-
[key: string]: ContentValue;
|
|
11
|
-
} | (() => ContentValue) | Promise<ContentValue> | TypedNode;
|
|
12
|
-
type Content = Record<string, ContentValue | undefined>;
|
|
13
|
-
type FlatContentValue = string | {
|
|
14
|
-
[key: string]: FlatContentValue;
|
|
15
|
-
} | TypedNode;
|
|
16
|
-
type FlatContent = Record<string, FlatContentValue | undefined>;
|
|
17
|
-
type ContentModule = Content & {
|
|
18
|
-
id: string;
|
|
19
|
-
filePath?: string;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type { Content, ContentModule, ContentValue, FlatContent, FlatContentValue, TypedNode };
|
|
@@ -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,22 +0,0 @@
|
|
|
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
|
-
import '../utils/getStackTraceInfo.mjs';
|
|
7
|
-
|
|
8
|
-
type TypedNode = TranslationContent<unknown> | EnumerationContent<unknown>;
|
|
9
|
-
type ContentValue = string | {
|
|
10
|
-
[key: string]: ContentValue;
|
|
11
|
-
} | (() => ContentValue) | Promise<ContentValue> | TypedNode;
|
|
12
|
-
type Content = Record<string, ContentValue | undefined>;
|
|
13
|
-
type FlatContentValue = string | {
|
|
14
|
-
[key: string]: FlatContentValue;
|
|
15
|
-
} | TypedNode;
|
|
16
|
-
type FlatContent = Record<string, FlatContentValue | undefined>;
|
|
17
|
-
type ContentModule = Content & {
|
|
18
|
-
id: string;
|
|
19
|
-
filePath?: string;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type { Content, ContentModule, ContentValue, FlatContent, FlatContentValue, TypedNode };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=contentModule.mjs.map
|
|
@@ -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,21 +0,0 @@
|
|
|
1
|
-
const getStackTraceInfo = () => {
|
|
2
|
-
const err = new Error();
|
|
3
|
-
const stack = err.stack ?? "";
|
|
4
|
-
const stackLines = stack.split("\n");
|
|
5
|
-
const callerLine = stackLines[2] ?? "";
|
|
6
|
-
const match = callerLine.match(/at\s[^(:]+\([^:]+:(\d+):(\d+)\)?/);
|
|
7
|
-
const line = match?.[1];
|
|
8
|
-
const column = match?.[2];
|
|
9
|
-
if (match) {
|
|
10
|
-
return {
|
|
11
|
-
// file,
|
|
12
|
-
line,
|
|
13
|
-
column
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
return {};
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
getStackTraceInfo
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=getStackTraceInfo.mjs.map
|
|
@@ -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":"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":[]}
|