mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
tgui maintenance chores (#60859)
## About The Pull Request **Upgrades:** - Yarn 3.0 - TypeScript 4.3 - Sass 1.37 - Required some refactoring of `/` into `math.div()` in CSS **Dependency removals:** - Removed ESM package, see: https://github.com/standard-things/esm/pull/902 I initially thought it was impossible to stop relying on this package, but fortunately, ES module support in Node 12+ now comes standard and I only had to convert the very few external module imports to `require()` (because Yarn PnP). I also moved `logging.js` directly into `tgui-dev-server` package, because that's where it is used. One less internal dependency. **Sidegrades:** - Removed creation of a common tgui chunk, because in practice it creates unnecessary complexity (devs sometimes get a white screen due to this chunk being invalid) and doesn't really save that much data on CDN, and **definitely** doesn't make tgui load faster. I think that is all. I tested it a bit and everything seemingly works.
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
//DEFINITIONS FOR ASSET DATUMS START HERE.
|
||||
|
||||
/datum/asset/simple/tgui_common
|
||||
keep_local_name = TRUE
|
||||
assets = list(
|
||||
"tgui-common.bundle.js" = file("tgui/public/tgui-common.bundle.js"),
|
||||
)
|
||||
|
||||
/datum/asset/simple/tgui
|
||||
keep_local_name = TRUE
|
||||
assets = list(
|
||||
|
||||
@@ -92,7 +92,6 @@
|
||||
window.initialize(
|
||||
fancy = user.client.prefs.tgui_fancy,
|
||||
inline_assets = list(
|
||||
get_asset_datum(/datum/asset/simple/tgui_common),
|
||||
get_asset_datum(/datum/asset/simple/tgui),
|
||||
))
|
||||
else
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
initialized_at = world.time
|
||||
// Perform a clean initialization
|
||||
window.initialize(inline_assets = list(
|
||||
get_asset_datum(/datum/asset/simple/tgui_common),
|
||||
get_asset_datum(/datum/asset/simple/tgui_panel),
|
||||
))
|
||||
window.send_asset(get_asset_datum(/datum/asset/simple/namespaced/fontawesome))
|
||||
|
||||
+342
-56
File diff suppressed because one or more lines are too long
Vendored
-55
File diff suppressed because one or more lines are too long
Vendored
+631
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.js";
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.js";
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "eslint",
|
||||
"version": "7.21.0-pnpify",
|
||||
"version": "7.32.0-sdk",
|
||||
"main": "./lib/api.js",
|
||||
"type": "commonjs"
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
||||
# This file is automatically generated by PnPify.
|
||||
# Manual changes will be lost!
|
||||
# This file is automatically generated by @yarnpkg/sdks.
|
||||
# Manual changes might be lost!
|
||||
|
||||
integrations:
|
||||
- vscode
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.js";
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.js";
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.js";
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
+65
-19
@@ -4,15 +4,22 @@ const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.js";
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
const moduleWrapper = tsserver => {
|
||||
if (!process.versions.pnp) {
|
||||
return tsserver;
|
||||
}
|
||||
|
||||
const {isAbsolute} = require(`path`);
|
||||
const pnpApi = require(`pnpapi`);
|
||||
|
||||
const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
|
||||
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
|
||||
|
||||
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
|
||||
return `${locator.name}@${locator.reference}`;
|
||||
}));
|
||||
@@ -23,9 +30,9 @@ const moduleWrapper = tsserver => {
|
||||
|
||||
function toEditorPath(str) {
|
||||
// We add the `zip:` prefix to both `.zip/` paths and virtual paths
|
||||
if (isAbsolute(str) && !str.match(/^\^zip:/) && (str.match(/\.zip\//) || str.match(/\$\$virtual\//))) {
|
||||
if (isAbsolute(str) && !str.match(/^\^zip:/) && (str.match(/\.zip\//) || isVirtual(str))) {
|
||||
// We also take the opportunity to turn virtual paths into physical ones;
|
||||
// this makes is much easier to work with workspaces that list peer
|
||||
// this makes it much easier to work with workspaces that list peer
|
||||
// dependencies, since otherwise Ctrl+Click would bring us to the virtual
|
||||
// file instances instead of the real ones.
|
||||
//
|
||||
@@ -34,26 +41,49 @@ const moduleWrapper = tsserver => {
|
||||
// with peer dep (otherwise jumping into react-dom would show resolution
|
||||
// errors on react).
|
||||
//
|
||||
const resolved = pnpApi.resolveVirtual(str);
|
||||
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
|
||||
if (resolved) {
|
||||
const locator = pnpApi.findPackageLocator(resolved);
|
||||
if (locator && dependencyTreeRoots.has(`${locator.name}@${locator.reference}`)) {
|
||||
str = resolved;
|
||||
str = resolved;
|
||||
}
|
||||
}
|
||||
|
||||
str = str.replace(/\\/g, `/`)
|
||||
str = str.replace(/^\/?/, `/`);
|
||||
str = normalize(str);
|
||||
|
||||
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
|
||||
// VSCode only adds it automatically for supported schemes,
|
||||
// so we have to do it manually for the `zip` scheme.
|
||||
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
|
||||
//
|
||||
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
|
||||
//
|
||||
if (str.match(/\.zip\//)) {
|
||||
str = `${isVSCode ? `^` : ``}zip:${str}`;
|
||||
switch (hostInfo) {
|
||||
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
|
||||
// VSCode only adds it automatically for supported schemes,
|
||||
// so we have to do it manually for the `zip` scheme.
|
||||
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
|
||||
//
|
||||
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
|
||||
//
|
||||
case `vscode`: {
|
||||
str = `^zip:${str}`;
|
||||
} break;
|
||||
|
||||
// To make "go to definition" work,
|
||||
// We have to resolve the actual file system path from virtual path
|
||||
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
|
||||
case `coc-nvim`: {
|
||||
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||
str = resolve(`zipfile:${str}`);
|
||||
} break;
|
||||
|
||||
// Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
|
||||
// We have to resolve the actual file system path from virtual path,
|
||||
// everything else is up to neovim
|
||||
case `neovim`: {
|
||||
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||
str = `zipfile:${str}`;
|
||||
} break;
|
||||
|
||||
default: {
|
||||
str = `zip:${str}`;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,15 +96,29 @@ const moduleWrapper = tsserver => {
|
||||
: str.replace(/^\^?zip:/, ``);
|
||||
}
|
||||
|
||||
// Force enable 'allowLocalPluginLoads'
|
||||
// TypeScript tries to resolve plugins using a path relative to itself
|
||||
// which doesn't work when using the global cache
|
||||
// https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
|
||||
// VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
|
||||
// TypeScript already does local loads and if this code is running the user trusts the workspace
|
||||
// https://github.com/microsoft/vscode/issues/45856
|
||||
const ConfiguredProject = tsserver.server.ConfiguredProject;
|
||||
const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
|
||||
ConfiguredProject.prototype.enablePluginsWithOptions = function() {
|
||||
this.projectService.allowLocalPluginLoads = true;
|
||||
return originalEnablePluginsWithOptions.apply(this, arguments);
|
||||
};
|
||||
|
||||
// And here is the point where we hijack the VSCode <-> TS communications
|
||||
// by adding ourselves in the middle. We locate everything that looks
|
||||
// like an absolute path of ours and normalize it.
|
||||
|
||||
const Session = tsserver.server.Session;
|
||||
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
|
||||
let isVSCode = false;
|
||||
let hostInfo = `unknown`;
|
||||
|
||||
return Object.assign(Session.prototype, {
|
||||
Object.assign(Session.prototype, {
|
||||
onMessage(/** @type {string} */ message) {
|
||||
const parsedMessage = JSON.parse(message)
|
||||
|
||||
@@ -82,9 +126,9 @@ const moduleWrapper = tsserver => {
|
||||
parsedMessage != null &&
|
||||
typeof parsedMessage === `object` &&
|
||||
parsedMessage.arguments &&
|
||||
parsedMessage.arguments.hostInfo === `vscode`
|
||||
typeof parsedMessage.arguments.hostInfo === `string`
|
||||
) {
|
||||
isVSCode = true;
|
||||
hostInfo = parsedMessage.arguments.hostInfo;
|
||||
}
|
||||
|
||||
return originalOnMessage.call(this, JSON.stringify(parsedMessage, (key, value) => {
|
||||
@@ -98,6 +142,8 @@ const moduleWrapper = tsserver => {
|
||||
})));
|
||||
}
|
||||
});
|
||||
|
||||
return tsserver;
|
||||
};
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
const moduleWrapper = tsserver => {
|
||||
if (!process.versions.pnp) {
|
||||
return tsserver;
|
||||
}
|
||||
|
||||
const {isAbsolute} = require(`path`);
|
||||
const pnpApi = require(`pnpapi`);
|
||||
|
||||
const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
|
||||
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
|
||||
|
||||
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
|
||||
return `${locator.name}@${locator.reference}`;
|
||||
}));
|
||||
|
||||
// VSCode sends the zip paths to TS using the "zip://" prefix, that TS
|
||||
// doesn't understand. This layer makes sure to remove the protocol
|
||||
// before forwarding it to TS, and to add it back on all returned paths.
|
||||
|
||||
function toEditorPath(str) {
|
||||
// We add the `zip:` prefix to both `.zip/` paths and virtual paths
|
||||
if (isAbsolute(str) && !str.match(/^\^zip:/) && (str.match(/\.zip\//) || isVirtual(str))) {
|
||||
// We also take the opportunity to turn virtual paths into physical ones;
|
||||
// this makes it much easier to work with workspaces that list peer
|
||||
// dependencies, since otherwise Ctrl+Click would bring us to the virtual
|
||||
// file instances instead of the real ones.
|
||||
//
|
||||
// We only do this to modules owned by the the dependency tree roots.
|
||||
// This avoids breaking the resolution when jumping inside a vendor
|
||||
// with peer dep (otherwise jumping into react-dom would show resolution
|
||||
// errors on react).
|
||||
//
|
||||
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
|
||||
if (resolved) {
|
||||
const locator = pnpApi.findPackageLocator(resolved);
|
||||
if (locator && dependencyTreeRoots.has(`${locator.name}@${locator.reference}`)) {
|
||||
str = resolved;
|
||||
}
|
||||
}
|
||||
|
||||
str = normalize(str);
|
||||
|
||||
if (str.match(/\.zip\//)) {
|
||||
switch (hostInfo) {
|
||||
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
|
||||
// VSCode only adds it automatically for supported schemes,
|
||||
// so we have to do it manually for the `zip` scheme.
|
||||
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
|
||||
//
|
||||
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
|
||||
//
|
||||
case `vscode`: {
|
||||
str = `^zip:${str}`;
|
||||
} break;
|
||||
|
||||
// To make "go to definition" work,
|
||||
// We have to resolve the actual file system path from virtual path
|
||||
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
|
||||
case `coc-nvim`: {
|
||||
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||
str = resolve(`zipfile:${str}`);
|
||||
} break;
|
||||
|
||||
// Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
|
||||
// We have to resolve the actual file system path from virtual path,
|
||||
// everything else is up to neovim
|
||||
case `neovim`: {
|
||||
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||
str = `zipfile:${str}`;
|
||||
} break;
|
||||
|
||||
default: {
|
||||
str = `zip:${str}`;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function fromEditorPath(str) {
|
||||
return process.platform === `win32`
|
||||
? str.replace(/^\^?zip:\//, ``)
|
||||
: str.replace(/^\^?zip:/, ``);
|
||||
}
|
||||
|
||||
// Force enable 'allowLocalPluginLoads'
|
||||
// TypeScript tries to resolve plugins using a path relative to itself
|
||||
// which doesn't work when using the global cache
|
||||
// https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
|
||||
// VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
|
||||
// TypeScript already does local loads and if this code is running the user trusts the workspace
|
||||
// https://github.com/microsoft/vscode/issues/45856
|
||||
const ConfiguredProject = tsserver.server.ConfiguredProject;
|
||||
const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
|
||||
ConfiguredProject.prototype.enablePluginsWithOptions = function() {
|
||||
this.projectService.allowLocalPluginLoads = true;
|
||||
return originalEnablePluginsWithOptions.apply(this, arguments);
|
||||
};
|
||||
|
||||
// And here is the point where we hijack the VSCode <-> TS communications
|
||||
// by adding ourselves in the middle. We locate everything that looks
|
||||
// like an absolute path of ours and normalize it.
|
||||
|
||||
const Session = tsserver.server.Session;
|
||||
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
|
||||
let hostInfo = `unknown`;
|
||||
|
||||
Object.assign(Session.prototype, {
|
||||
onMessage(/** @type {string} */ message) {
|
||||
const parsedMessage = JSON.parse(message)
|
||||
|
||||
if (
|
||||
parsedMessage != null &&
|
||||
typeof parsedMessage === `object` &&
|
||||
parsedMessage.arguments &&
|
||||
typeof parsedMessage.arguments.hostInfo === `string`
|
||||
) {
|
||||
hostInfo = parsedMessage.arguments.hostInfo;
|
||||
}
|
||||
|
||||
return originalOnMessage.call(this, JSON.stringify(parsedMessage, (key, value) => {
|
||||
return typeof value === `string` ? fromEditorPath(value) : value;
|
||||
}));
|
||||
},
|
||||
|
||||
send(/** @type {any} */ msg) {
|
||||
return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
|
||||
return typeof value === `string` ? toEditorPath(value) : value;
|
||||
})));
|
||||
}
|
||||
});
|
||||
|
||||
return tsserver;
|
||||
};
|
||||
|
||||
if (existsSync(absPnpApiPath)) {
|
||||
if (!process.versions.pnp) {
|
||||
// Setup the environment to be able to require typescript/lib/tsserverlibrary.js
|
||||
require(absPnpApiPath).setup();
|
||||
}
|
||||
}
|
||||
|
||||
// Defer to the real typescript/lib/tsserverlibrary.js your application uses
|
||||
module.exports = moduleWrapper(absRequire(`typescript/lib/tsserverlibrary.js`));
|
||||
+1
-1
@@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
|
||||
const {createRequire, createRequireFromPath} = require(`module`);
|
||||
const {resolve} = require(`path`);
|
||||
|
||||
const relPnpApiPath = "../../../../.pnp.js";
|
||||
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||
|
||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "typescript",
|
||||
"version": "4.2.3-pnpify",
|
||||
"version": "4.3.5-sdk",
|
||||
"main": "./lib/typescript.js",
|
||||
"type": "commonjs"
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,4 +14,4 @@ preferAggregateCacheInfo: true
|
||||
|
||||
preferInteractive: true
|
||||
|
||||
yarnPath: .yarn/releases/yarn-2.4.1.cjs
|
||||
yarnPath: .yarn/releases/yarn-3.0.1.cjs
|
||||
|
||||
@@ -14,7 +14,7 @@ const createBabelConfig = options => {
|
||||
[require.resolve('@babel/preset-env'), {
|
||||
modules: 'commonjs',
|
||||
useBuiltIns: 'entry',
|
||||
corejs: '3.10',
|
||||
corejs: '3',
|
||||
spec: false,
|
||||
loose: true,
|
||||
targets: [],
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ task-webpack() {
|
||||
## Runs a development server
|
||||
task-dev-server() {
|
||||
cd "${base_dir}"
|
||||
yarn node packages/tgui-dev-server/index.esm.js "${@}"
|
||||
yarn node --experimental-modules packages/tgui-dev-server/index.js "${@}"
|
||||
}
|
||||
|
||||
## Run a linter through all packages
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ function task-webpack {
|
||||
|
||||
## Runs a development server
|
||||
function task-dev-server {
|
||||
yarn node "packages/tgui-dev-server/index.esm.js" @Args
|
||||
yarn node --experimental-modules "packages/tgui-dev-server/index.js" @Args
|
||||
}
|
||||
|
||||
## Run a linter through all packages
|
||||
|
||||
+28
-27
@@ -6,39 +6,40 @@
|
||||
"packages/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.13.15",
|
||||
"@babel/eslint-parser": "^7.13.14",
|
||||
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
||||
"@babel/plugin-transform-jscript": "^7.12.13",
|
||||
"@babel/preset-env": "^7.13.15",
|
||||
"@babel/preset-typescript": "^7.13.0",
|
||||
"@types/jest": "^26.0.22",
|
||||
"@types/jsdom": "^16.2.10",
|
||||
"@types/node": "^14.14.41",
|
||||
"@typescript-eslint/parser": "^4.22.0",
|
||||
"babel-jest": "^26.6.3",
|
||||
"@babel/core": "^7.15.0",
|
||||
"@babel/eslint-parser": "^7.15.0",
|
||||
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
||||
"@babel/plugin-transform-jscript": "^7.14.5",
|
||||
"@babel/preset-env": "^7.15.0",
|
||||
"@babel/preset-typescript": "^7.15.0",
|
||||
"@types/jest": "^27.0.1",
|
||||
"@types/jsdom": "^16.2.13",
|
||||
"@types/node": "^14.17.9",
|
||||
"@typescript-eslint/parser": "^4.29.1",
|
||||
"babel-jest": "^27.0.6",
|
||||
"babel-loader": "^8.2.2",
|
||||
"babel-plugin-inferno": "^6.2.0",
|
||||
"babel-plugin-inferno": "^6.3.0",
|
||||
"babel-plugin-transform-remove-console": "^6.9.4",
|
||||
"common": "workspace:*",
|
||||
"css-loader": "^5.2.2",
|
||||
"eslint": "^7.24.0",
|
||||
"css-loader": "^5.2.7",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-radar": "^0.2.1",
|
||||
"eslint-plugin-react": "^7.23.2",
|
||||
"eslint-plugin-react": "^7.24.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"inferno": "^7.4.8",
|
||||
"jest": "^26.6.3",
|
||||
"jest-circus": "^26.6.3",
|
||||
"jsdom": "^16.5.3",
|
||||
"mini-css-extract-plugin": "^1.4.1",
|
||||
"sass": "^1.32.8",
|
||||
"sass-loader": "^11.0.1",
|
||||
"jest": "^27.0.6",
|
||||
"jest-circus": "^27.0.6",
|
||||
"jsdom": "^16.7.0",
|
||||
"mini-css-extract-plugin": "^1.6.2",
|
||||
"sass": "^1.37.5",
|
||||
"sass-loader": "^11.1.1",
|
||||
"style-loader": "^2.0.0",
|
||||
"terser-webpack-plugin": "^5.1.1",
|
||||
"typescript": "^4.2.4",
|
||||
"terser-webpack-plugin": "^5.1.4",
|
||||
"typescript": "^4.3.5",
|
||||
"url-loader": "^4.1.1",
|
||||
"webpack": "^5.33.2",
|
||||
"webpack-bundle-analyzer": "^4.4.1",
|
||||
"webpack-cli": "^4.6.0"
|
||||
}
|
||||
"webpack": "^5.50.0",
|
||||
"webpack-bundle-analyzer": "^4.4.2",
|
||||
"webpack-cli": "^4.7.2"
|
||||
},
|
||||
"packageManager": "yarn@3.0.1"
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"name": "tgfont",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"fantasticon": "^1.1.3"
|
||||
"fantasticon": "^1.2.2"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node mkdist.cjs && fantasticon --config config.cjs"
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import axios from 'axios';
|
||||
import { exec } from 'child_process';
|
||||
import { createLogger } from 'common/logging.js';
|
||||
import { promisify } from 'util';
|
||||
import { createLogger } from './logging.js';
|
||||
import { require } from './require.js';
|
||||
|
||||
const axios = require('axios');
|
||||
const logger = createLogger('dreamseeker');
|
||||
|
||||
const instanceByPid = new Map();
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
const esmRequire = require('esm')(module, {
|
||||
cache: false,
|
||||
});
|
||||
|
||||
esmRequire('./index.js');
|
||||
+11
-4
@@ -37,7 +37,7 @@ if (process.env.NODE_ENV !== 'production') {
|
||||
window.onunload = () => socket && socket.close();
|
||||
}
|
||||
|
||||
export const subscribe = fn => subscribers.push(fn);
|
||||
const subscribe = fn => subscribers.push(fn);
|
||||
|
||||
/**
|
||||
* A json serializer which handles circular references and other junk.
|
||||
@@ -91,7 +91,7 @@ const serializeObject = obj => {
|
||||
return json;
|
||||
};
|
||||
|
||||
export const sendMessage = msg => {
|
||||
const sendMessage = msg => {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const json = serializeObject(msg);
|
||||
// Send message using WebSocket
|
||||
@@ -119,7 +119,7 @@ export const sendMessage = msg => {
|
||||
}
|
||||
};
|
||||
|
||||
export const sendLogEntry = (level, ns, ...args) => {
|
||||
const sendLogEntry = (level, ns, ...args) => {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
try {
|
||||
sendMessage({
|
||||
@@ -135,7 +135,7 @@ export const sendLogEntry = (level, ns, ...args) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const setupHotReloading = () => {
|
||||
const setupHotReloading = () => {
|
||||
if (process.env.NODE_ENV !== 'production'
|
||||
&& process.env.WEBPACK_HMR_ENABLED
|
||||
&& window.WebSocket) {
|
||||
@@ -168,3 +168,10 @@ export const setupHotReloading = () => {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
subscribe,
|
||||
sendMessage,
|
||||
sendLogEntry,
|
||||
setupHotReloading,
|
||||
};
|
||||
@@ -4,13 +4,15 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { createLogger } from 'common/logging.js';
|
||||
import fs from 'fs';
|
||||
import { basename } from 'path';
|
||||
import SourceMap from 'source-map';
|
||||
import { parse as parseStackTrace } from 'stacktrace-parser';
|
||||
import { createLogger } from '../logging.js';
|
||||
import { require } from '../require.js';
|
||||
import { resolveGlob } from '../util.js';
|
||||
|
||||
const SourceMap = require('source-map');
|
||||
const { parse: parseStackTrace } = require('stacktrace-parser');
|
||||
|
||||
const logger = createLogger('retrace');
|
||||
|
||||
const { SourceMapConsumer } = SourceMap;
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { createLogger, directLog } from 'common/logging.js';
|
||||
import http from 'http';
|
||||
import { inspect } from 'util';
|
||||
import WebSocket from 'ws';
|
||||
import { retrace, loadSourceMaps } from './retrace.js';
|
||||
import { createLogger, directLog } from '../logging.js';
|
||||
import { require } from '../require.js';
|
||||
import { loadSourceMaps, retrace } from './retrace.js';
|
||||
|
||||
const WebSocket = require('ws');
|
||||
|
||||
const logger = createLogger('link');
|
||||
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
"private": true,
|
||||
"name": "tgui-dev-server",
|
||||
"version": "4.3.0",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"axios": "^0.21.1",
|
||||
"common": "workspace:*",
|
||||
"esm": "^3.2.25",
|
||||
"glob": "^7.1.6",
|
||||
"glob": "^7.1.7",
|
||||
"source-map": "^0.7.3",
|
||||
"stacktrace-parser": "^0.1.10",
|
||||
"ws": "^7.4.4"
|
||||
"ws": "^7.5.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { createLogger } from 'common/logging.js';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import { basename } from 'path';
|
||||
import { DreamSeeker } from './dreamseeker.js';
|
||||
import { createLogger } from './logging.js';
|
||||
import { resolveGlob, resolvePath } from './util.js';
|
||||
import { regQuery } from './winreg.js';
|
||||
import { DreamSeeker } from './dreamseeker.js';
|
||||
|
||||
const logger = createLogger('reloader');
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* @file
|
||||
* @copyright 2020 Aleksej Komarov
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { createRequire } from 'module';
|
||||
|
||||
export const require = createRequire(import.meta.url);
|
||||
@@ -4,26 +4,26 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import glob from 'glob';
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import fs from 'fs';
|
||||
import { promisify } from 'util';
|
||||
import path from 'path';
|
||||
import { require } from './require.js';
|
||||
|
||||
export { resolvePath };
|
||||
const globPkg = require('glob');
|
||||
|
||||
export const resolvePath = path.resolve;
|
||||
|
||||
/**
|
||||
* Combines path.resolve with glob patterns.
|
||||
*/
|
||||
export const resolveGlob = async (...sections) => {
|
||||
const unsafePaths = await promisify(glob)(
|
||||
resolvePath(...sections), {
|
||||
strict: false,
|
||||
silent: true,
|
||||
});
|
||||
export const resolveGlob = (...sections) => {
|
||||
const unsafePaths = globPkg.sync(path.resolve(...sections), {
|
||||
strict: false,
|
||||
silent: true,
|
||||
});
|
||||
const safePaths = [];
|
||||
for (let path of unsafePaths) {
|
||||
try {
|
||||
await promisify(fs.stat)(path);
|
||||
fs.statSync(path);
|
||||
safePaths.push(path);
|
||||
}
|
||||
catch {}
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { createLogger } from 'common/logging.js';
|
||||
import fs from 'fs';
|
||||
import { createRequire } from 'module';
|
||||
import { dirname } from 'path';
|
||||
import { loadSourceMaps, setupLink } from './link/server.js';
|
||||
import { createLogger } from './logging.js';
|
||||
import { reloadByondCache } from './reloader.js';
|
||||
import { resolveGlob } from './util.js';
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
*/
|
||||
|
||||
import { exec } from 'child_process';
|
||||
import { createLogger } from 'common/logging.js';
|
||||
import { promisify } from 'util';
|
||||
import { createLogger } from './logging.js';
|
||||
|
||||
const logger = createLogger('winreg');
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import './styles/themes/light.scss';
|
||||
|
||||
import { perf } from 'common/perf';
|
||||
import { combineReducers } from 'common/redux';
|
||||
import { setupHotReloading } from 'tgui-dev-server/link/client';
|
||||
import { setupHotReloading } from 'tgui-dev-server/link/client.cjs';
|
||||
import { setupGlobalEvents } from 'tgui/events';
|
||||
import { captureExternalLinks } from 'tgui/links';
|
||||
import { createRenderer } from 'tgui/renderer';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"version": "4.3.0",
|
||||
"dependencies": {
|
||||
"common": "workspace:*",
|
||||
"dompurify": "^2.2.7",
|
||||
"dompurify": "^2.3.1",
|
||||
"inferno": "^7.4.8",
|
||||
"tgui": "workspace:*",
|
||||
"tgui-dev-server": "workspace:*",
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
@use 'sass:color';
|
||||
@use 'sass:math';
|
||||
@use '~tgui/styles/base.scss';
|
||||
@use '~tgui/styles/colors.scss';
|
||||
|
||||
@@ -62,7 +63,7 @@ $color-bg-section: base.$color-bg-section !default;
|
||||
content: '';
|
||||
display: block;
|
||||
margin-top: -0.75em;
|
||||
border-bottom: (1em / 6) solid colors.$red;
|
||||
border-bottom: math.div(1em, 6) solid colors.$red;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ $color-bg-section: base.$color-bg-section !default;
|
||||
|
||||
.ChatMessage--highlighted {
|
||||
position: relative;
|
||||
border-left: (1em / 6) solid rgba(255, 221, 68);
|
||||
border-left: math.div(1em, 6) solid rgba(255, 221, 68);
|
||||
padding-left: 0.5em;
|
||||
|
||||
&:after {
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
@use 'sass:math';
|
||||
|
||||
$border-color: rgba(140, 140, 140, 0.5) !default;
|
||||
|
||||
.Ping {
|
||||
position: relative;
|
||||
padding: 0.125em 0.25em;
|
||||
border: (1em / 12) solid $border-color;
|
||||
border: math.div(1em, 12) solid $border-color;
|
||||
border-radius: 0.25em;
|
||||
width: 3.75em;
|
||||
text-align: right;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
"name": "tgui-polyfill",
|
||||
"version": "4.3.0",
|
||||
"dependencies": {
|
||||
"core-js": "^3.10.1",
|
||||
"regenerator-runtime": "^0.13.8",
|
||||
"core-js": "^3.16.1",
|
||||
"regenerator-runtime": "^0.13.9",
|
||||
"unfetch": "^4.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export const debugMiddleware = store => {
|
||||
};
|
||||
|
||||
export const relayMiddleware = store => {
|
||||
const devServer = require('tgui-dev-server/link/client');
|
||||
const devServer = require('tgui-dev-server/link/client.cjs');
|
||||
const externalBrowser = location.search === '?external';
|
||||
if (externalBrowser) {
|
||||
devServer.subscribe(msg => {
|
||||
|
||||
@@ -18,7 +18,7 @@ import './styles/themes/syndicate.scss';
|
||||
import './styles/themes/wizard.scss';
|
||||
|
||||
import { perf } from 'common/perf';
|
||||
import { setupHotReloading } from 'tgui-dev-server/link/client';
|
||||
import { setupHotReloading } from 'tgui-dev-server/link/client.cjs';
|
||||
import { setupHotKeys } from './hotkeys';
|
||||
import { captureExternalLinks } from './links';
|
||||
import { createRenderer } from './renderer';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { sendLogEntry } from 'tgui-dev-server/link/client';
|
||||
import { sendLogEntry } from 'tgui-dev-server/link/client.cjs';
|
||||
|
||||
const LEVEL_DEBUG = 0;
|
||||
const LEVEL_LOG = 1;
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
"name": "tgui",
|
||||
"version": "4.3.0",
|
||||
"dependencies": {
|
||||
"@popperjs/core": "^2.9.1",
|
||||
"@popperjs/core": "^2.9.3",
|
||||
"common": "workspace:*",
|
||||
"dateformat": "^4.5.1",
|
||||
"dompurify": "^2.2.7",
|
||||
"dompurify": "^2.3.1",
|
||||
"inferno": "^7.4.8",
|
||||
"inferno-vnode-flags": "^7.4.8",
|
||||
"js-yaml": "^4.1.0",
|
||||
"marked": "^2.0.3",
|
||||
"marked": "^2.1.3",
|
||||
"tgui-dev-server": "workspace:*",
|
||||
"tgui-polyfill": "workspace:*"
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
@use 'sass:color';
|
||||
@use 'sass:math';
|
||||
|
||||
$color-fg: #ffffff !default;
|
||||
$color-bg: #252525 !default;
|
||||
@@ -19,9 +20,9 @@ $font-size: 1 * $unit !default;
|
||||
$border-radius: 0.16em !default;
|
||||
|
||||
@function em($px) {
|
||||
@return 1em * ($px / $unit);
|
||||
@return 1em * math.div($px, $unit);
|
||||
}
|
||||
|
||||
@function rem($px) {
|
||||
@return 1rem * ($px / $unit);
|
||||
@return 1rem * math.div($px, $unit);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
@use 'sass:color';
|
||||
@use 'sass:math';
|
||||
@use '../base.scss';
|
||||
@use '../colors.scss';
|
||||
|
||||
@@ -100,28 +101,28 @@ $fg-map: colors.$fg-map !default;
|
||||
|
||||
.Tabs--horizontal {
|
||||
.Tab {
|
||||
border-top: (1em / 6) solid transparent;
|
||||
border-bottom: (1em / 6) solid transparent;
|
||||
border-top: math.div(1em, 6) solid transparent;
|
||||
border-bottom: math.div(1em, 6) solid transparent;
|
||||
border-top-left-radius: 0.25em;
|
||||
border-top-right-radius: 0.25em;
|
||||
}
|
||||
|
||||
.Tab--selected {
|
||||
border-bottom: (1em / 6) solid $color-default;
|
||||
border-bottom: math.div(1em, 6) solid $color-default;
|
||||
}
|
||||
}
|
||||
|
||||
.Tabs--vertical {
|
||||
.Tab {
|
||||
min-height: 2em;
|
||||
border-left: (1em / 6) solid transparent;
|
||||
border-right: (1em / 6) solid transparent;
|
||||
border-left: math.div(1em, 6) solid transparent;
|
||||
border-right: math.div(1em, 6) solid transparent;
|
||||
border-top-left-radius: 0.25em;
|
||||
border-bottom-left-radius: 0.25em;
|
||||
}
|
||||
|
||||
.Tab--selected {
|
||||
border-right: (1em / 6) solid $color-default;
|
||||
border-right: math.div(1em, 6) solid $color-default;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
@return null;
|
||||
}
|
||||
@if math.unit($value) == '%' {
|
||||
@return $value / 100%;
|
||||
@return math.div($value, 100%);
|
||||
}
|
||||
@return $value / ($value * 0 + 1);
|
||||
@return math.div($value, $value * 0 + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,12 +48,12 @@
|
||||
|
||||
@each $name, $value in $colors {
|
||||
$adjusted: 0;
|
||||
$value: $value / 255;
|
||||
$value: math.div($value, 255);
|
||||
@if $value < 0.03928 {
|
||||
$value: $value / 12.92;
|
||||
$value: math.div($value, 12.92);
|
||||
}
|
||||
@else {
|
||||
$value: ($value + .055) / 1.055;
|
||||
$value: math.div($value + .055, 1.055);
|
||||
$value: math.pow($value, 2.4);
|
||||
}
|
||||
$colors: map.merge($colors, ($name: $value));
|
||||
|
||||
+12
-17
@@ -1,28 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es3",
|
||||
"noEmit": true,
|
||||
"strict": false,
|
||||
"allowJs": true,
|
||||
"checkJs": false,
|
||||
"jsx": "preserve",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext",
|
||||
"ScriptHost"
|
||||
],
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"checkJs": false,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"isolatedModules": false,
|
||||
"jsx": "preserve",
|
||||
"lib": ["DOM", "DOM.Iterable", "ESNext", "ScriptHost"],
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"noEmit": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": false
|
||||
"skipLibCheck": true,
|
||||
"strict": false,
|
||||
"target": "ES3"
|
||||
},
|
||||
"include": [
|
||||
"./global.d.ts",
|
||||
"./*.d.ts",
|
||||
"./packages"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -98,10 +98,6 @@ module.exports = (env = {}, argv) => {
|
||||
},
|
||||
optimization: {
|
||||
emitOnErrors: false,
|
||||
splitChunks: {
|
||||
chunks: 'initial',
|
||||
name: 'tgui-common',
|
||||
},
|
||||
},
|
||||
performance: {
|
||||
hints: false,
|
||||
|
||||
+2732
-3525
File diff suppressed because it is too large
Load Diff
@@ -152,7 +152,6 @@ export const TguiTarget = new Juke.Target({
|
||||
outputs: [
|
||||
'tgui/public/tgui.bundle.css',
|
||||
'tgui/public/tgui.bundle.js',
|
||||
'tgui/public/tgui-common.bundle.js',
|
||||
'tgui/public/tgui-panel.bundle.css',
|
||||
'tgui/public/tgui-panel.bundle.js',
|
||||
],
|
||||
@@ -193,7 +192,7 @@ export const TguiLintTarget = new Juke.Target({
|
||||
export const TguiDevTarget = new Juke.Target({
|
||||
dependsOn: [YarnTarget],
|
||||
executes: async ({ args }) => {
|
||||
await yarn('node', 'packages/tgui-dev-server/index.esm.js', ...args);
|
||||
await yarn('node', 'packages/tgui-dev-server/index.js', ...args);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user