Package Exports
- @architect/parser
- @architect/parser/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@architect/parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@architect/parser 
OpenJS Architect is an Infrastructure as Code (IaC) solution. The critical insight of Infastructure as Code is determinism. Infrastructure resources are defined in a declarative manifest file with the code that depends on them. This ensures deployment artifacts alway have the exact runtime resources expected for every version of the code.
Architect looks in the following places for the primary definition/configuration manifest file:
The
.arcformat is unique to Architect with many readability advantages; but is not required
.arc
.arcis a text format for storing structured configuration data; it is not for serializing or transporting data
The .arc format:
- Comments follow
#symbols - Top level keys start with
@(example:@pragma) - Pragmas contain: scalar values or complex values
- Scalar values are:
string,numberandboolean - Complex values are:
array,vectorandmap - Whitespace is significant
Example
Consider a file some-arc-file.txt with the following contents:
# this is a comment
@section-one
simple-string-value # String
another-value
4.2 # Number
true # Boolean
@section-of-arrays
vector of values
vector tuple
@vectors-section
named
vector
of
values
@this-section-has-a-map
hello-world
name some-valueParsing the file with the following code:
#!/usr/bin/env node
const parse = require('@architect/parser')
const fs = require('node:fs')
const text = fs.readFileSync('./some-arc-file.txt').toString()
const result = parse(text)
console.log(result)Prints the following plain object to the console:
{
"section-one": [
"simple-string-value",
"another-value",
4.2,
true
],
"section-of-arrays": [
["vector", "of", "values"],
["vector", "tuple"]
],
"vectors-section": [
{named: ["vector", "of", "values"]},
],
"this-section-has-a-map": [{
"hello-world": {
"name": "some-value"
}
}]
}Things to notice:
arrayvalues are space seperated scalar values on a single linevectoris a namedarraywith scalar values indented two spaces on newlinesmapis a named value followed by keys and values indented two spaces