@angular-architects/native-federation 0.9.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 (61) hide show
  1. package/README.md +259 -0
  2. package/builders.json +10 -0
  3. package/collection.json +17 -0
  4. package/config.d.ts +1 -0
  5. package/config.js +5 -0
  6. package/config.js.map +1 -0
  7. package/executors.json +10 -0
  8. package/generators.json +12 -0
  9. package/package.json +27 -0
  10. package/src/builders/build/builder.d.ts +5 -0
  11. package/src/builders/build/builder.js +224 -0
  12. package/src/builders/build/builder.js.map +1 -0
  13. package/src/builders/build/schema.d.ts +3 -0
  14. package/src/builders/build/schema.json +550 -0
  15. package/src/config/federation-config.d.ts +26 -0
  16. package/src/config/federation-config.js +3 -0
  17. package/src/config/federation-config.js.map +1 -0
  18. package/src/config/index.d.ts +2 -0
  19. package/src/config/index.js +10 -0
  20. package/src/config/index.js.map +1 -0
  21. package/src/config/with-native-federation.d.ts +2 -0
  22. package/src/config/with-native-federation.js +53 -0
  23. package/src/config/with-native-federation.js.map +1 -0
  24. package/src/config.d.ts +2 -0
  25. package/src/config.js +10 -0
  26. package/src/config.js.map +1 -0
  27. package/src/executors/build/executor.d.ts +4 -0
  28. package/src/executors/build/executor.js +13 -0
  29. package/src/executors/build/executor.js.map +1 -0
  30. package/src/executors/build/schema.d.ts +1 -0
  31. package/src/executors/build/schema.json +9 -0
  32. package/src/generators/native-federation/files/src/index.ts__template__ +1 -0
  33. package/src/generators/native-federation/generator.d.ts +3 -0
  34. package/src/generators/native-federation/generator.js +44 -0
  35. package/src/generators/native-federation/generator.js.map +1 -0
  36. package/src/generators/native-federation/schema.d.ts +5 -0
  37. package/src/generators/native-federation/schema.json +29 -0
  38. package/src/index.d.ts +1 -0
  39. package/src/index.js +5 -0
  40. package/src/index.js.map +1 -0
  41. package/src/schematics/init/files/federation.config.js +19 -0
  42. package/src/schematics/init/schema.d.ts +6 -0
  43. package/src/schematics/init/schema.json +34 -0
  44. package/src/schematics/init/schematic.d.ts +4 -0
  45. package/src/schematics/init/schematic.js +174 -0
  46. package/src/schematics/init/schematic.js.map +1 -0
  47. package/src/utils/build-utils.d.ts +9 -0
  48. package/src/utils/build-utils.js +38 -0
  49. package/src/utils/build-utils.js.map +1 -0
  50. package/src/utils/hash-file.d.ts +1 -0
  51. package/src/utils/hash-file.js +13 -0
  52. package/src/utils/hash-file.js.map +1 -0
  53. package/src/utils/mapped-paths.d.ts +10 -0
  54. package/src/utils/mapped-paths.js +37 -0
  55. package/src/utils/mapped-paths.js.map +1 -0
  56. package/src/utils/package-info.d.ts +7 -0
  57. package/src/utils/package-info.js +94 -0
  58. package/src/utils/package-info.js.map +1 -0
  59. package/src/utils/shared-mappings-plugin.d.ts +3 -0
  60. package/src/utils/shared-mappings-plugin.js +29 -0
  61. package/src/utils/shared-mappings-plugin.js.map +1 -0
