Add method to build full form of import notation
webpack-bem-plugin requests method: import-notation-string -> import-notation-full-string
For now extending context process is integrated in parse method. Can we do a simple refactoring here?
Its also needed for method('b:foo e:x e:y') and method('b:foo e:y e:x') to return same result independent from initial order (of elements/modifiers/techs/etc-if-any)
method('b:foo e:x e:y') and method('b:foo e:y e:x') — ooh, are you sure it should be the same order?
import-notation-string -> import-notation-full-string
Can you collaborate on this a lil bit more?
are you sure it should be the same order?
not really. In plugin I want notation-string to be unique. In general it is not required
Can you collaborate on this a lil bit more?
add more info or make a PR ? Can do all two. You can assign it to me
According to old known BEM Full Stack and their must-should-deps mess there can be different order if entities relates each to another with "should" (weak) link.
I'd suggest to use the order of the first found set.
It could be something like:
const cache = {};
const method = (str) => {
const cells = parseImport(str);
const key = Array.from(new Set(cells.sort().map(c => c.id)).join(' ');
if (cache[key]) return cache[key];
return cache[key] = cells;
}
But how many times I'll get js code of block if I import it few times in different places? Accordingly to the logic we should reuse this code ;-)
It means we should group all js files of block with all their mods and then bake it to one Class with applyDecls() (hope we will change name and the way we call it).
Can you collaborate on this a lil bit more?
add more info or make a PR ? Can do all two. You can assign it to me
It's the least I can do ;-D