baraqex 1.0.37 → 1.0.38

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.
Files changed (42) hide show
  1. package/dist/api/hello.d.ts +3 -0
  2. package/dist/api/hello.d.ts.map +1 -0
  3. package/dist/api/users/[id].d.ts +5 -0
  4. package/dist/api/users/[id].d.ts.map +1 -0
  5. package/dist/browser.d.ts +14 -0
  6. package/dist/browser.d.ts.map +1 -0
  7. package/dist/frontend/components/WasmLoader.d.ts +2 -0
  8. package/dist/frontend/components/WasmLoader.d.ts.map +1 -0
  9. package/dist/frontend/hooks/useWasm.d.ts +2 -0
  10. package/dist/frontend/hooks/useWasm.d.ts.map +1 -0
  11. package/dist/frontend/index.d.ts +2 -0
  12. package/dist/frontend/index.d.ts.map +1 -0
  13. package/dist/index.d.ts +35 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/renderComponent.d.ts +9 -0
  16. package/dist/renderComponent.d.ts.map +1 -0
  17. package/dist/server/api-router.d.ts +16 -0
  18. package/dist/server/api-router.d.ts.map +1 -0
  19. package/dist/server/auth.d.ts +25 -0
  20. package/dist/server/auth.d.ts.map +1 -0
  21. package/dist/server/database.d.ts +22 -0
  22. package/dist/server/database.d.ts.map +1 -0
  23. package/dist/server/index.d.ts +115 -0
  24. package/dist/server/index.d.ts.map +1 -0
  25. package/dist/server/middleware.d.ts +11 -0
  26. package/dist/server/middleware.d.ts.map +1 -0
  27. package/dist/server/templates.d.ts +31 -0
  28. package/dist/server/templates.d.ts.map +1 -0
  29. package/dist/server/types.d.ts +69 -0
  30. package/dist/server/types.d.ts.map +1 -0
  31. package/dist/server/utils.d.ts +70 -0
  32. package/dist/server/utils.d.ts.map +1 -0
  33. package/dist/server/wasm.d.ts +29 -0
  34. package/dist/server/wasm.d.ts.map +1 -0
  35. package/dist/server-renderer.d.ts +5 -0
  36. package/dist/server-renderer.d.ts.map +1 -0
  37. package/dist/wasm.d.ts +51 -0
  38. package/dist/wasm.d.ts.map +1 -0
  39. package/package.json +11 -16
  40. package/templates/ssr-template/package-lock.json +5 -5
  41. package/templates/ssr-template/package.json +1 -1
  42. package/templates/ssr-template/src/App.tsx +1 -1
