gt-react-native 10.19.16 → 10.19.18

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 (170) hide show
  1. package/dist/commonjs/NativeGtReactNative.js +9 -7
  2. package/dist/commonjs/NativeGtReactNative.js.map +1 -1
  3. package/dist/commonjs/_virtual/_rolldown/runtime.js +23 -0
  4. package/dist/commonjs/errors-dir/constants.js +5 -6
  5. package/dist/commonjs/errors-dir/constants.js.map +1 -1
  6. package/dist/commonjs/errors-dir/errors.js +12 -7
  7. package/dist/commonjs/errors-dir/errors.js.map +1 -1
  8. package/dist/commonjs/errors-dir/warnings.js +34 -15
  9. package/dist/commonjs/errors-dir/warnings.js.map +1 -1
  10. package/dist/commonjs/index.js +35 -194
  11. package/dist/commonjs/internal.js +3 -13
  12. package/dist/commonjs/plugin-dir/index.js +35 -51
  13. package/dist/commonjs/plugin-dir/index.js.map +1 -1
  14. package/dist/commonjs/plugin-dir/types.js +24 -9
  15. package/dist/commonjs/plugin-dir/types.js.map +1 -1
  16. package/dist/commonjs/plugin-dir/utils/resolveLocales.js +52 -69
  17. package/dist/commonjs/plugin-dir/utils/resolveLocales.js.map +1 -1
  18. package/dist/commonjs/plugin.js +5 -13
  19. package/dist/commonjs/provider/GTProvider.js +22 -20
  20. package/dist/commonjs/provider/GTProvider.js.map +1 -1
  21. package/dist/commonjs/provider/hooks/locale/useDetermineLocale.js +96 -160
  22. package/dist/commonjs/provider/hooks/locale/useDetermineLocale.js.map +1 -1
  23. package/dist/commonjs/provider/hooks/useRegionState.js +32 -44
  24. package/dist/commonjs/provider/hooks/useRegionState.js.map +1 -1
  25. package/dist/commonjs/tools/testLocalePolyfill.js +125 -146
  26. package/dist/commonjs/tools/testLocalePolyfill.js.map +1 -1
  27. package/dist/commonjs/types/config.js +1 -6
  28. package/dist/commonjs/utils/getNativeLocales.js +36 -54
  29. package/dist/commonjs/utils/getNativeLocales.js.map +1 -1
  30. package/dist/commonjs/utils/nativeStore.js +37 -42
  31. package/dist/commonjs/utils/nativeStore.js.map +1 -1
  32. package/dist/commonjs/utils/utils.js +10 -14
  33. package/dist/commonjs/utils/utils.js.map +1 -1
  34. package/dist/module/NativeGtReactNative.d.ts.map +1 -0
  35. package/dist/module/NativeGtReactNative.js +5 -3
  36. package/dist/module/NativeGtReactNative.js.map +1 -1
  37. package/dist/module/errors-dir/constants.d.ts.map +1 -0
  38. package/dist/module/errors-dir/constants.js +4 -2
  39. package/dist/module/errors-dir/constants.js.map +1 -1
  40. package/dist/module/errors-dir/errors.d.ts.map +1 -0
  41. package/dist/module/errors-dir/errors.js +11 -3
  42. package/dist/module/errors-dir/errors.js.map +1 -1
  43. package/dist/{typescript/commonjs/src → module}/errors-dir/warnings.d.ts +1 -1
  44. package/dist/module/errors-dir/warnings.d.ts.map +1 -0
  45. package/dist/module/errors-dir/warnings.js +31 -11
  46. package/dist/module/errors-dir/warnings.js.map +1 -1
  47. package/dist/module/index.d.ts.map +1 -0
  48. package/dist/module/index.js +2 -5
  49. package/dist/module/internal.d.ts.map +1 -0
  50. package/dist/module/internal.js +2 -4
  51. package/dist/module/plugin-dir/index.d.ts.map +1 -0
  52. package/dist/module/plugin-dir/index.js +28 -45
  53. package/dist/module/plugin-dir/index.js.map +1 -1
  54. package/dist/module/plugin-dir/types.d.ts.map +1 -0
  55. package/dist/module/plugin-dir/types.js +22 -5
  56. package/dist/module/plugin-dir/types.js.map +1 -1
  57. package/dist/module/plugin-dir/utils/resolveLocales.d.ts.map +1 -0
  58. package/dist/module/plugin-dir/utils/resolveLocales.js +46 -62
  59. package/dist/module/plugin-dir/utils/resolveLocales.js.map +1 -1
  60. package/dist/module/plugin.d.ts.map +1 -0
  61. package/dist/module/plugin.js +2 -4
  62. package/dist/module/provider/GTProvider.d.ts.map +1 -0
  63. package/dist/module/provider/GTProvider.js +15 -14
  64. package/dist/module/provider/GTProvider.js.map +1 -1
  65. package/dist/module/provider/hooks/locale/useDetermineLocale.d.ts.map +1 -0
  66. package/dist/module/provider/hooks/locale/useDetermineLocale.js +91 -153
  67. package/dist/module/provider/hooks/locale/useDetermineLocale.js.map +1 -1
  68. package/dist/module/provider/hooks/useRegionState.d.ts.map +1 -0
  69. package/dist/module/provider/hooks/useRegionState.js +29 -39
  70. package/dist/module/provider/hooks/useRegionState.js.map +1 -1
  71. package/dist/module/tools/testLocalePolyfill.d.ts.map +1 -0
  72. package/dist/module/tools/testLocalePolyfill.js +124 -143
  73. package/dist/module/tools/testLocalePolyfill.js.map +1 -1
  74. package/dist/module/types/config.d.ts.map +1 -0
  75. package/dist/module/types/config.js +0 -3
  76. package/dist/module/utils/getNativeLocales.d.ts.map +1 -0
  77. package/dist/module/utils/getNativeLocales.js +35 -51
  78. package/dist/module/utils/getNativeLocales.js.map +1 -1
  79. package/dist/module/utils/nativeStore.d.ts.map +1 -0
  80. package/dist/module/utils/nativeStore.js +35 -38
  81. package/dist/module/utils/nativeStore.js.map +1 -1
  82. package/dist/module/utils/utils.d.ts.map +1 -0
  83. package/dist/module/utils/utils.js +10 -11
  84. package/dist/module/utils/utils.js.map +1 -1
  85. package/package.json +15 -37
  86. package/src/errors-dir/errors.ts +8 -1
  87. package/src/errors-dir/warnings.ts +30 -9
  88. package/dist/commonjs/index.js.map +0 -1
  89. package/dist/commonjs/internal.js.map +0 -1
  90. package/dist/commonjs/package.json +0 -1
  91. package/dist/commonjs/plugin.js.map +0 -1
  92. package/dist/commonjs/types/config.js.map +0 -1
  93. package/dist/module/index.js.map +0 -1
  94. package/dist/module/internal.js.map +0 -1
  95. package/dist/module/package.json +0 -1
  96. package/dist/module/plugin.js.map +0 -1
  97. package/dist/module/types/config.js.map +0 -1
  98. package/dist/typescript/commonjs/package.json +0 -1
  99. package/dist/typescript/commonjs/src/NativeGtReactNative.d.ts.map +0 -1
  100. package/dist/typescript/commonjs/src/errors-dir/constants.d.ts.map +0 -1
  101. package/dist/typescript/commonjs/src/errors-dir/errors.d.ts.map +0 -1
  102. package/dist/typescript/commonjs/src/errors-dir/warnings.d.ts.map +0 -1
  103. package/dist/typescript/commonjs/src/index.d.ts.map +0 -1
  104. package/dist/typescript/commonjs/src/internal.d.ts.map +0 -1
  105. package/dist/typescript/commonjs/src/plugin-dir/index.d.ts.map +0 -1
  106. package/dist/typescript/commonjs/src/plugin-dir/types.d.ts.map +0 -1
  107. package/dist/typescript/commonjs/src/plugin-dir/utils/resolveLocales.d.ts.map +0 -1
  108. package/dist/typescript/commonjs/src/plugin.d.ts.map +0 -1
  109. package/dist/typescript/commonjs/src/provider/GTProvider.d.ts.map +0 -1
  110. package/dist/typescript/commonjs/src/provider/hooks/locale/useDetermineLocale.d.ts.map +0 -1
  111. package/dist/typescript/commonjs/src/provider/hooks/useRegionState.d.ts.map +0 -1
  112. package/dist/typescript/commonjs/src/tools/testLocalePolyfill.d.ts.map +0 -1
  113. package/dist/typescript/commonjs/src/types/config.d.ts.map +0 -1
  114. package/dist/typescript/commonjs/src/utils/getNativeLocales.d.ts.map +0 -1
  115. package/dist/typescript/commonjs/src/utils/nativeStore.d.ts.map +0 -1
  116. package/dist/typescript/commonjs/src/utils/utils.d.ts.map +0 -1
  117. package/dist/typescript/module/package.json +0 -1
  118. package/dist/typescript/module/src/NativeGtReactNative.d.ts +0 -10
  119. package/dist/typescript/module/src/NativeGtReactNative.d.ts.map +0 -1
  120. package/dist/typescript/module/src/errors-dir/constants.d.ts +0 -2
  121. package/dist/typescript/module/src/errors-dir/constants.d.ts.map +0 -1
  122. package/dist/typescript/module/src/errors-dir/errors.d.ts +0 -2
  123. package/dist/typescript/module/src/errors-dir/errors.d.ts.map +0 -1
  124. package/dist/typescript/module/src/errors-dir/warnings.d.ts +0 -5
  125. package/dist/typescript/module/src/errors-dir/warnings.d.ts.map +0 -1
  126. package/dist/typescript/module/src/index.d.ts +0 -5
  127. package/dist/typescript/module/src/index.d.ts.map +0 -1
  128. package/dist/typescript/module/src/internal.d.ts +0 -2
  129. package/dist/typescript/module/src/internal.d.ts.map +0 -1
  130. package/dist/typescript/module/src/plugin-dir/index.d.ts +0 -6
  131. package/dist/typescript/module/src/plugin-dir/index.d.ts.map +0 -1
  132. package/dist/typescript/module/src/plugin-dir/types.d.ts +0 -13
  133. package/dist/typescript/module/src/plugin-dir/types.d.ts.map +0 -1
  134. package/dist/typescript/module/src/plugin-dir/utils/resolveLocales.d.ts +0 -13
  135. package/dist/typescript/module/src/plugin-dir/utils/resolveLocales.d.ts.map +0 -1
  136. package/dist/typescript/module/src/plugin.d.ts +0 -2
  137. package/dist/typescript/module/src/plugin.d.ts.map +0 -1
  138. package/dist/typescript/module/src/provider/GTProvider.d.ts +0 -4
  139. package/dist/typescript/module/src/provider/GTProvider.d.ts.map +0 -1
  140. package/dist/typescript/module/src/provider/hooks/locale/useDetermineLocale.d.ts +0 -4
  141. package/dist/typescript/module/src/provider/hooks/locale/useDetermineLocale.d.ts.map +0 -1
  142. package/dist/typescript/module/src/provider/hooks/useRegionState.d.ts +0 -3
  143. package/dist/typescript/module/src/provider/hooks/useRegionState.d.ts.map +0 -1
  144. package/dist/typescript/module/src/tools/testLocalePolyfill.d.ts +0 -8
  145. package/dist/typescript/module/src/tools/testLocalePolyfill.d.ts.map +0 -1
  146. package/dist/typescript/module/src/types/config.d.ts +0 -30
  147. package/dist/typescript/module/src/types/config.d.ts.map +0 -1
  148. package/dist/typescript/module/src/utils/getNativeLocales.d.ts +0 -10
  149. package/dist/typescript/module/src/utils/getNativeLocales.d.ts.map +0 -1
  150. package/dist/typescript/module/src/utils/nativeStore.d.ts +0 -16
  151. package/dist/typescript/module/src/utils/nativeStore.d.ts.map +0 -1
  152. package/dist/typescript/module/src/utils/utils.d.ts +0 -3
  153. package/dist/typescript/module/src/utils/utils.d.ts.map +0 -1
  154. /package/dist/{typescript/commonjs/src → module}/NativeGtReactNative.d.ts +0 -0
  155. /package/dist/{typescript/commonjs/src → module}/errors-dir/constants.d.ts +0 -0
  156. /package/dist/{typescript/commonjs/src → module}/errors-dir/errors.d.ts +0 -0
  157. /package/dist/{typescript/commonjs/src → module}/index.d.ts +0 -0
  158. /package/dist/{typescript/commonjs/src → module}/internal.d.ts +0 -0
  159. /package/dist/{typescript/commonjs/src → module}/plugin-dir/index.d.ts +0 -0
  160. /package/dist/{typescript/commonjs/src → module}/plugin-dir/types.d.ts +0 -0
  161. /package/dist/{typescript/commonjs/src → module}/plugin-dir/utils/resolveLocales.d.ts +0 -0
  162. /package/dist/{typescript/commonjs/src → module}/plugin.d.ts +0 -0
  163. /package/dist/{typescript/commonjs/src → module}/provider/GTProvider.d.ts +0 -0
  164. /package/dist/{typescript/commonjs/src → module}/provider/hooks/locale/useDetermineLocale.d.ts +0 -0
  165. /package/dist/{typescript/commonjs/src → module}/provider/hooks/useRegionState.d.ts +0 -0
  166. /package/dist/{typescript/commonjs/src → module}/tools/testLocalePolyfill.d.ts +0 -0
  167. /package/dist/{typescript/commonjs/src → module}/types/config.d.ts +0 -0
  168. /package/dist/{typescript/commonjs/src → module}/utils/getNativeLocales.d.ts +0 -0
  169. /package/dist/{typescript/commonjs/src → module}/utils/nativeStore.d.ts +0 -0
  170. /package/dist/{typescript/commonjs/src → module}/utils/utils.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_NativeGtReactNative","_interopRequireDefault","_warnings","e","__esModule","default","nativeStoreGet","key","Platform","OS","localStorage","console","warn","ssrUnsupportedWarning","getItem","GtReactNative","nativeStoreSet","value","setItem"],"sourceRoot":"../../../src","sources":["utils/nativeStore.ts"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAA+D,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASG,cAAcA,CAACC,GAAW,EAAiB;EACzD,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzB,IAAI,OAAOC,YAAY,KAAK,WAAW,EAAE;MACvC;MACAC,OAAO,CAACC,IAAI,CAACC,+BAAqB,CAAC;MACnC,OAAO,IAAI;IACb;IACA,OAAOH,YAAY,CAACI,OAAO,CAACP,GAAG,CAAC;EAClC;EACA,OAAOQ,4BAAa,CAACT,cAAc,CAACC,GAAG,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASS,cAAcA,CAACT,GAAW,EAAEU,KAAa,EAAQ;EAC/D,IAAIT,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzB,IAAI,OAAOC,YAAY,KAAK,WAAW,EAAE;MACvC;MACAC,OAAO,CAACC,IAAI,CAACC,+BAAqB,CAAC;MACnC;IACF;IACAH,YAAY,CAACQ,OAAO,CAACX,GAAG,EAAEU,KAAK,CAAC;IAChC;EACF;EACAF,4BAAa,CAACC,cAAc,CAACT,GAAG,EAAEU,KAAK,CAAC;AAC1C","ignoreList":[]}
