marko 4.26.5 → 4.28.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.
Files changed (266) hide show
  1. package/CHANGELOG.md +2510 -0
  2. package/README.md +1 -1
  3. package/bin/markoc.js +15 -15
  4. package/dist/compiler/CompileContext.js +1 -0
  5. package/dist/compiler/ast/CustomTag.js +2 -2
  6. package/dist/core-tags/components/TransformHelper/convertToComponent.js +1 -1
  7. package/dist/core-tags/components/TransformHelper/handleLegacyBind.js +0 -4
  8. package/dist/core-tags/core/await/renderer.js +0 -4
  9. package/dist/core-tags/migrate/all-tags/body-only-if.js +0 -1
  10. package/dist/core-tags/migrate/all-tags/control-flow-directives.js +0 -1
  11. package/dist/core-tags/migrate/all-tags/dynamic-attributes.js +1 -2
  12. package/dist/core-tags/migrate/all-tags/include-directive.js +0 -2
  13. package/dist/core-tags/migrate/all-tags/legacy-nested-tag.js +0 -2
  14. package/dist/core-tags/migrate/all-tags/marko-init.js +0 -2
  15. package/dist/core-tags/migrate/all-tags/modifier-key.js +0 -2
  16. package/dist/core-tags/migrate/all-tags/ref.js +1 -3
  17. package/dist/core-tags/migrate/all-tags/w-bind.js +0 -2
  18. package/dist/core-tags/migrate/all-tags/w-body.js +0 -2
  19. package/dist/core-tags/migrate/all-tags/w-config.js +0 -2
  20. package/dist/core-tags/migrate/all-tags/w-for.js +0 -3
  21. package/dist/core-tags/migrate/all-tags/w-id.js +1 -4
  22. package/dist/core-tags/migrate/all-tags/w-on.js +1 -4
  23. package/dist/core-tags/migrate/all-tags/w-preserve-attrs.js +0 -2
  24. package/dist/core-tags/migrate/all-tags/w-preserve.js +1 -3
  25. package/dist/core-tags/migrate/all-tags/widget-in-attrs.js +2 -11
  26. package/dist/core-tags/migrate/all-templates/non-standard-template-literals.js +0 -4
  27. package/dist/core-tags/migrate/all-templates/render-calls.js +0 -2
  28. package/dist/core-tags/migrate/assign-tag.js +0 -2
  29. package/dist/core-tags/migrate/async-fragment-tag.js +0 -2
  30. package/dist/core-tags/migrate/async-fragments-tag.js +0 -2
  31. package/dist/core-tags/migrate/await-tag.js +0 -7
  32. package/dist/core-tags/migrate/class-tag.js +0 -2
  33. package/dist/core-tags/migrate/component-globals-tag.js +0 -2
  34. package/dist/core-tags/migrate/for-tag.js +0 -2
  35. package/dist/core-tags/migrate/include-tag.js +0 -1
  36. package/dist/core-tags/migrate/invoke-tag.js +0 -2
  37. package/dist/core-tags/migrate/layout-placeholder-tag.js +0 -1
  38. package/dist/core-tags/migrate/layout-put-tag.js +0 -1
  39. package/dist/core-tags/migrate/layout-use-tag.js +0 -1
  40. package/dist/core-tags/migrate/macro-body-tag.js +0 -2
  41. package/dist/core-tags/migrate/macro-tag.js +0 -2
  42. package/dist/core-tags/migrate/unless-tag.js +0 -1
  43. package/dist/core-tags/migrate/var-tag.js +0 -2
  44. package/dist/node_modules/@internal/components-define-widget-legacy/index-browser.js +0 -10
  45. package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +0 -4
  46. package/dist/node_modules/@internal/components-registry/index-browser.js +2 -0
  47. package/dist/runtime/RenderResult.js +0 -3
  48. package/dist/runtime/components/Component.js +0 -6
  49. package/dist/runtime/components/ComponentDef.js +0 -3
  50. package/dist/runtime/components/ServerComponent.js +0 -4
  51. package/dist/runtime/components/legacy/defineComponent-legacy.js +0 -3
  52. package/dist/runtime/components/legacy/defineRenderer-legacy.js +0 -6
  53. package/dist/runtime/components/legacy/index.js +3 -1
  54. package/dist/runtime/helpers/dynamic-tag.js +3 -0
  55. package/dist/runtime/helpers/for-of.js +3 -1
  56. package/dist/runtime/helpers/interop-require.js +3 -0
  57. package/dist/runtime/html/helpers/attr.js +0 -4
  58. package/dist/runtime/html/helpers/attrs.js +0 -2
  59. package/dist/runtime/html/helpers/merge-attrs.js +0 -3
  60. package/dist/runtime/vdom/VElement.js +0 -3
  61. package/dist/runtime/vdom/helpers/attrs.js +0 -2
  62. package/dist/taglib/taglib-finder/index.js +1 -1
  63. package/dist/taglib/taglib-loader/Taglib.js +2 -1
  64. package/dist/taglib/taglib-loader/index.js +2 -2
  65. package/dist/taglib/taglib-loader/loadTagFromProps.js +15 -0
  66. package/dist/taglib/taglib-loader/loadTaglibFromFile.js +2 -2
  67. package/dist/taglib/taglib-loader/loadTaglibFromProps.js +12 -0
  68. package/docs/10-awesome-marko-features.md +1 -1
  69. package/docs/body-content.md +3 -3
  70. package/docs/class-components.md +6 -6
  71. package/docs/express.md +1 -1
  72. package/docs/fastify.md +4 -4
  73. package/docs/hapi.md +3 -3
  74. package/docs/http.md +1 -1
  75. package/docs/huncwot.md +1 -1
  76. package/docs/installing.md +2 -2
  77. package/docs/koa.md +2 -2
  78. package/docs/lasso.md +1 -1
  79. package/docs/marko-4-upgrade.md +1 -1
  80. package/docs/marko-v4.md +4 -4
  81. package/docs/marko-vs-react.md +2 -2
  82. package/docs/rendering.md +6 -6
  83. package/docs/server-side-rendering.md +3 -3
  84. package/docs/webpack.md +16 -16
  85. package/docs/why-is-marko-fast.md +3 -3
  86. package/package.json +1 -2
  87. package/src/compiler/Builder.js +13 -13
  88. package/src/compiler/CodeGenerator.js +2 -2
  89. package/src/compiler/CodeWriter.js +1 -1
  90. package/src/compiler/CompileContext.js +31 -30
  91. package/src/compiler/Compiler.js +3 -3
  92. package/src/compiler/HtmlJsParser.js +4 -4
  93. package/src/compiler/Migrator.js +2 -2
  94. package/src/compiler/Normalizer.js +5 -5
  95. package/src/compiler/Parser.js +11 -11
  96. package/src/compiler/Walker.js +1 -1
  97. package/src/compiler/ast/ArrayExpression.js +1 -1
  98. package/src/compiler/ast/BinaryExpression.js +1 -1
  99. package/src/compiler/ast/ConditionalExpression.js +1 -1
  100. package/src/compiler/ast/CustomTag.js +14 -14
  101. package/src/compiler/ast/Declaration.js +2 -2
  102. package/src/compiler/ast/DocumentType.js +2 -2
  103. package/src/compiler/ast/ForEach.js +1 -1
  104. package/src/compiler/ast/ForEachProp.js +1 -1
  105. package/src/compiler/ast/ForRange.js +1 -1
  106. package/src/compiler/ast/HtmlAttribute/html/generateCode.js +4 -4
  107. package/src/compiler/ast/HtmlAttribute/vdom/generateCode.js +2 -2
  108. package/src/compiler/ast/HtmlAttributeCollection.js +3 -3
  109. package/src/compiler/ast/HtmlComment.js +1 -1
  110. package/src/compiler/ast/HtmlElement/html/EndTag.js +1 -1
  111. package/src/compiler/ast/HtmlElement/html/StartTag.js +3 -3
  112. package/src/compiler/ast/HtmlElement/html/generateCode.js +5 -5
  113. package/src/compiler/ast/HtmlElement/index.js +1 -1
  114. package/src/compiler/ast/HtmlElement/vdom/HtmlElementVDOM.js +1 -1
  115. package/src/compiler/ast/HtmlElement/vdom/generateCode.js +3 -3
  116. package/src/compiler/ast/If.js +1 -1
  117. package/src/compiler/ast/LogicalExpression.js +1 -1
  118. package/src/compiler/ast/MemberExpression.js +1 -1
  119. package/src/compiler/ast/NewExpression.js +1 -1
  120. package/src/compiler/ast/Node.js +4 -4
  121. package/src/compiler/ast/ObjectExpression.js +2 -2
  122. package/src/compiler/ast/Property.js +1 -1
  123. package/src/compiler/ast/SequenceExpression.js +1 -1
  124. package/src/compiler/ast/TemplateLiteral.js +1 -1
  125. package/src/compiler/ast/TemplateRoot.js +3 -3
  126. package/src/compiler/ast/Text/index.js +1 -1
  127. package/src/compiler/ast/UnaryExpression.js +1 -1
  128. package/src/compiler/ast/UpdateExpression.js +1 -1
  129. package/src/compiler/config.js +1 -1
  130. package/src/compiler/index.js +5 -5
  131. package/src/compiler/modules.js +2 -2
  132. package/src/compiler/util/UniqueVars.js +4 -4
  133. package/src/compiler/util/convertRawJavaScriptAst.js +1 -1
  134. package/src/compiler/util/javaScriptReservedWords.js +1 -1
  135. package/src/compiler/util/macros.js +1 -1
  136. package/src/compiler/util/mergeProps.js +3 -3
  137. package/src/compiler/util/parseJavaScriptArgs.js +1 -1
  138. package/src/compiler/util/parseJavaScriptParams.js +1 -1
  139. package/src/compiler/util/parseRawJavaScriptAst.js +1 -1
  140. package/src/compiler/util/removeComments.js +6 -6
  141. package/src/compiler/util/tokenizer.js +3 -3
  142. package/src/compiler/util/vdom/VDOMOptimizer.js +2 -2
  143. package/src/core-tags/cache/cached-fragment-tag.js +2 -2
  144. package/src/core-tags/cache/default-cache-manager.js +2 -2
  145. package/src/core-tags/components/TransformHelper/ComponentArgsCompiler.js +3 -3
  146. package/src/core-tags/components/TransformHelper/assignComponentId.js +3 -3
  147. package/src/core-tags/components/TransformHelper/convertToComponent.js +7 -5
  148. package/src/core-tags/components/TransformHelper/getComponentFiles.js +1 -1
  149. package/src/core-tags/components/TransformHelper/handleComponentEvents.js +3 -3
  150. package/src/core-tags/components/TransformHelper/handleComponentPreserve.js +7 -7
  151. package/src/core-tags/components/TransformHelper/handleLegacyBind.js +2 -8
  152. package/src/core-tags/components/TransformHelper/handleRootNodes.js +14 -14
  153. package/src/core-tags/components/TransformHelper/handleScopedAttrs.js +1 -1
  154. package/src/core-tags/components/TransformHelper/index.js +1 -1
  155. package/src/core-tags/components/component-tag.js +1 -1
  156. package/src/core-tags/components/components-transformer.js +2 -2
  157. package/src/core-tags/components/util/generateRegisterComponentCode.js +2 -2
  158. package/src/core-tags/components/widget-types-tag.js +2 -2
  159. package/src/core-tags/core/await/AsyncValue.js +1 -1
  160. package/src/core-tags/core/await/renderer.js +3 -12
  161. package/src/core-tags/core/await/reorderer-renderer.js +1 -1
  162. package/src/core-tags/core/core-transformer.js +5 -5
  163. package/src/core-tags/core/html-comment-tag.js +1 -1
  164. package/src/core-tags/core/import-tag.js +1 -1
  165. package/src/core-tags/core/util/parseImport.js +8 -8
  166. package/src/core-tags/html/normalize-script-text.js +1 -1
  167. package/src/core-tags/migrate/all-tags/body-only-if.js +4 -5
  168. package/src/core-tags/migrate/all-tags/control-flow-directives.js +2 -5
  169. package/src/core-tags/migrate/all-tags/dynamic-attributes.js +1 -4
  170. package/src/core-tags/migrate/all-tags/include-directive.js +0 -4
  171. package/src/core-tags/migrate/all-tags/index.js +2 -2
  172. package/src/core-tags/migrate/all-tags/legacy-nested-tag.js +0 -5
  173. package/src/core-tags/migrate/all-tags/marko-init.js +2 -8
  174. package/src/core-tags/migrate/all-tags/modifier-key.js +1 -7
  175. package/src/core-tags/migrate/all-tags/params.js +1 -1
  176. package/src/core-tags/migrate/all-tags/ref.js +1 -5
  177. package/src/core-tags/migrate/all-tags/w-bind.js +8 -12
  178. package/src/core-tags/migrate/all-tags/w-body.js +3 -7
  179. package/src/core-tags/migrate/all-tags/w-config.js +1 -5
  180. package/src/core-tags/migrate/all-tags/w-for.js +1 -8
  181. package/src/core-tags/migrate/all-tags/w-id.js +1 -8
  182. package/src/core-tags/migrate/all-tags/w-on.js +2 -9
  183. package/src/core-tags/migrate/all-tags/w-preserve-attrs.js +1 -5
  184. package/src/core-tags/migrate/all-tags/w-preserve.js +3 -7
  185. package/src/core-tags/migrate/all-tags/widget-in-attrs.js +4 -17
  186. package/src/core-tags/migrate/all-templates/index.js +2 -2
  187. package/src/core-tags/migrate/all-templates/non-standard-template-literals.js +6 -12
  188. package/src/core-tags/migrate/all-templates/render-calls.js +4 -8
  189. package/src/core-tags/migrate/all-templates/widget-data-is-state.js +2 -2
  190. package/src/core-tags/migrate/all-templates/widget-get-template-data.js +2 -2
  191. package/src/core-tags/migrate/assign-tag.js +2 -6
  192. package/src/core-tags/migrate/async-fragment-tag.js +2 -6
  193. package/src/core-tags/migrate/async-fragments-tag.js +0 -4
  194. package/src/core-tags/migrate/await-tag.js +8 -23
  195. package/src/core-tags/migrate/class-tag.js +0 -4
  196. package/src/core-tags/migrate/component-globals-tag.js +0 -4
  197. package/src/core-tags/migrate/for-tag.js +12 -16
  198. package/src/core-tags/migrate/include-tag.js +2 -5
  199. package/src/core-tags/migrate/invoke-tag.js +2 -6
  200. package/src/core-tags/migrate/layout-placeholder-tag.js +0 -3
  201. package/src/core-tags/migrate/layout-put-tag.js +0 -3
  202. package/src/core-tags/migrate/layout-use-tag.js +0 -3
  203. package/src/core-tags/migrate/macro-body-tag.js +0 -5
  204. package/src/core-tags/migrate/macro-tag.js +5 -10
  205. package/src/core-tags/migrate/unless-tag.js +0 -3
  206. package/src/core-tags/migrate/util/addIdScopedAttr.js +1 -1
  207. package/src/core-tags/migrate/util/import-tag.js +6 -6
  208. package/src/core-tags/migrate/util/parseFor.js +20 -20
  209. package/src/core-tags/migrate/util/renderCallToDynamicTag.js +7 -7
  210. package/src/core-tags/migrate/var-tag.js +4 -8
  211. package/src/express.js +1 -1
  212. package/src/hot-reload.js +3 -3
  213. package/src/node-require/index.js +1 -1
  214. package/src/node_modules/@internal/components-define-widget-legacy/index-browser.js +2 -53
  215. package/src/node_modules/@internal/components-entry-legacy/index-browser.js +0 -10
  216. package/src/node_modules/@internal/components-registry/index-browser.js +2 -0
  217. package/src/runtime/RenderResult.js +3 -16
  218. package/src/runtime/components/Component.js +2 -23
  219. package/src/runtime/components/ComponentDef.js +2 -8
  220. package/src/runtime/components/ComponentsContext.js +1 -1
  221. package/src/runtime/components/ServerComponent.js +0 -6
  222. package/src/runtime/components/State.js +2 -2
  223. package/src/runtime/components/attach-detach.js +1 -1
  224. package/src/runtime/components/dom-data.js +1 -1
  225. package/src/runtime/components/legacy/defineComponent-legacy.js +0 -5
  226. package/src/runtime/components/legacy/defineRenderer-legacy.js +0 -16
  227. package/src/runtime/components/legacy/dependencies/index.js +10 -10
  228. package/src/runtime/components/legacy/index.js +5 -0
  229. package/src/runtime/components/legacy/renderer-legacy.js +1 -1
  230. package/src/runtime/components/update-manager.js +1 -1
  231. package/src/runtime/dom-insert.js +1 -1
  232. package/src/runtime/helpers/_weak-map.js +1 -1
  233. package/src/runtime/helpers/bind-component.js +1 -1
  234. package/src/runtime/helpers/dynamic-tag.js +3 -0
  235. package/src/runtime/helpers/for-of.js +1 -6
  236. package/src/runtime/helpers/interop-require.js +3 -0
  237. package/src/runtime/html/AsyncStream.js +5 -5
  238. package/src/runtime/html/BufferedWriter.js +1 -1
  239. package/src/runtime/html/StringWriter.js +1 -1
  240. package/src/runtime/html/helpers/attr.js +0 -9
  241. package/src/runtime/html/helpers/attrs.js +0 -6
  242. package/src/runtime/html/helpers/merge-attrs.js +0 -8
  243. package/src/runtime/html/index.js +1 -1
  244. package/src/runtime/renderable.js +1 -1
  245. package/src/runtime/vdom/AsyncVDOMBuilder.js +2 -2
  246. package/src/runtime/vdom/VComment.js +1 -1
  247. package/src/runtime/vdom/VComponent.js +1 -1
  248. package/src/runtime/vdom/VDocumentFragment.js +1 -1
  249. package/src/runtime/vdom/VElement.js +4 -11
  250. package/src/runtime/vdom/VFragment.js +1 -1
  251. package/src/runtime/vdom/VNode.js +1 -1
  252. package/src/runtime/vdom/VText.js +1 -1
  253. package/src/runtime/vdom/helpers/attrs.js +0 -7
  254. package/src/runtime/vdom/index.js +1 -1
  255. package/src/runtime/vdom/morphdom/fragment.js +1 -1
  256. package/src/runtime/vdom/morphdom/specialElHandlers.js +1 -1
  257. package/src/taglib/taglib-finder/index.js +6 -6
  258. package/src/taglib/taglib-loader/Tag.js +8 -8
  259. package/src/taglib/taglib-loader/Taglib.js +3 -2
  260. package/src/taglib/taglib-loader/index.js +2 -2
  261. package/src/taglib/taglib-loader/loadAttributeFromProps.js +1 -1
  262. package/src/taglib/taglib-loader/loadTagFromProps.js +29 -14
  263. package/src/taglib/taglib-loader/loadTaglibFromFile.js +2 -2
  264. package/src/taglib/taglib-loader/loadTaglibFromProps.js +27 -9
  265. package/src/taglib/taglib-loader/scanTagsDir.js +6 -6
  266. package/src/taglib/taglib-lookup/TaglibLookup.js +8 -8
