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 🙏

© 2026 – Pkg Stats / Ryan Hefner

vue-component-code-render

v0.5.1

Published

## 介绍

Readme

vuec

介绍

根据 script 生成 vue 单文件实例的组件

由于生产需要,所以想单独根据文件的内容来生成编译时和发布态的单文件 vue 组件,思路来源与 vuep 框架,不同的是这个是用单文件字符串生成的实例;vuep 可以完全用于编译态的实现。

主要目标:实现模版渲染以及简单的数据赋值

主要思路

利用 vue-template-compiler 解析单文件,对于 template 的文件利用 createElement 来实现,对于数据端以及 js 逻辑端展示,采用 mine-jsjs 进行解析,对于部分数据进行单项绑定;简单事件可以正常处理(比如 console);现阶段对于简单的页面可以做到基本正常显示,并实时动态修改;

为什么不用 vuep;

引入组件比较麻烦,需要将一些组件做成 umd 格式;其次,为了做到渲染的时候可以在做一些逻辑处理,vuep 是一个黑盒,完全是一个全新的 vue 实例;

hello world 实例

<template>
  <vuec :template="code"></vuec>
</template>
<script>
export default {
  data() {
    return {
      code: ""
    };
  },
  created: function() {
    // eslint-disable-next-line no-useless-escape
    const end = "<\/script>";
    this.code =
      `
    <template>
      <div>
        <el-button @click="handlerClick" type="primary">{{ msg }}</el-button>
      </div>
    </template>

    <script>
      export default {
        data() {
          return {  msg: "Hello, world!" }
        },
        methods:{
          handlerClick(){
            console.log("button click")
          }
        }
      }
  ` + end;
  }
};
</script>

在线实例

yarn install
yarn run serve

测试

yarn run unit:test

TODO

  • [ ] 更多复杂实例测试,完善 render 代码
    • [x] 样式引入 (已支持 postcss)
    • [ ] import 引入方案实现 (这个估计无法支持了)
    • [ ] 如何引入 mock 数据
  • [x] vuec 报错信息 (现在统一打印在 console,包括 vue 的错误信息)
  • [ ] 代码优化
  • [x] rollup 打包
  • [ ] 设计 md 编辑器