12 lines
529 B
JavaScript
12 lines
529 B
JavaScript
// Polyfills for browser globals required by pdfjs-dist in Node.js.
|
|
// Required via NODE_OPTIONS=--require so it runs before any module evaluation.
|
|
if (typeof globalThis.DOMMatrix === 'undefined') {
|
|
globalThis.DOMMatrix = class DOMMatrix { constructor() { return this; } };
|
|
}
|
|
if (typeof globalThis.ImageData === 'undefined') {
|
|
globalThis.ImageData = class ImageData { constructor() { return this; } };
|
|
}
|
|
if (typeof globalThis.Path2D === 'undefined') {
|
|
globalThis.Path2D = class Path2D { constructor() { return this; } };
|
|
}
|