diff --git a/plugins/vite-plugin-canyon/src/index.ts b/plugins/vite-plugin-canyon/src/index.ts index 93af9cf5..b07bdb25 100644 --- a/plugins/vite-plugin-canyon/src/index.ts +++ b/plugins/vite-plugin-canyon/src/index.ts @@ -1,5 +1,7 @@ import { parse } from '@babel/parser'; +// @ts-ignore import _traverse from '@babel/traverse'; +// @ts-ignore import _generator from '@babel/generator'; import {visitorProgramExit} from "./visitor-program-exit"; @@ -14,10 +16,11 @@ function resolveFilename(id: string): string { return id; } -export default function VitePluginInstrumentation(serviceParams) { +export default function VitePluginInstrumentation() { return { name: 'vite-plugin-instrumentation', enforce: 'post', + // @ts-ignore transform(code, id) { // 解析代码为 AST const ast = parse(code, { @@ -45,6 +48,7 @@ export default function VitePluginInstrumentation(serviceParams) { // 遍历和修改 AST traverse(ast, { Program: { + // @ts-ignore exit(path) { // 在 Program 节点的退出时执行 visitorProgramExit(undefined, path, { diff --git a/plugins/vite-plugin-canyon/src/visitor-program-exit.ts b/plugins/vite-plugin-canyon/src/visitor-program-exit.ts index ddcb9f23..613dcfe1 100644 --- a/plugins/vite-plugin-canyon/src/visitor-program-exit.ts +++ b/plugins/vite-plugin-canyon/src/visitor-program-exit.ts @@ -1,5 +1,6 @@ import {generateInitialCoverage} from "./helpers/generate-initial-coverage"; // import _traverse from '@babel/traverse'; +// @ts-ignore import _generator from '@babel/generator'; import t from '@babel/types'; // const { default: traverse } = _traverse; diff --git a/plugins/vite-plugin-canyon/tsconfig.json b/plugins/vite-plugin-canyon/tsconfig.json index d3425075..2a6e0a70 100644 --- a/plugins/vite-plugin-canyon/tsconfig.json +++ b/plugins/vite-plugin-canyon/tsconfig.json @@ -1,7 +1,18 @@ { "compilerOptions": { - "resolveJsonModule": true, - "esModuleInterop": true, + "target": "es2018", + "module": "commonjs", + "moduleResolution": "node", + "lib": [ "dom" ], + "rootDir": "src", + "outDir": "dist", + "sourceMap": true, + "declaration": true, + "declarationMap": true, + "strict": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true }, - "include": ["src"] + "include": [ "src/*" ], + "exclude": [ "**/node_modules" ] }