obsidian-launcher 0.3.1 → 0.4.0

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 CHANGED
@@ -1,3 +1,133 @@
1
1
  # obsidian-launcher
2
2
 
3
- TODO
3
+ `obsidian-launcher` is a package for downloading and launching different versions of [Obsidian](https://obsidian.md)
4
+ during testing and development of Obsidian plugins. It can download Obsidian, install plugins and themes into Obsidian
5
+ vaults, and launch sandboxed instances Obsidian with isolated user configuration directories. You can use it either as
6
+ a JavaScript package or as a command line interface.
7
+
8
+ The primary use case for this package is downloading and launching Obsidian for testing Obsidian plugins
9
+ in WebdriverIO with
10
+ [wdio-obsidian-service](https://jesse-r-s-hines.github.io/wdio-obsidian-service/modules/obsidian-launcher.html).
11
+ However, it can also be used as a stand-alone package, for instance if you want to test plugins with a different
12
+ testing framework, or just want to use the provided CLI.
13
+
14
+ ## Example Usage
15
+ The default export of the package is the `ObsidianLauncher` class, which can be used like so:
16
+ ```js
17
+ const launcher = new ObsidianLauncher();
18
+ const {proc} = await launcher.launch({
19
+ appVersion: "1.7.7",
20
+ vault: "path/to/my/vault",
21
+ copy: true, // copy the vault before installing plugins and opening in Obsidian
22
+ plugins: [
23
+ "path/to/my/plugin", // install a local plugin
24
+ {id: "dataview"}, // install a community plugin
25
+ ],
26
+ })
27
+ ```
28
+ This will download and launch Obsidian 1.7.7 with a sandboxed configuration directory so you don't need to worry about
29
+ it interfering with your system Obsidian installation.
30
+
31
+ ## API Docs
32
+ API docs for the package are available [here](https://jesse-r-s-hines.github.io/wdio-obsidian-service/modules/obsidian-launcher.html).
33
+
34
+
35
+ ## CLI
36
+ `obsidian-launcher` also provides a CLI interface which can be used via `npx`
37
+ ```bash
38
+ npx obsidian-launcher [subcommand] ...
39
+ ```
40
+
41
+ Available commands:
42
+
43
+ ### download
44
+ Download Obsidian to the cache without launching.
45
+
46
+ ```text
47
+ Options:
48
+ -c, --cache <cache> Directory to use as the download cache
49
+ -v, --version <version> Obsidian version to run
50
+ (default: "latest")
51
+ -i, --installer <version> Obsidian installer version to run
52
+ (default: "latest")
53
+ ```
54
+
55
+ ### install
56
+ Install plugins and themes into an Obsidian vault.
57
+
58
+ ```text
59
+ Arguments:
60
+ vault Vault to install into
61
+
62
+ Options:
63
+ -c, --cache <cache> Directory to use as the download cache
64
+ -p, --plugin <plugin> Plugin to install. Format one of:
65
+ - "<path>"
66
+ - "repo:<github-repo>"
67
+ - "id:<community-id>"
68
+ Can be repeated.
69
+ -t, --theme <plugin> Theme to install. Format one of:
70
+ - "<path>"
71
+ - "repo:<github-repo>"
72
+ - "name:<community-name>".
73
+ Can be repeated but only last will be enabled.
74
+ ```
75
+
76
+ ### launch
77
+ Download and launch Obsidian, opening the specified vault. The Obsidian instance will have a sandboxed configuration
78
+ directory.
79
+
80
+ You can use this option to easily compare plugin behavior on different versions of Obsidian without messing with your
81
+ system installation of Obsidian.
82
+
83
+ ```text
84
+ Arguments:
85
+ vault Vault to open
86
+
87
+ Options:
88
+ -c, --cache <cache> Directory to use as the download cache
89
+ -v, --version <version> Obsidian version to run
90
+ (default: "latest")
91
+ -i, --installer <version> Obsidian installer version to run
92
+ (default: "latest")
93
+ -p, --plugin <plugin> Plugin to install. Format one of:
94
+ - "<path>"
95
+ - "repo:<github-repo>"
96
+ - "id:<community-id>".
97
+ Can be repeated.
98
+ -t, --theme <plugin> Theme to install. Format one of:
99
+ - "<path>"
100
+ - "repo:<github-repo>"
101
+ - "name:<community-name>".
102
+ Can be repeated but only last will be enabled.
103
+ --copy Copy the vault first
104
+ ```
105
+
106
+ ### watch
107
+ Downloads Obsidian and opens a vault, then watches for changes to plugins and themes.
108
+
109
+ Takes the same arguments as the `launch` command but watches for changes to any local plugins or themes and updates the
110
+ the vault. Automatically installs `pjeby/hot-reload` so plugins will hot reload as they are updated.
111
+
112
+ ```text
113
+ Arguments:
114
+ vault Vault to open
115
+
116
+ Options:
117
+ -c, --cache <cache> Directory to use as the download cache
118
+ -v, --version <version> Obsidian version to run
119
+ (default: "latest")
120
+ -i, --installer <version> Obsidian installer version to run
121
+ (default: "latest")
122
+ -p, --plugin <plugin> Plugin to install. Format one of:
123
+ - "<path>"
124
+ - "repo:<github-repo>"
125
+ - "id:<community-id>".
126
+ Can be repeated.
127
+ -t, --theme <plugin> Theme to install. Format one of:
128
+ - "<path>"
129
+ - "repo:<github-repo>"
130
+ - "name:<community-name>".
131
+ Can be repeated but only last will be enabled
132
+ --copy Copy the vault first
133
+ ```
@@ -423,10 +423,11 @@ function normalizeObsidianVersionInfo(versionInfo) {
423
423
  var ObsidianLauncher = class {
424
424
  /**
425
425
  * Construct an ObsidianLauncher.
426
- * @param cacheDir Path to the cache directory. Defaults to "OBSIDIAN_CACHE" env var or ".obsidian-cache".
427
- * @param versionsUrl Custom `obsidian-versions.json` url. Can be a file URL.
428
- * @param communityPluginsUrl Custom `community-plugins.json` url. Can be a file URL.
429
- * @param communityThemes Custom `community-css-themes.json` url. Can be a file URL.
426
+ * @param options.cacheDir Path to the cache directory. Defaults to "OBSIDIAN_CACHE" env var or ".obsidian-cache".
427
+ * @param options.versionsUrl Custom `obsidian-versions.json` url. Can be a file URL.
428
+ * @param options.communityPluginsUrl Custom `community-plugins.json` url. Can be a file URL.
429
+ * @param options.communityThemesUrl Custom `community-css-themes.json` url. Can be a file URL.
430
+ * @param options.cacheDuration If the cached version list is older than this (in ms), refetch it. Defaults to 30 minutes.
430
431
  */
431
432
  constructor(options = {}) {
432
433
  this.cacheDir = _path2.default.resolve(_nullishCoalesce(_nullishCoalesce(options.cacheDir, () => ( process.env.OBSIDIAN_CACHE)), () => ( "./.obsidian-cache")));
@@ -436,18 +437,19 @@ var ObsidianLauncher = class {
436
437
  this.communityPluginsUrl = _nullishCoalesce(options.communityPluginsUrl, () => ( defaultCommunityPluginsUrl));
437
438
  const defaultCommunityThemesUrl = "https://raw.githubusercontent.com/obsidianmd/obsidian-releases/HEAD/community-css-themes.json";
438
439
  this.communityThemesUrl = _nullishCoalesce(options.communityThemesUrl, () => ( defaultCommunityThemesUrl));
440
+ this.cacheDuration = _nullishCoalesce(options.cacheDuration, () => ( 30 * 60 * 1e3));
439
441
  this.metadataCache = {};
440
442
  }
441
443
  /**
442
444
  * Returns file content fetched from url as JSON. Caches content to dest and uses that cache if its more recent than
443
445
  * cacheDuration ms or if there are network errors.
444
446
  */
445
- async cachedFetch(url, dest, { cacheDuration = 30 * 60 * 1e3 } = {}) {
447
+ async cachedFetch(url, dest) {
446
448
  dest = _path2.default.resolve(dest);
447
449
  if (!(dest in this.metadataCache)) {
448
450
  let fileContent;
449
451
  const mtime = await fileExists(dest) ? (await _promises2.default.stat(dest)).mtime : void 0;
450
- if (mtime && (/* @__PURE__ */ new Date()).getTime() - mtime.getTime() < cacheDuration) {
452
+ if (mtime && (/* @__PURE__ */ new Date()).getTime() - mtime.getTime() < this.cacheDuration) {
451
453
  fileContent = await _promises2.default.readFile(dest, "utf-8");
452
454
  } else {
453
455
  const request = await maybe(fetchWithFileUrl(url));
@@ -470,6 +472,9 @@ var ObsidianLauncher = class {
470
472
  }
471
473
  return this.metadataCache[dest];
472
474
  }
475
+ /**
476
+ * Get parsed content of the current project's manifest.json
477
+ */
473
478
  async getRootManifest() {
474
479
  if (!("manifest.json" in this.metadataCache)) {
475
480
  const root = _path2.default.parse(process.cwd()).root;
@@ -486,27 +491,36 @@ var ObsidianLauncher = class {
486
491
  }
487
492
  return this.metadataCache["manifest.json"];
488
493
  }
489
- /** Get information about all available Obsidian versions. */
494
+ /**
495
+ * Get information about all available Obsidian versions.
496
+ */
490
497
  async getVersions() {
491
498
  const dest = _path2.default.join(this.cacheDir, "obsidian-versions.json");
492
499
  return (await this.cachedFetch(this.versionsUrl, dest)).versions;
493
500
  }
494
- /** Get information about all available community plugins. */
501
+ /**
502
+ * Get information about all available community plugins.
503
+ */
495
504
  async getCommunityPlugins() {
496
505
  const dest = _path2.default.join(this.cacheDir, "obsidian-community-plugins.json");
497
506
  return await this.cachedFetch(this.communityPluginsUrl, dest);
498
507
  }
499
- /** Get information about all available community themes. */
508
+ /**
509
+ * Get information about all available community themes.
510
+ */
500
511
  async getCommunityThemes() {
501
512
  const dest = _path2.default.join(this.cacheDir, "obsidian-community-css-themes.json");
502
513
  return await this.cachedFetch(this.communityThemesUrl, dest);
503
514
  }
504
515
  /**
505
516
  * Resolves Obsidian app and installer version strings to absolute versions.
506
- * @param appVersion Obsidian version string or "latest", "latest-beta" or "earliest". "earliest" will use the
507
- * minAppVersion set in your manifest.json.
508
- * @param installerVersion Obsidian version string or "latest" or "earliest". "earliest" will use the minimum
509
- * installer version compatible with the appVersion.
517
+ * @param appVersion Obsidian version string or one of
518
+ * - "latest": Get the current latest non-beta Obsidian version
519
+ * - "latest-beta": Get the current latest beta Obsidian version (or latest is there is no current beta)
520
+ * - "earliest": Get the `minAppVersion` set in set in your `manifest.json`
521
+ * @param installerVersion Obsidian version string or one of
522
+ * - "latest": Get the latest Obsidian installer
523
+ * - "earliest": Get the oldest Obsidian installer compatible with the specified Obsidian app version
510
524
  * @returns [appVersion, installerVersion] with any "latest" etc. resolved to specific versions.
511
525
  */
512
526
  async resolveVersions(appVersion, installerVersion = "latest") {
@@ -535,32 +549,31 @@ var ObsidianLauncher = class {
535
549
  }
536
550
  /**
537
551
  * Gets details about an Obsidian version.
538
- * @param version Obsidian version string or "latest", "earliest", or "latest-beta". "earliest" will use the
539
- * minAppVersion set in your manifest.json.
552
+ * @param appVersion Obsidian app version (see {@link resolveVersions} for format)
540
553
  */
541
- async getVersionInfo(version) {
554
+ async getVersionInfo(appVersion) {
542
555
  const versions = await this.getVersions();
543
- if (version == "latest-beta") {
544
- version = versions.at(-1).version;
545
- } else if (version == "latest") {
546
- version = versions.filter((v) => !v.isBeta).at(-1).version;
547
- } else if (version == "earliest") {
548
- version = await _asyncOptionalChain([(await this.getRootManifest()), 'optionalAccess', async _27 => _27.minAppVersion]);
549
- if (!version) {
550
- throw Error('Unable to resolve Obsidian app version "earliest", no manifest.json or minAppVersion found.');
556
+ if (appVersion == "latest-beta") {
557
+ appVersion = versions.at(-1).version;
558
+ } else if (appVersion == "latest") {
559
+ appVersion = versions.filter((v) => !v.isBeta).at(-1).version;
560
+ } else if (appVersion == "earliest") {
561
+ appVersion = await _asyncOptionalChain([(await this.getRootManifest()), 'optionalAccess', async _27 => _27.minAppVersion]);
562
+ if (!appVersion) {
563
+ throw Error('Unable to resolve Obsidian app appVersion "earliest", no manifest.json or minAppVersion found.');
551
564
  }
552
565
  } else {
553
- version = _nullishCoalesce(_semver2.default.valid(version), () => ( version));
566
+ appVersion = _nullishCoalesce(_semver2.default.valid(appVersion), () => ( appVersion));
554
567
  }
555
- const versionInfo = versions.find((v) => v.version == version);
568
+ const versionInfo = versions.find((v) => v.version == appVersion);
556
569
  if (!versionInfo) {
557
- throw Error(`No Obsidian app version ${version} found`);
570
+ throw Error(`No Obsidian app version ${appVersion} found`);
558
571
  }
559
572
  return versionInfo;
560
573
  }
561
574
  /**
562
575
  * Downloads the Obsidian installer for the given version and platform. Returns the file path.
563
- * @param installerVersion Version to download.
576
+ * @param installerVersion Obsidian installer version to download. (see {@link resolveVersions} for format)
564
577
  */
565
578
  async downloadInstaller(installerVersion) {
566
579
  const installerVersionInfo = await this.getVersionInfo(installerVersion);
@@ -640,7 +653,11 @@ var ObsidianLauncher = class {
640
653
  }
641
654
  /**
642
655
  * Downloads the Obsidian asar for the given version and platform. Returns the file path.
643
- * @param appVersion Version to download.
656
+ *
657
+ * To download beta versions you'll need to have an Obsidian account with Catalyst and set the `OBSIDIAN_USERNAME`
658
+ * and `OBSIDIAN_PASSWORD` environment variables. 2FA needs to be disabled.
659
+ *
660
+ * @param appVersion Obsidian version to download (see {@link resolveVersions} for format)
644
661
  */
645
662
  async downloadApp(appVersion) {
646
663
  const appVersionInfo = await this.getVersionInfo(appVersion);
@@ -669,10 +686,11 @@ var ObsidianLauncher = class {
669
686
  *
670
687
  * wdio will download chromedriver from the Chrome for Testing API automatically (see
671
688
  * https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints). However, Google has only put
672
- * chromedriver since v115.0.5763.0 in that API, so wdio can't download older versions of chromedriver. As of
673
- * Obsidian v1.7.7, minInstallerVersion is v0.14.5 which runs on chromium v100.0.4896.75. Here we download
674
- * chromedriver for older versions ourselves using the @electron/get package which fetches it from
675
- * https://github.com/electron/electron/releases.
689
+ * chromedriver since v115.0.5763.0 in that API, so wdio can't automatically download older versions of chromedriver
690
+ * for old Electron versions. Here we download chromedriver for older versions ourselves using the @electron/get
691
+ * package which fetches chromedriver from https://github.com/electron/electron/releases.
692
+ *
693
+ * @param installerVersion Obsidian installer version (see {@link resolveVersions} for format)
676
694
  */
677
695
  async downloadChromedriver(installerVersion) {
678
696
  const versionInfo = await this.getVersionInfo(installerVersion);
@@ -761,11 +779,13 @@ var ObsidianLauncher = class {
761
779
  return await this.downloadGitHubPlugin(pluginInfo.repo, version);
762
780
  }
763
781
  /**
764
- * Downloads a list of plugins to the cache and returns a list of LocalPluginEntry with the downloaded paths.
782
+ * Downloads a list of plugins to the cache and returns a list of `DownloadedPluginEntry` with the downloaded paths.
765
783
  * Also adds the `id` property to the plugins based on the manifest.
766
784
  *
767
785
  * You can download plugins from GitHub using `{repo: "org/repo"}` and community plugins using `{id: 'plugin-id'}`.
768
786
  * Local plugins will just be passed through.
787
+ *
788
+ * @param plugins List of plugins to download.
769
789
  */
770
790
  async downloadPlugins(plugins) {
771
791
  return await Promise.all(
@@ -802,7 +822,12 @@ var ObsidianLauncher = class {
802
822
  throw Error(`${pluginPath}/manifest.json malformed.`);
803
823
  }
804
824
  }
805
- const enabled = typeof plugin == "string" ? true : plugin.enabled;
825
+ let enabled;
826
+ if (typeof plugin == "string") {
827
+ enabled = true;
828
+ } else {
829
+ enabled = _nullishCoalesce(plugin.enabled, () => ( true));
830
+ }
806
831
  return { path: pluginPath, id: pluginId, enabled, originalType };
807
832
  })
808
833
  );
@@ -858,11 +883,13 @@ var ObsidianLauncher = class {
858
883
  return await this.downloadGitHubTheme(themeInfo.repo);
859
884
  }
860
885
  /**
861
- * Downloads a list of themes to the cache and returns a list of LocalThemeEntry with the downloaded paths.
886
+ * Downloads a list of themes to the cache and returns a list of `DownloadedThemeEntry` with the downloaded paths.
862
887
  * Also adds the `name` property to the plugins based on the manifest.
863
888
  *
864
889
  * You can download themes from GitHub using `{repo: "org/repo"}` and community themes using `{name: 'theme-name'}`.
865
890
  * Local themes will just be passed through.
891
+ *
892
+ * @param themes List of themes to download
866
893
  */
867
894
  async downloadThemes(themes) {
868
895
  return await Promise.all(
@@ -900,15 +927,20 @@ var ObsidianLauncher = class {
900
927
  throw Error(`${themePath}/manifest.json malformed.`);
901
928
  }
902
929
  }
903
- const enabled = typeof theme == "string" ? true : theme.enabled;
930
+ let enabled;
931
+ if (typeof theme == "string") {
932
+ enabled = true;
933
+ } else {
934
+ enabled = _nullishCoalesce(theme.enabled, () => ( true));
935
+ }
904
936
  return { path: themePath, name: themeName, enabled, originalType };
905
937
  })
906
938
  );
907
939
  }
908
940
  /**
909
- * Installs plugins into an Obsidian vault.
910
- * @param vault Path to the vault to install the plugin in.
911
- * @param plugins List plugins paths to install.
941
+ * Installs plugins into an Obsidian vault
942
+ * @param vault Path to the vault to install the plugins in
943
+ * @param plugins List plugins to install
912
944
  */
913
945
  async installPlugins(vault, plugins) {
914
946
  const downloadedPlugins = await this.downloadPlugins(plugins);
@@ -958,9 +990,9 @@ var ObsidianLauncher = class {
958
990
  }
959
991
  }
960
992
  /**
961
- * Installs themes into an obsidian vault.
962
- * @param vault Path to the theme to install the plugin in.
963
- * @param themes: List of themes to install.
993
+ * Installs themes into an Obsidian vault
994
+ * @param vault Path to the theme to install the themes in
995
+ * @param themes List of themes to install
964
996
  */
965
997
  async installThemes(vault, themes) {
966
998
  const downloadedThemes = await this.downloadThemes(themes);
@@ -998,13 +1030,13 @@ var ObsidianLauncher = class {
998
1030
  }
999
1031
  }
1000
1032
  /**
1001
- * Sets up the config dir to use for the --user-data-dir in obsidian. Returns the path to the created config dir.
1033
+ * Sets up the config dir to use for the `--user-data-dir` in obsidian. Returns the path to the created config dir.
1002
1034
  *
1003
- * @param appVersion Obsidian version string.
1004
- * @param installerVersion Obsidian version string.
1005
- * @param appPath Path to the asar file to install. Will download if omitted.
1006
- * @param vault Path to the vault to open in Obsidian.
1007
- * @param dest Destination path for the config dir. If omitted it will create it under `/tmp`.
1035
+ * @param params.appVersion Obsidian app version (see {@link resolveVersions} for format)
1036
+ * @param params.installerVersion Obsidian version string.
1037
+ * @param params.appPath Path to the asar file to install. Will download if omitted.
1038
+ * @param params.vault Path to the vault to open in Obsidian.
1039
+ * @param params.dest Destination path for the config dir. If omitted it will create a temporary directory.
1008
1040
  */
1009
1041
  async setupConfigDir(params) {
1010
1042
  const [appVersion, installerVersion] = await this.resolveVersions(params.appVersion, params.installerVersion);
@@ -1018,6 +1050,9 @@ var ObsidianLauncher = class {
1018
1050
  // prevents the changelog page on boot
1019
1051
  };
1020
1052
  if (params.vault !== void 0) {
1053
+ if (!await fileExists(params.vault)) {
1054
+ throw Error(`Vault path ${params.vault} doesn't exist.`);
1055
+ }
1021
1056
  const vaultId = _crypto2.default.randomBytes(8).toString("hex");
1022
1057
  obsidianJson = {
1023
1058
  ...obsidianJson,
@@ -1049,17 +1084,17 @@ var ObsidianLauncher = class {
1049
1084
  /**
1050
1085
  * Sets up a vault for Obsidian, installing plugins and themes and optionally copying the vault to a temporary
1051
1086
  * directory first.
1052
- * @param vault Path to the vault to open in Obsidian.
1053
- * @param copy Whether to copy the vault to a tmpdir first. Default false.
1054
- * @param plugins List of plugins to install in the vault.
1055
- * @param themes List of themes to install in the vault.
1087
+ * @param params.vault Path to the vault to open in Obsidian
1088
+ * @param params.copy Whether to copy the vault to a tmpdir first. Default false
1089
+ * @param params.plugins List of plugins to install in the vault
1090
+ * @param params.themes List of themes to install in the vault
1056
1091
  * @returns Path to the copied vault (or just the path to the vault if copy is false)
1057
1092
  */
1058
1093
  async setupVault(params) {
1059
1094
  let vault = params.vault;
1060
1095
  if (params.copy) {
1061
1096
  const dest = await makeTmpDir("obs-launcher-vault-");
1062
- await _promises2.default.cp(vault, dest, { recursive: true });
1097
+ await _promises2.default.cp(vault, dest, { recursive: true, preserveTimestamps: true });
1063
1098
  vault = dest;
1064
1099
  }
1065
1100
  await this.installPlugins(vault, _nullishCoalesce(params.plugins, () => ( [])));
@@ -1070,20 +1105,24 @@ var ObsidianLauncher = class {
1070
1105
  * Downloads and launches Obsidian with a sandboxed config dir and a specifc vault open. Optionally install plugins
1071
1106
  * and themes first.
1072
1107
  *
1073
- * This is just a shortcut for calling downloadApp, downloadInstaller, setupVault and setupConfDir.
1108
+ * This is just a shortcut for calling `downloadApp`, `downloadInstaller`, `setupVault` and `setupConfDir`.
1074
1109
  *
1075
- * @param appVersion Obsidian version string.
1076
- * @param installerVersion Obsidian version string.
1077
- * @param vault Path to the vault to open in Obsidian.
1078
- * @param copy Whether to copy the vault to a tmpdir first. Default false.
1079
- * @param plugins List of plugins to install in the vault.
1080
- * @param themes List of themes to install in the vault.
1081
- * @param args CLI args to pass to Obsidian
1082
- * @param spawnOptions Options to pass to `spawn`.
1083
- * @returns The launched child process and the created tmpdirs.
1110
+ * @param params.appVersion Obsidian app version (see {@link resolveVersions} for format). Default "latest"
1111
+ * @param params.installerVersion Obsidian installer version (see {@link resolveVersions} for format).
1112
+ * Default "latest"
1113
+ * @param params.vault Path to the vault to open in Obsidian
1114
+ * @param params.copy Whether to copy the vault to a tmpdir first. Default false
1115
+ * @param params.plugins List of plugins to install in the vault
1116
+ * @param params.themes List of themes to install in the vault
1117
+ * @param params.args CLI args to pass to Obsidian
1118
+ * @param params.spawnOptions Options to pass to `spawn`
1119
+ * @returns The launched child process and the created tmpdirs
1084
1120
  */
1085
1121
  async launch(params) {
1086
- const [appVersion, installerVersion] = await this.resolveVersions(params.appVersion, params.installerVersion);
1122
+ const [appVersion, installerVersion] = await this.resolveVersions(
1123
+ _nullishCoalesce(params.appVersion, () => ( "latest")),
1124
+ _nullishCoalesce(params.installerVersion, () => ( "latest"))
1125
+ );
1087
1126
  const appPath = await this.downloadApp(appVersion);
1088
1127
  const installerPath = await this.downloadInstaller(installerVersion);
1089
1128
  let vault = params.vault;
@@ -1197,6 +1236,8 @@ var ObsidianLauncher = class {
1197
1236
  }
1198
1237
  /**
1199
1238
  * Returns true if the Obsidian version is already in the cache.
1239
+ * @param type on of "app" or "installer"
1240
+ * @param version Obsidian app/installer version (see {@link resolveVersions} for format)
1200
1241
  */
1201
1242
  async isInCache(type, version) {
1202
1243
  version = (await this.getVersionInfo(version)).version;
@@ -1210,8 +1251,9 @@ var ObsidianLauncher = class {
1210
1251
  return await fileExists(_path2.default.join(this.cacheDir, dest));
1211
1252
  }
1212
1253
  /**
1213
- * Returns true if we either have the credentails to download the version or it's already in cache.
1254
+ * Returns true if we either have the credentials to download the version or it's already in cache.
1214
1255
  * This is only relevant for Obsidian beta versions, as they require Obsidian insider credentials to download.
1256
+ * @param version Obsidian version (see {@link resolveVersions} for format)
1215
1257
  */
1216
1258
  async isAvailable(version) {
1217
1259
  const versionInfo = await this.getVersionInfo(version);
@@ -1229,4 +1271,4 @@ var ObsidianLauncher = class {
1229
1271
 
1230
1272
 
1231
1273
  exports.ObsidianLauncher = ObsidianLauncher;
1232
- //# sourceMappingURL=chunk-E67WPRVZ.cjs.map
1274
+ //# sourceMappingURL=chunk-D3Z4H7XZ.cjs.map