js

package
v0.1.133 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 23 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package js builds the modlock library that TypeScript and JavaScript mods import: one ES module holding the calls into the game and its protobuf runtime, the entity classes, the console and the game-mode kit as modules that import the first, and their declarations. Beside them it keeps the library's TypeScript source and the protobuf runtime's, which scriptc compiles with a mod. It also bundles the renderer that draws mods' interfaces in the player's game, the preview page that draws them in a browser, and Modlock Studio's page.

A script project installs only the declarations, so editors and the type checker see one modlock package and neither compiler mistakes it for an npm dependency; each compiler resolves modlock to its own copy here.

Library builds from the Modlock source when it is on disk: a checkout, or the module cache of the build that links this package. A release build has no source on disk and carries the library it was built with.

Index

Constants

View Source
const Built = "built"

Built is the directory under js that the release build fills with the built library before it builds the command line, which embeds it.

View Source
const Kit = "kit"

Kit is the directory of the built library that holds the game-mode kit, which mods import as modlock/kit, and its declarations.

View Source
const LayoutLibrary = "layout.js"

LayoutLibrary is the built library a mod's layout script includes to read its data and routes, which a client content package installs as scripts/modlock/layout.js beside the renderer. Its bundle defines the global Modlock.

View Source
const Preview = "preview"

Preview is the directory of the built library that holds the preview page modlock dev serves.

View Source
const Renderer = "renderer.js"

Renderer is the built renderer's file name, which a client content package installs as scripts/modlock/ui.js beside the layout in panorama/layout. It is not ui.js, since the library's declarations include ui.d.ts: a mod that imported modlock/ui would type check and then run the renderer on the server.

View Source
const Scriptc = "scriptc"

Scriptc is the directory of the built library that holds the source scriptc compiles: the library under js/src and the generated messages it imports, as in the Modlock source, and the protobuf runtime under protobuf-es-lite.

View Source
const ScriptcProtobuf = "protobuf-es-lite"

ScriptcProtobuf is the protobuf runtime's source directory under Scriptc.

View Source
const Studio = "studio"

Studio is the directory of the built library that holds Modlock Studio's page, which modlock studio serves.

View Source
const Worker = "worker.js"

Worker is the built library's entry for a script a mod's worker runs, which the script imports as modlock/worker. It binds the host itself and leaves out the mod's event handlers, so a worker answers only requests.

Variables

View Source
var Sources embed.FS

Sources holds the library's whole TypeScript source, so a Go module that vendors Modlock keeps the library at the version it pins: its type checker can resolve modlock to src/index.ts, and its browser pages can import a module such as the HUD kit's tokens beside their own TypeScript. The protobuf messages the source imports are vendored with their own packages.

Functions

func Build

func Build(ctx context.Context, source, out string) error

Build builds the library and renderer from the Modlock source into out.

func Library

func Library(ctx context.Context) (string, error)

Library returns a directory holding the built library and renderer: one built from the Modlock source when it is on disk, or else the one this build embeds, placed in the user cache the first time.

func Source

func Source() string

Source returns the root of the Modlock source on disk, or empty when this build has none: the checkout or module cache directory this package was compiled from, or else the module cache entry of the linked version.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL