@herb-tools/node 0.6.0 → 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.
package/binding.gyp CHANGED
@@ -18,6 +18,7 @@
18
18
  "./extension/libherb/ast_nodes.c",
19
19
  "./extension/libherb/ast_pretty_print.c",
20
20
  "./extension/libherb/buffer.c",
21
+ "./extension/libherb/element_source.c",
21
22
  "./extension/libherb/errors.c",
22
23
  "./extension/libherb/extract.c",
23
24
  "./extension/libherb/herb.c",
@@ -6,7 +6,7 @@ import { createRequire } from 'module';
6
6
  import { fileURLToPath } from 'url';
7
7
 
8
8
  var name = "@herb-tools/node";
9
- var version = "0.6.0";
9
+ var version = "0.7.0";
10
10
  var packageJSON = {
11
11
  name: name,
12
12
  version: version};
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.0/templates/javascript/packages/node/extension/error_helpers.cpp.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/javascript/packages/node/extension/error_helpers.cpp.erb
3
3
 
4
4
  #include <node_api.h>
5
5
  #include "error_helpers.h"
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.0/templates/javascript/packages/node/extension/error_helpers.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/javascript/packages/node/extension/error_helpers.h.erb
3
3
 
4
4
  #ifndef HERB_EXTENSION_ERRORS_H
5
5
  #define HERB_EXTENSION_ERRORS_H
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.0/templates/src/ast_nodes.c.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/src/ast_nodes.c.erb
3
3
 
4
4
  #include <stdio.h>
5
5
  #include <stdbool.h>
@@ -62,7 +62,7 @@ AST_HTML_CLOSE_TAG_NODE_T* ast_html_close_tag_node_init(token_T* tag_opening, to
62
62
  return html_close_tag_node;
63
63
  }
64
64
 
