deps-patch
Allow to add dependencies not detected from code
Last updated 5 years ago by zoubin .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install deps-patch 
SYNC missed versions from official npm registry.

deps-patch

version status

A plugin for both browserify and depsify, to allow to add dependencies not detected from code.

Example

In the following example, entry.css depends upon entry-deps.css, and extra.css upon extra-deps.css.

We can make entry.css depends on extra.css using this plugin.

var reduce = require('reduce-css')
var path = require('path')

var b = reduce.create(
  'entry.css',
  { basedir: path.join(__dirname, 'src') },
  'bundle.css'
)
b.plugin('deps-patch')
b.bundle().pipe(b.dest(path.join(__dirname, 'build')))

// add dependencies
setTimeout(function () {
  b.emit('deps-patch.update', [
    // it claims that entry.css should depend on extra.css
    // even if entry.css does not do it in the code
    { file: 'entry.css', deps: ['extra.css'] },
  ])
}, 200)

The result would be something like:

.entry-deps{} /* from entry-deps.css */
.extra-deps{} /* from extra-deps.css */
.extra{} /* from extra.css */
.entry{} /* from entry.css */

Usage

The deps-patch.update event should be fired whenever you want to add new dependencies.

b.plugin('deps-patch')

b.emit('deps-patch.update', depsPatch)

depsPatch is an array of rows. A row is just an object with fields:

  • file: String. the file path to the dependent
  • deps: Array. an array of file path to modules the dependent should depend upon.

Current Tags

  • 0.2.0                                ...           latest (5 years ago)

2 Versions

  • 0.2.0                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (5)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |