@bleedingdev/modern-js-ultramodern-create 3.9.0-ultramodern.2 → 3.9.0-ultramodern.21

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 (442) hide show
  1. package/README.md +43 -74
  2. package/dist/cjs/cli/package-source.cjs +2 -2
  3. package/dist/cjs/cli/project-setup.cjs +2 -22
  4. package/dist/cjs/index.cjs +9 -1
  5. package/dist/cjs/locale/en.cjs +2 -1
  6. package/dist/cjs/locale/zh.cjs +2 -1
  7. package/dist/cjs/ultramodern-package-source.cjs +13 -9
  8. package/dist/cjs/ultramodern-release-cohort.cjs +6 -21
  9. package/dist/cjs/ultramodern-tooling/commands/cloudflare-output-verify.cjs +49 -56
  10. package/dist/cjs/ultramodern-tooling/commands/context.cjs +11 -29
  11. package/dist/cjs/ultramodern-tooling/commands/routes-generate-app.cjs +67 -0
  12. package/dist/cjs/ultramodern-tooling/commands/routes-generate.cjs +24 -53
  13. package/dist/cjs/ultramodern-tooling/commands/validate.cjs +5 -11
  14. package/dist/cjs/ultramodern-tooling/commands.cjs +15 -8
  15. package/dist/cjs/ultramodern-tooling/config/index.cjs +10 -24
  16. package/dist/cjs/ultramodern-tooling/config/load.cjs +12 -10
  17. package/dist/cjs/ultramodern-tooling/config/metadata.cjs +34 -32
  18. package/dist/cjs/ultramodern-tooling/config/normalize.cjs +165 -164
  19. package/dist/cjs/ultramodern-workspace/add-shell.cjs +118 -118
  20. package/dist/cjs/ultramodern-workspace/add-vertical/execute.cjs +121 -25
  21. package/dist/cjs/ultramodern-workspace/add-vertical/plan.cjs +14 -160
  22. package/dist/cjs/ultramodern-workspace/add-vertical/preflight.cjs +16 -48
  23. package/dist/cjs/ultramodern-workspace/add-vertical/preview.cjs +78 -0
  24. package/dist/cjs/ultramodern-workspace/add-vertical/shell-files.cjs +87 -24
  25. package/dist/cjs/ultramodern-workspace/add-vertical/topology.cjs +4 -1
  26. package/dist/cjs/ultramodern-workspace/add-vertical/transaction.cjs +378 -45
  27. package/dist/cjs/ultramodern-workspace/add-vertical/workspace-state.cjs +21 -44
  28. package/dist/cjs/ultramodern-workspace/add-vertical.cjs +0 -9
  29. package/dist/cjs/ultramodern-workspace/api/client.cjs +5 -5
  30. package/dist/cjs/ultramodern-workspace/api/contracts.cjs +2 -2
  31. package/dist/cjs/ultramodern-workspace/api/rpc.cjs +20 -18
  32. package/dist/cjs/ultramodern-workspace/api/service.cjs +49 -24
  33. package/dist/cjs/ultramodern-workspace/api/shared.cjs +28 -18
  34. package/dist/cjs/ultramodern-workspace/app-files.cjs +3 -23
  35. package/dist/cjs/ultramodern-workspace/backend-federation.cjs +27 -27
  36. package/dist/cjs/ultramodern-workspace/contracts.cjs +14 -183
  37. package/dist/cjs/ultramodern-workspace/delivery-unit-schema/surfaces.cjs +85 -0
  38. package/dist/cjs/ultramodern-workspace/delivery-unit-schema/types.cjs +8 -85
  39. package/dist/cjs/ultramodern-workspace/delivery-unit-stamp.cjs +16 -4
  40. package/dist/cjs/ultramodern-workspace/delivery-unit-sync.cjs +27 -17
  41. package/dist/cjs/ultramodern-workspace/delivery-unit.cjs +16 -10
  42. package/dist/cjs/ultramodern-workspace/demo-components.cjs +66 -433
  43. package/dist/cjs/ultramodern-workspace/descriptors.cjs +0 -4
  44. package/dist/cjs/ultramodern-workspace/fs-io.cjs +37 -2
  45. package/dist/cjs/ultramodern-workspace/generation-result.cjs +4 -4
  46. package/dist/cjs/ultramodern-workspace/index.cjs +2 -5
  47. package/dist/cjs/ultramodern-workspace/mf-validation/constants.cjs +0 -6
  48. package/dist/cjs/ultramodern-workspace/mf-validation/discovery.cjs +6 -6
  49. package/dist/cjs/{ultramodern-tooling/commands/migrate-strict-effect/generated-patches.cjs → ultramodern-workspace/mf-validation/exposes.cjs} +13 -17
  50. package/dist/cjs/ultramodern-workspace/mf-validation/inspect.cjs +26 -7
  51. package/dist/cjs/ultramodern-workspace/mf-validation/object-literal.cjs +21 -122
  52. package/dist/cjs/ultramodern-workspace/mf-validation/path-utils.cjs +37 -38
  53. package/dist/cjs/ultramodern-workspace/mf-validation/syntax.cjs +93 -153
  54. package/dist/cjs/ultramodern-workspace/mf-validation.cjs +4 -0
  55. package/dist/cjs/ultramodern-workspace/module-federation/config.cjs +24 -29
  56. package/dist/cjs/ultramodern-workspace/module-federation/reexport-module.cjs +39 -58
  57. package/dist/cjs/ultramodern-workspace/module-federation/remote-refs.cjs +1 -43
  58. package/dist/cjs/ultramodern-workspace/package-json.cjs +63 -37
  59. package/dist/cjs/ultramodern-workspace/patch-inventory.cjs +104 -0
  60. package/dist/cjs/ultramodern-workspace/policy.cjs +3 -577
  61. package/dist/cjs/ultramodern-workspace/public-surface.cjs +3 -3
  62. package/dist/cjs/ultramodern-workspace/routes.cjs +2 -11
  63. package/dist/cjs/ultramodern-workspace/shared-patches.cjs +12 -2
  64. package/dist/cjs/ultramodern-workspace/shells.cjs +0 -70
  65. package/dist/cjs/ultramodern-workspace/tooling-command-catalog.cjs +27 -41
  66. package/dist/cjs/ultramodern-workspace/tsconfigs.cjs +8 -2
  67. package/dist/cjs/ultramodern-workspace/validation/architecture.cjs +397 -0
  68. package/dist/cjs/ultramodern-workspace/validation/assertions.cjs +140 -0
  69. package/dist/cjs/ultramodern-workspace/validation/types.cjs +18 -0
  70. package/dist/cjs/ultramodern-workspace/validation/workspace.cjs +344 -0
  71. package/dist/cjs/ultramodern-workspace/versions.cjs +81 -45
  72. package/dist/cjs/ultramodern-workspace/workspace-artifact-ownership.cjs +183 -0
  73. package/dist/cjs/ultramodern-workspace/workspace-script-plan.cjs +36 -25
  74. package/dist/cjs/ultramodern-workspace/workspace-scripts.cjs +11 -200
  75. package/dist/cjs/ultramodern-workspace/workspace-validation-contract.cjs +62 -373
  76. package/dist/cjs/ultramodern-workspace/write-app.cjs +19 -11
  77. package/dist/cjs/ultramodern-workspace/write-workspace.cjs +20 -50
  78. package/dist/cjs/ultramodern-workspace/zerops.cjs +2 -0
  79. package/dist/esm/cli/package-source.js +3 -3
  80. package/dist/esm/cli/project-setup.js +2 -22
  81. package/dist/esm/index.js +10 -2
  82. package/dist/esm/locale/en.js +2 -1
  83. package/dist/esm/locale/zh.js +2 -1
  84. package/dist/esm/ultramodern-package-source.js +14 -4
  85. package/dist/esm/ultramodern-release-cohort.js +5 -14
  86. package/dist/esm/ultramodern-tooling/commands/cloudflare-output-verify.js +49 -56
  87. package/dist/esm/ultramodern-tooling/commands/context.js +10 -26
  88. package/dist/esm/ultramodern-tooling/commands/routes-generate-app.js +35 -0
  89. package/dist/esm/ultramodern-tooling/commands/routes-generate.js +25 -54
  90. package/dist/esm/ultramodern-tooling/commands/validate.js +6 -12
  91. package/dist/esm/ultramodern-tooling/commands.js +15 -9
  92. package/dist/esm/ultramodern-tooling/config/index.js +0 -2
  93. package/dist/esm/ultramodern-tooling/config/load.js +9 -9
  94. package/dist/esm/ultramodern-tooling/config/metadata.js +33 -28
  95. package/dist/esm/ultramodern-tooling/config/normalize.js +159 -156
  96. package/dist/esm/ultramodern-workspace/add-shell.js +124 -123
  97. package/dist/esm/ultramodern-workspace/add-vertical/execute.js +119 -27
  98. package/dist/esm/ultramodern-workspace/add-vertical/plan.js +16 -150
  99. package/dist/esm/ultramodern-workspace/add-vertical/preflight.js +15 -47
  100. package/dist/esm/ultramodern-workspace/add-vertical/preview.js +40 -0
  101. package/dist/esm/ultramodern-workspace/add-vertical/shell-files.js +87 -25
  102. package/dist/esm/ultramodern-workspace/add-vertical/topology.js +4 -1
  103. package/dist/esm/ultramodern-workspace/add-vertical/transaction.js +373 -46
  104. package/dist/esm/ultramodern-workspace/add-vertical/workspace-state.js +17 -34
  105. package/dist/esm/ultramodern-workspace/add-vertical.js +1 -1
  106. package/dist/esm/ultramodern-workspace/api/client.js +5 -5
  107. package/dist/esm/ultramodern-workspace/api/contracts.js +2 -2
  108. package/dist/esm/ultramodern-workspace/api/rpc.js +20 -18
  109. package/dist/esm/ultramodern-workspace/api/service.js +49 -24
  110. package/dist/esm/ultramodern-workspace/api/shared.js +28 -18
  111. package/dist/esm/ultramodern-workspace/app-files.js +3 -23
  112. package/dist/esm/ultramodern-workspace/backend-federation.js +5 -5
  113. package/dist/esm/ultramodern-workspace/contracts.js +14 -180
  114. package/dist/esm/ultramodern-workspace/delivery-unit-schema/surfaces.js +41 -0
  115. package/dist/esm/ultramodern-workspace/delivery-unit-schema/types.js +1 -75
  116. package/dist/esm/ultramodern-workspace/delivery-unit-stamp.js +16 -4
  117. package/dist/esm/ultramodern-workspace/delivery-unit-sync.js +28 -18
  118. package/dist/esm/ultramodern-workspace/delivery-unit.js +12 -6
  119. package/dist/esm/ultramodern-workspace/demo-components.js +67 -428
  120. package/dist/esm/ultramodern-workspace/descriptors.js +1 -2
  121. package/dist/esm/ultramodern-workspace/fs-io.js +37 -2
  122. package/dist/esm/ultramodern-workspace/generation-result.js +3 -3
  123. package/dist/esm/ultramodern-workspace/index.js +1 -1
  124. package/dist/esm/ultramodern-workspace/mf-validation/constants.js +1 -4
  125. package/dist/esm/ultramodern-workspace/mf-validation/discovery.js +7 -7
  126. package/dist/esm/ultramodern-workspace/mf-validation/exposes.js +14 -0
  127. package/dist/esm/ultramodern-workspace/mf-validation/inspect.js +27 -8
  128. package/dist/esm/ultramodern-workspace/mf-validation/object-literal.js +22 -123
  129. package/dist/esm/ultramodern-workspace/mf-validation/path-utils.js +36 -34
  130. package/dist/esm/ultramodern-workspace/mf-validation/syntax.js +83 -143
  131. package/dist/esm/ultramodern-workspace/mf-validation.js +1 -0
  132. package/dist/esm/ultramodern-workspace/module-federation/config.js +25 -30
  133. package/dist/esm/ultramodern-workspace/module-federation/reexport-module.js +39 -58
  134. package/dist/esm/ultramodern-workspace/module-federation/remote-refs.js +1 -43
  135. package/dist/esm/ultramodern-workspace/package-json.js +58 -32
  136. package/dist/esm/ultramodern-workspace/patch-inventory.js +66 -0
  137. package/dist/esm/ultramodern-workspace/policy.js +2 -564
  138. package/dist/esm/ultramodern-workspace/public-surface.js +3 -3
  139. package/dist/esm/ultramodern-workspace/routes.js +2 -11
  140. package/dist/esm/ultramodern-workspace/shared-patches.js +2 -2
  141. package/dist/esm/ultramodern-workspace/shells.js +3 -67
  142. package/dist/esm/ultramodern-workspace/tooling-command-catalog.js +22 -37
  143. package/dist/esm/ultramodern-workspace/tsconfigs.js +9 -3
  144. package/dist/esm/ultramodern-workspace/validation/architecture.js +348 -0
  145. package/dist/esm/ultramodern-workspace/validation/assertions.js +65 -0
  146. package/dist/esm/ultramodern-workspace/validation/types.js +0 -0
  147. package/dist/esm/ultramodern-workspace/validation/workspace.js +286 -0
  148. package/dist/esm/ultramodern-workspace/versions.js +74 -29
  149. package/dist/esm/ultramodern-workspace/workspace-artifact-ownership.js +128 -0
  150. package/dist/esm/ultramodern-workspace/workspace-script-plan.js +35 -27
  151. package/dist/esm/ultramodern-workspace/workspace-scripts.js +10 -190
  152. package/dist/esm/ultramodern-workspace/workspace-validation-contract.js +65 -376
  153. package/dist/esm/ultramodern-workspace/write-app.js +18 -10
  154. package/dist/esm/ultramodern-workspace/write-workspace.js +25 -52
  155. package/dist/esm/ultramodern-workspace/zerops.js +2 -0
  156. package/dist/esm-node/cli/package-source.js +3 -3
  157. package/dist/esm-node/cli/project-setup.js +2 -22
  158. package/dist/esm-node/index.js +10 -2
  159. package/dist/esm-node/locale/en.js +2 -1
  160. package/dist/esm-node/locale/zh.js +2 -1
  161. package/dist/esm-node/ultramodern-package-source.js +14 -4
  162. package/dist/esm-node/ultramodern-release-cohort.js +5 -14
  163. package/dist/esm-node/ultramodern-tooling/commands/cloudflare-output-verify.js +49 -56
  164. package/dist/esm-node/ultramodern-tooling/commands/context.js +10 -26
  165. package/dist/esm-node/ultramodern-tooling/commands/routes-generate-app.js +36 -0
  166. package/dist/esm-node/ultramodern-tooling/commands/routes-generate.js +25 -54
  167. package/dist/esm-node/ultramodern-tooling/commands/validate.js +6 -12
  168. package/dist/esm-node/ultramodern-tooling/commands.js +15 -9
  169. package/dist/esm-node/ultramodern-tooling/config/index.js +0 -2
  170. package/dist/esm-node/ultramodern-tooling/config/load.js +9 -9
  171. package/dist/esm-node/ultramodern-tooling/config/metadata.js +33 -28
  172. package/dist/esm-node/ultramodern-tooling/config/normalize.js +159 -156
  173. package/dist/esm-node/ultramodern-workspace/add-shell.js +124 -123
  174. package/dist/esm-node/ultramodern-workspace/add-vertical/execute.js +119 -27
  175. package/dist/esm-node/ultramodern-workspace/add-vertical/plan.js +16 -150
  176. package/dist/esm-node/ultramodern-workspace/add-vertical/preflight.js +15 -47
  177. package/dist/esm-node/ultramodern-workspace/add-vertical/preview.js +41 -0
  178. package/dist/esm-node/ultramodern-workspace/add-vertical/shell-files.js +87 -25
  179. package/dist/esm-node/ultramodern-workspace/add-vertical/topology.js +4 -1
  180. package/dist/esm-node/ultramodern-workspace/add-vertical/transaction.js +373 -46
  181. package/dist/esm-node/ultramodern-workspace/add-vertical/workspace-state.js +17 -34
  182. package/dist/esm-node/ultramodern-workspace/add-vertical.js +1 -1
  183. package/dist/esm-node/ultramodern-workspace/api/client.js +5 -5
  184. package/dist/esm-node/ultramodern-workspace/api/contracts.js +2 -2
  185. package/dist/esm-node/ultramodern-workspace/api/rpc.js +20 -18
  186. package/dist/esm-node/ultramodern-workspace/api/service.js +49 -24
  187. package/dist/esm-node/ultramodern-workspace/api/shared.js +28 -18
  188. package/dist/esm-node/ultramodern-workspace/app-files.js +3 -23
  189. package/dist/esm-node/ultramodern-workspace/backend-federation.js +5 -5
  190. package/dist/esm-node/ultramodern-workspace/contracts.js +14 -180
  191. package/dist/esm-node/ultramodern-workspace/delivery-unit-schema/surfaces.js +42 -0
  192. package/dist/esm-node/ultramodern-workspace/delivery-unit-schema/types.js +1 -75
  193. package/dist/esm-node/ultramodern-workspace/delivery-unit-stamp.js +16 -4
  194. package/dist/esm-node/ultramodern-workspace/delivery-unit-sync.js +28 -18
  195. package/dist/esm-node/ultramodern-workspace/delivery-unit.js +12 -6
  196. package/dist/esm-node/ultramodern-workspace/demo-components.js +67 -428
  197. package/dist/esm-node/ultramodern-workspace/descriptors.js +1 -2
  198. package/dist/esm-node/ultramodern-workspace/fs-io.js +37 -2
  199. package/dist/esm-node/ultramodern-workspace/generation-result.js +3 -3
  200. package/dist/esm-node/ultramodern-workspace/index.js +1 -1
  201. package/dist/esm-node/ultramodern-workspace/mf-validation/constants.js +1 -4
  202. package/dist/esm-node/ultramodern-workspace/mf-validation/discovery.js +7 -7
  203. package/dist/esm-node/ultramodern-workspace/mf-validation/exposes.js +15 -0
  204. package/dist/esm-node/ultramodern-workspace/mf-validation/inspect.js +27 -8
  205. package/dist/esm-node/ultramodern-workspace/mf-validation/object-literal.js +22 -123
  206. package/dist/esm-node/ultramodern-workspace/mf-validation/path-utils.js +36 -34
  207. package/dist/esm-node/ultramodern-workspace/mf-validation/syntax.js +83 -143
  208. package/dist/esm-node/ultramodern-workspace/mf-validation.js +1 -0
  209. package/dist/esm-node/ultramodern-workspace/module-federation/config.js +25 -30
  210. package/dist/esm-node/ultramodern-workspace/module-federation/reexport-module.js +39 -58
  211. package/dist/esm-node/ultramodern-workspace/module-federation/remote-refs.js +1 -43
  212. package/dist/esm-node/ultramodern-workspace/package-json.js +58 -32
  213. package/dist/esm-node/ultramodern-workspace/patch-inventory.js +67 -0
  214. package/dist/esm-node/ultramodern-workspace/policy.js +2 -564
  215. package/dist/esm-node/ultramodern-workspace/public-surface.js +3 -3
  216. package/dist/esm-node/ultramodern-workspace/routes.js +2 -11
  217. package/dist/esm-node/ultramodern-workspace/shared-patches.js +2 -2
  218. package/dist/esm-node/ultramodern-workspace/shells.js +3 -67
  219. package/dist/esm-node/ultramodern-workspace/tooling-command-catalog.js +22 -37
  220. package/dist/esm-node/ultramodern-workspace/tsconfigs.js +9 -3
  221. package/dist/esm-node/ultramodern-workspace/validation/architecture.js +349 -0
  222. package/dist/esm-node/ultramodern-workspace/validation/assertions.js +66 -0
  223. package/dist/esm-node/ultramodern-workspace/validation/types.js +1 -0
  224. package/dist/esm-node/ultramodern-workspace/validation/workspace.js +287 -0
  225. package/dist/esm-node/ultramodern-workspace/versions.js +74 -29
  226. package/dist/esm-node/ultramodern-workspace/workspace-artifact-ownership.js +129 -0
  227. package/dist/esm-node/ultramodern-workspace/workspace-script-plan.js +35 -27
  228. package/dist/esm-node/ultramodern-workspace/workspace-scripts.js +10 -190
  229. package/dist/esm-node/ultramodern-workspace/workspace-validation-contract.js +65 -376
  230. package/dist/esm-node/ultramodern-workspace/write-app.js +18 -10
  231. package/dist/esm-node/ultramodern-workspace/write-workspace.js +25 -52
  232. package/dist/esm-node/ultramodern-workspace/zerops.js +2 -0
  233. package/dist/types/cli/project-setup.d.ts +1 -1
  234. package/dist/types/locale/en.d.ts +1 -0
  235. package/dist/types/locale/index.d.ts +2 -0
  236. package/dist/types/locale/zh.d.ts +1 -0
  237. package/dist/types/ultramodern-package-source.d.ts +2 -4
  238. package/dist/types/ultramodern-release-cohort.d.ts +1 -3
  239. package/dist/types/ultramodern-tooling/commands/cloudflare-output-verify.d.ts +2 -2
  240. package/dist/types/ultramodern-tooling/commands/context.d.ts +4 -1
  241. package/dist/types/ultramodern-tooling/commands/routes-generate-app.d.ts +1 -0
  242. package/dist/types/ultramodern-tooling/commands/routes-generate.d.ts +1 -1
  243. package/dist/types/ultramodern-tooling/commands/validate.d.ts +1 -1
  244. package/dist/types/ultramodern-tooling/config/index.d.ts +0 -2
  245. package/dist/types/ultramodern-tooling/config/load.d.ts +10 -2
  246. package/dist/types/ultramodern-tooling/config/metadata.d.ts +2 -2
  247. package/dist/types/ultramodern-tooling/config/normalize.d.ts +19 -19
  248. package/dist/types/ultramodern-tooling/config/types.d.ts +2 -9
  249. package/dist/types/ultramodern-workspace/add-shell.d.ts +1 -1
  250. package/dist/types/ultramodern-workspace/add-vertical/execute.d.ts +1 -0
  251. package/dist/types/ultramodern-workspace/add-vertical/preflight.d.ts +4 -3
  252. package/dist/types/ultramodern-workspace/add-vertical/preview.d.ts +4 -0
  253. package/dist/types/ultramodern-workspace/add-vertical/shell-files.d.ts +7 -2
  254. package/dist/types/ultramodern-workspace/add-vertical/transaction.d.ts +32 -6
  255. package/dist/types/ultramodern-workspace/add-vertical/workspace-state.d.ts +10 -7
  256. package/dist/types/ultramodern-workspace/add-vertical.d.ts +1 -1
  257. package/dist/types/ultramodern-workspace/api/client.d.ts +3 -1
  258. package/dist/types/ultramodern-workspace/api/rpc.d.ts +1 -1
  259. package/dist/types/ultramodern-workspace/api/service.d.ts +3 -1
  260. package/dist/types/ultramodern-workspace/api/shared.d.ts +2 -0
  261. package/dist/types/ultramodern-workspace/backend-federation.d.ts +1 -1
  262. package/dist/types/ultramodern-workspace/contracts.d.ts +1 -3
  263. package/dist/types/ultramodern-workspace/delivery-unit-schema/surfaces.d.ts +17 -0
  264. package/dist/types/ultramodern-workspace/delivery-unit-schema/types.d.ts +3 -68
  265. package/dist/types/ultramodern-workspace/delivery-unit-stamp.d.ts +2 -2
  266. package/dist/types/ultramodern-workspace/delivery-unit.d.ts +3 -3
  267. package/dist/types/ultramodern-workspace/demo-components.d.ts +0 -3
  268. package/dist/types/ultramodern-workspace/descriptors.d.ts +0 -1
  269. package/dist/types/ultramodern-workspace/fs-io.d.ts +1 -1
  270. package/dist/types/ultramodern-workspace/index.d.ts +1 -1
  271. package/dist/types/ultramodern-workspace/mf-validation/constants.d.ts +0 -1
  272. package/dist/types/ultramodern-workspace/mf-validation/exposes.d.ts +11 -0
  273. package/dist/types/ultramodern-workspace/mf-validation/path-utils.d.ts +2 -3
  274. package/dist/types/ultramodern-workspace/mf-validation/syntax.d.ts +4 -3
  275. package/dist/types/ultramodern-workspace/mf-validation/types.d.ts +1 -0
  276. package/dist/types/ultramodern-workspace/mf-validation.d.ts +1 -0
  277. package/dist/types/ultramodern-workspace/module-federation/config.d.ts +1 -1
  278. package/dist/types/ultramodern-workspace/module-federation/reexport-module.d.ts +2 -2
  279. package/dist/types/ultramodern-workspace/package-json.d.ts +1 -1
  280. package/dist/types/ultramodern-workspace/patch-inventory.d.ts +10 -0
  281. package/dist/types/ultramodern-workspace/policy.d.ts +31 -209
  282. package/dist/types/ultramodern-workspace/routes.d.ts +6 -1
  283. package/dist/types/ultramodern-workspace/shells.d.ts +2 -15
  284. package/dist/types/ultramodern-workspace/tooling-command-catalog.d.ts +8 -7
  285. package/dist/types/ultramodern-workspace/types.d.ts +9 -9
  286. package/dist/types/ultramodern-workspace/validation/architecture.d.ts +2 -0
  287. package/dist/types/ultramodern-workspace/validation/assertions.d.ts +14 -0
  288. package/dist/types/ultramodern-workspace/validation/types.d.ts +9 -0
  289. package/dist/types/ultramodern-workspace/validation/workspace.d.ts +6 -0
  290. package/dist/types/ultramodern-workspace/versions.d.ts +73 -28
  291. package/dist/types/ultramodern-workspace/workspace-artifact-ownership.d.ts +18 -0
  292. package/dist/types/ultramodern-workspace/workspace-script-plan.d.ts +4 -5
  293. package/dist/types/ultramodern-workspace/workspace-scripts.d.ts +8 -13
  294. package/dist/types/ultramodern-workspace/workspace-validation-contract.d.ts +22 -188
  295. package/dist/types/ultramodern-workspace/write-workspace.d.ts +1 -3
  296. package/package.json +18 -11
  297. package/{template-workspace/.modernjs/release-cohort.json → release-cohort.json} +88 -40
  298. package/template-workspace/.codex/skills/rspack-tracing/scripts/analyze_trace.js +1 -1
  299. package/template-workspace/README.md.handlebars +20 -35
  300. package/template-workspace/oxfmt.config.ts +3 -0
  301. package/template-workspace/pnpm-workspace.yaml.handlebars +0 -24
  302. package/template-workspace/scripts/bootstrap-agent-skills.mjs +4 -4
  303. package/templates/packages/shared-contracts-index.ts +4 -332
  304. package/templates/workspace/apps/modern.config.shared-module-federation.ts.handlebars +10 -0
  305. package/templates/workspace/apps/modern.config.ts.handlebars +13 -27
  306. package/templates/workspace/apps/shared/src/routes/ultramodern-route-metadata.ts.handlebars +21 -11
  307. package/templates/workspace/apps/shell-super-app/src/routes/[lang]/page.tsx.handlebars +20 -20
  308. package/templates/workspace/apps/shell-super-app/src/routes/vertical-components.helpers.tsx.handlebars +4 -6
  309. package/templates/workspace/apps/shell-super-app/src/routes/vertical-components.imports.tsx.handlebars +2 -2
  310. package/templates/workspace/apps/shell-super-app/src/routes/vertical-components.tsx.handlebars +11 -11
  311. package/templates/workspace/apps/shell-super-app/src/routes/vertical-components.worker.helpers.tsx.handlebars +1 -1
  312. package/templates/workspace/apps/shell-super-app/src/routes/vertical-components.worker.imports.tsx.handlebars +1 -1
  313. package/templates/workspace-scripts/generate-node-backend-federation.mjs +68 -77
  314. package/templates/workspace-scripts/generate-public-surface-assets.mjs +107 -207
  315. package/templates/workspace-scripts/materialize-zerops-runtime.mjs +12 -19
  316. package/templates/workspace-scripts/proof-cloudflare-version.mjs +53 -444
  317. package/templates/workspace-scripts/proof-node-backend-federation.mjs +212 -91
  318. package/templates/workspace-scripts/{proof-workerd-ssr.mts → proof-workerd-ssr.mjs} +434 -239
  319. package/templates/workspace-scripts/ultramodern-cloudflare-proof.mjs +25 -7
  320. package/templates/workspace-scripts/ultramodern-performance-readiness.mjs +45 -147
  321. package/templates/workspace-scripts/ultramodern-typecheck.mjs +1 -1
  322. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/api-metadata.cjs +0 -212
  323. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/declaration-patches.cjs +0 -47
  324. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/dependency-usage.cjs +0 -112
  325. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-backend-federation.cjs +0 -55
  326. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-build-identity.cjs +0 -102
  327. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-modern-configs.cjs +0 -195
  328. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxfmt.cjs +0 -146
  329. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxlint.cjs +0 -110
  330. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-removal.cjs +0 -67
  331. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-typescript.cjs +0 -307
  332. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-zerops.cjs +0 -58
  333. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts.cjs +0 -71
  334. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-ui-source.cjs +0 -151
  335. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/help.cjs +0 -67
  336. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/install.cjs +0 -52
  337. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/io.cjs +0 -447
  338. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.cjs +0 -323
  339. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/package-source.cjs +0 -87
  340. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/pnpm-policy.cjs +0 -612
  341. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.cjs +0 -376
  342. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/policy-constants.cjs +0 -73
  343. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/react-router-retirement.cjs +0 -215
  344. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/toolchain-pins.cjs +0 -135
  345. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect.cjs +0 -454
  346. package/dist/cjs/ultramodern-tooling/config/constants.cjs +0 -48
  347. package/dist/cjs/ultramodern-tooling/config/synthesize.cjs +0 -157
  348. package/dist/cjs/ultramodern-workspace/delivery-unit-schema/up-projection.cjs +0 -188
  349. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/api-metadata.js +0 -154
  350. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/declaration-patches.js +0 -9
  351. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/dependency-usage.js +0 -63
  352. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-backend-federation.js +0 -7
  353. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-build-identity.js +0 -47
  354. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-modern-configs.js +0 -146
  355. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxfmt.js +0 -97
  356. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxlint.js +0 -61
  357. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-removal.js +0 -16
  358. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-typescript.js +0 -258
  359. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-zerops.js +0 -10
  360. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts.js +0 -8
  361. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-patches.js +0 -15
  362. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-ui-source.js +0 -100
  363. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/help.js +0 -29
  364. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/install.js +0 -14
  365. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/io.js +0 -385
  366. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.js +0 -276
  367. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/package-source.js +0 -49
  368. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/pnpm-policy.js +0 -559
  369. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.js +0 -329
  370. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/policy-constants.js +0 -19
  371. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/react-router-retirement.js +0 -148
  372. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/toolchain-pins.js +0 -80
  373. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect.js +0 -405
  374. package/dist/esm/ultramodern-tooling/config/constants.js +0 -4
  375. package/dist/esm/ultramodern-tooling/config/synthesize.js +0 -108
  376. package/dist/esm/ultramodern-workspace/delivery-unit-schema/up-projection.js +0 -129
  377. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/api-metadata.js +0 -155
  378. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/declaration-patches.js +0 -10
  379. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/dependency-usage.js +0 -64
  380. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-backend-federation.js +0 -8
  381. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-build-identity.js +0 -48
  382. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-modern-configs.js +0 -147
  383. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxfmt.js +0 -98
  384. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxlint.js +0 -62
  385. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-removal.js +0 -17
  386. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-typescript.js +0 -259
  387. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-zerops.js +0 -11
  388. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts.js +0 -9
  389. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-patches.js +0 -16
  390. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-ui-source.js +0 -101
  391. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/help.js +0 -30
  392. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/install.js +0 -15
  393. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/io.js +0 -386
  394. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.js +0 -277
  395. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/package-source.js +0 -50
  396. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/pnpm-policy.js +0 -560
  397. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.js +0 -330
  398. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/policy-constants.js +0 -20
  399. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/react-router-retirement.js +0 -149
  400. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/toolchain-pins.js +0 -81
  401. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect.js +0 -406
  402. package/dist/esm-node/ultramodern-tooling/config/constants.js +0 -5
  403. package/dist/esm-node/ultramodern-tooling/config/synthesize.js +0 -109
  404. package/dist/esm-node/ultramodern-workspace/delivery-unit-schema/up-projection.js +0 -130
  405. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/api-metadata.d.ts +0 -12
  406. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/declaration-patches.d.ts +0 -4
  407. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/dependency-usage.d.ts +0 -1
  408. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-backend-federation.d.ts +0 -3
  409. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-build-identity.d.ts +0 -5
  410. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-modern-configs.d.ts +0 -3
  411. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxfmt.d.ts +0 -2
  412. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxlint.d.ts +0 -2
  413. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-removal.d.ts +0 -4
  414. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-typescript.d.ts +0 -3
  415. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-zerops.d.ts +0 -3
  416. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts.d.ts +0 -8
  417. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-patches.d.ts +0 -3
  418. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-ui-source.d.ts +0 -3
  419. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/help.d.ts +0 -1
  420. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/install.d.ts +0 -2
  421. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/io.d.ts +0 -26
  422. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.d.ts +0 -25
  423. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/package-source.d.ts +0 -3
  424. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/pnpm-policy.d.ts +0 -26
  425. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.d.ts +0 -26
  426. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/policy-constants.d.ts +0 -6
  427. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/react-router-retirement.d.ts +0 -37
  428. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/toolchain-pins.d.ts +0 -4
  429. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect.d.ts +0 -2
  430. package/dist/types/ultramodern-tooling/config/constants.d.ts +0 -3
  431. package/dist/types/ultramodern-tooling/config/synthesize.d.ts +0 -5
  432. package/dist/types/ultramodern-workspace/delivery-unit-schema/up-projection.d.ts +0 -189
  433. package/template-workspace/patches/@module-federation__bridge-react@2.9.0.patch +0 -47
  434. package/template-workspace/patches/@module-federation__dts-plugin@2.9.0.patch +0 -26
  435. package/template-workspace/patches/@module-federation__modern-js-v3@2.9.0.patch +0 -268
  436. package/template-workspace/patches/@module-federation__runtime-core@2.9.0.patch +0 -13
  437. package/template-workspace/patches/drizzle-orm-ts7-strict-declarations.patch +0 -471
  438. package/template-workspace/patches/msgpackr@2.1.0.patch +0 -30
  439. package/template-workspace/patches/zod@4.5.4.patch +0 -56
  440. package/templates/workspace-scripts/check-ultramodern-api-boundaries.mts +0 -779
  441. package/templates/workspace-scripts/check-ultramodern-i18n-boundaries.mts +0 -9
  442. package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +0 -4109
