@acryldev/blends-frame 0.2.6 → 0.2.7

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.
@@ -4,7 +4,7 @@
4
4
  * `extensions` row finds it). `blend.yaml` is edited by lines, so its comments and layout stay as the person wrote them. The running app takes a
5
5
  * switch when its Loader row (`app-plugins`) loads again, which the client asks for.
6
6
  */
7
- import { type PublishGitPort, type RepositoryHostPort } from '@acryldev/plugin-hub-core';
7
+ import { type Placement, type PublishGitPort, type RepositoryHostPort } from '@acryldev/plugin-hub-core';
8
8
  import { type AppPluginView, type FramePluginState, type FramePluginView, type SavedPluginResult, type SavedPluginView, type ShareVisibility, type SharedPluginView, type SharePlan } from './contract.ts';
9
9
  /** One row of `blend.yaml`'s `spec.rows`: where its block starts and ends (line indexes, end exclusive). */
10
10
  export interface BlendRow {
@@ -81,7 +81,7 @@ export declare function frameRowState(row: FrameRow): FramePluginState;
81
81
  export declare function readFramePlugins(root: string, rows: readonly FrameRow[]): Promise<FramePluginView[]>;
82
82
  /** The package.json a local plugin is shared with: the fields the builder's package_plugin writes (plugins/builder/index.ts), plus the Loader
83
83
  * patch the plugin-hub's share requires so the package can also be installed as a row. */
84
- export declare function pluginPackageManifest(name: string, description: string, version?: string, license?: string): Record<string, unknown>;
84
+ export declare function pluginPackageManifest(name: string, description: string, version?: string, license?: string, placement?: Placement): Record<string, unknown>;
85
85
  /**
86
86
  * The shares this app completed, from its own home (`shared-plugins.json`). The record is written only after the hub's whole share succeeded: a
87
87
  * package.json can name a repository before the release exists, because the hub prepares it before its guards, and a refused share must not look
@@ -93,7 +93,7 @@ export declare function recordShare(file: string, name: string, shared: SharedPl
93
93
  /** Where the frame packages the plugins it shares: under the app's home, never in the app's folder, so a share leaves no file to save. */
94
94
  export declare const pluginPackagesOf: (home: string) => string;
95
95
  /** Copy one local plugin into its package folder under `packages`, the way the builder's package_plugin does; answers the folder. */
96
- export declare function packageAppPlugin(root: string, name: string, packages: string, license?: string): Promise<string>;
96
+ export declare function packageAppPlugin(root: string, name: string, packages: string, license?: string, placement?: Placement): Promise<string>;
97
97
  /** Bump one package folder's patch version (what the hub asks for after a release), and answer the new version. */
98
98
  export declare function bumpPackageVersion(dir: string): Promise<string>;
99
99
  /**
package/lib/client.js CHANGED
@@ -237,13 +237,18 @@ window.__ModuleLoader__.load({
237
237
  /** @throws when the value is not a share plan. */
238
238
  function parseSharePlan(value) {
239
239
  if (!isRecord$5(value)) throw new Error("share plan: not a plan");
240
- const { owner, repo, version, visibility, createsRepository, released, license, registry } = value;
240
+ const { owner, repo, version, visibility, createsRepository, released, license, registry, placement } = value;
241
241
  if (typeof owner !== "string" || !GITHUB_NAME.test(owner) || typeof repo !== "string" || !GITHUB_NAME.test(repo)) throw new Error("share plan: repository");
242
242
  if (typeof version !== "string" || version === "" || released !== void 0 && (typeof released !== "string" || released === "")) throw new Error("share plan: version");
243
243
  if (visibility !== "private" && visibility !== "public" || typeof createsRepository !== "boolean") throw new Error("share plan: visibility");
244
244
  if (license !== void 0 && (typeof license !== "string" || !/^[A-Za-z0-9.+-]+$/u.test(license))) throw new Error("share plan: license");
245
245
  if (registry !== void 0 && typeof registry !== "boolean") throw new Error("share plan: registry");
246
246
  if (registry === true && visibility !== "public") throw new Error("share plan: only a public share can be listed in the registry");
247
+ const place = placement === void 0 ? void 0 : isRecord$5(placement) && typeof placement.category === "string" && (placement.subcategory === void 0 || typeof placement.subcategory === "string") ? {
248
+ category: placement.category,
249
+ ...typeof placement.subcategory === "string" ? { subcategory: placement.subcategory } : {}
250
+ } : null;
251
+ if (place === null) throw new Error("share plan: placement");
247
252
  return {
248
253
  owner,
249
254
  repo,
@@ -252,7 +257,8 @@ window.__ModuleLoader__.load({
252
257
  createsRepository,
253
258
  ...released === void 0 ? {} : { released },
254
259
  ...license === void 0 ? {} : { license },
255
- ...registry === true ? { registry } : {}
260
+ ...registry === true ? { registry } : {},
261
+ ...place === void 0 ? {} : { placement: place }
256
262
  };
257
263
  }
258
264
  /** @throws when the value is not what a save answers. */
@@ -17621,7 +17627,8 @@ window.__ModuleLoader__.load({
17621
17627
  shareSentence(plan),
17622
17628
  `Repository: ${plan.owner}/${plan.repo} on GitHub (${plan.createsRepository ? "a new one" : "it exists"}), ${plan.visibility}`,
17623
17629
  ...plan.license === void 0 ? [] : [`License: ${plan.license}`],
17624
- ...plan.registry === true ? ["Topic: cordis-plugin, which cordisplugins.github.io lists within about an hour"] : []
17630
+ ...plan.registry === true ? ["Topic: cordis-plugin, which cordisplugins.github.io lists within about an hour"] : [],
17631
+ ...plan.placement === void 0 ? [] : [`Category: ${plan.placement.category}${plan.placement.subcategory === void 0 ? "" : ` › ${plan.placement.subcategory}`}, where this app is in the Blends store`]
17625
17632
  ];
17626
17633
  }
17627
17634
  const DAY_MS = 864e5;