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

refactor: sort all top-level imports #337

Merged
merged 1 commit into from
Jun 1, 2022
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
3 changes: 2 additions & 1 deletion src/check-tsconfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { tsModule } from "./tsproxy";
import * as tsTypes from "typescript";

import { tsModule } from "./tsproxy";

export function checkTsConfig(parsedConfig: tsTypes.ParsedCommandLine): void
{
const module = parsedConfig.options.module!;
Expand Down
1 change: 1 addition & 0 deletions src/diagnostics-format-host.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as path from "path";
import * as tsTypes from "typescript";

import { tsModule } from "./tsproxy";

export class FormatHost implements tsTypes.FormatDiagnosticsHost
Expand Down
5 changes: 3 additions & 2 deletions src/get-options-overrides.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as path from "path";
import * as tsTypes from "typescript";
import { createFilter as createRollupFilter, normalizePath as normalize } from "@rollup/pluginutils";

import { tsModule } from "./tsproxy";
import * as tsTypes from "typescript";
import { IOptions } from "./ioptions";
import * as path from "path";
import { IContext } from "./context";

export function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }: IOptions, preParsedTsconfig?: tsTypes.ParsedCommandLine): tsTypes.CompilerOptions
Expand Down
3 changes: 2 additions & 1 deletion src/host.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { tsModule } from "./tsproxy";
import * as tsTypes from "typescript";
import { normalizePath as normalize } from "@rollup/pluginutils";

import { tsModule } from "./tsproxy";
import { TransformerFactoryCreator } from "./ioptions";

export class LanguageServiceHost implements tsTypes.LanguageServiceHost
Expand Down
19 changes: 9 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import { relative, dirname, normalize as pathNormalize, resolve as pathResolve } from "path";
import * as tsTypes from "typescript";
import { PluginImpl, PluginContext, InputOptions, OutputOptions, TransformResult, SourceMap, Plugin } from "rollup";
import { normalizePath as normalize } from "@rollup/pluginutils";
import * as _ from "lodash";
import { blue, red, yellow, green } from "colors/safe";
import * as resolve from "resolve";
import findCacheDir from "find-cache-dir";

import { RollupContext } from "./rollupcontext";
import { ConsoleContext, VerbosityLevel } from "./context";
import { LanguageServiceHost } from "./host";
import { TsCache, convertDiagnostic, convertEmitOutput, getAllReferences } from "./tscache";
import { tsModule, setTypescriptModule } from "./tsproxy";
import * as tsTypes from "typescript";
import * as resolve from "resolve";
import * as _ from "lodash";
import { IOptions } from "./ioptions";
import { parseTsConfig } from "./parse-tsconfig";
import { printDiagnostics } from "./print-diagnostics";
import { TSLIB, TSLIB_VIRTUAL, tslibSource, tslibVersion } from "./tslib";
import { blue, red, yellow, green } from "colors/safe";
import { relative, dirname, normalize as pathNormalize, resolve as pathResolve } from "path";
import { normalizePath as normalize } from "@rollup/pluginutils";
import findCacheDir from "find-cache-dir";

import { PluginImpl, PluginContext, InputOptions, OutputOptions, TransformResult, SourceMap, Plugin } from "rollup";

import { createFilter } from "./get-options-overrides";

type RPT2Options = Partial<IOptions>;
Expand Down
3 changes: 2 additions & 1 deletion src/ioptions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { tsModule } from "./tsproxy";
import * as tsTypes from "typescript";

import { tsModule } from "./tsproxy";

export interface ICustomTransformer
{
before?: tsTypes.TransformerFactory<tsTypes.SourceFile>;
Expand Down
5 changes: 3 additions & 2 deletions src/parse-tsconfig.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { dirname } from "path";
import * as _ from "lodash";

import { tsModule } from "./tsproxy";
import { IContext } from "./context";
import { dirname } from "path";
import { printDiagnostics } from "./print-diagnostics";
import { convertDiagnostic } from "./tscache";
import { getOptionsOverrides } from "./get-options-overrides";
import { IOptions } from "./ioptions";
import * as _ from "lodash";
import { checkTsConfig } from "./check-tsconfig";

export function parseTsConfig(context: IContext, pluginOptions: IOptions)
Expand Down
3 changes: 2 additions & 1 deletion src/print-diagnostics.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { tsModule } from "./tsproxy";
import { red, white, yellow } from "colors/safe";

import { tsModule } from "./tsproxy";
import { IContext } from "./context";
import { IDiagnostics } from "./tscache";

Expand Down
5 changes: 3 additions & 2 deletions src/rollingcache.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ICache } from "./icache";
import { emptyDirSync, ensureFileSync, readJsonSync, removeSync, writeJsonSync } from "fs-extra";
import { existsSync, readdirSync, renameSync } from "fs";
import { emptyDirSync, ensureFileSync, readJsonSync, removeSync, writeJsonSync } from "fs-extra";
import * as _ from "lodash";

import { ICache } from "./icache";

/**
* Saves data in new cache folder or reads it from old one.
* Avoids perpetually growing cache and situations when things need to consider changed and then reverted data to be changed.
Expand Down
3 changes: 2 additions & 1 deletion src/rollupcontext.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { IContext, VerbosityLevel } from "./context";
import * as _ from "lodash";
import { PluginContext } from "rollup";

import { IContext, VerbosityLevel } from "./context";

export class RollupContext implements IContext
{
private hasContext: boolean = true;
Expand Down
11 changes: 6 additions & 5 deletions src/tscache.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { IContext } from "./context";
import * as tsTypes from "typescript";
import { emptyDirSync, pathExistsSync, readdirSync, removeSync, statSync } from "fs-extra";
import * as _ from "lodash";
import { Graph, alg } from "graphlib";
import hash from "object-hash";
import { blue, yellow, green } from "colors/safe";

import { IContext } from "./context";
import { RollingCache } from "./rollingcache";
import { ICache } from "./icache";
import * as _ from "lodash";
import { tsModule } from "./tsproxy";
import * as tsTypes from "typescript";
import { blue, yellow, green } from "colors/safe";
import { emptyDirSync, pathExistsSync, readdirSync, removeSync, statSync } from "fs-extra";
import { formatHost } from "./diagnostics-format-host";
import { NoCache } from "./nocache";

Expand Down