mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-04 21:17:55 +08:00
adjust ssr API so that user can provide server-side implementations for custom directives
This commit is contained in:
parent
3c7aafa17b
commit
4191f251af
@ -9,4 +9,6 @@ general:
|
||||
|
||||
test:
|
||||
override:
|
||||
- npm run test:cover # only run unit tets for now before we setup SauceLabs
|
||||
- npm run lint
|
||||
- npm run test:cover # only run unit tests in Phantom for now before we setup SauceLabs
|
||||
- npm run test:ssr
|
||||
|
@ -5,14 +5,23 @@ import style from 'web/server/modules/style'
|
||||
import show from 'web/server/directives/show'
|
||||
import { isUnaryTag } from 'web/util/index'
|
||||
|
||||
export default createRenderer({
|
||||
isUnaryTag,
|
||||
modules: [
|
||||
const modules = [
|
||||
attrs,
|
||||
klass,
|
||||
style
|
||||
],
|
||||
directives: {
|
||||
]
|
||||
|
||||
const baseDirectives = {
|
||||
show
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export default function publicCreateRenderer (options = {}) {
|
||||
// user can provide server-side implementations for custom directives
|
||||
// when creating the renderer.
|
||||
const directives = Object.assign(baseDirectives, options.directives)
|
||||
return createRenderer({
|
||||
isUnaryTag,
|
||||
modules,
|
||||
directives
|
||||
})
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import Vue from '../../dist/vue.common.js'
|
||||
import { compileToFunctions } from '../../dist/compiler.common.js'
|
||||
import { renderToStream } from '../../dist/server-renderer.js'
|
||||
import createRenderer from '../../dist/server-renderer.js'
|
||||
const { renderToStream } = createRenderer()
|
||||
|
||||
describe('SSR: renderToStream', () => {
|
||||
it('should render to a stream', done => {
|
||||
|
@ -1,6 +1,9 @@
|
||||
import Vue from '../../dist/vue.common.js'
|
||||
import { compileToFunctions } from '../../dist/compiler.common.js'
|
||||
import { renderToString } from '../../dist/server-renderer.js'
|
||||
import createRenderer from '../../dist/server-renderer.js'
|
||||
const { renderToString } = createRenderer()
|
||||
|
||||
// TODO: test custom server-side directives
|
||||
|
||||
describe('SSR: renderToString', () => {
|
||||
it('static attributes', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user