@koine/i18n 2.0.0-beta.76 → 2.0.0-beta.78

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 (260) hide show
  1. package/README.md +1 -0
  2. package/api.cjs.js +2203 -0
  3. package/api.esm.js +2179 -0
  4. package/compiler-sync.cjs.d.ts +1 -0
  5. package/compiler-sync.cjs.default.js +1 -0
  6. package/compiler-sync.cjs.js +20 -0
  7. package/compiler-sync.cjs.mjs +2 -0
  8. package/compiler-sync.esm.js +16 -0
  9. package/compiler-worker.cjs.d.ts +1 -0
  10. package/compiler-worker.cjs.default.js +1 -0
  11. package/compiler-worker.cjs.js +18 -0
  12. package/compiler-worker.cjs.mjs +2 -0
  13. package/compiler-worker.esm.js +16 -0
  14. package/compiler.cjs.d.ts +1 -0
  15. package/compiler.cjs.default.js +1 -0
  16. package/compiler.cjs.js +21 -0
  17. package/compiler.cjs.mjs +2 -0
  18. package/compiler.esm.js +13 -0
  19. package/formatRoutePathname.cjs.js +12 -0
  20. package/formatRoutePathname.esm.js +10 -0
  21. package/index.cjs.d.ts +1 -0
  22. package/index.cjs.default.js +1 -0
  23. package/index.cjs.js +47 -0
  24. package/index.cjs.mjs +2 -0
  25. package/index.esm.js +42 -0
  26. package/next.cjs.d.ts +1 -0
  27. package/next.cjs.default.js +1 -0
  28. package/next.cjs.js +377 -0
  29. package/next.cjs.mjs +2 -0
  30. package/next.esm.js +353 -0
  31. package/package.json +22 -305
  32. package/actions/helpers-git.js +0 -45
  33. package/actions/helpers-i18n.js +0 -27
  34. package/actions/i18n.js +0 -17
  35. package/adapter-js/code/config.cjs.js +0 -14
  36. package/adapter-js/code/config.js +0 -14
  37. package/adapter-js/code/defaultLocale.js +0 -7
  38. package/adapter-js/code/deriveLocalisedPathnames.js +0 -78
  39. package/adapter-js/code/index.js +0 -123
  40. package/adapter-js/code/isLocale.js +0 -9
  41. package/adapter-js/code/locales.js +0 -8
  42. package/adapter-js/code/pathnameToRouteId.js +0 -20
  43. package/adapter-js/code/routes.js +0 -11
  44. package/adapter-js/code/routesSlim.js +0 -11
  45. package/adapter-js/code/routesSpa.js +0 -11
  46. package/adapter-js/code/tFns.js +0 -34
  47. package/adapter-js/code/tInterpolateParams.js +0 -18
  48. package/adapter-js/code/tPluralise.js +0 -10
  49. package/adapter-js/code/to.js +0 -32
  50. package/adapter-js/code/toFns.js +0 -25
  51. package/adapter-js/code/toFormat.js +0 -56
  52. package/adapter-js/code/toSpa.js +0 -42
  53. package/adapter-js/code/types.js +0 -327
  54. package/adapter-next/code/index.js +0 -54
  55. package/adapter-next/code/next-redirects.js +0 -5
  56. package/adapter-next/code/next-rewrites.js +0 -5
  57. package/adapter-next/code/useCurrentLocalisedPathnames.js +0 -20
  58. package/adapter-next/code/useLocale.js +0 -8
  59. package/adapter-next/code/useRouteId.js +0 -10
  60. package/adapter-next/code/useTo.js +0 -26
  61. package/adapter-next/code/useToSpa.js +0 -34
  62. package/adapter-next/plugin-async.js +0 -11
  63. package/adapter-next/plugin-legacy.js +0 -187
  64. package/adapter-next/plugin-shared.js +0 -39
  65. package/adapter-next/plugin.js +0 -13
  66. package/adapter-next/redirects.js +0 -51
  67. package/adapter-next/rewrites.js +0 -50
  68. package/adapter-next/transformPathname.js +0 -3
  69. package/adapter-next/webpackPluginI18n.js +0 -11
  70. package/adapter-next-translate/code/DynamicNamespaces.js +0 -9
  71. package/adapter-next-translate/code/T.js +0 -31
  72. package/adapter-next-translate/code/TransText.js +0 -9
  73. package/adapter-next-translate/code/getT.js +0 -15
  74. package/adapter-next-translate/code/index.js +0 -49
  75. package/adapter-next-translate/code/nextTranslateI18n.js +0 -19
  76. package/adapter-next-translate/code/useT.js +0 -43
  77. package/cjs/adapter-js/code/config.cjs.d.ts +0 -3
  78. package/cjs/adapter-js/code/config.d.ts +0 -3
  79. package/cjs/adapter-js/code/defaultLocale.d.ts +0 -3
  80. package/cjs/adapter-js/code/deriveLocalisedPathnames.d.ts +0 -2
  81. package/cjs/adapter-js/code/index.d.ts +0 -3
  82. package/cjs/adapter-js/code/isLocale.d.ts +0 -2
  83. package/cjs/adapter-js/code/locales.d.ts +0 -3
  84. package/cjs/adapter-js/code/pathnameToRouteId.d.ts +0 -3
  85. package/cjs/adapter-js/code/routes.d.ts +0 -3
  86. package/cjs/adapter-js/code/routesSlim.d.ts +0 -3
  87. package/cjs/adapter-js/code/routesSpa.d.ts +0 -3
  88. package/cjs/adapter-js/code/tFns.d.ts +0 -3
  89. package/cjs/adapter-js/code/tInterpolateParams.d.ts +0 -3
  90. package/cjs/adapter-js/code/tPluralise.d.ts +0 -2
  91. package/cjs/adapter-js/code/to.d.ts +0 -3
  92. package/cjs/adapter-js/code/toFns.d.ts +0 -3
  93. package/cjs/adapter-js/code/toFormat.d.ts +0 -3
  94. package/cjs/adapter-js/code/toSpa.d.ts +0 -3
  95. package/cjs/adapter-js/code/types.d.ts +0 -3
  96. package/cjs/adapter-next/code/index.d.ts +0 -3
  97. package/cjs/adapter-next/code/next-redirects.d.ts +0 -3
  98. package/cjs/adapter-next/code/next-rewrites.d.ts +0 -3
  99. package/cjs/adapter-next/code/useCurrentLocalisedPathnames.d.ts +0 -2
  100. package/cjs/adapter-next/code/useLocale.d.ts +0 -3
  101. package/cjs/adapter-next/code/useRouteId.d.ts +0 -2
  102. package/cjs/adapter-next/code/useTo.d.ts +0 -2
  103. package/cjs/adapter-next/code/useToSpa.d.ts +0 -2
  104. package/cjs/adapter-next/plugin-async.d.ts +0 -9
  105. package/cjs/adapter-next/plugin-legacy.d.ts +0 -22
  106. package/cjs/adapter-next/plugin-shared.d.ts +0 -13
  107. package/cjs/adapter-next/plugin.d.ts +0 -7
  108. package/cjs/adapter-next/redirects.d.ts +0 -4
  109. package/cjs/adapter-next/rewrites.d.ts +0 -4
  110. package/cjs/adapter-next/transformPathname.d.ts +0 -1
  111. package/cjs/adapter-next/webpackPluginI18n.d.ts +0 -7
  112. package/cjs/adapter-next-translate/code/DynamicNamespaces.d.ts +0 -2
  113. package/cjs/adapter-next-translate/code/T.d.ts +0 -2
  114. package/cjs/adapter-next-translate/code/TransText.d.ts +0 -2
  115. package/cjs/adapter-next-translate/code/getT.d.ts +0 -2
  116. package/cjs/adapter-next-translate/code/index.d.ts +0 -3
  117. package/cjs/adapter-next-translate/code/nextTranslateI18n.d.ts +0 -3
  118. package/cjs/adapter-next-translate/code/useT.d.ts +0 -2
  119. package/cjs/client/formatRoutePathname.d.ts +0 -4
  120. package/cjs/client/index.d.ts +0 -3
  121. package/cjs/client/interpolateTo.d.ts +0 -4
  122. package/cjs/client/routeHasDynamicPortion.d.ts +0 -2
  123. package/cjs/compiler/api.d.ts +0 -30
  124. package/cjs/compiler/code/data-routes.d.ts +0 -19
  125. package/cjs/compiler/code/data-translations.d.ts +0 -13
  126. package/cjs/compiler/code/data.d.ts +0 -33
  127. package/cjs/compiler/code/generate.d.ts +0 -14
  128. package/cjs/compiler/code/index.d.ts +0 -3
  129. package/cjs/compiler/code/tsCompile.d.ts +0 -2
  130. package/cjs/compiler/code/write.d.ts +0 -11
  131. package/cjs/compiler/config.d.ts +0 -12
  132. package/cjs/compiler/helpers.d.ts +0 -2
  133. package/cjs/compiler/input/data-local.d.ts +0 -4
  134. package/cjs/compiler/input/data-remote.d.ts +0 -7
  135. package/cjs/compiler/input/data.d.ts +0 -4
  136. package/cjs/compiler/input/index.d.ts +0 -4
  137. package/cjs/compiler/input/types.d.ts +0 -14
  138. package/cjs/compiler/input/write.d.ts +0 -8
  139. package/cjs/compiler/pluralisation.d.ts +0 -37
  140. package/cjs/compiler/summary/data.d.ts +0 -6
  141. package/cjs/compiler/summary/generate.d.ts +0 -4
  142. package/cjs/compiler/summary/index.d.ts +0 -3
  143. package/cjs/compiler/summary/write.d.ts +0 -10
  144. package/cjs/compiler/types.d.ts +0 -82
  145. package/cjs/compiler-sync.d.ts +0 -4
  146. package/cjs/compiler-worker.d.ts +0 -1
  147. package/cjs/compiler.d.ts +0 -2
  148. package/cjs/i18n/actions/helpers-git.js +0 -45
  149. package/cjs/i18n/actions/helpers-i18n.js +0 -27
  150. package/cjs/i18n/actions/i18n.js +0 -17
  151. package/cjs/i18n/adapter-js/code/config.cjs.js +0 -14
  152. package/cjs/i18n/adapter-js/code/config.js +0 -14
  153. package/cjs/i18n/adapter-js/code/defaultLocale.js +0 -7
  154. package/cjs/i18n/adapter-js/code/deriveLocalisedPathnames.js +0 -78
  155. package/cjs/i18n/adapter-js/code/index.js +0 -123
  156. package/cjs/i18n/adapter-js/code/isLocale.js +0 -9
  157. package/cjs/i18n/adapter-js/code/locales.js +0 -8
  158. package/cjs/i18n/adapter-js/code/pathnameToRouteId.js +0 -20
  159. package/cjs/i18n/adapter-js/code/routes.js +0 -11
  160. package/cjs/i18n/adapter-js/code/routesSlim.js +0 -11
  161. package/cjs/i18n/adapter-js/code/routesSpa.js +0 -11
  162. package/cjs/i18n/adapter-js/code/tFns.js +0 -34
  163. package/cjs/i18n/adapter-js/code/tInterpolateParams.js +0 -18
  164. package/cjs/i18n/adapter-js/code/tPluralise.js +0 -10
  165. package/cjs/i18n/adapter-js/code/to.js +0 -32
  166. package/cjs/i18n/adapter-js/code/toFns.js +0 -25
  167. package/cjs/i18n/adapter-js/code/toFormat.js +0 -56
  168. package/cjs/i18n/adapter-js/code/toSpa.js +0 -42
  169. package/cjs/i18n/adapter-js/code/types.js +0 -327
  170. package/cjs/i18n/adapter-next/code/index.js +0 -54
  171. package/cjs/i18n/adapter-next/code/next-redirects.js +0 -5
  172. package/cjs/i18n/adapter-next/code/next-rewrites.js +0 -5
  173. package/cjs/i18n/adapter-next/code/useCurrentLocalisedPathnames.js +0 -20
  174. package/cjs/i18n/adapter-next/code/useLocale.js +0 -8
  175. package/cjs/i18n/adapter-next/code/useRouteId.js +0 -10
  176. package/cjs/i18n/adapter-next/code/useTo.js +0 -26
  177. package/cjs/i18n/adapter-next/code/useToSpa.js +0 -34
  178. package/cjs/i18n/adapter-next/plugin-async.js +0 -11
  179. package/cjs/i18n/adapter-next/plugin-legacy.js +0 -187
  180. package/cjs/i18n/adapter-next/plugin-shared.js +0 -39
  181. package/cjs/i18n/adapter-next/plugin.js +0 -13
  182. package/cjs/i18n/adapter-next/redirects.js +0 -51
  183. package/cjs/i18n/adapter-next/rewrites.js +0 -50
  184. package/cjs/i18n/adapter-next/transformPathname.js +0 -3
  185. package/cjs/i18n/adapter-next/webpackPluginI18n.js +0 -11
  186. package/cjs/i18n/adapter-next-translate/code/DynamicNamespaces.js +0 -9
  187. package/cjs/i18n/adapter-next-translate/code/T.js +0 -31
  188. package/cjs/i18n/adapter-next-translate/code/TransText.js +0 -9
  189. package/cjs/i18n/adapter-next-translate/code/getT.js +0 -15
  190. package/cjs/i18n/adapter-next-translate/code/index.js +0 -49
  191. package/cjs/i18n/adapter-next-translate/code/nextTranslateI18n.js +0 -19
  192. package/cjs/i18n/adapter-next-translate/code/useT.js +0 -43
  193. package/cjs/i18n/client/formatRoutePathname.js +0 -5
  194. package/cjs/i18n/client/index.js +0 -3
  195. package/cjs/i18n/client/interpolateTo.js +0 -14
  196. package/cjs/i18n/client/routeHasDynamicPortion.js +0 -2
  197. package/cjs/i18n/compiler/api.js +0 -18
  198. package/cjs/i18n/compiler/code/data-routes.js +0 -99
  199. package/cjs/i18n/compiler/code/data-translations.js +0 -86
  200. package/cjs/i18n/compiler/code/data.js +0 -20
  201. package/cjs/i18n/compiler/code/generate.js +0 -46
  202. package/cjs/i18n/compiler/code/index.js +0 -2
  203. package/cjs/i18n/compiler/code/tsCompile.js +0 -27
  204. package/cjs/i18n/compiler/code/write.js +0 -39
  205. package/cjs/i18n/compiler/config.js +0 -13
  206. package/cjs/i18n/compiler/helpers.js +0 -14
  207. package/cjs/i18n/compiler/input/data-local.js +0 -60
  208. package/cjs/i18n/compiler/input/data-remote.js +0 -41
  209. package/cjs/i18n/compiler/input/data.js +0 -11
  210. package/cjs/i18n/compiler/input/index.js +0 -3
  211. package/cjs/i18n/compiler/input/types.js +0 -1
  212. package/cjs/i18n/compiler/input/write.js +0 -15
  213. package/cjs/i18n/compiler/pluralisation.js +0 -59
  214. package/cjs/i18n/compiler/summary/data.js +0 -28
  215. package/cjs/i18n/compiler/summary/generate.js +0 -27
  216. package/cjs/i18n/compiler/summary/index.js +0 -2
  217. package/cjs/i18n/compiler/summary/write.js +0 -18
  218. package/cjs/i18n/compiler/types.js +0 -1
  219. package/cjs/i18n/compiler-sync.js +0 -2
  220. package/cjs/i18n/compiler-worker.js +0 -3
  221. package/cjs/i18n/compiler.js +0 -1
  222. package/cjs/i18n/index.js +0 -2
  223. package/cjs/i18n/next.js +0 -3
  224. package/cjs/i18n/types.js +0 -1
  225. package/cjs/index.d.ts +0 -2
  226. package/cjs/next.d.ts +0 -3
  227. package/cjs/package.json +0 -34
  228. package/cjs/types.d.ts +0 -48
  229. package/client/formatRoutePathname.js +0 -5
  230. package/client/index.js +0 -3
  231. package/client/interpolateTo.js +0 -14
  232. package/client/routeHasDynamicPortion.js +0 -2
  233. package/compiler/api.js +0 -18
  234. package/compiler/code/data-routes.js +0 -99
  235. package/compiler/code/data-translations.js +0 -86
  236. package/compiler/code/data.js +0 -20
  237. package/compiler/code/generate.js +0 -46
  238. package/compiler/code/index.js +0 -2
  239. package/compiler/code/tsCompile.js +0 -27
  240. package/compiler/code/write.js +0 -39
  241. package/compiler/config.js +0 -13
  242. package/compiler/helpers.js +0 -14
  243. package/compiler/input/data-local.js +0 -60
  244. package/compiler/input/data-remote.js +0 -41
  245. package/compiler/input/data.js +0 -11
  246. package/compiler/input/index.js +0 -3
  247. package/compiler/input/types.js +0 -1
  248. package/compiler/input/write.js +0 -15
  249. package/compiler/pluralisation.js +0 -59
  250. package/compiler/summary/data.js +0 -28
  251. package/compiler/summary/generate.js +0 -27
  252. package/compiler/summary/index.js +0 -2
  253. package/compiler/summary/write.js +0 -18
  254. package/compiler/types.js +0 -1
  255. package/compiler-sync.js +0 -2
  256. package/compiler-worker.js +0 -3
  257. package/compiler.js +0 -1
  258. package/index.js +0 -2
  259. package/next.js +0 -3
  260. package/types.js +0 -1
