---
title: "repack(): function in Emit, TypeShade API reference"
description: "repack, a function in Emit. Emit manifest again from the portable IR it carries, with options: the same program, its WGSL…"
url: https://typeshade.dev/api/repack/
language: en
---

# `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 af54ddad5.

## Syntax

```ts
function repack(manifest: Pack, options: { readonly console?: boolean } = {}): Pack
```

## Parameters

**`manifest` `Pack`**

**`options` optional `{ readonly console?: boolean }`**

## Return value

`Pack`

## Exceptions

**`TypeError`**

`TypeError` when 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

```ts
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
```

## Source

[`src/emit.ts`, line 43](https://github.com/typeshade/typeshade/blob/af54ddad5/src/emit.ts#L43), at commit af54ddad5
