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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ne-node-parse-loader

v0.0.3

Published

Webpack SSR parse loader for netease

Downloads

6

Readme

ne-node-parse-loader

🏉Webpack SSR parse loader for netease

一个简单的Webpack loader,用来模拟文章页服务端渲染效果,在文章页项目中使用。

支持语法

  1. <% %> 会执行里面的 js 代码
  2. <%= %> or {{}} 代表输出内容
  3. <%- %> 会进行 html 的转义(在 html 里直接输出 html 字符串)
  4. <%# %> 的内容不进行处理(防止服务器端渲染客户端的语法)
  5. <%@ %> 会读取中间的路径,只能是/开头的静态地址,会根据channels参数中的对应domain取线上文件,转码后插入对应位置。404则插入注释,注释内提示出错位置。

注意

  1. 闭合的<%标签内不能嵌套 - <% <% %> %>是不会解析里面的语法.
  2. 页面上的变量必须使用 data.,否则会报错

设置

请在dev模式中使用!

// webpack.dev.config.js

const articleData = {"resultcode":200,"msg":null,"data":{"pageSize":1,"del":0,"source":"网易跟贴","body":"<p>滴滴滴!跟贴局要发车啦!</p><p class=\"f_center\"><img alt=\"发车啦!跟贴老司机速来定制车贴!\" src=\"http://cms-bucket.ws.126.net/2019/09/02/1f5b2156b9c04ba8a75f6e6e67fd6bde.jpeg?imageView&amp;thumbnail=550x0\" /><br  /></p><p>速来跟贴区参与活动吧~~~~</p><p><!--#include virtual=\"/special/0030ad/newpostad2.html\"-->","userid":"shihuan","media_url":"#","source_url":"#","topicid":"00307VL1","stitle":null,"boardid":"tie_bbs","replaceKeywordCount":5,"mtitle":null,"processPageData":"true","source_pic":"0030","duty_editor":"施欢_NY3461","modelid":"0030post1301_ad","author":"","info3g":null,"adstr":"<!--#include virtual=\"/special/0030ad/newpostad2.html\"-->","iscomment":"y","quality":80,"otitle":"","status":0,"hismod":false,"originalflag":0,"postid":"EO2G7Q2S00307VL1","title":"发车啦!跟贴老司机速来定制你的专属车贴!","pcommentid":"EO2G7Q2S00307VL1","newsid":null,"nickname":"施欢","digest":"","navtopicid":null,"statement":"","commentid":"EO2G7Q2S00307VL1","exe_editor":"王晓易_NE0011","hasad":true,"ptime":1567390283000,"setAdstr":false,"userinfo":null,"view_name":"网易跟贴","createtime":1567390555000,"statementtype":0,"docid":"EO2G7Q2S00307VL1","dkeys":"车贴,跟贴,老司机","hideAd":false,"url":"http://tie.163.com/gt/19/0902/10/EO2G7Q2S00307VL1.html","realname":null,"relatekey":"","buloid":"","sdigest":null,"photosetCovers":"","cnavbar":null}}

const channels = [
  {
    "channelid": "0001",
    "label": "新闻",
    "value": "news"
  }
]

module: {
  rules: [{
    test: /\.html?$/,
    use: [
      {
        loader: 'html-loader' // Used to output as html
      },
      {
        loader: 'ne-node-parse',
        options: {
          data: articleData.data,
          // url is supported too, like: data: 'https://news.163.com/19/0902/16/EO350JR40001982U.html',
          channels: channels
        }
      }
    ]
  }]
}

CHANGELOG

[0.0.2] - 2019-10-18

add

  • data字段增加对文章页旧url的支持

[0.0.3] - 2020-12-07

add

  • 设置encoding: null,以防转码失败