@softarc/native-federation 0.9.2-beta.2 → 0.9.2-beta.5

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
@@ -1,11 +1,7 @@
1
- # native-federation-core
1
+ # @softarc/native-federation
2
2
 
3
- This library was generated with [Nx](https://nx.dev).
3
+ This is the **framework- and bundler-agnostic** foundation for Native Federation.
4
4
 
5
- ## Building
5
+ Please find here an [example project](https://github.com/manfredsteyer/native-federation-core-example.git). There, have a look at ``build/build-common.ts``.
6
6
 
7
- Run `nx build native-federation-core` to build the library.
8
-
9
- ## Running unit tests
10
-
11
- Run `nx test native-federation-core` to execute the unit tests via [Jest](https://jestjs.io).
7
+ There is also an [Angular-specific wrapper](https://www.npmjs.com/package/@angular-architects/native-federation).
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@softarc/native-federation",
3
- "version": "0.9.2-beta.2",
3
+ "version": "0.9.2-beta.5",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./src/index.d.ts",
7
7
  "dependencies": {},
8
8
  "peerDependencies": {
9
- "@softarc/native-federation-runtime": "0.9.2-beta.2"
9
+ "@softarc/native-federation-runtime": "0.9.2-beta.5"
10
10
  }
11
11
  }
package/src/build.d.ts CHANGED
@@ -13,3 +13,4 @@ export { BuildAdapter } from './lib/core/build-adapter';
13
13
  export { withNativeFederation } from './lib/config/with-native-federation';
14
14
  export { buildForFederation } from './lib/core/build-for-federation';
15
15
  export { share, shareAll } from './lib/config/share-utils';
16
+ export { federationBuilder, BuildHelperParams } from './lib/core/federation-builder';
package/src/build.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shareAll = exports.share = exports.buildForFederation = exports.withNativeFederation = exports.loadFederationConfig = exports.getExternals = exports.bundleExposed = exports.bundleSharedMappings = exports.bundleShared = exports.writeFederationInfo = exports.writeImportMap = exports.setBuildAdapter = void 0;
3
+ exports.federationBuilder = exports.shareAll = exports.share = exports.buildForFederation = exports.withNativeFederation = exports.loadFederationConfig = exports.getExternals = exports.bundleExposed = exports.bundleSharedMappings = exports.bundleShared = exports.writeFederationInfo = exports.writeImportMap = exports.setBuildAdapter = void 0;
4
4
  var build_adapter_1 = require("./lib/core/build-adapter");
5
5
  Object.defineProperty(exports, "setBuildAdapter", { enumerable: true, get: function () { return build_adapter_1.setBuildAdapter; } });
6
6
  var write_import_map_1 = require("./lib/core/write-import-map");
@@ -24,4 +24,6 @@ Object.defineProperty(exports, "buildForFederation", { enumerable: true, get: fu
24
24
  var share_utils_1 = require("./lib/config/share-utils");
25
25
  Object.defineProperty(exports, "share", { enumerable: true, get: function () { return share_utils_1.share; } });
26
26
  Object.defineProperty(exports, "shareAll", { enumerable: true, get: function () { return share_utils_1.shareAll; } });
27
+ var federation_builder_1 = require("./lib/core/federation-builder");
28
+ Object.defineProperty(exports, "federationBuilder", { enumerable: true, get: function () { return federation_builder_1.federationBuilder; } });
27
29
  //# sourceMappingURL=build.js.map
package/src/build.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../libs/native-federation-core/src/build.ts"],"names":[],"mappings":";;;AAEA,0DAA2D;AAAlD,gHAAA,eAAe,OAAA;AACxB,gEAA6D;AAApD,kHAAA,cAAc,OAAA;AACvB,0EAAuE;AAA9D,4HAAA,mBAAmB,OAAA;AAC5B,0DAAwD;AAA/C,6GAAA,YAAY,OAAA;AACrB,4EAAyE;AAAhE,8HAAA,oBAAoB,OAAA;AAC7B,4DAA0D;AAAjD,+GAAA,aAAa,OAAA;AACtB,0DAAwD;AAA/C,6GAAA,YAAY,OAAA;AACrB,4EAAyE;AAAhE,8HAAA,oBAAoB,OAAA;AAG7B,8EAA2E;AAAlE,8HAAA,oBAAoB,OAAA;AAC7B,wEAAqE;AAA5D,0HAAA,kBAAkB,OAAA;AAC3B,wDAA2D;AAAlD,oGAAA,KAAK,OAAA;AAAE,uGAAA,QAAQ,OAAA"}
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../libs/native-federation-core/src/build.ts"],"names":[],"mappings":";;;AAEA,0DAA2D;AAAlD,gHAAA,eAAe,OAAA;AACxB,gEAA6D;AAApD,kHAAA,cAAc,OAAA;AACvB,0EAAuE;AAA9D,4HAAA,mBAAmB,OAAA;AAC5B,0DAAwD;AAA/C,6GAAA,YAAY,OAAA;AACrB,4EAAyE;AAAhE,8HAAA,oBAAoB,OAAA;AAC7B,4DAA0D;AAAjD,+GAAA,aAAa,OAAA;AACtB,0DAAwD;AAA/C,6GAAA,YAAY,OAAA;AACrB,4EAAyE;AAAhE,8HAAA,oBAAoB,OAAA;AAG7B,8EAA2E;AAAlE,8HAAA,oBAAoB,OAAA;AAC7B,wEAAqE;AAA5D,0HAAA,kBAAkB,OAAA;AAC3B,wDAA2D;AAAlD,oGAAA,KAAK,OAAA;AAAE,uGAAA,QAAQ,OAAA;AACxB,oEAAqF;AAA5E,uHAAA,iBAAiB,OAAA"}
@@ -0,0 +1,14 @@
1
+ import { BuildAdapter } from "./build-adapter";
2
+ import { FederationOptions } from "./federation-options";
3
+ export interface BuildHelperParams {
4
+ options: FederationOptions;
5
+ adapter: BuildAdapter;
6
+ }
7
+ declare function init(params: BuildHelperParams): Promise<void>;
8
+ declare function build(): Promise<void>;
9
+ export declare const federationBuilder: {
10
+ init: typeof init;
11
+ build: typeof build;
12
+ readonly externals: string[];
13
+ };
14
+ export {};
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.federationBuilder = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const build_adapter_1 = require("./build-adapter");
6
+ const build_for_federation_1 = require("./build-for-federation");
7
+ const get_externals_1 = require("./get-externals");
8
+ const load_federation_config_1 = require("./load-federation-config");
9
+ let externals = [];
10
+ let config;
11
+ let fedOptions;
12
+ function init(params) {
13
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
+ (0, build_adapter_1.setBuildAdapter)(params.adapter);
15
+ fedOptions = params.options;
16
+ config = yield (0, load_federation_config_1.loadFederationConfig)(fedOptions);
17
+ externals = (0, get_externals_1.getExternals)(config);
18
+ });
19
+ }
20
+ function build() {
21
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+ (0, build_for_federation_1.buildForFederation)(config, fedOptions, externals);
23
+ });
24
+ }
25
+ exports.federationBuilder = {
26
+ init,
27
+ build,
28
+ get externals() {
29
+ return externals;
30
+ }
31
+ };
32
+ //# sourceMappingURL=federation-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federation-builder.js","sourceRoot":"","sources":["../../../../../../libs/native-federation-core/src/lib/core/federation-builder.ts"],"names":[],"mappings":";;;;AACA,mDAA+D;AAC/D,iEAA4D;AAE5D,mDAA+C;AAC/C,qEAAgE;AAOhE,IAAI,SAAS,GAAa,EAAE,CAAC;AAC7B,IAAI,MAAkC,CAAC;AACvC,IAAI,UAA6B,CAAC;AAElC,SAAe,IAAI,CAAC,MAAyB;;QACzC,IAAA,+BAAe,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAChC,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;QAC5B,MAAM,GAAG,MAAM,IAAA,6CAAoB,EAAC,UAAU,CAAC,CAAC;QAChD,SAAS,GAAG,IAAA,4BAAY,EAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CAAA;AAED,SAAe,KAAK;;QAChB,IAAA,yCAAkB,EAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IACtD,CAAC;CAAA;AAEY,QAAA,iBAAiB,GAAG;IAC7B,IAAI;IACJ,KAAK;IACL,IAAI,SAAS;QACT,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export interface FederationOptions {
2
2
  workspaceRoot: string;
3
3
  outputPath: string;
4
+ federationConfig: string;
4
5
  tsConfig?: string;
5
6
  verbose?: boolean;
6
7
  }
