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.
- package/bin/markoc.js +18 -18
- package/dist/compiler/CompileContext.js +3 -8
- package/dist/core-tags/components/init-components-tag.js +1 -52
- package/dist/core-tags/components/package.json +1 -3
- package/dist/core-tags/components/preferred-script-location-tag.js +2 -2
- package/dist/core-tags/components/preserve-tag.js +1 -27
- package/dist/core-tags/core/await/AsyncValue.js +20 -20
- package/dist/core-tags/core/await/renderer.js +11 -12
- package/dist/core-tags/core/await/reorderer-renderer.js +11 -6
- package/dist/index.js +1 -39
- package/dist/node-require/index.js +11 -0
- package/dist/node_modules/@internal/components-beginComponent/index-browser.js +12 -0
- package/dist/{runtime/components/beginComponent.js → node_modules/@internal/components-beginComponent/index.js} +14 -14
- package/dist/node_modules/@internal/components-beginComponent/package.json +11 -0
- package/dist/{runtime/components/legacy/defineWidget-legacy-browser.js → node_modules/@internal/components-define-widget-legacy/index-browser.js} +47 -47
- package/dist/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
- package/dist/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
- package/dist/node_modules/@internal/components-endComponent/index.js +11 -0
- package/dist/node_modules/@internal/components-endComponent/package.json +11 -0
- package/dist/node_modules/@internal/components-entry/index-browser.js +9 -0
- package/dist/node_modules/@internal/components-entry/index.js +285 -0
- package/dist/node_modules/@internal/components-entry/package.json +11 -0
- package/dist/{runtime/components/legacy → node_modules/@internal/components-entry-legacy}/index-browser.js +14 -15
- package/dist/node_modules/@internal/components-entry-legacy/index.js +14 -0
- package/dist/node_modules/@internal/components-entry-legacy/package.json +11 -0
- package/dist/{runtime/components/init-components-browser.js → node_modules/@internal/components-registry/index-browser.js} +180 -79
- package/dist/node_modules/@internal/components-registry/index.js +34 -0
- package/dist/node_modules/@internal/components-registry/package.json +11 -0
- package/dist/{runtime/components/util-browser.js → node_modules/@internal/components-util/index-browser.js} +23 -24
- package/dist/{runtime/components/util.js → node_modules/@internal/components-util/index.js} +10 -12
- package/dist/node_modules/@internal/components-util/package.json +11 -0
- package/dist/node_modules/@internal/create-readable/index-browser.js +25 -0
- package/dist/node_modules/@internal/create-readable/index.js +52 -0
- package/dist/node_modules/@internal/create-readable/package.json +11 -0
- package/dist/node_modules/@internal/init-components-tag/index.js +52 -0
- package/dist/node_modules/@internal/init-components-tag/package.json +11 -0
- package/dist/{loader/index-default.js → node_modules/@internal/loader/index.js} +1 -1
- package/dist/node_modules/@internal/loader/package.json +11 -0
- package/dist/{core-tags/components/preserve-tag-browser.js → node_modules/@internal/preserve-tag/index-browser.js} +8 -8
- package/dist/node_modules/@internal/preserve-tag/index.js +27 -0
- package/dist/node_modules/@internal/preserve-tag/package.json +11 -0
- package/dist/node_modules/@internal/set-immediate/index-browser.js +17 -0
- package/dist/node_modules/@internal/set-immediate/index-worker.js +2 -0
- package/dist/node_modules/@internal/set-immediate/index.js +2 -0
- package/dist/node_modules/@internal/set-immediate/package.json +11 -0
- package/dist/runtime/RenderResult.js +24 -19
- package/dist/runtime/components/Component.js +154 -151
- package/dist/runtime/components/ComponentDef.js +28 -28
- package/dist/runtime/components/ComponentsContext.js +19 -19
- package/dist/runtime/components/GlobalComponentsContext.js +4 -4
- package/dist/runtime/components/KeySequence.js +3 -3
- package/dist/runtime/components/ServerComponent.js +13 -13
- package/dist/runtime/components/State.js +28 -28
- package/dist/runtime/components/attach-detach.js +9 -9
- package/dist/runtime/components/defineComponent.js +5 -5
- package/dist/runtime/components/dom-data.js +6 -6
- package/dist/runtime/components/event-delegation.js +15 -16
- package/dist/runtime/components/index.js +1 -285
- package/dist/runtime/components/legacy/browser.json +1 -1
- package/dist/runtime/components/legacy/defineComponent-legacy.js +1 -1
- package/dist/runtime/components/legacy/defineRenderer-legacy.js +18 -19
- package/dist/runtime/components/legacy/defineWidget-legacy.js +1 -18
- package/dist/runtime/components/legacy/dependencies/html.js +1 -1
- package/dist/runtime/components/legacy/dependencies/index.js +9 -9
- package/dist/runtime/components/legacy/helper-getWidgetFromOut.js +3 -3
- package/dist/runtime/components/legacy/index.js +1 -14
- package/dist/runtime/components/legacy/renderer-legacy.js +43 -43
- package/dist/runtime/components/registry.js +1 -34
- package/dist/runtime/components/renderer.js +38 -38
- package/dist/runtime/components/update-manager.js +10 -10
- package/dist/runtime/createOut.js +1 -1
- package/dist/runtime/dom-insert.js +6 -6
- package/dist/runtime/helpers/_change-case.js +2 -2
- package/dist/runtime/helpers/assign.js +3 -2
- package/dist/runtime/helpers/dynamic-tag.js +14 -16
- package/dist/runtime/helpers/load-template.js +1 -1
- package/dist/runtime/helpers/merge.js +3 -1
- package/dist/runtime/helpers/style-value.js +2 -2
- package/dist/runtime/html/AsyncStream.js +61 -52
- package/dist/runtime/html/BufferedWriter.js +5 -1
- package/dist/runtime/html/StringWriter.js +7 -3
- package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
- package/dist/runtime/html/helpers/attr.js +4 -4
- package/dist/runtime/html/helpers/attrs.js +3 -3
- package/dist/runtime/html/helpers/data-marko.js +4 -6
- package/dist/runtime/html/helpers/escape-quotes.js +2 -2
- package/dist/runtime/html/helpers/escape-xml.js +1 -1
- package/dist/runtime/html/helpers/props-script.js +1 -1
- package/dist/runtime/html/index.js +15 -12
- package/dist/runtime/renderable.js +5 -5
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +102 -103
- package/dist/runtime/vdom/VComment.js +7 -7
- package/dist/runtime/vdom/VComponent.js +5 -5
- package/dist/runtime/vdom/VDocumentFragment.js +8 -8
- package/dist/runtime/vdom/VElement.js +55 -54
- package/dist/runtime/vdom/VFragment.js +9 -9
- package/dist/runtime/vdom/VNode.js +30 -30
- package/dist/runtime/vdom/VText.js +7 -7
- package/dist/runtime/vdom/helpers/v-element.js +1 -1
- package/dist/runtime/vdom/helpers/v-text.js +1 -1
- package/dist/runtime/vdom/index.js +12 -22
- package/dist/runtime/vdom/morphdom/fragment.js +5 -5
- package/dist/runtime/vdom/morphdom/helpers.js +3 -3
- package/dist/runtime/vdom/morphdom/index.js +72 -68
- package/dist/runtime/vdom/morphdom/specialElHandlers.js +8 -8
- package/dist/runtime/vdom/preserve-attrs.js +1 -1
- package/dist/runtime/vdom/vdom.js +19 -21
- package/docs/body-content.md +2 -2
- package/docs/class-components.md +3 -3
- package/docs/express.md +1 -1
- package/docs/lasso.md +3 -6
- package/docs/marko-v4.md +5 -5
- package/docs/redux.md +1 -1
- package/docs/server-side-rendering.md +2 -2
- package/docs/why-is-marko-fast.md +2 -10
- package/package.json +1 -1
- package/src/browser-refresh.js +2 -2
- package/src/compiler/CodeWriter.js +1 -3
- package/src/compiler/CompileContext.js +3 -8
- package/src/compiler/Compiler.js +4 -4
- package/src/compiler/HtmlJsParser.js +1 -1
- package/src/compiler/Migrator.js +1 -1
- package/src/compiler/Parser.js +3 -3
- package/src/compiler/ast/CustomTag.js +9 -11
- package/src/compiler/ast/HtmlAttribute/html/generateCode.js +2 -2
- package/src/compiler/ast/HtmlAttribute/index.js +1 -1
- package/src/compiler/ast/HtmlElement/vdom/HtmlElementVDOM.js +1 -1
- package/src/compiler/ast/HtmlElement/vdom/generateCode.js +1 -1
- package/src/compiler/ast/TemplateRoot.js +1 -1
- package/src/compiler/ast/Text/html/generateCode.js +3 -3
- package/src/compiler/ast/Text/vdom/generateCode.js +1 -1
- package/src/compiler/index.js +4 -4
- package/src/compiler/modules.js +4 -4
- package/src/compiler/util/finger-print.js +1 -1
- package/src/compiler/util/parseExpression.js +1 -1
- package/src/compiler/util/parseStatement.js +1 -1
- package/src/compiler/util/removeDashes.js +1 -1
- package/src/compiler/util/safeVarName.js +1 -1
- package/src/compiler/util/tokenizer.js +1 -1
- package/src/core-tags/cache/cached-fragment-tag-transformer.js +1 -1
- package/src/core-tags/cache/cached-fragment-tag.js +4 -4
- package/src/core-tags/cache/default-cache-manager.js +3 -3
- package/src/core-tags/components/TransformHelper/ComponentArgsCompiler.js +1 -1
- package/src/core-tags/components/TransformHelper/convertToComponent.js +1 -1
- package/src/core-tags/components/TransformHelper/handleComponentPreserveAttrs.js +1 -1
- package/src/core-tags/components/init-components-tag.js +1 -54
- package/src/core-tags/components/package.json +1 -3
- package/src/core-tags/components/preferred-script-location-tag.js +1 -1
- package/src/core-tags/components/preserve-tag.js +1 -27
- package/src/core-tags/components/util/getTransformHelper.js +1 -1
- package/src/core-tags/core/await/AsyncValue.js +3 -3
- package/src/core-tags/core/await/noop-render.js +1 -1
- package/src/core-tags/core/await/renderer.js +8 -7
- package/src/core-tags/core/await/reorderer-renderer.js +35 -14
- package/src/core-tags/core/await/transformer.js +1 -1
- package/src/core-tags/core/core-transformer.js +2 -2
- package/src/core-tags/migrate/all-tags/index.js +1 -1
- package/src/core-tags/migrate/all-templates/index.js +1 -1
- package/src/core-tags/migrate/include-tag.js +3 -2
- package/src/core-tags/migrate/util/parseFor.js +3 -2
- package/src/core-tags/migrate/util/printJS.js +1 -1
- package/src/defineRenderer.js +1 -1
- package/src/express.js +1 -1
- package/src/hot-reload.js +5 -5
- package/src/index.js +1 -41
- package/src/legacy-helpers/notEmpty.js +1 -1
- package/src/node-require/index.js +12 -1
- package/src/{runtime/components/beginComponent-browser.js → node_modules/@internal/components-beginComponent/index-browser.js} +1 -1
- package/src/{runtime/components/beginComponent.js → node_modules/@internal/components-beginComponent/index.js} +2 -2
- package/src/node_modules/@internal/components-beginComponent/package.json +11 -0
- package/src/{runtime/components/legacy/defineWidget-legacy-browser.js → node_modules/@internal/components-define-widget-legacy/index-browser.js} +21 -23
- package/src/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
- package/src/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
- package/src/{runtime/components/endComponent.js → node_modules/@internal/components-endComponent/index.js} +1 -1
- package/src/node_modules/@internal/components-endComponent/package.json +11 -0
- package/src/node_modules/@internal/components-entry/index-browser.js +9 -0
- package/src/node_modules/@internal/components-entry/index.js +301 -0
- package/src/node_modules/@internal/components-entry/package.json +11 -0
- package/src/node_modules/@internal/components-entry-legacy/index-browser.js +74 -0
- package/src/node_modules/@internal/components-entry-legacy/index.js +15 -0
- package/src/node_modules/@internal/components-entry-legacy/package.json +11 -0
- package/src/{runtime/components/init-components-browser.js → node_modules/@internal/components-registry/index-browser.js} +240 -75
- package/src/node_modules/@internal/components-registry/index.js +44 -0
- package/src/node_modules/@internal/components-registry/package.json +11 -0
- package/src/{runtime/components/util-browser.js → node_modules/@internal/components-util/index-browser.js} +11 -10
- package/src/{runtime/components/util.js → node_modules/@internal/components-util/index.js} +0 -2
- package/src/node_modules/@internal/components-util/package.json +11 -0
- package/src/node_modules/@internal/create-readable/index-browser.js +30 -0
- package/src/node_modules/@internal/create-readable/index.js +57 -0
- package/src/node_modules/@internal/create-readable/package.json +11 -0
- package/src/node_modules/@internal/init-components-tag/index.js +54 -0
- package/src/node_modules/@internal/init-components-tag/package.json +11 -0
- package/src/{loader/index-default.js → node_modules/@internal/loader/index.js} +2 -2
- package/src/node_modules/@internal/loader/package.json +11 -0
- package/src/node_modules/@internal/preserve-tag/index.js +27 -0
- package/src/node_modules/@internal/preserve-tag/package.json +11 -0
- package/src/node_modules/@internal/set-immediate/index-browser.js +17 -0
- package/src/node_modules/@internal/set-immediate/index-worker.js +2 -0
- package/src/node_modules/@internal/set-immediate/index.js +2 -0
- package/src/node_modules/@internal/set-immediate/package.json +11 -0
- package/src/runtime/RenderResult.js +20 -18
- package/src/runtime/components/Component.js +44 -41
- package/src/runtime/components/ComponentDef.js +9 -9
- package/src/runtime/components/ComponentsContext.js +4 -5
- package/src/runtime/components/GlobalComponentsContext.js +2 -1
- package/src/runtime/components/KeySequence.js +1 -1
- package/src/runtime/components/State.js +6 -6
- package/src/runtime/components/attach-detach.js +4 -4
- package/src/runtime/components/defineComponent.js +1 -1
- package/src/runtime/components/event-delegation.js +10 -10
- package/src/runtime/components/index.js +1 -301
- package/src/runtime/components/jquery.js +2 -2
- package/src/runtime/components/legacy/browser.json +1 -1
- package/src/runtime/components/legacy/defineRenderer-legacy.js +5 -6
- package/src/runtime/components/legacy/defineWidget-legacy.js +1 -18
- package/src/runtime/components/legacy/dependencies/html.js +1 -1
- package/src/runtime/components/legacy/dependencies/index.js +3 -3
- package/src/runtime/components/legacy/helper-getWidgetFromOut.js +3 -3
- package/src/runtime/components/legacy/index.js +1 -15
- package/src/runtime/components/legacy/renderer-legacy.js +7 -7
- package/src/runtime/components/ready.js +2 -2
- package/src/runtime/components/registry.js +1 -44
- package/src/runtime/components/renderer.js +4 -4
- package/src/runtime/components/update-manager.js +1 -1
- package/src/runtime/dom-insert.js +8 -8
- package/src/runtime/helpers/_weak-map.js +2 -2
- package/src/runtime/helpers/assign.js +3 -1
- package/src/runtime/helpers/bind-component.js +2 -2
- package/src/runtime/helpers/dynamic-tag.js +2 -4
- package/src/runtime/helpers/for-in.js +1 -1
- package/src/runtime/helpers/load-nested-tag.js +1 -1
- package/src/runtime/helpers/load-template.js +1 -1
- package/src/runtime/helpers/merge.js +3 -1
- package/src/runtime/helpers/noop.js +1 -1
- package/src/runtime/helpers/style-value.js +1 -1
- package/src/runtime/helpers/to-string.js +1 -1
- package/src/runtime/html/AsyncStream.js +90 -76
- package/src/runtime/html/BufferedWriter.js +6 -2
- package/src/runtime/html/StringWriter.js +15 -9
- package/src/runtime/html/helpers/attrs.js +3 -3
- package/src/runtime/html/helpers/data-marko.js +0 -2
- package/src/runtime/html/helpers/escape-quotes.js +1 -1
- package/src/runtime/html/helpers/escape-xml.js +1 -1
- package/src/runtime/html/index.js +23 -13
- package/src/runtime/queueMicrotask.js +2 -2
- package/src/runtime/renderable.js +9 -9
- package/src/runtime/vdom/AsyncVDOMBuilder.js +46 -51
- package/src/runtime/vdom/VComment.js +3 -3
- package/src/runtime/vdom/VDocumentFragment.js +3 -3
- package/src/runtime/vdom/VElement.js +17 -13
- package/src/runtime/vdom/VFragment.js +1 -1
- package/src/runtime/vdom/VNode.js +2 -2
- package/src/runtime/vdom/VText.js +3 -3
- package/src/runtime/vdom/helpers/attrs.js +1 -1
- package/src/runtime/vdom/helpers/const.js +2 -2
- package/src/runtime/vdom/helpers/v-element.js +1 -1
- package/src/runtime/vdom/helpers/v-text.js +1 -1
- package/src/runtime/vdom/index.js +21 -23
- package/src/runtime/vdom/morphdom/fragment.js +8 -7
- package/src/runtime/vdom/morphdom/index.js +19 -9
- package/src/runtime/vdom/morphdom/specialElHandlers.js +6 -6
- package/src/runtime/vdom/parse-html.js +4 -4
- package/src/runtime/vdom/preserve-attrs.js +1 -1
- package/src/runtime/vdom/vdom.js +5 -7
- package/src/taglib/taglib-finder/index.js +1 -1
- package/src/taglib/taglib-loader/Tag.js +5 -5
- package/src/taglib/taglib-loader/Taglib.js +2 -2
- package/src/taglib/taglib-loader/json-file-reader.js +1 -1
- package/src/taglib/taglib-loader/loadAttributeFromProps.js +1 -1
- package/src/taglib/taglib-loader/loadTagFromProps.js +5 -6
- package/src/taglib/taglib-loader/tag-def-from-code.js +2 -1
- package/src/taglib/taglib-lookup/TaglibLookup.js +2 -2
- package/src/taglib/taglib-lookup/index.js +1 -1
- package/dist/core-tags/core/await/client-reorder-browser.js +0 -1
- package/dist/core-tags/core/await/client-reorder-runtime.min.js +0 -5
- package/dist/core-tags/core/await/client-reorder.js +0 -11
- package/dist/core-tags/core/await/package.json +0 -6
- package/dist/index-browser.js +0 -4
- package/dist/loader/index.js +0 -7
- package/dist/loader/package.json +0 -5
- package/dist/node-require/index-browser.js +0 -1
- package/dist/package.json +0 -5
- package/dist/runtime/components/beginComponent-browser.js +0 -12
- package/dist/runtime/components/endComponent.js +0 -11
- package/dist/runtime/components/index-browser.js +0 -14
- package/dist/runtime/components/init-components.js +0 -1
- package/dist/runtime/components/legacy/package.json +0 -6
- package/dist/runtime/components/package.json +0 -12
- package/dist/runtime/components/registry-browser.js +0 -73
- package/dist/runtime/html/Template.js +0 -63
- package/dist/runtime/package.json +0 -5
- package/dist/runtime/setImmediate.js +0 -19
- package/src/core-tags/core/await/client-reorder-browser.js +0 -1
- package/src/core-tags/core/await/client-reorder-runtime.min.js +0 -1
- package/src/core-tags/core/await/client-reorder.js +0 -14
- package/src/core-tags/core/await/package.json +0 -6
- package/src/index-browser.js +0 -3
- package/src/loader/index.js +0 -7
- package/src/loader/package.json +0 -5
- package/src/node-require/index-browser.js +0 -1
- package/src/package.json +0 -5
- package/src/runtime/components/index-browser.js +0 -15
- package/src/runtime/components/init-components.js +0 -1
- package/src/runtime/components/legacy/index-browser.js +0 -73
- package/src/runtime/components/legacy/package.json +0 -6
- package/src/runtime/components/package.json +0 -12
- package/src/runtime/components/registry-browser.js +0 -103
- package/src/runtime/html/Template.js +0 -62
- package/src/runtime/package.json +0 -5
- package/src/runtime/setImmediate.js +0 -21
- /package/dist/{runtime/components/endComponent-browser.js → node_modules/@internal/components-endComponent/index-browser.js} +0 -0
- /package/dist/{core-tags/components/init-components-tag-browser.js → node_modules/@internal/init-components-tag/index-browser.js} +0 -0
- /package/dist/{loader → node_modules/@internal/loader}/index-browser.js +0 -0
- /package/src/{runtime/components/endComponent-browser.js → node_modules/@internal/components-endComponent/index-browser.js} +0 -0
- /package/src/{core-tags/components/init-components-tag-browser.js → node_modules/@internal/init-components-tag/index-browser.js} +0 -0
- /package/src/{loader → node_modules/@internal/loader}/index-browser.js +0 -0
- /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("
|
|
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("
|
|
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("
|
|
10
|
-
var endComponent = require("
|
|
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("
|
|
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("
|
|
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);
|
|
@@ -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 (
|
|
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
|
-
|
|
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,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 (
|
|
8
|
+
if (hasOwnProperty.call(source, k) && !hasOwnProperty.call(into, k)) {
|
|
7
9
|
into[k] = source[k];
|
|
8
10
|
}
|
|
9
11
|
}
|
|
@@ -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
|
}
|
|
@@ -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(
|
|
39
|
+
return text.replace(/(--!?)>/g, "$1>");
|
|
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
|
-
|
|
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
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
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
|
-
|
|
409
|
-
|
|
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(
|
|
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)
|
|
509
|
-
str += "
|
|
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(
|
|
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
|
}
|