@@ -29,28 +29,32 @@ import {
2929 ExportDefaultDeclaration ,
3030 ExportNamedDeclaration ,
3131 RestElement ,
32- Pattern ,
33- Expression ,
34- V8IntrinsicIdentifier
32+ Pattern
3533} from '@babel/types'
3634import generate from '@babel/generator'
37-
38- import { getCoreExports } from './imports'
3935import {
4036 _babelInterop ,
4137 extractCurrentScope ,
4238 extractFunctionCallId ,
43- extractFunctionCallName ,
4439 extractFunctionId ,
4540 extractFunctionName
4641} from './artifacts/artifacts'
47- import { findIgnoredImports , shouldIgnoreCall } from './packageIgnores'
4842import { ArtifactMarking , FlytrapConfig } from '../core/types'
4943import { parseCode } from './parser'
5044import { createHumanLog } from '../core/errors'
5145import { log } from '../core/logging'
5246import { Err , Ok } from 'ts-results'
5347import { shouldIgnoreFunctionName } from './function-excludes'
48+ import { shouldIgnoreCall } from './call-ignores'
49+ import * as flytrapExports from '../index'
50+
51+ function getRequiredExportsForCapture ( ) : string [ ] {
52+ return [ 'uff' , 'ufc' , 'setFlytrapConfig' ]
53+ }
54+
55+ function getCoreExports ( ) : string [ ] {
56+ return Object . keys ( flytrapExports )
57+ }
5458
5559export function getCalleeAndAccessorKey ( node : MemberExpression | Identifier ) {
5660 if ( ! isMemberExpression ( node ) ) {
@@ -128,6 +132,7 @@ export function flytrapTransformWithArtifacts(
128132 code : string ,
129133 filePath : string ,
130134 config ?: Partial < FlytrapConfig > ,
135+ findIgnoredImports ?: ( code : string , packageIgnores : string [ ] ) => string [ ] ,
131136 returnArtifacts = false
132137) {
133138 const parseResult = parseCode ( code , filePath , config ?. babel ?. parserOptions )
@@ -157,9 +162,10 @@ export function flytrapTransformWithArtifacts(
157162 return Ok ( [ startIndex , endIndex ] )
158163 }
159164
160- const ignoredImports = config ?. packageIgnores
161- ? findIgnoredImports ( code , config . packageIgnores )
162- : undefined
165+ const ignoredImports =
166+ config ?. packageIgnores && findIgnoredImports
167+ ? findIgnoredImports ( code , config . packageIgnores )
168+ : undefined
163169
164170 try {
165171 _babelInterop ( babelTraverse ) ( ast , {
0 commit comments