* refactor: 编辑器/运行时架构拆分与构建系统升级 * feat(core): 层级系统重构与UI变换矩阵修复 * refactor: 移除 ecs-components 聚合包并修复跨包组件查找问题 * fix(physics): 修复跨包组件类引用问题 * feat: 统一运行时架构与浏览器运行支持 * feat(asset): 实现浏览器运行时资产加载系统 * fix: 修复文档、CodeQL安全问题和CI类型检查错误 * fix: 修复文档、CodeQL安全问题和CI类型检查错误 * fix: 修复文档、CodeQL安全问题、CI类型检查和测试错误 * test: 补齐核心模块测试用例,修复CI构建配置 * fix: 修复测试用例中的类型错误和断言问题 * fix: 修复 turbo build:npm 任务的依赖顺序问题 * fix: 修复 CI 构建错误并优化构建性能
139 lines
2.5 KiB
JavaScript
139 lines
2.5 KiB
JavaScript
const resolve = require('@rollup/plugin-node-resolve');
|
|
const commonjs = require('@rollup/plugin-commonjs');
|
|
const terser = require('@rollup/plugin-terser');
|
|
const babel = require('@rollup/plugin-babel');
|
|
const dts = require('rollup-plugin-dts').default;
|
|
const { readFileSync } = require('fs');
|
|
|
|
const pkg = JSON.parse(readFileSync('./package.json', 'utf8'));
|
|
|
|
const banner = `/**
|
|
* @esengine/editor-core v${pkg.version}
|
|
* ECS Framework Editor Core - Plugin-based editor framework
|
|
*
|
|
* @author ${pkg.author}
|
|
* @license ${pkg.license}
|
|
*/`;
|
|
|
|
const external = [
|
|
'@esengine/ecs-framework',
|
|
'react',
|
|
'react-dom',
|
|
'react/jsx-runtime',
|
|
/^@types\//
|
|
];
|
|
|
|
const commonPlugins = [
|
|
resolve({
|
|
browser: true,
|
|
preferBuiltins: false
|
|
}),
|
|
commonjs({
|
|
include: /node_modules/
|
|
}),
|
|
babel({
|
|
babelHelpers: 'bundled',
|
|
exclude: 'node_modules/**',
|
|
extensions: ['.js', '.ts']
|
|
})
|
|
];
|
|
|
|
module.exports = [
|
|
// ES模块构建
|
|
{
|
|
input: 'bin/index.js',
|
|
output: {
|
|
file: 'dist/index.mjs',
|
|
format: 'es',
|
|
banner,
|
|
sourcemap: true,
|
|
exports: 'named'
|
|
},
|
|
plugins: [
|
|
...commonPlugins,
|
|
terser({
|
|
format: {
|
|
comments: /^!/
|
|
}
|
|
})
|
|
],
|
|
external,
|
|
treeshake: {
|
|
moduleSideEffects: false,
|
|
propertyReadSideEffects: false,
|
|
unknownGlobalSideEffects: false
|
|
}
|
|
},
|
|
|
|
// CommonJS构建
|
|
{
|
|
input: 'bin/index.js',
|
|
output: {
|
|
file: 'dist/index.cjs',
|
|
format: 'cjs',
|
|
banner,
|
|
sourcemap: true,
|
|
exports: 'named'
|
|
},
|
|
plugins: [
|
|
...commonPlugins,
|
|
terser({
|
|
format: {
|
|
comments: /^!/
|
|
}
|
|
})
|
|
],
|
|
external,
|
|
treeshake: {
|
|
moduleSideEffects: false
|
|
}
|
|
},
|
|
|
|
// UMD构建
|
|
{
|
|
input: 'bin/index.js',
|
|
output: {
|
|
file: 'dist/index.umd.js',
|
|
format: 'umd',
|
|
name: 'EditorCore',
|
|
banner,
|
|
sourcemap: true,
|
|
exports: 'named',
|
|
globals: {
|
|
'@esengine/ecs-framework': 'ECS'
|
|
}
|
|
},
|
|
plugins: [
|
|
...commonPlugins,
|
|
terser({
|
|
format: {
|
|
comments: /^!/
|
|
}
|
|
})
|
|
],
|
|
external,
|
|
treeshake: {
|
|
moduleSideEffects: false
|
|
}
|
|
},
|
|
|
|
// 类型定义构建
|
|
{
|
|
input: 'bin/index.d.ts',
|
|
output: {
|
|
file: 'dist/index.d.ts',
|
|
format: 'es',
|
|
banner: `/**
|
|
* @esengine/editor-core v${pkg.version}
|
|
* TypeScript definitions
|
|
*/`
|
|
},
|
|
plugins: [
|
|
dts({
|
|
respectExternal: true
|
|
})
|
|
],
|
|
external
|
|
}
|
|
];
|