Skip to content

Commit

Permalink
use nodenext for compat (but bring back yucky extensions)
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen3H committed Jun 25, 2024
1 parent 48a19cd commit 1cf3a8f
Show file tree
Hide file tree
Showing 26 changed files with 27 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/OAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
OAPINation,
RawServerInfoV2,
RawServerInfoV3
} from './types'
} from './types/index.js'

import { townyData } from './utils/endpoint.js'
import { FetchError } from './utils/errors.js'
Expand Down
2 changes: 1 addition & 1 deletion src/api/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { StrictPoint2D, Point2D, TownBounds } from ".././types"
import type { StrictPoint2D, Point2D, TownBounds } from ".././types/index.js"
import { hypot, safeParseInt, strictFalsy } from ".././utils/functions.js"

type LocOrNation = Partial<Point2D & {
Expand Down
2 changes: 1 addition & 1 deletion src/api/dynmap/Dynmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type {
MapResponse, PlayersResponse,
Point2D, TownBounds,
DynmapMap
} from '../../types'
} from '../../types/index.js'

import DataHandler from '../../helpers/DataHandler.js'

Expand Down
2 changes: 1 addition & 1 deletion src/api/dynmap/GPS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type Dynmap from './Dynmap.js'
import {
type Route, Routes, type RouteInfo,
type Location, type Nation, type Player
} from '../../types'
} from '../../types/index.js'

import Mitt from '../../helpers/EventEmitter.js'
import { manhattan, safeParseInt, strictFalsy } from '../../utils/functions.js'
Expand Down
2 changes: 1 addition & 1 deletion src/api/dynmap/Nations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {
Nation, StrictPoint2D, Town
} from '../../types'
} from '../../types/index.js'

import type { Dynmap } from "./Dynmap.js"
import type { EntityApi } from '../../helpers/EntityApi.js'
Expand Down
2 changes: 1 addition & 1 deletion src/api/dynmap/Players.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
MapResponse,
OnlinePlayer, Player,
StrictPoint2D
} from '../../types'
} from '../../types/index.js'

import * as fn from '../../utils/functions.js'
import * as endpoint from '../../utils/endpoint.js'
Expand Down
2 changes: 1 addition & 1 deletion src/api/dynmap/Residents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type Dynmap from "./Dynmap.js"

import type {
Resident, Town
} from '../../types'
} from '../../types/index.js'

import {
FetchError,
Expand Down
2 changes: 1 addition & 1 deletion src/api/dynmap/Towns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from "../../utils/errors.js"

import type { EntityApi } from '../../helpers/EntityApi.js'
import type { Nation, StrictPoint2D, Town } from '../../types'
import type { Nation, StrictPoint2D, Town } from '../../types/index.js'
import { getNearest } from '../common.js'

class Towns implements EntityApi<Town | NotFoundError> {
Expand Down
2 changes: 1 addition & 1 deletion src/api/squaremap/GPS.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
type Route, Routes, type RouteInfo,
type Location, type Nation, type Player
} from '../../types'
} from '../../types/index.js'

import Mitt from '../../helpers/EventEmitter.js'
import { manhattan, safeParseInt, strictFalsy } from '../../utils/functions.js'
Expand Down
2 changes: 1 addition & 1 deletion src/api/squaremap/Nations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type Squaremap from "./Squaremap.js"

import { FetchError, type NotFoundError } from "../../utils/errors.js"
import type { EntityApi } from "../../helpers/EntityApi.js"
import type { Nation, SquaremapTown, StrictPoint2D } from "../../types"
import type { Nation, SquaremapTown, StrictPoint2D } from "../../types/index.js"

import { getExisting, sqr } from "../../utils/functions.js"

Expand Down
2 changes: 1 addition & 1 deletion src/api/squaremap/Players.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
EntityApi
} from "../../helpers/EntityApi.js"

import type { OnlinePlayer, Player, StrictPoint2D } from "../../types"
import type { OnlinePlayer, Player, StrictPoint2D } from "../../types/index.js"
import { FetchError, type NotFoundError } from "../../utils/errors.js"
import { getExisting } from "../../utils/functions.js"
import { parseInfoString } from "./parser.js"
Expand Down
2 changes: 1 addition & 1 deletion src/api/squaremap/Residents.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type Squaremap from "./Squaremap.js"

