@deltabox/toolchain 0.0.0-stage → 1.0.7

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 (235) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/LICENSE +373 -0
  3. package/README.md +235 -2
  4. package/dist/_virtual/_rolldown/runtime.js +1 -0
  5. package/dist/biome.d.ts +4 -0
  6. package/dist/biome.js +1 -0
  7. package/dist/changelog.d.ts +17 -0
  8. package/dist/changelog.js +1 -0
  9. package/dist/cli/commands/index.js +1 -0
  10. package/dist/cli/commands/projects.js +1 -0
  11. package/dist/cli/commands/providers.js +1 -0
  12. package/dist/cli/commands/reset.js +1 -0
  13. package/dist/cli/commands/shared.js +1 -0
  14. package/dist/cli/commands/sync.js +1 -0
  15. package/dist/cli/commands/watch.js +1 -0
  16. package/dist/cli/context.js +1 -0
  17. package/dist/cli/index.d.ts +15 -0
  18. package/dist/cli/index.js +2 -0
  19. package/dist/cli/options.js +1 -0
  20. package/dist/cli/register.d.ts +14 -0
  21. package/dist/cli/register.js +1 -0
  22. package/dist/config.d.ts +18 -0
  23. package/dist/config.js +1 -0
  24. package/dist/core.d.ts +13 -0
  25. package/dist/core.js +1 -0
  26. package/dist/index.d.ts +31 -0
  27. package/dist/index.js +1 -0
  28. package/dist/migrate.d.ts +15 -0
  29. package/dist/migrate.js +1 -0
  30. package/dist/package.js +1 -0
  31. package/dist/packages/biome/src/config.js +1 -0
  32. package/dist/packages/biome/src/index.d.ts +34 -0
  33. package/dist/packages/biome/src/index.js +1 -0
  34. package/dist/packages/biome/src/vscode-settings.js +1 -0
  35. package/dist/packages/changelog/src/cli/index.d.ts +8 -0
  36. package/dist/packages/changelog/src/cli/index.js +1 -0
  37. package/dist/packages/changelog/src/index.d.ts +19 -0
  38. package/dist/packages/changelog/src/index.js +1 -0
  39. package/dist/packages/changelog/src/run-workflows.d.ts +35 -0
  40. package/dist/packages/changelog/src/run-workflows.js +1 -0
  41. package/dist/packages/changelog/src/run.d.ts +14 -0
  42. package/dist/packages/changelog/src/run.js +1 -0
  43. package/dist/packages/changelog/src/sync.d.ts +18 -0
  44. package/dist/packages/changelog/src/sync.js +1 -0
  45. package/dist/packages/changelog/src/templates.d.ts +27 -0
  46. package/dist/packages/changelog/src/templates.js +27 -0
  47. package/dist/packages/changelog/src/utils/args.d.ts +7 -0
  48. package/dist/packages/changelog/src/utils/args.js +1 -0
  49. package/dist/packages/changelog/src/utils/format.d.ts +27 -0
  50. package/dist/packages/changelog/src/utils/format.js +5 -0
  51. package/dist/packages/changelog/src/utils/git.d.ts +9 -0
  52. package/dist/packages/changelog/src/utils/git.js +1 -0
  53. package/dist/packages/changelog/src/utils/packages.js +4 -0
  54. package/dist/packages/changelog/src/utils/reformat.d.ts +9 -0
  55. package/dist/packages/changelog/src/utils/reformat.js +6 -0
  56. package/dist/packages/changelog/src/utils/repo.js +1 -0
  57. package/dist/packages/changelog/src/utils/summary.d.ts +7 -0
  58. package/dist/packages/changelog/src/utils/summary.js +1 -0
  59. package/dist/packages/changelog/src/utils/types.d.ts +58 -0
  60. package/dist/packages/changelog/src/utils/version.d.ts +6 -0
  61. package/dist/packages/changelog/src/utils/version.js +14 -0
  62. package/dist/packages/changelog/src/utils/write.js +1 -0
  63. package/dist/packages/changelog/src/workflows.d.ts +51 -0
  64. package/dist/packages/changelog/src/workflows.js +5 -0
  65. package/dist/packages/config/src/cli/index.d.ts +28 -0
  66. package/dist/packages/config/src/cli/index.js +1 -0
  67. package/dist/packages/config/src/collect.d.ts +19 -0
  68. package/dist/packages/config/src/collect.js +1 -0
  69. package/dist/packages/config/src/config-json.d.ts +33 -0
  70. package/dist/packages/config/src/config-json.js +1 -0
  71. package/dist/packages/config/src/engine.d.ts +56 -0
  72. package/dist/packages/config/src/engine.js +1 -0
  73. package/dist/packages/config/src/env-file.d.ts +33 -0
  74. package/dist/packages/config/src/env-file.js +3 -0
  75. package/dist/packages/config/src/env.d.ts +31 -0
  76. package/dist/packages/config/src/env.js +1 -0
  77. package/dist/packages/config/src/generators/cli.d.ts +78 -0
  78. package/dist/packages/config/src/generators/cli.js +1 -0
  79. package/dist/packages/config/src/generators/env.d.ts +42 -0
  80. package/dist/packages/config/src/generators/env.js +23 -0
  81. package/dist/packages/config/src/generators/index.d.ts +8 -0
  82. package/dist/packages/config/src/generators/index.js +1 -0
  83. package/dist/packages/config/src/generators/json.d.ts +24 -0
  84. package/dist/packages/config/src/generators/json.js +1 -0
  85. package/dist/packages/config/src/generators/markdown.d.ts +77 -0
  86. package/dist/packages/config/src/generators/markdown.js +27 -0
  87. package/dist/packages/config/src/generators/types.d.ts +32 -0
  88. package/dist/packages/config/src/generators/types.js +1 -0
  89. package/dist/packages/config/src/index.d.ts +21 -0
  90. package/dist/packages/config/src/index.js +1 -0
  91. package/dist/packages/config/src/root.d.ts +11 -0
  92. package/dist/packages/config/src/root.js +1 -0
  93. package/dist/packages/config/src/schema.d.ts +34 -0
  94. package/dist/packages/config/src/schema.js +1 -0
  95. package/dist/packages/config/src/types.d.ts +75 -0
  96. package/dist/packages/config/src/types.js +1 -0
  97. package/dist/packages/core/src/graph.d.ts +55 -0
  98. package/dist/packages/core/src/graph.js +1 -0
  99. package/dist/packages/core/src/index.d.ts +16 -0
  100. package/dist/packages/core/src/index.js +1 -0
  101. package/dist/packages/core/src/loader.d.ts +27 -0
  102. package/dist/packages/core/src/loader.js +1 -0
  103. package/dist/packages/core/src/manifest.d.ts +17 -0
  104. package/dist/packages/core/src/manifest.js +1 -0
  105. package/dist/packages/core/src/project-type.d.ts +14 -0
  106. package/dist/packages/core/src/project-type.js +1 -0
  107. package/dist/packages/core/src/reset.d.ts +51 -0
  108. package/dist/packages/core/src/reset.js +1 -0
  109. package/dist/packages/core/src/select.d.ts +32 -0
  110. package/dist/packages/core/src/select.js +1 -0
  111. package/dist/packages/core/src/sync.d.ts +42 -0
  112. package/dist/packages/core/src/sync.js +1 -0
  113. package/dist/packages/core/src/vscode.d.ts +27 -0
  114. package/dist/packages/core/src/vscode.js +1 -0
  115. package/dist/packages/core/src/watch.d.ts +17 -0
  116. package/dist/packages/core/src/watch.js +1 -0
  117. package/dist/packages/migrate/src/biome.d.ts +18 -0
  118. package/dist/packages/migrate/src/biome.js +2 -0
  119. package/dist/packages/migrate/src/check.d.ts +14 -0
  120. package/dist/packages/migrate/src/check.js +1 -0
  121. package/dist/packages/migrate/src/cli/index.d.ts +12 -0
  122. package/dist/packages/migrate/src/cli/index.js +1 -0
  123. package/dist/packages/migrate/src/dprint.d.ts +18 -0
  124. package/dist/packages/migrate/src/dprint.js +1 -0
  125. package/dist/packages/migrate/src/eslint.d.ts +24 -0
  126. package/dist/packages/migrate/src/eslint.js +1 -0
  127. package/dist/packages/migrate/src/index.d.ts +14 -0
  128. package/dist/packages/migrate/src/index.js +1 -0
  129. package/dist/packages/migrate/src/oxfmt-map.d.ts +28 -0
  130. package/dist/packages/migrate/src/oxfmt-map.js +1 -0
  131. package/dist/packages/migrate/src/oxlint-map.d.ts +22 -0
  132. package/dist/packages/migrate/src/oxlint-map.js +1 -0
  133. package/dist/packages/migrate/src/prettier.d.ts +20 -0
  134. package/dist/packages/migrate/src/prettier.js +2 -0
  135. package/dist/packages/migrate/src/registry.d.ts +26 -0
  136. package/dist/packages/migrate/src/registry.js +1 -0
  137. package/dist/packages/migrate/src/types.d.ts +75 -0
  138. package/dist/packages/migrate/src/vite-target.d.ts +31 -0
  139. package/dist/packages/migrate/src/vite-target.js +5 -0
  140. package/dist/packages/project/src/cli/index.d.ts +8 -0
  141. package/dist/packages/project/src/cli/index.js +1 -0
  142. package/dist/packages/project/src/config.d.ts +55 -0
  143. package/dist/packages/project/src/config.js +1 -0
  144. package/dist/packages/project/src/index.d.ts +10 -0
  145. package/dist/packages/project/src/index.js +1 -0
  146. package/dist/packages/project/src/typescript.d.ts +66 -0
  147. package/dist/packages/project/src/typescript.js +22 -0
  148. package/dist/packages/shared/src/config-schema.d.ts +2039 -0
  149. package/dist/packages/shared/src/config-schema.js +1 -0
  150. package/dist/packages/shared/src/fs-utils.d.ts +18 -0
  151. package/dist/packages/shared/src/fs-utils.js +1 -0
  152. package/dist/packages/shared/src/index.d.ts +17 -0
  153. package/dist/packages/shared/src/index.js +1 -0
  154. package/dist/packages/shared/src/object-utils.d.ts +15 -0
  155. package/dist/packages/shared/src/object-utils.js +1 -0
  156. package/dist/packages/shared/src/provider.d.ts +66 -0
  157. package/dist/packages/shared/src/provider.js +1 -0
  158. package/dist/packages/shared/src/run.d.ts +26 -0
  159. package/dist/packages/shared/src/run.js +1 -0
  160. package/dist/packages/shared/src/string-utils.d.ts +52 -0
  161. package/dist/packages/shared/src/string-utils.js +3 -0
  162. package/dist/packages/shared/src/template.d.ts +53 -0
  163. package/dist/packages/shared/src/template.js +1 -0
  164. package/dist/packages/shared/src/toolchain.d.ts +159 -0
  165. package/dist/packages/shared/src/toolchain.js +1 -0
  166. package/dist/packages/shared/src/types.d.ts +100 -0
  167. package/dist/packages/shared/src/yaml.d.ts +17 -0
  168. package/dist/packages/shared/src/yaml.js +5 -0
  169. package/dist/packages/template/src/builtin.d.ts +10 -0
  170. package/dist/packages/template/src/builtin.js +1 -0
  171. package/dist/packages/template/src/cli/index.d.ts +8 -0
  172. package/dist/packages/template/src/cli/index.js +1 -0
  173. package/dist/packages/template/src/index.d.ts +10 -0
  174. package/dist/packages/template/src/index.js +1 -0
  175. package/dist/packages/template/src/local.d.ts +20 -0
  176. package/dist/packages/template/src/local.js +1 -0
  177. package/dist/packages/template/src/online.d.ts +17 -0
  178. package/dist/packages/template/src/online.js +1 -0
  179. package/dist/packages/template/src/registry.d.ts +48 -0
  180. package/dist/packages/template/src/registry.js +1 -0
  181. package/dist/packages/template/src/scaffold.d.ts +25 -0
  182. package/dist/packages/template/src/scaffold.js +1 -0
  183. package/dist/packages/template/src/types.d.ts +59 -0
  184. package/dist/packages/tsconfig/src/cli/generate/index.d.ts +35 -0
  185. package/dist/packages/tsconfig/src/cli/generate/index.js +1 -0
  186. package/dist/packages/tsconfig/src/cli/generate/utils.d.ts +43 -0
  187. package/dist/packages/tsconfig/src/cli/generate/utils.js +1 -0
  188. package/dist/packages/tsconfig/src/cli/index.d.ts +11 -0
  189. package/dist/packages/tsconfig/src/cli/index.js +1 -0
  190. package/dist/packages/tsconfig/src/index.d.ts +10 -0
  191. package/dist/packages/tsconfig/src/index.js +1 -0
  192. package/dist/packages/tsconfig/src/sync.d.ts +15 -0
  193. package/dist/packages/tsconfig/src/sync.js +1 -0
  194. package/dist/packages/tsconfig/src/templates/tsconfig.base.js +1 -0
  195. package/dist/packages/tsconfig/src/templates/tsconfig.build.js +1 -0
  196. package/dist/packages/tsconfig/src/templates/tsconfig.default.js +1 -0
  197. package/dist/packages/tsconfig/src/templates.d.ts +38 -0
  198. package/dist/packages/tsconfig/src/templates.js +1 -0
  199. package/dist/packages/tsdown/src/cleanup.d.ts +17 -0
  200. package/dist/packages/tsdown/src/cleanup.js +1 -0
  201. package/dist/packages/tsdown/src/cli/index.d.ts +11 -0
  202. package/dist/packages/tsdown/src/cli/index.js +1 -0
  203. package/dist/packages/tsdown/src/config/node.d.ts +37 -0
  204. package/dist/packages/tsdown/src/config/node.js +3 -0
  205. package/dist/packages/tsdown/src/index.d.ts +9 -0
  206. package/dist/packages/tsdown/src/index.js +1 -0
  207. package/dist/packages/vite/src/cli/index.d.ts +8 -0
  208. package/dist/packages/vite/src/cli/index.js +1 -0
  209. package/dist/packages/vite/src/commands.d.ts +29 -0
  210. package/dist/packages/vite/src/commands.js +1 -0
  211. package/dist/packages/vite/src/index.d.ts +8 -0
  212. package/dist/packages/vite/src/index.js +1 -0
  213. package/dist/packages/vite/src/provider.d.ts +11 -0
  214. package/dist/packages/vite/src/provider.js +1 -0
  215. package/dist/packages/vite/src/sync.d.ts +25 -0
  216. package/dist/packages/vite/src/sync.js +2 -0
  217. package/dist/packages/vite/src/vp.d.ts +59 -0
  218. package/dist/packages/vite/src/vp.js +1 -0
  219. package/dist/project.d.ts +7 -0
  220. package/dist/project.js +1 -0
  221. package/dist/providers.d.ts +11 -0
  222. package/dist/providers.js +1 -0
  223. package/dist/shared.d.ts +14 -0
  224. package/dist/shared.js +1 -0
  225. package/dist/sync.d.ts +12 -0
  226. package/dist/sync.js +1 -0
  227. package/dist/template.d.ts +11 -0
  228. package/dist/template.js +1 -0
  229. package/dist/tsconfig.d.ts +8 -0
  230. package/dist/tsconfig.js +1 -0
  231. package/dist/tsdown.d.ts +7 -0
  232. package/dist/tsdown.js +1 -0
  233. package/dist/vite.d.ts +9 -0
  234. package/dist/vite.js +1 -0
  235. package/package.json +114 -3
