@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.6 → 3.5.0-ultramodern.75

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 (258) hide show
  1. package/bin/modern.js +0 -0
  2. package/dist/cjs/builder/generator/getBuilderEnvironments.js +13 -16
  3. package/dist/cjs/builder/shared/builderPlugins/adapterPrecompress.js +13 -4
  4. package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +14 -11
  5. package/dist/cjs/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.js +72 -0
  6. package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +28 -11
  7. package/dist/cjs/builder/shared/bundlerPlugins/index.js +13 -6
  8. package/dist/cjs/builder/shared/lazyCompilation.js +2 -10
  9. package/dist/cjs/commands/index.js +0 -4
  10. package/dist/cjs/config/build-environment.js +268 -0
  11. package/dist/cjs/config/index.js +11 -4
  12. package/dist/cjs/config/public.js +46 -0
  13. package/dist/cjs/index.js +39 -62
  14. package/dist/cjs/plugins/analyze/getServerRoutes.js +19 -0
  15. package/dist/cjs/plugins/analyze/index.js +20 -12
  16. package/dist/cjs/plugins/backend-federation/codegen.js +255 -0
  17. package/dist/cjs/plugins/backend-federation/config.js +204 -0
  18. package/dist/cjs/plugins/backend-federation/emit.js +148 -0
  19. package/dist/cjs/plugins/backendFederationBuild.js +53 -0
  20. package/dist/cjs/plugins/deploy/index.js +4 -4
  21. package/dist/cjs/plugins/deploy/platforms/cloudflare/artifacts.js +127 -0
  22. package/dist/cjs/plugins/deploy/platforms/cloudflare/constants.js +141 -0
  23. package/dist/cjs/plugins/deploy/platforms/cloudflare/delivery-unit.js +139 -0
  24. package/dist/cjs/plugins/deploy/platforms/cloudflare/i18n-worker.js +135 -0
  25. package/dist/cjs/plugins/deploy/platforms/cloudflare/index.js +150 -0
  26. package/dist/cjs/plugins/deploy/platforms/cloudflare/security-policies.js +205 -0
  27. package/dist/cjs/plugins/deploy/platforms/cloudflare/types.js +18 -0
  28. package/dist/cjs/plugins/deploy/platforms/cloudflare/utils.js +66 -0
  29. package/dist/cjs/plugins/deploy/platforms/cloudflare/worker-manifest.js +208 -0
  30. package/dist/cjs/plugins/deploy/platforms/cloudflare/wrangler-config.js +204 -0
  31. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-contract.js +108 -0
  32. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-plan.js +93 -0
  33. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/identity.js +83 -0
  34. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +188 -0
  35. package/dist/cjs/{baseline.js → plugins/deploy/platforms/cloudflare-output-verifier/issues.js} +19 -10
  36. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/manifest.js +89 -0
  37. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.js +151 -0
  38. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.js +302 -0
  39. package/dist/cjs/plugins/deploy/platforms/node.js +20 -2
  40. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +250 -0
  41. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +191 -0
  42. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +514 -0
  43. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +1012 -0
  44. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +363 -0
  45. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +93 -0
  46. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +8 -4
  47. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +251 -155
  48. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +78 -39
  49. package/dist/cjs/plugins/deploy/platforms/templates/netlify-entry.cjs +62 -41
  50. package/dist/cjs/plugins/deploy/platforms/templates/netlify-entry.mjs +63 -41
  51. package/dist/cjs/plugins/deploy/platforms/templates/node-entry.cjs +52 -35
  52. package/dist/cjs/plugins/deploy/platforms/templates/node-entry.mjs +53 -35
  53. package/dist/cjs/plugins/deploy/platforms/templates/vercel-entry.cjs +61 -41
  54. package/dist/cjs/plugins/deploy/platforms/templates/vercel-entry.mjs +61 -40
  55. package/dist/cjs/plugins/deploy/utils/npmAliases.js +226 -0
  56. package/dist/cjs/plugins/ultramodernReleaseEnvelope.js +100 -0
  57. package/dist/cjs/presetUltramodern.js +33 -2
  58. package/dist/cjs/ultramodern-release-envelope/canonical.js +68 -0
  59. package/dist/cjs/ultramodern-release-envelope/framework-output.js +597 -0
  60. package/dist/cjs/ultramodern-release-envelope/index.js +399 -0
  61. package/dist/cjs/ultramodern-release-envelope/types.js +51 -0
  62. package/dist/cjs/ultramodern-release-identity.js +110 -0
  63. package/dist/esm/builder/generator/getBuilderEnvironments.mjs +12 -15
  64. package/dist/esm/builder/shared/builderPlugins/adapterPrecompress.mjs +13 -4
  65. package/dist/esm/builder/shared/builderPlugins/adapterSSR.mjs +15 -12
  66. package/dist/esm/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.mjs +30 -0
  67. package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.mjs +24 -10
  68. package/dist/esm/builder/shared/bundlerPlugins/index.mjs +1 -0
  69. package/dist/esm/builder/shared/lazyCompilation.mjs +1 -3
  70. package/dist/esm/commands/index.mjs +0 -1
  71. package/dist/esm/config/build-environment.mjs +224 -0
  72. package/dist/esm/config/index.mjs +1 -0
  73. package/dist/esm/config/public.mjs +1 -0
  74. package/dist/esm/index.mjs +5 -4
  75. package/dist/esm/plugins/analyze/getHtmlTemplate.mjs +2 -2
  76. package/dist/esm/plugins/analyze/getServerRoutes.mjs +17 -1
  77. package/dist/esm/plugins/analyze/index.mjs +20 -12
  78. package/dist/esm/plugins/analyze/isDefaultExportFunction.mjs +2 -2
  79. package/dist/esm/plugins/backend-federation/codegen.mjs +204 -0
  80. package/dist/esm/plugins/backend-federation/config.mjs +128 -0
  81. package/dist/esm/plugins/backend-federation/emit.mjs +97 -0
  82. package/dist/esm/plugins/backendFederationBuild.mjs +1 -0
  83. package/dist/esm/plugins/deploy/index.mjs +1 -1
  84. package/dist/esm/plugins/deploy/platforms/cloudflare/artifacts.mjs +64 -0
  85. package/dist/esm/plugins/deploy/platforms/cloudflare/constants.mjs +34 -0
  86. package/dist/esm/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +88 -0
  87. package/dist/esm/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +97 -0
  88. package/dist/esm/plugins/deploy/platforms/cloudflare/index.mjs +102 -0
  89. package/dist/esm/plugins/deploy/platforms/cloudflare/security-policies.mjs +167 -0
  90. package/dist/esm/plugins/deploy/platforms/cloudflare/types.mjs +0 -0
  91. package/dist/esm/plugins/deploy/platforms/cloudflare/utils.mjs +12 -0
  92. package/dist/esm/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +148 -0
  93. package/dist/esm/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +150 -0
  94. package/dist/esm/plugins/deploy/platforms/cloudflare-output-contract.mjs +31 -0
  95. package/dist/esm/plugins/deploy/platforms/cloudflare-output-plan.mjs +45 -0
  96. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +45 -0
  97. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +133 -0
  98. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +10 -0
  99. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +51 -0
  100. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +99 -0
  101. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +238 -0
  102. package/dist/esm/plugins/deploy/platforms/node.mjs +20 -2
  103. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +250 -0
  104. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +191 -0
  105. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +514 -0
  106. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +1012 -0
  107. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +363 -0
  108. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +93 -0
  109. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +8 -4
  110. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +251 -155
  111. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +78 -39
  112. package/dist/esm/plugins/deploy/platforms/templates/netlify-entry.cjs +62 -41
  113. package/dist/esm/plugins/deploy/platforms/templates/netlify-entry.mjs +63 -41
  114. package/dist/esm/plugins/deploy/platforms/templates/node-entry.cjs +52 -35
  115. package/dist/esm/plugins/deploy/platforms/templates/node-entry.mjs +53 -35
  116. package/dist/esm/plugins/deploy/platforms/templates/vercel-entry.cjs +61 -41
  117. package/dist/esm/plugins/deploy/platforms/templates/vercel-entry.mjs +61 -40
  118. package/dist/esm/plugins/deploy/utils/npmAliases.mjs +174 -0
  119. package/dist/esm/plugins/ultramodernReleaseEnvelope.mjs +52 -0
  120. package/dist/esm/presetUltramodern.mjs +33 -2
  121. package/dist/esm/ultramodern-release-envelope/canonical.mjs +21 -0
  122. package/dist/esm/ultramodern-release-envelope/framework-output.mjs +524 -0
  123. package/dist/esm/ultramodern-release-envelope/index.mjs +335 -0
  124. package/dist/esm/ultramodern-release-envelope/types.mjs +7 -0
  125. package/dist/esm/ultramodern-release-identity.mjs +66 -0
  126. package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +12 -15
  127. package/dist/esm-node/builder/shared/builderPlugins/adapterPrecompress.mjs +13 -4
  128. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.mjs +15 -12
  129. package/dist/esm-node/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.mjs +31 -0
  130. package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.mjs +24 -10
  131. package/dist/esm-node/builder/shared/bundlerPlugins/index.mjs +1 -0
  132. package/dist/esm-node/builder/shared/lazyCompilation.mjs +1 -3
  133. package/dist/esm-node/commands/index.mjs +0 -1
  134. package/dist/esm-node/config/build-environment.mjs +225 -0
  135. package/dist/esm-node/config/index.mjs +1 -0
  136. package/dist/esm-node/config/public.mjs +2 -0
  137. package/dist/esm-node/index.mjs +5 -4
  138. package/dist/esm-node/plugins/analyze/getHtmlTemplate.mjs +2 -2
  139. package/dist/esm-node/plugins/analyze/getServerRoutes.mjs +17 -1
  140. package/dist/esm-node/plugins/analyze/index.mjs +20 -12
  141. package/dist/esm-node/plugins/analyze/isDefaultExportFunction.mjs +2 -2
  142. package/dist/esm-node/plugins/backend-federation/codegen.mjs +205 -0
  143. package/dist/esm-node/plugins/backend-federation/config.mjs +129 -0
  144. package/dist/esm-node/plugins/backend-federation/emit.mjs +98 -0
  145. package/dist/esm-node/plugins/backendFederationBuild.mjs +2 -0
  146. package/dist/esm-node/plugins/deploy/index.mjs +1 -1
  147. package/dist/esm-node/plugins/deploy/platforms/cloudflare/artifacts.mjs +65 -0
  148. package/dist/esm-node/plugins/deploy/platforms/cloudflare/constants.mjs +35 -0
  149. package/dist/esm-node/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +89 -0
  150. package/dist/esm-node/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +98 -0
  151. package/dist/esm-node/plugins/deploy/platforms/cloudflare/index.mjs +103 -0
  152. package/dist/esm-node/plugins/deploy/platforms/cloudflare/security-policies.mjs +168 -0
  153. package/dist/esm-node/plugins/deploy/platforms/cloudflare/types.mjs +1 -0
  154. package/dist/esm-node/plugins/deploy/platforms/cloudflare/utils.mjs +13 -0
  155. package/dist/esm-node/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +149 -0
  156. package/dist/esm-node/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +151 -0
  157. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-contract.mjs +32 -0
  158. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-plan.mjs +46 -0
  159. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +46 -0
  160. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +134 -0
  161. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +11 -0
  162. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +52 -0
  163. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +100 -0
  164. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +239 -0
  165. package/dist/esm-node/plugins/deploy/platforms/node.mjs +20 -2
  166. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +250 -0
  167. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +191 -0
  168. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +514 -0
  169. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +1012 -0
  170. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +363 -0
  171. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +93 -0
  172. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +8 -4
  173. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +251 -155
  174. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +78 -39
  175. package/dist/esm-node/plugins/deploy/platforms/templates/netlify-entry.cjs +62 -41
  176. package/dist/esm-node/plugins/deploy/platforms/templates/netlify-entry.mjs +63 -41
  177. package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.cjs +52 -35
  178. package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.mjs +53 -35
  179. package/dist/esm-node/plugins/deploy/platforms/templates/vercel-entry.cjs +61 -41
  180. package/dist/esm-node/plugins/deploy/platforms/templates/vercel-entry.mjs +61 -40
  181. package/dist/esm-node/plugins/deploy/utils/npmAliases.mjs +175 -0
  182. package/dist/esm-node/plugins/ultramodernReleaseEnvelope.mjs +53 -0
  183. package/dist/esm-node/presetUltramodern.mjs +33 -2
  184. package/dist/esm-node/ultramodern-release-envelope/canonical.mjs +22 -0
  185. package/dist/esm-node/ultramodern-release-envelope/framework-output.mjs +525 -0
  186. package/dist/esm-node/ultramodern-release-envelope/index.mjs +336 -0
  187. package/dist/esm-node/ultramodern-release-envelope/types.mjs +8 -0
  188. package/dist/esm-node/ultramodern-release-identity.mjs +67 -0
  189. package/dist/types/builder/generator/createCopyPattern.d.ts +7 -5
  190. package/dist/types/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.d.ts +6 -0
  191. package/dist/types/builder/shared/bundlerPlugins/RouterPlugin.d.ts +1 -0
  192. package/dist/types/builder/shared/bundlerPlugins/index.d.ts +1 -0
  193. package/dist/types/builder/shared/lazyCompilation.d.ts +2 -4
  194. package/dist/types/commands/index.d.ts +0 -1
  195. package/dist/types/config/build-environment.d.ts +22 -0
  196. package/dist/types/config/index.d.ts +1 -0
  197. package/dist/types/config/public.d.ts +2 -0
  198. package/dist/types/index.d.ts +0 -2
  199. package/dist/types/plugins/analyze/getServerRoutes.d.ts +1 -0
  200. package/dist/types/plugins/backend-federation/codegen.d.ts +83 -0
  201. package/dist/types/plugins/backend-federation/config.d.ts +103 -0
  202. package/dist/types/plugins/backend-federation/emit.d.ts +13 -0
  203. package/dist/types/plugins/backendFederationBuild.d.ts +2 -0
  204. package/dist/types/plugins/deploy/platforms/cloudflare/artifacts.d.ts +15 -0
  205. package/dist/types/plugins/deploy/platforms/cloudflare/constants.d.ts +24 -0
  206. package/dist/types/plugins/deploy/platforms/cloudflare/delivery-unit.d.ts +23 -0
  207. package/dist/types/plugins/deploy/platforms/cloudflare/i18n-worker.d.ts +22 -0
  208. package/dist/types/plugins/deploy/platforms/{cloudflare.d.ts → cloudflare/index.d.ts} +1 -1
  209. package/dist/types/plugins/deploy/platforms/cloudflare/security-policies.d.ts +51 -0
  210. package/dist/types/plugins/deploy/platforms/cloudflare/types.d.ts +5 -0
  211. package/dist/types/plugins/deploy/platforms/cloudflare/utils.d.ts +6 -0
  212. package/dist/types/plugins/deploy/platforms/cloudflare/worker-manifest.d.ts +122 -0
  213. package/dist/types/plugins/deploy/platforms/cloudflare/wrangler-config.d.ts +46 -0
  214. package/dist/types/plugins/deploy/platforms/cloudflare-output-contract.d.ts +14 -0
  215. package/dist/types/plugins/deploy/platforms/cloudflare-output-plan.d.ts +34 -0
  216. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/identity.d.ts +4 -0
  217. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/index.d.ts +18 -0
  218. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/issues.d.ts +14 -0
  219. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/manifest.d.ts +2 -0
  220. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.d.ts +14 -0
  221. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.d.ts +20 -0
  222. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.d.mts +1 -0
  223. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.d.mts +1 -0
  224. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.d.mts +1 -0
  225. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.d.mts +1 -0
  226. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.d.mts +1 -0
  227. package/dist/types/plugins/deploy/utils/npmAliases.d.ts +14 -0
  228. package/dist/types/plugins/ultramodernReleaseEnvelope.d.ts +3 -0
  229. package/dist/types/presetUltramodern.d.ts +10 -0
  230. package/dist/types/run/index.d.ts +1 -1
  231. package/dist/types/types/config/cloudflareDeploy.d.ts +41 -0
  232. package/dist/types/types/config/deploy.d.ts +15 -2
  233. package/dist/types/ultramodern-release-envelope/canonical.d.ts +5 -0
  234. package/dist/types/ultramodern-release-envelope/framework-output.d.ts +31 -0
  235. package/dist/types/ultramodern-release-envelope/index.d.ts +6 -0
  236. package/dist/types/ultramodern-release-envelope/types.d.ts +62 -0
  237. package/dist/types/ultramodern-release-identity.d.ts +16 -0
  238. package/lib/types.d.ts +2 -3
  239. package/package.json +38 -23
  240. package/rslib.config.mts +11 -12
  241. package/dist/cjs/commands/runtime.js +0 -196
  242. package/dist/cjs/plugins/deploy/platforms/cloudflare.js +0 -540
  243. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -576
  244. package/dist/cjs/ultramodern/designSystem.js +0 -123
  245. package/dist/esm/baseline.mjs +0 -4
  246. package/dist/esm/commands/runtime.mjs +0 -146
  247. package/dist/esm/plugins/deploy/platforms/cloudflare.mjs +0 -492
  248. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -576
  249. package/dist/esm/ultramodern/designSystem.mjs +0 -73
  250. package/dist/esm-node/baseline.mjs +0 -5
  251. package/dist/esm-node/commands/runtime.mjs +0 -147
  252. package/dist/esm-node/plugins/deploy/platforms/cloudflare.mjs +0 -493
  253. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -576
  254. package/dist/esm-node/ultramodern/designSystem.mjs +0 -74
  255. package/dist/types/baseline.d.ts +0 -16
  256. package/dist/types/commands/runtime.d.ts +0 -12
  257. package/dist/types/ultramodern/designSystem.d.ts +0 -54
  258. /package/dist/types/plugins/deploy/platforms/templates/{cloudflare-entry.d.mts → cloudflare-entry.006-fetch-handler.d.mts} +0 -0
