@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.99 → 3.8.1-ultramodern.1

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 (411) hide show
  1. package/bin/modern-bundle-docs.js +7 -0
  2. package/dist/cjs/builder/generator/getBuilderEnvironments.js +73 -11
  3. package/dist/cjs/bundleDocs.js +114 -0
  4. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +1 -1
  5. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.js +94 -18
  6. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +1 -0
  7. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +14 -0
  8. package/dist/cjs/ultramodern-release-envelope/framework-output.js +109 -57
  9. package/dist/esm/builder/generator/getBuilderEnvironments.mjs +63 -10
  10. package/dist/esm/bundleDocs.mjs +62 -0
  11. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +1 -1
  12. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +93 -18
  13. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +1 -0
  14. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +14 -0
  15. package/dist/esm/ultramodern-release-envelope/framework-output.mjs +107 -58
  16. package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +63 -10
  17. package/dist/esm-node/bundleDocs.mjs +63 -0
  18. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +1 -1
  19. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +93 -18
  20. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +1 -0
  21. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +14 -0
  22. package/dist/esm-node/ultramodern-release-envelope/framework-output.mjs +107 -58
  23. package/dist/types/builder/generator/getBuilderEnvironments.d.ts +29 -0
  24. package/dist/types/bundleDocs.d.ts +20 -0
  25. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.d.ts +1 -1
  26. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.d.mts +1 -1
  27. package/dist/types/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.d.mts +13 -0
  28. package/dist/types/ultramodern-release-envelope/framework-output.d.ts +1 -0
  29. package/docs/apis/app/{commands.mdx → commands.md} +35 -9
  30. package/docs/apis/app/hooks/api/{lambda.mdx → lambda.md} +2 -6
  31. package/docs/apis/app/hooks/config/{favicon.mdx → favicon.md} +1 -6
  32. package/docs/apis/app/hooks/config/{html.mdx → html.md} +1 -5
  33. package/docs/apis/app/hooks/config/{icon.mdx → icon.md} +1 -6
  34. package/docs/apis/app/hooks/config/{mock.mdx → mock.md} +1 -5
  35. package/docs/apis/app/hooks/config/{public.mdx → public.md} +0 -4
  36. package/docs/apis/app/hooks/config/{upload.mdx → upload.md} +3 -7
  37. package/docs/apis/app/hooks/{modern-config.mdx → modern-config.md} +1 -5
  38. package/docs/apis/app/hooks/server/{server.mdx → server.md} +1 -6
  39. package/docs/apis/app/hooks/{shared.mdx → shared.md} +0 -4
  40. package/docs/apis/app/hooks/src/{app.mdx → app.md} +2 -2
  41. package/docs/apis/app/hooks/src/{entry.mdx → entry.md} +1 -6
  42. package/docs/apis/app/hooks/src/{entry.server.mdx → entry.server.md} +0 -5
  43. package/docs/apis/app/hooks/src/{modern.runtime.mdx → modern.runtime.md} +1 -5
  44. package/docs/apis/app/hooks/src/{routes.mdx → routes.md} +3 -7
  45. package/docs/apis/app/hooks/src/{server.mdx → server.md} +1 -5
  46. package/docs/apis/app/runtime/bff/{use-backend-context.mdx → use-backend-context.md} +0 -3
  47. package/docs/apis/app/runtime/core/{create-root.mdx → create-root.md} +0 -3
  48. package/docs/apis/app/runtime/core/{render.mdx → render.md} +1 -4
  49. package/docs/apis/app/runtime/core/{runtime-context.mdx → runtime-context.md} +0 -4
  50. package/docs/apis/app/runtime/router/{router.mdx → router.md} +1 -6
  51. package/docs/apis/app/runtime/ssr/{no-ssr.mdx → no-ssr.md} +0 -3
  52. package/docs/apis/app/runtime/ssr/{renderStreaming.mdx → renderStreaming.md} +0 -4
  53. package/docs/apis/app/runtime/ssr/{renderString.mdx → renderString.md} +0 -4
  54. package/docs/apis/app/runtime/ssr/{requestHandler.mdx → requestHandler.md} +0 -4
  55. package/docs/apis/app/runtime/utility/{css-in-js.mdx → css-in-js.md} +0 -4
  56. package/docs/apis/app/runtime/utility/{head.mdx → head.md} +0 -3
  57. package/docs/apis/app/runtime/utility/{loadable.mdx → loadable.md} +0 -3
  58. package/docs/community/blog/2022-0708-updates.md +91 -0
  59. package/docs/community/blog/2022-0910-updates.md +76 -0
  60. package/docs/community/blog/overview.md +63 -0
  61. package/docs/community/blog/v2-release-note.md +238 -0
  62. package/docs/community/blog/v3-release-note.md +622 -0
  63. package/docs/community/contributing-guide.md +252 -0
  64. package/docs/community/releases.md +23 -0
  65. package/docs/community/showcase.md +24 -0
  66. package/docs/community/team.md +14 -0
  67. package/docs/configure/app/bff/{cross-project.mdx → cross-project.md} +4 -8
  68. package/docs/configure/app/bff/{effect.mdx → effect.md} +16 -22
  69. package/docs/configure/app/bff/{prefix.mdx → prefix.md} +3 -7
  70. package/docs/configure/app/bff/{runtime-framework.mdx → runtime-framework.md} +3 -7
  71. package/docs/configure/app/{builder-plugins.mdx → builder-plugins.md} +4 -8
  72. package/docs/configure/app/dev/{asset-prefix.mdx → asset-prefix.md} +4 -9
  73. package/docs/configure/app/dev/{before-start-url.mdx → before-start-url.md} +0 -4
  74. package/docs/configure/app/dev/{client.mdx → client.md} +3 -7
  75. package/docs/configure/app/dev/hmr.md +10 -0
  76. package/docs/configure/app/dev/{host.mdx → host.md} +0 -4
  77. package/docs/configure/app/dev/{https.mdx → https.md} +0 -4
  78. package/docs/configure/app/dev/{lazy-compilation.mdx → lazy-compilation.md} +2 -8
  79. package/docs/configure/app/dev/live-reload.md +10 -0
  80. package/docs/configure/app/dev/{mock-dir.mdx → mock-dir.md} +0 -4
  81. package/docs/configure/app/dev/progress-bar.md +19 -0
  82. package/docs/configure/app/dev/{server.mdx → server.md} +0 -4
  83. package/docs/configure/app/dev/{setup-middlewares.mdx → setup-middlewares.md} +3 -7
  84. package/docs/configure/app/dev/{start-url.mdx → start-url.md} +0 -5
  85. package/docs/configure/app/dev/{watch-files.mdx → watch-files.md} +3 -7
  86. package/docs/configure/app/dev/{write-to-disk.mdx → write-to-disk.md} +3 -7
  87. package/docs/configure/app/experiments/{source-build.mdx → source-build.md} +1 -3
  88. package/docs/configure/app/html/{app-icon.mdx → app-icon.md} +3 -7
  89. package/docs/configure/app/html/{crossorigin.mdx → crossorigin.md} +3 -7
  90. package/docs/configure/app/html/{favicon.mdx → favicon.md} +3 -7
  91. package/docs/configure/app/html/inject.md +10 -0
  92. package/docs/configure/app/html/{meta.mdx → meta.md} +3 -7
  93. package/docs/configure/app/html/{mount-id.mdx → mount-id.md} +3 -7
  94. package/docs/configure/app/html/output-structure.md +10 -0
  95. package/docs/configure/app/html/script-loading.md +10 -0
  96. package/docs/configure/app/html/{tags.mdx → tags.md} +3 -7
  97. package/docs/configure/app/html/{template-parameters.mdx → template-parameters.md} +3 -7
  98. package/docs/configure/app/html/template.md +10 -0
  99. package/docs/configure/app/html/title.md +18 -0
  100. package/docs/configure/app/output/asset-prefix.md +11 -0
  101. package/docs/configure/app/output/{assets-retry.mdx → assets-retry.md} +1 -5
  102. package/docs/configure/app/output/{charset.mdx → charset.md} +3 -7
  103. package/docs/configure/app/output/{clean-dist-path.mdx → clean-dist-path.md} +0 -4
  104. package/docs/configure/app/output/{convert-to-rem.mdx → convert-to-rem.md} +12 -16
  105. package/docs/configure/app/output/{copy.mdx → copy.md} +3 -7
  106. package/docs/configure/app/output/{css-modules.mdx → css-modules.md} +3 -7
  107. package/docs/configure/app/output/{data-uri-limit.mdx → data-uri-limit.md} +3 -7
  108. package/docs/configure/app/output/{disable-css-module-extension.mdx → disable-css-module-extension.md} +3 -7
  109. package/docs/configure/app/output/{disable-inline-runtime-chunk.mdx → disable-inline-runtime-chunk.md} +0 -4
  110. package/docs/configure/app/output/{disable-svgr.mdx → disable-svgr.md} +0 -4
  111. package/docs/configure/app/output/{disable-ts-checker.mdx → disable-ts-checker.md} +0 -4
  112. package/docs/configure/app/output/{dist-path.mdx → dist-path.md} +3 -11
  113. package/docs/configure/app/output/{enable-asset-manifest.mdx → enable-asset-manifest.md} +0 -4
  114. package/docs/configure/app/output/{enable-css-module-tsdeclaration.mdx → enable-css-module-tsdeclaration.md} +0 -4
  115. package/docs/configure/app/output/{enable-inline-route-manifests.mdx → enable-inline-route-manifests.md} +0 -4
  116. package/docs/configure/app/output/{externals.mdx → externals.md} +3 -7
  117. package/docs/configure/app/output/filename-hash.md +10 -0
  118. package/docs/configure/app/output/{filename.mdx → filename.md} +3 -7
  119. package/docs/configure/app/output/inject-styles.md +10 -0
  120. package/docs/configure/app/output/{inline-scripts.mdx → inline-scripts.md} +4 -8
  121. package/docs/configure/app/output/{inline-styles.mdx → inline-styles.md} +4 -8
  122. package/docs/configure/app/output/{legal-comments.mdx → legal-comments.md} +3 -7
  123. package/docs/configure/app/output/{minify.mdx → minify.md} +3 -7
  124. package/docs/configure/app/output/{override-browserslist.mdx → override-browserslist.md} +4 -8
  125. package/docs/configure/app/output/polyfill.md +12 -0
  126. package/docs/configure/app/output/{source-map.mdx → source-map.md} +3 -7
  127. package/docs/configure/app/output/{split-route-chunks.mdx → split-route-chunks.md} +0 -4
  128. package/docs/configure/app/output/{ssg.mdx → ssg.md} +3 -7
  129. package/docs/configure/app/output/{ssgByEntries.mdx → ssgByEntries.md} +1 -4
  130. package/docs/configure/app/output/{svg-default-export.mdx → svg-default-export.md} +0 -4
  131. package/docs/configure/app/output/{temp-dir.mdx → temp-dir.md} +0 -4
  132. package/docs/configure/app/performance/{build-cache.mdx → build-cache.md} +3 -7
  133. package/docs/configure/app/performance/{chunk-split.mdx → chunk-split.md} +3 -7
  134. package/docs/configure/app/performance/{dns-prefetch.mdx → dns-prefetch.md} +3 -7
  135. package/docs/configure/app/performance/preconnect.md +16 -0
  136. package/docs/configure/app/performance/{prefetch.mdx → prefetch.md} +3 -7
  137. package/docs/configure/app/performance/{preload.mdx → preload.md} +3 -7
  138. package/docs/configure/app/performance/{print-file-size.mdx → print-file-size.md} +3 -7
  139. package/docs/configure/app/performance/profile.md +10 -0
  140. package/docs/configure/app/performance/remove-console.md +10 -0
  141. package/docs/configure/app/performance/remove-moment-locale.md +10 -0
  142. package/docs/configure/app/performance/{rsdoctor.mdx → rsdoctor.md} +0 -4
  143. package/docs/configure/app/{plugins.mdx → plugins.md} +4 -4
  144. package/docs/configure/app/resolve/{alias-strategy.mdx → alias-strategy.md} +3 -7
  145. package/docs/configure/app/resolve/alias.md +9 -0
  146. package/docs/configure/app/resolve/{condition-names.mdx → condition-names.md} +3 -8
  147. package/docs/configure/app/resolve/{dedupe.mdx → dedupe.md} +3 -7
  148. package/docs/configure/app/resolve/{extensions.mdx → extensions.md} +3 -8
  149. package/docs/configure/app/runtime/{0-intro.mdx → 0-intro.md} +1 -4
  150. package/docs/configure/app/runtime/{plugins.mdx → plugins.md} +1 -1
  151. package/docs/configure/app/runtime/{router.mdx → router.md} +3 -7
  152. package/docs/configure/app/security/{check-syntax.mdx → check-syntax.md} +0 -4
  153. package/docs/configure/app/security/{nonce.mdx → nonce.md} +3 -7
  154. package/docs/configure/app/security/{sri.mdx → sri.md} +0 -4
  155. package/docs/configure/app/server/{base-url.mdx → base-url.md} +0 -4
  156. package/docs/configure/app/server/{port.mdx → port.md} +3 -7
  157. package/docs/configure/app/server/{public-routes.mdx → public-routes.md} +0 -4
  158. package/docs/configure/app/server/{routes.mdx → routes.md} +1 -5
  159. package/docs/configure/app/server/rsc.md +22 -0
  160. package/docs/configure/app/server/{ssr-by-entries.mdx → ssr-by-entries.md} +1 -5
  161. package/docs/configure/app/server/ssr.md +80 -0
  162. package/docs/configure/app/server/{tsconfig-path.mdx → tsconfig-path.md} +0 -4
  163. package/docs/configure/app/source/{alias-strategy.mdx → alias-strategy.md} +4 -8
  164. package/docs/configure/app/source/{alias.mdx → alias.md} +4 -8
  165. package/docs/configure/app/source/{config-dir.mdx → config-dir.md} +1 -5
  166. package/docs/configure/app/source/{decorators.mdx → decorators.md} +0 -4
  167. package/docs/configure/app/source/{define.mdx → define.md} +3 -7
  168. package/docs/configure/app/source/{disable-default-entries.mdx → disable-default-entries.md} +2 -6
  169. package/docs/{components/module-federation.mdx → configure/app/source/enable-async-entry.md} +47 -0
  170. package/docs/configure/app/source/{enable-async-pre-entry.mdx → enable-async-pre-entry.md} +0 -4
  171. package/docs/configure/app/source/{entries-dir.mdx → entries-dir.md} +0 -4
  172. package/docs/configure/app/source/{entries.mdx → entries.md} +1 -5
  173. package/docs/configure/app/source/{exclude.mdx → exclude.md} +4 -8
  174. package/docs/configure/app/source/{global-vars.mdx → global-vars.md} +0 -4
  175. package/docs/configure/app/source/{include.mdx → include.md} +4 -8
  176. package/docs/configure/app/source/{main-entry-name.mdx → main-entry-name.md} +0 -4
  177. package/docs/configure/app/source/{pre-entry.mdx → pre-entry.md} +3 -7
  178. package/docs/configure/app/source/{react-compiler.mdx → react-compiler.md} +0 -4
  179. package/docs/configure/app/source/{transform-import.mdx → transform-import.md} +3 -7
  180. package/docs/configure/app/{split-chunks.mdx → split-chunks.md} +3 -3
  181. package/docs/configure/app/tools/{autoprefixer.mdx → autoprefixer.md} +0 -4
  182. package/docs/configure/app/tools/{bundler-chain.mdx → bundler-chain.md} +0 -4
  183. package/docs/configure/app/tools/{css-extract.mdx → css-extract.md} +3 -7
  184. package/docs/configure/app/tools/{css-loader.mdx → css-loader.md} +3 -7
  185. package/docs/configure/app/tools/{dev-server.mdx → dev-server.md} +0 -4
  186. package/docs/configure/app/tools/{html-plugin.mdx → html-plugin.md} +3 -7
  187. package/docs/configure/app/tools/{less.mdx → less.md} +0 -4
  188. package/docs/configure/app/tools/{lightningcss-loader.mdx → lightningcss-loader.md} +3 -7
  189. package/docs/configure/app/tools/{minify-css.mdx → minify-css.md} +0 -4
  190. package/docs/configure/app/tools/{postcss.mdx → postcss.md} +3 -7
  191. package/docs/configure/app/tools/rspack.md +10 -0
  192. package/docs/configure/app/tools/{sass.mdx → sass.md} +0 -4
  193. package/docs/configure/app/tools/style-loader.md +10 -0
  194. package/docs/configure/app/tools/{swc.mdx → swc.md} +4 -8
  195. package/docs/configure/app/tools/{ts-checker.mdx → ts-checker.md} +20 -7
  196. package/docs/configure/app/{usage.mdx → usage.md} +1 -1
  197. package/docs/guides/advanced-features/bff/{cross-project.mdx → cross-project.md} +1 -2
  198. package/docs/guides/advanced-features/bff/{data-platform.mdx → data-platform.md} +0 -4
  199. package/docs/guides/advanced-features/bff/{extend-server.mdx → extend-server.md} +1 -1
  200. package/docs/guides/advanced-features/bff/frameworks.md +243 -0
  201. package/docs/guides/advanced-features/bff/{function.mdx → function.md} +60 -7
  202. package/docs/guides/advanced-features/bff/{operators.mdx → operators.md} +2 -77
  203. package/docs/{components/bff-upload.mdx → guides/advanced-features/bff/upload.md} +4 -0
  204. package/docs/guides/advanced-features/{bff.mdx → bff.md} +0 -4
  205. package/docs/guides/advanced-features/{build-performance.mdx → build-performance.md} +3 -7
  206. package/docs/guides/advanced-features/{compatibility.mdx → compatibility.md} +54 -15
  207. package/docs/guides/advanced-features/international/{advanced.mdx → advanced.md} +0 -4
  208. package/docs/guides/advanced-features/international/{api.mdx → api.md} +16 -20
  209. package/docs/guides/advanced-features/international/{best-practices.mdx → best-practices.md} +0 -4
  210. package/docs/guides/advanced-features/international/configuration.md +228 -0
  211. package/docs/guides/advanced-features/international/{locale-detection.mdx → locale-detection.md} +25 -29
  212. package/docs/guides/advanced-features/international/{quick-start.mdx → quick-start.md} +29 -13
  213. package/docs/guides/advanced-features/international/{resource-loading.mdx → resource-loading.md} +11 -15
  214. package/docs/guides/advanced-features/international/{routing.mdx → routing.md} +12 -16
  215. package/docs/guides/advanced-features/international.md +27 -0
  216. package/docs/guides/advanced-features/{low-level.mdx → low-level.md} +17 -21
  217. package/docs/guides/advanced-features/page-performance/{code-split.mdx → code-split.md} +2 -6
  218. package/docs/guides/advanced-features/page-performance/{inline-assets.mdx → inline-assets.md} +3 -7
  219. package/docs/guides/advanced-features/page-performance/{optimize-bundle.mdx → optimize-bundle.md} +4 -8
  220. package/docs/{components/internal-logger.mdx → guides/advanced-features/server-monitor/logger.md} +16 -0
  221. package/docs/guides/advanced-features/server-monitor/metrics.md +58 -0
  222. package/docs/guides/advanced-features/server-monitor/{monitors.mdx → monitors.md} +3 -3
  223. package/docs/guides/advanced-features/{source-build.mdx → source-build.md} +1 -5
  224. package/docs/guides/advanced-features/{web-server.mdx → web-server.md} +1 -9
  225. package/docs/guides/basic-features/{alias.mdx → alias.md} +3 -7
  226. package/docs/guides/basic-features/css/{css-in-js.mdx → css-in-js.md} +12 -9
  227. package/docs/guides/basic-features/css/{css-modules.mdx → css-modules.md} +3 -3
  228. package/docs/guides/basic-features/css/{css.mdx → css.md} +2 -6
  229. package/docs/guides/basic-features/data/{data-cache.mdx → data-cache.md} +1 -6
  230. package/docs/guides/basic-features/data/{data-fetch.mdx → data-fetch.md} +4 -8
  231. package/docs/guides/basic-features/data/{data-write.mdx → data-write.md} +6 -9
  232. package/docs/guides/basic-features/debug/{mock.mdx → mock.md} +1 -5
  233. package/docs/guides/basic-features/debug/{proxy.mdx → proxy.md} +1 -5
  234. package/docs/guides/basic-features/debug/{using-storybook.mdx → using-storybook.md} +20 -8
  235. package/docs/guides/basic-features/{deploy.mdx → deploy.md} +23 -13
  236. package/docs/guides/basic-features/{env-vars.mdx → env-vars.md} +8 -12
  237. package/docs/guides/basic-features/{html.mdx → html.md} +3 -7
  238. package/docs/guides/basic-features/{output-files.mdx → output-files.md} +6 -10
  239. package/docs/guides/basic-features/render/{before-render.mdx → before-render.md} +1 -1
  240. package/docs/guides/basic-features/render/overview.md +47 -0
  241. package/docs/guides/basic-features/render/{rsc.mdx → rsc.md} +16 -33
  242. package/docs/guides/basic-features/render/{ssg.mdx → ssg.md} +71 -10
  243. package/docs/guides/basic-features/render/{ssr-cache.mdx → ssr-cache.md} +5 -5
  244. package/docs/guides/basic-features/render/{ssr.mdx → ssr.md} +10 -12
  245. package/docs/guides/basic-features/render/{streaming-ssr.mdx → streaming-ssr.md} +5 -8
  246. package/docs/guides/basic-features/routes/{config-routes.mdx → config-routes.md} +10 -11
  247. package/docs/guides/basic-features/routes/{routes.mdx → routes.md} +8 -16
  248. package/docs/guides/basic-features/static-assets/{json-files.mdx → json-files.md} +0 -4
  249. package/docs/guides/basic-features/static-assets/{svg-assets.mdx → svg-assets.md} +3 -7
  250. package/docs/guides/basic-features/static-assets/{wasm-assets.mdx → wasm-assets.md} +1 -5
  251. package/docs/guides/basic-features/{static-assets.mdx → static-assets.md} +10 -14
  252. package/docs/guides/basic-features/testing/{playwright.mdx → playwright.md} +12 -3
  253. package/docs/guides/basic-features/testing/{rstest.mdx → rstest.md} +70 -11
  254. package/docs/guides/concept/{builder.mdx → builder.md} +3 -26
  255. package/docs/guides/concept/{entries.mdx → entries.md} +11 -17
  256. package/docs/guides/concept/{server.mdx → server.md} +3 -3
  257. package/docs/guides/get-started/{ai-coding-agents.mdx → ai-coding-agents.md} +4 -9
  258. package/docs/guides/get-started/glossary.md +63 -0
  259. package/docs/guides/get-started/{introduction.mdx → introduction.md} +1 -6
  260. package/docs/guides/get-started/quick-start.md +269 -0
  261. package/docs/guides/get-started/{tech-stack.mdx → tech-stack.md} +9 -15
  262. package/docs/guides/get-started/{ultramodern.mdx → ultramodern.md} +38 -31
  263. package/docs/guides/get-started/{upgrade.mdx → upgrade.md} +26 -22
  264. package/docs/guides/topic-detail/module-federation/{application.mdx → application.md} +3 -3
  265. package/docs/guides/topic-detail/module-federation/{deploy.mdx → deploy.md} +2 -2
  266. package/docs/guides/topic-detail/module-federation/{i18n.mdx → i18n.md} +14 -14
  267. package/docs/guides/topic-detail/module-federation/{introduce.mdx → introduce.md} +2 -3
  268. package/docs/guides/topic-detail/module-federation/{ssr.mdx → ssr.md} +12 -7
  269. package/docs/guides/topic-detail/module-federation/{usage.mdx → usage.md} +20 -3
  270. package/docs/guides/troubleshooting/{builder.mdx → builder.md} +10 -14
  271. package/docs/guides/troubleshooting/{cli.mdx → cli.md} +0 -4
  272. package/docs/guides/troubleshooting/{dependencies.mdx → dependencies.md} +7 -11
  273. package/docs/guides/troubleshooting/{hmr.mdx → hmr.md} +5 -9
  274. package/docs/guides/upgrade/{config.mdx → config.md} +8 -5
  275. package/docs/guides/upgrade/{entry.mdx → entry.md} +6 -6
  276. package/docs/guides/upgrade/{other.mdx → other.md} +8 -8
  277. package/docs/guides/upgrade/{overview.mdx → overview.md} +4 -4
  278. package/docs/guides/upgrade/{tailwindcss.mdx → tailwindcss.md} +0 -1
  279. package/docs/guides/upgrade/web-server.md +11 -11
  280. package/docs/index.md +33 -4
  281. package/docs/llms.txt +290 -0
  282. package/docs/plugin/cli-plugins/api.md +573 -0
  283. package/docs/plugin/cli-plugins/life-cycle.md +2 -0
  284. package/docs/plugin/introduction.md +152 -0
  285. package/docs/plugin/official/cli-plugins/plugin-bff.md +5 -0
  286. package/docs/plugin/official/cli-plugins/plugin-ssg.md +5 -0
  287. package/docs/plugin/official/cli-plugins/plugin-styled-components.md +5 -0
  288. package/docs/plugin/official/cli-plugins.md +4 -0
  289. package/docs/plugin/plugin-system.md +238 -0
  290. package/docs/plugin/runtime-plugins/api.md +194 -0
  291. package/docs/plugin/runtime-plugins/life-cycle.md +2 -0
  292. package/docs/plugin/server-plugins/api.md +209 -0
  293. package/docs/plugin/server-plugins/life-cycle.md +13 -0
  294. package/docs/tutorials/examples/csr-auth.md +9 -0
  295. package/docs/tutorials/foundations/introduction.md +16 -0
  296. package/package.json +33 -15
  297. package/docs/_nav.json +0 -36
  298. package/docs/apis/_meta.json +0 -13
  299. package/docs/apis/app/hooks/_meta.json +0 -28
  300. package/docs/apis/app/hooks/config/_meta.json +0 -1
  301. package/docs/apis/app/runtime/_meta.json +0 -32
  302. package/docs/components/auto-upgrade.mdx +0 -0
  303. package/docs/components/build-output.mdx +0 -45
  304. package/docs/components/bundler.mdx +0 -3
  305. package/docs/components/convention-routing-motivation.mdx +0 -0
  306. package/docs/components/debug-app.mdx +0 -15
  307. package/docs/components/default-browserslist.mdx +0 -7
  308. package/docs/components/deploy-command.mdx +0 -14
  309. package/docs/components/deploy.mdx +0 -1
  310. package/docs/components/enable-bff-caution.mdx +0 -3
  311. package/docs/components/enable-bff.mdx +0 -56
  312. package/docs/components/enable-ssg.mdx +0 -49
  313. package/docs/components/entry-mode.mdx +0 -0
  314. package/docs/components/entry-scan-logic.mdx +0 -7
  315. package/docs/components/extend-bff-function.mdx +0 -3
  316. package/docs/components/hono.mdx +0 -120
  317. package/docs/components/init-app.mdx +0 -93
  318. package/docs/components/init-rspack-app.mdx +0 -5
  319. package/docs/components/internal-metrics.mdx +0 -20
  320. package/docs/components/international/custom-instance-code.mdx +0 -16
  321. package/docs/components/international/init-options-desc.mdx +0 -1
  322. package/docs/components/international/install-command.mdx +0 -10
  323. package/docs/components/international/instance-code.mdx +0 -16
  324. package/docs/components/international/introduce.mdx +0 -5
  325. package/docs/components/international/platform-support.mdx +0 -0
  326. package/docs/components/language-config.mdx +0 -9
  327. package/docs/components/micro-frontend.mdx +0 -6
  328. package/docs/components/micro-master-manifest-config.mdx +0 -15
  329. package/docs/components/micro-runtime-config.mdx +0 -17
  330. package/docs/components/new-entry-tooltip.mdx +0 -0
  331. package/docs/components/nodeVersion.mdx +0 -28
  332. package/docs/components/other-plugins.mdx +0 -0
  333. package/docs/components/output-asset-prefix-extend.mdx +0 -0
  334. package/docs/components/output-distpath-warning.mdx +0 -0
  335. package/docs/components/output-polyfill-extend.mdx +0 -1
  336. package/docs/components/prerequisites.mdx +0 -18
  337. package/docs/components/release-note.mdx +0 -1
  338. package/docs/components/routes-practice.mdx +0 -0
  339. package/docs/components/rsbuild-config-tooltip.mdx +0 -5
  340. package/docs/components/rsbuild.mdx +0 -3
  341. package/docs/components/rsc-deploy-tip.mdx +0 -1
  342. package/docs/components/rspack.mdx +0 -3
  343. package/docs/components/rspackTip.mdx +0 -7
  344. package/docs/components/runtime-cli-config.mdx +0 -0
  345. package/docs/components/serve-command.mdx +0 -22
  346. package/docs/components/ssr-monitor.mdx +0 -3
  347. package/docs/components/stream-ssr-performance.mdx +0 -0
  348. package/docs/components/swc.mdx +0 -3
  349. package/docs/components/tech-stack-node-framework.mdx +0 -1
  350. package/docs/components/turtorials-example-list.mdx +0 -2
  351. package/docs/components/ua-polyfill.mdx +0 -44
  352. package/docs/components/upgrade-browserslist.mdx +0 -0
  353. package/docs/components/upgrade-config-deploy.mdx +0 -0
  354. package/docs/components/upgrade-faq.mdx +0 -0
  355. package/docs/configure/_meta.json +0 -78
  356. package/docs/configure/app/dev/hmr.mdx +0 -14
  357. package/docs/configure/app/dev/live-reload.mdx +0 -14
  358. package/docs/configure/app/dev/progress-bar.mdx +0 -23
  359. package/docs/configure/app/html/inject.mdx +0 -14
  360. package/docs/configure/app/html/output-structure.mdx +0 -14
  361. package/docs/configure/app/html/script-loading.mdx +0 -14
  362. package/docs/configure/app/html/template.mdx +0 -14
  363. package/docs/configure/app/html/title.mdx +0 -22
  364. package/docs/configure/app/output/asset-prefix.mdx +0 -18
  365. package/docs/configure/app/output/filename-hash.mdx +0 -14
  366. package/docs/configure/app/output/inject-styles.mdx +0 -14
  367. package/docs/configure/app/output/polyfill.mdx +0 -18
  368. package/docs/configure/app/performance/preconnect.mdx +0 -20
  369. package/docs/configure/app/performance/profile.mdx +0 -14
  370. package/docs/configure/app/performance/remove-console.mdx +0 -14
  371. package/docs/configure/app/performance/remove-moment-locale.mdx +0 -14
  372. package/docs/configure/app/resolve/alias.mdx +0 -13
  373. package/docs/configure/app/server/rsc.mdx +0 -30
  374. package/docs/configure/app/server/ssr.mdx +0 -85
  375. package/docs/configure/app/source/enable-async-entry.mdx +0 -54
  376. package/docs/configure/app/tools/rspack.mdx +0 -14
  377. package/docs/configure/app/tools/style-loader.mdx +0 -14
  378. package/docs/guides/_meta.json +0 -37
  379. package/docs/guides/advanced-features/_meta.json +0 -32
  380. package/docs/guides/advanced-features/bff/_meta.json +0 -10
  381. package/docs/guides/advanced-features/bff/frameworks.mdx +0 -131
  382. package/docs/guides/advanced-features/bff/upload.mdx +0 -7
  383. package/docs/guides/advanced-features/international/_meta.json +0 -10
  384. package/docs/guides/advanced-features/international/configuration.mdx +0 -222
  385. package/docs/guides/advanced-features/international.mdx +0 -29
  386. package/docs/guides/advanced-features/page-performance/_meta.json +0 -1
  387. package/docs/guides/advanced-features/server-monitor/_meta.json +0 -1
  388. package/docs/guides/advanced-features/server-monitor/logger.mdx +0 -19
  389. package/docs/guides/advanced-features/server-monitor/metrics.mdx +0 -41
  390. package/docs/guides/basic-features/_meta.json +0 -49
  391. package/docs/guides/basic-features/css/_meta.json +0 -1
  392. package/docs/guides/basic-features/data/_meta.json +0 -1
  393. package/docs/guides/basic-features/debug/_meta.json +0 -1
  394. package/docs/guides/basic-features/render/_meta.json +0 -1
  395. package/docs/guides/basic-features/render/overview.mdx +0 -51
  396. package/docs/guides/basic-features/routes/_meta.json +0 -1
  397. package/docs/guides/basic-features/static-assets/_meta.json +0 -1
  398. package/docs/guides/basic-features/testing/_meta.json +0 -1
  399. package/docs/guides/concept/_meta.json +0 -1
  400. package/docs/guides/get-started/_meta.json +0 -9
  401. package/docs/guides/get-started/glossary.mdx +0 -63
  402. package/docs/guides/get-started/quick-start.mdx +0 -92
  403. package/docs/guides/topic-detail/_meta.json +0 -8
  404. package/docs/guides/topic-detail/module-federation/_meta.json +0 -1
  405. package/docs/guides/troubleshooting/_meta.json +0 -1
  406. package/docs/guides/upgrade/_meta.json +0 -1
  407. package/scripts/copy-main-doc.mjs +0 -50
  408. /package/docs/guides/advanced-features/bff/{sdk.mdx → sdk.md} +0 -0
  409. /package/docs/guides/advanced-features/page-performance/{react-compiler.mdx → react-compiler.md} +0 -0
  410. /package/docs/guides/basic-features/css/{tailwindcss.mdx → tailwindcss.md} +0 -0
  411. /package/docs/guides/basic-features/debug/{rsdoctor.mdx → rsdoctor.md} +0 -0
