obsidian-integration-testing 8.0.1 → 8.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -4
- package/dist/lib/cjs/cli.cjs +29 -8
- package/dist/lib/cjs/cli.d.cts +2 -1
- package/dist/lib/cjs/connect-to-cdp.cjs +17 -11
- package/dist/lib/cjs/connect-to-cdp.d.cts +35 -3
- package/dist/lib/cjs/context-provider.cjs +1 -1
- package/dist/lib/cjs/context-provider.d.cts +1 -1
- package/dist/lib/cjs/global-setup-core.cjs +17 -5
- package/dist/lib/cjs/global-setup-core.d.cts +11 -1
- package/dist/lib/cjs/incompatible-installer-version-error.cjs +52 -0
- package/dist/lib/cjs/incompatible-installer-version-error.d.cts +44 -0
- package/dist/lib/cjs/index.cjs +13 -1
- package/dist/lib/cjs/index.d.cts +7 -0
- package/dist/lib/cjs/installer-compatibility.cjs +64 -0
- package/dist/lib/cjs/installer-compatibility.d.cts +75 -0
- package/dist/lib/cjs/library.cjs +1 -1
- package/dist/lib/cjs/namespace-bootstrap.cjs +16 -7
- package/dist/lib/cjs/obsidian-installer.cjs +7 -4
- package/dist/lib/cjs/obsidian-metadata.cjs +1811 -0
- package/dist/lib/cjs/obsidian-metadata.d.cts +56 -0
- package/dist/lib/cjs/renderer-boot-detection.cjs +49 -0
- package/dist/lib/cjs/renderer-boot-detection.d.cts +83 -0
- package/dist/lib/cjs/renderer-failed-to-initialize-error.cjs +41 -0
- package/dist/lib/cjs/renderer-failed-to-initialize-error.d.cts +23 -0
- package/dist/lib/cjs/transport-desktop-cdp.cjs +85 -3
- package/dist/lib/cjs/transport-desktop-cdp.d.cts +55 -1
- package/dist/lib/cjs/transport-factory.cjs +76 -21
- package/dist/lib/cjs/transport-factory.d.cts +1 -1
- package/dist/lib/cjs/transport-options.cjs +1 -1
- package/dist/lib/cjs/transport-options.d.cts +37 -4
- package/dist/lib/cjs/visibility.cjs +10 -2
- package/dist/lib/cjs/visibility.d.cts +27 -8
- package/dist/lib/esm/cli.d.mts +2 -1
- package/dist/lib/esm/cli.mjs +29 -8
- package/dist/lib/esm/connect-to-cdp.d.mts +35 -3
- package/dist/lib/esm/connect-to-cdp.mjs +17 -11
- package/dist/lib/esm/context-provider.d.mts +1 -1
- package/dist/lib/esm/context-provider.mjs +1 -1
- package/dist/lib/esm/global-setup-core.d.mts +11 -1
- package/dist/lib/esm/global-setup-core.mjs +15 -4
- package/dist/lib/esm/incompatible-installer-version-error.d.mts +44 -0
- package/dist/lib/esm/incompatible-installer-version-error.mjs +28 -0
- package/dist/lib/esm/index.d.mts +7 -0
- package/dist/lib/esm/index.mjs +9 -1
- package/dist/lib/esm/installer-compatibility.d.mts +75 -0
- package/dist/lib/esm/installer-compatibility.mjs +40 -0
- package/dist/lib/esm/library.mjs +1 -1
- package/dist/lib/esm/namespace-bootstrap.mjs +16 -7
- package/dist/lib/esm/obsidian-installer.mjs +7 -4
- package/dist/lib/esm/obsidian-metadata.d.mts +56 -0
- package/dist/lib/esm/obsidian-metadata.mjs +1787 -0
- package/dist/lib/esm/renderer-boot-detection.d.mts +83 -0
- package/dist/lib/esm/renderer-boot-detection.mjs +23 -0
- package/dist/lib/esm/renderer-failed-to-initialize-error.d.mts +23 -0
- package/dist/lib/esm/renderer-failed-to-initialize-error.mjs +17 -0
- package/dist/lib/esm/transport-desktop-cdp.d.mts +55 -1
- package/dist/lib/esm/transport-desktop-cdp.mjs +89 -3
- package/dist/lib/esm/transport-factory.d.mts +1 -1
- package/dist/lib/esm/transport-factory.mjs +76 -21
- package/dist/lib/esm/transport-options.d.mts +37 -4
- package/dist/lib/esm/visibility.d.mts +27 -8
- package/dist/lib/esm/visibility.mjs +8 -2
- package/dist/obsidian-integration-testing-8.1.1.tgz +0 -0
- package/package.json +2 -3
- package/dist/obsidian-integration-testing-8.0.1.tgz +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
*
|
|
4
|
+
* Typed access to the repo-root `metadata.json` — the per-Obsidian-app-version
|
|
5
|
+
* data table precomputed in this repo (installer-floor / recommended-installer /
|
|
6
|
+
* recommended-Electron thresholds; see the `metadata.json` section in
|
|
7
|
+
* `CLAUDE.md`). This is the single module that reads the raw table; everything
|
|
8
|
+
* else consumes it through {@link getVersionMetadata} against the
|
|
9
|
+
* {@link ObsidianVersionMetadata} shape, so the raw table stays internal and the
|
|
10
|
+
* public surface is a typed lookup.
|
|
11
|
+
*
|
|
12
|
+
* The table is injected at build time by esbuild's `define` (and at test time by
|
|
13
|
+
* Vitest's `define`) — the `OBSIDIAN_METADATA` global is replaced with the parsed
|
|
14
|
+
* contents of `metadata.json`. This mirrors how `OBSIDIAN_INTEGRATION_TESTING_VERSION`
|
|
15
|
+
* is injected, and keeps the built library self-contained (the table is inlined
|
|
16
|
+
* into the output, with no runtime file read and no `bundle`-time JSON import that
|
|
17
|
+
* `bundle: false` cannot inline).
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* The subset of a `metadata.json` per-version entry this library reads.
|
|
21
|
+
*
|
|
22
|
+
* Every field is optional — an entry carries only the thresholds that apply to
|
|
23
|
+
* that version (e.g. only old versions carry {@link minRecommendedInstallerVersion}).
|
|
24
|
+
*/
|
|
25
|
+
export interface ObsidianVersionMetadata {
|
|
26
|
+
/** Whether the version's assets are available (present only when `false`). */
|
|
27
|
+
readonly available?: boolean;
|
|
28
|
+
/** URL of the version's changelog. */
|
|
29
|
+
readonly changelogUrl?: string;
|
|
30
|
+
/** The release channel: `'public'`, `'catalyst'`, or `'public+catalyst'`. */
|
|
31
|
+
readonly channel?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The app's hardcoded required-minimum Electron version (e.g. `'28.2.3'`). An
|
|
34
|
+
* Electron version, not an installer version — comparing against it needs the
|
|
35
|
+
* installer's bundled Electron, which is not derivable offline.
|
|
36
|
+
*/
|
|
37
|
+
readonly minRecommendedElectronVersion?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The recommended-minimum installer version (Obsidian's own "installer too old,
|
|
40
|
+
* reinstall" guidance). Present only on older versions.
|
|
41
|
+
*/
|
|
42
|
+
readonly minRecommendedInstallerVersion?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The empirically-measured run floor: the oldest installer version whose
|
|
45
|
+
* Electron shell can actually boot this app version's asar. Below it the
|
|
46
|
+
* renderer dead-boots.
|
|
47
|
+
*/
|
|
48
|
+
readonly minRunnableInstallerVersion?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Looks up the metadata entry for a concrete Obsidian app version.
|
|
52
|
+
*
|
|
53
|
+
* @param version - A concrete `x.y.z` app version.
|
|
54
|
+
* @returns The entry, or `undefined` when the version is absent from the table.
|
|
55
|
+
*/
|
|
56
|
+
export declare function getVersionMetadata(version: string): ObsidianVersionMetadata | undefined;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var renderer_boot_detection_exports = {};
|
|
20
|
+
__export(renderer_boot_detection_exports, {
|
|
21
|
+
DEFAULT_DEAD_BOOT_GRACE_IN_MILLISECONDS: () => DEFAULT_DEAD_BOOT_GRACE_IN_MILLISECONDS,
|
|
22
|
+
checkRendererBootState: () => checkRendererBootState,
|
|
23
|
+
resolveDeadBootGraceInMilliseconds: () => resolveDeadBootGraceInMilliseconds
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(renderer_boot_detection_exports);
|
|
26
|
+
const DEFAULT_DEAD_BOOT_GRACE_IN_MILLISECONDS = 1e4;
|
|
27
|
+
function checkRendererBootState(params) {
|
|
28
|
+
const { bodyChildElementCount, hasGraceElapsed, hasWindowApp, isDocumentComplete } = params;
|
|
29
|
+
if (hasWindowApp) {
|
|
30
|
+
return "pending";
|
|
31
|
+
}
|
|
32
|
+
if (!hasGraceElapsed) {
|
|
33
|
+
return "pending";
|
|
34
|
+
}
|
|
35
|
+
if (isDocumentComplete && bodyChildElementCount === 0) {
|
|
36
|
+
return "dead";
|
|
37
|
+
}
|
|
38
|
+
return "pending";
|
|
39
|
+
}
|
|
40
|
+
function resolveDeadBootGraceInMilliseconds(options) {
|
|
41
|
+
return options?.deadBootGraceInMilliseconds ?? DEFAULT_DEAD_BOOT_GRACE_IN_MILLISECONDS;
|
|
42
|
+
}
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
DEFAULT_DEAD_BOOT_GRACE_IN_MILLISECONDS,
|
|
46
|
+
checkRendererBootState,
|
|
47
|
+
resolveDeadBootGraceInMilliseconds
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL3JlbmRlcmVyLWJvb3QtZGV0ZWN0aW9uLnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvKipcbiAqIEBmaWxlXG4gKlxuICogUHVyZSBkZXRlY3Rpb24gb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DtBQUVBLE1BQUksQ0FBQyxpQkFBaUI7QUFDcEIsV0FBTztBQUFBLEVBQ1Q7QUFFQSxNQUFJLHNCQUFzQiwwQkFBMEIsR0FBRztBQUNyRCxXQUFPO0FBQUEsRUFDVDtBQUVBLFNBQU87QUFDVDtBQWNPLFNBQVMsbUNBQ2QsU0FDUTtBQUNSLFNBQU8sU0FBUywrQkFBK0I7QUFDakQ7IiwKICAibmFtZXMiOiBbXQp9Cg==
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
*
|
|
4
|
+
* Pure detection of a terminal "dead boot" of the owned Obsidian renderer, plus
|
|
5
|
+
* resolving the fast-fail grace window from the transport options. Kept separate
|
|
6
|
+
* from the integration-only `transport-desktop-cdp` (which drives real CDP and is
|
|
7
|
+
* excluded from unit tests) so the verdict logic and default resolution stay
|
|
8
|
+
* unit-testable.
|
|
9
|
+
*
|
|
10
|
+
* When an Obsidian asar cannot run on the launched Electron shell (the installer
|
|
11
|
+
* version is too old for that app version), the renderer loads `index.html`
|
|
12
|
+
* (`document.readyState` reaches `'complete'`) but the app never bootstraps:
|
|
13
|
+
* `document.body` stays empty and `window.app` remains `undefined` — visually a
|
|
14
|
+
* black screen. The owned-vault readiness poll cannot tell this terminal state
|
|
15
|
+
* apart from "still loading", so without a detector it waits out the whole
|
|
16
|
+
* readiness timeout before failing. This module encodes the signal that
|
|
17
|
+
* distinguishes the two: once the renderer has been `complete` for a short grace
|
|
18
|
+
* window with no `window.app` and an empty `<body>`, it is dead, not slow.
|
|
19
|
+
*/
|
|
20
|
+
import type { ObsidianCdpTransportOptions } from './transport-options.cjs';
|
|
21
|
+
/**
|
|
22
|
+
* Default for {@link ObsidianCdpTransportOptions.deadBootGraceInMilliseconds}.
|
|
23
|
+
*/
|
|
24
|
+
export declare const DEFAULT_DEAD_BOOT_GRACE_IN_MILLISECONDS = 10000;
|
|
25
|
+
/**
|
|
26
|
+
* Parameters for {@link checkRendererBootState}.
|
|
27
|
+
*/
|
|
28
|
+
export interface CheckRendererBootStateParams extends RendererBootObservation {
|
|
29
|
+
/**
|
|
30
|
+
* Whether the bootstrap grace window has elapsed since the renderer first
|
|
31
|
+
* reached `document.readyState` `'complete'`. The `'dead'` verdict is withheld
|
|
32
|
+
* until this is `true` so a genuinely slow boot is never misjudged.
|
|
33
|
+
*/
|
|
34
|
+
readonly hasGraceElapsed: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A sample of the owned renderer's bootstrap state, taken from the vault page
|
|
38
|
+
* target via a single CDP evaluation.
|
|
39
|
+
*/
|
|
40
|
+
export interface RendererBootObservation {
|
|
41
|
+
/**
|
|
42
|
+
* `document.body.childElementCount` in the vault renderer (`0` when `body` is
|
|
43
|
+
* absent). A dead boot leaves the body empty; a slow-but-valid boot renders at
|
|
44
|
+
* least a loading shell.
|
|
45
|
+
*/
|
|
46
|
+
readonly bodyChildElementCount: number;
|
|
47
|
+
/** Whether `window.app` is defined in the vault renderer. */
|
|
48
|
+
readonly hasWindowApp: boolean;
|
|
49
|
+
/** Whether the vault renderer's `document.readyState` is `'complete'`. */
|
|
50
|
+
readonly isDocumentComplete: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Verdict from {@link checkRendererBootState}: `'dead'` when the renderer has
|
|
54
|
+
* terminally failed to initialize, `'pending'` when it may still be booting.
|
|
55
|
+
*/
|
|
56
|
+
export type RendererBootVerdict = 'dead' | 'pending';
|
|
57
|
+
/**
|
|
58
|
+
* Decides whether the owned renderer has terminally failed to initialize.
|
|
59
|
+
*
|
|
60
|
+
* The verdict is `'dead'` only when all of the following hold: the grace window
|
|
61
|
+
* has elapsed, `window.app` is still undefined, the document is `'complete'`,
|
|
62
|
+
* and `<body>` is empty. This is exactly the observed incompatible-shell state
|
|
63
|
+
* (an asar that cannot run on the launched Electron), and it cannot be reached
|
|
64
|
+
* by a healthy boot — `window.app` is defined early, and a slow boot renders a
|
|
65
|
+
* non-empty loading shell — so there is no false-positive path on a valid boot.
|
|
66
|
+
*
|
|
67
|
+
* @param params - The sampled observation plus whether the grace has elapsed.
|
|
68
|
+
* @returns `'dead'` when the renderer is terminally dead, otherwise `'pending'`.
|
|
69
|
+
*/
|
|
70
|
+
export declare function checkRendererBootState(params: CheckRendererBootStateParams): RendererBootVerdict;
|
|
71
|
+
/**
|
|
72
|
+
* Resolves the dead-boot fast-fail grace window, applying the default when the
|
|
73
|
+
* option is omitted.
|
|
74
|
+
*
|
|
75
|
+
* This bounds how long the owned-vault readiness poll waits — after the renderer
|
|
76
|
+
* first reaches `document.readyState` `'complete'` — before concluding the boot
|
|
77
|
+
* is dead (see {@link checkRendererBootState}). A value of `0` disables fast-fail
|
|
78
|
+
* entirely, restoring the plain wait-out-the-readiness-timeout behavior.
|
|
79
|
+
*
|
|
80
|
+
* @param options - The desktop CDP transport options (or the relevant slice).
|
|
81
|
+
* @returns The grace window in milliseconds.
|
|
82
|
+
*/
|
|
83
|
+
export declare function resolveDeadBootGraceInMilliseconds(options?: Pick<ObsidianCdpTransportOptions, 'deadBootGraceInMilliseconds'>): number;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var renderer_failed_to_initialize_error_exports = {};
|
|
20
|
+
__export(renderer_failed_to_initialize_error_exports, {
|
|
21
|
+
RendererFailedToInitializeError: () => RendererFailedToInitializeError
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(renderer_failed_to_initialize_error_exports);
|
|
24
|
+
class RendererFailedToInitializeError extends Error {
|
|
25
|
+
/**
|
|
26
|
+
* Creates the error for a specific vault.
|
|
27
|
+
*
|
|
28
|
+
* @param vaultPath - The vault whose owned renderer failed to initialize.
|
|
29
|
+
*/
|
|
30
|
+
constructor(vaultPath) {
|
|
31
|
+
super(
|
|
32
|
+
`The Obsidian renderer for vault ${vaultPath} did not initialize on this Electron shell. The installer/Electron version is likely too old for this Obsidian app version. Pin a newer obsidianInstallerVersion, or align obsidianVersion with the installed shell.`
|
|
33
|
+
);
|
|
34
|
+
this.name = "RendererFailedToInitializeError";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
RendererFailedToInitializeError
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL3JlbmRlcmVyLWZhaWxlZC10by1pbml0aWFsaXplLWVycm9yLnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvKipcbiAqIEBmaWxlXG4gKlxuICogVGhlIGRpc3RpbmN0IGVycm9yIHRocm93biB3aGVuIHRoZSBvd25lZCBPYnNpZGlhbiByZW5kZXJlciB0ZXJtaW5hbGx5IGZhaWxzIHRvXG4gKiBpbml0aWFsaXplIFx1MjAxNCB0aGUgYXNhciBjb3VsZCBub3QgcnVuIG9u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Y29uc3RydWN0b3IodmF1bHRQYXRoOiBzdHJpbmcpIHtcbiAgICBzdXBlcihcbiAgICAgIGBUaGUgT2JzaWRpYW4gcmVuZGVyZXIgZm9yIHZhdWx0ICR7dmF1bHRQYXRofSBkaWQgbm90IGluaXRpYWxpemUgb24gdGhpcyBFbGVjdHJvbiBzaGVsbC4gYFxuICAgICAgICArICdUaGUgaW5zdGFsbGVyL0VsZWN0cm9uIHZlcnNpb24gaXMgbGlrZWx5IHRvbyBvbGQgZm9yIHRoaXMgT2JzaWRpYW4gYXBwIHZlcnNpb24uICdcbiAgICAgICAgKyAnUGluIGEgbmV3ZXIgb2JzaWRpYW5JbnN0YWxsZXJWZXJzaW9uLCBvciBhbGlnbiBvYnNpZGlhblZlcnNpb24gd2l0aCB0aGUgaW5zdGFsbGVkIHNoZWxsLidcbiAgICApO1xuICAgIHRoaXMubmFtZSA9ICdSZW5kZXJlckZhaWxlZFRvSW5pdGlhbGl6ZUVycm9yJztcbiAgfVxufVxuIl0sCiAgIm1hcHBpbmdzIjogIjs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQWdCTyxNQUFNLHdDQUF3QyxNQUFNO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLEVBTWxELFlBQVksV0FBbUI7QUFDcEM7QUFBQSxNQUNFLG1DQUFtQyxTQUFTO0FBQUEsSUFHOUM7QUFDQSxTQUFLLE9BQU87QUFBQSxFQUNkO0FBQ0Y7IiwKICAibmFtZXMiOiBbXQp9Cg==
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
*
|
|
4
|
+
* The distinct error thrown when the owned Obsidian renderer terminally fails to
|
|
5
|
+
* initialize — the asar could not run on the launched Electron shell (the
|
|
6
|
+
* installer/Electron version is too old for the Obsidian app version). It is
|
|
7
|
+
* exported so callers of `connectToCdp` / the transport can `instanceof`-match
|
|
8
|
+
* this specific failure and distinguish it from a generic readiness timeout.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Thrown when the owned Obsidian renderer loads but never bootstraps the app —
|
|
12
|
+
* an empty `<body>` with no `window.app` after the boot grace window (see
|
|
13
|
+
* `checkRendererBootState`). The usual cause is an installer/Electron shell too
|
|
14
|
+
* old for the pinned Obsidian app version.
|
|
15
|
+
*/
|
|
16
|
+
export declare class RendererFailedToInitializeError extends Error {
|
|
17
|
+
/**
|
|
18
|
+
* Creates the error for a specific vault.
|
|
19
|
+
*
|
|
20
|
+
* @param vaultPath - The vault whose owned renderer failed to initialize.
|
|
21
|
+
*/
|
|
22
|
+
constructor(vaultPath: string);
|
|
23
|
+
}
|