@appshell/loader 1.0.0-alpha.0 → 1.0.0-alpha.10
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 +34 -17
- package/dist/main.js +1 -1
- package/dist/types/config/src/context.d.ts +23 -0
- package/dist/types/config/src/context.d.ts.map +1 -0
- package/dist/types/config/src/credentials.d.ts +16 -0
- package/dist/types/config/src/credentials.d.ts.map +1 -0
- package/dist/types/config/src/index.d.ts +4 -0
- package/dist/types/config/src/index.d.ts.map +1 -1
- package/dist/types/config/src/publish.d.ts +5 -2
- package/dist/types/config/src/publish.d.ts.map +1 -1
- package/dist/types/loader/src/fetchDynamicScript.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/fetchDynamicScript.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,28 +3,45 @@
|
|
|
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
|
-
# 1.0.0-alpha.0 (2026-08-
|
|
6
|
+
# [1.0.0-alpha.10](https://github.com/appshell-org/appshell/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2026-08-19)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @appshell/loader
|
|
9
|
+
|
|
10
|
+
# [1.0.0-alpha.9](https://github.com/appshell-org/appshell/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2026-08-19)
|
|
7
11
|
|
|
8
12
|
### Bug Fixes
|
|
9
13
|
|
|
10
|
-
-
|
|
11
|
-
- configurable api key header support, minor fixes ([2f0bf02](https://github.com/appshell-org/appshell/commit/2f0bf027b92398f91b8e8cbfbf543d61fe37b7a0))
|
|
12
|
-
- hot module replacement support, example updates ([a67d230](https://github.com/appshell-org/appshell/commit/a67d2303b40f5911373225cc0b4ccf9b67c33d11))
|
|
13
|
-
- registry projection, enable env overwrite, refactor docker workflow, consolidate env names ([33a28fe](https://github.com/appshell-org/appshell/commit/33a28fe76b58e05c5b6b6b33d4b402e52bb29e70))
|
|
14
|
-
- rename @appshell/react-federated-component package to @appshell/react ([0b74498](https://github.com/appshell-org/appshell/commit/0b74498bf17ba73db4d936c8a012af1d3b111a28))
|
|
15
|
-
- replace config intermediate file with template ([9b79e65](https://github.com/appshell-org/appshell/commit/9b79e65b355686a0cca273c89c7164bb031e8437))
|
|
16
|
-
- resolve npm audit vulnerabilities (74 → 4) ([36a2d56](https://github.com/appshell-org/appshell/commit/36a2d56a76dabd55a6886ddb9f020948420fd832))
|
|
14
|
+
- **example:** resolve CSP/module-federation issues blocking local dev ([f8de4e1](https://github.com/appshell-org/appshell/commit/f8de4e1cfe495a7d4ae8e6374189384847c21309))
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
# [1.0.0-alpha.8](https://github.com/appshell-org/appshell/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2026-08-19)
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
**Note:** Version bump only for package @appshell/loader
|
|
19
|
+
|
|
20
|
+
# [1.0.0-alpha.7](https://github.com/appshell-org/appshell/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2026-08-18)
|
|
21
|
+
|
|
22
|
+
**Note:** Version bump only for package @appshell/loader
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @appshell/loader
|
|
25
|
+
|
|
26
|
+
# [1.0.0-alpha.6](https://github.com/appshell-org/appshell/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2026-08-18)
|
|
27
|
+
|
|
28
|
+
**Note:** Version bump only for package @appshell/loader
|
|
29
|
+
|
|
30
|
+
# [1.0.0-alpha.5](https://github.com/appshell-org/appshell/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2026-08-18)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @appshell/loader
|
|
33
|
+
|
|
34
|
+
**Note:** Version bump only for package @appshell/loader
|
|
35
|
+
|
|
36
|
+
# [1.0.0-alpha.4](https://github.com/appshell-org/appshell/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2026-08-18)
|
|
37
|
+
|
|
38
|
+
**Note:** Version bump only for package @appshell/loader
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @appshell/loader
|
|
41
|
+
|
|
42
|
+
# [1.0.0-alpha.3](https://github.com/appshell-org/appshell/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2026-08-18)
|
|
43
|
+
|
|
44
|
+
**Note:** Version bump only for package @appshell/loader
|
|
28
45
|
|
|
29
46
|
# 0.12.0-alpha.0 (2026-04-20)
|
|
30
47
|
|
package/dist/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(self,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};(()=>{e.S={};var t={},n={};e.I=(o,r)=>{r||(r=[]);var
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(self,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};(()=>{e.S={};var t={},n={};e.I=(o,r)=>{r||(r=[]);var i=n[o];if(i||(i=n[o]={}),!(r.indexOf(i)>=0)){if(r.push(i),t[o])return t[o];e.o(e.S,o)||(e.S[o]={}),e.S[o];var a=[];return t[o]=a.length?Promise.all(a).then((()=>t[o]=1)):1}}})();var t={};e.r(t),e.d(t,{chainResolvers:()=>l,default:()=>m,inlineResolver:()=>a,legacyManifestResolver:()=>s,registryResolver:()=>c});const n=new Set,o=async e=>{const t=document.createElement("script"),o=document.querySelector("script[nonce]")?.nonce;return o&&(t.nonce=o),new Promise(((o,r)=>{n.has(e)?o(!1):(n.add(e),t.src=e,t.type="text/javascript",t.async=!0,t.onload=()=>{console.debug(`Remote entry fetched from '${e}'.`),o(!0)},t.onerror=()=>{const t=`Failed to fetch remote entry from '${e}'.`;console.error(t),n.delete(e),r(t)},document.head.appendChild(t))})).finally((()=>{document.head.contains(t)&&document.head.removeChild(t)}))};(Object.getOwnPropertyDescriptor(o,"name")||{}).writable||Object.defineProperty(o,"name",{value:"default",configurable:!0});const r=async(t,n,o="default")=>{console.debug(`loading Appshell component: { scope: ${t}, module: ${n}, shareScope: ${o} }`),await e.I(o);const r=window[t];if(!r)throw new Error(`Failed to find module container ${t}`);await r.init(e.S[o]);const i=await r.get(n);if(!i)throw new Error(`Invalid factory produced by container for module ${n}.`);const a=i();return console.debug(`Appshell component loaded: { scope: ${t}, module: ${n}, shareScope: ${o} }`),a.default};(Object.getOwnPropertyDescriptor(r,"name")||{}).writable||Object.defineProperty(r,"name",{value:"default",configurable:!0});const i=(e,t)=>({remotes:t,environment:e.environment,modules:{}}),a=e=>async t=>{const n=e?.remotes[t];if(e&&n)return{remote:n,environment:e.environment[n.scope]??{},manifest:i(e,e.remotes)}},c=(e,t="")=>async n=>{if(!e)return;const o=`${t}/v1/environments/${e.environmentId}/remotes/${n}`,r=await fetch(o,{credentials:"include"});if(!r.ok)return;const a=await r.json();return{remote:a,environment:e.environment[a.scope]??{},manifest:i(e,{[n]:a})}},s=e=>{const t=new Map;return async n=>{const o=e.index?.[n];if(!o)return;const r=await(e=>{const n=t.get(e);if(n)return n;const o=fetch(e,{credentials:"include"}).then((async t=>{if(!t.ok)throw new Error(`Failed to get manifest from ${e}. ${await t.text()}`);return t.json()}));return t.set(e,o),o})(o),i=r?.remotes[n];return i?{remote:i,environment:{...r.environment[i.scope]??{},...e.overrides?.environment?.[i.scope]??{}},manifest:r}:void 0}},l=(...e)=>async t=>{for(const n of e){const e=await n(t);if(e)return e}},d=new Set,f=(e,t={})=>{const n=t.composition??("undefined"==typeof window?void 0:window.__appshell_config__),i=t.resolver??l(a(n),c(n),s(e));return async e=>{const t=t=>new Error(`Failed to load component '${e}'. ${t?.toString()}`);let n;try{n=await i(e)}catch(e){throw t(e)}if(!n)throw new Error(`Remote resource not found in registry. Expected: ${e}`);const{remote:a,environment:c,manifest:s}=n;try{return window[`__appshell_env__${a.scope}`]=c,d.has(a.remoteEntryUrl)||await o(a.remoteEntryUrl)?(d.add(a.remoteEntryUrl),[await r(a.scope,a.module,a.shareScope),s]):[null,null]}catch(e){throw t(e)}}};(Object.getOwnPropertyDescriptor(f,"name")||{}).writable||Object.defineProperty(f,"name",{value:"default",configurable:!0});const m=f;return t})()));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type AppshellContext = {
|
|
2
|
+
registry?: string;
|
|
3
|
+
/** Activation target as `scope/name`. */
|
|
4
|
+
environment?: string;
|
|
5
|
+
scopeId: string;
|
|
6
|
+
token?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The registry, environment, and token a developer is working against, resolved
|
|
10
|
+
* the way the CLI resolves them: env var, then `~/.appshell/config`, then a
|
|
11
|
+
* default. This lets the webpack plugin defer to `appshell config set` and
|
|
12
|
+
* `appshell login` instead of requiring per-project configuration.
|
|
13
|
+
*/
|
|
14
|
+
export declare const resolveContext: () => AppshellContext;
|
|
15
|
+
/**
|
|
16
|
+
* What `~/.appshell/config` alone declares, so a caller can warn when an env var
|
|
17
|
+
* or an explicit option points somewhere other than the developer's CLI context.
|
|
18
|
+
*/
|
|
19
|
+
export declare const persistedContext: () => {
|
|
20
|
+
registry?: string;
|
|
21
|
+
environment?: string;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../config/src/context.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAaF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,QAAO,eAQjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAO;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAK5E,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type Credential = {
|
|
2
|
+
accessToken: string;
|
|
3
|
+
refreshToken?: string;
|
|
4
|
+
/** Epoch milliseconds. */
|
|
5
|
+
expiresAt?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const credentialsPath: () => string;
|
|
8
|
+
export declare const saveCredential: (registry: string, credential: Credential) => void;
|
|
9
|
+
export declare const clearCredential: (registry: string) => void;
|
|
10
|
+
/**
|
|
11
|
+
* APPSHELL_TOKEN wins so CI never depends on a writable home directory.
|
|
12
|
+
* Expired tokens are treated as absent; refresh is the caller's concern.
|
|
13
|
+
*/
|
|
14
|
+
export declare const resolveToken: (registry: string) => string | undefined;
|
|
15
|
+
export declare const requireToken: (registry: string) => string;
|
|
16
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../../config/src/credentials.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAKF,eAAO,MAAM,eAAe,cAC6D,CAAC;AAqB1F,eAAO,MAAM,cAAc,aAAc,MAAM,cAAc,UAAU,SAEtE,CAAC;AAEF,eAAO,MAAM,eAAe,aAAc,MAAM,SAI/C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,aAAc,MAAM,KAAG,MAAM,GAAG,SAexD,CAAC;AAEF,eAAO,MAAM,YAAY,aAAc,MAAM,KAAG,MAO/C,CAAC"}
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* @appshell/config package API
|
|
3
3
|
*/
|
|
4
4
|
export { default as configmap } from './configmap';
|
|
5
|
+
export { persistedContext, resolveContext } from './context';
|
|
6
|
+
export type { AppshellContext } from './context';
|
|
7
|
+
export { clearCredential, credentialsPath, requireToken, resolveToken, saveCredential, } from './credentials';
|
|
8
|
+
export type { Credential } from './credentials';
|
|
5
9
|
export { default as deregister } from './deregister';
|
|
6
10
|
export { default as generateEnv } from './generate.env';
|
|
7
11
|
export { default as generateGlobalConfig } from './generate.global-config';
|
|
@@ -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,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,QAAQ,EACR,6BAA6B,EAC7B,WAAW,EACX,cAAc,EACd,MAAM,EACN,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC"}
|
|
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,aAAa,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC7D,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EACL,eAAe,EACf,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,QAAQ,EACR,6BAA6B,EAC7B,WAAW,EACX,cAAc,EACd,MAAM,EACN,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC"}
|
|
@@ -7,6 +7,8 @@ export type PublishOptions = {
|
|
|
7
7
|
manifest: AppshellManifest;
|
|
8
8
|
visibility?: 'public' | 'private';
|
|
9
9
|
metadata?: Metadata;
|
|
10
|
+
/** Ask the registry to overwrite an existing version whose content differs. */
|
|
11
|
+
force?: boolean;
|
|
10
12
|
};
|
|
11
13
|
export type PublishResult = {
|
|
12
14
|
/** `scope/name@version`. The scope comes from the token, not the caller. */
|
|
@@ -15,9 +17,10 @@ export type PublishResult = {
|
|
|
15
17
|
};
|
|
16
18
|
/**
|
|
17
19
|
* Publishing the same content twice is a no-op; publishing different content
|
|
18
|
-
* under a version that already exists is rejected by the registry
|
|
20
|
+
* under a version that already exists is rejected by the registry, unless
|
|
21
|
+
* `force` is set and the registry is configured to honor it (dev registries).
|
|
19
22
|
*/
|
|
20
|
-
export declare const publish: ({ registry, token, name, version, manifest, visibility, metadata, }: PublishOptions) => Promise<PublishResult>;
|
|
23
|
+
export declare const publish: ({ registry, token, name, version, manifest, visibility, metadata, force, }: PublishOptions) => Promise<PublishResult>;
|
|
21
24
|
/**
|
|
22
25
|
* Activating a newer version of an already active app upgrades it in place.
|
|
23
26
|
* @param environment `scope/name`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../../../config/src/publish.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,EAAE,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../../../config/src/publish.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,4EAA4E;IAC5E,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAmBF;;;;GAIG;AACH,eAAO,MAAM,OAAO,+EASjB,cAAc,KAAG,OAAO,CAAC,aAAa,CAYxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,aACT,MAAM,eACH,MAAM,SACZ,MAAM,UACL,MAAM,KACb,OAAO,CAAC,IAAI,CAgBd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchDynamicScript.d.ts","sourceRoot":"","sources":["../../../../src/fetchDynamicScript.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetchDynamicScript.d.ts","sourceRoot":"","sources":["../../../../src/fetchDynamicScript.ts"],"names":[],"mappings":"8BAM2B,MAAM;AAAjC,wBA0CE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appshell/loader",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.10",
|
|
4
4
|
"description": "Utility for loading Appshell components",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/loader/src/index.d.ts",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"appshell"
|
|
25
25
|
],
|
|
26
26
|
"license": "MIT",
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "0af7909493bfba483afdfdf0665834e6a8e4b591"
|
|
28
28
|
}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
const urlCache = new Set<string>();
|
|
2
2
|
|
|
3
|
+
/** Propagates the shell's CSP nonce so browsers that don't trust strict-dynamic propagation still allow it. */
|
|
4
|
+
const cspNonce = (): string | undefined =>
|
|
5
|
+
document.querySelector<HTMLScriptElement>('script[nonce]')?.nonce;
|
|
6
|
+
|
|
3
7
|
export default async (url: string) => {
|
|
4
8
|
const element = document.createElement('script');
|
|
9
|
+
const nonce = cspNonce();
|
|
10
|
+
|
|
11
|
+
if (nonce) {
|
|
12
|
+
element.nonce = nonce;
|
|
13
|
+
}
|
|
5
14
|
|
|
6
15
|
const cleanup = (): void => {
|
|
7
16
|
if (document.head.contains(element)) {
|