Merge pull request #784 from vector-im/fix-build-race

Fix build error caused due to race in postcss plugin
This commit is contained in:
R Midhun Suresh 2022-07-05 20:13:57 +05:30 committed by GitHub
commit 28b686dae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -112,7 +112,14 @@ function populateMapWithDerivedVariables(map, cssFileLocation, {resolvedMap, ali
...([...resolvedMap.keys()].filter(v => !aliasMap.has(v))), ...([...resolvedMap.keys()].filter(v => !aliasMap.has(v))),
...([...aliasMap.entries()].map(([alias, variable]) => `${alias}=${variable}`)) ...([...aliasMap.entries()].map(([alias, variable]) => `${alias}=${variable}`))
]; ];
map.set(location, { "derived-variables": derivedVariables }); const sharedObject = map.get(location);
const output = { "derived-variables": derivedVariables };
if (sharedObject) {
Object.assign(sharedObject, output);
}
else {
map.set(location, output);
}
} }
/** /**

View File

@ -55,7 +55,13 @@ function addResolvedVariablesToRootSelector(root, { Rule, Declaration }, urlVari
function populateMapWithIcons(map, cssFileLocation, urlVariables) { function populateMapWithIcons(map, cssFileLocation, urlVariables) {
const location = cssFileLocation.match(/(.+)\/.+\.css/)?.[1]; const location = cssFileLocation.match(/(.+)\/.+\.css/)?.[1];
const sharedObject = map.get(location); const sharedObject = map.get(location);
sharedObject["icon"] = Object.fromEntries(urlVariables); const output = {"icon": Object.fromEntries(urlVariables)};
if (sharedObject) {
Object.assign(sharedObject, output);
}
else {
map.set(location, output);
}
} }
function *createCounter() { function *createCounter() {