angular/aio/tools/transforms/angular-base-package/services/getImageDimensions.js
Derek Cormier 7642abfb7a build(bazel): fix bazel aio regressions after rebase
The aio-bazel-migration branch was rebased onto main to include runfiles
support on windows.
2022-11-22 13:51:16 -07:00

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;
}
};
};