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

amd-deploy

v1.1.4

Published

amd deploy

Downloads

40

Readme

amd-deploy

功能

  • 支持模块合并,用两级 include/exclude,实现最好的合并规则
  • 支持资源替换,便于缓存控制

配置

{
    // baseUrl 指向的本地硬盘路径
    baseUrl: '',

    // amd paths
    paths: { },

    // amd packages
    packages: [ ]
}

替换资源

{
    // 资源 ID 替换,如 require('underscore')
    // resource.id 表示代码中写的字面量,即 underscore
    // absolute 表示硬盘中的文件路径,如 project/dep/underscore/1.0.0/src/underscore.js
    replaceRequireResource: function (resource, absolute) {
        return resource.id + Date.now();
    },

    // 替换 require.config 中的一些值,比如 src 转为 asset
    replaceRequireConfig: function (config) {
        if (config.baseUrl) {
            config.baseUrl = config.baseUrl.replace('url', 'asset');
        }
        return config;
    }
}

模块合并

{
    combine: {

        // 全局 include 配置,应用于所有模块
        // include 表示即使模块不依赖某些模块,也会合并进去,避免需要时发请求
        include: [
            'underscore'
        ],

        // 全局 exclude 配置,应用于所有模块
        // exclude 表示即使模块依赖某些模块,也不会合并进去,第三方库和业务 common 层通常会用到
        exclude: [
            'cobble',
            'cobble/**/*'
        ],

        // 模块默认按自己的依赖进行合并(不合并 build 个毛...)
        // 只有配置成 false 才表示不需要合并(给你不合并的权利)

        // 模块默认继承全局 include 和 exclude
        // 只有按如下配置才表示不需要继承
        // {
        //     moduleId: {
        //         inheritInclude: false,
        //         inheritExclude: false
        //     }
        // }

        // 每个模块可以单独配置自己的 include 和 exclude,且优先级比全局 include exclude 更高,即
        // 如果 combine.include 包含了一些模块,module.exclude 可以去掉
        // 如果 combine.exclude 排除了一些模块,module.include 可以加上

        // exclude 和 moduleId 支持模糊匹配(为了避免误杀,只当 * 存在时开启),规则请参考 glob
        modules: {
            moduleId: {
                include: [ ],
                exclude: [ ]
            }
        }
    }
}

合并插件资源

如果需要合并样式或模板,可自己写规则,如下

{
    fileReader: {

        styl: function (filePath) {

            return 'define("id", [], function () {'
                 +     'return style;'
                 + '})';
        }

    }
}

压缩成一行

语法树生成代码,默认会被格式化,如果输入的代码已经过 uglify 处理,可用 minify 参数保持压缩状态

{
    minify: true
}