@angular-architects/native-federation 16.3.4 → 17.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,19 +22,18 @@ We will at least provide a new version of this package per Angular major. If nec
22
22
 
23
23
  - Use version 16.1.x for Angular 16.1.x
24
24
  - Use version 16.2.x for Angular 16.2.x
25
-
26
- We expect the APIs to stabilize so that we only need one major per Angular major in the future.
27
-
25
+ - Use version 17.x for Angular 17.x
26
+
28
27
  ## Credits
29
28
 
30
29
  Big thanks to:
31
30
 
32
- - [Zack [Jackson](https://twitter.com/ScriptedAlchemy) for initially coming up with the great idea of Module Federation and its successful mental model
31
+ - [Zack Jackson](https://twitter.com/ScriptedAlchemy) for initially coming up with the great idea of Module Federation and its successful mental model
33
32
  - [Tobias Koppers](https://twitter.com/wSokra) for helping to make Module Federation a first class citizen of webpack
34
- - [Florian [Rappl](https://twitter.com/FlorianRappl) for a good discussion about these topics during a speakers dinner in Nuremberg
33
+ - [Florian Rappl](https://twitter.com/FlorianRappl) for a good discussion about these topics during a speakers dinner in Nuremberg
35
34
  - [The Nx Team](https://twitter.com/NxDevTools), esp. [Colum Ferry](https://twitter.com/FerryColum), who seamlessly integrated webpack Module Federation into Nx and hence helped to spread the word about it (Nx + Module Federation === ❤️)
36
35
  - [Michael Egger-Zikes](https://twitter.com/MikeZks) for contributing to our Module Federation efforts and brining in valuable feedback
37
- - The Angular CLI-Team, esp. [Alan Agius](https://twitter.com/AlanAgius4) and [Charles Lyding](https://twitter.com/charleslyding), for their fantastic work on the esbuild builder for Angular
36
+ - The Angular CLI-Team, esp. [Alan Agius](https://twitter.com/AlanAgius4) and Charles Lyding, for their fantastic work on the esbuild builder for Angular
38
37
 
39
38
  ## Example 🛠️
40
39
 
package/collection.json CHANGED
@@ -1,22 +1,22 @@
1
- {
2
- "$schema": "../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
- "name": "native-federation",
4
- "version": "0.0.1",
5
- "schematics": {
6
- "ng-add": {
7
- "factory": "./src/schematics/init/schematic",
8
- "schema": "./src/schematics/init/schema.json",
9
- "description": "Initialize an angular project for native federation"
10
- },
11
- "init": {
12
- "factory": "./src/schematics/init/schematic",
13
- "schema": "./src/schematics/init/schema.json",
14
- "description": "Initialize an angular project for native federation"
15
- },
16
- "remove": {
17
- "factory": "./src/schematics/remove/schematic",
18
- "schema": "./src/schematics/remove/schema.json",
19
- "description": "Removes native federation"
20
- }
21
- }
22
- }
1
+ {
2
+ "$schema": "../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "name": "native-federation",
4
+ "version": "0.0.1",
5
+ "schematics": {
6
+ "ng-add": {
7
+ "factory": "./src/schematics/init/schematic",
8
+ "schema": "./src/schematics/init/schema.json",
9
+ "description": "Initialize an angular project for native federation"
10
+ },
11
+ "init": {
12
+ "factory": "./src/schematics/init/schematic",
13
+ "schema": "./src/schematics/init/schema.json",
14
+ "description": "Initialize an angular project for native federation"
15
+ },
16
+ "remove": {
17
+ "factory": "./src/schematics/remove/schematic",
18
+ "schema": "./src/schematics/remove/schema.json",
19
+ "description": "Removes native federation"
20
+ }
21
+ }
22
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@angular-architects/native-federation",
3
- "version": "16.3.4",
4
- "main": "src/index.js",
3
+ "version": "17.0.1",
4
+ "main": "./src/index.js",
5
5
  "generators": "./collection.json",
6
6
  "builders": "./builders.json",
7
7
  "schematics": "./collection.json",
@@ -20,12 +20,10 @@
20
20
  "@softarc/native-federation-runtime": "2.0.4",
21
21
  "@types/browser-sync": "^2.26.3",
22
22
  "browser-sync": "^2.29.3",
23
- "esbuild": "^0.18.12",
23
+ "esbuild": "^0.19.5",
24
24
  "mrmime": "^1.0.1",
25
25
  "npmlog": "^6.0.2",
26
26
  "process": "0.11.10"
27
27
  },
28
- "peerDependencies": {
29
- },
30
- "types": "./src/index.d.ts"
28
+ "peerDependencies": {}
31
29
  }
@@ -39,7 +39,7 @@ function runBuilder(nfOptions, context) {
39
39
  federationConfig: infereConfigPath(options.tsConfig),
40
40
  tsConfig: options.tsConfig,
41
41
  verbose: options.verbose,
42
- watch: options.watch,
42
+ watch: false,
43
43
  dev: !!nfOptions.dev,
44
44
  };
45
45
  const config = yield tslib_1.__await((0, build_4.loadFederationConfig)(fedOptions));
@@ -109,8 +109,9 @@ function runBuilder(nfOptions, context) {
109
109
  }
110
110
  if (!first && watch) {
111
111
  setTimeout(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
112
- build_1.logger.info('Rebuilding federation artefacts ...');
113
- yield Promise.all([rebuildEvents.rebuild.emit()]);
112
+ // logger.info('Rebuilding federation artefacts ...');
113
+ // await Promise.all([rebuildEvents.rebuild.emit()]);
114
+ yield (0, build_5.buildForFederation)(config, fedOptions, externals);
114
115
  build_1.logger.info('Done!');
115
116
  if (runServer) {
116
117
  setTimeout(() => (0, dev_server_1.reloadShell)(nfOptions.shell), 0);
@@ -1 +1 @@
1
- {"version":3,"file":"builder.js","sourceRoot":"","sources":["../../../../../../libs/native-federation/src/builders/build/builder.ts"],"names":[],"mappings":";;;;AAAA,kDAAkD;AAClD,yDAImC;AAInC,gGAAiG;AAEjG,mDAA6B;AAC7B,4DAAuE;AAGvE,4DAAmE;AACnE,iFAG6C;AAC7C,4DAAgE;AAChE,4DAAwE;AACxE,4DAAsE;AACtE,yDAAmE;AAGnE,uDAKgC;AAChC,+DAAyD;AACzD,iEAA8D;AAC9D,2BAA2C;AAC3C,uDAIgC;AAGhC,SAAuB,UAAU,CAC/B,SAA0B,EAC1B,OAAuB;;;QAEvB,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACxD,MAAM,QAAQ,GAAG,CAAC,sBAAM,OAAO,CAAC,gBAAgB,CAC9C,MAAM,CACP,CAAA,CAAmC,CAAC;QAErC,MAAM,OAAO,GAAG,sBAAM,OAAO,CAAC,uBAAuB,CAAC,MAAM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iBAC5B;gBAED,KAAK,GAAG,KAAK,CAAC;aACf;;;;;;;;;QAED,+BAA+B;QAC/B,gEAAgE;QAChE,4BAAM,UAAU,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA,CAAC;IACzC,CAAC;CAAA;AAtID,gCAsIC;AAED,kBAAe,IAAA,yBAAa,EAAC,UAAU,CAAQ,CAAC;AAEhD,SAAS,gBAAgB,CAAC,QAAgB;IACxC,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9C,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAAC;IAExE,OAAO,aAAa,CAAC;AACvB,CAAC"}
1
+ {"version":3,"file":"builder.js","sourceRoot":"","sources":["../../../../../../libs/native-federation/src/builders/build/builder.ts"],"names":[],"mappings":";;;;AAAA,kDAAkD;AAClD,yDAImC;AAInC,gGAAiG;AAEjG,mDAA6B;AAC7B,4DAAuE;AAGvE,4DAAmE;AACnE,iFAG6C;AAC7C,4DAAgE;AAChE,4DAAwE;AACxE,4DAAsE;AACtE,yDAAmE;AAGnE,uDAKgC;AAChC,+DAAyD;AACzD,iEAA8D;AAC9D,2BAA2C;AAC3C,uDAIgC;AAGhC,SAAuB,UAAU,CAC/B,SAA0B,EAC1B,OAAuB;;;QAEvB,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACxD,MAAM,QAAQ,GAAG,CAAC,sBAAM,OAAO,CAAC,gBAAgB,CAC9C,MAAM,CACP,CAAA,CAAmC,CAAC;QAErC,MAAM,OAAO,GAAG,sBAAM,OAAO,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAA,CAAC;QAC9D,MAAM,OAAO,GAAG,CAAC,sBAAM,OAAO,CAAC,eAAe,CAC5C,QAAQ,EACR,OAAO,CACR,CAAA,CAAwB,CAAC;QAE1B,MAAM,SAAS,GAAG,CAAC,CAAC,S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,CAAQ,CAAC;AAEhD,SAAS,gBAAgB,CAAC,QAAgB;IACxC,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9C,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAAC;IAExE,OAAO,aAAa,CAAC;AACvB,CAAC"}
@@ -1,11 +1,11 @@
1
- import { JsonObject } from '@angular-devkit/core';
2
-
3
- export interface NfBuilderSchema extends JsonObject {
4
- target: string;
5
- dev: boolean;
6
- port: number;
7
- open: boolean;
8
- rebuildDelay: number;
9
- shell: string;
10
- watch: boolean;
11
- } // eslint-disable-line
1
+ import { JsonObject } from '@angular-devkit/core';
2
+
3
+ export interface NfBuilderSchema extends JsonObject {
4
+ target: string;
5
+ dev: boolean;
6
+ port: number;
7
+ open: boolean;
8
+ rebuildDelay: number;
9
+ shell: string;
10
+ watch: boolean;
11
+ } // eslint-disable-line
@@ -1,43 +1,43 @@
1
- {
2
- "version": 2,
3
- "outputCapture": "direct-nodejs",
4
- "$schema": "http://json-schema.org/draft-07/schema",
5
- "title": "native federation browser builder",
6
- "description": "builder for native federation browser apps",
7
- "type": "object",
8
- "properties": {
9
- "target": {
10
- "type": "string",
11
- "description": "target configured for the esbuild builder"
12
- },
13
- "dev": {
14
- "type": "boolean",
15
- "description": "Set this to true to start the builder in dev mode",
16
- "default": false
17
- },
18
- "watch": {
19
- "type": "boolean",
20
- "default": false
21
- },
22
- "port": {
23
- "type": "number",
24
- "default": 0
25
- },
26
- "open": {
27
- "type": "boolean",
28
- "default": true,
29
- "description": "Open browser?",
30
- "alias": "o"
31
- },
32
- "rebuildDelay": {
33
- "type": "number",
34
- "default": 2000,
35
- "description": "The delay for rebuilding federation artefacts. This allows to have more resources for refreshing your micro frontend in the browser."
36
- },
37
- "shell": {
38
- "type": "string",
39
- "description": "Experimental",
40
- "default": ""
41
- }
42
- }
43
- }
1
+ {
2
+ "version": 2,
3
+ "outputCapture": "direct-nodejs",
4
+ "$schema": "http://json-schema.org/draft-07/schema",
5
+ "title": "native federation browser builder",
6
+ "description": "builder for native federation browser apps",
7
+ "type": "object",
8
+ "properties": {
9
+ "target": {
10
+ "type": "string",
11
+ "description": "target configured for the esbuild builder"
12
+ },
13
+ "dev": {
14
+ "type": "boolean",
15
+ "description": "Set this to true to start the builder in dev mode",
16
+ "default": false
17
+ },
18
+ "watch": {
19
+ "type": "boolean",
20
+ "default": false
21
+ },
22
+ "port": {
23
+ "type": "number",
24
+ "default": 0
25
+ },
26
+ "open": {
27
+ "type": "boolean",
28
+ "default": true,
29
+ "description": "Open browser?",
30
+ "alias": "o"
31
+ },
32
+ "rebuildDelay": {
33
+ "type": "number",
34
+ "default": 2000,
35
+ "description": "The delay for rebuilding federation artefacts. This allows to have more resources for refreshing your micro frontend in the browser."
36
+ },
37
+ "shell": {
38
+ "type": "string",
39
+ "description": "Experimental",
40
+ "default": ""
41
+ }
42
+ }
43
+ }
@@ -182,31 +182,31 @@ function makeMainAsync(main, options, remoteMap) {
182
182
  tree.create(bootstrapName, mainContent);
183
183
  let newMainContent = '';
184
184
  if (options.type === 'dynamic-host') {
185
- newMainContent = `import { initFederation } from '@angular-architects/native-federation';
186
-
187
- initFederation('/assets/federation.manifest.json')
188
- .catch(err => console.error(err))
189
- .then(_ => import('./bootstrap'))
190
- .catch(err => console.error(err));
185
+ newMainContent = `import { initFederation } from '@angular-architects/native-federation';
186
+
187
+ initFederation('/assets/federation.manifest.json')
188
+ .catch(err => console.error(err))
189
+ .then(_ => import('./bootstrap'))
190
+ .catch(err => console.error(err));
191
191
  `;
192
192
  }
193
193
  else if (options.type === 'host') {
194
194
  const manifest = JSON.stringify(remoteMap, null, 2).replace(/"/g, "'");
195
- newMainContent = `import { initFederation } from '@angular-architects/native-federation';
196
-
197
- initFederation(${manifest})
198
- .catch(err => console.error(err))
199
- .then(_ => import('./bootstrap'))
200
- .catch(err => console.error(err));
195
+ newMainContent = `import { initFederation } from '@angular-architects/native-federation';
196
+
197
+ initFederation(${manifest})
198
+ .catch(err => console.error(err))
199
+ .then(_ => import('./bootstrap'))
200
+ .catch(err => console.error(err));
201
201
  `;
202
202
  }
203
203
  else {
204
- newMainContent = `import { initFederation } from '@angular-architects/native-federation';
205
-
206
- initFederation()
207
- .catch(err => console.error(err))
208
- .then(_ => import('./bootstrap'))
209
- .catch(err => console.error(err));
204
+ newMainContent = `import { initFederation } from '@angular-architects/native-federation';
205
+
206
+ initFederation()
207
+ .catch(err => console.error(err))
208
+ .then(_ => import('./bootstrap'))
209
+ .catch(err => console.error(err));
210
210
  `;
211
211
  }
212
212
  tree.overwrite(main, newMainContent);
@@ -1,3 +1,3 @@
1
- export interface MfSchematicSchema {
2
- project: string;
3
- }
1
+ export interface MfSchematicSchema {
2
+ project: string;
3
+ }
@@ -1,17 +1,17 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "mf",
4
- "title": "",
5
- "type": "object",
6
- "properties": {
7
- "project": {
8
- "type": "string",
9
- "description": "The project to add module federation",
10
- "$default": {
11
- "$source": "argv",
12
- "index": 0
13
- },
14
- "x-prompt": "Project name (press enter for default project)"
15
- }
16
- }
17
- }
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "mf",
4
+ "title": "",
5
+ "type": "object",
6
+ "properties": {
7
+ "project": {
8
+ "type": "string",
9
+ "description": "The project to add module federation",
10
+ "$default": {
11
+ "$source": "argv",
12
+ "index": 0
13
+ },
14
+ "x-prompt": "Project name (press enter for default project)"
15
+ }
16
+ }
17
+ }
@@ -69,10 +69,10 @@ function reloadShell(shellProjectName) {
69
69
  exports.reloadShell = reloadShell;
70
70
  function modifyIndexHtml(content, fileNames) {
71
71
  if (buildError) {
72
- const errorHtml = `
73
- <div style="position: absolute; filter: opacity(80%); top:0; bottom:0; left:0; right:0; padding:20px; background-color:black; color:white; ">
74
- <h2>${buildError}</h2>
75
- </div>
72
+ const errorHtml = `
73
+ <div style="position: absolute; filter: opacity(80%); top:0; bottom:0; left:0; right:0; padding:20px; background-color:black; color:white; ">
74
+ <h2>${buildError}</h2>
75
+ </div>
76
76
  `;
77
77
  content = errorHtml + content;
78
78
  }
@@ -0,0 +1,60 @@
1
+ //
2
+ // We stick with rollup for bundling shared npm packages, as esbuild
3
+ // does currently not allow to convert commonjs to esm
4
+ //
5
+
6
+ import { rollup } from 'rollup';
7
+ import resolve from '@rollup/plugin-node-resolve';
8
+ import { externals } from 'rollup-plugin-node-externals';
9
+ import { logger } from '@softarc/native-federation/build';
10
+ import { terser } from 'rollup-plugin-terser';
11
+
12
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
13
+ const commonjs = require('@rollup/plugin-commonjs');
14
+
15
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
16
+ const replace = require('@rollup/plugin-replace');
17
+
18
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
19
+ const json = require('@rollup/plugin-json');
20
+
21
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
22
+
23
+ export async function runRollup(
24
+ entryPoint: string,
25
+ external: string[],
26
+ outfile: string
27
+ ) {
28
+ try {
29
+ const result = await rollup({
30
+ input: entryPoint,
31
+ onwarn: (warning) => {
32
+ logger.verbose(warning);
33
+ },
34
+ plugins: [
35
+ json(),
36
+ commonjs(),
37
+ externals({ include: external }),
38
+ resolve(),
39
+ replace({
40
+ preventAssignment: true,
41
+ values: {
42
+ 'process.env.NODE_ENV': '"development"',
43
+ },
44
+ }),
45
+ terser({ mangle: false, format: { comments: false } }),
46
+ ],
47
+ });
48
+
49
+ await result.write({
50
+ format: 'esm',
51
+ compact: true,
52
+ file: outfile,
53
+ sourcemap: true,
54
+ exports: 'named',
55
+ });
56
+ } catch (e) {
57
+ logger.error('Rollup error');
58
+ throw e;
59
+ }
60
+ }
@@ -1 +0,0 @@
1
- export declare function runRollup(entryPoint: string, external: string[], outfile: string): Promise<void>;
@@ -1,58 +0,0 @@
1
- "use strict";
2
- //
3
- // We stick with rollup for bundling shared npm packages, as esbuild
4
- // does currently not allow to convert commonjs to esm
5
- //
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.runRollup = void 0;
8
- const tslib_1 = require("tslib");
9
- const rollup_1 = require("rollup");
10
- const plugin_node_resolve_1 = tslib_1.__importDefault(require("@rollup/plugin-node-resolve"));
11
- const rollup_plugin_node_externals_1 = require("rollup-plugin-node-externals");
12
- const build_1 = require("@softarc/native-federation/build");
13
- const rollup_plugin_terser_1 = require("rollup-plugin-terser");
14
- // eslint-disable-next-line @typescript-eslint/no-var-requires
15
- const commonjs = require('@rollup/plugin-commonjs');
16
- // eslint-disable-next-line @typescript-eslint/no-var-requires
17
- const replace = require('@rollup/plugin-replace');
18
- // eslint-disable-next-line @typescript-eslint/no-var-requires
19
- const json = require('@rollup/plugin-json');
20
- // eslint-disable-next-line @typescript-eslint/no-var-requires
21
- function runRollup(entryPoint, external, outfile) {
22
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
- try {
24
- const result = yield (0, rollup_1.rollup)({
25
- input: entryPoint,
26
- onwarn: (warning) => {
27
- build_1.logger.verbose(warning);
28
- },
29
- plugins: [
30
- json(),
31
- commonjs(),
32
- (0, rollup_plugin_node_externals_1.externals)({ include: external }),
33
- (0, plugin_node_resolve_1.default)(),
34
- replace({
35
- preventAssignment: true,
36
- values: {
37
- 'process.env.NODE_ENV': '"development"',
38
- },
39
- }),
40
- (0, rollup_plugin_terser_1.terser)({ mangle: false, format: { comments: false } }),
41
- ],
42
- });
43
- yield result.write({
44
- format: 'esm',
45
- compact: true,
46
- file: outfile,
47
- sourcemap: true,
48
- exports: 'named',
49
- });
50
- }
51
- catch (e) {
52
- build_1.logger.error('Rollup error');
53
- throw e;
54
- }
55
- });
56
- }
57
- exports.runRollup = runRollup;
58
- //# sourceMappingURL=rollup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../../../../libs/native-federation/src/utils/rollup.ts"],"names":[],"mappings":";AAAA,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