marko 4.24.6 → 4.26.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/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 +4 -4
- 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
package/bin/markoc.js
CHANGED
|
@@ -99,7 +99,7 @@ var args = require("argly")
|
|
|
99
99
|
"Delete all *.marko.js files in the current directory",
|
|
100
100
|
"$0 . --clean"
|
|
101
101
|
)
|
|
102
|
-
.validate(function(result) {
|
|
102
|
+
.validate(function (result) {
|
|
103
103
|
if (result.help) {
|
|
104
104
|
this.printUsage();
|
|
105
105
|
process.exit(0);
|
|
@@ -116,7 +116,7 @@ var args = require("argly")
|
|
|
116
116
|
process.exit(1);
|
|
117
117
|
}
|
|
118
118
|
})
|
|
119
|
-
.onError(function(err) {
|
|
119
|
+
.onError(function (err) {
|
|
120
120
|
this.printUsage();
|
|
121
121
|
|
|
122
122
|
if (err) {
|
|
@@ -151,7 +151,7 @@ if (force) {
|
|
|
151
151
|
|
|
152
152
|
var paths = args.paths;
|
|
153
153
|
if (paths && paths.length) {
|
|
154
|
-
paths.forEach(function(path) {
|
|
154
|
+
paths.forEach(function (path) {
|
|
155
155
|
appModulePath.addPath(nodePath.resolve(cwd, path));
|
|
156
156
|
});
|
|
157
157
|
}
|
|
@@ -162,12 +162,12 @@ if (!ignoreRules) {
|
|
|
162
162
|
ignoreRules = ["/node_modules", ".*"];
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
ignoreRules = ignoreRules.filter(function(s) {
|
|
165
|
+
ignoreRules = ignoreRules.filter(function (s) {
|
|
166
166
|
s = s.trim();
|
|
167
167
|
return s && !s.match(/^#/);
|
|
168
168
|
});
|
|
169
169
|
|
|
170
|
-
ignoreRules = ignoreRules.map(function(pattern) {
|
|
170
|
+
ignoreRules = ignoreRules.map(function (pattern) {
|
|
171
171
|
return new Minimatch(pattern, mmOptions);
|
|
172
172
|
});
|
|
173
173
|
|
|
@@ -223,10 +223,10 @@ function walk(files, options, done) {
|
|
|
223
223
|
var fileCallback = options.file;
|
|
224
224
|
var context = {
|
|
225
225
|
errors: [],
|
|
226
|
-
beginAsync: function() {
|
|
226
|
+
beginAsync: function () {
|
|
227
227
|
pending++;
|
|
228
228
|
},
|
|
229
|
-
endAsync: function(err) {
|
|
229
|
+
endAsync: function (err) {
|
|
230
230
|
if (err) {
|
|
231
231
|
this.errors.push(err);
|
|
232
232
|
}
|
|
@@ -245,17 +245,17 @@ function walk(files, options, done) {
|
|
|
245
245
|
|
|
246
246
|
function doWalk(dir) {
|
|
247
247
|
context.beginAsync();
|
|
248
|
-
fs.readdir(dir, function(err, list) {
|
|
248
|
+
fs.readdir(dir, function (err, list) {
|
|
249
249
|
if (err) {
|
|
250
250
|
return context.endAsync(err);
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
if (list.length) {
|
|
254
|
-
list.forEach(function(basename) {
|
|
254
|
+
list.forEach(function (basename) {
|
|
255
255
|
var file = nodePath.join(dir, basename);
|
|
256
256
|
|
|
257
257
|
context.beginAsync();
|
|
258
|
-
fs.stat(file, function(err, stat) {
|
|
258
|
+
fs.stat(file, function (err, stat) {
|
|
259
259
|
if (err) {
|
|
260
260
|
return context.endAsync(err);
|
|
261
261
|
}
|
|
@@ -296,7 +296,7 @@ if (args.clean) {
|
|
|
296
296
|
walk(
|
|
297
297
|
args.files,
|
|
298
298
|
{
|
|
299
|
-
file: function(file, context) {
|
|
299
|
+
file: function (file, context) {
|
|
300
300
|
var basename = nodePath.basename(file);
|
|
301
301
|
|
|
302
302
|
if (
|
|
@@ -305,7 +305,7 @@ if (args.clean) {
|
|
|
305
305
|
basename.endsWith(".marko.xml.js")
|
|
306
306
|
) {
|
|
307
307
|
context.beginAsync();
|
|
308
|
-
fs.unlink(file, function(err) {
|
|
308
|
+
fs.unlink(file, function (err) {
|
|
309
309
|
if (err) {
|
|
310
310
|
return context.endAsync(err);
|
|
311
311
|
}
|
|
@@ -316,7 +316,7 @@ if (args.clean) {
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
},
|
|
319
|
-
function() {
|
|
319
|
+
function () {
|
|
320
320
|
if (deleteCount === 0) {
|
|
321
321
|
console.log("No *.marko.js files were found. Already clean.");
|
|
322
322
|
} else {
|
|
@@ -329,7 +329,7 @@ if (args.clean) {
|
|
|
329
329
|
var compileCount = 0;
|
|
330
330
|
var failed = [];
|
|
331
331
|
|
|
332
|
-
var compile = function(path, context) {
|
|
332
|
+
var compile = function (path, context) {
|
|
333
333
|
if (found[path]) {
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
@@ -348,7 +348,7 @@ if (args.clean) {
|
|
|
348
348
|
|
|
349
349
|
context.beginAsync();
|
|
350
350
|
|
|
351
|
-
markoCompiler.compileFile(path, compileOptions, function(err, src) {
|
|
351
|
+
markoCompiler.compileFile(path, compileOptions, function (err, src) {
|
|
352
352
|
if (err) {
|
|
353
353
|
failed.push(
|
|
354
354
|
'Failed to compile "' +
|
|
@@ -361,7 +361,7 @@ if (args.clean) {
|
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
context.beginAsync();
|
|
364
|
-
fs.writeFile(outPath, src, { encoding: "utf8" }, function(err) {
|
|
364
|
+
fs.writeFile(outPath, src, { encoding: "utf8" }, function (err) {
|
|
365
365
|
if (err) {
|
|
366
366
|
failed.push(
|
|
367
367
|
'Failed to write "' + path + '". Error: ' + (err.stack || err)
|
|
@@ -382,7 +382,7 @@ if (args.clean) {
|
|
|
382
382
|
walk(
|
|
383
383
|
args.files,
|
|
384
384
|
{
|
|
385
|
-
file: function(file, context) {
|
|
385
|
+
file: function (file, context) {
|
|
386
386
|
var basename = nodePath.basename(file);
|
|
387
387
|
|
|
388
388
|
if (
|
|
@@ -394,7 +394,7 @@ if (args.clean) {
|
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
},
|
|
397
|
-
function(err) {
|
|
397
|
+
function (err) {
|
|
398
398
|
if (err) {
|
|
399
399
|
if (failed.length) {
|
|
400
400
|
console.error(
|
|
@@ -79,10 +79,7 @@ const helpers = {
|
|
|
79
79
|
vdom: "marko/runtime/components/legacy/defineComponent-legacy",
|
|
80
80
|
html: "marko/runtime/helpers/noop"
|
|
81
81
|
},
|
|
82
|
-
"defineWidget-legacy":
|
|
83
|
-
html: "marko/runtime/components/legacy/defineWidget-legacy",
|
|
84
|
-
vdom: "marko/runtime/components/legacy/defineWidget-legacy-browser"
|
|
85
|
-
},
|
|
82
|
+
"defineWidget-legacy": "marko/runtime/components/legacy/defineWidget-legacy",
|
|
86
83
|
dynamicTag: "marko/runtime/helpers/dynamic-tag",
|
|
87
84
|
escapeXml: {
|
|
88
85
|
html: {
|
|
@@ -114,10 +111,8 @@ const helpers = {
|
|
|
114
111
|
renderer: "marko/runtime/components/renderer",
|
|
115
112
|
rendererLegacy: "marko/runtime/components/legacy/renderer-legacy",
|
|
116
113
|
registerComponent: {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
method: "r"
|
|
120
|
-
}
|
|
114
|
+
module: "marko/runtime/components/registry",
|
|
115
|
+
method: "r"
|
|
121
116
|
},
|
|
122
117
|
str: "marko/runtime/helpers/to-string",
|
|
123
118
|
styleValue: "marko/runtime/helpers/style-value",
|
|
@@ -1,52 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const INIT_COMPONENTS_KEY = Symbol();
|
|
4
|
-
|
|
5
|
-
const addComponentsFromContext = require("../../runtime/components").f_;
|
|
6
|
-
const getInitComponentsCode = require("../../runtime/components").g_;
|
|
7
|
-
|
|
8
|
-
function addComponentsFromOut(source, target) {
|
|
9
|
-
const sourceOut = source.out || source;
|
|
10
|
-
const targetOut = target || sourceOut;
|
|
11
|
-
const componentsContext = sourceOut.h_;
|
|
12
|
-
const componentDefs = targetOut.writer.get("componentDefs");
|
|
13
|
-
addComponentsFromContext(componentsContext, componentDefs);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function addInitScript(writer) {
|
|
17
|
-
const out = writer.state.root;
|
|
18
|
-
const componentDefs = writer.get("componentDefs");
|
|
19
|
-
writer.script(getInitComponentsCode(out, componentDefs));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
module.exports = function render(input, out) {
|
|
23
|
-
const $global = out.global;
|
|
24
|
-
if ($global[INIT_COMPONENTS_KEY] === undefined) {
|
|
25
|
-
$global[INIT_COMPONENTS_KEY] = true;
|
|
26
|
-
|
|
27
|
-
out.on("await:finish", addComponentsFromOut);
|
|
28
|
-
out.on("i_", addInitScript);
|
|
29
|
-
|
|
30
|
-
if (out.isSync() === true) {
|
|
31
|
-
// Generate initialization code for any of the UI components that were
|
|
32
|
-
// rendered synchronously
|
|
33
|
-
addComponentsFromOut(out);
|
|
34
|
-
} else {
|
|
35
|
-
// Generate initialization code for any of the UI components that were
|
|
36
|
-
// rendered asynchronously, but were outside an `<await>` tag
|
|
37
|
-
// (each `<await>` tag will have its own component initialization block)
|
|
38
|
-
const asyncOut = out.beginAsync({ last: true, timeout: -1 });
|
|
39
|
-
out.onLast(function (next) {
|
|
40
|
-
// Ensure we're getting init code starting from the root
|
|
41
|
-
let rootOut = out;
|
|
42
|
-
while (rootOut._parentOut) {
|
|
43
|
-
rootOut = rootOut._parentOut;
|
|
44
|
-
}
|
|
45
|
-
// Write out all of the component init code from the main out
|
|
46
|
-
addComponentsFromOut(rootOut, asyncOut);
|
|
47
|
-
asyncOut.end();
|
|
48
|
-
next();
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
1
|
+
module.exports = require("@internal/init-components-tag");
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
function forceScriptTagAtThisPoint(out) {
|
|
4
4
|
const writer = out.writer;
|
|
5
5
|
|
|
6
|
-
out.global.
|
|
6
|
+
out.global.f_ = true;
|
|
7
7
|
const htmlSoFar = writer.toString();
|
|
8
|
-
out.global.
|
|
8
|
+
out.global.f_ = undefined;
|
|
9
9
|
|
|
10
10
|
writer.clear();
|
|
11
11
|
writer.write(htmlSoFar);
|
|
@@ -1,27 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var getComponentsContext = ComponentsContext.u_;
|
|
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.o_, out.m_.n_, true);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (input.renderBody) {
|
|
13
|
-
if (shouldPreserve) {
|
|
14
|
-
var componentsContext = getComponentsContext(out);
|
|
15
|
-
var parentPreserved = componentsContext.v_;
|
|
16
|
-
componentsContext.v_ = true;
|
|
17
|
-
input.renderBody(out);
|
|
18
|
-
componentsContext.v_ = 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");
|
|
@@ -5,30 +5,30 @@ function AsyncValue() {
|
|
|
5
5
|
* The data that was provided via call to resolve(data).
|
|
6
6
|
* This property is assumed to be public and available for inspection.
|
|
7
7
|
*/
|
|
8
|
-
this.
|
|
8
|
+
this.g_ = undefined;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The data that was provided via call to reject(err)
|
|
12
12
|
* This property is assumed to be public and available for inspection.
|
|
13
13
|
*/
|
|
14
|
-
this.
|
|
14
|
+
this.h_ = undefined;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* The queue of callbacks that are waiting for data
|
|
18
18
|
*/
|
|
19
|
-
this.
|
|
19
|
+
this.i_ = undefined;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* The state of the data holder (STATE_INITIAL, STATE_RESOLVED, or STATE_REJECTED)
|
|
23
23
|
*/
|
|
24
|
-
this.
|
|
24
|
+
this.j_ = false;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
function notifyCallbacks(asyncValue, err, value) {
|
|
28
|
-
var callbacks = asyncValue.
|
|
28
|
+
var callbacks = asyncValue.i_;
|
|
29
29
|
if (callbacks) {
|
|
30
30
|
// clear out the registered callbacks (we still have reference to the original value)
|
|
31
|
-
asyncValue.
|
|
31
|
+
asyncValue.i_ = undefined;
|
|
32
32
|
|
|
33
33
|
// invoke all of the callbacks and use their scope
|
|
34
34
|
for (var i = 0; i < callbacks.length; i++) {
|
|
@@ -46,14 +46,14 @@ AsyncValue.prototype = {
|
|
|
46
46
|
* The given callback will be invoked when there is an error or resolved data
|
|
47
47
|
* available.
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
k_: function (callback) {
|
|
50
50
|
// Do we already have data or error?
|
|
51
|
-
if (this.
|
|
51
|
+
if (this.j_) {
|
|
52
52
|
// invoke the callback immediately
|
|
53
|
-
return callback(this.
|
|
53
|
+
return callback(this.h_, this.g_);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
var callbacks = this.
|
|
56
|
+
var callbacks = this.i_ || (this.i_ = []);
|
|
57
57
|
callbacks.push(callback);
|
|
58
58
|
},
|
|
59
59
|
|
|
@@ -63,19 +63,19 @@ 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
|
-
|
|
67
|
-
if (this.
|
|
66
|
+
l_: function (err) {
|
|
67
|
+
if (this.j_) {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
// remember the error
|
|
72
|
-
this.
|
|
72
|
+
this.h_ = err;
|
|
73
73
|
|
|
74
74
|
// Go to the rejected state if we don't have a loader.
|
|
75
75
|
// If we do have a loader then return to the initial state
|
|
76
76
|
// (we do this so that next call to done() will trigger load
|
|
77
77
|
// again in case the error was transient).
|
|
78
|
-
this.
|
|
78
|
+
this.j_ = true;
|
|
79
79
|
|
|
80
80
|
// always notify callbacks regardless of whether or not we return to the initial state
|
|
81
81
|
notifyCallbacks(this, err, null);
|
|
@@ -84,8 +84,8 @@ AsyncValue.prototype = {
|
|
|
84
84
|
/**
|
|
85
85
|
* This method will trigger any callbacks to be notified of data.
|
|
86
86
|
*/
|
|
87
|
-
|
|
88
|
-
if (this.
|
|
87
|
+
m_: function (value) {
|
|
88
|
+
if (this.j_) {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -93,9 +93,9 @@ AsyncValue.prototype = {
|
|
|
93
93
|
var asyncValue = this;
|
|
94
94
|
|
|
95
95
|
var finalPromise = value.then(function onFulfilled(value) {
|
|
96
|
-
queueMicrotask(asyncValue.
|
|
96
|
+
queueMicrotask(asyncValue.m_.bind(asyncValue, value));
|
|
97
97
|
}, function onRejected(err) {
|
|
98
|
-
queueMicrotask(asyncValue.
|
|
98
|
+
queueMicrotask(asyncValue.l_.bind(asyncValue, err));
|
|
99
99
|
});
|
|
100
100
|
|
|
101
101
|
if (finalPromise.done) {
|
|
@@ -103,10 +103,10 @@ AsyncValue.prototype = {
|
|
|
103
103
|
}
|
|
104
104
|
} else {
|
|
105
105
|
// remember the state
|
|
106
|
-
this.
|
|
106
|
+
this.g_ = value;
|
|
107
107
|
|
|
108
108
|
// go to the resolved state
|
|
109
|
-
this.
|
|
109
|
+
this.j_ = true;
|
|
110
110
|
|
|
111
111
|
// notify callbacks
|
|
112
112
|
notifyCallbacks(this, null, value);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var complain;
|
|
4
|
-
var isClientReorderSupported = require("./client-reorder").isSupported;
|
|
5
4
|
var AsyncValue = require("./AsyncValue");
|
|
6
5
|
|
|
7
6
|
function safeRenderBody(renderBody, targetOut, data) {
|
|
@@ -19,9 +18,9 @@ function requestData(provider, timeout) {
|
|
|
19
18
|
|
|
20
19
|
var callback = function (err, data) {
|
|
21
20
|
if (err) {
|
|
22
|
-
asyncValue.
|
|
21
|
+
asyncValue.l_(err);
|
|
23
22
|
} else {
|
|
24
|
-
asyncValue.
|
|
23
|
+
asyncValue.m_(data);
|
|
25
24
|
}
|
|
26
25
|
};
|
|
27
26
|
// eslint-disable-next-line no-constant-condition
|
|
@@ -32,11 +31,11 @@ function requestData(provider, timeout) {
|
|
|
32
31
|
provider(null, callback);
|
|
33
32
|
|
|
34
33
|
if (value !== undefined) {
|
|
35
|
-
asyncValue.
|
|
34
|
+
asyncValue.m_(value);
|
|
36
35
|
}
|
|
37
36
|
} else {
|
|
38
37
|
// Assume the provider is a data object...
|
|
39
|
-
asyncValue.
|
|
38
|
+
asyncValue.m_(provider);
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
if (timeout == null) {
|
|
@@ -53,10 +52,10 @@ function requestData(provider, timeout) {
|
|
|
53
52
|
if (!error) error = new Error(errorMsg);
|
|
54
53
|
error.code = "ERR_AWAIT_TIMEDOUT";
|
|
55
54
|
error.name = "TimeoutError";
|
|
56
|
-
asyncValue.
|
|
55
|
+
asyncValue.l_(error);
|
|
57
56
|
}, timeout);
|
|
58
57
|
|
|
59
|
-
asyncValue.
|
|
58
|
+
asyncValue.k_(function () {
|
|
60
59
|
if (timeoutId != null) {
|
|
61
60
|
clearTimeout(timeoutId);
|
|
62
61
|
}
|
|
@@ -69,7 +68,7 @@ function requestData(provider, timeout) {
|
|
|
69
68
|
const LAST_OPTIONS = { last: true, name: "await:finish" };
|
|
70
69
|
|
|
71
70
|
module.exports = function awaitTag(input, out) {
|
|
72
|
-
var clientReorder =
|
|
71
|
+
var clientReorder = typeof document === "undefined" && input.clientReorder === true && !out.isVDOM;
|
|
73
72
|
|
|
74
73
|
var name = input.name || input._name;
|
|
75
74
|
var timeout = input.timeout;
|
|
@@ -77,8 +76,8 @@ module.exports = function awaitTag(input, out) {
|
|
|
77
76
|
var asyncValue = requestData(provider, timeout);
|
|
78
77
|
var placeholderRenderer = input.placeholder && input.placeholder.renderBody;
|
|
79
78
|
|
|
80
|
-
if (asyncValue.
|
|
81
|
-
renderContents(asyncValue.
|
|
79
|
+
if (asyncValue.j_) {
|
|
80
|
+
renderContents(asyncValue.h_, asyncValue.g_, input, out);
|
|
82
81
|
return;
|
|
83
82
|
}
|
|
84
83
|
|
|
@@ -94,7 +93,7 @@ module.exports = function awaitTag(input, out) {
|
|
|
94
93
|
if (clientReorder) {
|
|
95
94
|
awaitInfo.after = input.showAfter;
|
|
96
95
|
|
|
97
|
-
clientReorderContext = out.global.
|
|
96
|
+
clientReorderContext = out.global.n_ || (out.global.n_ = {
|
|
98
97
|
instances: [],
|
|
99
98
|
nextId: 0
|
|
100
99
|
});
|
|
@@ -194,7 +193,7 @@ module.exports = function awaitTag(input, out) {
|
|
|
194
193
|
}
|
|
195
194
|
}
|
|
196
195
|
|
|
197
|
-
asyncValue.
|
|
196
|
+
asyncValue.k_(renderBody);
|
|
198
197
|
};
|
|
199
198
|
|
|
200
199
|
function renderContents(err, data, input, out) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var escapeDoubleQuotes = require("../../../runtime/html/helpers/escape-quotes").o_;
|
|
4
4
|
|
|
5
5
|
module.exports = function (input, out) {
|
|
6
6
|
// We cannot call beginSync() when using renderSync(). In this case we will
|
|
@@ -19,7 +19,7 @@ module.exports = function (input, out) {
|
|
|
19
19
|
|
|
20
20
|
global.__awaitReordererInvoked = true;
|
|
21
21
|
|
|
22
|
-
if (out.global.
|
|
22
|
+
if (out.global.n_) {
|
|
23
23
|
out.flush();
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -30,7 +30,7 @@ module.exports = function (input, out) {
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
out.onLast(function (next) {
|
|
33
|
-
var awaitContext = global.
|
|
33
|
+
var awaitContext = global.n_;
|
|
34
34
|
var remaining;
|
|
35
35
|
|
|
36
36
|
// Validate that we have remaining <await> instances that need handled
|
|
@@ -41,13 +41,18 @@ module.exports = function (input, out) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function handleAwait(awaitInfo) {
|
|
44
|
-
awaitInfo.out.on("
|
|
44
|
+
awaitInfo.out.on("p_", out.emit.bind(out, "p_")).on("finish", function (result) {
|
|
45
45
|
if (!global._afRuntime) {
|
|
46
|
-
|
|
46
|
+
// Minified version of ./client-reorder-runtime.js
|
|
47
|
+
asyncOut.script(`function $af(d,a,e,l,g,h,k,b,f,c){c=$af;if(a&&!c[a])(c[a+="$"]||(c[a]=[])).push(d);else{e=document;l=e.getElementById("af"+d);g=e.getElementById("afph"+d);h=e.createDocumentFragment();k=l.childNodes;b=0;for(f=k.length;b<f;b++)h.appendChild(k.item(0));g&&g.parentNode.replaceChild(h,g);c[d]=1;if(a=c[d+"$"])for(b=0,f=a.length;b<f;b++)c(a[b])}}`);
|
|
47
48
|
global._afRuntime = true;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
if (global.cspNonce) {
|
|
52
|
+
asyncOut.write('<style nonce="' + escapeDoubleQuotes(global.cspNonce) + '">' + "#af" + awaitInfo.id + "{display:none;}" + "</style>" + '<div id="af' + awaitInfo.id + '">' + result.toString() + "</div>");
|
|
53
|
+
} else {
|
|
54
|
+
asyncOut.write('<div id="af' + awaitInfo.id + '" style="display:none">' + result.toString() + "</div>");
|
|
55
|
+
}
|
|
51
56
|
|
|
52
57
|
asyncOut.script("$af(" + (typeof awaitInfo.id === "number" ? awaitInfo.id : '"' + awaitInfo.id + '"') + (awaitInfo.after ? ',"' + awaitInfo.after + '"' : "") + ")");
|
|
53
58
|
|
package/dist/index.js
CHANGED
|
@@ -1,42 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
// the following development and legacy apis should not be included
|
|
4
|
-
// when bundling the server with a tool like webpack
|
|
5
|
-
|
|
6
|
-
if (!process.env.BUNDLE) {
|
|
7
|
-
if (process.env.MARKO_HOT_RELOAD) {
|
|
8
|
-
require("./hot-reload").enable();
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// If process was launched with browser refresh then automatically
|
|
12
|
-
// enable browser-refresh
|
|
13
|
-
require("./browser-refresh").enable();
|
|
14
|
-
|
|
15
|
-
// Adds the template.getDependencies() method needed by older versions of lasso-marko
|
|
16
|
-
require("./runtime/components/legacy/dependencies/html");
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function fixFlush() {
|
|
20
|
-
try {
|
|
21
|
-
var OutgoingMessage = require("http").OutgoingMessage;
|
|
22
|
-
if (OutgoingMessage.prototype.flush && OutgoingMessage.prototype.flush.toString().indexOf("deprecated") !== -1) {
|
|
23
|
-
// Yes, we are monkey-patching http. This method should never have been added and it was introduced on
|
|
24
|
-
// the iojs fork. It was quickly deprecated and I'm 99% sure no one is actually using it.
|
|
25
|
-
// See:
|
|
26
|
-
// - https://github.com/marko-js/async-writer/issues/3
|
|
27
|
-
// - https://github.com/nodejs/node/issues/2920
|
|
28
|
-
//
|
|
29
|
-
// This method causes problems since marko looks for the flush method and calls it found.
|
|
30
|
-
// The `res.flush()` method is introduced by the [compression](https://www.npmjs.com/package/compression)
|
|
31
|
-
// middleware, but, otherwise, it should typically not exist.
|
|
32
|
-
delete require("http").OutgoingMessage.prototype.flush;
|
|
33
|
-
}
|
|
34
|
-
} catch (e) {
|
|
35
|
-
/* ignore error */
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
fixFlush();
|
|
40
|
-
|
|
41
3
|
exports.createOut = require("./runtime/createOut");
|
|
42
|
-
exports.load = require("
|
|
4
|
+
exports.load = require("@internal/loader");
|
|
@@ -8,6 +8,17 @@ const fs = require("fs");
|
|
|
8
8
|
const fsReadOptions = { encoding: "utf8" };
|
|
9
9
|
const MARKO_EXTENSIONS = Symbol("MARKO_EXTENSIONS");
|
|
10
10
|
|
|
11
|
+
if (process.env.MARKO_HOT_RELOAD) {
|
|
12
|
+
require("../hot-reload").enable();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// If process was launched with browser refresh then automatically
|
|
16
|
+
// enable browser-refresh
|
|
17
|
+
require("../browser-refresh").enable();
|
|
18
|
+
|
|
19
|
+
// Adds the template.getDependencies() method needed by older versions of lasso-marko
|
|
20
|
+
require("../runtime/components/legacy/dependencies/html");
|
|
21
|
+
|
|
11
22
|
function normalizeExtension(extension) {
|
|
12
23
|
if (extension.charAt(0) !== ".") {
|
|
13
24
|
extension = "." + extension;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var ComponentDef = require("../../../runtime/components/ComponentDef");
|
|
2
|
+
|
|
3
|
+
module.exports = function beginComponent(componentsContext, component, key, ownerComponentDef) {
|
|
4
|
+
var componentId = component.id;
|
|
5
|
+
var componentDef = componentsContext.q_ = new ComponentDef(component, componentId, componentsContext);
|
|
6
|
+
componentsContext.r_.s_[componentId] = true;
|
|
7
|
+
componentsContext.t_.push(componentDef);
|
|
8
|
+
|
|
9
|
+
var out = componentsContext.u_;
|
|
10
|
+
out.bc(component, key, ownerComponentDef && ownerComponentDef.v_);
|
|
11
|
+
return componentDef;
|
|
12
|
+
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const ComponentDef = require("
|
|
3
|
+
const ComponentDef = require("../../../runtime/components/ComponentDef");
|
|
4
4
|
|
|
5
5
|
var FLAG_WILL_RERENDER_IN_BROWSER = 1;
|
|
6
6
|
// var FLAG_HAS_RENDER_BODY = 2;
|
|
7
|
-
// var FLAG_IS_LEGACY = 4;
|
|
8
7
|
var FLAG_OLD_HYDRATE_NO_CREATE = 8;
|
|
9
8
|
|
|
10
9
|
module.exports = function beginComponent(componentsContext, component, key, ownerComponentDef, isSplitComponent, isImplicitComponent, existingComponentDef) {
|
|
@@ -12,13 +11,14 @@ module.exports = function beginComponent(componentsContext, component, key, owne
|
|
|
12
11
|
|
|
13
12
|
// existingComponentDef is only here to allow binding a conditional
|
|
14
13
|
// widget. It should be removed when the legacy compat layer is removed.
|
|
15
|
-
var componentDef = existingComponentDef || (componentsContext.
|
|
14
|
+
var componentDef = existingComponentDef || (componentsContext.q_ = new ComponentDef(component, componentId, componentsContext));
|
|
16
15
|
|
|
17
|
-
var ownerIsRenderBoundary = ownerComponentDef && ownerComponentDef.
|
|
18
|
-
var ownerWillRerender = ownerComponentDef && ownerComponentDef.
|
|
16
|
+
var ownerIsRenderBoundary = ownerComponentDef && ownerComponentDef.w_;
|
|
17
|
+
var ownerWillRerender = ownerComponentDef && ownerComponentDef.x_ & FLAG_WILL_RERENDER_IN_BROWSER;
|
|
19
18
|
// On the server
|
|
20
|
-
if (!componentsContext.
|
|
21
|
-
componentDef.
|
|
19
|
+
if (!componentsContext.y_ && ownerWillRerender) {
|
|
20
|
+
componentDef.x_ |= FLAG_WILL_RERENDER_IN_BROWSER;
|
|
21
|
+
componentDef._wrr = true;
|
|
22
22
|
return componentDef;
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -29,21 +29,21 @@ module.exports = function beginComponent(componentsContext, component, key, owne
|
|
|
29
29
|
return componentDef;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
componentsContext.
|
|
32
|
+
componentsContext.t_.push(componentDef);
|
|
33
33
|
|
|
34
|
-
let out = componentsContext.
|
|
34
|
+
let out = componentsContext.u_;
|
|
35
35
|
let runtimeId = out.global.runtimeId;
|
|
36
36
|
|
|
37
|
-
componentDef.
|
|
38
|
-
componentDef.
|
|
37
|
+
componentDef.w_ = true;
|
|
38
|
+
componentDef.z_ = componentsContext.y_;
|
|
39
39
|
|
|
40
40
|
if (isSplitComponent === false && out.global.noBrowserRerender !== true) {
|
|
41
|
-
componentDef.
|
|
42
|
-
componentsContext.
|
|
41
|
+
componentDef.x_ |= FLAG_WILL_RERENDER_IN_BROWSER;
|
|
42
|
+
componentsContext.y_ = false;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (out.global.oldHydrateNoCreate === true) {
|
|
46
|
-
componentDef.
|
|
46
|
+
componentDef.x_ |= FLAG_OLD_HYDRATE_NO_CREATE;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
if ((ownerIsRenderBoundary || ownerWillRerender) && key != null) {
|