65
- AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag, token_T* tag_name, array_T* body, struct AST_HTML_CLOSE_TAG_NODE_STRUCT* close_tag, bool is_void, position_T* start_position, position_T* end_position, array_T* errors) {
65
+ AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag, token_T* tag_name, array_T* body, struct AST_HTML_CLOSE_TAG_NODE_STRUCT* close_tag, bool is_void, element_source_t source, position_T* start_position, position_T* end_position, array_T* errors) {
66
66
  AST_HTML_ELEMENT_NODE_T* html_element_node = malloc(sizeof(AST_HTML_ELEMENT_NODE_T));
67
67
 
68
68
  ast_node_init(&html_element_node->base, AST_HTML_ELEMENT_NODE, start_position, end_position, errors);
@@ -72,6 +72,7 @@ AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(struct AST_HTML_OPEN_TAG_NOD
72
72
  html_element_node->body = body;
73
73
  html_element_node->close_tag = close_tag;
74
74
  html_element_node->is_void = is_void;
75
+ html_element_node->source = source;
75
76
 
76
77
  return html_element_node;
77
78
  }
@@ -219,7 +220,7 @@ AST_ERB_ELSE_NODE_T* ast_erb_else_node_init(token_T* tag_opening, token_T* conte
219
220
  return erb_else_node;
220
221
  }
221
222
 
222
- AST_ERB_IF_NODE_T* ast_erb_if_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, AST_NODE_T* subsequent, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors) {
223
+ AST_ERB_IF_NODE_T* ast_erb_if_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_NODE_STRUCT* subsequent, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors) {
223
224
  AST_ERB_IF_NODE_T* erb_if_node = malloc(sizeof(AST_ERB_IF_NODE_T));
224
225
 
225
226
  ast_node_init(&erb_if_node->base, AST_ERB_IF_NODE, start_position, end_position, errors);
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.0/templates/src/include/ast_nodes.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/src/include/ast_nodes.h.erb
3
3
 
4
4
  #ifndef HERB_AST_NODES_H
5
5
  #define HERB_AST_NODES_H
@@ -13,6 +13,7 @@
13
13
  #include "location.h"
14
14
  #include "token_struct.h"
15
15
  #include "analyzed_ruby.h"
16
+ #include "element_source.h"
16
17
 
17
18
  typedef enum {
18
19
  AST_DOCUMENT_NODE,
@@ -90,6 +91,7 @@ typedef struct AST_HTML_ELEMENT_NODE_STRUCT {
90
91
  array_T* body;
91
92
  struct AST_HTML_CLOSE_TAG_NODE_STRUCT* close_tag;
92
93
  bool is_void;
94
+ element_source_t source;
93
95
  } AST_HTML_ELEMENT_NODE_T;
94
96
 
95
97
  typedef struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT {
@@ -181,7 +183,7 @@ typedef struct AST_ERB_IF_NODE_STRUCT {
181
183
  token_T* content;
182
184
  token_T* tag_closing;
183
185
  array_T* statements;
184
- AST_NODE_T* subsequent;
186
+ struct AST_NODE_STRUCT* subsequent;
185
187
  struct AST_ERB_END_NODE_STRUCT* end_node;
186
188
  } AST_ERB_IF_NODE_T;
187
189
 
@@ -309,7 +311,7 @@ AST_DOCUMENT_NODE_T* ast_document_node_init(array_T* children, position_T* start
309
311
  AST_LITERAL_NODE_T* ast_literal_node_init(const char* content, position_T* start_position, position_T* end_position, array_T* errors);
310
312
  AST_HTML_OPEN_TAG_NODE_T* ast_html_open_tag_node_init(token_T* tag_opening, token_T* tag_name, token_T* tag_closing, array_T* children, bool is_void, position_T* start_position, position_T* end_position, array_T* errors);
311
313
  AST_HTML_CLOSE_TAG_NODE_T* ast_html_close_tag_node_init(token_T* tag_opening, token_T* tag_name, array_T* children, token_T* tag_closing, position_T* start_position, position_T* end_position, array_T* errors);
312
- AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag, token_T* tag_name, array_T* body, struct AST_HTML_CLOSE_TAG_NODE_STRUCT* close_tag, bool is_void, position_T* start_position, position_T* end_position, array_T* errors);
314
+ AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag, token_T* tag_name, array_T* body, struct AST_HTML_CLOSE_TAG_NODE_STRUCT* close_tag, bool is_void, element_source_t source, position_T* start_position, position_T* end_position, array_T* errors);
313
315
  AST_HTML_ATTRIBUTE_VALUE_NODE_T* ast_html_attribute_value_node_init(token_T* open_quote, array_T* children, token_T* close_quote, bool quoted, position_T* start_position, position_T* end_position, array_T* errors);
314
316
  AST_HTML_ATTRIBUTE_NAME_NODE_T* ast_html_attribute_name_node_init(array_T* children, position_T* start_position, position_T* end_position, array_T* errors);
315
317
  AST_HTML_ATTRIBUTE_NODE_T* ast_html_attribute_node_init(struct AST_HTML_ATTRIBUTE_NAME_NODE_STRUCT* name, token_T* equals, struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT* value, position_T* start_position, position_T* end_position, array_T* errors);
@@ -322,7 +324,7 @@ AST_WHITESPACE_NODE_T* ast_whitespace_node_init(token_T* value, position_T* star
322
324
  AST_ERB_CONTENT_NODE_T* ast_erb_content_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, analyzed_ruby_T* analyzed_ruby, bool parsed, bool valid, position_T* start_position, position_T* end_position, array_T* errors);
323
325
  AST_ERB_END_NODE_T* ast_erb_end_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, position_T* start_position, position_T* end_position, array_T* errors);
324
326
  AST_ERB_ELSE_NODE_T* ast_erb_else_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, position_T* start_position, position_T* end_position, array_T* errors);
325
- AST_ERB_IF_NODE_T* ast_erb_if_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, AST_NODE_T* subsequent, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
327
+ AST_ERB_IF_NODE_T* ast_erb_if_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_NODE_STRUCT* subsequent, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
326
328
  AST_ERB_BLOCK_NODE_T* ast_erb_block_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* body, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
327
329
  AST_ERB_WHEN_NODE_T* ast_erb_when_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, position_T* start_position, position_T* end_position, array_T* errors);
328
330
  AST_ERB_CASE_NODE_T* ast_erb_case_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* children, array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.0/templates/src/ast_pretty_print.c.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/src/ast_pretty_print.c.erb
