module-federation-angular-adapter 0.2200.0
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/LICENSE +8 -0
- package/README.md +115 -0
- package/builders.json +15 -0
- package/collection.json +27 -0
- package/generators.json +12 -0
- package/migration-collection.json +6 -0
- package/package.json +69 -0
- package/src/builders/build/builder.d.ts +7 -0
- package/src/builders/build/builder.d.ts.map +1 -0
- package/src/builders/build/builder.js +413 -0
- package/src/builders/build/federation-build-notifier.d.ts +70 -0
- package/src/builders/build/federation-build-notifier.d.ts.map +1 -0
- package/src/builders/build/federation-build-notifier.js +186 -0
- package/src/builders/build/get-externals.d.ts +18 -0
- package/src/builders/build/get-externals.d.ts.map +1 -0
- package/src/builders/build/get-externals.js +19 -0
- package/src/builders/build/i18n.d.ts +21 -0
- package/src/builders/build/i18n.d.ts.map +1 -0
- package/src/builders/build/i18n.js +73 -0
- package/src/builders/build/schema.d.ts +35 -0
- package/src/builders/build/schema.json +93 -0
- package/src/builders/build/setup-builder-env-variables.d.ts +1 -0
- package/src/builders/build/setup-builder-env-variables.d.ts.map +1 -0
- package/src/builders/build/setup-builder-env-variables.js +9 -0
- package/src/builders/build/update-index-html.d.ts +5 -0
- package/src/builders/build/update-index-html.d.ts.map +1 -0
- package/src/builders/build/update-index-html.js +33 -0
- package/src/builders/remote/assets.d.ts +14 -0
- package/src/builders/remote/assets.d.ts.map +1 -0
- package/src/builders/remote/assets.js +49 -0
- package/src/builders/remote/builder.d.ts +13 -0
- package/src/builders/remote/builder.d.ts.map +1 -0
- package/src/builders/remote/builder.js +153 -0
- package/src/builders/remote/change-watcher.d.ts +10 -0
- package/src/builders/remote/change-watcher.d.ts.map +1 -0
- package/src/builders/remote/change-watcher.js +35 -0
- package/src/builders/remote/infer-config-path.d.ts +2 -0
- package/src/builders/remote/infer-config-path.d.ts.map +1 -0
- package/src/builders/remote/infer-config-path.js +10 -0
- package/src/builders/remote/resolve-ng-options.d.ts +24 -0
- package/src/builders/remote/resolve-ng-options.d.ts.map +1 -0
- package/src/builders/remote/resolve-ng-options.js +28 -0
- package/src/builders/remote/schema.d.ts +26 -0
- package/src/builders/remote/schema.json +116 -0
- package/src/config/angular-locales.d.ts +6 -0
- package/src/config/angular-locales.d.ts.map +1 -0
- package/src/config/angular-locales.js +23 -0
- package/src/config/angular-skip-list.d.ts +3 -0
- package/src/config/angular-skip-list.d.ts.map +1 -0
- package/src/config/angular-skip-list.js +23 -0
- package/src/config/with-module-federation.d.ts +72 -0
- package/src/config/with-module-federation.d.ts.map +1 -0
- package/src/config/with-module-federation.js +72 -0
- package/src/config.d.ts +4 -0
- package/src/config.d.ts.map +1 -0
- package/src/config.js +3 -0
- package/src/generators/native-federation/files/src/index.ts__template__ +1 -0
- package/src/generators/native-federation/generator.d.ts +4 -0
- package/src/generators/native-federation/generator.d.ts.map +1 -0
- package/src/generators/native-federation/generator.js +45 -0
- package/src/generators/native-federation/schema.d.ts +5 -0
- package/src/generators/native-federation/schema.json +29 -0
- package/src/index.d.ts +82 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +132 -0
- package/src/internal.d.ts +2 -0
- package/src/internal.d.ts.map +1 -0
- package/src/internal.js +1 -0
- package/src/schematics/appbuilder/schema.d.ts +3 -0
- package/src/schematics/appbuilder/schema.json +17 -0
- package/src/schematics/appbuilder/schematic.d.ts +5 -0
- package/src/schematics/appbuilder/schematic.d.ts.map +1 -0
- package/src/schematics/appbuilder/schematic.js +80 -0
- package/src/schematics/init/files/federation.config.mjs__tmpl__ +35 -0
- package/src/schematics/init/schema.d.ts +5 -0
- package/src/schematics/init/schema.json +30 -0
- package/src/schematics/init/schematic.d.ts +6 -0
- package/src/schematics/init/schematic.d.ts.map +1 -0
- package/src/schematics/init/schematic.js +38 -0
- package/src/schematics/init/steps/add-dependencies.d.ts +3 -0
- package/src/schematics/init/steps/add-dependencies.d.ts.map +1 -0
- package/src/schematics/init/steps/add-dependencies.js +25 -0
- package/src/schematics/init/steps/generate-federation-config.d.ts +4 -0
- package/src/schematics/init/steps/generate-federation-config.d.ts.map +1 -0
- package/src/schematics/init/steps/generate-federation-config.js +15 -0
- package/src/schematics/init/steps/generate-remote-map.d.ts +2 -0
- package/src/schematics/init/steps/generate-remote-map.d.ts.map +1 -0
- package/src/schematics/init/steps/generate-remote-map.js +20 -0
- package/src/schematics/init/steps/make-main-async.d.ts +4 -0
- package/src/schematics/init/steps/make-main-async.d.ts.map +1 -0
- package/src/schematics/init/steps/make-main-async.js +35 -0
- package/src/schematics/init/steps/normalize-options.d.ts +20 -0
- package/src/schematics/init/steps/normalize-options.d.ts.map +1 -0
- package/src/schematics/init/steps/normalize-options.js +64 -0
- package/src/schematics/init/steps/update-package-json.d.ts +3 -0
- package/src/schematics/init/steps/update-package-json.d.ts.map +1 -0
- package/src/schematics/init/steps/update-package-json.js +19 -0
- package/src/schematics/init/steps/update-polyfills.d.ts +3 -0
- package/src/schematics/init/steps/update-polyfills.d.ts.map +1 -0
- package/src/schematics/init/steps/update-polyfills.js +21 -0
- package/src/schematics/init/steps/update-workspace-config.d.ts +4 -0
- package/src/schematics/init/steps/update-workspace-config.d.ts.map +1 -0
- package/src/schematics/init/steps/update-workspace-config.js +76 -0
- package/src/schematics/remove/schema.d.ts +3 -0
- package/src/schematics/remove/schema.json +17 -0
- package/src/schematics/remove/schematic.d.ts +5 -0
- package/src/schematics/remove/schematic.d.ts.map +1 -0
- package/src/schematics/remove/schematic.js +106 -0
- package/src/tools/esbuild/angular-bundler.d.ts +10 -0
- package/src/tools/esbuild/angular-bundler.d.ts.map +1 -0
- package/src/tools/esbuild/angular-bundler.js +134 -0
- package/src/tools/esbuild/create-awaitable-compiler-plugin.d.ts +6 -0
- package/src/tools/esbuild/create-awaitable-compiler-plugin.d.ts.map +1 -0
- package/src/tools/esbuild/create-awaitable-compiler-plugin.js +29 -0
- package/src/tools/esbuild/create-federation-tsconfig.d.ts +7 -0
- package/src/tools/esbuild/create-federation-tsconfig.d.ts.map +1 -0
- package/src/tools/esbuild/create-federation-tsconfig.js +46 -0
- package/src/tools/esbuild/shared-mappings-plugin.d.ts +4 -0
- package/src/tools/esbuild/shared-mappings-plugin.d.ts.map +1 -0
- package/src/tools/esbuild/shared-mappings-plugin.js +33 -0
- package/src/tools/mf/build-for-federation.d.ts +70 -0
- package/src/tools/mf/build-for-federation.d.ts.map +1 -0
- package/src/tools/mf/build-for-federation.js +75 -0
- package/src/tools/mf/federation-entry-points.d.ts +23 -0
- package/src/tools/mf/federation-entry-points.d.ts.map +1 -0
- package/src/tools/mf/federation-entry-points.js +13 -0
- package/src/tools/mf/federation-plugin.d.ts +11 -0
- package/src/tools/mf/federation-plugin.d.ts.map +1 -0
- package/src/tools/mf/federation-plugin.js +12 -0
- package/src/tools/mf/federation-side-build.d.ts +21 -0
- package/src/tools/mf/federation-side-build.d.ts.map +1 -0
- package/src/tools/mf/federation-side-build.js +27 -0
- package/src/tools/mf/to-plugin-config.d.ts +37 -0
- package/src/tools/mf/to-plugin-config.d.ts.map +1 -0
- package/src/tools/mf/to-plugin-config.js +33 -0
- package/src/utils/check-for-invalid-imports.d.ts +2 -0
- package/src/utils/check-for-invalid-imports.d.ts.map +1 -0
- package/src/utils/check-for-invalid-imports.js +29 -0
- package/src/utils/normalize-build-options.d.ts +22 -0
- package/src/utils/normalize-build-options.d.ts.map +1 -0
- package/src/utils/normalize-build-options.js +45 -0
- package/src/utils/normalize-context-options.d.ts +24 -0
- package/src/utils/normalize-context-options.d.ts.map +1 -0
- package/src/utils/normalize-context-options.js +18 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-polyfills.d.ts","sourceRoot":"","sources":["../../../../../src/schematics/init/steps/update-polyfills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvD,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,QAMvE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function updatePolyfills(tree, polyfills) {
|
|
2
|
+
if (typeof polyfills === 'string') {
|
|
3
|
+
updatePolyfillsFile(tree, polyfills);
|
|
4
|
+
}
|
|
5
|
+
else {
|
|
6
|
+
updatePolyfillsArray(tree, polyfills);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function updatePolyfillsFile(tree, polyfills) {
|
|
10
|
+
let polyfillsContent = tree.readText(polyfills);
|
|
11
|
+
if (!polyfillsContent.includes('es-module-shims')) {
|
|
12
|
+
polyfillsContent += `\nimport 'es-module-shims';\n`;
|
|
13
|
+
tree.overwrite(polyfills, polyfillsContent);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function updatePolyfillsArray(_tree, polyfills) {
|
|
17
|
+
const polyfillsConfig = polyfills;
|
|
18
|
+
if (!polyfillsConfig.includes('es-module-shims')) {
|
|
19
|
+
polyfillsConfig.push('es-module-shims');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Tree } from "@angular-devkit/schematics";
|
|
2
|
+
import type { NormalizedOptions } from "./normalize-options.js";
|
|
3
|
+
export declare function updateWorkspaceConfig(tree: Tree, options: NormalizedOptions, workspace: any, workspaceFileName: string): void;
|
|
4
|
+
//# sourceMappingURL=update-workspace-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-workspace-config.d.ts","sourceRoot":"","sources":["../../../../../src/schematics/init/steps/update-workspace-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE,GAAG,EACd,iBAAiB,EAAE,MAAM,QAmG1B"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export function updateWorkspaceConfig(tree, options, workspace, workspaceFileName) {
|
|
2
|
+
const { projectConfig, projectName, port } = options;
|
|
3
|
+
if (!projectConfig?.architect?.build || !projectConfig?.architect?.serve) {
|
|
4
|
+
throw new Error(`The project doesn't have a build or serve target in angular.json!`);
|
|
5
|
+
}
|
|
6
|
+
if (projectConfig.architect.build.builder ===
|
|
7
|
+
"module-federation-angular-adapter:build") {
|
|
8
|
+
console.log("native-federation builder is already set, skipping workspace setup.");
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const originalBuild = projectConfig.architect.build;
|
|
12
|
+
// Force the esbuild application builder. The build target Angular scaffolds is
|
|
13
|
+
// either `@angular-devkit/build-angular:application` or `@angular/build:application`;
|
|
14
|
+
// both normalize to the latter here.
|
|
15
|
+
console.log("Switching project to the application builder using esbuild ...");
|
|
16
|
+
originalBuild.builder = "@angular/build:application";
|
|
17
|
+
delete originalBuild.configurations?.development?.buildOptimizer;
|
|
18
|
+
delete originalBuild.configurations?.development?.vendorChunk;
|
|
19
|
+
if (originalBuild.options.main) {
|
|
20
|
+
const main = originalBuild.options.main;
|
|
21
|
+
delete originalBuild.options.main;
|
|
22
|
+
originalBuild.options.browser = main;
|
|
23
|
+
}
|
|
24
|
+
delete originalBuild.options.commonChunk;
|
|
25
|
+
projectConfig.architect.esbuild = originalBuild;
|
|
26
|
+
projectConfig.architect.build = {
|
|
27
|
+
builder: "module-federation-angular-adapter:build",
|
|
28
|
+
options: {
|
|
29
|
+
cacheExternalArtifacts: true,
|
|
30
|
+
},
|
|
31
|
+
configurations: {
|
|
32
|
+
production: {
|
|
33
|
+
target: `${projectName}:esbuild:production`,
|
|
34
|
+
},
|
|
35
|
+
development: {
|
|
36
|
+
target: `${projectName}:esbuild:development`,
|
|
37
|
+
dev: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
defaultConfiguration: "production",
|
|
41
|
+
};
|
|
42
|
+
const serve = projectConfig.architect.serve;
|
|
43
|
+
serve.options ??= {};
|
|
44
|
+
serve.options.port = port;
|
|
45
|
+
delete serve.options.commonChunk;
|
|
46
|
+
const serveProd = projectConfig.architect.serve.configurations?.production;
|
|
47
|
+
if (serveProd) {
|
|
48
|
+
serveProd.buildTarget = `${projectName}:esbuild:production`;
|
|
49
|
+
delete serveProd.browserTarget;
|
|
50
|
+
}
|
|
51
|
+
const serveDev = projectConfig.architect.serve.configurations?.development;
|
|
52
|
+
if (serveDev) {
|
|
53
|
+
serveDev.buildTarget = `${projectName}:esbuild:development`;
|
|
54
|
+
delete serveDev.browserTarget;
|
|
55
|
+
}
|
|
56
|
+
projectConfig.architect["serve-original"] = projectConfig.architect.serve;
|
|
57
|
+
projectConfig.architect.serve = {
|
|
58
|
+
builder: "module-federation-angular-adapter:build",
|
|
59
|
+
options: {
|
|
60
|
+
target: `${projectName}:serve-original:development`,
|
|
61
|
+
rebuildDelay: 500,
|
|
62
|
+
cacheExternalArtifacts: true,
|
|
63
|
+
dev: true,
|
|
64
|
+
devServer: true,
|
|
65
|
+
port: 0,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
const serveSsr = projectConfig.architect["serve-ssr"];
|
|
69
|
+
if (serveSsr && !serveSsr.options) {
|
|
70
|
+
serveSsr.options = {};
|
|
71
|
+
}
|
|
72
|
+
if (serveSsr) {
|
|
73
|
+
serveSsr.options.port = port;
|
|
74
|
+
}
|
|
75
|
+
tree.overwrite(workspaceFileName, JSON.stringify(workspace, null, "\t"));
|
|
76
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "nf",
|
|
4
|
+
"title": "",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The project to remove native federation from",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-prompt": "Project name (press enter for default project)"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Rule, Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import type { NfSchematicSchema } from './schema.js';
|
|
3
|
+
export default function remove(options: NfSchematicSchema): Rule;
|
|
4
|
+
export declare function getWorkspaceFileName(tree: Tree): string;
|
|
5
|
+
//# sourceMappingURL=schematic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schematic.d.ts","sourceRoot":"","sources":["../../../../src/schematics/remove/schematic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAcrD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAgB/D;AA+GD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAUvD"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
export default function remove(options) {
|
|
3
|
+
return async function (tree) {
|
|
4
|
+
const workspaceFileName = getWorkspaceFileName(tree);
|
|
5
|
+
const workspace = JSON.parse(tree.read(workspaceFileName)?.toString('utf8') ?? '{}');
|
|
6
|
+
const normalized = normalizeOptions(options, workspace);
|
|
7
|
+
const { polyfills, projectRoot } = normalized;
|
|
8
|
+
const bootstrapPath = path.join(projectRoot, 'src/bootstrap.ts');
|
|
9
|
+
const mainPath = path.join(projectRoot, 'src/main.ts');
|
|
10
|
+
makeMainSync(tree, bootstrapPath, mainPath);
|
|
11
|
+
updatePolyfills(tree, polyfills);
|
|
12
|
+
updateWorkspaceConfig(tree, normalized, workspace, workspaceFileName);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function makeMainSync(tree, bootstrapPath, mainPath) {
|
|
16
|
+
if (tree.exists(bootstrapPath) && tree.exists(mainPath)) {
|
|
17
|
+
tree.delete(mainPath);
|
|
18
|
+
tree.rename(bootstrapPath, mainPath);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function updateWorkspaceConfig(tree, options, workspace, workspaceFileName) {
|
|
22
|
+
const { projectConfig } = options;
|
|
23
|
+
if (!projectConfig?.architect?.build || !projectConfig?.architect?.serve) {
|
|
24
|
+
throw new Error(`The project doesn't have a build or serve target in angular.json!`);
|
|
25
|
+
}
|
|
26
|
+
if (projectConfig.architect.esbuild) {
|
|
27
|
+
projectConfig.architect.build = projectConfig.architect.esbuild;
|
|
28
|
+
delete projectConfig.architect.esbuild;
|
|
29
|
+
}
|
|
30
|
+
if (projectConfig.architect['serve-original']) {
|
|
31
|
+
projectConfig.architect.serve = projectConfig.architect['serve-original'];
|
|
32
|
+
delete projectConfig.architect['serve-original'];
|
|
33
|
+
}
|
|
34
|
+
if (projectConfig.architect.serve) {
|
|
35
|
+
const conf = projectConfig.architect.serve.configurations;
|
|
36
|
+
conf.production.buildTarget = conf.production.buildTarget.replace(':esbuild:', ':build:');
|
|
37
|
+
conf.development.buildTarget = conf.development.buildTarget.replace(':esbuild:', ':build:');
|
|
38
|
+
}
|
|
39
|
+
tree.overwrite(workspaceFileName, JSON.stringify(workspace, null, '\t'));
|
|
40
|
+
}
|
|
41
|
+
function normalizeOptions(options, workspace) {
|
|
42
|
+
const projects = Object.keys(workspace.projects);
|
|
43
|
+
if (!options.project && projects.length === 0) {
|
|
44
|
+
throw new Error(`No default project found. Please specifiy a project name!`);
|
|
45
|
+
}
|
|
46
|
+
if (!options.project) {
|
|
47
|
+
console.log('Using first configured project as default project: ' + projects[0]);
|
|
48
|
+
options.project = projects[0];
|
|
49
|
+
}
|
|
50
|
+
const projectName = options.project;
|
|
51
|
+
const projectConfig = workspace.projects[projectName];
|
|
52
|
+
if (!projectConfig) {
|
|
53
|
+
throw new Error(`Project ${projectName} not found in angular.json.`);
|
|
54
|
+
}
|
|
55
|
+
const projectRoot = projectConfig.root?.replace(/\\/g, '/');
|
|
56
|
+
const projectSourceRoot = projectConfig.sourceRoot?.replace(/\\/g, '/');
|
|
57
|
+
const manifestPath = path
|
|
58
|
+
.join(projectRoot, 'src/assets/federation.manifest.json')
|
|
59
|
+
.replace(/\\/g, '/');
|
|
60
|
+
const main = projectConfig.architect.build.options.main;
|
|
61
|
+
if (!projectConfig.architect.build.options.polyfills) {
|
|
62
|
+
projectConfig.architect.build.options.polyfills = [];
|
|
63
|
+
}
|
|
64
|
+
const polyfills = projectConfig.architect.build.options.polyfills;
|
|
65
|
+
return {
|
|
66
|
+
polyfills,
|
|
67
|
+
projectName,
|
|
68
|
+
projectRoot,
|
|
69
|
+
projectSourceRoot,
|
|
70
|
+
manifestPath,
|
|
71
|
+
projectConfig,
|
|
72
|
+
main,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function updatePolyfills(tree, polyfills) {
|
|
76
|
+
if (typeof polyfills === 'string') {
|
|
77
|
+
updatePolyfillsFile(tree, polyfills);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
updatePolyfillsArray(tree, polyfills);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function updatePolyfillsFile(tree, polyfills) {
|
|
84
|
+
let polyfillsContent = tree.readText(polyfills);
|
|
85
|
+
if (polyfillsContent.includes('es-module-shims')) {
|
|
86
|
+
polyfillsContent = polyfillsContent.replace(`import 'es-module-shims';`, '');
|
|
87
|
+
tree.overwrite(polyfills, polyfillsContent);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function updatePolyfillsArray(_tree, polyfills) {
|
|
91
|
+
const polyfillsConfig = polyfills;
|
|
92
|
+
const index = polyfillsConfig.findIndex(p => p === 'es-module-shims');
|
|
93
|
+
if (index === -1) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
polyfillsConfig.splice(index, 1);
|
|
97
|
+
}
|
|
98
|
+
export function getWorkspaceFileName(tree) {
|
|
99
|
+
if (tree.exists('angular.json')) {
|
|
100
|
+
return 'angular.json';
|
|
101
|
+
}
|
|
102
|
+
if (tree.exists('workspace.json')) {
|
|
103
|
+
return 'workspace.json';
|
|
104
|
+
}
|
|
105
|
+
throw new Error("angular.json or workspace.json expected! Did you call this in your project's root?");
|
|
106
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as esbuild from 'esbuild';
|
|
2
|
+
import type { NormalizedContextOptions } from '../../utils/normalize-context-options.js';
|
|
3
|
+
export declare function createAngularEsbuildContext(options: NormalizedContextOptions, extra?: {
|
|
4
|
+
extraPlugins?: esbuild.Plugin[];
|
|
5
|
+
write?: boolean;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
ctx: esbuild.BuildContext;
|
|
8
|
+
pluginDisposed: Promise<void>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=angular-bundler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular-bundler.d.ts","sourceRoot":"","sources":["../../../../src/tools/esbuild/angular-bundler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAiBnC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAGzF,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,wBAAwB,EAOjC,KAAK,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAC/D,OAAO,CAAC;IACT,GAAG,EAAE,OAAO,CAAC,YAAY,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B,CAAC,CAsJD"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import * as esbuild from 'esbuild';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import { transformSupportedBrowsersToTargets, getSupportedBrowsers, generateSearchDirectories, findTailwindConfiguration, loadPostcssConfiguration, } from '@angular/build/private';
|
|
5
|
+
import { normalizeOptimization, normalizeSourceMaps } from '../../utils/normalize-build-options.js';
|
|
6
|
+
import { createAwaitableCompilerPlugin } from './create-awaitable-compiler-plugin.js';
|
|
7
|
+
import { updateFederationTsConfig } from './create-federation-tsconfig.js';
|
|
8
|
+
export async function createAngularEsbuildContext(options,
|
|
9
|
+
// `extraPlugins`: appended after the Angular compiler — the MF side build (M2.1)
|
|
10
|
+
// injects `moduleFederationPlugin` here (one-pass composition).
|
|
11
|
+
// `write`: defaults to `false` (NF's adapter wrote outputs itself via writeResult).
|
|
12
|
+
// The MF side build MUST set `true` (M2.2): the plugin's `onEnd` reads the
|
|
13
|
+
// emitted container off disk (`fs.readFileSync`) to inject the module map, so it
|
|
14
|
+
// does not honor `write:false`.
|
|
15
|
+
extra = {}) {
|
|
16
|
+
const { builderOptions, context, entryPoints, external, outdir, cache, dev, hash, chunks, platform, optimizedMappings, } = options;
|
|
17
|
+
let tsConfigPath = options.tsConfigPath;
|
|
18
|
+
if (!tsConfigPath) {
|
|
19
|
+
throw new Error('tsConfigPath is required for Angular/esbuild context creation');
|
|
20
|
+
}
|
|
21
|
+
const workspaceRoot = context.workspaceRoot;
|
|
22
|
+
const projectMetadata = await context.getProjectMetadata(context.target.project);
|
|
23
|
+
const projectRoot = path.join(workspaceRoot, projectMetadata['root'] ?? '');
|
|
24
|
+
const browsers = getSupportedBrowsers(projectRoot, context.logger);
|
|
25
|
+
const target = transformSupportedBrowsersToTargets(browsers);
|
|
26
|
+
const optimizationOptions = normalizeOptimization(builderOptions.optimization);
|
|
27
|
+
const sourcemapOptions = normalizeSourceMaps(builderOptions.sourceMap);
|
|
28
|
+
const searchDirectories = await generateSearchDirectories([projectRoot, workspaceRoot]);
|
|
29
|
+
const postcssConfiguration = await loadPostcssConfiguration(searchDirectories);
|
|
30
|
+
const tailwindConfiguration = postcssConfiguration
|
|
31
|
+
? undefined
|
|
32
|
+
: await getTailwindConfig(searchDirectories);
|
|
33
|
+
const outputNames = {
|
|
34
|
+
bundles: '[name]',
|
|
35
|
+
media: 'media/[name]',
|
|
36
|
+
};
|
|
37
|
+
let fileReplacements;
|
|
38
|
+
if (builderOptions.fileReplacements) {
|
|
39
|
+
for (const replacement of builderOptions.fileReplacements) {
|
|
40
|
+
fileReplacements ??= {};
|
|
41
|
+
fileReplacements[path.join(workspaceRoot, replacement.replace)] = path.join(workspaceRoot, replacement.with);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (optimizedMappings) {
|
|
45
|
+
updateFederationTsConfig(workspaceRoot, tsConfigPath, entryPoints);
|
|
46
|
+
}
|
|
47
|
+
tsConfigPath = path.join(workspaceRoot, tsConfigPath);
|
|
48
|
+
const pluginOptions = {
|
|
49
|
+
sourcemap: !!sourcemapOptions.scripts && (sourcemapOptions.hidden ? 'external' : true),
|
|
50
|
+
thirdPartySourcemaps: sourcemapOptions.vendor,
|
|
51
|
+
tsconfig: tsConfigPath,
|
|
52
|
+
jit: false,
|
|
53
|
+
advancedOptimizations: !dev,
|
|
54
|
+
fileReplacements,
|
|
55
|
+
sourceFileCache: cache.bundlerCache,
|
|
56
|
+
loadResultCache: cache.bundlerCache.loadResultCache,
|
|
57
|
+
incremental: true,
|
|
58
|
+
includeTestMetadata: !optimizationOptions.scripts,
|
|
59
|
+
instrumentForCoverage: builderOptions.instrumentForCoverage,
|
|
60
|
+
};
|
|
61
|
+
const stylesheetBundlerOptions = {
|
|
62
|
+
workspaceRoot,
|
|
63
|
+
inlineFonts: !!optimizationOptions.fonts.inline,
|
|
64
|
+
optimization: !!optimizationOptions.styles.minify,
|
|
65
|
+
sourcemap:
|
|
66
|
+
// Hidden component stylesheet sourcemaps are inaccessible which is effectively
|
|
67
|
+
// the same as being disabled. Disabling has the advantage of avoiding the overhead
|
|
68
|
+
// of sourcemap processing.
|
|
69
|
+
sourcemapOptions.styles && !sourcemapOptions.hidden ? 'linked' : false,
|
|
70
|
+
outputNames,
|
|
71
|
+
includePaths: builderOptions.stylePreprocessorOptions?.includePaths,
|
|
72
|
+
sass: builderOptions?.stylePreprocessorOptions?.sass,
|
|
73
|
+
externalDependencies: external,
|
|
74
|
+
target,
|
|
75
|
+
inlineStyleLanguage: builderOptions.inlineStyleLanguage ?? 'css',
|
|
76
|
+
preserveSymlinks: builderOptions.preserveSymlinks,
|
|
77
|
+
tailwindConfiguration,
|
|
78
|
+
postcssConfiguration,
|
|
79
|
+
cacheOptions: {
|
|
80
|
+
enabled: true,
|
|
81
|
+
basePath: cache.cachePath,
|
|
82
|
+
path: cache.cachePath,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
const commonjsPluginModule = await import('@chialab/esbuild-plugin-commonjs');
|
|
86
|
+
const commonjsPlugin = commonjsPluginModule.default;
|
|
87
|
+
stylesheetBundlerOptions.externalDependencies = [];
|
|
88
|
+
const [compilerPlugin, pluginDisposed] = createAwaitableCompilerPlugin(pluginOptions, stylesheetBundlerOptions);
|
|
89
|
+
const customPlugins = Array.isArray(options.builderOptions.plugins)
|
|
90
|
+
? options.builderOptions.plugins
|
|
91
|
+
: [];
|
|
92
|
+
const config = {
|
|
93
|
+
entryPoints: entryPoints.map(ep => ({
|
|
94
|
+
in: ep.fileName,
|
|
95
|
+
out: path.parse(ep.outName).name,
|
|
96
|
+
})),
|
|
97
|
+
outdir,
|
|
98
|
+
entryNames: hash ? '[name]-[hash]' : '[name]',
|
|
99
|
+
write: extra.write ?? false,
|
|
100
|
+
external,
|
|
101
|
+
logLevel: 'warning',
|
|
102
|
+
bundle: true,
|
|
103
|
+
sourcemap: sourcemapOptions.scripts,
|
|
104
|
+
minify: !dev,
|
|
105
|
+
supported: {
|
|
106
|
+
'async-await': false,
|
|
107
|
+
'object-rest-spread': false,
|
|
108
|
+
},
|
|
109
|
+
splitting: chunks,
|
|
110
|
+
platform: platform ?? 'browser',
|
|
111
|
+
format: 'esm',
|
|
112
|
+
target: target,
|
|
113
|
+
logLimit: 0,
|
|
114
|
+
plugins: [compilerPlugin, commonjsPlugin(), ...customPlugins, ...(extra.extraPlugins ?? [])],
|
|
115
|
+
define: {
|
|
116
|
+
...(dev ? {} : { ngDevMode: 'false' }),
|
|
117
|
+
ngJitMode: 'false',
|
|
118
|
+
},
|
|
119
|
+
...(builderOptions.loader ? { loader: builderOptions.loader } : {}),
|
|
120
|
+
resolveExtensions: ['.ts', '.tsx', '.mjs', '.js', '.cjs'],
|
|
121
|
+
};
|
|
122
|
+
const ctx = await esbuild.context(config);
|
|
123
|
+
return { ctx, pluginDisposed };
|
|
124
|
+
}
|
|
125
|
+
async function getTailwindConfig(searchDirectories) {
|
|
126
|
+
const tailwindConfigurationPath = findTailwindConfiguration(searchDirectories);
|
|
127
|
+
if (!tailwindConfigurationPath) {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
file: tailwindConfigurationPath,
|
|
132
|
+
package: createRequire(tailwindConfigurationPath).resolve('tailwindcss'),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as esbuild from 'esbuild';
|
|
2
|
+
import { createCompilerPlugin } from '@angular/build/private';
|
|
3
|
+
type CreateCompilerPluginParams = Parameters<typeof createCompilerPlugin>;
|
|
4
|
+
export declare function createAwaitableCompilerPlugin(pluginOptions: CreateCompilerPluginParams[0], styleOptions: CreateCompilerPluginParams[1]): [esbuild.Plugin, Promise<void>];
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=create-awaitable-compiler-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-awaitable-compiler-plugin.d.ts","sourceRoot":"","sources":["../../../../src/tools/esbuild/create-awaitable-compiler-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,KAAK,0BAA0B,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE1E,wBAAgB,6BAA6B,CAC3C,aAAa,EAAE,0BAA0B,CAAC,CAAC,CAAC,EAC5C,YAAY,EAAE,0BAA0B,CAAC,CAAC,CAAC,GAC1C,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CA+BjC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createCompilerPlugin } from '@angular/build/private';
|
|
2
|
+
export function createAwaitableCompilerPlugin(pluginOptions, styleOptions) {
|
|
3
|
+
const originalPlugin = createCompilerPlugin(pluginOptions, styleOptions);
|
|
4
|
+
let resolveDispose;
|
|
5
|
+
const onDisposePromise = new Promise(resolve => {
|
|
6
|
+
resolveDispose = resolve;
|
|
7
|
+
});
|
|
8
|
+
const wrappedPlugin = {
|
|
9
|
+
...originalPlugin,
|
|
10
|
+
setup(build) {
|
|
11
|
+
// Wrap the build object to intercept onDispose
|
|
12
|
+
const wrappedBuild = new Proxy(build, {
|
|
13
|
+
get(target, prop) {
|
|
14
|
+
if (prop === 'onDispose') {
|
|
15
|
+
return (callback) => {
|
|
16
|
+
return target.onDispose(() => {
|
|
17
|
+
callback();
|
|
18
|
+
resolveDispose();
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return target[prop];
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
return originalPlugin.setup(wrappedBuild);
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
return [wrappedPlugin, onDisposePromise];
|
|
29
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EntryPoint } from '@softarc/native-federation';
|
|
2
|
+
/**
|
|
3
|
+
* Updates the federation tsconfig to include optimized mapping entry points.
|
|
4
|
+
* Only modifies the file when there are non-local entry points to add.
|
|
5
|
+
*/
|
|
6
|
+
export declare function updateFederationTsConfig(workspaceRoot: string, tsConfigPath: string, entryPoints: EntryPoint[]): void;
|
|
7
|
+
//# sourceMappingURL=create-federation-tsconfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-federation-tsconfig.d.ts","sourceRoot":"","sources":["../../../../src/tools/esbuild/create-federation-tsconfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAM7D;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,UAAU,EAAE,GACxB,IAAI,CA8BN"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import JSON5 from 'json5';
|
|
4
|
+
import { isDeepStrictEqual } from 'util';
|
|
5
|
+
/**
|
|
6
|
+
* Updates the federation tsconfig to include optimized mapping entry points.
|
|
7
|
+
* Only modifies the file when there are non-local entry points to add.
|
|
8
|
+
*/
|
|
9
|
+
export function updateFederationTsConfig(workspaceRoot, tsConfigPath, entryPoints) {
|
|
10
|
+
const fullTsConfigPath = path.join(workspaceRoot, tsConfigPath);
|
|
11
|
+
const tsconfigDir = path.dirname(fullTsConfigPath);
|
|
12
|
+
const filtered = entryPoints
|
|
13
|
+
.filter(ep => !ep.fileName.startsWith('.'))
|
|
14
|
+
.map(ep => path.relative(tsconfigDir, ep.fileName).replace(/\\\\/g, '/'));
|
|
15
|
+
if (filtered.length === 0) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const tsconfigAsString = fs.readFileSync(fullTsConfigPath, 'utf-8');
|
|
19
|
+
const tsconfig = JSON5.parse(tsconfigAsString);
|
|
20
|
+
if (!tsconfig.include) {
|
|
21
|
+
tsconfig.include = [];
|
|
22
|
+
}
|
|
23
|
+
for (const ep of filtered) {
|
|
24
|
+
if (!tsconfig.include.includes(ep)) {
|
|
25
|
+
tsconfig.include.push(ep);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const content = JSON5.stringify(tsconfig, null, 2);
|
|
29
|
+
if (!doesFileExistAndJsonEqual(fullTsConfigPath, content)) {
|
|
30
|
+
fs.writeFileSync(fullTsConfigPath, JSON.stringify(tsconfig, null, 2));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function doesFileExistAndJsonEqual(filePath, content) {
|
|
34
|
+
if (!fs.existsSync(filePath)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const currentContent = fs.readFileSync(filePath, 'utf-8');
|
|
39
|
+
const currentJson = JSON5.parse(currentContent);
|
|
40
|
+
const newJson = JSON5.parse(content);
|
|
41
|
+
return isDeepStrictEqual(currentJson, newJson);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-mappings-plugin.d.ts","sourceRoot":"","sources":["../../../../src/tools/esbuild/shared-mappings-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,SAAS,CAAC;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAOxE,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,YAAY,GAAG,MAAM,CA8B5E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
// TODO: `createSharedMappingsPlugin` currently has no callers. Before deleting,
|
|
3
|
+
// verify its responsibility (rewriting relative imports of shared/exposed paths
|
|
4
|
+
// to externals) isn't already handled elsewhere — e.g. the federation adapter's
|
|
5
|
+
// `external` list / mapped-paths handling in `angular-bundler.ts`. If covered,
|
|
6
|
+
// remove this file and its spec; otherwise wire it back into the esbuild config.
|
|
7
|
+
export function createSharedMappingsPlugin(mappedPaths) {
|
|
8
|
+
return {
|
|
9
|
+
name: 'custom',
|
|
10
|
+
setup(build) {
|
|
11
|
+
build.onResolve({ filter: /^[.]/ }, async (args) => {
|
|
12
|
+
let mappedPath = undefined;
|
|
13
|
+
let isSelf = false;
|
|
14
|
+
if (args.kind === 'import-statement') {
|
|
15
|
+
const importPath = path.join(args.resolveDir, args.path);
|
|
16
|
+
if (mappedPaths) {
|
|
17
|
+
mappedPath = Object.keys(mappedPaths).find(p => importPath.startsWith(path.dirname(p)));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (mappedPath) {
|
|
21
|
+
isSelf = args.importer.startsWith(path.dirname(mappedPath));
|
|
22
|
+
}
|
|
23
|
+
if (mappedPath && !isSelf) {
|
|
24
|
+
return {
|
|
25
|
+
path: mappedPaths[mappedPath],
|
|
26
|
+
external: true,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return {};
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { ApplicationBuilderOptions } from '@angular/build';
|
|
2
|
+
import type { BuilderContext } from '@angular-devkit/architect';
|
|
3
|
+
import type { SourceFileCache } from '@angular/build/private';
|
|
4
|
+
import type { FederationCache } from '@softarc/native-federation';
|
|
5
|
+
import type { FederationSharedInput } from './to-plugin-config.js';
|
|
6
|
+
import type { NfInternalOptions } from '../../builders/build/schema.js';
|
|
7
|
+
/**
|
|
8
|
+
* Minimal normalized-config shape this driver reads. NF's
|
|
9
|
+
* `NormalizedFederationConfig` satisfies it structurally (transitional — Phase 3
|
|
10
|
+
* replaces the config loader with `withModuleFederation`).
|
|
11
|
+
*/
|
|
12
|
+
export interface NormalizedConfig {
|
|
13
|
+
name: string;
|
|
14
|
+
filename?: string;
|
|
15
|
+
exposes?: Record<string, {
|
|
16
|
+
file: string;
|
|
17
|
+
}>;
|
|
18
|
+
shared?: Record<string, FederationSharedInput>;
|
|
19
|
+
sharedMappings?: Record<string, string>;
|
|
20
|
+
remotes?: Record<string, string>;
|
|
21
|
+
chunks?: boolean;
|
|
22
|
+
/** NF puts `features` on the config; `optimizedMappings` reads `ignoreUnusedDeps`. */
|
|
23
|
+
features?: {
|
|
24
|
+
ignoreUnusedDeps?: boolean;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** Federation options the builder already computed (subset NF's `fedOptions` provides). */
|
|
28
|
+
export interface FederationOptions {
|
|
29
|
+
outputPath: string;
|
|
30
|
+
/** Optional to match NF's `fedOptions.tsConfig`; `createAngularEsbuildContext` guards undefined at runtime. */
|
|
31
|
+
tsConfig?: string;
|
|
32
|
+
dev?: boolean;
|
|
33
|
+
watch?: boolean;
|
|
34
|
+
federationCache: FederationCache<SourceFileCache>;
|
|
35
|
+
}
|
|
36
|
+
/** MF-shaped build result (replaces NF's `FederationInfo`); consumed by i18n (M4.2). */
|
|
37
|
+
export interface MfFederationInfo {
|
|
38
|
+
name: string;
|
|
39
|
+
exposes: string[];
|
|
40
|
+
writtenFiles: string[];
|
|
41
|
+
}
|
|
42
|
+
/** Build context for the MF side build. */
|
|
43
|
+
export interface BuilderCtx {
|
|
44
|
+
builderOptions: ApplicationBuilderOptions & NfInternalOptions;
|
|
45
|
+
context: BuilderContext;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Stateful MF side builder (M2.1) — the `buildForFederation` + `rebuildForFederation`
|
|
49
|
+
* replacement. Holds one esbuild `BuildContext` (Angular compiler +
|
|
50
|
+
* `moduleFederationPlugin`, one-pass) across rebuilds so `ng serve` incremental
|
|
51
|
+
* DX (M2.6) is preserved — mirroring NF's adapter lifecycle (setup → build →
|
|
52
|
+
* rebuild* → dispose). NF's four shared-bundling phases are gone (MF owns shared,
|
|
53
|
+
* finding #6); the plugin emits `remoteEntry.js` + `mf-manifest.json`.
|
|
54
|
+
*
|
|
55
|
+
* Field values mirror NF's `bundleExposedAndMappings` exactly, so it is
|
|
56
|
+
* correct-by-construction against the existing context machinery.
|
|
57
|
+
*
|
|
58
|
+
* ⚠️ Type-checked, not yet runtime-verified: emitting against a real Angular app
|
|
59
|
+
* needs a browser/Angular env absent here (same limit as the M1.7 e2e).
|
|
60
|
+
*/
|
|
61
|
+
export interface MfFederationBuilder {
|
|
62
|
+
/** Initial build: bundle exposed modules + emit container/manifest. */
|
|
63
|
+
build(): Promise<MfFederationInfo>;
|
|
64
|
+
/** Incremental rebuild for `ng serve` (invalidates the changed files first). */
|
|
65
|
+
rebuild(modifiedFiles?: string[]): Promise<MfFederationInfo>;
|
|
66
|
+
/** Tear down the esbuild context (call once when the build/watch ends). */
|
|
67
|
+
dispose(): Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
export declare function createMfFederationBuilder(config: NormalizedConfig, fedOptions: FederationOptions, externals: string[], ctx: BuilderCtx): Promise<MfFederationBuilder>;
|
|
70
|
+
//# sourceMappingURL=build-for-federation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-for-federation.d.ts","sourceRoot":"","sources":["../../../../src/tools/mf/build-for-federation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAQlE,OAAO,KAAK,EAEV,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAExE;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IAC/C,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sFAAsF;IACtF,QAAQ,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC3C;AAED,2FAA2F;AAC3F,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,+GAA+G;IAC/G,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC;CACnD;AAED,wFAAwF;AACxF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AA4BD,2CAA2C;AAC3C,MAAM,WAAW,UAAU;IACzB,cAAc,EAAE,yBAAyB,GAAG,iBAAiB,CAAC;IAC9D,OAAO,EAAE,cAAc,CAAC;CACzB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,mBAAmB;IAClC,uEAAuE;IACvE,KAAK,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnC,gFAAgF;IAChF,OAAO,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC7D,2EAA2E;IAC3E,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,iBAAiB,EAC7B,SAAS,EAAE,MAAM,EAAE,EACnB,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,mBAAmB,CAAC,CAuD9B"}
|