{"id":17827020,"url":"https://github.com/whaaaley/esbuild-plugin-glob-import","last_synced_at":"2025-08-13T20:34:10.061Z","repository":{"id":91624396,"uuid":"498947687","full_name":"whaaaley/esbuild-plugin-glob-import","owner":"whaaaley","description":"Use globs to import multiple files.","archived":false,"fork":false,"pushed_at":"2024-03-30T17:42:04.000Z","size":84,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T06:12:25.965Z","etag":null,"topics":["esbuild","esbuild-plugin","glob","import"],"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/whaaaley.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":"2022-06-02T01:10:43.000Z","updated_at":"2024-01-07T21:52:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"5625972e-ce30-462d-95fd-cf9144d9a260","html_url":"https://github.com/whaaaley/esbuild-plugin-glob-import","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/whaaaley/esbuild-plugin-glob-import","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whaaaley%2Fesbuild-plugin-glob-import","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whaaaley%2Fesbuild-plugin-glob-import/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whaaaley%2Fesbuild-plugin-glob-import/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whaaaley%2Fesbuild-plugin-glob-import/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whaaaley","download_url":"https://codeload.github.com/whaaaley/esbuild-plugin-glob-import/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whaaaley%2Fesbuild-plugin-glob-import/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270305842,"owners_count":24562109,"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-08-13T02:00:09.904Z","response_time":66,"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":["esbuild","esbuild-plugin","glob","import"],"created_at":"2024-10-27T18:57:34.594Z","updated_at":"2025-08-13T20:34:09.288Z","avatar_url":"https://github.com/whaaaley.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# esbuild-plugin-glob-import\n\nUse globs to import multiple files.\n\n## Install\n\n```sh\n$ npm i esbuild-plugin-glob-import\n```\n\n## Setup\n\nAdd the plugin to your esbuild options.\n\n```js\nimport esbuild from 'esbuild'\nimport globImport from 'esbuild-plugin-glob-import'\n\nesbuild.build({\n  // ...\n  plugins: [\n    globImport()\n  ]\n})\n```\n\n## Options\n\n+ `camelCase` - truthy or falsy - If truthy, this camel cases paths and filenames and removes file extensions.\n+ `entryPoint` - string or falsy - Set which file in a directory is the entry point. If `entryPoint` is a string and matches a file, that module will be set on the key of the parent directory's name. If `entryPoint` is falsy all matching files will be imported and included in an object on keys of those file's names.\n+ `entryPointMatch` - function or nullish - Determine which file in a directory is the entry point. This function is called for every file imported using a glob. It receives the filepath as an array. Return truthy if the path is an entry point and falsy if not.\n\n## Example with default options\n\nOptions:\n\n```js\nconst opts = {\n  camelCase: true,\n  entryPoint: 'index.js',\n  entryPointMatch: arr =\u003e arr[arr.length - 1] === opts.entryPoint\n}\n```\n\nFile structure:\n\n```\n/pages\n  /home\n    home.css\n    index.js\n  /about\n    /content\n      summary.js\n      history.js\n    about.css\n    index.js\n  /error\n    error.css\n    index.js\n```\n\nGlob import statement:\n\n```js\nimport pages from './pages/**/index.js'\nconsole.log(pages)\n```\n\nOutput:\n\n```js\n{\n  home: function () {\n    // ...\n  },\n  about: function () {\n    // ...\n  },\n  error: function () {\n    // ...\n  }\n}\n```\n\n## Alternative Example\n\nUsing the same file structure and import statement from the previous example but with different options.\n\nOptions:\n\n```js\nconst opts = {\n  camelCase: false,\n  entryPoint: false,\n  entryPointMatch: null\n}\n```\n\nOutput:\n\n```js\n{\n  home: {\n    'index.js': function () {\n      // ...\n    }\n  },\n  about: {\n    'index.js': function () {\n      // ...\n    },\n    content {\n      'summary.js': function () {\n        // ...\n      },\n      'history.js': function () {\n        // ...\n      }\n    }\n  },\n  error: {\n    'index.js': function () {\n      // ...\n    }\n  }\n}\n```\n\n## Prior Art\n\n+ [esbuild](https://esbuild.github.io/)\n+ [esbuild-plugin-import-glob](https://github.com/thomaschaaf/esbuild-plugin-import-glob)\n+ [fast-glob](https://github.com/mrmlnc/fast-glob)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhaaaley%2Fesbuild-plugin-glob-import","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhaaaley%2Fesbuild-plugin-glob-import","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhaaaley%2Fesbuild-plugin-glob-import/lists"}