@sebbro/paraglide-lite 0.1.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 (715) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -0
  3. package/bin/run.js +4 -0
  4. package/dist/bundler-plugins/esbuild.d.ts +1 -0
  5. package/dist/bundler-plugins/esbuild.d.ts.map +1 -0
  6. package/dist/bundler-plugins/esbuild.js +4 -0
  7. package/dist/bundler-plugins/esbuild.js.map +1 -0
  8. package/dist/bundler-plugins/index.d.ts +6 -0
  9. package/dist/bundler-plugins/index.d.ts.map +1 -0
  10. package/dist/bundler-plugins/index.js +7 -0
  11. package/dist/bundler-plugins/index.js.map +1 -0
  12. package/dist/bundler-plugins/lazy-modules/scan-message-keys.d.ts +19 -0
  13. package/dist/bundler-plugins/lazy-modules/scan-message-keys.d.ts.map +1 -0
  14. package/dist/bundler-plugins/lazy-modules/scan-message-keys.js +85 -0
  15. package/dist/bundler-plugins/lazy-modules/scan-message-keys.js.map +1 -0
  16. package/dist/bundler-plugins/lazy-modules/scan-message-keys.test.d.ts +2 -0
  17. package/dist/bundler-plugins/lazy-modules/scan-message-keys.test.d.ts.map +1 -0
  18. package/dist/bundler-plugins/lazy-modules/scan-message-keys.test.js +53 -0
  19. package/dist/bundler-plugins/lazy-modules/scan-message-keys.test.js.map +1 -0
  20. package/dist/bundler-plugins/lazy-modules/ssr.d.ts +31 -0
  21. package/dist/bundler-plugins/lazy-modules/ssr.d.ts.map +1 -0
  22. package/dist/bundler-plugins/lazy-modules/ssr.js +42 -0
  23. package/dist/bundler-plugins/lazy-modules/ssr.js.map +1 -0
  24. package/dist/bundler-plugins/lazy-modules/ssr.test.d.ts +2 -0
  25. package/dist/bundler-plugins/lazy-modules/ssr.test.d.ts.map +1 -0
  26. package/dist/bundler-plugins/lazy-modules/ssr.test.js +48 -0
  27. package/dist/bundler-plugins/lazy-modules/ssr.test.js.map +1 -0
  28. package/dist/bundler-plugins/lazy-modules/virtual-ids.d.ts +7 -0
  29. package/dist/bundler-plugins/lazy-modules/virtual-ids.d.ts.map +1 -0
  30. package/dist/bundler-plugins/lazy-modules/virtual-ids.js +30 -0
  31. package/dist/bundler-plugins/lazy-modules/virtual-ids.js.map +1 -0
  32. package/dist/bundler-plugins/lazy-modules/virtual.d.ts +86 -0
  33. package/dist/bundler-plugins/lazy-modules/virtual.d.ts.map +1 -0
  34. package/dist/bundler-plugins/lazy-modules/virtual.js +2 -0
  35. package/dist/bundler-plugins/lazy-modules/virtual.js.map +1 -0
  36. package/dist/bundler-plugins/lazy-modules/vite-plugin.d.ts +18 -0
  37. package/dist/bundler-plugins/lazy-modules/vite-plugin.d.ts.map +1 -0
  38. package/dist/bundler-plugins/lazy-modules/vite-plugin.js +328 -0
  39. package/dist/bundler-plugins/lazy-modules/vite-plugin.js.map +1 -0
  40. package/dist/bundler-plugins/lazy-modules/vite-plugin.test.d.ts +2 -0
  41. package/dist/bundler-plugins/lazy-modules/vite-plugin.test.d.ts.map +1 -0
  42. package/dist/bundler-plugins/lazy-modules/vite-plugin.test.js +45 -0
  43. package/dist/bundler-plugins/lazy-modules/vite-plugin.test.js.map +1 -0
  44. package/dist/bundler-plugins/per-locale-build/constants.d.ts +2 -0
  45. package/dist/bundler-plugins/per-locale-build/constants.d.ts.map +1 -0
  46. package/dist/bundler-plugins/per-locale-build/constants.js +3 -0
  47. package/dist/bundler-plugins/per-locale-build/constants.js.map +1 -0
  48. package/dist/bundler-plugins/per-locale-build/index.d.ts +6 -0
  49. package/dist/bundler-plugins/per-locale-build/index.d.ts.map +1 -0
  50. package/dist/bundler-plugins/per-locale-build/index.js +43 -0
  51. package/dist/bundler-plugins/per-locale-build/index.js.map +1 -0
  52. package/dist/bundler-plugins/per-locale-build/locale-id.d.ts +8 -0
  53. package/dist/bundler-plugins/per-locale-build/locale-id.d.ts.map +1 -0
  54. package/dist/bundler-plugins/per-locale-build/locale-id.js +13 -0
  55. package/dist/bundler-plugins/per-locale-build/locale-id.js.map +1 -0
  56. package/dist/bundler-plugins/per-locale-build/types.d.ts +4 -0
  57. package/dist/bundler-plugins/per-locale-build/types.d.ts.map +1 -0
  58. package/dist/bundler-plugins/per-locale-build/types.js +2 -0
  59. package/dist/bundler-plugins/per-locale-build/types.js.map +1 -0
  60. package/dist/bundler-plugins/per-locale-build/vite-environments.d.ts +51 -0
  61. package/dist/bundler-plugins/per-locale-build/vite-environments.d.ts.map +1 -0
  62. package/dist/bundler-plugins/per-locale-build/vite-environments.js +250 -0
  63. package/dist/bundler-plugins/per-locale-build/vite-environments.js.map +1 -0
  64. package/dist/bundler-plugins/per-locale-build/vite-environments.test.d.ts +1 -0
  65. package/dist/bundler-plugins/per-locale-build/vite-environments.test.d.ts.map +1 -0
  66. package/dist/bundler-plugins/per-locale-build/vite-environments.test.js +250 -0
  67. package/dist/bundler-plugins/per-locale-build/vite-environments.test.js.map +1 -0
  68. package/dist/bundler-plugins/plugin-core.d.ts +74 -0
  69. package/dist/bundler-plugins/plugin-core.d.ts.map +1 -0
  70. package/dist/bundler-plugins/plugin-core.js +292 -0
  71. package/dist/bundler-plugins/plugin-core.js.map +1 -0
  72. package/dist/bundler-plugins/rolldown.d.ts +10 -0
  73. package/dist/bundler-plugins/rolldown.d.ts.map +1 -0
  74. package/dist/bundler-plugins/rolldown.js +36 -0
  75. package/dist/bundler-plugins/rolldown.js.map +1 -0
  76. package/dist/bundler-plugins/rolldown.test.d.ts +1 -0
  77. package/dist/bundler-plugins/rolldown.test.d.ts.map +1 -0
  78. package/dist/bundler-plugins/rolldown.test.js +72 -0
  79. package/dist/bundler-plugins/rolldown.test.js.map +1 -0
  80. package/dist/bundler-plugins/rollup.d.ts +1 -0
  81. package/dist/bundler-plugins/rollup.d.ts.map +1 -0
  82. package/dist/bundler-plugins/rollup.js +4 -0
  83. package/dist/bundler-plugins/rollup.js.map +1 -0
  84. package/dist/bundler-plugins/rspack.d.ts +1 -0
  85. package/dist/bundler-plugins/rspack.d.ts.map +1 -0
  86. package/dist/bundler-plugins/rspack.js +4 -0
  87. package/dist/bundler-plugins/rspack.js.map +1 -0
  88. package/dist/bundler-plugins/unplugin.d.ts +3 -0
  89. package/dist/bundler-plugins/unplugin.d.ts.map +1 -0
  90. package/dist/bundler-plugins/unplugin.js +62 -0
  91. package/dist/bundler-plugins/unplugin.js.map +1 -0
  92. package/dist/bundler-plugins/unplugin.test.d.ts +1 -0
  93. package/dist/bundler-plugins/unplugin.test.d.ts.map +1 -0
  94. package/dist/bundler-plugins/unplugin.test.js +256 -0
  95. package/dist/bundler-plugins/unplugin.test.js.map +1 -0
  96. package/dist/bundler-plugins/virtual-modules.test.d.ts +1 -0
  97. package/dist/bundler-plugins/virtual-modules.test.d.ts.map +1 -0
  98. package/dist/bundler-plugins/virtual-modules.test.js +77 -0
  99. package/dist/bundler-plugins/virtual-modules.test.js.map +1 -0
  100. package/dist/bundler-plugins/vite.d.ts +17 -0
  101. package/dist/bundler-plugins/vite.d.ts.map +1 -0
  102. package/dist/bundler-plugins/vite.js +15 -0
  103. package/dist/bundler-plugins/vite.js.map +1 -0
  104. package/dist/bundler-plugins/vite.test.d.ts +1 -0
  105. package/dist/bundler-plugins/vite.test.d.ts.map +1 -0
  106. package/dist/bundler-plugins/vite.test.js +61 -0
  107. package/dist/bundler-plugins/vite.test.js.map +1 -0
  108. package/dist/bundler-plugins/webpack.d.ts +1 -0
  109. package/dist/bundler-plugins/webpack.d.ts.map +1 -0
  110. package/dist/bundler-plugins/webpack.js +4 -0
  111. package/dist/bundler-plugins/webpack.js.map +1 -0
  112. package/dist/cli/commands/compile/command.d.ts +2 -0
  113. package/dist/cli/commands/compile/command.d.ts.map +1 -0
  114. package/dist/cli/commands/compile/command.js +225 -0
  115. package/dist/cli/commands/compile/command.js.map +1 -0
  116. package/dist/cli/commands/compile/command.test.d.ts +1 -0
  117. package/dist/cli/commands/compile/command.test.d.ts.map +1 -0
  118. package/dist/cli/commands/compile/command.test.js +69 -0
  119. package/dist/cli/commands/compile/command.test.js.map +1 -0
  120. package/dist/cli/commands/init/command.d.ts +2 -0
  121. package/dist/cli/commands/init/command.d.ts.map +1 -0
  122. package/dist/cli/commands/init/command.js +90 -0
  123. package/dist/cli/commands/init/command.js.map +1 -0
  124. package/dist/cli/defaults.d.ts +11 -0
  125. package/dist/cli/defaults.d.ts.map +1 -0
  126. package/dist/cli/defaults.js +13 -0
  127. package/dist/cli/defaults.js.map +1 -0
  128. package/dist/cli/index.d.ts +2 -0
  129. package/dist/cli/index.d.ts.map +1 -0
  130. package/dist/cli/index.js +11 -0
  131. package/dist/cli/index.js.map +1 -0
  132. package/dist/cli/steps/add-vite-plugin.d.ts +31 -0
  133. package/dist/cli/steps/add-vite-plugin.d.ts.map +1 -0
  134. package/dist/cli/steps/add-vite-plugin.js +65 -0
  135. package/dist/cli/steps/add-vite-plugin.js.map +1 -0
  136. package/dist/cli/steps/add-vite-plugin.test.d.ts +1 -0
  137. package/dist/cli/steps/add-vite-plugin.test.d.ts.map +1 -0
  138. package/dist/cli/steps/add-vite-plugin.test.js +74 -0
  139. package/dist/cli/steps/add-vite-plugin.test.js.map +1 -0
  140. package/dist/cli/steps/check-for-uncomitted-changes.d.ts +5 -0
  141. package/dist/cli/steps/check-for-uncomitted-changes.d.ts.map +1 -0
  142. package/dist/cli/steps/check-for-uncomitted-changes.js +37 -0
  143. package/dist/cli/steps/check-for-uncomitted-changes.js.map +1 -0
  144. package/dist/cli/steps/detect-bundler.d.ts +10 -0
  145. package/dist/cli/steps/detect-bundler.d.ts.map +1 -0
  146. package/dist/cli/steps/detect-bundler.js +22 -0
  147. package/dist/cli/steps/detect-bundler.js.map +1 -0
  148. package/dist/cli/steps/detect-bundler.test.d.ts +1 -0
  149. package/dist/cli/steps/detect-bundler.test.d.ts.map +1 -0
  150. package/dist/cli/steps/detect-bundler.test.js +29 -0
  151. package/dist/cli/steps/detect-bundler.test.js.map +1 -0
  152. package/dist/cli/steps/initialize-messages.d.ts +11 -0
  153. package/dist/cli/steps/initialize-messages.d.ts.map +1 -0
  154. package/dist/cli/steps/initialize-messages.js +31 -0
  155. package/dist/cli/steps/initialize-messages.js.map +1 -0
  156. package/dist/cli/steps/prompt-for-outdir.d.ts +8 -0
  157. package/dist/cli/steps/prompt-for-outdir.d.ts.map +1 -0
  158. package/dist/cli/steps/prompt-for-outdir.js +19 -0
  159. package/dist/cli/steps/prompt-for-outdir.js.map +1 -0
  160. package/dist/cli/steps/update-package-json.d.ts +11 -0
  161. package/dist/cli/steps/update-package-json.d.ts.map +1 -0
  162. package/dist/cli/steps/update-package-json.js +34 -0
  163. package/dist/cli/steps/update-package-json.js.map +1 -0
  164. package/dist/cli/steps/update-ts-config.d.ts +26 -0
  165. package/dist/cli/steps/update-ts-config.d.ts.map +1 -0
  166. package/dist/cli/steps/update-ts-config.js +270 -0
  167. package/dist/cli/steps/update-ts-config.js.map +1 -0
  168. package/dist/cli/steps/update-ts-config.test.d.ts +1 -0
  169. package/dist/cli/steps/update-ts-config.test.d.ts.map +1 -0
  170. package/dist/cli/steps/update-ts-config.test.js +60 -0
  171. package/dist/cli/steps/update-ts-config.test.js.map +1 -0
  172. package/dist/cli/utils.d.ts +36 -0
  173. package/dist/cli/utils.d.ts.map +1 -0
  174. package/dist/cli/utils.js +20 -0
  175. package/dist/cli/utils.js.map +1 -0
  176. package/dist/compiler/assert-url-pattern-available.d.ts +7 -0
  177. package/dist/compiler/assert-url-pattern-available.d.ts.map +1 -0
  178. package/dist/compiler/assert-url-pattern-available.js +17 -0
  179. package/dist/compiler/assert-url-pattern-available.js.map +1 -0
  180. package/dist/compiler/compile-annotation.d.ts +12 -0
  181. package/dist/compiler/compile-annotation.d.ts.map +1 -0
  182. package/dist/compiler/compile-annotation.js +136 -0
  183. package/dist/compiler/compile-annotation.js.map +1 -0
  184. package/dist/compiler/compile-bundle.d.ts +28 -0
  185. package/dist/compiler/compile-bundle.d.ts.map +1 -0
  186. package/dist/compiler/compile-bundle.js +431 -0
  187. package/dist/compiler/compile-bundle.js.map +1 -0
  188. package/dist/compiler/compile-bundle.test.d.ts +1 -0
  189. package/dist/compiler/compile-bundle.test.d.ts.map +1 -0
  190. package/dist/compiler/compile-bundle.test.js +399 -0
  191. package/dist/compiler/compile-bundle.test.js.map +1 -0
  192. package/dist/compiler/compile-local-variable.d.ts +16 -0
  193. package/dist/compiler/compile-local-variable.d.ts.map +1 -0
  194. package/dist/compiler/compile-local-variable.js +28 -0
  195. package/dist/compiler/compile-local-variable.js.map +1 -0
  196. package/dist/compiler/compile-local-variable.test.d.ts +1 -0
  197. package/dist/compiler/compile-local-variable.test.d.ts.map +1 -0
  198. package/dist/compiler/compile-local-variable.test.js +359 -0
  199. package/dist/compiler/compile-local-variable.test.js.map +1 -0
  200. package/dist/compiler/compile-message.d.ts +8 -0
  201. package/dist/compiler/compile-message.d.ts.map +1 -0
  202. package/dist/compiler/compile-message.js +174 -0
  203. package/dist/compiler/compile-message.js.map +1 -0
  204. package/dist/compiler/compile-message.test.d.ts +1 -0
  205. package/dist/compiler/compile-message.test.d.ts.map +1 -0
  206. package/dist/compiler/compile-message.test.js +1060 -0
  207. package/dist/compiler/compile-message.test.js.map +1 -0
  208. package/dist/compiler/compile-pattern.d.ts +29 -0
  209. package/dist/compiler/compile-pattern.d.ts.map +1 -0
  210. package/dist/compiler/compile-pattern.js +143 -0
  211. package/dist/compiler/compile-pattern.js.map +1 -0
  212. package/dist/compiler/compile-pattern.test.d.ts +1 -0
  213. package/dist/compiler/compile-pattern.test.d.ts.map +1 -0
  214. package/dist/compiler/compile-pattern.test.js +255 -0
  215. package/dist/compiler/compile-pattern.test.js.map +1 -0
  216. package/dist/compiler/compile-project.d.ts +21 -0
  217. package/dist/compiler/compile-project.d.ts.map +1 -0
  218. package/dist/compiler/compile-project.js +147 -0
  219. package/dist/compiler/compile-project.js.map +1 -0
  220. package/dist/compiler/compile-project.test.d.ts +1 -0
  221. package/dist/compiler/compile-project.test.d.ts.map +1 -0
  222. package/dist/compiler/compile-project.test.js +1709 -0
  223. package/dist/compiler/compile-project.test.js.map +1 -0
  224. package/dist/compiler/compile.bench.d.ts +1 -0
  225. package/dist/compiler/compile.bench.d.ts.map +1 -0
  226. package/dist/compiler/compile.bench.js +89 -0
  227. package/dist/compiler/compile.bench.js.map +1 -0
  228. package/dist/compiler/compile.d.ts +24 -0
  229. package/dist/compiler/compile.d.ts.map +1 -0
  230. package/dist/compiler/compile.js +106 -0
  231. package/dist/compiler/compile.js.map +1 -0
  232. package/dist/compiler/compile.test.d.ts +1 -0
  233. package/dist/compiler/compile.test.d.ts.map +1 -0
  234. package/dist/compiler/compile.test.js +66 -0
  235. package/dist/compiler/compile.test.js.map +1 -0
  236. package/dist/compiler/compiler-options.d.ts +466 -0
  237. package/dist/compiler/compiler-options.d.ts.map +1 -0
  238. package/dist/compiler/compiler-options.js +22 -0
  239. package/dist/compiler/compiler-options.js.map +1 -0
  240. package/dist/compiler/create-paraglide.d.ts +21 -0
  241. package/dist/compiler/create-paraglide.d.ts.map +1 -0
  242. package/dist/compiler/create-paraglide.js +69 -0
  243. package/dist/compiler/create-paraglide.js.map +1 -0
  244. package/dist/compiler/create-paraglide.test.d.ts +1 -0
  245. package/dist/compiler/create-paraglide.test.d.ts.map +1 -0
  246. package/dist/compiler/create-paraglide.test.js +55 -0
  247. package/dist/compiler/create-paraglide.test.js.map +1 -0
  248. package/dist/compiler/create-readme.d.ts +9 -0
  249. package/dist/compiler/create-readme.d.ts.map +1 -0
  250. package/dist/compiler/create-readme.js +127 -0
  251. package/dist/compiler/create-readme.js.map +1 -0
  252. package/dist/compiler/emit-files.d.ts +15 -0
  253. package/dist/compiler/emit-files.d.ts.map +1 -0
  254. package/dist/compiler/emit-files.js +58 -0
  255. package/dist/compiler/emit-files.js.map +1 -0
  256. package/dist/compiler/emit-files.test.d.ts +1 -0
  257. package/dist/compiler/emit-files.test.d.ts.map +1 -0
  258. package/dist/compiler/emit-files.test.js +43 -0
  259. package/dist/compiler/emit-files.test.js.map +1 -0
  260. package/dist/compiler/emit-ts-declarations.d.ts +11 -0
  261. package/dist/compiler/emit-ts-declarations.d.ts.map +1 -0
  262. package/dist/compiler/emit-ts-declarations.interop.test.d.ts +1 -0
  263. package/dist/compiler/emit-ts-declarations.interop.test.d.ts.map +1 -0
  264. package/dist/compiler/emit-ts-declarations.interop.test.js +33 -0
  265. package/dist/compiler/emit-ts-declarations.interop.test.js.map +1 -0
  266. package/dist/compiler/emit-ts-declarations.js +353 -0
  267. package/dist/compiler/emit-ts-declarations.js.map +1 -0
  268. package/dist/compiler/emit-ts-declarations.test.d.ts +1 -0
  269. package/dist/compiler/emit-ts-declarations.test.d.ts.map +1 -0
  270. package/dist/compiler/emit-ts-declarations.test.js +161 -0
  271. package/dist/compiler/emit-ts-declarations.test.js.map +1 -0
  272. package/dist/compiler/index.d.ts +13 -0
  273. package/dist/compiler/index.d.ts.map +1 -0
  274. package/dist/compiler/index.js +11 -0
  275. package/dist/compiler/index.js.map +1 -0
  276. package/dist/compiler/jsdoc-types.d.ts +21 -0
  277. package/dist/compiler/jsdoc-types.d.ts.map +1 -0
  278. package/dist/compiler/jsdoc-types.js +59 -0
  279. package/dist/compiler/jsdoc-types.js.map +1 -0
  280. package/dist/compiler/jsdoc-types.test.d.ts +1 -0
  281. package/dist/compiler/jsdoc-types.test.d.ts.map +1 -0
  282. package/dist/compiler/jsdoc-types.test.js +100 -0
  283. package/dist/compiler/jsdoc-types.test.js.map +1 -0
  284. package/dist/compiler/lazy-modules/compile-cache.d.ts +37 -0
  285. package/dist/compiler/lazy-modules/compile-cache.d.ts.map +1 -0
  286. package/dist/compiler/lazy-modules/compile-cache.js +34 -0
  287. package/dist/compiler/lazy-modules/compile-cache.js.map +1 -0
  288. package/dist/compiler/lazy-modules/compile-project.lazy.test.d.ts +2 -0
  289. package/dist/compiler/lazy-modules/compile-project.lazy.test.d.ts.map +1 -0
  290. package/dist/compiler/lazy-modules/compile-project.lazy.test.js +65 -0
  291. package/dist/compiler/lazy-modules/compile-project.lazy.test.js.map +1 -0
  292. package/dist/compiler/lazy-modules/create-loader.d.ts +18 -0
  293. package/dist/compiler/lazy-modules/create-loader.d.ts.map +1 -0
  294. package/dist/compiler/lazy-modules/create-loader.js +182 -0
  295. package/dist/compiler/lazy-modules/create-loader.js.map +1 -0
  296. package/dist/compiler/lazy-modules/create-loader.test.d.ts +2 -0
  297. package/dist/compiler/lazy-modules/create-loader.test.d.ts.map +1 -0
  298. package/dist/compiler/lazy-modules/create-loader.test.js +82 -0
  299. package/dist/compiler/lazy-modules/create-loader.test.js.map +1 -0
  300. package/dist/compiler/lazy-modules/manifest.d.ts +32 -0
  301. package/dist/compiler/lazy-modules/manifest.d.ts.map +1 -0
  302. package/dist/compiler/lazy-modules/manifest.js +11 -0
  303. package/dist/compiler/lazy-modules/manifest.js.map +1 -0
  304. package/dist/compiler/match-literals.d.ts +2 -0
  305. package/dist/compiler/match-literals.d.ts.map +1 -0
  306. package/dist/compiler/match-literals.js +42 -0
  307. package/dist/compiler/match-literals.js.map +1 -0
  308. package/dist/compiler/output-structure/lazy-modules.d.ts +27 -0
  309. package/dist/compiler/output-structure/lazy-modules.d.ts.map +1 -0
  310. package/dist/compiler/output-structure/lazy-modules.js +157 -0
  311. package/dist/compiler/output-structure/lazy-modules.js.map +1 -0
  312. package/dist/compiler/output-structure/lazy-modules.test.d.ts +2 -0
  313. package/dist/compiler/output-structure/lazy-modules.test.d.ts.map +1 -0
  314. package/dist/compiler/output-structure/lazy-modules.test.js +128 -0
  315. package/dist/compiler/output-structure/lazy-modules.test.js.map +1 -0
  316. package/dist/compiler/output-structure/locale-modules.d.ts +4 -0
  317. package/dist/compiler/output-structure/locale-modules.d.ts.map +1 -0
  318. package/dist/compiler/output-structure/locale-modules.js +81 -0
  319. package/dist/compiler/output-structure/locale-modules.js.map +1 -0
  320. package/dist/compiler/output-structure/locale-modules.test.d.ts +1 -0
  321. package/dist/compiler/output-structure/locale-modules.test.d.ts.map +1 -0
  322. package/dist/compiler/output-structure/locale-modules.test.js +163 -0
  323. package/dist/compiler/output-structure/locale-modules.test.js.map +1 -0
  324. package/dist/compiler/output-structure/message-modules.d.ts +4 -0
  325. package/dist/compiler/output-structure/message-modules.d.ts.map +1 -0
  326. package/dist/compiler/output-structure/message-modules.js +100 -0
  327. package/dist/compiler/output-structure/message-modules.js.map +1 -0
  328. package/dist/compiler/output-structure/message-modules.test.d.ts +1 -0
  329. package/dist/compiler/output-structure/message-modules.test.d.ts.map +1 -0
  330. package/dist/compiler/output-structure/message-modules.test.js +148 -0
  331. package/dist/compiler/output-structure/message-modules.test.js.map +1 -0
  332. package/dist/compiler/per-locale-build.d.ts +2 -0
  333. package/dist/compiler/per-locale-build.d.ts.map +1 -0
  334. package/dist/compiler/per-locale-build.js +3 -0
  335. package/dist/compiler/per-locale-build.js.map +1 -0
  336. package/dist/compiler/registry.d.ts +13 -0
  337. package/dist/compiler/registry.d.ts.map +1 -0
  338. package/dist/compiler/registry.js +60 -0
  339. package/dist/compiler/registry.js.map +1 -0
  340. package/dist/compiler/resolve-tsc-js-path.d.ts +9 -0
  341. package/dist/compiler/resolve-tsc-js-path.d.ts.map +1 -0
  342. package/dist/compiler/resolve-tsc-js-path.js +23 -0
  343. package/dist/compiler/resolve-tsc-js-path.js.map +1 -0
  344. package/dist/compiler/runtime/check-locale.d.ts +31 -0
  345. package/dist/compiler/runtime/check-locale.d.ts.map +1 -0
  346. package/dist/compiler/runtime/check-locale.js +51 -0
  347. package/dist/compiler/runtime/check-locale.js.map +1 -0
  348. package/dist/compiler/runtime/check-locale.test.d.ts +1 -0
  349. package/dist/compiler/runtime/check-locale.test.d.ts.map +1 -0
  350. package/dist/compiler/runtime/check-locale.test.js +84 -0
  351. package/dist/compiler/runtime/check-locale.test.js.map +1 -0
  352. package/dist/compiler/runtime/create-runtime.d.ts +35 -0
  353. package/dist/compiler/runtime/create-runtime.d.ts.map +1 -0
  354. package/dist/compiler/runtime/create-runtime.js +196 -0
  355. package/dist/compiler/runtime/create-runtime.js.map +1 -0
  356. package/dist/compiler/runtime/extract-locale-from-cookie.d.ts +13 -0
  357. package/dist/compiler/runtime/extract-locale-from-cookie.d.ts.map +1 -0
  358. package/dist/compiler/runtime/extract-locale-from-cookie.js +43 -0
  359. package/dist/compiler/runtime/extract-locale-from-cookie.js.map +1 -0
  360. package/dist/compiler/runtime/extract-locale-from-cookie.test.d.ts +1 -0
  361. package/dist/compiler/runtime/extract-locale-from-cookie.test.d.ts.map +1 -0
  362. package/dist/compiler/runtime/extract-locale-from-cookie.test.js +149 -0
  363. package/dist/compiler/runtime/extract-locale-from-cookie.test.js.map +1 -0
  364. package/dist/compiler/runtime/extract-locale-from-header.d.ts +13 -0
  365. package/dist/compiler/runtime/extract-locale-from-header.d.ts.map +1 -0
  366. package/dist/compiler/runtime/extract-locale-from-header.js +45 -0
  367. package/dist/compiler/runtime/extract-locale-from-header.js.map +1 -0
  368. package/dist/compiler/runtime/extract-locale-from-header.test.d.ts +1 -0
  369. package/dist/compiler/runtime/extract-locale-from-header.test.d.ts.map +1 -0
  370. package/dist/compiler/runtime/extract-locale-from-header.test.js +55 -0
  371. package/dist/compiler/runtime/extract-locale-from-header.test.js.map +1 -0
  372. package/dist/compiler/runtime/extract-locale-from-navigator.d.ts +12 -0
  373. package/dist/compiler/runtime/extract-locale-from-navigator.d.ts.map +1 -0
  374. package/dist/compiler/runtime/extract-locale-from-navigator.js +33 -0
  375. package/dist/compiler/runtime/extract-locale-from-navigator.js.map +1 -0
  376. package/dist/compiler/runtime/extract-locale-from-navigator.test.d.ts +1 -0
  377. package/dist/compiler/runtime/extract-locale-from-navigator.test.d.ts.map +1 -0
  378. package/dist/compiler/runtime/extract-locale-from-navigator.test.js +45 -0
  379. package/dist/compiler/runtime/extract-locale-from-navigator.test.js.map +1 -0
  380. package/dist/compiler/runtime/extract-locale-from-request-async.d.ts +34 -0
  381. package/dist/compiler/runtime/extract-locale-from-request-async.d.ts.map +1 -0
  382. package/dist/compiler/runtime/extract-locale-from-request-async.js +70 -0
  383. package/dist/compiler/runtime/extract-locale-from-request-async.js.map +1 -0
  384. package/dist/compiler/runtime/extract-locale-from-request-async.test.d.ts +1 -0
  385. package/dist/compiler/runtime/extract-locale-from-request-async.test.d.ts.map +1 -0
  386. package/dist/compiler/runtime/extract-locale-from-request-async.test.js +119 -0
  387. package/dist/compiler/runtime/extract-locale-from-request-async.test.js.map +1 -0
  388. package/dist/compiler/runtime/extract-locale-from-request.d.ts +41 -0
  389. package/dist/compiler/runtime/extract-locale-from-request.d.ts.map +1 -0
  390. package/dist/compiler/runtime/extract-locale-from-request.js +96 -0
  391. package/dist/compiler/runtime/extract-locale-from-request.js.map +1 -0
  392. package/dist/compiler/runtime/extract-locale-from-request.test.d.ts +1 -0
  393. package/dist/compiler/runtime/extract-locale-from-request.test.d.ts.map +1 -0
  394. package/dist/compiler/runtime/extract-locale-from-request.test.js +351 -0
  395. package/dist/compiler/runtime/extract-locale-from-request.test.js.map +1 -0
  396. package/dist/compiler/runtime/extract-locale-from-url.d.ts +11 -0
  397. package/dist/compiler/runtime/extract-locale-from-url.d.ts.map +1 -0
  398. package/dist/compiler/runtime/extract-locale-from-url.js +68 -0
  399. package/dist/compiler/runtime/extract-locale-from-url.js.map +1 -0
  400. package/dist/compiler/runtime/extract-locale-from-url.test.d.ts +1 -0
  401. package/dist/compiler/runtime/extract-locale-from-url.test.d.ts.map +1 -0
  402. package/dist/compiler/runtime/extract-locale-from-url.test.js +127 -0
  403. package/dist/compiler/runtime/extract-locale-from-url.test.js.map +1 -0
  404. package/dist/compiler/runtime/generate-static-localized-urls.d.ts +44 -0
  405. package/dist/compiler/runtime/generate-static-localized-urls.d.ts.map +1 -0
  406. package/dist/compiler/runtime/generate-static-localized-urls.js +133 -0
  407. package/dist/compiler/runtime/generate-static-localized-urls.js.map +1 -0
  408. package/dist/compiler/runtime/generate-static-localized-urls.test.d.ts +1 -0
  409. package/dist/compiler/runtime/generate-static-localized-urls.test.d.ts.map +1 -0
  410. package/dist/compiler/runtime/generate-static-localized-urls.test.js +159 -0
  411. package/dist/compiler/runtime/generate-static-localized-urls.test.js.map +1 -0
  412. package/dist/compiler/runtime/get-locale.d.ts +42 -0
  413. package/dist/compiler/runtime/get-locale.d.ts.map +1 -0
  414. package/dist/compiler/runtime/get-locale.js +158 -0
  415. package/dist/compiler/runtime/get-locale.js.map +1 -0
  416. package/dist/compiler/runtime/get-locale.test.d.ts +1 -0
  417. package/dist/compiler/runtime/get-locale.test.d.ts.map +1 -0
  418. package/dist/compiler/runtime/get-locale.test.js +295 -0
  419. package/dist/compiler/runtime/get-locale.test.js.map +1 -0
  420. package/dist/compiler/runtime/get-text-direction.d.ts +15 -0
  421. package/dist/compiler/runtime/get-text-direction.d.ts.map +1 -0
  422. package/dist/compiler/runtime/get-text-direction.js +46 -0
  423. package/dist/compiler/runtime/get-text-direction.js.map +1 -0
  424. package/dist/compiler/runtime/get-text-direction.test.d.ts +1 -0
  425. package/dist/compiler/runtime/get-text-direction.test.d.ts.map +1 -0
  426. package/dist/compiler/runtime/get-text-direction.test.js +40 -0
  427. package/dist/compiler/runtime/get-text-direction.test.js.map +1 -0
  428. package/dist/compiler/runtime/get-url-origin.d.ts +19 -0
  429. package/dist/compiler/runtime/get-url-origin.d.ts.map +1 -0
  430. package/dist/compiler/runtime/get-url-origin.js +31 -0
  431. package/dist/compiler/runtime/get-url-origin.js.map +1 -0
  432. package/dist/compiler/runtime/get-url-origin.test.d.ts +1 -0
  433. package/dist/compiler/runtime/get-url-origin.test.d.ts.map +1 -0
  434. package/dist/compiler/runtime/get-url-origin.test.js +18 -0
  435. package/dist/compiler/runtime/get-url-origin.test.js.map +1 -0
  436. package/dist/compiler/runtime/host-routing.d.ts +28 -0
  437. package/dist/compiler/runtime/host-routing.d.ts.map +1 -0
  438. package/dist/compiler/runtime/host-routing.js +79 -0
  439. package/dist/compiler/runtime/host-routing.js.map +1 -0
  440. package/dist/compiler/runtime/host-routing.test.d.ts +1 -0
  441. package/dist/compiler/runtime/host-routing.test.d.ts.map +1 -0
  442. package/dist/compiler/runtime/host-routing.test.js +128 -0
  443. package/dist/compiler/runtime/host-routing.test.js.map +1 -0
  444. package/dist/compiler/runtime/localize-href.d.ts +84 -0
  445. package/dist/compiler/runtime/localize-href.d.ts.map +1 -0
  446. package/dist/compiler/runtime/localize-href.js +115 -0
  447. package/dist/compiler/runtime/localize-href.js.map +1 -0
  448. package/dist/compiler/runtime/localize-href.test.d.ts +1 -0
  449. package/dist/compiler/runtime/localize-href.test.d.ts.map +1 -0
  450. package/dist/compiler/runtime/localize-href.test.js +139 -0
  451. package/dist/compiler/runtime/localize-href.test.js.map +1 -0
  452. package/dist/compiler/runtime/localize-url.d.ts +95 -0
  453. package/dist/compiler/runtime/localize-url.d.ts.map +1 -0
  454. package/dist/compiler/runtime/localize-url.js +327 -0
  455. package/dist/compiler/runtime/localize-url.js.map +1 -0
  456. package/dist/compiler/runtime/localize-url.test.d.ts +1 -0
  457. package/dist/compiler/runtime/localize-url.test.d.ts.map +1 -0
  458. package/dist/compiler/runtime/localize-url.test.js +533 -0
  459. package/dist/compiler/runtime/localize-url.test.js.map +1 -0
  460. package/dist/compiler/runtime/route-strategy.d.ts +32 -0
  461. package/dist/compiler/runtime/route-strategy.d.ts.map +1 -0
  462. package/dist/compiler/runtime/route-strategy.js +72 -0
  463. package/dist/compiler/runtime/route-strategy.js.map +1 -0
  464. package/dist/compiler/runtime/set-locale.d.ts +46 -0
  465. package/dist/compiler/runtime/set-locale.d.ts.map +1 -0
  466. package/dist/compiler/runtime/set-locale.js +172 -0
  467. package/dist/compiler/runtime/set-locale.js.map +1 -0
  468. package/dist/compiler/runtime/set-locale.test.d.ts +1 -0
  469. package/dist/compiler/runtime/set-locale.test.d.ts.map +1 -0
  470. package/dist/compiler/runtime/set-locale.test.js +555 -0
  471. package/dist/compiler/runtime/set-locale.test.js.map +1 -0
  472. package/dist/compiler/runtime/should-redirect.d.ts +100 -0
  473. package/dist/compiler/runtime/should-redirect.d.ts.map +1 -0
  474. package/dist/compiler/runtime/should-redirect.js +155 -0
  475. package/dist/compiler/runtime/should-redirect.js.map +1 -0
  476. package/dist/compiler/runtime/should-redirect.test.d.ts +1 -0
  477. package/dist/compiler/runtime/should-redirect.test.d.ts.map +1 -0
  478. package/dist/compiler/runtime/should-redirect.test.js +270 -0
  479. package/dist/compiler/runtime/should-redirect.test.js.map +1 -0
  480. package/dist/compiler/runtime/strategy.d.ts +63 -0
  481. package/dist/compiler/runtime/strategy.d.ts.map +1 -0
  482. package/dist/compiler/runtime/strategy.js +65 -0
  483. package/dist/compiler/runtime/strategy.js.map +1 -0
  484. package/dist/compiler/runtime/strategy.test.d.ts +1 -0
  485. package/dist/compiler/runtime/strategy.test.d.ts.map +1 -0
  486. package/dist/compiler/runtime/strategy.test.js +90 -0
  487. package/dist/compiler/runtime/strategy.test.js.map +1 -0
  488. package/dist/compiler/runtime/track-message-call.d.ts +5 -0
  489. package/dist/compiler/runtime/track-message-call.d.ts.map +1 -0
  490. package/dist/compiler/runtime/track-message-call.js +14 -0
  491. package/dist/compiler/runtime/track-message-call.js.map +1 -0
  492. package/dist/compiler/runtime/track-message-call.test.d.ts +1 -0
  493. package/dist/compiler/runtime/track-message-call.test.d.ts.map +1 -0
  494. package/dist/compiler/runtime/track-message-call.test.js +22 -0
  495. package/dist/compiler/runtime/track-message-call.test.js.map +1 -0
  496. package/dist/compiler/runtime/type-definitions.d.ts +197 -0
  497. package/dist/compiler/runtime/type-definitions.d.ts.map +1 -0
  498. package/dist/compiler/runtime/type-definitions.js +150 -0
  499. package/dist/compiler/runtime/type-definitions.js.map +1 -0
  500. package/dist/compiler/runtime/type.d.ts +47 -0
  501. package/dist/compiler/runtime/type.d.ts.map +1 -0
  502. package/dist/compiler/runtime/type.js +2 -0
  503. package/dist/compiler/runtime/type.js.map +1 -0
  504. package/dist/compiler/runtime/type.test.d.ts +1 -0
  505. package/dist/compiler/runtime/type.test.d.ts.map +1 -0
  506. package/dist/compiler/runtime/type.test.js +153 -0
  507. package/dist/compiler/runtime/type.test.js.map +1 -0
  508. package/dist/compiler/runtime/url-pattern.d.ts +12 -0
  509. package/dist/compiler/runtime/url-pattern.d.ts.map +1 -0
  510. package/dist/compiler/runtime/url-pattern.js +35 -0
  511. package/dist/compiler/runtime/url-pattern.js.map +1 -0
  512. package/dist/compiler/runtime/variables.d.ts +128 -0
  513. package/dist/compiler/runtime/variables.d.ts.map +1 -0
  514. package/dist/compiler/runtime/variables.js +111 -0
  515. package/dist/compiler/runtime/variables.js.map +1 -0
  516. package/dist/compiler/safe-module-id.d.ts +7 -0
  517. package/dist/compiler/safe-module-id.d.ts.map +1 -0
  518. package/dist/compiler/safe-module-id.js +78 -0
  519. package/dist/compiler/safe-module-id.js.map +1 -0
  520. package/dist/compiler/safe-module-id.test.d.ts +1 -0
  521. package/dist/compiler/safe-module-id.test.d.ts.map +1 -0
  522. package/dist/compiler/safe-module-id.test.js +36 -0
  523. package/dist/compiler/safe-module-id.test.js.map +1 -0
  524. package/dist/compiler/seed-previous-compilation.d.ts +7 -0
  525. package/dist/compiler/seed-previous-compilation.d.ts.map +1 -0
  526. package/dist/compiler/seed-previous-compilation.js +9 -0
  527. package/dist/compiler/seed-previous-compilation.js.map +1 -0
  528. package/dist/compiler/server/create-server-file.d.ts +12 -0
  529. package/dist/compiler/server/create-server-file.d.ts.map +1 -0
  530. package/dist/compiler/server/create-server-file.js +91 -0
  531. package/dist/compiler/server/create-server-file.js.map +1 -0
  532. package/dist/compiler/server/create-server-file.test.d.ts +1 -0
  533. package/dist/compiler/server/create-server-file.test.d.ts.map +1 -0
  534. package/dist/compiler/server/create-server-file.test.js +48 -0
  535. package/dist/compiler/server/create-server-file.test.js.map +1 -0
  536. package/dist/compiler/server/middleware.d.ts +98 -0
  537. package/dist/compiler/server/middleware.d.ts.map +1 -0
  538. package/dist/compiler/server/middleware.js +278 -0
  539. package/dist/compiler/server/middleware.js.map +1 -0
  540. package/dist/compiler/server/middleware.test.d.ts +1 -0
  541. package/dist/compiler/server/middleware.test.d.ts.map +1 -0
  542. package/dist/compiler/server/middleware.test.js +1001 -0
  543. package/dist/compiler/server/middleware.test.js.map +1 -0
  544. package/dist/compiler/server/type.d.ts +6 -0
  545. package/dist/compiler/server/type.d.ts.map +1 -0
  546. package/dist/compiler/server/type.js +2 -0
  547. package/dist/compiler/server/type.js.map +1 -0
  548. package/dist/compiler/test-helpers.d.ts +30 -0
  549. package/dist/compiler/test-helpers.d.ts.map +1 -0
  550. package/dist/compiler/test-helpers.js +50 -0
  551. package/dist/compiler/test-helpers.js.map +1 -0
  552. package/dist/compiler/types.d.ts +7 -0
  553. package/dist/compiler/types.d.ts.map +1 -0
  554. package/dist/compiler/types.js +2 -0
  555. package/dist/compiler/types.js.map +1 -0
  556. package/dist/compiler/variable-access.d.ts +3 -0
  557. package/dist/compiler/variable-access.d.ts.map +1 -0
  558. package/dist/compiler/variable-access.js +15 -0
  559. package/dist/compiler/variable-access.js.map +1 -0
  560. package/dist/index.d.ts +2 -0
  561. package/dist/index.d.ts.map +1 -0
  562. package/dist/index.js +3 -0
  563. package/dist/index.js.map +1 -0
  564. package/dist/messages/ast.d.ts +102 -0
  565. package/dist/messages/ast.d.ts.map +1 -0
  566. package/dist/messages/ast.js +8 -0
  567. package/dist/messages/ast.js.map +1 -0
  568. package/dist/messages/create-bundle-nested.d.ts +16 -0
  569. package/dist/messages/create-bundle-nested.d.ts.map +1 -0
  570. package/dist/messages/create-bundle-nested.js +22 -0
  571. package/dist/messages/create-bundle-nested.js.map +1 -0
  572. package/dist/messages/index.d.ts +5 -0
  573. package/dist/messages/index.d.ts.map +1 -0
  574. package/dist/messages/index.js +5 -0
  575. package/dist/messages/index.js.map +1 -0
  576. package/dist/messages/load-messages.d.ts +19 -0
  577. package/dist/messages/load-messages.d.ts.map +1 -0
  578. package/dist/messages/load-messages.js +49 -0
  579. package/dist/messages/load-messages.js.map +1 -0
  580. package/dist/messages/message-format/flatten.d.ts +9 -0
  581. package/dist/messages/message-format/flatten.d.ts.map +1 -0
  582. package/dist/messages/message-format/flatten.js +32 -0
  583. package/dist/messages/message-format/flatten.js.map +1 -0
  584. package/dist/messages/message-format/import-files.d.ts +32 -0
  585. package/dist/messages/message-format/import-files.d.ts.map +1 -0
  586. package/dist/messages/message-format/import-files.js +53 -0
  587. package/dist/messages/message-format/import-files.js.map +1 -0
  588. package/dist/messages/message-format/import-files.test.d.ts +1 -0
  589. package/dist/messages/message-format/import-files.test.d.ts.map +1 -0
  590. package/dist/messages/message-format/import-files.test.js +145 -0
  591. package/dist/messages/message-format/import-files.test.js.map +1 -0
  592. package/dist/messages/message-format/index.d.ts +6 -0
  593. package/dist/messages/message-format/index.d.ts.map +1 -0
  594. package/dist/messages/message-format/index.js +7 -0
  595. package/dist/messages/message-format/index.js.map +1 -0
  596. package/dist/messages/message-format/parse-bundle.d.ts +31 -0
  597. package/dist/messages/message-format/parse-bundle.d.ts.map +1 -0
  598. package/dist/messages/message-format/parse-bundle.js +169 -0
  599. package/dist/messages/message-format/parse-bundle.js.map +1 -0
  600. package/dist/messages/message-format/parse-declaration.d.ts +2 -0
  601. package/dist/messages/message-format/parse-declaration.d.ts.map +1 -0
  602. package/dist/messages/message-format/parse-declaration.js +56 -0
  603. package/dist/messages/message-format/parse-declaration.js.map +1 -0
  604. package/dist/messages/message-format/parse-markup.d.ts +4 -0
  605. package/dist/messages/message-format/parse-markup.d.ts.map +1 -0
  606. package/dist/messages/message-format/parse-markup.js +167 -0
  607. package/dist/messages/message-format/parse-markup.js.map +1 -0
  608. package/dist/messages/message-format/parse-matches.d.ts +5 -0
  609. package/dist/messages/message-format/parse-matches.d.ts.map +1 -0
  610. package/dist/messages/message-format/parse-matches.js +31 -0
  611. package/dist/messages/message-format/parse-matches.js.map +1 -0
  612. package/dist/messages/message-format/parse-pattern.d.ts +5 -0
  613. package/dist/messages/message-format/parse-pattern.d.ts.map +1 -0
  614. package/dist/messages/message-format/parse-pattern.js +120 -0
  615. package/dist/messages/message-format/parse-pattern.js.map +1 -0
  616. package/dist/messages/message-format/unique.d.ts +2 -0
  617. package/dist/messages/message-format/unique.d.ts.map +1 -0
  618. package/dist/messages/message-format/unique.js +5 -0
  619. package/dist/messages/message-format/unique.js.map +1 -0
  620. package/dist/messages/nest-bundles.d.ts +19 -0
  621. package/dist/messages/nest-bundles.d.ts.map +1 -0
  622. package/dist/messages/nest-bundles.js +49 -0
  623. package/dist/messages/nest-bundles.js.map +1 -0
  624. package/dist/services/account/index.d.ts +14 -0
  625. package/dist/services/account/index.d.ts.map +1 -0
  626. package/dist/services/account/index.js +43 -0
  627. package/dist/services/account/index.js.map +1 -0
  628. package/dist/services/account/types.d.ts +4 -0
  629. package/dist/services/account/types.d.ts.map +1 -0
  630. package/dist/services/account/types.js +2 -0
  631. package/dist/services/account/types.js.map +1 -0
  632. package/dist/services/codegen/escape.d.ts +9 -0
  633. package/dist/services/codegen/escape.d.ts.map +1 -0
  634. package/dist/services/codegen/escape.js +19 -0
  635. package/dist/services/codegen/escape.js.map +1 -0
  636. package/dist/services/codegen/quotes.d.ts +4 -0
  637. package/dist/services/codegen/quotes.d.ts.map +1 -0
  638. package/dist/services/codegen/quotes.js +5 -0
  639. package/dist/services/codegen/quotes.js.map +1 -0
  640. package/dist/services/env-variables/create-index-file.d.ts +9 -0
  641. package/dist/services/env-variables/create-index-file.d.ts.map +1 -0
  642. package/dist/services/env-variables/create-index-file.js +28 -0
  643. package/dist/services/env-variables/create-index-file.js.map +1 -0
  644. package/dist/services/env-variables/index.d.ts +3 -0
  645. package/dist/services/env-variables/index.d.ts.map +1 -0
  646. package/dist/services/env-variables/index.js +4 -0
  647. package/dist/services/env-variables/index.js.map +1 -0
  648. package/dist/services/environment/package.d.ts +9 -0
  649. package/dist/services/environment/package.d.ts.map +1 -0
  650. package/dist/services/environment/package.js +31 -0
  651. package/dist/services/environment/package.js.map +1 -0
  652. package/dist/services/environment/package.test.d.ts +1 -0
  653. package/dist/services/environment/package.test.d.ts.map +1 -0
  654. package/dist/services/environment/package.test.js +21 -0
  655. package/dist/services/environment/package.test.js.map +1 -0
  656. package/dist/services/error-handling.d.ts +12 -0
  657. package/dist/services/error-handling.d.ts.map +1 -0
  658. package/dist/services/error-handling.js +27 -0
  659. package/dist/services/error-handling.js.map +1 -0
  660. package/dist/services/error-handling.test.d.ts +1 -0
  661. package/dist/services/error-handling.test.d.ts.map +1 -0
  662. package/dist/services/error-handling.test.js +10 -0
  663. package/dist/services/error-handling.test.js.map +1 -0
  664. package/dist/services/file-handling/content-hash.d.ts +9 -0
  665. package/dist/services/file-handling/content-hash.js +19 -0
  666. package/dist/services/file-handling/content-hash.js.map +1 -0
  667. package/dist/services/file-handling/exists.d.ts +7 -0
  668. package/dist/services/file-handling/exists.d.ts.map +1 -0
  669. package/dist/services/file-handling/exists.js +24 -0
  670. package/dist/services/file-handling/exists.js.map +1 -0
  671. package/dist/services/file-handling/exists.test.d.ts +1 -0
  672. package/dist/services/file-handling/exists.test.d.ts.map +1 -0
  673. package/dist/services/file-handling/exists.test.js +27 -0
  674. package/dist/services/file-handling/exists.test.js.map +1 -0
  675. package/dist/services/file-handling/types.d.ts +4 -0
  676. package/dist/services/file-handling/types.d.ts.map +1 -0
  677. package/dist/services/file-handling/types.js +2 -0
  678. package/dist/services/file-handling/types.js.map +1 -0
  679. package/dist/services/file-handling/write-output.d.ts +21 -0
  680. package/dist/services/file-handling/write-output.d.ts.map +1 -0
  681. package/dist/services/file-handling/write-output.js +157 -0
  682. package/dist/services/file-handling/write-output.js.map +1 -0
  683. package/dist/services/file-handling/write-output.test.d.ts +1 -0
  684. package/dist/services/file-handling/write-output.test.d.ts.map +1 -0
  685. package/dist/services/file-handling/write-output.test.js +217 -0
  686. package/dist/services/file-handling/write-output.test.js.map +1 -0
  687. package/dist/services/file-watching/tracked-fs.d.ts +25 -0
  688. package/dist/services/file-watching/tracked-fs.d.ts.map +1 -0
  689. package/dist/services/file-watching/tracked-fs.js +94 -0
  690. package/dist/services/file-watching/tracked-fs.js.map +1 -0
  691. package/dist/services/file-watching/tracked-fs.test.d.ts +1 -0
  692. package/dist/services/file-watching/tracked-fs.test.d.ts.map +1 -0
  693. package/dist/services/file-watching/tracked-fs.test.js +87 -0
  694. package/dist/services/file-watching/tracked-fs.test.js.map +1 -0
  695. package/dist/services/logger/index.d.ts +17 -0
  696. package/dist/services/logger/index.d.ts.map +1 -0
  697. package/dist/services/logger/index.js +58 -0
  698. package/dist/services/logger/index.js.map +1 -0
  699. package/dist/services/lookup.d.ts +14 -0
  700. package/dist/services/lookup.d.ts.map +1 -0
  701. package/dist/services/lookup.js +24 -0
  702. package/dist/services/lookup.js.map +1 -0
  703. package/dist/urlpattern-polyfill/index.d.ts +2 -0
  704. package/dist/urlpattern-polyfill/index.d.ts.map +1 -0
  705. package/dist/urlpattern-polyfill/index.js +2 -0
  706. package/dist/urlpattern-polyfill/index.js.map +1 -0
  707. package/dist/utilities/detect-json-formatting.d.ts +10 -0
  708. package/dist/utilities/detect-json-formatting.d.ts.map +1 -0
  709. package/dist/utilities/detect-json-formatting.js +80 -0
  710. package/dist/utilities/detect-json-formatting.js.map +1 -0
  711. package/dist/utilities/node-normalize-path.d.ts +1 -0
  712. package/dist/utilities/node-normalize-path.d.ts.map +1 -0
  713. package/dist/utilities/node-normalize-path.js +10 -0
  714. package/dist/utilities/node-normalize-path.js.map +1 -0
  715. package/package.json +87 -0
