{"id":18971129,"url":"https://github.com/dburles/modulepreload-express","last_synced_at":"2025-04-16T08:32:44.954Z","repository":{"id":198580831,"uuid":"701104021","full_name":"dburles/modulepreload-express","owner":"dburles","description":"Express middleware for generating modulepreload link relations for a Link entity-header based on the requested JavaScript modules import graph.","archived":false,"fork":false,"pushed_at":"2024-09-17T23:42:39.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T08:46:43.973Z","etag":null,"topics":["esm","esmodules","express","header","http","link","middleware","modulepreload"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/modulepreload-express","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/dburles.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":"2023-10-05T23:36:14.000Z","updated_at":"2024-09-17T23:42:12.000Z","dependencies_parsed_at":"2024-11-08T14:59:44.804Z","dependency_job_id":"161c44b1-2bc7-4e28-970e-560975770da6","html_url":"https://github.com/dburles/modulepreload-express","commit_stats":null,"previous_names":["dburles/modulepreload-express"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dburles%2Fmodulepreload-express","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dburles%2Fmodulepreload-express/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dburles%2Fmodulepreload-express/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dburles%2Fmodulepreload-express/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dburles","download_url":"https://codeload.github.com/dburles/modulepreload-express/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249220839,"owners_count":21232421,"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":["esm","esmodules","express","header","http","link","middleware","modulepreload"],"created_at":"2024-11-08T14:59:37.060Z","updated_at":"2025-04-16T08:32:44.587Z","avatar_url":"https://github.com/dburles.png","language":"JavaScript","readme":"# modulepreload-express\n\nExpress middleware for generating [modulepreload](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/modulepreload) link relations for a [Link](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link) entity-header based on the requested JavaScript modules import graph. This will prevent request waterfalls for nested module imports. Supports import maps.\n\n## Install\n\n```sh\nnpm i modulepreload-express\n```\n\n## Usage example\n\n```js\nimport express from \"express\";\nimport createModulePreloadMiddleware from \"modulepreload-express/createModulePreloadMiddleware.mjs\";\n\nconst app = express();\n\nconst APP_ROOT = \"app\";\n\napp.use(createModulePreloadMiddleware(APP_ROOT));\napp.use(express.static(APP_ROOT));\n\napp.listen(3000);\n```\n\n## API\n\n### `createModulePreloadMiddleware(path[, options])`\n\n- `path` {string} Path to the application root directory, eg \"app\".\n- `options` {Object}\n  - `extensions` {Array\u0026lt;string\u0026gt;} The file extensions to consider for module scripts. Defaults to: `[\"mjs\", \"js\"]`.\n  - `importMap` {string} Import map string.\n  - `cache` {Object} A custom (map-like) cache.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdburles%2Fmodulepreload-express","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdburles%2Fmodulepreload-express","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdburles%2Fmodulepreload-express/lists"}