Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore prettier config #63

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions prettier.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ module.exports = {
semi: true,
tabWidth: 2,
trailingComma: "all",
importOrder: [
"<THIRD_PARTY_MODULES>",
"^[./]",
],
plugins: [require.resolve("@trivago/prettier-plugin-sort-imports")],
importOrder: ["<THIRD_PARTY_MODULES>", "^[./]"],
importOrderSeparation: true,
importOrderSortSpecifiers: true,
importOrderParserPlugins: ["decorators-legacy", "typescript"],
Expand Down
12 changes: 6 additions & 6 deletions src/components/Communicator.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Driver } from "../typings/Driver";
import { Invoke } from "./Invoke";

import { serializeError } from "../utils/internal/serializeError";
import {
ConditionVariable,
DomainError,
HashMap,
Pair,
ConditionVariable,
RuntimeError,
DomainError,
} from "tstl";

import { Driver } from "../typings/Driver";
import { serializeError } from "../utils/internal/serializeError";
import { Invoke } from "./Invoke";

/**
* The basic communicator.
*
Expand Down
1 change: 1 addition & 0 deletions src/protocols/internal/AcceptorBase.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DomainError, RuntimeError } from "tstl";

import { Communicator } from "../../components/Communicator";

/**
Expand Down
1 change: 1 addition & 0 deletions src/protocols/internal/ConnectorBase.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DomainError, RuntimeError } from "tstl";

import { Communicator } from "../../components/Communicator";

/**
Expand Down
8 changes: 3 additions & 5 deletions src/protocols/web/WebAcceptor.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import type http from "http";
import type WebSocket from "ws";
import { DomainError } from "tstl";

import { AcceptorBase } from "../internal/AcceptorBase";
import { IWebCommunicator } from "./internal/IWebCommunicator";
import type WebSocket from "ws";

import { Invoke } from "../../components/Invoke";

import { AcceptorBase } from "../internal/AcceptorBase";
import { WebError } from "./WebError";
import { IWebCommunicator } from "./internal/IWebCommunicator";

/**
* Web Socket Acceptor.
Expand Down
8 changes: 4 additions & 4 deletions src/protocols/web/WebConnector.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Invoke } from "../../components/Invoke";
import { WebError } from "./WebError";
import { DomainError, is_node, sleep_for } from "tstl";

import { Invoke } from "../../components/Invoke";
import { ConnectorBase } from "../internal/ConnectorBase";
import { IHeaderWrapper } from "../internal/IHeaderWrapper";
import { IWebCommunicator } from "./internal/IWebCommunicator";
import { once } from "../internal/once";
import { WebError } from "./WebError";
import { IWebCommunicator } from "./internal/IWebCommunicator";
import { WebSocketPolyfill } from "./internal/WebSocketPolyfill";
import { DomainError, is_node, sleep_for } from "tstl";

/**
* Web Socket Connector.
Expand Down
9 changes: 4 additions & 5 deletions src/protocols/web/WebServer.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import type http from "http";
import type https from "https";
import type net from "net";
import { DomainError, RuntimeError, is_node } from "tstl";
import type WebSocket from "ws";

import { WebAcceptor } from "./WebAcceptor";
import { IServer } from "../internal/IServer";

import { IHeaderWrapper } from "../internal/IHeaderWrapper";
import { NodeModule } from "../../utils/internal/NodeModule";
import { is_node, DomainError, RuntimeError } from "tstl";
import { IHeaderWrapper } from "../internal/IHeaderWrapper";
import { IServer } from "../internal/IServer";
import { WebAcceptor } from "./WebAcceptor";

/**
* Web Socket Server.
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/workers/SharedWorkerAcceptor.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AcceptorBase } from "../internal/AcceptorBase";
import { IWorkerSystem } from "./internal/IWorkerSystem";
import { DomainError } from "tstl";

import { Invoke } from "../../components/Invoke";
import { AcceptorBase } from "../internal/AcceptorBase";
import { IReject } from "./internal/IReject";
import { DomainError } from "tstl";
import { IWorkerSystem } from "./internal/IWorkerSystem";

/**
* SharedWorker acceptor for client.
Expand Down
8 changes: 4 additions & 4 deletions src/protocols/workers/SharedWorkerConnector.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ConnectorBase } from "../internal/ConnectorBase";
import { IWorkerSystem } from "./internal/IWorkerSystem";
import { DomainError, RuntimeError, sleep_until } from "tstl";

import { Invoke } from "../../components/Invoke";
import { ConnectorBase } from "../internal/ConnectorBase";
import { IHeaderWrapper } from "../internal/IHeaderWrapper";
import { once } from "../internal/once";
import { IReject } from "./internal/IReject";
import { IWorkerSystem } from "./internal/IWorkerSystem";
import { WebWorkerCompiler } from "./internal/WebWorkerCompiler";
import { once } from "../internal/once";
import { DomainError, RuntimeError, sleep_until } from "tstl";

/**
* SharedWorker Connector
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/workers/SharedWorkerServer.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { IServer } from "../internal/IServer";
import { SharedWorkerAcceptor } from "./SharedWorkerAcceptor";
import { DomainError, HashSet, is_node } from "tstl";

import { IHeaderWrapper } from "../internal/IHeaderWrapper";
import { IServer } from "../internal/IServer";
import { once } from "../internal/once";
import { HashSet, is_node, DomainError } from "tstl";
import { SharedWorkerAcceptor } from "./SharedWorkerAcceptor";

/**
* SharedWorker server.
Expand Down
8 changes: 4 additions & 4 deletions src/protocols/workers/WorkerConnector.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Invoke } from "../../components/Invoke";
import { DomainError, Singleton, is_node, sleep_until } from "tstl";

import { Invoke } from "../../components/Invoke";
import { ConnectorBase } from "../internal/ConnectorBase";
import { IHeaderWrapper } from "../internal/IHeaderWrapper";
import { once } from "../internal/once";
import { IWorkerCompiler } from "./internal/IWorkerCompiler";
import { IWorkerSystem } from "./internal/IWorkerSystem";
import { ConnectorBase } from "../internal/ConnectorBase";
import { NodeWorkerCompiler } from "./internal/NodeWorkerCompiler";
import { WebWorkerCompiler } from "./internal/WebWorkerCompiler";
import { once } from "../internal/once";
import { Singleton, is_node, DomainError, sleep_until } from "tstl";

/**
* Worker Connector.
Expand Down
23 changes: 11 additions & 12 deletions src/protocols/workers/WorkerServer.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import { Communicator } from "../../components/Communicator";
import { IServer } from "../internal/IServer";
import { IWorkerSystem } from "./internal/IWorkerSystem";

import { Invoke } from "../../components/Invoke";
import { IHeaderWrapper } from "../internal/IHeaderWrapper";
import { once } from "../internal/once";

import { ThreadPort } from "./internal/threads/ThreadPort";
import { ProcessChannel } from "./internal/processes/ProcessChannel";
import {
DomainError,
RuntimeError,
Singleton,
is_node,
DomainError,
sleep_until,
RuntimeError,
} from "tstl";

import { Communicator } from "../../components/Communicator";
import { Invoke } from "../../components/Invoke";
import { IHeaderWrapper } from "../internal/IHeaderWrapper";
import { IServer } from "../internal/IServer";
import { once } from "../internal/once";
import { IWorkerSystem } from "./internal/IWorkerSystem";
import { ProcessChannel } from "./internal/processes/ProcessChannel";
import { ThreadPort } from "./internal/threads/ThreadPort";

/**
* Worker Server.
*
Expand Down
1 change: 1 addition & 0 deletions src/protocols/workers/internal/FileSystem.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type fs from "fs";

import { NodeModule } from "../../../utils/internal/NodeModule";

/**
Expand Down
1 change: 0 additions & 1 deletion src/protocols/workers/internal/NodeWorkerCompiler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { NodeModule } from "../../../utils/internal/NodeModule";

import { FileSystem } from "./FileSystem";
import { IWorkerCompiler } from "./IWorkerCompiler";
import { ProcessWorker } from "./processes/ProcessWorker";
Expand Down
1 change: 1 addition & 0 deletions src/protocols/workers/internal/processes/ProcessWorker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type cp from "child_process";

import { NodeModule } from "../../../../utils/internal/NodeModule";
import { IWorkerCompiler } from "../IWorkerCompiler";

Expand Down
1 change: 1 addition & 0 deletions src/protocols/workers/internal/threads/ThreadPort.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//================================================================

/** @module tgrid.protocols.workers */
//================================================================
import { NodeModule } from "../../../../utils/internal/NodeModule";
Expand Down
2 changes: 2 additions & 0 deletions src/protocols/workers/internal/threads/ThreadWorker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
//================================================================

