@bleedingdev/modern-js-create 3.5.0-ultramodern.3 → 3.5.0-ultramodern.30
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 +21 -17
- package/dist/cjs/ultramodern-tooling/commands.cjs +772 -75
- package/dist/cjs/ultramodern-tooling/config.cjs +149 -8
- package/dist/cjs/ultramodern-workspace/add-vertical.cjs +25 -0
- package/dist/cjs/ultramodern-workspace/api.cjs +44 -0
- package/dist/cjs/ultramodern-workspace/app-files.cjs +8 -11
- package/dist/cjs/ultramodern-workspace/backend-federation.cjs +282 -0
- package/dist/cjs/ultramodern-workspace/contracts.cjs +24 -8
- package/dist/cjs/ultramodern-workspace/delivery-unit-sync.cjs +157 -0
- package/dist/cjs/ultramodern-workspace/delivery-unit.cjs +88 -0
- package/dist/cjs/ultramodern-workspace/descriptors.cjs +24 -0
- package/dist/cjs/ultramodern-workspace/module-federation.cjs +161 -50
- package/dist/cjs/ultramodern-workspace/package-json.cjs +26 -43
- package/dist/cjs/ultramodern-workspace/pnpm-workspace-policy-plan.cjs +166 -0
- package/dist/cjs/ultramodern-workspace/tooling-command-catalog.cjs +153 -0
- package/dist/cjs/ultramodern-workspace/versions.cjs +8 -3
- package/dist/cjs/ultramodern-workspace/workspace-script-plan.cjs +175 -0
- package/dist/cjs/ultramodern-workspace/workspace-scripts.cjs +104 -63
- package/dist/cjs/ultramodern-workspace/workspace-validation-contract.cjs +97 -0
- package/dist/cjs/ultramodern-workspace/write-workspace.cjs +11 -3
- package/dist/cjs/ultramodern-workspace/zerops.cjs +100 -0
- package/dist/esm/ultramodern-tooling/commands.js +775 -78
- package/dist/esm/ultramodern-tooling/config.js +144 -9
- package/dist/esm/ultramodern-workspace/add-vertical.js +26 -1
- package/dist/esm/ultramodern-workspace/api.js +43 -2
- package/dist/esm/ultramodern-workspace/app-files.js +8 -11
- package/dist/esm/ultramodern-workspace/backend-federation.js +217 -0
- package/dist/esm/ultramodern-workspace/contracts.js +24 -8
- package/dist/esm/ultramodern-workspace/delivery-unit-sync.js +108 -0
- package/dist/esm/ultramodern-workspace/delivery-unit.js +31 -0
- package/dist/esm/ultramodern-workspace/descriptors.js +13 -1
- package/dist/esm/ultramodern-workspace/module-federation.js +160 -42
- package/dist/esm/ultramodern-workspace/package-json.js +16 -40
- package/dist/esm/ultramodern-workspace/pnpm-workspace-policy-plan.js +113 -0
- package/dist/esm/ultramodern-workspace/tooling-command-catalog.js +100 -0
- package/dist/esm/ultramodern-workspace/versions.js +6 -4
- package/dist/esm/ultramodern-workspace/workspace-script-plan.js +110 -0
- package/dist/esm/ultramodern-workspace/workspace-scripts.js +88 -65
- package/dist/esm/ultramodern-workspace/workspace-validation-contract.js +59 -0
- package/dist/esm/ultramodern-workspace/write-workspace.js +14 -6
- package/dist/esm/ultramodern-workspace/zerops.js +62 -0
- package/dist/esm-node/ultramodern-tooling/commands.js +775 -78
- package/dist/esm-node/ultramodern-tooling/config.js +144 -9
- package/dist/esm-node/ultramodern-workspace/add-vertical.js +26 -1
- package/dist/esm-node/ultramodern-workspace/api.js +43 -2
- package/dist/esm-node/ultramodern-workspace/app-files.js +8 -11
- package/dist/esm-node/ultramodern-workspace/backend-federation.js +218 -0
- package/dist/esm-node/ultramodern-workspace/contracts.js +24 -8
- package/dist/esm-node/ultramodern-workspace/delivery-unit-sync.js +109 -0
- package/dist/esm-node/ultramodern-workspace/delivery-unit.js +32 -0
- package/dist/esm-node/ultramodern-workspace/descriptors.js +13 -1
- package/dist/esm-node/ultramodern-workspace/module-federation.js +160 -42
- package/dist/esm-node/ultramodern-workspace/package-json.js +16 -40
- package/dist/esm-node/ultramodern-workspace/pnpm-workspace-policy-plan.js +114 -0
- package/dist/esm-node/ultramodern-workspace/tooling-command-catalog.js +101 -0
- package/dist/esm-node/ultramodern-workspace/versions.js +6 -4
- package/dist/esm-node/ultramodern-workspace/workspace-script-plan.js +111 -0
- package/dist/esm-node/ultramodern-workspace/workspace-scripts.js +88 -65
- package/dist/esm-node/ultramodern-workspace/workspace-validation-contract.js +60 -0
- package/dist/esm-node/ultramodern-workspace/write-workspace.js +14 -6
- package/dist/esm-node/ultramodern-workspace/zerops.js +63 -0
- package/dist/types/ultramodern-tooling/config.d.ts +6 -0
- package/dist/types/ultramodern-workspace/api.d.ts +1 -0
- package/dist/types/ultramodern-workspace/backend-federation.d.ts +11 -0
- package/dist/types/ultramodern-workspace/contracts.d.ts +1 -1
- package/dist/types/ultramodern-workspace/delivery-unit-sync.d.ts +6 -0
- package/dist/types/ultramodern-workspace/delivery-unit.d.ts +27 -0
- package/dist/types/ultramodern-workspace/descriptors.d.ts +4 -0
- package/dist/types/ultramodern-workspace/module-federation.d.ts +4 -9
- package/dist/types/ultramodern-workspace/package-json.d.ts +0 -1
- package/dist/types/ultramodern-workspace/pnpm-workspace-policy-plan.d.ts +39 -0
- package/dist/types/ultramodern-workspace/tooling-command-catalog.d.ts +18 -0
- package/dist/types/ultramodern-workspace/versions.d.ts +5 -3
- package/dist/types/ultramodern-workspace/workspace-script-plan.d.ts +72 -0
- package/dist/types/ultramodern-workspace/workspace-scripts.d.ts +13 -0
- package/dist/types/ultramodern-workspace/workspace-validation-contract.d.ts +42 -0
- package/dist/types/ultramodern-workspace/zerops.d.ts +2 -0
- package/package.json +3 -3
- package/template-workspace/.gitignore.handlebars +4 -0
- package/template-workspace/README.md.handlebars +18 -15
- package/template-workspace/patches/@module-federation__bridge-react@2.6.0.patch +140 -0
- package/template-workspace/patches/@module-federation__modern-js-v3@2.6.0.patch +57 -0
- package/template-workspace/patches/drizzle-orm-ts7-strict-declarations.patch +452 -0
- package/template-workspace/patches/effect-schema-error-type-id.patch +18 -0
- package/template-workspace/pnpm-workspace.yaml.handlebars +8 -0
- package/template-workspace/scripts/bootstrap-agent-skills.mjs +11 -3
- package/templates/workspace-scripts/check-ultramodern-api-boundaries.mts +40 -2
- package/templates/workspace-scripts/generate-node-backend-federation.mjs +270 -0
- package/templates/workspace-scripts/materialize-zerops-runtime.mjs +448 -0
- package/templates/workspace-scripts/proof-cloudflare-version.mjs +237 -9
- package/templates/workspace-scripts/proof-node-backend-federation.mjs +729 -0
- package/templates/workspace-scripts/ultramodern-cloudflare-proof.mjs +188 -2
- package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +434 -18
|
@@ -37,7 +37,9 @@ var __webpack_require__ = {};
|
|
|
37
37
|
var __webpack_exports__ = {};
|
|
38
38
|
__webpack_require__.r(__webpack_exports__);
|
|
39
39
|
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
normalizeCompactUltramodernConfig: ()=>normalizeCompactUltramodernConfig,
|
|
40
41
|
readUltramodernConfig: ()=>readUltramodernConfig,
|
|
42
|
+
synthesizeCompactUltramodernConfig: ()=>synthesizeCompactUltramodernConfig,
|
|
41
43
|
workspaceAppsFromToolingConfig: ()=>workspaceAppsFromToolingConfig
|
|
42
44
|
});
|
|
43
45
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
@@ -47,6 +49,9 @@ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_no
|
|
|
47
49
|
const bridge_config_cjs_namespaceObject = require("../ultramodern-workspace/bridge-config.cjs");
|
|
48
50
|
const descriptors_cjs_namespaceObject = require("../ultramodern-workspace/descriptors.cjs");
|
|
49
51
|
const naming_cjs_namespaceObject = require("../ultramodern-workspace/naming.cjs");
|
|
52
|
+
const LEGACY_GENERATED_CONTRACT_PATH = '.modernjs/ultramodern-generated-contract.json';
|
|
53
|
+
const LEGACY_PACKAGE_SOURCE_METADATA_PATH = '.modernjs/ultramodern-package-source.json';
|
|
54
|
+
const LEGACY_DEVELOPMENT_OVERLAY_PATH = 'topology/local-overlays/development.json';
|
|
50
55
|
function readJsonObject(filePath) {
|
|
51
56
|
const value = JSON.parse(external_node_fs_default().readFileSync(filePath, 'utf-8'));
|
|
52
57
|
if (null === value || 'object' != typeof value || Array.isArray(value)) throw new Error(`UltraModern config must contain a JSON object: ${filePath}`);
|
|
@@ -55,11 +60,39 @@ function readJsonObject(filePath) {
|
|
|
55
60
|
function readOptionalJsonObject(filePath) {
|
|
56
61
|
return external_node_fs_default().existsSync(filePath) ? readJsonObject(filePath) : {};
|
|
57
62
|
}
|
|
58
|
-
function packageScopeFromRoot(
|
|
59
|
-
const rootPackage = readOptionalJsonObject(external_node_path_default().join(
|
|
60
|
-
return 'string' == typeof rootPackage.name && rootPackage.name.length > 0 ? rootPackage.name : external_node_path_default().basename(
|
|
63
|
+
function packageScopeFromRoot(workspaceRoot) {
|
|
64
|
+
const rootPackage = readOptionalJsonObject(external_node_path_default().join(workspaceRoot, 'package.json'));
|
|
65
|
+
return 'string' == typeof rootPackage.name && rootPackage.name.length > 0 ? rootPackage.name : external_node_path_default().basename(workspaceRoot);
|
|
61
66
|
}
|
|
62
|
-
function
|
|
67
|
+
function packageSourceFromMetadata(workspaceRoot) {
|
|
68
|
+
const metadataPath = external_node_path_default().join(workspaceRoot, LEGACY_PACKAGE_SOURCE_METADATA_PATH);
|
|
69
|
+
if (!external_node_fs_default().existsSync(metadataPath)) return;
|
|
70
|
+
const metadata = readJsonObject(metadataPath);
|
|
71
|
+
const aliases = metadata.modernPackages?.aliases ?? {};
|
|
72
|
+
const firstAliasEntry = Object.entries(aliases).find((entry)=>'string' == typeof entry[1]);
|
|
73
|
+
const firstPackage = firstAliasEntry?.[0];
|
|
74
|
+
const firstAlias = firstAliasEntry?.[1];
|
|
75
|
+
const aliasScope = firstAlias?.match(/^@([^/]+)\//u)?.[1];
|
|
76
|
+
const unscopedName = firstPackage?.split('/').at(-1) ?? '';
|
|
77
|
+
const aliasUnscopedName = firstAlias?.split('/').at(-1) ?? '';
|
|
78
|
+
const aliasPackageNamePrefix = aliasUnscopedName && unscopedName && aliasUnscopedName.endsWith(unscopedName) ? aliasUnscopedName.slice(0, -unscopedName.length) : void 0;
|
|
79
|
+
return {
|
|
80
|
+
strategy: 'install' === metadata.strategy ? 'install' : 'workspace',
|
|
81
|
+
modernPackageVersion: 'string' == typeof metadata.modernPackages?.specifier ? metadata.modernPackages.specifier : 'workspace:*',
|
|
82
|
+
registry: 'string' == typeof metadata.modernPackages?.registry ? metadata.modernPackages.registry : void 0,
|
|
83
|
+
aliasScope,
|
|
84
|
+
aliasPackageNamePrefix
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function readOverlayPorts(workspaceRoot) {
|
|
88
|
+
const overlayPath = external_node_path_default().join(workspaceRoot, LEGACY_DEVELOPMENT_OVERLAY_PATH);
|
|
89
|
+
if (!external_node_fs_default().existsSync(overlayPath)) return {};
|
|
90
|
+
const overlay = readJsonObject(overlayPath);
|
|
91
|
+
const ports = overlay.ports;
|
|
92
|
+
if (null === ports || 'object' != typeof ports || Array.isArray(ports)) return {};
|
|
93
|
+
return Object.fromEntries(Object.entries(ports).filter((entry)=>'number' == typeof entry[1]));
|
|
94
|
+
}
|
|
95
|
+
function normalizeCompactConfig(workspaceRoot, sourcePath, config) {
|
|
63
96
|
const packageSource = config.packageSource && 'object' == typeof config.packageSource ? {
|
|
64
97
|
strategy: 'install' === config.packageSource.strategy ? 'install' : 'workspace',
|
|
65
98
|
modernPackageVersion: 'string' == typeof config.packageSource.modernPackageVersion ? config.packageSource.modernPackageVersion : 'workspace:*',
|
|
@@ -112,10 +145,114 @@ function normalizeCompactConfig(sourcePath, config) {
|
|
|
112
145
|
}
|
|
113
146
|
};
|
|
114
147
|
}
|
|
115
|
-
function
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
148
|
+
function normalizeCompactUltramodernConfig(workspaceRoot, compact) {
|
|
149
|
+
return normalizeCompactConfig(workspaceRoot, external_node_path_default().join(workspaceRoot, descriptors_cjs_namespaceObject.ULTRAMODERN_CONFIG_PATH), compact);
|
|
150
|
+
}
|
|
151
|
+
function synthesizeCompactUltramodernConfig(workspaceRoot) {
|
|
152
|
+
const contractPath = external_node_path_default().join(workspaceRoot, LEGACY_GENERATED_CONTRACT_PATH);
|
|
153
|
+
if (!external_node_fs_default().existsSync(contractPath)) return;
|
|
154
|
+
const contract = readJsonObject(contractPath);
|
|
155
|
+
const sources = [
|
|
156
|
+
LEGACY_GENERATED_CONTRACT_PATH
|
|
157
|
+
];
|
|
158
|
+
const missing = [];
|
|
159
|
+
const packageSource = packageSourceFromMetadata(workspaceRoot);
|
|
160
|
+
if (packageSource) sources.push(LEGACY_PACKAGE_SOURCE_METADATA_PATH);
|
|
161
|
+
else missing.push(LEGACY_PACKAGE_SOURCE_METADATA_PATH);
|
|
162
|
+
const ports = readOverlayPorts(workspaceRoot);
|
|
163
|
+
if (external_node_fs_default().existsSync(external_node_path_default().join(workspaceRoot, LEGACY_DEVELOPMENT_OVERLAY_PATH))) sources.push(LEGACY_DEVELOPMENT_OVERLAY_PATH);
|
|
164
|
+
else missing.push(LEGACY_DEVELOPMENT_OVERLAY_PATH);
|
|
165
|
+
const apps = Array.isArray(contract.apps) ? contract.apps : [];
|
|
166
|
+
const shell = apps.find((app)=>app?.id === descriptors_cjs_namespaceObject.shellApp.id);
|
|
167
|
+
const compact = {
|
|
168
|
+
schemaVersion: 'number' == typeof contract.schemaVersion ? contract.schemaVersion : 1,
|
|
169
|
+
...'string' == typeof contract.profile ? {
|
|
170
|
+
profile: contract.profile
|
|
171
|
+
} : {},
|
|
172
|
+
workspace: {
|
|
173
|
+
packageScope: packageScopeFromRoot(workspaceRoot)
|
|
174
|
+
},
|
|
175
|
+
...packageSource ? {
|
|
176
|
+
packageSource: {
|
|
177
|
+
strategy: packageSource.strategy,
|
|
178
|
+
modernPackageVersion: packageSource.modernPackageVersion,
|
|
179
|
+
...packageSource.registry ? {
|
|
180
|
+
registry: packageSource.registry
|
|
181
|
+
} : {},
|
|
182
|
+
...packageSource.aliasScope ? {
|
|
183
|
+
aliasScope: packageSource.aliasScope
|
|
184
|
+
} : {},
|
|
185
|
+
...packageSource.aliasPackageNamePrefix ? {
|
|
186
|
+
aliasPackageNamePrefix: packageSource.aliasPackageNamePrefix
|
|
187
|
+
} : {}
|
|
188
|
+
}
|
|
189
|
+
} : {},
|
|
190
|
+
features: {
|
|
191
|
+
tailwind: shell?.styling?.tailwind !== false
|
|
192
|
+
},
|
|
193
|
+
topology: {
|
|
194
|
+
apps: apps.map((app)=>{
|
|
195
|
+
const id = String(app.id);
|
|
196
|
+
const appPath = 'string' == typeof app.path ? app.path : id === descriptors_cjs_namespaceObject.shellApp.id ? descriptors_cjs_namespaceObject.shellApp.directory : `verticals/${(0, naming_cjs_namespaceObject.toKebabCase)(id)}`;
|
|
197
|
+
const domain = 'string' == typeof app.i18n?.namespace && 'shell' !== app.i18n.namespace ? app.i18n.namespace : appPath.split('/').at(-1);
|
|
198
|
+
const moduleFederation = app.moduleFederation && 'object' == typeof app.moduleFederation ? {
|
|
199
|
+
role: 'vertical' === app.kind ? 'remote' : 'host',
|
|
200
|
+
...'string' == typeof app.moduleFederation.name ? {
|
|
201
|
+
name: app.moduleFederation.name
|
|
202
|
+
} : {},
|
|
203
|
+
...Array.isArray(app.moduleFederation.exposes) ? {
|
|
204
|
+
exposes: app.moduleFederation.exposes.filter((expose)=>'string' == typeof expose)
|
|
205
|
+
} : {},
|
|
206
|
+
...Array.isArray(app.moduleFederation.verticalRefs) ? {
|
|
207
|
+
verticalRefs: app.moduleFederation.verticalRefs.filter((ref)=>'string' == typeof ref)
|
|
208
|
+
} : {}
|
|
209
|
+
} : void 0;
|
|
210
|
+
const api = app.effect && 'object' == typeof app.effect ? {
|
|
211
|
+
stem: 'string' == typeof app.effect.prefix ? app.effect.prefix.split('/').filter(Boolean).at(-1) ?? domain ?? id : domain ?? id,
|
|
212
|
+
prefix: 'string' == typeof app.effect.prefix ? app.effect.prefix : `/${domain ?? id}-api`,
|
|
213
|
+
consumedBy: [
|
|
214
|
+
descriptors_cjs_namespaceObject.shellApp.id,
|
|
215
|
+
id
|
|
216
|
+
]
|
|
217
|
+
} : void 0;
|
|
218
|
+
return {
|
|
219
|
+
id,
|
|
220
|
+
kind: 'vertical' === app.kind ? 'vertical' : 'shell',
|
|
221
|
+
path: appPath,
|
|
222
|
+
...'string' == typeof app.package ? {
|
|
223
|
+
package: app.package
|
|
224
|
+
} : {},
|
|
225
|
+
packageSuffix: 'string' == typeof app.package ? app.package.split('/').at(-1) : appPath.split('/').at(-1),
|
|
226
|
+
...id === descriptors_cjs_namespaceObject.shellApp.id ? {
|
|
227
|
+
displayName: descriptors_cjs_namespaceObject.shellApp.displayName
|
|
228
|
+
} : {},
|
|
229
|
+
...domain ? {
|
|
230
|
+
domain
|
|
231
|
+
} : {},
|
|
232
|
+
...'number' == typeof ports[id] ? {
|
|
233
|
+
port: ports[id]
|
|
234
|
+
} : {},
|
|
235
|
+
...moduleFederation ? {
|
|
236
|
+
moduleFederation
|
|
237
|
+
} : {},
|
|
238
|
+
...api ? {
|
|
239
|
+
api
|
|
240
|
+
} : {}
|
|
241
|
+
};
|
|
242
|
+
})
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
return {
|
|
246
|
+
compact,
|
|
247
|
+
missing,
|
|
248
|
+
sources
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
function readUltramodernConfig(workspaceRoot = process.cwd()) {
|
|
252
|
+
const compactPath = external_node_path_default().join(workspaceRoot, descriptors_cjs_namespaceObject.ULTRAMODERN_CONFIG_PATH);
|
|
253
|
+
if (external_node_fs_default().existsSync(compactPath)) return normalizeCompactConfig(workspaceRoot, compactPath, readJsonObject(compactPath));
|
|
254
|
+
if (external_node_fs_default().existsSync(external_node_path_default().join(workspaceRoot, LEGACY_GENERATED_CONTRACT_PATH))) throw new Error(`Missing ${descriptors_cjs_namespaceObject.ULTRAMODERN_CONFIG_PATH}. Legacy UltraModern metadata detected — run \`modern-js-create ultramodern migrate-strict-effect\` to synthesize it.`);
|
|
255
|
+
throw new Error(`Missing UltraModern config. Expected ${descriptors_cjs_namespaceObject.ULTRAMODERN_CONFIG_PATH}. Run \`modern-js-create ultramodern migrate-strict-effect\` if you have legacy UltraModern metadata to migrate.`);
|
|
119
256
|
}
|
|
120
257
|
function workspaceAppsFromToolingConfig(config) {
|
|
121
258
|
return config.topology.apps.map((app)=>{
|
|
@@ -161,10 +298,14 @@ function workspaceAppsFromToolingConfig(config) {
|
|
|
161
298
|
};
|
|
162
299
|
});
|
|
163
300
|
}
|
|
301
|
+
exports.normalizeCompactUltramodernConfig = __webpack_exports__.normalizeCompactUltramodernConfig;
|
|
164
302
|
exports.readUltramodernConfig = __webpack_exports__.readUltramodernConfig;
|
|
303
|
+
exports.synthesizeCompactUltramodernConfig = __webpack_exports__.synthesizeCompactUltramodernConfig;
|
|
165
304
|
exports.workspaceAppsFromToolingConfig = __webpack_exports__.workspaceAppsFromToolingConfig;
|
|
166
305
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
306
|
+
"normalizeCompactUltramodernConfig",
|
|
167
307
|
"readUltramodernConfig",
|
|
308
|
+
"synthesizeCompactUltramodernConfig",
|
|
168
309
|
"workspaceAppsFromToolingConfig"
|
|
169
310
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
170
311
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -64,6 +64,8 @@ const external_ultramodern_package_source_cjs_namespaceObject = require("../ultr
|
|
|
64
64
|
const config_cjs_namespaceObject = require("../ultramodern-tooling/config.cjs");
|
|
65
65
|
const external_api_cjs_namespaceObject = require("./api.cjs");
|
|
66
66
|
const external_app_files_cjs_namespaceObject = require("./app-files.cjs");
|
|
67
|
+
const external_backend_federation_cjs_namespaceObject = require("./backend-federation.cjs");
|
|
68
|
+
const external_delivery_unit_cjs_namespaceObject = require("./delivery-unit.cjs");
|
|
67
69
|
const external_demo_components_cjs_namespaceObject = require("./demo-components.cjs");
|
|
68
70
|
const external_descriptors_cjs_namespaceObject = require("./descriptors.cjs");
|
|
69
71
|
const external_fs_io_cjs_namespaceObject = require("./fs-io.cjs");
|
|
@@ -79,6 +81,7 @@ const external_public_surface_cjs_namespaceObject = require("./public-surface.cj
|
|
|
79
81
|
const external_types_cjs_namespaceObject = require("./types.cjs");
|
|
80
82
|
const external_workspace_scripts_cjs_namespaceObject = require("./workspace-scripts.cjs");
|
|
81
83
|
const external_write_workspace_cjs_namespaceObject = require("./write-workspace.cjs");
|
|
84
|
+
const external_zerops_cjs_namespaceObject = require("./zerops.cjs");
|
|
82
85
|
const FIRST_VERTICAL_PORT = 4101;
|
|
83
86
|
const TOPOLOGY_PATH = 'topology/reference-topology.json';
|
|
84
87
|
const OWNERSHIP_PATH = 'topology/ownership.json';
|
|
@@ -132,6 +135,7 @@ function rewriteShellAppFiles(workspaceRoot, scope, packageSource, enableTailwin
|
|
|
132
135
|
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(external_node_path_default().join(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/tsconfig.json`), (0, external_package_json_cjs_namespaceObject.createAppTsConfig)(shellHost, remotes));
|
|
133
136
|
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(external_node_path_default().join(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/tsconfig.mf-types.json`), (0, external_package_json_cjs_namespaceObject.createAppMfTypesTsConfig)(shellHost));
|
|
134
137
|
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/src/modern-app-env.d.ts`, (0, external_app_files_cjs_namespaceObject.createAppEnvDts)(shellHost, remotes));
|
|
138
|
+
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/modern.config.ts`, (0, external_module_federation_cjs_namespaceObject.createAppModernConfig)(scope, shellHost, remotes));
|
|
135
139
|
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, publicWeb.jsonLdHelperFile.path, publicWeb.jsonLdHelperFile.content);
|
|
136
140
|
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, publicWeb.routeMetadataFile.path, publicWeb.routeMetadataFile.content);
|
|
137
141
|
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, publicWeb.routeHeadFile.path, publicWeb.routeHeadFile.content);
|
|
@@ -183,6 +187,12 @@ function verticalTopologyEntry(scope, vertical, remotes = []) {
|
|
|
183
187
|
fallbackTelemetryEvent: 'modernjs:mv-runtime-parity',
|
|
184
188
|
sharedContractVersion: 'mf-ssr-contract-v1'
|
|
185
189
|
},
|
|
190
|
+
...(0, external_backend_federation_cjs_namespaceObject.createBackendFederationContract)(scope, vertical) ? {
|
|
191
|
+
backendFederation: (0, external_backend_federation_cjs_namespaceObject.createBackendFederationContract)(scope, vertical)
|
|
192
|
+
} : {},
|
|
193
|
+
...vertical.api ? {
|
|
194
|
+
deliveryUnit: (0, external_delivery_unit_cjs_namespaceObject.deliveryUnitContractBlock)((0, external_delivery_unit_cjs_namespaceObject.createDeliveryUnitRecord)(scope, vertical))
|
|
195
|
+
} : {},
|
|
186
196
|
...(0, external_api_cjs_namespaceObject.apiTopologyMetadata)(vertical) ? {
|
|
187
197
|
api: (0, external_api_cjs_namespaceObject.apiTopologyMetadata)(vertical)
|
|
188
198
|
} : {},
|
|
@@ -423,6 +433,12 @@ function createDryRunJsonMutations(preflight, manifestUrl) {
|
|
|
423
433
|
pointer: `/apis/${vertical.id}`,
|
|
424
434
|
description: `Add local API URL for ${vertical.id}`,
|
|
425
435
|
value: `http://localhost:${vertical.port}${(0, external_descriptors_cjs_namespaceObject.resolveApiPrefix)(vertical)}`
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
path: DEVELOPMENT_OVERLAY_PATH,
|
|
439
|
+
pointer: `/serverExecution/${vertical.id}`,
|
|
440
|
+
description: `Add local MicroVertical server execution metadata for ${vertical.id}`,
|
|
441
|
+
value: (0, external_backend_federation_cjs_namespaceObject.createServerExecutionOverlay)(scope, vertical)
|
|
426
442
|
}
|
|
427
443
|
] : [];
|
|
428
444
|
return [
|
|
@@ -538,6 +554,8 @@ function addUltramodernVertical(options) {
|
|
|
538
554
|
overlay.ports[vertical.id] = vertical.port;
|
|
539
555
|
overlay.manifests ??= {};
|
|
540
556
|
overlay.manifests[vertical.id] = `http://localhost:${vertical.port}/mf-manifest.json`;
|
|
557
|
+
overlay.serverExecution ??= {};
|
|
558
|
+
overlay.serverExecution[vertical.id] = (0, external_backend_federation_cjs_namespaceObject.createServerExecutionOverlay)(scope, vertical);
|
|
541
559
|
overlay.apis ??= {};
|
|
542
560
|
overlay.apis[vertical.id] = `http://localhost:${vertical.port}${(0, external_descriptors_cjs_namespaceObject.resolveApiPrefix)(vertical)}`;
|
|
543
561
|
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(topologyPath, topology);
|
|
@@ -550,6 +568,13 @@ function addUltramodernVertical(options) {
|
|
|
550
568
|
},
|
|
551
569
|
...updatedVerticals
|
|
552
570
|
], enableTailwind, bridge));
|
|
571
|
+
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(options.workspaceRoot, 'zerops.yaml', `${(0, external_zerops_cjs_namespaceObject.createZeropsYaml)(scope, [
|
|
572
|
+
{
|
|
573
|
+
...external_descriptors_cjs_namespaceObject.shellApp,
|
|
574
|
+
verticalRefs: updatedVerticals.map((vertical)=>vertical.id)
|
|
575
|
+
},
|
|
576
|
+
...updatedVerticals
|
|
577
|
+
])}\n`);
|
|
553
578
|
rewriteShellAppFiles(options.workspaceRoot, scope, packageSource, enableTailwind, updatedVerticals, bridge);
|
|
554
579
|
(0, external_workspace_scripts_cjs_namespaceObject.writeGeneratedWorkspaceScripts)(options.workspaceRoot, scope, enableTailwind, updatedVerticals);
|
|
555
580
|
addShellZephyrDependency(options.workspaceRoot, scope, vertical);
|
|
@@ -35,6 +35,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
35
35
|
createApiReadinessContract: ()=>createApiReadinessContract,
|
|
36
36
|
createApiRequestContextContract: ()=>createApiRequestContextContract,
|
|
37
37
|
createApiServiceEntry: ()=>createApiServiceEntry,
|
|
38
|
+
createBackendEffectApiExpose: ()=>createBackendEffectApiExpose,
|
|
38
39
|
createSharedApi: ()=>createSharedApi,
|
|
39
40
|
createSharedApiContract: ()=>createSharedApiContract,
|
|
40
41
|
createSharedApiImports: ()=>createSharedApiImports,
|
|
@@ -50,6 +51,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
50
51
|
verticalApiReadinessSchemaExport: ()=>verticalApiReadinessSchemaExport,
|
|
51
52
|
verticalApiSchemaExport: ()=>verticalApiSchemaExport
|
|
52
53
|
});
|
|
54
|
+
const external_backend_federation_cjs_namespaceObject = require("./backend-federation.cjs");
|
|
53
55
|
const external_descriptors_cjs_namespaceObject = require("./descriptors.cjs");
|
|
54
56
|
const external_naming_cjs_namespaceObject = require("./naming.cjs");
|
|
55
57
|
function verticalApiExport(service) {
|
|
@@ -691,6 +693,46 @@ const apiRuntime: EffectBffDefinition<typeof ${apiExport}, EffectRuntimeLayer> &
|
|
|
691
693
|
layer,
|
|
692
694
|
});
|
|
693
695
|
|
|
696
|
+
export default apiRuntime;
|
|
697
|
+
`;
|
|
698
|
+
}
|
|
699
|
+
function createBackendEffectApiExpose(scope, service) {
|
|
700
|
+
const apiExport = verticalApiExport(service);
|
|
701
|
+
const groupName = verticalApiGroupName(service);
|
|
702
|
+
const apiPrefix = (0, external_descriptors_cjs_namespaceObject.resolveApiPrefix)(service);
|
|
703
|
+
const stem = (0, external_descriptors_cjs_namespaceObject.resolveApiStem)(service);
|
|
704
|
+
return `import apiRuntime from './index.ts';
|
|
705
|
+
import { ultramodernApiMarker } from '../shared/ultramodern-build.ts';
|
|
706
|
+
import {
|
|
707
|
+
${apiExport},
|
|
708
|
+
${groupName}ApiContract,
|
|
709
|
+
${groupName}OperationContexts,
|
|
710
|
+
} from '../shared/api.ts';
|
|
711
|
+
|
|
712
|
+
export const backendFederationContract = {
|
|
713
|
+
compatibility: {
|
|
714
|
+
build: ultramodernApiMarker.build,
|
|
715
|
+
contractVersion: '${external_backend_federation_cjs_namespaceObject.BACKEND_FEDERATION_CONTRACT_VERSION}',
|
|
716
|
+
nodeAdapterVersion: '${external_backend_federation_cjs_namespaceObject.BACKEND_FEDERATION_NODE_ADAPTER_VERSION}',
|
|
717
|
+
packageName: '${(0, external_naming_cjs_namespaceObject.packageName)(scope, service.packageSuffix)}',
|
|
718
|
+
sourceRevision: ultramodernApiMarker.sourceRevision,
|
|
719
|
+
unitId: ultramodernApiMarker.unitId,
|
|
720
|
+
},
|
|
721
|
+
executionSurfaces: ['node-mf-runtime'],
|
|
722
|
+
exposes: ['./effect-api'],
|
|
723
|
+
name: '${(0, external_descriptors_cjs_namespaceObject.createBackendFederationName)(service)}',
|
|
724
|
+
openapiPath: '${apiPrefix}/openapi.json',
|
|
725
|
+
readinessPath: '${apiPrefix}/${stem}/readiness',
|
|
726
|
+
role: 'microvertical-server',
|
|
727
|
+
runtimeFramework: 'effect',
|
|
728
|
+
strictEffectApproach: true,
|
|
729
|
+
} as const;
|
|
730
|
+
|
|
731
|
+
export const api: unknown = ${apiExport};
|
|
732
|
+
export const contract = ${groupName}ApiContract;
|
|
733
|
+
export const operationContexts = ${groupName}OperationContexts;
|
|
734
|
+
export const runtime = apiRuntime;
|
|
735
|
+
|
|
694
736
|
export default apiRuntime;
|
|
695
737
|
`;
|
|
696
738
|
}
|
|
@@ -1040,6 +1082,7 @@ exports.createApiOperationContract = __webpack_exports__.createApiOperationContr
|
|
|
1040
1082
|
exports.createApiReadinessContract = __webpack_exports__.createApiReadinessContract;
|
|
1041
1083
|
exports.createApiRequestContextContract = __webpack_exports__.createApiRequestContextContract;
|
|
1042
1084
|
exports.createApiServiceEntry = __webpack_exports__.createApiServiceEntry;
|
|
1085
|
+
exports.createBackendEffectApiExpose = __webpack_exports__.createBackendEffectApiExpose;
|
|
1043
1086
|
exports.createSharedApi = __webpack_exports__.createSharedApi;
|
|
1044
1087
|
exports.createSharedApiContract = __webpack_exports__.createSharedApiContract;
|
|
1045
1088
|
exports.createSharedApiImports = __webpack_exports__.createSharedApiImports;
|
|
@@ -1062,6 +1105,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
1062
1105
|
"createApiReadinessContract",
|
|
1063
1106
|
"createApiRequestContextContract",
|
|
1064
1107
|
"createApiServiceEntry",
|
|
1108
|
+
"createBackendEffectApiExpose",
|
|
1065
1109
|
"createSharedApi",
|
|
1066
1110
|
"createSharedApiContract",
|
|
1067
1111
|
"createSharedApiImports",
|
|
@@ -71,17 +71,14 @@ function createAppEnvDts(app, remotes = []) {
|
|
|
71
71
|
}
|
|
72
72
|
`;
|
|
73
73
|
})).join('\n');
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
declare module '*.css';
|
|
84
|
-
${remoteModuleDeclarations ? `\n${remoteModuleDeclarations}` : ''}`;
|
|
74
|
+
const reactTypeImport = remoteModuleDeclarations ? "import type React from 'react';\n" : '';
|
|
75
|
+
return [
|
|
76
|
+
`import '@modern-js/app-tools/types';\n${reactTypeImport}`.trimEnd(),
|
|
77
|
+
`declare global {
|
|
78
|
+
const ULTRAMODERN_SITE_URL: string;
|
|
79
|
+
}`,
|
|
80
|
+
remoteModuleDeclarations.trimEnd()
|
|
81
|
+
].filter((section)=>section.length > 0).join('\n\n').concat('\n');
|
|
85
82
|
}
|
|
86
83
|
function createAppRuntimeConfig(app, scope, remotes = []) {
|
|
87
84
|
const pluginsConfig = 'shell' === app.kind ? ` plugins: [
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
BACKEND_FEDERATION_CONTRACT_VERSION: ()=>BACKEND_FEDERATION_CONTRACT_VERSION,
|
|
32
|
+
BACKEND_FEDERATION_NODE_ADAPTER_VERSION: ()=>BACKEND_FEDERATION_NODE_ADAPTER_VERSION,
|
|
33
|
+
createBackendFederationContract: ()=>createBackendFederationContract,
|
|
34
|
+
createBackendFederationContractFile: ()=>createBackendFederationContractFile,
|
|
35
|
+
createBackendFederationMetadata: ()=>createBackendFederationMetadata,
|
|
36
|
+
createBackendFederationSummary: ()=>createBackendFederationSummary,
|
|
37
|
+
createDispatchWorkerNameEnv: ()=>createDispatchWorkerNameEnv,
|
|
38
|
+
createServerExecutionOverlay: ()=>createServerExecutionOverlay,
|
|
39
|
+
createWorkerBindingEnv: ()=>createWorkerBindingEnv,
|
|
40
|
+
createWorkerBindingName: ()=>createWorkerBindingName
|
|
41
|
+
});
|
|
42
|
+
const external_api_cjs_namespaceObject = require("./api.cjs");
|
|
43
|
+
const external_delivery_unit_cjs_namespaceObject = require("./delivery-unit.cjs");
|
|
44
|
+
const external_descriptors_cjs_namespaceObject = require("./descriptors.cjs");
|
|
45
|
+
const external_naming_cjs_namespaceObject = require("./naming.cjs");
|
|
46
|
+
const external_versions_cjs_namespaceObject = require("./versions.cjs");
|
|
47
|
+
const BACKEND_FEDERATION_CONTRACT_VERSION = 'microvertical-server-effect-v1';
|
|
48
|
+
const BACKEND_FEDERATION_NODE_ADAPTER_VERSION = 'backend-mf-effect-v1';
|
|
49
|
+
function createZephyrEnv(app, suffix) {
|
|
50
|
+
return `ZEPHYR_${(0, external_naming_cjs_namespaceObject.toEnvSegment)(app.domain ?? app.id)}_${suffix}`;
|
|
51
|
+
}
|
|
52
|
+
function createWorkerBindingName(app) {
|
|
53
|
+
return `VERTICAL_${(0, external_naming_cjs_namespaceObject.toEnvSegment)(app.domain ?? app.id)}_WORKER`;
|
|
54
|
+
}
|
|
55
|
+
function createWorkerBindingEnv(app) {
|
|
56
|
+
return `VERTICAL_${(0, external_naming_cjs_namespaceObject.toEnvSegment)(app.domain ?? app.id)}_WORKER_BINDING`;
|
|
57
|
+
}
|
|
58
|
+
function createDispatchNamespaceEnv(app) {
|
|
59
|
+
return `VERTICAL_${(0, external_naming_cjs_namespaceObject.toEnvSegment)(app.domain ?? app.id)}_DISPATCH_NAMESPACE`;
|
|
60
|
+
}
|
|
61
|
+
function createDispatchWorkerNameEnv(app) {
|
|
62
|
+
return `VERTICAL_${(0, external_naming_cjs_namespaceObject.toEnvSegment)(app.domain ?? app.id)}_WORKER_NAME`;
|
|
63
|
+
}
|
|
64
|
+
function createEffectExpose(app) {
|
|
65
|
+
const apiStem = (0, external_descriptors_cjs_namespaceObject.resolveApiStem)(app);
|
|
66
|
+
return {
|
|
67
|
+
contract: `${app.directory}/shared/api.ts`,
|
|
68
|
+
runtime: `${app.directory}/api/index.ts`,
|
|
69
|
+
client: `${app.directory}/src/api/${app.api.stem}-client.ts`,
|
|
70
|
+
openapi: `${app.api.prefix}/openapi.json`,
|
|
71
|
+
readiness: `${app.api.prefix}/${apiStem}/readiness`
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function createCloudflareExecutionSurface(scope, app) {
|
|
75
|
+
return {
|
|
76
|
+
kind: 'cloudflare-worker-snapshot',
|
|
77
|
+
workerName: (0, external_descriptors_cjs_namespaceObject.createCloudflareWorkerName)(scope, app),
|
|
78
|
+
publicUrlEnv: (0, external_descriptors_cjs_namespaceObject.createCloudflarePublicUrlEnv)(app),
|
|
79
|
+
ssr: {
|
|
80
|
+
workerEntry: '.output/server/index.mjs',
|
|
81
|
+
workerManifest: '.output/server/modern-worker-manifest.json',
|
|
82
|
+
routeManifest: '.output/server/route.json',
|
|
83
|
+
ssrBundle: '.output/worker/index.js',
|
|
84
|
+
effectBffBundle: '.output/worker/__modern_bff_effect.js',
|
|
85
|
+
assetsBinding: 'ASSETS'
|
|
86
|
+
},
|
|
87
|
+
zephyr: {
|
|
88
|
+
runtime: 'ssr-worker',
|
|
89
|
+
integration: 'managed-cloudflare',
|
|
90
|
+
snapshotIdEnv: createZephyrEnv(app, 'SNAPSHOT_ID'),
|
|
91
|
+
versionIdEnv: createZephyrEnv(app, 'VERSION_ID'),
|
|
92
|
+
applicationUidEnv: createZephyrEnv(app, 'APPLICATION_UID')
|
|
93
|
+
},
|
|
94
|
+
workerDispatch: {
|
|
95
|
+
preferred: 'service-binding',
|
|
96
|
+
serviceBinding: createWorkerBindingName(app),
|
|
97
|
+
serviceBindingEnv: createWorkerBindingEnv(app),
|
|
98
|
+
dispatchNamespaceEnv: createDispatchNamespaceEnv(app),
|
|
99
|
+
dispatchWorkerNameEnv: createDispatchWorkerNameEnv(app),
|
|
100
|
+
requestInterface: 'fetch'
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function createNodeExecutionSurface(app) {
|
|
105
|
+
return {
|
|
106
|
+
kind: 'node-mf-runtime',
|
|
107
|
+
adapterVersion: BACKEND_FEDERATION_NODE_ADAPTER_VERSION,
|
|
108
|
+
remoteName: (0, external_descriptors_cjs_namespaceObject.createBackendFederationName)(app),
|
|
109
|
+
manifestEnv: (0, external_descriptors_cjs_namespaceObject.createBackendFederationManifestEnv)(app),
|
|
110
|
+
manifestUrl: (0, external_descriptors_cjs_namespaceObject.createBackendFederationManifestUrl)(app),
|
|
111
|
+
containerEntry: (0, external_descriptors_cjs_namespaceObject.createBackendFederationContainerEntry)(app),
|
|
112
|
+
remoteType: 'module',
|
|
113
|
+
expose: './effect-api',
|
|
114
|
+
runtimePackage: '@modern-js/plugin-bff/effect'
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function createServerExecutionOverlay(scope, app) {
|
|
118
|
+
if (!(0, external_descriptors_cjs_namespaceObject.appHasApi)(app)) return;
|
|
119
|
+
const deliveryUnit = (0, external_delivery_unit_cjs_namespaceObject.createDeliveryUnitRecord)(scope, app);
|
|
120
|
+
return {
|
|
121
|
+
apiBaseUrl: `http://localhost:${app.port}${(0, external_descriptors_cjs_namespaceObject.resolveApiPrefix)(app)}`,
|
|
122
|
+
versionBoundary: 'web-and-api-same-build',
|
|
123
|
+
deliveryUnit: {
|
|
124
|
+
unitId: deliveryUnit.unitId,
|
|
125
|
+
buildMarker: deliveryUnit.buildMarker
|
|
126
|
+
},
|
|
127
|
+
cloudflare: createCloudflareExecutionSurface(scope, app),
|
|
128
|
+
node: createNodeExecutionSurface(app)
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function createBackendFederationContract(scope, app) {
|
|
132
|
+
if (!(0, external_descriptors_cjs_namespaceObject.appHasApi)(app)) return;
|
|
133
|
+
const readiness = `${app.api.prefix}/${(0, external_descriptors_cjs_namespaceObject.resolveApiStem)(app)}/readiness`;
|
|
134
|
+
const deliveryUnit = (0, external_delivery_unit_cjs_namespaceObject.createDeliveryUnitRecord)(scope, app);
|
|
135
|
+
return {
|
|
136
|
+
role: 'microvertical-server',
|
|
137
|
+
name: (0, external_descriptors_cjs_namespaceObject.createBackendFederationName)(app),
|
|
138
|
+
runtimeFramework: 'effect',
|
|
139
|
+
strictEffectApproach: true,
|
|
140
|
+
deliveryUnit: (0, external_delivery_unit_cjs_namespaceObject.deliveryUnitContractBlock)(deliveryUnit),
|
|
141
|
+
exposes: {
|
|
142
|
+
'./effect-api': createEffectExpose(app)
|
|
143
|
+
},
|
|
144
|
+
versionBoundary: {
|
|
145
|
+
invariant: 'web-and-api-same-build',
|
|
146
|
+
identityRoot: 'deliveryUnit',
|
|
147
|
+
packageName: (0, external_naming_cjs_namespaceObject.packageName)(scope, app.packageSuffix),
|
|
148
|
+
ui: {
|
|
149
|
+
manifestEnv: (0, external_descriptors_cjs_namespaceObject.createRemoteManifestEnv)(app),
|
|
150
|
+
manifestUrl: `http://localhost:${app.port}/mf-manifest.json`,
|
|
151
|
+
buildMarker: `${app.directory}/src/routes/ultramodern-route-metadata.ts`
|
|
152
|
+
},
|
|
153
|
+
api: {
|
|
154
|
+
readiness,
|
|
155
|
+
buildMarker: `${app.directory}/shared/ultramodern-build.ts`,
|
|
156
|
+
publicUrlEnv: (0, external_descriptors_cjs_namespaceObject.createCloudflarePublicUrlEnv)(app)
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
executionSurfaces: {
|
|
160
|
+
cloudflare: createCloudflareExecutionSurface(scope, app),
|
|
161
|
+
node: createNodeExecutionSurface(app)
|
|
162
|
+
},
|
|
163
|
+
compatibility: {
|
|
164
|
+
contractVersion: BACKEND_FEDERATION_CONTRACT_VERSION,
|
|
165
|
+
packageName: (0, external_naming_cjs_namespaceObject.packageName)(scope, app.packageSuffix),
|
|
166
|
+
effectVersion: external_versions_cjs_namespaceObject.EFFECT_VERSION,
|
|
167
|
+
moduleFederationVersion: external_versions_cjs_namespaceObject.MODULE_FEDERATION_VERSION
|
|
168
|
+
},
|
|
169
|
+
cache: {
|
|
170
|
+
cloudflareSnapshot: 'immutable',
|
|
171
|
+
nodeManifest: 'no-store',
|
|
172
|
+
nodeVersionedContainer: 'immutable',
|
|
173
|
+
nodeUnpinnedContainer: 'revalidate'
|
|
174
|
+
},
|
|
175
|
+
fallback: {
|
|
176
|
+
timeoutMs: 1500,
|
|
177
|
+
failureEvent: 'modernjs:microvertical-server-fallback',
|
|
178
|
+
strategy: 'typed-effect-error'
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function createBackendFederationMetadata(scope, app) {
|
|
183
|
+
if (!(0, external_descriptors_cjs_namespaceObject.appHasApi)(app)) return;
|
|
184
|
+
return {
|
|
185
|
+
contractVersion: BACKEND_FEDERATION_CONTRACT_VERSION,
|
|
186
|
+
deliveryUnit: (0, external_delivery_unit_cjs_namespaceObject.deliveryUnitContractBlock)((0, external_delivery_unit_cjs_namespaceObject.createDeliveryUnitRecord)(scope, app)),
|
|
187
|
+
executionSurfaces: [
|
|
188
|
+
'node-mf-runtime'
|
|
189
|
+
],
|
|
190
|
+
exposes: [
|
|
191
|
+
'./effect-api'
|
|
192
|
+
],
|
|
193
|
+
name: (0, external_descriptors_cjs_namespaceObject.createBackendFederationName)(app),
|
|
194
|
+
nodeAdapterVersion: BACKEND_FEDERATION_NODE_ADAPTER_VERSION,
|
|
195
|
+
openapiPath: `${app.api.prefix}/openapi.json`,
|
|
196
|
+
readinessPath: `${app.api.prefix}/${(0, external_descriptors_cjs_namespaceObject.resolveApiStem)(app)}/readiness`,
|
|
197
|
+
role: 'microvertical-server',
|
|
198
|
+
runtimeFramework: 'effect',
|
|
199
|
+
strictEffectApproach: true
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function createBackendFederationContractFile(app) {
|
|
203
|
+
if (!app.api) throw new Error(`App ${app.id} does not define an Effect API.`);
|
|
204
|
+
const apiExport = (0, external_api_cjs_namespaceObject.verticalApiExport)(app);
|
|
205
|
+
const groupName = (0, external_api_cjs_namespaceObject.verticalApiGroupName)(app);
|
|
206
|
+
const readinessPath = `${app.api.prefix}/${(0, external_descriptors_cjs_namespaceObject.resolveApiStem)(app)}/readiness`;
|
|
207
|
+
return `import runtime from './index.ts';
|
|
208
|
+
import { ultramodernApiMarker } from '../shared/ultramodern-build.ts';
|
|
209
|
+
import {
|
|
210
|
+
${apiExport} as api,
|
|
211
|
+
${groupName}ApiContract as contract,
|
|
212
|
+
${groupName}OperationContexts as operationContexts,
|
|
213
|
+
} from '../shared/api.ts';
|
|
214
|
+
|
|
215
|
+
export const backendFederationContract = {
|
|
216
|
+
compatibility: {
|
|
217
|
+
build: ultramodernApiMarker.build,
|
|
218
|
+
contractVersion: '${BACKEND_FEDERATION_CONTRACT_VERSION}',
|
|
219
|
+
nodeAdapterVersion: '${BACKEND_FEDERATION_NODE_ADAPTER_VERSION}',
|
|
220
|
+
packageName: ultramodernApiMarker.packageName,
|
|
221
|
+
sourceRevision: ultramodernApiMarker.sourceRevision,
|
|
222
|
+
unitId: ultramodernApiMarker.unitId,
|
|
223
|
+
},
|
|
224
|
+
contractVersion: '${BACKEND_FEDERATION_CONTRACT_VERSION}',
|
|
225
|
+
executionSurfaces: ['node-mf-runtime'],
|
|
226
|
+
exposes: ['./effect-api'],
|
|
227
|
+
name: '${(0, external_descriptors_cjs_namespaceObject.createBackendFederationName)(app)}',
|
|
228
|
+
nodeAdapterVersion: '${BACKEND_FEDERATION_NODE_ADAPTER_VERSION}',
|
|
229
|
+
openapiPath: '${app.api.prefix}/openapi.json',
|
|
230
|
+
readinessPath: '${readinessPath}',
|
|
231
|
+
role: 'microvertical-server',
|
|
232
|
+
runtimeFramework: 'effect',
|
|
233
|
+
strictEffectApproach: true,
|
|
234
|
+
} as const;
|
|
235
|
+
|
|
236
|
+
export { api, contract, operationContexts, runtime };
|
|
237
|
+
|
|
238
|
+
export default runtime;
|
|
239
|
+
`;
|
|
240
|
+
}
|
|
241
|
+
function createBackendFederationSummary(scope, app) {
|
|
242
|
+
if (!(0, external_descriptors_cjs_namespaceObject.appHasApi)(app)) return;
|
|
243
|
+
return {
|
|
244
|
+
id: app.id,
|
|
245
|
+
path: app.directory,
|
|
246
|
+
role: 'microvertical-server',
|
|
247
|
+
name: (0, external_descriptors_cjs_namespaceObject.createBackendFederationName)(app),
|
|
248
|
+
runtimeFramework: 'effect',
|
|
249
|
+
strictEffectApproach: true,
|
|
250
|
+
contractVersion: BACKEND_FEDERATION_CONTRACT_VERSION,
|
|
251
|
+
deliveryUnit: (0, external_delivery_unit_cjs_namespaceObject.deliveryUnitContractBlock)((0, external_delivery_unit_cjs_namespaceObject.createDeliveryUnitRecord)(scope, app)),
|
|
252
|
+
executionSurfaces: {
|
|
253
|
+
cloudflare: createCloudflareExecutionSurface(scope, app),
|
|
254
|
+
node: createNodeExecutionSurface(app)
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
exports.BACKEND_FEDERATION_CONTRACT_VERSION = __webpack_exports__.BACKEND_FEDERATION_CONTRACT_VERSION;
|
|
259
|
+
exports.BACKEND_FEDERATION_NODE_ADAPTER_VERSION = __webpack_exports__.BACKEND_FEDERATION_NODE_ADAPTER_VERSION;
|
|
260
|
+
exports.createBackendFederationContract = __webpack_exports__.createBackendFederationContract;
|
|
261
|
+
exports.createBackendFederationContractFile = __webpack_exports__.createBackendFederationContractFile;
|
|
262
|
+
exports.createBackendFederationMetadata = __webpack_exports__.createBackendFederationMetadata;
|
|
263
|
+
exports.createBackendFederationSummary = __webpack_exports__.createBackendFederationSummary;
|
|
264
|
+
exports.createDispatchWorkerNameEnv = __webpack_exports__.createDispatchWorkerNameEnv;
|
|
265
|
+
exports.createServerExecutionOverlay = __webpack_exports__.createServerExecutionOverlay;
|
|
266
|
+
exports.createWorkerBindingEnv = __webpack_exports__.createWorkerBindingEnv;
|
|
267
|
+
exports.createWorkerBindingName = __webpack_exports__.createWorkerBindingName;
|
|
268
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
269
|
+
"BACKEND_FEDERATION_CONTRACT_VERSION",
|
|
270
|
+
"BACKEND_FEDERATION_NODE_ADAPTER_VERSION",
|
|
271
|
+
"createBackendFederationContract",
|
|
272
|
+
"createBackendFederationContractFile",
|
|
273
|
+
"createBackendFederationMetadata",
|
|
274
|
+
"createBackendFederationSummary",
|
|
275
|
+
"createDispatchWorkerNameEnv",
|
|
276
|
+
"createServerExecutionOverlay",
|
|
277
|
+
"createWorkerBindingEnv",
|
|
278
|
+
"createWorkerBindingName"
|
|
279
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
280
|
+
Object.defineProperty(exports, '__esModule', {
|
|
281
|
+
value: true
|
|
282
|
+
});
|