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

bundalo

v0.2.11

Published

Extract/cache/render property files/strings using i18n rules and various rendering engines

Downloads

1,961

Readme

bundalo

Lead Maintainer: Aria Stewart

Extract/cache/render property files/strings using i18n rules and various rendering engines

Build Status

Use cases

Initialize bundalo

Call bundalo module with a key that matches your template engine, plus locale information. Currently only dust and none are supported as engines.

var bundalo = require('bundalo');

//couple of configs for later
var config = {
	"contentPath": "locales/", //required
	"fallback": "en-US",       //optional
	"engine": "dust",          //required
	"cache": false             //optional, default is true
};
var config2 = {
	"contentPath": "globals/",
	"fallback": "",
	"engine": "none"
};

//create two bundalo instances. Each has its own cache
var bundle = bundalo(config);
var bundle2 = bundalo(config);

Use bundalo

User wants key/values from some bundle file, corrected for locality, and possibly rendered with some data model

bundle.get({'bundle': 'errors/server','locality': 'en-US', 'model': {'name': 'Will Robinson'}}, function bundaloReturn(err, data) {
	console.log("what'd we get from bundalo.get?", data, err);
	cb({
		'err': data.error
	});
});

User wants multiple bundles in a single call, to avoid calling bundalo multiple times

bundle.get({'bundle': ['errors/server', 'errors/client'], 'locality': 'en-US',  'model': {'name': 'Will Robinson'}}, function bundaloReturn(err, data) {
	console.log("what'd we get from bundalo.get?", data, err);
	cb({
		'clienterr': data['errors/client'].error,
		'servererr': data['errors/server'].error
	});
});

User wants multiple bundles in a single call, and wants to alias the bundles for easier management upon return

bundle.get('bundle': {
	'server': 'errors/server',
	'client': 'errors/client'
}, 'locality': 'en-US', 'model': {'name': 'Will Robinson'}}, function bundaloReturn(err, data) {
	console.log("what'd we get from bundalo.get?", data, err);
	cb({
		'clienterr': data.client.error,
		'servererr': data.server.error
	});
});

Design

When a user first requests a bundle, bundalo will:

  • fetch the correct file from the file system based on locality
  • [dust only] compile the properties file into a dust template
  • cache the [compiled dust] template
  • [dust only] render the template with any provided data model
  • deserialize the rendered properties file via spud
  • return a JSON data object with the rendered values

Upon subsequent requests for a bundle, the previously cached compiled template will be re-rendered and returned. Cache will be based upon the bundle path provided by the user, plus the locality path information. I.e. 'US/en/foo/bar' is a separate cached object from 'DE/de/foo/bar'. Cache is consistent per bundalo instance created.