Skip to content

Commit 27db781

Browse files
Merge pull request #147 from browserify/doc-shape
Document output format
2 parents 8a0da51 + 6da33b6 commit 27db781

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

readme.markdown

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ md.end({ file: __dirname + '/files/main.js' });
1818

1919
output:
2020

21-
```
21+
```json
2222
$ node example/deps.js
2323
[
2424
{"id":"/home/substack/projects/module-deps/example/files/main.js","source":"var foo = require('./foo');\nconsole.log('main: ' + foo(5));\n","entry":true,"deps":{"./foo":"/home/substack/projects/module-deps/example/files/foo.js"}}
@@ -32,7 +32,7 @@ $ node example/deps.js
3232
and you can feed this json data into
3333
[browser-pack](https://github.com/browserify/browser-pack):
3434

35-
```
35+
```bash
3636
$ node example/deps.js | browser-pack | node
3737
main: 1055
3838
```
@@ -149,15 +149,30 @@ in `process.env.NODE_PATH`
149149
Input objects should be string filenames or objects with these parameters:
150150

151151
* `row.file` - filename
152+
* `row.entry` - whether to treat this file as an entry point, defaults to
153+
`true`. Set to `false` to include this file, but not run it automatically.
152154
* `row.expose` - name to be exposed as
153-
* `row.noparse` when true, don't parse the file contents for dependencies
155+
* `row.noparse` - when true, don't parse the file contents for dependencies
154156
155157
or objects can specify transforms:
156158
157159
* `row.transform` - string name, path, or function
158160
* `row.options` - transform options as an object
159161
* `row.global` - boolean, whether the transform is global
160162
163+
# output objects
164+
165+
Output objects describe files with dependencies. They have these properties:
166+
167+
* `row.id` - an identifier for the file, used in the `row.deps` prperty
168+
* `row.file` - path to the source file
169+
* `row.entry` - true if the file is an entry point
170+
* `row.expose` - name to be exposed as
171+
* `row.source` - source file content as a string
172+
* `row.deps` - object describing dependencies. The keys are strings as used
173+
in `require()` calls in the file, and values are the row IDs (file paths)
174+
of dependencies.
175+
161176
# events
162177
163178
## d.on('transform', function (tr, file) {})

0 commit comments

Comments
 (0)