mirror of https://github.com/sveltejs/svelte
parent
0b8cf4cef7
commit
5cbe6b764a
@ -1,6 +1,9 @@
|
||||
import visitors from './visitors/index';
|
||||
import { SsrGenerator } from './index';
|
||||
import Block from './Block';
|
||||
import { Node } from '../../interfaces';
|
||||
|
||||
export default function visit ( generator, fragment, node ) {
|
||||
export default function visit ( generator: SsrGenerator, block: Block, node: Node ) {
|
||||
const visitor = visitors[ node.type ];
|
||||
visitor( generator, fragment, node );
|
||||
visitor( generator, block, node );
|
||||
}
|
@ -1,4 +1,8 @@
|
||||
export default function visitMustacheTag ( generator, block, node ) {
|
||||
import { SsrGenerator } from '../index';
|
||||
import Block from '../Block';
|
||||
import { Node } from '../../../interfaces';
|
||||
|
||||
export default function visitMustacheTag ( generator: SsrGenerator, block: Block, node: Node ) {
|
||||
const { snippet } = block.contextualise( node.expression );
|
||||
generator.append( '${__escape( ' + snippet + ' )}' );
|
||||
}
|
@ -1,4 +1,8 @@
|
||||
export default function visitRawMustacheTag ( generator, block, node ) {
|
||||
import { SsrGenerator } from '../index';
|
||||
import Block from '../Block';
|
||||
import { Node } from '../../../interfaces';
|
||||
|
||||
export default function visitRawMustacheTag ( generator: SsrGenerator, block: Block, node: Node ) {
|
||||
const { snippet } = block.contextualise( node.expression );
|
||||
generator.append( '${' + snippet + '}' );
|
||||
}
|
@ -1,3 +1,7 @@
|
||||
export default function visitText ( generator, block, node ) {
|
||||
import { SsrGenerator } from '../index';
|
||||
import Block from '../Block';
|
||||
import { Node } from '../../../interfaces';
|
||||
|
||||
export default function visitText ( generator: SsrGenerator, block: Block, node: Node ) {
|
||||
generator.append( node.data.replace( /\${/g, '\\${' ) );
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
export default function visitYieldTag ( generator ) {
|
||||
import { SsrGenerator } from '../index';
|
||||
|
||||
export default function visitYieldTag ( generator: SsrGenerator ) {
|
||||
generator.append( `\${options && options.yield ? options.yield() : ''}` );
|
||||
}
|
Loading…
Reference in new issue