import type { Resident, SquaremapTown } from "../../types"
import type { Resident, SquaremapTown } from "../../types/index.js"

import type { EntityApi } from "../../helpers/EntityApi.js"
import { InvalidError, type NotFoundError } from "../../utils/errors.js"
Expand Down
2 changes: 1 addition & 1 deletion src/api/squaremap/Squaremap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
SquaremapMapResponse,
SquaremapPlayersResponse,
TownBounds
} from "../../types"
} from "../../types/index.js"

import DataHandler from "../../helpers/DataHandler.js"

Expand Down
2 changes: 1 addition & 1 deletion src/api/squaremap/Towns.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type Squaremap from "./Squaremap.js"
import type { Nation, SquaremapTown, StrictPoint2D } from "../../types"
import type { Nation, SquaremapTown, StrictPoint2D } from "../../types/index.js"

import type { EntityApi } from "../../helpers/EntityApi.js"
import { parseTowns } from "./parser.js"
Expand Down
2 changes: 1 addition & 1 deletion src/api/squaremap/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
SquaremapRawPlayer,
SquaremapTown,
StrictPoint2D
} from '../../types'
} from '../../types/index.js'

/**
* Parses the tooltip on a marker - removing white space, new lines and HTML tags.
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/DataHandler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as endpoint from '../utils/endpoint.js'

import { Mutex } from 'async-mutex'
import type { AnyMap } from '../types'
import type { AnyMap } from '../types/index.js'

class DataHandler {
#map: AnyMap
Expand Down
1 change: 1 addition & 0 deletions src/helpers/EventEmitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default class Mitt {
protected emit: any

constructor() {
//@ts-ignore
const emitter = mitt()

Object.keys(emitter).forEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Squaremap from './api/squaremap/Squaremap.js'

import MCAPI from "mojang-lib"
import { OAPIV2, OAPIV3 } from './OAPI.js'
import type { PlayersResponse } from './types'
import type { PlayersResponse } from './types/index.js'

const Aurora = new Squaremap('aurora')
const Nova = new Dynmap('nova')
Expand Down
2 changes: 1 addition & 1 deletion src/types/dynmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
StringContainedWithin,
HexString,
Opacity
} from '../types'
} from '../types/index.js'

export type MapResponse = {
timestamp: number
Expand Down
2 changes: 1 addition & 1 deletion src/types/nation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
RawEntitySpawn,
RawEntityStats,
RawEntityStatus
} from "../types"
} from "../types/index.js"

import type { Prettify } from "./util.js"

Expand Down
2 changes: 1 addition & 1 deletion src/types/oapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type {
Location,
NestedOmit,
Prettify
} from '../types'
} from '../types/index.js'

//#region V2
//#region Parsed
Expand Down
2 changes: 1 addition & 1 deletion src/types/player.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Location, Resident } from '../types'
import type { Location, Resident } from '../types/index.js'

export type OnlinePlayer = Location & {
name: string
Expand Down
2 changes: 1 addition & 1 deletion src/types/squaremap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
Opacity,
Prettify,
StrictPoint2D
} from '../types'
} from '../types/index.js'

export interface SquaremapPlayersResponse {
max: number
Expand Down
2 changes: 1 addition & 1 deletion src/utils/endpoint.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import endpoints from '../endpoints.json'

import { request, type Dispatcher } from "undici"
import type { AnyMap } from "../types"
import type { AnyMap } from "../types/index.js"

import { genRandomString } from './functions.js'

Expand Down
2 changes: 1 addition & 1 deletion src/utils/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
Point2D,
RawPlayer, Player, Town,
BaseTown, BaseNation
} from '../types'
} from '../types/index.js'

import { NotFound } from './errors.js'

Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"moduleDetection": "force",
"target": "ES2017",
"lib": ["ES2023"],
Expand Down

0 comments on commit 1cf3a8f

Please sign in to comment.