https://github.com/manbearwiz/angular-compiler-bundled
@angular/compiler bundled with esbuild to cjs to be used in schematics
https://github.com/manbearwiz/angular-compiler-bundled
abstract-syntax-tree angular angular-schematics esbuild
Last synced: about 1 month ago
JSON representation
@angular/compiler bundled with esbuild to cjs to be used in schematics
- Host: GitHub
- URL: https://github.com/manbearwiz/angular-compiler-bundled
- Owner: manbearwiz
- License: mit
- Created: 2024-02-16T23:28:24.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-10T20:00:24.000Z (about 1 year ago)
- Last Synced: 2025-09-30T22:48:52.947Z (5 months ago)
- Topics: abstract-syntax-tree, angular, angular-schematics, esbuild
- Language: TypeScript
- Homepage:
- Size: 99.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Deprecated
Most of the functionality in this package is now available in [@angular-eslint/bundled-angular-compiler](https://www.npmjs.com/package/@angular-eslint/bundled-angular-compiler).
# angular-compiler-bundled
## Introduction
This package bundles the `@angular/compiler` package and its dependencies into a single CommonJS (cjs) format file using esbuild, so you can import it via `require` in environments that do not support ES modules, such as compiled [Angular Schematics](https://angular.io/guide/schematics).
## Installation
You can install `angular-compiler-bundled` via npm:
```bash
npm install angular-compiler-bundled
```
## Usage
After installation, you can import the bundled Angular compiler module in your code:
```typescript
import { parseTemplate } from "angular-compiler-bundled";
const ast = parseTemplate(template.content, template.filePath, {
preserveWhitespaces: true,
preserveLineEndings: true,
leadingTriviaChars: [],
});
```
This package also includes some utility functions from the `angular/components` repo that are not exported by the original `@angular/compiler` package:
```typescript
import {
visitElements,
replaceStartTag,
replaceEndTag,
updateAttribute
} from 'angular-compiler-bundled';
```
## Disclaimer
This package is not officially maintained by the Angular team. I'm assuming they don't provide CommonJS support in the `@angular/compiler` package because that api is not considered public and is subject to change without notice.
I would love to move away from this package as soon as the Angular team provides better utilities for schematics development.