@ykdz/template 0.0.22 → 0.0.24

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 (452) hide show
  1. package/dist/cli.js +4 -575
  2. package/dist/main.d.ts +1 -0
  3. package/dist/main.js +370 -0
  4. package/node_modules/@typescript/old/LICENSE.txt +55 -0
  5. package/node_modules/@typescript/old/README.md +50 -0
  6. package/node_modules/@typescript/old/SECURITY.md +39 -0
  7. package/node_modules/@typescript/old/ThirdPartyNoticeText.txt +193 -0
  8. package/node_modules/@typescript/old/bin/tsc +2 -0
  9. package/node_modules/@typescript/old/bin/tsserver +2 -0
  10. package/node_modules/@typescript/old/lib/_tsc.js +134465 -0
  11. package/node_modules/@typescript/old/lib/_tsserver.js +659 -0
  12. package/node_modules/@typescript/old/lib/_typingsInstaller.js +222 -0
  13. package/node_modules/@typescript/old/lib/cs/diagnosticMessages.generated.json +2129 -0
  14. package/node_modules/@typescript/old/lib/de/diagnosticMessages.generated.json +2125 -0
  15. package/node_modules/@typescript/old/lib/es/diagnosticMessages.generated.json +2129 -0
  16. package/node_modules/@typescript/old/lib/fr/diagnosticMessages.generated.json +2129 -0
  17. package/node_modules/@typescript/old/lib/it/diagnosticMessages.generated.json +2125 -0
  18. package/node_modules/@typescript/old/lib/ja/diagnosticMessages.generated.json +2129 -0
  19. package/node_modules/@typescript/old/lib/ko/diagnosticMessages.generated.json +2129 -0
  20. package/node_modules/@typescript/old/lib/lib.d.ts +20 -0
  21. package/node_modules/@typescript/old/lib/lib.decorators.d.ts +382 -0
  22. package/node_modules/@typescript/old/lib/lib.decorators.legacy.d.ts +20 -0
  23. package/node_modules/@typescript/old/lib/lib.dom.asynciterable.d.ts +18 -0
  24. package/node_modules/@typescript/old/lib/lib.dom.d.ts +45125 -0
  25. package/node_modules/@typescript/old/lib/lib.dom.iterable.d.ts +18 -0
  26. package/node_modules/@typescript/old/lib/lib.es2015.collection.d.ts +150 -0
  27. package/node_modules/@typescript/old/lib/lib.es2015.core.d.ts +595 -0
  28. package/node_modules/@typescript/old/lib/lib.es2015.d.ts +26 -0
  29. package/node_modules/@typescript/old/lib/lib.es2015.generator.d.ts +75 -0
  30. package/node_modules/@typescript/old/lib/lib.es2015.iterable.d.ts +603 -0
  31. package/node_modules/@typescript/old/lib/lib.es2015.promise.d.ts +79 -0
  32. package/node_modules/@typescript/old/lib/lib.es2015.proxy.d.ts +126 -0
  33. package/node_modules/@typescript/old/lib/lib.es2015.reflect.d.ts +142 -0
  34. package/node_modules/@typescript/old/lib/lib.es2015.symbol.d.ts +44 -0
  35. package/node_modules/@typescript/old/lib/lib.es2015.symbol.wellknown.d.ts +324 -0
  36. package/node_modules/@typescript/old/lib/lib.es2016.array.include.d.ts +114 -0
  37. package/node_modules/@typescript/old/lib/lib.es2016.d.ts +19 -0
  38. package/node_modules/@typescript/old/lib/lib.es2016.full.d.ts +21 -0
  39. package/node_modules/@typescript/old/lib/lib.es2016.intl.d.ts +29 -0
  40. package/node_modules/@typescript/old/lib/lib.es2017.arraybuffer.d.ts +19 -0
  41. package/node_modules/@typescript/old/lib/lib.es2017.d.ts +24 -0
  42. package/node_modules/@typescript/old/lib/lib.es2017.date.d.ts +29 -0
  43. package/node_modules/@typescript/old/lib/lib.es2017.full.d.ts +21 -0
  44. package/node_modules/@typescript/old/lib/lib.es2017.intl.d.ts +42 -0
  45. package/node_modules/@typescript/old/lib/lib.es2017.object.d.ts +47 -0
  46. package/node_modules/@typescript/old/lib/lib.es2017.sharedmemory.d.ts +133 -0
  47. package/node_modules/@typescript/old/lib/lib.es2017.string.d.ts +43 -0
  48. package/node_modules/@typescript/old/lib/lib.es2017.typedarrays.d.ts +51 -0
  49. package/node_modules/@typescript/old/lib/lib.es2018.asyncgenerator.d.ts +75 -0
  50. package/node_modules/@typescript/old/lib/lib.es2018.asynciterable.d.ts +51 -0
  51. package/node_modules/@typescript/old/lib/lib.es2018.d.ts +22 -0
  52. package/node_modules/@typescript/old/lib/lib.es2018.full.d.ts +22 -0
  53. package/node_modules/@typescript/old/lib/lib.es2018.intl.d.ts +81 -0
  54. package/node_modules/@typescript/old/lib/lib.es2018.promise.d.ts +28 -0
  55. package/node_modules/@typescript/old/lib/lib.es2018.regexp.d.ts +35 -0
  56. package/node_modules/@typescript/old/lib/lib.es2019.array.d.ts +77 -0
  57. package/node_modules/@typescript/old/lib/lib.es2019.d.ts +22 -0
  58. package/node_modules/@typescript/old/lib/lib.es2019.full.d.ts +22 -0
  59. package/node_modules/@typescript/old/lib/lib.es2019.intl.d.ts +21 -0
  60. package/node_modules/@typescript/old/lib/lib.es2019.object.d.ts +31 -0
  61. package/node_modules/@typescript/old/lib/lib.es2019.string.d.ts +35 -0
  62. package/node_modules/@typescript/old/lib/lib.es2019.symbol.d.ts +22 -0
  63. package/node_modules/@typescript/old/lib/lib.es2020.bigint.d.ts +763 -0
  64. package/node_modules/@typescript/old/lib/lib.es2020.d.ts +25 -0
  65. package/node_modules/@typescript/old/lib/lib.es2020.date.d.ts +40 -0
  66. package/node_modules/@typescript/old/lib/lib.es2020.full.d.ts +22 -0
  67. package/node_modules/@typescript/old/lib/lib.es2020.intl.d.ts +472 -0
  68. package/node_modules/@typescript/old/lib/lib.es2020.number.d.ts +26 -0
  69. package/node_modules/@typescript/old/lib/lib.es2020.promise.d.ts +45 -0
  70. package/node_modules/@typescript/old/lib/lib.es2020.sharedmemory.d.ts +97 -0
  71. package/node_modules/@typescript/old/lib/lib.es2020.string.d.ts +42 -0
  72. package/node_modules/@typescript/old/lib/lib.es2020.symbol.wellknown.d.ts +39 -0
  73. package/node_modules/@typescript/old/lib/lib.es2021.d.ts +21 -0
  74. package/node_modules/@typescript/old/lib/lib.es2021.full.d.ts +22 -0
  75. package/node_modules/@typescript/old/lib/lib.es2021.intl.d.ts +164 -0
  76. package/node_modules/@typescript/old/lib/lib.es2021.promise.d.ts +46 -0
  77. package/node_modules/@typescript/old/lib/lib.es2021.string.d.ts +31 -0
  78. package/node_modules/@typescript/old/lib/lib.es2021.weakref.d.ts +76 -0
  79. package/node_modules/@typescript/old/lib/lib.es2022.array.d.ts +119 -0
  80. package/node_modules/@typescript/old/lib/lib.es2022.d.ts +23 -0
  81. package/node_modules/@typescript/old/lib/lib.es2022.error.d.ts +73 -0
  82. package/node_modules/@typescript/old/lib/lib.es2022.full.d.ts +22 -0
  83. package/node_modules/@typescript/old/lib/lib.es2022.intl.d.ts +143 -0
  84. package/node_modules/@typescript/old/lib/lib.es2022.object.d.ts +24 -0
  85. package/node_modules/@typescript/old/lib/lib.es2022.regexp.d.ts +37 -0
  86. package/node_modules/@typescript/old/lib/lib.es2022.string.d.ts +23 -0
  87. package/node_modules/@typescript/old/lib/lib.es2023.array.d.ts +922 -0
  88. package/node_modules/@typescript/old/lib/lib.es2023.collection.d.ts +19 -0
  89. package/node_modules/@typescript/old/lib/lib.es2023.d.ts +20 -0
  90. package/node_modules/@typescript/old/lib/lib.es2023.full.d.ts +22 -0
  91. package/node_modules/@typescript/old/lib/lib.es2023.intl.d.ts +62 -0
  92. package/node_modules/@typescript/old/lib/lib.es2024.arraybuffer.d.ts +63 -0
  93. package/node_modules/@typescript/old/lib/lib.es2024.collection.d.ts +27 -0
  94. package/node_modules/@typescript/old/lib/lib.es2024.d.ts +24 -0
  95. package/node_modules/@typescript/old/lib/lib.es2024.full.d.ts +22 -0
  96. package/node_modules/@typescript/old/lib/lib.es2024.object.d.ts +27 -0
  97. package/node_modules/@typescript/old/lib/lib.es2024.promise.d.ts +33 -0
  98. package/node_modules/@typescript/old/lib/lib.es2024.regexp.d.ts +23 -0
  99. package/node_modules/@typescript/old/lib/lib.es2024.sharedmemory.d.ts +66 -0
  100. package/node_modules/@typescript/old/lib/lib.es2024.string.d.ts +27 -0
  101. package/node_modules/@typescript/old/lib/lib.es2025.collection.d.ts +94 -0
  102. package/node_modules/@typescript/old/lib/lib.es2025.d.ts +23 -0
  103. package/node_modules/@typescript/old/lib/lib.es2025.float16.d.ts +443 -0
  104. package/node_modules/@typescript/old/lib/lib.es2025.full.d.ts +22 -0
  105. package/node_modules/@typescript/old/lib/lib.es2025.intl.d.ts +200 -0
  106. package/node_modules/@typescript/old/lib/lib.es2025.iterator.d.ts +146 -0
  107. package/node_modules/@typescript/old/lib/lib.es2025.promise.d.ts +32 -0
  108. package/node_modules/@typescript/old/lib/lib.es2025.regexp.d.ts +30 -0
  109. package/node_modules/@typescript/old/lib/lib.es5.d.ts +4599 -0
  110. package/node_modules/@typescript/old/lib/lib.es6.d.ts +21 -0
  111. package/node_modules/@typescript/old/lib/lib.esnext.array.d.ts +33 -0
  112. package/node_modules/@typescript/old/lib/lib.esnext.collection.d.ts +47 -0
  113. package/node_modules/@typescript/old/lib/lib.esnext.d.ts +27 -0
  114. package/node_modules/@typescript/old/lib/lib.esnext.date.d.ts +21 -0
  115. package/node_modules/@typescript/old/lib/lib.esnext.decorators.d.ts +26 -0
  116. package/node_modules/@typescript/old/lib/lib.esnext.disposable.d.ts +191 -0
  117. package/node_modules/@typescript/old/lib/lib.esnext.error.d.ts +22 -0
  118. package/node_modules/@typescript/old/lib/lib.esnext.full.d.ts +22 -0
  119. package/node_modules/@typescript/old/lib/lib.esnext.intl.d.ts +107 -0
  120. package/node_modules/@typescript/old/lib/lib.esnext.sharedmemory.d.ts +23 -0
  121. package/node_modules/@typescript/old/lib/lib.esnext.temporal.d.ts +485 -0
  122. package/node_modules/@typescript/old/lib/lib.esnext.typedarrays.d.ts +90 -0
  123. package/node_modules/@typescript/old/lib/lib.scripthost.d.ts +320 -0
  124. package/node_modules/@typescript/old/lib/lib.webworker.asynciterable.d.ts +18 -0
  125. package/node_modules/@typescript/old/lib/lib.webworker.d.ts +15606 -0
  126. package/node_modules/@typescript/old/lib/lib.webworker.importscripts.d.ts +21 -0
  127. package/node_modules/@typescript/old/lib/lib.webworker.iterable.d.ts +18 -0
  128. package/node_modules/@typescript/old/lib/pl/diagnosticMessages.generated.json +2129 -0
  129. package/node_modules/@typescript/old/lib/pt-br/diagnosticMessages.generated.json +2129 -0
  130. package/node_modules/@typescript/old/lib/ru/diagnosticMessages.generated.json +2125 -0
  131. package/node_modules/@typescript/old/lib/tr/diagnosticMessages.generated.json +2129 -0
  132. package/node_modules/@typescript/old/lib/tsc.js +8 -0
  133. package/node_modules/@typescript/old/lib/tsserver.js +8 -0
  134. package/node_modules/@typescript/old/lib/tsserverlibrary.d.ts +17 -0
  135. package/node_modules/@typescript/old/lib/tsserverlibrary.js +21 -0
  136. package/node_modules/@typescript/old/lib/typesMap.json +497 -0
  137. package/node_modules/@typescript/old/lib/typescript.d.ts +11448 -0
  138. package/node_modules/@typescript/old/lib/typescript.js +201039 -0
  139. package/node_modules/@typescript/old/lib/typingsInstaller.js +8 -0
  140. package/node_modules/@typescript/old/lib/watchGuard.js +53 -0
  141. package/node_modules/@typescript/old/lib/zh-cn/diagnosticMessages.generated.json +2129 -0
  142. package/node_modules/@typescript/old/lib/zh-tw/diagnosticMessages.generated.json +2125 -0
  143. package/node_modules/@typescript/old/package.json +118 -0
  144. package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.d.ts +85 -0
  145. package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.js +797 -0
  146. package/node_modules/@ykdz/template-builtin-presets/dist/src/index.d.ts +3 -0
  147. package/node_modules/@ykdz/template-builtin-presets/dist/src/index.js +2 -0
  148. package/node_modules/@ykdz/template-builtin-presets/dist/src/rust-bin/definition.d.ts +2 -0
  149. package/node_modules/@ykdz/template-builtin-presets/dist/src/rust-bin/definition.js +134 -0
  150. package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.d.ts +36 -0
  151. package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.js +106 -0
  152. package/node_modules/@ykdz/template-builtin-presets/dist/src/template-sources.d.ts +14 -0
  153. package/node_modules/@ykdz/template-builtin-presets/dist/src/template-sources.js +26 -0
  154. package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-lib/definition.d.ts +2 -0
  155. package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-lib/definition.js +138 -0
  156. package/node_modules/@ykdz/template-builtin-presets/dist/src/vike-app/definition.d.ts +2 -0
  157. package/node_modules/@ykdz/template-builtin-presets/dist/src/vike-app/definition.js +408 -0
  158. package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-app/definition.d.ts +2 -0
  159. package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-app/definition.js +94 -0
  160. package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-hono-app/definition.d.ts +2 -0
  161. package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-hono-app/definition.js +179 -0
  162. package/node_modules/@ykdz/template-builtin-presets/package.json +67 -0
  163. package/node_modules/@ykdz/{template-builtin-source/templates/vue-app/.github/dependabot.yml → template-builtin-presets/templates/foundation/.github/dependabot-rust.yml} +13 -0
  164. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/dependabot.dynamic.template +4 -0
  165. package/node_modules/@ykdz/{template-builtin-source/templates/ts-lib → template-builtin-presets/templates/foundation}/.github/dependabot.yml +5 -0
  166. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check.dynamic.template +19 -0
  167. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.pnpmfile.cts +14 -0
  168. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/TODO.md.template +5 -0
  169. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/devcontainer.json +16 -0
  170. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/gitignore +8 -0
  171. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/pnpm-workspace.dynamic.txt +23 -0
  172. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/pnpm-workspace.yaml +29 -0
  173. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/rust/.vscode/extensions.json +3 -0
  174. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/rust/.vscode/settings.json +5 -0
  175. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/rust/devcontainer/devcontainer.json +21 -0
  176. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/tsconfig.json +4 -0
  177. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/turbo.json +18 -0
  178. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/rust-bin/.github/dependabot.yml +5 -0
  179. package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/.github/workflows/check.yml +23 -0
  180. package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/.vscode/extensions.json +3 -0
  181. package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/.vscode/settings.json +5 -0
  182. package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/Cargo.lock +16 -0
  183. package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/Cargo.toml +27 -0
  184. package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/devcontainer/devcontainer.json +21 -0
  185. package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/devcontainer/rust.Dockerfile +16 -0
  186. package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/rust-toolchain.toml +3 -0
  187. package/node_modules/@ykdz/template-builtin-presets/templates/shared/devcontainer/node-pnpm.Dockerfile +12 -0
  188. package/node_modules/@ykdz/template-builtin-presets/templates/shared/devcontainer/shellcheck.Dockerfile +3 -0
  189. package/node_modules/@ykdz/template-builtin-presets/templates/shared/editor-customization/capabilities.json +38 -0
  190. package/node_modules/@ykdz/template-builtin-presets/templates/shared/oxc/node/oxlint.config.ts +6 -0
  191. package/node_modules/@ykdz/template-builtin-presets/templates/shared/oxc/oxfmt.config.ts +3 -0
  192. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/shared/oxc/tsconfig.config.json +2 -2
  193. package/node_modules/@ykdz/template-builtin-presets/templates/shared/vue/tsconfig.app.json +25 -0
  194. package/node_modules/@ykdz/template-builtin-presets/templates/shared/vue/tsconfig.json +8 -0
  195. package/node_modules/@ykdz/template-builtin-presets/templates/shared/vue/tsconfig.node.json +30 -0
  196. package/node_modules/@ykdz/template-builtin-presets/templates/shared/vue/tsconfig.test.json +9 -0
  197. package/node_modules/@ykdz/template-builtin-presets/templates/shared/vue/typescript/run-vue-tsc.ts +12 -0
  198. package/node_modules/@ykdz/{template-builtin-source/templates/vue-hono-app → template-builtin-presets/templates/ts-lib}/.github/dependabot.yml +5 -0
  199. package/node_modules/@ykdz/template-builtin-presets/templates/ts-lib/.github/workflows/check.yml +19 -0
  200. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/ts-lib/src/index.ts +1 -3
  201. package/node_modules/@ykdz/template-builtin-presets/templates/ts-lib/tsconfig.json +13 -0
  202. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/src/readiness.ts +2 -2
  203. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/src/types.d.ts +1 -0
  204. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/tsconfig.json +26 -0
  205. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db-migrations/drizzle.config.ts +17 -0
  206. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db-migrations/scripts/prepare-database.ts +45 -0
  207. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db-migrations/tsconfig.json +22 -0
  208. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db-migrations/turbo.json +10 -0
  209. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/Dockerfile +74 -0
  210. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/pages/index/+Page.telefunc.ts +1 -4
  211. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/pages/index/+Page.vue +2 -1
  212. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/playwright.config.ts +79 -0
  213. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/scripts/check-standalone-deployment.ts +511 -0
  214. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/scripts/container-entrypoint.sh +33 -0
  215. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/scripts/run-playwright.ts +151 -0
  216. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/test/e2e/app.spec.ts +3 -1
  217. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/tsconfig.app.json +34 -0
  218. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/tsconfig.json +9 -0
  219. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/tsconfig.node.json +31 -0
  220. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/tsconfig.test.json +11 -0
  221. package/node_modules/@ykdz/{template-builtin-source/templates/vue-app → template-builtin-presets/templates/vike-app/web}/turbo.json +1 -0
  222. package/node_modules/@ykdz/{template-builtin-source/templates/vike-app → template-builtin-presets/templates/vue-app}/.github/dependabot.yml +5 -4
  223. package/node_modules/@ykdz/{template-builtin-source/templates/vue-hono-app/web → template-builtin-presets/templates/vue-app}/turbo.json +2 -1
  224. package/node_modules/@ykdz/template-builtin-presets/templates/vue-app/typescript/tsconfig.json +8 -0
  225. package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/api/src/index.ts +3 -0
  226. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/api/src/server.ts +1 -1
  227. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/api/test/app.test.ts +1 -1
  228. package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/api/tsconfig.build.json +9 -0
  229. package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/api/tsconfig.json +25 -0
  230. package/node_modules/@ykdz/template-core/dist/Cargo.toml +1 -1
  231. package/node_modules/@ykdz/template-core/dist/dependency-catalog.d.ts +9 -0
  232. package/node_modules/@ykdz/template-core/dist/dependency-catalog.js +56 -1
  233. package/node_modules/@ykdz/template-core/dist/devcontainer.d.ts +11 -3
  234. package/node_modules/@ykdz/template-core/dist/devcontainer.js +17 -3
  235. package/node_modules/@ykdz/template-core/dist/editor-customization.d.ts +5 -9
  236. package/node_modules/@ykdz/template-core/dist/editor-customization.js +8 -46
  237. package/node_modules/@ykdz/template-core/dist/module-graph.d.ts +43 -2
  238. package/node_modules/@ykdz/template-core/dist/module-graph.js +58 -0
  239. package/node_modules/@ykdz/template-core/dist/package-contribution.d.ts +43 -0
  240. package/node_modules/@ykdz/template-core/dist/package-contribution.js +24 -0
  241. package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +28 -9
  242. package/node_modules/@ykdz/template-core/dist/preset-definition.d.ts +42 -0
  243. package/node_modules/@ykdz/template-core/dist/preset-definition.js +1 -0
  244. package/node_modules/@ykdz/template-core/dist/project-blueprint-v2.d.ts +33 -0
  245. package/node_modules/@ykdz/template-core/dist/project-blueprint-v2.js +161 -0
  246. package/node_modules/@ykdz/template-core/dist/project-github.d.ts +8 -9
  247. package/node_modules/@ykdz/template-core/dist/project-github.js +94 -9
  248. package/node_modules/@ykdz/template-core/dist/project-linking-v2.d.ts +20 -0
  249. package/node_modules/@ykdz/template-core/dist/project-linking-v2.js +37 -0
  250. package/node_modules/@ykdz/template-core/dist/renderer.d.ts +40 -5
  251. package/node_modules/@ykdz/template-core/dist/renderer.js +114 -29
  252. package/node_modules/@ykdz/template-core/dist/template-boundary-check.d.ts +21 -15
  253. package/node_modules/@ykdz/template-core/dist/template-boundary-check.js +99 -49
  254. package/node_modules/@ykdz/template-core/dist/toolchain-baseline-update.d.ts +45 -0
  255. package/node_modules/@ykdz/template-core/dist/toolchain-baseline-update.js +27 -0
  256. package/node_modules/@ykdz/template-core/dist/toolchain-resolution.d.ts +1 -0
  257. package/node_modules/@ykdz/template-core/dist/toolchain-resolution.js +50 -52
  258. package/node_modules/@ykdz/template-core/package.json +9 -6
  259. package/node_modules/semver/LICENSE +15 -0
  260. package/node_modules/semver/README.md +680 -0
  261. package/node_modules/semver/bin/semver.js +195 -0
  262. package/node_modules/semver/classes/comparator.js +143 -0
  263. package/node_modules/semver/classes/index.js +7 -0
  264. package/node_modules/semver/classes/range.js +577 -0
  265. package/node_modules/semver/classes/semver.js +350 -0
  266. package/node_modules/semver/functions/clean.js +8 -0
  267. package/node_modules/semver/functions/cmp.js +54 -0
  268. package/node_modules/semver/functions/coerce.js +62 -0
  269. package/node_modules/semver/functions/compare-build.js +9 -0
  270. package/node_modules/semver/functions/compare-loose.js +5 -0
  271. package/node_modules/semver/functions/compare.js +7 -0
  272. package/node_modules/semver/functions/diff.js +60 -0
  273. package/node_modules/semver/functions/eq.js +5 -0
  274. package/node_modules/semver/functions/gt.js +5 -0
  275. package/node_modules/semver/functions/gte.js +5 -0
  276. package/node_modules/semver/functions/inc.js +21 -0
  277. package/node_modules/semver/functions/lt.js +5 -0
  278. package/node_modules/semver/functions/lte.js +5 -0
  279. package/node_modules/semver/functions/major.js +5 -0
  280. package/node_modules/semver/functions/minor.js +5 -0
  281. package/node_modules/semver/functions/neq.js +5 -0
  282. package/node_modules/semver/functions/parse.js +18 -0
  283. package/node_modules/semver/functions/patch.js +5 -0
  284. package/node_modules/semver/functions/prerelease.js +8 -0
  285. package/node_modules/semver/functions/rcompare.js +5 -0
  286. package/node_modules/semver/functions/rsort.js +5 -0
  287. package/node_modules/semver/functions/satisfies.js +12 -0
  288. package/node_modules/semver/functions/sort.js +5 -0
  289. package/node_modules/semver/functions/truncate.js +48 -0
  290. package/node_modules/semver/functions/valid.js +8 -0
  291. package/node_modules/semver/index.js +93 -0
  292. package/node_modules/semver/internal/constants.js +37 -0
  293. package/node_modules/semver/internal/debug.js +11 -0
  294. package/node_modules/semver/internal/identifiers.js +29 -0
  295. package/node_modules/semver/internal/lrucache.js +42 -0
  296. package/node_modules/semver/internal/parse-options.js +17 -0
  297. package/node_modules/semver/internal/re.js +223 -0
  298. package/node_modules/semver/package.json +78 -0
  299. package/node_modules/semver/preload.js +4 -0
  300. package/node_modules/semver/range.bnf +17 -0
  301. package/node_modules/semver/ranges/gtr.js +6 -0
  302. package/node_modules/semver/ranges/intersects.js +9 -0
  303. package/node_modules/semver/ranges/ltr.js +6 -0
  304. package/node_modules/semver/ranges/max-satisfying.js +27 -0
  305. package/node_modules/semver/ranges/min-satisfying.js +26 -0
  306. package/node_modules/semver/ranges/min-version.js +63 -0
  307. package/node_modules/semver/ranges/outside.js +82 -0
  308. package/node_modules/semver/ranges/simplify.js +49 -0
  309. package/node_modules/semver/ranges/subset.js +249 -0
  310. package/node_modules/semver/ranges/to-comparators.js +10 -0
  311. package/node_modules/semver/ranges/valid.js +13 -0
  312. package/node_modules/typescript/LICENSE.txt +55 -0
  313. package/node_modules/typescript/README.md +9 -0
  314. package/node_modules/typescript/bin/tsc6 +2 -0
  315. package/node_modules/typescript/lib/tsc.js +1 -0
  316. package/node_modules/typescript/lib/tsserverlibrary.d.ts +2 -0
  317. package/node_modules/typescript/lib/tsserverlibrary.js +1 -0
  318. package/node_modules/typescript/lib/typescript.d.ts +2 -0
  319. package/node_modules/typescript/lib/typescript.js +1 -0
  320. package/node_modules/typescript/package.json +39 -0
  321. package/node_modules/valibot/LICENSE.md +9 -0
  322. package/node_modules/valibot/README.md +94 -0
  323. package/node_modules/valibot/dist/index.cjs +7974 -0
  324. package/node_modules/valibot/dist/index.d.cts +16184 -0
  325. package/node_modules/valibot/dist/index.d.mts +16184 -0
  326. package/node_modules/valibot/dist/index.min.cjs +2 -0
  327. package/node_modules/valibot/dist/index.min.mjs +2 -0
  328. package/node_modules/valibot/dist/index.mjs +7663 -0
  329. package/node_modules/valibot/package.json +79 -0
  330. package/package.json +20 -13
  331. package/LICENSE +0 -21
  332. package/node_modules/@ykdz/template-builtin-source/dist/src/index.d.ts +0 -22
  333. package/node_modules/@ykdz/template-builtin-source/dist/src/index.js +0 -103
  334. package/node_modules/@ykdz/template-builtin-source/dist/templates/projection-plans.d.ts +0 -7
  335. package/node_modules/@ykdz/template-builtin-source/dist/templates/projection-plans.js +0 -98
  336. package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.d.ts +0 -2
  337. package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.js +0 -15
  338. package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.d.ts +0 -9
  339. package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.js +0 -105
  340. package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.d.ts +0 -6
  341. package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.js +0 -197
  342. package/node_modules/@ykdz/template-builtin-source/dist/templates/vike-app/projection.d.ts +0 -5
  343. package/node_modules/@ykdz/template-builtin-source/dist/templates/vike-app/projection.js +0 -71
  344. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.d.ts +0 -6
  345. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.js +0 -281
  346. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.d.ts +0 -8
  347. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js +0 -154
  348. package/node_modules/@ykdz/template-builtin-source/package.json +0 -93
  349. package/node_modules/@ykdz/template-builtin-source/templates/preset-source.json +0 -517
  350. package/node_modules/@ykdz/template-builtin-source/templates/shared/devcontainer/node-pnpm.Dockerfile +0 -6
  351. package/node_modules/@ykdz/template-builtin-source/templates/shared/editor-customization/capabilities.json +0 -56
  352. package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/node/oxlint.config.ts +0 -34
  353. package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/oxfmt.config.ts +0 -8
  354. package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/vue/oxlint.config.ts +0 -36
  355. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/.github/workflows/check.yml +0 -28
  356. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/db/drizzle.config.ts +0 -10
  357. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/web/Dockerfile +0 -47
  358. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/web/playwright.config.ts +0 -43
  359. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/web/scripts/run-playwright.ts +0 -81
  360. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/api/src/index.ts +0 -3
  361. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/main.ts +0 -8
  362. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/stores/counter.ts +0 -12
  363. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/style.css +0 -1
  364. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/test/app.test.ts +0 -14
  365. package/node_modules/@ykdz/template-core/dist/declarations.d.ts +0 -2
  366. package/node_modules/@ykdz/template-core/dist/declarations.js +0 -1
  367. package/node_modules/@ykdz/template-core/dist/generated-scenarios.d.ts +0 -75
  368. package/node_modules/@ykdz/template-core/dist/generated-scenarios.js +0 -572
  369. package/node_modules/@ykdz/template-core/dist/generation-context.d.ts +0 -23
  370. package/node_modules/@ykdz/template-core/dist/generation-context.js +0 -20
  371. package/node_modules/@ykdz/template-core/dist/next-step-instructions.d.ts +0 -30
  372. package/node_modules/@ykdz/template-core/dist/next-step-instructions.js +0 -181
  373. package/node_modules/@ykdz/template-core/dist/package-addition-support.d.ts +0 -6
  374. package/node_modules/@ykdz/template-core/dist/package-addition-support.js +0 -2
  375. package/node_modules/@ykdz/template-core/dist/package-addition.d.ts +0 -12
  376. package/node_modules/@ykdz/template-core/dist/package-addition.js +0 -665
  377. package/node_modules/@ykdz/template-core/dist/package-linking.d.ts +0 -75
  378. package/node_modules/@ykdz/template-core/dist/package-linking.js +0 -157
  379. package/node_modules/@ykdz/template-core/dist/preset-projection.d.ts +0 -69
  380. package/node_modules/@ykdz/template-core/dist/preset-projection.js +0 -8
  381. package/node_modules/@ykdz/template-core/dist/preset-source.d.ts +0 -14
  382. package/node_modules/@ykdz/template-core/dist/preset-source.js +0 -294
  383. package/node_modules/@ykdz/template-core/dist/projection-capabilities.d.ts +0 -31
  384. package/node_modules/@ykdz/template-core/dist/projection-capabilities.js +0 -2168
  385. package/node_modules/@ykdz/template-core/dist/runtime-paths.d.ts +0 -1
  386. package/node_modules/@ykdz/template-core/dist/runtime-paths.js +0 -13
  387. package/node_modules/@ykdz/template-shared/dist/index.d.ts +0 -645
  388. package/node_modules/@ykdz/template-shared/dist/index.js +0 -1408
  389. package/node_modules/@ykdz/template-shared/package.json +0 -36
  390. package/node_modules/@ykdz/{template-builtin-source/templates/vue-app/.github/workflows/check.yml → template-builtin-presets/templates/foundation/.github/workflows/check-playwright.yml} +0 -0
  391. package/node_modules/@ykdz/{template-builtin-source/templates/rust-bin/.github/workflows/check.yml → template-builtin-presets/templates/foundation/.github/workflows/check-rust.yml} +0 -0
  392. package/node_modules/@ykdz/{template-builtin-source/templates/ts-lib → template-builtin-presets/templates/foundation}/.github/workflows/check.yml +0 -0
  393. package/node_modules/@ykdz/{template-builtin-source/templates/shared → template-builtin-presets/templates/foundation/rust}/devcontainer/rust.Dockerfile +0 -0
  394. package/node_modules/@ykdz/{template-builtin-source/templates/rust-bin → template-builtin-presets/templates/foundation/rust}/rust-toolchain.toml +0 -0
  395. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/rust-bin/rustfmt.toml +0 -0
  396. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/rust-bin/src/main.rs +0 -0
  397. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/rust-bin/turbo.json +0 -0
  398. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/shared/devcontainer/browser-test.Dockerfile +0 -0
  399. package/node_modules/@ykdz/{template-builtin-source/templates/vue-app → template-builtin-presets/templates/shared/vue}/src/main.ts +0 -0
  400. package/node_modules/@ykdz/{template-builtin-source/templates/vue-app → template-builtin-presets/templates/shared/vue}/src/stores/counter.ts +0 -0
  401. package/node_modules/@ykdz/{template-builtin-source/templates/vue-app → template-builtin-presets/templates/shared/vue}/src/style.css +0 -0
  402. package/node_modules/@ykdz/{template-builtin-source/templates/vue-app → template-builtin-presets/templates/shared/vue}/test/app.test.ts +0 -0
  403. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/ts-lib/src/name-schema.ts +0 -0
  404. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/ts-lib/turbo.json +0 -0
  405. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/scripts/seed-example.ts +0 -0
  406. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/src/db.ts +0 -0
  407. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/src/index.ts +0 -0
  408. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/src/queries/todos.ts +0 -0
  409. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/src/schema.ts +0 -0
  410. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/src/seed/example.ts +0 -0
  411. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/test/todos.test.ts +0 -0
  412. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/turbo.json +0 -0
  413. package/node_modules/@ykdz/{template-builtin-source/templates/vike-app/db → template-builtin-presets/templates/vike-app/db-migrations}/drizzle/migrations/20260709120325_old_captain_flint/migration.sql +0 -0
  414. package/node_modules/@ykdz/{template-builtin-source/templates/vike-app/db → template-builtin-presets/templates/vike-app/db-migrations}/drizzle/migrations/20260709120325_old_captain_flint/snapshot.json +0 -0
  415. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/+server.ts +0 -0
  416. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/.env.example +0 -0
  417. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/Dockerfile.dockerignore +0 -0
  418. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/assets/logo.svg +0 -0
  419. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/components/CounterButton.vue +0 -0
  420. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/components/PageShell.vue +0 -0
  421. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/pages/+Head.vue +0 -0
  422. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/pages/+Layout.vue +0 -0
  423. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/pages/+config.ts +0 -0
  424. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/pages/tailwind.css +0 -0
  425. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/server/api.ts +0 -0
  426. package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/server/app.ts +1 -1
  427. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/types/env.d.ts +0 -0
  428. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/types/global.d.ts +0 -0
  429. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/vite.config.ts +0 -0
  430. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/vitest.config.ts +0 -0
  431. /package/node_modules/@ykdz/{template-builtin-source/templates/vue-hono-app → template-builtin-presets/templates/vue-app}/.github/workflows/check.yml +0 -0
  432. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/env.d.ts +0 -0
  433. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/index.html +0 -0
  434. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/playwright.config.ts +0 -0
  435. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/scripts/run-playwright.ts +0 -0
  436. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/src/App.vue +0 -0
  437. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/test/e2e/app.spec.ts +0 -0
  438. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/vite.config.ts +0 -0
  439. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/vitest.config.ts +0 -0
  440. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/api/src/runtime.ts +0 -0
  441. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/api/turbo.json +0 -0
  442. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/api/vitest.config.ts +0 -0
  443. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/env.d.ts +0 -0
  444. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/index.html +0 -0
  445. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/playwright.config.ts +0 -0
  446. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/scripts/run-playwright.ts +0 -0
  447. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/src/App.vue +0 -0
  448. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/src/api.ts +0 -0
  449. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/test/e2e/app.spec.ts +0 -0
  450. /package/node_modules/@ykdz/{template-builtin-source/templates/vike-app → template-builtin-presets/templates/vue-hono-app}/web/turbo.json +0 -0
  451. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/vite.config.ts +0 -0
  452. /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/vitest.config.ts +0 -0
