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

typhonjs-config-jspm-parse

v0.6.1

Published

Provides utility functions to parse dependencies from JSPM entries in 'package.json' and 'config.js' via an instance of SystemJS / SystemJS Loader.

Downloads

17

Readme

typhonjs-config-jspm-parse

NPM Code Style License Gitter

Build Status Coverage Dependency Status

Provides several utility functions to parse JSPM packages and find normalized paths from package.json and config.js using an instance of System / SystemJS Loader. This npm module works in the Node execution environment and the browser. The following functions are available:

  • getPackageJSPMDependencies - Parses the packageObj / top level package.json for the JSPM entry to index JSPM dependencies. If an existing jspmPackageMap object hash exists then only the keys in that hash are resolved against jspm.dependencies entry in package.json.

  • getPackageJSPMDevDependencies - Parses the packageObj / top level package.json for the JSPM entry to index JSPM devDependencies. If an existing jspmPackageMap object hash exists then only the keys in that hash are resolved against jspm.devDependencies entry in package.json.

  • getPackageResolver- Returns an instance of PackageResolver which provides all top level (topLevelPackages) and child package (childPackageMap) dependencies. An optional packageFilter parameter which is an array of strings will limit the resolver to specifically those top level packages. Additional methods: getDirectDependency, getDirectDependencyMap & getUniqueDependencyList provide functionality to respectively return a specific direct child dependency, the direct child dependency map, or an array of all unique child dependencies.

  • getRootPath - Returns the root execution path.

  • getTopLevelDependencies - Returns all top level package dependencies and devDependencies. If jspmPackages is defined only the keys of jspmPackages will be resolved.

  • parseChildDependencies - Provides a map of all child dependencies defined in config.js / System.packages. System.packages stores the mapped dependency paths by a file:// reference, but we actually want the mapped paths for the package. This function parses System.packages converting the entries into the desired format.

  • parseNormalizedPackage - Attempts to normalize and parse a packageName returning null if it is an invalid package or an object hash containing the parsed package details. Note: Only works in the Node execution environment.

To install: npm install typhonjs-config-jspm-parse

For the latest significant changes please see the CHANGELOG.

For instance in specifying further user defined mapped paths in additional config loading here is an example from backbone-parse-es6-todos that maps a source file from a child dependency of backbone (https://github.com/typhonjs-demos/backbone-parse-es6-todos/blob/master/config/config-app-paths.js):

var System = System || global.System;

var JSPMParser = JSPMParser || (typeof require !== 'undefined' ? require('typhonjs-config-jspm-parse') : undefined);

var packageResolver = JSPMParser.getPackageResolver(System);
var pathBackboneEvents = packageResolver.getDirectDependency('backbone', 'typhonjs-core-backbone-events');

System.config(
{
   map:
   {
      'mainEventbus': pathBackboneEvents + '/src/mainEventbus.js',
   }
});

In the case of running in the browser load typhonjs-config-jspm-parse before usage.

<script src="jspm_packages/system.js"></script>
<script src="config.js"></script>
<script src="node_modules/typhonjs-config-jspm-parse/src/parser.js"></script>
<script src="config/config-app-paths.js"></script>
<script>System.import('main.js');</script>

Please see package.json and the jspm entries from backbone-parse-es6-todos: https://github.com/typhonjs-demos/backbone-parse-es6-todos/blob/master/package.json

In this case backbone is mapped to github:typhonjs-backbone-parse/backbone-parse-es6@master

The above code example searches for the mapped package typhonjs-core-backbone-events which is mapped in the package.json of github:typhonjs-backbone-parse/backbone-parse-es6@master: https://github.com/typhonjs-backbone-parse/backbone-parse-es6/blob/master/package.json