mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-11 07:03:30 +01:00
[TGUI] Update dependencies & dev server fix (#30639)
* [TGUI] Update dependencies & dev server fix * Update yarn.lock * Update tgui.bundle.js * Update helpers.min.js * Fix paradise-paradise * Rebuild html assets on build * And here
This commit is contained in:
Vendored
+942
File diff suppressed because one or more lines are too long
Vendored
-935
File diff suppressed because one or more lines are too long
+4
-3
@@ -13,11 +13,12 @@ logFilters:
|
||||
level: discard
|
||||
- code: YN0002
|
||||
level: discard
|
||||
pattern: 'css-loader@*'
|
||||
pattern: css-loader@*
|
||||
- code: YN0002
|
||||
level: discard
|
||||
pattern: 'url-loader@*'
|
||||
pattern: url-loader@*
|
||||
|
||||
|
||||
preferInteractive: true
|
||||
|
||||
yarnPath: .yarn/releases/yarn-4.8.1.cjs
|
||||
yarnPath: .yarn/releases/yarn-4.10.3.cjs
|
||||
|
||||
@@ -40,6 +40,14 @@ function task-install {
|
||||
yarn install
|
||||
}
|
||||
|
||||
## Minifies tgui/html assets
|
||||
function task-setup {
|
||||
yarn run build:helpers
|
||||
Write-Output "tgui: html helpers minified"
|
||||
yarn run build:style
|
||||
Write-Output "tgui: html styles minified"
|
||||
}
|
||||
|
||||
## Runs rspack
|
||||
function task-rspack {
|
||||
yarn run rspack @Args
|
||||
@@ -169,6 +177,7 @@ if ($Args.Length -gt 0) {
|
||||
task-prettier
|
||||
task-test @Rest
|
||||
task-lint
|
||||
task-setup
|
||||
task-rspack --mode=production
|
||||
task-validate-build
|
||||
exit 0
|
||||
@@ -191,10 +200,12 @@ if ($Args.Length -gt 0) {
|
||||
if ($Args.Length -eq 0) {
|
||||
task-install
|
||||
task-lint --fix
|
||||
task-setup
|
||||
task-rspack --mode=production
|
||||
exit 0
|
||||
}
|
||||
|
||||
## Run rspack with custom flags
|
||||
task-install
|
||||
task-setup
|
||||
task-rspack @Args
|
||||
|
||||
+20
-20
@@ -2,7 +2,7 @@
|
||||
"private": true,
|
||||
"name": "tgui-workspace",
|
||||
"version": "6.0.0-paradise",
|
||||
"packageManager": "yarn@4.8.1",
|
||||
"packageManager": "yarn@4.10.3",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
@@ -22,29 +22,29 @@
|
||||
"tgui:eslint-fix": "eslint --fix packages --ext .js,.cjs,.ts,.jsx,.tsx"
|
||||
},
|
||||
"dependencies": {
|
||||
"@rspack/cli": "^1.3.5",
|
||||
"@rspack/core": "^1.3.5",
|
||||
"@typescript-eslint/parser": "^8.13.0",
|
||||
"@typescript-eslint/utils": "^8.13.0",
|
||||
"@rspack/cli": "^1.5.8",
|
||||
"@rspack/core": "^1.5.8",
|
||||
"@typescript-eslint/parser": "^8.46.0",
|
||||
"@typescript-eslint/utils": "^8.46.0",
|
||||
"css-loader": "^7.1.2",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-react": "^7.34.1",
|
||||
"eslint-plugin-simple-import-sort": "^12.0.0",
|
||||
"eslint-plugin-sonarjs": "^0.25.0",
|
||||
"eslint-plugin-unused-imports": "^3.1.0",
|
||||
"jsdom": "^26.0.0",
|
||||
"prettier": "^3.5.3",
|
||||
"sass": "^1.80.6",
|
||||
"sass-embedded": "^1.85.1",
|
||||
"sass-loader": "^16.0.3",
|
||||
"typescript": "^5.6.3",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-prettier": "^9.1.2",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||
"eslint-plugin-sonarjs": "^0.25.1",
|
||||
"eslint-plugin-unused-imports": "^3.2.0",
|
||||
"jsdom": "^26.1.0",
|
||||
"prettier": "^3.6.2",
|
||||
"sass": "^1.93.2",
|
||||
"sass-embedded": "^1.93.2",
|
||||
"sass-loader": "^16.0.5",
|
||||
"typescript": "^5.9.3",
|
||||
"url-loader": "^4.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.14.0",
|
||||
"@types/node": "^22.18.8",
|
||||
"@types/webpack-env": "^1.18.8",
|
||||
"@types/wicg-file-system-access": "^2023.10.6",
|
||||
"vitest": "^3.1.1"
|
||||
"@types/wicg-file-system-access": "^2023.10.7",
|
||||
"vitest": "^3.2.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
"name": "common",
|
||||
"version": "4.3.1",
|
||||
"devDependencies": {
|
||||
"vitest": "^3.1.1"
|
||||
"vitest": "^3.2.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
"name": "tgui-bench",
|
||||
"version": "6.0.0-paradise",
|
||||
"dependencies": {
|
||||
"@fastify/static": "^8.1.1",
|
||||
"@fastify/static": "^8.2.0",
|
||||
"common": "workspace:*",
|
||||
"fastify": "^5.1.0",
|
||||
"fastify": "^5.6.1",
|
||||
"lodash": "^4.17.21",
|
||||
"platform": "^1.3.6",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"react": "^19.2.0",
|
||||
"react-dom": "^19.2.0",
|
||||
"tgui": "workspace:*",
|
||||
"tgui-core": "^5.1.0"
|
||||
"tgui-core": "^5.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.1.0",
|
||||
"@types/react-dom": "^19.1.2"
|
||||
"@types/react": "^19.2.2",
|
||||
"@types/react-dom": "^19.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { exec } from 'node:child_process';
|
||||
import { promisify } from 'node:util';
|
||||
|
||||
import axios from 'axios';
|
||||
import axios, { isAxiosError } from 'axios';
|
||||
|
||||
import { createLogger } from './logging.js';
|
||||
|
||||
@@ -40,7 +40,15 @@ export class DreamSeeker {
|
||||
.map((key) => encodeURIComponent(key) + '=' + encodeURIComponent(params[key]))
|
||||
.join('&');
|
||||
logger.log(`topic call at ${this.client.defaults.baseURL}/dummy.htm?${query}`);
|
||||
return this.client.get('/dummy.htm?' + query);
|
||||
return this.client.get('/dummy.htm?' + query).catch((e) => {
|
||||
if (isAxiosError(e) && e.code === 'ECONNREFUSED') {
|
||||
// Client exited, remove from list
|
||||
instanceByPid.delete(this.pid);
|
||||
logger.log(`client disconnected`);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,9 +13,7 @@ const reloadOnce = process.argv.includes('--reload');
|
||||
|
||||
async function setupServer() {
|
||||
const compiler = await createCompiler({
|
||||
mode: 'development',
|
||||
hot: !noHot,
|
||||
devServer: true,
|
||||
useTmpFolder: !noTmp,
|
||||
});
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "tgui-dev-server",
|
||||
"version": "6.0.0-paradise",
|
||||
"version": "6.1.0-paradise",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@rspack/core": "^1.3.5",
|
||||
"axios": "^1.12.0",
|
||||
"source-map": "^0.7.4",
|
||||
"@rspack/core": "^1.5.8",
|
||||
"axios": "^1.12.2",
|
||||
"source-map": "^0.7.6",
|
||||
"stacktrace-parser": "^0.1.11",
|
||||
"ws": "^8.18.1"
|
||||
"ws": "^8.18.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/ws": "^8.18.1"
|
||||
|
||||
@@ -32,14 +32,21 @@ class RspackCompiler {
|
||||
const requireFromRoot = createRequire(import.meta.dirname + '/../../..');
|
||||
/** @type {typeof import('@rspack/core')} */
|
||||
const rspack = await requireFromRoot('@rspack/core');
|
||||
|
||||
const createConfig = await requireFromRoot('./rspack.config.cjs');
|
||||
const createDevConfig = await requireFromRoot('./rspack.config-dev.cjs');
|
||||
|
||||
const config = createConfig({}, options);
|
||||
const devConfig = createDevConfig({}, options);
|
||||
|
||||
const mergedConfig = { ...config, ...devConfig };
|
||||
|
||||
// Inject the HMR plugin into the config if we're using it
|
||||
if (options.hot) {
|
||||
config.plugins.push(new rspack.HotModuleReplacementPlugin());
|
||||
mergedConfig.plugins.push(new rspack.HotModuleReplacementPlugin());
|
||||
}
|
||||
this.rspack = rspack;
|
||||
this.config = config;
|
||||
this.config = mergedConfig;
|
||||
this.bundleDir = config.output.path;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
"version": "6.0.0-paradise",
|
||||
"dependencies": {
|
||||
"common": "workspace:*",
|
||||
"dompurify": "^3.2.5",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"dompurify": "^3.2.7",
|
||||
"react": "^19.2.0",
|
||||
"react-dom": "^19.2.0",
|
||||
"tgui": "workspace:*",
|
||||
"tgui-core": "^5.1.0",
|
||||
"tgui-core": "^5.3.2",
|
||||
"tgui-dev-server": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.1.3",
|
||||
"@types/react-dom": "^19.1.3"
|
||||
"@types/react": "^19.2.2",
|
||||
"@types/react-dom": "^19.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "tgui-say",
|
||||
"version": "6.0.0-paradise-paradise",
|
||||
"version": "6.0.0-paradise",
|
||||
"dependencies": {
|
||||
"common": "workspace:*",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"react": "^19.2.0",
|
||||
"react-dom": "^19.2.0",
|
||||
"tgui": "workspace:*",
|
||||
"tgui-core": "^5.1.0"
|
||||
"tgui-core": "^5.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.1.3",
|
||||
"@types/react-dom": "^19.1.3",
|
||||
"vitest": "^3.1.1"
|
||||
"@types/react": "^19.2.2",
|
||||
"@types/react-dom": "^19.2.1",
|
||||
"vitest": "^3.2.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"clean-css-cli": "^5.6.3",
|
||||
"terser": "^5.39.0"
|
||||
"terser": "^5.44.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,23 +5,23 @@
|
||||
"dependencies": {
|
||||
"common": "workspace:*",
|
||||
"dateformat": "^5.0.3",
|
||||
"dompurify": "^3.2.5",
|
||||
"dompurify": "^3.2.7",
|
||||
"file-extension-icon-js": "^1.1.6",
|
||||
"highlight.js": "^11.10.0",
|
||||
"highlight.js": "^11.11.1",
|
||||
"jest": "^29.7.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lodash": "^4.17.21",
|
||||
"marked": "^4.3.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"tgui-core": "^5.1.0",
|
||||
"react": "^19.2.0",
|
||||
"react-dom": "^19.2.0",
|
||||
"tgui-core": "^5.3.2",
|
||||
"tgui-dev-server": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/lodash": "^4.17.20",
|
||||
"@types/marked": "4.3.2",
|
||||
"@types/react": "^19.1.3",
|
||||
"@types/react-dom": "^19.1.3",
|
||||
"vitest": "^3.1.1"
|
||||
"@types/react": "^19.2.2",
|
||||
"@types/react-dom": "^19.2.1",
|
||||
"vitest": "^3.2.4"
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,119 @@
|
||||
const { defineConfig } = require('@rspack/cli');
|
||||
const { rspack } = require('@rspack/core');
|
||||
|
||||
const createStats = (verbose) => ({
|
||||
assets: verbose,
|
||||
builtAt: verbose,
|
||||
cached: false,
|
||||
children: false,
|
||||
chunks: false,
|
||||
colors: true,
|
||||
entrypoints: true,
|
||||
hash: false,
|
||||
modules: false,
|
||||
performance: false,
|
||||
timings: verbose,
|
||||
version: verbose,
|
||||
});
|
||||
|
||||
/**
|
||||
* 04/25/2025
|
||||
* There is a bug in rspack, possibly only ours, with the experimental css
|
||||
* feature that throws an error in tgui-dev. This prevents hot reloading from
|
||||
* working properly and there doesn't seem to be any way to fix it.
|
||||
*
|
||||
* This config exists to switch to the old css loader during development.
|
||||
*
|
||||
* `TypeError: Cannot read properties of null (reading 'removeChild')`
|
||||
*/
|
||||
module.exports = (env = {}, argv) => {
|
||||
/** @type {import('@rspack/core').Configuration} */
|
||||
const config = defineConfig({
|
||||
cache: false,
|
||||
experiments: undefined,
|
||||
mode: 'development',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.([tj]s(x)?|cjs)$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'builtin:swc-loader',
|
||||
options: {
|
||||
isModule: 'unknown',
|
||||
jsc: {
|
||||
parser: {
|
||||
syntax: 'typescript',
|
||||
tsx: true,
|
||||
},
|
||||
transform: {
|
||||
react: {
|
||||
runtime: 'automatic',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
type: 'javascript/auto',
|
||||
},
|
||||
{
|
||||
test: /\.(s)?css$/,
|
||||
use: [
|
||||
{
|
||||
loader: rspack.CssExtractRspackPlugin.loader,
|
||||
},
|
||||
{
|
||||
loader: require.resolve('css-loader'),
|
||||
},
|
||||
{
|
||||
loader: require.resolve('sass-loader'),
|
||||
options: {
|
||||
api: 'modern-compiler',
|
||||
implementation: 'sass-embedded',
|
||||
},
|
||||
},
|
||||
],
|
||||
type: 'javascript/auto',
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpg)$/,
|
||||
type: 'asset/resource',
|
||||
},
|
||||
{
|
||||
test: /\.svg$/,
|
||||
oneOf: [
|
||||
{
|
||||
issuer: /\.(s)?css$/,
|
||||
type: 'asset/inline',
|
||||
},
|
||||
{
|
||||
type: 'asset/resource',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new rspack.EnvironmentPlugin({
|
||||
NODE_ENV: 'development',
|
||||
WEBPACK_HMR_ENABLED: env.WEBPACK_HMR_ENABLED || argv.hot || false,
|
||||
DEV_SERVER_IP: env.DEV_SERVER_IP || null,
|
||||
}),
|
||||
new rspack.CssExtractRspackPlugin({
|
||||
filename: '[name].bundle.css',
|
||||
chunkFilename: '[name].bundle.css',
|
||||
}),
|
||||
],
|
||||
});
|
||||
config.devtool = 'cheap-module-source-map';
|
||||
config.devServer = {
|
||||
progress: false,
|
||||
quiet: false,
|
||||
noInfo: false,
|
||||
clientLogLevel: 'silent',
|
||||
stats: createStats(false),
|
||||
};
|
||||
|
||||
return config;
|
||||
};
|
||||
+4
-32
@@ -38,6 +38,7 @@ module.exports = (env = {}, argv) => {
|
||||
directory: path.resolve(__dirname, '.yarn/rspack'),
|
||||
},
|
||||
},
|
||||
css: true,
|
||||
},
|
||||
mode: mode === 'production' ? 'production' : 'development',
|
||||
context: path.resolve(__dirname),
|
||||
@@ -73,7 +74,6 @@ module.exports = (env = {}, argv) => {
|
||||
{
|
||||
loader: 'builtin:swc-loader',
|
||||
options: {
|
||||
isModule: 'unknown',
|
||||
jsc: {
|
||||
parser: {
|
||||
syntax: 'typescript',
|
||||
@@ -93,12 +93,6 @@ module.exports = (env = {}, argv) => {
|
||||
{
|
||||
test: /\.(s)?css$/,
|
||||
use: [
|
||||
{
|
||||
loader: rspack.CssExtractRspackPlugin.loader,
|
||||
},
|
||||
{
|
||||
loader: require.resolve('css-loader'),
|
||||
},
|
||||
{
|
||||
loader: require.resolve('sass-loader'),
|
||||
options: {
|
||||
@@ -107,20 +101,11 @@ module.exports = (env = {}, argv) => {
|
||||
},
|
||||
},
|
||||
],
|
||||
type: 'javascript/auto',
|
||||
type: 'css',
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpg)$/,
|
||||
use: [
|
||||
{
|
||||
loader: require.resolve('url-loader'),
|
||||
options: {
|
||||
esModule: false,
|
||||
outputPath: 'assets/',
|
||||
publicPath: '/assets/',
|
||||
},
|
||||
},
|
||||
],
|
||||
type: 'asset/resource',
|
||||
},
|
||||
{
|
||||
test: /\.svg$/,
|
||||
@@ -130,16 +115,7 @@ module.exports = (env = {}, argv) => {
|
||||
type: 'asset/inline',
|
||||
},
|
||||
{
|
||||
use: [
|
||||
{
|
||||
loader: require.resolve('url-loader'),
|
||||
options: {
|
||||
esModule: false,
|
||||
outputPath: 'assets/',
|
||||
publicPath: '/assets/',
|
||||
},
|
||||
},
|
||||
],
|
||||
type: 'asset/resource',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -160,10 +136,6 @@ module.exports = (env = {}, argv) => {
|
||||
WEBPACK_HMR_ENABLED: env.WEBPACK_HMR_ENABLED || argv.hot || false,
|
||||
DEV_SERVER_IP: env.DEV_SERVER_IP || null,
|
||||
}),
|
||||
new rspack.CssExtractRspackPlugin({
|
||||
filename: '[name].bundle.css',
|
||||
chunkFilename: '[name].bundle.css',
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
+2426
-2129
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user