@vue/compiler-core 3.5.4 → 3.5.5

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-core v3.5.4
2
+ * @vue/compiler-core v3.5.5
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -636,7 +636,7 @@ class Tokenizer {
636
636
  if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
637
637
  if (c === 38) {
638
638
  this.startEntity();
639
- } else if (c === this.delimiterOpen[0]) {
639
+ } else if (!this.inVPre && c === this.delimiterOpen[0]) {
640
640
  this.state = 2;
641
641
  this.delimiterIndex = 0;
642
642
  this.stateInterpolationOpen(c);
@@ -2227,6 +2227,7 @@ const defaultParserOptions = {
2227
2227
  getNamespace: () => 0,
2228
2228
  isVoidTag: shared.NO,
2229
2229
  isPreTag: shared.NO,
2230
+ isIgnoreNewlineTag: shared.NO,
2230
2231
  isCustomElement: shared.NO,
2231
2232
  onError: defaultOnError,
2232
2233
  onWarn: defaultOnWarn,
@@ -2666,7 +2667,7 @@ function onCloseTag(el, end, isImplied = false) {
2666
2667
  el.innerLoc.end.offset
2667
2668
  );
2668
2669
  }
2669
- const { tag, ns } = el;
2670
+ const { tag, ns, children } = el;
2670
2671
  if (!inVPre) {
2671
2672
  if (tag === "slot") {
2672
2673
  el.tagType = 2;
@@ -2677,7 +2678,13 @@ function onCloseTag(el, end, isImplied = false) {
2677
2678
  }
2678
2679
  }
2679
2680
  if (!tokenizer.inRCDATA) {
2680
- el.children = condenseWhitespace(el.children, el.tag);
2681
+ el.children = condenseWhitespace(children);
2682
+ }
2683
+ if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
2684
+ const first = children[0];
2685
+ if (first && first.type === 2) {
2686
+ first.content = first.content.replace(/^\r?\n/, "");
2687
+ }
2681
2688
  }
2682
2689
  if (ns === 0 && currentOptions.isPreTag(tag)) {
2683
2690
  inPre--;
@@ -2829,12 +2836,6 @@ function condenseWhitespace(nodes, tag) {
2829
2836
  }
2830
2837
  }
2831
2838
  }
2832
- if (inPre && tag && currentOptions.isPreTag(tag)) {
2833
- const first = nodes[0];
2834
- if (first && first.type === 2) {
2835
- first.content = first.content.replace(/^\r?\n/, "");
2836
- }
2837
- }
2838
2839
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
2839
2840
  }
2840
2841
  function isAllWhitespace(str) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-core v3.5.4
2
+ * @vue/compiler-core v3.5.5
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -636,7 +636,7 @@ class Tokenizer {
636
636
  if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
637
637
  if (c === 38) {
638
638
  this.startEntity();
639
- } else if (c === this.delimiterOpen[0]) {
639
+ } else if (!this.inVPre && c === this.delimiterOpen[0]) {
640
640
  this.state = 2;
641
641
  this.delimiterIndex = 0;
642
642
  this.stateInterpolationOpen(c);
@@ -2223,6 +2223,7 @@ const defaultParserOptions = {
2223
2223
  getNamespace: () => 0,
2224
2224
  isVoidTag: shared.NO,
2225
2225
  isPreTag: shared.NO,
2226
+ isIgnoreNewlineTag: shared.NO,
2226
2227
  isCustomElement: shared.NO,
2227
2228
  onError: defaultOnError,
2228
2229
  onWarn: defaultOnWarn,
@@ -2662,7 +2663,7 @@ function onCloseTag(el, end, isImplied = false) {
2662
2663
  el.innerLoc.end.offset
2663
2664
  );
2664
2665
  }
2665
- const { tag, ns } = el;
2666
+ const { tag, ns, children } = el;
2666
2667
  if (!inVPre) {
2667
2668
  if (tag === "slot") {
2668
2669
  el.tagType = 2;
@@ -2673,7 +2674,13 @@ function onCloseTag(el, end, isImplied = false) {
2673
2674
  }
2674
2675
  }
2675
2676
  if (!tokenizer.inRCDATA) {
2676
- el.children = condenseWhitespace(el.children, el.tag);
2677
+ el.children = condenseWhitespace(children);
2678
+ }
2679
+ if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
2680
+ const first = children[0];
2681
+ if (first && first.type === 2) {
2682
+ first.content = first.content.replace(/^\r?\n/, "");
2683
+ }
2677
2684
  }
2678
2685
  if (ns === 0 && currentOptions.isPreTag(tag)) {
2679
2686
  inPre--;
@@ -2795,12 +2802,6 @@ function condenseWhitespace(nodes, tag) {
2795
2802
  }
2796
2803
  }
2797
2804
  }
2798
- if (inPre && tag && currentOptions.isPreTag(tag)) {
2799
- const first = nodes[0];
2800
- if (first && first.type === 2) {
2801
- first.content = first.content.replace(/^\r?\n/, "");
2802
- }
2803
- }
2804
2805
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
2805
2806
  }
