@bolt-foundry/gambit 0.8.3 → 0.8.5-rc.5

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 (289) hide show
  1. package/CHANGELOG.md +38 -2
  2. package/README.md +79 -16
  3. package/esm/_dnt.polyfills.d.ts +17 -0
  4. package/esm/_dnt.polyfills.d.ts.map +1 -1
  5. package/esm/_dnt.polyfills.js +122 -0
  6. package/esm/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts +322 -0
  7. package/esm/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts.map +1 -0
  8. package/esm/deps/jsr.io/@std/collections/1.1.5/deep_merge.js +105 -0
  9. package/esm/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts +14 -0
  10. package/esm/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts.map +1 -0
  11. package/esm/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.js +34 -0
  12. package/esm/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts +13 -0
  13. package/esm/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts.map +1 -0
  14. package/esm/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.js +18 -0
  15. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts +10 -0
  16. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts.map +1 -0
  17. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_same_path.js +17 -0
  18. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts +12 -0
  19. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts.map +1 -0
  20. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_subdir.js +25 -0
  21. package/esm/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts +9 -0
  22. package/esm/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts.map +1 -0
  23. package/esm/deps/jsr.io/@std/fs/1.0.22/_to_path_string.js +13 -0
  24. package/esm/deps/jsr.io/@std/fs/1.0.22/copy.d.ts +117 -0
  25. package/esm/deps/jsr.io/@std/fs/1.0.22/copy.d.ts.map +1 -0
  26. package/esm/deps/jsr.io/@std/fs/1.0.22/copy.js +313 -0
  27. package/esm/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts +48 -0
  28. package/esm/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts.map +1 -0
  29. package/esm/deps/jsr.io/@std/fs/1.0.22/empty_dir.js +87 -0
  30. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts +49 -0
  31. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts.map +1 -0
  32. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_dir.js +102 -0
  33. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts +47 -0
  34. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts.map +1 -0
  35. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_file.js +90 -0
  36. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts +49 -0
  37. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts.map +1 -0
  38. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_link.js +61 -0
  39. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts +70 -0
  40. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts.map +1 -0
  41. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.js +156 -0
  42. package/esm/deps/jsr.io/@std/fs/1.0.22/eol.d.ts +52 -0
  43. package/esm/deps/jsr.io/@std/fs/1.0.22/eol.d.ts.map +1 -0
  44. package/esm/deps/jsr.io/@std/fs/1.0.22/eol.js +67 -0
  45. package/esm/deps/jsr.io/@std/fs/1.0.22/exists.d.ts +218 -0
  46. package/esm/deps/jsr.io/@std/fs/1.0.22/exists.d.ts.map +1 -0
  47. package/esm/deps/jsr.io/@std/fs/1.0.22/exists.js +271 -0
  48. package/esm/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts +267 -0
  49. package/esm/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts.map +1 -0
  50. package/esm/deps/jsr.io/@std/fs/1.0.22/expand_glob.js +442 -0
  51. package/esm/deps/jsr.io/@std/fs/1.0.22/mod.d.ts +29 -0
  52. package/esm/deps/jsr.io/@std/fs/1.0.22/mod.d.ts.map +1 -0
  53. package/esm/deps/jsr.io/@std/fs/1.0.22/mod.js +29 -0
  54. package/esm/deps/jsr.io/@std/fs/1.0.22/move.d.ts +86 -0
  55. package/esm/deps/jsr.io/@std/fs/1.0.22/move.d.ts.map +1 -0
  56. package/esm/deps/jsr.io/@std/fs/1.0.22/move.js +142 -0
  57. package/esm/deps/jsr.io/@std/fs/1.0.22/walk.d.ts +777 -0
  58. package/esm/deps/jsr.io/@std/fs/1.0.22/walk.d.ts.map +1 -0
  59. package/esm/deps/jsr.io/@std/fs/1.0.22/walk.js +846 -0
  60. package/esm/deps/jsr.io/@std/json/1.0.2/types.d.ts +5 -0
  61. package/esm/deps/jsr.io/@std/json/1.0.2/types.d.ts.map +1 -0
  62. package/esm/deps/jsr.io/@std/json/1.0.2/types.js +3 -0
  63. package/esm/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts +20 -0
  64. package/esm/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts.map +1 -0
  65. package/esm/deps/jsr.io/@std/jsonc/1.0.2/mod.js +21 -0
  66. package/esm/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts +21 -0
  67. package/esm/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts.map +1 -0
  68. package/esm/deps/jsr.io/@std/jsonc/1.0.2/parse.js +320 -0
  69. package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts +93 -0
  70. package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts.map +1 -0
  71. package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.js +753 -0
  72. package/esm/deps/jsr.io/@std/toml/1.0.11/mod.d.ts +109 -0
  73. package/esm/deps/jsr.io/@std/toml/1.0.11/mod.d.ts.map +1 -0
  74. package/esm/deps/jsr.io/@std/toml/1.0.11/mod.js +110 -0
  75. package/esm/deps/jsr.io/@std/toml/1.0.11/parse.d.ts +21 -0
  76. package/esm/deps/jsr.io/@std/toml/1.0.11/parse.d.ts.map +1 -0
  77. package/esm/deps/jsr.io/@std/toml/1.0.11/parse.js +25 -0
  78. package/esm/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts +35 -0
  79. package/esm/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts.map +1 -0
  80. package/esm/deps/jsr.io/@std/toml/1.0.11/stringify.js +283 -0
  81. package/esm/gambit/simulator-ui/dist/bundle.js +10639 -4629
  82. package/esm/gambit/simulator-ui/dist/bundle.js.map +4 -4
  83. package/esm/mod.d.ts +13 -3
  84. package/esm/mod.d.ts.map +1 -1
  85. package/esm/mod.js +8 -2
  86. package/esm/src/cli_utils.d.ts +1 -0
  87. package/esm/src/cli_utils.d.ts.map +1 -1
  88. package/esm/src/cli_utils.js +13 -1
  89. package/esm/src/default_runtime.d.ts +46 -0
  90. package/esm/src/default_runtime.d.ts.map +1 -0
  91. package/esm/src/default_runtime.js +415 -0
  92. package/esm/src/durable_streams.js +26 -1
  93. package/esm/src/model_matchers.d.ts +10 -0
  94. package/esm/src/model_matchers.d.ts.map +1 -0
  95. package/esm/src/model_matchers.js +26 -0
  96. package/esm/src/openai_compat.d.ts +12 -1
  97. package/esm/src/openai_compat.d.ts.map +1 -1
  98. package/esm/src/openai_compat.js +53 -1
  99. package/esm/src/project_config.d.ts +47 -0
  100. package/esm/src/project_config.d.ts.map +1 -0
  101. package/esm/src/project_config.js +134 -0
  102. package/esm/src/providers/codex.d.ts +37 -0
  103. package/esm/src/providers/codex.d.ts.map +1 -0
  104. package/esm/src/providers/codex.js +810 -0
  105. package/esm/src/providers/google.d.ts +3 -1
  106. package/esm/src/providers/google.d.ts.map +1 -1
  107. package/esm/src/providers/google.js +82 -6
  108. package/esm/src/providers/ollama.d.ts +3 -1
  109. package/esm/src/providers/ollama.d.ts.map +1 -1
  110. package/esm/src/providers/ollama.js +238 -15
  111. package/esm/src/providers/openrouter.d.ts +6 -2
  112. package/esm/src/providers/openrouter.d.ts.map +1 -1
  113. package/esm/src/providers/openrouter.js +260 -23
  114. package/esm/src/providers/router.d.ts +19 -0
  115. package/esm/src/providers/router.d.ts.map +1 -0
  116. package/esm/src/providers/router.js +93 -0
  117. package/esm/src/server.d.ts +9 -0
  118. package/esm/src/server.d.ts.map +1 -1
  119. package/esm/src/server.js +3186 -652
  120. package/esm/src/server_feedback_grading_routes.d.ts +32 -0
  121. package/esm/src/server_feedback_grading_routes.d.ts.map +1 -0
  122. package/esm/src/server_feedback_grading_routes.js +305 -0
  123. package/esm/src/server_helpers.d.ts +4 -0
  124. package/esm/src/server_helpers.d.ts.map +1 -0
  125. package/esm/src/server_helpers.js +46 -0
  126. package/esm/src/server_session_store.d.ts +87 -0
  127. package/esm/src/server_session_store.d.ts.map +1 -0
  128. package/esm/src/server_session_store.js +873 -0
  129. package/esm/src/server_types.d.ts +110 -0
  130. package/esm/src/server_types.d.ts.map +1 -0
  131. package/esm/src/server_types.js +1 -0
  132. package/esm/src/server_ui_routes.d.ts +33 -0
  133. package/esm/src/server_ui_routes.d.ts.map +1 -0
  134. package/esm/src/server_ui_routes.js +135 -0
  135. package/esm/src/session_artifacts.d.ts +22 -0
  136. package/esm/src/session_artifacts.d.ts.map +1 -0
  137. package/esm/src/session_artifacts.js +243 -0
  138. package/esm/src/trace.d.ts.map +1 -1
  139. package/esm/src/trace.js +6 -3
  140. package/esm/src/workspace.d.ts +19 -0
  141. package/esm/src/workspace.d.ts.map +1 -0
  142. package/esm/src/workspace.js +164 -0
  143. package/esm/src/workspace_contract.d.ts +76 -0
  144. package/esm/src/workspace_contract.d.ts.map +1 -0
  145. package/esm/src/workspace_contract.js +74 -0
  146. package/package.json +2 -2
  147. package/script/_dnt.polyfills.d.ts +17 -0
  148. package/script/_dnt.polyfills.d.ts.map +1 -1
  149. package/script/_dnt.polyfills.js +122 -0
  150. package/script/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts +322 -0
  151. package/script/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts.map +1 -0
  152. package/script/deps/jsr.io/@std/collections/1.1.5/deep_merge.js +108 -0
  153. package/script/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts +14 -0
  154. package/script/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts.map +1 -0
  155. package/script/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.js +71 -0
  156. package/script/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts +13 -0
  157. package/script/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts.map +1 -0
  158. package/script/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.js +21 -0
  159. package/script/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts +10 -0
  160. package/script/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts.map +1 -0
  161. package/script/deps/jsr.io/@std/fs/1.0.22/_is_same_path.js +20 -0
  162. package/script/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts +12 -0
  163. package/script/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts.map +1 -0
  164. package/script/deps/jsr.io/@std/fs/1.0.22/_is_subdir.js +28 -0
  165. package/script/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts +9 -0
  166. package/script/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts.map +1 -0
  167. package/script/deps/jsr.io/@std/fs/1.0.22/_to_path_string.js +16 -0
  168. package/script/deps/jsr.io/@std/fs/1.0.22/copy.d.ts +117 -0
  169. package/script/deps/jsr.io/@std/fs/1.0.22/copy.d.ts.map +1 -0
  170. package/script/deps/jsr.io/@std/fs/1.0.22/copy.js +350 -0
  171. package/script/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts +48 -0
  172. package/script/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts.map +1 -0
  173. package/script/deps/jsr.io/@std/fs/1.0.22/empty_dir.js +124 -0
  174. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts +49 -0
  175. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts.map +1 -0
  176. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_dir.js +139 -0
  177. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts +47 -0
  178. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts.map +1 -0
  179. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_file.js +127 -0
  180. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts +49 -0
  181. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts.map +1 -0
  182. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_link.js +98 -0
  183. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts +70 -0
  184. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts.map +1 -0
  185. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.js +193 -0
  186. package/script/deps/jsr.io/@std/fs/1.0.22/eol.d.ts +52 -0
  187. package/script/deps/jsr.io/@std/fs/1.0.22/eol.d.ts.map +1 -0
  188. package/script/deps/jsr.io/@std/fs/1.0.22/eol.js +105 -0
  189. package/script/deps/jsr.io/@std/fs/1.0.22/exists.d.ts +218 -0
  190. package/script/deps/jsr.io/@std/fs/1.0.22/exists.d.ts.map +1 -0
  191. package/script/deps/jsr.io/@std/fs/1.0.22/exists.js +308 -0
  192. package/script/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts +267 -0
  193. package/script/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts.map +1 -0
  194. package/script/deps/jsr.io/@std/fs/1.0.22/expand_glob.js +479 -0
  195. package/script/deps/jsr.io/@std/fs/1.0.22/mod.d.ts +29 -0
  196. package/script/deps/jsr.io/@std/fs/1.0.22/mod.d.ts.map +1 -0
  197. package/script/deps/jsr.io/@std/fs/1.0.22/mod.js +45 -0
  198. package/script/deps/jsr.io/@std/fs/1.0.22/move.d.ts +86 -0
  199. package/script/deps/jsr.io/@std/fs/1.0.22/move.d.ts.map +1 -0
  200. package/script/deps/jsr.io/@std/fs/1.0.22/move.js +179 -0
  201. package/script/deps/jsr.io/@std/fs/1.0.22/walk.d.ts +777 -0
  202. package/script/deps/jsr.io/@std/fs/1.0.22/walk.d.ts.map +1 -0
  203. package/script/deps/jsr.io/@std/fs/1.0.22/walk.js +883 -0
  204. package/script/deps/jsr.io/@std/json/1.0.2/types.d.ts +5 -0
  205. package/script/deps/jsr.io/@std/json/1.0.2/types.d.ts.map +1 -0
  206. package/script/deps/jsr.io/@std/json/1.0.2/types.js +4 -0
  207. package/script/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts +20 -0
  208. package/script/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts.map +1 -0
  209. package/script/deps/jsr.io/@std/jsonc/1.0.2/mod.js +37 -0
  210. package/script/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts +21 -0
  211. package/script/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts.map +1 -0
  212. package/script/deps/jsr.io/@std/jsonc/1.0.2/parse.js +323 -0
  213. package/script/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts +93 -0
  214. package/script/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts.map +1 -0
  215. package/script/deps/jsr.io/@std/toml/1.0.11/_parser.js +781 -0
  216. package/script/deps/jsr.io/@std/toml/1.0.11/mod.d.ts +109 -0
  217. package/script/deps/jsr.io/@std/toml/1.0.11/mod.d.ts.map +1 -0
  218. package/script/deps/jsr.io/@std/toml/1.0.11/mod.js +126 -0
  219. package/script/deps/jsr.io/@std/toml/1.0.11/parse.d.ts +21 -0
  220. package/script/deps/jsr.io/@std/toml/1.0.11/parse.d.ts.map +1 -0
  221. package/script/deps/jsr.io/@std/toml/1.0.11/parse.js +28 -0
  222. package/script/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts +35 -0
  223. package/script/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts.map +1 -0
  224. package/script/deps/jsr.io/@std/toml/1.0.11/stringify.js +286 -0
  225. package/script/gambit/simulator-ui/dist/bundle.js +10639 -4629
  226. package/script/gambit/simulator-ui/dist/bundle.js.map +4 -4
  227. package/script/mod.d.ts +13 -3
  228. package/script/mod.d.ts.map +1 -1
  229. package/script/mod.js +14 -5
  230. package/script/src/cli_utils.d.ts +1 -0
  231. package/script/src/cli_utils.d.ts.map +1 -1
  232. package/script/src/cli_utils.js +14 -1
  233. package/script/src/default_runtime.d.ts +46 -0
  234. package/script/src/default_runtime.d.ts.map +1 -0
  235. package/script/src/default_runtime.js +452 -0
  236. package/script/src/durable_streams.js +26 -1
  237. package/script/src/model_matchers.d.ts +10 -0
  238. package/script/src/model_matchers.d.ts.map +1 -0
  239. package/script/src/model_matchers.js +29 -0
  240. package/script/src/openai_compat.d.ts +12 -1
  241. package/script/src/openai_compat.d.ts.map +1 -1
  242. package/script/src/openai_compat.js +85 -0
  243. package/script/src/project_config.d.ts +47 -0
  244. package/script/src/project_config.d.ts.map +1 -0
  245. package/script/src/project_config.js +173 -0
  246. package/script/src/providers/codex.d.ts +37 -0
  247. package/script/src/providers/codex.d.ts.map +1 -0
  248. package/script/src/providers/codex.js +850 -0
  249. package/script/src/providers/google.d.ts +3 -1
  250. package/script/src/providers/google.d.ts.map +1 -1
  251. package/script/src/providers/google.js +82 -6
  252. package/script/src/providers/ollama.d.ts +3 -1
  253. package/script/src/providers/ollama.d.ts.map +1 -1
  254. package/script/src/providers/ollama.js +238 -15
  255. package/script/src/providers/openrouter.d.ts +6 -2
  256. package/script/src/providers/openrouter.d.ts.map +1 -1
  257. package/script/src/providers/openrouter.js +260 -23
  258. package/script/src/providers/router.d.ts +19 -0
  259. package/script/src/providers/router.d.ts.map +1 -0
  260. package/script/src/providers/router.js +96 -0
  261. package/script/src/server.d.ts +9 -0
  262. package/script/src/server.d.ts.map +1 -1
  263. package/script/src/server.js +3193 -659
  264. package/script/src/server_feedback_grading_routes.d.ts +32 -0
  265. package/script/src/server_feedback_grading_routes.d.ts.map +1 -0
  266. package/script/src/server_feedback_grading_routes.js +343 -0
  267. package/script/src/server_helpers.d.ts +4 -0
  268. package/script/src/server_helpers.d.ts.map +1 -0
  269. package/script/src/server_helpers.js +84 -0
  270. package/script/src/server_session_store.d.ts +87 -0
  271. package/script/src/server_session_store.d.ts.map +1 -0
  272. package/script/src/server_session_store.js +910 -0
  273. package/script/src/server_types.d.ts +110 -0
  274. package/script/src/server_types.d.ts.map +1 -0
  275. package/script/src/server_types.js +2 -0
  276. package/script/src/server_ui_routes.d.ts +33 -0
  277. package/script/src/server_ui_routes.d.ts.map +1 -0
  278. package/script/src/server_ui_routes.js +172 -0
  279. package/script/src/session_artifacts.d.ts +22 -0
  280. package/script/src/session_artifacts.d.ts.map +1 -0
  281. package/script/src/session_artifacts.js +279 -0
  282. package/script/src/trace.d.ts.map +1 -1
  283. package/script/src/trace.js +6 -3
  284. package/script/src/workspace.d.ts +19 -0
  285. package/script/src/workspace.d.ts.map +1 -0
  286. package/script/src/workspace.js +201 -0
  287. package/script/src/workspace_contract.d.ts +76 -0
  288. package/script/src/workspace_contract.d.ts.map +1 -0
  289. package/script/src/workspace_contract.js +82 -0
