mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 01:33:54 +01:00
Merge pull request #1157 from threehams/faster-builds
Switch ts and babel for swc-loader
This commit is contained in:
commit
4011542b97
1930
package-lock.json
generated
1930
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -44,6 +44,8 @@
|
|||||||
"react-dom": "^16.8.3",
|
"react-dom": "^16.8.3",
|
||||||
"react-modal": "^3.12.1",
|
"react-modal": "^3.12.1",
|
||||||
"sprintf-js": "^1.1.1",
|
"sprintf-js": "^1.1.1",
|
||||||
|
"swc": "^1.0.11",
|
||||||
|
"swc-loader": "^0.1.14",
|
||||||
"tapable": "^1.0.0",
|
"tapable": "^1.0.0",
|
||||||
"treant-js": "^1.0.1",
|
"treant-js": "^1.0.1",
|
||||||
"uuid": "^3.2.1",
|
"uuid": "^3.2.1",
|
||||||
|
@ -241,7 +241,7 @@ export class ResearchTree {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mult: any = (<any>research)[propName];
|
const mult: any = (research as any)[propName];
|
||||||
if (mult == null) {
|
if (mult == null) {
|
||||||
console.warn(
|
console.warn(
|
||||||
`Invalid propName specified in ResearchTree.getMultiplierHelper: ${propName}`,
|
`Invalid propName specified in ResearchTree.getMultiplierHelper: ${propName}`,
|
||||||
|
@ -113,12 +113,12 @@ export abstract class Person {
|
|||||||
*/
|
*/
|
||||||
applyAugmentation(aug: Augmentation): void {
|
applyAugmentation(aug: Augmentation): void {
|
||||||
for (const mult in aug.mults) {
|
for (const mult in aug.mults) {
|
||||||
if ((<any>this)[mult] == null) {
|
if ((this as any)[mult] == null) {
|
||||||
console.warn(
|
console.warn(
|
||||||
`Augmentation has unrecognized multiplier property: ${mult}`,
|
`Augmentation has unrecognized multiplier property: ${mult}`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
(<any>this)[mult] *= aug.mults[mult];
|
(this as any)[mult] *= aug.mults[mult];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,9 +214,9 @@ export class Sleeve extends Person {
|
|||||||
// Success
|
// Success
|
||||||
const successGainRates: ITaskTracker = createTaskTracker();
|
const successGainRates: ITaskTracker = createTaskTracker();
|
||||||
|
|
||||||
const keysForIteration: (keyof ITaskTracker)[] = <
|
const keysForIteration: (keyof ITaskTracker)[] = Object.keys(
|
||||||
(keyof ITaskTracker)[]
|
successGainRates,
|
||||||
>Object.keys(successGainRates);
|
) as (keyof ITaskTracker)[];
|
||||||
for (let i = 0; i < keysForIteration.length; ++i) {
|
for (let i = 0; i < keysForIteration.length; ++i) {
|
||||||
const key = keysForIteration[i];
|
const key = keysForIteration[i];
|
||||||
successGainRates[key] = this.gainRatesForTask[key] * 2;
|
successGainRates[key] = this.gainRatesForTask[key] * 2;
|
||||||
|
@ -37,10 +37,10 @@ function toNumber(n: number | IMinMaxRange): number {
|
|||||||
let value: number;
|
let value: number;
|
||||||
switch (typeof n) {
|
switch (typeof n) {
|
||||||
case "number": {
|
case "number": {
|
||||||
return <number>n;
|
return n;
|
||||||
}
|
}
|
||||||
case "object": {
|
case "object": {
|
||||||
const range = <IMinMaxRange>n;
|
const range = n as IMinMaxRange;
|
||||||
value = getRandomInt(range.min, range.max);
|
value = getRandomInt(range.min, range.max);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ export function tabCompletion(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const textBox = <HTMLInputElement>textBoxElem;
|
const textBox = textBoxElem as HTMLInputElement;
|
||||||
|
|
||||||
const oldValue = textBox.value;
|
const oldValue = textBox.value;
|
||||||
const semiColonIndex = oldValue.lastIndexOf(";");
|
const semiColonIndex = oldValue.lastIndexOf(";");
|
||||||
|
@ -575,8 +575,8 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: (data: any[]): string => {
|
desc: (data: any[]): string => {
|
||||||
const k: number = <number>data[0];
|
const k: number = data[0];
|
||||||
const prices: number[] = <number[]>data[1];
|
const prices: number[] = data[1];
|
||||||
return [
|
return [
|
||||||
"You are given the following array with two elements:\n\n",
|
"You are given the following array with two elements:\n\n",
|
||||||
`[${k}, [${prices}]]\n\n`,
|
`[${k}, [${prices}]]\n\n`,
|
||||||
@ -606,8 +606,8 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
|
|||||||
name: "Algorithmic Stock Trader IV",
|
name: "Algorithmic Stock Trader IV",
|
||||||
numTries: 10,
|
numTries: 10,
|
||||||
solver: (data: any[], ans: string): boolean => {
|
solver: (data: any[], ans: string): boolean => {
|
||||||
const k: number = <number>data[0];
|
const k: number = data[0];
|
||||||
const prices: number[] = <number[]>data[1];
|
const prices: number[] = data[1];
|
||||||
|
|
||||||
const len = prices.length;
|
const len = prices.length;
|
||||||
if (len < 2) {
|
if (len < 2) {
|
||||||
|
@ -38,7 +38,7 @@ export class MoneySourceTracker {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
(<number>this[sanitizedSource]) += amt;
|
(this[sanitizedSource] as number) += amt;
|
||||||
this.total += amt;
|
this.total += amt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
"isolatedModules": true,
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
"lib": ["es2016", "dom", "es2017.object", "es2019"],
|
"lib": ["es2016", "dom", "es2017.object", "es2019"],
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
|
@ -15,8 +15,8 @@ export function compareArrays<T>(a1: T[], a2: T[]): boolean {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const elem1 = <any[]>(<any>a1[i]);
|
const elem1 = a1[i] as any;
|
||||||
const elem2 = <any[]>(<any>a2[i]);
|
const elem2 = a2[i] as any;
|
||||||
if (!compareArrays(elem1, elem2)) {
|
if (!compareArrays(elem1, elem2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -109,14 +109,32 @@ module.exports = (env, argv) => {
|
|||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.tsx?$/,
|
test: /\.tsx?$/,
|
||||||
loader: "ts-loader",
|
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
|
use: {
|
||||||
|
loader: "swc-loader",
|
||||||
|
options: {
|
||||||
|
jsc: {
|
||||||
|
parser: {
|
||||||
|
syntax: "typescript",
|
||||||
|
tsx: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(jsx)$/,
|
test: /\.(jsx)$/,
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
use: {
|
use: {
|
||||||
loader: "babel-loader",
|
loader: "swc-loader",
|
||||||
|
options: {
|
||||||
|
jsc: {
|
||||||
|
parser: {
|
||||||
|
syntax: "ecmascript",
|
||||||
|
jsx: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user