Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fileReflection = fileInfo.reflection as typedoc.DeclarationReflection;
const targetReflection = targetInfo.reflection as typedoc.ContainerReflection;
const childReflections = reflections.filter((reflection) => reflection.parent === fileReflection);
for (let i = 0; i < childReflections.length; i += 1) {
const childReflection = childReflections[i] as typedoc.DeclarationReflection;
childReflection.parent = targetReflection;
if (!targetReflection.children) {
targetReflection.children = [];
}
targetReflection.children!.push(childReflection);
}
if (fileReflection.children) {
fileReflection.children.length = 0;
}
CommentPlugin.removeReflection(context.project, fileReflection);
}
if (rootTarget.project.umbrella) {
for (let i = 0; i < targets.length; i += 1) {
const target = targets[i];
const targetReflection = targetReflections[target.uid]!.reflection as typedoc.ContainerReflection;
if (targetReflection !== rootReflection && target.project.umbrella) {
// add library reflections to parent framework reflection
const targetDeps = target.deps;
for (let j = 0; j < targetDeps.length; j += 1) {
const targetDep = targetDeps[j];
const depReflection = targetReflections[targetDep.uid]!.reflection as typedoc.DeclarationReflection;
const oldParentReflection = depReflection.parent as typedoc.ContainerReflection | undefined;
if (oldParentReflection && oldParentReflection.children) {
const index = oldParentReflection.children.indexOf(depReflection);
if (index >= 0) {
} else {
// lift root library reflections into project reflection
const childReflections = reflections.filter((reflection) => reflection.parent === rootReflection);
for (let i = 0; i < childReflections.length; i += 1) {
const childReflection = childReflections[i] as typedoc.DeclarationReflection;
childReflection.parent = context.project;
if (!context.project.children) {
context.project.children = [];
}
context.project.children!.push(childReflection);
}
if (rootReflection.children) {
rootReflection.children.length = 0;
}
context.project.comment = rootReflection.comment;
CommentPlugin.removeReflection(context.project, rootReflection);
for (const targetName in targetReflections) {
const targetInfo = targetReflections[targetName]!;
CommentPlugin.removeReflection(context.project, targetInfo.reflection!);
}
}
}
}
const fileReflection = fileInfo.reflection as DeclarationReflection;
const targetReflection = targetInfo.reflection as ContainerReflection;
const childReflections = reflections.filter((reflection) => reflection.parent === fileReflection);
for (let i = 0; i < childReflections.length; i += 1) {
const childReflection = childReflections[i] as DeclarationReflection;
childReflection.parent = targetReflection;
if (!targetReflection.children) {
targetReflection.children = [];
}
targetReflection.children!.push(childReflection);
}
if (fileReflection.children) {
fileReflection.children.length = 0;
}
CommentPlugin.removeReflection(context.project, fileReflection);
}
if (rootTarget.project.umbrella) {
CommentPlugin.removeReflection(context.project, rootReflection);
} else {
// lift root library reflections into project reflection
const childReflections = reflections.filter((reflection) => reflection.parent === rootReflection);
for (let i = 0; i < childReflections.length; i += 1) {
const childReflection = childReflections[i] as DeclarationReflection;
childReflection.parent = context.project;
if (!context.project.children) {
context.project.children = [];
}
context.project.children!.push(childReflection);
}
if (rootReflection.children) {
const childReflection = childReflections[i] as DeclarationReflection;
childReflection.parent = context.project;
if (!context.project.children) {
context.project.children = [];
}
context.project.children!.push(childReflection);
}
if (rootReflection.children) {
rootReflection.children.length = 0;
}
context.project.comment = rootReflection.comment;
CommentPlugin.removeReflection(context.project, rootReflection);
for (const targetName in targetReflections) {
const targetInfo = targetReflections[targetName]!;
CommentPlugin.removeReflection(context.project, targetInfo.reflection!);
}
}
}
}
private removeReflectionFromProject(reflection: Reflection, project: ProjectReflection) {
CommentPlugin.removeReflection(project, reflection)
if (reflection.parent && (reflection.parent.kind & ReflectionKind.FunctionOrMethod)) {
CommentPlugin.removeReflection(project, reflection.parent)
}
}
}
arr.forEach(x => {
let remove = false;
if (x.flags.isExternal) {
x.flags.isExternal = false;
}
remove = !x.flags.isExported || x.flags.isPrivate;
if (remove) {
CommentPlugin.removeReflection(context.project, x);
}
});
private removeReflectionFromProject(reflection: Reflection, project: ProjectReflection) {
CommentPlugin.removeReflection(project, reflection)
if (reflection.parent && (reflection.parent.kind & ReflectionKind.FunctionOrMethod)) {
CommentPlugin.removeReflection(project, reflection.parent)
}
}
}
const childReflection = childReflections[i] as typedoc.DeclarationReflection;
childReflection.parent = context.project;
if (!context.project.children) {
context.project.children = [];
}
context.project.children!.push(childReflection);
}
if (rootReflection.children) {
rootReflection.children.length = 0;
}
context.project.comment = rootReflection.comment;
CommentPlugin.removeReflection(context.project, rootReflection);
for (const targetName in targetReflections) {
const targetInfo = targetReflections[targetName]!;
CommentPlugin.removeReflection(context.project, targetInfo.reflection!);
}
}
}
}