@appshell/loader 0.1.0-alpha.1 → 0.2.0-alpha.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 (44) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +6 -6
  3. package/__tests__/remoteLoader.spec.ts +28 -9
  4. package/dist/main.js +1 -1
  5. package/dist/types/config/src/deregister.d.ts +3 -0
  6. package/dist/types/config/src/deregister.d.ts.map +1 -0
  7. package/dist/types/config/src/generate.env.d.ts +1 -1
  8. package/dist/types/config/src/generate.env.d.ts.map +1 -1
  9. package/dist/types/config/src/generate.global-config.d.ts +7 -0
  10. package/dist/types/config/src/generate.global-config.d.ts.map +1 -0
  11. package/dist/types/config/src/generate.manifest.d.ts +8 -0
  12. package/dist/types/config/src/generate.manifest.d.ts.map +1 -0
  13. package/dist/types/config/src/index.d.ts +4 -4
  14. package/dist/types/config/src/index.d.ts.map +1 -1
  15. package/dist/types/config/src/mappers/appshell.config.d.ts +2 -2
  16. package/dist/types/config/src/mappers/appshell.config.d.ts.map +1 -1
  17. package/dist/types/config/src/register.d.ts +1 -1
  18. package/dist/types/config/src/register.d.ts.map +1 -1
  19. package/dist/types/config/src/types.d.ts +16 -0
  20. package/dist/types/config/src/types.d.ts.map +1 -1
  21. package/dist/types/config/src/utils/load.d.ts.map +1 -1
  22. package/dist/types/config/src/utils/loadJson.d.ts +6 -2
  23. package/dist/types/config/src/utils/loadJson.d.ts.map +1 -1
  24. package/dist/types/config/src/validators/{appshell.manifest.d.ts → AppshellGlobalConfigValidator.d.ts} +1 -1
  25. package/dist/types/config/src/validators/AppshellGlobalConfigValidator.d.ts.map +1 -0
  26. package/dist/types/config/src/validators/{merge.manifests.d.ts → AppshellManifestValidator.d.ts} +1 -1
  27. package/dist/types/config/src/validators/AppshellManifestValidator.d.ts.map +1 -0
  28. package/dist/types/config/src/validators/{appshell.config.d.ts → AppshellTemplateValidator.d.ts} +1 -1
  29. package/dist/types/config/src/validators/AppshellTemplateValidator.d.ts.map +1 -0
  30. package/dist/types/config/src/validators/index.d.ts +3 -3
  31. package/dist/types/config/src/validators/index.d.ts.map +1 -1
  32. package/dist/types/loader/src/remoteLoader.d.ts +3 -2
  33. package/dist/types/loader/src/remoteLoader.d.ts.map +1 -1
  34. package/package.json +2 -2
  35. package/src/remoteLoader.ts +5 -3
  36. package/dist/types/config/src/generate.d.ts +0 -9
  37. package/dist/types/config/src/generate.d.ts.map +0 -1
  38. package/dist/types/config/src/generate.index.d.ts +0 -4
  39. package/dist/types/config/src/generate.index.d.ts.map +0 -1
  40. package/dist/types/config/src/generate.metadata.d.ts +0 -4
  41. package/dist/types/config/src/generate.metadata.d.ts.map +0 -1
  42. package/dist/types/config/src/validators/appshell.config.d.ts.map +0 -1
  43. package/dist/types/config/src/validators/appshell.manifest.d.ts.map +0 -1
  44. package/dist/types/config/src/validators/merge.manifests.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.2.0-alpha.0](https://github.com/navaris/appshell/compare/@appshell/loader@0.1.0...@appshell/loader@0.2.0-alpha.0) (2023-08-23)
7
+
8
+
9
+ ### Features
10
+
11
+ * consolidate runtime artifacts ([#26](https://github.com/navaris/appshell/issues/26)) ([a29479a](https://github.com/navaris/appshell/commit/a29479a49f0c5ec1273c9f8e4c7384096f2d4ba0))
12
+
13
+
14
+
15
+
16
+
17
+ # [0.1.0](https://github.com/navaris/appshell/compare/@appshell/loader@0.1.0-alpha.1...@appshell/loader@0.1.0) (2023-07-11)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * registry projection, enable env overwrite, refactor docker workflow, consolidate env names ([33a28fe](https://github.com/navaris/appshell/commit/33a28fe76b58e05c5b6b6b33d4b402e52bb29e70))
23
+ * rename @appshell/react-federated-component package to @appshell/react ([0b74498](https://github.com/navaris/appshell/commit/0b74498bf17ba73db4d936c8a012af1d3b111a28))
24
+ * replace config intermediate file with template ([9b79e65](https://github.com/navaris/appshell/commit/9b79e65b355686a0cca273c89c7164bb031e8437))
25
+
26
+
27
+
28
+
29
+
6
30
  # [0.1.0-alpha.1](https://github.com/navaris/appshell/compare/@appshell/loader@0.0.3...@appshell/loader@0.1.0-alpha.1) (2023-07-05)
7
31
 
8
32
 
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  # @appshell/loader
13
13
 
14
- Dynamically load federated components for Webpack Module federation micro-frontends.
14
+ Dynamically load federated components for micro-frontends built with Appshell and Webpack Module federation.
15
15
 
16
16
  Working examples can be found [here](https://github.com/navaris/appshell/tree/main/examples).
17
17
 
@@ -35,26 +35,26 @@ or
35
35
  pnpm add -D @appshell/loader
36
36
  ```
37
37
 
38
- The default export from this package is the loader function. It is given a manifest and returns an async function that can be called to dynamically load federated components.
38
+ The default export from this package is the loader function. It is given the global appshell configuration, and returns an async function that can be called to dynamically load federated components.
39
39
 
40
40
  ```ts
41
41
  import componentLoader from '@appshell/loader';
42
42
 
43
- const load = componentLoader(manifest);
43
+ const load = componentLoader(config);
44
44
 
45
45
  const Component = load<MyComponent>('MyModule/MyComponent');
46
46
 
47
47
  render(<Component />);
48
48
  ```
49
49
 
50
- **Where does the manifest come from?**
50
+ **Where does the global appshell configuration come from?**
51
51
 
52
52
  > See [@appshell/cli](https://www.npmjs.com/package/@appshell/cli)
53
53
 
54
54
  ```bash
55
- appshell generate manifest --configsDir appshell_configs
55
+ appshell generate global-config --registry appshell_registry_path
56
56
  ```
57
57
 
58
58
  **Do you have any framework specific loaders?**
59
59
 
60
- > See [@appshell/react-federated-component](https://www.npmjs.com/package/@appshell/react-federated-component) for a `React` loader.
60
+ > See [@appshell/react](https://www.npmjs.com/package/@appshell/react) for a `React` loader.
@@ -1,9 +1,13 @@
1
1
  /** @jest-environment jsdom */
2
2
  import { AppshellManifest } from '@appshell/config';
3
+ import { AppshellRegister } from '@appshell/config/src/types';
4
+ import fetch, { enableFetchMocks } from 'jest-fetch-mock';
3
5
  import * as fetchDynamicScript from '../src/fetchDynamicScript';
4
6
  import * as loadFederatedComponent from '../src/loadFederatedComponent';
5
7
  import remoteLoader from '../src/remoteLoader';
6
8
 
9
+ enableFetchMocks();
10
+
7
11
  jest.mock('../src/fetchDynamicScript');
8
12
  jest.mock('../src/loadFederatedComponent');
9
13
 
@@ -14,25 +18,39 @@ describe('remoteLoader', () => {
14
18
  id: 'test-component',
15
19
  scope: 'TestModule',
16
20
  module: './TestComponent',
17
- url: 'http://test.com/remoteEntry.js',
21
+ manifestUrl: 'http://test.com/appshell.manifest.json',
22
+ remoteEntryUrl: 'http://test.com/remoteEntry.js',
18
23
  metadata: {},
19
24
  },
20
25
  },
21
26
  modules: {},
22
27
  environment: {},
23
28
  };
29
+ const register: AppshellRegister = {
30
+ index: {
31
+ 'TestModule/TestComponent': 'http://test.com/appshell.manifest.json',
32
+ },
33
+ metadata: {},
34
+ };
24
35
 
25
- it('should return the federated component if it is found in the manifest', async () => {
36
+ beforeEach(() => {
37
+ fetch.mockIf('http://test.com/appshell.manifest.json', () =>
38
+ Promise.resolve({ ok: true, body: JSON.stringify(manifest) }),
39
+ );
40
+ });
41
+
42
+ it('should return the federated component if it is found in the registry', async () => {
26
43
  const ExpectedComponent = () => 'test component';
27
44
  jest.spyOn(fetchDynamicScript, 'default').mockReturnValueOnce(Promise.resolve(true));
28
45
  jest
29
46
  .spyOn(loadFederatedComponent, 'default')
30
47
  .mockResolvedValue(Promise.resolve(ExpectedComponent));
31
48
 
32
- const loadRemote = remoteLoader(manifest);
33
- const ActualComponent = await loadRemote('TestModule/TestComponent');
49
+ const loadRemote = remoteLoader(register);
50
+ const [ActualComponent, actualManifest] = await loadRemote('TestModule/TestComponent');
34
51
 
35
52
  expect(ActualComponent).toEqual(ExpectedComponent);
53
+ expect(actualManifest).toEqual(manifest);
36
54
  });
37
55
 
38
56
  it('should not fetch remote entry more than once', async () => {
@@ -44,7 +62,7 @@ describe('remoteLoader', () => {
44
62
  .spyOn(loadFederatedComponent, 'default')
45
63
  .mockResolvedValue(Promise.resolve(ExpectedComponent));
46
64
 
47
- const loadRemote = remoteLoader(manifest);
65
+ const loadRemote = remoteLoader(register);
48
66
 
49
67
  await loadRemote('TestModule/TestComponent');
50
68
  await loadRemote('TestModule/TestComponent');
@@ -53,21 +71,22 @@ describe('remoteLoader', () => {
53
71
  expect(fetchDynamicScriptSpy).toHaveBeenCalledTimes(1);
54
72
  });
55
73
 
56
- it('should throw if remote key is not found in the manifest', async () => {
74
+ it('should throw if remote key is not found in the registry', async () => {
57
75
  const ExpectedComponent = () => 'test component';
58
76
  jest.spyOn(loadFederatedComponent, 'default').mockResolvedValue(ExpectedComponent);
59
77
 
60
- const loadRemote = remoteLoader(manifest);
78
+ const loadRemote = remoteLoader(register);
61
79
 
62
80
  await expect(loadRemote('TestModule/DoesNotExist')).rejects.toThrow(
63
- /Remote resource not found in manifest/i,
81
+ /Remote resource not found in registry/i,
64
82
  );
65
83
  });
66
84
 
67
85
  it('should throw if load federated component fails', async () => {
86
+ jest.spyOn(fetchDynamicScript, 'default').mockReturnValueOnce(Promise.resolve(true));
68
87
  jest.spyOn(loadFederatedComponent, 'default').mockRejectedValue(new Error('failed'));
69
88
 
70
- const loadRemote = remoteLoader(manifest);
89
+ const loadRemote = remoteLoader(register);
71
90
 
72
91
  await expect(loadRemote('TestModule/TestComponent')).rejects.toThrow(
73
92
  /Failed to load component/i,
package/dist/main.js CHANGED
@@ -1 +1 @@
1
- !function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o();else if("function"==typeof define&&define.amd)define([],o);else{var t=o();for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(self,(()=>(()=>{"use strict";var e={d:(o,t)=>{for(var r in t)e.o(t,r)&&!e.o(o,r)&&Object.defineProperty(o,r,{enumerable:!0,get:t[r]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};(()=>{e.S={};var o={},t={};e.I=(r,n)=>{n||(n=[]);var a=t[r];if(a||(a=t[r]={}),!(n.indexOf(a)>=0)){if(n.push(a),o[r])return o[r];e.o(e.S,r)||(e.S[r]={}),e.S[r];var d=[];return o[r]=d.length?Promise.all(d).then((()=>o[r]=1)):1}}})();var o={};e.r(o),e.d(o,{default:()=>a});const t=new Set,r=new Set,n=new Map,a=o=>async a=>{let d;const c=o[a];if(!c)throw new Error(`Remote resource not found in registry. Expected: ${a}`);try{const o=await(async e=>{if(n.has(e))return n.get(e);n.set(e,void 0);const o=await fetch(e);if(o.ok)return o.json();const t=await o.text();throw new Error(`Failed to get manifest from ${e}. ${t}`)})(c);if(o){n.set(c,o);const i=o.remotes[a];if(window[`__appshell_env__${i.scope}`]=o.environment[i.scope]||{},r.has(i.remoteEntryUrl)||await(async e=>{const o=document.createElement("script");return new Promise(((r,n)=>{t.has(e)?r(!1):(t.add(e),o.src=e,o.type="text/javascript",o.async=!0,o.onload=()=>{console.debug(`Remote entry fetched from '${e}'.`),r(!0)},o.onerror=()=>{const o=`Failed to fetch remote entry from '${e}'.`;console.error(o),n(o)},document.head.appendChild(o))})).finally((()=>{document.head.contains(o)&&document.head.removeChild(o)}))})(i.remoteEntryUrl))return r.add(i.remoteEntryUrl),d=await(async(o,t,r="default")=>{console.debug(`loading federated component: { scope: ${o}, module: ${t}, shareScope: ${r} }`),await e.I(r);const n=window[o];if(!n)throw new Error(`Failed to find module container ${o}`);await n.init(e.S[r]);const a=await n.get(t);if(!a)throw new Error(`Invalid factory produced by container for module ${t}.`);const d=a();return console.debug(`federated component loaded: { scope: ${o}, module: ${t}, shareScope: ${r} }`),d.default})(i.scope,i.module,i.shareScope),[d,o]}return[null,null]}catch(e){throw new Error(`Failed to load component '${a}'. ${e?.toString()}`)}};return o})()));
1
+ !function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o();else if("function"==typeof define&&define.amd)define([],o);else{var t=o();for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(self,(()=>(()=>{"use strict";var e={d:(o,t)=>{for(var r in t)e.o(t,r)&&!e.o(o,r)&&Object.defineProperty(o,r,{enumerable:!0,get:t[r]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};(()=>{e.S={};var o={},t={};e.I=(r,n)=>{n||(n=[]);var a=t[r];if(a||(a=t[r]={}),!(n.indexOf(a)>=0)){if(n.push(a),o[r])return o[r];e.o(e.S,r)||(e.S[r]={}),e.S[r];var d=[];return o[r]=d.length?Promise.all(d).then((()=>o[r]=1)):1}}})();var o={};e.r(o),e.d(o,{default:()=>a});const t=new Set,r=new Set,n=new Map,a=o=>async a=>{let d;const c=o.index[a];if(!c)throw new Error(`Remote resource not found in registry. Expected: ${a}`);try{const o=await(async e=>{if(n.has(e))return n.get(e);n.set(e,void 0);const o=await fetch(e);if(o.ok)return o.json();const t=await o.text();throw new Error(`Failed to get manifest from ${e}. ${t}`)})(c);if(o){n.set(c,o);const i=o.remotes[a];if(window[`__appshell_env__${i.scope}`]=o.environment[i.scope]||{},r.has(i.remoteEntryUrl)||await(async e=>{const o=document.createElement("script");return new Promise(((r,n)=>{t.has(e)?r(!1):(t.add(e),o.src=e,o.type="text/javascript",o.async=!0,o.onload=()=>{console.debug(`Remote entry fetched from '${e}'.`),r(!0)},o.onerror=()=>{const o=`Failed to fetch remote entry from '${e}'.`;console.error(o),n(o)},document.head.appendChild(o))})).finally((()=>{document.head.contains(o)&&document.head.removeChild(o)}))})(i.remoteEntryUrl))return r.add(i.remoteEntryUrl),d=await(async(o,t,r="default")=>{console.debug(`loading federated component: { scope: ${o}, module: ${t}, shareScope: ${r} }`),await e.I(r);const n=window[o];if(!n)throw new Error(`Failed to find module container ${o}`);await n.init(e.S[r]);const a=await n.get(t);if(!a)throw new Error(`Invalid factory produced by container for module ${t}.`);const d=a();return console.debug(`federated component loaded: { scope: ${o}, module: ${t}, shareScope: ${r} }`),d.default})(i.scope,i.module,i.shareScope),[d,o]}return[null,null]}catch(e){throw new Error(`Failed to load component '${a}'. ${e?.toString()}`)}};return o})()));
@@ -0,0 +1,3 @@
1
+ declare const _default: (moduleName: string, registry: string) => Promise<void>;
2
+ export default _default;
3
+ //# sourceMappingURL=deregister.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deregister.d.ts","sourceRoot":"","sources":["../../../../../config/src/deregister.ts"],"names":[],"mappings":"qCAoGkC,MAAM,YAAY,MAAM;AAA1D,wBAeE"}
@@ -1,3 +1,3 @@
1
- declare const _default: (env: string, prefix?: string) => Promise<Map<string, string | number | undefined>>;
1
+ declare const _default: (env: string, prefix?: string, overwrite?: boolean) => Promise<Map<string, string>>;
2
2
  export default _default;
3
3
  //# sourceMappingURL=generate.env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.env.d.ts","sourceRoot":"","sources":["../../../../../config/src/generate.env.ts"],"names":[],"mappings":"8BAO2B,MAAM;AAAjC,wBA6BK"}
1
+ {"version":3,"file":"generate.env.d.ts","sourceRoot":"","sources":["../../../../../config/src/generate.env.ts"],"names":[],"mappings":"8BAO2B,MAAM;AAAjC,wBA8BK"}
@@ -0,0 +1,7 @@
1
+ import { AppshellGlobalConfig } from './types';
2
+ type GenerateGlobalConfigOptions = {
3
+ insecure: boolean;
4
+ };
5
+ declare const _default: (registries: string[], options?: GenerateGlobalConfigOptions) => Promise<AppshellGlobalConfig>;
6
+ export default _default;
7
+ //# sourceMappingURL=generate.global-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.global-config.d.ts","sourceRoot":"","sources":["../../../../../config/src/generate.global-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAK/C,KAAK,2BAA2B,GAAG;IACjC,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;qCAGY,MAAM,EAAE,YACX,2BAA2B,KACnC,QAAQ,oBAAoB,CAAC;AAHhC,wBAuCE"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Generates an appshell manifest
3
+ * @param templatePath path of the appshell manifest template to compile into an appshell manifest
4
+ * @returns an appshell manifest
5
+ */
6
+ declare const _default: <TMetadata extends Record<string, unknown>>(templatePath: string) => Promise<import("./types").AppshellManifest<TMetadata> | null>;
7
+ export default _default;
8
+ //# sourceMappingURL=generate.manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.manifest.d.ts","sourceRoot":"","sources":["../../../../../config/src/generate.manifest.ts"],"names":[],"mappings":"AAOA;;;;GAIG;kFAC4E,MAAM;AAArF,wBAaE"}
@@ -2,12 +2,12 @@
2
2
  * @appshell/config package API
3
3
  */
4
4
  export { default as configmap } from './configmap';
5
- export { default as generateManifest } from './generate';
5
+ export { default as deregister } from './deregister';
6
6
  export { default as generateEnv } from './generate.env';
7
- export { default as generateIndex } from './generate.index';
8
- export { default as generateMetadata } from './generate.metadata';
7
+ export { default as generateGlobalConfig } from './generate.global-config';
8
+ export { default as generateManifest } from './generate.manifest';
9
9
  export { default as register } from './register';
10
- export type { AppshellConfig, AppshellConfigRemote, AppshellIndex, AppshellManifest, AppshellRemote, Schema, } from './types';
10
+ export type { AppshellConfig, AppshellConfigRemote, AppshellGlobalConfig, AppshellIndex, AppshellManifest, AppshellRemote, AppshellTemplate, Metadata, Schema, } from './types';
11
11
  export * as utils from './utils';
12
12
  export * as validators from './validators';
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../config/src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,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@
1
- import { AppshellConfig, AppshellManifest, ConfigMap } from '../types';
2
- export declare const toAppshellManifest: <TMetadata extends Record<string, unknown>>(config: AppshellConfig, args: ConfigMap) => AppshellManifest<TMetadata>;
1
+ import { AppshellManifest, AppshellTemplate, ConfigMap } from '../types';
2
+ export declare const toAppshellManifest: <TMetadata extends Record<string, unknown>>(template: AppshellTemplate, args: ConfigMap) => AppshellManifest<TMetadata>;
3
3
  //# sourceMappingURL=appshell.config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appshell.config.d.ts","sourceRoot":"","sources":["../../../../../../config/src/mappers/appshell.config.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,cAAc,EAEd,gBAAgB,EAEhB,SAAS,EACV,MAAM,UAAU,CAAC;AA6DlB,eAAO,MAAM,kBAAkB,sDACrB,cAAc,QAChB,SAAS,gCAQhB,CAAC"}
1
+ {"version":3,"file":"appshell.config.d.ts","sourceRoot":"","sources":["../../../../../../config/src/mappers/appshell.config.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,gBAAgB,EAEhB,gBAAgB,EAChB,SAAS,EACV,MAAM,UAAU,CAAC;AA6DlB,eAAO,MAAM,kBAAkB,wDACnB,gBAAgB,QACpB,SAAS,gCAQhB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { AppshellManifest } from './types';
2
- declare const _default: (manifest: AppshellManifest, registry: string) => Promise<void>;
2
+ declare const _default: (manifest: AppshellManifest, registryPathOrUrl: string) => Promise<void>;
3
3
  export default _default;
4
4
  //# sourceMappingURL=register.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../../config/src/register.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;mCAGX,gBAAgB,YAAY,MAAM;AAAlE,wBAgBE"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../../config/src/register.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,gBAAgB,EAAmB,MAAM,SAAS,CAAC;mCAclD,gBAAgB,qBAAqB,MAAM;AAA3E,wBAmCE"}
@@ -11,10 +11,17 @@ export type AppshellConfigRemote<TMetadata = Metadata> = {
11
11
  metadata: TMetadata;
12
12
  };
13
13
  export type AppshellConfig<TMetadata = Metadata> = {
14
+ name?: string;
15
+ remotes?: Record<string, AppshellConfigRemote<TMetadata>>;
16
+ environment?: Record<string, unknown>;
17
+ overrides?: AppshellOverrides;
18
+ };
19
+ export type AppshellTemplate<TMetadata = Metadata> = {
14
20
  name?: string;
15
21
  remotes?: Record<string, AppshellConfigRemote<TMetadata>>;
16
22
  module: ModuleFederationPluginOptions;
17
23
  environment?: Record<string, unknown>;
24
+ overrides?: AppshellOverrides;
18
25
  };
19
26
  /** Appshell manifest types */
20
27
  export type AppshellRemote<TMetadata = Metadata> = {
@@ -26,13 +33,22 @@ export type AppshellRemote<TMetadata = Metadata> = {
26
33
  shareScope?: string;
27
34
  metadata: TMetadata;
28
35
  };
36
+ export type AppshellOverrides = {
37
+ environment: Record<string, Record<string, string | number | undefined>>;
38
+ };
29
39
  export type AppshellManifest<TMetadata = Metadata> = {
30
40
  remotes: Record<string, AppshellRemote<TMetadata>>;
31
41
  modules: Record<string, ModuleFederationPluginOptions>;
32
42
  environment: Record<string, Record<string, string | number | undefined>>;
43
+ overrides?: AppshellOverrides;
33
44
  };
34
45
  export type AppshellIndex = Record<string, string>;
35
46
  export type Metadata = Record<string, unknown>;
47
+ export type AppshellGlobalConfig<TMetadata = Metadata> = {
48
+ index: AppshellIndex;
49
+ metadata?: Record<string, TMetadata>;
50
+ overrides?: AppshellOverrides;
51
+ };
36
52
  /**
37
53
  * Advanced configuration for modules that should be exposed by this container.
38
54
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../config/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,C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ACpD;AAED,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,aAAa,CAAC,EAAE,GAAG,aAAa,CAAC;IAErD;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,CAAC,EACP,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,UAAU,GACV,WAAW,GACX,iBAAiB,GACjB,iBAAiB,GACjB,KAAK,GACL,aAAa,GACb,KAAK,GACL,MAAM,GACN,OAAO,GACP,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,eAAe,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,aAAa,CAAC,EAAE,GAAG,aAAa,CAAC;IAErD;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAEzB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,YAAY,CAAC,EAAE,GAAG,YAAY,CAAC;CACnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../../../../config/src/utils/load.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,QAAA,MAAM,IAAI,wBAAyB,MAAM,YAWxC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,OAAO,sBAAuB,MAAM,EAAE,cAA+C,CAAC;AAEnG,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../../../../config/src/utils/load.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,QAAA,MAAM,IAAI,wBAAyB,MAAM,YAUxC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,OAAO,sBAAuB,MAAM,EAAE,cAA+C,CAAC;AAEnG,eAAe,IAAI,CAAC"}
@@ -1,3 +1,7 @@
1
- declare const loadJson: <T extends object>(jsonPathOrUrl: string) => Promise<T[]>;
2
- export default loadJson;
1
+ type LoadJsonOptions = {
2
+ insecure: boolean;
3
+ target: string | RegExp;
4
+ };
5
+ declare const _default: <T = Record<string, unknown>>(jsonPathOrUrl: string, options?: LoadJsonOptions) => Promise<T[]>;
6
+ export default _default;
3
7
  //# sourceMappingURL=loadJson.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadJson.d.ts","sourceRoot":"","sources":["../../../../../../config/src/utils/loadJson.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,QAAQ,oCAA2C,MAAM,iBAkB9D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"loadJson.d.ts","sourceRoot":"","sources":["../../../../../../config/src/utils/loadJson.ts"],"names":[],"mappings":"AAOA,KAAK,eAAe,GAAG;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB,CAAC;qEAkCe,MAAM,YACZ,eAAe;AAF1B,wBAUE"}
@@ -1,4 +1,4 @@
1
1
  import { ConfigValidator } from '../types';
2
2
  declare const _default: ConfigValidator;
3
3
  export default _default;
4
- //# sourceMappingURL=appshell.manifest.d.ts.map
4
+ //# sourceMappingURL=AppshellGlobalConfigValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppshellGlobalConfigValidator.d.ts","sourceRoot":"","sources":["../../../../../../config/src/validators/AppshellGlobalConfigValidator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwB,eAAe,EAAE,MAAM,UAAU,CAAC;;AAEjE,wBAKqB"}
@@ -1,4 +1,4 @@
1
1
  import { ConfigValidator } from '../types';
2
2
  declare const _default: ConfigValidator;
3
3
  export default _default;
4
- //# sourceMappingURL=merge.manifests.d.ts.map
4
+ //# sourceMappingURL=AppshellManifestValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppshellManifestValidator.d.ts","sourceRoot":"","sources":["../../../../../../config/src/validators/AppshellManifestValidator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAoB,eAAe,EAAE,MAAM,UAAU,CAAC;;AAyB7D,wBAkBqB"}
@@ -1,4 +1,4 @@
1
1
  import { ConfigValidator } from '../types';
2
2
  declare const _default: ConfigValidator;
3
3
  export default _default;
4
- //# sourceMappingURL=appshell.config.d.ts.map
4
+ //# sourceMappingURL=AppshellTemplateValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppshellTemplateValidator.d.ts","sourceRoot":"","sources":["../../../../../../config/src/validators/AppshellTemplateValidator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAoB,eAAe,EAAE,MAAM,UAAU,CAAC;;AAuB7D,wBAkBqB"}
@@ -1,4 +1,4 @@
1
- export { default as appshell_config } from './appshell.config';
2
- export { default as appshell_manifest } from './appshell.manifest';
3
- export { default as merge_manifests } from './merge.manifests';
1
+ export { default as AppshellGlobalConfigValidator } from './AppshellGlobalConfigValidator';
2
+ export { default as AppshellManifestValidator } from './AppshellManifestValidator';
3
+ export { default as AppshellTemplateValidator } from './AppshellTemplateValidator';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../config/src/validators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../config/src/validators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -1,4 +1,5 @@
1
- import { type AppshellIndex, type AppshellManifest } from '@appshell/config';
2
- declare const _default: (index: AppshellIndex) => <TComponent>(key: string) => Promise<readonly [TComponent, AppshellManifest<import("packages/config/src/types").Metadata>] | readonly [null, null]>;
1
+ import { type AppshellManifest } from '@appshell/config';
2
+ import { AppshellGlobalConfig } from 'packages/config/src/types';
3
+ declare const _default: (config: AppshellGlobalConfig) => <TComponent>(key: string) => Promise<readonly [TComponent, AppshellManifest<import("@appshell/config").Metadata>] | readonly [null, null]>;
3
4
  export default _default;
4
5
  //# sourceMappingURL=remoteLoader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remoteLoader.d.ts","sourceRoot":"","sources":["../../../../src/remoteLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;gCAwBtD,aAAa,uBACV,MAAM;AADhC,wBAqCI"}
1
+ {"version":3,"file":"remoteLoader.d.ts","sourceRoot":"","sources":["../../../../src/remoteLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;iCAwBzC,oBAAoB,uBAClB,MAAM;AADhC,wBAsCI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appshell/loader",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.2.0-alpha.0",
4
4
  "description": "Utility for loading federated components",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/loader/src/index.d.ts",
@@ -25,5 +25,5 @@
25
25
  "appshell"
26
26
  ],
27
27
  "license": "MIT",
28
- "gitHead": "b7cdb4671193d0938106fa5bbb154c10949e55c3"
28
+ "gitHead": "a4216a032817193034b208f93ac7109458ef2c06"
29
29
  }
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable no-underscore-dangle */
2
- import { type AppshellIndex, type AppshellManifest } from '@appshell/config';
2
+ import { type AppshellManifest } from '@appshell/config';
3
+ import { AppshellGlobalConfig } from 'packages/config/src/types';
3
4
  import fetchDynamicScript from './fetchDynamicScript';
4
5
  import loadFederatedComponent from './loadFederatedComponent';
5
6
 
@@ -23,10 +24,10 @@ const fetchManifest = async (url: string): Promise<AppshellManifest | undefined>
23
24
  throw new Error(`Failed to get manifest from ${url}. ${message}`);
24
25
  };
25
26
 
26
- export default (index: AppshellIndex) =>
27
+ export default (config: AppshellGlobalConfig) =>
27
28
  async <TComponent>(key: string) => {
28
29
  let Component: TComponent;
29
- const manifestUrl = index[key];
30
+ const manifestUrl = config.index[key];
30
31
  if (!manifestUrl) {
31
32
  throw new Error(`Remote resource not found in registry. Expected: ${key}`);
32
33
  }
@@ -38,6 +39,7 @@ export default (index: AppshellIndex) =>
38
39
  fetchedManifestCache.set(manifestUrl, manifest);
39
40
 
40
41
  const remote = manifest.remotes[key];
42
+
41
43
  window[`__appshell_env__${remote.scope}`] = manifest.environment[remote.scope] || {};
42
44
 
43
45
  const loaded =
@@ -1,9 +0,0 @@
1
- /**
2
- * Generates an appshell manifest
3
- * @param configPath path of the appshell config to compile into an appshell manifest
4
- * @param webpackConfig path of the webpack config
5
- * @returns an appshell manifest
6
- */
7
- declare const _default: <TMetadata extends Record<string, unknown>>(configPath: string, webpackConfig?: string, webpackEnv?: {}, webpackArgs?: {}) => Promise<import("./types").AppshellManifest<TMetadata> | null>;
8
- export default _default;
9
- //# sourceMappingURL=generate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../../config/src/generate.ts"],"names":[],"mappings":"AAyHA;;;;;GAKG;gFAEW,MAAM;AADpB,wBAsBE"}
@@ -1,4 +0,0 @@
1
- import { AppshellIndex } from './types';
2
- declare const _default: (registries: string[]) => Promise<AppshellIndex>;
3
- export default _default;
4
- //# sourceMappingURL=generate.index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.index.d.ts","sourceRoot":"","sources":["../../../../../config/src/generate.index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAoB,MAAM,SAAS,CAAC;qCAGxB,MAAM,EAAE,KAAG,QAAQ,aAAa,CAAC;AAAnE,wBAgCE"}
@@ -1,4 +0,0 @@
1
- import { Metadata } from './types';
2
- declare const _default: <T = Record<string, Metadata>>(registries: string[]) => Promise<T>;
3
- export default _default;
4
- //# sourceMappingURL=generate.metadata.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.metadata.d.ts","sourceRoot":"","sources":["../../../../../config/src/generate.metadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,QAAQ,EAAE,MAAM,SAAS,CAAC;mEAGW,MAAM,EAAE;AAAxE,wBAgCE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"appshell.config.d.ts","sourceRoot":"","sources":["../../../../../../config/src/validators/appshell.config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAkB,eAAe,EAAE,MAAM,UAAU,CAAC;;AAuB3D,wBAkBqB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"appshell.manifest.d.ts","sourceRoot":"","sources":["../../../../../../config/src/validators/appshell.manifest.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoB,eAAe,EAAE,MAAM,UAAU,CAAC;;AAyB7D,wBAkBqB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"merge.manifests.d.ts","sourceRoot":"","sources":["../../../../../../config/src/validators/merge.manifests.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,eAAe,EAAE,MAAM,UAAU,CAAC;;AAE7D,wBAKqB"}