baraqex 1.0.37 → 1.0.39
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/api/hello.d.ts +3 -0
- package/dist/api/hello.d.ts.map +1 -0
- package/dist/api/users/[id].d.ts +5 -0
- package/dist/api/users/[id].d.ts.map +1 -0
- package/dist/browser.d.ts +14 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +771 -140
- package/dist/browser.js.map +4 -4
- package/dist/frontend/components/WasmLoader.d.ts +2 -0
- package/dist/frontend/components/WasmLoader.d.ts.map +1 -0
- package/dist/frontend/hooks/useWasm.d.ts +2 -0
- package/dist/frontend/hooks/useWasm.d.ts.map +1 -0
- package/dist/frontend/index.d.ts +2 -0
- package/dist/frontend/index.d.ts.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +872 -220
- package/dist/index.js.map +4 -4
- package/dist/renderComponent.d.ts +9 -0
- package/dist/renderComponent.d.ts.map +1 -0
- package/dist/server/api-router.d.ts +16 -0
- package/dist/server/api-router.d.ts.map +1 -0
- package/dist/server/auth.d.ts +25 -0
- package/dist/server/auth.d.ts.map +1 -0
- package/dist/server/database.d.ts +22 -0
- package/dist/server/database.d.ts.map +1 -0
- package/dist/server/index.d.ts +115 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +212 -85
- package/dist/server/index.js.map +4 -4
- package/dist/server/middleware.d.ts +11 -0
- package/dist/server/middleware.d.ts.map +1 -0
- package/dist/server/templates.d.ts +31 -0
- package/dist/server/templates.d.ts.map +1 -0
- package/dist/server/types.d.ts +69 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/utils.d.ts +70 -0
- package/dist/server/utils.d.ts.map +1 -0
- package/dist/server/wasm.d.ts +29 -0
- package/dist/server/wasm.d.ts.map +1 -0
- package/dist/server-renderer.d.ts +5 -0
- package/dist/server-renderer.d.ts.map +1 -0
- package/dist/wasm.d.ts +51 -0
- package/dist/wasm.d.ts.map +1 -0
- package/package.json +3 -4
- package/templates/ssr-template/package-lock.json +4 -4
- package/templates/ssr-template/package.json +1 -1
|
@@ -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":"AAG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
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 @@
|
|
|
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.
|
|
3
|
+
"version": "1.0.39",
|
|
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:
|
|
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,7 +71,7 @@
|
|
|
71
71
|
"author": "Mohamed X",
|
|
72
72
|
"license": "MIT",
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"frontend-hamroun": "^1.2.
|
|
74
|
+
"frontend-hamroun": "^1.2.89"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"cors": "^2.8.5",
|
|
@@ -104,7 +104,6 @@
|
|
|
104
104
|
"@types/bcryptjs": "^2.4.6",
|
|
105
105
|
"@types/cors": "^2.8.18",
|
|
106
106
|
"@types/express": "^5.0.2",
|
|
107
|
-
"@types/jsonwebtoken": "^9.0.9",
|
|
108
107
|
"@types/node": "^20.0.0",
|
|
109
108
|
"@types/pg": "^8.15.4",
|
|
110
109
|
"esbuild": "^0.19.0",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"name": "ssr-version",
|
|
9
9
|
"version": "0.0.0",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"baraqex": "^1.0.
|
|
11
|
+
"baraqex": "^1.0.38",
|
|
12
12
|
"express": "^4.18.2",
|
|
13
13
|
"frontend-hamroun": "latest"
|
|
14
14
|
},
|
|
@@ -713,9 +713,9 @@
|
|
|
713
713
|
}
|
|
714
714
|
},
|
|
715
715
|
"node_modules/baraqex": {
|
|
716
|
-
"version": "1.0.
|
|
717
|
-
"resolved": "https://registry.npmjs.org/baraqex/-/baraqex-1.0.
|
|
718
|
-
"integrity": "sha512
|
|
716
|
+
"version": "1.0.38",
|
|
717
|
+
"resolved": "https://registry.npmjs.org/baraqex/-/baraqex-1.0.38.tgz",
|
|
718
|
+
"integrity": "sha512-/k2zyPAwaQ/8ysTzD+AjP8CDhssNXhPBBUfCXCMGvTqAo4U1msxHAu5cnc9g0qjGJwj1wDw3ywDM72nwPh2sjw==",
|
|
719
719
|
"license": "MIT",
|
|
720
720
|
"dependencies": {
|
|
721
721
|
"frontend-hamroun": "^1.0.0"
|