-
-
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: Lexus Drumgold <[email protected]>
- Loading branch information
1 parent
9e1fbd8
commit 2bde439
Showing
3 changed files
with
72 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* @file Type Tests - ResolveHookResult | ||
* @module esm-types/hooks/tests/unit-d/ResolveHookResult | ||
*/ | ||
|
||
import type { Format } from '#src/enums' | ||
import type { ResolvedModuleUrl } from '#src/types' | ||
import type { Nilable } from '@flex-development/tutils' | ||
import type TestSubject from '../resolve-result' | ||
|
||
describe('unit-d:hooks/ResolveHookResult', () => { | ||
it('should match [format?: Nilable<Format>]', () => { | ||
expectTypeOf<TestSubject>() | ||
.toHaveProperty('format') | ||
.toEqualTypeOf<Nilable<Format>>() | ||
}) | ||
|
||
it('should match [shortCircuit?: boolean | undefined]', () => { | ||
expectTypeOf<TestSubject>() | ||
.toHaveProperty('shortCircuit') | ||
.toEqualTypeOf<boolean | undefined>() | ||
}) | ||
|
||
it('should match [url: ResolvedModuleUrl]', () => { | ||
expectTypeOf<TestSubject>() | ||
.toHaveProperty('url') | ||
.toEqualTypeOf<ResolvedModuleUrl>() | ||
}) | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* @file Hooks - ResolveHookResult | ||
* @module esm-types/hooks/ResolveHookResult | ||
*/ | ||
|
||
import type { Format } from '#src/enums' | ||
import type { ResolvedModuleUrl } from '#src/types' | ||
import type { Nilable } from '@flex-development/tutils' | ||
|
||
/** | ||
* [`resolve`][1] hook result. | ||
* | ||
* [1]: https://nodejs.org/api/esm.html#resolvespecifier-context-nextresolve | ||
*/ | ||
interface ResolveHookResult { | ||
/** | ||
* Module format hint for [`load`][1] hook. | ||
* | ||
* **Note**: Hint may be ignored. | ||
* | ||
* [1]: https://nodejs.org/api/esm.html#loadurl-context-nextload | ||
* | ||
* @see {@linkcode Format} | ||
*/ | ||
format?: Nilable<Format> | ||
|
||
/** | ||
* Signal that the current hook terminates the chain of `resolve` hooks. | ||
* | ||
* @default false | ||
*/ | ||
shortCircuit?: boolean | undefined | ||
|
||
/** | ||
* Resolved module URL. | ||
* | ||
* @see {@linkcode ResolvedModuleUrl} | ||
*/ | ||
url: ResolvedModuleUrl | ||
} | ||
|
||
export type { ResolveHookResult as default } |