/** * @file * * Typed access to the repo-root `metadata.json` — the per-Obsidian-app-version * data table precomputed in this repo (installer-floor / recommended-installer / * recommended-Electron thresholds; see the `metadata.json` section in * `CLAUDE.md`). This is the single module that reads the raw table; everything * else consumes it through {@link getVersionMetadata} against the * {@link ObsidianVersionMetadata} shape, so the raw table stays internal and the * public surface is a typed lookup. * * The table is injected at build time by esbuild's `define` (and at test time by * Vitest's `define`) — the `OBSIDIAN_METADATA` global is replaced with the parsed * contents of `metadata.json`. This mirrors how `OBSIDIAN_INTEGRATION_TESTING_VERSION` * is injected, and keeps the built library self-contained (the table is inlined * into the output, with no runtime file read and no `bundle`-time JSON import that * `bundle: false` cannot inline). */ /** * The concrete JS runtime versions an installer's Electron shell ships — the * **entire** `process.versions` object, read empirically by booting that * installer over CDP (see `scripts/collect-runtime-versions.ts`). Absent for * versions not yet collected (or that could not be booted). * * **These are the WINDOWS (`.exe`) values, and that matters.** A given Electron * version does bundle the same Node / V8 / Chromium everywhere — but the Electron * version itself is a property of the *installer*, not of the release, and two * installers of the same Obsidian version can differ: `1.12.4` shipped Electron * `39.6.0` in its `.exe` and `39.7.0` in every other installer, and `1.8.10` * shipped `34.2.0` vs `34.5.2`. This field carries one flat value, measured on * the `.exe` — the installer that, with the `.dmg`, is published for all 106 * installer-bearing releases. So a consumer pinning a macOS or Linux installer * should treat `electron` as accurate to the patch only for the 104 releases * where the platforms agree. The collection workflow boots all three platforms * and reports any new divergence. * * The index signature carries every key `process.versions` exposes for that * Electron build — beyond the four well-known ones below, that typically includes * `ares`, `brotli`, `cldr`, `icu`, `llhttp`, `modules`, `napi`, `nghttp2`, * `openssl`, `tz`, `unicode`, `uv`, `zlib` (and, on newer Electron, `ada`, * `simdjson`, …). The exact set varies by Electron version, which is why it is * captured wholesale rather than as a fixed field list. */ export interface ObsidianRuntimeVersions { /** The bundled Chromium version, e.g. `'114.0.5735.289'`. */ readonly chrome: string; /** The bundled Electron version, e.g. `'25.8.1'`. */ readonly electron: string; /** The bundled Node.js version, e.g. `'18.15.0'`. */ readonly node: string; /** Every `process.versions` key the Electron build exposes. */ readonly [key: string]: string; /** The bundled V8 version, e.g. `'11.4.183.23'`. */ readonly v8: string; } /** * The changelog page URLs for a version, one per publication target, baked into * `metadata.json` from Obsidian's own changelog feed (`obsidian.md/changelog.xml` * — see the `metadata.json` section in `CLAUDE.md`). * * Obsidian publishes a *separate* changelog page per platform (desktop / mobile) * and per channel (public / catalyst "early access"), each at its own dated slug * — the catalyst page typically predates the public one by about a day. Every * key is optional: a version carries only the pages the feed actually published * for it (a catalyst-only build has no `desktop`, a desktop-only release has no * `mobile`, and the oldest versions predate the mobile app entirely). * * Caveat for the mobile keys: before **1.4.8** (2023-09-05) the mobile app ran * its own version line, so a same-keyed mobile page documents a *different* * release than the desktop page beside it (mobile `1.4.5` shipped 2023-05-23, * desktop `1.4.5` 2023-08-31). From 1.4.8 on the two lines track within days. */ export interface ObsidianVersionChangelogUrls { /** The public desktop changelog page URL. */ readonly desktop?: string; /** The catalyst ("early access") desktop changelog page URL. */ readonly desktopCatalyst?: string; /** The public mobile changelog page URL. */ readonly mobile?: string; /** The catalyst ("early access") mobile changelog page URL. */ readonly mobileCatalyst?: string; } /** * The pre-resolved asset download URLs for a version, baked into `metadata.json` * from the `obsidianmd/obsidian-releases` release assets — plus, for catalyst * builds, the `releases.obsidian.md` CDN, which publishes no listing and so is * probed (see the `metadata.json` section in `CLAUDE.md`). * * These are the exact URLs the version's assets are published at, so the * integration-time download paths can skip the GitHub release-API lookup and the * historical dot-vs-hyphen asset-name guessing. Only the assets this library * actually downloads are carried: the app `asar`, the x64 desktop installers, * and the Android `apk`. A field is absent when the version publishes no such * asset (e.g. a catalyst build ships only the `asar`), in which case the caller * falls back to its hand-rolled resolution. */ export interface ObsidianVersionDownloads { /** * The public Android `.apk` URL. Published as a GitHub release asset named * uniformly `Obsidian-.apk` — the asset first appears at 1.5.8 and is * hyphenated from the start, so it has no dot-separator era to guess around * (unlike the desktop installers `installer-asset.ts` handles). * * There is deliberately no catalyst counterpart. Unlike the desktop catalyst * asar, the mobile catalyst build is not published at a URL at all: Obsidian * distributes it through a Discord-gated channel, per * https://obsidian.md/help/early-access. What this table can carry for a * catalyst mobile build is its changelog — * {@link ObsidianVersionChangelogUrls.mobileCatalyst}. */ readonly apk?: string; /** The `obsidian-.asar.gz` package URL. */ readonly asar?: string; /** The macOS (universal) `.dmg` installer URL. */ readonly dmg?: string; /** The Windows x64 `.exe` installer URL. */ readonly exe?: string; /** The Linux x64 `.tar.gz` portable-build URL. */ readonly tar?: string; } /** * The subset of a `metadata.json` per-version entry this library reads. * * Every field is optional — an entry carries only the thresholds that apply to * that version (e.g. only old versions carry {@link minRecommendedInstallerVersion}). */ export interface ObsidianVersionMetadata { /** Whether the version's assets are available (present only when `false`). */ readonly available?: boolean; /** * The version's changelog page URLs, one per publication target (desktop / * mobile × public / catalyst), baked from Obsidian's changelog feed. Absent * for the few versions the feed never published a page for. */ readonly changelogUrl?: ObsidianVersionChangelogUrls; /** The release channel: `'public'`, `'catalyst'`, or `'public+catalyst'`. */ readonly channel?: string; /** * The pre-resolved asset download URLs for the version, baked from the * `obsidianmd/obsidian-releases` release assets. Absent for versions not present * in the catalog (the caller then falls back to hand-rolled resolution). */ readonly downloads?: ObsidianVersionDownloads; /** * The highest ECMAScript edition (e.g. `'ES2022'`) fully supported by this * version's bundled Chromium, derived from {@link ObsidianRuntimeVersions.chrome} * (see `deriveEcmaScriptVersion`). Baked alongside {@link runtimeVersions}, so a * consumer pinning this installer knows offline which ES level a serialized * `evalInObsidian` closure may safely use. Absent when the version has no * collected runtime versions. */ readonly ecmaScriptVersion?: string; /** * The app's hardcoded required-minimum Electron version (e.g. `'28.2.3'`). An * Electron version, not an installer version — comparing against it needs the * installer's bundled Electron, which is not derivable offline. */ readonly minRecommendedElectronVersion?: string; /** * The recommended-minimum installer version (Obsidian's own "installer too old, * reinstall" guidance). Present only on older versions. */ readonly minRecommendedInstallerVersion?: string; /** * The empirically-measured run floor: the oldest installer version whose * Electron shell can actually boot this app version's asar. Below it the * renderer dead-boots. */ readonly minRunnableInstallerVersion?: string; /** * The concrete JS runtime versions this version's Electron shell ships, read * empirically from `process.versions`. Absent until collected (see * {@link ObsidianRuntimeVersions} and `scripts/collect-runtime-versions.ts`). */ readonly runtimeVersions?: ObsidianRuntimeVersions; } /** * Looks up the metadata entry for a concrete Obsidian app version. * * @param version - A concrete `x.y.z` app version. * @returns The entry, or `undefined` when the version is absent from the table. */ export declare function getVersionMetadata(version: string): ObsidianVersionMetadata | undefined;