mirror of
https://github.com/vitejs/vite.git
synced 2024-11-21 14:48:41 +00:00
refactor: remove unnecessary escape (#18044)
This commit is contained in:
parent
7cac03fa51
commit
8062d36773
@ -67,7 +67,6 @@ export default tseslint.config(
|
||||
'no-debugger': ['error'],
|
||||
'no-empty': ['warn', { allowEmptyCatch: true }],
|
||||
'no-process-exit': 'off',
|
||||
'no-useless-escape': 'off',
|
||||
'prefer-const': [
|
||||
'warn',
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ describe('parse positives', async () => {
|
||||
it('basic', async () => {
|
||||
expect(
|
||||
await run(`
|
||||
import.meta.glob(\'./modules/*.ts\')
|
||||
import.meta.glob('./modules/*.ts')
|
||||
`),
|
||||
).toMatchInlineSnapshot(`
|
||||
[
|
||||
@ -45,7 +45,7 @@ describe('parse positives', async () => {
|
||||
it('array', async () => {
|
||||
expect(
|
||||
await run(`
|
||||
import.meta.glob([\'./modules/*.ts\', './dir/*.{js,ts}\'])
|
||||
import.meta.glob(['./modules/*.ts', './dir/*.{js,ts}'])
|
||||
`),
|
||||
).toMatchInlineSnapshot(`
|
||||
[
|
||||
@ -65,7 +65,7 @@ describe('parse positives', async () => {
|
||||
expect(
|
||||
await run(`
|
||||
import.meta.glob([
|
||||
\'./modules/*.ts\',
|
||||
'./modules/*.ts',
|
||||
"!./dir/*.{js,ts}"
|
||||
], {
|
||||
eager: true,
|
||||
|
@ -1653,7 +1653,7 @@ export const cssDataUriRE =
|
||||
export const importCssRE = /@import ('[^']+\.css'|"[^"]+\.css"|[^'")]+\.css)/
|
||||
// Assuming a function name won't be longer than 256 chars
|
||||
// eslint-disable-next-line regexp/no-unused-capturing-group -- doesn't detect asyncReplace usage
|
||||
const cssImageSetRE = /(?<=image-set\()((?:[\w\-]{1,256}\([^)]*\)|[^)])*)(?=\))/
|
||||
const cssImageSetRE = /(?<=image-set\()((?:[\w-]{1,256}\([^)]*\)|[^)])*)(?=\))/
|
||||
|
||||
const UrlRewritePostcssPlugin: PostCSS.PluginCreator<{
|
||||
replacer: CssUrlReplacer
|
||||
|
@ -725,7 +725,7 @@ interface ImageCandidate {
|
||||
descriptor: string
|
||||
}
|
||||
const escapedSpaceCharacters = /(?: |\\t|\\n|\\f|\\r)+/g
|
||||
const imageSetUrlRE = /^(?:[\w\-]+\(.*?\)|'.*?'|".*?"|\S*)/
|
||||
const imageSetUrlRE = /^(?:[\w-]+\(.*?\)|'.*?'|".*?"|\S*)/
|
||||
function joinSrcset(ret: ImageCandidate[]) {
|
||||
return ret
|
||||
.map(({ url, descriptor }) => url + (descriptor ? ` ${descriptor}` : ''))
|
||||
@ -773,7 +773,7 @@ export function processSrcSetSync(
|
||||
}
|
||||
|
||||
const cleanSrcSetRE =
|
||||
/(?:url|image|gradient|cross-fade)\([^)]*\)|"([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'|data:\w+\/[\w.+\-]+;base64,[\w+/=]+|\?\S+,/g
|
||||
/(?:url|image|gradient|cross-fade)\([^)]*\)|"([^"]|(?<=\\)")*"|'([^']|(?<=\\)')*'|data:\w+\/[\w.+-]+;base64,[\w+/=]+|\?\S+,/g
|
||||
function splitSrcSet(srcs: string) {
|
||||
const parts: string[] = []
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user