diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 8ec8561ed..464292d6e 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -50,7 +50,6 @@ module.exports = { }, // These scripts are loaded in HTML; tell ESLint not to complain about them being undefined globals: { - droll: 'readonly', showdownKatex: 'readonly', toastr: 'readonly', SillyTavern: 'readonly', diff --git a/package-lock.json b/package-lock.json index 2963917e1..db34633e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,6 +29,7 @@ "csrf-csrf": "^2.2.3", "diff-match-patch": "^1.0.5", "dompurify": "^3.1.7", + "droll": "^0.2.1", "epubjs": "^0.3.93", "express": "^4.21.0", "form-data": "^4.0.0", @@ -3531,6 +3532,17 @@ "node": ">=10" } }, + "node_modules/droll": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/droll/-/droll-0.2.1.tgz", + "integrity": "sha512-fXxtxZSwGK6afeG18Vk6q/8LQDAnIylsvk/2tQhHwDOJmdB/x+YL9GLoSZUZXJkQ8LrBcyU/1EoIL1eSlpDMsg==", + "bin": { + "droll": "bin/droll-cli.js" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", diff --git a/package.json b/package.json index df9e09ffa..7c4afac75 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "csrf-csrf": "^2.2.3", "diff-match-patch": "^1.0.5", "dompurify": "^3.1.7", + "droll": "^0.2.1", "epubjs": "^0.3.93", "express": "^4.21.0", "form-data": "^4.0.0", diff --git a/public/global.d.ts b/public/global.d.ts index 2bd6c7356..73961fe45 100644 --- a/public/global.d.ts +++ b/public/global.d.ts @@ -1,5 +1,4 @@ // Global namespace modules -declare var droll; declare var showdownKatex; declare var ai; diff --git a/public/index.html b/public/index.html index 1d8df4ab1..0338bf9e4 100644 --- a/public/index.html +++ b/public/index.html @@ -6751,7 +6751,6 @@ - diff --git a/public/jsconfig.json b/public/jsconfig.json index a38d4c9af..3533f26b3 100644 --- a/public/jsconfig.json +++ b/public/jsconfig.json @@ -17,9 +17,7 @@ ], "typeAcquisition": { "include": [ - "@popperjs/core", - "showdown-katex", - "droll" + "showdown-katex" ] } } diff --git a/public/lib.js b/public/lib.js index 0f0bcb96a..73d81b109 100644 --- a/public/lib.js +++ b/public/lib.js @@ -19,6 +19,7 @@ import showdown from 'showdown'; import moment from 'moment'; import seedrandom from 'seedrandom'; import * as Popper from '@popperjs/core'; +import droll from 'droll'; /** * Expose the libraries to the 'window' object. @@ -69,6 +70,10 @@ export function initLibraryShims() { // @ts-ignore window.Popper = Popper; } + if (!('droll' in window)) { + // @ts-ignore + window.droll = droll; + } } export default { @@ -90,6 +95,7 @@ export default { moment, seedrandom, Popper, + droll, }; export { @@ -111,4 +117,5 @@ export { moment, seedrandom, Popper, + droll, }; diff --git a/public/scripts/macros.js b/public/scripts/macros.js index 503ae2553..5021244d1 100644 --- a/public/scripts/macros.js +++ b/public/scripts/macros.js @@ -1,4 +1,4 @@ -import { Handlebars, moment, seedrandom } from '../lib.js'; +import { Handlebars, moment, seedrandom, droll } from '../lib.js'; import { chat, chat_metadata, main_api, getMaxContextSize, getCurrentChatId, substituteParams } from '../script.js'; import { timestampToMoment, isDigitsOnly, getStringHash, escapeRegex, uuidv4 } from './utils.js'; import { textgenerationwebui_banned_in_macros } from './textgen-settings.js';