@@ -0,0 +1,69 @@
1
+ import { defaultCompilerOptions, } from "./compiler-options.js";
2
+ import { createRuntimeFile } from "./runtime/create-runtime.js";
3
+ import { createServerFile } from "./server/create-server-file.js";
4
+ import { assertURLPatternAvailable } from "./assert-url-pattern-available.js";
5
+ /**
6
+ * Creates an in-memory Paraglide module for use in tests and non-bundled environments.
7
+ *
8
+ * @example
9
+ * const paraglide = await createParaglide({
10
+ * baseLocale: "en",
11
+ * locales: ["en", "de"],
12
+ * strategy: ["cookie", "baseLocale"],
13
+ * })
14
+ *
15
+ * paraglide.localizeUrl("https://example.com", { locale: "de" })
16
+ * app.use(paraglide.paraglideMiddleware())
17
+ */
18
+ export async function createParaglide(args) {
19
+ const baseLocale = args.baseLocale;
20
+ const locales = args.locales;
21
+ if (!baseLocale) {
22
+ throw new Error("baseLocale is required");
23
+ }
24
+ if (!locales || locales.length === 0) {
25
+ throw new Error("At least one locale is required");
26
+ }
27
+ const needsUrlPattern = args.urlPatterns !== undefined ||
28
+ (args.routeStrategies?.length ?? 0) > 0;
29
+ if (needsUrlPattern) {
30
+ assertURLPatternAvailable();
31
+ }
32
+ const clientSideRuntime = createRuntimeFile({
33
+ baseLocale,
34
+ locales,
35
+ compilerOptions: {
36
+ ...defaultCompilerOptions,
37
+ ...args,
38
+ },
39
+ });
40
+ const serverSideRuntime = createServerFile({
41
+ compiledBundles: [],
42
+ compilerOptions: {
43
+ experimentalMiddlewareLocaleSplitting: args.experimentalMiddlewareLocaleSplitting ??
44
+ defaultCompilerOptions.experimentalMiddlewareLocaleSplitting,
45
+ disableAsyncLocalStorage: args.disableAsyncLocalStorage ??
46
+ defaultCompilerOptions.disableAsyncLocalStorage,
47
+ },
48
+ })
49
+ .replace(`import * as runtime from "./runtime.js";`, "")
50
+ .replaceAll("runtime.", "");
51
+ const mockMessageCode = `
52
+ export const m = new Proxy({}, {
53
+ get(target, prop) {
54
+ if (typeof prop === 'string' && prop !== 'then') {
55
+ throw new Error(
56
+ "Message functions are not available in createParaglide. " +
57
+ "Upvote and explain your use case in https://github.com/opral/inlang-paraglide-js/issues/471"
58
+ );
59
+ }
60
+ return undefined;
61
+ }
62
+ });`;
63
+ const combinedCode = clientSideRuntime + serverSideRuntime + mockMessageCode;
64
+ return await import(
65
+ /* @vite-ignore */
66
+ "data:text/javascript;base64," +
67
+ Buffer.from(combinedCode, "utf-8").toString("base64"));
68
+ }
69
+ //# sourceMappingURL=create-paraglide.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-paraglide.js","sourceRoot":"","sources":["../../src/compiler/create-paraglide.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,sBAAsB,GAEtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAQ9E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACpC,IAAyB;IAEzB,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAE7B,IAAI,CAAC,UAAU,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,eAAe,GACpB,IAAI,CAAC,WAAW,KAAK,SAAS;QAC9B,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAEzC,IAAI,eAAe,EAAE,CAAC;QACrB,yBAAyB,EAAE,CAAC;IAC7B,CAAC;IAED,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,UAAU;QACV,OAAO;QACP,eAAe,EAAE;YAChB,GAAG,sBAAsB;YACzB,GAAG,IAAI;SACP;KACD,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;QAC1C,eAAe,EAAE,EAAE;QACnB,eAAe,EAAE;YAChB,qCAAqC,EACpC,IAAI,CAAC,qCAAqC;gBAC1C,sBAAsB,CAAC,qCAAqC;YAC7D,wBAAwB,EACvB,IAAI,CAAC,wBAAwB;gBAC7B,sBAAsB,CAAC,wBAAwB;SAChD;KACD,CAAC;SACA,OAAO,CAAC,0CAA0C,EAAE,EAAE,CAAC;SACvD,UAAU,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAE7B,MAAM,eAAe,GAAG;;;;;;;;;;;KAWpB,CAAC;IAEL,MAAM,YAAY,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,eAAe,CAAC;IAE7E,OAAO,MAAM,MAAM;IAClB,kBAAkB;IAClB,8BAA8B;QAC7B,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACtD,CAAC;AACH,CAAC","sourcesContent":["import type { Runtime } from \"./runtime/type.js\";\nimport type { ServerRuntime } from \"./server/type.js\";\nimport {\n\tdefaultCompilerOptions,\n\ttype CompilerOptions,\n} from \"./compiler-options.js\";\nimport { createRuntimeFile } from \"./runtime/create-runtime.js\";\nimport { createServerFile } from \"./server/create-server-file.js\";\nimport { assertURLPatternAvailable } from \"./assert-url-pattern-available.js\";\n\ntype CreateParaglideArgs = Pick<CompilerOptions, \"baseLocale\" | \"locales\"> &\n\tOmit<\n\t\tCompilerOptions,\n\t\t\"outdir\" | \"messages\" | \"fs\" | \"baseLocale\" | \"locales\"\n\t>;\n\n/**\n * Creates an in-memory Paraglide module for use in tests and non-bundled environments.\n *\n * @example\n * const paraglide = await createParaglide({\n * baseLocale: \"en\",\n * locales: [\"en\", \"de\"],\n * strategy: [\"cookie\", \"baseLocale\"],\n * })\n *\n * paraglide.localizeUrl(\"https://example.com\", { locale: \"de\" })\n * app.use(paraglide.paraglideMiddleware())\n */\nexport async function createParaglide(\n\targs: CreateParaglideArgs\n): Promise<Runtime & ServerRuntime & { m: Record<string, unknown> }> {\n\tconst baseLocale = args.baseLocale;\n\tconst locales = args.locales;\n\n\tif (!baseLocale) {\n\t\tthrow new Error(\"baseLocale is required\");\n\t}\n\n\tif (!locales || locales.length === 0) {\n\t\tthrow new Error(\"At least one locale is required\");\n\t}\n\n\tconst needsUrlPattern =\n\t\targs.urlPatterns !== undefined ||\n\t\t(args.routeStrategies?.length ?? 0) > 0;\n\n\tif (needsUrlPattern) {\n\t\tassertURLPatternAvailable();\n\t}\n\n\tconst clientSideRuntime = createRuntimeFile({\n\t\tbaseLocale,\n\t\tlocales,\n\t\tcompilerOptions: {\n\t\t\t...defaultCompilerOptions,\n\t\t\t...args,\n\t\t},\n\t});\n\n\tconst serverSideRuntime = createServerFile({\n\t\tcompiledBundles: [],\n\t\tcompilerOptions: {\n\t\t\texperimentalMiddlewareLocaleSplitting:\n\t\t\t\targs.experimentalMiddlewareLocaleSplitting ??\n\t\t\t\tdefaultCompilerOptions.experimentalMiddlewareLocaleSplitting,\n\t\t\tdisableAsyncLocalStorage:\n\t\t\t\targs.disableAsyncLocalStorage ??\n\t\t\t\tdefaultCompilerOptions.disableAsyncLocalStorage,\n\t\t},\n\t})\n\t\t.replace(`import * as runtime from \"./runtime.js\";`, \"\")\n\t\t.replaceAll(\"runtime.\", \"\");\n\n\tconst mockMessageCode = `\n\texport const m = new Proxy({}, {\n\t\tget(target, prop) {\n\t\t\tif (typeof prop === 'string' && prop !== 'then') {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Message functions are not available in createParaglide. \" +\n\t\t\t\t\t\"Upvote and explain your use case in https://github.com/opral/inlang-paraglide-js/issues/471\"\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t});`;\n\n\tconst combinedCode = clientSideRuntime + serverSideRuntime + mockMessageCode;\n\n\treturn await import(\n\t\t/* @vite-ignore */\n\t\t\"data:text/javascript;base64,\" +\n\t\t\tBuffer.from(combinedCode, \"utf-8\").toString(\"base64\")\n\t);\n}\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-paraglide.test.d.ts","sourceRoot":"","sources":["../../src/compiler/create-paraglide.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,55 @@
1
+ import { test, expect } from "vitest";
2
+ import { createParaglide } from "./create-paraglide.js";
3
+ test("createParaglideModule should create a module with runtime and server functions", async () => {
4
+ const paraglide = await createParaglide({
5
+ baseLocale: "en",
6
+ locales: ["en", "de", "fr"],
7
+ });
8
+ // Check that runtime properties are available
9
+ expect(paraglide.baseLocale).toBe("en");
10
+ expect(paraglide.locales).toEqual(["en", "de", "fr"]);
11
+ expect(typeof paraglide.localizeUrl).toBe("function");
12
+ expect(typeof paraglide.getLocale).toBe("function");
13
+ expect(typeof paraglide.setLocale).toBe("function");
14
+ // Check that server functions are available
15
+ expect(typeof paraglide.paraglideMiddleware).toBe("function");
16
+ });
17
+ test("createParaglideModule should allow configuring compiler options", async () => {
18
+ const paraglide = await createParaglide({
19
+ baseLocale: "en",
20
+ locales: ["en", "de", "fr"],
21
+ strategy: ["url"],
22
+ cookieName: "custom-cookie",
23
+ });
24
+ // Check that compiler options are applied
25
+ expect(paraglide.strategy).toEqual(["url"]);
26
+ expect(paraglide.cookieName).toBe("custom-cookie");
27
+ });
28
+ test("createParaglideModule should work with URL localization", async () => {
29
+ const paraglide = await createParaglide({
30
+ baseLocale: "en",
31
+ locales: ["en", "de", "fr"],
32
+ strategy: ["url"],
33
+ });
34
+ // Test URL localization
35
+ const url = "https://example.com/products";
36
+ const localizedUrl = paraglide.localizeUrl(url, { locale: "de" });
37
+ expect(localizedUrl.href).toBe("https://example.com/de/products");
38
+ // Test URL delocalization
39
+ const deLocalizedUrl = paraglide.deLocalizeUrl(localizedUrl);
40
+ expect(deLocalizedUrl.href).toBe(url);
41
+ });
42
+ test("createParaglideModule should provide mock message functions that throw helpful errors", async () => {
43
+ const paraglide = await createParaglide({
44
+ baseLocale: "en",
45
+ locales: ["en", "de", "fr"],
46
+ });
47
+ // Verify m object exists
48
+ expect(paraglide.m).toBeDefined();
49
+ // Verify accessing a message function throws a helpful error
50
+ expect(() => {
51
+ // @ts-expect-error - We're testing runtime behavior
52
+ paraglide.m.someMessage();
53
+ }).toThrow(/Message functions are not available in createParaglide/);
54
+ });
55
+ //# sourceMappingURL=create-paraglide.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-paraglide.test.js","sourceRoot":"","sources":["../../src/compiler/create-paraglide.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,IAAI,CAAC,gFAAgF,EAAE,KAAK,IAAI,EAAE;IACjG,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC;QACvC,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;KAC3B,CAAC,CAAC;IAEH,8CAA8C;IAC9C,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACtD,MAAM,CAAC,OAAO,SAAS,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtD,MAAM,CAAC,OAAO,SAAS,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpD,MAAM,CAAC,OAAO,SAAS,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAEpD,4CAA4C;IAC5C,MAAM,CAAC,OAAO,SAAS,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC/D,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,iEAAiE,EAAE,KAAK,IAAI,EAAE;IAClF,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC;QACvC,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QAC3B,QAAQ,EAAE,CAAC,KAAK,CAAC;QACjB,UAAU,EAAE,eAAe;KAC3B,CAAC,CAAC;IAEH,0CAA0C;IAC1C,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5C,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AACpD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,yDAAyD,EAAE,KAAK,IAAI,EAAE;IAC1E,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC;QACvC,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QAC3B,QAAQ,EAAE,CAAC,KAAK,CAAC;KACjB,CAAC,CAAC;IAEH,wBAAwB;IACxB,MAAM,GAAG,GAAG,8BAA8B,CAAC;IAC3C,MAAM,YAAY,GAAG,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAElE,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;IAElE,0BAA0B;IAC1B,MAAM,cAAc,GAAG,SAAS,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IAC7D,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,uFAAuF,EAAE,KAAK,IAAI,EAAE;IACxG,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC;QACvC,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;KAC3B,CAAC,CAAC;IAEH,yBAAyB;IACzB,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAElC,6DAA6D;IAC7D,MAAM,CAAC,GAAG,EAAE;QACX,oDAAoD;QACpD,SAAS,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC,OAAO,CAAC,wDAAwD,CAAC,CAAC;AACtE,CAAC,CAAC,CAAC","sourcesContent":["import { test, expect } from \"vitest\";\nimport { createParaglide } from \"./create-paraglide.js\";\n\ntest(\"createParaglideModule should create a module with runtime and server functions\", async () => {\n\tconst paraglide = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\", \"fr\"],\n\t});\n\n\t// Check that runtime properties are available\n\texpect(paraglide.baseLocale).toBe(\"en\");\n\texpect(paraglide.locales).toEqual([\"en\", \"de\", \"fr\"]);\n\texpect(typeof paraglide.localizeUrl).toBe(\"function\");\n\texpect(typeof paraglide.getLocale).toBe(\"function\");\n\texpect(typeof paraglide.setLocale).toBe(\"function\");\n\n\t// Check that server functions are available\n\texpect(typeof paraglide.paraglideMiddleware).toBe(\"function\");\n});\n\ntest(\"createParaglideModule should allow configuring compiler options\", async () => {\n\tconst paraglide = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\", \"fr\"],\n\t\tstrategy: [\"url\"],\n\t\tcookieName: \"custom-cookie\",\n\t});\n\n\t// Check that compiler options are applied\n\texpect(paraglide.strategy).toEqual([\"url\"]);\n\texpect(paraglide.cookieName).toBe(\"custom-cookie\");\n});\n\ntest(\"createParaglideModule should work with URL localization\", async () => {\n\tconst paraglide = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\", \"fr\"],\n\t\tstrategy: [\"url\"],\n\t});\n\n\t// Test URL localization\n\tconst url = \"https://example.com/products\";\n\tconst localizedUrl = paraglide.localizeUrl(url, { locale: \"de\" });\n\n\texpect(localizedUrl.href).toBe(\"https://example.com/de/products\");\n\n\t// Test URL delocalization\n\tconst deLocalizedUrl = paraglide.deLocalizeUrl(localizedUrl);\n\texpect(deLocalizedUrl.href).toBe(url);\n});\n\ntest(\"createParaglideModule should provide mock message functions that throw helpful errors\", async () => {\n\tconst paraglide = await createParaglide({\n\t\tbaseLocale: \"en\",\n\t\tlocales: [\"en\", \"de\", \"fr\"],\n\t});\n\n\t// Verify m object exists\n\texpect(paraglide.m).toBeDefined();\n\n\t// Verify accessing a message function throws a helpful error\n\texpect(() => {\n\t\t// @ts-expect-error - We're testing runtime behavior\n\t\tparaglide.m.someMessage();\n\t}).toThrow(/Message functions are not available in createParaglide/);\n});\n"]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Creates the README.md content for the compiled output.
3
+ *
4
+ * This helps LLMs understand the compiled output.
5
+ * See https://llmstxt.org/ for the format guidelines.
6
+ */
7
+ export declare function createReadme(args: {
8
+ sourceLabel?: string;
9
+ }): string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-readme.d.ts","sourceRoot":"","sources":["../../src/compiler/create-readme.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAsKnE"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Creates the README.md content for the compiled output.
3
+ *
4
+ * This helps LLMs understand the compiled output.
5
+ * See https://llmstxt.org/ for the format guidelines.
6
+ */
7
+ export function createReadme(args) {
8
+ const compiledFromLine = args.sourceLabel
9
+ ? `\nCompiled from: \`${args.sourceLabel}\`\n`
10
+ : "";
11
+ return `# paraglide-lite compiled output
12
+
13
+ > Auto-generated i18n message functions. Import \`messages.js\` to use translated strings.
14
+ ${compiledFromLine}
15
+
16
+ ## What is this folder?
17
+
18
+ This folder contains compiled [@sebbro/paraglide-lite](https://github.com/SebbeBroman/paraglide-js) output — an unofficial fork of Paraglide JS that compiles translation messages into tree-shakeable JavaScript functions without an inlang project.
19
+
20
+ ## At a glance
21
+
22
+ Purpose:
23
+ - This folder stores compiled i18n message functions.
24
+ - Source translations live outside this folder (e.g. \`messages/{locale}.json\`).
25
+
26
+ Safe to import:
27
+ - \`messages.js\` — all message functions
28
+ - \`runtime.js\` — locale utilities
29
+ - \`server.js\` — server-side middleware
30
+
31
+ Do not edit:
32
+ - All files in this folder are auto-generated.
33
+ - Changes will be overwritten on next compilation.
34
+
35
+ \`\`\`
36
+ paraglide/
37
+ ├── messages.js # Message exports (import this)
38
+ ├── messages/ # Individual message functions
39
+ ├── runtime.js # Locale detection & configuration
40
+ ├── registry.js # Formatting utilities (plural, number, datetime, relativetime)
41
+ ├── server.js # Server-side middleware
42
+ └── .gitignore # Marks folder as generated
43
+ \`\`\`
44
+
45
+ ## Usage
46
+
47
+ \`\`\`js
48
+ import * as m from "./paraglide/messages.js";
49
+
50
+ // Messages are functions that return localized strings
51
+ m.hello_world(); // "Hello, World!" (in current locale)
52
+ m.greeting({ name: "Sam" }); // "Hello, Sam!"
53
+
54
+ // Override locale per-call
55
+ m.hello_world({}, { locale: "de" }); // "Hallo, Welt!"
56
+ m.greeting({ name: "Sam" }, { locale: "de" }); // "Hallo, Sam!"
57
+ \`\`\`
58
+
59
+ ## Runtime API
60
+
61
+ \`\`\`js
62
+ import { getLocale, getTextDirection, setLocale, locales, baseLocale } from "./paraglide/runtime.js";
63
+
64
+ getLocale(); // Current locale, e.g., "en"
65
+ getTextDirection(); // "ltr" | "rtl" for current locale
66
+ setLocale("de"); // Set locale
67
+ locales; // Available locales, e.g., ["en", "de", "fr"]
68
+ baseLocale; // Default locale, e.g., "en"
69
+ \`\`\`
70
+
71
+ ## Strategy
72
+
73
+ The strategy determines how the current locale is detected and persisted:
74
+
75
+ - **Cookie**: Stores locale preference in a cookie.
76
+ - **URL**: Derives locale from URL patterns (e.g., \`/en/about\`, \`en.example.com\`).
77
+ - **GlobalVariable**: Uses a global variable (client-side only).
78
+ - **BaseLocale**: Always returns the base locale.
79
+
80
+ Strategies can be combined. The order defines precedence:
81
+
82
+ \`\`\`js
83
+ await compile({
84
+ messages: "./messages/{locale}.json",
85
+ locales: ["en", "de"],
86
+ baseLocale: "en",
87
+ outdir: "./src/paraglide",
88
+ strategy: ["url", "cookie", "baseLocale"],
89
+ });
90
+ \`\`\`
91
+
92
+ ## Markup (rich text)
93
+
94
+ Messages can contain markup tags for bold, links, and other inline elements. Translators control where tags appear; developers control how they render.
95
+
96
+ Important:
97
+ - Tag names are app-defined. There is no built-in list of HTML tags.
98
+ - \`{#b}...{/b}\` does not automatically render as \`<b>...</b>\`.
99
+ - Renderers/snippets are looked up by the same tag name used in the message.
100
+
101
+ ### Message syntax
102
+
103
+ \`\`\`json
104
+ {
105
+ "cta": "{#link to=|/docs| rel=$relationship @track}Read the docs{/link}",
106
+ "welcome": "{#b}Hi {name}{/b}{#icon/}"
107
+ }
108
+ \`\`\`
109
+
110
+ - \`{#tagName}\` opens a tag, \`{/tagName}\` closes it.
111
+ - \`{#tagName/}\` creates a standalone tag.
112
+ - Options: \`to=|/docs|\` or \`rel=$relationship\` (accessed via \`options.*\`).
113
+ - Attributes: \`@track\` or \`@variant=|hero|\` (accessed via \`attributes.*\`).
114
+
115
+ Calling the message function still returns **plain text** (markup stripped). To render markup, use \`message.parts()\`:
116
+
117
+ \`\`\`js
118
+ const parts = m.cta.parts({ relationship: "noopener" });
119
+ \`\`\`
120
+
121
+ ## Links
122
+
123
+ - Official Paraglide JS (recommended for most users): https://paraglidejs.com
124
+ - This fork: https://github.com/SebbeBroman/paraglide-js
125
+ `;
126
+ }
127
+ //# sourceMappingURL=create-readme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-readme.js","sourceRoot":"","sources":["../../src/compiler/create-readme.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,IAA8B;IAC1D,MAAM,gBAAgB,GAAG,IAAI,CAAC,WAAW;QACxC,CAAC,CAAC,sBAAsB,IAAI,CAAC,WAAW,MAAM;QAC9C,CAAC,CAAC,EAAE,CAAC;IAEN,OAAO;;;EAGN,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GjB,CAAC;AACF,CAAC","sourcesContent":["/**\n * Creates the README.md content for the compiled output.\n *\n * This helps LLMs understand the compiled output.\n * See https://llmstxt.org/ for the format guidelines.\n */\nexport function createReadme(args: { sourceLabel?: string }): string {\n\tconst compiledFromLine = args.sourceLabel\n\t\t? `\\nCompiled from: \\`${args.sourceLabel}\\`\\n`\n\t\t: \"\";\n\n\treturn `# paraglide-lite compiled output\n\n> Auto-generated i18n message functions. Import \\`messages.js\\` to use translated strings.\n${compiledFromLine}\n\n## What is this folder?\n\nThis folder contains compiled [@sebbro/paraglide-lite](https://github.com/SebbeBroman/paraglide-js) output — an unofficial fork of Paraglide JS that compiles translation messages into tree-shakeable JavaScript functions without an inlang project.\n\n## At a glance\n\nPurpose:\n- This folder stores compiled i18n message functions.\n- Source translations live outside this folder (e.g. \\`messages/{locale}.json\\`).\n\nSafe to import:\n- \\`messages.js\\` — all message functions\n- \\`runtime.js\\` — locale utilities\n- \\`server.js\\` — server-side middleware\n\nDo not edit:\n- All files in this folder are auto-generated.\n- Changes will be overwritten on next compilation.\n\n\\`\\`\\`\nparaglide/\n├── messages.js # Message exports (import this)\n├── messages/ # Individual message functions\n├── runtime.js # Locale detection & configuration\n├── registry.js # Formatting utilities (plural, number, datetime, relativetime)\n├── server.js # Server-side middleware\n└── .gitignore # Marks folder as generated\n\\`\\`\\`\n\n## Usage\n\n\\`\\`\\`js\nimport * as m from \"./paraglide/messages.js\";\n\n// Messages are functions that return localized strings\nm.hello_world(); // \"Hello, World!\" (in current locale)\nm.greeting({ name: \"Sam\" }); // \"Hello, Sam!\"\n\n// Override locale per-call\nm.hello_world({}, { locale: \"de\" }); // \"Hallo, Welt!\"\nm.greeting({ name: \"Sam\" }, { locale: \"de\" }); // \"Hallo, Sam!\"\n\\`\\`\\`\n\n## Runtime API\n\n\\`\\`\\`js\nimport { getLocale, getTextDirection, setLocale, locales, baseLocale } from \"./paraglide/runtime.js\";\n\ngetLocale(); // Current locale, e.g., \"en\"\ngetTextDirection(); // \"ltr\" | \"rtl\" for current locale\nsetLocale(\"de\"); // Set locale\nlocales; // Available locales, e.g., [\"en\", \"de\", \"fr\"]\nbaseLocale; // Default locale, e.g., \"en\"\n\\`\\`\\`\n\n## Strategy\n\nThe strategy determines how the current locale is detected and persisted:\n\n- **Cookie**: Stores locale preference in a cookie.\n- **URL**: Derives locale from URL patterns (e.g., \\`/en/about\\`, \\`en.example.com\\`).\n- **GlobalVariable**: Uses a global variable (client-side only).\n- **BaseLocale**: Always returns the base locale.\n\nStrategies can be combined. The order defines precedence:\n\n\\`\\`\\`js\nawait compile({\n messages: \"./messages/{locale}.json\",\n locales: [\"en\", \"de\"],\n baseLocale: \"en\",\n outdir: \"./src/paraglide\",\n strategy: [\"url\", \"cookie\", \"baseLocale\"],\n});\n\\`\\`\\`\n\n## Markup (rich text)\n\nMessages can contain markup tags for bold, links, and other inline elements. Translators control where tags appear; developers control how they render.\n\nImportant:\n- Tag names are app-defined. There is no built-in list of HTML tags.\n- \\`{#b}...{/b}\\` does not automatically render as \\`<b>...</b>\\`.\n- Renderers/snippets are looked up by the same tag name used in the message.\n\n### Message syntax\n\n\\`\\`\\`json\n{\n \"cta\": \"{#link to=|/docs| rel=$relationship @track}Read the docs{/link}\",\n \"welcome\": \"{#b}Hi {name}{/b}{#icon/}\"\n}\n\\`\\`\\`\n\n- \\`{#tagName}\\` opens a tag, \\`{/tagName}\\` closes it.\n- \\`{#tagName/}\\` creates a standalone tag.\n- Options: \\`to=|/docs|\\` or \\`rel=$relationship\\` (accessed via \\`options.*\\`).\n- Attributes: \\`@track\\` or \\`@variant=|hero|\\` (accessed via \\`attributes.*\\`).\n\nCalling the message function still returns **plain text** (markup stripped). To render markup, use \\`message.parts()\\`:\n\n\\`\\`\\`js\nconst parts = m.cta.parts({ relationship: \"noopener\" });\n\\`\\`\\`\n\n## Links\n\n- Official Paraglide JS (recommended for most users): https://paraglidejs.com\n- This fork: https://github.com/SebbeBroman/paraglide-js\n`;\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import type { CompilerOptions } from "../compiler/compiler-options.js";
2
+ export type EmitFiles = true | false | "types";
3
+ /**
4
+ * Filters compiled output according to `emitFiles`.
5
+ *
6
+ * - `true` — write everything (default)
7
+ * - `"types"` — write `.d.ts` plus ignore/readme/package.json meta files
8
+ * - `false` — write nothing, except `.d.ts` when present (`emitTsDeclarations`)
9
+ */
10
+ export declare function filterOutputForEmit(output: Record<string, string>, emitFiles: EmitFiles): Record<string, string>;
11
+ /**
12
+ * Builds an absolute-path map of generated JS modules for virtual resolve/load.
13
+ */
14
+ export declare function buildVirtualModules(outdir: string, output: Record<string, string>, cwd?: string): Map<string, string>;
15
+ export declare function resolveEmitFiles(options: Pick<CompilerOptions, "emitFiles">): EmitFiles;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emit-files.d.ts","sourceRoot":"","sources":["../../src/compiler/emit-files.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,KAAK,GAAG,OAAO,CAAC;AAS/C;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,SAAS,EAAE,SAAS,GAClB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYxB;AAcD;;GAEG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,GAAG,GAAE,MAAsB,GACzB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAerB;AAED,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,GACzC,SAAS,CAEX"}
@@ -0,0 +1,58 @@
1
+ import path from "node:path";
2
+ const META_FILES = new Set([
3
+ ".gitignore",
4
+ ".prettierignore",
5
+ "README.md",
6
+ "messages/package.json",
7
+ ]);
8
+ /**
9
+ * Filters compiled output according to `emitFiles`.
10
+ *
11
+ * - `true` — write everything (default)
12
+ * - `"types"` — write `.d.ts` plus ignore/readme/package.json meta files
13
+ * - `false` — write nothing, except `.d.ts` when present (`emitTsDeclarations`)
14
+ */
15
+ export function filterOutputForEmit(output, emitFiles) {
16
+ if (emitFiles === true) {
17
+ return output;
18
+ }
19
+ const filtered = {};
20
+ for (const [filePath, content] of Object.entries(output)) {
21
+ if (shouldEmitFile(filePath, emitFiles)) {
22
+ filtered[filePath] = content;
23
+ }
24
+ }
25
+ return filtered;
26
+ }
27
+ function shouldEmitFile(filePath, emitFiles) {
28
+ const normalized = filePath.replaceAll("\\", "/");
29
+ if (normalized.endsWith(".d.ts")) {
30
+ return true;
31
+ }
32
+ if (emitFiles === false) {
33
+ return false;
34
+ }
35
+ // emitFiles === "types"
36
+ return META_FILES.has(normalized);
37
+ }
38
+ /**
39
+ * Builds an absolute-path map of generated JS modules for virtual resolve/load.
40
+ */
41
+ export function buildVirtualModules(outdir, output, cwd = process.cwd()) {
42
+ const absoluteOutdir = path.resolve(cwd, outdir);
43
+ const modules = new Map();
44
+ for (const [relativePath, content] of Object.entries(output)) {
45
+ const normalized = relativePath.replaceAll("\\", "/");
46
+ if (!normalized.endsWith(".js") &&
47
+ !normalized.endsWith(".mjs") &&
48
+ !normalized.endsWith(".cjs")) {
49
+ continue;
50
+ }
51
+ modules.set(path.resolve(absoluteOutdir, relativePath), content);
52
+ }
53
+ return modules;
54
+ }
55
+ export function resolveEmitFiles(options) {
56
+ return options.emitFiles ?? true;
57
+ }
58
+ //# sourceMappingURL=emit-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emit-files.js","sourceRoot":"","sources":["../../src/compiler/emit-files.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAK7B,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IAC1B,YAAY;IACZ,iBAAiB;IACjB,WAAW;IACX,uBAAuB;CACvB,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAClC,MAA8B,EAC9B,SAAoB;IAEpB,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC;IACf,CAAC;IAED,MAAM,QAAQ,GAA2B,EAAE,CAAC;IAC5C,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1D,IAAI,cAAc,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,CAAC;YACzC,QAAQ,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC;QAC9B,CAAC;IACF,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED,SAAS,cAAc,CAAC,QAAgB,EAAE,SAAoB;IAC7D,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAClD,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACd,CAAC;IACD,wBAAwB;IACxB,OAAO,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAClC,MAAc,EACd,MAA8B,EAC9B,GAAG,GAAW,OAAO,CAAC,GAAG,EAAE;IAE3B,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,KAAK,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9D,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACtD,IACC,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC3B,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC5B,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC3B,CAAC;YACF,SAAS;QACV,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC/B,OAA2C;IAE3C,OAAO,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC;AAClC,CAAC","sourcesContent":["import path from \"node:path\";\nimport type { CompilerOptions } from \"../compiler/compiler-options.js\";\n\nexport type EmitFiles = true | false | \"types\";\n\nconst META_FILES = new Set([\n\t\".gitignore\",\n\t\".prettierignore\",\n\t\"README.md\",\n\t\"messages/package.json\",\n]);\n\n/**\n * Filters compiled output according to `emitFiles`.\n *\n * - `true` — write everything (default)\n * - `\"types\"` — write `.d.ts` plus ignore/readme/package.json meta files\n * - `false` — write nothing, except `.d.ts` when present (`emitTsDeclarations`)\n */\nexport function filterOutputForEmit(\n\toutput: Record<string, string>,\n\temitFiles: EmitFiles\n): Record<string, string> {\n\tif (emitFiles === true) {\n\t\treturn output;\n\t}\n\n\tconst filtered: Record<string, string> = {};\n\tfor (const [filePath, content] of Object.entries(output)) {\n\t\tif (shouldEmitFile(filePath, emitFiles)) {\n\t\t\tfiltered[filePath] = content;\n\t\t}\n\t}\n\treturn filtered;\n}\n\nfunction shouldEmitFile(filePath: string, emitFiles: EmitFiles): boolean {\n\tconst normalized = filePath.replaceAll(\"\\\\\", \"/\");\n\tif (normalized.endsWith(\".d.ts\")) {\n\t\treturn true;\n\t}\n\tif (emitFiles === false) {\n\t\treturn false;\n\t}\n\t// emitFiles === \"types\"\n\treturn META_FILES.has(normalized);\n}\n\n/**\n * Builds an absolute-path map of generated JS modules for virtual resolve/load.\n */\nexport function buildVirtualModules(\n\toutdir: string,\n\toutput: Record<string, string>,\n\tcwd: string = process.cwd()\n): Map<string, string> {\n\tconst absoluteOutdir = path.resolve(cwd, outdir);\n\tconst modules = new Map<string, string>();\n\tfor (const [relativePath, content] of Object.entries(output)) {\n\t\tconst normalized = relativePath.replaceAll(\"\\\\\", \"/\");\n\t\tif (\n\t\t\t!normalized.endsWith(\".js\") &&\n\t\t\t!normalized.endsWith(\".mjs\") &&\n\t\t\t!normalized.endsWith(\".cjs\")\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\t\tmodules.set(path.resolve(absoluteOutdir, relativePath), content);\n\t}\n\treturn modules;\n}\n\nexport function resolveEmitFiles(\n\toptions: Pick<CompilerOptions, \"emitFiles\">\n): EmitFiles {\n\treturn options.emitFiles ?? true;\n}\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emit-files.test.d.ts","sourceRoot":"","sources":["../../src/compiler/emit-files.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
1
+ import { describe, expect, test } from "vitest";
2
+ import { buildVirtualModules, filterOutputForEmit, } from "./emit-files.js";
3
+ describe("filterOutputForEmit", () => {
4
+ const output = {
5
+ "runtime.js": "export {}",
6
+ "runtime.d.ts": "export {}",
7
+ "messages.js": "export {}",
8
+ "messages/package.json": '{"sideEffects":false}',
9
+ ".gitignore": "*",
10
+ "README.md": "# hi",
11
+ ".prettierignore": "*",
12
+ };
13
+ test("true keeps everything", () => {
14
+ expect(filterOutputForEmit(output, true)).toEqual(output);
15
+ });
16
+ test("types keeps declarations and meta", () => {
17
+ expect(filterOutputForEmit(output, "types")).toEqual({
18
+ "runtime.d.ts": "export {}",
19
+ "messages/package.json": '{"sideEffects":false}',
20
+ ".gitignore": "*",
21
+ "README.md": "# hi",
22
+ ".prettierignore": "*",
23
+ });
24
+ });
25
+ test("false keeps only d.ts", () => {
26
+ expect(filterOutputForEmit(output, false)).toEqual({
27
+ "runtime.d.ts": "export {}",
28
+ });
29
+ });
30
+ });
31
+ describe("buildVirtualModules", () => {
32
+ test("maps js files to absolute paths", () => {
33
+ const modules = buildVirtualModules("/out", {
34
+ "runtime.js": "a",
35
+ "messages/en.js": "b",
36
+ "runtime.d.ts": "c",
37
+ }, "/");
38
+ expect(modules.get("/out/runtime.js")).toBe("a");
39
+ expect(modules.get("/out/messages/en.js")).toBe("b");
40
+ expect(modules.has("/out/runtime.d.ts")).toBe(false);
41
+ });
42
+ });
43
+ //# sourceMappingURL=emit-files.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emit-files.test.js","sourceRoot":"","sources":["../../src/compiler/emit-files.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EACN,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,MAAM,MAAM,GAAG;QACd,YAAY,EAAE,WAAW;QACzB,cAAc,EAAE,WAAW;QAC3B,aAAa,EAAE,WAAW;QAC1B,uBAAuB,EAAE,uBAAuB;QAChD,YAAY,EAAE,GAAG;QACjB,WAAW,EAAE,MAAM;QACnB,iBAAiB,EAAE,GAAG;KACtB,CAAC;IAEF,IAAI,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAClC,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC9C,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;YACpD,cAAc,EAAE,WAAW;YAC3B,uBAAuB,EAAE,uBAAuB;YAChD,YAAY,EAAE,GAAG;YACjB,WAAW,EAAE,MAAM;YACnB,iBAAiB,EAAE,GAAG;SACtB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAClC,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;YAClD,cAAc,EAAE,WAAW;SAC3B,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,IAAI,CAAC,iCAAiC,EAAE,GAAG,EAAE;QAC5C,MAAM,OAAO,GAAG,mBAAmB,CAClC,MAAM,EACN;YACC,YAAY,EAAE,GAAG;YACjB,gBAAgB,EAAE,GAAG;YACrB,cAAc,EAAE,GAAG;SACnB,EACD,GAAG,CACH,CAAC;QACF,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACjD,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrD,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, test } from \"vitest\";\nimport {\n\tbuildVirtualModules,\n\tfilterOutputForEmit,\n} from \"./emit-files.js\";\n\ndescribe(\"filterOutputForEmit\", () => {\n\tconst output = {\n\t\t\"runtime.js\": \"export {}\",\n\t\t\"runtime.d.ts\": \"export {}\",\n\t\t\"messages.js\": \"export {}\",\n\t\t\"messages/package.json\": '{\"sideEffects\":false}',\n\t\t\".gitignore\": \"*\",\n\t\t\"README.md\": \"# hi\",\n\t\t\".prettierignore\": \"*\",\n\t};\n\n\ttest(\"true keeps everything\", () => {\n\t\texpect(filterOutputForEmit(output, true)).toEqual(output);\n\t});\n\n\ttest(\"types keeps declarations and meta\", () => {\n\t\texpect(filterOutputForEmit(output, \"types\")).toEqual({\n\t\t\t\"runtime.d.ts\": \"export {}\",\n\t\t\t\"messages/package.json\": '{\"sideEffects\":false}',\n\t\t\t\".gitignore\": \"*\",\n\t\t\t\"README.md\": \"# hi\",\n\t\t\t\".prettierignore\": \"*\",\n\t\t});\n\t});\n\n\ttest(\"false keeps only d.ts\", () => {\n\t\texpect(filterOutputForEmit(output, false)).toEqual({\n\t\t\t\"runtime.d.ts\": \"export {}\",\n\t\t});\n\t});\n});\n\ndescribe(\"buildVirtualModules\", () => {\n\ttest(\"maps js files to absolute paths\", () => {\n\t\tconst modules = buildVirtualModules(\n\t\t\t\"/out\",\n\t\t\t{\n\t\t\t\t\"runtime.js\": \"a\",\n\t\t\t\t\"messages/en.js\": \"b\",\n\t\t\t\t\"runtime.d.ts\": \"c\",\n\t\t\t},\n\t\t\t\"/\"\n\t\t);\n\t\texpect(modules.get(\"/out/runtime.js\")).toBe(\"a\");\n\t\texpect(modules.get(\"/out/messages/en.js\")).toBe(\"b\");\n\t\texpect(modules.has(\"/out/runtime.d.ts\")).toBe(false);\n\t});\n});\n"]}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Generates `.d.ts` files for the compiled Paraglide output using the TypeScript compiler.
3
+ *
4
+ * @param output - The generated compiler output keyed by relative file path.
5
+ * @returns The generated declaration files keyed by relative path.
6
+ *
7
+ * @example
8
+ * const declarations = await emitTsDeclarations(output);
9
+ * // Merge them into the compiler output before writing to disk
10
+ */
11
+ export declare function emitTsDeclarations(output: Record<string, string>): Promise<Record<string, string>>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emit-ts-declarations.d.ts","sourceRoot":"","sources":["../../src/compiler/emit-ts-declarations.ts"],"names":[],"mappings":"AAmBA;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CACvC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAoBjC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emit-ts-declarations.interop.test.d.ts","sourceRoot":"","sources":["../../src/compiler/emit-ts-declarations.interop.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ import { expect, test, vi } from "vitest";
2
+ import { createBundleNested } from "./test-helpers.js";
3
+ import { compileProject } from "./compile-project.js";
4
+ vi.mock("typescript", async () => {
5
+ const actual = await vi.importActual("typescript");
6
+ return {
7
+ default: actual,
8
+ createProgram: undefined,
9
+ };
10
+ });
11
+ test("emitTsDeclarations uses the compiler API for a default-only interop shape of TypeScript 5", async () => {
12
+ const bundles = [
13
+ createBundleNested({
14
+ id: "greeting.hello",
15
+ messages: [
16
+ {
17
+ locale: "en",
18
+ variants: [{ pattern: [{ type: "text", value: "Hello" }] }],
19
+ },
20
+ ],
21
+ }),
22
+ ];
23
+ const output = await compileProject({
24
+ bundles,
25
+ settings: { locales: ["en"], baseLocale: "en" },
26
+ compilerOptions: {
27
+ emitTsDeclarations: true,
28
+ },
29
+ });
30
+ expect(output).toHaveProperty("runtime.d.ts");
31
+ expect(output["messages/greeting_hello.d.ts"]).toContain(`export { greeting_hello as "greeting.hello" };`);
32
+ });
33
+ //# sourceMappingURL=emit-ts-declarations.interop.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emit-ts-declarations.interop.test.js","sourceRoot":"","sources":["../../src/compiler/emit-ts-declarations.interop.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;IAChC,MAAM,MAAM,GACX,MAAM,EAAE,CAAC,YAAY,CAA8B,YAAY,CAAC,CAAC;IAClE,OAAO;QACN,OAAO,EAAE,MAAM;QACf,aAAa,EAAE,SAAS;KACxB,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,2FAA2F,EAAE,KAAK,IAAI,EAAE;IAC5G,MAAM,OAAO,GAAG;QACf,kBAAkB,CAAC;YAClB,EAAE,EAAE,gBAAgB;YACpB,QAAQ,EAAE;gBACT;oBACC,MAAM,EAAE,IAAI;oBACZ,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;iBAC3D;aACD;SACD,CAAC;KACF,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC;QACnC,OAAO;QACP,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;QAC/C,eAAe,EAAE;YAChB,kBAAkB,EAAE,IAAI;SACxB;KACD,CAAC,CAAC;IAEH,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IAC9C,MAAM,CAAC,MAAM,CAAC,8BAA8B,CAAC,CAAC,CAAC,SAAS,CACvD,gDAAgD,CAChD,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { expect, test, vi } from \"vitest\";\nimport { createBundleNested } from \"./test-helpers.js\";\nimport { compileProject } from \"./compile-project.js\";\n\nvi.mock(\"typescript\", async () => {\n\tconst actual =\n\t\tawait vi.importActual<typeof import(\"typescript\")>(\"typescript\");\n\treturn {\n\t\tdefault: actual,\n\t\tcreateProgram: undefined,\n\t};\n});\n\ntest(\"emitTsDeclarations uses the compiler API for a default-only interop shape of TypeScript 5\", async () => {\n\tconst bundles = [\n\t\tcreateBundleNested({\n\t\t\tid: \"greeting.hello\",\n\t\t\tmessages: [\n\t\t\t\t{\n\t\t\t\t\tlocale: \"en\",\n\t\t\t\t\tvariants: [{ pattern: [{ type: \"text\", value: \"Hello\" }] }],\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t];\n\n\tconst output = await compileProject({\n\t\tbundles,\n\t\tsettings: { locales: [\"en\"], baseLocale: \"en\" },\n\t\tcompilerOptions: {\n\t\t\temitTsDeclarations: true,\n\t\t},\n\t});\n\n\texpect(output).toHaveProperty(\"runtime.d.ts\");\n\texpect(output[\"messages/greeting_hello.d.ts\"]).toContain(\n\t\t`export { greeting_hello as \"greeting.hello\" };`\n\t);\n});\n"]}