marko 4.25.0 → 4.26.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 (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
@@ -1,13 +1,13 @@
1
- var componentsUtil = require("./util");
1
+ var componentsUtil = require("@internal/components-util");
2
2
  var componentLookup = componentsUtil.___componentLookup;
3
3
 
4
4
  var ComponentsContext = require("./ComponentsContext");
5
5
  var getComponentsContext = ComponentsContext.___getComponentsContext;
6
- var registry = require("./registry");
6
+ var registry = require("@internal/components-registry");
7
7
  var copyProps = require("raptor-util/copyProps");
8
8
  var isServer = componentsUtil.___isServer === true;
9
- var beginComponent = require("./beginComponent");
10
- var endComponent = require("./endComponent");
9
+ var beginComponent = require("@internal/components-beginComponent");
10
+ var endComponent = require("@internal/components-endComponent");
11
11
 
12
12
  var COMPONENT_BEGIN_ASYNC_ADDED_KEY = "$wa";
13
13
 
@@ -4,7 +4,7 @@ var updatesScheduled = false;
4
4
  var batchStack = []; // A stack of batched updates
5
5
  var unbatchedQueue = []; // Used for scheduled batched updates
6
6
 
7
- var setImmediate = require("../setImmediate");
7
+ var setImmediate = require("@internal/set-immediate").___setImmediate;
8
8
 
9
9
  /**
10
10
  * This function is called when we schedule the update of "unbatched"
@@ -1,5 +1,5 @@
1
1
  var extend = require("raptor-util/extend");
2
- var componentsUtil = require("./components/util");
2
+ var componentsUtil = require("@internal/components-util");
3
3
  var destroyComponentForNode = componentsUtil.___destroyComponentForNode;
4
4
  var destroyNodeRecursive = componentsUtil.___destroyNodeRecursive;
5
5
  var helpers = require("./vdom/morphdom/helpers");
@@ -24,21 +24,21 @@ function beforeRemove(referenceEl) {
24
24
  destroyComponentForNode(referenceEl);
25
25
  }
26
26
 
27
- module.exports = function(target, getEl, afterInsert) {
27
+ module.exports = function (target, getEl, afterInsert) {
28
28
  extend(target, {
29
- appendTo: function(referenceEl) {
29
+ appendTo: function (referenceEl) {
30
30
  referenceEl = resolveEl(referenceEl);
31
31
  var el = getEl(this, referenceEl);
32
32
  insertBefore(el, null, referenceEl);
33
33
  return afterInsert(this, referenceEl);
34
34
  },
35
- prependTo: function(referenceEl) {
35
+ prependTo: function (referenceEl) {
36
36
  referenceEl = resolveEl(referenceEl);
37
37
  var el = getEl(this, referenceEl);
38
38
  insertBefore(el, referenceEl.firstChild || null, referenceEl);
39
39
  return afterInsert(this, referenceEl);
40
40
  },
41
- replace: function(referenceEl) {
41
+ replace: function (referenceEl) {
42
42
  referenceEl = resolveEl(referenceEl);
43
43
  var el = getEl(this, referenceEl);
44
44
  beforeRemove(referenceEl);
@@ -46,7 +46,7 @@ module.exports = function(target, getEl, afterInsert) {
46
46
  removeChild(referenceEl);
47
47
  return afterInsert(this, referenceEl);
48
48
  },
49
- replaceChildrenOf: function(referenceEl) {
49
+ replaceChildrenOf: function (referenceEl) {
50
50
  referenceEl = resolveEl(referenceEl);
51
51
  var el = getEl(this, referenceEl);
52
52
 
@@ -61,13 +61,13 @@ module.exports = function(target, getEl, afterInsert) {
61
61
  insertBefore(el, null, referenceEl);
62
62
  return afterInsert(this, referenceEl);
63
63
  },
64
- insertBefore: function(referenceEl) {
64
+ insertBefore: function (referenceEl) {
65
65
  referenceEl = resolveEl(referenceEl);
66
66
  var el = getEl(this, referenceEl);
67
67
  insertBefore(el, referenceEl, referenceEl.parentNode);
68
68
  return afterInsert(this, referenceEl);
69
69
  },
70
- insertAfter: function(referenceEl) {
70
+ insertAfter: function (referenceEl) {
71
71
  referenceEl = resolveEl(referenceEl);
72
72
  var el = getEl(this, referenceEl);
73
73
  insertAfter(el, referenceEl, referenceEl.parentNode);
@@ -5,10 +5,10 @@ module.exports =
5
5
  function WeakMap() {
6
6
  var id = seed + counter++;
7
7
  return {
8
- get: function(ref) {
8
+ get: function (ref) {
9
9
  return ref[id];
10
10
  },
11
- set: function(ref, value) {
11
+ set: function (ref, value) {
12
12
  ref[id] = value;
13
13
  }
14
14
  };
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
4
+
3
5
  /**
4
6
  * Merges object properties
5
7
  */
@@ -9,7 +11,7 @@ module.exports = function assign() {
9
11
  var source = arguments[i];
10
12
  if (source != null) {
11
13
  for (var k in source) {
12
- if (source.hasOwnProperty(k)) {
14
+ if (hasOwnProperty.call(source, k)) {
13
15
  into[k] = source[k];
14
16
  }
15
17
  }
@@ -1,8 +1,8 @@
1
1
  var createRendererFunc = require("../components/renderer");
2
2
 
3
- module.exports = function(componentProps) {
3
+ module.exports = function (componentProps) {
4
4
  var renderer = createRendererFunc(
5
- function(data, out, component, state) {
5
+ function (data, out, component, state) {
6
6
  data.$renderBody(out, component, state);
7
7
  },
8
8
  componentProps,
@@ -6,16 +6,14 @@ var ComponentsContext = require("../components/ComponentsContext");
6
6
  var getComponentsContext = ComponentsContext.___getComponentsContext;
7
7
  var ComponentDef = require("../components/ComponentDef");
8
8
  var w10NOOP = require("warp10/constants").NOOP;
9
- var RENDER_BODY_TO_JSON = function() {
9
+ var RENDER_BODY_TO_JSON = function () {
10
10
  return w10NOOP;
11
11
  };
12
12
 
13
13
  var autoKeyReg = /^\d[\d[\]]*$/;
14
14
  var FLAG_WILL_RERENDER_IN_BROWSER = 1;
15
15
  // var FLAG_HAS_RENDER_BODY = 2;
16
- // var FLAG_IS_LEGACY = 4;
17
- // var FLAG_OLD_HYDRATE_NO_CREATE = 8;
18
- var IS_SERVER = typeof window === "undefined";
16
+ var IS_SERVER = typeof document === "undefined";
19
17
 
20
18
  /**
21
19
  * Helper to render a dynamic tag
@@ -23,7 +23,7 @@ module.exports = function forIn(o, func) {
23
23
  "Passing a Map to a <for in> loop is deprecated and will be removed in a future version of Marko. Please switch to <for of> instead."
24
24
  );
25
25
  }
26
- o.forEach(function(v, k) {
26
+ o.forEach(function (v, k) {
27
27
  func(k, v);
28
28
  });
29
29
  } else {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  module.exports = function loadNestedTagHelper(targetProperty, isRepeated) {
4
- return function(input, parent) {
4
+ return function (input, parent) {
5
5
  // If we are nested tag then we do not have a renderer
6
6
  if (isRepeated) {
7
7
  var existingArray = parent[targetProperty];
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
 
3
- module.exports = require("../../loader");
3
+ module.exports = require("@internal/loader");
@@ -1,9 +1,11 @@
1
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
2
+
1
3
  /**
2
4
  * Merges object properties
3
5
  */
4
6
  module.exports = function merge(into, source) {
5
7
  for (var k in source) {
6
- if (source.hasOwnProperty(k) && !into.hasOwnProperty(k)) {
8
+ if (hasOwnProperty.call(source, k) && !hasOwnProperty.call(into, k)) {
7
9
  into[k] = source[k];
8
10
  }
9
11
  }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
 
3
- module.exports = function() {};
3
+ module.exports = function () {};
@@ -23,7 +23,7 @@ module.exports = function styleHelper(style) {
23
23
  } else if (type === "object") {
24
24
  for (var name in style) {
25
25
  var value = style[name];
26
- if (value != null) {
26
+ if (value != null && value !== false) {
27
27
  if (typeof value === "number" && value) {
28
28
  value += "px";
29
29
  }
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
 
3
- module.exports = function(value) {
3
+ module.exports = function (value) {
4
4
  return value == null ? "" : value + "";
5
5
  };
@@ -2,7 +2,6 @@
2
2
  var EventEmitter = require("events-light");
3
3
  var StringWriter = require("./StringWriter");
4
4
  var BufferedWriter = require("./BufferedWriter");
5
- var defaultDocument = typeof document != "undefined" && document;
6
5
  var RenderResult = require("../RenderResult");
7
6
  var attrsHelper = require("./helpers/attrs");
8
7
  var markoAttr = require("./helpers/data-marko");
@@ -19,10 +18,10 @@ var voidWriter = {
19
18
  script: noop,
20
19
  merge: noop,
21
20
  clear: noop,
22
- get: function() {
21
+ get: function () {
23
22
  return [];
24
23
  },
25
- toString: function() {
24
+ toString: function () {
26
25
  return "";
27
26
  }
28
27
  };
@@ -37,7 +36,7 @@ function State(root, stream, writer, events) {
37
36
  }
38
37
 
39
38
  function escapeEndingComment(text) {
40
- return text.replace(/-->/g, "--&gt;");
39
+ return text.replace(/(--!?)>/g, "$1&gt;");
41
40
  }
42
41
 
43
42
  function AsyncStream(global, writer, parentOut) {
@@ -95,6 +94,7 @@ function AsyncStream(global, writer, parentOut) {
95
94
  this.___assignedComponentDef = null;
96
95
  this.___assignedKey = null;
97
96
  this.___assignedCustomEvents = null;
97
+ this.___isLast = false;
98
98
  }
99
99
 
100
100
  AsyncStream.DEFAULT_TIMEOUT = 10000;
@@ -108,58 +108,58 @@ AsyncStream.INCLUDE_STACK =
108
108
  process.env.NODE_ENV === "development" ||
109
109
  process.env.NODE_ENV === "dev");
110
110
 
111
- AsyncStream.enableAsyncStackTrace = function() {
111
+ AsyncStream.enableAsyncStackTrace = function () {
112
112
  AsyncStream.INCLUDE_STACK = true;
113
113
  };
114
114
 
115
115
  var proto = (AsyncStream.prototype = {
116
116
  constructor: AsyncStream,
117
- ___document: defaultDocument,
117
+ ___host: typeof document === "object" && document,
118
118
  ___isOut: true,
119
119
 
120
- sync: function() {
120
+ sync: function () {
121
121
  this._sync = true;
122
122
  },
123
123
 
124
- isSync: function() {
124
+ isSync: function () {
125
125
  return this._sync === true;
126
126
  },
127
127
 
128
- write: function(str) {
128
+ write: function (str) {
129
129
  if (str != null) {
130
130
  this.writer.write(str.toString());
131
131
  }
132
132
  return this;
133
133
  },
134
134
 
135
- script: function(str) {
135
+ script: function (str) {
136
136
  if (str != null) {
137
137
  this.writer.script(str.toString());
138
138
  }
139
139
  return this;
140
140
  },
141
141
 
142
- ___getOutput: function() {
142
+ ___getOutput: function () {
143
143
  return this._state.writer.toString();
144
144
  },
145
145
 
146
146
  /**
147
147
  * Legacy...
148
148
  */
149
- getOutput: function() {
149
+ getOutput: function () {
150
150
  return this.___getOutput();
151
151
  },
152
152
 
153
- toString: function() {
153
+ toString: function () {
154
154
  return this._state.writer.toString();
155
155
  },
156
156
 
157
- ___getResult: function() {
157
+ ___getResult: function () {
158
158
  this._result = this._result || new RenderResult(this);
159
159
  return this._result;
160
160
  },
161
161
 
162
- beginAsync: function(options) {
162
+ beginAsync: function (options) {
163
163
  if (this._sync) {
164
164
  throw new Error("beginAsync() not allowed when using renderSync()");
165
165
  }
@@ -205,6 +205,7 @@ var proto = (AsyncStream.prototype = {
205
205
  }
206
206
 
207
207
  this._lastCount++;
208
+ newStream.___isLast = true;
208
209
  }
209
210
 
210
211
  name = options.name;
@@ -219,7 +220,7 @@ var proto = (AsyncStream.prototype = {
219
220
  newStream.name = name;
220
221
 
221
222
  if (timeout > 0) {
222
- newStream._timeoutId = setTimeout(function() {
223
+ newStream._timeoutId = setTimeout(function () {
223
224
  newStream.error(
224
225
  new Error(
225
226
  "Async fragment " +
@@ -242,7 +243,7 @@ var proto = (AsyncStream.prototype = {
242
243
  return newStream;
243
244
  },
244
245
 
245
- _doFinish: function() {
246
+ _doFinish: function () {
246
247
  var state = this._state;
247
248
 
248
249
  state.finished = true;
@@ -254,7 +255,7 @@ var proto = (AsyncStream.prototype = {
254
255
  }
255
256
  },
256
257
 
257
- end: function(data) {
258
+ end: function (data) {
258
259
  if (this._ended === true) {
259
260
  return;
260
261
  }
@@ -302,7 +303,7 @@ var proto = (AsyncStream.prototype = {
302
303
  }
303
304
 
304
305
  if (remaining === 0) {
305
- parentOut._handleChildDone();
306
+ parentOut._handleChildDone(this);
306
307
  } else if (remaining - this._lastCount === 0) {
307
308
  this._emitLast();
308
309
  }
@@ -311,7 +312,7 @@ var proto = (AsyncStream.prototype = {
311
312
  return this;
312
313
  },
313
314
 
314
- _handleChildDone: function() {
315
+ _handleChildDone: function (childOut) {
315
316
  var remaining = --this._remaining;
316
317
 
317
318
  if (remaining === 0) {
@@ -319,14 +320,20 @@ var proto = (AsyncStream.prototype = {
319
320
  if (parentOut === undefined) {
320
321
  this._doFinish();
321
322
  } else {
322
- parentOut._handleChildDone();
323
+ parentOut._handleChildDone(this);
324
+ }
325
+ } else {
326
+ if (childOut.___isLast) {
327
+ this._lastCount--;
328
+ }
329
+
330
+ if (remaining - this._lastCount === 0) {
331
+ this._emitLast();
323
332
  }
324
- } else if (remaining - this._lastCount === 0) {
325
- this._emitLast();
326
333
  }
327
334
  },
328
335
 
329
- _flushNext: function(currentWriter) {
336
+ _flushNext: function (currentWriter) {
330
337
  // It is possible that currentWriter is the
331
338
  // last writer in the chain, so let's make
332
339
  // sure there is a nextWriter to flush.
@@ -353,7 +360,7 @@ var proto = (AsyncStream.prototype = {
353
360
  }
354
361
  },
355
362
 
356
- on: function(event, callback) {
363
+ on: function (event, callback) {
357
364
  var state = this._state;
358
365
 
359
366
  if (event === "finish" && state.finished === true) {
@@ -367,7 +374,7 @@ var proto = (AsyncStream.prototype = {
367
374
  return this;
368
375
  },
369
376
 
370
- once: function(event, callback) {
377
+ once: function (event, callback) {
371
378
  var state = this._state;
372
379
 
373
380
  if (event === "finish" && state.finished === true) {
@@ -381,7 +388,7 @@ var proto = (AsyncStream.prototype = {
381
388
  return this;
382
389
  },
383
390
 
384
- onLast: function(callback) {
391
+ onLast: function (callback) {
385
392
  var lastArray = this._last;
386
393
 
387
394
  if (lastArray === undefined) {
@@ -393,27 +400,26 @@ var proto = (AsyncStream.prototype = {
393
400
  return this;
394
401
  },
395
402
 
396
- _emitLast: function() {
397
- var lastArray = this._last;
398
-
399
- var i = 0;
400
-
401
- function next() {
402
- if (i === lastArray.length) {
403
- return;
404
- }
405
- var lastCallback = lastArray[i++];
406
- lastCallback(next);
403
+ _emitLast: function () {
404
+ if (this._last) {
405
+ var i = 0;
406
+ var lastArray = this._last;
407
+ this._last = undefined;
408
+ (function next() {
409
+ if (i === lastArray.length) {
410
+ return;
411
+ }
412
+ var lastCallback = lastArray[i++];
413
+ lastCallback(next);
407
414
 
408
- if (lastCallback.length === 0) {
409
- next();
410
- }
415
+ if (lastCallback.length === 0) {
416
+ next();
417
+ }
418
+ })();
411
419
  }
412
-
413
- next();
414
420
  },
415
421
 
416
- emit: function(type, arg) {
422
+ emit: function (type, arg) {
417
423
  var events = this._state.events;
418
424
  switch (arguments.length) {
419
425
  case 1:
@@ -429,24 +435,24 @@ var proto = (AsyncStream.prototype = {
429
435
  return this;
430
436
  },
431
437
 
432
- removeListener: function() {
438
+ removeListener: function () {
433
439
  var events = this._state.events;
434
440
  events.removeListener.apply(events, arguments);
435
441
  return this;
436
442
  },
437
443
 
438
- prependListener: function() {
444
+ prependListener: function () {
439
445
  var events = this._state.events;
440
446
  events.prependListener.apply(events, arguments);
441
447
  return this;
442
448
  },
443
449
 
444
- pipe: function(stream) {
450
+ pipe: function (stream) {
445
451
  this._state.stream.pipe(stream);
446
452
  return this;
447
453
  },
448
454
 
449
- error: function(e) {
455
+ error: function (e) {
450
456
  var name = this.name;
451
457
  var stack = this._stack;
452
458
  if (stack) stack = getNonMarkoStack(stack);
@@ -474,7 +480,7 @@ var proto = (AsyncStream.prototype = {
474
480
  return this;
475
481
  },
476
482
 
477
- flush: function() {
483
+ flush: function () {
478
484
  var state = this._state;
479
485
 
480
486
  if (!state.finished) {
@@ -486,7 +492,7 @@ var proto = (AsyncStream.prototype = {
486
492
  return this;
487
493
  },
488
494
 
489
- createOut: function() {
495
+ createOut: function () {
490
496
  var newOut = new AsyncStream(this.global);
491
497
  // Forward error events to the parent out.
492
498
  newOut.on("error", this.emit.bind(this, "error"));
@@ -497,22 +503,31 @@ var proto = (AsyncStream.prototype = {
497
503
  return newOut;
498
504
  },
499
505
 
500
- ___elementDynamic: function(tagName, elementAttrs, key, componentDef, props) {
506
+ ___elementDynamic: function (
507
+ tagName,
508
+ elementAttrs,
509
+ key,
510
+ componentDef,
511
+ props
512
+ ) {
501
513
  var str =
502
514
  "<" +
503
515
  tagName +
504
516
  markoAttr(this, componentDef, props, key) +
505
- attrsHelper(elementAttrs) +
506
- ">";
517
+ attrsHelper(elementAttrs);
507
518
 
508
- if (selfClosingTags.indexOf(tagName) === -1) {
509
- str += "</" + tagName + ">";
519
+ if (selfClosingTags.voidElements.indexOf(tagName) !== -1) {
520
+ str += ">";
521
+ } else if (selfClosingTags.svgElements.indexOf(tagName) !== -1) {
522
+ str += "/>";
523
+ } else {
524
+ str += "></" + tagName + ">";
510
525
  }
511
526
 
512
527
  this.write(str);
513
528
  },
514
529
 
515
- element: function(tagName, elementAttrs, openTagOnly) {
530
+ element: function (tagName, elementAttrs, openTagOnly) {
516
531
  var str = "<" + tagName + attrsHelper(elementAttrs) + ">";
517
532
 
518
533
  if (openTagOnly !== true) {
@@ -522,7 +537,7 @@ var proto = (AsyncStream.prototype = {
522
537
  this.write(str);
523
538
  },
524
539
 
525
- ___beginElementDynamic: function(
540
+ ___beginElementDynamic: function (
526
541
  name,
527
542
  elementAttrs,
528
543
  key,
@@ -545,7 +560,7 @@ var proto = (AsyncStream.prototype = {
545
560
  }
546
561
  },
547
562
 
548
- beginElement: function(name, elementAttrs) {
563
+ beginElement: function (name, elementAttrs) {
549
564
  var str = "<" + name + attrsHelper(elementAttrs) + ">";
550
565
 
551
566
  this.write(str);
@@ -557,20 +572,20 @@ var proto = (AsyncStream.prototype = {
557
572
  }
558
573
  },
559
574
 
560
- endElement: function() {
575
+ endElement: function () {
561
576
  var tagName = this._elStack.pop();
562
577
  this.write("</" + tagName + ">");
563
578
  },
564
579
 
565
- comment: function(str) {
580
+ comment: function (str) {
566
581
  this.write("<!--" + escapeEndingComment(str) + "-->");
567
582
  },
568
583
 
569
- text: function(str) {
584
+ text: function (str) {
570
585
  this.write(escapeXmlOrNullish(str));
571
586
  },
572
587
 
573
- bf: function(key, component, preserve) {
588
+ bf: function (key, component, preserve) {
574
589
  if (preserve) {
575
590
  this.write("<!--F#" + escapeXmlString(key) + "-->");
576
591
  }
@@ -581,24 +596,23 @@ var proto = (AsyncStream.prototype = {
581
596
  }
582
597
  },
583
598
 
584
- ef: function() {
599
+ ef: function () {
585
600
  var preserve = this._elStack.pop();
586
601
  if (preserve) {
587
602
  this.write("<!--F/-->");
588
603
  }
589
604
  },
590
605
 
591
- ___getNode: function(doc) {
606
+ ___getNode: function (host) {
592
607
  var node = this._node;
593
- var nextEl;
594
- var fragment;
595
- var html = this.___getOutput();
596
-
597
- if (!doc) {
598
- doc = this.___document;
599
- }
600
608
 
601
609
  if (!node) {
610
+ var nextEl;
611
+ var fragment;
612
+ var html = this.___getOutput();
613
+ if (!host) host = this.___host;
614
+ var doc = host.ownerDocument || host;
615
+
602
616
  if (html) {
603
617
  node = parseHTML(html);
604
618
 
@@ -621,11 +635,11 @@ var proto = (AsyncStream.prototype = {
621
635
  return node;
622
636
  },
623
637
 
624
- then: function(fn, fnErr) {
638
+ then: function (fn, fnErr) {
625
639
  var out = this;
626
- var promise = new Promise(function(resolve, reject) {
640
+ var promise = new Promise(function (resolve, reject) {
627
641
  out.on("error", reject);
628
- out.on("finish", function(result) {
642
+ out.on("finish", function (result) {
629
643
  resolve(result);
630
644
  });
631
645
  });
@@ -633,11 +647,11 @@ var proto = (AsyncStream.prototype = {
633
647
  return Promise.resolve(promise).then(fn, fnErr);
634
648
  },
635
649
 
636
- catch: function(fnErr) {
650
+ catch: function (fnErr) {
637
651
  return this.then(undefined, fnErr);
638
652
  },
639
653
 
640
- c: function(componentDef, key, customEvents) {
654
+ c: function (componentDef, key, customEvents) {
641
655
  this.___assignedComponentDef = componentDef;
642
656
  this.___assignedKey = key;
643
657
  this.___assignedCustomEvents = customEvents;
@@ -1,5 +1,8 @@
1
1
  "use strict";
2
2
 
3
+ const immediate = require("@internal/set-immediate");
4
+ const setImmediate = immediate.___setImmediate;
5
+ const clearImmediate = immediate.___clearImmediate;
3
6
  const StringWriter = require("./StringWriter");
4
7
 
5
8
  /**
@@ -18,11 +21,11 @@ BufferedWriter.prototype = Object.assign(
18
21
  {
19
22
  scheduleFlush() {
20
23
  if (!this._scheduled) {
21
- this._scheduled = setImmediate(flush, this);
24
+ this._scheduled = setImmediate(flush.bind(0, this));
22
25
  }
23
26
  },
24
27
 
25
- end: function() {
28
+ end: function () {
26
29
  flush(this);
27
30
  if (!this._wrapped.isTTY) {
28
31
  this._wrapped.end();
@@ -41,6 +44,7 @@ function flush(writer) {
41
44
  writer._wrapped.flush();
42
45
  }
43
46
  }
47
+
44
48
  clearImmediate(writer._scheduled);
45
49
  writer._scheduled = null;
46
50
  }