{"id":45579169,"url":"https://github.com/usrz/javascript-esquire","last_synced_at":"2026-02-23T11:31:46.260Z","repository":{"id":22623903,"uuid":"25966415","full_name":"usrz/javascript-esquire","owner":"usrz","description":"A light weight script loader and dependency framework for JavaScript","archived":false,"fork":false,"pushed_at":"2015-08-03T04:36:04.000Z","size":2896,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-26T14:59:55.923Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/usrz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-30T10:49:35.000Z","updated_at":"2015-03-11T02:03:57.000Z","dependencies_parsed_at":"2022-09-13T11:41:44.529Z","dependency_job_id":null,"html_url":"https://github.com/usrz/javascript-esquire","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/usrz/javascript-esquire","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usrz%2Fjavascript-esquire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usrz%2Fjavascript-esquire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usrz%2Fjavascript-esquire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usrz%2Fjavascript-esquire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usrz","download_url":"https://codeload.github.com/usrz/javascript-esquire/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usrz%2Fjavascript-esquire/sbom","scorecard":{"id":912824,"data":{"date":"2025-08-11","repo":{"name":"github.com/usrz/javascript-esquire","commit":"59ed57393d9fc1fedd9ec50a7abb6fa7e59e491b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/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":"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":"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":"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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE.md: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":"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"}}]},"last_synced_at":"2025-08-24T19:52:51.987Z","repository_id":22623903,"created_at":"2025-08-24T19:52:51.987Z","updated_at":"2025-08-24T19:52:51.987Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29741586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T07:44:07.782Z","status":"ssl_error","status_checked_at":"2026-02-23T07:44:07.432Z","response_time":90,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-02-23T11:31:45.584Z","updated_at":"2026-02-23T11:31:46.255Z","avatar_url":"https://github.com/usrz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Esquire\n=======\n\nEsquire is a light weight, **asynchronous** injection framework for JavaScript.\n\n\u003cdiv class=\"nojsdoc\"\u003e\n  The full API documentation is avaiblable\n  \u003ca target=\"_blank\" href=\"http://usrz.github.io/javascript-esquire/\"\u003ehere\u003c/a\u003e.\n\u003c/div\u003e\n\nModules\n-------\n\nModule definitions are shared, on a per _global scope_ basis; in other words,\nthe same module is defined only once per `window` if running in a browser,\nor `global` if running under `Node.JS`.\n\nModules are defined by a `name`, a list of _dependencies_, and a constructor\nfunction:\n\n```javascript\nEsquire.define(\"myModuleName\", ['myFirstDependency', 'anotherDependency'], function(first, another) {\n  // the parameters to the constructor are our dependencies, and in this context\n  // \"this\" means the module itself, so \"this.name\" is \"myModuleName\"\n});\n```\n\nConstructors can return _immediately_ (with a result), or can return a\n_then-able_ `Promise` which will eventually resolve to the required instance.\n\nModule Injection\n----------------\n\nDirect injection of a module is supported through the `inject(...)` method,\nwhich will return a `Promise` to its return value:\n\n```javascript\nnew Esquire().inject(['dependencyName'], function(dependency) {\n  // ... use the dependency here, and either return or throw an exception\n\n}).then(function(result) {\n  // \"result\" here will be the value returned by the injected method above\n\n}, function(failure) {\n  // \"failure\" here will be the error thrown by the injected method above\n\n});\n```\n\nModule Requirement\n------------------\n\nModules can also be directly required by the caller, and will be returned\nwrapped into a `Promise`:\n\n```javascript\nnew Esquire().require('requestedModule')\n  .then(function(result) {\n    // \"result\" here will be the instance of the module 'requestedModule'\n  });\n```\n\nMultiple modules can also be requested simultaneously (both specifying module\nnames as arguments or an array of `string`s):\n\n```javascript\nnew Esquire().require('firstModule', 'secondModule')\n  .then(function(result) {\n    // result[0] -\u003e instance of 'firstModule'\n    // result[1] -\u003e instance of 'secondModule'\n  });\n```\n\nStatic vs. per-instance injection\n---------------------------------\n\nIn the examples above, a call to `new Esquire()` will create a new _injector_\nand with it, new modules instances are created. Each module _instance_ is only\navailable to its injector, and never shared across.\n\nOn the other hand the global `esquire(...)` method will allow to access a per\n_global scope_ shared injector.\n\nWhen calling `esquire(...)` with a callback function as its last parameter,\nthe method will behave like `inject(...)`, thus dependencies will be resolved\nand passed to callback method, and its return value (if any) will be returned.\n\n```javascript\nesquire(['dependencyName'], function(dependency) {\n  // ... use the dependency here, and either return or throw an exception\n}).then(function(result) {\n  // \"result\" here will be the value returned by the injected method above\n});\n```\n\nIf no callback function was given, the `esquire(...)` method will behave like\n`require(...)` and simply return the required dependencies.\n\n```javascript\nesquire('requestedModule')\n  .then(function(result) {\n    // \"result\" here will be the instance of the module 'requestedModule'\n  });\n```\n\nTimeouts\n--------\n\nAs module creation is asynchronous, it might be useful to specify a timeout\nwhen creation should fail.\n\nBy default the timeout is 2000 ms (2 sec), but a different timeout can be\nspecified at construction time. The minimum timeout is 100 ms.\n\n```javascript\nnew Esquire(60000).require('foo')\n  .then(function(foo) {\n    // we'll wait up to a minute for \"foo\" to be created\n  });\n```\n\nLoading\n-------\n\nWhile optional, loading of external scripts is also supported, with the same\n`Promise` mechanism (especially useful in browser environments).\n\nAnd as `Promise`s can be easily chained, constructs like the following can\nbe quite useful:\n\n```javascript\nEsquire.load(\"myOtherScript.js\")\n  .then(function() {\n    return esquire(\"moduleFromMyOtherScript\");\n  })\n.then(function(myModule) {\n  // here \"myModule\" will be the shared global instance of the module\n  // \"moduleFromMyOtherScript\" defined in the \"myOtherScript.js\" file\n});\n```\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusrz%2Fjavascript-esquire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusrz%2Fjavascript-esquire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusrz%2Fjavascript-esquire/lists"}