@vue/compiler-sfc 3.5.29 → 3.5.31

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.29
2
+ * @vue/compiler-sfc v3.5.31
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -2082,7 +2082,7 @@ function dedent(s) {
2082
2082
 
2083
2083
  function isRelativeUrl(url) {
2084
2084
  const firstChar = url.charAt(0);
2085
- return firstChar === "." || firstChar === "~" || firstChar === "@";
2085
+ return firstChar === "." || firstChar === "~" || firstChar === "@" || firstChar === "#";
2086
2086
  }
2087
2087
  const externalRE = /^(?:https?:)?\/\//;
2088
2088
  function isExternalUrl(url) {
@@ -2092,6 +2092,13 @@ const dataUrlRE = /^\s*data:/i;
2092
2092
  function isDataUrl(url) {
2093
2093
  return dataUrlRE.test(url);
2094
2094
  }
2095
+ function normalizeDecodedImportPath(source) {
2096
+ try {
2097
+ return decodeURIComponent(source);
2098
+ } catch {
2099
+ return source;
2100
+ }
2101
+ }
2095
2102
  function parseUrl(url) {
2096
2103
  const firstChar = url.charAt(0);
2097
2104
  if (firstChar === "~") {
@@ -2104,14 +2111,17 @@ function parseUriParts(urlString) {
2104
2111
  return url.parse(shared.isString(urlString) ? urlString : "", false, true);
2105
2112
  }
2106
2113
 
2114
+ const resourceUrlTagConfig = {
2115
+ video: ["src", "poster"],
2116
+ source: ["src"],
2117
+ img: ["src"],
2118
+ image: ["xlink:href", "href"]
2119
+ };
2107
2120
  const defaultAssetUrlOptions = {
2108
2121
  base: null,
2109
2122
  includeAbsolute: false,
2110
2123
  tags: {
2111
- video: ["src", "poster"],
2112
- source: ["src"],
2113
- img: ["src"],
2114
- image: ["xlink:href", "href"],
2124
+ ...resourceUrlTagConfig,
2115
2125
  use: ["xlink:href", "href"]
2116
2126
  }
2117
2127
  };
@@ -2130,6 +2140,10 @@ const normalizeOptions = (options) => {
2130
2140
  const createAssetUrlTransformWithOptions = (options) => {
2131
2141
  return (node, context) => transformAssetUrl(node, context, options);
2132
2142
  };
2143
+ function canTransformHashImport(tag, attrName) {
2144
+ var _a;
2145
+ return !!((_a = resourceUrlTagConfig[tag]) == null ? void 0 : _a.includes(attrName));
2146
+ }
2133
2147
  const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
2134
2148
  if (node.type === 1) {
2135
2149
  if (!node.props.length) {
@@ -2143,11 +2157,16 @@ const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
2143
2157
  }
2144
2158
  const assetAttrs = (attrs || []).concat(wildCardAttrs || []);
2145
2159
  node.props.forEach((attr, index) => {
2146
- if (attr.type !== 6 || !assetAttrs.includes(attr.name) || !attr.value || isExternalUrl(attr.value.content) || isDataUrl(attr.value.content) || attr.value.content[0] === "#" || !options.includeAbsolute && !isRelativeUrl(attr.value.content)) {
2160
+ if (attr.type !== 6 || !assetAttrs.includes(attr.name) || !attr.value) {
2161
+ return;
2162
+ }
2163
+ const urlValue = attr.value.content;
2164
+ const isHashOnlyValue = urlValue[0] === "#";
2165
+ if (isExternalUrl(urlValue) || isDataUrl(urlValue) || isHashOnlyValue && !canTransformHashImport(node.tag, attr.name) || !options.includeAbsolute && !isRelativeUrl(urlValue)) {
2147
2166
  return;
2148
2167
  }
2149
- const url = parseUrl(attr.value.content);
2150
- if (options.base && attr.value.content[0] === ".") {
2168
+ const url = parseUrl(urlValue);
2169
+ if (options.base && urlValue[0] === ".") {
2151
2170
  const base = parseUrl(options.base);
2152
2171
  const protocol = base.protocol || "";
2153
2172
  const host = base.host ? protocol + "//" + base.host : "";
@@ -2167,55 +2186,65 @@ const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
2167
2186
  });
2168
2187
  }
2169
2188
  };
2189
+ function resolveOrRegisterImport(source, loc, context) {
2190
+ const normalizedSource = normalizeDecodedImportPath(source);
2191
+ const existingIndex = context.imports.findIndex(
2192
+ (i) => i.path === normalizedSource
2193
+ );
2194
+ if (existingIndex > -1) {
2195
+ return {
2196
+ name: `_imports_${existingIndex}`,
2197
+ exp: context.imports[existingIndex].exp
2198
+ };
2199
+ }
2200
+ const name = `_imports_${context.imports.length}`;
2201
+ const exp = compilerCore.createSimpleExpression(
2202
+ name,
2203
+ false,
2204
+ loc,
2205
+ 3
2206
+ );
2207
+ context.imports.push({
2208
+ exp,
2209
+ path: normalizedSource
2210
+ });
2211
+ return { name, exp };
2212
+ }
2170
2213
  function getImportsExpressionExp(path2, hash, loc, context) {
2171
- if (path2) {
2172
- let name;
2173
- let exp;
2174
- const existingIndex = context.imports.findIndex((i) => i.path === path2);
2175
- if (existingIndex > -1) {
2176
- name = `_imports_${existingIndex}`;
2177
- exp = context.imports[existingIndex].exp;
2178
- } else {
2179
- name = `_imports_${context.imports.length}`;
2180
- exp = compilerCore.createSimpleExpression(
2181
- name,
2182
- false,
2183
- loc,
2184
- 3
2185
- );
2186
- context.imports.push({
2187
- exp,
2188
- path: decodeURIComponent(path2)
2189
- });
2190
- }
2191
- if (!hash) {
2192
- return exp;
2193
- }
2194
- const hashExp = `${name} + '${hash}'`;
2195
- const finalExp = compilerCore.createSimpleExpression(
2196
- hashExp,
2214
+ if (!path2 && !hash) {
2215
+ return compilerCore.createSimpleExpression(`''`, false, loc, 3);
2216
+ }
2217
+ if (!path2 && hash) {
2218
+ const { exp } = resolveOrRegisterImport(hash, loc, context);
2219
+ return exp;
2220
+ }
2221
+ if (path2 && !hash) {
2222
+ const { exp } = resolveOrRegisterImport(path2, loc, context);
2223
+ return exp;
2224
+ }
2225
+ const { name } = resolveOrRegisterImport(path2, loc, context);
2226
+ const hashExp = `${name} + '${hash}'`;
2227
+ const finalExp = compilerCore.createSimpleExpression(
2228
+ hashExp,
2229
+ false,
2230
+ loc,
2231
+ 3
2232
+ );
2233
+ if (!context.hoistStatic) {
2234
+ return finalExp;
2235
+ }
2236
+ const existingHoistIndex = context.hoists.findIndex((h) => {
2237
+ return h && h.type === 4 && !h.isStatic && h.content === hashExp;
2238
+ });
2239
+ if (existingHoistIndex > -1) {
2240
+ return compilerCore.createSimpleExpression(
2241
+ `_hoisted_${existingHoistIndex + 1}`,
2197
2242
  false,
2198
2243
  loc,
2199
2244
  3
2200
2245
  );
2201
- if (!context.hoistStatic) {
2202
- return finalExp;
2203
- }
2204
- const existingHoistIndex = context.hoists.findIndex((h) => {
2205
- return h && h.type === 4 && !h.isStatic && h.content === hashExp;
2206
- });
2207
- if (existingHoistIndex > -1) {
2208
- return compilerCore.createSimpleExpression(
2209
- `_hoisted_${existingHoistIndex + 1}`,
2210
- false,
2211
- loc,
2212
- 3
2213
- );
2214
- }
2215
- return context.hoist(finalExp);
2216
- } else {
2217
- return compilerCore.createSimpleExpression(`''`, false, loc, 3);
2218
2246
  }
2247
+ return context.hoist(finalExp);
2219
2248
  }
2220
2249
 
2221
2250
  const srcsetTags = ["img", "source"];
@@ -2272,12 +2301,14 @@ const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
2272
2301
  const compoundExpression = compilerCore.createCompoundExpression([], attr.loc);
2273
2302
  imageCandidates.forEach(({ url, descriptor }, index2) => {
2274
2303
  if (shouldProcessUrl(url)) {
2275
- const { path: path2 } = parseUrl(url);
2276
- let exp2;
2277
- if (path2) {
2304
+ const { path: path2, hash } = parseUrl(url);
2305
+ const source = path2 ? path2 : hash;
2306
+ if (source) {
2307
+ const normalizedSource = normalizeDecodedImportPath(source);
2278
2308
  const existingImportsIndex = context.imports.findIndex(
2279
- (i) => i.path === path2
2309
+ (i) => i.path === normalizedSource
2280
2310
  );
2311
+ let exp2;
2281
2312
  if (existingImportsIndex > -1) {
2282
2313
  exp2 = compilerCore.createSimpleExpression(
2283
2314
  `_imports_${existingImportsIndex}`,
@@ -2292,7 +2323,15 @@ const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
2292
2323
  attr.loc,
2293
2324
  3
2294
2325
  );
2295
- context.imports.push({ exp: exp2, path: path2 });
2326
+ context.imports.push({ exp: exp2, path: normalizedSource });
2327
+ }
2328
+ if (path2 && hash) {
2329
+ exp2 = compilerCore.createSimpleExpression(
2330
+ `${exp2.content} + '${hash}'`,
2331
+ false,
2332
+ attr.loc,
2333
+ 3
2334
+ );
2296
2335
  }
2297
2336
  compoundExpression.children.push(exp2);
2298
2337
  }
@@ -19708,7 +19747,7 @@ function getObjectOrArrayExpressionKeys(value) {
19708
19747
  return [];
19709
19748
  }
19710
19749
 
19711
- var _a, _b;
19750
+ var _a$1, _b;
19712
19751
  class ScriptCompileContext {
19713
19752
  constructor(descriptor, options) {
19714
19753
  this.descriptor = descriptor;
@@ -19717,7 +19756,7 @@ class ScriptCompileContext {
19717
19756
  this.source = this.descriptor.source;
19718
19757
  this.filename = this.descriptor.filename;
19719
19758
  this.s = new MagicString(this.source);
19720
- this.startOffset = (_a = this.descriptor.scriptSetup) == null ? void 0 : _a.loc.start.offset;
19759
+ this.startOffset = (_a$1 = this.descriptor.scriptSetup) == null ? void 0 : _a$1.loc.start.offset;
19721
19760
  this.endOffset = (_b = this.descriptor.scriptSetup) == null ? void 0 : _b.loc.end.offset;
19722
19761
  this.userImports = /* @__PURE__ */ Object.create(null);
19723
19762
  // macros presence check
@@ -20024,7 +20063,7 @@ const slashPattern = /\\\\/g;
20024
20063
  const openPattern = /\\{/g;
20025
20064
  const closePattern = /\\}/g;
20026
20065
  const commaPattern = /\\,/g;
20027
- const periodPattern = /\\./g;
20066
+ const periodPattern = /\\\./g;
20028
20067
  const EXPANSION_MAX = 100_000;
20029
20068
  function numeric(str) {
20030
20069
  return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
@@ -20394,8 +20433,110 @@ const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true, } = {
20394
20433
  };
20395
20434
 
20396
20435
  // parse a single path portion
20436
+ var _a;
20397
20437
  const types = new Set(['!', '?', '+', '*', '@']);
20398
20438
  const isExtglobType = (c) => types.has(c);
20439
+ const isExtglobAST = (c) => isExtglobType(c.type);
20440
+ // Map of which extglob types can adopt the children of a nested extglob
20441
+ //
20442
+ // anything but ! can adopt a matching type:
20443
+ // +(a|+(b|c)|d) => +(a|b|c|d)
20444
+ // *(a|*(b|c)|d) => *(a|b|c|d)
20445
+ // @(a|@(b|c)|d) => @(a|b|c|d)
20446
+ // ?(a|?(b|c)|d) => ?(a|b|c|d)
20447
+ //
20448
+ // * can adopt anything, because 0 or repetition is allowed
20449
+ // *(a|?(b|c)|d) => *(a|b|c|d)
20450
+ // *(a|+(b|c)|d) => *(a|b|c|d)
20451
+ // *(a|@(b|c)|d) => *(a|b|c|d)
20452
+ //
20453
+ // + can adopt @, because 1 or repetition is allowed
20454
+ // +(a|@(b|c)|d) => +(a|b|c|d)
20455
+ //
20456
+ // + and @ CANNOT adopt *, because 0 would be allowed
20457
+ // +(a|*(b|c)|d) => would match "", on *(b|c)
20458
+ // @(a|*(b|c)|d) => would match "", on *(b|c)
20459
+ //
20460
+ // + and @ CANNOT adopt ?, because 0 would be allowed
20461
+ // +(a|?(b|c)|d) => would match "", on ?(b|c)
20462
+ // @(a|?(b|c)|d) => would match "", on ?(b|c)
20463
+ //
20464
+ // ? can adopt @, because 0 or 1 is allowed
20465
+ // ?(a|@(b|c)|d) => ?(a|b|c|d)
20466
+ //
20467
+ // ? and @ CANNOT adopt * or +, because >1 would be allowed
20468
+ // ?(a|*(b|c)|d) => would match bbb on *(b|c)
20469
+ // @(a|*(b|c)|d) => would match bbb on *(b|c)
20470
+ // ?(a|+(b|c)|d) => would match bbb on +(b|c)
20471
+ // @(a|+(b|c)|d) => would match bbb on +(b|c)
20472
+ //
20473
+ // ! CANNOT adopt ! (nothing else can either)
20474
+ // !(a|!(b|c)|d) => !(a|b|c|d) would fail to match on b (not not b|c)
20475
+ //
20476
+ // ! can adopt @
20477
+ // !(a|@(b|c)|d) => !(a|b|c|d)
20478
+ //
20479
+ // ! CANNOT adopt *
20480
+ // !(a|*(b|c)|d) => !(a|b|c|d) would match on bbb, not allowed
20481
+ //
20482
+ // ! CANNOT adopt +
20483
+ // !(a|+(b|c)|d) => !(a|b|c|d) would match on bbb, not allowed
20484
+ //
20485
+ // ! CANNOT adopt ?
20486
+ // x!(a|?(b|c)|d) => x!(a|b|c|d) would fail to match "x"
20487
+ const adoptionMap = new Map([
20488
+ ['!', ['@']],
20489
+ ['?', ['?', '@']],
20490
+ ['@', ['@']],
20491
+ ['*', ['*', '+', '?', '@']],
20492
+ ['+', ['+', '@']],
20493
+ ]);
20494
+ // nested extglobs that can be adopted in, but with the addition of
20495
+ // a blank '' element.
20496
+ const adoptionWithSpaceMap = new Map([
20497
+ ['!', ['?']],
20498
+ ['@', ['?']],
20499
+ ['+', ['?', '*']],
20500
+ ]);
20501
+ // union of the previous two maps
20502
+ const adoptionAnyMap = new Map([
20503
+ ['!', ['?', '@']],
20504
+ ['?', ['?', '@']],
20505
+ ['@', ['?', '@']],
20506
+ ['*', ['*', '+', '?', '@']],
20507
+ ['+', ['+', '@', '?', '*']],
20508
+ ]);
20509
+ // Extglobs that can take over their parent if they are the only child
20510
+ // the key is parent, value maps child to resulting extglob parent type
20511
+ // '@' is omitted because it's a special case. An `@` extglob with a single
20512
+ // member can always be usurped by that subpattern.
20513
+ const usurpMap = new Map([
20514
+ ['!', new Map([['!', '@']])],
20515
+ [
20516
+ '?',
20517
+ new Map([
20518
+ ['*', '*'],
20519
+ ['+', '*'],
20520
+ ]),
20521
+ ],
20522
+ [
20523
+ '@',
20524
+ new Map([
20525
+ ['!', '!'],
20526
+ ['?', '?'],
20527
+ ['@', '@'],
20528
+ ['*', '*'],
20529
+ ['+', '+'],
20530
+ ]),
20531
+ ],
20532
+ [
20533
+ '+',
20534
+ new Map([
20535
+ ['?', '*'],
20536
+ ['*', '*'],
20537
+ ]),
20538
+ ],
20539
+ ]);
20399
20540
  // Patterns that get prepended to bind to the start of either the
20400
20541
  // entire string, or just a single path portion, to prevent dots
20401
20542
  // and/or traversal patterns, when needed.
@@ -20419,6 +20560,7 @@ const star$1 = qmark$1 + '*?';
20419
20560
  const starNoEmpty = qmark$1 + '+?';
20420
20561
  // remove the \ chars that we added if we end up doing a nonmagic compare
20421
20562
  // const deslash = (s: string) => s.replace(/\\(.)/g, '$1')
20563
+ let ID = 0;
20422
20564
  class AST {
20423
20565
  type;
20424
20566
  #root;
@@ -20434,6 +20576,22 @@ class AST {
20434
20576
  // set to true if it's an extglob with no children
20435
20577
  // (which really means one child of '')
20436
20578
  #emptyExt = false;
20579
+ id = ++ID;
20580
+ get depth() {
20581
+ return (this.#parent?.depth ?? -1) + 1;
20582
+ }
20583
+ [Symbol.for('nodejs.util.inspect.custom')]() {
20584
+ return {
20585
+ '@@type': 'AST',
20586
+ id: this.id,
20587
+ type: this.type,
20588
+ root: this.#root.id,
20589
+ parent: this.#parent?.id,
20590
+ depth: this.depth,
20591
+ partsLength: this.#parts.length,
20592
+ parts: this.#parts,
20593
+ };
20594
+ }
20437
20595
  constructor(type, parent, options = {}) {
20438
20596
  this.type = type;
20439
20597
  // extglobs are inherently magical
@@ -20513,7 +20671,7 @@ class AST {
20513
20671
  continue;
20514
20672
  /* c8 ignore start */
20515
20673
  if (typeof p !== 'string' &&
20516
- !(p instanceof AST && p.#parent === this)) {
20674
+ !(p instanceof _a && p.#parent === this)) {
20517
20675
  throw new Error('invalid part: ' + p);
20518
20676
  }
20519
20677
  /* c8 ignore stop */
@@ -20547,7 +20705,7 @@ class AST {
20547
20705
  const p = this.#parent;
20548
20706
  for (let i = 0; i < this.#parentIndex; i++) {
20549
20707
  const pp = p.#parts[i];
20550
- if (!(pp instanceof AST && pp.type === '!')) {
20708
+ if (!(pp instanceof _a && pp.type === '!')) {
20551
20709
  return false;
20552
20710
  }
20553
20711
  }
@@ -20575,13 +20733,14 @@ class AST {
20575
20733
  this.push(part.clone(this));
20576
20734
  }
20577
20735
  clone(parent) {
20578
- const c = new AST(this.type, parent);
20736
+ const c = new _a(this.type, parent);
20579
20737
  for (const p of this.#parts) {
20580
20738
  c.copyIn(p);
20581
20739
  }
20582
20740
  return c;
20583
20741
  }
20584
- static #parseAST(str, ast, pos, opt) {
20742
+ static #parseAST(str, ast, pos, opt, extDepth) {
20743
+ const maxDepth = opt.maxExtglobRecursion ?? 2;
20585
20744
  let escaping = false;
20586
20745
  let inBrace = false;
20587
20746
  let braceStart = -1;
@@ -20618,11 +20777,17 @@ class AST {
20618
20777
  acc += c;
20619
20778
  continue;
20620
20779
  }
20621
- if (!opt.noext && isExtglobType(c) && str.charAt(i) === '(') {
20780
+ // we don't have to check for adoption here, because that's
20781
+ // done at the other recursion point.
20782
+ const doRecurse = !opt.noext &&
20783
+ isExtglobType(c) &&
20784
+ str.charAt(i) === '(' &&
20785
+ extDepth <= maxDepth;
20786
+ if (doRecurse) {
20622
20787
  ast.push(acc);
20623
20788
  acc = '';
20624
- const ext = new AST(c, ast);
20625
- i = AST.#parseAST(str, ext, i, opt);
20789
+ const ext = new _a(c, ast);
20790
+ i = _a.#parseAST(str, ext, i, opt, extDepth + 1);
20626
20791
  ast.push(ext);
20627
20792
  continue;
20628
20793
  }
@@ -20634,7 +20799,7 @@ class AST {
20634
20799
  // some kind of extglob, pos is at the (
20635
20800
  // find the next | or )
20636
20801
  let i = pos + 1;
20637
- let part = new AST(null, ast);
20802
+ let part = new _a(null, ast);
20638
20803
  const parts = [];
20639
20804
  let acc = '';
20640
20805
  while (i < str.length) {
@@ -20665,19 +20830,26 @@ class AST {
20665
20830
  acc += c;
20666
20831
  continue;
20667
20832
  }
20668
- if (isExtglobType(c) && str.charAt(i) === '(') {
20833
+ const doRecurse = !opt.noext &&
20834
+ isExtglobType(c) &&
20835
+ str.charAt(i) === '(' &&
20836
+ /* c8 ignore start - the maxDepth is sufficient here */
20837
+ (extDepth <= maxDepth || (ast && ast.#canAdoptType(c)));
20838
+ /* c8 ignore stop */
20839
+ if (doRecurse) {
20840
+ const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
20669
20841
  part.push(acc);
20670
20842
  acc = '';
20671
- const ext = new AST(c, part);
20843
+ const ext = new _a(c, part);
20672
20844
  part.push(ext);
20673
- i = AST.#parseAST(str, ext, i, opt);
20845
+ i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
20674
20846
  continue;
20675
20847
  }
20676
20848
  if (c === '|') {
20677
20849
  part.push(acc);
20678
20850
  acc = '';
20679
20851
  parts.push(part);
20680
- part = new AST(null, ast);
20852
+ part = new _a(null, ast);
20681
20853
  continue;
20682
20854
  }
20683
20855
  if (c === ')') {
@@ -20699,9 +20871,82 @@ class AST {
20699
20871
  ast.#parts = [str.substring(pos - 1)];
20700
20872
  return i;
20701
20873
  }
20874
+ #canAdoptWithSpace(child) {
20875
+ return this.#canAdopt(child, adoptionWithSpaceMap);
20876
+ }
20877
+ #canAdopt(child, map = adoptionMap) {
20878
+ if (!child ||
20879
+ typeof child !== 'object' ||
20880
+ child.type !== null ||
20881
+ child.#parts.length !== 1 ||
20882
+ this.type === null) {
20883
+ return false;
20884
+ }
20885
+ const gc = child.#parts[0];
20886
+ if (!gc || typeof gc !== 'object' || gc.type === null) {
20887
+ return false;
20888
+ }
20889
+ return this.#canAdoptType(gc.type, map);
20890
+ }
20891
+ #canAdoptType(c, map = adoptionAnyMap) {
20892
+ return !!map.get(this.type)?.includes(c);
20893
+ }
20894
+ #adoptWithSpace(child, index) {
20895
+ const gc = child.#parts[0];
20896
+ const blank = new _a(null, gc, this.options);
20897
+ blank.#parts.push('');
20898
+ gc.push(blank);
20899
+ this.#adopt(child, index);
20900
+ }
20901
+ #adopt(child, index) {
20902
+ const gc = child.#parts[0];
20903
+ this.#parts.splice(index, 1, ...gc.#parts);
20904
+ for (const p of gc.#parts) {
20905
+ if (typeof p === 'object')
20906
+ p.#parent = this;
20907
+ }
20908
+ this.#toString = undefined;
20909
+ }
20910
+ #canUsurpType(c) {
20911
+ const m = usurpMap.get(this.type);
20912
+ return !!(m?.has(c));
20913
+ }
20914
+ #canUsurp(child) {
20915
+ if (!child ||
20916
+ typeof child !== 'object' ||
20917
+ child.type !== null ||
20918
+ child.#parts.length !== 1 ||
20919
+ this.type === null ||
20920
+ this.#parts.length !== 1) {
20921
+ return false;
20922
+ }
20923
+ const gc = child.#parts[0];
20924
+ if (!gc || typeof gc !== 'object' || gc.type === null) {
20925
+ return false;
20926
+ }
20927
+ return this.#canUsurpType(gc.type);
20928
+ }
20929
+ #usurp(child) {
20930
+ const m = usurpMap.get(this.type);
20931
+ const gc = child.#parts[0];
20932
+ const nt = m?.get(gc.type);
20933
+ /* c8 ignore start - impossible */
20934
+ if (!nt)
20935
+ return false;
20936
+ /* c8 ignore stop */
20937
+ this.#parts = gc.#parts;
20938
+ for (const p of this.#parts) {
20939
+ if (typeof p === 'object') {
20940
+ p.#parent = this;
20941
+ }
20942
+ }
20943
+ this.type = nt;
20944
+ this.#toString = undefined;
20945
+ this.#emptyExt = false;
20946
+ }
20702
20947
  static fromGlob(pattern, options = {}) {
20703
- const ast = new AST(null, undefined, options);
20704
- AST.#parseAST(pattern, ast, 0, options);
20948
+ const ast = new _a(null, undefined, options);
20949
+ _a.#parseAST(pattern, ast, 0, options, 0);
20705
20950
  return ast;
20706
20951
  }
20707
20952
  // returns the regular expression if there's magic, or the unescaped
@@ -20805,16 +21050,18 @@ class AST {
20805
21050
  // or start or whatever) and prepend ^ or / at the Regexp construction.
20806
21051
  toRegExpSource(allowDot) {
20807
21052
  const dot = allowDot ?? !!this.#options.dot;
20808
- if (this.#root === this)
21053
+ if (this.#root === this) {
21054
+ this.#flatten();
20809
21055
  this.#fillNegs();
20810
- if (!this.type) {
21056
+ }
21057
+ if (!isExtglobAST(this)) {
20811
21058
  const noEmpty = this.isStart() &&
20812
21059
  this.isEnd() &&
20813
21060
  !this.#parts.some(s => typeof s !== 'string');
20814
21061
  const src = this.#parts
20815
21062
  .map(p => {
20816
21063
  const [re, _, hasMagic, uflag] = typeof p === 'string' ?
20817
- AST.#parseGlob(p, this.#hasMagic, noEmpty)
21064
+ _a.#parseGlob(p, this.#hasMagic, noEmpty)
20818
21065
  : p.toRegExpSource(allowDot);
20819
21066
  this.#hasMagic = this.#hasMagic || hasMagic;
20820
21067
  this.#uflag = this.#uflag || uflag;
@@ -20876,12 +21123,12 @@ class AST {
20876
21123
  // invalid extglob, has to at least be *something* present, if it's
20877
21124
  // the entire path portion.
20878
21125
  const s = this.toString();
20879
- this.#parts = [s];
20880
- this.type = null;
20881
- this.#hasMagic = undefined;
21126
+ const me = this;
21127
+ me.#parts = [s];
21128
+ me.type = null;
21129
+ me.#hasMagic = undefined;
20882
21130
  return [s, unescape(this.toString()), false, false];
20883
21131
  }
20884
- // XXX abstract out this map method
20885
21132
  let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ?
20886
21133
  ''
20887
21134
  : this.#partsToRegExp(true);
@@ -20917,6 +21164,42 @@ class AST {
20917
21164
  this.#uflag,
20918
21165
  ];
20919
21166
  }
21167
+ #flatten() {
21168
+ if (!isExtglobAST(this)) {
21169
+ for (const p of this.#parts) {
21170
+ if (typeof p === 'object') {
21171
+ p.#flatten();
21172
+ }
21173
+ }
21174
+ }
21175
+ else {
21176
+ // do up to 10 passes to flatten as much as possible
21177
+ let iterations = 0;
21178
+ let done = false;
21179
+ do {
21180
+ done = true;
21181
+ for (let i = 0; i < this.#parts.length; i++) {
21182
+ const c = this.#parts[i];
21183
+ if (typeof c === 'object') {
21184
+ c.#flatten();
21185
+ if (this.#canAdopt(c)) {
21186
+ done = false;
21187
+ this.#adopt(c, i);
21188
+ }
21189
+ else if (this.#canAdoptWithSpace(c)) {
21190
+ done = false;
21191
+ this.#adoptWithSpace(c, i);
21192
+ }
21193
+ else if (this.#canUsurp(c)) {
21194
+ done = false;
21195
+ this.#usurp(c);
21196
+ }
21197
+ }
21198
+ }
21199
+ } while (!done && ++iterations < 10);
21200
+ }
21201
+ this.#toString = undefined;
21202
+ }
20920
21203
  #partsToRegExp(dot) {
20921
21204
  return this.#parts
20922
21205
  .map(p => {
@@ -20987,6 +21270,7 @@ class AST {
20987
21270
  return [re, unescape(glob), !!hasMagic, uflag];
20988
21271
  }
20989
21272
  }
21273
+ _a = AST;
20990
21274
 
20991
21275
  /**
20992
21276
  * Escape all magic characters in a glob pattern.
@@ -21204,11 +21488,13 @@ class Minimatch {
21204
21488
  isWindows;
21205
21489
  platform;
21206
21490
  windowsNoMagicRoot;
21491
+ maxGlobstarRecursion;
21207
21492
  regexp;
21208
21493
  constructor(pattern, options = {}) {
21209
21494
  assertValidPattern(pattern);
21210
21495
  options = options || {};
21211
21496
  this.options = options;
21497
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
21212
21498
  this.pattern = pattern;
21213
21499
  this.platform = options.platform || defaultPlatform;
21214
21500
  this.isWindows = this.platform === 'win32';
@@ -21613,7 +21899,8 @@ class Minimatch {
21613
21899
  // out of pattern, then that's fine, as long as all
21614
21900
  // the parts match.
21615
21901
  matchOne(file, pattern, partial = false) {
21616
- const options = this.options;
21902
+ let fileStartIndex = 0;
21903
+ let patternStartIndex = 0;
21617
21904
  // UNC paths like //?/X:/... can match X:/... and vice versa
21618
21905
  // Drive letters in absolute drive or unc paths are always compared
21619
21906
  // case-insensitively.
@@ -21642,14 +21929,11 @@ class Minimatch {
21642
21929
  file[fdi],
21643
21930
  pattern[pdi],
21644
21931
  ];
21932
+ // start matching at the drive letter index of each
21645
21933
  if (fd.toLowerCase() === pd.toLowerCase()) {
21646
21934
  pattern[pdi] = fd;
21647
- if (pdi > fdi) {
21648
- pattern = pattern.slice(pdi);
21649
- }
21650
- else if (fdi > pdi) {
21651
- file = file.slice(fdi);
21652
- }
21935
+ patternStartIndex = pdi;
21936
+ fileStartIndex = fdi;
21653
21937
  }
21654
21938
  }
21655
21939
  }
@@ -21659,99 +21943,185 @@ class Minimatch {
21659
21943
  if (optimizationLevel >= 2) {
21660
21944
  file = this.levelTwoFileOptimize(file);
21661
21945
  }
21662
- this.debug('matchOne', this, { file, pattern });
21663
- this.debug('matchOne', file.length, pattern.length);
21664
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
21946
+ if (pattern.includes(GLOBSTAR)) {
21947
+ return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
21948
+ }
21949
+ return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
21950
+ }
21951
+ #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
21952
+ // split the pattern into head, tail, and middle of ** delimited parts
21953
+ const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
21954
+ const lastgs = pattern.lastIndexOf(GLOBSTAR);
21955
+ // split the pattern up into globstar-delimited sections
21956
+ // the tail has to be at the end, and the others just have
21957
+ // to be found in order from the head.
21958
+ const [head, body, tail] = partial ? [
21959
+ pattern.slice(patternIndex, firstgs),
21960
+ pattern.slice(firstgs + 1),
21961
+ [],
21962
+ ] : [
21963
+ pattern.slice(patternIndex, firstgs),
21964
+ pattern.slice(firstgs + 1, lastgs),
21965
+ pattern.slice(lastgs + 1),
21966
+ ];
21967
+ // check the head, from the current file/pattern index.
21968
+ if (head.length) {
21969
+ const fileHead = file.slice(fileIndex, fileIndex + head.length);
21970
+ if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
21971
+ return false;
21972
+ }
21973
+ fileIndex += head.length;
21974
+ patternIndex += head.length;
21975
+ }
21976
+ // now we know the head matches!
21977
+ // if the last portion is not empty, it MUST match the end
21978
+ // check the tail
21979
+ let fileTailMatch = 0;
21980
+ if (tail.length) {
21981
+ // if head + tail > file, then we cannot possibly match
21982
+ if (tail.length + fileIndex > file.length)
21983
+ return false;
21984
+ // try to match the tail
21985
+ let tailStart = file.length - tail.length;
21986
+ if (this.#matchOne(file, tail, partial, tailStart, 0)) {
21987
+ fileTailMatch = tail.length;
21988
+ }
21989
+ else {
21990
+ // affordance for stuff like a/**/* matching a/b/
21991
+ // if the last file portion is '', and there's more to the pattern
21992
+ // then try without the '' bit.
21993
+ if (file[file.length - 1] !== '' ||
21994
+ fileIndex + tail.length === file.length) {
21995
+ return false;
21996
+ }
21997
+ tailStart--;
21998
+ if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
21999
+ return false;
22000
+ }
22001
+ fileTailMatch = tail.length + 1;
22002
+ }
22003
+ }
22004
+ // now we know the tail matches!
22005
+ // the middle is zero or more portions wrapped in **, possibly
22006
+ // containing more ** sections.
22007
+ // so a/**/b/**/c/**/d has become **/b/**/c/**
22008
+ // if it's empty, it means a/**/b, just verify we have no bad dots
22009
+ // if there's no tail, so it ends on /**, then we must have *something*
22010
+ // after the head, or it's not a matc
22011
+ if (!body.length) {
22012
+ let sawSome = !!fileTailMatch;
22013
+ for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
22014
+ const f = String(file[i]);
22015
+ sawSome = true;
22016
+ if (f === '.' ||
22017
+ f === '..' ||
22018
+ (!this.options.dot && f.startsWith('.'))) {
22019
+ return false;
22020
+ }
22021
+ }
22022
+ // in partial mode, we just need to get past all file parts
22023
+ return partial || sawSome;
22024
+ }
22025
+ // now we know that there's one or more body sections, which can
22026
+ // be matched anywhere from the 0 index (because the head was pruned)
22027
+ // through to the length-fileTailMatch index.
22028
+ // split the body up into sections, and note the minimum index it can
22029
+ // be found at (start with the length of all previous segments)
22030
+ // [section, before, after]
22031
+ const bodySegments = [[[], 0]];
22032
+ let currentBody = bodySegments[0];
22033
+ let nonGsParts = 0;
22034
+ const nonGsPartsSums = [0];
22035
+ for (const b of body) {
22036
+ if (b === GLOBSTAR) {
22037
+ nonGsPartsSums.push(nonGsParts);
22038
+ currentBody = [[], 0];
22039
+ bodySegments.push(currentBody);
22040
+ }
22041
+ else {
22042
+ currentBody[0].push(b);
22043
+ nonGsParts++;
22044
+ }
22045
+ }
22046
+ let i = bodySegments.length - 1;
22047
+ const fileLength = file.length - fileTailMatch;
22048
+ for (const b of bodySegments) {
22049
+ b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
22050
+ }
22051
+ return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
22052
+ }
22053
+ // return false for "nope, not matching"
22054
+ // return null for "not matching, cannot keep trying"
22055
+ #matchGlobStarBodySections(file,
22056
+ // pattern section, last possible position for it
22057
+ bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
22058
+ // take the first body segment, and walk from fileIndex to its "after"
22059
+ // value at the end
22060
+ // If it doesn't match at that position, we increment, until we hit
22061
+ // that final possible position, and give up.
22062
+ // If it does match, then advance and try to rest.
22063
+ // If any of them fail we keep walking forward.
22064
+ // this is still a bit recursively painful, but it's more constrained
22065
+ // than previous implementations, because we never test something that
22066
+ // can't possibly be a valid matching condition.
22067
+ const bs = bodySegments[bodyIndex];
22068
+ if (!bs) {
22069
+ // just make sure that there's no bad dots
22070
+ for (let i = fileIndex; i < file.length; i++) {
22071
+ sawTail = true;
22072
+ const f = file[i];
22073
+ if (f === '.' ||
22074
+ f === '..' ||
22075
+ (!this.options.dot && f.startsWith('.'))) {
22076
+ return false;
22077
+ }
22078
+ }
22079
+ return sawTail;
22080
+ }
22081
+ // have a non-globstar body section to test
22082
+ const [body, after] = bs;
22083
+ while (fileIndex <= after) {
22084
+ const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
22085
+ // if limit exceeded, no match. intentional false negative,
22086
+ // acceptable break in correctness for security.
22087
+ if (m && globStarDepth < this.maxGlobstarRecursion) {
22088
+ // match! see if the rest match. if so, we're done!
22089
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
22090
+ if (sub !== false) {
22091
+ return sub;
22092
+ }
22093
+ }
22094
+ const f = file[fileIndex];
22095
+ if (f === '.' ||
22096
+ f === '..' ||
22097
+ (!this.options.dot && f.startsWith('.'))) {
22098
+ return false;
22099
+ }
22100
+ fileIndex++;
22101
+ }
22102
+ // walked off. no point continuing
22103
+ return partial || null;
22104
+ }
22105
+ #matchOne(file, pattern, partial, fileIndex, patternIndex) {
22106
+ let fi;
22107
+ let pi;
22108
+ let pl;
22109
+ let fl;
22110
+ for (fi = fileIndex,
22111
+ pi = patternIndex,
22112
+ fl = file.length,
22113
+ pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
21665
22114
  this.debug('matchOne loop');
21666
- var p = pattern[pi];
21667
- var f = file[fi];
22115
+ let p = pattern[pi];
22116
+ let f = file[fi];
21668
22117
  this.debug(pattern, p, f);
21669
22118
  // should be impossible.
21670
22119
  // some invalid regexp stuff in the set.
21671
22120
  /* c8 ignore start */
21672
- if (p === false) {
22121
+ if (p === false || p === GLOBSTAR) {
21673
22122
  return false;
21674
22123
  }
21675
22124
  /* c8 ignore stop */
21676
- if (p === GLOBSTAR) {
21677
- this.debug('GLOBSTAR', [pattern, p, f]);
21678
- // "**"
21679
- // a/**/b/**/c would match the following:
21680
- // a/b/x/y/z/c
21681
- // a/x/y/z/b/c
21682
- // a/b/x/b/x/c
21683
- // a/b/c
21684
- // To do this, take the rest of the pattern after
21685
- // the **, and see if it would match the file remainder.
21686
- // If so, return success.
21687
- // If not, the ** "swallows" a segment, and try again.
21688
- // This is recursively awful.
21689
- //
21690
- // a/**/b/**/c matching a/b/x/y/z/c
21691
- // - a matches a
21692
- // - doublestar
21693
- // - matchOne(b/x/y/z/c, b/**/c)
21694
- // - b matches b
21695
- // - doublestar
21696
- // - matchOne(x/y/z/c, c) -> no
21697
- // - matchOne(y/z/c, c) -> no
21698
- // - matchOne(z/c, c) -> no
21699
- // - matchOne(c, c) yes, hit
21700
- var fr = fi;
21701
- var pr = pi + 1;
21702
- if (pr === pl) {
21703
- this.debug('** at the end');
21704
- // a ** at the end will just swallow the rest.
21705
- // We have found a match.
21706
- // however, it will not swallow /.x, unless
21707
- // options.dot is set.
21708
- // . and .. are *never* matched by **, for explosively
21709
- // exponential reasons.
21710
- for (; fi < fl; fi++) {
21711
- if (file[fi] === '.' ||
21712
- file[fi] === '..' ||
21713
- (!options.dot && file[fi].charAt(0) === '.'))
21714
- return false;
21715
- }
21716
- return true;
21717
- }
21718
- // ok, let's see if we can swallow whatever we can.
21719
- while (fr < fl) {
21720
- var swallowee = file[fr];
21721
- this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
21722
- // XXX remove this slice. Just pass the start index.
21723
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
21724
- this.debug('globstar found match!', fr, fl, swallowee);
21725
- // found a match.
21726
- return true;
21727
- }
21728
- else {
21729
- // can't swallow "." or ".." ever.
21730
- // can only swallow ".foo" when explicitly asked.
21731
- if (swallowee === '.' ||
21732
- swallowee === '..' ||
21733
- (!options.dot && swallowee.charAt(0) === '.')) {
21734
- this.debug('dot detected!', file, fr, pattern, pr);
21735
- break;
21736
- }
21737
- // ** swallows a segment, and continue.
21738
- this.debug('globstar swallow a segment, and continue');
21739
- fr++;
21740
- }
21741
- }
21742
- // no match was found.
21743
- // However, in partial mode, we can't say this is necessarily over.
21744
- /* c8 ignore start */
21745
- if (partial) {
21746
- // ran out of file
21747
- this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
21748
- if (fr === fl) {
21749
- return true;
21750
- }
21751
- }
21752
- /* c8 ignore stop */
21753
- return false;
21754
- }
21755
22125
  // something other than **
21756
22126
  // non-magic patterns just have to match exactly
21757
22127
  // patterns with magic have been turned into regexps.
@@ -23575,9 +23945,9 @@ function processDefineModel(ctx, node, declId) {
23575
23945
  let modelName;
23576
23946
  let options;
23577
23947
  const arg0 = node.arguments[0] && CompilerDOM.unwrapTSNode(node.arguments[0]);
23578
- const hasName = arg0 && arg0.type === "StringLiteral";
23948
+ const hasName = arg0 && (arg0.type === "StringLiteral" || arg0.type === "TemplateLiteral" && arg0.expressions.length === 0);
23579
23949
  if (hasName) {
23580
- modelName = arg0.value;
23950
+ modelName = arg0.type === "StringLiteral" ? arg0.value : arg0.quasis[0].value.cooked;
23581
23951
  options = node.arguments[1];
23582
23952
  } else {
23583
23953
  modelName = "modelValue";
@@ -25213,7 +25583,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
25213
25583
  return generator.toJSON();
25214
25584
  }
25215
25585
 
25216
- const version = "3.5.29";
25586
+ const version = "3.5.31";
25217
25587
  const parseCache = parseCache$1;
25218
25588
  const errorMessages = {
25219
25589
  ...CompilerDOM.errorMessages,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.5.29
2
+ * @vue/compiler-sfc v3.5.31
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -15949,7 +15949,7 @@ function requireLib () {
15949
15949
  this.next();
15950
15950
  return this.parseAsyncFunctionExpression(this.startNodeAtNode(id));
15951
15951
  } else if (tokenIsIdentifier(type)) {
15952
- if (this.lookaheadCharCode() === 61) {
15952
+ if (canBeArrow && this.lookaheadCharCode() === 61) {
15953
15953
  return this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(id));
15954
15954
  } else {
15955
15955
  return id;
@@ -26096,7 +26096,7 @@ const transformFor = createStructuralDirectiveTransform(
26096
26096
  loop.body = createBlockStatement([
26097
26097
  createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
26098
26098
  createCompoundExpression([
26099
- `if (_cached`,
26099
+ `if (_cached && _cached.el`,
26100
26100
  ...keyExp ? [` && _cached.key === `, keyExp] : [],
26101
26101
  ` && ${context.helperString(
26102
26102
  IS_MEMO_SAME
@@ -31697,7 +31697,7 @@ var _polyfillNode_url$1 = /*#__PURE__*/Object.freeze({
31697
31697
 
31698
31698
  function isRelativeUrl(url) {
31699
31699
  const firstChar = url.charAt(0);
31700
- return firstChar === "." || firstChar === "~" || firstChar === "@";
31700
+ return firstChar === "." || firstChar === "~" || firstChar === "@" || firstChar === "#";
31701
31701
  }
31702
31702
  const externalRE = /^(?:https?:)?\/\//;
31703
31703
  function isExternalUrl(url) {
@@ -31707,6 +31707,13 @@ const dataUrlRE = /^\s*data:/i;
31707
31707
  function isDataUrl(url) {
31708
31708
  return dataUrlRE.test(url);
31709
31709
  }
31710
+ function normalizeDecodedImportPath(source) {
31711
+ try {
31712
+ return decodeURIComponent(source);
31713
+ } catch (e) {
31714
+ return source;
31715
+ }
31716
+ }
31710
31717
  function parseUrl(url) {
31711
31718
  const firstChar = url.charAt(0);
31712
31719
  if (firstChar === "~") {
@@ -31738,16 +31745,18 @@ var __spreadValues$9 = (a, b) => {
31738
31745
  return a;
31739
31746
  };
31740
31747
  var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
31748
+ const resourceUrlTagConfig = {
31749
+ video: ["src", "poster"],
31750
+ source: ["src"],
31751
+ img: ["src"],
31752
+ image: ["xlink:href", "href"]
31753
+ };
31741
31754
  const defaultAssetUrlOptions = {
31742
31755
  base: null,
31743
31756
  includeAbsolute: false,
31744
- tags: {
31745
- video: ["src", "poster"],
31746
- source: ["src"],
31747
- img: ["src"],
31748
- image: ["xlink:href", "href"],
31757
+ tags: __spreadProps$8(__spreadValues$9({}, resourceUrlTagConfig), {
31749
31758
  use: ["xlink:href", "href"]
31750
- }
31759
+ })
31751
31760
  };
31752
31761
  const normalizeOptions = (options) => {
31753
31762
  if (Object.keys(options).some((key) => isArray$3(options[key]))) {
@@ -31760,6 +31769,10 @@ const normalizeOptions = (options) => {
31760
31769
  const createAssetUrlTransformWithOptions = (options) => {
31761
31770
  return (node, context) => transformAssetUrl(node, context, options);
31762
31771
  };
31772
+ function canTransformHashImport(tag, attrName) {
31773
+ var _a;
31774
+ return !!((_a = resourceUrlTagConfig[tag]) == null ? void 0 : _a.includes(attrName));
31775
+ }
31763
31776
  const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
31764
31777
  if (node.type === 1) {
31765
31778
  if (!node.props.length) {
@@ -31773,11 +31786,16 @@ const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
31773
31786
  }
31774
31787
  const assetAttrs = (attrs || []).concat(wildCardAttrs || []);
31775
31788
  node.props.forEach((attr, index) => {
31776
- if (attr.type !== 6 || !assetAttrs.includes(attr.name) || !attr.value || isExternalUrl(attr.value.content) || isDataUrl(attr.value.content) || attr.value.content[0] === "#" || !options.includeAbsolute && !isRelativeUrl(attr.value.content)) {
31789
+ if (attr.type !== 6 || !assetAttrs.includes(attr.name) || !attr.value) {
31777
31790
  return;
31778
31791
  }
31779
- const url = parseUrl(attr.value.content);
31780
- if (options.base && attr.value.content[0] === ".") {
31792
+ const urlValue = attr.value.content;
31793
+ const isHashOnlyValue = urlValue[0] === "#";
31794
+ if (isExternalUrl(urlValue) || isDataUrl(urlValue) || isHashOnlyValue && !canTransformHashImport(node.tag, attr.name) || !options.includeAbsolute && !isRelativeUrl(urlValue)) {
31795
+ return;
31796
+ }
31797
+ const url = parseUrl(urlValue);
31798
+ if (options.base && urlValue[0] === ".") {
31781
31799
  const base = parseUrl(options.base);
31782
31800
  const protocol = base.protocol || "";
31783
31801
  const host = base.host ? protocol + "//" + base.host : "";
@@ -31797,55 +31815,65 @@ const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
31797
31815
  });
31798
31816
  }
31799
31817
  };
31818
+ function resolveOrRegisterImport(source, loc, context) {
31819
+ const normalizedSource = normalizeDecodedImportPath(source);
31820
+ const existingIndex = context.imports.findIndex(
31821
+ (i) => i.path === normalizedSource
31822
+ );
31823
+ if (existingIndex > -1) {
31824
+ return {
31825
+ name: `_imports_${existingIndex}`,
31826
+ exp: context.imports[existingIndex].exp
31827
+ };
31828
+ }
31829
+ const name = `_imports_${context.imports.length}`;
31830
+ const exp = createSimpleExpression(
31831
+ name,
31832
+ false,
31833
+ loc,
31834
+ 3
31835
+ );
31836
+ context.imports.push({
31837
+ exp,
31838
+ path: normalizedSource
31839
+ });
31840
+ return { name, exp };
31841
+ }
31800
31842
  function getImportsExpressionExp(path2, hash, loc, context) {
31801
- if (path2) {
31802
- let name;
31803
- let exp;
31804
- const existingIndex = context.imports.findIndex((i) => i.path === path2);
31805
- if (existingIndex > -1) {
31806
- name = `_imports_${existingIndex}`;
31807
- exp = context.imports[existingIndex].exp;
31808
- } else {
31809
- name = `_imports_${context.imports.length}`;
31810
- exp = createSimpleExpression(
31811
- name,
31812
- false,
31813
- loc,
31814
- 3
31815
- );
31816
- context.imports.push({
31817
- exp,
31818
- path: decodeURIComponent(path2)
31819
- });
31820
- }
31821
- if (!hash) {
31822
- return exp;
31823
- }
31824
- const hashExp = `${name} + '${hash}'`;
31825
- const finalExp = createSimpleExpression(
31826
- hashExp,
31843
+ if (!path2 && !hash) {
31844
+ return createSimpleExpression(`''`, false, loc, 3);
31845
+ }
31846
+ if (!path2 && hash) {
31847
+ const { exp } = resolveOrRegisterImport(hash, loc, context);
31848
+ return exp;
31849
+ }
31850
+ if (path2 && !hash) {
31851
+ const { exp } = resolveOrRegisterImport(path2, loc, context);
31852
+ return exp;
31853
+ }
31854
+ const { name } = resolveOrRegisterImport(path2, loc, context);
31855
+ const hashExp = `${name} + '${hash}'`;
31856
+ const finalExp = createSimpleExpression(
31857
+ hashExp,
31858
+ false,
31859
+ loc,
31860
+ 3
31861
+ );
31862
+ if (!context.hoistStatic) {
31863
+ return finalExp;
31864
+ }
31865
+ const existingHoistIndex = context.hoists.findIndex((h) => {
31866
+ return h && h.type === 4 && !h.isStatic && h.content === hashExp;
31867
+ });
31868
+ if (existingHoistIndex > -1) {
31869
+ return createSimpleExpression(
31870
+ `_hoisted_${existingHoistIndex + 1}`,
31827
31871
  false,
31828
31872
  loc,
31829
31873
  3
31830
31874
  );
31831
- if (!context.hoistStatic) {
31832
- return finalExp;
31833
- }
31834
- const existingHoistIndex = context.hoists.findIndex((h) => {
31835
- return h && h.type === 4 && !h.isStatic && h.content === hashExp;
31836
- });
31837
- if (existingHoistIndex > -1) {
31838
- return createSimpleExpression(
31839
- `_hoisted_${existingHoistIndex + 1}`,
31840
- false,
31841
- loc,
31842
- 3
31843
- );
31844
- }
31845
- return context.hoist(finalExp);
31846
- } else {
31847
- return createSimpleExpression(`''`, false, loc, 3);
31848
31875
  }
31876
+ return context.hoist(finalExp);
31849
31877
  }
31850
31878
 
31851
31879
  const srcsetTags = ["img", "source"];
@@ -31902,12 +31930,14 @@ const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
31902
31930
  const compoundExpression = createCompoundExpression([], attr.loc);
31903
31931
  imageCandidates.forEach(({ url, descriptor }, index2) => {
31904
31932
  if (shouldProcessUrl(url)) {
31905
- const { path: path2 } = parseUrl(url);
31906
- let exp2;
31907
- if (path2) {
31933
+ const { path: path2, hash } = parseUrl(url);
31934
+ const source = path2 ? path2 : hash;
31935
+ if (source) {
31936
+ const normalizedSource = normalizeDecodedImportPath(source);
31908
31937
  const existingImportsIndex = context.imports.findIndex(
31909
- (i) => i.path === path2
31938
+ (i) => i.path === normalizedSource
31910
31939
  );
31940
+ let exp2;
31911
31941
  if (existingImportsIndex > -1) {
31912
31942
  exp2 = createSimpleExpression(
31913
31943
  `_imports_${existingImportsIndex}`,
@@ -31922,7 +31952,15 @@ const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
31922
31952
  attr.loc,
31923
31953
  3
31924
31954
  );
31925
- context.imports.push({ exp: exp2, path: path2 });
31955
+ context.imports.push({ exp: exp2, path: normalizedSource });
31956
+ }
31957
+ if (path2 && hash) {
31958
+ exp2 = createSimpleExpression(
31959
+ `${exp2.content} + '${hash}'`,
31960
+ false,
31961
+ attr.loc,
31962
+ 3
31963
+ );
31926
31964
  }
31927
31965
  compoundExpression.children.push(exp2);
31928
31966
  }
@@ -36442,7 +36480,15 @@ function requireMapGenerator () {
36442
36480
  }
36443
36481
  }
36444
36482
  } else if (this.css) {
36445
- this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, '');
36483
+ let startIndex;
36484
+ while ((startIndex = this.css.lastIndexOf('/*#')) !== -1) {
36485
+ let endIndex = this.css.indexOf('*/', startIndex + 3);
36486
+ if (endIndex === -1) break
36487
+ while (startIndex > 0 && this.css[startIndex - 1] === '\n') {
36488
+ startIndex--;
36489
+ }
36490
+ this.css = this.css.slice(0, startIndex) + this.css.slice(endIndex + 2);
36491
+ }
36446
36492
  }
36447
36493
  }
36448
36494
 
@@ -36919,7 +36965,7 @@ function requireParser$1 () {
36919
36965
  node.source.end.offset++;
36920
36966
 
36921
36967
  let text = token[1].slice(2, -2);
36922
- if (/^\s*$/.test(text)) {
36968
+ if (!text.trim()) {
36923
36969
  node.text = '';
36924
36970
  node.raws.left = text;
36925
36971
  node.raws.right = '';
@@ -38152,10 +38198,9 @@ function requireNoWorkResult () {
38152
38198
  this._css = css;
38153
38199
  this._opts = opts;
38154
38200
  this._map = undefined;
38155
- let root;
38156
38201
 
38157
38202
  let str = stringify;
38158
- this.result = new Result(this._processor, root, this._opts);
38203
+ this.result = new Result(this._processor, undefined, this._opts);
38159
38204
  this.result.css = css;
38160
38205
 
38161
38206
  let self = this;
@@ -38165,7 +38210,7 @@ function requireNoWorkResult () {
38165
38210
  }
38166
38211
  });
38167
38212
 
38168
- let map = new MapGenerator(str, root, this._opts, css);
38213
+ let map = new MapGenerator(str, undefined, this._opts, css);
38169
38214
  if (map.isMap()) {
38170
38215
  let [generatedCSS, generatedMap] = map.generate();
38171
38216
  if (generatedCSS) {
@@ -38240,7 +38285,7 @@ function requireProcessor$1 () {
38240
38285
 
38241
38286
  class Processor {
38242
38287
  constructor(plugins = []) {
38243
- this.version = '8.5.6';
38288
+ this.version = '8.5.8';
38244
38289
  this.plugins = this.normalize(plugins);
38245
38290
  }
38246
38291
 
@@ -49110,9 +49155,9 @@ function processDefineModel(ctx, node, declId) {
49110
49155
  let modelName;
49111
49156
  let options;
49112
49157
  const arg0 = node.arguments[0] && unwrapTSNode(node.arguments[0]);
49113
- const hasName = arg0 && arg0.type === "StringLiteral";
49158
+ const hasName = arg0 && (arg0.type === "StringLiteral" || arg0.type === "TemplateLiteral" && arg0.expressions.length === 0);
49114
49159
  if (hasName) {
49115
- modelName = arg0.value;
49160
+ modelName = arg0.type === "StringLiteral" ? arg0.value : arg0.quasis[0].value.cooked;
49116
49161
  options = node.arguments[1];
49117
49162
  } else {
49118
49163
  modelName = "modelValue";
@@ -50778,7 +50823,7 @@ var __spreadValues = (a, b) => {
50778
50823
  }
50779
50824
  return a;
50780
50825
  };
50781
- const version = "3.5.29";
50826
+ const version = "3.5.31";
50782
50827
  const parseCache = parseCache$1;
50783
50828
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
50784
50829
  const walk = walk$2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.5.29",
3
+ "version": "3.5.31",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "module": "dist/compiler-sfc.esm-browser.js",
@@ -42,15 +42,15 @@
42
42
  },
43
43
  "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
44
44
  "dependencies": {
45
- "@babel/parser": "^7.29.0",
45
+ "@babel/parser": "^7.29.2",
46
46
  "estree-walker": "^2.0.2",
47
47
  "magic-string": "^0.30.21",
48
- "postcss": "^8.5.6",
48
+ "postcss": "^8.5.8",
49
49
  "source-map-js": "^1.2.1",
50
- "@vue/shared": "3.5.29",
51
- "@vue/compiler-ssr": "3.5.29",
52
- "@vue/compiler-core": "3.5.29",
53
- "@vue/compiler-dom": "3.5.29"
50
+ "@vue/compiler-core": "3.5.31",
51
+ "@vue/compiler-dom": "3.5.31",
52
+ "@vue/shared": "3.5.31",
53
+ "@vue/compiler-ssr": "3.5.31"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@babel/types": "^7.29.0",
@@ -58,10 +58,10 @@
58
58
  "hash-sum": "^2.0.0",
59
59
  "lru-cache": "10.1.0",
60
60
  "merge-source-map": "^1.1.0",
61
- "minimatch": "~10.2.0",
61
+ "minimatch": "~10.2.4",
62
62
  "postcss-modules": "^6.0.1",
63
63
  "postcss-selector-parser": "^7.1.1",
64
- "pug": "^3.0.3",
65
- "sass": "^1.97.3"
64
+ "pug": "^3.0.4",
65
+ "sass": "^1.98.0"
66
66
  }
67
67
  }