@bleedingdev/modern-js-app-tools 3.9.0-ultramodern.4 → 3.9.0-ultramodern.6
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/builder/generator/index.js +0 -1
- package/dist/cjs/builder/shared/builderPlugins/index.js +4 -11
- package/dist/cjs/config/index.js +4 -11
- package/dist/cjs/index.js +80 -111
- package/dist/cjs/plugins/deploy/platforms/node.js +0 -13
- package/dist/cjs/plugins/serverBuild.js +2 -1
- package/dist/esm/builder/generator/index.mjs +1 -2
- package/dist/esm/builder/shared/builderPlugins/index.mjs +0 -1
- package/dist/esm/config/index.mjs +0 -1
- package/dist/esm/index.mjs +1 -6
- package/dist/esm/plugins/deploy/platforms/node.mjs +0 -13
- package/dist/esm/plugins/serverBuild.mjs +2 -1
- package/dist/esm-node/builder/generator/index.mjs +1 -2
- package/dist/esm-node/builder/shared/builderPlugins/index.mjs +0 -1
- package/dist/esm-node/config/index.mjs +0 -1
- package/dist/esm-node/index.mjs +1 -6
- package/dist/esm-node/plugins/deploy/platforms/node.mjs +0 -13
- package/dist/esm-node/plugins/serverBuild.mjs +2 -1
- package/dist/types/builder/shared/builderPlugins/index.d.ts +0 -1
- package/dist/types/config/index.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/plugins/deploy/utils/generator.d.ts +1 -1
- package/dist/types/types/config/output.d.ts +0 -9
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/plugin.d.ts +56 -2
- package/dist/types/utils/initAppContext.d.ts +3 -2
- package/docs/configure/app/bff/effect.md +29 -24
- package/docs/guides/advanced-features/bff/data-platform.md +2 -2
- package/docs/guides/advanced-features/bff/frameworks.md +36 -24
- package/docs/guides/advanced-features/bff/function.md +2 -2
- package/docs/guides/advanced-features/bff/operators.md +17 -17
- package/docs/guides/get-started/quick-start.md +1 -5
- package/docs/guides/get-started/ultramodern.md +5 -86
- package/docs/llms.txt +2 -2
- package/package.json +14 -30
- package/rslib.config.mts +0 -5
- package/dist/cjs/builder/shared/builderPlugins/adapterPrecompress.js +0 -125
- package/dist/cjs/config/build-environment.js +0 -268
- package/dist/cjs/config/public.js +0 -46
- package/dist/cjs/plugins/backend-federation/codegen.js +0 -256
- package/dist/cjs/plugins/backend-federation/config.js +0 -204
- package/dist/cjs/plugins/backend-federation/emit.js +0 -150
- package/dist/cjs/plugins/backendFederationBuild.js +0 -53
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +0 -62
- package/dist/cjs/plugins/deploy/utils/npmAliases.js +0 -226
- package/dist/cjs/plugins/ultramodernReleaseEnvelope.js +0 -44
- package/dist/cjs/presetUltramodern.js +0 -175
- package/dist/cjs/types/config/precompress.js +0 -18
- package/dist/esm/builder/shared/builderPlugins/adapterPrecompress.mjs +0 -77
- package/dist/esm/config/build-environment.mjs +0 -224
- package/dist/esm/config/public.mjs +0 -1
- package/dist/esm/plugins/backend-federation/codegen.mjs +0 -205
- package/dist/esm/plugins/backend-federation/config.mjs +0 -128
- package/dist/esm/plugins/backend-federation/emit.mjs +0 -99
- package/dist/esm/plugins/backendFederationBuild.mjs +0 -1
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +0 -1
- package/dist/esm/plugins/deploy/utils/npmAliases.mjs +0 -174
- package/dist/esm/plugins/ultramodernReleaseEnvelope.mjs +0 -6
- package/dist/esm/presetUltramodern.mjs +0 -119
- package/dist/esm/types/config/precompress.mjs +0 -0
- package/dist/esm-node/builder/shared/builderPlugins/adapterPrecompress.mjs +0 -78
- package/dist/esm-node/config/build-environment.mjs +0 -225
- package/dist/esm-node/config/public.mjs +0 -2
- package/dist/esm-node/plugins/backend-federation/codegen.mjs +0 -206
- package/dist/esm-node/plugins/backend-federation/config.mjs +0 -129
- package/dist/esm-node/plugins/backend-federation/emit.mjs +0 -100
- package/dist/esm-node/plugins/backendFederationBuild.mjs +0 -2
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +0 -2
- package/dist/esm-node/plugins/deploy/utils/npmAliases.mjs +0 -175
- package/dist/esm-node/plugins/ultramodernReleaseEnvelope.mjs +0 -7
- package/dist/esm-node/presetUltramodern.mjs +0 -120
- package/dist/esm-node/types/config/precompress.mjs +0 -1
- package/dist/types/builder/shared/builderPlugins/adapterPrecompress.d.ts +0 -3
- package/dist/types/config/build-environment.d.ts +0 -22
- package/dist/types/config/public.d.ts +0 -2
- package/dist/types/plugins/backend-federation/codegen.d.ts +0 -86
- package/dist/types/plugins/backend-federation/config.d.ts +0 -103
- package/dist/types/plugins/backend-federation/emit.d.ts +0 -13
- package/dist/types/plugins/backendFederationBuild.d.ts +0 -2
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/index.d.ts +0 -1
- package/dist/types/plugins/deploy/utils/npmAliases.d.ts +0 -14
- package/dist/types/plugins/ultramodernReleaseEnvelope.d.ts +0 -3
- package/dist/types/precompress/LICENSE +0 -20
- package/dist/types/precompress/index.d.ts +0 -76
- package/dist/types/presetUltramodern.d.ts +0 -87
- package/dist/types/types/config/precompress.d.ts +0 -19
|
@@ -1,204 +0,0 @@
|
|
|
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
|
-
buildModulePathFor: ()=>buildModulePathFor,
|
|
43
|
-
createAppFromCompactMetadata: ()=>createAppFromCompactMetadata,
|
|
44
|
-
createStampedDeliveryUnit: ()=>createStampedDeliveryUnit,
|
|
45
|
-
findBackendFederationApp: ()=>findBackendFederationApp,
|
|
46
|
-
findWorkspaceRoot: ()=>findWorkspaceRoot,
|
|
47
|
-
normalizeRelativePath: ()=>normalizeRelativePath,
|
|
48
|
-
readBuildIdentity: ()=>readBuildIdentity,
|
|
49
|
-
resolveWorkspaceSourceRevision: ()=>resolveWorkspaceSourceRevision
|
|
50
|
-
});
|
|
51
|
-
const external_node_fs_namespaceObject = require("node:fs");
|
|
52
|
-
const promises_namespaceObject = require("node:fs/promises");
|
|
53
|
-
var promises_default = /*#__PURE__*/ __webpack_require__.n(promises_namespaceObject);
|
|
54
|
-
const external_node_path_namespaceObject = require("node:path");
|
|
55
|
-
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
56
|
-
const release_identity_namespaceObject = require("@modern-js/app-tools-extensions/release-identity");
|
|
57
|
-
const universal_namespaceObject = require("@modern-js/utils/universal");
|
|
58
|
-
const COMPACT_CONFIG_PATH = '.modernjs/ultramodern.json';
|
|
59
|
-
const normalizeRelativePath = (value)=>value.replace(/\\/gu, '/').replace(/^\.\/+/u, '');
|
|
60
|
-
const isRecord = (value)=>'object' == typeof value && null !== value;
|
|
61
|
-
const readJsonFile = async (filePath)=>JSON.parse(await promises_default().readFile(filePath, 'utf8'));
|
|
62
|
-
const buildArtifactPathFor = (appDirectory)=>external_node_path_default().join(appDirectory, universal_namespaceObject.ULTRAMODERN_BUILD_ARTIFACT_PATH);
|
|
63
|
-
const buildModulePathFor = (appDirectory)=>external_node_path_default().join(appDirectory, universal_namespaceObject.ULTRAMODERN_BUILD_MODULE_PATH);
|
|
64
|
-
const readBuildIdentity = async (appDirectory)=>{
|
|
65
|
-
const buildArtifactPath = buildArtifactPathFor(appDirectory);
|
|
66
|
-
if ((0, external_node_fs_namespaceObject.existsSync)(buildArtifactPath)) {
|
|
67
|
-
const artifact = await readJsonFile(buildArtifactPath);
|
|
68
|
-
const artifactValidation = (0, universal_namespaceObject.validateUltramodernBuildArtifact)(artifact, buildArtifactPath);
|
|
69
|
-
if (!artifactValidation.ok) throw new Error(`[backend-federation-build] Invalid delivery-unit build artifact at ${buildArtifactPath}.`);
|
|
70
|
-
if (!(0, universal_namespaceObject.isUltramodernBuildArtifact)(artifact)) throw new Error(`[backend-federation-build] Invalid delivery-unit build artifact at ${buildArtifactPath}.`);
|
|
71
|
-
const deliveryUnit = artifact.deliveryUnit;
|
|
72
|
-
return {
|
|
73
|
-
artifact,
|
|
74
|
-
appId: deliveryUnit.appId,
|
|
75
|
-
buildVersion: deliveryUnit.buildMarker,
|
|
76
|
-
packageName: deliveryUnit.packageName,
|
|
77
|
-
version: deliveryUnit.version,
|
|
78
|
-
unitId: deliveryUnit.unitId,
|
|
79
|
-
sourceRevision: deliveryUnit.sourceRevision
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
const buildModulePath = buildModulePathFor(appDirectory);
|
|
83
|
-
if (!(0, external_node_fs_namespaceObject.existsSync)(buildModulePath)) return {};
|
|
84
|
-
console.warn(`[backend-federation-build] ${buildArtifactPath} missing; falling back to legacy regex parsing of ${buildModulePath}. Regenerate the workspace to emit ${universal_namespaceObject.ULTRAMODERN_BUILD_ARTIFACT_FILE}.`);
|
|
85
|
-
const source = await promises_default().readFile(buildModulePath, 'utf8');
|
|
86
|
-
return {
|
|
87
|
-
appId: source.match(/\bappId:\s*['"]([^'"]+)['"]/u)?.[1],
|
|
88
|
-
buildVersion: source.match(/\bbuild:\s*['"]([^'"]+)['"]/u)?.[1],
|
|
89
|
-
packageName: source.match(/\bpackageName:\s*['"]([^'"]+)['"]/u)?.[1],
|
|
90
|
-
version: source.match(/\bversion:\s*['"]([^'"]+)['"]/u)?.[1],
|
|
91
|
-
unitId: source.match(/\bunitId:\s*['"]([^'"]+)['"]/u)?.[1],
|
|
92
|
-
sourceRevision: source.match(/\bsourceRevision:\s*['"]([^'"]+)['"]/u)?.[1]
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
const toPascalCase = (value)=>value.split(/[^a-zA-Z0-9]+/u).filter(Boolean).map((part)=>part.charAt(0).toUpperCase() + part.slice(1)).join('');
|
|
96
|
-
const stringValue = (value)=>'string' == typeof value && value.length > 0 ? value : void 0;
|
|
97
|
-
const createBackendName = (app, id)=>{
|
|
98
|
-
const configuredName = stringValue(app.backendFederation?.name) ?? stringValue(app.backendFederation?.executionSurfaces?.node?.remoteName) ?? stringValue(app.serverExecution?.node?.remoteName);
|
|
99
|
-
if (configuredName) return configuredName;
|
|
100
|
-
const mfName = stringValue(app.moduleFederation?.name);
|
|
101
|
-
return mfName ? `${mfName}Backend` : `vertical${toPascalCase(id)}Backend`;
|
|
102
|
-
};
|
|
103
|
-
const findWorkspaceRoot = (appDirectory)=>{
|
|
104
|
-
let current = appDirectory;
|
|
105
|
-
while(true){
|
|
106
|
-
if ((0, external_node_fs_namespaceObject.existsSync)(external_node_path_default().join(current, COMPACT_CONFIG_PATH))) return current;
|
|
107
|
-
const parent = external_node_path_default().dirname(current);
|
|
108
|
-
if (parent === current) return;
|
|
109
|
-
current = parent;
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
const resolveWorkspaceSourceRevision = async (workspaceRoot)=>(0, release_identity_namespaceObject.resolveUltramodernSourceRevision)(workspaceRoot);
|
|
113
|
-
const createStampedDeliveryUnit = (input)=>{
|
|
114
|
-
if (!input.unitId || !input.buildMarker || !input.packageName || !input.version) return;
|
|
115
|
-
const record = {
|
|
116
|
-
schemaVersion: universal_namespaceObject.DELIVERY_UNIT_SCHEMA_VERSION,
|
|
117
|
-
kind: universal_namespaceObject.DELIVERY_UNIT_KIND,
|
|
118
|
-
appId: input.appId,
|
|
119
|
-
unitId: input.unitId,
|
|
120
|
-
packageName: input.packageName,
|
|
121
|
-
version: input.version,
|
|
122
|
-
buildMarker: input.buildMarker,
|
|
123
|
-
sourceRevision: input.sourceRevision,
|
|
124
|
-
deployProfile: universal_namespaceObject.DELIVERY_UNIT_DEPLOY_PROFILE
|
|
125
|
-
};
|
|
126
|
-
const validation = (0, universal_namespaceObject.validateDeliveryUnitRecord)(record);
|
|
127
|
-
if (!validation.ok) return;
|
|
128
|
-
return (0, universal_namespaceObject.deliveryUnitContractBlock)(record);
|
|
129
|
-
};
|
|
130
|
-
const createAppFromCompactMetadata = (workspaceRoot, appDirectory, compactApp)=>{
|
|
131
|
-
const id = stringValue(compactApp.id);
|
|
132
|
-
const appPath = stringValue(compactApp.path);
|
|
133
|
-
if (!id || 'vertical' !== compactApp.kind || !isRecord(compactApp.api)) return;
|
|
134
|
-
const directory = appPath ? normalizeRelativePath(appPath) : `verticals/${id}`;
|
|
135
|
-
if (external_node_path_default().resolve(workspaceRoot, directory) !== external_node_path_default().resolve(appDirectory)) return;
|
|
136
|
-
const port = 'number' == typeof compactApp.port ? compactApp.port : void 0;
|
|
137
|
-
if (void 0 === port) return;
|
|
138
|
-
const apiPrefix = stringValue(compactApp.api.prefix) ?? `/${id}-api`;
|
|
139
|
-
const apiStem = stringValue(compactApp.api.stem) ?? id;
|
|
140
|
-
const backendName = createBackendName(compactApp, id);
|
|
141
|
-
const manifestUrl = stringValue(compactApp.backendFederation?.executionSurfaces?.node?.manifestUrl) ?? stringValue(compactApp.serverExecution?.node?.manifestUrl) ?? `http://localhost:${port}/${universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE}`;
|
|
142
|
-
const containerEntry = stringValue(compactApp.backendFederation?.executionSurfaces?.node?.containerEntry) ?? stringValue(compactApp.serverExecution?.node?.containerEntry) ?? `http://localhost:${port}/${universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE}`;
|
|
143
|
-
const configuredRemoteType = stringValue(compactApp.backendFederation?.executionSurfaces?.node?.remoteType) ?? stringValue(compactApp.serverExecution?.node?.remoteType);
|
|
144
|
-
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}.`);
|
|
145
|
-
if (!new URL(containerEntry).pathname.endsWith(`/${universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE}`)) throw new Error(`[backend-federation-build] Node backend federation containerEntry must end with "/${universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE}"; received "${containerEntry}" for ${id}.`);
|
|
146
|
-
const remoteType = 'commonjs-module';
|
|
147
|
-
const packageName = stringValue(compactApp.package);
|
|
148
|
-
const uiManifestUrl = stringValue(compactApp.backendFederation?.versionBoundary?.ui?.manifestUrl) ?? stringValue(compactApp.moduleFederation?.manifestUrl);
|
|
149
|
-
const compactDeliveryUnit = isRecord(compactApp.deliveryUnit) ? {
|
|
150
|
-
unitId: stringValue(compactApp.deliveryUnit.unitId),
|
|
151
|
-
buildMarker: stringValue(compactApp.deliveryUnit.buildMarker),
|
|
152
|
-
sourceRevision: stringValue(compactApp.deliveryUnit.sourceRevision),
|
|
153
|
-
packageName: stringValue(compactApp.deliveryUnit.packageName),
|
|
154
|
-
version: stringValue(compactApp.deliveryUnit.version)
|
|
155
|
-
} : void 0;
|
|
156
|
-
return {
|
|
157
|
-
id,
|
|
158
|
-
directory,
|
|
159
|
-
packageName,
|
|
160
|
-
port,
|
|
161
|
-
apiPrefix,
|
|
162
|
-
apiStem,
|
|
163
|
-
backendName,
|
|
164
|
-
manifestUrl,
|
|
165
|
-
containerEntry,
|
|
166
|
-
remoteType,
|
|
167
|
-
uiManifestUrl,
|
|
168
|
-
compactDeliveryUnit
|
|
169
|
-
};
|
|
170
|
-
};
|
|
171
|
-
const findBackendFederationApp = async (workspaceRoot, appDirectory)=>{
|
|
172
|
-
const compactConfigPath = external_node_path_default().join(workspaceRoot, COMPACT_CONFIG_PATH);
|
|
173
|
-
const compactConfig = await readJsonFile(compactConfigPath);
|
|
174
|
-
const apps = Array.isArray(compactConfig.topology?.apps) ? compactConfig.topology.apps : [];
|
|
175
|
-
for (const app of apps){
|
|
176
|
-
const resolved = createAppFromCompactMetadata(workspaceRoot, appDirectory, app);
|
|
177
|
-
if (resolved) return resolved;
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
exports.COMPACT_CONFIG_PATH = __webpack_exports__.COMPACT_CONFIG_PATH;
|
|
181
|
-
exports.buildArtifactPathFor = __webpack_exports__.buildArtifactPathFor;
|
|
182
|
-
exports.buildModulePathFor = __webpack_exports__.buildModulePathFor;
|
|
183
|
-
exports.createAppFromCompactMetadata = __webpack_exports__.createAppFromCompactMetadata;
|
|
184
|
-
exports.createStampedDeliveryUnit = __webpack_exports__.createStampedDeliveryUnit;
|
|
185
|
-
exports.findBackendFederationApp = __webpack_exports__.findBackendFederationApp;
|
|
186
|
-
exports.findWorkspaceRoot = __webpack_exports__.findWorkspaceRoot;
|
|
187
|
-
exports.normalizeRelativePath = __webpack_exports__.normalizeRelativePath;
|
|
188
|
-
exports.readBuildIdentity = __webpack_exports__.readBuildIdentity;
|
|
189
|
-
exports.resolveWorkspaceSourceRevision = __webpack_exports__.resolveWorkspaceSourceRevision;
|
|
190
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
191
|
-
"COMPACT_CONFIG_PATH",
|
|
192
|
-
"buildArtifactPathFor",
|
|
193
|
-
"buildModulePathFor",
|
|
194
|
-
"createAppFromCompactMetadata",
|
|
195
|
-
"createStampedDeliveryUnit",
|
|
196
|
-
"findBackendFederationApp",
|
|
197
|
-
"findWorkspaceRoot",
|
|
198
|
-
"normalizeRelativePath",
|
|
199
|
-
"readBuildIdentity",
|
|
200
|
-
"resolveWorkspaceSourceRevision"
|
|
201
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
202
|
-
Object.defineProperty(exports, '__esModule', {
|
|
203
|
-
value: true
|
|
204
|
-
});
|
|
@@ -1,150 +0,0 @@
|
|
|
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 node_namespaceObject = require("@modern-js/server-runtime-extensions/backend-federation-security/node");
|
|
50
|
-
const universal_namespaceObject = require("@modern-js/utils/universal");
|
|
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_node_fs_namespaceObject.existsSync)((0, external_config_js_namespaceObject.buildArtifactPathFor)(appDirectory)) ? (0, external_config_js_namespaceObject.buildArtifactPathFor)(appDirectory) : (0, external_config_js_namespaceObject.buildModulePathFor)(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, universal_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, universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE);
|
|
113
|
-
const entryPath = external_node_path_default().join(distDirectory, universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE);
|
|
114
|
-
const deliveryUnitArtifactPath = stampedBuildArtifact ? external_node_path_default().join(distDirectory, universal_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
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
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_js_default(),
|
|
41
|
-
emitBackendFederationArtifacts: ()=>emit_js_namespaceObject.emitBackendFederationArtifacts
|
|
42
|
-
});
|
|
43
|
-
const emit_js_namespaceObject = require("./backend-federation/emit.js");
|
|
44
|
-
var emit_js_default = /*#__PURE__*/ __webpack_require__.n(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
|
-
});
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_modules__ = {
|
|
3
|
-
"@modern-js/app-tools-extensions/cloudflare-output-verifier" (module) {
|
|
4
|
-
module.exports = require("@modern-js/app-tools-extensions/cloudflare-output-verifier");
|
|
5
|
-
}
|
|
6
|
-
};
|
|
7
|
-
var __webpack_module_cache__ = {};
|
|
8
|
-
function __webpack_require__(moduleId) {
|
|
9
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
10
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
11
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
12
|
-
exports: {}
|
|
13
|
-
};
|
|
14
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
15
|
-
return module.exports;
|
|
16
|
-
}
|
|
17
|
-
(()=>{
|
|
18
|
-
__webpack_require__.n = (module)=>{
|
|
19
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
20
|
-
__webpack_require__.d(getter, {
|
|
21
|
-
a: getter
|
|
22
|
-
});
|
|
23
|
-
return getter;
|
|
24
|
-
};
|
|
25
|
-
})();
|
|
26
|
-
(()=>{
|
|
27
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
28
|
-
var define = (defs, kind)=>{
|
|
29
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
[kind]: defs[key]
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
define(getters, "get");
|
|
35
|
-
define(values, "value");
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
|
-
(()=>{
|
|
39
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
40
|
-
})();
|
|
41
|
-
(()=>{
|
|
42
|
-
__webpack_require__.r = (exports1)=>{
|
|
43
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
44
|
-
value: 'Module'
|
|
45
|
-
});
|
|
46
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
47
|
-
value: true
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
})();
|
|
51
|
-
var __webpack_exports__ = {};
|
|
52
|
-
(()=>{
|
|
53
|
-
__webpack_require__.r(__webpack_exports__);
|
|
54
|
-
var _modern_js_app_tools_extensions_cloudflare_output_verifier__rspack_import_0 = __webpack_require__("@modern-js/app-tools-extensions/cloudflare-output-verifier");
|
|
55
|
-
var __rspack_reexport = {};
|
|
56
|
-
for(const __rspack_import_key in _modern_js_app_tools_extensions_cloudflare_output_verifier__rspack_import_0)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_modern_js_app_tools_extensions_cloudflare_output_verifier__rspack_import_0[__rspack_import_key];
|
|
57
|
-
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
58
|
-
})();
|
|
59
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
60
|
-
Object.defineProperty(exports, '__esModule', {
|
|
61
|
-
value: true
|
|
62
|
-
});
|