@@ -0,0 +1,3 @@
1
+ export function get(req: any, res: any): void;
2
+ export function post(req: any, res: any): void;
3
+ //# sourceMappingURL=hello.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hello.d.ts","sourceRoot":"","sources":["../../src/api/hello.js"],"names":[],"mappings":"AAAA,8CAOC;AAED,+CAQC"}
@@ -0,0 +1,5 @@
1
+ export function get(req: any, res: any): any;
2
+ export function put(req: any, res: any): any;
3
+ export function delete_(req: any, res: any): any;
4
+ export { delete_ as delete, _delete as delete };
5
+ //# sourceMappingURL=%5Bid%5D.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"[id].d.ts","sourceRoot":"","sources":["../../../src/api/users/[id].js"],"names":[],"mappings":"AAOA,6CAeC;AAED,6CAmBC;AAED,iDAkBC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Browser-only entry point for baraqex
3
+ * This file excludes all server dependencies to ensure browser compatibility
4
+ */
5
+ export * from 'frontend-hamroun';
6
+ export { loadGoWasm, callWasmFunction, isWasmReady, getWasmFunctions, useGoWasm } from './wasm.js';
7
+ export type { GoWasmOptions, GoWasmInstance } from './wasm.js';
8
+ export { generateDocument, generateErrorPage, generateLoadingPage } from './server/templates.js';
9
+ export declare function renderToString(content: any): Promise<string>;
10
+ export declare function generateToken(length?: number): string;
11
+ export declare function safeJsonParse<T>(json: string, fallback: T): T;
12
+ export declare const isBrowser: boolean;
13
+ export declare const isNode = false;
14
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,kBAAkB,CAAC;AAGjC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGnG,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG/D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGjG,wBAAgB,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAa5D;AAGD,wBAAgB,aAAa,CAAC,MAAM,GAAE,MAAW,GAAG,MAAM,CAWzD;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAM7D;AAGD,eAAO,MAAM,SAAS,SAAgC,CAAC;AACvD,eAAO,MAAM,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=WasmLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WasmLoader.d.ts","sourceRoot":"","sources":["../../../src/frontend/components/WasmLoader.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useWasm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWasm.d.ts","sourceRoot":"","sources":["../../../src/frontend/hooks/useWasm.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/frontend/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,35 @@
1
+ export * from 'frontend-hamroun';
2
+ export type { ServerConfig, User, DbConfig, MiddlewareFunction } from './server/types.js';
3
+ export { loadGoWasm, callWasmFunction, isWasmReady, getWasmFunctions, useGoWasm } from './wasm.js';
4
+ export type { GoWasmOptions, GoWasmInstance } from './server/types.js';
5
+ export { generateDocument, generateErrorPage, generateLoadingPage } from './server/templates.js';
6
+ export declare let BaraqexServer: any;
7
+ export declare let createServer: any;
8
+ export declare let createDevServer: any;
9
+ export declare let createProductionServer: any;
10
+ export declare let renderComponent: any;
11
+ export declare let Database: any;
12
+ export declare let AuthService: any;
13
+ export declare let ApiRouter: any;
14
+ export declare let requestLogger: any;
15
+ export declare let errorHandler: any;
16
+ export declare let notFoundHandler: any;
17
+ export declare let rateLimit: any;
18
+ export declare let initNodeWasm: any;
19
+ export declare let loadGoWasmFromFile: any;
20
+ export declare let safeJsonParse: any;
21
+ export declare let generateToken: any;
22
+ export declare let hashString: any;
23
+ export declare let getPagination: any;
24
+ export declare let sendSuccess: any;
25
+ export declare let sendError: any;
26
+ export declare let validateFields: any;
27
+ export declare let validateFileUpload: any;
28
+ export declare let getEnvironmentInfo: any;
29
+ export declare let isDirectoryEmpty: any;
30
+ export declare let ensureDirectory: any;
31
+ export declare let writeJsonFile: any;
32
+ export declare let readJsonFile: any;
33
+ export declare let baraqexRenderToString: any;
34
+ export declare function renderToString(content: any): Promise<string>;
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AAGjC,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG1F,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACnG,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGvE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAOjG,eAAO,IAAI,aAAa,EAAE,GAAU,CAAC;AACrC,eAAO,IAAI,YAAY,EAAE,GAAU,CAAC;AACpC,eAAO,IAAI,eAAe,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+ export declare function renderComponent(Component: any, props?: any): Promise<{
5
+ html: string;
6
+ success: boolean;
7
+ error?: Error;
8
+ }>;
9
+ //# sourceMappingURL=renderComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderComponent.d.ts","sourceRoot":"","sources":["../src/renderComponent.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAsB,eAAe,CACnC,SAAS,EAAE,GAAG,EACd,KAAK,GAAE,GAAQ,GACd,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAiC5D"}
@@ -0,0 +1,16 @@
1
+ import { AuthService } from './auth.js';
2
+ export declare class ApiRouter {
3
+ router: any;
4
+ private apiDir;
5
+ private auth;
6
+ constructor(apiDir: string, auth?: AuthService | null);
7
+ private initializeRouter;
8
+ private setupRoutes;
9
+ private scanDirectory;
10
+ private isRouteFile;
11
+ private getRoutePath;
12
+ private registerRoute;
13
+ private isValidRouteModule;
14
+ private wrapHandler;
15
+ }
16
+ //# sourceMappingURL=api-router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-router.d.ts","sourceRoot":"","sources":["../../src/server/api-router.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAmBxC,qBAAa,SAAS;IACb,MAAM,EAAE,GAAG,CAAC;IACnB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAAqB;gBAErB,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,WAAW,GAAG,IAAW;YAQ7C,gBAAgB;IAa9B,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,YAAY;YAiBN,aAAa;IAuE3B,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,WAAW;CASpB"}
@@ -0,0 +1,25 @@
1
+ export interface AuthConfig {
2
+ secret: string;
3
+ expiresIn?: string | number;
4
+ }
5
+ export interface User {
6
+ id: string | number;
7
+ username: string;
8
+ password?: string;
9
+ email?: string;
10
+ roles?: string[];
11
+ [key: string]: any;
12
+ }
13
+ export declare class AuthService {
14
+ private config;
15
+ constructor(config: AuthConfig);
16
+ hashPassword(password: string): Promise<string>;
17
+ comparePasswords(password: string, hashedPassword: string): Promise<boolean>;
18
+ generateToken(user: Omit<User, 'password'>): string;
19
+ verifyToken(token: string): any;
20
+ initialize(): (req: any, res: any, next: any) => void;
21
+ requireAuth(): (req: any, res: any, next: any) => any;
22
+ requireRoles(roles: string[]): (req: any, res: any, next: any) => any;
23
+ private extractToken;
24
+ }
25
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/server/auth.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAa;gBAEf,MAAM,EAAE,UAAU;IAOxB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAY/C,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAYlF,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,MAAM;IAsBnD,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG;IAa/B,UAAU,KACA,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,MAAM,GAAG;IAavC,WAAW,KACD,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,MAAM,GAAG;IASvC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAClB,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,MAAM,GAAG;IAgBvC,OAAO,CAAC,YAAY;CAMrB"}
@@ -0,0 +1,22 @@
1
+ export interface DbConfig {
2
+ url: string;
3
+ type: 'mongodb' | 'mysql' | 'postgres';
4
+ }
5
+ export declare class Database {
6
+ private config;
7
+ private mongoClient;
8
+ private mongoDb;
9
+ private mysqlPool;
10
+ private pgPool;
11
+ constructor(config: DbConfig);
12
+ connect(): Promise<void>;
13
+ private connectMongo;
14
+ private connectMysql;
15
+ private connectPostgres;
16
+ disconnect(): Promise<void>;
17
+ getMongoDb(): any;
18
+ getMysqlPool(): any;
19
+ getPgPool(): any;
20
+ query(sql: string, values?: any[]): Promise<any>;
21
+ }
22
+ //# sourceMappingURL=database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/server/database.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;CACxC;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,MAAM,CAAa;gBAEf,MAAM,EAAE,QAAQ;IAItB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAgBhB,YAAY;YAgBZ,YAAY;YAgBZ,eAAe;IAiBvB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBjC,UAAU,IAAI,GAAG;IAIjB,YAAY,IAAI,GAAG;IAInB,SAAS,IAAI,GAAG;IAKV,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;CAgBvD"}
@@ -0,0 +1,115 @@
1
+ import { renderToString } from 'frontend-hamroun';
2
+ import { Database } from './database.js';
3
+ import { AuthService } from './auth.js';
4
+ import { ApiRouter } from './api-router.js';
5
+ import { rateLimit } from './middleware.js';
6
+ import * as utils from './utils.js';
7
+ import * as templates from './templates.js';
8
+ import { loadGoWasmFromFile } from './wasm.js';
9
+ export interface ServerConfig {
10
+ port?: number;
11
+ apiDir?: string;
12
+ pagesDir?: string;
13
+ staticDir?: string;
14
+ enableCors?: boolean;
15
+ corsOptions?: any;
16
+ db?: {
17
+ url: string;
18
+ type: 'mongodb' | 'mysql' | 'postgres';
19
+ };
20
+ auth?: {
21
+ secret: string;
22
+ expiresIn?: string | number;
23
+ };
24
+ }
25
+ export declare class Server {
26
+ private app;
27
+ private server;
28
+ private config;
29
+ private db;
30
+ private auth;
31
+ constructor(config?: ServerConfig);
32
+ private initializeApp;
33
+ private setupApiRoutes;
34
+ private generateApiDocs;
35
+ private scanApiDirectory;
36
+ private getRoutePath;
37
+ private detectApiMethods;
38
+ private setupPageRoutes;
39
+ private renderPage;
40
+ getExpressApp(): any;
41
+ getDatabase(): Database | null;
42
+ getAuth(): AuthService | null;
43
+ start(): Promise<void>;
44
+ stop(): Promise<void>;
45
+ restart(): Promise<void>;
46
+ enableSSR(options?: {
47
+ hydratable?: boolean;
48
+ }): void;
49
+ registerPlugin(plugin: (server: Server) => void): void;
50
+ addShutdownHandler(): void;
51
+ }
52
+ /**
53
+ * Creates and configures a new server instance
54
+ */
55
+ export declare function createServer(config?: ServerConfig): Server;
56
+ /**
57
+ * Creates a new server with sensible defaults for development
58
+ */
59
+ export declare function createDevServer(options?: {
60
+ port?: number;
61
+ enableCors?: boolean;
62
+ }): Server;
63
+ /**
64
+ * Creates a production-ready server with optimized settings
65
+ */
66
+ export declare function createProductionServer(config: ServerConfig): Server;
67
+ export declare function getRequestIp(req: any): string;
68
+ export declare function parseCookies(req: any): Record<string, string>;
69
+ export declare const renderComponent: (Component: any, props?: any) => Promise<{
70
+ html: string;
71
+ success: boolean;
72
+ error?: undefined;
73
+ } | {
74
+ html: string;
75
+ success: boolean;
76
+ error: unknown;
77
+ }>;
78
+ export { initNodeWasm, loadGoWasmFromFile } from './wasm.js';
79
+ export * from './utils.js';
80
+ export * from './templates.js';
81
+ export { Database } from './database.js';
82
+ export { AuthService } from './auth.js';
83
+ export { ApiRouter } from './api-router.js';
84
+ export { requestLogger, errorHandler, notFoundHandler, rateLimit } from './middleware.js';
85
+ export { renderToString };
86
+ declare const _default: {
87
+ Server: typeof Server;
88
+ createServer: typeof createServer;
89
+ createDevServer: typeof createDevServer;
90
+ createProductionServer: typeof createProductionServer;
91
+ rateLimit: typeof rateLimit;
92
+ requestLogger: import("./middleware.js").MiddlewareFunction;
93
+ errorHandler: (err: Error, req: any, res: any, next: any) => void;
94
+ notFoundHandler: (req: any, res: any) => void;
95
+ loadGoWasmFromFile: typeof loadGoWasmFromFile;
96
+ templates: typeof templates;
97
+ utils: typeof utils;
98
+ renderComponent: (Component: any, props?: any) => Promise<{
99
+ html: string;
100
+ success: boolean;
101
+ error?: undefined;
102
+ } | {
103
+ html: string;
104
+ success: boolean;
105
+ error: unknown;
106
+ }>;
107
+ renderToString: typeof renderToString;
108
+ getRequestIp: typeof getRequestIp;
109
+ parseCookies: typeof parseCookies;
110
+ Database: typeof Database;
111
+ AuthService: typeof AuthService;
112
+ ApiRouter: typeof ApiRouter;
113
+ };
114
+ export default _default;
115
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],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E,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,aAAa,EACb,YAAY,EACZ,eAAe,EACf,SAAS,EACV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,cAAc,EAAE,CAAC;;;;;;;;;;;;;iCArCuB,GAAG,UAAS,GAAG;;;;;;;;;;;;;;;;AAwChE,wBAsBE"}
@@ -0,0 +1,11 @@
1
+ export interface MiddlewareFunction {
2
+ (req: any, res: any, next: any): void | Promise<void>;
3
+ }
4
+ export declare const requestLogger: MiddlewareFunction;
5
+ export declare const errorHandler: (err: Error, req: any, res: any, next: any) => void;
6
+ export declare const notFoundHandler: (req: any, res: any) => void;
7
+ export declare function rateLimit(options: {
8
+ windowMs: number;
9
+ max: number;
10
+ }): (req: any, res: any, next: any) => any;
11
+ //# sourceMappingURL=middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/server/middleware.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD;AAGD,eAAO,MAAM,aAAa,EAAE,kBAG3B,CAAC;AAEF,eAAO,MAAM,YAAY,GACvB,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,GAAG,EACR,MAAM,GAAG,SASV,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,KAAK,GAAG,EAAE,KAAK,GAAG,SAMjD,CAAC;AAGF,wBAAgB,SAAS,CAAC,OAAO,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,IAG1D,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,MAAM,GAAG,SAwBtC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * HTML template generators for server-side rendering
3
+ */
4
+ export interface DocumentOptions {
5
+ title?: string;
6
+ description?: string;
7
+ lang?: string;
8
+ charset?: string;
9
+ viewport?: string;
10
+ scripts?: string[];
11
+ styles?: string[];
12
+ meta?: Record<string, string>;
13
+ bodyClasses?: string;
14
+ htmlAttrs?: Record<string, string>;
15
+ bodyAttrs?: Record<string, string>;
16
+ initialData?: any;
17
+ componentName?: string;
18
+ }
19
+ /**
20
+ * Generate a complete HTML document
21
+ */
22
+ export declare function generateDocument(content: string, options?: DocumentOptions): string;
23
+ /**
24
+ * Generate an error page
25
+ */
26
+ export declare function generateErrorPage(statusCode: number, message: string, error?: Error): string;
27
+ /**
28
+ * Generate a loading page
29
+ */
30
+ export declare function generateLoadingPage(message?: string): string;
31
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/server/templates.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,eAAoB,GAC5B,MAAM,CAyER;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,KAAK,GACZ,MAAM,CAgGR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,MAAqB,GAAG,MAAM,CAyC1E"}
@@ -0,0 +1,69 @@
1
+ export interface ServerConfig {
2
+ port?: number;
3
+ apiDir?: string;
4
+ pagesDir?: string;
5
+ staticDir?: string;
6
+ enableCors?: boolean;
7
+ corsOptions?: {
8
+ origin?: string | string[] | boolean;
9
+ credentials?: boolean;
10
+ methods?: string[];
11
+ allowedHeaders?: string[];
12
+ };
13
+ db?: {
14
+ url: string;
15
+ type: 'mongodb' | 'mysql' | 'postgres';
16
+ };
17
+ auth?: {
18
+ secret: string;
19
+ expiresIn?: string | number;
20
+ };
21
+ }
22
+ export interface Server {
23
+ start(): Promise<void>;
24
+ stop(): Promise<void>;
25
+ getExpressApp(): any;
26
+ getDatabase(): any;
27
+ getAuth(): any;
28
+ }
29
+ export interface User {
30
+ id: string | number;
31
+ username: string;
32
+ password?: string;
33
+ email?: string;
34
+ roles?: string[];
35
+ [key: string]: any;
36
+ }
37
+ export interface DbConfig {
38
+ url: string;
39
+ type: 'mongodb' | 'mysql' | 'postgres';
40
+ }
41
+ export interface MiddlewareFunction {
42
+ (req: any, res: any, next: any): void | Promise<void>;
43
+ }
44
+ export interface Todo {
45
+ id: number;
46
+ text: string;
47
+ completed: boolean;
48
+ }
49
+ export interface TodoItemProps {
50
+ todo: Todo;
51
+ onToggle: (id: number) => void;
52
+ onDelete: (id: number) => void;
53
+ }
54
+ export interface GoWasmInstance {
55
+ instance: WebAssembly.Instance;
56
+ module: WebAssembly.Module;
57
+ exports: WebAssembly.Exports;
58
+ functions: Record<string, Function>;
59
+ }
60
+ export interface GoWasmOptions {
61
+ debug?: boolean;
62
+ goWasmPath?: string;
63
+ importObject?: Record<string, any>;
64
+ onLoad?: (instance: GoWasmInstance) => void;
65
+ }
66
+ export declare const isBrowser: boolean;
67
+ export declare const isNode: string | false;
68
+ export declare const createConditionalExport: <T>(browserImpl: () => T, nodeImpl: () => T, fallback?: T) => T;
69
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/server/types.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE;QACZ,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC;QACrC,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;KAC3B,CAAC;IACF,EAAE,CAAC,EAAE;QACH,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;KACxC,CAAC;IACF,IAAI,CAAC,EAAE;QACL,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KAC7B,CAAC;CACH;AAGD,MAAM,WAAW,MAAM;IACrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,aAAa,IAAI,GAAG,CAAC;IACrB,WAAW,IAAI,GAAG,CAAC;IACnB,OAAO,IAAI,GAAG,CAAC;CAChB;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,GAAG,MAAM,C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C7C;AAGD,eAAO,MAAM,SAAS,SAAgC,CAAC;AACvD,eAAO,MAAM,MAAM,gBAA2D,CAAC;AAG/E,eAAO,MAAM,uBAAuB,GAAI,CAAC,EACvC,aAAa,MAAM,CAAC,EACpB,UAAU,MAAM,CAAC,EACjB,WAAW,CAAC,KACX,CAYF,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Utility functions for server-side operations
3
+ */
4
+ /**
5
+ * Safely parse JSON with error handling
6
+ */
7
+ export declare function safeJsonParse<T>(json: string, fallback: T): T;
8
+ /**
9
+ * Generate a secure random token
10
+ */
11
+ export declare function generateToken(length?: number): string;
12
+ /**
13
+ * Hash a string using SHA-256
14
+ */
15
+ export declare function hashString(input: string, salt?: string): string;
16
+ /**
17
+ * Get pagination parameters from request
18
+ */
19
+ export declare function getPagination(req: any): {
20
+ page: number;
21
+ limit: number;
22
+ skip: number;
23
+ };
24
+ /**
25
+ * Standard success response format
26
+ */
27
+ export declare function sendSuccess<T>(res: any, data: T, message?: string): any;
28
+ /**
29
+ * Standard error response format
30
+ */
31
+ export declare function sendError(res: any, message?: string, statusCode?: number, errors?: any): any;
32
+ /**
33
+ * Validate required fields in request body
34
+ */
35
+ export declare function validateFields(req: any, requiredFields: string[]): {
36
+ valid: boolean;
37
+ missing: string[];
38
+ };
39
+ /**
40
+ * Handle file upload validation
41
+ */
42
+ export declare function validateFileUpload(file: any, // Using 'any' to avoid the Express.Multer dependency
43
+ options?: {
44
+ maxSize?: number;
45
+ allowedTypes?: string[];
46
+ }): {
47
+ valid: boolean;
48
+ error?: string;
49
+ };
50
+ /**
51
+ * Get server environment information
52
+ */
53
+ export declare function getEnvironmentInfo(): Record<string, any>;
54
+ /**
55
+ * Check if a directory is empty
56
+ */
57
+ export declare function isDirectoryEmpty(dirPath: string): Promise<boolean>;
58
+ /**
59
+ * Create directory if it doesn't exist
60
+ */
61
+ export declare function ensureDirectory(dirPath: string): Promise<void>;
62
+ /**
63
+ * Write JSON to file
64
+ */
65
+ export declare function writeJsonFile(filePath: string, data: any): Promise<void>;
66
+ /**
67
+ * Read JSON from file
68
+ */
69
+ export declare function readJsonFile<T>(filePath: string, defaultValue: T): Promise<T>;
70
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/server/utils.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAM7D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,GAAE,MAAW,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,MAAW,GAAG,MAAM,CAEnE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAgBrF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,GAAE,MAAkB,GAAG,GAAG,CAMlF;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,MAA4B,EACrC,UAAU,GAAE,MAAY,EACxB,MAAM,CAAC,EAAE,GAAG,GACX,GAAG,CAML;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,GAAG,EACR,cAAc,EAAE,MAAM,EAAE,GACvB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAUvC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,GAAG,EAAE,qDAAqD;AAChE,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,GACL;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAyBpC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CASxD;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQxE;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOpE;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9E;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAOnF"}
@@ -0,0 +1,29 @@
1
+ import { GoWasmInstance, GoWasmOptions } from '../server/types.js';
2
+ /**
3
+ * Initialize the Node.js environment for running Go WASM modules
4
+ */
5
+ export declare function initNodeWasm(): Promise<void>;
6
+ /**
7
+ * Load a Go WASM module from a file path for server-side usage
8
+ */
9
+ export declare function loadGoWasmFromFile(wasmFilePath: string, options?: GoWasmOptions): Promise<GoWasmInstance>;
10
+ /**
11
+ * Call a Go WASM function in Node.js environment
12
+ */
13
+ export declare function callWasmFunction(funcName: string, ...args: any[]): any;
14
+ /**
15
+ * Check if Go WASM is ready in Node.js
16
+ */
17
+ export declare function isWasmReady(): boolean;
18
+ /**
19
+ * Get all available Go WASM functions in Node.js
20
+ */
21
+ export declare function getWasmFunctions(): string[];
22
+ declare global {
23
+ var Go: new () => {
24
+ importObject: any;
25
+ run: (instance: WebAssembly.Instance) => Promise<void>;
26
+ };
27
+ }
28
+ export type { GoWasmInstance, GoWasmOptions };
29
+ //# sourceMappingURL=wasm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../../src/server/wasm.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKnE;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAclD;AAuED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,cAAc,CAAC,CA+GzB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAOtE;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAKrC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAK3C;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,EAAE,EAAE,UAAU;QAChB,YAAY,EAAE,GAAG,CAAC;QAClB,GAAG,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACxD,CAAC;CACH;AAED,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Server-side rendering utilities
3
+ */
4
+ export declare function renderToString(component: any): string;
5
+ //# sourceMappingURL=server-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-renderer.d.ts","sourceRoot":"","sources":["../src/server-renderer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,cAAc,CAAC,SAAS,EAAE,GAAG,GAAG,MAAM,CAuBrD"}
package/dist/wasm.d.ts ADDED
@@ -0,0 +1,51 @@
1
+ /**
2
+ * WebAssembly integration for Frontend Hamroun
3
+ * Works in both browser and Node.js environments
4
+ */
5
+ export interface GoWasmOptions {
6
+ debug?: boolean;
7
+ goWasmPath?: string;
8
+ importObject?: any;
9
+ onLoad?: (instance: GoWasmInstance) => void;
10
+ }
11
+ export interface GoWasmInstance {
12
+ instance: WebAssembly.Instance;
13
+ module: WebAssembly.Module;
14
+ exports: WebAssembly.Exports;
15
+ functions: Record<string, Function>;
16
+ }
17
+ /**
18
+ * Load Go WASM module in the browser (like your working frontend code)
19
+ */
20
+ export declare function loadGoWasm(wasmUrl: string, options?: GoWasmOptions): Promise<GoWasmInstance>;
21
+ /**
22
+ * Call a Go WASM function (like your frontend code's callWasmFunction)
23
+ */
24
+ export declare function callWasmFunction(funcName: string, ...args: any[]): any;
25
+ /**
26
+ * Check if Go WASM is ready (like your frontend code's wasmReady state)
27
+ */
28
+ export declare function isWasmReady(): boolean;
29
+ /**
30
+ * Get all available Go WASM functions
31
+ */
32
+ export declare function getWasmFunctions(): string[];
33
+ /**
34
+ * Hook for React components (like your frontend code's useEffect pattern)
35
+ */
36
+ export declare function useGoWasm(wasmUrl: string, options?: GoWasmOptions): {
37
+ loadWasm: () => Promise<GoWasmInstance>;
38
+ callFunction: typeof callWasmFunction;
39
+ isReady: typeof isWasmReady;
40
+ getFunctions: typeof getWasmFunctions;
41
+ };
42
+ declare global {
43
+ interface Window {
44
+ Go: new () => {
45
+ importObject: any;
46
+ run: (instance: WebAssembly.Instance) => void;
47
+ };
48
+ [key: string]: any;
49
+ }
50
+ }
51
+ //# sourceMappingURL=wasm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;CAC7C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC;IAC/B,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC;IAC3B,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,cAAc,CAAC,CAwEzB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAWtE;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,OAAO,CASrC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAQ3C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB;;;;;EAarE;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,EAAE,EAAE,UAAU;YACZ,YAAY,EAAE,GAAG,CAAC;YAClB,GAAG,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,QAAQ,KAAK,IAAI,CAAC;SAC/C,CAAC;QACF,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baraqex",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "description": "A powerful full-stack framework built on top of frontend-hamroun",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -50,7 +50,7 @@
50
50
  "baraqex": "./bin/baraqex.js"
