Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,7 @@ export interface PlatformConfig {

resolveProjectStaticFileImportUrl?: (path: string) => Promise<string>;
nodeModulesResolver?: (modulePath: string) => Promise<string | null>;
platformFetch?: typeof fetch;
}
```

Expand Down
1 change: 1 addition & 0 deletions generated/PROPS_OVERVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,7 @@ export interface PlatformConfig {

resolveProjectStaticFileImportUrl?: (path: string) => Promise<string>
nodeModulesResolver?: (modulePath: string) => Promise<string | null>
platformFetch?: typeof fetch
}


Expand Down
6 changes: 6 additions & 0 deletions lib/platformConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export interface PlatformConfig {

resolveProjectStaticFileImportUrl?: (path: string) => Promise<string>
nodeModulesResolver?: (modulePath: string) => Promise<string | null>
platformFetch?: typeof fetch
}

const unvalidatedCircuitJson = z.array(z.any()).describe("Circuit JSON")
Expand Down Expand Up @@ -166,6 +167,10 @@ const autorouterDefinition = z.object({
.describe("Create an autorouter instance"),
})

const platformFetch = z
.custom<typeof fetch>((value) => typeof value === "function")
.describe("A fetch-like function to use for platform requests")

export const platformConfig = z.object({
partsEngine: partsEngine.optional(),
autorouter: autorouterProp.optional(),
Expand Down Expand Up @@ -218,6 +223,7 @@ export const platformConfig = z.object({
"A function that returns a string URL for static files for the project",
)
.optional(),
platformFetch: platformFetch.optional(),
}) as z.ZodType<PlatformConfig>

expectTypesMatch<PlatformConfig, z.infer<typeof platformConfig>>(true)