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

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 +34 -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 +10647 -4637
  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 +10647 -4637
  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,126 @@
1
+ "use strict";
2
+ // Copyright 2018-2025 the Deno authors. MIT license.
3
+ // This module is browser compatible.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ /**
20
+ * {@linkcode parse} and {@linkcode stringify} for handling
21
+ * {@link https://toml.io | TOML} encoded data.
22
+ *
23
+ * Be sure to read the supported types as not every spec is supported at the
24
+ * moment and the handling in TypeScript side is a bit different.
25
+ *
26
+ * ## Supported types and handling
27
+ *
28
+ * - [x] [Keys](https://toml.io/en/latest#keys)
29
+ * - [ ] [String](https://toml.io/en/latest#string)
30
+ * - [x] [Multiline String](https://toml.io/en/latest#string)
31
+ * - [x] [Literal String](https://toml.io/en/latest#string)
32
+ * - [ ] [Integer](https://toml.io/en/latest#integer)
33
+ * - [x] [Float](https://toml.io/en/latest#float)
34
+ * - [x] [Boolean](https://toml.io/en/latest#boolean)
35
+ * - [x] [Offset Date-time](https://toml.io/en/latest#offset-date-time)
36
+ * - [x] [Local Date-time](https://toml.io/en/latest#local-date-time)
37
+ * - [x] [Local Date](https://toml.io/en/latest#local-date)
38
+ * - [ ] [Local Time](https://toml.io/en/latest#local-time)
39
+ * - [x] [Table](https://toml.io/en/latest#table)
40
+ * - [x] [Inline Table](https://toml.io/en/latest#inline-table)
41
+ * - [ ] [Array of Tables](https://toml.io/en/latest#array-of-tables)
42
+ *
43
+ * _Supported with warnings see [Warning](#Warning)._
44
+ *
45
+ * ### Warning
46
+ *
47
+ * #### String
48
+ *
49
+ * Due to the spec, there is no flag to detect regex properly in a TOML
50
+ * declaration. So the regex is stored as string.
51
+ *
52
+ * #### Integer
53
+ *
54
+ * For **Binary** / **Octal** / **Hexadecimal** numbers, they are stored as string
55
+ * to be not interpreted as Decimal.
56
+ *
57
+ * #### Local Time
58
+ *
59
+ * Because local time does not exist in JavaScript, the local time is stored as a
60
+ * string.
61
+ *
62
+ * #### Array of Tables
63
+ *
64
+ * At the moment only simple declarations like below are supported:
65
+ *
66
+ * ```toml
67
+ * [[bin]]
68
+ * name = "deno"
69
+ * path = "cli/main.rs"
70
+ *
71
+ * [[bin]]
72
+ * name = "deno_core"
73
+ * path = "src/foo.rs"
74
+ *
75
+ * [[nib]]
76
+ * name = "node"
77
+ * path = "not_found"
78
+ * ```
79
+ *
80
+ * will output:
81
+ *
82
+ * ```json
83
+ * {
84
+ * "bin": [
85
+ * { "name": "deno", "path": "cli/main.rs" },
86
+ * { "name": "deno_core", "path": "src/foo.rs" }
87
+ * ],
88
+ * "nib": [{ "name": "node", "path": "not_found" }]
89
+ * }
90
+ * ```
91
+ *
92
+ * ```ts
93
+ * import { parse, stringify } from "@std/toml";
94
+ * import { assertEquals } from "@std/assert";
95
+ *
96
+ * const obj = {
97
+ * bin: [
98
+ * { name: "deno", path: "cli/main.rs" },
99
+ * { name: "deno_core", path: "src/foo.rs" },
100
+ * ],
101
+ * nib: [{ name: "node", path: "not_found" }],
102
+ * };
103
+ *
104
+ * const tomlString = stringify(obj);
105
+ * assertEquals(tomlString, `
106
+ * [[bin]]
107
+ * name = "deno"
108
+ * path = "cli/main.rs"
109
+ *
110
+ * [[bin]]
111
+ * name = "deno_core"
112
+ * path = "src/foo.rs"
113
+ *
114
+ * [[nib]]
115
+ * name = "node"
116
+ * path = "not_found"
117
+ * `);
118
+ *
119
+ * const tomlObject = parse(tomlString);
120
+ * assertEquals(tomlObject, obj);
121
+ * ```
122
+ *
123
+ * @module
124
+ */
125
+ __exportStar(require("./stringify.js"), exports);
126
+ __exportStar(require("./parse.js"), exports);
@@ -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,28 @@
1
+ "use strict";
2
+ // Copyright 2018-2025 the Deno authors. MIT license.
3
+ // This module is browser compatible.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.parse = parse;
6
+ const _parser_js_1 = require("./_parser.js");
7
+ /**
8
+ * Parses a {@link https://toml.io | TOML} string into an object.
9
+ *
10
+ * @example Usage
11
+ * ```ts
12
+ * import { parse } from "@std/toml/parse";
13
+ * import { assertEquals } from "@std/assert";
14
+ *
15
+ * const tomlString = `title = "TOML Example"
16
+ * [owner]
17
+ * name = "Alice"
18
+ * bio = "Alice is a programmer."`;
19
+ *
20
+ * const obj = parse(tomlString);
21
+ * assertEquals(obj, { title: "TOML Example", owner: { name: "Alice", bio: "Alice is a programmer." } });
22
+ * ```
23
+ * @param tomlString TOML string to be parsed.
24
+ * @returns The parsed JS object.
25
+ */
26
+ function parse(tomlString) {
27
+ return (0, _parser_js_1.parserFactory)(_parser_js_1.toml)(tomlString);
28
+ }
@@ -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,286 @@
1
+ "use strict";
2
+ // Copyright 2018-2025 the Deno authors. MIT license.
3
+ // This module is browser compatible.
4
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
5
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
6
+ 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");
7
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
8
+ };
9
+ 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;
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.stringify = stringify;
12
+ // Bare keys may only contain ASCII letters,
13
+ // ASCII digits, underscores, and dashes (A-Za-z0-9_-).
14
+ function joinKeys(keys) {
15
+ // Dotted keys are a sequence of bare or quoted keys joined with a dot.
16
+ // This allows for grouping similar properties together:
17
+ return keys
18
+ .map((str) => {
19
+ return str.length === 0 || str.match(/[^A-Za-z0-9_-]/)
20
+ ? JSON.stringify(str)
21
+ : str;
22
+ })
23
+ .join(".");
24
+ }
25
+ class Dumper {
26
+ constructor(srcObjc) {
27
+ _Dumper_instances.add(this);
28
+ Object.defineProperty(this, "maxPad", {
29
+ enumerable: true,
30
+ configurable: true,
31
+ writable: true,
32
+ value: 0
33
+ });
34
+ Object.defineProperty(this, "srcObject", {
35
+ enumerable: true,
36
+ configurable: true,
37
+ writable: true,
38
+ value: void 0
39
+ });
40
+ Object.defineProperty(this, "output", {
41
+ enumerable: true,
42
+ configurable: true,
43
+ writable: true,
44
+ value: []
45
+ });
46
+ _Dumper_arrayTypeCache.set(this, new Map());
47
+ this.srcObject = srcObjc;
48
+ }
49
+ dump(fmtOptions = {}) {
50
+ // deno-lint-ignore no-explicit-any
51
+ this.output = __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printObject).call(this, this.srcObject);
52
+ this.output = __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_format).call(this, fmtOptions);
53
+ return this.output;
54
+ }
55
+ }
56
+ _Dumper_arrayTypeCache = new WeakMap(), _Dumper_instances = new WeakSet(), _Dumper_printObject = function _Dumper_printObject(obj, keys = []) {
57
+ const out = [];
58
+ const props = Object.keys(obj);
59
+ const inlineProps = [];
60
+ const multilineProps = [];
61
+ for (const prop of props) {
62
+ if (__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_isSimplySerializable).call(this, obj[prop])) {
63
+ inlineProps.push(prop);
64
+ }
65
+ else {
66
+ multilineProps.push(prop);
67
+ }
68
+ }
69
+ const sortedProps = inlineProps.concat(multilineProps);
70
+ for (const prop of sortedProps) {
71
+ const value = obj[prop];
72
+ if (value instanceof Date) {
73
+ out.push(__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_dateDeclaration).call(this, [prop], value));
74
+ }
75
+ else if (typeof value === "string" || value instanceof RegExp) {
76
+ out.push(__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_strDeclaration).call(this, [prop], value.toString()));
77
+ }
78
+ else if (typeof value === "number") {
79
+ out.push(__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_numberDeclaration).call(this, [prop], value));
80
+ }
81
+ else if (typeof value === "boolean") {
82
+ out.push(__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_boolDeclaration).call(this, [prop], value));
83
+ }
84
+ else if (value instanceof Array) {
85
+ const arrayType = __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_getTypeOfArray).call(this, value);
86
+ if (arrayType === "ONLY_PRIMITIVE") {
87
+ out.push(__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_arrayDeclaration).call(this, [prop], value));
88
+ }
89
+ else if (arrayType === "ONLY_OBJECT_EXCLUDING_ARRAY") {
90
+ // array of objects
91
+ for (let i = 0; i < value.length; i++) {
92
+ out.push("");
93
+ out.push(__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_headerGroup).call(this, [...keys, prop]));
94
+ out.push(...__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printObject).call(this, value[i], [...keys, prop]));
95
+ }
96
+ }
97
+ else {
98
+ // this is a complex array, use the inline format.
99
+ const str = value.map((x) => __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printAsInlineValue).call(this, x)).join(",");
100
+ out.push(`${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, [prop])}[${str}]`);
101
+ }
102
+ }
103
+ else if (typeof value === "object") {
104
+ out.push("");
105
+ out.push(__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_header).call(this, [...keys, prop]));
106
+ if (value) {
107
+ const toParse = value;
108
+ out.push(...__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printObject).call(this, toParse, [...keys, prop]));
109
+ }
110
+ // out.push(...this._parse(value, `${path}${prop}.`));
111
+ }
112
+ }
113
+ out.push("");
114
+ return out;
115
+ }, _Dumper_isPrimitive = function _Dumper_isPrimitive(value) {
116
+ return value instanceof Date ||
117
+ value instanceof RegExp ||
118
+ ["string", "number", "boolean"].includes(typeof value);
119
+ }, _Dumper_getTypeOfArray = function _Dumper_getTypeOfArray(arr) {
120
+ if (__classPrivateFieldGet(this, _Dumper_arrayTypeCache, "f").has(arr)) {
121
+ return __classPrivateFieldGet(this, _Dumper_arrayTypeCache, "f").get(arr);
122
+ }
123
+ const type = __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_doGetTypeOfArray).call(this, arr);
124
+ __classPrivateFieldGet(this, _Dumper_arrayTypeCache, "f").set(arr, type);
125
+ return type;
126
+ }, _Dumper_doGetTypeOfArray = function _Dumper_doGetTypeOfArray(arr) {
127
+ if (!arr.length) {
128
+ // any type should be fine
129
+ return "ONLY_PRIMITIVE";
130
+ }
131
+ const onlyPrimitive = __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_isPrimitive).call(this, arr[0]);
132
+ if (arr[0] instanceof Array) {
133
+ return "MIXED";
134
+ }
135
+ for (let i = 1; i < arr.length; i++) {
136
+ if (onlyPrimitive !== __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_isPrimitive).call(this, arr[i]) || arr[i] instanceof Array) {
137
+ return "MIXED";
138
+ }
139
+ }
140
+ return onlyPrimitive ? "ONLY_PRIMITIVE" : "ONLY_OBJECT_EXCLUDING_ARRAY";
141
+ }, _Dumper_printAsInlineValue = function _Dumper_printAsInlineValue(value) {
142
+ if (value instanceof Date) {
143
+ return `"${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printDate).call(this, value)}"`;
144
+ }
145
+ else if (typeof value === "string" || value instanceof RegExp) {
146
+ return JSON.stringify(value.toString());
147
+ }
148
+ else if (typeof value === "number") {
149
+ return value;
150
+ }
151
+ else if (typeof value === "boolean") {
152
+ return value.toString();
153
+ }
154
+ else if (value instanceof Array) {
155
+ const str = value.map((x) => __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printAsInlineValue).call(this, x)).join(",");
156
+ return `[${str}]`;
157
+ }
158
+ else if (typeof value === "object") {
159
+ if (!value) {
160
+ throw new Error("Should never reach");
161
+ }
162
+ const str = Object.keys(value).map((key) => {
163
+ return `${joinKeys([key])} = ${
164
+ // deno-lint-ignore no-explicit-any
165
+ __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printAsInlineValue).call(this, value[key])}`;
166
+ }).join(",");
167
+ return `{${str}}`;
168
+ }
169
+ throw new Error("Should never reach");
170
+ }, _Dumper_isSimplySerializable = function _Dumper_isSimplySerializable(value) {
171
+ return (typeof value === "string" ||
172
+ typeof value === "number" ||
173
+ typeof value === "boolean" ||
174
+ value instanceof RegExp ||
175
+ value instanceof Date ||
176
+ (value instanceof Array &&
177
+ __classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_getTypeOfArray).call(this, value) !== "ONLY_OBJECT_EXCLUDING_ARRAY"));
178
+ }, _Dumper_header = function _Dumper_header(keys) {
179
+ return `[${joinKeys(keys)}]`;
180
+ }, _Dumper_headerGroup = function _Dumper_headerGroup(keys) {
181
+ return `[[${joinKeys(keys)}]]`;
182
+ }, _Dumper_declaration = function _Dumper_declaration(keys) {
183
+ const title = joinKeys(keys);
184
+ if (title.length > this.maxPad) {
185
+ this.maxPad = title.length;
186
+ }
187
+ return `${title} = `;
188
+ }, _Dumper_arrayDeclaration = function _Dumper_arrayDeclaration(keys, value) {
189
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}${JSON.stringify(value)}`;
190
+ }, _Dumper_strDeclaration = function _Dumper_strDeclaration(keys, value) {
191
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}${JSON.stringify(value)}`;
192
+ }, _Dumper_numberDeclaration = function _Dumper_numberDeclaration(keys, value) {
193
+ if (Number.isNaN(value)) {
194
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}nan`;
195
+ }
196
+ switch (value) {
197
+ case Infinity:
198
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}inf`;
199
+ case -Infinity:
200
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}-inf`;
201
+ default:
202
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}${value}`;
203
+ }
204
+ }, _Dumper_boolDeclaration = function _Dumper_boolDeclaration(keys, value) {
205
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}${value}`;
206
+ }, _Dumper_printDate = function _Dumper_printDate(value) {
207
+ function dtPad(v, lPad = 2) {
208
+ return v.padStart(lPad, "0");
209
+ }
210
+ const m = dtPad((value.getUTCMonth() + 1).toString());
211
+ const d = dtPad(value.getUTCDate().toString());
212
+ const h = dtPad(value.getUTCHours().toString());
213
+ const min = dtPad(value.getUTCMinutes().toString());
214
+ const s = dtPad(value.getUTCSeconds().toString());
215
+ const ms = dtPad(value.getUTCMilliseconds().toString(), 3);
216
+ // formatted date
217
+ const fData = `${value.getUTCFullYear()}-${m}-${d}T${h}:${min}:${s}.${ms}`;
218
+ return fData;
219
+ }, _Dumper_dateDeclaration = function _Dumper_dateDeclaration(keys, value) {
220
+ return `${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_declaration).call(this, keys)}${__classPrivateFieldGet(this, _Dumper_instances, "m", _Dumper_printDate).call(this, value)}`;
221
+ }, _Dumper_format = function _Dumper_format(options = {}) {
222
+ const { keyAlignment = false } = options;
223
+ const rDeclaration = /^(\".*\"|[^=]*)\s=/;
224
+ const out = [];
225
+ for (let i = 0; i < this.output.length; i++) {
226
+ const l = this.output[i];
227
+ // we keep empty entry for array of objects
228
+ if (l[0] === "[" && l[1] !== "[") {
229
+ // non-empty object with only subobjects as properties
230
+ if (this.output[i + 1] === "" &&
231
+ this.output[i + 2]?.slice(0, l.length) === l.slice(0, -1) + ".") {
232
+ i += 1;
233
+ continue;
234
+ }
235
+ out.push(l);
236
+ }
237
+ else {
238
+ if (keyAlignment) {
239
+ const m = rDeclaration.exec(l);
240
+ if (m && m[1]) {
241
+ out.push(l.replace(m[1], m[1].padEnd(this.maxPad)));
242
+ }
243
+ else {
244
+ out.push(l);
245
+ }
246
+ }
247
+ else {
248
+ out.push(l);
249
+ }
250
+ }
251
+ }
252
+ // Cleaning multiple spaces
253
+ const cleanedOutput = [];
254
+ for (let i = 0; i < out.length; i++) {
255
+ const l = out[i];
256
+ if (!(l === "" && out[i + 1] === "")) {
257
+ cleanedOutput.push(l);
258
+ }
259
+ }
260
+ return cleanedOutput;
261
+ };
262
+ /**
263
+ * Converts an object to a {@link https://toml.io | TOML} string.
264
+ *
265
+ * @example Usage
266
+ * ```ts
267
+ * import { stringify } from "@std/toml/stringify";
268
+ * import { assertEquals } from "@std/assert";
269
+ *
270
+ * const obj = {
271
+ * title: "TOML Example",
272
+ * owner: {
273
+ * name: "Bob",
274
+ * bio: "Bob is a cool guy",
275
+ * }
276
+ * };
277
+ * const tomlString = stringify(obj);
278
+ * assertEquals(tomlString, `title = "TOML Example"\n\n[owner]\nname = "Bob"\nbio = "Bob is a cool guy"\n`);
279
+ * ```
280
+ * @param obj Source object
281
+ * @param options Options for stringifying.
282
+ * @returns TOML string
283
+ */
284
+ function stringify(obj, options) {
285
+ return new Dumper(obj).dump(options).join("\n");
286
+ }