package/docs/rendering.md CHANGED
@@ -70,7 +70,7 @@ The `render` method returns an async `out` which is used to generate HTML on the
70
70
  var view = require("./view"); // Import `./view.marko`
71
71
  var resultPromise = view.render({});
72
72
 
73
- resultPromise.then(result => {
73
+ resultPromise.then((result) => {
74
74
  result.appendTo(document.body);
75
75
  });
76
76
  ```
@@ -212,8 +212,8 @@ If you need to make data available globally to all views that are rendered as th
212
212
  ```js
213
213
  view.render({
214
214
  $global: {
215
- flags: ["mobile"]
216
- }
215
+ flags: ["mobile"],
216
+ },
217
217
  });
218
218
  ```
219
219
 
@@ -235,9 +235,9 @@ app.get("/", (req, res) => {
235
235
 
236
236
  serializedGlobals: {
237
237
  isIos: true, // Tell marko to serialize isIos above
238
- isAndroid: true // Tell marko to serialize isAndroid above
239
- }
240
- }
238
+ isAndroid: true, // Tell marko to serialize isAndroid above
239
+ },
240
+ },
241
241
  },
242
242
  res
243
243
  );
@@ -138,9 +138,9 @@ template.render(
138
138
  $global: {
139
139
  serializedGlobals: {
140
140
  apiKey: true,
141
- locale: true
142
- }
143
- }
141
+ locale: true,
142
+ },
143
+ },
144
144
  },
145
145
  res
146
146
  );
package/docs/webpack.md CHANGED
@@ -40,19 +40,19 @@ module.exports = {
40
40
  entry: "./client.js",
41
41
  output: {
42
42
  path: __dirname,
43
- filename: "static/bundle.js"
43
+ filename: "static/bundle.js",
44
44
  },
45
45
  resolve: {
46
- extensions: [".js", ".marko"]
46
+ extensions: [".js", ".marko"],
47
47
  },
48
48
  module: {
49
49
  rules: [
50
50
  {
51
51
  test: /\.marko$/,
52
- loader: "@marko/webpack/loader"
53
- }
54
- ]
55
- }
52
+ loader: "@marko/webpack/loader",
53
+ },
54
+ ],
55
+ },
56
56
  };
57
57
  ```
58
58
 
@@ -96,8 +96,8 @@ module: {
96
96
  //...
97
97
  {
98
98
  test: /\.less$/, // matches style.less { ... } from our template
99
- use: ["style-loader", "css-loader", "less-loader"]
100
- }
99
+ use: ["style-loader", "css-loader", "less-loader"],
100
+ },
101
101
  //...
102
102
  ];
