Releases: sapphi-red/vite-plugin-static-copy
vite-plugin-static-copy@4.1.0
Minor Changes
-
#251
7672842Thanks @sapphi-red! - Addnameproperty to therenameobject form and allow rename functions to return aRenameObject. Thenameproperty replaces the file's basename (filename + extension), and can be combined withstripBaseto both flatten directory structure and rename the file in one step. Rename functions can now return{ name, stripBase }objects instead of only strings, making it easier to declaratively control output paths from dynamic rename logic.// node_modules/lib/dist/index.js → vendor/lib.js { src: 'node_modules/lib/dist/index.js', dest: 'vendor', rename: { name: 'lib.js', stripBase: true } } // src/pages/events/test.html → dist/events/index.html { src: 'src/pages/**/*.html', dest: 'dist/', rename: { stripBase: 2, name: 'index.html' } }
vite-plugin-static-copy@4.0.1
Patch Changes
-
#249
c6bf44cThanks @sapphi-red! - Fix absolutedestpaths being nested under the output directoryWhen
destwas an absolute path and the source file had a directory component (structured output), the path was incorrectly converted to a relative path, causing files to be nested under the build output directory instead of being copied to the specified absolute path.{ src: 'foo/foo.txt', dest: '/home/user/my-repo/bar' }
Before:
/home/user/my-repo/dist/home/user/my-repo/bar/foo/foo.txt
After:/home/user/my-repo/bar/foo/foo.txt -
#247
d3af79eThanks @sapphi-red! - Fixrename.stripBaseto work correctly with../pathsPreviously,
stripBasecounted..as directory segments, causing incorrect output paths when copying from parent directories.{ src: '../../src/pages/**/*.html', dest: 'dist/', rename: { stripBase: 2 } }
Before:
dist/src/pages/events/test.html
After:dist/events/test.html{ src: '../../src/pages/**/*.html', dest: 'dist/', rename: { stripBase: true } }
Before:
dist/src/pages/events/test.html
After:dist/test.html
vite-plugin-static-copy@4.0.0
Major Changes
-
#235
b2edc86Thanks @sapphi-red! - Simplify glob behavior and always preserve directory structure.Breaking changes:
- Only files are matched. Glob patterns no longer match directory entries. Previously, matching a directory would recursively copy it via
fs.cp, which caused files to be copied twice when using**patterns. - Directory patterns are auto-expanded.
src: 'assets'now automatically expands to match all files inside the directory, using tinyglobby's built-inexpandDirectoriesoption. No migration needed for this pattern alone. structuredoption removed. Directory structure is now always preserved in the output. Thestructuredoption has been removed entirely. Userename: { stripBase: true }to flatten output paths when needed.
- Only files are matched. Glob patterns no longer match directory entries. Previously, matching a directory would recursively copy it via
-
#237
6129008Thanks @sapphi-red! - Drop support for Vite 5 -
#238
9766e42Thanks @sapphi-red! - Drop support for Node 18, 20, 21, 23. The new support range is^22.0.0 || >= 24.0.0.
vite-plugin-static-copy@3.4.0
Minor Changes
-
#233
f665a15Thanks @sapphi-red! - Add{ stripBase: number }object form to therenameoption. This strips the given number of leading directory segments from the matched path, avoiding the need for manual../traversals in a rename function.This is useful when copying files from deep paths like
node_modules/my-lib/dist/**/*withstructured: true, where the full directory structure would otherwise be preserved in the output. Instead of writing a rename function that manually returns../traversals to flatten unwanted nesting, you can userename: { stripBase: N }to declaratively strip the leading segments.
vite-plugin-static-copy@3.3.0
Minor Changes
- #230
3074e1aThanks @sapphi-red! - Add Vite 8 to peer dependency range.
vite-plugin-static-copy@3.2.0
Minor Changes
- #219
fbb2a7aThanks @sapphi-red! - Addenvironmentoption to configure which environment the plugin runs in. Defaults to'client'.
vite-plugin-static-copy@3.1.6
Patch Changes
- #217
e3d457dThanks @sapphi-red! - Only skip non-client environments when multiple environments exist.
vite-plugin-static-copy@3.1.5
Patch Changes
- #214
3f252ccThanks @sapphi-red! - Only copy for the client environment.
vite-plugin-static-copy@3.1.4
Patch Changes
- #204
d0b5370Thanks @stianjensen! - Removedfs-extradependency in favor ofnode:fs. This should not affect the behavior.
vite-plugin-static-copy@3.1.3
Patch Changes
- #202
9388186Thanks @sapphi-red! - Switched to use trusted publisher to publish the package.