{"_id":"@botfather/units-compiler","_rev":"2-fed7155061d7c6e7679b3b55401b0858","name":"@botfather/units-compiler","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.1":{"name":"@botfather/units-compiler","version":"0.1.1","license":"MIT","_id":"@botfather/units-compiler@0.1.1","maintainers":[{"name":"botfather","email":"mohan.tushar.11@gmail.com"}],"homepage":"https://github.com/Botfather/units/tree/main/packages/units-compiler","bugs":{"url":"https://github.com/Botfather/units/issues"},"dist":{"shasum":"27f8a3201eec453c9f3a80316aa6f4cffed7bdf1","tarball":"https://registry.npmjs.org/@botfather/units-compiler/-/units-compiler-0.1.1.tgz","fileCount":5,"integrity":"sha512-bT2X2uG4qCweKUXYFtzmGyEmJJvmKh4wE6IOQ/t8f/kRF9KzQD1DPYOj1KxDkjgJO1lknne6rn0GH9vXiR3/Ng==","signatures":[{"sig":"MEUCIDR/wr1VXRtv9kMBA2Yc4QZVD5CQzI0YUnHVggaEdgE1AiEAkaXLrJP7dUDMjdyf964do8NcUpKGbcryd8hJMrzLf5g=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@botfather%2funits-compiler@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":27596},"main":"./index.js","type":"module","_from":"file:botfather-units-compiler-0.1.1.tgz","types":"./index.d.ts","_npmUser":{"name":"botfather","email":"mohan.tushar.11@gmail.com"},"_resolved":"/tmp/582d4a24ade2c65c5d8a7d0b329910dc/botfather-units-compiler-0.1.1.tgz","_integrity":"sha512-bT2X2uG4qCweKUXYFtzmGyEmJJvmKh4wE6IOQ/t8f/kRF9KzQD1DPYOj1KxDkjgJO1lknne6rn0GH9vXiR3/Ng==","repository":{"url":"git+https://github.com/Botfather/units.git","type":"git","directory":"packages/units-compiler"},"_npmVersion":"11.17.0","description":"Compile host-agnostic UI trees into Units AST/DSL with optional transform programs.","directories":{},"_nodeVersion":"22.14.0","dependencies":{"@botfather/units":"2.0.0","@botfather/units-ui-ir":"0.1.1","@botfather/units-react-adapter":"0.1.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/units-compiler_0.1.1_1782196782296_0.38700831504988886","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@botfather/units-compiler","version":"0.1.2","description":"Compile host-agnostic UI trees into Units AST/DSL with optional transform programs.","license":"MIT","type":"module","repository":{"type":"git","url":"git+https://github.com/Botfather/units.git","directory":"packages/units-compiler"},"homepage":"https://github.com/Botfather/units/tree/main/packages/units-compiler","bugs":{"url":"https://github.com/Botfather/units/issues"},"main":"./index.js","types":"./index.d.ts","dependencies":{"@botfather/units":"2.0.1","@botfather/units-react-adapter":"0.1.1","@botfather/units-ui-ir":"0.1.1"},"publishConfig":{"access":"public"},"_id":"@botfather/units-compiler@0.1.2","_integrity":"sha512-+yR1dlE2AeP5Bv0LrtN5ta/DYVkea9KLzidbbwiPN6vlupktuuH3+OjazTxLQyKkbLPg4JZgfZ+pu7vK9smFVg==","_resolved":"/tmp/1297e9e3685da04c58fb447fa77812c5/botfather-units-compiler-0.1.2.tgz","_from":"file:botfather-units-compiler-0.1.2.tgz","_nodeVersion":"24.16.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-+yR1dlE2AeP5Bv0LrtN5ta/DYVkea9KLzidbbwiPN6vlupktuuH3+OjazTxLQyKkbLPg4JZgfZ+pu7vK9smFVg==","shasum":"3629f97956976a0e4879846fa64923533af47c96","tarball":"https://registry.npmjs.org/@botfather/units-compiler/-/units-compiler-0.1.2.tgz","fileCount":5,"unpackedSize":27596,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@botfather%2funits-compiler@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDy07+duRtNbG16rhXO7PgdWq7lDgwch2V2YkiCEZlayAIgC3mMxkv7DsFQT391UG9ywTmMfmTmB7gQ1qnnXRki6n4="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5908717c-c6df-44f8-86f0-e3f335a5b3be"}},"directories":{},"maintainers":[{"name":"botfather","email":"mohan.tushar.11@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/units-compiler_0.1.2_1782219357039_0.5155033964107278"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-23T06:39:42.037Z","modified":"2026-06-23T12:55:57.468Z","0.1.1":"2026-06-23T06:39:42.438Z","0.1.2":"2026-06-23T12:55:57.179Z"},"bugs":{"url":"https://github.com/Botfather/units/issues"},"license":"MIT","homepage":"https://github.com/Botfather/units/tree/main/packages/units-compiler","repository":{"type":"git","url":"git+https://github.com/Botfather/units.git","directory":"packages/units-compiler"},"description":"Compile host-agnostic UI trees into Units AST/DSL with optional transform programs.","maintainers":[{"name":"botfather","email":"mohan.tushar.11@gmail.com"}],"readme":"# @botfather/units-compiler\n\nCompile host-agnostic UI trees into Units AST/DSL.\n\n## Install\n\n```sh\nnpm install @botfather/units-compiler @botfather/units\n```\n\n## Usage\n\n```js\nimport { compileUiToUnits } from \"@botfather/units-compiler\";\n\nconst result = compileUiToUnits(uiTree, {\n  sourceType: \"dom\",\n  program: transformProgramSource,\n});\n\nconsole.log(result.dsl);\nconsole.log(result.ast);\n```\n\n`compileUiToUnits` pipeline:\n- Detect/normalize host tree into Units IR (`dom`, `a11y`, `react`, `slack`, or `ir`)\n- Optionally run a Units transform program\n- Emit Units DSL (with small structural heuristics like `#for` on repeated leaf siblings)\n- Parse DSL back into Units AST\n\nSlack Block Kit payloads can be compiled with `sourceType: \"slack\"`. Text objects using `type: \"mrkdwn\"` are normalized into regular IR nodes for Slack styles, links, mentions, channels, special mentions, dates, quotes, and code spans without changing the Units grammar.\n\n```js\nconst slackResult = compileUiToUnits(blockKitPayload, {\n  sourceType: \"slack\",\n});\n```\n\nFor token efficiency, implicit actions are omitted by default (`button -> click`, `input -> input`, etc). Set `includeImplicitActions: true` to always emit explicit action props.\n\nThe compiler also compacts redundant leaf `name`/text duplication by default. When a leaf node has identical `name` and text, it emits a single compact form (`Button (name:'Save')`) instead of both representations. Set `includeRedundantName: true` and/or `includeRedundantLeafText: true` to keep explicit duplicates.\n\nWhen loop heuristics emit inline JS list literals, the compiler prints them in compact form and deduplicates loop item fields when `name` and `text` move together.\n\nRedundant root containers are omitted by default when they do not carry meaningful metadata, state, actions, or visible text. Set `includeRootContainer: true` to always emit the top-level container node.\n\n## Exports\n\n- `compileUiToUnits(uiRoot, programOrOptions?, maybeOptions?)`\n- `compileUiToUnitsDsl(uiRoot, programOrOptions?, maybeOptions?)`\n","readmeFilename":"README.md"}