mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-04 22:27:10 -04:00
Added esbuild for minification
This commit is contained in:
parent
ee777cdec1
commit
2fab20b8dd
2 changed files with 8 additions and 6 deletions
|
@ -3,13 +3,15 @@
|
||||||
* Worker thread to minify JS & CSS files out of the main NodeJS thread
|
* Worker thread to minify JS & CSS files out of the main NodeJS thread
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Terser from 'terser'
|
|
||||||
const fsp = require('fs').promises;
|
const fsp = require('fs').promises;
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import Threads from 'threads'
|
import {expose} from 'threads'
|
||||||
import lightminify from 'lightningcss'
|
import lightminify from 'lightningcss'
|
||||||
|
import {transform} from 'esbuild';
|
||||||
|
|
||||||
const compressJS = (content: string) => Terser.minify(content);
|
const compressJS = async (content: string) => {
|
||||||
|
return await transform(content, {minify: true});
|
||||||
|
}
|
||||||
|
|
||||||
const compressCSS = async (filename: string, ROOT_DIR: string) => {
|
const compressCSS = async (filename: string, ROOT_DIR: string) => {
|
||||||
const absPath = path.resolve(ROOT_DIR, filename);
|
const absPath = path.resolve(ROOT_DIR, filename);
|
||||||
|
@ -30,7 +32,7 @@ const compressCSS = async (filename: string, ROOT_DIR: string) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Threads.expose({
|
expose({
|
||||||
compressJS,
|
compressJS: compressJS,
|
||||||
compressCSS,
|
compressCSS,
|
||||||
});
|
});
|
||||||
|
|
|
@ -69,7 +69,6 @@
|
||||||
"socket.io": "^4.7.5",
|
"socket.io": "^4.7.5",
|
||||||
"socket.io-client": "^4.7.5",
|
"socket.io-client": "^4.7.5",
|
||||||
"superagent": "^9.0.2",
|
"superagent": "^9.0.2",
|
||||||
"terser": "^5.30.3",
|
|
||||||
"threads": "^1.7.0",
|
"threads": "^1.7.0",
|
||||||
"tinycon": "0.6.8",
|
"tinycon": "0.6.8",
|
||||||
"tsx": "^4.11.2",
|
"tsx": "^4.11.2",
|
||||||
|
@ -97,6 +96,7 @@
|
||||||
"@types/sinon": "^17.0.3",
|
"@types/sinon": "^17.0.3",
|
||||||
"@types/supertest": "^6.0.2",
|
"@types/supertest": "^6.0.2",
|
||||||
"@types/underscore": "^1.11.15",
|
"@types/underscore": "^1.11.15",
|
||||||
|
"esbuild": "^0.21.4",
|
||||||
"eslint": "^9.2.0",
|
"eslint": "^9.2.0",
|
||||||
"eslint-config-etherpad": "^4.0.4",
|
"eslint-config-etherpad": "^4.0.4",
|
||||||
"etherpad-cli-client": "^3.0.2",
|
"etherpad-cli-client": "^3.0.2",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue