@herb-tools/core 0.6.1 → 0.7.0

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.
@@ -135,7 +135,7 @@
135
135
  }
136
136
 
137
137
  // NOTE: This file is generated by the templates/template.rb script and should not
138
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.1/templates/javascript/packages/core/src/errors.ts.erb
138
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/javascript/packages/core/src/errors.ts.erb
139
139
  class HerbError {
140
140
  type;
141
141
  message;
@@ -592,7 +592,7 @@
592
592
  }
593
593
 
594
594
  // NOTE: This file is generated by the templates/template.rb script and should not
595
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.1/templates/javascript/packages/core/src/nodes.ts.erb
595
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/javascript/packages/core/src/nodes.ts.erb
596
596
  class Node {
597
597
  type;
598
598
  location;
@@ -632,7 +632,7 @@
632
632
  return "∅\n";
633
633
  if (array.length === 0)
634
634
  return "[]\n";
635
- let output = `(${array.length} item${array.length == 1 ? "" : "s"})\n`;
635
+ let output = `(${array.length} item${array.length === 1 ? "" : "s"})\n`;
636
636
  array.forEach((item, index) => {
637
637
  const isLast = index === array.length - 1;
638
638
  if (item instanceof Node || item instanceof HerbError) {
@@ -656,7 +656,7 @@
656
656
  .treeInspect()
657
657
  .trimStart()
658
658
  .split("\n")
659
- .map((line, index) => index == 0 ? line.trimStart() : `${prefix}${prefix2}${line}`)
659
+ .map((line, index) => index === 0 ? line.trimStart() : `${prefix}${prefix2}${line}`)
660
660
  .join("\n")
661
661
  .trimStart();
662
662
  output += `\n`;
@@ -897,6 +897,7 @@
897
897
  body;
898
898
  close_tag;
899
899
  is_void;
900
+ source;
900
901
  static get type() {
901
902
  return "AST_HTML_ELEMENT_NODE";
902
903
  }
@@ -910,6 +911,7 @@
910
911
  body: (data.body || []).map(node => fromSerializedNode(node)),
911
912
  close_tag: data.close_tag ? fromSerializedNode((data.close_tag)) : null,
912
913
  is_void: data.is_void,
914
+ source: data.source,
913
915
  });
914
916
  }
915
917
  constructor(props) {
@@ -919,6 +921,7 @@
919
921
  this.body = props.body;
920
922
  this.close_tag = props.close_tag;
921
923
  this.is_void = props.is_void;
924
+ this.source = props.source;
922
925
  }
923
926
  accept(visitor) {
924
927
  visitor.visitHTMLElementNode(this);
@@ -950,6 +953,7 @@
950
953
  body: this.body.map(node => node.toJSON()),
951
954
  close_tag: this.close_tag ? this.close_tag.toJSON() : null,
952
955
  is_void: this.is_void,
956
+ source: this.source,
953
957
  };
954
958
  }
955
959
  treeInspect() {
@@ -960,7 +964,8 @@
960
964
  output += `├── tag_name: ${this.tag_name ? this.tag_name.treeInspect() : "∅"}\n`;
961
965
  output += `├── body: ${this.inspectArray(this.body, "│ ")}`;
962
966
  output += `├── close_tag: ${this.inspectNode(this.close_tag, "│ ")}`;
963
- output += `└── is_void: ${typeof this.is_void === 'boolean' ? String(this.is_void) : "∅"}\n`;
967
+ output += `├── is_void: ${typeof this.is_void === 'boolean' ? String(this.is_void) : "∅"}\n`;
968
+ output += `└── source: ${this.source ? JSON.stringify(this.source) : "∅"}\n`;
964
969
  return output;
965
970
  }
966
971
  }
@@ -2840,7 +2845,7 @@
2840
2845
  }
2841
2846
 
2842
2847
  // NOTE: This file is generated by the templates/template.rb script and should not
2843
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.1/templates/javascript/packages/core/src/node-type-guards.ts.erb
2848
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/javascript/packages/core/src/node-type-guards.ts.erb
2844
2849
  /**
2845
2850
  * Type guard functions for AST nodes.
2846
2851
  * These functions provide type checking by combining both instanceof
@@ -3461,7 +3466,11 @@
3461
3466
  * Checks if a node is an ERB output node (generates content: <%= %> or <%== %>)
3462
3467
  */
3463
3468
  function isERBOutputNode(node) {
3464
- return isNode(node, ERBContentNode) && ["<%=", "<%=="].includes(node.tag_opening?.value);
3469
+ if (!isNode(node, ERBContentNode))
3470
+ return false;
3471
+ if (!node.tag_opening?.value)
3472
+ return false;
3473
+ return ["<%=", "<%=="].includes(node.tag_opening?.value);
3465
3474
  }
3466
3475
  /**
3467
3476
  * Checks if a node is a non-output ERB node (control flow: <% %>)
@@ -3730,7 +3739,7 @@
3730
3739
  }
3731
3740
 
3732
3741
  var name = "@herb-tools/core";
3733
- var version = "0.6.1";
3742
+ var version = "0.7.0";
3734
3743
  var packageJSON = {
3735
3744
  name: name,
3736
3745
  version: version};
@@ -3953,7 +3962,7 @@
3953
3962
  }
3954
3963
 
3955
3964
  // NOTE: This file is generated by the templates/template.rb script and should not
3956
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.1/templates/javascript/packages/core/src/visitor.ts.erb
3965
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/javascript/packages/core/src/visitor.ts.erb
3957
3966
  class Visitor {
3958
3967
  visit(node) {
3959
3968
  if (!node)