Skip to content

Commit

Permalink
Merge pull request antvis#343 from antvis/chore/fix-export-esm
Browse files Browse the repository at this point in the history
Chore/fix export esm
  • Loading branch information
pomelo-nwu authored Jun 12, 2023
2 parents d668294 + 4fd8896 commit d26dea5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
12 changes: 10 additions & 2 deletions packages/gi-site/src/hooks/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function beautifyCode(code: string) {
}

export const getActivePackage = (activeAssets: GIAssets) => {
const { services, components, elements, layouts } = activeAssets;
const { components, elements, layouts } = activeAssets;

const componentsMap = new Map<string, any>();
const elementsMap = new Map<string, any>();
Expand Down Expand Up @@ -108,7 +108,15 @@ export const getActivePackageName = (activeAssets: GIAssets): string[] => {
};

export const getConstantFiles = opts => {
const { config, id, engineId, activeAssets, theme = 'light', data, schemaData } = opts;
const { config, id, engineId, theme = 'light', data, schemaData } = opts;

const activeAssets = {
...opts.activeAssets,
services: opts.activeAssets.services.filter(item => {
return item.id === 'GI' || item.id === engineId;
}),
};

// const GI_SERVICES_OPTIONS = beautifyCode(JSON.stringify(serviceConfig));
const THEME_STYLE = Object.entries(ThemeVars[theme])
//@ts-ignore
Expand Down
15 changes: 11 additions & 4 deletions packages/gi-site/src/hooks/useNodeModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ function serialize(data: Record<string, any>) {
}

function getCSBData(opts) {
const { activeAssets, activeAssetsKeys, theme } = opts;
const { activeAssetsKeys, theme, engineId } = opts;
const activeAssets = {
...opts.activeAssets,
services: opts.activeAssets.services.filter(item => {
return item.id === 'GI' || item.id === engineId;
}),
};

const nodemodules = getActivePackage(activeAssets);

const ext = '.tsx';
Expand Down Expand Up @@ -55,7 +62,7 @@ function getCSBData(opts) {
return itemComponent.info.id;
})
.join(',');
console.log('umd', UMD);

return `const { ${componentIds} } = ${UMD}.components;`;
})
.join('\n');
Expand All @@ -70,7 +77,7 @@ function getCSBData(opts) {
return itemComponent.info.id;
})
.join(',');
console.log('umd', UMD);

return `const { ${componentIds} } = ${UMD}.elements;`;
})
.join('\n');
Expand All @@ -84,7 +91,7 @@ function getCSBData(opts) {
return itemComponent.info.id;
})
.join(',');
console.log('umd', UMD);

return `const { ${componentIds} } = ${UMD}.layouts;`;
})
.join('\n');
Expand Down

0 comments on commit d26dea5

Please sign in to comment.