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

xtpoint

v2.2.0

Published

Extension Points, aka point cuts

Downloads

7

Readme

xtpoint

(based on base implementation used within the open-xchange project)

Travis npm package

development model where applications are (dynamically) composed of many different (reusable) components.

Extension Points

(borrowed from eclipse.org project) A basic rule for building modular software systems is to avoid tight coupling between components. If components are tightly integrated, it becomes difficult to assemble the pieces into different configurations or to replace a component with a different implementation without causing a ripple of changes across the system.

Loose coupling is achieved partially through the mechanism of extensions and extension points. The simplest metaphor for describing extensions and extension points is electrical outlets. The outlet, or socket, is the extension point; the plug, or light bulb that connects to it, the extension. As with electric outlets, extension points come in a wide variety of shapes and sizes, and only the extensions that are designed for that particular extension point will fit.

When a plug-in wants to allow other plug-ins to extend or customize portions of its functionality, it will declare an extension point. The extension point declares a contract, that extensions must conform to. Plug-ins that want to connect to that extension point must implement that contract in their extension. The key attribute is that the plug-in being extended knows nothing about the plug-in that is connecting to it beyond the scope of that extension point contract. This allows plug-ins built by different individuals or companies to interact seamlessly, even without their knowing much about one another.

Some extensions are entirely declarative; that is, they contribute no code at all. For example, one extension point provides the ability to register a specific route, where the consuming extension would define the route and the mapping to the view component.

getChildRoutes = (next, callback) => {
  const routes = []
  const childRoutes = ext.point('app.routes').exec('config', this, routes)
 
  const matchingChildRoutes = childRoutes.find(function(route) {
    return new RegExp(route.path).test(next.location.pathname)
  })
  return callback(null, [matchingChildRoutes])
}

Example usage of an extension point:


ext.point('app.routes').extend({
  id: 'site',
  config: function(routes = []) {
    routes.push({
      path: '/site/live',
      getComponents(nextState, cb) {
        require.ensure([], (require) => {
          cb(null, require('./components/site'))
        })
      }
    })
    return routes
  }
})

NOTE: the example above also shows how code-chunking is used to load the view-component on demand

Where another category of extension points is used to group related elements in the user interface. For example, extension points for providing views, editors, and wizards to the UI allow the base UI plug-in to group common features, such as putting all import wizards into a single dialog, and to define a consistent way of presenting UI contributions from a wide variety of other plug-ins.

Extension-points may also be used to overwrite default behavior of a plugin.