Remove ".js" from module imports

pull/77/head
MillenniumEarl 2021-03-08 12:23:31 +01:00
parent 8a65cf67ff
commit 40f65d9fbb
21 changed files with 109 additions and 114 deletions

View File

@ -27,7 +27,7 @@ import {
Game,
searchHandiwork,
HandiworkSearchQuery
} from "./index.js";
} from "./index";
// Configure the .env reader
dotenv.config();

View File

@ -6,27 +6,22 @@
"use strict";
// Modules from file
import shared from "./scripts/shared.js";
import search from "./scripts/search.js";
import {
authenticate,
urlExists,
isF95URL,
send2faCode
} from "./scripts/network-helper.js";
import fetchLatestHandiworkURLs from "./scripts/fetch-data/fetch-latest.js";
import fetchPlatformData from "./scripts/fetch-data/fetch-platform-data.js";
import getHandiworkInformation from "./scripts/scrape-data/handiwork-parse.js";
import { IBasic } from "./scripts/interfaces.js";
import shared from "./scripts/shared";
import search from "./scripts/search";
import { authenticate, urlExists, isF95URL, send2faCode } from "./scripts/network-helper";
import fetchLatestHandiworkURLs from "./scripts/fetch-data/fetch-latest";
import fetchPlatformData from "./scripts/fetch-data/fetch-platform-data";
import getHandiworkInformation from "./scripts/scrape-data/handiwork-parse";
import { IBasic } from "./scripts/interfaces";
// Classes from file
import Credentials from "./scripts/classes/credentials.js";
import LoginResult from "./scripts/classes/login-result.js";
import UserProfile from "./scripts/classes/mapping/user-profile.js";
import LatestSearchQuery from "./scripts/classes/query/latest-search-query.js";
import HandiworkSearchQuery from "./scripts/classes/query/handiwork-search-query.js";
import HandiWork from "./scripts/classes/handiwork/handiwork.js";
import { UserNotLogged } from "./scripts/classes/errors.js";
import Credentials from "./scripts/classes/credentials";
import LoginResult from "./scripts/classes/login-result";
import UserProfile from "./scripts/classes/mapping/user-profile";
import LatestSearchQuery from "./scripts/classes/query/latest-search-query";
import HandiworkSearchQuery from "./scripts/classes/query/handiwork-search-query";
import HandiWork from "./scripts/classes/handiwork/handiwork";
import { UserNotLogged } from "./scripts/classes/errors";
//#region Global variables
@ -36,20 +31,20 @@ const USER_NOT_LOGGED = "User not authenticated, unable to continue";
//#region Re-export classes
export { default as Animation } from "./scripts/classes/handiwork/animation.js";
export { default as Asset } from "./scripts/classes/handiwork/asset.js";
export { default as Comic } from "./scripts/classes/handiwork/comic.js";
export { default as Game } from "./scripts/classes/handiwork/game.js";
export { default as Handiwork } from "./scripts/classes/handiwork/handiwork.js";
export { default as Animation } from "./scripts/classes/handiwork/animation";
export { default as Asset } from "./scripts/classes/handiwork/asset";
export { default as Comic } from "./scripts/classes/handiwork/comic";
export { default as Game } from "./scripts/classes/handiwork/game";
export { default as Handiwork } from "./scripts/classes/handiwork/handiwork";
export { default as PlatformUser } from "./scripts/classes/mapping/platform-user.js";
export { default as Post } from "./scripts/classes/mapping/post.js";
export { default as Thread } from "./scripts/classes/mapping/thread.js";
export { default as UserProfile } from "./scripts/classes/mapping/user-profile.js";
export { default as PlatformUser } from "./scripts/classes/mapping/platform-user";
export { default as Post } from "./scripts/classes/mapping/post";
export { default as Thread } from "./scripts/classes/mapping/thread";
export { default as UserProfile } from "./scripts/classes/mapping/user-profile";
export { default as HandiworkSearchQuery } from "./scripts/classes/query/handiwork-search-query.js";
export { default as LatestSearchQuery } from "./scripts/classes/query/latest-search-query.js";
export { default as ThreadSearchQuery } from "./scripts/classes/query/thread-search-query.js";
export { default as HandiworkSearchQuery } from "./scripts/classes/query/handiwork-search-query";
export { default as LatestSearchQuery } from "./scripts/classes/query/latest-search-query";
export { default as ThreadSearchQuery } from "./scripts/classes/query/thread-search-query";
//#endregion Re-export classes

