{"name":"webpack-manifest-plugin","version":"5.0.1","author":{"name":"Dane Thurber","email":"dane.thurber@gmail.com"},"license":"MIT","_id":"webpack-manifest-plugin@5.0.1","maintainers":[{"name":"danethurber","email":"dane.thurber@gmail.com"},{"name":"shellscape","email":"andrew@shellscape.org"}],"homepage":"https://github.com/shellscape/webpack-manifest-plugin","bugs":{"url":"https://github.com/shellscape/webpack-manifest-plugin/issues"},"ava":{"files":["!**/fixtures/**","!**/helpers/**","!**/output/**"]},"nyc":{"exclude":["test/"],"include":["src/*.ts"]},"dist":{"shasum":"8d401fec7fa587cba5af561eb60e39d6a8050e8a","tarball":"http://registry-npm.ywwl.com/webpack-manifest-plugin/download/webpack-manifest-plugin-5.0.1.tgz","fileCount":12,"integrity":"sha512-xTlX7dC3hrASixA2inuWFMz6qHsNi6MT3Uiqw621sJjRTShtpMjbDYhPPZBwWUKdIYKIjSq9em6+uzWayf38aQ==","signatures":[{"sig":"MEUCIFcbQNsGom0phPxc5ORohtVUNG4vFB4gUQGhdv3UQkRSAiEAocOxguX91drKCiGA4GMiFxya3Pe/vPWahf3dPZxFowU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36816,"size":11306,"noattachment":false,"key":"/webpack-manifest-plugin/-/webpack-manifest-plugin-5.0.1.tgz"},"jest":{"collectCoverage":true,"testEnvironment":"node","coverageDirectory":"./coverage/"},"main":"dist/index.js","husky":{"hooks":{"pre-commit":"lint-staged"}},"types":"./dist/index.d.ts","engines":{"node":">=14"},"gitHead":"b87cabc87794bafc4cb7118c723bd5cab525e1d1","scripts":{"lint":"pnpm lint:docs && pnpm lint:json && pnpm lint:js","test":"ava --timeout=2m","build":"tsc --project tsconfig.json","ci:lint":"pnpm lint && pnpm security","ci:test":"pnpm test -- --verbose","lint:js":"eslint --cache --fix --cache src test","prepare":"husky install","pretest":"pnpm install && pnpm build","security":"pnpm audit --audit-level=high --prod","lint:docs":"prettier --write README.md","lint:json":"prettier --write codecov.yml package.json","ci:coverage":"nyc pnpm ci:test && nyc report --reporter=text-lcov > coverage.lcov","lint-staged":"lint-staged","prepublishOnly":"pnpm lint && pnpm build"},"_npmUser":{"name":"shellscape","email":"andrew@shellscape.org"},"pre-commit":"lint-staged","repository":{"url":"git+https://github.com/shellscape/webpack-manifest-plugin.git","type":"git"},"_npmVersion":"10.2.4","description":"A Webpack Plugin for generating Asset Manifests","directories":{},"lint-staged":{"*.js":["eslint --fix"]},"_nodeVersion":"18.19.1","dependencies":{"tapable":"^2.0.0","webpack-sources":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"ava":"^5.1.0","del":"^6.0.0","nyc":"^15.1.0","husky":"8.0.2","react":"^16.3.2","tslib":"^2.3.0","codecov":"^3.1.0","ts-node":"^10.1.0","webpack":"^5.75.0","prettier":"^2.1.2","memory-fs":"^0.4.1","@ava/babel":"^1.0.1","pre-commit":"^1.2.2","typescript":"^4.9.4","@types/node":"^16.4.3","file-loader":"^6.2.0","lint-staged":"11.1.1","style-loader":"^0.23.0","@svgr/webpack":"^5.4.0","webpack-merge":"^5.8.0","@types/webpack":"^5.28.0","@commitlint/cli":"^13.1.0","copy-webpack-plugin":"^6.2.1","@types/webpack-sources":"^2.1.1","prettier-plugin-package":"^1.2.0","eslint-config-shellscape":"^6.0.0","@commitlint/config-conventional":"^13.1.0","@wordpress/dependency-extraction-webpack-plugin":"^3.1.0"},"peerDependencies":{"webpack":"^5.75.0"},"_npmOperationalInternal":{"tmp":"tmp/webpack-manifest-plugin_5.0.1_1741735078344_0.9239700236507926","host":"s3://npm-registry-packages-npm-production"},"readme":"[size]: https://packagephobia.now.sh/badge?p=webpack-manifest-plugin\n[size-url]: https://packagephobia.now.sh/result?p=webpack-manifest-plugin\n\n<div align=\"center\">\n\t<img width=\"256\" src=\"https://raw.githubusercontent.com/shellscape/webpack-manifest-plugin/master/assets/manifest.svg?sanitize=true\" alt=\"webpack-manfiest-plugin\"><br/><br/>\n</div>\n\n[![size][size]][size-url]\n[![libera manifesto](https://img.shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com)\n\n# webpack-manifest-plugin\n\nA Webpack plugin for generating an asset manifest.\n\n:heart: Please consider [Sponsoring my work](https://github.com/sponsors/shellscape)\n\n## Requirements\n\n`webpack-manifest-plugin` is an [evergreen 🌲](./.github/FAQ.md#what-does-evergreen-mean) module.\n\nThis module now requires Node.js v20.19.0 or newer and Webpack v5.0.0.\n\n## Contributing\n\nThis repository leverages [pnpm](https://pnpm.js.org/) for dependency management.\n\nTo begin, please install `pnpm`:\n\n```console\n$ npm install pnpm -g\n```\n\n## Install\n\nUsing npm:\n\n```console\nnpm install webpack-nano webpack-manifest-plugin --save-dev\n```\n\n_Note: We recommend using [webpack-nano](https://github.com/shellscape/webpack-nano), a very tiny, very clean webpack CLI._\n\n## Usage\n\nCreate a `webpack.config.js` or `webpack.config.mjs` file (ESM):\n\n```js\nimport { WebpackManifestPlugin } from 'webpack-manifest-plugin';\n\nexport default {\n  // an example entry definition\n  entry: ['app.js'],\n  // ...\n  plugins: [new WebpackManifestPlugin(/* options */)]\n};\n```\n\nAnd run `webpack`:\n\n```console\n$ npx wp\n```\n\nWith the default options, the example above will create a `manifest.json` file in the output directory for the build. The manifest file will contain a map of source filenames to the corresponding build output file. e.g.\n\n```json\n{\n  \"dist/batman.js\": \"dist/batman.1234567890.js\",\n  \"dist/joker.js\": \"dist/joker.0987654321.js\"\n}\n```\n\n### Options\n\n### `assetHookStage`\n\nType: `Number`<br>\nDefault: `Infinity`\n\nIf you need to consume the output of this plugin in another plugin, it can be useful to adjust the stage at which the manifest is generated. Pass a new stage to `assetHookStage` to change when the manifest is generated. See the [docs on `processAssets`](https://webpack.js.org/api/compilation-hooks/#list-of-asset-processing-stages) for more detail.\n\nNote: any files added to the compilation after the stage specified will not be included in the manifest.\n\n### `basePath`\n\nType: `String`<br>\nDefault: `''`\n\nSpecifies a path prefix for all keys in the manifest. Useful for including your output path in the manifest.\n\n### `fileName`\n\nType: `String`<br>\nDefault: `manifest.json`\n\nSpecifies the file name to use for the resulting manifest. By default the plugin will emit `manifest.json` to your output directory. Passing an absolute path to the `fileName` option will override both the file name and path.\n\n### `filter`\n\nType: `Function`<br>\nDefault: `undefined`\n\nAllows filtering the files which make up the manifest. The passed function should match the signature of `(file: FileDescriptor) => Boolean`. Return `true` to keep the file, `false` to remove the file.\n\n### `generate`\n\nType: `Function`<br>\nDefault: `undefined`\n\nA custom `Function` to create the manifest. The passed function should match the signature of `(seed: Object, files: FileDescriptor[], entries: string[]) => Object` and can return anything as long as it's serialisable by `JSON.stringify`.\n\n### `map`\n\nType: `Function`<br>\nDefault: `undefined`\n\nAllows modifying the files which make up the manifest. The passed function should match the signature of `(file: FileDescriptor) => FileDescriptor` where an object matching `FileDescriptor` is returned.\n\n### `publicPath`\n\nType: `String`<br>\nDefault: `<webpack-config>.output.publicPath`\n\nA path prefix that will be added to values of the manifest.\n\n### `removeKeyHash`\n\nType: `RegExp | false`<br>\nDefault: `/([a-f0-9]{32}\\.?)/gi`\n\nIf set to a valid `RegExp`, removes hashes from manifest keys. e.g.\n\n```json\n{\n  \"index.c5a9bff71fdfed9b6046.html\": \"index.c5a9bff71fdfed9b6046.html\"\n}\n```\n\n```json\n{\n  \"index.html\": \"index.c5a9bff71fdfed9b6046.html\"\n}\n```\n\nThe default value for this option is a regular expression targeting Webpack's [default md5 hash](https://webpack.js.org/configuration/output/#outputhashfunction). To target other hashing functions / algorithms, set this option to an appropriate `RegExp`. To disable replacing the hashes in key names, set this option to `false`.\n\n### `seed`\n\nType: `Object`<br>\nDefault: `{}`\n\nA cache of key/value pairs used to seed the manifest. This may include a set of [custom key/value](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json) pairs to include in your manifest, or may be used to combine manifests across compilations in [multi-compiler mode](https://github.com/webpack/webpack/tree/master/examples/multi-compiler). To combine manifests, pass a shared seed object to each compiler's `WebpackManifestPlugin` instance.\n\n### `serialize`\n\nType: `Function(Object) => string`<br>\nDefault: `undefined`\n\nA `Function` which can be leveraged to serialize the manifest in a different format than json. e.g. `yaml`.\n\n### `sort`\n\nType: `Function`<br>\nDefault: `undefined`\n\nAllows sorting the files which make up the manifest. The passed function should match the signature of `(fileA: FileDescriptor, fileB: FileDescriptor) => Number`. Return `0` to indicate no change, `-1` to indicate the file should be moved to a lower index, and `1` to indicate the file shoud be moved to a higher index.\n\n### `useEntryKeys`\n\nType: `Boolean`<br>\nDefault: `false`\n\nIf `true`, the keys specified in the `entry` property will be used as keys in the manifest. No file extension will be added (unless specified as part of an `entry` property key).\n\n### `useLegacyEmit`\n\nType: `Boolean`<br>\nDefault: `false`\n\nIf `true`, the manifest will be written on the deprecated webpack `emit` hook to be compatible with not yet updated webpack plugins.\n\nA lot of webpack plugins are not yet updated to match the new webpack 5 API. This is a problem when other plugins use the deprecated `emit` hook. The manifest will be written before these other plugins and thus files are missing on the manifest.\n\n### `writeToFileEmit`\n\nType: `Boolean`<br>\nDefault: `false`\n\nIf `true`, will emit the manifest to the build directory _and_ in memory for compatibility with `webpack-dev-server`.\n\n## Manifest File Descriptor\n\nThis plugin utilizes the following object structure to work with files. Many options for this plugin utilize the structure below.\n\n```ts\n{\n  chunk?: Chunk;\n  isAsset: boolean;\n  isChunk: boolean;\n  isInitial: boolean;\n  isModuleAsset: boolean;\n  name: string | null;\n  path: string;\n}\n```\n\n### `chunk`\n\nType: [`Chunk`](https://github.com/webpack/webpack/blob/master/lib/Chunk.js)\n\nOnly available if `isChunk` is `true`\n\n### `isInitial`\n\nType: `Boolean`\n\nIs required to run you app. Cannot be `true` if `isChunk` is `false`.\n\n### `isModuleAsset`\n\nType: `Boolean`\n\nIs required by a module. Cannot be `true` if `isAsset` is `false`.\n\n## Compiler Hooks\n\nThis plugin supports the following hooks via the `getCompilerHooks` export; `afterEmit`, `beforeEmit`. These hooks can be useful, e.g. changing manifest contents before emitting to disk.\n\n### `getCompilerHooks`\n\nReturns: `{ afterEmit: SyncWaterfallHook, beforeEmit: SyncWaterfallHook }`\n\n#### Usage\n\n```js\nconst { getCompilerHooks } = require('webpack-manifest-plugin');\n\nclass BatmanPlugin {\n  apply(compiler) {\n    const { beforeEmit } = getCompilerHooks(compiler);\n\n    beforeEmit.tap('BatmanPlugin', (manifest) => {\n      return { ...manifest, name: 'hello' };\n    });\n  }\n}\n```\n\n## Notes\n\n- If using this plugin with `webpack-clean` and `webpack-dev-server`, please review [this issue](https://github.com/shellscape/webpack-manifest-plugin/issues/267).\n\n## Attiribution\n\nSpecial thanks to [Dane Thurber](https://github.com/danethurber), the original author of this plugin, without whom this plugin would not exist.\n\n## Meta\n\n[CONTRIBUTING](./.github/CONTRIBUTING.md)\n\n[LICENSE (MIT)](./LICENSE)\n","publish_time":1741735078492,"_cnpm_publish_time":1741735078492,"dist-tags":{"beta":"1.1.0-0","latest":"6.0.1","next":"3.0.0-rc.0"}}