@breadstone-tools/localizator-core 0.0.31 → 0.0.33
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/_tests/AngularHTMLParser.Test.d.ts +1 -0
- package/_tests/AngularHTMLParser.Test.d.ts.map +1 -0
- package/_tests/AngularHTMLParser.Test.js +99 -0
- package/_tests/AngularHTMLParser.Test.js.map +1 -0
- package/_tests/AngularPreset.Test.d.ts +1 -0
- package/_tests/AngularPreset.Test.d.ts.map +1 -0
- package/_tests/AngularPreset.Test.js +14 -0
- package/_tests/AngularPreset.Test.js.map +1 -0
- package/_tests/DuplicateKeysTask.Test.d.ts +1 -0
- package/_tests/DuplicateKeysTask.Test.d.ts.map +1 -0
- package/_tests/DuplicateKeysTask.Test.js +97 -0
- package/_tests/DuplicateKeysTask.Test.js.map +1 -0
- package/_tests/EmptyValuesTask.Test.d.ts +1 -0
- package/_tests/EmptyValuesTask.Test.d.ts.map +1 -0
- package/_tests/EmptyValuesTask.Test.js +87 -0
- package/_tests/EmptyValuesTask.Test.js.map +1 -0
- package/_tests/JSXParser.Test.d.ts +1 -0
- package/_tests/JSXParser.Test.d.ts.map +1 -0
- package/_tests/JSXParser.Test.js +94 -0
- package/_tests/JSXParser.Test.js.map +1 -0
- package/_tests/JavaScriptParser.Test.d.ts +1 -0
- package/_tests/JavaScriptParser.Test.d.ts.map +1 -0
- package/_tests/JavaScriptParser.Test.js +231 -0
- package/_tests/JavaScriptParser.Test.js.map +1 -0
- package/_tests/JsonFormatter.Test.d.ts +1 -0
- package/_tests/JsonFormatter.Test.d.ts.map +1 -0
- package/_tests/JsonFormatter.Test.js +36 -0
- package/_tests/JsonFormatter.Test.js.map +1 -0
- package/_tests/JsonResourceSerializer.Test.d.ts +1 -0
- package/_tests/JsonResourceSerializer.Test.d.ts.map +1 -0
- package/_tests/JsonResourceSerializer.Test.js +105 -0
- package/_tests/JsonResourceSerializer.Test.js.map +1 -0
- package/_tests/JsonResourceTransformerAdapter.Test.d.ts +1 -0
- package/_tests/JsonResourceTransformerAdapter.Test.d.ts.map +1 -0
- package/_tests/JsonResourceTransformerAdapter.Test.js +126 -0
- package/_tests/JsonResourceTransformerAdapter.Test.js.map +1 -0
- package/_tests/KeyConsistencyTask.Test.d.ts +1 -0
- package/_tests/KeyConsistencyTask.Test.d.ts.map +1 -0
- package/_tests/KeyConsistencyTask.Test.js +160 -0
- package/_tests/KeyConsistencyTask.Test.js.map +1 -0
- package/_tests/KeyGenerator.Test.d.ts +1 -0
- package/_tests/KeyGenerator.Test.d.ts.map +1 -0
- package/_tests/KeyGenerator.Test.js +70 -0
- package/_tests/KeyGenerator.Test.js.map +1 -0
- package/_tests/LitPreset.Test.d.ts +1 -0
- package/_tests/LitPreset.Test.d.ts.map +1 -0
- package/_tests/LitPreset.Test.js +16 -0
- package/_tests/LitPreset.Test.js.map +1 -0
- package/_tests/LocalizationProcessor.Test.d.ts +1 -0
- package/_tests/LocalizationProcessor.Test.d.ts.map +1 -0
- package/_tests/LocalizationProcessor.Test.js +121 -0
- package/_tests/LocalizationProcessor.Test.js.map +1 -0
- package/_tests/MissingTranslationsTask.Test.d.ts +1 -0
- package/_tests/MissingTranslationsTask.Test.d.ts.map +1 -0
- package/_tests/MissingTranslationsTask.Test.js +132 -0
- package/_tests/MissingTranslationsTask.Test.js.map +1 -0
- package/_tests/ReactPreset.Test.d.ts +1 -0
- package/_tests/ReactPreset.Test.d.ts.map +1 -0
- package/_tests/ReactPreset.Test.js +16 -0
- package/_tests/ReactPreset.Test.js.map +1 -0
- package/_tests/ResourceProcessor.Test.d.ts +1 -0
- package/_tests/ResourceProcessor.Test.d.ts.map +1 -0
- package/_tests/ResourceProcessor.Test.js +31 -0
- package/_tests/ResourceProcessor.Test.js.map +1 -0
- package/_tests/ResxFormatter.Test.d.ts +1 -0
- package/_tests/ResxFormatter.Test.d.ts.map +1 -0
- package/_tests/ResxFormatter.Test.js +46 -0
- package/_tests/ResxFormatter.Test.js.map +1 -0
- package/_tests/ResxResourceSerializer.Test.d.ts +1 -0
- package/_tests/ResxResourceSerializer.Test.d.ts.map +1 -0
- package/_tests/ResxResourceSerializer.Test.js +119 -0
- package/_tests/ResxResourceSerializer.Test.js.map +1 -0
- package/_tests/ResxResourceTransformerAdapter.Test.d.ts +1 -0
- package/_tests/ResxResourceTransformerAdapter.Test.d.ts.map +1 -0
- package/_tests/ResxResourceTransformerAdapter.Test.js +118 -0
- package/_tests/ResxResourceTransformerAdapter.Test.js.map +1 -0
- package/_tests/StencilPreset.Test.d.ts +1 -0
- package/_tests/StencilPreset.Test.d.ts.map +1 -0
- package/_tests/StencilPreset.Test.js +14 -0
- package/_tests/StencilPreset.Test.js.map +1 -0
- package/_tests/TSXParser.Test.d.ts +1 -0
- package/_tests/TSXParser.Test.d.ts.map +1 -0
- package/_tests/TSXParser.Test.js +76 -0
- package/_tests/TSXParser.Test.js.map +1 -0
- package/_tests/TypeScriptParser.Test.d.ts +1 -0
- package/_tests/TypeScriptParser.Test.d.ts.map +1 -0
- package/_tests/TypeScriptParser.Test.js +277 -0
- package/_tests/TypeScriptParser.Test.js.map +1 -0
- package/_tests/TypescriptResourceSerializer.Test.d.ts +1 -0
- package/_tests/TypescriptResourceSerializer.Test.d.ts.map +1 -0
- package/_tests/TypescriptResourceSerializer.Test.js +143 -0
- package/_tests/TypescriptResourceSerializer.Test.js.map +1 -0
- package/_tests/UnusedKeysTask.Test.d.ts +1 -0
- package/_tests/UnusedKeysTask.Test.d.ts.map +1 -0
- package/_tests/UnusedKeysTask.Test.js +93 -0
- package/_tests/UnusedKeysTask.Test.js.map +1 -0
- package/_tests/VueParser.Test.d.ts +1 -0
- package/_tests/VueParser.Test.d.ts.map +1 -0
- package/_tests/VueParser.Test.js +164 -0
- package/_tests/VueParser.Test.js.map +1 -0
- package/_tests/VuePreset.Test.d.ts +1 -0
- package/_tests/VuePreset.Test.d.ts.map +1 -0
- package/_tests/VuePreset.Test.js +15 -0
- package/_tests/VuePreset.Test.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=AngularHTMLParser.Test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AngularHTMLParser.Test.d.ts","sourceRoot":"","sources":["../../src/_tests/AngularHTMLParser.Test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// // #region Imports
|
|
3
|
+
// import { AngularHTMLDetector } from '../src/Detectors/AngularHTMLDetector';
|
|
4
|
+
// import { describe, it, expect } from 'vitest';
|
|
5
|
+
// // #endregion
|
|
6
|
+
// describe('AngularHTMLParser', () => {
|
|
7
|
+
// it('should extract strings from text interpolation', () => {
|
|
8
|
+
// const content = '<label>{{ \'This is a sentence\' | translate }}</label>';
|
|
9
|
+
// const parser = new AngularHTMLDetector(console);
|
|
10
|
+
// const result = parser.detect(content);
|
|
11
|
+
// expect(result).toEqual([{
|
|
12
|
+
// columnNumber: 7,
|
|
13
|
+
// lineNumber: 1,
|
|
14
|
+
// context: content,
|
|
15
|
+
// isStatic: true,
|
|
16
|
+
// match: {
|
|
17
|
+
// value: 'This is a sentence'
|
|
18
|
+
// }
|
|
19
|
+
// }]);
|
|
20
|
+
// });
|
|
21
|
+
// it('should extract strings from attribute bindings', () => {
|
|
22
|
+
// const content = '<my-component [label]="\'This is a label\' | translate"></my-component>';
|
|
23
|
+
// const parser = new AngularHTMLDetector(console);
|
|
24
|
+
// const result = parser.detect(content);
|
|
25
|
+
// expect(result).toEqual([{
|
|
26
|
+
// columnNumber: 14,
|
|
27
|
+
// lineNumber: 1,
|
|
28
|
+
// context: content,
|
|
29
|
+
// isStatic: true,
|
|
30
|
+
// match: {
|
|
31
|
+
// value: 'This is a label'
|
|
32
|
+
// }
|
|
33
|
+
// }]);
|
|
34
|
+
// });
|
|
35
|
+
// it('should extract strings from event bindings', () => {
|
|
36
|
+
// const content = '<button (click)="doSomething(\'This is a key\' | translate)">Click Me</button>';
|
|
37
|
+
// const parser = new AngularHTMLDetector(console);
|
|
38
|
+
// const result = parser.detect(content);
|
|
39
|
+
// expect(result).toEqual([{
|
|
40
|
+
// columnNumber: 8,
|
|
41
|
+
// lineNumber: 1,
|
|
42
|
+
// context: content,
|
|
43
|
+
// isStatic: true,
|
|
44
|
+
// match: {
|
|
45
|
+
// value: 'This is a key'
|
|
46
|
+
// }
|
|
47
|
+
// }]);
|
|
48
|
+
// });
|
|
49
|
+
// it('should extract strings from structural directives', () => {
|
|
50
|
+
// const content = `<div *ngIf="'This is a condition' | translate as conditionText">
|
|
51
|
+
// {{ conditionText }}
|
|
52
|
+
// </div>`;
|
|
53
|
+
// const parser = new AngularHTMLDetector(console);
|
|
54
|
+
// const result = parser.detect(content);
|
|
55
|
+
// expect(result).toEqual([{
|
|
56
|
+
// columnNumber: 5,
|
|
57
|
+
// lineNumber: 1,
|
|
58
|
+
// context: '<div *ngIf="\'This is a condition\' | translate as conditionText">',
|
|
59
|
+
// isStatic: true,
|
|
60
|
+
// match: {
|
|
61
|
+
// value: 'This is a condition'
|
|
62
|
+
// }
|
|
63
|
+
// }]);
|
|
64
|
+
// });
|
|
65
|
+
// it('should extract strings from JSON-like configurations', () => {
|
|
66
|
+
// const content = '<div [config]="{ label: \'This is a translatable label\' | translate }"></div>';
|
|
67
|
+
// const parser = new AngularHTMLDetector(console);
|
|
68
|
+
// const result = parser.detect(content);
|
|
69
|
+
// expect(result).toEqual([{
|
|
70
|
+
// columnNumber: 5,
|
|
71
|
+
// lineNumber: 1,
|
|
72
|
+
// context: content,
|
|
73
|
+
// isStatic: true,
|
|
74
|
+
// match: {
|
|
75
|
+
// value: 'This is a translatable label'
|
|
76
|
+
// }
|
|
77
|
+
// }]);
|
|
78
|
+
// });
|
|
79
|
+
// it('should extract strings from content projection', () => {
|
|
80
|
+
// const content = '<ng-content select="[label]">{{ \'Default translation\' | translate }}</ng-content>';
|
|
81
|
+
// const parser = new AngularHTMLDetector(console);
|
|
82
|
+
// const result = parser.detect(content);
|
|
83
|
+
// expect(result).toEqual([{
|
|
84
|
+
// columnNumber: 29,
|
|
85
|
+
// lineNumber: 1,
|
|
86
|
+
// context: content,
|
|
87
|
+
// isStatic: true,
|
|
88
|
+
// match: {
|
|
89
|
+
// value: 'Default translation'
|
|
90
|
+
// }
|
|
91
|
+
// }]);
|
|
92
|
+
// });
|
|
93
|
+
// it('should return an empty array for empty content', () => {
|
|
94
|
+
// const parser = new AngularHTMLDetector(console);
|
|
95
|
+
// const result = parser.detect('');
|
|
96
|
+
// expect(result).toEqual([]);
|
|
97
|
+
// });
|
|
98
|
+
// });
|
|
99
|
+
//# sourceMappingURL=AngularHTMLParser.Test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AngularHTMLParser.Test.js","sourceRoot":"","sources":["../../src/_tests/AngularHTMLParser.Test.ts"],"names":[],"mappings":";AAAA,qBAAqB;AAErB,8EAA8E;AAC9E,iDAAiD;AAEjD,gBAAgB;AAEhB,wCAAwC;AACxC,mEAAmE;AACnE,qFAAqF;AACrF,2DAA2D;AAC3D,iDAAiD;AAEjD,oCAAoC;AACpC,+BAA+B;AAC/B,6BAA6B;AAC7B,gCAAgC;AAChC,8BAA8B;AAC9B,uBAAuB;AACvB,8CAA8C;AAC9C,gBAAgB;AAChB,eAAe;AACf,UAAU;AAEV,mEAAmE;AACnE,qGAAqG;AACrG,2DAA2D;AAC3D,iDAAiD;AAEjD,oCAAoC;AACpC,gCAAgC;AAChC,6BAA6B;AAC7B,gCAAgC;AAChC,8BAA8B;AAC9B,uBAAuB;AACvB,2CAA2C;AAC3C,gBAAgB;AAChB,eAAe;AACf,UAAU;AAEV,+DAA+D;AAC/D,4GAA4G;AAC5G,2DAA2D;AAC3D,iDAAiD;AAEjD,oCAAoC;AACpC,+BAA+B;AAC/B,6BAA6B;AAC7B,gCAAgC;AAChC,8BAA8B;AAC9B,uBAAuB;AACvB,yCAAyC;AACzC,gBAAgB;AAChB,eAAe;AACf,UAAU;AAEV,sEAAsE;AACtE,4FAA4F;AAC5F,kCAAkC;AAClC,mBAAmB;AACnB,2DAA2D;AAC3D,iDAAiD;AAEjD,oCAAoC;AACpC,+BAA+B;AAC/B,6BAA6B;AAC7B,6FAA6F;AAC7F,8BAA8B;AAC9B,uBAAuB;AACvB,+CAA+C;AAC/C,gBAAgB;AAChB,eAAe;AACf,UAAU;AAEV,yEAAyE;AACzE,4GAA4G;AAC5G,2DAA2D;AAC3D,iDAAiD;AAEjD,oCAAoC;AACpC,+BAA+B;AAC/B,6BAA6B;AAC7B,gCAAgC;AAChC,8BAA8B;AAC9B,uBAAuB;AACvB,wDAAwD;AACxD,gBAAgB;AAChB,eAAe;AACf,UAAU;AAEV,mEAAmE;AACnE,iHAAiH;AACjH,2DAA2D;AAC3D,iDAAiD;AAEjD,oCAAoC;AACpC,gCAAgC;AAChC,6BAA6B;AAC7B,gCAAgC;AAChC,8BAA8B;AAC9B,uBAAuB;AACvB,+CAA+C;AAC/C,gBAAgB;AAChB,eAAe;AACf,UAAU;AAEV,mEAAmE;AACnE,2DAA2D;AAC3D,4CAA4C;AAE5C,sCAAsC;AACtC,UAAU;AACV,MAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=AngularPreset.Test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AngularPreset.Test.d.ts","sourceRoot":"","sources":["../../src/_tests/AngularPreset.Test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { describe, it, expect } from 'vitest';
|
|
3
|
+
// import { AngularPreset } from '../src/Presets/AngularPreset';
|
|
4
|
+
// import { AngularHTMLDetector } from '../src/Detectors/AngularHTMLDetector';
|
|
5
|
+
// import { TypeScriptDetector } from '../src/Detectors/TypeScriptDetector';
|
|
6
|
+
// describe('AngularPreset', () => {
|
|
7
|
+
// it('should return correct parsers for file extensions', () => {
|
|
8
|
+
// const preset = new AngularPreset(console);
|
|
9
|
+
// const parsers = preset.getParsers();
|
|
10
|
+
// expect(parsers['.html']).toBeInstanceOf(AngularHTMLDetector);
|
|
11
|
+
// expect(parsers['.ts']).toBeInstanceOf(TypeScriptDetector);
|
|
12
|
+
// });
|
|
13
|
+
// });
|
|
14
|
+
//# sourceMappingURL=AngularPreset.Test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AngularPreset.Test.js","sourceRoot":"","sources":["../../src/_tests/AngularPreset.Test.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,gEAAgE;AAChE,8EAA8E;AAC9E,4EAA4E;AAE5E,oCAAoC;AACpC,sEAAsE;AACtE,qDAAqD;AACrD,+CAA+C;AAE/C,wEAAwE;AACxE,qEAAqE;AACrE,UAAU;AACV,MAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=DuplicateKeysTask.Test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DuplicateKeysTask.Test.d.ts","sourceRoot":"","sources":["../../src/_tests/DuplicateKeysTask.Test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// // #region Imports
|
|
3
|
+
// import { describe, it, expect } from 'vitest';
|
|
4
|
+
// import { DuplicateKeysTask } from '../src/Resources/Analyzers/Tasks/DuplicateKeysTask';
|
|
5
|
+
// import { JsonResourceInfo } from '../src/Resources/Models/JsonResourceInfo';
|
|
6
|
+
// import type { IAnalyzerTaskExecutionContext } from '../src/Resources/Analyzers/Tasks/Interfaces/IAnalyzerTask';
|
|
7
|
+
// // #endregion
|
|
8
|
+
// describe('DuplicateKeysTask', () => {
|
|
9
|
+
// it('should return no duplicates for unique keys', () => {
|
|
10
|
+
// const task = new DuplicateKeysTask();
|
|
11
|
+
// const context: IAnalyzerTaskExecutionContext = {
|
|
12
|
+
// resources: [
|
|
13
|
+
// new JsonResourceInfo({
|
|
14
|
+
// locale: 'en',
|
|
15
|
+
// data: {
|
|
16
|
+
// key1: 'value1',
|
|
17
|
+
// key2: 'value2',
|
|
18
|
+
// key3: 'value3'
|
|
19
|
+
// }
|
|
20
|
+
// }),
|
|
21
|
+
// new JsonResourceInfo({
|
|
22
|
+
// locale: 'de',
|
|
23
|
+
// data: {
|
|
24
|
+
// keyA: 'wertA',
|
|
25
|
+
// keyB: 'wertB',
|
|
26
|
+
// keyC: 'wertC'
|
|
27
|
+
// }
|
|
28
|
+
// })
|
|
29
|
+
// ],
|
|
30
|
+
// parameters: {}
|
|
31
|
+
// };
|
|
32
|
+
// const result = task.execute(context);
|
|
33
|
+
// expect(result.success).toBe(true);
|
|
34
|
+
// expect(result.message).toBe('No duplicate keys found in resources.');
|
|
35
|
+
// expect(result.data).toEqual([]);
|
|
36
|
+
// });
|
|
37
|
+
// it('should detect duplicates in a single resource', () => {
|
|
38
|
+
// const task = new DuplicateKeysTask(console);
|
|
39
|
+
// const context: IAnalyzerTaskExecutionContext = {
|
|
40
|
+
// resources: [
|
|
41
|
+
// new JsonResourceInfo({
|
|
42
|
+
// locale: 'en',
|
|
43
|
+
// data: {
|
|
44
|
+
// key1: 'value1',
|
|
45
|
+
// key2: 'value2'
|
|
46
|
+
// // key1: 'value3'
|
|
47
|
+
// } // Duplicate: 'key1'
|
|
48
|
+
// })
|
|
49
|
+
// ],
|
|
50
|
+
// parameters: {}
|
|
51
|
+
// };
|
|
52
|
+
// const result = task.execute(context);
|
|
53
|
+
// expect(result.success).toBe(true);
|
|
54
|
+
// expect(result.message).toBe('No duplicate keys found in resources.');
|
|
55
|
+
// expect(result.data).toEqual([]);
|
|
56
|
+
// });
|
|
57
|
+
// it('should detect duplicates across multiple resources', () => {
|
|
58
|
+
// const task = new DuplicateKeysTask(console);
|
|
59
|
+
// const context: IAnalyzerTaskExecutionContext = {
|
|
60
|
+
// resources: [
|
|
61
|
+
// new JsonResourceInfo({
|
|
62
|
+
// locale: 'en',
|
|
63
|
+
// data: {
|
|
64
|
+
// key1: 'value1',
|
|
65
|
+
// key2: 'value2'
|
|
66
|
+
// // key1: 'value3'
|
|
67
|
+
// } // Duplicate: 'key1'
|
|
68
|
+
// }),
|
|
69
|
+
// new JsonResourceInfo({
|
|
70
|
+
// locale: 'de',
|
|
71
|
+
// data: {
|
|
72
|
+
// keyA: 'wertA',
|
|
73
|
+
// keyB: 'wertB'
|
|
74
|
+
// // keyA: 'wertC'
|
|
75
|
+
// } // Duplicate: 'keyA'
|
|
76
|
+
// })
|
|
77
|
+
// ],
|
|
78
|
+
// parameters: {}
|
|
79
|
+
// };
|
|
80
|
+
// const result = task.execute(context);
|
|
81
|
+
// expect(result.success).toBe(true);
|
|
82
|
+
// expect(result.message).toBe('No duplicate keys found in resources.');
|
|
83
|
+
// expect(result.data).toEqual([]);
|
|
84
|
+
// });
|
|
85
|
+
// it('should handle empty resources without issues', () => {
|
|
86
|
+
// const task = new DuplicateKeysTask(console);
|
|
87
|
+
// const context: IAnalyzerTaskExecutionContext = {
|
|
88
|
+
// resources: [],
|
|
89
|
+
// parameters: {}
|
|
90
|
+
// };
|
|
91
|
+
// const result = task.execute(context);
|
|
92
|
+
// expect(result.success).toBe(true);
|
|
93
|
+
// expect(result.message).toBe('No duplicate keys found in resources.');
|
|
94
|
+
// expect(result.data).toEqual([]);
|
|
95
|
+
// });
|
|
96
|
+
// });
|
|
97
|
+
//# sourceMappingURL=DuplicateKeysTask.Test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DuplicateKeysTask.Test.js","sourceRoot":"","sources":["../../src/_tests/DuplicateKeysTask.Test.ts"],"names":[],"mappings":";AAAA,qBAAqB;AAErB,iDAAiD;AACjD,0FAA0F;AAC1F,+EAA+E;AAC/E,kHAAkH;AAElH,gBAAgB;AAEhB,wCAAwC;AACxC,gEAAgE;AAChE,gDAAgD;AAChD,2DAA2D;AAC3D,2BAA2B;AAC3B,yCAAyC;AACzC,oCAAoC;AACpC,8BAA8B;AAC9B,0CAA0C;AAC1C,0CAA0C;AAC1C,yCAAyC;AACzC,wBAAwB;AACxB,sBAAsB;AACtB,yCAAyC;AACzC,oCAAoC;AACpC,8BAA8B;AAC9B,yCAAyC;AACzC,yCAAyC;AACzC,wCAAwC;AACxC,wBAAwB;AACxB,qBAAqB;AACrB,iBAAiB;AACjB,6BAA6B;AAC7B,aAAa;AAEb,gDAAgD;AAEhD,6CAA6C;AAC7C,gFAAgF;AAChF,2CAA2C;AAC3C,UAAU;AAEV,kEAAkE;AAClE,uDAAuD;AACvD,2DAA2D;AAC3D,2BAA2B;AAC3B,yCAAyC;AACzC,oCAAoC;AACpC,8BAA8B;AAC9B,0CAA0C;AAC1C,yCAAyC;AACzC,4CAA4C;AAC5C,6CAA6C;AAC7C,qBAAqB;AACrB,iBAAiB;AACjB,6BAA6B;AAC7B,aAAa;AAEb,gDAAgD;AAEhD,6CAA6C;AAC7C,gFAAgF;AAChF,2CAA2C;AAC3C,UAAU;AAEV,uEAAuE;AACvE,uDAAuD;AACvD,2DAA2D;AAC3D,2BAA2B;AAC3B,yCAAyC;AACzC,oCAAoC;AACpC,8BAA8B;AAC9B,0CAA0C;AAC1C,yCAAyC;AACzC,4CAA4C;AAC5C,6CAA6C;AAC7C,sBAAsB;AACtB,yCAAyC;AACzC,oCAAoC;AACpC,8BAA8B;AAC9B,yCAAyC;AACzC,wCAAwC;AACxC,2CAA2C;AAC3C,6CAA6C;AAC7C,qBAAqB;AACrB,iBAAiB;AACjB,6BAA6B;AAC7B,aAAa;AAEb,gDAAgD;AAEhD,6CAA6C;AAC7C,gFAAgF;AAChF,2CAA2C;AAC3C,UAAU;AAEV,iEAAiE;AACjE,uDAAuD;AACvD,2DAA2D;AAC3D,6BAA6B;AAC7B,6BAA6B;AAC7B,aAAa;AAEb,gDAAgD;AAEhD,6CAA6C;AAC7C,gFAAgF;AAChF,2CAA2C;AAC3C,UAAU;AACV,MAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=EmptyValuesTask.Test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmptyValuesTask.Test.d.ts","sourceRoot":"","sources":["../../src/_tests/EmptyValuesTask.Test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// // #region Imports
|
|
3
|
+
// import { describe, it, expect } from 'vitest';
|
|
4
|
+
// import { EmptyValuesTask } from '../src/Resources/Analyzers/Tasks/EmptyValuesTask';
|
|
5
|
+
// import type { IAnalyzerTaskExecutionContext } from '../src/Resources/Analyzers/Tasks/Interfaces/IAnalyzerTask';
|
|
6
|
+
// import { JsonResourceInfo } from '../src/Resources/Models/JsonResourceInfo';
|
|
7
|
+
// // #endregion
|
|
8
|
+
// describe('EmptyValuesTask', () => {
|
|
9
|
+
// it('should identify empty values in resources', () => {
|
|
10
|
+
// const task = new EmptyValuesTask();
|
|
11
|
+
// const context: IAnalyzerTaskExecutionContext = {
|
|
12
|
+
// resources: [
|
|
13
|
+
// new JsonResourceInfo({
|
|
14
|
+
// locale: 'en',
|
|
15
|
+
// data: {
|
|
16
|
+
// key1: 'value1',
|
|
17
|
+
// key2: '', // Empty value
|
|
18
|
+
// key3: 'value3',
|
|
19
|
+
// key4: null // Empty value
|
|
20
|
+
// }
|
|
21
|
+
// }),
|
|
22
|
+
// new JsonResourceInfo({
|
|
23
|
+
// locale: 'de',
|
|
24
|
+
// data: {
|
|
25
|
+
// keyA: 'wertA',
|
|
26
|
+
// keyB: '', // Empty value
|
|
27
|
+
// keyC: 'wertC'
|
|
28
|
+
// }
|
|
29
|
+
// })
|
|
30
|
+
// ],
|
|
31
|
+
// parameters: {}
|
|
32
|
+
// };
|
|
33
|
+
// const result = task.execute(context);
|
|
34
|
+
// expect(result.success).toBe(false);
|
|
35
|
+
// expect(result.message).toBe('Empty values found in resources.');
|
|
36
|
+
// expect(result.data).toEqual([
|
|
37
|
+
// {
|
|
38
|
+
// locale: 'en',
|
|
39
|
+
// keys: ['key2', 'key4']
|
|
40
|
+
// },
|
|
41
|
+
// {
|
|
42
|
+
// locale: 'de',
|
|
43
|
+
// keys: ['keyB']
|
|
44
|
+
// }
|
|
45
|
+
// ]);
|
|
46
|
+
// });
|
|
47
|
+
// it('should return success when no empty values are found', () => {
|
|
48
|
+
// const task = new EmptyValuesTask(console);
|
|
49
|
+
// const context: IAnalyzerTaskExecutionContext = {
|
|
50
|
+
// resources: [
|
|
51
|
+
// new JsonResourceInfo({
|
|
52
|
+
// locale: 'en',
|
|
53
|
+
// data: {
|
|
54
|
+
// key1: 'value1',
|
|
55
|
+
// key2: 'value2',
|
|
56
|
+
// key3: 'value3'
|
|
57
|
+
// }
|
|
58
|
+
// }),
|
|
59
|
+
// new JsonResourceInfo({
|
|
60
|
+
// locale: 'de',
|
|
61
|
+
// data: {
|
|
62
|
+
// keyA: 'wertA',
|
|
63
|
+
// keyB: 'wertB',
|
|
64
|
+
// keyC: 'wertC'
|
|
65
|
+
// }
|
|
66
|
+
// })
|
|
67
|
+
// ],
|
|
68
|
+
// parameters: {}
|
|
69
|
+
// };
|
|
70
|
+
// const result = task.execute(context);
|
|
71
|
+
// expect(result.success).toBe(true);
|
|
72
|
+
// expect(result.message).toBe('No empty values found.');
|
|
73
|
+
// expect(result.data).toEqual([]);
|
|
74
|
+
// });
|
|
75
|
+
// it('should handle empty resource list', () => {
|
|
76
|
+
// const task = new EmptyValuesTask(console);
|
|
77
|
+
// const context: IAnalyzerTaskExecutionContext = {
|
|
78
|
+
// resources: [],
|
|
79
|
+
// parameters: {}
|
|
80
|
+
// };
|
|
81
|
+
// const result = task.execute(context);
|
|
82
|
+
// expect(result.success).toBe(true);
|
|
83
|
+
// expect(result.message).toBe('No empty values found.');
|
|
84
|
+
// expect(result.data).toEqual([]);
|
|
85
|
+
// });
|
|
86
|
+
// });
|
|
87
|
+
//# sourceMappingURL=EmptyValuesTask.Test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmptyValuesTask.Test.js","sourceRoot":"","sources":["../../src/_tests/EmptyValuesTask.Test.ts"],"names":[],"mappings":";AACA,qBAAqB;AAErB,iDAAiD;AACjD,sFAAsF;AACtF,kHAAkH;AAClH,+EAA+E;AAE/E,gBAAgB;AAEhB,sCAAsC;AACtC,8DAA8D;AAC9D,8CAA8C;AAC9C,2DAA2D;AAC3D,2BAA2B;AAC3B,yCAAyC;AACzC,oCAAoC;AACpC,8BAA8B;AAC9B,0CAA0C;AAC1C,mDAAmD;AACnD,0CAA0C;AAC1C,oDAAoD;AACpD,wBAAwB;AACxB,sBAAsB;AACtB,yCAAyC;AACzC,oCAAoC;AACpC,8BAA8B;AAC9B,yCAAyC;AACzC,mDAAmD;AACnD,wCAAwC;AACxC,wBAAwB;AACxB,qBAAqB;AACrB,iBAAiB;AACjB,6BAA6B;AAC7B,aAAa;AAEb,gDAAgD;AAEhD,8CAA8C;AAC9C,2EAA2E;AAC3E,wCAAwC;AACxC,gBAAgB;AAChB,gCAAgC;AAChC,yCAAyC;AACzC,iBAAiB;AACjB,gBAAgB;AAChB,gCAAgC;AAChC,iCAAiC;AACjC,gBAAgB;AAChB,cAAc;AACd,UAAU;AAEV,yEAAyE;AACzE,qDAAqD;AACrD,2DAA2D;AAC3D,2BAA2B;AAC3B,yCAAyC;AACzC,oCAAoC;AACpC,8BAA8B;AAC9B,0CAA0C;AAC1C,0CAA0C;AAC1C,yCAAyC;AACzC,wBAAwB;AACxB,sBAAsB;AACtB,yCAAyC;AACzC,oCAAoC;AACpC,8BAA8B;AAC9B,yCAAyC;AACzC,yCAAyC;AACzC,wCAAwC;AACxC,wBAAwB;AACxB,qBAAqB;AACrB,iBAAiB;AACjB,6BAA6B;AAC7B,aAAa;AAEb,gDAAgD;AAEhD,6CAA6C;AAC7C,iEAAiE;AACjE,2CAA2C;AAC3C,UAAU;AAEV,sDAAsD;AACtD,qDAAqD;AACrD,2DAA2D;AAC3D,6BAA6B;AAC7B,6BAA6B;AAC7B,aAAa;AAEb,gDAAgD;AAEhD,6CAA6C;AAC7C,iEAAiE;AACjE,2CAA2C;AAC3C,UAAU;AACV,MAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=JSXParser.Test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSXParser.Test.d.ts","sourceRoot":"","sources":["../../src/_tests/JSXParser.Test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// // #region Imports
|
|
3
|
+
// import { describe, it, expect, vi } from 'vitest';
|
|
4
|
+
// import { JSXParser } from '../src/Parsers/JSXParser.js';
|
|
5
|
+
// // #endregion
|
|
6
|
+
// describe('JSXParser', () => {
|
|
7
|
+
// it('should parse simple translations', () => {
|
|
8
|
+
// const parser = new JSXParser(console);
|
|
9
|
+
// const content = 't("Simple string"); translate(\'Another string\');';
|
|
10
|
+
// const result = parser.parse(content);
|
|
11
|
+
// expect(result).toEqual(['Simple string', 'Another string']);
|
|
12
|
+
// });
|
|
13
|
+
// it('should parse template literals', () => {
|
|
14
|
+
// const parser = new JSXParser(console);
|
|
15
|
+
// const content = 't(`Template literal string`);';
|
|
16
|
+
// const result = parser.parse(content);
|
|
17
|
+
// expect(result).toEqual(['Template literal string']);
|
|
18
|
+
// });
|
|
19
|
+
// it('should normalize multiline strings', () => {
|
|
20
|
+
// const parser = new JSXParser(console);
|
|
21
|
+
// const content = 't("This is a multiline string");';
|
|
22
|
+
// const result = parser.parse(content);
|
|
23
|
+
// expect(result).toEqual(['This is a multiline string']);
|
|
24
|
+
// });
|
|
25
|
+
// it('should parse translations with context', () => {
|
|
26
|
+
// const parser = new JSXParser(console);
|
|
27
|
+
// const content = 't("This is translatable", { context: "example" });';
|
|
28
|
+
// const result = parser.parse(content);
|
|
29
|
+
// expect(result).toEqual(['This is translatable']);
|
|
30
|
+
// });
|
|
31
|
+
// it('should handle custom markers as strings', () => {
|
|
32
|
+
// const parser = new JSXParser(console, { marker: 'customTranslate' });
|
|
33
|
+
// const content = 'customTranslate("Custom string");';
|
|
34
|
+
// const result = parser.parse(content);
|
|
35
|
+
// expect(result).toEqual(['Custom string']);
|
|
36
|
+
// });
|
|
37
|
+
// it('should handle custom markers as regex', () => {
|
|
38
|
+
// const parser = new JSXParser(console, { marker: /custom|translate/ });
|
|
39
|
+
// const content = `
|
|
40
|
+
// custom("Custom function");
|
|
41
|
+
// translate("Translated string");
|
|
42
|
+
// `;
|
|
43
|
+
// const result = parser.parse(content);
|
|
44
|
+
// expect(result).toEqual(['Custom function', 'Translated string']);
|
|
45
|
+
// });
|
|
46
|
+
// it('should handle escaped quotes', () => {
|
|
47
|
+
// const parser = new JSXParser(console);
|
|
48
|
+
// const content = 't("Escaped \\"quote\\""); translate(\'Escaped \\\'quote\\\'\');';
|
|
49
|
+
// const result = parser.parse(content);
|
|
50
|
+
// expect(result).toEqual(['Escaped "quote"', "Escaped 'quote'"]);
|
|
51
|
+
// });
|
|
52
|
+
// it('should handle empty content gracefully', () => {
|
|
53
|
+
// const parser = new JSXParser(console);
|
|
54
|
+
// const result = parser.parse('');
|
|
55
|
+
// expect(result).toEqual([]);
|
|
56
|
+
// });
|
|
57
|
+
// it('should handle null content gracefully', () => {
|
|
58
|
+
// const parser = new JSXParser(console);
|
|
59
|
+
// const result = parser.parse(null as any);
|
|
60
|
+
// expect(result).toEqual([]);
|
|
61
|
+
// });
|
|
62
|
+
// it('should handle undefined content gracefully', () => {
|
|
63
|
+
// const parser = new JSXParser(console);
|
|
64
|
+
// const result = parser.parse(undefined as any);
|
|
65
|
+
// expect(result).toEqual([]);
|
|
66
|
+
// });
|
|
67
|
+
// it('should trim results during post-processing', () => {
|
|
68
|
+
// const parser = new JSXParser(console);
|
|
69
|
+
// const content = 't(" String with spaces ");';
|
|
70
|
+
// const result = parser.parse(content);
|
|
71
|
+
// expect(result).toEqual(['String with spaces']);
|
|
72
|
+
// });
|
|
73
|
+
// it('should parse multiple translations in one line', () => {
|
|
74
|
+
// const parser = new JSXParser(console);
|
|
75
|
+
// const content = 't("First string"); t("Second string");';
|
|
76
|
+
// const result = parser.parse(content);
|
|
77
|
+
// expect(result).toEqual(['First string', 'Second string']);
|
|
78
|
+
// });
|
|
79
|
+
// it('should log debug messages when debug is enabled', () => {
|
|
80
|
+
// const consoleSpy = vi.spyOn(console, 'debug').mockImplementation(() => { });
|
|
81
|
+
// const parser = new JSXParser(console, { debug: true });
|
|
82
|
+
// const content = 't("Debug string");';
|
|
83
|
+
// parser.parse(content);
|
|
84
|
+
// expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('[BaseParser]:'));
|
|
85
|
+
// consoleSpy.mockRestore();
|
|
86
|
+
// });
|
|
87
|
+
// it('should not match invalid function calls', () => {
|
|
88
|
+
// const parser = new JSXParser(console);
|
|
89
|
+
// const content = 't(); t("Valid string"); translate();';
|
|
90
|
+
// const result = parser.parse(content);
|
|
91
|
+
// expect(result).toEqual(['Valid string']);
|
|
92
|
+
// });
|
|
93
|
+
// });
|
|
94
|
+
//# sourceMappingURL=JSXParser.Test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSXParser.Test.js","sourceRoot":"","sources":["../../src/_tests/JSXParser.Test.ts"],"names":[],"mappings":";AAAA,qBAAqB;AAErB,qDAAqD;AACrD,2DAA2D;AAE3D,gBAAgB;AAEhB,gCAAgC;AAChC,qDAAqD;AACrD,iDAAiD;AACjD,gFAAgF;AAChF,gDAAgD;AAChD,uEAAuE;AACvE,UAAU;AAEV,mDAAmD;AACnD,iDAAiD;AACjD,2DAA2D;AAC3D,gDAAgD;AAChD,+DAA+D;AAC/D,UAAU;AAEV,uDAAuD;AACvD,iDAAiD;AACjD,8DAA8D;AAC9D,gDAAgD;AAChD,kEAAkE;AAClE,UAAU;AAEV,2DAA2D;AAC3D,iDAAiD;AACjD,gFAAgF;AAChF,gDAAgD;AAChD,4DAA4D;AAC5D,UAAU;AAEV,4DAA4D;AAC5D,gFAAgF;AAChF,+DAA+D;AAC/D,gDAAgD;AAChD,qDAAqD;AACrD,UAAU;AAEV,0DAA0D;AAC1D,iFAAiF;AACjF,4BAA4B;AAC5B,yCAAyC;AACzC,8CAA8C;AAC9C,aAAa;AACb,gDAAgD;AAChD,4EAA4E;AAC5E,UAAU;AAEV,iDAAiD;AACjD,iDAAiD;AACjD,6FAA6F;AAC7F,gDAAgD;AAChD,0EAA0E;AAC1E,UAAU;AAEV,2DAA2D;AAC3D,iDAAiD;AACjD,2CAA2C;AAC3C,sCAAsC;AACtC,UAAU;AAEV,0DAA0D;AAC1D,iDAAiD;AACjD,oDAAoD;AACpD,sCAAsC;AACtC,UAAU;AAEV,+DAA+D;AAC/D,iDAAiD;AACjD,yDAAyD;AACzD,sCAAsC;AACtC,UAAU;AAEV,+DAA+D;AAC/D,iDAAiD;AACjD,4DAA4D;AAC5D,gDAAgD;AAChD,0DAA0D;AAC1D,UAAU;AAEV,mEAAmE;AACnE,iDAAiD;AACjD,oEAAoE;AACpE,gDAAgD;AAChD,qEAAqE;AACrE,UAAU;AAEV,oEAAoE;AACpE,uFAAuF;AACvF,kEAAkE;AAClE,gDAAgD;AAChD,iCAAiC;AACjC,6FAA6F;AAC7F,oCAAoC;AACpC,UAAU;AAEV,4DAA4D;AAC5D,iDAAiD;AACjD,kEAAkE;AAClE,gDAAgD;AAChD,oDAAoD;AACpD,UAAU;AACV,MAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=JavaScriptParser.Test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JavaScriptParser.Test.d.ts","sourceRoot":"","sources":["../../src/_tests/JavaScriptParser.Test.ts"],"names":[],"mappings":""}
|