repack()
함수, 출력 분류
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'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
function repack(manifest: Pack, options: { readonly console?: boolean } = {}): Pack매개변수
manifestPackoptions선택 사항{ readonly console?: boolean }
반환값
예외
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.
설명
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).
예제
예제
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 not소스
src/emit.ts, 43행, 커밋 c66579bf 기준