@@ -38,6 +38,7 @@ var __webpack_exports__ = {};
38
38
  __webpack_require__.r(__webpack_exports__);
39
39
  __webpack_require__.d(__webpack_exports__, {
40
40
  MICROVERTICAL_RELEASE_ENVELOPE_PATH: ()=>MICROVERTICAL_RELEASE_ENVELOPE_PATH,
41
+ MICROVERTICAL_RELEASE_IDENTITY_CARRIERS_PATH: ()=>MICROVERTICAL_RELEASE_IDENTITY_CARRIERS_PATH,
41
42
  emitCloudflareStagedReleaseEnvelope: ()=>emitCloudflareStagedReleaseEnvelope,
42
43
  emitFrameworkMicroVerticalReleaseEnvelope: ()=>emitFrameworkMicroVerticalReleaseEnvelope,
43
44
  emitNodeStagedReleaseEnvelope: ()=>emitNodeStagedReleaseEnvelope,
@@ -47,47 +48,20 @@ __webpack_require__.d(__webpack_exports__, {
47
48
  verifyCloudflareReleaseEnvelopeStaging: ()=>verifyCloudflareReleaseEnvelopeStaging,
48
49
  verifyNodeReleaseEnvelopeStaging: ()=>verifyNodeReleaseEnvelopeStaging
49
50
  });
51
+ const external_node_crypto_namespaceObject = require("node:crypto");
50
52
  const promises_namespaceObject = require("node:fs/promises");
51
53
  var promises_default = /*#__PURE__*/ __webpack_require__.n(promises_namespaceObject);
52
54
  const external_node_path_namespaceObject = require("node:path");
53
55
  var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
54
- const parser_namespaceObject = require("@babel/parser");
55
56
  const universal_namespaceObject = require("@modern-js/utils/universal");
56
57
  const external_index_js_namespaceObject = require("./index.js");
57
58
  const MICROVERTICAL_RELEASE_ENVELOPE_PATH = 'release/microvertical-release-envelope.json';
59
+ const MICROVERTICAL_RELEASE_IDENTITY_CARRIERS_PATH = 'release/microvertical-release-identity-carriers.json';
60
+ const MICROVERTICAL_RELEASE_IDENTITY_CARRIERS_KIND = 'ultramodern-release-identity-carriers';
61
+ const MICROVERTICAL_RELEASE_IDENTITY_CARRIERS_SCHEMA_VERSION = 1;
58
62
  const COMPILED_MODULE_PATTERN = /\.(?:c|m)?js$/u;
59
63
  const EFFECT_BFF_WORKER_PATTERN = /^worker\/__modern_bff_effect\.(?:c|m)?js$/u;
60
64
  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
65
  const flattenStrings = (value)=>'string' == typeof value ? [
92
66
  value
93
67
  ] : Array.isArray(value) ? value.flatMap(flattenStrings) : [];
@@ -230,6 +204,49 @@ const releaseArtifact = (logicalPath, runtime)=>({
230
204
  logicalPath,
231
205
  runtime
232
206
  });
207
+ const writeReleaseIdentityCarrierMetadata = async (artifactRoot, identity, carrierPaths)=>{
208
+ const surfacesByPath = new Map();
209
+ for (const [surface, logicalPaths] of Object.entries(carrierPaths)){
210
+ if (0 === logicalPaths.length) throw new Error(`[ultramodern-release-envelope] ${surface} has no declared release-identity carrier artifact.`);
211
+ for (const logicalPath of logicalPaths){
212
+ const surfaces = surfacesByPath.get(logicalPath) ?? new Set();
213
+ surfaces.add(surface);
214
+ surfacesByPath.set(logicalPath, surfaces);
215
+ }
216
+ }
217
+ const carriers = await Promise.all([
218
+ ...surfacesByPath
219
+ ].sort(([left], [right])=>left.localeCompare(right)).map(async ([logicalPath, surfaces])=>{
220
+ const bytes = await promises_default().readFile(external_node_path_default().join(artifactRoot, logicalPath));
221
+ return {
222
+ logicalPath,
223
+ byteLength: bytes.byteLength,
224
+ sha256: (0, external_node_crypto_namespaceObject.createHash)('sha256').update(bytes).digest('hex'),
225
+ surfaces: [
226
+ ...surfaces
227
+ ].sort((left, right)=>left.localeCompare(right))
228
+ };
229
+ }));
230
+ const releaseEnvelopePath = await resolveSafeReleaseEnvelopePath({
231
+ artifactRoot,
232
+ createDirectory: true
233
+ });
234
+ if (!releaseEnvelopePath) throw new Error('[ultramodern-release-envelope] could not resolve private release metadata directory.');
235
+ const metadataPath = external_node_path_default().join(external_node_path_default().dirname(releaseEnvelopePath), external_node_path_default().basename(MICROVERTICAL_RELEASE_IDENTITY_CARRIERS_PATH));
236
+ try {
237
+ const metadataStat = await promises_default().lstat(metadataPath);
238
+ if (metadataStat.isSymbolicLink() || !metadataStat.isFile()) throw new Error('[ultramodern-release-envelope] release identity carrier metadata must be a real file inside artifactRoot.');
239
+ } catch (error) {
240
+ if (!isMissingPathError(error)) throw error;
241
+ }
242
+ await promises_default().writeFile(metadataPath, `${JSON.stringify({
243
+ schemaVersion: MICROVERTICAL_RELEASE_IDENTITY_CARRIERS_SCHEMA_VERSION,
244
+ kind: MICROVERTICAL_RELEASE_IDENTITY_CARRIERS_KIND,
245
+ identity,
246
+ carriers
247
+ }, null, 2)}\n`);
248
+ return releaseArtifact(MICROVERTICAL_RELEASE_IDENTITY_CARRIERS_PATH, 'release-identity-metadata');
249
+ };
233
250
  const createReleaseArtifactInputs = async (distDirectory, identity, target)=>{
234
251
  const files = await collectFiles(distDirectory);
235
252
  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.');
@@ -253,13 +270,7 @@ const createReleaseArtifactInputs = async (distDirectory, identity, target)=>{
253
270
  const clientExecutionPaths = await manifestReferencedClientModules(distDirectory, files);
254
271
  if (0 === clientExecutionPaths.length) throw new Error('[ultramodern-release-envelope] UI/client manifest references no compiled execution module.');
255
272
  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');
273
+ if (0 === ssrExecutionPaths.length) throw new Error(`[ultramodern-release-envelope] route manifest references no emitted ${'node' === target ? 'Node' : 'Cloudflare'} SSR execution module.`);
263
274
  const runtimeByPath = new Map();
264
275
  const add = (paths, runtime)=>{
265
276
  for (const logicalPath of paths){
@@ -295,8 +306,25 @@ const createReleaseArtifactInputs = async (distDirectory, identity, target)=>{
295
306
  const artifacts = [
296
307
  ...runtimeByPath
297
308
  ].map(([logicalPath, runtime])=>releaseArtifact(logicalPath, runtime)).sort((left, right)=>left.logicalPath.localeCompare(right.logicalPath));
309
+ const identityCarrierMetadata = await writeReleaseIdentityCarrierMetadata(distDirectory, identity, {
310
+ apiBackend: apiBackendPaths,
311
+ backendFederation: [
312
+ universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE,
313
+ universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE
314
+ ],
315
+ ssr: [
316
+ ...new Set([
317
+ ...ssrExecutionPaths,
318
+ ...ssrPaths
319
+ ])
320
+ ],
321
+ uiClient: uiClientPaths.filter((logicalPath)=>COMPILED_MODULE_PATTERN.test(logicalPath))
322
+ });
298
323
  return {
299
- artifacts,
324
+ artifacts: [
325
+ ...artifacts,
326
+ identityCarrierMetadata
327
+ ].sort((left, right)=>left.logicalPath.localeCompare(right.logicalPath)),
300
328
  surfaces
301
329
  };
302
330
  };
@@ -418,13 +446,7 @@ const createNodeStagedReleaseArtifactInputs = async (outputDirectory, identity)=
418
446
  ])if (0 === paths.length) throw new Error(`[ultramodern-release-envelope] final Node staging has no ${surface} artifacts.`);
419
447
  const clientExecutionPaths = await manifestReferencedClientModules(outputDirectory, files);
420
448
  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');
449
+ if (0 === clientExecutionPaths.length || 0 === ssrExecutionPaths.length) throw new Error('[ultramodern-release-envelope] final Node manifests must reference emitted UI/client and SSR execution modules.');
428
450
  const runtimeByPath = new Map(files.filter((logicalPath)=>!backendFederationPaths.has(logicalPath)).map((logicalPath)=>[
429
451
  logicalPath,
430
452
  'nodejs-deployment'
@@ -434,10 +456,27 @@ const createNodeStagedReleaseArtifactInputs = async (outputDirectory, identity)=
434
456
  for (const logicalPath of apiBackendPaths)runtimeByPath.set(logicalPath, 'nodejs');
435
457
  runtimeByPath.set(universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE, 'module-federation-manifest');
436
458
  runtimeByPath.set(universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE, 'nodejs');
459
+ const identityCarrierMetadata = await writeReleaseIdentityCarrierMetadata(outputDirectory, identity, {
460
+ apiBackend: apiBackendPaths,
461
+ backendFederation: [
462
+ universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE,
463
+ universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE
464
+ ],
465
+ ssr: [
466
+ ...new Set([
467
+ ...ssrExecutionPaths,
468
+ ...ssrPaths.filter((logicalPath)=>'index.js' !== logicalPath)
469
+ ])
470
+ ],
471
+ uiClient: uiClientPaths.filter((logicalPath)=>COMPILED_MODULE_PATTERN.test(logicalPath))
472
+ });
437
473
  return {
438
474
  artifacts: [
439
- ...runtimeByPath
440
- ].map(([logicalPath, runtime])=>releaseArtifact(logicalPath, runtime)).sort((left, right)=>left.logicalPath.localeCompare(right.logicalPath)),
475
+ ...[
476
+ ...runtimeByPath
477
+ ].map(([logicalPath, runtime])=>releaseArtifact(logicalPath, runtime)),
478
+ identityCarrierMetadata
479
+ ].sort((left, right)=>left.logicalPath.localeCompare(right.logicalPath)),
441
480
  surfaces: {
442
481
  uiClient: [
443
482
  ...uiClientPaths
@@ -511,13 +550,7 @@ const createCloudflareStagedReleaseArtifactInputs = async (outputDirectory, iden
511
550
  ])if (!files.includes(logicalPath)) throw new Error(`[ultramodern-release-envelope] final Cloudflare staging is missing ${logicalPath}.`);
512
551
  const clientExecutionPaths = await manifestReferencedClientModules(outputDirectory, files, 'public/mf-manifest.json');
513
552
  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');
553
+ if (0 === clientExecutionPaths.length || 0 === ssrExecutionPaths.length) throw new Error('[ultramodern-release-envelope] final Cloudflare manifests must reference emitted UI/client and SSR execution modules.');
521
554
  const runtimeByPath = new Map();
522
555
  for (const logicalPath of files)runtimeByPath.set(logicalPath, 'cloudflare-deployment');
523
556
  const add = (paths, runtime)=>{
@@ -532,10 +565,27 @@ const createCloudflareStagedReleaseArtifactInputs = async (outputDirectory, iden
532
565
  add([
533
566
  backendContainerPath
534
567
  ], 'commonjs-module');
568
+ const identityCarrierMetadata = await writeReleaseIdentityCarrierMetadata(outputDirectory, identity, {
569
+ apiBackend: apiBackendPaths,
570
+ backendFederation: [
571
+ backendManifestPath,
572
+ backendContainerPath
573
+ ],
574
+ ssr: [
575
+ ...new Set([
576
+ ...ssrExecutionPaths,
577
+ ...ssrPaths.filter((logicalPath)=>logicalPath.startsWith('worker/'))
578
+ ])
579
+ ],
580
+ uiClient: uiClientPaths.filter((logicalPath)=>COMPILED_MODULE_PATTERN.test(logicalPath))
581
+ });
535
582
  return {
536
583
  artifacts: [
537
- ...runtimeByPath
538
- ].map(([logicalPath, runtime])=>releaseArtifact(logicalPath, runtime)).sort((left, right)=>left.logicalPath.localeCompare(right.logicalPath)),
584
+ ...[
585
+ ...runtimeByPath
586
+ ].map(([logicalPath, runtime])=>releaseArtifact(logicalPath, runtime)),
587
+ identityCarrierMetadata
588
+ ].sort((left, right)=>left.logicalPath.localeCompare(right.logicalPath)),
539
589
  surfaces: {
540
590
  uiClient: [
541
591
  ...uiClientPaths
@@ -573,6 +623,7 @@ const verifyCloudflareReleaseEnvelopeStaging = async (outputDirectory)=>readFram
573
623
  required: true
574
624
  });
575
625
  exports.MICROVERTICAL_RELEASE_ENVELOPE_PATH = __webpack_exports__.MICROVERTICAL_RELEASE_ENVELOPE_PATH;
626
+ exports.MICROVERTICAL_RELEASE_IDENTITY_CARRIERS_PATH = __webpack_exports__.MICROVERTICAL_RELEASE_IDENTITY_CARRIERS_PATH;
576
627
  exports.emitCloudflareStagedReleaseEnvelope = __webpack_exports__.emitCloudflareStagedReleaseEnvelope;
577
628
  exports.emitFrameworkMicroVerticalReleaseEnvelope = __webpack_exports__.emitFrameworkMicroVerticalReleaseEnvelope;
578
629
  exports.emitNodeStagedReleaseEnvelope = __webpack_exports__.emitNodeStagedReleaseEnvelope;
@@ -583,6 +634,7 @@ exports.verifyCloudflareReleaseEnvelopeStaging = __webpack_exports__.verifyCloud
583
634
  exports.verifyNodeReleaseEnvelopeStaging = __webpack_exports__.verifyNodeReleaseEnvelopeStaging;
584
635
  for(var __rspack_i in __webpack_exports__)if (-1 === [
585
636
  "MICROVERTICAL_RELEASE_ENVELOPE_PATH",
637
+ "MICROVERTICAL_RELEASE_IDENTITY_CARRIERS_PATH",
586
638
  "emitCloudflareStagedReleaseEnvelope",
587
639
  "emitFrameworkMicroVerticalReleaseEnvelope",
588
640
  "emitNodeStagedReleaseEnvelope",
@@ -5,6 +5,8 @@ import { isProd, isSSR, isServiceWorker, isUseRsc, isUseSSRBundle } from "@moder
5
5
  import { CLOUDFLARE_WORKER_NODE_BUILTINS } from "../../plugins/deploy/platforms/cloudflare-output-contract.mjs";
6
6
  const BFF_EFFECT_WORKER_ENTRY_NAME = '__modern_bff_effect';
7
7
  const BFF_EFFECT_WORKER_RUNTIME_QUERY = 'modern-bff-runtime';
8
+ const MF_SSR_DATA_FETCH_RUNTIME_PLUGIN = '@module-federation/modern-js-v3/ssr-inject-data-fetch-function-plugin';
9
+ const MF_SSR_DEV_RUNTIME_PLUGIN = '@module-federation/modern-js-v3/ssr-dev-plugin';
8
10
  const JS_OR_TS_EXTS = [
9
11
  '.js',
10
12
  '.jsx',
@@ -85,6 +87,64 @@ function getCloudflareWorkerNodeExternals() {
85
87
  ];
86
88
  }));
87
89
  }
90
+ const reserveWorkerChunkName = (baseName, reservedOutputNames)=>{
91
+ let name = baseName;
92
+ while(reservedOutputNames.has(normalizeWorkerOutputName(name)))name = `${name}_`;
93
+ return name;
94
+ };
95
+ const normalizeWorkerOutputName = (name)=>node_path.posix.normalize(name.replace(/\\/gu, '/')).toLowerCase();
96
+ function getCloudflareWorkerRspackConfig(workerEntryNames) {
97
+ const entryNames = [
98
+ ...workerEntryNames
99
+ ];
100
+ for (const entryName of entryNames){
101
+ const slashName = entryName.replace(/\\/gu, '/');
102
+ const normalizedName = node_path.posix.normalize(slashName);
103
+ if (entryName !== slashName || normalizedName !== slashName || '.' === normalizedName || normalizedName.startsWith('../') || node_path.posix.isAbsolute(normalizedName) || node_path.win32.isAbsolute(slashName) || /^[A-Za-z]:/u.test(slashName)) throw new Error(`Cloudflare worker entry name "${entryName}" must be a canonical relative output path without dot segments or backslashes.`);
104
+ }
105
+ const reservedNames = new Set(entryNames.map(normalizeWorkerOutputName));
106
+ const runtimeName = reserveWorkerChunkName('__modern_worker_runtime', reservedNames);
107
+ reservedNames.add(normalizeWorkerOutputName(runtimeName));
108
+ const sharedName = reserveWorkerChunkName('__modern_worker_shared', reservedNames);
109
+ return {
110
+ experiments: {
111
+ outputModule: true
112
+ },
113
+ externals: getCloudflareWorkerNodeExternals(),
114
+ externalsType: 'module-import',
115
+ module: {
116
+ parser: {
117
+ javascript: {
118
+ dynamicImportMode: 'eager'
119
+ }
120
+ }
121
+ },
122
+ optimization: {
123
+ runtimeChunk: {
124
+ name: runtimeName
125
+ },
126
+ splitChunks: {
127
+ chunks: 'all',
128
+ minSize: 0,
129
+ name: sharedName
130
+ }
131
+ }
132
+ };
133
+ }
134
+ function applyCloudflareWorkerRspackConfig(chain, workerEntryNames) {
135
+ const config = getCloudflareWorkerRspackConfig(workerEntryNames);
136
+ chain.experiments(config.experiments);
137
+ chain.externals(config.externals);
138
+ chain.externalsType(config.externalsType);
139
+ chain.module.parser.merge(config.module.parser);
140
+ chain.optimization.runtimeChunk(config.optimization.runtimeChunk);
141
+ chain.optimization.splitChunks(config.optimization.splitChunks);
142
+ }
143
+ function applyCloudflareWorkerMfRuntimeBoundary(chain) {
144
+ chain.plugins.delete('plugin-module-federation');
145
+ chain.resolve.alias.set(`${MF_SSR_DATA_FETCH_RUNTIME_PLUGIN}$`, getCloudflareWorkerCompatFile('cloudflare-worker-mf-ssr-runtime-plugin.mjs'));
146
+ chain.resolve.alias.set(`${MF_SSR_DEV_RUNTIME_PLUGIN}$`, getCloudflareWorkerCompatFile('cloudflare-worker-mf-ssr-runtime-plugin.mjs'));
147
+ }
88
148
  function getEffectBffEntry(normalizedConfig, appContext) {
89
149
  if (!normalizedConfig.bff || 'hono' === normalizedConfig.bff.runtimeFramework) return;
90
150
  const configuredEntry = normalizedConfig.bff.effect?.entry;
@@ -243,17 +303,10 @@ function getBuilderEnvironments(normalizedConfig, appContext, tempBuilderConfig)
243
303
  htmlPlugin: false,
244
304
  ...useCloudflareModuleWorker ? {
245
305
  bundlerChain: (chain)=>{
246
- chain.merge({
247
- experiments: {
248
- outputModule: true
249
- },
250
- externals: getCloudflareWorkerNodeExternals(),
251
- externalsType: 'module-import'
252
- });
306
+ applyCloudflareWorkerRspackConfig(chain, Object.keys(workerEntries));
253
307
  chain.output.module(true).library({
254
308
  type: 'module'
255
309
  }).publicPath('/').chunkFormat('module').chunkLoading('import').workerChunkLoading('import');
256
- chain.optimization.usedExports(false).providedExports(true).innerGraph(false).sideEffects(false);
257
310
  for (const condition of [
258
311
  'workerd',
259
312
  'worker',
@@ -263,7 +316,7 @@ function getBuilderEnvironments(normalizedConfig, appContext, tempBuilderConfig)
263
316
  'require',
264
317
  'module'
265
318
  ])chain.resolve.conditionNames.add(condition);
266
- chain.plugins.delete('plugin-module-federation');
319
+ applyCloudflareWorkerMfRuntimeBoundary(chain);
267
320
  if (tanstackRouterSsrServerFile) {
268
321
  chain.resolve.alias.set('@tanstack/router-core/ssr/server$', tanstackRouterSsrServerFile);
269
322
  chain.resolve.alias.set('@tanstack/router-core/ssr/server', tanstackRouterSsrServerFile);
@@ -304,4 +357,4 @@ function getBuilderEnvironments(normalizedConfig, appContext, tempBuilderConfig)
304
357
  builderConfig: tempBuilderConfig
305
358
  };
306
359
  }
307
- export { getBuilderEnvironments };
360
+ export { applyCloudflareWorkerMfRuntimeBoundary, applyCloudflareWorkerRspackConfig, getBuilderEnvironments, getCloudflareWorkerRspackConfig };
@@ -0,0 +1,62 @@
1
+ import node_fs from "node:fs";
2
+ import node_path from "node:path";
3
+ const DEFAULT_INDEX_FILE = 'llms.txt';
4
+ const DEFAULT_EXCLUDED_DIRS = [
5
+ 'zh'
6
+ ];
7
+ function bundleDocs({ source, target, indexFile = DEFAULT_INDEX_FILE, excludedDirs = DEFAULT_EXCLUDED_DIRS }) {
8
+ if (!node_fs.existsSync(source)) {
9
+ console.warn(`[bundle-docs] docs build output not found: ${source}`);
10
+ console.warn('[bundle-docs] skipping the bundled docs — build the docs site first if you need them');
11
+ return 0;
12
+ }
13
+ node_fs.rmSync(target, {
14
+ recursive: true,
15
+ force: true
16
+ });
17
+ const isBundled = (rel)=>rel === indexFile || rel.endsWith('.md') && !excludedDirs.some((dir)=>rel.startsWith(`${dir}${node_path.sep}`));
18
+ let count = 0;
19
+ for (const entry of node_fs.readdirSync(source, {
20
+ recursive: true,
21
+ withFileTypes: true
22
+ })){
23
+ if (!entry.isFile()) continue;
24
+ const from = node_path.join(entry.parentPath ?? entry.path, entry.name);
25
+ const rel = node_path.relative(source, from);
26
+ if (!isBundled(rel)) continue;
27
+ const to = node_path.join(target, rel);
28
+ node_fs.mkdirSync(node_path.dirname(to), {
29
+ recursive: true
30
+ });
31
+ node_fs.copyFileSync(from, to);
32
+ count++;
33
+ }
34
+ if (0 === count) throw new Error(`[bundle-docs] no files copied from ${source}`);
35
+ return count;
36
+ }
37
+ function parseArgs(argv) {
38
+ const options = {};
39
+ for(let i = 0; i < argv.length; i += 2){
40
+ const key = argv[i]?.replace(/^--/, '');
41
+ const value = argv[i + 1];
42
+ if (key && value) options[key] = value;
43
+ }
44
+ return options;
45
+ }
46
+ function runBundleDocsCli(pkgRoot) {
47
+ const args = parseArgs(process.argv.slice(2));
48
+ const source = args.source ? node_path.resolve(process.cwd(), args.source) : node_path.resolve(pkgRoot, '../../document/doc_build');
49
+ const target = args.target ? node_path.resolve(process.cwd(), args.target) : node_path.resolve(pkgRoot, 'docs');
50
+ try {
51
+ const count = bundleDocs({
52
+ source,
53
+ target,
54
+ indexFile: args.index
55
+ });
56
+ if (count > 0) console.log(`[bundle-docs] bundled ${count} doc files into docs`);
57
+ } catch (error) {
58
+ console.error(error.message);
59
+ process.exit(1);
60
+ }
61
+ }
62
+ export { bundleDocs, runBundleDocsCli };
@@ -116,7 +116,7 @@ const verifyCloudflareOutput = async (options)=>{
116
116
  path: publicPath
117
117
  });
118
118
  }
119
- if (false !== options.importWorker && await pathExists(outputPlan.paths.workerEntry)) await verifyWorkerImport(issues, outputPlan.paths.workerEntry);
119
+ if (false !== options.importWorker && await pathExists(outputPlan.paths.workerEntry)) await verifyWorkerImport(issues, outputPlan.paths.workerEntry, manifest);
120
120
  return {
121
121
  ok: 0 === issues.length,
122
122
  issues
@@ -1,7 +1,9 @@
1
1
  import promises from "node:fs/promises";
2
2
  import node_path from "node:path";
3
3
  import { pathToFileURL } from "node:url";
4
+ import { isDeepStrictEqual } from "node:util";
4
5
  import { parse } from "@babel/parser";
6
+ import traverse from "@babel/traverse";
5
7
  import { CLOUDFLARE_WORKER_BUNDLE_DIRECTORY, CLOUDFLARE_WORKER_NODE_BUILTINS } from "../cloudflare-output-contract.mjs";
6
8
  import { addIssue } from "./issues.mjs";
7
9
  const getReferencedRouteWorkers = (manifest)=>Array.isArray(manifest?.routeSpec?.routes) ? manifest.routeSpec.routes.map((route)=>'string' == typeof route?.worker && route.worker.length > 0 ? route.worker : void 0).filter((worker)=>'string' == typeof worker) : [];
@@ -45,6 +47,7 @@ const getNodeName = (node)=>{
45
47
  if (!isAstNode(node)) return;
46
48
  return 'Identifier' === node.type && 'string' == typeof node.name ? node.name : 'StringLiteral' === node.type && 'string' == typeof node.value ? node.value : void 0;
47
49
  };
50
+ const getStringLiteralValue = (node)=>isAstNode(node) && 'StringLiteral' === node.type && 'string' == typeof node.value ? node.value : void 0;
48
51
  const collectBindingNames = (node, names)=>{
49
52
  if (!isAstNode(node)) return;
50
53
  const name = getNodeName(node);
@@ -54,7 +57,11 @@ const collectBindingNames = (node, names)=>{
54
57
  } else if ('ArrayPattern' === node.type && Array.isArray(node.elements)) for (const element of node.elements)collectBindingNames(element, names);
55
58
  else if ('AssignmentPattern' === node.type || 'RestElement' === node.type) collectBindingNames('AssignmentPattern' === node.type ? node.left : node.argument, names);
56
59
  };
57
- const getMemberPropertyName = (node)=>'MemberExpression' === node.type ? getNodeName(node.property) : void 0;
60
+ const getMemberPropertyName = (node)=>{
61
+ if ('MemberExpression' !== node.type) return;
62
+ return true === node.computed ? getStringLiteralValue(node.property) : getNodeName(node.property);
63
+ };
64
+ const isAmbientModuleRequire = (node, modulePath)=>isAstNode(node) && 'MemberExpression' === node.type && isAstNode(node.object) && 'Identifier' === node.object.type && 'module' === node.object.name && void 0 === modulePath.scope.getBinding('module') && 'require' === getMemberPropertyName(node);
58
65
  const isModuleExports = (node)=>isAstNode(node) && 'MemberExpression' === node.type && isAstNode(node.object) && 'Identifier' === node.object.type && 'module' === node.object.name && 'exports' === getMemberPropertyName(node);
59
66
  const collectCommonJsExports = (statement, exports)=>{
60
67
  if ('ExpressionStatement' !== statement.type || !isAstNode(statement.expression) || 'AssignmentExpression' !== statement.expression.type) return;
@@ -89,19 +96,31 @@ const collectEsmExports = (statement, exports)=>{
89
96
  }
90
97
  }
91
98
  };
92
- const visitAst = (node, visitor)=>{
93
- visitor(node);
94
- for (const [key, value] of Object.entries(node))if ('loc' !== key && 'start' !== key && 'end' !== key && 'leadingComments' !== key && 'trailingComments' !== key && 'innerComments' !== key) {
95
- if (isAstNode(value)) visitAst(value, visitor);
96
- else if (Array.isArray(value)) {
97
- for (const item of value)if (isAstNode(item)) visitAst(item, visitor);
99
+ const getStaticImport = (modulePath)=>{
100
+ const node = modulePath.node;
101
+ if (('ImportDeclaration' === node.type || 'ExportNamedDeclaration' === node.type || 'ExportAllDeclaration' === node.type) && isAstNode(node.source)) return getStringLiteralValue(node.source);
102
+ if ('ImportExpression' === node.type && isAstNode(node.source)) return getStringLiteralValue(node.source);
103
+ if ('CallExpression' === node.type && Array.isArray(node.arguments) && 1 === node.arguments.length && isAstNode(node.callee) && ('Identifier' === node.callee.type && 'require' === node.callee.name && void 0 === modulePath.scope.getBinding('require') || isAmbientModuleRequire(node.callee, modulePath) || 'Import' === node.callee.type)) return getStringLiteralValue(node.arguments[0]);
104
+ };
105
+ const isAmbientLoaderWrite = (modulePath)=>{
106
+ let targetPath = modulePath;
107
+ while(targetPath.parentPath){
108
+ const parentPath = targetPath.parentPath;
109
+ if (parentPath.isAssignmentExpression()) return 'left' === targetPath.key;
110
+ if (parentPath.isUpdateExpression()) return 'argument' === targetPath.key;
111
+ if (parentPath.isForInStatement() || parentPath.isForOfStatement()) return 'left' === targetPath.key;
112
+ if (parentPath.isObjectProperty()) {
113
+ if ('value' !== targetPath.key) return false;
114
+ targetPath = parentPath;
115
+ continue;
116
+ }
117
+ if (parentPath.isObjectPattern() || parentPath.isArrayPattern() || parentPath.isRestElement() || parentPath.isAssignmentPattern()) {
118
+ targetPath = parentPath;
119
+ continue;
98
120
  }
121
+ break;
99
122
  }
100
- };
101
- const getStaticImport = (node)=>{
102
- if (('ImportDeclaration' === node.type || 'ExportNamedDeclaration' === node.type || 'ExportAllDeclaration' === node.type) && isAstNode(node.source)) return getNodeName(node.source);
103
- if ('ImportExpression' === node.type && isAstNode(node.source)) return getNodeName(node.source);
104
- if ('CallExpression' === node.type && Array.isArray(node.arguments) && 1 === node.arguments.length && isAstNode(node.callee) && ('Identifier' === node.callee.type && 'require' === node.callee.name || 'Import' === node.callee.type)) return getNodeName(node.arguments[0]);
123
+ return false;
105
124
  };
106
125
  const analyzeWorkerModule = (source)=>{
107
126
  const ast = parse(source, {
@@ -109,17 +128,49 @@ const analyzeWorkerModule = (source)=>{
109
128
  });
110
129
  const exports = new Set();
111
130
  const imports = new Set();
131
+ let unsafeCommonJsLoaderUsage = false;
132
+ let unsafeDynamicImport = false;
112
133
  for (const statement of ast.program.body){
113
134
  collectEsmExports(statement, exports);
114
135
  collectCommonJsExports(statement, exports);
115
136
  }
116
- visitAst(ast.program, (node)=>{
117
- const specifier = getStaticImport(node);
118
- if (specifier) imports.add(specifier);
137
+ traverse(ast, {
138
+ enter (modulePath) {
139
+ const node = modulePath.node;
140
+ if (('ImportExpression' === node.type || 'CallExpression' === node.type && isAstNode(node.callee) && 'Import' === node.callee.type) && void 0 === getStaticImport(modulePath)) unsafeDynamicImport = true;
141
+ if (modulePath.isReferencedIdentifier({
142
+ name: 'require'
143
+ }) && void 0 === modulePath.scope.getBinding('require')) {
144
+ const parentPath = modulePath.parentPath;
145
+ const isStaticRequireCall = parentPath?.isCallExpression() && 'callee' === modulePath.key && void 0 !== getStaticImport(parentPath);
146
+ const isAvailabilityCheck = parentPath?.isUnaryExpression({
147
+ operator: 'typeof'
148
+ });
149
+ if (!isStaticRequireCall && !isAvailabilityCheck) unsafeCommonJsLoaderUsage = true;
150
+ }
151
+ if ('Identifier' === node.type && isAmbientLoaderWrite(modulePath) && ('require' === node.name || 'module' === node.name) && void 0 === modulePath.scope.getBinding(node.name)) unsafeCommonJsLoaderUsage = true;
152
+ if (modulePath.isReferencedIdentifier({
153
+ name: 'module'
154
+ }) && void 0 === modulePath.scope.getBinding('module')) {
155
+ const parentPath = modulePath.parentPath;
156
+ const isExportsAccess = null !== parentPath && isModuleExports(parentPath.node);
157
+ const isStaticModuleRequireCall = null !== parentPath && isAmbientModuleRequire(parentPath.node, parentPath) && parentPath.parentPath?.isCallExpression() === true && 'callee' === parentPath.key && void 0 !== getStaticImport(parentPath.parentPath);
158
+ if (!isExportsAccess && !isStaticModuleRequireCall) unsafeCommonJsLoaderUsage = true;
159
+ }
160
+ if (isAmbientModuleRequire(node, modulePath)) {
161
+ const parentPath = modulePath.parentPath;
162
+ const isStaticRequireCall = parentPath?.isCallExpression() && 'callee' === modulePath.key && void 0 !== getStaticImport(parentPath);
163
+ if (!isStaticRequireCall) unsafeCommonJsLoaderUsage = true;
164
+ }
165
+ const specifier = getStaticImport(modulePath);
166
+ if (void 0 !== specifier) imports.add(specifier);
167
+ }
119
168
  });
120
169
  return {
121
170
  exports,
122
- imports
171
+ imports,
172
+ unsafeCommonJsLoaderUsage,
173
+ unsafeDynamicImport
123
174
  };
124
175
  };
125
176
  const getPackageName = (specifier)=>specifier.startsWith('@') ? specifier.split('/').slice(0, 2).join('/') : specifier.split('/')[0];
@@ -170,7 +221,25 @@ const verifyWorkerModuleClosure = async (issues, entryPath, entrySource, contrac
170
221
  return;
171
222
  }
172
223
  if (isEntry) entryAnalysis = analysis;
224
+ if (analysis.unsafeCommonJsLoaderUsage) addIssue(issues, {
225
+ code: 'invalid-worker-bundle',
226
+ message: 'Cloudflare worker bundles must use exactly one string-literal specifier in ambient CommonJS loader calls and must not pass or alias the loader.',
227
+ path: modulePath
228
+ });
229
+ if (analysis.unsafeDynamicImport) addIssue(issues, {
230
+ code: 'invalid-worker-bundle',
231
+ message: 'Cloudflare worker bundles must not contain non-static dynamic module imports.',
232
+ path: modulePath
233
+ });
173
234
  for (const specifier of analysis.imports){
235
+ if (0 === specifier.length) {
236
+ addIssue(issues, {
237
+ code: 'invalid-worker-bundle',
238
+ message: 'Cloudflare worker bundle module specifiers must not be empty.',
239
+ path: modulePath
240
+ });
241
+ continue;
242
+ }
174
243
  if (!specifier.startsWith('.') && !node_path.isAbsolute(specifier)) {
175
244
  if (CLOUDFLARE_WORKER_NODE_BUILTIN_SPECIFIERS.has(specifier)) continue;
176
245
  if (specifier.startsWith('node:')) {
@@ -219,14 +288,20 @@ const verifyWorkerBundleReferences = async (issues, worker, source, contract)=>{
219
288
  path: worker.path
220
289
  });
221
290
  };
222
- const verifyWorkerImport = async (issues, entryPath)=>{
291
+ const verifyWorkerImport = async (issues, entryPath, expectedManifest)=>{
223
292
  try {
224
- const worker = (await import(`${pathToFileURL(entryPath).href}?t=${Date.now()}`)).default;
293
+ const workerModule = await import(`${pathToFileURL(entryPath).href}?t=${Date.now()}`);
294
+ const worker = workerModule.default;
225
295
  if (!worker || 'function' != typeof worker.fetch) addIssue(issues, {
226
296
  code: 'worker-import-failed',
227
297
  message: 'Cloudflare server entry must default-export a Worker with fetch.',
228
298
  path: entryPath
229
299
  });
300
+ if (void 0 !== expectedManifest && !isDeepStrictEqual(workerModule.modernWorkerManifest, expectedManifest)) addIssue(issues, {
301
+ code: 'worker-import-failed',
302
+ message: 'Cloudflare server entry runtime manifest must exactly match modern-worker-manifest.json.',
303
+ path: entryPath
304
+ });
230
305
  } catch (error) {
231
306
  addIssue(issues, {
232
307
  code: 'worker-import-failed',
@@ -1,5 +1,6 @@
1
1
  const ASSETS_BINDING = 'ASSETS';
2
2
  const MODERN_WORKER_MANIFEST = p_workerManifest;
3
+ export const modernWorkerManifest = MODERN_WORKER_MANIFEST;
3
4
  const WORKER_MODULE_LOADERS = p_workerModuleLoaders;
4
5
  const workerModulePromises = new Map();
5
6
  const effectBffDispatcherPromises = new Map();
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Workerd cannot initialize Module Federation's Node-oriented SSR data-fetch
3
+ * runtime. Cloudflare workers do not load native MF remotes, so retain the
4
+ * runtime-plugin contract without installing its server data-fetch hooks.
5
+ */
6
+ export const injectDataFetchFunctionPlugin = () => ({
7
+ name: '@module-federation/inject-data-fetch-function-plugin',
8
+ setup() {},
9
+ });
10
+
11
+ export const mfSSRDevPlugin = () => ({
12
+ name: '@module-federation/modern-js-v3',
13
+ setup() {},
14
+ });