1
+ {"version":3,"file":"nativeStore.js","names":["Platform","ssrUnsupportedWarning","GtReactNative"],"sources":["../../../src/utils/nativeStore.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport GtReactNative from '../NativeGtReactNative';\nimport { ssrUnsupportedWarning } from '../errors-dir/warnings';\n\n/**\n * Native store interface, used to replace cookie behavior from gt-react\n */\n\n/**\n * Get a value from the native store\n * @param key - The key to get the value for\n * @returns The value for the key\n */\nexport function nativeStoreGet(key: string): string | null {\n if (Platform.OS === 'web') {\n if (typeof localStorage === 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(ssrUnsupportedWarning);\n return null;\n }\n return localStorage.getItem(key);\n }\n return GtReactNative.nativeStoreGet(key);\n}\n\n/**\n * Set a value in the native store\n * @param key - The key to set the value for\n * @param value - The value to set\n */\nexport function nativeStoreSet(key: string, value: string): void {\n if (Platform.OS === 'web') {\n if (typeof localStorage === 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(ssrUnsupportedWarning);\n return;\n }\n localStorage.setItem(key, value);\n return;\n }\n GtReactNative.nativeStoreSet(key, value);\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,SAAgB,eAAe,KAA4B;AACzD,KAAIA,aAAAA,SAAS,OAAO,OAAO;AACzB,MAAI,OAAO,iBAAiB,aAAa;AAEvC,WAAQ,KAAKC,4BAAAA,sBAAsB;AACnC,UAAO;;AAET,SAAO,aAAa,QAAQ,IAAI;;AAElC,QAAOC,4BAAAA,QAAc,eAAe,IAAI;;;;;;;AAQ1C,SAAgB,eAAe,KAAa,OAAqB;AAC/D,KAAIF,aAAAA,SAAS,OAAO,OAAO;AACzB,MAAI,OAAO,iBAAiB,aAAa;AAEvC,WAAQ,KAAKC,4BAAAA,sBAAsB;AACnC;;AAEF,eAAa,QAAQ,KAAK,MAAM;AAChC;;AAEF,6BAAA,QAAc,eAAe,KAAK,MAAM"}
@@ -1,17 +1,13 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.readAuthFromEnv = readAuthFromEnv;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/utils/utils.ts
7
3
  function readAuthFromEnv(params) {
8
- const {
9
- projectId,
10
- devApiKey
11
- } = params;
12
- return {
13
- projectId: projectId || '',
14
- devApiKey: devApiKey
15
- };
4
+ const { projectId, devApiKey } = params;
5
+ return {
6
+ projectId: projectId || "",
7
+ devApiKey
8
+ };
16
9
  }
10
+ //#endregion
11
+ exports.readAuthFromEnv = readAuthFromEnv;
12
+
17
13
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["readAuthFromEnv","params","projectId","devApiKey"],"sourceRoot":"../../../src","sources":["utils/utils.ts"],"mappings":";;;;;;AAKO,SAASA,eAAeA,CAACC,MAAyB,EAAqB;EAC5E,MAAM;IAAEC,SAAS;IAAEC;EAAU,CAAC,GAAGF,MAAM;EACvC,OAAO;IACLC,SAAS,EAAEA,SAAS,IAAI,EAAE;IAC1BC,SAAS,EAAEA;EACb,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../../src/utils/utils.ts"],"sourcesContent":["import type {\n AuthFromEnvParams,\n AuthFromEnvReturn,\n} from '@generaltranslation/react-core/types';\n\nexport function readAuthFromEnv(params: AuthFromEnvParams): AuthFromEnvReturn {\n const { projectId, devApiKey } = params;\n return {\n projectId: projectId || '',\n devApiKey: devApiKey,\n };\n}\n"],"mappings":";;AAKA,SAAgB,gBAAgB,QAA8C;CAC5E,MAAM,EAAE,WAAW,cAAc;AACjC,QAAO;EACL,WAAW,aAAa;EACb;EACZ"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeGtReactNative.d.ts","sourceRoot":"","sources":["../../src/NativeGtReactNative.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvC,gBAAgB,IAAI,MAAM,EAAE,CAAC;IAC7B,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC3C,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAClD;;AAED,wBAAuE"}
@@ -1,5 +1,7 @@
1
- "use strict";
1
+ import { TurboModuleRegistry } from "react-native";
2
+ //#region src/NativeGtReactNative.ts
3
+ var NativeGtReactNative_default = TurboModuleRegistry.getEnforcing("GtReactNative");
4
+ //#endregion
5
+ export { NativeGtReactNative_default as default };
2
6
 
