Skip to content

Commit bf818b3

Browse files
committed
fix cloneDeep issue for epub book too regarding Deno.kv()
1 parent 2c8963a commit bf818b3

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

src/command/render/render-contexts.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,6 @@ import {
8989
import { ExtensionContext } from "../../extension/types.ts";
9090
import { NotebookContext } from "../../render/notebook/notebook-types.ts";
9191

92-
// we can't naively ld.cloneDeep everything
93-
// because that destroys class instances
94-
// with private members
95-
//
96-
// Currently, that's ProjectContext.
97-
//
98-
// TODO: Ideally, we shouldn't be copying the RenderContext at all.
99-
export function copyRenderContext(
100-
context: RenderContext,
101-
): RenderContext {
102-
return {
103-
...ld.cloneDeep(context),
104-
project: context.project,
105-
};
106-
}
10792
export async function resolveFormatsFromMetadata(
10893
metadata: Metadata,
10994
input: string,

src/command/render/render-files.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import { outputRecipe } from "./output.ts";
4848

4949
import { renderPandoc } from "./render.ts";
5050
import { PandocRenderCompletion, RenderServices } from "./types.ts";
51-
import { copyRenderContext, renderContexts } from "./render-contexts.ts";
51+
import { renderContexts } from "./render-contexts.ts";
5252
import { renderProgress } from "./render-info.ts";
5353
import {
5454
ExecutedFile,
@@ -114,6 +114,7 @@ import {
114114
} from "../../project/project-shared.ts";
115115
import { NotebookContext } from "../../render/notebook/notebook-types.ts";
116116
import { setExecuteEnvironment } from "../../execute/environment.ts";
117+
import { safeCloneDeep } from "../../core/safe-clone-deep.ts";
117118

118119
export async function renderExecute(
119120
context: RenderContext,
@@ -503,7 +504,7 @@ async function renderFileInternal(
503504

504505
for (const format of Object.keys(contexts)) {
505506
pushTiming("render-context");
506-
const context = copyRenderContext(contexts[format]); // since we're going to mutate it...
507+
const context = safeCloneDeep(contexts[format]); // since we're going to mutate it...
507508

508509
// disquality some documents from server: shiny
509510
if (isServerShiny(context.format) && context.project) {

0 commit comments

Comments
 (0)