Skip to content

Commit 2ac7de7

Browse files
committed
more zod types
1 parent a41de51 commit 2ac7de7

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/project/project-shared.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ import { normalizeNewlines } from "../core/lib/text.ts";
4747
import { DirectiveCell } from "../core/lib/break-quarto-md-types.ts";
4848
import { QuartoJSONSchema, readYamlFromMarkdown } from "../core/yaml.ts";
4949
import { refSchema } from "../core/lib/yaml-schema/common.ts";
50-
import {
51-
BrandPathBoolLightDark,
52-
Zod,
53-
} from "../resources/types/zod/schema-types.ts";
50+
import { Zod } from "../resources/types/zod/schema-types.ts";
5451
import { Brand } from "../core/brand/brand.ts";
5552
import { assert } from "testing/asserts";
5653

@@ -547,7 +544,7 @@ export async function projectResolveBrand(
547544
let fileNames = ["_brand.yml", "_brand.yaml"].map((file) =>
548545
join(project.dir, file)
549546
);
550-
let brand = project?.config?.brand as Boolean | string | {
547+
const brand = project?.config?.brand as boolean | string | {
551548
light?: string;
552549
dark?: string;
553550
};
@@ -582,7 +579,7 @@ export async function projectResolveBrand(
582579
return project.brandCache.brand;
583580
} else {
584581
const metadata = await project.fileMetadata(fileName);
585-
const brand = Zod.BrandPathBoolLightDark.parse(metadata.brand); // as BrandPathBoolLightDark;
582+
const brand = Zod.BrandPathBoolLightDark.parse(metadata.brand);
586583
if (brand === false) {
587584
return undefined;
588585
}

src/project/serve/serve.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ import { exitWithCleanup, onCleanup } from "../../core/cleanup.ts";
109109
import { projectExtensionDirs } from "../../extension/extension.ts";
110110
import { findOpenPort } from "../../core/port.ts";
111111
import { kLocalhost } from "../../core/port-consts.ts";
112-
import { ProjectServe } from "../../resources/types/schema-types.ts";
112+
import { ProjectServe } from "../../resources/types/zod/schema-types.ts";
113113
import { handleHttpRequests } from "../../core/http-server.ts";
114114
import { touch } from "../../core/file.ts";
115115
import { staticResource } from "../../preview/preview-static.ts";

src/project/types.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { ExecutionEngine, ExecutionTarget } from "../execute/types.ts";
1414
import { InspectedMdCell } from "../quarto-core/inspect-types.ts";
1515
import { NotebookContext } from "../render/notebook/notebook-types.ts";
1616
import {
17-
Brand as BrandJson,
1817
NavigationItem as NavItem,
1918
NavigationItemObject,
2019
NavigationItemObject as SidebarTool,
@@ -70,8 +69,12 @@ export interface ProjectContext {
7069
fileInformationCache: Map<string, FileInformation>;
7170

7271
// This is a cache of _brand.yml for a project
73-
brandCache?: { brand?: LightDarkBrand};
74-
resolveBrand: (fileName?: string) => Promise<undefined | {light?: Brand | undefined, dark?: Brand | undefined}>;
72+
brandCache?: { brand?: LightDarkBrand };
73+
resolveBrand: (
74+
fileName?: string,
75+
) => Promise<
76+
undefined | { light?: Brand | undefined; dark?: Brand | undefined }
77+
>;
7578

7679
// expands markdown for a file
7780
// input file doesn't have to be markdown; it can be, for example, a knitr spin file

0 commit comments

Comments
 (0)