repack()
Function in Emit
Emit manifest again from the portable IR it carries, with options: the same program, its WGSL, GLSL and layouts byte for byte what the build wrote, and the variants the build did not ask for.
import { repack } from 'typeshade/emit'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
function repack(manifest: Pack, options: { readonly console?: boolean } = {}): PackParameters
manifestPackoptionsoptional{ readonly console?: boolean }
Return value
Exceptions
TypeErrorTypeErrorwhen the manifest carries no IR, and when another package version wrote it, naming both versions: the IR is not a stable format, and only its own version reads it.
Description
The IR stays on the result, so it can be emitted again. options.console adds the
recorded variant, the WGSL that records the console.* calls (surface §66).
The program is emitted under the options the manifest was packed under, the emit it records
(packModule(m, { emit }), surface §69): its optimization level, its parens and its
fp64Flavor, so its text and its bindings are the ones the build wrote and the variant it adds
agrees with them. A manifest packed with emit plugins carries no IR (packModule refuses ir
with a plugin: a plugin is a function, which a manifest cannot record).
Examples
Example
import { createRuntime } from 'typeshade/runtime';import { repack } from 'typeshade/emit';
const rt = await createRuntime({ emit: repack });const program = rt.load(manifest, { console: true }); // recorded, though the build did notSource
src/emit.ts, line 43, at commit 26de7be8