mirror of
https://github.com/vitejs/vite.git
synced 2024-11-22 07:09:05 +00:00
refactor: use types from sass instead of @types/sass (#16340)
This commit is contained in:
parent
5647d07819
commit
4581e8371d
@ -55,7 +55,6 @@
|
||||
"@types/micromatch": "^4.0.6",
|
||||
"@types/node": "^20.11.30",
|
||||
"@types/picomatch": "^2.3.3",
|
||||
"@types/sass": "~1.43.1",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/stylus": "^0.48.42",
|
||||
"@types/ws": "^8.5.10",
|
||||
|
@ -144,6 +144,7 @@
|
||||
"rollup-plugin-dts": "^6.1.0",
|
||||
"rollup-plugin-esbuild": "^6.1.1",
|
||||
"rollup-plugin-license": "^3.3.1",
|
||||
"sass": "^1.72.0",
|
||||
"sirv": "^2.0.4",
|
||||
"source-map-support": "^0.5.21",
|
||||
"strip-ansi": "^7.1.0",
|
||||
|
@ -1913,7 +1913,8 @@ type StylePreprocessorOptions = {
|
||||
enableSourcemap: boolean
|
||||
}
|
||||
|
||||
type SassStylePreprocessorOptions = StylePreprocessorOptions & Sass.Options
|
||||
type SassStylePreprocessorOptions = StylePreprocessorOptions &
|
||||
Omit<Sass.LegacyOptions<'async'>, 'data' | 'file' | 'outFile'>
|
||||
|
||||
type StylusStylePreprocessorOptions = StylePreprocessorOptions & {
|
||||
define?: Record<string, any>
|
||||
@ -2017,8 +2018,8 @@ function cleanScssBugUrl(url: string) {
|
||||
}
|
||||
|
||||
function fixScssBugImportValue(
|
||||
data: Sass.ImporterReturnType,
|
||||
): Sass.ImporterReturnType {
|
||||
data: Sass.LegacyImporterResult,
|
||||
): Sass.LegacyImporterResult {
|
||||
// the scss bug doesn't load files properly so we have to load it ourselves
|
||||
// to prevent internal error when it loads itself
|
||||
if (
|
||||
@ -2081,7 +2082,11 @@ const makeScssWorker = (
|
||||
|
||||
// NOTE: `sass` always runs it's own importer first, and only falls back to
|
||||
// the `importer` option when it can't resolve a path
|
||||
const _internalImporter: Sass.Importer = (url, importer, done) => {
|
||||
const _internalImporter: Sass.LegacyAsyncImporter = (
|
||||
url,
|
||||
importer,
|
||||
done,
|
||||
) => {
|
||||
internalImporter(url, importer, options.filename).then((data) =>
|
||||
done?.(data),
|
||||
)
|
||||
@ -2093,7 +2098,7 @@ const makeScssWorker = (
|
||||
: importer.unshift(options.importer)
|
||||
}
|
||||
|
||||
const finalOptions: Sass.Options = {
|
||||
const finalOptions: Sass.LegacyOptions<'async'> = {
|
||||
...options,
|
||||
data,
|
||||
file: options.filename,
|
||||
@ -2110,16 +2115,16 @@ const makeScssWorker = (
|
||||
return new Promise<{
|
||||
css: string
|
||||
map?: string | undefined
|
||||
stats: Sass.Result['stats']
|
||||
stats: Sass.LegacyResult['stats']
|
||||
}>((resolve, reject) => {
|
||||
sass.render(finalOptions, (err, res) => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
} else {
|
||||
resolve({
|
||||
css: res.css.toString(),
|
||||
map: res.map?.toString(),
|
||||
stats: res.stats,
|
||||
css: res!.css.toString(),
|
||||
map: res!.map?.toString(),
|
||||
stats: res!.stats,
|
||||
})
|
||||
}
|
||||
})
|
||||
@ -2213,7 +2218,7 @@ async function rebaseUrls(
|
||||
alias: Alias[],
|
||||
variablePrefix: string,
|
||||
resolver: ResolveFn,
|
||||
): Promise<Sass.ImporterReturnType> {
|
||||
): Promise<Sass.LegacyImporterResult> {
|
||||
file = path.resolve(file) // ensure os-specific flashes
|
||||
// in the same dir, no need to rebase
|
||||
const fileDir = path.dirname(file)
|
||||
|
@ -66,9 +66,6 @@ importers:
|
||||
'@types/picomatch':
|
||||
specifier: ^2.3.3
|
||||
version: 2.3.3
|
||||
'@types/sass':
|
||||
specifier: ~1.43.1
|
||||
version: 1.43.1
|
||||
'@types/semver':
|
||||
specifier: ^7.5.8
|
||||
version: 7.5.8
|
||||
@ -405,6 +402,9 @@ importers:
|
||||
rollup-plugin-license:
|
||||
specifier: ^3.3.1
|
||||
version: 3.3.1(rollup@4.13.0)
|
||||
sass:
|
||||
specifier: ^1.72.0
|
||||
version: 1.72.0
|
||||
sirv:
|
||||
specifier: ^2.0.4
|
||||
version: 2.0.4(patch_hash=amdes53ifqfntejkflpaq5ifce)
|
||||
@ -4360,12 +4360,6 @@ packages:
|
||||
resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==}
|
||||
dev: true
|
||||
|
||||
/@types/sass@1.43.1:
|
||||
resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.30
|
||||
dev: true
|
||||
|
||||
/@types/semver@7.5.8:
|
||||
resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==}
|
||||
dev: true
|
||||
@ -4639,7 +4633,7 @@ packages:
|
||||
'@vue/shared': 3.4.21
|
||||
entities: 4.5.0
|
||||
estree-walker: 2.0.2
|
||||
source-map-js: 1.0.2
|
||||
source-map-js: 1.2.0
|
||||
|
||||
/@vue/compiler-dom@3.2.0:
|
||||
resolution: {integrity: sha512-CqfATmX04+58LNBTTUPRBLyYGLP0bxtL+8b7B8pEvXja7fpmxiYcKBQsdaXfyqoRJsaTzA7eVXQt/t0dYhu/SQ==}
|
||||
@ -4665,7 +4659,7 @@ packages:
|
||||
estree-walker: 2.0.2
|
||||
magic-string: 0.30.8
|
||||
postcss: 8.4.38
|
||||
source-map-js: 1.0.2
|
||||
source-map-js: 1.2.0
|
||||
|
||||
/@vue/compiler-ssr@3.4.21:
|
||||
resolution: {integrity: sha512-M5+9nI2lPpAsgXOGQobnIueVqc9sisBFexh5yMIMRAPYLa7+5wEJs8iqOZc1WAa9WQbx9GR2twgznU8LTIiZ4Q==}
|
||||
@ -9168,7 +9162,7 @@ packages:
|
||||
dependencies:
|
||||
chokidar: 3.6.0(patch_hash=bckcfsslxcffppz65mxcq6naau)
|
||||
immutable: 4.0.0
|
||||
source-map-js: 1.0.2
|
||||
source-map-js: 1.2.0
|
||||
dev: true
|
||||
|
||||
/sax@1.3.0:
|
||||
@ -9348,10 +9342,6 @@ packages:
|
||||
is-fullwidth-code-point: 5.0.0
|
||||
dev: true
|
||||
|
||||
/source-map-js@1.0.2:
|
||||
resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
/source-map-js@1.2.0:
|
||||
resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
Loading…
Reference in New Issue
Block a user