vue 2.6.13 → 2.7.0-alpha.2
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 +17 -295
- package/compiler-sfc/index.d.ts +1 -0
- package/compiler-sfc/index.js +1 -0
- package/compiler-sfc/index.mjs +1 -0
- package/compiler-sfc/package.json +5 -0
- package/dist/vue.common.dev.js +11481 -11946
- package/dist/vue.common.prod.js +8 -3
- package/dist/vue.esm.browser.js +11321 -12011
- package/dist/vue.esm.browser.min.js +8 -3
- package/dist/vue.esm.js +11476 -11984
- package/dist/vue.js +11484 -11949
- package/dist/vue.min.js +8 -3
- package/dist/vue.runtime.common.dev.js +8427 -8421
- package/dist/vue.runtime.common.prod.js +8 -3
- package/dist/vue.runtime.esm.js +8436 -8454
- package/dist/vue.runtime.js +8430 -8424
- package/dist/vue.runtime.min.js +8 -3
- package/package.json +88 -111
- package/packages/compiler-sfc/dist/compiler-sfc.js +7 -0
- package/packages/compiler-sfc/node_modules/.bin/parser +17 -0
- package/packages/compiler-sfc/node_modules/.bin/sass +17 -0
- package/packages/compiler-sfc/package.json +30 -0
- package/src/compiler/{codeframe.js → codeframe.ts} +9 -7
- package/src/compiler/codegen/{events.js → events.ts} +21 -41
- package/src/compiler/codegen/{index.js → index.ts} +146 -136
- package/src/compiler/{create-compiler.js → create-compiler.ts} +26 -18
- package/src/compiler/directives/bind.ts +9 -0
- package/src/compiler/directives/{index.js → index.ts} +0 -2
- package/src/compiler/directives/{model.js → model.ts} +15 -18
- package/src/compiler/directives/{on.js → on.ts} +3 -4
- package/src/compiler/{error-detector.js → error-detector.ts} +61 -31
- package/src/compiler/{helpers.js → helpers.ts} +73 -61
- package/src/compiler/{index.js → index.ts} +2 -3
- package/src/compiler/{optimizer.js → optimizer.ts} +30 -23
- package/src/compiler/parser/{entity-decoder.js → entity-decoder.ts} +1 -3
- package/src/compiler/parser/{filter-parser.js → filter-parser.ts} +43 -24
- package/src/compiler/parser/{html-parser.js → html-parser.ts} +50 -29
- package/src/compiler/parser/{index.js → index.ts} +190 -172
- package/src/compiler/parser/{text-parser.js → text-parser.ts} +8 -9
- package/src/compiler/{to-function.js → to-function.ts} +27 -22
- package/src/core/components/{index.js → index.ts} +0 -0
- package/src/core/components/{keep-alive.js → keep-alive.ts} +42 -30
- package/src/core/{config.js → config.ts} +28 -30
- package/src/core/global-api/{assets.js → assets.ts} +8 -7
- package/src/core/global-api/{extend.js → extend.ts} +10 -13
- package/src/core/global-api/{index.js → index.ts} +4 -5
- package/src/core/global-api/{mixin.js → mixin.ts} +2 -3
- package/src/core/global-api/use.ts +23 -0
- package/src/core/{index.js → index.ts} +1 -1
- package/src/core/instance/{events.js → events.ts} +41 -24
- package/src/core/instance/{index.js → index.ts} +9 -5
- package/src/core/instance/{init.js → init.ts} +26 -15
- package/src/core/instance/inject.ts +72 -0
- package/src/core/instance/{lifecycle.js → lifecycle.ts} +86 -44
- package/src/core/instance/{proxy.js → proxy.ts} +29 -24
- package/src/core/instance/render-helpers/{bind-dynamic-keys.js → bind-dynamic-keys.ts} +6 -5
- package/src/core/instance/render-helpers/{bind-object-listeners.js → bind-object-listeners.ts} +4 -8
- package/src/core/instance/render-helpers/{bind-object-props.js → bind-object-props.ts} +12 -17
- package/src/core/instance/render-helpers/{check-keycodes.js → check-keycodes.ts} +5 -7
- package/src/core/instance/render-helpers/{index.js → index.ts} +1 -3
- package/src/core/instance/render-helpers/{render-list.js → render-list.ts} +12 -13
- package/src/core/instance/render-helpers/{render-slot.js → render-slot.ts} +10 -11
- package/src/core/instance/render-helpers/{render-static.js → render-static.ts} +7 -10
- package/src/core/instance/render-helpers/{resolve-filter.js → resolve-filter.ts} +1 -3
- package/src/core/instance/render-helpers/{resolve-scoped-slots.js → resolve-scoped-slots.ts} +11 -8
- package/src/core/instance/render-helpers/{resolve-slots.js → resolve-slots.ts} +12 -11
- package/src/core/instance/{render.js → render.ts} +66 -29
- package/src/core/instance/{state.js → state.ts} +100 -83
- package/src/core/observer/{array.js → array.ts} +11 -2
- package/src/core/observer/{dep.js → dep.ts} +37 -15
- package/src/core/observer/{index.js → index.ts} +137 -71
- package/src/core/observer/{scheduler.js → scheduler.ts} +42 -43
- package/src/core/observer/{traverse.js → traverse.ts} +10 -7
- package/src/core/observer/{watcher.js → watcher.ts} +88 -60
- package/src/core/util/{debug.js → debug.ts} +38 -34
- package/src/core/util/{env.js → env.ts} +27 -30
- package/src/core/util/{error.js → error.ts} +12 -14
- package/src/core/util/{index.js → index.ts} +0 -2
- package/src/core/util/{lang.js → lang.ts} +6 -7
- package/src/core/util/{next-tick.js → next-tick.ts} +16 -10
- package/src/core/util/{options.js → options.ts} +119 -114
- package/src/core/util/{perf.js → perf.ts} +5 -1
- package/src/core/util/{props.js → props.ts} +54 -50
- package/src/core/vdom/{create-component.js → create-component.ts} +51 -50
- package/src/core/vdom/{create-element.js → create-element.ts} +49 -43
- package/src/core/vdom/{create-functional-component.js → create-functional-component.ts} +52 -27
- package/src/core/vdom/helpers/{extract-props.js → extract-props.ts} +18 -18
- package/src/core/vdom/helpers/{get-first-component-child.js → get-first-component-child.ts} +6 -5
- package/src/core/vdom/helpers/{index.js → index.ts} +0 -2
- package/src/core/vdom/helpers/is-async-placeholder.ts +6 -0
- package/src/core/vdom/helpers/{merge-hook.js → merge-hook.ts} +7 -5
- package/src/core/vdom/helpers/{normalize-children.js → normalize-children.ts} +26 -16
- package/src/core/vdom/helpers/{normalize-scoped-slots.js → normalize-scoped-slots.ts} +23 -17
- package/src/core/vdom/helpers/{resolve-async-component.js → resolve-async-component.ts} +29 -37
- package/src/core/vdom/helpers/update-listeners.ts +101 -0
- package/src/core/vdom/modules/{directives.js → directives.ts} +20 -14
- package/src/core/vdom/modules/index.ts +4 -0
- package/src/core/vdom/modules/template-ref.ts +96 -0
- package/src/core/vdom/{patch.js → patch.ts} +239 -138
- package/src/core/vdom/{vnode.js → vnode.ts} +36 -31
- package/src/global.d.ts +15 -0
- package/src/platforms/web/compiler/directives/html.ts +8 -0
- package/src/platforms/web/compiler/directives/{index.js → index.ts} +0 -0
- package/src/platforms/web/compiler/directives/{model.js → model.ts} +47 -41
- package/src/platforms/web/compiler/directives/{text.js → text.ts} +2 -3
- package/src/platforms/web/compiler/{index.js → index.ts} +0 -2
- package/src/platforms/web/compiler/modules/{class.js → class.ts} +10 -15
- package/src/platforms/web/compiler/modules/{index.js → index.ts} +1 -5
- package/src/platforms/web/compiler/modules/{model.js → model.ts} +6 -11
- package/src/platforms/web/compiler/modules/{style.js → style.ts} +9 -14
- package/src/platforms/web/compiler/{options.js → options.ts} +1 -2
- package/src/platforms/web/compiler/{util.js → util.ts} +5 -7
- package/src/platforms/web/entry-compiler-sfc.ts +1 -0
- package/src/platforms/web/{entry-compiler.js → entry-compiler.ts} +1 -3
- package/src/platforms/web/{entry-runtime.js → entry-runtime-esm.ts} +2 -2
- package/src/platforms/web/entry-runtime-with-compiler-esm.ts +5 -0
- package/src/platforms/web/entry-runtime-with-compiler.ts +10 -0
- package/src/platforms/web/entry-runtime.ts +7 -0
- package/src/platforms/web/runtime/{class-util.js → class-util.ts} +2 -4
- package/src/platforms/web/runtime/components/{index.js → index.ts} +0 -0
- package/src/platforms/web/runtime/components/{transition-group.js → transition-group.ts} +59 -46
- package/src/platforms/web/runtime/components/{transition.js → transition.ts} +43 -36
- package/src/platforms/web/runtime/directives/{index.js → index.ts} +0 -0
- package/src/platforms/web/runtime/directives/{model.js → model.ts} +22 -21
- package/src/platforms/web/runtime/directives/{show.js → show.ts} +11 -10
- package/src/platforms/web/runtime/{index.js → index.ts} +9 -10
- package/src/platforms/web/runtime/modules/{attrs.js → attrs.ts} +12 -16
- package/src/platforms/web/runtime/modules/{class.js → class.ts} +7 -18
- package/src/platforms/web/runtime/modules/{dom-props.js → dom-props.ts} +24 -17
- package/src/platforms/web/runtime/modules/{events.js → events.ts} +22 -15
- package/src/platforms/web/runtime/modules/{index.js → index.ts} +1 -8
- package/src/platforms/web/runtime/modules/{style.js → style.ts} +24 -13
- package/src/platforms/web/runtime/modules/{transition.js → transition.ts} +61 -63
- package/src/platforms/web/runtime/node-ops.ts +66 -0
- package/src/platforms/web/runtime/{patch.js → patch.ts} +0 -2
- package/src/platforms/web/runtime/{transition-util.js → transition-util.ts} +63 -38
- package/src/platforms/web/{entry-runtime-with-compiler.js → runtime-with-compiler.ts} +28 -19
- package/src/platforms/web/util/{attrs.js → attrs.ts} +18 -14
- package/src/platforms/web/util/{class.js → class.ts} +23 -21
- package/src/platforms/web/util/{compat.js → compat.ts} +4 -4
- package/src/platforms/web/util/{element.js → element.ts} +21 -22
- package/src/platforms/web/util/{index.js → index.ts} +2 -6
- package/src/platforms/web/util/{style.js → style.ts} +12 -12
- package/src/sfc/{parser.js → parser.ts} +18 -15
- package/src/shared/{constants.js → constants.ts} +2 -6
- package/src/shared/{util.js → util.ts} +78 -55
- package/src/types/compiler.ts +224 -0
- package/src/types/component.ts +209 -0
- package/src/types/global-api.ts +37 -0
- package/src/types/modules.d.ts +15 -0
- package/src/types/options.ts +120 -0
- package/src/types/ssr.ts +27 -0
- package/src/types/utils.ts +3 -0
- package/src/types/vnode.ts +127 -0
- package/src/v3/apiInject.ts +66 -0
- package/src/v3/apiLifecycle.ts +53 -0
- package/src/v3/apiSetup.ts +161 -0
- package/src/v3/apiWatch.ts +355 -0
- package/src/v3/currentInstance.ts +23 -0
- package/src/v3/debug.ts +21 -0
- package/src/v3/h.ts +18 -0
- package/src/v3/index.ts +77 -0
- package/src/v3/reactivity/computed.ts +100 -0
- package/src/v3/reactivity/effect.ts +20 -0
- package/src/v3/reactivity/effectScope.ts +134 -0
- package/src/v3/reactivity/operations.ts +14 -0
- package/src/v3/reactivity/reactive.ts +123 -0
- package/src/v3/reactivity/readonly.ts +121 -0
- package/src/v3/reactivity/ref.ts +249 -0
- package/types/index.d.ts +10 -13
- package/types/options.d.ts +265 -132
- package/types/plugin.d.ts +4 -4
- package/types/umd.d.ts +47 -27
- package/types/v3-generated.d.ts +389 -0
- package/types/v3.d.ts +16 -0
- package/types/vnode.d.ts +70 -57
- package/types/vue.d.ts +292 -88
- package/dist/README.md +0 -122
- package/src/compiler/directives/bind.js +0 -11
- package/src/core/global-api/use.js +0 -23
- package/src/core/instance/inject.js +0 -73
- package/src/core/vdom/helpers/is-async-placeholder.js +0 -5
- package/src/core/vdom/helpers/update-listeners.js +0 -95
- package/src/core/vdom/modules/index.js +0 -7
- package/src/core/vdom/modules/ref.js +0 -45
- package/src/platforms/web/compiler/directives/html.js +0 -9
- package/src/platforms/web/entry-server-basic-renderer.js +0 -13
- package/src/platforms/web/entry-server-renderer.js +0 -27
- package/src/platforms/web/runtime/node-ops.js +0 -59
- package/src/platforms/web/server/compiler.js +0 -11
- package/src/platforms/web/server/directives/index.js +0 -7
- package/src/platforms/web/server/directives/model.js +0 -44
- package/src/platforms/web/server/directives/show.js +0 -12
- package/src/platforms/web/server/modules/attrs.js +0 -67
- package/src/platforms/web/server/modules/class.js +0 -11
- package/src/platforms/web/server/modules/dom-props.js +0 -50
- package/src/platforms/web/server/modules/index.js +0 -11
- package/src/platforms/web/server/modules/style.js +0 -41
- package/src/platforms/web/server/util.js +0 -101
- package/src/platforms/weex/compiler/directives/index.js +0 -5
- package/src/platforms/weex/compiler/directives/model.js +0 -33
- package/src/platforms/weex/compiler/index.js +0 -52
- package/src/platforms/weex/compiler/modules/append.js +0 -27
- package/src/platforms/weex/compiler/modules/class.js +0 -74
- package/src/platforms/weex/compiler/modules/index.js +0 -13
- package/src/platforms/weex/compiler/modules/props.js +0 -37
- package/src/platforms/weex/compiler/modules/recycle-list/component-root.js +0 -13
- package/src/platforms/weex/compiler/modules/recycle-list/component.js +0 -16
- package/src/platforms/weex/compiler/modules/recycle-list/index.js +0 -60
- package/src/platforms/weex/compiler/modules/recycle-list/recycle-list.js +0 -50
- package/src/platforms/weex/compiler/modules/recycle-list/text.js +0 -23
- package/src/platforms/weex/compiler/modules/recycle-list/v-bind.js +0 -21
- package/src/platforms/weex/compiler/modules/recycle-list/v-for.js +0 -33
- package/src/platforms/weex/compiler/modules/recycle-list/v-if.js +0 -63
- package/src/platforms/weex/compiler/modules/recycle-list/v-on.js +0 -25
- package/src/platforms/weex/compiler/modules/recycle-list/v-once.js +0 -19
- package/src/platforms/weex/compiler/modules/style.js +0 -87
- package/src/platforms/weex/entry-compiler.js +0 -2
- package/src/platforms/weex/entry-framework.js +0 -187
- package/src/platforms/weex/entry-runtime-factory.js +0 -6
- package/src/platforms/weex/runtime/components/index.js +0 -9
- package/src/platforms/weex/runtime/components/richtext.js +0 -82
- package/src/platforms/weex/runtime/components/transition-group.js +0 -148
- package/src/platforms/weex/runtime/components/transition.js +0 -9
- package/src/platforms/weex/runtime/directives/index.js +0 -2
- package/src/platforms/weex/runtime/index.js +0 -42
- package/src/platforms/weex/runtime/modules/attrs.js +0 -44
- package/src/platforms/weex/runtime/modules/class.js +0 -76
- package/src/platforms/weex/runtime/modules/events.js +0 -54
- package/src/platforms/weex/runtime/modules/index.js +0 -13
- package/src/platforms/weex/runtime/modules/style.js +0 -84
- package/src/platforms/weex/runtime/modules/transition.js +0 -270
- package/src/platforms/weex/runtime/node-ops.js +0 -91
- package/src/platforms/weex/runtime/patch.js +0 -16
- package/src/platforms/weex/runtime/recycle-list/render-component-template.js +0 -34
- package/src/platforms/weex/runtime/recycle-list/virtual-component.js +0 -136
- package/src/platforms/weex/runtime/text-node.js +0 -9
- package/src/platforms/weex/util/element.js +0 -52
- package/src/platforms/weex/util/index.js +0 -40
- package/src/platforms/weex/util/parser.js +0 -60
- package/src/server/bundle-renderer/create-bundle-renderer.js +0 -151
- package/src/server/bundle-renderer/create-bundle-runner.js +0 -150
- package/src/server/bundle-renderer/source-map-support.js +0 -45
- package/src/server/create-basic-renderer.js +0 -37
- package/src/server/create-renderer.js +0 -152
- package/src/server/optimizing-compiler/codegen.js +0 -264
- package/src/server/optimizing-compiler/index.js +0 -20
- package/src/server/optimizing-compiler/modules.js +0 -124
- package/src/server/optimizing-compiler/optimizer.js +0 -141
- package/src/server/optimizing-compiler/runtime-helpers.js +0 -150
- package/src/server/render-context.js +0 -130
- package/src/server/render-stream.js +0 -95
- package/src/server/render.js +0 -437
- package/src/server/template-renderer/create-async-file-mapper.js +0 -57
- package/src/server/template-renderer/index.js +0 -277
- package/src/server/template-renderer/parse-template.js +0 -42
- package/src/server/template-renderer/template-stream.js +0 -82
- package/src/server/util.js +0 -18
- package/src/server/webpack-plugin/client.js +0 -65
- package/src/server/webpack-plugin/server.js +0 -66
- package/src/server/webpack-plugin/util.js +0 -34
- package/src/server/write.js +0 -50
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
|
-
const path = require('path')
|
|
4
|
-
const serialize = require('serialize-javascript')
|
|
5
|
-
|
|
6
|
-
import { isJS, isCSS } from '../util'
|
|
7
|
-
import TemplateStream from './template-stream'
|
|
8
|
-
import { parseTemplate } from './parse-template'
|
|
9
|
-
import { createMapper } from './create-async-file-mapper'
|
|
10
|
-
import type { ParsedTemplate } from './parse-template'
|
|
11
|
-
import type { AsyncFileMapper } from './create-async-file-mapper'
|
|
12
|
-
|
|
13
|
-
type TemplateRendererOptions = {
|
|
14
|
-
template?: string | (content: string, context: any) => string;
|
|
15
|
-
inject?: boolean;
|
|
16
|
-
clientManifest?: ClientManifest;
|
|
17
|
-
shouldPreload?: (file: string, type: string) => boolean;
|
|
18
|
-
shouldPrefetch?: (file: string, type: string) => boolean;
|
|
19
|
-
serializer?: Function;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type ClientManifest = {
|
|
23
|
-
publicPath: string;
|
|
24
|
-
all: Array<string>;
|
|
25
|
-
initial: Array<string>;
|
|
26
|
-
async: Array<string>;
|
|
27
|
-
modules: {
|
|
28
|
-
[id: string]: Array<number>;
|
|
29
|
-
},
|
|
30
|
-
hasNoCssVersion?: {
|
|
31
|
-
[file: string]: boolean;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
type Resource = {
|
|
36
|
-
file: string;
|
|
37
|
-
extension: string;
|
|
38
|
-
fileWithoutQuery: string;
|
|
39
|
-
asType: string;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export default class TemplateRenderer {
|
|
43
|
-
options: TemplateRendererOptions;
|
|
44
|
-
inject: boolean;
|
|
45
|
-
parsedTemplate: ParsedTemplate | Function | null;
|
|
46
|
-
publicPath: string;
|
|
47
|
-
clientManifest: ClientManifest;
|
|
48
|
-
preloadFiles: Array<Resource>;
|
|
49
|
-
prefetchFiles: Array<Resource>;
|
|
50
|
-
mapFiles: AsyncFileMapper;
|
|
51
|
-
serialize: Function;
|
|
52
|
-
|
|
53
|
-
constructor (options: TemplateRendererOptions) {
|
|
54
|
-
this.options = options
|
|
55
|
-
this.inject = options.inject !== false
|
|
56
|
-
// if no template option is provided, the renderer is created
|
|
57
|
-
// as a utility object for rendering assets like preload links and scripts.
|
|
58
|
-
|
|
59
|
-
const { template } = options
|
|
60
|
-
this.parsedTemplate = template
|
|
61
|
-
? typeof template === 'string'
|
|
62
|
-
? parseTemplate(template)
|
|
63
|
-
: template
|
|
64
|
-
: null
|
|
65
|
-
|
|
66
|
-
// function used to serialize initial state JSON
|
|
67
|
-
this.serialize = options.serializer || (state => {
|
|
68
|
-
return serialize(state, { isJSON: true })
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
// extra functionality with client manifest
|
|
72
|
-
if (options.clientManifest) {
|
|
73
|
-
const clientManifest = this.clientManifest = options.clientManifest
|
|
74
|
-
// ensure publicPath ends with /
|
|
75
|
-
this.publicPath = clientManifest.publicPath === ''
|
|
76
|
-
? ''
|
|
77
|
-
: clientManifest.publicPath.replace(/([^\/])$/, '$1/')
|
|
78
|
-
// preload/prefetch directives
|
|
79
|
-
this.preloadFiles = (clientManifest.initial || []).map(normalizeFile)
|
|
80
|
-
this.prefetchFiles = (clientManifest.async || []).map(normalizeFile)
|
|
81
|
-
// initial async chunk mapping
|
|
82
|
-
this.mapFiles = createMapper(clientManifest)
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
bindRenderFns (context: Object) {
|
|
87
|
-
const renderer: any = this
|
|
88
|
-
;['ResourceHints', 'State', 'Scripts', 'Styles'].forEach(type => {
|
|
89
|
-
context[`render${type}`] = renderer[`render${type}`].bind(renderer, context)
|
|
90
|
-
})
|
|
91
|
-
// also expose getPreloadFiles, useful for HTTP/2 push
|
|
92
|
-
context.getPreloadFiles = renderer.getPreloadFiles.bind(renderer, context)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// render synchronously given rendered app content and render context
|
|
96
|
-
render (content: string, context: ?Object): string | Promise<string> {
|
|
97
|
-
const template = this.parsedTemplate
|
|
98
|
-
if (!template) {
|
|
99
|
-
throw new Error('render cannot be called without a template.')
|
|
100
|
-
}
|
|
101
|
-
context = context || {}
|
|
102
|
-
|
|
103
|
-
if (typeof template === 'function') {
|
|
104
|
-
return template(content, context)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (this.inject) {
|
|
108
|
-
return (
|
|
109
|
-
template.head(context) +
|
|
110
|
-
(context.head || '') +
|
|
111
|
-
this.renderResourceHints(context) +
|
|
112
|
-
this.renderStyles(context) +
|
|
113
|
-
template.neck(context) +
|
|
114
|
-
content +
|
|
115
|
-
this.renderState(context) +
|
|
116
|
-
this.renderScripts(context) +
|
|
117
|
-
template.tail(context)
|
|
118
|
-
)
|
|
119
|
-
} else {
|
|
120
|
-
return (
|
|
121
|
-
template.head(context) +
|
|
122
|
-
template.neck(context) +
|
|
123
|
-
content +
|
|
124
|
-
template.tail(context)
|
|
125
|
-
)
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
renderStyles (context: Object): string {
|
|
130
|
-
const initial = this.preloadFiles || []
|
|
131
|
-
const async = this.getUsedAsyncFiles(context) || []
|
|
132
|
-
const cssFiles = initial.concat(async).filter(({ file }) => isCSS(file))
|
|
133
|
-
return (
|
|
134
|
-
// render links for css files
|
|
135
|
-
(cssFiles.length
|
|
136
|
-
? cssFiles.map(({ file }) => `<link rel="stylesheet" href="${this.publicPath}${file}">`).join('')
|
|
137
|
-
: '') +
|
|
138
|
-
// context.styles is a getter exposed by vue-style-loader which contains
|
|
139
|
-
// the inline component styles collected during SSR
|
|
140
|
-
(context.styles || '')
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
renderResourceHints (context: Object): string {
|
|
145
|
-
return this.renderPreloadLinks(context) + this.renderPrefetchLinks(context)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
getPreloadFiles (context: Object): Array<Resource> {
|
|
149
|
-
const usedAsyncFiles = this.getUsedAsyncFiles(context)
|
|
150
|
-
if (this.preloadFiles || usedAsyncFiles) {
|
|
151
|
-
return (this.preloadFiles || []).concat(usedAsyncFiles || [])
|
|
152
|
-
} else {
|
|
153
|
-
return []
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
renderPreloadLinks (context: Object): string {
|
|
158
|
-
const files = this.getPreloadFiles(context)
|
|
159
|
-
const shouldPreload = this.options.shouldPreload
|
|
160
|
-
if (files.length) {
|
|
161
|
-
return files.map(({ file, extension, fileWithoutQuery, asType }) => {
|
|
162
|
-
let extra = ''
|
|
163
|
-
// by default, we only preload scripts or css
|
|
164
|
-
if (!shouldPreload && asType !== 'script' && asType !== 'style') {
|
|
165
|
-
return ''
|
|
166
|
-
}
|
|
167
|
-
// user wants to explicitly control what to preload
|
|
168
|
-
if (shouldPreload && !shouldPreload(fileWithoutQuery, asType)) {
|
|
169
|
-
return ''
|
|
170
|
-
}
|
|
171
|
-
if (asType === 'font') {
|
|
172
|
-
extra = ` type="font/${extension}" crossorigin`
|
|
173
|
-
}
|
|
174
|
-
return `<link rel="preload" href="${
|
|
175
|
-
this.publicPath}${file
|
|
176
|
-
}"${
|
|
177
|
-
asType !== '' ? ` as="${asType}"` : ''
|
|
178
|
-
}${
|
|
179
|
-
extra
|
|
180
|
-
}>`
|
|
181
|
-
}).join('')
|
|
182
|
-
} else {
|
|
183
|
-
return ''
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
renderPrefetchLinks (context: Object): string {
|
|
188
|
-
const shouldPrefetch = this.options.shouldPrefetch
|
|
189
|
-
if (this.prefetchFiles) {
|
|
190
|
-
const usedAsyncFiles = this.getUsedAsyncFiles(context)
|
|
191
|
-
const alreadyRendered = file => {
|
|
192
|
-
return usedAsyncFiles && usedAsyncFiles.some(f => f.file === file)
|
|
193
|
-
}
|
|
194
|
-
return this.prefetchFiles.map(({ file, fileWithoutQuery, asType }) => {
|
|
195
|
-
if (shouldPrefetch && !shouldPrefetch(fileWithoutQuery, asType)) {
|
|
196
|
-
return ''
|
|
197
|
-
}
|
|
198
|
-
if (alreadyRendered(file)) {
|
|
199
|
-
return ''
|
|
200
|
-
}
|
|
201
|
-
return `<link rel="prefetch" href="${this.publicPath}${file}">`
|
|
202
|
-
}).join('')
|
|
203
|
-
} else {
|
|
204
|
-
return ''
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
renderState (context: Object, options?: Object): string {
|
|
209
|
-
const {
|
|
210
|
-
contextKey = 'state',
|
|
211
|
-
windowKey = '__INITIAL_STATE__'
|
|
212
|
-
} = options || {}
|
|
213
|
-
const state = this.serialize(context[contextKey])
|
|
214
|
-
const autoRemove = process.env.NODE_ENV === 'production'
|
|
215
|
-
? ';(function(){var s;(s=document.currentScript||document.scripts[document.scripts.length-1]).parentNode.removeChild(s);}());'
|
|
216
|
-
: ''
|
|
217
|
-
const nonceAttr = context.nonce ? ` nonce="${context.nonce}"` : ''
|
|
218
|
-
return context[contextKey]
|
|
219
|
-
? `<script${nonceAttr}>window.${windowKey}=${state}${autoRemove}</script>`
|
|
220
|
-
: ''
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
renderScripts (context: Object): string {
|
|
224
|
-
if (this.clientManifest) {
|
|
225
|
-
const initial = this.preloadFiles.filter(({ file }) => isJS(file))
|
|
226
|
-
const async = (this.getUsedAsyncFiles(context) || []).filter(({ file }) => isJS(file))
|
|
227
|
-
const needed = [initial[0]].concat(async, initial.slice(1))
|
|
228
|
-
return needed.map(({ file }) => {
|
|
229
|
-
return `<script src="${this.publicPath}${file}" defer></script>`
|
|
230
|
-
}).join('')
|
|
231
|
-
} else {
|
|
232
|
-
return ''
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
getUsedAsyncFiles (context: Object): ?Array<Resource> {
|
|
237
|
-
if (!context._mappedFiles && context._registeredComponents && this.mapFiles) {
|
|
238
|
-
const registered = Array.from(context._registeredComponents)
|
|
239
|
-
context._mappedFiles = this.mapFiles(registered).map(normalizeFile)
|
|
240
|
-
}
|
|
241
|
-
return context._mappedFiles
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// create a transform stream
|
|
245
|
-
createStream (context: ?Object): TemplateStream {
|
|
246
|
-
if (!this.parsedTemplate) {
|
|
247
|
-
throw new Error('createStream cannot be called without a template.')
|
|
248
|
-
}
|
|
249
|
-
return new TemplateStream(this, this.parsedTemplate, context || {})
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
function normalizeFile (file: string): Resource {
|
|
254
|
-
const withoutQuery = file.replace(/\?.*/, '')
|
|
255
|
-
const extension = path.extname(withoutQuery).slice(1)
|
|
256
|
-
return {
|
|
257
|
-
file,
|
|
258
|
-
extension,
|
|
259
|
-
fileWithoutQuery: withoutQuery,
|
|
260
|
-
asType: getPreloadType(extension)
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
function getPreloadType (ext: string): string {
|
|
265
|
-
if (ext === 'js') {
|
|
266
|
-
return 'script'
|
|
267
|
-
} else if (ext === 'css') {
|
|
268
|
-
return 'style'
|
|
269
|
-
} else if (/jpe?g|png|svg|gif|webp|ico/.test(ext)) {
|
|
270
|
-
return 'image'
|
|
271
|
-
} else if (/woff2?|ttf|otf|eot/.test(ext)) {
|
|
272
|
-
return 'font'
|
|
273
|
-
} else {
|
|
274
|
-
// not exhausting all possibilities here, but above covers common cases
|
|
275
|
-
return ''
|
|
276
|
-
}
|
|
277
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
|
-
const compile = require('lodash.template')
|
|
4
|
-
const compileOptions = {
|
|
5
|
-
escape: /{{([^{][\s\S]+?[^}])}}/g,
|
|
6
|
-
interpolate: /{{{([\s\S]+?)}}}/g
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type ParsedTemplate = {
|
|
10
|
-
head: (data: any) => string;
|
|
11
|
-
neck: (data: any) => string;
|
|
12
|
-
tail: (data: any) => string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export function parseTemplate (
|
|
16
|
-
template: string,
|
|
17
|
-
contentPlaceholder?: string = '<!--vue-ssr-outlet-->'
|
|
18
|
-
): ParsedTemplate {
|
|
19
|
-
if (typeof template === 'object') {
|
|
20
|
-
return template
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
let i = template.indexOf('</head>')
|
|
24
|
-
const j = template.indexOf(contentPlaceholder)
|
|
25
|
-
|
|
26
|
-
if (j < 0) {
|
|
27
|
-
throw new Error(`Content placeholder not found in template.`)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (i < 0) {
|
|
31
|
-
i = template.indexOf('<body>')
|
|
32
|
-
if (i < 0) {
|
|
33
|
-
i = j
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
head: compile(template.slice(0, i), compileOptions),
|
|
39
|
-
neck: compile(template.slice(i, j), compileOptions),
|
|
40
|
-
tail: compile(template.slice(j + contentPlaceholder.length), compileOptions)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
|
-
const Transform = require('stream').Transform
|
|
4
|
-
import type TemplateRenderer from './index'
|
|
5
|
-
import type { ParsedTemplate } from './parse-template'
|
|
6
|
-
|
|
7
|
-
export default class TemplateStream extends Transform {
|
|
8
|
-
started: boolean;
|
|
9
|
-
renderer: TemplateRenderer;
|
|
10
|
-
template: ParsedTemplate;
|
|
11
|
-
context: Object;
|
|
12
|
-
inject: boolean;
|
|
13
|
-
|
|
14
|
-
constructor (
|
|
15
|
-
renderer: TemplateRenderer,
|
|
16
|
-
template: ParsedTemplate,
|
|
17
|
-
context: Object
|
|
18
|
-
) {
|
|
19
|
-
super()
|
|
20
|
-
this.started = false
|
|
21
|
-
this.renderer = renderer
|
|
22
|
-
this.template = template
|
|
23
|
-
this.context = context || {}
|
|
24
|
-
this.inject = renderer.inject
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
_transform (data: Buffer | string, encoding: string, done: Function) {
|
|
28
|
-
if (!this.started) {
|
|
29
|
-
this.emit('beforeStart')
|
|
30
|
-
this.start()
|
|
31
|
-
}
|
|
32
|
-
this.push(data)
|
|
33
|
-
done()
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
start () {
|
|
37
|
-
this.started = true
|
|
38
|
-
this.push(this.template.head(this.context))
|
|
39
|
-
|
|
40
|
-
if (this.inject) {
|
|
41
|
-
// inline server-rendered head meta information
|
|
42
|
-
if (this.context.head) {
|
|
43
|
-
this.push(this.context.head)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// inline preload/prefetch directives for initial/async chunks
|
|
47
|
-
const links = this.renderer.renderResourceHints(this.context)
|
|
48
|
-
if (links) {
|
|
49
|
-
this.push(links)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// CSS files and inline server-rendered CSS collected by vue-style-loader
|
|
53
|
-
const styles = this.renderer.renderStyles(this.context)
|
|
54
|
-
if (styles) {
|
|
55
|
-
this.push(styles)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
this.push(this.template.neck(this.context))
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
_flush (done: Function) {
|
|
63
|
-
this.emit('beforeEnd')
|
|
64
|
-
|
|
65
|
-
if (this.inject) {
|
|
66
|
-
// inline initial store state
|
|
67
|
-
const state = this.renderer.renderState(this.context)
|
|
68
|
-
if (state) {
|
|
69
|
-
this.push(state)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// embed scripts needed
|
|
73
|
-
const scripts = this.renderer.renderScripts(this.context)
|
|
74
|
-
if (scripts) {
|
|
75
|
-
this.push(scripts)
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
this.push(this.template.tail(this.context))
|
|
80
|
-
done()
|
|
81
|
-
}
|
|
82
|
-
}
|
package/src/server/util.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
|
-
export const isJS = (file: string): boolean => /\.js(\?[^.]+)?$/.test(file)
|
|
4
|
-
|
|
5
|
-
export const isCSS = (file: string): boolean => /\.css(\?[^.]+)?$/.test(file)
|
|
6
|
-
|
|
7
|
-
export function createPromiseCallback () {
|
|
8
|
-
let resolve, reject
|
|
9
|
-
const promise: Promise<string> = new Promise((_resolve, _reject) => {
|
|
10
|
-
resolve = _resolve
|
|
11
|
-
reject = _reject
|
|
12
|
-
})
|
|
13
|
-
const cb = (err: Error, res?: string) => {
|
|
14
|
-
if (err) return reject(err)
|
|
15
|
-
resolve(res || '')
|
|
16
|
-
}
|
|
17
|
-
return { promise, cb }
|
|
18
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
const hash = require('hash-sum')
|
|
2
|
-
const uniq = require('lodash.uniq')
|
|
3
|
-
import { isJS, isCSS, onEmit } from './util'
|
|
4
|
-
|
|
5
|
-
export default class VueSSRClientPlugin {
|
|
6
|
-
constructor (options = {}) {
|
|
7
|
-
this.options = Object.assign({
|
|
8
|
-
filename: 'vue-ssr-client-manifest.json'
|
|
9
|
-
}, options)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
apply (compiler) {
|
|
13
|
-
onEmit(compiler, 'vue-client-plugin', (compilation, cb) => {
|
|
14
|
-
const stats = compilation.getStats().toJson()
|
|
15
|
-
|
|
16
|
-
const allFiles = uniq(stats.assets
|
|
17
|
-
.map(a => a.name))
|
|
18
|
-
|
|
19
|
-
const initialFiles = uniq(Object.keys(stats.entrypoints)
|
|
20
|
-
.map(name => stats.entrypoints[name].assets)
|
|
21
|
-
.reduce((assets, all) => all.concat(assets), [])
|
|
22
|
-
.filter((file) => isJS(file) || isCSS(file)))
|
|
23
|
-
|
|
24
|
-
const asyncFiles = allFiles
|
|
25
|
-
.filter((file) => isJS(file) || isCSS(file))
|
|
26
|
-
.filter(file => initialFiles.indexOf(file) < 0)
|
|
27
|
-
|
|
28
|
-
const manifest = {
|
|
29
|
-
publicPath: stats.publicPath,
|
|
30
|
-
all: allFiles,
|
|
31
|
-
initial: initialFiles,
|
|
32
|
-
async: asyncFiles,
|
|
33
|
-
modules: { /* [identifier: string]: Array<index: number> */ }
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const assetModules = stats.modules.filter(m => m.assets.length)
|
|
37
|
-
const fileToIndex = file => manifest.all.indexOf(file)
|
|
38
|
-
stats.modules.forEach(m => {
|
|
39
|
-
// ignore modules duplicated in multiple chunks
|
|
40
|
-
if (m.chunks.length === 1) {
|
|
41
|
-
const cid = m.chunks[0]
|
|
42
|
-
const chunk = stats.chunks.find(c => c.id === cid)
|
|
43
|
-
if (!chunk || !chunk.files) {
|
|
44
|
-
return
|
|
45
|
-
}
|
|
46
|
-
const id = m.identifier.replace(/\s\w+$/, '') // remove appended hash
|
|
47
|
-
const files = manifest.modules[hash(id)] = chunk.files.map(fileToIndex)
|
|
48
|
-
// find all asset modules associated with the same chunk
|
|
49
|
-
assetModules.forEach(m => {
|
|
50
|
-
if (m.chunks.some(id => id === cid)) {
|
|
51
|
-
files.push.apply(files, m.assets.map(fileToIndex))
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
const json = JSON.stringify(manifest, null, 2)
|
|
58
|
-
compilation.assets[this.options.filename] = {
|
|
59
|
-
source: () => json,
|
|
60
|
-
size: () => json.length
|
|
61
|
-
}
|
|
62
|
-
cb()
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { validate, isJS, onEmit } from './util'
|
|
2
|
-
|
|
3
|
-
export default class VueSSRServerPlugin {
|
|
4
|
-
constructor (options = {}) {
|
|
5
|
-
this.options = Object.assign({
|
|
6
|
-
filename: 'vue-ssr-server-bundle.json'
|
|
7
|
-
}, options)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
apply (compiler) {
|
|
11
|
-
validate(compiler)
|
|
12
|
-
|
|
13
|
-
onEmit(compiler, 'vue-server-plugin', (compilation, cb) => {
|
|
14
|
-
const stats = compilation.getStats().toJson()
|
|
15
|
-
const entryName = Object.keys(stats.entrypoints)[0]
|
|
16
|
-
const entryInfo = stats.entrypoints[entryName]
|
|
17
|
-
|
|
18
|
-
if (!entryInfo) {
|
|
19
|
-
// #5553
|
|
20
|
-
return cb()
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const entryAssets = entryInfo.assets.filter(isJS)
|
|
24
|
-
|
|
25
|
-
if (entryAssets.length > 1) {
|
|
26
|
-
throw new Error(
|
|
27
|
-
`Server-side bundle should have one single entry file. ` +
|
|
28
|
-
`Avoid using CommonsChunkPlugin in the server config.`
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const entry = entryAssets[0]
|
|
33
|
-
if (!entry || typeof entry !== 'string') {
|
|
34
|
-
throw new Error(
|
|
35
|
-
`Entry "${entryName}" not found. Did you specify the correct entry option?`
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const bundle = {
|
|
40
|
-
entry,
|
|
41
|
-
files: {},
|
|
42
|
-
maps: {}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
stats.assets.forEach(asset => {
|
|
46
|
-
if (isJS(asset.name)) {
|
|
47
|
-
bundle.files[asset.name] = compilation.assets[asset.name].source()
|
|
48
|
-
} else if (asset.name.match(/\.js\.map$/)) {
|
|
49
|
-
bundle.maps[asset.name.replace(/\.map$/, '')] = JSON.parse(compilation.assets[asset.name].source())
|
|
50
|
-
}
|
|
51
|
-
// do not emit anything else for server
|
|
52
|
-
delete compilation.assets[asset.name]
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
const json = JSON.stringify(bundle, null, 2)
|
|
56
|
-
const filename = this.options.filename
|
|
57
|
-
|
|
58
|
-
compilation.assets[filename] = {
|
|
59
|
-
source: () => json,
|
|
60
|
-
size: () => json.length
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
cb()
|
|
64
|
-
})
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
const { red, yellow } = require('chalk')
|
|
2
|
-
|
|
3
|
-
const prefix = `[vue-server-renderer-webpack-plugin]`
|
|
4
|
-
const warn = exports.warn = msg => console.error(red(`${prefix} ${msg}\n`))
|
|
5
|
-
const tip = exports.tip = msg => console.log(yellow(`${prefix} ${msg}\n`))
|
|
6
|
-
|
|
7
|
-
export const validate = compiler => {
|
|
8
|
-
if (compiler.options.target !== 'node') {
|
|
9
|
-
warn('webpack config `target` should be "node".')
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (compiler.options.output && compiler.options.output.libraryTarget !== 'commonjs2') {
|
|
13
|
-
warn('webpack config `output.libraryTarget` should be "commonjs2".')
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (!compiler.options.externals) {
|
|
17
|
-
tip(
|
|
18
|
-
'It is recommended to externalize dependencies in the server build for ' +
|
|
19
|
-
'better build performance.'
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const onEmit = (compiler, name, hook) => {
|
|
25
|
-
if (compiler.hooks) {
|
|
26
|
-
// Webpack >= 4.0.0
|
|
27
|
-
compiler.hooks.emit.tapAsync(name, hook)
|
|
28
|
-
} else {
|
|
29
|
-
// Webpack < 4.0.0
|
|
30
|
-
compiler.plugin('emit', hook)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { isJS, isCSS } from '../util'
|
package/src/server/write.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
|
-
const MAX_STACK_DEPTH = 800
|
|
4
|
-
const noop = _ => _
|
|
5
|
-
|
|
6
|
-
const defer = typeof process !== 'undefined' && process.nextTick
|
|
7
|
-
? process.nextTick
|
|
8
|
-
: typeof Promise !== 'undefined'
|
|
9
|
-
? fn => Promise.resolve().then(fn)
|
|
10
|
-
: typeof setTimeout !== 'undefined'
|
|
11
|
-
? setTimeout
|
|
12
|
-
: noop
|
|
13
|
-
|
|
14
|
-
if (defer === noop) {
|
|
15
|
-
throw new Error(
|
|
16
|
-
'Your JavaScript runtime does not support any asynchronous primitives ' +
|
|
17
|
-
'that are required by vue-server-renderer. Please use a polyfill for ' +
|
|
18
|
-
'either Promise or setTimeout.'
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function createWriteFunction (
|
|
23
|
-
write: (text: string, next: Function) => boolean,
|
|
24
|
-
onError: Function
|
|
25
|
-
): Function {
|
|
26
|
-
let stackDepth = 0
|
|
27
|
-
const cachedWrite = (text, next) => {
|
|
28
|
-
if (text && cachedWrite.caching) {
|
|
29
|
-
cachedWrite.cacheBuffer[cachedWrite.cacheBuffer.length - 1] += text
|
|
30
|
-
}
|
|
31
|
-
const waitForNext = write(text, next)
|
|
32
|
-
if (waitForNext !== true) {
|
|
33
|
-
if (stackDepth >= MAX_STACK_DEPTH) {
|
|
34
|
-
defer(() => {
|
|
35
|
-
try { next() } catch (e) {
|
|
36
|
-
onError(e)
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
} else {
|
|
40
|
-
stackDepth++
|
|
41
|
-
next()
|
|
42
|
-
stackDepth--
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
cachedWrite.caching = false
|
|
47
|
-
cachedWrite.cacheBuffer = []
|
|
48
|
-
cachedWrite.componentBuffer = []
|
|
49
|
-
return cachedWrite
|
|
50
|
-
}
|