Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I debug a custom transformer

Tags:

dart

dart-pub

How can I debug a (custom) transformer using the debugger in DartEditor.

I tried use the transformer shown in http://dovdev.com/smoke-and-mirrors/ but it fails.

I checked these documents but couldn't find anything about debugging.

  • https://www.dartlang.org/tools/pub/assets-and-transformers.html
  • https://www.dartlang.org/tools/pub/transformers/index.html
like image 495
Günter Zöchbauer Avatar asked Oct 06 '14 06:10

Günter Zöchbauer


1 Answers

Since pub runs transformers in its process, inside isolates, and doesn't redirect a transformers stdout, it's fairly hard to debug from within pub itself, so the best option is to run the transformer outside of pub by setting up a barback environment along with mocked files.

The code_transformers package makes this easier. See its tests library: http://www.dartdocs.org/documentation/code_transformers/0.2.3+1/index.html#code_transformers/code_transformers-tests

like image 53
Justin Fagnani Avatar answered Oct 27 '22 11:10

Justin Fagnani