ScriptTransformer.d.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. import { Config } from '@jest/types';
  8. import { Options, TransformResult } from './types';
  9. export default class ScriptTransformer {
  10. static EVAL_RESULT_VARIABLE: 'Object.<anonymous>';
  11. private _cache;
  12. private _config;
  13. private _transformCache;
  14. private _transformConfigCache;
  15. constructor(config: Config.ProjectConfig);
  16. private _getCacheKey;
  17. private _getFileCachePath;
  18. private _getTransformPath;
  19. private _getTransformer;
  20. private _instrumentFile;
  21. private _getRealPath;
  22. preloadTransformer(filepath: Config.Path): void;
  23. transformSource(filepath: Config.Path, content: string, instrument: boolean): {
  24. code: string;
  25. mapCoverage: boolean;
  26. sourceMapPath: string | null;
  27. };
  28. private _transformAndBuildScript;
  29. transform(filename: Config.Path, options: Options, fileSource?: string): TransformResult;
  30. transformJson(filename: Config.Path, options: Options, fileSource: string): string;
  31. requireAndTranspileModule<ModuleType = unknown>(moduleName: string, callback?: (module: ModuleType) => void): ModuleType;
  32. requireAndTranspileModule<ModuleType = unknown>(moduleName: string, callback?: (module: ModuleType) => Promise<void>): Promise<ModuleType>;
  33. /**
  34. * @deprecated use `this.shouldTransform` instead
  35. */
  36. private _shouldTransform;
  37. shouldTransform(filename: Config.Path): boolean;
  38. }
  39. //# sourceMappingURL=ScriptTransformer.d.ts.map