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 ๐Ÿ™

ยฉ 2024 โ€“ย Pkg Stats / Ryan Hefner

@extension-kid/core

v0.2.4

Published

๐Ÿ‘ฉโ€๐Ÿ”ฌ Please be aware that this package is still experimental โ€” changes to the interface and underlying implementation are likely, and future development or maintenance is not guaranteed.

Downloads

5

Readme

Extension Kid ๐Ÿ‘ถ Build Status

๐Ÿ‘ฉโ€๐Ÿ”ฌ Please be aware that this package is still experimental โ€” changes to the interface and underlying implementation are likely, and future development or maintenance is not guaranteed.


Acknowledgments

The Framework is based and heavily inspired by the internal package system used in Theia IDE. Precisely @theia/core package version v0.3.7. The version was distributed under Apache 2.0 license.

Expected knowledge

Developer is expected to have prior knowledge of inversify.js and Dependency Injection pattern.

Key Concepts

The framework provides a way of modularizing applications. It brings two key concepts: Service and Extension.

Service

Service represents a place of your app you'd like to have extendable. Service has a named ExtensionProvider and expects its extensions to implement a certain interface.

export const MyServiceExtension = Symbol("MyServiceExtension");

export interface IMyServiceExtension {
  // ...
}

@injectable
export class MyService {
  constructor(
    @inject(ExtensionProvider)
    @named(MyServiceExtension)
    extensionProvider: ExtensionProvider
  ) {
    this._extensionProvider = extensionProvider;
  }
}

The Framework comes with one service Application.

Extension

Piece of code that implements interface of a specific Service

export class MyExtension implements IMyServiceExtension {
  // ...
}

Extensions are meant to be bound to an ExtensionProvider.

ExtensionProvider

Extension provider holds references to a container and a service identifier. The purpose of the provider is to fetch extensions from the container named after the service identifier.

Unless you need a very specific behavior from an extension provider you are highly encouraged to use the provided implementation. Otherwise you're free to implement your own provider.

To bind an extension provider to a service identifier use bindExtensionProvider helper:

new ContainerModule(bind => {
  bindExtensionProvider(bind, MyServiceExtension);
});

then you can simply bind extensions to the provider:

new ContainerModule(bind => {
  bind(MyServiceExtension).to(MyExtension1);
  bind(MyServiceExtension).to(MyExtension2);
});

Container

Extends inversify.js Container and wraps EventEmitter. The container emits events on every bind, unbind and rebind method calls.

ExtensionProvider uses this feature to expose observable interface, so that your service can be notified every time a new extension is being bound to the container.

Packages

Package resolver (TBD)

There's no package resolver mechanism in place yet.

Authoring a package

Typical package consists of one or several Extensions.

The default export of a package should be a factory function that accepts one argument context and returns a ContainerModule.

export default _context => {
  return new ContainerModule(bind => {
    // Do all the bindings you need here
  });
};

context argument is optional and will be used by the resolver (TBD) to parameterize the package. There's no more information currently, we just would like to establish the interface so that nobody will have to adjust their packages in the future.

Loading packages into your application

As there's no resolver yet, you should figure out the way of loading all your packages either at compile time or runtime or both.

At compile time in your application's composition root you can import packages and load them into a container.

import extensionFramework, { Container } from "extension-kid";
import packageFactory from "your-package";

const container = new Container();

container.load(extensionsFramework);

const package = packageFactory();
container.load(package);

export default container;