@vue/compiler-sfc 3.5.15 → 3.5.17

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.5.15
2
+ * @vue/compiler-sfc v3.5.17
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -8039,7 +8039,6 @@ function processRule(id, rule) {
8039
8039
  }
8040
8040
  function rewriteSelector(id, rule, selector, selectorRoot, deep, slotted = false) {
8041
8041
  let node = null;
8042
- let starNode = null;
8043
8042
  let shouldInject = !deep;
8044
8043
  selector.each((n) => {
8045
8044
  if (n.type === "combinator" && (n.value === ">>>" || n.value === "/deep/")) {
@@ -8124,11 +8123,10 @@ function rewriteSelector(id, rule, selector, selectorRoot, deep, slotted = false
8124
8123
  return false;
8125
8124
  }
8126
8125
  }
8127
- starNode = n;
8126
+ if (node) return;
8128
8127
  }
8129
- if (n.type !== "pseudo" && n.type !== "combinator" && n.type !== "universal" || n.type === "pseudo" && (n.value === ":is" || n.value === ":where") && !node) {
8128
+ if (n.type !== "pseudo" && n.type !== "combinator" || n.type === "pseudo" && (n.value === ":is" || n.value === ":where") && !node) {
8130
8129
  node = n;
8131
- starNode = null;
8132
8130
  }
8133
8131
  });
8134
8132
  if (rule.nodes.some((node2) => node2.type === "rule")) {
@@ -8169,18 +8167,6 @@ function rewriteSelector(id, rule, selector, selectorRoot, deep, slotted = false
8169
8167
  quoteMark: `"`
8170
8168
  })
8171
8169
  );
8172
- if (starNode) {
8173
- selector.insertBefore(
8174
- starNode,
8175
- selectorParser.attribute({
8176
- attribute: idToAdd,
8177
- value: idToAdd,
8178
- raws: {},
8179
- quoteMark: `"`
8180
- })
8181
- );
8182
- selector.removeChild(starNode);
8183
- }
8184
8170
  }
8185
8171
  }
