{"id":17350302,"url":"https://github.com/blairmcalpine/next-build-parser","last_synced_at":"2026-02-03T23:32:03.536Z","repository":{"id":257824071,"uuid":"871747090","full_name":"blairmcalpine/next-build-parser","owner":"blairmcalpine","description":"A quick and easy tool to parse the output of the Next.js build command into machine readable JSON, to fit whatever needs you may have.","archived":false,"fork":false,"pushed_at":"2025-06-23T02:16:29.000Z","size":142,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T12:45:58.369Z","etag":null,"topics":["ci","cli","next","nextjs","npm","parser"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/blairmcalpine.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-10-12T20:24:37.000Z","updated_at":"2025-07-03T01:32:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"61c86e92-0a3f-48bd-9667-cf770e9c8c29","html_url":"https://github.com/blairmcalpine/next-build-parser","commit_stats":null,"previous_names":["blairmcalpine/next-build-parser"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/blairmcalpine/next-build-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blairmcalpine%2Fnext-build-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blairmcalpine%2Fnext-build-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blairmcalpine%2Fnext-build-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blairmcalpine%2Fnext-build-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blairmcalpine","download_url":"https://codeload.github.com/blairmcalpine/next-build-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blairmcalpine%2Fnext-build-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29061537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T23:14:54.203Z","status":"ssl_error","status_checked_at":"2026-02-03T23:14:50.873Z","response_time":96,"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":["ci","cli","next","nextjs","npm","parser"],"created_at":"2024-10-15T17:06:25.211Z","updated_at":"2026-02-03T23:32:03.529Z","avatar_url":"https://github.com/blairmcalpine.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# next-build-parser\n\n🚀 A quick and easy tool to parse the output of the [Next.js](https://github.com/vercel/next.js) `next build` command into machine readable JSON, to fit whatever needs you may have.\n\n# Usage\n\n## 💻 As a CLI\n\nAssuming you have a `build` package.json script that runs `next build`, you can run:\n\n```bash\nnpm run build \u003e next-build.txt\nnpx next-build-parser next-build.txt\n```\n\nThis will output a JSON object to stdout. If you would like to output it to a file, you can run:\n\n```bash\nnpx next-build-parser next-build.txt --output output.json\n```\n\nFor other CLI options, run:\n\n```bash\nnpx next-build-parser --help\n```\n\n## 📦 In Code\n\nFirst, install the package, and then run `next build` to generate the output file:\n\n```bash\nnpm install next-build-parser\nnpm run build \u003e next-build.txt\n```\n\nThen you can use it in your code:\n\n```typescript\nimport { parse } from 'next-build-parser';\nimport { readFileSync } from 'node:fs';\n\nconst file = readFileSync('next-build.txt', 'utf8');\nconst output = parse(file, {\n  unit: 'MB',\n});\nconsole.log(output);\n```\n\nor using the more convenient `parseFile` function:\n\n```typescript\nimport { parseFile } from 'next-build-parser';\n\nconst output = parseFile('next-build.txt', {\n  unit: 'MB',\n});\nconsole.log(output);\n```\n\n## ➡️ Output\n\nThe output is a JSON object with the following structure:\n\n```typescript\ntype Output = {\n  routes: {\n    name: string; // The name of the route, e.g. /blog\n    type: string; // The type of the route, e.g. Dynamic, Static, etc.\n    icon: string; // The icon of the route type, e.g. λ\n    size: number; // The gzipped size of the route in the specified unit, e.g. 1000\n    firstLoad: number; // The gzipped size of the first load JS in the specified unit, e.g. 1000\n  }[];\n  shared: {\n    name: string; // The name of the chunk, e.g. chunks/472-9100b5fcfec8f88c.js\n    size: number; // The gzipped size of the chunk in the specified unit, e.g. 1000\n  }[];\n  sharedTotal: number; // The total gzipped size of all the shared chunks in the specified unit, e.g. 1000\n  unit: string; // The unit of the size, e.g. B, KB, MB, etc\n  middleware?: number; // The gzipped size of the middleware in the specified unit, e.g. 1000\n};\n```\n\n# FAQs\n\n- What is the difference between `firstLoad` and `size`?\n\n  `size` is the gzipped size of the route only, assuming the user has already downloaded the shared JS.\n  This is representative of the download size for a user that has already visited another route, but is visiting this one for the first time.\n\n  `firstLoad` is the total gzipped size of that route, which includes the shared JS. Other included files are typically shared layout files.\n  This is representative of the download size for a user that is visiting this route for the first time, and has not visited any other route before this.\n\n- Why isn't `firstLoad` the sum of `size` and `sharedTotal`?\n\n  This is usually because there is some other JS included in `sharedTotal` but not exclusive to this route, for example any client-side JS in Next.js layout files.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblairmcalpine%2Fnext-build-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblairmcalpine%2Fnext-build-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblairmcalpine%2Fnext-build-parser/lists"}