bertui 1.1.0 → 1.1.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/README.md +424 -435
- package/package.json +26 -6
- package/src/build/compiler/file-transpiler.js +171 -0
- package/src/build/compiler/index.js +45 -0
- package/src/build/compiler/route-discoverer.js +46 -0
- package/src/build/compiler/router-generator.js +104 -0
- package/src/build/generators/html-generator.js +293 -0
- package/src/build/generators/robots-generator.js +58 -0
- package/src/build/generators/sitemap-generator.js +63 -0
- package/src/build/processors/asset-processor.js +19 -0
- package/src/build/processors/css-builder.js +102 -0
- package/src/build.js +100 -680
- package/src/client/compiler.js +23 -42
- package/src/config/defaultConfig.js +26 -6
- package/src/config/loadConfig.js +21 -5
- package/src/pagebuilder/core.js +191 -0
- package/src/server/dev-server.js +134 -36
- package/src/utils/env.js +59 -39
- package/src/utils/meta-extractor.js +127 -0
- package/types/config.d.ts +80 -0
- package/types/index.d.ts +116 -0
- package/types/react.d.ts +13 -0
- package/types/router.d.ts +79 -0
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// bertui/types/index.d.ts
|
|
2
|
+
|
|
3
|
+
declare namespace React {
|
|
4
|
+
type ReactNode = any;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
namespace JSX {
|
|
9
|
+
type Element = any;
|
|
10
|
+
interface IntrinsicElements {
|
|
11
|
+
[elemName: string]: any;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
declare module 'bertui' {
|
|
16
|
+
import { BertuiConfig } from 'bertui/config';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Logger utility
|
|
20
|
+
*/
|
|
21
|
+
export interface Logger {
|
|
22
|
+
info(message: string): void;
|
|
23
|
+
success(message: string): void;
|
|
24
|
+
warn(message: string): void;
|
|
25
|
+
error(message: string): void;
|
|
26
|
+
debug(message: string): void;
|
|
27
|
+
bigLog(message: string, options?: { color?: string }): void;
|
|
28
|
+
table(data: any[]): void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Build options
|
|
33
|
+
*/
|
|
34
|
+
export interface BuildOptions {
|
|
35
|
+
/** Project root directory */
|
|
36
|
+
root?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Dev server options
|
|
41
|
+
*/
|
|
42
|
+
export interface DevOptions {
|
|
43
|
+
/** Server port */
|
|
44
|
+
port?: number;
|
|
45
|
+
/** Project root directory */
|
|
46
|
+
root?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Compile options
|
|
51
|
+
*/
|
|
52
|
+
export interface CompileOptions {
|
|
53
|
+
/** Project root directory */
|
|
54
|
+
root?: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Logger instance
|
|
59
|
+
*/
|
|
60
|
+
export const logger: Logger;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Default configuration
|
|
64
|
+
*/
|
|
65
|
+
export const defaultConfig: BertuiConfig;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Load configuration
|
|
69
|
+
*/
|
|
70
|
+
export function loadConfig(root: string): Promise<BertuiConfig>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Start development server
|
|
74
|
+
*/
|
|
75
|
+
export function startDev(options?: DevOptions): Promise<void>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Build for production
|
|
79
|
+
*/
|
|
80
|
+
export function buildProduction(options?: BuildOptions): Promise<void>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Compile project
|
|
84
|
+
*/
|
|
85
|
+
export function compileProject(root: string): Promise<{
|
|
86
|
+
outDir: string;
|
|
87
|
+
stats: { files: number; skipped: number };
|
|
88
|
+
routes: any[];
|
|
89
|
+
}>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* CLI program
|
|
93
|
+
*/
|
|
94
|
+
export function program(): void;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* BertUI version
|
|
98
|
+
*/
|
|
99
|
+
export const version: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Global declarations for Server Islands
|
|
103
|
+
declare global {
|
|
104
|
+
/**
|
|
105
|
+
* Mark a page component as a Server Island (SSG)
|
|
106
|
+
* Add this export to any page to enable static generation:
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```tsx
|
|
110
|
+
* export const render = "server";
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
export const render: "server" | "client";
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export {};
|
package/types/react.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// bertui/types/router.d.ts
|
|
2
|
+
declare module 'bertui/router' {
|
|
3
|
+
import { ReactNode, ComponentType } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Route parameter object
|
|
7
|
+
*/
|
|
8
|
+
export interface RouteParams {
|
|
9
|
+
[key: string]: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Router context value
|
|
14
|
+
*/
|
|
15
|
+
export interface RouterContext {
|
|
16
|
+
/** Current active route */
|
|
17
|
+
currentRoute: Route | null;
|
|
18
|
+
/** Dynamic route parameters */
|
|
19
|
+
params: RouteParams;
|
|
20
|
+
/** Navigate to a new path */
|
|
21
|
+
navigate: (path: string) => void;
|
|
22
|
+
/** Current pathname */
|
|
23
|
+
pathname: string;
|
|
24
|
+
/** Whether running in SSR mode */
|
|
25
|
+
isSSR?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Route configuration object
|
|
30
|
+
*/
|
|
31
|
+
export interface Route {
|
|
32
|
+
/** Route path (e.g., "/", "/blog", "/user/:id") */
|
|
33
|
+
path: string;
|
|
34
|
+
/** React component to render */
|
|
35
|
+
component: ComponentType<{ params?: RouteParams }>;
|
|
36
|
+
/** Route type: "static" or "dynamic" */
|
|
37
|
+
type: 'static' | 'dynamic';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Router component props
|
|
42
|
+
*/
|
|
43
|
+
export interface RouterProps {
|
|
44
|
+
/** Array of route configurations */
|
|
45
|
+
routes: Route[];
|
|
46
|
+
/** Initial path for SSR */
|
|
47
|
+
initialPath?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Link component props
|
|
52
|
+
*/
|
|
53
|
+
export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
54
|
+
/** Destination path */
|
|
55
|
+
to: string;
|
|
56
|
+
/** Link content */
|
|
57
|
+
children: ReactNode;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Router component for client-side routing
|
|
62
|
+
*/
|
|
63
|
+
export const Router: ComponentType<RouterProps>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Link component for navigation
|
|
67
|
+
*/
|
|
68
|
+
export const Link: ComponentType<LinkProps>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Hook to access router context
|
|
72
|
+
*/
|
|
73
|
+
export function useRouter(): RouterContext;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Exported routes configuration
|
|
77
|
+
*/
|
|
78
|
+
export const routes: Route[];
|
|
79
|
+
}
|