Load application resources and avoid runtime package surprises
LOAD(types, [callback], [clear=true]) is the application loader. types is an array or comma-separated list of resource groups (such as config, definitions, controllers, actions, modules, resources, jsonschemas, flowstreams). With no list it loads the normal application groups. It extracts bundles first and clears temporary files by default. Use it in a standalone script when you need application definitions without starting an HTTP listener; do not repeatedly call it in a request handler.
NPMINSTALL(name, [callback]) checks the package under CONF.$nodemodules: an already-installed matching version returns without running npm. Otherwise it invokes npm install there. The name must be a trusted fixed application value, never request input. Deploy dependencies through a pinned package manifest/lockfile when reproducibility matters. The test below covers only the installed-package branch: it does not download, upgrade or certify any third-party package.
exports.install = function() {
ROUTE('GET /loader-contract/', function($) { $.json({ available: typeof LOAD === 'function' && typeof NPMINSTALL === 'function' }); });
};