@blueking/bkui-form 1.0.1-beta.3 → 1.0.1-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/common/FieldGroupWrap.d.ts +209 -0
- package/dist/adapter/field/ArrayField.d.ts +147 -0
- package/dist/adapter/field/BooleanField.d.ts +145 -0
- package/dist/adapter/field/CompositionField.d.ts +151 -0
- package/dist/adapter/field/FieldProps.d.ts +70 -0
- package/dist/adapter/field/NumberField.d.ts +145 -0
- package/dist/adapter/field/ObjectField.d.ts +147 -0
- package/dist/adapter/field/SchemaField.d.ts +145 -0
- package/dist/adapter/field/StringField.d.ts +4 -0
- package/dist/adapter/widget/ArrayWidget.d.ts +154 -0
- package/dist/adapter/widget/ButtonWidget.d.ts +16 -0
- package/dist/adapter/widget/CheckboxWidget.d.ts +34 -0
- package/dist/adapter/widget/CollapseGroupWidget.d.ts +196 -0
- package/dist/adapter/widget/ColorPickerWidget.d.ts +8 -0
- package/dist/adapter/widget/InputWidget.d.ts +30 -0
- package/dist/adapter/widget/KeyValueArrayWidget.d.ts +157 -0
- package/dist/adapter/widget/RadioWidget.d.ts +37 -0
- package/dist/adapter/widget/SelectWidget.d.ts +37 -0
- package/dist/adapter/widget/SwitchWidget.d.ts +10 -0
- package/dist/adapter/widget/TabGroupWidget.d.ts +187 -0
- package/dist/adapter/widget/TableWidget.d.ts +154 -0
- package/dist/adapter/widget/Widget.d.ts +182 -0
- package/dist/controller/form.d.ts +141 -0
- package/dist/controller/props.d.ts +62 -0
- package/dist/core/events.d.ts +10 -0
- package/dist/core/expression.d.ts +13 -0
- package/dist/core/form.d.ts +5 -0
- package/dist/core/lang.d.ts +1 -0
- package/dist/core/layout.d.ts +20 -0
- package/dist/core/lifecycle.d.ts +0 -0
- package/dist/core/path.d.ts +9 -0
- package/dist/core/proxy.d.ts +3 -0
- package/dist/core/reaction.d.ts +5 -0
- package/dist/core/register.d.ts +19 -0
- package/dist/core/schema.d.ts +26 -0
- package/dist/core/validator.d.ts +35 -0
- package/dist/core/widgetTree.d.ts +40 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +7443 -0
- package/dist/index.umd.js +12 -0
- package/dist/style.css +1 -0
- package/dist/util/fetch.d.ts +10 -0
- package/dist/util/index.d.ts +23 -0
- package/package.json +24 -12
- package/esm/adapter/common/FieldGroupWrap.tsx.js +0 -199
- package/esm/adapter/field/ArrayField.tsx.js +0 -55
- package/esm/adapter/field/BooleanField.tsx.js +0 -41
- package/esm/adapter/field/CompositionField.tsx.js +0 -113
- package/esm/adapter/field/FieldProps.ts.js +0 -85
- package/esm/adapter/field/NumberField.tsx.js +0 -19
- package/esm/adapter/field/ObjectField.tsx.js +0 -58
- package/esm/adapter/field/SchemaField.tsx.js +0 -28
- package/esm/adapter/field/StringField.tsx.js +0 -4
- package/esm/adapter/widget/ArrayWidget.ts.js +0 -196
- package/esm/adapter/widget/ButtonWidget.ts.js +0 -76
- package/esm/adapter/widget/CheckboxWidget.ts.js +0 -101
- package/esm/adapter/widget/CollapseGroupWidget.ts.js +0 -140
- package/esm/adapter/widget/ColorPickerWidget.ts.js +0 -71
- package/esm/adapter/widget/InputWidget.ts.js +0 -79
- package/esm/adapter/widget/KeyValueArrayWidget.tsx.js +0 -156
- package/esm/adapter/widget/RadioWidget.ts.js +0 -98
- package/esm/adapter/widget/SelectWidget.ts.js +0 -98
- package/esm/adapter/widget/SwitchWidget.ts.js +0 -73
- package/esm/adapter/widget/TabGroupWidget.ts.js +0 -145
- package/esm/adapter/widget/TableWidget.ts.js +0 -205
- package/esm/adapter/widget/Widget.ts.js +0 -497
- package/esm/assets/fonts/iconcool.eot +0 -0
- package/esm/assets/fonts/iconcool.svg +0 -53
- package/esm/assets/fonts/iconcool.ttf +0 -0
- package/esm/assets/fonts/iconcool.woff +0 -0
- package/esm/assets/style.css +0 -43
- package/esm/controller/form.css +0 -164
- package/esm/controller/form.tsx.js +0 -159
- package/esm/controller/props.ts.js +0 -75
- package/esm/core/events.ts.js +0 -74
- package/esm/core/expression.ts.js +0 -67
- package/esm/core/lang.ts.js +0 -25
- package/esm/core/layout.ts.js +0 -149
- package/esm/core/path.ts.js +0 -60
- package/esm/core/proxy.ts.js +0 -10
- package/esm/core/reaction.ts.js +0 -116
- package/esm/core/register.ts.js +0 -74
- package/esm/core/schema.ts.js +0 -302
- package/esm/core/validator.ts.js +0 -248
- package/esm/core/widgetTree.ts.js +0 -163
- package/esm/index.ts.js +0 -6
- package/esm/node_modules/@blueking/cli-service/dist/lib/path.js +0 -35
- package/esm/node_modules/@blueking/cli-service/dist/lib/util.js +0 -233
- package/esm/node_modules/@blueking/cli-service/dist/tools/rust/helper/path.js +0 -172
- package/esm/node_modules/ajv/dist/ajv.js +0 -50
- package/esm/node_modules/ajv/dist/compile/codegen/code.js +0 -156
- package/esm/node_modules/ajv/dist/compile/codegen/index.js +0 -697
- package/esm/node_modules/ajv/dist/compile/codegen/scope.js +0 -143
- package/esm/node_modules/ajv/dist/compile/errors.js +0 -123
- package/esm/node_modules/ajv/dist/compile/index.js +0 -242
- package/esm/node_modules/ajv/dist/compile/names.js +0 -28
- package/esm/node_modules/ajv/dist/compile/ref_error.js +0 -12
- package/esm/node_modules/ajv/dist/compile/resolve.js +0 -155
- package/esm/node_modules/ajv/dist/compile/rules.js +0 -26
- package/esm/node_modules/ajv/dist/compile/util.js +0 -178
- package/esm/node_modules/ajv/dist/compile/validate/applicability.js +0 -19
- package/esm/node_modules/ajv/dist/compile/validate/boolSchema.js +0 -50
- package/esm/node_modules/ajv/dist/compile/validate/dataType.js +0 -203
- package/esm/node_modules/ajv/dist/compile/validate/defaults.js +0 -35
- package/esm/node_modules/ajv/dist/compile/validate/index.js +0 -520
- package/esm/node_modules/ajv/dist/compile/validate/keyword.js +0 -124
- package/esm/node_modules/ajv/dist/compile/validate/subschema.js +0 -81
- package/esm/node_modules/ajv/dist/core.js +0 -618
- package/esm/node_modules/ajv/dist/refs/data.json +0 -13
- package/esm/node_modules/ajv/dist/refs/json-schema-draft-07.json +0 -151
- package/esm/node_modules/ajv/dist/runtime/equal.js +0 -7
- package/esm/node_modules/ajv/dist/runtime/ucs2length.js +0 -24
- package/esm/node_modules/ajv/dist/runtime/uri.js +0 -6
- package/esm/node_modules/ajv/dist/runtime/validation_error.js +0 -11
- package/esm/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +0 -49
- package/esm/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +0 -106
- package/esm/node_modules/ajv/dist/vocabularies/applicator/allOf.js +0 -23
- package/esm/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +0 -12
- package/esm/node_modules/ajv/dist/vocabularies/applicator/contains.js +0 -95
- package/esm/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +0 -85
- package/esm/node_modules/ajv/dist/vocabularies/applicator/if.js +0 -66
- package/esm/node_modules/ajv/dist/vocabularies/applicator/index.js +0 -44
- package/esm/node_modules/ajv/dist/vocabularies/applicator/items.js +0 -52
- package/esm/node_modules/ajv/dist/vocabularies/applicator/items2020.js +0 -30
- package/esm/node_modules/ajv/dist/vocabularies/applicator/not.js +0 -26
- package/esm/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +0 -60
- package/esm/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +0 -75
- package/esm/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +0 -12
- package/esm/node_modules/ajv/dist/vocabularies/applicator/properties.js +0 -54
- package/esm/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +0 -38
- package/esm/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +0 -13
- package/esm/node_modules/ajv/dist/vocabularies/code.js +0 -131
- package/esm/node_modules/ajv/dist/vocabularies/core/id.js +0 -10
- package/esm/node_modules/ajv/dist/vocabularies/core/index.js +0 -16
- package/esm/node_modules/ajv/dist/vocabularies/core/ref.js +0 -122
- package/esm/node_modules/ajv/dist/vocabularies/discriminator/index.js +0 -104
- package/esm/node_modules/ajv/dist/vocabularies/discriminator/types.js +0 -9
- package/esm/node_modules/ajv/dist/vocabularies/draft7.js +0 -17
- package/esm/node_modules/ajv/dist/vocabularies/format/format.js +0 -92
- package/esm/node_modules/ajv/dist/vocabularies/format/index.js +0 -6
- package/esm/node_modules/ajv/dist/vocabularies/metadata.js +0 -18
- package/esm/node_modules/ajv/dist/vocabularies/validation/const.js +0 -25
- package/esm/node_modules/ajv/dist/vocabularies/validation/enum.js +0 -48
- package/esm/node_modules/ajv/dist/vocabularies/validation/index.js +0 -33
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitItems.js +0 -24
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitLength.js +0 -27
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +0 -27
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +0 -24
- package/esm/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +0 -26
- package/esm/node_modules/ajv/dist/vocabularies/validation/pattern.js +0 -24
- package/esm/node_modules/ajv/dist/vocabularies/validation/required.js +0 -79
- package/esm/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +0 -64
- package/esm/node_modules/ajv-formats/dist/formats.js +0 -173
- package/esm/node_modules/ajv-formats/dist/index.js +0 -37
- package/esm/node_modules/ajv-formats/dist/limit.js +0 -69
- package/esm/node_modules/ajv-i18n/localize/zh/index.js +0 -154
- package/esm/node_modules/fast-deep-equal/index.js +0 -46
- package/esm/node_modules/fast-uri/index.js +0 -303
- package/esm/node_modules/fast-uri/lib/schemes.js +0 -188
- package/esm/node_modules/fast-uri/lib/scopedChars.js +0 -30
- package/esm/node_modules/fast-uri/lib/utils.js +0 -244
- package/esm/node_modules/json-schema-traverse/index.js +0 -89
- package/esm/node_modules/semver/classes/comparator.js +0 -143
- package/esm/node_modules/semver/classes/range.js +0 -557
- package/esm/node_modules/semver/classes/semver.js +0 -333
- package/esm/node_modules/semver/functions/clean.js +0 -8
- package/esm/node_modules/semver/functions/cmp.js +0 -54
- package/esm/node_modules/semver/functions/coerce.js +0 -62
- package/esm/node_modules/semver/functions/compare-build.js +0 -9
- package/esm/node_modules/semver/functions/compare-loose.js +0 -5
- package/esm/node_modules/semver/functions/compare.js +0 -7
- package/esm/node_modules/semver/functions/diff.js +0 -60
- package/esm/node_modules/semver/functions/eq.js +0 -5
- package/esm/node_modules/semver/functions/gt.js +0 -5
- package/esm/node_modules/semver/functions/gte.js +0 -5
- package/esm/node_modules/semver/functions/inc.js +0 -21
- package/esm/node_modules/semver/functions/lt.js +0 -5
- package/esm/node_modules/semver/functions/lte.js +0 -5
- package/esm/node_modules/semver/functions/major.js +0 -5
- package/esm/node_modules/semver/functions/minor.js +0 -5
- package/esm/node_modules/semver/functions/neq.js +0 -5
- package/esm/node_modules/semver/functions/parse.js +0 -18
- package/esm/node_modules/semver/functions/patch.js +0 -5
- package/esm/node_modules/semver/functions/prerelease.js +0 -8
- package/esm/node_modules/semver/functions/rcompare.js +0 -5
- package/esm/node_modules/semver/functions/rsort.js +0 -5
- package/esm/node_modules/semver/functions/satisfies.js +0 -12
- package/esm/node_modules/semver/functions/sort.js +0 -5
- package/esm/node_modules/semver/functions/valid.js +0 -8
- package/esm/node_modules/semver/index.js +0 -91
- package/esm/node_modules/semver/internal/constants.js +0 -37
- package/esm/node_modules/semver/internal/debug.js +0 -11
- package/esm/node_modules/semver/internal/identifiers.js +0 -29
- package/esm/node_modules/semver/internal/lrucache.js +0 -42
- package/esm/node_modules/semver/internal/parse-options.js +0 -17
- package/esm/node_modules/semver/internal/re.js +0 -223
- package/esm/node_modules/semver/ranges/gtr.js +0 -6
- package/esm/node_modules/semver/ranges/intersects.js +0 -9
- package/esm/node_modules/semver/ranges/ltr.js +0 -6
- package/esm/node_modules/semver/ranges/max-satisfying.js +0 -27
- package/esm/node_modules/semver/ranges/min-satisfying.js +0 -26
- package/esm/node_modules/semver/ranges/min-version.js +0 -63
- package/esm/node_modules/semver/ranges/outside.js +0 -82
- package/esm/node_modules/semver/ranges/simplify.js +0 -49
- package/esm/node_modules/semver/ranges/subset.js +0 -249
- package/esm/node_modules/semver/ranges/to-comparators.js +0 -10
- package/esm/node_modules/semver/ranges/valid.js +0 -13
- package/esm/util/fetch.ts.js +0 -190
- package/esm/util/index.ts.js +0 -276
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { HEX } = require('./scopedChars.js')
|
|
4
|
-
|
|
5
|
-
const IPV4_REG = /^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u
|
|
6
|
-
|
|
7
|
-
function normalizeIPv4 (host) {
|
|
8
|
-
if (findToken(host, '.') < 3) { return { host, isIPV4: false } }
|
|
9
|
-
const matches = host.match(IPV4_REG) || []
|
|
10
|
-
const [address] = matches
|
|
11
|
-
if (address) {
|
|
12
|
-
return { host: stripLeadingZeros(address, '.'), isIPV4: true }
|
|
13
|
-
} else {
|
|
14
|
-
return { host, isIPV4: false }
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @param {string[]} input
|
|
20
|
-
* @param {boolean} [keepZero=false]
|
|
21
|
-
* @returns {string|undefined}
|
|
22
|
-
*/
|
|
23
|
-
function stringArrayToHexStripped (input, keepZero = false) {
|
|
24
|
-
let acc = ''
|
|
25
|
-
let strip = true
|
|
26
|
-
for (const c of input) {
|
|
27
|
-
if (HEX[c] === undefined) return undefined
|
|
28
|
-
if (c !== '0' && strip === true) strip = false
|
|
29
|
-
if (!strip) acc += c
|
|
30
|
-
}
|
|
31
|
-
if (keepZero && acc.length === 0) acc = '0'
|
|
32
|
-
return acc
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function getIPV6 (input) {
|
|
36
|
-
let tokenCount = 0
|
|
37
|
-
const output = { error: false, address: '', zone: '' }
|
|
38
|
-
const address = []
|
|
39
|
-
const buffer = []
|
|
40
|
-
let isZone = false
|
|
41
|
-
let endipv6Encountered = false
|
|
42
|
-
let endIpv6 = false
|
|
43
|
-
|
|
44
|
-
function consume () {
|
|
45
|
-
if (buffer.length) {
|
|
46
|
-
if (isZone === false) {
|
|
47
|
-
const hex = stringArrayToHexStripped(buffer)
|
|
48
|
-
if (hex !== undefined) {
|
|
49
|
-
address.push(hex)
|
|
50
|
-
} else {
|
|
51
|
-
output.error = true
|
|
52
|
-
return false
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
buffer.length = 0
|
|
56
|
-
}
|
|
57
|
-
return true
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
for (let i = 0; i < input.length; i++) {
|
|
61
|
-
const cursor = input[i]
|
|
62
|
-
if (cursor === '[' || cursor === ']') { continue }
|
|
63
|
-
if (cursor === ':') {
|
|
64
|
-
if (endipv6Encountered === true) {
|
|
65
|
-
endIpv6 = true
|
|
66
|
-
}
|
|
67
|
-
if (!consume()) { break }
|
|
68
|
-
tokenCount++
|
|
69
|
-
address.push(':')
|
|
70
|
-
if (tokenCount > 7) {
|
|
71
|
-
// not valid
|
|
72
|
-
output.error = true
|
|
73
|
-
break
|
|
74
|
-
}
|
|
75
|
-
if (i - 1 >= 0 && input[i - 1] === ':') {
|
|
76
|
-
endipv6Encountered = true
|
|
77
|
-
}
|
|
78
|
-
continue
|
|
79
|
-
} else if (cursor === '%') {
|
|
80
|
-
if (!consume()) { break }
|
|
81
|
-
// switch to zone detection
|
|
82
|
-
isZone = true
|
|
83
|
-
} else {
|
|
84
|
-
buffer.push(cursor)
|
|
85
|
-
continue
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if (buffer.length) {
|
|
89
|
-
if (isZone) {
|
|
90
|
-
output.zone = buffer.join('')
|
|
91
|
-
} else if (endIpv6) {
|
|
92
|
-
address.push(buffer.join(''))
|
|
93
|
-
} else {
|
|
94
|
-
address.push(stringArrayToHexStripped(buffer))
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
output.address = address.join('')
|
|
98
|
-
return output
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function normalizeIPv6 (host) {
|
|
102
|
-
if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
|
|
103
|
-
const ipv6 = getIPV6(host)
|
|
104
|
-
|
|
105
|
-
if (!ipv6.error) {
|
|
106
|
-
let newHost = ipv6.address
|
|
107
|
-
let escapedHost = ipv6.address
|
|
108
|
-
if (ipv6.zone) {
|
|
109
|
-
newHost += '%' + ipv6.zone
|
|
110
|
-
escapedHost += '%25' + ipv6.zone
|
|
111
|
-
}
|
|
112
|
-
return { host: newHost, escapedHost, isIPV6: true }
|
|
113
|
-
} else {
|
|
114
|
-
return { host, isIPV6: false }
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function stripLeadingZeros (str, token) {
|
|
119
|
-
let out = ''
|
|
120
|
-
let skip = true
|
|
121
|
-
const l = str.length
|
|
122
|
-
for (let i = 0; i < l; i++) {
|
|
123
|
-
const c = str[i]
|
|
124
|
-
if (c === '0' && skip) {
|
|
125
|
-
if ((i + 1 <= l && str[i + 1] === token) || i + 1 === l) {
|
|
126
|
-
out += c
|
|
127
|
-
skip = false
|
|
128
|
-
}
|
|
129
|
-
} else {
|
|
130
|
-
if (c === token) {
|
|
131
|
-
skip = true
|
|
132
|
-
} else {
|
|
133
|
-
skip = false
|
|
134
|
-
}
|
|
135
|
-
out += c
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return out
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function findToken (str, token) {
|
|
142
|
-
let ind = 0
|
|
143
|
-
for (let i = 0; i < str.length; i++) {
|
|
144
|
-
if (str[i] === token) ind++
|
|
145
|
-
}
|
|
146
|
-
return ind
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const RDS1 = /^\.\.?\//u
|
|
150
|
-
const RDS2 = /^\/\.(?:\/|$)/u
|
|
151
|
-
const RDS3 = /^\/\.\.(?:\/|$)/u
|
|
152
|
-
const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u
|
|
153
|
-
|
|
154
|
-
function removeDotSegments (input) {
|
|
155
|
-
const output = []
|
|
156
|
-
|
|
157
|
-
while (input.length) {
|
|
158
|
-
if (input.match(RDS1)) {
|
|
159
|
-
input = input.replace(RDS1, '')
|
|
160
|
-
} else if (input.match(RDS2)) {
|
|
161
|
-
input = input.replace(RDS2, '/')
|
|
162
|
-
} else if (input.match(RDS3)) {
|
|
163
|
-
input = input.replace(RDS3, '/')
|
|
164
|
-
output.pop()
|
|
165
|
-
} else if (input === '.' || input === '..') {
|
|
166
|
-
input = ''
|
|
167
|
-
} else {
|
|
168
|
-
const im = input.match(RDS5)
|
|
169
|
-
if (im) {
|
|
170
|
-
const s = im[0]
|
|
171
|
-
input = input.slice(s.length)
|
|
172
|
-
output.push(s)
|
|
173
|
-
} else {
|
|
174
|
-
throw new Error('Unexpected dot segment condition')
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return output.join('')
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function normalizeComponentEncoding (components, esc) {
|
|
182
|
-
const func = esc !== true ? escape : unescape
|
|
183
|
-
if (components.scheme !== undefined) {
|
|
184
|
-
components.scheme = func(components.scheme)
|
|
185
|
-
}
|
|
186
|
-
if (components.userinfo !== undefined) {
|
|
187
|
-
components.userinfo = func(components.userinfo)
|
|
188
|
-
}
|
|
189
|
-
if (components.host !== undefined) {
|
|
190
|
-
components.host = func(components.host)
|
|
191
|
-
}
|
|
192
|
-
if (components.path !== undefined) {
|
|
193
|
-
components.path = func(components.path)
|
|
194
|
-
}
|
|
195
|
-
if (components.query !== undefined) {
|
|
196
|
-
components.query = func(components.query)
|
|
197
|
-
}
|
|
198
|
-
if (components.fragment !== undefined) {
|
|
199
|
-
components.fragment = func(components.fragment)
|
|
200
|
-
}
|
|
201
|
-
return components
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function recomposeAuthority (components) {
|
|
205
|
-
const uriTokens = []
|
|
206
|
-
|
|
207
|
-
if (components.userinfo !== undefined) {
|
|
208
|
-
uriTokens.push(components.userinfo)
|
|
209
|
-
uriTokens.push('@')
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
if (components.host !== undefined) {
|
|
213
|
-
let host = unescape(components.host)
|
|
214
|
-
const ipV4res = normalizeIPv4(host)
|
|
215
|
-
|
|
216
|
-
if (ipV4res.isIPV4) {
|
|
217
|
-
host = ipV4res.host
|
|
218
|
-
} else {
|
|
219
|
-
const ipV6res = normalizeIPv6(ipV4res.host)
|
|
220
|
-
if (ipV6res.isIPV6 === true) {
|
|
221
|
-
host = `[${ipV6res.escapedHost}]`
|
|
222
|
-
} else {
|
|
223
|
-
host = components.host
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
uriTokens.push(host)
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
if (typeof components.port === 'number' || typeof components.port === 'string') {
|
|
230
|
-
uriTokens.push(':')
|
|
231
|
-
uriTokens.push(String(components.port))
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return uriTokens.length ? uriTokens.join('') : undefined
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
module.exports = {
|
|
238
|
-
recomposeAuthority,
|
|
239
|
-
normalizeComponentEncoding,
|
|
240
|
-
removeDotSegments,
|
|
241
|
-
normalizeIPv4,
|
|
242
|
-
normalizeIPv6,
|
|
243
|
-
stringArrayToHexStripped
|
|
244
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var traverse = module.exports = function (schema, opts, cb) {
|
|
4
|
-
// Legacy support for v0.3.1 and earlier.
|
|
5
|
-
if (typeof opts == 'function') {
|
|
6
|
-
cb = opts;
|
|
7
|
-
opts = {};
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
cb = opts.cb || cb;
|
|
11
|
-
var pre = (typeof cb == 'function') ? cb : cb.pre || function() {};
|
|
12
|
-
var post = cb.post || function() {};
|
|
13
|
-
|
|
14
|
-
_traverse(opts, pre, post, schema, '', schema);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
traverse.keywords = {
|
|
19
|
-
additionalItems: true,
|
|
20
|
-
items: true,
|
|
21
|
-
contains: true,
|
|
22
|
-
additionalProperties: true,
|
|
23
|
-
propertyNames: true,
|
|
24
|
-
not: true
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
traverse.arrayKeywords = {
|
|
28
|
-
items: true,
|
|
29
|
-
allOf: true,
|
|
30
|
-
anyOf: true,
|
|
31
|
-
oneOf: true
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
traverse.propsKeywords = {
|
|
35
|
-
definitions: true,
|
|
36
|
-
properties: true,
|
|
37
|
-
patternProperties: true,
|
|
38
|
-
dependencies: true
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
traverse.skipKeywords = {
|
|
42
|
-
default: true,
|
|
43
|
-
enum: true,
|
|
44
|
-
const: true,
|
|
45
|
-
required: true,
|
|
46
|
-
maximum: true,
|
|
47
|
-
minimum: true,
|
|
48
|
-
exclusiveMaximum: true,
|
|
49
|
-
exclusiveMinimum: true,
|
|
50
|
-
multipleOf: true,
|
|
51
|
-
maxLength: true,
|
|
52
|
-
minLength: true,
|
|
53
|
-
pattern: true,
|
|
54
|
-
format: true,
|
|
55
|
-
maxItems: true,
|
|
56
|
-
minItems: true,
|
|
57
|
-
uniqueItems: true,
|
|
58
|
-
maxProperties: true,
|
|
59
|
-
minProperties: true
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
|
64
|
-
if (schema && typeof schema == 'object' && !Array.isArray(schema)) {
|
|
65
|
-
pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
66
|
-
for (var key in schema) {
|
|
67
|
-
var sch = schema[key];
|
|
68
|
-
if (Array.isArray(sch)) {
|
|
69
|
-
if (key in traverse.arrayKeywords) {
|
|
70
|
-
for (var i=0; i<sch.length; i++)
|
|
71
|
-
_traverse(opts, pre, post, sch[i], jsonPtr + '/' + key + '/' + i, rootSchema, jsonPtr, key, schema, i);
|
|
72
|
-
}
|
|
73
|
-
} else if (key in traverse.propsKeywords) {
|
|
74
|
-
if (sch && typeof sch == 'object') {
|
|
75
|
-
for (var prop in sch)
|
|
76
|
-
_traverse(opts, pre, post, sch[prop], jsonPtr + '/' + key + '/' + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);
|
|
77
|
-
}
|
|
78
|
-
} else if (key in traverse.keywords || (opts.allKeys && !(key in traverse.skipKeywords))) {
|
|
79
|
-
_traverse(opts, pre, post, sch, jsonPtr + '/' + key, rootSchema, jsonPtr, key, schema);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
function escapeJsonPtr(str) {
|
|
88
|
-
return str.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
89
|
-
}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const ANY = Symbol('SemVer ANY')
|
|
4
|
-
// hoisted class for cyclic dependency
|
|
5
|
-
class Comparator {
|
|
6
|
-
static get ANY () {
|
|
7
|
-
return ANY
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
constructor (comp, options) {
|
|
11
|
-
options = parseOptions(options)
|
|
12
|
-
|
|
13
|
-
if (comp instanceof Comparator) {
|
|
14
|
-
if (comp.loose === !!options.loose) {
|
|
15
|
-
return comp
|
|
16
|
-
} else {
|
|
17
|
-
comp = comp.value
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
comp = comp.trim().split(/\s+/).join(' ')
|
|
22
|
-
debug('comparator', comp, options)
|
|
23
|
-
this.options = options
|
|
24
|
-
this.loose = !!options.loose
|
|
25
|
-
this.parse(comp)
|
|
26
|
-
|
|
27
|
-
if (this.semver === ANY) {
|
|
28
|
-
this.value = ''
|
|
29
|
-
} else {
|
|
30
|
-
this.value = this.operator + this.semver.version
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
debug('comp', this)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
parse (comp) {
|
|
37
|
-
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
|
38
|
-
const m = comp.match(r)
|
|
39
|
-
|
|
40
|
-
if (!m) {
|
|
41
|
-
throw new TypeError(`Invalid comparator: ${comp}`)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
this.operator = m[1] !== undefined ? m[1] : ''
|
|
45
|
-
if (this.operator === '=') {
|
|
46
|
-
this.operator = ''
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// if it literally is just '>' or '' then allow anything.
|
|
50
|
-
if (!m[2]) {
|
|
51
|
-
this.semver = ANY
|
|
52
|
-
} else {
|
|
53
|
-
this.semver = new SemVer(m[2], this.options.loose)
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
toString () {
|
|
58
|
-
return this.value
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
test (version) {
|
|
62
|
-
debug('Comparator.test', version, this.options.loose)
|
|
63
|
-
|
|
64
|
-
if (this.semver === ANY || version === ANY) {
|
|
65
|
-
return true
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (typeof version === 'string') {
|
|
69
|
-
try {
|
|
70
|
-
version = new SemVer(version, this.options)
|
|
71
|
-
} catch (er) {
|
|
72
|
-
return false
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return cmp(version, this.operator, this.semver, this.options)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
intersects (comp, options) {
|
|
80
|
-
if (!(comp instanceof Comparator)) {
|
|
81
|
-
throw new TypeError('a Comparator is required')
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (this.operator === '') {
|
|
85
|
-
if (this.value === '') {
|
|
86
|
-
return true
|
|
87
|
-
}
|
|
88
|
-
return new Range(comp.value, options).test(this.value)
|
|
89
|
-
} else if (comp.operator === '') {
|
|
90
|
-
if (comp.value === '') {
|
|
91
|
-
return true
|
|
92
|
-
}
|
|
93
|
-
return new Range(this.value, options).test(comp.semver)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
options = parseOptions(options)
|
|
97
|
-
|
|
98
|
-
// Special cases where nothing can possibly be lower
|
|
99
|
-
if (options.includePrerelease &&
|
|
100
|
-
(this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
|
|
101
|
-
return false
|
|
102
|
-
}
|
|
103
|
-
if (!options.includePrerelease &&
|
|
104
|
-
(this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
|
|
105
|
-
return false
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Same direction increasing (> or >=)
|
|
109
|
-
if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
|
|
110
|
-
return true
|
|
111
|
-
}
|
|
112
|
-
// Same direction decreasing (< or <=)
|
|
113
|
-
if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
|
|
114
|
-
return true
|
|
115
|
-
}
|
|
116
|
-
// same SemVer and both sides are inclusive (<= or >=)
|
|
117
|
-
if (
|
|
118
|
-
(this.semver.version === comp.semver.version) &&
|
|
119
|
-
this.operator.includes('=') && comp.operator.includes('=')) {
|
|
120
|
-
return true
|
|
121
|
-
}
|
|
122
|
-
// opposite directions less than
|
|
123
|
-
if (cmp(this.semver, '<', comp.semver, options) &&
|
|
124
|
-
this.operator.startsWith('>') && comp.operator.startsWith('<')) {
|
|
125
|
-
return true
|
|
126
|
-
}
|
|
127
|
-
// opposite directions greater than
|
|
128
|
-
if (cmp(this.semver, '>', comp.semver, options) &&
|
|
129
|
-
this.operator.startsWith('<') && comp.operator.startsWith('>')) {
|
|
130
|
-
return true
|
|
131
|
-
}
|
|
132
|
-
return false
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
module.exports = Comparator
|
|
137
|
-
|
|
138
|
-
const parseOptions = require('../internal/parse-options.js')
|
|
139
|
-
const { safeRe: re, t } = require('../internal/re.js')
|
|
140
|
-
const cmp = require('../functions/cmp.js')
|
|
141
|
-
const debug = require('../internal/debug.js')
|
|
142
|
-
const SemVer = require('./semver.js')
|
|
143
|
-
const Range = require('./range.js')
|