@bleedingdev/modern-js-ultramodern-create 3.9.0-ultramodern.12 → 3.9.0-ultramodern.13
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/README.md +32 -36
- package/dist/cjs/ultramodern-release-cohort.cjs +6 -21
- package/dist/cjs/ultramodern-tooling/commands/context.cjs +2 -1
- package/dist/cjs/ultramodern-tooling/commands/validate.cjs +2 -57
- package/dist/cjs/ultramodern-tooling/commands.cjs +11 -1
- package/dist/cjs/ultramodern-tooling/config/index.cjs +11 -4
- package/dist/cjs/ultramodern-tooling/config/load.cjs +4 -17
- package/dist/cjs/ultramodern-tooling/config/metadata.cjs +41 -2
- package/dist/cjs/ultramodern-tooling/config/normalize.cjs +121 -208
- package/dist/cjs/ultramodern-workspace/add-shell.cjs +51 -18
- package/dist/cjs/ultramodern-workspace/add-vertical/execute.cjs +40 -39
- package/dist/cjs/ultramodern-workspace/add-vertical/plan.cjs +1 -1
- package/dist/cjs/ultramodern-workspace/add-vertical/preflight.cjs +2 -8
- package/dist/cjs/ultramodern-workspace/add-vertical/topology.cjs +0 -32
- package/dist/cjs/ultramodern-workspace/add-vertical/workspace-state.cjs +3 -10
- package/dist/cjs/ultramodern-workspace/api/contracts.cjs +2 -2
- package/dist/cjs/ultramodern-workspace/api/rpc.cjs +16 -14
- package/dist/cjs/ultramodern-workspace/api/service.cjs +4 -8
- package/dist/cjs/ultramodern-workspace/api/shared.cjs +1 -1
- package/dist/cjs/ultramodern-workspace/backend-federation.cjs +3 -3
- package/dist/cjs/ultramodern-workspace/contracts.cjs +14 -183
- package/dist/cjs/ultramodern-workspace/delivery-unit-stamp.cjs +10 -5
- package/dist/cjs/ultramodern-workspace/delivery-unit-sync.cjs +27 -17
- package/dist/cjs/ultramodern-workspace/delivery-unit.cjs +11 -6
- package/dist/cjs/ultramodern-workspace/descriptors.cjs +0 -4
- package/dist/cjs/ultramodern-workspace/generation-result.cjs +1 -1
- package/dist/cjs/ultramodern-workspace/index.cjs +2 -5
- package/dist/cjs/ultramodern-workspace/mf-validation/constants.cjs +0 -6
- package/dist/cjs/ultramodern-workspace/mf-validation/discovery.cjs +6 -6
- package/dist/cjs/ultramodern-workspace/mf-validation/path-utils.cjs +37 -38
- package/dist/cjs/ultramodern-workspace/module-federation/config.cjs +8 -15
- package/dist/cjs/ultramodern-workspace/package-json.cjs +47 -54
- package/dist/cjs/ultramodern-workspace/patch-inventory.cjs +27 -36
- package/dist/cjs/ultramodern-workspace/policy.cjs +6 -354
- package/dist/cjs/ultramodern-workspace/public-surface.cjs +2 -2
- package/dist/cjs/ultramodern-workspace/routes.cjs +11 -7
- package/dist/cjs/ultramodern-workspace/shells.cjs +0 -70
- package/dist/cjs/ultramodern-workspace/tooling-command-catalog.cjs +6 -43
- package/dist/cjs/ultramodern-workspace/tsconfigs.cjs +3 -1
- package/dist/cjs/ultramodern-workspace/validation/architecture.cjs +5 -5
- package/dist/cjs/ultramodern-workspace/validation/workspace.cjs +275 -1249
- package/dist/cjs/ultramodern-workspace/versions.cjs +25 -41
- package/dist/cjs/ultramodern-workspace/workspace-artifact-ownership.cjs +1 -6
- package/dist/cjs/ultramodern-workspace/workspace-script-plan.cjs +7 -7
- package/dist/cjs/ultramodern-workspace/workspace-scripts.cjs +17 -112
- package/dist/cjs/ultramodern-workspace/workspace-validation-contract.cjs +62 -371
- package/dist/cjs/ultramodern-workspace/write-app.cjs +5 -4
- package/dist/cjs/ultramodern-workspace/write-workspace.cjs +10 -50
- package/dist/esm/ultramodern-release-cohort.js +5 -14
- package/dist/esm/ultramodern-tooling/commands/context.js +2 -1
- package/dist/esm/ultramodern-tooling/commands/validate.js +3 -48
- package/dist/esm/ultramodern-tooling/commands.js +10 -1
- package/dist/esm/ultramodern-tooling/config/index.js +1 -0
- package/dist/esm/ultramodern-tooling/config/load.js +5 -17
- package/dist/esm/ultramodern-tooling/config/metadata.js +36 -1
- package/dist/esm/ultramodern-tooling/config/normalize.js +125 -201
- package/dist/esm/ultramodern-workspace/add-shell.js +55 -22
- package/dist/esm/ultramodern-workspace/add-vertical/execute.js +41 -41
- package/dist/esm/ultramodern-workspace/add-vertical/plan.js +2 -2
- package/dist/esm/ultramodern-workspace/add-vertical/preflight.js +3 -6
- package/dist/esm/ultramodern-workspace/add-vertical/topology.js +1 -30
- package/dist/esm/ultramodern-workspace/add-vertical/workspace-state.js +3 -10
- package/dist/esm/ultramodern-workspace/api/contracts.js +2 -2
- package/dist/esm/ultramodern-workspace/api/rpc.js +16 -14
- package/dist/esm/ultramodern-workspace/api/service.js +4 -8
- package/dist/esm/ultramodern-workspace/api/shared.js +1 -1
- package/dist/esm/ultramodern-workspace/backend-federation.js +3 -3
- package/dist/esm/ultramodern-workspace/contracts.js +14 -180
- package/dist/esm/ultramodern-workspace/delivery-unit-stamp.js +10 -5
- package/dist/esm/ultramodern-workspace/delivery-unit-sync.js +28 -18
- package/dist/esm/ultramodern-workspace/delivery-unit.js +11 -6
- package/dist/esm/ultramodern-workspace/descriptors.js +1 -2
- package/dist/esm/ultramodern-workspace/generation-result.js +2 -2
- package/dist/esm/ultramodern-workspace/index.js +1 -1
- package/dist/esm/ultramodern-workspace/mf-validation/constants.js +1 -4
- package/dist/esm/ultramodern-workspace/mf-validation/discovery.js +7 -7
- package/dist/esm/ultramodern-workspace/mf-validation/path-utils.js +36 -34
- package/dist/esm/ultramodern-workspace/module-federation/config.js +9 -16
- package/dist/esm/ultramodern-workspace/package-json.js +48 -55
- package/dist/esm/ultramodern-workspace/patch-inventory.js +27 -36
- package/dist/esm/ultramodern-workspace/policy.js +6 -335
- package/dist/esm/ultramodern-workspace/public-surface.js +2 -2
- package/dist/esm/ultramodern-workspace/routes.js +11 -7
- package/dist/esm/ultramodern-workspace/shells.js +3 -67
- package/dist/esm/ultramodern-workspace/tooling-command-catalog.js +7 -41
- package/dist/esm/ultramodern-workspace/tsconfigs.js +4 -2
- package/dist/esm/ultramodern-workspace/validation/architecture.js +5 -5
- package/dist/esm/ultramodern-workspace/validation/workspace.js +267 -1250
- package/dist/esm/ultramodern-workspace/versions.js +24 -28
- package/dist/esm/ultramodern-workspace/workspace-artifact-ownership.js +3 -8
- package/dist/esm/ultramodern-workspace/workspace-script-plan.js +7 -7
- package/dist/esm/ultramodern-workspace/workspace-scripts.js +18 -107
- package/dist/esm/ultramodern-workspace/workspace-validation-contract.js +64 -373
- package/dist/esm/ultramodern-workspace/write-app.js +4 -3
- package/dist/esm/ultramodern-workspace/write-workspace.js +16 -53
- package/dist/esm-node/ultramodern-release-cohort.js +5 -14
- package/dist/esm-node/ultramodern-tooling/commands/context.js +2 -1
- package/dist/esm-node/ultramodern-tooling/commands/validate.js +3 -48
- package/dist/esm-node/ultramodern-tooling/commands.js +10 -1
- package/dist/esm-node/ultramodern-tooling/config/index.js +1 -0
- package/dist/esm-node/ultramodern-tooling/config/load.js +5 -17
- package/dist/esm-node/ultramodern-tooling/config/metadata.js +36 -1
- package/dist/esm-node/ultramodern-tooling/config/normalize.js +125 -201
- package/dist/esm-node/ultramodern-workspace/add-shell.js +55 -22
- package/dist/esm-node/ultramodern-workspace/add-vertical/execute.js +41 -41
- package/dist/esm-node/ultramodern-workspace/add-vertical/plan.js +2 -2
- package/dist/esm-node/ultramodern-workspace/add-vertical/preflight.js +3 -6
- package/dist/esm-node/ultramodern-workspace/add-vertical/topology.js +1 -30
- package/dist/esm-node/ultramodern-workspace/add-vertical/workspace-state.js +3 -10
- package/dist/esm-node/ultramodern-workspace/api/contracts.js +2 -2
- package/dist/esm-node/ultramodern-workspace/api/rpc.js +16 -14
- package/dist/esm-node/ultramodern-workspace/api/service.js +4 -8
- package/dist/esm-node/ultramodern-workspace/api/shared.js +1 -1
- package/dist/esm-node/ultramodern-workspace/backend-federation.js +3 -3
- package/dist/esm-node/ultramodern-workspace/contracts.js +14 -180
- package/dist/esm-node/ultramodern-workspace/delivery-unit-stamp.js +10 -5
- package/dist/esm-node/ultramodern-workspace/delivery-unit-sync.js +28 -18
- package/dist/esm-node/ultramodern-workspace/delivery-unit.js +11 -6
- package/dist/esm-node/ultramodern-workspace/descriptors.js +1 -2
- package/dist/esm-node/ultramodern-workspace/generation-result.js +2 -2
- package/dist/esm-node/ultramodern-workspace/index.js +1 -1
- package/dist/esm-node/ultramodern-workspace/mf-validation/constants.js +1 -4
- package/dist/esm-node/ultramodern-workspace/mf-validation/discovery.js +7 -7
- package/dist/esm-node/ultramodern-workspace/mf-validation/path-utils.js +36 -34
- package/dist/esm-node/ultramodern-workspace/module-federation/config.js +9 -16
- package/dist/esm-node/ultramodern-workspace/package-json.js +48 -55
- package/dist/esm-node/ultramodern-workspace/patch-inventory.js +27 -36
- package/dist/esm-node/ultramodern-workspace/policy.js +6 -335
- package/dist/esm-node/ultramodern-workspace/public-surface.js +2 -2
- package/dist/esm-node/ultramodern-workspace/routes.js +11 -7
- package/dist/esm-node/ultramodern-workspace/shells.js +3 -67
- package/dist/esm-node/ultramodern-workspace/tooling-command-catalog.js +7 -41
- package/dist/esm-node/ultramodern-workspace/tsconfigs.js +4 -2
- package/dist/esm-node/ultramodern-workspace/validation/architecture.js +5 -5
- package/dist/esm-node/ultramodern-workspace/validation/workspace.js +267 -1250
- package/dist/esm-node/ultramodern-workspace/versions.js +24 -28
- package/dist/esm-node/ultramodern-workspace/workspace-artifact-ownership.js +3 -8
- package/dist/esm-node/ultramodern-workspace/workspace-script-plan.js +7 -7
- package/dist/esm-node/ultramodern-workspace/workspace-scripts.js +18 -107
- package/dist/esm-node/ultramodern-workspace/workspace-validation-contract.js +64 -373
- package/dist/esm-node/ultramodern-workspace/write-app.js +4 -3
- package/dist/esm-node/ultramodern-workspace/write-workspace.js +16 -53
- package/dist/types/ultramodern-release-cohort.d.ts +1 -3
- package/dist/types/ultramodern-tooling/commands/validate.d.ts +2 -2
- package/dist/types/ultramodern-tooling/config/index.d.ts +1 -0
- package/dist/types/ultramodern-tooling/config/load.d.ts +6 -58
- package/dist/types/ultramodern-tooling/config/metadata.d.ts +3 -0
- package/dist/types/ultramodern-tooling/config/normalize.d.ts +9 -90
- package/dist/types/ultramodern-tooling/config/types.d.ts +1 -9
- package/dist/types/ultramodern-workspace/add-vertical/preflight.d.ts +3 -3
- package/dist/types/ultramodern-workspace/add-vertical/topology.d.ts +0 -1
- package/dist/types/ultramodern-workspace/add-vertical/workspace-state.d.ts +1 -1
- package/dist/types/ultramodern-workspace/api/rpc.d.ts +1 -1
- package/dist/types/ultramodern-workspace/contracts.d.ts +1 -3
- package/dist/types/ultramodern-workspace/delivery-unit-stamp.d.ts +2 -2
- package/dist/types/ultramodern-workspace/delivery-unit.d.ts +2 -2
- package/dist/types/ultramodern-workspace/descriptors.d.ts +0 -1
- package/dist/types/ultramodern-workspace/index.d.ts +1 -1
- package/dist/types/ultramodern-workspace/mf-validation/constants.d.ts +0 -1
- package/dist/types/ultramodern-workspace/mf-validation/path-utils.d.ts +2 -3
- package/dist/types/ultramodern-workspace/module-federation/config.d.ts +1 -1
- package/dist/types/ultramodern-workspace/patch-inventory.d.ts +2 -10
- package/dist/types/ultramodern-workspace/policy.d.ts +60 -182
- package/dist/types/ultramodern-workspace/shells.d.ts +1 -14
- package/dist/types/ultramodern-workspace/tooling-command-catalog.d.ts +1 -6
- package/dist/types/ultramodern-workspace/validation/types.d.ts +1 -12
- package/dist/types/ultramodern-workspace/validation/workspace.d.ts +5 -2
- package/dist/types/ultramodern-workspace/versions.d.ts +23 -27
- package/dist/types/ultramodern-workspace/workspace-script-plan.d.ts +1 -1
- package/dist/types/ultramodern-workspace/workspace-scripts.d.ts +7 -14
- package/dist/types/ultramodern-workspace/workspace-validation-contract.d.ts +22 -188
- package/dist/types/ultramodern-workspace/write-workspace.d.ts +1 -3
- package/package.json +17 -16
- package/{template-workspace/.modernjs/release-cohort.json → release-cohort.json} +48 -48
- package/template-workspace/README.md.handlebars +9 -16
- package/template-workspace/pnpm-workspace.yaml.handlebars +0 -24
- package/templates/workspace/apps/modern.config.ts.handlebars +5 -5
- package/templates/workspace/apps/shared/src/routes/ultramodern-route-metadata.ts.handlebars +8 -21
- package/templates/workspace-scripts/generate-node-backend-federation.mjs +39 -49
- package/templates/workspace-scripts/generate-public-surface-assets.mjs +142 -206
- package/templates/workspace-scripts/materialize-zerops-runtime.mjs +3 -11
- package/templates/workspace-scripts/proof-cloudflare-version.mjs +53 -444
- package/templates/workspace-scripts/proof-node-backend-federation.mjs +193 -39
- package/templates/workspace-scripts/proof-workerd-ssr.mjs +126 -66
- package/templates/workspace-scripts/ultramodern-performance-readiness.mjs +45 -147
- package/dist/cjs/ultramodern-workspace/cohort-parity.cjs +0 -129
- package/dist/cjs/ultramodern-workspace/patch-parity.cjs +0 -163
- package/dist/esm/ultramodern-workspace/cohort-parity.js +0 -74
- package/dist/esm/ultramodern-workspace/patch-parity.js +0 -99
- package/dist/esm-node/ultramodern-workspace/cohort-parity.js +0 -75
- package/dist/esm-node/ultramodern-workspace/patch-parity.js +0 -100
- package/dist/types/ultramodern-workspace/cohort-parity.d.ts +0 -31
- package/dist/types/ultramodern-workspace/patch-parity.d.ts +0 -39
- package/template-workspace/patches/@module-federation__bridge-react@2.9.0.patch +0 -47
- package/template-workspace/patches/@module-federation__dts-plugin@2.9.0.patch +0 -132
- package/template-workspace/patches/@module-federation__modern-js-v3@2.9.0.patch +0 -287
- package/template-workspace/patches/@module-federation__runtime-core@2.9.0.patch +0 -13
- package/template-workspace/patches/drizzle-orm-ts7-strict-declarations.patch +0 -471
- package/template-workspace/patches/msgpackr@2.1.0.patch +0 -30
- package/template-workspace/patches/zod@4.5.4.patch +0 -56
- package/templates/packages/effect-bff-runtime.ts +0 -2
|
@@ -37,1279 +37,305 @@ var __webpack_require__ = {};
|
|
|
37
37
|
var __webpack_exports__ = {};
|
|
38
38
|
__webpack_require__.r(__webpack_exports__);
|
|
39
39
|
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
validateApiClientExports: ()=>validateApiClientExports,
|
|
41
|
+
validateApiOnlySourceSurface: ()=>validateApiOnlySourceSurface,
|
|
42
|
+
validateBackendFederationEntrypoints: ()=>validateBackendFederationEntrypoints,
|
|
40
43
|
validateWorkspace: ()=>validateWorkspace
|
|
41
44
|
});
|
|
42
|
-
const external_node_child_process_namespaceObject = require("node:child_process");
|
|
43
45
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
44
46
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
45
47
|
const external_node_path_namespaceObject = require("node:path");
|
|
46
48
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const external_workspace_script_plan_cjs_namespaceObject = require("../workspace-script-plan.cjs");
|
|
49
|
+
const utils_namespaceObject = require("@modern-js/utils");
|
|
50
|
+
const external_ultramodern_release_cohort_cjs_namespaceObject = require("../../ultramodern-release-cohort.cjs");
|
|
50
51
|
const external_architecture_cjs_namespaceObject = require("./architecture.cjs");
|
|
51
|
-
|
|
52
|
+
function assert(condition, message) {
|
|
53
|
+
if (!condition) throw new Error(message);
|
|
54
|
+
}
|
|
55
|
+
function record(value, label) {
|
|
56
|
+
assert(null !== value && 'object' == typeof value && !Array.isArray(value), `${label} must be an object`);
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
function entries(value, label) {
|
|
60
|
+
assert(Array.isArray(value), `${label} must be an array`);
|
|
61
|
+
return value.map((entry, index)=>record(entry, `${label}[${index}]`));
|
|
62
|
+
}
|
|
63
|
+
function distinct(values, label) {
|
|
64
|
+
assert(new Set(values).size === values.length, `${label} contains duplicate entries`);
|
|
65
|
+
}
|
|
66
|
+
function requiredFile(root, relative, label) {
|
|
67
|
+
assert(external_node_fs_default().existsSync(external_node_path_default().join(root, relative)), `${label} is missing: ${relative}`);
|
|
68
|
+
}
|
|
69
|
+
function developmentUrl(value, port, label, generatedPath) {
|
|
70
|
+
assert('string' == typeof value, `${label} must be a URL`);
|
|
71
|
+
let parsed;
|
|
72
|
+
try {
|
|
73
|
+
parsed = new URL(value);
|
|
74
|
+
} catch {
|
|
75
|
+
throw new Error(`${label} must be a URL`);
|
|
76
|
+
}
|
|
77
|
+
assert([
|
|
78
|
+
'http:',
|
|
79
|
+
'https:'
|
|
80
|
+
].includes(parsed.protocol) && parsed.hostname.length > 0, `${label} must be an HTTP URL`);
|
|
81
|
+
if (generatedPath && parsed.pathname === generatedPath && ('localhost' === parsed.hostname || '127.0.0.1' === parsed.hostname)) assert(Number(parsed.port) === port, `${label} must use the app development port ${port}`);
|
|
82
|
+
return parsed;
|
|
83
|
+
}
|
|
84
|
+
function safePath(root, relative, label) {
|
|
85
|
+
assert('string' == typeof relative && relative.length > 0 && !external_node_path_default().isAbsolute(relative), `${label} must be a relative path`);
|
|
86
|
+
const resolved = external_node_path_default().resolve(root, relative);
|
|
87
|
+
assert(resolved.startsWith(`${external_node_path_default().resolve(root)}${external_node_path_default().sep}`), `${label} leaves the workspace`);
|
|
88
|
+
const realRoot = external_node_fs_default().realpathSync(root);
|
|
89
|
+
const real = external_node_fs_default().realpathSync(resolved);
|
|
90
|
+
assert(real.startsWith(`${realRoot}${external_node_path_default().sep}`), `${label} resolves outside the workspace`);
|
|
91
|
+
return resolved;
|
|
92
|
+
}
|
|
93
|
+
function validateApiClientExports(root, appPath, appId, exports1) {
|
|
94
|
+
const clients = [
|
|
95
|
+
'./api/client',
|
|
96
|
+
'./api/rpc-client'
|
|
97
|
+
].map((key)=>exports1?.[key]).filter((value)=>void 0 !== value);
|
|
98
|
+
assert(clients.length > 0, `${appId} must export its API client`);
|
|
99
|
+
for (const client of clients){
|
|
100
|
+
assert('string' == typeof client && client.startsWith('./') && !client.split(/[\\/]/u).includes('..') && /\.[cm]?[jt]sx?$/u.test(client), `${appId} must export its API client from an app-owned source module`);
|
|
101
|
+
assert(external_node_fs_default().existsSync(external_node_path_default().join(root, appPath, client)), `${appId} API client is missing: ${client}`);
|
|
102
|
+
const clientFile = safePath(external_node_path_default().join(root, appPath), client, `${appId} API client`);
|
|
103
|
+
assert(external_node_fs_default().statSync(clientFile).isFile(), `${appId} API client must be a file`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function validateApiOnlySourceSurface(root, app) {
|
|
107
|
+
assert(!Object.hasOwn(app.backendFederation?.versionBoundary ?? {}, 'ui'), `topology/reference-topology.json verticals.${app.id}.backendFederation must omit the UI boundary for an api-only unit`);
|
|
108
|
+
for (const relative of [
|
|
109
|
+
'module-federation.config.ts',
|
|
110
|
+
'src/federation-entry.tsx',
|
|
111
|
+
`src/components/${app.id}-widget.tsx`,
|
|
112
|
+
'src/routes/layout.tsx',
|
|
113
|
+
'src/routes/[lang]/page.tsx',
|
|
114
|
+
'src/routes/[lang]/route.meta.ts',
|
|
115
|
+
'src/routes/ultramodern-route-metadata.ts',
|
|
116
|
+
'src/routes/ultramodern-route-head.tsx',
|
|
117
|
+
'src/routes/index.css'
|
|
118
|
+
])assert(!external_node_fs_default().existsSync(external_node_path_default().join(root, app.path, relative)), `Unexpected ${app.path}/${relative} for a api-only unit`);
|
|
119
|
+
const mfTypesPath = external_node_path_default().join(root, app.path, 'tsconfig.mf-types.json');
|
|
120
|
+
if (external_node_fs_default().existsSync(mfTypesPath)) {
|
|
121
|
+
const mfTypes = record(JSON.parse(external_node_fs_default().readFileSync(mfTypesPath, 'utf8')), `${app.id} tsconfig.mf-types.json`);
|
|
122
|
+
assert(!mfTypes.include?.includes('src/federation-entry.tsx'), `${app.id}: restore the generated MicroVertical Module Federation DTS boundary`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function validateBackendFederationEntrypoints(root, appPath, appId) {
|
|
126
|
+
for (const relative of [
|
|
127
|
+
'backend-federation.config.ts',
|
|
128
|
+
'api/index.ts',
|
|
129
|
+
'api/effect-api.ts'
|
|
130
|
+
])requiredFile(root, `${appPath}/${relative}`, `${appId} API surface`);
|
|
131
|
+
}
|
|
52
132
|
function validateWorkspace(root, expected) {
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const compactConfigPath = workspaceValidationContract.metadata.compactConfig.path;
|
|
72
|
-
const retiredMetadataPaths = workspaceValidationContract.legacy.retiredMetadataPaths;
|
|
73
|
-
const modernPackageCohort = workspaceValidationContract.cohort.modernPackages;
|
|
74
|
-
const expectedAdditionalShellIds = workspaceValidationContract.cohort.additionalShellIds ?? [];
|
|
75
|
-
const expectedAdditionalShells = workspaceValidationContract.additionalShells ?? [];
|
|
76
|
-
const expectedPrimaryShellVerticalIds = workspaceValidationContract.topology?.referenceTopology?.shell?.verticalRefs ?? workspaceValidationContract.cohort.verticalIds;
|
|
77
|
-
const expectedReleaseCohort = workspaceValidationContract.cohort.releaseCohort;
|
|
78
|
-
const readText = (relativePath)=>external_node_fs_default().readFileSync(external_node_path_default().join(root, relativePath), 'utf-8');
|
|
79
|
-
const readJson = (relativePath)=>JSON.parse(readText(relativePath));
|
|
80
|
-
const expectedModernPackageSpecifier = (packageName)=>{
|
|
81
|
-
if ('workspace' === packageSource.strategy) return 'workspace:*';
|
|
82
|
-
const aliases = packageSource.modernPackages?.aliases ?? {};
|
|
83
|
-
const alias = aliases[packageName];
|
|
84
|
-
const specifier = packageSource.modernPackages?.specifier;
|
|
85
|
-
return 'string' == typeof alias ? `npm:${alias}@${specifier}` : specifier;
|
|
86
|
-
};
|
|
87
|
-
const assertPortableGeneratedEnvironmentScripts = (packageJson, label)=>{
|
|
88
|
-
const build = packageJson.scripts?.build ?? '';
|
|
89
|
-
const cloudflareBuild = packageJson.scripts?.['cloudflare:build'] ?? '';
|
|
90
|
-
(0, external_assertions_cjs_namespaceObject.assert)(build.includes('cross-env MODERNJS_DEPLOY=node modern deploy --skip-build'), `${label} build must use cross-env for its Node deploy`);
|
|
91
|
-
(0, external_assertions_cjs_namespaceObject.assert)(cloudflareBuild.includes('cross-env MODERNJS_DEPLOY=cloudflare modern build'), `${label} cloudflare:build must use cross-env for Modern build`);
|
|
92
|
-
(0, external_assertions_cjs_namespaceObject.assert)(cloudflareBuild.includes('cross-env MODERNJS_DEPLOY=cloudflare modern deploy --skip-build'), `${label} cloudflare:build must use cross-env for Modern deploy`);
|
|
93
|
-
(0, external_assertions_cjs_namespaceObject.assert)(!/(?:^|\s+&&\s+)MODERNJS_DEPLOY=/u.test(build), `${label} build must not use a POSIX-only environment prefix`);
|
|
94
|
-
(0, external_assertions_cjs_namespaceObject.assert)(!/(?:^|\s+&&\s+)MODERNJS_DEPLOY=/u.test(cloudflareBuild), `${label} cloudflare:build must not use a POSIX-only environment prefix`);
|
|
95
|
-
};
|
|
96
|
-
const assertExists = (relativePath)=>{
|
|
97
|
-
(0, external_assertions_cjs_namespaceObject.assert)(external_node_fs_default().existsSync(external_node_path_default().join(root, relativePath)), `Missing ${relativePath}`);
|
|
98
|
-
};
|
|
99
|
-
const assertNotExists = (relativePath)=>{
|
|
100
|
-
(0, external_assertions_cjs_namespaceObject.assert)(!external_node_fs_default().existsSync(external_node_path_default().join(root, relativePath)), `Unexpected ${relativePath}`);
|
|
101
|
-
};
|
|
102
|
-
const assertAnyOf = (relativePaths)=>{
|
|
103
|
-
(0, external_assertions_cjs_namespaceObject.assert)(relativePaths.some((relativePath)=>external_node_fs_default().existsSync(external_node_path_default().join(root, relativePath))), `Missing one of: ${relativePaths.join(', ')}`);
|
|
104
|
-
};
|
|
105
|
-
const assertWorkspaceValidationContract = (contract)=>{
|
|
106
|
-
(0, external_assertions_cjs_namespaceObject.assert)(null !== contract && 'object' == typeof contract && !Array.isArray(contract), 'Workspace validation contract must be a JSON object');
|
|
107
|
-
(0, external_assertions_cjs_namespaceObject.assert)(2 === contract.schemaVersion, `Unsupported workspace validation contract schemaVersion ${(0, external_assertions_cjs_namespaceObject.formatJson)(contract.schemaVersion)}; expected 2`);
|
|
108
|
-
(0, external_assertions_cjs_namespaceObject.assert)('modernjs.ultramodern-workspace-validation-contract' === contract.kind, `Unsupported workspace validation contract kind ${(0, external_assertions_cjs_namespaceObject.formatJson)(contract.kind)}`);
|
|
109
|
-
const metadataEntries = Object.entries(contract.metadata ?? {});
|
|
110
|
-
(0, external_assertions_cjs_namespaceObject.assert)(metadataEntries.length === (contract.cohort?.releaseCohort ? 5 : 4), 'Workspace validation contract must declare every structured metadata input');
|
|
111
|
-
for (const [name, metadata] of metadataEntries){
|
|
112
|
-
(0, external_assertions_cjs_namespaceObject.assert)('string' == typeof metadata?.path && metadata.path.length > 0, `Workspace validation contract metadata.${name}.path is required`);
|
|
113
|
-
(0, external_assertions_cjs_namespaceObject.assert)(1 === metadata.schemaVersion, `Unsupported expected metadata schemaVersion ${(0, external_assertions_cjs_namespaceObject.formatJson)(metadata.schemaVersion)} for ${name}`);
|
|
114
|
-
}
|
|
115
|
-
(0, external_assertions_cjs_namespaceObject.assertUniqueStrings)(contract.cohort?.modernPackages, 'workspace validation contract Modern package cohort');
|
|
116
|
-
(0, external_assertions_cjs_namespaceObject.assertUniqueStrings)(contract.cohort?.appIds, 'workspace validation contract app cohort');
|
|
117
|
-
(0, external_assertions_cjs_namespaceObject.assertUniqueStrings)(contract.cohort?.additionalShellIds ?? [], 'workspace validation contract additional-shell cohort');
|
|
118
|
-
for (const [field, label] of [
|
|
119
|
-
[
|
|
120
|
-
'additionalShellOwnerIds',
|
|
121
|
-
'workspace validation contract additional-shell owner cohort'
|
|
122
|
-
],
|
|
123
|
-
[
|
|
124
|
-
'additionalShellDeliveryUnitIds',
|
|
125
|
-
'workspace validation contract additional-shell delivery-unit cohort'
|
|
126
|
-
],
|
|
127
|
-
[
|
|
128
|
-
'additionalShellDegradedStateIds',
|
|
129
|
-
'workspace validation contract additional-shell degraded-state cohort'
|
|
130
|
-
],
|
|
131
|
-
[
|
|
132
|
-
'additionalShellBuildMarkerIds',
|
|
133
|
-
'workspace validation contract additional-shell build-marker cohort'
|
|
134
|
-
]
|
|
135
|
-
])(0, external_assertions_cjs_namespaceObject.assertUniqueStrings)(contract.cohort?.[field] ?? [], label);
|
|
136
|
-
(0, external_assertions_cjs_namespaceObject.assertUniqueStrings)(contract.cohort?.backendAppIds, 'workspace validation contract backend app cohort');
|
|
137
|
-
(0, external_assertions_cjs_namespaceObject.assertUniqueStrings)(contract.cohort?.verticalIds, 'workspace validation contract vertical cohort');
|
|
138
|
-
(0, external_assertions_cjs_namespaceObject.assertUniqueStrings)(contract.cohort?.sharedPackageIds, 'workspace validation contract shared package cohort');
|
|
139
|
-
(0, external_assertions_cjs_namespaceObject.assertUniqueStrings)(contract.cohort?.ownerIds, 'workspace validation contract owner cohort');
|
|
140
|
-
(0, external_assertions_cjs_namespaceObject.assertUniqueIdEntries)(contract.cohort?.packageManifests, 'workspace validation contract package manifests');
|
|
141
|
-
(0, external_assertions_cjs_namespaceObject.assertUniqueStrings)((contract.cohort?.packageManifests ?? []).map((manifest)=>manifest.path), 'workspace validation contract package manifest paths');
|
|
142
|
-
const evidencePolicy = contract.validationEvidencePolicy;
|
|
143
|
-
(0, external_assertions_cjs_namespaceObject.assert)(evidencePolicy?.schemaVersion === 1, `Unsupported validation evidence policy schemaVersion ${(0, external_assertions_cjs_namespaceObject.formatJson)(evidencePolicy?.schemaVersion)}; expected 1`);
|
|
144
|
-
(0, external_assertions_cjs_namespaceObject.assertUniqueIdEntries)(evidencePolicy?.required, 'workspace validation contract evidence requirements');
|
|
145
|
-
const requiredEvidence = new Map([
|
|
146
|
-
[
|
|
147
|
-
"typescript-compiler",
|
|
148
|
-
'compiler'
|
|
149
|
-
],
|
|
150
|
-
[
|
|
151
|
-
'architecture-compiler',
|
|
152
|
-
'compiler'
|
|
153
|
-
],
|
|
154
|
-
[
|
|
155
|
-
'executable-modern-config',
|
|
156
|
-
'runtime'
|
|
157
|
-
],
|
|
158
|
-
[
|
|
159
|
-
'executable-runtime-config',
|
|
160
|
-
'runtime'
|
|
161
|
-
],
|
|
162
|
-
[
|
|
163
|
-
'executable-module-federation-config',
|
|
164
|
-
'runtime'
|
|
165
|
-
],
|
|
166
|
-
[
|
|
167
|
-
'executable-build-facade',
|
|
168
|
-
'runtime'
|
|
169
|
-
],
|
|
170
|
-
[
|
|
171
|
-
'structured-package-config',
|
|
172
|
-
'structured'
|
|
173
|
-
],
|
|
174
|
-
[
|
|
175
|
-
'structured-deploy-config',
|
|
176
|
-
'structured'
|
|
177
|
-
],
|
|
178
|
-
[
|
|
179
|
-
'public-behavior-gates',
|
|
180
|
-
'behavior'
|
|
181
|
-
]
|
|
182
|
-
]);
|
|
183
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(evidencePolicy.required, [
|
|
184
|
-
...requiredEvidence
|
|
185
|
-
].map(([id, kind])=>({
|
|
186
|
-
id,
|
|
187
|
-
kind
|
|
188
|
-
})), 'workspace validation contract evidence requirements', 'restore the complete compiler, runtime, structured-data, and behavior evidence set');
|
|
189
|
-
for (const evidence of evidencePolicy.required)(0, external_assertions_cjs_namespaceObject.assert)(requiredEvidence.get(evidence.id) === evidence.kind, `Unsupported validation evidence ${(0, external_assertions_cjs_namespaceObject.formatJson)(evidence)}`);
|
|
190
|
-
};
|
|
191
|
-
const assertAdditionalShellContractShape = ()=>{
|
|
192
|
-
if ((workspaceValidationContract.cohort?.additionalShellIds ?? []).length > 0) {
|
|
193
|
-
for (const field of [
|
|
194
|
-
'additionalShellOwnerIds',
|
|
195
|
-
'additionalShellDeliveryUnitIds',
|
|
196
|
-
'additionalShellDegradedStateIds',
|
|
197
|
-
'additionalShellBuildMarkerIds'
|
|
198
|
-
])(0, external_assertions_cjs_namespaceObject.assertSameJson)(workspaceValidationContract.cohort?.[field], workspaceValidationContract.cohort.additionalShellIds, `workspace validation contract ${field}`, 'restore every generated additional-shell cohort');
|
|
199
|
-
(0, external_assertions_cjs_namespaceObject.assertSameIdCohort)(workspaceValidationContract.cohort?.additionalShellManifests, workspaceValidationContract.cohort.additionalShellIds, 'workspace validation contract additional-shell manifests', 'restore every generated additional-shell package manifest');
|
|
200
|
-
(0, external_assertions_cjs_namespaceObject.assertSameIdCohort)(workspaceValidationContract.additionalShells, workspaceValidationContract.cohort.additionalShellIds, 'workspace validation contract additional-shell records', 'restore every generated additional-shell contract record');
|
|
201
|
-
} else {
|
|
202
|
-
(0, external_assertions_cjs_namespaceObject.assert)(workspaceValidationContract.cohort?.additionalShellManifests === void 0, 'Single-shell workspace must not declare additional-shell manifests');
|
|
203
|
-
(0, external_assertions_cjs_namespaceObject.assert)(void 0 === workspaceValidationContract.additionalShells, 'Single-shell workspace must not declare additional-shell records');
|
|
204
|
-
for (const field of [
|
|
205
|
-
'additionalShellOwnerIds',
|
|
206
|
-
'additionalShellDeliveryUnitIds',
|
|
207
|
-
'additionalShellDegradedStateIds',
|
|
208
|
-
'additionalShellBuildMarkerIds'
|
|
209
|
-
])(0, external_assertions_cjs_namespaceObject.assert)(workspaceValidationContract.cohort?.[field] === void 0, `Single-shell workspace must not declare ${field}`);
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
const assertStructuredWorkspaceMetadata = ({ ultramodernConfig, topology, ownership, overlay })=>{
|
|
213
|
-
const observedMetadata = [
|
|
214
|
-
{
|
|
215
|
-
contract: workspaceValidationContract.metadata.compactConfig,
|
|
216
|
-
value: ultramodernConfig
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
contract: workspaceValidationContract.metadata.referenceTopology,
|
|
220
|
-
value: topology
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
contract: workspaceValidationContract.metadata.ownership,
|
|
224
|
-
value: ownership
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
contract: workspaceValidationContract.metadata.developmentOverlay,
|
|
228
|
-
value: overlay
|
|
229
|
-
}
|
|
230
|
-
];
|
|
231
|
-
for (const entry of observedMetadata){
|
|
232
|
-
(0, external_assertions_cjs_namespaceObject.assert)(null !== entry.value && 'object' == typeof entry.value && !Array.isArray(entry.value), `${entry.contract.path} must contain a JSON object`);
|
|
233
|
-
(0, external_assertions_cjs_namespaceObject.assert)(Number.isInteger(entry.value.schemaVersion), `${entry.contract.path} must declare an integer schemaVersion`);
|
|
234
|
-
}
|
|
235
|
-
const observedSchemaVersions = new Set(observedMetadata.map((entry)=>entry.value.schemaVersion));
|
|
236
|
-
(0, external_assertions_cjs_namespaceObject.assert)(1 === observedSchemaVersions.size, `Mixed workspace metadata schema versions: ${observedMetadata.map((entry)=>`${entry.contract.path}=${entry.value.schemaVersion}`).join(', ')}`);
|
|
237
|
-
for (const entry of observedMetadata)(0, external_assertions_cjs_namespaceObject.assert)(entry.value.schemaVersion === entry.contract.schemaVersion, `Unsupported workspace metadata schemaVersion ${entry.value.schemaVersion} at ${entry.contract.path}; expected ${entry.contract.schemaVersion}`);
|
|
238
|
-
(0, external_assertions_cjs_namespaceObject.assertObject)(ultramodernConfig.packageSource, `${compactConfigPath} packageSource`, 'restore generated compact package-source metadata');
|
|
239
|
-
for (const field of workspaceValidationContract.legacy.forbiddenCompactConfigFields)(0, external_assertions_cjs_namespaceObject.assert)(!Object.hasOwn(ultramodernConfig, field), `Stale legacy field ${compactConfigPath}.${field} is forbidden`);
|
|
240
|
-
for (const field of workspaceValidationContract.legacy.forbiddenPackageSourceFields)(0, external_assertions_cjs_namespaceObject.assert)(!Object.hasOwn(ultramodernConfig.packageSource, field), `Stale legacy field ${compactConfigPath}.packageSource.${field} is forbidden`);
|
|
241
|
-
for (const field of workspaceValidationContract.legacy.forbiddenTopologyFields)(0, external_assertions_cjs_namespaceObject.assert)(!Object.hasOwn(topology, field), `Stale legacy field ${workspaceValidationContract.metadata.referenceTopology.path}.${field} is forbidden`);
|
|
242
|
-
(0, external_assertions_cjs_namespaceObject.assertSameIdCohort)(ultramodernConfig.topology?.apps, workspaceValidationContract.cohort.appIds, `${compactConfigPath} topology.apps`, 'restore the complete generated app cohort');
|
|
243
|
-
(0, external_assertions_cjs_namespaceObject.assertSameIdCohort)(ultramodernConfig.moduleFederation?.apps, workspaceValidationContract.cohort.appIds, `${compactConfigPath} moduleFederation.apps`, 'restore the complete generated Module Federation app cohort');
|
|
244
|
-
(0, external_assertions_cjs_namespaceObject.assertSameIdCohort)(ultramodernConfig.backendFederation?.apps, workspaceValidationContract.cohort.backendAppIds, `${compactConfigPath} backendFederation.apps`, 'restore the complete generated backend app cohort');
|
|
245
|
-
(0, external_assertions_cjs_namespaceObject.assertSameIdCohort)(topology.verticals, workspaceValidationContract.cohort.verticalIds, `${workspaceValidationContract.metadata.referenceTopology.path} verticals`, 'restore the complete generated vertical cohort');
|
|
246
|
-
(0, external_assertions_cjs_namespaceObject.assertUniqueIdEntries)(topology.sharedPackages, 'topology.sharedPackages');
|
|
247
|
-
(0, external_assertions_cjs_namespaceObject.assertIncludesJson)(topology.sharedPackages.map((entry)=>entry.id), workspaceValidationContract.cohort.sharedPackageIds, 'topology.sharedPackages', 'restore required framework ownership entries');
|
|
248
|
-
(0, external_assertions_cjs_namespaceObject.assertSameIdCohort)(topology.shell?.moduleFederation?.remotes, workspaceValidationContract.topology.referenceTopology.shell.moduleFederation.remotes.map((remote)=>remote.id), `${workspaceValidationContract.metadata.referenceTopology.path} shell.moduleFederation.remotes`, 'restore the complete generated shell remote cohort');
|
|
249
|
-
(0, external_assertions_cjs_namespaceObject.assertUniqueIdEntries)(ownership.owners, 'ownership.owners');
|
|
250
|
-
(0, external_assertions_cjs_namespaceObject.assertIncludesJson)(ownership.owners.map((entry)=>entry.id), workspaceValidationContract.cohort.ownerIds, 'ownership.owners', 'restore required framework ownership entries');
|
|
251
|
-
for (const entry of [
|
|
252
|
-
...topology.sharedPackages,
|
|
253
|
-
...ownership.owners
|
|
254
|
-
]){
|
|
255
|
-
(0, external_assertions_cjs_namespaceObject.assert)('string' == typeof entry.path && entry.path.length > 0, `${entry.id} must declare a package path`);
|
|
256
|
-
(0, external_assertions_cjs_namespaceObject.assert)(readJson(`${entry.path}/package.json`).name === entry.package, `${entry.id} ownership package must match ${entry.path}/package.json`);
|
|
257
|
-
}
|
|
258
|
-
for (const manifest of workspaceValidationContract.cohort.packageManifests){
|
|
259
|
-
assertExists(manifest.path);
|
|
260
|
-
const packageJson = readJson(manifest.path);
|
|
261
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageJson.name === manifest.packageName, `${manifest.path} package name must be ${manifest.packageName}`);
|
|
262
|
-
if ('shell' === manifest.role || 'vertical' === manifest.role) (0, external_assertions_cjs_namespaceObject.assert)(packageJson.modernjs?.appId === manifest.id, `${manifest.path} modernjs.appId must be ${manifest.id}`);
|
|
263
|
-
}
|
|
264
|
-
if (expectedReleaseCohort) {
|
|
265
|
-
const releaseCohortContract = workspaceValidationContract.metadata.releaseCohort;
|
|
266
|
-
(0, external_assertions_cjs_namespaceObject.assertSelfCheck)(releaseCohortContract?.path === '.modernjs/release-cohort.json', 'authenticated release cohort projection', 'Expected release-cohort metadata path is missing or invalid', '.modernjs/release-cohort.json');
|
|
267
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(readJson(releaseCohortContract.path), expectedReleaseCohort, 'authenticated release cohort projection', releaseCohortContract.path);
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
const findById = (entries, id)=>Array.isArray(entries) ? entries.find((entry)=>entry?.id === id) : void 0;
|
|
271
|
-
const generatedContractLabel = compactConfigPath;
|
|
272
|
-
const deliveryUnitIdentityFixArea = 'regenerate vertical identity from delivery-unit record; do not hand-edit surface markers';
|
|
273
|
-
const deliveryUnitBlock = (record)=>({
|
|
274
|
-
schemaVersion: record?.schemaVersion,
|
|
275
|
-
kind: record?.kind,
|
|
276
|
-
unitId: record?.unitId,
|
|
277
|
-
packageName: record?.packageName,
|
|
278
|
-
version: record?.version,
|
|
279
|
-
buildMarker: record?.buildMarker,
|
|
280
|
-
sourceRevision: record?.sourceRevision
|
|
281
|
-
});
|
|
282
|
-
const expectedCompactAppFor = (id)=>workspaceValidationContract.topology.compactConfig?.apps?.find((entry)=>entry?.id === id);
|
|
283
|
-
const expectedDeliveryUnitFor = (vertical)=>{
|
|
284
|
-
const expectedApp = expectedCompactAppFor(vertical.id);
|
|
285
|
-
return expectedApp?.backendFederation?.deliveryUnit ?? expectedApp?.deliveryUnit ?? vertical.deliveryUnit;
|
|
286
|
-
};
|
|
287
|
-
const createModernPackageAliases = (packageSourceConfig)=>{
|
|
288
|
-
if ('string' != typeof packageSourceConfig?.aliasScope) return;
|
|
289
|
-
const scope = packageSourceConfig.aliasScope.replace(/^@/u, '');
|
|
290
|
-
const prefix = 'string' == typeof packageSourceConfig.aliasPackageNamePrefix ? packageSourceConfig.aliasPackageNamePrefix : '';
|
|
291
|
-
return Object.fromEntries(modernPackageCohort.map((packageName)=>[
|
|
292
|
-
packageName,
|
|
293
|
-
`@${scope}/${prefix}${packageName.split('/').at(-1)}`
|
|
294
|
-
]));
|
|
295
|
-
};
|
|
296
|
-
const createPackageSourceView = (config)=>{
|
|
297
|
-
const source = config.packageSource;
|
|
298
|
-
(0, external_assertions_cjs_namespaceObject.assert)(null !== source && 'object' == typeof source && !Array.isArray(source), `${compactConfigPath} packageSource must be a JSON object`);
|
|
299
|
-
(0, external_assertions_cjs_namespaceObject.assert)('workspace' === source.strategy || 'install' === source.strategy, `${compactConfigPath} packageSource.strategy must be workspace or install`);
|
|
300
|
-
if ('install' === source.strategy) (0, external_assertions_cjs_namespaceObject.assert)('string' == typeof source.modernPackageVersion && source.modernPackageVersion.length > 0, `${compactConfigPath} install package source must declare modernPackageVersion`);
|
|
301
|
-
const strategy = source.strategy;
|
|
302
|
-
const specifier = 'install' === strategy ? source.modernPackageVersion : 'workspace:*';
|
|
303
|
-
const aliases = createModernPackageAliases(source);
|
|
304
|
-
return {
|
|
305
|
-
schemaVersion: 1,
|
|
306
|
-
strategy,
|
|
307
|
-
modernPackages: {
|
|
308
|
-
packages: modernPackageCohort,
|
|
309
|
-
specifier,
|
|
310
|
-
...'string' == typeof source.registry ? {
|
|
311
|
-
registry: source.registry
|
|
312
|
-
} : {},
|
|
313
|
-
...aliases ? {
|
|
314
|
-
aliases
|
|
315
|
-
} : {}
|
|
316
|
-
},
|
|
317
|
-
generatedWorkspacePackages: {
|
|
318
|
-
packages: [
|
|
319
|
-
(0, external_naming_cjs_namespaceObject.packageName)(packageScope, 'shared-contracts'),
|
|
320
|
-
(0, external_naming_cjs_namespaceObject.packageName)(packageScope, 'shared-design-tokens')
|
|
321
|
-
],
|
|
322
|
-
specifier: 'workspace:*'
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
};
|
|
326
|
-
const expectedManifestUrl = (vertical)=>`http://localhost:${vertical.port}/mf-manifest.json`;
|
|
327
|
-
const expectedApiUrl = (vertical)=>`http://localhost:${vertical.port}${vertical.apiPrefix}${'rpc' === vertical.apiProtocol ? '/rpc' : ''}`;
|
|
328
|
-
const expectedBackendFederationName = (vertical)=>`${vertical.mfName}Backend`;
|
|
329
|
-
const expectedBackendManifestUrl = (vertical)=>`http://localhost:${vertical.port}/backend-mf-manifest.json`;
|
|
330
|
-
const expectedBackendContainerEntry = (vertical)=>`http://localhost:${vertical.port}/backendRemoteEntry.cjs`;
|
|
331
|
-
const expectedBackendManifestEnv = (vertical)=>`VERTICAL_${(0, external_naming_cjs_namespaceObject.toEnvSegment)(vertical.domain ?? vertical.id)}_BACKEND_MF_MANIFEST`;
|
|
332
|
-
const expectedPublicUrlEnv = (vertical)=>`ULTRAMODERN_PUBLIC_URL_${(0, external_naming_cjs_namespaceObject.toEnvSegment)(vertical.id)}`;
|
|
333
|
-
const expectedCloudflareWorkerName = (vertical)=>(0, external_naming_cjs_namespaceObject.toKebabCase)(`${packageScope}-${vertical.id}`).slice(0, 63);
|
|
334
|
-
const backendFederationSubset = (backendFederation)=>({
|
|
335
|
-
role: backendFederation?.role,
|
|
336
|
-
name: backendFederation?.name,
|
|
337
|
-
runtimeFramework: backendFederation?.runtimeFramework,
|
|
338
|
-
strictEffectApproach: backendFederation?.strictEffectApproach,
|
|
339
|
-
exposeRuntime: backendFederation?.exposes?.['./effect-api']?.runtime,
|
|
340
|
-
exposeReadiness: backendFederation?.exposes?.['./effect-api']?.readiness,
|
|
341
|
-
versionBoundary: {
|
|
342
|
-
invariant: backendFederation?.versionBoundary?.invariant,
|
|
343
|
-
hasUi: Object.hasOwn(backendFederation?.versionBoundary ?? {}, 'ui'),
|
|
344
|
-
uiManifestUrl: backendFederation?.versionBoundary?.ui?.manifestUrl,
|
|
345
|
-
apiReadiness: backendFederation?.versionBoundary?.api?.readiness
|
|
346
|
-
},
|
|
347
|
-
cloudflare: {
|
|
348
|
-
kind: backendFederation?.executionSurfaces?.cloudflare?.kind,
|
|
349
|
-
hasApi: Object.hasOwn(backendFederation?.executionSurfaces?.cloudflare ?? {}, 'api'),
|
|
350
|
-
hasSsr: Object.hasOwn(backendFederation?.executionSurfaces?.cloudflare ?? {}, 'ssr'),
|
|
351
|
-
workerName: backendFederation?.executionSurfaces?.cloudflare?.workerName,
|
|
352
|
-
publicUrlEnv: backendFederation?.executionSurfaces?.cloudflare?.publicUrlEnv,
|
|
353
|
-
zephyrRuntime: backendFederation?.executionSurfaces?.cloudflare?.zephyr?.runtime
|
|
354
|
-
},
|
|
355
|
-
node: {
|
|
356
|
-
kind: backendFederation?.executionSurfaces?.node?.kind,
|
|
357
|
-
remoteName: backendFederation?.executionSurfaces?.node?.remoteName,
|
|
358
|
-
manifestEnv: backendFederation?.executionSurfaces?.node?.manifestEnv,
|
|
359
|
-
manifestUrl: backendFederation?.executionSurfaces?.node?.manifestUrl,
|
|
360
|
-
containerEntry: backendFederation?.executionSurfaces?.node?.containerEntry,
|
|
361
|
-
remoteType: backendFederation?.executionSurfaces?.node?.remoteType,
|
|
362
|
-
expose: backendFederation?.executionSurfaces?.node?.expose
|
|
363
|
-
},
|
|
364
|
-
compatibility: {
|
|
365
|
-
contractVersion: backendFederation?.compatibility?.contractVersion
|
|
366
|
-
},
|
|
367
|
-
topLevelManifestUrl: backendFederation?.manifestUrl,
|
|
368
|
-
topLevelContainerEntry: backendFederation?.containerEntry
|
|
369
|
-
});
|
|
370
|
-
const expectedBackendFederationSubset = (vertical)=>({
|
|
371
|
-
role: 'microvertical-server',
|
|
372
|
-
name: expectedBackendFederationName(vertical),
|
|
373
|
-
runtimeFramework: 'effect',
|
|
374
|
-
strictEffectApproach: true,
|
|
375
|
-
exposeRuntime: `${vertical.path}/api/index.ts`,
|
|
376
|
-
exposeReadiness: 'rpc' === vertical.apiProtocol ? void 0 : `${vertical.apiPrefix}/${vertical.stem}/readiness`,
|
|
377
|
-
versionBoundary: {
|
|
378
|
-
invariant: 'web-and-api-same-build',
|
|
379
|
-
hasUi: vertical.emitsUi,
|
|
380
|
-
uiManifestUrl: vertical.emitsUi ? expectedManifestUrl(vertical) : void 0,
|
|
381
|
-
apiReadiness: 'rpc' === vertical.apiProtocol ? void 0 : `${vertical.apiPrefix}/${vertical.stem}/readiness`
|
|
382
|
-
},
|
|
383
|
-
cloudflare: {
|
|
384
|
-
kind: 'cloudflare-worker-snapshot',
|
|
385
|
-
hasApi: !vertical.emitsUi,
|
|
386
|
-
hasSsr: vertical.emitsUi,
|
|
387
|
-
workerName: expectedCloudflareWorkerName(vertical),
|
|
388
|
-
publicUrlEnv: expectedPublicUrlEnv(vertical),
|
|
389
|
-
zephyrRuntime: vertical.emitsUi ? 'ssr-worker' : 'api-worker'
|
|
390
|
-
},
|
|
391
|
-
node: {
|
|
392
|
-
kind: 'node-mf-runtime',
|
|
393
|
-
remoteName: expectedBackendFederationName(vertical),
|
|
394
|
-
manifestEnv: expectedBackendManifestEnv(vertical),
|
|
395
|
-
manifestUrl: expectedBackendManifestUrl(vertical),
|
|
396
|
-
containerEntry: expectedBackendContainerEntry(vertical),
|
|
397
|
-
remoteType: 'commonjs-module',
|
|
398
|
-
expose: './effect-api'
|
|
399
|
-
},
|
|
400
|
-
compatibility: {
|
|
401
|
-
contractVersion: 'microvertical-server-effect-v1'
|
|
402
|
-
},
|
|
403
|
-
topLevelManifestUrl: void 0,
|
|
404
|
-
topLevelContainerEntry: void 0
|
|
405
|
-
});
|
|
406
|
-
const serverExecutionSubset = (serverExecution)=>({
|
|
407
|
-
apiBaseUrl: serverExecution?.apiBaseUrl,
|
|
408
|
-
versionBoundary: serverExecution?.versionBoundary,
|
|
409
|
-
cloudflareKind: serverExecution?.cloudflare?.kind,
|
|
410
|
-
cloudflareWorkerName: serverExecution?.cloudflare?.workerName,
|
|
411
|
-
nodeKind: serverExecution?.node?.kind,
|
|
412
|
-
nodeManifestUrl: serverExecution?.node?.manifestUrl,
|
|
413
|
-
nodeContainerEntry: serverExecution?.node?.containerEntry
|
|
414
|
-
});
|
|
415
|
-
const expectedServerExecutionSubset = (vertical)=>({
|
|
416
|
-
apiBaseUrl: expectedApiUrl(vertical),
|
|
417
|
-
versionBoundary: 'web-and-api-same-build',
|
|
418
|
-
cloudflareKind: 'cloudflare-worker-snapshot',
|
|
419
|
-
cloudflareWorkerName: expectedCloudflareWorkerName(vertical),
|
|
420
|
-
nodeKind: 'node-mf-runtime',
|
|
421
|
-
nodeManifestUrl: expectedBackendManifestUrl(vertical),
|
|
422
|
-
nodeContainerEntry: expectedBackendContainerEntry(vertical)
|
|
423
|
-
});
|
|
424
|
-
const remoteContractSubset = (remote)=>({
|
|
425
|
-
id: remote?.id,
|
|
426
|
-
name: remote?.name,
|
|
427
|
-
manifestUrl: remote?.manifestUrl
|
|
428
|
-
});
|
|
429
|
-
const expectedRemoteContractSubset = (vertical)=>({
|
|
430
|
-
id: vertical.id,
|
|
431
|
-
name: vertical.mfName,
|
|
432
|
-
manifestUrl: expectedManifestUrl(vertical)
|
|
433
|
-
});
|
|
434
|
-
const expectedRemoteSubsetsForRefs = (refs)=>refs.map((ref)=>fullStackVerticals.find((vertical)=>vertical.id === ref)).filter((vertical)=>void 0 !== vertical).map(expectedRemoteContractSubset);
|
|
435
|
-
const requiredMicroVerticalPaths = (vertical)=>[
|
|
436
|
-
`${vertical.path}/package.json`,
|
|
437
|
-
`${vertical.path}/tsconfig.json`,
|
|
438
|
-
`${vertical.path}/tsconfig.mf-types.json`,
|
|
439
|
-
`${vertical.path}/modern.config.ts`,
|
|
440
|
-
`${vertical.path}/src/modern-app-env.d.ts`,
|
|
441
|
-
`${vertical.path}/src/modern.runtime.ts`,
|
|
442
|
-
`${vertical.path}/locales/en/translation.json`,
|
|
443
|
-
`${vertical.path}/locales/en/${vertical.namespace}.json`,
|
|
444
|
-
`${vertical.path}/locales/cs/translation.json`,
|
|
445
|
-
`${vertical.path}/locales/cs/${vertical.namespace}.json`,
|
|
446
|
-
...vertical.emitsUi ? [
|
|
447
|
-
`${vertical.path}/module-federation.config.ts`,
|
|
448
|
-
`${vertical.path}/src/federation-entry.tsx`,
|
|
449
|
-
...vertical.componentPaths,
|
|
450
|
-
`${vertical.path}/src/routes/index.css`,
|
|
451
|
-
`${vertical.path}/src/routes/layout.tsx`,
|
|
452
|
-
`${vertical.path}/src/routes/ultramodern-route-head.tsx`,
|
|
453
|
-
`${vertical.path}/src/routes/ultramodern-route-metadata.ts`,
|
|
454
|
-
...vertical.exposes.includes('./Widget') ? [
|
|
455
|
-
`${vertical.path}/src/routes/[lang]/_mf/fragment/widget/page.tsx`
|
|
456
|
-
] : []
|
|
457
|
-
] : [],
|
|
458
|
-
...vertical.emitsApi ? [
|
|
459
|
-
`${vertical.path}/backend-federation.config.ts`,
|
|
460
|
-
`${vertical.path}/api/effect-api.ts`,
|
|
461
|
-
`${vertical.path}/api/index.ts`,
|
|
462
|
-
`${vertical.path}/${vertical.apiContractPath}`,
|
|
463
|
-
`${vertical.path}/${vertical.apiClientPath}`
|
|
464
|
-
] : []
|
|
465
|
-
];
|
|
466
|
-
const forbiddenMicroVerticalPaths = (vertical)=>[
|
|
467
|
-
...vertical.emitsUi ? [] : [
|
|
468
|
-
`${vertical.path}/module-federation.config.ts`,
|
|
469
|
-
`${vertical.path}/src/federation-entry.tsx`,
|
|
470
|
-
`${vertical.path}/src/components/${vertical.domain ?? vertical.id}-widget.tsx`,
|
|
471
|
-
`${vertical.path}/src/routes/layout.tsx`,
|
|
472
|
-
`${vertical.path}/src/routes/[lang]/page.tsx`,
|
|
473
|
-
`${vertical.path}/src/routes/[lang]/_mf/fragment/widget/page.tsx`,
|
|
474
|
-
`${vertical.path}/src/routes/[lang]/route.meta.ts`,
|
|
475
|
-
`${vertical.path}/src/routes/ultramodern-route-head.tsx`,
|
|
476
|
-
`${vertical.path}/src/routes/ultramodern-route-metadata.ts`,
|
|
477
|
-
`${vertical.path}/src/routes/index.css`
|
|
478
|
-
],
|
|
479
|
-
...vertical.emitsApi ? [] : [
|
|
480
|
-
`${vertical.path}/shared/api.ts`,
|
|
481
|
-
`${vertical.path}/shared/rpc.ts`,
|
|
482
|
-
`${vertical.path}/backend-federation.config.ts`,
|
|
483
|
-
`${vertical.path}/api/index.ts`,
|
|
484
|
-
`${vertical.path}/api/effect-api.ts`,
|
|
485
|
-
`${vertical.path}/src/api/${vertical.domain ?? vertical.id}-client.ts`,
|
|
486
|
-
`${vertical.path}/src/api/${vertical.domain ?? vertical.id}-rpc-client.ts`
|
|
487
|
-
]
|
|
488
|
-
];
|
|
489
|
-
const assertRequiredVerticalFile = (vertical)=>(relativePath)=>{
|
|
490
|
-
(0, external_assertions_cjs_namespaceObject.assertSelfCheck)(external_node_fs_default().existsSync(external_node_path_default().join(root, relativePath)), `required files for ${vertical.id}`, `Missing ${relativePath}`, 'restore the generated MicroVertical files or rerun the MicroVertical generator');
|
|
491
|
-
};
|
|
492
|
-
const assertForbiddenVerticalFile = (vertical)=>(relativePath)=>{
|
|
493
|
-
(0, external_assertions_cjs_namespaceObject.assertSelfCheck)(!external_node_fs_default().existsSync(external_node_path_default().join(root, relativePath)), `forbidden files for ${vertical.id}`, `Unexpected ${relativePath} for a ${vertical.surfaceProfile} unit`, `remove ${relativePath}; a ${vertical.surfaceProfile} unit does not emit this surface`);
|
|
494
|
-
};
|
|
495
|
-
const assertMicroVerticalContractGraph = ({ topology, ownership, overlay, shellPackage })=>{
|
|
496
|
-
const expectedVerticalIds = fullStackVerticals.map((vertical)=>vertical.id);
|
|
497
|
-
const expectedShellVerticalIds = expectedPrimaryShellVerticalIds;
|
|
498
|
-
const expectedShellRemotes = expectedShellVerticalIds.flatMap((verticalId)=>{
|
|
499
|
-
const vertical = fullStackVerticals.find((candidate)=>candidate.id === verticalId);
|
|
500
|
-
return void 0 === vertical ? [] : [
|
|
501
|
-
expectedRemoteContractSubset(vertical)
|
|
502
|
-
];
|
|
503
|
-
});
|
|
504
|
-
(0, external_assertions_cjs_namespaceObject.assertObject)(topology.shell, 'topology/reference-topology.json shell', 'restore generated topology shell metadata');
|
|
505
|
-
(0, external_assertions_cjs_namespaceObject.assertArray)(topology.verticals, 'topology/reference-topology.json verticals', 'restore generated topology vertical entries');
|
|
506
|
-
(0, external_assertions_cjs_namespaceObject.assertObject)(topology.shell?.moduleFederation, 'topology/reference-topology.json shell.moduleFederation', 'restore generated shell Module Federation metadata');
|
|
507
|
-
(0, external_assertions_cjs_namespaceObject.assertArray)(topology.shell?.moduleFederation?.remotes, 'topology/reference-topology.json shell.moduleFederation.remotes', 'restore generated shell Module Federation remotes');
|
|
508
|
-
(0, external_assertions_cjs_namespaceObject.assertArray)(ownership.owners, 'topology/ownership.json owners', 'restore generated ownership entries');
|
|
509
|
-
(0, external_assertions_cjs_namespaceObject.assertObject)(overlay.ports, 'topology/local-overlays/development.json ports', 'restore generated local development port overlays');
|
|
510
|
-
(0, external_assertions_cjs_namespaceObject.assertObject)(overlay.manifests, 'topology/local-overlays/development.json manifests', 'restore generated local Module Federation manifest overlays');
|
|
511
|
-
(0, external_assertions_cjs_namespaceObject.assertObject)(overlay.apis, 'topology/local-overlays/development.json apis', 'restore generated local API overlays');
|
|
512
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(topology.shell.verticalRefs ?? [], expectedShellVerticalIds, 'topology/reference-topology.json shell.verticalRefs', 'restore generated topology shell references');
|
|
513
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(topology.verticals.map((vertical)=>vertical?.id), expectedVerticalIds, 'topology/reference-topology.json verticals', 'restore generated topology vertical entries');
|
|
514
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(topology.shell.moduleFederation.remotes.map(remoteContractSubset), expectedShellRemotes, 'topology/reference-topology.json shell.moduleFederation.remotes', 'restore generated shell Module Federation remotes');
|
|
515
|
-
const compactShell = findById(ultramodernConfig.topology?.apps, external_descriptors_cjs_namespaceObject.shellApp.id);
|
|
516
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(compactShell?.moduleFederation?.verticalRefs ?? [], expectedShellVerticalIds, `${compactConfigPath} topology.apps.${external_descriptors_cjs_namespaceObject.shellApp.id}.moduleFederation.verticalRefs`, 'keep compact and reference topology composition aligned');
|
|
517
|
-
for (const vertical of fullStackVerticals){
|
|
518
|
-
const expectedRefs = vertical.verticalRefs ?? [];
|
|
519
|
-
const topologyEntry = findById(topology.verticals, vertical.id);
|
|
520
|
-
const ownershipEntry = findById(ownership.owners, vertical.id);
|
|
521
|
-
const expectedExposes = Array.isArray(vertical.exposes) ? vertical.exposes : Object.keys(vertical.exposes ?? {});
|
|
522
|
-
const compactVertical = findById(ultramodernConfig.topology?.apps, vertical.id);
|
|
523
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)({
|
|
524
|
-
kind: compactVertical?.kind,
|
|
525
|
-
package: compactVertical?.package ?? vertical.packageName,
|
|
526
|
-
path: 'string' == typeof compactVertical?.path ? compactVertical.path.replace(/\\/gu, '/').replace(/^\.\/+/u, '') : vertical.path,
|
|
527
|
-
namespace: compactVertical?.domain ?? vertical.domain ?? vertical.id,
|
|
528
|
-
federationName: compactVertical?.moduleFederation?.name ?? vertical.mfName,
|
|
529
|
-
exposes: compactVertical?.moduleFederation?.exposes ?? [],
|
|
530
|
-
verticalRefs: compactVertical?.moduleFederation?.verticalRefs ?? [],
|
|
531
|
-
...vertical.emitsApi ? {
|
|
532
|
-
api: {
|
|
533
|
-
prefix: compactVertical?.api?.prefix ?? `/${vertical.domain ?? vertical.id}-api`,
|
|
534
|
-
protocol: compactVertical?.api?.protocol === 'rpc' ? 'rpc' : 'rest',
|
|
535
|
-
group: (0, external_naming_cjs_namespaceObject.toCamelCase)((0, external_naming_cjs_namespaceObject.toKebabCase)(compactVertical?.api?.stem ?? vertical.domain ?? vertical.id))
|
|
536
|
-
}
|
|
537
|
-
} : {}
|
|
538
|
-
}, {
|
|
539
|
-
kind: 'vertical',
|
|
540
|
-
package: vertical.packageName,
|
|
541
|
-
path: vertical.path,
|
|
542
|
-
namespace: vertical.namespace,
|
|
543
|
-
federationName: vertical.mfName,
|
|
544
|
-
exposes: expectedExposes,
|
|
545
|
-
verticalRefs: expectedRefs,
|
|
546
|
-
...vertical.emitsApi ? {
|
|
547
|
-
api: {
|
|
548
|
-
prefix: vertical.apiPrefix,
|
|
549
|
-
protocol: vertical.apiProtocol,
|
|
550
|
-
group: vertical.group
|
|
551
|
-
}
|
|
552
|
-
} : {}
|
|
553
|
-
}, `${compactConfigPath} topology.apps.${vertical.id} published surfaces`, 'keep compact and reference topology package, federation and API surfaces aligned');
|
|
554
|
-
requiredMicroVerticalPaths(vertical).forEach(assertRequiredVerticalFile(vertical));
|
|
555
|
-
(0, external_assertions_cjs_namespaceObject.assertObject)(topologyEntry, `topology/reference-topology.json verticals.${vertical.id}`, 'restore generated topology vertical entries');
|
|
556
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)({
|
|
557
|
-
kind: topologyEntry.kind,
|
|
558
|
-
package: topologyEntry.package,
|
|
559
|
-
path: topologyEntry.path,
|
|
560
|
-
moduleFederation: {
|
|
561
|
-
name: topologyEntry.moduleFederation?.name,
|
|
562
|
-
manifestUrl: topologyEntry.moduleFederation?.manifestUrl,
|
|
563
|
-
exposes: topologyEntry.moduleFederation?.exposes ?? [],
|
|
564
|
-
verticalRefs: topologyEntry.moduleFederation?.verticalRefs ?? [],
|
|
565
|
-
remotes: (topologyEntry.moduleFederation?.remotes ?? []).map(remoteContractSubset)
|
|
566
|
-
},
|
|
567
|
-
...vertical.emitsApi ? {
|
|
568
|
-
api: {
|
|
569
|
-
prefix: topologyEntry.api?.bff?.prefix,
|
|
570
|
-
serverEntry: topologyEntry.api?.serverEntry
|
|
571
|
-
}
|
|
572
|
-
} : {}
|
|
573
|
-
}, {
|
|
574
|
-
kind: 'vertical',
|
|
575
|
-
package: vertical.packageName,
|
|
576
|
-
path: vertical.path,
|
|
577
|
-
moduleFederation: {
|
|
578
|
-
name: vertical.mfName,
|
|
579
|
-
manifestUrl: expectedManifestUrl(vertical),
|
|
580
|
-
exposes: expectedExposes,
|
|
581
|
-
verticalRefs: expectedRefs,
|
|
582
|
-
remotes: expectedRemoteSubsetsForRefs(expectedRefs)
|
|
583
|
-
},
|
|
584
|
-
...vertical.emitsApi ? {
|
|
585
|
-
api: {
|
|
586
|
-
prefix: vertical.apiPrefix,
|
|
587
|
-
serverEntry: `${vertical.path}/api/index.ts`
|
|
588
|
-
}
|
|
589
|
-
} : {}
|
|
590
|
-
}, `topology/reference-topology.json verticals.${vertical.id}`, 'restore generated topology vertical entries');
|
|
591
|
-
if (vertical.emitsApi) (0, external_assertions_cjs_namespaceObject.assertSameJson)(backendFederationSubset(topologyEntry.backendFederation), expectedBackendFederationSubset(vertical), `topology/reference-topology.json verticals.${vertical.id}.backendFederation`, 'restore generated MicroVertical server execution contract');
|
|
592
|
-
if (vertical.deliveryUnit) {
|
|
593
|
-
const compactApp = findById(ultramodernConfig.topology?.apps, vertical.id);
|
|
594
|
-
const expectedDeliveryUnit = deliveryUnitBlock(expectedDeliveryUnitFor(vertical));
|
|
595
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(deliveryUnitBlock(compactApp?.deliveryUnit), expectedDeliveryUnit, `${generatedContractLabel} topology.apps.${vertical.id}.deliveryUnit`, deliveryUnitIdentityFixArea);
|
|
596
|
-
if (vertical.emitsApi) (0, external_assertions_cjs_namespaceObject.assertSameJson)(deliveryUnitBlock(compactApp?.backendFederation?.deliveryUnit), expectedDeliveryUnit, `${generatedContractLabel} topology.apps.${vertical.id}.backendFederation.deliveryUnit`, deliveryUnitIdentityFixArea);
|
|
597
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(deliveryUnitBlock(topologyEntry.deliveryUnit), expectedDeliveryUnit, `topology/reference-topology.json verticals.${vertical.id}.deliveryUnit`, deliveryUnitIdentityFixArea);
|
|
598
|
-
if (vertical.emitsApi) {
|
|
599
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(deliveryUnitBlock(topologyEntry.backendFederation?.deliveryUnit), expectedDeliveryUnit, `topology/reference-topology.json verticals.${vertical.id}.backendFederation.deliveryUnit`, deliveryUnitIdentityFixArea);
|
|
600
|
-
(0, external_assertions_cjs_namespaceObject.assertSelfCheck)(topologyEntry.backendFederation?.versionBoundary?.identityRoot === 'deliveryUnit', `topology/reference-topology.json verticals.${vertical.id}.backendFederation.versionBoundary.identityRoot`, `Expected "deliveryUnit", found ${(0, external_assertions_cjs_namespaceObject.formatJson)(topologyEntry.backendFederation?.versionBoundary?.identityRoot)}`, deliveryUnitIdentityFixArea);
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
(0, external_assertions_cjs_namespaceObject.assertObject)(ownershipEntry, `topology/ownership.json owners.${vertical.id}`, 'restore generated ownership entries');
|
|
604
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)({
|
|
605
|
-
package: ownershipEntry.package,
|
|
606
|
-
path: ownershipEntry.path
|
|
607
|
-
}, {
|
|
608
|
-
package: vertical.packageName,
|
|
609
|
-
path: vertical.path
|
|
610
|
-
}, `topology/ownership.json owners.${vertical.id}`, 'restore generated ownership entries');
|
|
611
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(overlay.ports[vertical.id], vertical.port, `topology/local-overlays/development.json ports.${vertical.id}`, 'restore generated local development port overlay');
|
|
612
|
-
if (vertical.emitsUi) (0, external_assertions_cjs_namespaceObject.assertSameJson)(overlay.manifests[vertical.id], expectedManifestUrl(vertical), `topology/local-overlays/development.json manifests.${vertical.id}`, 'restore generated local Module Federation manifest overlay');
|
|
613
|
-
if (vertical.emitsApi) {
|
|
614
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(overlay.apis[vertical.id], expectedApiUrl(vertical), `topology/local-overlays/development.json apis.${vertical.id}`, 'restore generated local API overlay');
|
|
615
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(serverExecutionSubset(overlay.serverExecution?.[vertical.id]), expectedServerExecutionSubset(vertical), `topology/local-overlays/development.json serverExecution.${vertical.id}`, 'restore generated local MicroVertical server execution overlay');
|
|
616
|
-
}
|
|
617
|
-
const shellPackagesForDependencyChecks = [
|
|
618
|
-
{
|
|
619
|
-
id: 'shell-super-app',
|
|
620
|
-
path: 'apps/shell-super-app',
|
|
621
|
-
pkg: shellPackage,
|
|
622
|
-
uiRefs: expectedShellVerticalIds
|
|
623
|
-
},
|
|
624
|
-
...expectedAdditionalShells.map((additionalShell)=>({
|
|
625
|
-
id: additionalShell.id,
|
|
626
|
-
path: additionalShell.path,
|
|
627
|
-
pkg: readJson(`${additionalShell.path}/package.json`),
|
|
628
|
-
uiRefs: additionalShell.verticalRefs ?? []
|
|
629
|
-
}))
|
|
630
|
-
];
|
|
631
|
-
for (const shellEntry of shellPackagesForDependencyChecks){
|
|
632
|
-
const composed = shellEntry.uiRefs.includes(vertical.id);
|
|
633
|
-
if (vertical.emitsApi || composed) (0, external_assertions_cjs_namespaceObject.assertSameJson)(shellEntry.pkg.dependencies?.[vertical.packageName], 'workspace:*', `${shellEntry.path}/package.json dependencies.${vertical.packageName}`, 'restore shell dependency for the MicroVertical consumer');
|
|
634
|
-
if (composed) (0, external_assertions_cjs_namespaceObject.assertSameJson)(shellEntry.pkg['zephyr:dependencies']?.[vertical.zephyrAlias], `${vertical.packageName}@workspace:*`, `${shellEntry.path}/package.json zephyr:dependencies.${vertical.zephyrAlias}`, 'restore shell Zephyr dependency metadata for the MicroVertical');
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
};
|
|
638
|
-
const toPosixPath = (value)=>value.split(external_node_path_default().sep).join('/');
|
|
639
|
-
const referenceFrom = (fromPath, toPath)=>({
|
|
640
|
-
path: toPosixPath(external_node_path_default().relative(fromPath, toPath))
|
|
641
|
-
});
|
|
642
|
-
const sharedPackagePaths = [
|
|
643
|
-
'packages/shared-contracts',
|
|
644
|
-
'packages/shared-design-tokens'
|
|
645
|
-
];
|
|
646
|
-
const tsgoCacheKey = (packagePath)=>packagePath.replace(/[^a-zA-Z0-9._-]+/gu, '__');
|
|
647
|
-
const assertProjectReferenceEmitConfig = (tsConfig, packagePath)=>{
|
|
648
|
-
const compilerOptions = tsConfig.compilerOptions ?? {};
|
|
649
|
-
const relativeRoot = toPosixPath(external_node_path_default().relative(packagePath, '.')) || '.';
|
|
650
|
-
(0, external_assertions_cjs_namespaceObject.assert)(true === compilerOptions.composite, `${packagePath} must stay a composite TS-Go project`);
|
|
651
|
-
(0, external_assertions_cjs_namespaceObject.assert)(true === compilerOptions.declaration, `${packagePath} must emit declarations for TS-Go build mode`);
|
|
652
|
-
(0, external_assertions_cjs_namespaceObject.assert)(false === compilerOptions.declarationMap, `${packagePath} must not emit declaration maps during checks`);
|
|
653
|
-
(0, external_assertions_cjs_namespaceObject.assert)(true === compilerOptions.emitDeclarationOnly, `${packagePath} must only emit declarations during checks`);
|
|
654
|
-
(0, external_assertions_cjs_namespaceObject.assert)(false === compilerOptions.noEmit, `${packagePath} must override root noEmit for TS-Go build mode`);
|
|
655
|
-
(0, external_assertions_cjs_namespaceObject.assert)(compilerOptions.outDir === `${relativeRoot}/node_modules/.cache/tsgo/declarations/${tsgoCacheKey(packagePath)}`, `${packagePath} must emit TS-Go declarations into the generated cache`);
|
|
656
|
-
(0, external_assertions_cjs_namespaceObject.assert)(compilerOptions.tsBuildInfoFile === `${relativeRoot}/node_modules/.cache/tsgo/${tsgoCacheKey(packagePath)}.tsbuildinfo`, `${packagePath} must keep TS-Go build info in the generated cache`);
|
|
657
|
-
};
|
|
658
|
-
const assertTsConfigReferenceGraph = ()=>{
|
|
659
|
-
const baseTsConfig = readJson('tsconfig.base.json');
|
|
660
|
-
const rootTsConfig = readJson('tsconfig.json');
|
|
661
|
-
const shellTsConfig = readJson('apps/shell-super-app/tsconfig.json');
|
|
662
|
-
const shellMfTypesTsConfig = readJson('apps/shell-super-app/tsconfig.mf-types.json');
|
|
663
|
-
const additionalShellPaths = (workspaceValidationContract.structuralShellPolicy?.shells ?? []).filter((shell)=>'shell-super-app' !== shell.id).map((shell)=>shell.packageDir);
|
|
664
|
-
const expectedRootReferences = [
|
|
665
|
-
...sharedPackagePaths,
|
|
666
|
-
'apps/shell-super-app',
|
|
667
|
-
...fullStackVerticals.map((vertical)=>vertical.path),
|
|
668
|
-
...additionalShellPaths
|
|
669
|
-
].map((referencePath)=>({
|
|
670
|
-
path: referencePath
|
|
671
|
-
}));
|
|
672
|
-
const expectedShellReferences = sharedPackagePaths.map((referencePath)=>referenceFrom('apps/shell-super-app', referencePath));
|
|
673
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(rootTsConfig.files, [], 'tsconfig.json files', 'restore the generated root project-reference tsconfig');
|
|
674
|
-
(0, external_assertions_cjs_namespaceObject.assertIncludesJson)(rootTsConfig.references ?? [], expectedRootReferences, 'tsconfig.json references', 'restore the generated root project-reference graph');
|
|
675
|
-
(0, external_assertions_cjs_namespaceObject.assertIncludesJson)(shellTsConfig.references ?? [], expectedShellReferences, 'apps/shell-super-app/tsconfig.json references', 'restore the generated shell project-reference graph');
|
|
676
|
-
(0, external_assertions_cjs_namespaceObject.assert)(baseTsConfig.compilerOptions?.skipLibCheck !== true, 'tsconfig.base.json must not use skipLibCheck');
|
|
677
|
-
(0, external_assertions_cjs_namespaceObject.assertIncludesJson)(shellTsConfig.include ?? [], [
|
|
678
|
-
'src',
|
|
679
|
-
'locales/**/*.json',
|
|
680
|
-
'package.json',
|
|
681
|
-
'shared',
|
|
682
|
-
'shared/ultramodern-build.json',
|
|
683
|
-
'server'
|
|
684
|
-
], 'apps/shell-super-app/tsconfig.json include', 'restore the generated shell typecheck boundary');
|
|
685
|
-
assertProjectReferenceEmitConfig(shellTsConfig, 'apps/shell-super-app');
|
|
686
|
-
(0, external_assertions_cjs_namespaceObject.assertIncludesJson)(shellMfTypesTsConfig.include ?? [], [
|
|
687
|
-
'src/modern-app-env.d.ts'
|
|
688
|
-
], 'apps/shell-super-app/tsconfig.mf-types.json', 'restore the generated shell Module Federation DTS boundary');
|
|
689
|
-
for (const sharedPackagePath of sharedPackagePaths)assertProjectReferenceEmitConfig(readJson(`${sharedPackagePath}/tsconfig.json`), sharedPackagePath);
|
|
690
|
-
for (const vertical of fullStackVerticals){
|
|
691
|
-
const verticalTsConfig = readJson(`${vertical.path}/tsconfig.json`);
|
|
692
|
-
const verticalMfTypesTsConfig = readJson(`${vertical.path}/tsconfig.mf-types.json`);
|
|
693
|
-
const expectedVerticalReferences = [
|
|
694
|
-
...sharedPackagePaths,
|
|
695
|
-
...(vertical.verticalRefs ?? []).map((verticalRef)=>fullStackVerticals.find((candidate)=>candidate.id === verticalRef)).filter((vertical)=>void 0 !== vertical).map((referencedVertical)=>referencedVertical.path)
|
|
696
|
-
].map((referencePath)=>referenceFrom(vertical.path, referencePath));
|
|
697
|
-
(0, external_assertions_cjs_namespaceObject.assertIncludesJson)(verticalTsConfig.references ?? [], expectedVerticalReferences, `${vertical.path}/tsconfig.json references`, 'restore the generated MicroVertical project-reference graph');
|
|
698
|
-
(0, external_assertions_cjs_namespaceObject.assertIncludesJson)(verticalTsConfig.include ?? [], [
|
|
699
|
-
'src',
|
|
700
|
-
'locales/**/*.json',
|
|
701
|
-
'package.json',
|
|
702
|
-
'shared',
|
|
703
|
-
'shared/ultramodern-build.json',
|
|
704
|
-
'server',
|
|
705
|
-
...vertical.emitsApi ? [
|
|
706
|
-
'api'
|
|
707
|
-
] : []
|
|
708
|
-
], `${vertical.path}/tsconfig.json include`, 'restore the generated MicroVertical typecheck boundary');
|
|
709
|
-
assertProjectReferenceEmitConfig(verticalTsConfig, vertical.path);
|
|
710
|
-
(0, external_assertions_cjs_namespaceObject.assert)((vertical.verticalRefs ?? []).length > 0 ? verticalTsConfig.compilerOptions?.skipLibCheck === true : verticalTsConfig.compilerOptions?.skipLibCheck !== true, `${vertical.path}/tsconfig.json must scope skipLibCheck to composed remotes`);
|
|
711
|
-
if (!vertical.emitsUi) (0, external_assertions_cjs_namespaceObject.assertSelfCheck)(!(verticalMfTypesTsConfig.include ?? []).includes('src/federation-entry.tsx'), `${vertical.path}/tsconfig.mf-types.json`, 'A headless unit cannot include a browser federation entry', 'restore the generated MicroVertical Module Federation DTS boundary');
|
|
712
|
-
(0, external_assertions_cjs_namespaceObject.assertIncludesJson)(verticalMfTypesTsConfig.include ?? [], vertical.emitsUi ? [
|
|
713
|
-
'src/federation-entry.tsx',
|
|
714
|
-
...vertical.componentPaths.map((componentPath)=>componentPath.replace(`${vertical.path}/`, '')),
|
|
715
|
-
'src/modern-app-env.d.ts'
|
|
716
|
-
] : [
|
|
717
|
-
'src/modern-app-env.d.ts'
|
|
718
|
-
], `${vertical.path}/tsconfig.mf-types.json`, 'restore the generated MicroVertical Module Federation DTS boundary');
|
|
719
|
-
}
|
|
720
|
-
for (const shell of expectedAdditionalShells){
|
|
721
|
-
const shellTsConfig = readJson(`${shell.path}/tsconfig.json`);
|
|
722
|
-
const shellMfTypesTsConfig = readJson(`${shell.path}/tsconfig.mf-types.json`);
|
|
723
|
-
const expectedShellReferences = sharedPackagePaths.map((referencePath)=>referenceFrom(shell.path, referencePath));
|
|
724
|
-
(0, external_assertions_cjs_namespaceObject.assertIncludesJson)(shellTsConfig.references ?? [], expectedShellReferences, `${shell.path}/tsconfig.json references`, 'restore the generated additional-shell project-reference graph');
|
|
725
|
-
(0, external_assertions_cjs_namespaceObject.assertIncludesJson)(shellTsConfig.include ?? [], [
|
|
726
|
-
'src',
|
|
727
|
-
'locales/**/*.json',
|
|
728
|
-
'package.json',
|
|
729
|
-
'shared',
|
|
730
|
-
'shared/ultramodern-build.json',
|
|
731
|
-
'server'
|
|
732
|
-
], `${shell.path}/tsconfig.json include`, 'restore the generated additional-shell typecheck boundary');
|
|
733
|
-
assertProjectReferenceEmitConfig(shellTsConfig, shell.path);
|
|
734
|
-
(0, external_assertions_cjs_namespaceObject.assertIncludesJson)(shellMfTypesTsConfig.include ?? [], [
|
|
735
|
-
'src/modern-app-env.d.ts'
|
|
736
|
-
], `${shell.path}/tsconfig.mf-types.json`, 'restore the generated additional-shell Module Federation DTS boundary');
|
|
737
|
-
}
|
|
738
|
-
};
|
|
739
|
-
const packageJsonFiles = (startDir)=>{
|
|
740
|
-
const files = [];
|
|
741
|
-
const queue = [
|
|
742
|
-
startDir
|
|
743
|
-
];
|
|
744
|
-
while(queue.length > 0){
|
|
745
|
-
const current = queue.shift();
|
|
746
|
-
for (const entry of external_node_fs_default().readdirSync(current, {
|
|
747
|
-
withFileTypes: true
|
|
748
|
-
})){
|
|
749
|
-
if ([
|
|
750
|
-
'.git',
|
|
751
|
-
'.output',
|
|
752
|
-
'.zerops',
|
|
753
|
-
'dist',
|
|
754
|
-
'node_modules',
|
|
755
|
-
'repos'
|
|
756
|
-
].includes(entry.name)) continue;
|
|
757
|
-
const absolute = external_node_path_default().join(current, entry.name);
|
|
758
|
-
if (entry.isDirectory()) queue.push(absolute);
|
|
759
|
-
else if ('package.json' === entry.name) files.push(absolute);
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
return files.sort();
|
|
763
|
-
};
|
|
764
|
-
const modernDependencyNames = (packageJson)=>[
|
|
765
|
-
...new Set([
|
|
766
|
-
'dependencies',
|
|
767
|
-
'devDependencies',
|
|
768
|
-
'optionalDependencies',
|
|
769
|
-
'peerDependencies'
|
|
770
|
-
].flatMap((section)=>Object.keys(packageJson[section] ?? {})).filter((packageName)=>packageName.startsWith('@modern-js/')))
|
|
771
|
-
];
|
|
772
|
-
const assertModernPackageCohort = ()=>{
|
|
773
|
-
const modernPackageNames = workspaceValidationContract.cohort.modernPackages;
|
|
774
|
-
const cohortPackages = expectedReleaseCohort?.packages;
|
|
775
|
-
const modernPackageNameSet = new Set(cohortPackages?.map((entry)=>entry.sourceName) ?? modernPackageNames);
|
|
776
|
-
const observedModernPackageNames = new Set();
|
|
777
|
-
const observedAppIds = [];
|
|
778
|
-
const additionalShellAppIds = new Set((workspaceValidationContract.structuralShellPolicy?.shells ?? []).map((shell)=>shell.id).filter((id)=>'shell-super-app' !== id));
|
|
779
|
-
for (const packageJsonPath of packageJsonFiles(root)){
|
|
780
|
-
const relativePath = external_node_path_default().relative(root, packageJsonPath).split(external_node_path_default().sep).join('/');
|
|
781
|
-
const packageJson = JSON.parse(external_node_fs_default().readFileSync(packageJsonPath, 'utf-8'));
|
|
782
|
-
if ('string' == typeof packageJson.modernjs?.appId && !additionalShellAppIds.has(packageJson.modernjs.appId)) observedAppIds.push(packageJson.modernjs.appId);
|
|
783
|
-
for (const packageName of modernDependencyNames(packageJson))observedModernPackageNames.add(packageName);
|
|
784
|
-
for (const section of [
|
|
785
|
-
'dependencies',
|
|
786
|
-
'devDependencies',
|
|
787
|
-
'optionalDependencies',
|
|
788
|
-
'peerDependencies'
|
|
789
|
-
])for (const packageName of modernPackageNameSet){
|
|
790
|
-
const actual = packageJson[section]?.[packageName];
|
|
791
|
-
if (void 0 !== actual) (0, external_assertions_cjs_namespaceObject.assert)(actual === (cohortPackages ? `npm:${cohortPackages.find((entry)=>entry.sourceName === packageName)?.targetName}@${expectedReleaseCohort.release.version}` : expectedModernPackageSpecifier(packageName)), `${relativePath} ${section}.${packageName} must match package source metadata`);
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
for (const packageName of modernPackageNames)(0, external_assertions_cjs_namespaceObject.assert)(observedModernPackageNames.has(packageName), `Modern package cohort is missing ${packageName}`);
|
|
795
|
-
(0, external_assertions_cjs_namespaceObject.assertUniqueStrings)(observedAppIds, 'generated app package manifests');
|
|
796
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)([
|
|
797
|
-
...observedAppIds
|
|
798
|
-
].toSorted(), [
|
|
799
|
-
...workspaceValidationContract.cohort.appIds
|
|
800
|
-
].toSorted(), 'generated app package manifest cohort', 'restore every generated app package manifest');
|
|
801
|
-
};
|
|
802
|
-
const assertPublicSurfaceAssets = (appPath)=>{
|
|
803
|
-
for (const relativePath of publicSurfaceManagedSourceAssetPaths)assertNotExists(`${appPath}/${relativePath}`);
|
|
804
|
-
};
|
|
805
|
-
const expectedWorkerName = (packageSuffix)=>`${packageScope}-${packageSuffix}`.slice(0, 63);
|
|
806
|
-
const parseSemver = (version)=>{
|
|
807
|
-
const match = /^(\d+)\.(\d+)\.(\d+)/u.exec(version);
|
|
808
|
-
(0, external_assertions_cjs_namespaceObject.assert)(match, `Unable to parse pnpm version: ${version}`);
|
|
809
|
-
return {
|
|
810
|
-
major: Number(match[1]),
|
|
811
|
-
minor: Number(match[2]),
|
|
812
|
-
patch: Number(match[3])
|
|
813
|
-
};
|
|
814
|
-
};
|
|
815
|
-
const compareSemver = (left, right)=>left.major - right.major || left.minor - right.minor || left.patch - right.patch;
|
|
816
|
-
const activePnpmVersion = (0, external_node_child_process_namespaceObject.execFileSync)('pnpm', [
|
|
817
|
-
'--pm-on-fail=ignore',
|
|
818
|
-
'--version'
|
|
819
|
-
], {
|
|
820
|
-
cwd: root,
|
|
821
|
-
encoding: 'utf-8',
|
|
822
|
-
stdio: [
|
|
823
|
-
'ignore',
|
|
824
|
-
'pipe',
|
|
825
|
-
'pipe'
|
|
133
|
+
const readJson = (relative)=>record(JSON.parse(external_node_fs_default().readFileSync(safePath(root, relative, relative), 'utf8')), relative);
|
|
134
|
+
const topology = readJson('topology/reference-topology.json');
|
|
135
|
+
const ownership = readJson('topology/ownership.json');
|
|
136
|
+
const overlay = readJson('topology/local-overlays/development.json');
|
|
137
|
+
const rootManifest = readJson('package.json');
|
|
138
|
+
const workspace = record(utils_namespaceObject.yaml.load(external_node_fs_default().readFileSync(external_node_path_default().join(root, 'pnpm-workspace.yaml'), 'utf8')), 'pnpm-workspace.yaml');
|
|
139
|
+
for (const [label, value] of [
|
|
140
|
+
[
|
|
141
|
+
'topology',
|
|
142
|
+
topology
|
|
143
|
+
],
|
|
144
|
+
[
|
|
145
|
+
'ownership',
|
|
146
|
+
ownership
|
|
147
|
+
],
|
|
148
|
+
[
|
|
149
|
+
'overlay',
|
|
150
|
+
overlay
|
|
826
151
|
]
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
const
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
const currentPnpmVersion = parseSemver(activePnpmVersion);
|
|
835
|
-
const minimumNodeVersion = {
|
|
836
|
-
major: 26,
|
|
837
|
-
minor: 0,
|
|
838
|
-
patch: 0
|
|
839
|
-
};
|
|
840
|
-
const currentNodeVersion = parseSemver(activeNodeVersion);
|
|
841
|
-
(0, external_assertions_cjs_namespaceObject.assert)(compareSemver(currentPnpmVersion, minimumPnpmVersion) >= 0, `Generated workspace requires pnpm >=11; active pnpm is ${activePnpmVersion}. Run mise install, then rerun pnpm from the activated shell.`);
|
|
842
|
-
(0, external_assertions_cjs_namespaceObject.assert)(compareSemver(currentNodeVersion, minimumNodeVersion) >= 0, `Generated workspace requires Node >=26; active Node is ${activeNodeVersion}. Run mise install, then rerun node from the activated shell.`);
|
|
843
|
-
const requiredPaths = [
|
|
844
|
-
'.gitignore',
|
|
845
|
-
'package.json',
|
|
846
|
-
'pnpm-workspace.yaml',
|
|
847
|
-
`patches/@module-federation__modern-js-v3@${expectedModuleFederationVersion}.patch`,
|
|
848
|
-
`patches/@module-federation__bridge-react@${expectedModuleFederationVersion}.patch`,
|
|
849
|
-
`patches/@module-federation__runtime-core@${expectedModuleFederationVersion}.patch`,
|
|
850
|
-
'tsconfig.json',
|
|
851
|
-
'tsconfig.base.json',
|
|
852
|
-
'oxlint.config.ts',
|
|
853
|
-
'oxfmt.config.ts',
|
|
854
|
-
'.agents/agent-reference-repos.json',
|
|
855
|
-
'topology/reference-topology.json',
|
|
856
|
-
'topology/ownership.json',
|
|
857
|
-
'topology/local-overlays/development.json',
|
|
858
|
-
"scripts/assert-mf-types.mts",
|
|
859
|
-
"scripts/bootstrap-agent-skills.mts",
|
|
860
|
-
"scripts/check-ultramodern-i18n-boundaries.mts",
|
|
861
|
-
...hasBackendSurfaces ? [
|
|
862
|
-
"scripts/generate-node-backend-federation.mts"
|
|
863
|
-
] : [],
|
|
864
|
-
"scripts/generate-public-surface-assets.mts",
|
|
865
|
-
"scripts/generate-tanstack-routes.mts",
|
|
866
|
-
"scripts/proof-cloudflare-version.mts",
|
|
867
|
-
...hasDeliveryUnits ? [
|
|
868
|
-
"scripts/proof-workerd-ssr.mts"
|
|
869
|
-
] : [],
|
|
870
|
-
...hasBackendSurfaces ? [
|
|
871
|
-
"scripts/proof-node-backend-federation.mts"
|
|
872
|
-
] : [],
|
|
873
|
-
"scripts/setup-agent-reference-repos.mts",
|
|
874
|
-
"scripts/ultramodern-performance-readiness.config.mjs",
|
|
875
|
-
"scripts/ultramodern-performance-readiness.mts",
|
|
876
|
-
"scripts/ultramodern-typecheck.mts",
|
|
877
|
-
"scripts/validate-ultramodern-workspace.mts",
|
|
878
|
-
"scripts/verify-cloudflare-output.mts",
|
|
879
|
-
'apps/shell-super-app/package.json',
|
|
880
|
-
'apps/shell-super-app/tsconfig.json',
|
|
881
|
-
'apps/shell-super-app/tsconfig.mf-types.json',
|
|
882
|
-
'apps/shell-super-app/modern.config.ts',
|
|
883
|
-
'apps/shell-super-app/module-federation.config.ts',
|
|
884
|
-
'apps/shell-super-app/src/modern-app-env.d.ts',
|
|
885
|
-
'apps/shell-super-app/src/modern.runtime.ts',
|
|
886
|
-
'apps/shell-super-app/src/api/vertical-clients.ts',
|
|
887
|
-
'apps/shell-super-app/locales/en/translation.json',
|
|
888
|
-
`apps/shell-super-app/locales/en/${shellNamespace}.json`,
|
|
889
|
-
'apps/shell-super-app/locales/cs/translation.json',
|
|
890
|
-
`apps/shell-super-app/locales/cs/${shellNamespace}.json`,
|
|
891
|
-
'apps/shell-super-app/src/routes/index.css',
|
|
892
|
-
'apps/shell-super-app/src/routes/layout.tsx',
|
|
893
|
-
'apps/shell-super-app/src/routes/shell-frame.tsx',
|
|
894
|
-
'apps/shell-super-app/src/routes/ultramodern-route-head.tsx',
|
|
895
|
-
'apps/shell-super-app/src/routes/ultramodern-route-metadata.ts',
|
|
896
|
-
'packages/shared-contracts/package.json',
|
|
897
|
-
'packages/shared-contracts/src/index.ts',
|
|
898
|
-
'packages/shared-contracts/tsconfig.json',
|
|
899
|
-
'packages/shared-design-tokens/package.json',
|
|
900
|
-
'packages/shared-design-tokens/src/index.ts',
|
|
901
|
-
'packages/shared-design-tokens/src/tokens.css',
|
|
902
|
-
'packages/shared-design-tokens/tsconfig.json'
|
|
152
|
+
])assert(1 === value.schemaVersion, `${label} schemaVersion must be 1`);
|
|
153
|
+
assert(rootManifest.name === expected.packageScope, 'Root package name disagrees with the workspace scope');
|
|
154
|
+
const shell = record(topology.shell, 'topology.shell');
|
|
155
|
+
const verticals = entries(topology.verticals, 'topology.verticals');
|
|
156
|
+
const shells = [
|
|
157
|
+
shell,
|
|
158
|
+
...entries(topology.shells ?? [], 'topology.shells')
|
|
903
159
|
];
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
160
|
+
const apps = [
|
|
161
|
+
...shells,
|
|
162
|
+
...verticals
|
|
163
|
+
];
|
|
164
|
+
const shared = entries(topology.sharedPackages ?? [], 'topology.sharedPackages');
|
|
165
|
+
const owners = entries(ownership.owners, 'ownership.owners');
|
|
166
|
+
distinct(apps.map((app)=>app.id), 'topology app ids');
|
|
167
|
+
distinct([
|
|
168
|
+
...apps,
|
|
169
|
+
...shared
|
|
170
|
+
].map((app)=>app.path), 'topology package paths');
|
|
171
|
+
distinct(shared.map((pkg)=>pkg.id), 'topology shared package ids');
|
|
172
|
+
distinct(owners.map((owner)=>owner.id), 'ownership ids');
|
|
173
|
+
assert(shared.length === expected.sharedPackages.length, 'Shared package membership disagrees with canonical inputs');
|
|
174
|
+
for (const expectedShared of expected.sharedPackages){
|
|
175
|
+
const actual = shared.find((entry)=>entry.id === expectedShared.id);
|
|
176
|
+
assert(actual?.path === expectedShared.path && actual?.package === expectedShared.packageName, `${expectedShared.id} shared package identity disagrees with canonical inputs`);
|
|
916
177
|
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
})
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
const rootPackage = readJson('package.json');
|
|
958
|
-
const ultramodernConfig = readJson(compactConfigPath);
|
|
959
|
-
const topology = readJson(workspaceValidationContract.metadata.referenceTopology.path);
|
|
960
|
-
const ownership = readJson(workspaceValidationContract.metadata.ownership.path);
|
|
961
|
-
const overlay = readJson(workspaceValidationContract.metadata.developmentOverlay.path);
|
|
962
|
-
assertStructuredWorkspaceMetadata({
|
|
963
|
-
ultramodernConfig,
|
|
964
|
-
topology,
|
|
965
|
-
ownership,
|
|
966
|
-
overlay
|
|
967
|
-
});
|
|
968
|
-
const bridgeConfig = ultramodernConfig?.bridge?.enabled === true ? ultramodernConfig.bridge : void 0;
|
|
969
|
-
const packageSource = createPackageSourceView(ultramodernConfig);
|
|
970
|
-
(0, external_assertions_cjs_namespaceObject.assert)((ultramodernConfig.workspace?.node?.version ?? expectedNodeVersion) === expectedNodeVersion, 'Generated contract must record the Node toolchain version');
|
|
971
|
-
const shellPackage = readJson('apps/shell-super-app/package.json');
|
|
972
|
-
assertMicroVerticalContractGraph({
|
|
973
|
-
topology,
|
|
974
|
-
ownership,
|
|
975
|
-
overlay,
|
|
976
|
-
shellPackage
|
|
977
|
-
});
|
|
978
|
-
for (const field of [
|
|
979
|
-
'features',
|
|
980
|
-
'deploy',
|
|
981
|
-
'moduleFederation',
|
|
982
|
-
'backendFederation',
|
|
983
|
-
'agentSkills',
|
|
984
|
-
'tooling'
|
|
985
|
-
])(0, external_assertions_cjs_namespaceObject.assertSameJson)(ultramodernConfig[field], workspaceValidationContract.policy.compactConfig[field], `${compactConfigPath} policy.${field}`, 'restore framework policy metadata');
|
|
986
|
-
assertTsConfigReferenceGraph();
|
|
987
|
-
(0, external_assertions_cjs_namespaceObject.assert)(true === rootPackage.private, 'Root package must be private');
|
|
988
|
-
(0, external_assertions_cjs_namespaceObject.assert)('string' == typeof rootPackage.packageManager, 'Root must declare packageManager');
|
|
989
|
-
const packageManagerPnpmVersionMatch = /^pnpm@(\d+\.\d+\.\d+)$/u.exec(rootPackage.packageManager);
|
|
990
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageManagerPnpmVersionMatch, 'Root packageManager must pin pnpm with a semver version');
|
|
991
|
-
const packageManagerPnpmVersion = packageManagerPnpmVersionMatch[1];
|
|
992
|
-
(0, external_assertions_cjs_namespaceObject.assert)(compareSemver(parseSemver(packageManagerPnpmVersion), minimumPnpmVersion) >= 0, 'Root packageManager must use pnpm >=11');
|
|
993
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.engines?.node === '>=26', 'Root must require Node >=26');
|
|
994
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.engines?.pnpm === '>=11', 'Root must require pnpm >=11');
|
|
995
|
-
const activeMiseTools = JSON.parse((0, external_node_child_process_namespaceObject.execFileSync)('mise', [
|
|
996
|
-
'ls',
|
|
997
|
-
'--current',
|
|
998
|
-
'--json'
|
|
999
|
-
], {
|
|
1000
|
-
cwd: root,
|
|
1001
|
-
encoding: 'utf-8'
|
|
1002
|
-
}));
|
|
1003
|
-
(0, external_assertions_cjs_namespaceObject.assert)(activeMiseTools.node?.some((tool)=>tool.requested_version === expectedNodeVersion), 'mise must activate the generated Node version');
|
|
1004
|
-
(0, external_assertions_cjs_namespaceObject.assert)(activeMiseTools.pnpm?.some((tool)=>tool.requested_version === packageManagerPnpmVersion), 'mise must activate the generated pnpm version');
|
|
1005
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.modernjs?.preset === 'presetUltramodern', 'Root must declare presetUltramodern');
|
|
1006
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.modernjs?.packageSource?.config === './.modernjs/ultramodern.json', 'Root must point at compact UltraModern config');
|
|
1007
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.modernjs?.packageSource?.strategy === packageSource.strategy, 'Root package source strategy must match metadata');
|
|
1008
|
-
(0, external_assertions_cjs_namespaceObject.assert)('workspace' === packageSource.strategy || 'install' === packageSource.strategy, 'Package source strategy must be workspace or install');
|
|
1009
|
-
(0, external_assertions_cjs_namespaceObject.assert)('install' === packageSource.strategy || packageSource.modernPackages?.specifier === 'workspace:*', 'Workspace package source must be explicitly backed by workspace:*');
|
|
1010
|
-
assertModernPackageCohort();
|
|
1011
|
-
const assertAdditionalShellCohort = ()=>{
|
|
1012
|
-
const primaryShellConfig = findById(ultramodernConfig.topology?.apps, 'shell-super-app');
|
|
1013
|
-
const overlayPorts = overlay.ports ?? {};
|
|
1014
|
-
const configuredPorts = [
|
|
1015
|
-
...Object.entries(overlayPorts).map(([id, port])=>({
|
|
1016
|
-
id,
|
|
1017
|
-
port
|
|
1018
|
-
})),
|
|
1019
|
-
...Object.hasOwn(overlayPorts, 'shell-super-app') ? [] : [
|
|
1020
|
-
{
|
|
1021
|
-
id: 'shell-super-app',
|
|
1022
|
-
port: primaryShellConfig?.port
|
|
1023
|
-
}
|
|
1024
|
-
],
|
|
1025
|
-
...expectedAdditionalShells.map((shell)=>({
|
|
1026
|
-
id: shell.id,
|
|
1027
|
-
port: shell.port
|
|
1028
|
-
}))
|
|
1029
|
-
];
|
|
1030
|
-
const portsByValue = new Map();
|
|
1031
|
-
for (const { id, port } of configuredPorts){
|
|
1032
|
-
(0, external_assertions_cjs_namespaceObject.assert)('number' == typeof port && Number.isFinite(port), `Configured development port for ${id} must be finite`);
|
|
1033
|
-
const previous = portsByValue.get(port);
|
|
1034
|
-
(0, external_assertions_cjs_namespaceObject.assert)(void 0 === previous, `Duplicate configured development port ${port} for ${previous} and ${id}`);
|
|
1035
|
-
portsByValue.set(port, id);
|
|
178
|
+
const expectedApps = new Map(expected.apps.map((app)=>[
|
|
179
|
+
app.id,
|
|
180
|
+
app
|
|
181
|
+
]));
|
|
182
|
+
assert(apps.length === expectedApps.size, 'Topology app membership disagrees with canonical inputs');
|
|
183
|
+
const verticalIds = new Set(verticals.map((vertical)=>vertical.id));
|
|
184
|
+
const ids = new Set(apps.map((app)=>app.id));
|
|
185
|
+
for (const app of apps){
|
|
186
|
+
const input = expectedApps.get(app.id);
|
|
187
|
+
assert(input, `Unexpected topology app ${app.id}`);
|
|
188
|
+
assert(app.kind === input.kind, `${app.id} kind disagrees with canonical inputs`);
|
|
189
|
+
assert(app.path === input.path, `${app.id} path disagrees with canonical inputs`);
|
|
190
|
+
assert(app.package === input.packageName, `${app.id} package identity disagrees with canonical inputs`);
|
|
191
|
+
const manifest = readJson(`${app.path}/package.json`);
|
|
192
|
+
assert(manifest.name === app.package, `${app.id} package name contradicts topology`);
|
|
193
|
+
assert(manifest.modernjs?.appId === app.id, `${app.id} modernjs.appId contradicts topology`);
|
|
194
|
+
const owner = owners.find((candidate)=>candidate.id === app.id);
|
|
195
|
+
assert(owner?.path === app.path && owner?.package === manifest.name, `${app.id} ownership identity contradicts topology and package.json`);
|
|
196
|
+
const refs = app.moduleFederation?.verticalRefs ?? app.verticalRefs ?? [];
|
|
197
|
+
assert(Array.isArray(refs), `${app.id} verticalRefs must be an array`);
|
|
198
|
+
distinct(refs, `${app.id} verticalRefs`);
|
|
199
|
+
for (const ref of refs)assert(verticalIds.has(ref), `${app.id} references unknown vertical ${ref}`);
|
|
200
|
+
assert(JSON.stringify(refs) === JSON.stringify(input.verticalRefs), `${app.id} verticalRefs disagree with canonical inputs`);
|
|
201
|
+
const port = overlay.ports?.[app.id];
|
|
202
|
+
assert(Number.isInteger(port) && port > 0 && port < 65536, `${app.id} has no development port`);
|
|
203
|
+
requiredFile(root, `${app.path}/modern.config.ts`, `${app.id} Modern.js config`);
|
|
204
|
+
if (input.emitsUi) requiredFile(root, `${app.path}/src/modern.runtime.ts`, `${app.id} runtime`);
|
|
205
|
+
requiredFile(root, `${app.path}/shared/ultramodern-build.json`, `${app.id} build stamp`);
|
|
206
|
+
const cloudflare = record(app.cloudflare, `${app.id} cloudflare`);
|
|
207
|
+
for (const field of [
|
|
208
|
+
'workerName',
|
|
209
|
+
'publicUrlEnv'
|
|
210
|
+
])assert('string' == typeof cloudflare[field] && cloudflare[field].length > 0, `${app.id} cloudflare.${field} is required`);
|
|
211
|
+
const cloudflareRoutes = record(cloudflare.routes, `${app.id} cloudflare.routes`);
|
|
212
|
+
record(cloudflare.security, `${app.id} cloudflare.security`);
|
|
213
|
+
record(cloudflare.qualityGates, `${app.id} cloudflare.qualityGates`);
|
|
214
|
+
if ('shell' === app.kind) assert('string' == typeof cloudflareRoutes.ssr && cloudflareRoutes.ssr.startsWith('/'), `${app.id} cloudflare SSR route is required`);
|
|
215
|
+
if (input.emitsApi) {
|
|
216
|
+
const routeKey = app.api?.protocol === 'rpc' ? 'rpc' : 'apiReadiness';
|
|
217
|
+
assert('string' == typeof cloudflareRoutes[routeKey] && cloudflareRoutes[routeKey].startsWith('/'), `${app.id} cloudflare API ${routeKey} route is required`);
|
|
1036
218
|
}
|
|
1037
|
-
if (
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
primaryShellConfig?.moduleFederation?.name,
|
|
1046
|
-
...expectedAdditionalShells.map((shell)=>shell.mfName)
|
|
1047
|
-
], 'configured shell Module Federation identities');
|
|
1048
|
-
(0, external_assertions_cjs_namespaceObject.assertUniqueStrings)(expectedAdditionalShells.map((shell)=>shell.deliveryUnit?.buildMarker), 'configured shell build markers');
|
|
1049
|
-
for (const shell of expectedAdditionalShells){
|
|
1050
|
-
const configShell = configuredShellById.get(shell.id);
|
|
1051
|
-
(0, external_assertions_cjs_namespaceObject.assertObject)(configShell, `${compactConfigPath} shells.${shell.id}`, 'restore the generated additional-shell config record');
|
|
1052
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)({
|
|
1053
|
-
id: configShell.id,
|
|
1054
|
-
name: configShell.name,
|
|
1055
|
-
kind: configShell.kind,
|
|
1056
|
-
package: configShell.package,
|
|
1057
|
-
path: configShell.path,
|
|
1058
|
-
port: configShell.port,
|
|
1059
|
-
portEnv: configShell.portEnv,
|
|
1060
|
-
mfName: configShell.mfName,
|
|
1061
|
-
verticalRefs: configShell.verticalRefs,
|
|
1062
|
-
owner: configShell.owner,
|
|
1063
|
-
deliveryUnit: configShell.deliveryUnit,
|
|
1064
|
-
moduleFederation: configShell.moduleFederation
|
|
1065
|
-
}, {
|
|
1066
|
-
id: shell.id,
|
|
1067
|
-
name: shell.id.replace(/^shell-/u, ''),
|
|
1068
|
-
kind: 'shell',
|
|
1069
|
-
package: shell.packageName,
|
|
1070
|
-
path: shell.path,
|
|
1071
|
-
port: shell.port,
|
|
1072
|
-
portEnv: shell.portEnv,
|
|
1073
|
-
mfName: shell.mfName,
|
|
1074
|
-
verticalRefs: shell.verticalRefs,
|
|
1075
|
-
owner: shell.owner,
|
|
1076
|
-
deliveryUnit: shell.deliveryUnit,
|
|
1077
|
-
moduleFederation: shell.moduleFederation
|
|
1078
|
-
}, `${compactConfigPath} shells.${shell.id}`, 'restore the complete additional-shell config record');
|
|
1079
|
-
(0, external_assertions_cjs_namespaceObject.assert)(!Object.hasOwn(overlay.ports ?? {}, shell.id), `${shell.id} port must stay in config.shells, not the development overlay`);
|
|
1080
|
-
const owner = configShell.owner;
|
|
1081
|
-
(0, external_assertions_cjs_namespaceObject.assertObject)(owner, `${compactConfigPath} shells.${shell.id}.owner`, 'record exactly one owner for every configured Delivery Unit');
|
|
1082
|
-
(0, external_assertions_cjs_namespaceObject.assert)([
|
|
1083
|
-
'team',
|
|
1084
|
-
'agent',
|
|
1085
|
-
'agent-team'
|
|
1086
|
-
].includes(owner.kind) && 'string' == typeof owner.id && owner.id.length > 0, `${compactConfigPath} shells.${shell.id}.owner must identify one accountable owner`);
|
|
1087
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(owner, shell.owner, `${compactConfigPath} shells.${shell.id}.owner`, 'restore the generated additional-shell owner attribution');
|
|
1088
|
-
(0, external_assertions_cjs_namespaceObject.assertObject)(configShell.deliveryUnit, `${compactConfigPath} shells.${shell.id}.deliveryUnit`, 'restore the generated additional-shell Delivery Unit identity');
|
|
1089
|
-
(0, external_assertions_cjs_namespaceObject.assert)('string' == typeof configShell.deliveryUnit.unitId && configShell.deliveryUnit.unitId.length > 0 && 'string' == typeof configShell.deliveryUnit.buildMarker && configShell.deliveryUnit.buildMarker.length > 0, `${compactConfigPath} shells.${shell.id}.deliveryUnit must carry unitId and buildMarker`);
|
|
1090
|
-
const packagePath = `${shell.path}/package.json`;
|
|
1091
|
-
const packageJson = readJson(packagePath);
|
|
1092
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageJson.name === shell.packageName, `${shell.id} package name is incorrect`);
|
|
1093
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageJson.modernjs?.appId === shell.id, `${shell.id} package modernjs.appId is incorrect`);
|
|
1094
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageJson.modernjs?.role === 'shell', `${shell.id} package modernjs.role must be shell`);
|
|
1095
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageJson.scripts?.['cloudflare:deploy'] === 'cross-env ULTRAMODERN_CLOUDFLARE_REQUIRE_PUBLIC_URLS=true pnpm run cloudflare:build && wrangler deploy --config .output/wrangler.json', `${shell.id} must expose a portable cloudflare:deploy`);
|
|
1096
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageJson.devDependencies?.['cross-env'] === expectedCrossEnvVersion, `${shell.id} cross-env dependency must match the portable generated-script cohort`);
|
|
1097
|
-
assertPortableGeneratedEnvironmentScripts(packageJson, shell.id);
|
|
1098
|
-
const buildArtifact = readJson(`${shell.path}/shared/ultramodern-build.json`);
|
|
1099
|
-
(0, external_assertions_cjs_namespaceObject.assert)(buildArtifact.deliveryUnit?.appId === shell.id, `${shell.id} build artifact appId is incorrect`);
|
|
1100
|
-
(0, external_assertions_cjs_namespaceObject.assert)(buildArtifact.deliveryUnit?.buildMarker === shell.deliveryUnit?.buildMarker, `${shell.id} build marker is not participating in the build artifact`);
|
|
1101
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(deliveryUnitBlock(configShell.deliveryUnit), deliveryUnitBlock(shell.deliveryUnit), `${compactConfigPath} shells.${shell.id}.deliveryUnit`, deliveryUnitIdentityFixArea);
|
|
1102
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(deliveryUnitBlock(buildArtifact.deliveryUnit), deliveryUnitBlock(shell.deliveryUnit), `${shell.path}/shared/ultramodern-build.json deliveryUnit`, deliveryUnitIdentityFixArea);
|
|
1103
|
-
(0, external_assertions_cjs_namespaceObject.assert)(shell.degradedState?.appId === shell.id && shell.degradedState?.status === 'degraded', `${shell.id} degraded-state contract must identify its own shell`);
|
|
1104
|
-
if ((shell.verticalRefs ?? []).length > 0) (0, external_assertions_cjs_namespaceObject.assert)(true === shell.degradedState.required, `${shell.id} degraded-state contract must be required for remote consumption`);
|
|
219
|
+
if (input.emitsUi && 'shell' !== app.kind) {
|
|
220
|
+
assert('string' == typeof overlay.manifests?.[app.id], `${app.id} has no development MF manifest URL`);
|
|
221
|
+
developmentUrl(overlay.manifests[app.id], port, `${app.id} MF manifest URL`, '/mf-manifest.json');
|
|
222
|
+
requiredFile(root, `${app.path}/module-federation.config.ts`, `${app.id} Module Federation config`);
|
|
223
|
+
for (const [expose, relative] of Object.entries(input.exposes)){
|
|
224
|
+
assert('string' == typeof relative && relative.startsWith('./src/'), `${app.id} ${expose} Module Federation expose must target a source file`);
|
|
225
|
+
assert(external_node_fs_default().existsSync(external_node_path_default().join(root, app.path, relative)), `${app.id} ${expose} Module Federation expose source ${relative} is missing`);
|
|
226
|
+
}
|
|
1105
227
|
}
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
'
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
])(0, external_assertions_cjs_namespaceObject.assert)(/^@[^/]+\/.+/.test(modernAliases[modernPackageName] ?? ''), `Install package source alias for ${modernPackageName} must be a scoped npm package`);
|
|
1127
|
-
}
|
|
1128
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageSource.generatedWorkspacePackages?.specifier === 'workspace:*', 'Generated workspace packages must keep workspace:* links');
|
|
1129
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.scripts?.build === expectedBuildScript, "Root build script must build verticals before shell");
|
|
1130
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.scripts?.['cloudflare:build'] === expectedCloudflareBuildScript, "Root cloudflare:build script is incorrect");
|
|
1131
|
-
(0, external_assertions_cjs_namespaceObject.assert)(!('ultramodern:check' in (rootPackage.scripts ?? {})), 'Root must not expose ultramodern:check');
|
|
1132
|
-
if (bridgeConfig) {
|
|
1133
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.scripts?.typecheck === 'pnpm -r --filter "./apps/*" --filter "./verticals/*" --filter "./packages/*" run typecheck', 'Bridge root typecheck must check generated package boundaries without building parent implementation sources');
|
|
1134
|
-
(0, external_assertions_cjs_namespaceObject.assert)(Array.isArray(bridgeConfig.workspacePackages), 'Bridge config must record workspace package patterns');
|
|
1135
|
-
for (const workspacePackage of bridgeConfig.workspacePackages){
|
|
1136
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.workspaces?.includes(workspacePackage.pattern), `Root workspaces must include bridge package pattern ${workspacePackage.pattern}`);
|
|
1137
|
-
(0, external_assertions_cjs_namespaceObject.assert)(readPnpmWorkspaceConfig('packages').includes(workspacePackage.pattern), `pnpm-workspace.yaml must include bridge package pattern ${workspacePackage.pattern}`);
|
|
228
|
+
if (input.emitsApi) assert('string' == typeof overlay.apis?.[app.id], `${app.id} has no development API URL`);
|
|
229
|
+
if (input.emitsApi && 'vertical' === app.kind) {
|
|
230
|
+
const apiUrl = developmentUrl(overlay.apis[app.id], port, `${app.id} API URL`);
|
|
231
|
+
const serverExecution = record(overlay.serverExecution?.[app.id], `${app.id} server execution`);
|
|
232
|
+
assert(serverExecution.apiBaseUrl === apiUrl.href.replace(/\/$/, ''), `${app.id} server execution API URL disagrees with overlay`);
|
|
233
|
+
const backend = record(app.backendFederation, `${app.id} backendFederation`);
|
|
234
|
+
const node = record(backend.executionSurfaces?.node, `${app.id} backendFederation node`);
|
|
235
|
+
developmentUrl(node.manifestUrl, port, `${app.id} backend manifest URL`, '/backend-mf-manifest.json');
|
|
236
|
+
developmentUrl(node.containerEntry, port, `${app.id} backend container URL`, '/backendRemoteEntry.cjs');
|
|
237
|
+
validateBackendFederationEntrypoints(root, app.path, app.id);
|
|
238
|
+
const apiExport = manifest.exports?.['./api'];
|
|
239
|
+
assert('string' == typeof apiExport && apiExport.startsWith('./shared/'), `${app.id} must export its shared API contract`);
|
|
240
|
+
assert(external_node_fs_default().existsSync(external_node_path_default().join(root, app.path, apiExport)), `${app.id} shared API contract ${apiExport} is missing`);
|
|
241
|
+
validateApiClientExports(root, app.path, app.id, manifest.exports);
|
|
242
|
+
const backendDelivery = record(backend.deliveryUnit, `${app.id} backendFederation.deliveryUnit`);
|
|
243
|
+
assert(backendDelivery.unitId === app.deliveryUnit?.unitId && backendDelivery.packageName === manifest.name && backendDelivery.buildMarker === app.deliveryUnit?.buildMarker, `${app.id} backend federation delivery identity contradicts topology`);
|
|
244
|
+
assert(backend.versionBoundary?.identityRoot === 'deliveryUnit' && backend.versionBoundary?.packageName === manifest.name, `${app.id} backend federation version boundary contradicts topology`);
|
|
245
|
+
assert(node.expected?.unitId === app.deliveryUnit?.unitId && node.expected?.buildMarker === app.deliveryUnit?.buildMarker, `${app.id} backend federation node identity contradicts topology`);
|
|
246
|
+
assert(serverExecution.deliveryUnit?.unitId === app.deliveryUnit?.unitId && serverExecution.deliveryUnit?.buildMarker === app.deliveryUnit?.buildMarker, `${app.id} server execution identity contradicts topology`);
|
|
247
|
+
assert(serverExecution.node?.manifestUrl === node.manifestUrl && serverExecution.node?.containerEntry === node.containerEntry, `${app.id} server execution node endpoints contradict topology`);
|
|
1138
248
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
(
|
|
249
|
+
if ('vertical' === app.kind && !input.emitsUi) validateApiOnlySourceSurface(root, app);
|
|
250
|
+
if ('vertical' === app.kind && !input.emitsApi) {
|
|
251
|
+
assert(!Object.hasOwn(overlay.apis ?? {}, app.id) && !Object.hasOwn(overlay.serverExecution ?? {}, app.id), `${app.id} UI-only vertical must not declare API endpoints`);
|
|
252
|
+
assert(!app.backendFederation && !app.api, `${app.id} UI-only vertical must not declare a backend API`);
|
|
253
|
+
for (const relative of [
|
|
254
|
+
'shared/api.ts',
|
|
255
|
+
'shared/rpc.ts',
|
|
256
|
+
'backend-federation.config.ts',
|
|
257
|
+
'api/index.ts',
|
|
258
|
+
'api/effect-api.ts',
|
|
259
|
+
'api/backend-federation.ts',
|
|
260
|
+
`src/api/${app.id}-client.ts`,
|
|
261
|
+
`src/api/${app.id}-rpc-client.ts`
|
|
262
|
+
])assert(!external_node_fs_default().existsSync(external_node_path_default().join(root, app.path, relative)), `Unexpected ${app.path}/${relative} for a ui-only unit`);
|
|
1142
263
|
}
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.scripts?.['i18n:boundaries'] === "node ./scripts/check-ultramodern-i18n-boundaries.mts", 'Root must expose i18n:boundaries');
|
|
1148
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.scripts?.['performance:readiness'] === "node ./scripts/ultramodern-performance-readiness.mts", 'Root must expose default-on performance readiness diagnostics');
|
|
1149
|
-
if (hasBackendSurfaces) {
|
|
1150
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.scripts?.['node:backend-federation:generate'] === "node ./scripts/generate-node-backend-federation.mts", 'Root must expose local Node backend federation artifact generation');
|
|
1151
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.scripts?.['node:proof'] === "node ./scripts/proof-node-backend-federation.mts", 'Root must expose read-only node:proof for already-built backend federation Effect modules');
|
|
1152
|
-
} else {
|
|
1153
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.scripts?.['node:backend-federation:generate'] === void 0, 'Root must not expose backend federation generation without an API surface');
|
|
1154
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.scripts?.['node:proof'] === void 0, 'Root must not expose node:proof without an API surface');
|
|
264
|
+
const delivery = record(app.deliveryUnit, `${app.id} deliveryUnit`);
|
|
265
|
+
assert('string' == typeof delivery.unitId && delivery.unitId.length > 0 && delivery.packageName === manifest.name, `${app.id} delivery unit identity contradicts package.json`);
|
|
266
|
+
const build = readJson(`${app.path}/shared/ultramodern-build.json`);
|
|
267
|
+
assert(build.deliveryUnit?.unitId === delivery.unitId && build.deliveryUnit?.packageName === manifest.name && build.deliveryUnit?.buildMarker === delivery.buildMarker, `${app.id} build identity contradicts topology`);
|
|
1155
268
|
}
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
(
|
|
1160
|
-
} else {
|
|
1161
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.scripts?.['zerops:materialize'] === void 0, 'Root must not expose Zerops materialization in a shell-only workspace');
|
|
1162
|
-
(0, external_assertions_cjs_namespaceObject.assert)(rootPackage.scripts?.['cloudflare:ssr-proof'] === void 0, 'Root must not expose workerd SSR proof in a shell-only workspace');
|
|
269
|
+
for (const pkg of shared){
|
|
270
|
+
const manifest = readJson(`${pkg.path}/package.json`);
|
|
271
|
+
assert(manifest.name === pkg.package, `${pkg.id} shared package identity contradicts topology`);
|
|
272
|
+
assert(owners.some((owner)=>owner.id === pkg.id && owner.path === pkg.path && owner.package === manifest.name), `${pkg.id} ownership identity contradicts package.json`);
|
|
1163
273
|
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
(0,
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
const
|
|
1179
|
-
const
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
assertPublicSurfaceAssets('apps/shell-super-app');
|
|
1197
|
-
(0, external_assertions_cjs_namespaceObject.assert)(topology.shell?.verticalRefs?.join(',') === expectedPrimaryShellVerticalIds.join(','), 'Topology shell verticalRefs must match generated verticals');
|
|
1198
|
-
(0, external_assertions_cjs_namespaceObject.assert)(topology.verticals?.length === fullStackVerticals.length, 'Topology must contain only generated verticals');
|
|
1199
|
-
(0, external_assertions_cjs_namespaceObject.assert)(!('remotes' in topology), 'Topology must not expose legacy remotes; use verticals');
|
|
1200
|
-
(0, external_assertions_cjs_namespaceObject.assert)(!('effectServices' in topology), 'Default APIs must be vertical-owned, not effectServices');
|
|
1201
|
-
for (const vertical of fullStackVerticals){
|
|
1202
|
-
const packageJson = readJson(`${vertical.path}/package.json`);
|
|
1203
|
-
const ultramodernBuildArtifact = readJson(`${vertical.path}/shared/ultramodern-build.json`);
|
|
1204
|
-
if (vertical.deliveryUnit) {
|
|
1205
|
-
findById(topology.verticals, vertical.id);
|
|
1206
|
-
const expectedDeliveryUnit = deliveryUnitBlock(expectedDeliveryUnitFor(vertical));
|
|
1207
|
-
const buildLabel = `${vertical.path}/shared/ultramodern-build.json deliveryUnit`;
|
|
1208
|
-
const buildIdentity = ultramodernBuildArtifact.deliveryUnit ?? {};
|
|
1209
|
-
(0, external_assertions_cjs_namespaceObject.assertSelfCheck)(buildIdentity.buildMarker === expectedDeliveryUnit.buildMarker, buildLabel, `Expected build "${expectedDeliveryUnit.buildMarker}", found ${(0, external_assertions_cjs_namespaceObject.formatJson)(buildIdentity.buildMarker)}`, deliveryUnitIdentityFixArea);
|
|
1210
|
-
(0, external_assertions_cjs_namespaceObject.assertSelfCheck)(buildIdentity.unitId === expectedDeliveryUnit.unitId, buildLabel, `Expected unitId "${expectedDeliveryUnit.unitId}", found ${(0, external_assertions_cjs_namespaceObject.formatJson)(buildIdentity.unitId)}`, deliveryUnitIdentityFixArea);
|
|
1211
|
-
(0, external_assertions_cjs_namespaceObject.assertSelfCheck)(buildIdentity.packageName === expectedDeliveryUnit.packageName, buildLabel, `Expected packageName "${expectedDeliveryUnit.packageName}", found ${(0, external_assertions_cjs_namespaceObject.formatJson)(buildIdentity.packageName)}`, deliveryUnitIdentityFixArea);
|
|
1212
|
-
(0, external_assertions_cjs_namespaceObject.assertSelfCheck)(buildIdentity.version === expectedDeliveryUnit.version, buildLabel, `Expected version "${expectedDeliveryUnit.version}", found ${(0, external_assertions_cjs_namespaceObject.formatJson)(buildIdentity.version)}`, deliveryUnitIdentityFixArea);
|
|
1213
|
-
}
|
|
1214
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageJson.name === vertical.packageName, `${vertical.id} package name is incorrect`);
|
|
1215
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageJson.scripts?.['cloudflare:deploy'] === 'cross-env ULTRAMODERN_CLOUDFLARE_REQUIRE_PUBLIC_URLS=true pnpm run cloudflare:build && wrangler deploy --config .output/wrangler.json', `${vertical.id} must expose a portable cloudflare:deploy`);
|
|
1216
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageJson.devDependencies?.['cross-env'] === expectedCrossEnvVersion, `${vertical.id} cross-env dependency must match the portable generated-script cohort`);
|
|
1217
|
-
assertPortableGeneratedEnvironmentScripts(packageJson, vertical.id);
|
|
1218
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageJson.devDependencies?.['@modern-js/app-tools'] === expectedModernPackageSpecifier('@modern-js/app-tools'), `${vertical.id} app-tools dependency must match package source metadata`);
|
|
1219
|
-
if (vertical.emitsApi) (0, external_assertions_cjs_namespaceObject.assert)(packageJson.dependencies?.['@modern-js/plugin-bff'] === expectedModernPackageSpecifier('@modern-js/plugin-bff'), `${vertical.id} plugin-bff dependency must match package source metadata`);
|
|
1220
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageJson.dependencies?.['@modern-js/plugin-i18n'] === expectedModernPackageSpecifier('@modern-js/plugin-i18n'), `${vertical.id} plugin-i18n dependency must match package source metadata`);
|
|
1221
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageJson.dependencies?.['@modern-js/plugin-tanstack'] === expectedModernPackageSpecifier('@modern-js/plugin-tanstack'), `${vertical.id} plugin-tanstack dependency must match package source metadata`);
|
|
1222
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageJson.dependencies?.['@modern-js/runtime'] === expectedModernPackageSpecifier('@modern-js/runtime'), `${vertical.id} runtime dependency must match package source metadata`);
|
|
1223
|
-
if (vertical.emitsApi) {
|
|
1224
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageJson.exports?.[vertical.apiClientExport] === `./${vertical.apiClientPath}`, `${vertical.id} must export its API client`);
|
|
1225
|
-
(0, external_assertions_cjs_namespaceObject.assert)(packageJson.exports?.['./api'] === `./${vertical.apiContractPath}`, `${vertical.id} must export its API contract`);
|
|
1226
|
-
if ('rpc' === vertical.apiProtocol) {
|
|
1227
|
-
(0, external_assertions_cjs_namespaceObject.assert)(!external_node_fs_default().existsSync(external_node_path_default().join(root, `${vertical.path}/src/api/${vertical.stem}-client.ts`)), `${vertical.id} RPC unit must not emit the REST API client`);
|
|
1228
|
-
(0, external_assertions_cjs_namespaceObject.assert)(!external_node_fs_default().existsSync(external_node_path_default().join(root, `${vertical.path}/shared/api.ts`)), `${vertical.id} RPC unit must not emit the REST API contract`);
|
|
1229
|
-
} else {
|
|
1230
|
-
(0, external_assertions_cjs_namespaceObject.assert)(!external_node_fs_default().existsSync(external_node_path_default().join(root, `${vertical.path}/src/api/${vertical.stem}-rpc-client.ts`)), `${vertical.id} REST unit must not emit the RPC API client`);
|
|
1231
|
-
(0, external_assertions_cjs_namespaceObject.assert)(!external_node_fs_default().existsSync(external_node_path_default().join(root, `${vertical.path}/shared/rpc.ts`)), `${vertical.id} REST unit must not emit the RPC API contract`);
|
|
274
|
+
for (const owner of owners)assert(ids.has(owner.id) || shared.some((pkg)=>pkg.id === owner.id), `Ownership names unknown package ${owner.id}`);
|
|
275
|
+
const catalogs = record(workspace.catalogs ?? {}, 'workspace catalogs');
|
|
276
|
+
const catalog = record(catalogs.ultramodern ?? {}, 'ultramodern catalog');
|
|
277
|
+
assert((0, external_ultramodern_release_cohort_cjs_namespaceObject.hasCreateReleaseCohort)() || (0, external_ultramodern_release_cohort_cjs_namespaceObject.isCreatePackageSourceCheckout)(), 'Installed ultramodern-create package is missing release-cohort.json');
|
|
278
|
+
const producer = (0, external_ultramodern_release_cohort_cjs_namespaceObject.hasCreateReleaseCohort)() ? (0, external_ultramodern_release_cohort_cjs_namespaceObject.readCreateReleaseCohort)() : void 0;
|
|
279
|
+
const cohort = new Map(producer?.packages.map((pkg)=>[
|
|
280
|
+
pkg.sourceName,
|
|
281
|
+
pkg
|
|
282
|
+
]) ?? []);
|
|
283
|
+
const members = [
|
|
284
|
+
...apps,
|
|
285
|
+
...shared
|
|
286
|
+
].map((app)=>`${app.path}/package.json`);
|
|
287
|
+
members.push('package.json');
|
|
288
|
+
for (const member of members){
|
|
289
|
+
const manifest = readJson(member);
|
|
290
|
+
for (const group of [
|
|
291
|
+
'dependencies',
|
|
292
|
+
'devDependencies',
|
|
293
|
+
'optionalDependencies',
|
|
294
|
+
'peerDependencies'
|
|
295
|
+
])for (const [name, request] of Object.entries(record(manifest[group] ?? {}, `${member} ${group}`))){
|
|
296
|
+
if (!expected.modernPackages.includes(name)) continue;
|
|
297
|
+
assert('string' == typeof request, `${member} ${name} dependency request must be a string`);
|
|
298
|
+
const catalogRequest = 'catalog:ultramodern' === request ? catalog[name] : void 0;
|
|
299
|
+
const effective = catalogRequest ?? request;
|
|
300
|
+
assert('string' == typeof effective && effective.length > 0, `${member} ${name} has no catalog entry`);
|
|
301
|
+
if ('workspace:*' !== request) assert('catalog:ultramodern' === request, `${member} ${name} must use the ultramodern catalog`);
|
|
302
|
+
if (producer && 'workspace:*' !== request) {
|
|
303
|
+
const release = cohort.get(name);
|
|
304
|
+
assert(release, `${member} ${name} is absent from the installed release cohort`);
|
|
305
|
+
assert(effective === `npm:${release.targetName}@${release.version}`, `${member} ${name} catalog request disagrees with the installed release cohort`);
|
|
1232
306
|
}
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
if ('rpc' !== vertical.apiProtocol) (0, external_assertions_cjs_namespaceObject.assert)(topologyEntry?.api?.readiness?.endpoint === `/${vertical.stem}/readiness`, `${vertical.id} topology readiness endpoint is incorrect`);
|
|
1252
|
-
}
|
|
1253
|
-
if (vertical.deliveryUnit) {
|
|
1254
|
-
const expectedDeliveryUnit = deliveryUnitBlock(expectedDeliveryUnitFor(vertical));
|
|
1255
|
-
const compactAppEntry = ultramodernConfig.topology?.apps?.find((entry)=>entry?.id === vertical.id);
|
|
1256
|
-
if (vertical.emitsApi) {
|
|
1257
|
-
const compactBackendDeliveryUnit = deliveryUnitBlock(compactAppEntry?.backendFederation?.deliveryUnit);
|
|
1258
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(deliveryUnitBlock(compactAppEntry?.deliveryUnit), compactBackendDeliveryUnit, `${compactConfigPath} topology.apps.${vertical.id}.deliveryUnit`, deliveryUnitIdentityFixArea);
|
|
1259
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(compactBackendDeliveryUnit, expectedDeliveryUnit, `${compactConfigPath} topology.apps.${vertical.id}.backendFederation.deliveryUnit`, deliveryUnitIdentityFixArea);
|
|
1260
|
-
(0, external_assertions_cjs_namespaceObject.assertSelfCheck)(compactAppEntry?.backendFederation?.versionBoundary?.identityRoot === 'deliveryUnit', `${compactConfigPath} topology.apps.${vertical.id}.backendFederation.versionBoundary.identityRoot`, `Expected "deliveryUnit", found ${(0, external_assertions_cjs_namespaceObject.formatJson)(compactAppEntry?.backendFederation?.versionBoundary?.identityRoot)}`, deliveryUnitIdentityFixArea);
|
|
307
|
+
let memberDir = external_node_path_default().dirname(external_node_path_default().join(root, member));
|
|
308
|
+
let installedPath;
|
|
309
|
+
while(memberDir.startsWith(external_node_path_default().resolve(root))){
|
|
310
|
+
const candidate = external_node_path_default().join(memberDir, 'node_modules', name, 'package.json');
|
|
311
|
+
if (external_node_fs_default().existsSync(candidate)) {
|
|
312
|
+
installedPath = candidate;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
if (memberDir === external_node_path_default().resolve(root)) break;
|
|
316
|
+
memberDir = external_node_path_default().dirname(memberDir);
|
|
317
|
+
}
|
|
318
|
+
if ('workspace:*' !== request && external_node_fs_default().existsSync(external_node_path_default().join(root, 'node_modules'))) assert(installedPath, `${member} ${name} is not installed`);
|
|
319
|
+
if (installedPath && 'workspace:*' !== request) {
|
|
320
|
+
const installed = record(JSON.parse(external_node_fs_default().readFileSync(installedPath, 'utf8')), installedPath);
|
|
321
|
+
const aliasMatch = /^npm:(@[^/]+\/[^@]+)@(.+)$/u.exec(effective);
|
|
322
|
+
assert(aliasMatch, `${member} ${name} catalog entry must name an installed package and version`);
|
|
323
|
+
assert(installed.name === aliasMatch[1] && installed.version === aliasMatch[2], `${member} ${name} installed package identity/version disagrees with the catalog`);
|
|
324
|
+
if (producer) assert(installed.version === producer.release.version, `${member} ${name} installed version disagrees with the release cohort`);
|
|
1261
325
|
}
|
|
1262
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(deliveryUnitBlock(compactAppEntry?.deliveryUnit), expectedDeliveryUnit, `${compactConfigPath} topology.apps.${vertical.id}.deliveryUnit`, deliveryUnitIdentityFixArea);
|
|
1263
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(deliveryUnitBlock(compactAppEntry?.deliveryUnit), deliveryUnitBlock(topologyEntry?.deliveryUnit), `${compactConfigPath} vs topology/reference-topology.json verticals.${vertical.id}.deliveryUnit`, deliveryUnitIdentityFixArea);
|
|
1264
326
|
}
|
|
1265
|
-
(0, external_assertions_cjs_namespaceObject.assert)(ownership.owners?.some((owner)=>owner.id === vertical.id && owner.path === vertical.path), `${vertical.id} ownership entry is missing`);
|
|
1266
|
-
(0, external_assertions_cjs_namespaceObject.assert)(overlay.ports?.[vertical.id], `${vertical.id} development port is missing`);
|
|
1267
|
-
if (vertical.emitsUi) (0, external_assertions_cjs_namespaceObject.assert)(overlay.manifests?.[vertical.id]?.includes('/mf-manifest.json'), `${vertical.id} development manifest is missing`);
|
|
1268
|
-
if (vertical.emitsApi) (0, external_assertions_cjs_namespaceObject.assert)(overlay.apis?.[vertical.id]?.endsWith('rpc' === vertical.apiProtocol ? `${vertical.apiPrefix}/rpc` : vertical.apiPrefix), `${vertical.id} development API URL is missing`);
|
|
1269
|
-
}
|
|
1270
|
-
for (const expectedApp of workspaceValidationContract.topology.compactConfig?.apps ?? []){
|
|
1271
|
-
const unitLabel = `delivery-unit identity for ${expectedApp.id}`;
|
|
1272
|
-
const expectedDeliveryUnit = deliveryUnitBlock(expectedApp.deliveryUnit);
|
|
1273
|
-
(0, external_assertions_cjs_namespaceObject.assertSelfCheck)('string' == typeof expectedDeliveryUnit.unitId && expectedDeliveryUnit.unitId.length > 0 && 'string' == typeof expectedDeliveryUnit.buildMarker && expectedDeliveryUnit.buildMarker.length > 0, unitLabel, `Every unit kind must declare a delivery-unit record; found ${(0, external_assertions_cjs_namespaceObject.formatJson)(expectedApp.deliveryUnit)}`, deliveryUnitIdentityFixArea);
|
|
1274
|
-
const compactAppEntry = ultramodernConfig.topology?.apps?.find((entry)=>entry?.id === expectedApp.id);
|
|
1275
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(expectedWorkerName(expectedApp.packageSuffix), expectedWorkerName(expectedApp.id), `${compactConfigPath} topology.apps.${expectedApp.id}.packageSuffix`, 'keep the app package suffix aligned with its Cloudflare worker identity');
|
|
1276
|
-
if (expectedApp.id === external_descriptors_cjs_namespaceObject.shellApp.id) (0, external_assertions_cjs_namespaceObject.assertSameJson)({
|
|
1277
|
-
kind: compactAppEntry?.kind,
|
|
1278
|
-
name: compactAppEntry?.moduleFederation?.name ?? external_descriptors_cjs_namespaceObject.shellApp.mfName,
|
|
1279
|
-
portEnv: compactAppEntry?.portEnv ?? external_descriptors_cjs_namespaceObject.shellApp.portEnv
|
|
1280
|
-
}, {
|
|
1281
|
-
kind: external_descriptors_cjs_namespaceObject.shellApp.kind,
|
|
1282
|
-
name: external_descriptors_cjs_namespaceObject.shellApp.mfName,
|
|
1283
|
-
portEnv: external_descriptors_cjs_namespaceObject.shellApp.portEnv
|
|
1284
|
-
}, `${compactConfigPath} topology.apps.${external_descriptors_cjs_namespaceObject.shellApp.id} shell identity`, 'restore the primary shell federation name and port environment');
|
|
1285
|
-
(0, external_assertions_cjs_namespaceObject.assertSelfCheck)(compactAppEntry?.moduleFederation?.ssr !== false, `${compactConfigPath} topology.apps.${expectedApp.id}.moduleFederation.ssr`, 'Workspace apps require streaming Module Federation SSR', 'restore generated streaming SSR Module Federation settings');
|
|
1286
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)({
|
|
1287
|
-
package: compactAppEntry?.package ?? expectedApp.package,
|
|
1288
|
-
path: 'string' == typeof compactAppEntry?.path ? compactAppEntry.path.replace(/\\/gu, '/').replace(/^\.\/+/u, '') : expectedApp.path
|
|
1289
|
-
}, {
|
|
1290
|
-
package: expectedApp.package,
|
|
1291
|
-
path: expectedApp.path
|
|
1292
|
-
}, `${compactConfigPath} topology.apps.${expectedApp.id} identity`, 'restore the app package and path declared by the workspace topology');
|
|
1293
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(compactAppEntry?.deploy?.cloudflare, expectedApp.deploy?.cloudflare, `${compactConfigPath} topology.apps.${expectedApp.id}.deploy.cloudflare`, 'regenerate the app Cloudflare deployment contract; do not add local proof-only smoke checks');
|
|
1294
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(deliveryUnitBlock(compactAppEntry?.deliveryUnit), expectedDeliveryUnit, `${compactConfigPath} topology.apps.${expectedApp.id}.deliveryUnit`, deliveryUnitIdentityFixArea);
|
|
1295
|
-
const topologyUnitEntry = 'shell' === expectedApp.kind ? topology.shell : topology.verticals?.find((entry)=>entry?.id === expectedApp.id);
|
|
1296
|
-
(0, external_assertions_cjs_namespaceObject.assertSameJson)(deliveryUnitBlock(topologyUnitEntry?.deliveryUnit), expectedDeliveryUnit, `topology/reference-topology.json ${'shell' === expectedApp.kind ? 'shell' : `verticals.${expectedApp.id}`}.deliveryUnit`, deliveryUnitIdentityFixArea);
|
|
1297
|
-
const appPath = expectedApp.path;
|
|
1298
|
-
const buildArtifactPath = `${appPath}/shared/ultramodern-build.json`;
|
|
1299
|
-
assertExists(buildArtifactPath);
|
|
1300
|
-
const buildIdentity = readJson(buildArtifactPath).deliveryUnit ?? {};
|
|
1301
|
-
(0, external_assertions_cjs_namespaceObject.assertSelfCheck)(buildIdentity.unitId === expectedDeliveryUnit.unitId && buildIdentity.buildMarker === expectedDeliveryUnit.buildMarker, `${buildArtifactPath} deliveryUnit`, `Expected ${(0, external_assertions_cjs_namespaceObject.formatJson)({
|
|
1302
|
-
unitId: expectedDeliveryUnit.unitId,
|
|
1303
|
-
buildMarker: expectedDeliveryUnit.buildMarker
|
|
1304
|
-
})}, found ${(0, external_assertions_cjs_namespaceObject.formatJson)({
|
|
1305
|
-
unitId: buildIdentity.unitId,
|
|
1306
|
-
buildMarker: buildIdentity.buildMarker
|
|
1307
|
-
})}`, deliveryUnitIdentityFixArea);
|
|
1308
327
|
}
|
|
1309
|
-
|
|
328
|
+
(0, external_architecture_cjs_namespaceObject.assertCompilerArchitecture)(root, expected);
|
|
329
|
+
console.log('UltraModern workspace validated');
|
|
1310
330
|
}
|
|
331
|
+
exports.validateApiClientExports = __webpack_exports__.validateApiClientExports;
|
|
332
|
+
exports.validateApiOnlySourceSurface = __webpack_exports__.validateApiOnlySourceSurface;
|
|
333
|
+
exports.validateBackendFederationEntrypoints = __webpack_exports__.validateBackendFederationEntrypoints;
|
|
1311
334
|
exports.validateWorkspace = __webpack_exports__.validateWorkspace;
|
|
1312
335
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
336
|
+
"validateApiClientExports",
|
|
337
|
+
"validateApiOnlySourceSurface",
|
|
338
|
+
"validateBackendFederationEntrypoints",
|
|
1313
339
|
"validateWorkspace"
|
|
1314
340
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
1315
341
|
Object.defineProperty(exports, '__esModule', {
|