html-validate-vue 4.2.0 → 4.2.3

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/index.js CHANGED
@@ -21,21 +21,18 @@ var __spreadValues = (a, b) => {
21
21
  return a;
22
22
  };
23
23
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
25
24
  var __commonJS = (cb, mod) => function __require() {
26
25
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
27
26
  };
28
- var __reExport = (target, module2, copyDefault, desc) => {
29
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
30
- for (let key of __getOwnPropNames(module2))
31
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
32
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
27
+ var __copyProps = (to, from, except, desc) => {
28
+ if (from && typeof from === "object" || typeof from === "function") {
29
+ for (let key of __getOwnPropNames(from))
30
+ if (!__hasOwnProp.call(to, key) && key !== except)
31
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
33
32
  }
34
- return target;
35
- };
36
- var __toESM = (module2, isNodeMode) => {
37
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
33
+ return to;
38
34
  };
35
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
39
36
 
40
37
  // node_modules/semver/internal/constants.js
41
38
  var require_constants = __commonJS({
@@ -74,7 +71,7 @@ var require_re = __commonJS({
74
71
  var R = 0;
75
72
  var createToken = (name, value, isGlobal) => {
76
73
  const index = R++;
77
- debug(index, value);
74
+ debug(name, index, value);
78
75
  t[name] = index;
79
76
  src[index] = value;
80
77
  re[index] = new RegExp(value, isGlobal ? "g" : void 0);
@@ -120,8 +117,8 @@ var require_re = __commonJS({
120
117
  createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
121
118
  createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
122
119
  createToken("STAR", "(<|>)?=?\\s*\\*");
123
- createToken("GTE0", "^\\s*>=\\s*0.0.0\\s*$");
124
- createToken("GTE0PRE", "^\\s*>=\\s*0.0.0-0\\s*$");
120
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
121
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
125
122
  }
126
123
  });
127
124
 
@@ -129,9 +126,9 @@ var require_re = __commonJS({
129
126
  var require_parse_options = __commonJS({
130
127
  "node_modules/semver/internal/parse-options.js"(exports2, module2) {
131
128
  var opts = ["includePrerelease", "loose", "rtl"];
132
- var parseOptions = (options) => !options ? {} : typeof options !== "object" ? { loose: true } : opts.filter((k) => options[k]).reduce((options2, k) => {
133
- options2[k] = true;
134
- return options2;
129
+ var parseOptions = (options) => !options ? {} : typeof options !== "object" ? { loose: true } : opts.filter((k) => options[k]).reduce((o, k) => {
130
+ o[k] = true;
131
+ return o;
135
132
  }, {});
136
133
  module2.exports = parseOptions;
137
134
  }
@@ -361,7 +358,7 @@ var require_semver = __commonJS({
361
358
  }
362
359
  }
363
360
  if (identifier) {
364
- if (this.prerelease[0] === identifier) {
361
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
365
362
  if (isNaN(this.prerelease[1])) {
366
363
  this.prerelease = [identifier, 0];
367
364
  }
@@ -448,7 +445,7 @@ var require_inc = __commonJS({
448
445
  options = void 0;
449
446
  }
450
447
  try {
451
- return new SemVer(version, options).inc(release, identifier).version;
448
+ return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier).version;
452
449
  } catch (er) {
453
450
  return null;
454
451
  }
@@ -648,16 +645,20 @@ var require_cmp = __commonJS({
648
645
  var cmp = (a, op, b, loose) => {
649
646
  switch (op) {
650
647
  case "===":
651
- if (typeof a === "object")
648
+ if (typeof a === "object") {
652
649
  a = a.version;
653
- if (typeof b === "object")
650
+ }
651
+ if (typeof b === "object") {
654
652
  b = b.version;
653
+ }
655
654
  return a === b;
656
655
  case "!==":
657
- if (typeof a === "object")
656
+ if (typeof a === "object") {
658
657
  a = a.version;
659
- if (typeof b === "object")
658
+ }
659
+ if (typeof b === "object") {
660
660
  b = b.version;
661
+ }
661
662
  return a !== b;
662
663
  case "":
663
664
  case "=":
@@ -711,8 +712,9 @@ var require_coerce = __commonJS({
711
712
  }
712
713
  re[t.COERCERTL].lastIndex = -1;
713
714
  }
714
- if (match === null)
715
+ if (match === null) {
715
716
  return null;
717
+ }
716
718
  return parse(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
717
719
  };
718
720
  module2.exports = coerce;
@@ -1393,16 +1395,16 @@ var require_range = __commonJS({
1393
1395
  this.loose = !!options.loose;
1394
1396
  this.includePrerelease = !!options.includePrerelease;
1395
1397
  this.raw = range;
1396
- this.set = range.split(/\s*\|\|\s*/).map((range2) => this.parseRange(range2.trim())).filter((c) => c.length);
1398
+ this.set = range.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
1397
1399
  if (!this.set.length) {
1398
1400
  throw new TypeError(`Invalid SemVer Range: ${range}`);
1399
1401
  }
1400
1402
  if (this.set.length > 1) {
1401
1403
  const first = this.set[0];
1402
1404
  this.set = this.set.filter((c) => !isNullSet(c[0]));
1403
- if (this.set.length === 0)
1405
+ if (this.set.length === 0) {
1404
1406
  this.set = [first];
1405
- else if (this.set.length > 1) {
1407
+ } else if (this.set.length > 1) {
1406
1408
  for (const c of this.set) {
1407
1409
  if (c.length === 1 && isAny(c[0])) {
1408
1410
  this.set = [c];
@@ -1427,28 +1429,37 @@ var require_range = __commonJS({
1427
1429
  const memoOpts = Object.keys(this.options).join(",");
1428
1430
  const memoKey = `parseRange:${memoOpts}:${range}`;
1429
1431
  const cached = cache.get(memoKey);
1430
- if (cached)
1432
+ if (cached) {
1431
1433
  return cached;
1434
+ }
1432
1435
  const loose = this.options.loose;
1433
1436
  const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
1434
1437
  range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
1435
1438
  debug("hyphen replace", range);
1436
1439
  range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
1437
- debug("comparator trim", range, re[t.COMPARATORTRIM]);
1440
+ debug("comparator trim", range);
1438
1441
  range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
1439
1442
  range = range.replace(re[t.CARETTRIM], caretTrimReplace);
1440
1443
  range = range.split(/\s+/).join(" ");
1441
- const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
1442
- const rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options)).filter(this.options.loose ? (comp) => !!comp.match(compRe) : () => true).map((comp) => new Comparator(comp, this.options));
1443
- const l = rangeList.length;
1444
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
1445
+ if (loose) {
1446
+ rangeList = rangeList.filter((comp) => {
1447
+ debug("loose invalid filter", comp, this.options);
1448
+ return !!comp.match(re[t.COMPARATORLOOSE]);
1449
+ });
1450
+ }
1451
+ debug("range list", rangeList);
1444
1452
  const rangeMap = /* @__PURE__ */ new Map();
1445
- for (const comp of rangeList) {
1446
- if (isNullSet(comp))
1453
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
1454
+ for (const comp of comparators) {
1455
+ if (isNullSet(comp)) {
1447
1456
  return [comp];
1457
+ }
1448
1458
  rangeMap.set(comp.value, comp);
1449
1459
  }
1450
- if (rangeMap.size > 1 && rangeMap.has(""))
1460
+ if (rangeMap.size > 1 && rangeMap.has("")) {
1451
1461
  rangeMap.delete("");
1462
+ }
1452
1463
  const result = [...rangeMap.values()];
1453
1464
  cache.set(memoKey, result);
1454
1465
  return result;
@@ -1527,8 +1538,8 @@ var require_range = __commonJS({
1527
1538
  return comp;
1528
1539
  };
1529
1540
  var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
1530
- var replaceTildes = (comp, options) => comp.trim().split(/\s+/).map((comp2) => {
1531
- return replaceTilde(comp2, options);
1541
+ var replaceTildes = (comp, options) => comp.trim().split(/\s+/).map((c) => {
1542
+ return replaceTilde(c, options);
1532
1543
  }).join(" ");
1533
1544
  var replaceTilde = (comp, options) => {
1534
1545
  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
@@ -1551,8 +1562,8 @@ var require_range = __commonJS({
1551
1562
  return ret;
1552
1563
  });
1553
1564
  };
1554
- var replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((comp2) => {
1555
- return replaceCaret(comp2, options);
1565
+ var replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((c) => {
1566
+ return replaceCaret(c, options);
1556
1567
  }).join(" ");
1557
1568
  var replaceCaret = (comp, options) => {
1558
1569
  debug("caret", comp, options);
@@ -1600,8 +1611,8 @@ var require_range = __commonJS({
1600
1611
  };
1601
1612
  var replaceXRanges = (comp, options) => {
1602
1613
  debug("replaceXRanges", comp, options);
1603
- return comp.split(/\s+/).map((comp2) => {
1604
- return replaceXRange(comp2, options);
1614
+ return comp.split(/\s+/).map((c) => {
1615
+ return replaceXRange(c, options);
1605
1616
  }).join(" ");
1606
1617
  };
1607
1618
  var replaceXRange = (comp, options) => {
@@ -1646,8 +1657,9 @@ var require_range = __commonJS({
1646
1657
  m = +m + 1;
1647
1658
  }
1648
1659
  }
1649
- if (gtlt === "<")
1660
+ if (gtlt === "<") {
1650
1661
  pr = "-0";
1662
+ }
1651
1663
  ret = `${gtlt + M}.${m}.${p}${pr}`;
1652
1664
  } else if (xm) {
1653
1665
  ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
@@ -1944,8 +1956,9 @@ var require_min_version = __commonJS({
1944
1956
  throw new Error(`Unexpected operation: ${comparator.operator}`);
1945
1957
  }
1946
1958
  });
1947
- if (setMin && (!minver || gt(minver, setMin)))
1959
+ if (setMin && (!minver || gt(minver, setMin))) {
1948
1960
  minver = setMin;
1961
+ }
1949
1962
  }
1950
1963
  if (minver && range.test(minver)) {
1951
1964
  return minver;
@@ -2077,37 +2090,40 @@ var require_simplify = __commonJS({
2077
2090
  var compare = require_compare();
2078
2091
  module2.exports = (versions, range, options) => {
2079
2092
  const set = [];
2080
- let min = null;
2093
+ let first = null;
2081
2094
  let prev = null;
2082
2095
  const v = versions.sort((a, b) => compare(a, b, options));
2083
2096
  for (const version of v) {
2084
2097
  const included = satisfies2(version, range, options);
2085
2098
  if (included) {
2086
2099
  prev = version;
2087
- if (!min)
2088
- min = version;
2100
+ if (!first) {
2101
+ first = version;
2102
+ }
2089
2103
  } else {
2090
2104
  if (prev) {
2091
- set.push([min, prev]);
2105
+ set.push([first, prev]);
2092
2106
  }
2093
2107
  prev = null;
2094
- min = null;
2108
+ first = null;
2095
2109
  }
2096
2110
  }
2097
- if (min)
2098
- set.push([min, null]);
2111
+ if (first) {
2112
+ set.push([first, null]);
2113
+ }
2099
2114
  const ranges = [];
2100
- for (const [min2, max] of set) {
2101
- if (min2 === max)
2102
- ranges.push(min2);
2103
- else if (!max && min2 === v[0])
2115
+ for (const [min, max] of set) {
2116
+ if (min === max) {
2117
+ ranges.push(min);
2118
+ } else if (!max && min === v[0]) {
2104
2119
  ranges.push("*");
2105
- else if (!max)
2106
- ranges.push(`>=${min2}`);
2107
- else if (min2 === v[0])
2120
+ } else if (!max) {
2121
+ ranges.push(`>=${min}`);
2122
+ } else if (min === v[0]) {
2108
2123
  ranges.push(`<=${max}`);
2109
- else
2110
- ranges.push(`${min2} - ${max}`);
2124
+ } else {
2125
+ ranges.push(`${min} - ${max}`);
2126
+ }
2111
2127
  }
2112
2128
  const simplified = ranges.join(" || ");
2113
2129
  const original = typeof range.raw === "string" ? range.raw : String(range);
@@ -2125,8 +2141,9 @@ var require_subset = __commonJS({
2125
2141
  var satisfies2 = require_satisfies();
2126
2142
  var compare = require_compare();
2127
2143
  var subset = (sub, dom, options = {}) => {
2128
- if (sub === dom)
2144
+ if (sub === dom) {
2129
2145
  return true;
2146
+ }
2130
2147
  sub = new Range(sub, options);
2131
2148
  dom = new Range(dom, options);
2132
2149
  let sawNonNull = false;
@@ -2135,59 +2152,70 @@ var require_subset = __commonJS({
2135
2152
  for (const simpleDom of dom.set) {
2136
2153
  const isSub = simpleSubset(simpleSub, simpleDom, options);
2137
2154
  sawNonNull = sawNonNull || isSub !== null;
2138
- if (isSub)
2155
+ if (isSub) {
2139
2156
  continue OUTER;
2157
+ }
2140
2158
  }
2141
- if (sawNonNull)
2159
+ if (sawNonNull) {
2142
2160
  return false;
2161
+ }
2143
2162
  }
2144
2163
  return true;
2145
2164
  };
2146
2165
  var simpleSubset = (sub, dom, options) => {
2147
- if (sub === dom)
2166
+ if (sub === dom) {
2148
2167
  return true;
2168
+ }
2149
2169
  if (sub.length === 1 && sub[0].semver === ANY) {
2150
- if (dom.length === 1 && dom[0].semver === ANY)
2170
+ if (dom.length === 1 && dom[0].semver === ANY) {
2151
2171
  return true;
2152
- else if (options.includePrerelease)
2172
+ } else if (options.includePrerelease) {
2153
2173
  sub = [new Comparator(">=0.0.0-0")];
2154
- else
2174
+ } else {
2155
2175
  sub = [new Comparator(">=0.0.0")];
2176
+ }
2156
2177
  }
2157
2178
  if (dom.length === 1 && dom[0].semver === ANY) {
2158
- if (options.includePrerelease)
2179
+ if (options.includePrerelease) {
2159
2180
  return true;
2160
- else
2181
+ } else {
2161
2182
  dom = [new Comparator(">=0.0.0")];
2183
+ }
2162
2184
  }
2163
2185
  const eqSet = /* @__PURE__ */ new Set();
2164
2186
  let gt, lt;
2165
2187
  for (const c of sub) {
2166
- if (c.operator === ">" || c.operator === ">=")
2188
+ if (c.operator === ">" || c.operator === ">=") {
2167
2189
  gt = higherGT(gt, c, options);
2168
- else if (c.operator === "<" || c.operator === "<=")
2190
+ } else if (c.operator === "<" || c.operator === "<=") {
2169
2191
  lt = lowerLT(lt, c, options);
2170
- else
2192
+ } else {
2171
2193
  eqSet.add(c.semver);
2194
+ }
2172
2195
  }
2173
- if (eqSet.size > 1)
2196
+ if (eqSet.size > 1) {
2174
2197
  return null;
2198
+ }
2175
2199
  let gtltComp;
2176
2200
  if (gt && lt) {
2177
2201
  gtltComp = compare(gt.semver, lt.semver, options);
2178
- if (gtltComp > 0)
2202
+ if (gtltComp > 0) {
2179
2203
  return null;
2180
- else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<="))
2204
+ } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
2181
2205
  return null;
2206
+ }
2182
2207
  }
2183
2208
  for (const eq of eqSet) {
2184
- if (gt && !satisfies2(eq, String(gt), options))
2209
+ if (gt && !satisfies2(eq, String(gt), options)) {
2185
2210
  return null;
2186
- if (lt && !satisfies2(eq, String(lt), options))
2211
+ }
2212
+ if (lt && !satisfies2(eq, String(lt), options)) {
2187
2213
  return null;
2214
+ }
2188
2215
  for (const c of dom) {
2189
- if (!satisfies2(eq, String(c), options))
2216
+ if (!satisfies2(eq, String(c), options)) {
2190
2217
  return false;
2218
+ }
2191
2219
  }
2192
2220
  return true;
2193
2221
  }
@@ -2209,10 +2237,12 @@ var require_subset = __commonJS({
2209
2237
  }
2210
2238
  if (c.operator === ">" || c.operator === ">=") {
2211
2239
  higher = higherGT(gt, c, options);
2212
- if (higher === c && higher !== gt)
2240
+ if (higher === c && higher !== gt) {
2213
2241
  return false;
2214
- } else if (gt.operator === ">=" && !satisfies2(gt.semver, String(c), options))
2242
+ }
2243
+ } else if (gt.operator === ">=" && !satisfies2(gt.semver, String(c), options)) {
2215
2244
  return false;
2245
+ }
2216
2246
  }
2217
2247
  if (lt) {
2218
2248
  if (needDomLTPre) {
@@ -2222,31 +2252,39 @@ var require_subset = __commonJS({
2222
2252
  }
2223
2253
  if (c.operator === "<" || c.operator === "<=") {
2224
2254
  lower = lowerLT(lt, c, options);
2225
- if (lower === c && lower !== lt)
2255
+ if (lower === c && lower !== lt) {
2226
2256
  return false;
2227
- } else if (lt.operator === "<=" && !satisfies2(lt.semver, String(c), options))
2257
+ }
2258
+ } else if (lt.operator === "<=" && !satisfies2(lt.semver, String(c), options)) {
2228
2259
  return false;
2260
+ }
2229
2261
  }
2230
- if (!c.operator && (lt || gt) && gtltComp !== 0)
2262
+ if (!c.operator && (lt || gt) && gtltComp !== 0) {
2231
2263
  return false;
2264
+ }
2232
2265
  }
2233
- if (gt && hasDomLT && !lt && gtltComp !== 0)
2266
+ if (gt && hasDomLT && !lt && gtltComp !== 0) {
2234
2267
  return false;
2235
- if (lt && hasDomGT && !gt && gtltComp !== 0)
2268
+ }
2269
+ if (lt && hasDomGT && !gt && gtltComp !== 0) {
2236
2270
  return false;
2237
- if (needDomGTPre || needDomLTPre)
2271
+ }
2272
+ if (needDomGTPre || needDomLTPre) {
2238
2273
  return false;
2274
+ }
2239
2275
  return true;
2240
2276
  };
2241
2277
  var higherGT = (a, b, options) => {
2242
- if (!a)
2278
+ if (!a) {
2243
2279
  return b;
2280
+ }
2244
2281
  const comp = compare(a.semver, b.semver, options);
2245
2282
  return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
2246
2283
  };
2247
2284
  var lowerLT = (a, b, options) => {
2248
- if (!a)
2285
+ if (!a) {
2249
2286
  return b;
2287
+ }
2250
2288
  const comp = compare(a.semver, b.semver, options);
2251
2289
  return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
2252
2290
  };
@@ -2440,6 +2478,31 @@ var AvailableSlots = class extends import_html_validate2.Rule {
2440
2478
  // src/rules/prefer-slot-shorthand.ts
2441
2479
  var import_html_validate3 = require("html-validate");
2442
2480
  var prefix = "v-slot:";
2481
+ function isVSlot(attr) {
2482
+ if (!attr.startsWith(prefix)) {
2483
+ return null;
2484
+ }
2485
+ if (attr.length <= prefix.length) {
2486
+ return null;
2487
+ }
2488
+ const slot = attr.slice(prefix.length);
2489
+ if (slot.match(/^\[.*\]$/)) {
2490
+ return null;
2491
+ }
2492
+ return slot;
2493
+ }
2494
+ function isDeprecatedSlot(attr, value) {
2495
+ if (attr !== "slot") {
2496
+ return null;
2497
+ }
2498
+ if (value instanceof import_html_validate3.DynamicValue) {
2499
+ return null;
2500
+ }
2501
+ if (value === null || value === "") {
2502
+ return null;
2503
+ }
2504
+ return value.toString();
2505
+ }
2443
2506
  var PreferSlotShorthand = class extends import_html_validate3.Rule {
2444
2507
  documentation(context) {
2445
2508
  var _a;
@@ -2455,16 +2518,15 @@ var PreferSlotShorthand = class extends import_html_validate3.Rule {
2455
2518
  setup() {
2456
2519
  this.on("attr", (event) => {
2457
2520
  const { key: attr, value, target, keyLocation: location } = event;
2458
- if (attr.startsWith(prefix) && attr.length > prefix.length) {
2459
- const slot = attr.slice(prefix.length);
2521
+ let slot;
2522
+ if (slot = isVSlot(attr)) {
2460
2523
  const context = { slot };
2461
2524
  const message = `Prefer to use #${slot} over ${attr}`;
2462
2525
  this.report(target, message, location, context);
2463
2526
  }
2464
- if (attr === "slot" && value !== null && value !== "") {
2465
- const slot = value.toString();
2527
+ if (slot = isDeprecatedSlot(attr, value)) {
2466
2528
  const context = { slot };
2467
- const message = `Prefer to use #${slot} over ${attr}="${value}"`;
2529
+ const message = `Prefer to use #${slot} over ${attr}="${value.toString()}"`;
2468
2530
  this.report(target, message, location, context);
2469
2531
  }
2470
2532
  });