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

hc-honeypack-intl-plugin

v0.0.7

Published

基于l20n规范,并考虑开发易用性,开发符合webpack-loader的加载器。

Downloads

2

Readme

l20n加载器

基于l20n规范,并考虑开发易用性,开发符合webpack-loader的加载器。

设计思路

依赖于extract-text-webpack-plugin插件,用于生成一份语言描述文件json格式,l20n的语言描述文件可以分3种类型,分别是.properties文件、.json文件、.l20n文件。naza-l20n-loader暂只支持生成.json文件,以便于后期发布到cdn服务器。

var ExtractTextPlugin = require('extract-text-webpack-plugin');
var poExtractTextPlugin = new ExtractTextPlugin(1, 'app.lang.json');

在webpack其中配置项加入

module: {
    loaders: [{
        test: /\.properties$/,
        loader: poExtractTextPlugin.extract("hc-honeypack-intl-plugin")
    }, ...],
}
plugins: [
  poExtractTextPlugin,
  ...
]
  • moduleplugins是webpack的配置项,module用于配置加载器,当webpack启动时,先通过
  • 加载器获取各种类型的文件内容,存到内存中。以供编译器使用,plugins则是配置编译器插件,上一个plugin执行成功后,才会执行下一个plugin。
  • 所以实际上naza-l20n-loader所做就是在加载时,遍历项目中所有.properties文件,收集文件内容。在编译时,打包生成一个.json文件。
  • 更多配置项参考webpack configuration
  • 另外,我们在loader期间,通过java-properties模块,把.properties文件编译成json格式的文件。从而.properies文件支持定义xx.xx.xx格式的文件。

在浏览器端通过aliyun-naza-l20n封装一个调用l20n的angular provider。

release 0.0.7

  1. 抽取webpack的配置项到该模块中,webpack.config.js只需要引入webpack-block.js即可。

release 0.0.9

  1. 修复webpack-block.js,指定filter
  2. 对于filter,输出的json和properties文件需要按顺序排列,这是l20n.js的一个bug。

对于l20n.js在解析文件时,以下格式的json解析会报错,即[other]不能在[one],[two]等最前面

key[other]=xxx
key[one]=xxx

release 0.0.10

  1. 修复resolveLoader要指向当前目录的node_modules

release 0.0.11

  1. 修复output,如果filename: '[name].[hash].js,这会导致build出错.

release 0.0.12

  1. 修复json,properties文件打包时,要去掉重复的key,以及做深度复制

release 0.0.13

  1. 修复ES6时国际化打包的问题