Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(chore): replace unpkg with npmmirror #149

Merged
merged 9 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/design-core/canvas.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://unpkg.com/@opentiny/vue-theme@3/index.css" rel="stylesheet" />
<link href="https://registry.npmmirror.com/@opentiny/vue-theme/3.10/files/index.css" rel="stylesheet" />
<style type="text/css">
.loading-warp {
display: flex;
Expand Down
2 changes: 2 additions & 0 deletions packages/design-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"@opentiny/tiny-engine-webcomponent-core": "workspace:^1.0.0",
"@opentiny/vue": "~3.10.0",
"@opentiny/vue-design-smb": "~3.10.0",
"@opentiny/vue-renderless": "~3.10.0",
"@opentiny/vue-theme": "~3.10.0",
"@vue/babel-plugin-jsx": "1.1.1",
"@vue/repl": "^1.3.0",
Expand All @@ -97,6 +98,7 @@
"xlsx": "^0.18.5"
},
"devDependencies": {
"@opentiny/tiny-engine-i18n-host": "workspace:*",
"@babel/eslint-parser": "^7.21.3",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
Expand Down
25 changes: 13 additions & 12 deletions packages/design-core/src/preview/src/preview/importMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,22 @@ const tinyVue3Imports = {
}

importMap.imports = {
vue: 'https://unpkg.com/[email protected]/dist/vue.runtime.esm-browser.js',
'vue/server-renderer': 'https://unpkg.com/@vue/[email protected]/dist/server-renderer.esm-browser.js',
'vue-i18n': 'https://unpkg.com/[email protected]/dist/vue-i18n.esm-browser.js',
'vue-router': 'https://unpkg.com/[email protected]/dist/vue-router.esm-browser.js',
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://unpkg.com/@vue/[email protected]/lib/esm/index.js',
'@vueuse/core': 'https://unpkg.com/@vueuse/core@9.6.0/index.mjs',
'@vueuse/shared': 'https://unpkg.com/@vueuse/shared@9.6.0/index.mjs',
axios: 'https://unpkg.com/axios@1.0.0-alpha.1/dist/esm/axios.js',
'axios-mock-adapter': 'https://unpkg.com/axios-mock-adapter@1.21.1/dist/axios-mock-adapter.js',
'@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',
'@opentiny/tiny-engine-webcomponent-core':
'https://unpkg.com/@opentiny/tiny-engine-webcomponent-core@1/dist/tiny-engine-webcomponent-core.es.js',
'https://registry.npmmirror.com/@opentiny/tiny-engine-webcomponent-core/1/files/dist/tiny-engine-webcomponent-core.es.js',
'@opentiny/tiny-engine-i18n-host':
'https://unpkg.com/@opentiny/tiny-engine-i18n-host@1/dist/tiny-engine-i18n-host.es.js',
'vue-demi': 'https://unpkg.com/vue-demi@0.13.11/lib/index.mjs',
pinia: 'https://unpkg.com/pinia@2.0.22/dist/pinia.esm-browser.js',
'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',
...tinyVue3Imports,
...getSearchParams().scripts
}
Expand Down
24 changes: 12 additions & 12 deletions packages/design-core/src/preview/src/preview/srcFiles/app.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/**
* Copyright (c) 2023 - present TinyEngine Authors.
* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
* Copyright (c) 2023 - present TinyEngine Authors.
* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/

function addCss(href) {
const link = document.createElement('link')
link.setAttribute('rel', 'stylesheet')
link.setAttribute('href', href)
document.head.appendChild(link)
}
addCss('https://unpkg.com/@opentiny/vue-theme@3/index.css')
addCss('https://unpkg.com/@opentiny/vue-theme-mobile@3/index.css')
addCss('https://registry.npmmirror.com/@opentiny/vue-theme/3.10/files/index.css')
addCss('https://registry.npmmirror.com/@opentiny/vue-theme-mobile/3.10/files/index.css')
8 changes: 6 additions & 2 deletions packages/design-core/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ const devAlias = {

const devVueAlias = {
find: /^vue$/,
replacement: `https://unpkg.com/vue@${importMapVersions.vue}/dist/vue.runtime.esm-browser.js`
replacement: `https://registry.npmmirror.com/vue/${importMapVersions.vue}/files/dist/vue.runtime.esm-browser.js`
}

const prodAlias = {
Expand Down Expand Up @@ -270,7 +270,11 @@ export default defineConfig(({ command, mode }) => {
}
}

config.plugins.push(monacoEditorPluginInstance, htmlPlugin(mode), importmapPlugin(importmap, importMapStyles))
config.plugins.push(
monacoEditorPluginInstance,
htmlPlugin(mode),
command === 'build' && importmapPlugin(importmap, importMapStyles)
)

return config
})