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

@autopack/vpack

v1.0.0

Published

📦 基于rollup的VUE包构建工具 | One common construction and package tool for VUE components based on Rollup 📦

Downloads

7

Readme

@autopack/vpack @autopack/vpack

Sponsor [TypeScript version][typescript-5] Node.js version MIT Build Status - GitHub Actions

📦 基于 rollup 的 VUE 包基础核心构建工具 One common construction and package tool for VUE components based on Rollup 📦

✨ Features

  • 基于 rollup 的基础核心构建工具

  • 支持 Vue

  • 支持自定义banner,可通过指定package中__cusBannerString__字段值修改本工具品牌名称

  • Basic core build tools based on rollup

  • Supports mutiple frameworks such as vue

  • Support custom banner, you can modify the brand name of this tool by specifying the value of the cusBannerString field in the package

🚀 Quick Start

Installion

npm i -D @autopack/vpack@latest # OR yarn add -D @autopack/vpack@latest

Usage

First Step:Add the scripts in package.json:

  "scripts": {
    "build": "NODE_ENV=production vpack build --source=js"
  },

Second Step:Goes to the project directory and runs:

npm run build # OR yarn build

@autopack/vpack 默认以 src/index.ts 为入口,在 dist 目录输出 'umd', 'es', 'cjs', 'iife', 'amd' 五种格式的构建包(包含未压缩和已压缩版本)。

@autopack/vpack defaults to 'src/index.ts' as the entry, and outputs 'umd', 'es', 'cjs', 'iife', 'amd'' build packages (including uncompressed and compressed versions) in the 'dist' directory.

Custom Config

可在项目根目录新建 autopack.config.js 自定义 @autopack/vpack 构建配置(或在 package.json 中使用 autopackConfig 对象配置)。

You can create a new 'autopack.config.js' custom @autopack/vpack build configuration at the project root (or use the 'autopackConfig' object configuration in 'package.json')

支持自定义banner,可通过指定package.json文件中__cusBannerString__字段值修改本工具品牌名称。

Custom banners are supported, and you can modify the brand name of the tool by specifying the value of the cusBannerString field in the package.json file

如需指定打包需要隔离的依赖包,则可配置 formatConfig 属性对象

If you need to specify that packaging depends on packages that need to be isolated, you can configure the formatConfig property object

  "formatConfig": {
    [format]: {
      external: ['xxx']
    }
  },

如需整体隔离 dependences 全体依赖包,可指定 isolateDep: true

To isolate all dependent packages of dependences as a whole, specify isolateDep: true

  "formatConfig": {
    [format]: {
      isolateDep: true,
    }
  },

debug 并且非production环境状态会自动开启 rollup-serve,可配置 templateBase 属性指定模版 index.html 所在路径

The debug and development states automatically turns on rollup-serve, and you can configure the templateBase property to specify the path where the template index.html is located.

  "formatConfig": {
    templateBase: 'examples/',
  },

batchPackage 布尔状态会自动开启批量打包, 默认批量路径为"./packages",可配置 input 数组属性指定input路径文件

  "batchPackage": true,

@autopack/vpack 默认配置/配置示例 Default Config

/**
 * @autopack/vpack 默认配置 Default Config
 */
module.exports = ({ pkg } = {}) => {
  return {
    // 输入 Input
    input: 'src/index.vue',

    // 输出 Output
    output: {
      // 目录 directory
      directory: 'dist',
      // 包名 name
      name: /\//.test(pkg.name) ? pkg.name.match(/\/(.+)/)[1] : pkg.name,
      // 格式 format
      format: ['umd', 'es', 'cjs', 'iife', 'amd'],
      // 顶部注释 banner
      banner: `/*!
* ${pkg.name} with v${pkg.version}
* Author: ${pkg.author}
* Built on ${new Date().toLocaleDateString()}
* Released under the ${
        pkg.license
      } License Copyright (c) 2021-${new Date().getFullYear()}
*/`
    },
    formatConfig: {
      umd: {
        // 打包屏蔽的外部模块 Shielded external modules
        external: ['lodash', 'moment'],
        // 外部pkg.dependences依赖不屏蔽 Isolate dependences not blocking
        isolateDep: false
      },
      es: {
        external: ['lodash', 'moment'],
        // 自动屏蔽全部pkg.dependences依赖 Blocking isolate dependences
        isolateDep: true
      },
      cjs: {
        external: [],
        isolateDep: false
      },
      iife: {
        external: [],
        isolateDep: false
      },
      amd: {
        external: [],
        isolateDep: false
      }
    },
    skipAlert: true, // 重复路径是否提示覆盖并继续构建,默认不提示 Whether the duplicate path prompts to override and continue building, it is not prompted by default
    templateBase: 'examples/', // rollup-plugin-serve build base
    // devServeInput: 'examples/index.js', // rollup-plugin-serve build input file
    batchPackage: false, //是否批量打包packages路径下的组件, 默认打包路径, 会覆盖input路径
    replaceMaps: {},
    stylusAlias: {
      '@': path.join(cwd, './node_modules/@')
    },
    styleExtract: false
  }
}

License

MIT

Copyright (c) 2022-present, YanPan