vanilladocs
vanillapunch.com
API / misc/buildinfo

misc/buildinfo

빌드 정보.

Build info.

BuildInfoextends Object

짝Counterpart: vanilla-engine BuildInfo

빌드 정보.

  • 배포 빌드가 적어 둔 판을 앱이 켜질 때 한 번 읽는다. 읽는 차례: 1. 페이지 머리의 <meta name="build-version" content="..."> 의 content. (있으면 그 글 그대로) 2. 없으면 version.json 을 캐시 없이(cache: "no-cache") 받는다. 새 판을 올려도 옛 판 표시가 남지 않게 한다. { version, date, time, hash, ... } 꼴이고, 글은 "날짜 시각 (해시)" 이다. 해시가 없으면 version, 그것도 없으면 빈 글.
  • 읽지 못하면(파일이 없는 개발 실행 같은 것) 예외 없이 빈 글이다. setPackageVersion 으로 넣은 판이 있으면 그 글이다.
  • 게임마다 판을 쓰는 꼴이 다르면 readVersionData() 로 받은 값을 게임이 엮는다.

Build info.

  • Reads the version written by the release build once when the app starts. Read order: 1. The content of <meta name="build-version" content="..."> in the page head. (If present, that text as is) 2. If absent, fetches version.json without cache (cache: "no-cache"). So the old version display does not linger after a new version is uploaded. Format { version, date, time, hash, ... }, and the text is "date time (hash)". If there is no hash, version, and if that is also missing, empty text.
  • If it cannot be read (such as a development run without the file), it is empty text without throwing. If a version was set with setPackageVersion, it is that text.
  • If each game writes the version differently, the game composes the value received from readVersionData().
예제Example판의 글 읽기Read the version text
import { BuildInfo } from "./build/vanilla.js";

const buildInfo = new BuildInfo();
buildInfo.setVersionJsonPath("");
buildInfo.setPackageVersion("1.2.3");
const versionText = await buildInfo.load();
const composedText = BuildInfo.composeText({ version: "1.2.3", date: "2026-11-26", time: "07:30", hash: "a1b2c3d" });
console.log(versionText, buildInfo.isLoaded(), composedText);
생성자constructorconstructor(versionJsonPath = DEFAULT_VERSION_JSON_PATH)#0.4.0 부터since 0.4.0소스source

생성.

Constructor.

versionJsonPathstring
빌드 판 파일 주소. (기본 "./version.json")Build version file URL. (default "./version.json")

짝Counterpart: vanilla-engine BuildInfo.new

정적staticstatic composeText(versionData)#0.4.0 부터since 0.4.0소스source

version.json 값으로 판의 글 만들기. (정적, "날짜 시각 (해시)", 해시가 없으면 version, 그것도 없으면 빈 글)

Builds the version text from a version.json value. (Static, "date time (hash)", version if there is no hash, empty text if that is also missing)

versionDataobject
{ version, date, time, hash }

반환Returnsstring 판의 글.The version text.

짝Counterpart: vanilla-engine BuildInfo.compose_text

메서드methodsetMetaName(metaName)#0.4.0 부터since 0.4.0소스source

meta 이름 설정. (기본 "build-version")

Sets the meta name. (default "build-version")

metaNamestring
판을 적은 meta 의 name.name of the meta that holds the version.

짝Counterpart: vanilla-engine BuildInfo.set_meta_name

메서드methodsetVersionJsonPath(versionJsonPath)#0.4.0 부터since 0.4.0소스source

빌드 판 파일 주소 설정. (빈 글이면 파일을 받지 않는다)

Sets the build version file URL. (Does not fetch the file if empty text)

versionJsonPathstring
빌드 판 파일 주소. (빈 글이면 받지 않는다)URL of the build version file. (not fetched if empty)

짝Counterpart: vanilla-engine BuildInfo.set_version_json_path

메서드methodasync load()#0.4.0 부터since 0.4.0소스source

읽기. (meta, 없으면 version.json. 실패해도 예외를 내지 않는다)

Reads. (meta, or version.json if absent. Does not throw on failure)

반환ReturnsPromise<string> 판의 글. (readText 와 같다)Version text. (Same as readText)

짝Counterpart: vanilla-engine BuildInfo.load

메서드methodreadMetaText()#0.4.0 부터since 0.4.0소스source

페이지의 meta 에 적힌 판. (없으면 빈 글)

Version written in the page's meta. (Empty text if absent)

반환Returnsstring meta 의 content 를 앞뒤 공백을 떼어 돌려준 글. 없으면 빈 글.The meta content with surrounding spaces trimmed. Empty if missing.

짝Counterpart: vanilla-engine BuildInfo.read_meta_text

메서드methodsetPackageVersion(packageVersion)#0.4.0 부터since 0.4.0소스source

빌드 때 넣은 판 설정. (meta 도 version.json 도 없을 때의 글, 번들러가 넣은 판 등)

Sets the version embedded at build time. (Text used when there is neither meta nor version.json, such as a version injected by a bundler)

packageVersionstring
빌드 때 넣은 판의 글.Version text set at build time.

짝Counterpart: vanilla-engine BuildInfo.set_package_version

메서드methodgetPackageVersion()#0.4.0 부터since 0.4.0소스source

빌드 때 넣은 판 반환.

Returns the version embedded at build time.

반환Returnsstring 빌드 때 넣은 판의 글. (처음은 빈 글)Version text set at build time. (empty at first)

짝Counterpart: vanilla-engine BuildInfo.get_package_version

메서드methodreadText()#0.4.0 부터since 0.4.0소스source

판의 글. (meta > version.json > 빌드 때 넣은 판, 다 없으면 빈 글)

Version text. (meta > version.json > version embedded at build time, empty text if none)

반환Returnsstring 판의 글. 다 없으면 빈 글.The version text. Empty if none is available.

짝Counterpart: vanilla-engine BuildInfo.read_text

메서드methodreadVersionData()#0.4.0 부터since 0.4.0소스source

version.json 에서 읽은 값. (meta 로 읽었거나 읽지 못했으면 null)

Value read from version.json. (null if read from meta or could not be read)

반환Returnsobject | null version.json 의 값. 없으면 null.The values from version.json. null if none.

짝Counterpart: vanilla-engine BuildInfo.read_version_data

메서드methodisLoaded()#0.4.0 부터since 0.4.0소스source

읽기를 마쳤는지. (실패해도 마친 것)

Whether reading has finished. (Finished even on failure)

반환Returnsboolean load 를 마쳤으면 참.True if load has finished.

짝Counterpart: vanilla-engine BuildInfo.is_loaded