H5-contact/node_modules/@dcloudio/vite-plugin-uni/dist/uvue/plugins/rewriteImportVue.d.ts

20 lines
1002 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { type ImportSpecifier } from 'es-module-lexer';
import MagicString from 'magic-string';
import type { Plugin } from 'vite';
/**
* 如下情况会生成import vue的代码
* 1. uvue页面编译产物通过helpers方式导入的vue相关apidefineComponent、unref等
* 2. 用户代码script中的ref、reactive、computed等
* 3. onLoad等从@dcloudio/uni-app导入的api等
* 4. 用户代码script中import vue的api
*
* 如果在transform中处理需要确保此插件在autoImport之后否则此时2、3尚未生成import vue的代码。
* 如果在renderChunk中处理能保证所有代码都已经生成import vue的代码但是此时热更新会触发所有文件重新处理import vue。
*/
export declare function rewriteImportVuePlugin(): Plugin;
/**
* import { xx as yy, zz } from 'vue' =>
* const { xx: yy, zz } = globalThis.Vue
*/
export declare function rewriteImportVue(input: string, importRanges?: Pick<ImportSpecifier, 'ss' | 'se'>[]): MagicString;