html-express-js 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.d.ts +48 -0
package/package.json
CHANGED
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template literal that supports string
|
|
3
|
+
* interpolating in passed HTML.
|
|
4
|
+
*
|
|
5
|
+
* @param {*} strings
|
|
6
|
+
* @param {...any} data
|
|
7
|
+
* @returns {string} - HTML string
|
|
8
|
+
*/
|
|
9
|
+
export function html(strings: any, ...data: any[]): string;
|
|
10
|
+
/**
|
|
11
|
+
* Returns an object containing both static
|
|
12
|
+
* index handler and the template engine callback.
|
|
13
|
+
*
|
|
14
|
+
* @param {HTMLExpressOptions} [opts]
|
|
15
|
+
* @returns {{
|
|
16
|
+
* staticIndexHandler: HTMLExpressStaticIndexHandler,
|
|
17
|
+
* engine: Parameters<import('express').Application['engine']>[1],
|
|
18
|
+
* }}
|
|
19
|
+
*/
|
|
20
|
+
export default function _default(opts?: HTMLExpressOptions): {
|
|
21
|
+
staticIndexHandler: HTMLExpressStaticIndexHandler;
|
|
22
|
+
engine: [ext: string, fn: (path: string, options: object, callback: (e: any, rendered?: string) => void) => void][1];
|
|
23
|
+
};
|
|
24
|
+
export type HTMLExpressBuildStateHandler = (req: import('express').Request) => Record<string, any>;
|
|
25
|
+
export type HTMLExpressOptions = {
|
|
26
|
+
/**
|
|
27
|
+
* - The directory that houses any potential index files
|
|
28
|
+
*/
|
|
29
|
+
viewsDir: string;
|
|
30
|
+
/**
|
|
31
|
+
* - The directory that houses all of the includes
|
|
32
|
+
* that will be available on the includes property of each static page.
|
|
33
|
+
*/
|
|
34
|
+
includesDir?: string;
|
|
35
|
+
/**
|
|
36
|
+
* - The path of a file relative to the views
|
|
37
|
+
* directory that should be served as 404 when no matching index page exists. Defaults to `404/index`.
|
|
38
|
+
*/
|
|
39
|
+
notFoundView?: string;
|
|
40
|
+
/**
|
|
41
|
+
* - A callback function that allows for
|
|
42
|
+
* building a state object from request information, that will be merged with default state and made available to all views
|
|
43
|
+
*/
|
|
44
|
+
buildRequestState?: HTMLExpressBuildStateHandler;
|
|
45
|
+
};
|
|
46
|
+
export type HTMLExpressStaticIndexHandler = (options?: HTMLExpressOptions) => import('express').RequestHandler;
|
|
47
|
+
declare function staticIndexHandler(options?: HTMLExpressOptions): import('express').RequestHandler;
|
|
48
|
+
export {};
|