zephyr-webpack-plugin 0.0.1
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 +26 -0
- package/package.json +23 -0
- package/src/delegate-module/zephyr-delegate.d.ts +13 -0
- package/src/delegate-module/zephyr-delegate.js +121 -0
- package/src/delegate-module/zephyr-delegate.js.map +1 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/convert-dependencies.d.ts +12 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/convert-dependencies.js +31 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/convert-dependencies.js.map +1 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/convert-to-graph.d.ts +47 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/convert-to-graph.js +56 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/convert-to-graph.js.map +1 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/get-licenses.d.ts +22 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/get-licenses.js +31 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/get-licenses.js.map +1 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/module-part-one.d.ts +16 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/module-part-one.js +113 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/module-part-one.js.map +1 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/module-part-two.d.ts +27 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/module-part-two.js +123 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/module-part-two.js.map +1 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/object-has-keys.d.ts +6 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/object-has-keys.js +20 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/object-has-keys.js.map +1 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/process-function-remotes.d.ts +9 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/process-function-remotes.js +36 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/process-function-remotes.js.map +1 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/validate-params.d.ts +34 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/validate-params.js +52 -0
- package/src/federation-dashboard-legacy/utils/convert-to-graph/validate-params.js.map +1 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/FederationDashboardPlugin.d.ts +27 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/FederationDashboardPlugin.js +418 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/FederationDashboardPlugin.js.map +1 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/add-runtime-requirement-to-promise-external.d.ts +4 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/add-runtime-requirement-to-promise-external.js +19 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/add-runtime-requirement-to-promise-external.js.map +1 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/compute-version-strategy.d.ts +4 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/compute-version-strategy.js +22 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/compute-version-strategy.js.map +1 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-plugin-options.d.ts +34 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-plugin-options.js +3 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-plugin-options.js.map +1 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-types.d.ts +23 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-types.js +3 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-types.js.map +1 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/find-package-json.d.ts +1 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/find-package-json.js +23 -0
- package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/find-package-json.js.map +1 -0
- package/src/federation-dashboard-legacy/utils/merge-graphs/merge-graphs.d.ts +20 -0
- package/src/federation-dashboard-legacy/utils/merge-graphs/merge-graphs.js +85 -0
- package/src/federation-dashboard-legacy/utils/merge-graphs/merge-graphs.js.map +1 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +6 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/ze-enable-snapshot-on-edge.d.ts +3 -0
- package/src/lib/actions/ze-enable-snapshot-on-edge.js +41 -0
- package/src/lib/actions/ze-enable-snapshot-on-edge.js.map +1 -0
- package/src/lib/actions/ze-upload-assets.d.ts +3 -0
- package/src/lib/actions/ze-upload-assets.js +73 -0
- package/src/lib/actions/ze-upload-assets.js.map +1 -0
- package/src/lib/actions/ze-upload-build-stats.d.ts +1 -0
- package/src/lib/actions/ze-upload-build-stats.js +31 -0
- package/src/lib/actions/ze-upload-build-stats.js.map +1 -0
- package/src/lib/actions/ze-upload-snapshot.d.ts +3 -0
- package/src/lib/actions/ze-upload-snapshot.js +38 -0
- package/src/lib/actions/ze-upload-snapshot.js.map +1 -0
- package/src/lib/dependency-resolution/resolve-key-version-to-entry.d.ts +0 -0
- package/src/lib/dependency-resolution/resolve-key-version-to-entry.js +11 -0
- package/src/lib/dependency-resolution/resolve-key-version-to-entry.js.map +1 -0
- package/src/lib/payload-builders/ze-build-assets-map.d.ts +3 -0
- package/src/lib/payload-builders/ze-build-assets-map.js +53 -0
- package/src/lib/payload-builders/ze-build-assets-map.js.map +1 -0
- package/src/lib/payload-builders/ze-build-snapshot.d.ts +8 -0
- package/src/lib/payload-builders/ze-build-snapshot.js +38 -0
- package/src/lib/payload-builders/ze-build-snapshot.js.map +1 -0
- package/src/lib/upload/upload-envs.d.ts +5 -0
- package/src/lib/upload/upload-envs.js +24 -0
- package/src/lib/upload/upload-envs.js.map +1 -0
- package/src/lib/upload/upload-file.d.ts +6 -0
- package/src/lib/upload/upload-file.js +31 -0
- package/src/lib/upload/upload-file.js.map +1 -0
- package/src/lib/upload/upload-snapshot.d.ts +5 -0
- package/src/lib/upload/upload-snapshot.js +29 -0
- package/src/lib/upload/upload-snapshot.js.map +1 -0
- package/src/lib/utils/ze-http-request.d.ts +6 -0
- package/src/lib/utils/ze-http-request.js +31 -0
- package/src/lib/utils/ze-http-request.js.map +1 -0
- package/src/lib/utils/ze-log-event.d.ts +17 -0
- package/src/lib/utils/ze-log-event.js +48 -0
- package/src/lib/utils/ze-log-event.js.map +1 -0
- package/src/lib/utils/ze-util-find-app-name.d.ts +7 -0
- package/src/lib/utils/ze-util-find-app-name.js +35 -0
- package/src/lib/utils/ze-util-find-app-name.js.map +1 -0
- package/src/lib/utils/ze-util-get-git-info.d.ts +13 -0
- package/src/lib/utils/ze-util-get-git-info.js +53 -0
- package/src/lib/utils/ze-util-get-git-info.js.map +1 -0
- package/src/lib/with-zephyr.d.ts +3 -0
- package/src/lib/with-zephyr.js +90 -0
- package/src/lib/with-zephyr.js.map +1 -0
- package/src/lib/ze-setup-build-id.d.ts +4 -0
- package/src/lib/ze-setup-build-id.js +62 -0
- package/src/lib/ze-setup-build-id.js.map +1 -0
- package/src/lib/ze-setup-build-steps-logging.d.ts +5 -0
- package/src/lib/ze-setup-build-steps-logging.js +42 -0
- package/src/lib/ze-setup-build-steps-logging.js.map +1 -0
- package/src/lib/ze-setup-ze-deploy.d.ts +3 -0
- package/src/lib/ze-setup-ze-deploy.js +67 -0
- package/src/lib/ze-setup-ze-deploy.js.map +1 -0
- package/src/lib/ze-webpack-plugin.d.ts +33 -0
- package/src/lib/ze-webpack-plugin.js +73 -0
- package/src/lib/ze-webpack-plugin.js.map +1 -0
- package/src/types/ze-webpack-plugin-options.d.ts +32 -0
- package/src/types/ze-webpack-plugin-options.js +3 -0
- package/src/types/ze-webpack-plugin-options.js.map +1 -0
- package/src/types/zephyr-plugin-options.d.ts +7 -0
- package/src/types/zephyr-plugin-options.js +3 -0
- package/src/types/zephyr-plugin-options.js.map +1 -0
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FederationDashboardPlugin = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const parser_1 = require("@babel/parser");
|
|
7
|
+
const types_1 = require("@babel/types");
|
|
8
|
+
const traverse_1 = require("@babel/traverse");
|
|
9
|
+
const generator_1 = require("@babel/generator");
|
|
10
|
+
const convert_to_graph_1 = require("../convert-to-graph/convert-to-graph");
|
|
11
|
+
const find_package_json_1 = require("./find-package-json");
|
|
12
|
+
const compute_version_strategy_1 = require("./compute-version-strategy");
|
|
13
|
+
const add_runtime_requirement_to_promise_external_1 = require("./add-runtime-requirement-to-promise-external");
|
|
14
|
+
const zephyr_edge_contract_1 = require("zephyr-edge-contract");
|
|
15
|
+
// convert this require to imports
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
17
|
+
const AutomaticVendorFederation = require('@module-federation/automatic-vendor-federation');
|
|
18
|
+
class FederationDashboardPlugin {
|
|
19
|
+
// { filename: string; reportFunction: () => void }
|
|
20
|
+
constructor(options) {
|
|
21
|
+
this.allArgumentsUsed = [];
|
|
22
|
+
this.FederationPluginOptions = {};
|
|
23
|
+
this._options = Object.assign({
|
|
24
|
+
debug: false,
|
|
25
|
+
// filename: 'dashboard.json',
|
|
26
|
+
useAST: false,
|
|
27
|
+
fetchClient: undefined,
|
|
28
|
+
}, options);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @param {Compiler} compiler
|
|
32
|
+
*/
|
|
33
|
+
apply(compiler) {
|
|
34
|
+
// todo: use buildid version (user_build_count)
|
|
35
|
+
compiler.options.output.uniqueName = `v${Date.now()}`;
|
|
36
|
+
new add_runtime_requirement_to_promise_external_1.AddRuntimeRequirementToPromiseExternal().apply(compiler);
|
|
37
|
+
const FederationPlugin = compiler.options.plugins.find((plugin) => plugin?.constructor.name === 'ModuleFederationPlugin');
|
|
38
|
+
// todo: valorkin fixes
|
|
39
|
+
this._options.standalone = typeof FederationPlugin === 'undefined';
|
|
40
|
+
if (FederationPlugin) {
|
|
41
|
+
this.FederationPluginOptions = Object.assign({}, FederationPlugin._options, this._options.standalone || {});
|
|
42
|
+
}
|
|
43
|
+
else if (this._options.standalone) {
|
|
44
|
+
this.FederationPluginOptions = {};
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
throw new Error('Dashboard plugin is missing Module Federation or standalone option');
|
|
48
|
+
}
|
|
49
|
+
// if (this.FederationPluginOptions) {
|
|
50
|
+
// this.FederationPluginOptions.name =
|
|
51
|
+
// this.FederationPluginOptions?.name?.replace('__REMOTE_VERSION__', '');
|
|
52
|
+
// compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
53
|
+
// compilation.hooks.processAssets.tapPromise(
|
|
54
|
+
// {
|
|
55
|
+
// name: PLUGIN_NAME,
|
|
56
|
+
// stage: Compilation.PROCESS_ASSETS_STAGE_REPORT
|
|
57
|
+
// },
|
|
58
|
+
// () => this.processWebpackGraph(compilation)
|
|
59
|
+
// );
|
|
60
|
+
// });
|
|
61
|
+
// }
|
|
62
|
+
// todo: valorkin find usage of this env variables
|
|
63
|
+
// if (this.FederationPluginOptions?.name) {
|
|
64
|
+
// new DefinePlugin({
|
|
65
|
+
// 'process.dashboardURL': JSON.stringify(this._options.dashboardURL),
|
|
66
|
+
// 'process.CURRENT_HOST': JSON.stringify(
|
|
67
|
+
// this.FederationPluginOptions.name
|
|
68
|
+
// )
|
|
69
|
+
// }).apply(compiler);
|
|
70
|
+
// }
|
|
71
|
+
}
|
|
72
|
+
parseModuleAst(compilation, callback) {
|
|
73
|
+
const filePaths = [];
|
|
74
|
+
const allArgumentsUsed = [];
|
|
75
|
+
// Explore each chunk (build output):
|
|
76
|
+
compilation.chunks.forEach((chunk) => {
|
|
77
|
+
// Explore each module within the chunk (built inputs):
|
|
78
|
+
chunk.getModules().forEach((module) => {
|
|
79
|
+
// Loop through all the dependencies that has the named export that we are looking for
|
|
80
|
+
const matchedNamedExports = module.dependencies.filter((dep) => dep.name === 'federateComponent');
|
|
81
|
+
if (matchedNamedExports.length > 0 && module.resource) {
|
|
82
|
+
filePaths.push({
|
|
83
|
+
resource: module.resource,
|
|
84
|
+
file: module.resourceResolveData?.relativePath,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
filePaths.forEach(({ resource, file }) => {
|
|
89
|
+
const sourceCode = (0, node_fs_1.readFileSync)(resource).toString('utf-8');
|
|
90
|
+
const ast = (0, parser_1.parse)(sourceCode, {
|
|
91
|
+
sourceType: 'unambiguous',
|
|
92
|
+
plugins: ['jsx', 'typescript'],
|
|
93
|
+
});
|
|
94
|
+
// traverse the abstract syntax tree
|
|
95
|
+
(0, traverse_1.default)(ast, {
|
|
96
|
+
/**
|
|
97
|
+
* We want to run a function depending on a found nodeType
|
|
98
|
+
* More node types are documented here: https://babeljs.io/docs/en/babel-types#api
|
|
99
|
+
*/
|
|
100
|
+
CallExpression: (path) => {
|
|
101
|
+
const { node } = path;
|
|
102
|
+
const { callee, arguments: args } = node;
|
|
103
|
+
if (callee?.loc?.identifierName === 'federateComponent') {
|
|
104
|
+
const argsAreStrings = args.every((arg) => arg.type === 'StringLiteral');
|
|
105
|
+
if (!argsAreStrings) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const argsValue = [file];
|
|
109
|
+
// we collect the JS representation of each argument used in this function call
|
|
110
|
+
for (let i = 0; i < args.length; i++) {
|
|
111
|
+
const a = args[i];
|
|
112
|
+
let { code } = (0, generator_1.default)(a);
|
|
113
|
+
if (code.startsWith('{')) {
|
|
114
|
+
// wrap it in parentheses, so when it's eval-ed, it is eval-ed correctly into an JS object
|
|
115
|
+
code = `(${code})`;
|
|
116
|
+
}
|
|
117
|
+
const value = eval(code);
|
|
118
|
+
// If the value is a Node, that means it was a variable name
|
|
119
|
+
// There is no easy way to resolve the variable real value, so we just skip any function calls
|
|
120
|
+
// that has variable as its args
|
|
121
|
+
if ((0, types_1.isNode)(value)) {
|
|
122
|
+
// by breaking out of the loop here,
|
|
123
|
+
// we also prevent this args to be pushed to `allArgumentsUsed`
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
argsValue.push(value);
|
|
128
|
+
}
|
|
129
|
+
if (i === args.length - 1) {
|
|
130
|
+
// push to the top level array
|
|
131
|
+
allArgumentsUsed.push(argsValue.filter(Boolean));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
const uniqueArgs = allArgumentsUsed.reduce((acc, current) => {
|
|
140
|
+
const id = current.join('|');
|
|
141
|
+
acc[id] = current;
|
|
142
|
+
return acc;
|
|
143
|
+
}, {});
|
|
144
|
+
this.allArgumentsUsed = Object.values(uniqueArgs);
|
|
145
|
+
if (callback)
|
|
146
|
+
callback();
|
|
147
|
+
}
|
|
148
|
+
async processWebpackGraph(curCompiler) {
|
|
149
|
+
const liveStats = curCompiler.getStats();
|
|
150
|
+
const stats = liveStats.toJson();
|
|
151
|
+
if (this._options.useAST) {
|
|
152
|
+
this.parseModuleAst(curCompiler);
|
|
153
|
+
}
|
|
154
|
+
// fs.writeFileSync('stats.json', JSON.stringify(stats, null, 2))
|
|
155
|
+
// get RemoteEntryChunk
|
|
156
|
+
const RemoteEntryChunk = this.getRemoteEntryChunk(stats, this.FederationPluginOptions);
|
|
157
|
+
const validChunkArray = this.buildValidChunkArray(liveStats, this.FederationPluginOptions);
|
|
158
|
+
const chunkDependencies = this.getChunkDependencies(validChunkArray);
|
|
159
|
+
const vendorFederation = this.buildVendorFederationMap(liveStats);
|
|
160
|
+
const rawData = {
|
|
161
|
+
name: this.FederationPluginOptions?.name,
|
|
162
|
+
remotes: Object.keys(this.FederationPluginOptions?.remotes || {}),
|
|
163
|
+
metadata: this._options.metadata || {},
|
|
164
|
+
topLevelPackage: vendorFederation || {},
|
|
165
|
+
publicPath: stats.publicPath,
|
|
166
|
+
federationRemoteEntry: RemoteEntryChunk,
|
|
167
|
+
buildHash: stats.hash,
|
|
168
|
+
environment: this._options.environment, // 'development' if not specified
|
|
169
|
+
version: (0, compute_version_strategy_1.computeVersionStrategy)(stats, this._options.versionStrategy),
|
|
170
|
+
posted: this._options.posted, // Date.now() if not specified
|
|
171
|
+
group: this._options.group, // 'default' if not specified
|
|
172
|
+
sha: compute_version_strategy_1.gitSha,
|
|
173
|
+
modules: stats.modules,
|
|
174
|
+
chunkDependencies,
|
|
175
|
+
functionRemotes: this.allArgumentsUsed,
|
|
176
|
+
};
|
|
177
|
+
let graphData;
|
|
178
|
+
try {
|
|
179
|
+
graphData = (0, convert_to_graph_1.convertToGraph)(rawData, !!this._options.standalone);
|
|
180
|
+
}
|
|
181
|
+
catch (err) {
|
|
182
|
+
console.warn('Error during dashboard data processing');
|
|
183
|
+
console.warn(err);
|
|
184
|
+
}
|
|
185
|
+
// todo: ze_webpack plugin
|
|
186
|
+
const ze_webpack_plugin = curCompiler.options.plugins.find((plugin) => plugin?.constructor.name === 'ZeWebpackPlugin');
|
|
187
|
+
const version = (0, zephyr_edge_contract_1.createSnapshotId)(ze_webpack_plugin._options);
|
|
188
|
+
// todo: override data from convert graph
|
|
189
|
+
const data_overrides = {
|
|
190
|
+
id: (0, zephyr_edge_contract_1.createFullAppName)(this._options.app),
|
|
191
|
+
version: version,
|
|
192
|
+
app: this._options.app,
|
|
193
|
+
git: this._options.git,
|
|
194
|
+
remotes: rawData.remotes,
|
|
195
|
+
context: {
|
|
196
|
+
isCI: this._options.context.isCI,
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
// todo: extend data
|
|
200
|
+
Object.assign(graphData, data_overrides);
|
|
201
|
+
if (!graphData) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
// const dashData = (this._dashData = JSON.stringify(graphData));
|
|
205
|
+
return this.postDashboardData(graphData).catch((err) => {
|
|
206
|
+
if (err) {
|
|
207
|
+
curCompiler.errors.push(err);
|
|
208
|
+
throw err;
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
// todo: this was generating dashboard plugin, not sure we need it anymore
|
|
212
|
+
/*return Promise.resolve().then(() => {
|
|
213
|
+
const statsBuf = Buffer.from(dashData || '{}', 'utf-8');
|
|
214
|
+
|
|
215
|
+
const source: Source = {
|
|
216
|
+
source() {
|
|
217
|
+
return statsBuf;
|
|
218
|
+
},
|
|
219
|
+
size() {
|
|
220
|
+
return statsBuf.length;
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
// for dashboard.json
|
|
224
|
+
if (curCompiler.emitAsset && this._options.filename) {
|
|
225
|
+
const asset = curCompiler.getAsset(this._options.filename);
|
|
226
|
+
if (asset) {
|
|
227
|
+
curCompiler.updateAsset(this._options.filename, source as never);
|
|
228
|
+
} else {
|
|
229
|
+
curCompiler.emitAsset(this._options.filename, source as never);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// for versioned remote
|
|
233
|
+
if (
|
|
234
|
+
curCompiler.emitAsset &&
|
|
235
|
+
this.FederationPluginOptions.filename &&
|
|
236
|
+
Object.keys(this.FederationPluginOptions.exposes || {}).length !== 0
|
|
237
|
+
) {
|
|
238
|
+
const remoteEntry = curCompiler
|
|
239
|
+
.getAsset(this.FederationPluginOptions.filename) as Asset & { source: { _value?: string } };
|
|
240
|
+
const cleanVersion =
|
|
241
|
+
typeof rawData.version === 'string'
|
|
242
|
+
? `_${rawData.version.split('.').join('_')}`
|
|
243
|
+
: `_${rawData.version}`;
|
|
244
|
+
|
|
245
|
+
let codeSource;
|
|
246
|
+
if (
|
|
247
|
+
remoteEntry &&
|
|
248
|
+
!remoteEntry.source._value &&
|
|
249
|
+
remoteEntry.source.source
|
|
250
|
+
) {
|
|
251
|
+
codeSource = remoteEntry.source.source();
|
|
252
|
+
} else if (remoteEntry.source._value) {
|
|
253
|
+
codeSource = remoteEntry.source._value;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (!codeSource) {
|
|
257
|
+
return callback && callback();
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
//string replace "dsl" with version_dsl to make another global.
|
|
261
|
+
const newSource = codeSource
|
|
262
|
+
.toString()
|
|
263
|
+
.replace(new RegExp(`__REMOTE_VERSION__`, 'g'), cleanVersion);
|
|
264
|
+
|
|
265
|
+
const rewriteTempalteFromMain = codeSource
|
|
266
|
+
.toString()
|
|
267
|
+
.replace(new RegExp(`__REMOTE_VERSION__`, 'g'), '');
|
|
268
|
+
|
|
269
|
+
const remoteEntryBuffer = Buffer.from(newSource, 'utf-8');
|
|
270
|
+
const originalRemoteEntryBuffer = Buffer.from(
|
|
271
|
+
rewriteTempalteFromMain,
|
|
272
|
+
'utf-8'
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
const remoteEntrySource = new RawSource(remoteEntryBuffer);
|
|
276
|
+
|
|
277
|
+
const originalRemoteEntrySource = new RawSource(
|
|
278
|
+
originalRemoteEntryBuffer
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
if (remoteEntry && graphData?.version) {
|
|
282
|
+
curCompiler.updateAsset(
|
|
283
|
+
this.FederationPluginOptions.filename,
|
|
284
|
+
originalRemoteEntrySource
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
curCompiler.emitAsset(
|
|
288
|
+
[graphData.version, this.FederationPluginOptions.filename].join(
|
|
289
|
+
'.'
|
|
290
|
+
),
|
|
291
|
+
remoteEntrySource
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (callback) {
|
|
296
|
+
return void callback();
|
|
297
|
+
}
|
|
298
|
+
});*/
|
|
299
|
+
}
|
|
300
|
+
getRemoteEntryChunk(stats, FederationPluginOptions) {
|
|
301
|
+
if (!stats.chunks)
|
|
302
|
+
return;
|
|
303
|
+
return stats.chunks.find((chunk) => chunk.names?.find((name) => name === FederationPluginOptions.name));
|
|
304
|
+
}
|
|
305
|
+
getChunkDependencies(validChunkArray) {
|
|
306
|
+
return validChunkArray.reduce((acc, chunk) => {
|
|
307
|
+
const subset = chunk.getAllReferencedChunks();
|
|
308
|
+
const stringifiableChunk = Array.from(subset).map((sub) => {
|
|
309
|
+
const cleanSet = Object.getOwnPropertyNames(sub).reduce((acc, key) => {
|
|
310
|
+
if (key === '_groups')
|
|
311
|
+
return acc;
|
|
312
|
+
return Object.assign(acc, { [key]: sub[key] });
|
|
313
|
+
}, {});
|
|
314
|
+
return this.mapToObjectRec(cleanSet);
|
|
315
|
+
});
|
|
316
|
+
return Object.assign(acc, {
|
|
317
|
+
[`${chunk.id}`]: stringifiableChunk,
|
|
318
|
+
});
|
|
319
|
+
}, {});
|
|
320
|
+
}
|
|
321
|
+
buildVendorFederationMap(liveStats) {
|
|
322
|
+
const vendorFederation = {};
|
|
323
|
+
let packageJson;
|
|
324
|
+
if (this._options.packageJsonPath) {
|
|
325
|
+
// todo: wrap this is in try/catch
|
|
326
|
+
packageJson = require(this._options.packageJsonPath);
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
const initialPath = liveStats.compilation.options.context?.split(node_path_1.sep);
|
|
330
|
+
packageJson = (0, find_package_json_1.findPackageJson)(initialPath);
|
|
331
|
+
}
|
|
332
|
+
if (packageJson) {
|
|
333
|
+
vendorFederation.dependencies = AutomaticVendorFederation({
|
|
334
|
+
exclude: [],
|
|
335
|
+
ignoreVersion: false,
|
|
336
|
+
packageJson,
|
|
337
|
+
// subPackages: this.directReasons(modules),
|
|
338
|
+
shareFrom: ['dependencies'],
|
|
339
|
+
ignorePatchversion: false,
|
|
340
|
+
});
|
|
341
|
+
vendorFederation.devDependencies = AutomaticVendorFederation({
|
|
342
|
+
exclude: [],
|
|
343
|
+
ignoreVersion: false,
|
|
344
|
+
packageJson,
|
|
345
|
+
// subPackages: this.directReasons(modules),
|
|
346
|
+
shareFrom: ['devDependencies'],
|
|
347
|
+
ignorePatchversion: false,
|
|
348
|
+
});
|
|
349
|
+
vendorFederation.optionalDependencies = AutomaticVendorFederation({
|
|
350
|
+
exclude: [],
|
|
351
|
+
ignoreVersion: false,
|
|
352
|
+
packageJson,
|
|
353
|
+
// subPackages: this.directReasons(modules),
|
|
354
|
+
shareFrom: ['optionalDependencies'],
|
|
355
|
+
ignorePatchversion: false,
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
return vendorFederation;
|
|
359
|
+
}
|
|
360
|
+
mapToObjectRec(m) {
|
|
361
|
+
const lo = {};
|
|
362
|
+
for (const [key, value] of Object.entries(m)) {
|
|
363
|
+
if (value instanceof Map && value.size > 0) {
|
|
364
|
+
lo[key] = this.mapToObjectRec(value);
|
|
365
|
+
}
|
|
366
|
+
else if (value instanceof Set && value.size > 0) {
|
|
367
|
+
lo[key] = this.mapToObjectRec(Array.from(value));
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
lo[key] = value;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return lo;
|
|
374
|
+
}
|
|
375
|
+
buildValidChunkArray(liveStats, FederationPluginOptions) {
|
|
376
|
+
if (!FederationPluginOptions.name)
|
|
377
|
+
return [];
|
|
378
|
+
const namedChunkRefs = liveStats.compilation.namedChunks.get(FederationPluginOptions.name);
|
|
379
|
+
if (!namedChunkRefs)
|
|
380
|
+
return [];
|
|
381
|
+
const AllReferencedChunksByRemote = namedChunkRefs.getAllReferencedChunks();
|
|
382
|
+
const validChunkArray = [];
|
|
383
|
+
AllReferencedChunksByRemote.forEach((chunk) => {
|
|
384
|
+
if (chunk.id !== FederationPluginOptions.name) {
|
|
385
|
+
validChunkArray.push(chunk);
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
return validChunkArray;
|
|
389
|
+
}
|
|
390
|
+
/*directReasons(modules) {
|
|
391
|
+
const directReasons = new Set();
|
|
392
|
+
|
|
393
|
+
modules.forEach((module) => {
|
|
394
|
+
if (module.reasons) {
|
|
395
|
+
module.reasons.forEach((reason) => {
|
|
396
|
+
if (reason.userRequest) {
|
|
397
|
+
try {
|
|
398
|
+
// grab user required package.json
|
|
399
|
+
const subsetPackage = require(reason.userRequest +
|
|
400
|
+
'/package.json');
|
|
401
|
+
|
|
402
|
+
directReasons.add(subsetPackage);
|
|
403
|
+
} catch (e) {
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
return Array.from(directReasons);
|
|
411
|
+
}*/
|
|
412
|
+
async postDashboardData(dashData) {
|
|
413
|
+
console.log(dashData);
|
|
414
|
+
throw new Error('not implemented, override it');
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
exports.FederationDashboardPlugin = FederationDashboardPlugin;
|
|
418
|
+
//# sourceMappingURL=FederationDashboardPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FederationDashboardPlugin.js","sourceRoot":"","sources":["../../../../../../../packages/zephyr-webpack-plugin/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/FederationDashboardPlugin.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,yCAAgC;AAEhC,0CAAsC;AACtC,wCAAsC;AACtC,8CAAuC;AACvC,gDAAwC;AAaxC,2EAI8C;AAG9C,2DAAsD;AACtD,yEAA4E;AAE5E,+GAAuG;AAEvG,+DAA2E;AAE3E,kCAAkC;AAElC,8DAA8D;AAC9D,MAAM,yBAAyB,GAAG,OAAO,CAAC,gDAAgD,CAAC,CAAC;AAS5F,MAAa,yBAAyB;IAYpC,mDAAmD;IACnD,YAAY,OAAkD;QAV9D,qBAAgB,GAA0D,EAAE,CAAC;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EAAE,CAAC;gBAClD,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YACnD,CAAC;iBAAM,CAAC;gBACN,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YAClB,CAAC;QACH,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,oBAAoB,CAClB,SAAgB,EAChB,uBAA4D;QAE5D,IAAI,CAAC,uBAAuB,CAAC,IAAI;YAAE,OAAO,EAAE,CAAC;QAE7C,MAAM,cAAc,GAAG,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAC1D,uBAAuB,CAAC,IAAI,CAC7B,CAAC;QAEF,IAAI,CAAC,cAAc;YAAE,OAAO,EAAE,CAAC;QAC/B,MAAM,2BAA2B,GAAG,cAAc,CAAC,sBAAsB,EAAE,CAAC;QAE5E,MAAM,eAAe,GAAY,EAAE,CAAC;QACpC,2BAA2B,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC5C,IAAI,KAAK,CAAC,EAAE,KAAK,uBAAuB,CAAC,IAAI,EAAE,CAAC;gBAC9C,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,eAAe,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IAEH,KAAK,CAAC,iBAAiB,CAAC,QAAiB;QACvC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;CACF;AArfD,8DAqfC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddRuntimeRequirementToPromiseExternal = void 0;
|
|
4
|
+
class AddRuntimeRequirementToPromiseExternal {
|
|
5
|
+
apply(compiler) {
|
|
6
|
+
compiler.hooks.compilation.tap('AddRuntimeRequirementToPromiseExternal', (compilation) => {
|
|
7
|
+
const { RuntimeGlobals } = compiler.webpack;
|
|
8
|
+
if (compilation.outputOptions.trustedTypes) {
|
|
9
|
+
compilation.hooks.additionalModuleRuntimeRequirements.tap('AddRuntimeRequirementToPromiseExternal', (module, set) => {
|
|
10
|
+
if (module.externalType === 'promise') {
|
|
11
|
+
set.add(RuntimeGlobals.loadScript);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.AddRuntimeRequirementToPromiseExternal = AddRuntimeRequirementToPromiseExternal;
|
|
19
|
+
//# sourceMappingURL=add-runtime-requirement-to-promise-external.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-runtime-requirement-to-promise-external.js","sourceRoot":"","sources":["../../../../../../../packages/zephyr-webpack-plugin/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/add-runtime-requirement-to-promise-external.ts"],"names":[],"mappings":";;;AAEA,MAAa,sCAAsC;IACjD,KAAK,CAAC,QAAkB;QACtB,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAC5B,wCAAwC,EACxC,CAAC,WAAwB,EAAE,EAAE;YAC3B,MAAM,EAAE,cAAc,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC;YAC5C,IAAI,WAAW,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC;gBAC3C,WAAW,CAAC,KAAK,CAAC,mCAAmC,CAAC,GAAG,CACvD,wCAAwC,EACxC,CAAC,MAA0C,EAAE,GAAG,EAAE,EAAE;oBAClD,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;wBACtC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;oBACrC,CAAC;gBACH,CAAC,CACF,CAAC;YACJ,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAnBD,wFAmBC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeVersionStrategy = exports.gitSha = void 0;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
try {
|
|
6
|
+
exports.gitSha = (0, node_child_process_1.execSync)('git rev-parse HEAD').toString().trim();
|
|
7
|
+
}
|
|
8
|
+
catch (e) {
|
|
9
|
+
console.error(e);
|
|
10
|
+
}
|
|
11
|
+
const computeVersionStrategy = (stats, arg) => {
|
|
12
|
+
switch (arg) {
|
|
13
|
+
case 'gitSha':
|
|
14
|
+
return exports.gitSha;
|
|
15
|
+
case 'buildHash':
|
|
16
|
+
return stats.hash;
|
|
17
|
+
default:
|
|
18
|
+
return arg ? arg.toString() : exports.gitSha;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.computeVersionStrategy = computeVersionStrategy;
|
|
22
|
+
//# sourceMappingURL=compute-version-strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-version-strategy.js","sourceRoot":"","sources":["../../../../../../../packages/zephyr-webpack-plugin/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/compute-version-strategy.ts"],"names":[],"mappings":";;;AAAA,2DAA8C;AAG9C,IAAI,CAAC;IACH,cAAM,GAAG,IAAA,6BAAQ,EAAC,oBAAoB,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC;AAAC,OAAO,CAAC,EAAE,CAAC;IACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC;AAEM,MAAM,sBAAsB,GAAG,CACpC,KAAwB,EACxB,GAAuB,EACH,EAAE;IACtB,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,QAAQ;YACX,OAAO,cAAM,CAAC;QAChB,KAAK,WAAW;YACd,OAAO,KAAK,CAAC,IAAI,CAAC;QACpB;YACE,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,cAAM,CAAC;IACzC,CAAC;AACH,CAAC,CAAC;AAZW,QAAA,sBAAsB,0BAYjC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ZeWebpackPluginOptions } from '../../../types/ze-webpack-plugin-options';
|
|
2
|
+
export interface FederationDashboardPluginOptions {
|
|
3
|
+
zeOptions: ZeWebpackPluginOptions;
|
|
4
|
+
app?: {
|
|
5
|
+
org: string;
|
|
6
|
+
project: string;
|
|
7
|
+
name: string;
|
|
8
|
+
version: string;
|
|
9
|
+
};
|
|
10
|
+
git?: {
|
|
11
|
+
name: string;
|
|
12
|
+
email: string;
|
|
13
|
+
branch: string;
|
|
14
|
+
commit: string;
|
|
15
|
+
};
|
|
16
|
+
context: {
|
|
17
|
+
isCI: boolean;
|
|
18
|
+
};
|
|
19
|
+
debug: boolean;
|
|
20
|
+
filename: string;
|
|
21
|
+
useAST: boolean;
|
|
22
|
+
fetchClient?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
23
|
+
standalone?: boolean;
|
|
24
|
+
dashboardURL?: string;
|
|
25
|
+
metadata?: Record<string, string | {
|
|
26
|
+
url: string;
|
|
27
|
+
}>;
|
|
28
|
+
environment?: string;
|
|
29
|
+
versionStrategy?: string;
|
|
30
|
+
posted?: Date;
|
|
31
|
+
group?: string;
|
|
32
|
+
nextjs?: string;
|
|
33
|
+
packageJsonPath?: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"federation-dashboard-plugin-options.js","sourceRoot":"","sources":["../../../../../../../packages/zephyr-webpack-plugin/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-plugin-options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export interface Source {
|
|
3
|
+
source: () => Buffer;
|
|
4
|
+
size: () => number;
|
|
5
|
+
}
|
|
6
|
+
export type Exposes = (string | ExposesObject)[] | ExposesObject;
|
|
7
|
+
interface ExposesObject {
|
|
8
|
+
[index: string]: string | ExposesConfig | string[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Advanced configuration for modules that should be exposed by this container.
|
|
12
|
+
*/
|
|
13
|
+
interface ExposesConfig {
|
|
14
|
+
/**
|
|
15
|
+
* Request to a module that should be exposed by this container.
|
|
16
|
+
*/
|
|
17
|
+
import: string | string[];
|
|
18
|
+
/**
|
|
19
|
+
* Custom chunk name for the exposed module.
|
|
20
|
+
*/
|
|
21
|
+
name?: string;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"federation-dashboard-types.js","sourceRoot":"","sources":["../../../../../../../packages/zephyr-webpack-plugin/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/federation-dashboard-types.ts"],"names":[],"mappings":""}
|
package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/find-package-json.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const findPackageJson: (filePath: string[] | undefined) => undefined | unknown;
|
package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/find-package-json.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findPackageJson = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const findPackageJson = (filePath) => {
|
|
7
|
+
if (!filePath || filePath.length === 0) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if ((0, node_fs_1.existsSync)((0, node_path_1.join)(filePath.join(node_path_1.sep), 'package.json'))) {
|
|
11
|
+
try {
|
|
12
|
+
const file = (0, node_fs_1.readFileSync)((0, node_path_1.join)(filePath.join(node_path_1.sep), 'package.json'), 'utf-8');
|
|
13
|
+
return JSON.parse(file);
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
console.error(e);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
filePath.pop();
|
|
20
|
+
return (0, exports.findPackageJson)(filePath);
|
|
21
|
+
};
|
|
22
|
+
exports.findPackageJson = findPackageJson;
|
|
23
|
+
//# sourceMappingURL=find-package-json.js.map
|
package/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/find-package-json.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-package-json.js","sourceRoot":"","sources":["../../../../../../../packages/zephyr-webpack-plugin/src/federation-dashboard-legacy/utils/federation-dashboard-plugin/find-package-json.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AACnD,yCAAsC;AAE/B,MAAM,eAAe,GAAG,CAC7B,QAA8B,EACT,EAAE;IACvB,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvC,OAAO;IACT,CAAC;IACD,IAAI,IAAA,oBAAU,EAAC,IAAA,gBAAI,EAAC,QAAQ,CAAC,IAAI,CAAC,eAAG,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QACzD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAA,sBAAY,EACvB,IAAA,gBAAI,EAAC,QAAQ,CAAC,IAAI,CAAC,eAAG,CAAC,EAAE,cAAc,CAAC,EACxC,OAAO,CACR,CAAC;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IACD,QAAQ,CAAC,GAAG,EAAE,CAAC;IACf,OAAO,IAAA,uBAAe,EAAC,QAAQ,CAAC,CAAC;AACnC,CAAC,CAAC;AAnBW,QAAA,eAAe,mBAmB1B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ConvertedDependencies } from '../convert-to-graph/convert-dependencies';
|
|
2
|
+
import { ModuleObject, Overrides } from '../convert-to-graph/module-part-two';
|
|
3
|
+
type Graph = ConvertedDependencies & {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
remote: string;
|
|
7
|
+
modules: ModuleObject[];
|
|
8
|
+
overrides: Overrides[];
|
|
9
|
+
consumes: {
|
|
10
|
+
consumingApplicationID: string;
|
|
11
|
+
applicationID: string | null;
|
|
12
|
+
name: string;
|
|
13
|
+
usedIn: {
|
|
14
|
+
file: string;
|
|
15
|
+
url: string;
|
|
16
|
+
}[];
|
|
17
|
+
}[];
|
|
18
|
+
};
|
|
19
|
+
export declare function mergeGraphs(graph1: Graph, graph2: Graph): Graph;
|
|
20
|
+
export {};
|