elegance-js 1.17.0 → 1.17.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/dist/global.d.ts +13 -1
- package/dist/page_compiler.mjs +2 -2
- package/package.json +1 -1
package/dist/global.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { ObjectAttributeType } from "./helpers/ObjectAttributeType";
|
|
2
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
3
|
declare global {
|
|
3
4
|
type NonVoid<T> = T extends void ? never : T;
|
|
5
|
+
/** Deprecated. */
|
|
4
6
|
var __ELEGANCE_SERVER_DATA__: any;
|
|
7
|
+
/** Increment this by 1 to get a per-build unique ID. */
|
|
5
8
|
var __SERVER_CURRENT_STATE_ID__: number;
|
|
9
|
+
/** Deprecated. */
|
|
6
10
|
var __SERVER_CURRENT_REF_ID__: number;
|
|
11
|
+
/** The global server current state for this build. */
|
|
7
12
|
var __SERVER_CURRENT_STATE__: Array<{
|
|
8
13
|
value: unknown;
|
|
9
14
|
type: ObjectAttributeType;
|
|
@@ -27,8 +32,15 @@ declare global {
|
|
|
27
32
|
children: null;
|
|
28
33
|
options: Record<string, any> | Child;
|
|
29
34
|
};
|
|
30
|
-
|
|
35
|
+
/** The type for API Endpoints in route.ts files. */
|
|
36
|
+
type Endpoint = (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
37
|
+
/** The type for middleware functions in middleware.ts files. */
|
|
38
|
+
type Middleware = (req: IncomingMessage, res: ServerResponse, next: () => void) => Promise<void>;
|
|
39
|
+
/** The type for const layout in layout.ts files. */
|
|
31
40
|
type Layout = ((child: Child) => (AnyBuiltElement | Promise<AnyBuiltElement>));
|
|
41
|
+
/** The type for const metadata in layout.ts files. */
|
|
42
|
+
type LayoutMetadata = ((child: Child) => (AnyBuiltElement | Promise<AnyBuiltElement>));
|
|
43
|
+
type Page = (AnyBuiltElement) | (() => AnyBuiltElement) | (() => Promise<AnyBuiltElement>);
|
|
32
44
|
type Metadata = (() => (AnyBuiltElement)) | (() => Promise<AnyBuiltElement>);
|
|
33
45
|
type ObjectAttribute<T> = T extends ObjectAttributeType.STATE ? {
|
|
34
46
|
type: ObjectAttributeType;
|
package/dist/page_compiler.mjs
CHANGED
|
@@ -672,7 +672,7 @@ return __exports
|
|
|
672
672
|
}
|
|
673
673
|
{
|
|
674
674
|
if (!layoutElements) {
|
|
675
|
-
throw new Error(`WARNING: ${filePath} should export a const layout, which is of type (child: Child) => AnyBuiltElement.`);
|
|
675
|
+
throw new Error(`WARNING: ${filePath} should export a const layout, which is of type Layout: (child: Child) => AnyBuiltElement.`);
|
|
676
676
|
}
|
|
677
677
|
if (typeof layoutElements === "function") {
|
|
678
678
|
if (layoutElements.constructor.name === "AsyncFunction") {
|
|
@@ -684,7 +684,7 @@ return __exports
|
|
|
684
684
|
}
|
|
685
685
|
{
|
|
686
686
|
if (!metadataElements) {
|
|
687
|
-
throw new Error(`WARNING: ${filePath} should export a const
|
|
687
|
+
throw new Error(`WARNING: ${filePath} should export a const metadata, which is of type LayoutMetadata: (child: Child) => AnyBuiltElement.`);
|
|
688
688
|
}
|
|
689
689
|
if (typeof metadataElements === "function") {
|
|
690
690
|
if (metadataElements.constructor.name === "AsyncFunction") {
|