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

enjoy-source-map

v1.2.17

Published

Generate source-map for templates and merge

Readme

enjoy-source-map build status

NPM

将含有内联sourcemap的文件合并、模板替换,保持原有对应关系.

var combline = require('enjoy-source-map');

//读取源代码
var content = fs.readFileSync(path.resolve(__dirname, "index.js"), {
    encoding: "utf8"
});

//读取模板
var Tpl = fs.readFileSync(path.resolve(__dirname, "inner-mod.tpl"), {
    encoding: "utf8"
});

//babel转换源代码(需配置sourceMaps:'line')
var source =  babel.transform(content, {...}).code;

content = combline.overWriteTlp(Tpl,{
    content:source
});

console.log(content);
// index.js
function(__inner_require__, exports, module) {
    'use strict';

    var _babelPolyfill = require("babel-polyfill@6/lib/index.js");

    var _babelPolyfill2 = babelHelpers.interopRequireDefault(_babelPolyfill);

    var _enjoyWebSupportElong = require("[email protected]/index.js");

    var _enjoyWebSupportElong2 = babelHelpers.interopRequireDefault(_enjoyWebSupportElong);

    var _main = __inner_require__(1 /*main.js*/ );

    var _main2 = babelHelpers.interopRequireDefault(_main);

    _enjoyWebSupportElong2.default.React.render(_enjoyWebSupportElong2.default.React.createElement(_main2.default), document.getElementsByTagName("div")[0]);

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9qaWUvRG9jdW1lbnRzL2Vsb25nL2Vuam95VGVzdC93ZWIvaDUvX2J1aWxkL2luZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0NBQUE7O0NBRUE7Ozs7Q0FDQTs7OztDQUNBOzs7O0NBRUEsK0JBQUEsQUFBTSxNQUFOLEFBQVksT0FBTywrQkFBQSxBQUFNLE1BQU4sQUFBWSxxQkFBL0IsVUFBb0QsU0FBQSxBQUFTLHFCQUFULEFBQThCLE9BQWxGLEFBQW9ELEFBQXFDIiwiZmlsZSI6ImJ1bmRsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbmltcG9ydCBCYWJlbFBvbHlmaWxsIGZyb20gXCJiYWJlbC1wb2x5ZmlsbFwiO1xuaW1wb3J0IEVuam95IGZyb20gXCJlbmpveS13ZWItc3VwcG9ydC1lbG9uZ1wiO1xuaW1wb3J0IE1haW4gZnJvbSBcIi4vbWFpblwiO1xuXG5FbmpveS5SZWFjdC5yZW5kZXIoRW5qb3kuUmVhY3QuY3JlYXRlRWxlbWVudChNYWluKSwgZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoXCJkaXZcIilbMF0pO1xuIl19

API

overWriteTlp(tpl, data)

模板替换

var content = combline.overWriteTlp(Tpl,{
    content:source
});

overWriteJoin(codes,jo = ',\n')

数组合并

var codes = [code1,code2];
var mods = combline.overWriteJoin(codes);

overWriteReplace(target,regexp|substr, newSubstr|function)

replace替换

var content = combline.overWriteReplace(codes,/(p1)(p2)/g,function(match, p1, p2){
        return [p1, p2].join(' - ');
    });