marko 5.32.15 → 5.33.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 (34) hide show
  1. package/bin/markoc +1 -1
  2. package/dist/node_modules/@internal/components-entry/index.js +5 -7
  3. package/dist/runtime/helpers/dynamic-tag.js +5 -1
  4. package/dist/runtime/helpers/tags-compat-dom.js +265 -0
  5. package/dist/runtime/helpers/tags-compat-html.js +167 -0
  6. package/dist/runtime/html/AsyncStream.js +96 -13
  7. package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
  8. package/dist/runtime/html/helpers/attr.js +3 -3
  9. package/dist/runtime/html/helpers/data-marko.js +1 -1
  10. package/dist/runtime/html/helpers/escape-quotes.js +1 -1
  11. package/dist/runtime/html/helpers/escape-xml.js +1 -1
  12. package/dist/runtime/renderable.js +52 -3
  13. package/dist/runtime/vdom/AsyncVDOMBuilder.js +67 -67
  14. package/dist/runtime/vdom/VComponent.js +3 -3
  15. package/dist/runtime/vdom/VDocumentFragment.js +7 -7
  16. package/dist/runtime/vdom/VElement.js +35 -35
  17. package/dist/runtime/vdom/VFragment.js +5 -5
  18. package/dist/runtime/vdom/VNode.js +31 -31
  19. package/dist/runtime/vdom/VText.js +8 -8
  20. package/dist/runtime/vdom/helpers/const-element.js +3 -3
  21. package/dist/runtime/vdom/hot-reload.js +2 -2
  22. package/dist/runtime/vdom/morphdom/fragment.js +3 -3
  23. package/dist/runtime/vdom/morphdom/helpers.js +1 -1
  24. package/dist/runtime/vdom/morphdom/index.js +31 -31
  25. package/dist/runtime/vdom/vdom.js +14 -14
  26. package/docs/compiler.md +1 -1
  27. package/index.d.ts +4 -6
  28. package/package.json +83 -83
  29. package/src/node_modules/@internal/components-entry/index.js +5 -7
  30. package/src/runtime/helpers/dynamic-tag.js +5 -1
  31. package/src/runtime/helpers/tags-compat-dom.js +265 -0
  32. package/src/runtime/helpers/tags-compat-html.js +167 -0
  33. package/src/runtime/html/AsyncStream.js +87 -4
  34. package/src/runtime/renderable.js +49 -0
package/bin/markoc CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- require('./markoc.js');
2
+ require("./markoc.js");
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var warp10 = require("warp10");
4
+ var w10NOOP = require("warp10/constants").NOOP;
4
5
  var safeJSONRegExp = /<\/|\u2028|\u2029/g;
5
6
  var IGNORE_GLOBAL_TYPES = new Set(["undefined", "function", "symbol"]);
6
7
  var DEFAULT_RUNTIME_ID = "M";
@@ -90,11 +91,6 @@ function addComponentsFromContext(componentsContext, componentsToHydrate) {
90
91
 
91
92
  needsState = true;
92
93
  } else {
93
- if (input && input.renderBody) {
94
- renderBody = input.renderBody;
95
- input.renderBody = undefined;
96
- }
97
-
98
94
  if (
99
95
  !(flags & FLAG_WILL_RERENDER_IN_BROWSER) ||
100
96
  flags & FLAG_OLD_HYDRATE_NO_CREATE)
@@ -115,6 +111,8 @@ function addComponentsFromContext(componentsContext, componentsToHydrate) {
115
111
  if (isNotEmpty(component)) {
116
112
  serializedProps = component;
117
113
  }
114
+ } else {
115
+ renderBody = input.renderBody;
118
116
  }
119
117
  }
120
118
 
@@ -138,9 +136,9 @@ function addComponentsFromContext(componentsContext, componentsToHydrate) {
138
136
  }
139
137
  }
140
138
 
