Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@jsxtools/rollup-plugin-copy

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsxtools/rollup-plugin-copy

A Rollup plugin for copying files during the build process.

Source
npmnpm
Version
0.3.2
Version published
Weekly downloads
60
-69.39%
Maintainers
1
Weekly downloads
 
Created
Source

@jsxtools/rollup-plugin-copy

@jsxtools/rollup-plugin-copy is a rollup plugin for copying files during the build process.

Installation

npm install @jsxtools/rollup-plugin-copy

Usage

import { rollupPluginCopy } from "@jsxtools/rollup-plugin-copy";

export default {
	input: "src/index.js",
	output: {
		file: "dist/bundle.js",
		format: "es",
	},
	plugins: [
		rollupPluginCopy({
			rootDir: "src",
			distDir: "dist",
			include: ["src/**/*.css", "src/**/*.png", "src/**/*.svg"],
			exclude: ["src/**/*.test.*"],
		}),
	],
};

Features

  • Copies files from source to destination with glob pattern support.
  • Only copies files that have changed using modification time and SHA-256 hash comparison.
  • Maintains a cache to avoid unnecessary file operations.
  • Handles file additions, changes, and deletions during development.
  • Uses Copy-on-Write (CoW) optimization when available (APFS, Btrfs, XFS).
  • Integrates with Rollup's asset system.

Configuration Options

  • cacheFile - Cache file for tracking changes (default: cpconfig.cpbuildinfo).
  • include - Glob patterns for files to include (string or array).
  • exclude - Glob patterns for files to exclude (string or array).
  • distDir - Destination directory to copy files to (default: dist).
  • workDir - Current working directory (default: current process directory).
  • rootDir - Source directory to copy files from (default: src)

Examples

Copy CSS and Image Files

rollupPluginCopy({
	rootDir: "src",
	distDir: "dist",
	include: ["src/**/*.css", "src/**/*.png", "src/**/*.jpg", "src/**/*.svg"],
});

Copy with Exclusions

rollupPluginCopy({
	rootDir: "assets",
	distDir: "public",
	include: ["assets/**/*"],
	exclude: ["assets/**/*.test.*", "assets/**/.*"],
});

Caching

The plugin maintains a cache file (default: cpconfig.cpbuildinfo) that tracks file modification times and SHA-256 hashes. This enables:

  • Only changed files are copied (based on mtime comparison)
  • Content verification using SHA-256 hashes when mtime differs
  • Detection of removed files for cleanup
  • Minimal file system operations during development
  • Incremental builds with accurate change detection

API

The plugin exports both the main plugin and a separate API:

  • rollupPluginCopy() - The main Rollup plugin
  • CopyAPI - Available via @jsxtools/rollup-plugin-copy/api
import { CopyAPI } from "@jsxtools/rollup-plugin-copy/api";

const copyApi = new CopyAPI();
copyApi.init({
	rootDir: "src",
	distDir: "dist",
	include: ["src/**/*.css"],
});

Peer Dependencies

  • rollup ^4.6.0

License

MIT-0

FAQs

Package last updated on 06 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts