{"id":20895195,"url":"https://github.com/devaman/importable","last_synced_at":"2026-04-25T06:32:54.331Z","repository":{"id":169980658,"uuid":"173628914","full_name":"devaman/importable","owner":"devaman","description":"Safely lazy load and initialize packages across your app","archived":false,"fork":false,"pushed_at":"2019-03-03T20:50:34.000Z","size":2815,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-12T19:32:35.270Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"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/devaman.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-03T20:56:42.000Z","updated_at":"2020-06-21T15:37:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"ee4597b0-6053-46f1-8c8c-aec0687a7d1c","html_url":"https://github.com/devaman/importable","commit_stats":null,"previous_names":["devaman/importable"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/devaman/importable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devaman%2Fimportable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devaman%2Fimportable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devaman%2Fimportable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devaman%2Fimportable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devaman","download_url":"https://codeload.github.com/devaman/importable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devaman%2Fimportable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28076810,"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-12-27T02:00:05.897Z","response_time":58,"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":"2024-11-18T10:25:51.242Z","updated_at":"2025-12-27T09:25:04.966Z","avatar_url":"https://github.com/devaman.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# importable\n\n[![npm](https://img.shields.io/npm/v/importable.svg)](https://www.npmjs.com/package/importable)\n\nSafely lazy load and initialize packages across your app\n\n## Why?\n\nLazy loading is great, but as soon as you need to do anything more than import a single package, it can get messy. With Importable, you can import the packages you need, initialize them, and use them like normal; let Importable take care of the rest.\n\n## Usage\n\nInstall using your favorite package manager\n\n```bash\nyarn add importable\n```\n\nCreate an Importable package\n\n```js\nimport Importable from 'importable';\n\nconst LazyPackage = new Importable(\n  // import the packages you need\n  [import('lazy-package'), import('lazy-config')],\n\n  // initialize them\n  async modules =\u003e {\n    const [lazyPackage, lazyConfig] = modules;\n\n    lazyPackage.initialize({ apiKey: lazyConfig.apiKey });\n  },\n\n  // and return them ready to use\n  async modules =\u003e {\n    const [lazyPackage] = modules;\n\n    return lazyPackage;\n  },\n);\n\nexport default LazyPackage;\n```\n\nImport your package with `await` and use it like normal\n\n```js\nimport LazyPackage from '../importables/LazyPackage';\n\nconst asyncFunction = async () =\u003e {\n  // get your package\n  const lazyPackage = await LazyPackage.import();\n\n  // use it like normal\n  lazyPackage.doSomething();\n};\n\n// and do it as often as you like\nasyncFunction();\nasyncFunction();\nasyncFunction();\n```\n\nSee the [test cases](https://github.com/michaelwm/importable/blob/master/src/Importable.test.js) for more in depth usage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevaman%2Fimportable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevaman%2Fimportable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevaman%2Fimportable/lists"}