ignorePatternsRegExp: calcIgnorePatternRegExp()

in packages/jest-transform/src/ScriptTransformer.ts [93:182]


        ignorePatternsRegExp: calcIgnorePatternRegExp(this._config),
        transformRegExp: calcTransformRegExp(this._config),
        transformedFiles: new Map(),
      };

      projectCaches.set(configString, projectCache);
    }

    this._cache = projectCache;
  }

  private _buildCacheKeyFromFileInfo(
    fileData: string,
    filename: string,
    transformOptions: TransformOptions,
    transformerCacheKey: string | undefined,
  ): string {
    if (transformerCacheKey) {
      return createHash('md5')
        .update(transformerCacheKey)
        .update(CACHE_VERSION)
        .digest('hex');
    }

    return createHash('md5')
      .update(fileData)
      .update(transformOptions.configString)
      .update(transformOptions.instrument ? 'instrument' : '')
      .update(filename)
      .update(CACHE_VERSION)
      .digest('hex');
  }

  private _getCacheKey(
    fileData: string,
    filename: string,
    options: ReducedTransformOptions,
  ): string {
    const configString = this._cache.configString;
    const {transformer, transformerConfig = {}} =
      this._getTransformer(filename) || {};
    let transformerCacheKey = undefined;

    const transformOptions: TransformOptions = {
      ...options,
      cacheFS: this._cacheFS,
      config: this._config,
      configString,
      transformerConfig,
    };

    if (typeof transformer?.getCacheKey === 'function') {
      transformerCacheKey = transformer.getCacheKey(
        fileData,
        filename,
        transformOptions,
      );
    }

    return this._buildCacheKeyFromFileInfo(
      fileData,
      filename,
      transformOptions,
      transformerCacheKey,
    );
  }

  private async _getCacheKeyAsync(
    fileData: string,
    filename: string,
    options: ReducedTransformOptions,
  ): Promise<string> {
    const configString = this._cache.configString;
    const {transformer, transformerConfig = {}} =
      this._getTransformer(filename) || {};
    let transformerCacheKey = undefined;

    const transformOptions: TransformOptions = {
      ...options,
      cacheFS: this._cacheFS,
      config: this._config,
      configString,
      transformerConfig,
    };

    if (transformer) {
      const getCacheKey =
        transformer.getCacheKeyAsync || transformer.getCacheKey;

      if (typeof getCacheKey === 'function') {