@herb-tools/core 0.6.1 → 0.7.1

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.
@@ -131,7 +131,7 @@ class Token {
131
131
  }
132
132
 
133
133
  // NOTE: This file is generated by the templates/template.rb script and should not
134
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.1/templates/javascript/packages/core/src/errors.ts.erb
134
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.1/templates/javascript/packages/core/src/errors.ts.erb
135
135
  class HerbError {
136
136
  type;
137
137
  message;
@@ -588,7 +588,7 @@ function convertToUTF8(string) {
588
588
  }
589
589
 
590
590
  // NOTE: This file is generated by the templates/template.rb script and should not
591
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.1/templates/javascript/packages/core/src/nodes.ts.erb
591
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.1/templates/javascript/packages/core/src/nodes.ts.erb
592
592
  class Node {
593
593
  type;
594
594
  location;
@@ -628,7 +628,7 @@ class Node {
628
628
  return "∅\n";
629
629
  if (array.length === 0)
630
630
  return "[]\n";
631
- let output = `(${array.length} item${array.length == 1 ? "" : "s"})\n`;
631
+ let output = `(${array.length} item${array.length === 1 ? "" : "s"})\n`;
632
632
  array.forEach((item, index) => {
633
633
  const isLast = index === array.length - 1;
634
634
  if (item instanceof Node || item instanceof HerbError) {
@@ -652,7 +652,7 @@ class Node {
652
652
  .treeInspect()
653
653
  .trimStart()
654
654
  .split("\n")
655
- .map((line, index) => index == 0 ? line.trimStart() : `${prefix}${prefix2}${line}`)
655
+ .map((line, index) => index === 0 ? line.trimStart() : `${prefix}${prefix2}${line}`)
656
656
  .join("\n")
657
657
  .trimStart();
658
658
  output += `\n`;
@@ -893,6 +893,7 @@ class HTMLElementNode extends Node {
893
893
  body;
894
894
  close_tag;
895
895
  is_void;
896
+ source;
896
897
  static get type() {
897
898
  return "AST_HTML_ELEMENT_NODE";
898
899
  }
@@ -906,6 +907,7 @@ class HTMLElementNode extends Node {
906
907
  body: (data.body || []).map(node => fromSerializedNode(node)),
907
908
  close_tag: data.close_tag ? fromSerializedNode((data.close_tag)) : null,
908
909
  is_void: data.is_void,
910
+ source: data.source,
909
911
  });
910
912
  }
911
913
  constructor(props) {
@@ -915,6 +917,7 @@ class HTMLElementNode extends Node {
915
917
  this.body = props.body;
916
918
  this.close_tag = props.close_tag;
917
919
  this.is_void = props.is_void;
920
+ this.source = props.source;
918
921
  }
919
922
  accept(visitor) {
920
923
  visitor.visitHTMLElementNode(this);
@@ -946,6 +949,7 @@ class HTMLElementNode extends Node {
946
949
  body: this.body.map(node => node.toJSON()),
947
950
  close_tag: this.close_tag ? this.close_tag.toJSON() : null,
948
951
  is_void: this.is_void,
952
+ source: this.source,
949
953
  };
950
954
  }
951
955
  treeInspect() {
@@ -956,7 +960,8 @@ class HTMLElementNode extends Node {
956
960
  output += `├── tag_name: ${this.tag_name ? this.tag_name.treeInspect() : "∅"}\n`;
957
961
  output += `├── body: ${this.inspectArray(this.body, "│ ")}`;
958
962
  output += `├── close_tag: ${this.inspectNode(this.close_tag, "│ ")}`;
959
- output += `└── is_void: ${typeof this.is_void === 'boolean' ? String(this.is_void) : "∅"}\n`;
963
+ output += `├── is_void: ${typeof this.is_void === 'boolean' ? String(this.is_void) : "∅"}\n`;
964
+ output += `└── source: ${this.source ? JSON.stringify(this.source) : "∅"}\n`;
960
965
  return output;
961
966
  }
962
967
  }
@@ -2836,7 +2841,7 @@ class ParseResult extends Result {
2836
2841
  }
2837
2842
 
2838
2843
  // NOTE: This file is generated by the templates/template.rb script and should not
2839
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.1/templates/javascript/packages/core/src/node-type-guards.ts.erb
2844
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.1/templates/javascript/packages/core/src/node-type-guards.ts.erb
2840
2845
  /**
2841
2846
  * Type guard functions for AST nodes.
2842
2847
  * These functions provide type checking by combining both instanceof
@@ -3457,7 +3462,11 @@ function filterERBInNodes(nodes) {
3457
3462
  * Checks if a node is an ERB output node (generates content: <%= %> or <%== %>)
3458
3463
  */
3459
3464
  function isERBOutputNode(node) {
3460
- return isNode(node, ERBContentNode) && ["<%=", "<%=="].includes(node.tag_opening?.value);
3465
+ if (!isNode(node, ERBContentNode))
3466
+ return false;
3467
+ if (!node.tag_opening?.value)
3468
+ return false;
3469
+ return ["<%=", "<%=="].includes(node.tag_opening?.value);
3461
3470
  }
3462
3471
  /**
3463
3472
  * Checks if a node is a non-output ERB node (control flow: <% %>)
@@ -3726,7 +3735,7 @@ function toMonacoDiagnostic(diagnostic) {
3726
3735
  }
3727
3736
 
3728
3737
  var name = "@herb-tools/core";
3729
- var version = "0.6.1";
3738
+ var version = "0.7.1";
3730
3739
  var packageJSON = {
3731
3740
  name: name,
3732
3741
  version: version};
@@ -3949,7 +3958,7 @@ class HerbBackend {
3949
3958
  }
3950
3959
 
3951
3960
  // NOTE: This file is generated by the templates/template.rb script and should not
3952
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.1/templates/javascript/packages/core/src/visitor.ts.erb
3961
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.1/templates/javascript/packages/core/src/visitor.ts.erb
3953
3962
  class Visitor {
3954
3963
  visit(node) {
3955
3964
  if (!node)