@acryldev/launcher-desktop 0.1.3 → 0.1.5

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.js CHANGED
@@ -47,8 +47,8 @@ function webboxesDeployUrl(github, name) {
47
47
  return url.href;
48
48
  }
49
49
  /** A Blend id as `acryl new --from` takes it: it starts with a letter or digit, so it can never read as an option. */
50
- /** The New WebBox page of webboxes.ai, which takes `github` and `name` to fill its form. */
51
- const WEBBOXES_NEW_BOX = "https://webboxes.ai/dashboard/webboxes/new";
50
+ /** WebBoxes.ai's WebBoxes page: with `github` (a public https://github.com/owner/repo) and `name` it opens the New WebBox form filled in. */
51
+ const WEBBOXES_NEW_BOX = "https://webboxes.ai/dashboard/webboxes";
52
52
  const BLEND_ID = /^[a-z0-9][a-z0-9._-]{0,127}$/u;
53
53
  /** A Blend released on GitHub, as `--from` takes it (create-acrylblends `github:owner/repo#ref`): what a community Blend is made from. */
54
54
  const BLEND_SOURCE = /^github:[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})\/[A-Za-z0-9._-]{1,100}(?:#[A-Za-z0-9._/-]{1,100})?$/u;
@@ -545,6 +545,8 @@ var LauncherService = class {
545
545
  #job;
546
546
  #blends;
547
547
  #signIn;
548
+ /** Apps just made whose `npm install` is running (`#install`), by id. */
549
+ #installing = /* @__PURE__ */ new Map();
548
550
  /** The tools apps need: being fetched (the first start on a computer without them), ready, or not had (apps then try the computer's own). */
549
551
  #tools = { state: "ready" };
550
552
  constructor(ports) {
@@ -592,7 +594,8 @@ var LauncherService = class {
592
594
  #view(entry) {
593
595
  const started = this.#started.get(entry.id);
594
596
  const missing = inspectApp(entry).state === "missing";
595
- const state = missing ? "missing" : started === void 0 ? "stopped" : started.address === void 0 ? "starting" : "running";
597
+ const installing = this.#installing.get(entry.id);
598
+ const state = missing ? "missing" : started === void 0 ? installing !== void 0 ? "starting" : "stopped" : started.address === void 0 ? "starting" : "running";
596
599
  const failure = this.#failures.get(entry.id);
597
600
  const blend = entry.blend === "" ? blendOf(entry.path) : entry.blend;
598
601
  const version = missing ? "" : blendVersionOf(entry.path);
@@ -610,6 +613,7 @@ var LauncherService = class {
610
613
  ...version !== "" && latest !== void 0 && newerVersion(latest, version) ? { update: latest } : {},
611
614
  ...started?.address === void 0 ? {} : { address: started.address },
612
615
  ...started === void 0 || started.address !== void 0 || started.output === "" ? {} : { output: started.output.trimEnd() },
616
+ ...started === void 0 && installing !== void 0 && installing.output !== "" ? { output: installing.output.trimEnd() } : {},
613
617
  ...failure === void 0 || state !== "stopped" ? {} : { failure },
614
618
  ...github === void 0 ? {} : { github }
615
619
  };
@@ -858,7 +862,13 @@ var LauncherService = class {
858
862
  }
859
863
  /** The plugins of a running app: the ones its people made (shareable) and the ones pulled from a registry. */
860
864
  async plugins(id) {
861
- const answer = await this.#door(id, (door, folder) => door.call(folder, "plugin-list", {}));
865
+ let answer;
866
+ try {
867
+ answer = await this.#door(id, (door, folder) => door.call(folder, "plugin-list", {}));
868
+ } catch (cause) {
869
+ if (cause instanceof LauncherRefusal && /no extensions plugin to drive/u.test(cause.message)) throw new LauncherRefusal("This app keeps its plugins in its own page: open it, then Settings > Plugins. Pulling a plugin from here needs an app made with a newer Blueprint.");
870
+ throw cause;
871
+ }
862
872
  return (Array.isArray(answer.value) ? answer.value : []).filter((plugin) => typeof plugin.name === "string").map((plugin) => ({
863
873
  name: String(plugin.name),
864
874
  version: typeof plugin.version === "string" ? plugin.version : "",
@@ -1130,6 +1140,7 @@ var LauncherService = class {
1130
1140
  }
1131
1141
  /** `npm install` in the new app's folder, as the job's second step; the job is still running while it does, and says so. */
1132
1142
  #install(appId, folder, job) {
1143
+ this.#installing.set(appId, job);
1133
1144
  job.step = "Step 2 of 3: installing its dependencies (npm install, about a minute). Next: starting it.";
1134
1145
  job.output = "";
1135
1146
  const run = this.#ports.runner({
@@ -1149,6 +1160,7 @@ var LauncherService = class {
1149
1160
  job.output = output;
1150
1161
  });
1151
1162
  run.onEnd((end) => {
1163
+ this.#installing.delete(appId);
1152
1164
  if (job.run !== run) return;
1153
1165
  if (end.notFound) {
1154
1166
  job.status = "failed";