@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.30 → 3.5.0-ultramodern.31

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 (116) hide show
  1. package/dist/cjs/plugins/backend-federation/codegen.js +208 -0
  2. package/dist/cjs/plugins/backend-federation/config.js +217 -0
  3. package/dist/cjs/plugins/backend-federation/emit.js +139 -0
  4. package/dist/cjs/plugins/backendFederationBuild.js +4 -298
  5. package/dist/cjs/plugins/deploy/platforms/cloudflare/artifacts.js +127 -0
  6. package/dist/cjs/plugins/deploy/platforms/cloudflare/constants.js +137 -0
  7. package/dist/cjs/plugins/deploy/platforms/cloudflare/delivery-unit.js +118 -0
  8. package/dist/cjs/plugins/deploy/platforms/cloudflare/i18n-worker.js +135 -0
  9. package/dist/cjs/plugins/deploy/platforms/cloudflare/index.js +126 -0
  10. package/dist/cjs/plugins/deploy/platforms/cloudflare/security-policies.js +223 -0
  11. package/dist/cjs/plugins/deploy/platforms/cloudflare/types.js +18 -0
  12. package/dist/cjs/plugins/deploy/platforms/cloudflare/utils.js +66 -0
  13. package/dist/cjs/plugins/deploy/platforms/cloudflare/worker-manifest.js +178 -0
  14. package/dist/cjs/plugins/deploy/platforms/cloudflare/wrangler-config.js +189 -0
  15. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/identity.js +83 -0
  16. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +184 -0
  17. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/issues.js +54 -0
  18. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/manifest.js +83 -0
  19. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.js +158 -0
  20. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.js +137 -0
  21. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier.js +23 -363
  22. package/dist/cjs/plugins/deploy/platforms/cloudflare.js +2 -745
  23. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +22 -0
  24. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -0
  25. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -0
  26. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -0
  27. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -0
  28. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +32 -0
  29. package/dist/esm/plugins/backend-federation/codegen.mjs +157 -0
  30. package/dist/esm/plugins/backend-federation/config.mjs +141 -0
  31. package/dist/esm/plugins/backend-federation/emit.mjs +88 -0
  32. package/dist/esm/plugins/backendFederationBuild.mjs +1 -296
  33. package/dist/esm/plugins/deploy/platforms/cloudflare/artifacts.mjs +64 -0
  34. package/dist/esm/plugins/deploy/platforms/cloudflare/constants.mjs +33 -0
  35. package/dist/esm/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +67 -0
  36. package/dist/esm/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +97 -0
  37. package/dist/esm/plugins/deploy/platforms/cloudflare/index.mjs +78 -0
  38. package/dist/esm/plugins/deploy/platforms/cloudflare/security-policies.mjs +167 -0
  39. package/dist/esm/plugins/deploy/platforms/cloudflare/types.mjs +0 -0
  40. package/dist/esm/plugins/deploy/platforms/cloudflare/utils.mjs +12 -0
  41. package/dist/esm/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +118 -0
  42. package/dist/esm/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +135 -0
  43. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +45 -0
  44. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +129 -0
  45. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +10 -0
  46. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +45 -0
  47. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +97 -0
  48. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +68 -0
  49. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier.mjs +1 -347
  50. package/dist/esm/plugins/deploy/platforms/cloudflare.mjs +1 -735
  51. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +22 -0
  52. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -0
  53. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -0
  54. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -0
  55. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -0
  56. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +32 -0
  57. package/dist/esm-node/plugins/backend-federation/codegen.mjs +158 -0
  58. package/dist/esm-node/plugins/backend-federation/config.mjs +142 -0
  59. package/dist/esm-node/plugins/backend-federation/emit.mjs +89 -0
  60. package/dist/esm-node/plugins/backendFederationBuild.mjs +1 -296
  61. package/dist/esm-node/plugins/deploy/platforms/cloudflare/artifacts.mjs +65 -0
  62. package/dist/esm-node/plugins/deploy/platforms/cloudflare/constants.mjs +34 -0
  63. package/dist/esm-node/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +68 -0
  64. package/dist/esm-node/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +98 -0
  65. package/dist/esm-node/plugins/deploy/platforms/cloudflare/index.mjs +79 -0
  66. package/dist/esm-node/plugins/deploy/platforms/cloudflare/security-policies.mjs +168 -0
  67. package/dist/esm-node/plugins/deploy/platforms/cloudflare/types.mjs +1 -0
  68. package/dist/esm-node/plugins/deploy/platforms/cloudflare/utils.mjs +13 -0
  69. package/dist/esm-node/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +119 -0
  70. package/dist/esm-node/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +136 -0
  71. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +46 -0
  72. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +130 -0
  73. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +11 -0
  74. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +46 -0
  75. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +98 -0
  76. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +69 -0
  77. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier.mjs +1 -347
  78. package/dist/esm-node/plugins/deploy/platforms/cloudflare.mjs +1 -735
  79. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +22 -0
  80. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -0
  81. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -0
  82. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -0
  83. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -0
  84. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +32 -0
  85. package/dist/types/plugins/backend-federation/codegen.d.ts +82 -0
  86. package/dist/types/plugins/backend-federation/config.d.ts +103 -0
  87. package/dist/types/plugins/backend-federation/emit.d.ts +13 -0
  88. package/dist/types/plugins/backendFederationBuild.d.ts +2 -11
  89. package/dist/types/plugins/deploy/platforms/cloudflare/artifacts.d.ts +15 -0
  90. package/dist/types/plugins/deploy/platforms/cloudflare/constants.d.ts +23 -0
  91. package/dist/types/plugins/deploy/platforms/cloudflare/delivery-unit.d.ts +23 -0
  92. package/dist/types/plugins/deploy/platforms/cloudflare/i18n-worker.d.ts +21 -0
  93. package/dist/types/plugins/deploy/platforms/cloudflare/index.d.ts +2 -0
  94. package/dist/types/plugins/deploy/platforms/cloudflare/security-policies.d.ts +88 -0
  95. package/dist/types/plugins/deploy/platforms/cloudflare/types.d.ts +5 -0
  96. package/dist/types/plugins/deploy/platforms/cloudflare/utils.d.ts +6 -0
  97. package/dist/types/plugins/deploy/platforms/cloudflare/worker-manifest.d.ts +100 -0
  98. package/dist/types/plugins/deploy/platforms/cloudflare/wrangler-config.d.ts +39 -0
  99. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/identity.d.ts +4 -0
  100. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/index.d.ts +18 -0
  101. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/issues.d.ts +14 -0
  102. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/manifest.d.ts +2 -0
  103. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.d.ts +13 -0
  104. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.d.ts +16 -0
  105. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier.d.ts +1 -32
  106. package/dist/types/plugins/deploy/platforms/cloudflare.d.ts +1 -2
  107. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.d.mts +1 -0
  108. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.d.mts +1 -0
  109. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.d.mts +1 -0
  110. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.d.mts +1 -0
  111. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.d.mts +1 -0
  112. package/package.json +11 -11
  113. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -879
  114. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -879
  115. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -879
  116. /package/dist/types/plugins/deploy/platforms/templates/{cloudflare-entry.d.mts → cloudflare-entry.006-fetch-handler.d.mts} +0 -0
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, getters, values)=>{
14
+ var define = (defs, kind)=>{
15
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
16
+ enumerable: true,
17
+ [kind]: defs[key]
18
+ });
19
+ };
20
+ define(getters, "get");
21
+ define(values, "value");
22
+ };
23
+ })();
24
+ (()=>{
25
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
26
+ })();
27
+ (()=>{
28
+ __webpack_require__.r = (exports1)=>{
29
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
30
+ value: 'Module'
31
+ });
32
+ Object.defineProperty(exports1, '__esModule', {
33
+ value: true
34
+ });
35
+ };
36
+ })();
37
+ var __webpack_exports__ = {};
38
+ __webpack_require__.r(__webpack_exports__);
39
+ __webpack_require__.d(__webpack_exports__, {
40
+ assertCloudflareOutput: ()=>assertCloudflareOutput,
41
+ verifyCloudflareOutput: ()=>verifyCloudflareOutput,
42
+ verifyCloudflareOutputMutationPolicy: ()=>external_mutation_policy_js_namespaceObject.verifyCloudflareOutputMutationPolicy
43
+ });
44
+ const promises_namespaceObject = require("node:fs/promises");
45
+ var promises_default = /*#__PURE__*/ __webpack_require__.n(promises_namespaceObject);
46
+ const external_node_path_namespaceObject = require("node:path");
47
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
48
+ const external_cloudflare_output_plan_js_namespaceObject = require("../cloudflare-output-plan.js");
49
+ const external_identity_js_namespaceObject = require("./identity.js");
50
+ const external_issues_js_namespaceObject = require("./issues.js");
51
+ const external_manifest_js_namespaceObject = require("./manifest.js");
52
+ const external_worker_bundles_js_namespaceObject = require("./worker-bundles.js");
53
+ const external_mutation_policy_js_namespaceObject = require("./mutation-policy.js");
54
+ const pathExists = async (filePath)=>{
55
+ try {
56
+ await promises_default().access(filePath);
57
+ return true;
58
+ } catch {
59
+ return false;
60
+ }
61
+ };
62
+ const readJson = async (filePath)=>JSON.parse(await promises_default().readFile(filePath, 'utf-8'));
63
+ const verifyCloudflareOutput = async (options)=>{
64
+ const outputDirectory = external_node_path_default().resolve(options.outputDirectory);
65
+ const issues = [];
66
+ const outputPlan = (0, external_cloudflare_output_plan_js_namespaceObject.createCloudflareOutputPlan)(outputDirectory);
67
+ for (const relativePath of outputPlan.requiredFiles){
68
+ const filePath = external_node_path_default().join(outputDirectory, relativePath);
69
+ if (!await pathExists(filePath)) (0, external_issues_js_namespaceObject.addIssue)(issues, {
70
+ code: 'missing-file',
71
+ message: `Cloudflare output is missing ${relativePath}.`,
72
+ path: filePath
73
+ });
74
+ }
75
+ const manifestPath = outputPlan.paths.workerManifest;
76
+ const wranglerPath = outputPlan.paths.wranglerConfig;
77
+ const packagePath = outputPlan.paths.outputPackage;
78
+ const workerPackagePath = outputPlan.paths.workerPackage;
79
+ const manifest = await pathExists(manifestPath) ? await readJson(manifestPath) : void 0;
80
+ const wrangler = await pathExists(wranglerPath) ? await readJson(wranglerPath) : void 0;
81
+ const outputPackage = await pathExists(packagePath) ? await readJson(packagePath) : void 0;
82
+ const workerPackage = await pathExists(workerPackagePath) ? await readJson(workerPackagePath) : void 0;
83
+ if (manifest) {
84
+ (0, external_manifest_js_namespaceObject.verifyManifestShape)(issues, manifest, manifestPath);
85
+ (0, external_identity_js_namespaceObject.verifyDeliveryUnitIdentity)(issues, manifest, manifestPath, options.deliveryUnit);
86
+ const workerReferences = (0, external_worker_bundles_js_namespaceObject.getWorkerBundleReferences)(manifest);
87
+ if (workerReferences.length > 0 && !await pathExists(workerPackagePath)) (0, external_issues_js_namespaceObject.addIssue)(issues, {
88
+ code: 'missing-file',
89
+ message: 'Cloudflare output is missing worker/package.json for referenced worker bundles.',
90
+ path: workerPackagePath
91
+ });
92
+ if (manifest.bff?.runtimeFramework === 'effect' && !(0, external_worker_bundles_js_namespaceObject.getEffectBffWorker)(manifest)) (0, external_issues_js_namespaceObject.addIssue)(issues, {
93
+ code: 'missing-worker-bundle',
94
+ message: 'Cloudflare Effect BFF manifest points to a missing worker bundle.'
95
+ });
96
+ for (const workerReference of workerReferences){
97
+ const resolvedWorker = (0, external_worker_bundles_js_namespaceObject.resolveWorkerBundleReference)(issues, outputDirectory, workerReference, manifestPath);
98
+ if (!resolvedWorker) continue;
99
+ const workerExists = await pathExists(resolvedWorker.path);
100
+ if (!workerExists) (0, external_issues_js_namespaceObject.addIssue)(issues, {
101
+ code: 'missing-worker-bundle',
102
+ message: (0, external_worker_bundles_js_namespaceObject.missingWorkerBundleMessage)(workerReference),
103
+ path: resolvedWorker.path
104
+ });
105
+ if (workerExists) {
106
+ const workerSource = await promises_default().readFile(resolvedWorker.path, 'utf-8');
107
+ (0, external_worker_bundles_js_namespaceObject.verifyWorkerBundleReferences)(issues, resolvedWorker, workerSource);
108
+ if ('effect-bff' === resolvedWorker.kind && (workerSource.includes(';entityKind;') || workerSource.includes(';entityKind,entityKind;'))) (0, external_issues_js_namespaceObject.addIssue)(issues, {
109
+ code: 'invalid-worker-bundle',
110
+ message: 'Cloudflare Effect BFF worker bundle contains invalid Drizzle entityKind marker references.',
111
+ path: resolvedWorker.path
112
+ });
113
+ }
114
+ }
115
+ }
116
+ if (wrangler) {
117
+ (0, external_issues_js_namespaceObject.assertEqual)(issues, wrangler.main, outputPlan.wrangler.main, {
118
+ code: 'invalid-wrangler',
119
+ message: `wrangler.json main must be ${outputPlan.wrangler.main}.`,
120
+ path: wranglerPath
121
+ });
122
+ (0, external_issues_js_namespaceObject.assertEqual)(issues, wrangler.assets?.binding, outputPlan.wrangler.assets.binding, {
123
+ code: 'invalid-wrangler',
124
+ message: 'wrangler.json assets.binding must be ASSETS.',
125
+ path: wranglerPath
126
+ });
127
+ (0, external_issues_js_namespaceObject.assertEqual)(issues, wrangler.assets?.directory, outputPlan.wrangler.assets.directory, {
128
+ code: 'invalid-wrangler',
129
+ message: 'wrangler.json assets.directory must be ./public.',
130
+ path: wranglerPath
131
+ });
132
+ (0, external_issues_js_namespaceObject.assertEqual)(issues, wrangler.assets?.run_worker_first, outputPlan.wrangler.assets.run_worker_first, {
133
+ code: 'invalid-wrangler',
134
+ message: 'wrangler.json assets.run_worker_first must be true.',
135
+ path: wranglerPath
136
+ });
137
+ for (const flag of outputPlan.wrangler.requiredCompatibilityFlags)(0, external_issues_js_namespaceObject.assertFlag)(issues, wrangler.compatibility_flags, flag, {
138
+ code: 'invalid-wrangler',
139
+ message: `wrangler.json compatibility_flags must include ${flag}.`,
140
+ path: wranglerPath
141
+ });
142
+ }
143
+ if (outputPackage) (0, external_issues_js_namespaceObject.assertEqual)(issues, outputPackage.type, outputPlan.packages.output.type, {
144
+ code: 'invalid-package',
145
+ message: '.output/package.json must declare type module.',
146
+ path: packagePath
147
+ });
148
+ if (workerPackage) (0, external_issues_js_namespaceObject.assertEqual)(issues, workerPackage.type, outputPlan.packages.worker.type, {
149
+ code: 'invalid-package',
150
+ message: '.output/worker/package.json must declare type commonjs.',
151
+ path: workerPackagePath
152
+ });
153
+ for (const leakedPath of outputPlan.publicLeakDirectories){
154
+ const publicPath = external_node_path_default().join(outputPlan.paths.publicAssets, leakedPath);
155
+ if (await pathExists(publicPath)) (0, external_issues_js_namespaceObject.addIssue)(issues, {
156
+ code: 'public-output-leak',
157
+ message: `Framework-owned ${leakedPath} output leaked into public assets.`,
158
+ path: publicPath
159
+ });
160
+ }
161
+ if (false !== options.importWorker && await pathExists(outputPlan.paths.workerEntry)) await (0, external_worker_bundles_js_namespaceObject.verifyWorkerImport)(issues, outputPlan.paths.workerEntry);
162
+ return {
163
+ ok: 0 === issues.length,
164
+ issues
165
+ };
166
+ };
167
+ const assertCloudflareOutput = async (options)=>{
168
+ const result = await verifyCloudflareOutput(options);
169
+ if (!result.ok) throw new Error([
170
+ 'Cloudflare output verification failed:',
171
+ ...result.issues.map((issue)=>`- ${issue.code}: ${issue.message}${issue.path ? ` (${issue.path})` : ''}`)
172
+ ].join('\n'));
173
+ };
174
+ exports.assertCloudflareOutput = __webpack_exports__.assertCloudflareOutput;
175
+ exports.verifyCloudflareOutput = __webpack_exports__.verifyCloudflareOutput;
176
+ exports.verifyCloudflareOutputMutationPolicy = __webpack_exports__.verifyCloudflareOutputMutationPolicy;
177
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
178
+ "assertCloudflareOutput",
179
+ "verifyCloudflareOutput",
180
+ "verifyCloudflareOutputMutationPolicy"
181
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
182
+ Object.defineProperty(exports, '__esModule', {
183
+ value: true
184
+ });
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ const addIssue = (issues, issue)=>{
31
+ issues.push(issue);
32
+ };
33
+ const assertEqual = (issues, actual, expected, issue)=>{
34
+ if (actual !== expected) addIssue(issues, issue);
35
+ };
36
+ const assertFlag = (issues, flags, flag, issue)=>{
37
+ if (!Array.isArray(flags) || !flags.includes(flag)) addIssue(issues, issue);
38
+ };
39
+ __webpack_require__.d(__webpack_exports__, {}, {
40
+ addIssue: addIssue,
41
+ assertEqual: assertEqual,
42
+ assertFlag: assertFlag
43
+ });
44
+ exports.addIssue = __webpack_exports__.addIssue;
45
+ exports.assertEqual = __webpack_exports__.assertEqual;
46
+ exports.assertFlag = __webpack_exports__.assertFlag;
47
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
48
+ "addIssue",
49
+ "assertEqual",
50
+ "assertFlag"
51
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
52
+ Object.defineProperty(exports, '__esModule', {
53
+ value: true
54
+ });
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ verifyManifestShape: ()=>verifyManifestShape
32
+ });
33
+ const external_cloudflare_output_contract_js_namespaceObject = require("../cloudflare-output-contract.js");
34
+ const external_issues_js_namespaceObject = require("./issues.js");
35
+ const verifyManifestShape = (issues, manifest, manifestPath)=>{
36
+ (0, external_issues_js_namespaceObject.assertEqual)(issues, manifest.runtime?.type, external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_RUNTIME_TYPE, {
37
+ code: 'invalid-manifest',
38
+ message: 'Cloudflare output manifest runtime.type must be cloudflare-module-worker.',
39
+ path: manifestPath
40
+ });
41
+ (0, external_issues_js_namespaceObject.assertEqual)(issues, manifest.runtime?.entry, external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_WORKER_ENTRY, {
42
+ code: 'invalid-manifest',
43
+ message: `Cloudflare output manifest runtime.entry must be ${external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_WORKER_ENTRY}.`,
44
+ path: manifestPath
45
+ });
46
+ (0, external_issues_js_namespaceObject.assertEqual)(issues, manifest.runtime?.fetchExport, true, {
47
+ code: 'invalid-manifest',
48
+ message: 'Cloudflare output manifest runtime.fetchExport must be true.',
49
+ path: manifestPath
50
+ });
51
+ (0, external_issues_js_namespaceObject.assertEqual)(issues, manifest.runtime?.nodeListen, false, {
52
+ code: 'invalid-manifest',
53
+ message: 'Cloudflare output manifest runtime.nodeListen must be false.',
54
+ path: manifestPath
55
+ });
56
+ (0, external_issues_js_namespaceObject.assertEqual)(issues, manifest.assets?.binding, external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_ASSETS_BINDING, {
57
+ code: 'invalid-manifest',
58
+ message: 'Cloudflare output manifest assets.binding must be ASSETS.',
59
+ path: manifestPath
60
+ });
61
+ (0, external_issues_js_namespaceObject.assertEqual)(issues, manifest.assets?.directory, `./${external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_PUBLIC_ASSETS_DIRECTORY}`, {
62
+ code: 'invalid-manifest',
63
+ message: 'Cloudflare output manifest assets.directory must be ./public.',
64
+ path: manifestPath
65
+ });
66
+ (0, external_issues_js_namespaceObject.assertEqual)(issues, manifest.assets?.runWorkerFirst, true, {
67
+ code: 'invalid-manifest',
68
+ message: 'Cloudflare output manifest assets.runWorkerFirst must be true.',
69
+ path: manifestPath
70
+ });
71
+ if (!Array.isArray(manifest.routeSpec?.routes)) (0, external_issues_js_namespaceObject.addIssue)(issues, {
72
+ code: 'invalid-manifest',
73
+ message: 'Cloudflare output manifest routeSpec.routes must be array.',
74
+ path: manifestPath
75
+ });
76
+ };
77
+ exports.verifyManifestShape = __webpack_exports__.verifyManifestShape;
78
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
79
+ "verifyManifestShape"
80
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
81
+ Object.defineProperty(exports, '__esModule', {
82
+ value: true
83
+ });
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, getters, values)=>{
14
+ var define = (defs, kind)=>{
15
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
16
+ enumerable: true,
17
+ [kind]: defs[key]
18
+ });
19
+ };
20
+ define(getters, "get");
21
+ define(values, "value");
22
+ };
23
+ })();
24
+ (()=>{
25
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
26
+ })();
27
+ (()=>{
28
+ __webpack_require__.r = (exports1)=>{
29
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
30
+ value: 'Module'
31
+ });
32
+ Object.defineProperty(exports1, '__esModule', {
33
+ value: true
34
+ });
35
+ };
36
+ })();
37
+ var __webpack_exports__ = {};
38
+ __webpack_require__.r(__webpack_exports__);
39
+ __webpack_require__.d(__webpack_exports__, {
40
+ FORBIDDEN_MUTATION_PATTERNS: ()=>FORBIDDEN_MUTATION_PATTERNS,
41
+ SOURCE_SCAN_FILE_PATTERN: ()=>SOURCE_SCAN_FILE_PATTERN,
42
+ SOURCE_SCAN_IGNORED_DIRECTORY_NAMES: ()=>SOURCE_SCAN_IGNORED_DIRECTORY_NAMES,
43
+ verifyCloudflareOutputMutationPolicy: ()=>verifyCloudflareOutputMutationPolicy,
44
+ walkFiles: ()=>walkFiles
45
+ });
46
+ const promises_namespaceObject = require("node:fs/promises");
47
+ var promises_default = /*#__PURE__*/ __webpack_require__.n(promises_namespaceObject);
48
+ const external_node_path_namespaceObject = require("node:path");
49
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
50
+ const external_issues_js_namespaceObject = require("./issues.js");
51
+ const SOURCE_SCAN_FILE_PATTERN = /\.(?:[cm]?[jt]s|json)$/u;
52
+ const SOURCE_SCAN_IGNORED_DIRECTORY_NAMES = new Set([
53
+ '.codex',
54
+ '.fastcontext',
55
+ '.git',
56
+ '.mf',
57
+ '.modernjs',
58
+ '.output',
59
+ 'coverage',
60
+ 'dist',
61
+ 'dist-cloudflare',
62
+ 'node_modules',
63
+ 'repos',
64
+ 'topology'
65
+ ]);
66
+ const FORBIDDEN_MUTATION_PATTERNS = [
67
+ {
68
+ code: 'forbidden-mutation-pattern',
69
+ message: "Generated Cloudflare server worker output must not be rewritten by app scripts.",
70
+ pattern: /\.output\/server\/index\.mjs/u
71
+ },
72
+ {
73
+ code: 'forbidden-mutation-pattern',
74
+ message: "Generated Cloudflare server worker output must not be rewritten by app scripts.",
75
+ pattern: /path\.(?:join|resolve)\(\s*['"`]\.output['"`]\s*,\s*['"`]server['"`]\s*,\s*['"`]index\.mjs['"`]\s*\)/u
76
+ },
77
+ {
78
+ code: 'forbidden-mutation-pattern',
79
+ message: "Generated Cloudflare BFF worker bundles must not be rewritten by app scripts.",
80
+ pattern: /\.output\/worker\/[^'"`]*\.(?:mjs|cjs|js)/u
81
+ },
82
+ {
83
+ code: 'forbidden-mutation-pattern',
84
+ message: "Generated Cloudflare BFF worker bundles must not be rewritten by app scripts.",
85
+ pattern: /path\.(?:join|resolve)\(\s*['"`]\.output['"`]\s*,\s*['"`]worker['"`]\s*,\s*['"`][^'"`]+\.(?:mjs|cjs|js)['"`]\s*\)/u
86
+ },
87
+ {
88
+ code: 'forbidden-mutation-pattern',
89
+ message: "Drizzle entityKind worker bundle markers must be fixed in the framework toolchain, not post-build scripts.",
90
+ pattern: /replaceAll\(\s*['"`];entityKind(?:,entityKind)?;/u
91
+ },
92
+ {
93
+ code: 'forbidden-mutation-pattern',
94
+ message: "Effect BFF Cloudflare dispatch must not depend on duck-typed runtime helper probing in app scripts.",
95
+ pattern: /(?:typeof\s+[^;\n]*dispatchEffectBffRequest|['"`]dispatchEffectBffRequest['"`]\s+in\s+|\.dispatchEffectBffRequest\b)/u
96
+ },
97
+ {
98
+ code: 'forbidden-mutation-pattern',
99
+ message: "Effect BFF Cloudflare dispatch must not branch on handler.length in app scripts.",
100
+ pattern: /\bhandler\s*\.\s*length\b/u
101
+ }
102
+ ];
103
+ const pathExists = async (filePath)=>{
104
+ try {
105
+ await promises_default().access(filePath);
106
+ return true;
107
+ } catch {
108
+ return false;
109
+ }
110
+ };
111
+ const walkFiles = async (root)=>{
112
+ if (!await pathExists(root)) return [];
113
+ const entries = await promises_default().readdir(root, {
114
+ withFileTypes: true
115
+ });
116
+ const files = [];
117
+ for (const entry of entries){
118
+ if (SOURCE_SCAN_IGNORED_DIRECTORY_NAMES.has(entry.name)) continue;
119
+ const entryPath = external_node_path_default().join(root, entry.name);
120
+ if (entry.isDirectory()) {
121
+ files.push(...await walkFiles(entryPath));
122
+ continue;
123
+ }
124
+ if (SOURCE_SCAN_FILE_PATTERN.test(entry.name)) files.push(entryPath);
125
+ }
126
+ return files;
127
+ };
128
+ const verifyCloudflareOutputMutationPolicy = async (options)=>{
129
+ const issues = [];
130
+ const files = (await Promise.all(options.scanRoots.map((scanRoot)=>walkFiles(external_node_path_default().resolve(scanRoot))))).flat();
131
+ for (const file of files){
132
+ const source = await promises_default().readFile(file, 'utf-8');
133
+ for (const forbidden of FORBIDDEN_MUTATION_PATTERNS)if (forbidden.pattern.test(source)) (0, external_issues_js_namespaceObject.addIssue)(issues, {
134
+ code: forbidden.code,
135
+ message: forbidden.message,
136
+ path: file
137
+ });
138
+ }
139
+ return {
140
+ ok: 0 === issues.length,
141
+ issues
142
+ };
143
+ };
144
+ exports.FORBIDDEN_MUTATION_PATTERNS = __webpack_exports__.FORBIDDEN_MUTATION_PATTERNS;
145
+ exports.SOURCE_SCAN_FILE_PATTERN = __webpack_exports__.SOURCE_SCAN_FILE_PATTERN;
146
+ exports.SOURCE_SCAN_IGNORED_DIRECTORY_NAMES = __webpack_exports__.SOURCE_SCAN_IGNORED_DIRECTORY_NAMES;
147
+ exports.verifyCloudflareOutputMutationPolicy = __webpack_exports__.verifyCloudflareOutputMutationPolicy;
148
+ exports.walkFiles = __webpack_exports__.walkFiles;
149
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
150
+ "FORBIDDEN_MUTATION_PATTERNS",
151
+ "SOURCE_SCAN_FILE_PATTERN",
152
+ "SOURCE_SCAN_IGNORED_DIRECTORY_NAMES",
153
+ "verifyCloudflareOutputMutationPolicy",
154
+ "walkFiles"
155
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
156
+ Object.defineProperty(exports, '__esModule', {
157
+ value: true
158
+ });
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, getters, values)=>{
14
+ var define = (defs, kind)=>{
15
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
16
+ enumerable: true,
17
+ [kind]: defs[key]
18
+ });
19
+ };
20
+ define(getters, "get");
21
+ define(values, "value");
22
+ };
23
+ })();
24
+ (()=>{
25
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
26
+ })();
27
+ (()=>{
28
+ __webpack_require__.r = (exports1)=>{
29
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
30
+ value: 'Module'
31
+ });
32
+ Object.defineProperty(exports1, '__esModule', {
33
+ value: true
34
+ });
35
+ };
36
+ })();
37
+ var __webpack_exports__ = {};
38
+ __webpack_require__.r(__webpack_exports__);
39
+ __webpack_require__.d(__webpack_exports__, {
40
+ FORBIDDEN_WORKER_BUNDLE_REFERENCE_PATTERNS: ()=>FORBIDDEN_WORKER_BUNDLE_REFERENCE_PATTERNS,
41
+ getEffectBffWorker: ()=>getEffectBffWorker,
42
+ getReferencedRouteWorkers: ()=>getReferencedRouteWorkers,
43
+ getWorkerBundleReferences: ()=>getWorkerBundleReferences,
44
+ missingWorkerBundleMessage: ()=>missingWorkerBundleMessage,
45
+ resolveWorkerBundleReference: ()=>resolveWorkerBundleReference,
46
+ verifyWorkerBundleReferences: ()=>verifyWorkerBundleReferences,
47
+ verifyWorkerImport: ()=>verifyWorkerImport
48
+ });
49
+ const external_node_path_namespaceObject = require("node:path");
50
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
51
+ const external_node_url_namespaceObject = require("node:url");
52
+ const external_cloudflare_output_contract_js_namespaceObject = require("../cloudflare-output-contract.js");
53
+ const external_issues_js_namespaceObject = require("./issues.js");
54
+ const getReferencedRouteWorkers = (manifest)=>Array.isArray(manifest?.routeSpec?.routes) ? manifest.routeSpec.routes.map((route)=>'string' == typeof route?.worker && route.worker.length > 0 ? route.worker : void 0).filter((worker)=>'string' == typeof worker) : [];
55
+ const getEffectBffWorker = (manifest)=>manifest?.bff?.runtimeFramework === 'effect' && 'string' == typeof manifest.bff.worker ? manifest.bff.worker : void 0;
56
+ const getWorkerBundleReferences = (manifest)=>{
57
+ const effectBffWorker = getEffectBffWorker(manifest);
58
+ return [
59
+ ...effectBffWorker ? [
60
+ {
61
+ kind: 'effect-bff',
62
+ reference: effectBffWorker
63
+ }
64
+ ] : [],
65
+ ...getReferencedRouteWorkers(manifest).map((reference)=>({
66
+ kind: 'route',
67
+ reference
68
+ }))
69
+ ];
70
+ };
71
+ const resolveWorkerBundleReference = (issues, outputDirectory, reference, manifestPath)=>{
72
+ const workerRoot = external_node_path_default().resolve(outputDirectory, external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_WORKER_BUNDLE_DIRECTORY);
73
+ const workerPath = external_node_path_default().resolve(outputDirectory, reference.reference);
74
+ const relativeToWorkerRoot = external_node_path_default().relative(workerRoot, workerPath);
75
+ if (external_node_path_default().isAbsolute(reference.reference) || relativeToWorkerRoot.startsWith('..') || external_node_path_default().isAbsolute(relativeToWorkerRoot)) {
76
+ (0, external_issues_js_namespaceObject.addIssue)(issues, {
77
+ code: 'invalid-manifest',
78
+ message: 'Cloudflare output manifest worker bundle references must stay under worker/.',
79
+ path: manifestPath
80
+ });
81
+ return null;
82
+ }
83
+ return {
84
+ ...reference,
85
+ path: workerPath
86
+ };
87
+ };
88
+ const missingWorkerBundleMessage = (reference)=>'effect-bff' === reference.kind ? 'Cloudflare Effect BFF manifest points to a missing worker bundle.' : 'Cloudflare route worker manifest points to a missing worker bundle.';
89
+ const FORBIDDEN_WORKER_BUNDLE_REFERENCE_PATTERNS = [
90
+ /\.\.\/server\//u,
91
+ /\.output\/server\//u,
92
+ /server\/index\.mjs/u
93
+ ];
94
+ const verifyWorkerBundleReferences = (issues, worker, source)=>{
95
+ if (FORBIDDEN_WORKER_BUNDLE_REFERENCE_PATTERNS.some((pattern)=>pattern.test(source))) (0, external_issues_js_namespaceObject.addIssue)(issues, {
96
+ code: 'invalid-worker-bundle',
97
+ message: 'Cloudflare worker bundles must not reference framework-owned server output paths.',
98
+ path: worker.path
99
+ });
100
+ };
101
+ const verifyWorkerImport = async (issues, entryPath)=>{
102
+ try {
103
+ const worker = (await import(`${(0, external_node_url_namespaceObject.pathToFileURL)(entryPath).href}?t=${Date.now()}`)).default;
104
+ if (!worker || 'function' != typeof worker.fetch) (0, external_issues_js_namespaceObject.addIssue)(issues, {
105
+ code: 'worker-import-failed',
106
+ message: 'Cloudflare server entry must default-export a Worker with fetch.',
107
+ path: entryPath
108
+ });
109
+ } catch (error) {
110
+ (0, external_issues_js_namespaceObject.addIssue)(issues, {
111
+ code: 'worker-import-failed',
112
+ message: `Cloudflare server entry could not be imported: ${error instanceof Error ? error.message : String(error)}`,
113
+ path: entryPath
114
+ });
115
+ }
116
+ };
117
+ exports.FORBIDDEN_WORKER_BUNDLE_REFERENCE_PATTERNS = __webpack_exports__.FORBIDDEN_WORKER_BUNDLE_REFERENCE_PATTERNS;
118
+ exports.getEffectBffWorker = __webpack_exports__.getEffectBffWorker;
119
+ exports.getReferencedRouteWorkers = __webpack_exports__.getReferencedRouteWorkers;
120
+ exports.getWorkerBundleReferences = __webpack_exports__.getWorkerBundleReferences;
121
+ exports.missingWorkerBundleMessage = __webpack_exports__.missingWorkerBundleMessage;
122
+ exports.resolveWorkerBundleReference = __webpack_exports__.resolveWorkerBundleReference;
123
+ exports.verifyWorkerBundleReferences = __webpack_exports__.verifyWorkerBundleReferences;
124
+ exports.verifyWorkerImport = __webpack_exports__.verifyWorkerImport;
125
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
126
+ "FORBIDDEN_WORKER_BUNDLE_REFERENCE_PATTERNS",
127
+ "getEffectBffWorker",
128
+ "getReferencedRouteWorkers",
129
+ "getWorkerBundleReferences",
130
+ "missingWorkerBundleMessage",
131
+ "resolveWorkerBundleReference",
132
+ "verifyWorkerBundleReferences",
133
+ "verifyWorkerImport"
134
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
135
+ Object.defineProperty(exports, '__esModule', {
136
+ value: true
137
+ });