plugin-screed-component-diff
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

plugin-screed-component-diff

coverage test

Helps users smooth out differences in the use of certain components

Installation

$ npm install plugin-screed-component-diff -D

# or yarn
$ yarn add plugin-screed-component-diff -D

Getting started

const pluginScreed = require('plugin-screed-component-diff');
const babelCore = require('@babel/core');
const babelTypes = require('@babel/types');

const source = `
<h-icon name="success1" qishi></h-icon>
`;

const result0 = babelCore.transform(source, {
  presets: ['@vue/babel-preset-jsx'],
  plugins: [
    [
      pluginScreed,
      {
        name: 'h-icon',
        reg: {
          attrs: {
            name: /^suc/,
          },
        },
        attrs: {
          add: {
            kngiht: 'qishi',
          },
          remove: ['qishi'],
        },
      },
    ],
  ],
});

const result1 = babelCore.transform(source, {
  presets: ['@babel/preset-react'],
  plugins: [
    [
      pluginScreed,
      {
        name: 'h-icon',
        attrs: {
          add: {
            kngiht: 'qishi',
          },
          remove: ['qishi'],
        },
      },
    ],
  ],
});

console.log(result0.code);
console.log(result1.code);

test('test vue', () => {
  expect(result0.code).toMatch(/kngiht/);
});

test('test react', () => {
  expect(result1.code).toMatch(/kngiht/);
});

Package Sidebar

Install

npm i plugin-screed-component-diff

Weekly Downloads

0

Version

0.1.4

License

MIT

Unpacked Size

9.31 kB

Total Files

8

Last publish

Collaborators

  • ahau2019