Skip to content

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
rossrobino committed Sep 18, 2024
1 parent 96bc88d commit f915105
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .changeset/nine-spies-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"domco": patch
---

fix: reference on `DomcoConfig` and export `MaybePromise`
46 changes: 33 additions & 13 deletions apps/docs/src/server/generated/globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ Passed into Vite `config.ssr.target`.

#### Defined in

[types/index.ts:58](https://github.com/rossrobino/domco/blob/079c24a873dea21ac0e5db4ef90b4f223f824e4a/packages/domco/src/types/index.ts#L58)
[types/index.ts:60](https://github.com/rossrobino/domco/blob/96bc88dd5cb595f98ceeaa40c8e6c0f3884cd45b/packages/domco/src/types/index.ts#L60)

---

<a id="adapterbuilderadapteroptions" name="adapterbuilderadapteroptions"></a>

### AdapterBuilder()\<AdapterOptions\>

> **AdapterBuilder**\<`AdapterOptions`\>: (`AdapterOptions`?) => `MaybePromise`\<[`Adapter`](globals.md#adapter)\>
> **AdapterBuilder**\<`AdapterOptions`\>: (`AdapterOptions`?) => [`MaybePromise`](globals.md#maybepromiset)\<[`Adapter`](globals.md#adapter)\>
Use this type to create your own adapter.
Pass any options for the adapter in as a generic.
Expand All @@ -103,11 +103,11 @@ Pass any options for the adapter in as a generic.

#### Returns

`MaybePromise`\<[`Adapter`](globals.md#adapter)\>
[`MaybePromise`](globals.md#maybepromiset)\<[`Adapter`](globals.md#adapter)\>

#### Defined in

[types/index.ts:88](https://github.com/rossrobino/domco/blob/079c24a873dea21ac0e5db4ef90b4f223f824e4a/packages/domco/src/types/index.ts#L88)
[types/index.ts:90](https://github.com/rossrobino/domco/blob/96bc88dd5cb595f98ceeaa40c8e6c0f3884cd45b/packages/domco/src/types/index.ts#L90)

---

Expand Down Expand Up @@ -151,7 +151,7 @@ The name of the entry point without extension.

#### Defined in

[types/index.ts:42](https://github.com/rossrobino/domco/blob/079c24a873dea21ac0e5db4ef90b4f223f824e4a/packages/domco/src/types/index.ts#L42)
[types/index.ts:44](https://github.com/rossrobino/domco/blob/96bc88dd5cb595f98ceeaa40c8e6c0f3884cd45b/packages/domco/src/types/index.ts#L44)

---

Expand All @@ -165,7 +165,7 @@ Middleware used in the Vite server for dev and preview.

#### Defined in

[types/index.ts:39](https://github.com/rossrobino/domco/blob/079c24a873dea21ac0e5db4ef90b4f223f824e4a/packages/domco/src/types/index.ts#L39)
[types/index.ts:41](https://github.com/rossrobino/domco/blob/96bc88dd5cb595f98ceeaa40c8e6c0f3884cd45b/packages/domco/src/types/index.ts#L41)

---

Expand Down Expand Up @@ -193,7 +193,7 @@ Exports from the SSR `app` entry point.
#### Defined in

[types/index.ts:5](https://github.com/rossrobino/domco/blob/079c24a873dea21ac0e5db4ef90b4f223f824e4a/packages/domco/src/types/index.ts#L5)
[types/index.ts:7](https://github.com/rossrobino/domco/blob/96bc88dd5cb595f98ceeaa40c8e6c0f3884cd45b/packages/domco/src/types/index.ts#L7)

---

Expand Down Expand Up @@ -250,15 +250,15 @@ export default defineConfig({

#### Defined in

[types/index.ts:114](https://github.com/rossrobino/domco/blob/079c24a873dea21ac0e5db4ef90b4f223f824e4a/packages/domco/src/types/index.ts#L114)
[types/index.ts:116](https://github.com/rossrobino/domco/blob/96bc88dd5cb595f98ceeaa40c8e6c0f3884cd45b/packages/domco/src/types/index.ts#L116)

---

<a id="handler-1" name="handler-1"></a>

### Handler()

> **Handler**: (`req`) => `MaybePromise`\<`Response`\>
> **Handler**: (`req`) => [`MaybePromise`](globals.md#maybepromiset)\<`Response`\>
Request handler, takes a web request and returns a web response.

Expand All @@ -277,11 +277,29 @@ export const handler: Handler = async (req) => {

#### Returns

`MaybePromise`\<`Response`\>
[`MaybePromise`](globals.md#maybepromiset)\<`Response`\>

#### Defined in

[types/index.ts:22](https://github.com/rossrobino/domco/blob/079c24a873dea21ac0e5db4ef90b4f223f824e4a/packages/domco/src/types/index.ts#L22)
[types/index.ts:24](https://github.com/rossrobino/domco/blob/96bc88dd5cb595f98ceeaa40c8e6c0f3884cd45b/packages/domco/src/types/index.ts#L24)

---

<a id="maybepromiset" name="maybepromiset"></a>

### MaybePromise\<T\>

> **MaybePromise**\<`T`\>: `T` \| `Promise`\<`T`\>
Helper type for a type that could be a promise.

#### Type Parameters

**T**

#### Defined in

[types/index.ts:4](https://github.com/rossrobino/domco/blob/96bc88dd5cb595f98ceeaa40c8e6c0f3884cd45b/packages/domco/src/types/index.ts#L4)

---

Expand All @@ -304,7 +322,7 @@ export const prerender: Prerender = ["/", "/post-1", "/post-2"];

#### Defined in

[types/index.ts:36](https://github.com/rossrobino/domco/blob/079c24a873dea21ac0e5db4ef90b4f223f824e4a/packages/domco/src/types/index.ts#L36)
[types/index.ts:38](https://github.com/rossrobino/domco/blob/96bc88dd5cb595f98ceeaa40c8e6c0f3884cd45b/packages/domco/src/types/index.ts#L38)

## Functions

Expand All @@ -321,6 +339,8 @@ to start using domco.

**domcoConfig**: [`DomcoConfig`](globals.md#domcoconfig) = `{}`

Your domco config object.

#### Returns

`Promise`\<`Plugin`\<`any`\>[]\>
Expand All @@ -341,4 +361,4 @@ export default defineConfig({

#### Defined in

[plugin/index.ts:29](https://github.com/rossrobino/domco/blob/079c24a873dea21ac0e5db4ef90b4f223f824e4a/packages/domco/src/plugin/index.ts#L29)
[plugin/index.ts:29](https://github.com/rossrobino/domco/blob/96bc88dd5cb595f98ceeaa40c8e6c0f3884cd45b/packages/domco/src/plugin/index.ts#L29)
2 changes: 1 addition & 1 deletion packages/domco/src/listener/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Adapted from https://github.com/mjackson/remix-the-web/blob/main/packages/node-fetch-server
* to use as middleware: https://github.com/mjackson/remix-the-web/issues/13
*/
import type { MaybePromise } from "../types/helper/index.js";
import type { MaybePromise } from "../types/index.js";
import type { ReadStream } from "node:fs";
import type {
IncomingHttpHeaders,
Expand Down
2 changes: 1 addition & 1 deletion packages/domco/src/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { Plugin } from "vite";
* Creates domco Vite plugin, add to your `plugins` array within your `vite.config`
* to start using domco.
*
* @param config Your domco config object.
* @param domcoConfig Your domco config object.
* @returns The domco Vite plugin.
*
* @example
Expand Down
2 changes: 0 additions & 2 deletions packages/domco/src/types/helper/index.ts

This file was deleted.

4 changes: 3 additions & 1 deletion packages/domco/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { MaybePromise } from "./helper/index.js";
import type { SSRTarget, SSROptions, Connect } from "vite";

/** Helper type for a type that could be a promise. */
export type MaybePromise<T> = T | Promise<T>;

/** Exports from the SSR `app` entry point. */
export type AppModule = {
handler: Handler;
Expand Down
2 changes: 1 addition & 1 deletion packages/domco/src/version/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "0.12.0";
export const version = "0.13.0";
15 changes: 10 additions & 5 deletions packages/domco/typedoc.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
/** @import { TypeDocOptions } from "typedoc" */
/** @import { PluginOptions } from "typedoc-plugin-markdown" */

/** @type {Partial<TypeDocOptions & PluginOptions>} */
export default {
entryPoints: ["src/index.ts"],
out: "../../apps/docs/src/server/generated",

/** @type {PluginOptions} */
const markdownOptions = {
plugin: ["typedoc-plugin-markdown"],
outputFileStrategy: "modules",
hidePageHeader: true,
hidePageTitle: true,
useHTMLAnchors: true,
};

/** @type {Partial<TypeDocOptions & PluginOptions>} */
export default {
entryPoints: ["src/index.ts"],
out: "../../apps/docs/src/server/generated",
plugin: ["typedoc-plugin-markdown"],
...markdownOptions,
};

0 comments on commit f915105

Please sign in to comment.