ProductPromotion
Logo

Angular.JS

made by https://0x3d.site

GitHub - IKatsuba/mutates: Still afraid to do something with AST? Mutates the AST, not your brain.
Still afraid to do something with AST? Mutates the AST, not your brain. - IKatsuba/mutates
Visit Site

GitHub - IKatsuba/mutates: Still afraid to do something with AST? Mutates the AST, not your brain.

GitHub - IKatsuba/mutates: Still afraid to do something with AST? Mutates the AST, not your brain.

Mutates

๐Ÿš€ Mutates is a powerful toolset for mutating the Abstract Syntax Tree (AST) of TypeScript files. It is a fork of ng-morph, with a broader focus beyond Angular-specific transformations, allowing for extensive AST modifications in any TypeScript project.

Features

โœจ AST Mutations: Modify the AST of any TypeScript file.
๐ŸŒ Framework-Agnostic: Not limited to Angular; can be used with any TypeScript-based project.
๐Ÿ”ง Extensible: Framework-specific transformations are available through separate packages.

Packages

Core Package

@mutates/core

The core package provides the essential functionalities needed to manipulate the AST of TypeScript files. It serves as the foundation for other specialized packages.

Framework-Specific Packages

Framework-specific transformations have been decoupled from the core package and are available as separate packages. For example:

@mutates/angular

This package includes transformations specific to Angular projects, leveraging the capabilities of @mutates/core to provide Angular-focused AST modifications.

@mutates/nx

This package includes transformations specific to Nx workspaces, allowing for Nx-specific filesystem operations and AST modifications.

Installation

To install the core package, use the following command:

npm install @mutates/core

For Angular-specific transformations, install the Angular package as well:

npm install @mutates/angular @mutates/core

For Nx-specific transformations, install the Nx package:

npm install @mutates/nx @mutates/core

Usage

Basic Example

Here is a simple example demonstrating how to use @mutates/core to modify a TypeScript file:

import { addFunctions, creataProject, createSourceFile, saveProject } from '@mutates/core';

// Initialize a new project
createProject();

// Add a TypeScript file to the project
createSourceFile(
  'example.ts',
  `
  const greet = (name: string) => {
    return 'Hello, ' + name;
  };
`,
);

// Perform some transformations
addFunctions('example.ts', {
  name: 'farewell',
  isExported: true,
  statements: "return 'buy!'",
});

// Save the modified file
saveProject();

Angular Example

To perform Angular-specific transformations, use @mutates/angular along with @mutates/core:

import { addProviders, getComponents } from '@mutates/angular';
import { createProject, createSourceFile, saveProject } from '@mutates/core';

// Initialize a new Angular project
createProject();

// Add an Angular component file to the project
createSourceFile(
  'app.component.ts',
  `
  import { Component } from '@angular/core';

  @Component({
    selector: 'app-root',
    template: '<h1>Hello, World!</h1>'
  })
  export class AppComponent {}
`,
);

// Perform some Angular-specific transformations
addProviders(getComponents('app.component.ts').at(0)!, ['AppService']);

// Save the modified file
saveProject();

Contributing

๐Ÿค Contributions are welcome! If you have any improvements or suggestions, feel free to open an issue or submit a pull request.

License

๐Ÿ“„ Mutates is licensed under the Apache-2.0 License. See the LICENSE file for more information.


For more detailed documentation, please visit the official documentation.

For further assistance or to report issues, please visit GitHub repository.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory