Skip to content

Commit 03b1825

Browse files
feat(api): add top-level "addedIn" key support (quasarframework#7105)
* feat(api): include top-level "addedIn" * chore(api): add top-level "addedIn" key * chore: add vscode debug helper (F5 to start debugging build) * Delete launch.json Co-authored-by: Razvan Stoenescu <razvan.stoenescu@gmail.com>
1 parent 41ac6e8 commit 03b1825

File tree

9 files changed

+54
-3
lines changed

9 files changed

+54
-3
lines changed

ui/build/build.api.js

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ function getMixedInAPI (api, mainFile) {
3636
}
3737

3838
const topSections = {
39-
plugin: [ 'meta', 'injection', 'quasarConfOptions', 'props', 'methods' ],
40-
component: [ 'meta', 'behavior', 'quasarConfOptions', 'props', 'slots', 'scopedSlots', 'events', 'methods' ],
41-
directive: [ 'meta', 'quasarConfOptions', 'value', 'arg', 'modifiers' ]
39+
plugin: [ 'meta', 'injection', 'quasarConfOptions', 'addedIn', 'props', 'methods' ],
40+
component: [ 'meta', 'behavior', 'quasarConfOptions', 'addedIn', 'props', 'slots', 'scopedSlots', 'events', 'methods' ],
41+
directive: [ 'meta', 'quasarConfOptions', 'addedIn', 'value', 'arg', 'modifiers' ]
4242
}
4343

4444
const objectTypes = {
@@ -309,6 +309,36 @@ function parseObject ({ banner, api, itemName, masterType, verifyCategory }) {
309309
})
310310
}
311311

312+
// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
313+
// https://regex101.com/r/vkijKf/1/
314+
const SEMANTIC_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
315+
316+
function isValidVersion (version) {
317+
return !!SEMANTIC_REGEX.exec(version)
318+
}
319+
320+
function handleAddedIn (api, banner) {
321+
if (api['addedIn'] === void 0 || api['addedIn'].length === 0) {
322+
logError(`${banner} "addedIn" is empty`)
323+
console.log()
324+
process.exit(1)
325+
}
326+
327+
const addedIn = api['addedIn']
328+
329+
if (addedIn.charAt(0) !== 'v') {
330+
logError(`${banner} "addedIn" value (${addedIn}) must start with "v"`)
331+
console.log()
332+
process.exit(1)
333+
}
334+
335+
if (isValidVersion(addedIn.slice(1)) !== true) {
336+
logError(`${banner} "addedIn" value (${addedIn}) must follow sematic versioning`)
337+
console.log()
338+
process.exit(1)
339+
}
340+
}
341+
312342
function convertBehavior (api, banner) {
313343
const behavior = {}
314344

@@ -364,6 +394,11 @@ function parseAPI (file, apiType) {
364394
continue
365395
}
366396

397+
if (type === 'addedIn') {
398+
handleAddedIn(api, banner)
399+
continue
400+
}
401+
367402
if (['value', 'arg', 'quasarConfOptions', 'meta'].includes(type)) {
368403
if (Object(api[type]) !== api[type]) {
369404
logError(`${banner} "${type}"/"${type}" is not an object`)

ui/src/components/file/QFile.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"docsUrl": "https://v1.quasar.dev/vue-components/file"
66
},
77

8+
"addedIn": "v1.8.0",
9+
810
"props": {
911
"value": {
1012
"type": [ "File", "FileList", "Array" ],

ui/src/components/intersection/QIntersection.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"$listeners": true
1010
},
1111

12+
"addedIn": "v1.4.0",
13+
1214
"props": {
1315
"tag": {
1416
"examples": [ "div", "span", "blockquote" ],

ui/src/components/responsive/QResponsive.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"$listeners": true
1010
},
1111

12+
"addedIn": "v1.9.0",
13+
1214
"slots": {
1315
"default": {
1416
"extends": "default"

ui/src/components/skeleton/QSkeleton.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"$listeners": true
1010
},
1111

12+
"addedIn": "v1.6.0",
13+
1214
"props": {
1315
"dark": {
1416
"extends": "dark"

ui/src/components/virtual-scroll/QVirtualScroll.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"docsUrl": "https://v1.quasar.dev/vue-components/virtual-scroll"
66
},
77

8+
"addedIn": "v1.1.0",
9+
810
"props": {
911
"type": {
1012
"type": "String",

ui/src/directives/Intersection.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"docsUrl": "https://v1.quasar.dev/vue-directives/intersection"
44
},
55

6+
"addedIn": "v1.3.0",
7+
68
"value": {
79
"type": [ "Object", "Function" ],
810
"desc": "Function to call when scrolling occurs (identical to description of 'handler' prop of the Object form); If using the Object form, it is HIGHLY recommended to reference it from your vue component scope, otherwise the directive update cycle will continuously recreate the observer which hits performance hard",

ui/src/directives/Mutation.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"docsUrl": "https://v1.quasar.dev/vue-directives/mutation"
44
},
55

6+
"addedIn": "v1.3.0",
7+
68
"value": {
79
"type": [ "Function" ],
810
"desc": "Function to call when mutation occurs; It is HIGHLY recommended to reference it from your vue component scope, otherwise the directive update cycle will continuously recreate the observer which hits performance hard",

ui/src/plugins/Dark.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
"injection": "$q.dark",
77

8+
"addedIn": "v1.3.0",
9+
810
"props": {
911
"isActive": {
1012
"type": "Boolean",

0 commit comments

Comments
 (0)