marko 4.28.5 → 4.28.7

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.
@@ -659,7 +659,7 @@ function hasHTML(node, context) {
659
659
  let hasHTML = false;
660
660
  const walker = context.createWalker({
661
661
  enter(node) {
662
- if (node.type === "Html" || node.type === "TextVDOM" || node._isTagCall) {
662
+ if (node.type === "Html" || node.type === "StartTag" || node.type === "TextVDOM" || node.type === "HtmlElement" || node.type === "HtmlComment" || node.type === "EndElementVDOM" || node.type === "HtmlElementVDOM" || node._isTagCall) {
663
663
  hasHTML = true;
664
664
  walker.stop();
665
665
  } else if (node._isNestedTagCall) {
@@ -58,33 +58,35 @@ function isXML(path) {
58
58
  }
59
59
 
60
60
  function _compile(src, filename, userOptions, callback) {
61
- registerCoreTaglibs();
62
-
63
- ok(filename, '"filename" argument is required');
64
- ok(typeof filename === "string", '"filename" argument should be a string');
65
-
66
- var options = {};
61
+ try {
62
+ registerCoreTaglibs();
67
63
 
68
- extend(options, globalConfig);
64
+ ok(filename, '"filename" argument is required');
65
+ ok(typeof filename === "string", '"filename" argument should be a string');
69
66
 
70
- if (userOptions) {
71
- extend(options, userOptions);
72
- }
67
+ var options = {};
73
68
 
74
- var compiler = defaultCompiler;
69
+ extend(options, globalConfig);
75
70
 
76
- if (isXML(filename)) {
77
- require("complain")("Using Marko to build XML is deprecated");
78
- options.ignoreUnrecognizedTags = true;
79
- }
71
+ if (userOptions) {
72
+ extend(options, userOptions);
73
+ }
80
74
 
81
- const context = new CompileContext(src, filename, compiler.builder, options);
75
+ var compiler = defaultCompiler;
82
76
 
83
- let result;
77
+ if (isXML(filename)) {
78
+ require("complain")("Using Marko to build XML is deprecated");
79
+ options.ignoreUnrecognizedTags = true;
80
+ }
84
81
 
85
- try {
82
+ const context = new CompileContext(src, filename, compiler.builder, options);
86
83
  const compiled = compiler.compile(src, context);
87
- result = userOptions.sourceOnly ? compiled.code : compiled;
84
+ const result = userOptions.sourceOnly ? compiled.code : compiled;
85
+ if (callback) {
86
+ callback(null, result);
87
+ } else {
88
+ return result;
89
+ }
88
90
  } catch (e) {
89
91
  if (callback) {
90
92
  return callback(e);
@@ -92,12 +94,6 @@ function _compile(src, filename, userOptions, callback) {
92
94
  throw e;
93
95
  }
94
96
  }
95
-
96
- if (callback) {
97
- callback(null, result);
98
- } else {
99
- return result;
100
- }
101
97
  }
102
98
 
103
99
  function compile(src, filename, options, callback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "4.28.5",
3
+ "version": "4.28.7",
4
4
  "license": "MIT",
5
5
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
6
6
  "dependencies": {
@@ -796,7 +796,16 @@ function hasHTML(node, context) {
796
796
  let hasHTML = false;
797
797
  const walker = context.createWalker({
798
798
  enter(node) {
799
- if (node.type === "Html" || node.type === "TextVDOM" || node._isTagCall) {
799
+ if (
800
+ node.type === "Html" ||
801
+ node.type === "StartTag" ||
802
+ node.type === "TextVDOM" ||
803
+ node.type === "HtmlElement" ||
804
+ node.type === "HtmlComment" ||
805
+ node.type === "EndElementVDOM" ||
806
+ node.type === "HtmlElementVDOM" ||
807
+ node._isTagCall
808
+ ) {
800
809
  hasHTML = true;
801
810
  walker.stop();
802
811
  } else if (node._isNestedTagCall) {
@@ -58,33 +58,40 @@ function isXML(path) {
58
58
  }
59
59
 
60
60
  function _compile(src, filename, userOptions, callback) {
61
- registerCoreTaglibs();
62
-
63
- ok(filename, '"filename" argument is required');
64
- ok(typeof filename === "string", '"filename" argument should be a string');
65
-
66
- var options = {};
61
+ try {
62
+ registerCoreTaglibs();
67
63
 
68
- extend(options, globalConfig);
64
+ ok(filename, '"filename" argument is required');
65
+ ok(typeof filename === "string", '"filename" argument should be a string');
69
66
 
70
- if (userOptions) {
71
- extend(options, userOptions);
72
- }
67
+ var options = {};
73
68
 
74
- var compiler = defaultCompiler;
69
+ extend(options, globalConfig);
75
70
 
76
- if (isXML(filename)) {
77
- require("complain")("Using Marko to build XML is deprecated");
78
- options.ignoreUnrecognizedTags = true;
79
- }
71
+ if (userOptions) {
72
+ extend(options, userOptions);
73
+ }
80
74
 
81
- const context = new CompileContext(src, filename, compiler.builder, options);
75
+ var compiler = defaultCompiler;
82
76
 
83
- let result;
77
+ if (isXML(filename)) {
78
+ require("complain")("Using Marko to build XML is deprecated");
79
+ options.ignoreUnrecognizedTags = true;
80
+ }
84
81
 
85
- try {
82
+ const context = new CompileContext(
83
+ src,
84
+ filename,
85
+ compiler.builder,
86
+ options
87
+ );
86
88
  const compiled = compiler.compile(src, context);
87
- result = userOptions.sourceOnly ? compiled.code : compiled;
89
+ const result = userOptions.sourceOnly ? compiled.code : compiled;
90
+ if (callback) {
91
+ callback(null, result);
92
+ } else {
93
+ return result;
94
+ }
88
95
  } catch (e) {
89
96
  if (callback) {
90
97
  return callback(e);
@@ -92,12 +99,6 @@ function _compile(src, filename, userOptions, callback) {
92
99
  throw e;
93
100
  }
94
101
  }
95
-
96
- if (callback) {
97
- callback(null, result);
98
- } else {
99
- return result;
100
- }
101
102
  }
102
103
 
103
104
  function compile(src, filename, options, callback) {