Skip to content

Commit dc05c73

Browse files
chore(docs): v0.4.2 API docs & examples
1 parent e2255e9 commit dc05c73

File tree

9 files changed

+87
-63
lines changed

9 files changed

+87
-63
lines changed

docs/api/README.md

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
* [Cache](interfaces/cache.md)
1212
* [CustomBlock](interfaces/customblock.md)
13+
* [File](interfaces/file.md)
1314
* [Module](interfaces/module.md)
1415
* [ModuleExport](interfaces/moduleexport.md)
1516
* [ModuleHandler](interfaces/modulehandler.md)
@@ -19,7 +20,6 @@
1920
### Type aliases
2021

2122
* [CustomBlockCallback](README.md#customblockcallback)
22-
* [File](README.md#file)
2323
* [LoadModule](README.md#loadmodule)
2424

2525
### Variables
@@ -42,37 +42,27 @@
4242

4343
Ƭ **CustomBlockCallback**: (component: [ModuleExport](interfaces/moduleexport.md)) => void
4444

45-
*Defined in [types.ts:66](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L66)*
45+
*Defined in [types.ts:69](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L69)*
4646

4747
CustomBlockCallback function type
4848

4949
___
5050

51-
### File
52-
53-
Ƭ **File**: string \| { content: string ; extname: string }
54-
55-
*Defined in [types.ts:60](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L60)*
56-
57-
Represents the content of the file or the content and the extension name.
58-
59-
___
60-
6151
### LoadModule
6252

6353
Ƭ **LoadModule**: (path: string, options: [Options](interfaces/options.md)) => Promise<[ModuleExport](interfaces/moduleexport.md)\>
6454

65-
*Defined in [types.ts:332](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L332)*
55+
*Defined in [types.ts:335](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L335)*
6656

6757
## Variables
6858

6959
### version
7060

7161
`Const` **version**: string = process.env.VERSION
7262

73-
*Defined in [tools.ts:39](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/tools.ts#L39)*
63+
*Defined in [tools.ts:39](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/tools.ts#L39)*
7464

75-
*Defined in [index.ts:11](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/index.ts#L11)*
65+
*Defined in [index.ts:11](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/index.ts#L11)*
7666

7767
the version of the library (process.env.VERSION is set by webpack, at compile-time)
7868

@@ -82,15 +72,15 @@ ___
8272

8373
`Const` **vueVersion**: string
8474

85-
*Defined in [createSFCModule.ts:4](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/createSFCModule.ts#L4)*
75+
*Defined in [createSFCModule.ts:4](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/createSFCModule.ts#L4)*
8676

8777
## Functions
8878

8979
### createSFCModule
9080

9181
**createSFCModule**(`source`: string, `filename`: string, `options`: [Options](interfaces/options.md), `loadModule`: [LoadModule](README.md#loadmodule)): Promise<[ModuleExport](interfaces/moduleexport.md)\>
9282

93-
*Defined in [createSFCModule.ts:3](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/createSFCModule.ts#L3)*
83+
*Defined in [createSFCModule.ts:3](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/createSFCModule.ts#L3)*
9484

9585
#### Parameters:
9686

@@ -109,7 +99,7 @@ ___
10999

110100
**loadModule**(`path`: string, `options_?`: [Options](interfaces/options.md)): Promise<[ModuleExport](interfaces/moduleexport.md)\>
111101

112-
*Defined in [index.ts:109](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/index.ts#L109)*
102+
*Defined in [index.ts:109](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/index.ts#L109)*
113103

114104
This is the main function.
115105
This function is intended to be used only to load the entry point of your application.
@@ -119,7 +109,7 @@ If for some reason you need to use it in your components, be sure to share at le
119109

120110
Name | Type | Default value | Description |
121111
------ | ------ | ------ | ------ |
122-
`path` | string | - | The path of the `.vue` file. If path is not a path (eg. an string ID), your [getFile](interfaces/options.md#getfile) function must return a [File](README.md#file) object. |
112+
`path` | string | - | The path of the `.vue` file. If path is not a path (eg. an string ID), your [getFile](interfaces/options.md#getfile) function must return a [File](interfaces/file.md) object. |
123113
`options_` | [Options](interfaces/options.md) | throwNotDefined('options') | - |
124114

125115
**Returns:** Promise<[ModuleExport](interfaces/moduleexport.md)\>
@@ -163,7 +153,7 @@ A Promise of the component
163153

164154
`Const` **defaultPathHandlers**: object
165155

166-
*Defined in [index.ts:56](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/index.ts#L56)*
156+
*Defined in [index.ts:56](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/index.ts#L56)*
167157

168158
Default implementation of PathHandlers
169159

docs/api/interfaces/cache.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
**get**(`key`: string): Promise<string\>
2323

24-
*Defined in [types.ts:19](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L19)*
24+
*Defined in [types.ts:19](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L19)*
2525

2626
#### Parameters:
2727

@@ -37,7 +37,7 @@ ___
3737

3838
**set**(`key`: string, `value`: string): Promise<void\>
3939

40-
*Defined in [types.ts:20](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L20)*
40+
*Defined in [types.ts:20](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L20)*
4141

4242
#### Parameters:
4343

docs/api/interfaces/customblock.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ A custom block
2424

2525
**attrs**: Record<string, string \| true\>
2626

27-
*Defined in [types.ts:75](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L75)*
27+
*Defined in [types.ts:78](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L78)*
2828

2929
___
3030

3131
### content
3232

3333
**content**: string
3434

35-
*Defined in [types.ts:74](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L74)*
35+
*Defined in [types.ts:77](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L77)*
3636

3737
___
3838

3939
### type
4040

4141
**type**: string
4242

43-
*Defined in [types.ts:73](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L73)*
43+
*Defined in [types.ts:76](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L76)*

docs/api/interfaces/file.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
**[vue3-sfc-loader](../README.md)**
2+
3+
> [Globals](../README.md) / File
4+
5+
# Interface: File
6+
7+
Represents a file content and the extension name.
8+
9+
## Hierarchy
10+
11+
* **File**
12+
13+
## Index
14+
15+
### Properties
16+
17+
* [content](file.md#content)
18+
* [extname](file.md#extname)
19+
20+
## Properties
21+
22+
### content
23+
24+
**content**: string
25+
26+
*Defined in [types.ts:62](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L62)*
27+
28+
___
29+
30+
### extname
31+
32+
**extname**: string
33+
34+
*Defined in [types.ts:63](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L63)*

docs/api/interfaces/module.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ This just represents a loaded js module
2222

2323
**exports**: [ModuleExport](moduleexport.md)
2424

25-
*Defined in [types.ts:93](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L93)*
25+
*Defined in [types.ts:96](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L96)*

docs/api/interfaces/modulehandler.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ see [additionalModuleHandlers](options.md#additionalmodulehandlers)
1515

1616
▸ (`source`: string, `path`: string, `options`: [Options](options.md)): Promise<[ModuleExport](moduleexport.md)\>
1717

18-
*Defined in [types.ts:52](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L52)*
18+
*Defined in [types.ts:52](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L52)*
1919

2020
Used by the library when it does not know how to handle a given file type (eg. `.json` files).
2121
see [additionalModuleHandlers](options.md#additionalmodulehandlers)

docs/api/interfaces/options.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
`Optional` **additionalBabelPlugins**: any[]
3535

36-
*Defined in [types.ts:212](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L212)*
36+
*Defined in [types.ts:215](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L215)*
3737

3838
Additional babel plugins. [TBD]
3939

@@ -48,7 +48,7 @@ ___
4848

4949
`Optional` **additionalModuleHandlers**: Record<string, [ModuleHandler](modulehandler.md)\>
5050

51-
*Defined in [types.ts:219](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L219)*
51+
*Defined in [types.ts:222](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L222)*
5252

5353
Additional module type handlers. see [ModuleHandler](modulehandler.md)
5454

@@ -58,7 +58,7 @@ ___
5858

5959
`Optional` **compiledCache**: [Cache](cache.md)
6060

61-
*Defined in [types.ts:259](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L259)*
61+
*Defined in [types.ts:262](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L262)*
6262

6363
[get](cache.md#get)() and [set](cache.md#set)() functions of this object are called when the lib needs to save or load already compiled code. get and set functions must return a `Promise` (or can be `async`).
6464
Since compilation consume a lot of CPU, is is always a good idea to provide this object.
@@ -102,7 +102,7 @@ ___
102102

103103
`Optional` **delimiters**: [string, string]
104104

105-
*Defined in [types.ts:201](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L201)*
105+
*Defined in [types.ts:204](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L204)*
106106

107107
Sets the delimiters used for text interpolation within the template.
108108
Typically this is used to avoid conflicting with server-side frameworks that also use mustache syntax.
@@ -146,7 +146,7 @@ ___
146146

147147
`Optional` **moduleCache**: Record<string, [Module](module.md)\>
148148

149-
*Defined in [types.ts:118](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L118)*
149+
*Defined in [types.ts:121](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L121)*
150150

151151
Initial cache that will contain resolved dependencies. All new modules go here.
152152
`vue` must initially be contained in this object.
@@ -170,7 +170,7 @@ ___
170170

171171
**pathHandlers**: [PathHandlers](pathhandlers.md)
172172

173-
*Defined in [types.ts:305](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L305)*
173+
*Defined in [types.ts:308](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L308)*
174174

175175
Abstact path handling
176176

@@ -180,7 +180,7 @@ Abstact path handling
180180

181181
**addStyle**(`style`: string, `scopeId`: string \| undefined): void
182182

183-
*Defined in [types.ts:161](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L161)*
183+
*Defined in [types.ts:164](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L164)*
184184

185185
Called by the library when CSS style must be added in the HTML document.
186186

@@ -212,7 +212,7 @@ ___
212212

213213
`Optional`**customBlockHandler**(`block`: [CustomBlock](customblock.md), `filename`: string, `options`: [Options](options.md)): Promise<[CustomBlockCallback](../README.md#customblockcallback) \| undefined\>
214214

215-
*Defined in [types.ts:327](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L327)*
215+
*Defined in [types.ts:330](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L330)*
216216

217217
Called for each custom block.
218218

@@ -247,9 +247,9 @@ ___
247247

248248
### getFile
249249

250-
**getFile**(`path`: string): Promise<[File](../README.md#file)\>
250+
**getFile**(`path`: string): Promise<[File](file.md)\>
251251

252-
*Defined in [types.ts:139](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L139)*
252+
*Defined in [types.ts:142](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L142)*
253253

254254
Called by the library when it needs a file.
255255

@@ -259,7 +259,7 @@ Name | Type | Description |
259259
------ | ------ | ------ |
260260
`path` | string | The path of the file |
261261

262-
**Returns:** Promise<[File](../README.md#file)\>
262+
**Returns:** Promise<[File](file.md)\>
263263

264264
a Promise of the file content (UTF-8)
265265

@@ -282,7 +282,7 @@ ___
282282

283283
`Optional`**loadModule**(`path`: string, `options`: [Options](options.md)): Promise<[Module](module.md) \| undefined\>
284284

285-
*Defined in [types.ts:298](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L298)*
285+
*Defined in [types.ts:301](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L301)*
286286

287287
Called when the lib requires a module. Do return `undefined` to let the library handle this.
288288

@@ -315,7 +315,7 @@ ___
315315

316316
`Optional`**log**(`type`: string, ...`data`: any[]): void
317317

318-
*Defined in [types.ts:277](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L277)*
318+
*Defined in [types.ts:280](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L280)*
319319

320320
Called by the library when there is somthing to log (eg. scripts compilation errors, template compilation errors, template compilation tips, style compilation errors, ...)
321321

docs/api/interfaces/pathhandlers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
**extname**(`filepath`: string): string
2323

24-
*Defined in [types.ts:25](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L25)*
24+
*Defined in [types.ts:25](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L25)*
2525

2626
#### Parameters:
2727

@@ -37,7 +37,7 @@ ___
3737

3838
**resolve**(`absoluteFilepath`: string, `dependencyPath`: string): string
3939

40-
*Defined in [types.ts:29](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e87df0d/src/types.ts#L29)*
40+
*Defined in [types.ts:29](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/e2255e9/src/types.ts#L29)*
4141

4242
#### Parameters:
4343

0 commit comments

Comments
 (0)