Nitro Component Resolver
The nitro component resolver looks up all
pattern.json (can be changed) files in the given nitro components directory
and provides fast and easy access to the files and their content during development and production.
npm i --save-dev @namics/nitro-component-resolver
const ComponentResolver = ;const resolver =rootDirectory: '/example/path/components'// Invalidate cache on file changes (can be set to false for production mode)// Default: truewatch: true// Main template (please adjust if you use another template language)// Default: '*/*/*.hbs'mainTemplate: '*/*/*.hbs'// Meta json which contains the component details// used by getComponents()// Default: '*/*/pattern.json'patternExpression: '*/*/pattern.json'// Wether to cache the examples// Default and recommend value: truecacheExamples: true;resolver;resolver;resolver;resolver;resolver;
The component resolver relies on chokidar.
Chokidar shares its internal file watcher so that only one io-watcher per file/folder is used even if multiple chokidar instances exist.
All resolved and parsed components are cached using the hot-file-cache module: