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

@pnp/modern-search-extensibility

v2.0.1

Published

Base library for creating PnP Modern Search extensions

Readme

PnP Search Extensibility library

PnP Modern Search uses the concept of 'extensibility libraries'. These are SharePoint Framework library components you put in the global or site collection app catalog that will be loaded automatically by Web Parts to enhance the experience and options (ex: new data source with new options, custom layout, etc.). Simple as that!

Get started

More information to get started can be found in the documentation for PnP Moderns Search at https://microsoft-search.github.io/pnp-modern-search/extensibility/.

v2.0.0 — Slim package (decoupled from SPFx)

Starting with v2.0.0, this package has zero @microsoft/sp-* runtime dependencies. SPFx types used in base classes (ServiceScope, WebPartContext, etc.) are typed as any, and any SPFx-specific behavior the base classes used to auto-perform is now opt-in.

Why

You can now consume this package from a library built against any SPFx version (1.18.2, 1.21.1, 1.22.x, ...) without npm peer-dep conflicts. Combined with the runtime cross-version manifest patcher in search-parts, extensions built against an older SPFx now load on pages running a newer SPFx version.

Migration from v1.x

In most cases no code changes are required — existing extensions compile and run as-is because they already import SPFx types directly from @microsoft/sp-* packages. Specific changes to be aware of:

| Area | v1.x | v2.0.0 | Action | |---|---|---|---| | Base class context types | BaseDataSource<T> with context: any | BaseDataSource<T, TContext = any> | None required. Optionally pass WebPartContext as the second generic for full intellisense. | | Constructor signature | (serviceScope: ServiceScope) | (serviceScope: any) | None — any is assignable from anything. | | BaseWebComponent._serviceScope | typed as ServiceScope | typed as any | None. Continue calling _serviceScope.consume(MyServiceKey) — works identically at runtime. Cast if you want types: (this._serviceScope as ServiceScope).consume(...). | | BaseWebComponent theme | Auto-consumed ThemeProvider from _serviceScope and set props.themeVariant | Removed. Theme is opt-in. | If you relied on auto-theme, either (a) pass data-theme-variant='{{JSONstringify @root.theme}}' from the Handlebars template, or (b) override getThemeVariant() in your web component and consume ThemeProvider.serviceKey from _serviceScope yourself. | | BaseWebComponent._moment | held a moment library instance (internal use) | Renamed to _dayjs (now a dayjs instance). Both were marked "INTERNAL USE ONLY". | If you accessed _moment directly (against advice), use this._serviceScope.consume(DateHelper.serviceKey) instead. | | Web component polyfill | Pulled in transitively via SPFx deps | Direct dep on @webcomponents/custom-elements ^1.6.0 | None — auto-included. | | Public exports (index.ts) | n/a | Identical to v1.18.2 | None. |

Optional generic typing (recommended for new code)

import { BaseDataSource } from '@pnp/modern-search-extensibility';
import { WebPartContext } from '@microsoft/sp-webpart-base';

export class MyDataSource extends BaseDataSource<IMyProps, WebPartContext> {
    public async getData() {
        // `this.context` is now typed as WebPartContext — full intellisense
        const url = this.context.pageContext.web.absoluteUrl;
        // ...
    }
}

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

"Sharing is Caring"

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.