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.
Files changed (144) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +115 -0
  3. package/builders.json +15 -0
  4. package/collection.json +27 -0
  5. package/generators.json +12 -0
  6. package/migration-collection.json +6 -0
  7. package/package.json +69 -0
  8. package/src/builders/build/builder.d.ts +7 -0
  9. package/src/builders/build/builder.d.ts.map +1 -0
  10. package/src/builders/build/builder.js +413 -0
  11. package/src/builders/build/federation-build-notifier.d.ts +70 -0
  12. package/src/builders/build/federation-build-notifier.d.ts.map +1 -0
  13. package/src/builders/build/federation-build-notifier.js +186 -0
  14. package/src/builders/build/get-externals.d.ts +18 -0
  15. package/src/builders/build/get-externals.d.ts.map +1 -0
  16. package/src/builders/build/get-externals.js +19 -0
  17. package/src/builders/build/i18n.d.ts +21 -0
  18. package/src/builders/build/i18n.d.ts.map +1 -0
  19. package/src/builders/build/i18n.js +73 -0
  20. package/src/builders/build/schema.d.ts +35 -0
  21. package/src/builders/build/schema.json +93 -0
  22. package/src/builders/build/setup-builder-env-variables.d.ts +1 -0
  23. package/src/builders/build/setup-builder-env-variables.d.ts.map +1 -0
  24. package/src/builders/build/setup-builder-env-variables.js +9 -0
  25. package/src/builders/build/update-index-html.d.ts +5 -0
  26. package/src/builders/build/update-index-html.d.ts.map +1 -0
  27. package/src/builders/build/update-index-html.js +33 -0
  28. package/src/builders/remote/assets.d.ts +14 -0
  29. package/src/builders/remote/assets.d.ts.map +1 -0
  30. package/src/builders/remote/assets.js +49 -0
  31. package/src/builders/remote/builder.d.ts +13 -0
  32. package/src/builders/remote/builder.d.ts.map +1 -0
  33. package/src/builders/remote/builder.js +153 -0
  34. package/src/builders/remote/change-watcher.d.ts +10 -0
  35. package/src/builders/remote/change-watcher.d.ts.map +1 -0
  36. package/src/builders/remote/change-watcher.js +35 -0
  37. package/src/builders/remote/infer-config-path.d.ts +2 -0
  38. package/src/builders/remote/infer-config-path.d.ts.map +1 -0
  39. package/src/builders/remote/infer-config-path.js +10 -0
  40. package/src/builders/remote/resolve-ng-options.d.ts +24 -0
  41. package/src/builders/remote/resolve-ng-options.d.ts.map +1 -0
  42. package/src/builders/remote/resolve-ng-options.js +28 -0
  43. package/src/builders/remote/schema.d.ts +26 -0
  44. package/src/builders/remote/schema.json +116 -0
  45. package/src/config/angular-locales.d.ts +6 -0
  46. package/src/config/angular-locales.d.ts.map +1 -0
  47. package/src/config/angular-locales.js +23 -0
  48. package/src/config/angular-skip-list.d.ts +3 -0
  49. package/src/config/angular-skip-list.d.ts.map +1 -0
  50. package/src/config/angular-skip-list.js +23 -0
  51. package/src/config/with-module-federation.d.ts +72 -0
  52. package/src/config/with-module-federation.d.ts.map +1 -0
  53. package/src/config/with-module-federation.js +72 -0
  54. package/src/config.d.ts +4 -0
  55. package/src/config.d.ts.map +1 -0
  56. package/src/config.js +3 -0
  57. package/src/generators/native-federation/files/src/index.ts__template__ +1 -0
  58. package/src/generators/native-federation/generator.d.ts +4 -0
  59. package/src/generators/native-federation/generator.d.ts.map +1 -0
  60. package/src/generators/native-federation/generator.js +45 -0
  61. package/src/generators/native-federation/schema.d.ts +5 -0
  62. package/src/generators/native-federation/schema.json +29 -0
  63. package/src/index.d.ts +82 -0
  64. package/src/index.d.ts.map +1 -0
  65. package/src/index.js +132 -0
  66. package/src/internal.d.ts +2 -0
  67. package/src/internal.d.ts.map +1 -0
  68. package/src/internal.js +1 -0
  69. package/src/schematics/appbuilder/schema.d.ts +3 -0
  70. package/src/schematics/appbuilder/schema.json +17 -0
  71. package/src/schematics/appbuilder/schematic.d.ts +5 -0
  72. package/src/schematics/appbuilder/schematic.d.ts.map +1 -0
  73. package/src/schematics/appbuilder/schematic.js +80 -0
  74. package/src/schematics/init/files/federation.config.mjs__tmpl__ +35 -0
  75. package/src/schematics/init/schema.d.ts +5 -0
  76. package/src/schematics/init/schema.json +30 -0
  77. package/src/schematics/init/schematic.d.ts +6 -0
  78. package/src/schematics/init/schematic.d.ts.map +1 -0
  79. package/src/schematics/init/schematic.js +38 -0
  80. package/src/schematics/init/steps/add-dependencies.d.ts +3 -0
  81. package/src/schematics/init/steps/add-dependencies.d.ts.map +1 -0
  82. package/src/schematics/init/steps/add-dependencies.js +25 -0
  83. package/src/schematics/init/steps/generate-federation-config.d.ts +4 -0
  84. package/src/schematics/init/steps/generate-federation-config.d.ts.map +1 -0
  85. package/src/schematics/init/steps/generate-federation-config.js +15 -0
  86. package/src/schematics/init/steps/generate-remote-map.d.ts +2 -0
  87. package/src/schematics/init/steps/generate-remote-map.d.ts.map +1 -0
  88. package/src/schematics/init/steps/generate-remote-map.js +20 -0
  89. package/src/schematics/init/steps/make-main-async.d.ts +4 -0
  90. package/src/schematics/init/steps/make-main-async.d.ts.map +1 -0
  91. package/src/schematics/init/steps/make-main-async.js +35 -0
  92. package/src/schematics/init/steps/normalize-options.d.ts +20 -0
  93. package/src/schematics/init/steps/normalize-options.d.ts.map +1 -0
  94. package/src/schematics/init/steps/normalize-options.js +64 -0
  95. package/src/schematics/init/steps/update-package-json.d.ts +3 -0
  96. package/src/schematics/init/steps/update-package-json.d.ts.map +1 -0
  97. package/src/schematics/init/steps/update-package-json.js +19 -0
  98. package/src/schematics/init/steps/update-polyfills.d.ts +3 -0
  99. package/src/schematics/init/steps/update-polyfills.d.ts.map +1 -0
  100. package/src/schematics/init/steps/update-polyfills.js +21 -0
  101. package/src/schematics/init/steps/update-workspace-config.d.ts +4 -0
  102. package/src/schematics/init/steps/update-workspace-config.d.ts.map +1 -0
  103. package/src/schematics/init/steps/update-workspace-config.js +76 -0
  104. package/src/schematics/remove/schema.d.ts +3 -0
  105. package/src/schematics/remove/schema.json +17 -0
  106. package/src/schematics/remove/schematic.d.ts +5 -0
  107. package/src/schematics/remove/schematic.d.ts.map +1 -0
  108. package/src/schematics/remove/schematic.js +106 -0
  109. package/src/tools/esbuild/angular-bundler.d.ts +10 -0
  110. package/src/tools/esbuild/angular-bundler.d.ts.map +1 -0
  111. package/src/tools/esbuild/angular-bundler.js +134 -0
  112. package/src/tools/esbuild/create-awaitable-compiler-plugin.d.ts +6 -0
  113. package/src/tools/esbuild/create-awaitable-compiler-plugin.d.ts.map +1 -0
  114. package/src/tools/esbuild/create-awaitable-compiler-plugin.js +29 -0
  115. package/src/tools/esbuild/create-federation-tsconfig.d.ts +7 -0
  116. package/src/tools/esbuild/create-federation-tsconfig.d.ts.map +1 -0
  117. package/src/tools/esbuild/create-federation-tsconfig.js +46 -0
  118. package/src/tools/esbuild/shared-mappings-plugin.d.ts +4 -0
  119. package/src/tools/esbuild/shared-mappings-plugin.d.ts.map +1 -0
  120. package/src/tools/esbuild/shared-mappings-plugin.js +33 -0
  121. package/src/tools/mf/build-for-federation.d.ts +70 -0
  122. package/src/tools/mf/build-for-federation.d.ts.map +1 -0
  123. package/src/tools/mf/build-for-federation.js +75 -0
  124. package/src/tools/mf/federation-entry-points.d.ts +23 -0
  125. package/src/tools/mf/federation-entry-points.d.ts.map +1 -0
  126. package/src/tools/mf/federation-entry-points.js +13 -0
  127. package/src/tools/mf/federation-plugin.d.ts +11 -0
  128. package/src/tools/mf/federation-plugin.d.ts.map +1 -0
  129. package/src/tools/mf/federation-plugin.js +12 -0
  130. package/src/tools/mf/federation-side-build.d.ts +21 -0
  131. package/src/tools/mf/federation-side-build.d.ts.map +1 -0
  132. package/src/tools/mf/federation-side-build.js +27 -0
  133. package/src/tools/mf/to-plugin-config.d.ts +37 -0
  134. package/src/tools/mf/to-plugin-config.d.ts.map +1 -0
  135. package/src/tools/mf/to-plugin-config.js +33 -0
  136. package/src/utils/check-for-invalid-imports.d.ts +2 -0
  137. package/src/utils/check-for-invalid-imports.d.ts.map +1 -0
  138. package/src/utils/check-for-invalid-imports.js +29 -0
  139. package/src/utils/normalize-build-options.d.ts +22 -0
  140. package/src/utils/normalize-build-options.d.ts.map +1 -0
  141. package/src/utils/normalize-build-options.js +45 -0
  142. package/src/utils/normalize-context-options.d.ts +24 -0
  143. package/src/utils/normalize-context-options.d.ts.map +1 -0
  144. package/src/utils/normalize-context-options.js +18 -0
