{"_id":"@brunoimbrizi/vite-plugin-static-copy","_rev":"1-fa203cdfcdb3ae1632b956a22f94678a","name":"@brunoimbrizi/vite-plugin-static-copy","dist-tags":{"latest":"0.15.0"},"versions":{"0.13.0":{"name":"@brunoimbrizi/vite-plugin-static-copy","version":"0.13.0","description":"rollup-plugin-copy for vite with dev server support.","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"type":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"engines":{"node":"^14.18.0 || >=16.0.0"},"scripts":{"dev":"tsup --watch","build":"tsup","lint":"eslint --cache .","format":"prettier --write --cache .","type-check":"tsc --noEmit","test":"vitest"},"repository":{"type":"git","url":"git+https://github.com/sapphi-red/vite-plugin-static-copy.git"},"keywords":["vite","vite-plugin"],"author":{"name":"sapphi-red","url":"https://github.com/sapphi-red"},"license":"MIT","bugs":{"url":"https://github.com/sapphi-red/vite-plugin-static-copy/issues"},"homepage":"https://github.com/sapphi-red/vite-plugin-static-copy#readme","sideEffects":false,"peerDependencies":{"vite":"^3.0.0 || ^4.0.0"},"devDependencies":{"@polka/url":"^1.0.0-next.21","@types/fs-extra":"^9.0.13","@types/node":"^18.11.18","@types/throttle-debounce":"^5.0.0","@typescript-eslint/eslint-plugin":"^5.47.1","@typescript-eslint/parser":"^5.47.1","eslint":"^8.31.0","eslint-config-prettier":"^8.5.0","mrmime":"^1.0.1","node-fetch":"^3.3.0","prettier":"^2.8.1","throttle-debounce":"^5.0.0","tsup":"^6.5.0","typescript":"^4.9.4","vite":"^4.0.3","vitest":"^0.26.2","vitest-github-actions-reporter":"^0.9.0"},"dependencies":{"chokidar":"^3.5.3","fast-glob":"^3.2.11","fs-extra":"^11.1.0","picocolors":"^1.0.0"},"directories":{"test":"test"},"gitHead":"a5b06dc81e9ca1686023d1dd30aeb70389c7ff2c","_id":"@brunoimbrizi/vite-plugin-static-copy@0.13.0","_nodeVersion":"18.12.1","_npmVersion":"9.2.0","dist":{"integrity":"sha512-Ku7gpmTXFyvz7lyKxfPS1zzSQkZBJplqxaqJjBfgGLsWbooVKxRh7J+4UvnO+iACfp/exp6MKvkGMzrVXSwKEg==","shasum":"1e987d40700fcac39a9a95954470e9506bedb1ef","tarball":"https://registry.npmjs.org/@brunoimbrizi/vite-plugin-static-copy/-/vite-plugin-static-copy-0.13.0.tgz","fileCount":6,"unpackedSize":67931,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC4YUu6Atni9wwilWXDzg84NVEnfiNmv7KPD4YjvByacAiATU28zTceeNbejWr6JP/Ghiva4LtVpKCJuSPUFC7vuWA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj39czACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpYphAAhRy5eFABU4i/f6suhdChdeQv/Q4W/iof4Aj2IRFZO0cYODWm\r\nm7L/EmBoSdsHsDEjwU2Td2MrB78Q+y5AoOGN0Iq+jB0aL3juQlm3LMNQDTm7\r\nA5/xRotDneuwPlewhbjaJqE2pDJrg41DWgQAqfMGJ/49CUoe/n0hwrsIkDnR\r\nWUhdtdygBQut7ZUPgHuc0M8a40kP2SZskwDtxYV1JTsyQ1d/oaso8NTNrQUF\r\nY06S1EMKD7iKkg2L2CO2iqwHM3TZN46NeyqmX52EOB10UMm6ELY+gfB00br3\r\n3ehU3cVUrESKicHQjDt1EaE2Ida4hR+oItyMDEX4PciUlQk6WXQ9M9NdcFnK\r\nZlGM8qTJ+9A3mLm5stFT5B3XSLoPfJl4DMuqsSUYzNObqxOJHWKiZmW8++7a\r\nNs4t2x9j08dx6vXMgdbpIsg71WlSIKPk9HQESR+7ZdJQS2gQnoFR+VpjJlHD\r\ndfFg/6reLQ7WoxjEr5e6tAchZYPtqt9ik58xcNbL5TpbdHFz3ZMgm3JmJVgw\r\n1YiIvNoOkbeigmqiTE+Gij7RU3MPVKsa2k1+1jFpPJedHVZBPio/+n3FtwOU\r\notUPO1PjpoS7Fw6hCgnS4la6EfGK6tJMuxK3a1bMMXG8aC1wASz8c4fclD2t\r\nJj5g3qeYtGgurfzSlvV62a0BlNwDG6+VzRU=\r\n=8Wqr\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"brunoimbrizi","email":"bruno.imbrizi@gmail.com"},"maintainers":[{"name":"brunoimbrizi","email":"bruno.imbrizi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-static-copy_0.13.0_1675614003387_0.25684650359388983"},"_hasShrinkwrap":false},"0.15.0":{"name":"@brunoimbrizi/vite-plugin-static-copy","version":"0.15.0","description":"rollup-plugin-copy for vite with dev server support.","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"engines":{"node":"^14.18.0 || >=16.0.0"},"scripts":{"dev":"tsup --watch","build":"tsup","lint":"eslint --cache .","format":"prettier --write --cache .","type-check":"tsc --noEmit","test":"vitest"},"repository":{"type":"git","url":"git+https://github.com/sapphi-red/vite-plugin-static-copy.git"},"keywords":["vite","vite-plugin"],"author":{"name":"sapphi-red","url":"https://github.com/sapphi-red"},"license":"MIT","bugs":{"url":"https://github.com/sapphi-red/vite-plugin-static-copy/issues"},"homepage":"https://github.com/sapphi-red/vite-plugin-static-copy#readme","sideEffects":false,"peerDependencies":{"vite":"^3.0.0 || ^4.0.0"},"devDependencies":{"@polka/url":"^1.0.0-next.21","@types/fs-extra":"^11.0.1","@types/node":"^18.16.8","@types/throttle-debounce":"^5.0.0","@typescript-eslint/eslint-plugin":"^5.59.5","@typescript-eslint/parser":"^5.59.5","eslint":"^8.40.0","eslint-config-prettier":"^8.8.0","eslint-plugin-vitest":"^0.2.2","mrmime":"^1.0.1","node-fetch":"^3.3.1","prettier":"^2.8.8","throttle-debounce":"^5.0.0","tsup":"^6.7.0","typescript":"^5.0.4","vite":"^4.3.5","vitest":"^0.31.0","vitest-github-actions-reporter":"^0.10.0"},"dependencies":{"chokidar":"^3.5.3","fast-glob":"^3.2.11","fs-extra":"^11.1.0","picocolors":"^1.0.0"},"packageManager":"pnpm@7.32.2","gitHead":"df736fca947ab91afd561aec8eb0f49c013d3fad","_id":"@brunoimbrizi/vite-plugin-static-copy@0.15.0","_nodeVersion":"18.12.1","_npmVersion":"9.2.0","dist":{"integrity":"sha512-e1jrgUdOInG0eJ9FbkApduQiJq5I00PjDMxBmKpHLhr8sM9R3tiukJaBOqH5QtzYZoS8zvsg/fH4wI+Y2eYQBA==","shasum":"2c0bf22aa1b1762e13cb7e31317b7f8cc4c51848","tarball":"https://registry.npmjs.org/@brunoimbrizi/vite-plugin-static-copy/-/vite-plugin-static-copy-0.15.0.tgz","fileCount":6,"unpackedSize":73364,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH8Qt6yPXCvK/7RIHYACrqMnyYrfd0FgqX/89Dtg0zRWAiB1hVxYTKfUg1i59QbhsqQ2x/Uy3lGn2/NQHOhYqS5AKg=="}]},"_npmUser":{"name":"brunoimbrizi","email":"bruno.imbrizi@gmail.com"},"directories":{},"maintainers":[{"name":"brunoimbrizi","email":"bruno.imbrizi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-static-copy_0.15.0_1685017239610_0.40914744879466136"},"_hasShrinkwrap":false}},"time":{"created":"2023-02-05T16:20:03.279Z","0.13.0":"2023-02-05T16:20:03.595Z","modified":"2023-05-25T12:20:39.879Z","0.15.0":"2023-05-25T12:20:39.784Z"},"maintainers":[{"name":"brunoimbrizi","email":"bruno.imbrizi@gmail.com"}],"description":"rollup-plugin-copy for vite with dev server support.","homepage":"https://github.com/sapphi-red/vite-plugin-static-copy#readme","keywords":["vite","vite-plugin"],"repository":{"type":"git","url":"git+https://github.com/sapphi-red/vite-plugin-static-copy.git"},"author":{"name":"sapphi-red","url":"https://github.com/sapphi-red"},"bugs":{"url":"https://github.com/sapphi-red/vite-plugin-static-copy/issues"},"license":"MIT","readme":"# vite-plugin-static-copy\r\n\r\n[![npm version](https://badge.fury.io/js/vite-plugin-static-copy.svg)](https://badge.fury.io/js/vite-plugin-static-copy) ![CI](https://github.com/sapphi-red/vite-plugin-static-copy/workflows/CI/badge.svg) [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)\r\n\r\n`rollup-plugin-copy` for Vite with dev server support.\r\n\r\n> **Note**\r\n> Before you use this plugin, consider using [public directory](https://vitejs.dev/guide/assets.html#the-public-directory) or [`import` in JavaScript](https://vitejs.dev/guide/features.html#static-assets).\r\n> In most cases, these will work.\r\n\r\n## Install\r\n\r\n```shell\r\nnpm i -D vite-plugin-static-copy # yarn add -D vite-plugin-static-copy\r\n```\r\n\r\n## Usage\r\n\r\nAdd `viteStaticCopy` plugin to `vite.config.js` / `vite.config.ts`.\r\n\r\n```js\r\n// vite.config.js / vite.config.ts\r\nimport { viteStaticCopy } from 'vite-plugin-static-copy'\r\n\r\nexport default {\r\n  plugins: [\r\n    viteStaticCopy({\r\n      targets: [\r\n        {\r\n          src: 'bin/example.wasm',\r\n          dest: 'wasm-files'\r\n        }\r\n      ]\r\n    })\r\n  ]\r\n}\r\n```\r\n\r\nFor example, if you use the config above, you will be able to fetch `bin/example.wasm` with `fetch('/wasm-files/example.wasm')`.\r\nSo the file will be copied to `dist/wasm-files/example.wasm`.\r\n\r\n> **Warning**\r\n>\r\n> If you are using Windows, make sure to use `normalizePath` after doing `path.resolve` or else.\r\n> `\\` is a escape charactor in `fast-glob` and you should use `/`.\r\n>\r\n> ```js\r\n> import { normalizePath } from 'vite'\r\n> import path from 'node:path'\r\n>\r\n> normalizePath(path.resolve(__dirname, './foo')) // C:/project/foo\r\n>\r\n> // instead of\r\n> path.resolve(__dirname, './foo') // C:\\project\\foo\r\n> ```\r\n>\r\n> See [`fast-glob` documentation about this](https://github.com/mrmlnc/fast-glob#how-to-write-patterns-on-windows) for more details.\r\n\r\n### Options\r\n\r\nSee [options.ts](https://github.com/sapphi-red/vite-plugin-static-copy/blob/main/src/options.ts).\r\n\r\n## Differences with `rollup-plugin-copy`\r\n\r\n- Faster dev server start-up than using `rollup-plugin-copy` on `buildStart` hook.\r\n  - Files are not copied and served directly from the server during dev to reduce start-up time.\r\n- `dest` is relative to [`build.outDir`](https://vitejs.dev/config/build-options.html#build-outdir).\r\n  - If you are going to copy files outside `build.outDir`, you could use `rollup-plugin-copy` instead. Because that does not require dev server support.\r\n- [`fast-glob`](https://www.npmjs.com/package/fast-glob) is used instead of [`globby`](https://www.npmjs.com/package/globby).\r\n  - Because `fast-glob` is used inside `vite`.\r\n- `transform` could return `null` as a way to tell the plugin not to copy the file, this is similar to the [CopyWebpackPlugin#filter](https://webpack.js.org/plugins/copy-webpack-plugin/#filter) option, but it expects `transform` to return the original content in case you want it to be copied.\r\n- `transform` can optionally be an object, with a `handler` property (with the same signature of the `rollup-plugin-copy` transform option) and an `encoding` property (`BufferEncoding | 'buffer'`) that will be used to read the file content so that the `handler`'s content argument will reflect the correct encoding (could be Buffer);\r\n","readmeFilename":"README.md"}