@herb-tools/node 0.8.3 → 0.8.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.
Files changed (37) hide show
  1. package/dist/herb-node.esm.js +1 -1
  2. package/extension/error_helpers.cpp +28 -2
  3. package/extension/error_helpers.h +2 -1
  4. package/extension/extension_helpers.cpp +1 -1
  5. package/extension/libherb/analyze.c +39 -28
  6. package/extension/libherb/analyze_helpers.c +179 -84
  7. package/extension/libherb/analyze_helpers.h +1 -0
  8. package/extension/libherb/analyze_missing_end.c +1 -1
  9. package/extension/libherb/analyze_transform.c +1 -1
  10. package/extension/libherb/analyzed_ruby.c +26 -25
  11. package/extension/libherb/analyzed_ruby.h +19 -18
  12. package/extension/libherb/ast_node.c +1 -1
  13. package/extension/libherb/ast_nodes.c +158 -54
  14. package/extension/libherb/ast_nodes.h +1 -1
  15. package/extension/libherb/ast_pretty_print.c +17 -16
  16. package/extension/libherb/ast_pretty_print.h +1 -1
  17. package/extension/libherb/errors.c +43 -6
  18. package/extension/libherb/errors.h +9 -1
  19. package/extension/libherb/extract.c +4 -3
  20. package/extension/libherb/herb.c +2 -2
  21. package/extension/libherb/include/analyze_helpers.h +1 -0
  22. package/extension/libherb/include/analyzed_ruby.h +19 -18
  23. package/extension/libherb/include/ast_nodes.h +1 -1
  24. package/extension/libherb/include/ast_pretty_print.h +1 -1
  25. package/extension/libherb/include/errors.h +9 -1
  26. package/extension/libherb/include/version.h +1 -1
  27. package/extension/libherb/lexer.c +3 -3
  28. package/extension/libherb/parser.c +10 -8
  29. package/extension/libherb/parser_helpers.c +9 -9
  30. package/extension/libherb/parser_match_tags.c +1 -1
  31. package/extension/libherb/pretty_print.c +6 -6
  32. package/extension/libherb/version.h +1 -1
  33. package/extension/libherb/visitor.c +27 -27
  34. package/extension/nodes.cpp +2 -2
  35. package/extension/nodes.h +1 -1
  36. package/package.json +2 -2
  37. package/CHANGELOG.md +0 -19
@@ -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.8.3/templates/src/visitor.c.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/src/visitor.c.erb
3
3
 
4
4
  #include <stdio.h>
5
5
 
@@ -24,7 +24,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
24
24
  const AST_DOCUMENT_NODE_T* document_node = ((const AST_DOCUMENT_NODE_T *) node);
25
25
 
