diff --git a/packages/react-renderer/src/runtime/createComponent.tsx b/packages/react-renderer/src/runtime/createComponent.tsx index 4f42edbff..6e9f430e4 100644 --- a/packages/react-renderer/src/runtime/createComponent.tsx +++ b/packages/react-renderer/src/runtime/createComponent.tsx @@ -116,7 +116,6 @@ export function createComponent( useEffect(() => { // trigger lifeCycles - // componentDidMount?.(); model.triggerLifeCycle('componentDidMount'); // 当 state 改变之后调用 diff --git a/packages/react-renderer/src/runtime/elements.tsx b/packages/react-renderer/src/runtime/elements.tsx index 3bafc53e9..98c21fd78 100644 --- a/packages/react-renderer/src/runtime/elements.tsx +++ b/packages/react-renderer/src/runtime/elements.tsx @@ -142,8 +142,7 @@ export function WidgetComponent(props: WidgetRendererProps) { }, ); - if (process.env.NODE_ENV === 'development') { - // development 模式下 把 widget 的内容作为 prop ,便于排查问题 + if (__DEV__) { processedProps.widget = widget; } diff --git a/packages/renderer-core/src/services/code-runtime/codeRuntime.ts b/packages/renderer-core/src/code-runtime/codeRuntime.ts similarity index 97% rename from packages/renderer-core/src/services/code-runtime/codeRuntime.ts rename to packages/renderer-core/src/code-runtime/codeRuntime.ts index 12c75581b..805b26506 100644 --- a/packages/renderer-core/src/services/code-runtime/codeRuntime.ts +++ b/packages/renderer-core/src/code-runtime/codeRuntime.ts @@ -53,7 +53,7 @@ export class CodeRuntime super(); if (options.evalCodeFunction) this._evalCodeFunction = options.evalCodeFunction; - this._codeScope = this.addDispose( + this._codeScope = this._addDispose( options.parentScope ? options.parentScope.createChild(options.initScopeValue ?? {}) : new CodeScope(options.initScopeValue ?? {}), @@ -122,7 +122,7 @@ export class CodeRuntime onResolve(handler: NodeResolverHandler): IDisposable { this._resolveHandlers.push(handler); - return this.addDispose( + return this._addDispose( toDisposable(() => { this._resolveHandlers = this._resolveHandlers.filter((h) => h !== handler); }), @@ -132,7 +132,7 @@ export class CodeRuntime createChild( options?: Omit, 'parentScope'>, ): ICodeRuntime { - return this.addDispose( + return this._addDispose( new CodeRuntime({ initScopeValue: options?.initScopeValue, parentScope: this._codeScope, diff --git a/packages/renderer-core/src/services/code-runtime/codeRuntimeService.ts b/packages/renderer-core/src/code-runtime/codeRuntimeService.ts similarity index 91% rename from packages/renderer-core/src/services/code-runtime/codeRuntimeService.ts rename to packages/renderer-core/src/code-runtime/codeRuntimeService.ts index d329638e8..ab63e0aa0 100644 --- a/packages/renderer-core/src/services/code-runtime/codeRuntimeService.ts +++ b/packages/renderer-core/src/code-runtime/codeRuntimeService.ts @@ -29,8 +29,8 @@ export class CodeRuntimeService extends Disposable implements ICodeRuntimeServic ) { super(); - this._rootRuntime = this.addDispose(new CodeRuntime(options)); - this.addDispose( + this._rootRuntime = this._addDispose(new CodeRuntime(options)); + this._addDispose( this.schemaService.onSchemaUpdate(({ key, data }) => { if (key === 'constants') { this.rootRuntime.getScope().set('constants', data); @@ -44,7 +44,7 @@ export class CodeRuntimeService extends Disposable implements ICodeRuntimeServic ): ICodeRuntime { this._throwIfDisposed(); - return this.addDispose( + return this._addDispose( options.parentScope ? new CodeRuntime(options) : this.rootRuntime.createChild(options), ); } diff --git a/packages/renderer-core/src/services/code-runtime/codeScope.ts b/packages/renderer-core/src/code-runtime/codeScope.ts similarity index 97% rename from packages/renderer-core/src/services/code-runtime/codeScope.ts rename to packages/renderer-core/src/code-runtime/codeScope.ts index 86537ace9..077b16a0a 100644 --- a/packages/renderer-core/src/services/code-runtime/codeScope.ts +++ b/packages/renderer-core/src/code-runtime/codeScope.ts @@ -66,7 +66,7 @@ export class CodeScope } createChild(initValue: Partial): ICodeScope { - const childScope = this.addDispose(new CodeScope(initValue)); + const childScope = this._addDispose(new CodeScope(initValue)); childScope.node.prev = this.node; return childScope; diff --git a/packages/renderer-core/src/services/code-runtime/evaluate.ts b/packages/renderer-core/src/code-runtime/evaluate.ts similarity index 100% rename from packages/renderer-core/src/services/code-runtime/evaluate.ts rename to packages/renderer-core/src/code-runtime/evaluate.ts diff --git a/packages/renderer-core/src/services/code-runtime/globals-es2015.ts b/packages/renderer-core/src/code-runtime/globals-es2015.ts similarity index 100% rename from packages/renderer-core/src/services/code-runtime/globals-es2015.ts rename to packages/renderer-core/src/code-runtime/globals-es2015.ts diff --git a/packages/renderer-core/src/services/code-runtime/index.ts b/packages/renderer-core/src/code-runtime/index.ts similarity index 100% rename from packages/renderer-core/src/services/code-runtime/index.ts rename to packages/renderer-core/src/code-runtime/index.ts diff --git a/packages/renderer-core/src/services/code-runtime/value.ts b/packages/renderer-core/src/code-runtime/value.ts similarity index 100% rename from packages/renderer-core/src/services/code-runtime/value.ts rename to packages/renderer-core/src/code-runtime/value.ts diff --git a/packages/renderer-core/src/createRenderer.ts b/packages/renderer-core/src/createRenderer.ts index 18d344f6f..5b9fb13aa 100644 --- a/packages/renderer-core/src/createRenderer.ts +++ b/packages/renderer-core/src/createRenderer.ts @@ -1,71 +1,98 @@ -import { invariant, InstantiationService } from '@alilc/lowcode-shared'; -import type { AppOptions, RendererApplication } from './types'; -import { CodeRuntimeService, ICodeRuntimeService } from './services/code-runtime'; +import { + invariant, + InstantiationService, + BeanContainer, + CtorDescriptor, + type Project, + type Package, +} from '@alilc/lowcode-shared'; +import { CodeRuntimeService, ICodeRuntimeService, type CodeRuntimeOptions } from './code-runtime'; import { IExtensionHostService, type RenderAdapter, type IRenderObject, ExtensionHostService, -} from './services/extension'; -import { IPackageManagementService, PackageManagementService } from './services/package'; -import { ISchemaService, SchemaService } from './services/schema'; -import { ILifeCycleService, LifecyclePhase, LifeCycleService } from './services/lifeCycleService'; -import { IRuntimeIntlService, RuntimeIntlService } from './services/runtimeIntlService'; -import { IRuntimeUtilService, RuntimeUtilService } from './services/runtimeUtilService'; + type Plugin, +} from './extension'; +import { IPackageManagementService, PackageManagementService } from './package'; +import { ISchemaService, SchemaService } from './schema'; +import { ILifeCycleService, LifecyclePhase, LifeCycleService } from './life-cycle'; +import { IRuntimeIntlService, RuntimeIntlService } from './intl'; +import { IRuntimeUtilService, RuntimeUtilService } from './util'; +import { type ModelDataSourceCreator } from './model'; + +export interface AppOptions { + schema: Project; + packages?: Package[]; + plugins?: Plugin[]; + /** + * code runtime 设置选项 + */ + codeRuntime?: CodeRuntimeOptions; + /** + * 数据源创建工厂函数 + */ + dataSourceCreator?: ModelDataSourceCreator; +} + +export type RendererApplication = { + readonly mode: 'development' | 'production'; + + readonly schema: Omit; + + readonly packageManager: IPackageManagementService; + + use(plugin: Plugin): Promise; + + destroy(): void; +} & Render; export function createRenderer( renderAdapter: RenderAdapter, ): (options: AppOptions) => Promise> { invariant(typeof renderAdapter === 'function', 'The first parameter must be a function.'); - const instantiationService = new InstantiationService(); - - // create services - const lifeCycleService = new LifeCycleService(); - instantiationService.container.set(ILifeCycleService, lifeCycleService); - return async (options) => { + // create services + const container = new BeanContainer(); + const lifeCycleService = new LifeCycleService(); + container.set(ILifeCycleService, lifeCycleService); + const schemaService = new SchemaService(options.schema); - instantiationService.container.set(ISchemaService, schemaService); + container.set(ISchemaService, schemaService); - const codeRuntimeService = instantiationService.createInstance( - CodeRuntimeService, - options.codeRuntime, + container.set( + ICodeRuntimeService, + new CtorDescriptor(CodeRuntimeService, [options.codeRuntime]), ); - instantiationService.container.set(ICodeRuntimeService, codeRuntimeService); - - const packageManagementService = instantiationService.createInstance(PackageManagementService); - instantiationService.container.set(IPackageManagementService, packageManagementService); + container.set(IPackageManagementService, new CtorDescriptor(PackageManagementService)); const utils = schemaService.get('utils'); - const runtimeUtilService = instantiationService.createInstance(RuntimeUtilService, utils); - instantiationService.container.set(IRuntimeUtilService, runtimeUtilService); + container.set(IRuntimeUtilService, new CtorDescriptor(RuntimeUtilService, [utils])); const defaultLocale = schemaService.get('config.defaultLocale'); const i18ns = schemaService.get('i18n', {}); - const runtimeIntlService = instantiationService.createInstance( - RuntimeIntlService, - defaultLocale, - i18ns, - ); - instantiationService.container.set(IRuntimeIntlService, runtimeIntlService); - - const extensionHostService = new ExtensionHostService( - lifeCycleService, - packageManagementService, - schemaService, - codeRuntimeService, - runtimeIntlService, - runtimeUtilService, + container.set( + IRuntimeIntlService, + new CtorDescriptor(RuntimeIntlService, [defaultLocale, i18ns]), ); - instantiationService.container.set(IExtensionHostService, extensionHostService); + + container.set(IExtensionHostService, new CtorDescriptor(ExtensionHostService)); + + const instantiationService = new InstantiationService(container); lifeCycleService.setPhase(LifecyclePhase.OptionsResolved); + const [extensionHostService, packageManagementService] = instantiationService.invokeFunction( + (accessor) => { + return [accessor.get(IExtensionHostService), accessor.get(IPackageManagementService)]; + }, + ); + const renderObject = await renderAdapter(instantiationService); await extensionHostService.registerPlugin(options.plugins ?? []); - // 先加载插件提供 package loader + await packageManagementService.loadPackages(options.packages ?? []); lifeCycleService.setPhase(LifecyclePhase.Ready); diff --git a/packages/renderer-core/src/services/extension/boosts.ts b/packages/renderer-core/src/extension/boosts.ts similarity index 95% rename from packages/renderer-core/src/services/extension/boosts.ts rename to packages/renderer-core/src/extension/boosts.ts index d13079d33..ddc2eeb3d 100644 --- a/packages/renderer-core/src/services/extension/boosts.ts +++ b/packages/renderer-core/src/extension/boosts.ts @@ -1,8 +1,8 @@ import { type StringDictionary } from '@alilc/lowcode-shared'; import { isObject } from 'lodash-es'; import { ICodeRuntime, ICodeRuntimeService } from '../code-runtime'; -import { IRuntimeUtilService } from '../runtimeUtilService'; -import { IRuntimeIntlService } from '../runtimeIntlService'; +import { IRuntimeUtilService } from '../util/utilService'; +import { IRuntimeIntlService } from '../intlService'; export type IBoosts = IBoostsApi & Extends & { [key: string]: any }; diff --git a/packages/renderer-core/src/services/extension/extensionHostService.ts b/packages/renderer-core/src/extension/extensionHostService.ts similarity index 83% rename from packages/renderer-core/src/services/extension/extensionHostService.ts rename to packages/renderer-core/src/extension/extensionHostService.ts index 5533770c3..c207424fb 100644 --- a/packages/renderer-core/src/services/extension/extensionHostService.ts +++ b/packages/renderer-core/src/extension/extensionHostService.ts @@ -3,10 +3,10 @@ import { type Plugin, type PluginContext } from './plugin'; import { BoostsManager } from './boosts'; import { IPackageManagementService } from '../package'; import { ISchemaService } from '../schema'; -import { ILifeCycleService } from '../lifeCycleService'; +import { ILifeCycleService } from '../life-cycle/lifeCycleService'; import { ICodeRuntimeService } from '../code-runtime'; -import { IRuntimeIntlService } from '../runtimeIntlService'; -import { IRuntimeUtilService } from '../runtimeUtilService'; +import { IRuntimeIntlService } from '../intl'; +import { IRuntimeUtilService } from '../util'; export interface IExtensionHostService { readonly boostsManager: BoostsManager; @@ -28,12 +28,12 @@ export class ExtensionHostService extends Disposable implements IExtensionHostSe private _pluginSetupContext: PluginContext; constructor( - lifeCycleService: ILifeCycleService, - packageManagementService: IPackageManagementService, - schemaService: ISchemaService, - codeRuntimeService: ICodeRuntimeService, - runtimeIntlService: IRuntimeIntlService, - runtimeUtilService: IRuntimeUtilService, + @ILifeCycleService lifeCycleService: ILifeCycleService, + @IPackageManagementService packageManagementService: IPackageManagementService, + @ISchemaService schemaService: ISchemaService, + @ICodeRuntimeService codeRuntimeService: ICodeRuntimeService, + @IRuntimeIntlService runtimeIntlService: IRuntimeIntlService, + @IRuntimeUtilService runtimeUtilService: IRuntimeUtilService, ) { super(); @@ -103,7 +103,7 @@ export class ExtensionHostService extends Disposable implements IExtensionHostSe await plugin.setup(this._pluginSetupContext); this._activePlugins.add(plugin.name); - this.addDispose(plugin); + this._addDispose(plugin); } getPlugin(name: string): Plugin | undefined { diff --git a/packages/renderer-core/src/services/extension/index.ts b/packages/renderer-core/src/extension/index.ts similarity index 100% rename from packages/renderer-core/src/services/extension/index.ts rename to packages/renderer-core/src/extension/index.ts diff --git a/packages/renderer-core/src/services/extension/plugin.ts b/packages/renderer-core/src/extension/plugin.ts similarity index 93% rename from packages/renderer-core/src/services/extension/plugin.ts rename to packages/renderer-core/src/extension/plugin.ts index 3e94310d5..863fa6fa3 100644 --- a/packages/renderer-core/src/services/extension/plugin.ts +++ b/packages/renderer-core/src/extension/plugin.ts @@ -1,6 +1,6 @@ import { type StringDictionary, type IDisposable } from '@alilc/lowcode-shared'; import { type IBoosts } from './boosts'; -import { ILifeCycleService } from '../lifeCycleService'; +import { ILifeCycleService } from '../life-cycle/lifeCycleService'; import { type ISchemaService } from '../schema'; import { type IPackageManagementService } from '../package'; import { type IStore } from '../../utils/store'; diff --git a/packages/renderer-core/src/services/extension/render.ts b/packages/renderer-core/src/extension/render.ts similarity index 100% rename from packages/renderer-core/src/services/extension/render.ts rename to packages/renderer-core/src/extension/render.ts diff --git a/packages/renderer-core/src/index.ts b/packages/renderer-core/src/index.ts index 58b9135c4..cad42f4e9 100644 --- a/packages/renderer-core/src/index.ts +++ b/packages/renderer-core/src/index.ts @@ -1,21 +1,20 @@ /* --------------- api -------------------- */ -export { createRenderer } from './createRenderer'; -export { IExtensionHostService } from './services/extension'; -export { definePackageLoader, IPackageManagementService } from './services/package'; -export { LifecyclePhase, ILifeCycleService } from './services/lifeCycleService'; -export { IComponentTreeModelService } from './services/model'; -export { ICodeRuntimeService } from './services/code-runtime'; -export { IRuntimeIntlService } from './services/runtimeIntlService'; -export { IRuntimeUtilService } from './services/runtimeUtilService'; -export { ISchemaService } from './services/schema'; +export * from './createRenderer'; +export { IExtensionHostService } from './extension'; +export { definePackageLoader, IPackageManagementService } from './package'; +export { LifecyclePhase, ILifeCycleService } from './life-cycle'; +export { IComponentTreeModelService } from './model'; +export { ICodeRuntimeService, mapValue, someValue } from './code-runtime'; +export { IRuntimeIntlService } from './intl'; +export { IRuntimeUtilService } from './util'; +export { ISchemaService } from './schema'; export { Widget } from './widget'; /* --------------- types ---------------- */ -export type * from './types'; -export type * from './services/extension'; -export type * from './services/code-runtime'; -export type * from './services/model'; -export type * from './services/package'; -export type * from './services/schema'; -export type * from './services/extension'; +export type * from './extension'; +export type * from './code-runtime'; +export type * from './model'; +export type * from './package'; +export type * from './schema'; +export type * from './extension'; export type * from './widget'; diff --git a/packages/renderer-core/src/intl/index.ts b/packages/renderer-core/src/intl/index.ts new file mode 100644 index 000000000..725ac0533 --- /dev/null +++ b/packages/renderer-core/src/intl/index.ts @@ -0,0 +1 @@ +export * from './intlService'; diff --git a/packages/renderer-core/src/services/runtimeIntlService.ts b/packages/renderer-core/src/intl/intlService.ts similarity index 94% rename from packages/renderer-core/src/services/runtimeIntlService.ts rename to packages/renderer-core/src/intl/intlService.ts index 205a45e9f..8c0ad7cd6 100644 --- a/packages/renderer-core/src/services/runtimeIntlService.ts +++ b/packages/renderer-core/src/intl/intlService.ts @@ -7,7 +7,7 @@ import { type LocaleTranslationsMap, Disposable, } from '@alilc/lowcode-shared'; -import { ICodeRuntimeService } from './code-runtime'; +import { ICodeRuntimeService } from '../code-runtime'; export interface MessageDescriptor { key: string; @@ -37,7 +37,7 @@ export class RuntimeIntlService extends Disposable implements IRuntimeIntlServic ) { super(); - this._intl = this.addDispose(new Intl(defaultLocale)); + this._intl = this._addDispose(new Intl(defaultLocale)); for (const key of Object.keys(i18nTranslations)) { this._intl.addTranslations(key, i18nTranslations[key]); } diff --git a/packages/renderer-core/src/life-cycle/index.ts b/packages/renderer-core/src/life-cycle/index.ts new file mode 100644 index 000000000..c3ec2d63e --- /dev/null +++ b/packages/renderer-core/src/life-cycle/index.ts @@ -0,0 +1 @@ +export * from './lifeCycleService'; diff --git a/packages/renderer-core/src/services/lifeCycleService.ts b/packages/renderer-core/src/life-cycle/lifeCycleService.ts similarity index 100% rename from packages/renderer-core/src/services/lifeCycleService.ts rename to packages/renderer-core/src/life-cycle/lifeCycleService.ts diff --git a/packages/renderer-core/src/services/model/componentTreeModel.ts b/packages/renderer-core/src/model/componentTreeModel.ts similarity index 97% rename from packages/renderer-core/src/services/model/componentTreeModel.ts rename to packages/renderer-core/src/model/componentTreeModel.ts index 89ff757b6..951fdd662 100644 --- a/packages/renderer-core/src/services/model/componentTreeModel.ts +++ b/packages/renderer-core/src/model/componentTreeModel.ts @@ -15,7 +15,7 @@ import { Disposable, } from '@alilc/lowcode-shared'; import { type ICodeRuntime } from '../code-runtime'; -import { IWidget, Widget } from '../../widget'; +import { IWidget, Widget } from '../widget'; export interface NormalizedComponentNode extends ComponentNode { loopArgs: [string, string]; @@ -25,7 +25,7 @@ export interface NormalizedComponentNode extends ComponentNode { /** * 根据低代码搭建协议的容器组件描述生成的容器模型 */ -export interface IComponentTreeModel { +export interface IComponentTreeModel extends IDisposable { readonly id: string; readonly codeRuntime: ICodeRuntime; @@ -61,7 +61,7 @@ export type ModelDataSourceCreator = ( codeRuntime: ICodeRuntime, ) => InstanceDataSourceApi; -export interface ComponentTreeModelOptions extends IDisposable { +export interface ComponentTreeModelOptions { id?: string; metadata?: StringDictionary; @@ -91,7 +91,7 @@ export class ComponentTreeModel this._id = options?.id ?? `model_${uniqueId()}`; this._metadata = options?.metadata ?? {}; this.initialize(options); - this.addDispose(_codeRuntime); + this._addDispose(_codeRuntime); } get id() { diff --git a/packages/renderer-core/src/services/model/componentTreeModelService.ts b/packages/renderer-core/src/model/componentTreeModelService.ts similarity index 98% rename from packages/renderer-core/src/services/model/componentTreeModelService.ts rename to packages/renderer-core/src/model/componentTreeModelService.ts index cd09a7898..90b7048c3 100644 --- a/packages/renderer-core/src/services/model/componentTreeModelService.ts +++ b/packages/renderer-core/src/model/componentTreeModelService.ts @@ -48,7 +48,7 @@ export class ComponentTreeModelService extends Disposable implements IComponentT ): IComponentTreeModel { this._throwIfDisposed(`ComponentTreeModelService has been disposed.`); - return this.addDispose( + return this._addDispose( new ComponentTreeModel( componentsTree, this.codeRuntimeService.createCodeRuntime({ diff --git a/packages/renderer-core/src/services/model/index.ts b/packages/renderer-core/src/model/index.ts similarity index 100% rename from packages/renderer-core/src/services/model/index.ts rename to packages/renderer-core/src/model/index.ts diff --git a/packages/renderer-core/src/services/package/index.ts b/packages/renderer-core/src/package/index.ts similarity index 100% rename from packages/renderer-core/src/services/package/index.ts rename to packages/renderer-core/src/package/index.ts diff --git a/packages/renderer-core/src/services/package/managementService.ts b/packages/renderer-core/src/package/managementService.ts similarity index 99% rename from packages/renderer-core/src/services/package/managementService.ts rename to packages/renderer-core/src/package/managementService.ts index 3f66b7f9c..e269279ab 100644 --- a/packages/renderer-core/src/services/package/managementService.ts +++ b/packages/renderer-core/src/package/managementService.ts @@ -63,7 +63,7 @@ export class PackageManagementService extends Disposable implements IPackageMana constructor(@ISchemaService private schemaService: ISchemaService) { super(); - this.addDispose( + this._addDispose( this.schemaService.onSchemaUpdate(({ key, previous, data }) => { if (key === 'componentsMap') { // todo: add remove ... diff --git a/packages/renderer-core/src/services/package/package.ts b/packages/renderer-core/src/package/package.ts similarity index 100% rename from packages/renderer-core/src/services/package/package.ts rename to packages/renderer-core/src/package/package.ts diff --git a/packages/renderer-core/src/services/schema/index.ts b/packages/renderer-core/src/schema/index.ts similarity index 100% rename from packages/renderer-core/src/services/schema/index.ts rename to packages/renderer-core/src/schema/index.ts diff --git a/packages/renderer-core/src/services/schema/schemaService.ts b/packages/renderer-core/src/schema/schemaService.ts similarity index 95% rename from packages/renderer-core/src/services/schema/schemaService.ts rename to packages/renderer-core/src/schema/schemaService.ts index b736ea989..e3bd5046a 100644 --- a/packages/renderer-core/src/services/schema/schemaService.ts +++ b/packages/renderer-core/src/schema/schemaService.ts @@ -22,7 +22,7 @@ export const ISchemaService = createDecorator('schemaService'); export class SchemaService extends Disposable implements ISchemaService { private store: NormalizedSchema; - private _observer = this.addDispose(new Events.Emitter()); + private _observer = this._addDispose(new Events.Emitter()); readonly onSchemaUpdate = this._observer.event; diff --git a/packages/renderer-core/src/services/schema/validation.ts b/packages/renderer-core/src/schema/validation.ts similarity index 100% rename from packages/renderer-core/src/services/schema/validation.ts rename to packages/renderer-core/src/schema/validation.ts diff --git a/packages/renderer-core/src/types.ts b/packages/renderer-core/src/types.ts deleted file mode 100644 index a2e00b598..000000000 --- a/packages/renderer-core/src/types.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { type Project, type Package } from '@alilc/lowcode-shared'; -import { type Plugin } from './services/extension'; -import { type ISchemaService } from './services/schema'; -import { type IPackageManagementService } from './services/package'; -import { type CodeRuntimeOptions } from './services/code-runtime'; -import { type ModelDataSourceCreator } from './services/model'; - -export interface AppOptions { - schema: Project; - packages?: Package[]; - plugins?: Plugin[]; - /** - * code runtime 设置选项 - */ - codeRuntime?: CodeRuntimeOptions; - /** - * 数据源创建工厂函数 - */ - dataSourceCreator?: ModelDataSourceCreator; -} - -export type RendererApplication = { - readonly mode: 'development' | 'production'; - - readonly schema: Omit; - - readonly packageManager: IPackageManagementService; - - use(plugin: Plugin): Promise; - - destroy(): void; -} & Render; diff --git a/packages/renderer-core/src/util/index.ts b/packages/renderer-core/src/util/index.ts new file mode 100644 index 000000000..b9d407dd3 --- /dev/null +++ b/packages/renderer-core/src/util/index.ts @@ -0,0 +1 @@ +export * from './utilService'; diff --git a/packages/renderer-core/src/services/runtimeUtilService.ts b/packages/renderer-core/src/util/utilService.ts similarity index 96% rename from packages/renderer-core/src/services/runtimeUtilService.ts rename to packages/renderer-core/src/util/utilService.ts index 9d8d2c88c..58ba3858d 100644 --- a/packages/renderer-core/src/services/runtimeUtilService.ts +++ b/packages/renderer-core/src/util/utilService.ts @@ -5,8 +5,8 @@ import { type StringDictionary, } from '@alilc/lowcode-shared'; import { isPlainObject } from 'lodash-es'; -import { IPackageManagementService } from './package'; -import { ICodeRuntimeService } from './code-runtime'; +import { IPackageManagementService } from '../package'; +import { ICodeRuntimeService } from '../code-runtime'; export interface IRuntimeUtilService { add(utilItem: UtilDescription, force?: boolean): void;