@bleedingdev/modern-js-app-tools 3.8.2-ultramodern.9 → 3.8.3-ultramodern.2

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 (242) hide show
  1. package/bin/modern-bundle-docs.js +11 -0
  2. package/bin/modern.js +11 -0
  3. package/dist/cjs/builder/generator/getBuilderEnvironments.js +13 -241
  4. package/dist/cjs/builder/generator/index.js +0 -1
  5. package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +37 -9
  6. package/dist/cjs/builder/shared/builderPlugins/index.js +6 -13
  7. package/dist/cjs/builder/shared/bundlerPlugins/index.js +6 -13
  8. package/dist/cjs/builder/shared/lazyCompilation.js +9 -9
  9. package/dist/cjs/bundleDocs.js +1 -1
  10. package/dist/cjs/index.js +59 -60
  11. package/dist/cjs/plugins/analyze/getServerRoutes.js +1 -1
  12. package/dist/cjs/plugins/analyze/isDefaultExportFunction.js +1 -9
  13. package/dist/cjs/plugins/backend-federation/codegen.js +2 -1
  14. package/dist/cjs/plugins/backend-federation/config.js +2 -2
  15. package/dist/cjs/plugins/backend-federation/emit.js +6 -4
  16. package/dist/cjs/plugins/deploy/index.js +4 -4
  17. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +23 -149
  18. package/dist/cjs/plugins/deploy/platforms/templates/netlify-entry.cjs +41 -62
  19. package/dist/cjs/plugins/deploy/platforms/templates/netlify-entry.mjs +41 -63
  20. package/dist/cjs/plugins/deploy/platforms/templates/node-entry.cjs +35 -52
  21. package/dist/cjs/plugins/deploy/platforms/templates/node-entry.mjs +35 -53
  22. package/dist/cjs/plugins/deploy/platforms/templates/vercel-entry.cjs +41 -61
  23. package/dist/cjs/plugins/deploy/platforms/templates/vercel-entry.mjs +40 -61
  24. package/dist/cjs/plugins/ultramodernReleaseEnvelope.js +3 -59
  25. package/dist/cjs/presetUltramodern.js +15 -8
  26. package/dist/cjs/run/index.js +9 -9
  27. package/dist/cjs/utils/env.js +1 -1
  28. package/dist/cjs/utils/register.js +6 -3
  29. package/dist/esm/builder/generator/getBuilderEnvironments.mjs +12 -231
  30. package/dist/esm/builder/generator/index.mjs +1 -2
  31. package/dist/esm/builder/shared/builderPlugins/adapterSSR.mjs +34 -9
  32. package/dist/esm/builder/shared/builderPlugins/index.mjs +0 -1
  33. package/dist/esm/builder/shared/bundlerPlugins/index.mjs +0 -1
  34. package/dist/esm/builder/shared/lazyCompilation.mjs +4 -4
  35. package/dist/esm/bundleDocs.mjs +1 -1
  36. package/dist/esm/index.mjs +3 -3
  37. package/dist/esm/plugins/analyze/getServerRoutes.mjs +1 -1
  38. package/dist/esm/plugins/analyze/isDefaultExportFunction.mjs +1 -9
  39. package/dist/esm/plugins/backend-federation/codegen.mjs +2 -1
  40. package/dist/esm/plugins/backend-federation/config.mjs +1 -1
  41. package/dist/esm/plugins/backend-federation/emit.mjs +5 -3
  42. package/dist/esm/plugins/deploy/index.mjs +1 -1
  43. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +1 -133
  44. package/dist/esm/plugins/deploy/platforms/templates/netlify-entry.cjs +41 -62
  45. package/dist/esm/plugins/deploy/platforms/templates/netlify-entry.mjs +41 -63
  46. package/dist/esm/plugins/deploy/platforms/templates/node-entry.cjs +35 -52
  47. package/dist/esm/plugins/deploy/platforms/templates/node-entry.mjs +35 -53
  48. package/dist/esm/plugins/deploy/platforms/templates/vercel-entry.cjs +41 -61
  49. package/dist/esm/plugins/deploy/platforms/templates/vercel-entry.mjs +40 -61
  50. package/dist/esm/plugins/ultramodernReleaseEnvelope.mjs +3 -49
  51. package/dist/esm/presetUltramodern.mjs +8 -5
  52. package/dist/esm/run/index.mjs +9 -9
  53. package/dist/esm/utils/env.mjs +1 -1
  54. package/dist/esm/utils/register.mjs +6 -3
  55. package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +12 -234
  56. package/dist/esm-node/builder/generator/index.mjs +1 -2
  57. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.mjs +34 -9
  58. package/dist/esm-node/builder/shared/builderPlugins/index.mjs +0 -1
  59. package/dist/esm-node/builder/shared/bundlerPlugins/index.mjs +0 -1
  60. package/dist/esm-node/builder/shared/lazyCompilation.mjs +4 -4
  61. package/dist/esm-node/bundleDocs.mjs +1 -1
  62. package/dist/esm-node/index.mjs +3 -3
  63. package/dist/esm-node/plugins/analyze/getServerRoutes.mjs +1 -1
  64. package/dist/esm-node/plugins/analyze/isDefaultExportFunction.mjs +1 -9
  65. package/dist/esm-node/plugins/backend-federation/codegen.mjs +2 -1
  66. package/dist/esm-node/plugins/backend-federation/config.mjs +1 -1
  67. package/dist/esm-node/plugins/backend-federation/emit.mjs +5 -3
  68. package/dist/esm-node/plugins/deploy/index.mjs +1 -1
  69. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +1 -133
  70. package/dist/esm-node/plugins/deploy/platforms/templates/netlify-entry.cjs +41 -62
  71. package/dist/esm-node/plugins/deploy/platforms/templates/netlify-entry.mjs +41 -63
  72. package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.cjs +35 -52
  73. package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.mjs +35 -53
  74. package/dist/esm-node/plugins/deploy/platforms/templates/vercel-entry.cjs +41 -61
  75. package/dist/esm-node/plugins/deploy/platforms/templates/vercel-entry.mjs +40 -61
  76. package/dist/esm-node/plugins/ultramodernReleaseEnvelope.mjs +3 -49
  77. package/dist/esm-node/presetUltramodern.mjs +8 -5
  78. package/dist/esm-node/run/index.mjs +9 -9
  79. package/dist/esm-node/utils/env.mjs +1 -1
  80. package/dist/esm-node/utils/register.mjs +6 -3
  81. package/dist/types/builder/generator/getBuilderEnvironments.d.ts +0 -29
  82. package/dist/types/builder/shared/builderPlugins/adapterSSR.d.ts +11 -0
  83. package/dist/types/builder/shared/builderPlugins/index.d.ts +0 -1
  84. package/dist/types/builder/shared/bundlerPlugins/index.d.ts +0 -1
  85. package/dist/types/builder/shared/lazyCompilation.d.ts +7 -7
  86. package/dist/types/plugins/analyze/getServerRoutes.d.ts +1 -1
  87. package/dist/types/plugins/backend-federation/codegen.d.ts +4 -1
  88. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/index.d.ts +1 -18
  89. package/dist/types/presetUltramodern.d.ts +23 -2
  90. package/dist/types/types/config/deploy.d.ts +2 -2
  91. package/docs/community/showcase.md +3 -5
  92. package/docs/configure/app/bff/effect.md +7 -7
  93. package/docs/guides/advanced-features/bff/frameworks.md +1 -1
  94. package/docs/guides/basic-features/deploy.md +2 -2
  95. package/docs/guides/get-started/quick-start.md +10 -9
  96. package/docs/guides/get-started/tech-stack.md +1 -1
  97. package/docs/guides/get-started/ultramodern.md +123 -38
  98. package/docs/guides/troubleshooting/cli.md +1 -1
  99. package/docs/llms.txt +2 -2
  100. package/docs/tutorials/examples/csr-auth.md +1 -1
  101. package/package.json +16 -28
  102. package/rslib.config.mts +4 -7
  103. package/dist/cjs/builder/shared/builderPlugins/adapterLazyCompilation.js +0 -74
  104. package/dist/cjs/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.js +0 -72
  105. package/dist/cjs/plugins/deploy/platforms/cloudflare/artifacts.js +0 -127
  106. package/dist/cjs/plugins/deploy/platforms/cloudflare/constants.js +0 -141
  107. package/dist/cjs/plugins/deploy/platforms/cloudflare/delivery-unit.js +0 -139
  108. package/dist/cjs/plugins/deploy/platforms/cloudflare/i18n-worker.js +0 -135
  109. package/dist/cjs/plugins/deploy/platforms/cloudflare/index.js +0 -150
  110. package/dist/cjs/plugins/deploy/platforms/cloudflare/security-policies.js +0 -205
  111. package/dist/cjs/plugins/deploy/platforms/cloudflare/types.js +0 -18
  112. package/dist/cjs/plugins/deploy/platforms/cloudflare/utils.js +0 -66
  113. package/dist/cjs/plugins/deploy/platforms/cloudflare/worker-manifest.js +0 -208
  114. package/dist/cjs/plugins/deploy/platforms/cloudflare/wrangler-config.js +0 -204
  115. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-contract.js +0 -108
  116. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-plan.js +0 -93
  117. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/identity.js +0 -83
  118. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/issues.js +0 -54
  119. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/manifest.js +0 -89
  120. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.js +0 -151
  121. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.js +0 -378
  122. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +0 -251
  123. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -191
  124. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -514
  125. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -1012
  126. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -363
  127. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +0 -93
  128. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +0 -11
  129. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +0 -281
  130. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +0 -14
  131. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +0 -98
  132. package/dist/cjs/types/config/cloudflareDeploy.js +0 -18
  133. package/dist/cjs/ultramodern-release-envelope/canonical.js +0 -68
  134. package/dist/cjs/ultramodern-release-envelope/framework-output.js +0 -649
  135. package/dist/cjs/ultramodern-release-envelope/index.js +0 -399
  136. package/dist/cjs/ultramodern-release-envelope/types.js +0 -51
  137. package/dist/cjs/ultramodern-release-identity.js +0 -110
  138. package/dist/esm/builder/shared/builderPlugins/adapterLazyCompilation.mjs +0 -36
  139. package/dist/esm/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.mjs +0 -30
  140. package/dist/esm/plugins/deploy/platforms/cloudflare/artifacts.mjs +0 -64
  141. package/dist/esm/plugins/deploy/platforms/cloudflare/constants.mjs +0 -34
  142. package/dist/esm/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +0 -88
  143. package/dist/esm/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +0 -97
  144. package/dist/esm/plugins/deploy/platforms/cloudflare/index.mjs +0 -102
  145. package/dist/esm/plugins/deploy/platforms/cloudflare/security-policies.mjs +0 -167
  146. package/dist/esm/plugins/deploy/platforms/cloudflare/types.mjs +0 -0
  147. package/dist/esm/plugins/deploy/platforms/cloudflare/utils.mjs +0 -12
  148. package/dist/esm/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +0 -148
  149. package/dist/esm/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +0 -150
  150. package/dist/esm/plugins/deploy/platforms/cloudflare-output-contract.mjs +0 -31
  151. package/dist/esm/plugins/deploy/platforms/cloudflare-output-plan.mjs +0 -45
  152. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +0 -45
  153. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +0 -10
  154. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +0 -51
  155. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +0 -99
  156. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +0 -313
  157. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +0 -251
  158. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -191
  159. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -514
  160. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -1012
  161. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -363
  162. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +0 -93
  163. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +0 -11
  164. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +0 -281
  165. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +0 -14
  166. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +0 -98
  167. package/dist/esm/types/config/cloudflareDeploy.mjs +0 -0
  168. package/dist/esm/ultramodern-release-envelope/canonical.mjs +0 -21
  169. package/dist/esm/ultramodern-release-envelope/framework-output.mjs +0 -573
  170. package/dist/esm/ultramodern-release-envelope/index.mjs +0 -335
  171. package/dist/esm/ultramodern-release-envelope/types.mjs +0 -7
  172. package/dist/esm/ultramodern-release-identity.mjs +0 -66
  173. package/dist/esm-node/builder/shared/builderPlugins/adapterLazyCompilation.mjs +0 -37
  174. package/dist/esm-node/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.mjs +0 -31
  175. package/dist/esm-node/plugins/deploy/platforms/cloudflare/artifacts.mjs +0 -65
  176. package/dist/esm-node/plugins/deploy/platforms/cloudflare/constants.mjs +0 -35
  177. package/dist/esm-node/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +0 -89
  178. package/dist/esm-node/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +0 -98
  179. package/dist/esm-node/plugins/deploy/platforms/cloudflare/index.mjs +0 -103
  180. package/dist/esm-node/plugins/deploy/platforms/cloudflare/security-policies.mjs +0 -168
  181. package/dist/esm-node/plugins/deploy/platforms/cloudflare/types.mjs +0 -1
  182. package/dist/esm-node/plugins/deploy/platforms/cloudflare/utils.mjs +0 -13
  183. package/dist/esm-node/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +0 -149
  184. package/dist/esm-node/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +0 -151
  185. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-contract.mjs +0 -32
  186. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-plan.mjs +0 -46
  187. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +0 -46
  188. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +0 -11
  189. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +0 -52
  190. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +0 -100
  191. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +0 -314
  192. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +0 -251
  193. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -191
  194. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -514
  195. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -1012
  196. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -363
  197. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +0 -93
  198. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +0 -11
  199. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +0 -281
  200. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +0 -14
  201. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +0 -98
  202. package/dist/esm-node/types/config/cloudflareDeploy.mjs +0 -1
  203. package/dist/esm-node/ultramodern-release-envelope/canonical.mjs +0 -22
  204. package/dist/esm-node/ultramodern-release-envelope/framework-output.mjs +0 -574
  205. package/dist/esm-node/ultramodern-release-envelope/index.mjs +0 -336
  206. package/dist/esm-node/ultramodern-release-envelope/types.mjs +0 -8
  207. package/dist/esm-node/ultramodern-release-identity.mjs +0 -67
  208. package/dist/types/builder/shared/builderPlugins/adapterLazyCompilation.d.ts +0 -3
  209. package/dist/types/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.d.ts +0 -6
  210. package/dist/types/plugins/deploy/platforms/cloudflare/artifacts.d.ts +0 -15
  211. package/dist/types/plugins/deploy/platforms/cloudflare/constants.d.ts +0 -24
  212. package/dist/types/plugins/deploy/platforms/cloudflare/delivery-unit.d.ts +0 -23
  213. package/dist/types/plugins/deploy/platforms/cloudflare/i18n-worker.d.ts +0 -22
  214. package/dist/types/plugins/deploy/platforms/cloudflare/index.d.ts +0 -2
  215. package/dist/types/plugins/deploy/platforms/cloudflare/security-policies.d.ts +0 -51
  216. package/dist/types/plugins/deploy/platforms/cloudflare/types.d.ts +0 -5
  217. package/dist/types/plugins/deploy/platforms/cloudflare/utils.d.ts +0 -6
  218. package/dist/types/plugins/deploy/platforms/cloudflare/worker-manifest.d.ts +0 -122
  219. package/dist/types/plugins/deploy/platforms/cloudflare/wrangler-config.d.ts +0 -46
  220. package/dist/types/plugins/deploy/platforms/cloudflare-output-contract.d.ts +0 -14
  221. package/dist/types/plugins/deploy/platforms/cloudflare-output-plan.d.ts +0 -34
  222. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/identity.d.ts +0 -4
  223. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/issues.d.ts +0 -14
  224. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/manifest.d.ts +0 -2
  225. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.d.ts +0 -14
  226. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.d.ts +0 -20
  227. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.d.mts +0 -1
  228. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.d.mts +0 -1
  229. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.d.mts +0 -1
  230. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.d.mts +0 -1
  231. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.d.mts +0 -1
  232. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.d.mts +0 -4
  233. package/dist/types/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.d.mts +0 -5
  234. package/dist/types/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.d.mts +0 -48
  235. package/dist/types/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.d.mts +0 -13
  236. package/dist/types/plugins/deploy/platforms/templates/cloudflare-worker-path.d.mts +0 -21
  237. package/dist/types/types/config/cloudflareDeploy.d.ts +0 -161
  238. package/dist/types/ultramodern-release-envelope/canonical.d.ts +0 -5
  239. package/dist/types/ultramodern-release-envelope/framework-output.d.ts +0 -32
  240. package/dist/types/ultramodern-release-envelope/index.d.ts +0 -6
  241. package/dist/types/ultramodern-release-envelope/types.d.ts +0 -62
  242. package/dist/types/ultramodern-release-identity.d.ts +0 -16
