{"_id":"@budingxiaocai/pages-webpack-plugin","_rev":"2-b1050578d2406ae1d4df5ab9514b7d03","name":"@budingxiaocai/pages-webpack-plugin","dist-tags":{"latest":"0.2.2"},"versions":{"0.2.1":{"name":"@budingxiaocai/pages-webpack-plugin","version":"0.2.1","keywords":["javascript","webpack","webpack-plugin","webpack5","webpack5-plugin","multi-pages"],"author":{"name":"budingxiaocai","email":"budingxiaocai@yeah.net"},"license":"MIT","_id":"@budingxiaocai/pages-webpack-plugin@0.2.1","maintainers":[{"name":"budingxiaocai","email":"budingxiaocai@yeah.net"}],"homepage":"https://github.com/budingxiaocai/pages-webpack-plugin","bugs":{"url":"https://github.com/budingxiaocai/pages-webpack-plugin/issues"},"dist":{"shasum":"5034f2140f2db3fe4ec7fd3b1a7b7faa97bbb8c7","tarball":"https://registry.npmjs.org/@budingxiaocai/pages-webpack-plugin/-/pages-webpack-plugin-0.2.1.tgz","fileCount":8,"integrity":"sha512-Z/FS7Pgn8WAZl3uBerTWGqG+LC37iLetixuPj5U74BPcfds6fBuhpQVdki25oaxf21CCW0egYw2TjtbtM8tRpA==","signatures":[{"sig":"MEUCIQDx2h68JjZ8FzOJGmPJPAC2JGz9TVecqu5n4TcBURz4PAIgGF61u+HlMQ0zl7gXewUpbepPZGD242/K4WRlWYt7pbo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12793},"main":"lib/index.js","gitHead":"9e414cf47ddd3b73d8349965b718567eae74b64c","scripts":{"lint":"eslint src/**/*.js","prepare":"husky"},"_npmUser":{"name":"budingxiaocai","email":"budingxiaocai@yeah.net"},"repository":{"url":"git+https://github.com/budingxiaocai/pages-webpack-plugin.git","type":"git"},"_npmVersion":"10.9.3","description":"用于自动化多页面应用构建的 Webpack 插件 / Webpack plugin for automating the construction of multi page applications","directories":{},"lint-staged":{"*.js":["eslint --fix","prettier --write"]},"_nodeVersion":"22.18.0","dependencies":{"globals":"^16.3.0","webpack":"^5.101.3","fast-glob":"^3.3.3","webpack-merge":"^6.0.1","html-webpack-plugin":"*"},"_hasShrinkwrap":false,"packageManager":"yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e","devDependencies":{"husky":"^9.1.7","eslint":"^9.33.0","prettier":"^3.6.2","@eslint/js":"^9.33.0","lint-staged":"^16.1.5","@eslint/compat":"^1.3.2","@eslint/eslintrc":"^3.3.1","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4"},"_npmOperationalInternal":{"tmp":"tmp/pages-webpack-plugin_0.2.1_1755778519180_0.40920546739729136","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@budingxiaocai/pages-webpack-plugin","description":"用于自动化多页面应用构建的 Webpack 插件 / Webpack plugin for automating the construction of multi page applications","version":"0.2.2","keywords":["javascript","webpack","webpack-plugin","webpack5","webpack5-plugin","multi-pages"],"homepage":"https://github.com/budingxiaocai/pages-webpack-plugin","main":"lib/index.js","license":"MIT","author":{"name":"budingxiaocai","email":"budingxiaocai@yeah.net"},"scripts":{"lint":"eslint src/**/*.js","prepare":"husky"},"lint-staged":{"*.js":["eslint --fix","prettier --write"]},"bugs":{"url":"https://github.com/budingxiaocai/pages-webpack-plugin/issues"},"packageManager":"yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e","dependencies":{"fast-glob":"^3.3.3","globals":"^16.3.0","html-webpack-plugin":"*","webpack":"^5"},"devDependencies":{"@eslint/compat":"^1.3.2","@eslint/eslintrc":"^3.3.1","@eslint/js":"^9.33.0","eslint":"^9.33.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4","husky":"^9.1.7","lint-staged":"^16.1.5","prettier":"^3.6.2"},"repository":{"type":"git","url":"git+https://github.com/budingxiaocai/pages-webpack-plugin.git"},"_id":"@budingxiaocai/pages-webpack-plugin@0.2.2","gitHead":"a47b45a6bf0c4cd0faf6639de2ae2f13fadca182","_nodeVersion":"22.18.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-4f6aq3RndEpSV032+D4yuAY1HTEuc++6L0/3FqqnD+Ba1cnyy5YDRHy7+hJdAosTPknhiYJMGrGtyoLMU1dEPA==","shasum":"67898e9409144975d77e3ae56ba48191d6bde06a","tarball":"https://registry.npmjs.org/@budingxiaocai/pages-webpack-plugin/-/pages-webpack-plugin-0.2.2.tgz","fileCount":8,"unpackedSize":12756,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDxyVX3nyfArD0uCFb81DYaRjsbewcSBa2gcQd/lPCzdwIhAIb8ZDr/5rz67b89857ADgOtPQkppeiV7yB7KrX/u31n"}]},"_npmUser":{"name":"budingxiaocai","email":"budingxiaocai@yeah.net"},"directories":{},"maintainers":[{"name":"budingxiaocai","email":"budingxiaocai@yeah.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pages-webpack-plugin_0.2.2_1755779065414_0.025032536041960318"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-21T12:15:19.064Z","modified":"2025-08-21T12:24:25.867Z","0.2.1":"2025-08-21T12:15:19.658Z","0.2.2":"2025-08-21T12:24:25.603Z"},"bugs":{"url":"https://github.com/budingxiaocai/pages-webpack-plugin/issues"},"author":{"name":"budingxiaocai","email":"budingxiaocai@yeah.net"},"license":"MIT","homepage":"https://github.com/budingxiaocai/pages-webpack-plugin","keywords":["javascript","webpack","webpack-plugin","webpack5","webpack5-plugin","multi-pages"],"repository":{"type":"git","url":"git+https://github.com/budingxiaocai/pages-webpack-plugin.git"},"description":"用于自动化多页面应用构建的 Webpack 插件 / Webpack plugin for automating the construction of multi page applications","maintainers":[{"name":"budingxiaocai","email":"budingxiaocai@yeah.net"}],"readme":"# PagesPlugin\r\n\r\n[中文](https://github.com/budingxiaocai/pages-webpack-plugin/blob/master/README-CN.md)\r\n\r\nPagesPlugin is a Webpack plugin that automates multi-page application builds. It scans directory structures and dynamically generates entry points and HTML files. It supports flexible configuration, pseudo-static routing, and integrates with `.pagerc.json` for per-page customization.\r\n\r\n## Features\r\n- Zero-config: Pages are generated automatically from directory names\r\n- Compact in size, rich in features\r\n- Dynamic routes: Directories named `[id]` are mapped to `/@id@.html?id=`\r\n- Per-page config: `.pagerc.json` overrides global settings for a single page\r\n\r\n## Install\r\n```bash\r\nnpm i -D pages-webpack-plugin\r\n# or\r\nyarn add -D pages-webpack-plugin\r\n```\r\n\r\n## Quick Start\r\n1. Create `webpack.config.js` in the project root:\r\n```javascript\r\nconst PagesPlugin = require('pages-plugin-webpack');\r\n\r\nmodule.exports = {\r\n  // ...\r\n  plugins: [\r\n    new PagesPlugin({\r\n      scanDir: './src/pages',        // optional, defaults to src\r\n      entryName: 'index.{tsx,jsx}'   // optional, defaults to index.{vue,tsx,jsx,html}\r\n      // any other html-webpack-plugin options are allowed\r\n    })\r\n  ]\r\n};\r\n```\r\n\r\n2. Create the following directory structure:\r\n```\r\nsrc/pages/\r\n├── home/\r\n│   └── index.tsx\r\n├── about/\r\n│   └── index.jsx\r\n└── user/\r\n    └── [id]/\r\n        └── index.tsx\r\n```\r\n\r\n3. Run `yarn build` to obtain:\r\n- `home.html`\r\n- `about.html`\r\n- `user/@id@.html` (accessible at `/user/[id]`)\r\n\r\n## Directory Conventions\r\n| Directory example       | \tGenerated route            | Description            |\r\n| ----------- | --------------- | ------------- |\r\n| `home`      | `/home.html`    | Static page         |\r\n| `[id]`      | `/@id@.html?id=`     | Dynamic route (param `id`) |\r\n\r\n## Plugin Options\r\nYou can pass the following fields when instantiating the plugin:\r\n| Field          | Type       | \tDefault                        | \tDescription            |\r\n| ----------- | -------- | -------------------------- | ------------- |\r\n| `scanDir`   | `string` | `src`                      | Root directory to scan pages       |\r\n| `entryName` | `string` | `index.{vue,tsx,jsx,html}` | Entry filename glob pattern |\r\n\r\nAny option supported by [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin#options) is also accepted.\r\n\r\n## Per-Page Config: `.pagerc.json`\r\nPlace `.pagerc.json` inside any page directory to override global settings (except scanDir):\r\n```json\r\n{\r\n  \"entryName\": \"main.tsx\"\r\n  // any other html-webpack-plugin options\r\n}\r\n```\r\n\r\n## Dynamic Routes (Pseudo-Static)\r\n\r\n### Static page mapping\r\nUse an `.htaccess` or Nginx snippet to internally rewrite `/user` to `/user.html`:\r\n```\r\nlocation / {\r\n    try_files $uri $uri.html =404;\r\n}\r\n```\r\n\r\n### Dynamic routes\r\n- Wrap directory names with `[]`, e.g. `[id]`, `[slug]`\r\n- The build outputs: `/user/@id@.html`\r\n- A matching `.htaccess` / Nginx snippet is auto-generated:\r\n```\r\nlocation ~ ^/user/([^/]+)/?$ {\r\n    rewrite ^/user/([^/]+)/?$ /user/@id@.html?id=$1 break;\r\n}\r\n```\r\n","readmeFilename":"README.md"}