Skip to content

Commit

Permalink
Fix imports... one final time. (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhar authored Jul 9, 2023
1 parent db952dc commit 811d338
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

# JavaScript and Type Definitions
!dist/**/*.d.ts
!dist/archipelago.min.js
!dist/**/*.js
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "archipelago.js",
"version": "1.0.1",
"version": "1.0.2",
"description": "A general-purpose client library for communicating with Archipelago game servers, written for Node.js.",
"license": "MIT",
"main": "archipelago.min.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"author": {
"email": "[email protected]",
Expand Down
4 changes: 2 additions & 2 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import { SetReplyPacket } from "./packets/SetReplyPacket";
import { ConnectionInformation } from "./types/ConnectionInformation";
import { VALID_JSON_MESSAGE_TYPE } from "./types/JSONMessagePart";
import { NetworkVersion } from "./types/NetworkVersion";
import { UnknownSlotData } from "./types/UnknownSlotData";
import { SlotData } from "./types/SlotData";

/**
* The client that connects to an Archipelago server and facilitates communication, listens for events, and manages
* data.
*/
export class Client<TSlotData = UnknownSlotData> {
export class Client<TSlotData = SlotData> {
#socket?: WebSocket;
#status: ConnectionStatus = CONNECTION_STATUS.DISCONNECTED;
#emitter = new EventEmitter();
Expand Down
14 changes: 0 additions & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,3 @@ export * from "./packets/SetPacket";
export * from "./packets/SetReplyPacket";
export * from "./packets/StatusUpdatePacket";
export * from "./packets/SyncPacket";
export * from "./types/ConnectionInformation";
export * from "./types/DataPackage";
export * from "./types/DataStorageOperations";
export * from "./types/DeathLinkData";
export * from "./types/GamePackage";
export * from "./types/Hint";
export * from "./types/JSONMessagePart";
export * from "./types/JSONSerializableData";
export * from "./types/NetworkItem";
export * from "./types/NetworkPlayer";
export * from "./types/NetworkSlot";
export * from "./types/NetworkVersion";
export * from "./types/Player";
export * from "./types/UnknownSlotData";
4 changes: 2 additions & 2 deletions src/packets/ConnectedPacket.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NetworkPlayer } from "../types/NetworkPlayer";
import { NetworkSlot } from "../types/NetworkSlot";
import { UnknownSlotData } from "../types/UnknownSlotData";
import { SlotData } from "../types/SlotData";
import { BaseServerPacket } from "./BasePackets";

/**
Expand Down Expand Up @@ -30,7 +30,7 @@ export interface ConnectedPacket extends BaseServerPacket {
checked_locations: number[];

/** Contains a json object for slot related data, differs per game. Empty if not required. */
slot_data: UnknownSlotData;
slot_data: SlotData;

/** Object of each slot with their {@link NetworkSlot} information. */
slot_info: { [slot: number]: NetworkSlot };
Expand Down
4 changes: 2 additions & 2 deletions src/types/ConnectionInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ItemsHandlingFlags } from "../consts/ItemsHandlingFlags";
/**
* An object that holds credential information for a slot to connect.
*/
export interface ConnectionInformation {
export type ConnectionInformation = {
/** The hostname or ip address of the Archipelago server to connect to. */
hostname: string;

Expand Down Expand Up @@ -46,4 +46,4 @@ export interface ConnectionInformation {
* on individual flags.
*/
items_handling: number | ItemsHandlingFlags;
}
};
5 changes: 4 additions & 1 deletion src/types/UnknownSlotData.ts → src/types/SlotData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { JSONSerializableData } from "./JSONSerializableData";
/**
* A stand in for unknown slot data.
*/
export type UnknownSlotData = {
export type SlotData = {
[arg: string]: JSONSerializableData;
};

// For backwards compatibility.
export type UnknownSlotData = SlotData;
14 changes: 14 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export * from "./ConnectionInformation";
export * from "./DataPackage";
export * from "./DataStorageOperations";
export * from "./DeathLinkData";
export * from "./GamePackage";
export * from "./Hint";
export * from "./JSONMessagePart";
export * from "./JSONSerializableData";
export * from "./NetworkItem";
export * from "./NetworkPlayer";
export * from "./NetworkSlot";
export * from "./ObjectValues";
export * from "./Player";
export * from "./SlotData";
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */

/* Modules */
"module": "esnext", /* Specify what module code is generated. */
"module": "commonjs", /* Specify what module code is generated. */
"rootDir": "./src", /* Specify the root folder within your source files. */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"baseUrl": "./src", /* Specify the base directory to resolve non-relative module names. */
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
minimizer: [new TerserPlugin()],
},
output: {
path: path.resolve(__dirname),
path: path.resolve(__dirname, "dist"),
filename: "archipelago.min.js",
library: {
type: "module",
Expand Down

0 comments on commit 811d338

Please sign in to comment.