Skip to content

Commit 834a9f1

Browse files
committed
chore: export basic types
1 parent 9147a71 commit 834a9f1

29 files changed

Lines changed: 319 additions & 50 deletions

packages/builtinComponent/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "",
55
"main": "dist/index.mjs",
66
"module": "dist/index.mjs",
7+
"types": "dist/index.d.ts",
78
"type": "module",
89
"publishConfig": {
910
"access": "public"
@@ -27,7 +28,8 @@
2728
"devDependencies": {
2829
"@vitejs/plugin-vue": "^5.1.2",
2930
"@vitejs/plugin-vue-jsx": "^4.0.1",
30-
"vite": "^5.4.2"
31+
"vite": "^5.4.2",
32+
"vite-plugin-dts": "^4.5.4"
3133
},
3234
"peerDependencies": {
3335
"@opentiny/vue": "^3.20.0",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"include": ["./index.ts", "./src/**/*.ts", "./src/**/*.tsx", "./src/**/*.vue"]
4+
}

packages/builtinComponent/vite.config.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,18 @@ import path from 'path'
1414
import vue from '@vitejs/plugin-vue'
1515
import vueJsx from '@vitejs/plugin-vue-jsx'
1616
import vitePluginCssInjectedByJs from 'vite-plugin-css-injected-by-js'
17+
import dts from 'vite-plugin-dts'
1718

1819
export default defineConfig({
19-
plugins: [vue(), vueJsx(), vitePluginCssInjectedByJs()],
20+
plugins: [
21+
vue(),
22+
vueJsx(),
23+
vitePluginCssInjectedByJs(),
24+
dts({
25+
tsconfigPath: path.resolve(__dirname, './tsconfig.json'),
26+
rollupTypes: true
27+
})
28+
],
2029
publicDir: false,
2130
build: {
2231
sourcemap: true,

packages/i18n/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"type": "module",
1616
"main": "dist/lowcode-design-i18n-host.umd.js",
1717
"module": "dist/lowcode-design-i18n-host.es.js",
18+
"types": "dist/lowcode-design-i18n-host.d.ts",
1819
"repository": {
1920
"type": "git",
2021
"url": "https://github.com/opentiny/tiny-engine",
@@ -28,7 +29,8 @@
2829
"homepage": "https://opentiny.design/tiny-engine",
2930
"devDependencies": {
3031
"@vitejs/plugin-vue": "^5.1.2",
31-
"vite": "^5.4.2"
32+
"vite": "^5.4.2",
33+
"vite-plugin-dts": "^4.5.4"
3234
},
3335
"peerDependencies": {
3436
"vue": "^3.4.15",

packages/i18n/tsconfig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"include": ["./src/**/*.ts", "./src/**/*.tsx", "./src/**/*.vue"],
4+
"exclude": ["./src/test"]
5+
}

packages/i18n/vite.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@
1212

1313
import vue from '@vitejs/plugin-vue'
1414
import path from 'path'
15+
import dts from 'vite-plugin-dts'
1516

1617
export default {
1718
plugins: [
19+
dts({
20+
tsconfigPath: path.resolve(__dirname, './tsconfig.json'),
21+
rollupTypes: true
22+
}),
1823
vue({
1924
template: {
2025
compilerOptions: {

packages/register/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"type": "module",
66
"main": "dist/index.js",
77
"module": "dist/index.js",
8+
"types": "dist/index.d.ts",
89
"author": "OpenTiny Team",
910
"license": "MIT",
1011
"bugs": {
@@ -32,6 +33,7 @@
3233
},
3334
"devDependencies": {
3435
"vite": "^5.4.2",
36+
"vite-plugin-dts": "^4.5.4",
3537
"vitest": "^1.4.0"
3638
},
3739
"keywords": []

packages/register/src/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const registryApiAndOptionsMap = (id: string, value: any) => {
8585
}
8686
}
8787

88-
const genDefaultHashMap = (registry: any) => {
88+
const genDefaultHashMap = (registry: Record<string, any>) => {
8989
Object.entries(registry).forEach(([key, value]) => {
9090
if (typeof value === 'object' && value && !isRef(value)) {
9191
const { id } = value
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/**
2+
* 临时类型声明文件
3+
*
4+
* 此文件为暂未导出类型声明的内部包提供临时类型定义
5+
* TODO: 当这些包完成类型导出后,应当删除此文件
6+
*
7+
* 相关包列表:
8+
* - @opentiny/tiny-engine-canvas
9+
* - @opentiny/tiny-engine-layout
10+
* - @opentiny/tiny-engine-plugin-* (block, datasource, help, i18n, materials, page, robot)
11+
* - @opentiny/tiny-engine-setting-props
12+
* - @opentiny/tiny-engine-toolbar-* (breadcrumb, generate-code, redoundo)
13+
* - @opentiny/tiny-engine-common
14+
*/
15+
16+
// Canvas API - 导出一个返回 API 对象的函数
17+
declare module '@opentiny/tiny-engine-canvas/DesignCanvas/src/api' {
18+
const useCanvasApi: () => Record<string, any>
19+
export default useCanvasApi
20+
}
21+
22+
// Layout Service - 导出包含 apis 属性的服务对象
23+
declare module '@opentiny/tiny-engine-layout' {
24+
export const LayoutService: {
25+
apis: Record<string, any>
26+
}
27+
}
28+
29+
// Plugin: Block - 区块管理服务
30+
declare module '@opentiny/tiny-engine-plugin-block' {
31+
export const BlockService: {
32+
apis: Record<string, any>
33+
}
34+
}
35+
36+
// Plugin: DataSource - 数据源管理服务
37+
declare module '@opentiny/tiny-engine-plugin-datasource' {
38+
export const DataSourceService: {
39+
apis: Record<string, any>
40+
}
41+
}
42+
43+
// Plugin: Help - 帮助服务
44+
declare module '@opentiny/tiny-engine-plugin-help' {
45+
export const HelpService: {
46+
apis: Record<string, any>
47+
}
48+
}
49+
50+
// Plugin: I18n - 国际化翻译服务
51+
declare module '@opentiny/tiny-engine-plugin-i18n' {
52+
export const TranslateService: {
53+
apis: Record<string, any>
54+
}
55+
}
56+
57+
// Plugin: Materials - 物料管理服务(包含两个服务)
58+
declare module '@opentiny/tiny-engine-plugin-materials' {
59+
export const MaterialService: {
60+
apis: Record<string, any>
61+
}
62+
export const ResourceService: {
63+
apis: Record<string, any>
64+
}
65+
}
66+
67+
// Plugin: Page - 页面管理服务
68+
declare module '@opentiny/tiny-engine-plugin-page' {
69+
export const PageService: {
70+
apis: Record<string, any>
71+
}
72+
}
73+
74+
// Plugin: Robot - AI 机器人服务
75+
declare module '@opentiny/tiny-engine-plugin-robot' {
76+
export const RobotService: {
77+
apis: Record<string, any>
78+
}
79+
}
80+
81+
// Setting: Props - 属性配置服务(包含两个服务)
82+
declare module '@opentiny/tiny-engine-setting-props' {
83+
export const PropertiesService: {
84+
apis: Record<string, any>
85+
}
86+
export const PropertyService: {
87+
apis: Record<string, any>
88+
}
89+
}
90+
91+
// Toolbar: Breadcrumb - 面包屑导航服务
92+
declare module '@opentiny/tiny-engine-toolbar-breadcrumb' {
93+
export const BreadcrumbService: {
94+
apis: Record<string, any>
95+
}
96+
}
97+
98+
// Toolbar: Generate Code - 代码生成和本地保存服务
99+
declare module '@opentiny/tiny-engine-toolbar-generate-code' {
100+
export const SaveLocalService: {
101+
apis: Record<string, any>
102+
}
103+
}
104+
105+
// Toolbar: Redo/Undo - 历史记录服务
106+
declare module '@opentiny/tiny-engine-toolbar-redoundo' {
107+
export const HistoryService: {
108+
apis: Record<string, any>
109+
}
110+
}
111+
112+
// Common - 通用工具(Modal 和 Notify)
113+
declare module '@opentiny/tiny-engine-common' {
114+
export const Modal: Record<string, any>
115+
export const Notify: (...args: any[]) => any
116+
}

packages/register/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ export { getConfigurator, addConfigurator } from './configurators'
1818
export * from './hooks'
1919
export { META_APP, META_SERVICE } from './constants'
2020
export { defineService, initServices } from './service'
21+
22+
export type { ServiceOptions } from './service'

0 commit comments

Comments
 (0)