@workerstack/clients 1.0.0-rc.29 → 1.0.0-rc.31

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 (375) hide show
  1. package/README.md +548 -35
  2. package/assets/installers/examples/github.config.ts +17 -19
  3. package/assets/installers/examples/goreleaser.config.ts +16 -18
  4. package/assets/installers/examples/raw.config.ts +13 -15
  5. package/bin/clients.js +88 -68
  6. package/bin/installgen.js +18 -13
  7. package/dist/cli.d.ts +4 -4
  8. package/dist/cli.js +20 -12
  9. package/dist/emit/cli/channels.d.ts +2 -2
  10. package/dist/emit/cli/channels.js +18 -13
  11. package/dist/emit/cli/commands.d.ts +1 -1
  12. package/dist/emit/cli/commands.js +14 -8
  13. package/dist/emit/cli/discovery.d.ts +0 -6
  14. package/dist/emit/cli/discovery.js +9 -7
  15. package/dist/emit/cli/flags.d.ts +1 -3
  16. package/dist/emit/cli/flags.js +11 -5
  17. package/dist/emit/cli/install.d.ts +0 -8
  18. package/dist/emit/cli/install.js +3 -3
  19. package/dist/emit/cli/layout.d.ts +1 -1
  20. package/dist/emit/cli/layout.js +13 -10
  21. package/dist/emit/cli/module.d.ts +6 -6
  22. package/dist/emit/cli/module.js +10 -10
  23. package/dist/emit/cli/release.d.ts +0 -11
  24. package/dist/emit/cli/release.js +4 -4
  25. package/dist/emit/cli/skills.js +3 -3
  26. package/dist/emit/csharp/errors.js +4 -4
  27. package/dist/emit/csharp/json.js +8 -8
  28. package/dist/emit/csharp/realtime.js +3 -3
  29. package/dist/emit/csharp/sdk-answer.js +4 -4
  30. package/dist/emit/csharp/sdk-body.js +8 -6
  31. package/dist/emit/csharp/sdk-client.d.ts +3 -3
  32. package/dist/emit/csharp/sdk-client.js +2 -2
  33. package/dist/emit/csharp/sdk-csproj.d.ts +7 -9
  34. package/dist/emit/csharp/sdk-csproj.js +10 -10
  35. package/dist/emit/csharp/sdk-doc.js +1 -1
  36. package/dist/emit/csharp/sdk-method.d.ts +18 -2
  37. package/dist/emit/csharp/sdk-method.js +24 -9
  38. package/dist/emit/csharp/sdk-plan.js +0 -1
  39. package/dist/emit/csharp/sdk.js +7 -4
  40. package/dist/emit/csharp/sse.d.ts +0 -2
  41. package/dist/emit/csharp/sse.js +7 -7
  42. package/dist/emit/csharp/transport.js +7 -7
  43. package/dist/emit/csharp/types-enum.js +3 -1
  44. package/dist/emit/csharp/types-messages.js +3 -3
  45. package/dist/emit/csharp/types-names.js +10 -12
  46. package/dist/emit/csharp/types-record.js +3 -3
  47. package/dist/emit/csharp/types-union.d.ts +1 -1
  48. package/dist/emit/csharp/types.d.ts +0 -1
  49. package/dist/emit/csharp/types.js +3 -3
  50. package/dist/emit/csharp/ws.js +2 -2
  51. package/dist/emit/go/errors.js +1 -1
  52. package/dist/emit/go/http.js +2 -2
  53. package/dist/emit/go/module-path.js +2 -2
  54. package/dist/emit/go/sdk-answer.js +1 -1
  55. package/dist/emit/go/sdk-body.js +11 -7
  56. package/dist/emit/go/sdk-client.js +1 -1
  57. package/dist/emit/go/sdk-method.d.ts +9 -0
  58. package/dist/emit/go/sdk-method.js +12 -3
  59. package/dist/emit/go/sdk-mirror.js +2 -2
  60. package/dist/emit/go/sdk-opts.d.ts +0 -2
  61. package/dist/emit/go/sdk-opts.js +3 -3
  62. package/dist/emit/go/sdk.d.ts +1 -1
  63. package/dist/emit/go/sdk.js +12 -11
  64. package/dist/emit/go/sse.js +1 -1
  65. package/dist/emit/go/types-names.js +5 -0
  66. package/dist/emit/go/types-struct.d.ts +2 -1
  67. package/dist/emit/go/types-struct.js +1 -1
  68. package/dist/emit/go/types.js +9 -9
  69. package/dist/emit/go/ws.js +6 -6
  70. package/dist/emit/java/gradle.d.ts +7 -9
  71. package/dist/emit/java/gradle.js +8 -8
  72. package/dist/emit/java/json.js +1 -1
  73. package/dist/emit/java/layout-ast.js +1 -1
  74. package/dist/emit/java/layout-decl.js +5 -4
  75. package/dist/emit/java/layout-doc.js +13 -7
  76. package/dist/emit/java/layout-dot.js +1 -1
  77. package/dist/emit/java/layout-strings.js +4 -5
  78. package/dist/emit/java/layout-types.js +7 -5
  79. package/dist/emit/java/layout-visitor.js +4 -3
  80. package/dist/emit/java/layout.js +5 -4
  81. package/dist/emit/java/models-names.js +5 -4
  82. package/dist/emit/java/models-record.d.ts +0 -1
  83. package/dist/emit/java/models-record.js +3 -3
  84. package/dist/emit/java/models-union.d.ts +1 -1
  85. package/dist/emit/java/models-union.js +1 -1
  86. package/dist/emit/java/models.d.ts +1 -2
  87. package/dist/emit/java/models.js +25 -16
  88. package/dist/emit/java/realtime.d.ts +5 -17
  89. package/dist/emit/java/realtime.js +1 -1
  90. package/dist/emit/java/sdk-client.d.ts +6 -6
  91. package/dist/emit/java/sdk-client.js +2 -1
  92. package/dist/emit/java/sdk-decl.js +2 -2
  93. package/dist/emit/java/sdk-errors.js +1 -1
  94. package/dist/emit/java/sdk-headers.js +2 -2
  95. package/dist/emit/java/sdk-mirror.js +2 -2
  96. package/dist/emit/java/sdk-models.d.ts +1 -1
  97. package/dist/emit/java/sdk-models.js +7 -7
  98. package/dist/emit/java/sdk-op.d.ts +7 -11
  99. package/dist/emit/java/sdk-op.js +22 -10
  100. package/dist/emit/java/sdk-params.d.ts +5 -5
  101. package/dist/emit/java/sdk-params.js +3 -2
  102. package/dist/emit/java/sdk-plan.js +0 -1
  103. package/dist/emit/java/sdk.d.ts +1 -1
  104. package/dist/emit/java/sdk.js +21 -14
  105. package/dist/emit/java/sse.d.ts +2 -4
  106. package/dist/emit/java/sse.js +6 -6
  107. package/dist/emit/java/ws.d.ts +2 -2
  108. package/dist/emit/java/ws.js +3 -4
  109. package/dist/emit/mcp/annotations.js +8 -4
  110. package/dist/emit/mcp/files.js +9 -9
  111. package/dist/emit/mcp/mounted.js +2 -2
  112. package/dist/emit/mcp/output-schema.js +3 -3
  113. package/dist/emit/mcp/registry.d.ts +0 -2
  114. package/dist/emit/mcp/registry.js +5 -4
  115. package/dist/emit/mcp/runtime.js +2 -2
  116. package/dist/emit/mcp/schema.js +22 -11
  117. package/dist/emit/mcp/server.d.ts +7 -7
  118. package/dist/emit/mcp/server.js +7 -6
  119. package/dist/emit/mcp/tools.js +7 -6
  120. package/dist/emit/python/errors.js +3 -3
  121. package/dist/emit/python/realtime.js +2 -2
  122. package/dist/emit/python/sdk-answer.d.ts +3 -7
  123. package/dist/emit/python/sdk-answer.js +2 -2
  124. package/dist/emit/python/sdk-body.js +4 -5
  125. package/dist/emit/python/sdk-client.js +5 -5
  126. package/dist/emit/python/sdk-doc.js +2 -2
  127. package/dist/emit/python/sdk-method.d.ts +11 -0
  128. package/dist/emit/python/sdk-method.js +20 -5
  129. package/dist/emit/python/sdk-plan.js +0 -1
  130. package/dist/emit/python/sdk-pyproject.d.ts +0 -2
  131. package/dist/emit/python/sdk-pyproject.js +8 -8
  132. package/dist/emit/python/sdk.d.ts +1 -1
  133. package/dist/emit/python/sdk.js +12 -8
  134. package/dist/emit/python/sse.d.ts +0 -2
  135. package/dist/emit/python/sse.js +2 -2
  136. package/dist/emit/python/transport.js +4 -4
  137. package/dist/emit/python/types-dict.d.ts +2 -2
  138. package/dist/emit/python/types-dict.js +1 -1
  139. package/dist/emit/python/types-names.js +2 -2
  140. package/dist/emit/python/types-union.js +1 -1
  141. package/dist/emit/python/types.js +3 -3
  142. package/dist/emit/python/ws.d.ts +2 -5
  143. package/dist/emit/python/ws.js +4 -4
  144. package/dist/emit/rust/errors.js +3 -3
  145. package/dist/emit/rust/http.js +4 -4
  146. package/dist/emit/rust/realtime.js +2 -2
  147. package/dist/emit/rust/sdk-body.js +8 -5
  148. package/dist/emit/rust/sdk-cargo.d.ts +16 -18
  149. package/dist/emit/rust/sdk-cargo.js +12 -12
  150. package/dist/emit/rust/sdk-client.d.ts +1 -1
  151. package/dist/emit/rust/sdk-client.js +3 -3
  152. package/dist/emit/rust/sdk-method.d.ts +12 -1
  153. package/dist/emit/rust/sdk-method.js +12 -4
  154. package/dist/emit/rust/sdk-opts.d.ts +2 -1
  155. package/dist/emit/rust/sdk-opts.js +2 -2
  156. package/dist/emit/rust/sdk-plan.js +0 -1
  157. package/dist/emit/rust/sdk.d.ts +1 -1
  158. package/dist/emit/rust/sdk.js +9 -6
  159. package/dist/emit/rust/sse.d.ts +0 -5
  160. package/dist/emit/rust/sse.js +2 -2
  161. package/dist/emit/rust/types-names.js +3 -3
  162. package/dist/emit/rust/types-struct.js +1 -1
  163. package/dist/emit/rust/types-union.d.ts +1 -1
  164. package/dist/emit/rust/types.js +7 -5
  165. package/dist/emit/rust/ws.d.ts +0 -11
  166. package/dist/emit/rust/ws.js +5 -5
  167. package/dist/emit/shared/escape.js +17 -17
  168. package/dist/emit/shared/format.js +1 -1
  169. package/dist/emit/shared/gofmt.js +1 -1
  170. package/dist/emit/shared/lang.js +10 -10
  171. package/dist/emit/shared/literals.d.ts +5 -0
  172. package/dist/emit/shared/literals.js +8 -0
  173. package/dist/emit/shared/metadata.d.ts +0 -6
  174. package/dist/emit/shared/metadata.js +8 -7
  175. package/dist/emit/shared/ruff.js +1 -1
  176. package/dist/emit/shared/rustfmt.js +1 -1
  177. package/dist/emit/shared/type-emitter.js +37 -20
  178. package/dist/emit/shared/unknown-type.constants.d.ts +2 -0
  179. package/dist/emit/shared/unknown-type.constants.js +2 -0
  180. package/dist/emit/ts/http.d.ts +8 -2
  181. package/dist/emit/ts/http.js +51 -6
  182. package/dist/emit/ts/package.d.ts +14 -12
  183. package/dist/emit/ts/package.js +10 -8
  184. package/dist/emit/ts/route-tree.js +2 -2
  185. package/dist/emit/ts/sdk-types-preamble.d.ts +1 -1
  186. package/dist/emit/ts/sdk-types-preamble.js +12 -4
  187. package/dist/emit/ts/sdk-types.d.ts +0 -5
  188. package/dist/emit/ts/sdk-types.js +63 -19
  189. package/dist/emit/ts/sdk.d.ts +3 -1
  190. package/dist/emit/ts/sdk.js +44 -12
  191. package/dist/emit/ts/service-map.d.ts +7 -1
  192. package/dist/emit/ts/service-map.js +10 -1
  193. package/dist/emit/ts/single-flight-text.d.ts +3 -0
  194. package/dist/emit/ts/single-flight-text.js +38 -0
  195. package/dist/emit/ts/tanstack-query.d.ts +3 -2
  196. package/dist/emit/ts/tanstack-query.js +60 -35
  197. package/dist/emit/ts/type-gen.js +31 -18
  198. package/dist/emit/ts/webhooks.d.ts +0 -2
  199. package/dist/emit/ts/webhooks.js +3 -3
  200. package/dist/extract/chain.js +5 -4
  201. package/dist/extract/extract.js +5 -5
  202. package/dist/extract/serialize.d.ts +0 -2
  203. package/dist/extract/serialize.js +14 -15
  204. package/dist/extract/walk.js +15 -12
  205. package/dist/gen/args.js +9 -5
  206. package/dist/gen/formatters.js +5 -3
  207. package/dist/gen/process.js +2 -1
  208. package/dist/gen/shipped.js +2 -2
  209. package/dist/gen/switch-on.constants.d.ts +2 -0
  210. package/dist/gen/switch-on.constants.js +2 -0
  211. package/dist/gen/targets.d.ts +6 -7
  212. package/dist/gen/targets.js +11 -6
  213. package/dist/gen/write.js +4 -2
  214. package/dist/index.js +2 -2
  215. package/dist/installers/cli.d.ts +4 -4
  216. package/dist/installers/cli.js +24 -24
  217. package/dist/installers/commands/build.d.ts +4 -4
  218. package/dist/installers/commands/build.js +2 -3
  219. package/dist/installers/commands/check.d.ts +2 -2
  220. package/dist/installers/commands/check.js +11 -10
  221. package/dist/installers/commands/init.d.ts +2 -2
  222. package/dist/installers/commands/init.js +1 -2
  223. package/dist/installers/config/define-config.d.ts +16 -16
  224. package/dist/installers/config/define-config.js +1 -1
  225. package/dist/installers/config/hooks/bun.d.ts +6 -6
  226. package/dist/installers/config/hooks/node.js +1 -1
  227. package/dist/installers/config/load.d.ts +6 -8
  228. package/dist/installers/config/load.js +7 -8
  229. package/dist/installers/config/resolve.d.ts +1 -2
  230. package/dist/installers/config/resolve.js +28 -33
  231. package/dist/installers/config/types.d.ts +6 -6
  232. package/dist/installers/config/types.js +0 -1
  233. package/dist/installers/render/quote.js +3 -5
  234. package/dist/installers/render/render.d.ts +6 -6
  235. package/dist/installers/render/render.js +26 -26
  236. package/dist/installers/ui.d.ts +4 -4
  237. package/dist/installers/ui.js +3 -3
  238. package/dist/ir/build.d.ts +3 -3
  239. package/dist/ir/build.js +8 -5
  240. package/dist/ir/invalidate-reads.d.ts +17 -0
  241. package/dist/ir/invalidate-reads.js +104 -0
  242. package/dist/ir/load.d.ts +10 -0
  243. package/dist/ir/load.js +65 -18
  244. package/dist/ir/model.d.ts +2 -1
  245. package/dist/ir/model.js +0 -1
  246. package/dist/ir/read-method.constants.d.ts +2 -0
  247. package/dist/ir/read-method.constants.js +2 -0
  248. package/dist/ir/resolve-refs.js +2 -2
  249. package/dist/ir/resource-tree.js +2 -1
  250. package/dist/ir/route-tree-intern.js +1 -1
  251. package/dist/ir/schema.js +3 -3
  252. package/dist/ir/sdk-model.js +3 -3
  253. package/dist/ir/slots.js +13 -8
  254. package/dist/ir/streams.js +1 -1
  255. package/dist/release/bootstrap.d.ts +3 -3
  256. package/dist/release/bootstrap.js +7 -7
  257. package/dist/release/bump-args.js +4 -4
  258. package/dist/release/bump-command.d.ts +1 -1
  259. package/dist/release/bump-command.js +9 -10
  260. package/dist/release/bump.d.ts +5 -4
  261. package/dist/release/bump.js +2 -2
  262. package/dist/release/cli.d.ts +4 -4
  263. package/dist/release/cli.js +4 -4
  264. package/dist/release/codegen.js +1 -1
  265. package/dist/release/digest.js +5 -7
  266. package/dist/release/git.js +5 -8
  267. package/dist/release/load.js +4 -4
  268. package/dist/release/manifest.js +9 -10
  269. package/dist/release/oasdiff.d.ts +10 -15
  270. package/dist/release/oasdiff.js +5 -6
  271. package/dist/release/registries.d.ts +0 -11
  272. package/dist/release/registries.js +17 -17
  273. package/dist/release/release-state.d.ts +16 -13
  274. package/dist/release/release-workflow.js +5 -7
  275. package/dist/release/repo-settings.d.ts +2 -1
  276. package/dist/release/spec-gate.d.ts +0 -2
  277. package/dist/release/spec-gate.js +6 -10
  278. package/dist/release/sync-command.d.ts +2 -2
  279. package/dist/release/sync-command.js +1 -1
  280. package/dist/release/sync-tree.js +9 -13
  281. package/dist/release/sync.d.ts +6 -6
  282. package/dist/release/sync.js +12 -13
  283. package/dist/release/types.d.ts +22 -22
  284. package/dist/release/types.js +0 -1
  285. package/dist/release/version-files.d.ts +3 -4
  286. package/dist/release/version-files.js +4 -5
  287. package/dist/runtime/.oxfmtrc.jsonc +8 -0
  288. package/dist/runtime/csharp/Config.cs +9 -1
  289. package/dist/runtime/csharp/Exchange.cs +56 -4
  290. package/dist/runtime/csharp/Hooks.cs +9 -0
  291. package/dist/runtime/csharp/Operation.cs +6 -1
  292. package/dist/runtime/csharp/WsDial.cs +3 -1
  293. package/dist/runtime/go/config.go +5 -0
  294. package/dist/runtime/go/hooks.go +70 -0
  295. package/dist/runtime/go/request.go +6 -2
  296. package/dist/runtime/go/stream.go +4 -1
  297. package/dist/runtime/go/ws.go +3 -1
  298. package/dist/runtime/java/ClientConfig.java +11 -0
  299. package/dist/runtime/java/Flight.java +2 -12
  300. package/dist/runtime/java/Hooks.java +45 -0
  301. package/dist/runtime/java/InvalidateEvent.java +10 -0
  302. package/dist/runtime/java/InvalidateHook.java +12 -0
  303. package/dist/runtime/java/InvalidateTarget.java +7 -0
  304. package/dist/runtime/java/Operation.java +23 -3
  305. package/dist/runtime/java/Realtime.java +3 -1
  306. package/dist/runtime/java/WsDial.java +3 -0
  307. package/dist/runtime/mcp/files.ts +1 -1
  308. package/dist/runtime/mcp/http.ts +6 -2
  309. package/dist/runtime/mcp/listen.ts +1 -1
  310. package/dist/runtime/mcp/mount.ts +2 -2
  311. package/dist/runtime/mcp/protocol.ts +1 -1
  312. package/dist/runtime/python/config.py +8 -2
  313. package/dist/runtime/python/exchange.py +3 -1
  314. package/dist/runtime/python/hooks.py +110 -5
  315. package/dist/runtime/python/operation.py +2 -0
  316. package/dist/runtime/python/send_async.py +14 -2
  317. package/dist/runtime/python/send_sync.py +4 -2
  318. package/dist/runtime/python/ws.py +5 -1
  319. package/dist/runtime/rust/config.rs +6 -1
  320. package/dist/runtime/rust/exchange.rs +15 -3
  321. package/dist/runtime/rust/hooks.rs +127 -2
  322. package/dist/runtime/rust/log.rs +11 -3
  323. package/dist/runtime/rust/request.rs +17 -0
  324. package/dist/runtime/rust/ws.rs +9 -1
  325. package/dist/runtime/ts/config.ts +69 -0
  326. package/dist/runtime/ts/http.ts +12 -10
  327. package/dist/runtime/ts/request.ts +2 -0
  328. package/dist/runtime/ts/response.ts +7 -0
  329. package/dist/runtime/ts/sdk-invalidate.ts +82 -0
  330. package/dist/runtime/ts/sdk-single-flight.constants.ts +25 -0
  331. package/dist/runtime/ts/sdk-single-flight.ts +203 -0
  332. package/dist/runtime/ts/sdk-sse.ts +5 -1
  333. package/dist/runtime/ts/sdk-ws.ts +9 -3
  334. package/dist/runtime/ts/sdk.ts +55 -31
  335. package/dist/runtime/ts/single-flight-batch.ts +184 -0
  336. package/dist/runtime/ts/single-flight-body.ts +59 -0
  337. package/dist/runtime/ts/single-flight-run.ts +160 -0
  338. package/dist/runtime/ts/single-flight.constants.ts +31 -0
  339. package/dist/runtime/ts/single-flight.ts +158 -0
  340. package/dist/runtime/ts-tanstack-query/invalidate.ts +96 -92
  341. package/dist/runtime/ts-tanstack-query/query.ts +140 -170
  342. package/package.json +12 -17
  343. package/references/INDEX.md +31 -0
  344. package/references/cli.md +33 -0
  345. package/references/configuring.md +29 -0
  346. package/references/documentation.md +15 -0
  347. package/references/errors.md +23 -0
  348. package/references/flags.md +104 -0
  349. package/references/gates.md +46 -0
  350. package/references/generate.md +29 -0
  351. package/references/install-scripts.md +28 -0
  352. package/references/install.md +38 -0
  353. package/references/license.md +8 -0
  354. package/references/mcp.md +76 -0
  355. package/references/output.md +45 -0
  356. package/references/overview.md +14 -0
  357. package/references/release-tooling.md +34 -0
  358. package/references/release.md +305 -0
  359. package/references/sdks.md +393 -0
  360. package/references/start.md +22 -0
  361. package/references/tdd.md +16 -0
  362. package/dist/emit/cli/index.d.ts +0 -1
  363. package/dist/emit/cli/index.js +0 -1
  364. package/dist/emit/csharp/index.d.ts +0 -1
  365. package/dist/emit/csharp/index.js +0 -1
  366. package/dist/emit/go/index.d.ts +0 -1
  367. package/dist/emit/go/index.js +0 -1
  368. package/dist/emit/java/index.d.ts +0 -2
  369. package/dist/emit/java/index.js +0 -2
  370. package/dist/emit/mcp/index.d.ts +0 -3
  371. package/dist/emit/mcp/index.js +0 -3
  372. package/dist/emit/python/index.d.ts +0 -1
  373. package/dist/emit/python/index.js +0 -1
  374. package/dist/emit/rust/index.d.ts +0 -1
  375. package/dist/emit/rust/index.js +0 -1
