marko 4.25.0 → 4.26.0
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/markoc.js +18 -18
- package/dist/compiler/CompileContext.js +3 -8
- package/dist/core-tags/components/init-components-tag.js +1 -52
- package/dist/core-tags/components/package.json +1 -3
- package/dist/core-tags/components/preferred-script-location-tag.js +2 -2
- package/dist/core-tags/components/preserve-tag.js +1 -27
- package/dist/core-tags/core/await/AsyncValue.js +20 -20
- package/dist/core-tags/core/await/renderer.js +11 -12
- package/dist/core-tags/core/await/reorderer-renderer.js +11 -6
- package/dist/index.js +1 -39
- package/dist/node-require/index.js +11 -0
- package/dist/node_modules/@internal/components-beginComponent/index-browser.js +12 -0
- package/dist/{runtime/components/beginComponent.js → node_modules/@internal/components-beginComponent/index.js} +14 -14
- package/dist/node_modules/@internal/components-beginComponent/package.json +11 -0
- package/dist/{runtime/components/legacy/defineWidget-legacy-browser.js → node_modules/@internal/components-define-widget-legacy/index-browser.js} +47 -47
- package/dist/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
- package/dist/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
- package/dist/node_modules/@internal/components-endComponent/index.js +11 -0
- package/dist/node_modules/@internal/components-endComponent/package.json +11 -0
- package/dist/node_modules/@internal/components-entry/index-browser.js +9 -0
- package/dist/node_modules/@internal/components-entry/index.js +285 -0
- package/dist/node_modules/@internal/components-entry/package.json +11 -0
- package/dist/{runtime/components/legacy → node_modules/@internal/components-entry-legacy}/index-browser.js +14 -15
- package/dist/node_modules/@internal/components-entry-legacy/index.js +14 -0
- package/dist/node_modules/@internal/components-entry-legacy/package.json +11 -0
- package/dist/{runtime/components/init-components-browser.js → node_modules/@internal/components-registry/index-browser.js} +180 -79
- package/dist/node_modules/@internal/components-registry/index.js +34 -0
- package/dist/node_modules/@internal/components-registry/package.json +11 -0
- package/dist/{runtime/components/util-browser.js → node_modules/@internal/components-util/index-browser.js} +23 -24
- package/dist/{runtime/components/util.js → node_modules/@internal/components-util/index.js} +10 -12
- package/dist/node_modules/@internal/components-util/package.json +11 -0
- package/dist/node_modules/@internal/create-readable/index-browser.js +25 -0
- package/dist/node_modules/@internal/create-readable/index.js +52 -0
- package/dist/node_modules/@internal/create-readable/package.json +11 -0
- package/dist/node_modules/@internal/init-components-tag/index.js +52 -0
- package/dist/node_modules/@internal/init-components-tag/package.json +11 -0
- package/dist/{loader/index-default.js → node_modules/@internal/loader/index.js} +1 -1
- package/dist/node_modules/@internal/loader/package.json +11 -0
- package/dist/{core-tags/components/preserve-tag-browser.js → node_modules/@internal/preserve-tag/index-browser.js} +8 -8
- package/dist/node_modules/@internal/preserve-tag/index.js +27 -0
- package/dist/node_modules/@internal/preserve-tag/package.json +11 -0
- package/dist/node_modules/@internal/set-immediate/index-browser.js +17 -0
- package/dist/node_modules/@internal/set-immediate/index-worker.js +2 -0
- package/dist/node_modules/@internal/set-immediate/index.js +2 -0
- package/dist/node_modules/@internal/set-immediate/package.json +11 -0
- package/dist/runtime/RenderResult.js +24 -19
- package/dist/runtime/components/Component.js +154 -151
- package/dist/runtime/components/ComponentDef.js +28 -28
- package/dist/runtime/components/ComponentsContext.js +19 -19
- package/dist/runtime/components/GlobalComponentsContext.js +4 -4
- package/dist/runtime/components/KeySequence.js +3 -3
- package/dist/runtime/components/ServerComponent.js +13 -13
- package/dist/runtime/components/State.js +28 -28
- package/dist/runtime/components/attach-detach.js +9 -9
- package/dist/runtime/components/defineComponent.js +5 -5
- package/dist/runtime/components/dom-data.js +6 -6
- package/dist/runtime/components/event-delegation.js +15 -16
- package/dist/runtime/components/index.js +1 -285
- package/dist/runtime/components/legacy/browser.json +1 -1
- package/dist/runtime/components/legacy/defineComponent-legacy.js +1 -1
- package/dist/runtime/components/legacy/defineRenderer-legacy.js +18 -19
- package/dist/runtime/components/legacy/defineWidget-legacy.js +1 -18
- package/dist/runtime/components/legacy/dependencies/html.js +1 -1
- package/dist/runtime/components/legacy/dependencies/index.js +9 -9
- package/dist/runtime/components/legacy/helper-getWidgetFromOut.js +3 -3
- package/dist/runtime/components/legacy/index.js +1 -14
- package/dist/runtime/components/legacy/renderer-legacy.js +43 -43
- package/dist/runtime/components/registry.js +1 -34
- package/dist/runtime/components/renderer.js +38 -38
- package/dist/runtime/components/update-manager.js +10 -10
- package/dist/runtime/createOut.js +1 -1
- package/dist/runtime/dom-insert.js +6 -6
- package/dist/runtime/helpers/_change-case.js +2 -2
- package/dist/runtime/helpers/assign.js +3 -2
- package/dist/runtime/helpers/dynamic-tag.js +14 -16
- package/dist/runtime/helpers/load-template.js +1 -1
- package/dist/runtime/helpers/merge.js +3 -1
- package/dist/runtime/helpers/style-value.js +2 -2
- package/dist/runtime/html/AsyncStream.js +61 -52
- package/dist/runtime/html/BufferedWriter.js +5 -1
- package/dist/runtime/html/StringWriter.js +7 -3
- package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
- package/dist/runtime/html/helpers/attr.js +4 -4
- package/dist/runtime/html/helpers/attrs.js +3 -3
- package/dist/runtime/html/helpers/data-marko.js +4 -6
- package/dist/runtime/html/helpers/escape-quotes.js +2 -2
- package/dist/runtime/html/helpers/escape-xml.js +1 -1
- package/dist/runtime/html/helpers/props-script.js +1 -1
- package/dist/runtime/html/index.js +15 -12
- package/dist/runtime/renderable.js +5 -5
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +102 -103
- package/dist/runtime/vdom/VComment.js +7 -7
- package/dist/runtime/vdom/VComponent.js +5 -5
- package/dist/runtime/vdom/VDocumentFragment.js +8 -8
- package/dist/runtime/vdom/VElement.js +55 -54
- package/dist/runtime/vdom/VFragment.js +9 -9
- package/dist/runtime/vdom/VNode.js +30 -30
- package/dist/runtime/vdom/VText.js +7 -7
- package/dist/runtime/vdom/helpers/v-element.js +1 -1
- package/dist/runtime/vdom/helpers/v-text.js +1 -1
- package/dist/runtime/vdom/index.js +12 -22
- package/dist/runtime/vdom/morphdom/fragment.js +5 -5
- package/dist/runtime/vdom/morphdom/helpers.js +3 -3
- package/dist/runtime/vdom/morphdom/index.js +72 -68
- package/dist/runtime/vdom/morphdom/specialElHandlers.js +8 -8
- package/dist/runtime/vdom/preserve-attrs.js +1 -1
- package/dist/runtime/vdom/vdom.js +19 -21
- package/docs/body-content.md +2 -2
- package/docs/class-components.md +3 -3
- package/docs/express.md +1 -1
- package/docs/lasso.md +3 -6
- package/docs/marko-v4.md +5 -5
- package/docs/redux.md +1 -1
- package/docs/server-side-rendering.md +2 -2
- package/docs/why-is-marko-fast.md +2 -10
- package/package.json +1 -1
- package/src/browser-refresh.js +2 -2
- package/src/compiler/CodeWriter.js +1 -3
- package/src/compiler/CompileContext.js +3 -8
- package/src/compiler/Compiler.js +4 -4
- package/src/compiler/HtmlJsParser.js +1 -1
- package/src/compiler/Migrator.js +1 -1
- package/src/compiler/Parser.js +3 -3
- package/src/compiler/ast/CustomTag.js +9 -11
- package/src/compiler/ast/HtmlAttribute/html/generateCode.js +2 -2
- package/src/compiler/ast/HtmlAttribute/index.js +1 -1
- package/src/compiler/ast/HtmlElement/vdom/HtmlElementVDOM.js +1 -1
- package/src/compiler/ast/HtmlElement/vdom/generateCode.js +1 -1
- package/src/compiler/ast/TemplateRoot.js +1 -1
- package/src/compiler/ast/Text/html/generateCode.js +3 -3
- package/src/compiler/ast/Text/vdom/generateCode.js +1 -1
- package/src/compiler/index.js +4 -4
- package/src/compiler/modules.js +4 -4
- package/src/compiler/util/finger-print.js +1 -1
- package/src/compiler/util/parseExpression.js +1 -1
- package/src/compiler/util/parseStatement.js +1 -1
- package/src/compiler/util/removeDashes.js +1 -1
- package/src/compiler/util/safeVarName.js +1 -1
- package/src/compiler/util/tokenizer.js +1 -1
- package/src/core-tags/cache/cached-fragment-tag-transformer.js +1 -1
- package/src/core-tags/cache/cached-fragment-tag.js +4 -4
- package/src/core-tags/cache/default-cache-manager.js +3 -3
- package/src/core-tags/components/TransformHelper/ComponentArgsCompiler.js +1 -1
- package/src/core-tags/components/TransformHelper/convertToComponent.js +1 -1
- package/src/core-tags/components/TransformHelper/handleComponentPreserveAttrs.js +1 -1
- package/src/core-tags/components/init-components-tag.js +1 -54
- package/src/core-tags/components/package.json +1 -3
- package/src/core-tags/components/preferred-script-location-tag.js +1 -1
- package/src/core-tags/components/preserve-tag.js +1 -27
- package/src/core-tags/components/util/getTransformHelper.js +1 -1
- package/src/core-tags/core/await/AsyncValue.js +3 -3
- package/src/core-tags/core/await/noop-render.js +1 -1
- package/src/core-tags/core/await/renderer.js +8 -7
- package/src/core-tags/core/await/reorderer-renderer.js +35 -14
- package/src/core-tags/core/await/transformer.js +1 -1
- package/src/core-tags/core/core-transformer.js +2 -2
- package/src/core-tags/migrate/all-tags/index.js +1 -1
- package/src/core-tags/migrate/all-templates/index.js +1 -1
- package/src/core-tags/migrate/include-tag.js +3 -2
- package/src/core-tags/migrate/util/parseFor.js +3 -2
- package/src/core-tags/migrate/util/printJS.js +1 -1
- package/src/defineRenderer.js +1 -1
- package/src/express.js +1 -1
- package/src/hot-reload.js +5 -5
- package/src/index.js +1 -41
- package/src/legacy-helpers/notEmpty.js +1 -1
- package/src/node-require/index.js +12 -1
- package/src/{runtime/components/beginComponent-browser.js → node_modules/@internal/components-beginComponent/index-browser.js} +1 -1
- package/src/{runtime/components/beginComponent.js → node_modules/@internal/components-beginComponent/index.js} +2 -2
- package/src/node_modules/@internal/components-beginComponent/package.json +11 -0
- package/src/{runtime/components/legacy/defineWidget-legacy-browser.js → node_modules/@internal/components-define-widget-legacy/index-browser.js} +21 -23
- package/src/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
- package/src/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
- package/src/{runtime/components/endComponent.js → node_modules/@internal/components-endComponent/index.js} +1 -1
- package/src/node_modules/@internal/components-endComponent/package.json +11 -0
- package/src/node_modules/@internal/components-entry/index-browser.js +9 -0
- package/src/node_modules/@internal/components-entry/index.js +301 -0
- package/src/node_modules/@internal/components-entry/package.json +11 -0
- package/src/node_modules/@internal/components-entry-legacy/index-browser.js +74 -0
- package/src/node_modules/@internal/components-entry-legacy/index.js +15 -0
- package/src/node_modules/@internal/components-entry-legacy/package.json +11 -0
- package/src/{runtime/components/init-components-browser.js → node_modules/@internal/components-registry/index-browser.js} +240 -75
- package/src/node_modules/@internal/components-registry/index.js +44 -0
- package/src/node_modules/@internal/components-registry/package.json +11 -0
- package/src/{runtime/components/util-browser.js → node_modules/@internal/components-util/index-browser.js} +11 -10
- package/src/{runtime/components/util.js → node_modules/@internal/components-util/index.js} +0 -2
- package/src/node_modules/@internal/components-util/package.json +11 -0
- package/src/node_modules/@internal/create-readable/index-browser.js +30 -0
- package/src/node_modules/@internal/create-readable/index.js +57 -0
- package/src/node_modules/@internal/create-readable/package.json +11 -0
- package/src/node_modules/@internal/init-components-tag/index.js +54 -0
- package/src/node_modules/@internal/init-components-tag/package.json +11 -0
- package/src/{loader/index-default.js → node_modules/@internal/loader/index.js} +2 -2
- package/src/node_modules/@internal/loader/package.json +11 -0
- package/src/node_modules/@internal/preserve-tag/index.js +27 -0
- package/src/node_modules/@internal/preserve-tag/package.json +11 -0
- package/src/node_modules/@internal/set-immediate/index-browser.js +17 -0
- package/src/node_modules/@internal/set-immediate/index-worker.js +2 -0
- package/src/node_modules/@internal/set-immediate/index.js +2 -0
- package/src/node_modules/@internal/set-immediate/package.json +11 -0
- package/src/runtime/RenderResult.js +20 -18
- package/src/runtime/components/Component.js +44 -41
- package/src/runtime/components/ComponentDef.js +9 -9
- package/src/runtime/components/ComponentsContext.js +4 -5
- package/src/runtime/components/GlobalComponentsContext.js +2 -1
- package/src/runtime/components/KeySequence.js +1 -1
- package/src/runtime/components/State.js +6 -6
- package/src/runtime/components/attach-detach.js +4 -4
- package/src/runtime/components/defineComponent.js +1 -1
- package/src/runtime/components/event-delegation.js +10 -10
- package/src/runtime/components/index.js +1 -301
- package/src/runtime/components/jquery.js +2 -2
- package/src/runtime/components/legacy/browser.json +1 -1
- package/src/runtime/components/legacy/defineRenderer-legacy.js +5 -6
- package/src/runtime/components/legacy/defineWidget-legacy.js +1 -18
- package/src/runtime/components/legacy/dependencies/html.js +1 -1
- package/src/runtime/components/legacy/dependencies/index.js +3 -3
- package/src/runtime/components/legacy/helper-getWidgetFromOut.js +3 -3
- package/src/runtime/components/legacy/index.js +1 -15
- package/src/runtime/components/legacy/renderer-legacy.js +7 -7
- package/src/runtime/components/ready.js +2 -2
- package/src/runtime/components/registry.js +1 -44
- package/src/runtime/components/renderer.js +4 -4
- package/src/runtime/components/update-manager.js +1 -1
- package/src/runtime/dom-insert.js +8 -8
- package/src/runtime/helpers/_weak-map.js +2 -2
- package/src/runtime/helpers/assign.js +3 -1
- package/src/runtime/helpers/bind-component.js +2 -2
- package/src/runtime/helpers/dynamic-tag.js +2 -4
- package/src/runtime/helpers/for-in.js +1 -1
- package/src/runtime/helpers/load-nested-tag.js +1 -1
- package/src/runtime/helpers/load-template.js +1 -1
- package/src/runtime/helpers/merge.js +3 -1
- package/src/runtime/helpers/noop.js +1 -1
- package/src/runtime/helpers/style-value.js +1 -1
- package/src/runtime/helpers/to-string.js +1 -1
- package/src/runtime/html/AsyncStream.js +90 -76
- package/src/runtime/html/BufferedWriter.js +6 -2
- package/src/runtime/html/StringWriter.js +15 -9
- package/src/runtime/html/helpers/attrs.js +3 -3
- package/src/runtime/html/helpers/data-marko.js +0 -2
- package/src/runtime/html/helpers/escape-quotes.js +1 -1
- package/src/runtime/html/helpers/escape-xml.js +1 -1
- package/src/runtime/html/index.js +23 -13
- package/src/runtime/queueMicrotask.js +2 -2
- package/src/runtime/renderable.js +9 -9
- package/src/runtime/vdom/AsyncVDOMBuilder.js +46 -51
- package/src/runtime/vdom/VComment.js +3 -3
- package/src/runtime/vdom/VDocumentFragment.js +3 -3
- package/src/runtime/vdom/VElement.js +17 -13
- package/src/runtime/vdom/VFragment.js +1 -1
- package/src/runtime/vdom/VNode.js +2 -2
- package/src/runtime/vdom/VText.js +3 -3
- package/src/runtime/vdom/helpers/attrs.js +1 -1
- package/src/runtime/vdom/helpers/const.js +2 -2
- package/src/runtime/vdom/helpers/v-element.js +1 -1
- package/src/runtime/vdom/helpers/v-text.js +1 -1
- package/src/runtime/vdom/index.js +21 -23
- package/src/runtime/vdom/morphdom/fragment.js +8 -7
- package/src/runtime/vdom/morphdom/index.js +19 -9
- package/src/runtime/vdom/morphdom/specialElHandlers.js +6 -6
- package/src/runtime/vdom/parse-html.js +4 -4
- package/src/runtime/vdom/preserve-attrs.js +1 -1
- package/src/runtime/vdom/vdom.js +5 -7
- package/src/taglib/taglib-finder/index.js +1 -1
- package/src/taglib/taglib-loader/Tag.js +5 -5
- package/src/taglib/taglib-loader/Taglib.js +2 -2
- package/src/taglib/taglib-loader/json-file-reader.js +1 -1
- package/src/taglib/taglib-loader/loadAttributeFromProps.js +1 -1
- package/src/taglib/taglib-loader/loadTagFromProps.js +5 -6
- package/src/taglib/taglib-loader/tag-def-from-code.js +2 -1
- package/src/taglib/taglib-lookup/TaglibLookup.js +2 -2
- package/src/taglib/taglib-lookup/index.js +1 -1
- package/dist/core-tags/core/await/client-reorder-browser.js +0 -1
- package/dist/core-tags/core/await/client-reorder-runtime.min.js +0 -5
- package/dist/core-tags/core/await/client-reorder.js +0 -11
- package/dist/core-tags/core/await/package.json +0 -6
- package/dist/index-browser.js +0 -4
- package/dist/loader/index.js +0 -7
- package/dist/loader/package.json +0 -5
- package/dist/node-require/index-browser.js +0 -1
- package/dist/package.json +0 -5
- package/dist/runtime/components/beginComponent-browser.js +0 -12
- package/dist/runtime/components/endComponent.js +0 -11
- package/dist/runtime/components/index-browser.js +0 -14
- package/dist/runtime/components/init-components.js +0 -1
- package/dist/runtime/components/legacy/package.json +0 -6
- package/dist/runtime/components/package.json +0 -12
- package/dist/runtime/components/registry-browser.js +0 -73
- package/dist/runtime/html/Template.js +0 -63
- package/dist/runtime/package.json +0 -5
- package/dist/runtime/setImmediate.js +0 -19
- package/src/core-tags/core/await/client-reorder-browser.js +0 -1
- package/src/core-tags/core/await/client-reorder-runtime.min.js +0 -1
- package/src/core-tags/core/await/client-reorder.js +0 -14
- package/src/core-tags/core/await/package.json +0 -6
- package/src/index-browser.js +0 -3
- package/src/loader/index.js +0 -7
- package/src/loader/package.json +0 -5
- package/src/node-require/index-browser.js +0 -1
- package/src/package.json +0 -5
- package/src/runtime/components/index-browser.js +0 -15
- package/src/runtime/components/init-components.js +0 -1
- package/src/runtime/components/legacy/index-browser.js +0 -73
- package/src/runtime/components/legacy/package.json +0 -6
- package/src/runtime/components/package.json +0 -12
- package/src/runtime/components/registry-browser.js +0 -103
- package/src/runtime/html/Template.js +0 -62
- package/src/runtime/package.json +0 -5
- package/src/runtime/setImmediate.js +0 -21
- /package/dist/{runtime/components/endComponent-browser.js → node_modules/@internal/components-endComponent/index-browser.js} +0 -0
- /package/dist/{core-tags/components/init-components-tag-browser.js → node_modules/@internal/init-components-tag/index-browser.js} +0 -0
- /package/dist/{loader → node_modules/@internal/loader}/index-browser.js +0 -0
- /package/src/{runtime/components/endComponent-browser.js → node_modules/@internal/components-endComponent/index-browser.js} +0 -0
- /package/src/{core-tags/components/init-components-tag-browser.js → node_modules/@internal/init-components-tag/index-browser.js} +0 -0
- /package/src/{loader → node_modules/@internal/loader}/index-browser.js +0 -0
- /package/src/{core-tags/components/preserve-tag-browser.js → node_modules/@internal/preserve-tag/index-browser.js} +0 -0
@@ -72,11 +72,7 @@ function render(input, out) {
|
|
72
72
|
var marko_template = require("marko/vdom").t(__filename);
|
73
73
|
|
74
74
|
function render(input, out) {
|
75
|
-
out
|
76
|
-
.e("DIV", null, 3)
|
77
|
-
.t("Hello ")
|
78
|
-
.t(input.name)
|
79
|
-
.t("!");
|
75
|
+
out.e("DIV", null, 3).t("Hello ").t(input.name).t("!");
|
80
76
|
}
|
81
77
|
```
|
82
78
|
|
@@ -184,11 +180,7 @@ var marko_attrs0 = {
|
|
184
180
|
};
|
185
181
|
|
186
182
|
function render(input, out) {
|
187
|
-
out
|
188
|
-
.e("DIV", marko_attrs0, 3)
|
189
|
-
.t("Hello ")
|
190
|
-
.t(input.name)
|
191
|
-
.t("!");
|
183
|
+
out.e("DIV", marko_attrs0, 3).t("Hello ").t(input.name).t("!");
|
192
184
|
}
|
193
185
|
```
|
194
186
|
|
package/package.json
CHANGED
package/src/browser-refresh.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
var enabled = false;
|
2
2
|
var browserRefreshClient = require("browser-refresh-client");
|
3
3
|
|
4
|
-
exports.enable = function(options) {
|
4
|
+
exports.enable = function (options) {
|
5
5
|
if (!browserRefreshClient.isBrowserRefreshEnabled()) {
|
6
6
|
return;
|
7
7
|
}
|
@@ -23,7 +23,7 @@ exports.enable = function(options) {
|
|
23
23
|
|
24
24
|
browserRefreshClient
|
25
25
|
.enableSpecialReload("*.marko marko.json marko-tag.json")
|
26
|
-
.onFileModified(function(path) {
|
26
|
+
.onFileModified(function (path) {
|
27
27
|
hotReload.handleFileModified(path, options);
|
28
28
|
});
|
29
29
|
};
|
@@ -82,10 +82,7 @@ const helpers = {
|
|
82
82
|
vdom: "marko/runtime/components/legacy/defineComponent-legacy",
|
83
83
|
html: "marko/runtime/helpers/noop"
|
84
84
|
},
|
85
|
-
"defineWidget-legacy":
|
86
|
-
html: "marko/runtime/components/legacy/defineWidget-legacy",
|
87
|
-
vdom: "marko/runtime/components/legacy/defineWidget-legacy-browser"
|
88
|
-
},
|
85
|
+
"defineWidget-legacy": "marko/runtime/components/legacy/defineWidget-legacy",
|
89
86
|
dynamicTag: "marko/runtime/helpers/dynamic-tag",
|
90
87
|
escapeXml: {
|
91
88
|
html: {
|
@@ -117,10 +114,8 @@ const helpers = {
|
|
117
114
|
renderer: "marko/runtime/components/renderer",
|
118
115
|
rendererLegacy: "marko/runtime/components/legacy/renderer-legacy",
|
119
116
|
registerComponent: {
|
120
|
-
|
121
|
-
|
122
|
-
method: "r"
|
123
|
-
}
|
117
|
+
module: "marko/runtime/components/registry",
|
118
|
+
method: "r"
|
124
119
|
},
|
125
120
|
str: "marko/runtime/helpers/to-string",
|
126
121
|
styleValue: "marko/runtime/helpers/style-value",
|
package/src/compiler/Compiler.js
CHANGED
@@ -4,14 +4,14 @@ var path = require("path");
|
|
4
4
|
var CodeGenerator = require("./CodeGenerator");
|
5
5
|
var CodeWriter = require("./CodeWriter");
|
6
6
|
var createError = require("raptor-util/createError");
|
7
|
-
var resolveDep =
|
8
|
-
.resolveDep;
|
7
|
+
var resolveDep =
|
8
|
+
require("../runtime/components/legacy/dependencies").resolveDep;
|
9
9
|
|
10
10
|
const FLAG_TRANSFORMER_APPLIED = "transformerApply";
|
11
11
|
|
12
12
|
function transformNode(node, context) {
|
13
13
|
try {
|
14
|
-
context.taglibLookup.forEachNodeTransformer(node, function(transformer) {
|
14
|
+
context.taglibLookup.forEachNodeTransformer(node, function (transformer) {
|
15
15
|
if (node.isDetached()) {
|
16
16
|
return; //The node might have been removed from the tree
|
17
17
|
}
|
@@ -52,7 +52,7 @@ function transformTreeHelper(node, context) {
|
|
52
52
|
* The checks to prevent transformers from being applied multiple times makes
|
53
53
|
* sure that this is not a problem.
|
54
54
|
*/
|
55
|
-
node.forEachChild(function(childNode) {
|
55
|
+
node.forEachChild(function (childNode) {
|
56
56
|
transformTreeHelper(childNode, context);
|
57
57
|
});
|
58
58
|
}
|
@@ -96,7 +96,7 @@ class HtmlJsParser {
|
|
96
96
|
var mergedOptions = Object.assign({}, this.defaultOptions, options);
|
97
97
|
var parser = (this.parser = htmljs.createParser(listeners, {
|
98
98
|
ignorePlaceholders: mergedOptions.ignorePlaceholders,
|
99
|
-
isOpenTagOnly: function(tagName) {
|
99
|
+
isOpenTagOnly: function (tagName) {
|
100
100
|
return handlers.isOpenTagOnly(tagName);
|
101
101
|
}
|
102
102
|
}));
|
package/src/compiler/Migrator.js
CHANGED
package/src/compiler/Parser.js
CHANGED
@@ -5,10 +5,10 @@ var Normalizer = require("./Normalizer");
|
|
5
5
|
var Migrator = require("./Migrator");
|
6
6
|
|
7
7
|
var COMPILER_ATTRIBUTE_HANDLERS = {
|
8
|
-
"preserve-whitespace": function(attr, context) {
|
8
|
+
"preserve-whitespace": function (attr, context) {
|
9
9
|
context.setPreserveWhitespace(true);
|
10
10
|
},
|
11
|
-
"preserve-comments": function(attr, context) {
|
11
|
+
"preserve-comments": function (attr, context) {
|
12
12
|
context.setPreserveComments(true);
|
13
13
|
}
|
14
14
|
};
|
@@ -164,7 +164,7 @@ class Parser {
|
|
164
164
|
|
165
165
|
this.parentNode.setTrimStartEnd(true);
|
166
166
|
|
167
|
-
attributes.forEach(function(attr) {
|
167
|
+
attributes.forEach(function (attr) {
|
168
168
|
let attrName = attr.name;
|
169
169
|
let handler = COMPILER_ATTRIBUTE_HANDLERS[attrName];
|
170
170
|
|
@@ -14,9 +14,8 @@ function getNestedVariables(elNode, tagDef, codegen) {
|
|
14
14
|
tagDef.forEachVariable(nestedVar => {
|
15
15
|
let varName;
|
16
16
|
if (nestedVar.nameFromAttribute) {
|
17
|
-
let possibleNameAttributes =
|
18
|
-
/\s+or\s+|\s*,\s*/i
|
19
|
-
);
|
17
|
+
let possibleNameAttributes =
|
18
|
+
nestedVar.nameFromAttribute.split(/\s+or\s+|\s*,\s*/i);
|
20
19
|
for (let i = 0, len = possibleNameAttributes.length; i < len; i++) {
|
21
20
|
let attrName = possibleNameAttributes[i];
|
22
21
|
let keep = false;
|
@@ -275,7 +274,7 @@ class CustomTag extends HtmlElement {
|
|
275
274
|
if (tagDef.forEachAttribute) {
|
276
275
|
// Add default values for any attributes from the tag definition. These added properties may get overridden
|
277
276
|
// by get overridden from the attributes found on the actual HTML element.
|
278
|
-
tagDef.forEachAttribute(function(attrDef) {
|
277
|
+
tagDef.forEachAttribute(function (attrDef) {
|
279
278
|
if (attrDef.hasOwnProperty("defaultValue")) {
|
280
279
|
handleAttr(
|
281
280
|
attrDef.name,
|
@@ -351,7 +350,7 @@ class CustomTag extends HtmlElement {
|
|
351
350
|
if (tagDef.forEachImportedVariable) {
|
352
351
|
// Imported variables are used to add input properties to a custom tag based on data/variables
|
353
352
|
// found in the compiled template
|
354
|
-
tagDef.forEachImportedVariable(function(importedVariable) {
|
353
|
+
tagDef.forEachImportedVariable(function (importedVariable) {
|
355
354
|
let propName = importedVariable.targetProperty;
|
356
355
|
let propExpression = importedVariable.expression;
|
357
356
|
|
@@ -651,7 +650,7 @@ class CustomTag extends HtmlElement {
|
|
651
650
|
|
652
651
|
if (tagDef.bodyFunction) {
|
653
652
|
let bodyFunction = tagDef.bodyFunction;
|
654
|
-
let bodyFunctionParams = bodyFunction.params.map(function(param) {
|
653
|
+
let bodyFunctionParams = bodyFunction.params.map(function (param) {
|
655
654
|
return builder.identifier(param);
|
656
655
|
});
|
657
656
|
|
@@ -662,9 +661,8 @@ class CustomTag extends HtmlElement {
|
|
662
661
|
renderBodyFunction.params.push(this._nestedTagVar);
|
663
662
|
} else {
|
664
663
|
if (nestedVariableNames && nestedVariableNames.length) {
|
665
|
-
renderBodyFunction.params =
|
666
|
-
nestedVariableNames
|
667
|
-
);
|
664
|
+
renderBodyFunction.params =
|
665
|
+
renderBodyFunction.params.concat(nestedVariableNames);
|
668
666
|
}
|
669
667
|
}
|
670
668
|
}
|
@@ -798,8 +796,8 @@ class CustomTag extends HtmlElement {
|
|
798
796
|
let renderBody = this.generateRenderBodyCode(codegen, body);
|
799
797
|
let additionalAttrs = renderBody &&
|
800
798
|
!isDynamicTag && {
|
801
|
-
[(tagDef.bodyFunction && tagDef.bodyFunction.name) ||
|
802
|
-
|
799
|
+
[(tagDef.bodyFunction && tagDef.bodyFunction.name) || "renderBody"]:
|
800
|
+
renderBody
|
803
801
|
};
|
804
802
|
let inputProps = this.buildInputProps(codegen, additionalAttrs);
|
805
803
|
let renderTagNode = this.generateRenderNode(
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var attr = require("../../../../runtime/html/helpers/attr");
|
4
|
-
var escapeDoubleQuoteAttrValue =
|
5
|
-
.d;
|
4
|
+
var escapeDoubleQuoteAttrValue =
|
5
|
+
require("../../../../runtime/html/helpers/escape-quotes").d;
|
6
6
|
|
7
7
|
function isStringLiteral(node) {
|
8
8
|
return node.type === "Literal" && typeof node.value === "string";
|
@@ -124,7 +124,7 @@ class HtmlElementVDOM extends Node {
|
|
124
124
|
if (attributes != null && attributes.length !== 0) {
|
125
125
|
let explicitAttrs = null;
|
126
126
|
let attrs = [];
|
127
|
-
let addAttr = function(name, value) {
|
127
|
+
let addAttr = function (name, value) {
|
128
128
|
hasNamedAttributes = true;
|
129
129
|
|
130
130
|
if (!SIMPLE_ATTRS[name]) {
|
@@ -33,7 +33,7 @@ function checkPropertiesStatic(properties) {
|
|
33
33
|
return true;
|
34
34
|
}
|
35
35
|
|
36
|
-
module.exports = function(node, codegen) {
|
36
|
+
module.exports = function (node, codegen) {
|
37
37
|
var builder = codegen.builder;
|
38
38
|
var context = codegen.context;
|
39
39
|
var body = codegen.generateCode(node.body);
|
@@ -1,10 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var escapeXmlOrNullish =
|
4
|
-
.x;
|
3
|
+
var escapeXmlOrNullish =
|
4
|
+
require("../../../../runtime/html/helpers/escape-xml").x;
|
5
5
|
var Literal = require("../../Literal");
|
6
6
|
|
7
|
-
module.exports = function(node, codegen) {
|
7
|
+
module.exports = function (node, codegen) {
|
8
8
|
var context = codegen.context;
|
9
9
|
var argument = codegen.generateCode(node.argument);
|
10
10
|
var escape = node.escape !== false;
|
@@ -4,7 +4,7 @@ var TextVDOM = require("./TextVDOM");
|
|
4
4
|
var Literal = require("../../Literal");
|
5
5
|
var he = require("he"); // Used for dealing with HTML entities
|
6
6
|
|
7
|
-
module.exports = function(node, codegen, vdomUtil) {
|
7
|
+
module.exports = function (node, codegen, vdomUtil) {
|
8
8
|
var argument = codegen.generateCode(node.argument);
|
9
9
|
var escape = node.escape !== false;
|
10
10
|
var isStatic = null;
|
package/src/compiler/index.js
CHANGED
@@ -14,7 +14,7 @@ var taglib = require("../taglib");
|
|
14
14
|
var defaults = extend({}, globalConfig);
|
15
15
|
|
16
16
|
Object.defineProperty(exports, "defaultOptions", {
|
17
|
-
get: function() {
|
17
|
+
get: function () {
|
18
18
|
return globalConfig;
|
19
19
|
},
|
20
20
|
enumerable: true,
|
@@ -22,7 +22,7 @@ Object.defineProperty(exports, "defaultOptions", {
|
|
22
22
|
});
|
23
23
|
|
24
24
|
Object.defineProperty(exports, "config", {
|
25
|
-
get: function() {
|
25
|
+
get: function () {
|
26
26
|
return globalConfig;
|
27
27
|
},
|
28
28
|
enumerable: true,
|
@@ -141,7 +141,7 @@ function compileFile(filename, options, callback) {
|
|
141
141
|
options.sourceOnly = options.sourceOnly !== false;
|
142
142
|
|
143
143
|
if (callback) {
|
144
|
-
fs.readFile(filename, { encoding: "utf8" }, function(err, templateSrc) {
|
144
|
+
fs.readFile(filename, { encoding: "utf8" }, function (err, templateSrc) {
|
145
145
|
if (err) {
|
146
146
|
return callback(err);
|
147
147
|
}
|
@@ -292,7 +292,7 @@ function buildTaglibLookup(dirname) {
|
|
292
292
|
|
293
293
|
exports.buildTaglibLookup = buildTaglibLookup;
|
294
294
|
|
295
|
-
exports.registerTaglib = function(filePath) {
|
295
|
+
exports.registerTaglib = function (filePath) {
|
296
296
|
registerCoreTaglibs();
|
297
297
|
|
298
298
|
ok(typeof filePath === "string", '"filePath" should be a string');
|
package/src/compiler/modules.js
CHANGED
@@ -14,19 +14,19 @@ const deresolveOptions = {
|
|
14
14
|
// We only need this to make Try Online work :/
|
15
15
|
|
16
16
|
var helpers = {
|
17
|
-
require: function(path) {
|
17
|
+
require: function (path) {
|
18
18
|
return nativeRequire(path);
|
19
19
|
},
|
20
20
|
|
21
|
-
resolve: function(path) {
|
21
|
+
resolve: function (path) {
|
22
22
|
return nativeRequire.resolve(path);
|
23
23
|
},
|
24
24
|
|
25
|
-
resolveFrom: function(from, target) {
|
25
|
+
resolveFrom: function (from, target) {
|
26
26
|
return resolveFrom(from, target);
|
27
27
|
},
|
28
28
|
|
29
|
-
deresolve: function(targetFilename, from) {
|
29
|
+
deresolve: function (targetFilename, from) {
|
30
30
|
return deresolve(targetFilename, from, deresolveOptions);
|
31
31
|
}
|
32
32
|
};
|
@@ -26,7 +26,7 @@ function create(tokens) {
|
|
26
26
|
);
|
27
27
|
|
28
28
|
return {
|
29
|
-
forEachToken: function(value, callback) {
|
29
|
+
forEachToken: function (value, callback) {
|
30
30
|
tokensRegExp.lastIndex = 0; // Start searching from the beginning again
|
31
31
|
var matches;
|
32
32
|
while ((matches = tokensRegExp.exec(value))) {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
var defaultCacheManagerPath = require.resolve("./default-cache-manager");
|
2
2
|
|
3
|
-
module.exports = function(el, context) {
|
3
|
+
module.exports = function (el, context) {
|
4
4
|
context.deprecate("The <cached-fragment> tag is deprecated.");
|
5
5
|
if (!el.hasAttribute("cache-manager")) {
|
6
6
|
var requirePath = context.getRequirePath(defaultCacheManagerPath);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
module.exports = {
|
3
|
-
render: function(input, out) {
|
3
|
+
render: function (input, out) {
|
4
4
|
var cacheKey = input.cacheKey;
|
5
5
|
if (!cacheKey) {
|
6
6
|
throw new Error("cache-key is required for <cached-fragment>");
|
@@ -17,21 +17,21 @@ module.exports = {
|
|
17
17
|
cache.get(
|
18
18
|
cacheKey,
|
19
19
|
{
|
20
|
-
builder: function(callback) {
|
20
|
+
builder: function (callback) {
|
21
21
|
var nestedOut = out.createOut();
|
22
22
|
|
23
23
|
if (input.renderBody) {
|
24
24
|
input.renderBody(nestedOut);
|
25
25
|
}
|
26
26
|
|
27
|
-
nestedOut.on("error", callback).on("finish", function(result) {
|
27
|
+
nestedOut.on("error", callback).on("finish", function (result) {
|
28
28
|
callback(null, result.getOutput());
|
29
29
|
});
|
30
30
|
|
31
31
|
nestedOut.end();
|
32
32
|
}
|
33
33
|
},
|
34
|
-
function(err, result) {
|
34
|
+
function (err, result) {
|
35
35
|
if (err) {
|
36
36
|
return asyncOut.error(err);
|
37
37
|
}
|
@@ -4,14 +4,14 @@ function createCache() {
|
|
4
4
|
var cache = {};
|
5
5
|
|
6
6
|
return {
|
7
|
-
get: function(cacheKey, options, callback) {
|
7
|
+
get: function (cacheKey, options, callback) {
|
8
8
|
var value = cache[cacheKey];
|
9
9
|
if (value !== undefined) {
|
10
10
|
return callback(null, value);
|
11
11
|
}
|
12
12
|
|
13
13
|
var builder = options.builder;
|
14
|
-
builder(function(err, value) {
|
14
|
+
builder(function (err, value) {
|
15
15
|
if (err) {
|
16
16
|
return callback(err);
|
17
17
|
}
|
@@ -29,7 +29,7 @@ function createCache() {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
var defaultCacheManager = {
|
32
|
-
getCache: function(cacheName) {
|
32
|
+
getCache: function (cacheName) {
|
33
33
|
return caches[cacheName] || (caches[cacheName] = createCache());
|
34
34
|
}
|
35
35
|
};
|
@@ -61,7 +61,7 @@ class ComponentArgs {
|
|
61
61
|
args = finalizeArgs(args, builder);
|
62
62
|
|
63
63
|
if (el.type === "CustomTag") {
|
64
|
-
el.generateRenderTagCode = function(codegen, tagVar, tagArgs) {
|
64
|
+
el.generateRenderTagCode = function (codegen, tagVar, tagArgs) {
|
65
65
|
tagArgs = tagArgs.concat(args);
|
66
66
|
return codegen.builder.functionCall(tagVar, tagArgs);
|
67
67
|
};
|
@@ -135,7 +135,7 @@ module.exports = function handleComponentBind(options) {
|
|
135
135
|
defineComponentHelper = this.context.helper("defineComponent");
|
136
136
|
}
|
137
137
|
|
138
|
-
this.context.on("beforeGenerateCode:TemplateRoot", function(eventArgs) {
|
138
|
+
this.context.on("beforeGenerateCode:TemplateRoot", function (eventArgs) {
|
139
139
|
eventArgs.node.addRenderFunctionParam(builder.identifier("__component"));
|
140
140
|
|
141
141
|
if (isLegacyComponent) {
|
@@ -11,7 +11,7 @@ module.exports = function handleComponentPreserveAttrs() {
|
|
11
11
|
|
12
12
|
var noUpdateAttrs = [];
|
13
13
|
|
14
|
-
el.forEachAttribute(function(attr) {
|
14
|
+
el.forEachAttribute(function (attr) {
|
15
15
|
var attrName = attr.name;
|
16
16
|
|
17
17
|
if (attrName && attrName.endsWith(NO_UPDATE_ATTR_SUFFIX)) {
|
@@ -1,54 +1 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
const INIT_COMPONENTS_KEY = Symbol();
|
4
|
-
|
5
|
-
const addComponentsFromContext = require("../../runtime/components")
|
6
|
-
.___addComponentsFromContext;
|
7
|
-
const getInitComponentsCode = require("../../runtime/components")
|
8
|
-
.___getInitComponentsCode;
|
9
|
-
|
10
|
-
function addComponentsFromOut(source, target) {
|
11
|
-
const sourceOut = source.out || source;
|
12
|
-
const targetOut = target || sourceOut;
|
13
|
-
const componentsContext = sourceOut.___components;
|
14
|
-
const componentDefs = targetOut.writer.get("componentDefs");
|
15
|
-
addComponentsFromContext(componentsContext, componentDefs);
|
16
|
-
}
|
17
|
-
|
18
|
-
function addInitScript(writer) {
|
19
|
-
const out = writer.state.root;
|
20
|
-
const componentDefs = writer.get("componentDefs");
|
21
|
-
writer.script(getInitComponentsCode(out, componentDefs));
|
22
|
-
}
|
23
|
-
|
24
|
-
module.exports = function render(input, out) {
|
25
|
-
const $global = out.global;
|
26
|
-
if ($global[INIT_COMPONENTS_KEY] === undefined) {
|
27
|
-
$global[INIT_COMPONENTS_KEY] = true;
|
28
|
-
|
29
|
-
out.on("await:finish", addComponentsFromOut);
|
30
|
-
out.on("___toString", addInitScript);
|
31
|
-
|
32
|
-
if (out.isSync() === true) {
|
33
|
-
// Generate initialization code for any of the UI components that were
|
34
|
-
// rendered synchronously
|
35
|
-
addComponentsFromOut(out);
|
36
|
-
} else {
|
37
|
-
// Generate initialization code for any of the UI components that were
|
38
|
-
// rendered asynchronously, but were outside an `<await>` tag
|
39
|
-
// (each `<await>` tag will have its own component initialization block)
|
40
|
-
const asyncOut = out.beginAsync({ last: true, timeout: -1 });
|
41
|
-
out.onLast(function(next) {
|
42
|
-
// Ensure we're getting init code starting from the root
|
43
|
-
let rootOut = out;
|
44
|
-
while (rootOut._parentOut) {
|
45
|
-
rootOut = rootOut._parentOut;
|
46
|
-
}
|
47
|
-
// Write out all of the component init code from the main out
|
48
|
-
addComponentsFromOut(rootOut, asyncOut);
|
49
|
-
asyncOut.end();
|
50
|
-
next();
|
51
|
-
});
|
52
|
-
}
|
53
|
-
}
|
54
|
-
};
|
1
|
+
module.exports = require("@internal/init-components-tag");
|
@@ -16,7 +16,7 @@ module.exports = function render(input, out) {
|
|
16
16
|
forceScriptTagAtThisPoint(out);
|
17
17
|
} else {
|
18
18
|
const asyncOut = out.beginAsync({ last: true, timeout: -1 });
|
19
|
-
out.onLast(function(next) {
|
19
|
+
out.onLast(function (next) {
|
20
20
|
forceScriptTagAtThisPoint(asyncOut);
|
21
21
|
asyncOut.end();
|
22
22
|
next();
|
@@ -1,27 +1 @@
|
|
1
|
-
|
2
|
-
var getComponentsContext = ComponentsContext.___getComponentsContext;
|
3
|
-
|
4
|
-
module.exports = function render(input, out) {
|
5
|
-
var shouldPreserve = Boolean(!("i" in input) || input.i);
|
6
|
-
var isComponent = !input.n;
|
7
|
-
|
8
|
-
if (isComponent) {
|
9
|
-
out.bf(out.___assignedKey, out.___assignedComponentDef.___component, true);
|
10
|
-
}
|
11
|
-
|
12
|
-
if (input.renderBody) {
|
13
|
-
if (shouldPreserve) {
|
14
|
-
var componentsContext = getComponentsContext(out);
|
15
|
-
var parentPreserved = componentsContext.___isPreserved;
|
16
|
-
componentsContext.___isPreserved = true;
|
17
|
-
input.renderBody(out);
|
18
|
-
componentsContext.___isPreserved = parentPreserved;
|
19
|
-
} else {
|
20
|
-
input.renderBody(out);
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
if (isComponent) {
|
25
|
-
out.ef();
|
26
|
-
}
|
27
|
-
};
|
1
|
+
module.exports = require("@internal/preserve-tag");
|
@@ -46,7 +46,7 @@ AsyncValue.prototype = {
|
|
46
46
|
* The given callback will be invoked when there is an error or resolved data
|
47
47
|
* available.
|
48
48
|
*/
|
49
|
-
___done: function(callback) {
|
49
|
+
___done: function (callback) {
|
50
50
|
// Do we already have data or error?
|
51
51
|
if (this.___settled) {
|
52
52
|
// invoke the callback immediately
|
@@ -63,7 +63,7 @@ AsyncValue.prototype = {
|
|
63
63
|
* its initial state so that any future requests to load data will trigger a
|
64
64
|
* new load call.
|
65
65
|
*/
|
66
|
-
___reject: function(err) {
|
66
|
+
___reject: function (err) {
|
67
67
|
if (this.___settled) {
|
68
68
|
return;
|
69
69
|
}
|
@@ -84,7 +84,7 @@ AsyncValue.prototype = {
|
|
84
84
|
/**
|
85
85
|
* This method will trigger any callbacks to be notified of data.
|
86
86
|
*/
|
87
|
-
___resolve: function(value) {
|
87
|
+
___resolve: function (value) {
|
88
88
|
if (this.___settled) {
|
89
89
|
return;
|
90
90
|
}
|