3
3
 
4
4
  #include "include/ast_node.h"
5
5
  #include "include/ast_nodes.h"
@@ -98,7 +98,8 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
98
98
  }
99
99
  buffer_append(buffer, "\n");
100
100
 
101
- pretty_print_boolean_property("is_void", html_element_node->is_void, indent, relative_indent, true, buffer);
101
+ pretty_print_boolean_property("is_void", html_element_node->is_void, indent, relative_indent, false, buffer);
102
+ pretty_print_string_property(element_source_to_string(html_element_node->source), "source", indent, relative_indent, true, buffer);
102
103
  } break;
103
104
 
104
105
  case AST_HTML_ATTRIBUTE_VALUE_NODE: {
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.0/templates/src/include/ast_pretty_print.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/src/include/ast_pretty_print.h.erb
3
3
 
4
4
  #ifndef HERB_AST_PRETTY_PRINT_H
5
5
  #define HERB_AST_PRETTY_PRINT_H
@@ -0,0 +1,11 @@
1
+ #include "include/element_source.h"
2
+
3
+ const char* element_source_to_string(element_source_t source) {
4
+ switch (source) {
5
+ case ELEMENT_SOURCE_HTML: return "HTML";
6
+ case ELEMENT_SOURCE_ACTIONVIEW: return "ActionView";
7
+ case ELEMENT_SOURCE_HAML: return "Haml";
8
+ case ELEMENT_SOURCE_SLIM: return "Slim";
9
+ default: return "Unknown";
10
+ }
11
+ }
@@ -0,0 +1,13 @@
1
+ #ifndef HERB_ELEMENT_SOURCE_H
2
+ #define HERB_ELEMENT_SOURCE_H
3
+
4
+ typedef enum {
5
+ ELEMENT_SOURCE_HTML,
6
+ ELEMENT_SOURCE_ACTIONVIEW,
7
+ ELEMENT_SOURCE_HAML,
8
+ ELEMENT_SOURCE_SLIM
9
+ } element_source_t;
10
+
11
+ const char* element_source_to_string(element_source_t source);
12
+
13
+ #endif
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.0/templates/src/errors.c.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/src/errors.c.erb
3
3
 
4
4
  #include "include/array.h"
5
5
  #include "include/errors.h"
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.0/templates/src/include/errors.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/src/include/errors.h.erb
3
3
 
4
4
  #ifndef HERB_ERRORS_H
5
5
  #define HERB_ERRORS_H
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.0/templates/src/include/ast_nodes.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/src/include/ast_nodes.h.erb
3
3
 
4
4
  #ifndef HERB_AST_NODES_H
5
5
  #define HERB_AST_NODES_H
@@ -13,6 +13,7 @@
13
13
  #include "location.h"
14
14
  #include "token_struct.h"
15
15
  #include "analyzed_ruby.h"
16
+ #include "element_source.h"
16
17
 
17
18
  typedef enum {
18
19
  AST_DOCUMENT_NODE,
@@ -90,6 +91,7 @@ typedef struct AST_HTML_ELEMENT_NODE_STRUCT {
90
91
  array_T* body;
91
92
  struct AST_HTML_CLOSE_TAG_NODE_STRUCT* close_tag;
92
93
  bool is_void;
94
+ element_source_t source;
93
95
  } AST_HTML_ELEMENT_NODE_T;
94
96
 
95
97
  typedef struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT {
@@ -181,7 +183,7 @@ typedef struct AST_ERB_IF_NODE_STRUCT {
181
183
  token_T* content;
182
184
  token_T* tag_closing;
183
185
  array_T* statements;
184
- AST_NODE_T* subsequent;
186
+ struct AST_NODE_STRUCT* subsequent;
185
187
  struct AST_ERB_END_NODE_STRUCT* end_node;
186
188
  } AST_ERB_IF_NODE_T;
187
189
 
@@ -309,7 +311,7 @@ AST_DOCUMENT_NODE_T* ast_document_node_init(array_T* children, position_T* start
309
311
  AST_LITERAL_NODE_T* ast_literal_node_init(const char* content, position_T* start_position, position_T* end_position, array_T* errors);
310
312
  AST_HTML_OPEN_TAG_NODE_T* ast_html_open_tag_node_init(token_T* tag_opening, token_T* tag_name, token_T* tag_closing, array_T* children, bool is_void, position_T* start_position, position_T* end_position, array_T* errors);
311
313
  AST_HTML_CLOSE_TAG_NODE_T* ast_html_close_tag_node_init(token_T* tag_opening, token_T* tag_name, array_T* children, token_T* tag_closing, position_T* start_position, position_T* end_position, array_T* errors);
312
- AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag, token_T* tag_name, array_T* body, struct AST_HTML_CLOSE_TAG_NODE_STRUCT* close_tag, bool is_void, position_T* start_position, position_T* end_position, array_T* errors);
314
+ AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag, token_T* tag_name, array_T* body, struct AST_HTML_CLOSE_TAG_NODE_STRUCT* close_tag, bool is_void, element_source_t source, position_T* start_position, position_T* end_position, array_T* errors);
313
315
  AST_HTML_ATTRIBUTE_VALUE_NODE_T* ast_html_attribute_value_node_init(token_T* open_quote, array_T* children, token_T* close_quote, bool quoted, position_T* start_position, position_T* end_position, array_T* errors);
314
316
  AST_HTML_ATTRIBUTE_NAME_NODE_T* ast_html_attribute_name_node_init(array_T* children, position_T* start_position, position_T* end_position, array_T* errors);
315
317
  AST_HTML_ATTRIBUTE_NODE_T* ast_html_attribute_node_init(struct AST_HTML_ATTRIBUTE_NAME_NODE_STRUCT* name, token_T* equals, struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT* value, position_T* start_position, position_T* end_position, array_T* errors);
@@ -322,7 +324,7 @@ AST_WHITESPACE_NODE_T* ast_whitespace_node_init(token_T* value, position_T* star
322
324
  AST_ERB_CONTENT_NODE_T* ast_erb_content_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, analyzed_ruby_T* analyzed_ruby, bool parsed, bool valid, position_T* start_position, position_T* end_position, array_T* errors);
323
325
  AST_ERB_END_NODE_T* ast_erb_end_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, position_T* start_position, position_T* end_position, array_T* errors);
324
326
  AST_ERB_ELSE_NODE_T* ast_erb_else_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, position_T* start_position, position_T* end_position, array_T* errors);