@@ -0,0 +1 @@
1
+ import"node:path";import"node:url";import.meta.url;import{z as e}from"zod";const t=e.enum([`monorepo-root`,`monorepo-workspace`,`project`]).describe(`The project kind (detected when omitted).`),n=e.object({type:t.optional(),name:e.string().describe(`The unscoped project name.`).optional(),scope:e.string().describe("The npm scope, eg. `@acme`.").optional(),author:e.string().describe(`Package author.`).optional(),license:e.string().describe(`SPDX license id.`).optional(),homepage:e.string().describe(`Project homepage.`).optional(),repo:e.string().describe("Repository URL, eg. `https://github.com/acme/app`.").optional(),nodeVersion:e.string().describe("Node engine range, eg. `>=22`.").optional(),packageManager:e.string().describe("Package manager name (default `yarn`).").optional(),packageManagerVersion:e.string().describe("Package manager version, eg. `4.17.1`.").optional(),description:e.string().describe(`One-line description.`).optional()}),r=e.object({name:e.string().optional(),id:e.string().optional(),if:e.string().optional(),uses:e.string().optional(),run:e.string().optional(),shell:e.string().optional(),"working-directory":e.string().optional(),with:e.record(e.string(),e.union([e.string(),e.number(),e.boolean()])).optional(),env:e.record(e.string(),e.string()).optional()}),i=e.object({job:e.string().describe(`Target job id (defaults to the primary/first job).`).optional(),before:e.array(r).describe(`Steps inserted at the start.`).optional(),after:e.array(r).describe(`Steps appended at the end.`).optional()}),a=e.object({enabled:e.boolean().describe(`Enable/disable this workflow (default true).`).optional(),pushBranches:e.array(e.string()).describe("Replace `on.push.branches`.").optional(),pullRequestBranches:e.array(e.string()).describe("Replace `on.pull_request.branches`.").optional(),triggers:e.record(e.string(),e.unknown()).describe("Extra `on.*` triggers.").optional(),extra:e.record(e.string(),e.unknown()).describe("Extra top-level keys (`permissions`, `concurrency`, `env`, ...).").optional(),steps:e.union([i,e.array(i)]).describe(`Extra steps for a job (one group, or per-job groups).`).optional(),jobs:e.record(e.string(),e.unknown()).describe(`Extra complete jobs merged in.`).optional(),tokens:e.record(e.string(),e.union([e.string(),e.number(),e.boolean()])).describe("Per-workflow token overrides (`nodeVersion`, `packageManager`, ...).").optional()}),o=e.union([e.boolean(),a]),s=e.object({ci:o.optional(),changelog:o.optional(),release:o.optional(),issues:o.optional(),sync:o.optional()}),c=e.object({enabled:e.boolean().describe(`Master switch (enabled when the section is defined).`).optional(),workflows:s.describe("Which workflows to write into `.github/workflows`.").optional(),branches:e.object({main:e.string().optional(),dev:e.string().optional()}).describe(`Branch names the workflows target.`).optional(),types:e.array(e.string()).describe(`Allowed commit types (commitlint).`).optional(),scopes:e.array(e.string()).describe(`Allowed commit scopes (commitlint).`).optional(),vscode:e.boolean().describe(`Write the Conventional-Commits VS Code settings.`).optional()}),l=e.object({enabled:e.boolean().describe(`Master switch (enabled when the section is defined).`).optional(),vscode:e.boolean().describe(`Write the Biome VS Code settings (default true).`).optional(),overrides:e.record(e.string(),e.unknown()).describe("Deep-merged over the generated `biome.json` (arrays union).").optional()}),u=e.object({enabled:e.boolean().describe(`Master switch (enabled when the section is defined).`).optional(),glob:e.string().describe("Glob for workspace `tsconfig.default.json` files.").optional(),appGlob:e.string().describe(`Glob for "override" (app) workspaces.`).optional(),refs:e.boolean().describe(`Wire project references (default false).`).optional(),composite:e.boolean().describe("Emit `composite: true` (default false).").optional(),aliases:e.boolean().describe(`Inject path aliases (default true).`).optional(),indent:e.number().describe(`JSON indentation (default 4).`).optional(),rootFile:e.string().describe("The monorepo tsconfig file name (default `tsconfig.monorepo.json`).").optional()}),d=e.object({enabled:e.boolean().describe(`Watch by default (enabled when the section is defined).`).optional(),debounce:e.number().describe(`Debounce window in ms (default 150).`).optional()}),f=e.enum([`builtin`,`local`,`npm`,`git`,`vite-plus`]).describe(`How to load the source.`),p=e.enum([`project`,`workspace`,`application`,`folder`,`tooling`,`pipeline`]).describe(`What the template produces.`),m=e.object({type:f,locate:e.string().describe(`A builtin id, local dir, npm scope, git URL or Vite+ id.`),id:e.string().describe(`Stable id (defaults to the basename/scope).`).optional(),name:e.string().describe(`Display name override.`).optional(),description:e.string().describe(`Description override.`).optional(),kind:p.optional(),ref:e.string().describe(`Git branch/tag/commit.`).optional(),subdir:e.string().describe(`Subdirectory within the source that holds the template.`).optional(),tags:e.array(e.string()).describe(`Free-form tags.`).optional(),online:e.boolean().describe(`Whether the source needs network access.`).optional()}),h=e.object({enabled:e.boolean().describe(`Master switch (enabled when the section is defined).`).optional(),sources:e.array(m).describe(`Extra sources on top of the builtin + registry sources.`).optional()}),g=e.object({enabled:e.boolean().describe(`Master switch (enabled when the section is defined).`).optional(),config:e.boolean().describe("Write the managed `vite.config.ts` (default true when the section is set).").optional(),defaultTemplate:e.string().describe("`create.defaultTemplate`, eg. `@acme` for `@acme/create`.").optional(),testInclude:e.array(e.string()).describe(`Extra Vitest include globs (default: tests under src + tests).`).optional(),lintIgnore:e.array(e.string()).describe(`Glob patterns Oxlint should ignore.`).optional(),overrides:e.record(e.string(),e.unknown()).describe("Deep-merged over the generated `vite.config.ts` object.").optional()});function _(t){return e.union([e.boolean(),t])}const v=e.object({project:n.optional(),changelog:_(c).optional(),biome:_(l).optional(),tsconfig:_(u).optional(),templates:_(h).optional(),vite:_(g).optional(),watch:_(d).optional()}),y=e.object({toolchain:v.optional()}),b={project:n,changelog:c,biome:l,tsconfig:u,templates:h,vite:g,watch:d},x={project:`Project metadata used as replacement tokens across every template.`,changelog:`Conventional-Commits CI, commitlint and the changelog pipeline.`,biome:"Biome config generation (for consumers that still want a `biome.json`).",tsconfig:`Workspace tsconfig generation (path aliases + project references).`,templates:`Template sources / scaffolding.`,vite:"Vite+ configuration (manages `vite.config.ts` + the `vite:*` commands).",watch:"Watch behaviour for `dbx watch`."};export{x as CONFIG_SECTION_DESCRIPTIONS,b as CONFIG_SECTION_SCHEMAS,l as biomeConfigSchema,c as changelogConfigSchema,s as changelogWorkflowsConfigSchema,y as dbxConfigSchema,n as projectConfigSchema,t as projectTypeSchema,p as templateKindSchema,m as templateSourceSchema,f as templateSourceTypeSchema,h as templatesConfigSchema,v as toolingConfigSchema,u as tsconfigConfigSchema,g as viteConfigSchema,d as watchConfigSchema,a as workflowConfigSchema,o as workflowSettingSchema,r as workflowStepSchema,i as workflowStepsConfigSchema};
@@ -0,0 +1,18 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ //#region packages/shared/src/fs-utils.d.ts
4
+ /** Read + parse a JSON file, returning `undefined` when it is missing/invalid. */
5
+ export declare function readJsonFile<T = Record<string, unknown>>(file: string): T | undefined;
6
+ /** Read + parse a JSON file relative to `cwd`. */
7
+ export declare function readJsonAt<T = Record<string, unknown>>(cwd: string, relative: string): T | undefined;
8
+ /** Serialize a value to JSON text (trailing newline included). */
9
+ export declare function toJson(value: unknown, indent?: number): string;
10
+ /** Write JSON text to a file, creating parent directories. */
11
+ export declare function writeJsonFile(file: string, value: unknown, indent?: number): void;
12
+ /**
13
+ * Merge a patch over the existing JSON at `cwd/relative` (deep merge for
14
+ * objects; `recommendations`/`extensions` arrays are unioned) and return the
15
+ * serialized result. Used by the VS Code sync task so consumer settings survive.
16
+ */
17
+ export declare function mergeJsonAt(cwd: string, relative: string, patch: Record<string, unknown>, indent?: number): string;
18
+ //#endregion
@@ -0,0 +1 @@
1
+ import{default as e}from"node:path";import"node:url";import.meta.url;import{deepMerge as t,isPlainObject as n}from"./object-utils.js";import r from"node:fs";function i(e){try{return JSON.parse(r.readFileSync(e,`utf-8`))}catch{return}}function a(t,n){return i(e.resolve(t,n))}function o(e,t=4){return`${JSON.stringify(e,null,t)}\n`}function s(t,n,i=4){r.mkdirSync(e.dirname(t),{recursive:!0}),r.writeFileSync(t,o(n,i),`utf-8`)}function c(e,t,n,r=4){return o(l(a(e,t)??{},n),r)}function l(e,r){let i=t(e,r);for(let t of Object.keys(r)){let a=e[t],o=r[t];Array.isArray(a)&&Array.isArray(o)?i[t]=[.../* @__PURE__ */ new Set([...a,...o])]:n(a)&&n(o)&&(i[t]=l(a,o))}return i}export{c as mergeJsonAt,a as readJsonAt,i as readJsonFile,o as toJson,s as writeJsonFile};
@@ -0,0 +1,17 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { mergeJsonAt, readJsonAt, readJsonFile, toJson, writeJsonFile } from "./fs-utils.js";
4
+ import { Sortable, deepMerge, isPlainObject, mapValues, resolveSort, sort } from "./object-utils.js";
5
+ import { ToolingProvider, ToolingProviderAction, ToolingProviderCommand, providerActions } from "./provider.js";
6
+ import { RunOptions, run, spawnCross } from "./run.js";
7
+ import { asString, camelCase, camelCaseId, capitalize, constantCase, ensureLeadingSlash, ensureSlashes, ensureTrailingSlash, formatCliFlag, hasText, indent, isLocalhost, kebabCase, pascalCase, removeDoubleSlashes, removeLeadingSlash, removeTrailingSlash, sanitizeSlashes, snakeCase, str, titleCase } from "./string-utils.js";
8
+ import { ReplacementOptions, ReplacementValue, Replacements, Replacer, applyReplacements, applyReplacementsDeep, createReplacer, defineReplacements, extractTokens, hasUnresolvedTokens, tokenPattern } from "./template.js";
9
+ import { CONFIG_SECTION_DESCRIPTIONS, CONFIG_SECTION_SCHEMAS, ChangelogWorkflowsConfig, DbxConfigSections, ProjectType, ToolingBiomeConfig, ToolingChangelogConfig, ToolingConfigSections, ToolingProjectConfig, ToolingTemplateKind, ToolingTemplateSource, ToolingTemplateSourceType, ToolingTemplatesConfig, ToolingTsconfigConfig, ToolingViteConfig, ToolingWatchConfig, WorkflowConfig, WorkflowSetting, WorkflowStep, WorkflowStepsConfig, biomeConfigSchema, changelogConfigSchema, changelogWorkflowsConfigSchema, dbxConfigSchema, projectConfigSchema, projectTypeSchema, templateKindSchema, templateSourceSchema, templateSourceTypeSchema, templatesConfigSchema, toolingConfigSchema, tsconfigConfigSchema, viteConfigSchema, watchConfigSchema, workflowConfigSchema, workflowSettingSchema, workflowStepSchema, workflowStepsConfigSchema } from "./config-schema.js";
10
+ import { Awaitable, GeneratedFile, JsonValue, PackageJson, ToolingArgument, ToolingCommand, ToolingCommandContext, ToolingOption } from "./types.js";
11
+ import { CONFIG_FILE_NAMES, DbxConfig, ManagedFile, SyncContext, SyncSummary, SyncTask, ToolingConfig, ToolingHooks, ToolingSection, defineConfig, repoSlugFromUrl, resolveTokens, sectionConfig, sectionEnabled } from "./toolchain.js";
12
+ import { YamlValue, toYaml } from "./yaml.js";
13
+ declare namespace index_d_exports {
14
+ export { Awaitable, CONFIG_FILE_NAMES, CONFIG_SECTION_DESCRIPTIONS, CONFIG_SECTION_SCHEMAS, ChangelogWorkflowsConfig, DbxConfig, DbxConfigSections, GeneratedFile, JsonValue, ManagedFile, PackageJson, ProjectType, ReplacementOptions, ReplacementValue, Replacements, Replacer, RunOptions, Sortable, SyncContext, SyncSummary, SyncTask, ToolingArgument, ToolingBiomeConfig, ToolingChangelogConfig, ToolingCommand, ToolingCommandContext, ToolingConfig, ToolingConfigSections, ToolingHooks, ToolingOption, ToolingProjectConfig, ToolingProvider, ToolingProviderAction, ToolingProviderCommand, ToolingSection, ToolingTemplateKind, ToolingTemplateSource, ToolingTemplateSourceType, ToolingTemplatesConfig, ToolingTsconfigConfig, ToolingViteConfig, ToolingWatchConfig, WorkflowConfig, WorkflowSetting, WorkflowStep, WorkflowStepsConfig, YamlValue, applyReplacements, applyReplacementsDeep, asString, biomeConfigSchema, camelCase, camelCaseId, capitalize, changelogConfigSchema, changelogWorkflowsConfigSchema, constantCase, createReplacer, dbxConfigSchema, deepMerge, defineConfig, defineReplacements, ensureLeadingSlash, ensureSlashes, ensureTrailingSlash, extractTokens, formatCliFlag, hasText, hasUnresolvedTokens, indent, isLocalhost, isPlainObject, kebabCase, mapValues, mergeJsonAt, pascalCase, projectConfigSchema, projectTypeSchema, providerActions, readJsonAt, readJsonFile, removeDoubleSlashes, removeLeadingSlash, removeTrailingSlash, repoSlugFromUrl, resolveSort, resolveTokens, run, sanitizeSlashes, sectionConfig, sectionEnabled, snakeCase, sort, spawnCross, str, templateKindSchema, templateSourceSchema, templateSourceTypeSchema, templatesConfigSchema, titleCase, toJson, toYaml, tokenPattern, toolingConfigSchema, tsconfigConfigSchema, viteConfigSchema, watchConfigSchema, workflowConfigSchema, workflowSettingSchema, workflowStepSchema, workflowStepsConfigSchema, writeJsonFile };
15
+ }
16
+ //#endregion
17
+ export { Awaitable, CONFIG_FILE_NAMES, CONFIG_SECTION_DESCRIPTIONS, CONFIG_SECTION_SCHEMAS, ChangelogWorkflowsConfig, DbxConfig, DbxConfigSections, GeneratedFile, JsonValue, ManagedFile, PackageJson, ProjectType, ReplacementOptions, ReplacementValue, Replacements, Replacer, RunOptions, Sortable, SyncContext, SyncSummary, SyncTask, ToolingArgument, ToolingBiomeConfig, ToolingChangelogConfig, ToolingCommand, ToolingCommandContext, ToolingConfig, ToolingConfigSections, ToolingHooks, ToolingOption, ToolingProjectConfig, ToolingProvider, ToolingProviderAction, ToolingProviderCommand, ToolingSection, ToolingTemplateKind, ToolingTemplateSource, ToolingTemplateSourceType, ToolingTemplatesConfig, ToolingTsconfigConfig, ToolingViteConfig, ToolingWatchConfig, WorkflowConfig, WorkflowSetting, WorkflowStep, WorkflowStepsConfig, type YamlValue, applyReplacements, applyReplacementsDeep, asString, biomeConfigSchema, camelCase, camelCaseId, capitalize, changelogConfigSchema, changelogWorkflowsConfigSchema, constantCase, createReplacer, dbxConfigSchema, deepMerge, defineConfig, defineReplacements, ensureLeadingSlash, ensureSlashes, ensureTrailingSlash, extractTokens, formatCliFlag, hasText, hasUnresolvedTokens, indent, index_d_exports, isLocalhost, isPlainObject, kebabCase, mapValues, mergeJsonAt, pascalCase, projectConfigSchema, projectTypeSchema, providerActions, readJsonAt, readJsonFile, removeDoubleSlashes, removeLeadingSlash, removeTrailingSlash, repoSlugFromUrl, resolveSort, resolveTokens, run, sanitizeSlashes, sectionConfig, sectionEnabled, snakeCase, sort, spawnCross, str, templateKindSchema, templateSourceSchema, templateSourceTypeSchema, templatesConfigSchema, titleCase, toJson, toYaml, tokenPattern, toolingConfigSchema, tsconfigConfigSchema, viteConfigSchema, watchConfigSchema, workflowConfigSchema, workflowSettingSchema, workflowStepSchema, workflowStepsConfigSchema, writeJsonFile };
@@ -0,0 +1 @@
1
+ import"node:path";import"node:url";import.meta.url;import{__exportAll as ee}from"../../../_virtual/_rolldown/runtime.js";import{deepMerge as e,isPlainObject as t,mapValues as n,resolveSort as r,sort as i}from"./object-utils.js";import{mergeJsonAt as a,readJsonAt as o,readJsonFile as s,toJson as c,writeJsonFile as l}from"./fs-utils.js";import{providerActions as u}from"./provider.js";import{run as d,spawnCross as f}from"./run.js";import{asString as p,camelCase as m,camelCaseId as h,capitalize as g,constantCase as _,ensureLeadingSlash as v,ensureSlashes as y,ensureTrailingSlash as b,formatCliFlag as x,hasText as S,indent as C,isLocalhost as w,kebabCase as T,pascalCase as E,removeDoubleSlashes as D,removeLeadingSlash as O,removeTrailingSlash as k,sanitizeSlashes as A,snakeCase as j,str as M,titleCase as N}from"./string-utils.js";import{applyReplacements as P,applyReplacementsDeep as F,createReplacer as te,defineReplacements as I,extractTokens as L,hasUnresolvedTokens as R,tokenPattern as z}from"./template.js";import{CONFIG_SECTION_DESCRIPTIONS as B,CONFIG_SECTION_SCHEMAS as V,biomeConfigSchema as H,changelogConfigSchema as U,changelogWorkflowsConfigSchema as W,dbxConfigSchema as G,projectConfigSchema as K,projectTypeSchema as q,templateKindSchema as J,templateSourceSchema as Y,templateSourceTypeSchema as X,templatesConfigSchema as Z,toolingConfigSchema as Q,tsconfigConfigSchema as $,viteConfigSchema as ne,watchConfigSchema as re,workflowConfigSchema as ie,workflowSettingSchema as ae,workflowStepSchema as oe,workflowStepsConfigSchema as se}from"./config-schema.js";import{CONFIG_FILE_NAMES as ce,defineConfig as le,repoSlugFromUrl as ue,resolveTokens as de,sectionConfig as fe,sectionEnabled as pe}from"./toolchain.js";import{toYaml as me}from"./yaml.js";var he=/* @__PURE__ */ ee({CONFIG_FILE_NAMES:()=>ce,CONFIG_SECTION_DESCRIPTIONS:()=>B,CONFIG_SECTION_SCHEMAS:()=>V,applyReplacements:()=>P,applyReplacementsDeep:()=>F,asString:()=>p,biomeConfigSchema:()=>H,camelCase:()=>m,camelCaseId:()=>h,capitalize:()=>g,changelogConfigSchema:()=>U,changelogWorkflowsConfigSchema:()=>W,constantCase:()=>_,createReplacer:()=>te,dbxConfigSchema:()=>G,deepMerge:()=>e,defineConfig:()=>le,defineReplacements:()=>I,ensureLeadingSlash:()=>v,ensureSlashes:()=>y,ensureTrailingSlash:()=>b,extractTokens:()=>L,formatCliFlag:()=>x,hasText:()=>S,hasUnresolvedTokens:()=>R,indent:()=>C,isLocalhost:()=>w,isPlainObject:()=>t,kebabCase:()=>T,mapValues:()=>n,mergeJsonAt:()=>a,pascalCase:()=>E,projectConfigSchema:()=>K,projectTypeSchema:()=>q,providerActions:()=>u,readJsonAt:()=>o,readJsonFile:()=>s,removeDoubleSlashes:()=>D,removeLeadingSlash:()=>O,removeTrailingSlash:()=>k,repoSlugFromUrl:()=>ue,resolveSort:()=>r,resolveTokens:()=>de,run:()=>d,sanitizeSlashes:()=>A,sectionConfig:()=>fe,sectionEnabled:()=>pe,snakeCase:()=>j,sort:()=>i,spawnCross:()=>f,str:()=>M,templateKindSchema:()=>J,templateSourceSchema:()=>Y,templateSourceTypeSchema:()=>X,templatesConfigSchema:()=>Z,titleCase:()=>N,toJson:()=>c,toYaml:()=>me,tokenPattern:()=>z,toolingConfigSchema:()=>Q,tsconfigConfigSchema:()=>$,viteConfigSchema:()=>ne,watchConfigSchema:()=>re,workflowConfigSchema:()=>ie,workflowSettingSchema:()=>ae,workflowStepSchema:()=>oe,workflowStepsConfigSchema:()=>se,writeJsonFile:()=>l});export{ce as CONFIG_FILE_NAMES,B as CONFIG_SECTION_DESCRIPTIONS,V as CONFIG_SECTION_SCHEMAS,P as applyReplacements,F as applyReplacementsDeep,p as asString,H as biomeConfigSchema,m as camelCase,h as camelCaseId,g as capitalize,U as changelogConfigSchema,W as changelogWorkflowsConfigSchema,_ as constantCase,te as createReplacer,G as dbxConfigSchema,e as deepMerge,le as defineConfig,I as defineReplacements,v as ensureLeadingSlash,y as ensureSlashes,b as ensureTrailingSlash,L as extractTokens,x as formatCliFlag,S as hasText,R as hasUnresolvedTokens,C as indent,w as isLocalhost,t as isPlainObject,T as kebabCase,n as mapValues,a as mergeJsonAt,E as pascalCase,K as projectConfigSchema,q as projectTypeSchema,u as providerActions,o as readJsonAt,s as readJsonFile,D as removeDoubleSlashes,O as removeLeadingSlash,k as removeTrailingSlash,ue as repoSlugFromUrl,r as resolveSort,de as resolveTokens,d as run,A as sanitizeSlashes,fe as sectionConfig,pe as sectionEnabled,j as snakeCase,i as sort,f as spawnCross,he as src_exports,M as str,J as templateKindSchema,Y as templateSourceSchema,X as templateSourceTypeSchema,Z as templatesConfigSchema,N as titleCase,c as toJson,me as toYaml,z as tokenPattern,Q as toolingConfigSchema,$ as tsconfigConfigSchema,ne as viteConfigSchema,re as watchConfigSchema,ie as workflowConfigSchema,ae as workflowSettingSchema,oe as workflowStepSchema,se as workflowStepsConfigSchema,l as writeJsonFile};
@@ -0,0 +1,15 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ //#region packages/shared/src/object-utils.d.ts
4
+ export type Sortable = Record<string, any> | [string, any][] | undefined;
5
+ /** Sort an object's keys (or an entry tuple array) alphabetically. */
6
+ export declare function sort<T extends Sortable>(value: T): T;
7
+ /** Default comparator used by {@link sort}. */
8
+ export declare function resolveSort(a: string, b: string): number;
9
+ /** Whether a value is a non-null, non-array object. */
10
+ export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
11
+ /** Recursively merge `sources` over `target` (arrays and scalars are replaced). */
12
+ export declare function deepMerge<T extends Record<string, any>>(target: T, ...sources: (Partial<T> | undefined)[]): T;
13
+ /** Map an object's values, keeping the keys. */
14
+ export declare function mapValues<V, R>(value: Record<string, V>, fn: (value: V, key: string) => R): Record<string, R>;
15
+ //#endregion
@@ -0,0 +1 @@
1
+ import"node:path";import"node:url";import.meta.url;function e(e){if(!e)return e;let n=(Array.isArray(e)?e:Object.entries(e||{})).sort(([e],[n])=>t(e,n));return Array.isArray(e)?n:Object.fromEntries(n)}function t(e,t){return e.localeCompare(t)}function n(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function r(e,...t){let i={...e};for(let e of t)if(e)for(let[t,a]of Object.entries(e)){let e=i[t];n(e)&&n(a)?i[t]=r(e,a):a!==void 0&&(i[t]=a)}return i}function i(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}export{r as deepMerge,n as isPlainObject,i as mapValues,t as resolveSort,e as sort};
@@ -0,0 +1,66 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ //#region packages/shared/src/provider.d.ts
4
+ /**
5
+ * The provider model.
6
+ *
7
+ * A *provider* is an external toolchain that `@deltabox/toolchain` exposes through
8
+ * its three surfaces: the `dbx` CLI, the programmatic API and the VS
9
+ * Code extension. A provider wraps a binary (eg. Vite+'s `vp`) and contributes
10
+ * namespaced CLI commands (`vite:dev`, `vite:build`, ...) plus the metadata the
11
+ * extension needs to build menus and run everything through the CLI.
12
+ *
13
+ * Providers stay framework-agnostic: they never import a CLI/editor framework,
14
+ * they just describe commands + actions. The root CLI and the extension consume
15
+ * this description (the extension over `dbx providers --json`).
16
+ */
17
+ /** A CLI command a provider contributes (namespaced, eg. `vite:dev`). */
18
+ export interface ToolingProviderCommand {
19
+ /** The namespaced `dbx` command name, eg. `vite:dev`. */
20
+ name: string;
21
+ /** The wrapped subcommand on the provider binary, eg. `dev`. */
22
+ subcommand: string;
23
+ /** Human-readable description. */
24
+ description: string;
25
+ /** UI group (eg. `develop`, `build`, `deps`). */
26
+ group?: string;
27
+ /** Alternate names the binary accepts, eg. `i` for `install`. */
28
+ aliases?: string[];
29
+ }
30
+ /** A curated action the VS Code extension can surface for a provider. */
31
+ export interface ToolingProviderAction {
32
+ /** Stable id, unique within the provider. */
33
+ id: string;
34
+ /** Menu label. */
35
+ label: string;
36
+ /** Longer description / tooltip. */
37
+ description?: string;
38
+ /** The `dbx` command to run (no args). */
39
+ command: string;
40
+ /** UI group. */
41
+ group?: string;
42
+ }
43
+ /** A provider descriptor consumed by the CLI + the VS Code extension. */
44
+ export interface ToolingProvider {
45
+ /** Stable id, eg. `vite-plus`. */
46
+ id: string;
47
+ /** Display name, eg. `Vite+`. */
48
+ name: string;
49
+ /** One-line description. */
50
+ description?: string;
51
+ /** Project homepage. */
52
+ homepage?: string;
53
+ /** The external binary the provider wraps, eg. `vp`. */
54
+ binary?: string;
55
+ /** The commands the provider contributes to the CLI. */
56
+ commands: ToolingProviderCommand[];
57
+ /** Curated actions for the extension (defaults to one per command). */
58
+ actions?: ToolingProviderAction[];
59
+ }
60
+ /**
61
+ * Derive the default actions (one per command) for a provider that does not
62
+ * declare its own. This keeps a provider descriptor minimal while still giving
63
+ * the extension something to render.
64
+ */
65
+ export declare function providerActions(provider: ToolingProvider): ToolingProviderAction[];
66
+ //#endregion
@@ -0,0 +1 @@
1
+ import"node:path";import"node:url";import.meta.url;function e(e){return e.actions?.length?e.actions:e.commands.map(e=>({id:e.name.replace(/[:]/g,`-`),label:e.description,command:e.name,...e.group?{group:e.group}:{}}))}export{e as providerActions};
@@ -0,0 +1,26 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { ChildProcess, SpawnOptions } from "node:child_process";
4
+ //#region packages/shared/src/run.d.ts
5
+ export interface RunOptions extends SpawnOptions {
6
+ /** Exit the main process with the child's exit code (default true). */
7
+ exitWithMainProc?: boolean;
8
+ /** Append a trailing `--` to the args (default true). */
9
+ argsEndingDashes?: boolean;
10
+ /** Log the command before spawning (default true). */
11
+ verbose?: boolean;
12
+ }
13
+ /**
14
+ * Spawn a command without a shell in a cross-platform safe way, returning the
15
+ * child process. On Windows the command and every argument are escaped for
16
+ * `cmd.exe` (and a `.cmd`/`.bat` shim is re-escaped) so a caller-supplied argv
17
+ * value can never inject a command. `options.stdio` defaults to `inherit`.
18
+ */
19
+ export declare function spawnCross(cmd: string, args: string[], options?: SpawnOptions): ChildProcess;
20
+ /**
21
+ * Spawn a command without a shell in a cross-platform safe way. On Windows the
22
+ * command and every argument are escaped for `cmd.exe` so a caller-supplied
23
+ * argv value can never inject a command.
24
+ */
25
+ export declare function run(cmd: string, args: string[], options?: RunOptions): ChildProcess;
26
+ //#endregion
@@ -0,0 +1 @@
1
+ import{default as e}from"node:path";import"node:url";import.meta.url;import t from"node:fs";import{spawn as n}from"node:child_process";const r=process.platform===`win32`,i=/([()\][%!^"`<>&|;, *?])/g;function a(e){return e.replace(i,`^$1`)}function o(e,t){let n=String(e);return n=n.replace(/(?=(\\+?)?)\1"/g,`$1$1\\"`),n=n.replace(/(?=(\\+?)?)\1$/,`$1$1`),n=`"${n}"`,n=n.replace(i,`^$1`),t&&(n=n.replace(i,`^$1`)),n}function s(n){if(e.extname(n))return t.existsSync(n)?n:void 0;let r=(process.env.PATHEXT??`.COM;.EXE;.BAT;.CMD`).split(`;`),i=(process.env.PATH??``).split(e.delimiter);for(let a of r)for(let r of i){let i=e.join(r,`${n}${a.toLowerCase()}`);if(t.existsSync(i))return i}}function c(e){let t=s(e)??e;return/\.(cmd|bat)$/i.test(t)}function l(e,t,i={}){if(r){let r=c(e),s=[a(e),...t.map(e=>o(e,r))].join(` `);return n(process.env.ComSpec??`cmd.exe`,[`/d`,`/s`,`/c`,`"${s}"`],{stdio:`inherit`,...i,shell:!1,windowsVerbatimArguments:!0})}return n(e,t,{stdio:`inherit`,...i,shell:!1})}function u(e,t,n){let{exitWithMainProc:r=!0,argsEndingDashes:i=!0,verbose:a=!0,...o}=n??{},s=[...t,...i?[`--`]:[]];a&&console.log(`$ ${e} ${s.join(` `)}`);let c=l(e,s,o);return r&&c.on(`exit`,process.exit),c}export{u as run,l as spawnCross};
@@ -0,0 +1,52 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ //#region packages/shared/src/string-utils.d.ts
4
+ /** Coerce a value to a trimmed string. */
5
+ export declare function str(v: unknown): string;
6
+ /** Coerce a value to a string without trimming. */
7
+ export declare function asString(v: unknown): string;
8
+ /** Whether a value looks like a non-empty string after trimming. */
9
+ export declare function hasText(v: unknown): v is string;
10
+ /** Uppercase the first letter of a string (no-op on empty input). */
11
+ export declare function capitalize(text: string): string;
12
+ /** `foo bar` -> `fooBar`. */
13
+ export declare function camelCase(text: string): string;
14
+ /** `foo bar` -> `FooBar`. */
15
+ export declare function pascalCase(text: string): string;
16
+ /** `foo bar` -> `foo-bar`. */
17
+ export declare function kebabCase(text: string): string;
18
+ /** `foo bar` -> `foo_bar`. */
19
+ export declare function snakeCase(text: string): string;
20
+ /** `foo bar` -> `FOO_BAR`. */
21
+ export declare function constantCase(text: string): string;
22
+ /** `foo bar` -> `Foo Bar`. */
23
+ export declare function titleCase(text: string): string;
24
+ /**
25
+ * Convert an operation id into a camelCase identifier:
26
+ * `hosts.list` -> `hostsList`, `auth.login` -> `authLogin`.
27
+ */
28
+ export declare function camelCaseId(operationId: string): string;
29
+ /**
30
+ * Turn an env-var-ish identifier into a CLI flag, stripping a prefix:
31
+ * `MYAPP_CLI_BASE_URL` -> `base-url` (with prefix `MYAPP_`).
32
+ */
33
+ export declare function formatCliFlag(env: string, prefix?: string): string;
34
+ /** Indent every non-empty line of a string. */
35
+ export declare function indent(text: string, spaces?: number): string;
36
+ /** Whether a URI points at a local host (localhost, 127.0.0.1, 0.0.0.0, ::). */
37
+ export declare function isLocalhost(uri: string): boolean;
38
+ /** Ensure a string starts with `slash`. */
39
+ export declare function ensureLeadingSlash(value: string, slash?: string): string;
40
+ /** Ensure a string ends with `slash`. */
41
+ export declare function ensureTrailingSlash(value: string, slash?: string): string;
42
+ /** Remove leading slashes from a string. */
43
+ export declare function removeLeadingSlash(value: string, slash?: string): string;
44
+ /** Remove trailing slashes from a string. */
45
+ export declare function removeTrailingSlash(value: string, slash?: string): string;
46
+ /** Collapse repeated slashes in a string. */
47
+ export declare function removeDoubleSlashes(value: string, slash?: string): string;
48
+ /** Sanitize slashes with the given operations (default: all). */
49
+ export declare function sanitizeSlashes(value: string, operations?: ('leading' | 'trailing' | 'double')[], slash?: string): string;
50
+ /** Ensure slashes at the requested positions. */
51
+ export declare function ensureSlashes(value: string, operations: ('leading' | 'trailing')[], slash?: string): string;
52
+ //#endregion
@@ -0,0 +1,3 @@
1
+ import"node:path";import"node:url";import.meta.url;function e(e){return typeof e==`string`?e.trim():``}function t(e){return typeof e==`string`?e:``}function n(e){return typeof e==`string`&&e.trim().length>0}function r(e){return e.length>0?e.charAt(0).toUpperCase()+e.slice(1):e}function i(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).split(/[^a-zA-Z0-9]+/).filter(Boolean)}function a(e){return i(e).map((e,t)=>t===0?e.toLowerCase():r(e.toLowerCase())).join(``)}function o(e){return i(e).map(e=>r(e.toLowerCase())).join(``)}function s(e){return i(e).map(e=>e.toLowerCase()).join(`-`)}function c(e){return i(e).map(e=>e.toLowerCase()).join(`_`)}function l(e){return i(e).map(e=>e.toUpperCase()).join(`_`)}function u(e){return i(e).map(e=>r(e.toLowerCase())).join(` `)}function d(e){return a(e)}function f(e,t=``){return s(t&&e.startsWith(t)?e.slice(t.length):e)}function p(e,t=2){let n=` `.repeat(t);return e.split(`
2
+ `).map(e=>e.trim()?n+e:e).join(`
3
+ `)}function m(e){return/localhost|127\.0\.0\.1|0\.0\.0\.0|::/.test(e)}function h(e,t=`/`){return e.startsWith(t)?e:`${t}${e}`}function g(e,t=`/`){return e.endsWith(t)?e:`${e}${t}`}function _(e,t=`/`){return e.replace(RegExp(`^${S(t)}+`),``)}function v(e,t=`/`){return e.replace(RegExp(`${S(t)}+$`),``)}function y(e,t=`/`){return e.replace(RegExp(`${S(t)}+`,`g`),t)}function b(e,t=[`leading`,`trailing`,`double`],n=`/`){let r=e;for(let e of t)e===`leading`&&(r=_(r,n)),e===`trailing`&&(r=v(r,n)),e===`double`&&(r=y(r,n));return r}function x(e,t,n=`/`){if(!t.length)throw Error(`ensureSlashes: operations array cannot be empty.`);let r=e;for(let e of t)if(e===`leading`)r=h(r,n);else if(e===`trailing`)r=g(r,n);else throw Error(`ensureSlashes: invalid operation: ${e}`);return r}function S(e){return e===`/`?`\\/`:e}export{t as asString,a as camelCase,d as camelCaseId,r as capitalize,l as constantCase,h as ensureLeadingSlash,x as ensureSlashes,g as ensureTrailingSlash,f as formatCliFlag,n as hasText,p as indent,m as isLocalhost,s as kebabCase,o as pascalCase,y as removeDoubleSlashes,_ as removeLeadingSlash,v as removeTrailingSlash,b as sanitizeSlashes,c as snakeCase,e as str,u as titleCase};
@@ -0,0 +1,53 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ //#region packages/shared/src/template.d.ts
4
+ /**
5
+ * Generic replacement/template engine.
6
+ *
7
+ * All `@deltabox/toolchain` templates and generated files are authored with
8
+ * `{{ token }}` placeholders (e.g. `{{name}}`, `{{scope}}`, `{{envPrefix}}`)
9
+ * so a consumer can retarget the tooling at any project by supplying its own
10
+ * replacement values. Tokens support an inline default: `{{name:my-app}}`.
11
+ */
12
+ /** A replacement value. Falsy-but-defined values are stringified. */
13
+ export type ReplacementValue = string | number | boolean | null | undefined;
14
+ /** A map of token name to replacement value. */
15
+ export interface Replacements {
16
+ [key: string]: ReplacementValue;
17
+ }
18
+ export interface ReplacementOptions {
19
+ /** Opening token delimiter (default `{{`). */
20
+ open?: string;
21
+ /** Closing token delimiter (default `}}`). */
22
+ close?: string;
23
+ /** Keep unresolved tokens as-is instead of erasing them (default true). */
24
+ keepUnresolved?: boolean;
25
+ /** Throw when a token cannot be resolved (default false). */
26
+ strict?: boolean;
27
+ /** Transform every resolved value before it is written. */
28
+ transform?: (value: string, key: string) => string;
29
+ }
30
+ /** A compiled replacer: feed it a string, get the rendered string back. */
31
+ export type Replacer = (input: string) => string;
32
+ /** Build the token-matching regular expression for the given delimiters. */
33
+ export declare function tokenPattern(open?: string, close?: string): RegExp;
34
+ /**
35
+ * Replace every `{{ token }}` (or custom delimiter) occurrence in `input`
36
+ * using `replacements`. Missing tokens fall back to their inline default, then
37
+ * to the `keepUnresolved`/`strict` policy.
38
+ */
39
+ export declare function applyReplacements(input: string, replacements?: Replacements, options?: ReplacementOptions): string;
40
+ /** Create a reusable {@link Replacer} bound to a replacement map. */
41
+ export declare function createReplacer(replacements?: Replacements, options?: ReplacementOptions): Replacer;
42
+ /**
43
+ * Recursively apply replacements to an arbitrary value. Strings are rendered;
44
+ * arrays and plain objects are walked; everything else is returned as-is.
45
+ */
46
+ export declare function applyReplacementsDeep<T>(value: T, replacements?: Replacements, options?: ReplacementOptions): T;
47
+ /** Every distinct token name referenced by `input`. */
48
+ export declare function extractTokens(input: string, options?: ReplacementOptions): string[];
49
+ /** Whether `input` still contains any token (resolved or not). */
50
+ export declare function hasUnresolvedTokens(input: string): boolean;
51
+ /** Identity helper that keeps replacement maps type-checked at the call site. */
52
+ export declare function defineReplacements<T extends Replacements>(replacements: T): T;
53
+ //#endregion
@@ -0,0 +1 @@
1
+ import"node:path";import"node:url";import.meta.url;function e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function t(t=`{{`,n=`}}`){return RegExp(`${e(t)}\\s*([\\w.@/-]+)\\s*(?::\\s*([^]*?))?\\s*${e(n)}`,`g`)}function n(e){return e==null?``:String(e)}function r(e,r={},i={}){let{open:a=`{{`,close:o=`}}`,keepUnresolved:s=!0,strict:c=!1,transform:l}=i,u=t(a,o);return e.replace(u,(e,t,i)=>{if(Object.hasOwn(r,t)){let e=n(r[t]);return l?l(e,t):e}if(i!==void 0)return i.trim();if(c)throw Error(`Missing replacement for token "{{${t}}}"`);return s?e:``})}function i(e={},t={}){return n=>r(n,e,t)}function a(e,t={},n={}){if(typeof e==`string`)return r(e,t,n);if(Array.isArray(e))return e.map(e=>a(e,t,n));if(e&&typeof e==`object`){let r={};for(let[i,o]of Object.entries(e))r[i]=a(o,t,n);return r}return e}function o(e,n={}){let r=t(n.open,n.close),i=/* @__PURE__ */ new Set;for(let t of e.matchAll(r))t[1]&&i.add(t[1]);return[...i]}function s(e){let n=t();return n.lastIndex=0,n.test(e)}function c(e){return e}export{r as applyReplacements,a as applyReplacementsDeep,i as createReplacer,c as defineReplacements,o as extractTokens,s as hasUnresolvedTokens,t as tokenPattern};
@@ -0,0 +1,159 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { Replacements } from "./template.js";
4
+ import { CONFIG_SECTION_DESCRIPTIONS, CONFIG_SECTION_SCHEMAS, ChangelogWorkflowsConfig, DbxConfigSections, ProjectType, ToolingBiomeConfig, ToolingChangelogConfig, ToolingConfigSections, ToolingProjectConfig, ToolingTemplateKind, ToolingTemplateSource, ToolingTemplateSourceType, ToolingTemplatesConfig, ToolingTsconfigConfig, ToolingViteConfig, ToolingWatchConfig, WorkflowConfig, WorkflowSetting, WorkflowStep, WorkflowStepsConfig, biomeConfigSchema, changelogConfigSchema, changelogWorkflowsConfigSchema, dbxConfigSchema, projectConfigSchema, projectTypeSchema, templateKindSchema, templateSourceSchema, templateSourceTypeSchema, templatesConfigSchema, toolingConfigSchema, tsconfigConfigSchema, viteConfigSchema, watchConfigSchema, workflowConfigSchema, workflowSettingSchema, workflowStepSchema, workflowStepsConfigSchema } from "./config-schema.js";
5
+ import { Awaitable } from "./types.js";
6
+ //#region packages/shared/src/toolchain.d.ts
7
+ /** A summary of a sync run, handed to {@link ToolingHooks.afterSync}. */
8
+ export interface SyncSummary {
9
+ written: string[];
10
+ changed: string[];
11
+ removed: string[];
12
+ upToDate: boolean;
13
+ }
14
+ /**
15
+ * Lifecycle hooks, declared as functions in `dbx.config.ts` (so they only work
16
+ * from a `.ts`/`.js` config, not JSON). Return values are awaited.
17
+ */
18
+ export interface ToolingHooks {
19
+ /** Runs after the config is loaded + tokens resolved. */
20
+ afterLoad?: (info: {
21
+ cwd: string;
22
+ config: ToolingConfig;
23
+ tokens: Replacements;
24
+ path?: string;
25
+ }) => Awaitable<void>;
26
+ /** Runs once before the sync tasks. */
27
+ beforeSync?: (ctx: SyncContext) => Awaitable<void>;
28
+ /** Runs before each task. */
29
+ beforeTask?: (info: {
30
+ task: SyncTask;
31
+ ctx: SyncContext;
32
+ }) => Awaitable<void>;
33
+ /** Runs after each task (with the files it produced, if any). */
34
+ afterTask?: (info: {
35
+ task: SyncTask;
36
+ ctx: SyncContext;
37
+ files?: ManagedFile[];
38
+ }) => Awaitable<void>;
39
+ /** Runs once after the sync tasks with the result summary. */
40
+ afterSync?: (info: {
41
+ cwd: string;
42
+ config: ToolingConfig;
43
+ result: SyncSummary;
44
+ }) => Awaitable<void>;
45
+ /** Runs on every watch-triggered change. */
46
+ onChange?: (info: {
47
+ path?: string;
48
+ }) => Awaitable<void>;
49
+ }
50
+ /**
51
+ * The complete tooling configuration a consumer declares (under
52
+ * `dbx.toolchain`).
53
+ *
54
+ * Every section is **opt-in by presence** (see {@link sectionEnabled}): define a
55
+ * section to enable it; omit it to leave that area untouched. Within a defined
56
+ * section, `enabled: false` disables it explicitly.
57
+ */
58
+ export type ToolingConfig = ToolingConfigSections & {
59
+ hooks?: ToolingHooks;
60
+ };
61
+ /**
62
+ * The root shape of a `dbx.config.*` file. The `@deltabox/toolchain` settings
63
+ * live under the `toolchain` key, so `dbx.config` can host other dbx concerns
64
+ * alongside it.
65
+ */
66
+ export interface DbxConfig {
67
+ toolchain?: ToolingConfig;
68
+ }
69
+ /**
70
+ * Identity helper that gives a config file full type-checking + autocomplete.
71
+ * Mirrors Vite's `defineConfig`: `export default defineConfig({ toolchain: { ... } })`.
72
+ */
73
+ export declare function defineConfig(config: DbxConfig): DbxConfig;
74
+ /**
75
+ * A config section that is enabled with `true`, disabled with `false`, or
76
+ * configured with an options object.
77
+ */
78
+ export type ToolingSection<T> = boolean | T;
79
+ /**
80
+ * Whether an optional top-level config section is enabled.
81
+ *
82
+ * Sections are **opt-in by presence**: a section only runs when it is defined
83
+ * in `dbx.config.*` (and not explicitly disabled). A consumer can
84
+ * enable a tooling area with the boolean shorthand (`biome: true`) when it needs
85
+ * no options, or configure it with an object (`biome: { overrides: { ... } }`).
86
+ * Either way the tooling never touches an area the consumer did not ask for.
87
+ */
88
+ export declare function sectionEnabled(section: ToolingSection<{
89
+ enabled?: boolean;
90
+ }> | undefined): boolean;
91
+ /** The options object for a section (`undefined` when it is a boolean/absent). */
92
+ export declare function sectionConfig<T extends {
93
+ enabled?: boolean;
94
+ }>(section: ToolingSection<T> | undefined): T | undefined;
95
+ /** The file names a config loader looks for, in priority order. */
96
+ export declare const CONFIG_FILE_NAMES: readonly ['dbx.config.ts', 'dbx.config.mts', 'dbx.config.js', 'dbx.config.mjs', 'dbx.config.cjs', 'dbx.config.json'];
97
+ /** Derive the `owner/name` slug from a repository URL. */
98
+ export declare function repoSlugFromUrl(repo: string | undefined): string | undefined;
99
+ /**
100
+ * Flatten a {@link ToolingConfig} into the `{{ token }}` replacements every
101
+ * template understands. Defaults are chosen so a bare config still renders.
102
+ */
103
+ export declare function resolveTokens(config?: ToolingConfig): Replacements;
104
+ /** A file written by a sync task (its parent directory is created as needed). */
105
+ export interface ManagedFile {
106
+ /** Path relative to the project root. */
107
+ path: string;
108
+ /** The file content. */
109
+ content: string;
110
+ /**
111
+ * A comment inserted at the top marking the file as managed (skipped for
112
+ * JSON files, which are tracked via the manifest instead).
113
+ */
114
+ header?: string;
115
+ }
116
+ /** The context handed to every {@link SyncTask}. */
117
+ export interface SyncContext {
118
+ /** The project root. */
119
+ cwd: string;
120
+ /** The detected/configured project kind. */
121
+ projectType: ProjectType;
122
+ /** The loaded config. */
123
+ config: ToolingConfig;
124
+ /** The resolved replacement tokens. */
125
+ tokens: Replacements;
126
+ /** Log a line (respects `--quiet`). */
127
+ log: (message: string) => void;
128
+ }
129
+ /** A unit of sync work exposed by a package. */
130
+ export interface SyncTask {
131
+ /** Stable id, used in logs + the manifest. */
132
+ name: string;
133
+ /**
134
+ * Repo-relative globs to watch; a change re-runs this task. The config file
135
+ * itself is always watched, and re-runs every task.
136
+ */
137
+ watch?: string[];
138
+ /**
139
+ * File names/suffixes the task does **not** own but that may appear in an
140
+ * older manifest. They are never deleted (even though they are no longer
141
+ * generated) and are dropped from the manifest, so a consumer can edit them
142
+ * freely — eg. `tsconfig.build.json`.
143
+ */
144
+ keep?: string[];
145
+ /** Whether the task runs for the given config (default: always). */
146
+ enabled?: (config: ToolingConfig) => boolean;
147
+ /**
148
+ * The project kinds the task applies to (default: all). A task is skipped
149
+ * when the resolved project type is not in this list.
150
+ */
151
+ projectTypes?: ProjectType[];
152
+ /**
153
+ * Run the task. Returns the managed files to write, and/or performs side
154
+ * effects directly (eg. the tsconfig task regenerates files itself).
155
+ */
156
+ run: (ctx: SyncContext) => Awaitable<ManagedFile[] | void>;
157
+ }
158
+ //#endregion
159
+ export { CONFIG_SECTION_DESCRIPTIONS, CONFIG_SECTION_SCHEMAS, ChangelogWorkflowsConfig, DbxConfigSections, ProjectType, ToolingBiomeConfig, ToolingChangelogConfig, ToolingConfigSections, ToolingProjectConfig, ToolingTemplateKind, ToolingTemplateSource, ToolingTemplateSourceType, ToolingTemplatesConfig, ToolingTsconfigConfig, ToolingViteConfig, ToolingWatchConfig, WorkflowConfig, WorkflowSetting, WorkflowStep, WorkflowStepsConfig, biomeConfigSchema, changelogConfigSchema, changelogWorkflowsConfigSchema, dbxConfigSchema, projectConfigSchema, projectTypeSchema, templateKindSchema, templateSourceSchema, templateSourceTypeSchema, templatesConfigSchema, toolingConfigSchema, tsconfigConfigSchema, viteConfigSchema, watchConfigSchema, workflowConfigSchema, workflowSettingSchema, workflowStepSchema, workflowStepsConfigSchema };
@@ -0,0 +1 @@
1
+ import"node:path";import"node:url";import.meta.url;import{CONFIG_SECTION_DESCRIPTIONS as e,CONFIG_SECTION_SCHEMAS as t,biomeConfigSchema as n,changelogConfigSchema as r,changelogWorkflowsConfigSchema as i,dbxConfigSchema as a,projectConfigSchema as o,projectTypeSchema as s,templateKindSchema as c,templateSourceSchema as l,templateSourceTypeSchema as u,templatesConfigSchema as d,toolingConfigSchema as f,tsconfigConfigSchema as p,viteConfigSchema as m,watchConfigSchema as h,workflowConfigSchema as g,workflowSettingSchema as _,workflowStepSchema as v,workflowStepsConfigSchema as y}from"./config-schema.js";function b(e){return e}function x(e){return e===void 0?!1:typeof e==`boolean`?e:e.enabled!==!1}function S(e){return e!==void 0&&typeof e==`object`?e:void 0}const C=[`dbx.config.ts`,`dbx.config.mts`,`dbx.config.js`,`dbx.config.mjs`,`dbx.config.cjs`,`dbx.config.json`];function w(e){if(!e)return;let t=e.match(/github\.com[/:]([^/]+)\/([^/.]+?)(?:\.git)?$/);return t?.[1]&&t[2]?`${t[1]}/${t[2]}`:void 0}function T(e={}){let t=e.project??{},n=S(e.changelog)??{};return{name:t.name??`app`,scope:t.scope??``,author:t.author??``,license:t.license??`MIT`,homepage:t.homepage??``,repo:t.repo??``,repoSlug:w(t.repo)??``,description:t.description??``,nodeVersion:t.nodeVersion??`22`,packageManager:t.packageManager??`yarn`,yarnVersion:t.packageManagerVersion??`4.17.1`,packageManagerVersion:t.packageManagerVersion??`4.17.1`,mainBranch:n.branches?.main??`main`,devBranch:n.branches?.dev??`dev`}}export{C as CONFIG_FILE_NAMES,e as CONFIG_SECTION_DESCRIPTIONS,t as CONFIG_SECTION_SCHEMAS,n as biomeConfigSchema,r as changelogConfigSchema,i as changelogWorkflowsConfigSchema,a as dbxConfigSchema,b as defineConfig,o as projectConfigSchema,s as projectTypeSchema,w as repoSlugFromUrl,T as resolveTokens,S as sectionConfig,x as sectionEnabled,c as templateKindSchema,l as templateSourceSchema,u as templateSourceTypeSchema,d as templatesConfigSchema,f as toolingConfigSchema,p as tsconfigConfigSchema,m as viteConfigSchema,h as watchConfigSchema,g as workflowConfigSchema,_ as workflowSettingSchema,v as workflowStepSchema,y as workflowStepsConfigSchema};
@@ -0,0 +1,100 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { Replacements } from "./template.js";
4
+ import { ProjectType } from "./config-schema.js";
5
+ import { ToolingConfig } from "./toolchain.js";
6
+ //#region packages/shared/src/types.d.ts
7
+ /** A value that may or may not be awaited. */
8
+ export type Awaitable<T> = T | Promise<T>;
9
+ /** A file that was written by a generator: an absolute path plus its content. */
10
+ export interface GeneratedFile {
11
+ path: string;
12
+ content: string;
13
+ }
14
+ /** Any JSON-serializable value. */
15
+ export type JsonValue = string | number | boolean | null | JsonValue[] | {
16
+ [key: string]: JsonValue;
17
+ };
18
+ /** A CLI option a tooling command exposes (framework-agnostic). */
19
+ export interface ToolingOption {
20
+ /** Commander-style flags, eg. `-o, --out <path>`. */
21
+ flags: string;
22
+ /** Human-readable description. */
23
+ description: string;
24
+ /** Optional default value (stringified). */
25
+ default?: string;
26
+ }
27
+ /**
28
+ * The context handed to every command after the consumer's
29
+ * `dbx.config.*` has been loaded, so a command can derive its defaults
30
+ * from the config; explicit CLI flags override those defaults.
31
+ */
32
+ export interface ToolingCommandContext {
33
+ /** The project root the config was loaded from. */
34
+ cwd: string;
35
+ /** The detected/configured project kind. */
36
+ projectType: ProjectType;
37
+ /** The loaded tooling config (empty object when none was found). */
38
+ config: ToolingConfig;
39
+ /** The resolved replacement tokens. */
40
+ tokens: Replacements;
41
+ /** The config file that was loaded, if any. */
42
+ configPath?: string;
43
+ }
44
+ /** A positional argument a command accepts. */
45
+ export interface ToolingArgument {
46
+ /** The argument name (also its key in the run `args` object). */
47
+ name: string;
48
+ /** Human-readable description. */
49
+ description: string;
50
+ /** Accept one value (default) or many (variadic, collected into an array). */
51
+ variadic?: boolean;
52
+ /** Whether the argument is required (default true). */
53
+ required?: boolean;
54
+ }
55
+ /**
56
+ * A framework-agnostic command description. Packages export these (eg.
57
+ * `configCommands()`) and the root `dbx` CLI registers them with
58
+ * commander, so packages never depend on a CLI framework. `args` contains only
59
+ * the flags explicitly passed on the command line (so config defaults apply
60
+ * otherwise); `context` carries the loaded config.
61
+ */
62
+ export interface ToolingCommand<Args extends Record<string, unknown> = Record<string, unknown>> {
63
+ /** The command name, eg. `config` or `generate`. */
64
+ name: string;
65
+ /** Human-readable description. */
66
+ description: string;
67
+ /** Positional arguments the command accepts. */
68
+ args?: ToolingArgument[];
69
+ /** Options the command accepts. */
70
+ options?: ToolingOption[];
71
+ /**
72
+ * Forward every operand (including unknown flags) to the command instead of
73
+ * parsing them. Used by provider passthrough commands (eg. `vite:dev`), which
74
+ * hand their raw argv to the wrapped binary. The raw operands arrive under
75
+ * the `args` key of the run argument (typed `string[]`).
76
+ */
77
+ passthrough?: boolean;
78
+ /** Run the command with the CLI-provided options + the loaded config. */
79
+ run: (args: Args, context: ToolingCommandContext) => Awaitable<void>;
80
+ }
81
+ /** A package.json-shaped object (loose; only the fields the tooling touches). */
82
+ export interface PackageJson {
83
+ name?: string;
84
+ version?: string;
85
+ private?: boolean;
86
+ type?: string;
87
+ description?: string;
88
+ scripts?: Record<string, string>;
89
+ dependencies?: Record<string, string>;
90
+ devDependencies?: Record<string, string>;
91
+ peerDependencies?: Record<string, string>;
92
+ optionalDependencies?: Record<string, string>;
93
+ workspaces?: string[] | {
94
+ packages?: string[];
95
+ };
96
+ exports?: Record<string, unknown> | string;
97
+ files?: string[];
98
+ [key: string]: unknown;
99
+ }
100
+ //#endregion
@@ -0,0 +1,17 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ //#region packages/shared/src/yaml.d.ts
4
+ /**
5
+ * A tiny, dependency-free YAML emitter for the subset GitHub Actions needs:
6
+ * nested maps, arrays (inline or block), booleans/numbers/null, and multi-line
7
+ * block scalars (`run: |`). It is intentionally conservative — string scalars
8
+ * that could be misread (booleans, numbers, `#`, `: `, `${{ }}`, ...) are
9
+ * double-quoted.
10
+ */
11
+ type YamlValue = string | number | boolean | null | YamlValue[] | {
12
+ [key: string]: YamlValue;
13
+ };
14
+ /** Serialize a value (expected to be a map) to a YAML document. */
15
+ export declare function toYaml(value: Record<string, YamlValue>): string;
16
+ //#endregion
17
+ export type { YamlValue };
@@ -0,0 +1,5 @@
1
+ import"node:path";import"node:url";import.meta.url;const e=/^(?:true|false|yes|no|on|off|null|~)$/i,t=/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?$/;function n(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function r(n){return!!(n===``||e.test(n)||t.test(n)||/^[\s\-?:,[\]{}#&*!|>%@`"']/.test(n)||/\s$/.test(n)||n.includes(`: `)||n.includes(` #`)||n.includes(` `)||n.includes("${{")||/["\\]/.test(n))}function i(e){return e===null?`null`:typeof e==`boolean`?e?`true`:`false`:typeof e==`number`?String(e):r(e)?`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`:e}function a(t){return r(t)&&!e.test(t)?`"${t}"`:t}function o(e){return e.reduce((e,t)=>e+String(s(t)).length+2,0)}function s(e){return e}function c(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function l(e,t){let r=` `.repeat(t),a=[];for(let o of e)if(c(o))a.push(`${r}- ${i(o)}`);else if(Array.isArray(o))a.push(`${r}-`),a.push(...l(o,t+2));else if(n(o)){let e=d(o,t+2),n=e[0];if(n===void 0)a.push(`${r}- {}`);else{a.push(`${r}- ${n.slice(t+2)}`);for(let t=1;t<e.length;t+=1)a.push(e[t])}}return a}function u(e,t,n,r){let i=e.endsWith(`
2
+ `)?e.slice(0,-1):e,a=[`${n}${r}: |`];for(let e of i.split(`
3
+ `))a.push(e===``?``:`${` `.repeat(t+2)}${e}`);return a}function d(e,t){let r=` `.repeat(t),f=[];for(let[p,m]of Object.entries(e)){if(m===void 0)continue;let e=a(p);typeof m==`string`&&m.includes(`
4
+ `)?f.push(...u(m,t,r,e)):c(m)?f.push(`${r}${e}: ${i(m)}`):Array.isArray(m)?m.length===0?f.push(`${r}${e}: []`):m.every(c)&&o(m)<=60?f.push(`${r}${e}: [${m.map(e=>i(s(e))).join(`, `)}]`):(f.push(`${r}${e}:`),f.push(...l(m,t+2))):n(m)&&(Object.keys(m).length===0?f.push(`${r}${e}: {}`):(f.push(`${r}${e}:`),f.push(...d(m,t+2))))}return f}function f(e){return`${d(e,0).join(`
5
+ `)}\n`}export{f as toYaml};
@@ -0,0 +1,10 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { Template } from "./types.js";
4
+ //#region packages/template/src/builtin.d.ts
5
+ /**
6
+ * The built-in, offline templates. They map onto the local generators in
7
+ * `@deltabox/toolchain-project`, so they need no files on disk or network.
8
+ */
9
+ export declare const BUILTIN_TEMPLATES: Template[];
10
+ //#endregion