@evomap/evolver 1.78.9 → 1.79.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.ja-JP.md +1 -0
- package/README.ko-KR.md +1 -0
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/index.js +177 -7
- package/package.json +1 -1
- package/scripts/build_binaries.js +388 -0
- package/src/evolve.js +1 -1
- package/src/gep/.integrity +0 -0
- package/src/gep/a2aProtocol.js +1 -1
- package/src/gep/candidateEval.js +1 -1
- package/src/gep/candidates.js +1 -1
- package/src/gep/contentHash.js +1 -1
- package/src/gep/crypto.js +1 -1
- package/src/gep/curriculum.js +1 -1
- package/src/gep/deviceId.js +1 -1
- package/src/gep/envFingerprint.js +1 -1
- package/src/gep/explore.js +1 -1
- package/src/gep/hubReview.js +1 -1
- package/src/gep/hubSearch.js +1 -1
- package/src/gep/hubVerify.js +1 -1
- package/src/gep/integrityCheck.js +1 -1
- package/src/gep/learningSignals.js +1 -1
- package/src/gep/memoryGraph.js +1 -1
- package/src/gep/memoryGraphAdapter.js +1 -1
- package/src/gep/mutation.js +1 -1
- package/src/gep/narrativeMemory.js +1 -1
- package/src/gep/personality.js +1 -1
- package/src/gep/policyCheck.js +1 -1
- package/src/gep/prompt.js +1 -1
- package/src/gep/reflection.js +1 -1
- package/src/gep/selector.js +1 -1
- package/src/gep/shield.js +1 -1
- package/src/gep/skillDistiller.js +1 -1
- package/src/gep/solidify.js +1 -1
- package/src/gep/strategy.js +1 -1
- package/assets/gep/candidates.jsonl +0 -1
- package/assets/gep/capsules.json +0 -4
- package/assets/gep/events.jsonl +0 -0
- package/assets/gep/failed_capsules.json +0 -4
- package/assets/gep/genes.json +0 -201
- package/assets/gep/genes.jsonl +0 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
//
|
|
4
|
+
// build_binaries.js — produce standalone CLI binaries of evolver via the
|
|
5
|
+
// hardened "obfuscator -> bun bundle -> bun compile" pipeline.
|
|
6
|
+
//
|
|
7
|
+
// Pipeline (decided after empirical testing — see notes at end of this file):
|
|
8
|
+
//
|
|
9
|
+
// 1. bun build ./index.js --target=node --outfile=stage/bundled.js
|
|
10
|
+
// -> resolves all require() into one self-contained file.
|
|
11
|
+
//
|
|
12
|
+
// 2. javascript-obfuscator stage/bundled.js -> stage/bundled.obf.js
|
|
13
|
+
// -> high-strength config: stringArray (rc4) + controlFlowFlattening +
|
|
14
|
+
// deadCodeInjection + identifier hex + splitStrings + numbers-to-expr.
|
|
15
|
+
// -> selfDefending MUST be off: it triggers infinite-loop self-defense
|
|
16
|
+
// when bun later wraps the bundle inside its standalone container.
|
|
17
|
+
// -> renameGlobals MUST be off (otherwise bun's bundle step fails to
|
|
18
|
+
// resolve dynamic require strings — but we already pass a single-file
|
|
19
|
+
// bundle here, so this no longer applies; kept off for safety).
|
|
20
|
+
// -> transformObjectKeys MUST be off (similar reason as above).
|
|
21
|
+
//
|
|
22
|
+
// 3. bun build stage/bundled.obf.js --compile --minify --target=<TARGET>
|
|
23
|
+
// -> embeds bun runtime + bundled+obfuscated JS into a single executable.
|
|
24
|
+
// -> --minify gives a second-pass identifier/whitespace squash on top
|
|
25
|
+
// of the obfuscator output.
|
|
26
|
+
//
|
|
27
|
+
// Targets shipped (decision per AGENTS sync 2026-05-05):
|
|
28
|
+
// bun-darwin-arm64 -> evolver-darwin-arm64
|
|
29
|
+
// bun-darwin-x64 -> evolver-darwin-x64
|
|
30
|
+
// bun-linux-x64 -> evolver-linux-x64
|
|
31
|
+
// bun-linux-arm64 -> evolver-linux-arm64
|
|
32
|
+
// bun-windows-x64 -> evolver-windows-x64.exe
|
|
33
|
+
//
|
|
34
|
+
// Usage:
|
|
35
|
+
// node scripts/build_binaries.js # builds all 4 targets
|
|
36
|
+
// node scripts/build_binaries.js --target=darwin-arm64
|
|
37
|
+
// node scripts/build_binaries.js --skip-obfuscate # bun-only fast path (DEV)
|
|
38
|
+
// node scripts/build_binaries.js --out-dir=dist-binaries
|
|
39
|
+
// node scripts/build_binaries.js --dry-run
|
|
40
|
+
//
|
|
41
|
+
// Outputs:
|
|
42
|
+
// <outDir>/evolver-<platform> binary
|
|
43
|
+
// <outDir>/evolver-<platform>.sha256 hash file (one line)
|
|
44
|
+
// <outDir>/SHA256SUMS.txt combined sha256 manifest
|
|
45
|
+
//
|
|
46
|
+
// Exit codes:
|
|
47
|
+
// 0 success
|
|
48
|
+
// 1 precondition failed (missing tool, version mismatch)
|
|
49
|
+
// 2 build step failed
|
|
50
|
+
// 3 smoke test of produced binary failed
|
|
51
|
+
|
|
52
|
+
'use strict';
|
|
53
|
+
|
|
54
|
+
const fs = require('fs');
|
|
55
|
+
const path = require('path');
|
|
56
|
+
const crypto = require('crypto');
|
|
57
|
+
const { execFileSync, spawnSync } = require('child_process');
|
|
58
|
+
|
|
59
|
+
// ---------- argv ----------
|
|
60
|
+
|
|
61
|
+
const argv = process.argv.slice(2);
|
|
62
|
+
const OPTS = {
|
|
63
|
+
target: null,
|
|
64
|
+
skipObfuscate: false,
|
|
65
|
+
outDir: 'dist-binaries',
|
|
66
|
+
dryRun: false,
|
|
67
|
+
keepStage: false,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
for (const a of argv) {
|
|
71
|
+
if (a === '--skip-obfuscate') OPTS.skipObfuscate = true;
|
|
72
|
+
else if (a === '--dry-run') OPTS.dryRun = true;
|
|
73
|
+
else if (a === '--keep-stage') OPTS.keepStage = true;
|
|
74
|
+
else if (a.startsWith('--target=')) OPTS.target = a.slice('--target='.length);
|
|
75
|
+
else if (a.startsWith('--out-dir=')) OPTS.outDir = a.slice('--out-dir='.length);
|
|
76
|
+
else if (a === '--help' || a === '-h') {
|
|
77
|
+
console.log(fs.readFileSync(__filename, 'utf8').split('\n').filter(l => l.startsWith('//')).map(l => l.replace(/^\/\/ ?/, '')).slice(0, 50).join('\n'));
|
|
78
|
+
process.exit(0);
|
|
79
|
+
} else {
|
|
80
|
+
console.error(`build_binaries: unknown argument: ${a}`);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// ---------- constants ----------
|
|
86
|
+
|
|
87
|
+
const REPO_ROOT = path.resolve(__dirname, '..');
|
|
88
|
+
const ENTRY = path.join(REPO_ROOT, 'index.js');
|
|
89
|
+
const STAGE_DIR = path.join(REPO_ROOT, '.binary-stage');
|
|
90
|
+
const OUT_DIR = path.resolve(REPO_ROOT, OPTS.outDir);
|
|
91
|
+
|
|
92
|
+
const ALL_TARGETS = [
|
|
93
|
+
{ triple: 'bun-darwin-arm64', name: 'evolver-darwin-arm64' },
|
|
94
|
+
{ triple: 'bun-darwin-x64', name: 'evolver-darwin-x64' },
|
|
95
|
+
{ triple: 'bun-linux-x64', name: 'evolver-linux-x64' },
|
|
96
|
+
{ triple: 'bun-linux-arm64', name: 'evolver-linux-arm64' },
|
|
97
|
+
{ triple: 'bun-windows-x64', name: 'evolver-windows-x64.exe' },
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
const TARGETS = OPTS.target
|
|
101
|
+
? ALL_TARGETS.filter(t => t.name.endsWith(OPTS.target) || t.triple.endsWith(OPTS.target))
|
|
102
|
+
: ALL_TARGETS;
|
|
103
|
+
|
|
104
|
+
if (TARGETS.length === 0) {
|
|
105
|
+
console.error(`build_binaries: target "${OPTS.target}" matched no known triple. Known: ${ALL_TARGETS.map(t => t.triple).join(', ')}`);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// ---------- helpers ----------
|
|
110
|
+
|
|
111
|
+
function step(label) {
|
|
112
|
+
console.log(`\n>> ${label}`);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function run(cmd, args, opts = {}) {
|
|
116
|
+
if (OPTS.dryRun) {
|
|
117
|
+
console.log(` [dry-run] ${cmd} ${args.join(' ')}`);
|
|
118
|
+
return { status: 0, stdout: '', stderr: '' };
|
|
119
|
+
}
|
|
120
|
+
const r = spawnSync(cmd, args, { stdio: 'inherit', ...opts });
|
|
121
|
+
if (r.status !== 0) {
|
|
122
|
+
console.error(` command failed (exit ${r.status}): ${cmd} ${args.join(' ')}`);
|
|
123
|
+
process.exit(2);
|
|
124
|
+
}
|
|
125
|
+
return r;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function runCapture(cmd, args, opts = {}) {
|
|
129
|
+
// Preflight version checks must always run (even in dry-run mode); use this
|
|
130
|
+
// helper only for read-only commands.
|
|
131
|
+
return execFileSync(cmd, args, { encoding: 'utf8', ...opts });
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function ensureDir(d) {
|
|
135
|
+
if (!fs.existsSync(d)) fs.mkdirSync(d, { recursive: true });
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function rmDir(d) {
|
|
139
|
+
if (fs.existsSync(d)) fs.rmSync(d, { recursive: true, force: true });
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function sha256(filePath) {
|
|
143
|
+
const buf = fs.readFileSync(filePath);
|
|
144
|
+
return crypto.createHash('sha256').update(buf).digest('hex');
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// ---------- preflight ----------
|
|
148
|
+
|
|
149
|
+
step('Preflight');
|
|
150
|
+
|
|
151
|
+
if (!fs.existsSync(ENTRY)) {
|
|
152
|
+
console.error(` ERROR: entry not found: ${ENTRY}`);
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
try {
|
|
157
|
+
const v = runCapture('bun', ['--version']).trim();
|
|
158
|
+
console.log(` bun: ${v}`);
|
|
159
|
+
// Pin a sane minimum. As of writing pipeline tested on 1.3.13.
|
|
160
|
+
const [maj, min] = v.split('.').map(Number);
|
|
161
|
+
if (maj < 1 || (maj === 1 && min < 3)) {
|
|
162
|
+
console.error(` ERROR: bun >= 1.3 required; found ${v}`);
|
|
163
|
+
process.exit(1);
|
|
164
|
+
}
|
|
165
|
+
} catch (e) {
|
|
166
|
+
console.error(' ERROR: `bun` not found in PATH. Install from https://bun.com');
|
|
167
|
+
process.exit(1);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (!OPTS.skipObfuscate) {
|
|
171
|
+
try {
|
|
172
|
+
require.resolve('javascript-obfuscator', { paths: [REPO_ROOT] });
|
|
173
|
+
console.log(' javascript-obfuscator: present');
|
|
174
|
+
} catch {
|
|
175
|
+
console.error(' ERROR: javascript-obfuscator not installed. Run `npm install` in repo root first.');
|
|
176
|
+
process.exit(1);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const releaseVersion = process.env.RELEASE_VERSION
|
|
181
|
+
|| JSON.parse(fs.readFileSync(path.join(REPO_ROOT, 'package.json'), 'utf8')).version;
|
|
182
|
+
console.log(` release version: ${releaseVersion}`);
|
|
183
|
+
console.log(` targets: ${TARGETS.map(t => t.name).join(', ')}`);
|
|
184
|
+
console.log(` out dir: ${OUT_DIR}`);
|
|
185
|
+
if (OPTS.skipObfuscate) console.log(' WARN: --skip-obfuscate => DEV-grade binary, do NOT distribute');
|
|
186
|
+
if (OPTS.dryRun) console.log(' mode: DRY RUN (no files will change)');
|
|
187
|
+
|
|
188
|
+
// ---------- stage 1: bun bundle ----------
|
|
189
|
+
|
|
190
|
+
step('Stage 1 — bun bundle (resolve require tree to one file)');
|
|
191
|
+
|
|
192
|
+
ensureDir(STAGE_DIR);
|
|
193
|
+
const BUNDLED_JS = path.join(STAGE_DIR, 'bundled.js');
|
|
194
|
+
|
|
195
|
+
run('bun', ['build', ENTRY, '--target=node', `--outfile=${BUNDLED_JS}`]);
|
|
196
|
+
|
|
197
|
+
const bundleSize = OPTS.dryRun ? 0 : fs.statSync(BUNDLED_JS).size;
|
|
198
|
+
console.log(` bundled.js: ${(bundleSize / 1024 / 1024).toFixed(2)} MB`);
|
|
199
|
+
|
|
200
|
+
// ---------- stage 2: obfuscate ----------
|
|
201
|
+
|
|
202
|
+
let payloadJs = BUNDLED_JS;
|
|
203
|
+
|
|
204
|
+
if (!OPTS.skipObfuscate) {
|
|
205
|
+
step('Stage 2 — javascript-obfuscator (high strength, bundler-safe)');
|
|
206
|
+
const OBF_JS = path.join(STAGE_DIR, 'bundled.obf.js');
|
|
207
|
+
|
|
208
|
+
if (!OPTS.dryRun) {
|
|
209
|
+
const O = require(require.resolve('javascript-obfuscator', { paths: [REPO_ROOT] }));
|
|
210
|
+
const src = fs.readFileSync(BUNDLED_JS, 'utf8');
|
|
211
|
+
// Deterministic obfuscation: same release version + same source = same
|
|
212
|
+
// output. This makes binary diffs across re-runs meaningful and lets
|
|
213
|
+
// SHA256SUMS be reproduced by anyone with the source tree.
|
|
214
|
+
const seed = parseInt(crypto.createHash('sha256').update(`evolver:${releaseVersion}`).digest('hex').slice(0, 8), 16);
|
|
215
|
+
const t0 = Date.now();
|
|
216
|
+
const result = O.obfuscate(src, {
|
|
217
|
+
seed,
|
|
218
|
+
compact: true,
|
|
219
|
+
controlFlowFlattening: true,
|
|
220
|
+
controlFlowFlatteningThreshold: 0.75,
|
|
221
|
+
deadCodeInjection: true,
|
|
222
|
+
deadCodeInjectionThreshold: 0.4,
|
|
223
|
+
stringArray: true,
|
|
224
|
+
stringArrayEncoding: ['rc4'],
|
|
225
|
+
stringArrayThreshold: 0.85,
|
|
226
|
+
identifierNamesGenerator: 'hexadecimal',
|
|
227
|
+
// The next three MUST stay disabled — they are incompatible with bun's
|
|
228
|
+
// standalone wrapping (selfDefending + transformObjectKeys + renameGlobals
|
|
229
|
+
// each break either compile-time bundling or run-time module resolution).
|
|
230
|
+
// See pipeline notes at top of file.
|
|
231
|
+
renameGlobals: false,
|
|
232
|
+
selfDefending: false,
|
|
233
|
+
transformObjectKeys: false,
|
|
234
|
+
debugProtection: false,
|
|
235
|
+
splitStrings: true,
|
|
236
|
+
splitStringsChunkLength: 8,
|
|
237
|
+
numbersToExpressions: true,
|
|
238
|
+
unicodeEscapeSequence: true,
|
|
239
|
+
target: 'node',
|
|
240
|
+
});
|
|
241
|
+
fs.writeFileSync(OBF_JS, result.getObfuscatedCode());
|
|
242
|
+
const obfSize = fs.statSync(OBF_JS).size;
|
|
243
|
+
console.log(` obfuscation: ${((Date.now() - t0) / 1000).toFixed(1)}s, output ${(obfSize / 1024 / 1024).toFixed(2)} MB`);
|
|
244
|
+
} else {
|
|
245
|
+
console.log(' [dry-run] would obfuscate stage/bundled.js -> stage/bundled.obf.js');
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
payloadJs = OBF_JS;
|
|
249
|
+
} else {
|
|
250
|
+
console.log('\n>> Stage 2 — SKIPPED (--skip-obfuscate)');
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// ---------- stage 3: per-target compile ----------
|
|
254
|
+
|
|
255
|
+
step(`Stage 3 — bun compile (${TARGETS.length} target${TARGETS.length === 1 ? '' : 's'})`);
|
|
256
|
+
|
|
257
|
+
// Idempotency: scrub OUT_DIR up front so stale binaries from a prior partial
|
|
258
|
+
// run can't leak into a subsequent `gh release upload dist-binaries/*`.
|
|
259
|
+
if (!OPTS.dryRun) {
|
|
260
|
+
rmDir(OUT_DIR);
|
|
261
|
+
}
|
|
262
|
+
ensureDir(OUT_DIR);
|
|
263
|
+
const sums = [];
|
|
264
|
+
|
|
265
|
+
for (const t of TARGETS) {
|
|
266
|
+
const outPath = path.join(OUT_DIR, t.name);
|
|
267
|
+
console.log(`\n --- ${t.triple} -> ${path.relative(REPO_ROOT, outPath)} ---`);
|
|
268
|
+
|
|
269
|
+
run('bun', [
|
|
270
|
+
'build',
|
|
271
|
+
payloadJs,
|
|
272
|
+
'--compile',
|
|
273
|
+
'--minify',
|
|
274
|
+
`--target=${t.triple}`,
|
|
275
|
+
`--outfile=${outPath}`,
|
|
276
|
+
]);
|
|
277
|
+
|
|
278
|
+
if (!OPTS.dryRun) {
|
|
279
|
+
const stat = fs.statSync(outPath);
|
|
280
|
+
fs.chmodSync(outPath, 0o755);
|
|
281
|
+
const hash = sha256(outPath);
|
|
282
|
+
fs.writeFileSync(`${outPath}.sha256`, `${hash} ${t.name}\n`);
|
|
283
|
+
sums.push(`${hash} ${t.name}`);
|
|
284
|
+
console.log(` size: ${(stat.size / 1024 / 1024).toFixed(1)} MB sha256: ${hash.slice(0, 16)}…`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// Smoke test only the host platform binary (cross-platform binaries cannot
|
|
289
|
+
// be executed on the build host without an emulator; skip them by design).
|
|
290
|
+
const hostTriple = (() => {
|
|
291
|
+
const arch = process.arch === 'arm64' ? 'arm64' : 'x64';
|
|
292
|
+
const plat = process.platform === 'darwin' ? 'darwin'
|
|
293
|
+
: process.platform === 'linux' ? 'linux'
|
|
294
|
+
: process.platform === 'win32' ? 'windows'
|
|
295
|
+
: null;
|
|
296
|
+
return plat ? `${plat}-${arch}` : null;
|
|
297
|
+
})();
|
|
298
|
+
|
|
299
|
+
if (!OPTS.dryRun && hostTriple) {
|
|
300
|
+
// Match against the triple suffix (e.g. "darwin-arm64"), since the binary
|
|
301
|
+
// name on Windows includes a ".exe" extension.
|
|
302
|
+
const hostBin = TARGETS.find(t => t.triple.endsWith(hostTriple));
|
|
303
|
+
if (hostBin) {
|
|
304
|
+
step(`Stage 4 — smoke test ${hostBin.name}`);
|
|
305
|
+
const r = spawnSync(path.join(OUT_DIR, hostBin.name), ['--help'], {
|
|
306
|
+
timeout: 15000,
|
|
307
|
+
encoding: 'utf8',
|
|
308
|
+
});
|
|
309
|
+
if (r.status !== 0 || !r.stdout || !r.stdout.includes('Usage:')) {
|
|
310
|
+
console.error(' ERROR: smoke test failed.');
|
|
311
|
+
console.error(` exit: ${r.status}`);
|
|
312
|
+
console.error(` stdout: ${(r.stdout || '').slice(0, 200)}`);
|
|
313
|
+
console.error(` stderr: ${(r.stderr || '').slice(0, 200)}`);
|
|
314
|
+
process.exit(3);
|
|
315
|
+
}
|
|
316
|
+
console.log(' smoke test: OK');
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// ---------- write combined SHA256SUMS ----------
|
|
321
|
+
|
|
322
|
+
if (!OPTS.dryRun) {
|
|
323
|
+
step('Writing combined SHA256SUMS.txt');
|
|
324
|
+
const sumsFile = path.join(OUT_DIR, 'SHA256SUMS.txt');
|
|
325
|
+
fs.writeFileSync(sumsFile, sums.join('\n') + '\n');
|
|
326
|
+
console.log(` wrote ${path.relative(REPO_ROOT, sumsFile)}`);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// ---------- cleanup ----------
|
|
330
|
+
|
|
331
|
+
if (!OPTS.keepStage && !OPTS.dryRun) {
|
|
332
|
+
rmDir(STAGE_DIR);
|
|
333
|
+
} else if (OPTS.keepStage) {
|
|
334
|
+
console.log(`\n (kept stage at ${path.relative(REPO_ROOT, STAGE_DIR)} for inspection)`);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
step(`Done. ${TARGETS.length} binar${TARGETS.length === 1 ? 'y' : 'ies'} in ${path.relative(REPO_ROOT, OUT_DIR)}/`);
|
|
338
|
+
console.log(' next: gh release upload v<ver> dist-binaries/* --repo EvoMap/evolver');
|
|
339
|
+
|
|
340
|
+
//
|
|
341
|
+
// =====================================================================
|
|
342
|
+
// PIPELINE RATIONALE — 2026-05-05
|
|
343
|
+
// =====================================================================
|
|
344
|
+
//
|
|
345
|
+
// Why "bun-bundle then obfuscate" rather than the more obvious
|
|
346
|
+
// "obfuscate src/ then bun-bundle":
|
|
347
|
+
//
|
|
348
|
+
// javascript-obfuscator at high strength (stringArray + RC4 +
|
|
349
|
+
// transformObjectKeys + ...) rewrites string literals through a runtime
|
|
350
|
+
// lookup function: require('./gep/paths') becomes
|
|
351
|
+
// require(_0xLOOKUP(0x82b)). Bun's bundler does static analysis on
|
|
352
|
+
// require() arguments at compile time, so it cannot resolve those
|
|
353
|
+
// dynamic require calls and the resulting binary throws "Cannot find
|
|
354
|
+
// module './gep/paths'" on first invocation.
|
|
355
|
+
//
|
|
356
|
+
// By bundling FIRST, every require() is inlined and resolved before the
|
|
357
|
+
// obfuscator ever sees the code. The obfuscator then operates on a
|
|
358
|
+
// single self-contained file with no remaining dynamic requires, so
|
|
359
|
+
// stringArray and friends are safe.
|
|
360
|
+
//
|
|
361
|
+
// Why selfDefending must stay OFF:
|
|
362
|
+
//
|
|
363
|
+
// selfDefending: true injects a guard that hangs (infinite while loop)
|
|
364
|
+
// when it detects formatting changes. bun --compile wraps the JS payload
|
|
365
|
+
// in a standalone executable container that re-emits the source with
|
|
366
|
+
// different whitespace + line endings, which trips the guard immediately.
|
|
367
|
+
// Symptom: binary launches, opens stdio, then never exits.
|
|
368
|
+
//
|
|
369
|
+
// Why transformObjectKeys must stay OFF:
|
|
370
|
+
//
|
|
371
|
+
// Same family of issue — it rewrites top-level module.exports / exports
|
|
372
|
+
// patterns in ways that bun's standalone runtime cannot rebuild.
|
|
373
|
+
//
|
|
374
|
+
// Why renameGlobals must stay OFF:
|
|
375
|
+
//
|
|
376
|
+
// Not strictly required after the bundle step (no external require'd
|
|
377
|
+
// modules remain), but kept off as a safety belt; the cost is small
|
|
378
|
+
// because identifier hashing already covers >99% of names through
|
|
379
|
+
// identifierNamesGenerator='hexadecimal'.
|
|
380
|
+
//
|
|
381
|
+
// Smoke test policy:
|
|
382
|
+
//
|
|
383
|
+
// We only smoke test the binary that matches the BUILD HOST triple.
|
|
384
|
+
// Cross-compiled binaries can't be executed without an emulator
|
|
385
|
+
// (qemu-user-static on linux, Rosetta on darwin-x64-on-arm64). CI/CD
|
|
386
|
+
// in GitHub Actions on `runs-on: macos-latest, ubuntu-latest` should
|
|
387
|
+
// set up the matrix so each runner smoke-tests its own native target.
|
|
388
|
+
//
|