@@ -1,100 +0,0 @@
1
- import node_fs from "node:fs";
2
- import { isDeepStrictEqual } from "node:util";
3
- import "./io.js";
4
- const multiCharacterTokens = [
5
- '===',
6
- '!==',
7
- '**=',
8
- '&&=',
9
- '||=',
10
- '??=',
11
- '...',
12
- '=>',
13
- '==',
14
- '!=',
15
- '<=',
16
- '>=',
17
- '++',
18
- '--',
19
- '&&',
20
- '||',
21
- '??',
22
- '?.',
23
- '**',
24
- '+=',
25
- '-=',
26
- '*=',
27
- '/=',
28
- '%=',
29
- '&=',
30
- '|=',
31
- '^=',
32
- '</',
33
- '/>'
34
- ];
35
- function isIdentifierPart(character) {
36
- return /[$_\p{ID_Continue}\u200C\u200D]/u.test(character);
37
- }
38
- function generatedUiSourceTokens(source) {
39
- const tokens = [];
40
- let index = 0;
41
- while(index < source.length){
42
- const character = source[index] ?? '';
43
- if (/\s/u.test(character)) {
44
- index += 1;
45
- continue;
46
- }
47
- if (source.startsWith('//', index)) {
48
- const lineEnd = source.indexOf('\n', index + 2);
49
- index = lineEnd < 0 ? source.length : lineEnd + 1;
50
- continue;
51
- }
52
- if (source.startsWith('/*', index)) {
53
- const commentEnd = source.indexOf('*/', index + 2);
54
- index = commentEnd < 0 ? source.length : commentEnd + 2;
55
- continue;
56
- }
57
- if ("'" === character || '"' === character || '`' === character) {
58
- const quote = character;
59
- const start = index;
60
- index += 1;
61
- let escaped = false;
62
- while(index < source.length){
63
- const current = source[index] ?? '';
64
- index += 1;
65
- if (escaped) escaped = false;
66
- else if ('\\' === current) escaped = true;
67
- else if (current === quote) break;
68
- }
69
- tokens.push(`literal:${source.slice(start, index)}`);
70
- continue;
71
- }
72
- if (isIdentifierPart(character)) {
73
- const start = index;
74
- index += 1;
75
- while(isIdentifierPart(source[index] ?? ''))index += 1;
76
- tokens.push(`word:${source.slice(start, index)}`);
77
- continue;
78
- }
79
- const multiCharacterToken = multiCharacterTokens.find((token)=>source.startsWith(token, index));
80
- if (multiCharacterToken) {
81
- tokens.push(`punctuator:${multiCharacterToken}`);
82
- index += multiCharacterToken.length;
83
- continue;
84
- }
85
- tokens.push(`punctuator:${character}`);
86
- index += 1;
87
- }
88
- return tokens;
89
- }
90
- function generatedUiSourceRequiresRewrite(existingSource, nextSource) {
91
- return !isDeepStrictEqual(generatedUiSourceTokens(existingSource), generatedUiSourceTokens(nextSource));
92
- }
93
- function writeGeneratedUiSourceIfChanged(io, filePath, nextSource) {
94
- if (node_fs.existsSync(filePath)) {
95
- const existingSource = node_fs.readFileSync(filePath, 'utf-8');
96
- if (!generatedUiSourceRequiresRewrite(existingSource, nextSource)) return io.writeGenerated(filePath, existingSource);
97
- }
98
- return io.writeGenerated(filePath, nextSource);
99
- }
100
- export { generatedUiSourceRequiresRewrite, writeGeneratedUiSourceIfChanged };
@@ -1,29 +0,0 @@
1
- const migrateStrictEffectHelp = `Usage:
2
- ultramodern-create ultramodern migrate-strict-effect --version <version> [--dry-run] [--skip-install]
3
-
4
- Updates generated UltraModern package-source metadata, Modern package aliases,
5
- framework-owned toolchain pins, direct Effect API topology metadata, strict
6
- Effect pnpm overrides/trust policy, framework-owned TypeScript config
7
- surfaces, and the pnpm lockfile. Source code still has to pass pnpm api:check
8
- and pnpm contract:check.
9
-
10
- Existing Modern configs are treated as consumer-owned unless generated
11
- ownership can be proven. Package scripts and TypeScript configs are merged at
12
- their framework-owned boundaries so consumer command segments, includes,
13
- references, plugins, and diagnostic overrides survive. An ambiguous Module
14
- Federation config that requires a bridge update is refused before any file is
15
- written, with the config path and the manual resolution required.
16
-
17
- The obsolete react-router dependency is dropped from every generated app that
18
- does not import React Router in its own source. Each generated Module
19
- Federation config then declares bridge.enableBridgeRouter from what its app
20
- still depends on: true where the app declares react-router or react-router-dom,
21
- the router-free false everywhere else.
22
-
23
- When the compact config is absent but legacy UltraModern 3.2 metadata is
24
- present, the compact config is synthesized from it first. Shell-only
25
- workspaces skip the backend-federation and Zerops runtime stages. Pass
26
- --dry-run to print the planned filesystem changes without writing anything
27
- (including preserved consumer overlays; implies --skip-install).
28
- `;
29
- export { migrateStrictEffectHelp };
@@ -1,14 +0,0 @@
1
- import { spawnSync } from "node:child_process";
2
- function runPnpmLockfileRefresh(context) {
3
- const result = spawnSync('pnpm', [
4
- 'install',
5
- '--lockfile-only',
6
- "--ignore-scripts"
7
- ], {
8
- cwd: context.workspaceRoot,
9
- stdio: 'inherit'
10
- });
11
- if (result.error) throw result.error;
12
- return result.status ?? 1;
13
- }
14
- export { runPnpmLockfileRefresh };
@@ -1,385 +0,0 @@
1
- import node_fs from "node:fs";
2
- import node_os from "node:os";
3
- import node_path from "node:path";
4
- import { formatGeneratedSourceCandidates } from "../../../ultramodern-workspace/fs-io.js";
5
- const stagingExcludedEntries = new Set([
6
- '.git',
7
- '.nx',
8
- '.output',
9
- 'coverage',
10
- 'dist',
11
- 'node_modules'
12
- ]);
13
- const stagingGeneratedOutputEntries = new Set([
14
- 'coverage',
15
- 'dist'
16
- ]);
17
- const stagingWorkspacePackageDirectories = new Set([
18
- 'apps',
19
- 'packages',
20
- 'verticals'
21
- ]);
22
- function lstatIfExists(filePath) {
23
- try {
24
- return node_fs.lstatSync(filePath);
25
- } catch (error) {
26
- if ('ENOENT' === error.code) return;
27
- throw error;
28
- }
29
- }
30
- function symlinkTypeForPath(filePath) {
31
- return node_fs.statSync(filePath, {
32
- throwIfNoEntry: false
33
- })?.isDirectory() ? 'win32' === process.platform ? 'junction' : 'dir' : 'file';
34
- }
35
- function isPathInsideRoot(rootPath, targetPath) {
36
- const relativePath = node_path.relative(rootPath, targetPath);
37
- return '' === relativePath || !relativePath.startsWith(`..${node_path.sep}`) && '..' !== relativePath && !node_path.isAbsolute(relativePath);
38
- }
39
- function resolvePotentialRealPath(filePath, visitedSymlinks = new Set()) {
40
- const absolutePath = node_path.resolve(filePath);
41
- let existingAncestor = absolutePath;
42
- while(!lstatIfExists(existingAncestor)){
43
- const parentPath = node_path.dirname(existingAncestor);
44
- if (parentPath === existingAncestor) return absolutePath;
45
- existingAncestor = parentPath;
46
- }
47
- let realAncestor;
48
- try {
49
- realAncestor = node_fs.realpathSync.native(existingAncestor);
50
- } catch (error) {
51
- const ancestorStat = lstatIfExists(existingAncestor);
52
- if (!ancestorStat?.isSymbolicLink()) throw error;
53
- if (visitedSymlinks.has(existingAncestor)) throw new Error(`Refusing to follow cyclic migration symlink: ${existingAncestor}`);
54
- visitedSymlinks.add(existingAncestor);
55
- realAncestor = resolvePotentialRealPath(node_path.resolve(node_path.dirname(existingAncestor), node_fs.readlinkSync(existingAncestor)), visitedSymlinks);
56
- }
57
- return node_path.resolve(realAncestor, node_path.relative(existingAncestor, absolutePath));
58
- }
59
- function capturePath(filePath) {
60
- const stat = lstatIfExists(filePath);
61
- if (!stat) return;
62
- const mode = 4095 & stat.mode;
63
- if (stat.isFile()) return {
64
- content: node_fs.readFileSync(filePath),
65
- mode,
66
- type: 'file'
67
- };
68
- if (stat.isDirectory()) {
69
- const entries = new Map();
70
- for (const entry of node_fs.readdirSync(filePath).sort((left, right)=>left.localeCompare(right))){
71
- const snapshot = capturePath(node_path.join(filePath, entry));
72
- if (snapshot) entries.set(entry, snapshot);
73
- }
74
- return {
75
- entries,
76
- mode,
77
- type: 'directory'
78
- };
79
- }
80
- if (stat.isSymbolicLink()) return {
81
- linkType: symlinkTypeForPath(filePath),
82
- mode,
83
- target: node_fs.readlinkSync(filePath),
84
- type: 'symlink'
85
- };
86
- throw new Error(`Unsupported migration transaction path: ${filePath}`);
87
- }
88
- function removePath(filePath) {
89
- node_fs.rmSync(filePath, {
90
- force: true,
91
- recursive: true
92
- });
93
- }
94
- function chmodSymlinkIfSupported(filePath, mode) {
95
- if ('function' == typeof node_fs.lchmodSync) node_fs.lchmodSync(filePath, mode);
96
- }
97
- function restorePath(filePath, snapshot) {
98
- if (!snapshot) return void removePath(filePath);
99
- const current = lstatIfExists(filePath);
100
- if ('file' === snapshot.type) {
101
- if (!current?.isFile() || current.isSymbolicLink()) {
102
- removePath(filePath);
103
- node_fs.mkdirSync(node_path.dirname(filePath), {
104
- recursive: true
105
- });
106
- }
107
- node_fs.writeFileSync(filePath, snapshot.content);
108
- node_fs.chmodSync(filePath, snapshot.mode);
109
- return;
110
- }
111
- if ('symlink' === snapshot.type) {
112
- if (!current?.isSymbolicLink() || node_fs.readlinkSync(filePath) !== snapshot.target || symlinkTypeForPath(filePath) !== snapshot.linkType) {
113
- removePath(filePath);
114
- node_fs.mkdirSync(node_path.dirname(filePath), {
115
- recursive: true
116
- });
117
- node_fs.symlinkSync(snapshot.target, filePath, snapshot.linkType);
118
- }
119
- chmodSymlinkIfSupported(filePath, snapshot.mode);
120
- return;
121
- }
122
- if (!current?.isDirectory() || current.isSymbolicLink()) {
123
- removePath(filePath);
124
- node_fs.mkdirSync(filePath, {
125
- recursive: true
126
- });
127
- }
128
- for (const entry of node_fs.readdirSync(filePath))if (!snapshot.entries.has(entry)) removePath(node_path.join(filePath, entry));
129
- for (const [entry, childSnapshot] of snapshot.entries)restorePath(node_path.join(filePath, entry), childSnapshot);
130
- node_fs.chmodSync(filePath, snapshot.mode);
131
- }
132
- function copyWorkspaceEntry(sourcePath, destinationPath, sourceWorkspaceRoot, stagedWorkspaceRoot, sourceWorkspaceAliases) {
133
- const stat = node_fs.lstatSync(sourcePath);
134
- if (stat.isDirectory()) {
135
- node_fs.mkdirSync(destinationPath, {
136
- mode: 4095 & stat.mode
137
- });
138
- const relativeSourcePath = node_path.relative(sourceWorkspaceRoot, sourcePath);
139
- for (const entry of node_fs.readdirSync(sourcePath)){
140
- const isNamedWorkspacePackage = stagingWorkspacePackageDirectories.has(relativeSourcePath) && stagingGeneratedOutputEntries.has(entry);
141
- if (!stagingExcludedEntries.has(entry) || isNamedWorkspacePackage) copyWorkspaceEntry(node_path.join(sourcePath, entry), node_path.join(destinationPath, entry), sourceWorkspaceRoot, stagedWorkspaceRoot, sourceWorkspaceAliases);
142
- }
143
- node_fs.chmodSync(destinationPath, 4095 & stat.mode);
144
- return;
145
- }
146
- if (stat.isFile()) {
147
- node_fs.copyFileSync(sourcePath, destinationPath, node_fs.constants.COPYFILE_FICLONE);
148
- node_fs.chmodSync(destinationPath, 4095 & stat.mode);
149
- return;
150
- }
151
- if (stat.isSymbolicLink()) {
152
- const target = node_fs.readlinkSync(sourcePath);
153
- const stagedTarget = node_path.isAbsolute(target) ? relocateWorkspacePath(sourceWorkspaceAliases, stagedWorkspaceRoot, target) : target;
154
- node_fs.symlinkSync(stagedTarget, destinationPath, symlinkTypeForPath(sourcePath));
155
- chmodSymlinkIfSupported(destinationPath, 4095 & stat.mode);
156
- return;
157
- }
158
- throw new Error(`Unsupported migration staging path: ${sourcePath}`);
159
- }
160
- function relocateWorkspacePath(sourceWorkspaceRoots, stagedWorkspaceRoot, sourcePath) {
161
- for (const sourceWorkspaceRoot of sourceWorkspaceRoots){
162
- const relativePath = node_path.relative(sourceWorkspaceRoot, sourcePath);
163
- if (isPathInsideRoot(sourceWorkspaceRoot, sourcePath)) return node_path.join(stagedWorkspaceRoot, relativePath);
164
- }
165
- return sourcePath;
166
- }
167
- function isPromiseLike(value) {
168
- return ('object' == typeof value || 'function' == typeof value) && null !== value && 'function' == typeof value.then;
169
- }
170
- function createMigrationIoWithBehavior(workspaceRoot, dryRun, behavior) {
171
- const absoluteWorkspaceRoot = node_path.resolve(workspaceRoot);
172
- const realWorkspaceRoot = resolvePotentialRealPath(absoluteWorkspaceRoot);
173
- const plan = [];
174
- let activeTransaction;
175
- const rel = (p)=>(node_path.relative(absoluteWorkspaceRoot, p) || node_path.basename(p)).split(node_path.sep).join('/');
176
- const assertRealWorkspacePath = (absolutePath, displayedPath, followFinalSymlink = true)=>{
177
- const pathToResolve = followFinalSymlink ? absolutePath : node_path.dirname(absolutePath);
178
- const realPath = resolvePotentialRealPath(pathToResolve);
179
- if (!isPathInsideRoot(realWorkspaceRoot, realPath)) throw new Error(`Refusing to mutate outside workspace: ${displayedPath}`);
180
- };
181
- const assertWorkspacePath = (filePath, followFinalSymlink = true)=>{
182
- const absolutePath = node_path.resolve(filePath);
183
- const relativePath = node_path.relative(absoluteWorkspaceRoot, absolutePath);
184
- if ('' === relativePath || '..' === relativePath || relativePath.startsWith(`..${node_path.sep}`) || node_path.isAbsolute(relativePath)) throw new Error(`Refusing to mutate outside workspace: ${filePath}`);
185
- assertRealWorkspacePath(absolutePath, filePath, followFinalSymlink);
186
- return absolutePath;
187
- };
188
- const captureForRollback = (filePath)=>{
189
- if (!activeTransaction || activeTransaction.snapshots.has(filePath)) return;
190
- activeTransaction.snapshots.set(filePath, capturePath(filePath));
191
- activeTransaction.order.push(filePath);
192
- };
193
- const captureMissingParents = (filePath)=>{
194
- const missing = [];
195
- let current = node_path.dirname(filePath);
196
- while(current !== absoluteWorkspaceRoot && !lstatIfExists(current)){
197
- missing.push(current);
198
- current = node_path.dirname(current);
199
- }
200
- for (const missingDirectory of missing.reverse())captureForRollback(missingDirectory);
201
- };
202
- const rollback = (transaction)=>{
203
- for (const filePath of [
204
- ...transaction.order
205
- ].reverse())restorePath(filePath, transaction.snapshots.get(filePath));
206
- };
207
- const finishWithError = (transaction, error)=>{
208
- try {
209
- rollback(transaction);
210
- } catch (rollbackError) {
211
- throw new Error(`Migration failed (${String(error)}) and rollback failed (${String(rollbackError)}).`);
212
- } finally{
213
- activeTransaction = void 0;
214
- }
215
- throw error;
216
- };
217
- const formatGeneratedWrites = (generatedPaths)=>{
218
- if (0 === generatedPaths.size) return;
219
- const relativePaths = [
220
- ...generatedPaths
221
- ].map((filePath)=>node_path.relative(absoluteWorkspaceRoot, filePath)).sort((left, right)=>left.localeCompare(right));
222
- const formattedSources = formatGeneratedSourceCandidates(relativePaths.map((relativePath)=>[
223
- relativePath,
224
- node_fs.readFileSync(node_path.join(absoluteWorkspaceRoot, relativePath), 'utf-8')
225
- ]));
226
- for (const [index, relativePath] of relativePaths.entries())io.write(node_path.join(absoluteWorkspaceRoot, relativePath), formattedSources[index]);
227
- };
228
- const io = {
229
- workspaceRoot: absoluteWorkspaceRoot,
230
- dryRun,
231
- plan,
232
- write (filePath, content) {
233
- const absolutePath = assertWorkspacePath(filePath);
234
- if (node_fs.existsSync(absolutePath) && node_fs.readFileSync(absolutePath, 'utf-8') === content) return false;
235
- if (dryRun) {
236
- plan.push(`[dry-run] would write ${rel(absolutePath)}`);
237
- if (!behavior.materializeDryRun) return true;
238
- }
239
- captureMissingParents(absolutePath);
240
- captureForRollback(absolutePath);
241
- const current = lstatIfExists(absolutePath);
242
- if (current?.isSymbolicLink()) {
243
- const linkedPath = node_path.resolve(node_path.dirname(absolutePath), node_fs.readlinkSync(absolutePath));
244
- let targetPath = linkedPath;
245
- try {
246
- targetPath = node_fs.realpathSync.native(absolutePath);
247
- } catch {}
248
- const absoluteTargetPath = node_path.resolve(targetPath);
249
- assertRealWorkspacePath(absoluteTargetPath, filePath);
250
- captureMissingParents(absoluteTargetPath);
251
- captureForRollback(absoluteTargetPath);
252
- }
253
- assertRealWorkspacePath(absolutePath, filePath);
254
- node_fs.mkdirSync(node_path.dirname(absolutePath), {
255
- recursive: true
256
- });
257
- node_fs.writeFileSync(absolutePath, content, 'utf-8');
258
- return true;
259
- },
260
- writeGenerated (filePath, content) {
261
- const absolutePath = assertWorkspacePath(filePath);
262
- const changed = io.write(absolutePath, content);
263
- if (dryRun && !behavior.materializeDryRun) return changed;
264
- if (activeTransaction) activeTransaction.generatedPaths.add(absolutePath);
265
- else formatGeneratedWrites(new Set([
266
- absolutePath
267
- ]));
268
- return changed;
269
- },
270
- remove (filePath) {
271
- const absolutePath = assertWorkspacePath(filePath, false);
272
- if (!lstatIfExists(absolutePath)) return false;
273
- if (dryRun) {
274
- plan.push(`[dry-run] would delete ${rel(absolutePath)}`);
275
- if (!behavior.materializeDryRun) return true;
276
- }
277
- activeTransaction?.generatedPaths.delete(absolutePath);
278
- captureForRollback(absolutePath);
279
- assertRealWorkspacePath(absolutePath, filePath, false);
280
- node_fs.rmSync(absolutePath);
281
- return true;
282
- },
283
- log (message) {
284
- if (dryRun) plan.push(`[dry-run] ${message}`);
285
- else process.stdout.write(`[ultramodern] ${message}\n`);
286
- },
287
- transaction (operation, options) {
288
- if (activeTransaction) throw new Error('Nested migration transactions are not supported.');
289
- const transaction = {
290
- generatedPaths: new Set(),
291
- order: [],
292
- snapshots: new Map()
293
- };
294
- activeTransaction = transaction;
295
- const finish = (result)=>{
296
- try {
297
- if (options?.commitWhen && !options.commitWhen(result)) rollback(transaction);
298
- else formatGeneratedWrites(transaction.generatedPaths);
299
- return result;
300
- } catch (error) {
301
- return finishWithError(transaction, error);
302
- } finally{
303
- activeTransaction = void 0;
304
- }
305
- };
306
- try {
307
- const result = operation();
308
- if (isPromiseLike(result)) return Promise.resolve(result).then((value)=>finish(value), (error)=>finishWithError(transaction, error));
309
- return finish(result);
310
- } catch (error) {
311
- return finishWithError(transaction, error);
312
- }
313
- },
314
- withStagedWorkspace (operation) {
315
- const temporaryRoot = node_fs.mkdtempSync(node_path.join(node_os.tmpdir(), 'ultramodern-migration-'));
316
- const stagedWorkspaceRoot = node_path.join(temporaryRoot, 'workspace');
317
- const sourceWorkspaceAliases = [
318
- ...new Set([
319
- absoluteWorkspaceRoot,
320
- realWorkspaceRoot
321
- ])
322
- ];
323
- try {
324
- copyWorkspaceEntry(realWorkspaceRoot, stagedWorkspaceRoot, realWorkspaceRoot, stagedWorkspaceRoot, sourceWorkspaceAliases);
325
- const result = operation(stagedWorkspaceRoot);
326
- if (isPromiseLike(result)) return Promise.resolve(result).finally(()=>{
327
- node_fs.rmSync(temporaryRoot, {
328
- force: true,
329
- recursive: true
330
- });
331
- });
332
- node_fs.rmSync(temporaryRoot, {
333
- force: true,
334
- recursive: true
335
- });
336
- return result;
337
- } catch (error) {
338
- node_fs.rmSync(temporaryRoot, {
339
- force: true,
340
- recursive: true
341
- });
342
- throw error;
343
- }
344
- }
345
- };
346
- return io;
347
- }
348
- function createMigrationIo(workspaceRoot, dryRun) {
349
- return createMigrationIoWithBehavior(workspaceRoot, dryRun, {
350
- materializeDryRun: false
351
- });
352
- }
353
- function withStagedDryRunMigrationIo(workspaceRoot, operation) {
354
- const ownerIo = createMigrationIo(workspaceRoot, true);
355
- return ownerIo.withStagedWorkspace((stagedWorkspaceRoot)=>operation(createMigrationIoWithBehavior(stagedWorkspaceRoot, true, {
356
- materializeDryRun: true
357
- })));
358
- }
359
- function readJsonFile(filePath) {
360
- return JSON.parse(node_fs.readFileSync(filePath, 'utf-8'));
361
- }
362
- function writeJsonFile(io, filePath, value) {
363
- return io.write(filePath, `${JSON.stringify(value, null, 2)}\n`);
364
- }
365
- function listWorkspacePackageFiles(workspaceRoot) {
366
- const packageFiles = [
367
- 'package.json'
368
- ];
369
- for (const directory of [
370
- 'apps',
371
- 'verticals',
372
- 'packages'
373
- ]){
374
- const absoluteDirectory = node_path.join(workspaceRoot, directory);
375
- if (node_fs.existsSync(absoluteDirectory)) for (const entry of node_fs.readdirSync(absoluteDirectory, {
376
- withFileTypes: true
377
- })){
378
- if (!entry.isDirectory()) continue;
379
- const packageFile = `${directory}/${entry.name}/package.json`;
380
- if (node_fs.existsSync(node_path.join(workspaceRoot, packageFile))) packageFiles.push(packageFile);
381
- }
382
- }
383
- return packageFiles;
384
- }
385
- export { createMigrationIo, listWorkspacePackageFiles, readJsonFile, withStagedDryRunMigrationIo, writeJsonFile };