提交 70b61ef3 编写于 作者: fxy060608's avatar fxy060608

chore: 增加 sort-import

上级 0eead14c
......@@ -6,6 +6,7 @@ module.exports = {
parserOptions: {
sourceType: 'module',
},
plugins: ['import', '@typescript-eslint'],
rules: {
'no-unused-vars': [
'error',
......@@ -22,6 +23,20 @@ module.exports = {
'ObjectExpression > SpreadElement',
'ObjectPattern > RestElement',
],
'sort-imports': ['error', { ignoreDeclarationSort: true }],
// This rule enforces the preference for using '@ts-expect-error' comments in TypeScript
// code to indicate intentional type errors, improving code clarity and maintainability.
'@typescript-eslint/prefer-ts-expect-error': 'error',
// Enforce the use of 'import type' for importing types
'@typescript-eslint/consistent-type-imports': [
'error',
{
fixStyle: 'inline-type-imports',
disallowTypeAnnotations: false,
},
],
// Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers
'@typescript-eslint/no-import-type-side-effects': 'error',
},
overrides: [
// tests, no restrictions (runs in Node / jest with jsdom)
......
import {
capitalize,
hasOwn,
makeMap,
isArray,
isString,
isObject,
toRawType,
capitalize,
isPlainObject,
isString,
makeMap,
toRawType,
} from '@vue/shared'
export const CHOOSE_SIZE_TYPES = ['original', 'compressed']
......
......@@ -1730,7 +1730,7 @@ function addEventListener(pageId, callback) {
}
}
else {
// @ts-ignore
// @ts-expect-error
window.__plusMessage = onPlusMessage$1;
}
callbacks$3[pageId] = callback;
......
import { computed, Ref, reactive, watch, onBeforeUnmount } from 'vue'
import { CustomEventTrigger } from '@dcloudio/uni-components'
import { Position, useNative } from './useNative'
import { type Ref, computed, onBeforeUnmount, reactive, watch } from 'vue'
import type { CustomEventTrigger } from '@dcloudio/uni-components'
import { type Position, useNative } from './useNative'
import { formatLog } from '@dcloudio/uni-shared'
let id = 0
......
import {
Ref,
reactive,
ref,
type Ref,
computed,
provide,
inject,
onMounted,
onBeforeUnmount,
onMounted,
provide,
reactive,
ref,
} from 'vue'
import { getNavigationBarHeight } from './navigationBar'
import { getRealPath } from '../platform/getRealPath'
......
......@@ -2,8 +2,8 @@ import { getCurrentPage, getRealRoute } from '@dcloudio/uni-core'
import {
DATA_RE,
SCHEME_RE,
cacheStringFunction,
addLeadingSlash,
cacheStringFunction,
} from '@dcloudio/uni-shared'
export function getRealPath(filepath: string) {
// 无协议的情况补全 https
......
import * as uni from './api'
import { UniServiceJSBridge } from './bridge'
import { getApp, registerApp as __registerApp } from './framework/app'
import { registerApp as __registerApp, getApp } from './framework/app'
import {
definePage as __definePage,
registerPage as __registerPage,
......
import { weexGetSystemInfoSync } from './api/device/systemInfo'
import { normalizeStyles } from '@dcloudio/uni-shared'
import { parseWebviewStyle } from './framework/webview/style/index'
import type { parseWebviewStyle } from './framework/webview/style/index'
import { ON_THEME_CHANGE } from '@dcloudio/uni-shared'
import { setStatusBarStyle } from './statusBar'
import { getAllPages } from './framework/page/getCurrentPages'
......
import { getCurrentPage } from '@dcloudio/uni-core'
import { ComponentPublicInstance } from 'vue'
import type { ComponentPublicInstance } from 'vue'
export function getCurrentWebview() {
const page = getCurrentPage()
......
import { camelize, capitalize, isString } from '@vue/shared'
import { getRealPath } from '../platform/getRealPath'
import { defaultRpx2Unit, createRpx2Unit } from '@dcloudio/uni-shared'
import { createRpx2Unit, defaultRpx2Unit } from '@dcloudio/uni-shared'
export function normalizeStyleValue(val: string) {
return normalizeUrl(normalizeRpx(val))
......
import * as uni from './api/index'
import { getApp, registerApp as __registerApp, initApp } from './framework/app'
import { registerApp as __registerApp, getApp, initApp } from './framework/app'
import {
getCurrentPages,
definePage as __definePage,
getCurrentPages,
} from '../service/framework/page'
import * as components from './components'
......
import { getCurrentPage } from '@dcloudio/uni-core'
import { ComponentPublicInstance } from 'vue'
import { UniPage } from '@dcloudio/uni-app-x/types/native'
import type { ComponentPublicInstance } from 'vue'
import type { UniPage } from '@dcloudio/uni-app-x/types/native'
interface UniPageFix extends UniPage {
applyStatusBarStyle(): void
......
......@@ -117,17 +117,14 @@ function report(type: string, err: any) {
}, 10)
}
// @ts-ignore
global.__error_reporting__ = report
process
.on('unhandledRejection', (reason, p) => {
// @ts-ignore
global.__error_reporting__('unhandledRejection', reason)
console.log(reason)
})
.on('uncaughtException', (err) => {
// @ts-ignore
global.__error_reporting__('uncaughtException', err.stack)
console.log(err)
})
......@@ -3,8 +3,8 @@ import { isAppIOSUVueNativeTag } from '@dcloudio/uni-shared'
import {
MANIFEST_JSON_UTS,
PAGES_JSON_UTS,
UniViteCopyPluginOptions,
UniVitePlugin,
type UniViteCopyPluginOptions,
type UniVitePlugin,
initI18nOptions,
injectAssetPlugin,
matchUTSComponent,
......@@ -14,7 +14,7 @@ import {
transformUTSComponent,
} from '@dcloudio/uni-cli-shared'
import { compileI18nJsonStr } from '@dcloudio/uni-i18n'
import { Plugin, ResolvedConfig } from 'vite'
import type { Plugin, ResolvedConfig } from 'vite'
export function createUniOptions(
platform: 'android' | 'ios'
......
import {
UNI_EASYCOM_EXCLUDE,
initAppProvide,
uniEasycomPlugin,
uniHBuilderXConsolePlugin,
uniViteInjectPlugin,
UNI_EASYCOM_EXCLUDE,
uniEasycomPlugin,
} from '@dcloudio/uni-cli-shared'
import { uniManifestJsonPlugin } from '../plugins/manifestJson'
......
import fs from 'fs'
import path from 'path'
import { ConfigEnv, UserConfig } from 'vite'
import type { ConfigEnv, UserConfig } from 'vite'
import {
emptyDir,
......
import { Plugin, ResolvedConfig } from 'vite'
import type { Plugin, ResolvedConfig } from 'vite'
import {
injectAssetPlugin,
......
import { resolveVueI18nRuntime, UniVitePlugin } from '@dcloudio/uni-cli-shared'
import {
type UniVitePlugin,
resolveVueI18nRuntime,
} from '@dcloudio/uni-cli-shared'
import { uniOptions } from './uni'
import { buildOptions } from './build'
......
import path from 'path'
import { Plugin } from 'vite'
import type { Plugin } from 'vite'
import {
APP_CONFIG,
......
import { Plugin, ResolvedConfig } from 'vite'
import type { Plugin, ResolvedConfig } from 'vite'
import { hash } from '@dcloudio/uni-cli-shared'
const emittedHashMap = new WeakMap<ResolvedConfig, Map<string, string>>()
......
import path from 'path'
import fs from 'fs-extra'
import { Plugin } from 'vite'
import type { Plugin } from 'vite'
import { templateDir } from '../utils'
import { resolveBuiltIn } from '@dcloudio/uni-cli-shared'
......
import {
initAppProvide,
uniViteInjectPlugin,
uniCssScopedPlugin,
getAppStyleIsolation,
parseManifestJsonOnce,
uniHBuilderXConsolePlugin,
UNI_EASYCOM_EXCLUDE,
isVueSfcFile,
isUniPageFile,
getAppStyleIsolation,
initAppProvide,
isAppVue,
isUniPageFile,
isVueSfcFile,
parseManifestJsonOnce,
uniCssScopedPlugin,
uniEasycomPlugin,
uniHBuilderXConsolePlugin,
uniViteInjectPlugin,
} from '@dcloudio/uni-cli-shared'
import { uniTemplatePlugin } from '../plugins/template'
import { uniManifestJsonPlugin } from '../plugins/manifestJson'
......
import { runByHBuilderX } from '../hbx/env'
import { parseManifestJsonOnce, getPlatformManifestJsonOnce } from '../json'
import { getPlatformManifestJsonOnce, parseManifestJsonOnce } from '../json'
export function initDefine(stringifyBoolean: boolean = false) {
const manifestJson = parseManifestJsonOnce(process.env.UNI_INPUT_DIR)
......
......@@ -6,7 +6,7 @@ import type { LogErrorOptions } from 'vite'
import { NodeTypes } from '@vue/compiler-core'
import { isString } from '@vue/shared'
import { normalizePath } from '../utils'
import { Formatter } from '../logs/format'
import type { Formatter } from '../logs/format'
import { EXTNAME_VUE_RE } from '../constants'
import { parseVue } from '../vite/utils/ast'
......
......@@ -2,9 +2,9 @@ import fs from 'fs'
import path from 'path'
import { extend, hasOwn } from '@vue/shared'
import {
once,
defaultRpx2Unit,
defaultMiniProgramRpx2Unit,
defaultRpx2Unit,
once,
} from '@dcloudio/uni-shared'
import { parseJson } from './json'
......
......@@ -2,12 +2,12 @@ import fs from 'fs'
import path from 'path'
import { extend, hasOwn, isArray, isPlainObject } from '@vue/shared'
import {
addLeadingSlash,
once,
TABBAR_HEIGHT,
addLeadingSlash,
normalizeTitleColor,
once,
} from '@dcloudio/uni-shared'
import { removeExt, normalizePath } from '../utils'
import { normalizePath, removeExt } from '../utils'
import { parseJson } from './json'
import { isVueSfcFile } from '../vue/utils'
import { parseVueRequest } from '../vite'
......
import fs from 'fs'
import path from 'path'
import { parseJson } from './json'
import { once, normalizeStyles } from '@dcloudio/uni-shared'
import { normalizeStyles, once } from '@dcloudio/uni-shared'
export function hasThemeJson(themeLocation: string) {
if (!fs.existsSync(themeLocation)) {
......
......@@ -4,12 +4,12 @@ import { isString } from '@vue/shared'
import { isInHBuilderX, runByHBuilderX } from '../hbx/env'
import { moduleAliasFormatter } from '../hbx/alias'
import {
errorFormatter,
h5ServeFormatter,
removeInfoFormatter,
removeWarnFormatter,
errorFormatter,
} from '../hbx/log'
import { LogErrorOptions, LogOptions } from 'vite'
import type { LogErrorOptions, LogOptions } from 'vite'
export interface Formatter<T extends LogOptions = LogOptions> {
test: (msg: string, options?: T) => boolean
......
import type { Program } from '@babel/types'
import { parse, ParserPlugin } from '@babel/parser'
import { type ParserPlugin, parse } from '@babel/parser'
import { normalizeParsePlugins } from '../utils'
export function parseProgram(
......
import {
type Node,
type Program,
isArrayExpression,
isIdentifier,
isObjectProperty,
isStringLiteral,
Node,
Program,
} from '@babel/types'
import { walk } from 'estree-walker'
......
import path from 'path'
import { PluginContext } from 'rollup'
import { init, parse as parseImports, ImportSpecifier } from 'es-module-lexer'
import type { PluginContext } from 'rollup'
import {
type ImportSpecifier,
init,
parse as parseImports,
} from 'es-module-lexer'
import { extend } from '@vue/shared'
import { isImportDeclaration, isImportDefaultSpecifier } from '@babel/types'
import { parse } from '@babel/parser'
......
import fs from 'fs'
import path from 'path'
import { UniViteCopyPluginTarget } from '../vite/plugins/copy'
import type { UniViteCopyPluginTarget } from '../vite/plugins/copy'
import { parseJson } from '../json/json'
import { getPlatformManifestJsonOnce } from '../json/manifest'
......
import {
IfStatement,
ImportDeclaration,
type IfStatement,
type ImportDeclaration,
type Node,
type ObjectProperty,
type Program,
type Statement,
type StringLiteral,
isBlockStatement,
isCallExpression,
isIdentifier,
......@@ -12,11 +17,6 @@ import {
isStringLiteral,
isUnaryExpression,
isVariableDeclaration,
Node,
ObjectProperty,
Program,
Statement,
StringLiteral,
} from '@babel/types'
import { walk } from 'estree-walker'
import MagicString from 'magic-string'
......
import {
Node,
type Node,
isCallExpression,
isIdentifier,
isMemberExpression,
......
import type { Plugin } from 'postcss'
import type { Options } from 'autoprefixer'
import uniPostcssScopedPlugin from './plugins/stylePluginScoped'
import uniPostcssPlugin, { UniAppCssProcessorOptions } from './plugins/uniapp'
import uniPostcssPlugin, {
type UniAppCssProcessorOptions,
} from './plugins/uniapp'
export { uniPostcssPlugin }
export { uniPostcssScopedPlugin }
export function initPostcssPlugin({
......
import { Options } from 'unplugin-auto-import/types'
import type { Options } from 'unplugin-auto-import/types'
export type AutoImportOptions = Options
......
......@@ -8,7 +8,7 @@ import type {
SFCStyleCompileOptions,
TemplateCompiler,
} from '@vue/compiler-sfc'
import { UniViteCopyPluginOptions } from './plugins/copy'
import type { UniViteCopyPluginOptions } from './plugins/copy'
export const cssTarget = 'chrome53'
export interface CopyOptions {
......
import * as BabelCore from '@babel/core'
import type * as BabelCore from '@babel/core'
import type { PluginObj } from '@babel/core'
import { isBuiltInComponent } from '@dcloudio/uni-shared'
......
import {
ElementNode,
type AttributeNode,
type ElementNode,
NodeTypes,
RootNode,
ParentNode,
TemplateChildNode,
AttributeNode,
type ParentNode,
type RootNode,
type TemplateChildNode,
} from '@vue/compiler-core'
import MagicString from 'magic-string'
import { isElementNode, parseVue } from '../vite/utils/ast'
......
import { extend, isString } from '@vue/shared'
import { isComponentTag } from '@dcloudio/uni-shared'
import {
AttributeNode,
ComponentNode,
createSimpleExpression,
DirectiveNode,
ElementNode,
type AttributeNode,
type ComponentNode,
type DirectiveNode,
type ElementNode,
ElementTypes,
isCoreComponent,
locStub,
type ExpressionNode,
NodeTypes,
RootNode,
ExpressionNode,
TemplateChildNode,
TransformContext,
type Position,
type RootNode,
type SourceLocation,
type TemplateChildNode,
type TransformContext,
createSimpleExpression,
isCoreComponent,
isStaticExp,
SourceLocation,
Position,
locStub,
} from '@vue/compiler-core'
import { createAssetUrlTransformWithOptions } from './transforms/templateTransformAssetUrl'
import { createSrcsetTransformWithOptions } from './transforms/templateTransformSrcset'
......
......@@ -3,7 +3,7 @@ import { existsSync } from 'node:fs'
import { mkdir, readFile, writeFile as writeFile_ } from 'node:fs/promises'
import type { EasyComContext } from './context'
import { notNullish, slash } from '../utils'
import { ComponentInfo } from './types'
import type { ComponentInfo } from './types'
const multilineCommentsRE = /\/\*.*?\*\//gms
const singlelineCommentsRE = /\/\/.*$/gm
......
......@@ -98,7 +98,6 @@ function createNavigatorOnClick(props2) {
case "redirect":
uni.redirectTo({
url: props2.url,
// @ts-ignore
exists: props2.exists
});
break;
......
......@@ -15,7 +15,7 @@ export function getAdData(
}
// TODO 缺少语法提示 getDrawAds
// @ts-ignore
// @ts-expect-error
plus.ad.getDrawAds(
{
adpid: String(adpid),
......
import { ComputedRef, ExtractPropTypes } from 'vue'
import type { ComputedRef, ExtractPropTypes } from 'vue'
import { PolySymbol } from '@dcloudio/uni-core'
export const uniCheckGroupKey = PolySymbol(__DEV__ ? 'uniCheckGroup' : 'ucg')
......
import { ExtractPropTypes } from 'vue'
import type { ExtractPropTypes } from 'vue'
export const movableAreaProps = {
scaleArea: {
type: Boolean,
......
......@@ -109,7 +109,6 @@ export function createNavigatorOnClick(
case 'redirect':
uni.redirectTo({
url: props.url,
// @ts-ignore
exists: props.exists,
})
break
......
import {
PropType,
ExtractPropTypes,
import type {
ComponentInternalInstance,
ExtractPropTypes,
PropType,
WritableComputedRef,
} from 'vue'
import { isArray } from '@vue/shared'
......
import { WritableComputedRef, ExtractPropTypes } from 'vue'
import type { ExtractPropTypes, WritableComputedRef } from 'vue'
import { PolySymbol } from '@dcloudio/uni-core'
export const uniRadioGroupKey = PolySymbol(__DEV__ ? 'uniRadioGroup' : 'ucg')
......
......@@ -30,11 +30,11 @@ export class UniElement extends HTMLElement {
get style() {
const originalStyle = super.style
// @ts-ignore
// @ts-expect-error
if (originalStyle.__patchRpx__) {
return originalStyle
}
// @ts-ignore
// @ts-expect-error
originalStyle.__patchRpx__ = true
const originalSetProperty = originalStyle.setProperty.bind(originalStyle)
super.style.setProperty = function (
......
import { ComponentOptionsMixin } from 'vue'
import { AnimationAction, MPAnimation } from '@dcloudio/uni-api'
import type { ComponentOptionsMixin } from 'vue'
import type { AnimationAction, MPAnimation } from '@dcloudio/uni-api'
function converPx(value: string) {
if (/^-?\d+[ur]px$/i.test(value)) {
......
import {
ComponentCustomOptions,
type ComponentCustomOptions,
createElementBlock,
defineComponent,
openBlock,
......
import { Fragment, VNode, isVNode } from 'vue'
import { Fragment, type VNode, isVNode } from 'vue'
import { isArray } from '@vue/shared'
export function flatVNode(nodes: any): VNode[] {
......
import { onMounted, getCurrentInstance } from 'vue'
import { getCurrentInstance, onMounted } from 'vue'
import { useCurrentPageId } from '@dcloudio/uni-core'
type ContextType = 'canvas' | 'map' | 'video' | 'editor'
......
import { Ref, SetupContext, EmitsOptions } from 'vue'
import type { EmitsOptions, Ref, SetupContext } from 'vue'
import { normalizeTarget } from '@dcloudio/uni-shared'
import { createNativeEvent } from '@dcloudio/uni-core'
......
import {
Ref,
ref,
SetupContext,
watch,
onMounted,
onBeforeMount,
type ExtractPropTypes,
type HTMLAttributes,
type Ref,
type SetupContext,
computed,
reactive,
nextTick,
HTMLAttributes,
ExtractPropTypes,
onBeforeMount,
onMounted,
reactive,
ref,
watch,
} from 'vue'
import { extend, isFunction } from '@vue/shared'
import { debounce } from '@dcloudio/uni-shared'
import { getCurrentPageId, registerViewMethod } from '@dcloudio/uni-core'
import { throttle } from './throttle'
import { useCustomEvent, CustomEventTrigger } from './useEvent'
import { type CustomEventTrigger, useCustomEvent } from './useEvent'
import { useUserAction } from './useUserAction'
import {
props as keyboardProps,
emit as keyboardEmit,
props as keyboardProps,
useKeyboard,
} from './useKeyboard'
import { useScopedAttrs } from './useScopedAttrs'
......@@ -233,13 +233,13 @@ function useBase(
}
})
// #if _X_
// @ts-ignore
// @ts-expect-error
const value =
getValueString(props.modelValue, props.type, maxlength.value) ||
getValueString(props.value, props.type, maxlength.value)
// #endif
// #if !_X_
// @ts-ignore
// @ts-expect-error
const value =
getValueString(props.modelValue, props.type) ||
getValueString(props.value, props.type)
......@@ -279,13 +279,13 @@ function useValueSync(
trigger: CustomEventTrigger
) {
// #if _X_
//@ts-ignore
//@ts-expect-error
const valueChangeFn = throttle((val: any) => {
state.value = getValueString(val, props.type, state.maxlength)
}, 100)
// #endif
// #if !_X_
//@ts-ignore
//@ts-expect-error
const valueChangeFn = debounce(
(val: any) => {
state.value = getValueString(val, props.type)
......
import { getCurrentInstance, inject, onBeforeUnmount } from 'vue'
import { isString } from '@vue/shared'
import { UniFormCtx, uniFormKey } from '../vue/form'
import { type UniFormCtx, uniFormKey } from '../vue/form'
interface ValueState {
value: string
......
import { Ref, watch, computed } from 'vue'
import { CustomEventTrigger } from './useEvent'
import { type Ref, computed, watch } from 'vue'
import type { CustomEventTrigger } from './useEvent'
import { plusReady } from '@dcloudio/uni-shared'
let resetTimer: ReturnType<typeof setTimeout>
......
import { isPlainObject } from '@vue/shared'
import { watch, onUnmounted } from 'vue'
import { onUnmounted, watch } from 'vue'
import { useCurrentPageId } from '@dcloudio/uni-core'
export function useListeners(
......
import { cacheStringFunction } from '@dcloudio/uni-shared'
import { Ref, SetupContext, EmitsOptions } from 'vue'
import type { EmitsOptions, Ref, SetupContext } from 'vue'
type EventDetail = Record<string, any>
type WeexTarget = WechatMiniprogram.BaseEvent['target']
......
import { onMounted, getCurrentInstance, reactive } from 'vue'
import { getCurrentInstance, onMounted, reactive } from 'vue'
interface State {
attrs: Record<string, string>
......
import {
watch,
onMounted,
onBeforeUnmount,
type ComponentPublicInstance,
getCurrentInstance,
ComponentPublicInstance,
onBeforeUnmount,
onMounted,
watch,
} from 'vue'
import {
getCurrentPageId,
......
import { onMounted, onBeforeUnmount, reactive } from 'vue'
import { onBeforeUnmount, onMounted, reactive } from 'vue'
import { passive } from '@dcloudio/uni-shared'
......
......@@ -17,10 +17,10 @@ import PickerViewColumn, {
} from './picker-view-column/index'
import Progress, { UniProgressElement } from './progress/index'
//#if _X_
// @ts-ignore
// @ts-expect-error
import Radio, { UniRadioElement } from './radio/index-x'
//#else
// @ts-ignore
// @ts-expect-error
import Radio from './radio/index'
//#endif
import RadioGroup, { UniRadioGroupElement } from './radio-group/index'
......@@ -28,10 +28,10 @@ import ResizeSensor from './resize-sensor/index'
import RichText, { UniRichTextElement } from './rich-text'
import ScrollView, { UniScrollViewElement } from './scroll-view/index'
//#if _X_
// @ts-ignore
// @ts-expect-error
import Slider, { UniSliderElement } from './slider/index-x'
//#else
// @ts-ignore
// @ts-expect-error
import Slider from './slider/index'
//#endif
import Swiper, { UniSwiperElement } from './swiper/index'
......
......@@ -85,9 +85,6 @@ export function removeStyle(id: string) {
let style = sheetsMap.get(id)
if (style) {
if (style instanceof CSSStyleSheet) {
// @ts-ignore
const index = document.adoptedStyleSheets.indexOf(style)
// @ts-ignore
document.adoptedStyleSheets = document.adoptedStyleSheets.filter(
(s: CSSStyleSheet) => s !== style
)
......
import { ComponentPublicInstance } from 'vue'
import { isString, isArray, remove } from '@vue/shared'
import type { ComponentPublicInstance } from 'vue'
import { isArray, isString, remove } from '@vue/shared'
import { invokeArrayFns } from '@dcloudio/uni-shared'
import { getCurrentPageVm } from './page'
......
import {
type EventChannel,
addLeadingSlash,
EventChannel,
resolveComponentInstance,
normalizeStyles,
resolveComponentInstance,
} from '@dcloudio/uni-shared'
import { extend } from '@vue/shared'
import {
ComponentInternalInstance,
ComponentPublicInstance,
type ComponentInternalInstance,
type ComponentPublicInstance,
getCurrentInstance,
} from 'vue'
import { rpx2px } from './util'
......
......@@ -60,7 +60,7 @@ function addEventListener(pageId: string, callback: CallBack) {
globalEvent.addEventListener('plusMessage', onPlusMessage)
}
} else {
// @ts-ignore
// @ts-expect-error
window.__plusMessage = onPlusMessage
}
callbacks[pageId] = callback
......
import { defineI18nProperty, defineI18nProperties } from './useI18n'
import { defineI18nProperties, defineI18nProperty } from './useI18n'
import { isEnableLocale } from './utils'
export function initNavigationBarI18n(
......
import { isArray, isString } from '@vue/shared'
import {
getEnvLocale,
I18N_JSON_DELIMITERS,
UNI_STORAGE_LOCALE,
getEnvLocale,
} from '@dcloudio/uni-shared'
import { BuiltInLocale, initVueI18n, isI18nStr } from '@dcloudio/uni-i18n'
import { type BuiltInLocale, initVueI18n, isI18nStr } from '@dcloudio/uni-i18n'
import { isEnableLocale } from './utils'
let i18n: ReturnType<typeof initVueI18n>
......
......@@ -3,14 +3,14 @@ import fs from 'fs'
import path from 'path'
import type { Plugin, ResolvedConfig, ServerOptions } from 'vite'
import {
getDevServerOptions,
initPostcssPlugin,
isInHBuilderX,
isSsr,
normalizePath,
getDevServerOptions,
resolveMainPathOnce,
parseManifestJsonOnce,
initPostcssPlugin,
parseRpx2UnitOnce,
isSsr,
resolveMainPathOnce,
} from '@dcloudio/uni-cli-shared'
import { createDefine } from '../utils'
import { esbuildPrePlugin } from './esbuild/esbuildPrePlugin'
......
import type { ResolvedConfig } from 'vite'
import {
UniVitePlugin,
type UniVitePlugin,
rewriteCompileScriptSetupLangOnce,
} from '@dcloudio/uni-cli-shared'
import { createHandleHotUpdate } from './handleHotUpdate'
......
import {
type UniVitePlugin,
transformH5BuiltInComponents,
transformMatchMedia,
transformPageHead,
transformRefresherSlot,
transformTapToClick,
transformUniH5Jsx,
UniVitePlugin,
transformRefresherSlot,
} from '@dcloudio/uni-cli-shared'
import { isH5NativeTag, isH5CustomElement } from '@dcloudio/uni-shared'
import { CompilerOptions } from '@vue/compiler-core'
import { isH5CustomElement, isH5NativeTag } from '@dcloudio/uni-shared'
import type { CompilerOptions } from '@vue/compiler-core'
function realIsH5CustomElement(tag: string) {
return isH5CustomElement(tag, process.env.UNI_APP_X === 'true')
......
import fs from 'fs'
import path from 'path'
import { normalizePath, Plugin, ResolvedConfig } from 'vite'
import { type Plugin, type ResolvedConfig, normalizePath } from 'vite'
import {
buildInCssSet,
minifyCSS,
getAssetHash,
resolveBuiltIn,
isExternalUrl,
minifyCSS,
resolveBuiltIn,
} from '@dcloudio/uni-cli-shared'
import { OutputOptions } from 'rollup'
import type { OutputOptions } from 'rollup'
import { isFunction, isString } from '@vue/shared'
function isCombineBuiltInCss(config: ResolvedConfig) {
......@@ -37,7 +37,7 @@ export function uniCssPlugin(): Plugin {
generateBuiltInCssCode([...buildInCssSet].sort()),
resolvedConfig
)
// @ts-ignore 'Buffer' only refers to a type, but is being used as a value here
// 'Buffer' only refers to a type, but is being used as a value here
const contentHash = getAssetHash(Buffer.from(content, 'utf-8'))
const assetFileNames = path.posix.join(
resolvedConfig.build.assetsDir,
......
import path from 'path'
import type { Plugin } from 'vite'
import { createFilter, FilterPattern } from '@rollup/pluginutils'
import { type FilterPattern, createFilter } from '@rollup/pluginutils'
import { camelize, capitalize } from '@vue/shared'
import { COMPONENT_PREFIX, isBuiltInComponent } from '@dcloudio/uni-shared'
import {
H5_COMPONENTS_STYLE_PATH,
BASE_COMPONENTS_STYLE_PATH,
X_BASE_COMPONENTS_STYLE_PATH,
COMPONENT_DEPS_CSS,
parseVueRequest,
EXTNAME_VUE_TEMPLATE,
H5_COMPONENTS_STYLE_PATH,
X_BASE_COMPONENTS_STYLE_PATH,
addImportDeclaration,
buildInCssSet,
genResolveEasycomCode,
isCombineBuiltInCss,
matchEasycom,
addImportDeclaration,
genResolveEasycomCode,
EXTNAME_VUE_TEMPLATE,
parseVueRequest,
} from '@dcloudio/uni-cli-shared'
const H5_COMPONENTS_PATH = '@dcloudio/uni-h5'
......
......@@ -6,12 +6,12 @@ import { extend } from '@vue/shared'
import {
API_DEPS_CSS,
COMMON_EXCLUDE,
InjectOptions,
type InjectOptions,
buildInCssSet,
uniViteInjectPlugin,
isCombineBuiltInCss,
isEnableTreeShaking,
parseManifestJsonOnce,
uniViteInjectPlugin,
} from '@dcloudio/uni-cli-shared'
const apiJson = require(path.resolve(
......
import {
PAGES_JSON_JS,
defineUniMainJsPlugin,
isSsr,
PAGES_JSON_JS,
} from '@dcloudio/uni-cli-shared'
import { isSSR, isSsrManifest } from '../utils'
......
......@@ -2,10 +2,10 @@ import type { Plugin, ResolvedConfig } from 'vite'
import {
defineUniManifestJsonPlugin,
normalizeNetworkTimeout,
parseJson,
initI18nOptions,
normalizeNetworkTimeout,
normalizeThemeConfigOnce,
parseJson,
} from '@dcloudio/uni-cli-shared'
const defaultRouter = {
......
import type { Plugin, ResolvedConfig } from 'vite'
import {
API_DEPS_CSS,
FEATURE_DEFINES,
H5_FRAMEWORK_STYLE_PATH,
BASE_COMPONENTS_STYLE_PATH,
type FEATURE_DEFINES,
H5_FRAMEWORK_STYLE_PATH,
MANIFEST_JSON_JS,
checkPagesJson,
createRollupError,
defineUniPagesJsonPlugin,
isEnableTreeShaking,
normalizeIdentifier,
normalizePagePath,
normalizePagesJson,
defineUniPagesJsonPlugin,
normalizePagesRoute,
normalizePagePath,
isEnableTreeShaking,
parseManifestJsonOnce,
MANIFEST_JSON_JS,
checkPagesJson,
createRollupError,
preUVueJson,
} from '@dcloudio/uni-cli-shared'
import { isSSR } from '../utils'
......
import path from 'path'
import { Plugin } from 'vite'
import type { Plugin } from 'vite'
import { EXTNAME_VUE, parseVueRequest } from '@dcloudio/uni-cli-shared'
......
import { normalizePath } from '@dcloudio/uni-cli-shared'
import { isAbsolute, join, dirname } from 'path'
import { Plugin, TransformResult, ViteDevServer } from 'vite'
import { dirname, isAbsolute, join } from 'path'
import type { Plugin, TransformResult, ViteDevServer } from 'vite'
export function uniPostSourceMapPlugin(): Plugin {
return {
......
import path from 'path'
import type { Plugin, ResolvedConfig } from 'vite'
import { OutputChunk } from 'rollup'
import type { OutputChunk } from 'rollup'
import {
isSsr,
......@@ -10,13 +10,13 @@ import {
} from '@dcloudio/uni-cli-shared'
import {
generateSsrDefineCode,
generateSsrEntryServerCode,
initSsrAliasOnce,
initSsrDefine,
rewriteSsrVue,
rewriteSsrNativeTag,
rewriteSsrRenderStyle,
generateSsrDefineCode,
generateSsrEntryServerCode,
rewriteSsrVue,
} from '../utils'
const ENTRY_SERVER_JS = 'entry-server.js'
......
import type { ConfigEnv, UserConfig } from 'vite'
import {
parsePagesJsonOnce,
parseManifestJsonOnce,
initFeatures,
isSsr,
parseManifestJsonOnce,
parsePagesJsonOnce,
} from '@dcloudio/uni-cli-shared'
import { isSsrManifest } from './ssr'
......
import path from 'path'
import fs from 'fs'
import { extend, isArray, isString, NormalizedStyle } from '@vue/shared'
import { type NormalizedStyle, extend, isArray, isString } from '@vue/shared'
import {
once,
isH5NativeTag,
type Rpx2UnitOptions,
createRpx2Unit,
Rpx2UnitOptions,
isH5NativeTag,
once,
} from '@dcloudio/uni-shared'
import {
parseRpx2UnitOnce,
resolveBuiltIn,
getBuiltInPaths,
transformMatchMedia,
normalizePath,
parseRpx2UnitOnce,
resolveBuiltIn,
transformH5BuiltInComponents,
transformMatchMedia,
} from '@dcloudio/uni-cli-shared'
import type { ConfigEnv, ResolvedConfig, UserConfig } from 'vite'
import resolve from 'resolve'
import { resolveComponentType } from '@vue/compiler-dom'
import type resolve from 'resolve'
import type { resolveComponentType } from '@vue/compiler-dom'
import { transformPageHead } from '../plugin/transforms/transformPageHead'
// Temporal handling for 2.7 breaking change
......@@ -177,7 +177,6 @@ export function rewriteSsrResolve() {
}
export function rewriteSsrNativeTag() {
// @ts-ignore
const compilerDom = require(resolveBuiltIn('@vue/compiler-dom'))
// TODO compiler-ssr时,传入的 isNativeTag 会被 @vue/compiler-dom 的 isNativeTag 覆盖
// https://github.com/vuejs/vue-next/blob/master/packages/compiler-ssr/src/index.ts#L36
......
......@@ -5528,7 +5528,6 @@ function createNavigatorOnClick(props2) {
case "redirect":
uni.redirectTo({
url: props2.url,
// @ts-ignore
exists: props2.exists
});
break;
......
......@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
};
import { withModifiers, createVNode, getCurrentInstance, ref, defineComponent, openBlock, createElementBlock, onMounted, provide, computed, watch, onUnmounted, inject, onBeforeUnmount, mergeProps, injectHook, reactive, onActivated, nextTick, onBeforeMount, withDirectives, vModelDynamic, vShow, shallowRef, watchEffect, isVNode, Fragment, markRaw, Comment, h, createTextVNode, isReactive, Transition, createApp, createBlock, onBeforeActivate, onBeforeDeactivate, renderList, effectScope, withCtx, KeepAlive, resolveDynamicComponent, createElementVNode, normalizeStyle, renderSlot } from "vue";
import { isArray, isString, extend, remove, stringifyStyle, parseStringStyle, isPlainObject as isPlainObject$1, isFunction, capitalize, camelize, hasOwn, isObject, toRawType, makeMap as makeMap$1, isPromise, hyphenate, invokeArrayFns as invokeArrayFns$1 } from "@vue/shared";
import { once, UNI_STORAGE_LOCALE, I18N_JSON_DELIMITERS, Emitter, passive, initCustomDatasetOnce, resolveComponentInstance, normalizeStyles, addLeadingSlash, invokeArrayFns, removeLeadingSlash, resolveOwnerVm, resolveOwnerEl, ON_WXS_INVOKE_CALL_METHOD, ON_RESIZE, ON_APP_ENTER_FOREGROUND, ON_APP_ENTER_BACKGROUND, ON_SHOW, ON_HIDE, ON_PAGE_SCROLL, ON_REACH_BOTTOM, EventChannel, SCHEME_RE, DATA_RE, getCustomDataset, LINEFEED, ON_ERROR, callOptions, ON_UNHANDLE_REJECTION, ON_PAGE_NOT_FOUND, PRIMARY_COLOR, getLen, debounce, isUniLifecycleHook, ON_LOAD, UniLifecycleHooks, invokeCreateErrorHandler, invokeCreateVueAppHook, parseQuery, NAVBAR_HEIGHT, ON_UNLOAD, ON_REACH_BOTTOM_DISTANCE, ON_THEME_CHANGE, decodedQuery, WEB_INVOKE_APPSERVICE, ON_WEB_INVOKE_APP_SERVICE, sortObject, OFF_THEME_CHANGE, updateElementStyle, ON_BACK_PRESS, parseUrl, addFont, ON_NAVIGATION_BAR_CHANGE, scrollTo, RESPONSIVE_MIN_WIDTH, onCreateVueApp, formatDateTime, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_PULL_DOWN_REFRESH } from "@dcloudio/uni-shared";
import { once, UNI_STORAGE_LOCALE, I18N_JSON_DELIMITERS, Emitter, passive, initCustomDatasetOnce, resolveComponentInstance, normalizeStyles, addLeadingSlash, invokeArrayFns, removeLeadingSlash, resolveOwnerVm, resolveOwnerEl, ON_WXS_INVOKE_CALL_METHOD, ON_RESIZE, ON_APP_ENTER_FOREGROUND, ON_APP_ENTER_BACKGROUND, ON_SHOW, ON_HIDE, ON_PAGE_SCROLL, ON_REACH_BOTTOM, EventChannel, SCHEME_RE, DATA_RE, getCustomDataset, LINEFEED, ON_ERROR, callOptions, ON_UNHANDLE_REJECTION, ON_PAGE_NOT_FOUND, getLen, PRIMARY_COLOR, debounce, isUniLifecycleHook, ON_LOAD, UniLifecycleHooks, invokeCreateErrorHandler, invokeCreateVueAppHook, parseQuery, NAVBAR_HEIGHT, ON_UNLOAD, ON_REACH_BOTTOM_DISTANCE, ON_THEME_CHANGE, decodedQuery, WEB_INVOKE_APPSERVICE, ON_WEB_INVOKE_APP_SERVICE, sortObject, OFF_THEME_CHANGE, updateElementStyle, ON_BACK_PRESS, parseUrl, addFont, ON_NAVIGATION_BAR_CHANGE, scrollTo, RESPONSIVE_MIN_WIDTH, onCreateVueApp, formatDateTime, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_PULL_DOWN_REFRESH } from "@dcloudio/uni-shared";
import { onCreateVueApp as onCreateVueApp2 } from "@dcloudio/uni-shared";
import { initVueI18n, isI18nStr, LOCALE_EN, LOCALE_ES, LOCALE_FR, LOCALE_ZH_HANS, LOCALE_ZH_HANT } from "@dcloudio/uni-i18n";
import { useRoute, createRouter, createWebHistory, createWebHashHistory, useRouter, isNavigationFailure, RouterView } from "vue-router";
......@@ -1529,7 +1529,6 @@ function removeStyle(id2) {
let style = sheetsMap.get(id2);
if (style) {
if (style instanceof CSSStyleSheet) {
document.adoptedStyleSheets.indexOf(style);
document.adoptedStyleSheets = document.adoptedStyleSheets.filter(
(s) => s !== style
);
......@@ -6759,7 +6758,8 @@ const ShowModalOptions = {
params.confirmText = t2("uni.showModal.confirm");
}
},
confirmColor: PRIMARY_COLOR
//@ts-ignore
confirmColor: "#576b95"
}
};
const API_SHOW_TOAST = "showToast";
......@@ -12027,7 +12027,6 @@ function createNavigatorOnClick(props2) {
case "redirect":
uni.redirectTo({
url: props2.url,
// @ts-ignore
exists: props2.exists
});
break;
......@@ -17814,7 +17813,7 @@ const actionSheet = /* @__PURE__ */ defineComponent({
emit: emit2
}) {
initI18nShowActionSheetMsgsOnce();
const HEIGHT = ref(260);
const HEIGHT = ref(336);
const contentHeight = ref(0);
const titleHeight = ref(0);
const deltaY = ref(0);
......@@ -18151,7 +18150,7 @@ const props$f = {
},
confirmColor: {
type: String,
default: "#007aff"
default: "#576b95"
},
visible: {
type: Boolean
......
......@@ -4909,7 +4909,6 @@ function createNavigatorOnClick(props2) {
case "redirect":
uni.redirectTo({
url: props2.url,
// @ts-ignore
exists: props2.exists
});
break;
......
......@@ -988,7 +988,6 @@ function removeStyle(id2) {
let style = sheetsMap.get(id2);
if (style) {
if (style instanceof CSSStyleSheet) {
document.adoptedStyleSheets.indexOf(style);
document.adoptedStyleSheets = document.adoptedStyleSheets.filter(
(s) => s !== style
);
......@@ -11388,7 +11387,6 @@ function createNavigatorOnClick(props2) {
case "redirect":
uni.redirectTo({
url: props2.url,
// @ts-ignore
exists: props2.exists
});
break;
......@@ -21401,6 +21399,7 @@ const props$6 = {
},
confirmColor: {
type: String,
// @ts-ignore
default: "#007aff"
},
visible: {
......
import { NAVBAR_HEIGHT } from '@dcloudio/uni-shared'
import { updatePageCssVar } from '@dcloudio/uni-core'
import { useTabBar } from '../framework/setup/state'
import { cssEnv, cssConstant } from '../service/api/base/canIUse'
import { cssConstant, cssEnv } from '../service/api/base/canIUse'
const envMethod = /*#__PURE__*/ (() =>
cssEnv ? 'env' : cssConstant ? 'constant' : '')()
......
import { getTheme } from '../service/api/base/getBrowserInfo'
import { normalizeStyles, ON_THEME_CHANGE } from '@dcloudio/uni-shared'
import { ON_THEME_CHANGE, normalizeStyles } from '@dcloudio/uni-shared'
import { isReactive, reactive, watch } from 'vue'
export { getTheme }
......
import { watchEffect, onActivated, ssrContextKey } from 'vue'
import { UNI_SSR_TITLE, ON_NAVIGATION_BAR_CHANGE } from '@dcloudio/uni-shared'
import { onActivated, ssrContextKey, watchEffect } from 'vue'
import { ON_NAVIGATION_BAR_CHANGE, UNI_SSR_TITLE } from '@dcloudio/uni-shared'
import { getApp } from '../framework/setup/app'
export function updateDocumentTitle(title: string) {
......
import { extend } from '@vue/shared'
import { onMounted, computed, ref, onUnmounted } from 'vue'
import { computed, onMounted, onUnmounted, ref } from 'vue'
type Popover = {
left: number
......
import { ComponentPublicInstance } from 'vue'
import type { ComponentPublicInstance } from 'vue'
const WINDOW_NAMES = ['VUniLeftWindow', 'VUniTopWindow', 'VUniRightWindow']
......
import { ComponentPublicInstance } from 'vue'
import type { ComponentPublicInstance } from 'vue'
import { getRealRoute } from '@dcloudio/uni-core'
import { addLeadingSlash, DATA_RE, SCHEME_RE } from '@dcloudio/uni-shared'
import { DATA_RE, SCHEME_RE, addLeadingSlash } from '@dcloudio/uni-shared'
declare global {
interface ImportMeta {
env: {
......
......@@ -848,7 +848,7 @@ function initCreatePage() {
};
}
// @ts-ignore
// @ts-expect-error
function initComponentProps(_rawProps) {
const propertiesOptions = {
properties: {},
......
import { isPlainObject, isArray, hasOwn } from '@vue/shared'
import { hasOwn, isArray, isPlainObject } from '@vue/shared'
import {
navigateTo as _navigateTo,
addSafeAreaInsets,
useDeviceId,
populateParameters,
navigateTo as _navigateTo,
useDeviceId,
} from '@dcloudio/uni-mp-core'
import { getStorageSync } from './shims'
......
......@@ -2,7 +2,7 @@ import { hasOwn, isFunction } from '@vue/shared'
import { initGetProvider } from '@dcloudio/uni-mp-core'
import { $on, $off } from '@dcloudio/uni-api/src/service/base/eventBus'
import { $off, $on } from '@dcloudio/uni-api/src/service/base/eventBus'
let onKeyboardHeightChangeCallback: undefined | ((result: any) => void)
......
import { capitalize } from '@vue/shared'
import { customizeEvent } from '@dcloudio/uni-shared'
import { MiniProgramCompilerOptions } from '@dcloudio/uni-cli-shared'
import type { MiniProgramCompilerOptions } from '@dcloudio/uni-cli-shared'
export const event: MiniProgramCompilerOptions['event'] = {
format(name, { isCatch, isComponent }) {
......
......@@ -4,12 +4,12 @@ import { NodeTypes } from '@vue/compiler-core'
import type { CompilerOptions } from '@dcloudio/uni-mp-compiler'
import {
COMPONENT_ON_LINK,
type MiniProgramCompilerOptions,
copyMiniProgramPluginJson,
createTransformComponentLink,
MiniProgramCompilerOptions,
transformMatchMedia,
} from '@dcloudio/uni-cli-shared'
import { UniMiniProgramPluginOptions } from '@dcloudio/uni-mp-vite'
import type { UniMiniProgramPluginOptions } from '@dcloudio/uni-mp-vite'
import source from './mini.project.json'
import { transformRef } from './transforms/transformRef'
import { event } from './event'
......
import { ComponentOptions, ComponentPublicInstance } from 'vue'
// @ts-ignore
import type { ComponentOptions, ComponentPublicInstance } from 'vue'
// @ts-expect-error
import { pruneComponentPropsCache } from 'vue'
import {
initProps,
$destroyComponent,
initBehaviors,
initData,
$destroyComponent,
initProps,
initVueIds,
initWxsCallMethods,
} from '@dcloudio/uni-mp-core'
import {
handleRef,
type MPComponentInstance,
type RelationOptions,
createVueComponent,
handleLink,
triggerEvent,
isComponent2,
initSpecialMethods,
MPComponentInstance,
initRelation,
handleRef,
initChildVues,
createVueComponent,
RelationOptions,
initPropsObserver,
initRelation,
initSpecialMethods,
isComponent2,
triggerEvent,
} from './util'
declare function Component<
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册