Skip to content

Commit b6e058f

Browse files
authored
feat: add global insulation variable (#664)
* feat: add global insulation variable * chore: add merge logic
1 parent 95c6901 commit b6e058f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/core/src/config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,28 @@ export const getAppConfig = (
7272
return mergeResult;
7373
};
7474

75+
function getGlobalInsulationVariable() {
76+
return window['__GARFISH_INSULATION_VARIABLE__'] || [];
77+
}
78+
7579
export const generateAppOptions = (
7680
appName: string,
7781
garfish: interfaces.Garfish,
7882
options?: Partial<Omit<AppInfo, 'name'>>,
7983
): AppInfo => {
8084
let appInfo: AppInfo = garfish.appInfos[appName] || { name: appName };
85+
const insulationVariable = Array.from(
86+
new Set([
87+
...getGlobalInsulationVariable(),
88+
...(appInfo?.insulationVariable || []),
89+
]),
90+
);
8191

8292
// Merge register appInfo config and loadApp config
8393
appInfo = getAppConfig(garfish.options, {
8494
...appInfo,
8595
...options,
96+
insulationVariable,
8697
props: {
8798
...(appInfo.props || {}),
8899
...(options?.props || {}),

0 commit comments

Comments
 (0)