marko 4.25.0 → 4.26.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (317) hide show
  1. package/bin/markoc.js +18 -18
  2. package/dist/compiler/CompileContext.js +3 -8
  3. package/dist/core-tags/components/init-components-tag.js +1 -52
  4. package/dist/core-tags/components/package.json +1 -3
  5. package/dist/core-tags/components/preferred-script-location-tag.js +2 -2
  6. package/dist/core-tags/components/preserve-tag.js +1 -27
  7. package/dist/core-tags/core/await/AsyncValue.js +20 -20
  8. package/dist/core-tags/core/await/renderer.js +11 -12
  9. package/dist/core-tags/core/await/reorderer-renderer.js +11 -6
  10. package/dist/index.js +1 -39
  11. package/dist/node-require/index.js +11 -0
  12. package/dist/node_modules/@internal/components-beginComponent/index-browser.js +12 -0
  13. package/dist/{runtime/components/beginComponent.js → node_modules/@internal/components-beginComponent/index.js} +14 -14
  14. package/dist/node_modules/@internal/components-beginComponent/package.json +11 -0
  15. package/dist/{runtime/components/legacy/defineWidget-legacy-browser.js → node_modules/@internal/components-define-widget-legacy/index-browser.js} +47 -47
  16. package/dist/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
  17. package/dist/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
  18. package/dist/node_modules/@internal/components-endComponent/index.js +11 -0
  19. package/dist/node_modules/@internal/components-endComponent/package.json +11 -0
  20. package/dist/node_modules/@internal/components-entry/index-browser.js +9 -0
  21. package/dist/node_modules/@internal/components-entry/index.js +285 -0
  22. package/dist/node_modules/@internal/components-entry/package.json +11 -0
  23. package/dist/{runtime/components/legacy → node_modules/@internal/components-entry-legacy}/index-browser.js +14 -15
  24. package/dist/node_modules/@internal/components-entry-legacy/index.js +14 -0
  25. package/dist/node_modules/@internal/components-entry-legacy/package.json +11 -0
  26. package/dist/{runtime/components/init-components-browser.js → node_modules/@internal/components-registry/index-browser.js} +180 -79
  27. package/dist/node_modules/@internal/components-registry/index.js +34 -0
  28. package/dist/node_modules/@internal/components-registry/package.json +11 -0
  29. package/dist/{runtime/components/util-browser.js → node_modules/@internal/components-util/index-browser.js} +23 -24
  30. package/dist/{runtime/components/util.js → node_modules/@internal/components-util/index.js} +10 -12
  31. package/dist/node_modules/@internal/components-util/package.json +11 -0
  32. package/dist/node_modules/@internal/create-readable/index-browser.js +25 -0
  33. package/dist/node_modules/@internal/create-readable/index.js +52 -0
  34. package/dist/node_modules/@internal/create-readable/package.json +11 -0
  35. package/dist/node_modules/@internal/init-components-tag/index.js +52 -0
  36. package/dist/node_modules/@internal/init-components-tag/package.json +11 -0
  37. package/dist/{loader/index-default.js → node_modules/@internal/loader/index.js} +1 -1
  38. package/dist/node_modules/@internal/loader/package.json +11 -0
  39. package/dist/{core-tags/components/preserve-tag-browser.js → node_modules/@internal/preserve-tag/index-browser.js} +8 -8
  40. package/dist/node_modules/@internal/preserve-tag/index.js +27 -0
  41. package/dist/node_modules/@internal/preserve-tag/package.json +11 -0
  42. package/dist/node_modules/@internal/set-immediate/index-browser.js +17 -0
  43. package/dist/node_modules/@internal/set-immediate/index-worker.js +2 -0
  44. package/dist/node_modules/@internal/set-immediate/index.js +2 -0
  45. package/dist/node_modules/@internal/set-immediate/package.json +11 -0
  46. package/dist/runtime/RenderResult.js +24 -19
  47. package/dist/runtime/components/Component.js +154 -151
  48. package/dist/runtime/components/ComponentDef.js +28 -28
  49. package/dist/runtime/components/ComponentsContext.js +19 -19
  50. package/dist/runtime/components/GlobalComponentsContext.js +4 -4
  51. package/dist/runtime/components/KeySequence.js +3 -3
  52. package/dist/runtime/components/ServerComponent.js +13 -13
  53. package/dist/runtime/components/State.js +28 -28
  54. package/dist/runtime/components/attach-detach.js +9 -9
  55. package/dist/runtime/components/defineComponent.js +5 -5
  56. package/dist/runtime/components/dom-data.js +6 -6
  57. package/dist/runtime/components/event-delegation.js +15 -16
  58. package/dist/runtime/components/index.js +1 -285
  59. package/dist/runtime/components/legacy/browser.json +1 -1
  60. package/dist/runtime/components/legacy/defineComponent-legacy.js +1 -1
  61. package/dist/runtime/components/legacy/defineRenderer-legacy.js +18 -19
  62. package/dist/runtime/components/legacy/defineWidget-legacy.js +1 -18
  63. package/dist/runtime/components/legacy/dependencies/html.js +1 -1
  64. package/dist/runtime/components/legacy/dependencies/index.js +9 -9
  65. package/dist/runtime/components/legacy/helper-getWidgetFromOut.js +3 -3
  66. package/dist/runtime/components/legacy/index.js +1 -14
  67. package/dist/runtime/components/legacy/renderer-legacy.js +43 -43
  68. package/dist/runtime/components/registry.js +1 -34
  69. package/dist/runtime/components/renderer.js +38 -38
  70. package/dist/runtime/components/update-manager.js +10 -10
  71. package/dist/runtime/createOut.js +1 -1
  72. package/dist/runtime/dom-insert.js +6 -6
  73. package/dist/runtime/helpers/_change-case.js +2 -2
  74. package/dist/runtime/helpers/assign.js +3 -2
  75. package/dist/runtime/helpers/dynamic-tag.js +14 -16
  76. package/dist/runtime/helpers/load-template.js +1 -1
  77. package/dist/runtime/helpers/merge.js +3 -1
  78. package/dist/runtime/helpers/style-value.js +2 -2
  79. package/dist/runtime/html/AsyncStream.js +61 -52
  80. package/dist/runtime/html/BufferedWriter.js +5 -1
  81. package/dist/runtime/html/StringWriter.js +7 -3
  82. package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
  83. package/dist/runtime/html/helpers/attr.js +4 -4
  84. package/dist/runtime/html/helpers/attrs.js +3 -3
  85. package/dist/runtime/html/helpers/data-marko.js +4 -6
  86. package/dist/runtime/html/helpers/escape-quotes.js +2 -2
  87. package/dist/runtime/html/helpers/escape-xml.js +1 -1
  88. package/dist/runtime/html/helpers/props-script.js +1 -1
  89. package/dist/runtime/html/index.js +15 -12
  90. package/dist/runtime/renderable.js +5 -5
  91. package/dist/runtime/vdom/AsyncVDOMBuilder.js +102 -103
  92. package/dist/runtime/vdom/VComment.js +7 -7
  93. package/dist/runtime/vdom/VComponent.js +5 -5
  94. package/dist/runtime/vdom/VDocumentFragment.js +8 -8
  95. package/dist/runtime/vdom/VElement.js +55 -54
  96. package/dist/runtime/vdom/VFragment.js +9 -9
  97. package/dist/runtime/vdom/VNode.js +30 -30
  98. package/dist/runtime/vdom/VText.js +7 -7
  99. package/dist/runtime/vdom/helpers/v-element.js +1 -1
  100. package/dist/runtime/vdom/helpers/v-text.js +1 -1
  101. package/dist/runtime/vdom/index.js +12 -22
  102. package/dist/runtime/vdom/morphdom/fragment.js +5 -5
  103. package/dist/runtime/vdom/morphdom/helpers.js +3 -3
  104. package/dist/runtime/vdom/morphdom/index.js +72 -68
  105. package/dist/runtime/vdom/morphdom/specialElHandlers.js +8 -8
  106. package/dist/runtime/vdom/preserve-attrs.js +1 -1
  107. package/dist/runtime/vdom/vdom.js +19 -21
  108. package/docs/body-content.md +2 -2
  109. package/docs/class-components.md +3 -3
  110. package/docs/express.md +1 -1
  111. package/docs/lasso.md +3 -6
  112. package/docs/marko-v4.md +5 -5
  113. package/docs/redux.md +1 -1
  114. package/docs/server-side-rendering.md +2 -2
  115. package/docs/why-is-marko-fast.md +2 -10
  116. package/package.json +1 -1
  117. package/src/browser-refresh.js +2 -2
  118. package/src/compiler/CodeWriter.js +1 -3
  119. package/src/compiler/CompileContext.js +3 -8
  120. package/src/compiler/Compiler.js +4 -4
  121. package/src/compiler/HtmlJsParser.js +1 -1
  122. package/src/compiler/Migrator.js +1 -1
  123. package/src/compiler/Parser.js +3 -3
  124. package/src/compiler/ast/CustomTag.js +9 -11
  125. package/src/compiler/ast/HtmlAttribute/html/generateCode.js +2 -2
  126. package/src/compiler/ast/HtmlAttribute/index.js +1 -1
  127. package/src/compiler/ast/HtmlElement/vdom/HtmlElementVDOM.js +1 -1
  128. package/src/compiler/ast/HtmlElement/vdom/generateCode.js +1 -1
  129. package/src/compiler/ast/TemplateRoot.js +1 -1
  130. package/src/compiler/ast/Text/html/generateCode.js +3 -3
  131. package/src/compiler/ast/Text/vdom/generateCode.js +1 -1
  132. package/src/compiler/index.js +4 -4
  133. package/src/compiler/modules.js +4 -4
  134. package/src/compiler/util/finger-print.js +1 -1
  135. package/src/compiler/util/parseExpression.js +1 -1
  136. package/src/compiler/util/parseStatement.js +1 -1
  137. package/src/compiler/util/removeDashes.js +1 -1
  138. package/src/compiler/util/safeVarName.js +1 -1
  139. package/src/compiler/util/tokenizer.js +1 -1
  140. package/src/core-tags/cache/cached-fragment-tag-transformer.js +1 -1
  141. package/src/core-tags/cache/cached-fragment-tag.js +4 -4
  142. package/src/core-tags/cache/default-cache-manager.js +3 -3
  143. package/src/core-tags/components/TransformHelper/ComponentArgsCompiler.js +1 -1
  144. package/src/core-tags/components/TransformHelper/convertToComponent.js +1 -1
  145. package/src/core-tags/components/TransformHelper/handleComponentPreserveAttrs.js +1 -1
  146. package/src/core-tags/components/init-components-tag.js +1 -54
  147. package/src/core-tags/components/package.json +1 -3
  148. package/src/core-tags/components/preferred-script-location-tag.js +1 -1
  149. package/src/core-tags/components/preserve-tag.js +1 -27
  150. package/src/core-tags/components/util/getTransformHelper.js +1 -1
  151. package/src/core-tags/core/await/AsyncValue.js +3 -3
  152. package/src/core-tags/core/await/noop-render.js +1 -1
  153. package/src/core-tags/core/await/renderer.js +8 -7
  154. package/src/core-tags/core/await/reorderer-renderer.js +35 -14
  155. package/src/core-tags/core/await/transformer.js +1 -1
  156. package/src/core-tags/core/core-transformer.js +2 -2
  157. package/src/core-tags/migrate/all-tags/index.js +1 -1
  158. package/src/core-tags/migrate/all-templates/index.js +1 -1
  159. package/src/core-tags/migrate/include-tag.js +3 -2
  160. package/src/core-tags/migrate/util/parseFor.js +3 -2
  161. package/src/core-tags/migrate/util/printJS.js +1 -1
  162. package/src/defineRenderer.js +1 -1
  163. package/src/express.js +1 -1
  164. package/src/hot-reload.js +5 -5
  165. package/src/index.js +1 -41
  166. package/src/legacy-helpers/notEmpty.js +1 -1
  167. package/src/node-require/index.js +12 -1
  168. package/src/{runtime/components/beginComponent-browser.js → node_modules/@internal/components-beginComponent/index-browser.js} +1 -1
  169. package/src/{runtime/components/beginComponent.js → node_modules/@internal/components-beginComponent/index.js} +2 -2
  170. package/src/node_modules/@internal/components-beginComponent/package.json +11 -0
  171. package/src/{runtime/components/legacy/defineWidget-legacy-browser.js → node_modules/@internal/components-define-widget-legacy/index-browser.js} +21 -23
  172. package/src/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
  173. package/src/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
  174. package/src/{runtime/components/endComponent.js → node_modules/@internal/components-endComponent/index.js} +1 -1
  175. package/src/node_modules/@internal/components-endComponent/package.json +11 -0
  176. package/src/node_modules/@internal/components-entry/index-browser.js +9 -0
  177. package/src/node_modules/@internal/components-entry/index.js +301 -0
  178. package/src/node_modules/@internal/components-entry/package.json +11 -0
  179. package/src/node_modules/@internal/components-entry-legacy/index-browser.js +74 -0
  180. package/src/node_modules/@internal/components-entry-legacy/index.js +15 -0
  181. package/src/node_modules/@internal/components-entry-legacy/package.json +11 -0
  182. package/src/{runtime/components/init-components-browser.js → node_modules/@internal/components-registry/index-browser.js} +240 -75
  183. package/src/node_modules/@internal/components-registry/index.js +44 -0
  184. package/src/node_modules/@internal/components-registry/package.json +11 -0
  185. package/src/{runtime/components/util-browser.js → node_modules/@internal/components-util/index-browser.js} +11 -10
  186. package/src/{runtime/components/util.js → node_modules/@internal/components-util/index.js} +0 -2
  187. package/src/node_modules/@internal/components-util/package.json +11 -0
  188. package/src/node_modules/@internal/create-readable/index-browser.js +30 -0
  189. package/src/node_modules/@internal/create-readable/index.js +57 -0
  190. package/src/node_modules/@internal/create-readable/package.json +11 -0
  191. package/src/node_modules/@internal/init-components-tag/index.js +54 -0
  192. package/src/node_modules/@internal/init-components-tag/package.json +11 -0
  193. package/src/{loader/index-default.js → node_modules/@internal/loader/index.js} +2 -2
  194. package/src/node_modules/@internal/loader/package.json +11 -0
  195. package/src/node_modules/@internal/preserve-tag/index.js +27 -0
  196. package/src/node_modules/@internal/preserve-tag/package.json +11 -0
  197. package/src/node_modules/@internal/set-immediate/index-browser.js +17 -0
  198. package/src/node_modules/@internal/set-immediate/index-worker.js +2 -0
  199. package/src/node_modules/@internal/set-immediate/index.js +2 -0
  200. package/src/node_modules/@internal/set-immediate/package.json +11 -0
  201. package/src/runtime/RenderResult.js +20 -18
  202. package/src/runtime/components/Component.js +44 -41
  203. package/src/runtime/components/ComponentDef.js +9 -9
  204. package/src/runtime/components/ComponentsContext.js +4 -5
  205. package/src/runtime/components/GlobalComponentsContext.js +2 -1
  206. package/src/runtime/components/KeySequence.js +1 -1
  207. package/src/runtime/components/State.js +6 -6
  208. package/src/runtime/components/attach-detach.js +4 -4
  209. package/src/runtime/components/defineComponent.js +1 -1
  210. package/src/runtime/components/event-delegation.js +10 -10
  211. package/src/runtime/components/index.js +1 -301
  212. package/src/runtime/components/jquery.js +2 -2
  213. package/src/runtime/components/legacy/browser.json +1 -1
  214. package/src/runtime/components/legacy/defineRenderer-legacy.js +5 -6
  215. package/src/runtime/components/legacy/defineWidget-legacy.js +1 -18
  216. package/src/runtime/components/legacy/dependencies/html.js +1 -1
  217. package/src/runtime/components/legacy/dependencies/index.js +3 -3
  218. package/src/runtime/components/legacy/helper-getWidgetFromOut.js +3 -3
  219. package/src/runtime/components/legacy/index.js +1 -15
  220. package/src/runtime/components/legacy/renderer-legacy.js +7 -7
  221. package/src/runtime/components/ready.js +2 -2
  222. package/src/runtime/components/registry.js +1 -44
  223. package/src/runtime/components/renderer.js +4 -4
  224. package/src/runtime/components/update-manager.js +1 -1
  225. package/src/runtime/dom-insert.js +8 -8
  226. package/src/runtime/helpers/_weak-map.js +2 -2
  227. package/src/runtime/helpers/assign.js +3 -1
  228. package/src/runtime/helpers/bind-component.js +2 -2
  229. package/src/runtime/helpers/dynamic-tag.js +2 -4
  230. package/src/runtime/helpers/for-in.js +1 -1
  231. package/src/runtime/helpers/load-nested-tag.js +1 -1
  232. package/src/runtime/helpers/load-template.js +1 -1
  233. package/src/runtime/helpers/merge.js +3 -1
  234. package/src/runtime/helpers/noop.js +1 -1
  235. package/src/runtime/helpers/style-value.js +1 -1
  236. package/src/runtime/helpers/to-string.js +1 -1
  237. package/src/runtime/html/AsyncStream.js +90 -76
  238. package/src/runtime/html/BufferedWriter.js +6 -2
  239. package/src/runtime/html/StringWriter.js +15 -9
  240. package/src/runtime/html/helpers/attrs.js +3 -3
  241. package/src/runtime/html/helpers/data-marko.js +0 -2
  242. package/src/runtime/html/helpers/escape-quotes.js +1 -1
  243. package/src/runtime/html/helpers/escape-xml.js +1 -1
  244. package/src/runtime/html/index.js +23 -13
  245. package/src/runtime/queueMicrotask.js +2 -2
  246. package/src/runtime/renderable.js +9 -9
  247. package/src/runtime/vdom/AsyncVDOMBuilder.js +46 -51
  248. package/src/runtime/vdom/VComment.js +3 -3
  249. package/src/runtime/vdom/VDocumentFragment.js +3 -3
  250. package/src/runtime/vdom/VElement.js +17 -13
  251. package/src/runtime/vdom/VFragment.js +1 -1
  252. package/src/runtime/vdom/VNode.js +2 -2
  253. package/src/runtime/vdom/VText.js +3 -3
  254. package/src/runtime/vdom/helpers/attrs.js +1 -1
  255. package/src/runtime/vdom/helpers/const.js +2 -2
  256. package/src/runtime/vdom/helpers/v-element.js +1 -1
  257. package/src/runtime/vdom/helpers/v-text.js +1 -1
  258. package/src/runtime/vdom/index.js +21 -23
  259. package/src/runtime/vdom/morphdom/fragment.js +8 -7
  260. package/src/runtime/vdom/morphdom/index.js +19 -9
  261. package/src/runtime/vdom/morphdom/specialElHandlers.js +6 -6
  262. package/src/runtime/vdom/parse-html.js +4 -4
  263. package/src/runtime/vdom/preserve-attrs.js +1 -1
  264. package/src/runtime/vdom/vdom.js +5 -7
  265. package/src/taglib/taglib-finder/index.js +1 -1
  266. package/src/taglib/taglib-loader/Tag.js +5 -5
  267. package/src/taglib/taglib-loader/Taglib.js +2 -2
  268. package/src/taglib/taglib-loader/json-file-reader.js +1 -1
  269. package/src/taglib/taglib-loader/loadAttributeFromProps.js +1 -1
  270. package/src/taglib/taglib-loader/loadTagFromProps.js +5 -6
  271. package/src/taglib/taglib-loader/tag-def-from-code.js +2 -1
  272. package/src/taglib/taglib-lookup/TaglibLookup.js +2 -2
  273. package/src/taglib/taglib-lookup/index.js +1 -1
  274. package/dist/core-tags/core/await/client-reorder-browser.js +0 -1
  275. package/dist/core-tags/core/await/client-reorder-runtime.min.js +0 -5
  276. package/dist/core-tags/core/await/client-reorder.js +0 -11
  277. package/dist/core-tags/core/await/package.json +0 -6
  278. package/dist/index-browser.js +0 -4
  279. package/dist/loader/index.js +0 -7
  280. package/dist/loader/package.json +0 -5
  281. package/dist/node-require/index-browser.js +0 -1
  282. package/dist/package.json +0 -5
  283. package/dist/runtime/components/beginComponent-browser.js +0 -12
  284. package/dist/runtime/components/endComponent.js +0 -11
  285. package/dist/runtime/components/index-browser.js +0 -14
  286. package/dist/runtime/components/init-components.js +0 -1
  287. package/dist/runtime/components/legacy/package.json +0 -6
  288. package/dist/runtime/components/package.json +0 -12
  289. package/dist/runtime/components/registry-browser.js +0 -73
  290. package/dist/runtime/html/Template.js +0 -63
  291. package/dist/runtime/package.json +0 -5
  292. package/dist/runtime/setImmediate.js +0 -19
  293. package/src/core-tags/core/await/client-reorder-browser.js +0 -1
  294. package/src/core-tags/core/await/client-reorder-runtime.min.js +0 -1
  295. package/src/core-tags/core/await/client-reorder.js +0 -14
  296. package/src/core-tags/core/await/package.json +0 -6
  297. package/src/index-browser.js +0 -3
  298. package/src/loader/index.js +0 -7
  299. package/src/loader/package.json +0 -5
  300. package/src/node-require/index-browser.js +0 -1
  301. package/src/package.json +0 -5
  302. package/src/runtime/components/index-browser.js +0 -15
  303. package/src/runtime/components/init-components.js +0 -1
  304. package/src/runtime/components/legacy/index-browser.js +0 -73
  305. package/src/runtime/components/legacy/package.json +0 -6
  306. package/src/runtime/components/package.json +0 -12
  307. package/src/runtime/components/registry-browser.js +0 -103
  308. package/src/runtime/html/Template.js +0 -62
  309. package/src/runtime/package.json +0 -5
  310. package/src/runtime/setImmediate.js +0 -21
  311. /package/dist/{runtime/components/endComponent-browser.js → node_modules/@internal/components-endComponent/index-browser.js} +0 -0
  312. /package/dist/{core-tags/components/init-components-tag-browser.js → node_modules/@internal/init-components-tag/index-browser.js} +0 -0
  313. /package/dist/{loader → node_modules/@internal/loader}/index-browser.js +0 -0
  314. /package/src/{runtime/components/endComponent-browser.js → node_modules/@internal/components-endComponent/index-browser.js} +0 -0
  315. /package/src/{core-tags/components/init-components-tag-browser.js → node_modules/@internal/init-components-tag/index-browser.js} +0 -0
  316. /package/src/{loader → node_modules/@internal/loader}/index-browser.js +0 -0
  317. /package/src/{core-tags/components/preserve-tag-browser.js → node_modules/@internal/preserve-tag/index-browser.js} +0 -0
