unplugin-utils
A set of utility functions commonly used by unplugins.
Last updated 6 months ago by GitHub Actions .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install unplugin-utils 
SYNC missed versions from official npm registry.

unplugin-utils

npm version npm downloads Unit Test codecov

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.
  • ???? Coverage: 100% test coverage.

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-PRESENT Kevin Deng

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

Current Tags

  • 0.3.1                                ...           latest (6 months ago)

9 Versions

  • 0.3.1                                ...           6 months ago
  • 0.3.0                                ...           8 months ago
  • 0.2.5                                ...           8 months ago
  • 0.2.4                                ...           a year ago
  • 0.2.3                                ...           a year ago
  • 0.2.2                                ...           a year ago
  • 0.2.1                                ...           a year ago
  • 0.2.0                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 1
Dependencies (2)
Dev Dependencies (13)

Copyright 2013 - present © cnpmjs.org | Home |