325
- AST_ERB_IF_NODE_T* ast_erb_if_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, AST_NODE_T* subsequent, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
327
+ AST_ERB_IF_NODE_T* ast_erb_if_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_NODE_STRUCT* subsequent, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
326
328
  AST_ERB_BLOCK_NODE_T* ast_erb_block_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* body, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
327
329
  AST_ERB_WHEN_NODE_T* ast_erb_when_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, position_T* start_position, position_T* end_position, array_T* errors);
328
330
  AST_ERB_CASE_NODE_T* ast_erb_case_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* children, array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.0/templates/src/include/ast_pretty_print.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/src/include/ast_pretty_print.h.erb
3
3
 
4
4
  #ifndef HERB_AST_PRETTY_PRINT_H
5
5
  #define HERB_AST_PRETTY_PRINT_H
@@ -0,0 +1,13 @@
1
+ #ifndef HERB_ELEMENT_SOURCE_H
2
+ #define HERB_ELEMENT_SOURCE_H
3
+
4
+ typedef enum {
5
+ ELEMENT_SOURCE_HTML,
6
+ ELEMENT_SOURCE_ACTIONVIEW,
7
+ ELEMENT_SOURCE_HAML,
8
+ ELEMENT_SOURCE_SLIM
9
+ } element_source_t;
10
+
11
+ const char* element_source_to_string(element_source_t source);
12
+
13
+ #endif
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.0/templates/src/include/errors.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/src/include/errors.h.erb
3
3
 
4
4
  #ifndef HERB_ERRORS_H
5
5
  #define HERB_ERRORS_H
@@ -1,6 +1,6 @@
1
1
  #ifndef HERB_VERSION_H
2
2
  #define HERB_VERSION_H