3
- import { TurboModuleRegistry } from 'react-native';
4
- export default TurboModuleRegistry.getEnforcing('GtReactNative');
5
7
  //# sourceMappingURL=NativeGtReactNative.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeGtReactNative.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAQlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,eAAe,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"NativeGtReactNative.js","names":[],"sources":["../../src/NativeGtReactNative.ts"],"sourcesContent":["import type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\nexport interface Spec extends TurboModule {\n multiply(a: number, b: number): number;\n getNativeLocales(): string[];\n nativeStoreGet(key: string): string | null;\n nativeStoreSet(key: string, value: string): void;\n}\n\nexport default TurboModuleRegistry.getEnforcing<Spec>('GtReactNative');\n"],"mappings":";;AASA,IAAA,8BAAe,oBAAoB,aAAmB,gBAAgB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/errors-dir/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,oBAAoB,CAAC"}
@@ -1,4 +1,6 @@
1
- "use strict";
1
+ //#region src/errors-dir/constants.ts
2
+ const PACKAGE_NAME = "gt-react-native";
3
+ //#endregion
4
+ export { PACKAGE_NAME };
2
5
 
3
- export const PACKAGE_NAME = 'gt-react-native';
4
6
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PACKAGE_NAME"],"sourceRoot":"../../../src","sources":["errors-dir/constants.ts"],"mappings":";;AAAA,OAAO,MAAMA,YAAY,GAAG,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"constants.js","names":[],"sources":["../../../src/errors-dir/constants.ts"],"sourcesContent":["export const PACKAGE_NAME = 'gt-react-native';\n"],"mappings":";AAAA,MAAa,eAAe"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors-dir/errors.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,WAMxD,CAAC"}
@@ -1,5 +1,13 @@
1
- "use strict";
2
-
3
1
  import { PACKAGE_NAME } from "./constants.js";
