The new package packages/plugin-sdk (@runestone/plugin-sdk) is the one source of the public plugin types. It contains PluginApi and its members, the manifest type, API_VERSION, and feature checks (hasFeature, requireFeature, requireFeatures, missingFeatures). It also contains the action icons and the tooltip helper as DOM functions, because RuneStone has no API for them. Menus stay host-drawn through api.ui.showActionMenu, so the SDK contains only the menu types. The SDK uses the Apache License 2.0. The host imports the SDK with relative paths in src/lib/plugins/sdk.ts, src/lib/ui/actionIcons.ts, and src/lib/ui/tooltip.ts. The completion, Git, background, and contribution contract files export the SDK types. The menu files keep their types, because the Terminal plugin keeps copies of them. A unit test makes sure that those types and the SDK types are the same. The menu inventory now scans the SDK source. pnpm sdk:build compiles the SDK to dist/. pnpm release:sdk --version <v> builds it, then commits and tags v<v> in a local clone of the public repository. It never pushes, and it prints the push commands. It stops before a change in these conditions: - The clone is missing, has changes, or is not on a branch. - The tag exists, or the version is not greater than the current version. - The package has no LICENSE file, or the SDK source has changes that are not committed. A failed attempt restores the version and the clone. pnpm check type checks the SDK and the example plugin. The example plugin now has JSDoc types from the SDK. pnpm test covers the feature checks, the host and SDK parity, and the release script with temporary Git repositories. The plugin development, release, development, and completion guides describe the SDK.
12 lines
703 B
TypeScript
12 lines
703 B
TypeScript
// The public types and helpers of the RuneStone plugin API.
|
|
// The icon and tooltip helpers use the DOM. Import them from "@runestone/plugin-sdk/icons" and "@runestone/plugin-sdk/tooltip".
|
|
export type * from "./api.ts";
|
|
export type * from "./backgrounds.ts";
|
|
export type * from "./completion.ts";
|
|
export type * from "./contributions.ts";
|
|
export type * from "./git.ts";
|
|
export type * from "./menu.ts";
|
|
export type { ActionIcon } from "./icons.ts";
|
|
export { API_VERSION, type PluginManifest } from "./manifest.ts";
|
|
export { describeFeature, hasFeature, missingFeatures, MissingFeatureError, pluginFeatures, requireFeature, requireFeatures, type PluginFeature, type PluginFeatures } from "./features.ts";
|