|
|
@ -12,6 +12,8 @@ export class SsrGenerator extends Generator {
|
|
|
|
bindings: string[];
|
|
|
|
bindings: string[];
|
|
|
|
renderCode: string;
|
|
|
|
renderCode: string;
|
|
|
|
elementDepth: number; // TODO is this necessary? appears to be unused
|
|
|
|
elementDepth: number; // TODO is this necessary? appears to be unused
|
|
|
|
|
|
|
|
appendTargets: Record<string, string> | null;
|
|
|
|
|
|
|
|
appendTarget: string | null;
|
|
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
constructor(
|
|
|
|
parsed: Parsed,
|
|
|
|
parsed: Parsed,
|
|
|
@ -24,6 +26,7 @@ export class SsrGenerator extends Generator {
|
|
|
|
this.bindings = [];
|
|
|
|
this.bindings = [];
|
|
|
|
this.renderCode = '';
|
|
|
|
this.renderCode = '';
|
|
|
|
this.elementDepth = 0;
|
|
|
|
this.elementDepth = 0;
|
|
|
|
|
|
|
|
this.appendTargets = null;
|
|
|
|
|
|
|
|
|
|
|
|
// in an SSR context, we don't need to include events, methods, oncreate or ondestroy
|
|
|
|
// in an SSR context, we don't need to include events, methods, oncreate or ondestroy
|
|
|
|
const { templateProperties, defaultExport } = this;
|
|
|
|
const { templateProperties, defaultExport } = this;
|
|
|
@ -59,7 +62,23 @@ export class SsrGenerator extends Generator {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
append(code: string) {
|
|
|
|
append(code: string) {
|
|
|
|
this.renderCode += code;
|
|
|
|
if (this.appendTarget) {
|
|
|
|
|
|
|
|
this.appendTargets[this.appendTarget] += code;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.renderCode += code;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
removeAppendTarget() {
|
|
|
|
|
|
|
|
this.appendTarget = this.appendTargets = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setAppendTarget(name: string) {
|
|
|
|
|
|
|
|
if (!this.appendTargets[name]) {
|
|
|
|
|
|
|
|
this.appendTargets[name] = '';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.appendTarget = name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|