{"id":31196289,"url":"https://github.com/confuser/node-pluginable","last_synced_at":"2025-09-20T04:50:04.092Z","repository":{"id":22744826,"uuid":"26089989","full_name":"confuser/node-pluginable","owner":"confuser","description":"Node.js component/module/plugin loader","archived":false,"fork":false,"pushed_at":"2016-04-15T13:16:49.000Z","size":39,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-19T14:36:05.383Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/confuser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-02T18:57:19.000Z","updated_at":"2021-08-08T00:25:37.000Z","dependencies_parsed_at":"2022-08-05T19:00:21.066Z","dependency_job_id":null,"html_url":"https://github.com/confuser/node-pluginable","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/confuser/node-pluginable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confuser%2Fnode-pluginable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confuser%2Fnode-pluginable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confuser%2Fnode-pluginable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confuser%2Fnode-pluginable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/confuser","download_url":"https://codeload.github.com/confuser/node-pluginable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/confuser%2Fnode-pluginable/sbom","scorecard":{"id":302410,"data":{"date":"2025-08-11","repo":{"name":"github.com/confuser/node-pluginable","commit":"0e59aa2d6a9a05ccb634500b6ed74a97e3d1bd1e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 2/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: ISC License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T21:02:20.936Z","repository_id":22744826,"created_at":"2025-08-17T21:02:20.936Z","updated_at":"2025-08-17T21:02:20.936Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276047233,"owners_count":25575881,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-20T02:00:10.207Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-20T04:49:59.115Z","updated_at":"2025-09-20T04:50:04.077Z","avatar_url":"https://github.com/confuser.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pluginable\n\n[![build status](https://secure.travis-ci.org/confuser/node-pluginable.png)](http://travis-ci.org/confuser/node-pluginable)\n[![Coverage Status](https://coveralls.io/repos/confuser/node-pluginable/badge.png?branch=master)](https://coveralls.io/r/confuser/node-pluginable?branch=master)\n\n\nA component/module/plugin loader\n\n## Installation\n\n```\nnpm install pluginable --save\n```\n\n## Usage\n```js\nvar pluginable = require('pluginable')\n\nglob('./**/pluginable.js', funcion (error, files) {\n  var pluginLoader = pluginable(files)\n\n  pluginLoader.load(function (error) {\n    console.log('Plugins loaded')\n  })\n})\n```\n\n## Plugin Interface\n```js\nmodule.exports = function theName(cb) {\n  console.log('this is called on load')\n\n  cb(null)\n}\n```\n\n### Dependencies\nThese can be inferred from the function arguments\n\n```js\nmodule.exports = function theName(db, userService, app, cb) {\n  console.log(db, userService, app)\n}\n```\n\n### Instances\nThese are returned within the function via an async callback(error, instance).\nThis is then what another plugin will be given if it is dependent on it based on the function name.\n\n#### Async\n```js\nmodule.exports = function theName(db, cb) {\n  cb(null, { test: 'hello' })\n}\n```\n\nThe last argument of your function will always be assumed to be the callback(error, [instance])\n\n\nNote: The plugin will only be registered if the returned instance is truey\n\n## Events\nRegistered before pluginable is initialised, or within a plugin itself via `on` or `once`.\n\nOnly emitted if no errors, e.g. an afterLoad will not emit if a plugin returns an error.\n\n```js\nvar pluginable = require('pluginable')\nvar pluginLoader = pluginable(files)\n\npluginLoader.on('beforeLoad', function (plugin) {\n  console.log(plugin.name)\n})\n\npluginLoader.load(function (error) {\n  console.log('Plugins loaded')\n})\n```\n\n```js\nmodule.exports = function pluginName() {\n  this.on('eventName', function () { })\n}\n```\n\n* `beforeLoad(plugin)` - Emitted before each plugin is loaded.\n\n* `beforeLoad:pluginName(plugin)` - Emitted before the specified plugin is loaded.\n\n* `afterLoad(plugin, instance)` - Emitted after each plugin is loaded.\n\n* `afterLoad:pluginName(plugin, instance)` - Emitted after the specified plugin is loaded.\n\n* `beforeFinished(pluginInstances)` - Emitted before the pluginable callback is called.\n\n* `afterFinished(pluginInstances)` - Emitted after the pluginable callback is called.\n\n## What if...\n\n### I want to access other plugins but not be dependent on them?\n```js\nmodule.exports = function theName(db, cb) {\n  // Will output instance value of 'test' if present\n  console.log(this.plugins.test)\n  cb(null, { test: 'hello' })\n}\nmodule.exports.softDepend = [ 'test' ]\n```\n\n### I want to clear the plugins?\nPluginable is newless OO. Allowing the reference to be garbage collected should suffice.\n\n### I want to dynamically load a plugin before startup?\n```js\nvar pluginLoader = require('pluginable')(files)\npluginLoader.registerBeforeLoad(function test(cb) { cb() })\n\npluginLoader.load(function (error, plugins) {\n  console.log(error, plugins)\n})\n```\nThis allows you to register plugins for use with a dependency before executing load(), for example a logger instance.\n\n### I want to use this pattern with other functions after load?\n```js\nvar pluginLoader = require('pluginable')(files)\n\npluginLoader.load(function (error, plugins) {\n  var fn = pluginLoader.bond(function hello(pluginA, pluginB) {\n    console.log(pluginA, pluginB)\n  })\n\n  fn()\n})\n```\nNote, `bond` will throw an error if a dependency is unmet.\n\n### I have plugins with circular dependencies?\nPluginable will return an error stating which plugins are affected and will not continue until it is solved.\n\n### I have a plugin dependency that isn't present?\nPluginable will return an error stating which dependency is missing and from which plugin.\n\n### I try to break it?\nPluginable tries to validate plugins before loading or using them. If you're really evil and come across a scenario that isn't covered, feel free to open an issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconfuser%2Fnode-pluginable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconfuser%2Fnode-pluginable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconfuser%2Fnode-pluginable/lists"}