@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/cjs/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from "./client";
2
- export * from "./types";
package/cjs/next.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export { withI18nLegacy, type WithI18nLegacyOptions, } from "./adapter-next/plugin-legacy";
2
- export { withI18nAsync, type WithI18nAsyncOptions, } from "./adapter-next/plugin-async";
3
- export { withI18n, type WithI18nOptions } from "./adapter-next/plugin";
package/cjs/package.json DELETED
@@ -1,34 +0,0 @@
1
- {
2
- "name": "@koine/i18n",
3
- "sideEffects": false,
4
- "dependencies": {
5
- "@koine/node": "*",
6
- "@koine/utils": "*",
7
- "glob": "^10.3.10",
8
- "webpack": "^5.90.1",
9
- "minimatch": "^9.0.3",
10
- "synckit": "^0.9.0",
11
- "typescript": "^5.3.3"
12
- },
13
- "peerDependencies": {
14
- "next": "^14.0.4",
15
- "next-translate-plugin": "^2.6.2"
16
- },
17
- "peerDependenciesMeta": {
18
- "next": {
19
- "optional": true
20
- },
21
- "next-translate": {
22
- "optional": true
23
- },
24
- "next-translate-plugin": {
25
- "optional": true
26
- },
27
- "react": {
28
- "optional": true
29
- }
30
- },
31
- "module": "./index.js",
32
- "type": "module",
33
- "main": "./index.js"
34
- }
package/cjs/types.d.ts DELETED
@@ -1,48 +0,0 @@
1
- import type { JsonObject, Split } from "@koine/utils";
2
- export declare namespace I18nUtils {
3
- export type Join<A, Sep extends string = "", R extends string = ""> = A extends [infer First, ...infer Rest] ? Join<Rest, Sep, R extends "" ? `${First & string}` : `${R}${Sep}${First & string}`> : R;
4
- export type BuildRecursiveJoin<TList, TSeparator extends string> = Exclude<TList extends [...infer ButLast, unknown] ? Join<ButLast, TSeparator> | BuildRecursiveJoin<ButLast, TSeparator> : never, "">;
5
- type JoinObjectPath<S1, S2> = S1 extends string ? S2 extends string ? `${S1}.${S2}` : S1 : never;
6
- type GetWithPath<BaseType, Keys extends readonly string[]> = Keys extends [] ? BaseType : Keys extends readonly [infer Head, ...infer Tail] ? GetWithPath<Head extends keyof BaseType ? BaseType[Head] : unknown, Extract<Tail, string[]>> : never;
7
- export type Get<BaseType, Path extends string | readonly string[]> = GetWithPath<BaseType, Path extends string ? Split<Path, "."> : Path>;
8
- export type Paths<T, TAsObj extends boolean = true> = {
9
- [K in Extract<keyof T, string>]: T[K] extends Record<string, never> | never[] | "" ? never : T[K] extends Record<string, unknown> ? (TAsObj extends true ? `${K}` : never) | JoinObjectPath<K, Paths<T[K], TAsObj>> : T[K] extends string | number | boolean | Array<string | number | boolean | object> ? `${K}` : never;
10
- }[Extract<keyof T, string>] extends infer O ? O : never;
11
- export type AllPaths<TDictionary extends JsonObject> = {
12
- [N in Extract<keyof TDictionary, string>]: {
13
- [K in Extract<keyof TDictionary[N], string>]: TDictionary[N][K] extends Record<string, never> | never[] | "" ? never : TDictionary[N][K] extends Record<string, unknown> ? `${N}:${K}` | JoinObjectPath<K extends string ? `${N}:${K}` : `${N}:`, Paths<TDictionary[N][K]>> : TDictionary[N][K] extends string | number | boolean | Array<string | number | boolean | object> ? `${N}:${K}` : never;
14
- }[Extract<keyof TDictionary[N], string>];
15
- }[Extract<keyof TDictionary, string>] extends infer O ? O : never;
16
- type Whitespace = `\u{20}`;
17
- type TrimLeft<V extends string> = V extends `${Whitespace}${infer R}` ? TrimLeft<R> : V;
18
- type TrimRight<V extends string> = V extends `${infer R}${Whitespace}` ? TrimRight<R> : V;
19
- type Trim<V extends string> = TrimLeft<TrimRight<V>>;
20
- type WithDynamicPortion<F extends string, D extends GenericDelimiters> = `${string}${F}${D["start"]}${string}${D["end"]}${F}${string}` | `${string}${F}${D["start"]}${string}${D["end"]}` | `${D["start"]}${string}${D["end"]}${F}${string}` | `${D["start"]}${string}${D["end"]}`;
21
- type FilterOnlyStaticRouteId<T extends string, F extends string, D extends GenericDelimiters> = T extends WithDynamicPortion<F, D> ? never : T;
22
- type FilterOnlyDynamicRouteId<T extends string, F extends string, D extends GenericDelimiters> = T extends WithDynamicPortion<F, D> ? T : never;
23
- type InferredSeparator<T extends string> = T extends `${string}.${string}` ? "." : T extends `${string}/${string}` ? "/" : never;
24
- type GenericDelimiters = {
25
- start: string;
26
- end: string;
27
- };
28
- type WithDelimitedString<Start extends string, End extends string> = `${string}${Start}${string}${End}${string}` | `${string}${Start}${string}${End}` | `${Start}${string}${End}${string}` | `${Start}${string}${End}`;
29
- type InferredDelimiters<T extends string> = T extends WithDelimitedString<"[", "]"> ? {
30
- start: "[";
31
- end: "]";
32
- } : T extends WithDelimitedString<"{{", "}}"> ? {
33
- start: "{{";
34
- end: "}}";
35
- } : T extends WithDelimitedString<"{", "}"> ? {
36
- start: "{";
37
- end: "}";
38
- } : never;
39
- export type DynamicParams<T extends string, Separator extends string = InferredSeparator<T>, Delimiters extends GenericDelimiters = InferredDelimiters<T>> = string extends T ? Record<string, string> : T extends `${string}${Delimiters["start"]}${infer Param}${Delimiters["end"]}${Separator}${infer Rest}` ? {
40
- [k in Trim<Param> | keyof DynamicParams<Rest>]: string | number;
41
- } : T extends `${string}${Delimiters["start"]}${infer Param}${Delimiters["end"]}` ? {
42
- [k in Trim<Param>]: string | number;
43
- } : {};
44
- export type RouteStrictIdStatic<T extends string> = FilterOnlyStaticRouteId<T, InferredSeparator<T>, InferredDelimiters<T>>;
45
- export type RouteStrictIdDynamic<T extends string> = FilterOnlyDynamicRouteId<T, InferredSeparator<T>, InferredDelimiters<T>>;
46
- export type RouteStrictId<T extends string> = RouteStrictIdStatic<T> | RouteStrictIdDynamic<T>;
47
- export {};
48
- }
@@ -1,5 +0,0 @@
1
- export let formatRoutePathname = (e = "", t)=>{
2
- let { trailingSlash: a } = t || {};
3
- return e = ("/" + e + "/").replace(/\/+/g, "/"), a || (e = e.replace(/\/*$/, "")), e || "/";
4
- };
5
- export default formatRoutePathname;
package/client/index.js DELETED
@@ -1,3 +0,0 @@
1
- export { formatRoutePathname } from "./formatRoutePathname";
2
- export { interpolateTo } from "./interpolateTo";
3
- export { routeHasDynamicPortion } from "./routeHasDynamicPortion";
@@ -1,14 +0,0 @@
1
- import { getType as e } from "@koine/utils";
2
- import { formatRoutePathname as r } from "./formatRoutePathname";
3
- export function interpolateTo(t, o) {
4
- let i = t.replace(/\./g, "/");
5
- return "development" === process.env.NODE_ENV && o && i.replace(/[[{]{1,2}(.*?)[\]}]{1,2}/g, (r, i)=>{
6
- if (!(i in o)) throw Error("[@koine/i18n]::interpolateTo, using '" + t + "' without param '" + i + "'");
7
- if (![
8
- "string",
9
- "number"
10
- ].includes(typeof o[i])) throw Error("[@koine/i18n]::interpolateTo, using '" + t + "' with unserializable param '" + i + "' (type '" + e(o[i]) + "')");
11
- return "";
12
- }), r(i = i ? o ? i.replace(/[[{]{1,2}(.*?)[\]}]{1,2}/g, (e, r)=>o[r.trim()] + "") : i : "/");
13
- }
14
- export default interpolateTo;
@@ -1,2 +0,0 @@
1
- export let routeHasDynamicPortion = (t)=>/\[/.test(t);
2
- export default routeHasDynamicPortion;
package/compiler/api.js DELETED
@@ -1,18 +0,0 @@
1
- import { getCodeData as r, writeCode as i } from "./code";
2
- import { getConfig as t } from "./config";
3
- import { getInputData as e, writeInput as m } from "./input";
4
- import { getSummaryData as o, writeSummary as p } from "./summary";
5
- export let i18nCompiler = async (a)=>{
6
- let { input: u, code: w, summary: s, ...n } = a, f = [], l = await e(u), c = t(l, n), h = r(c, w, l);
7
- return u?.write && f.push(m(u.write, l)), w?.write && f.push(i({
8
- ...w,
9
- ...w.write
10
- }, h)), s?.write && f.push(p({
11
- ...s,
12
- ...s.write
13
- }, o(c, s, l))), await Promise.all(f), {
14
- config: c,
15
- input: l,
16
- code: h
17
- };
18
- };
@@ -1,99 +0,0 @@
1
- import { escapeRegExp as e, objectFlat as t, objectSort as a, objectSortByKeysMatching as l } from "@koine/utils";
2
- import { formatRoutePathname as n } from "../../client/formatRoutePathname";
3
- export const codeDataRoutesOptions = {
4
- translationJsonFileName: "~.json",
5
- fnsPrefix: "",
6
- tokens: {
7
- parentReference: "^",
8
- idDelimiter: ".",
9
- catchAll: {
10
- start: "[...",
11
- end: "]"
12
- },
13
- optionalCatchAll: {
14
- start: "[[...",
15
- end: "]]"
16
- }
17
- }
18
- };
19
- let r = (t, a)=>{
20
- let { idDelimiter: l, parentReference: n, catchAll: r, optionalCatchAll: d } = a.tokens;
21
- return {
22
- ...t,
23
- ...a,
24
- reg: {
25
- trailingDelimiter: RegExp(`${e(l)}+$`),
26
- indexEnd: RegExp(`${e(l)}index$`),
27
- parentReference: RegExp(`^/${e(n)}`),
28
- catchAll: RegExp(`${e(r.start)}(.+)${e(r.end)}$`),
29
- optionalCatchAll: RegExp(`${e(d.start)}(.+)${e(d.end)}$`)
30
- }
31
- };
32
- }, d = (e, { reg: t })=>{
33
- let a = e.replace(t.indexEnd, ""), l = t.optionalCatchAll.test(e), n = t.catchAll.test(e);
34
- return l && (a = a.replace(t.optionalCatchAll, "")), n && (a = a.replace(t.catchAll, "")), {
35
- routeId: a = a.replace(t.trailingDelimiter, ""),
36
- isCatchAll: n,
37
- isOptionalCatchAll: l
38
- };
39
- }, i = (e)=>n(e.replace(/\*/g, "").replace(/[[{]{1,2}(.*?)[\]}]{1,2}/g, (e, t)=>`[${t.trim()}]`)), s = (e)=>{
40
- let t = e.match(/\[.*?\]/g);
41
- if (t) return t.map((e)=>e.slice(1, -1).trim()).reduce((e, t)=>(e[t] = "stringOrNumber", e), {});
42
- }, p = (e, t, a, l, n)=>{
43
- let { tokens: { parentReference: r, idDelimiter: d }, reg: i } = t, s = e.byId[l], o = s.pathnames[a];
44
- if (o.startsWith(`/${r}`)) {
45
- o = o.replace(i.parentReference, "");
46
- let r = l.split(d).slice(0, -1).join(d);
47
- if (!n || n && n(s, r)) {
48
- if (r) o = p(e, t, a, r, n) + o;
49
- else throw Error("Used a parent route token reference without a matching parent route");
50
- }
51
- }
52
- return o;
53
- }, o = (e, t)=>{
54
- for(let a in e.byId)for(let l in e.byId[a].pathnames)e.byId[a].pathnames[l] = p(e, t, l, a);
55
- }, c = (e, t)=>{
56
- let a = (t, a)=>t.inWildcard && !e.wildcardIds.includes(a);
57
- for(let l in e.byId){
58
- let { inWildcard: n } = e.byId[l];
59
- if (n && e.byId[l].pathnamesSpa) for(let n in e.byId[l].pathnamesSpa)e.byId[l].pathnamesSpa[n] = p(e, t, n, l, a);
60
- else delete e.byId[l].pathnamesSpa;
61
- }
62
- }, m = (e, t)=>{
63
- let { defaultLocale: a, locales: n } = t;
64
- for(let t in e.byId){
65
- let r = e.byId[t].pathnames, d = r[a], i = {};
66
- for(let e in r){
67
- let t = r[e];
68
- t !== d && (i[e] = t);
69
- }
70
- Object.keys(i).length === n.length - 1 || (Object.keys(i).length >= 1 ? (i[a] = d, e.byId[t].pathnamesSlim = l(i, a)) : e.byId[t].pathnamesSlim = d);
71
- }
72
- }, h = (e)=>{
73
- if (e.wildcardIds.length) for(let t in e.byId)e.wildcardIds.some((e)=>t.startsWith(e) && e !== t) && (e.byId[t].inWildcard = !0);
74
- }, I = (e, n, r, p)=>{
75
- let o = t(e, r.tokens.idDelimiter);
76
- for(let e in o){
77
- let t = o[e], { routeId: a, isCatchAll: c, isOptionalCatchAll: m } = d(e, r);
78
- if (!p.byId[a]) {
79
- p.byId[a] = p.byId[a] || {};
80
- let e = s(a);
81
- p.byId[a].id = a, e && (p.byId[a].params = e), (c || m) && (p.byId[a].wildcard = !0, p.wildcardIds.push(a));
82
- }
83
- p.byId[a].pathnames = p.byId[a].pathnames || {}, p.byId[a].pathnames[n] = i(t), p.byId[a].pathnames = l(p.byId[a].pathnames, r.defaultLocale), p.byId[a].pathnamesSpa = {
84
- ...p.byId[a].pathnames
85
- };
86
- }
87
- p.byId = a(p.byId);
88
- };
89
- export let getCodeDataRoutes = (e, t, { translationFiles: a })=>{
90
- let l = {
91
- byId: {},
92
- wildcardIds: []
93
- }, n = r(e, t);
94
- for(let e = 0; e < a.length; e++){
95
- let { path: r, locale: d, data: i } = a[e];
96
- r === t.translationJsonFileName && I(i, d, n, l);
97
- }
98
- return h(l), c(l, n), o(l, n), m(l, n), l;
99
- };
@@ -1,86 +0,0 @@
1
- import { basename as e, dirname as t, extname as r, join as a, sep as l } from "node:path";
2
- import { minimatch as s } from "minimatch";
3
- import { forin as i, isArray as n, isObject as o, isPrimitive as p, isString as f, objectSort as m } from "@koine/utils";
4
- import { getPluralSuffix as u, isPluralKey as c, removePluralSuffix as d } from "../pluralisation";
5
- export const codeDataTranslationsOptions = {
6
- ignorePaths: [],
7
- dynamicDelimiters: {
8
- start: "{{",
9
- end: "}}"
10
- },
11
- fnsAsDataCodes: !0,
12
- fnsPrefix: "",
13
- createArrayIndexBasedFns: !1
14
- };
15
- let g = RegExp(l, "g"), v = (e)=>{
16
- let t = e.replace(/~/g, "$").replace(/-/g, "_").replace(g, "_").replace(/_+/g, "_").replace(/[^a-zA-Z0-9_$]/gi, "");
17
- return /^[0-9]/.test(t) ? "$" + t : t;
18
- }, h = (e, t)=>{
19
- if (f(t)) {
20
- let { start: r, end: a } = e.dynamicDelimiters, l = RegExp(`${r}(.*?)${a}`, "gm"), s = t.match(l);
21
- if (s) return s.map((e)=>e.replace(r, "").replace(a, "").trim()).reduce((e, t)=>(e[t] = "stringOrNumber", e), {});
22
- }
23
- }, y = (e, t, r = {})=>{
24
- if (p(t)) {
25
- let a = h(e, t);
26
- return a && (r = {
27
- ...r,
28
- ...a
29
- }), r;
30
- }
31
- if (n(t)) for(let a = 0; a < t.length; a++){
32
- let l = h(e, t[a]);
33
- l && (r = {
34
- ...r,
35
- ...l
36
- });
37
- }
38
- else for(let a in t){
39
- let l = y(e, t[a], r);
40
- l && (r = {
41
- ...r,
42
- ...l
43
- });
44
- }
45
- return {};
46
- }, _ = (e, t)=>(Object.keys(t).filter(c).forEach((r)=>{
47
- let a = d(r), l = u(r);
48
- if (t[a] = t[a] || {}, t[r]) {
49
- let s = t[a].values || {};
50
- i(t[r].values, (r, i)=>{
51
- s[r] = o(s[r]) ? s[r] : {}, s[r][l] = i;
52
- let n = y(e, i);
53
- n && (t[a].params = {
54
- ...t[a].params || {},
55
- ...n
56
- });
57
- }), Object.keys(s).length && (t[a].values = s, t[a].plural = !0), delete t[r];
58
- }
59
- }), t), x = (e, t, r, a, l)=>{
60
- if (p(a)) {
61
- l[t] = l[t] || {}, l[t].values = l[t].values || {}, l[t].values[r] = a, l[t].typeValue = "Primitive";
62
- let s = h(e, a);
63
- s && (l[t].params = s);
64
- } else {
65
- if (e.fnsAsDataCodes) {
66
- let e = n(a) ? "Array" : "Object";
67
- l[t] = l[t] || {}, l[t].values = l[t].values || {}, l[t].values[r] = a, l[t].typeValue = e;
68
- }
69
- if (n(a)) {
70
- if (e.createArrayIndexBasedFns) for(let s = 0; s < a.length; s++)x(e, t + "_" + s, r, a[s], l);
71
- } else for(let s in a)x(e, t + "_" + v(s), r, a[s], l);
72
- }
73
- return l;
74
- }, A = (l, s, i)=>{
75
- let { locale: n, path: o } = s, p = a(t(o), e(o, r(o)));
76
- for(let e in s.data){
77
- let t = s.data[e];
78
- x(l, v(p + (e ? "_" + e : "")), n, t, i);
79
- }
80
- return i;
81
- };
82
- export let getCodeDataTranslations = (e, t, { translationFiles: r })=>{
83
- let { ignorePaths: a } = t, l = {};
84
- for(let e = 0; e < r.length; e++)(!a || a && a.every((t)=>!s(r[e].path, t))) && A(t, r[e], l);
85
- return m(l = _(t, l));
86
- };
@@ -1,20 +0,0 @@
1
- import { objectMergeWithDefaults as t } from "@koine/utils";
2
- import { codeDataRoutesOptions as o, getCodeDataRoutes as a } from "./data-routes";
3
- import { codeDataTranslationsOptions as s, getCodeDataTranslations as r } from "./data-translations";
4
- let e = {
5
- routes: o,
6
- translations: s
7
- };
8
- export let getCodeData = (o, s, l)=>{
9
- let n = t(e, s);
10
- return n.translations.ignorePaths.push(n.routes.translationJsonFileName), l = {
11
- ...l,
12
- localesFolders: l.localesFolders.sort((t, a)=>o.defaultLocale ? -1 : t.localeCompare(a))
13
- }, {
14
- config: o,
15
- options: n,
16
- input: l,
17
- routes: a(o, n.routes, l),
18
- translations: r(o, n.translations, l)
19
- };
20
- };
@@ -1,46 +0,0 @@
1
- import { isPromise as e } from "@koine/utils";
2
- import t from "../../adapter-js/code";
3
- import a from "../../adapter-next-translate/code";
4
- import n from "../../adapter-next/code";
5
- let r = {
6
- js: t,
7
- next: n,
8
- "next-translate": a
9
- }, o = (e)=>{
10
- let t = "";
11
- return e.filter((e)=>e.index).sort((e, t)=>e.name.localeCompare(t.name)).forEach((e)=>{
12
- t += `export * from "./${e.name}";\n`;
13
- }), t;
14
- }, s = async (t, a, n = [])=>{
15
- let o = (0, r[a])(t), d = e(o) ? await o : o;
16
- return n = n.concat(d), d.dependsOn && await Promise.all(d.dependsOn.map(async (e)=>{
17
- n = n.concat(await s(t, e));
18
- })), n;
19
- }, d = (t, a, n = [])=>{
20
- let o = (0, r[a])(t);
21
- return e(o) ? console.warn(`i18nCompiler: unsupported use of async adapter '${a}'`, "Please use the sync api") : (n = n.concat(o), o.dependsOn && o.dependsOn.forEach((e)=>{
22
- n = n.concat(d(t, e));
23
- })), n;
24
- }, l = (e, t, a)=>{
25
- let { outputFiles: n } = t, r = a.reduce((e, t)=>[
26
- ...e,
27
- ...t.files
28
- ], []).map((t)=>{
29
- let { fn: a, ...r } = t, o = n?.[r.name] || r.name;
30
- return {
31
- ...r,
32
- name: o,
33
- content: a(e)
34
- };
35
- });
36
- return o(r) && r.push({
37
- name: "index",
38
- ext: "ts",
39
- content: o(r)
40
- }), {
41
- files: r,
42
- needsTranslationsFiles: a.some((e)=>e.needsTranslationsFiles)
43
- };
44
- };
45
- export let generateCode = async (e, t)=>l(e, t, await s(e, t.adapter));
46
- export let generateCodeSync = (e, t)=>l(e, t, d(e, t.adapter));
@@ -1,2 +0,0 @@
1
- export { writeCode, writeCodeSync } from "./write";
2
- export { getCodeData } from "./data";
@@ -1,27 +0,0 @@
1
- import { join as e } from "node:path";
2
- import * as t from "typescript";
3
- export let tsCompile = (o, i, s, r)=>{
4
- let l = Array.from(s).filter((e)=>e.endsWith(".ts") || e.endsWith(".tsx")).map((t)=>e(o, i, t)), n = {
5
- noEmitOnError: !0,
6
- noImplicitAny: !0,
7
- declaration: !0,
8
- target: t.ScriptTarget.ESNext,
9
- module: t.ModuleKind.ESNext,
10
- moduleResolution: t.ModuleResolutionKind.Bundler,
11
- resolveJsonModule: !0,
12
- allowJs: !1,
13
- esModuleInterop: !0,
14
- jsx: t.JsxEmit.ReactJSX,
15
- outDir: e(o, i),
16
- skipLibCheck: !0,
17
- noEmitHelpers: !0,
18
- importHelpers: !0,
19
- ...r || {}
20
- }, a = t.createProgram(l, n), m = a.emit();
21
- return t.getPreEmitDiagnostics(a).concat(m.diagnostics).forEach((e)=>{
22
- if (e.file) {
23
- let { line: o, character: i } = t.getLineAndCharacterOfPosition(e.file, e.start), s = t.flattenDiagnosticMessageText(e.messageText, "\n");
24
- console.log(`${e.file.fileName} (${o + 1},${i + 1}): ${s}`);
25
- } else console.log(t.flattenDiagnosticMessageText(e.messageText, "\n"));
26
- }), m;
27
- };
@@ -1,39 +0,0 @@
1
- import { rmSync as e } from "node:fs";
2
- import { join as t } from "node:path";
3
- import { fsWrite as a, fsWriteSync as r } from "@koine/node";
4
- import { generateCode as s, generateCodeSync as i } from "./generate";
5
- import { tsCompile as o } from "./tsCompile";
6
- let n = async (e, r, s, i)=>Promise.all(s.files.map(async ({ name: s, ext: o, content: n })=>{
7
- let l = `${s}.${o}`, d = t(e, r, l);
8
- await a(d, n), i.add(l);
9
- })), l = (e, a, s, i)=>s.files.map(({ name: s, ext: o, content: n })=>{
10
- let l = `${s}.${o}`;
11
- r(t(e, a, l), n), i.add(l);
12
- }), d = (a, r, s)=>{
13
- let i = Array.from(s).filter((e)=>e.endsWith(".ts") || e.endsWith(".tsx"));
14
- o(a, r, i), i.forEach((i)=>{
15
- s.add(i.replace(/\.tsx?$/, ".js")), s.add(i.replace(/\.tsx?$/, ".d.ts")), s.delete(i), e(t(a, r, i), {
16
- force: !0
17
- });
18
- });
19
- }, m = async (e, r, { translationFiles: s }, i)=>Promise.all(s.map(async ({ data: s, locale: o, path: n })=>{
20
- let l = t("translations", o);
21
- await a(t(e, r, l, n), JSON.stringify(s)), i.add(l);
22
- })), p = (e, a, { translationFiles: s }, i)=>s.forEach(({ data: s, locale: o, path: n })=>{
23
- let l = t("translations", o);
24
- r(t(e, a, l, n), JSON.stringify(s)), i.add(l);
25
- }), f = (e, a, r, s)=>[
26
- t(e, a, ".gitignore"),
27
- Array.from(new Set([
28
- ...r,
29
- ...s
30
- ])).sort().map((e)=>`/${e}`).join(`\n`)
31
- ];
32
- export let writeCode = async (e, t)=>{
33
- let { cwd: r = process.cwd(), output: i, skipTsCompile: o, skipGitignore: l, skipTranslations: p, ...c } = e, w = await s(t, c), y = new Set(), S = new Set();
34
- await n(r, i, w, y), o || d(r, i, y), w.needsTranslationsFiles && !p && await m(r, i, t.input, S), l || await a(...f(r, i, S, y));
35
- };
36
- export let writeCodeSync = (e, t)=>{
37
- let { cwd: a = process.cwd(), output: s, skipTsCompile: o, skipGitignore: n, skipTranslations: m, ...c } = e, w = i(t, c), y = new Set(), S = new Set();
38
- l(a, s, w, y), o || d(a, s, y), w.needsTranslationsFiles && !m && p(a, s, t.input, S), n || r(...f(a, s, S, y));
39
- };
@@ -1,13 +0,0 @@
1
- import { objectMergeWithDefaults as l } from "@koine/utils";
2
- export const configDefaults = {
3
- locales: [
4
- "en"
5
- ],
6
- defaultLocale: "en",
7
- hideDefaultLocaleInUrl: !0
8
- };
9
- export let getConfig = (e, o = {})=>{
10
- o.locales = o.locales || e.localesFolders, o.defaultLocale = o.defaultLocale || o.locales?.[0], o.hideDefaultLocaleInUrl = !!o.hideDefaultLocaleInUrl;
11
- let a = l(configDefaults, o);
12
- return a.locales = a.locales.sort((l, e)=>a.defaultLocale ? -1 : l.localeCompare(e)), a;
13
- };
@@ -1,14 +0,0 @@
1
- export let dataParamsToTsInterfaceBody = (e)=>Object.keys(e).reduce((r, t)=>{
2
- let a = e[t], s = "";
3
- switch(a){
4
- case "number":
5
- s = "number";
6
- break;
7
- case "string":
8
- s = "string";
9
- break;
10
- default:
11
- s = "string | number";
12
- }
13
- return r.push(`${t}: ${s};`), r;
14
- }, []).join(" ");
@@ -1,60 +0,0 @@
1
- import { readFileSync as e } from "node:fs";
2
- import { readFile as t } from "node:fs/promises";
3
- import { join as a } from "node:path";
4
- import { glob as o, globSync as r } from "glob";
5
- let l = (e)=>{
6
- let { cwd: t, ignore: a } = e;
7
- return o.sync("*", {
8
- cwd: t,
9
- withFileTypes: !0,
10
- ignore: [
11
- ...a,
12
- "node_modules/**"
13
- ]
14
- }).filter((e)=>e.isDirectory()).map((e)=>e.relative()).sort((e, t)=>e.localeCompare(t));
15
- };
16
- export let getInputDataLocal = async (e)=>{
17
- let { cwd: r = process.cwd(), ignore: s = [], source: p } = e, i = a(r, p), c = l({
18
- cwd: i,
19
- ignore: s
20
- }), n = [];
21
- return await Promise.all(c.map(async (r)=>{
22
- let l = await o("**/*.json", {
23
- cwd: a(i, r),
24
- ignore: e.ignore
25
- });
26
- await Promise.all(l.map(async (e)=>{
27
- let o = a(i, r, e), l = await t(o, "utf8");
28
- l && n.push({
29
- path: e,
30
- data: JSON.parse(l),
31
- locale: r
32
- });
33
- }));
34
- })), {
35
- localesFolders: c,
36
- translationFiles: n
37
- };
38
- };
39
- export let getInputDataLocalSync = (t)=>{
40
- let { cwd: o = process.cwd(), ignore: s = [], source: p } = t, i = a(o, p), c = l({
41
- cwd: i,
42
- ignore: s
43
- }), n = [];
44
- return c.forEach((o)=>{
45
- r("**/*.json", {
46
- cwd: a(i, o),
47
- ignore: t.ignore
48
- }).forEach((t)=>{
49
- let r = e(a(i, o, t), "utf8");
50
- r && n.push({
51
- path: t,
52
- data: JSON.parse(r),
53
- locale: o
54
- });
55
- });
56
- }), {
57
- localesFolders: c,
58
- translationFiles: n
59
- };
60
- };
@@ -1,41 +0,0 @@
1
- import { request as e } from "node:https";
2
- import { minimatch as t } from "minimatch";
3
- let r = (e, r)=>{
4
- let { ignore: l = [], source: o } = e;
5
- try {
6
- let e = JSON.parse(r);
7
- return {
8
- ...e,
9
- localesFolders: l.length ? e.localesFolders.filter((e)=>l.every((r)=>!t(e, r))) : e.localesFolders,
10
- translationFiles: l.length ? e.translationFiles.filter((e)=>l.every((r)=>!t(e.path, r))) : e.translationFiles
11
- };
12
- } catch (e) {
13
- throw Error(`Failed to parse JSON from ${o}`);
14
- }
15
- };
16
- export let getInputDataRemote = async (r)=>new Promise((l, o)=>{
17
- let { ignore: a = [], source: s } = r, n = s.startsWith("https://raw.githubusercontent.com"), i = "", c = e(s, n ? {} : {
18
- headers: {
19
- Accept: "application/json"
20
- }
21
- }, (e)=>{
22
- e.setEncoding("utf8"), e.on("data", (e)=>{
23
- i += e;
24
- }), e.on("end", ()=>{
25
- try {
26
- let e = n ? JSON.parse(i) : i;
27
- l({
28
- ...e,
29
- localesFolders: a.length ? e.localesFolders.filter((e)=>a.every((r)=>!t(e, r))) : e.localesFolders,
30
- translationFiles: a.length ? e.translationFiles.filter((e)=>a.every((r)=>!t(e.path, r))) : e.translationFiles
31
- });
32
- } catch (e) {
33
- throw Error(`Failed to parse JSON from ${s}`);
34
- }
35
- });
36
- });
37
- c.on("error", (e)=>{
38
- console.error(e), o("");
39
- }), c.end();
40
- });
41
- export let getInputDataRemoteSync = (e)=>r(e, "{}");
@@ -1,11 +0,0 @@
1
- import { isAbsoluteUrl as t } from "next/dist/shared/lib/utils";
2
- import { getInputDataLocal as a, getInputDataLocalSync as e } from "./data-local";
3
- import { getInputDataRemote as r, getInputDataRemoteSync as o } from "./data-remote";
4
- export let getInputData = async (e)=>{
5
- let { source: o } = e;
6
- return t(o) ? await r(e) : await a(e);
7
- };
8
- export let getInputDataSync = (a)=>{
9
- let { source: r } = a;
10
- return t(r) ? o(a) : e(a);
11
- };
@@ -1,3 +0,0 @@
1
- export { writeInput, writeInputSync } from "./write";
2
- export { getInputData, getInputDataSync } from "./data";
3
- export { getInputDataLocal, getInputDataLocalSync } from "./data-local";
@@ -1 +0,0 @@
1
- export { };
@@ -1,15 +0,0 @@
1
- import { join as t } from "node:path";
2
- import { fsWrite as e, fsWriteSync as r } from "@koine/node";
3
- let n = (e, r)=>{
4
- let { cwd: n = process.cwd(), output: i, pretty: o } = e;
5
- return [
6
- t(n, i),
7
- o ? JSON.stringify(r, null, 2) : JSON.stringify(r)
8
- ];
9
- };
10
- export let writeInput = async (t, r)=>{
11
- await e(...n(t, r));
12
- };
13
- export let writeInputSync = (t, e)=>{
14
- r(...n(t, e));
15
- };