baraqex 1.0.44 → 1.0.46
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_WASM.md +472 -0
- package/dist/browser.js +1 -422
- package/dist/browser.js.map +4 -4
- package/dist/index.js +31 -421
- package/dist/index.js.map +4 -4
- package/dist/{server/index.js → server.js} +21 -114
- package/dist/server.js.map +7 -0
- package/package.json +48 -57
- package/templates/ssr-template/package-lock.json +2 -2
- package/templates/ssr-template/src/App.tsx +1 -1
- package/templates/ssr-template/src/client.tsx +1 -1
- package/templates/ssr-template/src/server.ts +1 -1
- package/templates/wasm/package-lock.json +3169 -2710
- package/templates/wasm/package.json +10 -12
- package/templates/wasm/src/App.tsx +50 -19
- package/templates/wasm/vite.config.ts +24 -59
- package/dist/api/hello.d.ts +0 -3
- package/dist/api/hello.d.ts.map +0 -1
- package/dist/api/users/[id].d.ts +0 -5
- package/dist/api/users/[id].d.ts.map +0 -1
- package/dist/browser.d.ts +0 -29
- package/dist/browser.d.ts.map +0 -1
- package/dist/browser.package.json +0 -4
- package/dist/frontend/components/WasmLoader.d.ts +0 -2
- package/dist/frontend/components/WasmLoader.d.ts.map +0 -1
- package/dist/frontend/hooks/useWasm.d.ts +0 -2
- package/dist/frontend/hooks/useWasm.d.ts.map +0 -1
- package/dist/frontend/index.d.ts +0 -2
- package/dist/frontend/index.d.ts.map +0 -1
- package/dist/index.d.ts +0 -34
- package/dist/index.d.ts.map +0 -1
- package/dist/renderComponent.d.ts +0 -9
- package/dist/renderComponent.d.ts.map +0 -1
- package/dist/server/api-router.d.ts +0 -16
- package/dist/server/api-router.d.ts.map +0 -1
- package/dist/server/auth.d.ts +0 -25
- package/dist/server/auth.d.ts.map +0 -1
- package/dist/server/database.d.ts +0 -22
- package/dist/server/database.d.ts.map +0 -1
- package/dist/server/index.d.ts +0 -115
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/index.js.map +0 -7
- package/dist/server/middleware.d.ts +0 -11
- package/dist/server/middleware.d.ts.map +0 -1
- package/dist/server/package.json +0 -4
- package/dist/server/templates.d.ts +0 -31
- package/dist/server/templates.d.ts.map +0 -1
- package/dist/server/types.d.ts +0 -69
- package/dist/server/types.d.ts.map +0 -1
- package/dist/server/utils.d.ts +0 -70
- package/dist/server/utils.d.ts.map +0 -1
- package/dist/server/wasm.d.ts +0 -29
- package/dist/server/wasm.d.ts.map +0 -1
- package/dist/server-renderer.d.ts +0 -5
- package/dist/server-renderer.d.ts.map +0 -1
- package/dist/wasm.d.ts +0 -51
- package/dist/wasm.d.ts.map +0 -1
- package/templates/wasm/src/index.html +0 -14
- package/templates/wasm/src/main.tsx +0 -5
- package/templates/wasm/src/wasm-loader.ts +0 -119
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "wasm-
|
|
3
|
-
"version": "
|
|
2
|
+
"name": "wasm-app",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Frontend Hamroun WASM Application",
|
|
5
|
+
"main": "src/App.tsx",
|
|
4
6
|
"type": "module",
|
|
5
7
|
"scripts": {
|
|
6
8
|
"dev": "vite",
|
|
7
9
|
"build": "vite build",
|
|
8
|
-
"build:wasm": "cd wasm && GOOS=js GOARCH=wasm go build -o ../public/example.wasm main.go",
|
|
9
|
-
"
|
|
10
|
+
"build:wasm": "cd wasm && set GOOS=js && set GOARCH=wasm && go build -o ../public/example.wasm main.go",
|
|
11
|
+
"copy:wasm-exec": "copy \"%GOROOT%\\misc\\wasm\\wasm_exec.js\" public\\",
|
|
12
|
+
"setup:wasm": "npm run copy:wasm-exec && npm run build:wasm",
|
|
10
13
|
"preview": "vite preview",
|
|
11
|
-
"
|
|
12
|
-
"copy-wasm-exec:win": "copy \"%GOROOT%\\misc\\wasm\\wasm_exec.js\" public\\",
|
|
13
|
-
"setup": "npm run copy-wasm-exec && npm run build:wasm",
|
|
14
|
-
"setup:win": "npm run copy-wasm-exec:win && npm run build:wasm:win"
|
|
14
|
+
"type-check": "tsc --noEmit"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
17
|
+
"frontend-hamroun": "^1.0.35" ,
|
|
18
|
+
"baraqex": "1.0.45"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^20.0.0",
|
|
22
|
-
"buffer": "^6.0.3",
|
|
23
|
-
"process": "^0.11.10",
|
|
24
22
|
"typescript": "^5.0.0",
|
|
25
23
|
"vite": "^5.0.0"
|
|
26
24
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, useState, useEffect } from 'frontend-hamroun';
|
|
2
|
-
import { loadGoWasm, callWasmFunction
|
|
2
|
+
import { loadGoWasm, callWasmFunction } from 'baraqex';
|
|
3
3
|
|
|
4
4
|
export default function App() {
|
|
5
5
|
const [wasmReady, setWasmReady] = useState(false);
|
|
@@ -16,13 +16,13 @@ export default function App() {
|
|
|
16
16
|
|
|
17
17
|
async function loadWasm() {
|
|
18
18
|
try {
|
|
19
|
-
console.log('Loading Go WASM module...');
|
|
19
|
+
console.log('Loading Go WASM module using baraqex API...');
|
|
20
20
|
|
|
21
|
-
//
|
|
21
|
+
// Use baraqex API to load WASM
|
|
22
22
|
await loadGoWasm('/example.wasm', {
|
|
23
23
|
debug: true,
|
|
24
24
|
onLoad: () => {
|
|
25
|
-
console.log('WASM module loaded successfully');
|
|
25
|
+
console.log('WASM module loaded successfully via baraqex');
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
|
|
@@ -46,12 +46,10 @@ export default function App() {
|
|
|
46
46
|
};
|
|
47
47
|
}, []);
|
|
48
48
|
|
|
49
|
-
//
|
|
49
|
+
// Use baraqex callWasmFunction API
|
|
50
50
|
const callFunction = (funcName: string, ...args: any[]) => {
|
|
51
51
|
try {
|
|
52
|
-
|
|
53
|
-
throw new Error('WASM not ready yet');
|
|
54
|
-
}
|
|
52
|
+
// Call using baraqex API
|
|
55
53
|
return callWasmFunction(funcName, ...args);
|
|
56
54
|
} catch (error) {
|
|
57
55
|
const errorMsg = error instanceof Error ? error.message : 'Function call failed';
|
|
@@ -104,10 +102,7 @@ export default function App() {
|
|
|
104
102
|
}
|
|
105
103
|
};
|
|
106
104
|
|
|
107
|
-
|
|
108
|
-
const currentError = wasmError || getWasmError();
|
|
109
|
-
|
|
110
|
-
if (!wasmReady && !currentError) {
|
|
105
|
+
if (!wasmReady && !wasmError) {
|
|
111
106
|
return (
|
|
112
107
|
<div className="app loading">
|
|
113
108
|
<div className="spinner"></div>
|
|
@@ -117,11 +112,11 @@ export default function App() {
|
|
|
117
112
|
);
|
|
118
113
|
}
|
|
119
114
|
|
|
120
|
-
if (
|
|
115
|
+
if (wasmError) {
|
|
121
116
|
return (
|
|
122
117
|
<div className="app error">
|
|
123
118
|
<h2>WASM Error</h2>
|
|
124
|
-
<p>{
|
|
119
|
+
<p>{wasmError}</p>
|
|
125
120
|
<button onClick={() => window.location.reload()}>Reload Page</button>
|
|
126
121
|
<details style={{ marginTop: '20px', textAlign: 'left' }}>
|
|
127
122
|
<summary>Troubleshooting</summary>
|
|
@@ -139,11 +134,11 @@ export default function App() {
|
|
|
139
134
|
return (
|
|
140
135
|
<div className="app">
|
|
141
136
|
<header>
|
|
142
|
-
<h1>
|
|
143
|
-
<p>High-performance computing with WebAssembly</p>
|
|
137
|
+
<h1>Frontend Hamroun + Go WASM (Baraqex)</h1>
|
|
138
|
+
<p>High-performance computing with WebAssembly via Baraqex API</p>
|
|
144
139
|
<div className="status">
|
|
145
140
|
<span className="status-indicator ready"></span>
|
|
146
|
-
WASM Ready
|
|
141
|
+
WASM Ready via Baraqex
|
|
147
142
|
</div>
|
|
148
143
|
</header>
|
|
149
144
|
|
|
@@ -185,7 +180,7 @@ export default function App() {
|
|
|
185
180
|
<button onClick={handleAddition}>Add</button>
|
|
186
181
|
<button onClick={handleMultiplication}>Multiply</button>
|
|
187
182
|
</div>
|
|
188
|
-
<small>
|
|
183
|
+
<small>callWasmFunction('goAdd', {inputA}, {inputB})</small>
|
|
189
184
|
</div>
|
|
190
185
|
|
|
191
186
|
{/* Fibonacci */}
|
|
@@ -224,7 +219,7 @@ export default function App() {
|
|
|
224
219
|
{/* Results Display */}
|
|
225
220
|
{result && (
|
|
226
221
|
<section className="results">
|
|
227
|
-
<h2>📊 WASM Result</h2>
|
|
222
|
+
<h2>📊 Baraqex WASM Result</h2>
|
|
228
223
|
<div className="result-card">
|
|
229
224
|
{result.type === 'hello' && (
|
|
230
225
|
<p><strong>Greeting:</strong> <span className="result-value">{result.value}</span></p>
|
|
@@ -454,6 +449,42 @@ export default function App() {
|
|
|
454
449
|
border-radius: 4px;
|
|
455
450
|
}
|
|
456
451
|
|
|
452
|
+
.info-section {
|
|
453
|
+
margin-top: 40px;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.info-section h2 {
|
|
457
|
+
text-align: center;
|
|
458
|
+
margin-bottom: 30px;
|
|
459
|
+
color: #374151;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.benefits-grid {
|
|
463
|
+
display: grid;
|
|
464
|
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
465
|
+
gap: 20px;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.benefit {
|
|
469
|
+
background: #f9fafb;
|
|
470
|
+
padding: 20px;
|
|
471
|
+
border-radius: 12px;
|
|
472
|
+
border: 1px solid #e5e7eb;
|
|
473
|
+
text-align: center;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.benefit h4 {
|
|
477
|
+
margin: 0 0 8px 0;
|
|
478
|
+
color: #374151;
|
|
479
|
+
font-size: 1.1rem;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.benefit p {
|
|
483
|
+
margin: 0;
|
|
484
|
+
color: #6b7280;
|
|
485
|
+
font-size: 0.9rem;
|
|
486
|
+
}
|
|
487
|
+
|
|
457
488
|
.error {
|
|
458
489
|
color: #dc2626;
|
|
459
490
|
}
|
|
@@ -2,72 +2,37 @@ import { defineConfig } from 'vite';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
|
|
4
4
|
export default defineConfig({
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
esbuild: {
|
|
6
|
+
jsx: 'transform',
|
|
7
|
+
jsxFactory: 'jsx',
|
|
8
|
+
jsxFragment: 'Fragment',
|
|
9
|
+
jsxImportSource: 'frontend-hamroun',
|
|
10
|
+
},
|
|
11
|
+
optimizeDeps: {
|
|
12
|
+
include: ['frontend-hamroun'],
|
|
13
|
+
exclude: []
|
|
14
|
+
},
|
|
15
|
+
server: {
|
|
16
|
+
fs: {
|
|
17
|
+
allow: ['..', '../..']
|
|
18
|
+
},
|
|
19
|
+
headers: {
|
|
20
|
+
'Cross-Origin-Embedder-Policy': 'require-corp',
|
|
21
|
+
'Cross-Origin-Opener-Policy': 'same-origin'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
7
24
|
build: {
|
|
8
|
-
|
|
9
|
-
emptyOutDir: true,
|
|
25
|
+
target: 'esnext',
|
|
10
26
|
rollupOptions: {
|
|
11
|
-
|
|
12
|
-
|
|
27
|
+
output: {
|
|
28
|
+
format: 'es'
|
|
13
29
|
}
|
|
14
30
|
}
|
|
15
31
|
},
|
|
16
|
-
server: {
|
|
17
|
-
port: 3000,
|
|
18
|
-
open: true
|
|
19
|
-
},
|
|
20
|
-
optimizeDeps: {
|
|
21
|
-
exclude: [
|
|
22
|
-
// Exclude Node.js-only packages from browser bundling
|
|
23
|
-
'crypto',
|
|
24
|
-
'mongodb',
|
|
25
|
-
'mysql2',
|
|
26
|
-
'pg',
|
|
27
|
-
'bcryptjs',
|
|
28
|
-
'jsonwebtoken',
|
|
29
|
-
'cors',
|
|
30
|
-
'express',
|
|
31
|
-
'fs',
|
|
32
|
-
'path',
|
|
33
|
-
'url',
|
|
34
|
-
'http',
|
|
35
|
-
'https',
|
|
36
|
-
'stream',
|
|
37
|
-
'util',
|
|
38
|
-
'events',
|
|
39
|
-
'buffer',
|
|
40
|
-
'assert',
|
|
41
|
-
'child_process',
|
|
42
|
-
'cluster',
|
|
43
|
-
'dgram',
|
|
44
|
-
'dns',
|
|
45
|
-
'domain',
|
|
46
|
-
'net',
|
|
47
|
-
'os',
|
|
48
|
-
'punycode',
|
|
49
|
-
'querystring',
|
|
50
|
-
'readline',
|
|
51
|
-
'repl',
|
|
52
|
-
'string_decoder',
|
|
53
|
-
'sys',
|
|
54
|
-
'timers',
|
|
55
|
-
'tls',
|
|
56
|
-
'tty',
|
|
57
|
-
'vm',
|
|
58
|
-
'worker_threads',
|
|
59
|
-
'zlib'
|
|
60
|
-
]
|
|
61
|
-
},
|
|
62
|
-
define: {
|
|
63
|
-
global: 'globalThis',
|
|
64
|
-
'process.env': {}
|
|
65
|
-
},
|
|
66
32
|
resolve: {
|
|
67
33
|
alias: {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
process: 'process/browser'
|
|
34
|
+
'frontend-hamroun/jsx-dev-runtime': 'frontend-hamroun',
|
|
35
|
+
'frontend-hamroun/jsx-runtime': 'frontend-hamroun'
|
|
71
36
|
}
|
|
72
37
|
}
|
|
73
38
|
});
|
package/dist/api/hello.d.ts
DELETED
package/dist/api/hello.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hello.d.ts","sourceRoot":"","sources":["../../src/api/hello.js"],"names":[],"mappings":"AAAA,8CAOC;AAED,+CAQC"}
|
package/dist/api/users/[id].d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"[id].d.ts","sourceRoot":"","sources":["../../../src/api/users/[id].js"],"names":[],"mappings":"AAOA,6CAeC;AAED,6CAmBC;AAED,iDAkBC"}
|
package/dist/browser.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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 declare function generateDocument(content: string, options?: any): string;
|
|
9
|
-
export declare function generateErrorPage(statusCode: number, message: string): string;
|
|
10
|
-
export declare function generateLoadingPage(message?: string): string;
|
|
11
|
-
export declare function renderToString(content: any): string;
|
|
12
|
-
export declare function generateToken(length?: number): string;
|
|
13
|
-
export declare function safeJsonParse<T>(json: string, fallback: T): T;
|
|
14
|
-
export declare const isBrowser: boolean;
|
|
15
|
-
export declare const isNode = false;
|
|
16
|
-
export declare const Server: null;
|
|
17
|
-
export declare const createServer: null;
|
|
18
|
-
export declare const createDevServer: null;
|
|
19
|
-
export declare const createProductionServer: null;
|
|
20
|
-
export declare const Database: null;
|
|
21
|
-
export declare const AuthService: null;
|
|
22
|
-
export declare const ApiRouter: null;
|
|
23
|
-
export declare const requestLogger: null;
|
|
24
|
-
export declare const errorHandler: null;
|
|
25
|
-
export declare const notFoundHandler: null;
|
|
26
|
-
export declare const rateLimit: null;
|
|
27
|
-
export declare const initNodeWasm: null;
|
|
28
|
-
export declare const loadGoWasmFromFile: null;
|
|
29
|
-
//# sourceMappingURL=browser.d.ts.map
|
package/dist/browser.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;AAI/D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,GAAQ,GAAG,MAAM,CAiB3E;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAQ7E;AAED,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,MAAqB,GAAG,MAAM,CAa1E;AAYD,wBAAgB,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,CAanD;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;AAG5B,eAAO,MAAM,MAAM,MAAO,CAAC;AAC3B,eAAO,MAAM,YAAY,MAAO,CAAC;AACjC,eAAO,MAAM,eAAe,MAAO,CAAC;AACpC,eAAO,MAAM,sBAAsB,MAAO,CAAC;AAC3C,eAAO,MAAM,QAAQ,MAAO,CAAC;AAC7B,eAAO,MAAM,WAAW,MAAO,CAAC;AAChC,eAAO,MAAM,SAAS,MAAO,CAAC;AAC9B,eAAO,MAAM,aAAa,MAAO,CAAC;AAClC,eAAO,MAAM,YAAY,MAAO,CAAC;AACjC,eAAO,MAAM,eAAe,MAAO,CAAC;AACpC,eAAO,MAAM,SAAS,MAAO,CAAC;AAC9B,eAAO,MAAM,YAAY,MAAO,CAAC;AACjC,eAAO,MAAM,kBAAkB,MAAO,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WasmLoader.d.ts","sourceRoot":"","sources":["../../../src/frontend/components/WasmLoader.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWasm.d.ts","sourceRoot":"","sources":["../../../src/frontend/hooks/useWasm.ts"],"names":[],"mappings":""}
|
package/dist/frontend/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/frontend/index.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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
|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AAC;AAClC,eAAO,IAAI,aAAa,EAAE,GAAU,CAAC;AACrC,eAAO,IAAI,WAAW,EAAE,GAAU,CAAC;AACnC,eAAO,IAAI,SAAS,EAAE,GAAU,CAAC;AACjC,eAAO,IAAI,cAAc,EAAE,GAAU,CAAC;AACtC,eAAO,IAAI,kBAAkB,EAAE,GAAU,CAAC;AAC1C,eAAO,IAAI,kBAAkB,EAAE,GAAU,CAAC;AAC1C,eAAO,IAAI,gBAAgB,EAAE,GAAU,CAAC;AACxC,eAAO,IAAI,eAAe,EAAE,GAAU,CAAC;AACvC,eAAO,IAAI,aAAa,EAAE,GAAU,CAAC;AACrC,eAAO,IAAI,YAAY,EAAE,GAAU,CAAC;AACpC,eAAO,IAAI,qBAAqB,EAAE,GAAU,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/server/auth.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/server/index.d.ts
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
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) => {
|
|
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) => {
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAgD,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG1F,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAgB,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAkB7D,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,GAAG,CAAC;IAClB,EAAE,CAAC,EAAE;QACH,G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