Skip to content

Commit c69689a

Browse files
Merge branch 'opentiny:develop' into develop
2 parents 967a971 + 79cbf42 commit c69689a

36 files changed

Lines changed: 339 additions & 90 deletions

mockServer/src/assets/json/appinfo.json

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,21 +1684,6 @@
16841684
"created_at": "2022-07-01T03:21:19.000Z",
16851685
"updated_at": "2022-07-01T03:21:19.000Z"
16861686
},
1687-
{
1688-
"id": 146,
1689-
"name": "npm",
1690-
"type": "function",
1691-
"content": {
1692-
"type": "JSFunction",
1693-
"value": "''"
1694-
},
1695-
"app": 1,
1696-
"category": "utils",
1697-
"created_by": null,
1698-
"updated_by": null,
1699-
"created_at": "2022-08-29T06:54:02.000Z",
1700-
"updated_at": "2023-01-05T01:00:52.000Z"
1701-
},
17021687
{
17031688
"id": 102,
17041689
"name": "Pager",

mockServer/src/mock/get/app-center/apps/extension/list.json

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,6 @@
6666
"created_at": "2022-07-01T03:21:19.000Z",
6767
"updated_at": "2022-07-01T03:21:19.000Z"
6868
},
69-
{
70-
"id": 146,
71-
"name": "npm",
72-
"type": "function",
73-
"content": {
74-
"type": "JSFunction",
75-
"value": "''"
76-
},
77-
"app": 1,
78-
"category": "utils",
79-
"created_at": "2022-08-29T06:54:02.000Z",
80-
"updated_at": "2023-01-05T01:00:52.000Z"
81-
},
8269
{
8370
"id": 102,
8471
"name": "Pager",

mockServer/src/mock/get/app-center/v1/apps/schema/1.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2158,14 +2158,6 @@
21582158
"main": ""
21592159
}
21602160
},
2161-
{
2162-
"name": "npm",
2163-
"type": "function",
2164-
"content": {
2165-
"type": "JSFunction",
2166-
"value": "''"
2167-
}
2168-
},
21692161
{
21702162
"name": "Pager",
21712163
"type": "npm",

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/design-core/src/init.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,6 @@ export const init = async ({
151151

152152
app.mount(selector)
153153
appMounted?.({ app })
154+
155+
return app
154156
}

packages/design-core/src/preview/src/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ export const initPreview = ({ registry, lifeCycles = {} }) => {
3030
initSvgs(app)
3131

3232
app.mount('#app')
33+
34+
return app
3335
}

packages/design-core/src/preview/src/preview/importMap.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
*
1111
*/
1212

13-
import { useEnv } from '@opentiny/tiny-engine-meta-register'
13+
import { useEnv, getMergeMeta } from '@opentiny/tiny-engine-meta-register'
1414
import { importMapConfig as importMapJSON } from '@opentiny/tiny-engine-common/js/importMap'
1515

1616
const importMap = {}
1717
const opentinyVueVersion = '~3.20'
1818

19-
function replacePlaceholder(v) {
19+
function replacePlaceholder(v, k) {
2020
const {
2121
VITE_CDN_TYPE,
2222
VITE_CDN_DOMAIN,
@@ -28,6 +28,14 @@ function replacePlaceholder(v) {
2828
const versionDelimiter = VITE_CDN_TYPE === 'npmmirror' && !isLocalBundle ? '/' : '@'
2929
const fileDelimiter = VITE_CDN_TYPE === 'npmmirror' && !isLocalBundle ? '/files' : ''
3030
const cdnDomain = isLocalBundle ? BASE_URL + VITE_LOCAL_IMPORT_PATH : VITE_CDN_DOMAIN
31+
const customImportMap = getMergeMeta('engine.config')?.importMap
32+
33+
if (customImportMap?.imports?.[k]) {
34+
return customImportMap.imports[k]
35+
.replace('${VITE_CDN_DOMAIN}', cdnDomain)
36+
.replace('${versionDelimiter}', versionDelimiter)
37+
.replace('${fileDelimiter}', fileDelimiter)
38+
}
3139

3240
return v
3341
.replace('${VITE_CDN_DOMAIN}', cdnDomain)
@@ -38,7 +46,7 @@ function replacePlaceholder(v) {
3846

3947
export const getImportMap = (scripts = {}) => {
4048
importMap.imports = {
41-
...Object.fromEntries(Object.entries(importMapJSON.imports).map(([k, v]) => [k, replacePlaceholder(v)])),
49+
...Object.fromEntries(Object.entries(importMapJSON.imports).map(([k, v]) => [k, replacePlaceholder(v, k)])),
4250
...scripts
4351
}
4452

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",

0 commit comments

Comments
 (0)