marko 4.26.3 → 4.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (250) hide show
  1. package/README.md +1 -1
  2. package/bin/markoc.js +15 -15
  3. package/dist/compiler/ast/CustomTag.js +2 -2
  4. package/dist/core-tags/components/TransformHelper/handleLegacyBind.js +0 -4
  5. package/dist/core-tags/core/await/renderer.js +0 -4
  6. package/dist/core-tags/migrate/all-tags/body-only-if.js +0 -1
  7. package/dist/core-tags/migrate/all-tags/control-flow-directives.js +0 -1
  8. package/dist/core-tags/migrate/all-tags/dynamic-attributes.js +1 -2
  9. package/dist/core-tags/migrate/all-tags/include-directive.js +0 -2
  10. package/dist/core-tags/migrate/all-tags/legacy-nested-tag.js +0 -2
  11. package/dist/core-tags/migrate/all-tags/marko-init.js +0 -2
  12. package/dist/core-tags/migrate/all-tags/modifier-key.js +0 -2
  13. package/dist/core-tags/migrate/all-tags/ref.js +1 -3
  14. package/dist/core-tags/migrate/all-tags/w-bind.js +0 -2
  15. package/dist/core-tags/migrate/all-tags/w-body.js +0 -2
  16. package/dist/core-tags/migrate/all-tags/w-config.js +0 -2
  17. package/dist/core-tags/migrate/all-tags/w-for.js +0 -3
  18. package/dist/core-tags/migrate/all-tags/w-id.js +1 -4
  19. package/dist/core-tags/migrate/all-tags/w-on.js +1 -4
  20. package/dist/core-tags/migrate/all-tags/w-preserve-attrs.js +0 -2
  21. package/dist/core-tags/migrate/all-tags/w-preserve.js +1 -3
  22. package/dist/core-tags/migrate/all-tags/widget-in-attrs.js +2 -11
  23. package/dist/core-tags/migrate/all-templates/non-standard-template-literals.js +0 -4
  24. package/dist/core-tags/migrate/all-templates/render-calls.js +0 -2
  25. package/dist/core-tags/migrate/assign-tag.js +0 -2
  26. package/dist/core-tags/migrate/async-fragment-tag.js +0 -2
  27. package/dist/core-tags/migrate/async-fragments-tag.js +0 -2
  28. package/dist/core-tags/migrate/await-tag.js +0 -7
  29. package/dist/core-tags/migrate/class-tag.js +0 -2
  30. package/dist/core-tags/migrate/component-globals-tag.js +0 -2
  31. package/dist/core-tags/migrate/for-tag.js +0 -2
  32. package/dist/core-tags/migrate/include-tag.js +0 -1
  33. package/dist/core-tags/migrate/invoke-tag.js +0 -2
  34. package/dist/core-tags/migrate/layout-placeholder-tag.js +0 -1
  35. package/dist/core-tags/migrate/layout-put-tag.js +0 -1
  36. package/dist/core-tags/migrate/layout-use-tag.js +0 -1
  37. package/dist/core-tags/migrate/macro-body-tag.js +0 -2
  38. package/dist/core-tags/migrate/macro-tag.js +0 -2
  39. package/dist/core-tags/migrate/unless-tag.js +0 -1
  40. package/dist/core-tags/migrate/var-tag.js +0 -2
  41. package/dist/node_modules/@internal/components-define-widget-legacy/index-browser.js +0 -10
  42. package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +0 -4
  43. package/dist/runtime/RenderResult.js +0 -3
  44. package/dist/runtime/components/Component.js +0 -6
  45. package/dist/runtime/components/ComponentDef.js +0 -3
  46. package/dist/runtime/components/ServerComponent.js +0 -4
  47. package/dist/runtime/components/legacy/defineComponent-legacy.js +0 -3
  48. package/dist/runtime/components/legacy/defineRenderer-legacy.js +1 -6
  49. package/dist/runtime/components/legacy/index.js +3 -1
  50. package/dist/runtime/helpers/for-of.js +3 -1
  51. package/dist/runtime/html/helpers/attr.js +0 -4
  52. package/dist/runtime/html/helpers/attrs.js +0 -2
  53. package/dist/runtime/html/helpers/merge-attrs.js +0 -3
  54. package/dist/runtime/vdom/VElement.js +0 -3
  55. package/dist/runtime/vdom/helpers/attrs.js +0 -2
  56. package/dist/taglib/taglib-loader/loadTagFromProps.js +15 -0
  57. package/docs/10-awesome-marko-features.md +1 -1
  58. package/docs/body-content.md +3 -3
  59. package/docs/class-components.md +6 -6
  60. package/docs/express.md +1 -1
  61. package/docs/fastify.md +4 -4
  62. package/docs/hapi.md +3 -3
  63. package/docs/http.md +1 -1
  64. package/docs/huncwot.md +1 -1
  65. package/docs/installing.md +2 -2
  66. package/docs/koa.md +2 -2
  67. package/docs/lasso.md +1 -1
  68. package/docs/marko-4-upgrade.md +1 -1
  69. package/docs/marko-v4.md +4 -4
  70. package/docs/marko-vs-react.md +2 -2
  71. package/docs/rendering.md +6 -6
  72. package/docs/server-side-rendering.md +3 -3
  73. package/docs/webpack.md +16 -16
  74. package/docs/why-is-marko-fast.md +3 -3
  75. package/package.json +1 -1
  76. package/src/compiler/Builder.js +13 -13
  77. package/src/compiler/CodeGenerator.js +2 -2
  78. package/src/compiler/CodeWriter.js +1 -1
  79. package/src/compiler/CompileContext.js +30 -30
  80. package/src/compiler/Compiler.js +3 -3
  81. package/src/compiler/HtmlJsParser.js +4 -4
  82. package/src/compiler/Migrator.js +2 -2
  83. package/src/compiler/Normalizer.js +5 -5
  84. package/src/compiler/Parser.js +11 -11
  85. package/src/compiler/Walker.js +1 -1
  86. package/src/compiler/ast/ArrayExpression.js +1 -1
  87. package/src/compiler/ast/BinaryExpression.js +1 -1
  88. package/src/compiler/ast/ConditionalExpression.js +1 -1
  89. package/src/compiler/ast/CustomTag.js +14 -14
  90. package/src/compiler/ast/Declaration.js +2 -2
  91. package/src/compiler/ast/DocumentType.js +2 -2
  92. package/src/compiler/ast/ForEach.js +1 -1
  93. package/src/compiler/ast/ForEachProp.js +1 -1
  94. package/src/compiler/ast/ForRange.js +1 -1
  95. package/src/compiler/ast/HtmlAttribute/html/generateCode.js +4 -4
  96. package/src/compiler/ast/HtmlAttribute/vdom/generateCode.js +2 -2
  97. package/src/compiler/ast/HtmlAttributeCollection.js +3 -3
  98. package/src/compiler/ast/HtmlComment.js +1 -1
  99. package/src/compiler/ast/HtmlElement/html/EndTag.js +1 -1
  100. package/src/compiler/ast/HtmlElement/html/StartTag.js +3 -3
  101. package/src/compiler/ast/HtmlElement/html/generateCode.js +5 -5
  102. package/src/compiler/ast/HtmlElement/index.js +1 -1
  103. package/src/compiler/ast/HtmlElement/vdom/HtmlElementVDOM.js +1 -1
  104. package/src/compiler/ast/HtmlElement/vdom/generateCode.js +3 -3
  105. package/src/compiler/ast/If.js +1 -1
  106. package/src/compiler/ast/LogicalExpression.js +1 -1
  107. package/src/compiler/ast/MemberExpression.js +1 -1
  108. package/src/compiler/ast/NewExpression.js +1 -1
  109. package/src/compiler/ast/Node.js +4 -4
  110. package/src/compiler/ast/ObjectExpression.js +2 -2
  111. package/src/compiler/ast/Property.js +1 -1
  112. package/src/compiler/ast/SequenceExpression.js +1 -1
  113. package/src/compiler/ast/TemplateLiteral.js +1 -1
  114. package/src/compiler/ast/TemplateRoot.js +3 -3
  115. package/src/compiler/ast/Text/index.js +1 -1
  116. package/src/compiler/ast/UnaryExpression.js +1 -1
  117. package/src/compiler/ast/UpdateExpression.js +1 -1
  118. package/src/compiler/config.js +1 -1
  119. package/src/compiler/index.js +5 -5
  120. package/src/compiler/modules.js +2 -2
  121. package/src/compiler/util/UniqueVars.js +4 -4
  122. package/src/compiler/util/convertRawJavaScriptAst.js +1 -1
  123. package/src/compiler/util/javaScriptReservedWords.js +1 -1
  124. package/src/compiler/util/macros.js +1 -1
  125. package/src/compiler/util/mergeProps.js +3 -3
  126. package/src/compiler/util/parseJavaScriptArgs.js +1 -1
  127. package/src/compiler/util/parseJavaScriptParams.js +1 -1
  128. package/src/compiler/util/parseRawJavaScriptAst.js +1 -1
  129. package/src/compiler/util/removeComments.js +6 -6
  130. package/src/compiler/util/tokenizer.js +3 -3
  131. package/src/compiler/util/vdom/VDOMOptimizer.js +2 -2
  132. package/src/core-tags/cache/cached-fragment-tag.js +2 -2
  133. package/src/core-tags/cache/default-cache-manager.js +2 -2
  134. package/src/core-tags/components/TransformHelper/ComponentArgsCompiler.js +3 -3
  135. package/src/core-tags/components/TransformHelper/assignComponentId.js +3 -3
  136. package/src/core-tags/components/TransformHelper/convertToComponent.js +4 -4
  137. package/src/core-tags/components/TransformHelper/getComponentFiles.js +1 -1
  138. package/src/core-tags/components/TransformHelper/handleComponentEvents.js +3 -3
  139. package/src/core-tags/components/TransformHelper/handleComponentPreserve.js +7 -7
  140. package/src/core-tags/components/TransformHelper/handleLegacyBind.js +2 -8
  141. package/src/core-tags/components/TransformHelper/handleRootNodes.js +14 -14
  142. package/src/core-tags/components/TransformHelper/handleScopedAttrs.js +1 -1
  143. package/src/core-tags/components/TransformHelper/index.js +1 -1
  144. package/src/core-tags/components/component-tag.js +1 -1
  145. package/src/core-tags/components/components-transformer.js +2 -2
  146. package/src/core-tags/components/util/generateRegisterComponentCode.js +2 -2
  147. package/src/core-tags/components/widget-types-tag.js +2 -2
  148. package/src/core-tags/core/await/AsyncValue.js +1 -1
  149. package/src/core-tags/core/await/renderer.js +3 -12
  150. package/src/core-tags/core/await/reorderer-renderer.js +1 -1
  151. package/src/core-tags/core/core-transformer.js +5 -5
  152. package/src/core-tags/core/html-comment-tag.js +1 -1
  153. package/src/core-tags/core/import-tag.js +1 -1
  154. package/src/core-tags/core/util/parseImport.js +8 -8
  155. package/src/core-tags/html/normalize-script-text.js +1 -1
  156. package/src/core-tags/migrate/all-tags/body-only-if.js +4 -5
  157. package/src/core-tags/migrate/all-tags/control-flow-directives.js +2 -5
  158. package/src/core-tags/migrate/all-tags/dynamic-attributes.js +1 -4
  159. package/src/core-tags/migrate/all-tags/include-directive.js +0 -4
  160. package/src/core-tags/migrate/all-tags/index.js +2 -2
  161. package/src/core-tags/migrate/all-tags/legacy-nested-tag.js +0 -5
  162. package/src/core-tags/migrate/all-tags/marko-init.js +2 -8
  163. package/src/core-tags/migrate/all-tags/modifier-key.js +1 -7
  164. package/src/core-tags/migrate/all-tags/params.js +1 -1
  165. package/src/core-tags/migrate/all-tags/ref.js +1 -5
  166. package/src/core-tags/migrate/all-tags/w-bind.js +8 -12
  167. package/src/core-tags/migrate/all-tags/w-body.js +3 -7
  168. package/src/core-tags/migrate/all-tags/w-config.js +1 -5
  169. package/src/core-tags/migrate/all-tags/w-for.js +1 -8
  170. package/src/core-tags/migrate/all-tags/w-id.js +1 -8
  171. package/src/core-tags/migrate/all-tags/w-on.js +2 -9
  172. package/src/core-tags/migrate/all-tags/w-preserve-attrs.js +1 -5
  173. package/src/core-tags/migrate/all-tags/w-preserve.js +3 -7
  174. package/src/core-tags/migrate/all-tags/widget-in-attrs.js +4 -17
  175. package/src/core-tags/migrate/all-templates/index.js +2 -2
  176. package/src/core-tags/migrate/all-templates/non-standard-template-literals.js +6 -12
  177. package/src/core-tags/migrate/all-templates/render-calls.js +4 -8
  178. package/src/core-tags/migrate/all-templates/widget-data-is-state.js +2 -2
  179. package/src/core-tags/migrate/all-templates/widget-get-template-data.js +2 -2
  180. package/src/core-tags/migrate/assign-tag.js +2 -6
  181. package/src/core-tags/migrate/async-fragment-tag.js +2 -6
  182. package/src/core-tags/migrate/async-fragments-tag.js +0 -4
  183. package/src/core-tags/migrate/await-tag.js +8 -23
  184. package/src/core-tags/migrate/class-tag.js +0 -4
  185. package/src/core-tags/migrate/component-globals-tag.js +0 -4
  186. package/src/core-tags/migrate/for-tag.js +12 -16
  187. package/src/core-tags/migrate/include-tag.js +2 -5
  188. package/src/core-tags/migrate/invoke-tag.js +2 -6
  189. package/src/core-tags/migrate/layout-placeholder-tag.js +0 -3
  190. package/src/core-tags/migrate/layout-put-tag.js +0 -3
  191. package/src/core-tags/migrate/layout-use-tag.js +0 -3
  192. package/src/core-tags/migrate/macro-body-tag.js +0 -5
  193. package/src/core-tags/migrate/macro-tag.js +5 -10
  194. package/src/core-tags/migrate/unless-tag.js +0 -3
  195. package/src/core-tags/migrate/util/addIdScopedAttr.js +1 -1
  196. package/src/core-tags/migrate/util/import-tag.js +6 -6
  197. package/src/core-tags/migrate/util/parseFor.js +20 -20
  198. package/src/core-tags/migrate/util/renderCallToDynamicTag.js +7 -7
  199. package/src/core-tags/migrate/var-tag.js +4 -8
  200. package/src/express.js +1 -1
  201. package/src/hot-reload.js +3 -3
  202. package/src/node-require/index.js +1 -1
  203. package/src/node_modules/@internal/components-define-widget-legacy/index-browser.js +4 -55
  204. package/src/node_modules/@internal/components-entry-legacy/index-browser.js +0 -10
  205. package/src/runtime/RenderResult.js +3 -16
  206. package/src/runtime/components/Component.js +2 -23
  207. package/src/runtime/components/ComponentDef.js +2 -8
  208. package/src/runtime/components/ComponentsContext.js +1 -1
  209. package/src/runtime/components/ServerComponent.js +0 -6
  210. package/src/runtime/components/State.js +2 -2
  211. package/src/runtime/components/attach-detach.js +1 -1
  212. package/src/runtime/components/dom-data.js +1 -1
  213. package/src/runtime/components/legacy/defineComponent-legacy.js +0 -5
  214. package/src/runtime/components/legacy/defineRenderer-legacy.js +1 -16
  215. package/src/runtime/components/legacy/dependencies/index.js +10 -10
  216. package/src/runtime/components/legacy/index.js +5 -0
  217. package/src/runtime/components/legacy/renderer-legacy.js +1 -1
  218. package/src/runtime/components/update-manager.js +1 -1
  219. package/src/runtime/dom-insert.js +1 -1
  220. package/src/runtime/helpers/_weak-map.js +1 -1
  221. package/src/runtime/helpers/bind-component.js +1 -1
  222. package/src/runtime/helpers/for-of.js +1 -6
  223. package/src/runtime/html/AsyncStream.js +5 -5
  224. package/src/runtime/html/BufferedWriter.js +1 -1
  225. package/src/runtime/html/StringWriter.js +1 -1
  226. package/src/runtime/html/helpers/attr.js +0 -9
  227. package/src/runtime/html/helpers/attrs.js +0 -6
  228. package/src/runtime/html/helpers/merge-attrs.js +0 -8
  229. package/src/runtime/html/index.js +1 -1
  230. package/src/runtime/renderable.js +1 -1
  231. package/src/runtime/vdom/AsyncVDOMBuilder.js +2 -2
  232. package/src/runtime/vdom/VComment.js +1 -1
  233. package/src/runtime/vdom/VComponent.js +1 -1
  234. package/src/runtime/vdom/VDocumentFragment.js +1 -1
  235. package/src/runtime/vdom/VElement.js +4 -11
  236. package/src/runtime/vdom/VFragment.js +1 -1
  237. package/src/runtime/vdom/VNode.js +1 -1
  238. package/src/runtime/vdom/VText.js +1 -1
  239. package/src/runtime/vdom/helpers/attrs.js +0 -7
  240. package/src/runtime/vdom/index.js +1 -1
  241. package/src/runtime/vdom/morphdom/fragment.js +1 -1
  242. package/src/runtime/vdom/morphdom/specialElHandlers.js +1 -1
  243. package/src/taglib/taglib-finder/index.js +5 -5
  244. package/src/taglib/taglib-loader/Tag.js +8 -8
  245. package/src/taglib/taglib-loader/Taglib.js +1 -1
  246. package/src/taglib/taglib-loader/loadAttributeFromProps.js +1 -1
  247. package/src/taglib/taglib-loader/loadTagFromProps.js +29 -14
  248. package/src/taglib/taglib-loader/loadTaglibFromProps.js +9 -9
  249. package/src/taglib/taglib-loader/scanTagsDir.js +6 -6
  250. package/src/taglib/taglib-lookup/TaglibLookup.js +8 -8
