forked from benyap/resolve-tspaths
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Nikola <[email protected]>
- Loading branch information
1 parent
a6ca573
commit 4c70f63
Showing
14 changed files
with
126 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
export class FileError extends Step { | ||
constructor( | ||
public readonly step: string, | ||
public readonly path: string, | ||
message: string | ||
) { | ||
super(step, `Error processing ${path}: ${message}`); | ||
export default class FileError extends (await import("@Class/Error/Step.js")) | ||
.default { | ||
public override readonly Step; | ||
public readonly Path; | ||
|
||
constructor(Step: string, Path: string, Message: string) { | ||
super(Step, `Error processing ${Path}: ${Message}`); | ||
|
||
this.Step = Step; | ||
this.Path = Path; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export class FileNotFoundError extends FileError { | ||
constructor(step: string, path: string) { | ||
super(step, path, `Not found`); | ||
export default class extends (await import("@Class/Error/File.js")).default { | ||
constructor(Step: string, Path: string) { | ||
super(Step, Path, "Not found"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
export class InvalidAliasError extends Step { | ||
constructor( | ||
public readonly step: string, | ||
public readonly alias: string | ||
) { | ||
super(step, `The alias ${alias} is not permitted`); | ||
export default class extends (await import("@Class/Error/Step.js")).default { | ||
public override readonly Step: string; | ||
public readonly Alias: string; | ||
|
||
constructor(Step: string, Alias: string) { | ||
super(Step, `The alias ${Alias} is not permitted`); | ||
|
||
this.Step = Step; | ||
this.Alias = Alias; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
export class InvalidAliasError extends Step { | ||
constructor( | ||
public readonly step: string, | ||
public readonly alias: string | ||
) { | ||
super(step, `The alias ${alias} is not permitted`); | ||
export default class extends (await import("@Class/Error/Step.js")).default { | ||
public override readonly Step: string; | ||
public readonly Alias: string; | ||
|
||
constructor(Step: string, Alias: string) { | ||
super(Step, `The alias ${Alias} is not permitted`); | ||
|
||
this.Step = Step; | ||
this.Alias = Alias; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
export default class extends Error { | ||
constructor( | ||
public readonly step: string, | ||
message: string | ||
) { | ||
super(message); | ||
public readonly Step: string; | ||
|
||
constructor(Step: string, Message: string) { | ||
super(Message); | ||
|
||
this.Step = Step; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
export default class extends (await import("@Class/Error/Step.js")).default { | ||
constructor( | ||
public override readonly step: string, | ||
public readonly property: string | ||
) { | ||
super(step, `${property} is not set in tsconfig`); | ||
public override readonly Step: string; | ||
public readonly Property: string; | ||
|
||
constructor(Step: string, Property: string) { | ||
super(Step, `${Property} is not set in tsconfig`); | ||
|
||
this.Step = Step; | ||
this.Property = Property; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
export interface Alias { | ||
export default interface Interface { | ||
/** The original path alias. */ | ||
alias: string; | ||
Alias: string; | ||
|
||
/** The alias prefix that has been matched. */ | ||
prefix: string; | ||
Prefix: string; | ||
|
||
/** The paths that the alias points to. */ | ||
aliasPaths: string[]; | ||
Path: string[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import type { TextChange } from "@Interface/TextChange.js"; | ||
|
||
export interface Change { | ||
export default interface Interface { | ||
/** The source of the file being changed. */ | ||
file: string; | ||
File: string; | ||
|
||
/** The new content of the file. */ | ||
text: string; | ||
Text: string; | ||
|
||
/** A list of text changes in the file. */ | ||
changes?: TextChange[]; | ||
Change?: TextChange[]; | ||
} | ||
|
||
import type TextChange from "@Interface/TextChange.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,43 @@ | ||
export default interface ProgramOptions { | ||
export default interface Interface { | ||
/** | ||
* Path to the project's tsconfig file. Defaults to "tsconfig.json" | ||
* if not provided. | ||
* | ||
*/ | ||
project: string; | ||
Project: string; | ||
|
||
/** | ||
* Path to the source directory. Defaults to `compilerOptions.rootDir` | ||
* from tsconfig. If `rootDir` is not defined in tsconfig, it will | ||
* default to "src". | ||
* | ||
*/ | ||
src?: string; | ||
Source?: string; | ||
|
||
/** | ||
* Path to the output directory. Defaults to `compilerOptions.outDir` | ||
* from tsconfig if not provided. | ||
* | ||
*/ | ||
out?: string; | ||
Target?: string; | ||
|
||
/** | ||
* A list of file extensions that will be matched for replacement. | ||
* Defaults to `["js", "d.ts"]` to handle js and type declaration | ||
* files. | ||
* | ||
*/ | ||
ext: string[]; | ||
Extension: string[]; | ||
|
||
/** | ||
* If `true`, verbose logs will be printed for degugging. | ||
* | ||
*/ | ||
verbose: boolean; | ||
Verbose: boolean; | ||
|
||
/** | ||
* If `true`, changes will not be emitted. | ||
* | ||
*/ | ||
noEmit: boolean; | ||
NoEmit: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,31 @@ | ||
export default interface Interface { | ||
/** Absolute path to `baseUrl` as defined in the tsconfig file. */ | ||
basePath: string; | ||
/** | ||
* Absolute path to `baseUrl` as defined in the tsconfig file. | ||
* | ||
*/ | ||
Base: string; | ||
|
||
/** Absolute path to the directory the tsconfig file is in. */ | ||
configPath: string; | ||
/** | ||
* Absolute path to the directory the tsconfig file is in. | ||
* | ||
*/ | ||
PathConfig: string; | ||
|
||
/** Absolute path to the tsconfig file. */ | ||
configFile: string; | ||
/** | ||
* Absolute path to the tsconfig file. | ||
* | ||
*/ | ||
FileConfig: string; | ||
|
||
/** Absolute path to the source directory. */ | ||
srcPath: string; | ||
/** | ||
* Absolute path to the source directory. | ||
* | ||
*/ | ||
Source: string; | ||
|
||
/** Absolute path to the output directory. */ | ||
outPath: string; | ||
/** | ||
* Absolute path to the output directory. | ||
* | ||
*/ | ||
Target: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export interface TextChange { | ||
export default interface Interface { | ||
/** The original text. */ | ||
original: string; | ||
Original: string; | ||
|
||
/** The modified text. */ | ||
modified: string; | ||
Modify: string; | ||
} |