gt-react-native 0.0.1-alpha.9 → 0.0.2-alpha.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 (169) hide show
  1. package/README.md +34 -11
  2. package/lib/commonjs/NativeGtReactNative.js +9 -0
  3. package/lib/commonjs/NativeGtReactNative.js.map +1 -0
  4. package/lib/commonjs/errors-dir/constants.js +8 -0
  5. package/lib/commonjs/errors-dir/constants.js.map +1 -0
  6. package/lib/commonjs/errors-dir/errors.js +10 -0
  7. package/lib/commonjs/errors-dir/errors.js.map +1 -0
  8. package/lib/commonjs/errors-dir/warnings.js +18 -0
  9. package/lib/commonjs/errors-dir/warnings.js.map +1 -0
  10. package/lib/commonjs/index.js +158 -0
  11. package/lib/commonjs/index.js.map +1 -0
  12. package/lib/commonjs/internal.js +13 -0
  13. package/lib/commonjs/internal.js.map +1 -0
  14. package/lib/commonjs/package.json +1 -0
  15. package/lib/commonjs/plugin-dir/index.js +54 -0
  16. package/lib/commonjs/plugin-dir/index.js.map +1 -0
  17. package/lib/commonjs/plugin-dir/types.js +2 -0
  18. package/lib/commonjs/plugin-dir/types.js.map +1 -0
  19. package/lib/commonjs/plugin-dir/utils/resolveLocales.js +74 -0
  20. package/lib/commonjs/plugin-dir/utils/resolveLocales.js.map +1 -0
  21. package/lib/commonjs/plugin.js +14 -0
  22. package/lib/commonjs/plugin.js.map +1 -0
  23. package/lib/commonjs/provider/GTProvider.js +24 -0
  24. package/lib/commonjs/provider/GTProvider.js.map +1 -0
  25. package/lib/commonjs/provider/hooks/locale/useDetermineLocale.js +146 -0
  26. package/lib/commonjs/provider/hooks/locale/useDetermineLocale.js.map +1 -0
  27. package/lib/commonjs/provider/hooks/useRegionState.js +47 -0
  28. package/lib/commonjs/provider/hooks/useRegionState.js.map +1 -0
  29. package/lib/commonjs/tools/testLocalePolyfill.js +68 -0
  30. package/lib/commonjs/tools/testLocalePolyfill.js.map +1 -0
  31. package/lib/commonjs/types/config.js +6 -0
  32. package/lib/commonjs/types/config.js.map +1 -0
  33. package/lib/commonjs/utils/getNativeLocales.js +58 -0
  34. package/lib/commonjs/utils/getNativeLocales.js.map +1 -0
  35. package/lib/commonjs/utils/nativeStore.js +39 -0
  36. package/lib/commonjs/utils/nativeStore.js.map +1 -0
  37. package/lib/commonjs/utils/utils.js +17 -0
  38. package/lib/commonjs/utils/utils.js.map +1 -0
  39. package/lib/module/errors-dir/constants.js +1 -1
  40. package/lib/module/errors-dir/constants.js.map +1 -1
  41. package/lib/module/errors-dir/errors.js +5 -0
  42. package/lib/module/errors-dir/errors.js.map +1 -0
  43. package/lib/module/errors-dir/warnings.js +12 -0
  44. package/lib/module/errors-dir/warnings.js.map +1 -0
  45. package/lib/module/index.js +1 -2
  46. package/lib/module/index.js.map +1 -1
  47. package/lib/module/internal.js +4 -0
  48. package/lib/module/internal.js.map +1 -0
  49. package/lib/module/plugin-dir/index.js +49 -0
  50. package/lib/module/plugin-dir/index.js.map +1 -0
  51. package/lib/module/plugin-dir/types.js +2 -0
  52. package/lib/module/plugin-dir/types.js.map +1 -0
  53. package/lib/module/plugin-dir/utils/resolveLocales.js +69 -0
  54. package/lib/module/plugin-dir/utils/resolveLocales.js.map +1 -0
  55. package/lib/module/plugin.js +4 -0
  56. package/lib/module/plugin.js.map +1 -0
  57. package/lib/module/tools/testLocalePolyfill.js +64 -0
  58. package/lib/module/tools/testLocalePolyfill.js.map +1 -0
  59. package/lib/typescript/commonjs/package.json +1 -0
  60. package/lib/typescript/commonjs/src/NativeGtReactNative.d.ts.map +1 -0
  61. package/lib/typescript/commonjs/src/errors-dir/constants.d.ts +2 -0
  62. package/lib/typescript/commonjs/src/errors-dir/constants.d.ts.map +1 -0
  63. package/lib/typescript/commonjs/src/errors-dir/errors.d.ts +2 -0
  64. package/lib/typescript/commonjs/src/errors-dir/errors.d.ts.map +1 -0
  65. package/lib/typescript/commonjs/src/errors-dir/warnings.d.ts +4 -0
  66. package/lib/typescript/commonjs/src/errors-dir/warnings.d.ts.map +1 -0
  67. package/lib/typescript/{src → commonjs/src}/index.d.ts +1 -2
  68. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  69. package/lib/typescript/commonjs/src/internal.d.ts +2 -0
  70. package/lib/typescript/commonjs/src/internal.d.ts.map +1 -0
  71. package/lib/typescript/commonjs/src/plugin-dir/index.d.ts +6 -0
  72. package/lib/typescript/commonjs/src/plugin-dir/index.d.ts.map +1 -0
  73. package/lib/typescript/commonjs/src/plugin-dir/types.d.ts +10 -0
  74. package/lib/typescript/commonjs/src/plugin-dir/types.d.ts.map +1 -0
  75. package/lib/typescript/commonjs/src/plugin-dir/utils/resolveLocales.d.ts +13 -0
  76. package/lib/typescript/commonjs/src/plugin-dir/utils/resolveLocales.d.ts.map +1 -0
  77. package/lib/typescript/commonjs/src/plugin.d.ts +2 -0
  78. package/lib/typescript/commonjs/src/plugin.d.ts.map +1 -0
  79. package/lib/typescript/commonjs/src/provider/GTProvider.d.ts.map +1 -0
  80. package/lib/typescript/commonjs/src/provider/hooks/locale/useDetermineLocale.d.ts.map +1 -0
  81. package/lib/typescript/commonjs/src/provider/hooks/useRegionState.d.ts.map +1 -0
  82. package/lib/typescript/commonjs/src/tools/testLocalePolyfill.d.ts +12 -0
  83. package/lib/typescript/commonjs/src/tools/testLocalePolyfill.d.ts.map +1 -0
  84. package/lib/typescript/commonjs/src/types/config.d.ts.map +1 -0
  85. package/lib/typescript/commonjs/src/utils/getNativeLocales.d.ts.map +1 -0
  86. package/lib/typescript/commonjs/src/utils/nativeStore.d.ts.map +1 -0
  87. package/lib/typescript/commonjs/src/utils/utils.d.ts.map +1 -0
  88. package/lib/typescript/commonjs/vitest.config.d.ts +3 -0
  89. package/lib/typescript/commonjs/vitest.config.d.ts.map +1 -0
  90. package/lib/typescript/module/src/NativeGtReactNative.d.ts +10 -0
  91. package/lib/typescript/module/src/NativeGtReactNative.d.ts.map +1 -0
  92. package/lib/typescript/module/src/errors-dir/constants.d.ts +2 -0
  93. package/lib/typescript/module/src/errors-dir/constants.d.ts.map +1 -0
  94. package/lib/typescript/module/src/errors-dir/errors.d.ts +2 -0
  95. package/lib/typescript/module/src/errors-dir/errors.d.ts.map +1 -0
  96. package/lib/typescript/module/src/errors-dir/warnings.d.ts +4 -0
  97. package/lib/typescript/module/src/errors-dir/warnings.d.ts.map +1 -0
  98. package/lib/typescript/module/src/index.d.ts +6 -0
  99. package/lib/typescript/module/src/index.d.ts.map +1 -0
  100. package/lib/typescript/module/src/internal.d.ts +2 -0
  101. package/lib/typescript/module/src/internal.d.ts.map +1 -0
  102. package/lib/typescript/module/src/plugin-dir/index.d.ts +6 -0
  103. package/lib/typescript/module/src/plugin-dir/index.d.ts.map +1 -0
  104. package/lib/typescript/module/src/plugin-dir/types.d.ts +10 -0
  105. package/lib/typescript/module/src/plugin-dir/types.d.ts.map +1 -0
  106. package/lib/typescript/module/src/plugin-dir/utils/resolveLocales.d.ts +13 -0
  107. package/lib/typescript/module/src/plugin-dir/utils/resolveLocales.d.ts.map +1 -0
  108. package/lib/typescript/module/src/plugin.d.ts +2 -0
  109. package/lib/typescript/module/src/plugin.d.ts.map +1 -0
  110. package/lib/typescript/module/src/provider/GTProvider.d.ts +4 -0
  111. package/lib/typescript/module/src/provider/GTProvider.d.ts.map +1 -0
  112. package/lib/typescript/module/src/provider/hooks/locale/useDetermineLocale.d.ts +4 -0
  113. package/lib/typescript/module/src/provider/hooks/locale/useDetermineLocale.d.ts.map +1 -0
  114. package/lib/typescript/module/src/provider/hooks/useRegionState.d.ts +3 -0
  115. package/lib/typescript/module/src/provider/hooks/useRegionState.d.ts.map +1 -0
  116. package/lib/typescript/module/src/tools/testLocalePolyfill.d.ts +12 -0
  117. package/lib/typescript/module/src/tools/testLocalePolyfill.d.ts.map +1 -0
  118. package/lib/typescript/module/src/types/config.d.ts +30 -0
  119. package/lib/typescript/module/src/types/config.d.ts.map +1 -0
  120. package/lib/typescript/module/src/utils/getNativeLocales.d.ts +10 -0
  121. package/lib/typescript/module/src/utils/getNativeLocales.d.ts.map +1 -0
  122. package/lib/typescript/module/src/utils/nativeStore.d.ts +16 -0
  123. package/lib/typescript/module/src/utils/nativeStore.d.ts.map +1 -0
  124. package/lib/typescript/module/src/utils/utils.d.ts +3 -0
  125. package/lib/typescript/module/src/utils/utils.d.ts.map +1 -0
  126. package/lib/typescript/module/vitest.config.d.ts +3 -0
  127. package/lib/typescript/module/vitest.config.d.ts.map +1 -0
  128. package/package.json +48 -17
  129. package/src/errors-dir/constants.ts +1 -1
  130. package/src/errors-dir/errors.ts +3 -0
  131. package/src/errors-dir/warnings.ts +14 -0
  132. package/src/index.tsx +0 -2
  133. package/src/internal.ts +1 -0
  134. package/src/plugin-dir/index.ts +80 -0
  135. package/src/plugin-dir/types.ts +10 -0
  136. package/src/plugin-dir/utils/resolveLocales.ts +95 -0
  137. package/src/plugin.ts +1 -0
  138. package/src/tools/testLocalePolyfill.ts +82 -0
  139. package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeGtReactNativeSpec.java +0 -51
  140. package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -28
  141. package/android/app/build/generated/source/codegen/jni/GtReactNativeSpec-generated.cpp +0 -50
  142. package/android/app/build/generated/source/codegen/jni/GtReactNativeSpec.h +0 -31
  143. package/android/app/build/generated/source/codegen/jni/react/renderer/components/GtReactNativeSpec/GtReactNativeSpecJSI-generated.cpp +0 -51
  144. package/android/app/build/generated/source/codegen/jni/react/renderer/components/GtReactNativeSpec/GtReactNativeSpecJSI.h +0 -98
  145. package/lib/module/utils/polyfill.js +0 -39
  146. package/lib/module/utils/polyfill.js.map +0 -1
  147. package/lib/typescript/src/NativeGtReactNative.d.ts.map +0 -1
  148. package/lib/typescript/src/errors-dir/constants.d.ts +0 -2
  149. package/lib/typescript/src/errors-dir/constants.d.ts.map +0 -1
  150. package/lib/typescript/src/index.d.ts.map +0 -1
  151. package/lib/typescript/src/provider/GTProvider.d.ts.map +0 -1
  152. package/lib/typescript/src/provider/hooks/locale/useDetermineLocale.d.ts.map +0 -1
  153. package/lib/typescript/src/provider/hooks/useRegionState.d.ts.map +0 -1
  154. package/lib/typescript/src/types/config.d.ts.map +0 -1
  155. package/lib/typescript/src/utils/getNativeLocales.d.ts.map +0 -1
  156. package/lib/typescript/src/utils/nativeStore.d.ts.map +0 -1
  157. package/lib/typescript/src/utils/polyfill.d.ts +0 -29
  158. package/lib/typescript/src/utils/polyfill.d.ts.map +0 -1
  159. package/lib/typescript/src/utils/utils.d.ts.map +0 -1
  160. package/src/utils/polyfill.ts +0 -51
  161. /package/lib/typescript/{src → commonjs/src}/NativeGtReactNative.d.ts +0 -0
  162. /package/lib/typescript/{src → commonjs/src}/provider/GTProvider.d.ts +0 -0
  163. /package/lib/typescript/{src → commonjs/src}/provider/hooks/locale/useDetermineLocale.d.ts +0 -0
  164. /package/lib/typescript/{src → commonjs/src}/provider/hooks/useRegionState.d.ts +0 -0
  165. /package/lib/typescript/{src → commonjs/src}/types/config.d.ts +0 -0
  166. /package/lib/typescript/{src → commonjs/src}/utils/getNativeLocales.d.ts +0 -0
  167. /package/lib/typescript/{src → commonjs/src}/utils/nativeStore.d.ts +0 -0
  168. /package/lib/typescript/{src → commonjs/src}/utils/utils.d.ts +0 -0
  169. /package/lib/typescript/{package.json → module/package.json} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_generaltranslation","_internal","_getNativeLocales","_nativeStore","useDetermineLocale","locale","_locale","defaultLocale","libraryDefaultLocale","locales","localeCookieName","ssr","customMapping","resolveAliasLocale","map","initializeLocale","result","determineLocale","getNewLocale","_setLocale","useState","setLocale","setLocaleWithoutPersist","createSetLocale","useEffect","newLocale","storedLocale","nativeStoreGet","preferredLocales","getNativeLocales","length","l","nativeStoreSet","validatedLocale","console","warn"],"sourceRoot":"../../../../../src","sources":["provider/hooks/locale/useDetermineLocale.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,mBA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uB,CAAC;AAC7C","ignoreList":[]}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useRegionState = useRegionState;
