@zstackui/qiankun 2.6.3-beta-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +116 -0
- package/dist/index.umd.js +8681 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/index.umd.min.js +4 -0
- package/dist/index.umd.min.js.map +1 -0
- package/dist/src/__tests__/globalState.test.d.ts +5 -0
- package/dist/src/__tests__/utils.test.d.ts +1 -0
- package/dist/src/addons/engineFlag.d.ts +6 -0
- package/dist/src/addons/index.d.ts +6 -0
- package/dist/src/addons/runtimePublicPath.d.ts +6 -0
- package/dist/src/apis.d.ts +7 -0
- package/dist/src/effects.d.ts +3 -0
- package/dist/src/error.d.ts +3 -0
- package/dist/src/errorHandler.d.ts +7 -0
- package/dist/src/globalState.d.ts +7 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/interfaces.d.ts +107 -0
- package/dist/src/loader.d.ts +8 -0
- package/dist/src/prefetch.d.ts +14 -0
- package/dist/src/sandbox/__tests__/common.test.d.ts +5 -0
- package/dist/src/sandbox/__tests__/proxySandbox.test.d.ts +10 -0
- package/dist/src/sandbox/common.d.ts +21 -0
- package/dist/src/sandbox/index.d.ts +40 -0
- package/dist/src/sandbox/legacy/__tests__/sandbox.test.d.ts +5 -0
- package/dist/src/sandbox/legacy/sandbox.d.ts +28 -0
- package/dist/src/sandbox/patchers/__tests__/css.test.d.ts +5 -0
- package/dist/src/sandbox/patchers/__tests__/interval.test.d.ts +5 -0
- package/dist/src/sandbox/patchers/css.d.ts +17 -0
- package/dist/src/sandbox/patchers/dynamicAppend/__tests__/common.test.d.ts +1 -0
- package/dist/src/sandbox/patchers/dynamicAppend/common.d.ts +22 -0
- package/dist/src/sandbox/patchers/dynamicAppend/forLooseSandbox.d.ts +17 -0
- package/dist/src/sandbox/patchers/dynamicAppend/forStrictSandbox.d.ts +12 -0
- package/dist/src/sandbox/patchers/dynamicAppend/index.d.ts +6 -0
- package/dist/src/sandbox/patchers/historyListener.d.ts +5 -0
- package/dist/src/sandbox/patchers/index.d.ts +9 -0
- package/dist/src/sandbox/patchers/interval.d.ts +5 -0
- package/dist/src/sandbox/patchers/windowListener.d.ts +5 -0
- package/dist/src/sandbox/proxySandbox.d.ts +23 -0
- package/dist/src/sandbox/snapshotSandbox.d.ts +20 -0
- package/dist/src/utils.d.ts +44 -0
- package/dist/src/version.d.ts +1 -0
- package/es/addons/engineFlag.d.ts +6 -0
- package/es/addons/engineFlag.js +50 -0
- package/es/addons/index.d.ts +6 -0
- package/es/addons/index.js +13 -0
- package/es/addons/runtimePublicPath.d.ts +6 -0
- package/es/addons/runtimePublicPath.js +57 -0
- package/es/apis.d.ts +7 -0
- package/es/apis.js +278 -0
- package/es/effects.d.ts +3 -0
- package/es/effects.js +33 -0
- package/es/error.d.ts +3 -0
- package/es/error.js +16 -0
- package/es/errorHandler.d.ts +7 -0
- package/es/errorHandler.js +13 -0
- package/es/globalState.d.ts +7 -0
- package/es/globalState.js +101 -0
- package/es/index.d.ts +11 -0
- package/es/index.js +11 -0
- package/es/interfaces.d.ts +107 -0
- package/es/interfaces.js +8 -0
- package/es/loader.d.ts +8 -0
- package/es/loader.js +600 -0
- package/es/prefetch.d.ts +14 -0
- package/es/prefetch.js +125 -0
- package/es/sandbox/common.d.ts +21 -0
- package/es/sandbox/common.js +157 -0
- package/es/sandbox/index.d.ts +40 -0
- package/es/sandbox/index.js +105 -0
- package/es/sandbox/legacy/sandbox.d.ts +28 -0
- package/es/sandbox/legacy/sandbox.js +142 -0
- package/es/sandbox/patchers/css.d.ts +17 -0
- package/es/sandbox/patchers/css.js +186 -0
- package/es/sandbox/patchers/dynamicAppend/common.d.ts +22 -0
- package/es/sandbox/patchers/dynamicAppend/common.js +306 -0
- package/es/sandbox/patchers/dynamicAppend/forLooseSandbox.d.ts +17 -0
- package/es/sandbox/patchers/dynamicAppend/forLooseSandbox.js +77 -0
- package/es/sandbox/patchers/dynamicAppend/forStrictSandbox.d.ts +12 -0
- package/es/sandbox/patchers/dynamicAppend/forStrictSandbox.js +103 -0
- package/es/sandbox/patchers/dynamicAppend/index.d.ts +6 -0
- package/es/sandbox/patchers/dynamicAppend/index.js +6 -0
- package/es/sandbox/patchers/historyListener.d.ts +5 -0
- package/es/sandbox/patchers/historyListener.js +54 -0
- package/es/sandbox/patchers/index.d.ts +9 -0
- package/es/sandbox/patchers/index.js +45 -0
- package/es/sandbox/patchers/interval.d.ts +5 -0
- package/es/sandbox/patchers/interval.js +34 -0
- package/es/sandbox/patchers/windowListener.d.ts +5 -0
- package/es/sandbox/patchers/windowListener.js +34 -0
- package/es/sandbox/proxySandbox.d.ts +23 -0
- package/es/sandbox/proxySandbox.js +315 -0
- package/es/sandbox/snapshotSandbox.d.ts +20 -0
- package/es/sandbox/snapshotSandbox.js +59 -0
- package/es/utils.d.ts +44 -0
- package/es/utils.js +215 -0
- package/es/version.d.ts +1 -0
- package/es/version.js +1 -0
- package/lib/addons/engineFlag.d.ts +6 -0
- package/lib/addons/engineFlag.js +55 -0
- package/lib/addons/index.d.ts +6 -0
- package/lib/addons/index.js +21 -0
- package/lib/addons/runtimePublicPath.d.ts +6 -0
- package/lib/addons/runtimePublicPath.js +63 -0
- package/lib/apis.d.ts +7 -0
- package/lib/apis.js +288 -0
- package/lib/effects.d.ts +3 -0
- package/lib/effects.js +42 -0
- package/lib/error.d.ts +3 -0
- package/lib/error.js +23 -0
- package/lib/errorHandler.d.ts +7 -0
- package/lib/errorHandler.js +33 -0
- package/lib/globalState.d.ts +7 -0
- package/lib/globalState.js +110 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +89 -0
- package/lib/interfaces.d.ts +107 -0
- package/lib/interfaces.js +14 -0
- package/lib/loader.d.ts +8 -0
- package/lib/loader.js +606 -0
- package/lib/prefetch.d.ts +14 -0
- package/lib/prefetch.js +132 -0
- package/lib/sandbox/common.d.ts +21 -0
- package/lib/sandbox/common.js +169 -0
- package/lib/sandbox/index.d.ts +40 -0
- package/lib/sandbox/index.js +123 -0
- package/lib/sandbox/legacy/sandbox.d.ts +28 -0
- package/lib/sandbox/legacy/sandbox.js +148 -0
- package/lib/sandbox/patchers/css.d.ts +17 -0
- package/lib/sandbox/patchers/css.js +193 -0
- package/lib/sandbox/patchers/dynamicAppend/common.d.ts +22 -0
- package/lib/sandbox/patchers/dynamicAppend/common.js +322 -0
- package/lib/sandbox/patchers/dynamicAppend/forLooseSandbox.d.ts +17 -0
- package/lib/sandbox/patchers/dynamicAppend/forLooseSandbox.js +84 -0
- package/lib/sandbox/patchers/dynamicAppend/forStrictSandbox.d.ts +12 -0
- package/lib/sandbox/patchers/dynamicAppend/forStrictSandbox.js +110 -0
- package/lib/sandbox/patchers/dynamicAppend/index.d.ts +6 -0
- package/lib/sandbox/patchers/dynamicAppend/index.js +19 -0
- package/lib/sandbox/patchers/historyListener.d.ts +5 -0
- package/lib/sandbox/patchers/historyListener.js +62 -0
- package/lib/sandbox/patchers/index.d.ts +9 -0
- package/lib/sandbox/patchers/index.js +57 -0
- package/lib/sandbox/patchers/interval.d.ts +5 -0
- package/lib/sandbox/patchers/interval.js +42 -0
- package/lib/sandbox/patchers/windowListener.d.ts +5 -0
- package/lib/sandbox/patchers/windowListener.js +42 -0
- package/lib/sandbox/proxySandbox.d.ts +23 -0
- package/lib/sandbox/proxySandbox.js +321 -0
- package/lib/sandbox/snapshotSandbox.d.ts +20 -0
- package/lib/sandbox/snapshotSandbox.js +65 -0
- package/lib/utils.d.ts +44 -0
- package/lib/utils.js +240 -0
- package/lib/version.d.ts +1 -0
- package/lib/version.js +7 -0
- package/package.json +137 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author kuitos
|
|
3
|
+
* @since 2019-05-16
|
|
4
|
+
*/
|
|
5
|
+
import type { ImportEntryOpts } from 'import-html-entry';
|
|
6
|
+
import type { RegisterApplicationConfig, StartOpts, Parcel } from 'single-spa';
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
__POWERED_BY_QIANKUN__?: boolean;
|
|
10
|
+
__INJECTED_PUBLIC_PATH_BY_QIANKUN__?: string;
|
|
11
|
+
__QIANKUN_DEVELOPMENT__?: boolean;
|
|
12
|
+
Zone?: CallableFunction;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export type ObjectType = Record<string, any>;
|
|
16
|
+
export type Entry = string | {
|
|
17
|
+
scripts?: string[];
|
|
18
|
+
styles?: string[];
|
|
19
|
+
html?: string;
|
|
20
|
+
};
|
|
21
|
+
export type HTMLContentRender = (props: {
|
|
22
|
+
appContent: string;
|
|
23
|
+
loading: boolean;
|
|
24
|
+
}) => any;
|
|
25
|
+
export type AppMetadata = {
|
|
26
|
+
name: string;
|
|
27
|
+
entry: Entry;
|
|
28
|
+
};
|
|
29
|
+
export type LoadableApp<T extends ObjectType> = AppMetadata & {
|
|
30
|
+
props?: T;
|
|
31
|
+
} & ({
|
|
32
|
+
render: HTMLContentRender;
|
|
33
|
+
} | {
|
|
34
|
+
container: string | HTMLElement;
|
|
35
|
+
});
|
|
36
|
+
export type RegistrableApp<T extends ObjectType> = LoadableApp<T> & {
|
|
37
|
+
loader?: (loading: boolean) => void;
|
|
38
|
+
activeRule: RegisterApplicationConfig['activeWhen'];
|
|
39
|
+
};
|
|
40
|
+
export type PrefetchStrategy = boolean | 'all' | string[] | ((apps: AppMetadata[]) => {
|
|
41
|
+
criticalAppNames: string[];
|
|
42
|
+
minorAppsName: string[];
|
|
43
|
+
});
|
|
44
|
+
type QiankunSpecialOpts = {
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated internal api, don't used it as normal, might be removed after next version
|
|
47
|
+
*/
|
|
48
|
+
$$cacheLifecycleByAppName?: boolean;
|
|
49
|
+
prefetch?: PrefetchStrategy;
|
|
50
|
+
sandbox?: boolean | {
|
|
51
|
+
strictStyleIsolation?: boolean;
|
|
52
|
+
experimentalStyleIsolation?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated We use strict mode by default
|
|
55
|
+
*/
|
|
56
|
+
loose?: boolean;
|
|
57
|
+
patchers?: Patcher[];
|
|
58
|
+
};
|
|
59
|
+
singular?: boolean | ((app: LoadableApp<any>) => Promise<boolean>);
|
|
60
|
+
/**
|
|
61
|
+
* skip some scripts or links intercept, like JSONP
|
|
62
|
+
*/
|
|
63
|
+
excludeAssetFilter?: (url: string) => boolean;
|
|
64
|
+
transformStorage?: boolean;
|
|
65
|
+
globalContext?: typeof window;
|
|
66
|
+
};
|
|
67
|
+
export type FrameworkConfiguration = QiankunSpecialOpts & ImportEntryOpts & StartOpts;
|
|
68
|
+
export type LifeCycleFn<T extends ObjectType> = (app: LoadableApp<T>, global: typeof window) => Promise<any>;
|
|
69
|
+
export type FrameworkLifeCycles<T extends ObjectType> = {
|
|
70
|
+
beforeLoad?: LifeCycleFn<T> | Array<LifeCycleFn<T>>;
|
|
71
|
+
beforeMount?: LifeCycleFn<T> | Array<LifeCycleFn<T>>;
|
|
72
|
+
afterMount?: LifeCycleFn<T> | Array<LifeCycleFn<T>>;
|
|
73
|
+
beforeUnmount?: LifeCycleFn<T> | Array<LifeCycleFn<T>>;
|
|
74
|
+
afterUnmount?: LifeCycleFn<T> | Array<LifeCycleFn<T>>;
|
|
75
|
+
};
|
|
76
|
+
export type MicroApp = Parcel;
|
|
77
|
+
export type Rebuilder = () => void;
|
|
78
|
+
export type Freer = () => Rebuilder;
|
|
79
|
+
export type Patcher = () => Freer;
|
|
80
|
+
export declare enum SandBoxType {
|
|
81
|
+
Proxy = "Proxy",
|
|
82
|
+
Snapshot = "Snapshot",
|
|
83
|
+
LegacyProxy = "LegacyProxy"
|
|
84
|
+
}
|
|
85
|
+
export type SandBox = {
|
|
86
|
+
/** 沙箱的名字 */
|
|
87
|
+
name: string;
|
|
88
|
+
/** 沙箱的类型 */
|
|
89
|
+
type: SandBoxType;
|
|
90
|
+
/** 沙箱导出的代理实体 */
|
|
91
|
+
proxy: WindowProxy;
|
|
92
|
+
/** 沙箱是否在运行中 */
|
|
93
|
+
sandboxRunning: boolean;
|
|
94
|
+
/** latest set property */
|
|
95
|
+
latestSetProp?: PropertyKey | null;
|
|
96
|
+
/** 启动沙箱 */
|
|
97
|
+
active: () => void;
|
|
98
|
+
/** 关闭沙箱 */
|
|
99
|
+
inactive: () => void;
|
|
100
|
+
};
|
|
101
|
+
export type OnGlobalStateChangeCallback = (state: Record<string, any>, prevState: Record<string, any>) => void;
|
|
102
|
+
export type MicroAppStateActions = {
|
|
103
|
+
onGlobalStateChange: (callback: OnGlobalStateChangeCallback, fireImmediately?: boolean) => void;
|
|
104
|
+
setGlobalState: (state: Record<string, any>) => boolean;
|
|
105
|
+
offGlobalStateChange: () => boolean;
|
|
106
|
+
};
|
|
107
|
+
export {};
|
package/es/interfaces.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export var SandBoxType;
|
|
2
|
+
(function (SandBoxType) {
|
|
3
|
+
SandBoxType["Proxy"] = "Proxy";
|
|
4
|
+
SandBoxType["Snapshot"] = "Snapshot";
|
|
5
|
+
// for legacy sandbox
|
|
6
|
+
// https://github.com/umijs/qiankun/blob/0d1d3f0c5ed1642f01854f96c3fabf0a2148bd26/src/sandbox/legacy/sandbox.ts#L22...L25
|
|
7
|
+
SandBoxType["LegacyProxy"] = "LegacyProxy";
|
|
8
|
+
})(SandBoxType || (SandBoxType = {}));
|
package/es/loader.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Kuitos
|
|
3
|
+
* @since 2020-04-01
|
|
4
|
+
*/
|
|
5
|
+
import type { ParcelConfigObject } from 'single-spa';
|
|
6
|
+
import type { FrameworkConfiguration, FrameworkLifeCycles, LoadableApp, ObjectType } from './interfaces';
|
|
7
|
+
export type ParcelConfigObjectGetter = (remountContainer?: string | HTMLElement) => ParcelConfigObject;
|
|
8
|
+
export declare function loadApp<T extends ObjectType>(app: LoadableApp<T>, configuration?: FrameworkConfiguration, lifeCycles?: FrameworkLifeCycles<T>): Promise<ParcelConfigObjectGetter>;
|