A .pvmod file is how a mod travels: one ZIP of the mod folder, named <id>-<version>.pvmod. Plain folders keep working for development; the package is only the exchange format. The game checks the whole archive before it writes anything, and a failed install leaves your mods folder as it was.
What is in a package
A package holds the files of the mod folder, nothing else. The only declaration of a mod is defineMod in its entry file. JSON in a package is data the mod may import, never a manifest.
sparks-1.2.0.pvmod
├── main.ts entry file (or index.ts)
├── lib/shapes.ts
├── fonts/Display.ttf
└── images/spark.png
The entry file is main.ts, or index.ts when there is no main.ts. It sits at the root of the ZIP. A ZIP whose files all live in one top folder (sparks/main.ts) is accepted too: that folder is stripped on install.
| Allowed extension | Used for |
|---|---|
ts |
Sources (.d.ts counts as .ts) |
ttf, otf |
Fonts (a mod font is at most 8 MiB) |
png |
Images |
json, md, txt |
Data and notes |
Any other extension makes the whole package invalid. Folder entries are fine.
The id declared by defineMod is 1 to 64 characters among a-z, 0-9, ., -, _. It starts and ends with a letter or a digit and has no ... The version is a semantic version (1.2.0, a pre-release suffix is allowed). See Concepts for the manifest.
Limits
These limits are checked before extraction and again while extracting.
| Limit | Value |
|---|---|
| Package file | 64 MiB |
| Entries (files and folders) | 1024 |
| Files | 256 |
| One file, uncompressed | 16 MiB |
| All files, uncompressed | 64 MiB |
Entries must have a safe relative path (no .., no absolute path). Symbolic links and encrypted entries are refused. Two entries whose names differ only by case are refused (Foo.ts and foo.ts), because Windows and macOS would merge them. Only the stored and deflate compression methods are read.
The catalogue is stricter than the game: it caps a mod at 2 MiB and a skin at 8 MiB, and has its own file-type and count rules. Read Catalogue before publishing. The table of every limit in one place is in Limits.
Export a mod
On the Mods page, the Export action of an installed mod asks for a folder and writes <id>-<version>.pvmod there. The id and version come from the mod's defineMod.
Export skips hidden entries (names that start with .) and node_modules. Every other file must be allowed: a .psd or a .mp3 in the folder makes the export fail with the error described below, so move it out first. Symbolic links in the folder fail the export too. The file is written to a temporary name and renamed, so a failed export leaves no half file.
Install a mod
You can install a package three ways: the Install… button of the Mods page, dropping a .pvmod on the game window, or double-clicking it in Windows (see Share strings and file associations). A mod that arrives by double-click is installed disabled: enable it from the Mods page after reading its permissions. Updating an installed mod keeps its enabled or disabled state.
The game then:
- Checks the whole ZIP (paths, links, extensions, sizes, counts, entry file).
- Extracts it into a hidden staging folder of your mods folder.
- Loads the mod once in a throwaway engine, under the mod budgets, to read its
defineMod. - Swaps the folder into place as
<mods folder>/<id>with renames.
The mod is installed under its id, not under the package's file name.
Replace rules
An install replaces an installed mod with the same id, whatever its version. The game reports which case applied:
| Case | Message shown |
|---|---|
| No folder with this id | Installed {name} {version}. |
| Newer version | Updated {name} from {from} to {version}. |
| Same version | Reinstalled {name} {version}. |
| Older version | Downgraded {name} from {from} to {version}. |
| Existing folder could not be read | Replaced an unreadable mod folder with {name} {version}. |
Uninstalling a mod keeps its storage, so a reinstall finds its data again. The game's own mods (shipped next to prism.exe) are searched first; you cannot shadow one with a package.
The running mod host does not see the change until it restarts.
Errors
A refused package gives one of two message shapes:
invalid mod package: <reason>— the archive is not acceptable.the mod does not load: <reason>— the archive is fine, butdefineModis missing or invalid, the API version does not match, or a script or font fails.
The <reason> for an invalid package is one of:
| Reason | Cause |
|---|---|
not a ZIP archive (…) |
The file is not a ZIP |
the package weighs N bytes; the limit is M |
Over 64 MiB |
the package has N entries; the limit is M |
Over 1024 entries |
"X" is a symbolic link |
A link entry (also on export) |
"X" is encrypted |
A password-protected entry |
"X" appears twice |
Two entries with the same name, ignoring case |
"X" weighs N bytes; the limit is M |
A file over 16 MiB |
the files weigh more than N bytes |
Over 64 MiB unpacked |
the package holds more than N files |
Over 256 files |
"X" uses an unsupported compression (…) |
Not stored or deflate |
"X" cannot be in a package: allowed files are .ts, .ttf, .otf, .png, .json, .md, .txt |
Disallowed extension |
no main.ts or index.ts at the root of the package |
No entry file |
unsafe entry: … |
A path that escapes the folder |
the game's own folder <path> already holds the mod `<id>`; uninstall or edit it instead |
The id belongs to a mod shipped with the game |
the folder <path> holds another mod (`<id>`); rename it first |
A folder named like your id declares a different mod |
For the mod does not load, the reason is the same text you see when a mod in a plain folder fails: see Troubleshooting.
Pitfalls
- Count your files: 256 is a hard cap in the game. The catalogue server counts up to 512, so a catalogue mod with 257 to 512 files passes the server and then fails the install.
- The catalogue accepts fewer bytes than the game (2 MiB against 64 MiB). A mod with a large font installs from a file and is still refused by the catalogue.
- Keep build output, screenshots and source art out of the folder: any file with an extension outside the list fails the export and the install.