module-hook
Last updated 8 years ago by taojie .
ISC · Original npm · Tarball · package.json
$ cnpm install module-hook 
SYNC missed versions from official npm registry.

module-hook

在指定名称及版本的模块被加载前执行指定的操作,方便对模块进行修改或源码替换。

Installation

$ npm install module-hook --save

Usage

import { hook } from 'module-hook';

hook('debug', '^3.x', (loadModule, replaceSource, version) => {
  // loadModule: 加载模块下的文件
  // replaceSource(file, replacer): 覆盖指定文件源码
  //   replacer(source): replacer 可以是文件地址或者函数,函数参数如上所述
  // version: 当前加载的模块版本
});

License

MIT

Current Tags

  • 2.1.3                                ...           latest (7 years ago)

8 Versions

  • 2.1.3                                ...           7 years ago
  • 2.1.2                                ...           7 years ago
  • 2.1.1                                ...           7 years ago
  • 2.1.0                                ...           8 years ago
  • 2.0.0                                ...           8 years ago
  • 1.0.2                                ...           8 years ago
  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (4)

Copyright 2013 - present © cnpmjs.org | Home |