/** @module tgrid.protocols.workers */
//================================================================
import type thread from "worker_threads";

import { NodeModule } from "../../../../utils/internal/NodeModule";
import { IWorkerCompiler } from "../IWorkerCompiler";

Expand Down
7 changes: 3 additions & 4 deletions src/utils/internal/NodeModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import type * as __cp from "child_process";
import type * as __fs from "fs";
import type * as __http from "http";
import type * as __https from "https";
import import2 from "import2";
import type * as __os from "os";
import type * as __thread from "worker_threads";
import type * as __ws from "ws";
import type * as __process from "process";

import import2 from "import2";
import { Singleton } from "tstl";
import type * as __thread from "worker_threads";
import type * as __ws from "ws";

export namespace NodeModule {
export const cp: Singleton<Promise<typeof __cp>> = new Singleton(() =>
Expand Down
2 changes: 2 additions & 0 deletions test/browser/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as puppeteer from "puppeteer";

import { TestBundler } from "./TestBundler";

const HttpServer = require("local-web-server");

const PORT = 37792;
Expand Down
1 change: 1 addition & 0 deletions test/browser/shared-worker-client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { SharedWorkerConnector } from "tgrid";

import { ICalculator } from "../controllers/ICalculator";
import { complete } from "./internal";

Expand Down
1 change: 1 addition & 0 deletions test/browser/shared-worker-server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { SharedWorkerServer } from "tgrid";

import { Calculator } from "../providers/Calculator";

/// chrome://inspect/#workers
Expand Down
2 changes: 1 addition & 1 deletion test/browser/web-client.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Driver, WebConnector } from "tgrid";
import { InvalidArgument } from "tstl";

import { ICalculator } from "../controllers/ICalculator";
import { complete } from "./internal";
import { Driver, WebConnector } from "tgrid";

window.onload = async () => {
for (let i: number = 0; i < 5; ++i) {
Expand Down
1 change: 1 addition & 0 deletions test/browser/web-server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { WebServer } from "tgrid";

import { Calculator } from "../providers/Calculator";

async function main(): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion test/browser/worker-client.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { WorkerConnector } from "tgrid";
import "whatwg-fetch";

import { ICalculator } from "../controllers/ICalculator";
import { complete } from "./internal";
import { WorkerConnector } from "tgrid";

async function get_source(): Promise<string> {
let url: string = location.href;
Expand Down
1 change: 1 addition & 0 deletions test/browser/worker-server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { WorkerServer } from "tgrid";

import { Calculator } from "../providers/Calculator";

async function main(): Promise<void> {
Expand Down
3 changes: 2 additions & 1 deletion test/controllers/ICalculator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Driver } from "tgrid";
import { DomainError, InvalidArgument, randint } from "tstl";

import { Calculator } from "../providers/Calculator";
import { Driver } from "tgrid";

export interface ICalculator extends ISimple {
scientific: IScientific;
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/IScript.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LengthError, DomainError } from "tstl";
import { DomainError, LengthError } from "tstl";

export interface IScript {
name: string;
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/IVector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Driver } from "tgrid";
import { randint, DomainError } from "tstl";
import { DomainError, randint } from "tstl";

export interface IVector<T> {
size(): T;
Expand Down
4 changes: 2 additions & 2 deletions test/node/components/test_pseudo.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Communicator, Invoke, Driver } from "tgrid";
import { Communicator, Driver, Invoke } from "tgrid";
import { InvalidArgument } from "tstl";

import { Calculator } from "../../providers/Calculator";
import { ICalculator } from "../../controllers/ICalculator";
import { Calculator } from "../../providers/Calculator";

class PseudoCommunicator<Provider> extends Communicator<Provider> {
private sender_: (invoke: Invoke) => void;
Expand Down
6 changes: 3 additions & 3 deletions test/node/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const EXTENSION = __filename.substr(-2);
if (EXTENSION === "js") require("source-map-support").install();
import fs from "fs";

import fs from "fs";
const EXTENSION = __filename.substr(-2);
if (EXTENSION === "js") require("source-map-support").install();

interface IModule {
[key: string]: () => Promise<void>;
Expand Down
8 changes: 4 additions & 4 deletions test/node/protocols/web/test_web_calculator.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Calculator } from "../../../providers/Calculator";
import { Driver, WebConnector, WebServer } from "tgrid";
import { Vector } from "tstl";

import { ICalculator } from "../../../controllers/ICalculator";
import { IVector } from "../../../controllers/IVector";

import { Vector } from "tstl";
import { Driver, WebConnector, WebServer } from "tgrid";
import { Calculator } from "../../../providers/Calculator";

const PORT: number = 10101;

Expand Down
2 changes: 1 addition & 1 deletion test/node/protocols/web/test_web_chat.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Driver, WebConnector, WebServer } from "tgrid";
import { sleep_for } from "tstl";

import { IScript } from "../../../controllers/IScript";
import { IChatPrinter } from "../../../controllers/IChatPrinter";
import { IChatService } from "../../../controllers/IChatService";
import { IScript } from "../../../controllers/IScript";
import { ChatService } from "../../../providers/ChatService";

const PORT = 10101;
Expand Down
6 changes: 3 additions & 3 deletions test/node/protocols/web/test_web_mutex.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Driver, WebConnector, WebServer } from "tgrid";
import {
DomainError,
Mutex,
Vector,
sleep_for,
RuntimeError,
Vector,
is_sorted,
DomainError,
sleep_for,
} from "tstl";

const PORT: number = 10101;
Expand Down
5 changes: 3 additions & 2 deletions test/node/protocols/workers/internal/calculator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Simple } from "../../../../providers/Calculator";
import { IScientific, IStatistics } from "../../../../controllers/ICalculator";
import { Driver, WorkerConnector, WorkerServer } from "tgrid";

import { IScientific, IStatistics } from "../../../../controllers/ICalculator";
import { Simple } from "../../../../providers/Calculator";

class HierarchicalCalculator extends Simple {
// REMOTE CALCULATOR
public scientific!: Driver<IScientific>;
Expand Down
Loading