Use array instead of Set

This commit is contained in:
RMidhunSuresh 2022-04-01 20:43:42 +05:30
parent 859449ed60
commit 76789eacf1
2 changed files with 5 additions and 5 deletions

View File

@ -104,10 +104,10 @@ function populateMapWithDerivedVariables(map, cssFileLocation) {
*/
return;
}
const derivedVariables = new Set([
const derivedVariables = [
...([...resolvedMap.keys()].filter(v => !aliasMap.has(v))),
...([...aliasMap.entries()].map(([alias, variable]) => `${alias}=${variable}`))
]);
];
map.set(location, { "derived-variables": derivedVariables });
}

View File

@ -131,9 +131,9 @@ module.exports.tests = function tests() {
color: var(--my-alias--lighter-15);
}`;
await postcss([plugin({ derive, compiledVariables })]).process(inputCSS, { from: "/foo/bar/test.css", });
const actualSet = compiledVariables.get("/foo/bar")["derived-variables"];
const expectedSet = new Set(["icon-color--darker-20", "my-alias=icon-color--darker-20", "my-alias--lighter-15"]);
assert.deepEqual(actualSet, expectedSet);
const actualArray = compiledVariables.get("/foo/bar")["derived-variables"];
const expectedArray = ["icon-color--darker-20", "my-alias=icon-color--darker-20", "my-alias--lighter-15"];
assert.deepStrictEqual(actualArray.sort(), expectedArray.sort());
}
};
};