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-dict

v0.1.3

Published

vue-dict是一个vue深入订制的字典集工具,有多种使用方式,方便开发者使用

Readme

Rollup.js 下一代的 ES6 模块打包机

在我们模块化项目时,经常调用一个模块,使用了其中一个方法,其它 N 多的方法我们未调用,我们希望未调用到的方法或者变量忽略它们,并且不打包到 js 文件中,这样在大项目里面可以显著减少文件的体积,特别在移动终端,虽然 4G 非常快,但是我还是希望更省流量。

ES6 帮我们实现了,目前 webpackbrowserify 都还不支持这一屌爆了的功能。如果你现在就想实现这一功能的话,你就可以尝试使用rollup.js

使用方法

使用gulp工具来搞定打包功能。首先在根目录建立gulpfile.jspackage.json 文件这个是 gulp 工具的标配。如果不知道怎么玩儿gulp,得先去研究研究

先安装依赖模块

npm install gulp --save
npm install rollup --save
npm install rollup-plugin-commonjs --save
npm install rollup-plugin-node-resolve --save

gulpfile.js

var gulp = require("gulp");
var fs = require("fs");
var rollup = require("rollup").rollup;
var commonjs = require("rollup-plugin-commonjs");
var nodeResolve = require("rollup-plugin-node-resolve");

gulp.task("script", function () {
    return rollup({
        entry: "src/main.js",
        plugins: [nodeResolve({ jsnext: true }), commonjs()],
    }).then(function (bundle) {
        // 输出 bundle + sourcemap
        var result = bundle.generate({
            // output format - 'amd', 'cjs', 'es6', 'iife', 'umd'
            // amd – 使用像requirejs一样的银木块定义
            // cjs – CommonJS,适用于node和browserify / Webpack
            // es6 (default) – 保持ES6的格式
            // iife – 使用于<script> 标签引用的方式
            // umd – 适用于CommonJs和AMD风格通用模式
            /**
             * output format - 'amd', 'cjs', 'es6', 'iife', 'umd'
             * amd – 使用像requirejs一样的银木块定义
             * cjs – CommonJS,适用于node和browserify / Webpack
             * es6 (default) – 保持ES6的格式
             * iife – 使用于<script> 标签引用的方式
             * umd – 适用于CommonJs和AMD风格通用模式
             */
            format: "cjs",
        });

        fs.writeFileSync("bundle.js", result.code);

        bundle.write({
            format: "cjs",
            dest: "dist/main.js",
        });
    });
});

再去建立 main.jsmain.js ,运行 npm script 进行打包,就可得到你想要的 js 文件了。

rollup 插件

Plugins: https://github.com/rollup/rollup/wiki/Plugins

  • babel – transpile code with Babel
  • browserify-transform – use Browserify transforms as plugins
  • coffee-script – convert CoffeeScript to JS
  • commonjs – convert CommonJS modules to ES6
  • eslint - verify entry and imported scripts
  • includepaths – provide base paths to resolve imports from
  • inject – detect dependencies and inject them
  • istanbul – Instruments code for code coverage with Istanbul
  • json – convert JSON to ES6
  • memory - load entry from memory
  • multi-entry – allows multiple 'entry points' instead of just one
  • node-resolve – use the Node.js module resolution algorithm (e.g. modules from node_modules, installed with npm)
  • pegjs - import PEG.js grammars as parsers
  • postcss - compile postcss and insert to head
  • ractive – precompile Ractive components
  • replace – replace occurrences of a set of strings
  • riot - compile Riot.js tag file
  • string – import text files as strings
  • stylus-css-modules – compile Stylus and inject CSS modules
  • uglify - minify generated bundle
  • vue - compile vue components

参考资料

官网:http://rollupjs.org
Github:https://github.com/rollup/rollup