Skip to content

Commit d54c43c

Browse files
Merge branch 'main' of github.com:FranckFreiburger/vue3-sfc-loader into main
2 parents 17c99bd + 6d5b6a7 commit d54c43c

File tree

5 files changed

+73
-65
lines changed

5 files changed

+73
-65
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11

2+
### [0.8.1](https://github.com/FranckFreiburger/vue3-sfc-loader/compare/v0.8.0...v0.8.1) (2021-06-28)
3+
4+
5+
### Bug Fixes
6+
7+
* **build:** IE11 compatibility ([cce49ec](https://github.com/FranckFreiburger/vue3-sfc-loader/commit/cce49ec23a848822a058ceb586d0a0a502204c28)), closes [#75](https://github.com/FranckFreiburger/vue3-sfc-loader/issues/75)
8+
* core-js with preset-env usage ([2ba3f5d](https://github.com/FranckFreiburger/vue3-sfc-loader/commit/2ba3f5dbf85900b9c6c4cceb37aa1c69ba2c44cf))
9+
210
## [0.8.0](https://github.com/FranckFreiburger/vue3-sfc-loader/compare/v0.7.3...v0.8.0) (2021-05-31)
311

412

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ Load .vue files dynamically at runtime from your html/js. No node.js environment
8686
## dist/
8787

8888
[![latest bundle version](https://img.shields.io/npm/v/vue3-sfc-loader?label=latest%20version)](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/main/CHANGELOG.md)
89-
[<!--update-min-br-size-->![bundle minified+brotli size](https://img.shields.io/badge/min%2Bbr-284kB-blue)<!--/update-min-br-size-->](#dist)
90-
[<!--update-min-gz-size-->![bundle minified+gzip size](https://img.shields.io/badge/min%2Bgz-360kB-blue)<!--/update-min-gz-size-->](#dist)
91-
[<!--update-min-size-->![bundle minified size](https://img.shields.io/badge/min-1396kB-blue)<!--/update-min-size-->](#dist)
89+
[<!--update-min-br-size-->![bundle minified+brotli size](https://img.shields.io/badge/min%2Bbr-341kB-blue)<!--/update-min-br-size-->](#dist)
90+
[<!--update-min-gz-size-->![bundle minified+gzip size](https://img.shields.io/badge/min%2Bgz-447kB-blue)<!--/update-min-gz-size-->](#dist)
91+
[<!--update-min-size-->![bundle minified size](https://img.shields.io/badge/min-1839kB-blue)<!--/update-min-size-->](#dist)
9292
[![Snyk Vulnerabilities for vue3-sfc-loader](https://img.shields.io/snyk/vulnerabilities/github/FranckFreiburger/vue3-sfc-loader)](https://snyk.io/vuln/npm:vue3-sfc-loader)
9393

9494
[![browser support](https://img.shields.io/github/package-json/browserslist/FranckFreiburger/vue3-sfc-loader)](https://github.com/browserslist/browserslist#query-composition)

docs/api/README.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@
4545

4646
Ƭ **AbstractPath**: { toString: () => string }
4747

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.
4951

5052
#### Type declaration:
5153

@@ -59,7 +61,7 @@ ___
5961

6062
Ƭ **Cache**: { get: (key: string) => Promise<string\> ; set: (key: string, value: string) => Promise<void\> }
6163

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)*
6365

6466
#### Type declaration:
6567

@@ -74,15 +76,15 @@ ___
7476

7577
Ƭ **ContentData**: string \| ArrayBuffer
7678

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)*
7880

7981
___
8082

8183
### CustomBlock
8284

8385
Ƭ **CustomBlock**: { attrs: Record<string, string \| true\> ; content: string ; type: string }
8486

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)*
8688

8789
A custom block
8890

@@ -100,7 +102,7 @@ ___
100102

101103
Ƭ **CustomBlockCallback**: (component: [ModuleExport](README.md#moduleexport)) => void
102104

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)*
104106

105107
CustomBlockCallback function type
106108

@@ -110,7 +112,7 @@ ___
110112

111113
Ƭ **File**: { getContentData: (asBinary: Boolean) => Promise<[ContentData](README.md#contentdata)\> ; type: string }
112114

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)*
114116

115117
Represents a file content and the extension name.
116118

@@ -127,15 +129,15 @@ ___
127129

128130
Ƭ **LangProcessor**: (source: string, preprocessOptions?: any) => Promise<string\> \| string
129131

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)*
131133

132134
___
133135

134136
### Module
135137

136138
Ƭ **Module**: { exports: [ModuleExport](README.md#moduleexport) }
137139

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)*
139141

140142
This just represents a loaded js module
141143

@@ -151,15 +153,15 @@ ___
151153

152154
Ƭ **ModuleCacheId**: string
153155

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)*
155157

156158
___
157159

158160
### ModuleExport
159161

160162
Ƭ **ModuleExport**: {}
161163

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)*
163165

164166
This just represents a loaded js module exports
165167

@@ -169,12 +171,13 @@ ___
169171

170172
Ƭ **ModuleHandler**: (type: string, getContentData: File[\"getContentData\"], path: [AbstractPath](README.md#abstractpath), options: [Options](README.md#options)) => Promise<[ModuleExport](README.md#moduleexport) \| null\>
171173

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).
173177

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.
176179

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'] ]]
178181

179182
**`param`** The path of the file
180183

@@ -184,9 +187,6 @@ see [[moduleHandlers]]
184187

185188
```javascript
186189
...
187-
moduleHandlers: {
188-
'.json': (source, path, options) => JSON.parse(source),
189-
}
190190
...
191191
```
192192

@@ -196,7 +196,7 @@ ___
196196

197197
Ƭ **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 }
198198

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)*
200200

201201
#### Type declaration:
202202

@@ -222,7 +222,7 @@ ___
222222

223223
Ƭ **PathContext**: { refPath: [AbstractPath](README.md#abstractpath) ; relPath: [AbstractPath](README.md#abstractpath) }
224224

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)*
226226

227227
A PathContext represents a path (relPath) relative to an abolute path (refPath)
228228
Note that relPath is not necessary relative, but it is, relPath is relative to refPath.
@@ -240,7 +240,7 @@ ___
240240

241241
Ƭ **PathResolve**: (pathCx: [PathContext](README.md#pathcontext)) => [AbstractPath](README.md#abstractpath)
242242

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)*
244244

245245
relative to absolute module path resolution
246246

@@ -250,15 +250,15 @@ ___
250250

251251
Ƭ **Resource**: { getContent: () => Promise<[File](README.md#file)\> ; id: [ModuleCacheId](README.md#modulecacheid) ; path: [AbstractPath](README.md#abstractpath) }
252252

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)*
254254

255255
Represents a resource.
256256

257257
#### Type declaration:
258258

259259
Name | Type | Description |
260260
------ | ------ | ------ |
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. |
262262
`id` | [ModuleCacheId](README.md#modulecacheid) | 'abstract' unique id of the resource. This id is used as the key of the [[Options.moduleCache]] |
263263
`path` | [AbstractPath](README.md#abstractpath) | file path of the resource |
264264

@@ -268,9 +268,9 @@ Name | Type | Description |
268268

269269
`Const` **version**: string = process.env.VERSION
270270

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)*
272272

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)*
274274

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

@@ -280,15 +280,15 @@ ___
280280

281281
`Const` **vueVersion**: string
282282

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)*
284284

285285
## Functions
286286

287287
### buildTemplateProcessor
288288

289289
**buildTemplateProcessor**(`processor`: [LangProcessor](README.md#langprocessor)): object
290290

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)*
292292

293293
Convert a function to template processor interface (consolidate)
294294

@@ -310,7 +310,7 @@ ___
310310

311311
**createSFCModule**(`source`: string, `filename`: [AbstractPath](README.md#abstractpath), `options`: [Options](README.md#options)): Promise<[ModuleExport](README.md#moduleexport)\>
312312

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)*
314314

315315
#### Parameters:
316316

@@ -328,7 +328,7 @@ ___
328328

329329
**defaultGetResource**(`pathCx`: [PathContext](README.md#pathcontext), `options`: [Options](README.md#options)): [Resource](README.md#resource)
330330

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)*
332332

333333
Default getResource implementation
334334
by default, getContent() use the file extension as file type.
@@ -348,7 +348,7 @@ ___
348348

349349
**defaultHandleModule**(`type`: string, `getContentData`: File[\"getContentData\"], `path`: [AbstractPath](README.md#abstractpath), `options`: [Options](README.md#options)): Promise<[ModuleExport](README.md#moduleexport) \| null\>
350350

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)*
352352

353353
Default implementation of handleModule
354354

@@ -369,7 +369,7 @@ ___
369369

370370
`Const`**defaultPathResolve**(`__namedParameters`: { refPath: [AbstractPath](README.md#abstractpath) ; relPath: [AbstractPath](README.md#abstractpath) }): string \| [AbstractPath](README.md#abstractpath)
371371

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)*
373373

374374
Default resolve implementation
375375
resolve() should handle 3 situations :
@@ -391,7 +391,7 @@ ___
391391

392392
**loadModule**(`path`: [AbstractPath](README.md#abstractpath), `options?`: [Options](README.md#options)): Promise<[ModuleExport](README.md#moduleexport)\>
393393

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)*
395395

396396
This is the main function.
397397
This function is intended to be used only to load the entry point of your application.
@@ -445,7 +445,7 @@ ___
445445

446446
**loadModuleInternal**(`pathCx`: [PathContext](README.md#pathcontext), `options`: [Options](README.md#options)): Promise<[ModuleExport](README.md#moduleexport)\>
447447

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)*
449449

450450
#### Parameters:
451451

0 commit comments

Comments
 (0)