Comparing version 0.20.7 to 0.20.8
@@ -0,1 +1,11 @@ | ||
## [0.20.8](https://github.com/vuejs/vite/compare/v0.20.7...v0.20.8) (2020-06-11) | ||
### Performance Improvements | ||
* avoid unnecessary css processing when source did not change ([a792610](https://github.com/vuejs/vite/commit/a7926103cbf3854259b23c5906a11c11bd4caa30)), closes [#383](https://github.com/vuejs/vite/issues/383) | ||
* skip rewrite for css requests ([88f411e](https://github.com/vuejs/vite/commit/88f411ef7fd06e4b02485b05515c60aa31c9ffc2)) | ||
## [0.20.7](https://github.com/vuejs/vite/compare/v0.20.6...v0.20.7) (2020-06-08) | ||
@@ -2,0 +12,0 @@ |
@@ -20,3 +20,3 @@ "use strict"; | ||
async transform(css, id) { | ||
if (id.endsWith('.css') || cssUtils_1.cssPreprocessLangRE.test(id)) { | ||
if (cssUtils_1.isCSSRequest(id)) { | ||
// if this is a Vue SFC style request, it's already processed by | ||
@@ -23,0 +23,0 @@ // rollup-plugin-vue and we just need to rewrite URLs + collect it |
@@ -11,3 +11,3 @@ "use strict"; | ||
const path_1 = __importDefault(require("path")); | ||
const isAsset = (id) => id.endsWith('.css') || cssUtils_1.cssPreprocessLangRE.test(id) || utils_1.isStaticAsset(id); | ||
const isAsset = (id) => cssUtils_1.isCSSRequest(id) || utils_1.isStaticAsset(id); | ||
exports.depAssetExternalPlugin = { | ||
@@ -14,0 +14,0 @@ name: 'vite:optimize-dep-assets-external', |
@@ -19,3 +19,3 @@ "use strict"; | ||
// handle .css imports | ||
if ((cssUtils_1.cssPreprocessLangRE.test(ctx.path) || ctx.response.is('css')) && | ||
if (cssUtils_1.isCSSRequest(ctx.path) && | ||
// note ctx.body could be null if upstream set status to 304 | ||
@@ -43,3 +43,3 @@ ctx.body) { | ||
watcher.on('change', (filePath) => { | ||
if (filePath.endsWith('.css') || cssUtils_1.cssPreprocessLangRE.test(filePath)) { | ||
if (cssUtils_1.isCSSRequest(filePath)) { | ||
const publicPath = resolver.fileToRequest(filePath); | ||
@@ -63,3 +63,3 @@ /** filter unused files */ | ||
if (filePath.endsWith('.module.css')) { | ||
moduleCssUpdate(filePath); | ||
moduleCssUpdate(filePath, resolver); | ||
} | ||
@@ -70,3 +70,3 @@ const boundaries = cssUtils_1.getCssImportBoundaries(filePath); | ||
if (boundary.includes('.module')) { | ||
moduleCssUpdate(boundary); | ||
moduleCssUpdate(boundary, resolver); | ||
} | ||
@@ -97,3 +97,5 @@ else if (boundary.includes('.vue')) { | ||
} | ||
function moduleCssUpdate(filePath) { | ||
function moduleCssUpdate(filePath, resolver) { | ||
// bust process cache | ||
processedCSS.delete(resolver.fileToRequest(filePath)); | ||
watcher.handleJSReload(filePath); | ||
@@ -111,2 +113,7 @@ } | ||
async function processCss(root, ctx) { | ||
// source didn't change (marker added by cachedRead) | ||
// just use previously cached result | ||
if (ctx.__notModified && processedCSS.has(ctx.path)) { | ||
return; | ||
} | ||
const css = (await utils_1.readBody(ctx.body)); | ||
@@ -113,0 +120,0 @@ const result = await cssUtils_1.compileCss(root, ctx.path, { |
@@ -137,5 +137,3 @@ "use strict"; | ||
watcher.on('change', (file) => { | ||
if (!(file.endsWith('.vue') || | ||
file.endsWith('.css') || | ||
cssUtils_1.cssPreprocessLangRE.test(file))) { | ||
if (!(file.endsWith('.vue') || cssUtils_1.isCSSRequest(file))) { | ||
// everything except plain .css are considered HMR dependencies. | ||
@@ -142,0 +140,0 @@ // plain css has its own HMR logic in ./serverPluginCss.ts. |
@@ -14,2 +14,3 @@ "use strict"; | ||
const chalk_1 = __importDefault(require("chalk")); | ||
const cssUtils_1 = require("../utils/cssUtils"); | ||
const debug = require('debug')('vite:rewrite'); | ||
@@ -35,2 +36,3 @@ const rewriteCache = new lru_cache_1.default({ max: 1024 }); | ||
ctx.response.is('js') && | ||
!cssUtils_1.isCSSRequest(ctx.path) && | ||
!ctx.url.endsWith('.map') && | ||
@@ -37,0 +39,0 @@ // skip internal client |
import { SFCAsyncStyleCompileOptions, SFCStyleCompileResults } from '@vue/compiler-sfc'; | ||
export declare const urlRE: RegExp; | ||
export declare const cssPreprocessLangRE: RegExp; | ||
export declare const isCSSRequest: (file: string) => boolean; | ||
declare type Replacer = (url: string) => string | Promise<string>; | ||
@@ -5,0 +6,0 @@ export declare function rewriteCssUrls(css: string, replacerOrBase: string | Replacer): Promise<string>; |
@@ -15,2 +15,3 @@ "use strict"; | ||
exports.cssPreprocessLangRE = /(.+)\.(less|sass|scss|styl|stylus|postcss)$/; | ||
exports.isCSSRequest = (file) => file.endsWith('.css') || exports.cssPreprocessLangRE.test(file); | ||
function rewriteCssUrls(css, replacerOrBase) { | ||
@@ -17,0 +18,0 @@ let replacer; |
@@ -29,2 +29,4 @@ "use strict"; | ||
if (ctx) { | ||
// a private marker in case the user ticks "disable cache" during dev | ||
ctx.__notModified = true; | ||
ctx.etag = cached.etag; | ||
@@ -31,0 +33,0 @@ ctx.lastModified = new Date(cached.lastModified); |
{ | ||
"name": "vite", | ||
"version": "0.20.7", | ||
"version": "0.20.8", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "author": "Evan You", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
306320
5489