@breadstone-tools/localizator-core 0.0.12-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/Detectors/Abstracts/BaseDetector.d.ts +81 -0
  2. package/Detectors/Abstracts/BaseDetector.d.ts.map +1 -0
  3. package/Detectors/Abstracts/BaseDetector.js +137 -0
  4. package/Detectors/Abstracts/BaseDetector.js.map +1 -0
  5. package/Detectors/AngularHTMLDetector.d.ts +94 -0
  6. package/Detectors/AngularHTMLDetector.d.ts.map +1 -0
  7. package/Detectors/AngularHTMLDetector.js +123 -0
  8. package/Detectors/AngularHTMLDetector.js.map +1 -0
  9. package/Detectors/Interfaces/IDetector.d.ts +73 -0
  10. package/Detectors/Interfaces/IDetector.d.ts.map +1 -0
  11. package/Detectors/Interfaces/IDetector.js +12 -0
  12. package/Detectors/Interfaces/IDetector.js.map +1 -0
  13. package/Detectors/JSXDetector.d.ts +69 -0
  14. package/Detectors/JSXDetector.d.ts.map +1 -0
  15. package/Detectors/JSXDetector.js +101 -0
  16. package/Detectors/JSXDetector.js.map +1 -0
  17. package/Detectors/JavaScriptDetector.d.ts +74 -0
  18. package/Detectors/JavaScriptDetector.d.ts.map +1 -0
  19. package/Detectors/JavaScriptDetector.js +106 -0
  20. package/Detectors/JavaScriptDetector.js.map +1 -0
  21. package/Detectors/TSXDetector.d.ts +76 -0
  22. package/Detectors/TSXDetector.d.ts.map +1 -0
  23. package/Detectors/TSXDetector.js +101 -0
  24. package/Detectors/TSXDetector.js.map +1 -0
  25. package/Detectors/TypeScriptDetector.d.ts +76 -0
  26. package/Detectors/TypeScriptDetector.d.ts.map +1 -0
  27. package/Detectors/TypeScriptDetector.js +102 -0
  28. package/Detectors/TypeScriptDetector.js.map +1 -0
  29. package/Detectors/Utils.d.ts +41 -0
  30. package/Detectors/Utils.d.ts.map +1 -0
  31. package/Detectors/Utils.js +62 -0
  32. package/Detectors/Utils.js.map +1 -0
  33. package/Detectors/VueDetector.d.ts +60 -0
  34. package/Detectors/VueDetector.d.ts.map +1 -0
  35. package/Detectors/VueDetector.js +108 -0
  36. package/Detectors/VueDetector.js.map +1 -0
  37. package/Formatters/Formatters.d.ts +15 -0
  38. package/Formatters/Formatters.d.ts.map +1 -0
  39. package/Formatters/Formatters.js +34 -0
  40. package/Formatters/Formatters.js.map +1 -0
  41. package/Formatters/Interfaces/IFormatter.d.ts +24 -0
  42. package/Formatters/Interfaces/IFormatter.d.ts.map +1 -0
  43. package/Formatters/Interfaces/IFormatter.js +3 -0
  44. package/Formatters/Interfaces/IFormatter.js.map +1 -0
  45. package/Formatters/JsonFormatter.d.ts +26 -0
  46. package/Formatters/JsonFormatter.d.ts.map +1 -0
  47. package/Formatters/JsonFormatter.js +42 -0
  48. package/Formatters/JsonFormatter.js.map +1 -0
  49. package/Formatters/ResxFormatter.d.ts +26 -0
  50. package/Formatters/ResxFormatter.d.ts.map +1 -0
  51. package/Formatters/ResxFormatter.js +53 -0
  52. package/Formatters/ResxFormatter.js.map +1 -0
  53. package/Index.d.ts +57 -0
  54. package/Index.d.ts.map +1 -0
  55. package/Index.js +86 -0
  56. package/Index.js.map +1 -0
  57. package/LICENSE +21 -0
  58. package/Presets/AngularPreset.d.ts +38 -0
  59. package/Presets/AngularPreset.d.ts.map +1 -0
  60. package/Presets/AngularPreset.js +59 -0
  61. package/Presets/AngularPreset.js.map +1 -0
  62. package/Presets/Interfaces/IFrameworkPreset.d.ts +28 -0
  63. package/Presets/Interfaces/IFrameworkPreset.d.ts.map +1 -0
  64. package/Presets/Interfaces/IFrameworkPreset.js +4 -0
  65. package/Presets/Interfaces/IFrameworkPreset.js.map +1 -0
  66. package/Presets/LitPreset.d.ts +38 -0
  67. package/Presets/LitPreset.d.ts.map +1 -0
  68. package/Presets/LitPreset.js +57 -0
  69. package/Presets/LitPreset.js.map +1 -0
  70. package/Presets/Presets.d.ts +25 -0
  71. package/Presets/Presets.d.ts.map +1 -0
  72. package/Presets/Presets.js +50 -0
  73. package/Presets/Presets.js.map +1 -0
  74. package/Presets/ReactPreset.d.ts +38 -0
  75. package/Presets/ReactPreset.d.ts.map +1 -0
  76. package/Presets/ReactPreset.js +61 -0
  77. package/Presets/ReactPreset.js.map +1 -0
  78. package/Presets/StencilPreset.d.ts +38 -0
  79. package/Presets/StencilPreset.d.ts.map +1 -0
  80. package/Presets/StencilPreset.js +59 -0
  81. package/Presets/StencilPreset.js.map +1 -0
  82. package/Presets/VuePreset.d.ts +38 -0
  83. package/Presets/VuePreset.d.ts.map +1 -0
  84. package/Presets/VuePreset.js +60 -0
  85. package/Presets/VuePreset.js.map +1 -0
  86. package/Resources/Analyzers/ResourceAnalyzer.d.ts +58 -0
  87. package/Resources/Analyzers/ResourceAnalyzer.d.ts.map +1 -0
  88. package/Resources/Analyzers/ResourceAnalyzer.js +119 -0
  89. package/Resources/Analyzers/ResourceAnalyzer.js.map +1 -0
  90. package/Resources/Analyzers/Tasks/DuplicateKeysTask.d.ts +31 -0
  91. package/Resources/Analyzers/Tasks/DuplicateKeysTask.d.ts.map +1 -0
  92. package/Resources/Analyzers/Tasks/DuplicateKeysTask.js +40 -0
  93. package/Resources/Analyzers/Tasks/DuplicateKeysTask.js.map +1 -0
  94. package/Resources/Analyzers/Tasks/EmptyValuesTask.d.ts +31 -0
  95. package/Resources/Analyzers/Tasks/EmptyValuesTask.d.ts.map +1 -0
  96. package/Resources/Analyzers/Tasks/EmptyValuesTask.js +41 -0
  97. package/Resources/Analyzers/Tasks/EmptyValuesTask.js.map +1 -0
  98. package/Resources/Analyzers/Tasks/Interfaces/IAnalyzerTask.d.ts +36 -0
  99. package/Resources/Analyzers/Tasks/Interfaces/IAnalyzerTask.d.ts.map +1 -0
  100. package/Resources/Analyzers/Tasks/Interfaces/IAnalyzerTask.js +4 -0
  101. package/Resources/Analyzers/Tasks/Interfaces/IAnalyzerTask.js.map +1 -0
  102. package/Resources/Analyzers/Tasks/KeyConsistencyTask.d.ts +35 -0
  103. package/Resources/Analyzers/Tasks/KeyConsistencyTask.d.ts.map +1 -0
  104. package/Resources/Analyzers/Tasks/KeyConsistencyTask.js +67 -0
  105. package/Resources/Analyzers/Tasks/KeyConsistencyTask.js.map +1 -0
  106. package/Resources/Analyzers/Tasks/MissingTranslationsTask.d.ts +31 -0
  107. package/Resources/Analyzers/Tasks/MissingTranslationsTask.d.ts.map +1 -0
  108. package/Resources/Analyzers/Tasks/MissingTranslationsTask.js +44 -0
  109. package/Resources/Analyzers/Tasks/MissingTranslationsTask.js.map +1 -0
  110. package/Resources/Analyzers/Tasks/MultipleKeyUsageTask.d.ts +31 -0
  111. package/Resources/Analyzers/Tasks/MultipleKeyUsageTask.d.ts.map +1 -0
  112. package/Resources/Analyzers/Tasks/MultipleKeyUsageTask.js +48 -0
  113. package/Resources/Analyzers/Tasks/MultipleKeyUsageTask.js.map +1 -0
  114. package/Resources/Analyzers/Tasks/UnusedKeysTask.d.ts +31 -0
  115. package/Resources/Analyzers/Tasks/UnusedKeysTask.d.ts.map +1 -0
  116. package/Resources/Analyzers/Tasks/UnusedKeysTask.js +49 -0
  117. package/Resources/Analyzers/Tasks/UnusedKeysTask.js.map +1 -0
  118. package/Resources/Models/Interfaces/IJsonResourceInfo.d.ts +12 -0
  119. package/Resources/Models/Interfaces/IJsonResourceInfo.d.ts.map +1 -0
  120. package/Resources/Models/Interfaces/IJsonResourceInfo.js +4 -0
  121. package/Resources/Models/Interfaces/IJsonResourceInfo.js.map +1 -0
  122. package/Resources/Models/Interfaces/IResourceInfo.d.ts +71 -0
  123. package/Resources/Models/Interfaces/IResourceInfo.d.ts.map +1 -0
  124. package/Resources/Models/Interfaces/IResourceInfo.js +4 -0
  125. package/Resources/Models/Interfaces/IResourceInfo.js.map +1 -0
  126. package/Resources/Models/Interfaces/IResourceModel.d.ts +41 -0
  127. package/Resources/Models/Interfaces/IResourceModel.d.ts.map +1 -0
  128. package/Resources/Models/Interfaces/IResourceModel.js +25 -0
  129. package/Resources/Models/Interfaces/IResourceModel.js.map +1 -0
  130. package/Resources/Models/Interfaces/IResxResourceInfo.d.ts +12 -0
  131. package/Resources/Models/Interfaces/IResxResourceInfo.d.ts.map +1 -0
  132. package/Resources/Models/Interfaces/IResxResourceInfo.js +4 -0
  133. package/Resources/Models/Interfaces/IResxResourceInfo.js.map +1 -0
  134. package/Resources/Models/Interfaces/ITypeScriptResourceInfo.d.ts +11 -0
  135. package/Resources/Models/Interfaces/ITypeScriptResourceInfo.d.ts.map +1 -0
  136. package/Resources/Models/Interfaces/ITypeScriptResourceInfo.js +4 -0
  137. package/Resources/Models/Interfaces/ITypeScriptResourceInfo.js.map +1 -0
  138. package/Resources/Models/Interfaces/ResourceType.d.ts +29 -0
  139. package/Resources/Models/Interfaces/ResourceType.d.ts.map +1 -0
  140. package/Resources/Models/Interfaces/ResourceType.js +45 -0
  141. package/Resources/Models/Interfaces/ResourceType.js.map +1 -0
  142. package/Resources/Models/JsonResourceInfo.d.ts +111 -0
  143. package/Resources/Models/JsonResourceInfo.d.ts.map +1 -0
  144. package/Resources/Models/JsonResourceInfo.js +184 -0
  145. package/Resources/Models/JsonResourceInfo.js.map +1 -0
  146. package/Resources/Models/ResxResourceInfo.d.ts +110 -0
  147. package/Resources/Models/ResxResourceInfo.d.ts.map +1 -0
  148. package/Resources/Models/ResxResourceInfo.js +171 -0
  149. package/Resources/Models/ResxResourceInfo.js.map +1 -0
  150. package/Resources/Models/TypeScriptResourceInfo.d.ts +109 -0
  151. package/Resources/Models/TypeScriptResourceInfo.d.ts.map +1 -0
  152. package/Resources/Models/TypeScriptResourceInfo.js +244 -0
  153. package/Resources/Models/TypeScriptResourceInfo.js.map +1 -0
  154. package/Resources/ResourceFactory.d.ts +39 -0
  155. package/Resources/ResourceFactory.d.ts.map +1 -0
  156. package/Resources/ResourceFactory.js +102 -0
  157. package/Resources/ResourceFactory.js.map +1 -0
  158. package/Resources/ResourceMode.d.ts +14 -0
  159. package/Resources/ResourceMode.d.ts.map +1 -0
  160. package/Resources/ResourceMode.js +18 -0
  161. package/Resources/ResourceMode.js.map +1 -0
  162. package/Resources/ResourceProcessor.d.ts +66 -0
  163. package/Resources/ResourceProcessor.d.ts.map +1 -0
  164. package/Resources/ResourceProcessor.js +90 -0
  165. package/Resources/ResourceProcessor.js.map +1 -0
  166. package/Resources/Scanners/Adapter/Interfaces/IScannerAdapter.d.ts +17 -0
  167. package/Resources/Scanners/Adapter/Interfaces/IScannerAdapter.d.ts.map +1 -0
  168. package/Resources/Scanners/Adapter/Interfaces/IScannerAdapter.js +4 -0
  169. package/Resources/Scanners/Adapter/Interfaces/IScannerAdapter.js.map +1 -0
  170. package/Resources/Scanners/Adapter/JsonScannerAdapter.d.ts +28 -0
  171. package/Resources/Scanners/Adapter/JsonScannerAdapter.d.ts.map +1 -0
  172. package/Resources/Scanners/Adapter/JsonScannerAdapter.js +62 -0
  173. package/Resources/Scanners/Adapter/JsonScannerAdapter.js.map +1 -0
  174. package/Resources/Scanners/Adapter/ResxScannerAdapter.d.ts +28 -0
  175. package/Resources/Scanners/Adapter/ResxScannerAdapter.d.ts.map +1 -0
  176. package/Resources/Scanners/Adapter/ResxScannerAdapter.js +62 -0
  177. package/Resources/Scanners/Adapter/ResxScannerAdapter.js.map +1 -0
  178. package/Resources/Scanners/ResourceScanner.d.ts +32 -0
  179. package/Resources/Scanners/ResourceScanner.d.ts.map +1 -0
  180. package/Resources/Scanners/ResourceScanner.js +59 -0
  181. package/Resources/Scanners/ResourceScanner.js.map +1 -0
  182. package/Resources/Sorting/ResourceSorter.d.ts +46 -0
  183. package/Resources/Sorting/ResourceSorter.d.ts.map +1 -0
  184. package/Resources/Sorting/ResourceSorter.js +82 -0
  185. package/Resources/Sorting/ResourceSorter.js.map +1 -0
  186. package/Resources/Transformers/Adapters/Abstracts/BaseResourceTransformerAdapter.d.ts +20 -0
  187. package/Resources/Transformers/Adapters/Abstracts/BaseResourceTransformerAdapter.d.ts.map +1 -0
  188. package/Resources/Transformers/Adapters/Abstracts/BaseResourceTransformerAdapter.js +15 -0
  189. package/Resources/Transformers/Adapters/Abstracts/BaseResourceTransformerAdapter.js.map +1 -0
  190. package/Resources/Transformers/Adapters/Interfaces/IResourceTransformerAdapter.d.ts +11 -0
  191. package/Resources/Transformers/Adapters/Interfaces/IResourceTransformerAdapter.d.ts.map +1 -0
  192. package/Resources/Transformers/Adapters/Interfaces/IResourceTransformerAdapter.js +4 -0
  193. package/Resources/Transformers/Adapters/Interfaces/IResourceTransformerAdapter.js.map +1 -0
  194. package/Resources/Transformers/Adapters/JsonResourceTransformerAdapter.d.ts +26 -0
  195. package/Resources/Transformers/Adapters/JsonResourceTransformerAdapter.d.ts.map +1 -0
  196. package/Resources/Transformers/Adapters/JsonResourceTransformerAdapter.js +64 -0
  197. package/Resources/Transformers/Adapters/JsonResourceTransformerAdapter.js.map +1 -0
  198. package/Resources/Transformers/Adapters/ResxResourceTransformerAdapter.d.ts +19 -0
  199. package/Resources/Transformers/Adapters/ResxResourceTransformerAdapter.d.ts.map +1 -0
  200. package/Resources/Transformers/Adapters/ResxResourceTransformerAdapter.js +30 -0
  201. package/Resources/Transformers/Adapters/ResxResourceTransformerAdapter.js.map +1 -0
  202. package/Resources/Transformers/Interfaces/IResourceTransformerResult.d.ts +11 -0
  203. package/Resources/Transformers/Interfaces/IResourceTransformerResult.d.ts.map +1 -0
  204. package/Resources/Transformers/Interfaces/IResourceTransformerResult.js +4 -0
  205. package/Resources/Transformers/Interfaces/IResourceTransformerResult.js.map +1 -0
  206. package/Resources/Transformers/ResourceTransformer.d.ts +74 -0
  207. package/Resources/Transformers/ResourceTransformer.d.ts.map +1 -0
  208. package/Resources/Transformers/ResourceTransformer.js +112 -0
  209. package/Resources/Transformers/ResourceTransformer.js.map +1 -0
  210. package/Resources/Transformers/Serializers/Interfaces/IResourceSerializer.d.ts +9 -0
  211. package/Resources/Transformers/Serializers/Interfaces/IResourceSerializer.d.ts.map +1 -0
  212. package/Resources/Transformers/Serializers/Interfaces/IResourceSerializer.js +4 -0
  213. package/Resources/Transformers/Serializers/Interfaces/IResourceSerializer.js.map +1 -0
  214. package/Resources/Transformers/Serializers/JsonResourceSerializer.d.ts +20 -0
  215. package/Resources/Transformers/Serializers/JsonResourceSerializer.d.ts.map +1 -0
  216. package/Resources/Transformers/Serializers/JsonResourceSerializer.js +47 -0
  217. package/Resources/Transformers/Serializers/JsonResourceSerializer.js.map +1 -0
  218. package/Resources/Transformers/Serializers/ResxResourceSerializer.d.ts +20 -0
  219. package/Resources/Transformers/Serializers/ResxResourceSerializer.d.ts.map +1 -0
  220. package/Resources/Transformers/Serializers/ResxResourceSerializer.js +36 -0
  221. package/Resources/Transformers/Serializers/ResxResourceSerializer.js.map +1 -0
  222. package/Resources/Transformers/Serializers/TypescriptResourceSerializer.d.ts +20 -0
  223. package/Resources/Transformers/Serializers/TypescriptResourceSerializer.d.ts.map +1 -0
  224. package/Resources/Transformers/Serializers/TypescriptResourceSerializer.js +36 -0
  225. package/Resources/Transformers/Serializers/TypescriptResourceSerializer.js.map +1 -0
  226. package/Services/DiffService.d.ts +1 -0
  227. package/Services/DiffService.d.ts.map +1 -0
  228. package/Services/DiffService.js +86 -0
  229. package/Services/DiffService.js.map +1 -0
  230. package/Services/KeyGenerator.d.ts +21 -0
  231. package/Services/KeyGenerator.d.ts.map +1 -0
  232. package/Services/KeyGenerator.js +34 -0
  233. package/Services/KeyGenerator.js.map +1 -0
  234. package/Services/LocalizationProcessor.d.ts +83 -0
  235. package/Services/LocalizationProcessor.d.ts.map +1 -0
  236. package/Services/LocalizationProcessor.js +90 -0
  237. package/Services/LocalizationProcessor.js.map +1 -0
  238. package/package.json +19 -0
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Escapes special characters in a string for use in a regular expression.
3
+ *
4
+ * @param value - The string to escape.
5
+ * @returns The escaped string.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const escaped = escapeRegExp(".*+?^${}()|[]\\");
10
+ * console.log(escaped); // \.\*\+\?\^\$\{\}$begin:math:text$$end:math:text$\|$begin:math:display$$end:math:display$\\
11
+ * ```
12
+ */
13
+ export declare function escapeRegExp(value: string): string;
14
+ /**
15
+ * Checks whether a string is a valid resource key.
16
+ *
17
+ * @param key - The string to check.
18
+ * @param prefix - An optional prefix that valid keys should start with (e.g., `loc.`).
19
+ * @param suffix - An optional suffix that valid keys should end with (e.g., `.key`).
20
+ * @returns `true` if the string is a valid resource key, otherwise `false`.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const isValid = isResourceKey("loc.this.is.a.key", "loc.");
25
+ * console.log(isValid); // true
26
+ *
27
+ * const hasInvalidPrefix = isResourceKey("this.is.a.key", "loc.");
28
+ * console.log(hasInvalidPrefix); // false
29
+ *
30
+ * const hasInvalidSuffix = isResourceKey("loc.this.is.a.key", "loc.", ".value");
31
+ * console.log(hasInvalidSuffix); // false
32
+ *
33
+ * const containsSpaces = isResourceKey("this is invalid", "loc.");
34
+ * console.log(containsSpaces); // false
35
+ *
36
+ * const noPrefixOrSuffix = isResourceKey("a.valid.key");
37
+ * console.log(noPrefixOrSuffix); // true
38
+ * ```
39
+ */
40
+ export declare function isResourceKey(key: string, prefix?: string, suffix?: string): boolean;
41
+ //# sourceMappingURL=Utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../src/Detectors/Utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAkBpF"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.escapeRegExp = escapeRegExp;
4
+ exports.isResourceKey = isResourceKey;
5
+ /**
6
+ * Escapes special characters in a string for use in a regular expression.
7
+ *
8
+ * @param value - The string to escape.
9
+ * @returns The escaped string.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const escaped = escapeRegExp(".*+?^${}()|[]\\");
14
+ * console.log(escaped); // \.\*\+\?\^\$\{\}$begin:math:text$$end:math:text$\|$begin:math:display$$end:math:display$\\
15
+ * ```
16
+ */
17
+ function escapeRegExp(value) {
18
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
19
+ }
20
+ /**
21
+ * Checks whether a string is a valid resource key.
22
+ *
23
+ * @param key - The string to check.
24
+ * @param prefix - An optional prefix that valid keys should start with (e.g., `loc.`).
25
+ * @param suffix - An optional suffix that valid keys should end with (e.g., `.key`).
26
+ * @returns `true` if the string is a valid resource key, otherwise `false`.
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const isValid = isResourceKey("loc.this.is.a.key", "loc.");
31
+ * console.log(isValid); // true
32
+ *
33
+ * const hasInvalidPrefix = isResourceKey("this.is.a.key", "loc.");
34
+ * console.log(hasInvalidPrefix); // false
35
+ *
36
+ * const hasInvalidSuffix = isResourceKey("loc.this.is.a.key", "loc.", ".value");
37
+ * console.log(hasInvalidSuffix); // false
38
+ *
39
+ * const containsSpaces = isResourceKey("this is invalid", "loc.");
40
+ * console.log(containsSpaces); // false
41
+ *
42
+ * const noPrefixOrSuffix = isResourceKey("a.valid.key");
43
+ * console.log(noPrefixOrSuffix); // true
44
+ * ```
45
+ */
46
+ function isResourceKey(key, prefix, suffix) {
47
+ // Check for prefix, if specified
48
+ if (prefix && !key.startsWith(prefix)) {
49
+ return false; // Key must start with the given prefix
50
+ }
51
+ // Check for suffix, if specified
52
+ if (suffix && !key.endsWith(suffix)) {
53
+ return false; // Key must end with the given suffix
54
+ }
55
+ // Check for spaces
56
+ if ((/\s/).test(key)) {
57
+ return false; // Keys should not contain spaces
58
+ }
59
+ // All conditions met: key is considered a resource key
60
+ return true;
61
+ }
62
+ //# sourceMappingURL=Utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../src/Detectors/Utils.ts"],"names":[],"mappings":";;AAYA,oCAEC;AA4BD,sCAkBC;AA5DD;;;;;;;;;;;GAWG;AACH,SAAgB,YAAY,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,aAAa,CAAC,GAAW,EAAE,MAAe,EAAE,MAAe;IACvE,iCAAiC;IACjC,IAAI,MAAM,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC,CAAC,uCAAuC;IACzD,CAAC;IAED,iCAAiC;IACjC,IAAI,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC,CAAC,qCAAqC;IACvD,CAAC;IAED,mBAAmB;IACnB,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnB,OAAO,KAAK,CAAC,CAAC,iCAAiC;IACnD,CAAC;IAED,uDAAuD;IACvD,OAAO,IAAI,CAAC;AAChB,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { BaseDetector, type IBaseDetectorOptions } from './Abstracts/BaseDetector.js';
2
+ import type { ILogger } from '@breadstone-infrastructure/utilities';
3
+ /**
4
+ * Options for configuring the `VueDetector`.
5
+ *
6
+ * @public
7
+ */
8
+ export interface IVueDetectorOptions extends IBaseDetectorOptions {
9
+ /**
10
+ * The function name or regex used for translation in scripts (default: `/\$t|t/`).
11
+ */
12
+ scriptMarker?: string | RegExp;
13
+ /**
14
+ * The function name or regex used for translation in templates (default: `\$t`).
15
+ */
16
+ templateMarker?: string | RegExp;
17
+ }
18
+ /**
19
+ * Detector for extracting translatable strings from Vue files.
20
+ *
21
+ * This detector supports translation extraction from:
22
+ * - `<template>` blocks:
23
+ * ```html
24
+ * <div>{{ $t('Template string') }}</div>
25
+ * ```
26
+ * - `<script>` blocks:
27
+ * ```typescript
28
+ * $t('Script string');
29
+ * ```
30
+ *
31
+ * @public
32
+ */
33
+ export declare class VueDetector extends BaseDetector {
34
+ private readonly _scriptMarker;
35
+ private readonly _templateMarker;
36
+ /**
37
+ * Constructs a new instance of the `VueDetector` class.
38
+ *
39
+ * @public
40
+ * @param logger - The logger to use for logging messages.
41
+ * @param options - Configuration for the detector.
42
+ */
43
+ constructor(logger: ILogger, options?: IVueDetectorOptions);
44
+ /**
45
+ * Provides regex patterns for extracting strings from Vue files.
46
+ *
47
+ * @protected
48
+ * @returns An array of regex patterns.
49
+ */
50
+ protected getRegexes(): Array<RegExp>;
51
+ /**
52
+ * Pre-processes Vue content by extracting `<template>` and `<script>` blocks.
53
+ *
54
+ * @protected
55
+ * @param content - The raw content.
56
+ * @returns The combined content.
57
+ */
58
+ protected preProcessContent(content: string): string;
59
+ }
60
+ //# sourceMappingURL=VueDetector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VueDetector.d.ts","sourceRoot":"","sources":["../../src/Detectors/VueDetector.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,KAAK,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGtF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAIpE;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAE7D;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE/B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAEpC;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAIzC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkB;IAChD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;IAMlD;;;;;;OAMG;gBACgB,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,mBAAmB;IAWjE;;;;;OAKG;cACgB,UAAU,IAAI,KAAK,CAAC,MAAM,CAAC;IAyB9C;;;;;;OAMG;cACgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAiBhE"}
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ // #region Imports
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.VueDetector = void 0;
28
+ const BaseDetector_js_1 = require("./Abstracts/BaseDetector.js");
29
+ const cheerio = __importStar(require("cheerio"));
30
+ const Utils_js_1 = require("./Utils.js");
31
+ /**
32
+ * Detector for extracting translatable strings from Vue files.
33
+ *
34
+ * This detector supports translation extraction from:
35
+ * - `<template>` blocks:
36
+ * ```html
37
+ * <div>{{ $t('Template string') }}</div>
38
+ * ```
39
+ * - `<script>` blocks:
40
+ * ```typescript
41
+ * $t('Script string');
42
+ * ```
43
+ *
44
+ * @public
45
+ */
46
+ class VueDetector extends BaseDetector_js_1.BaseDetector {
47
+ // #region Fields
48
+ _scriptMarker;
49
+ _templateMarker;
50
+ // #endregion
51
+ // #region Constructor
52
+ /**
53
+ * Constructs a new instance of the `VueDetector` class.
54
+ *
55
+ * @public
56
+ * @param logger - The logger to use for logging messages.
57
+ * @param options - Configuration for the detector.
58
+ */
59
+ constructor(logger, options) {
60
+ super(logger, options);
61
+ this._scriptMarker = options?.scriptMarker ?? /t|\$t/;
62
+ this._templateMarker = options?.templateMarker ?? /\$t/;
63
+ }
64
+ // #endregion
65
+ // #region Methods
66
+ /**
67
+ * Provides regex patterns for extracting strings from Vue files.
68
+ *
69
+ * @protected
70
+ * @returns An array of regex patterns.
71
+ */
72
+ getRegexes() {
73
+ const templateMarker = this._templateMarker instanceof RegExp
74
+ ? this._templateMarker.source
75
+ : (0, Utils_js_1.escapeRegExp)(this._templateMarker);
76
+ const scriptMarker = this._scriptMarker instanceof RegExp
77
+ ? this._scriptMarker.source
78
+ : (0, Utils_js_1.escapeRegExp)(this._scriptMarker);
79
+ return [
80
+ // Template Marker
81
+ new RegExp(`${templateMarker}\\(` +
82
+ "\\s*(['\"`])(?<value>(?:\\\\\\1|.)*?)\\1(?:,\\s*\\{.*?\\})?\\)", 'gs'),
83
+ // Script Marker
84
+ new RegExp(`${scriptMarker}\\(` +
85
+ "\\s*(['\"`])(?<value>(?:\\\\\\1|.)*?)\\1(?:,\\s*\\{.*?\\})?\\)", 'gs')
86
+ ];
87
+ }
88
+ /**
89
+ * Pre-processes Vue content by extracting `<template>` and `<script>` blocks.
90
+ *
91
+ * @protected
92
+ * @param content - The raw content.
93
+ * @returns The combined content.
94
+ */
95
+ preProcessContent(content) {
96
+ const $ = cheerio.load(content);
97
+ const templateContent = $('template').html() ?? '';
98
+ const scriptContent = $('script').html() ?? '';
99
+ const combinedContent = `
100
+ ${templateContent}
101
+ ${scriptContent}
102
+ `;
103
+ this.log('Pre-processed Vue content.');
104
+ return combinedContent.replace(/\r?\n/g, ' ').trim();
105
+ }
106
+ }
107
+ exports.VueDetector = VueDetector;
108
+ //# sourceMappingURL=VueDetector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VueDetector.js","sourceRoot":"","sources":["../../src/Detectors/VueDetector.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;AAElB,iEAAsF;AACtF,iDAAmC;AACnC,yCAA0C;AAwB1C;;;;;;;;;;;;;;GAcG;AACH,MAAa,WAAY,SAAQ,8BAAY;IAEzC,iBAAiB;IAEA,aAAa,CAAkB;IAC/B,eAAe,CAAkB;IAElD,aAAa;IAEb,sBAAsB;IAEtB;;;;;;OAMG;IACH,YAAmB,MAAe,EAAE,OAA6B;QAC7D,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAEvB,IAAI,CAAC,aAAa,GAAG,OAAO,EAAE,YAAY,IAAI,OAAO,CAAC;QACtD,IAAI,CAAC,eAAe,GAAG,OAAO,EAAE,cAAc,IAAI,KAAK,CAAC;IAC5D,CAAC;IAED,aAAa;IAEb,kBAAkB;IAElB;;;;;OAKG;IACgB,UAAU;QACzB,MAAM,cAAc,GAAG,IAAI,CAAC,eAAe,YAAY,MAAM;YACzD,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM;YAC7B,CAAC,CAAC,IAAA,uBAAY,EAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAEzC,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,YAAY,MAAM;YACrD,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM;YAC3B,CAAC,CAAC,IAAA,uBAAY,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAEvC,OAAO;YACH,kBAAkB;YAClB,IAAI,MAAM,CACN,GAAG,cAAc,KAAK;gBACtB,gEAAgE,EAChE,IAAI,CACP;YACD,gBAAgB;YAChB,IAAI,MAAM,CACN,GAAG,YAAY,KAAK;gBACpB,gEAAgE,EAChE,IAAI,CACP;SACJ,CAAC;IACN,CAAC;IAED;;;;;;OAMG;IACgB,iBAAiB,CAAC,OAAe;QAChD,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEhC,MAAM,eAAe,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;QACnD,MAAM,aAAa,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;QAE/C,MAAM,eAAe,GAAG;cAClB,eAAe;cACf,aAAa;SAClB,CAAC;QAEF,IAAI,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;QACvC,OAAO,eAAe,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACzD,CAAC;CAIJ;AApFD,kCAoFC"}
@@ -0,0 +1,15 @@
1
+ import { ResourceType } from '../Resources/Models/Interfaces/ResourceType.js';
2
+ import type { IFormatter } from './Interfaces/IFormatter.js';
3
+ /**
4
+ * @public
5
+ */
6
+ export declare namespace Formatters {
7
+ /**
8
+ * Gets a formatter instance based on the provided formatter type.
9
+ *
10
+ * @param type - The formatter type.
11
+ * @returns The formatter instance.
12
+ */
13
+ function get(type: ResourceType): IFormatter;
14
+ }
15
+ //# sourceMappingURL=Formatters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Formatters.d.ts","sourceRoot":"","sources":["../../src/Formatters/Formatters.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAM7D;;GAEG;AACH,yBAAiB,UAAU,CAAC;IAExB;;;;;OAKG;IACH,SAAgB,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,UAAU,CAWlD;CAEJ"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Formatters = void 0;
5
+ const ResourceType_js_1 = require("../Resources/Models/Interfaces/ResourceType.js");
6
+ const JsonFormatter_js_1 = require("./JsonFormatter.js");
7
+ const ResxFormatter_js_1 = require("./ResxFormatter.js");
8
+ // #endregion
9
+ /**
10
+ * @public
11
+ */
12
+ var Formatters;
13
+ (function (Formatters) {
14
+ /**
15
+ * Gets a formatter instance based on the provided formatter type.
16
+ *
17
+ * @param type - The formatter type.
18
+ * @returns The formatter instance.
19
+ */
20
+ function get(type) {
21
+ switch (type) {
22
+ case ResourceType_js_1.ResourceType.Json:
23
+ return new JsonFormatter_js_1.JsonFormatter();
24
+ case ResourceType_js_1.ResourceType.Resx:
25
+ return new ResxFormatter_js_1.ResxFormatter();
26
+ case ResourceType_js_1.ResourceType.TypeScript:
27
+ throw new Error('TypeScript formatter is not implemented');
28
+ default:
29
+ throw new Error('Unknown formatter');
30
+ }
31
+ }
32
+ Formatters.get = get;
33
+ })(Formatters || (exports.Formatters = Formatters = {}));
34
+ //# sourceMappingURL=Formatters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Formatters.js","sourceRoot":"","sources":["../../src/Formatters/Formatters.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAElB,oFAA8E;AAE9E,yDAAmD;AACnD,yDAAmD;AAEnD,aAAa;AAEb;;GAEG;AACH,IAAiB,UAAU,CAqB1B;AArBD,WAAiB,UAAU;IAEvB;;;;;OAKG;IACH,SAAgB,GAAG,CAAC,IAAkB;QAClC,QAAQ,IAAI,EAAE,CAAC;YACX,KAAK,8BAAY,CAAC,IAAI;gBAClB,OAAO,IAAI,gCAAa,EAAE,CAAC;YAC/B,KAAK,8BAAY,CAAC,IAAI;gBAClB,OAAO,IAAI,gCAAa,EAAE,CAAC;YAC/B,KAAK,8BAAY,CAAC,UAAU;gBACxB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAC/D;gBACI,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC;IAXe,cAAG,MAWlB,CAAA;AAEL,CAAC,EArBgB,UAAU,0BAAV,UAAU,QAqB1B"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Represents the result of a formatter operation.
3
+ *
4
+ * @public
5
+ */
6
+ export interface IFormatterResult {
7
+ content: string;
8
+ changes: Record<string, string>;
9
+ }
10
+ /**
11
+ * Interface for formatters that convert extracted strings into specific formats.
12
+ *
13
+ * @public
14
+ */
15
+ export interface IFormatter {
16
+ /**
17
+ * Formats extracted strings into a desired format.
18
+ *
19
+ * @param strings - The extracted strings as key-value pairs.
20
+ * @returns The formatted output.
21
+ */
22
+ format(strings: Record<string, string>): IFormatterResult;
23
+ }
24
+ //# sourceMappingURL=IFormatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IFormatter.d.ts","sourceRoot":"","sources":["../../../src/Formatters/Interfaces/IFormatter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IAEvB;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,gBAAgB,CAAC;CAE7D"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IFormatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IFormatter.js","sourceRoot":"","sources":["../../../src/Formatters/Interfaces/IFormatter.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import type { IFormatter, IFormatterResult } from './Interfaces/IFormatter.js';
2
+ /**
3
+ * Formatter for outputting extracted strings in JSON format.
4
+ *
5
+ * @public
6
+ */
7
+ export declare class JsonFormatter implements IFormatter {
8
+ private readonly _indent;
9
+ /**
10
+ * Constructs a new instance of the `JsonFormatter` class.
11
+ *
12
+ * @public
13
+ */
14
+ constructor(options?: {
15
+ indent: number;
16
+ });
17
+ /**
18
+ * Formats extracted strings into a JSON format.
19
+ *
20
+ * @public
21
+ * @param strings The extracted strings as key-value pairs.
22
+ * @returns The formatted output as a JSON string.
23
+ */
24
+ format(strings: Record<string, string>): IFormatterResult;
25
+ }
26
+ //# sourceMappingURL=JsonFormatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonFormatter.d.ts","sourceRoot":"","sources":["../../src/Formatters/JsonFormatter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAI/E;;;;GAIG;AACH,qBAAa,aAAc,YAAW,UAAU;IAI5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAMjC;;;;OAIG;gBACgB,OAAO,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;IAQ/C;;;;;;OAMG;IACI,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,gBAAgB;CAWnE"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.JsonFormatter = void 0;
5
+ // #endregion
6
+ /**
7
+ * Formatter for outputting extracted strings in JSON format.
8
+ *
9
+ * @public
10
+ */
11
+ class JsonFormatter {
12
+ // #region Fields
13
+ _indent;
14
+ // #endregion
15
+ // #region Ctor
16
+ /**
17
+ * Constructs a new instance of the `JsonFormatter` class.
18
+ *
19
+ * @public
20
+ */
21
+ constructor(options) {
22
+ this._indent = options?.indent ?? 2;
23
+ }
24
+ // #endregion
25
+ // #region Methods
26
+ /**
27
+ * Formats extracted strings into a JSON format.
28
+ *
29
+ * @public
30
+ * @param strings The extracted strings as key-value pairs.
31
+ * @returns The formatted output as a JSON string.
32
+ */
33
+ format(strings) {
34
+ const content = JSON.stringify(strings, null, this._indent);
35
+ return {
36
+ content: content,
37
+ changes: strings
38
+ };
39
+ }
40
+ }
41
+ exports.JsonFormatter = JsonFormatter;
42
+ //# sourceMappingURL=JsonFormatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonFormatter.js","sourceRoot":"","sources":["../../src/Formatters/JsonFormatter.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAIlB,aAAa;AAEb;;;;GAIG;AACH,MAAa,aAAa;IAEtB,iBAAiB;IAEA,OAAO,CAAS;IAEjC,aAAa;IAEb,eAAe;IAEf;;;;OAIG;IACH,YAAmB,OAA4B;QAC3C,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,aAAa;IAEb,kBAAkB;IAElB;;;;;;OAMG;IACI,MAAM,CAAC,OAA+B;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAE5D,OAAO;YACH,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,OAAO;SACnB,CAAC;IACN,CAAC;CAIJ;AAzCD,sCAyCC"}
@@ -0,0 +1,26 @@
1
+ import type { IFormatter, IFormatterResult } from './Interfaces/IFormatter.js';
2
+ /**
3
+ * Formatter for outputting extracted strings in RESX format.
4
+ *
5
+ * @public
6
+ */
7
+ export declare class ResxFormatter implements IFormatter {
8
+ private readonly _indent;
9
+ /**
10
+ * Constructs a new instance of the `ResxFormatter` class.
11
+ *
12
+ * @public
13
+ */
14
+ constructor(options?: {
15
+ indent: number;
16
+ });
17
+ /**
18
+ * Formats extracted strings into the RESX XML format.
19
+ *
20
+ * @public
21
+ * @param strings A record of string keys and their values.
22
+ * @returns The formatted output as a RESX string.
23
+ */
24
+ format(strings: Record<string, string>): IFormatterResult;
25
+ }
26
+ //# sourceMappingURL=ResxFormatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResxFormatter.d.ts","sourceRoot":"","sources":["../../src/Formatters/ResxFormatter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAI/E;;;;GAIG;AACH,qBAAa,aAAc,YAAW,UAAU;IAI5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAMjC;;;;OAIG;gBACgB,OAAO,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;IAM/C;;;;;;OAMG;IACI,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,gBAAgB;CAsBnE"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ResxFormatter = void 0;
5
+ // #endregion
6
+ /**
7
+ * Formatter for outputting extracted strings in RESX format.
8
+ *
9
+ * @public
10
+ */
11
+ class ResxFormatter {
12
+ // #region Fields
13
+ _indent;
14
+ // #endregion
15
+ // #region Ctor
16
+ /**
17
+ * Constructs a new instance of the `ResxFormatter` class.
18
+ *
19
+ * @public
20
+ */
21
+ constructor(options) {
22
+ this._indent = options?.indent ?? 2;
23
+ }
24
+ // #endregion
25
+ /**
26
+ * Formats extracted strings into the RESX XML format.
27
+ *
28
+ * @public
29
+ * @param strings A record of string keys and their values.
30
+ * @returns The formatted output as a RESX string.
31
+ */
32
+ format(strings) {
33
+ const escapeXml = (value) => value
34
+ .replace(/&/g, '&amp;')
35
+ .replace(/</g, '&lt;')
36
+ .replace(/>/g, '&gt;')
37
+ .replace(/"/g, '&quot;')
38
+ .replace(/'/g, '&apos;');
39
+ const content = `<?xml version="1.0" encoding="utf-8"?>
40
+ <root>
41
+ ${Object.entries(strings).map(([key, value]) => ` <data name="${escapeXml(key)}" xml:space="preserve">
42
+ <value>${escapeXml(value)}</value>
43
+ </data>`)
44
+ .join('\n')}
45
+ </root>`;
46
+ return {
47
+ content: content,
48
+ changes: strings
49
+ };
50
+ }
51
+ }
52
+ exports.ResxFormatter = ResxFormatter;
53
+ //# sourceMappingURL=ResxFormatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResxFormatter.js","sourceRoot":"","sources":["../../src/Formatters/ResxFormatter.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAIlB,aAAa;AAEb;;;;GAIG;AACH,MAAa,aAAa;IAEtB,iBAAiB;IAEA,OAAO,CAAS;IAEjC,aAAa;IAEb,eAAe;IAEf;;;;OAIG;IACH,YAAmB,OAA4B;QAC3C,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,aAAa;IAEb;;;;;;OAMG;IACI,MAAM,CAAC,OAA+B;QACzC,MAAM,SAAS,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK;aAC7C,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;aACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;aACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;aACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;aACvB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAE7B,MAAM,OAAO,GAAG;;EAEtB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,mBAAmB,SAAS,CAAC,GAAG,CAAC;iBAChE,SAAS,CAAC,KAAK,CAAC;YACrB,CAAC;aACR,IAAI,CAAC,IAAI,CAAC;QACP,CAAC;QAED,OAAO;YACH,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,OAAO;SACnB,CAAC;IACN,CAAC;CAEJ;AAlDD,sCAkDC"}
package/Index.d.ts ADDED
@@ -0,0 +1,57 @@
1
+ export type { IFormatter, IFormatterResult } from './Formatters/Interfaces/IFormatter.js';
2
+ export { Formatters } from './Formatters/Formatters.js';
3
+ export { JsonFormatter } from './Formatters/JsonFormatter.js';
4
+ export { ResxFormatter } from './Formatters/ResxFormatter.js';
5
+ export { BaseDetector } from './Detectors/Abstracts/BaseDetector.js';
6
+ export type { IDetector } from './Detectors/Interfaces/IDetector.js';
7
+ export { AngularHTMLDetector } from './Detectors/AngularHTMLDetector.js';
8
+ export { JSXDetector } from './Detectors/JSXDetector.js';
9
+ export { JavaScriptDetector } from './Detectors/JavaScriptDetector.js';
10
+ export { TSXDetector } from './Detectors/TSXDetector.js';
11
+ export { TypeScriptDetector } from './Detectors/TypeScriptDetector.js';
12
+ export { VueDetector } from './Detectors/VueDetector.js';
13
+ export type { IFrameworkPreset } from './Presets/Interfaces/IFrameworkPreset.js';
14
+ export { AngularPreset } from './Presets/AngularPreset.js';
15
+ export { LitPreset } from './Presets/LitPreset.js';
16
+ export { ReactPreset } from './Presets/ReactPreset.js';
17
+ export { StencilPreset } from './Presets/StencilPreset.js';
18
+ export { VuePreset } from './Presets/VuePreset.js';
19
+ export { Presets } from './Presets/Presets.js';
20
+ export type { ILocalizationProcessorEventMap, ILocalizationProcessorResult, IProcessOptions } from './Services/LocalizationProcessor.js';
21
+ export { LocalizationProcessor } from './Services/LocalizationProcessor.js';
22
+ export { ResourceFactory } from './Resources/ResourceFactory.js';
23
+ export { ResourceMode } from './Resources/ResourceMode.js';
24
+ export { ResourceScanner } from './Resources/Scanners/ResourceScanner.js';
25
+ export type { IResourceSorterOptions } from './Resources/Sorting/ResourceSorter.js';
26
+ export { ResourceSorter } from './Resources/Sorting/ResourceSorter.js';
27
+ export { ResourceTransformer } from './Resources/Transformers/ResourceTransformer.js';
28
+ export type { IResourceTransformerResult } from './Resources/Transformers/Interfaces/IResourceTransformerResult.js';
29
+ export type { IResourceSerializer } from './Resources/Transformers/Serializers/Interfaces/IResourceSerializer.js';
30
+ export { JsonResourceSerializer } from './Resources/Transformers/Serializers/JsonResourceSerializer.js';
31
+ export { ResxResourceSerializer } from './Resources/Transformers/Serializers/ResxResourceSerializer.js';
32
+ export { TypescriptResourceSerializer } from './Resources/Transformers/Serializers/TypescriptResourceSerializer.js';
33
+ export type { IResourceTransformerAdapter } from './Resources/Transformers/Adapters/Interfaces/IResourceTransformerAdapter.js';
34
+ export { JsonResourceTransformerAdapter } from './Resources/Transformers/Adapters/JsonResourceTransformerAdapter.js';
35
+ export { ResxResourceTransformerAdapter } from './Resources/Transformers/Adapters/ResxResourceTransformerAdapter.js';
36
+ export { ResxResourceInfo } from './Resources/Models/ResxResourceInfo.js';
37
+ export { JsonResourceInfo } from './Resources/Models/JsonResourceInfo.js';
38
+ export { TypeScriptResourceInfo } from './Resources/Models/TypeScriptResourceInfo.js';
39
+ export type { IJsonResourceInfo } from './Resources/Models/Interfaces/IJsonResourceInfo.js';
40
+ export type { ITypeScriptResourceInfo } from './Resources/Models/Interfaces/ITypeScriptResourceInfo.js';
41
+ export type { IResourceInfo, ResourceContentFn } from './Resources/Models/Interfaces/IResourceInfo.js';
42
+ export type { IResxResourceInfo } from './Resources/Models/Interfaces/IResxResourceInfo.js';
43
+ export type { IResourceModel } from './Resources/Models/Interfaces/IResourceModel.js';
44
+ export { ResourceType } from './Resources/Models/Interfaces/ResourceType.js';
45
+ export { ResxScannerAdapter } from './Resources/Scanners/Adapter/ResxScannerAdapter.js';
46
+ export { JsonScannerAdapter } from './Resources/Scanners/Adapter/JsonScannerAdapter.js';
47
+ export type { IScannerAdapter } from './Resources/Scanners/Adapter/Interfaces/IScannerAdapter.js';
48
+ export { ResourceAnalyzer } from './Resources/Analyzers/ResourceAnalyzer.js';
49
+ export type { IAnalyzerTask, IAnalyzerTaskExecutionContext, IAnalyzerTaskResult } from './Resources/Analyzers/Tasks/Interfaces/IAnalyzerTask.js';
50
+ export { DuplicateKeysTask, type IDuplicateKeysTaskData } from './Resources/Analyzers/Tasks/DuplicateKeysTask.js';
51
+ export { EmptyValuesTask, type IEmptyValuesTaskResultData } from './Resources/Analyzers/Tasks/EmptyValuesTask.js';
52
+ export { KeyConsistencyTask, type IKeyConsistencyTaskResultData } from './Resources/Analyzers/Tasks/KeyConsistencyTask.js';
53
+ export { MissingTranslationsTask, type IMissingTranslationsTaskResultData } from './Resources/Analyzers/Tasks/MissingTranslationsTask.js';
54
+ export { UnusedKeysTask, type IUnusedKeysTaskResultData } from './Resources/Analyzers/Tasks/UnusedKeysTask.js';
55
+ export { MultipleKeyUsageTask, type IMultipleKeyUsageTaskResultData } from './Resources/Analyzers/Tasks/MultipleKeyUsageTask.js';
56
+ export { ResourceProcessor } from './Resources/ResourceProcessor.js';
57
+ //# sourceMappingURL=Index.d.ts.map
package/Index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Index.d.ts","sourceRoot":"","sources":["../src/Index.ts"],"names":[],"mappings":"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"}