26
26
  if (document_node->children != NULL) {
27
- for (size_t index = 0; index < hb_array_size(document_node->children); index++) {
27
+ for (size_t index = 0; index < document_node->children->size; index++) {
28
28
  herb_visit_node(hb_array_get(document_node->children, index), visitor, data);
29
29
  }
30
30
  }
@@ -35,7 +35,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
35
35
  const AST_HTML_OPEN_TAG_NODE_T* html_open_tag_node = ((const AST_HTML_OPEN_TAG_NODE_T *) node);
36
36
 
37
37
  if (html_open_tag_node->children != NULL) {
38
- for (size_t index = 0; index < hb_array_size(html_open_tag_node->children); index++) {
38
+ for (size_t index = 0; index < html_open_tag_node->children->size; index++) {
39
39
  herb_visit_node(hb_array_get(html_open_tag_node->children, index), visitor, data);
40
40
  }
41
41
  }
@@ -46,7 +46,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
46
46
  const AST_HTML_CLOSE_TAG_NODE_T* html_close_tag_node = ((const AST_HTML_CLOSE_TAG_NODE_T *) node);
47
47
 
48
48
  if (html_close_tag_node->children != NULL) {
49
- for (size_t index = 0; index < hb_array_size(html_close_tag_node->children); index++) {
49
+ for (size_t index = 0; index < html_close_tag_node->children->size; index++) {
50
50
  herb_visit_node(hb_array_get(html_close_tag_node->children, index), visitor, data);
51
51
  }
52
52
  }
@@ -61,7 +61,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
61
61
  }
62
62
 
63
63
  if (html_element_node->body != NULL) {
64
- for (size_t index = 0; index < hb_array_size(html_element_node->body); index++) {
64
+ for (size_t index = 0; index < html_element_node->body->size; index++) {
65
65
  herb_visit_node(hb_array_get(html_element_node->body, index), visitor, data);
66
66
  }
67
67
  }
@@ -76,7 +76,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
76
76
  const AST_HTML_ATTRIBUTE_VALUE_NODE_T* html_attribute_value_node = ((const AST_HTML_ATTRIBUTE_VALUE_NODE_T *) node);
77
77
 
78
78
  if (html_attribute_value_node->children != NULL) {
79
- for (size_t index = 0; index < hb_array_size(html_attribute_value_node->children); index++) {
79
+ for (size_t index = 0; index < html_attribute_value_node->children->size; index++) {
80
80
  herb_visit_node(hb_array_get(html_attribute_value_node->children, index), visitor, data);
81
81
  }
82
82
  }
@@ -87,7 +87,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
87
87
  const AST_HTML_ATTRIBUTE_NAME_NODE_T* html_attribute_name_node = ((const AST_HTML_ATTRIBUTE_NAME_NODE_T *) node);
88
88
 
89
89
  if (html_attribute_name_node->children != NULL) {
90
- for (size_t index = 0; index < hb_array_size(html_attribute_name_node->children); index++) {
90
+ for (size_t index = 0; index < html_attribute_name_node->children->size; index++) {
91
91
  herb_visit_node(hb_array_get(html_attribute_name_node->children, index), visitor, data);
92
92
  }
93
93
  }
@@ -111,7 +111,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
111
111
  const AST_HTML_COMMENT_NODE_T* html_comment_node = ((const AST_HTML_COMMENT_NODE_T *) node);
112
112
 
113
113
  if (html_comment_node->children != NULL) {
114
- for (size_t index = 0; index < hb_array_size(html_comment_node->children); index++) {
114
+ for (size_t index = 0; index < html_comment_node->children->size; index++) {
115
115
  herb_visit_node(hb_array_get(html_comment_node->children, index), visitor, data);
116
116
  }
117
117
  }
@@ -122,7 +122,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
122
122
  const AST_HTML_DOCTYPE_NODE_T* html_doctype_node = ((const AST_HTML_DOCTYPE_NODE_T *) node);
123
123
 
124
124
  if (html_doctype_node->children != NULL) {
125
- for (size_t index = 0; index < hb_array_size(html_doctype_node->children); index++) {
125
+ for (size_t index = 0; index < html_doctype_node->children->size; index++) {
126
126
  herb_visit_node(hb_array_get(html_doctype_node->children, index), visitor, data);
127
127
  }
128
128
  }
@@ -133,7 +133,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
133
133
  const AST_XML_DECLARATION_NODE_T* xml_declaration_node = ((const AST_XML_DECLARATION_NODE_T *) node);
134
134
 
135
135
  if (xml_declaration_node->children != NULL) {
136
- for (size_t index = 0; index < hb_array_size(xml_declaration_node->children); index++) {
136
+ for (size_t index = 0; index < xml_declaration_node->children->size; index++) {
137
137
  herb_visit_node(hb_array_get(xml_declaration_node->children, index), visitor, data);
138
138
  }
139
139
  }
@@ -144,7 +144,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
144
144
  const AST_CDATA_NODE_T* cdata_node = ((const AST_CDATA_NODE_T *) node);
145
145
 
146
146
  if (cdata_node->children != NULL) {
147
- for (size_t index = 0; index < hb_array_size(cdata_node->children); index++) {
147
+ for (size_t index = 0; index < cdata_node->children->size; index++) {
148
148
  herb_visit_node(hb_array_get(cdata_node->children, index), visitor, data);
149
149
  }
150
150
  }
@@ -155,7 +155,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
155
155
  const AST_ERB_ELSE_NODE_T* erb_else_node = ((const AST_ERB_ELSE_NODE_T *) node);
156
156
 
157
157
  if (erb_else_node->statements != NULL) {
158
- for (size_t index = 0; index < hb_array_size(erb_else_node->statements); index++) {
158
+ for (size_t index = 0; index < erb_else_node->statements->size; index++) {
159
159
  herb_visit_node(hb_array_get(erb_else_node->statements, index), visitor, data);
160
160
  }
161
161
  }
@@ -166,7 +166,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
166
166
  const AST_ERB_IF_NODE_T* erb_if_node = ((const AST_ERB_IF_NODE_T *) node);
167
167
 
168
168
  if (erb_if_node->statements != NULL) {
169
- for (size_t index = 0; index < hb_array_size(erb_if_node->statements); index++) {
169
+ for (size_t index = 0; index < erb_if_node->statements->size; index++) {
170
170
  herb_visit_node(hb_array_get(erb_if_node->statements, index), visitor, data);
171
171
  }
172
172
  }
@@ -185,7 +185,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
185
185
  const AST_ERB_BLOCK_NODE_T* erb_block_node = ((const AST_ERB_BLOCK_NODE_T *) node);
186
186
 
187
187
  if (erb_block_node->body != NULL) {
188
- for (size_t index = 0; index < hb_array_size(erb_block_node->body); index++) {
188
+ for (size_t index = 0; index < erb_block_node->body->size; index++) {
189
189
  herb_visit_node(hb_array_get(erb_block_node->body, index), visitor, data);
190
190
  }
191
191
  }
@@ -200,7 +200,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
200
200
  const AST_ERB_WHEN_NODE_T* erb_when_node = ((const AST_ERB_WHEN_NODE_T *) node);
201
201
 
202
202
  if (erb_when_node->statements != NULL) {
203
- for (size_t index = 0; index < hb_array_size(erb_when_node->statements); index++) {
203
+ for (size_t index = 0; index < erb_when_node->statements->size; index++) {
204
204
  herb_visit_node(hb_array_get(erb_when_node->statements, index), visitor, data);
205
205
  }
206
206
  }
@@ -211,13 +211,13 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
211
211
  const AST_ERB_CASE_NODE_T* erb_case_node = ((const AST_ERB_CASE_NODE_T *) node);
212
212
 
213
213
  if (erb_case_node->children != NULL) {
214
- for (size_t index = 0; index < hb_array_size(erb_case_node->children); index++) {
214
+ for (size_t index = 0; index < erb_case_node->children->size; index++) {
215
215
  herb_visit_node(hb_array_get(erb_case_node->children, index), visitor, data);
216
216
  }
217
217
  }
218
218
 
219
219
  if (erb_case_node->conditions != NULL) {
220
- for (size_t index = 0; index < hb_array_size(erb_case_node->conditions); index++) {
220
+ for (size_t index = 0; index < erb_case_node->conditions->size; index++) {
221
221
  herb_visit_node(hb_array_get(erb_case_node->conditions, index), visitor, data);
222
222
  }
223
223
  }
@@ -236,13 +236,13 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
236
236
  const AST_ERB_CASE_MATCH_NODE_T* erb_case_match_node = ((const AST_ERB_CASE_MATCH_NODE_T *) node);
237
237
 
238
238
  if (erb_case_match_node->children != NULL) {
239
- for (size_t index = 0; index < hb_array_size(erb_case_match_node->children); index++) {
239
+ for (size_t index = 0; index < erb_case_match_node->children->size; index++) {
240
240
  herb_visit_node(hb_array_get(erb_case_match_node->children, index), visitor, data);
241
241
  }
242
242
  }
243
243
 
244
244
  if (erb_case_match_node->conditions != NULL) {
245
- for (size_t index = 0; index < hb_array_size(erb_case_match_node->conditions); index++) {
245
+ for (size_t index = 0; index < erb_case_match_node->conditions->size; index++) {
246
246
  herb_visit_node(hb_array_get(erb_case_match_node->conditions, index), visitor, data);
247
247
  }
248
248
  }
@@ -261,7 +261,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
261
261
  const AST_ERB_WHILE_NODE_T* erb_while_node = ((const AST_ERB_WHILE_NODE_T *) node);
262
262
 
263
263
  if (erb_while_node->statements != NULL) {
264
- for (size_t index = 0; index < hb_array_size(erb_while_node->statements); index++) {
264
+ for (size_t index = 0; index < erb_while_node->statements->size; index++) {
265
265
  herb_visit_node(hb_array_get(erb_while_node->statements, index), visitor, data);
266
266
  }
267
267
  }
@@ -276,7 +276,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
276
276
  const AST_ERB_UNTIL_NODE_T* erb_until_node = ((const AST_ERB_UNTIL_NODE_T *) node);
277
277
 
278
278
  if (erb_until_node->statements != NULL) {
279
- for (size_t index = 0; index < hb_array_size(erb_until_node->statements); index++) {
279
+ for (size_t index = 0; index < erb_until_node->statements->size; index++) {
280
280
  herb_visit_node(hb_array_get(erb_until_node->statements, index), visitor, data);
281
281
  }
282
282
  }
@@ -291,7 +291,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
291
291
  const AST_ERB_FOR_NODE_T* erb_for_node = ((const AST_ERB_FOR_NODE_T *) node);
292
292
 
293
293
  if (erb_for_node->statements != NULL) {
294
- for (size_t index = 0; index < hb_array_size(erb_for_node->statements); index++) {
294
+ for (size_t index = 0; index < erb_for_node->statements->size; index++) {
295
295
  herb_visit_node(hb_array_get(erb_for_node->statements, index), visitor, data);
296
296
  }
297
297
  }
@@ -306,7 +306,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
306
306
  const AST_ERB_RESCUE_NODE_T* erb_rescue_node = ((const AST_ERB_RESCUE_NODE_T *) node);
307
307
 
308
308
  if (erb_rescue_node->statements != NULL) {
309
- for (size_t index = 0; index < hb_array_size(erb_rescue_node->statements); index++) {
309
+ for (size_t index = 0; index < erb_rescue_node->statements->size; index++) {
310
310
  herb_visit_node(hb_array_get(erb_rescue_node->statements, index), visitor, data);
311
311
  }
312
312
  }
@@ -321,7 +321,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
321
321
  const AST_ERB_ENSURE_NODE_T* erb_ensure_node = ((const AST_ERB_ENSURE_NODE_T *) node);
322
322
 
323
323
  if (erb_ensure_node->statements != NULL) {
324
- for (size_t index = 0; index < hb_array_size(erb_ensure_node->statements); index++) {
324
+ for (size_t index = 0; index < erb_ensure_node->statements->size; index++) {
325
325
  herb_visit_node(hb_array_get(erb_ensure_node->statements, index), visitor, data);
326
326
  }
327
327
  }
@@ -332,7 +332,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
332
332
  const AST_ERB_BEGIN_NODE_T* erb_begin_node = ((const AST_ERB_BEGIN_NODE_T *) node);
333
333
 
334
334
  if (erb_begin_node->statements != NULL) {
335
- for (size_t index = 0; index < hb_array_size(erb_begin_node->statements); index++) {
335
+ for (size_t index = 0; index < erb_begin_node->statements->size; index++) {
336
336
  herb_visit_node(hb_array_get(erb_begin_node->statements, index), visitor, data);
337
337
  }
338
338
  }
@@ -359,7 +359,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
359
359
  const AST_ERB_UNLESS_NODE_T* erb_unless_node = ((const AST_ERB_UNLESS_NODE_T *) node);
360
360
 
361
361
  if (erb_unless_node->statements != NULL) {
362
- for (size_t index = 0; index < hb_array_size(erb_unless_node->statements); index++) {
362
+ for (size_t index = 0; index < erb_unless_node->statements->size; index++) {
363
363
  herb_visit_node(hb_array_get(erb_unless_node->statements, index), visitor, data);
364
364
  }
365
365
  }
@@ -378,7 +378,7 @@ void herb_visit_child_nodes(const AST_NODE_T *node, bool (*visitor)(const AST_NO
378
378
  const AST_ERB_IN_NODE_T* erb_in_node = ((const AST_ERB_IN_NODE_T *) node);
379
379
 
380
380
  if (erb_in_node->statements != NULL) {
381
- for (size_t index = 0; index < hb_array_size(erb_in_node->statements); index++) {
381
+ for (size_t index = 0; index < erb_in_node->statements->size; index++) {
382
382
  herb_visit_node(hb_array_get(erb_in_node->statements, index), visitor, data);
383
383
  }
384
384
  }
@@ -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.8.3/templates/javascript/packages/node/extension/nodes.cpp.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/javascript/packages/node/extension/nodes.cpp.erb
3
3
 
4
4
  #include <node_api.h>
5
5
  #include "error_helpers.h"
@@ -1089,7 +1089,7 @@ napi_value NodesArrayFromCArray(napi_env env, hb_array_T* array) {
1089
1089
  napi_create_array(env, &result);
1090
1090
 
1091
1091
  if (array) {
1092
- for (size_t i = 0; i < hb_array_size(array); i++) {
1092
+ for (size_t i = 0; i < array->size; i++) {
1093
1093
  AST_NODE_T* child_node = (AST_NODE_T*) hb_array_get(array, i);
1094
1094
  if (child_node) {
1095
1095
  napi_value js_child = NodeFromCStruct(env, child_node);
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.8.3/templates/javascript/packages/node/extension/nodes.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/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.8.3",
3
+ "version": "0.8.5",
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.8.3",
51
+ "@herb-tools/core": "0.8.5",
52
52
  "@mapbox/node-pre-gyp": "^2.0.0",
53
53
  "node-addon-api": "^8.5.0",
54
54
  "node-pre-gyp-github": "^2.0.0"
package/CHANGELOG.md DELETED
@@ -1,19 +0,0 @@
1
- ## 0.3.1 (2025-06-23)
2
-
3
- This was a version bump only for @herb-tools/node to align it with other projects, there were no code changes.
4
-
5
- ## 0.3.0 (2025-06-21)
6
-
7
- This was a version bump only for @herb-tools/node to align it with other projects, there were no code changes.
8
-
9
- ## 0.2.0 (2025-06-11)
10
-
11
- This was a version bump only for @herb-tools/node to align it with other projects, there were no code changes.
12
-
13
- ## 0.1.1 (2025-04-20)
14
-
15
- This was a version bump only for @herb-tools/node to align it with other projects, there were no code changes.
16
-
17
- ## 0.1.0 (2025-04-15)
18
-
19
- This was a version bump only for @herb-tools/node to align it with other projects, there were no code changes.