51
51
  },
52
52
  "scripts": {
53
- "build": "npm run clean && npm run build:types && npm run build:esm",
53
+ "build": "npm run clean && npm run build:esm",
54
54
  "build:types": "tsc --emitDeclarationOnly",
55
55
  "build:esm": "node build.mjs",
56
56
  "clean": "rimraf dist",
@@ -71,11 +71,11 @@
71
71
  "author": "Mohamed X",
72
72
  "license": "MIT",
73
73
  "dependencies": {
74
- "frontend-hamroun": "^1.2.35"
74
+ "frontend-hamroun": "^1.0.0"
75
75
  },
76
76
  "peerDependencies": {
77
- "cors": "^2.8.5",
78
- "express": "^4.18.0"
77
+ "express": "^4.18.0",
78
+ "cors": "^2.8.5"
79
79
  },
80
80
  "peerDependenciesMeta": {
81
81
  "express": {
@@ -101,24 +101,19 @@
101
101
  }
102
102
  },
103
103
  "devDependencies": {
104
- "@types/bcryptjs": "^2.4.6",
105
- "@types/cors": "^2.8.18",
106
- "@types/express": "^5.0.2",
107
- "@types/jsonwebtoken": "^9.0.9",
108
104
  "@types/node": "^20.0.0",
109
- "@types/pg": "^8.15.4",
110
- "esbuild": "^0.19.0",
105
+ "typescript": "^5.0.0",
111
106
  "jest": "^29.0.0",
112
107
  "rimraf": "^5.0.0",
113
- "typescript": "^5.0.0"
108
+ "esbuild": "^0.19.0"
114
109
  },
115
110
  "optionalDependencies": {
116
- "bcryptjs": "^2.4.3",
117
- "cors": "^2.8.5",
118
111
  "express": "^4.18.0",
119
- "jsonwebtoken": "^9.0.0",
112
+ "cors": "^2.8.5",
120
113
  "mongodb": "^6.0.0",
121
114
  "mysql2": "^3.6.0",
122
- "pg": "^8.11.0"
115
+ "pg": "^8.11.0",
116
+ "bcryptjs": "^2.4.3",
117
+ "jsonwebtoken": "^9.0.0"
123
118
  }
124
119
  }
