@vue/compiler-sfc 3.5.20 → 3.5.21

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.20
2
+ * @vue/compiler-sfc v3.5.21
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -2061,7 +2061,7 @@ function isRelativeUrl(url) {
2061
2061
  const firstChar = url.charAt(0);
2062
2062
  return firstChar === "." || firstChar === "~" || firstChar === "@";
2063
2063
  }
2064
- const externalRE = /^(https?:)?\/\//;
2064
+ const externalRE = /^(?:https?:)?\/\//;
2065
2065
  function isExternalUrl(url) {
2066
2066
  return externalRE.test(url);
2067
2067
  }
@@ -7985,8 +7985,8 @@ function requireDist$1 () {
7985
7985
  var distExports = /*@__PURE__*/ requireDist$1();
7986
7986
  var selectorParser = /*@__PURE__*/getDefaultExportFromCjs(distExports);
7987
7987
 
7988
- const animationNameRE = /^(-\w+-)?animation-name$/;
7989
- const animationRE = /^(-\w+-)?animation$/;
7988
+ const animationNameRE = /^(?:-\w+-)?animation-name$/;
7989
+ const animationRE = /^(?:-\w+-)?animation$/;
7990
7990
  const keyframesRE = /^(?:-\w+-)?keyframes$/;
7991
7991
  const scopedPlugin = (id = "") => {
7992
7992
  const keyframes = /* @__PURE__ */ Object.create(null);
@@ -19610,6 +19610,8 @@ const propNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~\-]/;
19610
19610
  function getEscapedPropName(key) {
19611
19611
  return propNameEscapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
19612
19612
  }
19613
+ const isJS = (...langs) => langs.some((lang) => lang === "js" || lang === "jsx");
19614
+ const isTS = (...langs) => langs.some((lang) => lang === "ts" || lang === "tsx");
19613
19615
 
19614
19616
  function analyzeScriptBindings(ast) {
19615
19617
  for (const node of ast) {
@@ -19710,8 +19712,8 @@ class ScriptCompileContext {
19710
19712
  const { script, scriptSetup } = descriptor;
19711
19713
  const scriptLang = script && script.lang;
19712
19714
  const scriptSetupLang = scriptSetup && scriptSetup.lang;
19713
- this.isJS = scriptLang === "js" || scriptLang === "jsx" || scriptSetupLang === "js" || scriptSetupLang === "jsx";
19714
- this.isTS = scriptLang === "ts" || scriptLang === "tsx" || scriptSetupLang === "ts" || scriptSetupLang === "tsx";
19715
+ this.isJS = isJS(scriptLang, scriptSetupLang);
19716
+ this.isTS = isTS(scriptLang, scriptSetupLang);
19715
19717
  const customElement = options.customElement;
19716
19718
  const filename = this.descriptor.filename;
19717
19719
  if (customElement) {
@@ -19890,9 +19892,6 @@ const normalScriptDefaultVar = `__default__`;
19890
19892
  function processNormalScript(ctx, scopeId) {
19891
19893
  var _a;
19892
19894
  const script = ctx.descriptor.script;
19893
- if (script.lang && !ctx.isJS && !ctx.isTS) {
19894
- return script;
19895
- }
19896
19895
  try {
19897
19896
  let content = script.content;
19898
19897
  let map = script.map;
@@ -22651,14 +22650,19 @@ function resolveWithTS(containingFile, source, ts2, fs) {
22651
22650
  if (configs.length === 1) {
22652
22651
  matchedConfig = configs[0];
22653
22652
  } else {
22653
+ const [major, minor] = ts2.versionMajorMinor.split(".").map(Number);
22654
+ const getPattern = (base, p) => {
22655
+ const supportsConfigDir = major > 5 || major === 5 && minor >= 5;
22656
+ return p.startsWith("${configDir}") && supportsConfigDir ? normalizePath(p.replace("${configDir}", path$1.dirname(configPath))) : joinPaths(base, p);
22657
+ };
22654
22658
  for (const c of configs) {
22655
22659
  const base = normalizePath(
22656
22660
  c.config.options.pathsBasePath || path$1.dirname(c.config.options.configFilePath)
22657
22661
  );
22658
22662
  const included = (_a = c.config.raw) == null ? void 0 : _a.include;
22659
22663
  const excluded = (_b = c.config.raw) == null ? void 0 : _b.exclude;
22660
- if (!included && (!base || containingFile.startsWith(base)) || (included == null ? void 0 : included.some((p) => minimatch(containingFile, joinPaths(base, p))))) {
22661
- if (excluded && excluded.some((p) => minimatch(containingFile, joinPaths(base, p)))) {
22664
+ if (!included && (!base || containingFile.startsWith(base)) || (included == null ? void 0 : included.some((p) => minimatch(containingFile, getPattern(base, p))))) {
22665
+ if (excluded && excluded.some((p) => minimatch(containingFile, getPattern(base, p)))) {
22662
22666
  continue;
22663
22667
  }
22664
22668
  matchedConfig = c;
@@ -22832,7 +22836,11 @@ function recordTypes(ctx, body, scope, asGlobal = false) {
22832
22836
  }
22833
22837
  } else if (stmt.type === "TSModuleDeclaration" && stmt.global) {
22834
22838
  for (const s of stmt.body.body) {
22835
- recordType(s, types, declares);
22839
+ if (s.type === "ExportNamedDeclaration" && s.declaration) {
22840
+ recordType(s.declaration, types, declares);
22841
+ } else {
22842
+ recordType(s, types, declares);
22843
+ }
22836
22844
  }
22837
22845
  }
22838
22846
  } else {
@@ -24195,21 +24203,26 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
24195
24203
  const scopeId = options.id ? options.id.replace(/^data-v-/, "") : "";
24196
24204
  const scriptLang = script && script.lang;
24197
24205
  const scriptSetupLang = scriptSetup && scriptSetup.lang;
24206
+ const isJSOrTS = isJS(scriptLang, scriptSetupLang) || isTS(scriptLang, scriptSetupLang);
24198
24207
  if (script && scriptSetup && scriptLang !== scriptSetupLang) {
24199
24208
  throw new Error(
24200
24209
  `[@vue/compiler-sfc] <script> and <script setup> must have the same language type.`
24201
24210
  );
24202
24211
  }
24203
- const ctx = new ScriptCompileContext(sfc, options);
24204
24212
  if (!scriptSetup) {
24205
24213
  if (!script) {
24206
24214
  throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`);
24207
24215
  }
24208
- return processNormalScript(ctx, scopeId);
24216
+ if (script.lang && !isJSOrTS) {
24217
+ return script;
24218
+ }
24219
+ const ctx2 = new ScriptCompileContext(sfc, options);
24220
+ return processNormalScript(ctx2, scopeId);
24209
24221
  }
24210
- if (scriptSetupLang && !ctx.isJS && !ctx.isTS) {
24222
+ if (scriptSetupLang && !isJSOrTS) {
24211
24223
  return scriptSetup;
24212
24224
  }
24225
+ const ctx = new ScriptCompileContext(sfc, options);
24213
24226
  const scriptBindings = /* @__PURE__ */ Object.create(null);
24214
24227
  const setupBindings = /* @__PURE__ */ Object.create(null);
24215
24228
  let defaultExport;
@@ -25014,7 +25027,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
25014
25027
  return generator.toJSON();
25015
25028
  }
25016
25029
 
25017
- const version = "3.5.20";
25030
+ const version = "3.5.21";
25018
25031
  const parseCache = parseCache$1;
25019
25032
  const errorMessages = {
25020
25033
  ...CompilerDOM.errorMessages,
@@ -1,9 +1,8 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.5.20
2
+ * @vue/compiler-sfc v3.5.21
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- /*! #__NO_SIDE_EFFECTS__ */
7
6
  // @__NO_SIDE_EFFECTS__
8
7
  function makeMap(str) {
9
8
  const map = /* @__PURE__ */ Object.create(null);
@@ -44,10 +43,10 @@ const cacheStringFunction = (fn) => {
44
43
  return hit || (cache[str] = fn(str));
45
44
  });
46
45
  };
47
- const camelizeRE = /-(\w)/g;
46
+ const camelizeRE = /-\w/g;
48
47
  const camelize = cacheStringFunction(
49
48
  (str) => {
50
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
49
+ return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
51
50
  }
52
51
  );
53
52
  const hyphenateRE = /\B([A-Z])/g;
@@ -17689,7 +17688,7 @@ const isMemberExpressionNode = (exp, context) => {
17689
17688
  }
17690
17689
  };
17691
17690
  const isMemberExpression = isMemberExpressionNode;
17692
- const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
17691
+ const fnExpRE = /^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/;
17693
17692
  const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
17694
17693
  const isFnExpressionNode = (exp, context) => {
17695
17694
  try {
@@ -23636,7 +23635,7 @@ function isConst(type) {
23636
23635
  }
23637
23636
 
23638
23637
  const transformIf = createStructuralDirectiveTransform(
23639
- /^(if|else|else-if)$/,
23638
+ /^(?:if|else|else-if)$/,
23640
23639
  (node, dir, context) => {
23641
23640
  return processIf(node, dir, context, (ifNode, branch, isRoot) => {
23642
23641
  const siblings = context.parent.children;
@@ -24233,7 +24232,9 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
24233
24232
  const dynamicSlots = [];
24234
24233
  let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
24235
24234
  if (!context.ssr && context.prefixIdentifiers) {
24236
- hasDynamicSlots = hasScopeRef(node, context.identifiers);
24235
+ hasDynamicSlots = node.props.some(
24236
+ (prop) => isVSlot(prop) && (hasScopeRef(prop.arg, context.identifiers) || hasScopeRef(prop.exp, context.identifiers))
24237
+ ) || children.some((child) => hasScopeRef(child, context.identifiers));
24237
24238
  }
24238
24239
  const onComponentSlot = findDir(node, "slot", true);
24239
24240
  if (onComponentSlot) {
@@ -24296,7 +24297,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
24296
24297
  );
24297
24298
  } else if (vElse = findDir(
24298
24299
  slotElement,
24299
- /^else(-if)?$/,
24300
+ /^else(?:-if)?$/,
24300
24301
  true
24301
24302
  /* allowEmpty */
24302
24303
  )) {
@@ -24308,7 +24309,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
24308
24309
  break;
24309
24310
  }
24310
24311
  }
24311
- if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
24312
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
24312
24313
  let conditional = dynamicSlots[dynamicSlots.length - 1];
24313
24314
  while (conditional.alternate.type === 19) {
24314
24315
  conditional = conditional.alternate;
@@ -26015,7 +26016,7 @@ const getCachedNode = (node) => {
26015
26016
  return node.codegenNode;
26016
26017
  }
26017
26018
  };
26018
- const dataAriaRE = /^(data|aria)-/;
26019
+ const dataAriaRE = /^(?:data|aria)-/;
26019
26020
  const isStringifiableAttr = (name, ns) => {
26020
26021
  return (ns === 0 ? isKnownHtmlAttr(name) : ns === 1 ? isKnownSvgAttr(name) : ns === 2 ? isKnownMathMLAttr(name) : false) || dataAriaRE.test(name);
26021
26022
  };
@@ -31531,7 +31532,7 @@ function isRelativeUrl(url) {
31531
31532
  const firstChar = url.charAt(0);
31532
31533
  return firstChar === "." || firstChar === "~" || firstChar === "@";
31533
31534
  }
31534
- const externalRE = /^(https?:)?\/\//;
31535
+ const externalRE = /^(?:https?:)?\/\//;
31535
31536
  function isExternalUrl(url) {
31536
31537
  return externalRE.test(url);
31537
31538
  }
@@ -31844,7 +31845,7 @@ const ssrHelpers = {
31844
31845
  registerRuntimeHelpers(ssrHelpers);
31845
31846
 
31846
31847
  const ssrTransformIf = createStructuralDirectiveTransform(
31847
- /^(if|else|else-if)$/,
31848
+ /^(?:if|else|else-if)$/,
31848
31849
  processIf
31849
31850
  );
31850
31851
  function ssrProcessIf(node, context, disableNestedFragments = false, disableComment = false) {
@@ -41899,8 +41900,8 @@ function requireDist () {
41899
41900
  var distExports = /*@__PURE__*/ requireDist();
41900
41901
  var selectorParser = /*@__PURE__*/getDefaultExportFromCjs(distExports);
41901
41902
 
41902
- const animationNameRE = /^(-\w+-)?animation-name$/;
41903
- const animationRE = /^(-\w+-)?animation$/;
41903
+ const animationNameRE = /^(?:-\w+-)?animation-name$/;
41904
+ const animationRE = /^(?:-\w+-)?animation$/;
41904
41905
  const keyframesRE = /^(?:-\w+-)?keyframes$/;
41905
41906
  const scopedPlugin = (id = "") => {
41906
41907
  const keyframes = /* @__PURE__ */ Object.create(null);
@@ -45740,6 +45741,8 @@ const propNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~\-]/;
45740
45741
  function getEscapedPropName(key) {
45741
45742
  return propNameEscapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
45742
45743
  }
45744
+ const isJS = (...langs) => langs.some((lang) => lang === "js" || lang === "jsx");
45745
+ const isTS = (...langs) => langs.some((lang) => lang === "ts" || lang === "tsx");
45743
45746
 
45744
45747
  function analyzeScriptBindings(ast) {
45745
45748
  for (const node of ast) {
@@ -45810,97 +45813,88 @@ function getObjectOrArrayExpressionKeys(value) {
45810
45813
  return [];
45811
45814
  }
45812
45815
 
45813
- const comma = ','.charCodeAt(0);
45814
- const semicolon = ';'.charCodeAt(0);
45815
- const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
45816
- const intToChar = new Uint8Array(64); // 64 possible chars.
45817
- const charToInt = new Uint8Array(128); // z is 122 in ASCII
45816
+ // src/vlq.ts
45817
+ var comma = ",".charCodeAt(0);
45818
+ var semicolon = ";".charCodeAt(0);
45819
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
45820
+ var intToChar = new Uint8Array(64);
45821
+ var charToInt = new Uint8Array(128);
45818
45822
  for (let i = 0; i < chars.length; i++) {
45819
- const c = chars.charCodeAt(i);
45820
- intToChar[i] = c;
45821
- charToInt[c] = i;
45823
+ const c = chars.charCodeAt(i);
45824
+ intToChar[i] = c;
45825
+ charToInt[c] = i;
45822
45826
  }
45823
45827
  function encodeInteger(builder, num, relative) {
45824
- let delta = num - relative;
45825
- delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;
45826
- do {
45827
- let clamped = delta & 0b011111;
45828
- delta >>>= 5;
45829
- if (delta > 0)
45830
- clamped |= 0b100000;
45831
- builder.write(intToChar[clamped]);
45832
- } while (delta > 0);
45833
- return num;
45834
- }
45835
-
45836
- const bufLength = 1024 * 16;
45837
- // Provide a fallback for older environments.
45838
- const td = typeof TextDecoder !== 'undefined'
45839
- ? /* #__PURE__ */ new TextDecoder()
45840
- : typeof Buffer !== 'undefined'
45841
- ? {
45842
- decode(buf) {
45843
- const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
45844
- return out.toString();
45845
- },
45846
- }
45847
- : {
45848
- decode(buf) {
45849
- let out = '';
45850
- for (let i = 0; i < buf.length; i++) {
45851
- out += String.fromCharCode(buf[i]);
45852
- }
45853
- return out;
45854
- },
45855
- };
45856
- class StringWriter {
45857
- constructor() {
45858
- this.pos = 0;
45859
- this.out = '';
45860
- this.buffer = new Uint8Array(bufLength);
45861
- }
45862
- write(v) {
45863
- const { buffer } = this;
45864
- buffer[this.pos++] = v;
45865
- if (this.pos === bufLength) {
45866
- this.out += td.decode(buffer);
45867
- this.pos = 0;
45868
- }
45869
- }
45870
- flush() {
45871
- const { buffer, out, pos } = this;
45872
- return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
45828
+ let delta = num - relative;
45829
+ delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
45830
+ do {
45831
+ let clamped = delta & 31;
45832
+ delta >>>= 5;
45833
+ if (delta > 0) clamped |= 32;
45834
+ builder.write(intToChar[clamped]);
45835
+ } while (delta > 0);
45836
+ return num;
45837
+ }
45838
+
45839
+ // src/strings.ts
45840
+ var bufLength = 1024 * 16;
45841
+ var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
45842
+ decode(buf) {
45843
+ const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
45844
+ return out.toString();
45845
+ }
45846
+ } : {
45847
+ decode(buf) {
45848
+ let out = "";
45849
+ for (let i = 0; i < buf.length; i++) {
45850
+ out += String.fromCharCode(buf[i]);
45851
+ }
45852
+ return out;
45853
+ }
45854
+ };
45855
+ var StringWriter = class {
45856
+ constructor() {
45857
+ this.pos = 0;
45858
+ this.out = "";
45859
+ this.buffer = new Uint8Array(bufLength);
45860
+ }
45861
+ write(v) {
45862
+ const { buffer } = this;
45863
+ buffer[this.pos++] = v;
45864
+ if (this.pos === bufLength) {
45865
+ this.out += td.decode(buffer);
45866
+ this.pos = 0;
45873
45867
  }
45874
- }
45868
+ }
45869
+ flush() {
45870
+ const { buffer, out, pos } = this;
45871
+ return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
45872
+ }
45873
+ };
45875
45874
  function encode(decoded) {
45876
- const writer = new StringWriter();
45877
- let sourcesIndex = 0;
45878
- let sourceLine = 0;
45879
- let sourceColumn = 0;
45880
- let namesIndex = 0;
45881
- for (let i = 0; i < decoded.length; i++) {
45882
- const line = decoded[i];
45883
- if (i > 0)
45884
- writer.write(semicolon);
45885
- if (line.length === 0)
45886
- continue;
45887
- let genColumn = 0;
45888
- for (let j = 0; j < line.length; j++) {
45889
- const segment = line[j];
45890
- if (j > 0)
45891
- writer.write(comma);
45892
- genColumn = encodeInteger(writer, segment[0], genColumn);
45893
- if (segment.length === 1)
45894
- continue;
45895
- sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
45896
- sourceLine = encodeInteger(writer, segment[2], sourceLine);
45897
- sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
45898
- if (segment.length === 4)
45899
- continue;
45900
- namesIndex = encodeInteger(writer, segment[4], namesIndex);
45901
- }
45902
- }
45903
- return writer.flush();
45875
+ const writer = new StringWriter();
45876
+ let sourcesIndex = 0;
45877
+ let sourceLine = 0;
45878
+ let sourceColumn = 0;
45879
+ let namesIndex = 0;
45880
+ for (let i = 0; i < decoded.length; i++) {
45881
+ const line = decoded[i];
45882
+ if (i > 0) writer.write(semicolon);
45883
+ if (line.length === 0) continue;
45884
+ let genColumn = 0;
45885
+ for (let j = 0; j < line.length; j++) {
45886
+ const segment = line[j];
45887
+ if (j > 0) writer.write(comma);
45888
+ genColumn = encodeInteger(writer, segment[0], genColumn);
45889
+ if (segment.length === 1) continue;
45890
+ sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
45891
+ sourceLine = encodeInteger(writer, segment[2], sourceLine);
45892
+ sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
45893
+ if (segment.length === 4) continue;
45894
+ namesIndex = encodeInteger(writer, segment[4], namesIndex);
45895
+ }
45896
+ }
45897
+ return writer.flush();
45904
45898
  }
45905
45899
 
45906
45900
  class BitSet {
@@ -46940,12 +46934,18 @@ class MagicString {
46940
46934
  if (this.byStart[index] || this.byEnd[index]) return;
46941
46935
 
46942
46936
  let chunk = this.lastSearchedChunk;
46937
+ let previousChunk = chunk;
46943
46938
  const searchForward = index > chunk.end;
46944
46939
 
46945
46940
  while (chunk) {
46946
46941
  if (chunk.contains(index)) return this._splitChunk(chunk, index);
46947
46942
 
46948
46943
  chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
46944
+
46945
+ // Prevent infinite loop (e.g. via empty chunks, where start === end)
46946
+ if (chunk === previousChunk) return;
46947
+
46948
+ previousChunk = chunk;
46949
46949
  }
46950
46950
  }
46951
46951
 
@@ -47207,8 +47207,8 @@ class ScriptCompileContext {
47207
47207
  const { script, scriptSetup } = descriptor;
47208
47208
  const scriptLang = script && script.lang;
47209
47209
  const scriptSetupLang = scriptSetup && scriptSetup.lang;
47210
- this.isJS = scriptLang === "js" || scriptLang === "jsx" || scriptSetupLang === "js" || scriptSetupLang === "jsx";
47211
- this.isTS = scriptLang === "ts" || scriptLang === "tsx" || scriptSetupLang === "ts" || scriptSetupLang === "tsx";
47210
+ this.isJS = isJS(scriptLang, scriptSetupLang);
47211
+ this.isTS = isTS(scriptLang, scriptSetupLang);
47212
47212
  const customElement = options.customElement;
47213
47213
  const filename = this.descriptor.filename;
47214
47214
  if (customElement) {
@@ -47406,9 +47406,6 @@ const normalScriptDefaultVar = `__default__`;
47406
47406
  function processNormalScript(ctx, scopeId) {
47407
47407
  var _a;
47408
47408
  const script = ctx.descriptor.script;
47409
- if (script.lang && !ctx.isJS && !ctx.isTS) {
47410
- return script;
47411
- }
47412
47409
  try {
47413
47410
  let content = script.content;
47414
47411
  let map = script.map;
@@ -48258,7 +48255,11 @@ function recordTypes(ctx, body, scope, asGlobal = false) {
48258
48255
  }
48259
48256
  } else if (stmt.type === "TSModuleDeclaration" && stmt.global) {
48260
48257
  for (const s of stmt.body.body) {
48261
- recordType(s, types, declares);
48258
+ if (s.type === "ExportNamedDeclaration" && s.declaration) {
48259
+ recordType(s.declaration, types, declares);
48260
+ } else {
48261
+ recordType(s, types, declares);
48262
+ }
48262
48263
  }
48263
48264
  }
48264
48265
  } else {
@@ -49640,21 +49641,26 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
49640
49641
  const scopeId = options.id ? options.id.replace(/^data-v-/, "") : "";
49641
49642
  const scriptLang = script && script.lang;
49642
49643
  const scriptSetupLang = scriptSetup && scriptSetup.lang;
49644
+ const isJSOrTS = isJS(scriptLang, scriptSetupLang) || isTS(scriptLang, scriptSetupLang);
49643
49645
  if (script && scriptSetup && scriptLang !== scriptSetupLang) {
49644
49646
  throw new Error(
49645
49647
  `[@vue/compiler-sfc] <script> and <script setup> must have the same language type.`
49646
49648
  );
49647
49649
  }
49648
- const ctx = new ScriptCompileContext(sfc, options);
49649
49650
  if (!scriptSetup) {
49650
49651
  if (!script) {
49651
49652
  throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`);
49652
49653
  }
49653
- return processNormalScript(ctx, scopeId);
49654
+ if (script.lang && !isJSOrTS) {
49655
+ return script;
49656
+ }
49657
+ const ctx2 = new ScriptCompileContext(sfc, options);
49658
+ return processNormalScript(ctx2, scopeId);
49654
49659
  }
49655
- if (scriptSetupLang && !ctx.isJS && !ctx.isTS) {
49660
+ if (scriptSetupLang && !isJSOrTS) {
49656
49661
  return scriptSetup;
49657
49662
  }
49663
+ const ctx = new ScriptCompileContext(sfc, options);
49658
49664
  const scriptBindings = /* @__PURE__ */ Object.create(null);
49659
49665
  const setupBindings = /* @__PURE__ */ Object.create(null);
49660
49666
  let defaultExport;
@@ -50470,7 +50476,7 @@ var __spreadValues = (a, b) => {
50470
50476
  }
50471
50477
  return a;
50472
50478
  };
50473
- const version = "3.5.20";
50479
+ const version = "3.5.21";
50474
50480
  const parseCache = parseCache$1;
50475
50481
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
50476
50482
  const walk = walk$2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.5.20",
3
+ "version": "3.5.21",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "module": "dist/compiler-sfc.esm-browser.js",
@@ -44,13 +44,13 @@
44
44
  "dependencies": {
45
45
  "@babel/parser": "^7.28.3",
46
46
  "estree-walker": "^2.0.2",
47
- "magic-string": "^0.30.17",
47
+ "magic-string": "^0.30.18",
48
48
  "postcss": "^8.5.6",
49
49
  "source-map-js": "^1.2.1",
50
- "@vue/compiler-core": "3.5.20",
51
- "@vue/compiler-dom": "3.5.20",
52
- "@vue/compiler-ssr": "3.5.20",
53
- "@vue/shared": "3.5.20"
50
+ "@vue/compiler-core": "3.5.21",
51
+ "@vue/compiler-dom": "3.5.21",
52
+ "@vue/compiler-ssr": "3.5.21",
53
+ "@vue/shared": "3.5.21"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@babel/types": "^7.28.2",