@@ -1,134 +1,2 @@
1
1
  import "node:module";
2
- import promises from "node:fs/promises";
3
- import node_path from "node:path";
4
- import { createCloudflareOutputPlan } from "../cloudflare-output-plan.mjs";
5
- import { verifyDeliveryUnitIdentity } from "./identity.mjs";
6
- import { addIssue, assertEqual, assertFlag } from "./issues.mjs";
7
- import { verifyManifestShape } from "./manifest.mjs";
8
- import { getEffectBffWorker, getWorkerBundleReferences, missingWorkerBundleMessage, resolveWorkerBundleReference, verifyWorkerBundleReferences, verifyWorkerImport } from "./worker-bundles.mjs";
9
- const pathExists = async (filePath)=>{
10
- try {
11
- await promises.access(filePath);
12
- return true;
13
- } catch {
14
- return false;
15
- }
16
- };
17
- const readJson = async (filePath)=>JSON.parse(await promises.readFile(filePath, 'utf-8'));
18
- const verifyCloudflareOutput = async (options)=>{
19
- const outputDirectory = node_path.resolve(options.outputDirectory);
20
- const issues = [];
21
- const outputPlan = createCloudflareOutputPlan(outputDirectory);
22
- for (const relativePath of outputPlan.requiredFiles){
23
- const filePath = node_path.join(outputDirectory, relativePath);
24
- if (!await pathExists(filePath)) addIssue(issues, {
25
- code: 'missing-file',
26
- message: `Cloudflare output is missing ${relativePath}.`,
27
- path: filePath
28
- });
29
- }
30
- const manifestPath = outputPlan.paths.workerManifest;
31
- const wranglerPath = outputPlan.paths.wranglerConfig;
32
- const packagePath = outputPlan.paths.outputPackage;
33
- const workerPackagePath = outputPlan.paths.workerPackage;
34
- const manifest = await pathExists(manifestPath) ? await readJson(manifestPath) : void 0;
35
- const wrangler = await pathExists(wranglerPath) ? await readJson(wranglerPath) : void 0;
36
- const outputPackage = await pathExists(packagePath) ? await readJson(packagePath) : void 0;
37
- const workerPackage = await pathExists(workerPackagePath) ? await readJson(workerPackagePath) : void 0;
38
- if (manifest) {
39
- verifyManifestShape(issues, manifest, manifestPath);
40
- verifyDeliveryUnitIdentity(issues, manifest, manifestPath, options.deliveryUnit);
41
- const workerReferences = getWorkerBundleReferences(manifest);
42
- const providedWorkerPackages = new Set(workerPackage?.dependencies && 'object' == typeof workerPackage.dependencies ? Object.keys(workerPackage.dependencies) : []);
43
- if (workerReferences.length > 0 && !await pathExists(workerPackagePath)) addIssue(issues, {
44
- code: 'missing-file',
45
- message: 'Cloudflare output is missing worker/package.json for referenced worker bundles.',
46
- path: workerPackagePath
47
- });
48
- if (manifest.bff?.runtimeFramework === 'effect' && !getEffectBffWorker(manifest)) addIssue(issues, {
49
- code: 'missing-worker-bundle',
50
- message: 'Cloudflare Effect BFF manifest points to a missing worker bundle.'
51
- });
52
- for (const workerReference of workerReferences){
53
- const resolvedWorker = resolveWorkerBundleReference(issues, outputDirectory, workerReference, manifestPath);
54
- if (!resolvedWorker) continue;
55
- const workerExists = await pathExists(resolvedWorker.path);
56
- if (!workerExists) addIssue(issues, {
57
- code: 'missing-worker-bundle',
58
- message: missingWorkerBundleMessage(workerReference),
59
- path: resolvedWorker.path
60
- });
61
- if (workerExists) {
62
- const workerSource = await promises.readFile(resolvedWorker.path, 'utf-8');
63
- await verifyWorkerBundleReferences(issues, resolvedWorker, workerSource, {
64
- providedPackages: providedWorkerPackages,
65
- workerRoot: outputPlan.paths.workerBundle
66
- });
67
- if ('effect-bff' === resolvedWorker.kind && (workerSource.includes(';entityKind;') || workerSource.includes(';entityKind,entityKind;'))) addIssue(issues, {
68
- code: 'invalid-worker-bundle',
69
- message: 'Cloudflare Effect BFF worker bundle contains invalid Drizzle entityKind marker references.',
70
- path: resolvedWorker.path
71
- });
72
- }
73
- }
74
- }
75
- if (wrangler) {
76
- assertEqual(issues, wrangler.main, outputPlan.wrangler.main, {
77
- code: 'invalid-wrangler',
78
- message: `wrangler.json main must be ${outputPlan.wrangler.main}.`,
79
- path: wranglerPath
80
- });
81
- assertEqual(issues, wrangler.assets?.binding, outputPlan.wrangler.assets.binding, {
82
- code: 'invalid-wrangler',
83
- message: 'wrangler.json assets.binding must be ASSETS.',
84
- path: wranglerPath
85
- });
86
- assertEqual(issues, wrangler.assets?.directory, outputPlan.wrangler.assets.directory, {
87
- code: 'invalid-wrangler',
88
- message: 'wrangler.json assets.directory must be ./public.',
89
- path: wranglerPath
90
- });
91
- assertEqual(issues, wrangler.assets?.run_worker_first, outputPlan.wrangler.assets.run_worker_first, {
92
- code: 'invalid-wrangler',
93
- message: 'wrangler.json assets.run_worker_first must be true.',
94
- path: wranglerPath
95
- });
96
- for (const flag of outputPlan.wrangler.requiredCompatibilityFlags)assertFlag(issues, wrangler.compatibility_flags, flag, {
97
- code: 'invalid-wrangler',
98
- message: `wrangler.json compatibility_flags must include ${flag}.`,
99
- path: wranglerPath
100
- });
101
- }
102
- if (outputPackage) assertEqual(issues, outputPackage.type, outputPlan.packages.output.type, {
103
- code: 'invalid-package',
104
- message: '.output/package.json must declare type module.',
105
- path: packagePath
106
- });
107
- if (workerPackage) assertEqual(issues, workerPackage.type, outputPlan.packages.worker.type, {
108
- code: 'invalid-package',
109
- message: '.output/worker/package.json must declare type commonjs.',
110
- path: workerPackagePath
111
- });
112
- for (const leakedPath of outputPlan.publicLeakDirectories){
113
- const publicPath = node_path.join(outputPlan.paths.publicAssets, leakedPath);
114
- if (await pathExists(publicPath)) addIssue(issues, {
115
- code: 'public-output-leak',
116
- message: `Framework-owned ${leakedPath} output leaked into public assets.`,
117
- path: publicPath
118
- });
119
- }
120
- if (false !== options.importWorker && await pathExists(outputPlan.paths.workerEntry)) await verifyWorkerImport(issues, outputPlan.paths.workerEntry, manifest);
121
- return {
122
- ok: 0 === issues.length,
123
- issues
124
- };
125
- };
126
- const assertCloudflareOutput = async (options)=>{
127
- const result = await verifyCloudflareOutput(options);
128
- if (!result.ok) throw new Error([
129
- 'Cloudflare output verification failed:',
130
- ...result.issues.map((issue)=>`- ${issue.code}: ${issue.message}${issue.path ? ` (${issue.path})` : ''}`)
131
- ].join('\n'));
132
- };
133
- export { verifyCloudflareOutputMutationPolicy } from "./mutation-policy.mjs";
134
- export { assertCloudflareOutput, verifyCloudflareOutput };
2
+ export * from "@modern-js/app-tools-extensions/cloudflare-output-verifier";
@@ -1,78 +1,57 @@
1
1
  const fs = require('node:fs/promises');