7
+ var _react = require("react");
8
+ var _nativeStore = require("../../utils/nativeStore");
9
+ function getNewRegion({
10
+ _region,
11
+ regionCookieName
12
+ }) {
13
+ // Check for region in native store
14
+ const cookieRegion = (0, _nativeStore.nativeStoreGet)(regionCookieName) || undefined;
15
+ const newRegion = _region || cookieRegion;
16
+
17
+ // if state not valid, change it to newRegion
18
+ if (cookieRegion && cookieRegion !== newRegion) {
19
+ (0, _nativeStore.nativeStoreSet)(regionCookieName, newRegion || '');
20
+ }
21
+ return newRegion;
22
+ }
23
+ function useRegionState({
24
+ _region,
25
+ ssr,
26
+ regionCookieName
27
+ }) {
28
+ const [region, _setRegion] = (0, _react.useState)(ssr ? undefined : getNewRegion({
29
+ _region,
30
+ regionCookieName
31
+ }));
32
+ const setRegion = newRegion => {
33
+ _setRegion(newRegion);
34
+ (0, _nativeStore.nativeStoreSet)(regionCookieName, newRegion || '');
35
+ };
36
+ (0, _react.useEffect)(() => {
37
+ _setRegion(getNewRegion({
38
+ _region,
39
+ regionCookieName
40
+ }));
41
+ }, [_region, regionCookieName]);
42
+ return {
43
+ region,
44
+ setRegion
45
+ };
46
+ }
47
+ //# sourceMappingURL=useRegionState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_nativeStore","getNewRegion","_region","regionCookieName","cookieRegion","nativeStoreGet","undefined","newRegion","nativeStoreSet","useRegionState","ssr","region","_setRegion","useState","setRegion","useEffect"],"sourceRoot":"../../../../src","sources":["provider/hooks/useRegionState.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAEA,SAASE,YAAYA,CAAC;EACpBC,OAAO;EACPC;AAIF,CAAC,EAAE;EACD;EACA,MAAMC,YAAY,GAAG,IAAAC,2BAAc,EAACF,gBAAgB,CAAC,IAAIG,SAAS;EAClE,MAAMC,SAAS,GAAGL,OAAO,IAAIE,YAAY;;EAEzC;EACA,IAAIA,YAAY,IAAIA,YAAY,KAAKG,SAAS,EAAE;IAC9C,IAAAC,2BAAc,EAACL,gBAAgB,EAAEI,SAAS,IAAI,EAAE,CAAC;EACnD;EAEA,OAAOA,SAAS;AAClB;AAEO,SAASE,cAAcA,CAAC;EAC7BP,OAAO;EACPQ,GAAG;EACHP;AACoB,CAAC,EAAwB;EAC7C,MAAM,CAACQ,MAAM,EAAEC,UAAU,CAAC,GAAG,IAAAC,eAAQ,EACnCH,GAAG,GACCJ,SAAS,GACTL,YAAY,CAAC;IACXC,OAAO;IACPC;EACF,CAAC,CACP,CAAC;EACD,MAAMW,SAAS,GAAIP,SAA6B,IAAK;IACnDK,UAAU,CAACL,SAAS,CAAC;IACrB,IAAAC,2BAAc,EAACL,gBAAgB,EAAEI,SAAS,IAAI,EAAE,CAAC;EACnD,CAAC;EACD,IAAAQ,gBAAS,EAAC,MAAM;IACdH,UAAU,CAACX,YAAY,CAAC;MAAEC,OAAO;MAAEC;IAAiB,CAAC,CAAC,CAAC;EACzD,CAAC,EAAE,CAACD,OAAO,EAAEC,gBAAgB,CAAC,CAAC;EAC/B,OAAO;IACLQ,MAAM;IACNG;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.testLocalePolyfill = testLocalePolyfill;
7
+ function testLocalePolyfill(locale = 'en-US') {
8
+ const problems = [];
9
+
10
+ // 1. basic presence
11
+ if (!global.Intl) problems.push('Intl missing entirely');
12
+ const apis = ['Locale', 'NumberFormat', 'DateTimeFormat', 'PluralRules', 'RelativeTimeFormat', 'ListFormat', 'DisplayNames'];
13
+ apis.forEach(a => {
14
+ // @ts-ignore
15
+ if (!Intl[a]) problems.push(`Intl.${a} missing`);
16
+ });
17
+
18
+ // 2. locale actually supported (no silent fallback)
19
+ const dtfSupported = Intl.DateTimeFormat.supportedLocalesOf([locale])[0] === locale;
20
+ const nfSupported = Intl.NumberFormat.supportedLocalesOf([locale])[0] === locale;
21
+ if (!dtfSupported) problems.push(`${locale} not supported by DateTimeFormat`);
22
+ if (!nfSupported) problems.push(`${locale} not supported by NumberFormat`);
23
+
24
+ // 3. numeric separators sanity
25
+ let group, decimal;
26
+ try {
27
+ const parts = new Intl.NumberFormat(locale).formatToParts(1234.5);
28
+ group = parts.find(p => p.type === 'group')?.value;
29
+ decimal = parts.find(p => p.type === 'decimal')?.value;
30
+ if (!group || !decimal) problems.push('formatToParts missing group/decimal separators');
31
+ } catch (e) {
32
+ problems.push(`NumberFormat threw: ${e instanceof Error ? e.message : String(e)}`);
33
+ }
34
+
35
+ // 4. plural rules sanity
36
+ try {
37
+ const pr = new Intl.PluralRules(locale);
38
+ const sample = pr.select(5);
39
+ if (!sample) problems.push('PluralRules returned undefined');
40
+ } catch (e) {
41
+ problems.push(`PluralRules threw: ${e instanceof Error ? e.message : String(e)}`);
42
+ }
43
+
44
+ // 5. show example formatted values
45
+ const example = {
46
+ number: new Intl.NumberFormat(locale).format(1234.5),
47
+ date: new Intl.DateTimeFormat(locale, {
48
+ dateStyle: 'long'
49
+ }).format(new Date('2020-01-02')),
50
+ weekday: new Intl.DateTimeFormat(locale, {
51
+ weekday: 'long'
52
+ }).format(new Date('2020-01-02'))
53
+ };
54
+ const result = {
55
+ ok: problems.length === 0,
56
+ problems,
57
+ group,
58
+ decimal,
59
+ example
60
+ };
61
+ if (result.ok) {
62
+ console.log(`✅ Locale polyfill looks OK for ${locale}`, example);
63
+ } else {
64
+ console.warn(`❌ Locale polyfill check failed for ${locale}:`, problems, example);
65
+ }
66
+ return result;
67
+ }
68
+ //# sourceMappingURL=testLocalePolyfill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["testLocalePolyfill","locale","problems","global","Intl","push","apis","forEach","a","dtfSupported","DateTimeFormat","supportedLocalesOf","nfSupported","NumberFormat","group","decimal","parts","formatToParts","find","p","type","value","e","Error","message","String","pr","PluralRules","sample","select","example","number","format","date","dateStyle","Date","weekday","result","ok","length","console","log","warn"],"sourceRoot":"../../../src","sources":["tools/testLocalePolyfill.ts"],"mappings":";;;;;;AAAO,SAASA,kBAAkBA,CAACC,MAAM,GAAG,OAAO,EAAE;EACnD,MAAMC,QAAQ,GAAG,EAAE;;EAEnB;EACA,IAAI,CAACC,MAAM,CAACC,IAAI,EAAEF,QAAQ,CAACG,IAAI,CAAC,uBAAuB,CAAC;EACxD,MAAMC,IAAI,GAAG,CACX,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,cAAc,CACf;EACDA,IAAI,CAACC,OAAO,CAAEC,CAAC,IAAK;IAClB;IACA,IAAI,CAACJ,IAAI,CAACI,CAAC,CAAC,EAAEN,QAAQ,CAACG,IAAI,CAAC,QAAQG,CAAC,UAAU,CAAC;EAClD,CAAC,CAAC;;EAEF;EACA,MAAMC,YAAY,GAChBL,IAAI,CAACM,cAAc,CAACC,kBAAkB,CAAC,CAACV,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAKA,MAAM;EAChE,MAAMW,WAAW,GACfR,IAAI,CAACS,YAAY,CAACF,kBAAkB,CAAC,CAACV,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAKA,MAAM;EAC9D,IAAI,CAACQ,YAAY,EAAEP,QAAQ,CAACG,IAAI,CAAC,GAAGJ,MAAM,kCAAkC,CAAC;EAC7E,IAAI,CAACW,WAAW,EAAEV,QAAQ,CAACG,IAAI,CAAC,GAAGJ,MAAM,gCAAgC,CAAC;;EAE1E;EACA,IAAIa,KAAK,EAAEC,OAAO;EAClB,IAAI;IACF,MAAMC,KAAK,GAAG,IAAIZ,IAAI,CAACS,YAAY,CAACZ,MAAM,CAAC,CAACgB,aAAa,CAAC,MAAM,CAAC;IACjEH,K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O,EAAE;IAAO,CAAC,CAAC,CAACJ,MAAM,CAClE,IAAIG,IAAI,CAAC,YAAY,CACvB;EACF,CAAC;EAED,MAAME,MAAM,GAAG;IACbC,EAAE,EAAEpC,QAAQ,CAACqC,MAAM,KAAK,CAAC;IACzBrC,QAAQ;IACRY,KAAK;IACLC,OAAO;IACPe;EACF,CAAC;EAED,IAAIO,MAAM,CAACC,EAAE,EAAE;IACbE,OAAO,CAACC,GAAG,CAAC,kCAAkCxC,MAAM,EAAE,EAAE6B,OAAO,CAAC;EAClE,CAAC,MAAM;IACLU,OAAO,CAACE,IAAI,CACV,sCAAsCzC,MAAM,GAAG,EAC/CC,QAAQ,EACR4B,OACF,CAAC;EACH;EACA,OAAOO,MAAM;AACf","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/config.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getNativeLocales = getNativeLocales;
7
+ var _reactNative = require("react-native");
8
+ var _NativeGtReactNative = _interopRequireDefault(require("../NativeGtReactNative"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ /**
11
+ * Get native device locales in preference order
12
+ * Returns an empty array if detection fails or is not supported
13
+ *
14
+ * iOS: Returns current locale first, followed by preferred languages
15
+ * Android: Returns user's preferred language list (LocaleList on API 24+, single locale on older versions)
16
+ * Web: Returns browser language preferences from navigator
17
+ */
18
+ function getNativeLocales() {
19
+ try {
20
+ // Web platform - use browser locale detection
21
+ if (_reactNative.Platform.OS === 'web') {
22
+ return getWebLocales();
23
+ }
24
+
25
+ // Try to get locales from native module
26
+ return _NativeGtReactNative.default.getNativeLocales() || [];
27
+ } catch (error) {
28
+ // Return empty array on any error (native module not available, etc.)
29
+ return [];
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Get browser locales for web platform
35
+ */
36
+ function getWebLocales() {
37
+ try {
38
+ if (typeof navigator === 'undefined') {
39
+ return [];
40
+ }
41
+ const locales = [];
42
+
43
+ // Use navigator.languages if available (most browsers)
44
+ if (navigator.languages && Array.isArray(navigator.languages)) {
45
+ locales.push(...navigator.languages);
46
+ } else if (navigator.language) {
47
+ // Fallback to single language
48
+ locales.push(navigator.language);
49
+ } else if (navigator.userLanguage) {
50
+ // IE fallback
51
+ locales.push(navigator.userLanguage);
52
+ }
53
+ return locales;
54
+ } catch (error) {
55
+ return [];
56
+ }
57
+ }
58
+ //# sourceMappingURL=getNativeLocales.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_NativeGtReactNative","_interopRequireDefault","e","__esModule","default","getNativeLocales","Platform","OS","getWebLocales","GtReactNative","error","navigator","locales","languages","Array","isArray","push","language","userLanguage"],"sourceRoot":"../../../src","sources":["utils/getNativeLocales.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAmD,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,gBAAgBA,CAAA,EAAa;EAC3C,IAAI;IACF;IACA,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;MACzB,OAAOC,aAAa,CAAC,CAAC;IACxB;;IAEA;IACA,OAAOC,4BAAa,CAACJ,gBAAgB,CAAC,CAAC,IAAI,EAAE;EAC/C,CAAC,CAAC,OAAOK,KAAK,EAAE;IACd;IACA,OAAO,EAAE;EACX;AACF;;AAEA;AACA;AACA;AACA,SAASF,aAAaA,CAAA,EAAa;EACjC,IAAI;IACF,IAAI,OAAOG,SAAS,KAAK,WAAW,EAAE;MACpC,OAAO,EAAE;IACX;IAEA,MAAMC,OAAiB,GAAG,EAAE;;IAE5B;IACA,IAAID,SAAS,CAACE,SAAS,IAAIC,KAAK,CAACC,OAAO,CAACJ,SAAS,CAACE,SAAS,CAAC,EAAE;MAC7DD,OAAO,CAACI,IAAI,CAAC,GAAGL,SAAS,CAACE,SAAS,CAAC;IACtC,CAAC,MAAM,IAAIF,SAAS,CAACM,QAAQ,EAAE;MAC7B;MACAL,OAAO,CAACI,IAAI,CAACL,SAAS,CAACM,QAAQ,CAAC;IAClC,CAAC,MAAM,IAAKN,SAAS,CAASO,YAAY,EAAE;MAC1C;MACAN,OAAO,CAACI,IAAI,CAAEL,SAAS,CAASO,YAAY,CAAC;IAC/C;IAEA,OAAON,OAAO;EAChB,CAAC,CAAC,OAAOF,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.nativeStoreGet = nativeStoreGet;
7
+ exports.nativeStoreSet = nativeStoreSet;
8
+ var _reactNative = require("react-native");
9
+ var _NativeGtReactNative = _interopRequireDefault(require("../NativeGtReactNative"));
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ /**
12
+ * Native store interface, used to replace cookie behavior from gt-react
13
+ */
14
+
15
+ /**
16
+ * Get a value from the native store
17
+ * @param key - The key to get the value for
18
+ * @returns The value for the key
19
+ */
20
+ function nativeStoreGet(key) {
21
+ if (_reactNative.Platform.OS === 'web') {
22
+ return localStorage.getItem(key);
23
+ }
24
+ return _NativeGtReactNative.default.nativeStoreGet(key);
25
+ }
26
+
27
+ /**
28
+ * Set a value in the native store
29
+ * @param key - The key to set the value for
30
+ * @param value - The value to set
31
+ */
32
+ function nativeStoreSet(key, value) {
33
+ if (_reactNative.Platform.OS === 'web') {
34
+ localStorage.setItem(key, value);
35
+ return;
36
+ }
37
+ _NativeGtReactNative.default.nativeStoreSet(key, value);
38
+ }
39
+ //# sourceMappingURL=nativeStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_NativeGtReactNative","_interopRequireDefault","e","__esModule","default","nativeStoreGet","key","Platform","OS","localStorage","getItem","GtReactNative","nativeStoreSet","value","setItem"],"sourceRoot":"../../../src","sources":["utils/nativeStore.ts"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAmD,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASG,cAAcA,CAACC,GAAW,EAAiB;EACzD,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzB,OAAOC,YAAY,CAACC,OAAO,CAACJ,GAAG,CAAC;EAClC;EACA,OAAOK,4BAAa,CAACN,cAAc,CAACC,GAAG,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASM,cAAcA,CAACN,GAAW,EAAEO,KAAa,EAAQ;EAC/D,IAAIN,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzBC,YAAY,CAACK,OAAO,CAACR,GAAG,EAAEO,KAAK,CAAC;IAChC;EACF;EACAF,4BAAa,CAACC,cAAc,CAACN,GAAG,EAAEO,KAAK,CAAC;AAC1C","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.readAuthFromEnv = readAuthFromEnv;
7
+ function readAuthFromEnv(params) {
8
+ const {
9
+ projectId,
10
+ devApiKey
11
+ } = params;
12
+ return {
13
+ projectId: projectId || '',
14
+ devApiKey: devApiKey
15
+ };
16
+ }
17
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +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,4 +1,4 @@
1
1
  "use strict";
2
2
 
3
- export const PACKAGE_NAME = 'gt-react';
3
+ export const PACKAGE_NAME = 'gt-react-native';
4
4
  //# 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,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["PACKAGE_NAME"],"sourceRoot":"../../../src","sources":["errors-dir/constants.ts"],"mappings":";;AAAA,OAAO,MAAMA,YAAY,GAAG,iBAAiB","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ import { PACKAGE_NAME } from "./constants.js";
4
+ export const failedToReadConfigFileError = filePath => `${PACKAGE_NAME} Error: Failed to read GT Config at ${filePath}.`;
5
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +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":[]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ import { libraryDefaultLocale } from 'generaltranslation/internal';
4
+ 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
+ //# sourceMappingURL=warnings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["libraryDefaultLocale","PACKAGE_NAME","resolveLocalesFailedWarning","couldNotLocateConfigWarning","filePath","invalidLocalesWarning","invalidLocales","join"],"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","ignoreList":[]}
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
 
3
- import { polyfillLocales } from "./utils/polyfill.js";
4
3
  import GtReactNative from "./NativeGtReactNative.js";
5
4
  import { GTProvider } from "./provider/GTProvider.js";
6
5
  export function multiply(a, b) {
7
6
  return GtReactNative.multiply(a, b);
8
7
  }
9
8
  import { T, useGT, useTranslations, useDefaultLocale, useLocale, useRegion, Var, Num, Currency, DateTime, Plural, Branch, useLocales, useLocaleSelector, useSetLocale, useGTClass, useLocaleProperties, useRegionSelector, useLocaleDirection, useMessages, msg, decodeMsg, decodeOptions } from '@generaltranslation/react-core';
10
- export { Var, Num, Currency, DateTime, T, GTProvider, Plural, Branch, useGT, useTranslations, useDefaultLocale, useLocale, useLocales, useSetLocale, useLocaleSelector, useRegion, useRegionSelector, useGTClass, useLocaleProperties, useLocaleDirection, msg, decodeMsg, decodeOptions, useMessages, polyfillLocales };
9
+ export { Var, Num, Currency, DateTime, T, GTProvider, Plural, Branch, useGT, useTranslations, useDefaultLocale, useLocale, useLocales, useSetLocale, useLocaleSelector, useRegion, useRegionSelector, useGTClass, useLocaleProperties, useLocaleDirection, msg, decodeMsg, decodeOptions, useMessages };
11
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["polyfillLocales","GtReactNative","GTProvider","multiply","a","b","T","useGT","useTranslations","useDefaultLocale","useLocale","useRegion","Var","Num","Currency","DateTime","Plural","Branch","useLocales","useLocaleSelector","useSetLocale","useGTClass","useLocaleProperties","useRegionSelector","useLocaleDirection","useMessages","msg","decodeMsg","decodeOptions"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,qBAAkB;AAClD,OAAOC,aAAa,MAAM,0BAAuB;AAEjD,SAASC,UAAU,QAAQ,0BAAuB;AAClD,OAAO,SAASC,QAAQA,CAACC,CAAS,EAAEC,CAAS,EAAU;EACrD,OAAOJ,aAAa,CAACE,QAAQ,CAACC,CAAC,EAAEC,CAAC,CAAC;AACrC;AAEA,SACEC,CAAC,EACDC,KAAK,EACLC,eAAe,EACfC,gBAAgB,EAChBC,SAAS,EACTC,SAAS,EACTC,GAAG,EACHC,GAAG,EACHC,QAAQ,EACRC,QAAQ,EACRC,MAAM,EACNC,MAAM,EACNC,UAAU,EACVC,iBAAiB,EACjBC,YAAY,EACZC,UAAU,EACVC,mBAAmB,EACnBC,iBAAiB,EACjBC,kBAAkB,EAClBC,WAAW,EACXC,GAAG,EACHC,SAAS,EACTC,aAAa,QACR,gCAAgC;AAOvC,SACEhB,GAAG,EACHC,GAAG,EACHC,QAAQ,EACRC,QAAQ,EACRT,CAAC,EACDJ,UAAU,EACVc,MAAM,EACNC,MAAM,EACNV,KAAK,EACLC,eAAe,EACfC,gBAAgB,EAChBC,SAAS,EACTQ,UAAU,EACVE,YAAY,EACZD,iBAAiB,EACjBR,SAAS,EACTY,iBAAiB,EACjBF,UAAU,EACVC,mBAAmB,EACnBE,kBAAkB,EAIlBE,GAAG,EACHC,SAAS,EACTC,aAAa,EACbH,WAAW,EACXzB,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["GtReactNative","GTProvider","multiply","a","b","T","useGT","useTranslations","useDefaultLocale","useLocale","useRegion","Var","Num","Currency","DateTime","Plural","Branch","useLocales","useLocaleSelector","useSetLocale","useGTClass","useLocaleProperties","useRegionSelector","useLocaleDirection","useMessages","msg","decodeMsg","decodeOptions"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,aAAa,MAAM,0BAAuB;AAEjD,SAASC,UAAU,QAAQ,0BAAuB;AAClD,OAAO,SAASC,QAAQA,CAACC,CAAS,EAAEC,CAAS,EAAU;EACrD,OAAOJ,aAAa,CAACE,QAAQ,CAACC,CAAC,EAAEC,CAAC,CAAC;AACrC;AAEA,SACEC,CAAC,EACDC,KAAK,EACLC,eAAe,EACfC,gBAAgB,EAChBC,SAAS,EACTC,SAAS,EACTC,GAAG,EACHC,GAAG,EACHC,QAAQ,EACRC,QAAQ,EACRC,MAAM,EACNC,MAAM,EACNC,UAAU,EACVC,iBAAiB,EACjBC,YAAY,EACZC,UAAU,EACVC,mBAAmB,EACnBC,iBAAiB,EACjBC,kBAAkB,EAClBC,WAAW,EACXC,GAAG,EACHC,SAAS,EACTC,aAAa,QACR,gCAAgC;AAOvC,SACEhB,GAAG,EACHC,GAAG,EACHC,QAAQ,EACRC,QAAQ,EACRT,CAAC,EACDJ,UAAU,EACVc,MAAM,EACNC,MAAM,EACNV,KAAK,EACLC,eAAe,EACfC,gBAAgB,EAChBC,SAAS,EACTQ,UAAU,EACVE,YAAY,EACZD,iBAAiB,EACjBR,SAAS,EACTY,iBAAiB,EACjBF,UAAU,EACVC,mBAAmB,EACnBE,kBAAkB,EAIlBE,GAAG,EACHC,SAAS,EACTC,aAAa,EACbH,WAAW","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { testLocalePolyfill } from "./tools/testLocalePolyfill.js";
4
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["testLocalePolyfill"],"sourceRoot":"../../src","sources":["internal.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,+BAA4B","ignoreList":[]}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ import * as path from 'path';
4
+ import { resolveLocales } from "./utils/resolveLocales.js";
5
+ export default function (babel, {
6
+ locales,
7
+ config,
8
+ configFilePath,
9
+ entryPointFilePath = path.resolve(process.cwd(), 'src', 'App.tsx')
10
+ }) {
11
+ const {
12
+ types: t
13
+ } = babel;
14
+ return {
15
+ name: 'gt-react-native/plugin',
16
+ visitor: {
17
+ Program(programPath, state) {
18
+ const currentFilePath = path.resolve(state.filename || state.file.opts.filename || '');
19
+
20
+ // Only apply polyfills to files that import gt-react-native or generaltranslation
21
+ if (currentFilePath !== entryPointFilePath) {
22
+ return;
23
+ }
24
+ const resolvedLocales = resolveLocales({
25
+ locales,
26
+ config,
27
+ configFilePath
28
+ });
29
+
30
+ // TODO: smart imports based on if the polyfill is required, do this as a wrapper around AppRegistry.registerComponent()
31
+ const imports = ['@formatjs/intl-getcanonicallocales/polyfill', '@formatjs/intl-locale/polyfill', '@formatjs/intl-displaynames/polyfill', '@formatjs/intl-listformat/polyfill', '@formatjs/intl-pluralrules/polyfill-force',
32
+ // https://github.com/formatjs/formatjs/issues/4463
33
+ '@formatjs/intl-numberformat/polyfill', '@formatjs/intl-relativetimeformat/polyfill', '@formatjs/intl-datetimeformat/polyfill', '@formatjs/intl-datetimeformat/add-all-tz', ...resolvedLocales.flatMap(locale => [`@formatjs/intl-displaynames/locale-data/${locale}`, `@formatjs/intl-listformat/locale-data/${locale}`, `@formatjs/intl-pluralrules/locale-data/${locale}`, `@formatjs/intl-numberformat/locale-data/${locale}`, `@formatjs/intl-relativetimeformat/locale-data/${locale}`, `@formatjs/intl-datetimeformat/locale-data/${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
+ };
48
+ }
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["path","resolveLocales","babel","locales","config","configFilePath","entryPointFilePath","resolve","process","cwd","types","t","name","visitor","Program","programPath","state","currentFilePath","filename","file","opts","resolvedLocales","imports","flatMap","locale","existingImports","Set","node","body","forEach","isImportDeclaration","source","value","includes","add","importsToAdd","filter","imp","has","length","newImports","map","importPath","importDeclaration","stringLiteral","unshift"],"sourceRoot":"../../../src","sources":["plugin-dir/index.ts"],"mappings":";;AAAA,OAAO,KAAKA,IAAI,MAAM,MAAM;AAG5B,SAASC,cAAc,QAAQ,2BAAwB;AAEvD,eAAe,UACbC,KAA8B,EAC9B;EACEC,OAAO;EACPC,MAAM;EACNC,cAAc;EACdC,kBAAkB,GAAGN,IAAI,CAACO,OAAO,CAACC,OAAO,CAACC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS;AACpD,CAAC,EACL;EACX,MAAM;IAAEC,KAAK,EAAEC;EAAE,CAAC,GAAGT,K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MAAM,CAAEC,GAAG,IAAK,CAACZ,eAAe,CAACa,GAAG,CAACD,GAAG,CAAC,CAAC;QAEvE,IAAIF,YAAY,CAACI,MAAM,GAAG,CAAC,EAAE;UAC3B,MAAMC,UAAU,GAAGL,YAAY,CAACM,GAAG,CAAEC,UAAU,IAC7C/B,CAAC,CAACgC,iBAAiB,CAAC,EAAE,EAAEhC,CAAC,CAACiC,aAAa,CAACF,UAAU,CAAC,CACrD,CAAC;UAED3B,WAAW,CAACY,IAAI,CAACC,IAAI,CAACiB,OAAO,CAAC,GAAGL,UAAU,CAAC;QAC9C;MACF;IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["plugin-dir/types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ import fs from 'fs';
4
+ import { couldNotLocateConfigWarning, invalidLocalesWarning, resolveLocalesFailedWarning } from "../../errors-dir/warnings.js";
5
+ import { libraryDefaultLocale } from 'generaltranslation/internal';
6
+ 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
+
11
+ /**
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;
44
+ }
45
+
46
+ /**
47
+ * Resolve locales from a config file
48
+ * @param configFilePath - The path to the config file
49
+ * @returns A list of locales
50
+ */
51
+ 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
+ } catch (error) {
63
+ console.error(failedToReadConfigFileError(filePath), error);
64
+ break;
65
+ }
66
+ }
67
+ return result;
68
+ }
69
+ //# sourceMappingURL=resolveLocales.js.map
@@ -0,0 +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,2B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;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;IACH,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":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { default } from "./plugin-dir/index.js";
4
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["default"],"sourceRoot":"../../src","sources":["plugin.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,uBAAc","ignoreList":[]}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ export function testLocalePolyfill(locale = 'en-US') {
4
+ const problems = [];
5
+
6
+ // 1. basic presence
7
+ if (!global.Intl) problems.push('Intl missing entirely');
8
+ const apis = ['Locale', 'NumberFormat', 'DateTimeFormat', 'PluralRules', 'RelativeTimeFormat', 'ListFormat', 'DisplayNames'];
9
+ apis.forEach(a => {
10
+ // @ts-ignore
11
+ if (!Intl[a]) problems.push(`Intl.${a} missing`);
12
+ });
13
+
14
+ // 2. locale actually supported (no silent fallback)
15
+ const dtfSupported = Intl.DateTimeFormat.supportedLocalesOf([locale])[0] === locale;
16
+ const nfSupported = Intl.NumberFormat.supportedLocalesOf([locale])[0] === locale;
17
+ if (!dtfSupported) problems.push(`${locale} not supported by DateTimeFormat`);
18
+ if (!nfSupported) problems.push(`${locale} not supported by NumberFormat`);
19
+
20
+ // 3. numeric separators sanity
21
+ let group, decimal;
22
+ try {
23
+ const parts = new Intl.NumberFormat(locale).formatToParts(1234.5);
24
+ group = parts.find(p => p.type === 'group')?.value;
25
+ decimal = parts.find(p => p.type === 'decimal')?.value;
26
+ if (!group || !decimal) problems.push('formatToParts missing group/decimal separators');
27
+ } catch (e) {
28
+ problems.push(`NumberFormat threw: ${e instanceof Error ? e.message : String(e)}`);
29
+ }
30
+
31
+ // 4. plural rules sanity
32
+ try {
33
+ const pr = new Intl.PluralRules(locale);
34
+ const sample = pr.select(5);
35
+ if (!sample) problems.push('PluralRules returned undefined');
36
+ } catch (e) {
37
+ problems.push(`PluralRules threw: ${e instanceof Error ? e.message : String(e)}`);
38
+ }
39
+
40
+ // 5. show example formatted values
41
+ const example = {
42
+ number: new Intl.NumberFormat(locale).format(1234.5),
43
+ date: new Intl.DateTimeFormat(locale, {
44
+ dateStyle: 'long'
45
+ }).format(new Date('2020-01-02')),
46
+ weekday: new Intl.DateTimeFormat(locale, {
47
+ weekday: 'long'
48
+ }).format(new Date('2020-01-02'))
49
+ };
50
+ const result = {
51
+ ok: problems.length === 0,
52
+ problems,
53
+ group,
54
+ decimal,
55
+ example
56
+ };
57
+ if (result.ok) {
58
+ console.log(`✅ Locale polyfill looks OK for ${locale}`, example);
59
+ } else {
60
+ console.warn(`❌ Locale polyfill check failed for ${locale}:`, problems, example);
61
+ }
62
+ return result;
63
+ }
64
+ //# sourceMappingURL=testLocalePolyfill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["testLocalePolyfill","locale","problems","global","Intl","push","apis","forEach","a","dtfSupported","DateTimeFormat","supportedLocalesOf","nfSupported","NumberFormat","group","decimal","parts","formatToParts","find","p","type","value","e","Error","message","String","pr","PluralRules","sample","select","example","number","format","date","dateStyle","Date","weekday","result","ok","length","console","log","warn"],"sourceRoot":"../../../src","sources":["tools/testLocalePolyfill.ts"],"mappings":";;AAAA,OAAO,SAASA,kBAAkBA,CAACC,MAAM,GAAG,OAAO,EAAE;EACnD,MAAMC,QAAQ,GAAG,EAAE;;EAEnB;EACA,IAAI,CAACC,MAAM,CAACC,IAAI,EAAEF,QAAQ,CAACG,IAAI,CAAC,uBAAuB,CAAC;EACxD,MAAMC,IAAI,GAAG,CACX,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,cAAc,CACf;EACDA,IAAI,CAACC,OAAO,CAAEC,CAAC,IAAK;IAClB;IACA,IAAI,CAACJ,IAAI,CAACI,CAAC,CAAC,EAAEN,QAAQ,CAACG,IAAI,CAAC,QAAQG,CAAC,UAAU,CAAC;EAClD,CAAC,CAAC;;EAEF;EACA,MAAMC,YAAY,GAChBL,IAAI,CAACM,cAAc,CAACC,kBAAkB,CAAC,CAACV,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAKA,MAAM;EAChE,MAAMW,WAAW,GACfR,IAAI,CAACS,YAAY,CAACF,kBAAkB,CAAC,CAACV,MAAM,CAAC,CA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AAC;EACH;;EAEA;EACA,MAAMQ,OAAO,GAAG;IACdC,MAAM,EAAE,IAAI3B,IAAI,CAACS,YAAY,CAACZ,MAAM,CAAC,CAAC+B,MAAM,CAAC,MAAM,CAAC;IACpDC,IAAI,EAAE,IAAI7B,IAAI,CAACM,cAAc,CAACT,MAAM,EAAE;MAAEiC,SAAS,EAAE;IAAO,CAAC,CAAC,CAACF,MAAM,CACjE,IAAIG,IAAI,CAAC,YAAY,CACvB,CAAC;IACDC,OAAO,EAAE,IAAIhC,IAAI,CAACM,cAAc,CAACT,MAAM,EAAE;MAAEmC,OAAO,EAAE;IAAO,CAAC,CAAC,CAACJ,MAAM,CAClE,IAAIG,IAAI,CAAC,YAAY,CACvB;EACF,CAAC;EAED,MAAME,MAAM,GAAG;IACbC,EAAE,EAAEpC,QAAQ,CAACqC,MAAM,KAAK,CAAC;IACzBrC,QAAQ;IACRY,KAAK;IACLC,OAAO;IACPe;EACF,CAAC;EAED,IAAIO,MAAM,CAACC,EAAE,EAAE;IACbE,OAAO,CAACC,GAAG,CAAC,kCAAkCxC,MAAM,EAAE,EAAE6B,OAAO,CAAC;EAClE,CAAC,MAAM;IACLU,OAAO,CAACE,IAAI,CACV,sCAAsCzC,MAAM,GAAG,EAC/CC,QAAQ,EACR4B,OACF,CAAC;EACH;EACA,OAAOO,MAAM;AACf","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -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"}
@@ -0,0 +1,2 @@
1
+ export declare const PACKAGE_NAME = "gt-react-native";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -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"}
@@ -0,0 +1,2 @@
1
+ export declare const failedToReadConfigFileError: (filePath: string) => string;
2
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../../src/errors-dir/errors.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,WACO,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const resolveLocalesFailedWarning: string;
2
+ export declare const couldNotLocateConfigWarning: (filePath: string) => string;
3
+ export declare const invalidLocalesWarning: (invalidLocales: string[]) => string;
4
+ //# sourceMappingURL=warnings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warnings.d.ts","sourceRoot":"","sources":["../../../../../src/errors-dir/warnings.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,2BAA2B,QAIO,CAAC;AAEhD,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,WACG,CAAC;AAEhE,eAAO,MAAM,qBAAqB,GAAI,gBAAgB,MAAM,EAAE,WACwB,CAAC"}