npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@storepress/get-plugin-data

v0.0.1

Published

Parse WordPress plugin file headers — a Node port of get_plugin_data() with CLI auto-detection.

Readme

@storepress/get-plugin-data

Parse WordPress plugin file headers from Node — a port of WP core's get_plugin_data() with CLI auto-detection.

CLI

Run from inside a plugin directory; it auto-detects the entry PHP file.

# Single field
npx -y @storepress/get-plugin-data Version
# 1.0.0

npx -y @storepress/get-plugin-data TextDomain
# my-plugin

# All fields as JSON (default)
npx -y @storepress/get-plugin-data

# Shell env (CI-friendly)
eval "$(npx -y @storepress/get-plugin-data --format=env)"
echo "$WP_VERSION"

# Tab-separated lines
npx -y @storepress/get-plugin-data --format=line

# Bypass auto-detect
npx -y @storepress/get-plugin-data Version --file=./my-plugin.php

# Run from elsewhere
npx -y @storepress/get-plugin-data Version --cwd=./plugins/my-plugin

Options

| Flag | Description | | ---------------- | ------------------------------------------------------------------- | | [field] | Field name to print (case-insensitive). Omit to print all. | | --cwd <path> | Directory to scan for the entry file. Defaults to process.cwd(). | | --file <path> | Parse a specific file, skipping auto-detection. | | --format <fmt> | json (default), env, or line. | | -h, --help | Show help. |

Programmatic API

import {
	getPluginData,
	getPluginDataSync,
	findPluginEntry,
	parsePluginHeader,
} from '@storepress/get-plugin-data';

// Async — read and parse a file
const data = await getPluginData( './my-plugin.php' );
// { Name: 'My Plugin', Version: '1.0.0', TextDomain: 'my-plugin', ... }

// Sync variant
const data2 = getPluginDataSync( './my-plugin.php' );

// Auto-detect entry file in a directory
const entry = await findPluginEntry( './my-plugin' );
// './my-plugin/my-plugin.php' or null

// Parse a string directly
const data3 = parsePluginHeader( phpSource );

// Custom header map (e.g. for themes or extra fields)
const data4 = parsePluginHeader( phpSource, {
	headers: {
		Name:        'Theme Name',
		ThemeURI:    'Theme URI',
		Version:     'Version',
		Template:    'Template',
	},
} );

Returned shape

Keys mirror WordPress core's get_plugin_data():

Name, PluginURI, Version, Description, Author, AuthorURI,
TextDomain, DomainPath, Network, RequiresWP, RequiresPHP,
UpdateURI, RequiresPlugins, License, LicenseURI

Missing headers come back as empty strings, matching WP's behavior.

Detection logic

The CLI scans top-level *.php files only (same scope as WP's plugin loader), prefers a file whose basename matches the directory name (the my-plugin/my-plugin.php convention), and returns the first one whose first 8KB contains a Plugin Name: header. uninstall.php, index.php shims, and helper files are filtered out naturally because they lack that header. Bundled libraries inside subdirectories are not scanned, so vendored plugin headers (e.g. ACF inside vendor/) won't be picked up. Use --file for non-standard layouts.

Why 8KB?

WordPress reads only the first 8192 bytes of a plugin file when extracting headers. This package matches that, so a plugin that "passes" here also loads in WP. A header buried below that line will fail in both places — the same way.

Github Tag

  • Push Tag git tag $(node -p "require('./package.json').version") && git push origin "$_"
  • Delete Tag git tag -d $(node -p "require('./package.json').version") && git push origin --delete "$_"

License

GPL-2.0-or-later