mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-21 04:10:47 +02:00
make runtime provenance platform-neutral
This commit is contained in:
@@ -599,22 +599,28 @@ function runtimeHelperClosure(rendered: Map<string, RenderedModuleRecord>): Arra
|
||||
consumers.set(match[1], sources);
|
||||
}
|
||||
}
|
||||
const platformSourceOverrides: Record<string, { posix: string; win32: string }> = {
|
||||
browse: { posix: 'browse/dist/browse', win32: 'browse/dist/browse.exe' },
|
||||
'gstack-design': { posix: 'design/dist/design', win32: 'design/dist/design.exe' },
|
||||
'make-pdf': { posix: 'make-pdf/dist/pdf', win32: 'make-pdf/dist/pdf.exe' },
|
||||
};
|
||||
const sourceOverrides: Record<string, string> = {
|
||||
browse: process.platform === 'win32' ? 'browse/dist/browse.exe' : 'browse/dist/browse',
|
||||
'gstack-design': process.platform === 'win32' ? 'design/dist/design.exe' : 'design/dist/design',
|
||||
'make-pdf': process.platform === 'win32' ? 'make-pdf/dist/pdf.exe' : 'make-pdf/dist/pdf',
|
||||
'remote-slug': 'browse/bin/remote-slug',
|
||||
'gstack-gbrain-sync': 'bin/gstack-gbrain-sync.ts',
|
||||
'gstack-memory-ingest': 'bin/gstack-memory-ingest.ts',
|
||||
'gstack-global-discover': 'bin/gstack-global-discover.ts',
|
||||
'gstack-redact-audit-log': 'bin/gstack-redact-audit-log',
|
||||
};
|
||||
return [...consumers].sort(([left], [right]) => left.localeCompare(right)).map(([name, sources]) => ({
|
||||
name,
|
||||
source_path: sourceOverrides[name] ?? `bin/${name}`,
|
||||
consumer_modules: [...sources].sort(),
|
||||
stable_path: `\${GSTACK_HOME:-$HOME/.gstack}/bin/${name}`,
|
||||
}));
|
||||
return [...consumers].sort(([left], [right]) => left.localeCompare(right)).map(([name, sources]) => {
|
||||
const platformPaths = platformSourceOverrides[name];
|
||||
return {
|
||||
name,
|
||||
source_path: platformPaths?.posix ?? sourceOverrides[name] ?? `bin/${name}`,
|
||||
...(platformPaths ? { platform_source_paths: platformPaths } : {}),
|
||||
consumer_modules: [...sources].sort(),
|
||||
stable_path: `\${GSTACK_HOME:-$HOME/.gstack}/bin/${name}`,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
interface SectionCopyRecord {
|
||||
|
||||
@@ -248,7 +248,9 @@ export function runParity(): ParityResult {
|
||||
const helperClosure = json(path.join(ROOT, 'evals', 'parity', 'runtime-helper-closure.json'));
|
||||
check(JSON.stringify(helperClosure.helpers) === JSON.stringify(manifest.runtime_helpers), 'Runtime helper closure and provenance differ');
|
||||
for (const helper of helperClosure.helpers) {
|
||||
check(fs.existsSync(path.join(ROOT, helper.source_path)), `Preserved helper ${helper.name} has no source payload at ${helper.source_path}`);
|
||||
const sourcePath = helper.platform_source_paths?.[process.platform === 'win32' ? 'win32' : 'posix']
|
||||
?? helper.source_path;
|
||||
check(fs.existsSync(path.join(ROOT, sourcePath)), `Preserved helper ${helper.name} has no source payload at ${sourcePath}`);
|
||||
check(Array.isArray(helper.consumer_modules) && helper.consumer_modules.length > 0, `Preserved helper ${helper.name} has no consumer provenance`);
|
||||
}
|
||||
for (const record of [...manifest.sources, ...manifest.sections]) {
|
||||
|
||||
Reference in New Issue
Block a user