2
2
  const path = require('node:path');
3
3
  const { createNetlifyFunction } = require('@modern-js/prod-server/netlify');
4
-
5
4
  p_genPluginImportsCode;
6
-
7
- if (!process.env.NODE_ENV) {
8
- process.env.NODE_ENV = 'production';
9
- }
10
-
5
+ if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production';
11
6
  let requestHandler = null;
12
7
  let handlerCreationPromise = null;
13
-
14
8
  async function loadRoutes(routeFilepath) {
15
- try {
16
- await fs.access(routeFilepath);
17
- const content = await fs.readFile(routeFilepath, 'utf-8');
18
- const routeSpec = JSON.parse(content);
19
- return routeSpec.routes || [];
20
- } catch (error) {
21
- console.warn(
22
- 'route.json not found or invalid, continuing with empty routes.',
23
- );
24
- return [];
25
- }
9
+ try {
10
+ await fs.access(routeFilepath);
11
+ const content = await fs.readFile(routeFilepath, 'utf-8');
12
+ const routeSpec = JSON.parse(content);
13
+ return routeSpec.routes || [];
14
+ } catch (error) {
15
+ console.warn('route.json not found or invalid, continuing with empty routes.');
16
+ return [];
17
+ }
26
18
  }
27
-
28
19
  async function initServer() {
29
- const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
30
- const routes = await loadRoutes(routeFilepath);
31
-
32
- const dynamicProdOptions = p_dynamicProdOptions;
33
-
34
- const prodServerOptions = {
35
- pwd: __dirname,
36
- routes,
37
- disableCustomHook: true,
38
- appContext: {
39
- sharedDirectory: p_sharedDirectory,
40
- apiDirectory: p_apiDirectory,
41
- lambdaDirectory: p_lambdaDirectory,
42
- bffRuntimeFramework: p_bffRuntimeFramework,
43
- },
44
- plugins: p_plugins,
45
- serverConfigPath: p_serverDirectory,
46
- ...dynamicProdOptions,
47
- };
48
-
49
- const requestHandler = await createNetlifyFunction(prodServerOptions);
50
-
51
- return requestHandler;
20
+ const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
21
+ const routes = await loadRoutes(routeFilepath);
22
+ const dynamicProdOptions = p_dynamicProdOptions;
23
+ const prodServerOptions = {
24
+ pwd: __dirname,
25
+ routes,
26
+ disableCustomHook: true,
27
+ appContext: {
28
+ sharedDirectory: p_sharedDirectory,
29
+ apiDirectory: p_apiDirectory,
30
+ lambdaDirectory: p_lambdaDirectory,
31
+ bffRuntimeFramework: p_bffRuntimeFramework
32
+ },
33
+ plugins: p_plugins,
34
+ serverConfigPath: p_serverDirectory,
35
+ ...dynamicProdOptions
36
+ };
37
+ const requestHandler = await createNetlifyFunction(prodServerOptions);
38
+ return requestHandler;
52
39
  }
