From 7476a709142fa45110ec32eae437414e6315638e Mon Sep 17 00:00:00 2001 From: yaoyun8 Date: Sun, 24 Dec 2023 22:37:57 -0800 Subject: [PATCH 1/7] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dunpkg=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/design-core/public/mock/bundle.json | 24 ++++++------ .../src/preview/src/preview/importMap.js | 37 +++++++++--------- packages/design-core/vite.config.js | 38 +++++++++---------- 3 files changed, 47 insertions(+), 52 deletions(-) diff --git a/packages/design-core/public/mock/bundle.json b/packages/design-core/public/mock/bundle.json index 1b79e42470..09b0d6c2a5 100644 --- a/packages/design-core/public/mock/bundle.json +++ b/packages/design-core/public/mock/bundle.json @@ -20,8 +20,8 @@ "npm": { "package": "element-plus", "version": "2.4.2", - "script": "https://unpkg.com/element-plus@2.4.2/dist/index.full.mjs", - "css": "https://unpkg.com/element-plus@2.4.2/dist/index.css", + "script": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.full.mjs", + "css": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.css", "dependencies": null, "exportName": "ElInput" }, @@ -300,8 +300,8 @@ "npm": { "package": "element-plus", "version": "2.4.2", - "script": "https://unpkg.com/element-plus@2.4.2/dist/index.full.mjs", - "css": "https://unpkg.com/element-plus@2.4.2/dist/index.css", + "script": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.full.mjs", + "css": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.css", "dependencies": null, "exportName": "ElButton" }, @@ -621,8 +621,8 @@ "npm": { "package": "element-plus", "version": "2.4.2", - "script": "https://unpkg.com/element-plus@2.4.2/dist/index.full.mjs", - "css": "https://unpkg.com/element-plus@2.4.2/dist/index.css", + "script": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.full.mjs", + "css": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.css", "dependencies": null, "exportName": "ElForm" }, @@ -1078,8 +1078,8 @@ "npm": { "package": "element-plus", "version": "2.4.2", - "script": "https://unpkg.com/element-plus@2.4.2/dist/index.full.mjs", - "css": "https://unpkg.com/element-plus@2.4.2/dist/index.css", + "script": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.full.mjs", + "css": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.css", "dependencies": null, "exportName": "ElFormItem" }, @@ -1428,8 +1428,8 @@ "npm": { "package": "element-plus", "version": "2.4.2", - "script": "https://unpkg.com/element-plus@2.4.2/dist/index.full.mjs", - "css": "https://unpkg.com/element-plus@2.4.2/dist/index.css", + "script": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.full.mjs", + "css": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.css", "dependencies": null, "exportName": "ElTable" }, @@ -2664,8 +2664,8 @@ "npm": { "package": "element-plus", "version": "2.4.2", - "script": "https://unpkg.com/element-plus@2.4.2/dist/index.full.mjs", - "css": "https://unpkg.com/element-plus@2.4.2/dist/index.css", + "script": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.full.mjs", + "css": "https://npm.onmicrosoft.cn/element-plus@2.4.2/dist/index.css", "dependencies": null, "exportName": "ElTableColumn" }, diff --git a/packages/design-core/src/preview/src/preview/importMap.js b/packages/design-core/src/preview/src/preview/importMap.js index c04220ebae..e7b97bd35e 100644 --- a/packages/design-core/src/preview/src/preview/importMap.js +++ b/packages/design-core/src/preview/src/preview/importMap.js @@ -18,30 +18,29 @@ const importMap = {} const tinyVue3Imports = { // 推荐之后统一使用@opentiny/vue去引入依赖,兼容后续录入的组件来源于tiny-vue - '@opentiny/vue': 'https://registry.npmmirror.com/@opentiny/vue/3.11/files/runtime/tiny-vue.mjs', - '@opentiny/vue-icon': 'https://registry.npmmirror.com/@opentiny/vue/3.11/files/runtime/tiny-vue-icon.mjs', - '@opentiny/vue-common': 'https://registry.npmmirror.com/@opentiny/vue/3.11/files/runtime/tiny-vue-common.mjs', - '@opentiny/vue-locale': 'https://registry.npmmirror.com/@opentiny/vue/3.11/files/runtime/tiny-vue-locale.mjs', - '@opentiny/vue-renderless/': 'https://esm.sh/@opentiny/vue-renderless@3.11/?raw' + '@opentiny/vue': 'https://npm.onmicrosoft.cn/@opentiny/vue@3/runtime/tiny-vue.mjs', + '@opentiny/vue-icon': 'https://npm.onmicrosoft.cn/@opentiny/vue@3/runtime/tiny-vue-icon.mjs', + '@opentiny/vue-common': 'https://npm.onmicrosoft.cn/@opentiny/vue@3/runtime/tiny-vue-common.mjs', + '@opentiny/vue-locale': 'https://npm.onmicrosoft.cn/@opentiny/vue@3/runtime/tiny-vue-locale.mjs', + '@opentiny/vue-renderless/': 'https://npm.onmicrosoft.cn/@opentiny/vue-renderless@3/' } importMap.imports = { - vue: 'https://registry.npmmirror.com/vue/3.2.36/files/dist/vue.esm-browser.js', - 'vue/server-renderer': - 'https://registry.npmmirror.com/vue/server-renderer/3.2.36/files/dist/server-renderer.esm-browser.js', - 'vue-i18n': 'https://registry.npmmirror.com/vue-i18n/9.2.0/files/dist/vue-i18n.esm-browser.js', - 'vue-router': 'https://registry.npmmirror.com/vue-router/4.0.16/files/dist/vue-router.esm-browser.js', - '@vue/devtools-api': 'https://esm.sh/@vue/devtools-api@6.1.4/lib/esm/index.js?raw', - '@vueuse/core': 'https://registry.npmmirror.com/@vueuse/core/9.6.0/files/index.mjs', - '@vueuse/shared': 'https://registry.npmmirror.com/@vueuse/shared/9.6.0/files/index.mjs', - axios: 'https://registry.npmmirror.com/axios/1.0.0-alpha.1/files/dist/esm/axios.js', - 'axios-mock-adapter': 'https://registry.npmmirror.com/axios-mock-adapter/1.21.1/files/dist/axios-mock-adapter.js', + vue: 'https://npm.onmicrosoft.cn/vue@3.2.36/dist/vue.runtime.esm-browser.js', + 'vue/server-renderer': 'https://npm.onmicrosoft.cn/@vue/server-renderer@3.2.36/dist/server-renderer.esm-browser.js', + 'vue-i18n': 'https://npm.onmicrosoft.cn/vue-i18n@9.2.0-beta.36/dist/vue-i18n.esm-browser.js', + 'vue-router': 'https://npm.onmicrosoft.cn/vue-router@4.0.16/dist/vue-router.esm-browser.js', + '@vue/devtools-api': 'https://npm.onmicrosoft.cn/@vue/devtools-api@6.1.4/lib/esm/index.js', + '@vueuse/core': 'https://npm.onmicrosoft.cn/@vueuse/core@9.6.0/index.mjs', + '@vueuse/shared': 'https://npm.onmicrosoft.cn/@vueuse/shared@9.6.0/index.mjs', + axios: 'https://npm.onmicrosoft.cn/axios@1.0.0-alpha.1/dist/esm/axios.js', + 'axios-mock-adapter': 'https://npm.onmicrosoft.cn/axios-mock-adapter@1.21.1/dist/axios-mock-adapter.js', '@opentiny/tiny-engine-webcomponent-core': - 'https://registry.npmmirror.com/@opentiny/tiny-engine-webcomponent-core/1/files/dist/tiny-engine-webcomponent-core.es.js', + 'https://npm.onmicrosoft.cn/@opentiny/tiny-engine-webcomponent-core@1/dist/tiny-engine-webcomponent-core.es.js', '@opentiny/tiny-engine-i18n-host': - 'https://registry.npmmirror.com/@opentiny/tiny-engine-i18n-host/1/files/dist/tiny-engine-i18n-host.es.js', - 'vue-demi': 'https://registry.npmmirror.com/vue-demi/0.13.11/files/lib/index.mjs', - pinia: 'https://registry.npmmirror.com/pinia/2.0.22/files/dist/pinia.esm-browser.js', + 'https://npm.onmicrosoft.cn/@opentiny/tiny-engine-i18n-host@1/dist/tiny-engine-i18n-host.es.js', + 'vue-demi': 'https://npm.onmicrosoft.cn/vue-demi@0.13.11/lib/index.mjs', + pinia: 'https://npm.onmicrosoft.cn/pinia@2.0.22/dist/pinia.esm-browser.js', ...tinyVue3Imports, ...getSearchParams().scripts } diff --git a/packages/design-core/vite.config.js b/packages/design-core/vite.config.js index 17a43618ab..be3dfe2803 100644 --- a/packages/design-core/vite.config.js +++ b/packages/design-core/vite.config.js @@ -177,7 +177,7 @@ const devAlias = { const devVueAlias = { find: /^vue$/, - replacement: `https://registry.npmmirror.com/vue/${importMapVersions.vue}/files/dist/vue.runtime.esm-browser.js` + replacement: `https://npm.onmicrosoft.cn/vue@${importMapVersions.vue}/dist/vue.runtime.esm-browser.js` } const prodAlias = { @@ -193,25 +193,25 @@ const commonAlias = { const importmap = { imports: { - prettier: `https://unpkg.com/prettier@${importMapVersions.prettier}/esm/standalone.mjs`, - 'prettier/': `https://unpkg.com/prettier@${importMapVersions.prettier}/esm/`, - 'prettier/parser-typescript': `https://unpkg.com/prettier@${importMapVersions.prettier}/esm/parser-typescript.mjs`, - 'prettier/parser-html': `https://unpkg.com/prettier@${importMapVersions.prettier}/esm/parser-html.mjs`, - 'prettier/parser-postcss': `https://unpkg.com/prettier@${importMapVersions.prettier}/esm/parser-postcss.mjs`, - 'prettier/parser-babel': `https://unpkg.com/prettier@${importMapVersions.prettier}/esm/parser-babel.mjs`, + prettier: `https://npm.onmicrosoft.cn/prettier@${importMapVersions.prettier}/esm/standalone.mjs`, + 'prettier/': `https://npm.onmicrosoft.cn/prettier@${importMapVersions.prettier}/esm/`, + 'prettier/parser-typescript': `https://npm.onmicrosoft.cn/prettier@${importMapVersions.prettier}/esm/parser-typescript.mjs`, + 'prettier/parser-html': `https://npm.onmicrosoft.cn/prettier@${importMapVersions.prettier}/esm/parser-html.mjs`, + 'prettier/parser-postcss': `https://npm.onmicrosoft.cn/prettier@${importMapVersions.prettier}/esm/parser-postcss.mjs`, + 'prettier/parser-babel': `https://npm.onmicrosoft.cn/prettier@${importMapVersions.prettier}/esm/parser-babel.mjs`, - vue: `https://unpkg.com/vue@${importMapVersions.vue}/dist/vue.runtime.esm-browser.js`, - '@opentiny/vue': `https://unpkg.com/@opentiny/vue@${importMapVersions.tinyVue}/runtime/tiny-vue.mjs`, - '@opentiny/vue-icon': `https://unpkg.com/@opentiny/vue@${importMapVersions.tinyVue}/runtime/tiny-vue-icon.mjs`, - '@opentiny/vue-common': `https://unpkg.com/@opentiny/vue@${importMapVersions.tinyVue}/runtime/tiny-vue-common.mjs`, - '@opentiny/vue-locale': `https://unpkg.com/@opentiny/vue@${importMapVersions.tinyVue}/runtime/tiny-vue-locale.mjs`, - '@opentiny/vue-design-smb': `https://unpkg.com/@opentiny/vue-design-smb@${importMapVersions.tinyVue}/index.js`, - '@opentiny/vue-theme/theme-tool': `https://unpkg.com/@opentiny/vue-theme@${importMapVersions.tinyVue}/theme-tool`, - '@opentiny/vue-theme/theme': `https://unpkg.com/@opentiny/vue-theme@${importMapVersions.tinyVue}/theme` + vue: `https://npm.onmicrosoft.cn/vue@${importMapVersions.vue}/dist/vue.runtime.esm-browser.js`, + '@opentiny/vue': `https://npm.onmicrosoft.cn/@opentiny/vue@${importMapVersions.tinyVue}/runtime/tiny-vue.mjs`, + '@opentiny/vue-icon': `https://npm.onmicrosoft.cn/@opentiny/vue@${importMapVersions.tinyVue}/runtime/tiny-vue-icon.mjs`, + '@opentiny/vue-common': `https://npm.onmicrosoft.cn/@opentiny/vue@${importMapVersions.tinyVue}/runtime/tiny-vue-common.mjs`, + '@opentiny/vue-locale': `https://npm.onmicrosoft.cn/@opentiny/vue@${importMapVersions.tinyVue}/runtime/tiny-vue-locale.mjs`, + '@opentiny/vue-design-smb': `https://npm.onmicrosoft.cn/@opentiny/vue-design-smb@${importMapVersions.tinyVue}/index.js`, + '@opentiny/vue-theme/theme-tool': `https://npm.onmicrosoft.cn/@opentiny/vue-theme@${importMapVersions.tinyVue}/theme-tool`, + '@opentiny/vue-theme/theme': `https://npm.onmicrosoft.cn/@opentiny/vue-theme@${importMapVersions.tinyVue}/theme` } } -const importMapStyles = [`https://unpkg.com/@opentiny/vue-theme@${importMapVersions.tinyVue}/index.css`] +const importMapStyles = [`https://npm.onmicrosoft.cn/@opentiny/vue-theme@${importMapVersions.tinyVue}/index.css`] export default defineConfig(({ command, mode }) => { const monacoPublicPath = { @@ -270,11 +270,7 @@ export default defineConfig(({ command, mode }) => { } } - config.plugins.push( - monacoEditorPluginInstance, - htmlPlugin(mode), - command === 'build' && importmapPlugin(importmap, importMapStyles) - ) + config.plugins.push(monacoEditorPluginInstance, htmlPlugin(mode), importmapPlugin(importmap, importMapStyles)) return config }) From c1fc068515ae00f4bfc8df8f271392d5f64cbe8a Mon Sep 17 00:00:00 2001 From: yaoyun8 Date: Sun, 24 Dec 2023 23:12:36 -0800 Subject: [PATCH 2/7] =?UTF-8?q?fix=EF=BC=9A=E5=9B=BA=E5=AE=9Aopentiny/vue?= =?UTF-8?q?=E7=9A=84=E6=AC=A1=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design-core/src/preview/src/preview/importMap.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/design-core/src/preview/src/preview/importMap.js b/packages/design-core/src/preview/src/preview/importMap.js index e7b97bd35e..cf2c884c17 100644 --- a/packages/design-core/src/preview/src/preview/importMap.js +++ b/packages/design-core/src/preview/src/preview/importMap.js @@ -16,13 +16,15 @@ import { getSearchParams } from './http' const importMap = {} +const opentinyVueVersion = '~3.11' + const tinyVue3Imports = { // 推荐之后统一使用@opentiny/vue去引入依赖,兼容后续录入的组件来源于tiny-vue - '@opentiny/vue': 'https://npm.onmicrosoft.cn/@opentiny/vue@3/runtime/tiny-vue.mjs', - '@opentiny/vue-icon': 'https://npm.onmicrosoft.cn/@opentiny/vue@3/runtime/tiny-vue-icon.mjs', - '@opentiny/vue-common': 'https://npm.onmicrosoft.cn/@opentiny/vue@3/runtime/tiny-vue-common.mjs', - '@opentiny/vue-locale': 'https://npm.onmicrosoft.cn/@opentiny/vue@3/runtime/tiny-vue-locale.mjs', - '@opentiny/vue-renderless/': 'https://npm.onmicrosoft.cn/@opentiny/vue-renderless@3/' + '@opentiny/vue': `https://npm.onmicrosoft.cn/@opentiny/vue@${opentinyVueVersion}/runtime/tiny-vue.mjs`, + '@opentiny/vue-icon': `https://npm.onmicrosoft.cn/@opentiny/vue@${opentinyVueVersion}/runtime/tiny-vue-icon.mjs`, + '@opentiny/vue-common': `https://npm.onmicrosoft.cn/@opentiny/vue@${opentinyVueVersion}/runtime/tiny-vue-common.mjs`, + '@opentiny/vue-locale': `https://npm.onmicrosoft.cn/@opentiny/vue@${opentinyVueVersion}/runtime/tiny-vue-locale.mjs`, + '@opentiny/vue-renderless/': `https://npm.onmicrosoft.cn/@opentiny/vue-renderless@${opentinyVueVersion}/` } importMap.imports = { From 7481e71dafdffb6708b7b5f863c0c8a11f190056 Mon Sep 17 00:00:00 2001 From: yaoyun8 Date: Mon, 25 Dec 2023 02:22:44 -0800 Subject: [PATCH 3/7] =?UTF-8?q?fix=EF=BC=9A=E5=8D=87=E7=BA=A7devtools-api?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/design-core/src/preview/src/preview/importMap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/design-core/src/preview/src/preview/importMap.js b/packages/design-core/src/preview/src/preview/importMap.js index cf2c884c17..371267320b 100644 --- a/packages/design-core/src/preview/src/preview/importMap.js +++ b/packages/design-core/src/preview/src/preview/importMap.js @@ -32,7 +32,7 @@ importMap.imports = { 'vue/server-renderer': 'https://npm.onmicrosoft.cn/@vue/server-renderer@3.2.36/dist/server-renderer.esm-browser.js', 'vue-i18n': 'https://npm.onmicrosoft.cn/vue-i18n@9.2.0-beta.36/dist/vue-i18n.esm-browser.js', 'vue-router': 'https://npm.onmicrosoft.cn/vue-router@4.0.16/dist/vue-router.esm-browser.js', - '@vue/devtools-api': 'https://npm.onmicrosoft.cn/@vue/devtools-api@6.1.4/lib/esm/index.js', + '@vue/devtools-api': 'https://npm.onmicrosoft.cn/@vue/devtools-api@6.5.1/lib/esm/index.js', '@vueuse/core': 'https://npm.onmicrosoft.cn/@vueuse/core@9.6.0/index.mjs', '@vueuse/shared': 'https://npm.onmicrosoft.cn/@vueuse/shared@9.6.0/index.mjs', axios: 'https://npm.onmicrosoft.cn/axios@1.0.0-alpha.1/dist/esm/axios.js', From 447588ef1dfd9d23b1ce229fd33a155b9fc2262c Mon Sep 17 00:00:00 2001 From: yaoyun8 Date: Mon, 25 Dec 2023 04:33:13 -0800 Subject: [PATCH 4/7] =?UTF-8?q?fix=EF=BC=9ACDN=E5=9F=9F=E5=90=8D=E6=8F=90?= =?UTF-8?q?=E5=8F=96=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vite.config.js | 2 +- packages/common/js/environments.js | 1 + packages/design-core/.env.alpha | 1 + packages/design-core/.env.development | 1 + packages/design-core/.env.prod | 1 + packages/design-core/canvas.html | 2 +- .../src/preview/src/preview/importMap.js | 39 ++++++------ .../src/preview/src/preview/srcFiles/app.js | 4 +- packages/design-core/vite.config.js | 60 ++++++++++--------- 9 files changed, 59 insertions(+), 52 deletions(-) diff --git a/packages/blockToWebComponentTemplate/vite.config.js b/packages/blockToWebComponentTemplate/vite.config.js index db65f1cc6a..0b5b45162e 100644 --- a/packages/blockToWebComponentTemplate/vite.config.js +++ b/packages/blockToWebComponentTemplate/vite.config.js @@ -43,7 +43,7 @@ export default defineConfig(({ command, mode }) => { } const vuePluginConfig = {} - const styleLinks = ['https://registry.npmmirror.com/@opentiny/vue-theme/3.11/files/index.css'] + const styleLinks = ['https://npm.onmicrosoft.cn/@opentiny/vue-theme@3/index.css'] config.publicDir = false diff --git a/packages/common/js/environments.js b/packages/common/js/environments.js index f0613e4f31..9da87a6cfb 100644 --- a/packages/common/js/environments.js +++ b/packages/common/js/environments.js @@ -15,6 +15,7 @@ export const PROD = import.meta.env.PROD export const BASE_URL = import.meta.env.BASE_URL export const VITE_ORIGIN = import.meta.env.VITE_ORIGIN export const VITE_API_MOCK = import.meta.env.VITE_API_MOCK +export const VITE_CDN_DOMAIN = import.meta.env.VITE_CDN_DOMAIN export const isMock = VITE_API_MOCK === 'mock' diff --git a/packages/design-core/.env.alpha b/packages/design-core/.env.alpha index 86332d8efa..02380022ae 100644 --- a/packages/design-core/.env.alpha +++ b/packages/design-core/.env.alpha @@ -1,4 +1,5 @@ # alpha mode, used by the "build:alpha" script NODE_ENV=production +VITE_CDN_DOMAIN=https://npm.onmicrosoft.cn # VITE_ORIGIN= diff --git a/packages/design-core/.env.development b/packages/design-core/.env.development index 416620797c..05e65af31b 100644 --- a/packages/design-core/.env.development +++ b/packages/design-core/.env.development @@ -1,5 +1,6 @@ # development mode, used by the "vite" command NODE_ENV=development +VITE_CDN_DOMAIN=https://npm.onmicrosoft.cn # request data via alpha service # VITE_ORIGIN= \ No newline at end of file diff --git a/packages/design-core/.env.prod b/packages/design-core/.env.prod index 5ddb7273d7..00c129ad60 100644 --- a/packages/design-core/.env.prod +++ b/packages/design-core/.env.prod @@ -1,4 +1,5 @@ # prod mode, used by the "build:prod" script NODE_ENV=production +VITE_CDN_DOMAIN=https://npm.onmicrosoft.cn #VITE_ORIGIN= \ No newline at end of file diff --git a/packages/design-core/canvas.html b/packages/design-core/canvas.html index c07062ef32..dd9b6b658c 100644 --- a/packages/design-core/canvas.html +++ b/packages/design-core/canvas.html @@ -4,7 +4,7 @@ - +