mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 03:01:16 +00:00
chore: change build config
This commit is contained in:
parent
cbf57e367e
commit
6b8d0c13bc
@ -3,13 +3,13 @@
|
|||||||
"version": "2.0.0-beta.0",
|
"version": "2.0.0-beta.0",
|
||||||
"description": "Designer for Ali LowCode Engine",
|
"description": "Designer for Ali LowCode Engine",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/designer.cjs",
|
"main": "dist/low-code-designer.cjs",
|
||||||
"module": "dist/designer.js",
|
"module": "dist/low-code-designer.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/designer.js",
|
"import": "./dist/low-code-designer.js",
|
||||||
"require": "./dist/designer.cjs",
|
"require": "./dist/low-code-designer.cjs",
|
||||||
"types": "./dist/index.d.ts"
|
"types": "./dist/index.d.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,25 +1,8 @@
|
|||||||
import { defineConfig, type LibraryFormats } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import { resolve } from 'node:path';
|
import baseConfigFn from '../../vite.base.config'
|
||||||
import { env } from 'node:process';
|
|
||||||
import react from '@vitejs/plugin-react';
|
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
export default defineConfig(async () => {
|
||||||
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
return baseConfigFn({
|
||||||
|
name: 'LowCodeDesigner',
|
||||||
export default defineConfig({
|
})
|
||||||
build: {
|
|
||||||
lib: {
|
|
||||||
// Could also be a dictionary or array of multiple entry points
|
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
|
||||||
name: 'LowCodeDesigner',
|
|
||||||
formats,
|
|
||||||
// the proper extensions will be added
|
|
||||||
fileName: 'designer',
|
|
||||||
},
|
|
||||||
rollupOptions: {
|
|
||||||
external: externals,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [react()],
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -4,12 +4,12 @@
|
|||||||
"description": "Core Api for Ali lowCode engine",
|
"description": "Core Api for Ali lowCode engine",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/editorCore.js",
|
"main": "dist/low-code-editor-core.js",
|
||||||
"module": "dist/editorCore.js",
|
"module": "dist/low-code-editor-core.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/editorCore.js",
|
"import": "./dist/low-code-editor-core.js",
|
||||||
"types": "./dist/index.d.ts"
|
"types": "./dist/index.d.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,25 +1,8 @@
|
|||||||
import { defineConfig, type LibraryFormats } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import { resolve } from 'node:path';
|
import baseConfigFn from '../../vite.base.config'
|
||||||
import { env } from 'node:process';
|
|
||||||
import react from '@vitejs/plugin-react';
|
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
export default defineConfig(async () => {
|
||||||
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
return baseConfigFn({
|
||||||
|
name: 'LowCodeEditorCore',
|
||||||
export default defineConfig({
|
})
|
||||||
build: {
|
|
||||||
lib: {
|
|
||||||
// Could also be a dictionary or array of multiple entry points
|
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
|
||||||
name: 'LowCodeEditorCore',
|
|
||||||
formats,
|
|
||||||
// the proper extensions will be added
|
|
||||||
fileName: 'editorCore',
|
|
||||||
},
|
|
||||||
rollupOptions: {
|
|
||||||
external: externals,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [react()],
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,13 +3,13 @@
|
|||||||
"version": "2.0.0-beta.0",
|
"version": "2.0.0-beta.0",
|
||||||
"description": "alibaba lowcode editor skeleton",
|
"description": "alibaba lowcode editor skeleton",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/editorSkeleton.cjs",
|
"main": "dist/low-code-editor-skeleton.cjs",
|
||||||
"module": "dist/editorSkeleton.js",
|
"module": "dist/low-code-editor-skeleton.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/editorSkeleton.js",
|
"import": "./dist/low-code-editor-skeleton.js",
|
||||||
"require": "./dist/editorSkeleton.cjs",
|
"require": "./dist/low-code-editor-skeleton.cjs",
|
||||||
"types": "./dist/index.d.ts"
|
"types": "./dist/index.d.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,25 +1,9 @@
|
|||||||
import { defineConfig, type LibraryFormats } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import { resolve } from 'node:path';
|
import baseConfigFn from '../../vite.base.config'
|
||||||
import { env } from 'node:process'
|
|
||||||
import react from '@vitejs/plugin-react';
|
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
export default defineConfig(async () => {
|
||||||
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
return baseConfigFn({
|
||||||
|
name: 'LowCodeEditorSkeleton',
|
||||||
export default defineConfig({
|
defaultFormats: ['es', 'cjs']
|
||||||
build: {
|
})
|
||||||
lib: {
|
|
||||||
// Could also be a dictionary or array of multiple entry points
|
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
|
||||||
name: 'LowCodeEditorSkeleton',
|
|
||||||
formats,
|
|
||||||
// the proper extensions will be added
|
|
||||||
fileName: 'editorSkeleton',
|
|
||||||
},
|
|
||||||
rollupOptions: {
|
|
||||||
external: externals,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [react()],
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,13 +3,13 @@
|
|||||||
"version": "2.0.0-beta.0",
|
"version": "2.0.0-beta.0",
|
||||||
"description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系",
|
"description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/engine.js",
|
"main": "dist/ali-low-code-engine.js",
|
||||||
"module": "dist/engine.js",
|
"module": "dist/ali-low-code-engine.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/engine.js",
|
"import": "./dist/ali-low-code-engine.js",
|
||||||
"require": "./dist/engine.cjs",
|
"require": "./dist/ali-low-code-engine.cjs",
|
||||||
"types": "./dist/index.d.ts"
|
"types": "./dist/index.d.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,33 +1,25 @@
|
|||||||
import { defineConfig, LibraryFormats } from 'vite';
|
import { defineConfig, mergeConfig } from 'vite';
|
||||||
import { resolve } from 'node:path';
|
import baseConfigFn from '../../vite.base.config'
|
||||||
import { env } from 'node:process';
|
|
||||||
import react from '@vitejs/plugin-react';
|
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
export default defineConfig(async () => {
|
||||||
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
const baseConfig = await baseConfigFn({
|
||||||
|
name: 'AliLowCodeEngine',
|
||||||
|
defaultFormats: ['es', 'cjs'],
|
||||||
|
})
|
||||||
|
|
||||||
export default defineConfig({
|
return mergeConfig(baseConfig, defineConfig({
|
||||||
build: {
|
build: {
|
||||||
lib: {
|
rollupOptions: {
|
||||||
// Could also be a dictionary or array of multiple entry points
|
output: {
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
// for UMD
|
||||||
name: 'AliLowCodeEngine',
|
globals: {
|
||||||
formats,
|
react: 'React',
|
||||||
// the proper extensions will be added
|
'react-dom': 'ReactDOM',
|
||||||
fileName: 'engine',
|
'@alifd/next': 'Next'
|
||||||
},
|
},
|
||||||
rollupOptions: {
|
|
||||||
external: externals,
|
|
||||||
output: {
|
|
||||||
// for UMD
|
|
||||||
globals: {
|
|
||||||
react: 'React',
|
|
||||||
'react-dom': 'ReactDOM',
|
|
||||||
'@alifd/next': 'Next'
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
},
|
}))
|
||||||
plugins: [react()],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -6,13 +6,13 @@
|
|||||||
"homepage": "https://github.com/alibaba/lowcode-engine#readme",
|
"homepage": "https://github.com/alibaba/lowcode-engine#readme",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/command.cjs",
|
"main": "dist/low-code-plugin-command.cjs",
|
||||||
"module": "dist/command.js",
|
"module": "dist/low-code-plugin-command.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/command.js",
|
"import": "./dist/low-code-plugin-command.js",
|
||||||
"require": "./dist/command.cjs",
|
"require": "./dist/low-code-plugin-command.cjs",
|
||||||
"types": "./dist/index.d.ts"
|
"types": "./dist/index.d.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -34,7 +34,13 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-types": "workspace:*",
|
"@alilc/lowcode-types": "workspace:*",
|
||||||
"@alilc/lowcode-utils": "workspace:*"
|
"@alilc/lowcode-utils": "workspace:*",
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|||||||
@ -1,18 +1,9 @@
|
|||||||
import { defineConfig, LibraryFormats } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import { resolve } from 'node:path';
|
import baseConfigFn from '../../vite.base.config'
|
||||||
import { env } from 'node:process';
|
|
||||||
|
|
||||||
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
export default defineConfig(async () => {
|
||||||
|
return baseConfigFn({
|
||||||
export default defineConfig({
|
name: 'LowCodePluginCommand',
|
||||||
build: {
|
defaultFormats: ['es', 'cjs']
|
||||||
lib: {
|
})
|
||||||
// Could also be a dictionary or array of multiple entry points
|
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
|
||||||
name: 'LowCodePluginCommand',
|
|
||||||
formats,
|
|
||||||
// the proper extensions will be added
|
|
||||||
fileName: 'plugin-command',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,13 +3,13 @@
|
|||||||
"version": "2.0.0-beta.0",
|
"version": "2.0.0-beta.0",
|
||||||
"description": "alibaba lowcode editor designer plugin",
|
"description": "alibaba lowcode editor designer plugin",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/designer.cjs",
|
"main": "dist/low-code-plugin-designer.cjs",
|
||||||
"module": "dist/designer.js",
|
"module": "dist/low-code-plugin-designer.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/designer.js",
|
"import": "./dist/low-code-plugin-designer.js",
|
||||||
"require": "./dist/designer.cjs",
|
"require": "./dist/low-code-plugin-designer.cjs",
|
||||||
"types": "./dist/index.d.ts"
|
"types": "./dist/index.d.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,25 +1,10 @@
|
|||||||
import { defineConfig, LibraryFormats } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import { env } from 'node:process';
|
import baseConfigFn from '../../vite.base.config'
|
||||||
import { resolve } from 'node:path';
|
|
||||||
import react from '@vitejs/plugin-react';
|
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
export default defineConfig(async () => {
|
||||||
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
return baseConfigFn({
|
||||||
|
name: 'LowCodePluginDesigner',
|
||||||
export default defineConfig({
|
defaultFormats: ['es', 'cjs'],
|
||||||
build: {
|
entry: 'src/index.tsx'
|
||||||
lib: {
|
})
|
||||||
// Could also be a dictionary or array of multiple entry points
|
|
||||||
entry: resolve(import.meta.dirname, 'src/index.tsx'),
|
|
||||||
name: 'LowCodePluginDesigner',
|
|
||||||
formats,
|
|
||||||
// the proper extensions will be added
|
|
||||||
fileName: 'plugin-designer',
|
|
||||||
},
|
|
||||||
rollupOptions: {
|
|
||||||
external: externals,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [react()],
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,13 +3,13 @@
|
|||||||
"version": "1.3.2",
|
"version": "1.3.2",
|
||||||
"description": "Outline pane for Ali lowCode engine",
|
"description": "Outline pane for Ali lowCode engine",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/plugin-outline-pane.cjs",
|
"main": "dist/low-code-plugin-outline-pane.cjs",
|
||||||
"module": "dist/plugin-outline-pane.js",
|
"module": "dist/low-code-plugin-outline-pane.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/plugin-outline-pane.js",
|
"import": "./dist/low-code-plugin-outline-pane.js",
|
||||||
"require": "./dist/plugin-outline-pane.cjs",
|
"require": "./dist/low-code-plugin-outline-pane.cjs",
|
||||||
"types": "./dist/index.d.ts"
|
"types": "./dist/index.d.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,25 +1,10 @@
|
|||||||
import { defineConfig, LibraryFormats } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import { env } from 'node:process';
|
import baseConfigFn from '../../vite.base.config'
|
||||||
import { resolve } from 'node:path';
|
|
||||||
import react from '@vitejs/plugin-react';
|
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
export default defineConfig(async () => {
|
||||||
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
return baseConfigFn({
|
||||||
|
name: 'LowCodePluginOutlinePane',
|
||||||
export default defineConfig({
|
defaultFormats: ['es', 'cjs'],
|
||||||
build: {
|
entry: 'src/index.tsx'
|
||||||
lib: {
|
})
|
||||||
// Could also be a dictionary or array of multiple entry points
|
|
||||||
entry: resolve(import.meta.dirname, 'src/index.tsx'),
|
|
||||||
name: 'LowCodePluginOutlinePane',
|
|
||||||
formats,
|
|
||||||
// the proper extensions will be added
|
|
||||||
fileName: 'plugin-outline-pane',
|
|
||||||
},
|
|
||||||
rollupOptions: {
|
|
||||||
external: externals,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [react()],
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -6,13 +6,13 @@
|
|||||||
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
|
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
|
||||||
"homepage": "https://github.com/alibaba/lowcode-engine/#readme",
|
"homepage": "https://github.com/alibaba/lowcode-engine/#readme",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "dist/reactRenderer.cjs",
|
"main": "dist/low-code-react-renderer.cjs",
|
||||||
"module": "dist/reactRenderer.js",
|
"module": "dist/low-code-react-renderer.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/reactRenderer.js",
|
"import": "./dist/low-code-react-renderer.js",
|
||||||
"require": "./dist/reactRenderer.cjs",
|
"require": "./dist/low-code-react-renderer.cjs",
|
||||||
"types": "./dist/index.d.ts"
|
"types": "./dist/index.d.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -3,10 +3,10 @@ import {
|
|||||||
type AppBase,
|
type AppBase,
|
||||||
createAppFunction,
|
createAppFunction,
|
||||||
type AppOptionsBase,
|
type AppOptionsBase,
|
||||||
} from '@alilc/renderer-core';
|
} from '@alilc/lowcode-renderer-core';
|
||||||
import { type ComponentType } from 'react';
|
import { type ComponentType } from 'react';
|
||||||
import { type Root, createRoot } from 'react-dom/client';
|
import { type Root, createRoot } from 'react-dom/client';
|
||||||
import { createRouter } from '@alilc/runtime-router';
|
import { createRouter } from '@alilc/lowcode-renderer-router';
|
||||||
import { createRenderer } from '../renderer';
|
import { createRenderer } from '../renderer';
|
||||||
import AppComponent from '../components/app';
|
import AppComponent from '../components/app';
|
||||||
import { createIntl } from '../runtime-api/intl';
|
import { createIntl } from '../runtime-api/intl';
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import {
|
|||||||
isJSFunction,
|
isJSFunction,
|
||||||
isJSSlot,
|
isJSSlot,
|
||||||
someValue,
|
someValue,
|
||||||
} from '@alilc/renderer-core';
|
} from '@alilc/lowcode-renderer-core';
|
||||||
import { isPlainObject } from 'lodash-es';
|
import { isPlainObject } from 'lodash-es';
|
||||||
import { forwardRef, useRef, useEffect, createElement, useMemo } from 'react';
|
import { forwardRef, useRef, useEffect, createElement, useMemo } from 'react';
|
||||||
import { createSignal, watch } from './signals';
|
import { createSignal, watch } from './signals';
|
||||||
@ -26,7 +26,7 @@ import type {
|
|||||||
JSSlot,
|
JSSlot,
|
||||||
JSFunction,
|
JSFunction,
|
||||||
I18nNode,
|
I18nNode,
|
||||||
} from '@alilc/renderer-core';
|
} from '@alilc/lowcode-renderer-core';
|
||||||
import type {
|
import type {
|
||||||
ComponentType,
|
ComponentType,
|
||||||
ReactInstance,
|
ReactInstance,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { PageConfig, ComponentTree } from '@alilc/renderer-core';
|
import type { PageConfig, ComponentTree } from '@alilc/lowcode-renderer-core';
|
||||||
import { useAppContext } from '../context/app';
|
import { useAppContext } from '../context/app';
|
||||||
import { createComponent } from '../component';
|
import { createComponent } from '../component';
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { type Router } from '@alilc/runtime-router';
|
import { type Router } from '@alilc/lowcode-renderer-router';
|
||||||
import { useState, useLayoutEffect, useMemo, type ReactNode } from 'react';
|
import { useState, useLayoutEffect, useMemo, type ReactNode } from 'react';
|
||||||
import { RouterContext, RouteLocationContext, PageConfigContext } from '../context/router';
|
import { RouterContext, RouteLocationContext, PageConfigContext } from '../context/router';
|
||||||
import { useAppContext } from '../context/app';
|
import { useAppContext } from '../context/app';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { createContext, useContext } from 'react';
|
import { createContext, useContext } from 'react';
|
||||||
import { type AppContext as AppContextType } from '@alilc/renderer-core';
|
import { type AppContext as AppContextType } from '@alilc/lowcode-renderer-core';
|
||||||
import { type ReactRenderer } from '../renderer';
|
import { type ReactRenderer } from '../renderer';
|
||||||
|
|
||||||
export interface AppContextObject extends AppContextType {
|
export interface AppContextObject extends AppContextType {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { type Router, type RouteLocationNormalized } from '@alilc/runtime-router';
|
import { type Router, type RouteLocationNormalized } from '@alilc/lowcode-renderer-router';
|
||||||
import { type PageConfig } from '@alilc/renderer-core';
|
import { type PageConfig } from '@alilc/lowcode-renderer-core';
|
||||||
import { createContext, useContext } from 'react';
|
import { createContext, useContext } from 'react';
|
||||||
|
|
||||||
export const RouterContext = createContext<Router>({} as any);
|
export const RouterContext = createContext<Router>({} as any);
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import {
|
|||||||
definePlugin as definePluginFn,
|
definePlugin as definePluginFn,
|
||||||
type Plugin,
|
type Plugin,
|
||||||
type PluginSetupContext,
|
type PluginSetupContext,
|
||||||
} from '@alilc/renderer-core';
|
} from '@alilc/lowcode-renderer-core';
|
||||||
import { type ComponentType, type PropsWithChildren } from 'react';
|
import { type ComponentType, type PropsWithChildren } from 'react';
|
||||||
import { type OutletProps } from './components/outlet';
|
import { type OutletProps } from './components/outlet';
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import {
|
|||||||
type AnyFunction,
|
type AnyFunction,
|
||||||
type Util,
|
type Util,
|
||||||
type UtilsApi,
|
type UtilsApi,
|
||||||
} from '@alilc/renderer-core';
|
} from '@alilc/lowcode-renderer-core';
|
||||||
|
|
||||||
export interface RuntimeUtils extends UtilsApi {
|
export interface RuntimeUtils extends UtilsApi {
|
||||||
addUtil(utilItem: Util): void;
|
addUtil(utilItem: Util): void;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { type PlainObject } from '@alilc/renderer-core';
|
import { type PlainObject } from '@alilc/lowcode-renderer-core';
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
computed,
|
computed,
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import {
|
|||||||
type PlainObject,
|
type PlainObject,
|
||||||
type JSExpression,
|
type JSExpression,
|
||||||
isJSExpression,
|
isJSExpression,
|
||||||
} from '@alilc/renderer-core';
|
} from '@alilc/lowcode-renderer-core';
|
||||||
import { type ComponentType, memo, forwardRef, type PropsWithChildren, createElement } from 'react';
|
import { type ComponentType, memo, forwardRef, type PropsWithChildren, createElement } from 'react';
|
||||||
import { produce } from 'immer';
|
import { produce } from 'immer';
|
||||||
import hoistNonReactStatics from 'hoist-non-react-statics';
|
import hoistNonReactStatics from 'hoist-non-react-statics';
|
||||||
|
|||||||
@ -1,32 +1,23 @@
|
|||||||
import { defineConfig, LibraryFormats } from 'vite';
|
import { defineConfig, mergeConfig } from 'vite';
|
||||||
import { env } from 'node:process';
|
import baseConfigFn from '../../vite.base.config'
|
||||||
import { resolve } from 'node:path';
|
|
||||||
import react from '@vitejs/plugin-react';
|
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
export default defineConfig(async () => {
|
||||||
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs', 'iife']) as LibraryFormats[];
|
const baseConfig = await baseConfigFn({
|
||||||
|
name: 'LowCodeReactRenderer',
|
||||||
|
defaultFormats: ['es', 'cjs'],
|
||||||
|
})
|
||||||
|
|
||||||
export default defineConfig({
|
return mergeConfig(baseConfig, defineConfig({
|
||||||
build: {
|
build: {
|
||||||
lib: {
|
rollupOptions: {
|
||||||
// Could also be a dictionary or array of multiple entry points
|
output: {
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
// for UMD
|
||||||
name: 'LowCodeReactRenderer',
|
globals: {
|
||||||
formats,
|
react: 'React',
|
||||||
// the proper extensions will be added
|
'react-dom': 'ReactDOM',
|
||||||
fileName: 'reactRenderer',
|
},
|
||||||
},
|
|
||||||
rollupOptions: {
|
|
||||||
external: externals,
|
|
||||||
output: {
|
|
||||||
// for UMD
|
|
||||||
globals: {
|
|
||||||
react: 'React',
|
|
||||||
'react-dom': 'ReactDOM',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
},
|
}))
|
||||||
plugins: [react()],
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -6,12 +6,12 @@
|
|||||||
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
|
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
|
||||||
"homepage": "https://github.com/alibaba/lowcode-engine/#readme",
|
"homepage": "https://github.com/alibaba/lowcode-engine/#readme",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "dist/rendererCore.js",
|
"main": "dist/low-code-renderer-core.js",
|
||||||
"module": "dist/rendererCore.js",
|
"module": "dist/low-code-renderer-core.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/rendererCore.js",
|
"import": "./dist/low-code-renderer-core.js",
|
||||||
"types": "./dist/index.d.ts"
|
"types": "./dist/index.d.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,18 +1,8 @@
|
|||||||
import { defineConfig, LibraryFormats } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import { env } from 'node:process';
|
import baseConfigFn from '../../vite.base.config'
|
||||||
import { resolve } from 'node:path';
|
|
||||||
|
|
||||||
const formats = (env['FORMATS']?.split(',') ?? ['es']) as LibraryFormats[];
|
export default defineConfig(async () => {
|
||||||
|
return baseConfigFn({
|
||||||
export default defineConfig({
|
name: 'LowCodeRendererCore',
|
||||||
build: {
|
})
|
||||||
lib: {
|
|
||||||
// Could also be a dictionary or array of multiple entry points
|
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
|
||||||
name: 'LowCodeRendererCore',
|
|
||||||
formats,
|
|
||||||
// the proper extensions will be added
|
|
||||||
fileName: 'rendererCore',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -6,11 +6,11 @@
|
|||||||
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
|
"bugs": "https://github.com/alibaba/lowcode-engine/issues",
|
||||||
"homepage": "https://github.com/alibaba/lowcode-engine/#readme",
|
"homepage": "https://github.com/alibaba/lowcode-engine/#readme",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"module": "dist/runtimeRouter.js",
|
"module": "dist/low-code-runtime-router.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/runtimeRouter.js",
|
"import": "./dist/low-code-runtime-router.js",
|
||||||
"types": "./dist/index.d.ts"
|
"types": "./dist/index.d.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { RawRouteLocation } from '@alilc/renderer-core';
|
import { RawRouteLocation } from '@alilc/lowcode-renderer-core';
|
||||||
import { type RouteLocationNormalized } from './types';
|
import { type RouteLocationNormalized } from './types';
|
||||||
import { isRouteLocation } from './utils/helper';
|
import { isRouteLocation } from './utils/helper';
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { type PlainObject, type RawLocation } from '@alilc/renderer-core';
|
import { type PlainObject, type RawLocation } from '@alilc/lowcode-renderer-core';
|
||||||
import { pick } from 'lodash-es';
|
import { pick } from 'lodash-es';
|
||||||
import { createRouteRecordMatcher, type RouteRecordMatcher } from './utils/record-matcher';
|
import { createRouteRecordMatcher, type RouteRecordMatcher } from './utils/record-matcher';
|
||||||
import { type PathParserOptions } from './utils/path-parser';
|
import { type PathParserOptions } from './utils/path-parser';
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import {
|
|||||||
useEvent,
|
useEvent,
|
||||||
type RawRouteLocation,
|
type RawRouteLocation,
|
||||||
type RawLocationOptions,
|
type RawLocationOptions,
|
||||||
} from '@alilc/renderer-core';
|
} from '@alilc/lowcode-renderer-core';
|
||||||
import {
|
import {
|
||||||
createBrowserHistory,
|
createBrowserHistory,
|
||||||
createHashHistory,
|
createHashHistory,
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import type {
|
|||||||
RouteLocation,
|
RouteLocation,
|
||||||
PlainObject,
|
PlainObject,
|
||||||
RawRouteLocation,
|
RawRouteLocation,
|
||||||
} from '@alilc/renderer-core';
|
} from '@alilc/lowcode-renderer-core';
|
||||||
import type { PathParserOptions } from './utils/path-parser';
|
import type { PathParserOptions } from './utils/path-parser';
|
||||||
|
|
||||||
export interface RouteRecord extends RouterRecordSpec, PathParserOptions {
|
export interface RouteRecord extends RouterRecordSpec, PathParserOptions {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { RawRouteLocation } from '@alilc/renderer-core';
|
import type { RawRouteLocation } from '@alilc/lowcode-renderer-core';
|
||||||
import type { RouteLocationNormalized } from '../types';
|
import type { RouteLocationNormalized } from '../types';
|
||||||
|
|
||||||
export function isRouteLocation(route: any): route is RawRouteLocation {
|
export function isRouteLocation(route: any): route is RawRouteLocation {
|
||||||
|
|||||||
@ -1,23 +1,8 @@
|
|||||||
import { defineConfig, LibraryFormats } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import { env } from 'node:process';
|
import baseConfigFn from '../../vite.base.config'
|
||||||
import { resolve } from 'node:path';
|
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
export default defineConfig(async () => {
|
||||||
const formats = (env['FORMATS']?.split(',') ?? ['es', 'cjs']) as LibraryFormats[];
|
return baseConfigFn({
|
||||||
|
name: 'LowCodeRuntimeRouter',
|
||||||
export default defineConfig({
|
})
|
||||||
build: {
|
|
||||||
lib: {
|
|
||||||
// Could also be a dictionary or array of multiple entry points
|
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
|
||||||
name: 'LowCodeRuntimeRouter',
|
|
||||||
formats,
|
|
||||||
// the proper extensions will be added
|
|
||||||
fileName: 'runtimeRouter',
|
|
||||||
},
|
|
||||||
rollupOptions: {
|
|
||||||
external: externals,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,13 +3,13 @@
|
|||||||
"version": "2.0.0-beta.0",
|
"version": "2.0.0-beta.0",
|
||||||
"description": "Types for Ali lowCode engine",
|
"description": "Types for Ali lowCode engine",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/lowcodeTypes.js",
|
"main": "dist/low-code-types.js",
|
||||||
"module": "dist/lowcodeTypes.js",
|
"module": "dist/low-code-types.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/lowcodeTypes.js",
|
"import": "./dist/low-code-types.js",
|
||||||
"module": "./dist/lowcodeTypes.js",
|
"module": "./dist/low-code-types.js",
|
||||||
"types": "./dist/index.d.ts"
|
"types": "./dist/index.d.ts"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|||||||
@ -1,18 +1,6 @@
|
|||||||
import { defineConfig, LibraryFormats } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import { resolve } from 'node:path';
|
import baseConfigFn from '../../vite.base.config'
|
||||||
import { env } from 'node:process';
|
|
||||||
|
|
||||||
const formats = (env['FORMATS']?.split(',') ?? ['es']) as LibraryFormats[];
|
export default defineConfig(async () => baseConfigFn({
|
||||||
|
name: 'LowCodeTypes',
|
||||||
export default defineConfig({
|
}));
|
||||||
build: {
|
|
||||||
lib: {
|
|
||||||
// Could also be a dictionary or array of multiple entry points
|
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
|
||||||
name: 'LowcodeTypes',
|
|
||||||
formats,
|
|
||||||
// the proper extensions will be added
|
|
||||||
fileName: 'lowcodeTypes',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|||||||
@ -3,12 +3,12 @@
|
|||||||
"version": "2.0.0-beta.0",
|
"version": "2.0.0-beta.0",
|
||||||
"description": "Utils for Ali lowCode engine",
|
"description": "Utils for Ali lowCode engine",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "lib/index.js",
|
"main": "lib/low-code-utils.js",
|
||||||
"module": "dist/index.js",
|
"module": "dist/low-code-utils.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/lowCodeUtils.js",
|
"import": "./dist/low-code-utils.js",
|
||||||
"types": "./dist/index.d.ts"
|
"types": "./dist/index.d.ts"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|||||||
@ -1,25 +1,8 @@
|
|||||||
import { defineConfig, LibraryFormats } from 'vite';
|
import { defineConfig, } from 'vite';
|
||||||
import { resolve } from 'node:path';
|
import baseConfigFn from '../../vite.base.config'
|
||||||
import { env } from 'node:process';
|
|
||||||
import react from '@vitejs/plugin-react';
|
|
||||||
import { devDependencies, peerDependencies } from './package.json';
|
|
||||||
|
|
||||||
const externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
export default defineConfig(async () => {
|
||||||
const formats = (env['FORMATS']?.split(',') ?? ['es']) as LibraryFormats[];
|
return baseConfigFn({
|
||||||
|
name: 'LowCodeUtils',
|
||||||
export default defineConfig({
|
})
|
||||||
build: {
|
|
||||||
lib: {
|
|
||||||
entry: resolve(import.meta.dirname, 'src/index.ts'),
|
|
||||||
name: 'LowCodeUtils',
|
|
||||||
formats,
|
|
||||||
fileName: 'lowCodeUtils',
|
|
||||||
},
|
|
||||||
rollupOptions: {
|
|
||||||
external: externals,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
react(),
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -7,6 +7,9 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
||||||
|
<!-- <script src=""></script> -->
|
||||||
|
|
||||||
<script type="module" src="./src/index.ts"></script>
|
<script type="module" src="./src/index.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -1,25 +1,21 @@
|
|||||||
import { resolve } from 'node:path';
|
|
||||||
import { existsSync } from 'node:fs';
|
|
||||||
import { readdir } from 'node:fs/promises';
|
|
||||||
import { argv, cwd } from 'node:process';
|
import { argv, cwd } from 'node:process';
|
||||||
import minimist from 'minimist';
|
import minimist from 'minimist';
|
||||||
import { execa } from 'execa';
|
import { execa } from 'execa';
|
||||||
import { findWorkspacePackages } from '@pnpm/workspace.find-packages'
|
import { findWorkspacePackages } from '@pnpm/workspace.find-packages'
|
||||||
|
|
||||||
const args = minimist(argv.slice(2));
|
const args = minimist(argv.slice(2));
|
||||||
const targets = args['_'][0];
|
const targets = args['_'];
|
||||||
const formatArgs = args['formats'];
|
const formatArgs = args['formats'];
|
||||||
const prod = args['prod'] || args['p'];
|
const prod = args['prod'] || args['p'];
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
const packages = await findWorkspacePackages(cwd());
|
const packages = await findWorkspacePackages(cwd());
|
||||||
const targetPackageName = `@alilc/lowcode-${targets[0]}`
|
const targetPackageName = `@alilc/lowcode-${targets[0]}`
|
||||||
|
|
||||||
const finalName = packages
|
const finalName = packages
|
||||||
.filter((item) => item.manifest.name.includes(targetPackageName))
|
.filter((item) => item.manifest.name === targetPackageName)
|
||||||
.filter((dir) => existsSync(resolve(packagesUrl.pathname, dir)));
|
.map(item => item.manifest.name);
|
||||||
|
|
||||||
await execa('pnpm', ['--filter', finalName, 'build:target'], {
|
await execa('pnpm', ['--filter', finalName[0], 'build:target'], {
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
env: {
|
env: {
|
||||||
FORMATS: !prod ? formatArgs : undefined,
|
FORMATS: !prod ? formatArgs : undefined,
|
||||||
|
|||||||
51
vite.base.config.ts
Normal file
51
vite.base.config.ts
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import { defineConfig, LibraryFormats } from 'vite';
|
||||||
|
import { env, cwd } from 'node:process';
|
||||||
|
import { resolve } from 'node:path';
|
||||||
|
import { readFile } from 'node:fs/promises'
|
||||||
|
import react from '@vitejs/plugin-react';
|
||||||
|
|
||||||
|
interface Options {
|
||||||
|
name: string;
|
||||||
|
entry?: string;
|
||||||
|
defaultFormats?: LibraryFormats[];
|
||||||
|
externalDeps?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const resolvePath = (path: string) => resolve(cwd(), path)
|
||||||
|
|
||||||
|
export default async ({ name, entry = 'src/index.ts', defaultFormats = ['es'], externalDeps = true }: Options) => {
|
||||||
|
const formats = (env['FORMATS']?.split(',') ?? defaultFormats) as LibraryFormats[];
|
||||||
|
|
||||||
|
let externals: string[] = [];
|
||||||
|
|
||||||
|
if (externalDeps) {
|
||||||
|
const { peerDependencies = {}, devDependencies = {} } = await getPackageJson(resolvePath('package.json'));
|
||||||
|
externals = [...Object.keys(peerDependencies), ...Object.keys(devDependencies)];
|
||||||
|
}
|
||||||
|
|
||||||
|
return defineConfig({
|
||||||
|
build: {
|
||||||
|
lib: {
|
||||||
|
entry: resolvePath(entry),
|
||||||
|
name,
|
||||||
|
fileName: camelCaseToKebabCase(name),
|
||||||
|
formats,
|
||||||
|
},
|
||||||
|
minify: false,
|
||||||
|
rollupOptions: {
|
||||||
|
external: externals
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: [react()],
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function camelCaseToKebabCase(str: string) {
|
||||||
|
// 使用正则表达式匹配大写字母
|
||||||
|
return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getPackageJson(path: string) {
|
||||||
|
const content = await readFile(path, 'utf-8');
|
||||||
|
return JSON.parse(content);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user