Skip to content

Commit

Permalink
refactor: use export * as ns syntax (#3677)
Browse files Browse the repository at this point in the history
  • Loading branch information
faustbrian authored May 4, 2020
1 parent 932cfec commit 0443687
Show file tree
Hide file tree
Showing 22 changed files with 99 additions and 161 deletions.
6 changes: 2 additions & 4 deletions packages/core-api/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import * as Contracts from "./interfaces";
import * as Schemas from "./schemas";
export * as Contracts from "./interfaces";
export * as Schemas from "./schemas";

export * from "./controllers/controller";
export * from "./identifiers";
export * from "./server";
export * from "./service-provider";

export { Contracts, Schemas };
18 changes: 8 additions & 10 deletions packages/core-cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as Actions from "./actions";
import * as Commands from "./commands";
import * as Components from "./component-factory";
import * as Contracts from "./contracts";
import * as Container from "./ioc";
import * as Plugins from "./plugins";
import * as Services from "./services";
import * as Utils from "./utils";
export * as Actions from "./actions";
export * as Commands from "./commands";
export * as Components from "./component-factory";
export * as Contracts from "./contracts";
export * as Container from "./ioc";
export * as Plugins from "./plugins";
export * as Services from "./services";
export * as Utils from "./utils";

export * from "./application";
export * from "./input";
Expand All @@ -14,5 +14,3 @@ export * from "./output";
export * from "./action-factory";
export * from "./application-factory";
export * from "./component-factory";

export { Actions, Commands, Components, Container, Contracts, Plugins, Services, Utils };
6 changes: 2 additions & 4 deletions packages/core-database/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
export * from "./database-service";
export * from "./service-provider";

import * as Models from "./models";
import * as Repositories from "./repositories";

export { Models, Repositories };
export * as Models from "./models";
export * as Repositories from "./repositories";
6 changes: 2 additions & 4 deletions packages/core-kernel/src/bootstrap/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
import * as app from "./app";
import * as serviceProviders from "./service-providers";

export { app, serviceProviders };
export * as app from "./app";
export * as serviceProviders from "./service-providers";
18 changes: 8 additions & 10 deletions packages/core-kernel/src/contracts/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import * as Blockchain from "./blockchain";
import * as Database from "./database";
import * as Kernel from "./kernel";
import * as P2P from "./p2p";
import * as Search from "./search";
import * as Shared from "./shared";
import * as State from "./state";
import * as TransactionPool from "./transaction-pool";

export { Blockchain, Database, Kernel, Search, P2P, Shared, State, TransactionPool };
export * as Blockchain from "./blockchain";
export * as Database from "./database";
export * as Kernel from "./kernel";
export * as P2P from "./p2p";
export * as Search from "./search";
export * as Shared from "./shared";
export * as State from "./state";
export * as TransactionPool from "./transaction-pool";
18 changes: 8 additions & 10 deletions packages/core-kernel/src/exceptions/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import * as Cache from "./cache";
import * as Config from "./config";
import * as Container from "./container";
import * as Filesystem from "./filesystem";
import * as Logic from "./logic";
import * as Plugins from "./plugins";
import * as Runtime from "./runtime";
import * as Validation from "./validation";

export { Cache, Config, Container, Filesystem, Logic, Plugins, Runtime, Validation };
export * as Cache from "./cache";
export * as Config from "./config";
export * as Container from "./container";
export * as Filesystem from "./filesystem";
export * as Logic from "./logic";
export * as Plugins from "./plugins";
export * as Runtime from "./runtime";
export * as Validation from "./validation";
20 changes: 10 additions & 10 deletions packages/core-kernel/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Application } from "./application";
import * as Contracts from "./contracts";
import * as Enums from "./enums";
import * as Exceptions from "./exceptions";
import * as Container from "./ioc";
import * as Providers from "./providers";
import * as Services from "./services";
import * as Support from "./support";
import * as Types from "./types";
import * as Utils from "./utils";
export * as Contracts from "./contracts";
export * as Enums from "./enums";
export * as Exceptions from "./exceptions";
export * as Container from "./ioc";
export * as Providers from "./providers";
export * as Services from "./services";
export * as Support from "./support";
export * as Types from "./types";
export * as Utils from "./utils";

