Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する

Overview


The @blocklet/meta library is a foundational package within the Blocklet ecosystem. It provides the tools to define, parse, validate, and manage the metadata for any Blocklet. This library serves two primary functions: it establishes the formal specification for the blocklet.yml manifest file and offers a comprehensive set of utility functions for interacting with Blocklet metadata and runtime state programmatically.


The blocklet.yml Specification#

The blocklet.yml file is the central manifest for a Blocklet, analogous to package.json in a Node.js project. It's a declarative YAML file that defines everything about the Blocklet. The formal schema, defined using the Joi validation library, ensures that all Blocklets across the ecosystem are structured consistently, enabling interoperability between Blocklet Server, registries, and developer tools.

Key sections of the specification include:

Core Metadata

The Blocklet's unique identifier (did), name, version, title, and description.

Execution & Environment

How the Blocklet runs, specified by its engine, runtime requirements, lifecycle scripts, and environment variables.

Interfaces & Services

How the Blocklet exposes itself to the web and other services, defining UIs, API endpoints, and service ports.

Composition

How a Blocklet is built from other Blocklets (components), enabling complex, modular applications.

UI & Theming

Definitions for navigation entries and theme properties that integrate the Blocklet's UI into the broader user experience.

Monetization & Security

Pricing rules, revenue-sharing configurations, and cryptographic signatures to ensure metadata integrity.

The Utility Library#

Beyond the specification, @blocklet/meta exports a rich set of JavaScript/TypeScript functions for developers and tools to work with Blocklet metadata and state. These utilities provide the core logic for the Blocklet Command Line Interface (CLI) and Blocklet Server, handling tasks from installation and dependency resolution to runtime configuration and state management.

Category

Key Functions

Description

Parsing & Validation

parse, validateMeta

Read, fix, and validate blocklet.yml files from the filesystem.

Component & State

forEachBlocklet, findComponent, isRunning

Traverse component trees, find specific components, and inspect runtime statuses.

DID & Wallet

toBlockletDid, getBlockletWallet, getPermanentDid

Generate Blocklet-specific Decentralized Identifiers (DIDs) and manage associated wallets.

Security

signResponse, verifyResponse, verifyMultiSig

Perform cryptographic operations like signing and verifying data to ensure authenticity.

File System

list, select, update, read

Programmatically find and manipulate blocklet.yml files.


Whether you are developing a new Blocklet, building tools for the ecosystem, or integrating Blocklet capabilities into your platform, the @blocklet/meta library is your starting point. Begin by exploring the Getting Started guide to parse your first blocklet.yml file.