@appshell/loader 0.3.1-alpha.0 → 0.4.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
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.4.0-alpha.0](https://github.com/navaris/appshell/compare/@appshell/loader@0.3.1-alpha.0...@appshell/loader@0.4.0-alpha.0) (2024-09-05)
7
+
8
+
9
+ ### Features
10
+
11
+ * api key support ([8c91e62](https://github.com/navaris/appshell/commit/8c91e6240b3d879af9bdd5949924865da0e0f8a1))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.3.1-alpha.0](https://github.com/navaris/appshell/compare/@appshell/loader@0.3.0...@appshell/loader@0.3.1-alpha.0) (2024-08-31)
7
18
 
8
19
 
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 i=[];return o[r]=i.length?Promise.all(i).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 i;const c=o.index[a];if(!c)throw new Error(`Remote resource not found in registry. Expected: ${a}`);try{const d=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(d){n.set(c,d);const s=d.remotes[a],l=d.environment[s.scope]||{},f=o.overrides?.environment&&o.overrides?.environment[s.scope]||{};if(window[`__appshell_env__${s.scope}`]={...l,...f},r.has(s.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)}))})(s.remoteEntryUrl))return r.add(s.remoteEntryUrl),i=await(async(o,t,r="default")=>{console.debug(`loading Appshell 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 i=a();return console.debug(`Appshell component loaded: { scope: ${o}, module: ${t}, shareScope: ${r} }`),i.default})(s.scope,s.module,s.shareScope),[i,d]}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 i=[];return o[r]=i.length?Promise.all(i).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 i;const d=o.index[a];if(!d)throw new Error(`Remote resource not found in registry. Expected: ${a}`);try{const c=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}`)})(d);if(c){n.set(d,c);const s=c.remotes[a],l=c.environment[s.scope]||{},f=o.overrides?.environment&&o.overrides?.environment[s.scope]||{};if(window[`__appshell_env__${s.scope}`]={...l,...f},r.has(s.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),t.delete(e),n(o)},document.head.appendChild(o))})).finally((()=>{document.head.contains(o)&&document.head.removeChild(o)}))})(s.remoteEntryUrl))return r.add(s.remoteEntryUrl),i=await(async(o,t,r="default")=>{console.debug(`loading Appshell 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 i=a();return console.debug(`Appshell component loaded: { scope: ${o}, module: ${t}, shareScope: ${r} }`),i.default})(s.scope,s.module,s.shareScope),[i,c]}return[null,null]}catch(e){throw new Error(`Failed to load component '${a}'. ${e?.toString()}`)}};return o})()));
@@ -1 +1 @@
1
- {"version":3,"file":"fetchDynamicScript.d.ts","sourceRoot":"","sources":["../../../../src/fetchDynamicScript.ts"],"names":[],"mappings":"8BAE2B,MAAM;AAAjC,wBAoCE"}
1
+ {"version":3,"file":"fetchDynamicScript.d.ts","sourceRoot":"","sources":["../../../../src/fetchDynamicScript.ts"],"names":[],"mappings":"8BAE2B,MAAM;AAAjC,wBAqCE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appshell/loader",
3
- "version": "0.3.1-alpha.0",
3
+ "version": "0.4.0-alpha.0",
4
4
  "description": "Utility for loading Appshell components",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/loader/src/index.d.ts",
@@ -11,11 +11,11 @@
11
11
  "registry": "https://registry.npmjs.org/"
12
12
  },
13
13
  "scripts": {
14
- "build": "webpack --mode production && yarn build:types",
14
+ "build": "webpack --mode production && npm run build:types",
15
15
  "build:types": "tsc --emitDeclarationOnly",
16
16
  "clean": "rm -rf dist",
17
17
  "prebuild": "npm run clean",
18
- "start": "webpack --watch --mode development && yarn build:types",
18
+ "start": "webpack --watch --mode development && npm run build:types",
19
19
  "stats": "webpack --json > stats.json"
20
20
  },
21
21
  "keywords": [
@@ -24,5 +24,5 @@
24
24
  "appshell"
25
25
  ],
26
26
  "license": "MIT",
27
- "gitHead": "a44ca542cf779c0cbbc527a02bc74d0a0619d0b9"
27
+ "gitHead": "113bd70a2b0bed71962280015cdf31afc5f80178"
28
28
  }
@@ -30,6 +30,7 @@ export default async (url: string) => {
30
30
  const message = `Failed to fetch remote entry from '${url}'.`;
31
31
  // eslint-disable-next-line no-console
32
32
  console.error(message);
33
+ urlCache.delete(url);
33
34
  reject(message);
34
35
  };
35
36