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
@@ -3,14 +3,13 @@
3
3
  var EventEmitter = require("events-light");
4
4
  var StringWriter = require("./StringWriter");
5
5
  var BufferedWriter = require("./BufferedWriter");
6
- var defaultDocument = typeof document != "undefined" && document;
7
6
  var RenderResult = require("../RenderResult");
8
7
  var attrsHelper = require("./helpers/attrs");
9
8
  var markoAttr = require("./helpers/data-marko");
10
9
  var escapeXmlHelper = require("./helpers/escape-xml");
11
10
  var parseHTML = require("../vdom/parse-html");
12
11
  var escapeXmlOrNullish = escapeXmlHelper.x;
13
- var escapeXmlString = escapeXmlHelper.bg_;
12
+ var escapeXmlString = escapeXmlHelper.bo_;
14
13
  var selfClosingTags = require("self-closing-tags");
15
14
 
16
15
  function noop() {}
@@ -38,7 +37,7 @@ function State(root, stream, writer, events) {
38
37
  }
39
38
 
40
39
  function escapeEndingComment(text) {
41
- return text.replace(/-->/g, "-->");
40
+ return text.replace(/(--!?)>/g, "$1>");
42
41
  }
43
42
 
44
43
  function AsyncStream(global, writer, parentOut) {
@@ -90,11 +89,12 @@ function AsyncStream(global, writer, parentOut) {
90
89
 
91
90
  this._elStack = undefined; // Array
92
91
 
93
- this.h_ = null; // ComponentsContext
92
+ this.t_ = null; // ComponentsContext
94
93
 
95
- this.m_ = null;
96
- this.o_ = null;
97
- this.aQ_ = null;
94
+ this.aa_ = null;
95
+ this.ab_ = null;
96
+ this.bc_ = null;
97
+ this.bp_ = false;
98
98
  }
99
99
 
100
100
  AsyncStream.DEFAULT_TIMEOUT = 10000;
@@ -110,8 +110,8 @@ AsyncStream.enableAsyncStackTrace = function () {
110
110
 
111
111
  var proto = AsyncStream.prototype = {
112
112
  constructor: AsyncStream,
113
- _c_: defaultDocument,
114
- bh_: true,
113
+ E_: typeof document === "object" && document,
114
+ bq_: true,
115
115
 
116
116
  sync: function () {
117
117
  this._sync = true;
@@ -135,7 +135,7 @@ var proto = AsyncStream.prototype = {
135
135
  return this;
136
136
  },
137
137
 
138
- H_: function () {
138
+ aj_: function () {
139
139
  return this._state.writer.toString();
140
140
  },
141
141
 
@@ -143,14 +143,14 @@ var proto = AsyncStream.prototype = {
143
143
  * Legacy...
144
144
  */
145
145
  getOutput: function () {
146
- return this.H_();
146
+ return this.aj_();
147
147
  },
148
148
 
149
149
  toString: function () {
150
150
  return this._state.writer.toString();
151
151
  },
152
152
 
153
- bi_: function () {
153
+ br_: function () {
154
154
  this._result = this._result || new RenderResult(this);
155
155
  return this._result;
156
156
  },
@@ -201,6 +201,7 @@ var proto = AsyncStream.prototype = {
201
201
  }
202
202
 
203
203
  this._lastCount++;
204
+ newStream.bp_ = true;
204
205
  }
205
206
 
206
207
  name = options.name;
@@ -238,7 +239,7 @@ var proto = AsyncStream.prototype = {
238
239
  if (state.writer.end) {
239
240
  state.writer.end();
240
241
  } else {
241
- state.events.emit("finish", this.bi_());
242
+ state.events.emit("finish", this.br_());
242
243
  }
243
244
  },
244
245
 
@@ -290,7 +291,7 @@ var proto = AsyncStream.prototype = {
290
291
  }
291
292
 
292
293
  if (remaining === 0) {
293
- parentOut._handleChildDone();
294
+ parentOut._handleChildDone(this);
294
295
  } else if (remaining - this._lastCount === 0) {
295
296
  this._emitLast();
296
297
  }
@@ -299,7 +300,7 @@ var proto = AsyncStream.prototype = {
299
300
  return this;
300
301
  },
301
302
 
302
- _handleChildDone: function () {
303
+ _handleChildDone: function (childOut) {
303
304
  var remaining = --this._remaining;
304
305
 
305
306
  if (remaining === 0) {
@@ -307,10 +308,16 @@ var proto = AsyncStream.prototype = {
307
308
  if (parentOut === undefined) {
308
309
  this._doFinish();
309
310
  } else {
310
- parentOut._handleChildDone();
311
+ parentOut._handleChildDone(this);
312
+ }
313
+ } else {
314
+ if (childOut.bp_) {
315
+ this._lastCount--;
316
+ }
317
+
318
+ if (remaining - this._lastCount === 0) {
319
+ this._emitLast();
311
320
  }
312
- } else if (remaining - this._lastCount === 0) {
313
- this._emitLast();
314
321
  }
315
322
  },
316
323
 
@@ -345,7 +352,7 @@ var proto = AsyncStream.prototype = {
345
352
  var state = this._state;
346
353
 
347
354
  if (event === "finish" && state.finished === true) {
348
- callback(this.bi_());
355
+ callback(this.br_());
349
356
  } else if (event === "last") {
350
357
  this.onLast(callback);
351
358
  } else {
@@ -359,7 +366,7 @@ var proto = AsyncStream.prototype = {
359
366
  var state = this._state;
360
367
 
361
368
  if (event === "finish" && state.finished === true) {
362
- callback(this.bi_());
369
+ callback(this.br_());
363
370
  } else if (event === "last") {
364
371
  this.onLast(callback);
365
372
  } else {
@@ -382,23 +389,22 @@ var proto = AsyncStream.prototype = {
382
389
  },
383
390
 
384
391
  _emitLast: function () {
385
- var lastArray = this._last;
386
-
387
- var i = 0;
388
-
389
- function next() {
390
- if (i === lastArray.length) {
391
- return;
392
- }
393
- var lastCallback = lastArray[i++];
394
- lastCallback(next);
392
+ if (this._last) {
393
+ var i = 0;
394
+ var lastArray = this._last;
395
+ this._last = undefined;
396
+ (function next() {
397
+ if (i === lastArray.length) {
398
+ return;
399
+ }
400
+ var lastCallback = lastArray[i++];
401
+ lastCallback(next);
395
402
 
396
- if (lastCallback.length === 0) {
397
- next();
398
- }
403
+ if (lastCallback.length === 0) {
404
+ next();
405
+ }
406
+ })();
399
407
  }
400
-
401
- next();
402
408
  },
403
409
 
404
410
  emit: function (type, arg) {
@@ -482,11 +488,15 @@ var proto = AsyncStream.prototype = {
482
488
  return newOut;
483
489
  },
484
490
 
485
- bf_: function (tagName, elementAttrs, key, componentDef, props) {
486
- var str = "<" + tagName + markoAttr(this, componentDef, props, key) + attrsHelper(elementAttrs) + ">";
491
+ bn_: function (tagName, elementAttrs, key, componentDef, props) {
492
+ var str = "<" + tagName + markoAttr(this, componentDef, props, key) + attrsHelper(elementAttrs);
487
493
 
488
- if (selfClosingTags.indexOf(tagName) === -1) {
489
- str += "</" + tagName + ">";
494
+ if (selfClosingTags.voidElements.indexOf(tagName) !== -1) {
495
+ str += ">";
496
+ } else if (selfClosingTags.svgElements.indexOf(tagName) !== -1) {
497
+ str += "/>";
498
+ } else {
499
+ str += "></" + tagName + ">";
490
500
  }
491
501
 
492
502
  this.write(str);
@@ -502,7 +512,7 @@ var proto = AsyncStream.prototype = {
502
512
  this.write(str);
503
513
  },
504
514
 
505
- bd_: function (name, elementAttrs, key, componentDef, props) {
515
+ bl_: function (name, elementAttrs, key, componentDef, props) {
506
516
  var str = "<" + name + markoAttr(this, componentDef, props, key) + attrsHelper(elementAttrs) + ">";
507
517
 
508
518
  this.write(str);
@@ -557,17 +567,16 @@ var proto = AsyncStream.prototype = {
557
567
  }
558
568
  },
559
569
 
560
- G_: function (doc) {
570
+ ai_: function (host) {
561
571
  var node = this._node;
562
- var nextEl;
563
- var fragment;
564
- var html = this.H_();
565
-
566
- if (!doc) {
567
- doc = this._c_;
568
- }
569
572
 
570
573
  if (!node) {
574
+ var nextEl;
575
+ var fragment;
576
+ var html = this.aj_();
577
+ if (!host) host = this.E_;
578
+ var doc = host.ownerDocument || host;
579
+
571
580
  if (html) {
572
581
  node = parseHTML(html);
573
582
 
@@ -607,15 +616,15 @@ var proto = AsyncStream.prototype = {
607
616
  },
608
617
 
609
618
  c: function (componentDef, key, customEvents) {
610
- this.m_ = componentDef;
611
- this.o_ = key;
612
- this.aQ_ = customEvents;
619
+ this.aa_ = componentDef;
620
+ this.ab_ = key;
621
+ this.bc_ = customEvents;
613
622
  }
614
623
  };
615
624
 
616
625
  // alias:
617
626
  proto.w = proto.write;
618
- proto.be_ = proto.endElement;
627
+ proto.bm_ = proto.endElement;
619
628
 
620
629
  module.exports = AsyncStream;
621
630
 
@@ -1,5 +1,8 @@
1
1
  "use strict";
2
2
 
3
+ const immediate = require("@internal/set-immediate");
4
+ const setImmediate = immediate.af_;
5
+ const clearImmediate = immediate.ag_;
3
6
  const StringWriter = require("./StringWriter");
4
7
 
5
8
  /**
@@ -17,7 +20,7 @@ function BufferedWriter(wrappedStream) {
17
20
  BufferedWriter.prototype = Object.assign({
18
21
  scheduleFlush() {
19
22
  if (!this._scheduled) {
20
- this._scheduled = setImmediate(flush, this);
23
+ this._scheduled = setImmediate(flush.bind(0, this));
21
24
  }
22
25
  },
23
26
 
@@ -38,6 +41,7 @@ function flush(writer) {
38
41
  writer._wrapped.flush();
39
42
  }
40
43
  }
44
+
41
45
  clearImmediate(writer._scheduled);
42
46
  writer._scheduled = null;
43
47
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var escapeDoubleQuotes = require("./helpers/escape-quotes").bj_;
3
+ var escapeDoubleQuotes = require("./helpers/escape-quotes").o_;
4
4
 
5
5
  function StringWriter() {
6
6
  this._content = "";
@@ -26,7 +26,11 @@ StringWriter.prototype = {
26
26
 
27
27
  merge: function (otherWriter) {
28
28
  this._content += otherWriter._content;
29
- this._scripts += otherWriter._scripts;
29
+
30
+ if (otherWriter._scripts) {
31
+ this._scripts = this._scripts ? this._scripts + ";" + otherWriter._scripts : otherWriter._scripts;
32
+ }
33
+
30
34
  if (otherWriter._data) {
31
35
  if (this._data) {
32
36
  for (const key in otherWriter._data) {
@@ -49,7 +53,7 @@ StringWriter.prototype = {
49
53
  },
50
54
 
51
55
  toString: function () {
52
- this.state.events.emit("i_", this);
56
+ this.state.events.emit("p_", this);
53
57
  let str = this._content;
54
58
  if (this._scripts) {
55
59
  const outGlobal = this.state.root.global;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  var attrHelper = require("./attr");
4
- var notEmptyAttr = attrHelper.bl_;
5
- var isEmptyAttrValue = attrHelper.bm_;
4
+ var notEmptyAttr = attrHelper.bs_;
5
+ var isEmptyAttrValue = attrHelper.bt_;
6
6
  var classHelper = require("./class-attr");
7
7
  var styleHelper = require("./style-attr");
8
8
 
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var escapeQuoteHelpers = require("./escape-quotes");
4
- var escapeDoubleQuotes = escapeQuoteHelpers.bj_;
5
- var escapeSingleQuotes = escapeQuoteHelpers.bn_;
4
+ var escapeDoubleQuotes = escapeQuoteHelpers.o_;
5
+ var escapeSingleQuotes = escapeQuoteHelpers.bu_;
6
6
  var complain;
7
7
 
8
8
  module.exports = maybeEmptyAttr;
9
9
 
10
- maybeEmptyAttr.bl_ = notEmptyAttr;
11
- maybeEmptyAttr.bm_ = isEmpty;
10
+ maybeEmptyAttr.bs_ = notEmptyAttr;
11
+ maybeEmptyAttr.bt_ = isEmpty;
12
12
 
13
13
  function maybeEmptyAttr(name, value) {
14
14
  if (isEmpty(value)) {
@@ -6,11 +6,11 @@ var dynamicAttrHelper = require("./_dynamic-attr");
6
6
  module.exports = function attrs(arg) {
7
7
  switch (typeof arg) {
8
8
  case "object":
9
- var out = "";
9
+ var result = "";
10
10
  for (var attrName in arg) {
11
- out += dynamicAttrHelper(attrName, arg[attrName]);
11
+ result += dynamicAttrHelper(attrName, arg[attrName]);
12
12
  }
13
- return out;
13
+ return result;
14
14
  case "string":
15
15
  return arg;
16
16
  // eslint-disable-next-line no-constant-condition
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var escapeQuoteHelpers = require("./escape-quotes");
4
- var escapeSingleQuotes = escapeQuoteHelpers.bn_;
5
- var escapeDoubleQuotes = escapeQuoteHelpers.bj_;
4
+ var escapeSingleQuotes = escapeQuoteHelpers.bu_;
5
+ var escapeDoubleQuotes = escapeQuoteHelpers.o_;
6
6
  var FLAG_WILL_RERENDER_IN_BROWSER = 1;
7
7
  // var FLAG_HAS_RENDER_BODY = 2;
8
- // var FLAG_IS_LEGACY = 4;
9
- // var FLAG_OLD_HYDRATE_NO_CREATE = 8;
10
8
 
11
9
  module.exports = function dataMarko(out, componentDef, props, key) {
12
10
  var result = "";
13
- var willNotRerender = out.h_.v_ || componentDef._M_ && (componentDef._N_ & FLAG_WILL_RERENDER_IN_BROWSER) === 0;
11
+ var willNotRerender = out.t_.y_ || componentDef.w_ && (componentDef.x_ & FLAG_WILL_RERENDER_IN_BROWSER) === 0;
14
12
 
15
13
  if (willNotRerender) {
16
14
  if (props) {
@@ -22,7 +20,7 @@ module.exports = function dataMarko(out, componentDef, props, key) {
22
20
  }
23
21
 
24
22
  if (key && key[0] === "@") {
25
- result += ' data-marko-key="' + escapeDoubleQuotes(componentDef._Q_(key) + " " + componentDef.id) + '"';
23
+ result += ' data-marko-key="' + escapeDoubleQuotes(componentDef.aN_(key) + " " + componentDef.id) + '"';
26
24
  }
27
25
  }
28
26
 
@@ -4,9 +4,9 @@ exports.d = function (value) {
4
4
  return escapeDoubleQuotes(value + "", 0);
5
5
  };
6
6
 
7
- exports.bj_ = escapeDoubleQuotes;
7
+ exports.o_ = escapeDoubleQuotes;
8
8
 
9
- exports.bn_ = escapeSingleQuotes;
9
+ exports.bu_ = escapeSingleQuotes;
10
10
 
11
11
  function escapeSingleQuotes(value, startPos) {
12
12
  return escapeQuote(value, startPos, "'", "&#39;");
@@ -12,7 +12,7 @@ module.exports.x = function (value) {
12
12
  return escapeXML(value + "");
13
13
  };
14
14
 
15
- exports.bg_ = escapeXML;
15
+ exports.bo_ = escapeXML;
16
16
 
17
17
  function escapeXML(str) {
18
18
  var len = str.length;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var escapeDoubleQuotes = require("./escape-quotes").bj_;
3
+ var escapeDoubleQuotes = require("./escape-quotes").o_;
4
4
  var escapeScript = require("./escape-script-placeholder");
5
5
  var assignPropsFunction = `
6
6
  function ap_(p) {
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
 
3
- var Template;
3
+ globalThis.Marko = {
4
+ Component: function () {}
5
+ };
4
6
 
5
7
  /**
6
8
  * Method is for internal usage only. This method
@@ -8,26 +10,27 @@ var Template;
8
10
  * it is used to create a new Template instance.
9
11
  * @private
10
12
  */
11
- exports.t = function createTemplate(path) {
12
- return new Template(path);
13
+ exports.t = function createTemplate(typeName) {
14
+ return new Template(typeName);
13
15
  };
14
16
 
15
- require("../../");
17
+ function Template(typeName) {
18
+ this.path = this.bv_ = typeName;
19
+ }
16
20
 
17
- var AsyncStream = require("./AsyncStream");
18
- Template = require("./Template");
21
+ Template.prototype.stream = require("@internal/create-readable");
19
22
 
20
- function createOut(globalData, parent, state, buffer) {
21
- return new AsyncStream(globalData, parent, state, buffer);
22
- }
23
+ var AsyncStream = require("./AsyncStream");
23
24
 
24
25
  exports.createWriter = function (writer) {
25
26
  return new AsyncStream(null, writer);
26
27
  };
27
-
28
28
  exports.Template = Template;
29
- exports.bo_ = createOut;
30
29
  exports.AsyncStream = AsyncStream;
31
30
  exports.enableAsyncStackTrace = AsyncStream.enableAsyncStackTrace;
32
31
 
33
- require("../createOut").aY_(createOut);
32
+ require("../createOut").bf_(Template.prototype.createOut = function createOut(globalData, writer, parentOut, buffer) {
33
+ return new AsyncStream(globalData, writer, parentOut, buffer);
34
+ });
35
+
36
+ require("../renderable")(Template.prototype);
@@ -1,5 +1,5 @@
1
1
  var defaultCreateOut = require("./createOut");
2
- var setImmediate = require("./setImmediate");
2
+ var setImmediate = require("@internal/set-immediate").af_;
3
3
  var extend = require("raptor-util/extend");
4
4
 
5
5
  function safeRender(renderFunc, finalData, finalOut, shouldEnd) {
@@ -67,7 +67,7 @@ module.exports = function (target, renderer) {
67
67
  }
68
68
 
69
69
  render(localData, out);
70
- return out.bi_();
70
+ return out.br_();
71
71
  },
72
72
 
73
73
  /**
@@ -93,7 +93,7 @@ module.exports = function (target, renderer) {
93
93
  var finalData;
94
94
  var globalData;
95
95
  var render = renderFunc || this._;
96
- var shouldBuffer = this.bk_;
96
+ var shouldBuffer = this._W_;
97
97
  var shouldEnd = true;
98
98
 
99
99
  if (data) {
@@ -105,7 +105,7 @@ module.exports = function (target, renderer) {
105
105
  finalData = {};
106
106
  }
107
107
 
108
- if (out && out.bh_) {
108
+ if (out && out.bq_) {
109
109
  finalOut = out;
110
110
  shouldEnd = false;
111
111
  extend(out.global, globalData);
@@ -122,7 +122,7 @@ module.exports = function (target, renderer) {
122
122
 
123
123
  if (callback) {
124
124
  finalOut.on("finish", function () {
125
- callback(null, finalOut.bi_(), finalOut);
125
+ callback(null, finalOut.br_(), finalOut);
126
126
  }).once("error", callback);
127
127
  }
128
128