Skip to content

Commit 972a38e

Browse files
wip(docs): update doc
1 parent 5b5605b commit 972a38e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/types.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ export type Cache = {
2626
export type ModuleCacheId = string;
2727

2828

29+
/**
30+
* An abstract way to specify a path. It could be a simple string or a object like an URL. An AbstractPath must always be convertible to a string.
31+
*/
2932
export type AbstractPath = {
3033
toString() : string,
3134
}
@@ -48,9 +51,9 @@ export type PathResolve = (pathCx : PathContext) => AbstractPath;
4851

4952

5053
/**
51-
* Used by the library when it does not know how to handle a given file type (eg. `.json` files).
52-
* see [[moduleHandlers]]
53-
* @param source The content of the file
54+
* Used by the library when it needs to handle a does not know how to handle a given file type (eg. `.json` files).
55+
* @param type The type of the file. It can be anything, but must be '.vue', '.js' or '.mjs' for vue, js and esm files.
56+
* @param getContentData The method to get the content data of a file (text or binary). see [[ File['getContentData'] ]]
5457
* @param path The path of the file
5558
* @param options The options
5659
*
@@ -59,9 +62,6 @@ export type PathResolve = (pathCx : PathContext) => AbstractPath;
5962
*
6063
* ```javascript
6164
* ...
62-
* moduleHandlers: {
63-
* '.json': (source, path, options) => JSON.parse(source),
64-
* }
6565
* ...
6666
* ```
6767
*/
@@ -93,7 +93,7 @@ export type Resource = {
9393
id : ModuleCacheId,
9494
/** file path of the resource */
9595
path : AbstractPath,
96-
/** asynchronously get the content of the resource */
96+
/** asynchronously get the content of the resource. Once you got the content, you can asynchronously get the data through the getContentData(asBinary) method. */
9797
getContent : () => Promise<File>,
9898
}
9999

0 commit comments

Comments
 (0)