@bleedingdev/modern-js-app-tools-extensions 3.9.0-ultramodern.1 → 3.9.0-ultramodern.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/backend-federation-build/codegen.js +256 -0
- package/dist/cjs/backend-federation-build/config.js +189 -0
- package/dist/cjs/backend-federation-build/emit.js +150 -0
- package/dist/cjs/backend-federation-build/index.js +53 -0
- package/dist/cjs/build-config/build-environment.js +268 -0
- package/dist/cjs/build-config/precompress/plugin.js +124 -0
- package/dist/cjs/build-config/precompress/types.js +18 -0
- package/dist/cjs/build-config/public.js +46 -0
- package/dist/cjs/cloudflare/constants.js +1 -1
- package/dist/cjs/cloudflare/delivery-unit.js +7 -16
- package/dist/cjs/cloudflare-output-contract.js +37 -1
- package/dist/cjs/cloudflare-output-verifier/identity.js +6 -6
- package/dist/cjs/cloudflare-output-verifier/worker-bundles.js +4 -1
- package/dist/cjs/config.js +29 -1
- package/dist/cjs/deploy-output/npmAliases.js +226 -0
- package/dist/cjs/deploy-output/plugin.js +76 -0
- package/dist/cjs/deploy-output/target.js +48 -0
- package/dist/cjs/native-type-checker.js +193 -0
- package/dist/cjs/policy-defaults.js +101 -0
- package/dist/cjs/release-envelope/framework-output.js +77 -32
- package/dist/cjs/release-envelope/plugin.js +5 -3
- package/dist/cjs/release-identity.js +3 -6
- package/dist/cjs/runtime-package-resolution.js +118 -0
- package/dist/esm/backend-federation-build/codegen.mjs +205 -0
- package/dist/esm/backend-federation-build/config.mjs +116 -0
- package/dist/esm/backend-federation-build/emit.mjs +99 -0
- package/dist/esm/backend-federation-build/index.mjs +1 -0
- package/dist/esm/build-config/build-environment.mjs +224 -0
- package/dist/esm/build-config/precompress/plugin.mjs +76 -0
- package/dist/esm/build-config/precompress/types.mjs +0 -0
- package/dist/esm/build-config/public.mjs +1 -0
- package/dist/esm/cloudflare/constants.mjs +1 -1
- package/dist/esm/cloudflare/delivery-unit.mjs +1 -10
- package/dist/esm/cloudflare-output-contract.mjs +35 -2
- package/dist/esm/cloudflare-output-verifier/identity.mjs +1 -1
- package/dist/esm/cloudflare-output-verifier/worker-bundles.mjs +5 -2
- package/dist/esm/config.mjs +1 -0
- package/dist/esm/deploy-output/npmAliases.mjs +174 -0
- package/dist/esm/deploy-output/plugin.mjs +28 -0
- package/dist/esm/deploy-output/target.mjs +10 -0
- package/dist/esm/native-type-checker.mjs +142 -0
- package/dist/esm/policy-defaults.mjs +45 -0
- package/dist/esm/release-envelope/framework-output.mjs +51 -6
- package/dist/esm/release-envelope/plugin.mjs +5 -3
- package/dist/esm/release-identity.mjs +3 -6
- package/dist/esm/runtime-package-resolution.mjs +60 -0
- package/dist/esm-node/backend-federation-build/codegen.mjs +206 -0
- package/dist/esm-node/backend-federation-build/config.mjs +117 -0
- package/dist/esm-node/backend-federation-build/emit.mjs +100 -0
- package/dist/esm-node/backend-federation-build/index.mjs +2 -0
- package/dist/esm-node/build-config/build-environment.mjs +225 -0
- package/dist/esm-node/build-config/precompress/plugin.mjs +77 -0
- package/dist/esm-node/build-config/precompress/types.mjs +1 -0
- package/dist/esm-node/build-config/public.mjs +2 -0
- package/dist/esm-node/cloudflare/constants.mjs +1 -1
- package/dist/esm-node/cloudflare/delivery-unit.mjs +1 -10
- package/dist/esm-node/cloudflare-output-contract.mjs +35 -2
- package/dist/esm-node/cloudflare-output-verifier/identity.mjs +1 -1
- package/dist/esm-node/cloudflare-output-verifier/worker-bundles.mjs +5 -2
- package/dist/esm-node/config.mjs +1 -0
- package/dist/esm-node/deploy-output/npmAliases.mjs +175 -0
- package/dist/esm-node/deploy-output/plugin.mjs +31 -0
- package/dist/esm-node/deploy-output/target.mjs +11 -0
- package/dist/esm-node/native-type-checker.mjs +143 -0
- package/dist/esm-node/policy-defaults.mjs +46 -0
- package/dist/esm-node/release-envelope/framework-output.mjs +51 -6
- package/dist/esm-node/release-envelope/plugin.mjs +5 -3
- package/dist/esm-node/release-identity.mjs +3 -6
- package/dist/esm-node/runtime-package-resolution.mjs +61 -0
- package/dist/types/backend-federation-build/codegen.d.ts +86 -0
- package/dist/types/backend-federation-build/config.d.ts +102 -0
- package/dist/types/backend-federation-build/emit.d.ts +21 -0
- package/dist/types/backend-federation-build/index.d.ts +2 -0
- package/dist/types/build-config/build-environment.d.ts +22 -0
- package/dist/types/build-config/precompress/plugin.d.ts +4 -0
- package/dist/types/build-config/precompress/types.d.ts +19 -0
- package/dist/types/build-config/public.d.ts +2 -0
- package/dist/types/cloudflare/constants.d.ts +1 -1
- package/dist/types/cloudflare/delivery-unit.d.ts +2 -2
- package/dist/types/cloudflare/worker-manifest.d.ts +2 -2
- package/dist/types/cloudflare-output-contract.d.ts +2 -1
- package/dist/types/cloudflare-output-verifier/identity.d.ts +1 -1
- package/dist/types/config.d.ts +2 -0
- package/dist/types/deploy-output/npmAliases.d.ts +14 -0
- package/dist/types/deploy-output/plugin.d.ts +15 -0
- package/dist/types/deploy-output/target.d.ts +6 -0
- package/dist/types/native-type-checker.d.ts +15 -0
- package/dist/types/policy-defaults.d.ts +46 -0
- package/dist/types/precompress/LICENSE +20 -0
- package/dist/types/precompress/index.d.ts +76 -0
- package/dist/types/release-envelope/framework-output.d.ts +2 -1
- package/dist/types/runtime-package-resolution.d.ts +28 -0
- package/package.json +71 -13
- package/src/backend-federation-build/codegen.ts +245 -0
- package/src/backend-federation-build/config.ts +356 -0
- package/src/backend-federation-build/emit.ts +202 -0
- package/src/backend-federation-build/index.ts +2 -0
- package/src/build-config/build-environment.ts +404 -0
- package/src/build-config/precompress/plugin.ts +140 -0
- package/src/build-config/precompress/types.ts +26 -0
- package/src/build-config/public.ts +6 -0
- package/src/cloudflare/constants.ts +1 -1
- package/src/cloudflare/delivery-unit.ts +3 -20
- package/src/cloudflare/worker-manifest.ts +1 -0
- package/src/cloudflare-builder.ts +1 -0
- package/src/cloudflare-output-contract.ts +37 -0
- package/src/cloudflare-output-verifier/identity.ts +1 -1
- package/src/cloudflare-output-verifier/worker-bundles.ts +5 -3
- package/src/config.ts +7 -0
- package/src/deploy-output/npmAliases.ts +333 -0
- package/src/deploy-output/plugin.ts +49 -0
- package/src/deploy-output/target.ts +23 -0
- package/src/native-type-checker.ts +183 -0
- package/src/policy-defaults.ts +127 -0
- package/src/release-envelope/framework-output.ts +135 -4
- package/src/release-envelope/plugin.ts +15 -3
- package/src/release-identity.ts +3 -2
- package/src/runtime-package-resolution.ts +115 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.r = (exports1)=>{
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
30
|
+
value: 'Module'
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
33
|
+
value: true
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
var __webpack_exports__ = {};
|
|
38
|
+
__webpack_require__.r(__webpack_exports__);
|
|
39
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
createBackendManifest: ()=>createBackendManifest,
|
|
41
|
+
createBackendRemoteEntrySource: ()=>createBackendRemoteEntrySource
|
|
42
|
+
});
|
|
43
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
44
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
45
|
+
const backend_federation_contracts_namespaceObject = require("@modern-js/backend-federation-contracts");
|
|
46
|
+
const external_esbuild_namespaceObject = require("esbuild");
|
|
47
|
+
const external_config_js_namespaceObject = require("./config.js");
|
|
48
|
+
const createRelativeImportSpecifier = (fromDirectory, toFile)=>{
|
|
49
|
+
const relativePath = (0, external_config_js_namespaceObject.normalizeRelativePath)(external_node_path_default().relative(fromDirectory, toFile));
|
|
50
|
+
return relativePath.startsWith('.') ? relativePath : `./${relativePath}`;
|
|
51
|
+
};
|
|
52
|
+
const createPublicPath = (containerEntry, fallbackPort)=>{
|
|
53
|
+
try {
|
|
54
|
+
return new URL('.', containerEntry).href;
|
|
55
|
+
} catch {
|
|
56
|
+
const slashIndex = containerEntry.lastIndexOf('/');
|
|
57
|
+
if (slashIndex >= 0) return containerEntry.slice(0, slashIndex + 1);
|
|
58
|
+
return `http://localhost:${fallbackPort}/`;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const createBackendRemoteEntrySource = async (workspaceRoot, app, effectApiPath, entryPath)=>{
|
|
62
|
+
const effectApiSpecifier = createRelativeImportSpecifier(external_node_path_default().dirname(effectApiPath), effectApiPath);
|
|
63
|
+
const containerMetadata = {
|
|
64
|
+
buildVersion: app.buildVersion,
|
|
65
|
+
expose: backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_EFFECT_EXPOSE,
|
|
66
|
+
name: app.backendName,
|
|
67
|
+
packageName: app.packageName,
|
|
68
|
+
remoteType: app.remoteType,
|
|
69
|
+
source: (0, external_config_js_namespaceObject.normalizeRelativePath)(external_node_path_default().relative(workspaceRoot, effectApiPath)),
|
|
70
|
+
version: app.version,
|
|
71
|
+
...app.unitId ? {
|
|
72
|
+
unitId: app.unitId
|
|
73
|
+
} : {},
|
|
74
|
+
...app.sourceRevision ? {
|
|
75
|
+
sourceRevision: app.sourceRevision
|
|
76
|
+
} : {}
|
|
77
|
+
};
|
|
78
|
+
const compatibility = {
|
|
79
|
+
build: app.buildVersion,
|
|
80
|
+
contractVersion: backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_CONTRACT_VERSION,
|
|
81
|
+
nodeAdapterVersion: backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_NODE_ADAPTER_VERSION,
|
|
82
|
+
packageName: app.packageName,
|
|
83
|
+
...app.unitId ? {
|
|
84
|
+
unitId: app.unitId
|
|
85
|
+
} : {},
|
|
86
|
+
...app.sourceRevision ? {
|
|
87
|
+
sourceRevision: app.sourceRevision
|
|
88
|
+
} : {}
|
|
89
|
+
};
|
|
90
|
+
const source = `// Generated by Modern.js backend federation build.
|
|
91
|
+
import * as exposedNamespace from ${JSON.stringify(effectApiSpecifier)};
|
|
92
|
+
|
|
93
|
+
const exposedModule = {
|
|
94
|
+
...exposedNamespace,
|
|
95
|
+
backendFederationContract: {
|
|
96
|
+
...(exposedNamespace.backendFederationContract ?? {}),
|
|
97
|
+
compatibility: {
|
|
98
|
+
...(exposedNamespace.backendFederationContract?.compatibility ?? {}),
|
|
99
|
+
...${JSON.stringify(compatibility)},
|
|
100
|
+
},
|
|
101
|
+
name: ${JSON.stringify(app.backendName)},
|
|
102
|
+
role: 'microvertical-server',
|
|
103
|
+
runtimeFramework: 'effect',
|
|
104
|
+
strictEffectApproach: true,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
const exposedModules = {
|
|
108
|
+
${JSON.stringify(backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_EFFECT_EXPOSE)}: () => Promise.resolve(exposedModule),
|
|
109
|
+
};
|
|
110
|
+
const __modernjsBackendFederation = ${JSON.stringify(containerMetadata)};
|
|
111
|
+
|
|
112
|
+
function init() {}
|
|
113
|
+
|
|
114
|
+
function get(id) {
|
|
115
|
+
const load = exposedModules[id];
|
|
116
|
+
if (!load) {
|
|
117
|
+
throw new Error(\`Unexpected backend federation expose: \${id}\`);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return async () => load();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
module.exports = { __modernjsBackendFederation, get, init };
|
|
124
|
+
`;
|
|
125
|
+
const result = await (0, external_esbuild_namespaceObject.build)({
|
|
126
|
+
absWorkingDir: external_node_path_default().dirname(effectApiPath),
|
|
127
|
+
bundle: true,
|
|
128
|
+
format: 'cjs',
|
|
129
|
+
logLevel: 'silent',
|
|
130
|
+
platform: 'node',
|
|
131
|
+
stdin: {
|
|
132
|
+
contents: source,
|
|
133
|
+
loader: 'ts',
|
|
134
|
+
resolveDir: external_node_path_default().dirname(effectApiPath),
|
|
135
|
+
sourcefile: external_node_path_default().basename(entryPath)
|
|
136
|
+
},
|
|
137
|
+
target: 'node20',
|
|
138
|
+
write: false
|
|
139
|
+
});
|
|
140
|
+
const output = result.outputFiles[0];
|
|
141
|
+
if (!output) throw new Error('[backend-federation-build] CommonJS backend federation container emitted no output.');
|
|
142
|
+
return output.text;
|
|
143
|
+
};
|
|
144
|
+
const createBackendManifest = (workspaceRoot, distDirectory, app, entryIntegrity)=>{
|
|
145
|
+
const sourceModule = `${app.directory}/api/effect-api.ts`;
|
|
146
|
+
const publicPath = createPublicPath(app.containerEntry, app.port);
|
|
147
|
+
const manifest = {
|
|
148
|
+
schemaVersion: 1,
|
|
149
|
+
id: app.backendName,
|
|
150
|
+
name: app.backendName,
|
|
151
|
+
version: app.version,
|
|
152
|
+
buildVersion: app.buildVersion,
|
|
153
|
+
metaData: {
|
|
154
|
+
name: app.backendName,
|
|
155
|
+
type: 'backend',
|
|
156
|
+
buildInfo: {
|
|
157
|
+
buildVersion: app.buildVersion,
|
|
158
|
+
buildName: app.packageName
|
|
159
|
+
},
|
|
160
|
+
remoteEntry: {
|
|
161
|
+
name: backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE,
|
|
162
|
+
path: '',
|
|
163
|
+
type: app.remoteType
|
|
164
|
+
},
|
|
165
|
+
globalName: app.backendName,
|
|
166
|
+
publicPath,
|
|
167
|
+
ssrRemoteEntry: {
|
|
168
|
+
name: backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE,
|
|
169
|
+
path: '',
|
|
170
|
+
type: app.remoteType
|
|
171
|
+
},
|
|
172
|
+
ssrPublicPath: publicPath
|
|
173
|
+
},
|
|
174
|
+
entry: {
|
|
175
|
+
...entryIntegrity,
|
|
176
|
+
file: backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE,
|
|
177
|
+
path: (0, external_config_js_namespaceObject.normalizeRelativePath)(external_node_path_default().relative(workspaceRoot, external_node_path_default().join(distDirectory, backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE))),
|
|
178
|
+
type: app.remoteType,
|
|
179
|
+
url: app.containerEntry
|
|
180
|
+
},
|
|
181
|
+
exposes: [
|
|
182
|
+
{
|
|
183
|
+
id: `${app.backendName}:${backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_EFFECT_EXPOSE}`,
|
|
184
|
+
name: backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_EFFECT_EXPOSE,
|
|
185
|
+
path: '',
|
|
186
|
+
assets: {
|
|
187
|
+
js: {
|
|
188
|
+
async: [],
|
|
189
|
+
sync: [
|
|
190
|
+
backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
css: {
|
|
194
|
+
async: [],
|
|
195
|
+
sync: []
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
shared: [],
|
|
201
|
+
backendFederation: {
|
|
202
|
+
role: 'microvertical-server',
|
|
203
|
+
appId: app.id,
|
|
204
|
+
name: app.backendName,
|
|
205
|
+
runtimeFramework: 'effect',
|
|
206
|
+
strictEffectApproach: true,
|
|
207
|
+
contractVersion: backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_CONTRACT_VERSION,
|
|
208
|
+
nodeAdapterVersion: backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_NODE_ADAPTER_VERSION,
|
|
209
|
+
remoteType: app.remoteType,
|
|
210
|
+
expose: backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_EFFECT_EXPOSE,
|
|
211
|
+
manifestUrl: app.manifestUrl,
|
|
212
|
+
containerEntry: app.containerEntry,
|
|
213
|
+
source: {
|
|
214
|
+
module: sourceModule
|
|
215
|
+
},
|
|
216
|
+
readinessPath: `${app.apiPrefix}/${app.apiStem}/readiness`,
|
|
217
|
+
openapiPath: `${app.apiPrefix}/openapi.json`,
|
|
218
|
+
...app.deliveryUnit ? {
|
|
219
|
+
deliveryUnit: app.deliveryUnit
|
|
220
|
+
} : {},
|
|
221
|
+
versionBoundary: {
|
|
222
|
+
invariant: 'web-and-api-same-build',
|
|
223
|
+
packageName: app.packageName,
|
|
224
|
+
version: app.version,
|
|
225
|
+
buildVersion: app.buildVersion,
|
|
226
|
+
...app.uiManifestUrl ? {
|
|
227
|
+
uiManifestUrl: app.uiManifestUrl
|
|
228
|
+
} : {},
|
|
229
|
+
...app.deliveryUnit ? {
|
|
230
|
+
deliveryUnit: {
|
|
231
|
+
unitId: app.deliveryUnit.unitId,
|
|
232
|
+
buildMarker: app.deliveryUnit.buildMarker,
|
|
233
|
+
sourceRevision: app.deliveryUnit.sourceRevision
|
|
234
|
+
}
|
|
235
|
+
} : {}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
const validation = (0, backend_federation_contracts_namespaceObject.validateBackendFederationManifest)(manifest, {
|
|
240
|
+
path: 'backendFederationManifest',
|
|
241
|
+
requireEffectExpose: true,
|
|
242
|
+
requireEffectRuntime: true,
|
|
243
|
+
requireVersionFields: true
|
|
244
|
+
});
|
|
245
|
+
if (!validation.ok) throw new Error(`[backend-federation-build] Invalid backend federation manifest: ${(0, backend_federation_contracts_namespaceObject.formatBackendFederationValidationErrors)(validation.errors)}.`);
|
|
246
|
+
return manifest;
|
|
247
|
+
};
|
|
248
|
+
exports.createBackendManifest = __webpack_exports__.createBackendManifest;
|
|
249
|
+
exports.createBackendRemoteEntrySource = __webpack_exports__.createBackendRemoteEntrySource;
|
|
250
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
251
|
+
"createBackendManifest",
|
|
252
|
+
"createBackendRemoteEntrySource"
|
|
253
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
254
|
+
Object.defineProperty(exports, '__esModule', {
|
|
255
|
+
value: true
|
|
256
|
+
});
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.r = (exports1)=>{
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
30
|
+
value: 'Module'
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
33
|
+
value: true
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
var __webpack_exports__ = {};
|
|
38
|
+
__webpack_require__.r(__webpack_exports__);
|
|
39
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
COMPACT_CONFIG_PATH: ()=>COMPACT_CONFIG_PATH,
|
|
41
|
+
buildArtifactPathFor: ()=>buildArtifactPathFor,
|
|
42
|
+
createAppFromCompactMetadata: ()=>createAppFromCompactMetadata,
|
|
43
|
+
createStampedDeliveryUnit: ()=>createStampedDeliveryUnit,
|
|
44
|
+
findBackendFederationApp: ()=>findBackendFederationApp,
|
|
45
|
+
findWorkspaceRoot: ()=>findWorkspaceRoot,
|
|
46
|
+
normalizeRelativePath: ()=>normalizeRelativePath,
|
|
47
|
+
readBuildIdentity: ()=>readBuildIdentity,
|
|
48
|
+
resolveWorkspaceSourceRevision: ()=>resolveWorkspaceSourceRevision
|
|
49
|
+
});
|
|
50
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
51
|
+
const promises_namespaceObject = require("node:fs/promises");
|
|
52
|
+
var promises_default = /*#__PURE__*/ __webpack_require__.n(promises_namespaceObject);
|
|
53
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
54
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
55
|
+
const release_identity_namespaceObject = require("@modern-js/app-tools-extensions/release-identity");
|
|
56
|
+
const backend_federation_contracts_namespaceObject = require("@modern-js/backend-federation-contracts");
|
|
57
|
+
const COMPACT_CONFIG_PATH = '.modernjs/ultramodern.json';
|
|
58
|
+
const normalizeRelativePath = (value)=>value.replace(/\\/gu, '/').replace(/^\.\/+/u, '');
|
|
59
|
+
const isRecord = (value)=>'object' == typeof value && null !== value;
|
|
60
|
+
const readJsonFile = async (filePath)=>JSON.parse(await promises_default().readFile(filePath, 'utf8'));
|
|
61
|
+
const buildArtifactPathFor = (appDirectory)=>external_node_path_default().join(appDirectory, backend_federation_contracts_namespaceObject.ULTRAMODERN_BUILD_ARTIFACT_PATH);
|
|
62
|
+
const readBuildIdentity = async (appDirectory)=>{
|
|
63
|
+
const buildArtifactPath = buildArtifactPathFor(appDirectory);
|
|
64
|
+
if ((0, external_node_fs_namespaceObject.existsSync)(buildArtifactPath)) {
|
|
65
|
+
const artifact = await readJsonFile(buildArtifactPath);
|
|
66
|
+
const artifactValidation = (0, backend_federation_contracts_namespaceObject.validateUltramodernBuildArtifact)(artifact, buildArtifactPath);
|
|
67
|
+
if (!artifactValidation.ok) throw new Error(`[backend-federation-build] Invalid delivery-unit build artifact at ${buildArtifactPath}.`);
|
|
68
|
+
if (!(0, backend_federation_contracts_namespaceObject.isUltramodernBuildArtifact)(artifact)) throw new Error(`[backend-federation-build] Invalid delivery-unit build artifact at ${buildArtifactPath}.`);
|
|
69
|
+
const deliveryUnit = artifact.deliveryUnit;
|
|
70
|
+
return {
|
|
71
|
+
artifact,
|
|
72
|
+
appId: deliveryUnit.appId,
|
|
73
|
+
buildVersion: deliveryUnit.buildMarker,
|
|
74
|
+
packageName: deliveryUnit.packageName,
|
|
75
|
+
version: deliveryUnit.version,
|
|
76
|
+
unitId: deliveryUnit.unitId,
|
|
77
|
+
sourceRevision: deliveryUnit.sourceRevision
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
throw new Error(`[backend-federation-build] Missing delivery-unit build artifact at ${buildArtifactPath}.`);
|
|
81
|
+
};
|
|
82
|
+
const toPascalCase = (value)=>value.split(/[^a-zA-Z0-9]+/u).filter(Boolean).map((part)=>part.charAt(0).toUpperCase() + part.slice(1)).join('');
|
|
83
|
+
const stringValue = (value)=>'string' == typeof value && value.length > 0 ? value : void 0;
|
|
84
|
+
const createBackendName = (app, id)=>{
|
|
85
|
+
const configuredName = stringValue(app.backendFederation?.name) ?? stringValue(app.backendFederation?.executionSurfaces?.node?.remoteName) ?? stringValue(app.serverExecution?.node?.remoteName);
|
|
86
|
+
if (configuredName) return configuredName;
|
|
87
|
+
const mfName = stringValue(app.moduleFederation?.name);
|
|
88
|
+
return mfName ? `${mfName}Backend` : `vertical${toPascalCase(id)}Backend`;
|
|
89
|
+
};
|
|
90
|
+
const findWorkspaceRoot = (appDirectory)=>{
|
|
91
|
+
let current = appDirectory;
|
|
92
|
+
while(true){
|
|
93
|
+
if ((0, external_node_fs_namespaceObject.existsSync)(external_node_path_default().join(current, COMPACT_CONFIG_PATH))) return current;
|
|
94
|
+
const parent = external_node_path_default().dirname(current);
|
|
95
|
+
if (parent === current) return;
|
|
96
|
+
current = parent;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const resolveWorkspaceSourceRevision = async (workspaceRoot)=>(0, release_identity_namespaceObject.resolveUltramodernSourceRevision)(workspaceRoot);
|
|
100
|
+
const createStampedDeliveryUnit = (input)=>{
|
|
101
|
+
if (!input.unitId || !input.buildMarker || !input.packageName || !input.version) return;
|
|
102
|
+
const record = {
|
|
103
|
+
schemaVersion: backend_federation_contracts_namespaceObject.DELIVERY_UNIT_SCHEMA_VERSION,
|
|
104
|
+
kind: backend_federation_contracts_namespaceObject.DELIVERY_UNIT_KIND,
|
|
105
|
+
appId: input.appId,
|
|
106
|
+
unitId: input.unitId,
|
|
107
|
+
packageName: input.packageName,
|
|
108
|
+
version: input.version,
|
|
109
|
+
buildMarker: input.buildMarker,
|
|
110
|
+
sourceRevision: input.sourceRevision,
|
|
111
|
+
deployProfile: backend_federation_contracts_namespaceObject.DELIVERY_UNIT_DEPLOY_PROFILE
|
|
112
|
+
};
|
|
113
|
+
const validation = (0, backend_federation_contracts_namespaceObject.validateDeliveryUnitRecord)(record);
|
|
114
|
+
if (!validation.ok) return;
|
|
115
|
+
return (0, backend_federation_contracts_namespaceObject.deliveryUnitContractBlock)(record);
|
|
116
|
+
};
|
|
117
|
+
const createAppFromCompactMetadata = (workspaceRoot, appDirectory, compactApp)=>{
|
|
118
|
+
const id = stringValue(compactApp.id);
|
|
119
|
+
const appPath = stringValue(compactApp.path);
|
|
120
|
+
if (!id || 'vertical' !== compactApp.kind || !isRecord(compactApp.api)) return;
|
|
121
|
+
const directory = appPath ? normalizeRelativePath(appPath) : `verticals/${id}`;
|
|
122
|
+
if (external_node_path_default().resolve(workspaceRoot, directory) !== external_node_path_default().resolve(appDirectory)) return;
|
|
123
|
+
const port = 'number' == typeof compactApp.port ? compactApp.port : void 0;
|
|
124
|
+
if (void 0 === port) return;
|
|
125
|
+
const apiPrefix = stringValue(compactApp.api.prefix) ?? `/${id}-api`;
|
|
126
|
+
const apiStem = stringValue(compactApp.api.stem) ?? id;
|
|
127
|
+
const backendName = createBackendName(compactApp, id);
|
|
128
|
+
const manifestUrl = stringValue(compactApp.backendFederation?.executionSurfaces?.node?.manifestUrl) ?? stringValue(compactApp.serverExecution?.node?.manifestUrl) ?? `http://localhost:${port}/${backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE}`;
|
|
129
|
+
const containerEntry = stringValue(compactApp.backendFederation?.executionSurfaces?.node?.containerEntry) ?? stringValue(compactApp.serverExecution?.node?.containerEntry) ?? `http://localhost:${port}/${backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE}`;
|
|
130
|
+
const configuredRemoteType = stringValue(compactApp.backendFederation?.executionSurfaces?.node?.remoteType) ?? stringValue(compactApp.serverExecution?.node?.remoteType);
|
|
131
|
+
if (void 0 !== configuredRemoteType && 'commonjs-module' !== configuredRemoteType) throw new Error(`[backend-federation-build] Node backend federation remoteType must be "commonjs-module"; received "${configuredRemoteType}" for ${id}.`);
|
|
132
|
+
if (!new URL(containerEntry).pathname.endsWith(`/${backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE}`)) throw new Error(`[backend-federation-build] Node backend federation containerEntry must end with "/${backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE}"; received "${containerEntry}" for ${id}.`);
|
|
133
|
+
const remoteType = 'commonjs-module';
|
|
134
|
+
const packageName = stringValue(compactApp.package);
|
|
135
|
+
const uiManifestUrl = stringValue(compactApp.backendFederation?.versionBoundary?.ui?.manifestUrl) ?? stringValue(compactApp.moduleFederation?.manifestUrl);
|
|
136
|
+
const compactDeliveryUnit = isRecord(compactApp.deliveryUnit) ? {
|
|
137
|
+
unitId: stringValue(compactApp.deliveryUnit.unitId),
|
|
138
|
+
buildMarker: stringValue(compactApp.deliveryUnit.buildMarker),
|
|
139
|
+
sourceRevision: stringValue(compactApp.deliveryUnit.sourceRevision),
|
|
140
|
+
packageName: stringValue(compactApp.deliveryUnit.packageName),
|
|
141
|
+
version: stringValue(compactApp.deliveryUnit.version)
|
|
142
|
+
} : void 0;
|
|
143
|
+
return {
|
|
144
|
+
id,
|
|
145
|
+
directory,
|
|
146
|
+
packageName,
|
|
147
|
+
port,
|
|
148
|
+
apiPrefix,
|
|
149
|
+
apiStem,
|
|
150
|
+
backendName,
|
|
151
|
+
manifestUrl,
|
|
152
|
+
containerEntry,
|
|
153
|
+
remoteType,
|
|
154
|
+
uiManifestUrl,
|
|
155
|
+
compactDeliveryUnit
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
const findBackendFederationApp = async (workspaceRoot, appDirectory)=>{
|
|
159
|
+
const compactConfigPath = external_node_path_default().join(workspaceRoot, COMPACT_CONFIG_PATH);
|
|
160
|
+
const compactConfig = await readJsonFile(compactConfigPath);
|
|
161
|
+
const apps = Array.isArray(compactConfig.topology?.apps) ? compactConfig.topology.apps : [];
|
|
162
|
+
for (const app of apps){
|
|
163
|
+
const resolved = createAppFromCompactMetadata(workspaceRoot, appDirectory, app);
|
|
164
|
+
if (resolved) return resolved;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
exports.COMPACT_CONFIG_PATH = __webpack_exports__.COMPACT_CONFIG_PATH;
|
|
168
|
+
exports.buildArtifactPathFor = __webpack_exports__.buildArtifactPathFor;
|
|
169
|
+
exports.createAppFromCompactMetadata = __webpack_exports__.createAppFromCompactMetadata;
|
|
170
|
+
exports.createStampedDeliveryUnit = __webpack_exports__.createStampedDeliveryUnit;
|
|
171
|
+
exports.findBackendFederationApp = __webpack_exports__.findBackendFederationApp;
|
|
172
|
+
exports.findWorkspaceRoot = __webpack_exports__.findWorkspaceRoot;
|
|
173
|
+
exports.normalizeRelativePath = __webpack_exports__.normalizeRelativePath;
|
|
174
|
+
exports.readBuildIdentity = __webpack_exports__.readBuildIdentity;
|
|
175
|
+
exports.resolveWorkspaceSourceRevision = __webpack_exports__.resolveWorkspaceSourceRevision;
|
|
176
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
177
|
+
"COMPACT_CONFIG_PATH",
|
|
178
|
+
"buildArtifactPathFor",
|
|
179
|
+
"createAppFromCompactMetadata",
|
|
180
|
+
"createStampedDeliveryUnit",
|
|
181
|
+
"findBackendFederationApp",
|
|
182
|
+
"findWorkspaceRoot",
|
|
183
|
+
"normalizeRelativePath",
|
|
184
|
+
"readBuildIdentity",
|
|
185
|
+
"resolveWorkspaceSourceRevision"
|
|
186
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
187
|
+
Object.defineProperty(exports, '__esModule', {
|
|
188
|
+
value: true
|
|
189
|
+
});
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.r = (exports1)=>{
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
30
|
+
value: 'Module'
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
33
|
+
value: true
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
var __webpack_exports__ = {};
|
|
38
|
+
__webpack_require__.r(__webpack_exports__);
|
|
39
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
default: ()=>emit,
|
|
41
|
+
emitBackendFederationArtifacts: ()=>emitBackendFederationArtifacts
|
|
42
|
+
});
|
|
43
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
44
|
+
const promises_namespaceObject = require("node:fs/promises");
|
|
45
|
+
var promises_default = /*#__PURE__*/ __webpack_require__.n(promises_namespaceObject);
|
|
46
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
47
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
48
|
+
const release_identity_namespaceObject = require("@modern-js/app-tools-extensions/release-identity");
|
|
49
|
+
const backend_federation_contracts_namespaceObject = require("@modern-js/backend-federation-contracts");
|
|
50
|
+
const node_namespaceObject = require("@modern-js/server-runtime-extensions/backend-federation-security/node");
|
|
51
|
+
const external_codegen_js_namespaceObject = require("./codegen.js");
|
|
52
|
+
const external_config_js_namespaceObject = require("./config.js");
|
|
53
|
+
const emitBackendFederationArtifacts = async (appDirectory, distDirectory)=>{
|
|
54
|
+
const workspaceRoot = (0, external_config_js_namespaceObject.findWorkspaceRoot)(appDirectory);
|
|
55
|
+
if (!workspaceRoot) return;
|
|
56
|
+
const effectApiPath = external_node_path_default().join(appDirectory, 'api/effect-api.ts');
|
|
57
|
+
const backendFederationConfigPath = external_node_path_default().join(appDirectory, 'backend-federation.config.ts');
|
|
58
|
+
if (!(0, external_node_fs_namespaceObject.existsSync)(effectApiPath) || !(0, external_node_fs_namespaceObject.existsSync)(backendFederationConfigPath)) return;
|
|
59
|
+
const app = await (0, external_config_js_namespaceObject.findBackendFederationApp)(workspaceRoot, appDirectory);
|
|
60
|
+
if (!app) return;
|
|
61
|
+
const buildIdentity = await (0, external_config_js_namespaceObject.readBuildIdentity)(appDirectory);
|
|
62
|
+
const compactDeliveryUnit = app.compactDeliveryUnit;
|
|
63
|
+
const hasCompactDeliveryUnit = void 0 !== compactDeliveryUnit && (void 0 !== compactDeliveryUnit.unitId || void 0 !== compactDeliveryUnit.buildMarker || void 0 !== compactDeliveryUnit.packageName || void 0 !== compactDeliveryUnit.version);
|
|
64
|
+
const hasBuildIdentity = void 0 !== buildIdentity.unitId || void 0 !== buildIdentity.buildVersion || void 0 !== buildIdentity.packageName || void 0 !== buildIdentity.version;
|
|
65
|
+
if (hasBuildIdentity) {
|
|
66
|
+
const compactConfigPath = external_node_path_default().join(workspaceRoot, external_config_js_namespaceObject.COMPACT_CONFIG_PATH);
|
|
67
|
+
const buildIdentityPath = (0, external_config_js_namespaceObject.buildArtifactPathFor)(appDirectory);
|
|
68
|
+
const mismatches = [];
|
|
69
|
+
const compare = (label, a, b, leftLabel = 'deliveryUnit')=>{
|
|
70
|
+
if (void 0 !== a && void 0 !== b && a !== b) mismatches.push(`${label}: ${leftLabel}=${a} vs ultramodern-build=${b}`);
|
|
71
|
+
};
|
|
72
|
+
compare('appId', app.id, buildIdentity.appId, 'topology');
|
|
73
|
+
if (hasCompactDeliveryUnit) {
|
|
74
|
+
compare('unitId', compactDeliveryUnit?.unitId, buildIdentity.unitId);
|
|
75
|
+
compare('buildMarker/build', compactDeliveryUnit?.buildMarker, buildIdentity.buildVersion);
|
|
76
|
+
compare('packageName', compactDeliveryUnit?.packageName, buildIdentity.packageName);
|
|
77
|
+
compare('version', compactDeliveryUnit?.version, buildIdentity.version);
|
|
78
|
+
}
|
|
79
|
+
if (mismatches.length > 0) throw new Error(`[backend-federation-build] Delivery-unit identity drift between ${compactConfigPath} (topology) and ${buildIdentityPath}: ${mismatches.join('; ')}`);
|
|
80
|
+
}
|
|
81
|
+
const unitId = compactDeliveryUnit?.unitId ?? buildIdentity.unitId;
|
|
82
|
+
const generationBuildMarker = compactDeliveryUnit?.buildMarker ?? buildIdentity.buildVersion;
|
|
83
|
+
const sourceRevision = await (0, external_config_js_namespaceObject.resolveWorkspaceSourceRevision)(workspaceRoot);
|
|
84
|
+
const buildVersion = generationBuildMarker && unitId ? (0, release_identity_namespaceObject.resolveUltramodernReleaseIdentity)({
|
|
85
|
+
generationBuildMarker,
|
|
86
|
+
unitId,
|
|
87
|
+
workspaceRoot
|
|
88
|
+
}).buildMarker : void 0;
|
|
89
|
+
const packageName = compactDeliveryUnit?.packageName ?? buildIdentity.packageName ?? app.packageName;
|
|
90
|
+
const version = compactDeliveryUnit?.version ?? buildIdentity.version;
|
|
91
|
+
const deliveryUnit = (0, external_config_js_namespaceObject.createStampedDeliveryUnit)({
|
|
92
|
+
appId: app.id,
|
|
93
|
+
unitId,
|
|
94
|
+
buildMarker: buildVersion,
|
|
95
|
+
packageName,
|
|
96
|
+
version,
|
|
97
|
+
sourceRevision
|
|
98
|
+
});
|
|
99
|
+
const stampedBuildArtifact = buildIdentity.artifact ? (0, backend_federation_contracts_namespaceObject.stampUltramodernBuildArtifactIdentity)(buildIdentity.artifact, {
|
|
100
|
+
buildMarker: buildVersion ?? buildIdentity.artifact.deliveryUnit.buildMarker,
|
|
101
|
+
sourceRevision
|
|
102
|
+
}) : void 0;
|
|
103
|
+
const resolvedApp = {
|
|
104
|
+
...app,
|
|
105
|
+
packageName,
|
|
106
|
+
version,
|
|
107
|
+
buildVersion,
|
|
108
|
+
unitId,
|
|
109
|
+
sourceRevision,
|
|
110
|
+
deliveryUnit
|
|
111
|
+
};
|
|
112
|
+
const manifestPath = external_node_path_default().join(distDirectory, backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE);
|
|
113
|
+
const entryPath = external_node_path_default().join(distDirectory, backend_federation_contracts_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE);
|
|
114
|
+
const deliveryUnitArtifactPath = stampedBuildArtifact ? external_node_path_default().join(distDirectory, backend_federation_contracts_namespaceObject.ULTRAMODERN_BUILD_ARTIFACT_FILE) : void 0;
|
|
115
|
+
const entrySource = await (0, external_codegen_js_namespaceObject.createBackendRemoteEntrySource)(workspaceRoot, resolvedApp, effectApiPath, entryPath);
|
|
116
|
+
await promises_default().mkdir(distDirectory, {
|
|
117
|
+
recursive: true
|
|
118
|
+
});
|
|
119
|
+
await promises_default().writeFile(entryPath, entrySource);
|
|
120
|
+
await promises_default().writeFile(manifestPath, `${JSON.stringify((0, external_codegen_js_namespaceObject.createBackendManifest)(workspaceRoot, distDirectory, resolvedApp, (0, node_namespaceObject.createBackendFederationEntryIntegrity)(entrySource)), null, 2)}\n`);
|
|
121
|
+
if (stampedBuildArtifact && deliveryUnitArtifactPath) await promises_default().writeFile(deliveryUnitArtifactPath, `${JSON.stringify(stampedBuildArtifact, null, 2)}\n`);
|
|
122
|
+
return {
|
|
123
|
+
appId: resolvedApp.id,
|
|
124
|
+
manifestPath,
|
|
125
|
+
containerPath: entryPath,
|
|
126
|
+
...deliveryUnitArtifactPath ? {
|
|
127
|
+
deliveryUnitArtifactPath
|
|
128
|
+
} : {},
|
|
129
|
+
remoteName: resolvedApp.backendName,
|
|
130
|
+
remoteType: resolvedApp.remoteType
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
const emit = ()=>({
|
|
134
|
+
name: '@modern-js/backend-federation-build',
|
|
135
|
+
setup (api) {
|
|
136
|
+
api.onAfterBuild(async ()=>{
|
|
137
|
+
const { appDirectory, distDirectory } = api.getAppContext();
|
|
138
|
+
await emitBackendFederationArtifacts(appDirectory, distDirectory);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
exports["default"] = __webpack_exports__["default"];
|
|
143
|
+
exports.emitBackendFederationArtifacts = __webpack_exports__.emitBackendFederationArtifacts;
|
|
144
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
145
|
+
"default",
|
|
146
|
+
"emitBackendFederationArtifacts"
|
|
147
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
148
|
+
Object.defineProperty(exports, '__esModule', {
|
|
149
|
+
value: true
|
|
150
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.r = (exports1)=>{
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
30
|
+
value: 'Module'
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
33
|
+
value: true
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
var __webpack_exports__ = {};
|
|
38
|
+
__webpack_require__.r(__webpack_exports__);
|
|
39
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
default: ()=>external_emit_js_default(),
|
|
41
|
+
emitBackendFederationArtifacts: ()=>external_emit_js_namespaceObject.emitBackendFederationArtifacts
|
|
42
|
+
});
|
|
43
|
+
const external_emit_js_namespaceObject = require("./emit.js");
|
|
44
|
+
var external_emit_js_default = /*#__PURE__*/ __webpack_require__.n(external_emit_js_namespaceObject);
|
|
45
|
+
exports["default"] = __webpack_exports__["default"];
|
|
46
|
+
exports.emitBackendFederationArtifacts = __webpack_exports__.emitBackendFederationArtifacts;
|
|
47
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
48
|
+
"default",
|
|
49
|
+
"emitBackendFederationArtifacts"
|
|
50
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
51
|
+
Object.defineProperty(exports, '__esModule', {
|
|
52
|
+
value: true
|
|
53
|
+
});
|