@@ -62,5 +62,5 @@ module.exports = {
62
62
  volatile: true,
63
63
  while: true,
64
64
  with: true,
65
- yield: true
65
+ yield: true,
66
66
  };
@@ -30,7 +30,7 @@ class MacrosContext {
30
30
  var functionName = "macro_" + safeVarName(name);
31
31
  var macroDef = {
32
32
  name: name,
33
- functionName: functionName
33
+ functionName: functionName,
34
34
  };
35
35
 
36
36
  this._byName[name] = macroDef;
@@ -24,7 +24,7 @@ module.exports = function merge(props1, props2, context) {
24
24
  let mergeVar = context.helper("merge");
25
25
  argProp.value = context.builder.functionCall(mergeVar, [
26
26
  props2, // Input props from the attributes take precedence
27
- argProp.value
27
+ argProp.value,
28
28
  ]);
29
29
 
30
30
  return props1;
@@ -38,14 +38,14 @@ module.exports = function merge(props1, props2, context) {
38
38
 
39
39
  return context.builder.functionCall(mergeVar, [
40
40
  props2, // Input props from the attributes take precedence
41
- props1
41
+ props1,
42
42
  ]);
43
43
  }
44
44
  } else {
45
45
  let mergeVar = context.helper("merge");
46
46
  return context.builder.functionCall(mergeVar, [
47
47
  props2, // Input props from the attributes take precedence
48
- props1
48
+ props1,
49
49
  ]);
50
50
  }
51
51
  };
