unvendor: Replace droll

This commit is contained in:
Cohee
2024-10-17 08:12:28 +00:00
parent ec4763b0c5
commit e9a002bc2b
8 changed files with 22 additions and 7 deletions

View File

@ -50,7 +50,6 @@ module.exports = {
}, },
// These scripts are loaded in HTML; tell ESLint not to complain about them being undefined // These scripts are loaded in HTML; tell ESLint not to complain about them being undefined
globals: { globals: {
droll: 'readonly',
showdownKatex: 'readonly', showdownKatex: 'readonly',
toastr: 'readonly', toastr: 'readonly',
SillyTavern: 'readonly', SillyTavern: 'readonly',

12
package-lock.json generated
View File

@ -29,6 +29,7 @@
"csrf-csrf": "^2.2.3", "csrf-csrf": "^2.2.3",
"diff-match-patch": "^1.0.5", "diff-match-patch": "^1.0.5",
"dompurify": "^3.1.7", "dompurify": "^3.1.7",
"droll": "^0.2.1",
"epubjs": "^0.3.93", "epubjs": "^0.3.93",
"express": "^4.21.0", "express": "^4.21.0",
"form-data": "^4.0.0", "form-data": "^4.0.0",
@ -3531,6 +3532,17 @@
"node": ">=10" "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": { "node_modules/eastasianwidth": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",

View File

@ -19,6 +19,7 @@
"csrf-csrf": "^2.2.3", "csrf-csrf": "^2.2.3",
"diff-match-patch": "^1.0.5", "diff-match-patch": "^1.0.5",
"dompurify": "^3.1.7", "dompurify": "^3.1.7",
"droll": "^0.2.1",
"epubjs": "^0.3.93", "epubjs": "^0.3.93",
"express": "^4.21.0", "express": "^4.21.0",
"form-data": "^4.0.0", "form-data": "^4.0.0",

1
public/global.d.ts vendored
View File

@ -1,5 +1,4 @@
// Global namespace modules // Global namespace modules
declare var droll;
declare var showdownKatex; declare var showdownKatex;
declare var ai; declare var ai;

View File

@ -6751,7 +6751,6 @@
<script src="lib/toastr.min.js"></script> <script src="lib/toastr.min.js"></script>
<script src="lib/select2.min.js"></script> <script src="lib/select2.min.js"></script>
<script src="lib/select2-search-placeholder.js"></script> <script src="lib/select2-search-placeholder.js"></script>
<script src="lib/droll.js"></script>
<script src="lib/pagination.js"></script> <script src="lib/pagination.js"></script>
<script src="lib/toolcool-color-picker.js"></script> <script src="lib/toolcool-color-picker.js"></script>
<script src="lib/jquery.izoomify.js"></script> <script src="lib/jquery.izoomify.js"></script>

View File

@ -17,9 +17,7 @@
], ],
"typeAcquisition": { "typeAcquisition": {
"include": [ "include": [
"@popperjs/core", "showdown-katex"
"showdown-katex",
"droll"
] ]
} }
} }

View File

@ -19,6 +19,7 @@ import showdown from 'showdown';
import moment from 'moment'; import moment from 'moment';
import seedrandom from 'seedrandom'; import seedrandom from 'seedrandom';
import * as Popper from '@popperjs/core'; import * as Popper from '@popperjs/core';
import droll from 'droll';
/** /**
* Expose the libraries to the 'window' object. * Expose the libraries to the 'window' object.
@ -69,6 +70,10 @@ export function initLibraryShims() {
// @ts-ignore // @ts-ignore
window.Popper = Popper; window.Popper = Popper;
} }
if (!('droll' in window)) {
// @ts-ignore
window.droll = droll;
}
} }
export default { export default {
@ -90,6 +95,7 @@ export default {
moment, moment,
seedrandom, seedrandom,
Popper, Popper,
droll,
}; };
export { export {
@ -111,4 +117,5 @@ export {
moment, moment,
seedrandom, seedrandom,
Popper, Popper,
droll,
}; };

View File

@ -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 { chat, chat_metadata, main_api, getMaxContextSize, getCurrentChatId, substituteParams } from '../script.js';
import { timestampToMoment, isDigitsOnly, getStringHash, escapeRegex, uuidv4 } from './utils.js'; import { timestampToMoment, isDigitsOnly, getStringHash, escapeRegex, uuidv4 } from './utils.js';
import { textgenerationwebui_banned_in_macros } from './textgen-settings.js'; import { textgenerationwebui_banned_in_macros } from './textgen-settings.js';