reactivity-transform.d.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { ImportSpecifier, ImportDefaultSpecifier, ImportNamespaceSpecifier, Program } from '@babel/types';
  2. import MagicString, { SourceMap } from 'magic-string';
  3. import { ParserPlugin } from '@babel/parser';
  4. export declare function shouldTransform(src: string): boolean;
  5. export interface RefTransformOptions {
  6. filename?: string;
  7. sourceMap?: boolean;
  8. parserPlugins?: ParserPlugin[];
  9. importHelpersFrom?: string;
  10. }
  11. export interface RefTransformResults {
  12. code: string;
  13. map: SourceMap | null;
  14. rootRefs: string[];
  15. importedHelpers: string[];
  16. }
  17. export interface ImportBinding {
  18. local: string;
  19. imported: string;
  20. source: string;
  21. specifier: ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier;
  22. }
  23. export declare function transform(src: string, { filename, sourceMap, parserPlugins, importHelpersFrom }?: RefTransformOptions): RefTransformResults;
  24. export declare function transformAST(ast: Program, s: MagicString, offset?: number, knownRefs?: string[], knownProps?: Record<string, // public prop key
  25. {
  26. local: string;
  27. default?: any;
  28. isConst?: boolean;
  29. }>): {
  30. rootRefs: string[];
  31. importedHelpers: string[];
  32. };