View File

@ -6,7 +6,7 @@
"use strict";
// Modules from file
import { getF95Token } from "../network-helper.js";
import { getF95Token } from "../network-helper";
/**
* Represents the credentials used to access the platform.

View File

@ -10,9 +10,9 @@ import cheerio from "cheerio";
import { DateTime } from "luxon";
// Modules from files
import { urls } from "../../constants/url.js";
import { fetchHTML } from "../../network-helper.js";
import { GENERIC, MEMBER } from "../../constants/css-selector.js";
import { urls } from "../../constants/url";
import { fetchHTML } from "../../network-helper";
import { GENERIC, MEMBER } from "../../constants/css-selector";
/**
* Represents a generic user registered on the platform.

View File

@ -9,11 +9,11 @@
import cheerio from "cheerio";
// Modules from file
import PlatformUser from "./platform-user.js";
import { IPostElement, parseF95ThreadPost } from "../../scrape-data/post-parse.js";
import { POST, THREAD } from "../../constants/css-selector.js";
import { urls } from "../../constants/url.js";
import { fetchHTML } from "../../network-helper.js";
import PlatformUser from "./platform-user";
import { IPostElement, parseF95ThreadPost } from "../../scrape-data/post-parse";
import { POST, THREAD } from "../../constants/css-selector";
import { urls } from "../../constants/url";
import { fetchHTML } from "../../network-helper";
/**
* Represents a post published by a user on the F95Zone platform.

View File

@ -10,20 +10,20 @@ import cheerio from "cheerio";
import { DateTime } from "luxon";
// Modules from files
import Post from "./post.js";
import PlatformUser from "./platform-user.js";
import { TCategory, TRating } from "../../interfaces.js";
import { urls } from "../../constants/url.js";
import { POST, THREAD } from "../../constants/css-selector.js";
import { fetchHTML, fetchPOSTResponse } from "../../network-helper.js";
import Shared from "../../shared.js";
import Post from "./post";
import PlatformUser from "./platform-user";
import { TCategory, TRating } from "../../interfaces";
import { urls } from "../../constants/url";
import { POST, THREAD } from "../../constants/css-selector";
import { fetchHTML, fetchPOSTResponse } from "../../network-helper";
import Shared from "../../shared";
import {
GenericAxiosError,
ParameterError,
UnexpectedResponseContentType
} from "../errors.js";
import { Result } from "../result.js";
import { getJSONLD, TJsonLD } from "../../scrape-data/json-ld.js";
} from "../errors";
import { Result } from "../result";
import { getJSONLD, TJsonLD } from "../../scrape-data/json-ld";
/**
* Represents a generic F95Zone platform thread.

View File

@ -9,13 +9,13 @@
import cheerio from "cheerio";
// Modules from files
import Post from "./post.js";
import PlatformUser from "./platform-user.js";
import { urls } from "../../constants/url.js";
import { GENERIC, WATCHED_THREAD } from "../../constants/css-selector.js";
import { fetchHTML } from "../../network-helper.js";
import { GenericAxiosError, UnexpectedResponseContentType } from "../errors.js";
import { Result } from "../result.js";
import Post from "./post";
import PlatformUser from "./platform-user";
import { urls } from "../../constants/url";
import { GENERIC, WATCHED_THREAD } from "../../constants/css-selector";
import { fetchHTML } from "../../network-helper";
import { GenericAxiosError, UnexpectedResponseContentType } from "../errors";
import { Result } from "../result";
// Interfaces
interface IWatchedThread {

View File

@ -6,7 +6,7 @@
"use strict";
// Modules from file
import shared, { TPrefixDict } from "../shared.js";
import shared, { TPrefixDict } from "../shared";
/**
* Convert prefixes and platform tags from string to ID and vice versa.

View File

@ -10,11 +10,11 @@ import { IsInt, Min, validateSync } from "class-validator";
import { AxiosResponse } from "axios";
// Module from files
import { IQuery, TCategory, TQueryInterface } from "../../interfaces.js";
import { GenericAxiosError } from "../errors.js";
import { Result } from "../result.js";
import LatestSearchQuery, { TLatestOrder } from "./latest-search-query.js";
import ThreadSearchQuery, { TThreadOrder } from "./thread-search-query.js";
import { IQuery, TCategory, TQueryInterface } from "../../interfaces";
import { GenericAxiosError } from "../errors";
import { Result } from "../result";
import LatestSearchQuery, { TLatestOrder } from "./latest-search-query";
import ThreadSearchQuery, { TThreadOrder } from "./thread-search-query";
// Type definitions
/**

View File

@ -9,13 +9,13 @@
import { ArrayMaxSize, IsInt, Min, validateSync } from "class-validator";
// Modules from file
import { urls } from "../../constants/url.js";
import PrefixParser from "../prefix-parser.js";
import { IQuery, TCategory, TQueryInterface } from "../../interfaces.js";
import { fetchGETResponse } from "../../network-helper.js";
import { urls } from "../../constants/url";
import PrefixParser from "../prefix-parser";
import { IQuery, TCategory, TQueryInterface } from "../../interfaces";
import { fetchGETResponse } from "../../network-helper";
import { AxiosResponse } from "axios";
import { GenericAxiosError } from "../errors.js";
import { Result } from "../result.js";
import { GenericAxiosError } from "../errors";
import { Result } from "../result";
// Type definitions
export type TLatestOrder = "date" | "likes" | "views" | "title" | "rating";

View File

@ -9,14 +9,14 @@
import { IsInt, Min, validateSync } from "class-validator";
// Module from files
import { IQuery, TCategory, TQueryInterface } from "../../interfaces.js";
import { urls } from "../../constants/url.js";
import PrefixParser from "./../prefix-parser.js";
import { fetchPOSTResponse } from "../../network-helper.js";
import { IQuery, TCategory, TQueryInterface } from "../../interfaces";
import { urls } from "../../constants/url";
import PrefixParser from "./../prefix-parser";
import { fetchPOSTResponse } from "../../network-helper";
import { AxiosResponse } from "axios";
import { GenericAxiosError } from "../errors.js";
import { Result } from "../result.js";
import Shared from "../../shared.js";
import { GenericAxiosError } from "../errors";
import { Result } from "../result";
import Shared from "../../shared";
// Type definitions
export type TThreadOrder = "relevance" | "date" | "last_update" | "replies";

View File

@ -9,8 +9,8 @@
import HandiworkSearchQuery from "../classes/query/handiwork-search-query";
import LatestSearchQuery from "../classes/query/latest-search-query";
import ThreadSearchQuery from "../classes/query/thread-search-query";
import fetchLatestHandiworkURLs from "./fetch-latest.js";
import fetchThreadHandiworkURLs from "./fetch-thread.js";
import fetchLatestHandiworkURLs from "./fetch-latest";
import fetchThreadHandiworkURLs from "./fetch-thread";
/**
* Gets the URLs of the handiworks that match the passed parameters.

View File

@ -6,8 +6,8 @@
"use strict";
// Modules from file
import LatestSearchQuery from "../classes/query/latest-search-query.js";
import { urls } from "../constants/url.js";
import LatestSearchQuery from "../classes/query/latest-search-query";
import { urls } from "../constants/url";
/**
* Gets the URLs of the latest handiworks that match the passed parameters.

View File

@ -12,10 +12,10 @@ import { readFileSync, writeFileSync, existsSync } from "fs";
import cheerio from "cheerio";
// Modules from file
import shared, { TPrefixDict } from "../shared.js";
import { urls as f95url } from "../constants/url.js";
import { GENERIC } from "../constants/css-selector.js";
import { fetchHTML } from "../network-helper.js";
import shared, { TPrefixDict } from "../shared";
import { urls as f95url } from "../constants/url";
import { GENERIC } from "../constants/css-selector";
import { fetchHTML } from "../network-helper";
//#region Interface definitions

View File

@ -6,13 +6,13 @@
"use strict";
// Modules from files
import fetchHandiworkURLs from "./fetch-handiwork.js";
import fetchLatestHandiworkURLs from "./fetch-latest.js";
import fetchThreadHandiworkURLs from "./fetch-thread.js";
import HandiworkSearchQuery from "../classes/query/handiwork-search-query.js";
import LatestSearchQuery from "../classes/query/latest-search-query.js";
import ThreadSearchQuery from "../classes/query/thread-search-query.js";
import { IQuery } from "../interfaces.js";
import fetchHandiworkURLs from "./fetch-handiwork";
import fetchLatestHandiworkURLs from "./fetch-latest";
import fetchThreadHandiworkURLs from "./fetch-thread";
import HandiworkSearchQuery from "../classes/query/handiwork-search-query";
import LatestSearchQuery from "../classes/query/latest-search-query";
import ThreadSearchQuery from "../classes/query/thread-search-query";
import { IQuery } from "../interfaces";
//#region Public methods

View File

@ -9,10 +9,10 @@
import cheerio from "cheerio";
// Modules from file
import shared from "../shared.js";
import { THREAD_SEARCH } from "../constants/css-selector.js";
import { urls as f95urls } from "../constants/url.js";
import ThreadSearchQuery from "../classes/query/thread-search-query.js";
import shared from "../shared";
import { THREAD_SEARCH } from "../constants/css-selector";
import { urls as f95urls } from "../constants/url";
import ThreadSearchQuery from "../classes/query/thread-search-query";
//#region Public methods

View File

@ -11,17 +11,17 @@ import cheerio from "cheerio";
import axiosCookieJarSupport from "axios-cookiejar-support";
// Modules from file
import shared from "./shared.js";
import { urls } from "./constants/url.js";
import { GENERIC } from "./constants/css-selector.js";
import LoginResult from "./classes/login-result.js";
import { failure, Result, success } from "./classes/result.js";
import shared from "./shared";
import { urls } from "./constants/url";
import { GENERIC } from "./constants/css-selector";
import LoginResult from "./classes/login-result";
import { failure, Result, success } from "./classes/result";
import {
GenericAxiosError,
InvalidF95Token,
UnexpectedResponseContentType
} from "./classes/errors.js";
import Credentials from "./classes/credentials.js";
} from "./classes/errors";
import Credentials from "./classes/credentials";
// Configure axios to use the cookie jar
axiosCookieJarSupport(axios);

View File

@ -9,11 +9,11 @@
import { DateTime } from "luxon";
// Modules from files
import HandiWork from "../classes/handiwork/handiwork.js";
import Thread from "../classes/mapping/thread.js";
import { IBasic, TAuthor, TEngine, TExternalPlatform, TStatus } from "../interfaces.js";
import shared, { TPrefixDict } from "../shared.js";
import { ILink, IPostElement } from "./post-parse.js";
import HandiWork from "../classes/handiwork/handiwork";
import Thread from "../classes/mapping/thread";
import { IBasic, TAuthor, TEngine, TExternalPlatform, TStatus } from "../interfaces";
import shared, { TPrefixDict } from "../shared";
import { ILink, IPostElement } from "./post-parse";
export async function getHandiworkInformation<T extends IBasic>(url: string): Promise<T>;

View File

@ -9,8 +9,8 @@
import cheerio from "cheerio";
// Modules from file
import shared from "../shared.js";
import { THREAD } from "../constants/css-selector.js";
import shared from "../shared";
import { THREAD } from "../constants/css-selector";
/**
* Represents information contained in a JSON+LD tag.

View File

@ -7,9 +7,9 @@
"use strict";
// Modules from file
import { IBasic, IQuery } from "./interfaces.js";
import getHandiworkInformation from "./scrape-data/handiwork-parse.js";
import getURLsFromQuery from "./fetch-data/fetch-query.js";
import { IBasic, IQuery } from "./interfaces";
import getHandiworkInformation from "./scrape-data/handiwork-parse";
import getURLsFromQuery from "./fetch-data/fetch-query";
/**
* Gets the handiworks that match the passed parameters.

View File

@ -14,7 +14,7 @@ import { join } from "path";
import log4js from "log4js";
// Modules from file
import Session from "./classes/session.js";
import Session from "./classes/session";
// Types declaration
export type TPrefixDict = { [n: number]: string };