45
45
46
46
Ƭ ** AbstractPath** : { toString: () => string }
47
47
48
- * Defined in [ types.ts:29] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0/src/types.ts#L29 ) *
48
+ * Defined in [ types.ts:32] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1/src/types.ts#L32 ) *
49
+
50
+ 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.
49
51
50
52
#### Type declaration:
51
53
59
61
60
62
Ƭ ** Cache** : { get: (key: string) => Promise<string\> ; set: (key: string, value: string) => Promise<void\> }
61
63
62
- * Defined in [ types.ts:20] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/types.ts#L20 ) *
64
+ * Defined in [ types.ts:20] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/types.ts#L20 ) *
63
65
64
66
#### Type declaration:
65
67
74
76
75
77
Ƭ ** ContentData** : string \| ArrayBuffer
76
78
77
- * Defined in [ types.ts:71] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/types.ts#L71 ) *
79
+ * Defined in [ types.ts:71] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/types.ts#L71 ) *
78
80
79
81
___
80
82
81
83
### CustomBlock
82
84
83
85
Ƭ ** CustomBlock** : { attrs: Record<string, string \| true\> ; content: string ; type: string }
84
86
85
- * Defined in [ types.ts:109] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/types.ts#L109 ) *
87
+ * Defined in [ types.ts:109] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/types.ts#L109 ) *
86
88
87
89
A custom block
88
90
100
102
101
103
Ƭ ** CustomBlockCallback** : (component: [ ModuleExport] ( README.md#moduleexport ) ) => void
102
104
103
- * Defined in [ types.ts:103] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/types.ts#L103 ) *
105
+ * Defined in [ types.ts:103] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/types.ts#L103 ) *
104
106
105
107
CustomBlockCallback function type
106
108
110
112
111
113
Ƭ ** File** : { getContentData: (asBinary: Boolean) => Promise<[ ContentData] ( README.md#contentdata ) \> ; type: string }
112
114
113
- * Defined in [ types.ts:77] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/types.ts#L77 ) *
115
+ * Defined in [ types.ts:77] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/types.ts#L77 ) *
114
116
115
117
Represents a file content and the extension name.
116
118
@@ -127,15 +129,15 @@ ___
127
129
128
130
Ƭ ** LangProcessor** : (source: string, preprocessOptions?: any) => Promise<string\> \| string
129
131
130
- * Defined in [ types.ts:399] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/types.ts#L399 ) *
132
+ * Defined in [ types.ts:399] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/types.ts#L399 ) *
131
133
132
134
___
133
135
134
136
### Module
135
137
136
138
Ƭ ** Module** : { exports: [ ModuleExport] ( README.md#moduleexport ) }
137
139
138
- * Defined in [ types.ts:129] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/types.ts#L129 ) *
140
+ * Defined in [ types.ts:129] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/types.ts#L129 ) *
139
141
140
142
This just represents a loaded js module
141
143
@@ -151,15 +153,15 @@ ___
151
153
152
154
Ƭ ** ModuleCacheId** : string
153
155
154
- * Defined in [ types.ts:26] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/types.ts#L26 ) *
156
+ * Defined in [ types.ts:26] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/types.ts#L26 ) *
155
157
156
158
___
157
159
158
160
### ModuleExport
159
161
160
162
Ƭ ** ModuleExport** : {}
161
163
162
- * Defined in [ types.ts:123] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/types.ts#L123 ) *
164
+ * Defined in [ types.ts:123] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/types.ts#L123 ) *
163
165
164
166
This just represents a loaded js module exports
165
167
@@ -169,12 +171,13 @@ ___
169
171
170
172
Ƭ ** ModuleHandler** : (type: string, getContentData: File[ \" getContentData\" ] , path: [ AbstractPath] ( README.md#abstractpath ) , options: [ Options] ( README.md#options ) ) => Promise<[ ModuleExport] ( README.md#moduleexport ) \| null\>
171
173
172
- * Defined in [ types.ts:68] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0/src/types.ts#L68 ) *
174
+ * Defined in [ types.ts:68] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1/src/types.ts#L68 ) *
175
+
176
+ Used by the library when it needs to handle a does not know how to handle a given file type (eg. ` .json ` files).
173
177
174
- Used by the library when it does not know how to handle a given file type (eg. ` .json ` files).
175
- see [[ moduleHandlers]]
178
+ ** ` param ` ** The type of the file. It can be anything, but must be '.vue', '.js' or '.mjs' for vue, js and esm files.
176
179
177
- ** ` param ` ** The content of the file
180
+ ** ` param ` ** The method to get the content data of a file (text or binary). see [[ File [ 'getContentData' ] ]]
178
181
179
182
** ` param ` ** The path of the file
180
183
@@ -184,9 +187,6 @@ see [[moduleHandlers]]
184
187
185
188
``` javascript
186
189
...
187
- moduleHandlers: {
188
- ' .json ' : (source , path , options ) => JSON .parse (source),
189
- }
190
190
...
191
191
```
192
192
196
196
197
197
Ƭ **Options**: { additionalBabelParserPlugins?: babel\_ParserPlugin[] ; additionalBabelPlugins?: Record<string, any\> ; compiledCache?: [Cache](README.md#cache) ; delimiters?: [string, string] ; handleModule?: [ModuleHandler](README.md#modulehandler) ; moduleCache: Record<[ModuleCacheId](README.md#modulecacheid), LoadingType<[ModuleExport](README.md#moduleexport)\> \| [ModuleExport](README.md#moduleexport)\> ; pathResolve: [PathResolve](README.md#pathresolve) ; addStyle: (style: string, scopeId: string \| undefined) => void ; customBlockHandler?: (block: [CustomBlock](README.md#customblock), filename: [AbstractPath](README.md#abstractpath), options: [Options](README.md#options)) => Promise<[CustomBlockCallback](README.md#customblockcallback) \| undefined\> ; getFile: (path: [AbstractPath](README.md#abstractpath)) => Promise<[File](README.md#file) \| [ContentData](README.md#contentdata)\> ; getResource: (pathCx: [PathContext](README.md#pathcontext), options: [Options](README.md#options)) => [Resource](README.md#resource) ; loadModule?: (path: [AbstractPath](README.md#abstractpath), options: [Options](README.md#options)) => Promise<[ModuleExport](README.md#moduleexport) \| undefined\> ; log?: (type: string, ...data: any[]) => void }
198
198
199
- * Defined in [ types.ts:140] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/types.ts#L140 ) *
199
+ * Defined in [ types.ts:140] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/types.ts#L140 ) *
200
200
201
201
#### Type declaration:
202
202
222
222
223
223
Ƭ ** PathContext** : { refPath: [ AbstractPath] ( README.md#abstractpath ) ; relPath: [ AbstractPath] ( README.md#abstractpath ) }
224
224
225
- * Defined in [ types.ts:38 ] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/types.ts#L38 ) *
225
+ * Defined in [ types.ts:41 ] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/types.ts#L41 ) *
226
226
227
227
A PathContext represents a path (relPath) relative to an abolute path (refPath)
228
228
Note that relPath is not necessary relative, but it is, relPath is relative to refPath.
240
240
241
241
Ƭ ** PathResolve** : (pathCx: [ PathContext] ( README.md#pathcontext ) ) => [ AbstractPath] ( README.md#abstractpath )
242
242
243
- * Defined in [ types.ts:47 ] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/types.ts#L47 ) *
243
+ * Defined in [ types.ts:50 ] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/types.ts#L50 ) *
244
244
245
245
relative to absolute module path resolution
246
246
@@ -250,15 +250,15 @@ ___
250
250
251
251
Ƭ ** Resource** : { getContent: () => Promise<[ File] ( README.md#file ) \> ; id: [ ModuleCacheId] ( README.md#modulecacheid ) ; path: [ AbstractPath] ( README.md#abstractpath ) }
252
252
253
- * Defined in [ types.ts:88] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/types.ts#L88 ) *
253
+ * Defined in [ types.ts:88] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/types.ts#L88 ) *
254
254
255
255
Represents a resource.
256
256
257
257
#### Type declaration:
258
258
259
259
Name | Type | Description |
260
260
------ | ------ | ------ |
261
- ` getContent ` | () => Promise<[ File] ( README.md#file ) \> | asynchronously get the content of the resource |
261
+ ` getContent ` | () => Promise<[ File] ( README.md#file ) \> | asynchronously get the content of the resource. Once you got the content, you can asynchronously get the data through the getContentData(asBinary) method. |
262
262
` id ` | [ ModuleCacheId] ( README.md#modulecacheid ) | 'abstract' unique id of the resource. This id is used as the key of the [[ Options.moduleCache]] |
263
263
` path ` | [ AbstractPath] ( README.md#abstractpath ) | file path of the resource |
264
264
@@ -268,9 +268,9 @@ Name | Type | Description |
268
268
269
269
• ` Const ` ** version** : string = process.env.VERSION
270
270
271
- * Defined in [ tools.ts:53] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/tools.ts#L53 ) *
271
+ * Defined in [ tools.ts:53] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/tools.ts#L53 ) *
272
272
273
- * Defined in [ index.ts:26] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/index.ts#L26 ) *
273
+ * Defined in [ index.ts:26] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/index.ts#L26 ) *
274
274
275
275
the version of the library (process.env.VERSION is set by webpack, at compile-time)
276
276
@@ -280,15 +280,15 @@ ___
280
280
281
281
• ` Const ` ** vueVersion** : string
282
282
283
- * Defined in [ createSFCModule.ts:4] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/createSFCModule.ts#L4 ) *
283
+ * Defined in [ createSFCModule.ts:4] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/createSFCModule.ts#L4 ) *
284
284
285
285
## Functions
286
286
287
287
### buildTemplateProcessor
288
288
289
289
▸ ** buildTemplateProcessor** (` processor ` : [ LangProcessor] ( README.md#langprocessor ) ): object
290
290
291
- * Defined in [ index.ts:179] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/index.ts#L179 ) *
291
+ * Defined in [ index.ts:179] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/index.ts#L179 ) *
292
292
293
293
Convert a function to template processor interface (consolidate)
294
294
310
310
311
311
▸ ** createSFCModule** (` source ` : string, ` filename ` : [ AbstractPath] ( README.md#abstractpath ) , ` options ` : [ Options] ( README.md#options ) ): Promise<[ ModuleExport] ( README.md#moduleexport ) \>
312
312
313
- * Defined in [ createSFCModule.ts:3] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/createSFCModule.ts#L3 ) *
313
+ * Defined in [ createSFCModule.ts:3] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/createSFCModule.ts#L3 ) *
314
314
315
315
#### Parameters:
316
316
328
328
329
329
▸ ** defaultGetResource** (` pathCx ` : [ PathContext] ( README.md#pathcontext ) , ` options ` : [ Options] ( README.md#options ) ): [ Resource] ( README.md#resource )
330
330
331
- * Defined in [ index.ts:76] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/index.ts#L76 ) *
331
+ * Defined in [ index.ts:76] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/index.ts#L76 ) *
332
332
333
333
Default getResource implementation
334
334
by default, getContent() use the file extension as file type.
348
348
349
349
▸ ** defaultHandleModule** (` type ` : string, ` getContentData ` : File[ \" getContentData\" ] , ` path ` : [ AbstractPath] ( README.md#abstractpath ) , ` options ` : [ Options] ( README.md#options ) ): Promise<[ ModuleExport] ( README.md#moduleexport ) \| null\>
350
350
351
- * Defined in [ tools.ts:372] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/tools.ts#L372 ) *
351
+ * Defined in [ tools.ts:372] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/tools.ts#L372 ) *
352
352
353
353
Default implementation of handleModule
354
354
369
369
370
370
▸ ` Const ` ** defaultPathResolve** (` __namedParameters ` : { refPath: [ AbstractPath] ( README.md#abstractpath ) ; relPath: [ AbstractPath] ( README.md#abstractpath ) }): string \| [ AbstractPath] ( README.md#abstractpath )
371
371
372
- * Defined in [ index.ts:53] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/index.ts#L53 ) *
372
+ * Defined in [ index.ts:53] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/index.ts#L53 ) *
373
373
374
374
Default resolve implementation
375
375
resolve() should handle 3 situations :
391
391
392
392
▸ ** loadModule** (` path ` : [ AbstractPath] ( README.md#abstractpath ) , ` options? ` : [ Options] ( README.md#options ) ): Promise<[ ModuleExport] ( README.md#moduleexport ) \>
393
393
394
- * Defined in [ index.ts:152] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/index.ts#L152 ) *
394
+ * Defined in [ index.ts:152] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/index.ts#L152 ) *
395
395
396
396
This is the main function.
397
397
This function is intended to be used only to load the entry point of your application.
445
445
446
446
▸ ** loadModuleInternal** (` pathCx ` : [ PathContext] ( README.md#pathcontext ) , ` options ` : [ Options] ( README.md#options ) ): Promise<[ ModuleExport] ( README.md#moduleexport ) \>
447
447
448
- * Defined in [ tools.ts:260] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/04817e0 /src/tools.ts#L260 ) *
448
+ * Defined in [ tools.ts:260] ( https://github.com/FranckFreiburger/vue3-sfc-loader/blob/9dfc5b1 /src/tools.ts#L260 ) *
449
449
450
450
#### Parameters:
451
451
0 commit comments