@nx/module-federation 24.0.0-beta.2 → 24.0.0-beta.3
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 +1 -3
- package/dist/angular.d.ts +1 -5
- package/dist/angular.js +7 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +0 -2
- package/dist/rspack.d.ts +1 -5
- package/dist/rspack.js +7 -6
- package/dist/src/migrations/update-24-0-0/inventory.d.ts +11 -0
- package/dist/src/migrations/update-24-0-0/inventory.js +139 -0
- package/dist/src/migrations/update-24-0-0/migrate-angular-module-federation.d.ts +5 -0
- package/dist/src/migrations/update-24-0-0/migrate-angular-module-federation.js +18 -0
- package/dist/src/migrations/update-24-0-0/migrate-module-federation.d.ts +10 -0
- package/dist/src/migrations/update-24-0-0/migrate-module-federation.js +26 -0
- package/dist/src/migrations/update-24-0-0/migrate-module-federation.md +1931 -0
- package/dist/src/migrations/update-24-0-0/migrate-react-module-federation.d.ts +5 -0
- package/dist/src/migrations/update-24-0-0/migrate-react-module-federation.js +18 -0
- package/dist/src/stubs/models.d.ts +26 -0
- package/dist/src/stubs/stubs.d.ts +19 -0
- package/dist/src/stubs/stubs.js +43 -0
- package/dist/webpack.d.ts +1 -2
- package/dist/webpack.js +4 -3
- package/migrations.json +6 -0
- package/package.json +5 -60
- package/readme-template.md +1 -3
- package/dist/internal.d.ts +0 -2
- package/dist/internal.js +0 -13
- package/dist/src/executors/utils/build-static-remotes.d.ts +0 -4
- package/dist/src/executors/utils/build-static-remotes.js +0 -67
- package/dist/src/executors/utils/index.d.ts +0 -4
- package/dist/src/executors/utils/index.js +0 -6
- package/dist/src/executors/utils/models.d.ts +0 -30
- package/dist/src/executors/utils/start-remote-iterators.d.ts +0 -25
- package/dist/src/executors/utils/start-remote-iterators.js +0 -52
- package/dist/src/executors/utils/start-static-remotes-file-server.d.ts +0 -15
- package/dist/src/executors/utils/start-static-remotes-file-server.js +0 -61
- package/dist/src/plugins/models/index.d.ts +0 -14
- package/dist/src/plugins/models/index.js +0 -2
- package/dist/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-dev-server-plugin.d.ts +0 -13
- package/dist/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-dev-server-plugin.js +0 -75
- package/dist/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-plugin.d.ts +0 -11
- package/dist/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-plugin.js +0 -93
- package/dist/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-ssr-dev-server-plugin.d.ts +0 -15
- package/dist/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-ssr-dev-server-plugin.js +0 -107
- package/dist/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-dev-server-plugin.d.ts +0 -13
- package/dist/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-dev-server-plugin.js +0 -75
- package/dist/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-plugin.d.ts +0 -11
- package/dist/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-plugin.js +0 -80
- package/dist/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-ssr-dev-server-plugin.d.ts +0 -15
- package/dist/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-ssr-dev-server-plugin.js +0 -107
- package/dist/src/plugins/utils/build-static-remotes.d.ts +0 -3
- package/dist/src/plugins/utils/build-static-remotes.js +0 -65
- package/dist/src/plugins/utils/get-dynamic-manifest-file.d.ts +0 -2
- package/dist/src/plugins/utils/get-dynamic-manifest-file.js +0 -18
- package/dist/src/plugins/utils/get-remotes.d.ts +0 -7
- package/dist/src/plugins/utils/get-remotes.js +0 -68
- package/dist/src/plugins/utils/get-static-remotes.d.ts +0 -3
- package/dist/src/plugins/utils/get-static-remotes.js +0 -27
- package/dist/src/plugins/utils/index.d.ts +0 -7
- package/dist/src/plugins/utils/index.js +0 -10
- package/dist/src/plugins/utils/parse-remotes-config.d.ts +0 -6
- package/dist/src/plugins/utils/parse-remotes-config.js +0 -35
- package/dist/src/plugins/utils/start-remote-proxies.d.ts +0 -5
- package/dist/src/plugins/utils/start-remote-proxies.js +0 -65
- package/dist/src/plugins/utils/start-static-remotes-file-server.d.ts +0 -2
- package/dist/src/plugins/utils/start-static-remotes-file-server.js +0 -46
- package/dist/src/utils/dependencies.d.ts +0 -6
- package/dist/src/utils/dependencies.js +0 -70
- package/dist/src/utils/framework-detection.d.ts +0 -2
- package/dist/src/utils/framework-detection.js +0 -20
- package/dist/src/utils/get-remotes-for-host.d.ts +0 -17
- package/dist/src/utils/get-remotes-for-host.js +0 -154
- package/dist/src/utils/index.d.ts +0 -11
- package/dist/src/utils/index.js +0 -14
- package/dist/src/utils/is-serve-mode.d.ts +0 -2
- package/dist/src/utils/is-serve-mode.js +0 -19
- package/dist/src/utils/models/index.d.ts +0 -47
- package/dist/src/utils/models/index.js +0 -2
- package/dist/src/utils/module-federation-config.d.ts +0 -57
- package/dist/src/utils/module-federation-config.js +0 -144
- package/dist/src/utils/normalize-project-name.d.ts +0 -1
- package/dist/src/utils/normalize-project-name.js +0 -10
- package/dist/src/utils/package-json.d.ts +0 -2
- package/dist/src/utils/package-json.js +0 -12
- package/dist/src/utils/parse-static-remotes-config.d.ts +0 -13
- package/dist/src/utils/parse-static-remotes-config.js +0 -62
- package/dist/src/utils/plugins/runtime-library-control.plugin.d.ts +0 -3
- package/dist/src/utils/plugins/runtime-library-control.plugin.js +0 -54
- package/dist/src/utils/port-utils.d.ts +0 -7
- package/dist/src/utils/port-utils.js +0 -22
- package/dist/src/utils/public-api.d.ts +0 -7
- package/dist/src/utils/public-api.js +0 -18
- package/dist/src/utils/remotes.d.ts +0 -19
- package/dist/src/utils/remotes.js +0 -75
- package/dist/src/utils/rspack-version.d.ts +0 -3
- package/dist/src/utils/rspack-version.js +0 -11
- package/dist/src/utils/secondary-entry-points.d.ts +0 -12
- package/dist/src/utils/secondary-entry-points.js +0 -125
- package/dist/src/utils/share.d.ts +0 -58
- package/dist/src/utils/share.js +0 -334
- package/dist/src/utils/start-remote-proxies.d.ts +0 -5
- package/dist/src/utils/start-remote-proxies.js +0 -55
- package/dist/src/utils/start-ssr-remote-proxies.d.ts +0 -5
- package/dist/src/utils/start-ssr-remote-proxies.js +0 -69
- package/dist/src/utils/typescript.d.ts +0 -4
- package/dist/src/utils/typescript.js +0 -53
- package/dist/src/utils/url-helpers.d.ts +0 -13
- package/dist/src/utils/url-helpers.js +0 -70
- package/dist/src/with-module-federation/angular/utils.d.ts +0 -28
- package/dist/src/with-module-federation/angular/utils.js +0 -83
- package/dist/src/with-module-federation/angular/with-module-federation-ssr.d.ts +0 -2
- package/dist/src/with-module-federation/angular/with-module-federation-ssr.js +0 -86
- package/dist/src/with-module-federation/angular/with-module-federation.d.ts +0 -2
- package/dist/src/with-module-federation/angular/with-module-federation.js +0 -85
- package/dist/src/with-module-federation/react/utils.d.ts +0 -2
- package/dist/src/with-module-federation/react/utils.js +0 -17
- package/dist/src/with-module-federation/rspack/utils.d.ts +0 -10
- package/dist/src/with-module-federation/rspack/utils.js +0 -32
- package/dist/src/with-module-federation/rspack/with-module-federation-ssr.d.ts +0 -4
- package/dist/src/with-module-federation/rspack/with-module-federation-ssr.js +0 -75
- package/dist/src/with-module-federation/rspack/with-module-federation.d.ts +0 -9
- package/dist/src/with-module-federation/rspack/with-module-federation.js +0 -82
- package/dist/src/with-module-federation/webpack/utils.d.ts +0 -10
- package/dist/src/with-module-federation/webpack/utils.js +0 -32
- package/dist/src/with-module-federation/webpack/with-module-federation-ssr.d.ts +0 -2
- package/dist/src/with-module-federation/webpack/with-module-federation-ssr.js +0 -69
- package/dist/src/with-module-federation/webpack/with-module-federation.d.ts +0 -5
- package/dist/src/with-module-federation/webpack/with-module-federation.js +0 -72
- package/dist/url-helpers.d.ts +0 -13
- package/dist/url-helpers.js +0 -78
- package/executors.json +0 -4
- /package/dist/src/{executors/utils → stubs}/models.js +0 -0
package/dist/src/utils/share.js
DELETED
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.shareWorkspaceLibraries = shareWorkspaceLibraries;
|
|
4
|
-
exports.getNpmPackageSharedConfig = getNpmPackageSharedConfig;
|
|
5
|
-
exports.filterPackagesDeclaredInRootPackageJson = filterPackagesDeclaredInRootPackageJson;
|
|
6
|
-
exports.sharePackages = sharePackages;
|
|
7
|
-
exports.applySharedFunction = applySharedFunction;
|
|
8
|
-
exports.applyAdditionalShared = applyAdditionalShared;
|
|
9
|
-
const path_1 = require("path");
|
|
10
|
-
const package_json_1 = require("./package-json");
|
|
11
|
-
const typescript_1 = require("./typescript");
|
|
12
|
-
const secondary_entry_points_1 = require("./secondary-entry-points");
|
|
13
|
-
const devkit_1 = require("@nx/devkit");
|
|
14
|
-
const fs_1 = require("fs");
|
|
15
|
-
// Deferred so a top-level import of @rspack/core (pure ESM in v2) doesn't
|
|
16
|
-
// crash Jest's CJS loading of any test that imports this module.
|
|
17
|
-
function loadNormalModuleReplacementPlugin(bundler) {
|
|
18
|
-
if (bundler === 'rspack') {
|
|
19
|
-
return require('@rspack/core').NormalModuleReplacementPlugin;
|
|
20
|
-
}
|
|
21
|
-
return require('webpack').NormalModuleReplacementPlugin;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Checks if a version string is a workspace protocol version that needs normalization.
|
|
25
|
-
* This includes pnpm workspace protocol (workspace:*), file: protocol, or bare *.
|
|
26
|
-
*/
|
|
27
|
-
function isWorkspaceProtocolVersion(version) {
|
|
28
|
-
if (!version)
|
|
29
|
-
return false;
|
|
30
|
-
return (version === '*' ||
|
|
31
|
-
version.startsWith('workspace:') ||
|
|
32
|
-
version.startsWith('file:'));
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Normalizes workspace protocol versions (workspace:*, workspace:^, *, file:) to actual semver versions
|
|
36
|
-
* by looking up the version from the library's package.json.
|
|
37
|
-
*
|
|
38
|
-
* @param version - The version string that may contain workspace protocol
|
|
39
|
-
* @param libraryName - The name of the library to look up
|
|
40
|
-
* @param workspaceLibs - The workspace libraries to search in
|
|
41
|
-
* @returns The normalized version string, or null if it cannot be resolved
|
|
42
|
-
*/
|
|
43
|
-
function normalizeWorkspaceProtocolVersion(version, libraryName, workspaceLibs) {
|
|
44
|
-
if (!isWorkspaceProtocolVersion(version)) {
|
|
45
|
-
return version;
|
|
46
|
-
}
|
|
47
|
-
// Look up the actual version from the library's package.json
|
|
48
|
-
const workspaceLib = workspaceLibs.find((lib) => lib.importKey === libraryName);
|
|
49
|
-
if (workspaceLib) {
|
|
50
|
-
const libPackageJsonPath = (0, path_1.join)(devkit_1.workspaceRoot, workspaceLib.root, 'package.json');
|
|
51
|
-
if ((0, fs_1.existsSync)(libPackageJsonPath)) {
|
|
52
|
-
const libPkgJson = (0, devkit_1.readJsonFile)(libPackageJsonPath);
|
|
53
|
-
if (libPkgJson?.version) {
|
|
54
|
-
return libPkgJson.version;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// Can't resolve the actual version, return null to indicate no version requirement
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Build an object of functions to be used with the ModuleFederationPlugin to
|
|
63
|
-
* share Nx Workspace Libraries between Hosts and Remotes.
|
|
64
|
-
*
|
|
65
|
-
* @param workspaceLibs - The Nx Workspace Libraries to share
|
|
66
|
-
* @param tsConfigPath - The path to TS Config File that contains the Path Mappings for the Libraries
|
|
67
|
-
* @param bundler - The bundler to use for the replacement plugin
|
|
68
|
-
*/
|
|
69
|
-
function shareWorkspaceLibraries(workspaceLibs, tsConfigPath = process.env.NX_TSCONFIG_PATH ?? (0, typescript_1.getRootTsConfigPath)(), bundler = 'rspack') {
|
|
70
|
-
if (!workspaceLibs) {
|
|
71
|
-
return getEmptySharedLibrariesConfig();
|
|
72
|
-
}
|
|
73
|
-
const tsconfigPathAliases = (0, typescript_1.readTsPathMappings)(tsConfigPath);
|
|
74
|
-
// Nested projects must come first, sort them as such
|
|
75
|
-
const sortedTsConfigPathAliases = {};
|
|
76
|
-
Object.keys(tsconfigPathAliases)
|
|
77
|
-
.sort((a, b) => {
|
|
78
|
-
return b.split('/').length - a.split('/').length;
|
|
79
|
-
})
|
|
80
|
-
.forEach((key) => (sortedTsConfigPathAliases[key] = tsconfigPathAliases[key]));
|
|
81
|
-
const pathMappings = [];
|
|
82
|
-
for (const [key, paths] of Object.entries(sortedTsConfigPathAliases)) {
|
|
83
|
-
const library = workspaceLibs.find((lib) => lib.importKey === key);
|
|
84
|
-
if (!library) {
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
// This is for Angular Projects that use ng-package.json
|
|
88
|
-
// It will do nothing for React Projects
|
|
89
|
-
(0, secondary_entry_points_1.collectWorkspaceLibrarySecondaryEntryPoints)(library, sortedTsConfigPathAliases).forEach(({ name, path }) => pathMappings.push({
|
|
90
|
-
name,
|
|
91
|
-
path,
|
|
92
|
-
}));
|
|
93
|
-
pathMappings.push({
|
|
94
|
-
name: key,
|
|
95
|
-
path: (0, path_1.normalize)((0, path_1.join)(devkit_1.workspaceRoot, paths[0])),
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
// Collect workspace libs that are not in TS path mappings
|
|
99
|
-
// This supports TS Solution + PM Workspaces where libs use package.json
|
|
100
|
-
const workspaceLibrariesAsDeps = [];
|
|
101
|
-
if (Object.keys(sortedTsConfigPathAliases).length !== workspaceLibs.length) {
|
|
102
|
-
for (const workspaceLib of workspaceLibs) {
|
|
103
|
-
if (!sortedTsConfigPathAliases[workspaceLib.importKey]) {
|
|
104
|
-
workspaceLibrariesAsDeps.push(workspaceLib.importKey);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
getAliases: () => pathMappings.reduce((aliases, library) => ({
|
|
110
|
-
...aliases,
|
|
111
|
-
// If the library path ends in a wildcard, remove it as webpack/rspack can't handle this in resolve.alias
|
|
112
|
-
// e.g. path/to/my/lib/* -> path/to/my/lib
|
|
113
|
-
[library.name]: library.path.replace(/\/\*$/, ''),
|
|
114
|
-
}), {}),
|
|
115
|
-
getLibraries: (projectRoot, eager) => {
|
|
116
|
-
let pkgJson = null;
|
|
117
|
-
if (projectRoot &&
|
|
118
|
-
(0, fs_1.existsSync)((0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, projectRoot, 'package.json'))) {
|
|
119
|
-
pkgJson = (0, devkit_1.readJsonFile)((0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, projectRoot, 'package.json'));
|
|
120
|
-
}
|
|
121
|
-
const libraries = pathMappings.reduce((libraries, library) => {
|
|
122
|
-
// Check to see if the library version is declared in the app's package.json
|
|
123
|
-
let version = pkgJson
|
|
124
|
-
? (0, devkit_1.getDependencyVersionFromPackageJson)(library.name, devkit_1.workspaceRoot, pkgJson)
|
|
125
|
-
: null;
|
|
126
|
-
// Normalize workspace protocol versions (workspace:*, workspace:^, *, file:)
|
|
127
|
-
version = normalizeWorkspaceProtocolVersion(version, library.name, workspaceLibs);
|
|
128
|
-
if (!version && workspaceLibs.length > 0) {
|
|
129
|
-
const workspaceLib = workspaceLibs.find((lib) => lib.importKey === library.name);
|
|
130
|
-
const libPackageJsonPath = workspaceLib
|
|
131
|
-
? (0, path_1.join)(workspaceLib.root, 'package.json')
|
|
132
|
-
: null;
|
|
133
|
-
if (libPackageJsonPath && (0, fs_1.existsSync)(libPackageJsonPath)) {
|
|
134
|
-
pkgJson = (0, devkit_1.readJsonFile)(libPackageJsonPath);
|
|
135
|
-
if (pkgJson) {
|
|
136
|
-
version = pkgJson.version;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return {
|
|
141
|
-
...libraries,
|
|
142
|
-
[library.name]: {
|
|
143
|
-
...(version
|
|
144
|
-
? {
|
|
145
|
-
requiredVersion: version,
|
|
146
|
-
singleton: true,
|
|
147
|
-
}
|
|
148
|
-
: { requiredVersion: false }),
|
|
149
|
-
eager,
|
|
150
|
-
},
|
|
151
|
-
};
|
|
152
|
-
}, {});
|
|
153
|
-
// Add workspace libs from package.json dependencies
|
|
154
|
-
// This supports TS Solution + PM Workspaces
|
|
155
|
-
for (const libraryName of workspaceLibrariesAsDeps) {
|
|
156
|
-
let version = pkgJson?.dependencies?.[libraryName] ??
|
|
157
|
-
pkgJson?.devDependencies?.[libraryName];
|
|
158
|
-
// Normalize workspace protocol versions (workspace:*, workspace:^, *, file:)
|
|
159
|
-
version = normalizeWorkspaceProtocolVersion(version, libraryName, workspaceLibs);
|
|
160
|
-
libraries[libraryName] = {
|
|
161
|
-
...(version
|
|
162
|
-
? { requiredVersion: version, singleton: true }
|
|
163
|
-
: { requiredVersion: false }),
|
|
164
|
-
eager,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
return libraries;
|
|
168
|
-
},
|
|
169
|
-
getReplacementPlugin: () => new (loadNormalModuleReplacementPlugin(bundler))(/./, (req) => {
|
|
170
|
-
if (!req.request.startsWith('.')) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
const from = req.context;
|
|
174
|
-
const to = (0, path_1.normalize)((0, path_1.join)(req.context, req.request));
|
|
175
|
-
for (const library of pathMappings) {
|
|
176
|
-
const libFolder = (0, path_1.normalize)((0, path_1.dirname)(library.path));
|
|
177
|
-
if (!from.startsWith(libFolder) && to.startsWith(libFolder)) {
|
|
178
|
-
const newReq = library.name.endsWith('/*')
|
|
179
|
-
? /**
|
|
180
|
-
* req usually is in the form of "../../../path/to/file"
|
|
181
|
-
* library.path is usually in the form of "/Users/username/path/to/Workspace/path/to/library"
|
|
182
|
-
*
|
|
183
|
-
* When a wildcard is used in the TS path mappings, we want to get everything after the import to
|
|
184
|
-
* re-route the request correctly inline with the webpack/rspack resolve.alias
|
|
185
|
-
*/
|
|
186
|
-
(0, path_1.join)(library.name, req.request.split(library.path.replace(devkit_1.workspaceRoot, '').replace('/*', ''))[1])
|
|
187
|
-
: library.name;
|
|
188
|
-
req.request = newReq;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}),
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Build the Module Federation Share Config for a specific package and the
|
|
196
|
-
* specified version of that package.
|
|
197
|
-
* @param pkgName - Name of the package to share
|
|
198
|
-
* @param version - Version of the package to require by other apps in the Module Federation setup
|
|
199
|
-
*/
|
|
200
|
-
function getNpmPackageSharedConfig(pkgName, version) {
|
|
201
|
-
if (!version) {
|
|
202
|
-
devkit_1.logger.warn(`Could not find a version for "${pkgName}" in the root "package.json" ` +
|
|
203
|
-
'when collecting shared packages for the Module Federation setup. ' +
|
|
204
|
-
'The package will not be shared.');
|
|
205
|
-
return undefined;
|
|
206
|
-
}
|
|
207
|
-
// Warn if a workspace protocol version is passed - this indicates the package
|
|
208
|
-
// should be configured as a workspace library instead of using sharePackages
|
|
209
|
-
if (isWorkspaceProtocolVersion(version)) {
|
|
210
|
-
devkit_1.logger.warn(`Package "${pkgName}" has a workspace protocol version "${version}" which cannot be used ` +
|
|
211
|
-
'for Module Federation. For workspace libraries, use the workspace library configuration ' +
|
|
212
|
-
'instead of sharePackages. The package will not be shared.');
|
|
213
|
-
return undefined;
|
|
214
|
-
}
|
|
215
|
-
return { singleton: true, strictVersion: true, requiredVersion: version };
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Narrow a list of package names down to those with a version declared in the
|
|
219
|
-
* root package.json.
|
|
220
|
-
*
|
|
221
|
-
* Version resolution matches {@link sharePackages}, so a package kept here never
|
|
222
|
-
* trips the missing-version warning in {@link getNpmPackageSharedConfig}.
|
|
223
|
-
* @param packages - Array of package names as strings
|
|
224
|
-
*/
|
|
225
|
-
function filterPackagesDeclaredInRootPackageJson(packages) {
|
|
226
|
-
if (packages.length === 0) {
|
|
227
|
-
return [];
|
|
228
|
-
}
|
|
229
|
-
const pkgJson = (0, package_json_1.readRootPackageJson)();
|
|
230
|
-
return packages.filter((pkg) => Boolean((0, devkit_1.getDependencyVersionFromPackageJson)(pkg, devkit_1.workspaceRoot, pkgJson)));
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Create a dictionary of packages and their Module Federation Shared Config
|
|
234
|
-
* from an array of package names.
|
|
235
|
-
*
|
|
236
|
-
* Lookup the versions of the packages from the root package.json file in the
|
|
237
|
-
* workspace.
|
|
238
|
-
* @param packages - Array of package names as strings
|
|
239
|
-
*/
|
|
240
|
-
function sharePackages(packages) {
|
|
241
|
-
const pkgJson = (0, package_json_1.readRootPackageJson)();
|
|
242
|
-
const allPackages = [];
|
|
243
|
-
packages.forEach((pkg) => {
|
|
244
|
-
const pkgVersion = (0, devkit_1.getDependencyVersionFromPackageJson)(pkg, devkit_1.workspaceRoot, pkgJson);
|
|
245
|
-
allPackages.push({ name: pkg, version: pkgVersion });
|
|
246
|
-
(0, secondary_entry_points_1.collectPackageSecondaryEntryPoints)(pkg, pkgVersion, allPackages);
|
|
247
|
-
});
|
|
248
|
-
return allPackages.reduce((shared, pkg) => {
|
|
249
|
-
const config = getNpmPackageSharedConfig(pkg.name, pkg.version);
|
|
250
|
-
if (config) {
|
|
251
|
-
shared[pkg.name] = config;
|
|
252
|
-
}
|
|
253
|
-
return shared;
|
|
254
|
-
}, {});
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Apply a custom function provided by the user that will modify the Shared Config
|
|
258
|
-
* of the dependencies for the Module Federation build.
|
|
259
|
-
*
|
|
260
|
-
* @param sharedConfig - The original Shared Config to be modified
|
|
261
|
-
* @param sharedFn - The custom function to run
|
|
262
|
-
*/
|
|
263
|
-
function applySharedFunction(sharedConfig, sharedFn) {
|
|
264
|
-
if (!sharedFn) {
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
for (const [libraryName, library] of Object.entries(sharedConfig)) {
|
|
268
|
-
const mappedDependency = sharedFn(libraryName, library);
|
|
269
|
-
if (mappedDependency === false) {
|
|
270
|
-
delete sharedConfig[libraryName];
|
|
271
|
-
continue;
|
|
272
|
-
}
|
|
273
|
-
else if (!mappedDependency) {
|
|
274
|
-
continue;
|
|
275
|
-
}
|
|
276
|
-
sharedConfig[libraryName] = mappedDependency;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Add additional dependencies to the shared package that may not have been
|
|
281
|
-
* discovered by the project graph.
|
|
282
|
-
*
|
|
283
|
-
* This can be useful for applications that use a Dependency Injection system
|
|
284
|
-
* that expects certain Singleton values to be present in the shared injection
|
|
285
|
-
* hierarchy.
|
|
286
|
-
*
|
|
287
|
-
* @param sharedConfig - The original Shared Config
|
|
288
|
-
* @param additionalShared - The additional dependencies to add
|
|
289
|
-
* @param projectGraph - The Nx project graph
|
|
290
|
-
*/
|
|
291
|
-
function applyAdditionalShared(sharedConfig, additionalShared, projectGraph) {
|
|
292
|
-
if (!additionalShared) {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
for (const shared of additionalShared) {
|
|
296
|
-
if (typeof shared === 'string') {
|
|
297
|
-
addStringDependencyToSharedConfig(sharedConfig, shared, projectGraph);
|
|
298
|
-
}
|
|
299
|
-
else if (Array.isArray(shared)) {
|
|
300
|
-
sharedConfig[shared[0]] = shared[1];
|
|
301
|
-
}
|
|
302
|
-
else if (typeof shared === 'object') {
|
|
303
|
-
sharedConfig[shared.libraryName] = shared.sharedConfig;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
function addStringDependencyToSharedConfig(sharedConfig, dependency, projectGraph) {
|
|
308
|
-
if (projectGraph.nodes[dependency]) {
|
|
309
|
-
sharedConfig[dependency] = { requiredVersion: false };
|
|
310
|
-
}
|
|
311
|
-
else if (projectGraph.externalNodes?.[`npm:${dependency}`]) {
|
|
312
|
-
const pkgJson = (0, package_json_1.readRootPackageJson)();
|
|
313
|
-
const config = getNpmPackageSharedConfig(dependency, (0, devkit_1.getDependencyVersionFromPackageJson)(dependency, devkit_1.workspaceRoot, pkgJson));
|
|
314
|
-
if (!config) {
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
sharedConfig[dependency] = config;
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
const pkgJsonPath = require.resolve(`${dependency}/package.json`);
|
|
321
|
-
if (!pkgJsonPath) {
|
|
322
|
-
throw new Error(`Could not find package ${dependency} when applying it as a shared package. Are you sure it has been installed?`);
|
|
323
|
-
}
|
|
324
|
-
const pkgJson = (0, devkit_1.readJsonFile)(pkgJsonPath);
|
|
325
|
-
const config = getNpmPackageSharedConfig(dependency, pkgJson.version);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
function getEmptySharedLibrariesConfig(bundler = 'rspack') {
|
|
329
|
-
return {
|
|
330
|
-
getAliases: () => ({}),
|
|
331
|
-
getLibraries: () => ({}),
|
|
332
|
-
getReplacementPlugin: () => new (loadNormalModuleReplacementPlugin(bundler))(/./, () => { }),
|
|
333
|
-
};
|
|
334
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { StaticRemotesConfig } from './parse-static-remotes-config';
|
|
2
|
-
export declare function startRemoteProxies(staticRemotesConfig: StaticRemotesConfig, mappedLocationsOfRemotes: Record<string, string>, sslOptions?: {
|
|
3
|
-
pathToCert: string;
|
|
4
|
-
pathToKey: string;
|
|
5
|
-
}, host?: string): Promise<void>;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.startRemoteProxies = startRemoteProxies;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
const port_utils_1 = require("./port-utils");
|
|
7
|
-
async function startRemoteProxies(staticRemotesConfig, mappedLocationsOfRemotes, sslOptions, host = '127.0.0.1') {
|
|
8
|
-
const { createProxyMiddleware } = require('http-proxy-middleware');
|
|
9
|
-
const express = require('express');
|
|
10
|
-
let sslCert;
|
|
11
|
-
let sslKey;
|
|
12
|
-
if (sslOptions && sslOptions.pathToCert && sslOptions.pathToKey) {
|
|
13
|
-
if ((0, fs_1.existsSync)(sslOptions.pathToCert) && (0, fs_1.existsSync)(sslOptions.pathToKey)) {
|
|
14
|
-
sslCert = (0, fs_1.readFileSync)(sslOptions.pathToCert);
|
|
15
|
-
sslKey = (0, fs_1.readFileSync)(sslOptions.pathToKey);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
devkit_1.logger.warn(`Encountered SSL options in project.json, however, the certificate files do not exist in the filesystem. Using http.`);
|
|
19
|
-
devkit_1.logger.warn(`Attempted to find '${sslOptions.pathToCert}' and '${sslOptions.pathToKey}'.`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
const http = require('http');
|
|
23
|
-
const https = require('https');
|
|
24
|
-
devkit_1.logger.info(`NX Starting static remotes proxies...`);
|
|
25
|
-
let startedProxies = 0;
|
|
26
|
-
let skippedProxies = 0;
|
|
27
|
-
for (const app of staticRemotesConfig.remotes) {
|
|
28
|
-
const port = staticRemotesConfig.config[app].port;
|
|
29
|
-
// Check if the port is already in use (another MF dev server may have already started a proxy)
|
|
30
|
-
const portInUse = await (0, port_utils_1.isPortInUse)(port, host);
|
|
31
|
-
if (portInUse) {
|
|
32
|
-
devkit_1.logger.info(`NX Skipping proxy for ${app} on port ${port} - port already in use (likely served by another process)`);
|
|
33
|
-
skippedProxies++;
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
const expressProxy = express();
|
|
37
|
-
expressProxy.use(createProxyMiddleware({
|
|
38
|
-
target: mappedLocationsOfRemotes[app],
|
|
39
|
-
changeOrigin: true,
|
|
40
|
-
secure: sslCert ? false : undefined,
|
|
41
|
-
}));
|
|
42
|
-
const proxyServer = (sslCert ? https : http)
|
|
43
|
-
.createServer({ cert: sslCert, key: sslKey }, expressProxy)
|
|
44
|
-
.listen(port);
|
|
45
|
-
process.on('SIGTERM', () => proxyServer.close());
|
|
46
|
-
process.on('exit', () => proxyServer.close());
|
|
47
|
-
startedProxies++;
|
|
48
|
-
}
|
|
49
|
-
if (skippedProxies > 0) {
|
|
50
|
-
devkit_1.logger.info(`NX Static remotes proxies: started ${startedProxies}, skipped ${skippedProxies} (already running)`);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
devkit_1.logger.info(`NX Static remotes proxies started successfully`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { StaticRemotesConfig } from './parse-static-remotes-config';
|
|
2
|
-
export declare function startSsrRemoteProxies(staticRemotesConfig: StaticRemotesConfig, mappedLocationsOfRemotes: Record<string, string>, sslOptions?: {
|
|
3
|
-
pathToCert: string;
|
|
4
|
-
pathToKey: string;
|
|
5
|
-
}, host?: string): Promise<void>;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.startSsrRemoteProxies = startSsrRemoteProxies;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
const port_utils_1 = require("./port-utils");
|
|
7
|
-
async function startSsrRemoteProxies(staticRemotesConfig, mappedLocationsOfRemotes, sslOptions, host = '127.0.0.1') {
|
|
8
|
-
const { createProxyMiddleware } = require('http-proxy-middleware');
|
|
9
|
-
const express = require('express');
|
|
10
|
-
let sslCert;
|
|
11
|
-
let sslKey;
|
|
12
|
-
if (sslOptions && sslOptions.pathToCert && sslOptions.pathToKey) {
|
|
13
|
-
if ((0, fs_1.existsSync)(sslOptions.pathToCert) && (0, fs_1.existsSync)(sslOptions.pathToKey)) {
|
|
14
|
-
sslCert = (0, fs_1.readFileSync)(sslOptions.pathToCert);
|
|
15
|
-
sslKey = (0, fs_1.readFileSync)(sslOptions.pathToKey);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
devkit_1.logger.warn(`Encountered SSL options in project.json, however, the certificate files do not exist in the filesystem. Using http.`);
|
|
19
|
-
devkit_1.logger.warn(`Attempted to find '${sslOptions.pathToCert}' and '${sslOptions.pathToKey}'.`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
const http = require('http');
|
|
23
|
-
const https = require('https');
|
|
24
|
-
devkit_1.logger.info(`NX Starting static remotes proxies...`);
|
|
25
|
-
let startedProxies = 0;
|
|
26
|
-
let skippedProxies = 0;
|
|
27
|
-
for (const app of staticRemotesConfig.remotes) {
|
|
28
|
-
const port = staticRemotesConfig.config[app].port;
|
|
29
|
-
// Check if the port is already in use (another MF dev server may have already started a proxy)
|
|
30
|
-
const portInUse = await (0, port_utils_1.isPortInUse)(port, host);
|
|
31
|
-
if (portInUse) {
|
|
32
|
-
devkit_1.logger.info(`NX Skipping proxy for ${app} on port ${port} - port already in use (likely served by another process)`);
|
|
33
|
-
skippedProxies++;
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
const expressProxy = express();
|
|
37
|
-
/**
|
|
38
|
-
* SSR remotes have two output paths: one for the browser and one for the server.
|
|
39
|
-
* We need to handle paths for both of them.
|
|
40
|
-
* The browser output path is used to serve the client-side code.
|
|
41
|
-
* The server output path is used to serve the server-side code.
|
|
42
|
-
*/
|
|
43
|
-
expressProxy.use(createProxyMiddleware({
|
|
44
|
-
target: `${mappedLocationsOfRemotes[app]}`,
|
|
45
|
-
secure: sslCert ? false : undefined,
|
|
46
|
-
changeOrigin: true,
|
|
47
|
-
pathRewrite: (path) => {
|
|
48
|
-
if (path.includes('/server')) {
|
|
49
|
-
return path;
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
return `browser/${path}`;
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
}));
|
|
56
|
-
const proxyServer = (sslCert ? https : http)
|
|
57
|
-
.createServer({ cert: sslCert, key: sslKey }, expressProxy)
|
|
58
|
-
.listen(port);
|
|
59
|
-
process.on('SIGTERM', () => proxyServer.close());
|
|
60
|
-
process.on('exit', () => proxyServer.close());
|
|
61
|
-
startedProxies++;
|
|
62
|
-
}
|
|
63
|
-
if (skippedProxies > 0) {
|
|
64
|
-
devkit_1.logger.info(`NX SSR Static remotes proxies: started ${startedProxies}, skipped ${skippedProxies} (already running)`);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
devkit_1.logger.info(`Nx SSR Static remotes proxies started successfully`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ParsedCommandLine } from 'typescript';
|
|
2
|
-
export declare function readTsPathMappings(tsConfigPath?: string): ParsedCommandLine['options']['paths'];
|
|
3
|
-
export declare function readTsConfig(tsConfigPath: string): ParsedCommandLine;
|
|
4
|
-
export declare function getRootTsConfigPath(): string | null;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readTsPathMappings = readTsPathMappings;
|
|
4
|
-
exports.readTsConfig = readTsConfig;
|
|
5
|
-
exports.getRootTsConfigPath = getRootTsConfigPath;
|
|
6
|
-
const fs_1 = require("fs");
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
const devkit_1 = require("@nx/devkit");
|
|
9
|
-
let tsConfig = new Map();
|
|
10
|
-
let tsPathMappings = new Map();
|
|
11
|
-
function readTsPathMappings(tsConfigPath = process.env.NX_TSCONFIG_PATH ?? getRootTsConfigPath()) {
|
|
12
|
-
if (tsPathMappings.has(tsConfigPath)) {
|
|
13
|
-
return tsPathMappings.get(tsConfigPath);
|
|
14
|
-
}
|
|
15
|
-
if (!tsConfig.has(tsConfigPath)) {
|
|
16
|
-
tsConfig.set(tsConfigPath, readTsConfiguration(tsConfigPath));
|
|
17
|
-
}
|
|
18
|
-
// Build the processed paths object in a single pass instead of
|
|
19
|
-
// spreading on each iteration, which was O(n²) for n path aliases
|
|
20
|
-
const processedPaths = {};
|
|
21
|
-
for (const [alias, aliasPaths] of Object.entries(tsConfig.get(tsConfigPath).options?.paths ?? {})) {
|
|
22
|
-
processedPaths[alias] = aliasPaths.map((path) => path.replace(/^\.\//, ''));
|
|
23
|
-
}
|
|
24
|
-
tsPathMappings.set(tsConfigPath, processedPaths);
|
|
25
|
-
return processedPaths;
|
|
26
|
-
}
|
|
27
|
-
function readTsConfiguration(tsConfigPath) {
|
|
28
|
-
if (!(0, fs_1.existsSync)(tsConfigPath)) {
|
|
29
|
-
throw new Error(`NX MF: TsConfig Path for workspace libraries does not exist! (${tsConfigPath}).`);
|
|
30
|
-
}
|
|
31
|
-
return readTsConfig(tsConfigPath);
|
|
32
|
-
}
|
|
33
|
-
let tsModule;
|
|
34
|
-
function readTsConfig(tsConfigPath) {
|
|
35
|
-
if (!tsModule) {
|
|
36
|
-
tsModule = require('typescript');
|
|
37
|
-
}
|
|
38
|
-
const readResult = tsModule.readConfigFile(tsConfigPath, tsModule.sys.readFile);
|
|
39
|
-
return tsModule.parseJsonConfigFileContent(readResult.config, tsModule.sys, (0, path_1.dirname)(tsConfigPath));
|
|
40
|
-
}
|
|
41
|
-
function getRootTsConfigPath() {
|
|
42
|
-
const tsConfigFileName = getRootTsConfigFileName();
|
|
43
|
-
return tsConfigFileName ? (0, path_1.join)(devkit_1.workspaceRoot, tsConfigFileName) : null;
|
|
44
|
-
}
|
|
45
|
-
function getRootTsConfigFileName() {
|
|
46
|
-
for (const tsConfigName of ['tsconfig.base.json', 'tsconfig.json']) {
|
|
47
|
-
const tsConfigPath = (0, path_1.join)(devkit_1.workspaceRoot, tsConfigName);
|
|
48
|
-
if ((0, fs_1.existsSync)(tsConfigPath)) {
|
|
49
|
-
return tsConfigName;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if a URL string is absolute (has protocol)
|
|
3
|
-
*/
|
|
4
|
-
export declare function isAbsoluteUrl(url: string): boolean;
|
|
5
|
-
/**
|
|
6
|
-
* Safely processes remote locations, handling both relative and absolute URLs
|
|
7
|
-
* while preserving query parameters and hash fragments for absolute URLs
|
|
8
|
-
*/
|
|
9
|
-
export declare function processRemoteLocation(remoteLocation: string, remoteEntryExt: 'js' | 'mjs'): string;
|
|
10
|
-
/**
|
|
11
|
-
* Processes remote URLs for runtime environments, resolving relative URLs against window.location.origin
|
|
12
|
-
*/
|
|
13
|
-
export declare function processRuntimeRemoteUrl(remoteUrl: string, remoteEntryExt: 'js' | 'mjs'): string;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAbsoluteUrl = isAbsoluteUrl;
|
|
4
|
-
exports.processRemoteLocation = processRemoteLocation;
|
|
5
|
-
exports.processRuntimeRemoteUrl = processRuntimeRemoteUrl;
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
/**
|
|
8
|
-
* Checks if a URL string is absolute (has protocol)
|
|
9
|
-
*/
|
|
10
|
-
function isAbsoluteUrl(url) {
|
|
11
|
-
try {
|
|
12
|
-
new URL(url);
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Safely processes remote locations, handling both relative and absolute URLs
|
|
21
|
-
* while preserving query parameters and hash fragments for absolute URLs
|
|
22
|
-
*/
|
|
23
|
-
function processRemoteLocation(remoteLocation, remoteEntryExt) {
|
|
24
|
-
// Handle promise-based remotes as-is
|
|
25
|
-
if (remoteLocation.startsWith('promise new Promise')) {
|
|
26
|
-
return remoteLocation;
|
|
27
|
-
}
|
|
28
|
-
if (isAbsoluteUrl(remoteLocation)) {
|
|
29
|
-
// Use new URL parsing for absolute URLs (supports query params/hash)
|
|
30
|
-
const url = new URL(remoteLocation);
|
|
31
|
-
const ext = (0, path_1.extname)(url.pathname);
|
|
32
|
-
const needsRemoteEntry = !['.js', '.mjs', '.json'].includes(ext);
|
|
33
|
-
if (needsRemoteEntry) {
|
|
34
|
-
url.pathname = url.pathname.endsWith('/')
|
|
35
|
-
? `${url.pathname}remoteEntry.${remoteEntryExt}`
|
|
36
|
-
: `${url.pathname}/remoteEntry.${remoteEntryExt}`;
|
|
37
|
-
}
|
|
38
|
-
return url.href;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
// Use string manipulation for relative URLs (backward compatibility)
|
|
42
|
-
const ext = (0, path_1.extname)(remoteLocation);
|
|
43
|
-
const needsRemoteEntry = !['.js', '.mjs', '.json'].includes(ext);
|
|
44
|
-
if (needsRemoteEntry) {
|
|
45
|
-
const baseRemote = remoteLocation.endsWith('/')
|
|
46
|
-
? remoteLocation.slice(0, -1)
|
|
47
|
-
: remoteLocation;
|
|
48
|
-
return `${baseRemote}/remoteEntry.${remoteEntryExt}`;
|
|
49
|
-
}
|
|
50
|
-
return remoteLocation;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Processes remote URLs for runtime environments, resolving relative URLs against window.location.origin
|
|
55
|
-
*/
|
|
56
|
-
function processRuntimeRemoteUrl(remoteUrl, remoteEntryExt) {
|
|
57
|
-
if (isAbsoluteUrl(remoteUrl)) {
|
|
58
|
-
return processRemoteLocation(remoteUrl, remoteEntryExt);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
// For runtime relative URLs, resolve against current origin
|
|
62
|
-
const baseUrl = typeof globalThis !== 'undefined' &&
|
|
63
|
-
typeof globalThis.window !== 'undefined' &&
|
|
64
|
-
globalThis.window.location
|
|
65
|
-
? globalThis.window.location.origin
|
|
66
|
-
: 'http://localhost';
|
|
67
|
-
const absoluteUrl = new URL(remoteUrl, baseUrl).href;
|
|
68
|
-
return processRemoteLocation(absoluteUrl, remoteEntryExt);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ModuleFederationConfig, SharedLibraryConfig } from '../../utils';
|
|
2
|
-
/**
|
|
3
|
-
* Default npm packages to share for Angular projects, each shared only when the
|
|
4
|
-
* workspace declares it in the root package.json.
|
|
5
|
-
*/
|
|
6
|
-
export declare const DEFAULT_ANGULAR_PACKAGES_TO_SHARE: string[];
|
|
7
|
-
/**
|
|
8
|
-
* npm packages to avoid sharing in Angular projects.
|
|
9
|
-
*/
|
|
10
|
-
export declare const DEFAULT_NPM_PACKAGES_TO_AVOID: string[];
|
|
11
|
-
/**
|
|
12
|
-
* Applies eager loading to default Angular packages.
|
|
13
|
-
* Exported for backward compatibility.
|
|
14
|
-
*/
|
|
15
|
-
export declare function applyDefaultEagerPackages(sharedConfig: Record<string, SharedLibraryConfig>, useRspack?: boolean): void;
|
|
16
|
-
/**
|
|
17
|
-
* Creates the default remote URL resolver for Angular.
|
|
18
|
-
* Kept for backward compatibility with existing configs.
|
|
19
|
-
*/
|
|
20
|
-
export declare function getFunctionDeterminateRemoteUrl(isServer?: boolean, useRspack?: boolean): (remote: string) => string;
|
|
21
|
-
export declare function getModuleFederationConfig(mfConfig: ModuleFederationConfig, options?: {
|
|
22
|
-
isServer: boolean;
|
|
23
|
-
determineRemoteUrl?: (remote: string) => string;
|
|
24
|
-
}, bundler?: 'rspack' | 'webpack'): Promise<import("../../utils/module-federation-config").ModuleFederationConfigResult>;
|
|
25
|
-
export declare function getModuleFederationConfigSync(mfConfig: ModuleFederationConfig, options?: {
|
|
26
|
-
isServer: boolean;
|
|
27
|
-
determineRemoteUrl?: (remote: string) => string;
|
|
28
|
-
}, useRspack?: boolean): import("../../utils/module-federation-config").ModuleFederationConfigResult;
|