103
103
  }
@@ -120,25 +120,25 @@ const CSSExtractPlugin = require("mini-css-extract-plugin");
120
120
  module.exports = {
121
121
  entry: "./client.js",
122
122
  resolve: {
123
- extensions: [".js", ".marko"]
123
+ extensions: [".js", ".marko"],
124
124
  },
125
125
  module: {
126
126
  rules: [
127
127
  {
128
128
  test: /\.marko$/,
129
- loader: "@marko/webpack/loader"
129
+ loader: "@marko/webpack/loader",
130
130
  },
131
131
  {
132
132
  test: /\.(less|css)$/,
133
- use: [CSSExtractPlugin.loader, "css-loader", "less-loader"]
134
- }
135
- ]
133
+ use: [CSSExtractPlugin.loader, "css-loader", "less-loader"],
134
+ },
135
+ ],
136
136
  },
137
137
  plugins: [
138
138
  // Write out CSS bundle to its own file:
139
139
  new CSSExtractPlugin({
140
- filename: "[name].css"
141
- })
142
- ]
140
+ filename: "[name].css",
141
+ }),
142
+ ],
143
143
  };
144
144
  ```
@@ -104,8 +104,8 @@ function render(input, out) {
104
104
  "DIV",
105
105
  {
106
106
  style: marko_styleAttr({
107
- backgroundColor: color
108
- })
107
+ backgroundColor: color,
108
+ }),
109
109
  },
110
110
  0,
111
111
  4
@@ -176,7 +176,7 @@ Marko will produce the following compiled output:
176
176
 
177
177
  ```js
178
178
  var marko_attrs0 = {
179
- class: "hello"
179
+ class: "hello",
180
180
  };
181
181
 
182
182
  function render(input, out) {
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "4.26.5",
3
+ "version": "4.28.0",
4
4
  "license": "MIT",
5
5
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
6
6
  "dependencies": {
7
- "acorn": "^7.4.0",
8
7
  "app-module-path": "^2.2.0",
9
8
  "argly": "^1.0.0",
10
9
  "browser-refresh-client": "^1.0.0",
@@ -65,7 +65,7 @@ function makeNode(arg) {
65
65
  } else if (arg == null) {
66
66
  return undefined;
67
67
  } else if (Array.isArray(arg)) {
68
- return arg.map(arg => {
68
+ return arg.map((arg) => {
69
69
  return makeNode(arg);
70
70
  });
71
71
  } else {
@@ -209,7 +209,7 @@ class Builder {
209
209
  : {
210
210
  params: makeNode(params),
211
211
  of: makeNode(ofExpression),
212
- body
212
+ body,
213
213
  }
214
214
  );
215
215
  }
@@ -221,7 +221,7 @@ class Builder {
221
221
  : {
222
222
  params: makeNode(params),
223
223
  in: makeNode(inExpression),
224
- body
224
+ body,
225
225
  }
226
226
  );
227
227
  }
@@ -235,7 +235,7 @@ class Builder {
235
235
  from: makeNode(from),
236
236
  to: makeNode(to),
237
237
  step: makeNode(step),
238
- body
238
+ body,
239
239
  }
240
240
  );
241
241
  }
@@ -299,7 +299,7 @@ class Builder {
299
299
  body,
300
300
  argument,
301
301
  openTagOnly,
302
- selfClosed
302
+ selfClosed,
303
303
  });
