{"_id":"@amplication/ast-types","_rev":"2-a4ac44b0466be45f547f58b1e7a9c237","name":"@amplication/ast-types","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@amplication/ast-types","version":"0.0.1","_id":"@amplication/ast-types@0.0.1","maintainers":[{"name":"mulygottlieb","email":"muly@amplication.com"},{"name":"amplication-bot","email":"engineering@amplication.com"},{"name":"yuvalhazaz","email":"hazaz.yuval@gmail.com"},{"name":"morhag","email":"mor@amplication.com"},{"name":"levivannoort","email":"vanNoort.levi@protonmail.com"}],"dist":{"shasum":"c1014a2dfaaadbd94d8ea3b3fc504faf0531e200","tarball":"https://registry.npmjs.org/@amplication/ast-types/-/ast-types-0.0.1.tgz","fileCount":14,"integrity":"sha512-8F26ZCwMLXGU7pDAF+K8Feyl/tYeKnA3JmqKQ4Ni/6EiJhLNldf+iSBH7WzlwfUEKs2fmGSAskbDNTDbw60ROA==","signatures":[{"sig":"MEYCIQCo0yDmZuRcfsZ6klyL5Zox+l9E108xvZ9NX5doTRKefwIhALAB6YNtmQywskuRyLJQ51b7yrzVihk9OIDD/QieoSrU","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5327},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"1b3512b23785cd0c29878eebcd12bda3a9726e92","_npmUser":{"name":"yuvalhazaz","email":"hazaz.yuval@gmail.com"},"_npmVersion":"9.6.7","description":"This package provides common interfaces for AST (Abstract Syntax Tree) nodes and code generation writers used across different language-specific AST packages in Amplication.","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.5.0","ts-jest":"^29.1.0","typescript":"^5.0.4","@types/jest":"^29.5.0","@types/node":"^18.15.11"},"_npmOperationalInternal":{"tmp":"tmp/ast-types_0.0.1_1742464537894_0.9579915524840619","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@amplication/ast-types","version":"0.0.2","devDependencies":{"@types/jest":"^29.5.0","@types/node":"^18.15.11","jest":"^29.5.0","ts-jest":"^29.1.0","typescript":"^5.0.4"},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"1b3512b23785cd0c29878eebcd12bda3a9726e92","description":"This package provides common interfaces for AST (Abstract Syntax Tree) nodes and code generation writers used across different language-specific AST packages in Amplication.","_id":"@amplication/ast-types@0.0.2","_nodeVersion":"18.17.0","_npmVersion":"9.6.7","dist":{"integrity":"sha512-SyRHffotbouYLK5EJqyOkhY21M/qjNb2TfwbYVmY1i2roaIus24+MNb27Ruu4rNSX4Cf/8lWUEAne2eA5af+OQ==","shasum":"b3c3bb02fdba7b2410988a3869b36355c8cc359a","tarball":"https://registry.npmjs.org/@amplication/ast-types/-/ast-types-0.0.2.tgz","fileCount":14,"unpackedSize":5483,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIB1S0Ig+lE4fVyIbzyIeDaWktf924hbvY43ptoPIJzr2AiEAs+eVo3VrBrLwVBk2EB9tZUstBvBjd1sNUeBGbfxVaHE="}]},"_npmUser":{"name":"yuvalhazaz","email":"hazaz.yuval@gmail.com"},"directories":{},"maintainers":[{"name":"mulygottlieb","email":"muly@amplication.com"},{"name":"amplication-bot","email":"engineering@amplication.com"},{"name":"yuvalhazaz","email":"hazaz.yuval@gmail.com"},{"name":"morhag","email":"mor@amplication.com"},{"name":"levivannoort","email":"vanNoort.levi@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ast-types_0.0.2_1742471083171_0.5714587311193748"},"_hasShrinkwrap":false}},"time":{"created":"2025-03-20T09:55:37.756Z","modified":"2025-03-20T11:44:43.515Z","0.0.1":"2025-03-20T09:55:38.057Z","0.0.2":"2025-03-20T11:44:43.324Z"},"description":"This package provides common interfaces for AST (Abstract Syntax Tree) nodes and code generation writers used across different language-specific AST packages in Amplication.","maintainers":[{"name":"mulygottlieb","email":"muly@amplication.com"},{"name":"amplication-bot","email":"engineering@amplication.com"},{"name":"yuvalhazaz","email":"hazaz.yuval@gmail.com"},{"name":"morhag","email":"mor@amplication.com"},{"name":"levivannoort","email":"vanNoort.levi@protonmail.com"}],"readme":"# @amplication/ast-types\n\nThis package provides common interfaces for AST (Abstract Syntax Tree) nodes and code generation writers used across different language-specific AST packages in Amplication.\n\n## Interfaces\n\n### IAstNode\n\nThe base interface for all AST nodes in the Amplication AST system.\n\n```typescript\ninterface IAstNode {\n  /**\n   * Writes the AST node to the given writer.\n   * @param writer The writer to write to\n   */\n  write(writer: IWriter): void;\n}\n```\n\n### IWriter\n\nThe interface for code generation writers that handle proper indentation and formatting.\n\n```typescript\ninterface IWriter {\n  /**\n   * Writes text to the output buffer with proper indentation\n   * @param text The text to write\n   */\n  write(text: string): void;\n\n  /**\n   * Writes an AST node to the output buffer\n   * @param node The AST node to write\n   */\n  writeNode(node: IAstNode): void;\n\n  /**\n   * Writes text followed by a newline if the last line wasn't a newline\n   * @param text Optional text to write before the newline\n   */\n  writeLine(text?: string): void;\n\n  /**\n   * Writes a newline to the output buffer\n   */\n  newLine(): void;\n\n  /**\n   * Writes a newline if the last line wasn't a newline\n   */\n  writeNewLineIfLastLineNot(): void;\n\n  /**\n   * Increases the indentation level\n   */\n  indent(): void;\n\n  /**\n   * Decreases the indentation level\n   */\n  dedent(): void;\n\n  /**\n   * Returns the current contents of the output buffer\n   */\n  toString(): string;\n}\n```\n\n## Usage\n\nThis package is used by language-specific AST packages like `@amplication/csharp-ast` and `@amplication/java-ast` to ensure consistent AST node and writer implementations across different languages.\n\nExample usage in a language-specific package:\n\n```typescript\nimport { IAstNode, IWriter } from '@amplication/ast-types';\n\nexport class MyAstNode implements IAstNode {\n  write(writer: IWriter): void {\n    writer.write('// My AST node implementation');\n  }\n}\n```\n\n## Development\n\n### Building\n\n```bash\nnx build ast-types\n```\n\n### Testing\n\n```bash\nnx test ast-types\n```\n\n### Linting\n\n```bash\nnx lint ast-types\n```\n","readmeFilename":"README.md"}