marko 4.26.3 → 4.27.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/bin/markoc.js +15 -15
- package/dist/compiler/ast/CustomTag.js +2 -2
- package/dist/core-tags/components/TransformHelper/handleLegacyBind.js +0 -4
- package/dist/core-tags/core/await/renderer.js +0 -4
- package/dist/core-tags/migrate/all-tags/body-only-if.js +0 -1
- package/dist/core-tags/migrate/all-tags/control-flow-directives.js +0 -1
- package/dist/core-tags/migrate/all-tags/dynamic-attributes.js +1 -2
- package/dist/core-tags/migrate/all-tags/include-directive.js +0 -2
- package/dist/core-tags/migrate/all-tags/legacy-nested-tag.js +0 -2
- package/dist/core-tags/migrate/all-tags/marko-init.js +0 -2
- package/dist/core-tags/migrate/all-tags/modifier-key.js +0 -2
- package/dist/core-tags/migrate/all-tags/ref.js +1 -3
- package/dist/core-tags/migrate/all-tags/w-bind.js +0 -2
- package/dist/core-tags/migrate/all-tags/w-body.js +0 -2
- package/dist/core-tags/migrate/all-tags/w-config.js +0 -2
- package/dist/core-tags/migrate/all-tags/w-for.js +0 -3
- package/dist/core-tags/migrate/all-tags/w-id.js +1 -4
- package/dist/core-tags/migrate/all-tags/w-on.js +1 -4
- package/dist/core-tags/migrate/all-tags/w-preserve-attrs.js +0 -2
- package/dist/core-tags/migrate/all-tags/w-preserve.js +1 -3
- package/dist/core-tags/migrate/all-tags/widget-in-attrs.js +2 -11
- package/dist/core-tags/migrate/all-templates/non-standard-template-literals.js +0 -4
- package/dist/core-tags/migrate/all-templates/render-calls.js +0 -2
- package/dist/core-tags/migrate/assign-tag.js +0 -2
- package/dist/core-tags/migrate/async-fragment-tag.js +0 -2
- package/dist/core-tags/migrate/async-fragments-tag.js +0 -2
- package/dist/core-tags/migrate/await-tag.js +0 -7
- package/dist/core-tags/migrate/class-tag.js +0 -2
- package/dist/core-tags/migrate/component-globals-tag.js +0 -2
- package/dist/core-tags/migrate/for-tag.js +0 -2
- package/dist/core-tags/migrate/include-tag.js +0 -1
- package/dist/core-tags/migrate/invoke-tag.js +0 -2
- package/dist/core-tags/migrate/layout-placeholder-tag.js +0 -1
- package/dist/core-tags/migrate/layout-put-tag.js +0 -1
- package/dist/core-tags/migrate/layout-use-tag.js +0 -1
- package/dist/core-tags/migrate/macro-body-tag.js +0 -2
- package/dist/core-tags/migrate/macro-tag.js +0 -2
- package/dist/core-tags/migrate/unless-tag.js +0 -1
- package/dist/core-tags/migrate/var-tag.js +0 -2
- package/dist/node_modules/@internal/components-define-widget-legacy/index-browser.js +0 -10
- package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +0 -4
- package/dist/runtime/RenderResult.js +0 -3
- package/dist/runtime/components/Component.js +0 -6
- package/dist/runtime/components/ComponentDef.js +0 -3
- package/dist/runtime/components/ServerComponent.js +0 -4
- package/dist/runtime/components/legacy/defineComponent-legacy.js +0 -3
- package/dist/runtime/components/legacy/defineRenderer-legacy.js +1 -6
- package/dist/runtime/components/legacy/index.js +3 -1
- package/dist/runtime/helpers/for-of.js +3 -1
- package/dist/runtime/html/helpers/attr.js +0 -4
- package/dist/runtime/html/helpers/attrs.js +0 -2
- package/dist/runtime/html/helpers/merge-attrs.js +0 -3
- package/dist/runtime/vdom/VElement.js +0 -3
- package/dist/runtime/vdom/helpers/attrs.js +0 -2
- package/dist/taglib/taglib-loader/loadTagFromProps.js +15 -0
- package/docs/10-awesome-marko-features.md +1 -1
- package/docs/body-content.md +3 -3
- package/docs/class-components.md +6 -6
- package/docs/express.md +1 -1
- package/docs/fastify.md +4 -4
- package/docs/hapi.md +3 -3
- package/docs/http.md +1 -1
- package/docs/huncwot.md +1 -1
- package/docs/installing.md +2 -2
- package/docs/koa.md +2 -2
- package/docs/lasso.md +1 -1
- package/docs/marko-4-upgrade.md +1 -1
- package/docs/marko-v4.md +4 -4
- package/docs/marko-vs-react.md +2 -2
- package/docs/rendering.md +6 -6
- package/docs/server-side-rendering.md +3 -3
- package/docs/webpack.md +16 -16
- package/docs/why-is-marko-fast.md +3 -3
- package/package.json +1 -1
- package/src/compiler/Builder.js +13 -13
- package/src/compiler/CodeGenerator.js +2 -2
- package/src/compiler/CodeWriter.js +1 -1
- package/src/compiler/CompileContext.js +30 -30
- package/src/compiler/Compiler.js +3 -3
- package/src/compiler/HtmlJsParser.js +4 -4
- package/src/compiler/Migrator.js +2 -2
- package/src/compiler/Normalizer.js +5 -5
- package/src/compiler/Parser.js +11 -11
- package/src/compiler/Walker.js +1 -1
- package/src/compiler/ast/ArrayExpression.js +1 -1
- package/src/compiler/ast/BinaryExpression.js +1 -1
- package/src/compiler/ast/ConditionalExpression.js +1 -1
- package/src/compiler/ast/CustomTag.js +14 -14
- package/src/compiler/ast/Declaration.js +2 -2
- package/src/compiler/ast/DocumentType.js +2 -2
- package/src/compiler/ast/ForEach.js +1 -1
- package/src/compiler/ast/ForEachProp.js +1 -1
- package/src/compiler/ast/ForRange.js +1 -1
- package/src/compiler/ast/HtmlAttribute/html/generateCode.js +4 -4
- package/src/compiler/ast/HtmlAttribute/vdom/generateCode.js +2 -2
- package/src/compiler/ast/HtmlAttributeCollection.js +3 -3
- package/src/compiler/ast/HtmlComment.js +1 -1
- package/src/compiler/ast/HtmlElement/html/EndTag.js +1 -1
- package/src/compiler/ast/HtmlElement/html/StartTag.js +3 -3
- package/src/compiler/ast/HtmlElement/html/generateCode.js +5 -5
- package/src/compiler/ast/HtmlElement/index.js +1 -1
- package/src/compiler/ast/HtmlElement/vdom/HtmlElementVDOM.js +1 -1
- package/src/compiler/ast/HtmlElement/vdom/generateCode.js +3 -3
- package/src/compiler/ast/If.js +1 -1
- package/src/compiler/ast/LogicalExpression.js +1 -1
- package/src/compiler/ast/MemberExpression.js +1 -1
- package/src/compiler/ast/NewExpression.js +1 -1
- package/src/compiler/ast/Node.js +4 -4
- package/src/compiler/ast/ObjectExpression.js +2 -2
- package/src/compiler/ast/Property.js +1 -1
- package/src/compiler/ast/SequenceExpression.js +1 -1
- package/src/compiler/ast/TemplateLiteral.js +1 -1
- package/src/compiler/ast/TemplateRoot.js +3 -3
- package/src/compiler/ast/Text/index.js +1 -1
- package/src/compiler/ast/UnaryExpression.js +1 -1
- package/src/compiler/ast/UpdateExpression.js +1 -1
- package/src/compiler/config.js +1 -1
- package/src/compiler/index.js +5 -5
- package/src/compiler/modules.js +2 -2
- package/src/compiler/util/UniqueVars.js +4 -4
- package/src/compiler/util/convertRawJavaScriptAst.js +1 -1
- package/src/compiler/util/javaScriptReservedWords.js +1 -1
- package/src/compiler/util/macros.js +1 -1
- package/src/compiler/util/mergeProps.js +3 -3
- package/src/compiler/util/parseJavaScriptArgs.js +1 -1
- package/src/compiler/util/parseJavaScriptParams.js +1 -1
- package/src/compiler/util/parseRawJavaScriptAst.js +1 -1
- package/src/compiler/util/removeComments.js +6 -6
- package/src/compiler/util/tokenizer.js +3 -3
- package/src/compiler/util/vdom/VDOMOptimizer.js +2 -2
- package/src/core-tags/cache/cached-fragment-tag.js +2 -2
- package/src/core-tags/cache/default-cache-manager.js +2 -2
- package/src/core-tags/components/TransformHelper/ComponentArgsCompiler.js +3 -3
- package/src/core-tags/components/TransformHelper/assignComponentId.js +3 -3
- package/src/core-tags/components/TransformHelper/convertToComponent.js +4 -4
- package/src/core-tags/components/TransformHelper/getComponentFiles.js +1 -1
- package/src/core-tags/components/TransformHelper/handleComponentEvents.js +3 -3
- package/src/core-tags/components/TransformHelper/handleComponentPreserve.js +7 -7
- package/src/core-tags/components/TransformHelper/handleLegacyBind.js +2 -8
- package/src/core-tags/components/TransformHelper/handleRootNodes.js +14 -14
- package/src/core-tags/components/TransformHelper/handleScopedAttrs.js +1 -1
- package/src/core-tags/components/TransformHelper/index.js +1 -1
- package/src/core-tags/components/component-tag.js +1 -1
- package/src/core-tags/components/components-transformer.js +2 -2
- package/src/core-tags/components/util/generateRegisterComponentCode.js +2 -2
- package/src/core-tags/components/widget-types-tag.js +2 -2
- package/src/core-tags/core/await/AsyncValue.js +1 -1
- package/src/core-tags/core/await/renderer.js +3 -12
- package/src/core-tags/core/await/reorderer-renderer.js +1 -1
- package/src/core-tags/core/core-transformer.js +5 -5
- package/src/core-tags/core/html-comment-tag.js +1 -1
- package/src/core-tags/core/import-tag.js +1 -1
- package/src/core-tags/core/util/parseImport.js +8 -8
- package/src/core-tags/html/normalize-script-text.js +1 -1
- package/src/core-tags/migrate/all-tags/body-only-if.js +4 -5
- package/src/core-tags/migrate/all-tags/control-flow-directives.js +2 -5
- package/src/core-tags/migrate/all-tags/dynamic-attributes.js +1 -4
- package/src/core-tags/migrate/all-tags/include-directive.js +0 -4
- package/src/core-tags/migrate/all-tags/index.js +2 -2
- package/src/core-tags/migrate/all-tags/legacy-nested-tag.js +0 -5
- package/src/core-tags/migrate/all-tags/marko-init.js +2 -8
- package/src/core-tags/migrate/all-tags/modifier-key.js +1 -7
- package/src/core-tags/migrate/all-tags/params.js +1 -1
- package/src/core-tags/migrate/all-tags/ref.js +1 -5
- package/src/core-tags/migrate/all-tags/w-bind.js +8 -12
- package/src/core-tags/migrate/all-tags/w-body.js +3 -7
- package/src/core-tags/migrate/all-tags/w-config.js +1 -5
- package/src/core-tags/migrate/all-tags/w-for.js +1 -8
- package/src/core-tags/migrate/all-tags/w-id.js +1 -8
- package/src/core-tags/migrate/all-tags/w-on.js +2 -9
- package/src/core-tags/migrate/all-tags/w-preserve-attrs.js +1 -5
- package/src/core-tags/migrate/all-tags/w-preserve.js +3 -7
- package/src/core-tags/migrate/all-tags/widget-in-attrs.js +4 -17
- package/src/core-tags/migrate/all-templates/index.js +2 -2
- package/src/core-tags/migrate/all-templates/non-standard-template-literals.js +6 -12
- package/src/core-tags/migrate/all-templates/render-calls.js +4 -8
- package/src/core-tags/migrate/all-templates/widget-data-is-state.js +2 -2
- package/src/core-tags/migrate/all-templates/widget-get-template-data.js +2 -2
- package/src/core-tags/migrate/assign-tag.js +2 -6
- package/src/core-tags/migrate/async-fragment-tag.js +2 -6
- package/src/core-tags/migrate/async-fragments-tag.js +0 -4
- package/src/core-tags/migrate/await-tag.js +8 -23
- package/src/core-tags/migrate/class-tag.js +0 -4
- package/src/core-tags/migrate/component-globals-tag.js +0 -4
- package/src/core-tags/migrate/for-tag.js +12 -16
- package/src/core-tags/migrate/include-tag.js +2 -5
- package/src/core-tags/migrate/invoke-tag.js +2 -6
- package/src/core-tags/migrate/layout-placeholder-tag.js +0 -3
- package/src/core-tags/migrate/layout-put-tag.js +0 -3
- package/src/core-tags/migrate/layout-use-tag.js +0 -3
- package/src/core-tags/migrate/macro-body-tag.js +0 -5
- package/src/core-tags/migrate/macro-tag.js +5 -10
- package/src/core-tags/migrate/unless-tag.js +0 -3
- package/src/core-tags/migrate/util/addIdScopedAttr.js +1 -1
- package/src/core-tags/migrate/util/import-tag.js +6 -6
- package/src/core-tags/migrate/util/parseFor.js +20 -20
- package/src/core-tags/migrate/util/renderCallToDynamicTag.js +7 -7
- package/src/core-tags/migrate/var-tag.js +4 -8
- package/src/express.js +1 -1
- package/src/hot-reload.js +3 -3
- package/src/node-require/index.js +1 -1
- package/src/node_modules/@internal/components-define-widget-legacy/index-browser.js +4 -55
- package/src/node_modules/@internal/components-entry-legacy/index-browser.js +0 -10
- package/src/runtime/RenderResult.js +3 -16
- package/src/runtime/components/Component.js +2 -23
- package/src/runtime/components/ComponentDef.js +2 -8
- package/src/runtime/components/ComponentsContext.js +1 -1
- package/src/runtime/components/ServerComponent.js +0 -6
- package/src/runtime/components/State.js +2 -2
- package/src/runtime/components/attach-detach.js +1 -1
- package/src/runtime/components/dom-data.js +1 -1
- package/src/runtime/components/legacy/defineComponent-legacy.js +0 -5
- package/src/runtime/components/legacy/defineRenderer-legacy.js +1 -16
- package/src/runtime/components/legacy/dependencies/index.js +10 -10
- package/src/runtime/components/legacy/index.js +5 -0
- package/src/runtime/components/legacy/renderer-legacy.js +1 -1
- package/src/runtime/components/update-manager.js +1 -1
- package/src/runtime/dom-insert.js +1 -1
- package/src/runtime/helpers/_weak-map.js +1 -1
- package/src/runtime/helpers/bind-component.js +1 -1
- package/src/runtime/helpers/for-of.js +1 -6
- package/src/runtime/html/AsyncStream.js +5 -5
- package/src/runtime/html/BufferedWriter.js +1 -1
- package/src/runtime/html/StringWriter.js +1 -1
- package/src/runtime/html/helpers/attr.js +0 -9
- package/src/runtime/html/helpers/attrs.js +0 -6
- package/src/runtime/html/helpers/merge-attrs.js +0 -8
- package/src/runtime/html/index.js +1 -1
- package/src/runtime/renderable.js +1 -1
- package/src/runtime/vdom/AsyncVDOMBuilder.js +2 -2
- package/src/runtime/vdom/VComment.js +1 -1
- package/src/runtime/vdom/VComponent.js +1 -1
- package/src/runtime/vdom/VDocumentFragment.js +1 -1
- package/src/runtime/vdom/VElement.js +4 -11
- package/src/runtime/vdom/VFragment.js +1 -1
- package/src/runtime/vdom/VNode.js +1 -1
- package/src/runtime/vdom/VText.js +1 -1
- package/src/runtime/vdom/helpers/attrs.js +0 -7
- package/src/runtime/vdom/index.js +1 -1
- package/src/runtime/vdom/morphdom/fragment.js +1 -1
- package/src/runtime/vdom/morphdom/specialElHandlers.js +1 -1
- package/src/taglib/taglib-finder/index.js +5 -5
- package/src/taglib/taglib-loader/Tag.js +8 -8
- package/src/taglib/taglib-loader/Taglib.js +1 -1
- package/src/taglib/taglib-loader/loadAttributeFromProps.js +1 -1
- package/src/taglib/taglib-loader/loadTagFromProps.js +29 -14
- package/src/taglib/taglib-loader/loadTaglibFromProps.js +9 -9
- package/src/taglib/taglib-loader/scanTagsDir.js +6 -6
- package/src/taglib/taglib-lookup/TaglibLookup.js +8 -8
@@ -1,5 +1,4 @@
|
|
1
1
|
var domInsert = require("./dom-insert");
|
2
|
-
var complain;
|
3
2
|
|
4
3
|
function getRootNode(el) {
|
5
4
|
var cur = el;
|
@@ -72,14 +71,12 @@ var proto = RenderResult.prototype = {
|
|
72
71
|
Object.defineProperty(proto, "html", {
|
73
72
|
get: function () {
|
74
73
|
return this.toString();
|
75
|
-
// eslint-disable-next-line no-constant-condition
|
76
74
|
}
|
77
75
|
});
|
78
76
|
|
79
77
|
Object.defineProperty(proto, "context", {
|
80
78
|
get: function () {
|
81
79
|
return this.u_;
|
82
|
-
// eslint-disable-next-line no-constant-condition
|
83
80
|
}
|
84
81
|
});
|
85
82
|
|
@@ -1,8 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
/* jshint newcap:false */
|
3
3
|
|
4
|
-
var complain;
|
5
|
-
|
6
4
|
var domInsert = require("../dom-insert");
|
7
5
|
var defaultCreateOut = require("../createOut");
|
8
6
|
var getComponentsContext = require("./ComponentsContext").U_;
|
@@ -236,10 +234,8 @@ Component.prototype = componentProto = {
|
|
236
234
|
var keyedComponentRoot = this.N_[resolvedKey];
|
237
235
|
|
238
236
|
if (keyedComponentRoot) {
|
239
|
-
|
240
237
|
return keyedComponentRoot.nodeType === 1 /** Node.ELEMENT_NODE */
|
241
238
|
? keyedComponentRoot : walkFragments(keyedComponentRoot);
|
242
|
-
// eslint-disable-next-line no-constant-condition
|
243
239
|
}
|
244
240
|
}
|
245
241
|
|
@@ -264,7 +260,6 @@ Component.prototype = componentProto = {
|
|
264
260
|
var rootNode = this.N_[resolveKeyHelper(key, index)];
|
265
261
|
if (/\[\]$/.test(key)) {
|
266
262
|
rootNode = rootNode && rootNode[Object.keys(rootNode)[0]];
|
267
|
-
// eslint-disable-next-line no-constant-condition
|
268
263
|
}
|
269
264
|
return rootNode && componentsByDOMNode.get(rootNode);
|
270
265
|
},
|
@@ -568,7 +563,6 @@ Component.prototype = componentProto = {
|
|
568
563
|
return (this._E_ ? this._E_.nodes : []).filter(function (el) {
|
569
564
|
return el.nodeType === ELEMENT_NODE;
|
570
565
|
});
|
571
|
-
// eslint-disable-next-line no-constant-condition
|
572
566
|
},
|
573
567
|
|
574
568
|
aF_: emit,
|
@@ -1,6 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var complain;
|
4
3
|
var w10Noop = require("warp10/constants").NOOP;
|
5
4
|
var componentUtil = require("@internal/components-util");
|
6
5
|
var attachBubblingEvent = componentUtil._U_;
|
@@ -51,9 +50,7 @@ ComponentDef.prototype = {
|
|
51
50
|
return id;
|
52
51
|
} else {
|
53
52
|
if (typeof nestedId !== "string") {
|
54
|
-
|
55
53
|
nestedId = String(nestedId);
|
56
|
-
// eslint-disable-next-line no-constant-condition
|
57
54
|
}
|
58
55
|
|
59
56
|
if (nestedId.indexOf("#") === 0) {
|
@@ -1,7 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var complain;
|
4
|
-
|
5
3
|
class ServerComponent {
|
6
4
|
constructor(id, input, out, typeName, customEvents, scope) {
|
7
5
|
this.id = id;
|
@@ -46,9 +44,7 @@ class ServerComponent {
|
|
46
44
|
return id;
|
47
45
|
} else {
|
48
46
|
if (typeof nestedId !== "string") {
|
49
|
-
|
50
47
|
nestedId = String(nestedId);
|
51
|
-
// eslint-disable-next-line no-constant-condition
|
52
48
|
}
|
53
49
|
|
54
50
|
if (nestedId.indexOf("#") === 0) {
|
@@ -1,4 +1,3 @@
|
|
1
|
-
var complain;
|
2
1
|
var makeRenderable = require("../../renderable");
|
3
2
|
var getComponentsContext = require("../ComponentsContext").U_;
|
4
3
|
var componentLookup = require("@internal/components-util")._n_;
|
@@ -9,9 +8,6 @@ var resolveComponentKey = modernRenderer.aX_;
|
|
9
8
|
module.exports = function defineRenderer(renderingLogic) {
|
10
9
|
var renderer = renderingLogic.renderer;
|
11
10
|
|
12
|
-
// eslint-disable-next-line no-constant-condition
|
13
|
-
|
14
|
-
|
15
11
|
if (renderer && renderer.aY_) {
|
16
12
|
return renderer;
|
17
13
|
}
|
@@ -118,8 +114,6 @@ module.exports = function defineRenderer(renderingLogic) {
|
|
118
114
|
// widget config will be serialized.
|
119
115
|
widgetConfig = getWidgetConfig(newProps, out);
|
120
116
|
}
|
121
|
-
// eslint-disable-next-line no-constant-condition
|
122
|
-
|
123
117
|
|
124
118
|
templateData.widgetProps = newProps;
|
125
119
|
widgetBody && (templateData.renderBody = widgetBody);
|
@@ -135,6 +129,7 @@ module.exports = function defineRenderer(renderingLogic) {
|
|
135
129
|
renderer.template = template;
|
136
130
|
|
137
131
|
makeRenderable(renderer, renderer);
|
132
|
+
renderer.render = renderer.render.bind(this);
|
138
133
|
|
139
134
|
return renderer;
|
140
135
|
};
|
@@ -8,7 +8,9 @@ var complain;
|
|
8
8
|
module.exports = function forOf(array, callback) {
|
9
9
|
var i;
|
10
10
|
|
11
|
-
if (array == null) {
|
11
|
+
if (array == null) {
|
12
|
+
// ignore
|
13
|
+
} else if (Array.isArray(array)) {
|
12
14
|
for (i = 0; i < array.length; i++) {
|
13
15
|
callback(array[i], i, array);
|
14
16
|
}
|
@@ -3,7 +3,6 @@
|
|
3
3
|
var escapeQuoteHelpers = require("./escape-quotes");
|
4
4
|
var escapeDoubleQuotes = escapeQuoteHelpers.o_;
|
5
5
|
var escapeSingleQuotes = escapeQuoteHelpers.bu_;
|
6
|
-
var complain;
|
7
6
|
|
8
7
|
module.exports = maybeEmptyAttr;
|
9
8
|
|
@@ -30,10 +29,7 @@ function notEmptyAttr(name, value) {
|
|
30
29
|
switch (value.toString) {
|
31
30
|
case Object.prototype.toString:
|
32
31
|
case Array.prototype.toString:
|
33
|
-
|
34
32
|
return " " + name + singleQuote(JSON.stringify(value), 2);
|
35
|
-
// eslint-disable-next-line no-constant-condition
|
36
|
-
|
37
33
|
case RegExp.prototype.toString:
|
38
34
|
return " " + name + guessQuotes(value.source);
|
39
35
|
}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var complain;
|
4
3
|
var dynamicAttrHelper = require("./_dynamic-attr");
|
5
4
|
|
6
5
|
/**
|
@@ -13,13 +12,11 @@ module.exports = function mergeAttrs() {
|
|
13
12
|
for (var i = arguments.length, last = i - 1; i--;) {
|
14
13
|
var source = arguments[i];
|
15
14
|
if (typeof source === "string") {
|
16
|
-
|
17
15
|
if (source[0] !== " ") {
|
18
16
|
result += " " + source;
|
19
17
|
} else {
|
20
18
|
result += source;
|
21
19
|
}
|
22
|
-
// eslint-disable-next-line no-constant-condition
|
23
20
|
} else {
|
24
21
|
for (var k in source) {
|
25
22
|
if (i === last || !seen.has(k)) {
|
@@ -1,6 +1,5 @@
|
|
1
1
|
/* jshint newcap:false */
|
2
2
|
|
3
|
-
var complain;
|
4
3
|
var domData = require("../components/dom-data");
|
5
4
|
var componentsUtil = require("@internal/components-util");
|
6
5
|
var vElementByDOMNode = domData._L_;
|
@@ -35,8 +34,6 @@ function convertAttrValue(type, value) {
|
|
35
34
|
case Object.prototype.toString:
|
36
35
|
case Array.prototype.toString:
|
37
36
|
return JSON.stringify(value);
|
38
|
-
// eslint-disable-next-line no-constant-condition
|
39
|
-
|
40
37
|
case RegExp.prototype.toString:
|
41
38
|
return value.source;
|
42
39
|
}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var complain;
|
4
3
|
var classHelper = require("../../helpers/class-value");
|
5
4
|
var styleHelper = require("../../helpers/style-value");
|
6
5
|
var parseHTML = require("../parse-html");
|
@@ -11,7 +10,6 @@ var parseHTML = require("../parse-html");
|
|
11
10
|
module.exports = function (attributes) {
|
12
11
|
if (typeof attributes === "string") {
|
13
12
|
return parseAttrs(attributes);
|
14
|
-
// eslint-disable-next-line no-constant-condition
|
15
13
|
}
|
16
14
|
|
17
15
|
if (attributes) {
|
@@ -479,6 +479,10 @@ class TagLoader {
|
|
479
479
|
* - "body-function": "_handleBody(param1, param2, param3)"
|
480
480
|
*/
|
481
481
|
bodyFunction(value) {
|
482
|
+
complain("body-function is deprecated.", {
|
483
|
+
location: this.filePath
|
484
|
+
});
|
485
|
+
|
482
486
|
var tag = this.tag;
|
483
487
|
var parts = bodyFunctionRegExp.exec(value);
|
484
488
|
if (!parts) {
|
@@ -514,6 +518,10 @@ class TagLoader {
|
|
514
518
|
* }
|
515
519
|
*/
|
516
520
|
importVar(value) {
|
521
|
+
complain("import-var is deprecated.", {
|
522
|
+
location: this.filePath
|
523
|
+
});
|
524
|
+
|
517
525
|
var tag = this.tag;
|
518
526
|
forEachEntry(value, (varName, varValue) => {
|
519
527
|
var importedVar = {
|
@@ -592,6 +600,10 @@ class TagLoader {
|
|
592
600
|
* DEPRECATED
|
593
601
|
*/
|
594
602
|
escapeXmlBody(value) {
|
603
|
+
complain("escape-xml-body is deprecated.", {
|
604
|
+
location: this.filePath
|
605
|
+
});
|
606
|
+
|
595
607
|
if (value === false) {
|
596
608
|
this.tag.escapeXmlBody = false;
|
597
609
|
}
|
@@ -665,6 +677,9 @@ class TagLoader {
|
|
665
677
|
}
|
666
678
|
|
667
679
|
featureFlags(value) {
|
680
|
+
complain("feature-flags is deprecated.", {
|
681
|
+
location: this.filePath
|
682
|
+
});
|
668
683
|
this.tag.featureFlags = value;
|
669
684
|
}
|
670
685
|
}
|
package/docs/body-content.md
CHANGED
package/docs/class-components.md
CHANGED
@@ -110,7 +110,7 @@ In your `component.js` file, export the component’s class:
|
|
110
110
|
module.exports = class {
|
111
111
|
onCreate() {
|
112
112
|
this.state = {
|
113
|
-
count: 0
|
113
|
+
count: 0,
|
114
114
|
};
|
115
115
|
}
|
116
116
|
increment() {
|
@@ -144,12 +144,12 @@ If you target browsers that does not support classes, a plain object of methods
|
|
144
144
|
module.exports = {
|
145
145
|
onCreate: function () {
|
146
146
|
this.state = {
|
147
|
-
count: 0
|
147
|
+
count: 0,
|
148
148
|
};
|
149
149
|
},
|
150
150
|
increment: function () {
|
151
151
|
this.state.count++;
|
152
|
-
}
|
152
|
+
},
|
153
153
|
};
|
154
154
|
```
|
155
155
|
|
@@ -217,7 +217,7 @@ class {
|
|
217
217
|
module.exports = {
|
218
218
|
shout() {
|
219
219
|
alert(`My favorite number is ${this.number}!`);
|
220
|
-
}
|
220
|
+
},
|
221
221
|
};
|
222
222
|
```
|
223
223
|
|
@@ -626,7 +626,7 @@ Destroys the component by unsubscribing from all listeners made using the `subsc
|
|
626
626
|
```js
|
627
627
|
component.destroy({
|
628
628
|
removeNode: false, // true by default
|
629
|
-
recursive: false // true by default
|
629
|
+
recursive: false, // true by default
|
630
630
|
});
|
631
631
|
```
|
632
632
|
|
@@ -748,7 +748,7 @@ Changes the value of multiple state properties:
|
|
748
748
|
```js
|
749
749
|
this.setState({
|
750
750
|
disabled: true,
|
751
|
-
size: "large"
|
751
|
+
size: "large",
|
752
752
|
});
|
753
753
|
```
|
754
754
|
|
package/docs/express.md
CHANGED
package/docs/fastify.md
CHANGED
@@ -18,19 +18,19 @@ const fastify = require("fastify")();
|
|
18
18
|
|
19
19
|
fastify.register(require("point-of-view"), {
|
20
20
|
engine: {
|
21
|
-
marko: require("marko")
|
22
|
-
}
|
21
|
+
marko: require("marko"),
|
22
|
+
},
|
23
23
|
});
|
24
24
|
|
25
25
|
fastify.get("/", (req, reply) => {
|
26
26
|
reply.view("/index.marko", {
|
27
27
|
name: "Frank",
|
28
28
|
count: 30,
|
29
|
-
colors: ["red", "green", "blue"]
|
29
|
+
colors: ["red", "green", "blue"],
|
30
30
|
});
|
31
31
|
});
|
32
32
|
|
33
|
-
fastify.listen(8080, err => {
|
33
|
+
fastify.listen(8080, (err) => {
|
34
34
|
if (err) throw err;
|
35
35
|
console.log(`Server listening on ${fastify.server.address().port}`);
|
36
36
|
});
|
package/docs/hapi.md
CHANGED
@@ -34,13 +34,13 @@ server.route({
|
|
34
34
|
indexTemplate.stream({
|
35
35
|
name: "Frank",
|
36
36
|
count: 30,
|
37
|
-
colors: ["red", "green", "blue"]
|
37
|
+
colors: ["red", "green", "blue"],
|
38
38
|
})
|
39
39
|
).type("text/html");
|
40
|
-
}
|
40
|
+
},
|
41
41
|
});
|
42
42
|
|
43
|
-
server.start(err => {
|
43
|
+
server.start((err) => {
|
44
44
|
if (err) {
|
45
45
|
throw err;
|
46
46
|
}
|
package/docs/http.md
CHANGED
package/docs/huncwot.md
CHANGED
@@ -17,7 +17,7 @@ const Huncwot = require("huncwot");
|
|
17
17
|
const app = new Huncwot();
|
18
18
|
const template = require("./index.marko");
|
19
19
|
|
20
|
-
app.get("/", request => template.stream({ name: "Frank" }));
|
20
|
+
app.get("/", (request) => template.stream({ name: "Frank" }));
|
21
21
|
|
22
22
|
app.listen(3000);
|
23
23
|
```
|
package/docs/installing.md
CHANGED
@@ -184,12 +184,12 @@ var isProduction = process.env.NODE_ENV === "production";
|
|
184
184
|
// Configure lasso to control how JS/CSS/etc. is delivered to the browser
|
185
185
|
require("lasso").configure({
|
186
186
|
plugins: [
|
187
|
-
"lasso-marko" // Allow Marko templates to be compiled and transported to the browser
|
187
|
+
"lasso-marko", // Allow Marko templates to be compiled and transported to the browser
|
188
188
|
],
|
189
189
|
outputDir: __dirname + "/static", // Place all generated JS/CSS/etc. files into the "static" dir
|
190
190
|
bundlingEnabled: isProduction, // Only enable bundling in production
|
191
191
|
minify: isProduction, // Only minify JS and CSS code in production
|
192
|
-
fingerprintsEnabled: isProduction // Only add fingerprints to URLs in production
|
192
|
+
fingerprintsEnabled: isProduction, // Only add fingerprints to URLs in production
|
193
193
|
});
|
194
194
|
```
|
195
195
|
|
package/docs/koa.md
CHANGED
@@ -23,7 +23,7 @@ app.use((ctx, next) => {
|
|
23
23
|
ctx.body = template.stream({
|
24
24
|
name: "Frank",
|
25
25
|
count: 30,
|
26
|
-
colors: ["red", "green", "blue"]
|
26
|
+
colors: ["red", "green", "blue"],
|
27
27
|
});
|
28
28
|
});
|
29
29
|
|
@@ -46,7 +46,7 @@ app.use((ctx, next) => {
|
|
46
46
|
ctx.body = template.stream({
|
47
47
|
name: "Frank",
|
48
48
|
count: 30,
|
49
|
-
colors: ["red", "green", "blue"]
|
49
|
+
colors: ["red", "green", "blue"],
|
50
50
|
});
|
51
51
|
|
52
52
|
ctx.vary("Accept-Encoding");
|
package/docs/lasso.md
CHANGED
package/docs/marko-4-upgrade.md
CHANGED
package/docs/marko-v4.md
CHANGED
@@ -51,7 +51,7 @@ var clickCount = require("./src/components/click-count");
|
|
51
51
|
|
52
52
|
var component = clickCount
|
53
53
|
.renderSync({
|
54
|
-
value: 10
|
54
|
+
value: 10,
|
55
55
|
})
|
56
56
|
.appendTo(document.body)
|
57
57
|
.getComponent();
|
@@ -97,7 +97,7 @@ _Compiled for VDOM output (browser-side):_
|
|
97
97
|
|
98
98
|
```javascript
|
99
99
|
var marko_attrs0 = {
|
100
|
-
class: "color"
|
100
|
+
class: "color",
|
101
101
|
},
|
102
102
|
marko_node0 = marko_createElement("DIV", null, 1, marko_const_nextId()).t(
|
103
103
|
"No colors!"
|
@@ -694,7 +694,7 @@ _Automatically inserted before `</body>`_
|
|
694
694
|
|
695
695
|
```js
|
696
696
|
require("marko/node-require").install({
|
697
|
-
extension: ".marko"
|
697
|
+
extension: ".marko",
|
698
698
|
});
|
699
699
|
```
|
700
700
|
|
@@ -702,7 +702,7 @@ require("marko/node-require").install({
|
|
702
702
|
|
703
703
|
```js
|
704
704
|
require("marko/node-require").install({
|
705
|
-
extensions: [".marko", ".marko.xml", ".html"]
|
705
|
+
extensions: [".marko", ".marko.xml", ".html"],
|
706
706
|
});
|
707
707
|
```
|
708
708
|
|
package/docs/marko-vs-react.md
CHANGED
@@ -455,11 +455,11 @@ template:
|
|
455
455
|
function renderColors(colors) {
|
456
456
|
return (
|
457
457
|
<ul>
|
458
|
-
{colors.map(color => (
|
458
|
+
{colors.map((color) => (
|
459
459
|
<li
|
460
460
|
className="color"
|
461
461
|
style={{
|
462
|
-
backgroundColor: color
|
462
|
+
backgroundColor: color,
|
463
463
|
}}
|
464
464
|
>
|
465
465
|
{color}
|
package/docs/rendering.md
CHANGED
@@ -70,7 +70,7 @@ The `render` method returns an async `out` which is used to generate HTML on the
|
|
70
70
|
var view = require("./view"); // Import `./view.marko`
|
71
71
|
var resultPromise = view.render({});
|
72
72
|
|
73
|
-
resultPromise.then(result => {
|
73
|
+
resultPromise.then((result) => {
|
74
74
|
result.appendTo(document.body);
|
75
75
|
});
|
76
76
|
```
|
@@ -212,8 +212,8 @@ If you need to make data available globally to all views that are rendered as th
|
|
212
212
|
```js
|
213
213
|
view.render({
|
214
214
|
$global: {
|
215
|
-
flags: ["mobile"]
|
216
|
-
}
|
215
|
+
flags: ["mobile"],
|
216
|
+
},
|
217
217
|
});
|
218
218
|
```
|
219
219
|
|
@@ -235,9 +235,9 @@ app.get("/", (req, res) => {
|
|
235
235
|
|
236
236
|
serializedGlobals: {
|
237
237
|
isIos: true, // Tell marko to serialize isIos above
|
238
|
-
isAndroid: true // Tell marko to serialize isAndroid above
|
239
|
-
}
|
240
|
-
}
|
238
|
+
isAndroid: true, // Tell marko to serialize isAndroid above
|
239
|
+
},
|
240
|
+
},
|
241
241
|
},
|
242
242
|
res
|
243
243
|
);
|
package/docs/webpack.md
CHANGED
@@ -40,19 +40,19 @@ module.exports = {
|
|
40
40
|
entry: "./client.js",
|
41
41
|
output: {
|
42
42
|
path: __dirname,
|
43
|
-
filename: "static/bundle.js"
|
43
|
+
filename: "static/bundle.js",
|
44
44
|
},
|
45
45
|
resolve: {
|
46
|
-
extensions: [".js", ".marko"]
|
46
|
+
extensions: [".js", ".marko"],
|
47
47
|
},
|
48
48
|
module: {
|
49
49
|
rules: [
|
50
50
|
{
|
51
51
|
test: /\.marko$/,
|
52
|
-
loader: "@marko/webpack/loader"
|
53
|
-
}
|
54
|
-
]
|
55
|
-
}
|
52
|
+
loader: "@marko/webpack/loader",
|
53
|
+
},
|
54
|
+
],
|
55
|
+
},
|
56
56
|
};
|
57
57
|
```
|
58
58
|
|
@@ -96,8 +96,8 @@ module: {
|
|
96
96
|
//...
|
97
97
|
{
|
98
98
|
test: /\.less$/, // matches style.less { ... } from our template
|
99
|
-
use: ["style-loader", "css-loader", "less-loader"]
|
100
|
-
}
|
99
|
+
use: ["style-loader", "css-loader", "less-loader"],
|
100
|
+
},
|
101
101
|
//...
|
102
102
|
];
|
103
103
|
}
|
@@ -120,25 +120,25 @@ const CSSExtractPlugin = require("mini-css-extract-plugin");
|
|
120
120
|
module.exports = {
|
121
121
|
entry: "./client.js",
|
122
122
|
resolve: {
|
123
|
-
extensions: [".js", ".marko"]
|
123
|
+
extensions: [".js", ".marko"],
|
124
124
|
},
|
125
125
|
module: {
|
126
126
|
rules: [
|
127
127
|
{
|
128
128
|
test: /\.marko$/,
|
129
|
-
loader: "@marko/webpack/loader"
|
129
|
+
loader: "@marko/webpack/loader",
|
130
130
|
},
|
131
131
|
{
|
132
132
|
test: /\.(less|css)$/,
|
133
|
-
use: [CSSExtractPlugin.loader, "css-loader", "less-loader"]
|
134
|
-
}
|
135
|
-
]
|
133
|
+
use: [CSSExtractPlugin.loader, "css-loader", "less-loader"],
|
134
|
+
},
|
135
|
+
],
|
136
136
|
},
|
137
137
|
plugins: [
|
138
138
|
// Write out CSS bundle to its own file:
|
139
139
|
new CSSExtractPlugin({
|
140
|
-
filename: "[name].css"
|
141
|
-
})
|
142
|
-
]
|
140
|
+
filename: "[name].css",
|
141
|
+
}),
|
142
|
+
],
|
143
143
|
};
|
144
144
|
```
|
@@ -104,8 +104,8 @@ function render(input, out) {
|
|
104
104
|
"DIV",
|
105
105
|
{
|
106
106
|
style: marko_styleAttr({
|
107
|
-
backgroundColor: color
|
108
|
-
})
|
107
|
+
backgroundColor: color,
|
108
|
+
}),
|
109
109
|
},
|
110
110
|
0,
|
111
111
|
4
|
@@ -176,7 +176,7 @@ Marko will produce the following compiled output:
|
|
176
176
|
|
177
177
|
```js
|
178
178
|
var marko_attrs0 = {
|
179
|
-
class: "hello"
|
179
|
+
class: "hello",
|
180
180
|
};
|
181
181
|
|
182
182
|
function render(input, out) {
|