@@ -12,7 +12,8 @@ import { authorName } from "../emit/shared/metadata.js";
12
12
  export const TARGETS = ["cli", "csharp", "go", "java", "mcp", "python", "rust", "ts"];
13
13
  /**
14
14
  * Each target and the names of its generate function's options, which `--<target>-<option>` carries as strings.
15
- * `--ts-tanstack-query` is the one switch that takes no value: it turns the TanStack Query adapter on.
15
+ * `--ts-tanstack-query` and `--ts-single-flight` are the switches that take no value: they turn the TanStack Query
16
+ * adapter and the single-flight handler on.
16
17
  */
17
18
  export const TARGET_OPTIONS = {
18
19
  cli: [
@@ -73,7 +74,7 @@ export const TARGET_OPTIONS = {
73
74
  "repository",
74
75
  "version",
75
76
  ],
76
- ts: ["name", "packageName", "stem", "tanstackQuery", "version"],
77
+ ts: ["name", "packageName", "singleFlight", "stem", "tanstackQuery", "version"],
77
78
  };
78
79
  /**
79
80
  * The target options that take no value, since their name already says what they turn on
@@ -81,7 +82,10 @@ export const TARGET_OPTIONS = {
81
82
  * the repo's README test (`tests/docs/readmes.test.ts`) reads to hold every flag to its README row; this table only
82
83
  * says how one is read. Bare is `true` and an inline `true`/`false` is read, exactly as `--watch` is.
83
84
  */
84
- const BOOLEAN_OPTIONS = { cli: ["aur"], ts: ["tanstackQuery"] };
85
+ const BOOLEAN_OPTIONS = {
86
+ cli: ["aur"],
87
+ ts: ["singleFlight", "tanstackQuery"],
88
+ };
85
89
  /** Whether `target`'s option `key` takes no value. */
86
90
  export function isBooleanOption(target, key) {
87
91
  const keys = BOOLEAN_OPTIONS[target] ?? [];
@@ -92,10 +96,11 @@ function issueOf(target, key, value) {
92
96
  const keys = TARGET_OPTIONS[target];
93
97
  if (!keys.includes(key))
94
98
  return { message: `unknown ${target} option ${JSON.stringify(key)}: want one of ${keys.join(", ")}`, path: [key] };
95
- if (isBooleanOption(target, key))
99
+ if (isBooleanOption(target, key)) {
96
100
  return value === "true" || value === "false"
97
101
  ? undefined
98
102
  : { message: `${target} option ${key}: want "true" or "false"`, path: [key] };
103
+ }
99
104
  return typeof value === "string" && value !== ""
100
105
  ? undefined
101
106
  : { message: `${target} option ${key}: want a non-empty string`, path: [key] };
@@ -106,7 +111,7 @@ function schemaOf(target) {
106
111
  validate(value) {
107
112
  if (typeof value !== "object" || value === null || Array.isArray(value))
108
113
  return { issues: [{ message: `${target} options: want an object of option names to strings` }] };
109
- /* an option given as undefined is not given: a caller's optional field, never a value */
114
+ // an option given as undefined is not given: a caller's optional field, never a value
110
115
  const given = Object.entries(value).filter(([, option]) => option !== undefined);
111
116
  const issues = given.flatMap(([key, option]) => issueOf(target, key, option) ?? []);
112
117
  return issues.length > 0 ? { issues } : { value: Object.fromEntries(given) };
@@ -122,7 +127,7 @@ function schemasOf() {
122
127
  return Object.fromEntries(TARGETS.map((target) => [target, schemaOf(target)]));
123
128
  }
124
129
  /** `value` as `target`'s options, or an error naming every problem its schema found. */
125
- export function checkedOptions(target, value) {
130
+ function checkedOptions(target, value) {
126
131
  const result = targetOptionSchemas[target]["~standard"].validate(value);
127
132
  if (result.issues !== undefined)
128
133
  throw new Error(result.issues.map((issue) => issue.message).join("; "));
package/dist/gen/write.js CHANGED
@@ -61,7 +61,9 @@ export function writeFileIfChanged(path, content) {
61
61
  function listed(dir) {
62
62
  try {
63
63
  const files = JSON.parse(readFileSync(join(dir, MANIFEST), "utf8")).files;
64
- return typeof files === "object" && files !== null && !Array.isArray(files) ? files : {};
64
+ return typeof files === "object" && files !== null && !Array.isArray(files)
65
+ ? files
66
+ : {};
65
67
  }
66
68
  catch {
67
69
  return {};
@@ -98,7 +100,7 @@ export function writeTarget(dir, files, packages) {
98
100
  kept.push(rel);
99
101
  continue;
100
102
  }
101
- /* a deleted file or directory is already gone (R7) */
103
+ // a deleted file or directory is already gone (R7)
102
104
  if (!existsSync(path))
103
105
  continue;
104
106
  if (!lstatSync(path).isFile() || sha256(readFileSync(path)) !== hash) {
package/dist/index.js CHANGED
@@ -10,6 +10,6 @@ export { generateRouteTree } from "./emit/ts/route-tree.js";
10
10
  export { generateTypes } from "./emit/ts/type-gen.js";
11
11
  export { generated, writeGenerated, } from "./cli.js";
12
12
  export { TARGETS, targetOptionSchemas, } from "./gen/targets.js";
13
- /* `writeTarget` writes one target's files into a directory the caller picks, keeping `MANIFEST` there: for a caller
14
- that lays out `generated`'s files itself rather than as `writeGenerated`'s `<out>/<target>` */
13
+ // `writeTarget` writes one target's files into a directory the caller picks, keeping `MANIFEST` there: for a caller
14
+ // that lays out `generated`'s files itself rather than as `writeGenerated`'s `<out>/<target>`
15
15
  export { MANIFEST, writeFileIfChanged, writeTarget } from "./gen/write.js";
@@ -1,14 +1,14 @@
1
1
  import { type RuntimeInfo } from "./config/load.ts";
2
2
  import { type UiIo } from "./ui.ts";
3
- export interface Io extends UiIo {
3
+ export type Io = UiIo & {
4
4
  cwd: string;
5
5
  runtime?: RuntimeInfo;
6
6
  fetch?: typeof fetch;
7
- }
7
+ };
8
8
  /** The whole CLI, in-process: every effect goes through `io`, so tests run it without spawning. Returns the exit code. */
9
9
  export declare function run(argv: readonly string[], io: Io): Promise<number>;
10
10
  /** The slice of `process` that `start` touches. */
11
- export interface Proc {
11
+ export type Proc = {
12
12
  stdout: NodeJS.WritableStream & {
13
13
  isTTY?: boolean;
14
14
  };
@@ -17,5 +17,5 @@ export interface Proc {
17
17
  env: Record<string, string | undefined>;
18
18
  exitCode?: number | string | null | undefined;
19
19
  exit(code?: number): void;
20
- }
20
+ };
21
21
  export declare function start(argv?: readonly string[], proc?: Proc): Promise<void>;
@@ -21,35 +21,35 @@ Options:
21
21
  Run \`installgen <command> --help\` for a command's options.
22
22
  `;
23
23
  const COMMANDS = {
24
- init: {
25
- usage: `Usage: installgen init [--preset ${ /* @__PURE__ */PRESETS.join("|")}] [--force]
26
-
27
- --preset <name> the example to start from (default: raw)
28
- --force overwrite an existing config
29
- `,
30
- options: { preset: { type: "string" }, force: { type: "boolean" } },
31
- },
32
24
  build: {
25
+ options: { config: { short: "c", type: "string" }, "default-version": { type: "string" }, out: { type: "string" } },
33
26
  usage: `Usage: installgen build [-c <path>] [--out <dir>] [--default-version <version>]
34
27
 
35
28
  -c, --config <path> the config (default: installgen.config.{ts,mts,js,mjs} in this directory)
36
29
  --out <dir> where to write the scripts (default: the config's outDir, installers)
37
30
  --default-version <version> install this version when the user names none (default: the latest file)
38
31
  `,
39
- options: { config: { type: "string", short: "c" }, out: { type: "string" }, "default-version": { type: "string" } },
40
32
  },
41
33
  check: {
34
+ options: {
35
+ config: { short: "c", type: "string" },
36
+ "default-version": { type: "string" },
37
+ list: { type: "boolean" },
38
+ },
42
39
  usage: `Usage: installgen check [-c <path>] [--default-version <version>] [--list]
43
40
 
44
41
  -c, --config <path> the config (default: installgen.config.{ts,mts,js,mjs} in this directory)
45
42
  --default-version <version> check this version (default: read the latest file)
46
43
  --list print the URLs the installers fetch, without fetching
47
44
  `,
48
- options: {
49
- config: { type: "string", short: "c" },
50
- "default-version": { type: "string" },
51
- list: { type: "boolean" },
52
- },
45
+ },
46
+ init: {
47
+ options: { force: { type: "boolean" }, preset: { type: "string" } },
48
+ usage: `Usage: installgen init [--preset ${ /* @__PURE__ */PRESETS.join("|")}] [--force]
49
+
50
+ --preset <name> the example to start from (default: raw)
51
+ --force overwrite an existing config
52
+ `,
53
53
  },
54
54
  };
55
55
  class UsageError extends Error {
@@ -74,10 +74,10 @@ function topLevel(command, io) {
74
74
  function parse(command, rest) {
75
75
  try {
76
76
  return parseArgs({
77
+ allowPositionals: false,
77
78
  args: [...rest],
78
- options: { ...COMMANDS[command].options, help: { type: "boolean", short: "h" } },
79
+ options: { ...COMMANDS[command].options, help: { short: "h", type: "boolean" } },
79
80
  strict: true,
80
- allowPositionals: false,
81
81
  }).values;
82
82
  }
83
83
  catch (error) {
@@ -96,19 +96,19 @@ async function dispatch(command, values, io, ui) {
96
96
  const configPath = values.config;
97
97
  const defaultVersion = values["default-version"];
98
98
  if (command === "init") {
99
- init({ cwd: io.cwd, preset: presetOf(values), force: values.force === true }, ui);
99
+ init({ cwd: io.cwd, force: values.force === true, preset: presetOf(values) }, ui);
100
100
  return 0;
101
101
  }
102
102
  if (command === "build") {
103
- await build({ cwd: io.cwd, configPath, runtime, out: values.out, defaultVersion }, ui);
103
+ await build({ configPath, cwd: io.cwd, defaultVersion, out: values.out, runtime }, ui);
104
104
  return 0;
105
105
  }
106
106
  const problems = await check({
107
- cwd: io.cwd,
108
107
  configPath,
109
- runtime,
108
+ cwd: io.cwd,
110
109
  defaultVersion,
111
110
  list: values.list === true,
111
+ runtime,
112
112
  ...(io.fetch ? { fetch: io.fetch } : {}),
113
113
  }, ui);
114
114
  return problems === 0 ? 0 : 1;
@@ -145,9 +145,9 @@ export async function run(argv, io) {
145
145
  }
146
146
  }
147
147
  export async function start(argv = process.argv.slice(2), proc = process) {
148
- /* a reader that closes early (`| head`, `| grep -q`) is done listening: stop writing and leave quietly */
148
+ // a reader that closes early (`| head`, `| grep -q`) is done listening: stop writing and leave quietly
149
149
  let closed = false;
150
- /* EPIPE, or EOF where Windows reports a closed pipe that way */
150
+ // EPIPE, or EOF where Windows reports a closed pipe that way
151
151
  const onError = (error) => {
152
152
  if (error.code !== "EPIPE" && error.code !== "EOF")
153
153
  throw error;
@@ -163,8 +163,8 @@ export async function start(argv = process.argv.slice(2), proc = process) {
163
163
  proc.exitCode = await run(argv, {
164
164
  cwd: proc.cwd(),
165
165
  env: proc.env,
166
- stdout: write(proc.stdout),
167
- stderr: write(proc.stderr),
168
166
  isTTY: proc.stdout.isTTY === true,
167
+ stderr: write(proc.stderr),
168
+ stdout: write(proc.stdout),
169
169
  });
170
170
  }
@@ -1,15 +1,15 @@
1
1
  import { type RuntimeInfo } from "../config/load.ts";
2
2
  import type { ResolvedConfig } from "../config/types.ts";
3
3
  import type { Ui } from "../ui.ts";
4
- export interface ConfigOptions {
4
+ export type ConfigOptions = {
5
5
  cwd: string;
6
6
  configPath: string | undefined;
7
7
  runtime: RuntimeInfo;
8
- }
8
+ };
9
9
  export declare function loadResolved(options: ConfigOptions): Promise<ResolvedConfig>;
10
10
  export declare function warnUnverified(resolved: ResolvedConfig, ui: Ui): void;
11
- export interface BuildOptions extends ConfigOptions {
11
+ export type BuildOptions = ConfigOptions & {
12
12
  out: string | undefined;
13
13
  defaultVersion: string | undefined;
14
- }
14
+ };
15
15
  export declare function build(options: BuildOptions, ui: Ui): Promise<void>;
@@ -4,13 +4,12 @@ import { loadConfig } from "../config/load.js";
4
4
  import { resolveConfig } from "../config/resolve.js";
5
5
  import { render } from "../render/render.js";
6
6
  export async function loadResolved(options) {
7
- const { config } = await loadConfig({ cwd: options.cwd, configPath: options.configPath, runtime: options.runtime });
7
+ const { config } = await loadConfig({ configPath: options.configPath, cwd: options.cwd, runtime: options.runtime });
8
8
  return resolveConfig(config);
9
9
  }
10
10
  export function warnUnverified(resolved, ui) {
11
- if (resolved.platforms.every((p) => p.checksums === undefined)) {
11
+ if (resolved.platforms.every((p) => p.checksums === undefined))
12
12
  ui.warn("no checksumsPath; the installers will not verify downloads (they show a warning row instead)");
13
- }
14
13
  }
15
14
  export async function build(options, ui) {
16
15
  const resolved = await loadResolved(options);
@@ -1,10 +1,10 @@
1
1
  import type { Ui } from "../ui.ts";
2
2
  import { type ConfigOptions } from "./build.ts";
3
- export interface CheckOptions extends ConfigOptions {
3
+ export type CheckOptions = ConfigOptions & {
4
4
  defaultVersion: string | undefined;
5
5
  list: boolean;
6
6
  fetch?: typeof fetch;
7
- }
7
+ };
8
8
  /** `hash file`, `hash *file`, BSD `SHA256 (file) = hash`, or a file holding one bare hash. */
9
9
  export declare function findChecksum(text: string, file: string): string | undefined;
10
10
  export declare function check(options: CheckOptions, ui: Ui): Promise<number>;
@@ -1,6 +1,6 @@
1
1
  import { InstallgenError } from "../errors.js";
2
2
  import { loadResolved, warnUnverified } from "./build.js";
3
- /* the same rules the scripts apply at install time */
3
+ // the same rules the scripts apply at install time
4
4
  const VERSION = /^[A-Za-z0-9._+-]+$/;
5
5
  const TIMEOUT_MS = 15_000;
6
6
  function expand(segments, version, tag) {
@@ -19,7 +19,7 @@ export function findChecksum(text, file) {
19
19
  const only = lines.length === 1 ? lines[0]?.trim().split(/\s+/) : undefined;
20
20
  return only?.length === 1 ? only[0] : undefined;
21
21
  }
22
- /* fetch rejects with a TypeError whose cause says why (ECONNREFUSED, a timeout) */
22
+ // fetch rejects with a TypeError whose cause says why (ECONNREFUSED, a timeout)
23
23
  function failure(error) {
24
24
  const e = error;
25
25
  return e.cause instanceof Error ? `${e.message}: ${e.cause.message}` : e.message;
@@ -36,12 +36,12 @@ function normalize(raw, tagPrefix, what) {
36
36
  function probesFor(get) {
37
37
  const sums = new Map();
38
38
  return {
39
- /* HEAD first; hosts that refuse it get a one-byte ranged GET */
39
+ // HEAD first; hosts that refuse it get a one-byte ranged GET
40
40
  async exists(url) {
41
41
  try {
42
42
  const head = await get(url, { method: "HEAD" });
43
43
  if (head.ok)
44
- return undefined;
44
+ return;
45
45
  const ranged = await get(url, { headers: { range: "bytes=0-0" } });
46
46
  await ranged.arrayBuffer();
47
47
  return ranged.ok ? undefined : `missing ${url} (${ranged.status})`;
@@ -53,7 +53,7 @@ function probesFor(get) {
53
53
  checksums(url) {
54
54
  let probe = sums.get(url);
55
55
  if (probe === undefined) {
56
- probe = get(url).then(async (res) => res.ok ? { ok: true, body: await res.text() } : { ok: false, reason: `missing ${url} (${res.status})` }, (error) => ({ ok: false, reason: `unreachable ${url}: ${failure(error)}` }));
56
+ probe = get(url).then(async (res) => res.ok ? { body: await res.text(), ok: true } : { ok: false, reason: `missing ${url} (${res.status})` }, (error) => ({ ok: false, reason: `unreachable ${url}: ${failure(error)}` }));
57
57
  sums.set(url, probe);
58
58
  }
59
59
  return probe;
@@ -82,8 +82,9 @@ async function checkPlatform(p, run) {
82
82
  const found = [];
83
83
  let problems = 0;
84
84
  const missing = await probes.exists(assetUrl);
85
- if (missing === undefined)
85
+ if (missing === undefined) {
86
86
  found.push(assetUrl);
87
+ }
87
88
  else {
88
89
  problems++;
89
90
  ui.bad(p.platform, missing);
@@ -97,8 +98,9 @@ async function checkPlatform(p, run) {
97
98
  }
98
99
  if (p.signature !== undefined) {
99
100
  const missingBundle = await probes.exists(`${resolved.baseUrl}/${expand(p.signature.bundle, version, tag)}`);
100
- if (missingBundle === undefined)
101
+ if (missingBundle === undefined) {
101
102
  found.push("signature bundle");
103
+ }
102
104
  else {
103
105
  problems++;
104
106
  ui.bad(p.platform, missingBundle);
@@ -119,7 +121,7 @@ export async function check(options, ui) {
119
121
  }
120
122
  warnUnverified(resolved, ui);
121
123
  const version = await resolveVersion(resolved, options.defaultVersion, get, ui);
122
- const run = { resolved, version, tag: resolved.tagPrefix + version, probes: probesFor(get), ui };
124
+ const run = { probes: probesFor(get), resolved, tag: resolved.tagPrefix + version, ui, version };
123
125
  let problems = 0;
124
126
  for (const p of resolved.platforms)
125
127
  problems += await checkPlatform(p, run);
@@ -154,8 +156,7 @@ function list(resolved, defaultVersion, ui) {
154
156
  ui.info(`${p.platform} ${resolved.baseUrl}/${expand(p.asset, version, tag)}`);
155
157
  if (p.checksums !== undefined)
156
158
  ui.info(`${p.platform} ${resolved.baseUrl}/${expand(p.checksums, version, tag)}`);
157
- if (p.signature !== undefined) {
159
+ if (p.signature !== undefined)
158
160
  ui.info(`${p.platform} ${resolved.baseUrl}/${expand(p.signature.bundle, version, tag)}`);
159
- }
160
161
  }
161
162
  }
@@ -1,9 +1,9 @@
1
1
  import type { Ui } from "../ui.ts";
2
2
  export declare const PRESETS: readonly ["raw", "goreleaser", "github"];
3
3
  export type Preset = (typeof PRESETS)[number];
4
- export interface InitOptions {
4
+ export type InitOptions = {
5
5
  cwd: string;
6
6
  preset: Preset;
7
7
  force: boolean;
8
- }
8
+ };
9
9
  export declare function init(options: InitOptions, ui: Ui): void;
@@ -21,9 +21,8 @@ function isModuleProject(cwd) {
21
21
  }
22
22
  export function init(options, ui) {
23
23
  const existing = CONFIG_FILES.find((name) => existsSync(join(options.cwd, name)));
24
- if (existing !== undefined && !options.force) {
24
+ if (existing !== undefined && !options.force)
25
25
  throw new InstallgenError(`${existing} already exists; pass --force to overwrite it`);
26
- }
27
26
  const file = isModuleProject(options.cwd) ? "installgen.config.ts" : "installgen.config.mts";
28
27
  const example = readFileSync(new URL(`../../../assets/installers/examples/${options.preset}.config.ts`, import.meta.url), "utf8");
29
28
  writeFileSync(join(options.cwd, file), example);
@@ -9,19 +9,19 @@ export declare const TAG_SENTINEL = "__InstallGen_Tag__";
9
9
  declare const versionBrand: unique symbol;
10
10
  declare const tagBrand: unique symbol;
11
11
  /** The release version without the tag prefix (`1.2.3`). Interpolate it; the script fills it in at install time. */
12
- export interface VersionToken {
12
+ export type VersionToken = {
13
13
  /** Yields a placeholder the build swaps for the script's version variable; a string method on it is refused. */
14
14
  readonly [Symbol.toPrimitive]: (hint: string) => string;
15
15
  readonly [versionBrand]: true;
16
- }
16
+ };
17
17
  /** The release tag, `tagPrefix` + version (`v1.2.3`). Interpolate it; the script fills it in at install time. */
18
- export interface TagToken {
18
+ export type TagToken = {
19
19
  /** Yields a placeholder the build swaps for the script's tag variable; a string method on it is refused. */
20
20
  readonly [Symbol.toPrimitive]: (hint: string) => string;
21
21
  readonly [tagBrand]: true;
22
- }
22
+ };
23
23
  /** What a path function gets: the tokens to interpolate, and the platform it is called for (once per platform). */
24
- export interface PathContext {
24
+ export type PathContext = {
25
25
  /** The version being installed, filled in at install time. */
26
26
  readonly version: VersionToken;
27
27
  /** The tag being installed, filled in at install time. */
@@ -30,19 +30,19 @@ export interface PathContext {
30
30
  readonly os: Os;
31
31
  /** The platform's architecture. */
32
32
  readonly arch: Arch;
33
- }
33
+ };
34
34
  /** What `checksumsPath` gets: the path context plus the asset it lists. */
35
- export interface ChecksumsContext extends PathContext {
35
+ export type ChecksumsContext = PathContext & {
36
36
  /** The asset path `assetPath` returned for this platform. */
37
37
  readonly asset: string;
38
- }
38
+ };
39
39
  /** What `signature.bundlePath` gets: the checksums context plus the checksums file it signs. */
40
- export interface BundleContext extends ChecksumsContext {
40
+ export type BundleContext = ChecksumsContext & {
41
41
  /** The checksums path `checksumsPath` returned for this platform. */
42
42
  readonly checksums: string;
43
- }
43
+ };
44
44
  /** A keyless sigstore signature on the checksums file, checked by `cosign verify-blob` when cosign is on PATH. */
45
- export interface SignatureConfig {
45
+ export type SignatureConfig = {
46
46
  /**
47
47
  * The certificate identity the bundle must carry, matched exactly: an https URL. Interpolate `tag` to bind it to the
48
48
  * release, e.g. `https://github.com/o/r/.github/workflows/release.yml@refs/tags/${tag}`.
@@ -52,16 +52,16 @@ export interface SignatureConfig {
52
52
  issuer?: string;
53
53
  /** The sigstore bundle of the checksums file, per platform. Default: the checksums path + `.sigstore.json`. */
54
54
  bundlePath?: (ctx: BundleContext) => string;
55
- }
55
+ };
56
56
  /** Where the two scripts are served: https, or http on loopback. The scripts print these in their hints. */
57
- export interface ScriptUrls {
57
+ export type ScriptUrls = {
58
58
  /** The URL users pipe to `sh`. */
59
59
  sh: string;
60
60
  /** The URL users pipe to `iex`. */
61
61
  ps1: string;
62
- }
62
+ };
63
63
  /** An `installgen.config.ts` default export: where a release's files live and how the scripts install them. */
64
- export interface InstallgenConfig {
64
+ export type InstallgenConfig = {
65
65
  /** The binary name, `^[A-Za-z0-9][A-Za-z0-9._-]*$`. */
66
66
  name: string;
67
67
  /** Where the files live. https only; loopback http is allowed for tests. */
@@ -92,7 +92,7 @@ export interface InstallgenConfig {
92
92
  scriptUrls?: ScriptUrls;
93
93
  /** Default `"installers"`. */
94
94
  outDir?: string;
95
- }
95
+ };
96
96
  /** Returns `config` unchanged; it is there so an untyped config file still gets the config's types. */
97
97
  export declare function defineConfig(config: InstallgenConfig): InstallgenConfig;
98
98
  export declare const versionToken: VersionToken;
@@ -1,4 +1,4 @@
1
- /* Mixed case, so toUpperCase and toLowerCase both change it and the build reports the call as mangled. */
1
+ // Mixed case, so toUpperCase and toLowerCase both change it and the build reports the call as mangled.
2
2
  export const VERSION_SENTINEL = "__InstallGen_Version__";
3
3
  export const TAG_SENTINEL = "__InstallGen_Tag__";
4
4
  /** Returns `config` unchanged; it is there so an untyped config file still gets the config's types. */
@@ -1,17 +1,17 @@
1
- export interface BunBuild {
1
+ export type BunBuild = {
2
2
  module(specifier: string, load: () => {
3
3
  exports: Record<string, unknown>;
4
4
  loader: "object";
5
5
  }): void;
6
- }
7
- export interface BunPlugin {
6
+ };
7
+ export type BunPlugin = {
8
8
  name: string;
9
9
  setup(build: BunBuild): void | Promise<void>;
10
- }
10
+ };
11
11
  /** The slice of the `Bun` global the loader uses. */
12
- export interface BunLike {
12
+ export type BunLike = {
13
13
  plugin(plugin: BunPlugin): void;
14
- }
14
+ };
15
15
  type Importer = (url: string) => Promise<Record<string, unknown>>;
16
16
  /**
17
17
  * Bun's `onResolve` never sees the imports a runtime-loaded config makes; `build.module` does. The config's import of
@@ -9,7 +9,7 @@ export function registerNodeHook(specifier, selfUrl, register = module.registerH
9
9
  return register({
10
10
  resolve(imported, context, nextResolve) {
11
11
  if (imported === specifier)
12
- return { url: selfUrl, shortCircuit: true };
12
+ return { shortCircuit: true, url: selfUrl };
13
13
  return nextResolve(imported, context);
14
14
  },
15
15
  });
@@ -1,20 +1,18 @@
1
1
  import type { InstallgenConfig } from "./define-config.ts";
2
2
  import { type BunLike } from "./hooks/bun.ts";
3
3
  import { type RegisterHooks } from "./hooks/node.ts";
4
- /** The specifier an installgen config imports `defineConfig` from, resolved to the running package. */
5
- export declare const INSTALLERS_SPECIFIER = "@workerstack/clients/installers";
6
4
  export declare const CONFIG_FILES: readonly ["installgen.config.ts", "installgen.config.mts", "installgen.config.js", "installgen.config.mjs"];
7
- export interface RuntimeInfo {
5
+ export type RuntimeInfo = {
8
6
  runtime: "node" | "bun";
9
7
  /** `process.versions.node`; Bun reports the Node version it implements. */
10
8
  nodeVersion: string;
11
9
  bun?: BunLike;
12
- }
10
+ };
13
11
  export declare function detectRuntime(scope?: {
14
12
  Bun?: BunLike;
15
13
  }, nodeVersion?: string): RuntimeInfo;
16
14
  type Importer = (url: string) => Promise<Record<string, unknown>>;
17
- export interface LoadOptions {
15
+ export type LoadOptions = {
18
16
  cwd: string;
19
17
  /** `-c`: relative to `cwd`. */
20
18
  configPath?: string | undefined;
@@ -24,11 +22,11 @@ export interface LoadOptions {
24
22
  importModule?: Importer;
25
23
  /** Node's `module.registerHooks`. */
26
24
  registerHooks?: RegisterHooks;
27
- }
28
- export interface LoadedConfig {
25
+ };
26
+ export type LoadedConfig = {
29
27
  path: string;
30
28
  config: InstallgenConfig;
31
- }
29
+ };
32
30
  /** Whether Node `version` imports a `.ts` module natively: from 22.18, and on 23 from 23.6. */
33
31
  export declare function stripsTypes(version: string): boolean;
34
32
  export declare function loadConfig(options: LoadOptions): Promise<LoadedConfig>;
@@ -13,7 +13,7 @@ import { InstallgenError } from "../errors.js";
13
13
  import { registerBunHook } from "./hooks/bun.js";
14
14
  import { registerNodeHook } from "./hooks/node.js";
15
15
  /** The specifier an installgen config imports `defineConfig` from, resolved to the running package. */
16
- export const INSTALLERS_SPECIFIER = "@workerstack/clients/installers";
16
+ const INSTALLERS_SPECIFIER = "@workerstack/clients/installers";
17
17
  export const CONFIG_FILES = [
18
18
  "installgen.config.ts",
19
19
  "installgen.config.mts",
@@ -21,9 +21,9 @@ export const CONFIG_FILES = [
21
21
  "installgen.config.mjs",
22
22
  ];
23
23
  export function detectRuntime(scope = globalThis, nodeVersion = process.versions.node) {
24
- return scope.Bun ? { runtime: "bun", nodeVersion, bun: scope.Bun } : { runtime: "node", nodeVersion };
24
+ return scope.Bun ? { bun: scope.Bun, nodeVersion, runtime: "bun" } : { nodeVersion, runtime: "node" };
25
25
  }
26
- /* Node strips types from .ts without a flag from 22.18, and on 23 from 23.6 */
26
+ // Node strips types from .ts without a flag from 22.18, and on 23 from 23.6
27
27
  const CJS_SYNTAX = /Unexpected token 'export'|Cannot use import statement outside a module/;
28
28
  function find(cwd, configPath) {
29
29
  if (configPath !== undefined) {
@@ -70,10 +70,10 @@ export async function loadConfig(options) {
70
70
  const ext = extname(path);
71
71
  const { runtime } = options;
72
72
  const importModule = options.importModule ?? ((url) => import(__rewriteRelativeImportExtension(url)));
73
- /* the sibling entry in this module's own form: index.ts from a checkout's source, index.js from an install */
73
+ // the sibling entry in this module's own form: index.ts from a checkout's source, index.js from an install
74
74
  const selfUrl = options.selfUrl ?? new URL(`../index${extname(new URL(import.meta.url).pathname)}`, import.meta.url).href;
75
75
  assertStripsTypes(runtime, ext);
76
- /* Bun's plugin stays for the process; Node's hook goes once the config is imported */
76
+ // Bun's plugin stays for the process; Node's hook goes once the config is imported
77
77
  let hook;
78
78
  if (runtime.bun)
79
79
  await registerBunHook(runtime.bun, INSTALLERS_SPECIFIER, selfUrl, importModule);
@@ -90,8 +90,7 @@ export async function loadConfig(options) {
90
90
  hook?.deregister();
91
91
  }
92
92
  const config = mod.default;
93
- if (typeof config !== "object" || config === null) {
93
+ if (typeof config !== "object" || config === null)
94
94
  throw new InstallgenError(`${path} has no default export; write \`export default defineConfig({ ... })\``);
95
- }
96
- return { path, config: config };
95
+ return { config: config, path };
97
96
  }
@@ -1,4 +1,3 @@
1
- import { type InstallgenConfig, type Platform } from "./define-config.ts";
1
+ import { type InstallgenConfig } from "./define-config.ts";
2
2
  import type { ResolvedConfig } from "./types.ts";
3
- export declare const ALL_PLATFORMS: readonly Platform[];
4
3
  export declare function resolveConfig(input: InstallgenConfig): ResolvedConfig;