acrylblends 1.3.2 → 1.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/dist/index.d.ts CHANGED
@@ -163,7 +163,7 @@ export declare function libraryRoot(): string;
163
163
  /** Every plugin in the library, by name. */
164
164
  export declare function readLibrary(root?: string): Map<string, LibraryPlugin>;
165
165
  /** The plugins to copy for `names`: each one after everything it requires, no duplicates. */
166
- export declare function closure(names: readonly string[], library: Map<string, LibraryPlugin>): LibraryPlugin[];
166
+ export declare function closure(names: readonly string[], library: ReadonlyMap<string, LibraryPlugin>): LibraryPlugin[];
167
167
  /** Copy one library plugin's source into `<app>/plugins/<name>/`. Throws when that folder already exists. */
168
168
  export declare function copyPlugin(plugin: LibraryPlugin, appDir: string, root?: string): string;
169
169
  //#endregion
package/dist/index.js CHANGED
@@ -2027,6 +2027,12 @@ const MOUNTED = [
2027
2027
  name: "feedback",
2028
2028
  local: "feedback",
2029
2029
  needs: ["acryl-router"]
2030
+ },
2031
+ {
2032
+ name: "showcase",
2033
+ local: "showcase",
2034
+ needs: ["plugin-share"],
2035
+ after: "plugin-share"
2030
2036
  }
2031
2037
  ];
2032
2038
  /** A row, in either line ending: a file edited on Windows (or checked out with core.autocrlf) is still a Blend. */
@@ -3489,6 +3495,8 @@ function carriedCopies(dir) {
3489
3495
  }
3490
3496
  /** The plugins the frame's host layer mounts by path: any framed app carries them, and an app made before the frame gets them here. */
3491
3497
  const HOST_PLUGINS = ["acryl-web-server", "acryl-page"];
3498
+ /** A library plugin a scaffold file imports: `from '../plugins/<name>/...'`. */
3499
+ const PLUGIN_IMPORT = /from '\.\.\/plugins\/([^/']+)\//gu;
3492
3500
  /** The profile script the DSH-profile layout used; the host launcher replaced it, so an app upgraded from that layout drops it. */
3493
3501
  const OLD_PROFILE_SCRIPT = "scripts/ide-profile.mjs";
3494
3502
  /**
@@ -3572,13 +3580,14 @@ function planFrameStep(appDir, library, templateDirFor = templateDir) {
3572
3580
  state: generatedState(existsSync(path) ? readText(path) : void 0, rows.appPlugins)
3573
3581
  });
3574
3582
  }
3575
- const hostPlugins = HOST_PLUGINS.filter((plugin) => library.has(plugin) && !existsSync(join(appDir, "plugins", plugin)));
3583
+ const imported = files.filter((file) => file.file.endsWith(".ts")).flatMap((file) => [...file.text.matchAll(PLUGIN_IMPORT)].map((match) => match[1]));
3584
+ const addedPlugins = closure([.../* @__PURE__ */ new Set([...HOST_PLUGINS, ...imported])].filter((plugin) => library.has(plugin)), library).map((plugin) => plugin.name).filter((plugin) => !existsSync(join(appDir, "plugins", plugin)));
3576
3585
  const oldScript = join(appDir, OLD_PROFILE_SCRIPT);
3577
3586
  const removeProfileScript = existsSync(oldScript) && GENERATED_MARKER.test(readText(oldScript).split("\n", 1)[0] ?? "");
3578
3587
  const input = frameProfileInput(specs, name, rows.rows);
3579
3588
  const profile = planIdeProfileWrite(appDir, input);
3580
3589
  const conflicts = [...files.filter((file) => file.state === "conflict").map((file) => file.file), ...profile.files.filter((file) => file.state === "conflict").map((file) => file.file)];
3581
- const changed = files.some((file) => file.state !== "same") || profile.manifestChanged || profile.files.some((file) => file.state !== "same") || hostPlugins.length > 0 || removeProfileScript;
3590
+ const changed = files.some((file) => file.state !== "same") || profile.manifestChanged || profile.files.some((file) => file.state !== "same") || addedPlugins.length > 0 || removeProfileScript;
3582
3591
  return {
3583
3592
  kind: "planned",
3584
3593
  template,
@@ -3586,7 +3595,7 @@ function planFrameStep(appDir, library, templateDirFor = templateDir) {
3586
3595
  profile,
3587
3596
  files,
3588
3597
  kept,
3589
- hostPlugins,
3598
+ addedPlugins,
3590
3599
  removeProfileScript,
3591
3600
  conflicts,
3592
3601
  ...conflictLines === void 0 ? {} : { conflictLines },
@@ -3603,7 +3612,7 @@ function frameReport(frame) {
3603
3612
  for (const file of frame.files) if (file.state !== "same") parts.push(`${file.file} ${file.state === "update" ? "updated" : "added"}`);
3604
3613
  for (const file of frame.profile.files) if (file.state !== "same") parts.push(`${file.file} ${file.state === "update" ? "updated" : "added"}`);
3605
3614
  if (frame.profile.clientRowsAdded.length > 0) parts.push(`scripts/ide-host.mjs client rows added (${frame.profile.clientRowsAdded.join(", ")})`);
3606
- for (const plugin of frame.hostPlugins) parts.push(`plugins/${plugin} added`);
3615
+ for (const plugin of frame.addedPlugins) parts.push(`plugins/${plugin} added`);
3607
3616
  if (frame.removeProfileScript) parts.push(`${OLD_PROFILE_SCRIPT} removed`);
3608
3617
  if (frame.profile.manifestChanged) parts.push("package.json merged (dev runs scripts/ide-host.mjs)");
3609
3618
  for (const { file, mountable } of frame.kept) if (!mountable) parts.push(`${file} kept as the app's (edited): it does not export FRAME_MOUNT_PREFIX, so the frame cannot show the app until it does (a fresh app's ${file} shows how)`);
@@ -3777,7 +3786,7 @@ async function upgrade(options, io) {
3777
3786
  cpSync(join(appDir, file.file), join(backup, file.file));
3778
3787
  frameBackups += 1;
3779
3788
  }
3780
- for (const plugin of frame.hostPlugins) {
3789
+ for (const plugin of frame.addedPlugins) {
3781
3790
  const known = library.get(plugin);
3782
3791
  if (known === void 0) continue;
3783
3792
  copyPlugin(known, appDir);