dsh-mobile 0.3.13 → 0.3.14

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/lib/index.mjs CHANGED
@@ -7913,7 +7913,9 @@ var CpolarComponentManager = class {
7913
7913
  const PACKAGE_NAME = "dsh-mobile";
7914
7914
  const NPM_LATEST_URL = "https://registry.npmjs.org/dsh-mobile/latest";
7915
7915
  const GITHUB_LATEST_URL = "https://github.com/saya-ch/dsh-mobile/releases/latest";
7916
+ const GITHUB_API_LATEST_URL = "https://api.github.com/repos/saya-ch/dsh-mobile/releases/latest";
7916
7917
  const GITHUB_RELEASES_URL = "https://github.com/saya-ch/dsh-mobile/releases";
7918
+ const RELEASE_NOTES_MAX_CHARS = 4e3;
7917
7919
  const STATUS_CACHE_MS = 6e5;
7918
7920
  const REQUEST_TIMEOUT_MS = 8e3;
7919
7921
  const UPDATE_TIMEOUT_MS = 12e4;
@@ -8053,6 +8055,21 @@ async function fetchAndroidVersion(fetcher) {
8053
8055
  });
8054
8056
  return githubReleaseVersion(response.headers.get("location"), response.url);
8055
8057
  }
8058
+ /** Best-effort body of the latest GitHub release, trimmed to a bounded size. */
8059
+ async function fetchReleaseNotes(fetcher) {
8060
+ const response = await fetcher(GITHUB_API_LATEST_URL, {
8061
+ headers: {
8062
+ accept: "application/vnd.github+json",
8063
+ "user-agent": "dsh-mobile-release-check"
8064
+ },
8065
+ signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
8066
+ });
8067
+ if (!response.ok) return void 0;
8068
+ const payload = await response.json();
8069
+ if (typeof payload.body !== "string") return void 0;
8070
+ const notes = payload.body.trim();
8071
+ return notes === "" ? void 0 : notes.slice(0, RELEASE_NOTES_MAX_CHARS);
8072
+ }
8056
8073
  async function readProfileInstalledVersion(profileDirectory) {
8057
8074
  try {
8058
8075
  const manifestPath = createRequire(join(profileDirectory, "package.json")).resolve(`${PACKAGE_NAME}/package.json`);
@@ -8245,9 +8262,14 @@ var PluginReleaseManager = class {
8245
8262
  async status(force = false) {
8246
8263
  if (!force && this.cache !== void 0 && this.cache.expiresAt > this.now()) return this.cache.status;
8247
8264
  const updateSupported = isRegistryPluginSpec(this.profileDirectory === void 0 ? void 0 : await profileDependencySpec(this.profileDirectory));
8248
- const [npmResult, androidResult] = await Promise.allSettled([fetchNpmVersion(this.fetcher), fetchAndroidVersion(this.fetcher)]);
8265
+ const [npmResult, androidResult, notesResult] = await Promise.allSettled([
8266
+ fetchNpmVersion(this.fetcher),
8267
+ fetchAndroidVersion(this.fetcher),
8268
+ fetchReleaseNotes(this.fetcher)
8269
+ ]);
8249
8270
  const latestVersion = npmResult.status === "fulfilled" ? npmResult.value : void 0;
8250
8271
  const androidVersion = androidResult.status === "fulfilled" ? androidResult.value : void 0;
8272
+ const releaseNotes = notesResult.status === "fulfilled" ? notesResult.value : void 0;
8251
8273
  const comparison = latestVersion === void 0 ? void 0 : comparePluginVersions(latestVersion, this.installedVersion);
8252
8274
  const status = Object.freeze({
8253
8275
  installedVersion: this.installedVersion,
@@ -8255,7 +8277,8 @@ var PluginReleaseManager = class {
8255
8277
  updateAvailable: updateSupported && comparison === 1,
8256
8278
  updateSupported,
8257
8279
  ...androidVersion === void 0 ? {} : { androidVersion },
8258
- androidDownloadUrl: androidReleaseDownloadUrl(androidVersion)
8280
+ androidDownloadUrl: androidReleaseDownloadUrl(androidVersion),
8281
+ ...releaseNotes === void 0 ? {} : { releaseNotes }
8259
8282
  });
8260
8283
  this.cache = {
8261
8284
  expiresAt: this.now() + STATUS_CACHE_MS,