2024-10-16 21:00:14 +02:00
|
|
|
/**
|
|
|
|
* Add all the libraries that you want to expose to the client here.
|
|
|
|
* They are bundled and exposed by Webpack in the /lib.js file.
|
|
|
|
*/
|
2024-10-17 00:32:13 +02:00
|
|
|
import lodash from 'lodash';
|
2024-10-16 21:00:14 +02:00
|
|
|
import Fuse from 'fuse.js';
|
2024-10-16 22:11:13 +02:00
|
|
|
import DOMPurify from 'dompurify';
|
2024-10-16 22:18:23 +02:00
|
|
|
import hljs from 'highlight.js';
|
2024-10-16 22:37:54 +02:00
|
|
|
import localforage from 'localforage';
|
2024-10-16 23:34:07 +02:00
|
|
|
import Handlebars from 'handlebars';
|
2024-10-16 23:40:11 +02:00
|
|
|
import css from '@adobe/css-tools';
|
2024-10-16 23:56:09 +02:00
|
|
|
import Bowser from 'bowser';
|
2024-10-17 00:03:33 +02:00
|
|
|
import ePub from 'epubjs';
|
2024-10-17 00:16:39 +02:00
|
|
|
import * as pdfjsLib from 'pdfjs-dist/webpack.mjs';
|
2024-10-17 00:23:22 +02:00
|
|
|
import DiffMatchPatch from 'diff-match-patch';
|
2024-10-17 00:30:04 +02:00
|
|
|
import { isProbablyReaderable, Readability } from '@mozilla/readability';
|
2024-10-17 00:39:15 +02:00
|
|
|
import SVGInject from '@iconfu/svg-inject';
|
2024-10-16 22:11:13 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Expose the libraries to the 'window' object.
|
|
|
|
* Needed for compatibility with old extensions.
|
|
|
|
* Note: New extensions are encouraged to import the libraries directly from lib.js.
|
|
|
|
*/
|
|
|
|
export function initLibraryShims() {
|
|
|
|
if (!window) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!('Fuse' in window)) {
|
|
|
|
// @ts-ignore
|
|
|
|
window.Fuse = Fuse;
|
|
|
|
}
|
|
|
|
if (!('DOMPurify' in window)) {
|
|
|
|
// @ts-ignore
|
|
|
|
window.DOMPurify = DOMPurify;
|
|
|
|
}
|
2024-10-16 22:18:23 +02:00
|
|
|
if (!('hljs' in window)) {
|
|
|
|
// @ts-ignore
|
|
|
|
window.hljs = hljs;
|
|
|
|
}
|
2024-10-16 22:37:54 +02:00
|
|
|
if (!('localforage' in window)) {
|
|
|
|
// @ts-ignore
|
|
|
|
window.localforage = localforage;
|
|
|
|
}
|
2024-10-16 23:34:07 +02:00
|
|
|
if (!('Handlebars' in window)) {
|
|
|
|
// @ts-ignore
|
|
|
|
window.Handlebars = Handlebars;
|
|
|
|
}
|
2024-10-17 00:23:22 +02:00
|
|
|
if (!('diff_match_patch' in window)) {
|
|
|
|
// @ts-ignore
|
|
|
|
window.diff_match_patch = DiffMatchPatch;
|
|
|
|
}
|
2024-10-17 00:39:15 +02:00
|
|
|
if (!('SVGInject' in window)) {
|
|
|
|
// @ts-ignore
|
|
|
|
window.SVGInject = SVGInject;
|
|
|
|
}
|
2024-10-16 22:11:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
2024-10-17 00:32:13 +02:00
|
|
|
lodash,
|
2024-10-16 22:11:13 +02:00
|
|
|
Fuse,
|
|
|
|
DOMPurify,
|
2024-10-16 22:18:23 +02:00
|
|
|
hljs,
|
2024-10-16 22:37:54 +02:00
|
|
|
localforage,
|
2024-10-16 23:34:07 +02:00
|
|
|
Handlebars,
|
2024-10-16 23:40:11 +02:00
|
|
|
css,
|
2024-10-16 23:56:09 +02:00
|
|
|
Bowser,
|
2024-10-17 00:03:33 +02:00
|
|
|
ePub,
|
2024-10-17 00:16:39 +02:00
|
|
|
pdfjsLib,
|
2024-10-17 00:23:22 +02:00
|
|
|
DiffMatchPatch,
|
2024-10-17 00:30:04 +02:00
|
|
|
Readability,
|
|
|
|
isProbablyReaderable,
|
2024-10-17 00:39:15 +02:00
|
|
|
SVGInject,
|
2024-10-16 22:11:13 +02:00
|
|
|
};
|
2024-10-16 21:00:14 +02:00
|
|
|
|
|
|
|
export {
|
2024-10-17 00:32:13 +02:00
|
|
|
lodash,
|
2024-10-16 21:00:14 +02:00
|
|
|
Fuse,
|
2024-10-16 22:11:13 +02:00
|
|
|
DOMPurify,
|
2024-10-16 22:18:23 +02:00
|
|
|
hljs,
|
2024-10-16 22:37:54 +02:00
|
|
|
localforage,
|
2024-10-16 23:34:07 +02:00
|
|
|
Handlebars,
|
2024-10-16 23:40:11 +02:00
|
|
|
css,
|
2024-10-16 23:56:09 +02:00
|
|
|
Bowser,
|
2024-10-17 00:03:33 +02:00
|
|
|
ePub,
|
2024-10-17 00:16:39 +02:00
|
|
|
pdfjsLib,
|
2024-10-17 00:23:22 +02:00
|
|
|
DiffMatchPatch,
|
2024-10-17 00:30:04 +02:00
|
|
|
Readability,
|
|
|
|
isProbablyReaderable,
|
2024-10-17 00:39:15 +02:00
|
|
|
SVGInject,
|
2024-10-16 21:00:14 +02:00
|
|
|
};
|