@@ -8,7 +8,7 @@
8
8
  "name": "ssr-version",
9
9
  "version": "0.0.0",
10
10
  "dependencies": {
11
- "baraqex": "^1.0.36",
11
+ "baraqex": "^1.0.37",
12
12
  "express": "^4.18.2",
13
13
  "frontend-hamroun": "latest"
14
14
  },
@@ -713,12 +713,12 @@
713
713
  }
714
714
  },
715
715
  "node_modules/baraqex": {
716
- "version": "1.0.36",
717
- "resolved": "https://registry.npmjs.org/baraqex/-/baraqex-1.0.36.tgz",
718
- "integrity": "sha512-ecbhuEeUIt853CEO2i9YDcKwU7HHkZ9v0ZTfM62k3nNqHXiEKAC+FAnEDgko4JGAr6nuIjVHheo1zlh3YrEFiw==",
716
+ "version": "1.0.37",
717
+ "resolved": "https://registry.npmjs.org/baraqex/-/baraqex-1.0.37.tgz",
718
+ "integrity": "sha512-tHwlloLM2ErQt2wbypaxnbsJEeVb/P/tsBpy4ZNaguBcQmdn3g0IfsdMMCN2d65m2+dAOUgjBrKvkm+uLn46Ew==",
719
719
  "license": "MIT",
720
720
  "dependencies": {
721
- "frontend-hamroun": "^1.0.0"
721
+ "frontend-hamroun": "^1.2.35"
722
722
  },
723
723
  "bin": {
724
724
  "baraqex": "bin/baraqex.js"
@@ -10,7 +10,7 @@
10
10
  "start": "node dist/server.js"
11
11
  },
12
12
  "dependencies": {
13
- "baraqex": "^1.0.36",
13
+ "baraqex": "^1.0.37",
14
14
  "express": "^4.18.2",
15
15
  "frontend-hamroun": "latest"
16
16
  },
@@ -1,4 +1,4 @@
1
- import { useState, useEffect, useRef, useMemo } from 'baraqex/browser';
1
+ import { useState, useEffect, useRef, useMemo } from 'baraqex';
2
2
 
3
3
  // Custom hooks for better code organization
4
4
  function useTimer(initialTime = 0) {