package/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ Copyright 2021 Softarc Consulting GmbH
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
+
package/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # `module-federation-angular-adapter`
2
+
3
+ An Angular adapter for **Module Federation v2**, built on
4
+ [`@module-federation/runtime`](https://www.npmjs.com/package/@module-federation/runtime)
5
+ and [`@module-federation/esbuild`](https://www.npmjs.com/package/@module-federation/esbuild).
6
+
7
+ It lets an Angular app **consume** and **produce** Module Federation v2 remotes that
8
+ interoperate with stock **webpack / rspack** MF hosts — while reusing Angular's
9
+ esbuild-based `ApplicationBuilder` and the same es-module-shims foundation as
10
+ [Native Federation](https://www.npmjs.com/package/@angular-architects/native-federation).
11
+
12
+ > [!WARNING]
13
+ > **Pre-release.** The adapter is code-complete and statically verified
14
+ > (type-checks, lints, unit tests pass), but its **end-to-end behaviour is not yet
15
+ > proven** in a real Angular app/browser. See
16
+ > [Constraints & known issues](./docs/known-issues.md). Not yet recommended for
17
+ > production.
18
+
19
+ ## Features
20
+
21
+ - ✅ **Module Federation v2 interop** — emits `mf-manifest.json` + an ESM
22
+ `remoteEntry.js`; consumes/produces remotes across Angular, webpack, and rspack.
23
+ - ✅ **Familiar config** — `withModuleFederation` / `share` / `shareAll`, the same
24
+ shape Native Federation / the Module Federation plugin use.
25
+ - ✅ **Angular-native build** — delegates the app shell to Angular's fast esbuild
26
+ `ApplicationBuilder`; runs the federation container as a side build.
27
+ - ✅ **Single-instance sharing** — `@angular/*`, `rxjs`, `zone.js` shared as strict
28
+ singletons via the MF shared scope.
29
+
30
+ ## Quick start
31
+
32
+ ```bash
33
+ ng add module-federation-angular-adapter
34
+ ```
35
+
36
+ Configure `federation.config.mjs`:
37
+
38
+ ```js
39
+ import {
40
+ withModuleFederation,
41
+ shareAll,
42
+ } from "module-federation-angular-adapter/config";
43
+
44
+ export default withModuleFederation({
45
+ name: "mfe1",
46
+ // remotes only:
47
+ exposes: { "./Component": "./src/app/app.component.ts" },
48
+ shared: {
49
+ ...shareAll({
50
+ singleton: true,
51
+ strictVersion: true,
52
+ requiredVersion: "auto",
53
+ }),
54
+ "@angular/core": {
55
+ singleton: true,
56
+ strictVersion: true,
57
+ requiredVersion: "auto",
58
+ includeSecondaries: true,
59
+ },
60
+ },
61
+ skip: ["rxjs/ajax", "rxjs/fetch"],
62
+ });
63
+ ```
64
+
65
+ Load a remote in the host:
66
+
67
+ ```ts
68
+ import { initFederation } from "module-federation-angular-adapter";
69
+
70
+ const { loadRemoteModule } = initFederation({
71
+ mfe1: "http://localhost:4201/mf-manifest.json",
72
+ });
73
+
74
+ const m = await loadRemoteModule("mfe1", "./Component");
75
+ ```
76
+
77
+ Full walkthrough: **[docs/usage.md](./docs/usage.md)**.
78
+
79
+ ## How it differs from Native Federation
80
+
81
+ Same adapter shape and es-module-shims loader; the **orchestrator** and the
82
+ **artifact contract** change.
83
+
84
+ | | Native Federation | This adapter |
85
+ | ---------------- | ----------------------------------------- | --------------------------------------------- |
86
+ | Runtime | `@softarc/native-federation-orchestrator` | `@module-federation/runtime` |
87
+ | Build core | `@softarc/native-federation` | `@module-federation/esbuild` |
88
+ | Manifest | `remoteEntry.json` | `remoteEntry.js` + `mf-manifest.json` (MF v2) |
89
+ | `initFederation` | returns a `Promise` | **synchronous** |
90
+ | Interop | NF hosts only | stock webpack / rspack MF v2 hosts |
91
+
92
+ The trade: you gain the wider Module Federation v2 ecosystem; you depend on the
93
+ (currently early `0.0.x`) `@module-federation/esbuild`. See
94
+ [Architecture](./docs/architecture.md) for the full picture.
95
+
96
+ ## Documentation
97
+
98
+ - **[Usage](./docs/usage.md)** — install, configure, load/expose remotes.
99
+ - **[Architecture](./docs/architecture.md)** — how it works and the design behind it.
100
+ - **[Constraints & known issues](./docs/known-issues.md)** — what to be aware of.
101
+ - **[SSR proposal (deferred)](./docs/research/ssr-proposal-future.md)** — why SSR is
102
+ not yet supported.
103
+
104
+ ## Credits
105
+
106
+ Built on the work of the Module Federation and Native Federation communities —
107
+ [Zack Jackson](https://github.com/ScriptedAlchemy) (Module Federation), the
108
+ [`@module-federation`](https://github.com/module-federation) team (`runtime` +
109
+ `esbuild`), [Manfred Steyer](https://github.com/manfredsteyer) and the Angular
110
+ Architects team (Native Federation, whose adapter this ports from), and the Angular
111
+ CLI team for the esbuild `ApplicationBuilder`.
112
+
113
+ ## License
114
+
115
+ MIT
package/builders.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "../../node_modules/@angular-devkit/architect/src/builders-schema.json",
3
+ "builders": {
4
+ "build": {
5
+ "implementation": "./src/builders/build/builder",
6
+ "schema": "./src/builders/build/schema.json",
7
+ "description": "native federation builder"
8
+ },
9
+ "remote": {
10
+ "implementation": "./src/builders/remote/builder",
11
+ "schema": "./src/builders/remote/schema.json",
12
+ "description": "native federation builder without the Angular application build or dev server (federation artifacts + copied assets only; serving is handled externally)"
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "name": "module-federation-esbuild",
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 module federation (esbuild)"
10
+ },
11
+ "init": {
12
+ "factory": "./src/schematics/init/schematic",
13
+ "schema": "./src/schematics/init/schema.json",
14
+ "description": "Initialize an angular project for module federation (esbuild)"
15
+ },
16
+ "remove": {
17
+ "factory": "./src/schematics/remove/schematic",
18
+ "schema": "./src/schematics/remove/schema.json",
19
+ "description": "Removes module federation (esbuild)"
20
+ },
21
+ "appbuilder": {
22
+ "factory": "./src/schematics/appbuilder/schematic",
23
+ "schema": "./src/schematics/appbuilder/schema.json",
24
+ "description": "Migrates for using the appbuilder"
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "name": "native-federation",
4
+ "version": "0.0.1",
5
+ "generators": {
6
+ "native-federation": {
7
+ "factory": "./src/generators/native-federation/generator",
8
+ "schema": "./src/generators/native-federation/schema.json",
9
+ "description": "native-federation generator"
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "name": "module-federation-esbuild",
4
+ "version": "0.0.1",
5
+ "schematics": {}
6
+ }
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "module-federation-angular-adapter",
3
+ "version": "0.2200.0",
4
+ "generators": "./collection.json",
5
+ "builders": "./builders.json",
6
+ "schematics": "./collection.json",
7
+ "license": "MIT",
8
+ "author": {
9
+ "name": "Native federation team",
10
+ "url": "http://www.angulararchitects.io"
11
+ },
12
+ "peerDependencies": {
13
+ "@angular/build": "~22.0.0"
14
+ },
15
+ "dependencies": {
16
+ "@angular-devkit/architect": "^0.2200.0",
17
+ "@angular-devkit/core": "~22.0.0",
18
+ "@angular-devkit/schematics": "~22.0.0",
19
+ "@chialab/esbuild-plugin-commonjs": "^0.19.0",
20
+ "@module-federation/esbuild": "0.0.109",
21
+ "@module-federation/runtime": "2.6.0",
22
+ "@module-federation/sdk": "2.6.0",
23
+ "@module-federation/webpack-bundler-runtime": "2.6.0",
24
+ "@softarc/native-federation": "^4.0.0",
25
+ "es-module-shims": "^2.8.0",
26
+ "esbuild": "^0.28.0",
27
+ "mrmime": "^2.0.1"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/Aukevanoost/angular-module-federation-adapter"
32
+ },
33
+ "ng-update": {
34
+ "migrations": "./migration-collection.json"
35
+ },
36
+ "exports": {
37
+ "./package.json": "./package.json",
38
+ ".": {
39
+ "types": "./src/index.d.ts",
40
+ "import": "./src/index.js",
41
+ "default": "./src/index.js"
42
+ },
43
+ "./config": {
44
+ "types": "./src/config.d.ts",
45
+ "import": "./src/config.js",
46
+ "default": "./src/config.js"
47
+ },
48
+ "./internal": {
49
+ "types": "./src/internal.d.ts",
50
+ "import": "./src/internal.js",
51
+ "default": "./src/internal.js"
52
+ }
53
+ },
54
+ "homepage": "https://github.com/Aukevanoost/angular-module-federation-adapter#readme",
55
+ "type": "module",
56
+ "files": [
57
+ "src",
58
+ "collection.json",
59
+ "generators.json",
60
+ "builders.json",
61
+ "migration-collection.json",
62
+ "README.md",
63
+ "LICENSE",
64
+ "!**/*.tsbuildinfo"
65
+ ],
66
+ "types": "./src/index.d.ts",
67
+ "module": "./src/index.js",
68
+ "main": "./src/index.js"
69
+ }
@@ -0,0 +1,7 @@
1
+ import "./setup-builder-env-variables.js";
2
+ import { type BuilderContext, type BuilderOutput } from "@angular-devkit/architect";
3
+ import type { NfBuilderSchema, NfInternalOptions } from "./schema.js";
4
+ export declare function runBuilder(nfBuilderOptions: NfBuilderSchema & NfInternalOptions, context: BuilderContext): AsyncIterable<BuilderOutput>;
5
+ declare const _default: any;
6
+ export default _default;
7
+ //# sourceMappingURL=builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../../src/builders/build/builder.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAiB1C,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAGnB,MAAM,2BAA2B,CAAC;AAsBnC,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAwEtE,wBAAuB,UAAU,CAC/B,gBAAgB,EAAE,eAAe,GAAG,iBAAiB,EACrD,OAAO,EAAE,cAAc,GACtB,aAAa,CAAC,aAAa,CAAC,CAke9B;wBAkE2C,GAAG;AAA/C,wBAAgD"}