@@ -0,0 +1,550 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "title": "Esbuild browser schema for Build Facade.",
4
+ "description": "Browser target options",
5
+ "type": "object",
6
+ "properties": {
7
+ "assets": {
8
+ "type": "array",
9
+ "description": "List of static application assets.",
10
+ "default": [],
11
+ "items": {
12
+ "$ref": "#/definitions/assetPattern"
13
+ }
14
+ },
15
+ "main": {
16
+ "type": "string",
17
+ "description": "The full path for the main entry point to the app, relative to the current workspace."
18
+ },
19
+ "polyfills": {
20
+ "type": "string",
21
+ "description": "The full path for the polyfills file, relative to the current workspace."
22
+ },
23
+ "tsConfig": {
24
+ "type": "string",
25
+ "description": "The full path for the TypeScript configuration file, relative to the current workspace."
26
+ },
27
+ "scripts": {
28
+ "description": "Global scripts to be included in the build.",
29
+ "type": "array",
30
+ "default": [],
31
+ "items": {
32
+ "oneOf": [
33
+ {
34
+ "type": "object",
35
+ "properties": {
36
+ "input": {
37
+ "type": "string",
38
+ "description": "The file to include.",
39
+ "pattern": "\\.[cm]?jsx?$"
40
+ },
41
+ "bundleName": {
42
+ "type": "string",
43
+ "pattern": "^[\\w\\-.]*$",
44
+ "description": "The bundle name for this extra entry point."
45
+ },
46
+ "inject": {
47
+ "type": "boolean",
48
+ "description": "If the bundle will be referenced in the HTML file.",
49
+ "default": true
50
+ }
51
+ },
52
+ "additionalProperties": false,
53
+ "required": ["input"]
54
+ },
55
+ {
56
+ "type": "string",
57
+ "description": "The file to include.",
58
+ "pattern": "\\.[cm]?jsx?$"
59
+ }
60
+ ]
61
+ }
62
+ },
63
+ "styles": {
64
+ "description": "Global styles to be included in the build.",
65
+ "type": "array",
66
+ "default": [],
67
+ "items": {
68
+ "oneOf": [
69
+ {
70
+ "type": "object",
71
+ "properties": {
72
+ "input": {
73
+ "type": "string",
74
+ "description": "The file to include.",
75
+ "pattern": "\\.(?:css|scss|sass|less|styl)$"
76
+ },
77
+ "bundleName": {
78
+ "type": "string",
79
+ "pattern": "^[\\w\\-.]*$",
80
+ "description": "The bundle name for this extra entry point."
81
+ },
82
+ "inject": {
83
+ "type": "boolean",
84
+ "description": "If the bundle will be referenced in the HTML file.",
85
+ "default": true
86
+ }
87
+ },
88
+ "additionalProperties": false,
89
+ "required": ["input"]
90
+ },
91
+ {
92
+ "type": "string",
93
+ "description": "The file to include.",
94
+ "pattern": "\\.(?:css|scss|sass|less|styl)$"
95
+ }
96
+ ]
97
+ }
98
+ },
99
+ "inlineStyleLanguage": {
100
+ "description": "The stylesheet language to use for the application's inline component styles.",
101
+ "type": "string",
102
+ "default": "css",
103
+ "enum": ["css", "less", "sass", "scss"]
104
+ },
105
+ "stylePreprocessorOptions": {
106
+ "description": "Options to pass to style preprocessors.",
107
+ "type": "object",
108
+ "properties": {
109
+ "includePaths": {
110
+ "description": "Paths to include. Paths will be resolved to workspace root.",
111
+ "type": "array",
112
+ "items": {
113
+ "type": "string"
114
+ },
115
+ "default": []
116
+ }
117
+ },
118
+ "additionalProperties": false
119
+ },
120
+ "externalDependencies": {
121
+ "description": "Exclude the listed external dependencies from being bundled into the bundle. Instead, the created bundle relies on these dependencies to be available during runtime.",
122
+ "type": "array",
123
+ "items": {
124
+ "type": "string"
125
+ },
126
+ "default": []
127
+ },
128
+ "optimization": {
129
+ "description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration.",
130
+ "x-user-analytics": 16,
131
+ "default": true,
132
+ "oneOf": [
133
+ {
134
+ "type": "object",
135
+ "properties": {
136
+ "scripts": {
137
+ "type": "boolean",
138
+ "description": "Enables optimization of the scripts output.",
139
+ "default": true
140
+ },
141
+ "styles": {
142
+ "description": "Enables optimization of the styles output.",
143
+ "default": true,
144
+ "oneOf": [
145
+ {
146
+ "type": "object",
147
+ "properties": {
148
+ "minify": {
149
+ "type": "boolean",
150
+ "description": "Minify CSS definitions by removing extraneous whitespace and comments, merging identifiers and minimizing values.",
151
+ "default": true
152
+ },
153
+ "inlineCritical": {
154
+ "type": "boolean",
155
+ "description": "Extract and inline critical CSS definitions to improve first paint time.",
156
+ "default": true
157
+ }
158
+ },
159
+ "additionalProperties": false
160
+ },
161
+ {
162
+ "type": "boolean"
163
+ }
164
+ ]
165
+ },
166
+ "fonts": {
167
+ "description": "Enables optimization for fonts. This option requires internet access. `HTTPS_PROXY` environment variable can be used to specify a proxy server.",
168
+ "default": true,
169
+ "oneOf": [
170
+ {
171
+ "type": "object",
172
+ "properties": {
173
+ "inline": {
174
+ "type": "boolean",
175
+ "description": "Reduce render blocking requests by inlining external Google Fonts and Adobe Fonts CSS definitions in the application's HTML index file. This option requires internet access. `HTTPS_PROXY` environment variable can be used to specify a proxy server.",
176
+ "default": true
177
+ }
178
+ },
179
+ "additionalProperties": false
180
+ },
181
+ {
182
+ "type": "boolean"
183
+ }
184
+ ]
185
+ }
186
+ },
187
+ "additionalProperties": false
188
+ },
189
+ {
190
+ "type": "boolean"
191
+ }
192
+ ]
193
+ },
194
+ "fileReplacements": {
195
+ "description": "Replace compilation source files with other compilation source files in the build.",
196
+ "type": "array",
197
+ "items": {
198
+ "$ref": "#/definitions/fileReplacement"
199
+ },
200
+ "default": []
201
+ },
202
+ "outputPath": {
203
+ "type": "string",
204
+ "description": "The full path for the new output directory, relative to the current workspace.\nBy default, writes output to a folder named dist/ in the current project."
205
+ },
206
+ "resourcesOutputPath": {
207
+ "type": "string",
208
+ "description": "The path where style resources will be placed, relative to outputPath."
209
+ },
210
+ "aot": {
211
+ "type": "boolean",
212
+ "description": "Build using Ahead of Time compilation.",
213
+ "x-user-analytics": 13,
214
+ "default": true
215
+ },
216
+ "sourceMap": {
217
+ "description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.",
218
+ "default": false,
219
+ "oneOf": [
220
+ {
221
+ "type": "object",
222
+ "properties": {
223
+ "scripts": {
224
+ "type": "boolean",
225
+ "description": "Output source maps for all scripts.",
226
+ "default": true
227
+ },
228
+ "styles": {
229
+ "type": "boolean",
230
+ "description": "Output source maps for all styles.",
231
+ "default": true
232
+ },
233
+ "hidden": {
234
+ "type": "boolean",
235
+ "description": "Output source maps used for error reporting tools.",
236
+ "default": false
237
+ },
238
+ "vendor": {
239
+ "type": "boolean",
240
+ "description": "Resolve vendor packages source maps.",
241
+ "default": false
242
+ }
243
+ },
244
+ "additionalProperties": false
245
+ },
246
+ {
247
+ "type": "boolean"
248
+ }
249
+ ]
250
+ },
251
+ "vendorChunk": {
252
+ "type": "boolean",
253
+ "description": "Generate a seperate bundle containing only vendor libraries. This option should only used for development.",
254
+ "default": false
255
+ },
256
+ "commonChunk": {
257
+ "type": "boolean",
258
+ "description": "Generate a seperate bundle containing code used across multiple bundles.",
259
+ "default": true
260
+ },
261
+ "baseHref": {
262
+ "type": "string",
263
+ "description": "Base url for the application being built."
264
+ },
265
+ "deployUrl": {
266
+ "type": "string",
267
+ "description": "URL where files will be deployed.",
268
+ "x-deprecated": "Use \"baseHref\" option, \"APP_BASE_HREF\" DI token or a combination of both instead. For more information, see https://angular.io/guide/deployment#the-deploy-url."
269
+ },
270
+ "verbose": {
271
+ "type": "boolean",
272
+ "description": "Adds more details to output logging.",
273
+ "default": false
274
+ },
275
+ "progress": {
276
+ "type": "boolean",
277
+ "description": "Log progress to the console while building.",
278
+ "default": true
279
+ },
280
+ "i18nMissingTranslation": {
281
+ "type": "string",
282
+ "description": "How to handle missing translations for i18n.",
283
+ "enum": ["warning", "error", "ignore"],
284
+ "default": "warning"
285
+ },
286
+ "i18nDuplicateTranslation": {
287
+ "type": "string",
288
+ "description": "How to handle duplicate translations for i18n.",
289
+ "enum": ["warning", "error", "ignore"],
290
+ "default": "warning"
291
+ },
292
+ "localize": {
293
+ "description": "Translate the bundles in one or more locales.",
294
+ "oneOf": [
295
+ {
296
+ "type": "boolean",
297
+ "description": "Translate all locales."
298
+ },
299
+ {
300
+ "type": "array",
301
+ "description": "List of locales ID's to translate.",
302
+ "minItems": 1,
303
+ "items": {
304
+ "type": "string",
305
+ "pattern": "^[a-zA-Z]{2,3}(-[a-zA-Z]{4})?(-([a-zA-Z]{2}|[0-9]{3}))?(-[a-zA-Z]{5,8})?(-x(-[a-zA-Z0-9]{1,8})+)?$"
306
+ }
307
+ }
308
+ ]
309
+ },
310
+ "watch": {
311
+ "type": "boolean",
312
+ "description": "Run build when files change.",
313
+ "default": false
314
+ },
315
+ "outputHashing": {
316
+ "type": "string",
317
+ "description": "Define the output filename cache-busting hashing mode.",
318
+ "default": "none",
319
+ "enum": ["none", "all", "media", "bundles"]
320
+ },
321
+ "poll": {
322
+ "type": "number",
323
+ "description": "Enable and define the file watching poll time period in milliseconds."
324
+ },
325
+ "deleteOutputPath": {
326
+ "type": "boolean",
327
+ "description": "Delete the output path before building.",
328
+ "default": true
329
+ },
330
+ "preserveSymlinks": {
331
+ "type": "boolean",
332
+ "description": "Do not use the real path when resolving modules. If unset then will default to `true` if NodeJS option --preserve-symlinks is set."
333
+ },
334
+ "extractLicenses": {
335
+ "type": "boolean",
336
+ "description": "Extract all licenses in a separate file.",
337
+ "default": true
338
+ },
339
+ "buildOptimizer": {
340
+ "type": "boolean",
341
+ "description": "Enables advanced build optimizations when using the 'aot' option.",
342
+ "default": true
343
+ },
344
+ "namedChunks": {
345
+ "type": "boolean",
346
+ "description": "Use file name for lazy loaded chunks.",
347
+ "default": false
348
+ },
349
+ "subresourceIntegrity": {
350
+ "type": "boolean",
351
+ "description": "Enables the use of subresource integrity validation.",
352
+ "default": false
353
+ },
354
+ "serviceWorker": {
355
+ "type": "boolean",
356
+ "description": "Generates a service worker config for production builds.",
357
+ "default": false
358
+ },
359
+ "ngswConfigPath": {
360
+ "type": "string",
361
+ "description": "Path to ngsw-config.json."
362
+ },
363
+ "index": {
364
+ "description": "Configures the generation of the application's HTML index.",
365
+ "oneOf": [
366
+ {
367
+ "type": "string",
368
+ "description": "The path of a file to use for the application's HTML index. The filename of the specified path will be used for the generated file and will be created in the root of the application's configured output path."
369
+ },
370
+ {
371
+ "type": "object",
372
+ "description": "",
373
+ "properties": {
374
+ "input": {
375
+ "type": "string",
376
+ "minLength": 1,
377
+ "description": "The path of a file to use for the application's generated HTML index."
378
+ },
379
+ "output": {
380
+ "type": "string",
381
+ "minLength": 1,
382
+ "default": "index.html",
383
+ "description": "The output path of the application's generated HTML index file. The full provided path will be used and will be considered relative to the application's configured output path."
384
+ }
385
+ },
386
+ "required": ["input"]
387
+ }
388
+ ]
389
+ },
390
+ "statsJson": {
391
+ "type": "boolean",
392
+ "description": "Generates a 'stats.json' file which can be analyzed using tools such as 'webpack-bundle-analyzer'.",
393
+ "default": false
394
+ },
395
+ "budgets": {
396
+ "description": "Budget thresholds to ensure parts of your application stay within boundaries which you set.",
397
+ "type": "array",
398
+ "items": {
399
+ "$ref": "#/definitions/budget"
400
+ },
401
+ "default": []
402
+ },
403
+ "webWorkerTsConfig": {
404
+ "type": "string",
405
+ "description": "TypeScript configuration for Web Worker modules."
406
+ },
407
+ "crossOrigin": {
408
+ "type": "string",
409
+ "description": "Define the crossorigin attribute setting of elements that provide CORS support.",
410
+ "default": "none",
411
+ "enum": ["none", "anonymous", "use-credentials"]
412
+ },
413
+ "allowedCommonJsDependencies": {
414
+ "description": "A list of CommonJS packages that are allowed to be used without a build time warning.",
415
+ "type": "array",
416
+ "items": {
417
+ "type": "string"
418
+ },
419
+ "default": []
420
+ }
421
+ },
422
+ "additionalProperties": false,
423
+ "required": ["outputPath", "index", "main", "tsConfig"],
424
+ "definitions": {
425
+ "assetPattern": {
426
+ "oneOf": [
427
+ {
428
+ "type": "object",
429
+ "properties": {
430
+ "followSymlinks": {
431
+ "type": "boolean",
432
+ "default": false,
433
+ "description": "Allow glob patterns to follow symlink directories. This allows subdirectories of the symlink to be searched."
434
+ },
435
+ "glob": {
436
+ "type": "string",
437
+ "description": "The pattern to match."
438
+ },
439
+ "input": {
440
+ "type": "string",
441
+ "description": "The input directory path in which to apply 'glob'. Defaults to the project root."
442
+ },
443
+ "ignore": {
444
+ "description": "An array of globs to ignore.",
445
+ "type": "array",
446
+ "items": {
447
+ "type": "string"
448
+ }
449
+ },
450
+ "output": {
451
+ "type": "string",
452
+ "description": "Absolute path within the output."
453
+ }
454
+ },
455
+ "additionalProperties": false,
456
+ "required": ["glob", "input", "output"]
457
+ },
458
+ {
459
+ "type": "string"
460
+ }
461
+ ]
462
+ },
463
+ "fileReplacement": {
464
+ "oneOf": [
465
+ {
466
+ "type": "object",
467
+ "properties": {
468
+ "src": {
469
+ "type": "string",
470
+ "pattern": "\\.(([cm]?j|t)sx?|json)$"
471
+ },
472
+ "replaceWith": {
473
+ "type": "string",
474
+ "pattern": "\\.(([cm]?j|t)sx?|json)$"
475
+ }
476
+ },
477
+ "additionalProperties": false,
478
+ "required": ["src", "replaceWith"]
479
+ },
480
+ {
481
+ "type": "object",
482
+ "properties": {
483
+ "replace": {
484
+ "type": "string",
485
+ "pattern": "\\.(([cm]?j|t)sx?|json)$"
486
+ },
487
+ "with": {
488
+ "type": "string",
489
+ "pattern": "\\.(([cm]?j|t)sx?|json)$"
490
+ }
491
+ },
492
+ "additionalProperties": false,
493
+ "required": ["replace", "with"]
494
+ }
495
+ ]
496
+ },
497
+ "budget": {
498
+ "type": "object",
499
+ "properties": {
500
+ "type": {
501
+ "type": "string",
502
+ "description": "The type of budget.",
503
+ "enum": [
504
+ "all",
505
+ "allScript",
506
+ "any",
507
+ "anyScript",
508
+ "anyComponentStyle",
509
+ "bundle",
510
+ "initial"
511
+ ]
512
+ },
513
+ "name": {
514
+ "type": "string",
515
+ "description": "The name of the bundle."
516
+ },
517
+ "baseline": {
518
+ "type": "string",
519
+ "description": "The baseline size for comparison."
520
+ },
521
+ "maximumWarning": {
522
+ "type": "string",
523
+ "description": "The maximum threshold for warning relative to the baseline."
524
+ },
525
+ "maximumError": {
526
+ "type": "string",
527
+ "description": "The maximum threshold for error relative to the baseline."
528
+ },
529
+ "minimumWarning": {
530
+ "type": "string",
531
+ "description": "The minimum threshold for warning relative to the baseline."
532
+ },
533
+ "minimumError": {
534
+ "type": "string",
535
+ "description": "The minimum threshold for error relative to the baseline."
536
+ },
537
+ "warning": {
538
+ "type": "string",
539
+ "description": "The threshold for warning relative to the baseline (min & max)."
540
+ },
541
+ "error": {
542
+ "type": "string",
543
+ "description": "The threshold for error relative to the baseline (min & max)."
544
+ }
545
+ },
546
+ "additionalProperties": false,
547
+ "required": ["type"]
548
+ }
549
+ }
550
+ }
@@ -0,0 +1,26 @@
1
+ import { MappedPath } from '../utils/mapped-paths';
2
+ export interface SharedConfig {
3
+ singleton?: boolean;
4
+ strictVersion?: boolean;
5
+ requiredVersion?: string;
6
+ version?: string;
7
+ }
8
+ export interface FederationConfig {
9
+ name?: string;
10
+ exposes?: Record<string, string>;
11
+ shared?: Record<string, SharedConfig>;
12
+ sharedMappings?: Array<string>;
13
+ skip?: Array<string>;
14
+ }
15
+ export interface NormalizedSharedConfig {
16
+ singleton: boolean;
17
+ strictVersion: boolean;
18
+ requiredVersion: string;
19
+ version?: string;
20
+ }
21
+ export interface NormalizedFederationConfig {
22
+ name: string;
23
+ exposes: Record<string, string>;
24
+ shared: Record<string, NormalizedSharedConfig>;
25
+ sharedMappings: Array<MappedPath>;
26
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=federation-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-config.js","sourceRoot":"","sources":["../../../../../libs/native-federation/src/config/federation-config.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './with-native-federation';
2
+ export { findRootTsConfigJson, share, shareAll, } from '@angular-architects/module-federation/webpack';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shareAll = exports.share = exports.findRootTsConfigJson = void 0;
4
+ const tslib_1 = require("tslib");
5
+ tslib_1.__exportStar(require("./with-native-federation"), exports);
6
+ var webpack_1 = require("@angular-architects/module-federation/webpack");
7
+ Object.defineProperty(exports, "findRootTsConfigJson", { enumerable: true, get: function () { return webpack_1.findRootTsConfigJson; } });
8
+ Object.defineProperty(exports, "share", { enumerable: true, get: function () { return webpack_1.share; } });
9
+ Object.defineProperty(exports, "shareAll", { enumerable: true, get: function () { return webpack_1.shareAll; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/native-federation/src/config/index.ts"],"names":[],"mappings":";;;;AAAA,mEAAyC;AACzC,yEAIuD;AAHrD,+GAAA,oBAAoB,OAAA;AACpB,gGAAA,KAAK,OAAA;AACL,mGAAA,QAAQ,OAAA"}
@@ -0,0 +1,2 @@
1
+ import { FederationConfig, NormalizedFederationConfig } from './federation-config';
2
+ export declare function withNativeFederation(config: FederationConfig): NormalizedFederationConfig;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withNativeFederation = void 0;
4
+ const mapped_paths_1 = require("../utils/mapped-paths");
5
+ const config_1 = require("../config");
6
+ function withNativeFederation(config) {
7
+ var _a, _b, _c;
8
+ const skip = (_a = new Set(config.skip)) !== null && _a !== void 0 ? _a : new Set();
9
+ return {
10
+ name: (_b = config.name) !== null && _b !== void 0 ? _b : '',
11
+ exposes: (_c = config.exposes) !== null && _c !== void 0 ? _c : {},
12
+ shared: normalizeShared(config, skip),
13
+ sharedMappings: normalizeSharedMappings(config, skip),
14
+ };
15
+ }
16
+ exports.withNativeFederation = withNativeFederation;
17
+ function normalizeShared(config, skip) {
18
+ let result = {};
19
+ const shared = config.shared;
20
+ if (!shared) {
21
+ result = (0, config_1.shareAll)({
22
+ singleton: true,
23
+ strictVersion: true,
24
+ requiredVersion: 'auto',
25
+ });
26
+ }
27
+ else {
28
+ result = Object.keys(shared).reduce((acc, cur) => {
29
+ var _a, _b, _c;
30
+ return (Object.assign(Object.assign({}, acc), { [cur]: {
31
+ requiredVersion: (_a = shared[cur].requiredVersion) !== null && _a !== void 0 ? _a : 'auto',
32
+ singleton: (_b = shared[cur].singleton) !== null && _b !== void 0 ? _b : false,
33
+ strictVersion: (_c = shared[cur].strictVersion) !== null && _c !== void 0 ? _c : false,
34
+ version: shared[cur].version,
35
+ } }));
36
+ }, {});
37
+ result = (0, config_1.share)(result);
38
+ }
39
+ result = Object.keys(result)
40
+ .filter((key) => !skip.has(key))
41
+ .reduce((acc, cur) => (Object.assign(Object.assign({}, acc), { [cur]: result[cur] })), {});
42
+ return result;
43
+ }
44
+ function normalizeSharedMappings(config, skip) {
45
+ const rootTsConfigPath = (0, config_1.findRootTsConfigJson)();
46
+ const paths = (0, mapped_paths_1.getMappedPaths)({
47
+ rootTsConfigPath,
48
+ sharedMappings: config.sharedMappings,
49
+ });
50
+ const result = paths.filter((p) => !skip.has(p.key));
51
+ return result;
52
+ }
53
+ //# sourceMappingURL=with-native-federation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with-native-federation.js","sourceRoot":"","sources":["../../../../../libs/native-federation/src/config/with-native-federation.ts"],"names":[],"mappings":";;;AAAA,wDAAmE;AACnE,sCAAkE;AAQlE,SAAgB,oBAAoB,CAClC,MAAwB;;IAExB,MAAM,IAAI,GAAG,MAAA,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,mCAAI,IAAI,GAAG,EAAU,CAAC;IAEvD,OAAO;QACL,IAAI,EAAE,MAAA,MAAM,CAAC,IAAI,mCAAI,EAAE;QACvB,OAAO,EAAE,MAAA,MAAM,CAAC,OAAO,mCAAI,EAAE;QAC7B,MAAM,EAAE,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC;QACrC,cAAc,EAAE,uBAAuB,CAAC,MAAM,EAAE,IAAI,CAAC;KACtD,CAAC;AACJ,CAAC;AAXD,oDAWC;AAED,SAAS,eAAe,CACtB,MAAwB,EACxB,IAAiB;IAEjB,IAAI,MAAM,GAA2C,EAAE,CAAC;IAExD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAE7B,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,GAAG,IAAA,iBAAQ,EAAC;YAChB,SAAS,EAAE,IAAI;YACf,aAAa,EAAE,IAAI;YACnB,eAAe,EAAE,MAAM;SACxB,CAA2C,CAAC;KAC9C;SAAM;QACL,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CACjC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;;YAAC,OAAA,iCACT,GAAG,KACN,CAAC,GAAG,CAAC,EAAE;oBACL,eAAe,EAAE,MAAA,MAAM,CAAC,GAAG,CAAC,CAAC,eAAe,mCAAI,MAAM;oBACtD,SAAS,EAAE,MAAA,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,mCAAI,KAAK;oBACzC,aAAa,EAAE,MAAA,MAAM,CAAC,GAAG,CAAC,CAAC,aAAa,mCAAI,KAAK;oBACjD,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO;iBAC7B,IACD,CAAA;SAAA,EACF,EAAE,CACH,CAAC;QAEF,MAAM,GAAG,IAAA,cAAK,EAAC,MAAM,CAA2C,CAAC;KAClE;IAED,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;SACzB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SAC/B,MAAM,CACL,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,iCACT,GAAG,KACN,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,IAClB,EACF,EAAE,CACH,CAAC;IAEJ,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,uBAAuB,CAC9B,MAAwB,EACxB,IAAiB;IAEjB,MAAM,gBAAgB,GAAG,IAAA,6BAAoB,GAAE,CAAC;IAEhD,MAAM,KAAK,GAAG,IAAA,6BAAc,EAAC;QAC3B,gBAAgB;QAChB,cAAc,EAAE,MAAM,CAAC,cAAc;KACtC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAErD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './config/with-native-federation';
2
+ export { findRootTsConfigJson, share, shareAll, } from '@angular-architects/module-federation/webpack';