@easy-editor/materials-dashboard-audio 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/component.min.js +1 -2
- package/dist/index.min.js +1 -2
- package/dist/meta.min.js +1 -2
- package/easypack.config.ts +10 -0
- package/package.json +4 -11
- package/src/component.tsx +222 -140
- package/src/configure.ts +165 -247
- package/src/index.tsx +7 -7
- package/src/meta.ts +26 -28
- package/src/snippets.ts +61 -50
- package/tsconfig.json +20 -9
- package/.vite/plugins/vite-plugin-external-deps.ts +0 -224
- package/.vite/plugins/vite-plugin-material-dev.ts +0 -218
- package/dist/component.esm.js +0 -165
- package/dist/component.esm.js.map +0 -1
- package/dist/component.js +0 -173
- package/dist/component.js.map +0 -1
- package/dist/component.min.js.map +0 -1
- package/dist/index.cjs +0 -456
- package/dist/index.cjs.map +0 -1
- package/dist/index.esm.js +0 -453
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js +0 -460
- package/dist/index.js.map +0 -1
- package/dist/index.min.js.map +0 -1
- package/dist/meta.esm.js +0 -292
- package/dist/meta.esm.js.map +0 -1
- package/dist/meta.js +0 -303
- package/dist/meta.js.map +0 -1
- package/dist/meta.min.js.map +0 -1
- package/dist/src/component.d.ts +0 -23
- package/dist/src/configure.d.ts +0 -7
- package/dist/src/constants.d.ts +0 -16
- package/dist/src/index.d.ts +0 -6
- package/dist/src/meta.d.ts +0 -7
- package/dist/src/snippets.d.ts +0 -7
- package/rollup.config.js +0 -222
- package/tsconfig.build.json +0 -12
- package/tsconfig.test.json +0 -7
- package/vite.config.ts +0 -54
package/dist/meta.min.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meta.min.js","sources":["../../../../shared/src/index.ts","../src/constants.ts","../src/meta.ts","../src/snippets.ts","../src/configure.ts"],"sourcesContent":["/**\n * Shared types, components and utilities for EasyEditor materials\n * @package @easy-editor/materials-shared\n */\n\n// 物料分组常量\nexport const MaterialGroup = {\n /** 内置 */\n INNER: 'inner',\n /** 基础 */\n BASIC: 'basic',\n /** 图表 */\n CHART: 'chart',\n /** 数据展示 */\n DISPLAY: 'display',\n /** 媒体 */\n MEDIA: 'media',\n /** 交互 */\n INTERACTION: 'interaction',\n /** 地图 */\n MAP: 'map',\n} as const\n\nexport type MaterialGroup = (typeof MaterialGroup)[keyof typeof MaterialGroup]\n\n// 工具函数\nexport { cn } from './lib/utils'\n\nexport * from './types'\n","/**\n * 物料常量配置\n * 统一管理全局变量名等配置,确保 meta.ts 和 rollup.config.js 使用相同的值\n */\n\n/**\n * UMD 全局变量基础名称\n * 用于构建:\n * - 元数据:${GLOBAL_NAME}Meta (例如: EasyEditorMaterialsAudioMeta)\n * - 组件:${GLOBAL_NAME}Component (例如: EasyEditorMaterialsAudioComponent)\n * - 完整构建:${GLOBAL_NAME} (例如: EasyEditorMaterialsAudio)\n */\nexport const COMPONENT_NAME = 'EasyEditorMaterialsAudio'\n\n/**\n * 包名\n */\nexport const PACKAGE_NAME = '@easy-editor/materials-dashboard-audio'\n","/**\n * Audio Meta\n * 音频组件元数据\n */\n\nimport type { ComponentMetadata } from '@easy-editor/core'\nimport { MaterialGroup } from '@easy-editor/materials-shared'\nimport { COMPONENT_NAME, PACKAGE_NAME } from './constants'\nimport configure from './configure'\nimport snippets from './snippets'\nimport pkg from '../package.json'\n\nexport const meta: ComponentMetadata = {\n componentName: COMPONENT_NAME,\n title: '音频',\n group: MaterialGroup.MEDIA,\n devMode: 'proCode',\n npm: {\n package: PACKAGE_NAME,\n version: pkg.version,\n globalName: COMPONENT_NAME,\n componentName: COMPONENT_NAME,\n },\n snippets,\n configure,\n}\n\nexport default meta\n","/**\n * Audio Snippets\n * 音频组件代码片段\n */\n\nimport type { Snippet } from '@easy-editor/core'\nimport { COMPONENT_NAME } from './constants'\n\nexport const snippets: Snippet[] = [\n {\n title: '音频播放器',\n screenshot: '',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n src: '',\n title: '音频文件',\n autoPlay: false,\n loop: false,\n audioStyle: 'custom',\n },\n $dashboard: {\n rect: {\n width: 300,\n height: 60,\n },\n },\n },\n },\n {\n title: '原生音频',\n screenshot: '',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n src: '',\n title: '音频文件',\n audioStyle: 'native',\n },\n $dashboard: {\n rect: {\n width: 300,\n height: 60,\n },\n },\n },\n },\n]\n\nexport default snippets\n","/**\n * Audio Configure\n * 音频组件配置\n */\n\nimport type { Configure } from '@easy-editor/core'\nimport type { UploadValue } from '@easy-editor/materials-shared'\n\nexport const configure: Configure = {\n props: [\n {\n type: 'group',\n title: '属性',\n setter: 'TabSetter',\n items: [\n {\n type: 'group',\n key: 'config',\n title: '配置',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n // 基础配置\n {\n name: 'id',\n title: 'ID',\n setter: 'NodeIdSetter',\n extraProps: {\n // @ts-expect-error label is not a valid extra prop\n label: false,\n },\n },\n {\n name: 'title',\n title: '标题',\n setter: 'StringSetter',\n extraProps: {\n getValue(target) {\n return target.getExtraPropValue('title')\n },\n setValue(target, value) {\n target.setExtraPropValue('title', value)\n },\n },\n },\n {\n type: 'group',\n title: '基础属性',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'rect',\n title: '位置尺寸',\n setter: 'RectSetter',\n extraProps: {\n getValue(target) {\n return target.getExtraPropValue('$dashboard.rect')\n },\n setValue(target, value) {\n target.setExtraPropValue('$dashboard.rect', value)\n },\n },\n },\n ],\n },\n // 组件配置\n {\n type: 'group',\n title: '内容',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: '__upload',\n title: '上传',\n setter: {\n componentName: 'UploadSetter',\n props: {\n accept: '.mp3,.wav,.ogg',\n },\n },\n extraProps: {\n setValue(target, value: UploadValue) {\n if (value) {\n const { base64, raw } = value\n if (base64) {\n target.parent.setPropValue('src', base64)\n }\n if (raw?.width) {\n target.parent.setExtraPropValue('$dashboard.rect.width', raw.width)\n }\n if (raw?.height) {\n target.parent.setExtraPropValue('$dashboard.rect.height', raw.height)\n }\n } else {\n target.parent.clearPropValue('src')\n }\n },\n },\n },\n {\n name: 'src',\n title: '音频地址',\n setter: 'StringSetter',\n },\n {\n name: 'title',\n title: '标题',\n setter: 'StringSetter',\n extraProps: {\n defaultValue: '音频文件',\n },\n },\n ],\n },\n {\n type: 'group',\n title: '播放',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'autoPlay',\n title: '自动播放',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: false,\n },\n },\n {\n name: 'loop',\n title: '循环播放',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: false,\n },\n },\n {\n name: 'audioStyle',\n title: '样式类型',\n setter: {\n componentName: 'SelectSetter',\n props: {\n options: [\n { label: '自定义', value: 'custom' },\n { label: '原生', value: 'native' },\n ],\n },\n },\n extraProps: {\n defaultValue: 'custom',\n },\n },\n {\n name: 'playbackRate',\n title: '播放速度',\n setter: {\n componentName: 'SelectSetter',\n props: {\n options: [\n { label: '0.5x', value: 0.5 },\n { label: '0.75x', value: 0.75 },\n { label: '1x (正常)', value: 1 },\n { label: '1.25x', value: 1.25 },\n { label: '1.5x', value: 1.5 },\n { label: '2x', value: 2 },\n ],\n },\n },\n extraProps: {\n defaultValue: 1,\n },\n },\n {\n name: 'volume',\n title: '音量',\n setter: {\n componentName: 'SliderSetter',\n props: {\n min: 0,\n max: 100,\n step: 1,\n suffix: '%',\n },\n },\n extraProps: {\n defaultValue: 100,\n },\n },\n ],\n },\n ],\n },\n {\n type: 'group',\n key: 'data',\n title: '数据',\n items: [\n {\n name: 'dataBinding',\n title: '数据绑定',\n setter: 'DataBindingSetter',\n },\n ],\n },\n {\n type: 'group',\n key: 'advanced',\n title: '高级',\n items: [\n {\n name: 'condition',\n title: '显隐控制',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: true,\n supportVariable: true,\n },\n },\n ],\n },\n ],\n },\n ],\n component: {},\n supports: {},\n advanced: {},\n}\n\nexport default configure\n"],"names":["COMPONENT_NAME","meta","componentName","title","group","devMode","npm","package","version","globalName","snippets","screenshot","schema","props","src","autoPlay","loop","audioStyle","$dashboard","rect","width","height","configure","type","setter","items","key","icon","name","extraProps","label","getValue","target","getExtraPropValue","setValue","value","setExtraPropValue","accept","base64","raw","parent","setPropValue","clearPropValue","defaultValue","options","min","max","step","suffix","supportVariable","component","supports","advanced"],"mappings":"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"}
|
package/dist/src/component.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Audio Component
|
|
3
|
-
* 音频播放组件
|
|
4
|
-
*/
|
|
5
|
-
import { type CSSProperties, type Ref } from 'react';
|
|
6
|
-
export type AudioStyle = 'custom' | 'native';
|
|
7
|
-
export interface AudioProps {
|
|
8
|
-
ref?: Ref<HTMLDivElement>;
|
|
9
|
-
/** 音频地址 */
|
|
10
|
-
src?: string;
|
|
11
|
-
/** 标题 */
|
|
12
|
-
title?: string;
|
|
13
|
-
/** 自动播放 */
|
|
14
|
-
autoPlay?: boolean;
|
|
15
|
-
/** 循环播放 */
|
|
16
|
-
loop?: boolean;
|
|
17
|
-
/** 样式类型 */
|
|
18
|
-
audioStyle?: AudioStyle;
|
|
19
|
-
/** 外部样式 */
|
|
20
|
-
style?: CSSProperties;
|
|
21
|
-
}
|
|
22
|
-
export declare const Audio: React.FC<AudioProps>;
|
|
23
|
-
export default Audio;
|
package/dist/src/configure.d.ts
DELETED
package/dist/src/constants.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 物料常量配置
|
|
3
|
-
* 统一管理全局变量名等配置,确保 meta.ts 和 rollup.config.js 使用相同的值
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* UMD 全局变量基础名称
|
|
7
|
-
* 用于构建:
|
|
8
|
-
* - 元数据:${GLOBAL_NAME}Meta (例如: EasyEditorMaterialsAudioMeta)
|
|
9
|
-
* - 组件:${GLOBAL_NAME}Component (例如: EasyEditorMaterialsAudioComponent)
|
|
10
|
-
* - 完整构建:${GLOBAL_NAME} (例如: EasyEditorMaterialsAudio)
|
|
11
|
-
*/
|
|
12
|
-
export declare const COMPONENT_NAME = "EasyEditorMaterialsAudio";
|
|
13
|
-
/**
|
|
14
|
-
* 包名
|
|
15
|
-
*/
|
|
16
|
-
export declare const PACKAGE_NAME = "@easy-editor/materials-dashboard-audio";
|
package/dist/src/index.d.ts
DELETED
package/dist/src/meta.d.ts
DELETED
package/dist/src/snippets.d.ts
DELETED
package/rollup.config.js
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import babel from '@rollup/plugin-babel'
|
|
2
|
-
import commonjs from '@rollup/plugin-commonjs'
|
|
3
|
-
import nodeResolve from '@rollup/plugin-node-resolve'
|
|
4
|
-
import json from '@rollup/plugin-json'
|
|
5
|
-
import { terser } from 'rollup-plugin-terser'
|
|
6
|
-
import cleanup from 'rollup-plugin-cleanup'
|
|
7
|
-
import postcss from 'rollup-plugin-postcss'
|
|
8
|
-
import pkg from './package.json' with { type: 'json' }
|
|
9
|
-
|
|
10
|
-
const GLOBAL_NAME = 'EasyEditorMaterialsAudio'
|
|
11
|
-
|
|
12
|
-
// 外部依赖(不打包进组件)
|
|
13
|
-
const external = ['react', 'react-dom', 'react/jsx-runtime', '@easy-editor/core']
|
|
14
|
-
|
|
15
|
-
const globals = {
|
|
16
|
-
react: 'React',
|
|
17
|
-
'react-dom': 'ReactDOM',
|
|
18
|
-
'react/jsx-runtime': 'jsxRuntime',
|
|
19
|
-
'@easy-editor/core': 'EasyEditorCore',
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const plugins = [
|
|
23
|
-
nodeResolve({
|
|
24
|
-
extensions: ['.js', '.ts', '.jsx', '.tsx'],
|
|
25
|
-
}),
|
|
26
|
-
commonjs(),
|
|
27
|
-
json(),
|
|
28
|
-
postcss({
|
|
29
|
-
modules: {
|
|
30
|
-
generateScopedName: '[name]__[local]___[hash:base64:5]',
|
|
31
|
-
},
|
|
32
|
-
autoModules: true,
|
|
33
|
-
minimize: true,
|
|
34
|
-
inject: true,
|
|
35
|
-
}),
|
|
36
|
-
babel({
|
|
37
|
-
extensions: ['.js', '.ts', '.jsx', '.tsx'],
|
|
38
|
-
exclude: 'node_modules/**',
|
|
39
|
-
babelrc: false,
|
|
40
|
-
babelHelpers: 'bundled',
|
|
41
|
-
presets: [
|
|
42
|
-
['@babel/preset-react', { runtime: 'automatic' }],
|
|
43
|
-
[
|
|
44
|
-
'@babel/preset-typescript',
|
|
45
|
-
{
|
|
46
|
-
allowDeclareFields: true,
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
],
|
|
50
|
-
}),
|
|
51
|
-
cleanup({
|
|
52
|
-
comments: ['some', /PURE/],
|
|
53
|
-
extensions: ['.js', '.ts'],
|
|
54
|
-
}),
|
|
55
|
-
]
|
|
56
|
-
|
|
57
|
-
export default [
|
|
58
|
-
/* ---------------------------------- 元数据构建 --------------------------------- */
|
|
59
|
-
// 元数据 ESM 构建(用于动态 import)
|
|
60
|
-
{
|
|
61
|
-
input: 'src/meta.ts',
|
|
62
|
-
output: [
|
|
63
|
-
{
|
|
64
|
-
file: 'dist/meta.esm.js',
|
|
65
|
-
format: 'esm',
|
|
66
|
-
sourcemap: true,
|
|
67
|
-
banner: `/* @easy-editor/materials-dashboard-audio v${pkg.version} (meta, esm) */`,
|
|
68
|
-
exports: 'named',
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
plugins,
|
|
72
|
-
external,
|
|
73
|
-
},
|
|
74
|
-
// 元数据 UMD 构建(备用方案)
|
|
75
|
-
{
|
|
76
|
-
input: 'src/meta.ts',
|
|
77
|
-
output: [
|
|
78
|
-
{
|
|
79
|
-
file: 'dist/meta.js',
|
|
80
|
-
format: 'umd',
|
|
81
|
-
name: `${GLOBAL_NAME}Meta`,
|
|
82
|
-
globals,
|
|
83
|
-
sourcemap: true,
|
|
84
|
-
banner: `/* @easy-editor/materials-dashboard-audio v${pkg.version} (meta) */`,
|
|
85
|
-
exports: 'named',
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
plugins,
|
|
89
|
-
external,
|
|
90
|
-
},
|
|
91
|
-
// 元数据压缩版本(UMD,备用方案)
|
|
92
|
-
{
|
|
93
|
-
input: 'src/meta.ts',
|
|
94
|
-
output: [
|
|
95
|
-
{
|
|
96
|
-
file: 'dist/meta.min.js',
|
|
97
|
-
format: 'umd',
|
|
98
|
-
name: `${GLOBAL_NAME}Meta`,
|
|
99
|
-
globals,
|
|
100
|
-
sourcemap: true,
|
|
101
|
-
banner: `/* @easy-editor/materials-dashboard-audio v${pkg.version} (meta, minified) */`,
|
|
102
|
-
exports: 'named',
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
plugins: [...plugins, terser()],
|
|
106
|
-
external,
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
/* ---------------------------------- 组件构建 ---------------------------------- */
|
|
110
|
-
// 组件 ESM 构建(用于动态 import)
|
|
111
|
-
{
|
|
112
|
-
input: 'src/component.tsx',
|
|
113
|
-
output: [
|
|
114
|
-
{
|
|
115
|
-
file: 'dist/component.esm.js',
|
|
116
|
-
format: 'esm',
|
|
117
|
-
sourcemap: true,
|
|
118
|
-
banner: `/* @easy-editor/materials-dashboard-audio v${pkg.version} (component, esm) */`,
|
|
119
|
-
exports: 'named',
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
plugins,
|
|
123
|
-
external,
|
|
124
|
-
},
|
|
125
|
-
// 组件 UMD 构建(备用方案)
|
|
126
|
-
{
|
|
127
|
-
input: 'src/component.tsx',
|
|
128
|
-
output: [
|
|
129
|
-
{
|
|
130
|
-
file: 'dist/component.js',
|
|
131
|
-
format: 'umd',
|
|
132
|
-
name: `${GLOBAL_NAME}Component`,
|
|
133
|
-
globals,
|
|
134
|
-
sourcemap: true,
|
|
135
|
-
banner: `/* @easy-editor/materials-dashboard-audio v${pkg.version} (component) */`,
|
|
136
|
-
exports: 'named',
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
plugins,
|
|
140
|
-
external,
|
|
141
|
-
},
|
|
142
|
-
// 组件压缩版本(UMD,备用方案)
|
|
143
|
-
{
|
|
144
|
-
input: 'src/component.tsx',
|
|
145
|
-
output: [
|
|
146
|
-
{
|
|
147
|
-
file: 'dist/component.min.js',
|
|
148
|
-
format: 'umd',
|
|
149
|
-
name: `${GLOBAL_NAME}Component`,
|
|
150
|
-
globals,
|
|
151
|
-
sourcemap: true,
|
|
152
|
-
banner: `/* @easy-editor/materials-dashboard-audio v${pkg.version} (component, minified) */`,
|
|
153
|
-
exports: 'named',
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
plugins: [...plugins, terser()],
|
|
157
|
-
external,
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
/* ---------------------------------- 完整构建 ---------------------------------- */
|
|
161
|
-
// UMD 构建(用于 CDN 和浏览器)
|
|
162
|
-
{
|
|
163
|
-
input: 'src/index.tsx',
|
|
164
|
-
output: [
|
|
165
|
-
{
|
|
166
|
-
file: 'dist/index.js',
|
|
167
|
-
format: 'umd',
|
|
168
|
-
name: GLOBAL_NAME,
|
|
169
|
-
globals,
|
|
170
|
-
sourcemap: true,
|
|
171
|
-
banner: `/* @easy-editor/materials-dashboard-audio v${pkg.version} */`,
|
|
172
|
-
exports: 'named',
|
|
173
|
-
},
|
|
174
|
-
],
|
|
175
|
-
plugins,
|
|
176
|
-
external,
|
|
177
|
-
},
|
|
178
|
-
// ESM 构建(用于现代打包工具)
|
|
179
|
-
{
|
|
180
|
-
input: 'src/index.tsx',
|
|
181
|
-
output: [
|
|
182
|
-
{
|
|
183
|
-
file: 'dist/index.esm.js',
|
|
184
|
-
format: 'esm',
|
|
185
|
-
sourcemap: true,
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
plugins,
|
|
189
|
-
external,
|
|
190
|
-
},
|
|
191
|
-
// CJS 构建(用于 Node.js)
|
|
192
|
-
{
|
|
193
|
-
input: 'src/index.tsx',
|
|
194
|
-
output: [
|
|
195
|
-
{
|
|
196
|
-
file: 'dist/index.cjs',
|
|
197
|
-
format: 'cjs',
|
|
198
|
-
sourcemap: true,
|
|
199
|
-
exports: 'named',
|
|
200
|
-
},
|
|
201
|
-
],
|
|
202
|
-
plugins,
|
|
203
|
-
external,
|
|
204
|
-
},
|
|
205
|
-
// 压缩版本(用于生产环境)
|
|
206
|
-
{
|
|
207
|
-
input: 'src/index.tsx',
|
|
208
|
-
output: [
|
|
209
|
-
{
|
|
210
|
-
file: 'dist/index.min.js',
|
|
211
|
-
format: 'umd',
|
|
212
|
-
name: GLOBAL_NAME,
|
|
213
|
-
globals,
|
|
214
|
-
sourcemap: true,
|
|
215
|
-
banner: `/* @easy-editor/materials-dashboard-audio v${pkg.version} (minified) */`,
|
|
216
|
-
exports: 'named',
|
|
217
|
-
},
|
|
218
|
-
],
|
|
219
|
-
plugins: [...plugins, terser()],
|
|
220
|
-
external,
|
|
221
|
-
},
|
|
222
|
-
]
|
package/tsconfig.build.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"jsx": "react-jsx",
|
|
5
|
-
"strictPropertyInitialization": false,
|
|
6
|
-
"outDir": "./dist",
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"allowSyntheticDefaultImports": true
|
|
10
|
-
},
|
|
11
|
-
"include": ["./src"]
|
|
12
|
-
}
|
package/tsconfig.test.json
DELETED
package/vite.config.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vite Configuration for Material Development
|
|
3
|
-
* 物料开发 Vite 配置
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { defineConfig } from 'vite'
|
|
7
|
-
import react from '@vitejs/plugin-react'
|
|
8
|
-
import { materialDevPlugin } from './.vite/plugins/vite-plugin-material-dev'
|
|
9
|
-
import { externalDeps } from './.vite/plugins/vite-plugin-external-deps'
|
|
10
|
-
|
|
11
|
-
export default defineConfig({
|
|
12
|
-
plugins: [
|
|
13
|
-
react(),
|
|
14
|
-
// 外部化 React/ReactDOM,使用父应用提供的实例
|
|
15
|
-
externalDeps({
|
|
16
|
-
externals: ['react', 'react-dom', 'react/jsx-runtime', '@easy-editor/core'],
|
|
17
|
-
globals: {
|
|
18
|
-
react: 'React',
|
|
19
|
-
'react-dom': 'ReactDOM',
|
|
20
|
-
'react/jsx-runtime': 'jsxRuntime',
|
|
21
|
-
'@easy-editor/core': 'EasyEditorCore',
|
|
22
|
-
},
|
|
23
|
-
}),
|
|
24
|
-
materialDevPlugin({
|
|
25
|
-
entry: '/src/index.tsx',
|
|
26
|
-
}),
|
|
27
|
-
],
|
|
28
|
-
server: {
|
|
29
|
-
port: 5001,
|
|
30
|
-
host: 'localhost',
|
|
31
|
-
cors: true,
|
|
32
|
-
hmr: {
|
|
33
|
-
port: 5001,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
build: {
|
|
37
|
-
target: 'esnext',
|
|
38
|
-
rollupOptions: {
|
|
39
|
-
// 确保生产构建也外部化这些依赖
|
|
40
|
-
external: ['react', 'react-dom', 'react/jsx-runtime', '@easy-editor/core'],
|
|
41
|
-
output: {
|
|
42
|
-
globals: {
|
|
43
|
-
react: 'React',
|
|
44
|
-
'react-dom': 'ReactDOM',
|
|
45
|
-
'react/jsx-runtime': 'jsxRuntime',
|
|
46
|
-
'@easy-editor/core': 'EasyEditorCore',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
resolve: {
|
|
52
|
-
dedupe: ['react', 'react-dom'],
|
|
53
|
-
},
|
|
54
|
-
})
|