From 753eaada75646b48a35567d103dbc47d13bbbaab Mon Sep 17 00:00:00 2001 From: Andrey Vlasov Date: Sun, 6 Dec 2020 19:49:08 +0300 Subject: [PATCH] add features --- src/main.ts | 4 ++-- src/virtual-module.ts | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main.ts b/src/main.ts index b3d71f3..57b879f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -33,8 +33,8 @@ const systemJSImport = async (requestUrl: string) => { // sections: { version: '1.0.0', name: 'sections' } // } -export default async ({ apps: rawApps, navigations, config }) => { - defineVirtualModule({ navigations, config }) +export default async ({ apps: rawApps, navigations, config, features }) => { + defineVirtualModule({ navigations, config, features }) const apps = new Apps(rawApps) diff --git a/src/virtual-module.ts b/src/virtual-module.ts index fe0dbd3..bfaa767 100644 --- a/src/virtual-module.ts +++ b/src/virtual-module.ts @@ -1,8 +1,10 @@ -const createVirtualModule = ({ config, navigations }) => ({ +const createVirtualModule = ({ config, navigations, features }) => ({ getConfig: () => config, - getConfigValue: (key) => config[key], + getConfigValue: (pkg: string) => config[pkg], getNavigations: () => navigations, - getNavigationsValue: (key) => navigations[key], + getNavigationsValue: (pkg: string) => navigations[pkg], + getAllFeatures: () => features, + getFeatures: (pkg: string) => features[pkg] }) export const defineVirtualModule = (params) => {