index.js
function plugin(options, callback) {
    options = options || {};

    return function (style) {

        if (options.resolveUrl !== false) {
            style.define('url', stylus.resolver());
        }

        style.use(
            rider({
                implicit: options.implicit
            })
        );

        style.on('end', postprocessor(options, callback));

        if (options.husl) {
            // define husl & huslp
            style.define('husl', function (H, S, L, A) {
                var rgb = husl._rgbPrepare(husl._conv.husl.rgb([H.val, S.val, L.val]));
                var a = (A !== undefined ? A.val : 1);
                return new stylus.nodes.RGBA(rgb[0], rgb[1], rgb[2], a);
            });
            style.define('huslp', function (H, S, L, A) {
                var rgb = husl._rgbPrepare(husl._conv.huslp.rgb([H.val, S.val, L.val]));
                var a = (A !== undefined ? A.val : 1);
                return new stylus.nodes.RGBA(rgb[0], rgb[1], rgb[2], a);
            });
        }

        if (options.use) {
            style.use(options.use);
        }
    };
}
function plugin(options, callback) {
    options = options || {};

    return function (style) {

        if (options.resolveUrl !== false) {
            style.define('url', stylus.resolver());
        }

        style.use(
            rider({
                implicit: options.implicit
            })
        );

        style.on('end', postprocessor(options, callback));

        if (options.husl) {
            // define husl & huslp
            style.define('husl', function (H, S, L, A) {
                var rgb = husl._rgbPrepare(husl._conv.husl.rgb([H.val, S.val, L.val]));
                var a = (A !== undefined ? A.val : 1);
                return new stylus.nodes.RGBA(rgb[0], rgb[1], rgb[2], a);
            });
            style.define('huslp', function (H, S, L, A) {
                var rgb = husl._rgbPrepare(husl._conv.huslp.rgb([H.val, S.val, L.val]));
                var a = (A !== undefined ? A.val : 1);
                return new stylus.nodes.RGBA(rgb[0], rgb[1], rgb[2], a);
            });
        }

        if (options.use) {
            style.use(options.use);
        }
    };
}
编译

@param  {Object} options options
@param  {boolean=} options.implicit 引入rider
@param  {Array|boolean=} options.autoprefixer autoprefixer支持
@param  {boolean=} options.husl husl支持
@param  {boolean=} options.resolveUrl resolve url
@param  {Function=} options.use use
@param  {Function=} callback provider callback