4
- export const failedToReadConfigFileError = filePath => `${PACKAGE_NAME} Error: Failed to read GT Config at ${filePath}.`;
2
+ import { createDiagnosticMessage } from "generaltranslation/internal";
3
+ //#region src/errors-dir/errors.ts
4
+ const failedToReadConfigFileError = (filePath) => createDiagnosticMessage({
5
+ source: PACKAGE_NAME,
6
+ severity: "Error",
7
+ whatHappened: `GT Config at ${filePath} could not be read`,
8
+ fix: "Check that the file exists and contains valid JSON"
9
+ });
10
+ //#endregion
11
+ export { failedToReadConfigFileError };
12
+
5
13
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PACKAGE_NAME","failedToReadConfigFileError","filePath"],"sourceRoot":"../../../src","sources":["errors-dir/errors.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,gBAAa;AAC1C,OAAO,MAAMC,2BAA2B,GAAIC,QAAgB,IAC1D,GAAGF,YAAY,uCAAuCE,QAAQ,GAAG","ignoreList":[]}
1
+ {"version":3,"file":"errors.js","names":[],"sources":["../../../src/errors-dir/errors.ts"],"sourcesContent":["import { createDiagnosticMessage } from 'generaltranslation/internal';\nimport { PACKAGE_NAME } from './constants';\n\nexport const failedToReadConfigFileError = (filePath: string) =>\n createDiagnosticMessage({\n source: PACKAGE_NAME,\n severity: 'Error',\n whatHappened: `GT Config at ${filePath} could not be read`,\n fix: 'Check that the file exists and contains valid JSON',\n });\n"],"mappings":";;;AAGA,MAAa,+BAA+B,aAC1C,wBAAwB;CACtB,QAAQ;CACR,UAAU;CACV,cAAc,gBAAgB,SAAS;CACvC,KAAK;CACN,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export declare const resolveLocalesFailedWarning: string;
2
2
  export declare const couldNotLocateConfigWarning: (filePath: string) => string;
3
3
  export declare const invalidLocalesWarning: (invalidLocales: string[]) => string;
4
- export declare const ssrUnsupportedWarning = "gt-react-native: Server-side environments are not explicitly supported. Some features may not work as expected.";
4
+ export declare const ssrUnsupportedWarning: string;
5
5
  //# sourceMappingURL=warnings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warnings.d.ts","sourceRoot":"","sources":["../../../src/errors-dir/warnings.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,2BAA2B,QAMtC,CAAC;AAEH,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,WAMxD,CAAC;AAEL,eAAO,MAAM,qBAAqB,GAAI,gBAAgB,MAAM,EAAE,WAO1D,CAAC;AAEL,eAAO,MAAM,qBAAqB,QAKhC,CAAC"}
@@ -1,13 +1,33 @@
1
- "use strict";
2
-
3
- import { libraryDefaultLocale } from 'generaltranslation/internal';
4
1
  import { PACKAGE_NAME } from "./constants.js";
5
- export const resolveLocalesFailedWarning = `${PACKAGE_NAME}: Failed to resolve locales for polyfill. Falling back to ${libraryDefaultLocale}.
6
- Specify a list of locales for the gt-react-native babel plugin by:
7
- (1) Providing a list of locales
8
- (2) Providing your GT Config to the plugin
9
- (3) Providing the path to your GT Config file.`;
10
- export const couldNotLocateConfigWarning = filePath => `${PACKAGE_NAME}: Could not locate GT Config at ${filePath}.`;
11
- export const invalidLocalesWarning = invalidLocales => `${PACKAGE_NAME}: Invalid locales found in GT Config: ${invalidLocales.join(', ')}.`;
12
- export const ssrUnsupportedWarning = `${PACKAGE_NAME}: Server-side environments are not explicitly supported. Some features may not work as expected.`;
2
+ import { createDiagnosticMessage, libraryDefaultLocale } from "generaltranslation/internal";
3
+ //#region src/errors-dir/warnings.ts
4
+ const resolveLocalesFailedWarning = createDiagnosticMessage({
5
+ source: PACKAGE_NAME,
6
+ severity: "Warning",
7
+ whatHappened: "Locales for the polyfill could not be resolved",
8
+ fix: "Provide locales directly, pass your GT Config to the plugin, or provide the path to your GT Config file",
9
+ wayOut: `The library will fall back to ${libraryDefaultLocale}`
10
+ });
11
+ const couldNotLocateConfigWarning = (filePath) => createDiagnosticMessage({
12
+ source: PACKAGE_NAME,
13
+ severity: "Warning",
14
+ whatHappened: `GT Config could not be found at ${filePath}`,
15
+ fix: "Check the path or pass locales directly to the plugin"
16
+ });
17
+ const invalidLocalesWarning = (invalidLocales) => createDiagnosticMessage({
18
+ source: PACKAGE_NAME,
19
+ severity: "Warning",
20
+ whatHappened: "GT Config contains invalid locales",
21
+ fix: "Use valid BCP 47 locale codes or add custom mappings",
22
+ details: invalidLocales
23
+ });
24
+ const ssrUnsupportedWarning = createDiagnosticMessage({
25
+ source: PACKAGE_NAME,
26
+ severity: "Warning",
27
+ whatHappened: "Server-side environments are not explicitly supported",
28
+ wayOut: "Some features may not work as expected"
29
+ });
30
+ //#endregion
31
+ export { couldNotLocateConfigWarning, invalidLocalesWarning, resolveLocalesFailedWarning, ssrUnsupportedWarning };
32
+
13
33
  //# sourceMappingURL=warnings.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["libraryDefaultLocale","PACKAGE_NAME","resolveLocalesFailedWarning","couldNotLocateConfigWarning","filePath","invalidLocalesWarning","invalidLocales","join","ssrUnsupportedWarning"],"sourceRoot":"../../../src","sources":["errors-dir/warnings.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,6BAA6B;AAClE,SAASC,YAAY,QAAQ,gBAAa;AAE1C,OAAO,MAAMC,2BAA2B,GAAG,GAAGD,YAAY,6DAA6DD,oBAAoB;AAC3I;AACA;AACA;AACA,+CAA+C;AAE/C,OAAO,MAAMG,2BAA2B,GAAIC,QAAgB,IAC1D,GAAGH,YAAY,mCAAmCG,QAAQ,GAAG;AAE/D,OAAO,MAAMC,qBAAqB,GAAIC,cAAwB,IAC5D,GAAGL,YAAY,yCAAyCK,cAAc,CAACC,IAAI,CAAC,IAAI,CAAC,GAAG;AAEtF,OAAO,MAAMC,qBAAqB,GAAG,GAAGP,YAAY,kGAAkG","ignoreList":[]}
1
+ {"version":3,"file":"warnings.js","names":[],"sources":["../../../src/errors-dir/warnings.ts"],"sourcesContent":["import {\n createDiagnosticMessage,\n libraryDefaultLocale,\n} from 'generaltranslation/internal';\nimport { PACKAGE_NAME } from './constants';\n\nexport const resolveLocalesFailedWarning = createDiagnosticMessage({\n source: PACKAGE_NAME,\n severity: 'Warning',\n whatHappened: 'Locales for the polyfill could not be resolved',\n fix: 'Provide locales directly, pass your GT Config to the plugin, or provide the path to your GT Config file',\n wayOut: `The library will fall back to ${libraryDefaultLocale}`,\n});\n\nexport const couldNotLocateConfigWarning = (filePath: string) =>\n createDiagnosticMessage({\n source: PACKAGE_NAME,\n severity: 'Warning',\n whatHappened: `GT Config could not be found at ${filePath}`,\n fix: 'Check the path or pass locales directly to the plugin',\n });\n\nexport const invalidLocalesWarning = (invalidLocales: string[]) =>\n createDiagnosticMessage({\n source: PACKAGE_NAME,\n severity: 'Warning',\n whatHappened: 'GT Config contains invalid locales',\n fix: 'Use valid BCP 47 locale codes or add custom mappings',\n details: invalidLocales,\n });\n\nexport const ssrUnsupportedWarning = createDiagnosticMessage({\n source: PACKAGE_NAME,\n severity: 'Warning',\n whatHappened: 'Server-side environments are not explicitly supported',\n wayOut: 'Some features may not work as expected',\n});\n"],"mappings":";;;AAMA,MAAa,8BAA8B,wBAAwB;CACjE,QAAQ;CACR,UAAU;CACV,cAAc;CACd,KAAK;CACL,QAAQ,iCAAiC;CAC1C,CAAC;AAEF,MAAa,+BAA+B,aAC1C,wBAAwB;CACtB,QAAQ;CACR,UAAU;CACV,cAAc,mCAAmC;CACjD,KAAK;CACN,CAAC;AAEJ,MAAa,yBAAyB,mBACpC,wBAAwB;CACtB,QAAQ;CACR,UAAU;CACV,cAAc;CACd,KAAK;CACL,SAAS;CACV,CAAC;AAEJ,MAAa,wBAAwB,wBAAwB;CAC3D,QAAQ;CACR,UAAU;CACV,cAAc;CACd,QAAQ;CACT,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EACL,CAAC,EACD,KAAK,EACL,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,GAAG,EACH,SAAS,EACT,aAAa,EACb,UAAU,EACV,SAAS,EACT,aAAa,EACb,UAAU,EACV,UAAU,EACX,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EACV,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,MAAM,EACN,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,CAAC,EACD,UAAU,EACV,MAAM,EACN,MAAM,EACN,KAAK,EACL,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,GAAG,EACH,SAAS,EACT,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,aAAa,EACb,UAAU,EACV,UAAU,GACX,CAAC"}
@@ -1,6 +1,3 @@
1
- "use strict";
2
-
3
1
  import { GTProvider } from "./provider/GTProvider.js";
4
- import { T, useGT, useTranslations, useDefaultLocale, useLocale, useRegion, Var, Num, Currency, DateTime, Static, Plural, Branch, useVersionId, useLocales, useLocaleSelector, useSetLocale, useGTClass, useLocaleProperties, useRegionSelector, useLocaleDirection, useMessages, msg, decodeMsg, decodeOptions, gtFallback, mFallback, declareStatic, declareVar, decodeVars } from '@generaltranslation/react-core';
5
- export { Static, Var, Num, Currency, DateTime, T, GTProvider, Plural, Branch, useGT, useTranslations, useDefaultLocale, useLocale, useLocales, useSetLocale, useLocaleSelector, useRegion, useRegionSelector, useGTClass, useLocaleProperties, useLocaleDirection, useVersionId, msg, decodeMsg, decodeOptions, useMessages, gtFallback, mFallback, declareStatic, declareVar, decodeVars };
6
- //# sourceMappingURL=index.js.map
2
+ import { Branch, Currency, DateTime, Num, Plural, Static, T, Var, declareStatic, declareVar, decodeMsg, decodeOptions, decodeVars, gtFallback, mFallback, msg, useDefaultLocale, useGT, useGTClass, useLocale, useLocaleDirection, useLocaleProperties, useLocaleSelector, useLocales, useMessages, useRegion, useRegionSelector, useSetLocale, useTranslations, useVersionId } from "@generaltranslation/react-core";
3
+ export { Branch, Currency, DateTime, GTProvider, Num, Plural, Static, T, Var, declareStatic, declareVar, decodeMsg, decodeOptions, decodeVars, gtFallback, mFallback, msg, useDefaultLocale, useGT, useGTClass, useLocale, useLocaleDirection, useLocaleProperties, useLocaleSelector, useLocales, useMessages, useRegion, useRegionSelector, useSetLocale, useTranslations, useVersionId };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -1,4 +1,2 @@
1
- "use strict";
2
-
3
- export { testLocalePolyfill } from "./tools/testLocalePolyfill.js";
4
- //# sourceMappingURL=internal.js.map
1
+ import { testLocalePolyfill } from "./tools/testLocalePolyfill.js";
2
+ export { testLocalePolyfill };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugin-dir/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAA+B,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAG1E,MAAM,CAAC,OAAO,WACZ,KAAK,EAAE;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAAE,EAC9B,EACE,OAAO,EACP,MAAM,EACN,cAAc,EACd,kBAAkE,EAClE,gBAAqB,GACtB,EAAE,aAAa,GACf,SAAS,CAuDX"}
@@ -1,49 +1,32 @@
1
- "use strict";
2
-
3
- import * as path from 'path';
4
1
  import { LOCALE_POLYFILLS, POLYFILLS } from "./types.js";
5
2
  import { resolveLocales } from "./utils/resolveLocales.js";
6
- export default function (babel, {
7
- locales,
8
- config,
9
- configFilePath,
10
- entryPointFilePath = path.resolve(process.cwd(), 'src', 'App.tsx'),
11
- excludePolyfills = []
12
- }) {
13
- const {
14
- types: t
15
- } = babel;
16
- return {
17
- name: 'gt-react-native/plugin',
18
- visitor: {
19
- Program(programPath, state) {
20
- const currentFilePath = path.resolve(state.filename || state.file.opts.filename || '');
21
-
22
- // Only apply polyfills to files that import gt-react-native or generaltranslation
23
- if (currentFilePath !== entryPointFilePath) {
24
- return;
25
- }
26
- const resolvedLocales = resolveLocales({
27
- locales,
28
- config,
29
- configFilePath
30
- });
31
-
32
- // TODO: smart imports based on if the polyfill is required, do this as a wrapper around AppRegistry.registerComponent()
33
- const imports = [...POLYFILLS.filter(polyfill => !excludePolyfills.includes(polyfill)), ...resolvedLocales.flatMap(locale => LOCALE_POLYFILLS.map(localeData => `${localeData}/${locale}`))];
34
- const existingImports = new Set();
35
- programPath.node.body.forEach(node => {
36
- if (t.isImportDeclaration(node) && typeof node.source.value === 'string' && imports.includes(node.source.value)) {
37
- existingImports.add(node.source.value);
38
- }
39
- });
40
- const importsToAdd = imports.filter(imp => !existingImports.has(imp));
41
- if (importsToAdd.length > 0) {
42
- const newImports = importsToAdd.map(importPath => t.importDeclaration([], t.stringLiteral(importPath)));
43
- programPath.node.body.unshift(...newImports);
44
- }
45
- }
46
- }
47
- };
3
+ import * as path$1 from "path";
4
+ //#region src/plugin-dir/index.ts
5
+ function plugin_dir_default(babel, { locales, config, configFilePath, entryPointFilePath = path$1.resolve(process.cwd(), "src", "App.tsx"), excludePolyfills = [] }) {
6
+ const { types: t } = babel;
7
+ return {
8
+ name: "gt-react-native/plugin",
9
+ visitor: { Program(programPath, state) {
10
+ if (path$1.resolve(state.filename || state.file.opts.filename || "") !== entryPointFilePath) return;
11
+ const resolvedLocales = resolveLocales({
12
+ locales,
13
+ config,
14
+ configFilePath
15
+ });
16
+ const imports = [...POLYFILLS.filter((polyfill) => !excludePolyfills.includes(polyfill)), ...resolvedLocales.flatMap((locale) => LOCALE_POLYFILLS.map((localeData) => `${localeData}/${locale}`))];
17
+ const existingImports = /* @__PURE__ */ new Set();
18
+ programPath.node.body.forEach((node) => {
19
+ if (t.isImportDeclaration(node) && typeof node.source.value === "string" && imports.includes(node.source.value)) existingImports.add(node.source.value);
20
+ });
21
+ const importsToAdd = imports.filter((imp) => !existingImports.has(imp));
22
+ if (importsToAdd.length > 0) {
23
+ const newImports = importsToAdd.map((importPath) => t.importDeclaration([], t.stringLiteral(importPath)));
24
+ programPath.node.body.unshift(...newImports);
25
+ }
26
+ } }
27
+ };
48
28
  }
29
+ //#endregion
30
+ export { plugin_dir_default as default };
31
+
49
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["path","LOCALE_POLYFILLS","POLYFILLS","resolveLocales","babel","locales","config","configFilePath","entryPointFilePath","resolve","process","cwd","excludePolyfills","types","t","name","visitor","Program","programPath","state","currentFilePath","filename","file","opts","resolvedLocales","imports","filter","polyfill","includes","flatMap","locale","map","localeData","existingImports","Set","node","body","forEach","isImportDeclaration","source","value","add","importsToAdd","imp","has","length","newImports","importPath","importDeclaration","stringLiteral","unshift"],"sourceRoot":"../../../src","sources":["plugin-dir/index.ts"],"mappings":";;AAAA,OAAO,KAAKA,IAAI,MAAM,MAAM;AAE5B,SAASC,gBAAgB,EAAEC,SAAS,QAA4B,YAAS;AACzE,SAASC,cAAc,QAAQ,2BAAwB;AAEvD,eAAe,UACbC,KAA8B,EAC9B;EACEC,OAAO;EACPC,MAAM;EACNC,cAAc;EACdC,kBAAkB,GAAGR,IAAI,CAACS,OAAO,CAACC,OAAO,CAACC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC;EAClEC,gBAAgB,GAAG;AACN,CAAC,EACL;EACX,MAAM;IAAEC,KAAK,EAAEC;EAAE,CAAC,GAAGV,KAAK;EAE1B,OAAO;IACLW,IAAI,EAAE,wBAAwB;IAC9BC,OAAO,EAAE;MACPC,OAAOA,CAACC,WAAW,EAAEC,KAAK,EAAE;QAC1B,MAAMC,eAAe,GAAGpB,IAAI,CAACS,OAAO,CAClCU,KAAK,CAACE,QAAQ,IAAIF,KAAK,CAACG,IAAI,CAACC,IAAI,CAACF,QAAQ,IAAI,EAChD,CAAC;;QAED;QACA,IAAID,eAAe,KAAKZ,kBAAkB,EAAE;UAC1C;QACF;QAEA,MAAMgB,eAAe,GAAGrB,cAAc,CAAC;UACrCE,OAAO;UACPC,MAAM;UACNC;QACF,CAAC,CAAC;;QAEF;QACA,MAAMkB,OAAO,GAAG,CACd,GAAGvB,SAAS,CAACwB,MAAM,CAChBC,QAAQ,IAAK,CAACf,gBAAgB,CAACgB,QAAQ,CAACD,QAAQ,CACnD,CAAC,EACD,GAAGH,eAAe,CAACK,OAAO,CAAEC,MAAM,IAChC7B,gBAAgB,CAAC8B,GAAG,CAAEC,UAAU,IAAK,GAAGA,UAAU,IAAIF,MAAM,EAAE,CAChE,CAAC,CACF;QAED,MAAMG,eAAe,GAAG,IAAIC,GAAG,CAAS,CAAC;QACzChB,WAAW,CAACiB,IAAI,CAACC,IAAI,CAACC,OAAO,CAAEF,IAAI,IAAK;UACtC,IACErB,CAAC,CAACwB,mBAAmB,CAACH,IAAI,CAAC,IAC3B,OAAOA,IAAI,CAACI,MAAM,CAACC,KAAK,KAAK,QAAQ,IACrCf,OAAO,CAACG,QAAQ,CAACO,IAAI,CAACI,MAAM,CAACC,KAAK,CAAC,EACnC;YACAP,eAAe,CAACQ,GAAG,CAACN,IAAI,CAACI,MAAM,CAACC,KAAK,CAAC;UACxC;QACF,CAAC,CAAC;QAEF,MAAME,YAAY,GAAGjB,OAAO,CAACC,MAAM,CAAEiB,GAAG,IAAK,CAACV,eAAe,CAACW,GAAG,CAACD,GAAG,CAAC,CAAC;QAEvE,IAAID,YAAY,CAACG,MAAM,GAAG,CAAC,EAAE;UAC3B,MAAMC,UAAU,GAAGJ,YAAY,CAACX,GAAG,CAAEgB,UAAU,IAC7CjC,CAAC,CAACkC,iBAAiB,CAAC,EAAE,EAAElC,CAAC,CAACmC,aAAa,CAACF,UAAU,CAAC,CACrD,CAAC;UAED7B,WAAW,CAACiB,IAAI,CAACC,IAAI,CAACc,OAAO,CAAC,GAAGJ,UAAU,CAAC;QAC9C;MACF;IACF;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["path"],"sources":["../../../src/plugin-dir/index.ts"],"sourcesContent":["import * as path from 'path';\nimport type { PluginObj, types } from '@babel/core';\nimport { LOCALE_POLYFILLS, POLYFILLS, type PluginOptions } from './types';\nimport { resolveLocales } from './utils/resolveLocales';\n\nexport default function (\n babel: { types: typeof types },\n {\n locales,\n config,\n configFilePath,\n entryPointFilePath = path.resolve(process.cwd(), 'src', 'App.tsx'),\n excludePolyfills = [],\n }: PluginOptions\n): PluginObj {\n const { types: t } = babel;\n\n return {\n name: 'gt-react-native/plugin',\n visitor: {\n Program(programPath, state) {\n const currentFilePath = path.resolve(\n state.filename || state.file.opts.filename || ''\n );\n\n // Only apply polyfills to files that import gt-react-native or generaltranslation\n if (currentFilePath !== entryPointFilePath) {\n return;\n }\n\n const resolvedLocales = resolveLocales({\n locales,\n config,\n configFilePath,\n });\n\n // TODO: smart imports based on if the polyfill is required, do this as a wrapper around AppRegistry.registerComponent()\n const imports = [\n ...POLYFILLS.filter(\n (polyfill) => !excludePolyfills.includes(polyfill)\n ),\n ...resolvedLocales.flatMap((locale) =>\n LOCALE_POLYFILLS.map((localeData) => `${localeData}/${locale}`)\n ),\n ];\n\n const existingImports = new Set<string>();\n programPath.node.body.forEach((node) => {\n if (\n t.isImportDeclaration(node) &&\n typeof node.source.value === 'string' &&\n imports.includes(node.source.value)\n ) {\n existingImports.add(node.source.value);\n }\n });\n\n const importsToAdd = imports.filter((imp) => !existingImports.has(imp));\n\n if (importsToAdd.length > 0) {\n const newImports = importsToAdd.map((importPath) =>\n t.importDeclaration([], t.stringLiteral(importPath))\n );\n\n programPath.node.body.unshift(...newImports);\n }\n },\n },\n };\n}\n"],"mappings":";;;;AAKA,SAAA,mBACE,OACA,EACE,SACA,QACA,gBACA,qBAAqBA,OAAK,QAAQ,QAAQ,KAAK,EAAE,OAAO,UAAU,EAClE,mBAAmB,EAAE,IAEZ;CACX,MAAM,EAAE,OAAO,MAAM;AAErB,QAAO;EACL,MAAM;EACN,SAAS,EACP,QAAQ,aAAa,OAAO;AAM1B,OALwBA,OAAK,QAC3B,MAAM,YAAY,MAAM,KAAK,KAAK,YAAY,GAI7B,KAAK,mBACtB;GAGF,MAAM,kBAAkB,eAAe;IACrC;IACA;IACA;IACD,CAAC;GAGF,MAAM,UAAU,CACd,GAAG,UAAU,QACV,aAAa,CAAC,iBAAiB,SAAS,SAAS,CACnD,EACD,GAAG,gBAAgB,SAAS,WAC1B,iBAAiB,KAAK,eAAe,GAAG,WAAW,GAAG,SAAS,CAChE,CACF;GAED,MAAM,kCAAkB,IAAI,KAAa;AACzC,eAAY,KAAK,KAAK,SAAS,SAAS;AACtC,QACE,EAAE,oBAAoB,KAAK,IAC3B,OAAO,KAAK,OAAO,UAAU,YAC7B,QAAQ,SAAS,KAAK,OAAO,MAAM,CAEnC,iBAAgB,IAAI,KAAK,OAAO,MAAM;KAExC;GAEF,MAAM,eAAe,QAAQ,QAAQ,QAAQ,CAAC,gBAAgB,IAAI,IAAI,CAAC;AAEvE,OAAI,aAAa,SAAS,GAAG;IAC3B,MAAM,aAAa,aAAa,KAAK,eACnC,EAAE,kBAAkB,EAAE,EAAE,EAAE,cAAc,WAAW,CAAC,CACrD;AAED,gBAAY,KAAK,KAAK,QAAQ,GAAG,WAAW;;KAGjD;EACF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugin-dir/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,mYAUZ,CAAC;AAEX,eAAO,MAAM,gBAAgB,kRAOnB,CAAC;AAEX,MAAM,WAAW,aAAa;IAE5B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB,MAAM,CAAC,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,MAAM,CAC5D,MAAM,EACN,OAAO,CACR,CAAC;IAEF,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,gBAAgB,CAAC,EAAE,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;CACjD"}
@@ -1,7 +1,24 @@
1
- "use strict";
1
+ //#region src/plugin-dir/types.ts
2
+ const POLYFILLS = [
3
+ "@formatjs/intl-getcanonicallocales/polyfill",
4
+ "@formatjs/intl-locale/polyfill",
5
+ "@formatjs/intl-displaynames/polyfill",
6
+ "@formatjs/intl-listformat/polyfill",
7
+ "@formatjs/intl-pluralrules/polyfill-force",
8
+ "@formatjs/intl-numberformat/polyfill",
9
+ "@formatjs/intl-relativetimeformat/polyfill",
10
+ "@formatjs/intl-datetimeformat/polyfill",
11
+ "@formatjs/intl-datetimeformat/add-all-tz"
12
+ ];
13
+ const LOCALE_POLYFILLS = [
14
+ `@formatjs/intl-displaynames/locale-data`,
15
+ `@formatjs/intl-listformat/locale-data`,
16
+ `@formatjs/intl-pluralrules/locale-data`,
17
+ `@formatjs/intl-numberformat/locale-data`,
18
+ `@formatjs/intl-relativetimeformat/locale-data`,
19
+ `@formatjs/intl-datetimeformat/locale-data`
20
+ ];
21
+ //#endregion
22
+ export { LOCALE_POLYFILLS, POLYFILLS };
2
23
 
3
- export const POLYFILLS = ['@formatjs/intl-getcanonicallocales/polyfill', '@formatjs/intl-locale/polyfill', '@formatjs/intl-displaynames/polyfill', '@formatjs/intl-listformat/polyfill', '@formatjs/intl-pluralrules/polyfill-force',
4
- // https://github.com/formatjs/formatjs/issues/4463
5
- '@formatjs/intl-numberformat/polyfill', '@formatjs/intl-relativetimeformat/polyfill', '@formatjs/intl-datetimeformat/polyfill', '@formatjs/intl-datetimeformat/add-all-tz'];
6
- export const LOCALE_POLYFILLS = [`@formatjs/intl-displaynames/locale-data`, `@formatjs/intl-listformat/locale-data`, `@formatjs/intl-pluralrules/locale-data`, `@formatjs/intl-numberformat/locale-data`, `@formatjs/intl-relativetimeformat/locale-data`, `@formatjs/intl-datetimeformat/locale-data`];
7
24
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["POLYFILLS","LOCALE_POLYFILLS"],"sourceRoot":"../../../src","sources":["plugin-dir/types.ts"],"mappings":";;AAAA,OAAO,MAAMA,SAAS,GAAG,CACvB,6CAA6C,EAC7C,gCAAgC,EAChC,sCAAsC,EACtC,oCAAoC,EACpC,2CAA2C;AAAE;AAC7C,sCAAsC,EACtC,4CAA4C,EAC5C,wCAAwC,EACxC,0CAA0C,CAClC;AAEV,OAAO,MAAMC,gBAAgB,GAAG,CAC9B,yCAAyC,EACzC,uCAAuC,EACvC,wCAAwC,EACxC,yCAAyC,EACzC,+CAA+C,EAC/C,2CAA2C,CACnC","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/plugin-dir/types.ts"],"sourcesContent":["export const POLYFILLS = [\n '@formatjs/intl-getcanonicallocales/polyfill',\n '@formatjs/intl-locale/polyfill',\n '@formatjs/intl-displaynames/polyfill',\n '@formatjs/intl-listformat/polyfill',\n '@formatjs/intl-pluralrules/polyfill-force', // https://github.com/formatjs/formatjs/issues/4463\n '@formatjs/intl-numberformat/polyfill',\n '@formatjs/intl-relativetimeformat/polyfill',\n '@formatjs/intl-datetimeformat/polyfill',\n '@formatjs/intl-datetimeformat/add-all-tz',\n] as const;\n\nexport const LOCALE_POLYFILLS = [\n `@formatjs/intl-displaynames/locale-data`,\n `@formatjs/intl-listformat/locale-data`,\n `@formatjs/intl-pluralrules/locale-data`,\n `@formatjs/intl-numberformat/locale-data`,\n `@formatjs/intl-relativetimeformat/locale-data`,\n `@formatjs/intl-datetimeformat/locale-data`,\n] as const;\n\nexport interface PluginOptions {\n /* List of locales to polyfill */\n locales?: string[];\n /* Gt config object */\n config?: { defaultLocale: string; locales: string[] } & Record<\n string,\n unknown\n >;\n /* Path to the gt config file */\n configFilePath?: string;\n /* Resolved from package.json */\n entryPointFilePath?: string;\n /* Polyfills to exclude */\n excludePolyfills?: (typeof POLYFILLS)[number][];\n}\n"],"mappings":";AAAA,MAAa,YAAY;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,mBAAmB;CAC9B;CACA;CACA;CACA;CACA;CACA;CACD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveLocales.d.ts","sourceRoot":"","sources":["../../../../src/plugin-dir/utils/resolveLocales.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,MAAM,EACN,cAAc,GACf,EAAE;IACD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,MAAM,CAC5D,MAAM,EACN,OAAO,CACR,CAAC;IACF,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,EAAE,CA0BX"}
@@ -1,70 +1,54 @@
1
- "use strict";
2
-
3
- import fs from 'fs';
4
1
  import { couldNotLocateConfigWarning, invalidLocalesWarning, resolveLocalesFailedWarning } from "../../errors-dir/warnings.js";
5
- import { libraryDefaultLocale } from 'generaltranslation/internal';
6
2
  import { failedToReadConfigFileError } from "../../errors-dir/errors.js";
7
- import { getSupportedLocale } from '@generaltranslation/supported-locales';
8
- import path from 'path';
9
- const DEFAULT_CONFIG_FILE_PATHS = [path.join(process.cwd(), 'gt.config.json'), path.join(process.cwd(), '.locadex', 'gt.config.json')];
10
-
3
+ import { libraryDefaultLocale } from "generaltranslation/internal";
4
+ import path from "path";
5
+ import fs from "fs";
6
+ import { getSupportedLocale } from "@generaltranslation/supported-locales";
7
+ //#region src/plugin-dir/utils/resolveLocales.ts
8
+ const DEFAULT_CONFIG_FILE_PATHS = [path.join(process.cwd(), "gt.config.json"), path.join(process.cwd(), ".locadex", "gt.config.json")];
11
9
  /**
12
- * Given a list of locales or a config object or a path to a config file, return a list of locales to polyfill.
13
- * Preference order: locales > config > configFilePaths > library default locale
14
- */
15
- export function resolveLocales({
16
- locales,
17
- config,
18
- configFilePath
19
- }) {
20
- let result = [];
21
-
22
- // Resolve locales from the given options
23
- if (locales) {
24
- result = Array.from(new Set(locales));
25
- } else if (config) {
26
- result = Array.from(new Set([config.defaultLocale, ...config.locales]));
27
- } else {
28
- result = resolveLocalesFromConfig(configFilePath);
29
- }
30
-
31
- // Validate the result
32
- const invalidLocales = result.filter(locale => !getSupportedLocale(locale));
33
- if (invalidLocales.length) {
34
- console.warn(invalidLocalesWarning(invalidLocales));
35
- result = result.filter(locale => !invalidLocales.includes(locale));
36
- }
37
-
38
- // Fallback to default locale if no locales were found
39
- if (result.length === 0) {
40
- console.warn(resolveLocalesFailedWarning);
41
- result = [libraryDefaultLocale];
42
- }
43
- return result;
10
+ * Given a list of locales or a config object or a path to a config file, return a list of locales to polyfill.
11
+ * Preference order: locales > config > configFilePaths > library default locale
12
+ */
13
+ function resolveLocales({ locales, config, configFilePath }) {
14
+ let result = [];
15
+ if (locales) result = Array.from(new Set(locales));
16
+ else if (config) result = Array.from(new Set([config.defaultLocale, ...config.locales]));
17
+ else result = resolveLocalesFromConfig(configFilePath);
18
+ const invalidLocales = result.filter((locale) => !getSupportedLocale(locale));
19
+ if (invalidLocales.length) {
20
+ console.warn(invalidLocalesWarning(invalidLocales));
21
+ result = result.filter((locale) => !invalidLocales.includes(locale));
22
+ }
23
+ if (result.length === 0) {
24
+ console.warn(resolveLocalesFailedWarning);
25
+ result = [libraryDefaultLocale];
26
+ }
27
+ return result;
44
28
  }
45
-
46
29
  /**
47
- * Resolve locales from a config file
48
- * @param configFilePath - The path to the config file
49
- * @returns A list of locales
50
- */
30
+ * Resolve locales from a config file
31
+ * @param configFilePath - The path to the config file
32
+ * @returns A list of locales
33
+ */
51
34
  function resolveLocalesFromConfig(configFilePath) {
52
- const configFilePaths = [...(configFilePath ? [configFilePath] : []), ...DEFAULT_CONFIG_FILE_PATHS];
53
- let result = [];
54
- for (const filePath of configFilePaths) {
55
- try {
56
- if (!fs.existsSync(filePath)) {
57
- console.warn(couldNotLocateConfigWarning(filePath));
58
- continue;
59
- }
60
- const resolvedConfig = JSON.parse(fs.readFileSync(filePath, 'utf8'));
61
- result = Array.from(new Set([...(resolvedConfig.defaultLocale ? [resolvedConfig.defaultLocale] : []), ...(resolvedConfig.locales || [])]));
62
- break;
63
- } catch (error) {
64
- console.error(failedToReadConfigFileError(filePath), error);
65
- break;
66
- }
67
- }
68
- return result;
35
+ const configFilePaths = [...configFilePath ? [configFilePath] : [], ...DEFAULT_CONFIG_FILE_PATHS];
36
+ let result = [];
37
+ for (const filePath of configFilePaths) try {
38
+ if (!fs.existsSync(filePath)) {
39
+ console.warn(couldNotLocateConfigWarning(filePath));
40
+ continue;
41
+ }
42
+ const resolvedConfig = JSON.parse(fs.readFileSync(filePath, "utf8"));
43
+ result = Array.from(new Set([...resolvedConfig.defaultLocale ? [resolvedConfig.defaultLocale] : [], ...resolvedConfig.locales || []]));
44
+ break;
45
+ } catch (error) {
46
+ console.error(failedToReadConfigFileError(filePath), error);
47
+ break;
48
+ }
49
+ return result;
69
50
  }
51
+ //#endregion
52
+ export { resolveLocales };
53
+
70
54
  //# sourceMappingURL=resolveLocales.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["fs","couldNotLocateConfigWarning","invalidLocalesWarning","resolveLocalesFailedWarning","libraryDefaultLocale","failedToReadConfigFileError","getSupportedLocale","path","DEFAULT_CONFIG_FILE_PATHS","join","process","cwd","resolveLocales","locales","config","configFilePath","result","Array","from","Set","defaultLocale","resolveLocalesFromConfig","invalidLocales","filter","locale","length","console","warn","includes","configFilePaths","filePath","existsSync","resolvedConfig","JSON","parse","readFileSync","error"],"sourceRoot":"../../../../src","sources":["plugin-dir/utils/resolveLocales.ts"],"mappings":";;AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,SACEC,2BAA2B,EAC3BC,qBAAqB,EACrBC,2BAA2B,QACtB,8BAA2B;AAClC,SAASC,oBAAoB,QAAQ,6BAA6B;AAClE,SAASC,2BAA2B,QAAQ,4BAAyB;AACrE,SAASC,kBAAkB,QAAQ,uCAAuC;AAC1E,OAAOC,IAAI,MAAM,MAAM;AAEvB,MAAMC,yBAAyB,GAAG,CAChCD,IAAI,CAACE,IAAI,CAACC,OAAO,CAACC,GAAG,CAAC,CAAC,EAAE,gBAAgB,CAAC,EAC1CJ,IAAI,CAACE,IAAI,CAACC,OAAO,CAACC,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,gBAAgB,CAAC,CACvD;;AAED;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAC;EAC7BC,OAAO;EACPC,MAAM;EACNC;AAQF,CAAC,EAAY;EACX,IAAIC,MAAgB,GAAG,EAAE;;EAEzB;EACA,IAAIH,OAAO,EAAE;IACXG,MAAM,GAAGC,KAAK,CAACC,IAAI,CAAC,IAAIC,GAAG,CAACN,OAAO,CAAC,CAAC;EACvC,CAAC,MAAM,IAAIC,MAAM,EAAE;IACjBE,MAAM,GAAGC,KAAK,CAACC,IAAI,CAAC,IAAIC,GAAG,CAAC,CAACL,MAAM,CAACM,aAAa,EAAE,GAAGN,MAAM,CAACD,OAAO,CAAC,CAAC,CAAC;EACzE,CAAC,MAAM;IACLG,MAAM,GAAGK,wBAAwB,CAACN,cAAc,CAAC;EACnD;;EAEA;EACA,MAAMO,cAAc,GAAGN,MAAM,CAACO,MAAM,CAAEC,MAAM,IAAK,CAAClB,kBAAkB,CAACkB,MAAM,CAAC,CAAC;EAC7E,IAAIF,cAAc,CAACG,MAAM,EAAE;IACzBC,OAAO,CAACC,IAAI,CAACzB,qBAAqB,CAACoB,cAAc,CAAC,CAAC;IACnDN,MAAM,GAAGA,MAAM,CAACO,MAAM,CAAEC,MAAM,IAAK,CAACF,cAAc,CAACM,QAAQ,CAACJ,MAAM,CAAC,CAAC;EACtE;;EAEA;EACA,IAAIR,MAAM,CAACS,MAAM,KAAK,CAAC,EAAE;IACvBC,OAAO,CAACC,IAAI,CAACxB,2BAA2B,CAAC;IACzCa,MAAM,GAAG,CAACZ,oBAAoB,CAAC;EACjC;EAEA,OAAOY,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASK,wBAAwBA,CAACN,cAAkC,EAAE;EACpE,MAAMc,eAAe,GAAG,CACtB,IAAId,cAAc,GAAG,CAACA,cAAc,CAAC,GAAG,EAAE,CAAC,EAC3C,GAAGP,yBAAyB,CAC7B;EACD,IAAIQ,MAAgB,GAAG,EAAE;EAEzB,KAAK,MAAMc,QAAQ,IAAID,eAAe,EAAE;IACtC,IAAI;MACF,IAAI,CAAC7B,EAAE,CAAC+B,UAAU,CAACD,QAAQ,CAAC,EAAE;QAC5BJ,OAAO,CAACC,IAAI,CAAC1B,2BAA2B,CAAC6B,QAAQ,CAAC,CAAC;QACnD;MACF;MAEA,MAAME,cAAc,GAAGC,IAAI,CAACC,KAAK,CAAClC,EAAE,CAACmC,YAAY,CAACL,QAAQ,EAAE,MAAM,CAAC,CAGlE;MAEDd,MAAM,GAAGC,KAAK,CAACC,IAAI,CACjB,IAAIC,GAAG,CAAC,CACN,IAAIa,cAAc,CAACZ,aAAa,GAC5B,CAACY,cAAc,CAACZ,aAAa,CAAC,GAC9B,EAAE,CAAC,EACP,IAAIY,cAAc,CAACnB,OAAO,IAAI,EAAE,CAAC,CAClC,CACH,CAAC;MACD;IACF,CAAC,CAAC,OAAOuB,KAAK,EAAE;MACdV,OAAO,CAACU,KAAK,CAAC/B,2BAA2B,CAACyB,QAAQ,CAAC,EAAEM,KAAK,CAAC;MAC3D;IACF;EACF;EACA,OAAOpB,MAAM;AACf","ignoreList":[]}
1
+ {"version":3,"file":"resolveLocales.js","names":[],"sources":["../../../../src/plugin-dir/utils/resolveLocales.ts"],"sourcesContent":["import fs from 'fs';\nimport {\n couldNotLocateConfigWarning,\n invalidLocalesWarning,\n resolveLocalesFailedWarning,\n} from '../../errors-dir/warnings';\nimport { libraryDefaultLocale } from 'generaltranslation/internal';\nimport { failedToReadConfigFileError } from '../../errors-dir/errors';\nimport { getSupportedLocale } from '@generaltranslation/supported-locales';\nimport path from 'path';\n\nconst DEFAULT_CONFIG_FILE_PATHS = [\n path.join(process.cwd(), 'gt.config.json'),\n path.join(process.cwd(), '.locadex', 'gt.config.json'),\n];\n\n/**\n * Given a list of locales or a config object or a path to a config file, return a list of locales to polyfill.\n * Preference order: locales > config > configFilePaths > library default locale\n */\nexport function resolveLocales({\n locales,\n config,\n configFilePath,\n}: {\n locales?: string[];\n config?: { defaultLocale: string; locales: string[] } & Record<\n string,\n unknown\n >;\n configFilePath?: string;\n}): string[] {\n let result: string[] = [];\n\n // Resolve locales from the given options\n if (locales) {\n result = Array.from(new Set(locales));\n } else if (config) {\n result = Array.from(new Set([config.defaultLocale, ...config.locales]));\n } else {\n result = resolveLocalesFromConfig(configFilePath);\n }\n\n // Validate the result\n const invalidLocales = result.filter((locale) => !getSupportedLocale(locale));\n if (invalidLocales.length) {\n console.warn(invalidLocalesWarning(invalidLocales));\n result = result.filter((locale) => !invalidLocales.includes(locale));\n }\n\n // Fallback to default locale if no locales were found\n if (result.length === 0) {\n console.warn(resolveLocalesFailedWarning);\n result = [libraryDefaultLocale];\n }\n\n return result;\n}\n\n/**\n * Resolve locales from a config file\n * @param configFilePath - The path to the config file\n * @returns A list of locales\n */\nfunction resolveLocalesFromConfig(configFilePath: string | undefined) {\n const configFilePaths = [\n ...(configFilePath ? [configFilePath] : []),\n ...DEFAULT_CONFIG_FILE_PATHS,\n ];\n let result: string[] = [];\n\n for (const filePath of configFilePaths) {\n try {\n if (!fs.existsSync(filePath)) {\n console.warn(couldNotLocateConfigWarning(filePath));\n continue;\n }\n\n const resolvedConfig = JSON.parse(fs.readFileSync(filePath, 'utf8')) as {\n defaultLocale?: string;\n locales?: string[];\n };\n\n result = Array.from(\n new Set([\n ...(resolvedConfig.defaultLocale\n ? [resolvedConfig.defaultLocale]\n : []),\n ...(resolvedConfig.locales || []),\n ])\n );\n break;\n } catch (error) {\n console.error(failedToReadConfigFileError(filePath), error);\n break;\n }\n }\n return result;\n}\n"],"mappings":";;;;;;;AAWA,MAAM,4BAA4B,CAChC,KAAK,KAAK,QAAQ,KAAK,EAAE,iBAAiB,EAC1C,KAAK,KAAK,QAAQ,KAAK,EAAE,YAAY,iBAAiB,CACvD;;;;;AAMD,SAAgB,eAAe,EAC7B,SACA,QACA,kBAQW;CACX,IAAI,SAAmB,EAAE;AAGzB,KAAI,QACF,UAAS,MAAM,KAAK,IAAI,IAAI,QAAQ,CAAC;UAC5B,OACT,UAAS,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,eAAe,GAAG,OAAO,QAAQ,CAAC,CAAC;KAEvE,UAAS,yBAAyB,eAAe;CAInD,MAAM,iBAAiB,OAAO,QAAQ,WAAW,CAAC,mBAAmB,OAAO,CAAC;AAC7E,KAAI,eAAe,QAAQ;AACzB,UAAQ,KAAK,sBAAsB,eAAe,CAAC;AACnD,WAAS,OAAO,QAAQ,WAAW,CAAC,eAAe,SAAS,OAAO,CAAC;;AAItE,KAAI,OAAO,WAAW,GAAG;AACvB,UAAQ,KAAK,4BAA4B;AACzC,WAAS,CAAC,qBAAqB;;AAGjC,QAAO;;;;;;;AAQT,SAAS,yBAAyB,gBAAoC;CACpE,MAAM,kBAAkB,CACtB,GAAI,iBAAiB,CAAC,eAAe,GAAG,EAAE,EAC1C,GAAG,0BACJ;CACD,IAAI,SAAmB,EAAE;AAEzB,MAAK,MAAM,YAAY,gBACrB,KAAI;AACF,MAAI,CAAC,GAAG,WAAW,SAAS,EAAE;AAC5B,WAAQ,KAAK,4BAA4B,SAAS,CAAC;AACnD;;EAGF,MAAM,iBAAiB,KAAK,MAAM,GAAG,aAAa,UAAU,OAAO,CAAC;AAKpE,WAAS,MAAM,KACb,IAAI,IAAI,CACN,GAAI,eAAe,gBACf,CAAC,eAAe,cAAc,GAC9B,EAAE,EACN,GAAI,eAAe,WAAW,EAAE,CACjC,CAAC,CACH;AACD;UACO,OAAO;AACd,UAAQ,MAAM,4BAA4B,SAAS,EAAE,MAAM;AAC3D;;AAGJ,QAAO"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
@@ -1,4 +1,2 @@
1
- "use strict";
2
-
3
- export { default } from "./plugin-dir/index.js";
4
- //# sourceMappingURL=plugin.js.map
1
+ import plugin_dir_default from "./plugin-dir/index.js";
2
+ export { plugin_dir_default as default };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GTProvider.d.ts","sourceRoot":"","sources":["../../../src/provider/GTProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAKvD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAWpE;AAED,eAAe,UAAU,CAAC"}
@@ -1,19 +1,20 @@
1
- "use strict";
2
-
3
1
  import { useDetermineLocale } from "./hooks/locale/useDetermineLocale.js";
4
- import { GTProvider as _GTProvider } from '@generaltranslation/react-core';
5
2
  import { readAuthFromEnv } from "../utils/utils.js";
6
3
  import { useRegionState } from "./hooks/useRegionState.js";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- export function GTProvider(props) {
9
- return /*#__PURE__*/_jsx(_GTProvider, {
10
- ssr: false,
11
- environment: __DEV__ ? 'development' : 'production',
12
- ...props,
13
- readAuthFromEnv: readAuthFromEnv,
14
- useDetermineLocale: useDetermineLocale,
15
- useRegionState: useRegionState
16
- });
4
+ import { GTProvider as GTProvider$1 } from "@generaltranslation/react-core";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region src/provider/GTProvider.tsx
7
+ function GTProvider(props) {
8
+ return /* @__PURE__ */ jsx(GTProvider$1, {
9
+ ssr: false,
10
+ environment: __DEV__ ? "development" : "production",
11
+ ...props,
12
+ readAuthFromEnv,
13
+ useDetermineLocale,
14
+ useRegionState
15
+ });
17
16
  }
18
- export default GTProvider;
17
+ //#endregion
18
+ export { GTProvider, GTProvider as default };
19
+
19
20
  //# sourceMappingURL=GTProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useDetermineLocale","GTProvider","_GTProvider","readAuthFromEnv","useRegionState","jsx","_jsx","props","ssr","environment","__DEV__"],"sourceRoot":"../../../src","sources":["provider/GTProvider.tsx"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,sCAAmC;AAEtE,SAASC,UAAU,IAAIC,WAAW,QAAQ,gCAAgC;AAC1E,SAASC,eAAe,QAAQ,mBAAgB;AAChD,SAASC,cAAc,QAAQ,2BAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAExD,OAAO,SAASL,UAAUA,CAACM,KAAsB,EAAqB;EACpE,oBACED,IAAA,CAACJ,WAAW;IACVM,GAAG,EAAE,KAAM;IACXC,WAAW,EAAEC,OAAO,GAAG,aAAa,GAAG,YAAa;IAAA,GAChDH,KAAK;IACTJ,eAAe,EAAEA,eAAgB;IACjCH,kBAAkB,EAAEA,kBAAmB;IACvCI,cAAc,EAAEA;EAAe,CAChC,CAAC;AAEN;AAEA,eAAeH,UAAU","ignoreList":[]}
1
+ {"version":3,"file":"GTProvider.js","names":["_GTProvider"],"sources":["../../../src/provider/GTProvider.tsx"],"sourcesContent":["import { useDetermineLocale } from './hooks/locale/useDetermineLocale';\nimport type { GTProviderProps } from '../types/config';\nimport { GTProvider as _GTProvider } from '@generaltranslation/react-core';\nimport { readAuthFromEnv } from '../utils/utils';\nimport { useRegionState } from './hooks/useRegionState';\n\nexport function GTProvider(props: GTProviderProps): React.JSX.Element {\n return (\n <_GTProvider\n ssr={false}\n environment={__DEV__ ? 'development' : 'production'}\n {...props}\n readAuthFromEnv={readAuthFromEnv}\n useDetermineLocale={useDetermineLocale}\n useRegionState={useRegionState}\n />\n );\n}\n\nexport default GTProvider;\n"],"mappings":";;;;;;AAMA,SAAgB,WAAW,OAA2C;AACpE,QACE,oBAACA,cAAD;EACE,KAAK;EACL,aAAa,UAAU,gBAAgB;EACvC,GAAI;EACa;EACG;EACJ;EAChB,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDetermineLocale.d.ts","sourceRoot":"","sources":["../../../../../src/provider/hooks/locale/useDetermineLocale.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAM9C,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EAAE,OAAY,EACpB,aAAoC,EACpC,OAAY,EACZ,gBAA8C,EAC9C,GAAW,EAAE,eAAe;AAC5B,aAAa,EACb,UAAU,GACX,EAAE,wBAAwB,GAAG,wBAAwB,CAiErD"}