Files
esengine/packages/tools/build-config/src/index.ts

91 lines
2.5 KiB
TypeScript
Raw Normal View History

/**
* @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';