unvendor: Replace hljs

This commit is contained in:
Cohee 2024-10-16 23:18:23 +03:00
parent 3c28b754dc
commit 416282ae1f
11 changed files with 28 additions and 1365 deletions

View File

@ -52,7 +52,6 @@ module.exports = {
globals: {
droll: 'readonly',
Handlebars: 'readonly',
hljs: 'readonly',
localforage: 'readonly',
moment: 'readonly',
pdfjsLib: 'readonly',

10
package-lock.json generated
View File

@ -28,6 +28,7 @@
"fuse.js": "^7.0.0",
"google-translate-api-x": "^10.7.1",
"helmet": "^7.1.0",
"highlight.js": "^11.10.0",
"html-entities": "^2.5.2",
"iconv-lite": "^0.6.3",
"ip-matching": "^2.1.2",
@ -4277,6 +4278,15 @@
"node": ">=16.0.0"
}
},
"node_modules/highlight.js": {
"version": "11.10.0",
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.10.0.tgz",
"integrity": "sha512-SYVnVFswQER+zu1laSya563s+F8VDGt7o35d4utbamowvUNLLMovFqwCLSocpZTz3MgaSRA1IbqRWZv97dtErQ==",
"license": "BSD-3-Clause",
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/html-entities": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.5.2.tgz",

View File

@ -18,6 +18,7 @@
"fuse.js": "^7.0.0",
"google-translate-api-x": "^10.7.1",
"helmet": "^7.1.0",
"highlight.js": "^11.10.0",
"html-entities": "^2.5.2",
"iconv-lite": "^0.6.3",
"ip-matching": "^2.1.2",

1
public/global.d.ts vendored
View File

@ -1,7 +1,6 @@
// Global namespace modules
declare var droll;
declare var Handlebars;
declare var hljs;
declare var localforage;
declare var pdfjsLib;
declare var Popper;

View File

@ -6750,7 +6750,6 @@
<script src="lib/showdown-patch.js"></script>
<script src="lib/showdown-katex.min.js"></script>
<script src="lib/popper.js"></script>
<script src="lib/highlight.min.js"></script>
<script src="lib/moment-with-locales.min.js"></script>
<script src="lib/cropper.min.js"></script>
<script src="lib/jquery-cropper.min.js"></script>

View File

@ -4,6 +4,7 @@
*/
import Fuse from 'fuse.js';
import DOMPurify from 'dompurify';
import hljs from 'highlight.js';
/**
* Expose the libraries to the 'window' object.
@ -22,14 +23,20 @@ export function initLibraryShims() {
// @ts-ignore
window.DOMPurify = DOMPurify;
}
if (!('hljs' in window)) {
// @ts-ignore
window.hljs = hljs;
}
}
export default {
Fuse,
DOMPurify,
hljs,
};
export {
Fuse,
DOMPurify,
hljs,
};

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,10 @@
import { Fuse, DOMPurify, initLibraryShims, default as libs } from './lib.js';
import {
Fuse,
DOMPurify,
hljs,
initLibraryShims,
default as libs,
} from './lib.js';
import { humanizedDateTime, favsToHotswap, getMessageTimeStamp, dragElement, isMobile, initRossMods, shouldSendOnEnter, addSafariPatch } from './scripts/RossAscends-mods.js';
import { userStatsHandler, statMesProcess, initStats } from './scripts/stats.js';

View File

@ -1,3 +1,4 @@
import { hljs } from '../../../../lib.js';
import { POPUP_RESULT, POPUP_TYPE, Popup } from '../../../popup.js';
import { setSlashCommandAutoComplete } from '../../../slash-commands.js';
import { SlashCommandAbortController } from '../../../slash-commands/SlashCommandAbortController.js';

View File

@ -1,3 +1,4 @@
import { hljs } from '../../lib.js';
import { SlashCommandAbortController } from './SlashCommandAbortController.js';
import { SlashCommandArgument, SlashCommandNamedArgument } from './SlashCommandArgument.js';
import { SlashCommandClosure } from './SlashCommandClosure.js';

View File

@ -1,3 +1,4 @@
import { hljs } from '../../lib.js';
import { power_user } from '../power-user.js';
import { isTrueBoolean, uuidv4 } from '../utils.js';
import { SlashCommand } from './SlashCommand.js';