diff --git a/src/node/eejs/index.ts b/src/node/eejs/index.ts index 85b72ec05..18b113f5a 100644 --- a/src/node/eejs/index.ts +++ b/src/node/eejs/index.ts @@ -20,11 +20,11 @@ * require("./index").require("./path/to/template.ejs") */ -const ejs = require('ejs'); -const fs = require('fs'); +import ejs from 'ejs'; +import fs from 'fs'; const hooks = require('../../static/js/pluginfw/hooks.js'); -const path = require('path'); -const resolve = require('resolve'); +import path from 'path'; +import resolve from 'resolve'; import {root, settings} from '../utils/Settings' const templateCache = new Map(); @@ -86,8 +86,7 @@ exports.require = (name: string, args: any, mod: any) => { const cache = settings.maxAge !== 0; const template = cache && templateCache.get(ejspath) || ejs.compile( '<% e._init({get: () => __output, set: (s) => { __output = s; }}); %>' + - `${fs.readFileSync(ejspath).toString()}<% e._exit(); %>`, - {filename: ejspath}); + `${fs.readFileSync(ejspath).toString()}<% e._exit(); %>`, {filename: ejspath}); if (cache) templateCache.set(ejspath, template); exports.info.args.push(args); diff --git a/src/node/handler/APIHandler.js b/src/node/handler/APIHandler.js index 3b5a3fb63..0f92444e0 100644 --- a/src/node/handler/APIHandler.js +++ b/src/node/handler/APIHandler.js @@ -24,7 +24,7 @@ const fs = require('fs'); const api = require('../db/API'); const log4js = require('log4js'); const padManager = require('../db/PadManager'); -const randomString = require('../utils/randomstring'); +import randomString from "../utils/randomstring"; const argv = require('../utils/Cli').argv; const createHTTPError = require('http-errors'); diff --git a/src/node/utils/Settings.ts b/src/node/utils/Settings.ts index 74defbeb8..873128779 100644 --- a/src/node/utils/Settings.ts +++ b/src/node/utils/Settings.ts @@ -852,4 +852,3 @@ export const exportedForTestingOnly = { // initially load settings reloadSettings(); - diff --git a/src/package.json b/src/package.json index d39f6668f..298056d36 100644 --- a/src/package.json +++ b/src/package.json @@ -81,6 +81,7 @@ "devDependencies": { "@types/async": "^3.2.24", "@types/cross-spawn": "^6.0.6", + "@types/ejs": "^3.1.5", "@types/express": "^4.17.21", "@types/formidable": "^3.4.5", "@types/jsonminify": "^0.4.3", diff --git a/src/templates/pad.html b/src/templates/pad.html index 69671ca17..c25ebcf9a 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -1,5 +1,5 @@ <% - var settings = require("ep_etherpad-lite/node/utils/Settings") + import {settings} from 'ep_etherpad-lite/node/utils/Settings'; , langs = require("ep_etherpad-lite/node/hooks/i18n").availableLangs , pluginUtils = require('ep_etherpad-lite/static/js/pluginfw/shared') ;