@@ -11,7 +11,7 @@ function parseJavaScriptArgs(args, builder) {
11
11
  const ast = parseRawJavaScriptAst`_(${args})`;
12
12
 
13
13
  return ast.body[0].expression.arguments.map(
14
- node =>
14
+ (node) =>
15
15
  convertRawJavaScriptAst(node, builder) ||
16
16
  builder.expression(ast.source.slice(node.range[0], node.range[1]), ast)
17
17
  );
@@ -9,7 +9,7 @@ function parseJavaScriptParams(params, builder) {
9
9
 
10
10
  const ast = parseRawJavaScriptAst`(${params}) => {}`;
11
11
 
12
- return ast.body[0].expression.params.map(node => {
12
+ return ast.body[0].expression.params.map((node) => {
13
13
  const paramSrc = ast.source.slice(node.range[0], node.range[1]);
14
14
  return node.type === "Identifier"
15
15
  ? builder.identifier(paramSrc)
@@ -5,7 +5,7 @@ const espree = require("espree");
5
5
  const espreeOptions = {
6
6
  range: true,
7
7
  sourceType: "script",
8
- ecmaVersion: espree.latestEcmaVersion
8
+ ecmaVersion: espree.latestEcmaVersion,
9
9
  };
10
10
 
11
11
  module.exports = function parseRawJavaScriptAst(parts, src) {
@@ -2,26 +2,26 @@
2
2
  var tokenizer = require("./tokenizer").create([
3
3
  {
4
4
  name: "stringDouble",
5
- pattern: /"(?:[^"]|\\")*"/
5
+ pattern: /"(?:[^"]|\\")*"/,
6
6
  },
7
7
  {
8
8
  name: "stringSingle",
9
- pattern: /'(?:[^']|\\')*'/
9
+ pattern: /'(?:[^']|\\')*'/,
10
10
  },
11
11
  {
12
12
  name: "singleLineComment",
13
- pattern: /\/\/.*/
13
+ pattern: /\/\/.*/,
14
14
  },
15
15
  {
16
16
  name: "multiLineComment",
17
- pattern: /\/\*(?:[\s\S]*?)\*\//
18
- }
17
+ pattern: /\/\*(?:[\s\S]*?)\*\//,
18
+ },
19
19
  ]);
20
20
 
21
21
  module.exports = function removeComments(str) {
22
22
  var comments = [];
23
23
 
24
- tokenizer.forEachToken(str, token => {
24
+ tokenizer.forEachToken(str, (token) => {
25
25
  switch (token.name) {
26
26
  case "singleLineComment":
27
27
  case "multiLineComment":
@@ -10,7 +10,7 @@ function create(tokens) {
10
10
  start: matches.index,
11
11
  end: matches.index + matches[0].length,
12
12
  name: tokenDef.name,
13
- value: tokenValue
13
+ value: tokenValue,
14
14
  };
15
15
  }
16
16
  }
@@ -18,7 +18,7 @@ function create(tokens) {
18
18
 
19
19
  var tokensRegExp = new RegExp(
20
20
  tokens
21
- .map(token => {
21
+ .map((token) => {
22
22
  return "(" + token.pattern.source + ")";
23
23
  })
24
24
  .join("|"),
@@ -33,7 +33,7 @@ function create(tokens) {
33
33
  let token = getToken(matches);
34
34
  callback(token);
35
35
  }
36
- }
36
+ },
37
37
  };
38
38
  }
39
39
 
@@ -27,7 +27,7 @@ const OPTIMIZER_CONTEXT_KEY = Symbol();
27
27
  const OPTIONS_DEFAULT = { optimizeTextNodes: true, optimizeStaticNodes: true };
28
28
  const OPTIONS_OPTIMIZE_TEXT_NODES = {
29
29
  optimizeTextNodes: true,
30
- optimizeStaticNodes: false
30
+ optimizeStaticNodes: false,
31
31
  };
32
32
 
33
33
  class OptimizerContext {
@@ -159,7 +159,7 @@ function doOptimizeNode(node, context, options) {
159
159
  let walker = context.createWalker({
160
160
  enterArray(nodes) {
161
161
  return generateNodesForArray(nodes, context, options);
162
- }
162
+ },
163
163
  });
164
164
 
165
165
  return walker.walk(node);
@@ -29,7 +29,7 @@ module.exports = {
29
29
  });
30
30
 
31
31
  nestedOut.end();
32
- }
32
+ },
33
33
  },
34
34
  function (err, result) {
35
35
  if (err) {
@@ -48,5 +48,5 @@ module.exports = {
48
48
  }
49
49
  }
50
50
  );
51
- }
51
+ },
52
52
  };
