chore: switch to esm, support raw running via node #2696

Merged
Sainan merged 3 commits from esm into main 2025-08-26 04:29:07 -07:00
18 changed files with 42 additions and 40 deletions
Showing only changes of commit 1a83f1ea3f - Show all commits

8
package-lock.json generated
View File

@ -23,7 +23,7 @@
"ncp": "^2.0.0",
"typescript": "^5.7",
"undici": "^7.10.0",
"warframe-public-export-plus": "^0.5.82",
"warframe-public-export-plus": "^0.5.83",
"warframe-riven-info": "^0.1.2",
"winston": "^3.17.0",
"winston-daily-rotate-file": "^5.0.0",
@ -5507,9 +5507,9 @@
}
},
"node_modules/warframe-public-export-plus": {
"version": "0.5.82",
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.82.tgz",
"integrity": "sha512-hZa9KpMDA2wy0Hn03y9Nfyzbjxer1I6Rvb52b363uzrqS0cvDO56rhiDo71JbraeV34qF6yo+Vca1zwFmw2srA=="
"version": "0.5.83",
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.83.tgz",
"integrity": "sha512-SJgw6NxQaiLgMfnKGML8mRY9lT3wJb3HEABSvuCd/XiKpUqPgqTCp7EwPhbG3D/FMtN+IZjBQgykLD5R7/MSRA=="
},
"node_modules/warframe-riven-info": {
"version": "0.1.2",

View File

@ -25,6 +25,7 @@
"fix": "npm run update-translations && npm run fix-imports && npm run prettier"
},
"license": "GNU",
"type": "module",
"dependencies": {
"@types/express": "^5",
"@types/morgan": "^1.9.9",
@ -40,7 +41,7 @@
"ncp": "^2.0.0",
"typescript": "^5.7",
"undici": "^7.10.0",
"warframe-public-export-plus": "^0.5.82",
"warframe-public-export-plus": "^0.5.83",
"warframe-riven-info": "^0.1.2",
"winston": "^3.17.0",
"winston-daily-rotate-file": "^5.0.0",

View File

@ -1,6 +1,6 @@
import type { RequestHandler } from "express";
import { config } from "../../services/configService.ts";
import allShipFeatures from "../../../static/fixed_responses/allShipFeatures.json";
import allShipFeatures from "../../../static/fixed_responses/allShipFeatures.json" with { type: "json" };
import { getAccountIdForRequest } from "../../services/loginService.ts";
import { createGarden, getPersonalRooms } from "../../services/personalRoomsService.ts";
import type { IGetShipResponse, IPersonalRoomsClient } from "../../types/personalRoomsTypes.ts";

View File

@ -3,7 +3,7 @@ import { getAccountForRequest } from "../../services/loginService.ts";
import type { TInventoryDatabaseDocument } from "../../models/inventoryModels/inventoryModel.ts";
import { Inventory } from "../../models/inventoryModels/inventoryModel.ts";
import { config } from "../../services/configService.ts";
import allDialogue from "../../../static/fixed_responses/allDialogue.json";
import allDialogue from "../../../static/fixed_responses/allDialogue.json" with { type: "json" };
import type { ILoadoutDatabase } from "../../types/saveLoadoutTypes.ts";
import type { IInventoryClient, IShipInventory } from "../../types/inventoryTypes/inventoryTypes.ts";
import { equipmentKeys } from "../../types/inventoryTypes/inventoryTypes.ts";

View File

@ -1,6 +1,6 @@
import { getJSONfromString } from "../../helpers/stringHelpers.ts";
import type { RequestHandler } from "express";
import glyphCodes from "../../../static/fixed_responses/glyphsCodes.json";
import glyphCodes from "../../../static/fixed_responses/glyphsCodes.json" with { type: "json" };
import { getAccountIdForRequest } from "../../services/loginService.ts";
import { addItem, getInventory } from "../../services/inventoryService.ts";

View File

@ -21,8 +21,8 @@ import {
ExportWarframes,
ExportWeapons
} from "warframe-public-export-plus";
import allIncarnons from "../../../static/fixed_responses/allIncarnonList.json";
import varzia from "../../../static/fixed_responses/worldState/varzia.json";
import allIncarnons from "../../../static/fixed_responses/allIncarnonList.json" with { type: "json" };
import varzia from "../../../static/fixed_responses/worldState/varzia.json" with { type: "json" };
interface ListedItem {
uniqueName: string;

View File

@ -1,5 +1,5 @@
import type { RequestHandler } from "express";
import aggregateSessions from "../../../static/fixed_responses/aggregateSessions.json";
import aggregateSessions from "../../../static/fixed_responses/aggregateSessions.json" with { type: "json" };
const aggregateSessionsController: RequestHandler = (_req, res) => {
res.json(aggregateSessions);

View File

@ -1,7 +1,7 @@
import type { RequestHandler } from "express";
import { getAccountIdForRequest } from "../../services/loginService.ts";
import { config } from "../../services/configService.ts";
import allScans from "../../../static/fixed_responses/allScans.json";
import allScans from "../../../static/fixed_responses/allScans.json" with { type: "json" };
import { ExportEnemies } from "warframe-public-export-plus";
import { getInventory } from "../../services/inventoryService.ts";
import { getStats } from "../../services/statsService.ts";

View File

@ -1,4 +1,4 @@
import path from "path";
export const rootDir = path.join(__dirname, "../..");
export const rootDir = path.join(import.meta.dirname, "../..");
export const repoDir = path.basename(rootDir) != "build" ? rootDir : path.join(rootDir, "..");

View File

@ -4,7 +4,7 @@ import { config, configPath, configRemovedOptionsKeys, loadConfig, syncConfigWit
import { saveConfig, shouldReloadConfig } from "./configWriterService.ts";
import { getWebPorts, startWebServer, stopWebServer } from "./webService.ts";
import { sendWsBroadcast } from "./wsService.ts";
import varzia from "../../static/fixed_responses/worldState/varzia.json";
import varzia from "../../static/fixed_responses/worldState/varzia.json" with { type: "json" };
chokidar.watch(configPath).on("change", () => {
if (shouldReloadConfig()) {

View File

@ -33,7 +33,7 @@ import { Inbox } from "../models/inboxModel.ts";
import type { IFusionTreasure } from "../types/inventoryTypes/inventoryTypes.ts";
import type { IInventoryChanges } from "../types/purchaseTypes.ts";
import { parallelForeach } from "../utils/async-utils.ts";
import allDecoRecipes from "../../static/fixed_responses/allDecoRecipes.json";
import allDecoRecipes from "../../static/fixed_responses/allDecoRecipes.json" with { type: "json" };
import { createMessage } from "./inboxService.ts";
import { addAccountDataToFriendInfo, addInventoryDataToFriendInfo } from "./friendService.ts";
import type { ITypeCount } from "../types/commonTypes.ts";

View File

@ -72,7 +72,7 @@ import {
} from "../helpers/inventoryHelpers.ts";
import { addQuestKey, completeQuest } from "./questService.ts";
import { handleBundleAcqusition } from "./purchaseService.ts";
import libraryDailyTasks from "../../static/fixed_responses/libraryDailyTasks.json";
import libraryDailyTasks from "../../static/fixed_responses/libraryDailyTasks.json" with { type: "json" };
import { generateRewardSeed, getRandomElement, getRandomInt, getRandomWeightedReward, SRng } from "./rngService.ts";
import type { IMessageCreationTemplate } from "./inboxService.ts";
import { createMessage } from "./inboxService.ts";

View File

@ -1,4 +1,4 @@
import randomRewards from "../../static/fixed_responses/loginRewards/randomRewards.json";
import randomRewards from "../../static/fixed_responses/loginRewards/randomRewards.json" with { type: "json" };
import type { IInventoryChanges } from "../types/purchaseTypes.ts";
import type { TAccountDocument } from "./loginService.ts";
import { mixSeeds, SRng } from "./rngService.ts";

View File

@ -53,10 +53,10 @@ import type { IMissionCredits, IMissionReward } from "../types/missionTypes.ts";
import { crackRelic } from "../helpers/relicHelper.ts";
import type { IMessageCreationTemplate } from "./inboxService.ts";
import { createMessage } from "./inboxService.ts";
import kuriaMessage50 from "../../static/fixed_responses/kuriaMessages/fiftyPercent.json";
import kuriaMessage75 from "../../static/fixed_responses/kuriaMessages/seventyFivePercent.json";
import kuriaMessage100 from "../../static/fixed_responses/kuriaMessages/oneHundredPercent.json";
import conservationAnimals from "../../static/fixed_responses/conservationAnimals.json";
import kuriaMessage50 from "../../static/fixed_responses/kuriaMessages/fiftyPercent.json" with { type: "json" };
import kuriaMessage75 from "../../static/fixed_responses/kuriaMessages/seventyFivePercent.json" with { type: "json" };
import kuriaMessage100 from "../../static/fixed_responses/kuriaMessages/oneHundredPercent.json" with { type: "json" };
import conservationAnimals from "../../static/fixed_responses/conservationAnimals.json" with { type: "json" };
import {
generateNemesisProfile,
getInfestedLichItemRewards,
@ -76,7 +76,7 @@ import {
pushClassicBounties
} from "./worldStateService.ts";
import { config } from "./configService.ts";
import libraryDailyTasks from "../../static/fixed_responses/libraryDailyTasks.json";
import libraryDailyTasks from "../../static/fixed_responses/libraryDailyTasks.json" with { type: "json" };
import type { IGoal, ISyndicateMissionInfo } from "../types/worldStateTypes.ts";
import { fromOid } from "../helpers/inventoryHelpers.ts";
import type { TAccountDocument } from "./loginService.ts";

View File

@ -10,7 +10,7 @@ import type { Types } from "mongoose";
import { ExportKeys } from "warframe-public-export-plus";
import { addFixedLevelRewards } from "./missionInventoryUpdateService.ts";
import type { IInventoryChanges } from "../types/purchaseTypes.ts";
import questCompletionItems from "../../static/fixed_responses/questCompletionRewards.json";
import questCompletionItems from "../../static/fixed_responses/questCompletionRewards.json" with { type: "json" };
import type { ITypeCount } from "../types/commonTypes.ts";
export interface IUpdateQuestRequest {

View File

@ -1,14 +1,14 @@
import staticWorldState from "../../static/fixed_responses/worldState/worldState.json";
import baro from "../../static/fixed_responses/worldState/baro.json";
import varzia from "../../static/fixed_responses/worldState/varzia.json";
import fissureMissions from "../../static/fixed_responses/worldState/fissureMissions.json";
import sortieTilesets from "../../static/fixed_responses/worldState/sortieTilesets.json";
import sortieTilesetMissions from "../../static/fixed_responses/worldState/sortieTilesetMissions.json";
import syndicateMissions from "../../static/fixed_responses/worldState/syndicateMissions.json";
import darvoDeals from "../../static/fixed_responses/worldState/darvoDeals.json";
import invasionNodes from "../../static/fixed_responses/worldState/invasionNodes.json";
import invasionRewards from "../../static/fixed_responses/worldState/invasionRewards.json";
import pvpChallenges from "../../static/fixed_responses/worldState/pvpChallenges.json";
import staticWorldState from "../../static/fixed_responses/worldState/worldState.json" with { type: "json" };
import baro from "../../static/fixed_responses/worldState/baro.json" with { type: "json" };
import varzia from "../../static/fixed_responses/worldState/varzia.json" with { type: "json" };
import fissureMissions from "../../static/fixed_responses/worldState/fissureMissions.json" with { type: "json" };
import sortieTilesets from "../../static/fixed_responses/worldState/sortieTilesets.json" with { type: "json" };
import sortieTilesetMissions from "../../static/fixed_responses/worldState/sortieTilesetMissions.json" with { type: "json" };
import syndicateMissions from "../../static/fixed_responses/worldState/syndicateMissions.json" with { type: "json" };
import darvoDeals from "../../static/fixed_responses/worldState/darvoDeals.json" with { type: "json" };
import invasionNodes from "../../static/fixed_responses/worldState/invasionNodes.json" with { type: "json" };
import invasionRewards from "../../static/fixed_responses/worldState/invasionRewards.json" with { type: "json" };
import pvpChallenges from "../../static/fixed_responses/worldState/pvpChallenges.json" with { type: "json" };
import { buildConfig } from "./buildConfigService.ts";
import { unixTimesInMs } from "../constants/timeConstants.ts";
import { config } from "./configService.ts";

View File

@ -1,22 +1,23 @@
import type http from "http";
import type https from "https";
import ws from "ws";
import type { default as ws } from "ws";
import { WebSocketServer } from "ws";
import { Account } from "../models/loginModel.ts";
import { createAccount, createNonce, getUsernameFromEmail, isCorrectPassword } from "./loginService.ts";
import type { IDatabaseAccountJson } from "../types/loginTypes.ts";
import type { HydratedDocument } from "mongoose";
import { logError } from "../utils/logger.ts";
let wsServer: ws.Server | undefined;
let wssServer: ws.Server | undefined;
let wsServer: WebSocketServer | undefined;
let wssServer: WebSocketServer | undefined;
export const startWsServer = (httpServer: http.Server): void => {
wsServer = new ws.Server({ server: httpServer });
wsServer = new WebSocketServer({ server: httpServer });
wsServer.on("connection", wsOnConnect);
};
export const startWssServer = (httpsServer: https.Server): void => {
wssServer = new ws.Server({ server: httpsServer });
wssServer = new WebSocketServer({ server: httpsServer });
wssServer.on("connection", wsOnConnect);
};

View File

@ -25,7 +25,7 @@
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "node16" /* Specify what module code is generated. */,
"module": "node18" /* Specify what module code is generated. */,
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */