mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
The aio-bazel-migration branch was rebased onto main to include runfiles support on windows.
19 lines
430 B
JavaScript
19 lines
430 B
JavaScript
const { join } = require('canonical-path');
|
|
const sizeOf = require('image-size');
|
|
|
|
module.exports = function getImageDimensions() {
|
|
return (basePaths, path) => {
|
|
let error;
|
|
for (const basePath of basePaths) {
|
|
try {
|
|
return sizeOf(join(basePath, path));
|
|
} catch (e) {
|
|
// Fall back to next basePath if not found
|
|
error = e;
|
|
}
|
|
}
|
|
if (error) {
|
|
throw error;
|
|
}
|
|
};
|
|
};
|