export { Application, Container, Contracts, Enums, Exceptions, Providers, Services, Support, Types, Utils };
export { Application };
3 changes: 1 addition & 2 deletions packages/core-kernel/src/ioc/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import "reflect-metadata";

import * as Selectors from "./selectors";
export * as Selectors from "./selectors";

export * from "inversify";

export * from "./identifiers";
export { Selectors };
24 changes: 11 additions & 13 deletions packages/core-kernel/src/services/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import * as Attributes from "./attributes";
import * as Cache from "./cache";
import * as Config from "./config";
import * as Events from "./events";
import * as Filesystem from "./filesystem";
import * as Log from "./log";
import * as Pipeline from "./pipeline";
import * as Queue from "./queue";
import * as Schedule from "./schedule";
import * as Triggers from "./triggers";
import * as Validation from "./validation";

export { Attributes, Cache, Config, Events, Filesystem, Log, Pipeline, Queue, Schedule, Triggers, Validation };
export * as Attributes from "./attributes";
export * as Cache from "./cache";
export * as Config from "./config";
export * as Events from "./events";
export * as Filesystem from "./filesystem";
export * as Log from "./log";
export * as Pipeline from "./pipeline";
export * as Queue from "./queue";
export * as Schedule from "./schedule";
export * as Triggers from "./triggers";
export * as Validation from "./validation";
6 changes: 3 additions & 3 deletions packages/core-kernel/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { getBlockTimeLookup } from "./get-blocktime-lookup";
import { getBlockNotChainedErrorMessage, isBlockChained } from "./is-block-chained";
import { isWhitelisted } from "./is-whitelisted";
import { calculateRound, isNewRound } from "./round-calculator";
import * as Search from "./search";
export * as Search from "./search";
import { calculate } from "./supply-calculator";
import * as Plugins from "./transform-plugins";
export * as Plugins from "./transform-plugins";

export * from "@arkecosystem/utils";
export * from "./expiration-calculator";
Expand All @@ -20,4 +20,4 @@ export const roundCalculator = { calculateRound, isNewRound };
export const supplyCalculator = { calculate };
export const forgingInfoCalculator = { calculateForgingInfo, getBlockTimeLookup };

export { formatTimestamp, isBlockChained, getBlockNotChainedErrorMessage, isWhitelisted, Search, Plugins };
export { formatTimestamp, isBlockChained, getBlockNotChainedErrorMessage, isWhitelisted };
10 changes: 4 additions & 6 deletions packages/core-magistrate-crypto/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import * as Builders from "./builders";
import * as Enums from "./enums";
import * as Interfaces from "./interfaces";
import * as Transactions from "./transactions";

export { Builders, Enums, Interfaces, Transactions };
export * as Builders from "./builders";
export * as Enums from "./enums";
export * as Interfaces from "./interfaces";
export * as Transactions from "./transactions";
4 changes: 1 addition & 3 deletions packages/core-magistrate-transactions/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
import * as Handlers from "./handlers";
export * as Handlers from "./handlers";
export * from "./service-provider";

export { Handlers };
4 changes: 1 addition & 3 deletions packages/core-state/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
export * from "./service-provider";
import * as Wallets from "./wallets";

export { Wallets };
export * as Wallets from "./wallets";
4 changes: 1 addition & 3 deletions packages/core-test-framework/src/factories/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import * as Factories from "./factories";
export * as Factories from "./factories";

export * from "./factory-builder";
export * from "./types";
export * from "./helpers";

export { Factories };
8 changes: 3 additions & 5 deletions packages/core-test-framework/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ export * from "./app";
export * from "./cli";
// Entity Factories for commonly used entities like blocks and wallets
// Generators for commonly used entities like blocks and wallets
import * as Generators from "./app/generators";
import * as Factories from "./factories";
export * as Generators from "./app/generators";
export * as Factories from "./factories";
// Utilities for common tasks like sending HTTP requests or altering wallets
export * from "./utils"; // todo: export as Utils
import * as Mocks from "./mocks"; // todo: export as Utils

