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.2.0
Version published
Maintainers
1
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 content-based comparison.
  • Maintains a cache to avoid unnecessary file operations.
  • Handles file changes during development.
  • 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, sizes, and hashes. This enables:

  • Only changed files are copied
  • Detects content changes even if timestamps are the same
  • Minimal file system operations during development

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 03 Oct 2025

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