elegance-js 2.1.7 → 2.1.9
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/dist/build.d.ts +2 -0
- package/dist/build.mjs +1726 -46
- package/dist/compile_docs.mjs +1731 -53
- package/dist/global.d.ts +4 -1
- package/dist/page_compiler.d.ts +1 -3
- package/dist/page_compiler.mjs +42 -468
- package/dist/server/server.mjs +1250 -1100
- package/package.json +1 -1
package/dist/global.d.ts
CHANGED
|
@@ -35,8 +35,10 @@ declare global {
|
|
|
35
35
|
};
|
|
36
36
|
/** The type for API Endpoints in route.ts files. */
|
|
37
37
|
type Endpoint = (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
38
|
+
/** Assign any key any value, within the middleware function, and the data will be passed to the pages affected by the middleware. */
|
|
39
|
+
type MiddlewareData = Record<string, any>;
|
|
38
40
|
/** The type for middleware functions in middleware.ts files. */
|
|
39
|
-
type Middleware = (req: IncomingMessage, res: ServerResponse, next: () => void) => Promise<void>;
|
|
41
|
+
type Middleware = (req: IncomingMessage, res: ServerResponse, next: () => void, data: MiddlewareData) => Promise<void>;
|
|
40
42
|
/** On dynamic pages, the requestHook, if present, shall be called by the server, before serving the page. */
|
|
41
43
|
type RequestHook = (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
|
|
42
44
|
/** The type for const layout in layout.ts files. */
|
|
@@ -46,6 +48,7 @@ declare global {
|
|
|
46
48
|
/** Parameters that get passed into Page */
|
|
47
49
|
type PageProps = {
|
|
48
50
|
pageName: string;
|
|
51
|
+
middlewareData: MiddlewareData;
|
|
49
52
|
};
|
|
50
53
|
/** Internal use only. */
|
|
51
54
|
type PageInformation = {
|
package/dist/page_compiler.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from "http";
|
|
2
|
-
export declare const PAGE_MAP: Map<string, PageInformation>;
|
|
3
|
-
export declare const LAYOUT_MAP: Map<string, LayoutInformation>;
|
|
4
2
|
export declare const processPageElements: (element: Child, objectAttributes: Array<any>, recursionLevel: number, stack?: any[]) => Child;
|
|
5
|
-
export declare const buildDynamicPage: (DIST_DIR: string, directory: string, pageInfo: PageInformation, req: IncomingMessage, res: ServerResponse) => Promise<false | {
|
|
3
|
+
export declare const buildDynamicPage: (DIST_DIR: string, directory: string, pageInfo: PageInformation, req: IncomingMessage, res: ServerResponse, middlewareData: MiddlewareData) => Promise<false | {
|
|
6
4
|
resultHTML: any;
|
|
7
5
|
}>;
|