angular/aio/tools/transforms/angular-base-package/services/getImageDimensions.js
Derek Cormier 431c562815 build(bazel): add bazel targets for aio doc generation
This is an incremental step to produce dgeni output with bazel. The
generated outputs are not yet used by other targets.
2022-11-22 13:51:16 -07:00

19 lines
433 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(resolve(basePath, path));
} catch (e) {
// Fall back to next basePath if not found
error = e;
}
}
if (error) {
throw error;
}
};
};