This repository has been archived by the owner on Jun 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(*): make mapping classes generic
We need to be able to re-map the TypeScript declaration files as well as the generated ECMAscript output files. This will require almost exactly the same process as the ECMAscript re-mapping. The classes that handle the re-mapping have been made generic so that we can re-use the same framework for the declaration re-mapping. See #2 BREAKING CHANGE: The re-mapping classes have been made generic and there are ES derived variants of each. This is required so that we can nicely re-map TypeScript declaration files using the same re-mapping framework. The demo library code in the `README` will still work, however, the modules have all moved around hence the breaking change 💥 If you do not do any module loading of the library, then you will require no code changes other than upgrading your dependency
- Loading branch information
1 parent
6f08580
commit 3e3df9d
Showing
17 changed files
with
262 additions
and
170 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
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,10 +1,17 @@ | ||
import Export from '@lib/Export'; | ||
import Import from '@lib/Import'; | ||
import EsImport, { Interface as EsImportInterface } from '@es/Export'; | ||
import EsFile from '@es/File'; | ||
import EsExport, { Interface as EsExportInterface } from '@es/Import'; | ||
import Mapper, { IOptions as IMapperOptions } from '@lib/Mapper'; | ||
import TsImport, { Interface as TsImportInterface } from '@ts/Export'; | ||
import TsFile from '@ts/File'; | ||
import TsExport, { Interface as TsExportInterface } from '@ts/Import'; | ||
export type DeclarationInterface = EsImportInterface | EsExportInterface | TsImportInterface | TsExportInterface; | ||
export type Declaration = EsImport | EsExport | TsImport | TsExport; | ||
export type File = EsFile | TsFile; | ||
|
||
export type IOptions = IMapperOptions; | ||
|
||
export default async function *convert({ ...other}: IOptions): AsyncIterableIterator<Import | Export> { | ||
export default async function *convert({ ...other}: IOptions): AsyncIterableIterator<Declaration> { | ||
const mapper = new Mapper({ ...other }); | ||
yield* mapper.map(); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
import TspmError from '@lib/Error'; | ||
import Path from '@lib/Path'; | ||
|
||
export interface IOptions { | ||
path: Path; | ||
} | ||
|
||
export default class ResolutionError extends TspmError { | ||
readonly path: Path; | ||
|
||
constructor({ path }: IOptions) { | ||
super(`File not found: '${path}'`); | ||
this.path = path; | ||
} | ||
} |
Oops, something went wrong.