export { Factories, Generators, Mocks };
export * as Mocks from "./mocks"; // todo: export as Utils
36 changes: 11 additions & 25 deletions packages/core-test-framework/src/mocks/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
import * as BlockRepository from "./block-repository";
import * as Blockchain from "./blockchain";
import * as NetworkMonitor from "./network-monitor";
import * as PeerStorage from "./peer-storage";
import * as TransactionPoolQuery from "./query";
import * as RoundRepository from "./round-repository";
import * as ServiceProviderRepository from "./service-provider-repository";
import * as StateStore from "./state-store";
import * as TransactionPoolProcessor from "./transaction-pool-processor";
import * as TransactionRepository from "./transaction-repository";
import * as WalletRepository from "./wallet-respository";

export {
BlockRepository,
Blockchain,
NetworkMonitor,
PeerStorage,
TransactionPoolQuery,
RoundRepository,
ServiceProviderRepository,
StateStore,
TransactionPoolProcessor,
TransactionRepository,
WalletRepository,
};
export * as BlockRepository from "./block-repository";
export * as Blockchain from "./blockchain";
export * as NetworkMonitor from "./network-monitor";
export * as PeerStorage from "./peer-storage";
export * as TransactionPoolQuery from "./query";
export * as RoundRepository from "./round-repository";
export * as ServiceProviderRepository from "./service-provider-repository";
export * as StateStore from "./state-store";
export * as TransactionPoolProcessor from "./transaction-pool-processor";
export * as TransactionRepository from "./transaction-repository";
export * as WalletRepository from "./wallet-respository";
4 changes: 1 addition & 3 deletions packages/core-test-framework/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ export * from "./generic";
export * from "./rest-client";
export * from "./transaction-factory";

import * as Mapper from "./mapper";

export { Mapper };
export * as Mapper from "./mapper";
6 changes: 3 additions & 3 deletions packages/core-transactions/src/handlers/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TransactionHandlerRegistry } from "./handler-registry";
import * as One from "./one";
export * as One from "./one";
import { TransactionHandler, TransactionHandlerConstructor } from "./transaction";
import * as Two from "./two";
export * as Two from "./two";

export { One, Two, TransactionHandler, TransactionHandlerConstructor, TransactionHandlerRegistry as Registry };
export { TransactionHandler, TransactionHandlerConstructor, TransactionHandlerRegistry as Registry };
5 changes: 2 additions & 3 deletions packages/core-transactions/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export * from "./service-provider";

import * as Errors from "./errors";
import * as Handlers from "./handlers";
export * as Errors from "./errors";
export * as Handlers from "./handlers";

export * from "./transaction-reader";
export { Errors, Handlers };
4 changes: 1 addition & 3 deletions packages/crypto/src/crypto/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import * as bip38 from "./bip38";

export { bip38 };
export * as bip38 from "./bip38";
export { Hash } from "./hash";
export { HashAlgorithms } from "./hash-algorithms";
export { HDWallet } from "./hdwallet";
Expand Down
42 changes: 13 additions & 29 deletions packages/crypto/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
import * as Blocks from "./blocks";
import * as Constants from "./constants";
import * as Crypto from "./crypto";
import * as Enums from "./enums";
import * as Errors from "./errors";
import * as Identities from "./identities";
import * as Interfaces from "./interfaces";
import * as Managers from "./managers";
import * as Networks from "./networks";
import * as Transactions from "./transactions";
import * as Types from "./types";
import * as Utils from "./utils";
import * as Validation from "./validation";

export {
Blocks,
Constants,
Crypto,
Enums,
Errors,
Identities,
Interfaces,
Managers,
Networks,
Transactions,
Types,
Utils,
Validation,
};
export * as Blocks from "./blocks";
export * as Constants from "./constants";
export * as Crypto from "./crypto";
export * as Enums from "./enums";
export * as Errors from "./errors";
export * as Identities from "./identities";
export * as Interfaces from "./interfaces";
export * as Managers from "./managers";
export * as Networks from "./networks";
export * as Transactions from "./transactions";
export * as Types from "./types";
export * as Utils from "./utils";
export * as Validation from "./validation";
8 changes: 3 additions & 5 deletions packages/crypto/src/transactions/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ export * from "./transaction";
export * from "./factory";
export * from "./internal-transaction-type";

import * as One from "./one";
import * as schemas from "./schemas";
import * as Two from "./two";

export { One, Two, schemas };
export * as One from "./one";
export * as schemas from "./schemas";
export * as Two from "./two";

0 comments on commit 0443687

Please sign in to comment.