141
- if (typeof renderBody === "function") {
139
+ if (typeof renderBody === "function" && renderBody.toJSON && renderBody.toJSON() === w10NOOP) {
142
140
  flags |= FLAG_HAS_RENDER_BODY;
143
- renderBody = undefined;
141
+ renderBody = input.renderBody = undefined;
144
142
  }
145
143
 
146
144
  var extra = {
@@ -68,6 +68,7 @@ customEvents)
68
68
  var renderer =
69
69
  tag._ || (
70
70
  tag.renderer ? tag.renderer.renderer || tag.renderer : tag.render);
71
+ var render = tag && tag.renderBody || tag;
71
72
 
72
73
  // eslint-disable-next-line no-constant-condition
73
74
 
@@ -78,12 +79,15 @@ customEvents)
78
79
 
79
80
 
80
81
 
82
+ if (dynamicTag.bk_) {
83
+ renderer = dynamicTag.bk_(renderer, render, args);
84
+ }
85
+
81
86
  if (renderer) {
82
87
  out.c(componentDef, key, customEvents);
83
88
  renderer(attrs, out);
84
89
  out._X_ = null;
85
90
  } else {
86
- var render = tag && tag.renderBody || tag;
87
91
  var isFn = typeof render === "function";
88
92
 
89
93
  // eslint-disable-next-line no-constant-condition
@@ -0,0 +1,265 @@
1
+ "use strict";exports.__esModule = true;exports.default = void 0;var _ComponentsContext = require("../components/ComponentsContext");
2
+ var _fragment = require("../vdom/morphdom/fragment");
3
+
4
+ const {
5
+ prepare,
6
+ runEffects,
7
+ patchConditionals,
8
+ createScopeWithRenderer,
9
+ queueEffect,
10
+ scopeLookup,
11
+ getRegisteredWithScope,
12
+ register
13
+ } = require(
14
+ // eslint-disable-next-line no-constant-condition
15
+ "@marko/runtime-tags/dom"
16
+ );
17
+ const { _i_ } = require("@internal/components-util");
18
+ const defineComponent = require("../components/defineComponent");
19
+ const { r: registerComponent } = require("../components/registry");
20
+ const createRenderer = require("../components/renderer");
21
+ const defaultCreateOut = require("../createOut");
22
+ const morphdom = require("../vdom/morphdom");
23
+ const dynamicTag = require("./dynamic-tag");var _default = exports.default =
24
+
25
+ dynamicTag.bk_ = function tagsToVdom(
26
+ tagsRenderer,
27
+ renderBody,
28
+ args)
29
+ {
30
+ if (
31
+ tagsRenderer ?
32
+ tagsRenderer.bl_ === undefined :
33
+ !Array.isArray(renderBody) && renderBody?.bl_ === undefined)
34
+
35
+ return tagsRenderer;
36
+
37
+ return (input, out) =>
38
+ TagsCompat({ i: args ? args : input, r: tagsRenderer || renderBody }, out);
39
+ };
40
+
41
+ const TagsCompatId = "tags-compat";
42
+ const TagsCompat = createRenderer(
43
+ function (_, out, componentDef, component) {
44
+ let existing = false;
45
+ const isHydrate =
46
+ (0, _ComponentsContext.R_)(out).o_._W_;
47
+ const input = Array.isArray(_.i) ? _.i : [_.i];
48
+ const tagsRenderer = resolveRegistered(_.r);
49
+ const args = tagsRenderer.bm_;
50
+
51
+ component.effects = prepare(() => {
52
+ if (isHydrate) {
53
+ const scopeId = out.global.componentIdToScopeId[component.id];
54
+ component.scope = scopeLookup[scopeId];
55
+ }
56
+ if (!component.scope) {
57
+ component.scope = createScopeWithRenderer(
58
+ tagsRenderer /* out.global as context */
59
+ );
60
+ for (const signal of tagsRenderer.bn_) {
61
+ signal(component.scope, true);
62
+ }
63
+ } else {
64
+ args && args(component.scope, input, 1);
65
+ existing = true;
66
+ }
67
+ args && args(component.scope, input);
68
+ });
69
+ out.bf(out._Y_, component, existing);
70
+ if (!existing) {
71
+ out.node({
72
+ bo_: () =>
73
+ component.scope.bp_ === component.scope.bq_ ?
74
+ component.scope.bp_ :
75
+ component.scope.bp_.parentNode
76
+ });
77
+ }
78
+ out.ef();
79
+ },
80
+ {
81
+ t: TagsCompatId,
82
+ d: "MARKO_DEBUG"
83
+ },
84
+ {}
85
+ );
86
+
87
+ registerComponent(TagsCompatId, () => ({
88
+ _: TagsCompat,
89
+ Component: defineComponent(
90
+ {
91
+ onMount() {
92
+ runEffects(this.effects);
93
+ },
94
+ onUpdate() {
95
+ runEffects(this.effects);
96
+ }
97
+ },
98
+ TagsCompat
99
+ )
100
+ }));
101
+
102
+ // (
103
+ // nodeAccessor: Accessor,
104
+ // dynamicTagAttrs?: IntersectionSignal,
105
+ // intersection?: IntersectionSignal,
106
+ // valueWithIntersection?: ValueSignal
107
+ // )
108
+
109
+ const rendererCache = new WeakMap();
110
+
111
+ patchConditionals((conditional) => (...args) => {
112
+ const signal = conditional(...args);
113
+ const hasAttrs = args.length > 1;
114
+ return (scope, renderer, clean) => {
115
+ return signal(scope, create5to6Renderer(renderer, hasAttrs), clean);
116
+ };
117
+ });
118
+
119
+ function create5to6Renderer(renderer, hasAttrs) {
120
+ let newRenderer = renderer;
121
+ if (renderer) {
122
+ const rendererFromAnywhere =
123
+ renderer._ ||
124
+ renderer.render ||
125
+ renderer.renderer && renderer.renderer.renderer ||
126
+ renderer.renderer;
127
+ const isMarko6 = rendererFromAnywhere ?
128
+ rendererFromAnywhere.bl_ :
129
+ renderer.bl_;
130
+
131
+ if (typeof renderer !== "string" && !isMarko6) {
132
+ newRenderer = rendererCache.get(renderer);
133
+ if (!newRenderer) {
134
+ const { Component } = renderer;
135
+ if (Component) {
136
+ const setCustomEvents = Component.prototype.aB_;
137
+ Component.prototype.aB_ = function (
138
+ customEvents,
139
+ scopeId)
140
+ {
141
+ for (const customEvent of customEvents) {
142
+ customEvent[1] = resolveRegistered(customEvent[1]);
143
+ }
144
+
145
+ setCustomEvents.call(this, customEvents, scopeId);
146
+ };
147
+ }
148
+ newRenderer = {
149
+ br_(scope) {
150
+ if (!hasAttrs) {
151
+ renderAndMorph(scope, rendererFromAnywhere, renderer, {});
152
+ }
153
+ },
154
+ bl_() {
155
+ const realFragment = document.createDocumentFragment();
156
+ (0, _fragment._h_)(null, null, realFragment);
157
+ return realFragment;
158
+ },
159
+ bs_: 1,
160
+ bm_(scope, input, clean) {
161
+ if (clean) return;
162
+ renderAndMorph(scope, rendererFromAnywhere, renderer, input);
163
+ }
164
+ };
165
+ rendererCache.set(renderer, newRenderer);
166
+ }
167
+ }
168
+ }
169
+ return newRenderer;
170
+ }
171
+
172
+ register("@marko/tags-compat-5-to-6", create5to6Renderer);
173
+
174
+ function renderAndMorph(scope, renderer, renderBody, input) {
175
+ const out = defaultCreateOut();
176
+ let rootNode = scope.bp_.fragment;
177
+ if (!rootNode) {
178
+ const component = scope.marko5Component = _i_[scope.m5c];
179
+ rootNode = component._A_;
180
+ scope.bp_ = rootNode.startNode;
181
+ scope.bq_ = rootNode.endNode;
182
+ }
183
+ const host = scope.bp_;
184
+ const existingComponent = scope.marko5Component;
185
+ const componentsContext = (0, _ComponentsContext.R_)(out);
186
+ const globalComponentsContext = componentsContext.o_;
187
+ let customEvents;
188
+ globalComponentsContext.ax_ = existingComponent;
189
+ out.sync();
190
+ if (renderer) {
191
+ const [rawInput] = input;
192
+ const normalizedInput = {};
193
+
194
+ for (const key in rawInput) {
195
+ let value = rawInput[key];
196
+ if (key.startsWith("on")) {
197
+ const c = key[2];
198
+ customEvents = customEvents || {};
199
+ customEvents[(c === "-" ? "" : c.toLowerCase()) + key.slice(3)] = [
200
+ value];
201
+
202
+ } else {
203
+ normalizedInput[key] = rawInput[key];
204
+ }
205
+ }
206
+
207
+ renderer(normalizedInput, out);
208
+ } else {
209
+ RenderBodyComponent({ renderBody, args: input }, out);
210
+ }
211
+
212
+ queueEffect(scope, () => {
213
+ const targetNode = out.af_().ay_;
214
+ morphdom(rootNode, targetNode, host, componentsContext);
215
+ const componentDefs = componentsContext.ad_(
216
+ getRootNode(host)
217
+ );
218
+ const component = componentDefs[0].r_;
219
+ component._A_ = rootNode;
220
+ component.N_ = input[0];
221
+ component.U_ = customEvents;
222
+ scope.marko5Component = component;
223
+ });
224
+ }
225
+
226
+ function getRootNode(el) {
227
+ var cur = el;
228
+ while (cur.parentNode) cur = cur.parentNode;
229
+ return cur;
230
+ }
231
+
232
+ const RenderBodyComponentId = "renderbody-renderer";
233
+ const RenderBodyComponent = createRenderer(
234
+ function (input, out, _componentDef) {
235
+ dynamicTag(
236
+ out,
237
+ input.renderBody,
238
+ null,
239
+ null,
240
+ input.args,
241
+ null,
242
+ _componentDef,
243
+ "0"
244
+ );
245
+ },
246
+ {
247
+ t: RenderBodyComponentId,
248
+ i: true,
249
+ d: "MARKO_DEBUG"
250
+ },
251
+ {}
252
+ );
253
+
254
+ registerComponent(RenderBodyComponentId, () => ({
255
+ _: RenderBodyComponent,
256
+ Component: defineComponent({}, RenderBodyComponent)
257
+ }));
258
+
259
+ function resolveRegistered(renderer) {
260
+ if (!Array.isArray(renderer)) return renderer;
261
+
262
+ const [registerId, scopeId] = renderer;
263
+ const scope = scopeLookup[scopeId];
264
+ return getRegisteredWithScope(registerId, scope);
265
+ }
@@ -0,0 +1,167 @@
1
+ "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;exports.serialized5to6 = serialized5to6;var _initComponentsTag = _interopRequireDefault(require("../../core-tags/components/init-components-tag"));
2
+ var _ComponentsContext = require("../components/ComponentsContext");
3
+
4
+ const tagsAPI = require(
5
+ // eslint-disable-next-line no-constant-condition
6
+ "@marko/runtime-tags/html"
7
+ );
8
+ const createRenderer = require("../components/renderer");
9
+ const defaultCreateOut = require("../createOut");
10
+ const dynamicTag5 = require("./dynamic-tag");
11
+ const {
12
+ patchDynamicTag,
13
+ createRenderFn,
14
+ fork,
15
+ write,
16
+ makeSerializable,
17
+ register,
18
+ writeScope,
19
+ nextScopeId,
20
+ getRegistryInfo
21
+ } = tagsAPI;
22
+
23
+ const FN_TO_JSON = function () {
24
+ // TODO: this should instead return an object that contains getRegistryInfo
25
+ // then in the dom-compat, handle that object to lookup the function in the registry
26
+ // (we also need to do this for events)
27
+ return getRegistryInfo(this);
28
+ };
29
+
30
+ const isMarko6 = (fn) => !!fn.bt_;
31
+ const isMarko5 = (fn) => !fn.bt_;var _default = exports.default =
32
+
33
+ dynamicTag5.bk_ = function tagsToVdom(
34
+ tagsRenderer,
35
+ renderBody,
36
+ args)
37
+ {
38
+ if (tagsRenderer ? isMarko5(tagsRenderer) : isMarko5(renderBody))
39
+ return tagsRenderer;
40
+
41
+ if (!tagsRenderer && renderBody) {
42
+ renderBody.toJSON = FN_TO_JSON;
43
+ }
44
+
45
+ return (input, out) =>
46
+ TagsCompat(
47
+ args ?
48
+ { i: args, r: (args) => (tagsRenderer || renderBody)(...args) } :
49
+ { i: input, r: tagsRenderer || renderBody },
50
+ out
51
+ );
52
+ };
53
+
54
+ const TagsCompatId = "tags-compat";
55
+ const TagsCompat = createRenderer(
56
+ function (_, out, componentDef, component) {
57
+ const input = _.i;
58
+ const tagsRenderer = _.r;
59
+ const renderFn = createRenderFn(tagsRenderer);
60
+ const $global = out.global;
61
+ const streamData = $global.streamData = $global.streamData || {};
62
+
63
+ $global.serializedGlobals = $global.serializedGlobals || {};
64
+ $global.serializedGlobals.componentIdToScopeId = true;
65
+ $global.componentIdToScopeId = $global.componentIdToScopeId || {};
66
+ $global.componentIdToScopeId[component.id] = streamData.scopeId || 0;
67
+ out.bf(out._Y_, component, true);
68
+ renderFn(out.beginAsync(), input, {}, streamData);
69
+ out.ef();
70
+ },
71
+ {
72
+ t: TagsCompatId,
73
+ d: "MARKO_DEBUG"
74
+ },
75
+ {}
76
+ );
77
+
78
+ patchDynamicTag(
79
+ function getRenderer(tag) {
80
+ const renderer = tag._ || tag.renderBody || tag;
81
+ if (isMarko6(renderer)) return renderer;
82
+
83
+ const renderer5 =
84
+ tag._ ||
85
+ tag.render ||
86
+ tag.renderer && tag.renderer.renderer ||
87
+ tag.renderer;
88
+ const renderBody5 = tag.renderBody || tag;
89
+
90
+ return (input, ...args) => {
91
+ const out = defaultCreateOut();
92
+ let customEvents;
93
+
94
+ out.global.streamData = tagsAPI.$_streamData;
95
+
96
+ if (renderer5) {
97
+ const normalizedInput = {};
98
+
99
+ for (const key in input) {
100
+ let value = input[key];
101
+ if (key.startsWith("on") && typeof value === "function") {
102
+ const c = key[2];
103
+ customEvents = customEvents || [];
104
+ customEvents.push([
105
+ (c === "-" ? "" : c.toLowerCase()) + key.slice(3),
106
+ value]
107
+ );
108
+ value.toJSON = FN_TO_JSON;
109
+ } else {
110
+ normalizedInput[key] = input[key];
111
+ }
112
+ }
113
+ renderer5(normalizedInput, out);
114
+ } else {
115
+ renderBody5(out, input, ...args);
116
+ }
117
+
118
+ const componentsContext = (0, _ComponentsContext.R_)(out);
119
+ const component = componentsContext.b_[0];
120
+ if (component) {
121
+ component.r_.U_ = customEvents;
122
+ writeScope(nextScopeId(), {
123
+ m5c: component.id
124
+ });
125
+ }
126
+
127
+ (0, _initComponentsTag.default)({}, out);
128
+
129
+ let async;
130
+ out.once("finish", (result) => {
131
+ if (!async) {
132
+ async = false;
133
+ write(result.toString());
134
+ }
135
+ });
136
+
137
+ out.end();
138
+
139
+ if (async !== false) {
140
+ async = true;
141
+ fork(out, (result) => {
142
+ write(result.toString());
143
+ });
144
+ }
145
+ };
146
+ },
147
+ function createRenderer(renderFn) {
148
+ renderFn.bt_ = true;
149
+ return renderFn;
150
+ }
151
+ );
152
+
153
+ function dummyCreate5to6Renderer() {}
154
+
155
+ register(dummyCreate5to6Renderer, "@marko/tags-compat-5-to-6");
156
+
157
+ function serialized5to6(renderer, id) {
158
+ const dummyRenderer = () => {};
159
+ register(dummyRenderer, id);
160
+ return makeSerializable(renderer, (s) =>
161
+ s.
162
+ value(dummyCreate5to6Renderer).
163
+ code("(").
164
+ value(dummyRenderer).
165
+ code(",!0)")
166
+ );
167
+ }
@@ -9,7 +9,7 @@ var markoAttr = require("./helpers/data-marko");
9
9
  var escapeXmlHelper = require("./helpers/escape-xml");
10
10
  var StringWriter = require("./StringWriter");
11
11
  var escapeXmlOrNullish = escapeXmlHelper.x;
12
- var escapeXmlString = escapeXmlHelper.bk_;
12
+ var escapeXmlString = escapeXmlHelper.bu_;
13
13
 
14
14
  function noop() {}
15
15
 
@@ -39,6 +39,16 @@ function escapeEndingComment(text) {
39
39
  return text.replace(/(--!?)>/g, "$1&gt;");
40
40
  }
41
41
 
42
+ function deferred() {
43
+ let resolve;
44
+ let reject;
45
+ const promise = new Promise((res, rej) => {
46
+ resolve = res;
47
+ reject = rej;
48
+ });
49
+ return { promise, resolve, reject };
50
+ }
51
+
42
52
  function AsyncStream(global, writer, parentOut) {
43
53
  if (parentOut === null) {
44
54
  throw new Error("illegal state");
@@ -94,7 +104,7 @@ function AsyncStream(global, writer, parentOut) {
94
104
  this._X_ = null;
95
105
  this._Y_ = null;
96
106
  this.b__ = null;
97
- this.bl_ = false;
107
+ this.bv_ = false;
98
108
  }
99
109
 
100
110
  AsyncStream.DEFAULT_TIMEOUT = 10000;
@@ -115,7 +125,78 @@ AsyncStream.enableAsyncStackTrace = function () {
115
125
  var proto = AsyncStream.prototype = {
116
126
  constructor: AsyncStream,
117
127
  A_: typeof document === "object" && document,
118
- bm_: true,
128
+ bw_: true,
129
+
130
+ [Symbol.asyncIterator]() {
131
+ if (this.bx_) {
132
+ return this.bx_;
133
+ }
134
+
135
+ const originalWriter = this._state.writer;
136
+ let buffer = "";
137
+ let iteratorNextFn;
138
+
139
+ if (!originalWriter.stream) {
140
+ // Writing has finished completely so we can use a simple iterator
141
+ buffer = this.toString();
142
+ iteratorNextFn = () => {
143
+ const value = buffer;
144
+ buffer = "";
145
+ return { value, done: !value };
146
+ };
147
+ } else {
148
+ let done = false;
149
+ let pending = deferred();
150
+ const stream = {
151
+ write(data) {
152
+ buffer += data;
153
+ },
154
+ end() {
155
+ done = true;
156
+ pending.resolve({
157
+ value: "",
158
+ done
159
+ });
160
+ },
161
+ flush() {
162
+ pending.resolve({
163
+ value: buffer,
164
+ done: false
165
+ });
166
+ buffer = "";
167
+ pending = deferred();
168
+ }
169
+ };
170
+
171
+ this.on("error", pending.reject);
172
+
173
+ const writer = new BufferedWriter(stream);
174
+ writer.stream = originalWriter.stream;
175
+ writer.stream.writer = writer;
176
+ writer.next = originalWriter.next;
177
+ writer.state = this._state;
178
+ writer.merge(originalWriter);
179
+
180
+ this._state.stream = stream;
181
+ this._state.writer = writer;
182
+
183
+ iteratorNextFn = async () => {
184
+ if (buffer || done) {
185
+ const value = buffer;
186
+ buffer = "";
187
+ return { value, done };
188
+ }
189
+ return pending.promise;
190
+ };
191
+ }
192
+
193
+ return this.bx_ = {
194
+ next: iteratorNextFn,
195
+ [Symbol.asyncIterator]() {
196
+ return this;
197
+ }
198
+ };
199
+ },
119
200
 
120
201
  sync: function () {
121
202
  this._sync = true;
@@ -154,7 +235,7 @@ var proto = AsyncStream.prototype = {
154
235
  return this._state.writer.toString();
155
236
  },
156
237
 
157
- bn_: function () {
238
+ by_: function () {
158
239
  this._result = this._result || new RenderResult(this);
159
240
  return this._result;
160
241
  },
@@ -205,7 +286,7 @@ var proto = AsyncStream.prototype = {
205
286
  }
206
287
 
207
288
  this._lastCount++;
208
- newStream.bl_ = true;
289
+ newStream.bv_ = true;
209
290
  }
210
291
 
211
292
  name = options.name;
@@ -251,7 +332,7 @@ var proto = AsyncStream.prototype = {
251
332
  }
252
333
 
253
334
  if (state.events !== state.stream) {
254
- state.events.emit("finish", this.bn_());
335
+ state.events.emit("finish", this.by_());
255
336
  }
256
337
  },
257
338
 
@@ -323,7 +404,7 @@ var proto = AsyncStream.prototype = {
323
404
  parentOut._handleChildDone(this);
324
405
  }
325
406
  } else {
326
- if (childOut.bl_) {
407
+ if (childOut.bv_) {
327
408
  this._lastCount--;
328
409
  }
329
410
 
@@ -364,7 +445,7 @@ var proto = AsyncStream.prototype = {
364
445
  var state = this._state;
365
446
 
366
447
  if (event === "finish" && state.finished === true) {
367
- callback(this.bn_());
448
+ callback(this.by_());
368
449
  } else if (event === "last") {
369
450
  this.onLast(callback);
370
451
  } else {
@@ -378,7 +459,7 @@ var proto = AsyncStream.prototype = {
378
459
  var state = this._state;
379
460
 
380
461
  if (event === "finish" && state.finished === true) {
381
- callback(this.bn_());
462
+ callback(this.by_());
382
463
  } else if (event === "last") {
383
464
  this.onLast(callback);
384
465
  } else {
@@ -637,20 +718,22 @@ var proto = AsyncStream.prototype = {
637
718
 
638
719
  then: function (fn, fnErr) {
639
720
  var out = this;
640
- var promise = new Promise(function (resolve, reject) {
721
+ return new Promise(function (resolve, reject) {
641
722
  out.on("error", reject);
642
723
  out.on("finish", function (result) {
643
724
  resolve(result);
644
725
  });
645
- });
646
-
647
- return Promise.resolve(promise).then(fn, fnErr);
726
+ }).then(fn, fnErr);
648
727
  },
649
728
 
650
729
  catch: function (fnErr) {
651
730
  return this.then(undefined, fnErr);
652
731
  },
653
732
 
733
+ finally: function (fn) {
734
+ return this.then(undefined, undefined).finally(fn);
735
+ },
736
+
654
737
  c: function (componentDef, key, customEvents) {
655
738
  this._X_ = componentDef;
656
739
  this._Y_ = key;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var attrHelper = require("./attr");
3
- var notEmptyAttr = attrHelper.bo_;
4
- var isEmptyAttrValue = attrHelper.bp_;
3
+ var notEmptyAttr = attrHelper.bz_;
4
+ var isEmptyAttrValue = attrHelper.bA_;
5
5
  var classHelper = require("./class-attr");
6
6
  var styleHelper = require("./style-attr");
7
7