{"id":24087125,"url":"https://github.com/hapipal/hodgepodge","last_synced_at":"2025-05-05T17:58:13.878Z","repository":{"id":55197456,"uuid":"43437767","full_name":"hapipal/hodgepodge","owner":"hapipal","description":"Resolving hapi plugin dependencies since 2015","archived":false,"fork":false,"pushed_at":"2021-01-06T06:21:44.000Z","size":48,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-12T19:51:34.606Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hapipal.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":"2015-09-30T14:28:47.000Z","updated_at":"2023-12-13T17:42:26.000Z","dependencies_parsed_at":"2022-08-14T15:50:41.990Z","dependency_job_id":null,"html_url":"https://github.com/hapipal/hodgepodge","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapipal%2Fhodgepodge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapipal%2Fhodgepodge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapipal%2Fhodgepodge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapipal%2Fhodgepodge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hapipal","download_url":"https://codeload.github.com/hapipal/hodgepodge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252547937,"owners_count":21766079,"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","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-01-10T03:02:19.368Z","updated_at":"2025-05-05T17:58:13.854Z","avatar_url":"https://github.com/hapipal.png","language":"JavaScript","readme":"# hodgepodge\n\nResolving hapi plugin dependencies since 2015\n\n[![Build Status](https://travis-ci.com/hapipal/hodgepodge.svg?branch=master)](https://travis-ci.com/hapipal/hodgepodge) [![Coverage Status](https://coveralls.io/repos/hapipal/hodgepodge/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/hapipal/hodgepodge?branch=master)\n\nLead Maintainer - [Devin Ivy](https://github.com/devinivy)\n\n## Installation\n```sh\nnpm install hodgepodge\n```\n\n## Usage\n\u003e See also the [API Reference](API.md)\n\u003e\n\u003e Hodgepodge is intended for use with hapi v19+ and nodejs v12+ (see v3 for lower support).\n\u003e\n\u003e This module is currently under [ad hoc maintenance](https://github.com/hapipal/hodgepodge/issues/11), which means it relies fully on community support.\n\nWhen you declare dependencies on a hapi plugin, whether by [`server.dependency()`](https://hapi.dev/api/#server.dependency()) or by the [`dependencies` plugin property](https://hapi.dev/api/#plugins), hapi does not actually defer plugin registration to resolve those dependencies.  It just assures that those dependencies exist at the time the server is initialized.  Hodgepodge actually reorders your plugin registrations so that they occur in an order that respects their dependencies, simply by paying attention to their listed `dependencies`.\n\n\u003e **Note**\n\u003e\n\u003e It's suggested to use hodgepodge only when it's really necessary– ideally plugin registration order should not matter.  You may, for example, utilize the [`once` plugin registration option](https://hapi.dev/api/#server.register()) or\n[`once`/`multiple` plugin properties](https://hapi.dev/api/#plugins) so that plugins may simply be registered by every other plugin that depends on them.\n\u003e\n\u003e See [\"Handling plugin dependencies\"](https://hapipal.com/best-practices/handling-plugin-dependencies) for an in-depth look at taming inter-plugin dependencies.\n\n```js\nconst Hodgepodge = require('hodgepodge');\n\n(async () =\u003e {\n\n    const plugins = Hodgepodge.sort([\n        pluginA, // pluginA.dependencies === 'pluginB'\n        pluginB\n    ]);\n\n    // Now plugins looks like [pluginB, pluginA]\n    // This ordering respects pluginA's dependency on pluginB\n\n    await server.register(plugins);\n})();\n```\n\n### More\nIn a sense this is an alternative to the [`server.dependency(deps, [after])`](https://hapi.dev/api/#server.dependency()) [pattern](API.md#without-hodgepodge), which some find to be clunky.  In contrast to use of `server.dependency()`'s `after` callback, dependencies are dealt with at the time of plugin registration rather than during server initialization (during [`onPreStart`](https://hapi.dev/api/#server.ext())).\n\nDue to this core difference in timing, it may be required that your plugin be registered using hodgepodge to ensure that plugin dependencies are resolved in time for the plugin to be used.  In order to enforce this, wrap your plugin's `dependencies` in an object with a single property `hodgepodge`.  When hodgepodge passes over your plugin, it will unwrap this property; but if hodgepodge is not used to register your plugin, hapi will fail when it tries to register your plugin because `{ hodgepodge: [] }` is an invalid `dependencies` plugin property.  This is by design, in case you want to enforce registration of your plugin using hodgepodge.  If you do this, remember that hodgepodge is then a `peerDependency` of your project!\n\nHodgepodge throws an exception when there are circular dependencies, or if dependencies will otherwise not be met during registration.\n\n### Limitations\nBecause hodgepodge reorders serial plugin registrations rather than deferring plugin registration until dependencies are met, hodgepodge can only resolve dependencies among plugins that are registered at the same time.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhapipal%2Fhodgepodge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhapipal%2Fhodgepodge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhapipal%2Fhodgepodge/lists"}