304
304
  }
305
305
  }
@@ -377,7 +377,7 @@ class Builder {
377
377
  return new Assignment({
378
378
  left: moduleExports,
379
379
  right: value,
380
- operator: "="
380
+ operator: "=",
381
381
  });
382
382
  } else {
383
383
  return moduleExports;
@@ -432,7 +432,7 @@ class Builder {
432
432
  }
433
433
  } else {
434
434
  let propertiesObject = properties;
435
- properties = Object.keys(propertiesObject).map(key => {
435
+ properties = Object.keys(propertiesObject).map((key) => {
436
436
  let value = propertiesObject[key];
437
437
  if (!(value instanceof Node)) {
438
438
  value = value = new Literal({ value });
@@ -509,7 +509,7 @@ class Builder {
509
509
 
510
510
  let callee = new MemberExpression({
511
511
  object: new Identifier({ name: "require" }),
512
- property: new Identifier({ name: "resolve" })
512
+ property: new Identifier({ name: "resolve" }),
513
513
  });
514
514
 
515
515
  let args = [path];
@@ -526,7 +526,7 @@ class Builder {
526
526
  return new Scriptlet({
527
527
  code: scriptlet.value,
528
528
  tag: scriptlet.tag,
529
- block: scriptlet.block
529
+ block: scriptlet.block,
530
530
  });
531
531
  }
532
532
 
@@ -615,11 +615,11 @@ class Builder {
615
615
  }
616
616
  if (typeof declaration === "string") {
617
617
  declarations[i] = new VariableDeclarator({
618
- id: new Identifier({ name: declaration })
618
+ id: new Identifier({ name: declaration }),
619
619
  });
620
620
  } else if (declaration instanceof Identifier) {
621
621
  declarations[i] = new VariableDeclarator({
622
- id: declaration
622
+ id: declaration,
623
623
  });
624
624
  } else if (typeof declaration === "object") {
625
625
  if (!(declaration instanceof VariableDeclarator)) {
@@ -640,14 +640,14 @@ class Builder {
640
640
 
641
641
  declarations[i] = new VariableDeclarator({
642
642
  id,
643
- init
643
+ init,
644
644
  });
645
645
  }
646
646
  }
647
647
  }
648
648
  } else if (typeof declarations === "object") {
649
649
  // Convert the object into an array of variables
650
- declarations = Object.keys(declarations).map(key => {
650
+ declarations = Object.keys(declarations).map((key) => {
651
651
  let id = new Identifier({ name: key });
652
652
  let init = makeNode(declarations[key]);
653
653
  return new VariableDeclarator({ id, init });
@@ -135,12 +135,12 @@ class CodeGenerator {
135
135
 
136
136
  _generateCode(node, finalNodes) {
137
137
  if (isArray(node)) {
138
- node.forEach(child => {
138
+ node.forEach((child) => {
139
139
  this._generateCode(child, finalNodes);
140
140
  });
141
141
  return;
142
142
  } else if (node instanceof Container) {
143
- node.forEach(child => {
143
+ node.forEach((child) => {
144
144
  if (child.container === node) {
145
145
  this._generateCode(child, finalNodes);
146
146
  }
@@ -60,7 +60,7 @@ class CodeWriter {
60
60
  ok(nodes, '"nodes" expected');
61
61
  let firstStatement = true;
62
62
 
63
- var writeNode = node => {
63
+ var writeNode = (node) => {
64
64
  if (Array.isArray(node) || node instanceof Container) {
65
65
  node.forEach(writeNode);
66
66
  return;
@@ -61,11 +61,11 @@ const helpers = {
61
61
  merge: "marko/runtime/helpers/merge",
62
62
  attr: {
63
63
  html: "marko/runtime/html/helpers/attr",
64
- vdom: "marko/runtime/vdom/helpers/attr"
64
+ vdom: "marko/runtime/vdom/helpers/attr",
65
65
  },
66
66
  attrs: {
67
67
  html: "marko/runtime/html/helpers/attrs",
68
- vdom: "marko/runtime/vdom/helpers/attrs"
68
+ vdom: "marko/runtime/vdom/helpers/attrs",
69
69
  },
70
70
  mergeAttrs: { html: "marko/runtime/html/helpers/merge-attrs" },
71
71
  classAttr: { html: "marko/runtime/html/helpers/class-attr" },
@@ -76,36 +76,37 @@ const helpers = {
76
76
  dataMarko: { html: "marko/runtime/html/helpers/data-marko" },
77
77
  bindComponent: "marko/runtime/helpers/bind-component",
78
78
  defineComponent: {
79
- vdom: "marko/runtime/components/defineComponent"
79
+ vdom: "marko/runtime/components/defineComponent",
80
80
  },
81
81
  "defineComponent-legacy": {
82
82
  vdom: "marko/runtime/components/legacy/defineComponent-legacy",
83
- html: "marko/runtime/helpers/noop"
83
+ html: "marko/runtime/helpers/noop",
84
84
  },
85
85
  "defineWidget-legacy": "marko/runtime/components/legacy/defineWidget-legacy",
86
86
  dynamicTag: "marko/runtime/helpers/dynamic-tag",
87
87
  escapeXml: {
88
88
  html: {
89
89
  module: "marko/runtime/html/helpers/escape-xml",
90
- method: "x"
91
- }
90
+ method: "x",
91
+ },
92
92
  },
93
93
  escapeDoubleQuoteAttrValue: {
94
94
  html: {
95
95
  module: "marko/runtime/html/helpers/escape-quotes",
96
- method: "d"
97
- }
96
+ method: "d",
97
+ },
98
98
  },
99
99
  escapeScript: {
100
- html: "marko/runtime/html/helpers/escape-script-placeholder"
100
+ html: "marko/runtime/html/helpers/escape-script-placeholder",
101
101
  },
102
102
  escapeStyle: {
103
- html: "marko/runtime/html/helpers/escape-style-placeholder"
103
+ html: "marko/runtime/html/helpers/escape-style-placeholder",
104
104
  },
105
105
  forOf: "marko/runtime/helpers/for-of",
106
106
  forIn: "marko/runtime/helpers/for-in",
107
107
  forRange: "marko/runtime/helpers/for-range",
108
108
  getWidgetFromOut: "marko/runtime/components/legacy/helper-getWidgetFromOut",
109
+ interopRequireDefault: "marko/runtime/helpers/interop-require",
109
110
  loadNestedTag: "marko/runtime/helpers/load-nested-tag",
110
111
  loadTag: "marko/runtime/helpers/load-tag",
111
112
  loadTemplate: "marko/runtime/helpers/load-template",
@@ -115,13 +116,13 @@ const helpers = {
115
116
  rendererLegacy: "marko/runtime/components/legacy/renderer-legacy",
116
117
  registerComponent: {
117
118
  module: "marko/runtime/components/registry",
118
- method: "r"
119
+ method: "r",
119
120
  },
120
121
  str: "marko/runtime/helpers/to-string",
121
122
  styleValue: "marko/runtime/helpers/style-value",
122
123
  styleAttr: {
123
- html: "marko/runtime/html/helpers/style-attr"
124
- }
124
+ html: "marko/runtime/html/helpers/style-attr",
125
+ },
125
126
  };
126
127
 
127
128
  class CompileContext extends EventEmitter {
@@ -268,7 +269,7 @@ class CompileContext extends EventEmitter {
268
269
  return {
269
270
  pop: () => {
270
271
  this.popData(key);
271
- }
272
+ },
272
273
  };
273
274
  }
274
275
 
@@ -337,7 +338,7 @@ class CompileContext extends EventEmitter {
337
338
  node,
338
339
  message,
339
340
  code,
340
- pos
341
+ pos,
341
342
  };
342
343
  } else if (typeof errorInfo === "string") {
343
344
  let message = arguments[0];
@@ -347,7 +348,7 @@ class CompileContext extends EventEmitter {
347
348
  errorInfo = {
348
349
  message,
349
350
  code,
350
- pos
351
+ pos,
351
352
  };
352
353
  }
353
354
 
@@ -489,7 +490,7 @@ class CompileContext extends EventEmitter {
489
490
  message:
490
491
  "Unrecognized tag: " +
491
492
  tagName +
492
- " - More details: https://github.com/marko-js/marko/wiki/Error:-Unrecognized-Tag"
493
+ " - More details: https://github.com/marko-js/marko/wiki/Error:-Unrecognized-Tag",
493
494
  });
494
495
  }
495
496
 
@@ -510,9 +511,9 @@ class CompileContext extends EventEmitter {
510
511
  } else if (typeof attributes === "object") {
511
512
  if (!Array.isArray(attributes)) {
512
513
  attributes = elDef.attributes = Object.keys(attributes).map(
513
- attrName => {
514
+ (attrName) => {
514
515
  var attrDef = {
515
- name: attrName
516
+ name: attrName,
516
517
  };
517
518
 
518
519
  var val = attributes[attrName];
@@ -576,7 +577,7 @@ class CompileContext extends EventEmitter {
576
577
  // may be a macro that gets registered later
577
578
  this.unrecognizedTags.push({
578
579
  node: elNode,
579
- tagName: tagName
580
+ tagName: tagName,
580
581
  });
581
582
  }
582
583
  }
@@ -620,7 +621,7 @@ class CompileContext extends EventEmitter {
620
621
  var foundAttrs = {};
621
622
 
622
623
  // Validate the attributes
623
- attributes.forEach(attr => {
624
+ attributes.forEach((attr) => {
624
625
  let attrName = attr.name;
625
626
  if (!attrName) {
626
627
  // Attribute will be name for placeholder attributes. For example: <div ${data.myAttrs}>
@@ -644,7 +645,7 @@ class CompileContext extends EventEmitter {
644
645
  getTaglibPath(tagDef.taglibId) +
645
646
  '" does not support attribute "' +
646
647
  attrName +
647
- '"'
648
+ '"',
648
649
  });
649
650
  }
650
651
  return;
@@ -665,7 +666,7 @@ class CompileContext extends EventEmitter {
665
666
  // Add default values for any attributes. If an attribute has a declared
666
667
  // default value and the attribute was not found on the element
667
668
  // then add the attribute with the specified default value
668
- tagDef.forEachAttribute(attrDef => {
669
+ tagDef.forEachAttribute((attrDef) => {
669
670
  var attrName = attrDef.name;
670
671
 
671
672
  if (
@@ -674,7 +675,7 @@ class CompileContext extends EventEmitter {
674
675
  ) {
675
676
  attributes.push({
676
677
  name: attrName,
677
- value: builder.literal(attrDef.defaultValue)
678
+ value: builder.literal(attrDef.defaultValue),
678
679
  });
679
680
  } else if (attrDef.required === true) {
680
681
  // TODO Only throw an error if there is no data argument provided (just HTML attributes)
@@ -688,7 +689,7 @@ class CompileContext extends EventEmitter {
688
689
  tagName +
689
690
  '" in taglib "' +
690
691
  getTaglibPath(tagDef.taglibId) +
691
- '".'
692
+ '".',
692
693
  });
693
694
  }
694
695
  }
@@ -744,7 +745,7 @@ class CompileContext extends EventEmitter {
744
745
  builder.literal(relativePath)
745
746
  );
746
747
  let loadFunctionCall = builder.functionCall(this.helper("loadTemplate"), [
747
- loadTemplateArg
748
+ loadTemplateArg,
748
749
  ]);
749
750
  templateVar = this.addStaticVar(varName, loadFunctionCall);
750
751
  }
@@ -773,7 +774,7 @@ class CompileContext extends EventEmitter {
773
774
  this.meta[key] = [value];
774
775
  } else if (
775
776
  !unique ||
776
- !property.some(e => JSON.stringify(e) === JSON.stringify(value))
777
+ !property.some((e) => JSON.stringify(e) === JSON.stringify(value))
777
778
  ) {
778
779
  property.push(value);
779
780
  }
@@ -852,7 +853,7 @@ class CompileContext extends EventEmitter {
852
853
  let staticNodes = [];
853
854
  let staticVars = this.getStaticVars();
854
855
 
855
- let staticVarNodes = Object.keys(staticVars).map(varName => {
856
+ let staticVarNodes = Object.keys(staticVars).map((varName) => {
856
857
  var varInit = staticVars[varName];
857
858
  return builder.variableDeclarator(varName, varInit);
858
859
  });
@@ -953,7 +954,7 @@ class CompileContext extends EventEmitter {
953
954
 
954
955
  optimize(rootNode) {
955
956
  if (this._optimizers) {
956
- this._optimizers.forEach(optimizer => {
957
+ this._optimizers.forEach((optimizer) => {
957
958
  optimizer.optimize(rootNode, this);
958
959
  });
959
960
  }
@@ -978,7 +979,7 @@ class CompileContext extends EventEmitter {
978
979
 
979
980
  CompileContext.prototype.util = {
980
981
  isValidJavaScriptIdentifier: require("./util/isValidJavaScriptIdentifier"),
981
- isJavaScriptReservedWord: require("./util/isJavaScriptReservedWord")
982
+ isJavaScriptReservedWord: require("./util/isJavaScriptReservedWord"),
982
983
  };
983
984
 
984
985
  module.exports = CompileContext;
@@ -58,7 +58,7 @@ function transformTreeHelper(node, context) {
58
58
  }
59
59
 
60
60
  function transformTree(rootNode, context) {
61
- context.taglibLookup.forEachTemplateTransformer(transformer => {
61
+ context.taglibLookup.forEachTemplateTransformer((transformer) => {
62
62
  var transformFunc = transformer.getFunc();
63
63
  rootNode = transformFunc(rootNode, context) || rootNode;
64
64
  });
@@ -111,7 +111,7 @@ class CompiledTemplate {
111
111
  var meta = this.context.meta;
112
112
  if (meta) {
113
113
  var root = path.dirname(this.filename);
114
- return (meta.deps || []).map(dep => resolveDep(dep, root));
114
+ return (meta.deps || []).map((dep) => resolveDep(dep, root));
115
115
  } else {
116
116
  return [];
117
117
  }
@@ -151,7 +151,7 @@ class Compiler {
151
151
 
152
152
  // STAGE 1: Parse the template to produce the initial AST
153
153
  var ast = this.parser.parse(src, context, {
154
- migrate: true && !process.env.MARKO_NO_MIGRATE
154
+ migrate: true && !process.env.MARKO_NO_MIGRATE,
155
155
  });
156
156
  // console.log('ROOT', JSON.stringify(ast, null, 2));
157
157
 
@@ -23,11 +23,11 @@ class HtmlJsParser {
23
23
  onString(event) {
24
24
  if (!event.isStringLiteral) {
25
25
  let value = "";
26
- event.stringParts.forEach(part => {
26
+ event.stringParts.forEach((part) => {
27
27
  if (part.type === "placeholder") {
28
28
  value += "${" + part.value + "}";
29
29
  } else {
30
- value += part.replace(/`|\${/g, match => "\\" + match);
30
+ value += part.replace(/`|\${/g, (match) => "\\" + match);
31
31
  }
32
32
  });
33
33
  event.value = "$nonstandard`" + value + "`";
@@ -90,7 +90,7 @@ class HtmlJsParser {
90
90
 
91
91
  onError(event) {
92
92
  handlers.handleError(event);
93
- }
93
+ },
94
94
  };
95
95
 
96
96
  var mergedOptions = Object.assign({}, this.defaultOptions, options);
@@ -98,7 +98,7 @@ class HtmlJsParser {
98
98
  ignorePlaceholders: mergedOptions.ignorePlaceholders,
99
99
  isOpenTagOnly: function (tagName) {
100
100
  return handlers.isOpenTagOnly(tagName);
101
- }
101
+ },
102
102
  }));
103
103
  parser.parse(src, filename);
104
104
  }
@@ -13,7 +13,7 @@ function migrateNode(node, context) {
13
13
  return;
14
14
  }
15
15
 
16
- context.taglibLookup.forEachTagMigrator(node, migration => {
16
+ context.taglibLookup.forEachTagMigrator(node, (migration) => {
17
17
  // Check to make sure a migration of a certain type is only applied once to a node
18
18
  if (node.isTransformerApplied(migration)) {
19
19
  return;
@@ -61,7 +61,7 @@ function migrateTreeHelper(node, context) {
61
61
  function migrateTree(ast, context) {
62
62
  // TODO: Consider moving this into the loop below so that root level migrations
63
63
  // are also run on new nodes.
64
- context.taglibLookup.forEachTemplateMigrator(migration => {
64
+ context.taglibLookup.forEachTemplateMigrator((migration) => {
65
65
  migration(ast, context);
66
66
  });
67
67
 
@@ -10,7 +10,7 @@ function isIEConditionalComment(comment) {
10
10
 
11
11
  function mergeShorthandClassNames(el, shorthandClassNames, context) {
12
12
  var builder = context.builder;
13
- let classNames = shorthandClassNames.map(className => {
13
+ let classNames = shorthandClassNames.map((className) => {
14
14
  return typeof className == "string"
15
15
  ? builder.literal(className)
16
16
  : className;
@@ -45,7 +45,7 @@ function mergeShorthandClassNames(el, shorthandClassNames, context) {
45
45
  el.setAttributeValue(
46
46
  "class",
47
47
  builder.functionCall(context.helper("classValue"), [
48
- builder.literal(finalClassNames)
48
+ builder.literal(finalClassNames),
49
49
  ])
50
50
  );
51
51
  }
@@ -93,7 +93,7 @@ class Normalizer {
93
93
  if (newNode !== node) {
94
94
  return newNode;
95
95
  }
96
- }
96
+ },
97
97
  })
98
98
  .walk(rootNode);
99
99
 
@@ -110,7 +110,7 @@ class Normalizer {
110
110
  }
111
111
 
112
112
  if (elNode.tagName === "marko-migration-flags") {
113
- elNode.attributes.forEach(attr => {
113
+ elNode.attributes.forEach((attr) => {
114
114
  context.setFlag(attr.name);
115
115
  });
116
116
  elNode.detach();
@@ -147,7 +147,7 @@ class Normalizer {
147
147
  openTagOnly: elNode.openTagOnly,
148
148
  selfClosed: elNode.selfClosed,
149
149
  pos: elNode.pos,
150
- attributes: elNode.attributes
150
+ attributes: elNode.attributes,
151
151
  });
152
152
 
153
153
  newNode.pos = elNode.pos;