Skip to content

Latest commit

 

History

History
63 lines (48 loc) · 1.83 KB

README.md

File metadata and controls

63 lines (48 loc) · 1.83 KB

impound

npm version npm downloads Github Actions Codecov

Build plugin to restrict import patterns in certain parts of your code-base.

This package is an unplugin which provides support for a wide range of bundlers.

Usage

Install package:

# npm
npm install impound
// rollup.config.js
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import { ImpoundPlugin } from 'impound'

export default {
  plugins: [
    ImpoundPlugin.rollup({
      cwd: dirname(fileURLToPath(import.meta.url)),
      include: [/src\/*/],
      patterns: [
        [/^node:.*/], // disallows all node imports
        ['@nuxt/kit', 'Importing from @nuxt kit is not allowed in your src/ directory'] // custom error message
      ]
    }),
  ],
}

💻 Development

  • Clone this repository
  • Enable Corepack using corepack enable
  • Install dependencies using pnpm install
  • Run interactive tests using pnpm dev

License

Made with ❤️

Published under MIT License.