@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.30 → 3.5.0-ultramodern.32
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.
- package/dist/cjs/plugins/backend-federation/codegen.js +208 -0
- package/dist/cjs/plugins/backend-federation/config.js +217 -0
- package/dist/cjs/plugins/backend-federation/emit.js +139 -0
- package/dist/cjs/plugins/backendFederationBuild.js +4 -298
- package/dist/cjs/plugins/deploy/platforms/cloudflare/artifacts.js +127 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/constants.js +137 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/delivery-unit.js +118 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/i18n-worker.js +135 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/index.js +126 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/security-policies.js +223 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/types.js +18 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/utils.js +66 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/worker-manifest.js +178 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/wrangler-config.js +189 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/identity.js +83 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +184 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/issues.js +54 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/manifest.js +83 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.js +158 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.js +137 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier.js +23 -363
- package/dist/cjs/plugins/deploy/platforms/cloudflare.js +2 -745
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +22 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +32 -0
- package/dist/esm/plugins/backend-federation/codegen.mjs +157 -0
- package/dist/esm/plugins/backend-federation/config.mjs +141 -0
- package/dist/esm/plugins/backend-federation/emit.mjs +88 -0
- package/dist/esm/plugins/backendFederationBuild.mjs +1 -296
- package/dist/esm/plugins/deploy/platforms/cloudflare/artifacts.mjs +64 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/constants.mjs +33 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +67 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +97 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/index.mjs +78 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/security-policies.mjs +167 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/types.mjs +0 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/utils.mjs +12 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +118 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +135 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +45 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +129 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +10 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +45 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +97 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +68 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier.mjs +1 -347
- package/dist/esm/plugins/deploy/platforms/cloudflare.mjs +1 -735
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +22 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +32 -0
- package/dist/esm-node/plugins/backend-federation/codegen.mjs +158 -0
- package/dist/esm-node/plugins/backend-federation/config.mjs +142 -0
- package/dist/esm-node/plugins/backend-federation/emit.mjs +89 -0
- package/dist/esm-node/plugins/backendFederationBuild.mjs +1 -296
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/artifacts.mjs +65 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/constants.mjs +34 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +68 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +98 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/index.mjs +79 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/security-policies.mjs +168 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/types.mjs +1 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/utils.mjs +13 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +119 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +136 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +46 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +130 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +11 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +46 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +98 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +69 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier.mjs +1 -347
- package/dist/esm-node/plugins/deploy/platforms/cloudflare.mjs +1 -735
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +22 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +32 -0
- package/dist/types/plugins/backend-federation/codegen.d.ts +82 -0
- package/dist/types/plugins/backend-federation/config.d.ts +103 -0
- package/dist/types/plugins/backend-federation/emit.d.ts +13 -0
- package/dist/types/plugins/backendFederationBuild.d.ts +2 -11
- package/dist/types/plugins/deploy/platforms/cloudflare/artifacts.d.ts +15 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/constants.d.ts +23 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/delivery-unit.d.ts +23 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/i18n-worker.d.ts +21 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/index.d.ts +2 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/security-policies.d.ts +88 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/types.d.ts +5 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/utils.d.ts +6 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/worker-manifest.d.ts +100 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/wrangler-config.d.ts +39 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/identity.d.ts +4 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/index.d.ts +18 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/issues.d.ts +14 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/manifest.d.ts +2 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.d.ts +13 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.d.ts +16 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier.d.ts +1 -32
- package/dist/types/plugins/deploy/platforms/cloudflare.d.ts +1 -2
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.d.mts +1 -0
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.d.mts +1 -0
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.d.mts +1 -0
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.d.mts +1 -0
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.d.mts +1 -0
- package/package.json +11 -11
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -879
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -879
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -879
- /package/dist/types/plugins/deploy/platforms/templates/{cloudflare-entry.d.mts → cloudflare-entry.006-fetch-handler.d.mts} +0 -0
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"./cloudflare-output-verifier/index" (module) {
|
|
4
|
+
module.exports = require("./cloudflare-output-verifier/index.js");
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
var __webpack_module_cache__ = {};
|
|
8
|
+
function __webpack_require__(moduleId) {
|
|
9
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
10
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
11
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
12
|
+
exports: {}
|
|
13
|
+
};
|
|
14
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
15
|
+
return module.exports;
|
|
16
|
+
}
|
|
3
17
|
(()=>{
|
|
4
18
|
__webpack_require__.n = (module)=>{
|
|
5
19
|
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
@@ -35,368 +49,14 @@ var __webpack_require__ = {};
|
|
|
35
49
|
};
|
|
36
50
|
})();
|
|
37
51
|
var __webpack_exports__ = {};
|
|
38
|
-
|
|
39
|
-
__webpack_require__.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var
|
|
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_node_url_namespaceObject = require("node:url");
|
|
49
|
-
const external_cloudflare_output_contract_js_namespaceObject = require("./cloudflare-output-contract.js");
|
|
50
|
-
const external_cloudflare_output_plan_js_namespaceObject = require("./cloudflare-output-plan.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\(\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\(\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 readJson = async (filePath)=>JSON.parse(await promises_default().readFile(filePath, 'utf-8'));
|
|
112
|
-
const addIssue = (issues, issue)=>{
|
|
113
|
-
issues.push(issue);
|
|
114
|
-
};
|
|
115
|
-
const assertEqual = (issues, actual, expected, issue)=>{
|
|
116
|
-
if (actual !== expected) addIssue(issues, issue);
|
|
117
|
-
};
|
|
118
|
-
const assertFlag = (issues, flags, flag, issue)=>{
|
|
119
|
-
if (!Array.isArray(flags) || !flags.includes(flag)) addIssue(issues, issue);
|
|
120
|
-
};
|
|
121
|
-
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) : [];
|
|
122
|
-
const getEffectBffWorker = (manifest)=>manifest?.bff?.runtimeFramework === 'effect' && 'string' == typeof manifest.bff.worker ? manifest.bff.worker : void 0;
|
|
123
|
-
const getWorkerBundleReferences = (manifest)=>{
|
|
124
|
-
const effectBffWorker = getEffectBffWorker(manifest);
|
|
125
|
-
return [
|
|
126
|
-
...effectBffWorker ? [
|
|
127
|
-
{
|
|
128
|
-
kind: 'effect-bff',
|
|
129
|
-
reference: effectBffWorker
|
|
130
|
-
}
|
|
131
|
-
] : [],
|
|
132
|
-
...getReferencedRouteWorkers(manifest).map((reference)=>({
|
|
133
|
-
kind: 'route',
|
|
134
|
-
reference
|
|
135
|
-
}))
|
|
136
|
-
];
|
|
137
|
-
};
|
|
138
|
-
const resolveWorkerBundleReference = (issues, outputDirectory, reference, manifestPath)=>{
|
|
139
|
-
const workerRoot = external_node_path_default().resolve(outputDirectory, external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_WORKER_BUNDLE_DIRECTORY);
|
|
140
|
-
const workerPath = external_node_path_default().resolve(outputDirectory, reference.reference);
|
|
141
|
-
const relativeToWorkerRoot = external_node_path_default().relative(workerRoot, workerPath);
|
|
142
|
-
if (external_node_path_default().isAbsolute(reference.reference) || relativeToWorkerRoot.startsWith('..') || external_node_path_default().isAbsolute(relativeToWorkerRoot)) {
|
|
143
|
-
addIssue(issues, {
|
|
144
|
-
code: 'invalid-manifest',
|
|
145
|
-
message: 'Cloudflare output manifest worker bundle references must stay under worker/.',
|
|
146
|
-
path: manifestPath
|
|
147
|
-
});
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
return {
|
|
151
|
-
...reference,
|
|
152
|
-
path: workerPath
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
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.';
|
|
156
|
-
const DELIVERY_UNIT_IDENTITY_FIELDS = [
|
|
157
|
-
'unitId',
|
|
158
|
-
'buildMarker',
|
|
159
|
-
'sourceRevision'
|
|
160
|
-
];
|
|
161
|
-
const verifyDeliveryUnitIdentity = (issues, manifest, manifestPath, declared)=>{
|
|
162
|
-
const stamped = manifest?.deliveryUnit;
|
|
163
|
-
const hasStamp = Boolean(stamped) && 'object' == typeof stamped;
|
|
164
|
-
if (declared) {
|
|
165
|
-
if (!hasStamp) return void addIssue(issues, {
|
|
166
|
-
code: 'missing-delivery-unit',
|
|
167
|
-
message: `Cloudflare worker manifest is missing the delivery-unit identity declared by the workspace topology (expected unitId ${declared.unitId}, buildMarker ${declared.buildMarker}).`,
|
|
168
|
-
path: manifestPath
|
|
169
|
-
});
|
|
170
|
-
for (const field of DELIVERY_UNIT_IDENTITY_FIELDS)assertEqual(issues, stamped[field], declared[field], {
|
|
171
|
-
code: 'delivery-unit-drift',
|
|
172
|
-
message: `Cloudflare worker manifest deliveryUnit.${field} must match the topology delivery-unit record (expected ${declared[field]}, received ${stamped[field] ?? 'undefined'}).`,
|
|
173
|
-
path: manifestPath
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
if (hasStamp && stamped.surfaces && 'object' == typeof stamped.surfaces) for (const surface of [
|
|
177
|
-
'ui',
|
|
178
|
-
'api'
|
|
179
|
-
]){
|
|
180
|
-
const marker = stamped.surfaces[surface];
|
|
181
|
-
if (!marker || 'object' != typeof marker) {
|
|
182
|
-
addIssue(issues, {
|
|
183
|
-
code: 'missing-delivery-unit',
|
|
184
|
-
message: `Cloudflare worker manifest is missing the ${surface} delivery-unit surface marker.`,
|
|
185
|
-
path: manifestPath
|
|
186
|
-
});
|
|
187
|
-
continue;
|
|
188
|
-
}
|
|
189
|
-
for (const field of DELIVERY_UNIT_IDENTITY_FIELDS)assertEqual(issues, marker[field], stamped[field], {
|
|
190
|
-
code: 'delivery-unit-drift',
|
|
191
|
-
message: `Cloudflare worker manifest ${surface} surface deliveryUnit.${field} must derive from one delivery-unit record (expected ${stamped[field] ?? 'undefined'}, received ${marker[field] ?? 'undefined'}).`,
|
|
192
|
-
path: manifestPath
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
const verifyManifestShape = (issues, manifest, manifestPath)=>{
|
|
197
|
-
assertEqual(issues, manifest.runtime?.type, external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_RUNTIME_TYPE, {
|
|
198
|
-
code: 'invalid-manifest',
|
|
199
|
-
message: 'Cloudflare output manifest runtime.type must be cloudflare-module-worker.',
|
|
200
|
-
path: manifestPath
|
|
201
|
-
});
|
|
202
|
-
assertEqual(issues, manifest.runtime?.entry, external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_WORKER_ENTRY, {
|
|
203
|
-
code: 'invalid-manifest',
|
|
204
|
-
message: `Cloudflare output manifest runtime.entry must be ${external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_WORKER_ENTRY}.`,
|
|
205
|
-
path: manifestPath
|
|
206
|
-
});
|
|
207
|
-
assertEqual(issues, manifest.runtime?.fetchExport, true, {
|
|
208
|
-
code: 'invalid-manifest',
|
|
209
|
-
message: 'Cloudflare output manifest runtime.fetchExport must be true.',
|
|
210
|
-
path: manifestPath
|
|
211
|
-
});
|
|
212
|
-
assertEqual(issues, manifest.runtime?.nodeListen, false, {
|
|
213
|
-
code: 'invalid-manifest',
|
|
214
|
-
message: 'Cloudflare output manifest runtime.nodeListen must be false.',
|
|
215
|
-
path: manifestPath
|
|
216
|
-
});
|
|
217
|
-
assertEqual(issues, manifest.assets?.binding, external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_ASSETS_BINDING, {
|
|
218
|
-
code: 'invalid-manifest',
|
|
219
|
-
message: 'Cloudflare output manifest assets.binding must be ASSETS.',
|
|
220
|
-
path: manifestPath
|
|
221
|
-
});
|
|
222
|
-
assertEqual(issues, manifest.assets?.directory, `./${external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_PUBLIC_ASSETS_DIRECTORY}`, {
|
|
223
|
-
code: 'invalid-manifest',
|
|
224
|
-
message: 'Cloudflare output manifest assets.directory must be ./public.',
|
|
225
|
-
path: manifestPath
|
|
226
|
-
});
|
|
227
|
-
assertEqual(issues, manifest.assets?.runWorkerFirst, true, {
|
|
228
|
-
code: 'invalid-manifest',
|
|
229
|
-
message: 'Cloudflare output manifest assets.runWorkerFirst must be true.',
|
|
230
|
-
path: manifestPath
|
|
231
|
-
});
|
|
232
|
-
};
|
|
233
|
-
const walkFiles = async (root)=>{
|
|
234
|
-
if (!await pathExists(root)) return [];
|
|
235
|
-
const entries = await promises_default().readdir(root, {
|
|
236
|
-
withFileTypes: true
|
|
237
|
-
});
|
|
238
|
-
const files = [];
|
|
239
|
-
for (const entry of entries){
|
|
240
|
-
if (SOURCE_SCAN_IGNORED_DIRECTORY_NAMES.has(entry.name)) continue;
|
|
241
|
-
const entryPath = external_node_path_default().join(root, entry.name);
|
|
242
|
-
if (entry.isDirectory()) {
|
|
243
|
-
files.push(...await walkFiles(entryPath));
|
|
244
|
-
continue;
|
|
245
|
-
}
|
|
246
|
-
if (SOURCE_SCAN_FILE_PATTERN.test(entry.name)) files.push(entryPath);
|
|
247
|
-
}
|
|
248
|
-
return files;
|
|
249
|
-
};
|
|
250
|
-
const verifyCloudflareOutputMutationPolicy = async (options)=>{
|
|
251
|
-
const issues = [];
|
|
252
|
-
const files = (await Promise.all(options.scanRoots.map((scanRoot)=>walkFiles(external_node_path_default().resolve(scanRoot))))).flat();
|
|
253
|
-
for (const file of files){
|
|
254
|
-
const source = await promises_default().readFile(file, 'utf-8');
|
|
255
|
-
for (const forbidden of FORBIDDEN_MUTATION_PATTERNS)if (forbidden.pattern.test(source)) addIssue(issues, {
|
|
256
|
-
code: forbidden.code,
|
|
257
|
-
message: forbidden.message,
|
|
258
|
-
path: file
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
return {
|
|
262
|
-
ok: 0 === issues.length,
|
|
263
|
-
issues
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
const verifyWorkerImport = async (issues, entryPath)=>{
|
|
267
|
-
try {
|
|
268
|
-
const worker = (await import(`${(0, external_node_url_namespaceObject.pathToFileURL)(entryPath).href}?t=${Date.now()}`)).default;
|
|
269
|
-
if (!worker || 'function' != typeof worker.fetch) addIssue(issues, {
|
|
270
|
-
code: 'worker-import-failed',
|
|
271
|
-
message: 'Cloudflare server entry must default-export a Worker with fetch.',
|
|
272
|
-
path: entryPath
|
|
273
|
-
});
|
|
274
|
-
} catch (error) {
|
|
275
|
-
addIssue(issues, {
|
|
276
|
-
code: 'worker-import-failed',
|
|
277
|
-
message: `Cloudflare server entry could not be imported: ${error instanceof Error ? error.message : String(error)}`,
|
|
278
|
-
path: entryPath
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
const verifyCloudflareOutput = async (options)=>{
|
|
283
|
-
const outputDirectory = external_node_path_default().resolve(options.outputDirectory);
|
|
284
|
-
const issues = [];
|
|
285
|
-
const outputPlan = (0, external_cloudflare_output_plan_js_namespaceObject.createCloudflareOutputPlan)(outputDirectory);
|
|
286
|
-
for (const relativePath of outputPlan.requiredFiles){
|
|
287
|
-
const filePath = external_node_path_default().join(outputDirectory, relativePath);
|
|
288
|
-
if (!await pathExists(filePath)) addIssue(issues, {
|
|
289
|
-
code: 'missing-file',
|
|
290
|
-
message: `Cloudflare output is missing ${relativePath}.`,
|
|
291
|
-
path: filePath
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
const manifestPath = outputPlan.paths.workerManifest;
|
|
295
|
-
const wranglerPath = outputPlan.paths.wranglerConfig;
|
|
296
|
-
const packagePath = outputPlan.paths.outputPackage;
|
|
297
|
-
const workerPackagePath = outputPlan.paths.workerPackage;
|
|
298
|
-
const manifest = await pathExists(manifestPath) ? await readJson(manifestPath) : void 0;
|
|
299
|
-
const wrangler = await pathExists(wranglerPath) ? await readJson(wranglerPath) : void 0;
|
|
300
|
-
const outputPackage = await pathExists(packagePath) ? await readJson(packagePath) : void 0;
|
|
301
|
-
const workerPackage = await pathExists(workerPackagePath) ? await readJson(workerPackagePath) : void 0;
|
|
302
|
-
if (manifest) {
|
|
303
|
-
verifyManifestShape(issues, manifest, manifestPath);
|
|
304
|
-
verifyDeliveryUnitIdentity(issues, manifest, manifestPath, options.deliveryUnit);
|
|
305
|
-
const workerReferences = getWorkerBundleReferences(manifest);
|
|
306
|
-
if (workerReferences.length > 0 && !await pathExists(workerPackagePath)) addIssue(issues, {
|
|
307
|
-
code: 'missing-file',
|
|
308
|
-
message: 'Cloudflare output is missing worker/package.json for referenced worker bundles.',
|
|
309
|
-
path: workerPackagePath
|
|
310
|
-
});
|
|
311
|
-
if (manifest.bff?.runtimeFramework === 'effect' && !getEffectBffWorker(manifest)) addIssue(issues, {
|
|
312
|
-
code: 'missing-worker-bundle',
|
|
313
|
-
message: 'Cloudflare Effect BFF manifest points to a missing worker bundle.'
|
|
314
|
-
});
|
|
315
|
-
for (const workerReference of workerReferences){
|
|
316
|
-
const resolvedWorker = resolveWorkerBundleReference(issues, outputDirectory, workerReference, manifestPath);
|
|
317
|
-
if (!resolvedWorker) continue;
|
|
318
|
-
const workerExists = await pathExists(resolvedWorker.path);
|
|
319
|
-
if (!workerExists) addIssue(issues, {
|
|
320
|
-
code: 'missing-worker-bundle',
|
|
321
|
-
message: missingWorkerBundleMessage(workerReference),
|
|
322
|
-
path: resolvedWorker.path
|
|
323
|
-
});
|
|
324
|
-
if (workerExists && 'effect-bff' === resolvedWorker.kind) {
|
|
325
|
-
const workerSource = await promises_default().readFile(resolvedWorker.path, 'utf-8');
|
|
326
|
-
if (workerSource.includes(';entityKind;') || workerSource.includes(';entityKind,entityKind;')) addIssue(issues, {
|
|
327
|
-
code: 'invalid-worker-bundle',
|
|
328
|
-
message: 'Cloudflare Effect BFF worker bundle contains invalid Drizzle entityKind marker references.',
|
|
329
|
-
path: resolvedWorker.path
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
if (wrangler) {
|
|
335
|
-
assertEqual(issues, wrangler.main, outputPlan.wrangler.main, {
|
|
336
|
-
code: 'invalid-wrangler',
|
|
337
|
-
message: `wrangler.json main must be ${outputPlan.wrangler.main}.`,
|
|
338
|
-
path: wranglerPath
|
|
339
|
-
});
|
|
340
|
-
assertEqual(issues, wrangler.assets?.binding, outputPlan.wrangler.assets.binding, {
|
|
341
|
-
code: 'invalid-wrangler',
|
|
342
|
-
message: 'wrangler.json assets.binding must be ASSETS.',
|
|
343
|
-
path: wranglerPath
|
|
344
|
-
});
|
|
345
|
-
assertEqual(issues, wrangler.assets?.directory, outputPlan.wrangler.assets.directory, {
|
|
346
|
-
code: 'invalid-wrangler',
|
|
347
|
-
message: 'wrangler.json assets.directory must be ./public.',
|
|
348
|
-
path: wranglerPath
|
|
349
|
-
});
|
|
350
|
-
assertEqual(issues, wrangler.assets?.run_worker_first, outputPlan.wrangler.assets.run_worker_first, {
|
|
351
|
-
code: 'invalid-wrangler',
|
|
352
|
-
message: 'wrangler.json assets.run_worker_first must be true.',
|
|
353
|
-
path: wranglerPath
|
|
354
|
-
});
|
|
355
|
-
for (const flag of outputPlan.wrangler.requiredCompatibilityFlags)assertFlag(issues, wrangler.compatibility_flags, flag, {
|
|
356
|
-
code: 'invalid-wrangler',
|
|
357
|
-
message: `wrangler.json compatibility_flags must include ${flag}.`,
|
|
358
|
-
path: wranglerPath
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
if (outputPackage) assertEqual(issues, outputPackage.type, outputPlan.packages.output.type, {
|
|
362
|
-
code: 'invalid-package',
|
|
363
|
-
message: '.output/package.json must declare type module.',
|
|
364
|
-
path: packagePath
|
|
365
|
-
});
|
|
366
|
-
if (workerPackage) assertEqual(issues, workerPackage.type, outputPlan.packages.worker.type, {
|
|
367
|
-
code: 'invalid-package',
|
|
368
|
-
message: '.output/worker/package.json must declare type commonjs.',
|
|
369
|
-
path: workerPackagePath
|
|
370
|
-
});
|
|
371
|
-
for (const leakedPath of outputPlan.publicLeakDirectories){
|
|
372
|
-
const publicPath = external_node_path_default().join(outputPlan.paths.publicAssets, leakedPath);
|
|
373
|
-
if (await pathExists(publicPath)) addIssue(issues, {
|
|
374
|
-
code: 'public-output-leak',
|
|
375
|
-
message: `Framework-owned ${leakedPath} output leaked into public assets.`,
|
|
376
|
-
path: publicPath
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
if (false !== options.importWorker && await pathExists(outputPlan.paths.workerEntry)) await verifyWorkerImport(issues, outputPlan.paths.workerEntry);
|
|
380
|
-
return {
|
|
381
|
-
ok: 0 === issues.length,
|
|
382
|
-
issues
|
|
383
|
-
};
|
|
384
|
-
};
|
|
385
|
-
const assertCloudflareOutput = async (options)=>{
|
|
386
|
-
const result = await verifyCloudflareOutput(options);
|
|
387
|
-
if (!result.ok) throw new Error([
|
|
388
|
-
'Cloudflare output verification failed:',
|
|
389
|
-
...result.issues.map((issue)=>`- ${issue.code}: ${issue.message}${issue.path ? ` (${issue.path})` : ''}`)
|
|
390
|
-
].join('\n'));
|
|
391
|
-
};
|
|
392
|
-
exports.assertCloudflareOutput = __webpack_exports__.assertCloudflareOutput;
|
|
393
|
-
exports.verifyCloudflareOutput = __webpack_exports__.verifyCloudflareOutput;
|
|
394
|
-
exports.verifyCloudflareOutputMutationPolicy = __webpack_exports__.verifyCloudflareOutputMutationPolicy;
|
|
395
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
396
|
-
"assertCloudflareOutput",
|
|
397
|
-
"verifyCloudflareOutput",
|
|
398
|
-
"verifyCloudflareOutputMutationPolicy"
|
|
399
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
52
|
+
(()=>{
|
|
53
|
+
__webpack_require__.r(__webpack_exports__);
|
|
54
|
+
var _cloudflare_output_verifier_index__rspack_import_0 = __webpack_require__("./cloudflare-output-verifier/index");
|
|
55
|
+
var __rspack_reexport = {};
|
|
56
|
+
for(const __rspack_import_key in _cloudflare_output_verifier_index__rspack_import_0)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_cloudflare_output_verifier_index__rspack_import_0[__rspack_import_key];
|
|
57
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
58
|
+
})();
|
|
59
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
400
60
|
Object.defineProperty(exports, '__esModule', {
|
|
401
61
|
value: true
|
|
402
62
|
});
|