@@ -0,0 +1,109 @@
1
+ /**
2
+ * {@linkcode parse} and {@linkcode stringify} for handling
3
+ * {@link https://toml.io | TOML} encoded data.
4
+ *
5
+ * Be sure to read the supported types as not every spec is supported at the
6
+ * moment and the handling in TypeScript side is a bit different.
7
+ *
8
+ * ## Supported types and handling
9
+ *
10
+ * - [x] [Keys](https://toml.io/en/latest#keys)
11
+ * - [ ] [String](https://toml.io/en/latest#string)
12
+ * - [x] [Multiline String](https://toml.io/en/latest#string)
13
+ * - [x] [Literal String](https://toml.io/en/latest#string)
14
+ * - [ ] [Integer](https://toml.io/en/latest#integer)
15
+ * - [x] [Float](https://toml.io/en/latest#float)
16
+ * - [x] [Boolean](https://toml.io/en/latest#boolean)
17
+ * - [x] [Offset Date-time](https://toml.io/en/latest#offset-date-time)
18
+ * - [x] [Local Date-time](https://toml.io/en/latest#local-date-time)
19
+ * - [x] [Local Date](https://toml.io/en/latest#local-date)
20
+ * - [ ] [Local Time](https://toml.io/en/latest#local-time)
21
+ * - [x] [Table](https://toml.io/en/latest#table)
22
+ * - [x] [Inline Table](https://toml.io/en/latest#inline-table)
23
+ * - [ ] [Array of Tables](https://toml.io/en/latest#array-of-tables)
24
+ *
25
+ * _Supported with warnings see [Warning](#Warning)._
26
+ *
27
+ * ### Warning
28
+ *
29
+ * #### String
30
+ *
31
+ * Due to the spec, there is no flag to detect regex properly in a TOML
32
+ * declaration. So the regex is stored as string.
33
+ *
34
+ * #### Integer
35
+ *
36
+ * For **Binary** / **Octal** / **Hexadecimal** numbers, they are stored as string
37
+ * to be not interpreted as Decimal.
38
+ *
39
+ * #### Local Time
40
+ *
41
+ * Because local time does not exist in JavaScript, the local time is stored as a
42
+ * string.
43
+ *
44
+ * #### Array of Tables
45
+ *
46
+ * At the moment only simple declarations like below are supported:
47
+ *
48
+ * ```toml
49
+ * [[bin]]
50
+ * name = "deno"
51
+ * path = "cli/main.rs"
52
+ *
53
+ * [[bin]]
54
+ * name = "deno_core"
55
+ * path = "src/foo.rs"
56
+ *
57
+ * [[nib]]
58
+ * name = "node"
59
+ * path = "not_found"
60
+ * ```
61
+ *
62
+ * will output:
63
+ *
64
+ * ```json
65
+ * {
66
+ * "bin": [
67
+ * { "name": "deno", "path": "cli/main.rs" },
68
+ * { "name": "deno_core", "path": "src/foo.rs" }
69
+ * ],
70
+ * "nib": [{ "name": "node", "path": "not_found" }]
71
+ * }
72
+ * ```
73
+ *
74
+ * ```ts
75
+ * import { parse, stringify } from "@std/toml";
76
+ * import { assertEquals } from "@std/assert";
77
+ *
78
+ * const obj = {
79
+ * bin: [
80
+ * { name: "deno", path: "cli/main.rs" },
81
+ * { name: "deno_core", path: "src/foo.rs" },
82
+ * ],
83
+ * nib: [{ name: "node", path: "not_found" }],
84
+ * };
85
+ *
86
+ * const tomlString = stringify(obj);
87
+ * assertEquals(tomlString, `
88
+ * [[bin]]
89
+ * name = "deno"
90
+ * path = "cli/main.rs"
91
+ *
92
+ * [[bin]]
93
+ * name = "deno_core"
94
+ * path = "src/foo.rs"
95
+ *
96
+ * [[nib]]
97
+ * name = "node"
98
+ * path = "not_found"
99
+ * `);
100
+ *
101
+ * const tomlObject = parse(tomlString);
102
+ * assertEquals(tomlObject, obj);
103
+ * ```
104
+ *
105
+ * @module
106
+ */
107
+ export * from "./stringify.js";
108
+ export * from "./parse.js";
109
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/toml/1.0.11/mod.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,110 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ /**
4
+ * {@linkcode parse} and {@linkcode stringify} for handling
5
+ * {@link https://toml.io | TOML} encoded data.
6
+ *
7
+ * Be sure to read the supported types as not every spec is supported at the
8
+ * moment and the handling in TypeScript side is a bit different.
9
+ *
10
+ * ## Supported types and handling
11
+ *
12
+ * - [x] [Keys](https://toml.io/en/latest#keys)
13
+ * - [ ] [String](https://toml.io/en/latest#string)
14
+ * - [x] [Multiline String](https://toml.io/en/latest#string)
15
+ * - [x] [Literal String](https://toml.io/en/latest#string)
16
+ * - [ ] [Integer](https://toml.io/en/latest#integer)
17
+ * - [x] [Float](https://toml.io/en/latest#float)
18
+ * - [x] [Boolean](https://toml.io/en/latest#boolean)
19
+ * - [x] [Offset Date-time](https://toml.io/en/latest#offset-date-time)
20
+ * - [x] [Local Date-time](https://toml.io/en/latest#local-date-time)
21
+ * - [x] [Local Date](https://toml.io/en/latest#local-date)
22
+ * - [ ] [Local Time](https://toml.io/en/latest#local-time)
23
+ * - [x] [Table](https://toml.io/en/latest#table)
24
+ * - [x] [Inline Table](https://toml.io/en/latest#inline-table)
25
+ * - [ ] [Array of Tables](https://toml.io/en/latest#array-of-tables)
26
+ *
27
+ * _Supported with warnings see [Warning](#Warning)._
28
+ *
29
+ * ### Warning
30
+ *
31
+ * #### String
32
+ *
33
+ * Due to the spec, there is no flag to detect regex properly in a TOML
34
+ * declaration. So the regex is stored as string.
35
+ *
36
+ * #### Integer
37
+ *
38
+ * For **Binary** / **Octal** / **Hexadecimal** numbers, they are stored as string
39
+ * to be not interpreted as Decimal.
40
+ *
41
+ * #### Local Time
42
+ *
43
+ * Because local time does not exist in JavaScript, the local time is stored as a
44
+ * string.
45
+ *
46
+ * #### Array of Tables
47
+ *
48
+ * At the moment only simple declarations like below are supported:
49
+ *
50
+ * ```toml
51
+ * [[bin]]
52
+ * name = "deno"
53
+ * path = "cli/main.rs"
54
+ *
55
+ * [[bin]]
56
+ * name = "deno_core"
57
+ * path = "src/foo.rs"
58
+ *
59
+ * [[nib]]
60
+ * name = "node"
61
+ * path = "not_found"
62
+ * ```
63
+ *
64
+ * will output:
65
+ *
66
+ * ```json
67
+ * {
68
+ * "bin": [
69
+ * { "name": "deno", "path": "cli/main.rs" },
70
+ * { "name": "deno_core", "path": "src/foo.rs" }
71
+ * ],
72
+ * "nib": [{ "name": "node", "path": "not_found" }]
73
+ * }
74
+ * ```
75
+ *
76
+ * ```ts
77
+ * import { parse, stringify } from "@std/toml";
78
+ * import { assertEquals } from "@std/assert";
79
+ *
80
+ * const obj = {
81
+ * bin: [
82
+ * { name: "deno", path: "cli/main.rs" },
83
+ * { name: "deno_core", path: "src/foo.rs" },
84
+ * ],
85
+ * nib: [{ name: "node", path: "not_found" }],
86
+ * };
87
+ *
88
+ * const tomlString = stringify(obj);
89
+ * assertEquals(tomlString, `
90
+ * [[bin]]
91
+ * name = "deno"
92
+ * path = "cli/main.rs"
93
+ *
94
+ * [[bin]]
95
+ * name = "deno_core"
96
+ * path = "src/foo.rs"
97
+ *
98
+ * [[nib]]
99
+ * name = "node"
100
+ * path = "not_found"
101
+ * `);
102
+ *
103
+ * const tomlObject = parse(tomlString);
104
+ * assertEquals(tomlObject, obj);
105
+ * ```
106
+ *
107
+ * @module
108
+ */
109
+ export * from "./stringify.js";
110
+ export * from "./parse.js";
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Parses a {@link https://toml.io | TOML} string into an object.
3
+ *
4
+ * @example Usage
5
+ * ```ts
6
+ * import { parse } from "@std/toml/parse";
7
+ * import { assertEquals } from "@std/assert";
8
+ *
9
+ * const tomlString = `title = "TOML Example"
10
+ * [owner]
11
+ * name = "Alice"
12
+ * bio = "Alice is a programmer."`;
13
+ *
14
+ * const obj = parse(tomlString);
15
+ * assertEquals(obj, { title: "TOML Example", owner: { name: "Alice", bio: "Alice is a programmer." } });
16
+ * ```
17
+ * @param tomlString TOML string to be parsed.
18
+ * @returns The parsed JS object.
19
+ */
20
+ export declare function parse(tomlString: string): Record<string, unknown>;
21
+ //# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/toml/1.0.11/parse.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEjE"}
@@ -0,0 +1,25 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ import { parserFactory, toml } from "./_parser.js";
4
+ /**
5
+ * Parses a {@link https://toml.io | TOML} string into an object.
6
+ *
7
+ * @example Usage
8
+ * ```ts
9
+ * import { parse } from "@std/toml/parse";
10
+ * import { assertEquals } from "@std/assert";
11
+ *
12
+ * const tomlString = `title = "TOML Example"
13
+ * [owner]
14
+ * name = "Alice"
15
+ * bio = "Alice is a programmer."`;
16
+ *
17
+ * const obj = parse(tomlString);
18
+ * assertEquals(obj, { title: "TOML Example", owner: { name: "Alice", bio: "Alice is a programmer." } });
19
+ * ```
20
+ * @param tomlString TOML string to be parsed.
21
+ * @returns The parsed JS object.
22
+ */
23
+ export function parse(tomlString) {
24
+ return parserFactory(toml)(tomlString);
25
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Options for {@linkcode stringify}.
3
+ */
4
+ export interface StringifyOptions {
5
+ /**
6
+ * Define if the keys should be aligned or not.
7
+ *
8
+ * @default {false}
9
+ */
10
+ keyAlignment?: boolean;
11
+ }
12
+ /**
13
+ * Converts an object to a {@link https://toml.io | TOML} string.
14
+ *
15
+ * @example Usage
16
+ * ```ts
17
+ * import { stringify } from "@std/toml/stringify";
18
+ * import { assertEquals } from "@std/assert";
19
+ *
20
+ * const obj = {
21
+ * title: "TOML Example",
22
+ * owner: {
23
+ * name: "Bob",
24
+ * bio: "Bob is a cool guy",
25
+ * }
26
+ * };
27
+ * const tomlString = stringify(obj);
28
+ * assertEquals(tomlString, `title = "TOML Example"\n\n[owner]\nname = "Bob"\nbio = "Bob is a cool guy"\n`);
29
+ * ```
30
+ * @param obj Source object
31
+ * @param options Options for stringifying.
32
+ * @returns TOML string
33
+ */
34
+ export declare function stringify(obj: Record<string, unknown>, options?: StringifyOptions): string;
35
+ //# sourceMappingURL=stringify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/toml/1.0.11/stringify.ts"],"names":[],"mappings":"AAsBA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AA2OD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,OAAO,CAAC,EAAE,gBAAgB,GACzB,MAAM,CAER"}
@@ -0,0 +1,283 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
6
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7
+ };
8
+ var _Dumper_instances, _Dumper_arrayTypeCache, _Dumper_printObject, _Dumper_isPrimitive, _Dumper_getTypeOfArray, _Dumper_doGetTypeOfArray, _Dumper_printAsInlineValue, _Dumper_isSimplySerializable, _Dumper_header, _Dumper_headerGroup, _Dumper_declaration, _Dumper_arrayDeclaration, _Dumper_strDeclaration, _Dumper_numberDeclaration, _Dumper_boolDeclaration, _Dumper_printDate, _Dumper_dateDeclaration, _Dumper_format;
9
+ // Bare keys may only contain ASCII letters,
10
+ // ASCII digits, underscores, and dashes (A-Za-z0-9_-).
11
+ function joinKeys(keys) {
12
+ // Dotted keys are a sequence of bare or quoted keys joined with a dot.
13
+ // This allows for grouping similar properties together:
14
+ return keys
15
+ .map((str) => {
16
+ return str.length === 0 || str.match(/[^A-Za-z0-9_-]/)
17
+ ? JSON.stringify(str)
18
+ : str;
19
+ })
20
+ .join(".");
21
+ }
22
+ class Dumper {
23
+ constructor(srcObjc) {
24
+ _Dumper_instances.add(this);
25
+ Object.defineProperty(this, "maxPad", {
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true,
29
+ value: 0
30
+ });
31
+ Object.defineProperty(this, "srcObject", {
32
+ enumerable: true,
33
+ configurable: true,
34
+ writable: true,
35
+ value: void 0
36
+ });
37
+ Object.defineProperty(this, "output", {
38
+ enumerable: true,
39
+ configurable: true,
40
+ writable: true,
41
+ value: []
42
+ });
43
+ _Dumper_arrayTypeCache.set(this, new Map());
44
+ this.srcObject = srcObjc;
45
+ }
46
+ dump(fmtOptions = {}) {
47
+ // deno-lint-ignore no-explicit-any
48
+ this.output = __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printObject).call(this, this.srcObject);
49
+ this.output = __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_format).call(this, fmtOptions);
50
+ return this.output;
51
+ }
52
+ }
53
+ _Dumper_arrayTypeCache = new WeakMap(), _Dumper_instances = new WeakSet(), _Dumper_printObject = function _Dumper_printObject(obj, keys = []) {
54
+ const out = [];
55
+ const props = Object.keys(obj);
56
+ const inlineProps = [];
57
+ const multilineProps = [];
58
+ for (const prop of props) {
59
+ if (__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_isSimplySerializable).call(this, obj[prop])) {
60
+ inlineProps.push(prop);
61
+ }
62
+ else {
63
+ multilineProps.push(prop);
64
+ }
65
+ }
66
+ const sortedProps = inlineProps.concat(multilineProps);
67
+ for (const prop of sortedProps) {
68
+ const value = obj[prop];
69
+ if (value instanceof Date) {
70
+ out.push(__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_dateDeclaration).call(this, [prop], value));
71
+ }
72
+ else if (typeof value === "string" || value instanceof RegExp) {
73
+ out.push(__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_strDeclaration).call(this, [prop], value.toString()));
74
+ }
75
+ else if (typeof value === "number") {
76
+ out.push(__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_numberDeclaration).call(this, [prop], value));
77
+ }
78
+ else if (typeof value === "boolean") {
79
+ out.push(__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_boolDeclaration).call(this, [prop], value));
80
+ }
81
+ else if (value instanceof Array) {
82
+ const arrayType = __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_getTypeOfArray).call(this, value);
83
+ if (arrayType === "ONLY_PRIMITIVE") {
84
+ out.push(__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_arrayDeclaration).call(this, [prop], value));
85
+ }
86
+ else if (arrayType === "ONLY_OBJECT_EXCLUDING_ARRAY") {
87
+ // array of objects
88
+ for (let i = 0; i < value.length; i++) {
89
+ out.push("");
90
+ out.push(__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_headerGroup).call(this, [...keys, prop]));
91
+ out.push(...__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printObject).call(this, value[i], [...keys, prop]));
92
+ }
93
+ }
94
+ else {
95
+ // this is a complex array, use the inline format.
96
+ const str = value.map((x) => __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printAsInlineValue).call(this, x)).join(",");
97
+ out.push(`${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, [prop])}[${str}]`);
98
+ }
99
+ }
100
+ else if (typeof value === "object") {
101
+ out.push("");
102
+ out.push(__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_header).call(this, [...keys, prop]));
103
+ if (value) {
104
+ const toParse = value;
105
+ out.push(...__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printObject).call(this, toParse, [...keys, prop]));
106
+ }
107
+ // out.push(...this._parse(value, `${path}${prop}.`));
108
+ }
109
+ }
110
+ out.push("");
111
+ return out;
112
+ }, _Dumper_isPrimitive = function _Dumper_isPrimitive(value) {
113
+ return value instanceof Date ||
114
+ value instanceof RegExp ||
115
+ ["string", "number", "boolean"].includes(typeof value);
116
+ }, _Dumper_getTypeOfArray = function _Dumper_getTypeOfArray(arr) {
117
+ if (__classPrivateFieldGet(this, _Dumper_arrayTypeCache, "f").has(arr)) {
118
+ return __classPrivateFieldGet(this, _Dumper_arrayTypeCache, "f").get(arr);
119
+ }
120
+ const type = __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_doGetTypeOfArray).call(this, arr);
121
+ __classPrivateFieldGet(this, _Dumper_arrayTypeCache, "f").set(arr, type);
122
+ return type;
123
+ }, _Dumper_doGetTypeOfArray = function _Dumper_doGetTypeOfArray(arr) {
124
+ if (!arr.length) {
125
+ // any type should be fine
126
+ return "ONLY_PRIMITIVE";
127
+ }
128
+ const onlyPrimitive = __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_isPrimitive).call(this, arr[0]);
129
+ if (arr[0] instanceof Array) {
130
+ return "MIXED";
131
+ }
132
+ for (let i = 1; i < arr.length; i++) {
133
+ if (onlyPrimitive !== __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_isPrimitive).call(this, arr[i]) || arr[i] instanceof Array) {
134
+ return "MIXED";
135
+ }
136
+ }
137
+ return onlyPrimitive ? "ONLY_PRIMITIVE" : "ONLY_OBJECT_EXCLUDING_ARRAY";
138
+ }, _Dumper_printAsInlineValue = function _Dumper_printAsInlineValue(value) {
139
+ if (value instanceof Date) {
140
+ return `"${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printDate).call(this, value)}"`;
141
+ }
142
+ else if (typeof value === "string" || value instanceof RegExp) {
143
+ return JSON.stringify(value.toString());
144
+ }
145
+ else if (typeof value === "number") {
146
+ return value;
147
+ }
148
+ else if (typeof value === "boolean") {
149
+ return value.toString();
150
+ }
151
+ else if (value instanceof Array) {
152
+ const str = value.map((x) => __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printAsInlineValue).call(this, x)).join(",");
153
+ return `[${str}]`;
154
+ }
155
+ else if (typeof value === "object") {
156
+ if (!value) {
157
+ throw new Error("Should never reach");
158
+ }
159
+ const str = Object.keys(value).map((key) => {
160
+ return `${joinKeys([key])} = ${
161
+ // deno-lint-ignore no-explicit-any
162
+ __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printAsInlineValue).call(this, value[key])}`;
163
+ }).join(",");
164
+ return `{${str}}`;
165
+ }
166
+ throw new Error("Should never reach");
167
+ }, _Dumper_isSimplySerializable = function _Dumper_isSimplySerializable(value) {
168
+ return (typeof value === "string" ||
169
+ typeof value === "number" ||
170
+ typeof value === "boolean" ||
171
+ value instanceof RegExp ||
172
+ value instanceof Date ||
173
+ (value instanceof Array &&
174
+ __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_getTypeOfArray).call(this, value) !== "ONLY_OBJECT_EXCLUDING_ARRAY"));
175
+ }, _Dumper_header = function _Dumper_header(keys) {
176
+ return `[${joinKeys(keys)}]`;
177
+ }, _Dumper_headerGroup = function _Dumper_headerGroup(keys) {
178
+ return `[[${joinKeys(keys)}]]`;
179
+ }, _Dumper_declaration = function _Dumper_declaration(keys) {
180
+ const title = joinKeys(keys);
181
+ if (title.length > this.maxPad) {
182
+ this.maxPad = title.length;
183
+ }
184
+ return `${title} = `;
185
+ }, _Dumper_arrayDeclaration = function _Dumper_arrayDeclaration(keys, value) {
186
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}${JSON.stringify(value)}`;
187
+ }, _Dumper_strDeclaration = function _Dumper_strDeclaration(keys, value) {
188
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}${JSON.stringify(value)}`;
189
+ }, _Dumper_numberDeclaration = function _Dumper_numberDeclaration(keys, value) {
190
+ if (Number.isNaN(value)) {
191
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}nan`;
192
+ }
193
+ switch (value) {
194
+ case Infinity:
195
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}inf`;
196
+ case -Infinity:
197
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}-inf`;
198
+ default:
199
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}${value}`;
200
+ }
201
+ }, _Dumper_boolDeclaration = function _Dumper_boolDeclaration(keys, value) {
202
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}${value}`;
203
+ }, _Dumper_printDate = function _Dumper_printDate(value) {
204
+ function dtPad(v, lPad = 2) {
205
+ return v.padStart(lPad, "0");
206
+ }
207
+ const m = dtPad((value.getUTCMonth() + 1).toString());
208
+ const d = dtPad(value.getUTCDate().toString());
209
+ const h = dtPad(value.getUTCHours().toString());
210
+ const min = dtPad(value.getUTCMinutes().toString());
211
+ const s = dtPad(value.getUTCSeconds().toString());
212
+ const ms = dtPad(value.getUTCMilliseconds().toString(), 3);
213
+ // formatted date
214
+ const fData = `${value.getUTCFullYear()}-${m}-${d}T${h}:${min}:${s}.${ms}`;
215
+ return fData;
216
+ }, _Dumper_dateDeclaration = function _Dumper_dateDeclaration(keys, value) {
217
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printDate).call(this, value)}`;
218
+ }, _Dumper_format = function _Dumper_format(options = {}) {
219
+ const { keyAlignment = false } = options;
220
+ const rDeclaration = /^(\".*\"|[^=]*)\s=/;
221
+ const out = [];
222
+ for (let i = 0; i < this.output.length; i++) {
223
+ const l = this.output[i];
224
+ // we keep empty entry for array of objects
225
+ if (l[0] === "[" && l[1] !== "[") {
226
+ // non-empty object with only subobjects as properties
227
+ if (this.output[i + 1] === "" &&
228
+ this.output[i + 2]?.slice(0, l.length) === l.slice(0, -1) + ".") {
229
+ i += 1;
230
+ continue;
231
+ }
232
+ out.push(l);
233
+ }
234
+ else {
235
+ if (keyAlignment) {
236
+ const m = rDeclaration.exec(l);
237
+ if (m && m[1]) {
238
+ out.push(l.replace(m[1], m[1].padEnd(this.maxPad)));
239
+ }
240
+ else {
241
+ out.push(l);
242
+ }
243
+ }
244
+ else {
245
+ out.push(l);
246
+ }
247
+ }
248
+ }
249
+ // Cleaning multiple spaces
250
+ const cleanedOutput = [];
251
+ for (let i = 0; i < out.length; i++) {
252
+ const l = out[i];
253
+ if (!(l === "" && out[i + 1] === "")) {
254
+ cleanedOutput.push(l);
255
+ }
256
+ }
257
+ return cleanedOutput;
258
+ };
259
+ /**
260
+ * Converts an object to a {@link https://toml.io | TOML} string.
261
+ *
262
+ * @example Usage
263
+ * ```ts
264
+ * import { stringify } from "@std/toml/stringify";
265
+ * import { assertEquals } from "@std/assert";
266
+ *
267
+ * const obj = {
268
+ * title: "TOML Example",
269
+ * owner: {
270
+ * name: "Bob",
271
+ * bio: "Bob is a cool guy",
272
+ * }
273
+ * };
274
+ * const tomlString = stringify(obj);
275
+ * assertEquals(tomlString, `title = "TOML Example"\n\n[owner]\nname = "Bob"\nbio = "Bob is a cool guy"\n`);
276
+ * ```
277
+ * @param obj Source object
278
+ * @param options Options for stringifying.
279
+ * @returns TOML string
280
+ */
281
+ export function stringify(obj, options) {
282
+ return new Dumper(obj).dump(options).join("\n");
283
+ }