{"_id":"next-build-parser","_rev":"3-c732643e1d863b30631390825e9ea534","name":"next-build-parser","dist-tags":{"latest":"1.3.0"},"versions":{"1.0.1":{"name":"next-build-parser","version":"1.0.1","keywords":["nextjs","next.js","next","build","parse"],"author":{"url":"https://github.com/blairmcalpine","name":"Blair McAlpine"},"license":"MIT","_id":"next-build-parser@1.0.1","maintainers":[{"name":"blairmcalpine","email":"blair.mcalpine77@gmail.com"}],"homepage":"https://github.com/blairmcalpine/next-build-parser","bugs":{"url":"https://github.com/blairmcalpine/next-build-parser/issues"},"bin":{"next-build-parser":"dist/cli.js"},"dist":{"shasum":"0f4e95312e4adb78d4634cac48bc90fbc1db8603","tarball":"https://registry.npmjs.org/next-build-parser/-/next-build-parser-1.0.1.tgz","fileCount":21,"integrity":"sha512-4lzWpQPRxr48uU66Kv0J5t1PQhYnQCybNWF+bKmBteaJGH6aQI3NsNlK9Xd6kLUFMe8UJNjx6ifSFD9oQ9kUYg==","signatures":[{"sig":"MEQCIGeWiZYpwAHVHruAfdnH8Mpj2Y4cTbPH26xpQVeBoBYfAiA87Yu+TOI7Dc6gaR2DuQteUCaxtXLsIBV0T2NLuIySig==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24954},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"17acd8146c6787761475855829abe238b49fc1a8","scripts":{"ci":"npm run build && npm run format:check && npm run exports:check && npm run test","test":"vitest run","build":"tsc","format":"prettier --write .","format:check":"prettier --check .","exports:check":"attw --pack . --ignore-rules=cjs-resolves-to-esm","release:local":"changeset version && changeset publish","prepublishOnly":"npm run ci"},"_npmUser":{"name":"blairmcalpine","email":"blair.mcalpine77@gmail.com"},"repository":{"url":"git+https://github.com/blairmcalpine/next-build-parser.git","type":"git"},"_npmVersion":"10.5.0","description":"Parse the output of next build into machine readable JSON","directories":{},"_nodeVersion":"20.12.0","dependencies":{"zod":"^3.23.8"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.1","vitest":"^2.1.2","prettier":"^3.3.3","typescript":"^5.6.3","@types/node":"^22.7.5","@changesets/cli":"^2.27.9","@arethetypeswrong/cli":"^0.16.4"},"_npmOperationalInternal":{"tmp":"tmp/next-build-parser_1.0.1_1728789464617_0.12761535388036926","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"next-build-parser","version":"1.1.0","keywords":["nextjs","next.js","next","build","parse"],"author":{"url":"https://github.com/blairmcalpine","name":"Blair McAlpine"},"license":"MIT","_id":"next-build-parser@1.1.0","maintainers":[{"name":"blairmcalpine","email":"blair.mcalpine77@gmail.com"}],"homepage":"https://github.com/blairmcalpine/next-build-parser","bugs":{"url":"https://github.com/blairmcalpine/next-build-parser/issues"},"bin":{"next-build-parser":"dist/cli.js"},"dist":{"shasum":"284bbba8199de0915abd9e463e3b375e77631453","tarball":"https://registry.npmjs.org/next-build-parser/-/next-build-parser-1.1.0.tgz","fileCount":21,"integrity":"sha512-ESSdEUEejdxAEBy78mdP45J8Yg3W6xAvLhY7HP5HwzrbecMyqkJiIBdCY/tBhZu2RsFfFAq9eWjVVYMo3Px90g==","signatures":[{"sig":"MEUCIFKxKO+Agsb450M8vXvZRdTKOOBqppbZO+Xhj8mCeHHOAiEAvP+dbUPHVEc50+wfy3MywcsmwkmEZ8YXOq1IbWczjVk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25359},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"44510c7fa37a95b9015de20ee31df774c00d68f9","scripts":{"ci":"npm run build && npm run format:check && npm run exports:check && npm run test","test":"vitest run","build":"tsc","format":"prettier --write .","format:check":"prettier --check .","exports:check":"attw --pack . --ignore-rules=cjs-resolves-to-esm","release:local":"changeset version && changeset publish","prepublishOnly":"npm run ci"},"_npmUser":{"name":"blairmcalpine","email":"blair.mcalpine77@gmail.com"},"repository":{"url":"git+https://github.com/blairmcalpine/next-build-parser.git","type":"git"},"_npmVersion":"10.5.0","description":"Parse the output of next build into machine readable JSON.","directories":{},"_nodeVersion":"20.12.0","dependencies":{"zod":"^3.23.8","commander":"^12.1.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.2","prettier":"^3.3.3","typescript":"^5.6.3","@types/node":"^22.7.5","@changesets/cli":"^2.27.9","@arethetypeswrong/cli":"^0.16.4"},"_npmOperationalInternal":{"tmp":"tmp/next-build-parser_1.1.0_1728932011276_0.7153915580429127","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"next-build-parser","version":"1.2.0","keywords":["nextjs","next.js","next","build","parse"],"author":{"url":"https://github.com/blairmcalpine","name":"Blair McAlpine"},"license":"MIT","_id":"next-build-parser@1.2.0","maintainers":[{"name":"blairmcalpine","email":"blair.mcalpine77@gmail.com"}],"homepage":"https://github.com/blairmcalpine/next-build-parser","bugs":{"url":"https://github.com/blairmcalpine/next-build-parser/issues"},"bin":{"next-build-parser":"dist/cli.js"},"dist":{"shasum":"8669d6ea394692be50e0c7b6bd0e5d5bfbb74e24","tarball":"https://registry.npmjs.org/next-build-parser/-/next-build-parser-1.2.0.tgz","fileCount":24,"integrity":"sha512-avSdfUhYMV/vRHaGPcFSTn+cj1mw3D6zNmyxc33sH5x9JCreg/5ccWSa3kQmztH6tRKTVhcMN4UjkhCg+khdvA==","signatures":[{"sig":"MEUCIFQBcDrUV/AfV9QrjpsqhZhudvbWYPJOB6OfVcXhZUWzAiEAmRkbBF0dHy1Qm44939d7+JLRjWwqat/YQWgFnHnGrps=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26425},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"241e2584d0a77f6b87240b6f2720dfd67e58bbd4","scripts":{"ci":"npm run build && npm run format:check && npm run exports:check && npm run test","test":"vitest run","build":"tsc","format":"prettier --write .","prepare":"husky","format:check":"prettier --check .","exports:check":"attw --pack . --ignore-rules=cjs-resolves-to-esm","release:local":"changeset version && changeset publish","prepublishOnly":"npm run ci"},"_npmUser":{"name":"blairmcalpine","email":"blair.mcalpine77@gmail.com"},"repository":{"url":"git+https://github.com/blairmcalpine/next-build-parser.git","type":"git"},"_npmVersion":"10.5.0","description":"Parse the output of next build into machine readable JSON.","directories":{},"_nodeVersion":"20.12.0","dependencies":{"zod":"^3.23.8","commander":"^12.1.0"},"_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.6","vitest":"^2.1.2","prettier":"^3.3.3","typescript":"^5.6.3","@types/node":"^22.7.5","@changesets/cli":"^2.27.9","@arethetypeswrong/cli":"^0.16.4"},"simple-git-hooks":{"pre-commit":"npx pretty-quick --staged"},"_npmOperationalInternal":{"tmp":"tmp/next-build-parser_1.2.0_1728935000407_0.7199395292234594","host":"s3://npm-registry-packages"}},"1.3.0":{"name":"next-build-parser","version":"1.3.0","description":"Parse the output of next build into machine readable JSON.","keywords":["nextjs","next.js","next","build","parse"],"homepage":"https://github.com/blairmcalpine/next-build-parser","bugs":{"url":"https://github.com/blairmcalpine/next-build-parser/issues"},"author":{"name":"Blair McAlpine","url":"https://github.com/blairmcalpine"},"repository":{"type":"git","url":"git+https://github.com/blairmcalpine/next-build-parser.git"},"main":"./dist/index.js","bin":{"next-build-parser":"dist/cli.js"},"exports":{"./package.json":"./package.json",".":{"import":"./dist/index.js","default":"./dist/index.cjs"}},"type":"module","license":"MIT","scripts":{"build":"tsup","ci":"npm run build && npm run format:check && npm run exports:check && npm run test","exports:check":"attw --pack .","format":"prettier --write .","format:check":"prettier --check .","prepublishOnly":"npm run ci","release:local":"changeset version && changeset publish","test":"vitest run","prepare":"husky"},"devDependencies":{"@arethetypeswrong/cli":"^0.16.4","@changesets/cli":"^2.27.9","@types/node":"^22.7.5","husky":"^9.1.6","prettier":"^3.3.3","tsup":"^8.3.5","typescript":"^5.6.3","vitest":"^2.1.2"},"dependencies":{"commander":"^12.1.0","zod":"^3.23.8"},"_id":"next-build-parser@1.3.0","gitHead":"624fc0f9d6f041579377f4c508b3646e283fa370","types":"./dist/index.d.ts","_nodeVersion":"22.11.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-PxuXdt437XFbgeMpiDLvzxAY5jPfFlTOVDqGAEfvvzmT0gx6tLorlmFVCxCC2+qdREhC0GS2TWPlkGxr3PD35Q==","shasum":"0ff64e5cebb05ea30138178ba9da9743a61a5f79","tarball":"https://registry.npmjs.org/next-build-parser/-/next-build-parser-1.3.0.tgz","fileCount":7,"unpackedSize":22647,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDP2OpLC1WotpG3ZRqXWyZOdkL5wvPzkoOorXCu3nKy1QIhAIOW6vINGyMwzNG1Y24ILlGt/2Rt4hUbeHawSvp7PRWA"}]},"_npmUser":{"name":"blairmcalpine","email":"blair.mcalpine77@gmail.com"},"directories":{},"maintainers":[{"name":"blairmcalpine","email":"blair.mcalpine77@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/next-build-parser_1.3.0_1734470809798_0.8065733993746256"},"_hasShrinkwrap":false}},"time":{"created":"2024-10-13T03:17:44.524Z","modified":"2024-12-17T21:26:50.236Z","1.0.1":"2024-10-13T03:17:44.797Z","1.1.0":"2024-10-14T18:53:31.487Z","1.2.0":"2024-10-14T19:43:20.574Z","1.3.0":"2024-12-17T21:26:50.034Z"},"bugs":{"url":"https://github.com/blairmcalpine/next-build-parser/issues"},"author":{"name":"Blair McAlpine","url":"https://github.com/blairmcalpine"},"license":"MIT","homepage":"https://github.com/blairmcalpine/next-build-parser","keywords":["nextjs","next.js","next","build","parse"],"repository":{"type":"git","url":"git+https://github.com/blairmcalpine/next-build-parser.git"},"description":"Parse the output of next build into machine readable JSON.","maintainers":[{"name":"blairmcalpine","email":"blair.mcalpine77@gmail.com"}],"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 > 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 > 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 alreaedy 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","readmeFilename":"README.md"}