Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use temporary directory for esbuild #6743

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 34 additions & 46 deletions src/node/hooks/express/specialpages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ exports.expressPreSession = async (hookName:string, {app}:ArgsExpressType) => {

app.get('/robots.txt', (req:any, res:any) => {
let filePath =
path.join(settings.root, 'src', 'static', 'skins', settings.skinName, 'robots.txt');
path.join(settings.root, 'src', 'static', 'skins', settings.skinName, 'robots.txt');
res.sendFile(filePath, (err:any) => {
// there is no custom robots.txt, send the default robots.txt which dissallows all
if (err) {
Expand Down Expand Up @@ -244,37 +244,37 @@ const convertTypescriptWatched = (content: string, cb: (output:string, hash: str
})
}

exports.expressCreateServer = async (hookName: string, args: ArgsExpressType, cb: Function) => {
exports.expressCreateServer = async (_hookName: string, args: ArgsExpressType, cb: Function) => {
const padString = eejs.require('ep_etherpad-lite/templates/padBootstrap.js', {
pluginModules: (() => {
const pluginModules = new Set();
for (const part of plugins.parts) {
for (const [, hookFnName] of Object.entries(part.client_hooks || {})) {
// @ts-ignore
pluginModules.add(hookFnName.split(':')[0]);
}
pluginModules: (() => {
const pluginModules = new Set();
for (const part of plugins.parts) {
for (const [, hookFnName] of Object.entries(part.client_hooks || {})) {
// @ts-ignore
pluginModules.add(hookFnName.split(':')[0]);
}
return [...pluginModules];
})(),
settings,
})
}
return [...pluginModules];
})(),
settings,
})

const indexString = eejs.require('ep_etherpad-lite/templates/indexBootstrap.js', {
})

const timeSliderString = eejs.require('ep_etherpad-lite/templates/timeSliderBootstrap.js', {
pluginModules: (() => {
const pluginModules = new Set();
for (const part of plugins.parts) {
for (const [, hookFnName] of Object.entries(part.client_hooks || {})) {
// @ts-ignore
pluginModules.add(hookFnName.split(':')[0]);
}
const timeSliderString = eejs.require('ep_etherpad-lite/templates/timeSliderBootstrap.js', {
pluginModules: (() => {
const pluginModules = new Set();
for (const part of plugins.parts) {
for (const [, hookFnName] of Object.entries(part.client_hooks || {})) {
// @ts-ignore
pluginModules.add(hookFnName.split(':')[0]);
}
return [...pluginModules];
})(),
settings,
})
}
return [...pluginModules];
})(),
settings,
})



Expand All @@ -295,32 +295,20 @@ exports.expressCreateServer = async (hookName: string, args: ArgsExpressType, cb
fileNamePad = `padbootstrap-${padSliderWrite.hash}.min.js`
fileNameTimeSlider = `timeSliderBootstrap-${timeSliderWrite.hash}.min.js`
fileNameIndex = `indexBootstrap-${indexWrite.hash}.min.js`
const pathNamePad = path.join(outdir, fileNamePad)
const pathNameTimeSlider = path.join(outdir, fileNameTimeSlider)
const pathNameIndex = path.join(outdir, 'index.js')

if (!fs.existsSync(pathNamePad)) {
fs.writeFileSync(pathNamePad, padSliderWrite.output);
}

if (!fs.existsSync(pathNameIndex)) {
fs.writeFileSync(pathNameIndex, indexWrite.output);
}

if (!fs.existsSync(pathNameTimeSlider)) {
fs.writeFileSync(pathNameTimeSlider,timeSliderWrite.output)
}

args.app.get("/"+fileNamePad, (req: any, res: any) => {
res.sendFile(pathNamePad)
args.app.get("/"+fileNamePad, (_req, res) => {
res.header('Content-Type', 'application/javascript');
res.send(padSliderWrite.output)
})

args.app.get("/"+fileNameIndex, (req: any, res: any) => {
res.sendFile(pathNameIndex)
args.app.get("/"+fileNameIndex, (_req, res) => {
res.header('Content-Type', 'application/javascript');
res.send(indexWrite.output)
})

args.app.get("/"+fileNameTimeSlider, (req: any, res: any) => {
res.sendFile(pathNameTimeSlider)
args.app.get("/"+fileNameTimeSlider, (_req, res) => {
res.header('Content-Type', 'application/javascript');
res.send(timeSliderWrite.output)
})

// serve index.html under /
Expand Down
2 changes: 0 additions & 2 deletions var/js/.gitignore

This file was deleted.

Loading