@@ -24,14 +24,14 @@ function createCache() {
24
24
 
25
25
  callback(null, value);
26
26
  });
27
- }
27
+ },
28
28
  };
29
29
  }
30
30
 
31
31
  var defaultCacheManager = {
32
32
  getCache: function (cacheName) {
33
33
  return caches[cacheName] || (caches[cacheName] = createCache());
34
- }
34
+ },
35
35
  };
36
36
 
37
37
  module.exports = defaultCacheManager;
@@ -37,7 +37,7 @@ class ComponentArgs {
37
37
  options.eventType,
38
38
  options.targetMethod,
39
39
  options.isOnce,
40
- options.extraArgs
40
+ options.extraArgs,
41
41
  ]);
42
42
  }
43
43
 
@@ -66,7 +66,7 @@ class ComponentArgs {
66
66
  return codegen.builder.functionCall(tagVar, tagArgs);
67
67
  };
68
68
  } else {
69
- el.onBeforeGenerateCode(event => {
69
+ el.onBeforeGenerateCode((event) => {
70
70
  let funcTarget = builder.memberExpression(
71
71
  builder.identifierOut(),
72
72
  builder.identifier("c")
@@ -76,7 +76,7 @@ class ComponentArgs {
76
76
  event.insertCode(builder.functionCall(funcTarget, funcArgs));
77
77
  });
78
78
 
79
- el.onAfterGenerateCode(event => {
79
+ el.onAfterGenerateCode((event) => {
80
80
  let funcTarget = builder.memberExpression(
81
81
  builder.identifierOut(),
82
82
  builder.identifier("c")
@@ -99,7 +99,7 @@ module.exports = function assignComponentId(isRepeated) {
99
99
 
100
100
  this.componentIdInfo = {
101
101
  idExpression: idExpression,
102
- nestedIdExpression: nestedIdExpression
102
+ nestedIdExpression: nestedIdExpression,
103
103
  };
104
104
 
105
105
  return this.componentIdInfo;
@@ -188,7 +188,7 @@ const createIndexKey = (forNode, transformHelper) => {
188
188
 
189
189
  const forASTNodes = ["ForEach", "ForEachProp", "ForRange", "ForStatement"];
190
190
 
191
- const getParentFor = el => {
191
+ const getParentFor = (el) => {
192
192
  let current = el;
193
193
  while ((current = current.parentNode) && current.type !== "Macro") {
194
194
  if (current.tagName === "for" || forASTNodes.includes(current.type)) {
@@ -197,7 +197,7 @@ const getParentFor = el => {
197
197
  }
198
198
  };
199
199
 
200
- const getFirstElementChild = el => {
200
+ const getFirstElementChild = (el) => {
201
201
  let current = el.firstChild;
202
202
  while (
203
203
  current &&
@@ -101,7 +101,7 @@ module.exports = function handleComponentBind(options) {
101
101
 
102
102
  // TODO Deprecation warning for inner binds
103
103
  let componentNode = context.createNodeForEl("_component", {
104
- props: builder.literal(componentProps)
104
+ props: builder.literal(componentProps),
105
105
  });
106
106
  el.wrapWith(componentNode);
107
107
  return;
@@ -146,7 +146,7 @@ module.exports = function handleComponentBind(options) {
146
146
  eventArgs.node.addRenderFunctionParam(builder.identifier("state"));
147
147
  }
148
148
 
149
- eventArgs.node.generateAssignRenderCode = eventArgs => {
149
+ eventArgs.node.generateAssignRenderCode = (eventArgs) => {
150
150
  const nodes = [];
151
151
  const templateVar = eventArgs.templateVar;
152
152
  const templateRendererMember = eventArgs.templateRendererMember;
@@ -154,7 +154,7 @@ module.exports = function handleComponentBind(options) {
154
154
 
155
155
  const createRendererArgs = [
156
156
  renderFunctionVar,
157
- builder.literal(componentProps)
157
+ builder.literal(componentProps),
158
158
  ];
159
159
 
160
160
  if (markoComponentVar) {
@@ -177,7 +177,7 @@ module.exports = function handleComponentBind(options) {
177
177
  ),
178
178
  builder.functionCall(defineComponentHelper, [
179
179
  markoComponentVar || builder.literal({}),
180
- templateRendererMember
180
+ templateRendererMember,
181
181
  ])
182
182
  )
183
183
  );
@@ -24,7 +24,7 @@ function getComponentFiles(filename) {
24
24
  styles: [],
25
25
  file: null,
26
26
  browserFile: null,
27
- package: null
27
+ package: null,
28
28
  };
29
29
 
30
30
  let dirFiles = fs.readdirSync(dirname);
@@ -83,7 +83,7 @@ module.exports = function handleComponentEvents() {
83
83
  if (hasComponentEvents) {
84
84
  var attrs = el.getAttributes().concat([]);
85
85
 
86
- attrs.forEach(attr => {
86
+ attrs.forEach((attr) => {
87
87
  var eventType;
88
88
  var targetMethod;
89
89
  var attrName = attr.name;
@@ -150,7 +150,7 @@ module.exports = function handleComponentEvents() {
150
150
  eventType,
151
151
  targetMethod,
152
152
  extraArgs,
153
- isOnce
153
+ isOnce,
154
154
  });
155
155
  } else {
156
156
  // We are adding an event listener for a DOM event (not a custom event)
@@ -171,7 +171,7 @@ module.exports = function handleComponentEvents() {
171
171
  eventType,
172
172
  targetMethod,
173
173
  extraArgs,
174
- isOnce
174
+ isOnce,
175
175
  });
176
176
  }
177
177
  });
@@ -7,7 +7,7 @@ function addPreserve(transformHelper, bodyOnly, condition) {
7
7
  var isCustomTag = el.type !== "HtmlElement";
8
8
 
9
9
  if (bodyOnly) {
10
- el.forEachChild(child => {
10
+ el.forEachChild((child) => {
11
11
  child._canBePreserved = true;
12
12
  });
13
13
  } else {
@@ -15,7 +15,7 @@ function addPreserve(transformHelper, bodyOnly, condition) {
15
15
  }
16
16
 
17
17
  var preserveAttrs = {
18
- key: transformHelper.assignComponentId().nestedIdExpression
18
+ key: transformHelper.assignComponentId().nestedIdExpression,
19
19
  };
20
20
 
21
21
  if (isCustomTag) {
@@ -100,20 +100,20 @@ const preserveTypes = [
100
100
  // The new preserve types
101
101
  {
102
102
  attribute: "no-update",
103
- handler: preserveHandler
103
+ handler: preserveHandler,
104
104
  },
105
105
  {
106
106
  attribute: "no-update-if",
107
- handler: preserveIfHandler
107
+ handler: preserveIfHandler,
108
108
  },
109
109
  {
110
110
  attribute: "no-update-body",
111
- handler: preserveBodyHandler
111
+ handler: preserveBodyHandler,
112
112
  },
113
113
  {
114
114
  attribute: "no-update-body-if",
115
- handler: preserveBodyIfHandler
116
- }
115
+ handler: preserveBodyIfHandler,
116
+ },
117
117
  ];
118
118
 
119
119
  module.exports = function handleComponentPreserve() {
@@ -35,12 +35,6 @@ module.exports = function handleLegacyBind() {
35
35
 
36
36
  const hasWidgetTypes = context.isFlagSet("hasWidgetTypes");
37
37
 
38
- if (hasWidgetTypes) {
39
- context.deprecate(
40
- "The <widget-types> tag is deprecated. Please remove it. See: https://github.com/marko-js/marko/issues/514"
41
- );
42
- }
43
-
44
38
  if (bindAttrValue != null && !bindAttr.isLiteralValue()) {
45
39
  // This is a dynamic expression. The <widget-types> should have been found.
46
40
  if (!hasWidgetTypes) {
@@ -61,7 +55,7 @@ module.exports = function handleLegacyBind() {
61
55
  builder.identifier("marko_componentTypes"),
62
56
  bindAttrValue,
63
57
  true /* computed */
64
- )
58
+ ),
65
59
  ]
66
60
  )
67
61
  );
@@ -84,6 +78,6 @@ module.exports = function handleLegacyBind() {
84
78
  componentModule,
85
79
  rendererModule,
86
80
  isLegacyComponent: true,
87
- rootNodes: [el]
81
+ rootNodes: [el],
88
82
  });
89
83
  };
@@ -8,7 +8,7 @@ const escodegen = require("escodegen");
8
8
  const FLAG_COMPONENT_STYLE = Symbol("COMPONENT_STYLE");
9
9
  const espreeOptions = {
10
10
  sourceType: "script",
11
- ecmaVersion: espree.latestEcmaVersion
11
+ ecmaVersion: espree.latestEcmaVersion,
12
12
  };
13
13
 
14
14
  function handleStyleElement(styleEl, transformHelper) {
@@ -62,7 +62,7 @@ function handleStyleElement(styleEl, transformHelper) {
62
62
  type: lang,
63
63
  code: styleCode,
64
64
  virtualPath: "./" + path.basename(context.filename) + "." + lang,
65
- path: "./" + path.basename(context.filename)
65
+ path: "./" + path.basename(context.filename),
66
66
  });
67
67
  }
68
68
 
@@ -77,14 +77,14 @@ function methodToProperty(method) {
77
77
  value: method.value,
78
78
  kind: "init",
79
79
  method: false,
80
- shorthand: false
80
+ shorthand: false,
81
81
  };
82
82
  }
83
83
 
84
84
  function classToObject(cls, el, transformHelper) {
85
85
  return {
86
86
  type: "ObjectExpression",
87
- properties: cls.body.body.map(method => {
87
+ properties: cls.body.body.map((method) => {
88
88
  if (method.type != "MethodDefinition") {
89
89
  throw Error(
90
90
  "Only methods are allowed on single file component class definitions."
@@ -104,7 +104,7 @@ function classToObject(cls, el, transformHelper) {
104
104
  } else {
105
105
  return method;
106
106
  }
107
- })
107
+ }),
108
108
  };
109
109
  }
110
110
 
@@ -123,7 +123,7 @@ function handleClassDeclaration(classEl, transformHelper) {
123
123
  if (errorIndex != null && errorIndex >= 0) {
124
124
  transformHelper.context.addError({
125
125
  pos: classEl.pos + errorIndex,
126
- message: message
126
+ message: message,
127
127
  });
128
128
  return;
129
129
  }
@@ -151,7 +151,7 @@ function handleClassDeclaration(classEl, transformHelper) {
151
151
  let moduleInfo = {
152
152
  inlineId: componentVar,
153
153
  filename: transformHelper.filename,
154
- requirePath: "./" + path.basename(transformHelper.filename)
154
+ requirePath: "./" + path.basename(transformHelper.filename),
155
155
  };
156
156
 
157
157
  classEl.detach();
@@ -179,7 +179,7 @@ module.exports = function handleRootNodes() {
179
179
  context.addDependency("package: ./" + componentFiles.package);
180
180
  }
181
181
 
182
- componentFiles.styles.forEach(styleFile => {
182
+ componentFiles.styles.forEach((styleFile) => {
183
183
  context.addDependency("./" + styleFile);
184
184
  });
185
185
 
@@ -188,7 +188,7 @@ module.exports = function handleRootNodes() {
188
188
 
189
189
  let moduleInfo = {
190
190
  filename: path.join(dirname, file),
191
- requirePath: "./" + file.slice(0, file.lastIndexOf("."))
191
+ requirePath: "./" + file.slice(0, file.lastIndexOf(".")),
192
192
  };
193
193
 
194
194
  componentModule = rendererModule = moduleInfo;
@@ -199,7 +199,7 @@ module.exports = function handleRootNodes() {
199
199
 
200
200
  componentModule = {
201
201
  filename: path.join(dirname, file),
202
- requirePath: "./" + file.slice(0, file.lastIndexOf("."))
202
+ requirePath: "./" + file.slice(0, file.lastIndexOf(".")),
203
203
  };
204
204
  }
205
205
 
@@ -264,7 +264,7 @@ module.exports = function handleRootNodes() {
264
264
  walker.skip();
265
265
  return;
266
266
  }
267
- }
267
+ },
268
268
  });
269
269
 
270
270
  walker.walk(templateRoot);
@@ -281,7 +281,7 @@ module.exports = function handleRootNodes() {
281
281
 
282
282
  // After normalizing the text nodes to remove whitespace we may have detached
283
283
  // some of the root text nodes so remove those from our list
284
- rootNodes = rootNodes.filter(rootNode => {
284
+ rootNodes = rootNodes.filter((rootNode) => {
285
285
  return rootNode.isDetached() !== true;
286
286
  });
287
287
 
@@ -296,7 +296,7 @@ module.exports = function handleRootNodes() {
296
296
 
297
297
  componentModule = rendererModule = {
298
298
  filename: this.filename,
299
- requirePath: "./" + path.basename(this.filename)
299
+ requirePath: "./" + path.basename(this.filename),
300
300
  };
301
301
  }
302
302
 
@@ -305,6 +305,6 @@ module.exports = function handleRootNodes() {
305
305
  isImplicitComponent,
306
306
  rootNodes,
307
307
  componentModule,
308
- rendererModule
308
+ rendererModule,
309
309
  });
310
310
  };
@@ -9,7 +9,7 @@ module.exports = function handleComponentKeyAttrs() {
9
9
 
10
10
  var attrs = el.attributes.concat([]);
11
11
 
12
- attrs.forEach(attribute => {
12
+ attrs.forEach((attribute) => {
13
13
  const attributeName = attribute.name;
14
14
  if (!attributeName) {
15
15
  return;
@@ -31,7 +31,7 @@ class TransformHelper {
31
31
 
32
32
  getTemplateModule() {
33
33
  return {
34
- requirePath: this.context.getRequirePath(this.filename)
34
+ requirePath: this.context.getRequirePath(this.filename),
35
35
  };
36
36
  }
37
37
 
@@ -8,7 +8,7 @@ module.exports = function codeGenerator(el, codegen) {
8
8
  var bodyFunc = builder.renderBodyFunction(el.body, [
9
9
  builder.identifierOut(),
10
10
  builder.identifier("__component"),
11
- builder.identifier("state")
11
+ builder.identifier("state"),
12
12
  ]);
13
13
 
14
14
  var componentProps = el.getAttributeValue("props");
@@ -24,10 +24,10 @@ module.exports = function transform(el, context) {
24
24
  el.prependChild(
25
25
  builder.vars({
26
26
  widget: builder.functionCall(getWidgetFromOut, [
27
- builder.identifier("out")
27
+ builder.identifier("out"),
28
28
  ]),
29
29
  __component: builder.identifier("widget"),
30
- component: builder.memberExpression("__component", "_c")
30
+ component: builder.memberExpression("__component", "_c"),
31
31
  })
32
32
  );
33
33
  }
@@ -73,14 +73,14 @@ function generateRegisterComponentCode(
73
73
  builder.identifier("module"),
74
74
  builder.identifier("exports")
75
75
  )
76
- )
76
+ ),
77
77
  ]
78
78
  );
79
79
  }
80
80
 
81
81
  registerNode = builder.functionCall(registerComponent, [
82
82
  builder.literal(componentId),
83
- def
83
+ def,
84
84
  ]);
85
85
  } else {
86
86
  registerNode = builder.literal(componentId);
@@ -16,7 +16,7 @@ module.exports = function codeGenerator(el, codegen) {
16
16
 
17
17
  var typesObject = {};
18
18
 
19
- attrs.forEach(attr => {
19
+ attrs.forEach((attr) => {
20
20
  if (!attr.isLiteralString()) {
21
21
  codegen.addError("Component type should be a string");
22
22
  return;
@@ -40,7 +40,7 @@ module.exports = function codeGenerator(el, codegen) {
40
40
  let componentModule = {
41
41
  legacy: true,
42
42
  filename: filename,
43
- requirePath: requirePath
43
+ requirePath: requirePath,
44
44
  };
45
45
 
46
46
  typesObject[attr.name] = generateRegisterComponentCode(
@@ -114,7 +114,7 @@ AsyncValue.prototype = {
114
114
  // notify callbacks
115
115
  notifyCallbacks(this, null, value);
116
116
  }
117
- }
117
+ },
118
118
  };
119
119
 
120
120
  module.exports = AsyncValue;
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- var complain = "MARKO_DEBUG" && require("complain");
3
2
  var AsyncValue = require("./AsyncValue");
4
3
 
5
4
  function safeRenderBody(renderBody, targetOut, data) {
@@ -14,14 +13,6 @@ function requestData(provider, timeout) {
14
13
  var asyncValue = new AsyncValue();
15
14
 
16
15
  if (typeof provider === "function") {
17
- // eslint-disable-next-line no-constant-condition
18
- if ("MARKO_DEBUG") {
19
- complain(
20
- "Passing a callback function to the <await> tag has been deprecated, please use a promise instead.",
21
- { level: 1, locationIndex: 3 }
22
- );
23
- }
24
-
25
16
  var callback = function (err, data) {
26
17
  if (err) {
27
18
  asyncValue.___reject(err);
@@ -102,7 +93,7 @@ module.exports = function awaitTag(input, out) {
102
93
  var awaitInfo = {
103
94
  name: name,
104
95
  clientReorder: clientReorder,
105
- dataProvider: provider
96
+ dataProvider: provider,
106
97
  };
107
98
 
108
99
  if (clientReorder) {
@@ -112,7 +103,7 @@ module.exports = function awaitTag(input, out) {
112
103
  out.global.___clientReorderContext ||
113
104
  (out.global.___clientReorderContext = {
114
105
  instances: [],
115
- nextId: 0
106
+ nextId: 0,
116
107
  });
117
108
 
118
109
  var id = (awaitInfo.id = input.name || clientReorderContext.nextId++);
@@ -159,7 +150,7 @@ module.exports = function awaitTag(input, out) {
159
150
  out.flush(); // Flush everything up to this await instance
160
151
  asyncOut = awaitInfo.out = out.beginAsync({
161
152
  timeout: 0, // We will use our code for controlling timeout
162
- name: name
153
+ name: name,
163
154
  });
164
155
  }
165
156
 
@@ -27,7 +27,7 @@ module.exports = function (input, out) {
27
27
  var asyncOut = out.beginAsync({
28
28
  last: true,
29
29
  timeout: -1,
30
- name: "await-reorderer"
30
+ name: "await-reorderer",
31
31
  });
32
32
 
33
33
  out.onLast(function (next) {