8186
8172
  function isSpaceCombinator(node) {
@@ -12430,7 +12416,7 @@ function requireLodash_camelcase () {
12430
12416
  function castSlice(array, start, end) {
12431
12417
  var length = array.length;
12432
12418
  end = end === undefined ? length : end;
12433
- return (false && end >= length) ? array : baseSlice(array, start, end);
12419
+ return (!start && end >= length) ? array : baseSlice(array, start, end);
12434
12420
  }
12435
12421
 
12436
12422
  /**
@@ -19937,289 +19923,250 @@ export default ${defaultVar}`;
19937
19923
  }
19938
19924
  }
19939
19925
 
19940
- var balancedMatch;
19941
- var hasRequiredBalancedMatch;
19942
-
19943
- function requireBalancedMatch () {
19944
- if (hasRequiredBalancedMatch) return balancedMatch;
19945
- hasRequiredBalancedMatch = 1;
19946
- balancedMatch = balanced;
19947
- function balanced(a, b, str) {
19948
- if (a instanceof RegExp) a = maybeMatch(a, str);
19949
- if (b instanceof RegExp) b = maybeMatch(b, str);
19950
-
19951
- var r = range(a, b, str);
19952
-
19953
- return r && {
19954
- start: r[0],
19955
- end: r[1],
19956
- pre: str.slice(0, r[0]),
19957
- body: str.slice(r[0] + a.length, r[1]),
19958
- post: str.slice(r[1] + b.length)
19959
- };
19960
- }
19961
-
19962
- function maybeMatch(reg, str) {
19963
- var m = str.match(reg);
19964
- return m ? m[0] : null;
19965
- }
19966
-
19967
- balanced.range = range;
19968
- function range(a, b, str) {
19969
- var begs, beg, left, right, result;
19970
- var ai = str.indexOf(a);
19971
- var bi = str.indexOf(b, ai + 1);
19972
- var i = ai;
19973
-
19974
- if (ai >= 0 && bi > 0) {
19975
- if(a===b) {
19976
- return [ai, bi];
19977
- }
19978
- begs = [];
19979
- left = str.length;
19980
-
19981
- while (i >= 0 && !result) {
19982
- if (i == ai) {
19983
- begs.push(i);
19984
- ai = str.indexOf(a, i + 1);
19985
- } else if (begs.length == 1) {
19986
- result = [ begs.pop(), bi ];
19987
- } else {
19988
- beg = begs.pop();
19989
- if (beg < left) {
19990
- left = beg;
19991
- right = bi;
19992
- }
19993
-
19994
- bi = str.indexOf(b, i + 1);
19995
- }
19996
-
19997
- i = ai < bi && ai >= 0 ? ai : bi;
19998
- }
19999
-
20000
- if (begs.length) {
20001
- result = [ left, right ];
20002
- }
20003
- }
19926
+ const balanced = (a, b, str) => {
19927
+ const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
19928
+ const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
19929
+ const r = ma !== null && mb != null && range(ma, mb, str);
19930
+ return (r && {
19931
+ start: r[0],
19932
+ end: r[1],
19933
+ pre: str.slice(0, r[0]),
19934
+ body: str.slice(r[0] + ma.length, r[1]),
19935
+ post: str.slice(r[1] + mb.length),
19936
+ });
19937
+ };
19938
+ const maybeMatch = (reg, str) => {
19939
+ const m = str.match(reg);
19940
+ return m ? m[0] : null;
19941
+ };
19942
+ const range = (a, b, str) => {
19943
+ let begs, beg, left, right = undefined, result;
19944
+ let ai = str.indexOf(a);
19945
+ let bi = str.indexOf(b, ai + 1);
19946
+ let i = ai;
19947
+ if (ai >= 0 && bi > 0) {
19948
+ if (a === b) {
19949
+ return [ai, bi];
19950
+ }
19951
+ begs = [];
19952
+ left = str.length;
19953
+ while (i >= 0 && !result) {
19954
+ if (i === ai) {
19955
+ begs.push(i);
19956
+ ai = str.indexOf(a, i + 1);
19957
+ }
19958
+ else if (begs.length === 1) {
19959
+ const r = begs.pop();
19960
+ if (r !== undefined)
19961
+ result = [r, bi];
19962
+ }
19963
+ else {
19964
+ beg = begs.pop();
19965
+ if (beg !== undefined && beg < left) {
19966
+ left = beg;
19967
+ right = bi;
19968
+ }
19969
+ bi = str.indexOf(b, i + 1);
19970
+ }
19971
+ i = ai < bi && ai >= 0 ? ai : bi;
19972
+ }
19973
+ if (begs.length && right !== undefined) {
19974
+ result = [left, right];
19975
+ }
19976
+ }
19977
+ return result;
19978
+ };
20004
19979
 
20005
- return result;
20006
- }
20007
- return balancedMatch;
19980
+ const escSlash = '\0SLASH' + Math.random() + '\0';
19981
+ const escOpen = '\0OPEN' + Math.random() + '\0';
19982
+ const escClose = '\0CLOSE' + Math.random() + '\0';
19983
+ const escComma = '\0COMMA' + Math.random() + '\0';
19984
+ const escPeriod = '\0PERIOD' + Math.random() + '\0';
19985
+ const escSlashPattern = new RegExp(escSlash, 'g');
19986
+ const escOpenPattern = new RegExp(escOpen, 'g');
19987
+ const escClosePattern = new RegExp(escClose, 'g');
19988
+ const escCommaPattern = new RegExp(escComma, 'g');
19989
+ const escPeriodPattern = new RegExp(escPeriod, 'g');
19990
+ const slashPattern = /\\\\/g;
19991
+ const openPattern = /\\{/g;
19992
+ const closePattern = /\\}/g;
19993
+ const commaPattern = /\\,/g;
19994
+ const periodPattern = /\\./g;
19995
+ function numeric(str) {
19996
+ return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
19997
+ }
19998
+ function escapeBraces(str) {
19999
+ return str
20000
+ .replace(slashPattern, escSlash)
20001
+ .replace(openPattern, escOpen)
20002
+ .replace(closePattern, escClose)
20003
+ .replace(commaPattern, escComma)
20004
+ .replace(periodPattern, escPeriod);
20005
+ }
20006
+ function unescapeBraces(str) {
20007
+ return str
20008
+ .replace(escSlashPattern, '\\')
20009
+ .replace(escOpenPattern, '{')
20010
+ .replace(escClosePattern, '}')
20011
+ .replace(escCommaPattern, ',')
20012
+ .replace(escPeriodPattern, '.');
20008
20013
  }
20009
-
20010
- var braceExpansion;
20011
- var hasRequiredBraceExpansion;
20012
-
20013
- function requireBraceExpansion () {
20014
- if (hasRequiredBraceExpansion) return braceExpansion;
20015
- hasRequiredBraceExpansion = 1;
20016
- var balanced = /*@__PURE__*/ requireBalancedMatch();
20017
-
20018
- braceExpansion = expandTop;
20019
-
20020
- var escSlash = '\0SLASH'+Math.random()+'\0';
20021
- var escOpen = '\0OPEN'+Math.random()+'\0';
20022
- var escClose = '\0CLOSE'+Math.random()+'\0';
20023
- var escComma = '\0COMMA'+Math.random()+'\0';
20024
- var escPeriod = '\0PERIOD'+Math.random()+'\0';
20025
-
20026
- function numeric(str) {
20027
- return parseInt(str, 10) == str
20028
- ? parseInt(str, 10)
20029
- : str.charCodeAt(0);
20030
- }
20031
-
20032
- function escapeBraces(str) {
20033
- return str.split('\\\\').join(escSlash)
20034
- .split('\\{').join(escOpen)
20035
- .split('\\}').join(escClose)
20036
- .split('\\,').join(escComma)
20037
- .split('\\.').join(escPeriod);
20038
- }
20039
-
20040
- function unescapeBraces(str) {
20041
- return str.split(escSlash).join('\\')
20042
- .split(escOpen).join('{')
20043
- .split(escClose).join('}')
20044
- .split(escComma).join(',')
20045
- .split(escPeriod).join('.');
20046
- }
20047
-
20048
-
20049
- // Basically just str.split(","), but handling cases
20050
- // where we have nested braced sections, which should be
20051
- // treated as individual members, like {a,{b,c},d}
20052
- function parseCommaParts(str) {
20053
- if (!str)
20054
- return [''];
20055
-
20056
- var parts = [];
20057
- var m = balanced('{', '}', str);
20058
-
20059
- if (!m)
20060
- return str.split(',');
20061
-
20062
- var pre = m.pre;
20063
- var body = m.body;
20064
- var post = m.post;
20065
- var p = pre.split(',');
20066
-
20067
- p[p.length-1] += '{' + body + '}';
20068
- var postParts = parseCommaParts(post);
20069
- if (post.length) {
20070
- p[p.length-1] += postParts.shift();
20071
- p.push.apply(p, postParts);
20072
- }
20073
-
20074
- parts.push.apply(parts, p);
20075
-
20076
- return parts;
20077
- }
20078
-
20079
- function expandTop(str) {
20080
- if (!str)
20081
- return [];
20082
-
20083
- // I don't know why Bash 4.3 does this, but it does.
20084
- // Anything starting with {} will have the first two bytes preserved
20085
- // but *only* at the top level, so {},a}b will not expand to anything,
20086
- // but a{},b}c will be expanded to [a}c,abc].
20087
- // One could argue that this is a bug in Bash, but since the goal of
20088
- // this module is to match Bash's rules, we escape a leading {}
20089
- if (str.substr(0, 2) === '{}') {
20090
- str = '\\{\\}' + str.substr(2);
20091
- }
20092
-
20093
- return expand(escapeBraces(str), true).map(unescapeBraces);
20094
- }
20095
-
20096
- function embrace(str) {
20097
- return '{' + str + '}';
20098
- }
20099
- function isPadded(el) {
20100
- return /^-?0\d/.test(el);
20101
- }
20102
-
20103
- function lte(i, y) {
20104
- return i <= y;
20105
- }
20106
- function gte(i, y) {
20107
- return i >= y;
20108
- }
20109
-
20110
- function expand(str, isTop) {
20111
- var expansions = [];
20112
-
20113
- var m = balanced('{', '}', str);
20114
- if (!m) return [str];
20115
-
20116
- // no need to expand pre, since it is guaranteed to be free of brace-sets
20117
- var pre = m.pre;
20118
- var post = m.post.length
20119
- ? expand(m.post, false)
20120
- : [''];
20121
-
20122
- if (/\$$/.test(m.pre)) {
20123
- for (var k = 0; k < post.length; k++) {
20124
- var expansion = pre+ '{' + m.body + '}' + post[k];
20125
- expansions.push(expansion);
20126
- }
20127
- } else {
20128
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
20129
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
20130
- var isSequence = isNumericSequence || isAlphaSequence;
20131
- var isOptions = m.body.indexOf(',') >= 0;
20132
- if (!isSequence && !isOptions) {
20133
- // {a},b}
20134
- if (m.post.match(/,.*\}/)) {
20135
- str = m.pre + '{' + m.body + escClose + m.post;
20136
- return expand(str);
20137
- }
20138
- return [str];
20139
- }
20140
-
20141
- var n;
20142
- if (isSequence) {
20143
- n = m.body.split(/\.\./);
20144
- } else {
20145
- n = parseCommaParts(m.body);
20146
- if (n.length === 1) {
20147
- // x{{a,b}}y ==> x{a}y x{b}y
20148
- n = expand(n[0], false).map(embrace);
20149
- if (n.length === 1) {
20150
- return post.map(function(p) {
20151
- return m.pre + n[0] + p;
20152
- });
20153
- }
20154
- }
20155
- }
20156
-
20157
- // at this point, n is the parts, and we know it's not a comma set
20158
- // with a single entry.
20159
- var N;
20160
-
20161
- if (isSequence) {
20162
- var x = numeric(n[0]);
20163
- var y = numeric(n[1]);
20164
- var width = Math.max(n[0].length, n[1].length);
20165
- var incr = n.length == 3
20166
- ? Math.abs(numeric(n[2]))
20167
- : 1;
20168
- var test = lte;
20169
- var reverse = y < x;
20170
- if (reverse) {
20171
- incr *= -1;
20172
- test = gte;
20173
- }
20174
- var pad = n.some(isPadded);
20175
-
20176
- N = [];
20177
-
20178
- for (var i = x; test(i, y); i += incr) {
20179
- var c;
20180
- if (isAlphaSequence) {
20181
- c = String.fromCharCode(i);
20182
- if (c === '\\')
20183
- c = '';
20184
- } else {
20185
- c = String(i);
20186
- if (pad) {
20187
- var need = width - c.length;
20188
- if (need > 0) {
20189
- var z = new Array(need + 1).join('0');
20190
- if (i < 0)
20191
- c = '-' + z + c.slice(1);
20192
- else
20193
- c = z + c;
20194
- }
20195
- }
20196
- }
20197
- N.push(c);
20198
- }
20199
- } else {
20200
- N = [];
20201
-
20202
- for (var j = 0; j < n.length; j++) {
20203
- N.push.apply(N, expand(n[j], false));
20204
- }
20205
- }
20206
-
20207
- for (var j = 0; j < N.length; j++) {
20208
- for (var k = 0; k < post.length; k++) {
20209
- var expansion = pre + N[j] + post[k];
20210
- if (!isTop || isSequence || expansion)
20211
- expansions.push(expansion);
20212
- }
20213
- }
20214
- }
20215
-
20216
- return expansions;
20217
- }
20218
- return braceExpansion;
20014
+ /**
20015
+ * Basically just str.split(","), but handling cases
20016
+ * where we have nested braced sections, which should be
20017
+ * treated as individual members, like {a,{b,c},d}
20018
+ */
20019
+ function parseCommaParts(str) {
20020
+ if (!str) {
20021
+ return [''];
20022
+ }
20023
+ const parts = [];
20024
+ const m = balanced('{', '}', str);
20025
+ if (!m) {
20026
+ return str.split(',');
20027
+ }
20028
+ const { pre, body, post } = m;
20029
+ const p = pre.split(',');
20030
+ p[p.length - 1] += '{' + body + '}';
20031
+ const postParts = parseCommaParts(post);
20032
+ if (post.length) {
20033
+ p[p.length - 1] += postParts.shift();
20034
+ p.push.apply(p, postParts);
20035
+ }
20036
+ parts.push.apply(parts, p);
20037
+ return parts;
20038
+ }
20039
+ function expand(str) {
20040
+ if (!str) {
20041
+ return [];
20042
+ }
20043
+ // I don't know why Bash 4.3 does this, but it does.
20044
+ // Anything starting with {} will have the first two bytes preserved
20045
+ // but *only* at the top level, so {},a}b will not expand to anything,
20046
+ // but a{},b}c will be expanded to [a}c,abc].
20047
+ // One could argue that this is a bug in Bash, but since the goal of
20048
+ // this module is to match Bash's rules, we escape a leading {}
20049
+ if (str.slice(0, 2) === '{}') {
20050
+ str = '\\{\\}' + str.slice(2);
20051
+ }
20052
+ return expand_(escapeBraces(str), true).map(unescapeBraces);
20053
+ }
20054
+ function embrace(str) {
20055
+ return '{' + str + '}';
20056
+ }
20057
+ function isPadded(el) {
20058
+ return /^-?0\d/.test(el);
20059
+ }
20060
+ function lte(i, y) {
20061
+ return i <= y;
20062
+ }
20063
+ function gte(i, y) {
20064
+ return i >= y;
20065
+ }
20066
+ function expand_(str, isTop) {
20067
+ /** @type {string[]} */
20068
+ const expansions = [];
20069
+ const m = balanced('{', '}', str);
20070
+ if (!m)
20071
+ return [str];
20072
+ // no need to expand pre, since it is guaranteed to be free of brace-sets
20073
+ const pre = m.pre;
20074
+ const post = m.post.length ? expand_(m.post, false) : [''];
20075
+ if (/\$$/.test(m.pre)) {
20076
+ for (let k = 0; k < post.length; k++) {
20077
+ const expansion = pre + '{' + m.body + '}' + post[k];
20078
+ expansions.push(expansion);
20079
+ }
20080
+ }
20081
+ else {
20082
+ const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
20083
+ const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
20084
+ const isSequence = isNumericSequence || isAlphaSequence;
20085
+ const isOptions = m.body.indexOf(',') >= 0;
20086
+ if (!isSequence && !isOptions) {
20087
+ // {a},b}
20088
+ if (m.post.match(/,(?!,).*\}/)) {
20089
+ str = m.pre + '{' + m.body + escClose + m.post;
20090
+ return expand_(str);
20091
+ }
20092
+ return [str];
20093
+ }
20094
+ let n;
20095
+ if (isSequence) {
20096
+ n = m.body.split(/\.\./);
20097
+ }
20098
+ else {
20099
+ n = parseCommaParts(m.body);
20100
+ if (n.length === 1 && n[0] !== undefined) {
20101
+ // x{{a,b}}y ==> x{a}y x{b}y
20102
+ n = expand_(n[0], false).map(embrace);
20103
+ //XXX is this necessary? Can't seem to hit it in tests.
20104
+ /* c8 ignore start */
20105
+ if (n.length === 1) {
20106
+ return post.map(p => m.pre + n[0] + p);
20107
+ }
20108
+ /* c8 ignore stop */
20109
+ }
20110
+ }
20111
+ // at this point, n is the parts, and we know it's not a comma set
20112
+ // with a single entry.
20113
+ let N;
20114
+ if (isSequence && n[0] !== undefined && n[1] !== undefined) {
20115
+ const x = numeric(n[0]);
20116
+ const y = numeric(n[1]);
20117
+ const width = Math.max(n[0].length, n[1].length);
20118
+ let incr = n.length === 3 && n[2] !== undefined ? Math.abs(numeric(n[2])) : 1;
20119
+ let test = lte;
20120
+ const reverse = y < x;
20121
+ if (reverse) {
20122
+ incr *= -1;
20123
+ test = gte;
20124
+ }
20125
+ const pad = n.some(isPadded);
20126
+ N = [];
20127
+ for (let i = x; test(i, y); i += incr) {
20128
+ let c;
20129
+ if (isAlphaSequence) {
20130
+ c = String.fromCharCode(i);
20131
+ if (c === '\\') {
20132
+ c = '';
20133
+ }
20134
+ }
20135
+ else {
20136
+ c = String(i);
20137
+ if (pad) {
20138
+ const need = width - c.length;
20139
+ if (need > 0) {
20140
+ const z = new Array(need + 1).join('0');
20141
+ if (i < 0) {
20142
+ c = '-' + z + c.slice(1);
20143
+ }
20144
+ else {
20145
+ c = z + c;
20146
+ }
20147
+ }
20148
+ }
20149
+ }
20150
+ N.push(c);
20151
+ }
20152
+ }
20153
+ else {
20154
+ N = [];
20155
+ for (let j = 0; j < n.length; j++) {
20156
+ N.push.apply(N, expand_(n[j], false));
20157
+ }
20158
+ }
20159
+ for (let j = 0; j < N.length; j++) {
20160
+ for (let k = 0; k < post.length; k++) {
20161
+ const expansion = pre + N[j] + post[k];
20162
+ if (!isTop || isSequence || expansion) {
20163
+ expansions.push(expansion);
20164
+ }
20165
+ }
20166
+ }
20167
+ }
20168
+ return expansions;
20219
20169
  }