53
-
54
40
  async function createHandler() {
55
- if (!handlerCreationPromise) {
56
- handlerCreationPromise = (async () => {
57
- try {
58
- requestHandler = await initServer();
59
- } catch (error) {
60
- console.error('Error creating server:', error);
61
- process.exit(1);
62
- }
41
+ if (!handlerCreationPromise) handlerCreationPromise = (async ()=>{
42
+ try {
43
+ requestHandler = await initServer();
44
+ } catch (error) {
45
+ console.error('Error creating server:', error);
46
+ process.exit(1);
47
+ }
63
48
  })();
64
- }
65
- await handlerCreationPromise;
66
- return requestHandler;
49
+ await handlerCreationPromise;
50
+ return requestHandler;
67
51
  }
68
-
69
52
  createHandler();
70
-
71
- const handler = async (request, context) => {
72
- if (!requestHandler) {
73
- await createHandler();
74
- }
75
- return requestHandler(request, context);
53
+ const handler = async (request, context)=>{
54
+ if (!requestHandler) await createHandler();
55
+ return requestHandler(request, context);
76
56
  };
77
-
78
57
  module.exports.default = handler;
@@ -2,80 +2,58 @@ import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import { createNetlifyFunction } from '@modern-js/prod-server/netlify';
5
-
6
5
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
-
8
6
  p_genPluginImportsCode;
9
-
10
- if (!process.env.NODE_ENV) {
11
- process.env.NODE_ENV = 'production';
12
- }
13
-
7
+ if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production';
14
8
  let requestHandler = null;
15
9
  let handlerCreationPromise = null;
16
-
17
10
  async function loadRoutes(routeFilepath) {
18
- try {
19
- await fs.access(routeFilepath);
20
- const content = await fs.readFile(routeFilepath, 'utf-8');
21
- const routeSpec = JSON.parse(content);
22
- return routeSpec.routes || [];
23
- } catch (error) {
24
- console.warn(
25
- 'route.json not found or invalid, continuing with empty routes.',
26
- );
27
- return [];
28
- }
11
+ try {
12
+ await fs.access(routeFilepath);
13
+ const content = await fs.readFile(routeFilepath, 'utf-8');
14
+ const routeSpec = JSON.parse(content);
15
+ return routeSpec.routes || [];
16
+ } catch (error) {
17
+ console.warn('route.json not found or invalid, continuing with empty routes.');
18
+ return [];
19
+ }
29
20
  }
30
-
31
21
  async function initServer() {
32
- const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
33
- const routes = await loadRoutes(routeFilepath);
34
-
35
- const dynamicProdOptions = p_dynamicProdOptions;
36
-
37
- const prodServerOptions = {
38
- pwd: __dirname,
39
- routes,
40
- disableCustomHook: true,
41
- appContext: {
42
- sharedDirectory: p_sharedDirectory,
43
- apiDirectory: p_apiDirectory,
44
- lambdaDirectory: p_lambdaDirectory,
45
- bffRuntimeFramework: p_bffRuntimeFramework,
46
- },
47
- plugins: p_plugins,
48
- serverConfigPath: p_serverDirectory,
49
- ...dynamicProdOptions,
50
- };
51
-
52
- const requestHandler = await createNetlifyFunction(prodServerOptions);
53
-
54
- return requestHandler;
22
+ const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
23
+ const routes = await loadRoutes(routeFilepath);
24
+ const dynamicProdOptions = p_dynamicProdOptions;
25
+ const prodServerOptions = {
26
+ pwd: __dirname,
27
+ routes,
28
+ disableCustomHook: true,
29
+ appContext: {
30
+ sharedDirectory: p_sharedDirectory,
31
+ apiDirectory: p_apiDirectory,
32
+ lambdaDirectory: p_lambdaDirectory,
33
+ bffRuntimeFramework: p_bffRuntimeFramework
34
+ },
35
+ plugins: p_plugins,
36
+ serverConfigPath: p_serverDirectory,
37
+ ...dynamicProdOptions
38
+ };
39
+ const requestHandler = await createNetlifyFunction(prodServerOptions);
40
+ return requestHandler;
55
41
  }
56
-
57
42
  async function createHandler() {
58
- if (!handlerCreationPromise) {
59
- handlerCreationPromise = (async () => {
60
- try {
61
- requestHandler = await initServer();
62
- } catch (error) {
63
- console.error('Error creating server:', error);
64
- process.exit(1);
65
- }
43
+ if (!handlerCreationPromise) handlerCreationPromise = (async ()=>{
44
+ try {
45
+ requestHandler = await initServer();
46
+ } catch (error) {
47
+ console.error('Error creating server:', error);
48
+ process.exit(1);
49
+ }
66
50
  })();
67
- }
68
- await handlerCreationPromise;
69
- return requestHandler;
51
+ await handlerCreationPromise;
52
+ return requestHandler;
70
53
  }
71
-
72
54
  createHandler();
73
-
74
- const handler = async (request, context) => {
75
- if (!requestHandler) {
76
- await createHandler();
77
- }
78
- return requestHandler(request, context);
55
+ const handler = async (request, context)=>{
56
+ if (!requestHandler) await createHandler();
57
+ return requestHandler(request, context);
79
58
  };
80
-
81
59
  export default handler;
@@ -1,61 +1,44 @@
1
1
  const fs = require('node:fs/promises');
2
2
  const path = require('node:path');
3
3
  const { createProdServer } = require('@modern-js/prod-server');
4
-
5
4
  p_genPluginImportsCode;
6
-
7
- if (!process.env.NODE_ENV) {
8
- process.env.NODE_ENV = 'production';
9
- }
10
-
5
+ if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production';
11
6
  async function loadRoutes(routeFilepath) {
12
- try {
13
- await fs.access(routeFilepath);
14
- const content = await fs.readFile(routeFilepath, 'utf-8');
15
- const routeSpec = JSON.parse(content);
16
- return routeSpec.routes || [];
17
- } catch (error) {
18
- console.warn(
19
- 'route.json not found or invalid, continuing with empty routes.',
20
- );
21
- return [];
22
- }
7
+ try {
8
+ await fs.access(routeFilepath);
9
+ const content = await fs.readFile(routeFilepath, 'utf-8');
10
+ const routeSpec = JSON.parse(content);
11
+ return routeSpec.routes || [];
12
+ } catch (error) {
13
+ console.warn('route.json not found or invalid, continuing with empty routes.');
14
+ return [];
15
+ }
23
16
  }
24
-
25
17
  async function main() {
26
- const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
27
- const routes = await loadRoutes(routeFilepath);
28
-
29
- const dynamicProdOptions = p_dynamicProdOptions;
30
- const prodServerOptions = {
31
- pwd: __dirname,
32
- routes,
33
- disableCustomHook: true,
34
- appContext: {
35
- sharedDirectory: p_sharedDirectory,
36
- apiDirectory: p_apiDirectory,
37
- lambdaDirectory: p_lambdaDirectory,
38
- bffRuntimeFramework: p_bffRuntimeFramework,
39
- },
40
- plugins: p_plugins,
41
- serverConfigPath: p_serverDirectory,
42
- ...dynamicProdOptions,
43
- };
44
-
45
- const app = await createProdServer(prodServerOptions);
46
- const port = process.env.PORT || 8080;
47
- app.listen(
48
- {
49
- host: '::',
50
- port,
51
- },
52
- () => {
53
- console.log(
54
- `\x1b[32mServer is listening on http://[::]:${port}`,
55
- '\x1b[0m',
56
- );
57
- },
58
- );
18
+ const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
19
+ const routes = await loadRoutes(routeFilepath);
20
+ const dynamicProdOptions = p_dynamicProdOptions;
21
+ const prodServerOptions = {
22
+ pwd: __dirname,
23
+ routes,
24
+ disableCustomHook: true,
25
+ appContext: {
26
+ sharedDirectory: p_sharedDirectory,
27
+ apiDirectory: p_apiDirectory,
28
+ lambdaDirectory: p_lambdaDirectory,
29
+ bffRuntimeFramework: p_bffRuntimeFramework
30
+ },
31
+ plugins: p_plugins,
32
+ serverConfigPath: p_serverDirectory,
33
+ ...dynamicProdOptions
34
+ };
35
+ const app = await createProdServer(prodServerOptions);
36
+ const port = process.env.PORT || 8080;
37
+ app.listen({
38
+ host: '::',
39
+ port
40
+ }, ()=>{
41
+ console.log(`\x1b[32mServer is listening on http://[::]:${port}`, '\x1b[0m');
42
+ });
59
43
  }
60
-
61
44
  main();
@@ -2,63 +2,45 @@ import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import { createProdServer } from '@modern-js/prod-server';
5
-
6
5
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
-
8
6
  p_genPluginImportsCode;
9
-
10
- if (!process.env.NODE_ENV) {
11
- process.env.NODE_ENV = 'production';
12
- }
13
-
7
+ if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production';
14
8
  async function loadRoutes(routeFilepath) {
15
- try {
16
- await fs.access(routeFilepath);
17
- const content = await fs.readFile(routeFilepath, 'utf-8');
18
- const routeSpec = JSON.parse(content);
19
- return routeSpec.routes || [];
20
- } catch (error) {
21
- console.warn(
22
- 'route.json not found or invalid, continuing with empty routes.',
23
- );
24
- return [];
25
- }
9
+ try {
10
+ await fs.access(routeFilepath);
11
+ const content = await fs.readFile(routeFilepath, 'utf-8');
12
+ const routeSpec = JSON.parse(content);
13
+ return routeSpec.routes || [];
14
+ } catch (error) {
15
+ console.warn('route.json not found or invalid, continuing with empty routes.');
16
+ return [];
17
+ }
26
18
  }
27
-
28
19
  async function main() {
29
- const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
30
- const routes = await loadRoutes(routeFilepath);
31
-
32
- const dynamicProdOptions = p_dynamicProdOptions;
33
- const prodServerOptions = {
34
- pwd: __dirname,
35
- routes,
36
- disableCustomHook: true,
37
- appContext: {
38
- sharedDirectory: p_sharedDirectory,
39
- apiDirectory: p_apiDirectory,
40
- lambdaDirectory: p_lambdaDirectory,
41
- bffRuntimeFramework: p_bffRuntimeFramework,
42
- },
43
- plugins: p_plugins,
44
- serverConfigPath: p_serverDirectory,
45
- ...dynamicProdOptions,
46
- };
47
-
48
- const app = await createProdServer(prodServerOptions);
49
- const port = process.env.PORT || 8080;
50
- app.listen(
51
- {
52
- host: '::',
53
- port,
54
- },
55
- () => {
56
- console.log(
57
- `\x1b[32mServer is listening on http://[::]:${port}`,
58
- '\x1b[0m',
59
- );
60
- },
61
- );
20
+ const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
21
+ const routes = await loadRoutes(routeFilepath);
22
+ const dynamicProdOptions = p_dynamicProdOptions;
23
+ const prodServerOptions = {
24
+ pwd: __dirname,
25
+ routes,
26
+ disableCustomHook: true,
27
+ appContext: {
28
+ sharedDirectory: p_sharedDirectory,
29
+ apiDirectory: p_apiDirectory,
30
+ lambdaDirectory: p_lambdaDirectory,
31
+ bffRuntimeFramework: p_bffRuntimeFramework
32
+ },
33
+ plugins: p_plugins,
34
+ serverConfigPath: p_serverDirectory,
35
+ ...dynamicProdOptions
36
+ };
37
+ const app = await createProdServer(prodServerOptions);
38
+ const port = process.env.PORT || 8080;
39
+ app.listen({
40
+ host: '::',
41
+ port
42
+ }, ()=>{
43
+ console.log(`\x1b[32mServer is listening on http://[::]:${port}`, '\x1b[0m');
44
+ });
62
45
  }
63
-
64
46
  main();