@@ -1,2168 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import path from "node:path";
3
- import { normalizePresetProjectionDeclaration, projectionCapabilityIssues, validatePresetProjectionDeclaration as validateProjectionCapabilities, } from "@ykdz/template-shared";
4
- import { collectGeneratedManifestCatalogDependencies, collectGeneratedManifestCatalogReferences, renderCargoLockForPackage, renderGeneratedPnpmWorkspaceYaml, renderCargoDependencyTomlEntries, } from "./dependency-catalog.js";
5
- import { browserTestToolLayer, checkedDockerfileFirstNodePnpmDevcontainer, dockerfileFirstRustPnpmDevcontainer, nodePnpmToolLayer, rustToolLayer, } from "./devcontainer.js";
6
- import { editorCustomizationForCapabilities, loadEditorCustomizationDeclarations, } from "./editor-customization.js";
7
- import { playwrightBrowserAssetsEnvironmentNeed, renderCheckLeafCommand, renderFixCommand, renderFixLeafCommand, renderRootCheckCommand, renderTurboRunCommand, } from "./module-graph.js";
8
- import { packageManifestExposureFields, packageTurboConfig, planPackageLinks, } from "./package-linking.js";
9
- export { normalizePresetProjectionDeclaration, projectionCapabilityIssues, validateProjectionCapabilities, };
10
- const strictTypescriptRootBoundary = {
11
- kind: "workspace-orchestration",
12
- path: ".",
13
- };
14
- const workspacePackageBoundary = {
15
- kind: "package-boundary",
16
- path: ".",
17
- };
18
- const requiredPlanCapabilityProviders = [
19
- {
20
- flag: "rootCheck",
21
- kind: "strict-typescript-root",
22
- label: "root check command",
23
- },
24
- {
25
- flag: "fixCommand",
26
- kind: "oxc-format-lint",
27
- label: "fix command",
28
- },
29
- {
30
- flag: "githubActions",
31
- kind: "github-maintenance",
32
- label: "GitHub Actions maintenance",
33
- },
34
- {
35
- flag: "dependabot",
36
- kind: "github-maintenance",
37
- label: "Dependabot maintenance",
38
- },
39
- {
40
- flag: "devcontainer",
41
- kind: "node-pnpm-devcontainer",
42
- label: "development container support",
43
- },
44
- ];
45
- const dependencyMaintenanceEcosystems = ["npm", "github-actions", "docker"];
46
- function strictTypeScriptCompilerOptions(options) {
47
- return {
48
- ...options,
49
- erasableSyntaxOnly: true,
50
- exactOptionalPropertyTypes: true,
51
- forceConsistentCasingInFileNames: true,
52
- isolatedModules: true,
53
- noEmitOnError: true,
54
- noFallthroughCasesInSwitch: true,
55
- noImplicitOverride: true,
56
- noImplicitReturns: true,
57
- noUncheckedIndexedAccess: true,
58
- skipLibCheck: false,
59
- strict: true,
60
- target: "es2023",
61
- verbatimModuleSyntax: true,
62
- };
63
- }
64
- const capabilityInterpreters = {
65
- "workspace-library-package": {
66
- kind: "workspace-library-package",
67
- contribute({ capability, state }) {
68
- state.package = capability;
69
- state.sourceRoot = templateSourceRoot(state, capability.packageSourcePreset);
70
- state.packageDependencies.add("valibot");
71
- state.operationFactories.push(workspaceLibraryPackageOperations);
72
- },
73
- },
74
- "workspace-node-packages": {
75
- kind: "workspace-node-packages",
76
- contribute({ capability, state }) {
77
- state.nodeWorkspace = capability;
78
- state.sourceRoot = templateSourceRootForPreset(state, sourceRootPreset(capability));
79
- state.operationFactories.push(workspaceNodePackagesOperations);
80
- if (hasVikePackage(capability)) {
81
- state.dependencyMaintenanceExtraDirectories.docker = ["/apps/web"];
82
- state.ciDockerImageBuild = {
83
- dockerfile: "apps/web/Dockerfile",
84
- targets: [
85
- { name: "runtime", tag: "vike-app:check" },
86
- {
87
- name: "database-preparation",
88
- tag: "vike-app-db-prepare:check",
89
- },
90
- ],
91
- };
92
- }
93
- if (capability.packages.length > 1) {
94
- state.rootScriptFragments.dev = "turbo run dev --parallel";
95
- }
96
- const vuePackage = findVuePackage(capability);
97
- if (vuePackage !== undefined) {
98
- state.rootCheckEnvironmentNeeds.push(playwrightBrowserAssetsEnvironmentNeed({
99
- browser: "chromium",
100
- owner: { kind: "package-boundary", path: vuePackage.path },
101
- }));
102
- state.editorCustomizationCapabilities.push("vue", "tailwind");
103
- }
104
- state.editorCustomizationCapabilities.push("vitest");
105
- },
106
- },
107
- "rust-binary-workspace": {
108
- kind: "rust-binary-workspace",
109
- contribute({ capability, state }) {
110
- state.rustWorkspace = capability;
111
- state.sourceRoot = templateSourceRootForPreset(state, "rust-bin");
112
- setDevelopmentContainerResource(state, capability.devcontainerResourceId, "rust-binary-workspace");
113
- setEditorCustomizationResource(state, capability.editorCustomizationResourceId, "rust-binary-workspace");
114
- state.rootCheckComponents.push({
115
- kind: "turbo-package-check",
116
- owner: workspaceGlobBoundary(capability.workspacePackageGlob),
117
- });
118
- state.rootFixComponents.push({
119
- kind: "turbo-package-fix",
120
- owner: workspaceGlobBoundary(capability.workspacePackageGlob),
121
- });
122
- state.packageCheckComponents.push({ kind: "rustfmt-check", owner: workspacePackageBoundary }, { kind: "cargo-clippy", owner: workspacePackageBoundary }, { kind: "cargo-test", owner: workspacePackageBoundary });
123
- state.packageFixComponents.push({
124
- kind: "rustfmt-write",
125
- owner: workspacePackageBoundary,
126
- });
127
- state.dependencyMaintenanceEcosystems.push("npm", "cargo", "github-actions", "docker", "rust-toolchain");
128
- state.editorCustomizationCapabilities.push("rust-tooling");
129
- state.flags.rootCheck = true;
130
- state.flags.fixCommand = true;
131
- state.flags.githubActions = true;
132
- state.flags.dependabot = true;
133
- state.flags.devcontainer = true;
134
- state.operationFactories.push(rustBinaryWorkspaceOperations);
135
- },
136
- },
137
- "strict-typescript-root": {
138
- kind: "strict-typescript-root",
139
- contribute({ state }) {
140
- state.rootCheckComponents.push({
141
- kind: "typescript-typecheck",
142
- owner: strictTypescriptRootBoundary,
143
- });
144
- const workspaceBoundary = workspaceBoundaryForState(state);
145
- state.rootCheckComponents.push({
146
- kind: "turbo-package-check",
147
- owner: workspaceBoundary,
148
- });
149
- state.packageCheckComponents.push({
150
- kind: "typescript-typecheck",
151
- owner: workspacePackageBoundary,
152
- });
153
- state.rootScriptFragments.typecheck =
154
- "tsc -p tsconfig.config.json --noEmit --pretty false";
155
- state.packageScriptFragments.typecheck =
156
- "tsc -p tsconfig.json --noEmit --pretty false";
157
- state.rootDevDependencies.add("typescript");
158
- state.packageDevDependencies.add("@types/node");
159
- state.packageDevDependencies.add("typescript");
160
- state.flags.rootCheck = true;
161
- state.operationFactories.push(strictTypescriptOperations);
162
- },
163
- },
164
- "oxc-format-lint": {
165
- kind: "oxc-format-lint",
166
- contribute({ capability, state }) {
167
- state.sourceRoots.sharedOxc = state.projectionSourceRoots.sharedOxc();
168
- setEditorCustomizationResource(state, capability.editorCustomizationResourceId, "oxc-format-lint");
169
- state.rootCheckComponents.unshift({
170
- kind: "oxc-format-check",
171
- owner: strictTypescriptRootBoundary,
172
- }, {
173
- kind: "oxc-lint",
174
- owner: strictTypescriptRootBoundary,
175
- });
176
- state.packageCheckComponents.push({ kind: "oxc-lint", owner: workspacePackageBoundary }, { kind: "oxc-format-check", owner: workspacePackageBoundary });
177
- state.rootFixComponents.push({
178
- kind: "oxc-format-write",
179
- owner: strictTypescriptRootBoundary,
180
- }, {
181
- kind: "oxc-lint-fix",
182
- owner: strictTypescriptRootBoundary,
183
- }, {
184
- kind: "turbo-package-fix",
185
- owner: workspaceBoundaryForState(state),
186
- });
187
- state.packageFixComponents.push({ kind: "oxc-format-write", owner: workspacePackageBoundary }, { kind: "oxc-lint-fix", owner: workspacePackageBoundary });
188
- state.rootScriptFragments["format:check"] =
189
- "oxfmt --list-different oxlint.config.ts oxfmt.config.ts";
190
- state.rootScriptFragments["format:write"] =
191
- "oxfmt --write oxlint.config.ts oxfmt.config.ts";
192
- state.rootScriptFragments.lint =
193
- "oxlint --quiet --format=unix oxlint.config.ts oxfmt.config.ts";
194
- state.rootScriptFragments["lint:fix"] =
195
- "oxlint --format=unix oxlint.config.ts oxfmt.config.ts --fix";
196
- state.packageScriptFragments["format:check"] =
197
- "oxfmt --list-different --config ../../oxfmt.config.ts .";
198
- state.packageScriptFragments["format:write"] =
199
- "oxfmt --write --config ../../oxfmt.config.ts .";
200
- state.packageScriptFragments.lint =
201
- "oxlint --quiet --format=unix --config ../../oxlint.config.ts .";
202
- state.packageScriptFragments["lint:fix"] =
203
- "oxlint --format=unix --config ../../oxlint.config.ts . --fix";
204
- state.rootDevDependencies.add("oxfmt");
205
- state.rootDevDependencies.add("oxlint");
206
- state.rootDevDependencies.add("oxlint-tsgolint");
207
- state.packageDevDependencies.add("oxfmt");
208
- state.packageDevDependencies.add("oxlint");
209
- state.packageDevDependencies.add("oxlint-tsgolint");
210
- state.editorCustomizationCapabilities.push("oxc-format-lint");
211
- state.flags.fixCommand = true;
212
- state.operationFactories.push(oxcFormatLintOperations);
213
- },
214
- },
215
- "node-pnpm-devcontainer": {
216
- kind: "node-pnpm-devcontainer",
217
- contribute({ capability, state }) {
218
- setDevelopmentContainerResource(state, capability.devcontainerResourceId, "node-pnpm-devcontainer");
219
- state.flags.devcontainer = true;
220
- state.operationFactories.push(nodePnpmDevcontainerOperations);
221
- },
222
- },
223
- "github-maintenance": {
224
- kind: "github-maintenance",
225
- contribute({ state }) {
226
- state.dependencyMaintenanceEcosystems.push(...dependencyMaintenanceEcosystems);
227
- state.flags.githubActions = true;
228
- state.flags.dependabot = true;
229
- state.operationFactories.push(githubMaintenanceOperations);
230
- },
231
- },
232
- };
233
- function contributeProjectionCapability(capability, state) {
234
- switch (capability.kind) {
235
- case "workspace-library-package":
236
- capabilityInterpreters["workspace-library-package"].contribute({
237
- capability,
238
- state,
239
- });
240
- return;
241
- case "workspace-node-packages":
242
- capabilityInterpreters["workspace-node-packages"].contribute({
243
- capability,
244
- state,
245
- });
246
- return;
247
- case "rust-binary-workspace":
248
- capabilityInterpreters["rust-binary-workspace"].contribute({
249
- capability,
250
- state,
251
- });
252
- return;
253
- case "strict-typescript-root":
254
- capabilityInterpreters["strict-typescript-root"].contribute({
255
- capability,
256
- state,
257
- });
258
- return;
259
- case "oxc-format-lint":
260
- capabilityInterpreters["oxc-format-lint"].contribute({
261
- capability,
262
- state,
263
- });
264
- return;
265
- case "node-pnpm-devcontainer":
266
- capabilityInterpreters["node-pnpm-devcontainer"].contribute({
267
- capability,
268
- state,
269
- });
270
- return;
271
- case "github-maintenance":
272
- capabilityInterpreters["github-maintenance"].contribute({
273
- capability,
274
- state,
275
- });
276
- return;
277
- }
278
- }
279
- export function interpretPresetProjectionDeclaration(options) {
280
- const validation = validateProjectionCapabilities(options.declaration);
281
- if (!validation.ok) {
282
- throw new Error(`Projection Declaration is invalid:\n${validation.issues
283
- .map((issue) => ` - ${issue.path}: ${issue.message}`)
284
- .join("\n")}`);
285
- }
286
- const state = createProjectionCompositionState(options.sourceRoots);
287
- for (const capability of validation.value.capabilities) {
288
- contributeProjectionCapability(capability, state);
289
- }
290
- const checkPlan = {
291
- components: state.rootCheckComponents,
292
- environmentNeeds: state.rootCheckEnvironmentNeeds,
293
- };
294
- const fixPlan = {
295
- components: state.rootFixComponents,
296
- };
297
- const packageScripts = projectRootPackageScripts(checkPlan, fixPlan, state.rootScriptFragments);
298
- const packageScriptsByPath = packageScriptsByWorkspacePath(state);
299
- const dependencyMaintenancePolicy = {
300
- ecosystems: uniqueValues(state.dependencyMaintenanceEcosystems),
301
- extraDirectories: state.dependencyMaintenanceExtraDirectories,
302
- ...(state.rustWorkspace === undefined
303
- ? {}
304
- : {
305
- directories: {
306
- cargo: `/${rustWorkspacePackagePath(options.context)}`,
307
- },
308
- }),
309
- interval: "weekly",
310
- };
311
- if (state.sourceRoot === undefined) {
312
- throw new Error("Projection Capability composition did not provide sourceRoot");
313
- }
314
- return {
315
- sourceRoot: state.sourceRoot,
316
- sourceRoots: state.sourceRoots,
317
- operations: state.operationFactories.flatMap((factory) => factory({
318
- context: options.context,
319
- state,
320
- packageScripts,
321
- packageScriptsByPath,
322
- })),
323
- checkPlan,
324
- fixPlan,
325
- ciDockerImageBuild: state.ciDockerImageBuild,
326
- dependencyMaintenancePolicy,
327
- packageScripts,
328
- capabilities: completePlanCapabilityFlags(state.flags),
329
- };
330
- }
331
- export function blueprintForPresetSourcePreset(preset, options = { targetDir: process.cwd() }) {
332
- const packageScope = options.scope ?? projectNameFromDir(options.targetDir);
333
- const projectName = projectNameFromDir(options.targetDir);
334
- const packageManager = preset.supportedPackageManagers[0];
335
- const blueprint = {
336
- schemaVersion: 1,
337
- preset: preset.name,
338
- ...(packageManager === undefined ? {} : { packageManager }),
339
- projectKind: preset.supportedProjectKinds[0] ?? "multi-package",
340
- features: [...preset.features],
341
- };
342
- if (preset.projection === undefined) {
343
- return blueprint;
344
- }
345
- const validation = validateProjectionCapabilities(preset.projection);
346
- if (!validation.ok) {
347
- throw new Error(`Projection Declaration is invalid:\n${validation.issues
348
- .map((issue) => ` - ${issue.path}: ${issue.message}`)
349
- .join("\n")}`);
350
- }
351
- const packages = blueprintPackagesForCapabilities(validation.value.capabilities, packageScope, projectName);
352
- return packages.length === 0 ? blueprint : { ...blueprint, packages };
353
- }
354
- export function projectPresetSourcePreset(options) {
355
- if (options.preset.projection === undefined) {
356
- throw new Error(`Preset ${options.preset.name} must declare a Projection Declaration`);
357
- }
358
- return interpretPresetProjectionDeclaration({
359
- preset: options.preset,
360
- declaration: options.preset.projection,
361
- context: options.context,
362
- sourceRoots: options.sourceRoots,
363
- });
364
- }
365
- export async function planPresetSourcePackageAddition(options) {
366
- if (options.preset.projection === undefined) {
367
- throw new Error(`Preset ${options.preset.name} declares Package Addition support but has no Projection Declaration`);
368
- }
369
- const state = stateForProjectionDeclaration(options.preset.projection, options.sourceRoots);
370
- const additionCapability = packageAdditionCapabilityForState(options.preset.name, state);
371
- return {
372
- packagePath: options.addition.packagePath,
373
- workspacePackageGlob: additionCapability.workspacePackageGlob,
374
- workspaceMembershipGlob: `${packageCollectionFromPackagePath(options.addition.packagePath)}/*`,
375
- packageRole: additionCapability.packageRole,
376
- packageSourcePreset: additionCapability.packageSourcePreset,
377
- sourceRoot: templateSourceRootForPreset(state, additionCapability.sourcePreset),
378
- sourceRoots: state.sourceRoots,
379
- operations: packageAdditionOperationsForCapability({
380
- capability: additionCapability,
381
- packageName: options.addition.packageName,
382
- packagePath: options.addition.packagePath,
383
- nodeVersion: options.addition.nodeVersion,
384
- }),
385
- };
386
- }
387
- export function defaultPackagePathForPresetSourcePackageAddition(preset, packageLeafName, sourceRoots) {
388
- if (preset.projection === undefined) {
389
- throw new Error(`Preset ${preset.name} declares Package Addition support but has no Projection Declaration`);
390
- }
391
- const state = stateForProjectionDeclaration(preset.projection, sourceRoots);
392
- const additionCapability = packageAdditionCapabilityForState(preset.name, state);
393
- return `${packageCollection(additionCapability.workspacePackageGlob)}/${packageLeafName}`;
394
- }
395
- function createProjectionCompositionState(sourceRoots) {
396
- return {
397
- projectionSourceRoots: sourceRoots,
398
- sourceRoots: {},
399
- rootCheckComponents: [],
400
- rootCheckEnvironmentNeeds: [],
401
- packageCheckComponents: [],
402
- rootFixComponents: [],
403
- packageFixComponents: [],
404
- rootScriptFragments: {},
405
- packageScriptFragments: {},
406
- rootDevDependencies: new Set(["turbo"]),
407
- packageDependencies: new Set(),
408
- packageDevDependencies: new Set(),
409
- dependencyMaintenanceEcosystems: [],
410
- dependencyMaintenanceExtraDirectories: {},
411
- ciDockerImageBuild: undefined,
412
- editorCustomizationCapabilities: [],
413
- operationFactories: [],
414
- flags: {},
415
- };
416
- }
417
- function uniqueValues(values) {
418
- return [...new Set(values)];
419
- }
420
- function setDevelopmentContainerResource(state, resourceId, capabilityKind) {
421
- const root = state.projectionSourceRoots.sharedResource(resourceId);
422
- if (root === undefined) {
423
- throw new Error(`Projection Capability ${capabilityKind} references unresolved Development Container Shared Resource: ${resourceId}`);
424
- }
425
- const sourceRootKey = developmentContainerResourceSourceRootKey(resourceId);
426
- state.devcontainerResource = { id: resourceId, root, sourceRootKey };
427
- state.sourceRoots[sourceRootKey] = root;
428
- }
429
- function setEditorCustomizationResource(state, resourceId, capabilityKind) {
430
- const root = state.projectionSourceRoots.sharedResource(resourceId);
431
- if (root === undefined) {
432
- throw new Error(`Projection Capability ${capabilityKind} references unresolved Editor Customization Shared Resource: ${resourceId}`);
433
- }
434
- state.editorCustomizationResource = {
435
- id: resourceId,
436
- root,
437
- declarations: loadEditorCustomizationDeclarations(root),
438
- };
439
- }
440
- function developmentContainerResourceSourceRootKey(resourceId) {
441
- return `devcontainer:${resourceId}`;
442
- }
443
- function editorCustomizationDeclarationsForState(state) {
444
- if (state.editorCustomizationResource === undefined) {
445
- throw new Error("Projection Capability composition did not provide Editor Customization Shared Resource");
446
- }
447
- return state.editorCustomizationResource.declarations;
448
- }
449
- function projectNameFromDir(targetDir) {
450
- return path.basename(path.resolve(targetDir));
451
- }
452
- function blueprintPackagesForCapabilities(capabilities, packageScope, projectName) {
453
- return capabilities.flatMap((capability) => {
454
- if (capability.kind === "workspace-library-package") {
455
- return [
456
- {
457
- name: `@${packageScope}/${projectName}`,
458
- path: `${packageCollection(capability.workspacePackageGlob)}/${projectName}`,
459
- },
460
- ];
461
- }
462
- if (capability.kind === "workspace-node-packages") {
463
- return capability.packages.map((nodePackage) => {
464
- const leaf = nodePackage.path.split("/").at(-1) ?? nodePackage.path;
465
- return {
466
- name: `@${packageScope}/${leaf}`,
467
- path: nodePackage.path,
468
- };
469
- });
470
- }
471
- if (capability.kind === "rust-binary-workspace") {
472
- const rustPackageName = cargoPackageNameFromProjectName(projectName);
473
- return [
474
- {
475
- name: `${rustPackageName}-native`,
476
- path: `packages/${rustPackageName}`,
477
- },
478
- ];
479
- }
480
- return [];
481
- });
482
- }
483
- function stateForProjectionDeclaration(declaration, sourceRoots) {
484
- const validation = validateProjectionCapabilities(declaration);
485
- if (!validation.ok) {
486
- throw new Error(`Projection Declaration is invalid:\n${validation.issues
487
- .map((issue) => ` - ${issue.path}: ${issue.message}`)
488
- .join("\n")}`);
489
- }
490
- const state = createProjectionCompositionState(sourceRoots);
491
- for (const capability of validation.value.capabilities) {
492
- contributeProjectionCapability(capability, state);
493
- }
494
- return state;
495
- }
496
- function packageAdditionCapabilityForState(presetName, state) {
497
- if (state.package !== undefined) {
498
- const scripts = packageScriptsByWorkspacePath(state).get(state.package.workspacePackageGlob);
499
- if (scripts === undefined) {
500
- throw new Error(`Missing package scripts for ${state.package.workspacePackageGlob}`);
501
- }
502
- return {
503
- sourcePreset: state.package.packageSourcePreset,
504
- workspacePackageGlob: state.package.workspacePackageGlob,
505
- packageRole: state.package.packageRole,
506
- packageSourcePreset: state.package.packageSourcePreset,
507
- sourceFiles: state.package.sourceFiles,
508
- packageScripts: scripts,
509
- };
510
- }
511
- if (state.nodeWorkspace !== undefined) {
512
- if (state.nodeWorkspace.packages.length !== 1) {
513
- throw new Error(`Preset ${presetName} is an initialization-only workspace and cannot be used for Package Addition`);
514
- }
515
- const nodePackage = state.nodeWorkspace.packages[0];
516
- if (nodePackage === undefined) {
517
- throw new Error(`Preset ${presetName} must declare one package for Package Addition`);
518
- }
519
- return {
520
- sourcePreset: nodePackage.kind,
521
- workspacePackageGlob: state.nodeWorkspace.workspacePackageGlob,
522
- packageRole: "runtime-service",
523
- packageSourcePreset: nodePackage.kind,
524
- sourceFiles: nodePackage.sourceFiles,
525
- packageScripts: nodePackageScripts(nodePackage, state.nodeWorkspace),
526
- nodePackage,
527
- nodeWorkspace: state.nodeWorkspace,
528
- };
529
- }
530
- throw new Error(`Preset ${presetName} is an initialization-only workspace and cannot be used for Package Addition`);
531
- }
532
- function packageCollectionFromPackagePath(packagePath) {
533
- const [workspaceCollection] = packagePath.split("/");
534
- if (!workspaceCollection) {
535
- throw new Error(`Invalid Package Path for Package Addition: ${packagePath}`);
536
- }
537
- return workspaceCollection;
538
- }
539
- function packageAdditionOperationsForCapability(options) {
540
- switch (options.capability.packageSourcePreset) {
541
- case "ts-lib":
542
- return libraryPackageAdditionOperations(options);
543
- case "hono-api":
544
- return honoApiPackageAdditionOperations(options);
545
- case "vike-app":
546
- throw new Error("vike-app cannot be used for Package Addition");
547
- case "vue-app":
548
- return vueAppPackageAdditionOperations(options);
549
- }
550
- }
551
- function generationContextForPackageAddition(options) {
552
- return {
553
- projectName: {
554
- kind: "ProjectName",
555
- value: options.packageName.split("/").at(0)?.replace(/^@/, "") ?? "app",
556
- },
557
- preset: options.preset,
558
- packageManager: { kind: "PackageManager", value: "pnpm" },
559
- blueprint: {
560
- schemaVersion: 1,
561
- preset: options.preset,
562
- packageManager: "pnpm",
563
- projectKind: "multi-package",
564
- features: [],
565
- packages: [{ name: options.packageName, path: options.packagePath }],
566
- },
567
- toolchain: {
568
- nodeLtsMajor: { kind: "NodeLtsMajor", value: options.nodeVersion },
569
- packageManagerPin: { kind: "PackageManagerPin", value: "pnpm@10.34.4" },
570
- source: "bundled-fallback",
571
- diagnostics: [],
572
- },
573
- };
574
- }
575
- function libraryPackageAdditionOperations(options) {
576
- const packageExposure = planPackageLinks([
577
- {
578
- name: options.packageName,
579
- path: options.packagePath,
580
- role: "shared-library",
581
- sourcePreset: "ts-lib",
582
- },
583
- ]).exposuresByPackagePath.get(options.packagePath);
584
- if (packageExposure === undefined) {
585
- throw new Error(`Missing Package Exposure for ${options.packagePath}`);
586
- }
587
- const exposureFields = packageManifestExposureFields(packageExposure);
588
- return [
589
- {
590
- kind: "writeJson",
591
- to: `${options.packagePath}/package.json`,
592
- value: {
593
- name: options.packageName,
594
- version: "0.0.0",
595
- private: true,
596
- type: "module",
597
- imports: exposureFields.imports,
598
- exports: exposureFields.exports,
599
- dependencies: {
600
- valibot: "catalog:",
601
- },
602
- scripts: options.capability.packageScripts,
603
- devDependencies: {
604
- "@types/node": "catalog:",
605
- oxfmt: "catalog:",
606
- oxlint: "catalog:",
607
- typescript: "catalog:",
608
- },
609
- engines: {
610
- node: options.nodeVersion,
611
- },
612
- },
613
- multilineArrays: ["files"],
614
- },
615
- {
616
- kind: "writeJson",
617
- to: `${options.packagePath}/tsconfig.json`,
618
- value: libraryTsconfigJson(),
619
- },
620
- ...options.capability.sourceFiles.map((sourceFile) => ({
621
- kind: "copyFile",
622
- from: sourceFile,
623
- to: `${options.packagePath}/${sourceFile}`,
624
- })),
625
- ];
626
- }
627
- function libraryTsconfigJson() {
628
- return {
629
- compilerOptions: strictTypeScriptCompilerOptions({
630
- composite: true,
631
- declaration: true,
632
- declarationMap: true,
633
- module: "nodenext",
634
- moduleResolution: "nodenext",
635
- rootDir: "src",
636
- types: ["node"],
637
- }),
638
- include: ["src/**/*.ts"],
639
- };
640
- }
641
- function honoApiPackageAdditionOperations(options) {
642
- const packageExposure = planPackageLinks([
643
- {
644
- name: options.packageName,
645
- path: options.packagePath,
646
- role: "runtime-service",
647
- sourcePreset: "hono-api",
648
- },
649
- ]).exposuresByPackagePath.get(options.packagePath);
650
- if (packageExposure === undefined) {
651
- throw new Error(`Missing Package Exposure for ${options.packagePath}`);
652
- }
653
- return [
654
- {
655
- kind: "writeJson",
656
- to: `${options.packagePath}/package.json`,
657
- value: honoApiPackageJson(generationContextForPackageAddition({
658
- preset: "hono-api",
659
- packageName: options.packageName,
660
- packagePath: options.packagePath,
661
- nodeVersion: options.nodeVersion,
662
- }), options.packageName, options.capability.packageScripts, packageManifestExposureFields(packageExposure)),
663
- },
664
- ...honoApiTsconfigOperations(options.packagePath),
665
- ...options.capability.sourceFiles.map((sourceFile) => ({
666
- kind: "copyFile",
667
- from: sourceFile,
668
- to: `${options.packagePath}/${sourceFile}`,
669
- })),
670
- ];
671
- }
672
- function vueAppPackageAdditionOperations(options) {
673
- return [
674
- {
675
- kind: "writeJson",
676
- to: `${options.packagePath}/package.json`,
677
- value: vuePackageJson(generationContextForPackageAddition({
678
- preset: "vue-app",
679
- packageName: options.packageName,
680
- packagePath: options.packagePath,
681
- nodeVersion: options.nodeVersion,
682
- }), options.packageName, options.capability.packageScripts),
683
- },
684
- ...vueAppTsconfigOperations(options.packagePath),
685
- ...options.capability.sourceFiles.map((sourceFile) => ({
686
- kind: "copyFile",
687
- from: sourceFile,
688
- to: `${options.packagePath}/${sourceFile}`,
689
- })),
690
- ];
691
- }
692
- function completePlanCapabilityFlags(flags) {
693
- const missing = requiredPlanCapabilityProviders.filter((requirement) => flags[requirement.flag] !== true);
694
- if (missing.length > 0) {
695
- throw new Error(`Projection Capability composition did not provide required plan capabilities: ${missing
696
- .map((requirement) => requirement.flag)
697
- .join(", ")}`);
698
- }
699
- return {
700
- rootCheck: true,
701
- fixCommand: true,
702
- githubActions: true,
703
- dependabot: true,
704
- devcontainer: true,
705
- };
706
- }
707
- function packageScriptsByWorkspacePath(state) {
708
- if (state.package === undefined && state.rustWorkspace === undefined) {
709
- return new Map();
710
- }
711
- if (state.rustWorkspace !== undefined) {
712
- return new Map([
713
- [
714
- state.rustWorkspace.workspacePackageGlob,
715
- projectPackageScripts({
716
- components: state.packageCheckComponents,
717
- environmentNeeds: [],
718
- }, {
719
- components: state.packageFixComponents,
720
- }, state.packageScriptFragments),
721
- ],
722
- ]);
723
- }
724
- return new Map([
725
- [
726
- state.package.workspacePackageGlob,
727
- projectPackageScripts({
728
- components: state.packageCheckComponents,
729
- environmentNeeds: [],
730
- }, {
731
- components: state.packageFixComponents,
732
- }, state.packageScriptFragments),
733
- ],
734
- ]);
735
- }
736
- function workspaceBoundaryForState(state) {
737
- return workspaceGlobBoundary(state.nodeWorkspace?.workspacePackageGlob ??
738
- state.package?.workspacePackageGlob ??
739
- state.rustWorkspace?.workspacePackageGlob ??
740
- "packages/*");
741
- }
742
- function workspaceGlobBoundary(workspacePackageGlob) {
743
- return {
744
- kind: "package-boundary",
745
- path: workspacePackageGlob,
746
- };
747
- }
748
- function hasVuePackage(capability) {
749
- return findVuePackage(capability) !== undefined;
750
- }
751
- function hasVikePackage(capability) {
752
- return capability.packages.some((nodePackage) => nodePackage.kind === "vike-app");
753
- }
754
- function findVuePackage(capability) {
755
- return capability.packages.find((nodePackage) => nodePackage.kind === "vue-app" || nodePackage.kind === "vike-app");
756
- }
757
- function sourceRootPreset(capability) {
758
- if (capability.packages.length === 1) {
759
- const nodePackage = capability.packages[0];
760
- if (nodePackage === undefined) {
761
- throw new Error("Node package workspace must contain one package");
762
- }
763
- return nodePackage.kind;
764
- }
765
- return "vue-hono-app";
766
- }
767
- function projectRootPackageScripts(checkPlan, fixPlan, fragments) {
768
- const leafFragments = leafScriptFragments(fragments);
769
- const directFragments = directScriptFragments(fragments);
770
- return {
771
- check: `pnpm run check:boundaries && ${renderRootCheckCommand(checkPlan)}`,
772
- fix: renderFixCommand(fixPlan),
773
- ...rootTaskEntrypoints(checkPlan, fixPlan),
774
- ...directFragments,
775
- ...leafFragments,
776
- "check:boundaries": "turbo boundaries --no-color",
777
- "check:run": noopTaskCommand(),
778
- "fix:run": noopTaskCommand(),
779
- };
780
- }
781
- function projectPackageScripts(checkPlan, fixPlan, fragments) {
782
- void checkPlan;
783
- void fixPlan;
784
- return {
785
- ...directScriptFragments(fragments),
786
- ...leafScriptFragments(fragments),
787
- };
788
- }
789
- const leafEntrypointNames = new Set([
790
- "format:check",
791
- "format:write",
792
- "lint",
793
- "lint:fix",
794
- "typecheck",
795
- "build",
796
- "test",
797
- "test:e2e",
798
- ]);
799
- function leafScriptName(scriptName) {
800
- return leafEntrypointNames.has(scriptName) ? `${scriptName}:run` : scriptName;
801
- }
802
- function leafScriptFragments(fragments) {
803
- return Object.fromEntries(Object.entries(fragments)
804
- .filter(([scriptName]) => leafEntrypointNames.has(scriptName))
805
- .map(([scriptName, command]) => [leafScriptName(scriptName), command]));
806
- }
807
- function directScriptFragments(fragments) {
808
- return Object.fromEntries(Object.entries(fragments).filter(([scriptName]) => !leafEntrypointNames.has(scriptName)));
809
- }
810
- function rootTaskEntrypoints(checkPlan, fixPlan) {
811
- const taskNames = new Set([
812
- ...checkPlan.components.map((component) => renderCheckLeafCommand(component).startsWith("turbo run ")
813
- ? undefined
814
- : leafEntrypointFromRunTask(component.kind)),
815
- ...fixPlan.components.map((component) => renderFixLeafCommand(component).startsWith("turbo run ")
816
- ? undefined
817
- : leafEntrypointFromRunTask(component.kind)),
818
- ]);
819
- const entries = [];
820
- for (const taskName of taskNames) {
821
- if (taskName === undefined) {
822
- continue;
823
- }
824
- entries.push([taskName, renderTurboRunCommand([`${taskName}:run`])]);
825
- }
826
- return Object.fromEntries(entries);
827
- }
828
- function leafEntrypointFromRunTask(kind) {
829
- switch (kind) {
830
- case "oxc-format-check":
831
- case "rustfmt-check":
832
- return "format:check";
833
- case "oxc-format-write":
834
- case "rustfmt-write":
835
- return "format:write";
836
- case "oxc-lint":
837
- case "cargo-clippy":
838
- return "lint";
839
- case "oxc-lint-fix":
840
- return "lint:fix";
841
- case "typescript-typecheck":
842
- return "typecheck";
843
- case "build":
844
- return "build";
845
- case "unit-test":
846
- case "cargo-test":
847
- return "test";
848
- case "e2e-test":
849
- return "test:e2e";
850
- case "turbo-check":
851
- case "turbo-package-typecheck":
852
- case "turbo-package-build":
853
- case "turbo-package-test":
854
- case "turbo-package-e2e-test":
855
- case "turbo-package-check":
856
- case "turbo-fix":
857
- case "turbo-package-fix":
858
- return undefined;
859
- }
860
- }
861
- function noopTaskCommand() {
862
- return 'node -e ""';
863
- }
864
- function packageCollection(workspacePackageGlob) {
865
- return workspacePackageGlob.slice(0, -"/*".length);
866
- }
867
- function workspacePackagePath(context, capability) {
868
- return `${packageCollection(capability.workspacePackageGlob)}/${context.projectName.value}`;
869
- }
870
- function workspacePackageName(context, capability) {
871
- const packageDefinition = context.blueprint.packages?.find((pkg) => pkg.path === workspacePackagePath(context, capability));
872
- return (packageDefinition?.name ??
873
- `@${context.projectName.value}/${context.projectName.value}`);
874
- }
875
- function cargoPackageNameFromProjectName(projectName) {
876
- const slug = projectName
877
- .normalize("NFKD")
878
- .replace(/[\u0300-\u036f]/g, "")
879
- .toLowerCase()
880
- .replace(/[^a-z0-9]+/g, "-")
881
- .replace(/^-+|-+$/g, "");
882
- return slug || "rust-bin";
883
- }
884
- function rustProjectName(context) {
885
- return cargoPackageNameFromProjectName(context.projectName.value);
886
- }
887
- function rustWorkspacePackagePath(context) {
888
- return `packages/${rustProjectName(context)}`;
889
- }
890
- function rustWorkspacePackageName(context) {
891
- return `${rustProjectName(context)}-native`;
892
- }
893
- function packageLinkPlanFor(context, capability) {
894
- return planPackageLinks([
895
- {
896
- name: workspacePackageName(context, capability),
897
- path: workspacePackagePath(context, capability),
898
- role: capability.packageRole,
899
- sourcePreset: capability.packageSourcePreset,
900
- },
901
- ]);
902
- }
903
- function nodePackageDefinitions(context, capability) {
904
- const nodeDefinitions = capability.packages
905
- .filter((nodePackage) => nodePackage.kind === "hono-api")
906
- .map((nodePackage) => ({
907
- name: nodePackageName(context, nodePackage),
908
- path: nodePackage.path,
909
- role: "runtime-service",
910
- sourcePreset: "hono-api",
911
- }));
912
- if (hasVikePackage(capability)) {
913
- return [
914
- ...nodeDefinitions,
915
- {
916
- name: vikeDbPackageName(context),
917
- path: vikeDbPackagePath(),
918
- role: "shared-library",
919
- sourcePreset: "ts-lib",
920
- },
921
- ];
922
- }
923
- return nodeDefinitions;
924
- }
925
- function nodePackageName(context, nodePackage) {
926
- const packageDefinition = context.blueprint.packages?.find((pkg) => pkg.path === nodePackage.path);
927
- if (packageDefinition !== undefined) {
928
- return packageDefinition.name;
929
- }
930
- const leaf = nodePackage.path.split("/").at(-1) ?? nodePackage.path;
931
- return `@${context.projectName.value}/${leaf}`;
932
- }
933
- function nodePackageLinkPlan(context, capability) {
934
- return planPackageLinks(nodePackageDefinitions(context, capability), capability.packageLinks ?? []);
935
- }
936
- function vikeDbPackagePath() {
937
- return "packages/db";
938
- }
939
- function vikeDbPackageName(context) {
940
- const packageDefinition = context.blueprint.packages?.find((pkg) => pkg.path === vikeDbPackagePath());
941
- return packageDefinition?.name ?? `@${context.projectName.value}/db`;
942
- }
943
- function rootPackageJson(context, packageScripts, state) {
944
- return {
945
- name: context.projectName.value,
946
- version: "0.0.0",
947
- private: true,
948
- type: "module",
949
- scripts: packageScripts,
950
- devDependencies: catalogDependencies(state.rootDevDependencies),
951
- engines: {
952
- node: context.toolchain.nodeLtsMajor.value,
953
- },
954
- packageManager: context.toolchain.packageManagerPin.value,
955
- };
956
- }
957
- function libraryPackageJson(context, state, capability, scripts) {
958
- const packagePath = workspacePackagePath(context, capability);
959
- const packageExposure = packageLinkPlanFor(context, capability).exposuresByPackagePath.get(packagePath);
960
- if (packageExposure === undefined) {
961
- throw new Error(`Missing Package Exposure for ${packagePath}`);
962
- }
963
- const exposureFields = packageManifestExposureFields(packageExposure);
964
- return {
965
- name: workspacePackageName(context, capability),
966
- version: "0.0.0",
967
- private: true,
968
- type: "module",
969
- imports: exposureFields.imports,
970
- exports: exposureFields.exports,
971
- dependencies: catalogDependencies(state.packageDependencies),
972
- scripts,
973
- devDependencies: catalogDependencies(state.packageDevDependencies),
974
- engines: {
975
- node: context.toolchain.nodeLtsMajor.value,
976
- },
977
- };
978
- }
979
- function honoApiPackageJson(context, packageName, scripts, exposureFields) {
980
- return {
981
- name: packageName,
982
- version: "0.0.0",
983
- private: true,
984
- type: "module",
985
- ...(exposureFields === undefined
986
- ? {
987
- imports: {
988
- "#/*": {
989
- default: "./dist/*.js",
990
- types: "./src/*.ts",
991
- },
992
- },
993
- }
994
- : {
995
- types: exposureFields.types,
996
- exports: exposureFields.exports,
997
- imports: exposureFields.imports,
998
- }),
999
- scripts,
1000
- dependencies: {
1001
- "@hono/node-server": "catalog:",
1002
- hono: "catalog:",
1003
- },
1004
- devDependencies: {
1005
- "@types/node": "catalog:",
1006
- oxfmt: "catalog:",
1007
- oxlint: "catalog:",
1008
- "oxlint-tsgolint": "catalog:",
1009
- "tsc-alias": "catalog:",
1010
- ...(scripts.dev === undefined ? {} : { tsx: "catalog:" }),
1011
- typescript: "catalog:",
1012
- vitest: "catalog:",
1013
- },
1014
- engines: {
1015
- node: context.toolchain.nodeLtsMajor.value,
1016
- },
1017
- };
1018
- }
1019
- function vuePackageJson(context, packageName, scripts, packageLinkDependencies = {}) {
1020
- return {
1021
- name: packageName,
1022
- version: "0.0.0",
1023
- private: true,
1024
- type: "module",
1025
- imports: {
1026
- "#/*": {
1027
- default: "./src/*.ts",
1028
- types: "./src/*.ts",
1029
- },
1030
- },
1031
- scripts,
1032
- dependencies: {
1033
- ...packageLinkDependencies,
1034
- ...(Object.keys(packageLinkDependencies).length === 0
1035
- ? {}
1036
- : { hono: "catalog:" }),
1037
- pinia: "catalog:",
1038
- vue: "catalog:",
1039
- },
1040
- devDependencies: {
1041
- "@playwright/test": "catalog:",
1042
- "@tailwindcss/vite": "catalog:",
1043
- "@types/node": "catalog:",
1044
- "@types/web-bluetooth": "catalog:",
1045
- "@vitejs/plugin-vue": "catalog:",
1046
- "@vue/tsconfig": "catalog:",
1047
- oxfmt: "catalog:",
1048
- oxlint: "catalog:",
1049
- "oxlint-tsgolint": "catalog:",
1050
- tailwindcss: "catalog:",
1051
- typescript: "catalog:",
1052
- vite: "catalog:",
1053
- vitest: "catalog:",
1054
- "vue-tsc": "catalog:",
1055
- },
1056
- engines: {
1057
- node: context.toolchain.nodeLtsMajor.value,
1058
- },
1059
- };
1060
- }
1061
- function vikePackageJson(context, packageName, scripts, packageLinkDependencies = {}) {
1062
- return {
1063
- name: packageName,
1064
- version: "0.0.0",
1065
- private: true,
1066
- type: "module",
1067
- imports: {
1068
- "#/*": {
1069
- default: "./*.ts",
1070
- types: "./*.ts",
1071
- },
1072
- },
1073
- scripts,
1074
- dependencies: {
1075
- ...packageLinkDependencies,
1076
- "@vikejs/hono": "catalog:",
1077
- hono: "catalog:",
1078
- telefunc: "catalog:",
1079
- vike: "catalog:",
1080
- "vike-vue": "catalog:",
1081
- vue: "catalog:",
1082
- },
1083
- devDependencies: {
1084
- "@playwright/test": "catalog:",
1085
- "@tailwindcss/vite": "catalog:",
1086
- "@types/node": "catalog:",
1087
- "@vitejs/plugin-vue": "catalog:",
1088
- "@vue/tsconfig": "catalog:",
1089
- oxfmt: "catalog:",
1090
- oxlint: "catalog:",
1091
- "oxlint-tsgolint": "catalog:",
1092
- tailwindcss: "catalog:",
1093
- turbo: "catalog:",
1094
- typescript: "catalog:",
1095
- vite: "catalog:",
1096
- vitest: "catalog:",
1097
- "vue-tsc": "catalog:",
1098
- },
1099
- engines: {
1100
- node: context.toolchain.nodeLtsMajor.value,
1101
- },
1102
- packageManager: context.toolchain.packageManagerPin.value,
1103
- };
1104
- }
1105
- function vikeDbPackageJson(context) {
1106
- return {
1107
- name: vikeDbPackageName(context),
1108
- version: "0.0.0",
1109
- private: true,
1110
- type: "module",
1111
- imports: {
1112
- "#db/*": {
1113
- default: "./src/*.ts",
1114
- types: "./src/*.ts",
1115
- },
1116
- },
1117
- exports: {
1118
- ".": {
1119
- default: "./src/index.ts",
1120
- types: "./src/index.ts",
1121
- },
1122
- "./schema": {
1123
- default: "./src/schema.ts",
1124
- types: "./src/schema.ts",
1125
- },
1126
- "./queries/todos": {
1127
- default: "./src/queries/todos.ts",
1128
- types: "./src/queries/todos.ts",
1129
- },
1130
- "./readiness": {
1131
- default: "./src/readiness.ts",
1132
- types: "./src/readiness.ts",
1133
- },
1134
- },
1135
- dependencies: {
1136
- "drizzle-orm": "catalog:",
1137
- },
1138
- scripts: vikeDbPackageScripts(),
1139
- devDependencies: {
1140
- "@types/node": "catalog:",
1141
- "drizzle-kit": "catalog:",
1142
- oxfmt: "catalog:",
1143
- oxlint: "catalog:",
1144
- "oxlint-tsgolint": "catalog:",
1145
- typescript: "catalog:",
1146
- vitest: "catalog:",
1147
- },
1148
- engines: {
1149
- node: context.toolchain.nodeLtsMajor.value,
1150
- },
1151
- };
1152
- }
1153
- function vikeDbPackageScripts() {
1154
- return {
1155
- "build:run": "tsc -p tsconfig.json --noEmit",
1156
- "db:generate": "drizzle-kit generate",
1157
- "db:migrate": "drizzle-kit migrate",
1158
- "db:prepare:deploy": "pnpm run db:migrate",
1159
- "db:prepare:dev": "pnpm run db:push && pnpm run db:seed:example",
1160
- "db:prepare:test": 'rm -f "${DATABASE_FILE:-./node_modules/.tmp/test.sqlite}" && pnpm run db:push && pnpm run db:seed:example',
1161
- "db:push": "mkdir -p data node_modules/.tmp && drizzle-kit push",
1162
- "db:seed:example": "node --experimental-strip-types scripts/seed-example.ts",
1163
- "db:studio": "drizzle-kit studio",
1164
- "format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
1165
- "format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
1166
- "lint:run": "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
1167
- "lint:fix:run": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
1168
- "test:run": "DATABASE_FILE=./node_modules/.tmp/test.sqlite pnpm run db:prepare:test && DATABASE_FILE=./node_modules/.tmp/test.sqlite vitest run --reporter=agent --silent=passed-only; status=$?; rm -f ./node_modules/.tmp/test.sqlite; exit $status",
1169
- "typecheck:run": "tsc -p tsconfig.json --noEmit --pretty false",
1170
- };
1171
- }
1172
- function catalogDependencies(dependencies) {
1173
- return Object.fromEntries([...dependencies].toSorted().map((dependency) => [dependency, "catalog:"]));
1174
- }
1175
- function generationRecord(context) {
1176
- return {
1177
- packageName: "@ykdz/template",
1178
- version: "0.0.0",
1179
- command: `template init --preset ${context.blueprint.preset}`,
1180
- toolchain: {
1181
- nodeLtsMajor: context.toolchain.nodeLtsMajor.value,
1182
- packageManagerPin: context.toolchain.packageManagerPin.value,
1183
- source: context.toolchain.source,
1184
- },
1185
- };
1186
- }
1187
- function rustCargoToml(projectName, dependencies = []) {
1188
- return [
1189
- "[package]",
1190
- `name = "${projectName}"`,
1191
- 'version = "0.1.0"',
1192
- 'edition = "2024"',
1193
- "",
1194
- "[dependencies]",
1195
- ...renderCargoDependencyTomlEntries(dependencies),
1196
- "",
1197
- "[lints]",
1198
- "workspace = true",
1199
- "",
1200
- "[workspace]",
1201
- 'members = ["."]',
1202
- 'resolver = "3"',
1203
- "",
1204
- "[workspace.lints.rust]",
1205
- 'unsafe_code = "forbid"',
1206
- "",
1207
- "[workspace.lints.clippy]",
1208
- 'all = "deny"',
1209
- 'pedantic = "deny"',
1210
- 'nursery = "deny"',
1211
- "",
1212
- "[profile.release]",
1213
- 'strip = "symbols"',
1214
- 'lto = "thin"',
1215
- "codegen-units = 1",
1216
- "",
1217
- ].join("\n");
1218
- }
1219
- function rustCargoLock(projectName) {
1220
- return renderCargoLockForPackage({
1221
- packageName: projectName,
1222
- packageVersion: "0.1.0",
1223
- });
1224
- }
1225
- function rustRootPackageJson(context, packageScripts, state) {
1226
- return {
1227
- name: rustProjectName(context),
1228
- version: "0.0.0",
1229
- private: true,
1230
- scripts: packageScripts,
1231
- devDependencies: catalogDependencies(state.rootDevDependencies),
1232
- engines: {
1233
- node: context.toolchain.nodeLtsMajor.value,
1234
- },
1235
- packageManager: context.toolchain.packageManagerPin.value,
1236
- };
1237
- }
1238
- function rustWorkspacePackageJson(context) {
1239
- return {
1240
- name: rustWorkspacePackageName(context),
1241
- version: "0.0.0",
1242
- private: true,
1243
- scripts: rustWorkspacePackageScripts(),
1244
- engines: {
1245
- node: context.toolchain.nodeLtsMajor.value,
1246
- },
1247
- };
1248
- }
1249
- function rustWorkspacePackageScripts() {
1250
- return {
1251
- "format:check:run": "cargo fmt --all -- --check",
1252
- "format:write:run": "cargo fmt --all",
1253
- "lint:run": "cargo clippy --workspace --all-targets -- -D warnings",
1254
- "test:run": "cargo test --workspace",
1255
- };
1256
- }
1257
- function workspaceLibraryPackageOperations({ context, state, packageScripts, packageScriptsByPath, }) {
1258
- if (state.package === undefined) {
1259
- throw new Error("workspace-library-package capability state is missing");
1260
- }
1261
- const capability = state.package;
1262
- const packagePath = workspacePackagePath(context, capability);
1263
- const workspacePackageScripts = packageScriptsByPath.get(capability.workspacePackageGlob);
1264
- if (workspacePackageScripts === undefined) {
1265
- throw new Error(`Missing package scripts for ${capability.workspacePackageGlob}`);
1266
- }
1267
- const rootManifest = rootPackageJson(context, packageScripts, state);
1268
- const packageManifest = libraryPackageJson(context, state, capability, workspacePackageScripts);
1269
- return [
1270
- {
1271
- kind: "writeJson",
1272
- to: "package.json",
1273
- value: rootManifest,
1274
- },
1275
- {
1276
- kind: "writeText",
1277
- to: "pnpm-workspace.yaml",
1278
- text: renderGeneratedPnpmWorkspaceYaml({
1279
- packages: [capability.workspacePackageGlob],
1280
- dependencies: collectGeneratedManifestCatalogDependencies([
1281
- rootManifest,
1282
- packageManifest,
1283
- ]),
1284
- }),
1285
- },
1286
- {
1287
- kind: "writeJson",
1288
- to: "turbo.json",
1289
- value: packageTurboConfig({ dependencyBuildsRequired: false }),
1290
- },
1291
- {
1292
- kind: "writeJson",
1293
- to: `${packagePath}/package.json`,
1294
- value: packageManifest,
1295
- multilineArrays: ["files"],
1296
- },
1297
- {
1298
- kind: "writeText",
1299
- to: ".gitignore",
1300
- text: [
1301
- "node_modules",
1302
- "dist",
1303
- ".env",
1304
- ".template/",
1305
- ".pnpm-store/",
1306
- "",
1307
- ].join("\n"),
1308
- },
1309
- ...capability.sourceFiles.map((sourceFile) => ({
1310
- kind: "copyFile",
1311
- from: sourceFile,
1312
- to: `${packagePath}/${sourceFile}`,
1313
- })),
1314
- {
1315
- kind: "writeJson",
1316
- to: ".template/blueprint.json",
1317
- value: context.blueprint,
1318
- },
1319
- {
1320
- kind: "writeJson",
1321
- to: ".template/generated-by.json",
1322
- value: generationRecord(context),
1323
- },
1324
- ];
1325
- }
1326
- function rustBinaryWorkspaceOperations({ context, state, packageScripts, }) {
1327
- if (state.rustWorkspace === undefined) {
1328
- throw new Error("rust-binary-workspace capability state is missing");
1329
- }
1330
- const capability = state.rustWorkspace;
1331
- const packagePath = rustWorkspacePackagePath(context);
1332
- const rootManifest = rustRootPackageJson(context, packageScripts, state);
1333
- const packageManifest = rustWorkspacePackageJson(context);
1334
- const rustLayer = rustToolLayer();
1335
- const dockerfileFragments = readDevelopmentContainerDockerfileFragments(state, ["rust"]);
1336
- const editorCustomization = editorCustomizationForCapabilities(state.editorCustomizationCapabilities, editorCustomizationDeclarationsForState(state));
1337
- const developmentContainer = dockerfileFirstRustPnpmDevcontainer({
1338
- name: context.projectName.value,
1339
- nodeLayer: nodePnpmToolLayer({
1340
- nodeVersion: context.toolchain.nodeLtsMajor.value,
1341
- packageManagerPin: context.toolchain.packageManagerPin.value,
1342
- }),
1343
- rustLayer,
1344
- dockerfileFragments,
1345
- extensions: editorCustomization.extensions,
1346
- settings: editorCustomization.settings,
1347
- });
1348
- return [
1349
- {
1350
- kind: "writeJson",
1351
- to: "package.json",
1352
- value: rootManifest,
1353
- },
1354
- {
1355
- kind: "writeText",
1356
- to: "pnpm-workspace.yaml",
1357
- text: renderGeneratedPnpmWorkspaceYaml({
1358
- packages: [capability.workspacePackageGlob],
1359
- dependencies: collectGeneratedManifestCatalogDependencies([
1360
- rootManifest,
1361
- packageManifest,
1362
- ]),
1363
- }),
1364
- },
1365
- {
1366
- kind: "writeJson",
1367
- to: "turbo.json",
1368
- value: packageTurboConfig({ dependencyBuildsRequired: false }),
1369
- },
1370
- {
1371
- kind: "writeJson",
1372
- to: `${packagePath}/package.json`,
1373
- value: packageManifest,
1374
- },
1375
- {
1376
- kind: "writeText",
1377
- to: `${packagePath}/Cargo.toml`,
1378
- text: rustCargoToml(rustProjectName(context), capability.cargoDependencies ?? []),
1379
- },
1380
- {
1381
- kind: "writeText",
1382
- to: `${packagePath}/Cargo.lock`,
1383
- text: rustCargoLock(rustProjectName(context)),
1384
- },
1385
- {
1386
- kind: "copyFile",
1387
- from: "rustfmt.toml",
1388
- to: `${packagePath}/rustfmt.toml`,
1389
- },
1390
- {
1391
- kind: "writeTextTemplate",
1392
- from: "rust-toolchain.toml",
1393
- to: "rust-toolchain.toml",
1394
- replacements: {
1395
- RUST_TOOLCHAIN: rustLayer.toolchain,
1396
- },
1397
- },
1398
- {
1399
- kind: "writeText",
1400
- to: ".gitignore",
1401
- text: [
1402
- "target",
1403
- "node_modules",
1404
- "dist",
1405
- ".env",
1406
- ".template/",
1407
- ".pnpm-store/",
1408
- "",
1409
- ].join("\n"),
1410
- },
1411
- ...capability.sourceFiles.map((sourceFile) => ({
1412
- kind: "copyFile",
1413
- from: sourceFile,
1414
- to: `${packagePath}/${sourceFile}`,
1415
- })),
1416
- {
1417
- kind: "writeJson",
1418
- to: ".template/blueprint.json",
1419
- value: context.blueprint,
1420
- },
1421
- {
1422
- kind: "writeJson",
1423
- to: ".template/generated-by.json",
1424
- value: generationRecord(context),
1425
- },
1426
- {
1427
- kind: "writeJson",
1428
- to: ".devcontainer/devcontainer.json",
1429
- value: developmentContainer.devcontainer,
1430
- multilineArrays: ["customizations.vscode.extensions"],
1431
- },
1432
- {
1433
- ...developmentContainer.dockerfileOperation,
1434
- },
1435
- {
1436
- kind: "writeJson",
1437
- to: ".vscode/extensions.json",
1438
- value: {
1439
- recommendations: editorCustomization.extensions,
1440
- },
1441
- },
1442
- {
1443
- kind: "writeJson",
1444
- to: ".vscode/settings.json",
1445
- value: editorCustomization.settings,
1446
- },
1447
- {
1448
- kind: "copyFile",
1449
- from: ".github/workflows/check.yml",
1450
- to: ".github/workflows/check.yml",
1451
- },
1452
- {
1453
- kind: "writeTextTemplate",
1454
- from: ".github/dependabot.yml",
1455
- to: ".github/dependabot.yml",
1456
- replacements: {
1457
- CARGO_PACKAGE_DIRECTORY: `/${packagePath}`,
1458
- },
1459
- },
1460
- ];
1461
- }
1462
- function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
1463
- if (state.nodeWorkspace === undefined) {
1464
- throw new Error("workspace-node-packages capability state is missing");
1465
- }
1466
- const capability = state.nodeWorkspace;
1467
- const packageLinkPlan = nodePackageLinkPlan(context, capability);
1468
- const nodePackageManifests = capability.packages.map((nodePackage) => {
1469
- const scripts = nodePackageScripts(nodePackage, capability);
1470
- const packageName = nodePackageName(context, nodePackage);
1471
- if (nodePackage.kind === "hono-api") {
1472
- const exposure = packageLinkPlan.exposuresByPackagePath.get(nodePackage.path);
1473
- return honoApiPackageJson(context, packageName, scripts, exposure === undefined
1474
- ? undefined
1475
- : packageManifestExposureFields(exposure));
1476
- }
1477
- if (nodePackage.kind === "vike-app") {
1478
- return vikePackageJson(context, packageName, scripts, packageLinkPlan.manifestDependenciesByPackagePath.get(nodePackage.path));
1479
- }
1480
- return vuePackageJson(context, packageName, scripts, packageLinkPlan.manifestDependenciesByPackagePath.get(nodePackage.path));
1481
- });
1482
- const vikeDbManifest = hasVikePackage(capability)
1483
- ? vikeDbPackageJson(context)
1484
- : undefined;
1485
- const packageManifests = vikeDbManifest === undefined
1486
- ? nodePackageManifests
1487
- : [...nodePackageManifests, vikeDbManifest];
1488
- const rootManifest = rootPackageJson(context, packageScripts, state);
1489
- if (rootManifest === undefined) {
1490
- throw new Error("workspace-node-packages rendered no package manifests");
1491
- }
1492
- return [
1493
- {
1494
- kind: "writeJson",
1495
- to: "package.json",
1496
- value: rootManifest,
1497
- },
1498
- {
1499
- kind: "writeText",
1500
- to: "pnpm-workspace.yaml",
1501
- text: renderGeneratedPnpmWorkspaceYaml({
1502
- packages: workspacePackageGlobsForNodeWorkspace(capability),
1503
- dependencies: capability.packageLinks === undefined
1504
- ? collectGeneratedManifestCatalogDependencies([
1505
- rootManifest,
1506
- ...packageManifests,
1507
- ])
1508
- : collectGeneratedManifestCatalogReferences([
1509
- rootManifest,
1510
- ...packageManifests,
1511
- ]),
1512
- ...(hasVuePackage(capability)
1513
- ? {
1514
- allowBuilds: {
1515
- esbuild: true,
1516
- },
1517
- }
1518
- : {}),
1519
- }),
1520
- },
1521
- {
1522
- kind: "writeJson",
1523
- to: "turbo.json",
1524
- value: {
1525
- tasks: {
1526
- ...packageLinkPlan.turboTasks,
1527
- ...(hasVuePackage(capability)
1528
- ? {
1529
- dev: {
1530
- cache: false,
1531
- persistent: true,
1532
- },
1533
- }
1534
- : {}),
1535
- },
1536
- boundaries: packageTurboConfig({
1537
- dependencyBuildsRequired: false,
1538
- }).boundaries,
1539
- },
1540
- },
1541
- {
1542
- kind: "writeText",
1543
- to: ".gitignore",
1544
- text: gitignoreForNodeWorkspace(capability),
1545
- },
1546
- ...capability.packages.flatMap((nodePackage, index) => [
1547
- {
1548
- kind: "writeJson",
1549
- to: `${nodePackage.path}/package.json`,
1550
- value: nodePackageManifests[index],
1551
- },
1552
- ...nodePackageTsconfigOperations(nodePackage, capability),
1553
- ...nodePackage.sourceFiles.flatMap((sourceFile) => vikeTemplateSourceOperation({
1554
- context,
1555
- nodePackage,
1556
- sourceFile,
1557
- workspace: capability,
1558
- })),
1559
- ]),
1560
- ...(vikeDbManifest === undefined ? [] : vikeDbPackageOperations(context)),
1561
- {
1562
- kind: "writeJson",
1563
- to: ".template/blueprint.json",
1564
- value: context.blueprint,
1565
- },
1566
- {
1567
- kind: "writeJson",
1568
- to: ".template/generated-by.json",
1569
- value: generationRecord(context),
1570
- },
1571
- ];
1572
- }
1573
- function nodePackageScripts(nodePackage, workspace) {
1574
- const oxcScripts = {
1575
- "format:check": "oxfmt --list-different --config ../../oxfmt.config.ts .",
1576
- "format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
1577
- lint: "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
1578
- "lint:fix": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
1579
- };
1580
- if (nodePackage.kind === "hono-api") {
1581
- return {
1582
- "build:run": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
1583
- ...(workspace.packages.length > 1
1584
- ? { dev: "tsx watch src/server.ts" }
1585
- : {}),
1586
- ...leafScriptFragments(oxcScripts),
1587
- start: "node dist/server.js",
1588
- "test:run": "vitest run --reporter=agent --silent=passed-only",
1589
- "typecheck:run": "tsc -p tsconfig.json --noEmit --pretty false",
1590
- };
1591
- }
1592
- if (nodePackage.kind === "vike-app") {
1593
- const dbCommand = "DATABASE_FILE=../../apps/web/data/app.sqlite pnpm --dir ../../packages/db run db:prepare:dev";
1594
- return {
1595
- "build:run": "vike build",
1596
- dev: `${dbCommand} && vike dev`,
1597
- "format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
1598
- "format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
1599
- "lint:run": "oxlint --quiet --format=unix --type-aware --config ../../oxlint.config.ts .",
1600
- "lint:fix:run": "oxlint --type-aware --format=unix --config ../../oxlint.config.ts . --fix",
1601
- preview: `${dbCommand} && vike preview`,
1602
- start: "node ./dist/server/index.mjs",
1603
- "test:run": "vitest run --reporter=agent --silent=passed-only --passWithNoTests",
1604
- "test:e2e:run": "node --experimental-strip-types scripts/run-playwright.ts",
1605
- "typecheck:run": "vue-tsc --build --noEmit --pretty false",
1606
- };
1607
- }
1608
- return {
1609
- "build:run": "vite build",
1610
- dev: "vite",
1611
- ...leafScriptFragments(oxcScripts),
1612
- preview: "vite preview",
1613
- "test:run": "vitest run --reporter=agent --silent=passed-only",
1614
- "test:e2e:run": "node --experimental-strip-types scripts/run-playwright.ts",
1615
- "typecheck:run": workspace.packages.length > 1
1616
- ? "vue-tsc --build --pretty false"
1617
- : "vue-tsc --build --noEmit --pretty false",
1618
- };
1619
- }
1620
- function nodePackageTsconfigOperations(nodePackage, workspace) {
1621
- if (nodePackage.kind === "vike-app") {
1622
- return [
1623
- {
1624
- kind: "writeJson",
1625
- to: `${nodePackage.path}/tsconfig.json`,
1626
- value: {
1627
- files: [],
1628
- references: [
1629
- { path: "../../packages/db" },
1630
- { path: "./tsconfig.app.json" },
1631
- { path: "./tsconfig.test.json" },
1632
- { path: "./tsconfig.node.json" },
1633
- ],
1634
- },
1635
- },
1636
- {
1637
- kind: "writeJson",
1638
- to: `${nodePackage.path}/tsconfig.app.json`,
1639
- value: {
1640
- extends: "@vue/tsconfig/tsconfig.dom.json",
1641
- compilerOptions: {
1642
- ...strictTypeScriptCompilerOptions({
1643
- composite: true,
1644
- module: "esnext",
1645
- moduleResolution: "bundler",
1646
- paths: { "#/*": ["./*"] },
1647
- tsBuildInfoFile: "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
1648
- types: ["node"],
1649
- }),
1650
- skipLibCheck: true,
1651
- },
1652
- include: [
1653
- "+server.ts",
1654
- "assets/**/*.svg",
1655
- "components/**/*.vue",
1656
- "pages/**/*.ts",
1657
- "pages/**/*.vue",
1658
- "server/**/*.ts",
1659
- "types/**/*.d.ts",
1660
- ],
1661
- },
1662
- },
1663
- {
1664
- kind: "writeJson",
1665
- to: `${nodePackage.path}/tsconfig.test.json`,
1666
- value: {
1667
- extends: "./tsconfig.app.json",
1668
- compilerOptions: {
1669
- lib: ["ESNext", "DOM", "DOM.Iterable"],
1670
- paths: { "#/*": ["./*"] },
1671
- skipLibCheck: true,
1672
- tsBuildInfoFile: "./node_modules/.tmp/tsconfig.test.tsbuildinfo",
1673
- types: ["node", "vitest/globals"],
1674
- },
1675
- include: ["test/**/*.ts", "vitest.config.ts"],
1676
- },
1677
- },
1678
- {
1679
- kind: "writeJson",
1680
- to: `${nodePackage.path}/tsconfig.node.json`,
1681
- multilineArrays: ["include"],
1682
- value: {
1683
- compilerOptions: {
1684
- ...strictTypeScriptCompilerOptions({
1685
- composite: true,
1686
- module: "esnext",
1687
- moduleResolution: "bundler",
1688
- lib: ["ESNext", "DOM", "DOM.Iterable"],
1689
- paths: { "#/*": ["./*"] },
1690
- tsBuildInfoFile: "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
1691
- types: ["node"],
1692
- }),
1693
- skipLibCheck: true,
1694
- },
1695
- include: [
1696
- "playwright.config.ts",
1697
- "scripts/**/*.ts",
1698
- "vite.config.ts",
1699
- "vitest.config.ts",
1700
- ],
1701
- },
1702
- },
1703
- ];
1704
- }
1705
- if (nodePackage.kind === "hono-api") {
1706
- return [
1707
- {
1708
- kind: "writeJson",
1709
- to: `${nodePackage.path}/tsconfig.json`,
1710
- value: {
1711
- compilerOptions: strictTypeScriptCompilerOptions({
1712
- composite: true,
1713
- ...(workspace.packages.length > 1
1714
- ? { declaration: true, declarationMap: true }
1715
- : {}),
1716
- module: "nodenext",
1717
- moduleResolution: "nodenext",
1718
- types: ["node", "vitest/globals"],
1719
- }),
1720
- include: ["src/**/*.ts", "test/**/*.ts", "vitest.config.ts"],
1721
- },
1722
- },
1723
- {
1724
- kind: "writeJson",
1725
- to: `${nodePackage.path}/tsconfig.build.json`,
1726
- value: {
1727
- extends: "./tsconfig.json",
1728
- compilerOptions: {
1729
- outDir: "dist",
1730
- rootDir: "src",
1731
- types: ["node"],
1732
- },
1733
- include: ["src/**/*.ts"],
1734
- },
1735
- },
1736
- ];
1737
- }
1738
- return [
1739
- {
1740
- kind: "writeJson",
1741
- to: `${nodePackage.path}/tsconfig.json`,
1742
- value: {
1743
- files: [],
1744
- references: [
1745
- { path: "./tsconfig.app.json" },
1746
- { path: "./tsconfig.test.json" },
1747
- { path: "./tsconfig.node.json" },
1748
- ],
1749
- },
1750
- },
1751
- {
1752
- kind: "writeJson",
1753
- to: `${nodePackage.path}/tsconfig.app.json`,
1754
- value: {
1755
- extends: "@vue/tsconfig/tsconfig.dom.json",
1756
- compilerOptions: strictTypeScriptCompilerOptions({
1757
- composite: true,
1758
- module: "esnext",
1759
- moduleResolution: "bundler",
1760
- tsBuildInfoFile: "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
1761
- types: ["web-bluetooth"],
1762
- }),
1763
- include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue"],
1764
- },
1765
- },
1766
- {
1767
- kind: "writeJson",
1768
- to: `${nodePackage.path}/tsconfig.test.json`,
1769
- value: {
1770
- extends: "./tsconfig.app.json",
1771
- compilerOptions: {
1772
- lib: ["ESNext", "DOM", "DOM.Iterable"],
1773
- tsBuildInfoFile: "./node_modules/.tmp/tsconfig.test.tsbuildinfo",
1774
- types: ["node", "vitest/globals", "web-bluetooth"],
1775
- },
1776
- include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue", "test/**/*.ts"],
1777
- },
1778
- },
1779
- {
1780
- kind: "writeJson",
1781
- to: `${nodePackage.path}/tsconfig.node.json`,
1782
- multilineArrays: ["include"],
1783
- value: {
1784
- compilerOptions: strictTypeScriptCompilerOptions({
1785
- composite: true,
1786
- module: "esnext",
1787
- moduleResolution: "bundler",
1788
- lib: ["ESNext", "DOM", "DOM.Iterable"],
1789
- ...(workspace.packages.length > 1
1790
- ? { outDir: "./node_modules/.tmp/tsconfig.node" }
1791
- : {}),
1792
- tsBuildInfoFile: "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
1793
- types: ["node"],
1794
- }),
1795
- include: [
1796
- "playwright.config.ts",
1797
- "scripts/**/*.ts",
1798
- "vite.config.ts",
1799
- "vitest.config.ts",
1800
- ],
1801
- },
1802
- },
1803
- ];
1804
- }
1805
- function honoApiTsconfigOperations(packagePath) {
1806
- const operations = nodePackageTsconfigOperations({
1807
- kind: "hono-api",
1808
- path: "apps/api",
1809
- sourceFiles: [],
1810
- }, {
1811
- kind: "workspace-node-packages",
1812
- workspacePackageGlob: "apps/*",
1813
- packages: [
1814
- {
1815
- kind: "hono-api",
1816
- path: "apps/api",
1817
- sourceFiles: [],
1818
- },
1819
- ],
1820
- });
1821
- return operations.map((operation) => ({
1822
- ...operation,
1823
- to: operation.to.replace(/^apps\/api/, packagePath),
1824
- }));
1825
- }
1826
- function vueAppTsconfigOperations(packagePath) {
1827
- const operations = nodePackageTsconfigOperations({
1828
- kind: "vue-app",
1829
- path: "apps/web",
1830
- sourceFiles: [],
1831
- }, {
1832
- kind: "workspace-node-packages",
1833
- workspacePackageGlob: "apps/*",
1834
- packages: [
1835
- {
1836
- kind: "vue-app",
1837
- path: "apps/web",
1838
- sourceFiles: [],
1839
- },
1840
- ],
1841
- });
1842
- return operations.map((operation) => ({
1843
- ...operation,
1844
- to: operation.to.replace(/^apps\/web/, packagePath),
1845
- }));
1846
- }
1847
- function sourcePathWithinNodePackage(sourceFile, workspace) {
1848
- if (workspace.packages.length === 1 && !sourceFile.startsWith("web/")) {
1849
- return sourceFile;
1850
- }
1851
- return sourceFile.replace(/^(api|web)\//, "");
1852
- }
1853
- function nodePackageTargetPath(nodePackage, sourceFile, workspace) {
1854
- const packageRelativePath = sourcePathWithinNodePackage(sourceFile, workspace);
1855
- return `${nodePackage.path}/${packageRelativePath}`;
1856
- }
1857
- function vikeTemplateSourceOperation(options) {
1858
- const to = nodePackageTargetPath(options.nodePackage, options.sourceFile, options.workspace);
1859
- const copyOperation = {
1860
- kind: "copyFile",
1861
- from: options.sourceFile,
1862
- to,
1863
- };
1864
- if (options.nodePackage.kind === "vike-app" &&
1865
- options.sourceFile === "web/Dockerfile") {
1866
- return [
1867
- {
1868
- kind: "writeTextTemplate",
1869
- from: options.sourceFile,
1870
- to,
1871
- replacements: {
1872
- NODE_VERSION: options.context.toolchain.nodeLtsMajor.value,
1873
- PACKAGE_MANAGER_PIN: options.context.toolchain.packageManagerPin.value,
1874
- WEB_PACKAGE_NAME: nodePackageName(options.context, options.nodePackage),
1875
- },
1876
- },
1877
- ];
1878
- }
1879
- if (options.nodePackage.kind === "vike-app" &&
1880
- [
1881
- "web/pages/index/+Page.telefunc.ts",
1882
- "web/server/app.ts",
1883
- "web/types/global.d.ts",
1884
- ].includes(options.sourceFile)) {
1885
- const dbPackageName = vikeDbPackageName(options.context);
1886
- const replacements = {
1887
- "web/pages/index/+Page.telefunc.ts": `import { createTodo, listTodos } from "${dbPackageName}/queries/todos";`,
1888
- "web/server/app.ts": [
1889
- `import { createDatabase } from "${dbPackageName}";`,
1890
- `import { assertDatabaseReady } from "${dbPackageName}/readiness";`,
1891
- ].join("\n"),
1892
- "web/types/global.d.ts": `import type { Database } from "${dbPackageName}";`,
1893
- };
1894
- return [
1895
- copyOperation,
1896
- {
1897
- kind: "replaceAnchors",
1898
- path: to,
1899
- language: "typescript",
1900
- replacements: {
1901
- "db-package-import": replacements[options.sourceFile],
1902
- },
1903
- },
1904
- ];
1905
- }
1906
- return [copyOperation];
1907
- }
1908
- const vikeDbSourceFiles = [
1909
- "db/turbo.json",
1910
- "db/drizzle.config.ts",
1911
- "db/drizzle/migrations/20260709120325_old_captain_flint/migration.sql",
1912
- "db/drizzle/migrations/20260709120325_old_captain_flint/snapshot.json",
1913
- "db/scripts/seed-example.ts",
1914
- "db/src/db.ts",
1915
- "db/src/index.ts",
1916
- "db/src/queries/todos.ts",
1917
- "db/src/readiness.ts",
1918
- "db/src/seed/example.ts",
1919
- "db/src/schema.ts",
1920
- "db/test/todos.test.ts",
1921
- ];
1922
- function vikeDbPackageOperations(context) {
1923
- const packagePath = vikeDbPackagePath();
1924
- return [
1925
- {
1926
- kind: "writeJson",
1927
- to: `${packagePath}/package.json`,
1928
- value: vikeDbPackageJson(context),
1929
- },
1930
- {
1931
- kind: "writeJson",
1932
- to: `${packagePath}/tsconfig.json`,
1933
- value: vikeDbTsconfigJson(),
1934
- },
1935
- ...vikeDbSourceFiles.map((sourceFile) => ({
1936
- kind: "copyFile",
1937
- from: sourceFile,
1938
- to: `${packagePath}/${sourceFile.replace(/^db\//, "")}`,
1939
- })),
1940
- ];
1941
- }
1942
- function vikeDbTsconfigJson() {
1943
- return {
1944
- compilerOptions: {
1945
- ...strictTypeScriptCompilerOptions({
1946
- composite: true,
1947
- declaration: true,
1948
- declarationMap: true,
1949
- module: "esnext",
1950
- moduleResolution: "bundler",
1951
- paths: { "#db/*": ["./src/*"] },
1952
- rootDir: ".",
1953
- types: ["node"],
1954
- }),
1955
- skipLibCheck: true,
1956
- },
1957
- include: ["src/**/*.ts", "test/**/*.ts", "drizzle.config.ts"],
1958
- };
1959
- }
1960
- function workspacePackageGlobsForNodeWorkspace(workspace) {
1961
- return hasVikePackage(workspace)
1962
- ? [workspace.workspacePackageGlob, "packages/*"]
1963
- : [workspace.workspacePackageGlob];
1964
- }
1965
- function gitignoreForNodeWorkspace(workspace) {
1966
- return [
1967
- "node_modules",
1968
- "dist",
1969
- ...(hasVuePackage(workspace) ? ["playwright-report", "test-results"] : []),
1970
- ".env",
1971
- ".template/",
1972
- ".pnpm-store/",
1973
- "",
1974
- ].join("\n");
1975
- }
1976
- function strictTypescriptOperations({ context, state, }) {
1977
- if (state.package === undefined && state.nodeWorkspace === undefined) {
1978
- throw new Error("strict-typescript-root requires a workspace package layout");
1979
- }
1980
- const rootConfigTsconfigOperation = () => {
1981
- if (state.sourceRoots.sharedOxc === undefined) {
1982
- throw new Error("strict-typescript-root requires shared OXC source when rendering tsconfig.config.json");
1983
- }
1984
- return {
1985
- kind: "copyFile",
1986
- from: "tsconfig.config.json",
1987
- to: "tsconfig.config.json",
1988
- sourceRoot: "sharedOxc",
1989
- };
1990
- };
1991
- if (state.nodeWorkspace !== undefined) {
1992
- return [
1993
- {
1994
- kind: "writeJson",
1995
- to: "tsconfig.json",
1996
- value: {
1997
- files: [],
1998
- references: rootTsconfigReferences(state.nodeWorkspace),
1999
- },
2000
- },
2001
- rootConfigTsconfigOperation(),
2002
- ];
2003
- }
2004
- const libraryPackage = state.package;
2005
- return [
2006
- {
2007
- kind: "writeJson",
2008
- to: "tsconfig.json",
2009
- value: {
2010
- files: [],
2011
- },
2012
- },
2013
- rootConfigTsconfigOperation(),
2014
- {
2015
- kind: "writeJson",
2016
- to: `${workspacePackagePath(context, libraryPackage)}/tsconfig.json`,
2017
- value: libraryTsconfigJson(),
2018
- },
2019
- ];
2020
- }
2021
- function rootTsconfigReferences(workspace) {
2022
- return workspace.packages.flatMap((nodePackage) => {
2023
- if (nodePackage.kind === "hono-api") {
2024
- return hasVuePackage(workspace)
2025
- ? []
2026
- : [{ path: `./${nodePackage.path}/tsconfig.json` }];
2027
- }
2028
- if (nodePackage.kind === "vike-app") {
2029
- return [
2030
- { path: "./packages/db" },
2031
- { path: `./${nodePackage.path}/tsconfig.app.json` },
2032
- { path: `./${nodePackage.path}/tsconfig.test.json` },
2033
- { path: `./${nodePackage.path}/tsconfig.node.json` },
2034
- ];
2035
- }
2036
- return [
2037
- { path: `./${nodePackage.path}/tsconfig.app.json` },
2038
- { path: `./${nodePackage.path}/tsconfig.test.json` },
2039
- { path: `./${nodePackage.path}/tsconfig.node.json` },
2040
- ];
2041
- });
2042
- }
2043
- function oxcFormatLintOperations({ state, }) {
2044
- const editorCustomization = editorCustomizationForCapabilities(state.editorCustomizationCapabilities, editorCustomizationDeclarationsForState(state));
2045
- return [
2046
- {
2047
- kind: "copyFile",
2048
- sourceRoot: "sharedOxc",
2049
- from: state.nodeWorkspace && hasVuePackage(state.nodeWorkspace)
2050
- ? "vue/oxlint.config.ts"
2051
- : "node/oxlint.config.ts",
2052
- to: "oxlint.config.ts",
2053
- },
2054
- {
2055
- kind: "copyFile",
2056
- sourceRoot: "sharedOxc",
2057
- from: "oxfmt.config.ts",
2058
- to: "oxfmt.config.ts",
2059
- },
2060
- {
2061
- kind: "writeJson",
2062
- to: ".vscode/extensions.json",
2063
- value: {
2064
- recommendations: editorCustomization.extensions,
2065
- },
2066
- multilineArrays: ["recommendations"],
2067
- },
2068
- {
2069
- kind: "writeJson",
2070
- to: ".vscode/settings.json",
2071
- value: editorCustomization.settings,
2072
- },
2073
- ];
2074
- }
2075
- function nodePnpmDevcontainerOperations({ context, state, }) {
2076
- const additionalLayers = state.nodeWorkspace && hasVuePackage(state.nodeWorkspace)
2077
- ? [browserTestToolLayer()]
2078
- : [];
2079
- const dockerfileFragments = readDevelopmentContainerDockerfileFragments(state, additionalLayers.length === 0 ? [] : ["browserTest"]);
2080
- const editorCustomization = editorCustomizationForCapabilities(state.editorCustomizationCapabilities, editorCustomizationDeclarationsForState(state));
2081
- const developmentContainer = checkedDockerfileFirstNodePnpmDevcontainer({
2082
- name: context.projectName.value,
2083
- layer: nodePnpmToolLayer({
2084
- nodeVersion: context.toolchain.nodeLtsMajor.value,
2085
- packageManagerPin: context.toolchain.packageManagerPin.value,
2086
- }),
2087
- dockerfileFragments,
2088
- additionalLayers,
2089
- extensions: editorCustomization.extensions,
2090
- settings: editorCustomization.settings,
2091
- });
2092
- return [
2093
- {
2094
- kind: "writeJson",
2095
- to: ".devcontainer/devcontainer.json",
2096
- value: developmentContainer.devcontainer,
2097
- multilineArrays: ["customizations.vscode.extensions"],
2098
- },
2099
- {
2100
- ...developmentContainer.dockerfileOperation,
2101
- },
2102
- ];
2103
- }
2104
- function readDevelopmentContainerDockerfileFragments(state, optionalFragments) {
2105
- if (state.devcontainerResource === undefined) {
2106
- throw new Error("Projection Capability composition did not provide a Development Container Shared Resource");
2107
- }
2108
- const fragmentNames = {
2109
- nodePnpm: "node-pnpm.Dockerfile",
2110
- browserTest: "browser-test.Dockerfile",
2111
- rust: "rust.Dockerfile",
2112
- };
2113
- const selected = new Set(optionalFragments);
2114
- return {
2115
- sourceRoot: state.devcontainerResource.sourceRootKey,
2116
- nodePnpm: readDevelopmentContainerDockerfileFragment(state.devcontainerResource, fragmentNames.nodePnpm),
2117
- ...(selected.has("browserTest")
2118
- ? {
2119
- browserTest: readDevelopmentContainerDockerfileFragment(state.devcontainerResource, fragmentNames.browserTest),
2120
- }
2121
- : {}),
2122
- ...(selected.has("rust")
2123
- ? {
2124
- rust: readDevelopmentContainerDockerfileFragment(state.devcontainerResource, fragmentNames.rust),
2125
- }
2126
- : {}),
2127
- };
2128
- }
2129
- function readDevelopmentContainerDockerfileFragment(resource, fragmentName) {
2130
- const filePath = path.join(resource.root, fragmentName);
2131
- try {
2132
- return {
2133
- from: fragmentName,
2134
- text: readFileSync(filePath, "utf8"),
2135
- };
2136
- }
2137
- catch (error) {
2138
- if (isMissingDevelopmentContainerFragmentError(error)) {
2139
- throw new Error(`Development Container Shared Resource ${resource.id} is missing Dockerfile fragment: ${fragmentName}`, { cause: error });
2140
- }
2141
- throw error;
2142
- }
2143
- }
2144
- function isMissingDevelopmentContainerFragmentError(error) {
2145
- return (error instanceof Error &&
2146
- "code" in error &&
2147
- (error.code === "ENOENT" || error.code === "ENOTDIR"));
2148
- }
2149
- function githubMaintenanceOperations() {
2150
- return [
2151
- {
2152
- kind: "copyFile",
2153
- from: ".github/workflows/check.yml",
2154
- to: ".github/workflows/check.yml",
2155
- },
2156
- {
2157
- kind: "copyFile",
2158
- from: ".github/dependabot.yml",
2159
- to: ".github/dependabot.yml",
2160
- },
2161
- ];
2162
- }
2163
- function templateSourceRoot(state, sourcePreset) {
2164
- return templateSourceRootForPreset(state, sourcePreset);
2165
- }
2166
- function templateSourceRootForPreset(state, sourcePreset) {
2167
- return state.projectionSourceRoots.preset(sourcePreset);
2168
- }