@bleedingdev/modern-js-app-tools 3.9.0-ultramodern.1 → 3.9.0-ultramodern.11

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 (352) hide show
  1. package/dist/cjs/builder/generator/index.js +0 -1
  2. package/dist/cjs/builder/shared/builderPlugins/index.js +4 -11
  3. package/dist/cjs/config/index.js +4 -11
  4. package/dist/cjs/index.js +46 -72
  5. package/dist/cjs/plugins/deploy/platforms/node.js +0 -13
  6. package/dist/cjs/plugins/deploy/utils/generator.js +1 -1
  7. package/dist/cjs/plugins/serverBuild.js +2 -1
  8. package/dist/cjs/{plugins/backendFederationBuild.js → server-plugin.js} +4 -7
  9. package/dist/esm/builder/generator/index.mjs +1 -2
  10. package/dist/esm/builder/shared/builderPlugins/index.mjs +0 -1
  11. package/dist/esm/config/index.mjs +0 -1
  12. package/dist/esm/index.mjs +3 -6
  13. package/dist/esm/plugins/deploy/platforms/node.mjs +0 -13
  14. package/dist/esm/plugins/deploy/utils/generator.mjs +1 -1
  15. package/dist/esm/plugins/serverBuild.mjs +2 -1
  16. package/dist/esm/server-plugin.mjs +1 -0
  17. package/dist/esm-node/builder/generator/index.mjs +1 -2
  18. package/dist/esm-node/builder/shared/builderPlugins/index.mjs +0 -1
  19. package/dist/esm-node/config/index.mjs +0 -1
  20. package/dist/esm-node/index.mjs +3 -6
  21. package/dist/esm-node/plugins/deploy/platforms/node.mjs +0 -13
  22. package/dist/esm-node/plugins/deploy/utils/generator.mjs +1 -1
  23. package/dist/esm-node/plugins/serverBuild.mjs +2 -1
  24. package/dist/esm-node/server-plugin.mjs +2 -0
  25. package/dist/types/builder/shared/builderPlugins/index.d.ts +0 -1
  26. package/dist/types/config/index.d.ts +0 -1
  27. package/dist/types/index.d.ts +2 -2
  28. package/dist/types/plugins/deploy/utils/generator.d.ts +1 -1
  29. package/dist/types/server-plugin.d.ts +10 -0
  30. package/dist/types/types/config/output.d.ts +0 -9
  31. package/dist/types/types/index.d.ts +1 -1
  32. package/dist/types/types/plugin.d.ts +56 -2
  33. package/dist/types/utils/initAppContext.d.ts +3 -2
  34. package/docs/apis/app/commands.md +2 -0
  35. package/docs/apis/app/hooks/api/lambda.md +2 -0
  36. package/docs/apis/app/hooks/config/favicon.md +2 -0
  37. package/docs/apis/app/hooks/config/html.md +2 -0
  38. package/docs/apis/app/hooks/config/icon.md +2 -0
  39. package/docs/apis/app/hooks/config/mock.md +2 -0
  40. package/docs/apis/app/hooks/config/public.md +2 -0
  41. package/docs/apis/app/hooks/config/upload.md +2 -0
  42. package/docs/apis/app/hooks/modern-config.md +2 -0
  43. package/docs/apis/app/hooks/server/server.md +2 -0
  44. package/docs/apis/app/hooks/shared.md +2 -0
  45. package/docs/apis/app/hooks/src/app.md +2 -0
  46. package/docs/apis/app/hooks/src/entry.md +2 -0
  47. package/docs/apis/app/hooks/src/entry.server.md +2 -0
  48. package/docs/apis/app/hooks/src/modern.runtime.md +2 -0
  49. package/docs/apis/app/hooks/src/routes.md +2 -0
  50. package/docs/apis/app/hooks/src/server.md +2 -0
  51. package/docs/apis/app/runtime/bff/use-backend-context.md +2 -0
  52. package/docs/apis/app/runtime/core/create-root.md +2 -0
  53. package/docs/apis/app/runtime/core/render.md +2 -0
  54. package/docs/apis/app/runtime/core/runtime-context.md +2 -0
  55. package/docs/apis/app/runtime/router/router.md +2 -0
  56. package/docs/apis/app/runtime/ssr/no-ssr.md +2 -0
  57. package/docs/apis/app/runtime/ssr/renderStreaming.md +2 -0
  58. package/docs/apis/app/runtime/ssr/renderString.md +2 -0
  59. package/docs/apis/app/runtime/ssr/requestHandler.md +2 -0
  60. package/docs/apis/app/runtime/utility/css-in-js.md +2 -0
  61. package/docs/apis/app/runtime/utility/head.md +2 -0
  62. package/docs/apis/app/runtime/utility/loadable.md +2 -0
  63. package/docs/community/blog/2022-0708-updates.md +2 -0
  64. package/docs/community/blog/2022-0910-updates.md +2 -0
  65. package/docs/community/blog/overview.md +2 -0
  66. package/docs/community/blog/v2-release-note.md +2 -0
  67. package/docs/community/blog/v3-release-note.md +2 -0
  68. package/docs/community/contributing-guide.md +2 -0
  69. package/docs/community/releases.md +2 -0
  70. package/docs/community/showcase.md +2 -0
  71. package/docs/community/team.md +2 -0
  72. package/docs/configure/app/bff/cross-project.md +2 -0
  73. package/docs/configure/app/bff/effect.md +31 -24
  74. package/docs/configure/app/bff/prefix.md +2 -0
  75. package/docs/configure/app/bff/runtime-framework.md +2 -0
  76. package/docs/configure/app/builder-plugins.md +2 -0
  77. package/docs/configure/app/dev/asset-prefix.md +2 -0
  78. package/docs/configure/app/dev/before-start-url.md +2 -0
  79. package/docs/configure/app/dev/client.md +2 -0
  80. package/docs/configure/app/dev/hmr.md +2 -0
  81. package/docs/configure/app/dev/host.md +2 -0
  82. package/docs/configure/app/dev/https.md +2 -0
  83. package/docs/configure/app/dev/lazy-compilation.md +2 -0
  84. package/docs/configure/app/dev/live-reload.md +2 -0
  85. package/docs/configure/app/dev/mock-dir.md +2 -0
  86. package/docs/configure/app/dev/progress-bar.md +2 -0
  87. package/docs/configure/app/dev/server.md +2 -0
  88. package/docs/configure/app/dev/setup-middlewares.md +2 -0
  89. package/docs/configure/app/dev/start-url.md +2 -0
  90. package/docs/configure/app/dev/watch-files.md +2 -0
  91. package/docs/configure/app/dev/write-to-disk.md +2 -0
  92. package/docs/configure/app/experiments/source-build.md +2 -0
  93. package/docs/configure/app/html/app-icon.md +2 -0
  94. package/docs/configure/app/html/crossorigin.md +2 -0
  95. package/docs/configure/app/html/favicon.md +2 -0
  96. package/docs/configure/app/html/inject.md +2 -0
  97. package/docs/configure/app/html/meta.md +2 -0
  98. package/docs/configure/app/html/mount-id.md +2 -0
  99. package/docs/configure/app/html/output-structure.md +2 -0
  100. package/docs/configure/app/html/script-loading.md +2 -0
  101. package/docs/configure/app/html/tags.md +2 -0
  102. package/docs/configure/app/html/template-parameters.md +2 -0
  103. package/docs/configure/app/html/template.md +2 -0
  104. package/docs/configure/app/html/title.md +2 -0
  105. package/docs/configure/app/output/asset-prefix.md +2 -0
  106. package/docs/configure/app/output/assets-retry.md +2 -0
  107. package/docs/configure/app/output/charset.md +2 -0
  108. package/docs/configure/app/output/clean-dist-path.md +2 -0
  109. package/docs/configure/app/output/convert-to-rem.md +2 -0
  110. package/docs/configure/app/output/copy.md +2 -0
  111. package/docs/configure/app/output/css-modules.md +2 -0
  112. package/docs/configure/app/output/data-uri-limit.md +2 -0
  113. package/docs/configure/app/output/disable-css-module-extension.md +2 -0
  114. package/docs/configure/app/output/disable-inline-runtime-chunk.md +2 -0
  115. package/docs/configure/app/output/disable-svgr.md +2 -0
  116. package/docs/configure/app/output/disable-ts-checker.md +2 -0
  117. package/docs/configure/app/output/dist-path.md +2 -0
  118. package/docs/configure/app/output/enable-asset-manifest.md +2 -0
  119. package/docs/configure/app/output/enable-css-module-tsdeclaration.md +2 -0
  120. package/docs/configure/app/output/enable-inline-route-manifests.md +2 -0
  121. package/docs/configure/app/output/externals.md +2 -0
  122. package/docs/configure/app/output/filename-hash.md +2 -0
  123. package/docs/configure/app/output/filename.md +2 -0
  124. package/docs/configure/app/output/inject-styles.md +2 -0
  125. package/docs/configure/app/output/inline-scripts.md +2 -0
  126. package/docs/configure/app/output/inline-styles.md +2 -0
  127. package/docs/configure/app/output/legal-comments.md +2 -0
  128. package/docs/configure/app/output/minify.md +2 -0
  129. package/docs/configure/app/output/override-browserslist.md +2 -0
  130. package/docs/configure/app/output/polyfill.md +2 -0
  131. package/docs/configure/app/output/source-map.md +2 -0
  132. package/docs/configure/app/output/split-route-chunks.md +2 -0
  133. package/docs/configure/app/output/ssg.md +2 -0
  134. package/docs/configure/app/output/ssgByEntries.md +2 -0
  135. package/docs/configure/app/output/svg-default-export.md +2 -0
  136. package/docs/configure/app/output/temp-dir.md +2 -0
  137. package/docs/configure/app/performance/build-cache.md +2 -0
  138. package/docs/configure/app/performance/chunk-split.md +2 -0
  139. package/docs/configure/app/performance/dns-prefetch.md +2 -0
  140. package/docs/configure/app/performance/preconnect.md +2 -0
  141. package/docs/configure/app/performance/prefetch.md +2 -0
  142. package/docs/configure/app/performance/preload.md +2 -0
  143. package/docs/configure/app/performance/print-file-size.md +2 -0
  144. package/docs/configure/app/performance/profile.md +2 -0
  145. package/docs/configure/app/performance/remove-console.md +2 -0
  146. package/docs/configure/app/performance/remove-moment-locale.md +2 -0
  147. package/docs/configure/app/performance/rsdoctor.md +2 -0
  148. package/docs/configure/app/plugins.md +2 -0
  149. package/docs/configure/app/resolve/alias-strategy.md +2 -0
  150. package/docs/configure/app/resolve/alias.md +2 -0
  151. package/docs/configure/app/resolve/condition-names.md +2 -0
  152. package/docs/configure/app/resolve/dedupe.md +2 -0
  153. package/docs/configure/app/resolve/extensions.md +2 -0
  154. package/docs/configure/app/runtime/0-intro.md +2 -0
  155. package/docs/configure/app/runtime/plugins.md +2 -0
  156. package/docs/configure/app/runtime/router.md +2 -0
  157. package/docs/configure/app/security/check-syntax.md +2 -0
  158. package/docs/configure/app/security/nonce.md +2 -0
  159. package/docs/configure/app/security/sri.md +2 -0
  160. package/docs/configure/app/server/base-url.md +2 -0
  161. package/docs/configure/app/server/port.md +2 -0
  162. package/docs/configure/app/server/public-routes.md +2 -0
  163. package/docs/configure/app/server/routes.md +2 -0
  164. package/docs/configure/app/server/rsc.md +2 -0
  165. package/docs/configure/app/server/ssr-by-entries.md +2 -0
  166. package/docs/configure/app/server/ssr.md +2 -0
  167. package/docs/configure/app/server/tsconfig-path.md +2 -0
  168. package/docs/configure/app/source/alias-strategy.md +2 -0
  169. package/docs/configure/app/source/alias.md +2 -0
  170. package/docs/configure/app/source/config-dir.md +2 -0
  171. package/docs/configure/app/source/decorators.md +2 -0
  172. package/docs/configure/app/source/define.md +2 -0
  173. package/docs/configure/app/source/disable-default-entries.md +2 -0
  174. package/docs/configure/app/source/enable-async-entry.md +2 -0
  175. package/docs/configure/app/source/enable-async-pre-entry.md +2 -0
  176. package/docs/configure/app/source/entries-dir.md +2 -0
  177. package/docs/configure/app/source/entries.md +2 -0
  178. package/docs/configure/app/source/exclude.md +2 -0
  179. package/docs/configure/app/source/global-vars.md +2 -0
  180. package/docs/configure/app/source/include.md +2 -0
  181. package/docs/configure/app/source/main-entry-name.md +2 -0
  182. package/docs/configure/app/source/pre-entry.md +2 -0
  183. package/docs/configure/app/source/react-compiler.md +2 -0
  184. package/docs/configure/app/source/transform-import.md +2 -0
  185. package/docs/configure/app/split-chunks.md +2 -0
  186. package/docs/configure/app/tools/autoprefixer.md +2 -0
  187. package/docs/configure/app/tools/bundler-chain.md +2 -0
  188. package/docs/configure/app/tools/css-extract.md +2 -0
  189. package/docs/configure/app/tools/css-loader.md +2 -0
  190. package/docs/configure/app/tools/dev-server.md +2 -0
  191. package/docs/configure/app/tools/html-plugin.md +2 -0
  192. package/docs/configure/app/tools/less.md +2 -0
  193. package/docs/configure/app/tools/lightningcss-loader.md +2 -0
  194. package/docs/configure/app/tools/minify-css.md +2 -0
  195. package/docs/configure/app/tools/postcss.md +2 -0
  196. package/docs/configure/app/tools/rspack.md +2 -0
  197. package/docs/configure/app/tools/sass.md +2 -0
  198. package/docs/configure/app/tools/style-loader.md +2 -0
  199. package/docs/configure/app/tools/swc.md +2 -0
  200. package/docs/configure/app/tools/ts-checker.md +2 -0
  201. package/docs/configure/app/usage.md +2 -0
  202. package/docs/guides/advanced-features/bff/cross-project.md +2 -0
  203. package/docs/guides/advanced-features/bff/data-platform.md +4 -2
  204. package/docs/guides/advanced-features/bff/extend-server.md +2 -0
  205. package/docs/guides/advanced-features/bff/frameworks.md +38 -24
  206. package/docs/guides/advanced-features/bff/function.md +4 -2
  207. package/docs/guides/advanced-features/bff/operators.md +19 -17
  208. package/docs/guides/advanced-features/bff/sdk.md +2 -0
  209. package/docs/guides/advanced-features/bff/upload.md +2 -0
  210. package/docs/guides/advanced-features/bff.md +2 -0
  211. package/docs/guides/advanced-features/build-performance.md +2 -0
  212. package/docs/guides/advanced-features/compatibility.md +2 -0
  213. package/docs/guides/advanced-features/international/advanced.md +2 -0
  214. package/docs/guides/advanced-features/international/api.md +2 -0
  215. package/docs/guides/advanced-features/international/best-practices.md +2 -0
  216. package/docs/guides/advanced-features/international/configuration.md +2 -0
  217. package/docs/guides/advanced-features/international/locale-detection.md +2 -0
  218. package/docs/guides/advanced-features/international/quick-start.md +2 -0
  219. package/docs/guides/advanced-features/international/resource-loading.md +2 -0
  220. package/docs/guides/advanced-features/international/routing.md +2 -0
  221. package/docs/guides/advanced-features/international.md +2 -0
  222. package/docs/guides/advanced-features/low-level.md +2 -0
  223. package/docs/guides/advanced-features/page-performance/code-split.md +2 -0
  224. package/docs/guides/advanced-features/page-performance/inline-assets.md +2 -0
  225. package/docs/guides/advanced-features/page-performance/optimize-bundle.md +2 -0
  226. package/docs/guides/advanced-features/page-performance/react-compiler.md +2 -0
  227. package/docs/guides/advanced-features/server-monitor/logger.md +2 -0
  228. package/docs/guides/advanced-features/server-monitor/metrics.md +2 -0
  229. package/docs/guides/advanced-features/server-monitor/monitors.md +2 -0
  230. package/docs/guides/advanced-features/source-build.md +2 -0
  231. package/docs/guides/advanced-features/web-server.md +2 -0
  232. package/docs/guides/basic-features/alias.md +2 -0
  233. package/docs/guides/basic-features/css/css-in-js.md +2 -0
  234. package/docs/guides/basic-features/css/css-modules.md +2 -0
  235. package/docs/guides/basic-features/css/css.md +2 -0
  236. package/docs/guides/basic-features/css/tailwindcss.md +2 -0
  237. package/docs/guides/basic-features/data/data-cache.md +2 -0
  238. package/docs/guides/basic-features/data/data-fetch.md +2 -0
  239. package/docs/guides/basic-features/data/data-write.md +2 -0
  240. package/docs/guides/basic-features/debug/mock.md +2 -0
  241. package/docs/guides/basic-features/debug/proxy.md +2 -0
  242. package/docs/guides/basic-features/debug/rsdoctor.md +2 -0
  243. package/docs/guides/basic-features/debug/using-storybook.md +2 -0
  244. package/docs/guides/basic-features/deploy.md +2 -0
  245. package/docs/guides/basic-features/env-vars.md +2 -0
  246. package/docs/guides/basic-features/html.md +2 -0
  247. package/docs/guides/basic-features/output-files.md +2 -0
  248. package/docs/guides/basic-features/render/before-render.md +2 -0
  249. package/docs/guides/basic-features/render/overview.md +2 -0
  250. package/docs/guides/basic-features/render/rsc.md +2 -0
  251. package/docs/guides/basic-features/render/ssg.md +2 -0
  252. package/docs/guides/basic-features/render/ssr-cache.md +16 -1
  253. package/docs/guides/basic-features/render/ssr.md +2 -0
  254. package/docs/guides/basic-features/render/streaming-ssr.md +2 -0
  255. package/docs/guides/basic-features/routes/config-routes.md +2 -0
  256. package/docs/guides/basic-features/routes/routes.md +2 -0
  257. package/docs/guides/basic-features/static-assets/json-files.md +2 -0
  258. package/docs/guides/basic-features/static-assets/svg-assets.md +2 -0
  259. package/docs/guides/basic-features/static-assets/wasm-assets.md +2 -0
  260. package/docs/guides/basic-features/static-assets.md +2 -0
  261. package/docs/guides/basic-features/testing/playwright.md +2 -0
  262. package/docs/guides/basic-features/testing/rstest.md +2 -0
  263. package/docs/guides/concept/builder.md +2 -0
  264. package/docs/guides/concept/entries.md +2 -0
  265. package/docs/guides/concept/server.md +2 -0
  266. package/docs/guides/get-started/ai-coding-agents.md +2 -0
  267. package/docs/guides/get-started/glossary.md +2 -0
  268. package/docs/guides/get-started/introduction.md +2 -0
  269. package/docs/guides/get-started/quick-start.md +3 -5
  270. package/docs/guides/get-started/tech-stack.md +2 -0
  271. package/docs/guides/get-started/ultramodern.md +11 -90
  272. package/docs/guides/get-started/upgrade.md +2 -0
  273. package/docs/guides/topic-detail/module-federation/application.md +2 -0
  274. package/docs/guides/topic-detail/module-federation/deploy.md +2 -0
  275. package/docs/guides/topic-detail/module-federation/i18n.md +2 -0
  276. package/docs/guides/topic-detail/module-federation/introduce.md +2 -0
  277. package/docs/guides/topic-detail/module-federation/ssr.md +2 -0
  278. package/docs/guides/topic-detail/module-federation/usage.md +2 -0
  279. package/docs/guides/troubleshooting/builder.md +2 -0
  280. package/docs/guides/troubleshooting/cli.md +2 -0
  281. package/docs/guides/troubleshooting/dependencies.md +2 -0
  282. package/docs/guides/troubleshooting/hmr.md +2 -0
  283. package/docs/guides/upgrade/config.md +2 -0
  284. package/docs/guides/upgrade/entry.md +2 -0
  285. package/docs/guides/upgrade/other.md +2 -0
  286. package/docs/guides/upgrade/overview.md +2 -0
  287. package/docs/guides/upgrade/tailwindcss.md +2 -0
  288. package/docs/guides/upgrade/web-server.md +2 -0
  289. package/docs/index.md +2 -0
  290. package/docs/llms.txt +2 -2
  291. package/docs/plugin/cli-plugins/api.md +2 -0
  292. package/docs/plugin/cli-plugins/life-cycle.md +2 -0
  293. package/docs/plugin/introduction.md +2 -0
  294. package/docs/plugin/official/cli-plugins/plugin-bff.md +2 -0
  295. package/docs/plugin/official/cli-plugins/plugin-ssg.md +2 -0
  296. package/docs/plugin/official/cli-plugins/plugin-styled-components.md +2 -0
  297. package/docs/plugin/official/cli-plugins.md +2 -0
  298. package/docs/plugin/plugin-system.md +2 -0
  299. package/docs/plugin/runtime-plugins/api.md +2 -0
  300. package/docs/plugin/runtime-plugins/life-cycle.md +2 -0
  301. package/docs/plugin/server-plugins/api.md +2 -0
  302. package/docs/plugin/server-plugins/life-cycle.md +2 -0
  303. package/docs/tutorials/examples/csr-auth.md +2 -0
  304. package/docs/tutorials/foundations/introduction.md +2 -0
  305. package/package.json +30 -38
  306. package/dist/cjs/builder/shared/builderPlugins/adapterPrecompress.js +0 -125
  307. package/dist/cjs/config/build-environment.js +0 -268
  308. package/dist/cjs/config/public.js +0 -46
  309. package/dist/cjs/plugins/backend-federation/codegen.js +0 -256
  310. package/dist/cjs/plugins/backend-federation/config.js +0 -204
  311. package/dist/cjs/plugins/backend-federation/emit.js +0 -150
  312. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +0 -62
  313. package/dist/cjs/plugins/deploy/utils/npmAliases.js +0 -226
  314. package/dist/cjs/plugins/ultramodernReleaseEnvelope.js +0 -44
  315. package/dist/cjs/presetUltramodern.js +0 -168
  316. package/dist/cjs/types/config/precompress.js +0 -18
  317. package/dist/esm/builder/shared/builderPlugins/adapterPrecompress.mjs +0 -77
  318. package/dist/esm/config/build-environment.mjs +0 -224
  319. package/dist/esm/config/public.mjs +0 -1
  320. package/dist/esm/plugins/backend-federation/codegen.mjs +0 -205
  321. package/dist/esm/plugins/backend-federation/config.mjs +0 -128
  322. package/dist/esm/plugins/backend-federation/emit.mjs +0 -99
  323. package/dist/esm/plugins/backendFederationBuild.mjs +0 -1
  324. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +0 -1
  325. package/dist/esm/plugins/deploy/utils/npmAliases.mjs +0 -174
  326. package/dist/esm/plugins/ultramodernReleaseEnvelope.mjs +0 -6
  327. package/dist/esm/presetUltramodern.mjs +0 -112
  328. package/dist/esm/types/config/precompress.mjs +0 -0
  329. package/dist/esm-node/builder/shared/builderPlugins/adapterPrecompress.mjs +0 -78
  330. package/dist/esm-node/config/build-environment.mjs +0 -225
  331. package/dist/esm-node/config/public.mjs +0 -2
  332. package/dist/esm-node/plugins/backend-federation/codegen.mjs +0 -206
  333. package/dist/esm-node/plugins/backend-federation/config.mjs +0 -129
  334. package/dist/esm-node/plugins/backend-federation/emit.mjs +0 -100
  335. package/dist/esm-node/plugins/backendFederationBuild.mjs +0 -2
  336. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +0 -2
  337. package/dist/esm-node/plugins/deploy/utils/npmAliases.mjs +0 -175
  338. package/dist/esm-node/plugins/ultramodernReleaseEnvelope.mjs +0 -7
  339. package/dist/esm-node/presetUltramodern.mjs +0 -113
  340. package/dist/esm-node/types/config/precompress.mjs +0 -1
  341. package/dist/types/builder/shared/builderPlugins/adapterPrecompress.d.ts +0 -3
  342. package/dist/types/config/build-environment.d.ts +0 -22
  343. package/dist/types/config/public.d.ts +0 -2
  344. package/dist/types/plugins/backend-federation/codegen.d.ts +0 -86
  345. package/dist/types/plugins/backend-federation/config.d.ts +0 -103
  346. package/dist/types/plugins/backend-federation/emit.d.ts +0 -13
  347. package/dist/types/plugins/backendFederationBuild.d.ts +0 -2
  348. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/index.d.ts +0 -1
  349. package/dist/types/plugins/deploy/utils/npmAliases.d.ts +0 -14
  350. package/dist/types/plugins/ultramodernReleaseEnvelope.d.ts +0 -3
  351. package/dist/types/presetUltramodern.d.ts +0 -87
  352. package/dist/types/types/config/precompress.d.ts +0 -20