@@ -1,2 +1,3 @@
1
1
  import { NormalizedFederationConfig } from '../config/federation-config';
2
- export declare function loadFederationConfig(fullConfigPath: string): Promise<NormalizedFederationConfig>;
2
+ import { FederationOptions } from './federation-options';
3
+ export declare function loadFederationConfig(fedOptions: FederationOptions): Promise<NormalizedFederationConfig>;
@@ -2,8 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadFederationConfig = void 0;
4
4
  const tslib_1 = require("tslib");
5
- function loadFederationConfig(fullConfigPath) {
5
+ const path = require("path");
6
+ const fs = require("fs");
7
+ function loadFederationConfig(fedOptions) {
6
8
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+ const fullConfigPath = path.join(fedOptions.workspaceRoot, fedOptions.federationConfig);
10
+ if (!fs.existsSync(fullConfigPath)) {
11
+ throw new Error('Expected ' + fullConfigPath);
12
+ }
7
13
  const config = (yield Promise.resolve().then(() => require(fullConfigPath)));
8
14
  return config;
9
15
  });
@@ -1 +1 @@
1
- {"version":3,"file":"load-federation-config.js","sourceRoot":"","sources":["../../../../../../libs/native-federation-core/src/lib/core/load-federation-config.ts"],"names":[],"mappings":";;;;AAEA,SAAsB,oBAAoB,CAAC,cAAsB;;QAC/D,MAAM,MAAM,GAAG,CAAC,2CAAa,cAAc,EAAC,CAA+B,CAAC;QAC5E,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AAHD,oDAGC"}
1
+ {"version":3,"file":"load-federation-config.js","sourceRoot":"","sources":["../../../../../../libs/native-federation-core/src/lib/core/load-federation-config.ts"],"names":[],"mappings":";;;;AAEA,6BAA6B;AAC7B,yBAAyB;AAEzB,SAAsB,oBAAoB,CAAC,UAA6B;;QAEtE,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;QAExF,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;YAClC,MAAM,IAAI,KAAK,CAAC,WAAW,GAAG,cAAc,CAAC,CAAC;SAC/C;QAED,MAAM,MAAM,GAAG,CAAC,2CAAa,cAAc,EAAC,CAA+B,CAAC;QAC5E,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AAVD,oDAUC"}