3
3
 
4
- #define HERB_VERSION "0.6.0"
4
+ #define HERB_VERSION "0.7.0"
5
5
 
6
6
  #endif
@@ -910,6 +910,7 @@ static AST_HTML_ELEMENT_NODE_T* parser_parse_html_self_closing_element(
910
910
  NULL,
911
911
  NULL,
912
912
  true,
913
+ ELEMENT_SOURCE_HTML,
913
914
  open_tag->base.location->start,
914
915
  open_tag->base.location->end,
915
916
  NULL
@@ -958,6 +959,7 @@ static AST_HTML_ELEMENT_NODE_T* parser_parse_html_regular_element(
958
959
  body,
959
960
  close_tag,
960
961
  false,
962
+ ELEMENT_SOURCE_HTML,
961
963
  open_tag->base.location->start,
962
964
  close_tag->base.location->end,
963
965
  errors
@@ -988,6 +990,7 @@ static AST_HTML_ELEMENT_NODE_T* parser_parse_html_element(parser_T* parser) {
988
990
  NULL,
989
991
  NULL,
990
992
  false,
993
+ ELEMENT_SOURCE_HTML,
991
994
  open_tag->base.location->start,
992
995
  open_tag->base.location->end,
993
996
  errors
@@ -173,6 +173,7 @@ AST_HTML_ELEMENT_NODE_T* parser_handle_missing_close_tag(
173
173
  body,
174
174
  NULL,
175
175
  false,
176
+ ELEMENT_SOURCE_HTML,
176
177
  open_tag->base.location->start,
177
178
  open_tag->base.location->end,
178
179
  errors
@@ -1,6 +1,6 @@
1
1
  #ifndef HERB_VERSION_H
2
2
  #define HERB_VERSION_H
3
3
 
4
- #define HERB_VERSION "0.6.0"
4
+ #define HERB_VERSION "0.7.0"
5
5
 
6
6
  #endif
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.0/templates/src/visitor.c.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/src/visitor.c.erb
3
3
 
4
4
  #include <stdio.h>
5
5
 
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.0/templates/javascript/packages/node/extension/nodes.cpp.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/javascript/packages/node/extension/nodes.cpp.erb
3
3
 
4
4
  #include <node_api.h>
5
5
  #include "error_helpers.h"
@@ -174,6 +174,9 @@ napi_value html_element_nodeNodeFromCStruct(napi_env env, AST_HTML_ELEMENT_NODE_
174
174
  napi_get_boolean(env, html_element_node->is_void, &is_void);
175
175
  napi_set_named_property(env, result, "is_void", is_void);
176
176
 
177
+ napi_value source = CreateString(env, element_source_to_string(html_element_node->source));
178
+ napi_set_named_property(env, result, "source", source);
179
+
177
180
 
178
181
  return result;
179
182
  }
package/extension/nodes.h CHANGED
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.6.0/templates/javascript/packages/node/extension/nodes.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.0/templates/javascript/packages/node/extension/nodes.h.erb
3
3
 
4
4
  #ifndef HERB_EXTENSION_NODES_H
5
5
  #define HERB_EXTENSION_NODES_H
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herb-tools/node",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Native Node.js addon for HTML-aware ERB parsing using Herb.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -48,7 +48,7 @@
48
48
  "host": "https://github.com/marcoroth/herb/releases/download/"
49
49
  },
50
50
  "dependencies": {
51
- "@herb-tools/core": "0.6.0",
51
+ "@herb-tools/core": "0.7.0",
52
52
  "@mapbox/node-pre-gyp": "^2.0.0",
53
53
  "node-addon-api": "^5.1.0",
54
54
  "node-pre-gyp-github": "^2.0.0"
package/src/util.ts CHANGED
@@ -25,7 +25,7 @@ export function resolvePath(relativePath: string) {
25
25
  const { fileURLToPath } = require("url")
26
26
  const currentFileUrl = import.meta.url
27
27
  basePath = path.dirname(fileURLToPath(currentFileUrl))
28
- } catch (error) {
28
+ } catch {
29
29
  // Fallback for environments where neither is available
30
30
  basePath = process.cwd()
31
31
  }