diff --git a/packages/editor-preset-vision/package.json b/packages/editor-preset-vision/package.json index cff9295c0..e3bbea6ed 100644 --- a/packages/editor-preset-vision/package.json +++ b/packages/editor-preset-vision/package.json @@ -20,6 +20,7 @@ "@ali/lowcode-editor-skeleton": "^1.0.9-6", "@ali/lowcode-plugin-designer": "^1.0.9-6", "@ali/lowcode-plugin-outline-pane": "^1.0.9-6", + "@ali/lowcode-utils": "^1.0.9-7", "@ali/ve-i18n-util": "^2.0.0", "@ali/ve-icons": "^4.1.9", "@ali/ve-less-variables": "2.0.3", diff --git a/packages/editor-preset-vision/src/bundle/prototype.ts b/packages/editor-preset-vision/src/bundle/prototype.ts index b91554240..2c3f7b44c 100644 --- a/packages/editor-preset-vision/src/bundle/prototype.ts +++ b/packages/editor-preset-vision/src/bundle/prototype.ts @@ -16,6 +16,7 @@ import { upgradePropConfig, upgradeConfigure, } from './upgrade-metadata'; +import { accessLibrary } from '@ali/lowcode-utils'; import { designer } from '../editor'; @@ -166,15 +167,6 @@ export interface OldGlobalPropConfig extends OldPropConfig { const packageMaps: any = {}; -function accessLibrary(library: string | object) { - if (typeof library !== 'string') { - return library; - } - - // TODO: enhance logic - return (window as any)[library]; -} - export function setPackages(packages: Array<{ package: string; library: object | string }>) { packages.forEach((item) => { let lib: any; diff --git a/packages/utils/src/build-components.ts b/packages/utils/src/build-components.ts index fcf4d17c1..6cfda9514 100644 --- a/packages/utils/src/build-components.ts +++ b/packages/utils/src/build-components.ts @@ -9,7 +9,7 @@ interface LibraryMap { [key: string]: string; } -function accessLibrary(library: string | Record) { +export function accessLibrary(library: string | Record) { if (typeof library !== 'string') { return library; }