marko 4.26.3 → 4.27.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/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
|
@@ -11,7 +11,7 @@ const CUSTOM_TAG_KEY = Symbol("CustomTag");
|
|
|
11
11
|
function getNestedVariables(elNode, tagDef, codegen) {
|
|
12
12
|
let variableNames = [];
|
|
13
13
|
if (tagDef.forEachVariable) {
|
|
14
|
-
tagDef.forEachVariable(nestedVar => {
|
|
14
|
+
tagDef.forEachVariable((nestedVar) => {
|
|
15
15
|
let varName;
|
|
16
16
|
if (nestedVar.nameFromAttribute) {
|
|
17
17
|
let possibleNameAttributes =
|
|
@@ -67,7 +67,7 @@ function getNestedVariables(elNode, tagDef, codegen) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
if (elNode.params.length) {
|
|
70
|
-
elNode.params.forEach(variable => {
|
|
70
|
+
elNode.params.forEach((variable) => {
|
|
71
71
|
if (typeof variable === "string") {
|
|
72
72
|
variable = codegen.builder.identifier(variable);
|
|
73
73
|
}
|
|
@@ -83,7 +83,7 @@ function getAllowedAttributesString(tagName, context) {
|
|
|
83
83
|
|
|
84
84
|
let tagDef = context.taglibLookup.getTag(tagName);
|
|
85
85
|
if (tagDef) {
|
|
86
|
-
tagDef.forEachAttribute(attrDef => {
|
|
86
|
+
tagDef.forEachAttribute((attrDef) => {
|
|
87
87
|
attrNames.push(attrDef.name);
|
|
88
88
|
});
|
|
89
89
|
|
|
@@ -121,7 +121,7 @@ function checkIfNestedTagCanBeAddedDirectlyToInput(nestedTag, parentCustomTag) {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
function processDirectlyNestedTags(node, codegen) {
|
|
124
|
-
node.forEachChild(child => {
|
|
124
|
+
node.forEachChild((child) => {
|
|
125
125
|
if (child.type === "CustomTag") {
|
|
126
126
|
let customTag = child;
|
|
127
127
|
|
|
@@ -367,7 +367,7 @@ class CustomTag extends HtmlElement {
|
|
|
367
367
|
}
|
|
368
368
|
attrProps = builder.objectExpression(explicitAttrs);
|
|
369
369
|
if (computedAttrs) {
|
|
370
|
-
computedAttrs.forEach(prop => attrProps.properties.push(prop));
|
|
370
|
+
computedAttrs.forEach((prop) => attrProps.properties.push(prop));
|
|
371
371
|
}
|
|
372
372
|
attrs.push(attrProps);
|
|
373
373
|
}
|
|
@@ -444,9 +444,9 @@ class CustomTag extends HtmlElement {
|
|
|
444
444
|
name: fullyQualifiedName,
|
|
445
445
|
attributes: {
|
|
446
446
|
"*": {
|
|
447
|
-
targetProperty: null
|
|
448
|
-
}
|
|
449
|
-
}
|
|
447
|
+
targetProperty: null,
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
450
|
},
|
|
451
451
|
context.filename
|
|
452
452
|
);
|
|
@@ -552,13 +552,13 @@ class CustomTag extends HtmlElement {
|
|
|
552
552
|
);
|
|
553
553
|
|
|
554
554
|
let loadTag = builder.functionCall(context.helper("loadTag"), [
|
|
555
|
-
templateVar
|
|
555
|
+
templateVar,
|
|
556
556
|
]);
|
|
557
557
|
let tagVar = codegen.addStaticVar(tagVarName, loadTag);
|
|
558
558
|
|
|
559
559
|
renderTagNode = this.generateRenderTagCode(codegen, tagVar, [
|
|
560
560
|
inputProps,
|
|
561
|
-
builder.identifierOut()
|
|
561
|
+
builder.identifierOut(),
|
|
562
562
|
]);
|
|
563
563
|
} else {
|
|
564
564
|
if (rendererRequirePath) {
|
|
@@ -602,18 +602,18 @@ class CustomTag extends HtmlElement {
|
|
|
602
602
|
argumentNode,
|
|
603
603
|
properties
|
|
604
604
|
? builder.objectExpression(
|
|
605
|
-
Object.keys(properties).map(propName => {
|
|
605
|
+
Object.keys(properties).map((propName) => {
|
|
606
606
|
return builder.property(
|
|
607
607
|
builder.literal(propName),
|
|
608
608
|
properties[propName]
|
|
609
609
|
);
|
|
610
610
|
})
|
|
611
611
|
)
|
|
612
|
-
: builder.literalNull()
|
|
612
|
+
: builder.literalNull(),
|
|
613
613
|
];
|
|
614
614
|
} else {
|
|
615
615
|
loadTag = builder.functionCall(context.helper("loadTag"), [
|
|
616
|
-
requireRendererFunctionCall // The first param is the renderer
|
|
616
|
+
requireRendererFunctionCall, // The first param is the renderer
|
|
617
617
|
]);
|
|
618
618
|
|
|
619
619
|
tagArgs = [inputProps, builder.identifierOut()];
|
|
@@ -797,7 +797,7 @@ class CustomTag extends HtmlElement {
|
|
|
797
797
|
let additionalAttrs = renderBody &&
|
|
798
798
|
!isDynamicTag && {
|
|
799
799
|
[(tagDef.bodyFunction && tagDef.bodyFunction.name) || "renderBody"]:
|
|
800
|
-
renderBody
|
|
800
|
+
renderBody,
|
|
801
801
|
};
|
|
802
802
|
let inputProps = this.buildInputProps(codegen, additionalAttrs);
|
|
803
803
|
let renderTagNode = this.generateRenderNode(
|
|
@@ -13,14 +13,14 @@ class Declaration extends Node {
|
|
|
13
13
|
return [
|
|
14
14
|
builder.htmlLiteral("<?"),
|
|
15
15
|
codegen.generateCode(builder.text(this.declaration)),
|
|
16
|
-
builder.htmlLiteral("?>")
|
|
16
|
+
builder.htmlLiteral("?>"),
|
|
17
17
|
];
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
toJSON() {
|
|
21
21
|
return {
|
|
22
22
|
type: this.type,
|
|
23
|
-
value: this.value
|
|
23
|
+
value: this.value,
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -13,7 +13,7 @@ class DocumentType extends Node {
|
|
|
13
13
|
return [
|
|
14
14
|
builder.htmlLiteral("<!"),
|
|
15
15
|
builder.html(codegen.generateCode(this.documentType)),
|
|
16
|
-
builder.htmlLiteral(">")
|
|
16
|
+
builder.htmlLiteral(">"),
|
|
17
17
|
];
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -24,7 +24,7 @@ class DocumentType extends Node {
|
|
|
24
24
|
toJSON() {
|
|
25
25
|
return {
|
|
26
26
|
type: this.type,
|
|
27
|
-
value: this.documentType
|
|
27
|
+
value: this.documentType,
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -19,19 +19,19 @@ function flattenAttrConcats(node) {
|
|
|
19
19
|
if (isString) {
|
|
20
20
|
return {
|
|
21
21
|
isString: true,
|
|
22
|
-
concats: left.concats.concat(right.concats)
|
|
22
|
+
concats: left.concats.concat(right.concats),
|
|
23
23
|
};
|
|
24
24
|
} else {
|
|
25
25
|
return {
|
|
26
26
|
isString: false,
|
|
27
|
-
concats: [node]
|
|
27
|
+
concats: [node],
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
return {
|
|
33
33
|
isString: isStringLiteral(node) || node.type === "AttributePlaceholder",
|
|
34
|
-
concats: [node]
|
|
34
|
+
concats: [node],
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -125,7 +125,7 @@ module.exports = function generateCode(node, codegen) {
|
|
|
125
125
|
return [
|
|
126
126
|
builder.htmlLiteral(" " + name + "("),
|
|
127
127
|
builder.htmlLiteral(argument),
|
|
128
|
-
builder.htmlLiteral(")")
|
|
128
|
+
builder.htmlLiteral(")"),
|
|
129
129
|
];
|
|
130
130
|
} else {
|
|
131
131
|
// Attribute with no value is a boolean attribute
|
|
@@ -25,11 +25,11 @@ module.exports = function generateCode(node, codegen, vdomUtil) {
|
|
|
25
25
|
} else {
|
|
26
26
|
if (name === "class") {
|
|
27
27
|
node.value = builder.functionCall(context.helper("classValue"), [
|
|
28
|
-
attrValue
|
|
28
|
+
attrValue,
|
|
29
29
|
]);
|
|
30
30
|
} else if (name === "style") {
|
|
31
31
|
node.value = builder.functionCall(context.helper("styleValue"), [
|
|
32
|
-
attrValue
|
|
32
|
+
attrValue,
|
|
33
33
|
]);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -96,7 +96,7 @@ class HtmlAttributeCollection {
|
|
|
96
96
|
} else {
|
|
97
97
|
this.addAttribute({
|
|
98
98
|
name: name,
|
|
99
|
-
value: value
|
|
99
|
+
value: value,
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -119,7 +119,7 @@ class HtmlAttributeCollection {
|
|
|
119
119
|
|
|
120
120
|
if (attributes) {
|
|
121
121
|
if (Array.isArray(attributes)) {
|
|
122
|
-
attributes.forEach(attr => {
|
|
122
|
+
attributes.forEach((attr) => {
|
|
123
123
|
this.addAttribute(attr);
|
|
124
124
|
});
|
|
125
125
|
} else {
|
|
@@ -138,7 +138,7 @@ class HtmlAttributeCollection {
|
|
|
138
138
|
} else {
|
|
139
139
|
attrDef = {
|
|
140
140
|
name: attrName,
|
|
141
|
-
value: attrValue
|
|
141
|
+
value: attrValue,
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -29,7 +29,7 @@ class StartTag extends Node {
|
|
|
29
29
|
if (this.includeDataMarko) {
|
|
30
30
|
var dataMarkoArgs = [
|
|
31
31
|
builder.identifier("out"),
|
|
32
|
-
builder.identifier("__component")
|
|
32
|
+
builder.identifier("__component"),
|
|
33
33
|
];
|
|
34
34
|
|
|
35
35
|
var properties = this.properties;
|
|
@@ -39,7 +39,7 @@ class StartTag extends Node {
|
|
|
39
39
|
if (propKeys.length) {
|
|
40
40
|
dataMarkoArgs.push(
|
|
41
41
|
builder.objectExpression(
|
|
42
|
-
propKeys.map(propName => {
|
|
42
|
+
propKeys.map((propName) => {
|
|
43
43
|
return builder.property(
|
|
44
44
|
builder.literal(propName),
|
|
45
45
|
properties[propName]
|
|
@@ -68,7 +68,7 @@ class StartTag extends Node {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
if (attributes) {
|
|
71
|
-
var hasSpread = attributes.find(attr => attr.spread);
|
|
71
|
+
var hasSpread = attributes.find((attr) => attr.spread);
|
|
72
72
|
if (!hasSpread) {
|
|
73
73
|
for (let i = 0; i < attributes.length; i++) {
|
|
74
74
|
let attr = attributes[i];
|
|
@@ -56,7 +56,7 @@ module.exports = function generateCode(node, codegen) {
|
|
|
56
56
|
context.meta.legacy ||
|
|
57
57
|
context.isFlagSet("legacyWidgetAttrsWithoutBind") ||
|
|
58
58
|
!context.isStatefulComponent ||
|
|
59
|
-
isPreserved(node)
|
|
59
|
+
isPreserved(node),
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
var endTag;
|
|
@@ -64,7 +64,7 @@ module.exports = function generateCode(node, codegen) {
|
|
|
64
64
|
|
|
65
65
|
if (!openTagOnly) {
|
|
66
66
|
endTag = new EndTag({
|
|
67
|
-
tagName: tagName
|
|
67
|
+
tagName: tagName,
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -81,7 +81,7 @@ module.exports = function generateCode(node, codegen) {
|
|
|
81
81
|
[
|
|
82
82
|
builder.concat(builder.literal("f_"), node.key),
|
|
83
83
|
builder.identifier("component"),
|
|
84
|
-
builder.literal(1)
|
|
84
|
+
builder.literal(1),
|
|
85
85
|
]
|
|
86
86
|
)
|
|
87
87
|
)
|
|
@@ -108,11 +108,11 @@ module.exports = function generateCode(node, codegen) {
|
|
|
108
108
|
codegen.context.helper("propsForPreviousNode"),
|
|
109
109
|
[
|
|
110
110
|
builder.objectExpression(
|
|
111
|
-
attributes.map(attr =>
|
|
111
|
+
attributes.map((attr) =>
|
|
112
112
|
builder.property(builder.identifier(attr.name), attr.value)
|
|
113
113
|
)
|
|
114
114
|
),
|
|
115
|
-
builder.identifier("out")
|
|
115
|
+
builder.identifier("out"),
|
|
116
116
|
]
|
|
117
117
|
);
|
|
118
118
|
}
|
|
@@ -49,7 +49,7 @@ module.exports = function (node, codegen) {
|
|
|
49
49
|
|
|
50
50
|
if (properties) {
|
|
51
51
|
Object.keys(properties).forEach(
|
|
52
|
-
key => (properties[key] = codegen.generateCode(properties[key]))
|
|
52
|
+
(key) => (properties[key] = codegen.generateCode(properties[key]))
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -100,7 +100,7 @@ module.exports = function (node, codegen) {
|
|
|
100
100
|
isHtmlOnly,
|
|
101
101
|
nextConstId,
|
|
102
102
|
runtimeFlags,
|
|
103
|
-
isAutoKeyed
|
|
103
|
+
isAutoKeyed,
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
if (isHtmlOnly) {
|
|
@@ -120,7 +120,7 @@ module.exports = function (node, codegen) {
|
|
|
120
120
|
),
|
|
121
121
|
[
|
|
122
122
|
builder.concat(builder.literal("f_"), node.key),
|
|
123
|
-
builder.identifier("component")
|
|
123
|
+
builder.identifier("component"),
|
|
124
124
|
]
|
|
125
125
|
)
|
|
126
126
|
)
|
package/src/compiler/ast/If.js
CHANGED
|
@@ -26,7 +26,7 @@ class If extends Node {
|
|
|
26
26
|
// correctly.
|
|
27
27
|
let previous = this;
|
|
28
28
|
let whitespaceNodes = [];
|
|
29
|
-
this.forEachNextSibling(curNode => {
|
|
29
|
+
this.forEachNextSibling((curNode) => {
|
|
30
30
|
if (curNode.type === "Else") {
|
|
31
31
|
curNode.detach();
|
|
32
32
|
if (whitespaceNodes.length) {
|
package/src/compiler/ast/Node.js
CHANGED
|
@@ -130,7 +130,7 @@ class Node {
|
|
|
130
130
|
|
|
131
131
|
appendChildren(nodes) {
|
|
132
132
|
ok(this.body, "Node does not support child nodes: " + this);
|
|
133
|
-
nodes.forEach(node => {
|
|
133
|
+
nodes.forEach((node) => {
|
|
134
134
|
this.body.appendChild(node);
|
|
135
135
|
});
|
|
136
136
|
}
|
|
@@ -288,7 +288,7 @@ class Node {
|
|
|
288
288
|
get bodyText() {
|
|
289
289
|
var bodyText = "";
|
|
290
290
|
|
|
291
|
-
this.forEachChild(child => {
|
|
291
|
+
this.forEachChild((child) => {
|
|
292
292
|
if (child.type === "Text") {
|
|
293
293
|
var childText = child.argument;
|
|
294
294
|
if (childText && childText.type === "Literal") {
|
|
@@ -361,7 +361,7 @@ class Node {
|
|
|
361
361
|
var currentTextLiteral = null;
|
|
362
362
|
var literalTextNodes = [];
|
|
363
363
|
|
|
364
|
-
body.forEach(curChild => {
|
|
364
|
+
body.forEach((curChild) => {
|
|
365
365
|
if (curChild.noOutput) {
|
|
366
366
|
// Skip over AST nodes that produce no HTML output
|
|
367
367
|
return;
|
|
@@ -426,7 +426,7 @@ class Node {
|
|
|
426
426
|
literalTextNodes.forEach(trim);
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
-
literalTextNodes.forEach(textNode => {
|
|
429
|
+
literalTextNodes.forEach((textNode) => {
|
|
430
430
|
if (textNode.argument.value === "") {
|
|
431
431
|
textNode.detach();
|
|
432
432
|
}
|
|
@@ -60,7 +60,7 @@ class ObjectExpression extends Node {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
if (Array.isArray(props)) {
|
|
63
|
-
props.forEach(prop => {
|
|
63
|
+
props.forEach((prop) => {
|
|
64
64
|
this.addProperty(prop);
|
|
65
65
|
});
|
|
66
66
|
}
|
|
@@ -91,7 +91,7 @@ class ObjectExpression extends Node {
|
|
|
91
91
|
toJSON() {
|
|
92
92
|
return {
|
|
93
93
|
type: "ObjectExpression",
|
|
94
|
-
properties: this.properties
|
|
94
|
+
properties: this.properties,
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -56,7 +56,7 @@ class TemplateLiteral extends Node {
|
|
|
56
56
|
|
|
57
57
|
function escapeQuasi(quasi, quote) {
|
|
58
58
|
if (!quasi) return "";
|
|
59
|
-
return quasi.replace(/["`\\\n\r\u2028\u2029]|\${/g, match => {
|
|
59
|
+
return quasi.replace(/["`\\\n\r\u2028\u2029]|\${/g, (match) => {
|
|
60
60
|
switch (match) {
|
|
61
61
|
case quote:
|
|
62
62
|
case "${":
|
|
@@ -6,7 +6,7 @@ function createVarsArray(vars) {
|
|
|
6
6
|
var varInit = vars[varName];
|
|
7
7
|
return {
|
|
8
8
|
id: varName,
|
|
9
|
-
init: varInit
|
|
9
|
+
init: varInit,
|
|
10
10
|
};
|
|
11
11
|
});
|
|
12
12
|
}
|
|
@@ -115,7 +115,7 @@ class TemplateRoot extends Node {
|
|
|
115
115
|
context,
|
|
116
116
|
templateVar,
|
|
117
117
|
templateRendererMember,
|
|
118
|
-
renderFunctionVar
|
|
118
|
+
renderFunctionVar,
|
|
119
119
|
};
|
|
120
120
|
|
|
121
121
|
assignRenderCode = this.generateAssignRenderCode(eventArgs);
|
|
@@ -152,7 +152,7 @@ class TemplateRoot extends Node {
|
|
|
152
152
|
toJSON() {
|
|
153
153
|
return {
|
|
154
154
|
type: this.type,
|
|
155
|
-
body: this.body
|
|
155
|
+
body: this.body,
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
158
|
|
package/src/compiler/config.js
CHANGED
package/src/compiler/index.js
CHANGED
|
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "defaultOptions", {
|
|
|
18
18
|
return globalConfig;
|
|
19
19
|
},
|
|
20
20
|
enumerable: true,
|
|
21
|
-
configurable: false
|
|
21
|
+
configurable: false,
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
Object.defineProperty(exports, "config", {
|
|
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "config", {
|
|
|
26
26
|
return globalConfig;
|
|
27
27
|
},
|
|
28
28
|
enumerable: true,
|
|
29
|
-
configurable: false
|
|
29
|
+
configurable: false,
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
var defaultParser = new Parser(new HtmlJsParser());
|
|
@@ -42,7 +42,7 @@ function configure(newConfig) {
|
|
|
42
42
|
|
|
43
43
|
var defaultCompiler = new Compiler({
|
|
44
44
|
parser: defaultParser,
|
|
45
|
-
builder: Builder.DEFAULT_BUILDER
|
|
45
|
+
builder: Builder.DEFAULT_BUILDER,
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
function createBuilder(options) {
|
|
@@ -123,7 +123,7 @@ function compileForBrowser(src, filename, options, callback) {
|
|
|
123
123
|
output: "vdom",
|
|
124
124
|
meta: false,
|
|
125
125
|
browser: true,
|
|
126
|
-
sourceOnly: false
|
|
126
|
+
sourceOnly: false,
|
|
127
127
|
},
|
|
128
128
|
options
|
|
129
129
|
);
|
|
@@ -191,7 +191,7 @@ function parseRaw(templateSrc, filename, options) {
|
|
|
191
191
|
Object.assign(
|
|
192
192
|
{
|
|
193
193
|
raw: true,
|
|
194
|
-
ignorePlaceholders: true
|
|
194
|
+
ignorePlaceholders: true,
|
|
195
195
|
},
|
|
196
196
|
options
|
|
197
197
|
)
|
package/src/compiler/modules.js
CHANGED
|
@@ -7,7 +7,7 @@ var deresolve = require("./util/deresolve");
|
|
|
7
7
|
const deresolveOptions = {
|
|
8
8
|
shouldRemoveExt(ext) {
|
|
9
9
|
return ext === ".js" || ext === ".json" || ext === ".es6";
|
|
10
|
-
}
|
|
10
|
+
},
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
// This allows us to swap out a different implementation in the browser...
|
|
@@ -28,7 +28,7 @@ var helpers = {
|
|
|
28
28
|
|
|
29
29
|
deresolve: function (targetFilename, from) {
|
|
30
30
|
return deresolve(targetFilename, from, deresolveOptions);
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
module.exports = helpers;
|
|
@@ -29,7 +29,7 @@ class UniqueVars {
|
|
|
29
29
|
|
|
30
30
|
let newEntry = {
|
|
31
31
|
name: name + ++entry.counter,
|
|
32
|
-
value: value
|
|
32
|
+
value: value,
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
entry.vars.push(newEntry);
|
|
@@ -39,10 +39,10 @@ class UniqueVars {
|
|
|
39
39
|
vars: [
|
|
40
40
|
{
|
|
41
41
|
name: name,
|
|
42
|
-
value: value
|
|
43
|
-
}
|
|
42
|
+
value: value,
|
|
43
|
+
},
|
|
44
44
|
],
|
|
45
|
-
counter: 1
|
|
45
|
+
counter: 1,
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
this.vars[name] = entry;
|
|
@@ -140,7 +140,7 @@ module.exports = function convertRawJavaScriptAst(ast, builder) {
|
|
|
140
140
|
return null;
|
|
141
141
|
}
|
|
142
142
|
case "TemplateLiteral": {
|
|
143
|
-
const quasis = node.quasis.map(q => q.value.cooked);
|
|
143
|
+
const quasis = node.quasis.map((q) => q.value.cooked);
|
|
144
144
|
const expressions = convert(node.expressions);
|
|
145
145
|
if (expressions) {
|
|
146
146
|
return builder.templateLiteral(quasis, expressions);
|