Files
esengine/packages/build-config/src/index.ts
YHH b42a7b4e43 Feature/editor optimization (#251)
* 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 构建错误并优化构建性能
2025-12-01 22:28:51 +08:00

91 lines
2.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* @esengine/build-config
*
* 统一构建配置包,提供标准化的 Vite 配置预设和共享插件
* Unified build configuration with standardized Vite presets and shared plugins
*
* @example
* ```typescript
* // 1. 纯运行时包 (core, math, components)
* import { runtimeOnlyPreset } from '@esengine/build-config/presets';
* export default runtimeOnlyPreset({ root: __dirname });
*
* // 2. 插件包 (ui, tilemap, behavior-tree)
* import { pluginPreset } from '@esengine/build-config/presets';
* export default pluginPreset({
* root: __dirname,
* hasCSS: true
* });
*
* // 3. 纯编辑器包 (editor-core, node-editor)
* import { editorOnlyPreset } from '@esengine/build-config/presets';
* export default editorOnlyPreset({
* root: __dirname,
* hasReact: true
* });
* ```
*
* ## 包类型说明
*
* | 类型 | 说明 | 示例 |
* |------|------|------|
* | RuntimeOnly | 纯运行时库,不含编辑器代码 | core, math, components |
* | Plugin | 插件包,同时有 runtime 和 editor 入口 | ui, tilemap, behavior-tree |
* | EditorOnly | 纯编辑器包,仅用于编辑器 | editor-core, node-editor |
*
* ## 目录结构约定
*
* ### RuntimeOnly 包
* ```
* packages/my-lib/
* ├── src/
* │ └── index.ts # 主入口
* ├── vite.config.ts
* └── package.json
* ```
*
* ### Plugin 包
* ```
* packages/my-plugin/
* ├── src/
* │ ├── index.ts # 主入口(编辑器环境)
* │ ├── runtime.ts # 运行时入口(不含 React
* │ └── editor/
* │ └── index.ts # 编辑器模块
* ├── plugin.json # 插件描述文件
* ├── vite.config.ts
* └── package.json
* ```
*
* ### EditorOnly 包
* ```
* packages/my-editor-tool/
* ├── src/
* │ └── index.ts # 主入口
* ├── vite.config.ts
* └── package.json
* ```
*/
// Types
export { EPackageType, STANDARD_EXTERNALS, EDITOR_ONLY_EXTERNALS } from './types';
export type { PackageBuildConfig } from './types';
// Presets
export {
runtimeOnlyPreset,
pluginPreset,
standaloneRuntimeConfig,
editorOnlyPreset
} from './presets';
export type {
RuntimeOnlyOptions,
PluginPackageOptions,
StandaloneRuntimeOptions,
EditorOnlyOptions
} from './presets';
// Plugins
export { cssInjectPlugin, blockEditorPlugin } from './plugins';
export type { BlockEditorOptions } from './plugins';