Skip to content

Oxygen

Choose a tag to compare

@hershel-theodore-layton hershel-theodore-layton released this 15 Feb 07:17
· 30 commits to master since this release
7ce7f26

This is the first release of expr-dump.

We are skipping v0.0.0 Ho, Ho, Ho. The current api is stableTM1. All the options are provided via a shape, so new options that deprecate the older ones can be added in a backwards compatible way.

This utility builds on the previous work in type-visitor. Dump values to source code, yep, that's about it. If you have never needed it, you'll hear crickets. If you have used hacky Str\replace() workarounds to approximate this, like hhvm-autoload does, or you have had the pleasure of writing a HackCodegen\HackBuilderRenderer, you may like this solution, no promises.

Support for built-in dumpers is limited to the following types:

  • bool
  • dict
  • dynamic / mixed / nonnull
  • enums (require an EnumDefinition)
  • float (also num)
  • keyset
  • int (also arraykey, num)
  • null
  • nullables (of any of the supported types)
  • shape
  • string (also arraykey)
  • tuple
  • vec
  • vec_or_dict

Support for other types can be added with custom dumpers and default dumpers can be overridden using the same mechanism.

In the same line as static-type-assertion-code-generator, use this dependency as a development dependency. TypeVisitor is built on an eternally unstable api. (It has been unstable since at least 2016).

  1. Obviously not a legal trademark. Riffing on the joke "Soon superscript TM".