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

[MIRROR] Renames js files into "proper" jsx #770

Merged
merged 1 commit into from
Nov 22, 2023
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
File renamed without changes.
4 changes: 2 additions & 2 deletions tgui/packages/tgui-dev-server/dreamseeker.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import { exec } from 'child_process';
import { promisify } from 'util';
import { createLogger } from './logging.js';
import { require } from './require.js';
import { createLogger } from './logging';
import { require } from './require';

const axios = require('axios');
const logger = createLogger('dreamseeker');
Expand Down
4 changes: 2 additions & 2 deletions tgui/packages/tgui-dev-server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* @license MIT
*/

import { createCompiler } from './webpack.js';
import { reloadByondCache } from './reloader.js';
import { createCompiler } from './webpack';
import { reloadByondCache } from './reloader';

const noHot = process.argv.includes('--no-hot');
const noTmp = process.argv.includes('--no-tmp');
Expand Down
6 changes: 3 additions & 3 deletions tgui/packages/tgui-dev-server/link/retrace.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import fs from 'fs';
import { basename } from 'path';
import { createLogger } from '../logging.js';
import { require } from '../require.js';
import { resolveGlob } from '../util.js';
import { createLogger } from '../logging';
import { require } from '../require';
import { resolveGlob } from '../util';

const SourceMap = require('source-map');
const { parse: parseStackTrace } = require('stacktrace-parser');
Expand Down
6 changes: 3 additions & 3 deletions tgui/packages/tgui-dev-server/link/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import http from 'http';
import { inspect } from 'util';
import { createLogger, directLog } from '../logging.js';
import { require } from '../require.js';
import { loadSourceMaps, retrace } from './retrace.js';
import { createLogger, directLog } from '../logging';
import { require } from '../require';
import { loadSourceMaps, retrace } from './retrace';

const WebSocket = require('ws');

Expand Down
8 changes: 4 additions & 4 deletions tgui/packages/tgui-dev-server/reloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
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';
import { createLogger } from './logging';
import { resolveGlob, resolvePath } from './util';
import { regQuery } from './winreg';

const logger = createLogger('reloader');

Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui-dev-server/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import fs from 'fs';
import path from 'path';
import { require } from './require.js';
import { require } from './require';

const globPkg = require('glob');

Expand Down
8 changes: 4 additions & 4 deletions tgui/packages/tgui-dev-server/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
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';
import { loadSourceMaps, setupLink } from './link/server';
import { createLogger } from './logging';
import { reloadByondCache } from './reloader';
import { resolveGlob } from './util';

const logger = createLogger('webpack');

Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui-dev-server/winreg.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { exec } from 'child_process';
import { promisify } from 'util';
import { createLogger } from './logging.js';
import { createLogger } from './logging';

const logger = createLogger('winreg');

Expand Down
File renamed without changes.
51 changes: 51 additions & 0 deletions tgui/packages/tgui/components/FakeTerminal.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { Box } from './Box';
import { Component, Fragment } from 'inferno';

export class FakeTerminal extends Component {
constructor(props) {
super(props);
this.timer = null;
this.state = {
currentIndex: 0,
currentDisplay: [],
};
}

tick() {
const { props, state } = this;
if (state.currentIndex <= props.allMessages.length) {
this.setState((prevState) => {
return {
currentIndex: prevState.currentIndex + 1,
};
});
const { currentDisplay } = state;
currentDisplay.push(props.allMessages[state.currentIndex]);
} else {
clearTimeout(this.timer);
setTimeout(props.onFinished, props.finishedTimeout);
}
}

componentDidMount() {
const { linesPerSecond = 2.5 } = this.props;
this.timer = setInterval(() => this.tick(), 1000 / linesPerSecond);
}

componentWillUnmount() {
clearTimeout(this.timer);
}

render() {
return (
<Box m={1}>
{this.state.currentDisplay.map((value) => (
<Fragment key={value}>
{value}
<br />
</Fragment>
))}
</Box>
);
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion tgui/packages/tgui/interfaces/NtosCargo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CargoContent } from './Cargo.js';
import { CargoContent } from './Cargo';
import { NtosWindow } from '../layouts';

export const NtosCargo = (props, context) => {
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui/interfaces/NtosTechweb.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AppTechweb } from './Techweb.js';
import { AppTechweb } from './Techweb';

export const NtosTechweb = (props, context) => {
return <AppTechweb />;
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions tgui/packages/tgui/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ export const getRoutedComponent = (store: Store) => {
const name = config?.interface;
const interfacePathBuilders = [
(name: string) => `./${name}.tsx`,
(name: string) => `./${name}.js`,
(name: string) => `./${name}.jsx`,
(name: string) => `./${name}/index.tsx`,
(name: string) => `./${name}/index.js`,
(name: string) => `./${name}/index.jsx`,
];
let esModule;
while (!esModule && interfacePathBuilders.length > 0) {
Expand Down
19 changes: 5 additions & 14 deletions tgui/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,9 @@ module.exports = (env = {}, argv) => {
context: path.resolve(__dirname),
target: ['web', 'es3', 'browserslist:ie 8'],
entry: {
'tgui': [
'./packages/tgui-polyfill',
'./packages/tgui',
],
'tgui-panel': [
'./packages/tgui-polyfill',
'./packages/tgui-panel',
],
'tgui-say': [
'./packages/tgui-polyfill',
'./packages/tgui-say',
],
'tgui': ['./packages/tgui-polyfill', './packages/tgui'],
'tgui-panel': ['./packages/tgui-polyfill', './packages/tgui-panel'],
'tgui-say': ['./packages/tgui-polyfill', './packages/tgui-say'],
},
output: {
path: argv.useTmpFolder
Expand All @@ -55,13 +46,13 @@ module.exports = (env = {}, argv) => {
chunkLoadTimeout: 15000,
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
extensions: ['.tsx', '.ts', '.js', '.jsx'],
alias: {},
},
module: {
rules: [
{
test: /\.(js|cjs|ts|tsx)$/,
test: /\.(js(x)?|cjs|ts(x)?)$/,
use: [
{
loader: require.resolve('babel-loader'),
Expand Down
Loading