| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.initAutoImportOptions = void 0;
- const uniPreset = {
- from: '@dcloudio/uni-app',
- imports: [
- // uni-app lifecycle
- // App and Page
- 'onShow',
- 'onHide',
- // App
- 'onAppShow',
- 'onLaunch',
- 'onError',
- 'onThemeChange',
- 'onKeyboardHeightChange',
- 'onPageNotFound',
- 'onUnhandledRejection',
- 'onLastPageBackPress',
- 'onExit',
- // Page
- 'onPageShow',
- 'onPageHide',
- 'onLoad',
- 'onReady',
- 'onUnload',
- 'onResize',
- 'onBackPress',
- 'onPageScroll',
- 'onTabItemTap',
- 'onReachBottom',
- 'onPullDownRefresh',
- // 辅助
- 'renderComponentSlot',
- ],
- };
- const uniH5Preset = {
- from: '@dcloudio/uni-h5',
- imports: [
- 'UniElement',
- 'UniElementImpl',
- 'UniButtonElement',
- 'UniCanvasElement',
- 'UniCheckboxElement',
- 'UniCheckboxGroupElement',
- 'UniEditorElement',
- 'UniFormElement',
- 'UniIconElement',
- 'UniImageElement',
- 'UniInputElement',
- 'UniLabelElement',
- 'UniMovableAreaElement',
- 'UniMovableViewElement',
- 'UniNavigatorElement',
- 'UniPickerViewElement',
- 'UniPickerViewColumnElement',
- 'UniProgressElement',
- 'UniRadioElement',
- 'UniRadioGroupElement',
- 'UniRichTextElement',
- 'UniScrollViewElement',
- 'UniSliderElement',
- 'UniSwiperElement',
- 'UniSwiperItemElement',
- 'UniSwitchElement',
- 'UniTextElement',
- 'UniTextareaElement',
- 'UniViewElement',
- 'UniListViewElement',
- 'UniListItemElement',
- 'UniStickySectionElement',
- 'UniStickyHeaderElement',
- 'UniVideoElement',
- 'UniWebViewElement',
- 'UniMapElement',
- 'UniCoverViewElement',
- 'UniCoverImageElement',
- 'UniPickerElement',
- ],
- };
- const cloudPreset = {
- '@dcloudio/uni-cloud': [['default', 'uniCloud']],
- };
- const vuePreset = {
- from: 'vue',
- imports: [
- // vue lifecycle
- 'onActivated',
- 'onBeforeMount',
- 'onBeforeUnmount',
- 'onBeforeUpdate',
- 'onErrorCaptured',
- 'onDeactivated',
- 'onMounted',
- 'onServerPrefetch',
- 'onUnmounted',
- 'onUpdated',
- // setup helpers
- 'useAttrs',
- 'useSlots',
- // reactivity,
- 'computed',
- 'customRef',
- 'isReadonly',
- 'isRef',
- 'isProxy',
- 'isReactive',
- 'markRaw',
- 'reactive',
- 'readonly',
- 'ref',
- 'shallowReactive',
- 'shallowReadonly',
- 'shallowRef',
- 'triggerRef',
- 'toRaw',
- 'toRef',
- 'toRefs',
- 'toValue',
- 'unref',
- 'watch',
- 'watchEffect',
- 'watchPostEffect',
- 'watchSyncEffect',
- // component
- 'defineComponent',
- 'defineAsyncComponent',
- 'getCurrentInstance',
- 'h',
- 'inject',
- 'nextTick',
- 'provide',
- 'useCssModule',
- 'createApp',
- // effect scope
- 'effectScope',
- 'EffectScope',
- 'getCurrentScope',
- 'onScopeDispose',
- // types 全部全局导入
- ],
- };
- function initAutoImportOptions(platform, { imports = [], ...userOptions }) {
- const autoImport = [uniPreset, cloudPreset, vuePreset];
- if (platform === 'web') {
- autoImport.push(uniH5Preset);
- }
- return {
- ...userOptions,
- include: [/\.[u]?ts$/, /\.[u]?vue/],
- exclude: [/[\\/]\.git[\\/]/],
- imports: imports.concat(
- // app-android 平台暂不注入其他
- platform === 'app-android' ? [] : autoImport),
- dts: false,
- };
- }
- exports.initAutoImportOptions = initAutoImportOptions;
|