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

jtaro-bundle

v0.3.1

Published

A bundle plugin for JTaro

Readme

JTaro-Bundle

为JTaro服务的打包脚本

安装

npm install -D jtaro-bundle

方法

bundle

  • 根据index.html的href和src属性提取需要的文件
  • 将整个文件夹所有第一层js文件(Vue页面组件)合并到一个文件并创建Vue组件
  • 直接拷贝指定文件(夹)

选项:

| 键 | 值 | 必填 | 备注 | |:--:|:--:|:--:|:--:| | origin | <String> | Y | 开发目录的index.html | | target | <String> | Y | 生产目录的index.html模板 | | copies | <Array> | N | 直接拷贝的文件(夹) | | rollupPlugins | <Array> | N | 参考 Rollup JavaScript-API#plugins | | sourceMap | <Boolean> | N | 默认为false,是否开启sourceMap | | callback | <Function> | N | 打包完成后执行的回调 |

示例:

// nodejs
var jtaroBundle = require('jtaro-bundle')
var uglify = require('rollup-plugin-uglify')
var babel = require('rollup-plugin-babel')

jtaroBundle.bundle({
  origin: 'dev/index.html',  // 开发目录的index.html
  target: 'pro/index_template.html',  // 生产目录的index.html模板
  // 直接拷贝的文件(夹),注意:文件夹后不要带/,否则windows10拷贝的文件会有问题,例:./assets不要写成./assets/
  copies: ['./data.json', './assets'],
  // 自定义使用rollup打包时使用的插件
  // uglify不能压缩ES6语法,所以babel要放在uglify前面
  rollupPlugins: [babel({
    include: './dev/pages/*.js', // 相对于该脚本文件(请注意区分与jtaro-module的babel插件路径)
    presets: [
      [
        'es2015',
        {
          'modules': false
        }
      ]
    ]
  },
    uglify()],
  sourceMap: true,
  callback: function () {
    console.log('打包完成')
  }
})

index

用于将文件夹里所有js文件索引到一个js文件里,给rollup.js提供入口

require('jtaro-bundle').index(path[, name])

  • path 必须,要提取索引的目录
  • name 可选,索引文件的名称,如果不填,默认为<目录名> + _index.js
var jtaroBundle = require('jtaro-bundle')
jtaroBundle.index('dev/pages')
// jtaroBundle.index('dev/pages', 'myIndex.js') // 自定义文件名

将会生成dev/pages.js文件,dev/pages.js文件内容类似如下形式,引入js并创建Vue组件

import p2 from './pages/detail.js'
Vue.component('pages__detail', p2)
import p4 from './pages/home.js'
Vue.component('pages__home', p4)
import p8 from './pages/reply.js'
Vue.component('pages__reply', p8)

LOG

v0.3.1 (2018-06-07)

  • 使用 md5 hash 替换文件后面的时间戳,保证文件不变,不更新缓存
  • 使用 copySync 替换 copy ,解决 windows 系统拷贝文件失败的问题

v0.3.0 (2017-07-10)

  • 添加回调函数,打包完成后可执行回调
  • 添加创建带时间戳路径的index.html文件用于清除缓存,因此原index.html模板文件要修改为index_template.html

v0.2.6 (2017-06-09)

  • 修复工程目录路径带.报错的问题

v0.2.5 (2017-05-19)

v0.2.4 (2017-05-16)

v0.2.3 (2017-05-04)

v0.2.2 (2017-05-02)

  • 补充修复windows下index方法解释\反斜杠路径错误的问题

v0.2.1 (2017-05-01)

  • 修复windows下index方法解释\反斜杠路径错误的问题

v0.2.0 (2017-03-21)

  • 新增index方法,用于将文件夹里所有js文件索引到一个js文件里,给rollup.js提供入口

v0.1.2 (2017-03-13)

  • 添加sourceMap选项

v0.1.1 (2017-02-28)

  • 添加rollupPlugins选项