unplugin-utils
TypeScript icon, indicating that this package has built-in type declarations

0.2.4 • Public • Published

unplugin-utils npm

Unit Test

A set of utility functions commonly used by unplugins.

Thanks to @rollup/pluginutils. This projects is heavily copied from it.

Why Fork?

  • 🌍 Platform agnostic, supports running in the browser, Node.js...
  • ✂️ Subset, smaller bundle size.

Install

npm i unplugin-utils

Usage

createFilter

export default function myPlugin(options = {}) {
  const filter = createFilter(options.include, options.exclude)

  return {
    transform(code, id) {
      if (!filter(id)) return

      // proceed with the transformation...
    },
  }
}

normalizePath

import { normalizePath } from 'unplugin-utils'

normalizePath(String.raw`foo\bar`) // 'foo/bar'
normalizePath('foo/bar') // 'foo/bar'

Sponsors

License

MIT License © 2025 三咲智子 Kevin Deng

MIT Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors)

Readme

Keywords

none

Package Sidebar

Install

npm i unplugin-utils

Weekly Downloads

410,139

Version

0.2.4

License

MIT

Unpacked Size

12.9 kB

Total Files

7

Last publish

Collaborators

  • sxzz