OLD | NEW |
1 # Dart2js Info | 1 # Dart2js Info |
2 | 2 |
3 This package contains libraries and tools you can use to process `.info.json` | 3 This package contains libraries and tools you can use to process `.info.json` |
4 files, which are produced when running dart2js with `--dump-info`. | 4 files, which are produced when running dart2js with `--dump-info`. |
5 | 5 |
6 The `.info.json` files contain data about each element included in | 6 The `.info.json` files contain data about each element included in |
7 the output of your program. The data includes information such as: | 7 the output of your program. The data includes information such as: |
8 | 8 |
9 * the size that each function adds to the `.dart.js` output, | 9 * the size that each function adds to the `.dart.js` output, |
10 * dependencies between functions, | 10 * dependencies between functions, |
(...skipping 19 matching lines...) Expand all Loading... |
30 add more data to the `.info.json` files, and include better tools to help | 30 add more data to the `.info.json` files, and include better tools to help |
31 understand the results of type inference. | 31 understand the results of type inference. |
32 | 32 |
33 This package is still in flux and we might make breaking changes at any time. | 33 This package is still in flux and we might make breaking changes at any time. |
34 Our current goal is not to provide a stable API, we mainly want to expose the | 34 Our current goal is not to provide a stable API, we mainly want to expose the |
35 functionality and iterate on it. We recommend that you pin a specific version | 35 functionality and iterate on it. We recommend that you pin a specific version |
36 of this package and update when needed. | 36 of this package and update when needed. |
37 | 37 |
38 ## Info API | 38 ## Info API |
39 | 39 |
40 [AllInfo][AllInfo] exposes a Dart representation of the `.info.json` files. | 40 [AllInfo][AllInfo] exposes a Dart representation of all of the collected |
41 You can parse the information using `AllInfo.fromJson`. For example: | 41 information. You can decode an `AllInfo` object from the JSON form produced by |
| 42 the `dart2js` `--dump-info` option using the `AllInfoJsonCodec`. For example: |
42 | 43 |
43 ```dart | 44 ```dart |
44 import 'dart:convert'; | 45 import 'dart:convert'; |
45 import 'dart:io'; | 46 import 'dart:io'; |
46 | 47 |
47 import 'package:dart2js_info/info.dart'; | 48 import 'package:dart2js_info/info.dart'; |
48 | 49 |
49 main(args) { | 50 main(args) { |
50 var infoPath = args[0]; | 51 var infoPath = args[0]; |
51 var json = JSON.decode(new File(infoPath).readAsStringSync()); | 52 var json = JSON.decode(new File(infoPath).readAsStringSync()); |
52 var info = new AllInfo.fromJson(json); | 53 var info = new AllInfoJsonCodec().decode(json); |
53 ... | 54 ... |
54 } | 55 } |
55 ``` | 56 ``` |
56 | 57 |
57 ## Available tools | 58 ## Available tools |
58 | 59 |
59 The following tools are a available today: | 60 The following tools are a available today: |
60 | 61 |
61 * [`code_deps.dart`][code_deps]: simple tool that can answer queries about the | 62 * [`code_deps.dart`][code_deps]: simple tool that can answer queries about the |
62 dependency between functions and fields in your program. Currently it only | 63 dependency between functions and fields in your program. Currently it only |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 287 |
287 [repo]: https://github.com/dart-lang/dart2js_info/ | 288 [repo]: https://github.com/dart-lang/dart2js_info/ |
288 [tracker]: https://github.com/dart-lang/dart2js_info/issues | 289 [tracker]: https://github.com/dart-lang/dart2js_info/issues |
289 [code_deps]: https://github.com/dart-lang/dart2js_info/blob/master/bin/code_deps
.dart | 290 [code_deps]: https://github.com/dart-lang/dart2js_info/blob/master/bin/code_deps
.dart |
290 [lib_split]: https://github.com/dart-lang/dart2js_info/blob/master/bin/library_s
ize_split.dart | 291 [lib_split]: https://github.com/dart-lang/dart2js_info/blob/master/bin/library_s
ize_split.dart |
291 [coverage]: https://github.com/dart-lang/dart2js_info/blob/master/bin/coverage_l
og_server.dart | 292 [coverage]: https://github.com/dart-lang/dart2js_info/blob/master/bin/coverage_l
og_server.dart |
292 [live]: https://github.com/dart-lang/dart2js_info/blob/master/bin/live_code_size
_analysis.dart | 293 [live]: https://github.com/dart-lang/dart2js_info/blob/master/bin/live_code_size
_analysis.dart |
293 [function_analysis]: https://github.com/dart-lang/dart2js_info/blob/master/bin/f
unction_size_analysis.dart | 294 [function_analysis]: https://github.com/dart-lang/dart2js_info/blob/master/bin/f
unction_size_analysis.dart |
294 [verify_deps]: https://github.com/dart-lang/dart2js_info/blob/master/bin/verify_
deps.dart | 295 [verify_deps]: https://github.com/dart-lang/dart2js_info/blob/master/bin/verify_
deps.dart |
295 [AllInfo]: http://dart-lang.github.io/dart2js_info/doc/api/dart2js_info.info/All
Info-class.html | 296 [AllInfo]: http://dart-lang.github.io/dart2js_info/doc/api/dart2js_info.info/All
Info-class.html |
OLD | NEW |