New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@microprogram/plugin-components

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microprogram/plugin-components

Automatically parse components in `.*xml` and fill in json

latest
Source
npmnpm
Version
1.0.0-beta.30
Version published
Maintainers
1
Created
Source

@microprogram/plugin-wxapp-components

Install

# yarn
yarn add @microprogram/plugin-components

Usage

in gulpfile.js

const components = require('@microprogram/plugin-components');

return gulp.src(/path/to/miniprogramRoot + '**/*.wxml')
    .pipe(components({
      targetKey: "usingComponents",
      transformers: [
        {
          prefix: 'van-',
          getComponentPath: (componentName) => {
            return `@vant/weapp/${componentName}/index`
          }
        },
        {
          prefix: 'self-',
          getComponentPath: (componentName) => {
            return `../../components/${componentName}/index`
          }
        },
        {
          prefix: 'home-',
          getComponentPath: (componentName) => {
            return `./components/${componentName}/index`
          }
        }
      ]
    }))
    .pipe(gulp.dest(destPath))

Example

The following is the original file content .wxml file:

<van-button>Button</van-button>

.json file:

{
  "usingComponents": {}
}

When use this task, the json file will auto be changed to

{
  "usingComponents": {
    "van-button": "@vant/weapp/button/index"
  }
}

FAQs

Package last updated on 09 Jun 2021

Did you know?

Socket

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.

Install

Related posts