@@ -0,0 +1,597 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, getters, values)=>{
14
+ var define = (defs, kind)=>{
15
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
16
+ enumerable: true,
17
+ [kind]: defs[key]
18
+ });
19
+ };
20
+ define(getters, "get");
21
+ define(values, "value");
22
+ };
23
+ })();
24
+ (()=>{
25
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
26
+ })();
27
+ (()=>{
28
+ __webpack_require__.r = (exports1)=>{
29
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
30
+ value: 'Module'
31
+ });
32
+ Object.defineProperty(exports1, '__esModule', {
33
+ value: true
34
+ });
35
+ };
36
+ })();
37
+ var __webpack_exports__ = {};
38
+ __webpack_require__.r(__webpack_exports__);
39
+ __webpack_require__.d(__webpack_exports__, {
40
+ MICROVERTICAL_RELEASE_ENVELOPE_PATH: ()=>MICROVERTICAL_RELEASE_ENVELOPE_PATH,
41
+ emitCloudflareStagedReleaseEnvelope: ()=>emitCloudflareStagedReleaseEnvelope,
42
+ emitFrameworkMicroVerticalReleaseEnvelope: ()=>emitFrameworkMicroVerticalReleaseEnvelope,
43
+ emitNodeStagedReleaseEnvelope: ()=>emitNodeStagedReleaseEnvelope,
44
+ readFrameworkMicroVerticalReleaseEnvelope: ()=>readFrameworkMicroVerticalReleaseEnvelope,
45
+ stageCloudflareReleaseEnvelope: ()=>stageCloudflareReleaseEnvelope,
46
+ verifyBuildOutputReleaseEnvelope: ()=>verifyBuildOutputReleaseEnvelope,
47
+ verifyCloudflareReleaseEnvelopeStaging: ()=>verifyCloudflareReleaseEnvelopeStaging,
48
+ verifyNodeReleaseEnvelopeStaging: ()=>verifyNodeReleaseEnvelopeStaging
49
+ });
50
+ const promises_namespaceObject = require("node:fs/promises");
51
+ var promises_default = /*#__PURE__*/ __webpack_require__.n(promises_namespaceObject);
52
+ const external_node_path_namespaceObject = require("node:path");
53
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
54
+ const parser_namespaceObject = require("@babel/parser");
55
+ const universal_namespaceObject = require("@modern-js/utils/universal");
56
+ const external_index_js_namespaceObject = require("./index.js");
57
+ const MICROVERTICAL_RELEASE_ENVELOPE_PATH = 'release/microvertical-release-envelope.json';
58
+ const COMPILED_MODULE_PATTERN = /\.(?:c|m)?js$/u;
59
+ const EFFECT_BFF_WORKER_PATTERN = /^worker\/__modern_bff_effect\.(?:c|m)?js$/u;
60
+ const isRecord = (value)=>'object' == typeof value && null !== value && !Array.isArray(value);
61
+ const isAstNode = (value)=>isRecord(value) && 'string' == typeof value.type;
62
+ const visitAst = (node, visitor)=>{
63
+ visitor(node);
64
+ for (const value of Object.values(node))if (isAstNode(value)) visitAst(value, visitor);
65
+ else if (Array.isArray(value)) {
66
+ for (const item of value)if (isAstNode(item)) visitAst(item, visitor);
67
+ }
68
+ };
69
+ const compiledModuleIdentityValues = (source)=>{
70
+ const values = new Set();
71
+ const ast = (0, parser_namespaceObject.parse)(source, {
72
+ sourceType: 'unambiguous'
73
+ });
74
+ visitAst(ast.program, (node)=>{
75
+ if ('StringLiteral' === node.type && 'string' == typeof node.value) values.add(node.value);
76
+ else if ('TemplateElement' === node.type && isRecord(node.value) && 'string' == typeof node.value.cooked) values.add(node.value.cooked);
77
+ });
78
+ return values;
79
+ };
80
+ const assertEveryCompiledIdentityCarrier = async (distDirectory, logicalPaths, identity, surface)=>{
81
+ const compiledLogicalPaths = logicalPaths.filter((pathname)=>COMPILED_MODULE_PATTERN.test(pathname));
82
+ if (0 === compiledLogicalPaths.length) throw new Error(`[ultramodern-release-envelope] ${surface} has no compiled execution module carrying release identity.`);
83
+ for (const logicalPath of compiledLogicalPaths){
84
+ const source = await promises_default().readFile(external_node_path_default().join(distDirectory, logicalPath), {
85
+ encoding: 'utf8'
86
+ });
87
+ const values = compiledModuleIdentityValues(source);
88
+ if (!values.has(identity.buildMarker) || !values.has(identity.sourceRevision) || !values.has(identity.releaseVersion)) throw new Error(`[ultramodern-release-envelope] ${surface} execution module ${logicalPath} does not carry exact buildMarker ${identity.buildMarker}, sourceRevision ${identity.sourceRevision}, and releaseVersion ${identity.releaseVersion}.`);
89
+ }
90
+ };
91
+ const flattenStrings = (value)=>'string' == typeof value ? [
92
+ value
93
+ ] : Array.isArray(value) ? value.flatMap(flattenStrings) : [];
94
+ const collectNestedStrings = (value, key)=>{
95
+ if (Array.isArray(value)) return value.flatMap((item)=>collectNestedStrings(item, key));
96
+ if (!isRecord(value)) return [];
97
+ return Object.entries(value).flatMap(([entryKey, entryValue])=>[
98
+ ...entryKey === key ? flattenStrings(entryValue) : [],
99
+ ...collectNestedStrings(entryValue, key)
100
+ ]);
101
+ };
102
+ const manifestReferencedClientModules = async (distDirectory, files, manifestLogicalPath = 'mf-manifest.json')=>{
103
+ const manifest = await readJson(external_node_path_default().join(distDirectory, manifestLogicalPath));
104
+ const references = [
105
+ ...collectNestedStrings(manifest, 'path'),
106
+ ...collectNestedStrings(manifest, 'name'),
107
+ ...collectNestedStrings(manifest, 'sync'),
108
+ ...collectNestedStrings(manifest, 'async')
109
+ ];
110
+ const normalizedReferences = new Set(references.filter((value)=>'string' == typeof value).map((value)=>value.replace(/^https?:\/\/[^/]+/u, '')).map((value)=>value.replace(/^\/+/u, '')));
111
+ return files.filter((logicalPath)=>COMPILED_MODULE_PATTERN.test(logicalPath) && [
112
+ ...normalizedReferences
113
+ ].some((reference)=>reference === logicalPath || reference.endsWith(`/${logicalPath}`) || logicalPath.endsWith(`/${reference}`)));
114
+ };
115
+ const routeReferencedSsrModules = async (distDirectory, files, target, routeSpecLogicalPath = 'route.json')=>{
116
+ const routeSpec = await readJson(external_node_path_default().join(distDirectory, routeSpecLogicalPath));
117
+ const field = 'node' === target ? 'bundle' : 'worker';
118
+ const references = collectNestedStrings(routeSpec, field).map((value)=>value.replace(/^\/+/u, ''));
119
+ return files.filter((logicalPath)=>COMPILED_MODULE_PATTERN.test(logicalPath) && references.includes(logicalPath));
120
+ };
121
+ const readJson = async (filePath)=>JSON.parse(await promises_default().readFile(filePath, 'utf8'));
122
+ const isFilesystemPathInside = (root, candidate)=>{
123
+ const relative = external_node_path_default().relative(root, candidate);
124
+ return '' === relative || !relative.startsWith(`..${external_node_path_default().sep}`) && '..' !== relative && !external_node_path_default().isAbsolute(relative);
125
+ };
126
+ const isMissingPathError = (error)=>isRecord(error) && 'ENOENT' === error.code;
127
+ const resolveSafeReleaseEnvelopePath = async ({ artifactRoot, createDirectory })=>{
128
+ const resolvedRoot = external_node_path_default().resolve(artifactRoot);
129
+ const realRoot = await promises_default().realpath(resolvedRoot);
130
+ const releaseDirectory = external_node_path_default().join(resolvedRoot, 'release');
131
+ let releaseStat;
132
+ try {
133
+ releaseStat = await promises_default().lstat(releaseDirectory);
134
+ } catch (error) {
135
+ if (!isMissingPathError(error)) throw error;
136
+ if (!createDirectory) return;
137
+ await promises_default().mkdir(releaseDirectory);
138
+ releaseStat = await promises_default().lstat(releaseDirectory);
139
+ }
140
+ if (releaseStat.isSymbolicLink() || !releaseStat.isDirectory()) throw new Error('[ultramodern-release-envelope] release must be a real directory inside artifactRoot, not a symlink or file.');
141
+ const realReleaseDirectory = await promises_default().realpath(releaseDirectory);
142
+ if (!isFilesystemPathInside(realRoot, realReleaseDirectory)) throw new Error('[ultramodern-release-envelope] release directory resolves outside artifactRoot.');
143
+ const envelopePath = external_node_path_default().join(releaseDirectory, external_node_path_default().basename(MICROVERTICAL_RELEASE_ENVELOPE_PATH));
144
+ try {
145
+ const envelopeStat = await promises_default().lstat(envelopePath);
146
+ if (envelopeStat.isSymbolicLink() || !envelopeStat.isFile()) throw new Error('[ultramodern-release-envelope] release envelope must be a real file inside artifactRoot, not a symlink or directory.');
147
+ const realEnvelopePath = await promises_default().realpath(envelopePath);
148
+ if (!isFilesystemPathInside(realRoot, realEnvelopePath)) throw new Error('[ultramodern-release-envelope] release envelope resolves outside artifactRoot.');
149
+ } catch (error) {
150
+ if (!isMissingPathError(error)) throw error;
151
+ if (!createDirectory) return;
152
+ }
153
+ return envelopePath;
154
+ };
155
+ const writeReleaseEnvelope = async (artifactRoot, envelope)=>{
156
+ const envelopePath = await resolveSafeReleaseEnvelopePath({
157
+ artifactRoot,
158
+ createDirectory: true
159
+ });
160
+ if (!envelopePath) throw new Error('[ultramodern-release-envelope] could not resolve release envelope path.');
161
+ await promises_default().writeFile(envelopePath, `${(0, external_index_js_namespaceObject.canonicalSerializeMicroVerticalReleaseEnvelope)(envelope)}\n`);
162
+ };
163
+ const readBuildArtifact = async (distDirectory)=>{
164
+ const artifactPath = external_node_path_default().join(distDirectory, universal_namespaceObject.ULTRAMODERN_BUILD_ARTIFACT_FILE);
165
+ const artifact = await readJson(artifactPath);
166
+ if (!(0, universal_namespaceObject.isUltramodernBuildArtifact)(artifact)) throw new Error(`[ultramodern-release-envelope] ${universal_namespaceObject.ULTRAMODERN_BUILD_ARTIFACT_FILE} is missing or invalid.`);
167
+ if ('workspace' === artifact.deliveryUnit.sourceRevision) throw new Error('[ultramodern-release-envelope] sourceRevision "workspace" cannot produce a promotable full-stack envelope.');
168
+ return artifact;
169
+ };
170
+ const assertIdentityBlock = (value, identity, location, includeReleaseVersion)=>{
171
+ if (!isRecord(value)) throw new Error(`[ultramodern-release-envelope] ${location} is missing delivery identity.`);
172
+ const expected = {
173
+ unitId: identity.unitId,
174
+ buildMarker: identity.buildMarker,
175
+ sourceRevision: identity.sourceRevision,
176
+ ...includeReleaseVersion ? {
177
+ version: identity.releaseVersion
178
+ } : void 0
179
+ };
180
+ for (const [field, expectedValue] of Object.entries(expected))if (value[field] !== expectedValue) throw new Error(`[ultramodern-release-envelope] ${location}.${field} must match ${expectedValue}; received ${String(value[field])}.`);
181
+ };
182
+ const readBackendManifest = async (distDirectory, identity)=>{
183
+ const manifest = await readJson(external_node_path_default().join(distDirectory, universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE));
184
+ if (!isRecord(manifest) || !isRecord(manifest.backendFederation)) throw new Error('[ultramodern-release-envelope] backend federation manifest is missing backendFederation metadata.');
185
+ assertIdentityBlock(manifest.backendFederation.deliveryUnit, identity, 'backendFederation.deliveryUnit', true);
186
+ const versionBoundary = manifest.backendFederation.versionBoundary;
187
+ assertIdentityBlock(isRecord(versionBoundary) ? versionBoundary.deliveryUnit : void 0, identity, 'backendFederation.versionBoundary.deliveryUnit', false);
188
+ };
189
+ const collectFiles = async (root)=>{
190
+ const resolvedRoot = external_node_path_default().resolve(root);
191
+ const realRoot = await promises_default().realpath(resolvedRoot);
192
+ const collectDirectory = async (relativeDirectory)=>{
193
+ const directory = external_node_path_default().join(resolvedRoot, ...relativeDirectory.split('/').filter(Boolean));
194
+ const entries = await promises_default().readdir(directory, {
195
+ withFileTypes: true
196
+ });
197
+ const files = [];
198
+ for (const entry of entries){
199
+ const logicalPath = external_node_path_default().posix.join(relativeDirectory, entry.name);
200
+ if ('release' === logicalPath || logicalPath.startsWith('release/')) continue;
201
+ if (entry.isDirectory()) {
202
+ files.push(...await collectDirectory(logicalPath));
203
+ continue;
204
+ }
205
+ if (entry.isFile()) {
206
+ files.push(logicalPath);
207
+ continue;
208
+ }
209
+ if (!entry.isSymbolicLink()) continue;
210
+ const lexicalPath = external_node_path_default().join(resolvedRoot, ...logicalPath.split('/'));
211
+ let realPath;
212
+ try {
213
+ realPath = await promises_default().realpath(lexicalPath);
214
+ } catch {
215
+ throw new Error(`[ultramodern-release-envelope] symbolic link ${logicalPath} cannot be resolved.`);
216
+ }
217
+ if (!isFilesystemPathInside(realRoot, realPath)) throw new Error(`[ultramodern-release-envelope] symbolic link ${logicalPath} resolves outside artifactRoot.`);
218
+ const targetStat = await promises_default().stat(realPath);
219
+ if (!targetStat.isFile() && !targetStat.isDirectory()) throw new Error(`[ultramodern-release-envelope] symbolic link ${logicalPath} must resolve to a file or directory.`);
220
+ const targetLogicalPath = external_node_path_default().relative(realRoot, realPath).split(external_node_path_default().sep).join('/');
221
+ if ('release' === targetLogicalPath || targetLogicalPath.startsWith('release/')) throw new Error(`[ultramodern-release-envelope] symbolic link ${logicalPath} targets private release metadata.`);
222
+ if (targetStat.isDirectory() && isFilesystemPathInside(realPath, await promises_default().realpath(external_node_path_default().dirname(lexicalPath)))) throw new Error(`[ultramodern-release-envelope] symbolic link ${logicalPath} targets an ancestor directory.`);
223
+ files.push(logicalPath);
224
+ }
225
+ return files;
226
+ };
227
+ return (await collectDirectory('')).sort();
228
+ };
229
+ const releaseArtifact = (logicalPath, runtime)=>({
230
+ logicalPath,
231
+ runtime
232
+ });
233
+ const createReleaseArtifactInputs = async (distDirectory, identity, target)=>{
234
+ const files = await collectFiles(distDirectory);
235
+ if ('node' === target && files.some((logicalPath)=>EFFECT_BFF_WORKER_PATTERN.test(logicalPath))) throw new Error('[ultramodern-release-envelope] Node target conflicts with a Cloudflare Effect API/BFF worker artifact; resolve the canonical deploy target instead of emitting a Node envelope for Cloudflare output.');
236
+ const uiClientPaths = files.filter((logicalPath)=>{
237
+ const topLevel = logicalPath.split('/')[0];
238
+ return 'static' === topLevel || 'html' === topLevel || 'public' === topLevel || [
239
+ 'index.html',
240
+ 'mf-manifest.json',
241
+ 'mf-stats.json',
242
+ 'remoteEntry.js',
243
+ 'routes-manifest.json',
244
+ 'loadable-stats.json'
245
+ ].includes(logicalPath);
246
+ });
247
+ const ssrPaths = 'node' === target ? files.filter((logicalPath)=>logicalPath.startsWith('bundles/') && COMPILED_MODULE_PATTERN.test(logicalPath)) : files.filter((logicalPath)=>logicalPath.startsWith('worker/') && COMPILED_MODULE_PATTERN.test(logicalPath) && !EFFECT_BFF_WORKER_PATTERN.test(logicalPath));
248
+ const nodeApiEntryPaths = files.filter((logicalPath)=>logicalPath.startsWith('api/') && COMPILED_MODULE_PATTERN.test(logicalPath));
249
+ const apiBackendPaths = 'node' === target ? files.filter((logicalPath)=>(logicalPath.startsWith('api/') || logicalPath.startsWith('shared/')) && COMPILED_MODULE_PATTERN.test(logicalPath)) : files.filter((logicalPath)=>EFFECT_BFF_WORKER_PATTERN.test(logicalPath));
250
+ if (0 === uiClientPaths.length) throw new Error(`[ultramodern-release-envelope] ${target} full-stack MicroVertical has no UI/client artifacts.`);
251
+ if (0 === ssrPaths.length) throw new Error(`[ultramodern-release-envelope] ${target} full-stack MicroVertical has no ${'node' === target ? 'Node' : 'workerd'} SSR artifacts.`);
252
+ if ('node' === target && 0 === nodeApiEntryPaths.length || 0 === apiBackendPaths.length) throw new Error(`[ultramodern-release-envelope] ${target} full-stack MicroVertical has no actual ${'node' === target ? 'compiled Node Effect API artifact' : 'Effect API/BFF worker artifact'}.`);
253
+ const clientExecutionPaths = await manifestReferencedClientModules(distDirectory, files);
254
+ if (0 === clientExecutionPaths.length) throw new Error('[ultramodern-release-envelope] UI/client manifest references no compiled execution module.');
255
+ const ssrExecutionPaths = await routeReferencedSsrModules(distDirectory, files, target);
256
+ await assertEveryCompiledIdentityCarrier(distDirectory, clientExecutionPaths, identity, 'manifest-referenced UI/client');
257
+ await assertEveryCompiledIdentityCarrier(distDirectory, ssrExecutionPaths, identity, 'node' === target ? 'route-referenced Node SSR' : 'route-referenced Cloudflare SSR');
258
+ await assertEveryCompiledIdentityCarrier(distDirectory, ssrPaths, identity, 'node' === target ? 'compiled Node SSR closure' : 'compiled Cloudflare SSR/workerd closure');
259
+ await assertEveryCompiledIdentityCarrier(distDirectory, 'node' === target ? nodeApiEntryPaths : apiBackendPaths, identity, 'node' === target ? 'Node API/backend' : 'Cloudflare API/backend');
260
+ await assertEveryCompiledIdentityCarrier(distDirectory, [
261
+ universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE
262
+ ], identity, 'backend Module Federation container');
263
+ const runtimeByPath = new Map();
264
+ const add = (paths, runtime)=>{
265
+ for (const logicalPath of paths){
266
+ const existing = runtimeByPath.get(logicalPath);
267
+ if (existing && existing !== runtime) throw new Error(`[ultramodern-release-envelope] artifact "${logicalPath}" cannot carry conflicting runtimes "${existing}" and "${runtime}".`);
268
+ runtimeByPath.set(logicalPath, runtime);
269
+ }
270
+ };
271
+ add(uiClientPaths, 'browser');
272
+ add(ssrPaths, 'node' === target ? 'nodejs' : 'workerd');
273
+ add(apiBackendPaths, 'node' === target ? 'nodejs' : 'workerd-effect');
274
+ add([
275
+ universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE
276
+ ], 'module-federation-manifest');
277
+ add([
278
+ universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE
279
+ ], 'node' === target ? 'nodejs' : 'commonjs-module');
280
+ const surfaces = {
281
+ uiClient: [
282
+ ...uiClientPaths
283
+ ].sort((left, right)=>left.localeCompare(right)),
284
+ ssr: [
285
+ ...ssrPaths
286
+ ].sort((left, right)=>left.localeCompare(right)),
287
+ apiBackend: [
288
+ ...apiBackendPaths
289
+ ].sort((left, right)=>left.localeCompare(right)),
290
+ backendFederation: {
291
+ manifest: universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE,
292
+ container: universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE
293
+ }
294
+ };
295
+ const artifacts = [
296
+ ...runtimeByPath
297
+ ].map(([logicalPath, runtime])=>releaseArtifact(logicalPath, runtime)).sort((left, right)=>left.logicalPath.localeCompare(right.logicalPath));
298
+ return {
299
+ artifacts,
300
+ surfaces
301
+ };
302
+ };
303
+ const pathExists = async (filePath)=>{
304
+ try {
305
+ await promises_default().access(filePath);
306
+ return true;
307
+ } catch {
308
+ return false;
309
+ }
310
+ };
311
+ const emitFrameworkMicroVerticalReleaseEnvelope = async ({ apiOnly, distDirectory, target })=>{
312
+ if (apiOnly) return;
313
+ const backendManifestPath = external_node_path_default().join(distDirectory, universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE);
314
+ const backendContainerPath = external_node_path_default().join(distDirectory, universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE);
315
+ const [hasBackendManifest, hasBackendContainer] = await Promise.all([
316
+ pathExists(backendManifestPath),
317
+ pathExists(backendContainerPath)
318
+ ]);
319
+ if (!hasBackendManifest && !hasBackendContainer) return;
320
+ if (!hasBackendManifest || !hasBackendContainer) throw new Error('[ultramodern-release-envelope] full-stack MicroVertical backend federation manifest and container must be emitted together.');
321
+ const buildArtifact = await readBuildArtifact(distDirectory);
322
+ const identity = {
323
+ unitId: buildArtifact.deliveryUnit.unitId,
324
+ buildMarker: buildArtifact.deliveryUnit.buildMarker,
325
+ sourceRevision: buildArtifact.deliveryUnit.sourceRevision,
326
+ releaseVersion: buildArtifact.deliveryUnit.version
327
+ };
328
+ await readBackendManifest(distDirectory, identity);
329
+ const { artifacts, surfaces } = await createReleaseArtifactInputs(distDirectory, identity, target);
330
+ const envelope = await (0, external_index_js_namespaceObject.createMicroVerticalReleaseEnvelope)({
331
+ artifactRoot: distDirectory,
332
+ target,
333
+ identity,
334
+ artifacts,
335
+ surfaces
336
+ });
337
+ await writeReleaseEnvelope(distDirectory, envelope);
338
+ return envelope;
339
+ };
340
+ const readFrameworkMicroVerticalReleaseEnvelope = async ({ artifactRoot, expectedTarget, logicalPathForArtifact, required = false })=>{
341
+ const envelopePath = await resolveSafeReleaseEnvelopePath({
342
+ artifactRoot,
343
+ createDirectory: false
344
+ });
345
+ if (!envelopePath) {
346
+ if (required) throw new Error(`[ultramodern-release-envelope] required envelope is missing at ${MICROVERTICAL_RELEASE_ENVELOPE_PATH}.`);
347
+ return;
348
+ }
349
+ return (0, external_index_js_namespaceObject.verifyMicroVerticalReleaseEnvelope)(await readJson(envelopePath), {
350
+ artifactRoot,
351
+ ...expectedTarget ? {
352
+ expectedTarget
353
+ } : {},
354
+ ...logicalPathForArtifact ? {
355
+ logicalPathForArtifact
356
+ } : {}
357
+ });
358
+ };
359
+ const verifyBuildOutputReleaseEnvelope = async (distDirectory, expectedTarget)=>{
360
+ const [hasEnvelope, hasBuildArtifact, hasBackendManifest, hasBackendEntry] = await Promise.all([
361
+ pathExists(external_node_path_default().join(distDirectory, MICROVERTICAL_RELEASE_ENVELOPE_PATH)),
362
+ pathExists(external_node_path_default().join(distDirectory, universal_namespaceObject.ULTRAMODERN_BUILD_ARTIFACT_FILE)),
363
+ pathExists(external_node_path_default().join(distDirectory, universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE)),
364
+ pathExists(external_node_path_default().join(distDirectory, universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE))
365
+ ]);
366
+ const isFullStackMicroVertical = hasBuildArtifact && (hasBackendManifest || hasBackendEntry);
367
+ return readFrameworkMicroVerticalReleaseEnvelope({
368
+ artifactRoot: distDirectory,
369
+ ...expectedTarget ? {
370
+ expectedTarget
371
+ } : {},
372
+ required: hasEnvelope || isFullStackMicroVertical
373
+ });
374
+ };
375
+ const verifyNodeReleaseEnvelopeStaging = async ({ outputDirectory })=>readFrameworkMicroVerticalReleaseEnvelope({
376
+ artifactRoot: outputDirectory,
377
+ expectedTarget: 'node',
378
+ required: true
379
+ });
380
+ const createNodeStagedReleaseArtifactInputs = async (outputDirectory, identity)=>{
381
+ const files = await collectFiles(outputDirectory);
382
+ for (const requiredPath of [
383
+ 'index.js',
384
+ 'package.json',
385
+ universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE,
386
+ universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE
387
+ ])if (!files.includes(requiredPath)) throw new Error(`[ultramodern-release-envelope] final Node staging is missing ${requiredPath}.`);
388
+ const backendFederationPaths = new Set([
389
+ universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE,
390
+ universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE
391
+ ]);
392
+ const uiClientPaths = files.filter((logicalPath)=>{
393
+ const topLevel = logicalPath.split('/')[0];
394
+ return 'static' === topLevel || 'html' === topLevel || 'public' === topLevel || [
395
+ 'index.html',
396
+ 'mf-manifest.json',
397
+ 'mf-stats.json',
398
+ 'remoteEntry.js',
399
+ 'routes-manifest.json',
400
+ 'loadable-stats.json'
401
+ ].includes(logicalPath);
402
+ });
403
+ const ssrPaths = files.filter((logicalPath)=>'index.js' === logicalPath || logicalPath.startsWith('bundles/') && COMPILED_MODULE_PATTERN.test(logicalPath));
404
+ const apiBackendPaths = files.filter((logicalPath)=>(logicalPath.startsWith('api/') || logicalPath.startsWith('shared/')) && COMPILED_MODULE_PATTERN.test(logicalPath));
405
+ for (const [surface, paths] of [
406
+ [
407
+ 'UI/client',
408
+ uiClientPaths
409
+ ],
410
+ [
411
+ 'Node SSR',
412
+ ssrPaths
413
+ ],
414
+ [
415
+ 'Node API/backend',
416
+ apiBackendPaths
417
+ ]
418
+ ])if (0 === paths.length) throw new Error(`[ultramodern-release-envelope] final Node staging has no ${surface} artifacts.`);
419
+ const clientExecutionPaths = await manifestReferencedClientModules(outputDirectory, files);
420
+ const ssrExecutionPaths = await routeReferencedSsrModules(outputDirectory, files, 'node');
421
+ await assertEveryCompiledIdentityCarrier(outputDirectory, clientExecutionPaths, identity, 'final manifest-referenced Node UI/client');
422
+ await assertEveryCompiledIdentityCarrier(outputDirectory, ssrExecutionPaths, identity, 'final route-referenced Node SSR');
423
+ await assertEveryCompiledIdentityCarrier(outputDirectory, ssrPaths.filter((logicalPath)=>'index.js' !== logicalPath), identity, 'final compiled Node SSR closure');
424
+ await assertEveryCompiledIdentityCarrier(outputDirectory, apiBackendPaths.filter((logicalPath)=>logicalPath.startsWith('api/')), identity, 'final Node API/backend');
425
+ await assertEveryCompiledIdentityCarrier(outputDirectory, [
426
+ universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE
427
+ ], identity, 'final Node backend Module Federation container');
428
+ const runtimeByPath = new Map(files.filter((logicalPath)=>!backendFederationPaths.has(logicalPath)).map((logicalPath)=>[
429
+ logicalPath,
430
+ 'nodejs-deployment'
431
+ ]));
432
+ for (const logicalPath of uiClientPaths)runtimeByPath.set(logicalPath, 'browser');
433
+ for (const logicalPath of ssrPaths)runtimeByPath.set(logicalPath, 'nodejs');
434
+ for (const logicalPath of apiBackendPaths)runtimeByPath.set(logicalPath, 'nodejs');
435
+ runtimeByPath.set(universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE, 'module-federation-manifest');
436
+ runtimeByPath.set(universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE, 'nodejs');
437
+ return {
438
+ artifacts: [
439
+ ...runtimeByPath
440
+ ].map(([logicalPath, runtime])=>releaseArtifact(logicalPath, runtime)).sort((left, right)=>left.logicalPath.localeCompare(right.logicalPath)),
441
+ surfaces: {
442
+ uiClient: [
443
+ ...uiClientPaths
444
+ ].sort((left, right)=>left.localeCompare(right)),
445
+ ssr: [
446
+ ...ssrPaths
447
+ ].sort((left, right)=>left.localeCompare(right)),
448
+ apiBackend: [
449
+ ...apiBackendPaths
450
+ ].sort((left, right)=>left.localeCompare(right)),
451
+ backendFederation: {
452
+ manifest: universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE,
453
+ container: universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE
454
+ }
455
+ }
456
+ };
457
+ };
458
+ const emitNodeStagedReleaseEnvelope = async ({ distDirectory, outputDirectory })=>{
459
+ const source = await verifyBuildOutputReleaseEnvelope(distDirectory, 'node');
460
+ if (!source) return;
461
+ const { artifacts, surfaces } = await createNodeStagedReleaseArtifactInputs(outputDirectory, source.identity);
462
+ const staged = await (0, external_index_js_namespaceObject.createMicroVerticalReleaseEnvelope)({
463
+ artifactRoot: outputDirectory,
464
+ target: 'node',
465
+ identity: source.identity,
466
+ artifacts,
467
+ surfaces
468
+ });
469
+ await writeReleaseEnvelope(outputDirectory, staged);
470
+ return staged;
471
+ };
472
+ const stageCloudflareReleaseEnvelope = async ({ distDirectory, outputDirectory })=>{
473
+ const source = await verifyBuildOutputReleaseEnvelope(distDirectory, 'cloudflare');
474
+ if (!source) return;
475
+ const stagedEnvelopePath = external_node_path_default().join(outputDirectory, MICROVERTICAL_RELEASE_ENVELOPE_PATH);
476
+ if (await pathExists(stagedEnvelopePath)) throw new Error('[ultramodern-release-envelope] Cloudflare staging contains a stale envelope before final output generation.');
477
+ return source;
478
+ };
479
+ const createCloudflareStagedReleaseArtifactInputs = async (outputDirectory, identity)=>{
480
+ const files = await collectFiles(outputDirectory);
481
+ for (const requiredPath of [
482
+ 'server/index.mjs',
483
+ 'server/modern-worker-manifest.json',
484
+ 'wrangler.json',
485
+ 'package.json',
486
+ 'worker/package.json'
487
+ ])if (!files.includes(requiredPath)) throw new Error(`[ultramodern-release-envelope] final Cloudflare staging is missing ${requiredPath}.`);
488
+ if (files.some((logicalPath)=>'public/release' === logicalPath || logicalPath.startsWith('public/release/'))) throw new Error('[ultramodern-release-envelope] final Cloudflare envelope must remain private and cannot be staged under public/release.');
489
+ const backendManifestPath = `public/${universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE}`;
490
+ const backendContainerPath = `public/${universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE}`;
491
+ const apiBackendPaths = files.filter((logicalPath)=>EFFECT_BFF_WORKER_PATTERN.test(logicalPath));
492
+ const ssrPaths = files.filter((logicalPath)=>(logicalPath.startsWith('server/') || logicalPath.startsWith('worker/')) && COMPILED_MODULE_PATTERN.test(logicalPath) && !EFFECT_BFF_WORKER_PATTERN.test(logicalPath));
493
+ const uiClientPaths = files.filter((logicalPath)=>logicalPath.startsWith('public/') && logicalPath !== backendManifestPath && logicalPath !== backendContainerPath);
494
+ for (const [surface, paths] of [
495
+ [
496
+ 'UI/client',
497
+ uiClientPaths
498
+ ],
499
+ [
500
+ 'Cloudflare SSR',
501
+ ssrPaths
502
+ ],
503
+ [
504
+ 'Cloudflare API/backend',
505
+ apiBackendPaths
506
+ ]
507
+ ])if (0 === paths.length) throw new Error(`[ultramodern-release-envelope] final Cloudflare staging has no ${surface} artifacts.`);
508
+ for (const logicalPath of [
509
+ backendManifestPath,
510
+ backendContainerPath
511
+ ])if (!files.includes(logicalPath)) throw new Error(`[ultramodern-release-envelope] final Cloudflare staging is missing ${logicalPath}.`);
512
+ const clientExecutionPaths = await manifestReferencedClientModules(outputDirectory, files, 'public/mf-manifest.json');
513
+ const ssrExecutionPaths = await routeReferencedSsrModules(outputDirectory, files, 'cloudflare', 'server/route.json');
514
+ await assertEveryCompiledIdentityCarrier(outputDirectory, clientExecutionPaths, identity, 'final manifest-referenced Cloudflare UI/client');
515
+ await assertEveryCompiledIdentityCarrier(outputDirectory, ssrExecutionPaths, identity, 'final route-referenced Cloudflare SSR');
516
+ await assertEveryCompiledIdentityCarrier(outputDirectory, ssrPaths.filter((logicalPath)=>logicalPath.startsWith('worker/')), identity, 'final compiled Cloudflare SSR/workerd closure');
517
+ await assertEveryCompiledIdentityCarrier(outputDirectory, apiBackendPaths, identity, 'final Cloudflare API/backend');
518
+ await assertEveryCompiledIdentityCarrier(outputDirectory, [
519
+ backendContainerPath
520
+ ], identity, 'final Cloudflare backend Module Federation container');
521
+ const runtimeByPath = new Map();
522
+ for (const logicalPath of files)runtimeByPath.set(logicalPath, 'cloudflare-deployment');
523
+ const add = (paths, runtime)=>{
524
+ for (const logicalPath of paths)runtimeByPath.set(logicalPath, runtime);
525
+ };
526
+ add(uiClientPaths, 'browser');
527
+ add(ssrPaths, 'workerd');
528
+ add(apiBackendPaths, 'workerd-effect');
529
+ add([
530
+ backendManifestPath
531
+ ], 'module-federation-manifest');
532
+ add([
533
+ backendContainerPath
534
+ ], 'commonjs-module');
535
+ return {
536
+ artifacts: [
537
+ ...runtimeByPath
538
+ ].map(([logicalPath, runtime])=>releaseArtifact(logicalPath, runtime)).sort((left, right)=>left.logicalPath.localeCompare(right.logicalPath)),
539
+ surfaces: {
540
+ uiClient: [
541
+ ...uiClientPaths
542
+ ].sort((left, right)=>left.localeCompare(right)),
543
+ ssr: [
544
+ ...ssrPaths
545
+ ].sort((left, right)=>left.localeCompare(right)),
546
+ apiBackend: [
547
+ ...apiBackendPaths
548
+ ].sort((left, right)=>left.localeCompare(right)),
549
+ backendFederation: {
550
+ manifest: backendManifestPath,
551
+ container: backendContainerPath
552
+ }
553
+ }
554
+ };
555
+ };
556
+ const emitCloudflareStagedReleaseEnvelope = async ({ distDirectory, outputDirectory })=>{
557
+ const source = await verifyBuildOutputReleaseEnvelope(distDirectory, 'cloudflare');
558
+ if (!source) return;
559
+ const { artifacts, surfaces } = await createCloudflareStagedReleaseArtifactInputs(outputDirectory, source.identity);
560
+ const staged = await (0, external_index_js_namespaceObject.createMicroVerticalReleaseEnvelope)({
561
+ artifactRoot: outputDirectory,
562
+ target: 'cloudflare',
563
+ identity: source.identity,
564
+ artifacts,
565
+ surfaces
566
+ });
567
+ await writeReleaseEnvelope(outputDirectory, staged);
568
+ return staged;
569
+ };
570
+ const verifyCloudflareReleaseEnvelopeStaging = async (outputDirectory)=>readFrameworkMicroVerticalReleaseEnvelope({
571
+ artifactRoot: outputDirectory,
572
+ expectedTarget: 'cloudflare',
573
+ required: true
574
+ });
575
+ exports.MICROVERTICAL_RELEASE_ENVELOPE_PATH = __webpack_exports__.MICROVERTICAL_RELEASE_ENVELOPE_PATH;
576
+ exports.emitCloudflareStagedReleaseEnvelope = __webpack_exports__.emitCloudflareStagedReleaseEnvelope;
577
+ exports.emitFrameworkMicroVerticalReleaseEnvelope = __webpack_exports__.emitFrameworkMicroVerticalReleaseEnvelope;
578
+ exports.emitNodeStagedReleaseEnvelope = __webpack_exports__.emitNodeStagedReleaseEnvelope;
579
+ exports.readFrameworkMicroVerticalReleaseEnvelope = __webpack_exports__.readFrameworkMicroVerticalReleaseEnvelope;
580
+ exports.stageCloudflareReleaseEnvelope = __webpack_exports__.stageCloudflareReleaseEnvelope;
581
+ exports.verifyBuildOutputReleaseEnvelope = __webpack_exports__.verifyBuildOutputReleaseEnvelope;
582
+ exports.verifyCloudflareReleaseEnvelopeStaging = __webpack_exports__.verifyCloudflareReleaseEnvelopeStaging;
583
+ exports.verifyNodeReleaseEnvelopeStaging = __webpack_exports__.verifyNodeReleaseEnvelopeStaging;
584
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
585
+ "MICROVERTICAL_RELEASE_ENVELOPE_PATH",
586
+ "emitCloudflareStagedReleaseEnvelope",
587
+ "emitFrameworkMicroVerticalReleaseEnvelope",
588
+ "emitNodeStagedReleaseEnvelope",
589
+ "readFrameworkMicroVerticalReleaseEnvelope",
590
+ "stageCloudflareReleaseEnvelope",
591
+ "verifyBuildOutputReleaseEnvelope",
592
+ "verifyCloudflareReleaseEnvelopeStaging",
593
+ "verifyNodeReleaseEnvelopeStaging"
594
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
595
+ Object.defineProperty(exports, '__esModule', {
596
+ value: true
597
+ });