提交 4980fea9 编写于 作者: fxy060608's avatar fxy060608

build(deps): bump vite from 2.9.7 to 2.9.8

上级 77f38001
......@@ -13,7 +13,7 @@
"@dcloudio/uni-components": "../../uni-components",
"@dcloudio/uni-h5": "../../uni-h5",
"vue": "3.2.33",
"vue-router": "^4.0.14",
"vue-router": "^4.0.15",
"vuex": "^4.0.2"
},
"devDependencies": {
......@@ -21,6 +21,6 @@
"compression": "^1.7.4",
"cypress": "^7.3.0",
"serve-static": "^1.14.1",
"vite": "^2.9.7"
"vite": "^2.9.8"
}
}
......@@ -29,7 +29,7 @@
"@dcloudio/uni-shared": "3.0.0-alpha-3040820220424001",
"@dcloudio/uts": "3.0.0-alpha-3040820220424001",
"@rollup/pluginutils": "^4.2.0",
"@vitejs/plugin-vue": "^2.3.1",
"@vitejs/plugin-vue": "^2.3.2",
"@vue/compiler-dom": "3.2.33",
"@vue/compiler-sfc": "3.2.33",
"cac": "6.7.9",
......
......@@ -83,6 +83,7 @@ export const cssLangRE = new RegExp(cssLangs)
const cssModuleRE = new RegExp(`\\.module${cssLangs}`)
const directRequestRE = /(\?|&)direct\b/
export const commonjsProxyRE = /\?commonjs-proxy/
const varRE = /^var\(/i
const enum PreprocessLang {
less = 'less',
......@@ -558,8 +559,8 @@ async function compileCSS(
.default(postcssPlugins)
.process(code, {
...postcssOptions,
to: cleanUrl(id),
from: cleanUrl(id),
to: id,
from: id,
map: {
inline: false,
annotation: false,
......@@ -737,7 +738,7 @@ type CssUrlReplacer = (
// https://drafts.csswg.org/css-syntax-3/#identifier-code-point
export const cssUrlRE =
/(?<=^|[^\w\-\u0080-\uffff])url\(\s*('[^']+'|"[^"]+"|[^'")]+)\s*\)/
const cssImageSetRE = /image-set\(([^)]+)\)/
const cssImageSetRE = /(?<=image-set\()((?:[\w\-]+\([^\)]*\)|[^)])*)(?=\))/
const UrlRewritePostcssPlugin: Postcss.PluginCreator<{
replacer: CssUrlReplacer
......@@ -758,7 +759,9 @@ const UrlRewritePostcssPlugin: Postcss.PluginCreator<{
const importer = declaration.source?.input.file
return opts.replacer(rawUrl, importer)
}
const rewriterToUse = isCssUrl ? rewriteCssUrls : rewriteCssImageSet
const rewriterToUse = isCssImageSet
? rewriteCssImageSet
: rewriteCssUrls
promises.push(
rewriterToUse(declaration.value, replacerForDeclaration).then(
(url) => {
......@@ -780,9 +783,16 @@ function rewriteCssUrls(
css: string,
replacer: CssUrlReplacer
): Promise<string> {
return asyncReplace(css, cssUrlRE, async (match) => {
const [matched, rawUrl] = match
return await doUrlReplace(rawUrl, matched, replacer)
return asyncReplace(css, cssImageSetRE, async (match) => {
const [, rawUrl] = match
const url = await processSrcSet(rawUrl, async ({ url }) => {
// the url maybe url(...)
if (cssUrlRE.test(url)) {
return await rewriteCssUrls(url, replacer)
}
return await doUrlReplace(url, url, replacer)
})
return url
})
}
......@@ -809,7 +819,12 @@ async function doUrlReplace(
wrap = first
rawUrl = rawUrl.slice(1, -1)
}
if (isExternalUrl(rawUrl) || isDataUrl(rawUrl) || rawUrl.startsWith('#')) {
if (
isExternalUrl(rawUrl) ||
isDataUrl(rawUrl) ||
rawUrl.startsWith('#') ||
varRE.test(rawUrl)
) {
return matched
}
......
......@@ -126,6 +126,7 @@ interface ImageCandidate {
descriptor: string
}
const escapedSpaceCharacters = /( |\\t|\\n|\\f|\\r)+/g
const imageSetUrlRE = /^(?:[\w\-]+\(.*?\)|'.*?'|".*?"|\S*)/
export async function processSrcSet(
srcs: string,
replacer: (arg: ImageCandidate) => Promise<string>
......@@ -133,11 +134,13 @@ export async function processSrcSet(
const imageCandidates: ImageCandidate[] = srcs
.split(',')
.map((s) => {
const [url, descriptor] = s
.replace(escapedSpaceCharacters, ' ')
.trim()
.split(' ', 2)
return { url, descriptor }
const src = s.replace(escapedSpaceCharacters, ' ').trim()
const [url] = imageSetUrlRE.exec(src) || []
return {
url,
descriptor: src?.slice(url.length).trim(),
}
})
.filter(({ url }) => !!url)
......
......@@ -37,7 +37,7 @@
"@vue/shared": "3.2.33",
"localstorage-polyfill": "^1.0.1",
"safe-area-insets": "^1.4.1",
"vue-router": "^4.0.14",
"vue-router": "^4.0.15",
"xmlhttprequest": "^1.8.0"
},
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
......
......@@ -29,7 +29,7 @@
"@dcloudio/uni-shared": "3.0.0-alpha-3040820220424001",
"@rollup/pluginutils": "^4.2.0",
"@vitejs/plugin-legacy": "^1.8.2",
"@vitejs/plugin-vue": "^2.3.1",
"@vitejs/plugin-vue": "^2.3.2",
"@vitejs/plugin-vue-jsx": "^1.3.10",
"@vue/compiler-core": "3.2.33",
"@vue/compiler-dom": "3.2.33",
......@@ -54,7 +54,7 @@
"chokidar": "^3.5.3"
},
"peerDependencies": {
"vite": "^2.9.7"
"vite": "^2.9.8"
},
"uni-app": {
"compilerVersion": "3.4.8"
......
......@@ -20,7 +20,7 @@ importers:
'@types/jest': ^26.0.23
'@types/node': ^17.0.31
'@typescript-eslint/parser': ^5.14.0
'@vitejs/plugin-vue': ^2.3.1
'@vitejs/plugin-vue': ^2.3.2
'@vitejs/plugin-vue-jsx': ^1.3.10
'@vue/reactivity': 3.2.33
'@vue/runtime-core': 3.2.33
......@@ -48,9 +48,9 @@ importers:
semver: ^7.3.5
ts-jest: ^27.0.3
typescript: 4.6.4
vite: ^2.9.7
vite: ^2.9.8
vue: 3.2.33
vue-router: ^4.0.14
vue-router: ^4.0.15
yorkie: ^2.0.0
devDependencies:
'@babel/preset-env': 7.17.10
......@@ -111,9 +111,9 @@ importers:
compression: ^1.7.4
cypress: ^7.3.0
serve-static: ^1.14.1
vite: ^2.9.7
vite: ^2.9.8
vue: 3.2.33
vue-router: ^4.0.14
vue-router: ^4.0.15
vuex: ^4.0.2
dependencies:
'@dcloudio/uni-app': link:../../uni-app
......@@ -212,7 +212,7 @@ importers:
'@rollup/pluginutils': ^4.2.0
'@types/debug': ^4.1.7
'@types/fs-extra': ^9.0.13
'@vitejs/plugin-vue': ^2.3.1
'@vitejs/plugin-vue': ^2.3.2
'@vue/compiler-core': 3.2.33
'@vue/compiler-dom': 3.2.33
'@vue/compiler-sfc': 3.2.33
......@@ -441,7 +441,7 @@ importers:
localstorage-polyfill: ^1.0.1
safe-area-insets: ^1.4.1
vue: 3.2.33
vue-router: ^4.0.14
vue-router: ^4.0.15
xmlhttprequest: ^1.8.0
dependencies:
'@dcloudio/uni-h5-vite': link:../uni-h5-vite
......@@ -794,7 +794,7 @@ importers:
'@types/fs-extra': ^9.0.13
'@types/sass': ^1.16.0
'@vitejs/plugin-legacy': ^1.8.2
'@vitejs/plugin-vue': ^2.3.1
'@vitejs/plugin-vue': ^2.3.2
'@vitejs/plugin-vue-jsx': ^1.3.10
'@vue/babel-plugin-jsx': ^1.1.1
'@vue/compiler-core': 3.2.33
......
......@@ -13,22 +13,22 @@ const pkgs = {
latest: '3.2.33',
},
'vue-router': {
latest: '4.0.14',
latest: '4.0.15',
},
vuex: {
latest: '4.0.2',
},
pinia: {
latest: '2.0.13',
latest: '2.0.14',
},
'vue-i18n': {
next: '9.1.9',
},
vite: {
latest: '2.9.7',
latest: '2.9.8',
},
'@vitejs/plugin-vue': {
latest: '2.3.1',
latest: '2.3.2',
},
'@vitejs/plugin-vue-jsx': {
latest: '1.3.10',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册