@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.9 → 3.5.0-ultramodern.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/bin/modern.js +0 -0
  2. package/dist/cjs/builder/generator/getBuilderEnvironments.js +13 -16
  3. package/dist/cjs/builder/shared/builderPlugins/adapterPrecompress.js +13 -4
  4. package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +14 -11
  5. package/dist/cjs/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.js +72 -0
  6. package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +28 -11
  7. package/dist/cjs/builder/shared/bundlerPlugins/index.js +13 -6
  8. package/dist/cjs/builder/shared/lazyCompilation.js +2 -10
  9. package/dist/cjs/commands/index.js +0 -4
  10. package/dist/cjs/config/build-environment.js +268 -0
  11. package/dist/cjs/config/index.js +11 -4
  12. package/dist/cjs/config/public.js +46 -0
  13. package/dist/cjs/index.js +39 -62
  14. package/dist/cjs/plugins/analyze/getServerRoutes.js +19 -0
  15. package/dist/cjs/plugins/analyze/index.js +20 -12
  16. package/dist/cjs/plugins/backend-federation/codegen.js +255 -0
  17. package/dist/cjs/plugins/backend-federation/config.js +204 -0
  18. package/dist/cjs/plugins/backend-federation/emit.js +148 -0
  19. package/dist/cjs/plugins/backendFederationBuild.js +53 -0
  20. package/dist/cjs/plugins/deploy/index.js +4 -4
  21. package/dist/cjs/plugins/deploy/platforms/cloudflare/artifacts.js +127 -0
  22. package/dist/cjs/plugins/deploy/platforms/cloudflare/constants.js +141 -0
  23. package/dist/cjs/plugins/deploy/platforms/cloudflare/delivery-unit.js +139 -0
  24. package/dist/cjs/plugins/deploy/platforms/cloudflare/i18n-worker.js +135 -0
  25. package/dist/cjs/plugins/deploy/platforms/cloudflare/index.js +150 -0
  26. package/dist/cjs/plugins/deploy/platforms/cloudflare/security-policies.js +205 -0
  27. package/dist/cjs/plugins/deploy/platforms/cloudflare/types.js +18 -0
  28. package/dist/cjs/plugins/deploy/platforms/cloudflare/utils.js +66 -0
  29. package/dist/cjs/plugins/deploy/platforms/cloudflare/worker-manifest.js +208 -0
  30. package/dist/cjs/plugins/deploy/platforms/cloudflare/wrangler-config.js +204 -0
  31. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-contract.js +108 -0
  32. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-plan.js +93 -0
  33. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/identity.js +83 -0
  34. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +188 -0
  35. package/dist/cjs/{baseline.js → plugins/deploy/platforms/cloudflare-output-verifier/issues.js} +19 -10
  36. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/manifest.js +89 -0
  37. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.js +151 -0
  38. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.js +302 -0
  39. package/dist/cjs/plugins/deploy/platforms/node.js +20 -2
  40. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +250 -0
  41. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +191 -0
  42. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +514 -0
  43. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +1012 -0
  44. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +363 -0
  45. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +93 -0
  46. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +8 -4
  47. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +251 -155
  48. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +78 -39
  49. package/dist/cjs/plugins/deploy/platforms/templates/netlify-entry.cjs +62 -41
  50. package/dist/cjs/plugins/deploy/platforms/templates/netlify-entry.mjs +63 -41
  51. package/dist/cjs/plugins/deploy/platforms/templates/node-entry.cjs +52 -35
  52. package/dist/cjs/plugins/deploy/platforms/templates/node-entry.mjs +53 -35
  53. package/dist/cjs/plugins/deploy/platforms/templates/vercel-entry.cjs +61 -41
  54. package/dist/cjs/plugins/deploy/platforms/templates/vercel-entry.mjs +61 -40
  55. package/dist/cjs/plugins/deploy/utils/npmAliases.js +226 -0
  56. package/dist/cjs/plugins/ultramodernReleaseEnvelope.js +100 -0
  57. package/dist/cjs/presetUltramodern.js +33 -2
  58. package/dist/cjs/ultramodern-release-envelope/canonical.js +68 -0
  59. package/dist/cjs/ultramodern-release-envelope/framework-output.js +597 -0
  60. package/dist/cjs/ultramodern-release-envelope/index.js +399 -0
  61. package/dist/cjs/ultramodern-release-envelope/types.js +51 -0
  62. package/dist/cjs/ultramodern-release-identity.js +110 -0
  63. package/dist/esm/builder/generator/getBuilderEnvironments.mjs +12 -15
  64. package/dist/esm/builder/shared/builderPlugins/adapterPrecompress.mjs +13 -4
  65. package/dist/esm/builder/shared/builderPlugins/adapterSSR.mjs +15 -12
  66. package/dist/esm/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.mjs +30 -0
  67. package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.mjs +24 -10
  68. package/dist/esm/builder/shared/bundlerPlugins/index.mjs +1 -0
  69. package/dist/esm/builder/shared/lazyCompilation.mjs +1 -3
  70. package/dist/esm/commands/index.mjs +0 -1
  71. package/dist/esm/config/build-environment.mjs +224 -0
  72. package/dist/esm/config/index.mjs +1 -0
  73. package/dist/esm/config/public.mjs +1 -0
  74. package/dist/esm/index.mjs +5 -4
  75. package/dist/esm/plugins/analyze/getHtmlTemplate.mjs +2 -2
  76. package/dist/esm/plugins/analyze/getServerRoutes.mjs +17 -1
  77. package/dist/esm/plugins/analyze/index.mjs +20 -12
  78. package/dist/esm/plugins/analyze/isDefaultExportFunction.mjs +2 -2
  79. package/dist/esm/plugins/backend-federation/codegen.mjs +204 -0
  80. package/dist/esm/plugins/backend-federation/config.mjs +128 -0
  81. package/dist/esm/plugins/backend-federation/emit.mjs +97 -0
  82. package/dist/esm/plugins/backendFederationBuild.mjs +1 -0
  83. package/dist/esm/plugins/deploy/index.mjs +1 -1
  84. package/dist/esm/plugins/deploy/platforms/cloudflare/artifacts.mjs +64 -0
  85. package/dist/esm/plugins/deploy/platforms/cloudflare/constants.mjs +34 -0
  86. package/dist/esm/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +88 -0
  87. package/dist/esm/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +97 -0
  88. package/dist/esm/plugins/deploy/platforms/cloudflare/index.mjs +102 -0
  89. package/dist/esm/plugins/deploy/platforms/cloudflare/security-policies.mjs +167 -0
  90. package/dist/esm/plugins/deploy/platforms/cloudflare/types.mjs +0 -0
  91. package/dist/esm/plugins/deploy/platforms/cloudflare/utils.mjs +12 -0
  92. package/dist/esm/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +148 -0
  93. package/dist/esm/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +150 -0
  94. package/dist/esm/plugins/deploy/platforms/cloudflare-output-contract.mjs +31 -0
  95. package/dist/esm/plugins/deploy/platforms/cloudflare-output-plan.mjs +45 -0
  96. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +45 -0
  97. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +133 -0
  98. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +10 -0
  99. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +51 -0
  100. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +99 -0
  101. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +238 -0
  102. package/dist/esm/plugins/deploy/platforms/node.mjs +20 -2
  103. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +250 -0
  104. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +191 -0
  105. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +514 -0
  106. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +1012 -0
  107. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +363 -0
  108. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +93 -0
  109. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +8 -4
  110. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +251 -155
  111. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +78 -39
  112. package/dist/esm/plugins/deploy/platforms/templates/netlify-entry.cjs +62 -41
  113. package/dist/esm/plugins/deploy/platforms/templates/netlify-entry.mjs +63 -41
  114. package/dist/esm/plugins/deploy/platforms/templates/node-entry.cjs +52 -35
  115. package/dist/esm/plugins/deploy/platforms/templates/node-entry.mjs +53 -35
  116. package/dist/esm/plugins/deploy/platforms/templates/vercel-entry.cjs +61 -41
  117. package/dist/esm/plugins/deploy/platforms/templates/vercel-entry.mjs +61 -40
  118. package/dist/esm/plugins/deploy/utils/npmAliases.mjs +174 -0
  119. package/dist/esm/plugins/ultramodernReleaseEnvelope.mjs +52 -0
  120. package/dist/esm/presetUltramodern.mjs +33 -2
  121. package/dist/esm/ultramodern-release-envelope/canonical.mjs +21 -0
  122. package/dist/esm/ultramodern-release-envelope/framework-output.mjs +524 -0
  123. package/dist/esm/ultramodern-release-envelope/index.mjs +335 -0
  124. package/dist/esm/ultramodern-release-envelope/types.mjs +7 -0
  125. package/dist/esm/ultramodern-release-identity.mjs +66 -0
  126. package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +12 -15
  127. package/dist/esm-node/builder/shared/builderPlugins/adapterPrecompress.mjs +13 -4
  128. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.mjs +15 -12
  129. package/dist/esm-node/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.mjs +31 -0
  130. package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.mjs +24 -10
  131. package/dist/esm-node/builder/shared/bundlerPlugins/index.mjs +1 -0
  132. package/dist/esm-node/builder/shared/lazyCompilation.mjs +1 -3
  133. package/dist/esm-node/commands/index.mjs +0 -1
  134. package/dist/esm-node/config/build-environment.mjs +225 -0
  135. package/dist/esm-node/config/index.mjs +1 -0
  136. package/dist/esm-node/config/public.mjs +2 -0
  137. package/dist/esm-node/index.mjs +5 -4
  138. package/dist/esm-node/plugins/analyze/getHtmlTemplate.mjs +2 -2
  139. package/dist/esm-node/plugins/analyze/getServerRoutes.mjs +17 -1
  140. package/dist/esm-node/plugins/analyze/index.mjs +20 -12
  141. package/dist/esm-node/plugins/analyze/isDefaultExportFunction.mjs +2 -2
  142. package/dist/esm-node/plugins/backend-federation/codegen.mjs +205 -0
  143. package/dist/esm-node/plugins/backend-federation/config.mjs +129 -0
  144. package/dist/esm-node/plugins/backend-federation/emit.mjs +98 -0
  145. package/dist/esm-node/plugins/backendFederationBuild.mjs +2 -0
  146. package/dist/esm-node/plugins/deploy/index.mjs +1 -1
  147. package/dist/esm-node/plugins/deploy/platforms/cloudflare/artifacts.mjs +65 -0
  148. package/dist/esm-node/plugins/deploy/platforms/cloudflare/constants.mjs +35 -0
  149. package/dist/esm-node/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +89 -0
  150. package/dist/esm-node/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +98 -0
  151. package/dist/esm-node/plugins/deploy/platforms/cloudflare/index.mjs +103 -0
  152. package/dist/esm-node/plugins/deploy/platforms/cloudflare/security-policies.mjs +168 -0
  153. package/dist/esm-node/plugins/deploy/platforms/cloudflare/types.mjs +1 -0
  154. package/dist/esm-node/plugins/deploy/platforms/cloudflare/utils.mjs +13 -0
  155. package/dist/esm-node/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +149 -0
  156. package/dist/esm-node/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +151 -0
  157. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-contract.mjs +32 -0
  158. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-plan.mjs +46 -0
  159. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +46 -0
  160. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +134 -0
  161. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +11 -0
  162. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +52 -0
  163. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +100 -0
  164. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +239 -0
  165. package/dist/esm-node/plugins/deploy/platforms/node.mjs +20 -2
  166. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +250 -0
  167. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +191 -0
  168. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +514 -0
  169. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +1012 -0
  170. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +363 -0
  171. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +93 -0
  172. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +8 -4
  173. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +251 -155
  174. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +78 -39
  175. package/dist/esm-node/plugins/deploy/platforms/templates/netlify-entry.cjs +62 -41
  176. package/dist/esm-node/plugins/deploy/platforms/templates/netlify-entry.mjs +63 -41
  177. package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.cjs +52 -35
  178. package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.mjs +53 -35
  179. package/dist/esm-node/plugins/deploy/platforms/templates/vercel-entry.cjs +61 -41
  180. package/dist/esm-node/plugins/deploy/platforms/templates/vercel-entry.mjs +61 -40
  181. package/dist/esm-node/plugins/deploy/utils/npmAliases.mjs +175 -0
  182. package/dist/esm-node/plugins/ultramodernReleaseEnvelope.mjs +53 -0
  183. package/dist/esm-node/presetUltramodern.mjs +33 -2
  184. package/dist/esm-node/ultramodern-release-envelope/canonical.mjs +22 -0
  185. package/dist/esm-node/ultramodern-release-envelope/framework-output.mjs +525 -0
  186. package/dist/esm-node/ultramodern-release-envelope/index.mjs +336 -0
  187. package/dist/esm-node/ultramodern-release-envelope/types.mjs +8 -0
  188. package/dist/esm-node/ultramodern-release-identity.mjs +67 -0
  189. package/dist/types/builder/generator/createCopyPattern.d.ts +7 -5
  190. package/dist/types/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.d.ts +6 -0
  191. package/dist/types/builder/shared/bundlerPlugins/RouterPlugin.d.ts +1 -0
  192. package/dist/types/builder/shared/bundlerPlugins/index.d.ts +1 -0
  193. package/dist/types/builder/shared/lazyCompilation.d.ts +2 -4
  194. package/dist/types/commands/index.d.ts +0 -1
  195. package/dist/types/config/build-environment.d.ts +22 -0
  196. package/dist/types/config/index.d.ts +1 -0
  197. package/dist/types/config/public.d.ts +2 -0
  198. package/dist/types/index.d.ts +0 -2
  199. package/dist/types/plugins/analyze/getServerRoutes.d.ts +1 -0
  200. package/dist/types/plugins/backend-federation/codegen.d.ts +83 -0
  201. package/dist/types/plugins/backend-federation/config.d.ts +103 -0
  202. package/dist/types/plugins/backend-federation/emit.d.ts +13 -0
  203. package/dist/types/plugins/backendFederationBuild.d.ts +2 -0
  204. package/dist/types/plugins/deploy/platforms/cloudflare/artifacts.d.ts +15 -0
  205. package/dist/types/plugins/deploy/platforms/cloudflare/constants.d.ts +24 -0
  206. package/dist/types/plugins/deploy/platforms/cloudflare/delivery-unit.d.ts +23 -0
  207. package/dist/types/plugins/deploy/platforms/cloudflare/i18n-worker.d.ts +22 -0
  208. package/dist/types/plugins/deploy/platforms/{cloudflare.d.ts → cloudflare/index.d.ts} +1 -1
  209. package/dist/types/plugins/deploy/platforms/cloudflare/security-policies.d.ts +51 -0
  210. package/dist/types/plugins/deploy/platforms/cloudflare/types.d.ts +5 -0
  211. package/dist/types/plugins/deploy/platforms/cloudflare/utils.d.ts +6 -0
  212. package/dist/types/plugins/deploy/platforms/cloudflare/worker-manifest.d.ts +122 -0
  213. package/dist/types/plugins/deploy/platforms/cloudflare/wrangler-config.d.ts +46 -0
  214. package/dist/types/plugins/deploy/platforms/cloudflare-output-contract.d.ts +14 -0
  215. package/dist/types/plugins/deploy/platforms/cloudflare-output-plan.d.ts +34 -0
  216. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/identity.d.ts +4 -0
  217. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/index.d.ts +18 -0
  218. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/issues.d.ts +14 -0
  219. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/manifest.d.ts +2 -0
  220. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.d.ts +14 -0
  221. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.d.ts +20 -0
  222. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.d.mts +1 -0
  223. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.d.mts +1 -0
  224. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.d.mts +1 -0
  225. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.d.mts +1 -0
  226. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.d.mts +1 -0
  227. package/dist/types/plugins/deploy/utils/npmAliases.d.ts +14 -0
  228. package/dist/types/plugins/ultramodernReleaseEnvelope.d.ts +3 -0
  229. package/dist/types/presetUltramodern.d.ts +10 -0
  230. package/dist/types/run/index.d.ts +1 -1
  231. package/dist/types/types/config/cloudflareDeploy.d.ts +41 -0
  232. package/dist/types/types/config/deploy.d.ts +15 -2
  233. package/dist/types/ultramodern-release-envelope/canonical.d.ts +5 -0
  234. package/dist/types/ultramodern-release-envelope/framework-output.d.ts +31 -0
  235. package/dist/types/ultramodern-release-envelope/index.d.ts +6 -0
  236. package/dist/types/ultramodern-release-envelope/types.d.ts +62 -0
  237. package/dist/types/ultramodern-release-identity.d.ts +16 -0
  238. package/lib/types.d.ts +2 -3
  239. package/package.json +38 -23
  240. package/rslib.config.mts +11 -12
  241. package/dist/cjs/commands/runtime.js +0 -196
  242. package/dist/cjs/plugins/deploy/platforms/cloudflare.js +0 -540
  243. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -576
  244. package/dist/cjs/ultramodern/designSystem.js +0 -123
  245. package/dist/esm/baseline.mjs +0 -4
  246. package/dist/esm/commands/runtime.mjs +0 -146
  247. package/dist/esm/plugins/deploy/platforms/cloudflare.mjs +0 -492
  248. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -576
  249. package/dist/esm/ultramodern/designSystem.mjs +0 -73
  250. package/dist/esm-node/baseline.mjs +0 -5
  251. package/dist/esm-node/commands/runtime.mjs +0 -147
  252. package/dist/esm-node/plugins/deploy/platforms/cloudflare.mjs +0 -493
  253. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -576
  254. package/dist/esm-node/ultramodern/designSystem.mjs +0 -74
  255. package/dist/types/baseline.d.ts +0 -16
  256. package/dist/types/commands/runtime.d.ts +0 -12
  257. package/dist/types/ultramodern/designSystem.d.ts +0 -54
  258. /package/dist/types/plugins/deploy/platforms/templates/{cloudflare-entry.d.mts → cloudflare-entry.006-fetch-handler.d.mts} +0 -0
