Angular Modernizer
    Preparing search index...

    Transform rule for migrating Angular artifacts to standalone architecture.

    This rule implements the TransformRule interface and serves as the bridge between the Angular Modernizer's plugin system and the standalone migration orchestrator. It follows the "Thin Rule, Thick Orchestrator" pattern where the rule handles protocol compliance while delegating all business logic to the StandaloneMigrationOrchestrator.

    The rule orchestrates the migration of:

    • Components: Adds standalone: true and analyzes template dependencies
    • Directives: Adds standalone: true with empty imports
    • Pipes: Adds standalone: true (no imports needed)

    This rule is typically not used directly, but rather accessed through the StandalonePlugin:

    const plugin = new StandalonePlugin();
    const rules = plugin.getTransformRules();
    const rule = rules[0]; // StandaloneMigrationRule
    const result = await rule.transform(context);

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    category: "modernization" = 'modernization'

    Rule category for grouping.

    description: "Migrates Angular components, directives, and pipes to standalone architecture" = 'Migrates Angular components, directives, and pipes to standalone architecture'

    Rule description.

    id: "standalone:migrate-to-standalone" = 'standalone:migrate-to-standalone'

    Unique rule identifier. Format: "plugin-name:rule-name"

    name: "Migrate to Standalone" = 'Migrate to Standalone'

    Human-readable rule name.

    tags: string[] = ...

    Tags for filtering and search.

    Methods

    • Transform a source file by migrating Angular artifacts to standalone.

      Parameters

      Returns Promise<TransformResult>

      Promise resolving to the transformation result

      This method implements the TransformRule.transform contract. It delegates to the StandaloneMigrationOrchestrator for the actual transformation work, then packages the result into a TransformResult.

      The method:

      1. Captures the file's initial state
      2. Invokes the orchestrator to perform the migration
      3. Detects whether the file was modified
      4. Returns a standardized TransformResult

      The transform result includes:

      • modified: Whether the file was changed
      • message: A human-readable summary
      • filePath: The path to the transformed file
      • ruleId: This rule's identifier
      const rule = new StandaloneMigrationRule();
      const result = await rule.transform(context);

      if (result.modified) {
      console.info(`Migrated: ${result.filePath}`);
      }