sails-build-dictionary is a utility package designed to recursively build a dictionary (plain JavaScript object) of modules from specified directories, leveraging the `include-all` library. It was a foundational component for older versions of the Sails.js framework (prior to v1.0), primarily used for automatically loading application components like models, controllers, and services by convention into a structured object accessible within the Sails application instance. The package's latest version is 0.10.1, with its last publication dating back 12 years (as of March 2014). Since Sails v1.0, this module has been officially deprecated, with the recommendation that developers directly use `include-all@1.x.x` for similar functionality. Consequently, `sails-build-dictionary` is no longer actively maintained and does not receive updates, including security patches or compatibility adjustments for newer Node.js versions.
npm install sails-build-dictionaryVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to use `sails-build-dictionary` to recursively load JavaScript modules from a simulated Sails.js `api` directory structure into a nested dictionary object. It creates dummy model and controller files, then aggregates them into a single object.
For new projects or updated Sails applications (v1.0+), bypass `sails-build-dictionary` and use `require('include-all')` directly to load modules. Consult the `include-all` documentation for its API.Always use Node.js `require()` syntax to import `sails-build-dictionary`. Ensure your project environment is configured for CommonJS if you intend to use this legacy package.
Migrate away from `sails-build-dictionary` to `include-all` or a modern, actively maintained module loader that supports your project's Node.js version and module system (CommonJS/ESM).
Ensure the package is installed: `npm install sails-build-dictionary`. If using ES modules, remember that `sails-build-dictionary` is CommonJS-only; use `const buildDictionary = require('sails-build-dictionary');`.Double-check the usage against the quickstart example. The primary method for building dictionaries is `buildDictionary.aggregate()`. Ensure your `require()` statement correctly captures the exported object and you are calling the method on it.