@nx/rspack 20.2.0-beta.2 → 20.2.0-beta.4
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/app-plugin.d.ts +2 -0
- package/app-plugin.js +5 -0
- package/generators.json +10 -0
- package/migrations.json +21 -1
- package/module-federation.d.ts +4 -1
- package/module-federation.js +7 -2
- package/package.json +10 -8
- package/react-plugin.d.ts +1 -0
- package/react-plugin.js +5 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +5 -7
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +5 -7
- package/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts +1 -1
- package/src/executors/module-federation-static-server/module-federation-static-server.impl.js +4 -5
- package/src/executors/rspack/schema.d.ts +1 -1
- package/src/executors/rspack/schema.json +1 -1
- package/src/generators/application/application.js +0 -2
- package/src/generators/configuration/configuration.js +0 -2
- package/src/generators/convert-config-to-rspack-plugin/convert-config-to-rspack-plugin.d.ts +7 -0
- package/src/generators/convert-config-to-rspack-plugin/convert-config-to-rspack-plugin.js +92 -0
- package/src/generators/convert-config-to-rspack-plugin/lib/extract-rspack-options.d.ts +6 -0
- package/src/generators/convert-config-to-rspack-plugin/lib/extract-rspack-options.js +106 -0
- package/src/generators/convert-config-to-rspack-plugin/lib/normalize-path-options.d.ts +2 -0
- package/src/generators/convert-config-to-rspack-plugin/lib/normalize-path-options.js +73 -0
- package/src/generators/convert-config-to-rspack-plugin/lib/utils.d.ts +1 -0
- package/src/generators/convert-config-to-rspack-plugin/lib/utils.js +13 -0
- package/src/generators/convert-config-to-rspack-plugin/lib/validate-project.d.ts +9 -0
- package/src/generators/convert-config-to-rspack-plugin/lib/validate-project.js +40 -0
- package/src/generators/convert-config-to-rspack-plugin/schema.json +19 -0
- package/src/generators/convert-to-inferred/__snapshots__/convert-to-inferred.spec.ts.snap +268 -0
- package/src/generators/convert-to-inferred/convert-to-inferred.d.ts +12 -0
- package/src/generators/convert-to-inferred/convert-to-inferred.js +114 -0
- package/src/generators/convert-to-inferred/schema.json +19 -0
- package/src/generators/convert-to-inferred/utils/ast.d.ts +3 -0
- package/src/generators/convert-to-inferred/utils/ast.js +40 -0
- package/src/generators/convert-to-inferred/utils/build-post-target-transformer.d.ts +6 -0
- package/src/generators/convert-to-inferred/utils/build-post-target-transformer.js +210 -0
- package/src/generators/convert-to-inferred/utils/index.d.ts +3 -0
- package/src/generators/convert-to-inferred/utils/index.js +6 -0
- package/src/generators/convert-to-inferred/utils/serve-post-target-transformer.d.ts +6 -0
- package/src/generators/convert-to-inferred/utils/serve-post-target-transformer.js +207 -0
- package/src/generators/convert-to-inferred/utils/types.d.ts +11 -0
- package/src/generators/convert-webpack/lib/transform-cjs.js +5 -5
- package/src/generators/convert-webpack/lib/transform-esm.js +5 -5
- package/src/generators/init/init.js +0 -2
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.d.ts +2 -0
- package/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.js +35 -0
- package/src/plugins/nx-app-rspack-plugin/nx-app-rspack-plugin.d.ts +16 -0
- package/src/plugins/nx-app-rspack-plugin/nx-app-rspack-plugin.js +43 -0
- package/src/plugins/nx-react-rspack-plugin/nx-react-rspack-plugin.d.ts +8 -0
- package/src/plugins/nx-react-rspack-plugin/nx-react-rspack-plugin.js +13 -0
- package/src/plugins/use-legacy-nx-plugin/use-legacy-nx-plugin.d.ts +31 -0
- package/src/plugins/use-legacy-nx-plugin/use-legacy-nx-plugin.js +73 -0
- package/src/plugins/utils/apply-base-config.js +3 -0
- package/src/plugins/utils/apply-web-config.d.ts +2 -2
- package/src/plugins/utils/apply-web-config.js +1 -1
- package/src/plugins/utils/plugins/normalize-options.js +1 -1
- package/src/plugins/utils/plugins/nx-tsconfig-paths-rspack-plugin.js +3 -2
- package/src/utils/create-compiler.js +3 -1
- package/src/utils/generator-utils.d.ts +2 -2
- package/src/utils/generator-utils.js +134 -67
- package/src/utils/has-plugin.d.ts +2 -0
- package/src/utils/has-plugin.js +10 -0
- package/src/utils/module-federation/build-static.remotes.d.ts +1 -1
- package/src/utils/versions.d.ts +2 -2
- package/src/utils/versions.js +2 -2
- package/src/utils/module-federation/dependencies.d.ts +0 -6
- package/src/utils/module-federation/dependencies.js +0 -56
- package/src/utils/module-federation/get-remotes-for-host.d.ts +0 -16
- package/src/utils/module-federation/get-remotes-for-host.js +0 -99
- package/src/utils/module-federation/index.d.ts +0 -6
- package/src/utils/module-federation/index.js +0 -9
- package/src/utils/module-federation/models/index.d.ts +0 -47
- package/src/utils/module-federation/package-json.d.ts +0 -8
- package/src/utils/module-federation/package-json.js +0 -12
- package/src/utils/module-federation/parse-static-remotes-config.d.ts +0 -13
- package/src/utils/module-federation/parse-static-remotes-config.js +0 -34
- package/src/utils/module-federation/plugins/runtime-library-control.plugin.d.ts +0 -3
- package/src/utils/module-federation/plugins/runtime-library-control.plugin.js +0 -54
- package/src/utils/module-federation/public-api.d.ts +0 -8
- package/src/utils/module-federation/public-api.js +0 -20
- package/src/utils/module-federation/remotes.d.ts +0 -19
- package/src/utils/module-federation/remotes.js +0 -85
- package/src/utils/module-federation/secondary-entry-points.d.ts +0 -12
- package/src/utils/module-federation/secondary-entry-points.js +0 -104
- package/src/utils/module-federation/share.d.ts +0 -48
- package/src/utils/module-federation/share.js +0 -235
- package/src/utils/module-federation/start-remote-proxies.d.ts +0 -5
- package/src/utils/module-federation/start-remote-proxies.js +0 -45
- package/src/utils/module-federation/start-ssr-remote-proxies.d.ts +0 -5
- package/src/utils/module-federation/start-ssr-remote-proxies.js +0 -59
- package/src/utils/module-federation/typescript.d.ts +0 -4
- package/src/utils/module-federation/typescript.js +0 -53
- package/src/utils/module-federation/with-module-federation/package-json.d.ts +0 -8
- package/src/utils/module-federation/with-module-federation/package-json.js +0 -12
- package/src/utils/module-federation/with-module-federation/utils.d.ts +0 -12
- package/src/utils/module-federation/with-module-federation/utils.js +0 -76
- package/src/utils/module-federation/with-module-federation/with-module-federation-ssr.d.ts +0 -3
- package/src/utils/module-federation/with-module-federation/with-module-federation-ssr.js +0 -62
- package/src/utils/module-federation/with-module-federation/with-module-federation.d.ts +0 -8
- package/src/utils/module-federation/with-module-federation/with-module-federation.js +0 -70
- /package/src/{utils/module-federation/models/index.js → generators/convert-to-inferred/utils/types.js} +0 -0
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRemotes = getRemotes;
|
|
4
|
-
exports.getModuleFederationConfig = getModuleFederationConfig;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const internal_1 = require("@nx/js/src/internal");
|
|
8
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
9
|
-
const fs_1 = require("fs");
|
|
10
|
-
const find_matching_projects_1 = require("nx/src/utils/find-matching-projects");
|
|
11
|
-
const path_1 = require("path");
|
|
12
|
-
function extractRemoteProjectsFromConfig(config, pathToManifestFile) {
|
|
13
|
-
const remotes = [];
|
|
14
|
-
const dynamicRemotes = [];
|
|
15
|
-
if (pathToManifestFile && (0, fs_1.existsSync)(pathToManifestFile)) {
|
|
16
|
-
const moduleFederationManifestJson = (0, fs_1.readFileSync)(pathToManifestFile, 'utf-8');
|
|
17
|
-
if (moduleFederationManifestJson) {
|
|
18
|
-
// This should have shape of
|
|
19
|
-
// {
|
|
20
|
-
// "remoteName": "remoteLocation",
|
|
21
|
-
// }
|
|
22
|
-
const parsedManifest = JSON.parse(moduleFederationManifestJson);
|
|
23
|
-
if (Object.keys(parsedManifest).every((key) => typeof key === 'string' && typeof parsedManifest[key] === 'string')) {
|
|
24
|
-
dynamicRemotes.push(...Object.keys(parsedManifest));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const staticRemotes = config.remotes?.map((r) => (Array.isArray(r) ? r[0] : r)) ?? [];
|
|
29
|
-
remotes.push(...staticRemotes);
|
|
30
|
-
return { remotes, dynamicRemotes };
|
|
31
|
-
}
|
|
32
|
-
function collectRemoteProjects(remote, collected, context) {
|
|
33
|
-
const remoteProject = context.projectGraph.nodes[remote]?.data;
|
|
34
|
-
if (!context.projectGraph.nodes[remote] || collected.has(remote)) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
collected.add(remote);
|
|
38
|
-
const remoteProjectRoot = remoteProject.root;
|
|
39
|
-
const remoteProjectTsConfig = remoteProject.targets['build'].options.tsConfig;
|
|
40
|
-
const remoteProjectConfig = getModuleFederationConfig(remoteProjectTsConfig, context.root, remoteProjectRoot);
|
|
41
|
-
const { remotes: remoteProjectRemotes } = extractRemoteProjectsFromConfig(remoteProjectConfig);
|
|
42
|
-
remoteProjectRemotes.forEach((r) => collectRemoteProjects(r, collected, context));
|
|
43
|
-
}
|
|
44
|
-
function getRemotes(devRemotes, skipRemotes, config, context, pathToManifestFile) {
|
|
45
|
-
const collectedRemotes = new Set();
|
|
46
|
-
const { remotes, dynamicRemotes } = extractRemoteProjectsFromConfig(config, pathToManifestFile);
|
|
47
|
-
remotes.forEach((r) => collectRemoteProjects(r, collectedRemotes, context));
|
|
48
|
-
const remotesToSkip = new Set((0, find_matching_projects_1.findMatchingProjects)(skipRemotes, context.projectGraph.nodes) ?? []);
|
|
49
|
-
if (remotesToSkip.size > 0) {
|
|
50
|
-
devkit_1.logger.info(`Remotes not served automatically: ${[...remotesToSkip.values()].join(', ')}`);
|
|
51
|
-
}
|
|
52
|
-
const knownRemotes = Array.from(collectedRemotes).filter((r) => !remotesToSkip.has(r));
|
|
53
|
-
const knownDynamicRemotes = dynamicRemotes.filter((r) => !remotesToSkip.has(r) && context.projectGraph.nodes[r]);
|
|
54
|
-
devkit_1.logger.info(`NX Starting module federation dev-server for ${chalk_1.default.bold(context.projectName)} with ${[...knownRemotes, ...knownDynamicRemotes].length} remotes`);
|
|
55
|
-
const devServeApps = new Set(!devRemotes
|
|
56
|
-
? []
|
|
57
|
-
: Array.isArray(devRemotes)
|
|
58
|
-
? (0, find_matching_projects_1.findMatchingProjects)(devRemotes, context.projectGraph.nodes)
|
|
59
|
-
: (0, find_matching_projects_1.findMatchingProjects)([devRemotes], context.projectGraph.nodes));
|
|
60
|
-
const staticRemotes = knownRemotes.filter((r) => !devServeApps.has(r));
|
|
61
|
-
const devServeRemotes = [...knownRemotes, ...knownDynamicRemotes].filter((r) => devServeApps.has(r));
|
|
62
|
-
const staticDynamicRemotes = knownDynamicRemotes.filter((r) => !devServeApps.has(r));
|
|
63
|
-
const remotePorts = [...devServeRemotes, ...staticDynamicRemotes].map((r) => context.projectGraph.nodes[r].data.targets['serve'].options.port);
|
|
64
|
-
const staticRemotePort = Math.max(...[
|
|
65
|
-
...remotePorts,
|
|
66
|
-
...staticRemotes.map((r) => context.projectGraph.nodes[r].data.targets['serve'].options.port),
|
|
67
|
-
]) +
|
|
68
|
-
(remotesToSkip.size + 1);
|
|
69
|
-
return {
|
|
70
|
-
staticRemotes,
|
|
71
|
-
devRemotes: devServeRemotes,
|
|
72
|
-
dynamicRemotes: staticDynamicRemotes,
|
|
73
|
-
remotePorts,
|
|
74
|
-
staticRemotePort,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
function getModuleFederationConfig(tsconfigPath, workspaceRoot, projectRoot, pluginName = 'react') {
|
|
78
|
-
const moduleFederationConfigPathJS = (0, path_1.join)(workspaceRoot, projectRoot, 'module-federation.config.js');
|
|
79
|
-
const moduleFederationConfigPathTS = (0, path_1.join)(workspaceRoot, projectRoot, 'module-federation.config.ts');
|
|
80
|
-
let moduleFederationConfigPath = moduleFederationConfigPathJS;
|
|
81
|
-
// create a no-op so this can be called with issue
|
|
82
|
-
const fullTSconfigPath = tsconfigPath.startsWith(workspaceRoot)
|
|
83
|
-
? tsconfigPath
|
|
84
|
-
: (0, path_1.join)(workspaceRoot, tsconfigPath);
|
|
85
|
-
let cleanupTranspiler = () => undefined;
|
|
86
|
-
if ((0, fs_1.existsSync)(moduleFederationConfigPathTS)) {
|
|
87
|
-
cleanupTranspiler = (0, internal_1.registerTsProject)(fullTSconfigPath);
|
|
88
|
-
moduleFederationConfigPath = moduleFederationConfigPathTS;
|
|
89
|
-
}
|
|
90
|
-
try {
|
|
91
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
92
|
-
const config = require(moduleFederationConfigPath);
|
|
93
|
-
cleanupTranspiler();
|
|
94
|
-
return config.default || config;
|
|
95
|
-
}
|
|
96
|
-
catch {
|
|
97
|
-
throw new Error(`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nx/${pluginName}:host"?\nSee: https://nx.dev/concepts/more-concepts/faster-builds-with-module-federation`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./share"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./dependencies"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./package-json"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./remotes"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./models"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./get-remotes-for-host"), exports);
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { moduleFederationPlugin } from '@module-federation/sdk';
|
|
2
|
-
import type { NormalModuleReplacementPlugin } from '@rspack/core';
|
|
3
|
-
export type ModuleFederationLibrary = {
|
|
4
|
-
type: string;
|
|
5
|
-
name: string;
|
|
6
|
-
};
|
|
7
|
-
export type WorkspaceLibrary = {
|
|
8
|
-
name: string;
|
|
9
|
-
root: string;
|
|
10
|
-
importKey: string | undefined;
|
|
11
|
-
};
|
|
12
|
-
export type SharedWorkspaceLibraryConfig = {
|
|
13
|
-
getAliases: () => Record<string, string>;
|
|
14
|
-
getLibraries: (projectRoot: string, eager?: boolean) => Record<string, SharedLibraryConfig>;
|
|
15
|
-
getReplacementPlugin: () => NormalModuleReplacementPlugin;
|
|
16
|
-
};
|
|
17
|
-
export type Remotes = Array<string | [remoteName: string, remoteUrl: string]>;
|
|
18
|
-
export interface SharedLibraryConfig {
|
|
19
|
-
singleton?: boolean;
|
|
20
|
-
strictVersion?: boolean;
|
|
21
|
-
requiredVersion?: false | string;
|
|
22
|
-
eager?: boolean;
|
|
23
|
-
}
|
|
24
|
-
export type SharedFunction = (libraryName: string, sharedConfig: SharedLibraryConfig) => undefined | false | SharedLibraryConfig;
|
|
25
|
-
export type AdditionalSharedConfig = Array<string | [libraryName: string, sharedConfig: SharedLibraryConfig] | {
|
|
26
|
-
libraryName: string;
|
|
27
|
-
sharedConfig: SharedLibraryConfig;
|
|
28
|
-
}>;
|
|
29
|
-
export interface ModuleFederationConfig {
|
|
30
|
-
name: string;
|
|
31
|
-
remotes?: Remotes;
|
|
32
|
-
library?: ModuleFederationLibrary;
|
|
33
|
-
exposes?: Record<string, string>;
|
|
34
|
-
shared?: SharedFunction;
|
|
35
|
-
additionalShared?: AdditionalSharedConfig;
|
|
36
|
-
/**
|
|
37
|
-
* `nxRuntimeLibraryControlPlugin` is a runtime module federation plugin to ensure
|
|
38
|
-
* that shared libraries are resolved from a remote with live reload capabilities.
|
|
39
|
-
* If you run into any issues with loading shared libraries, try disabling this option.
|
|
40
|
-
*/
|
|
41
|
-
disableNxRuntimeLibraryControlPlugin?: boolean;
|
|
42
|
-
}
|
|
43
|
-
export type NxModuleFederationConfigOverride = Omit<moduleFederationPlugin.ModuleFederationPluginOptions, 'exposes' | 'remotes' | 'name' | 'library' | 'shared' | 'filename' | 'remoteType'>;
|
|
44
|
-
export type WorkspaceLibrarySecondaryEntryPoint = {
|
|
45
|
-
name: string;
|
|
46
|
-
path: string;
|
|
47
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readRootPackageJson = readRootPackageJson;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
function readRootPackageJson() {
|
|
7
|
-
const pkgJsonPath = (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, 'package.json');
|
|
8
|
-
if (!(0, fs_1.existsSync)(pkgJsonPath)) {
|
|
9
|
-
throw new Error('NX MF: Could not find root package.json to determine dependency versions.');
|
|
10
|
-
}
|
|
11
|
-
return (0, devkit_1.readJsonFile)(pkgJsonPath);
|
|
12
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ExecutorContext } from '@nx/devkit';
|
|
2
|
-
export type StaticRemoteConfig = {
|
|
3
|
-
basePath: string;
|
|
4
|
-
outputPath: string;
|
|
5
|
-
urlSegment: string;
|
|
6
|
-
port: number;
|
|
7
|
-
};
|
|
8
|
-
export type StaticRemotesConfig = {
|
|
9
|
-
remotes: string[];
|
|
10
|
-
config: Record<string, StaticRemoteConfig> | undefined;
|
|
11
|
-
};
|
|
12
|
-
export declare function parseStaticRemotesConfig(staticRemotes: string[] | undefined, context: ExecutorContext): StaticRemotesConfig;
|
|
13
|
-
export declare function parseStaticSsrRemotesConfig(staticRemotes: string[] | undefined, context: ExecutorContext): StaticRemotesConfig;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseStaticRemotesConfig = parseStaticRemotesConfig;
|
|
4
|
-
exports.parseStaticSsrRemotesConfig = parseStaticSsrRemotesConfig;
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
function parseStaticRemotesConfig(staticRemotes, context) {
|
|
7
|
-
if (!staticRemotes?.length) {
|
|
8
|
-
return { remotes: [], config: undefined };
|
|
9
|
-
}
|
|
10
|
-
const config = {};
|
|
11
|
-
for (const app of staticRemotes) {
|
|
12
|
-
const outputPath = context.projectGraph.nodes[app].data.targets['build'].options.outputPath;
|
|
13
|
-
const basePath = (0, path_1.dirname)(outputPath);
|
|
14
|
-
const urlSegment = (0, path_1.basename)(outputPath);
|
|
15
|
-
const port = context.projectGraph.nodes[app].data.targets['serve'].options.port;
|
|
16
|
-
config[app] = { basePath, outputPath, urlSegment, port };
|
|
17
|
-
}
|
|
18
|
-
return { remotes: staticRemotes, config };
|
|
19
|
-
}
|
|
20
|
-
function parseStaticSsrRemotesConfig(staticRemotes, context) {
|
|
21
|
-
if (!staticRemotes?.length) {
|
|
22
|
-
return { remotes: [], config: undefined };
|
|
23
|
-
}
|
|
24
|
-
const config = {};
|
|
25
|
-
for (const app of staticRemotes) {
|
|
26
|
-
const outputPath = (0, path_1.dirname)(context.projectGraph.nodes[app].data.targets['build'].options.outputPath // dist/checkout/browser -> checkout
|
|
27
|
-
);
|
|
28
|
-
const basePath = (0, path_1.dirname)(outputPath); // dist/checkout -> dist
|
|
29
|
-
const urlSegment = (0, path_1.basename)(outputPath); // dist/checkout -> checkout
|
|
30
|
-
const port = context.projectGraph.nodes[app].data.targets['serve'].options.port;
|
|
31
|
-
config[app] = { basePath, outputPath, urlSegment, port };
|
|
32
|
-
}
|
|
33
|
-
return { remotes: staticRemotes, config };
|
|
34
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const runtimeStore = {
|
|
4
|
-
sharedPackagesFromDev: {},
|
|
5
|
-
};
|
|
6
|
-
if (process.env.NX_MF_DEV_REMOTES) {
|
|
7
|
-
// process.env.NX_MF_DEV_REMOTES is replaced by an array value via DefinePlugin, even though the original value is a stringified array.
|
|
8
|
-
runtimeStore.devRemotes = process.env
|
|
9
|
-
.NX_MF_DEV_REMOTES;
|
|
10
|
-
}
|
|
11
|
-
const nxRuntimeLibraryControlPlugin = function () {
|
|
12
|
-
return {
|
|
13
|
-
name: 'nx-runtime-library-control-plugin',
|
|
14
|
-
beforeInit(args) {
|
|
15
|
-
runtimeStore.name = args.options.name;
|
|
16
|
-
return args;
|
|
17
|
-
},
|
|
18
|
-
resolveShare: (args) => {
|
|
19
|
-
const { shareScopeMap, scope, pkgName, version, GlobalFederation } = args;
|
|
20
|
-
const originalResolver = args.resolver;
|
|
21
|
-
args.resolver = function () {
|
|
22
|
-
if (!runtimeStore.sharedPackagesFromDev[pkgName]) {
|
|
23
|
-
if (!GlobalFederation.__INSTANCES__) {
|
|
24
|
-
return originalResolver();
|
|
25
|
-
}
|
|
26
|
-
else if (!runtimeStore.devRemotes) {
|
|
27
|
-
return originalResolver();
|
|
28
|
-
}
|
|
29
|
-
const devRemoteInstanceToUse = GlobalFederation.__INSTANCES__.find((instance) => instance.options.shared[pkgName] &&
|
|
30
|
-
runtimeStore.devRemotes.find((dr) => instance.name === dr));
|
|
31
|
-
if (!devRemoteInstanceToUse) {
|
|
32
|
-
return originalResolver();
|
|
33
|
-
}
|
|
34
|
-
runtimeStore.sharedPackagesFromDev[pkgName] =
|
|
35
|
-
devRemoteInstanceToUse.name;
|
|
36
|
-
}
|
|
37
|
-
const remoteInstanceName = runtimeStore.sharedPackagesFromDev[pkgName];
|
|
38
|
-
const remoteInstance = GlobalFederation.__INSTANCES__.find((instance) => instance.name === remoteInstanceName);
|
|
39
|
-
try {
|
|
40
|
-
const remotePkgInfo = remoteInstance.options.shared[pkgName].find((shared) => shared.from === remoteInstanceName);
|
|
41
|
-
remotePkgInfo.useIn.push(runtimeStore.name);
|
|
42
|
-
remotePkgInfo.useIn = Array.from(new Set(remotePkgInfo.useIn));
|
|
43
|
-
shareScopeMap[scope][pkgName][version] = remotePkgInfo;
|
|
44
|
-
return remotePkgInfo;
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
return originalResolver();
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
return args;
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
exports.default = nxRuntimeLibraryControlPlugin;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AdditionalSharedConfig, ModuleFederationConfig, ModuleFederationLibrary, Remotes, SharedFunction, SharedLibraryConfig, SharedWorkspaceLibraryConfig, WorkspaceLibrary, WorkspaceLibrarySecondaryEntryPoint } from './models';
|
|
2
|
-
import { applyAdditionalShared, applySharedFunction, getNpmPackageSharedConfig, sharePackages, shareWorkspaceLibraries } from './share';
|
|
3
|
-
import { mapRemotes, mapRemotesForSSR } from './remotes';
|
|
4
|
-
import { getDependentPackagesForProject } from './dependencies';
|
|
5
|
-
import { readRootPackageJson } from './package-json';
|
|
6
|
-
import { withModuleFederation } from './with-module-federation/with-module-federation';
|
|
7
|
-
import { withModuleFederationForSSR } from './with-module-federation/with-module-federation-ssr';
|
|
8
|
-
export { AdditionalSharedConfig, applyAdditionalShared, applySharedFunction, getDependentPackagesForProject, getNpmPackageSharedConfig, mapRemotes, mapRemotesForSSR, ModuleFederationConfig, ModuleFederationLibrary, readRootPackageJson, Remotes, SharedFunction, SharedLibraryConfig, SharedWorkspaceLibraryConfig, sharePackages, shareWorkspaceLibraries, withModuleFederation, withModuleFederationForSSR, WorkspaceLibrary, WorkspaceLibrarySecondaryEntryPoint, };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withModuleFederationForSSR = exports.withModuleFederation = exports.shareWorkspaceLibraries = exports.sharePackages = exports.readRootPackageJson = exports.mapRemotesForSSR = exports.mapRemotes = exports.getNpmPackageSharedConfig = exports.getDependentPackagesForProject = exports.applySharedFunction = exports.applyAdditionalShared = void 0;
|
|
4
|
-
const share_1 = require("./share");
|
|
5
|
-
Object.defineProperty(exports, "applyAdditionalShared", { enumerable: true, get: function () { return share_1.applyAdditionalShared; } });
|
|
6
|
-
Object.defineProperty(exports, "applySharedFunction", { enumerable: true, get: function () { return share_1.applySharedFunction; } });
|
|
7
|
-
Object.defineProperty(exports, "getNpmPackageSharedConfig", { enumerable: true, get: function () { return share_1.getNpmPackageSharedConfig; } });
|
|
8
|
-
Object.defineProperty(exports, "sharePackages", { enumerable: true, get: function () { return share_1.sharePackages; } });
|
|
9
|
-
Object.defineProperty(exports, "shareWorkspaceLibraries", { enumerable: true, get: function () { return share_1.shareWorkspaceLibraries; } });
|
|
10
|
-
const remotes_1 = require("./remotes");
|
|
11
|
-
Object.defineProperty(exports, "mapRemotes", { enumerable: true, get: function () { return remotes_1.mapRemotes; } });
|
|
12
|
-
Object.defineProperty(exports, "mapRemotesForSSR", { enumerable: true, get: function () { return remotes_1.mapRemotesForSSR; } });
|
|
13
|
-
const dependencies_1 = require("./dependencies");
|
|
14
|
-
Object.defineProperty(exports, "getDependentPackagesForProject", { enumerable: true, get: function () { return dependencies_1.getDependentPackagesForProject; } });
|
|
15
|
-
const package_json_1 = require("./package-json");
|
|
16
|
-
Object.defineProperty(exports, "readRootPackageJson", { enumerable: true, get: function () { return package_json_1.readRootPackageJson; } });
|
|
17
|
-
const with_module_federation_1 = require("./with-module-federation/with-module-federation");
|
|
18
|
-
Object.defineProperty(exports, "withModuleFederation", { enumerable: true, get: function () { return with_module_federation_1.withModuleFederation; } });
|
|
19
|
-
const with_module_federation_ssr_1 = require("./with-module-federation/with-module-federation-ssr");
|
|
20
|
-
Object.defineProperty(exports, "withModuleFederationForSSR", { enumerable: true, get: function () { return with_module_federation_ssr_1.withModuleFederationForSSR; } });
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Remotes } from './models';
|
|
2
|
-
/**
|
|
3
|
-
* Map remote names to a format that can be understood and used by Module
|
|
4
|
-
* Federation.
|
|
5
|
-
*
|
|
6
|
-
* @param remotes - The remotes to map
|
|
7
|
-
* @param remoteEntryExt - The file extension of the remoteEntry file
|
|
8
|
-
* @param determineRemoteUrl - The function used to lookup the URL of the served remote
|
|
9
|
-
*/
|
|
10
|
-
export declare function mapRemotes(remotes: Remotes, remoteEntryExt: 'js' | 'mjs', determineRemoteUrl: (remote: string) => string): Record<string, string>;
|
|
11
|
-
/**
|
|
12
|
-
* Map remote names to a format that can be understood and used by Module
|
|
13
|
-
* Federation.
|
|
14
|
-
*
|
|
15
|
-
* @param remotes - The remotes to map
|
|
16
|
-
* @param remoteEntryExt - The file extension of the remoteEntry file
|
|
17
|
-
* @param determineRemoteUrl - The function used to lookup the URL of the served remote
|
|
18
|
-
*/
|
|
19
|
-
export declare function mapRemotesForSSR(remotes: Remotes, remoteEntryExt: 'js' | 'mjs', determineRemoteUrl: (remote: string) => string): Record<string, string>;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapRemotes = mapRemotes;
|
|
4
|
-
exports.mapRemotesForSSR = mapRemotesForSSR;
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
/**
|
|
7
|
-
* Map remote names to a format that can be understood and used by Module
|
|
8
|
-
* Federation.
|
|
9
|
-
*
|
|
10
|
-
* @param remotes - The remotes to map
|
|
11
|
-
* @param remoteEntryExt - The file extension of the remoteEntry file
|
|
12
|
-
* @param determineRemoteUrl - The function used to lookup the URL of the served remote
|
|
13
|
-
*/
|
|
14
|
-
function mapRemotes(remotes, remoteEntryExt, determineRemoteUrl) {
|
|
15
|
-
const mappedRemotes = {};
|
|
16
|
-
for (const nxRemoteProjectName of remotes) {
|
|
17
|
-
if (Array.isArray(nxRemoteProjectName)) {
|
|
18
|
-
const mfRemoteName = normalizeRemoteName(nxRemoteProjectName[0]);
|
|
19
|
-
mappedRemotes[mfRemoteName] = handleArrayRemote(nxRemoteProjectName, remoteEntryExt);
|
|
20
|
-
}
|
|
21
|
-
else if (typeof nxRemoteProjectName === 'string') {
|
|
22
|
-
const mfRemoteName = normalizeRemoteName(nxRemoteProjectName);
|
|
23
|
-
mappedRemotes[mfRemoteName] = handleStringRemote(nxRemoteProjectName, determineRemoteUrl);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return mappedRemotes;
|
|
27
|
-
}
|
|
28
|
-
// Helper function to deal with remotes that are arrays
|
|
29
|
-
function handleArrayRemote(remote, remoteEntryExt) {
|
|
30
|
-
let [nxRemoteProjectName, remoteLocation] = remote;
|
|
31
|
-
const mfRemoteName = normalizeRemoteName(nxRemoteProjectName);
|
|
32
|
-
const remoteLocationExt = (0, path_1.extname)(remoteLocation);
|
|
33
|
-
// If remote location already has .js or .mjs extension
|
|
34
|
-
if (['.js', '.mjs', '.json'].includes(remoteLocationExt)) {
|
|
35
|
-
return remoteLocation;
|
|
36
|
-
}
|
|
37
|
-
const baseRemote = remoteLocation.endsWith('/')
|
|
38
|
-
? remoteLocation.slice(0, -1)
|
|
39
|
-
: remoteLocation;
|
|
40
|
-
const globalPrefix = `${normalizeRemoteName(mfRemoteName)}@`;
|
|
41
|
-
// if the remote is defined with anything other than http then we assume it's a promise based remote
|
|
42
|
-
// In that case we should use what the user provides as the remote location
|
|
43
|
-
if (!remoteLocation.startsWith('promise new Promise')) {
|
|
44
|
-
return `${globalPrefix}${baseRemote}/remoteEntry.${remoteEntryExt}`;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
return remoteLocation;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// Helper function to deal with remotes that are strings
|
|
51
|
-
function handleStringRemote(nxRemoteProjectName, determineRemoteUrl) {
|
|
52
|
-
const globalPrefix = `${normalizeRemoteName(nxRemoteProjectName)}@`;
|
|
53
|
-
return `${globalPrefix}${determineRemoteUrl(nxRemoteProjectName)}`;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Map remote names to a format that can be understood and used by Module
|
|
57
|
-
* Federation.
|
|
58
|
-
*
|
|
59
|
-
* @param remotes - The remotes to map
|
|
60
|
-
* @param remoteEntryExt - The file extension of the remoteEntry file
|
|
61
|
-
* @param determineRemoteUrl - The function used to lookup the URL of the served remote
|
|
62
|
-
*/
|
|
63
|
-
function mapRemotesForSSR(remotes, remoteEntryExt, determineRemoteUrl) {
|
|
64
|
-
const mappedRemotes = {};
|
|
65
|
-
for (const remote of remotes) {
|
|
66
|
-
if (Array.isArray(remote)) {
|
|
67
|
-
let [nxRemoteProjectName, remoteLocation] = remote;
|
|
68
|
-
const mfRemoteName = normalizeRemoteName(nxRemoteProjectName);
|
|
69
|
-
const remoteLocationExt = (0, path_1.extname)(remoteLocation);
|
|
70
|
-
mappedRemotes[mfRemoteName] = `${mfRemoteName}@${['.js', '.mjs'].includes(remoteLocationExt)
|
|
71
|
-
? remoteLocation
|
|
72
|
-
: `${remoteLocation.endsWith('/')
|
|
73
|
-
? remoteLocation.slice(0, -1)
|
|
74
|
-
: remoteLocation}/remoteEntry.${remoteEntryExt}`}`;
|
|
75
|
-
}
|
|
76
|
-
else if (typeof remote === 'string') {
|
|
77
|
-
const mfRemoteName = normalizeRemoteName(remote);
|
|
78
|
-
mappedRemotes[mfRemoteName] = `${mfRemoteName}@${determineRemoteUrl(remote)}`;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return mappedRemotes;
|
|
82
|
-
}
|
|
83
|
-
function normalizeRemoteName(nxRemoteProjectName) {
|
|
84
|
-
return nxRemoteProjectName.replace(/-/g, '_');
|
|
85
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { WorkspaceLibrary } from './models';
|
|
2
|
-
import { WorkspaceLibrarySecondaryEntryPoint } from './models';
|
|
3
|
-
export declare function collectWorkspaceLibrarySecondaryEntryPoints(library: WorkspaceLibrary, tsconfigPathAliases: Record<string, string[]>): WorkspaceLibrarySecondaryEntryPoint[];
|
|
4
|
-
export declare function getNonNodeModulesSubDirs(directory: string): string[];
|
|
5
|
-
export declare function recursivelyCollectSecondaryEntryPointsFromDirectory(pkgName: string, pkgVersion: string, pkgRoot: string, mainEntryPointExports: any | undefined, directories: string[], collectedPackages: {
|
|
6
|
-
name: string;
|
|
7
|
-
version: string;
|
|
8
|
-
}[]): void;
|
|
9
|
-
export declare function collectPackageSecondaryEntryPoints(pkgName: string, pkgVersion: string, collectedPackages: {
|
|
10
|
-
name: string;
|
|
11
|
-
version: string;
|
|
12
|
-
}[]): void;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.collectWorkspaceLibrarySecondaryEntryPoints = collectWorkspaceLibrarySecondaryEntryPoints;
|
|
4
|
-
exports.getNonNodeModulesSubDirs = getNonNodeModulesSubDirs;
|
|
5
|
-
exports.recursivelyCollectSecondaryEntryPointsFromDirectory = recursivelyCollectSecondaryEntryPointsFromDirectory;
|
|
6
|
-
exports.collectPackageSecondaryEntryPoints = collectPackageSecondaryEntryPoints;
|
|
7
|
-
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
const fs_1 = require("fs");
|
|
9
|
-
const package_json_1 = require("nx/src/utils/package-json");
|
|
10
|
-
const path_1 = require("path");
|
|
11
|
-
function collectWorkspaceLibrarySecondaryEntryPoints(library, tsconfigPathAliases) {
|
|
12
|
-
const libraryRoot = (0, path_1.join)(devkit_1.workspaceRoot, library.root);
|
|
13
|
-
const needsSecondaryEntryPointsCollected = (0, fs_1.existsSync)((0, path_1.join)(libraryRoot, 'ng-package.json'));
|
|
14
|
-
const secondaryEntryPoints = [];
|
|
15
|
-
if (needsSecondaryEntryPointsCollected) {
|
|
16
|
-
const tsConfigAliasesForLibWithSecondaryEntryPoints = Object.entries(tsconfigPathAliases).reduce((acc, [tsKey, tsPaths]) => {
|
|
17
|
-
if (!tsKey.startsWith(library.importKey)) {
|
|
18
|
-
return { ...acc };
|
|
19
|
-
}
|
|
20
|
-
if (tsPaths.some((path) => path.startsWith(`${library.root}/`))) {
|
|
21
|
-
acc = { ...acc, [tsKey]: tsPaths };
|
|
22
|
-
}
|
|
23
|
-
return acc;
|
|
24
|
-
}, {});
|
|
25
|
-
for (const [alias] of Object.entries(tsConfigAliasesForLibWithSecondaryEntryPoints)) {
|
|
26
|
-
const pathToLib = (0, path_1.dirname)((0, path_1.join)(devkit_1.workspaceRoot, tsconfigPathAliases[alias][0]));
|
|
27
|
-
let searchDir = pathToLib;
|
|
28
|
-
while (searchDir !== libraryRoot) {
|
|
29
|
-
if ((0, fs_1.existsSync)((0, path_1.join)(searchDir, 'ng-package.json'))) {
|
|
30
|
-
secondaryEntryPoints.push({ name: alias, path: pathToLib });
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
searchDir = (0, path_1.dirname)(searchDir);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return secondaryEntryPoints;
|
|
38
|
-
}
|
|
39
|
-
function getNonNodeModulesSubDirs(directory) {
|
|
40
|
-
return (0, fs_1.readdirSync)(directory)
|
|
41
|
-
.filter((file) => file !== 'node_modules')
|
|
42
|
-
.map((file) => (0, path_1.join)(directory, file))
|
|
43
|
-
.filter((file) => (0, fs_1.lstatSync)(file).isDirectory());
|
|
44
|
-
}
|
|
45
|
-
function recursivelyCollectSecondaryEntryPointsFromDirectory(pkgName, pkgVersion, pkgRoot, mainEntryPointExports, directories, collectedPackages) {
|
|
46
|
-
for (const directory of directories) {
|
|
47
|
-
const packageJsonPath = (0, path_1.join)(directory, 'package.json');
|
|
48
|
-
const relativeEntryPointPath = (0, path_1.relative)(pkgRoot, directory);
|
|
49
|
-
const entryPointName = (0, devkit_1.joinPathFragments)(pkgName, relativeEntryPointPath);
|
|
50
|
-
if ((0, fs_1.existsSync)(packageJsonPath)) {
|
|
51
|
-
try {
|
|
52
|
-
// require the secondary entry point to try to rule out sample code
|
|
53
|
-
require.resolve(entryPointName, { paths: [devkit_1.workspaceRoot] });
|
|
54
|
-
const { name } = (0, devkit_1.readJsonFile)(packageJsonPath);
|
|
55
|
-
// further check to make sure what we were able to require is the
|
|
56
|
-
// same as the package name
|
|
57
|
-
if (name === entryPointName) {
|
|
58
|
-
collectedPackages.push({ name, version: pkgVersion });
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
// do nothing
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else if (mainEntryPointExports) {
|
|
66
|
-
// if the package.json doesn't exist, check if the directory is
|
|
67
|
-
// exported by the main entry point
|
|
68
|
-
const entryPointExportKey = `./${relativeEntryPointPath}`;
|
|
69
|
-
const entryPointInfo = mainEntryPointExports[entryPointExportKey];
|
|
70
|
-
if (entryPointInfo) {
|
|
71
|
-
collectedPackages.push({
|
|
72
|
-
name: entryPointName,
|
|
73
|
-
version: pkgVersion,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
const subDirs = getNonNodeModulesSubDirs(directory);
|
|
78
|
-
recursivelyCollectSecondaryEntryPointsFromDirectory(pkgName, pkgVersion, pkgRoot, mainEntryPointExports, subDirs, collectedPackages);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
function collectPackageSecondaryEntryPoints(pkgName, pkgVersion, collectedPackages) {
|
|
82
|
-
let pathToPackage;
|
|
83
|
-
let packageJsonPath;
|
|
84
|
-
let packageJson;
|
|
85
|
-
try {
|
|
86
|
-
({ path: packageJsonPath, packageJson } = (0, package_json_1.readModulePackageJson)(pkgName));
|
|
87
|
-
pathToPackage = (0, path_1.dirname)(packageJsonPath);
|
|
88
|
-
}
|
|
89
|
-
catch {
|
|
90
|
-
// the package.json might not resolve if the package has the "exports"
|
|
91
|
-
// entry and is not exporting the package.json file, fall back to trying
|
|
92
|
-
// to find it from the top-level node_modules
|
|
93
|
-
pathToPackage = (0, path_1.join)(devkit_1.workspaceRoot, 'node_modules', pkgName);
|
|
94
|
-
packageJsonPath = (0, path_1.join)(pathToPackage, 'package.json');
|
|
95
|
-
if (!(0, fs_1.existsSync)(packageJsonPath)) {
|
|
96
|
-
// might not exist if it's nested in another package, just return here
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
packageJson = (0, devkit_1.readJsonFile)(packageJsonPath);
|
|
100
|
-
}
|
|
101
|
-
const { exports } = packageJson;
|
|
102
|
-
const subDirs = getNonNodeModulesSubDirs(pathToPackage);
|
|
103
|
-
recursivelyCollectSecondaryEntryPointsFromDirectory(pkgName, pkgVersion, pathToPackage, exports, subDirs, collectedPackages);
|
|
104
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { type ProjectGraph } from '@nx/devkit';
|
|
2
|
-
import type { SharedLibraryConfig, SharedWorkspaceLibraryConfig, WorkspaceLibrary } from './models';
|
|
3
|
-
import { AdditionalSharedConfig, SharedFunction } from './models';
|
|
4
|
-
/**
|
|
5
|
-
* Build an object of functions to be used with the ModuleFederationPlugin to
|
|
6
|
-
* share Nx Workspace Libraries between Hosts and Remotes.
|
|
7
|
-
*
|
|
8
|
-
* @param workspaceLibs - The Nx Workspace Libraries to share
|
|
9
|
-
* @param tsConfigPath - The path to TS Config File that contains the Path Mappings for the Libraries
|
|
10
|
-
*/
|
|
11
|
-
export declare function shareWorkspaceLibraries(workspaceLibs: WorkspaceLibrary[], tsConfigPath?: string): SharedWorkspaceLibraryConfig;
|
|
12
|
-
/**
|
|
13
|
-
* Build the Module Federation Share Config for a specific package and the
|
|
14
|
-
* specified version of that package.
|
|
15
|
-
* @param pkgName - Name of the package to share
|
|
16
|
-
* @param version - Version of the package to require by other apps in the Module Federation setup
|
|
17
|
-
*/
|
|
18
|
-
export declare function getNpmPackageSharedConfig(pkgName: string, version: string): SharedLibraryConfig | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Create a dictionary of packages and their Module Federation Shared Config
|
|
21
|
-
* from an array of package names.
|
|
22
|
-
*
|
|
23
|
-
* Lookup the versions of the packages from the root package.json file in the
|
|
24
|
-
* workspace.
|
|
25
|
-
* @param packages - Array of package names as strings
|
|
26
|
-
*/
|
|
27
|
-
export declare function sharePackages(packages: string[]): Record<string, SharedLibraryConfig>;
|
|
28
|
-
/**
|
|
29
|
-
* Apply a custom function provided by the user that will modify the Shared Config
|
|
30
|
-
* of the dependencies for the Module Federation build.
|
|
31
|
-
*
|
|
32
|
-
* @param sharedConfig - The original Shared Config to be modified
|
|
33
|
-
* @param sharedFn - The custom function to run
|
|
34
|
-
*/
|
|
35
|
-
export declare function applySharedFunction(sharedConfig: Record<string, SharedLibraryConfig>, sharedFn: SharedFunction | undefined): void;
|
|
36
|
-
/**
|
|
37
|
-
* Add additional dependencies to the shared package that may not have been
|
|
38
|
-
* discovered by the project graph.
|
|
39
|
-
*
|
|
40
|
-
* This can be useful for applications that use a Dependency Injection system
|
|
41
|
-
* that expects certain Singleton values to be present in the shared injection
|
|
42
|
-
* hierarchy.
|
|
43
|
-
*
|
|
44
|
-
* @param sharedConfig - The original Shared Config
|
|
45
|
-
* @param additionalShared - The additional dependencies to add
|
|
46
|
-
* @param projectGraph - The Nx project graph
|
|
47
|
-
*/
|
|
48
|
-
export declare function applyAdditionalShared(sharedConfig: Record<string, SharedLibraryConfig>, additionalShared: AdditionalSharedConfig | undefined, projectGraph: ProjectGraph): void;
|