AbstractObfuscatingReplacer.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. import { inject, injectable, } from 'inversify';
  2. import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
  3. import * as ESTree from 'estree';
  4. import { TNodeWithLexicalScope } from '../../../types/node/TNodeWithLexicalScope';
  5. import { IObfuscatingReplacer } from '../../../interfaces/node-transformers/obfuscating-transformers/obfuscating-replacers/IObfuscatingReplacer';
  6. import { IOptions } from '../../../interfaces/options/IOptions';
  7. @injectable()
  8. export abstract class AbstractObfuscatingReplacer implements IObfuscatingReplacer {
  9. /**
  10. * @type {IOptions}
  11. */
  12. protected readonly options: IOptions;
  13. /**
  14. * @param {IOptions} options
  15. */
  16. public constructor (
  17. @inject(ServiceIdentifiers.IOptions) options: IOptions
  18. ) {
  19. this.options = options;
  20. }
  21. /**
  22. * @param {Node} node
  23. * @param {TNodeWithLexicalScope} lexicalScopeNode
  24. * @returns {Node}
  25. */
  26. public abstract replace (node: ESTree.Node, lexicalScopeNode?: TNodeWithLexicalScope): ESTree.Node;
  27. }