Fix a compatibility issue in less-imports.js on 3.11.2+.
Review Request #11067 — Created July 5, 2020 and submitted
The less-imports.js utility broke on LessCSS 3.11.2, and again on
3.11.3, but in different ways.
On prior versions, the internal list of imported files was an object,
mapping file paths to some internal state. This was removed entirely on
3.11.2, leaving no way to get to these files (there are other mappings
that include filenames, but they also include the original file being
3.11.3 brought this back, but changed it to an array. That caused the
existing logic to fail, as we were calling
Object.keys()on the list,
giving us dependencies that were indexes into an array. This in turn
caused every file to appear out of date, every time it was loaded,
explaining the recent slowdown in LessCSS file processing.
We now check if
filesexists at all, and bail with a slightly more
helpful error that at least leads us to knowing there's a problem.
Otherwise, we proceed to handle the list correctly, whether it's an
object or an array.
Tested an install that ran on 3.11.1, and an install on 3.11.3.
Verified that the dependencies for files were loaded correctly on