@angular-architects/native-federation-v4 20.3.1 → 20.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-architects/native-federation-v4",
3
- "version": "20.3.1",
3
+ "version": "20.3.2",
4
4
  "generators": "./collection.json",
5
5
  "builders": "./builders.json",
6
6
  "schematics": "./collection.json",
@@ -10,8 +10,8 @@
10
10
  "url": "http://www.angulararchitects.io"
11
11
  },
12
12
  "dependencies": {
13
- "@softarc/native-federation": "4.0.0-RC1",
14
- "@softarc/native-federation-runtime": "4.0.0-RC1",
13
+ "@softarc/native-federation": "4.0.0-RC3",
14
+ "@softarc/native-federation-runtime": "4.0.0-RC3",
15
15
  "@angular-devkit/architect": "^0.2003.1",
16
16
  "@angular-devkit/build-angular": "~20.3.1",
17
17
  "@angular-devkit/core": "~20.3.1",
@@ -1 +1 @@
1
- {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../../src/builders/build/builder.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAGnB,MAAM,2BAA2B,CAAC;AAkCnC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAsCnD,wBAAuB,UAAU,CAC/B,SAAS,EAAE,eAAe,EAC1B,OAAO,EAAE,cAAc,GACtB,aAAa,CAAC,aAAa,CAAC,CA8X9B;wBA6C2C,GAAG;AAA/C,wBAAgD"}
1
+ {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../../src/builders/build/builder.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAGnB,MAAM,2BAA2B,CAAC;AAkCnC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAsCnD,wBAAuB,UAAU,CAC/B,SAAS,EAAE,eAAe,EAC1B,OAAO,EAAE,cAAc,GACtB,aAAa,CAAC,aAAa,CAAC,CA+X9B;wBA6C2C,GAAG;AAA/C,wBAAgD"}
@@ -11,7 +11,7 @@ import { createAngularBuildAdapter, setMemResultHandler, } from '../../utils/ang
11
11
  import { existsSync, mkdirSync, rmSync } from 'fs';
12
12
  import { fstart } from '../../tools/fstart-as-data-url.js';
13
13
  import { EsBuildResult, MemResults, NgCliAssetResult } from '../../utils/mem-resuts.js';
14
- import { getI18nConfig, translateFederationArtefacts } from '../../utils/i18n.js';
14
+ import { getI18nConfig, translateFederationArtifacts } from '../../utils/i18n.js';
15
15
  import { RebuildHubs } from '../../utils/rebuild-events.js';
16
16
  import { createSharedMappingsPlugin } from '../../utils/shared-mappings-plugin.js';
17
17
  import { updateScriptTags } from '../../utils/updateIndexHtml.js';
@@ -126,6 +126,7 @@ export async function* runBuilder(nfOptions, context) {
126
126
  verbose: options.verbose,
127
127
  watch: false, // options.watch,
128
128
  dev: !!nfOptions.dev,
129
+ chunks: !nfOptions.chunks ? false : nfOptions.chunks,
129
130
  entryPoint,
130
131
  buildNotifications: nfOptions.buildNotifications,
131
132
  cacheExternalArtifacts: nfOptions.cacheExternalArtifacts,
@@ -217,7 +218,7 @@ export async function* runBuilder(nfOptions, context) {
217
218
  const hasLocales = i18n?.locales && Object.keys(i18n.locales).length > 0;
218
219
  if (hasLocales && localeFilter) {
219
220
  const start = process.hrtime();
220
- translateFederationArtefacts(i18n, localeFilter, outputOptions.base, federationResult);
221
+ translateFederationArtifacts(i18n, localeFilter, outputOptions.base, federationResult);
221
222
  logger.measure(start, 'To translate the artifacts.');
222
223
  }
223
224
  options.deleteOutputPath = false;
@@ -276,7 +277,7 @@ export async function* runBuilder(nfOptions, context) {
276
277
  throw new AbortedError('[builder] After federation build.');
277
278
  }
278
279
  if (hasLocales && localeFilter) {
279
- translateFederationArtefacts(i18n, localeFilter, outputOptions.base, federationResult);
280
+ translateFederationArtifacts(i18n, localeFilter, outputOptions.base, federationResult);
280
281
  }
281
282
  if (signal?.aborted) {
282
283
  throw new AbortedError('[builder] After federation translations.');
@@ -17,5 +17,6 @@ export interface NfBuilderSchema extends JsonObject {
17
17
  outputPath?: string;
18
18
  ssr: boolean;
19
19
  devServer?: boolean;
20
+ chunks?: { enable: boolean; dense: true };
20
21
  cacheExternalArtifacts?: boolean;
21
22
  } // eslint-disable-line
@@ -32,7 +32,7 @@
32
32
  "rebuildDelay": {
33
33
  "type": "number",
34
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."
35
+ "description": "The delay for rebuilding federation artifacts. This allows to have more resources for refreshing your micro frontend in the browser."
36
36
  },
37
37
  "shell": {
38
38
  "type": "string",
@@ -65,6 +65,25 @@
65
65
  "type": "boolean",
66
66
  "description": "can be used to disable the dev server when dev=true"
67
67
  },
68
+ "cacheExternalArtifacts": {
69
+ "type": "boolean",
70
+ "description": "Will cache the shared externals so they can be re-used between builds"
71
+ },
72
+ "chunks": {
73
+ "type": "object",
74
+ "properties": {
75
+ "enable": {
76
+ "type": "boolean",
77
+ "default": true,
78
+ "description": "Enable chunking (code splitting)."
79
+ },
80
+ "dense": {
81
+ "type": "boolean",
82
+ "default": false,
83
+ "description": "Allows for a more compact remoteEntry.json."
84
+ }
85
+ }
86
+ },
68
87
  "buildNotifications": {
69
88
  "type": "object",
70
89
  "properties": {
@@ -1 +1 @@
1
- {"version":3,"file":"angular-esbuild-adapter.d.ts","sourceRoot":"","sources":["../../../src/utils/angular-esbuild-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAWnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAShE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAQhE,OAAO,EAAE,KAAK,aAAa,EAAe,MAAM,qBAAqB,CAAC;AAMt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function setMemResultHandler(handler) {
19
19
  }
20
20
  export function createAngularBuildAdapter(builderOptions, context, rebuildRequested = new RebuildHubs()) {
21
21
  return async (options) => {
22
- const { entryPoints, tsConfigPath, external, outdir, mappedPaths, kind, watch, dev, hash, platform, optimizedMappings, signal, } = options;
22
+ const { entryPoints, tsConfigPath, external, outdir, mappedPaths, kind, watch, dev, hash, chunks, platform, optimizedMappings, signal, } = options;
23
23
  setNgServerMode();
24
- const files = await runEsbuild(builderOptions, context, entryPoints, external, outdir, tsConfigPath, mappedPaths, watch, rebuildRequested, dev, kind, hash, undefined, undefined, undefined, platform, optimizedMappings, signal);
24
+ const files = await runEsbuild(builderOptions, context, entryPoints, external, outdir, tsConfigPath, mappedPaths, watch, rebuildRequested, dev, kind, chunks, hash, undefined, undefined, undefined, platform, optimizedMappings, signal);
25
25
  if (kind === 'shared-package') {
26
26
  const scriptFiles = files.filter(f => f.endsWith('.js') || f.endsWith('.mjs'));
27
27
  for (const file of scriptFiles) {
@@ -62,7 +62,7 @@ export function createAngularBuildAdapter(builderOptions, context, rebuildReques
62
62
  }
63
63
  }
64
64
  }
65
- async function runEsbuild(builderOptions, context, entryPoints, external, outdir, tsConfigPath, mappedPaths, watch, rebuildRequested = new RebuildHubs(), dev, kind, hash = false, plugins = null, absWorkingDir = undefined, logLevel = 'warning', platform, optimizedMappings, signal) {
65
+ async function runEsbuild(builderOptions, context, entryPoints, external, outdir, tsConfigPath, mappedPaths, watch, rebuildRequested = new RebuildHubs(), dev, kind, chunks, hash = false, plugins = null, absWorkingDir = undefined, logLevel = 'warning', platform, optimizedMappings, signal) {
66
66
  if (signal?.aborted) {
67
67
  throw new AbortedError('[angular-esbuild-adapter] Before building');
68
68
  }
@@ -130,7 +130,7 @@ async function runEsbuild(builderOptions, context, entryPoints, external, outdir
130
130
  'async-await': false,
131
131
  'object-rest-spread': false,
132
132
  },
133
- splitting: true, //kind === 'mapping-or-exposed',
133
+ splitting: chunks, //kind === 'mapping-or-exposed',
134
134
  platform: platform ?? 'browser',
135
135
  format: 'esm',
136
136
  target: target,
@@ -19,5 +19,5 @@ export type SourceLocaleObject = {
19
19
  subPath?: string;
20
20
  };
21
21
  export declare function getI18nConfig(context: BuilderContext): Promise<I18nConfig | undefined>;
22
- export declare function translateFederationArtefacts(i18n: I18nConfig, localize: boolean | string[], outputPath: string, federationResult: FederationInfo): Promise<void>;
22
+ export declare function translateFederationArtifacts(i18n: I18nConfig, localize: boolean | string[], outputPath: string, federationResult: FederationInfo): Promise<void>;
23
23
  //# sourceMappingURL=i18n.d.ts.map
package/src/utils/i18n.js CHANGED
@@ -7,7 +7,7 @@ export async function getI18nConfig(context) {
7
7
  const i18nConfig = workspaceConfig?.i18n;
8
8
  return i18nConfig;
9
9
  }
10
- export async function translateFederationArtefacts(i18n, localize, outputPath, federationResult) {
10
+ export async function translateFederationArtifacts(i18n, localize, outputPath, federationResult) {
11
11
  const neededLocales = Array.isArray(localize) ? localize : Object.keys(i18n.locales);
12
12
  const locales = Object.keys(i18n.locales).filter(locale => neededLocales.includes(locale));
13
13
  if (locales.length === 0) {