@@ -1,492 +0,0 @@
1
- import node_path from "node:path";
2
- import { fs } from "@modern-js/utils";
3
- import { readTemplate } from "../utils/index.mjs";
4
- const WORKER_ENTRY = 'server/index.mjs';
5
- const WORKER_MANIFEST = 'server/modern-worker-manifest.json';
6
- const WRANGLER_CONFIG_FILE = 'wrangler.json';
7
- const OUTPUT_PACKAGE_FILE = 'package.json';
8
- const ASSETS_BINDING = 'ASSETS';
9
- const ROUTE_SPEC_FILE = 'route.json';
10
- const ROUTE_SPEC_OUTPUT = `server/${ROUTE_SPEC_FILE}`;
11
- const LOADABLE_STATS_FILE = 'loadable-stats.json';
12
- const ROUTE_MANIFEST_FILE = 'routes-manifest.json';
13
- const PUBLIC_ASSETS_DIRECTORY = 'public';
14
- const WORKER_BUNDLE_DIRECTORY = 'worker';
15
- const SERVER_BUNDLE_DIRECTORY = 'bundles';
16
- const SERVER_OUTPUT_DIRECTORY = 'server';
17
- const DEFAULT_SERVER_ONLY_PUBLIC_ASSET_EXCLUDES = [
18
- 'api',
19
- 'shared'
20
- ];
21
- const BFF_EFFECT_WORKER_ENTRY = `${WORKER_BUNDLE_DIRECTORY}/__modern_bff_effect.js`;
22
- const EFFECT_BFF_CLOUDFLARE_IMPORT_GUIDANCE = 'Ensure the Effect API entry exists at api/index.ts or bff.effect.entry, and import Cloudflare edge handlers from @modern-js/plugin-bff/effect-edge instead of lambda/Hono server helpers.';
23
- const DEFAULT_COMPATIBILITY_DATE = '2026-06-02';
24
- const COMPATIBILITY_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/u;
25
- const REQUIRED_COMPATIBILITY_FLAGS = [
26
- 'nodejs_compat',
27
- 'global_fetch_strictly_public'
28
- ];
29
- const RESERVED_ARTIFACT_DESTINATION_FILES = new Set([
30
- WRANGLER_CONFIG_FILE,
31
- OUTPUT_PACKAGE_FILE
32
- ]);
33
- const RESERVED_ARTIFACT_DESTINATION_DIRECTORIES = new Set([
34
- PUBLIC_ASSETS_DIRECTORY,
35
- SERVER_OUTPUT_DIRECTORY,
36
- WORKER_BUNDLE_DIRECTORY
37
- ]);
38
- const DEFAULT_SECURITY_HEADERS = {
39
- referrerPolicy: 'strict-origin-when-cross-origin',
40
- contentTypeOptions: 'nosniff',
41
- permissionsPolicy: 'camera=(), geolocation=(), microphone=(), payment=(), usb=()'
42
- };
43
- const DEFAULT_CORS_ALLOWED_METHODS = [
44
- 'GET',
45
- 'HEAD',
46
- 'POST',
47
- 'PUT',
48
- 'PATCH',
49
- 'DELETE',
50
- 'OPTIONS'
51
- ];
52
- const DEFAULT_CSP_DIRECTIVES = {
53
- 'base-uri': [
54
- "'self'"
55
- ],
56
- 'connect-src': [
57
- "'self'",
58
- 'https:',
59
- 'http:',
60
- 'wss:',
61
- 'ws:'
62
- ],
63
- 'default-src': [
64
- "'self'"
65
- ],
66
- 'font-src': [
67
- "'self'",
68
- 'data:',
69
- 'https:',
70
- 'http:'
71
- ],
72
- 'form-action': [
73
- "'self'"
74
- ],
75
- 'frame-ancestors': [
76
- "'self'"
77
- ],
78
- 'img-src': [
79
- "'self'",
80
- 'data:',
81
- 'blob:',
82
- 'https:',
83
- 'http:'
84
- ],
85
- 'manifest-src': [
86
- "'self'",
87
- 'https:',
88
- 'http:'
89
- ],
90
- 'object-src': [
91
- "'none'"
92
- ],
93
- "script-src": [
94
- "'self'",
95
- "'unsafe-inline'",
96
- "'unsafe-eval'",
97
- 'https:',
98
- 'http:',
99
- 'blob:'
100
- ],
101
- 'style-src': [
102
- "'self'",
103
- "'unsafe-inline'",
104
- 'https:',
105
- 'http:'
106
- ],
107
- 'worker-src': [
108
- "'self'",
109
- 'blob:'
110
- ]
111
- };
112
- const getCompatibilityDate = (modernConfig)=>{
113
- const configuredDate = modernConfig.deploy?.worker?.compatibilityDate?.trim();
114
- const compatibilityDate = configuredDate || DEFAULT_COMPATIBILITY_DATE;
115
- if (!COMPATIBILITY_DATE_PATTERN.test(compatibilityDate)) throw new Error(`deploy.worker.compatibilityDate must use YYYY-MM-DD, received ${JSON.stringify(compatibilityDate)}.`);
116
- return compatibilityDate;
117
- };
118
- const getWorkerName = (appDirectory)=>{
119
- const basename = node_path.basename(appDirectory);
120
- return basename.replace(/[^a-zA-Z0-9-_]/g, '-') || 'modern-cloudflare-worker';
121
- };
122
- const getConfiguredWorkerName = (appDirectory, modernConfig)=>{
123
- const configuredName = modernConfig.deploy?.worker?.name?.trim();
124
- return configuredName || getWorkerName(appDirectory);
125
- };
126
- const normalizeRelativePath = (value, label, scope = 'app output')=>{
127
- if ('string' != typeof value) throw new Error(`${label} must be a relative path inside the ${scope}.`);
128
- const normalized = value.trim().replace(/\\/g, '/').replace(/^\.\/+/u, '').replace(/\/+$/u, '');
129
- const segments = normalized.split('/');
130
- if (!normalized || node_path.isAbsolute(normalized) || '.' === normalized || segments.includes('..')) throw new Error(`${label} must be a relative path inside the ${scope}.`);
131
- return normalized;
132
- };
133
- const normalizeDirectiveValues = (value)=>{
134
- const values = Array.isArray(value) ? value : [
135
- value
136
- ];
137
- return [
138
- ...new Set(values.map((entry)=>entry.trim()).filter(Boolean))
139
- ];
140
- };
141
- const appendDirectiveValues = (directives, name, values)=>{
142
- if (!values?.length) return;
143
- directives[name] = normalizeDirectiveValues([
144
- ...directives[name] ?? [],
145
- ...values
146
- ]);
147
- };
148
- const createContentSecurityPolicy = (config)=>{
149
- const mode = config?.mode ?? 'report-only';
150
- if ('off' === mode) return {
151
- mode,
152
- directives: {},
153
- reason: config?.reason
154
- };
155
- const directives = Object.fromEntries(Object.entries(DEFAULT_CSP_DIRECTIVES).map(([name, values])=>[
156
- name,
157
- [
158
- ...values
159
- ]
160
- ]));
161
- for (const [name, value] of Object.entries(config?.directives ?? {}))if (false === value) delete directives[name];
162
- else directives[name] = normalizeDirectiveValues(value);
163
- if (config?.frameAncestors === false) delete directives['frame-ancestors'];
164
- else if (config?.frameAncestors) directives['frame-ancestors'] = normalizeDirectiveValues(config.frameAncestors);
165
- appendDirectiveValues(directives, "script-src", config?.additionalScriptSrc);
166
- appendDirectiveValues(directives, 'style-src', config?.additionalStyleSrc);
167
- appendDirectiveValues(directives, 'connect-src', config?.additionalConnectSrc);
168
- appendDirectiveValues(directives, 'img-src', config?.additionalImgSrc);
169
- if (config?.reportUri) directives['report-uri'] = [
170
- config.reportUri
171
- ];
172
- return {
173
- mode,
174
- directives,
175
- reason: config?.reason
176
- };
177
- };
178
- const createNoindexPolicy = (noindex)=>{
179
- if (false === noindex) return {
180
- workersDev: false,
181
- localhost: false,
182
- previewHostnames: []
183
- };
184
- if (true === noindex || void 0 === noindex) return {
185
- workersDev: true,
186
- localhost: true,
187
- previewHostnames: []
188
- };
189
- return {
190
- workersDev: noindex.workersDev ?? true,
191
- localhost: noindex.localhost ?? true,
192
- previewHostnames: noindex.previewHostnames ?? [],
193
- reason: noindex.reason
194
- };
195
- };
196
- const createCloudflareWorkerCorsPolicy = (cors)=>({
197
- assets: cors?.assets ?? true,
198
- allowedOrigins: normalizeDirectiveValues(cors?.allowedOrigins ?? []),
199
- allowedMethods: cors?.allowedMethods?.length ? normalizeDirectiveValues(cors.allowedMethods.map((method)=>method.toUpperCase())) : DEFAULT_CORS_ALLOWED_METHODS,
200
- allowedHeaders: cors?.allowedHeaders?.length ? normalizeDirectiveValues(cors.allowedHeaders) : [
201
- '*'
202
- ],
203
- reason: cors?.reason
204
- });
205
- const createCloudflareWorkerSecurityPolicy = (modernConfig)=>{
206
- const security = modernConfig.deploy?.worker?.security;
207
- if (security?.enabled === false) return {
208
- enabled: false,
209
- cors: createCloudflareWorkerCorsPolicy(security.cors),
210
- reason: security.reason
211
- };
212
- return {
213
- enabled: true,
214
- headers: {
215
- referrerPolicy: security?.headers?.referrerPolicy ?? DEFAULT_SECURITY_HEADERS.referrerPolicy,
216
- contentTypeOptions: security?.headers?.contentTypeOptions ?? DEFAULT_SECURITY_HEADERS.contentTypeOptions,
217
- permissionsPolicy: security?.headers?.permissionsPolicy ?? DEFAULT_SECURITY_HEADERS.permissionsPolicy
218
- },
219
- contentSecurityPolicy: createContentSecurityPolicy(security?.contentSecurityPolicy),
220
- noindex: createNoindexPolicy(security?.noindex),
221
- cors: createCloudflareWorkerCorsPolicy(security?.cors),
222
- reason: security?.reason
223
- };
224
- };
225
- const isJsonRecord = (value)=>'object' == typeof value && null !== value && !Array.isArray(value);
226
- const getConfiguredWrangler = (modernConfig)=>{
227
- const wrangler = modernConfig.deploy?.worker?.wrangler;
228
- if (void 0 === wrangler) return {};
229
- if (!isJsonRecord(wrangler)) throw new Error('deploy.worker.wrangler must be a JSON object.');
230
- return wrangler;
231
- };
232
- const createWranglerCompatibilityFlags = (configuredFlags)=>{
233
- if (void 0 === configuredFlags) return [
234
- ...REQUIRED_COMPATIBILITY_FLAGS
235
- ];
236
- if (!Array.isArray(configuredFlags) || configuredFlags.some((flag)=>'string' != typeof flag)) throw new Error('deploy.worker.wrangler.compatibility_flags must be an array of strings.');
237
- return [
238
- ...new Set([
239
- ...configuredFlags,
240
- ...REQUIRED_COMPATIBILITY_FLAGS
241
- ])
242
- ];
243
- };
244
- const createWranglerAssetsConfig = (configuredAssets)=>{
245
- if (void 0 !== configuredAssets && !isJsonRecord(configuredAssets)) throw new Error('deploy.worker.wrangler.assets must be an object.');
246
- return {
247
- ...isJsonRecord(configuredAssets) ? configuredAssets : {},
248
- directory: `./${PUBLIC_ASSETS_DIRECTORY}`,
249
- binding: ASSETS_BINDING,
250
- run_worker_first: true
251
- };
252
- };
253
- const assertNonEmptyString = (value, label)=>{
254
- if ('string' != typeof value || 0 === value.trim().length) throw new Error(`${label} must be a non-empty string.`);
255
- return value.trim();
256
- };
257
- const normalizeD1Database = (database, index)=>{
258
- const binding = assertNonEmptyString(database.binding, `deploy.worker.d1Databases[${index}].binding`);
259
- const databaseName = assertNonEmptyString(database.databaseName, `deploy.worker.d1Databases[${index}].databaseName`);
260
- const databaseId = assertNonEmptyString(database.databaseId, `deploy.worker.d1Databases[${index}].databaseId`);
261
- const migrationsDir = void 0 === database.migrationsDir ? void 0 : normalizeRelativePath(database.migrationsDir, `deploy.worker.d1Databases[${index}].migrationsDir`, 'app root');
262
- const previewDatabaseId = void 0 === database.previewDatabaseId ? void 0 : assertNonEmptyString(database.previewDatabaseId, `deploy.worker.d1Databases[${index}].previewDatabaseId`);
263
- return {
264
- binding,
265
- database_name: databaseName,
266
- database_id: databaseId,
267
- ...void 0 === migrationsDir ? {} : {
268
- migrations_dir: migrationsDir
269
- },
270
- ...void 0 === previewDatabaseId ? {} : {
271
- preview_database_id: previewDatabaseId
272
- },
273
- ...void 0 === database.remote ? {} : {
274
- remote: database.remote
275
- }
276
- };
277
- };
278
- const createWranglerD1Databases = (modernConfig, configuredWranglerD1)=>{
279
- const d1Databases = modernConfig.deploy?.worker?.d1Databases;
280
- if (void 0 === d1Databases) return configuredWranglerD1;
281
- if (void 0 !== configuredWranglerD1) throw new Error('Use deploy.worker.d1Databases or deploy.worker.wrangler.d1_databases, not both.');
282
- if (!Array.isArray(d1Databases)) throw new Error('deploy.worker.d1Databases must be an array.');
283
- return d1Databases.map(normalizeD1Database);
284
- };
285
- const createWranglerConfig = (appDirectory, modernConfig)=>{
286
- const wrangler = getConfiguredWrangler(modernConfig);
287
- const d1Databases = createWranglerD1Databases(modernConfig, wrangler.d1_databases);
288
- return {
289
- $schema: 'node_modules/wrangler/config-schema.json',
290
- name: getConfiguredWorkerName(appDirectory, modernConfig),
291
- compatibility_date: getCompatibilityDate(modernConfig),
292
- ...wrangler,
293
- main: WORKER_ENTRY,
294
- compatibility_flags: createWranglerCompatibilityFlags(wrangler.compatibility_flags),
295
- assets: createWranglerAssetsConfig(wrangler.assets),
296
- ...void 0 === d1Databases ? {} : {
297
- d1_databases: d1Databases
298
- }
299
- };
300
- };
301
- const normalizeCloudflareArtifact = (artifact, index)=>{
302
- const from = normalizeRelativePath(artifact.from, `deploy.worker.artifacts[${index}].from`, 'app root');
303
- const to = normalizeRelativePath(artifact.to, `deploy.worker.artifacts[${index}].to`, 'Cloudflare output');
304
- const [topLevelDestination] = to.split('/');
305
- const reservedDestination = RESERVED_ARTIFACT_DESTINATION_FILES.has(to) ? to : topLevelDestination;
306
- if (RESERVED_ARTIFACT_DESTINATION_FILES.has(to) || RESERVED_ARTIFACT_DESTINATION_DIRECTORIES.has(topLevelDestination)) throw new Error(`deploy.worker.artifacts[${index}].to must not target generated Cloudflare output path ${JSON.stringify(reservedDestination)}.`);
307
- return {
308
- from,
309
- to,
310
- index
311
- };
312
- };
313
- const getCloudflareArtifacts = (modernConfig)=>(modernConfig.deploy?.worker?.artifacts ?? []).map(normalizeCloudflareArtifact);
314
- const copyCloudflareArtifacts = async (appDirectory, outputDirectory, artifacts)=>{
315
- for (const artifact of artifacts){
316
- const sourcePath = node_path.join(appDirectory, artifact.from);
317
- if (!await fs.pathExists(sourcePath)) throw new Error(`deploy.worker.artifacts[${artifact.index}].from does not exist: ${artifact.from}`);
318
- await fs.copy(sourcePath, node_path.join(outputDirectory, artifact.to));
319
- }
320
- };
321
- const copyCloudflareD1Migrations = async (appDirectory, outputDirectory, modernConfig)=>{
322
- for (const [index, database] of (modernConfig.deploy?.worker?.d1Databases ?? []).entries()){
323
- if (!database.migrationsDir) continue;
324
- const migrationsDir = normalizeRelativePath(database.migrationsDir, `deploy.worker.d1Databases[${index}].migrationsDir`, 'app root');
325
- const sourcePath = node_path.join(appDirectory, migrationsDir);
326
- if (!await fs.pathExists(sourcePath)) throw new Error(`deploy.worker.d1Databases[${index}].migrationsDir does not exist: ${migrationsDir}`);
327
- await fs.copy(sourcePath, node_path.join(outputDirectory, migrationsDir));
328
- }
329
- };
330
- const readRouteSpec = async (outputDirectory)=>{
331
- const routeSpecPath = node_path.join(outputDirectory, ROUTE_SPEC_OUTPUT);
332
- if (!await fs.pathExists(routeSpecPath)) return {
333
- routes: []
334
- };
335
- const routeSpec = await fs.readJSON(routeSpecPath);
336
- return {
337
- ...routeSpec,
338
- routes: Array.isArray(routeSpec.routes) ? routeSpec.routes : []
339
- };
340
- };
341
- const createMissingEffectBffWorkerError = (outputDirectory, worker)=>new Error(`Cloudflare Effect API runtime is configured, but the BFF worker bundle is missing: ${node_path.join(outputDirectory, worker)}. ${EFFECT_BFF_CLOUDFLARE_IMPORT_GUIDANCE}`);
342
- const createWorkerManifest = async (outputDirectory, modernConfig)=>{
343
- const routeSpec = await readRouteSpec(outputDirectory);
344
- const routes = await Promise.all(routeSpec.routes.map(async (route)=>{
345
- const worker = 'string' == typeof route.worker ? route.worker : void 0;
346
- return {
347
- urlPath: route.urlPath,
348
- entryName: route.entryName,
349
- entryPath: route.entryPath,
350
- isSSR: Boolean(route.isSSR),
351
- worker,
352
- workerExists: worker ? await fs.pathExists(node_path.join(outputDirectory, worker)) : false
353
- };
354
- }));
355
- const bffPrefix = modernConfig.bff?.prefix;
356
- const primaryBffPrefix = Array.isArray(bffPrefix) ? bffPrefix[0] : bffPrefix;
357
- const isEffectApi = Boolean(modernConfig.bff) && modernConfig.bff?.runtimeFramework !== 'hono';
358
- const effectApiWorkerExists = await fs.pathExists(node_path.join(outputDirectory, BFF_EFFECT_WORKER_ENTRY));
359
- if (isEffectApi && primaryBffPrefix && !effectApiWorkerExists) throw createMissingEffectBffWorkerError(outputDirectory, BFF_EFFECT_WORKER_ENTRY);
360
- return {
361
- version: 1,
362
- runtime: {
363
- type: 'cloudflare-module-worker',
364
- entry: WORKER_ENTRY,
365
- fetchExport: true,
366
- nodeListen: false
367
- },
368
- assets: {
369
- binding: ASSETS_BINDING,
370
- directory: `./${PUBLIC_ASSETS_DIRECTORY}`,
371
- runWorkerFirst: true
372
- },
373
- routeSpec: {
374
- file: ROUTE_SPEC_OUTPUT,
375
- routes
376
- },
377
- workerBundles: {
378
- directory: WORKER_BUNDLE_DIRECTORY,
379
- format: 'commonjs',
380
- importableFromModuleWorker: true,
381
- requestHandlerExport: 'requestHandler'
382
- },
383
- resources: {
384
- loadableStats: LOADABLE_STATS_FILE,
385
- routeManifest: ROUTE_MANIFEST_FILE
386
- },
387
- security: createCloudflareWorkerSecurityPolicy(modernConfig),
388
- bff: isEffectApi && primaryBffPrefix && effectApiWorkerExists ? {
389
- runtimeFramework: 'effect',
390
- prefix: primaryBffPrefix,
391
- worker: BFF_EFFECT_WORKER_ENTRY
392
- } : void 0
393
- };
394
- };
395
- const createWorkerModuleLoaders = (manifest)=>{
396
- const imports = new Map();
397
- for (const route of manifest.routeSpec.routes)if (route.worker && route.workerExists) {
398
- const importPath = `../${String(route.worker).replace(/^\/+/u, '')}`;
399
- imports.set(route.worker, `() => import(${JSON.stringify(importPath)})`);
400
- }
401
- if (manifest.bff?.worker) {
402
- const importPath = `../${String(manifest.bff.worker).replace(/^\/+/u, '')}`;
403
- imports.set(manifest.bff.worker, `() => import(${JSON.stringify(importPath)})`);
404
- }
405
- if (0 === imports.size) return '{}';
406
- const loaders = [
407
- ...imports.entries()
408
- ].map(([worker, loader])=>`${JSON.stringify(worker)}: ${loader}`);
409
- return `{\n${loaders.join(',\n')}\n}`;
410
- };
411
- const getPublicAssetExcludes = (appDirectory, modernConfig)=>[
412
- ...DEFAULT_SERVER_ONLY_PUBLIC_ASSET_EXCLUDES.filter((directory)=>{
413
- try {
414
- return fs.statSync(node_path.join(appDirectory, directory)).isDirectory();
415
- } catch {
416
- return false;
417
- }
418
- }),
419
- ...modernConfig.deploy?.worker?.publicAssetExcludes ?? []
420
- ].map((entry)=>normalizeRelativePath(entry, 'deploy.worker.publicAssetExcludes'));
421
- const shouldCopyToPublicAssets = (src, distDirectory, publicAssetExcludes)=>{
422
- const relativePath = node_path.relative(distDirectory, src);
423
- if (!relativePath) return true;
424
- const normalizedRelativePath = relativePath.replace(/\\/g, '/');
425
- const [topLevelDirectory] = normalizedRelativePath.split('/');
426
- return normalizedRelativePath !== ROUTE_SPEC_FILE && topLevelDirectory !== WORKER_BUNDLE_DIRECTORY && topLevelDirectory !== SERVER_BUNDLE_DIRECTORY && !publicAssetExcludes.some((exclude)=>normalizedRelativePath === exclude || normalizedRelativePath.startsWith(`${exclude}/`));
427
- };
428
- const shouldCopyToWorkerBundle = (src, workerBundleDirectory)=>{
429
- const relativePath = node_path.relative(workerBundleDirectory, src);
430
- if (!relativePath) return true;
431
- const normalizedRelativePath = relativePath.replace(/\\/g, '/');
432
- const basename = node_path.basename(normalizedRelativePath);
433
- if (basename.startsWith('.') || normalizedRelativePath.includes('/.')) return false;
434
- if (fs.statSync(src).isDirectory()) return true;
435
- return [
436
- '.cjs',
437
- '.js',
438
- '.mjs'
439
- ].includes(node_path.extname(normalizedRelativePath));
440
- };
441
- const createCloudflarePreset = ({ appContext, modernConfig })=>{
442
- const { appDirectory, distDirectory } = appContext;
443
- const outputDirectory = node_path.join(appDirectory, '.output');
444
- const publicDirectory = node_path.join(outputDirectory, PUBLIC_ASSETS_DIRECTORY);
445
- const workerEntryPath = node_path.join(outputDirectory, WORKER_ENTRY);
446
- const workerManifestPath = node_path.join(outputDirectory, WORKER_MANIFEST);
447
- const routeSpecOutputPath = node_path.join(outputDirectory, ROUTE_SPEC_OUTPUT);
448
- const wranglerConfigPath = node_path.join(outputDirectory, WRANGLER_CONFIG_FILE);
449
- const cloudflareArtifacts = getCloudflareArtifacts(modernConfig);
450
- const publicAssetExcludes = getPublicAssetExcludes(appDirectory, modernConfig);
451
- return {
452
- async prepare () {
453
- await fs.remove(outputDirectory);
454
- },
455
- async writeOutput () {
456
- await fs.copy(distDirectory, publicDirectory, {
457
- filter: (src)=>shouldCopyToPublicAssets(src, distDirectory, publicAssetExcludes)
458
- });
459
- await fs.ensureDir(node_path.dirname(workerEntryPath));
460
- await fs.ensureDir(node_path.dirname(workerManifestPath));
461
- const routeSpecSourcePath = node_path.join(distDirectory, ROUTE_SPEC_FILE);
462
- if (await fs.pathExists(routeSpecSourcePath)) await fs.copy(routeSpecSourcePath, routeSpecOutputPath);
463
- const workerBundleSourceDirectory = node_path.join(distDirectory, WORKER_BUNDLE_DIRECTORY);
464
- const workerBundleOutputDirectory = node_path.join(outputDirectory, WORKER_BUNDLE_DIRECTORY);
465
- if (await fs.pathExists(workerBundleSourceDirectory)) {
466
- await fs.copy(workerBundleSourceDirectory, workerBundleOutputDirectory, {
467
- filter: (src)=>shouldCopyToWorkerBundle(src, workerBundleSourceDirectory)
468
- });
469
- await fs.writeJSON(node_path.join(workerBundleOutputDirectory, 'package.json'), {
470
- type: 'commonjs'
471
- });
472
- }
473
- await copyCloudflareArtifacts(appDirectory, outputDirectory, cloudflareArtifacts);
474
- await copyCloudflareD1Migrations(appDirectory, outputDirectory, modernConfig);
475
- await fs.writeJSON(wranglerConfigPath, createWranglerConfig(appDirectory, modernConfig), {
476
- spaces: 2
477
- });
478
- await fs.writeJSON(workerManifestPath, await createWorkerManifest(outputDirectory, modernConfig), {
479
- spaces: 2
480
- });
481
- await fs.writeJSON(node_path.join(outputDirectory, OUTPUT_PACKAGE_FILE), {
482
- type: 'module'
483
- });
484
- },
485
- async genEntry () {
486
- const template = await readTemplate('cloudflare-entry.mjs');
487
- const manifest = await fs.readJSON(workerManifestPath);
488
- await fs.writeFile(workerEntryPath, template.replace('p_workerManifest', JSON.stringify(manifest, null, 2)).replace('p_workerModuleLoaders', createWorkerModuleLoaders(manifest)));
489
- }
490
- };
491
- };
492
- export { createCloudflarePreset };