npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

m2v

v1.2.8

Published

miniprogram

Downloads

3

Readme

m2v

微信小程序(组件)代码转Vue(组件)代码

Wechat applet code into Vue code

only component transformations are supported !!!

Scripts


npm i m2v

Use


const path = require('path')
const { transform } = require('m2v')

const resolve = (file) => {
  return path.resolve(__dirname, file)
}

// 入口的微信小程序组件文件夹
const entry = resolve('./components/')

// 编译后的Vue组件文件夹
const output = resolve('./outComponents/')

transform(entry, output)

转换逻辑

  1. 若目录存在 .wxml, 则作为组件进行转换
  2. 若不存在 .wxml, 但存在 .wxss, 则作为样式文件单独转换
  3. 若既不存在 .wxml, 也不存在 .wxss, 则直接拷贝文件,不进行任何处理

转换实现

| 小程序规则 | vue规则 | 是否实现 | | ---- | ---- | ---- | | .wxml, .json, .wxss, .js 文件合并转换成vue单文件 | .json文件只取文件引用部分, .wxml抓换成template, .js 转换成script部分, .wxss转换成style部分 | 已实现 | | wx api 转成vue实例方法 | 由于web端的限制,只实现部分sdk功能,现统一转成this.$xxx语法,项目中使用需要单独挂载,部分sdk参考wx-web-sdk | 已实现 | | .wxs 转成 vue.filter | .wxs在.wxml引用规则被限制,语法需转成vue.filter,在重写.wxml上的.wxs语法规则,转成vue filter语法 | 未实现 |

tips

  1. 只支持lifetimes 里的生命周期,钩子函数有created, attached, ready, moved, detached, error(若写在了lifetimes对象外,请统一移到lifetimes中)