@appshell/loader 1.0.0-alpha.10 → 1.0.0-alpha.101
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 +19 -21
- package/dist/main.js +1 -1
- package/dist/types/config/src/axios.d.ts +0 -1
- package/dist/types/config/src/configmap.d.ts +0 -1
- package/dist/types/config/src/context.d.ts +8 -5
- package/dist/types/config/src/credentials.d.ts +35 -3
- package/dist/types/config/src/generate.manifest.d.ts +30 -2
- package/dist/types/config/src/index.d.ts +9 -10
- package/dist/types/config/src/loader.d.ts +18 -0
- package/dist/types/config/src/mappers/appshell.config.d.ts +9 -3
- package/dist/types/config/src/outdated.d.ts +0 -1
- package/dist/types/config/src/package-name.d.ts +20 -0
- package/dist/types/config/src/publish.d.ts +109 -7
- package/dist/types/config/src/sync.d.ts +0 -1
- package/dist/types/config/src/tls.d.ts +11 -0
- package/dist/types/config/src/types.d.ts +184 -31
- package/dist/types/config/src/utils/blur.d.ts +0 -1
- package/dist/types/config/src/utils/compare.d.ts +0 -1
- package/dist/types/config/src/utils/config.d.ts +15 -1
- package/dist/types/config/src/utils/copy.d.ts +0 -1
- package/dist/types/config/src/utils/dump.d.ts +10 -0
- package/dist/types/config/src/utils/index.d.ts +2 -5
- package/dist/types/config/src/utils/list.d.ts +0 -1
- package/dist/types/config/src/utils/load.d.ts +0 -1
- package/dist/types/config/src/validators/AppshellTemplateValidator.d.ts +0 -1
- package/dist/types/config/src/validators/index.d.ts +0 -3
- package/dist/types/loader/src/index.d.ts +0 -1
- package/dist/types/loader/src/loadAppshellComponent.d.ts +13 -14
- package/dist/types/loader/src/remoteLoader.d.ts +2 -3
- package/dist/types/loader/src/resolvers.d.ts +4 -12
- package/dist/types/loader/src/types.d.ts +0 -1
- package/dist/types/runtime/src/errors.d.ts +32 -0
- package/dist/types/runtime/src/identity.d.ts +47 -0
- package/dist/types/runtime/src/index.d.ts +6 -0
- package/dist/types/runtime/src/store.d.ts +25 -0
- package/dist/types/runtime/src/types.d.ts +9 -0
- package/dist/types/runtime/src/wire.d.ts +58 -0
- package/package.json +15 -4
- package/CHANGELOG.md +0 -201
- package/__tests__/fetchDynamicScript.spec.ts +0 -44
- package/__tests__/fixtures/TestComponent.ts +0 -3
- package/__tests__/loadAppshellComponent.spec.ts +0 -102
- package/__tests__/remoteLoader.spec.ts +0 -144
- package/__tests__/resolvers.spec.ts +0 -128
- package/dist/types/config/src/axios.d.ts.map +0 -1
- package/dist/types/config/src/configmap.d.ts.map +0 -1
- package/dist/types/config/src/context.d.ts.map +0 -1
- package/dist/types/config/src/credentials.d.ts.map +0 -1
- package/dist/types/config/src/deregister.d.ts +0 -3
- package/dist/types/config/src/deregister.d.ts.map +0 -1
- package/dist/types/config/src/generate.env.d.ts +0 -3
- package/dist/types/config/src/generate.env.d.ts.map +0 -1
- package/dist/types/config/src/generate.global-config.d.ts +0 -10
- package/dist/types/config/src/generate.global-config.d.ts.map +0 -1
- package/dist/types/config/src/generate.manifest.d.ts.map +0 -1
- package/dist/types/config/src/index.d.ts.map +0 -1
- package/dist/types/config/src/mappers/appshell.config.d.ts.map +0 -1
- package/dist/types/config/src/outdated.d.ts.map +0 -1
- package/dist/types/config/src/publish.d.ts.map +0 -1
- package/dist/types/config/src/register.d.ts +0 -4
- package/dist/types/config/src/register.d.ts.map +0 -1
- package/dist/types/config/src/sync.d.ts.map +0 -1
- package/dist/types/config/src/types.d.ts.map +0 -1
- package/dist/types/config/src/utils/blur.d.ts.map +0 -1
- package/dist/types/config/src/utils/compare.d.ts.map +0 -1
- package/dist/types/config/src/utils/config.d.ts.map +0 -1
- package/dist/types/config/src/utils/copy.d.ts.map +0 -1
- package/dist/types/config/src/utils/index.d.ts.map +0 -1
- package/dist/types/config/src/utils/isValidUrl.d.ts +0 -3
- package/dist/types/config/src/utils/isValidUrl.d.ts.map +0 -1
- package/dist/types/config/src/utils/list.d.ts.map +0 -1
- package/dist/types/config/src/utils/load.d.ts.map +0 -1
- package/dist/types/config/src/utils/loadJson.d.ts +0 -10
- package/dist/types/config/src/utils/loadJson.d.ts.map +0 -1
- package/dist/types/config/src/utils/merge.d.ts +0 -4
- package/dist/types/config/src/utils/merge.d.ts.map +0 -1
- package/dist/types/config/src/validators/AppshellGlobalConfigValidator.d.ts +0 -4
- package/dist/types/config/src/validators/AppshellGlobalConfigValidator.d.ts.map +0 -1
- package/dist/types/config/src/validators/AppshellManifestValidator.d.ts +0 -4
- package/dist/types/config/src/validators/AppshellManifestValidator.d.ts.map +0 -1
- package/dist/types/config/src/validators/AppshellTemplateValidator.d.ts.map +0 -1
- package/dist/types/config/src/validators/index.d.ts.map +0 -1
- package/dist/types/loader/src/fetchDynamicScript.d.ts +0 -3
- package/dist/types/loader/src/fetchDynamicScript.d.ts.map +0 -1
- package/dist/types/loader/src/index.d.ts.map +0 -1
- package/dist/types/loader/src/loadAppshellComponent.d.ts.map +0 -1
- package/dist/types/loader/src/remoteLoader.d.ts.map +0 -1
- package/dist/types/loader/src/resolvers.d.ts.map +0 -1
- package/dist/types/loader/src/types.d.ts.map +0 -1
- package/src/fetchDynamicScript.ts +0 -49
- package/src/index.ts +0 -7
- package/src/loadAppshellComponent.ts +0 -48
- package/src/remoteLoader.ts +0 -80
- package/src/resolvers.ts +0 -110
- package/src/types.ts +0 -10
- package/tsconfig.json +0 -7
- package/webpack.config.js +0 -37
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who is looking at the page, as the registry was told by the gateway.
|
|
3
|
+
*
|
|
4
|
+
* Unlike vars this is not scope-specific — there is one visitor per page, not one
|
|
5
|
+
* per package — so it lives in the main entry rather than needing the subpath
|
|
6
|
+
* trick `@appshell/runtime/vars` uses to get a per-package scope substituted.
|
|
7
|
+
*
|
|
8
|
+
* It is also not delivered through the vars store, and that is a constraint rather
|
|
9
|
+
* than a preference: `setVars` freezes on first write and throws on replacement,
|
|
10
|
+
* which is what stops one package overwriting another's configuration. Identity
|
|
11
|
+
* changes — sign-in, sign-out, token refresh — so it cannot live behind a
|
|
12
|
+
* write-once door without either breaking that guarantee or never updating.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* A discriminated union rather than an optional user, so `username` cannot be read
|
|
16
|
+
* without the anonymous case having been handled. The compiler enforces what a
|
|
17
|
+
* convention would only ask for.
|
|
18
|
+
*/
|
|
19
|
+
export type Identity = {
|
|
20
|
+
authenticated: false;
|
|
21
|
+
} | {
|
|
22
|
+
authenticated: true;
|
|
23
|
+
subject: string;
|
|
24
|
+
username: string;
|
|
25
|
+
roles: string[];
|
|
26
|
+
};
|
|
27
|
+
export declare const ANONYMOUS: Identity;
|
|
28
|
+
declare global {
|
|
29
|
+
interface Window {
|
|
30
|
+
__appshell_identity__?: unknown;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The visitor, or the anonymous identity when there is none.
|
|
35
|
+
*
|
|
36
|
+
* Never throws and never returns undefined — an absent or malformed value is
|
|
37
|
+
* anonymous, which is a state every caller already has to handle. That is the
|
|
38
|
+
* opposite of `readVars`, which throws when a scope is missing, and the difference
|
|
39
|
+
* is deliberate: a package with no configuration cannot do its job, while a package
|
|
40
|
+
* with no signed-in user usually can and simply renders differently.
|
|
41
|
+
*
|
|
42
|
+
* This is a typed accessor, not a boundary. The value is inlined into the document
|
|
43
|
+
* and any script on the page can read it directly, exactly as with vars. Treat it
|
|
44
|
+
* as what the server said about the visitor, never as proof of anything: it carries
|
|
45
|
+
* no token and grants nothing. Anything that matters is re-checked server-side.
|
|
46
|
+
*/
|
|
47
|
+
export declare const getIdentity: () => Identity;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { MissingScopeError, MissingVarsError, VarsConflictError } from './errors';
|
|
2
|
+
export { ANONYMOUS, getIdentity } from './identity';
|
|
3
|
+
export type { Identity } from './identity';
|
|
4
|
+
export { hasVars, readVars, resetVars, setVars } from './store';
|
|
5
|
+
export type { Vars } from './types';
|
|
6
|
+
export type { AppshellIndex, AppshellRemote, Metadata, ModuleFederationLoader, RemoteLoader, } from './wire';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Vars } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Delivers a scope's vars. Called by `@appshell/loader` immediately before the remote
|
|
4
|
+
* is loaded, so they are in place before the package's modules evaluate.
|
|
5
|
+
*
|
|
6
|
+
* The first write for a scope wins and is frozen. Re-delivering the identical vars is a
|
|
7
|
+
* no-op — the same remote can be mounted more than once — but replacing them throws.
|
|
8
|
+
* That is what keeps one package from overwriting another's: by the time any package
|
|
9
|
+
* evaluates, the host has already written for it.
|
|
10
|
+
*
|
|
11
|
+
* It does not make a scope's vars *private*. Any code on the page can still read another
|
|
12
|
+
* scope by name, and nothing short of a separate realm would change that.
|
|
13
|
+
*/
|
|
14
|
+
export declare const setVars: (scope: string, vars: Vars) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Reads a scope's vars, throwing rather than handing back an empty object — a package
|
|
17
|
+
* that silently renders with no configuration is the failure this replaced.
|
|
18
|
+
*
|
|
19
|
+
* Prefer `getVars()` from `@appshell/runtime/vars`, which supplies the scope for you.
|
|
20
|
+
*/
|
|
21
|
+
export declare const readVars: <TVars extends Vars = Vars>(scope: string) => TVars;
|
|
22
|
+
/** Whether a scope has been delivered, for callers that want to branch instead of catch. */
|
|
23
|
+
export declare const hasVars: (scope: string) => boolean;
|
|
24
|
+
/** Test seam. Not part of the contract a package should build on. */
|
|
25
|
+
export declare const resetVars: () => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A package's runtime configuration, already merged by the registry — a package's
|
|
3
|
+
* declared vars, then the application's `overrides.vars`.
|
|
4
|
+
*
|
|
5
|
+
* Structurally identical to `AppshellComposition['vars'][scope]` in `@appshell/config`,
|
|
6
|
+
* but declared here rather than imported. This package is a shared singleton loaded
|
|
7
|
+
* into every micro-frontend on the page, so it carries no dependencies at all.
|
|
8
|
+
*/
|
|
9
|
+
export type Vars = Record<string, string | number | undefined>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the browser is told about a remote.
|
|
3
|
+
*
|
|
4
|
+
* These live here rather than in `@appshell/config` because config is build tooling — it
|
|
5
|
+
* carries yaml, lodash and axios — and a package that only wants to type a remote should
|
|
6
|
+
* not install a compiler to get it. This package is already the one every micro-frontend
|
|
7
|
+
* on the page shares, and it has no dependencies of its own to pass on.
|
|
8
|
+
*
|
|
9
|
+
* `AppshellManifest` deliberately stays in `@appshell/config`. It is a build artifact, and
|
|
10
|
+
* its `modules` field is Module Federation plugin options — build-time webpack
|
|
11
|
+
* configuration the browser never sees and this package should never drag in.
|
|
12
|
+
*/
|
|
13
|
+
/** Arbitrary, application-defined description of a remote. Appshell never reads it. */
|
|
14
|
+
export type Metadata = Record<string, unknown>;
|
|
15
|
+
/**
|
|
16
|
+
* How a host loads a remote, named as one kind among possible kinds.
|
|
17
|
+
*
|
|
18
|
+
* scope, module and shareScope are Module Federation's vocabulary, and they used to sit
|
|
19
|
+
* at the top level of a remote where nothing said so — which is what would have made a
|
|
20
|
+
* second framework awkward, not the words themselves. Nested under a kind they are
|
|
21
|
+
* exactly correct, and something like single-spa slots beside them without reinterpreting
|
|
22
|
+
* anything already published.
|
|
23
|
+
*
|
|
24
|
+
* apiVersion follows the house style set by appshell.app.yaml, and the group is appshell's
|
|
25
|
+
* because appshell owns this schema: it decides which fields it stores, even though the
|
|
26
|
+
* fields describe federation concepts. If federation ever needs a different recipe that is
|
|
27
|
+
* a v2, and manifests published under v1 keep meaning what they meant — which matters,
|
|
28
|
+
* because they are immutable and hashed.
|
|
29
|
+
*/
|
|
30
|
+
export type ModuleFederationLoader = {
|
|
31
|
+
apiVersion: 'federation.appshell.org/v1';
|
|
32
|
+
kind: 'ModuleFederation';
|
|
33
|
+
scope: string;
|
|
34
|
+
module: string;
|
|
35
|
+
shareScope?: string;
|
|
36
|
+
/** The entry file the build emits, conventionally remoteEntry.js. */
|
|
37
|
+
filename: string;
|
|
38
|
+
/**
|
|
39
|
+
* What built this, recorded as a fact rather than a constraint.
|
|
40
|
+
*
|
|
41
|
+
* Deliberately not a version range. A range is a claim about the environment, and a
|
|
42
|
+
* package cannot make it: it knows what built it and not what will load it, and the
|
|
43
|
+
* host is what registers the remote. Freezing one into an immutable artifact is the
|
|
44
|
+
* same mistake as freezing its origin.
|
|
45
|
+
*/
|
|
46
|
+
builtWith?: string;
|
|
47
|
+
};
|
|
48
|
+
export type RemoteLoader = ModuleFederationLoader;
|
|
49
|
+
/** A remote the registry has already resolved, so the browser needs no manifest fetch. */
|
|
50
|
+
export type AppshellRemote<TMetadata = Metadata> = {
|
|
51
|
+
id: string;
|
|
52
|
+
manifestUrl: string;
|
|
53
|
+
remoteEntryUrl: string;
|
|
54
|
+
loader: RemoteLoader;
|
|
55
|
+
metadata: TMetadata;
|
|
56
|
+
};
|
|
57
|
+
/** Remote key to manifest url. */
|
|
58
|
+
export type AppshellIndex = Record<string, string>;
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appshell/loader",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.101",
|
|
4
4
|
"description": "Utility for loading Appshell components",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/loader/src/index.d.ts",
|
|
7
|
-
"repository":
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/appshellhq/appshell.git"
|
|
10
|
+
},
|
|
8
11
|
"author": "Robert Hamilton <rh@navaris.com>",
|
|
9
12
|
"publishConfig": {
|
|
10
13
|
"access": "public",
|
|
@@ -16,13 +19,21 @@
|
|
|
16
19
|
"clean": "rm -rf dist",
|
|
17
20
|
"prebuild": "npm run clean",
|
|
18
21
|
"start": "webpack --watch --mode development && npm run build:types",
|
|
19
|
-
"stats": "webpack --json > stats.json"
|
|
22
|
+
"stats": "webpack --json > stats.json",
|
|
23
|
+
"typecheck": "tsc --noEmit"
|
|
20
24
|
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
21
28
|
"keywords": [
|
|
22
29
|
"module federation",
|
|
23
30
|
"micro-frontends",
|
|
24
31
|
"appshell"
|
|
25
32
|
],
|
|
26
33
|
"license": "MIT",
|
|
27
|
-
"
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@appshell/runtime": "^1.0.0-alpha.101",
|
|
36
|
+
"@module-federation/enhanced": "^2.8.2"
|
|
37
|
+
},
|
|
38
|
+
"gitHead": "7a0f5ce018f35276830999b97891ccaf2114ee1e"
|
|
28
39
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
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)
|
|
11
|
-
|
|
12
|
-
### Bug Fixes
|
|
13
|
-
|
|
14
|
-
- **example:** resolve CSP/module-federation issues blocking local dev ([f8de4e1](https://github.com/appshell-org/appshell/commit/f8de4e1cfe495a7d4ae8e6374189384847c21309))
|
|
15
|
-
|
|
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)
|
|
17
|
-
|
|
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
|
|
45
|
-
|
|
46
|
-
# 0.12.0-alpha.0 (2026-04-20)
|
|
47
|
-
|
|
48
|
-
### Bug Fixes
|
|
49
|
-
|
|
50
|
-
- appshell loader override check ([aedda4a](https://github.com/appshell-org/appshell/commit/aedda4abf81560297dce03df09fba68e8785242f))
|
|
51
|
-
- configurable api key header support, minor fixes ([2f0bf02](https://github.com/appshell-org/appshell/commit/2f0bf027b92398f91b8e8cbfbf543d61fe37b7a0))
|
|
52
|
-
- hot module replacement support, example updates ([a67d230](https://github.com/appshell-org/appshell/commit/a67d2303b40f5911373225cc0b4ccf9b67c33d11))
|
|
53
|
-
- registry projection, enable env overwrite, refactor docker workflow, consolidate env names ([33a28fe](https://github.com/appshell-org/appshell/commit/33a28fe76b58e05c5b6b6b33d4b402e52bb29e70))
|
|
54
|
-
- rename @appshell/react-federated-component package to @appshell/react ([0b74498](https://github.com/appshell-org/appshell/commit/0b74498bf17ba73db4d936c8a012af1d3b111a28))
|
|
55
|
-
- replace config intermediate file with template ([9b79e65](https://github.com/appshell-org/appshell/commit/9b79e65b355686a0cca273c89c7164bb031e8437))
|
|
56
|
-
- update repository URLs from navaris/appshell to appshell-org/appshell ([506a90d](https://github.com/appshell-org/appshell/commit/506a90d94a6f6e10f463987d408550f48624bfd0))
|
|
57
|
-
|
|
58
|
-
### Features
|
|
59
|
-
|
|
60
|
-
- api key support ([9cdcbee](https://github.com/appshell-org/appshell/commit/9cdcbee36e44b8a179b49768d74a25767f1cc5f2))
|
|
61
|
-
- appshell cli api key support, init sync and outdated commands ([#6](https://github.com/appshell-org/appshell/issues/6)) ([acc5fa2](https://github.com/appshell-org/appshell/commit/acc5fa234f91a167038161d5080481c43f8eb8b4))
|
|
62
|
-
- AppshellComponent impl ([2b82621](https://github.com/appshell-org/appshell/commit/2b82621c13302f790a8e1c457f9a82f39903fc1f))
|
|
63
|
-
- consolidate runtime artifacts ([#26](https://github.com/appshell-org/appshell/issues/26)) ([a29479a](https://github.com/appshell-org/appshell/commit/a29479a49f0c5ec1273c9f8e4c7384096f2d4ba0))
|
|
64
|
-
- environment variable override for federated components ([#27](https://github.com/appshell-org/appshell/issues/27)) ([d32de0b](https://github.com/appshell-org/appshell/commit/d32de0b0d1cbb1792715e1b363c80ed4600df155))
|
|
65
|
-
- foundation refactor wip ([339b930](https://github.com/appshell-org/appshell/commit/339b9306accaa9aba1712f3a0dee6c4cab7ed273))
|
|
66
|
-
|
|
67
|
-
## [0.5.1-alpha.0](https://github.com/appshell-org/appshell/compare/@appshell/loader@0.5.0...@appshell/loader@0.5.1-alpha.0) (2026-04-20)
|
|
68
|
-
|
|
69
|
-
### Bug Fixes
|
|
70
|
-
|
|
71
|
-
- update repository URLs from navaris/appshell to appshell-org/appshell ([506a90d](https://github.com/appshell-org/appshell/commit/506a90d94a6f6e10f463987d408550f48624bfd0))
|
|
72
|
-
|
|
73
|
-
# [0.5.0](https://github.com/navaris/appshell/compare/@appshell/loader@0.4.0...@appshell/loader@0.5.0) (2025-08-12)
|
|
74
|
-
|
|
75
|
-
### Bug Fixes
|
|
76
|
-
|
|
77
|
-
- configurable api key header support, minor fixes ([2f0bf02](https://github.com/navaris/appshell/commit/2f0bf027b92398f91b8e8cbfbf543d61fe37b7a0))
|
|
78
|
-
|
|
79
|
-
### Features
|
|
80
|
-
|
|
81
|
-
- appshell cli api key support, init sync and outdated commands ([#6](https://github.com/navaris/appshell/issues/6)) ([acc5fa2](https://github.com/navaris/appshell/commit/acc5fa234f91a167038161d5080481c43f8eb8b4))
|
|
82
|
-
|
|
83
|
-
# [0.5.0-alpha.0](https://github.com/navaris/appshell/compare/@appshell/loader@0.4.0...@appshell/loader@0.5.0-alpha.0) (2025-08-10)
|
|
84
|
-
|
|
85
|
-
### Bug Fixes
|
|
86
|
-
|
|
87
|
-
- include credentials when fetching the manifests ([4e0ee79](https://github.com/navaris/appshell/commit/4e0ee79b4ba93d34fd6a0e1a5f6bf2fc9f3994cc))
|
|
88
|
-
|
|
89
|
-
### Features
|
|
90
|
-
|
|
91
|
-
- appshell cli api key support, init sync and outdated commands ([#6](https://github.com/navaris/appshell/issues/6)) ([acc5fa2](https://github.com/navaris/appshell/commit/acc5fa234f91a167038161d5080481c43f8eb8b4))
|
|
92
|
-
|
|
93
|
-
# [0.4.0](https://github.com/navaris/appshell/compare/@appshell/loader@0.3.0...@appshell/loader@0.4.0) (2024-09-24)
|
|
94
|
-
|
|
95
|
-
### Features
|
|
96
|
-
|
|
97
|
-
- api key support ([9cdcbee](https://github.com/navaris/appshell/commit/9cdcbee36e44b8a179b49768d74a25767f1cc5f2))
|
|
98
|
-
|
|
99
|
-
# [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)
|
|
100
|
-
|
|
101
|
-
### Features
|
|
102
|
-
|
|
103
|
-
- api key support ([8c91e62](https://github.com/navaris/appshell/commit/8c91e6240b3d879af9bdd5949924865da0e0f8a1))
|
|
104
|
-
|
|
105
|
-
## [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)
|
|
106
|
-
|
|
107
|
-
### Bug Fixes
|
|
108
|
-
|
|
109
|
-
- bump pipeline ([8bb63bc](https://github.com/navaris/appshell/commit/8bb63bcae1928c01bb6bc853d88010939e686af5))
|
|
110
|
-
|
|
111
|
-
# [0.3.0](https://github.com/navaris/appshell/compare/@appshell/loader@0.2.1...@appshell/loader@0.3.0) (2024-01-25)
|
|
112
|
-
|
|
113
|
-
### Features
|
|
114
|
-
|
|
115
|
-
- AppshellComponent impl ([2b82621](https://github.com/navaris/appshell/commit/2b82621c13302f790a8e1c457f9a82f39903fc1f))
|
|
116
|
-
|
|
117
|
-
## [0.2.1](https://github.com/navaris/appshell/compare/@appshell/loader@0.2.0...@appshell/loader@0.2.1) (2023-08-29)
|
|
118
|
-
|
|
119
|
-
### Bug Fixes
|
|
120
|
-
|
|
121
|
-
- appshell loader override check ([aedda4a](https://github.com/navaris/appshell/commit/aedda4abf81560297dce03df09fba68e8785242f))
|
|
122
|
-
|
|
123
|
-
# [0.2.0](https://github.com/navaris/appshell/compare/@appshell/loader@0.2.0-alpha.1...@appshell/loader@0.2.0) (2023-08-28)
|
|
124
|
-
|
|
125
|
-
**Note:** Version bump only for package @appshell/loader
|
|
126
|
-
|
|
127
|
-
# [0.2.0-alpha.1](https://github.com/navaris/appshell/compare/@appshell/loader@0.2.0-alpha.0...@appshell/loader@0.2.0-alpha.1) (2023-08-28)
|
|
128
|
-
|
|
129
|
-
### Features
|
|
130
|
-
|
|
131
|
-
- environment variable override for federated components ([#27](https://github.com/navaris/appshell/issues/27)) ([d32de0b](https://github.com/navaris/appshell/commit/d32de0b0d1cbb1792715e1b363c80ed4600df155))
|
|
132
|
-
|
|
133
|
-
# [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)
|
|
134
|
-
|
|
135
|
-
### Features
|
|
136
|
-
|
|
137
|
-
- consolidate runtime artifacts ([#26](https://github.com/navaris/appshell/issues/26)) ([a29479a](https://github.com/navaris/appshell/commit/a29479a49f0c5ec1273c9f8e4c7384096f2d4ba0))
|
|
138
|
-
|
|
139
|
-
# [0.1.0](https://github.com/navaris/appshell/compare/@appshell/loader@0.1.0-alpha.1...@appshell/loader@0.1.0) (2023-07-11)
|
|
140
|
-
|
|
141
|
-
### Bug Fixes
|
|
142
|
-
|
|
143
|
-
- registry projection, enable env overwrite, refactor docker workflow, consolidate env names ([33a28fe](https://github.com/navaris/appshell/commit/33a28fe76b58e05c5b6b6b33d4b402e52bb29e70))
|
|
144
|
-
- rename @appshell/react-federated-component package to @appshell/react ([0b74498](https://github.com/navaris/appshell/commit/0b74498bf17ba73db4d936c8a012af1d3b111a28))
|
|
145
|
-
- replace config intermediate file with template ([9b79e65](https://github.com/navaris/appshell/commit/9b79e65b355686a0cca273c89c7164bb031e8437))
|
|
146
|
-
|
|
147
|
-
# [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)
|
|
148
|
-
|
|
149
|
-
### Features
|
|
150
|
-
|
|
151
|
-
- foundation refactor wip ([339b930](https://github.com/navaris/appshell/commit/339b9306accaa9aba1712f3a0dee6c4cab7ed273))
|
|
152
|
-
|
|
153
|
-
# [0.1.0-alpha.0](https://github.com/navaris/appshell/compare/@appshell/loader@0.0.3...@appshell/loader@0.1.0-alpha.0) (2023-07-05)
|
|
154
|
-
|
|
155
|
-
### Features
|
|
156
|
-
|
|
157
|
-
- registry index ([8e6ee0a](https://github.com/navaris/appshell/commit/8e6ee0a6a377584efa2ee702168025f46108b8c5))
|
|
158
|
-
|
|
159
|
-
## [0.0.3](https://github.com/navaris/appshell/compare/@appshell/loader@0.0.3-alpha.2...@appshell/loader@0.0.3) (2023-06-29)
|
|
160
|
-
|
|
161
|
-
**Note:** Version bump only for package @appshell/loader
|
|
162
|
-
|
|
163
|
-
## [0.0.3-alpha.2](https://github.com/navaris/appshell/compare/@appshell/loader@0.0.2...@appshell/loader@0.0.3-alpha.2) (2023-06-29)
|
|
164
|
-
|
|
165
|
-
**Note:** Version bump only for package @appshell/loader
|
|
166
|
-
|
|
167
|
-
## [0.0.3-alpha.1](https://github.com/navaris/appshell/compare/@appshell/loader@0.0.3-alpha.0...@appshell/loader@0.0.3-alpha.1) (2023-06-29)
|
|
168
|
-
|
|
169
|
-
### Bug Fixes
|
|
170
|
-
|
|
171
|
-
- update npm package visibility ([1ef4119](https://github.com/navaris/appshell/commit/1ef411903dd038dfc781e8ce0700811e5460c903))
|
|
172
|
-
|
|
173
|
-
## [0.0.3-alpha.0](https://github.com/navaris/appshell/compare/@appshell/loader@0.0.2-alpha.0...@appshell/loader@0.0.3-alpha.0) (2023-06-29)
|
|
174
|
-
|
|
175
|
-
**Note:** Version bump only for package @appshell/loader
|
|
176
|
-
|
|
177
|
-
## [0.0.2](https://github.com/navaris/appshell/compare/@appshell/loader@0.0.2-alpha.0...@appshell/loader@0.0.2) (2023-06-29)
|
|
178
|
-
|
|
179
|
-
**Note:** Version bump only for package @appshell/loader
|
|
180
|
-
|
|
181
|
-
## [0.0.2-alpha.0](https://github.com/navaris/appshell/compare/@appshell/loader@0.0.1...@appshell/loader@0.0.2-alpha.0) (2023-06-15)
|
|
182
|
-
|
|
183
|
-
### Bug Fixes
|
|
184
|
-
|
|
185
|
-
- hot module replacement support, example updates ([a67d230](https://github.com/navaris/appshell/commit/a67d2303b40f5911373225cc0b4ccf9b67c33d11))
|
|
186
|
-
|
|
187
|
-
=======
|
|
188
|
-
|
|
189
|
-
## 0.0.1 (2023-06-15)
|
|
190
|
-
|
|
191
|
-
**Note:** Version bump only for package @appshell/loader
|
|
192
|
-
|
|
193
|
-
## [0.0.1-alpha.1](https://github.com/navaris/appshell/compare/@appshell/loader@0.0.1-alpha.0...@appshell/loader@0.0.1-alpha.1) (2023-06-15)
|
|
194
|
-
|
|
195
|
-
### Bug Fixes
|
|
196
|
-
|
|
197
|
-
- hot module replacement support, example updates ([a67d230](https://github.com/navaris/appshell/commit/a67d2303b40f5911373225cc0b4ccf9b67c33d11))
|
|
198
|
-
|
|
199
|
-
## 0.0.1-alpha.0 (2023-03-19)
|
|
200
|
-
|
|
201
|
-
**Note:** Version bump only for package @appshell/loader
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/** @jest-environment jsdom */
|
|
2
|
-
import { fireEvent } from '@testing-library/react';
|
|
3
|
-
import fetchDynamicScript from '../src/fetchDynamicScript';
|
|
4
|
-
|
|
5
|
-
const mockHead = (event: string) => {
|
|
6
|
-
const appendChildSpy = jest.spyOn(document.head, 'appendChild').mockImplementation((element) => {
|
|
7
|
-
fireEvent(element, new Event(event));
|
|
8
|
-
return element;
|
|
9
|
-
});
|
|
10
|
-
const removeChildSpy = jest.spyOn(document.head, 'removeChild').mockReturnThis();
|
|
11
|
-
const containsSpy = jest.spyOn(document.head, 'contains').mockReturnValue(true);
|
|
12
|
-
|
|
13
|
-
return [appendChildSpy, removeChildSpy, containsSpy];
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
describe('fetchDynamicScript', () => {
|
|
17
|
-
afterEach(() => {
|
|
18
|
-
jest.resetAllMocks();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should successfully resolve when valid script url is provided', async () => {
|
|
22
|
-
mockHead('load');
|
|
23
|
-
const url = 'http://test.com/1/somescript.js';
|
|
24
|
-
const success = await fetchDynamicScript(url);
|
|
25
|
-
|
|
26
|
-
expect(success).toBe(true);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('should reject when fetching the script results in an error', async () => {
|
|
30
|
-
mockHead('error');
|
|
31
|
-
const url = 'http://test.com/2/somescript.js';
|
|
32
|
-
|
|
33
|
-
await expect(fetchDynamicScript(url)).rejects.toMatch(/Failed to fetch remote entry/i);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should cleanup script tags when finished', async () => {
|
|
37
|
-
const [appendChildSpy, removeChildSpy] = mockHead('load');
|
|
38
|
-
const url = 'http://test.com/3/somescript.js';
|
|
39
|
-
await fetchDynamicScript(url);
|
|
40
|
-
|
|
41
|
-
expect(appendChildSpy).toHaveBeenCalled();
|
|
42
|
-
expect(removeChildSpy).toHaveBeenCalled();
|
|
43
|
-
});
|
|
44
|
-
});
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/** @jest-environment jsdom */
|
|
2
|
-
/* eslint-disable no-underscore-dangle */
|
|
3
|
-
import loadAppshellComponent from '../src/loadAppshellComponent';
|
|
4
|
-
import { ModuleContainer, ShareScope } from '../src/types';
|
|
5
|
-
|
|
6
|
-
type ComponentType = () => string;
|
|
7
|
-
|
|
8
|
-
const TestComponent = () => 'test component';
|
|
9
|
-
const mockModule = {
|
|
10
|
-
'./TestComponent': {
|
|
11
|
-
get: jest.fn(),
|
|
12
|
-
from: '',
|
|
13
|
-
eager: false,
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
const scopes: Record<string, ShareScope<ComponentType>> = {
|
|
17
|
-
default: {
|
|
18
|
-
TestModule: mockModule,
|
|
19
|
-
},
|
|
20
|
-
test_scope: {
|
|
21
|
-
TestModule2: mockModule,
|
|
22
|
-
},
|
|
23
|
-
no_factory: {
|
|
24
|
-
TestModule3: mockModule,
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
const containers: Record<string, Record<string, ModuleContainer<ComponentType>>> = {
|
|
28
|
-
default: {
|
|
29
|
-
TestModule: {
|
|
30
|
-
init: jest.fn(),
|
|
31
|
-
get: jest.fn().mockReturnValue(() => ({
|
|
32
|
-
default: TestComponent,
|
|
33
|
-
})),
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
test_scope: {
|
|
37
|
-
TestModule2: {
|
|
38
|
-
init: jest.fn(),
|
|
39
|
-
get: jest.fn().mockReturnValue(() => ({
|
|
40
|
-
test_scope: TestComponent,
|
|
41
|
-
})),
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
no_factory: {
|
|
45
|
-
TestModule3: {
|
|
46
|
-
init: jest.fn(),
|
|
47
|
-
get: jest.fn().mockReturnValue(undefined),
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
describe('loadAppshellComponent', () => {
|
|
53
|
-
beforeEach(() => {
|
|
54
|
-
window.__webpack_init_sharing__ = jest.fn(async (shareScope: string) => {
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
56
|
-
Object.entries(containers[shareScope] || {}).forEach(([key, module]) => {
|
|
57
|
-
window[key] = module;
|
|
58
|
-
});
|
|
59
|
-
window.__webpack_share_scopes__ = {};
|
|
60
|
-
window.__webpack_share_scopes__[shareScope] = scopes[shareScope];
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
afterEach(() => {
|
|
65
|
-
Object.values(window.__webpack_share_scopes__ || {})
|
|
66
|
-
.flatMap((val) => Object.keys(val || {}))
|
|
67
|
-
.forEach((key) => {
|
|
68
|
-
delete window[key];
|
|
69
|
-
});
|
|
70
|
-
window.__webpack_share_scopes__ = {};
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('should load the Appshell component from the default scope', async () => {
|
|
74
|
-
const scope = 'TestModule';
|
|
75
|
-
const module = './TestComponent';
|
|
76
|
-
const shareScope = undefined;
|
|
77
|
-
|
|
78
|
-
const Component = await loadAppshellComponent<ComponentType>(scope, module, shareScope);
|
|
79
|
-
|
|
80
|
-
expect(Component).toBe(TestComponent);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('should throw if the share scope does not exist', async () => {
|
|
84
|
-
const scope = 'TestModule';
|
|
85
|
-
const module = './TestComponent';
|
|
86
|
-
const shareScope = 'does_not_exist';
|
|
87
|
-
|
|
88
|
-
await expect(loadAppshellComponent<ComponentType>(scope, module, shareScope)).rejects.toThrow(
|
|
89
|
-
/Failed to find module container/i,
|
|
90
|
-
);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('should throw if the module factory does not exist', async () => {
|
|
94
|
-
const scope = 'TestModule3';
|
|
95
|
-
const module = './TestComponent';
|
|
96
|
-
const shareScope = 'no_factory';
|
|
97
|
-
|
|
98
|
-
await expect(loadAppshellComponent<ComponentType>(scope, module, shareScope)).rejects.toThrow(
|
|
99
|
-
/Invalid factory produced/i,
|
|
100
|
-
);
|
|
101
|
-
});
|
|
102
|
-
});
|