open-index/open-npm huggingface dataset:
npm package: @lancejpollard/tierra.js
Description: Terraform Script Builder in JavaScript
Author: Lance Pollard
Latest version: 1.0.2


```
npm install @lancejpollard/tierra.js
```

```js
const tierra = require('@lancejpollard/tierra.js')
const fs = require('fs')

const t = tierra()
t.terraform({
  blob: {
    required_version: '>= 0.12',
    required_providers: {
      type: 'block',
      blob: {
        aws: '~> 3.0.0'
      }
    }
  }
})
t.provider({
  name: 'aws',
  blob: {
    region: 'us-west-1'
  }
})
let m = t.module({
  type: 'env',
  name: 'staging',
  blob: {
    env: 'staging'
  }
})
m.resource({
  type: 'aws_lb',
  name: 'lb',
  blob: {
    foo: 'bar'
  }
})
m.variable({
  name: 'var1',
  blob: {
    type: 'string',
    default: 'foo'
  }
})
t.resource({
  type: 'aws_vpc',
  name: 'vpc',
  blob: {
    name: 'foo',
    bar: {
      type: 'block',
      blob: {
        baz: 123,
        bang: {
          type: 'block',
          blob: {
            eleven: true
          }
        }
      }
    },
    baz: {
      type: 'map',
      blob: {
        a: 1,
        b: true,
        c: 'three'
      }
    }
  }
})
t.forEach(blob => {
  if (blob.name) {
    if (!fs.existsSync(blob.name)) {
      fs.mkdirSync(blob.name)
    }
    fs.writeFileSync(`${blob.name}/main.tf`, blob.text)
  } else {
    fs.writeFileSync(`tmp/main.tf`, blob.text)
  }
})
```

```
terraform {
  required_version = ">= 0.12"

  required_providers {
    aws = "~> 3.0.0"
  }
}

provider "aws" {
  region = "us-west-1"
}

module "staging" {
  env = "staging"
  source = "./env"
}

resource "aws_vpc" "vpc" {
  name = "foo"

  bar {
    baz = 123

    bang {
      eleven = true
    }
  }

  baz = {
    a = 1
    b = true
    c = "three"
  }
}
```

```
resource "aws_lb" "lb" {
  foo = "bar"
}

variable "var1" {
  type = string
  default = "foo"
}
```
npm package: @lancer/ihtml-parser
Description: Fast & forgiving HTML/XML parser, with code interpolation
Author: Gilbert
Latest version: 1.0.1

# ihtml-parser

[![NPM version](http://img.shields.io/npm/v/ihtml-parser.svg?style=flat)](https://npmjs.org/package/@lancer/ihtml-parser)

A fork of [htmlparser2](https://github.com/fb55/htmlparser2) with added interpolation syntax. Made for use with the [Lancer html framework](https://github.com/LancerStudio/lancer).

## Installation

    npm install @lancer/ihtml-parser

## Usage

`ihtml-parser` extends `htmlparser2` to support `{{}}` for interpolation. The biggest difference in usage is receiving `string | Interpolation` instead of `string` during the parsing process.

Note that `{{}}` is not arbitrary string interpolation; it can only appear as an element's attribute or within an element's text.

Here's a quick example:

```javascript
const Parser = require("@lancer/ihtml-parser");
const parser = new htmlparser2.Parser({
    onopentag(name, attributes, iAttributes) {
        /*
         * `attributes` has type { [attrName: string]: string } | null
         *
         * However, for attributes with interpolations (e.g. foo="{{bar}}" or {{foo}}="bar"),
         * a third argument is present with type (ParsedAttribute[] | null)
         *
         * where ParsedAttribute = [DynamicContent, DynamicContent]
         * where DynamicContent = Array<string | Interpolation>
         * where Interpolation = { code: string }
         *
         * (Note that Interpolation is a class)
         */
         console.log("Open tag", name, attributes);
    },
    ontext(text) {
        /*
         * Before, `text` had type string
         *
         * Now, it has type string | Interpolation
         */
        console.log("-->", text);
    },
});
parser.write(
    `Xyz <a href="{{ myLink.url }}">Go to {{myLink.text}}</ a>`
);
parser.end();
```