@grafana/plugin-meta-extractor

中文文档
0.13.0发布于 2026/05/29Apache-2.0TypeScriptCommonJS构建来源已验证近 30 天下载 7967

Extract meta information from a Grafana plugin source code.

原始使用文档
文档目录5 节
  1. Install
  2. Usage
  3. Returned data format
  4. Plugin support
  5. Contributing

Grafana / Plugin Meta Extractor

[!WARNING]
This is an experimental project and may change at any time. It is not yet used in any of our tools and does not reliably work with most of our app plugin implementation patterns.

@grafana/plugin-meta-extractor is a cli tool that can be used to extract meta-information from the source code of a Grafana plugin. It is used to generate plugin metadata without the need for manual intervention, which is then used by the Grafana application to understand features or functionalities a plugin supports or uses.

Install

npm install @grafana/plugin-meta-extractor --save-dev

Usage

With Webpack

The package exposes a webpack plugin that can be used to generate plugin meta-information on every build based on the source code. The plugin adds additional information to the plugin.json file by overriding the generated property in the JSON.

// webpack.config.ts
// -----------------

import { GrafanaPluginMetaExtractor } from '@grafana/plugin-meta-extractor';

export default {
  // ...
  plugins: [
    new GrafanaPluginMetaExtractor(),
    // ...
  ],
};

In code

The package exposes the methods for extracting the meta-data so they can be used manually:

import { extractPluginMeta } from '@grafana/plugin-meta-extractor';

const entryPoint = `${PLUGIN_ROOT}/src/module.ts`;
const pluginMeta = extractPluginMeta(entryPoint);

CLI

By calling the binary against a (module.ts|tsx) file, the package will print out the extracted meta-data to the console.

# Run local build
./dist/bin/run.js ~/my-grafana-plugin/src/module.ts

# Run latest remote version
npx @grafana/plugin-meta-extractor ~/my-grafana-plugin/src/module.ts

Returned data format

The returned meta-data is in the following format:

{
  extensions: Array<{
    type: "link" | "component",
    extensionPointId: string,
    title: string,
    description: string
  }>
}

Plugin support

This package requires the module.(ts|tsx) to be in a certain format to be able to parse it (we are planning to improve on this in the future). The method calls for registering extensions have to be in the module.(ts|tsx), and they need to be called on the AppPlugin instance in a "chained" manner:

// src/module.ts
export const plugin = new AppPlugin<{}>()
  .setRootPage(App)
  .configureExtensionLink<PluginExtensionPanelContext>({
    // ...
  })
  .configureExtensionLink<PluginExtensionPanelContext>({
    // ...
  });

Contributing

We are always grateful for contributions! See CONTRIBUTING.md for more information.

版本与发布记录

@grafana/plugin-meta-extractor 共发布 245 个版本,首次发布于 2024/04/24;过去 12 个月发布了 43 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.13.0latest2026/05/295 个月前
0.12.32026/05/265 个月前
0.12.3-canary.2646.26441606068.0canary2026/05/265 个月前
0.13.0-canary.2621.26422794927.02026/05/265 个月前
0.13.0-canary.2621.26391095667.02026/05/255 个月前
0.13.0-canary.2621.26390068377.02026/05/255 个月前

关于 @grafana/plugin-meta-extractor 的常见问题

@grafana/plugin-meta-extractor 是什么?

Extract meta information from a Grafana plugin source code.

如何安装 @grafana/plugin-meta-extractor?

在项目目录运行 npm install @grafana/plugin-meta-extractor,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 plugin-meta-extractor,可以用 npx plugin-meta-extractor 直接运行。

@grafana/plugin-meta-extractor 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@grafana/plugin-meta-extractor 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@grafana/plugin-meta-extractor 可以商用吗?

@grafana/plugin-meta-extractor 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@grafana/plugin-meta-extractor 的下载量有多少?

根据 npm 官方下载统计,@grafana/plugin-meta-extractor 在 2026/10/17 – 2026/11/15 这 30 天内被下载 7,967 次,日均约 266 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@grafana/plugin-meta-extractor 还在维护吗?

最新版本 0.13.0 发布于 2026/05/29(5 个月前);至今共发布 245 个版本,其中过去 12 个月发布了 43 个;首次发布于 2024/04/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。