mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-13 20:36:34 +00:00
chore: add env format for vite config
This commit is contained in:
parent
1149044308
commit
cdb9445c5f
@ -1,9 +1,11 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig, type LibraryFormats } from 'vite';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
|
import { env } from 'node:process';
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
import { devDependencies, peerDependencies } from './package.json';
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
||||||
|
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
@ -11,7 +13,7 @@ export default defineConfig({
|
|||||||
// Could also be a dictionary or array of multiple entry points
|
// Could also be a dictionary or array of multiple entry points
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
||||||
name: 'LowCodeDesigner',
|
name: 'LowCodeDesigner',
|
||||||
formats: ['es', 'cjs'],
|
formats,
|
||||||
// the proper extensions will be added
|
// the proper extensions will be added
|
||||||
fileName: 'designer',
|
fileName: 'designer',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig, type LibraryFormats } from 'vite';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
|
import { env } from 'node:process';
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
import { devDependencies, peerDependencies } from './package.json';
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
||||||
|
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
@ -11,7 +13,7 @@ export default defineConfig({
|
|||||||
// Could also be a dictionary or array of multiple entry points
|
// Could also be a dictionary or array of multiple entry points
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
||||||
name: 'LowCodeEditorCore',
|
name: 'LowCodeEditorCore',
|
||||||
formats: ['es'],
|
formats,
|
||||||
// the proper extensions will be added
|
// the proper extensions will be added
|
||||||
fileName: 'editorCore',
|
fileName: 'editorCore',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -138,8 +138,7 @@ export class SettingsPrimaryPane extends Component<
|
|||||||
return (
|
return (
|
||||||
<div className="lc-settings-navigator">
|
<div className="lc-settings-navigator">
|
||||||
{createIcon(this.main.componentMeta?.icon, {
|
{createIcon(this.main.componentMeta?.icon, {
|
||||||
className: 'lc-settings-navigator-icon',
|
className: 'lc-settings-navigator-icon'
|
||||||
class: 'lc-settings-navigator-icon',
|
|
||||||
})}
|
})}
|
||||||
<Breadcrumb className="lc-settings-node-breadcrumb">{items}</Breadcrumb>
|
<Breadcrumb className="lc-settings-node-breadcrumb">{items}</Breadcrumb>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -161,13 +161,6 @@ export class PanelDock implements IWidget {
|
|||||||
showPanel() {
|
showPanel() {
|
||||||
this.panel?.setActive(true);
|
this.panel?.setActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
onActiveChange(func: () => any) {
|
|
||||||
return this.panel?.onActiveChange(func);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isPanelDock(obj: any): obj is PanelDock {
|
export function isPanelDock(obj: any): obj is PanelDock {
|
||||||
|
|||||||
@ -234,37 +234,6 @@ export class Panel implements IWidget {
|
|||||||
return isPanelDock(item) && item.panelName === this.name;
|
return isPanelDock(item) && item.panelName === this.name;
|
||||||
}) as any;
|
}) as any;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
getSupportedPositions() {
|
|
||||||
return ['default'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
getCurrentPosition() {
|
|
||||||
return 'default';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
setPosition(/* position: string */) {
|
|
||||||
// noop
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
onActiveChange(fn: (flag: boolean) => void): () => void {
|
|
||||||
this.emitter.on('activechange', fn);
|
|
||||||
return () => {
|
|
||||||
this.emitter.removeListener('activechange', fn);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isPanel(obj: any): obj is Panel {
|
export function isPanel(obj: any): obj is Panel {
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig, type LibraryFormats } from 'vite';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
|
import { env } from 'node:process'
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
import { devDependencies, peerDependencies } from './package.json';
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
||||||
|
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
@ -11,7 +13,7 @@ export default defineConfig({
|
|||||||
// Could also be a dictionary or array of multiple entry points
|
// Could also be a dictionary or array of multiple entry points
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
||||||
name: 'LowCodeEditorSkeleton',
|
name: 'LowCodeEditorSkeleton',
|
||||||
formats: ['es', 'cjs'],
|
formats,
|
||||||
// the proper extensions will be added
|
// the proper extensions will be added
|
||||||
fileName: 'editorSkeleton',
|
fileName: 'editorSkeleton',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -29,7 +29,6 @@
|
|||||||
"@alilc/lowcode-designer": "workspace:*",
|
"@alilc/lowcode-designer": "workspace:*",
|
||||||
"@alilc/lowcode-editor-core": "workspace:*",
|
"@alilc/lowcode-editor-core": "workspace:*",
|
||||||
"@alilc/lowcode-editor-skeleton": "workspace:*",
|
"@alilc/lowcode-editor-skeleton": "workspace:*",
|
||||||
"@alilc/lowcode-engine-ext": "^1.0.0",
|
|
||||||
"@alilc/lowcode-plugin-command": "workspace:*",
|
"@alilc/lowcode-plugin-command": "workspace:*",
|
||||||
"@alilc/lowcode-plugin-designer": "workspace:*",
|
"@alilc/lowcode-plugin-designer": "workspace:*",
|
||||||
"@alilc/lowcode-plugin-outline-pane": "workspace:*",
|
"@alilc/lowcode-plugin-outline-pane": "workspace:*",
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
/* eslint-disable max-len */
|
|
||||||
/* eslint-disable no-param-reassign */
|
|
||||||
import { createElement } from 'react';
|
import { createElement } from 'react';
|
||||||
import { render, unmountComponentAtNode } from 'react-dom';
|
import { createRoot, type Root } from 'react-dom/client';
|
||||||
import {
|
import {
|
||||||
globalContext,
|
globalContext,
|
||||||
Editor,
|
Editor,
|
||||||
@ -210,13 +208,14 @@ engineConfig.set('isOpenSource', isOpenSource);
|
|||||||
|
|
||||||
// container which will host LowCodeEngine DOM
|
// container which will host LowCodeEngine DOM
|
||||||
let engineContainer: HTMLElement;
|
let engineContainer: HTMLElement;
|
||||||
// @ts-ignore webpack Define variable
|
|
||||||
|
|
||||||
export { version }
|
export { version }
|
||||||
engineConfig.set('ENGINE_VERSION', version);
|
engineConfig.set('ENGINE_VERSION', version);
|
||||||
|
|
||||||
const pluginPromise = registryInnerPlugin(designer, editor, plugins);
|
const pluginPromise = registryInnerPlugin(designer, editor, plugins);
|
||||||
|
|
||||||
|
let root: Root | undefined;
|
||||||
|
|
||||||
export async function init(
|
export async function init(
|
||||||
container?: HTMLElement,
|
container?: HTMLElement,
|
||||||
options?: IPublicTypeEngineOptions,
|
options?: IPublicTypeEngineOptions,
|
||||||
@ -244,15 +243,19 @@ export async function init(
|
|||||||
if (options && options.enableWorkspaceMode) {
|
if (options && options.enableWorkspaceMode) {
|
||||||
const disposeFun = await pluginPromise;
|
const disposeFun = await pluginPromise;
|
||||||
disposeFun && disposeFun();
|
disposeFun && disposeFun();
|
||||||
render(
|
|
||||||
createElement(WorkSpaceWorkbench, {
|
if (!root) {
|
||||||
|
root = createRoot(
|
||||||
|
engineContainer,
|
||||||
|
);
|
||||||
|
root.render(createElement(WorkSpaceWorkbench, {
|
||||||
workspace: innerWorkspace,
|
workspace: innerWorkspace,
|
||||||
// skeleton: workspace.skeleton,
|
// skeleton: workspace.skeleton,
|
||||||
className: 'engine-main',
|
className: 'engine-main',
|
||||||
topAreaItemClassName: 'engine-actionitem',
|
topAreaItemClassName: 'engine-actionitem',
|
||||||
}),
|
}))
|
||||||
engineContainer,
|
}
|
||||||
);
|
|
||||||
innerWorkspace.enableAutoOpenFirstWindow = engineConfig.get('enableAutoOpenFirstWindow', true);
|
innerWorkspace.enableAutoOpenFirstWindow = engineConfig.get('enableAutoOpenFirstWindow', true);
|
||||||
innerWorkspace.setActive(true);
|
innerWorkspace.setActive(true);
|
||||||
innerWorkspace.initWindow();
|
innerWorkspace.initWindow();
|
||||||
@ -263,14 +266,14 @@ export async function init(
|
|||||||
|
|
||||||
await plugins.init(pluginPreference as any);
|
await plugins.init(pluginPreference as any);
|
||||||
|
|
||||||
render(
|
if (!root) {
|
||||||
createElement(Workbench, {
|
root = createRoot(engineContainer)
|
||||||
|
root.render(createElement(Workbench, {
|
||||||
skeleton: innerSkeleton,
|
skeleton: innerSkeleton,
|
||||||
className: 'engine-main',
|
className: 'engine-main',
|
||||||
topAreaItemClassName: 'engine-actionitem',
|
topAreaItemClassName: 'engine-actionitem',
|
||||||
}),
|
}))
|
||||||
engineContainer,
|
}
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function destroy() {
|
export async function destroy() {
|
||||||
@ -284,5 +287,5 @@ export async function destroy() {
|
|||||||
|
|
||||||
// unmount DOM container, this will trigger React componentWillUnmount lifeCycle,
|
// unmount DOM container, this will trigger React componentWillUnmount lifeCycle,
|
||||||
// so necessary cleanups will be done.
|
// so necessary cleanups will be done.
|
||||||
engineContainer && unmountComponentAtNode(engineContainer);
|
root && root.unmount();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,10 +6,11 @@ export const setterRegistry = (ctx: IPublicModelPluginContext) => {
|
|||||||
init() {
|
init() {
|
||||||
const { config } = ctx;
|
const { config } = ctx;
|
||||||
if (config.get('disableDefaultSetters')) return;
|
if (config.get('disableDefaultSetters')) return;
|
||||||
const builtinSetters = require('@alilc/lowcode-engine-ext')?.setters;
|
// todo: 互相依赖
|
||||||
if (builtinSetters) {
|
// const builtinSetters = require('@alilc/lowcode-engine-ext')?.setters;
|
||||||
ctx.setters.registerSetter(builtinSetters);
|
// if (builtinSetters) {
|
||||||
}
|
// ctx.setters.registerSetter(builtinSetters);
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig, LibraryFormats } from 'vite';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
|
import { env } from 'node:process';
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
import { devDependencies, peerDependencies } from './package.json';
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
||||||
|
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
@ -11,7 +13,7 @@ export default defineConfig({
|
|||||||
// Could also be a dictionary or array of multiple entry points
|
// Could also be a dictionary or array of multiple entry points
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
||||||
name: 'AliLowCodeEngine',
|
name: 'AliLowCodeEngine',
|
||||||
formats: ['es', 'cjs', 'iife'],
|
formats,
|
||||||
// the proper extensions will be added
|
// the proper extensions will be added
|
||||||
fileName: 'engine',
|
fileName: 'engine',
|
||||||
},
|
},
|
||||||
@ -22,6 +24,7 @@ export default defineConfig({
|
|||||||
globals: {
|
globals: {
|
||||||
react: 'React',
|
react: 'React',
|
||||||
'react-dom': 'ReactDOM',
|
'react-dom': 'ReactDOM',
|
||||||
|
'@alifd/next': 'Next'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig, LibraryFormats } from 'vite';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
|
import { env } from 'node:process';
|
||||||
|
|
||||||
|
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
@ -7,7 +10,7 @@ export default defineConfig({
|
|||||||
// Could also be a dictionary or array of multiple entry points
|
// Could also be a dictionary or array of multiple entry points
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
||||||
name: 'LowCodePluginCommand',
|
name: 'LowCodePluginCommand',
|
||||||
formats: ['es', 'cjs'],
|
formats,
|
||||||
// the proper extensions will be added
|
// the proper extensions will be added
|
||||||
fileName: 'plugin-command',
|
fileName: 'plugin-command',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig, LibraryFormats } from 'vite';
|
||||||
|
import { env } from 'node:process';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
import { devDependencies, peerDependencies } from './package.json';
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
||||||
|
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
@ -11,7 +13,7 @@ export default defineConfig({
|
|||||||
// Could also be a dictionary or array of multiple entry points
|
// Could also be a dictionary or array of multiple entry points
|
||||||
entry: resolve(import.meta.dirname, 'src/index.tsx'),
|
entry: resolve(import.meta.dirname, 'src/index.tsx'),
|
||||||
name: 'LowCodePluginDesigner',
|
name: 'LowCodePluginDesigner',
|
||||||
formats: ['es', 'cjs'],
|
formats,
|
||||||
// the proper extensions will be added
|
// the proper extensions will be added
|
||||||
fileName: 'plugin-designer',
|
fileName: 'plugin-designer',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig, LibraryFormats } from 'vite';
|
||||||
|
import { env } from 'node:process';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
import { devDependencies, peerDependencies } from './package.json';
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
||||||
|
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
@ -11,7 +13,7 @@ export default defineConfig({
|
|||||||
// Could also be a dictionary or array of multiple entry points
|
// Could also be a dictionary or array of multiple entry points
|
||||||
entry: resolve(import.meta.dirname, 'src/index.tsx'),
|
entry: resolve(import.meta.dirname, 'src/index.tsx'),
|
||||||
name: 'LowCodePluginOutlinePane',
|
name: 'LowCodePluginOutlinePane',
|
||||||
formats: ['es', 'cjs'],
|
formats,
|
||||||
// the proper extensions will be added
|
// the proper extensions will be added
|
||||||
fileName: 'plugin-outline-pane',
|
fileName: 'plugin-outline-pane',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig, LibraryFormats } from 'vite';
|
||||||
|
import { env } from 'node:process';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
import { devDependencies, peerDependencies } from './package.json';
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
||||||
|
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs', 'iife']) as LibraryFormats[];
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
@ -11,7 +13,7 @@ export default defineConfig({
|
|||||||
// Could also be a dictionary or array of multiple entry points
|
// Could also be a dictionary or array of multiple entry points
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
||||||
name: 'LowCodeReactRenderer',
|
name: 'LowCodeReactRenderer',
|
||||||
formats: ['es', 'cjs', 'iife'],
|
formats,
|
||||||
// the proper extensions will be added
|
// the proper extensions will be added
|
||||||
fileName: 'reactRenderer',
|
fileName: 'reactRenderer',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig, LibraryFormats } from 'vite';
|
||||||
|
import { env } from 'node:process';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
import { devDependencies, peerDependencies } from './package.json';
|
||||||
|
|
||||||
const externals = [...Object.keys(devDependencies), ...Object.keys(peerDependencies)];
|
const externals = [...Object.keys(devDependencies), ...Object.keys(peerDependencies)];
|
||||||
|
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs', 'iife']) as LibraryFormats[];
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
@ -11,7 +13,7 @@ export default defineConfig({
|
|||||||
// Could also be a dictionary or array of multiple entry points
|
// Could also be a dictionary or array of multiple entry points
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
||||||
name: 'LowCodeSimulatorReactRenderer',
|
name: 'LowCodeSimulatorReactRenderer',
|
||||||
formats: ['es', 'cjs', 'iife'],
|
formats,
|
||||||
// the proper extensions will be added
|
// the proper extensions will be added
|
||||||
fileName: 'SimulatorReactRenderer',
|
fileName: 'SimulatorReactRenderer',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,13 +1,16 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig, LibraryFormats } from 'vite';
|
||||||
|
import { env } from 'node:process';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
|
|
||||||
|
const formats = (env['FORMATS']?.split(',') ?? ['es']) as LibraryFormats[];
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
lib: {
|
lib: {
|
||||||
// Could also be a dictionary or array of multiple entry points
|
// Could also be a dictionary or array of multiple entry points
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
||||||
name: 'LowCodeRendererCore',
|
name: 'LowCodeRendererCore',
|
||||||
formats: ['es'],
|
formats,
|
||||||
// the proper extensions will be added
|
// the proper extensions will be added
|
||||||
fileName: 'rendererCore',
|
fileName: 'rendererCore',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig, LibraryFormats } from 'vite';
|
||||||
|
import { env } from 'node:process';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
import { devDependencies, peerDependencies } from './package.json';
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
||||||
|
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
@ -10,7 +12,7 @@ export default defineConfig({
|
|||||||
// Could also be a dictionary or array of multiple entry points
|
// Could also be a dictionary or array of multiple entry points
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
||||||
name: 'LowCodeRuntimeRouter',
|
name: 'LowCodeRuntimeRouter',
|
||||||
formats: ['es'],
|
formats,
|
||||||
// the proper extensions will be added
|
// the proper extensions will be added
|
||||||
fileName: 'runtimeRouter',
|
fileName: 'runtimeRouter',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig, LibraryFormats } from 'vite';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
|
import { env } from 'node:process';
|
||||||
|
|
||||||
|
const formats = (env['FORMATS']?.split(',') ?? ['es']) as LibraryFormats[];
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
@ -7,7 +10,7 @@ export default defineConfig({
|
|||||||
// Could also be a dictionary or array of multiple entry points
|
// Could also be a dictionary or array of multiple entry points
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
||||||
name: 'LowcodeTypes',
|
name: 'LowcodeTypes',
|
||||||
formats: ['es'],
|
formats,
|
||||||
// the proper extensions will be added
|
// the proper extensions will be added
|
||||||
fileName: 'lowcodeTypes',
|
fileName: 'lowcodeTypes',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -20,7 +20,7 @@ export function createIcon(
|
|||||||
if (URL_RE.test(icon)) {
|
if (URL_RE.test(icon)) {
|
||||||
return createElement('img', {
|
return createElement('img', {
|
||||||
src: icon,
|
src: icon,
|
||||||
class: props?.className,
|
className: props?.className,
|
||||||
...props,
|
...props,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ export function createIcon(
|
|||||||
}
|
}
|
||||||
if (isReactComponent(icon)) {
|
if (isReactComponent(icon)) {
|
||||||
return createElement(icon, {
|
return createElement(icon, {
|
||||||
class: props?.className,
|
className: props?.className,
|
||||||
...props,
|
...props,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,17 +1,18 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig, LibraryFormats } from 'vite';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
import dts from 'vite-plugin-dts';
|
import { env } from 'node:process';
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
import { devDependencies, peerDependencies } from './package.json';
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
||||||
|
const formats = (env['FORMATS']?.split(',') ?? ['es']) as LibraryFormats[];
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
lib: {
|
lib: {
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
||||||
name: 'LowCodeUtils',
|
name: 'LowCodeUtils',
|
||||||
formats: ['es'],
|
formats,
|
||||||
fileName: 'lowCodeUtils',
|
fileName: 'lowCodeUtils',
|
||||||
},
|
},
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
@ -20,13 +21,5 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
react(),
|
react(),
|
||||||
dts({
|
|
||||||
rollupTypes: true,
|
|
||||||
tsconfigPath: resolve(import.meta.dirname, 'tsconfig.declaration.json'),
|
|
||||||
compilerOptions: {
|
|
||||||
stripInternal: true,
|
|
||||||
paths: {},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|||||||
30
playground/engine/src/index.css
Normal file
30
playground/engine/src/index.css
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
body {
|
||||||
|
font-family: PingFangSC-Regular, Roboto, Helvetica Neue, Helvetica, Tahoma, Arial, PingFang SC-Light, Microsoft YaHei;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
body * {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body, #lce-container {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
top: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-webkit-user-drag: none;
|
||||||
|
-webkit-text-size-adjust: none;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
|
||||||
|
#engine {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
12
playground/engine/src/index.ts
Normal file
12
playground/engine/src/index.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { init } from '@alilc/lowcode-engine';
|
||||||
|
|
||||||
|
import './index.css';
|
||||||
|
|
||||||
|
init(document.getElementById('app')!, {
|
||||||
|
locale: 'zh-CN',
|
||||||
|
enableCondition: true,
|
||||||
|
enableCanvasLock: true,
|
||||||
|
// 默认绑定变量
|
||||||
|
supportVariableGlobally: true,
|
||||||
|
requestHandlersMap: {},
|
||||||
|
});
|
||||||
@ -2,7 +2,11 @@
|
|||||||
"name": "playground",
|
"name": "playground",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite"
|
"dev": "vite"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@alilc/lowcode-engine": "workspace:*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
playground/renderer/index.html
Normal file
12
playground/renderer/index.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="./src/index.ts"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -1,8 +1,6 @@
|
|||||||
{
|
{
|
||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"paths": {
|
"outDir": "dist",
|
||||||
"@alilc/renderer-react": ["runtime/renderer-react"]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
playground/vite.config.ts
Normal file
13
playground/vite.config.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import { resolve } from 'node:path'
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
build: {
|
||||||
|
rollupOptions: {
|
||||||
|
input: {
|
||||||
|
engine: resolve(import.meta.dirname, 'engine/index.html'),
|
||||||
|
renderer: resolve(import.meta.dirname, 'renderer/index.html')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user