
Research
/Security News
Mini Shai-Hulud Campaign Hits Red Hat Cloud Services npm Packages
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.
@jsxtools/rollup-plugin-utils
Advanced tools
**@jsxtools/rollup-plugin-utils** is a collection of utilities for Rollup plugins.
@jsxtools/rollup-plugin-utils is a collection of utilities for Rollup plugins.
This package includes utilities for virtual asset management, file hashing, path resolution, and option handling.
npm install @jsxtools/rollup-plugin-utils
This package provides several utility modules that can be imported individually:
import { VirtualAsset } from '@jsxtools/rollup-plugin-utils/virtual-asset'
import { getFileHash, getFileHashAndData } from '@jsxtools/rollup-plugin-utils/get-file-hash'
import { toArray, toMergedArray } from '@jsxtools/rollup-plugin-utils/options'
import { resolve, relative, resolveDir } from '@jsxtools/rollup-plugin-utils/path'
A utility class for managing virtual assets in Rollup builds.
import { VirtualAsset } from '@jsxtools/rollup-plugin-utils/virtual-asset'
const virtualAsset = new VirtualAsset("my-virtual-asset", {
load(context, id) {
if (id === this.id) {
return { code: 'export const data = "virtual";' }
}
return null
}
})
// ... and in a plugin
export default {
name: 'my-plugin',
buildStart(options) {
virtualAsset.buildStart(this, options)
},
resolveId(id, importer, options) {
return virtualAsset.resolveId(this, id, importer, options)
},
load(id) {
return virtualAsset.load(this, id)
},
generateBundle(options, bundle) {
virtualAsset.generateBundle(this, options, bundle)
}
}
Utilities for generating SHA-1 file hashes.
import { getFileHash } from '@jsxtools/rollup-plugin-utils/get-file-hash'
const hash = await getFileHash('path/to/file.js')
console.log(hash) // "a1b2c3d4e5f6..."
import { getFileHashAndData } from '@jsxtools/rollup-plugin-utils/get-file-hash'
const { hash, data } = await getFileHashAndData('path/to/file.js')
console.log(hash) // "a1b2c3d4e5f6..."
console.log(data) // <Buffer ...>
Utilities for handling plugin options, including array manipulation and merging.
import { toArray, toMergedArray } from '@jsxtools/rollup-plugin-utils/options'
// convert single values or arrays to arrays
const files = toArray('file.js') // ['file.js']
const moreFiles = toArray(['a.js', 'b.js']) // ['a.js', 'b.js']
const noFiles = toArray(null) // []
// merge arrays safely
const merged = toMergedArray(['a.js'], ['b.js']) // ['a.js', 'b.js']
const withNulls = toMergedArray(null, ['b.js']) // ['b.js']
import { assignInput } from '@jsxtools/rollup-plugin-utils/options'
const plugin = {
name: 'my-plugin',
buildStart(options) {
assignInput(options.input, "src/another-file.js")
}
}
Path resolution and manipulation utilities.
import { resolve, relative, resolveDir } from '@jsxtools/rollup-plugin-utils/path'
// Standard Node.js path functions
const absolutePath = resolve('src', 'index.js')
const relativePath = relative('/project', '/project/src/index.js')
// Directory resolution with trailing separator
const srcDir = resolveDir('src') // '/absolute/path/to/src/'
const distDir = resolveDir('dist', 'assets') // '/absolute/path/to/dist/assets/'
constructor(options?) - Create a virtual asset with optional configurationbuildStart(context, options) - Initialize the virtual asset during build startresolveId(context, id, importer, options) - Resolve virtual asset IDsload(context, id) - Load virtual asset contentgenerateBundle(context, options, bundle) - Clean up virtual assets from bundlegetFileHash(filePath: string): Promise<string | null> - Generate SHA-1 hash of filegetFileHashAndData(filePath: string): Promise<FileHashAndData> - Generate hash and read file datatoArray<T>(items: T | T[] | null | undefined): T[] - Convert to array, filtering nullstoMergedArray<T>(a?: T[], b?: T[]): T[] - Merge two arrays safelyassignInput<T extends Record<string, string> | string[]>(input: T, id: string) => T - Add an ID to an input optionrelative(from: string, to: string): string - Get relative path (re-export from Node.js)resolve(...paths: string[]): string - Resolve absolute path (re-export from Node.js)resolveDir(...paths: string[]): string - Resolve directory with trailing separator@jsxtools/rollup-plugin-utils/get-file-hash - File hashing utilities@jsxtools/rollup-plugin-utils/options - Options handling utilities@jsxtools/rollup-plugin-utils/path - Path utilities@jsxtools/rollup-plugin-utils/virtual-asset - Virtual asset managementrollup ^4.6.0MIT-0
FAQs
A collection of utilities for authoring Rollup plugins.
The npm package @jsxtools/rollup-plugin-utils receives a total of 54 weekly downloads. As such, @jsxtools/rollup-plugin-utils popularity was classified as not popular.
We found that @jsxtools/rollup-plugin-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Research
/Security News
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.

Research
/Security News
The North Korean malware loader hides in a Packagist-listed package and its GitHub branch to fetch and execute remote code in a likely Contagious Interview-style lure.

Security News
The Rust project is moving toward formal rules on LLM use in contributions after months of internal debate over maintainer burden, code quality, and contributor experience.