package/package.json CHANGED
@@ -2,8 +2,8 @@
2
2
  "name": "@koine/i18n",
3
3
  "sideEffects": false,
4
4
  "dependencies": {
5
- "@koine/node": "2.0.0-beta.76",
6
- "@koine/utils": "2.0.0-beta.76",
5
+ "@koine/node": "2.0.0-beta.78",
6
+ "@koine/utils": "2.0.0-beta.78",
7
7
  "glob": "^10.3.10",
8
8
  "webpack": "^5.90.1",
9
9
  "minimatch": "^9.0.3",
@@ -28,318 +28,35 @@
28
28
  "optional": true
29
29
  }
30
30
  },
31
- "module": "./index.js",
32
- "type": "module",
33
- "main": "./cjs/index.js",
34
31
  "exports": {
32
+ "./package.json": "./package.json",
35
33
  ".": {
36
- "require": "./cjs/index.js",
37
- "import": "./index.js"
34
+ "module": "./index.esm.js",
35
+ "import": "./index.cjs.mjs",
36
+ "default": "./index.cjs.js"
38
37
  },
39
- "./actions/helpers-git": {
40
- "require": "./cjs/actions/helpers-git.js",
41
- "import": "./actions/helpers-git.js"
42
- },
43
- "./actions/helpers-i18n": {
44
- "require": "./cjs/actions/helpers-i18n.js",
45
- "import": "./actions/helpers-i18n.js"
46
- },
47
- "./actions/i18n": {
48
- "require": "./cjs/actions/i18n.js",
49
- "import": "./actions/i18n.js"
50
- },
51
- "./adapter-js/code/config.cjs": {
52
- "require": "./cjs/adapter-js/code/config.cjs.js",
53
- "import": "./adapter-js/code/config.cjs.js"
54
- },
55
- "./adapter-js/code/config": {
56
- "require": "./cjs/adapter-js/code/config.js",
57
- "import": "./adapter-js/code/config.js"
58
- },
59
- "./adapter-js/code/defaultLocale": {
60
- "require": "./cjs/adapter-js/code/defaultLocale.js",
61
- "import": "./adapter-js/code/defaultLocale.js"
62
- },
63
- "./adapter-js/code/deriveLocalisedPathnames": {
64
- "require": "./cjs/adapter-js/code/deriveLocalisedPathnames.js",
65
- "import": "./adapter-js/code/deriveLocalisedPathnames.js"
66
- },
67
- "./adapter-js/code": {
68
- "require": "./cjs/adapter-js/code/index.js",
69
- "import": "./adapter-js/code/index.js"
70
- },
71
- "./adapter-js/code/isLocale": {
72
- "require": "./cjs/adapter-js/code/isLocale.js",
73
- "import": "./adapter-js/code/isLocale.js"
74
- },
75
- "./adapter-js/code/locales": {
76
- "require": "./cjs/adapter-js/code/locales.js",
77
- "import": "./adapter-js/code/locales.js"
78
- },
79
- "./adapter-js/code/pathnameToRouteId": {
80
- "require": "./cjs/adapter-js/code/pathnameToRouteId.js",
81
- "import": "./adapter-js/code/pathnameToRouteId.js"
82
- },
83
- "./adapter-js/code/routes": {
84
- "require": "./cjs/adapter-js/code/routes.js",
85
- "import": "./adapter-js/code/routes.js"
86
- },
87
- "./adapter-js/code/routesSlim": {
88
- "require": "./cjs/adapter-js/code/routesSlim.js",
89
- "import": "./adapter-js/code/routesSlim.js"
90
- },
91
- "./adapter-js/code/routesSpa": {
92
- "require": "./cjs/adapter-js/code/routesSpa.js",
93
- "import": "./adapter-js/code/routesSpa.js"
94
- },
95
- "./adapter-js/code/tFns": {
96
- "require": "./cjs/adapter-js/code/tFns.js",
97
- "import": "./adapter-js/code/tFns.js"
98
- },
99
- "./adapter-js/code/tInterpolateParams": {
100
- "require": "./cjs/adapter-js/code/tInterpolateParams.js",
101
- "import": "./adapter-js/code/tInterpolateParams.js"
102
- },
103
- "./adapter-js/code/tPluralise": {
104
- "require": "./cjs/adapter-js/code/tPluralise.js",
105
- "import": "./adapter-js/code/tPluralise.js"
106
- },
107
- "./adapter-js/code/to": {
108
- "require": "./cjs/adapter-js/code/to.js",
109
- "import": "./adapter-js/code/to.js"
110
- },
111
- "./adapter-js/code/toFns": {
112
- "require": "./cjs/adapter-js/code/toFns.js",
113
- "import": "./adapter-js/code/toFns.js"
114
- },
115
- "./adapter-js/code/toFormat": {
116
- "require": "./cjs/adapter-js/code/toFormat.js",
117
- "import": "./adapter-js/code/toFormat.js"
118
- },
119
- "./adapter-js/code/toSpa": {
120
- "require": "./cjs/adapter-js/code/toSpa.js",
121
- "import": "./adapter-js/code/toSpa.js"
122
- },
123
- "./adapter-js/code/types": {
124
- "require": "./cjs/adapter-js/code/types.js",
125
- "import": "./adapter-js/code/types.js"
126
- },
127
- "./adapter-next-translate/code/DynamicNamespaces": {
128
- "require": "./cjs/adapter-next-translate/code/DynamicNamespaces.js",
129
- "import": "./adapter-next-translate/code/DynamicNamespaces.js"
130
- },
131
- "./adapter-next-translate/code/T": {
132
- "require": "./cjs/adapter-next-translate/code/T.js",
133
- "import": "./adapter-next-translate/code/T.js"
134
- },
135
- "./adapter-next-translate/code/TransText": {
136
- "require": "./cjs/adapter-next-translate/code/TransText.js",
137
- "import": "./adapter-next-translate/code/TransText.js"
138
- },
139
- "./adapter-next-translate/code/getT": {
140
- "require": "./cjs/adapter-next-translate/code/getT.js",
141
- "import": "./adapter-next-translate/code/getT.js"
142
- },
143
- "./adapter-next-translate/code": {
144
- "require": "./cjs/adapter-next-translate/code/index.js",
145
- "import": "./adapter-next-translate/code/index.js"
146
- },
147
- "./adapter-next-translate/code/nextTranslateI18n": {
148
- "require": "./cjs/adapter-next-translate/code/nextTranslateI18n.js",
149
- "import": "./adapter-next-translate/code/nextTranslateI18n.js"
150
- },
151
- "./adapter-next-translate/code/useT": {
152
- "require": "./cjs/adapter-next-translate/code/useT.js",
153
- "import": "./adapter-next-translate/code/useT.js"
154
- },
155
- "./adapter-next/code": {
156
- "require": "./cjs/adapter-next/code/index.js",
157
- "import": "./adapter-next/code/index.js"
158
- },
159
- "./adapter-next/code/next-redirects": {
160
- "require": "./cjs/adapter-next/code/next-redirects.js",
161
- "import": "./adapter-next/code/next-redirects.js"
162
- },
163
- "./adapter-next/code/next-rewrites": {
164
- "require": "./cjs/adapter-next/code/next-rewrites.js",
165
- "import": "./adapter-next/code/next-rewrites.js"
166
- },
167
- "./adapter-next/code/useCurrentLocalisedPathnames": {
168
- "require": "./cjs/adapter-next/code/useCurrentLocalisedPathnames.js",
169
- "import": "./adapter-next/code/useCurrentLocalisedPathnames.js"
170
- },
171
- "./adapter-next/code/useLocale": {
172
- "require": "./cjs/adapter-next/code/useLocale.js",
173
- "import": "./adapter-next/code/useLocale.js"
174
- },
175
- "./adapter-next/code/useRouteId": {
176
- "require": "./cjs/adapter-next/code/useRouteId.js",
177
- "import": "./adapter-next/code/useRouteId.js"
178
- },
179
- "./adapter-next/code/useTo": {
180
- "require": "./cjs/adapter-next/code/useTo.js",
181
- "import": "./adapter-next/code/useTo.js"
182
- },
183
- "./adapter-next/code/useToSpa": {
184
- "require": "./cjs/adapter-next/code/useToSpa.js",
185
- "import": "./adapter-next/code/useToSpa.js"
186
- },
187
- "./adapter-next/plugin-async": {
188
- "require": "./cjs/adapter-next/plugin-async.js",
189
- "import": "./adapter-next/plugin-async.js"
190
- },
191
- "./adapter-next/plugin-legacy": {
192
- "require": "./cjs/adapter-next/plugin-legacy.js",
193
- "import": "./adapter-next/plugin-legacy.js"
194
- },
195
- "./adapter-next/plugin-shared": {
196
- "require": "./cjs/adapter-next/plugin-shared.js",
197
- "import": "./adapter-next/plugin-shared.js"
198
- },
199
- "./adapter-next/plugin": {
200
- "require": "./cjs/adapter-next/plugin.js",
201
- "import": "./adapter-next/plugin.js"
202
- },
203
- "./adapter-next/redirects": {
204
- "require": "./cjs/adapter-next/redirects.js",
205
- "import": "./adapter-next/redirects.js"
206
- },
207
- "./adapter-next/rewrites": {
208
- "require": "./cjs/adapter-next/rewrites.js",
209
- "import": "./adapter-next/rewrites.js"
210
- },
211
- "./adapter-next/transformPathname": {
212
- "require": "./cjs/adapter-next/transformPathname.js",
213
- "import": "./adapter-next/transformPathname.js"
214
- },
215
- "./adapter-next/webpackPluginI18n": {
216
- "require": "./cjs/adapter-next/webpackPluginI18n.js",
217
- "import": "./adapter-next/webpackPluginI18n.js"
218
- },
219
- "./client/formatRoutePathname": {
220
- "require": "./cjs/client/formatRoutePathname.js",
221
- "import": "./client/formatRoutePathname.js"
222
- },
223
- "./client": {
224
- "require": "./cjs/client/index.js",
225
- "import": "./client/index.js"
226
- },
227
- "./client/interpolateTo": {
228
- "require": "./cjs/client/interpolateTo.js",
229
- "import": "./client/interpolateTo.js"
230
- },
231
- "./client/routeHasDynamicPortion": {
232
- "require": "./cjs/client/routeHasDynamicPortion.js",
233
- "import": "./client/routeHasDynamicPortion.js"
38
+ "./compiler": {
39
+ "module": "./compiler.esm.js",
40
+ "import": "./compiler.cjs.mjs",
41
+ "default": "./compiler.cjs.js"
234
42
  },
235
43
  "./compiler-sync": {
236
- "require": "./cjs/compiler-sync.js",
237
- "import": "./compiler-sync.js"
44
+ "module": "./compiler-sync.esm.js",
45
+ "import": "./compiler-sync.cjs.mjs",
46
+ "default": "./compiler-sync.cjs.js"
238
47
  },
239
48
  "./compiler-worker": {
240
- "require": "./cjs/compiler-worker.js",
241
- "import": "./compiler-worker.js"
242
- },
243
- "./compiler": {
244
- "require": "./cjs/compiler.js",
245
- "import": "./compiler.js"
246
- },
247
- "./compiler/api": {
248
- "require": "./cjs/compiler/api.js",
249
- "import": "./compiler/api.js"
250
- },
251
- "./compiler/code/data-routes": {
252
- "require": "./cjs/compiler/code/data-routes.js",
253
- "import": "./compiler/code/data-routes.js"
254
- },
255
- "./compiler/code/data-translations": {
256
- "require": "./cjs/compiler/code/data-translations.js",
257
- "import": "./compiler/code/data-translations.js"
258
- },
259
- "./compiler/code/data": {
260
- "require": "./cjs/compiler/code/data.js",
261
- "import": "./compiler/code/data.js"
262
- },
263
- "./compiler/code/generate": {
264
- "require": "./cjs/compiler/code/generate.js",
265
- "import": "./compiler/code/generate.js"
266
- },
267
- "./compiler/code": {
268
- "require": "./cjs/compiler/code/index.js",
269
- "import": "./compiler/code/index.js"
270
- },
271
- "./compiler/code/tsCompile": {
272
- "require": "./cjs/compiler/code/tsCompile.js",
273
- "import": "./compiler/code/tsCompile.js"
274
- },
275
- "./compiler/code/write": {
276
- "require": "./cjs/compiler/code/write.js",
277
- "import": "./compiler/code/write.js"
278
- },
279
- "./compiler/config": {
280
- "require": "./cjs/compiler/config.js",
281
- "import": "./compiler/config.js"
282
- },
283
- "./compiler/helpers": {
284
- "require": "./cjs/compiler/helpers.js",
285
- "import": "./compiler/helpers.js"
286
- },
287
- "./compiler/input/data-local": {
288
- "require": "./cjs/compiler/input/data-local.js",
289
- "import": "./compiler/input/data-local.js"
290
- },
291
- "./compiler/input/data-remote": {
292
- "require": "./cjs/compiler/input/data-remote.js",
293
- "import": "./compiler/input/data-remote.js"
294
- },
295
- "./compiler/input/data": {
296
- "require": "./cjs/compiler/input/data.js",
297
- "import": "./compiler/input/data.js"
298
- },
299
- "./compiler/input": {
300
- "require": "./cjs/compiler/input/index.js",
301
- "import": "./compiler/input/index.js"
302
- },
303
- "./compiler/input/types": {
304
- "require": "./cjs/compiler/input/types.js",
305
- "import": "./compiler/input/types.js"
306
- },
307
- "./compiler/input/write": {
308
- "require": "./cjs/compiler/input/write.js",
309
- "import": "./compiler/input/write.js"
310
- },
311
- "./compiler/pluralisation": {
312
- "require": "./cjs/compiler/pluralisation.js",
313
- "import": "./compiler/pluralisation.js"
314
- },
315
- "./compiler/summary/data": {
316
- "require": "./cjs/compiler/summary/data.js",
317
- "import": "./compiler/summary/data.js"
318
- },
319
- "./compiler/summary/generate": {
320
- "require": "./cjs/compiler/summary/generate.js",
321
- "import": "./compiler/summary/generate.js"
322
- },
323
- "./compiler/summary": {
324
- "require": "./cjs/compiler/summary/index.js",
325
- "import": "./compiler/summary/index.js"
326
- },
327
- "./compiler/summary/write": {
328
- "require": "./cjs/compiler/summary/write.js",
329
- "import": "./compiler/summary/write.js"
330
- },
331
- "./compiler/types": {
332
- "require": "./cjs/compiler/types.js",
333
- "import": "./compiler/types.js"
49
+ "module": "./compiler-worker.esm.js",
50
+ "import": "./compiler-worker.cjs.mjs",
51
+ "default": "./compiler-worker.cjs.js"
334
52
  },
335
53
  "./next": {
336
- "require": "./cjs/next.js",
337
- "import": "./next.js"
338
- },
339
- "./types": {
340
- "require": "./cjs/types.js",
341
- "import": "./types.js"
54
+ "module": "./next.esm.js",
55
+ "import": "./next.cjs.mjs",
56
+ "default": "./next.cjs.js"
342
57
  }
343
58
  },
344
- "version": "2.0.0-beta.76"
59
+ "module": "./index.esm.js",
60
+ "main": "./index.cjs.js",
61
+ "version": "2.0.0-beta.78"
345
62
  }
@@ -1,45 +0,0 @@
1
- import * as t from "@actions/core";
2
- import { simpleGit as i } from "simple-git";
3
- function e(i, e) {
4
- e && console.log(e), i && t.error(i);
5
- }
6
- export class Git {
7
- constructor(i, e){
8
- this.errors = [], this.baseDir = i, this.afterFetch = e, this.outputs = {
9
- committed: "false",
10
- commit_sha: void 0,
11
- pushed: "false"
12
- }, Object.entries(this.outputs).forEach(([i, e])=>t.setOutput(i, e));
13
- }
14
- async run() {
15
- let s = i({
16
- baseDir: this.baseDir
17
- }), o = process.env.GITHUB_REF?.substring(11) || "main";
18
- t.info(`Running in folder ${this.baseDir}...`), t.info("> Pulling from remote..."), await s.fetch(void 0, e).pull(void 0, void 0, void 0, e), await this.afterFetch(), t.info("> Checking for uncommitted changes in the git working tree...");
19
- let r = (await s.status()).files.length;
20
- r ? (t.info(`> Found ${r} changed files.`), await s.fetch([
21
- "--tags",
22
- "--force"
23
- ], e), t.info("> Re-staging files..."), await s.add(".").catch((t)=>{
24
- if (t.message.includes("fatal: pathspec") && t.message.includes("did not match any files")) this.errors.push(Error("Add command did not match any file"));
25
- else throw t;
26
- }), t.info("> Creating commit..."), await s.commit("chore(action): auto commit", void 0, {}, (t, i)=>(i && (this.setOutput("committed", "true"), this.setOutput("commit_sha", i.commit)), e(t, i))), t.info("> Pushing commit to repo..."), await s.push("origin", o, {
27
- "--set-upstream": null
28
- }, (t, i)=>(i && this.setOutput("pushed", "true"), e(t, i))), t.endGroup(), t.info("> Task completed!!!")) : (t.endGroup(), t.info("> Working tree clean. Nothing to commit."));
29
- }
30
- setOutput(i, e) {
31
- this.outputs[i] = e, t.setOutput(i, e);
32
- }
33
- logOutputs() {
34
- for(let i in t.startGroup("Outputs"), this.outputs)t.info(`${i}: ${this.outputs[i]}`);
35
- t.endGroup();
36
- }
37
- success() {
38
- if (1 === this.errors.length) throw this.errors[0];
39
- if (this.errors.length > 1) throw this.errors.forEach((i)=>t.error(i)), "There have been multiple runtime errors.";
40
- this.logOutputs();
41
- }
42
- error(i) {
43
- t.endGroup(), this.logOutputs(), t.setFailed(i);
44
- }
45
- }
@@ -1,27 +0,0 @@
1
- import { getConfig as o } from "../compiler/config";
2
- import { getInputDataLocal as r } from "../compiler/input/data-local";
3
- import { writeInput as t } from "../compiler/input/write";
4
- import { getSummaryData as i } from "../compiler/summary/data";
5
- import { writeSummary as m } from "../compiler/summary/write";
6
- export let i18nAction = async (p)=>{
7
- let { cwd: u, source: e = ".", url: a, output: { input: l, summaryJson: c, summaryMarkdown: n }, ...s } = p, f = await r({
8
- cwd: u,
9
- source: e,
10
- ...s
11
- }), w = [];
12
- if (l && w.push(t({
13
- cwd: u,
14
- output: l
15
- }, f)), c || n) {
16
- let r = i(o(f), {
17
- sourceUrl: a
18
- }, f);
19
- w.push(m({
20
- cwd: u,
21
- outputJson: c,
22
- outputMarkdown: n,
23
- sourceUrl: a
24
- }, r));
25
- }
26
- return await Promise.all(w), f;
27
- };
package/actions/i18n.js DELETED
@@ -1,17 +0,0 @@
1
- import { getInput as o, info as s } from "@actions/core";
2
- import { Git as r } from "./helpers-git";
3
- import { i18nAction as t } from "./helpers-i18n";
4
- let e = async ()=>{
5
- let r = process.env.GITHUB_REPOSITORY, e = process.env.GITHUB_REF.replace("refs/heads/", ""), u = `https://github.com/${r}/blob/${e}`, n = await t({
6
- url: u,
7
- output: {
8
- input: o("output_input") || ".github/input.json",
9
- summaryJson: o("output_summary_json") || ".github/summary.json",
10
- summaryMarkdown: o("output_summary_md") || ".github/summary.md"
11
- }
12
- });
13
- s(`Found locales: ${n.localesFolders.join(", ")}`), s(`Found ${n.translationFiles.length} JSON files`);
14
- }, u = new r(process.cwd(), e);
15
- u.run().then(()=>u.success()).catch((o)=>{
16
- u.error(o), console.error(o);
17
- });
@@ -1,14 +0,0 @@
1
- export default (({ config: e })=>`
2
- const { locales } = require("./locales");
3
- const { defaultLocale } = require("./defaultLocale");
4
-
5
- const config = {
6
- locales,
7
- defaultLocale,
8
- hideDefaultLocaleInUrl: ${e.hideDefaultLocaleInUrl},
9
- };
10
-
11
- exports.config = config;
12
-
13
- module.exports = config;
14
- `);
@@ -1,14 +0,0 @@
1
- export default (({ config: e })=>`
2
- import { locales } from "./locales";
3
- import { defaultLocale } from "./defaultLocale";
4
-
5
- /**
6
- */
7
- export const config = {
8
- locales,
9
- defaultLocale,
10
- hideDefaultLocaleInUrl: ${e.hideDefaultLocaleInUrl},
11
- }
12
-
13
- export default config;
14
- `);
@@ -1,7 +0,0 @@
1
- export default (({ config: e })=>`
2
- import type { I18n } from "./types";
3
-
4
- export const defaultLocale: I18n.Locale = "${e.defaultLocale}";
5
-
6
- export default defaultLocale;
7
- `);
@@ -1,78 +0,0 @@
1
- export default (()=>`
2
- import { locales } from "./locales";
3
- import { to } from "./to";
4
- import type { I18n } from "./types";
5
-
6
- function getPathnameDynamicPortionName(pathname: string) {
7
- const res = pathname.match(/\\[(.+)\\]/);
8
- return res ? res[1] : false;
9
- }
10
-
11
- function isStaticPathname(pathname: string) {
12
- return !/\\[/.test(pathname);
13
- }
14
-
15
- // e.g. ['my', 'path', 'id', 'view'] or ['nl' 'my', 'path', 'id', 'view']
16
- // where the first might be the locale (depending on hideDefaultLocaleInUrl)
17
- function getPathnameParts(pathname: string) {
18
- return pathname
19
- .split("/")
20
- .slice(1)
21
- .filter((p, i) => (i === 0 ? !locales.includes(p as I18n.Locale) : true));
22
- }
23
-
24
- function localisePathname(
25
- locale: I18n.Locale,
26
- // e.g. "my.path.[id].view"
27
- routeId: I18n.RouteIdDynamic | I18n.RouteIdStatic,
28
- locationLike: LocationLike
29
- ) {
30
- const toPathname = to(routeId as I18n.RouteIdStatic, locale);
31
-
32
- if (isStaticPathname(toPathname)) {
33
- return toPathname;
34
- }
35
- // e.g. ['my', 'path', '[id]', 'view']
36
- const toPathnameParts = getPathnameParts(toPathname);
37
- // e.g. "my.path.[id].view"
38
- const routeIdDynamic = routeId as I18n.RouteIdDynamic;
39
- // e.g. /my/path/123/view
40
- const currentPathname = locationLike.pathname;
41
- // e.g. ['my', 'path', '123', 'view']
42
- const currentPathnameParts = getPathnameParts(currentPathname);
43
- // e.g. { id: "123" }
44
- const params: Record<string, string> = {};
45
-
46
- for (let i = 0; i < toPathnameParts.length; i++) {
47
- // e.g. "my" or "[id]"
48
- const part = toPathnameParts[i];
49
- // e.g. "id"
50
- const name = getPathnameDynamicPortionName(part);
51
- if (name) {
52
- // e.g. "123"
53
- const value = currentPathnameParts[i];
54
- if (value) {
55
- params[name] = value;
56
- }
57
- }
58
- }
59
-
60
- return (
61
- to(routeIdDynamic, params as never, locale) +
62
- location?.search || "" +
63
- location?.hash || ""
64
- );
65
- }
66
-
67
- type LocationLike = { pathname: string; search?: string; hash?: string; };
68
-
69
- export type LocalisedPathnames = Record<I18n.Locale, string>;
70
-
71
- export const deriveLocalisedPathnames = (routeId: I18n.RouteId, locationLike: LocationLike) =>
72
- locales.reduce((pathnames, locale) => {
73
- pathnames[locale] = localisePathname(locale, routeId, locationLike);
74
- return pathnames;
75
- }, {} as LocalisedPathnames);
76
-
77
- export default deriveLocalisedPathnames;
78
- `);