@energy8platform/platform-core 0.16.0
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 +482 -0
- package/bin/simulate.ts +139 -0
- package/dist/dev-bridge.cjs.js +237 -0
- package/dist/dev-bridge.cjs.js.map +1 -0
- package/dist/dev-bridge.d.ts +141 -0
- package/dist/dev-bridge.esm.js +235 -0
- package/dist/dev-bridge.esm.js.map +1 -0
- package/dist/index.cjs.js +569 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +439 -0
- package/dist/index.esm.js +560 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/loading.cjs.js +190 -0
- package/dist/loading.cjs.js.map +1 -0
- package/dist/loading.d.ts +86 -0
- package/dist/loading.esm.js +185 -0
- package/dist/loading.esm.js.map +1 -0
- package/dist/lua.cjs.js +1129 -0
- package/dist/lua.cjs.js.map +1 -0
- package/dist/lua.d.ts +319 -0
- package/dist/lua.esm.js +1119 -0
- package/dist/lua.esm.js.map +1 -0
- package/dist/simulation.cjs.js +374 -0
- package/dist/simulation.cjs.js.map +1 -0
- package/dist/simulation.d.ts +190 -0
- package/dist/simulation.esm.js +368 -0
- package/dist/simulation.esm.js.map +1 -0
- package/dist/vite.cjs.js +179 -0
- package/dist/vite.cjs.js.map +1 -0
- package/dist/vite.d.ts +13 -0
- package/dist/vite.esm.js +176 -0
- package/dist/vite.esm.js.map +1 -0
- package/package.json +100 -0
- package/scripts/install-simulate.mjs +101 -0
- package/src/EventEmitter.ts +55 -0
- package/src/PlatformSession.ts +156 -0
- package/src/dev-bridge/DevBridge.ts +305 -0
- package/src/dev-bridge/index.ts +2 -0
- package/src/index.ts +98 -0
- package/src/loading/CSSPreloader.ts +129 -0
- package/src/loading/index.ts +3 -0
- package/src/loading/logo.ts +95 -0
- package/src/lua/ActionRouter.ts +132 -0
- package/src/lua/LuaEngine.ts +412 -0
- package/src/lua/LuaEngineAPI.ts +314 -0
- package/src/lua/PersistentState.ts +80 -0
- package/src/lua/SessionManager.ts +227 -0
- package/src/lua/SimulationRunner.ts +192 -0
- package/src/lua/fengari.d.ts +10 -0
- package/src/lua/index.ts +28 -0
- package/src/lua/types.ts +149 -0
- package/src/simulation/NativeSimulationRunner.ts +367 -0
- package/src/simulation/ParallelSimulationRunner.ts +156 -0
- package/src/simulation/SimulationWorker.ts +44 -0
- package/src/simulation/index.ts +21 -0
- package/src/types.ts +85 -0
- package/src/vite/index.ts +196 -0
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import { spawn, execSync } from 'child_process';
|
|
2
|
+
import { writeFile, unlink } from 'fs/promises';
|
|
3
|
+
import { accessSync, constants } from 'fs';
|
|
4
|
+
import { join, dirname } from 'path';
|
|
5
|
+
import { tmpdir, cpus } from 'os';
|
|
6
|
+
import { randomBytes } from 'crypto';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
import { Worker } from 'worker_threads';
|
|
9
|
+
|
|
10
|
+
// ─── Runner ─────────────────────────────────────────────
|
|
11
|
+
class NativeSimulationRunner {
|
|
12
|
+
config;
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.config = config;
|
|
15
|
+
}
|
|
16
|
+
async run() {
|
|
17
|
+
const { binaryPath, script, gameDefinition, iterations, bet, action, params } = this.config;
|
|
18
|
+
const id = randomBytes(8).toString('hex');
|
|
19
|
+
const tmpDir = tmpdir();
|
|
20
|
+
const luaPath = join(tmpDir, `sim-${id}.lua`);
|
|
21
|
+
const configPath = join(tmpDir, `sim-${id}.json`);
|
|
22
|
+
try {
|
|
23
|
+
// Write temp files
|
|
24
|
+
await Promise.all([
|
|
25
|
+
writeFile(luaPath, script, 'utf-8'),
|
|
26
|
+
writeFile(configPath, JSON.stringify({ ...gameDefinition, script_path: luaPath }), 'utf-8'),
|
|
27
|
+
]);
|
|
28
|
+
// Build CLI args
|
|
29
|
+
const args = [
|
|
30
|
+
'-config', configPath,
|
|
31
|
+
'-iterations', String(iterations),
|
|
32
|
+
'-bet', String(bet),
|
|
33
|
+
'-format', 'json',
|
|
34
|
+
];
|
|
35
|
+
if (action) {
|
|
36
|
+
args.push('-action', action);
|
|
37
|
+
}
|
|
38
|
+
if (params && Object.keys(params).length > 0) {
|
|
39
|
+
args.push('-params', JSON.stringify(params));
|
|
40
|
+
}
|
|
41
|
+
// Execute binary
|
|
42
|
+
const output = await this.exec(binaryPath, args);
|
|
43
|
+
// Parse JSON output
|
|
44
|
+
const json = JSON.parse(output);
|
|
45
|
+
return mapGoResult(json);
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
// Cleanup temp files
|
|
49
|
+
await Promise.allSettled([unlink(luaPath), unlink(configPath)]);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exec(binary, args) {
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
const child = spawn(binary, args, { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
55
|
+
let stdout = '';
|
|
56
|
+
let stderr = '';
|
|
57
|
+
child.stdout.on('data', (chunk) => {
|
|
58
|
+
stdout += chunk.toString();
|
|
59
|
+
});
|
|
60
|
+
child.stderr.on('data', (chunk) => {
|
|
61
|
+
stderr += chunk.toString();
|
|
62
|
+
});
|
|
63
|
+
child.on('error', (err) => {
|
|
64
|
+
reject(new Error(`Failed to execute simulation binary: ${err.message}`));
|
|
65
|
+
});
|
|
66
|
+
child.on('close', (code) => {
|
|
67
|
+
if (code !== 0) {
|
|
68
|
+
reject(new Error(`Simulation binary exited with code ${code}: ${stderr.trim()}`));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
resolve(stdout);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// ─── Result mapping ─────────────────────────────────────
|
|
78
|
+
function mapGoResult(json) {
|
|
79
|
+
const baseStage = json.per_stage_stats?.base_game;
|
|
80
|
+
const baseGameRtp = baseStage?.rtp ?? 0;
|
|
81
|
+
const baseGameWin = baseStage?.total_win ?? 0;
|
|
82
|
+
const perStage = json.per_stage_stats
|
|
83
|
+
? Object.fromEntries(Object.entries(json.per_stage_stats).map(([key, s]) => [
|
|
84
|
+
key,
|
|
85
|
+
{
|
|
86
|
+
totalWin: s.total_win,
|
|
87
|
+
spinCount: s.spin_count,
|
|
88
|
+
hitCount: s.hit_count,
|
|
89
|
+
maxWin: s.max_win,
|
|
90
|
+
rtp: s.rtp,
|
|
91
|
+
perSpinRtp: s.per_spin_rtp,
|
|
92
|
+
hitFrequency: s.hit_frequency,
|
|
93
|
+
avgWin: s.avg_win,
|
|
94
|
+
},
|
|
95
|
+
]))
|
|
96
|
+
: undefined;
|
|
97
|
+
return {
|
|
98
|
+
gameId: json.game_id,
|
|
99
|
+
action: 'spin',
|
|
100
|
+
iterations: json.iterations,
|
|
101
|
+
durationMs: Math.round(json.duration_sec * 1000),
|
|
102
|
+
totalRtp: json.total_rtp,
|
|
103
|
+
baseGameRtp,
|
|
104
|
+
bonusRtp: json.total_rtp - baseGameRtp,
|
|
105
|
+
hitFrequency: json.hit_frequency,
|
|
106
|
+
maxWin: json.max_win,
|
|
107
|
+
maxWinHits: json.max_win_hits,
|
|
108
|
+
bonusTriggered: json.bonus_triggered,
|
|
109
|
+
bonusSpinsPlayed: json.bonus_spins_total,
|
|
110
|
+
speed: json.speed,
|
|
111
|
+
workersUsed: json.workers_used,
|
|
112
|
+
perStage,
|
|
113
|
+
winDistribution: json.win_distribution,
|
|
114
|
+
_raw: {
|
|
115
|
+
totalWagered: json.total_bet,
|
|
116
|
+
totalWon: json.total_win,
|
|
117
|
+
baseGameWin,
|
|
118
|
+
bonusWin: json.total_win - baseGameWin,
|
|
119
|
+
hits: json.iterations > 0 ? Math.round((json.hit_frequency * json.iterations) / 100) : 0,
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
// ─── Binary discovery ───────────────────────────────────
|
|
124
|
+
/**
|
|
125
|
+
* Search for a native simulation binary in standard locations.
|
|
126
|
+
* Returns the absolute path if found, null otherwise.
|
|
127
|
+
*/
|
|
128
|
+
function findNativeBinary(baseDir) {
|
|
129
|
+
// 1. Explicit env var
|
|
130
|
+
const envPath = process.env.SIMULATE_BINARY;
|
|
131
|
+
if (envPath && isExecutable(envPath)) {
|
|
132
|
+
return envPath;
|
|
133
|
+
}
|
|
134
|
+
const platform = process.platform; // darwin, linux, win32
|
|
135
|
+
const nodeArch = process.arch; // arm64, x64
|
|
136
|
+
const goArch = nodeArch === 'x64' ? 'amd64' : nodeArch;
|
|
137
|
+
const goPlatform = platform === 'win32' ? 'windows' : platform;
|
|
138
|
+
const ext = platform === 'win32' ? '.exe' : '';
|
|
139
|
+
const names = [
|
|
140
|
+
`simulate-${goPlatform}-${goArch}${ext}`,
|
|
141
|
+
`simulation-${goPlatform}-${goArch}${ext}`,
|
|
142
|
+
`simulate${ext}`,
|
|
143
|
+
`simulation${ext}`,
|
|
144
|
+
];
|
|
145
|
+
// Search directories: user's project first, then this package's bin/
|
|
146
|
+
const searchDirs = [];
|
|
147
|
+
if (baseDir)
|
|
148
|
+
searchDirs.push(baseDir);
|
|
149
|
+
// This package's root (where postinstall downloads the binary)
|
|
150
|
+
try {
|
|
151
|
+
const pkgRoot = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
152
|
+
if (!searchDirs.includes(pkgRoot))
|
|
153
|
+
searchDirs.push(pkgRoot);
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
// fallback for CJS
|
|
157
|
+
if (typeof __dirname !== 'undefined') {
|
|
158
|
+
const pkgRoot = join(__dirname, '..');
|
|
159
|
+
if (!searchDirs.includes(pkgRoot))
|
|
160
|
+
searchDirs.push(pkgRoot);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
for (const dir of searchDirs) {
|
|
164
|
+
for (const name of names) {
|
|
165
|
+
const candidate = join(dir, 'bin', name);
|
|
166
|
+
if (isExecutable(candidate))
|
|
167
|
+
return candidate;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// Check $PATH
|
|
171
|
+
for (const bin of ['simulate', 'simulation']) {
|
|
172
|
+
try {
|
|
173
|
+
const cmd = platform === 'win32' ? `where ${bin}` : `which ${bin}`;
|
|
174
|
+
const result = execSync(cmd, { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'ignore'] }).trim();
|
|
175
|
+
if (result)
|
|
176
|
+
return result.split('\n')[0];
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
// not found
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
function isExecutable(path) {
|
|
185
|
+
try {
|
|
186
|
+
accessSync(path, constants.X_OK);
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
// ─── Extended formatting ────────────────────────────────
|
|
194
|
+
/** Format a NativeSimulationResult with per-stage and distribution data */
|
|
195
|
+
function formatNativeResult(result) {
|
|
196
|
+
const lines = [
|
|
197
|
+
'',
|
|
198
|
+
'--- Simulation Results ---',
|
|
199
|
+
`Game: ${result.gameId}`,
|
|
200
|
+
`Iterations: ${result.iterations.toLocaleString()}`,
|
|
201
|
+
`Duration: ${(result.durationMs / 1000).toFixed(1)}s`,
|
|
202
|
+
];
|
|
203
|
+
if (result.speed) {
|
|
204
|
+
lines.push(`Speed: ${Math.round(result.speed).toLocaleString()} iterations/sec`);
|
|
205
|
+
}
|
|
206
|
+
if (result.workersUsed) {
|
|
207
|
+
lines.push(`Workers: ${result.workersUsed}`);
|
|
208
|
+
}
|
|
209
|
+
lines.push('', '--- Total ---', `Total RTP: ${result.totalRtp.toFixed(2)}%`, `Base Game RTP: ${result.baseGameRtp.toFixed(2)}%`, `Bonus RTP: ${result.bonusRtp.toFixed(2)}%`, `Hit Frequency: ${result.hitFrequency.toFixed(2)}%`, `Max Win: ${result.maxWin.toFixed(2)}x`, `Max Win Cap Hits: ${result.maxWinHits}`);
|
|
210
|
+
if (result.bonusTriggered > 0) {
|
|
211
|
+
const frequency = Math.round(result.iterations / result.bonusTriggered);
|
|
212
|
+
lines.push('', '--- Bonus Stats ---', `Bonus Triggered: ${result.bonusTriggered.toLocaleString()} (1 in ${frequency} spins)`, `Bonus Spins Total: ${result.bonusSpinsPlayed.toLocaleString()}`);
|
|
213
|
+
}
|
|
214
|
+
// Per-stage breakdown
|
|
215
|
+
if (result.perStage && Object.keys(result.perStage).length > 0) {
|
|
216
|
+
lines.push('', '--- Per-Stage Breakdown ---');
|
|
217
|
+
const header = 'Stage | Spins | RTP (contrib) | Per-Spin RTP | Hit Freq | Avg Win | Max Win';
|
|
218
|
+
lines.push(header);
|
|
219
|
+
lines.push('-'.repeat(header.length));
|
|
220
|
+
for (const [stage, stats] of Object.entries(result.perStage)) {
|
|
221
|
+
lines.push(`${stage.padEnd(20)} | ${String(stats.spinCount).padStart(10)} | ` +
|
|
222
|
+
`${stats.rtp.toFixed(2).padStart(12)}% | ` +
|
|
223
|
+
`${stats.perSpinRtp.toFixed(2).padStart(11)}% | ` +
|
|
224
|
+
`${stats.hitFrequency.toFixed(2).padStart(8)}% | ` +
|
|
225
|
+
`${stats.avgWin.toFixed(3).padStart(8)}x | ` +
|
|
226
|
+
`${stats.maxWin.toFixed(2).padStart(8)}x`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// Win distribution
|
|
230
|
+
if (result.winDistribution && result.winDistribution.length > 0) {
|
|
231
|
+
lines.push('', '--- Win Distribution ---');
|
|
232
|
+
for (const bucket of result.winDistribution) {
|
|
233
|
+
const bar = '█'.repeat(Math.round(bucket.pct / 2));
|
|
234
|
+
lines.push(`${bucket.label.padEnd(10)} ${String(bucket.count).padStart(10)} (${bucket.pct.toFixed(2).padStart(6)}%) ${bar}`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return lines.join('\n');
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/// <reference types="node" />
|
|
241
|
+
const SEED_STRIDE = 1 << 20; // 2^20 — gap between worker seeds to avoid overlap
|
|
242
|
+
/**
|
|
243
|
+
* Runs simulation across multiple worker threads for parallel speedup.
|
|
244
|
+
* Each worker gets an independent LuaEngine with a partitioned seed range.
|
|
245
|
+
*
|
|
246
|
+
* Results are statistically equivalent to single-threaded mode but not
|
|
247
|
+
* bit-identical (different RNG sequence ordering).
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```ts
|
|
251
|
+
* const runner = new ParallelSimulationRunner({
|
|
252
|
+
* script: luaSource,
|
|
253
|
+
* gameDefinition,
|
|
254
|
+
* iterations: 1_000_000,
|
|
255
|
+
* bet: 1.0,
|
|
256
|
+
* workerCount: 8,
|
|
257
|
+
* onProgress: (done, total) => console.log(`${done}/${total}`),
|
|
258
|
+
* });
|
|
259
|
+
* const result = await runner.run();
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
class ParallelSimulationRunner {
|
|
263
|
+
config;
|
|
264
|
+
workerCount;
|
|
265
|
+
constructor(config) {
|
|
266
|
+
this.config = config;
|
|
267
|
+
const maxWorkers = cpus().length;
|
|
268
|
+
this.workerCount = Math.max(1, Math.min(config.workerCount ?? maxWorkers, maxWorkers, config.iterations));
|
|
269
|
+
}
|
|
270
|
+
async run() {
|
|
271
|
+
const { iterations, seed, onProgress, workerCount: _, ...restConfig } = this.config;
|
|
272
|
+
const workerCount = this.workerCount;
|
|
273
|
+
// Split iterations evenly, remainder goes to last worker
|
|
274
|
+
const baseChunk = Math.floor(iterations / workerCount);
|
|
275
|
+
const remainder = iterations - baseChunk * workerCount;
|
|
276
|
+
const workerPath = join(dirname(fileURLToPath(import.meta.url)), 'SimulationWorker.ts');
|
|
277
|
+
const progressPerWorker = new Array(workerCount).fill(0);
|
|
278
|
+
const totalIterations = iterations;
|
|
279
|
+
const promises = Array.from({ length: workerCount }, (_, i) => {
|
|
280
|
+
const workerIterations = baseChunk + (i < remainder ? 1 : 0);
|
|
281
|
+
const workerSeed = seed !== undefined ? seed + i * SEED_STRIDE : undefined;
|
|
282
|
+
const workerConfig = {
|
|
283
|
+
config: {
|
|
284
|
+
...restConfig,
|
|
285
|
+
iterations: workerIterations,
|
|
286
|
+
seed: workerSeed,
|
|
287
|
+
progressInterval: this.config.progressInterval,
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
return new Promise((resolve, reject) => {
|
|
291
|
+
const worker = new Worker(workerPath, {
|
|
292
|
+
workerData: workerConfig,
|
|
293
|
+
// tsx registers itself via --require/--import; pass through to workers
|
|
294
|
+
execArgv: process.execArgv,
|
|
295
|
+
});
|
|
296
|
+
worker.on('message', (msg) => {
|
|
297
|
+
if (msg.type === 'progress' && onProgress) {
|
|
298
|
+
progressPerWorker[i] = msg.progress.completed;
|
|
299
|
+
const totalCompleted = progressPerWorker.reduce((a, b) => a + b, 0);
|
|
300
|
+
onProgress(totalCompleted, totalIterations);
|
|
301
|
+
}
|
|
302
|
+
else if (msg.type === 'result') {
|
|
303
|
+
resolve(msg.result);
|
|
304
|
+
}
|
|
305
|
+
else if (msg.type === 'error') {
|
|
306
|
+
reject(new Error(`Worker ${i} failed: ${msg.error}`));
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
worker.on('error', (err) => reject(new Error(`Worker ${i} error: ${err.message}`)));
|
|
310
|
+
worker.on('exit', (code) => {
|
|
311
|
+
if (code !== 0)
|
|
312
|
+
reject(new Error(`Worker ${i} exited with code ${code}`));
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
const results = await Promise.all(promises);
|
|
317
|
+
return aggregateResults(results);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function aggregateResults(results) {
|
|
321
|
+
const raw = {
|
|
322
|
+
totalWagered: 0,
|
|
323
|
+
totalWon: 0,
|
|
324
|
+
baseGameWin: 0,
|
|
325
|
+
bonusWin: 0,
|
|
326
|
+
hits: 0,
|
|
327
|
+
};
|
|
328
|
+
let iterations = 0;
|
|
329
|
+
let maxWin = 0;
|
|
330
|
+
let maxWinHits = 0;
|
|
331
|
+
let bonusTriggered = 0;
|
|
332
|
+
let bonusSpinsPlayed = 0;
|
|
333
|
+
let maxDurationMs = 0;
|
|
334
|
+
for (const r of results) {
|
|
335
|
+
const rr = r._raw;
|
|
336
|
+
raw.totalWagered += rr.totalWagered;
|
|
337
|
+
raw.totalWon += rr.totalWon;
|
|
338
|
+
raw.baseGameWin += rr.baseGameWin;
|
|
339
|
+
raw.bonusWin += rr.bonusWin;
|
|
340
|
+
raw.hits += rr.hits;
|
|
341
|
+
iterations += r.iterations;
|
|
342
|
+
if (r.maxWin > maxWin)
|
|
343
|
+
maxWin = r.maxWin;
|
|
344
|
+
maxWinHits += r.maxWinHits;
|
|
345
|
+
bonusTriggered += r.bonusTriggered;
|
|
346
|
+
bonusSpinsPlayed += r.bonusSpinsPlayed;
|
|
347
|
+
if (r.durationMs > maxDurationMs)
|
|
348
|
+
maxDurationMs = r.durationMs;
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
gameId: results[0].gameId,
|
|
352
|
+
action: results[0].action,
|
|
353
|
+
iterations,
|
|
354
|
+
durationMs: maxDurationMs,
|
|
355
|
+
totalRtp: raw.totalWagered > 0 ? (raw.totalWon / raw.totalWagered) * 100 : 0,
|
|
356
|
+
baseGameRtp: raw.totalWagered > 0 ? (raw.baseGameWin / raw.totalWagered) * 100 : 0,
|
|
357
|
+
bonusRtp: raw.totalWagered > 0 ? (raw.bonusWin / raw.totalWagered) * 100 : 0,
|
|
358
|
+
hitFrequency: iterations > 0 ? (raw.hits / iterations) * 100 : 0,
|
|
359
|
+
maxWin,
|
|
360
|
+
maxWinHits,
|
|
361
|
+
bonusTriggered,
|
|
362
|
+
bonusSpinsPlayed,
|
|
363
|
+
_raw: raw,
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export { NativeSimulationRunner, ParallelSimulationRunner, findNativeBinary, formatNativeResult };
|
|
368
|
+
//# sourceMappingURL=simulation.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulation.esm.js","sources":["../src/simulation/NativeSimulationRunner.ts","../src/simulation/ParallelSimulationRunner.ts"],"sourcesContent":[null,null],"names":["fsConstants"],"mappings":";;;;;;;;;AA4FA;MAEa,sBAAsB,CAAA;AACzB,IAAA,MAAM;AAEd,IAAA,WAAA,CAAY,MAA8B,EAAA;AACxC,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;IACtB;AAEA,IAAA,MAAM,GAAG,GAAA;AACP,QAAA,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM;QAC3F,MAAM,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;AACzC,QAAA,MAAM,MAAM,GAAG,MAAM,EAAE;QACvB,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA,IAAA,EAAO,EAAE,CAAA,IAAA,CAAM,CAAC;QAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA,IAAA,EAAO,EAAE,CAAA,KAAA,CAAO,CAAC;AAEjD,QAAA,IAAI;;YAEF,MAAM,OAAO,CAAC,GAAG,CAAC;AAChB,gBAAA,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;AACnC,gBAAA,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC;AAC5F,aAAA,CAAC;;AAGF,YAAA,MAAM,IAAI,GAAG;AACX,gBAAA,SAAS,EAAE,UAAU;AACrB,gBAAA,aAAa,EAAE,MAAM,CAAC,UAAU,CAAC;AACjC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MAAM;AAAE,YAAA,MAAM,GAAG,CAAC,CAAC,MAAM;AACxC,QAAA,UAAU,IAAI,CAAC,CAAC,UAAU;AAC1B,QAAA,cAAc,IAAI,CAAC,CAAC,cAAc;AAClC,QAAA,gBAAgB,IAAI,CAAC,CAAC,gBAAgB;AACtC,QAAA,IAAI,CAAC,CAAC,UAAU,GAAG,aAAa;AAAE,YAAA,aAAa,GAAG,CAAC,CAAC,UAAU;IAChE;IAEA,OAAO;AACL,QAAA,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM;AACzB,QAAA,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM;QACzB,UAAU;AACV,QAAA,UAAU,EAAE,aAAa;QACzB,QAAQ,EAAE,GAAG,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,YAAY,IAAI,GAAG,GAAG,CAAC;QAC5E,WAAW,EAAE,GAAG,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC,YAAY,IAAI,GAAG,GAAG,CAAC;QAClF,QAAQ,EAAE,GAAG,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,YAAY,IAAI,GAAG,GAAG,CAAC;AAC5E,QAAA,YAAY,EAAE,UAAU,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,UAAU,IAAI,GAAG,GAAG,CAAC;QAChE,MAAM;QACN,UAAU;QACV,cAAc;QACd,gBAAgB;AAChB,QAAA,IAAI,EAAE,GAAG;KACV;AACH;;;;"}
|
package/dist/vite.cjs.js
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// ─── DevBridge Plugin ────────────────────────────────────
|
|
4
|
+
/**
|
|
5
|
+
* Vite plugin that auto-injects the DevBridge mock-host bootstrapper
|
|
6
|
+
* into the HTML during development, so the game can communicate with
|
|
7
|
+
* a mock casino host without manual setup.
|
|
8
|
+
*
|
|
9
|
+
* Pair with `luaPlugin` to also enable `.lua` raw imports and serve a
|
|
10
|
+
* Lua execution endpoint at POST /__lua-play.
|
|
11
|
+
*/
|
|
12
|
+
const VIRTUAL_ID = '/@dev-bridge-entry.js';
|
|
13
|
+
function devBridgePlugin(configPath) {
|
|
14
|
+
let entrySrc = '';
|
|
15
|
+
let viteRoot = '';
|
|
16
|
+
let resolvedConfigPath = configPath;
|
|
17
|
+
return {
|
|
18
|
+
name: 'platform-core:dev-bridge',
|
|
19
|
+
apply: 'serve', // dev only
|
|
20
|
+
enforce: 'pre',
|
|
21
|
+
configResolved(config) {
|
|
22
|
+
viteRoot = config.root;
|
|
23
|
+
// Resolve relative config path against Vite root so the virtual
|
|
24
|
+
// module can import it with an absolute path.
|
|
25
|
+
if (configPath.startsWith('.')) {
|
|
26
|
+
resolvedConfigPath = config.root + '/' + configPath.replace(/^\.\//, '');
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
resolveId(id) {
|
|
30
|
+
if (id === VIRTUAL_ID)
|
|
31
|
+
return id;
|
|
32
|
+
},
|
|
33
|
+
load(id) {
|
|
34
|
+
if (id === VIRTUAL_ID) {
|
|
35
|
+
// This goes through Vite's pipeline so bare imports are resolved
|
|
36
|
+
return `
|
|
37
|
+
import { DevBridge } from '@energy8platform/platform-core/dev-bridge';
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
const mod = await import('${resolvedConfigPath}');
|
|
41
|
+
const config = mod.default ?? mod.config ?? mod;
|
|
42
|
+
new DevBridge(config).start();
|
|
43
|
+
} catch (e) {
|
|
44
|
+
console.warn('[DevBridge] Failed to load config:', e);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
await import('${entrySrc}');
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
transformIndexHtml(html) {
|
|
52
|
+
// Find the app's entry module script (skip Vite internal /@... scripts)
|
|
53
|
+
const scriptRegex = /<script\s+type="module"\s+src="((?!\/@)[^"]+)"\s*>\s*<\/script>/;
|
|
54
|
+
const match = html.match(scriptRegex);
|
|
55
|
+
if (!match) {
|
|
56
|
+
console.warn('[DevBridge] Could not find entry module script in index.html');
|
|
57
|
+
return html;
|
|
58
|
+
}
|
|
59
|
+
entrySrc = match[1];
|
|
60
|
+
if (entrySrc.startsWith('.')) {
|
|
61
|
+
entrySrc = viteRoot + '/' + entrySrc.replace(/^\.\//, '');
|
|
62
|
+
}
|
|
63
|
+
else if (entrySrc.startsWith('/')) {
|
|
64
|
+
entrySrc = viteRoot + entrySrc;
|
|
65
|
+
}
|
|
66
|
+
return html.replace(match[0], `<script type="module" src="${VIRTUAL_ID}"></script>`);
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
// ─── Lua Plugin ─────────────────────────────────────────
|
|
71
|
+
/**
|
|
72
|
+
* Vite plugin that:
|
|
73
|
+
* 1. Enables importing `.lua` files as raw strings with HMR
|
|
74
|
+
* 2. Runs a LuaEngine on the Vite dev server (Node.js) via POST /__lua-play
|
|
75
|
+
*
|
|
76
|
+
* fengari runs server-side only — no browser shims needed.
|
|
77
|
+
*/
|
|
78
|
+
function luaPlugin(configPath) {
|
|
79
|
+
let luaEngine = null;
|
|
80
|
+
let viteServer = null;
|
|
81
|
+
async function initEngine() {
|
|
82
|
+
if (!viteServer)
|
|
83
|
+
return;
|
|
84
|
+
try {
|
|
85
|
+
// Invalidate cached modules so HMR picks up changes
|
|
86
|
+
const root = viteServer.config.root;
|
|
87
|
+
const fullConfigPath = configPath.startsWith('.')
|
|
88
|
+
? root + '/' + configPath.replace(/^\.\//, '')
|
|
89
|
+
: configPath;
|
|
90
|
+
// Invalidate the config module and its dependencies
|
|
91
|
+
const configMod = viteServer.moduleGraph.getModuleById(fullConfigPath);
|
|
92
|
+
if (configMod)
|
|
93
|
+
viteServer.moduleGraph.invalidateModule(configMod);
|
|
94
|
+
// ssrLoadModule handles TS transpilation and resolves all imports
|
|
95
|
+
const mod = await viteServer.ssrLoadModule(fullConfigPath);
|
|
96
|
+
const config = mod.default ?? mod.config ?? mod;
|
|
97
|
+
if (!config.luaScript || !config.gameDefinition) {
|
|
98
|
+
console.log('[LuaPlugin] No luaScript/gameDefinition in config — Lua server disabled');
|
|
99
|
+
luaEngine = null;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
// Load LuaEngine via SSR (fengari runs natively in Node.js)
|
|
103
|
+
const luaMod = await viteServer.ssrLoadModule('@energy8platform/platform-core/lua');
|
|
104
|
+
const { LuaEngine } = luaMod;
|
|
105
|
+
if (luaEngine)
|
|
106
|
+
luaEngine.destroy();
|
|
107
|
+
luaEngine = new LuaEngine({
|
|
108
|
+
script: config.luaScript,
|
|
109
|
+
gameDefinition: config.gameDefinition,
|
|
110
|
+
seed: config.luaSeed,
|
|
111
|
+
});
|
|
112
|
+
console.log('[LuaPlugin] LuaEngine initialized (server-side)');
|
|
113
|
+
}
|
|
114
|
+
catch (e) {
|
|
115
|
+
console.warn('[LuaPlugin] Failed to initialize LuaEngine:', e.message);
|
|
116
|
+
luaEngine = null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
name: 'platform-core:lua',
|
|
121
|
+
apply: 'serve',
|
|
122
|
+
async configureServer(server) {
|
|
123
|
+
viteServer = server;
|
|
124
|
+
await initEngine();
|
|
125
|
+
// POST /__lua-play — execute Lua on the server
|
|
126
|
+
server.middlewares.use('/__lua-play', (req, res) => {
|
|
127
|
+
if (req.method !== 'POST') {
|
|
128
|
+
res.statusCode = 405;
|
|
129
|
+
res.end('Method Not Allowed');
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
let body = '';
|
|
133
|
+
req.on('data', (chunk) => { body += chunk; });
|
|
134
|
+
req.on('end', () => {
|
|
135
|
+
try {
|
|
136
|
+
if (!luaEngine) {
|
|
137
|
+
res.statusCode = 503;
|
|
138
|
+
res.setHeader('Content-Type', 'application/json');
|
|
139
|
+
res.end(JSON.stringify({ error: 'LuaEngine not initialized' }));
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const params = JSON.parse(body);
|
|
143
|
+
const result = luaEngine.execute(params);
|
|
144
|
+
res.statusCode = 200;
|
|
145
|
+
res.setHeader('Content-Type', 'application/json');
|
|
146
|
+
res.end(JSON.stringify(result));
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
res.statusCode = 500;
|
|
150
|
+
res.setHeader('Content-Type', 'application/json');
|
|
151
|
+
res.end(JSON.stringify({ error: e.message }));
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
transform(code, id) {
|
|
157
|
+
if (id.endsWith('.lua')) {
|
|
158
|
+
return {
|
|
159
|
+
code: `export default ${JSON.stringify(code)};`,
|
|
160
|
+
map: null,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
async handleHotUpdate({ file, server }) {
|
|
165
|
+
if (file.endsWith('.lua') || file.includes('dev.config')) {
|
|
166
|
+
console.log('[LuaPlugin] Reloading LuaEngine...');
|
|
167
|
+
// Invalidate all SSR modules so ssrLoadModule picks up fresh code
|
|
168
|
+
server.moduleGraph.invalidateAll();
|
|
169
|
+
await initEngine();
|
|
170
|
+
server.ws.send({ type: 'full-reload' });
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
exports.devBridgePlugin = devBridgePlugin;
|
|
178
|
+
exports.luaPlugin = luaPlugin;
|
|
179
|
+
//# sourceMappingURL=vite.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.cjs.js","sources":["../src/vite/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;AAEA;;;;;;;AAOG;AACH,MAAM,UAAU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;AAGjD,gBAAA,MAAM,CAAC,WAAW,CAAC,aAAa,EAAE;gBAElC,MAAM,UAAU,EAAE;gBAClB,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;AACvC,gBAAA,OAAO,EAAE;YACX;QACF,CAAC;KACF;AACH;;;;;"}
|
package/dist/vite.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
declare function devBridgePlugin(configPath: string): Plugin;
|
|
4
|
+
/**
|
|
5
|
+
* Vite plugin that:
|
|
6
|
+
* 1. Enables importing `.lua` files as raw strings with HMR
|
|
7
|
+
* 2. Runs a LuaEngine on the Vite dev server (Node.js) via POST /__lua-play
|
|
8
|
+
*
|
|
9
|
+
* fengari runs server-side only — no browser shims needed.
|
|
10
|
+
*/
|
|
11
|
+
declare function luaPlugin(configPath: string): Plugin;
|
|
12
|
+
|
|
13
|
+
export { devBridgePlugin, luaPlugin };
|