1 | /*
|
2 | Copyright (c) 2012, Yahoo! Inc. All rights reserved.
|
3 | Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
4 | */
|
5 |
|
6 | /*jslint nomen: true */
|
7 | var path = require('path'),
|
8 | Store = require('./lib/store'),
|
9 | Report = require('./lib/report'),
|
10 | meta = require('./lib/util/meta');
|
11 |
|
12 | //register our standard plugins
|
13 | require('./lib/register-plugins');
|
14 |
|
15 | /**
|
16 | * the top-level API for `istanbul`. provides access to the key libraries in
|
17 | * istanbul so you can write your own tools using `istanbul` as a library.
|
18 | *
|
19 | * Usage
|
20 | * -----
|
21 | *
|
22 | * var istanbul = require('istanbul');
|
23 | *
|
24 | *
|
25 | * @class Istanbul
|
26 | * @static
|
27 | * @module main
|
28 | * @main main
|
29 | */
|
30 |
|
31 | module.exports = {
|
32 | /**
|
33 | * the Instrumenter class.
|
34 | * @property Instrumenter
|
35 | * @type Instrumenter
|
36 | * @static
|
37 | */
|
38 | Instrumenter: require('./lib/instrumenter'),
|
39 | /**
|
40 | * the Store class.
|
41 | * @property Store
|
42 | * @type Store
|
43 | * @static
|
44 | */
|
45 | Store: Store,
|
46 | /**
|
47 | * the Collector class
|
48 | * @property Collector
|
49 | * @type Collector
|
50 | * @static
|
51 | */
|
52 | Collector: require('./lib/collector'),
|
53 | /**
|
54 | * the hook module
|
55 | * @property hook
|
56 | * @type Hook
|
57 | * @static
|
58 | */
|
59 | hook: require('./lib/hook'),
|
60 | /**
|
61 | * the Report class
|
62 | * @property Report
|
63 | * @type Report
|
64 | * @static
|
65 | */
|
66 | Report: Report,
|
67 | /**
|
68 | * the config module
|
69 | * @property config
|
70 | * @type Config
|
71 | * @static
|
72 | */
|
73 | config: require('./lib/config'),
|
74 | /**
|
75 | * the Reporter class
|
76 | * @property Reporter
|
77 | * @type Reporter
|
78 | * @static
|
79 | */
|
80 | Reporter: require('./lib/reporter'),
|
81 | /**
|
82 | * utility for processing coverage objects
|
83 | * @property utils
|
84 | * @type ObjectUtils
|
85 | * @static
|
86 | */
|
87 | utils: require('./lib/object-utils'),
|
88 | /**
|
89 | * asynchronously returns a function that can match filesystem paths.
|
90 | * The function returned in the callback may be passed directly as a `matcher`
|
91 | * to the functions in the `hook` module.
|
92 | *
|
93 | * When no options are passed, the match function is one that matches all JS
|
94 | * files under the current working directory except ones under `node_modules`
|
95 | *
|
96 | * Match patterns are `ant`-style patterns processed using the `glob` library.
|
97 | * Examples not provided due to limitations in putting asterisks inside
|
98 | * jsdoc comments. Please refer to tests under `test/other/test-matcher.js`
|
99 | * for examples.
|
100 | *
|
101 | * @method matcherFor
|
102 | * @static
|
103 | * @param {Object} options Optional. Lookup options.
|
104 | * @param {String} [options.root] the root of the filesystem tree under
|
105 | * which to match files. Defaults to `process.cwd()`
|
106 | * @param {Array} [options.includes] an array of include patterns to match.
|
107 | * Defaults to all JS files under the root.
|
108 | * @param {Array} [options.excludes] and array of exclude patterns. File paths
|
109 | * matching these patterns will be excluded by the returned matcher.
|
110 | * Defaults to files under `node_modules` found anywhere under root.
|
111 | * @param {Function(err, matchFunction)} callback The callback that is
|
112 | * called with two arguments. The first is an `Error` object in case
|
113 | * of errors or a falsy value if there were no errors. The second
|
114 | * is a function that may be use as a matcher.
|
115 | */
|
116 | matcherFor: require('./lib/util/file-matcher').matcherFor,
|
117 | /**
|
118 | * the version of the library
|
119 | * @property VERSION
|
120 | * @type String
|
121 | * @static
|
122 | */
|
123 | VERSION: meta.VERSION,
|
124 | /**
|
125 | * the abstract Writer class
|
126 | * @property Writer
|
127 | * @type Writer
|
128 | * @static
|
129 | */
|
130 | Writer: require('./lib/util/writer').Writer,
|
131 | /**
|
132 | * the abstract ContentWriter class
|
133 | * @property ContentWriter
|
134 | * @type ContentWriter
|
135 | * @static
|
136 | */
|
137 | ContentWriter: require('./lib/util/writer').ContentWriter,
|
138 | /**
|
139 | * the concrete FileWriter class
|
140 | * @property FileWriter
|
141 | * @type FileWriter
|
142 | * @static
|
143 | */
|
144 | FileWriter: require('./lib/util/file-writer'),
|
145 | //undocumented
|
146 | _yuiLoadHook: require('./lib/util/yui-load-hook'),
|
147 | //undocumented
|
148 | TreeSummarizer: require('./lib/util/tree-summarizer'),
|
149 | //undocumented
|
150 | assetsDir: path.resolve(__dirname, 'lib', 'assets')
|
151 | };
|
152 |
|
153 |
|