2806
2807
  function isAllWhitespace(str) {
@@ -661,6 +661,11 @@ export interface ParserOptions extends ErrorHandlingOptions, CompilerCompatOptio
661
661
  * e.g. elements that should preserve whitespace inside, e.g. `<pre>`
662
662
  */
663
663
  isPreTag?: (tag: string) => boolean;
664
+ /**
665
+ * Elements that should ignore the first newline token per parinsg spec
666
+ * e.g. `<textarea>` and `<pre>`
667
+ */
668
+ isIgnoreNewlineTag?: (tag: string) => boolean;
664
669
  /**
665
670
  * Platform-specific built-in components e.g. `<Transition>`
666
671
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-core v3.5.4
2
+ * @vue/compiler-core v3.5.5
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -619,7 +619,7 @@ class Tokenizer {
619
619
  this.sequenceIndex += 1;
620
620
  } else if (this.sequenceIndex === 0) {
621
621
  if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
622
- if (c === this.delimiterOpen[0]) {
622
+ if (!this.inVPre && c === this.delimiterOpen[0]) {
623
623
  this.state = 2;
624
624
  this.delimiterIndex = 0;
625
625
  this.stateInterpolationOpen(c);
@@ -1910,6 +1910,7 @@ const defaultParserOptions = {
1910
1910
  getNamespace: () => 0,
1911
1911
  isVoidTag: NO,
1912
1912
  isPreTag: NO,
1913
+ isIgnoreNewlineTag: NO,
1913
1914
  isCustomElement: NO,
1914
1915
  onError: defaultOnError,
1915
1916
  onWarn: defaultOnWarn,
@@ -2352,7 +2353,7 @@ function onCloseTag(el, end, isImplied = false) {
2352
2353
  el.innerLoc.end.offset
2353
2354
  );
2354
2355
  }
2355
- const { tag, ns } = el;
2356
+ const { tag, ns, children } = el;
2356
2357
  if (!inVPre) {
2357
2358
  if (tag === "slot") {
2358
2359
  el.tagType = 2;
@@ -2363,7 +2364,13 @@ function onCloseTag(el, end, isImplied = false) {
2363
2364
  }
2364
2365
  }
2365
2366
  if (!tokenizer.inRCDATA) {
2366
- el.children = condenseWhitespace(el.children, el.tag);
2367
+ el.children = condenseWhitespace(children);
2368
+ }
2369
+ if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
2370
+ const first = children[0];
2371
+ if (first && first.type === 2) {
2372
+ first.content = first.content.replace(/^\r?\n/, "");
2373
+ }
2367
2374
  }
2368
2375
  if (ns === 0 && currentOptions.isPreTag(tag)) {
2369
2376
  inPre--;
@@ -2515,12 +2522,6 @@ function condenseWhitespace(nodes, tag) {
2515
2522
  }
2516
2523
  }
2517
2524
  }
2518
- if (inPre && tag && currentOptions.isPreTag(tag)) {
2519
- const first = nodes[0];
2520
- if (first && first.type === 2) {
2521
- first.content = first.content.replace(/^\r?\n/, "");
2522
- }
2523
- }
2524
2525
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
2525
2526
  }
2526
2527
  function isAllWhitespace(str) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-core",
3
- "version": "3.5.4",
3
+ "version": "3.5.5",
4
4
  "description": "@vue/compiler-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/compiler-core.esm-bundler.js",
@@ -50,7 +50,7 @@
50
50
  "entities": "^4.5.0",
51
51
  "estree-walker": "^2.0.2",
52
52
  "source-map-js": "^1.2.0",
53
- "@vue/shared": "3.5.4"
53
+ "@vue/shared": "3.5.5"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@babel/types": "^7.25.2"