hunk.code_window:   }
   }
   /**
    * This uses a dynamic import to load a module which may be ESM.
    * CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
    * will currently, unconditionally downlevel dynamic import into a require call.
    * require calls cannot load ESM code and will result in a runtime error. To workaround
  
hunk.labels: keep keep add keep keep keep keep keep
hunk.after_edit: /**
    * Lazily compiled dynamic import loader function.
    */
   let load: (<T>(modulePath: string | URL) => Promise<T>) | undefined;
  
hunk.file_path: packages/angular_devkit/architect/node/node-modules-architect-host.ts
hunk.type: add
file: import { expectFileToMatch } from '../../utils/fs';
  import { execWithEnv, extractNpmEnv, ng, silentNpm } from '../../utils/process';
  import { installPackage, uninstallPackage } from '../../utils/packages';
  import { isPrereleaseCli } from '../../utils/project';
  
  export default async function () {
    // Must publish old version to local registry to allow install. This is especially important
    // for release commits as npm will try to request tooling packages that are not on the npm registry yet
    await publishOutdated('@schematics/angular@7');
    await publishOutdated('@angular-devkit/core@7');
    await publishOutdated('@angular-devkit/schematics@7');
  
    // Install outdated and incompatible version
    await installPackage('@schematics/angular@7');
  
    const tag = (await isPrereleaseCli()) ? '@next' : '';
    await ng('add', `@angular/material${tag}`, '--skip-confirmation');
    await expectFileToMatch('package.json', /@angular\/material/);
  
    // Clean up existing cdk package
    // Not doing so can cause adding material to fail if an incompatible cdk is present
    await uninstallPackage('@angular/cdk');
  }
  
  async function publishOutdated(npmSpecifier: string): Promise<void> {
    const { stdout: stdoutPack } = await silentNpm(
      'pack',
      npmSpecifier,
      '--registry=https://registry.npmjs.org',
    );
    await execWithEnv('npm', ['publish', stdoutPack.trim(), '--tag=outdated'], {
      ...extractNpmEnv(),
      // Also set an auth token value for the local test registry which is required by npm 7+
      // even though it is never actually used.
      'NPM_CONFIG__AUTH': 'e2e-testing',
    });
  }
  