20220
-
20221
- var braceExpansionExports = /*@__PURE__*/ requireBraceExpansion();
20222
- var expand = /*@__PURE__*/getDefaultExportFromCjs(braceExpansionExports);
20223
20170
 
20224
20171
  const MAX_PATTERN_LENGTH = 1024 * 64;
20225
20172
  const assertValidPattern = (pattern) => {
@@ -20880,7 +20827,7 @@ class AST {
20880
20827
  return [s, unescape(this.toString()), false, false];
20881
20828
  }
20882
20829
  // XXX abstract out this map method
20883
- let bodyDotAllowed = !repeated || allowDot || dot || false
20830
+ let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot
20884
20831
  ? ''
20885
20832
  : this.#partsToRegExp(true);
20886
20833
  if (bodyDotAllowed === body) {
@@ -22340,25 +22287,39 @@ function resolveArrayElementType(ctx, node, scope) {
22340
22287
  scope
22341
22288
  );
22342
22289
  }
22343
- function resolveStringType(ctx, node, scope) {
22290
+ function resolveStringType(ctx, node, scope, typeParameters) {
22344
22291
  switch (node.type) {
22345
22292
  case "StringLiteral":
22346
22293
  return [node.value];
22347
22294
  case "TSLiteralType":
22348
- return resolveStringType(ctx, node.literal, scope);
22295
+ return resolveStringType(ctx, node.literal, scope, typeParameters);
22349
22296
  case "TSUnionType":
22350
- return node.types.map((t) => resolveStringType(ctx, t, scope)).flat();
22297
+ return node.types.map((t) => resolveStringType(ctx, t, scope, typeParameters)).flat();
22351
22298
  case "TemplateLiteral": {
22352
22299
  return resolveTemplateKeys(ctx, node, scope);
22353
22300
  }
22354
22301
  case "TSTypeReference": {
22355
22302
  const resolved = resolveTypeReference(ctx, node, scope);
22356
22303
  if (resolved) {
22357
- return resolveStringType(ctx, resolved, scope);
22304
+ return resolveStringType(ctx, resolved, scope, typeParameters);
22358
22305
  }
22359
22306
  if (node.typeName.type === "Identifier") {
22360
- const getParam = (index = 0) => resolveStringType(ctx, node.typeParameters.params[index], scope);
22361
- switch (node.typeName.name) {
22307
+ const name = node.typeName.name;
22308
+ if (typeParameters && typeParameters[name]) {
22309
+ return resolveStringType(
22310
+ ctx,
22311
+ typeParameters[name],
22312
+ scope,
22313
+ typeParameters
22314
+ );
22315
+ }
22316
+ const getParam = (index = 0) => resolveStringType(
22317
+ ctx,
22318
+ node.typeParameters.params[index],
22319
+ scope,
22320
+ typeParameters
22321
+ );
22322
+ switch (name) {
22362
22323
  case "Extract":
22363
22324
  return getParam(1);
22364
22325
  case "Exclude": {
@@ -22445,7 +22406,8 @@ function resolveBuiltin(ctx, node, name, scope, typeParameters) {
22445
22406
  const picked = resolveStringType(
22446
22407
  ctx,
22447
22408
  node.typeParameters.params[1],
22448
- scope
22409
+ scope,
22410
+ typeParameters
22449
22411
  );
22450
22412
  const res2 = { props: {}, calls: t.calls };
22451
22413
  for (const key of picked) {
@@ -22457,7 +22419,8 @@ function resolveBuiltin(ctx, node, name, scope, typeParameters) {
22457
22419
  const omitted = resolveStringType(
22458
22420
  ctx,
22459
22421
  node.typeParameters.params[1],
22460
- scope
22422
+ scope,
22423
+ typeParameters
22461
22424
  );
22462
22425
  const res = { props: {}, calls: t.calls };
22463
22426
  for (const key in t.props) {
@@ -23108,13 +23071,8 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
23108
23071
  case "TSTypeReference": {
23109
23072
  const resolved = resolveTypeReference(ctx, node, scope);
23110
23073
  if (resolved) {
23111
- if (resolved.type === "TSTypeAliasDeclaration") {
23112
- return inferRuntimeType(
23113
- ctx,
23114
- resolved.typeAnnotation,
23115
- resolved._ownerScope,
23116
- isKeyOf
23117
- );
23074
+ if (resolved.type === "TSTypeAliasDeclaration" && resolved.typeAnnotation.type === "TSFunctionType") {
23075
+ return ["Function"];
23118
23076
  }
23119
23077
  return inferRuntimeType(ctx, resolved, resolved._ownerScope, isKeyOf);
23120
23078
  }
@@ -23430,12 +23388,6 @@ function processDefineModel(ctx, node, declId) {
23430
23388
  if (!isCallOf(node, DEFINE_MODEL)) {
23431
23389
  return false;
23432
23390
  }
23433
- if (!declId) {
23434
- ctx.error(
23435
- "defineModel() must be assigned to a variable. For example: const model = defineModel()",
23436
- node
23437
- );
23438
- }
23439
23391
  ctx.hasDefineModelCall = true;
23440
23392
  const type = node.typeParameters && node.typeParameters.params[0] || void 0;
23441
23393
  let modelName;
@@ -25022,7 +24974,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
25022
24974
  return generator.toJSON();
25023
24975
  }
25024
24976
 
25025
- const version = "3.5.15";
24977
+ const version = "3.5.17";
25026
24978
  const parseCache = parseCache$1;
25027
24979
  const errorMessages = {
25028
24980
  ...CompilerDOM.errorMessages,