• Public
  • Public/Protected
  • All


Process over Delphi Forms (.dfm) files via an AST.

Inspired by the excellent PostCSS tool, motivated by my rage at the Delphi IDE.

npm CircleCI branch Codecov branch Greenkeeper

Table of Contents


The postdfm project is an interface wrapping all the separate modules together.

# npm
$ npm install postdfm

# yarn
$ yarn add postdfm

Example Usage

const fs = require("fs");
const postdfm = require("postdfm");

const cisDfm = fs.readFileSync(
  //.dfm files tend to be ascii instead of utf8

const runner = postcss({
  transformers: [
    function(ast) {
      //transform and return the ast
      return transformedAst;

const transDfm = runner.processSync(dfm, {
  //filename used for reporting errors
  from: "cis.dfm"

fs.writeFileSync("trans.dfm", transDfm);


Runner instance

Create a runner by calling the postdfm function.

const postdfm = require("postdfm");
const runner = postdfm();

postdfm(options?: RunnerOptions)

Create a Runner instance using RunnerOptions

runner.process(dfm: string, processingOptions: ProcessingOptions): Promise<string>

Process a file through the runner asynchronously.

runner.processSync(dfm: string, processingOptions: ProcessingOptions): string

Process a file through the runner synchronously.


Options to pass to an instance of Runner.

options.transformers: Transformer[]

Array of transformations to perform on AST.

options.parser: Parser = "@postdfm/dfm2ast"

Parser to use, defaults to @postdfm/dfm2ast.

options.stringifier: Stringifier = "@postdfm/ast2dfm"

Stringifier to use, defaults to @postdfm/ast2dfm.


A function that takes an AST, transforms it, and returns it.

(ast: AST.Root): AST.Root


A function that takes a string, parses it, and returns an AST.

(dfm: string): AST.Root


A function that takes an AST, stringifies it, and returns a string.

(ast: AST.Root): string



The file which is being processed. Used when throwing syntax errors.

Generated Documentation

You can find the generated typedoc documentation here.


Bug reports and feature requests are greatly appreciated, as are pull requests.

Please see the Contributing Guide for instructions on how to contribute to this project.


Licensed under the MIT License.


External modules


  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc