dag 0.1.0 copy "dag: ^0.1.0" to clipboard
dag: ^0.1.0 copied to clipboard

Transpiles .dag files (plain text with embedded Dart code, PHP-style) into plain .dart source files. Not a template engine: the .dag file IS Dart code, interleaved with literal text, exactly like a .p [...]

0.1.0 #

Initial release.

  • Transpile .dag files (literal text with embedded Dart, PHP-style) into plain .dart source. Not a template engine — a .dag file compiles to real Dart, evaluated at compile time, not interpreted at runtime.
  • Tags: <?dag ... ?> (raw code, inserted verbatim — can open/close a block across multiple tags, e.g. if (x) { ... }), <?dag= expr ?> (echo an expression), <?dag:imports ?> (deduped, hoisted to file top), <?dag:params ?> (render function's parameter list), <?dag:name ?> (rename the generated function, default render).
  • Generated function is always Future<String> ... async, so any echo or code can await a Future/Future<String> with no extra setup.
  • Runtime errors are rethrown as DagError, carrying the original error, its stack trace, and the exact .dag file + line that caused it — via a single try/catch around the whole function body plus a cheap line-tracking variable (no per-statement try/catch overhead).
  • Whitespace control: <?dag- ... ?> / <?dag ... -?> / <?dag- ... -?> trim adjacent whitespace independently on each side (Twig-style), with <?- as shorthand for <?dag-. Lets structural tags (for, if, }) sit on their own line without leaking a blank line into the output.
  • dag CLI (dart run dag:dag <file|dir> [--out] [--watch]) for file/directory transpilation with optional watch mode.
  • package:build Builder (lib/builder.dart, registered via build.yaml) so .dag -> .g.dart can run through build_runner as part of a normal Dart build pipeline.
4
likes
0
points
134
downloads

Publisher

verified publisherfinchdart.com

Weekly Downloads

Transpiles .dag files (plain text with embedded Dart code, PHP-style) into plain .dart source files. Not a template engine: the .dag file IS Dart code, interleaved with literal text, exactly like a .php file is PHP code interleaved with HTML.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

args, build, path, watcher

More

Packages that depend on dag