node-haste

node-haste is a dependency management system for static resources for node.js. It provides the ability to statically resolve JavaScript module dependencies both for node module resolution and Facebook's haste module system.

BSD-3-Clause 52 个版本
安装
npm install node-haste
yarn add node-haste
pnpm add node-haste
bun add node-haste
README

node-haste Build Status

node-haste is a dependency management system for static resources for node.js. It provides the ability to statically resolve JavaScript module dependencies both for node module resolution and Facebook's haste module system.

It is used internally at Facebook as well as externally as part of Facebook's open source projects, like jest and react-native.

Note: If you are consuming the code here and you are not also a Facebook project, be prepared for a bad time. APIs may appear or disappear and we may not follow semver strictly, though we will do our best to. This library is being published with our use cases in mind and is not necessarily meant to be consumed by the broader public. In order for us to move fast and ship projects like Jest and react-native, we've made the decision to not support everybody. We probably won't take your feature requests unless they align with our needs. There will be overlap in functionality here and in other open source projects.

Example Usage

npm install --save node-haste
const NodeHaste = require('node-haste');

const cache = new NodeHaste.Cache({
  cacheKey: '$$cacheKey$$',
});

const fileWatcher = new NodeHaste.FileWatcher([{
  dir: '/path/to/node-haste/lib',
}], {useWatchman: true});

// Create an instance of the dependency graph
const graph = new NodeHaste({
  roots: ['/path/to/node-haste/lib'],
  cache,
  fileWatcher,
  // Don't throw on unresolved errors; node-haste currently doesn't support
  // native node modules, for example.
  shouldThrowOnUnresolvedErrors: () => false,
});

// Find all recursive dependencies of `lib/index.js`
graph.getDependencies('/path/to/node-haste/lib/index.js')
  .then(
    response => console.log(response.dependencies.map(dep => dep.path)),
    error => console.error(error)
  );

Development

$ npm install
$ npm test
版本列表
2.12.0-alpha.0 2016-05-19
2.12.0 2016-05-20
2.11.0 2016-05-04
2.10.1 2016-04-28
2.10.0 2016-04-27
2.9.6 2016-04-06
2.9.5 2016-04-06
2.9.4 2016-03-23
2.9.3 2016-03-22
2.9.2 2016-03-21
2.9.0 2016-03-14
2.8.0 2016-03-11
2.7.0 2016-03-09
2.6.1 2016-03-06
2.6.0 2016-03-05
2.5.0 2016-02-26
2.4.0 2016-02-25
2.3.0 2016-02-20
2.2.0 2016-02-19
2.1.3 2016-02-19
2.1.2 2016-02-19
2.1.1 2016-02-18
2.1.0 2016-02-18
2.0.0 2016-02-17
2.0.0-alpha9 2016-01-28
2.0.0-alpha8 2016-01-26
2.0.0-alpha7 2016-01-14
2.0.0-alpha6 2016-01-14
2.0.0-alpha5 2016-01-12
2.0.0-alpha4 2016-01-08
2.0.0-alpha3 2016-01-05
2.0.0-alpha2 2015-11-14
2.0.0-alpha19 2016-02-15
2.0.0-alpha18 2016-02-09
2.0.0-alpha17 2016-02-09
2.0.0-alpha16 2016-02-03
2.0.0-alpha15 2016-02-02
2.0.0-alpha14 2016-02-02
2.0.0-alpha13 2016-02-01
2.0.0-alpha12 2016-02-01
2.0.0-alpha11 2016-02-01
2.0.0-alpha1 2015-11-14
1.2.8 2014-12-03
1.2.7 2014-12-01
1.2.6 2014-07-03
1.2.5 2014-05-16
1.2.4 2014-05-16
1.2.3 2014-05-16
1.2.2 2014-05-15
1.2.1 2014-02-19
0.2.1 2013-12-03
0.2.0 2013-11-14