Skip to content

Commit 64b196f

Browse files
committed
fix: prod build fail and cache performance
1 parent 9233842 commit 64b196f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

gulpfile.js/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ function makeDistAll() {
7979
}
8080

8181
function makeJSDist() {
82-
return src(['src/**/*.js', '!src/**/unittest-files/**/*', "!src/thirdparty/prettier/**/*"])
82+
return src(['src/**/*.js', '!src/**/unittest-files/**/*', "!src/thirdparty/prettier/**/*",
83+
"!src/thirdparty/language-worker.js"])
8384
.pipe(sourcemaps.init())
8485
.pipe(minify({
8586
ext:{

src/language/CSSUtils.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,10 +1903,12 @@ define(function (require, exports, module) {
19031903
return selector;
19041904
}
19051905

1906+
let globalPrecacheRun = 0;
19061907
function getAllCssSelectorsInProject(options = {
19071908
includeClasses: true,
19081909
includeIDs: true
19091910
}) {
1911+
globalPrecacheRun ++; // we need to stop the pre cache logic from doing the same cache again
19101912
return new Promise(resolve=>{
19111913
ProjectManager.getAllFiles(ProjectManager.getLanguageFilter(["css", "less", "scss"]))
19121914
.done(function (cssFiles) {
@@ -1936,9 +1938,16 @@ define(function (require, exports, module) {
19361938
}
19371939

19381940
async function _populateSelectorCache() {
1941+
globalPrecacheRun ++;
1942+
const currentCacheRun = globalPrecacheRun;
19391943
const cssFiles = await jsPromise(ProjectManager.getAllFiles(
19401944
ProjectManager.getLanguageFilter(["css", "less", "scss"])));
19411945
for(let cssFile of cssFiles){
1946+
if(currentCacheRun !== globalPrecacheRun) {
1947+
// this is for cases in very large projects where the project switches while a
1948+
// project wide css parse was in progress.
1949+
break;
1950+
}
19421951
await _loadFileAndScanCSSSelectorCached(cssFile.fullPath); // this is serial to not hog processor
19431952
}
19441953
}

0 commit comments

Comments
 (0)