@@ -1,129 +0,0 @@
1
- import "node:module";
2
- import { existsSync } from "node:fs";
3
- import promises from "node:fs/promises";
4
- import node_path from "node:path";
5
- import { resolveUltramodernSourceRevision } from "@modern-js/app-tools-extensions/release-identity";
6
- import { BACKEND_FEDERATION_MANIFEST_FILE, BACKEND_FEDERATION_REMOTE_ENTRY_FILE, DELIVERY_UNIT_DEPLOY_PROFILE, DELIVERY_UNIT_KIND, DELIVERY_UNIT_SCHEMA_VERSION, ULTRAMODERN_BUILD_ARTIFACT_FILE, ULTRAMODERN_BUILD_ARTIFACT_PATH, ULTRAMODERN_BUILD_MODULE_PATH, deliveryUnitContractBlock, isUltramodernBuildArtifact, validateDeliveryUnitRecord, validateUltramodernBuildArtifact } from "@modern-js/utils/universal";
7
- const COMPACT_CONFIG_PATH = '.modernjs/ultramodern.json';
8
- const normalizeRelativePath = (value)=>value.replace(/\\/gu, '/').replace(/^\.\/+/u, '');
9
- const isRecord = (value)=>'object' == typeof value && null !== value;
10
- const readJsonFile = async (filePath)=>JSON.parse(await promises.readFile(filePath, 'utf8'));
11
- const buildArtifactPathFor = (appDirectory)=>node_path.join(appDirectory, ULTRAMODERN_BUILD_ARTIFACT_PATH);
12
- const buildModulePathFor = (appDirectory)=>node_path.join(appDirectory, ULTRAMODERN_BUILD_MODULE_PATH);
13
- const readBuildIdentity = async (appDirectory)=>{
14
- const buildArtifactPath = buildArtifactPathFor(appDirectory);
15
- if (existsSync(buildArtifactPath)) {
16
- const artifact = await readJsonFile(buildArtifactPath);
17
- const artifactValidation = validateUltramodernBuildArtifact(artifact, buildArtifactPath);
18
- if (!artifactValidation.ok) throw new Error(`[backend-federation-build] Invalid delivery-unit build artifact at ${buildArtifactPath}.`);
19
- if (!isUltramodernBuildArtifact(artifact)) throw new Error(`[backend-federation-build] Invalid delivery-unit build artifact at ${buildArtifactPath}.`);
20
- const deliveryUnit = artifact.deliveryUnit;
21
- return {
22
- artifact,
23
- appId: deliveryUnit.appId,
24
- buildVersion: deliveryUnit.buildMarker,
25
- packageName: deliveryUnit.packageName,
26
- version: deliveryUnit.version,
27
- unitId: deliveryUnit.unitId,
28
- sourceRevision: deliveryUnit.sourceRevision
29
- };
30
- }
31
- const buildModulePath = buildModulePathFor(appDirectory);
32
- if (!existsSync(buildModulePath)) return {};
33
- console.warn(`[backend-federation-build] ${buildArtifactPath} missing; falling back to legacy regex parsing of ${buildModulePath}. Regenerate the workspace to emit ${ULTRAMODERN_BUILD_ARTIFACT_FILE}.`);
34
- const source = await promises.readFile(buildModulePath, 'utf8');
35
- return {
36
- appId: source.match(/\bappId:\s*['"]([^'"]+)['"]/u)?.[1],
37
- buildVersion: source.match(/\bbuild:\s*['"]([^'"]+)['"]/u)?.[1],
38
- packageName: source.match(/\bpackageName:\s*['"]([^'"]+)['"]/u)?.[1],
39
- version: source.match(/\bversion:\s*['"]([^'"]+)['"]/u)?.[1],
40
- unitId: source.match(/\bunitId:\s*['"]([^'"]+)['"]/u)?.[1],
41
- sourceRevision: source.match(/\bsourceRevision:\s*['"]([^'"]+)['"]/u)?.[1]
42
- };
43
- };
44
- const toPascalCase = (value)=>value.split(/[^a-zA-Z0-9]+/u).filter(Boolean).map((part)=>part.charAt(0).toUpperCase() + part.slice(1)).join('');
45
- const stringValue = (value)=>'string' == typeof value && value.length > 0 ? value : void 0;
46
- const createBackendName = (app, id)=>{
47
- const configuredName = stringValue(app.backendFederation?.name) ?? stringValue(app.backendFederation?.executionSurfaces?.node?.remoteName) ?? stringValue(app.serverExecution?.node?.remoteName);
48
- if (configuredName) return configuredName;
49
- const mfName = stringValue(app.moduleFederation?.name);
50
- return mfName ? `${mfName}Backend` : `vertical${toPascalCase(id)}Backend`;
51
- };
52
- const findWorkspaceRoot = (appDirectory)=>{
53
- let current = appDirectory;
54
- while(true){
55
- if (existsSync(node_path.join(current, COMPACT_CONFIG_PATH))) return current;
56
- const parent = node_path.dirname(current);
57
- if (parent === current) return;
58
- current = parent;
59
- }
60
- };
61
- const resolveWorkspaceSourceRevision = async (workspaceRoot)=>resolveUltramodernSourceRevision(workspaceRoot);
62
- const createStampedDeliveryUnit = (input)=>{
63
- if (!input.unitId || !input.buildMarker || !input.packageName || !input.version) return;
64
- const record = {
65
- schemaVersion: DELIVERY_UNIT_SCHEMA_VERSION,
66
- kind: DELIVERY_UNIT_KIND,
67
- appId: input.appId,
68
- unitId: input.unitId,
69
- packageName: input.packageName,
70
- version: input.version,
71
- buildMarker: input.buildMarker,
72
- sourceRevision: input.sourceRevision,
73
- deployProfile: DELIVERY_UNIT_DEPLOY_PROFILE
74
- };
75
- const validation = validateDeliveryUnitRecord(record);
76
- if (!validation.ok) return;
77
- return deliveryUnitContractBlock(record);
78
- };
79
- const createAppFromCompactMetadata = (workspaceRoot, appDirectory, compactApp)=>{
80
- const id = stringValue(compactApp.id);
81
- const appPath = stringValue(compactApp.path);
82
- if (!id || 'vertical' !== compactApp.kind || !isRecord(compactApp.api)) return;
83
- const directory = appPath ? normalizeRelativePath(appPath) : `verticals/${id}`;
84
- if (node_path.resolve(workspaceRoot, directory) !== node_path.resolve(appDirectory)) return;
85
- const port = 'number' == typeof compactApp.port ? compactApp.port : void 0;
86
- if (void 0 === port) return;
87
- const apiPrefix = stringValue(compactApp.api.prefix) ?? `/${id}-api`;
88
- const apiStem = stringValue(compactApp.api.stem) ?? id;
89
- const backendName = createBackendName(compactApp, id);
90
- const manifestUrl = stringValue(compactApp.backendFederation?.executionSurfaces?.node?.manifestUrl) ?? stringValue(compactApp.serverExecution?.node?.manifestUrl) ?? `http://localhost:${port}/${BACKEND_FEDERATION_MANIFEST_FILE}`;
91
- const containerEntry = stringValue(compactApp.backendFederation?.executionSurfaces?.node?.containerEntry) ?? stringValue(compactApp.serverExecution?.node?.containerEntry) ?? `http://localhost:${port}/${BACKEND_FEDERATION_REMOTE_ENTRY_FILE}`;
92
- const configuredRemoteType = stringValue(compactApp.backendFederation?.executionSurfaces?.node?.remoteType) ?? stringValue(compactApp.serverExecution?.node?.remoteType);
93
- if (void 0 !== configuredRemoteType && 'commonjs-module' !== configuredRemoteType) throw new Error(`[backend-federation-build] Node backend federation remoteType must be "commonjs-module"; received "${configuredRemoteType}" for ${id}.`);
94
- if (!new URL(containerEntry).pathname.endsWith(`/${BACKEND_FEDERATION_REMOTE_ENTRY_FILE}`)) throw new Error(`[backend-federation-build] Node backend federation containerEntry must end with "/${BACKEND_FEDERATION_REMOTE_ENTRY_FILE}"; received "${containerEntry}" for ${id}.`);
95
- const remoteType = 'commonjs-module';
96
- const packageName = stringValue(compactApp.package);
97
- const uiManifestUrl = stringValue(compactApp.backendFederation?.versionBoundary?.ui?.manifestUrl) ?? stringValue(compactApp.moduleFederation?.manifestUrl);
98
- const compactDeliveryUnit = isRecord(compactApp.deliveryUnit) ? {
99
- unitId: stringValue(compactApp.deliveryUnit.unitId),
100
- buildMarker: stringValue(compactApp.deliveryUnit.buildMarker),
101
- sourceRevision: stringValue(compactApp.deliveryUnit.sourceRevision),
102
- packageName: stringValue(compactApp.deliveryUnit.packageName),
103
- version: stringValue(compactApp.deliveryUnit.version)
104
- } : void 0;
105
- return {
106
- id,
107
- directory,
108
- packageName,
109
- port,
110
- apiPrefix,
111
- apiStem,
112
- backendName,
113
- manifestUrl,
114
- containerEntry,
115
- remoteType,
116
- uiManifestUrl,
117
- compactDeliveryUnit
118
- };
119
- };
120
- const findBackendFederationApp = async (workspaceRoot, appDirectory)=>{
121
- const compactConfigPath = node_path.join(workspaceRoot, COMPACT_CONFIG_PATH);
122
- const compactConfig = await readJsonFile(compactConfigPath);
123
- const apps = Array.isArray(compactConfig.topology?.apps) ? compactConfig.topology.apps : [];
124
- for (const app of apps){
125
- const resolved = createAppFromCompactMetadata(workspaceRoot, appDirectory, app);
126
- if (resolved) return resolved;
127
- }
128
- };
129
- export { COMPACT_CONFIG_PATH, buildArtifactPathFor, buildModulePathFor, createAppFromCompactMetadata, createStampedDeliveryUnit, findBackendFederationApp, findWorkspaceRoot, normalizeRelativePath, readBuildIdentity, resolveWorkspaceSourceRevision };
@@ -1,100 +0,0 @@
1
- import "node:module";
2
- import { existsSync } from "node:fs";
3
- import promises from "node:fs/promises";
4
- import node_path from "node:path";
5
- import { resolveUltramodernReleaseIdentity } from "@modern-js/app-tools-extensions/release-identity";
6
- import { createBackendFederationEntryIntegrity } from "@modern-js/server-runtime-extensions/backend-federation-security/node";
7
- import { BACKEND_FEDERATION_MANIFEST_FILE, BACKEND_FEDERATION_REMOTE_ENTRY_FILE, ULTRAMODERN_BUILD_ARTIFACT_FILE, stampUltramodernBuildArtifactIdentity } from "@modern-js/utils/universal";
8
- import { createBackendManifest, createBackendRemoteEntrySource } from "./codegen.mjs";
9
- import { COMPACT_CONFIG_PATH, buildArtifactPathFor, buildModulePathFor, createStampedDeliveryUnit, findBackendFederationApp, findWorkspaceRoot, readBuildIdentity, resolveWorkspaceSourceRevision } from "./config.mjs";
10
- const emitBackendFederationArtifacts = async (appDirectory, distDirectory)=>{
11
- const workspaceRoot = findWorkspaceRoot(appDirectory);
12
- if (!workspaceRoot) return;
13
- const effectApiPath = node_path.join(appDirectory, 'api/effect-api.ts');
14
- const backendFederationConfigPath = node_path.join(appDirectory, 'backend-federation.config.ts');
15
- if (!existsSync(effectApiPath) || !existsSync(backendFederationConfigPath)) return;
16
- const app = await findBackendFederationApp(workspaceRoot, appDirectory);
17
- if (!app) return;
18
- const buildIdentity = await readBuildIdentity(appDirectory);
19
- const compactDeliveryUnit = app.compactDeliveryUnit;
20
- const hasCompactDeliveryUnit = void 0 !== compactDeliveryUnit && (void 0 !== compactDeliveryUnit.unitId || void 0 !== compactDeliveryUnit.buildMarker || void 0 !== compactDeliveryUnit.packageName || void 0 !== compactDeliveryUnit.version);
21
- const hasBuildIdentity = void 0 !== buildIdentity.unitId || void 0 !== buildIdentity.buildVersion || void 0 !== buildIdentity.packageName || void 0 !== buildIdentity.version;
22
- if (hasBuildIdentity) {
23
- const compactConfigPath = node_path.join(workspaceRoot, COMPACT_CONFIG_PATH);
24
- const buildIdentityPath = existsSync(buildArtifactPathFor(appDirectory)) ? buildArtifactPathFor(appDirectory) : buildModulePathFor(appDirectory);
25
- const mismatches = [];
26
- const compare = (label, a, b, leftLabel = 'deliveryUnit')=>{
27
- if (void 0 !== a && void 0 !== b && a !== b) mismatches.push(`${label}: ${leftLabel}=${a} vs ultramodern-build=${b}`);
28
- };
29
- compare('appId', app.id, buildIdentity.appId, 'topology');
30
- if (hasCompactDeliveryUnit) {
31
- compare('unitId', compactDeliveryUnit?.unitId, buildIdentity.unitId);
32
- compare('buildMarker/build', compactDeliveryUnit?.buildMarker, buildIdentity.buildVersion);
33
- compare('packageName', compactDeliveryUnit?.packageName, buildIdentity.packageName);
34
- compare('version', compactDeliveryUnit?.version, buildIdentity.version);
35
- }
36
- if (mismatches.length > 0) throw new Error(`[backend-federation-build] Delivery-unit identity drift between ${compactConfigPath} (topology) and ${buildIdentityPath}: ${mismatches.join('; ')}`);
37
- }
38
- const unitId = compactDeliveryUnit?.unitId ?? buildIdentity.unitId;
39
- const generationBuildMarker = compactDeliveryUnit?.buildMarker ?? buildIdentity.buildVersion;
40
- const sourceRevision = await resolveWorkspaceSourceRevision(workspaceRoot);
41
- const buildVersion = generationBuildMarker && unitId ? resolveUltramodernReleaseIdentity({
42
- generationBuildMarker,
43
- unitId,
44
- workspaceRoot
45
- }).buildMarker : void 0;
46
- const packageName = compactDeliveryUnit?.packageName ?? buildIdentity.packageName ?? app.packageName;
47
- const version = compactDeliveryUnit?.version ?? buildIdentity.version;
48
- const deliveryUnit = createStampedDeliveryUnit({
49
- appId: app.id,
50
- unitId,
51
- buildMarker: buildVersion,
52
- packageName,
53
- version,
54
- sourceRevision
55
- });
56
- const stampedBuildArtifact = buildIdentity.artifact ? stampUltramodernBuildArtifactIdentity(buildIdentity.artifact, {
57
- buildMarker: buildVersion ?? buildIdentity.artifact.deliveryUnit.buildMarker,
58
- sourceRevision
59
- }) : void 0;
60
- const resolvedApp = {
61
- ...app,
62
- packageName,
63
- version,
64
- buildVersion,
65
- unitId,
66
- sourceRevision,
67
- deliveryUnit
68
- };
69
- const manifestPath = node_path.join(distDirectory, BACKEND_FEDERATION_MANIFEST_FILE);
70
- const entryPath = node_path.join(distDirectory, BACKEND_FEDERATION_REMOTE_ENTRY_FILE);
71
- const deliveryUnitArtifactPath = stampedBuildArtifact ? node_path.join(distDirectory, ULTRAMODERN_BUILD_ARTIFACT_FILE) : void 0;
72
- const entrySource = await createBackendRemoteEntrySource(workspaceRoot, resolvedApp, effectApiPath, entryPath);
73
- await promises.mkdir(distDirectory, {
74
- recursive: true
75
- });
76
- await promises.writeFile(entryPath, entrySource);
77
- await promises.writeFile(manifestPath, `${JSON.stringify(createBackendManifest(workspaceRoot, distDirectory, resolvedApp, createBackendFederationEntryIntegrity(entrySource)), null, 2)}\n`);
78
- if (stampedBuildArtifact && deliveryUnitArtifactPath) await promises.writeFile(deliveryUnitArtifactPath, `${JSON.stringify(stampedBuildArtifact, null, 2)}\n`);
79
- return {
80
- appId: resolvedApp.id,
81
- manifestPath,
82
- containerPath: entryPath,
83
- ...deliveryUnitArtifactPath ? {
84
- deliveryUnitArtifactPath
85
- } : {},
86
- remoteName: resolvedApp.backendName,
87
- remoteType: resolvedApp.remoteType
88
- };
89
- };
90
- const emit = ()=>({
91
- name: '@modern-js/backend-federation-build',
92
- setup (api) {
93
- api.onAfterBuild(async ()=>{
94
- const { appDirectory, distDirectory } = api.getAppContext();
95
- await emitBackendFederationArtifacts(appDirectory, distDirectory);
96
- });
97
- }
98
- });
99
- export default emit;
100
- export { emitBackendFederationArtifacts };
@@ -1,2 +0,0 @@
1
- import "node:module";
2
- export { default, emitBackendFederationArtifacts } from "./backend-federation/emit.mjs";
@@ -1,2 +0,0 @@
1
- import "node:module";
2
- export * from "@modern-js/app-tools-extensions/cloudflare-output-verifier";
@@ -1,175 +0,0 @@
1
- import "node:module";
2
- import promises from "node:fs/promises";
3
- import node_path from "node:path";
4
- const dependencyKeys = [
5
- 'dependencies',
6
- 'optionalDependencies'
7
- ];
8
- const exactVersionPattern = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u;
9
- async function readPackageJson(filePath) {
10
- return JSON.parse(await promises.readFile(filePath, 'utf8'));
11
- }
12
- function parseNpmAlias(aliasName, specifier) {
13
- if (!specifier.startsWith('npm:')) return;
14
- const target = specifier.slice(4);
15
- const versionSeparator = target.lastIndexOf('@');
16
- if (versionSeparator <= 0 || versionSeparator === target.length - 1) throw new Error(`Invalid npm alias specifier for ${aliasName}: ${specifier}`);
17
- return {
18
- aliasName,
19
- targetName: target.slice(0, versionSeparator),
20
- targetVersion: target.slice(versionSeparator + 1)
21
- };
22
- }
23
- function aliasesFromPackageJson(packageJson) {
24
- const aliases = [];
25
- for (const dependencyKey of dependencyKeys)for (const [aliasName, specifier] of Object.entries(packageJson[dependencyKey] ?? {})){
26
- const alias = parseNpmAlias(aliasName, specifier);
27
- if (alias) aliases.push(alias);
28
- }
29
- return aliases;
30
- }
31
- async function collectPackageRecords(nodeModulesDirectory) {
32
- const records = [];
33
- const visitedNodeModules = new Set();
34
- const visitPackage = async (directory)=>{
35
- const packageJsonPath = node_path.join(directory, 'package.json');
36
- try {
37
- const packageJson = await readPackageJson(packageJsonPath);
38
- if (packageJson.name && packageJson.version) records.push({
39
- directory,
40
- packageJson
41
- });
42
- } catch (error) {
43
- if ('ENOENT' !== error.code) throw error;
44
- }
45
- await visitNodeModules(node_path.join(directory, 'node_modules'));
46
- };
47
- const visitScope = async (scopeDirectory)=>{
48
- const entries = await promises.readdir(scopeDirectory, {
49
- withFileTypes: true
50
- });
51
- for (const entry of entries)if (entry.isDirectory()) await visitPackage(node_path.join(scopeDirectory, entry.name));
52
- };
53
- const visitNdepeStore = async (storeDirectory)=>{
54
- const entries = await promises.readdir(storeDirectory, {
55
- withFileTypes: true
56
- });
57
- for (const entry of entries)if (entry.isDirectory()) {
58
- const entryPath = node_path.join(storeDirectory, entry.name);
59
- if (entry.name.startsWith('@')) await visitScope(entryPath);
60
- else await visitNodeModules(node_path.join(entryPath, 'node_modules'));
61
- }
62
- };
63
- const visitNodeModules = async (directory)=>{
64
- const resolvedDirectory = node_path.resolve(directory);
65
- if (visitedNodeModules.has(resolvedDirectory)) return;
66
- visitedNodeModules.add(resolvedDirectory);
67
- let entries;
68
- try {
69
- entries = await promises.readdir(directory, {
70
- withFileTypes: true
71
- });
72
- } catch (error) {
73
- if ('ENOENT' === error.code) return;
74
- throw error;
75
- }
76
- for (const entry of entries){
77
- if (!entry.isDirectory()) continue;
78
- const entryPath = node_path.join(directory, entry.name);
79
- if ('.ndepe' === entry.name) await visitNdepeStore(entryPath);
80
- else if (entry.name.startsWith('@')) await visitScope(entryPath);
81
- else await visitPackage(entryPath);
82
- }
83
- };
84
- await visitNodeModules(nodeModulesDirectory);
85
- return records;
86
- }
87
- async function resolveAliasTarget(ownerDirectory, alias, outputDirectory) {
88
- let directory = ownerDirectory;
89
- const outputRoot = node_path.resolve(outputDirectory);
90
- const resolvedOutputRoot = await promises.realpath(outputRoot);
91
- while(directory === outputRoot || directory.startsWith(`${outputRoot}${node_path.sep}`)){
92
- const candidate = node_path.join(directory, 'node_modules', alias.targetName);
93
- try {
94
- const resolvedCandidate = await promises.realpath(candidate);
95
- if (resolvedCandidate !== resolvedOutputRoot && !resolvedCandidate.startsWith(`${resolvedOutputRoot}${node_path.sep}`)) throw new Error(`Cannot preserve npm alias ${alias.aliasName}: emitted target ${candidate} resolves outside deployment output to ${resolvedCandidate}`);
96
- const packageJson = await readPackageJson(node_path.join(candidate, 'package.json'));
97
- if (packageJson.name !== alias.targetName || !packageJson.version) throw new Error(`npm alias ${alias.aliasName} resolved ${candidate} to unexpected package ${String(packageJson.name)}`);
98
- if (exactVersionPattern.test(alias.targetVersion) && packageJson.version !== alias.targetVersion) return;
99
- return {
100
- directory: candidate,
101
- packageJson
102
- };
103
- } catch (error) {
104
- if ('ENOENT' !== error.code) throw error;
105
- }
106
- if (directory === outputRoot) break;
107
- directory = node_path.dirname(directory);
108
- }
109
- }
110
- async function ensureAliasLink(ownerDirectory, alias, target) {
111
- const aliasPath = node_path.join(ownerDirectory, 'node_modules', alias.aliasName);
112
- await promises.mkdir(node_path.dirname(aliasPath), {
113
- recursive: true
114
- });
115
- try {
116
- const [existing, expected] = await Promise.all([
117
- promises.realpath(aliasPath),
118
- promises.realpath(target.directory)
119
- ]);
120
- if (existing === expected) return;
121
- throw new Error(`Cannot preserve npm alias ${alias.aliasName}: ${aliasPath} already resolves to ${existing}, expected ${expected}`);
122
- } catch (error) {
123
- if ('ENOENT' !== error.code) throw error;
124
- }
125
- const linkTarget = node_path.relative(node_path.dirname(aliasPath), target.directory);
126
- await promises.symlink(linkTarget, aliasPath, 'dir');
127
- }
128
- function aliasSpecifier(alias) {
129
- return `npm:${alias.targetName}@${alias.targetVersion}`;
130
- }
131
- async function readPackageIdentity(entryPath) {
132
- let directory = node_path.dirname(entryPath);
133
- const root = node_path.parse(directory).root;
134
- while(directory !== root){
135
- try {
136
- const packageJson = await readPackageJson(node_path.join(directory, 'package.json'));
137
- if (packageJson.name && packageJson.version) return {
138
- name: packageJson.name,
139
- version: packageJson.version
140
- };
141
- } catch (error) {
142
- if ('ENOENT' !== error.code) throw error;
143
- }
144
- directory = node_path.dirname(directory);
145
- }
146
- throw new Error(`Cannot find owning package for deployment entry ${entryPath}`);
147
- }
148
- async function preserveNpmAliases({ appDirectory, outputDirectory, implicitAliases = [] }) {
149
- const records = await collectPackageRecords(node_path.join(outputDirectory, 'node_modules'));
150
- const appPackageJson = await readPackageJson(node_path.join(appDirectory, 'package.json'));
151
- const rootAliases = [
152
- ...aliasesFromPackageJson(appPackageJson),
153
- ...implicitAliases
154
- ].filter((alias)=>alias.aliasName !== alias.targetName);
155
- const emittedRootAliases = [];
156
- for (const alias of rootAliases){
157
- const target = await resolveAliasTarget(outputDirectory, alias, outputDirectory);
158
- if (!target) {
159
- if (implicitAliases.includes(alias)) throw new Error(`Cannot preserve implicit npm alias ${alias.aliasName}: emitted target ${alias.targetName}@${alias.targetVersion} is missing`);
160
- continue;
161
- }
162
- await ensureAliasLink(outputDirectory, alias, target);
163
- emittedRootAliases.push(alias);
164
- }
165
- for (const record of records)for (const alias of aliasesFromPackageJson(record.packageJson).filter((candidate)=>candidate.aliasName !== candidate.targetName)){
166
- const target = await resolveAliasTarget(record.directory, alias, outputDirectory);
167
- if (target) await ensureAliasLink(record.directory, alias, target);
168
- }
169
- const outputPackageJsonPath = node_path.join(outputDirectory, 'package.json');
170
- const outputPackageJson = await readPackageJson(outputPackageJsonPath);
171
- outputPackageJson.dependencies ??= {};
172
- for (const alias of emittedRootAliases)outputPackageJson.dependencies[alias.aliasName] = aliasSpecifier(alias);
173
- await promises.writeFile(outputPackageJsonPath, `${JSON.stringify(outputPackageJson, null, 2)}\n`);
174
- }
175
- export { preserveNpmAliases, readPackageIdentity };
@@ -1,7 +0,0 @@
1
- import "node:module";
2
- import { createUltramodernReleaseEnvelopePlugin } from "@modern-js/app-tools-extensions/release-envelope/plugin";
3
- import { resolveDeployTarget } from "./deploy/index.mjs";
4
- const ultramodernReleaseEnvelope = ()=>createUltramodernReleaseEnvelopePlugin({
5
- resolveDeployTarget: resolveDeployTarget
6
- });
7
- export default ultramodernReleaseEnvelope;
@@ -1,113 +0,0 @@
1
- import "node:module";
2
- import node_fs from "node:fs";
3
- import node_path from "node:path";
4
- import { resolveUltramodernReleaseIdentity } from "@modern-js/app-tools-extensions/release-identity";
5
- import { mergeConfig } from "@modern-js/plugin/cli";
6
- import { rspack } from "@rsbuild/core";
7
- const DEFAULT_OTLP_ENDPOINT = 'http://127.0.0.1:4318/v1/logs';
8
- const DEFAULT_VICTORIA_METRICS_ENDPOINT = 'http://127.0.0.1:8428/api/v1/import/prometheus';
9
- const resolveReactRouterPackageDir = (appDirectory)=>{
10
- const resolveNodeModulePackageJson = (packageName, fromDirectory)=>{
11
- let currentDirectory = node_path.resolve(fromDirectory);
12
- while(true){
13
- const packageJson = node_path.join(currentDirectory, 'node_modules', packageName, 'package.json');
14
- if (node_fs.existsSync(packageJson)) return node_fs.realpathSync(packageJson);
15
- const parentDirectory = node_path.dirname(currentDirectory);
16
- if (parentDirectory === currentDirectory) return;
17
- currentDirectory = parentDirectory;
18
- }
19
- };
20
- const reactRouterPackageJson = resolveNodeModulePackageJson('react-router', appDirectory);
21
- if (reactRouterPackageJson) return node_path.dirname(reactRouterPackageJson);
22
- const reactRouterDomPackageJson = resolveNodeModulePackageJson('react-router-dom', appDirectory);
23
- if (!reactRouterDomPackageJson) return;
24
- const nestedReactRouterPackageJson = resolveNodeModulePackageJson('react-router', node_path.dirname(reactRouterDomPackageJson));
25
- if (nestedReactRouterPackageJson) return node_path.dirname(nestedReactRouterPackageJson);
26
- };
27
- const setReactRouterBridgeSafeAliases = (chain, { isProd })=>{
28
- const chainContext = chain.get('context');
29
- const appDirectory = 'string' == typeof chainContext && chainContext.length > 0 ? chainContext : process.cwd();
30
- const reactRouterPackageDir = resolveReactRouterPackageDir(appDirectory);
31
- if (!reactRouterPackageDir) return;
32
- const productionEntry = node_path.join(reactRouterPackageDir, 'dist/production/index.mjs');
33
- const developmentEntry = node_path.join(reactRouterPackageDir, 'dist/development/index.mjs');
34
- chain.resolve.alias.set('react-router$', isProd ? productionEntry : developmentEntry);
35
- chain.resolve.alias.set('react-router/dist/production/index.js', productionEntry);
36
- chain.resolve.alias.set('react-router/dist/development/index.js', developmentEntry);
37
- };
38
- const createPresetUltramodernConfig = (options = {})=>{
39
- const { appId = 'app', deliveryUnit, enableBffRequestId = true, enableTelemetry = true, enableTelemetryExporters, otlpEndpoint = process.env.MODERN_TELEMETRY_OTLP_ENDPOINT, victoriaMetricsEndpoint = process.env.MODERN_TELEMETRY_VICTORIA_ENDPOINT, telemetryFailLoudStartup = false, enableModuleFederationSSR = true } = options;
40
- const server = {};
41
- const releaseIdentity = deliveryUnit ? resolveUltramodernReleaseIdentity({
42
- generationBuildMarker: deliveryUnit.buildMarker,
43
- unitId: deliveryUnit.unitId
44
- }) : void 0;
45
- const bundledReleaseIdentity = releaseIdentity ? {
46
- ...releaseIdentity,
47
- releaseVersion: deliveryUnit.version
48
- } : void 0;
49
- if (enableTelemetry) {
50
- server.telemetry = {
51
- enabled: true,
52
- failLoudStartup: telemetryFailLoudStartup
53
- };
54
- if (false !== enableTelemetryExporters) {
55
- const exporters = {};
56
- if (true === enableTelemetryExporters || otlpEndpoint) exporters.otlp = {
57
- enabled: true,
58
- endpoint: otlpEndpoint || DEFAULT_OTLP_ENDPOINT
59
- };
60
- if (true === enableTelemetryExporters || victoriaMetricsEndpoint) exporters.victoriaMetrics = {
61
- enabled: true,
62
- endpoint: victoriaMetricsEndpoint || DEFAULT_VICTORIA_METRICS_ENDPOINT
63
- };
64
- if (Object.keys(exporters).length > 0) server.telemetry.exporters = exporters;
65
- }
66
- }
67
- if (enableModuleFederationSSR) server.ssr = {
68
- mode: 'stream',
69
- moduleFederationAppSSR: true
70
- };
71
- const presetConfig = {
72
- output: {
73
- precompress: true
74
- },
75
- server,
76
- source: {
77
- reactCompiler: true,
78
- ...deliveryUnit ? {
79
- globalVars: {
80
- ULTRAMODERN_BUILD_MARKER: releaseIdentity?.buildMarker,
81
- ULTRAMODERN_RELEASE_VERSION: deliveryUnit.version,
82
- ULTRAMODERN_SOURCE_REVISION: releaseIdentity?.sourceRevision
83
- }
84
- } : {}
85
- },
86
- tools: {
87
- bundlerChain: setReactRouterBridgeSafeAliases,
88
- lightningcssLoader: true,
89
- ...bundledReleaseIdentity ? {
90
- rspack: (config)=>{
91
- config.plugins ??= [];
92
- config.plugins.push(new rspack.BannerPlugin({
93
- banner: `void ${JSON.stringify(bundledReleaseIdentity.buildMarker)};void ${JSON.stringify(bundledReleaseIdentity.sourceRevision)};void ${JSON.stringify(bundledReleaseIdentity.releaseVersion)};`,
94
- raw: true,
95
- stage: rspack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE,
96
- test: /\.(?:c|m)?js$/u
97
- }));
98
- return config;
99
- }
100
- } : {}
101
- }
102
- };
103
- if (enableBffRequestId) presetConfig.bff = {
104
- requestId: appId
105
- };
106
- return presetConfig;
107
- };
108
- const presetUltramodern = (config, options = {})=>mergeConfig([
109
- createPresetUltramodernConfig(options),
110
- config
111
- ]);
112
- export { default as ultramodernReleaseEnvelopePlugin } from "./plugins/ultramodernReleaseEnvelope.mjs";
113
- export { createPresetUltramodernConfig, presetUltramodern };
@@ -1 +0,0 @@
1
- import "node:module";
@@ -1,3 +0,0 @@
1
- import type { RsbuildPlugin } from '@rsbuild/core';
2
- import type { BuilderOptions } from '../types.js';
3
- export declare const builderPluginAdapterPrecompress: (options: BuilderOptions) => RsbuildPlugin;
@@ -1,22 +0,0 @@
1
- import type { URL } from 'node:url';
2
- import type { Rspack } from '@rsbuild/core';
3
- /**
4
- * Reads an environment variable while keeping generated build configs free of
5
- * direct process access.
6
- */
7
- export declare function getBuildConfigEnvironment(name: string): string | undefined;
8
- /**
9
- * Runs a Rspack config setup under a leased environment value. The lease is
10
- * restored when that compiler reaches any supported terminal hook.
11
- */
12
- export declare function withBuildConfigEnvironment<Config extends {
13
- plugins?: Rspack.Plugin[];
14
- }, SetupArguments extends unknown[]>(name: string, value: string, setup: (config: Config, ...args: SetupArguments) => Config | void | Promise<Config | void>): (config: Config, ...args: SetupArguments) => Promise<Config>;
15
- export type ResolveEffectTsgoCompilerOptions = {
16
- /** Module URL or absolute filename used to resolve the consumer's compiler. */
17
- from: string | URL;
18
- };
19
- /**
20
- * Resolves the Effect TS-Go executable used by Module Federation DTS builds.
21
- */
22
- export declare function resolveEffectTsgoCompiler(options: ResolveEffectTsgoCompilerOptions): string;
@@ -1,2 +0,0 @@
1
- export type { ResolveEffectTsgoCompilerOptions } from './build-environment.js';
2
- export { getBuildConfigEnvironment, resolveEffectTsgoCompiler, withBuildConfigEnvironment, } from './build-environment.js';
@@ -1,86 +0,0 @@
1
- import type { BackendFederationEntryIntegrity } from '@modern-js/server-runtime-extensions/backend-federation-security';
2
- import { type BackendFederationApp } from './config.js';
3
- export declare const createBackendRemoteEntrySource: (workspaceRoot: string, app: BackendFederationApp, effectApiPath: string, entryPath: string) => Promise<string>;
4
- export declare const createBackendManifest: (workspaceRoot: string, distDirectory: string, app: BackendFederationApp, entryIntegrity: BackendFederationEntryIntegrity) => {
5
- schemaVersion: number;
6
- id: string;
7
- name: string;
8
- version: string | undefined;
9
- buildVersion: string | undefined;
10
- metaData: {
11
- name: string;
12
- type: string;
13
- buildInfo: {
14
- buildVersion: string | undefined;
15
- buildName: string | undefined;
16
- };
17
- remoteEntry: {
18
- name: string;
19
- path: string;
20
- type: string;
21
- };
22
- globalName: string;
23
- publicPath: string;
24
- ssrRemoteEntry: {
25
- name: string;
26
- path: string;
27
- type: string;
28
- };
29
- ssrPublicPath: string;
30
- };
31
- entry: {
32
- byteLength: number;
33
- sha256: string;
34
- file: string;
35
- path: string;
36
- type: string;
37
- url: string;
38
- };
39
- exposes: {
40
- id: string;
41
- name: string;
42
- path: string;
43
- assets: {
44
- js: {
45
- async: never[];
46
- sync: string[];
47
- };
48
- css: {
49
- async: never[];
50
- sync: never[];
51
- };
52
- };
53
- }[];
54
- shared: never[];
55
- backendFederation: {
56
- role: string;
57
- appId: string;
58
- name: string;
59
- runtimeFramework: string;
60
- strictEffectApproach: boolean;
61
- contractVersion: string;
62
- nodeAdapterVersion: string;
63
- remoteType: string;
64
- expose: string;
65
- manifestUrl: string;
66
- containerEntry: string;
67
- source: {
68
- module: string;
69
- };
70
- readinessPath: string;
71
- openapiPath: string;
72
- deliveryUnit?: import("@modern-js/utils/universal").DeliveryUnitContractBlock | undefined;
73
- versionBoundary: {
74
- invariant: string;
75
- packageName: string | undefined;
76
- version: string | undefined;
77
- buildVersion: string | undefined;
78
- uiManifestUrl?: string | undefined;
79
- deliveryUnit?: {
80
- unitId: string;
81
- buildMarker: string;
82
- sourceRevision: string;
83
- } | undefined;
84
- };
85
- };
86
- };