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
@@ -0,0 +1,75 @@
1
+ import { normalizeContextOptions } from '../../utils/normalize-context-options.js';
2
+ import { createFederationEsbuildContext } from './federation-side-build.js';
3
+ import { toExposedEntryPoints, } from './federation-entry-points.js';
4
+ /** Shared-mappings → entry points (mirrors NF's `bundleExposedAndMappings`). */
5
+ function toMappingEntryPoints(sharedMappings = {}) {
6
+ return Object.entries(sharedMappings).map(([entryPoint, mappedImport]) => ({
7
+ fileName: entryPoint,
8
+ outName: mappedImport.replace(/[^A-Za-z0-9]/g, '_') + '.js',
9
+ key: mappedImport,
10
+ }));
11
+ }
12
+ /** NF normalized config → the MF plugin's `FederationConfigInput` (exposes value → file path). */
13
+ function toFederationConfigInput(config) {
14
+ const exposes = {};
15
+ for (const [key, expose] of Object.entries(config.exposes ?? {})) {
16
+ exposes[key] = expose.file;
17
+ }
18
+ return {
19
+ name: config.name,
20
+ filename: config.filename,
21
+ exposes,
22
+ shared: config.shared,
23
+ remotes: config.remotes,
24
+ };
25
+ }
26
+ export async function createMfFederationBuilder(config, fedOptions, externals, ctx) {
27
+ const entryPoints = [
28
+ ...toMappingEntryPoints(config.sharedMappings),
29
+ ...toExposedEntryPoints(config.exposes),
30
+ ];
31
+ const options = normalizeContextOptions(ctx.builderOptions, ctx.context, {
32
+ entryPoints,
33
+ outdir: fedOptions.outputPath,
34
+ tsConfigPath: fedOptions.tsConfig,
35
+ external: externals,
36
+ dev: !!fedOptions.dev,
37
+ watch: fedOptions.watch,
38
+ mappedPaths: config.sharedMappings ?? {},
39
+ chunks: config.chunks,
40
+ hash: !fedOptions.dev,
41
+ optimizedMappings: !!config.features?.ignoreUnusedDeps,
42
+ isMappingOrExposed: true,
43
+ cache: fedOptions.federationCache,
44
+ });
45
+ const { ctx: buildContext, pluginDisposed } = await createFederationEsbuildContext(options, toFederationConfigInput(config));
46
+ const runWrite = async () => {
47
+ const result = await buildContext.rebuild();
48
+ // write:true → esbuild emitted the chunks + container, and the MF plugin's
49
+ // onEnd rewrote the container (module map) + wrote mf-manifest.json. Collect
50
+ // the emitted files from the metafile (the plugin forces metafile:true).
51
+ const writtenFiles = result.metafile ? Object.keys(result.metafile.outputs) : [];
52
+ return {
53
+ name: config.name,
54
+ exposes: Object.keys(config.exposes ?? {}),
55
+ writtenFiles,
56
+ };
57
+ };
58
+ let disposed = false;
59
+ return {
60
+ build: runWrite,
61
+ async rebuild(modifiedFiles = []) {
62
+ options.cache.bundlerCache.invalidate(new Set(modifiedFiles));
63
+ return runWrite();
64
+ },
65
+ // Idempotent: the build builder disposes once for the #47 TS-state reset
66
+ // (non-watch) and again in its final cleanup, so guard against double-dispose.
67
+ async dispose() {
68
+ if (disposed)
69
+ return;
70
+ disposed = true;
71
+ await buildContext.dispose();
72
+ await pluginDisposed;
73
+ },
74
+ };
75
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * esbuild entry-point descriptor for the side build. Structurally matches NF's
3
+ * `EntryPoint` (`{ fileName, outName, key? }`) so it's assignable to
4
+ * `createAngularEsbuildContext`'s param, but declared locally to survive the
5
+ * Phase-3 NF removal.
6
+ */
7
+ export interface FederationEntryPoint {
8
+ fileName: string;
9
+ outName: string;
10
+ key?: string;
11
+ }
12
+ /** A config `exposes` entry — only the source `file` is needed to build it. */
13
+ export interface ExposeInput {
14
+ file: string;
15
+ }
16
+ /**
17
+ * Derive the side-build entry points from a federation config's `exposes`
18
+ * (M2.1). Mirrors NF's `bundleExposedAndMappings`:
19
+ * `{ fileName: expose.file, outName: key + '.js', key }`. Shared-mappings
20
+ * entries (if still used) are concatenated by the caller.
21
+ */
22
+ export declare function toExposedEntryPoints(exposes?: Record<string, ExposeInput>): FederationEntryPoint[];
23
+ //# sourceMappingURL=federation-entry-points.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-entry-points.d.ts","sourceRoot":"","sources":["../../../../src/tools/mf/federation-entry-points.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,+EAA+E;AAC/E,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAM,GACxC,oBAAoB,EAAE,CAMxB"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Derive the side-build entry points from a federation config's `exposes`
3
+ * (M2.1). Mirrors NF's `bundleExposedAndMappings`:
4
+ * `{ fileName: expose.file, outName: key + '.js', key }`. Shared-mappings
5
+ * entries (if still used) are concatenated by the caller.
6
+ */
7
+ export function toExposedEntryPoints(exposes = {}) {
8
+ return Object.entries(exposes).map(([key, expose]) => ({
9
+ fileName: expose.file,
10
+ outName: key + '.js',
11
+ key,
12
+ }));
13
+ }
@@ -0,0 +1,11 @@
1
+ import type { Plugin } from 'esbuild';
2
+ import { type FederationConfigInput } from './to-plugin-config.js';
3
+ /**
4
+ * The esbuild plugin injected into the Angular esbuild context (M2.1 keystone:
5
+ * one-pass composition). It wraps the exposed Angular modules — already compiled
6
+ * by the co-present Angular compiler plugin — into the MF container and emits
7
+ * `remoteEntry.js` + `mf-manifest.json`. Externals/shared resolution flows
8
+ * through es-module-shims import maps (finding #6).
9
+ */
10
+ export declare function createFederationPlugin(cfg: FederationConfigInput, filename?: string): Plugin;
11
+ //# sourceMappingURL=federation-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-plugin.d.ts","sourceRoot":"","sources":["../../../../src/tools/mf/federation-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAoB,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAErF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,qBAAqB,EAC1B,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAER"}
@@ -0,0 +1,12 @@
1
+ import { moduleFederationPlugin } from '@module-federation/esbuild/plugin';
2
+ import { toMfPluginConfig } from './to-plugin-config.js';
3
+ /**
4
+ * The esbuild plugin injected into the Angular esbuild context (M2.1 keystone:
5
+ * one-pass composition). It wraps the exposed Angular modules — already compiled
6
+ * by the co-present Angular compiler plugin — into the MF container and emits
7
+ * `remoteEntry.js` + `mf-manifest.json`. Externals/shared resolution flows
8
+ * through es-module-shims import maps (finding #6).
9
+ */
10
+ export function createFederationPlugin(cfg, filename) {
11
+ return moduleFederationPlugin(toMfPluginConfig(cfg, filename));
12
+ }
@@ -0,0 +1,21 @@
1
+ import type { NormalizedContextOptions } from '../../utils/normalize-context-options.js';
2
+ import { createAngularEsbuildContext } from '../esbuild/angular-bundler.js';
3
+ import type { FederationConfigInput } from './to-plugin-config.js';
4
+ /**
5
+ * MF side-build context (M2.1 driver). Replaces NF's `buildForFederation` build
6
+ * path: reuses the Angular compiler esbuild context and injects
7
+ * `moduleFederationPlugin` as an extra plugin — the one-pass composition proven
8
+ * feasible from the plugin source (the compiler plugin compiles exposed `.ts`;
9
+ * the MF plugin wraps the container; the nested shared sub-build is
10
+ * commonjs-only, so the compiler never runs twice).
11
+ *
12
+ * Returns the esbuild `BuildContext` + the compiler's `pluginDisposed`, mirroring
13
+ * `createAngularEsbuildContext` so the existing orchestration loop (rebuild
14
+ * queue, dispose) drives it unchanged.
15
+ *
16
+ * ⚠️ End-to-end artifact emission is only verifiable against a real Angular app
17
+ * (absent in this sandbox — same limit as the M1.7 e2e); this is code-complete
18
+ * and type-checked, emit-proof deferred.
19
+ */
20
+ export declare function createFederationEsbuildContext(options: NormalizedContextOptions, federationConfig: FederationConfigInput): ReturnType<typeof createAngularEsbuildContext>;
21
+ //# sourceMappingURL=federation-side-build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-side-build.d.ts","sourceRoot":"","sources":["../../../../src/tools/mf/federation-side-build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,wBAAwB,EACjC,gBAAgB,EAAE,qBAAqB,GACtC,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAQhD"}
@@ -0,0 +1,27 @@
1
+ import { createAngularEsbuildContext } from '../esbuild/angular-bundler.js';
2
+ import { createFederationPlugin } from './federation-plugin.js';
3
+ /**
4
+ * MF side-build context (M2.1 driver). Replaces NF's `buildForFederation` build
5
+ * path: reuses the Angular compiler esbuild context and injects
6
+ * `moduleFederationPlugin` as an extra plugin — the one-pass composition proven
7
+ * feasible from the plugin source (the compiler plugin compiles exposed `.ts`;
8
+ * the MF plugin wraps the container; the nested shared sub-build is
9
+ * commonjs-only, so the compiler never runs twice).
10
+ *
11
+ * Returns the esbuild `BuildContext` + the compiler's `pluginDisposed`, mirroring
12
+ * `createAngularEsbuildContext` so the existing orchestration loop (rebuild
13
+ * queue, dispose) drives it unchanged.
14
+ *
15
+ * ⚠️ End-to-end artifact emission is only verifiable against a real Angular app
16
+ * (absent in this sandbox — same limit as the M1.7 e2e); this is code-complete
17
+ * and type-checked, emit-proof deferred.
18
+ */
19
+ export function createFederationEsbuildContext(options, federationConfig) {
20
+ // `write: true` (M2.2): the MF plugin's `onEnd` reads the emitted container off
21
+ // disk to inject the module map, so it cannot run under the NF `write:false` +
22
+ // writeResult flow. esbuild writes the chunks/container/manifest to `outdir`.
23
+ return createAngularEsbuildContext(options, {
24
+ extraPlugins: [createFederationPlugin(federationConfig)],
25
+ write: true,
26
+ });
27
+ }
@@ -0,0 +1,37 @@
1
+ import type { moduleFederationPlugin } from '@module-federation/esbuild/plugin';
2
+ /**
3
+ * Config object accepted by `@module-federation/esbuild`'s `moduleFederationPlugin`
4
+ * (its `NormalizedFederationConfig`). Derived via `Parameters<>` so we don't reach
5
+ * into the plugin's `dist/lib/config/*` internals.
6
+ */
7
+ export type MfPluginConfig = Parameters<typeof moduleFederationPlugin>[0];
8
+ /**
9
+ * Minimal shape we read off a *normalized* federation config to drive the MF
10
+ * side build. Declared locally (not imported from `@softarc/native-federation`)
11
+ * so this mapper survives the Phase-3 NF removal — both NF's and MF's own
12
+ * normalized configs satisfy it.
13
+ */
14
+ export interface FederationConfigInput {
15
+ name: string;
16
+ filename?: string;
17
+ exposes?: Record<string, string>;
18
+ shared?: Record<string, FederationSharedInput>;
19
+ remotes?: Record<string, string>;
20
+ }
21
+ export interface FederationSharedInput {
22
+ singleton?: boolean;
23
+ strictVersion?: boolean;
24
+ /** Concrete range by the normalized stage (NF resolves `'auto'` upstream). */
25
+ requiredVersion?: string;
26
+ version?: string;
27
+ eager?: boolean;
28
+ includeSecondaries?: boolean;
29
+ }
30
+ /**
31
+ * Map a normalized federation config → `moduleFederationPlugin` options (the
32
+ * config half of M2.1). Pairs with the proven esbuild invocation (M0.1 / the
33
+ * in-workspace re-proof) to form the side build. The plugin emits
34
+ * `remoteEntry.js` + `mf-manifest.json`.
35
+ */
36
+ export declare function toMfPluginConfig(cfg: FederationConfigInput, filename?: string): MfPluginConfig;
37
+ //# sourceMappingURL=to-plugin-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-plugin-config.d.ts","sourceRoot":"","sources":["../../../../src/tools/mf/to-plugin-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEhF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;AAG1E;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,8EAA8E;IAC9E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAqBD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,qBAAqB,EAC1B,QAAQ,SAAmB,GAC1B,cAAc,CAQhB"}
@@ -0,0 +1,33 @@
1
+ function mapShared(shared) {
2
+ const out = {};
3
+ for (const [pkg, cfg] of Object.entries(shared ?? {})) {
4
+ out[pkg] = {
5
+ singleton: cfg.singleton ?? false,
6
+ strictVersion: cfg.strictVersion ?? false,
7
+ // The plugin's NormalizedSharedConfig requires a string here (no `false`,
8
+ // unlike the runtime). Fall back to `'*'` when unresolved.
9
+ requiredVersion: cfg.requiredVersion ?? '*',
10
+ version: cfg.version,
11
+ eager: cfg.eager,
12
+ // ✅ Spike-confirmed (finding #4): the esbuild plugin DOES support
13
+ // `includeSecondaries` — so it maps 1:1, contra M3.1's table.
14
+ includeSecondaries: cfg.includeSecondaries,
15
+ };
16
+ }
17
+ return out;
18
+ }
19
+ /**
20
+ * Map a normalized federation config → `moduleFederationPlugin` options (the
21
+ * config half of M2.1). Pairs with the proven esbuild invocation (M0.1 / the
22
+ * in-workspace re-proof) to form the side build. The plugin emits
23
+ * `remoteEntry.js` + `mf-manifest.json`.
24
+ */
25
+ export function toMfPluginConfig(cfg, filename = 'remoteEntry.js') {
26
+ return {
27
+ name: cfg.name,
28
+ filename: cfg.filename ?? filename,
29
+ exposes: cfg.exposes ?? {},
30
+ shared: mapShared(cfg.shared),
31
+ remotes: cfg.remotes,
32
+ };
33
+ }
@@ -0,0 +1,2 @@
1
+ export declare function checkForInvalidImports(importList: string[], type: string): void;
2
+ //# sourceMappingURL=check-for-invalid-imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-for-invalid-imports.d.ts","sourceRoot":"","sources":["../../../src/utils/check-for-invalid-imports.ts"],"names":[],"mappings":"AAIA,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,QAiCxE"}
@@ -0,0 +1,29 @@
1
+ import { logger } from '@softarc/native-federation/internal';
2
+ const ALLOWED_FILE_EXTENSIONS = new Set(['mjs', 'js', 'mts', 'ts', 'jsx', 'tsx', 'json']);
3
+ export function checkForInvalidImports(importList, type) {
4
+ const importsWithDot = [];
5
+ for (const mappingImport of importList) {
6
+ if (!mappingImport.includes('.')) {
7
+ continue;
8
+ }
9
+ const queryIndex = mappingImport.search(/[?#]/);
10
+ const sanitizedImport = queryIndex >= 0 ? mappingImport.slice(0, queryIndex) : mappingImport;
11
+ const segmentStart = sanitizedImport.lastIndexOf('/') + 1;
12
+ const lastSegment = sanitizedImport.slice(segmentStart);
13
+ const dotIndex = lastSegment.lastIndexOf('.');
14
+ if (dotIndex < 0) {
15
+ continue;
16
+ }
17
+ const extension = lastSegment.slice(dotIndex + 1);
18
+ if (!ALLOWED_FILE_EXTENSIONS.has(extension)) {
19
+ importsWithDot.push(mappingImport);
20
+ }
21
+ }
22
+ if (importsWithDot.length > 0) {
23
+ importsWithDot.forEach(e => {
24
+ logger.warn(`Import '${e}' contains a bad dot (.) import.`);
25
+ });
26
+ logger.debug('Bad import issue: https://github.com/vitejs/vite/issues/21036');
27
+ throw new Error(`Invalid '${type}' config. Invalid imports paths detected, consider using a barrel import instead. `);
28
+ }
29
+ }
@@ -0,0 +1,22 @@
1
+ import type { ApplicationBuilderOptions } from '@angular/build';
2
+ /**
3
+ * Vendored from `@angular/build` (`normalize-optimization.ts`, `normalize-source-maps.ts`).
4
+ * These helpers aren't on the public or `/private` export surface.
5
+ *
6
+ * Types are derived from the public `ApplicationBuilderOptions`. Emitted declarations don't
7
+ * reference Angular's internal schema module.
8
+ */
9
+ type Optimization = NonNullable<ApplicationBuilderOptions['optimization']>;
10
+ type OptimizationObject = Extract<Optimization, object>;
11
+ type Styles = Extract<NonNullable<OptimizationObject['styles']>, object>;
12
+ type Fonts = Extract<NonNullable<OptimizationObject['fonts']>, object>;
13
+ type NormalizedOptimization = Required<Omit<OptimizationObject, 'fonts' | 'styles'>> & {
14
+ fonts: Fonts;
15
+ styles: Styles;
16
+ };
17
+ type SourceMap = NonNullable<ApplicationBuilderOptions['sourceMap']>;
18
+ type NormalizedSourceMap = Extract<SourceMap, object>;
19
+ export declare function normalizeOptimization(optimization?: Optimization): NormalizedOptimization;
20
+ export declare function normalizeSourceMaps(sourceMap: SourceMap): NormalizedSourceMap;
21
+ export {};
22
+ //# sourceMappingURL=normalize-build-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-build-options.d.ts","sourceRoot":"","sources":["../../../src/utils/normalize-build-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAEhE;;;;;;GAMG;AAEH,KAAK,YAAY,GAAG,WAAW,CAAC,yBAAyB,CAAC,cAAc,CAAC,CAAC,CAAC;AAC3E,KAAK,kBAAkB,GAAG,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACxD,KAAK,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACzE,KAAK,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAEvE,KAAK,sBAAsB,GAAG,QAAQ,CAAC,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC,GAAG;IACrF,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,SAAS,GAAG,WAAW,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC,CAAC;AACrE,KAAK,mBAAmB,GAAG,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAEtD,wBAAgB,qBAAqB,CAAC,YAAY,GAAE,YAAmB,GAAG,sBAAsB,CAkC/F;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,mBAAmB,CAc7E"}
@@ -0,0 +1,45 @@
1
+ export function normalizeOptimization(optimization = true) {
2
+ if (typeof optimization === 'object') {
3
+ const styleOptimization = !!optimization.styles;
4
+ return {
5
+ scripts: !!optimization.scripts,
6
+ styles: typeof optimization.styles === 'object'
7
+ ? optimization.styles
8
+ : {
9
+ minify: styleOptimization,
10
+ removeSpecialComments: styleOptimization,
11
+ inlineCritical: styleOptimization,
12
+ },
13
+ fonts: typeof optimization.fonts === 'object'
14
+ ? optimization.fonts
15
+ : {
16
+ inline: !!optimization.fonts,
17
+ },
18
+ };
19
+ }
20
+ return {
21
+ scripts: optimization,
22
+ styles: {
23
+ minify: optimization,
24
+ inlineCritical: optimization,
25
+ removeSpecialComments: optimization,
26
+ },
27
+ fonts: {
28
+ inline: optimization,
29
+ },
30
+ };
31
+ }
32
+ export function normalizeSourceMaps(sourceMap) {
33
+ const scripts = typeof sourceMap === 'object' ? sourceMap.scripts : sourceMap;
34
+ const styles = typeof sourceMap === 'object' ? sourceMap.styles : sourceMap;
35
+ const hidden = (typeof sourceMap === 'object' && sourceMap.hidden) || false;
36
+ const vendor = (typeof sourceMap === 'object' && sourceMap.vendor) || false;
37
+ const sourcesContent = typeof sourceMap === 'object' ? sourceMap.sourcesContent : sourceMap;
38
+ return {
39
+ vendor,
40
+ hidden,
41
+ scripts,
42
+ styles,
43
+ sourcesContent,
44
+ };
45
+ }
@@ -0,0 +1,24 @@
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, EntryPoint, NFBuildAdapterOptions } from '@softarc/native-federation';
5
+ import type { PathToImport } from '@softarc/native-federation/internal';
6
+ import type { NfInternalOptions } from '../builders/build/schema';
7
+ export interface NormalizedContextOptions {
8
+ builderOptions: ApplicationBuilderOptions & NfInternalOptions;
9
+ context: BuilderContext;
10
+ entryPoints: EntryPoint[];
11
+ external: string[];
12
+ outdir: string;
13
+ tsConfigPath?: string;
14
+ mappedPaths: PathToImport;
15
+ cache: FederationCache<SourceFileCache>;
16
+ dev: boolean;
17
+ isMappingOrExposed: boolean;
18
+ hash: boolean;
19
+ chunks?: boolean;
20
+ platform?: 'browser' | 'node';
21
+ optimizedMappings: boolean;
22
+ }
23
+ export declare function normalizeContextOptions(builderOptions: ApplicationBuilderOptions & NfInternalOptions, context: BuilderContext, adapterOptions: NFBuildAdapterOptions<SourceFileCache>): NormalizedContextOptions;
24
+ //# sourceMappingURL=normalize-context-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-context-options.d.ts","sourceRoot":"","sources":["../../../src/utils/normalize-context-options.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,EACV,eAAe,EACf,UAAU,EACV,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,WAAW,wBAAwB;IACvC,cAAc,EAAE,yBAAyB,GAAG,iBAAiB,CAAC;IAC9D,OAAO,EAAE,cAAc,CAAC;IACxB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,YAAY,CAAC;IAC1B,KAAK,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC;IACxC,GAAG,EAAE,OAAO,CAAC;IACb,kBAAkB,EAAE,OAAO,CAAC;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC9B,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,yBAAyB,GAAG,iBAAiB,EAC7D,OAAO,EAAE,cAAc,EACvB,cAAc,EAAE,qBAAqB,CAAC,eAAe,CAAC,GACrD,wBAAwB,CAiB1B"}
@@ -0,0 +1,18 @@
1
+ export function normalizeContextOptions(builderOptions, context, adapterOptions) {
2
+ return {
3
+ builderOptions,
4
+ context,
5
+ entryPoints: adapterOptions.entryPoints,
6
+ external: adapterOptions.external,
7
+ outdir: adapterOptions.outdir,
8
+ tsConfigPath: adapterOptions.tsConfigPath,
9
+ mappedPaths: adapterOptions.mappedPaths,
10
+ cache: adapterOptions.cache,
11
+ dev: !!adapterOptions.dev,
12
+ isMappingOrExposed: !!adapterOptions.isMappingOrExposed,
13
+ hash: !!adapterOptions.hash,
14
+ chunks: adapterOptions.chunks,
15
+ platform: adapterOptions.platform,
16
+ optimizedMappings: !!adapterOptions.optimizedMappings,
17
+ };
18
+ }