remove some unused code

pull/1718/head
Rich Harris 7 years ago
parent 39a159dc22
commit 8bb8cbf56f

@ -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;

@ -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);
}
}
Loading…
Cancel
Save