diff --git a/src/compile/Compiler.ts b/src/compile/Compiler.ts index 690b837d79..4ec97f2f38 100644 --- a/src/compile/Compiler.ts +++ b/src/compile/Compiler.ts @@ -19,7 +19,6 @@ import { test } from '../config'; import Fragment from './nodes/Fragment'; import shared from './shared'; import { DomTarget } from './dom/index'; -import { SsrTarget } from './ssr/index'; import { Node, GenerateOptions, ShorthandImport, Ast, CompileOptions, CustomElementOptions } from '../interfaces'; interface Computation { @@ -137,7 +136,7 @@ export default class Compiler { options: CompileOptions, stats: Stats, dom: boolean, - target: DomTarget | SsrTarget + target?: DomTarget ) { stats.start('compile'); this.stats = stats; diff --git a/src/compile/ssr/index.ts b/src/compile/ssr/index.ts index 3e86967556..a556b40693 100644 --- a/src/compile/ssr/index.ts +++ b/src/compile/ssr/index.ts @@ -3,29 +3,6 @@ import Compiler from '../Compiler'; import Stats from '../../Stats'; import Stylesheet from '../../css/Stylesheet'; import { Ast, CompileOptions } from '../../interfaces'; -import { AppendTarget } from '../../interfaces'; - -export class SsrTarget { - bindings: string[]; - renderCode: string; - appendTargets: AppendTarget[]; - - constructor() { - this.bindings = []; - this.renderCode = ''; - this.appendTargets = []; - } - - append(code: string) { - if (this.appendTargets.length) { - const appendTarget = this.appendTargets[this.appendTargets.length - 1]; - const slotName = appendTarget.slotStack[appendTarget.slotStack.length - 1]; - appendTarget.slots[slotName] += code; - } else { - this.renderCode += code; - } - } -} export default function ssr( ast: Ast, @@ -37,26 +14,4 @@ export default function ssr( const compiler = new Compiler(ast, source, options.name || 'SvelteComponent', stylesheet, options, stats, false); return generate(compiler); -} - -function trim(nodes) { - let start = 0; - for (; start < nodes.length; start += 1) { - const node = nodes[start]; - if (node.type !== 'Text') break; - - node.data = node.data.replace(/^\s+/, ''); - if (node.data) break; - } - - let end = nodes.length; - for (; end > start; end -= 1) { - const node = nodes[end - 1]; - if (node.type !== 'Text') break; - - node.data = node.data.replace(/\s+$/, ''); - if (node.data) break; - } - - return nodes.slice(start, end); -} +} \ No newline at end of file