@@ -72,11 +72,7 @@ function render(input, out) {
72
72
  var marko_template = require("marko/vdom").t(__filename);
73
73
 
74
74
  function render(input, out) {
75
- out
76
- .e("DIV", null, 3)
77
- .t("Hello ")
78
- .t(input.name)
79
- .t("!");
75
+ out.e("DIV", null, 3).t("Hello ").t(input.name).t("!");
80
76
  }
81
77
  ```
82
78
 
@@ -184,11 +180,7 @@ var marko_attrs0 = {
184
180
  };
185
181
 
186
182
  function render(input, out) {
187
- out
188
- .e("DIV", marko_attrs0, 3)
189
- .t("Hello ")
190
- .t(input.name)
191
- .t("!");
183
+ out.e("DIV", marko_attrs0, 3).t("Hello ").t(input.name).t("!");
192
184
  }
193
185
  ```
194
186
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "4.25.0",
3
+ "version": "4.26.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": {
@@ -1,7 +1,7 @@
1
1
  var enabled = false;
2
2
  var browserRefreshClient = require("browser-refresh-client");
3
3
 
4
- exports.enable = function(options) {
4
+ exports.enable = function (options) {
5
5
  if (!browserRefreshClient.isBrowserRefreshEnabled()) {
6
6
  return;
7
7
  }
@@ -23,7 +23,7 @@ exports.enable = function(options) {
23
23
 
24
24
  browserRefreshClient
25
25
  .enableSpecialReload("*.marko marko.json marko-tag.json")
26
- .onFileModified(function(path) {
26
+ .onFileModified(function (path) {
27
27
  hotReload.handleFileModified(path, options);
28
28
  });
29
29
  };
@@ -49,9 +49,7 @@ class CodeWriter {
49
49
 
50
50
  this.writeStatements(body);
51
51
 
52
- this.decIndent()
53
- .writeLineIndent()
54
- .write("}");
52
+ this.decIndent().writeLineIndent().write("}");
55
53
  }
56
54
 
57
55
  writeStatements(nodes) {
@@ -82,10 +82,7 @@ const helpers = {
82
82
  vdom: "marko/runtime/components/legacy/defineComponent-legacy",
83
83
  html: "marko/runtime/helpers/noop"
84
84
  },
85
- "defineWidget-legacy": {
86
- html: "marko/runtime/components/legacy/defineWidget-legacy",
87
- vdom: "marko/runtime/components/legacy/defineWidget-legacy-browser"
88
- },
85
+ "defineWidget-legacy": "marko/runtime/components/legacy/defineWidget-legacy",
89
86
  dynamicTag: "marko/runtime/helpers/dynamic-tag",
90
87
  escapeXml: {
91
88
  html: {
@@ -117,10 +114,8 @@ const helpers = {
117
114
  renderer: "marko/runtime/components/renderer",
118
115
  rendererLegacy: "marko/runtime/components/legacy/renderer-legacy",
119
116
  registerComponent: {
120
- vdom: {
121
- module: "marko/runtime/components/registry-browser",
122
- method: "r"
123
- }
117
+ module: "marko/runtime/components/registry",
118
+ method: "r"
124
119
  },
125
120
  str: "marko/runtime/helpers/to-string",
126
121
  styleValue: "marko/runtime/helpers/style-value",
@@ -4,14 +4,14 @@ var path = require("path");
4
4
  var CodeGenerator = require("./CodeGenerator");
5
5
  var CodeWriter = require("./CodeWriter");
6
6
  var createError = require("raptor-util/createError");
7
- var resolveDep = require("../runtime/components/legacy/dependencies")
8
- .resolveDep;
7
+ var resolveDep =
8
+ require("../runtime/components/legacy/dependencies").resolveDep;
9
9
 
10
10
  const FLAG_TRANSFORMER_APPLIED = "transformerApply";
11
11
 
12
12
  function transformNode(node, context) {
13
13
  try {
14
- context.taglibLookup.forEachNodeTransformer(node, function(transformer) {
14
+ context.taglibLookup.forEachNodeTransformer(node, function (transformer) {
15
15
  if (node.isDetached()) {
16
16
  return; //The node might have been removed from the tree
17
17
  }
@@ -52,7 +52,7 @@ function transformTreeHelper(node, context) {
52
52
  * The checks to prevent transformers from being applied multiple times makes
53
53
  * sure that this is not a problem.
54
54
  */
55
- node.forEachChild(function(childNode) {
55
+ node.forEachChild(function (childNode) {
56
56
  transformTreeHelper(childNode, context);
57
57
  });
58
58
  }
@@ -96,7 +96,7 @@ class HtmlJsParser {
96
96
  var mergedOptions = Object.assign({}, this.defaultOptions, options);
97
97
  var parser = (this.parser = htmljs.createParser(listeners, {
98
98
  ignorePlaceholders: mergedOptions.ignorePlaceholders,
99
- isOpenTagOnly: function(tagName) {
99
+ isOpenTagOnly: function (tagName) {
100
100
  return handlers.isOpenTagOnly(tagName);
101
101
  }
102
102
  }));
@@ -53,7 +53,7 @@ function migrateTreeHelper(node, context) {
53
53
  * sure that this is not a problem.
54
54
  */
55
55
 
56
- node.forEachChild(function(childNode) {
56
+ node.forEachChild(function (childNode) {
57
57
  migrateTreeHelper(childNode, context);
58
58
  });
59
59
  }
@@ -5,10 +5,10 @@ var Normalizer = require("./Normalizer");
5
5
  var Migrator = require("./Migrator");
6
6
 
7
7
  var COMPILER_ATTRIBUTE_HANDLERS = {
8
- "preserve-whitespace": function(attr, context) {
8
+ "preserve-whitespace": function (attr, context) {
9
9
  context.setPreserveWhitespace(true);
10
10
  },
11
- "preserve-comments": function(attr, context) {
11
+ "preserve-comments": function (attr, context) {
12
12
  context.setPreserveComments(true);
13
13
  }
14
14
  };
@@ -164,7 +164,7 @@ class Parser {
164
164
 
165
165
  this.parentNode.setTrimStartEnd(true);
166
166
 
167
- attributes.forEach(function(attr) {
167
+ attributes.forEach(function (attr) {
168
168
  let attrName = attr.name;
169
169
  let handler = COMPILER_ATTRIBUTE_HANDLERS[attrName];
170
170
 
@@ -14,9 +14,8 @@ function getNestedVariables(elNode, tagDef, codegen) {
14
14
  tagDef.forEachVariable(nestedVar => {
15
15
  let varName;
16
16
  if (nestedVar.nameFromAttribute) {
17
- let possibleNameAttributes = nestedVar.nameFromAttribute.split(
18
- /\s+or\s+|\s*,\s*/i
19
- );
17
+ let possibleNameAttributes =
18
+ nestedVar.nameFromAttribute.split(/\s+or\s+|\s*,\s*/i);
20
19
  for (let i = 0, len = possibleNameAttributes.length; i < len; i++) {
21
20
  let attrName = possibleNameAttributes[i];
22
21
  let keep = false;
@@ -275,7 +274,7 @@ class CustomTag extends HtmlElement {
275
274
  if (tagDef.forEachAttribute) {
276
275
  // Add default values for any attributes from the tag definition. These added properties may get overridden
277
276
  // by get overridden from the attributes found on the actual HTML element.
278
- tagDef.forEachAttribute(function(attrDef) {
277
+ tagDef.forEachAttribute(function (attrDef) {
279
278
  if (attrDef.hasOwnProperty("defaultValue")) {
280
279
  handleAttr(
281
280
  attrDef.name,
@@ -351,7 +350,7 @@ class CustomTag extends HtmlElement {
351
350
  if (tagDef.forEachImportedVariable) {
352
351
  // Imported variables are used to add input properties to a custom tag based on data/variables
353
352
  // found in the compiled template
354
- tagDef.forEachImportedVariable(function(importedVariable) {
353
+ tagDef.forEachImportedVariable(function (importedVariable) {
355
354
  let propName = importedVariable.targetProperty;
356
355
  let propExpression = importedVariable.expression;
357
356
 
@@ -651,7 +650,7 @@ class CustomTag extends HtmlElement {
651
650
 
652
651
  if (tagDef.bodyFunction) {
653
652
  let bodyFunction = tagDef.bodyFunction;
654
- let bodyFunctionParams = bodyFunction.params.map(function(param) {
653
+ let bodyFunctionParams = bodyFunction.params.map(function (param) {
655
654
  return builder.identifier(param);
656
655
  });
657
656
 
@@ -662,9 +661,8 @@ class CustomTag extends HtmlElement {
662
661
  renderBodyFunction.params.push(this._nestedTagVar);
663
662
  } else {
664
663
  if (nestedVariableNames && nestedVariableNames.length) {
665
- renderBodyFunction.params = renderBodyFunction.params.concat(
666
- nestedVariableNames
667
- );
664
+ renderBodyFunction.params =
665
+ renderBodyFunction.params.concat(nestedVariableNames);
668
666
  }
669
667
  }
670
668
  }
@@ -798,8 +796,8 @@ class CustomTag extends HtmlElement {
798
796
  let renderBody = this.generateRenderBodyCode(codegen, body);
799
797
  let additionalAttrs = renderBody &&
800
798
  !isDynamicTag && {
801
- [(tagDef.bodyFunction && tagDef.bodyFunction.name) ||
802
- "renderBody"]: renderBody
799
+ [(tagDef.bodyFunction && tagDef.bodyFunction.name) || "renderBody"]:
800
+ renderBody
803
801
  };
804
802
  let inputProps = this.buildInputProps(codegen, additionalAttrs);
805
803
  let renderTagNode = this.generateRenderNode(
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  var attr = require("../../../../runtime/html/helpers/attr");
4
- var escapeDoubleQuoteAttrValue = require("../../../../runtime/html/helpers/escape-quotes")
5
- .d;
4
+ var escapeDoubleQuoteAttrValue =
5
+ require("../../../../runtime/html/helpers/escape-quotes").d;
6
6
 
7
7
  function isStringLiteral(node) {
8
8
  return node.type === "Literal" && typeof node.value === "string";
@@ -79,7 +79,7 @@ class HtmlAttribute extends Node {
79
79
  }
80
80
  }
81
81
 
82
- HtmlAttribute.isHtmlAttribute = function(attr) {
82
+ HtmlAttribute.isHtmlAttribute = function (attr) {
83
83
  return attr instanceof HtmlAttribute;
84
84
  };
85
85
 
@@ -124,7 +124,7 @@ class HtmlElementVDOM extends Node {
124
124
  if (attributes != null && attributes.length !== 0) {
125
125
  let explicitAttrs = null;
126
126
  let attrs = [];
127
- let addAttr = function(name, value) {
127
+ let addAttr = function (name, value) {
128
128
  hasNamedAttributes = true;
129
129
 
130
130
  if (!SIMPLE_ATTRS[name]) {
@@ -33,7 +33,7 @@ function checkPropertiesStatic(properties) {
33
33
  return true;
34
34
  }
35
35
 
36
- module.exports = function(node, codegen) {
36
+ module.exports = function (node, codegen) {
37
37
  var builder = codegen.builder;
38
38
  var context = codegen.context;
39
39
  var body = codegen.generateCode(node.body);
@@ -2,7 +2,7 @@
2
2
  var Node = require("./Node");
3
3
 
4
4
  function createVarsArray(vars) {
5
- return Object.keys(vars).map(function(varName) {
5
+ return Object.keys(vars).map(function (varName) {
6
6
  var varInit = vars[varName];
7
7
  return {
8
8
  id: varName,
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var escapeXmlOrNullish = require("../../../../runtime/html/helpers/escape-xml")
4
- .x;
3
+ var escapeXmlOrNullish =
4
+ require("../../../../runtime/html/helpers/escape-xml").x;
5
5
  var Literal = require("../../Literal");
6
6
 
7
- module.exports = function(node, codegen) {
7
+ module.exports = function (node, codegen) {
8
8
  var context = codegen.context;
9
9
  var argument = codegen.generateCode(node.argument);
10
10
  var escape = node.escape !== false;
@@ -4,7 +4,7 @@ var TextVDOM = require("./TextVDOM");
4
4
  var Literal = require("../../Literal");
5
5
  var he = require("he"); // Used for dealing with HTML entities
6
6
 
7
- module.exports = function(node, codegen, vdomUtil) {
7
+ module.exports = function (node, codegen, vdomUtil) {
8
8
  var argument = codegen.generateCode(node.argument);
9
9
  var escape = node.escape !== false;
10
10
  var isStatic = null;
@@ -14,7 +14,7 @@ var taglib = require("../taglib");
14
14
  var defaults = extend({}, globalConfig);
15
15
 
16
16
  Object.defineProperty(exports, "defaultOptions", {
17
- get: function() {
17
+ get: function () {
18
18
  return globalConfig;
19
19
  },
20
20
  enumerable: true,
@@ -22,7 +22,7 @@ Object.defineProperty(exports, "defaultOptions", {
22
22
  });
23
23
 
24
24
  Object.defineProperty(exports, "config", {
25
- get: function() {
25
+ get: function () {
26
26
  return globalConfig;
27
27
  },
28
28
  enumerable: true,
@@ -141,7 +141,7 @@ function compileFile(filename, options, callback) {
141
141
  options.sourceOnly = options.sourceOnly !== false;
142
142
 
143
143
  if (callback) {
144
- fs.readFile(filename, { encoding: "utf8" }, function(err, templateSrc) {
144
+ fs.readFile(filename, { encoding: "utf8" }, function (err, templateSrc) {
145
145
  if (err) {
146
146
  return callback(err);
147
147
  }
@@ -292,7 +292,7 @@ function buildTaglibLookup(dirname) {
292
292
 
293
293
  exports.buildTaglibLookup = buildTaglibLookup;
294
294
 
295
- exports.registerTaglib = function(filePath) {
295
+ exports.registerTaglib = function (filePath) {
296
296
  registerCoreTaglibs();
297
297
 
298
298
  ok(typeof filePath === "string", '"filePath" should be a string');
@@ -14,19 +14,19 @@ const deresolveOptions = {
14
14
  // We only need this to make Try Online work :/
15
15
 
16
16
  var helpers = {
17
- require: function(path) {
17
+ require: function (path) {
18
18
  return nativeRequire(path);
19
19
  },
20
20
 
21
- resolve: function(path) {
21
+ resolve: function (path) {
22
22
  return nativeRequire.resolve(path);
23
23
  },
24
24
 
25
- resolveFrom: function(from, target) {
25
+ resolveFrom: function (from, target) {
26
26
  return resolveFrom(from, target);
27
27
  },
28
28
 
29
- deresolve: function(targetFilename, from) {
29
+ deresolve: function (targetFilename, from) {
30
30
  return deresolve(targetFilename, from, deresolveOptions);
31
31
  }
32
32
  };
@@ -1,5 +1,5 @@
1
1
  var sha1 = require("simple-sha1");
2
2
 
3
- module.exports = function(str) {
3
+ module.exports = function (str) {
4
4
  return sha1.sync(str);
5
5
  };
@@ -1,5 +1,5 @@
1
1
  var parseJavaScript = require("./parseJavaScript");
2
2
 
3
- module.exports = function(src, builder) {
3
+ module.exports = function (src, builder) {
4
4
  return parseJavaScript(src, builder, true /* isExpression */);
5
5
  };
@@ -1,5 +1,5 @@
1
1
  var parseJavaScript = require("./parseJavaScript");
2
2
 
3
- module.exports = function(src, builder) {
3
+ module.exports = function (src, builder) {
4
4
  return parseJavaScript(src, builder, false /* isExpression */);
5
5
  };
@@ -1,5 +1,5 @@
1
1
  module.exports = function removeDashes(str) {
2
- return str.replace(/-([a-z])/g, function(match, lower) {
2
+ return str.replace(/-([a-z])/g, function (match, lower) {
3
3
  return lower.toUpperCase();
4
4
  });
5
5
  };
@@ -8,7 +8,7 @@ function safeVarName(varName) {
8
8
 
9
9
  return varName
10
10
  .replace(/[^A-Za-z0-9_]/g, "_")
11
- .replace(/^[0-9]+/, function(match) {
11
+ .replace(/^[0-9]+/, function (match) {
12
12
  var str = "";
13
13
  for (var i = 0; i < match.length; i++) {
14
14
  str += "_";
@@ -26,7 +26,7 @@ function create(tokens) {
26
26
  );
27
27
 
28
28
  return {
29
- forEachToken: function(value, callback) {
29
+ forEachToken: function (value, callback) {
30
30
  tokensRegExp.lastIndex = 0; // Start searching from the beginning again
31
31
  var matches;
32
32
  while ((matches = tokensRegExp.exec(value))) {
@@ -1,6 +1,6 @@
1
1
  var defaultCacheManagerPath = require.resolve("./default-cache-manager");
2
2
 
3
- module.exports = function(el, context) {
3
+ module.exports = function (el, context) {
4
4
  context.deprecate("The <cached-fragment> tag is deprecated.");
5
5
  if (!el.hasAttribute("cache-manager")) {
6
6
  var requirePath = context.getRequirePath(defaultCacheManagerPath);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  module.exports = {
3
- render: function(input, out) {
3
+ render: function (input, out) {
4
4
  var cacheKey = input.cacheKey;
5
5
  if (!cacheKey) {
6
6
  throw new Error("cache-key is required for <cached-fragment>");
@@ -17,21 +17,21 @@ module.exports = {
17
17
  cache.get(
18
18
  cacheKey,
19
19
  {
20
- builder: function(callback) {
20
+ builder: function (callback) {
21
21
  var nestedOut = out.createOut();
22
22
 
23
23
  if (input.renderBody) {
24
24
  input.renderBody(nestedOut);
25
25
  }
26
26
 
27
- nestedOut.on("error", callback).on("finish", function(result) {
27
+ nestedOut.on("error", callback).on("finish", function (result) {
28
28
  callback(null, result.getOutput());
29
29
  });
30
30
 
31
31
  nestedOut.end();
32
32
  }
33
33
  },
34
- function(err, result) {
34
+ function (err, result) {
35
35
  if (err) {
36
36
  return asyncOut.error(err);
37
37
  }
@@ -4,14 +4,14 @@ function createCache() {
4
4
  var cache = {};
5
5
 
6
6
  return {
7
- get: function(cacheKey, options, callback) {
7
+ get: function (cacheKey, options, callback) {
8
8
  var value = cache[cacheKey];
9
9
  if (value !== undefined) {
10
10
  return callback(null, value);
11
11
  }
12
12
 
13
13
  var builder = options.builder;
14
- builder(function(err, value) {
14
+ builder(function (err, value) {
15
15
  if (err) {
16
16
  return callback(err);
17
17
  }
@@ -29,7 +29,7 @@ function createCache() {
29
29
  }
30
30
 
31
31
  var defaultCacheManager = {
32
- getCache: function(cacheName) {
32
+ getCache: function (cacheName) {
33
33
  return caches[cacheName] || (caches[cacheName] = createCache());
34
34
  }
35
35
  };
@@ -61,7 +61,7 @@ class ComponentArgs {
61
61
  args = finalizeArgs(args, builder);
62
62
 
63
63
  if (el.type === "CustomTag") {
64
- el.generateRenderTagCode = function(codegen, tagVar, tagArgs) {
64
+ el.generateRenderTagCode = function (codegen, tagVar, tagArgs) {
65
65
  tagArgs = tagArgs.concat(args);
66
66
  return codegen.builder.functionCall(tagVar, tagArgs);
67
67
  };
@@ -135,7 +135,7 @@ module.exports = function handleComponentBind(options) {
135
135
  defineComponentHelper = this.context.helper("defineComponent");
136
136
  }
137
137
 
138
- this.context.on("beforeGenerateCode:TemplateRoot", function(eventArgs) {
138
+ this.context.on("beforeGenerateCode:TemplateRoot", function (eventArgs) {
139
139
  eventArgs.node.addRenderFunctionParam(builder.identifier("__component"));
140
140
 
141
141
  if (isLegacyComponent) {
@@ -11,7 +11,7 @@ module.exports = function handleComponentPreserveAttrs() {
11
11
 
12
12
  var noUpdateAttrs = [];
13
13
 
14
- el.forEachAttribute(function(attr) {
14
+ el.forEachAttribute(function (attr) {
15
15
  var attrName = attr.name;
16
16
 
17
17
  if (attrName && attrName.endsWith(NO_UPDATE_ATTR_SUFFIX)) {
@@ -1,54 +1 @@
1
- "use strict";
2
-
3
- const INIT_COMPONENTS_KEY = Symbol();
4
-
5
- const addComponentsFromContext = require("../../runtime/components")
6
- .___addComponentsFromContext;
7
- const getInitComponentsCode = require("../../runtime/components")
8
- .___getInitComponentsCode;
9
-
10
- function addComponentsFromOut(source, target) {
11
- const sourceOut = source.out || source;
12
- const targetOut = target || sourceOut;
13
- const componentsContext = sourceOut.___components;
14
- const componentDefs = targetOut.writer.get("componentDefs");
15
- addComponentsFromContext(componentsContext, componentDefs);
16
- }
17
-
18
- function addInitScript(writer) {
19
- const out = writer.state.root;
20
- const componentDefs = writer.get("componentDefs");
21
- writer.script(getInitComponentsCode(out, componentDefs));
22
- }
23
-
24
- module.exports = function render(input, out) {
25
- const $global = out.global;
26
- if ($global[INIT_COMPONENTS_KEY] === undefined) {
27
- $global[INIT_COMPONENTS_KEY] = true;
28
-
29
- out.on("await:finish", addComponentsFromOut);
30
- out.on("___toString", addInitScript);
31
-
32
- if (out.isSync() === true) {
33
- // Generate initialization code for any of the UI components that were
34
- // rendered synchronously
35
- addComponentsFromOut(out);
36
- } else {
37
- // Generate initialization code for any of the UI components that were
38
- // rendered asynchronously, but were outside an `<await>` tag
39
- // (each `<await>` tag will have its own component initialization block)
40
- const asyncOut = out.beginAsync({ last: true, timeout: -1 });
41
- out.onLast(function(next) {
42
- // Ensure we're getting init code starting from the root
43
- let rootOut = out;
44
- while (rootOut._parentOut) {
45
- rootOut = rootOut._parentOut;
46
- }
47
- // Write out all of the component init code from the main out
48
- addComponentsFromOut(rootOut, asyncOut);
49
- asyncOut.end();
50
- next();
51
- });
52
- }
53
- }
54
- };
1
+ module.exports = require("@internal/init-components-tag");
@@ -1,7 +1,5 @@
1
1
  {
2
2
  "browser": {
3
- "./getRequirePath.js": "./getRequirePath-browser.js",
4
- "./init-components-tag.js": "./init-components-tag-browser.js",
5
- "./preserve-tag.js": "./preserve-tag-browser.js"
3
+ "./getRequirePath.js": "./getRequirePath-browser.js"
6
4
  }
7
5
  }
@@ -16,7 +16,7 @@ module.exports = function render(input, out) {
16
16
  forceScriptTagAtThisPoint(out);
17
17
  } else {
18
18
  const asyncOut = out.beginAsync({ last: true, timeout: -1 });
19
- out.onLast(function(next) {
19
+ out.onLast(function (next) {
20
20
  forceScriptTagAtThisPoint(asyncOut);
21
21
  asyncOut.end();
22
22
  next();
@@ -1,27 +1 @@
1
- var ComponentsContext = require("../../runtime/components/ComponentsContext");
2
- var getComponentsContext = ComponentsContext.___getComponentsContext;
3
-
4
- module.exports = function render(input, out) {
5
- var shouldPreserve = Boolean(!("i" in input) || input.i);
6
- var isComponent = !input.n;
7
-
8
- if (isComponent) {
9
- out.bf(out.___assignedKey, out.___assignedComponentDef.___component, true);
10
- }
11
-
12
- if (input.renderBody) {
13
- if (shouldPreserve) {
14
- var componentsContext = getComponentsContext(out);
15
- var parentPreserved = componentsContext.___isPreserved;
16
- componentsContext.___isPreserved = true;
17
- input.renderBody(out);
18
- componentsContext.___isPreserved = parentPreserved;
19
- } else {
20
- input.renderBody(out);
21
- }
22
- }
23
-
24
- if (isComponent) {
25
- out.ef();
26
- }
27
- };
1
+ module.exports = require("@internal/preserve-tag");
@@ -1,5 +1,5 @@
1
1
  var TransformHelper = require("../TransformHelper");
2
2
 
3
- module.exports = function(el, context) {
3
+ module.exports = function (el, context) {
4
4
  return new TransformHelper(el, context);
5
5
  };
@@ -46,7 +46,7 @@ AsyncValue.prototype = {
46
46
  * The given callback will be invoked when there is an error or resolved data
47
47
  * available.
48
48
  */
49
- ___done: function(callback) {
49
+ ___done: function (callback) {
50
50
  // Do we already have data or error?
51
51
  if (this.___settled) {
52
52
  // invoke the callback immediately
@@ -63,7 +63,7 @@ AsyncValue.prototype = {
63
63
  * its initial state so that any future requests to load data will trigger a
64
64
  * new load call.
65
65
  */
66
- ___reject: function(err) {
66
+ ___reject: function (err) {
67
67
  if (this.___settled) {
68
68
  return;
69
69
  }
@@ -84,7 +84,7 @@ AsyncValue.prototype = {
84
84
  /**
85
85
  * This method will trigger any callbacks to be notified of data.
86
86
  */
87
- ___resolve: function(value) {
87
+ ___resolve: function (value) {
88
88
  if (this.___settled) {
89
89
  return;
90
90
  }