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
@@ -8,60 +8,60 @@ var numberRegExp = /^-?(?:\d+|\d+\.\d*|\d*\.\d+|\d+\.\d+)$/;
|
|
8
8
|
var tokenizer = require("../../../compiler/util/tokenizer").create([
|
9
9
|
{
|
10
10
|
name: "stringDouble",
|
11
|
-
pattern: /"(?:[^"]|\\")*"
|
11
|
+
pattern: /"(?:[^"]|\\")*"/,
|
12
12
|
},
|
13
13
|
{
|
14
14
|
name: "stringSingle",
|
15
|
-
pattern: /'(?:[^']|\\')*'
|
15
|
+
pattern: /'(?:[^']|\\')*'/,
|
16
16
|
},
|
17
17
|
{
|
18
18
|
name: "in",
|
19
|
-
pattern: /\s+in\s
|
19
|
+
pattern: /\s+in\s+/,
|
20
20
|
},
|
21
21
|
{
|
22
22
|
name: "from",
|
23
|
-
pattern: /\s+from\s
|
23
|
+
pattern: /\s+from\s+/,
|
24
24
|
},
|
25
25
|
{
|
26
26
|
name: "to",
|
27
|
-
pattern: /\s+to\s
|
27
|
+
pattern: /\s+to\s+/,
|
28
28
|
},
|
29
29
|
{
|
30
30
|
name: "step",
|
31
|
-
pattern: /\s+step\s
|
31
|
+
pattern: /\s+step\s+/,
|
32
32
|
},
|
33
33
|
{
|
34
34
|
name: "semicolon",
|
35
|
-
pattern: /[;]
|
35
|
+
pattern: /[;]/,
|
36
36
|
},
|
37
37
|
{
|
38
38
|
name: "separator",
|
39
|
-
pattern: /separator\s?=\s
|
39
|
+
pattern: /separator\s?=\s?/,
|
40
40
|
},
|
41
41
|
{
|
42
42
|
name: "status-var",
|
43
|
-
pattern: /status-var\s?=\s
|
43
|
+
pattern: /status-var\s?=\s?/,
|
44
44
|
},
|
45
45
|
{
|
46
46
|
name: "iterator",
|
47
|
-
pattern: /iterator\s?=\s
|
47
|
+
pattern: /iterator\s?=\s?/,
|
48
48
|
},
|
49
49
|
{
|
50
50
|
name: "pipe",
|
51
|
-
pattern: /\s+\|\s
|
51
|
+
pattern: /\s+\|\s+/,
|
52
52
|
},
|
53
53
|
{
|
54
54
|
name: "groupOpen",
|
55
|
-
pattern: /[{([]
|
55
|
+
pattern: /[{([]/,
|
56
56
|
},
|
57
57
|
{
|
58
58
|
name: "groupClose",
|
59
|
-
pattern: /[})\]]
|
59
|
+
pattern: /[})\]]/,
|
60
60
|
},
|
61
61
|
{
|
62
62
|
name: "array",
|
63
|
-
pattern: /array
|
64
|
-
}
|
63
|
+
pattern: /array/,
|
64
|
+
},
|
65
65
|
]);
|
66
66
|
|
67
67
|
var inRegExp =
|
@@ -204,7 +204,7 @@ module.exports = function (str) {
|
|
204
204
|
}
|
205
205
|
}
|
206
206
|
|
207
|
-
tokenizer.forEachToken(str, token => {
|
207
|
+
tokenizer.forEachToken(str, (token) => {
|
208
208
|
switch (token.name) {
|
209
209
|
case "groupOpen":
|
210
210
|
depth++;
|
@@ -371,7 +371,7 @@ module.exports = function (str) {
|
|
371
371
|
separator: separatorExpression,
|
372
372
|
statusVarName: statusVarName,
|
373
373
|
iterator: iteratorExpression,
|
374
|
-
isArray: isArray
|
374
|
+
isArray: isArray,
|
375
375
|
};
|
376
376
|
} else if (loopType === "ForEachProp") {
|
377
377
|
return {
|
@@ -380,7 +380,7 @@ module.exports = function (str) {
|
|
380
380
|
valueVarName: valueVarName,
|
381
381
|
in: inExpression,
|
382
382
|
separator: separatorExpression,
|
383
|
-
statusVarName: statusVarName
|
383
|
+
statusVarName: statusVarName,
|
384
384
|
};
|
385
385
|
} else if (loopType === "ForRange") {
|
386
386
|
return {
|
@@ -388,7 +388,7 @@ module.exports = function (str) {
|
|
388
388
|
varName: varName,
|
389
389
|
from: fromExpression,
|
390
390
|
to: toExpression,
|
391
|
-
step: stepExpression
|
391
|
+
step: stepExpression,
|
392
392
|
};
|
393
393
|
} else if (loopType === "For") {
|
394
394
|
if (forTest == null) {
|
@@ -400,7 +400,7 @@ module.exports = function (str) {
|
|
400
400
|
loopType: loopType,
|
401
401
|
init: forInit,
|
402
402
|
test: forTest,
|
403
|
-
update: forUpdate
|
403
|
+
update: forUpdate,
|
404
404
|
};
|
405
405
|
} else {
|
406
406
|
throwError("Invalid for loop");
|
@@ -5,7 +5,7 @@ module.exports = function renderCallToDynamicTag(ast, context) {
|
|
5
5
|
const args = ast.args;
|
6
6
|
const callee = ast.callee;
|
7
7
|
const argsLength = args.length;
|
8
|
-
const outIndex = args.findIndex(arg => arg.name === "out");
|
8
|
+
const outIndex = args.findIndex((arg) => arg.name === "out");
|
9
9
|
const calleeProperty = callee.property && callee.property.name;
|
10
10
|
|
11
11
|
if (outIndex === -1) {
|
@@ -57,7 +57,7 @@ module.exports = function renderCallToDynamicTag(ast, context) {
|
|
57
57
|
null,
|
58
58
|
[builder.identifier("_"), builder.identifier("out")],
|
59
59
|
[ast]
|
60
|
-
)
|
60
|
+
),
|
61
61
|
});
|
62
62
|
}
|
63
63
|
}
|
@@ -87,18 +87,18 @@ function toAttributesOrSpread(val) {
|
|
87
87
|
|
88
88
|
if (
|
89
89
|
val.type === "ObjectExpression" &&
|
90
|
-
val.properties.every(prop => !prop.computed)
|
90
|
+
val.properties.every((prop) => !prop.computed)
|
91
91
|
) {
|
92
|
-
return val.properties.map(prop => ({
|
92
|
+
return val.properties.map((prop) => ({
|
93
93
|
name: prop.literalKeyValue,
|
94
|
-
value: prop.value
|
94
|
+
value: prop.value,
|
95
95
|
}));
|
96
96
|
}
|
97
97
|
|
98
98
|
return [
|
99
99
|
{
|
100
100
|
value: val,
|
101
|
-
spread: true
|
102
|
-
}
|
101
|
+
spread: true,
|
102
|
+
},
|
103
103
|
];
|
104
104
|
}
|
@@ -19,10 +19,6 @@ module.exports = function nodeFactory(elNode, context) {
|
|
19
19
|
return elNode;
|
20
20
|
}
|
21
21
|
|
22
|
-
context.deprecate(
|
23
|
-
'The "<var>" tag is deprecated. Please use "$ <js_code>" for JavaScript in the template. See: https://github.com/marko-js/marko/wiki/Deprecation:-var,-assign,-invoke-tags'
|
24
|
-
);
|
25
|
-
|
26
22
|
if (
|
27
23
|
firstChild &&
|
28
24
|
firstChild.type === "Text" &&
|
@@ -39,7 +35,7 @@ module.exports = function nodeFactory(elNode, context) {
|
|
39
35
|
lastChild.argument.value = lastChild.argument.value.trimRight();
|
40
36
|
}
|
41
37
|
|
42
|
-
const scriptlets = elNode.attributes.map(attr => {
|
38
|
+
const scriptlets = elNode.attributes.map((attr) => {
|
43
39
|
const name = attr.name;
|
44
40
|
const val = attr.rawValue;
|
45
41
|
|
@@ -55,7 +51,7 @@ module.exports = function nodeFactory(elNode, context) {
|
|
55
51
|
return builder.scriptlet({
|
56
52
|
value: `var ${
|
57
53
|
val == null ? name : `${name} = ${printJS(attr.value, context)}`
|
58
|
-
}
|
54
|
+
}`,
|
59
55
|
});
|
60
56
|
});
|
61
57
|
|
@@ -63,7 +59,7 @@ module.exports = function nodeFactory(elNode, context) {
|
|
63
59
|
return;
|
64
60
|
}
|
65
61
|
|
66
|
-
scriptlets.forEach(scriptlet => elNode.insertSiblingBefore(scriptlet));
|
67
|
-
elNode.forEachChild(node => elNode.insertSiblingBefore(node));
|
62
|
+
scriptlets.forEach((scriptlet) => elNode.insertSiblingBefore(scriptlet));
|
63
|
+
elNode.forEachChild((node) => elNode.insertSiblingBefore(node));
|
68
64
|
elNode.detach();
|
69
65
|
};
|
package/src/express.js
CHANGED
package/src/hot-reload.js
CHANGED
@@ -63,7 +63,7 @@ exports.enable = function (options) {
|
|
63
63
|
hotReloadData = template[HOT_RELOAD_KEY] = {
|
64
64
|
modifiedId: modifiedId,
|
65
65
|
latest: template,
|
66
|
-
originals: {}
|
66
|
+
originals: {},
|
67
67
|
};
|
68
68
|
}
|
69
69
|
|
@@ -118,7 +118,7 @@ exports.enable = function (options) {
|
|
118
118
|
originalTemplate,
|
119
119
|
"_"
|
120
120
|
);
|
121
|
-
}
|
121
|
+
},
|
122
122
|
});
|
123
123
|
|
124
124
|
return originalTemplate;
|
@@ -192,7 +192,7 @@ exports.handleFileModified = function (path, options) {
|
|
192
192
|
handleFileModified();
|
193
193
|
// If we taglib was modified then uncache *all* templates so that they will
|
194
194
|
// all be reloaded
|
195
|
-
Object.keys(require.cache).forEach(filename => {
|
195
|
+
Object.keys(require.cache).forEach((filename) => {
|
196
196
|
if (filename.endsWith(".marko") || filename.endsWith(".marko.js")) {
|
197
197
|
delete require.cache[filename];
|
198
198
|
}
|
@@ -140,7 +140,7 @@ function install(options) {
|
|
140
140
|
requireExtensions[MARKO_EXTENSIONS] ||
|
141
141
|
(requireExtensions[MARKO_EXTENSIONS] = []);
|
142
142
|
|
143
|
-
extensions.forEach(extension => {
|
143
|
+
extensions.forEach((extension) => {
|
144
144
|
extension = normalizeExtension(extension);
|
145
145
|
requireExtensions[extension] = markoRequireExtension;
|
146
146
|
requireExtensions[MARKO_EXTENSIONS].push(extension);
|
@@ -14,7 +14,7 @@ var stateToJSONDef = {
|
|
14
14
|
return this;
|
15
15
|
}
|
16
16
|
};
|
17
|
-
function noop() {}
|
17
|
+
function noop() { }
|
18
18
|
|
19
19
|
module.exports = function defineWidget(def, renderer) {
|
20
20
|
def = def.Widget || def;
|
@@ -23,7 +23,7 @@ module.exports = function defineWidget(def, renderer) {
|
|
23
23
|
return def;
|
24
24
|
}
|
25
25
|
|
26
|
-
var ComponentClass = function () {};
|
26
|
+
var ComponentClass = function () { };
|
27
27
|
var proto;
|
28
28
|
var legacyInit;
|
29
29
|
|
@@ -78,47 +78,18 @@ module.exports = function defineWidget(def, renderer) {
|
|
78
78
|
},
|
79
79
|
set: function (newState) {
|
80
80
|
newState = newState || {};
|
81
|
-
// eslint-disable-next-line no-constant-condition
|
82
|
-
if ("MARKO_DEBUG") {
|
83
|
-
if (
|
84
|
-
Object.keys(newState).sort().join("") !==
|
85
|
-
Object.keys((this.___state && this.___state.___raw) || {})
|
86
|
-
.sort()
|
87
|
-
.join("")
|
88
|
-
)
|
89
|
-
complain(
|
90
|
-
"'widget.state = newState' has changed from merging the newState to replacing the old state."
|
91
|
-
);
|
92
|
-
}
|
93
|
-
|
94
81
|
this.setState(newState);
|
95
82
|
}
|
96
83
|
});
|
97
84
|
|
98
85
|
Object.defineProperty(proto, "__document", {
|
99
86
|
get: function () {
|
100
|
-
// eslint-disable-next-line no-constant-condition
|
101
|
-
if ("MARKO_DEBUG") {
|
102
|
-
complain("__document is deprecated");
|
103
|
-
}
|
104
87
|
return this.___host;
|
105
88
|
}
|
106
89
|
});
|
107
90
|
|
108
91
|
Object.defineProperty(proto, "el", {
|
109
92
|
get: function () {
|
110
|
-
// eslint-disable-next-line no-constant-condition
|
111
|
-
if ("MARKO_DEBUG") {
|
112
|
-
if (
|
113
|
-
this.___currentLegacyBindEl !==
|
114
|
-
(this.___rootNode && this.___rootNode.firstChild)
|
115
|
-
) {
|
116
|
-
complain(
|
117
|
-
"this.el no longer returns the `w-bind` element and instead returns the first node in the template. Assign a key to the w-bind element and use getEl(key) instead."
|
118
|
-
);
|
119
|
-
}
|
120
|
-
}
|
121
|
-
|
122
93
|
return this.___currentLegacyBindEl;
|
123
94
|
}
|
124
95
|
});
|
@@ -206,19 +177,7 @@ module.exports = function defineWidget(def, renderer) {
|
|
206
177
|
this.___legacyInit && this.___legacyInit(this.widgetConfig || {});
|
207
178
|
this.___legacyOnRender && this.___legacyOnRender({ firstRender: true });
|
208
179
|
this.___legacyRender = legacyRender;
|
209
|
-
|
210
|
-
// eslint-disable-next-line no-constant-condition
|
211
|
-
if ("MARKO_DEBUG") {
|
212
|
-
Object.defineProperty(el, "__widget", {
|
213
|
-
configurable: true,
|
214
|
-
get: function () {
|
215
|
-
complain("__widget is deprecated");
|
216
|
-
return self;
|
217
|
-
}
|
218
|
-
});
|
219
|
-
} else {
|
220
|
-
el.__widget = this;
|
221
|
-
}
|
180
|
+
el.__widget = this;
|
222
181
|
}
|
223
182
|
} else if (el) {
|
224
183
|
if (prevEl) {
|
@@ -300,17 +259,7 @@ module.exports = function defineWidget(def, renderer) {
|
|
300
259
|
Component.renderSync = renderer.renderSync;
|
301
260
|
}
|
302
261
|
|
303
|
-
|
304
|
-
if ("MARKO_DEBUG") {
|
305
|
-
Object.defineProperty(Component, "_isWidget", {
|
306
|
-
get: function () {
|
307
|
-
complain("_isWidget is deprecated");
|
308
|
-
return true;
|
309
|
-
}
|
310
|
-
});
|
311
|
-
} else {
|
312
|
-
Component._isWidget = true;
|
313
|
-
}
|
262
|
+
Component._isWidget = true;
|
314
263
|
|
315
264
|
return Component;
|
316
265
|
};
|
@@ -3,8 +3,6 @@ var loader = require("@internal/loader");
|
|
3
3
|
var getComponentForEl =
|
4
4
|
require("@internal/components-util").___getComponentForEl;
|
5
5
|
|
6
|
-
var complain = "MARKO_DEBUG" && require("complain");
|
7
|
-
|
8
6
|
// expose legacy
|
9
7
|
require("@internal/components-registry").___legacy = exports;
|
10
8
|
exports.load = function (typeName) {
|
@@ -55,17 +53,9 @@ if (Widget) {
|
|
55
53
|
var RenderResult = require("../../../runtime/RenderResult");
|
56
54
|
|
57
55
|
RenderResult.prototype.getWidget = function () {
|
58
|
-
// eslint-disable-next-line no-constant-condition
|
59
|
-
if ("MARKO_DEBUG") {
|
60
|
-
complain("getWidget is deprecated. use getComponent instead.");
|
61
|
-
}
|
62
56
|
return this.getWidgets()[0];
|
63
57
|
};
|
64
58
|
RenderResult.prototype.getWidgets = function () {
|
65
|
-
// eslint-disable-next-line no-constant-condition
|
66
|
-
if ("MARKO_DEBUG") {
|
67
|
-
complain("getWidgets is deprecated. use getComponents instead.");
|
68
|
-
}
|
69
59
|
return RenderResult.prototype.getComponents
|
70
60
|
.apply(this, arguments)
|
71
61
|
.filter(function (component) {
|
@@ -1,5 +1,4 @@
|
|
1
1
|
var domInsert = require("./dom-insert");
|
2
|
-
var complain = "MARKO_DEBUG" && require("complain");
|
3
2
|
|
4
3
|
function getRootNode(el) {
|
5
4
|
var cur = el;
|
@@ -66,31 +65,19 @@ var proto = (RenderResult.prototype = {
|
|
66
65
|
toString: function () {
|
67
66
|
return this.___out.toString();
|
68
67
|
},
|
69
|
-
document: typeof document === "object" && document
|
68
|
+
document: typeof document === "object" && document,
|
70
69
|
});
|
71
70
|
|
72
71
|
Object.defineProperty(proto, "html", {
|
73
72
|
get: function () {
|
74
|
-
// eslint-disable-next-line no-constant-condition
|
75
|
-
if ("MARKO_DEBUG") {
|
76
|
-
complain(
|
77
|
-
'The "html" property is deprecated. Please use "toString" instead.'
|
78
|
-
);
|
79
|
-
}
|
80
73
|
return this.toString();
|
81
|
-
}
|
74
|
+
},
|
82
75
|
});
|
83
76
|
|
84
77
|
Object.defineProperty(proto, "context", {
|
85
78
|
get: function () {
|
86
|
-
// eslint-disable-next-line no-constant-condition
|
87
|
-
if ("MARKO_DEBUG") {
|
88
|
-
complain(
|
89
|
-
'The "context" property is deprecated. Please use "out" instead.'
|
90
|
-
);
|
91
|
-
}
|
92
79
|
return this.___out;
|
93
|
-
}
|
80
|
+
},
|
94
81
|
});
|
95
82
|
|
96
83
|
// Add all of the following DOM methods to Component.prototype:
|
@@ -1,8 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
/* jshint newcap:false */
|
3
3
|
|
4
|
-
var complain = "MARKO_DEBUG" && require("complain");
|
5
|
-
|
6
4
|
var domInsert = require("../dom-insert");
|
7
5
|
var defaultCreateOut = require("../createOut");
|
8
6
|
var getComponentsContext =
|
@@ -27,7 +25,7 @@ var slice = Array.prototype.slice;
|
|
27
25
|
|
28
26
|
var COMPONENT_SUBSCRIBE_TO_OPTIONS;
|
29
27
|
var NON_COMPONENT_SUBSCRIBE_TO_OPTIONS = {
|
30
|
-
addDestroyListener: false
|
28
|
+
addDestroyListener: false,
|
31
29
|
};
|
32
30
|
|
33
31
|
var emit = EventEmitter.prototype.emit;
|
@@ -254,13 +252,6 @@ Component.prototype = componentProto = {
|
|
254
252
|
var keyedComponentRoot = this.___keyedElements[resolvedKey];
|
255
253
|
|
256
254
|
if (keyedComponentRoot) {
|
257
|
-
// eslint-disable-next-line no-constant-condition
|
258
|
-
if ("MARKO_DEBUG") {
|
259
|
-
complain(
|
260
|
-
"Accessing the elements of a child component using 'component.getEl' is deprecated."
|
261
|
-
);
|
262
|
-
}
|
263
|
-
|
264
255
|
return keyedComponentRoot.nodeType === 1 /** Node.ELEMENT_NODE */
|
265
256
|
? keyedComponentRoot
|
266
257
|
: walkFragments(keyedComponentRoot);
|
@@ -287,12 +278,6 @@ Component.prototype = componentProto = {
|
|
287
278
|
getComponent: function (key, index) {
|
288
279
|
var rootNode = this.___keyedElements[resolveKeyHelper(key, index)];
|
289
280
|
if (/\[\]$/.test(key)) {
|
290
|
-
// eslint-disable-next-line no-constant-condition
|
291
|
-
if ("MARKO_DEBUG") {
|
292
|
-
complain(
|
293
|
-
"A repeated key[] was passed to getComponent. Use a non-repeating key if there is only one of these components."
|
294
|
-
);
|
295
|
-
}
|
296
281
|
rootNode = rootNode && rootNode[Object.keys(rootNode)[0]];
|
297
282
|
}
|
298
283
|
return rootNode && componentsByDOMNode.get(rootNode);
|
@@ -604,12 +589,6 @@ Component.prototype = componentProto = {
|
|
604
589
|
},
|
605
590
|
|
606
591
|
get els() {
|
607
|
-
// eslint-disable-next-line no-constant-condition
|
608
|
-
if ("MARKO_DEBUG") {
|
609
|
-
complain(
|
610
|
-
'The "this.els" attribute is deprecated. Please use "this.getEls(key)" instead.'
|
611
|
-
);
|
612
|
-
}
|
613
592
|
return (this.___rootNode ? this.___rootNode.nodes : []).filter(function (
|
614
593
|
el
|
615
594
|
) {
|
@@ -641,7 +620,7 @@ Component.prototype = componentProto = {
|
|
641
620
|
___emitDestroy() {
|
642
621
|
this.onDestroy && this.onDestroy();
|
643
622
|
this.___emit("destroy");
|
644
|
-
}
|
623
|
+
},
|
645
624
|
};
|
646
625
|
|
647
626
|
componentProto.elId = componentProto.getElId;
|
@@ -1,5 +1,4 @@
|
|
1
1
|
"use strict";
|
2
|
-
var complain = "MARKO_DEBUG" && require("complain");
|
3
2
|
var w10Noop = require("warp10/constants").NOOP;
|
4
3
|
var componentUtil = require("@internal/components-util");
|
5
4
|
var attachBubblingEvent = componentUtil.___attachBubblingEvent;
|
@@ -53,11 +52,6 @@ ComponentDef.prototype = {
|
|
53
52
|
return id;
|
54
53
|
} else {
|
55
54
|
if (typeof nestedId !== "string") {
|
56
|
-
// eslint-disable-next-line no-constant-condition
|
57
|
-
if ("MARKO_DEBUG") {
|
58
|
-
complain("Using non strings as keys is deprecated.");
|
59
|
-
}
|
60
|
-
|
61
55
|
nestedId = String(nestedId);
|
62
56
|
}
|
63
57
|
|
@@ -83,7 +77,7 @@ ComponentDef.prototype = {
|
|
83
77
|
|
84
78
|
get ___type() {
|
85
79
|
return this.___component.___type;
|
86
|
-
}
|
80
|
+
},
|
87
81
|
};
|
88
82
|
|
89
83
|
ComponentDef.prototype.nk = ComponentDef.prototype.___nextKey;
|
@@ -162,7 +156,7 @@ ComponentDef.___deserialize = function (o, types, global, registry) {
|
|
162
156
|
id: id,
|
163
157
|
___component: component,
|
164
158
|
___domEvents: extra.d,
|
165
|
-
___flags: extra.f || 0
|
159
|
+
___flags: extra.f || 0,
|
166
160
|
};
|
167
161
|
};
|
168
162
|
|
@@ -1,5 +1,4 @@
|
|
1
1
|
"use strict";
|
2
|
-
var complain = "MARKO_DEBUG" && require("complain");
|
3
2
|
|
4
3
|
class ServerComponent {
|
5
4
|
constructor(id, input, out, typeName, customEvents, scope) {
|
@@ -45,11 +44,6 @@ class ServerComponent {
|
|
45
44
|
return id;
|
46
45
|
} else {
|
47
46
|
if (typeof nestedId !== "string") {
|
48
|
-
// eslint-disable-next-line no-constant-condition
|
49
|
-
if ("MARKO_DEBUG") {
|
50
|
-
complain("Using non strings as keys is deprecated.");
|
51
|
-
}
|
52
|
-
|
53
47
|
nestedId = String(nestedId);
|
54
48
|
}
|
55
49
|
|
@@ -9,7 +9,7 @@ function ensure(state, propertyName) {
|
|
9
9
|
},
|
10
10
|
set: function (value) {
|
11
11
|
this.___set(propertyName, value, false /* ensure:false */);
|
12
|
-
}
|
12
|
+
},
|
13
13
|
});
|
14
14
|
}
|
15
15
|
}
|
@@ -99,7 +99,7 @@ State.prototype = {
|
|
99
99
|
},
|
100
100
|
toJSON: function () {
|
101
101
|
return this.___raw;
|
102
|
-
}
|
102
|
+
},
|
103
103
|
};
|
104
104
|
|
105
105
|
module.exports = State;
|
@@ -8,11 +8,6 @@ var defineRenderer;
|
|
8
8
|
var defineWidget;
|
9
9
|
|
10
10
|
module.exports = function defineComponent(def) {
|
11
|
-
// eslint-disable-next-line no-constant-condition
|
12
|
-
if ("MARKO_DEBUG") {
|
13
|
-
require("complain")("defineComponent is deprecated");
|
14
|
-
}
|
15
|
-
|
16
11
|
if (def.___isComponent) {
|
17
12
|
return def;
|
18
13
|
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
var complain = "MARKO_DEBUG" && require("complain");
|
2
1
|
var makeRenderable = require("../../renderable");
|
3
2
|
var getComponentsContext =
|
4
3
|
require("../ComponentsContext").___getComponentsContext;
|
@@ -10,11 +9,6 @@ var resolveComponentKey = modernRenderer.___resolveComponentKey;
|
|
10
9
|
module.exports = function defineRenderer(renderingLogic) {
|
11
10
|
var renderer = renderingLogic.renderer;
|
12
11
|
|
13
|
-
// eslint-disable-next-line no-constant-condition
|
14
|
-
if ("MARKO_DEBUG") {
|
15
|
-
require("complain")("defineRenderer is deprecated");
|
16
|
-
}
|
17
|
-
|
18
12
|
if (renderer && renderer.___isRenderer) {
|
19
13
|
return renderer;
|
20
14
|
}
|
@@ -128,16 +122,6 @@ module.exports = function defineRenderer(renderingLogic) {
|
|
128
122
|
// widget config will be serialized.
|
129
123
|
widgetConfig = getWidgetConfig(newProps, out);
|
130
124
|
}
|
131
|
-
// eslint-disable-next-line no-constant-condition
|
132
|
-
if ("MARKO_DEBUG") {
|
133
|
-
if (widgetState && "widgetState" in templateData) {
|
134
|
-
complain("Passing widgetState as input is deprecated.");
|
135
|
-
}
|
136
|
-
|
137
|
-
if (widgetConfig && "widgetConfig" in templateData) {
|
138
|
-
complain("Passing widgetConfig as input is deprecated.");
|
139
|
-
}
|
140
|
-
}
|
141
125
|
|
142
126
|
templateData.widgetProps = newProps;
|
143
127
|
widgetBody && (templateData.renderBody = widgetBody);
|
@@ -153,6 +137,7 @@ module.exports = function defineRenderer(renderingLogic) {
|
|
153
137
|
renderer.template = template;
|
154
138
|
|
155
139
|
makeRenderable(renderer, renderer);
|
140
|
+
renderer.render = renderer.render.bind(this);
|
156
141
|
|
157
142
|
return renderer;
|
158
143
|
};
|