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

feat(types): add tests

上级 55e5ff94
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
"size": "npm run build size-check", "size": "npm run build size-check",
"lint": "eslint packages/*/src/**/*.ts", "lint": "eslint packages/*/src/**/*.ts",
"format": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"", "format": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"",
"test": "jest", "test": "jest && tsc -p ./test-dts/tsconfig.json",
"test-dts": "tsc -p ./test-dts/tsconfig.json && tsc -p ./test-dts/tsconfig.build.json",
"preinstall": "node ./scripts/preinstall.js", "preinstall": "node ./scripts/preinstall.js",
"e2e:ssr:dev": "cd packages/playground/ssr && npm run dev:ssr", "e2e:ssr:dev": "cd packages/playground/ssr && npm run dev:ssr",
"e2e:ssr:open": "cd packages/playground/ssr && npx cypress open", "e2e:ssr:open": "cd packages/playground/ssr && npx cypress open",
...@@ -42,6 +43,7 @@ ...@@ -42,6 +43,7 @@
"devDependencies": { "devDependencies": {
"@dcloudio/types": "^2.5.14", "@dcloudio/types": "^2.5.14",
"@dcloudio/uni-api": "3.0.0-alpha-3030120211215001", "@dcloudio/uni-api": "3.0.0-alpha-3030120211215001",
"@dcloudio/uni-app": "3.0.0-alpha-3030120211215001",
"@jest/types": "^27.0.2", "@jest/types": "^27.0.2",
"@microsoft/api-extractor": "^7.19.2", "@microsoft/api-extractor": "^7.19.2",
"@rollup/plugin-alias": "^3.1.1", "@rollup/plugin-alias": "^3.1.1",
......
...@@ -42,7 +42,7 @@ export function getRealPath(filepath: string) { ...@@ -42,7 +42,7 @@ export function getRealPath(filepath: string) {
} else { } else {
const page = getCurrentPage() const page = getCurrentPage()
if (page) { if (page) {
return wwwPath + getRealRoute(addLeadingSlash(page.route), filepath) return wwwPath + getRealRoute(addLeadingSlash(page.route!), filepath)
} }
} }
} }
......
...@@ -4,14 +4,11 @@ import { ...@@ -4,14 +4,11 @@ import {
ON_APP_ENTER_FOREGROUND, ON_APP_ENTER_FOREGROUND,
ON_THEME_CHANGE, ON_THEME_CHANGE,
ON_KEYBOARD_HEIGHT_CHANGE, ON_KEYBOARD_HEIGHT_CHANGE,
addLeadingSlash,
} from '@dcloudio/uni-shared' } from '@dcloudio/uni-shared'
import { $reLaunch } from '../../api/route/_reLaunch'
import { import {
EVENT_BACKBUTTON, EVENT_BACKBUTTON,
backbuttonListener, backbuttonListener,
getEnterOptions, getEnterOptions,
RedirectInfo,
parseRedirectInfo, parseRedirectInfo,
initEnterOptions, initEnterOptions,
} from './utils' } from './utils'
...@@ -91,13 +88,13 @@ export function onPlusMessage<T>( ...@@ -91,13 +88,13 @@ export function onPlusMessage<T>(
UniServiceJSBridge.subscribe('plusMessage.' + type, callback, once) UniServiceJSBridge.subscribe('plusMessage.' + type, callback, once)
} }
function initEnterReLaunch(info: RedirectInfo) { // function initEnterReLaunch(info: RedirectInfo) {
__uniConfig.realEntryPagePath = // __uniConfig.realEntryPagePath =
__uniConfig.realEntryPagePath || __uniConfig.entryPagePath // __uniConfig.realEntryPagePath || __uniConfig.entryPagePath
__uniConfig.entryPagePath = info.path // __uniConfig.entryPagePath = info.path
__uniConfig.entryPageQuery = info.query // __uniConfig.entryPageQuery = info.query
$reLaunch( // $reLaunch(
{ url: addLeadingSlash(info.path) + info.query }, // { url: addLeadingSlash(info.path) + info.query },
{ resolve() {}, reject() {} } // { resolve() {}, reject() {} }
) // )
} // }
...@@ -12,7 +12,9 @@ export function createNVueWebview({ ...@@ -12,7 +12,9 @@ export function createNVueWebview({
webviewStyle, webviewStyle,
}: CreateWebviewOptions) { }: CreateWebviewOptions) {
const curWebviewId = genWebviewId() const curWebviewId = genWebviewId()
const curWebviewStyle = parseWebviewStyle(path, routeOptions.meta) const curWebviewStyle = parseWebviewStyle(path, routeOptions.meta, {
id: curWebviewId + '',
})
;(curWebviewStyle as any).uniPageUrl = initUniPageUrl(path, query) ;(curWebviewStyle as any).uniPageUrl = initUniPageUrl(path, query)
if (__DEV__) { if (__DEV__) {
console.log( console.log(
......
...@@ -8,7 +8,7 @@ import { DebugRefresh, InitUniPageUrl } from '../utils' ...@@ -8,7 +8,7 @@ import { DebugRefresh, InitUniPageUrl } from '../utils'
export function parseWebviewStyle( export function parseWebviewStyle(
path: string, path: string,
routeMeta: UniApp.PageRouteMeta, routeMeta: UniApp.PageRouteMeta,
webview: PlusWebviewWebviewObject webview: { id: string }
): PlusWebviewWebviewStyles & { ): PlusWebviewWebviewStyles & {
uniPageUrl?: InitUniPageUrl uniPageUrl?: InitUniPageUrl
debugRefresh?: DebugRefresh debugRefresh?: DebugRefresh
......
...@@ -275,7 +275,6 @@ export default /*#__PURE__*/ defineBuiltInComponent({ ...@@ -275,7 +275,6 @@ export default /*#__PURE__*/ defineBuiltInComponent({
src={control.iconPath} src={control.iconPath}
style={control.position} style={control.position}
auto-size auto-size
// @ts-expect-error
onClick={() => onClick={() =>
control.clickable && control.clickable &&
trigger('controltap', {} as Event, { controlId: control.id }) trigger('controltap', {} as Event, { controlId: control.id })
......
import '@dcloudio/uni-components/style/audio.css'
import { Audio } from '@dcloudio/uni-components'
import { UniNodeJSON } from '@dcloudio/uni-shared'
import { UniComponent } from './UniComponent'
export class UniAudio extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-audio', Audio, parentNodeId, refNodeId, nodeJson)
}
}
export function preventDoubleTap() { export function preventDoubleTap() {
if (String(navigator.vendor).indexOf('Apple') === 0) { if (String(navigator.vendor).indexOf('Apple') === 0) {
let firstEvent: MouseEvent | null = null let firstEvent: MouseEvent | null = null
let timeout: number let timeout: ReturnType<typeof setTimeout>
// 用于全局禁用 iOS 双击包含手势 // 用于全局禁用 iOS 双击包含手势
document.documentElement.addEventListener('click', (event) => { document.documentElement.addEventListener('click', (event) => {
const TIME_MAX = 450 const TIME_MAX = 450
......
...@@ -85,27 +85,40 @@ const onShow = /*#__PURE__*/ createHook(uniShared.ON_SHOW); ...@@ -85,27 +85,40 @@ const onShow = /*#__PURE__*/ createHook(uniShared.ON_SHOW);
const onHide = /*#__PURE__*/ createHook(uniShared.ON_HIDE); const onHide = /*#__PURE__*/ createHook(uniShared.ON_HIDE);
const onLaunch = /*#__PURE__*/ createHook(uniShared.ON_LAUNCH); const onLaunch = /*#__PURE__*/ createHook(uniShared.ON_LAUNCH);
const onError = /*#__PURE__*/ createHook(uniShared.ON_ERROR); const onError = /*#__PURE__*/ createHook(uniShared.ON_ERROR);
const onThemeChange = /*#__PURE__*/ createHook(uniShared.ON_THEME_CHANGE); const onThemeChange =
const onPageNotFound = /*#__PURE__*/ createHook(uniShared.ON_PAGE_NOT_FOUND); /*#__PURE__*/ createHook(uniShared.ON_THEME_CHANGE);
const onUnhandledRejection = /*#__PURE__*/ createHook(uniShared.ON_UNHANDLE_REJECTION); const onPageNotFound =
/*#__PURE__*/ createHook(uniShared.ON_PAGE_NOT_FOUND);
const onUnhandledRejection =
/*#__PURE__*/ createHook(uniShared.ON_UNHANDLE_REJECTION);
// 小程序如果想在 setup 的 props 传递页面参数,需要定义 props,故同时暴露 onLoad 吧 // 小程序如果想在 setup 的 props 传递页面参数,需要定义 props,故同时暴露 onLoad 吧
const onLoad = /*#__PURE__*/ createHook(uniShared.ON_LOAD); const onLoad = /*#__PURE__*/ createHook(uniShared.ON_LOAD);
const onReady = /*#__PURE__*/ createHook(uniShared.ON_READY); const onReady = /*#__PURE__*/ createHook(uniShared.ON_READY);
const onUnload = /*#__PURE__*/ createHook(uniShared.ON_UNLOAD); const onUnload = /*#__PURE__*/ createHook(uniShared.ON_UNLOAD);
const onResize = /*#__PURE__*/ createHook(uniShared.ON_RESIZE); const onResize = /*#__PURE__*/ createHook(uniShared.ON_RESIZE);
const onBackPress = /*#__PURE__*/ createHook(uniShared.ON_BACK_PRESS); const onBackPress =
const onPageScroll = /*#__PURE__*/ createHook(uniShared.ON_PAGE_SCROLL); /*#__PURE__*/ createHook(uniShared.ON_BACK_PRESS);
const onTabItemTap = /*#__PURE__*/ createHook(uniShared.ON_TAB_ITEM_TAP); const onPageScroll =
/*#__PURE__*/ createHook(uniShared.ON_PAGE_SCROLL);
const onTabItemTap =
/*#__PURE__*/ createHook(uniShared.ON_TAB_ITEM_TAP);
const onReachBottom = /*#__PURE__*/ createHook(uniShared.ON_REACH_BOTTOM); const onReachBottom = /*#__PURE__*/ createHook(uniShared.ON_REACH_BOTTOM);
const onPullDownRefresh = /*#__PURE__*/ createHook(uniShared.ON_PULL_DOWN_REFRESH); const onPullDownRefresh = /*#__PURE__*/ createHook(uniShared.ON_PULL_DOWN_REFRESH);
const onShareTimeline = /*#__PURE__*/ createHook(uniShared.ON_SHARE_TIMELINE); const onShareTimeline =
const onAddToFavorites = /*#__PURE__*/ createHook(uniShared.ON_ADD_TO_FAVORITES); /*#__PURE__*/ createHook(uniShared.ON_SHARE_TIMELINE);
const onShareAppMessage = /*#__PURE__*/ createHook(uniShared.ON_SHARE_APP_MESSAGE); const onAddToFavorites =
const onNavigationBarButtonTap = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_BUTTON_TAP); /*#__PURE__*/ createHook(uniShared.ON_ADD_TO_FAVORITES);
const onNavigationBarSearchInputChanged = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED); const onShareAppMessage =
/*#__PURE__*/ createHook(uniShared.ON_SHARE_APP_MESSAGE);
const onNavigationBarButtonTap =
/*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_BUTTON_TAP);
const onNavigationBarSearchInputChanged =
/*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED);
const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED); const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED);
const onNavigationBarSearchInputConfirmed = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED); const onNavigationBarSearchInputConfirmed =
const onNavigationBarSearchInputFocusChanged = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED); /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED);
const onNavigationBarSearchInputFocusChanged =
/*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED);
exports.getSsrGlobalData = getSsrGlobalData; exports.getSsrGlobalData = getSsrGlobalData;
exports.onAddToFavorites = onAddToFavorites; exports.onAddToFavorites = onAddToFavorites;
......
...@@ -2,33 +2,109 @@ import type { ComponentInternalInstance } from '@vue/runtime-core'; ...@@ -2,33 +2,109 @@ import type { ComponentInternalInstance } from '@vue/runtime-core';
import { ref } from 'vue'; import { ref } from 'vue';
import { shallowRef } from 'vue'; import { shallowRef } from 'vue';
declare interface AddToFavoritesContent {
title?: string;
imageUrl?: string;
query?: string;
}
declare interface AddToFavoritesOption {
webviewUrl?: string;
}
declare interface BackPressOption {
from: 'backbutton' | 'navigateBack';
}
declare interface CustomShareAppMessage {
title?: string;
path?: string;
imageUrl?: string;
}
declare interface CustomShareTimeline {
title?: string;
query?: string;
imageUrl?: string;
}
export declare function getSsrGlobalData(): any; export declare function getSsrGlobalData(): any;
export declare const onAddToFavorites: (hook: () => any, target?: ComponentInternalInstance | null) => any; declare type LaunchOption = LaunchShowOption;
declare interface LaunchShowOption {
path: string;
query: Record<string, string | undefined>;
scene: number;
shareTicket: string;
referrerInfo?: ReferrerInfo;
}
declare interface NavigationBarButtonTapOption {
index: number;
}
declare interface NavigationBarSearchInputChangedOption {
text: string;
}
declare type NavigationBarSearchInputConfirmedOption = NavigationBarSearchInputChangedOption;
declare interface NavigationBarSearchInputFocusChanged {
focus: boolean;
}
export declare const onAddToFavorites: (hook: onAddToFavoritesHook, target?: ComponentInternalInstance | null) => any;
declare type onAddToFavoritesHook = (options: AddToFavoritesOption) => AddToFavoritesContent | void;
declare type onAppShowHook = (options: LaunchShowOption) => void;
export declare const onBackPress: (hook: () => any, target?: ComponentInternalInstance | null) => any; export declare const onBackPress: (hook: onBackPressHook, target?: ComponentInternalInstance | null) => any;
export declare const onError: (hook: () => any, target?: ComponentInternalInstance | null) => any; declare type onBackPressHook = (options: BackPressOption) => boolean | void;
export declare const onError: (hook: onErrorHook, target?: ComponentInternalInstance | null) => any;
declare type onErrorHook = (error: string) => void;
export declare const onHide: (hook: () => any, target?: ComponentInternalInstance | null) => any; export declare const onHide: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onLaunch: (hook: () => any, target?: ComponentInternalInstance | null) => any; export declare const onLaunch: (hook: onLaunchHook, target?: ComponentInternalInstance | null) => any;
declare type onLaunchHook = (options: LaunchOption) => void;
export declare const onLoad: (hook: onLoadHook, target?: ComponentInternalInstance | null) => any;
export declare const onLoad: (hook: () => any, target?: ComponentInternalInstance | null) => any; declare type onLoadHook = (query: Record<string, string | undefined>) => void;
export declare const onNavigationBarButtonTap: (hook: () => any, target?: ComponentInternalInstance | null) => any; export declare const onNavigationBarButtonTap: (hook: onNavigationBarButtonTapHook, target?: ComponentInternalInstance | null) => any;
export declare const onNavigationBarSearchInputChanged: (hook: () => any, target?: ComponentInternalInstance | null) => any; declare type onNavigationBarButtonTapHook = (options: NavigationBarButtonTapOption) => void;
export declare const onNavigationBarSearchInputChanged: (hook: onNavigationBarSearchInputChangedHook, target?: ComponentInternalInstance | null) => any;
declare type onNavigationBarSearchInputChangedHook = (options: NavigationBarSearchInputChangedOption) => void;
export declare const onNavigationBarSearchInputClicked: (hook: () => any, target?: ComponentInternalInstance | null) => any; export declare const onNavigationBarSearchInputClicked: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onNavigationBarSearchInputConfirmed: (hook: () => any, target?: ComponentInternalInstance | null) => any; export declare const onNavigationBarSearchInputConfirmed: (hook: onNavigationBarSearchInputConfirmedHook, target?: ComponentInternalInstance | null) => any;
declare type onNavigationBarSearchInputConfirmedHook = (options: NavigationBarSearchInputConfirmedOption) => void;
export declare const onNavigationBarSearchInputFocusChanged: (hook: onNavigationBarSearchInputFocusChangedHook, target?: ComponentInternalInstance | null) => any;
export declare const onNavigationBarSearchInputFocusChanged: (hook: () => any, target?: ComponentInternalInstance | null) => any; declare type onNavigationBarSearchInputFocusChangedHook = (options: NavigationBarSearchInputFocusChanged) => void;
export declare const onPageNotFound: (hook: () => any, target?: ComponentInternalInstance | null) => any; export declare const onPageNotFound: (hook: onPageNotFoundHook, target?: ComponentInternalInstance | null) => any;
export declare const onPageScroll: (hook: () => any, target?: ComponentInternalInstance | null) => any; declare type onPageNotFoundHook = (options: PageNotFoundOption) => void;
export declare const onPageScroll: (hook: onPageScrollHook, target?: ComponentInternalInstance | null) => any;
declare type onPageScrollHook = (options: PageScrollOption) => void;
declare type onPageShowHook = () => void;
export declare const onPullDownRefresh: (hook: () => any, target?: ComponentInternalInstance | null) => any; export declare const onPullDownRefresh: (hook: () => any, target?: ComponentInternalInstance | null) => any;
...@@ -36,28 +112,83 @@ export declare const onReachBottom: (hook: () => any, target?: ComponentInternal ...@@ -36,28 +112,83 @@ export declare const onReachBottom: (hook: () => any, target?: ComponentInternal
export declare const onReady: (hook: () => any, target?: ComponentInternalInstance | null) => any; export declare const onReady: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onResize: (hook: () => any, target?: ComponentInternalInstance | null) => any; export declare const onResize: (hook: onResizeHook, target?: ComponentInternalInstance | null) => any;
declare type onResizeHook = (options: ResizeOption) => void;
export declare const onShareAppMessage: (hook: onShareAppMessageHook, target?: ComponentInternalInstance | null) => any;
declare type onShareAppMessageHook = (options: ShareAppMessageOption) => CustomShareAppMessage | void;
export declare const onShareTimeline: (hook: onShareTimelineHook, target?: ComponentInternalInstance | null) => any;
declare type onShareTimelineHook = () => CustomShareTimeline | void;
export declare const onShow: (hook: onAppShowHook | onPageShowHook, target?: ComponentInternalInstance | null) => any;
export declare const onShareAppMessage: (hook: () => any, target?: ComponentInternalInstance | null) => any; export declare const onTabItemTap: (hook: onTabItemTapHook, target?: ComponentInternalInstance | null) => any;
export declare const onShareTimeline: (hook: () => any, target?: ComponentInternalInstance | null) => any; declare type onTabItemTapHook = (options: TabItemTapOption) => void;
export declare const onShow: (hook: () => any, target?: ComponentInternalInstance | null) => any; export declare const onThemeChange: (hook: onThemeChangeHook, target?: ComponentInternalInstance | null) => any;
export declare const onTabItemTap: (hook: () => any, target?: ComponentInternalInstance | null) => any; declare type onThemeChangeHook = (options: ThemeChangeOption) => void;
export declare const onThemeChange: (hook: () => any, target?: ComponentInternalInstance | null) => any; export declare const onUnhandledRejection: (hook: onUnhandledRejectionHook, target?: ComponentInternalInstance | null) => any;
export declare const onUnhandledRejection: (hook: () => any, target?: ComponentInternalInstance | null) => any; declare type onUnhandledRejectionHook = (options: UnhandledRejectionOption) => void;
export declare const onUnload: (hook: () => any, target?: ComponentInternalInstance | null) => any; export declare const onUnload: (hook: () => any, target?: ComponentInternalInstance | null) => any;
declare interface PageNotFoundOption {
path: string;
query: Record<string, string | undefined>;
isEntryPage: boolean;
}
declare interface PageScrollOption {
scrollTop: number;
}
declare interface ReferrerInfo {
appId: string;
extraData?: any;
}
declare interface ResizeOption {
size: {
windowWidth: number;
windowHeight: number;
};
}
export declare function resolveEasycom(component: unknown, easycom: unknown): unknown; export declare function resolveEasycom(component: unknown, easycom: unknown): unknown;
export declare const shallowSsrRef: SSRRef; export declare const shallowSsrRef: SSRRef;
declare interface ShareAppMessageOption {
from: 'button' | 'menu' | string;
target: any;
webViewUrl?: string;
}
declare type SSRRef = (value: unknown, key?: string, shallow?: boolean) => ReturnType<typeof ref> | ReturnType<typeof shallowRef>; declare type SSRRef = (value: unknown, key?: string, shallow?: boolean) => ReturnType<typeof ref> | ReturnType<typeof shallowRef>;
export declare const ssrRef: SSRRef; export declare const ssrRef: SSRRef;
declare interface TabItemTapOption {
index: string;
pagePath: string;
text: string;
}
declare interface ThemeChangeOption {
theme: 'dark' | 'light';
}
declare interface UnhandledRejectionOption {
promise: Promise<any>;
reason: string;
}
export { } export { }
...@@ -53,26 +53,39 @@ const onShow = /*#__PURE__*/ createHook(ON_SHOW); ...@@ -53,26 +53,39 @@ const onShow = /*#__PURE__*/ createHook(ON_SHOW);
const onHide = /*#__PURE__*/ createHook(ON_HIDE); const onHide = /*#__PURE__*/ createHook(ON_HIDE);
const onLaunch = /*#__PURE__*/ createHook(ON_LAUNCH); const onLaunch = /*#__PURE__*/ createHook(ON_LAUNCH);
const onError = /*#__PURE__*/ createHook(ON_ERROR); const onError = /*#__PURE__*/ createHook(ON_ERROR);
const onThemeChange = /*#__PURE__*/ createHook(ON_THEME_CHANGE); const onThemeChange =
const onPageNotFound = /*#__PURE__*/ createHook(ON_PAGE_NOT_FOUND); /*#__PURE__*/ createHook(ON_THEME_CHANGE);
const onUnhandledRejection = /*#__PURE__*/ createHook(ON_UNHANDLE_REJECTION); const onPageNotFound =
/*#__PURE__*/ createHook(ON_PAGE_NOT_FOUND);
const onUnhandledRejection =
/*#__PURE__*/ createHook(ON_UNHANDLE_REJECTION);
// 小程序如果想在 setup 的 props 传递页面参数,需要定义 props,故同时暴露 onLoad 吧 // 小程序如果想在 setup 的 props 传递页面参数,需要定义 props,故同时暴露 onLoad 吧
const onLoad = /*#__PURE__*/ createHook(ON_LOAD); const onLoad = /*#__PURE__*/ createHook(ON_LOAD);
const onReady = /*#__PURE__*/ createHook(ON_READY); const onReady = /*#__PURE__*/ createHook(ON_READY);
const onUnload = /*#__PURE__*/ createHook(ON_UNLOAD); const onUnload = /*#__PURE__*/ createHook(ON_UNLOAD);
const onResize = /*#__PURE__*/ createHook(ON_RESIZE); const onResize = /*#__PURE__*/ createHook(ON_RESIZE);
const onBackPress = /*#__PURE__*/ createHook(ON_BACK_PRESS); const onBackPress =
const onPageScroll = /*#__PURE__*/ createHook(ON_PAGE_SCROLL); /*#__PURE__*/ createHook(ON_BACK_PRESS);
const onTabItemTap = /*#__PURE__*/ createHook(ON_TAB_ITEM_TAP); const onPageScroll =
/*#__PURE__*/ createHook(ON_PAGE_SCROLL);
const onTabItemTap =
/*#__PURE__*/ createHook(ON_TAB_ITEM_TAP);
const onReachBottom = /*#__PURE__*/ createHook(ON_REACH_BOTTOM); const onReachBottom = /*#__PURE__*/ createHook(ON_REACH_BOTTOM);
const onPullDownRefresh = /*#__PURE__*/ createHook(ON_PULL_DOWN_REFRESH); const onPullDownRefresh = /*#__PURE__*/ createHook(ON_PULL_DOWN_REFRESH);
const onShareTimeline = /*#__PURE__*/ createHook(ON_SHARE_TIMELINE); const onShareTimeline =
const onAddToFavorites = /*#__PURE__*/ createHook(ON_ADD_TO_FAVORITES); /*#__PURE__*/ createHook(ON_SHARE_TIMELINE);
const onShareAppMessage = /*#__PURE__*/ createHook(ON_SHARE_APP_MESSAGE); const onAddToFavorites =
const onNavigationBarButtonTap = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_BUTTON_TAP); /*#__PURE__*/ createHook(ON_ADD_TO_FAVORITES);
const onNavigationBarSearchInputChanged = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED); const onShareAppMessage =
/*#__PURE__*/ createHook(ON_SHARE_APP_MESSAGE);
const onNavigationBarButtonTap =
/*#__PURE__*/ createHook(ON_NAVIGATION_BAR_BUTTON_TAP);
const onNavigationBarSearchInputChanged =
/*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED);
const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED); const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED);
const onNavigationBarSearchInputConfirmed = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED); const onNavigationBarSearchInputConfirmed =
const onNavigationBarSearchInputFocusChanged = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED); /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED);
const onNavigationBarSearchInputFocusChanged =
/*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED);
export { getSsrGlobalData, onAddToFavorites, onBackPress, onError, onHide, onLaunch, onLoad, onNavigationBarButtonTap, onNavigationBarSearchInputChanged, onNavigationBarSearchInputClicked, onNavigationBarSearchInputConfirmed, onNavigationBarSearchInputFocusChanged, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, resolveEasycom, shallowSsrRef, ssrRef }; export { getSsrGlobalData, onAddToFavorites, onBackPress, onError, onHide, onLaunch, onLoad, onNavigationBarButtonTap, onNavigationBarSearchInputChanged, onNavigationBarSearchInputClicked, onNavigationBarSearchInputConfirmed, onNavigationBarSearchInputFocusChanged, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, resolveEasycom, shallowSsrRef, ssrRef };
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
}, },
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da", "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
"devDependencies": { "devDependencies": {
"@dcloudio/uni-shared": "3.0.0-alpha-3030120211215001" "@dcloudio/uni-shared": "3.0.0-alpha-3030120211215001",
"@types/quill": "^1.3.7"
} }
} }
...@@ -144,7 +144,7 @@ function _activeAnimation(state: ProgerssState, props: ProgressProps) { ...@@ -144,7 +144,7 @@ function _activeAnimation(state: ProgerssState, props: ProgressProps) {
} else { } else {
state.currentPercent += 1 state.currentPercent += 1
} }
}, parseFloat(props.duration as string)) }, parseFloat(props.duration as string)) as unknown as number
} else { } else {
state.currentPercent = state.realPercent state.currentPercent = state.realPercent
} }
......
...@@ -30,8 +30,8 @@ export const hoverProps = { ...@@ -30,8 +30,8 @@ export const hoverProps = {
export function useHover(props: UseHoverOptions) { export function useHover(props: UseHoverOptions) {
const hovering = ref(false) const hovering = ref(false)
let hoverTouch: boolean = false let hoverTouch: boolean = false
let hoverStartTimer: number let hoverStartTimer: ReturnType<typeof setTimeout>
let hoverStayTimer: number let hoverStayTimer: ReturnType<typeof setTimeout>
function hoverReset() { function hoverReset() {
requestAnimationFrame(() => { requestAnimationFrame(() => {
clearTimeout(hoverStayTimer) clearTimeout(hoverStayTimer)
......
...@@ -2,7 +2,7 @@ import { Ref, watch } from 'vue' ...@@ -2,7 +2,7 @@ import { Ref, watch } from 'vue'
import { CustomEventTrigger } from './useEvent' import { CustomEventTrigger } from './useEvent'
import { plusReady } from '@dcloudio/uni-shared' import { plusReady } from '@dcloudio/uni-shared'
let resetTimer: number let resetTimer: ReturnType<typeof setTimeout>
let isAndroid: boolean let isAndroid: boolean
let osVersion: string let osVersion: string
let keyboardHeight: number let keyboardHeight: number
......
...@@ -18585,7 +18585,7 @@ function usePopupStyle(props2) { ...@@ -18585,7 +18585,7 @@ function usePopupStyle(props2) {
const fixSize = () => { const fixSize = () => {
const { windowWidth, windowHeight, windowTop } = uni.getSystemInfoSync(); const { windowWidth, windowHeight, windowTop } = uni.getSystemInfoSync();
popupWidth.value = windowWidth; popupWidth.value = windowWidth;
popupHeight.value = windowHeight + windowTop; popupHeight.value = windowHeight + (windowTop || 0);
}; };
window.addEventListener("resize", fixSize); window.addEventListener("resize", fixSize);
fixSize(); fixSize();
......
...@@ -13,13 +13,13 @@ export function getJSONP( ...@@ -13,13 +13,13 @@ export function getJSONP(
var callbackKey = options.callback || 'callback' var callbackKey = options.callback || 'callback'
var callbackName = '__callback' + Date.now() var callbackName = '__callback' + Date.now()
var timeout = options.timeout || 30000 var timeout = options.timeout || 30000
var timing: number var timing: ReturnType<typeof setTimeout>
function end() { function end() {
clearTimeout(timing) clearTimeout(timing)
delete window[callbackName] delete (window as any)[callbackName]
js.remove() js.remove()
} }
window[callbackName] = (res: any) => { ;(window as any)[callbackName] = (res: any) => {
if (typeof success === 'function') { if (typeof success === 'function') {
success(res) success(res)
} }
......
...@@ -95,7 +95,7 @@ export function usePopupStyle(props: Data) { ...@@ -95,7 +95,7 @@ export function usePopupStyle(props: Data) {
const fixSize = () => { const fixSize = () => {
const { windowWidth, windowHeight, windowTop } = uni.getSystemInfoSync() const { windowWidth, windowHeight, windowTop } = uni.getSystemInfoSync()
popupWidth.value = windowWidth popupWidth.value = windowWidth
popupHeight.value = windowHeight + windowTop popupHeight.value = windowHeight + (windowTop || 0)
} }
window.addEventListener('resize', fixSize) window.addEventListener('resize', fixSize)
fixSize() fixSize()
......
...@@ -44,9 +44,10 @@ export const startAccelerometer = <API_TYPE_START_ACCELEROMETER>( ...@@ -44,9 +44,10 @@ export const startAccelerometer = <API_TYPE_START_ACCELEROMETER>(
window.addEventListener('devicemotion', listener, false) window.addEventListener('devicemotion', listener, false)
} }
if (!listener) { if (!listener) {
if (DeviceMotionEvent.requestPermission) { if ((DeviceMotionEvent as any).requestPermission) {
DeviceMotionEvent.requestPermission() ;(DeviceMotionEvent as any)
.then((res) => { .requestPermission()
.then((res: string) => {
if (res === 'granted') { if (res === 'granted') {
addEventListener() addEventListener()
resolve() resolve()
...@@ -54,7 +55,7 @@ export const startAccelerometer = <API_TYPE_START_ACCELEROMETER>( ...@@ -54,7 +55,7 @@ export const startAccelerometer = <API_TYPE_START_ACCELEROMETER>(
reject(`${res}`) reject(`${res}`)
} }
}) })
.catch((error) => { .catch((error: any) => {
reject(`${error}`) reject(`${error}`)
}) })
return return
......
...@@ -43,9 +43,10 @@ export const startCompass = <API_TYPE_START_COMPASS>( ...@@ -43,9 +43,10 @@ export const startCompass = <API_TYPE_START_COMPASS>(
window.addEventListener('deviceorientation', listener, false) window.addEventListener('deviceorientation', listener, false)
} }
if (!listener) { if (!listener) {
if (DeviceOrientationEvent.requestPermission) { if ((DeviceOrientationEvent as any).requestPermission) {
DeviceOrientationEvent.requestPermission() ;(DeviceOrientationEvent as any)
.then((res) => { .requestPermission()
.then((res: string) => {
if (res === 'granted') { if (res === 'granted') {
addEventListener() addEventListener()
resolve() resolve()
...@@ -53,7 +54,7 @@ export const startCompass = <API_TYPE_START_COMPASS>( ...@@ -53,7 +54,7 @@ export const startCompass = <API_TYPE_START_COMPASS>(
reject(`${res}`) reject(`${res}`)
} }
}) })
.catch((error) => { .catch((error: any) => {
reject(`${error}`) reject(`${error}`)
}) })
return return
......
...@@ -62,7 +62,7 @@ export const downloadFile = defineTaskApi<API_TYPE_DOWNLOAD_FILE>( ...@@ -62,7 +62,7 @@ export const downloadFile = defineTaskApi<API_TYPE_DOWNLOAD_FILE>(
{ url, header, timeout = __uniConfig.networkTimeout.downloadFile }, { url, header, timeout = __uniConfig.networkTimeout.downloadFile },
{ resolve, reject } { resolve, reject }
) => { ) => {
var timer: number var timer: ReturnType<typeof setTimeout>
var xhr = new XMLHttpRequest() var xhr = new XMLHttpRequest()
var downloadTask = new DownloadTask(xhr) var downloadTask = new DownloadTask(xhr)
xhr.open('GET', url, true) xhr.open('GET', url, true)
......
...@@ -81,7 +81,7 @@ export const uploadFile = defineTaskApi<API_TYPE_UPLOAD_FILE>( ...@@ -81,7 +81,7 @@ export const uploadFile = defineTaskApi<API_TYPE_UPLOAD_FILE>(
function upload(realFiles: File[]) { function upload(realFiles: File[]) {
var xhr = new XMLHttpRequest() var xhr = new XMLHttpRequest()
var form = new FormData() var form = new FormData()
var timer: number var timer: ReturnType<typeof setTimeout>
Object.keys(formData).forEach((key) => { Object.keys(formData).forEach((key) => {
form.append(key, formData[key]) form.append(key, formData[key])
}) })
......
...@@ -71,7 +71,7 @@ export const setStorage = <API_TYPE_SET_STORAGE>defineAsyncApi( ...@@ -71,7 +71,7 @@ export const setStorage = <API_TYPE_SET_STORAGE>defineAsyncApi(
try { try {
setStorageSync(key, data) setStorageSync(key, data)
resolve() resolve()
} catch (error) { } catch (error: any) {
reject(error.message) reject(error.message)
} }
}, },
...@@ -114,7 +114,7 @@ export const getStorage = <API_TYPE_GET_STORAGE>defineAsyncApi( ...@@ -114,7 +114,7 @@ export const getStorage = <API_TYPE_GET_STORAGE>defineAsyncApi(
resolve({ resolve({
data, data,
}) })
} catch (error) { } catch (error: any) {
reject(error.message) reject(error.message)
} }
}, },
......
...@@ -28,7 +28,7 @@ import type { ...@@ -28,7 +28,7 @@ import type {
let showToastState: ToastProps let showToastState: ToastProps
let showType: 'onShowToast' | 'onShowLoading' | '' = '' let showType: 'onShowToast' | 'onShowLoading' | '' = ''
let timeoutId: number let timeoutId: ReturnType<typeof setTimeout>
const scope = /*#__PURE__*/ effectScope() const scope = /*#__PURE__*/ effectScope()
......
...@@ -298,7 +298,7 @@ const CHECK_RENDER_DELAY = 1000 ...@@ -298,7 +298,7 @@ const CHECK_RENDER_DELAY = 1000
const CHECK_RENDER_RETRY = 5 const CHECK_RENDER_RETRY = 5
class AdRender { class AdRender {
private _checkTimer: number | null private _checkTimer: ReturnType<typeof setTimeout> | null
private _pi: number = 0 private _pi: number = 0
private _pl: any[] = [] private _pl: any[] = []
private _b: any = {} private _b: any = {}
......
...@@ -45,7 +45,7 @@ export default /*#__PURE__*/ defineSystemComponent({ ...@@ -45,7 +45,7 @@ export default /*#__PURE__*/ defineSystemComponent({
}) })
if (!__NODE_JS__) { if (!__NODE_JS__) {
const onMapReady: OnMapReady = inject('onMapReady') as OnMapReady const onMapReady: OnMapReady = inject('onMapReady') as OnMapReady
let timer: number let timer: ReturnType<typeof setTimeout>
function compassChangeHandler(res: { direction: number }) { function compassChangeHandler(res: { direction: number }) {
state.rotate = res.direction state.rotate = res.direction
} }
......
...@@ -370,7 +370,7 @@ function useMap( ...@@ -370,7 +370,7 @@ function useMap(
if (context) { if (context) {
try { try {
context.translate(data) context.translate(data)
} catch (error) { } catch (error: any) {
callOptions(data, `${type}:fail ${error.message}`) callOptions(data, `${type}:fail ${error.message}`)
} }
callOptions(data, `${type}:ok`) callOptions(data, `${type}:ok`)
......
...@@ -485,7 +485,7 @@ function useSystem() { ...@@ -485,7 +485,7 @@ function useSystem() {
return _system return _system
} }
let __contentVisibleDelay: number let __contentVisibleDelay: ReturnType<typeof setTimeout>
function usePickerMethods( function usePickerMethods(
props: Props, props: Props,
state: State, state: State,
......
...@@ -462,7 +462,7 @@ function useControls( ...@@ -462,7 +462,7 @@ function useControls(
function toggleControls() { function toggleControls() {
state.controlsVisible = !state.controlsVisible state.controlsVisible = !state.controlsVisible
} }
let hideTiming: number | null let hideTiming: ReturnType<typeof setTimeout> | null
function autoHideStart() { function autoHideStart() {
hideTiming = setTimeout(() => { hideTiming = setTimeout(() => {
state.controlsVisible = false state.controlsVisible = false
......
...@@ -872,7 +872,7 @@ function initCreatePage() { ...@@ -872,7 +872,7 @@ function initCreatePage() {
} }
// @ts-ignore // @ts-ignore
function initComponentProps(rawProps) { function initComponentProps(_rawProps) {
const propertiesOptions = { const propertiesOptions = {
properties: {}, properties: {},
}; };
......
...@@ -28,11 +28,11 @@ declare function Component<P, D, M extends tinyapp.IComponentMethods>( ...@@ -28,11 +28,11 @@ declare function Component<P, D, M extends tinyapp.IComponentMethods>(
options: tinyapp.ComponentOptions<P, D, M> options: tinyapp.ComponentOptions<P, D, M>
): void ): void
function initComponentProps(rawProps: Record<string, any>) { function initComponentProps(_rawProps: Record<string, any>) {
const propertiesOptions = { const propertiesOptions = {
properties: {}, properties: {},
} }
initProps(propertiesOptions, rawProps, false) initProps(propertiesOptions)
const properties = propertiesOptions.properties as Record<string, any> const properties = propertiesOptions.properties as Record<string, any>
const props: Record<string, any> = { const props: Record<string, any> = {
// onVueInit // onVueInit
......
import { import { hasOwn, isFunction, camelize, isString } from '@vue/shared'
hasOwn,
isFunction,
camelize,
isArray,
isString,
remove,
} from '@vue/shared'
import { import {
ComponentPublicInstance, ComponentPublicInstance,
......
...@@ -776,7 +776,7 @@ function parseComponent(vueOptions, { parse, mocks, isPage, initRelation, handle ...@@ -776,7 +776,7 @@ function parseComponent(vueOptions, { parse, mocks, isPage, initRelation, handle
if (__VUE_OPTIONS_API__) { if (__VUE_OPTIONS_API__) {
applyOptions(mpComponentOptions, vueOptions, initBehavior); applyOptions(mpComponentOptions, vueOptions, initBehavior);
} }
initProps(mpComponentOptions, vueOptions.props); initProps(mpComponentOptions);
initPropsObserver(mpComponentOptions); initPropsObserver(mpComponentOptions);
initExtraOptions(mpComponentOptions, vueOptions); initExtraOptions(mpComponentOptions, vueOptions);
initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods); initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods);
......
...@@ -110,7 +110,7 @@ export function parseComponent( ...@@ -110,7 +110,7 @@ export function parseComponent(
applyOptions(mpComponentOptions, vueOptions, initBehavior) applyOptions(mpComponentOptions, vueOptions, initBehavior)
} }
initProps(mpComponentOptions, vueOptions.props, false) initProps(mpComponentOptions)
initPropsObserver(mpComponentOptions) initPropsObserver(mpComponentOptions)
......
...@@ -771,7 +771,7 @@ function parseComponent(vueOptions, { parse, mocks, isPage, initRelation, handle ...@@ -771,7 +771,7 @@ function parseComponent(vueOptions, { parse, mocks, isPage, initRelation, handle
if (__VUE_OPTIONS_API__) { if (__VUE_OPTIONS_API__) {
applyOptions(mpComponentOptions, vueOptions, initBehavior); applyOptions(mpComponentOptions, vueOptions, initBehavior);
} }
initProps(mpComponentOptions, vueOptions.props); initProps(mpComponentOptions);
initPropsObserver(mpComponentOptions); initPropsObserver(mpComponentOptions);
initExtraOptions(mpComponentOptions, vueOptions); initExtraOptions(mpComponentOptions, vueOptions);
initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods); initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods);
......
...@@ -736,7 +736,7 @@ function parseComponent(vueOptions, { parse, mocks, isPage, initRelation, handle ...@@ -736,7 +736,7 @@ function parseComponent(vueOptions, { parse, mocks, isPage, initRelation, handle
if (__VUE_OPTIONS_API__) { if (__VUE_OPTIONS_API__) {
applyOptions(mpComponentOptions, vueOptions, initBehavior); applyOptions(mpComponentOptions, vueOptions, initBehavior);
} }
initProps(mpComponentOptions, vueOptions.props); initProps(mpComponentOptions);
initPropsObserver(mpComponentOptions); initPropsObserver(mpComponentOptions);
initExtraOptions(mpComponentOptions, vueOptions); initExtraOptions(mpComponentOptions, vueOptions);
initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods); initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods);
......
...@@ -725,7 +725,7 @@ function parseComponent(vueOptions, { parse, mocks, isPage, initRelation, handle ...@@ -725,7 +725,7 @@ function parseComponent(vueOptions, { parse, mocks, isPage, initRelation, handle
if (__VUE_OPTIONS_API__) { if (__VUE_OPTIONS_API__) {
applyOptions(mpComponentOptions, vueOptions, initBehavior); applyOptions(mpComponentOptions, vueOptions, initBehavior);
} }
initProps(mpComponentOptions, vueOptions.props); initProps(mpComponentOptions);
initPropsObserver(mpComponentOptions); initPropsObserver(mpComponentOptions);
initExtraOptions(mpComponentOptions, vueOptions); initExtraOptions(mpComponentOptions, vueOptions);
initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods); initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods);
......
...@@ -736,7 +736,7 @@ function parseComponent(vueOptions, { parse, mocks, isPage, initRelation, handle ...@@ -736,7 +736,7 @@ function parseComponent(vueOptions, { parse, mocks, isPage, initRelation, handle
if (__VUE_OPTIONS_API__) { if (__VUE_OPTIONS_API__) {
applyOptions(mpComponentOptions, vueOptions, initBehavior); applyOptions(mpComponentOptions, vueOptions, initBehavior);
} }
initProps(mpComponentOptions, vueOptions.props); initProps(mpComponentOptions);
initPropsObserver(mpComponentOptions); initPropsObserver(mpComponentOptions);
initExtraOptions(mpComponentOptions, vueOptions); initExtraOptions(mpComponentOptions, vueOptions);
initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods); initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods);
......
...@@ -597,7 +597,7 @@ function parseComponent(vueOptions, { parse, mocks, isPage, initRelation, handle ...@@ -597,7 +597,7 @@ function parseComponent(vueOptions, { parse, mocks, isPage, initRelation, handle
if (__VUE_OPTIONS_API__) { if (__VUE_OPTIONS_API__) {
applyOptions(mpComponentOptions, vueOptions, initBehavior); applyOptions(mpComponentOptions, vueOptions, initBehavior);
} }
initProps(mpComponentOptions, vueOptions.props); initProps(mpComponentOptions);
initPropsObserver(mpComponentOptions); initPropsObserver(mpComponentOptions);
initExtraOptions(mpComponentOptions, vueOptions); initExtraOptions(mpComponentOptions, vueOptions);
initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods); initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods);
......
...@@ -714,7 +714,7 @@ function parseComponent(vueOptions, { parse, mocks, isPage, initRelation, handle ...@@ -714,7 +714,7 @@ function parseComponent(vueOptions, { parse, mocks, isPage, initRelation, handle
if (__VUE_OPTIONS_API__) { if (__VUE_OPTIONS_API__) {
applyOptions(mpComponentOptions, vueOptions, initBehavior); applyOptions(mpComponentOptions, vueOptions, initBehavior);
} }
initProps(mpComponentOptions, vueOptions.props); initProps(mpComponentOptions);
initPropsObserver(mpComponentOptions); initPropsObserver(mpComponentOptions);
initExtraOptions(mpComponentOptions, vueOptions); initExtraOptions(mpComponentOptions, vueOptions);
initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods); initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods);
......
...@@ -6,6 +6,7 @@ importers: ...@@ -6,6 +6,7 @@ importers:
specifiers: specifiers:
'@dcloudio/types': ^2.5.14 '@dcloudio/types': ^2.5.14
'@dcloudio/uni-api': 3.0.0-alpha-3030120211215001 '@dcloudio/uni-api': 3.0.0-alpha-3030120211215001
'@dcloudio/uni-app': 3.0.0-alpha-3030120211215001
'@jest/types': ^27.0.2 '@jest/types': ^27.0.2
'@microsoft/api-extractor': ^7.19.2 '@microsoft/api-extractor': ^7.19.2
'@rollup/plugin-alias': ^3.1.1 '@rollup/plugin-alias': ^3.1.1
...@@ -52,6 +53,7 @@ importers: ...@@ -52,6 +53,7 @@ importers:
devDependencies: devDependencies:
'@dcloudio/types': 2.5.14 '@dcloudio/types': 2.5.14
'@dcloudio/uni-api': link:packages/uni-api '@dcloudio/uni-api': link:packages/uni-api
'@dcloudio/uni-app': link:packages/uni-app
'@jest/types': 27.4.2 '@jest/types': 27.4.2
'@microsoft/api-extractor': 7.19.2 '@microsoft/api-extractor': 7.19.2
'@rollup/plugin-alias': 3.1.8_rollup@2.60.2 '@rollup/plugin-alias': 3.1.8_rollup@2.60.2
...@@ -449,8 +451,10 @@ importers: ...@@ -449,8 +451,10 @@ importers:
packages/uni-components: packages/uni-components:
specifiers: specifiers:
'@dcloudio/uni-shared': 3.0.0-alpha-3030120211215001 '@dcloudio/uni-shared': 3.0.0-alpha-3030120211215001
'@types/quill': ^1.3.7
devDependencies: devDependencies:
'@dcloudio/uni-shared': link:../uni-shared '@dcloudio/uni-shared': link:../uni-shared
'@types/quill': 1.3.10
packages/uni-core: packages/uni-core:
specifiers: specifiers:
...@@ -2737,6 +2741,12 @@ packages: ...@@ -2737,6 +2741,12 @@ packages:
resolution: {integrity: sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==} resolution: {integrity: sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==}
dev: true dev: true
/@types/quill/1.3.10:
resolution: {integrity: sha512-IhW3fPW+bkt9MLNlycw8u8fWb7oO7W5URC9MfZYHBlA24rex9rs23D5DETChu1zvgVdc5ka64ICjJOgQMr6Shw==}
dependencies:
parchment: 1.1.4
dev: true
/@types/range-parser/1.2.4: /@types/range-parser/1.2.4:
resolution: {integrity: sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==} resolution: {integrity: sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==}
dev: true dev: true
...@@ -7135,6 +7145,10 @@ packages: ...@@ -7135,6 +7145,10 @@ packages:
resolution: {integrity: sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==} resolution: {integrity: sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==}
dev: true dev: true
/parchment/1.1.4:
resolution: {integrity: sha512-J5FBQt/pM2inLzg4hEWmzQx/8h8D0CiDxaG3vyp9rKrQRSDgBlhjdP5jQGgosEajXPSQouXGHOmVdgo7QmJuOg==}
dev: true
/parent-module/1.0.1: /parent-module/1.0.1:
resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==}
engines: {node: '>=6'} engines: {node: '>=6'}
......
...@@ -68,6 +68,9 @@ async function main() { ...@@ -68,6 +68,9 @@ async function main() {
step('\nBuilding all packages...') step('\nBuilding all packages...')
if (!skipBuild && !isDryRun) { if (!skipBuild && !isDryRun) {
await run('pnpm', ['run', 'build']) await run('pnpm', ['run', 'build'])
// test generated dts files
step('\nVerifying type declarations...')
await run('pnpm', ['run', 'test-dts'])
} else { } else {
console.log(`(skipped)`) console.log(`(skipped)`)
} }
......
export * from '@dcloudio/uni-app'
export function expectType<T>(value: T): void
{
"compilerOptions": {
"noEmit": true,
"jsx": "preserve",
"module": "esnext",
"strict": true,
"moduleResolution": "node",
"lib": ["esnext", "dom"]
},
"include": ["./*"]
}
{
"extends": "../tsconfig.json",
"compilerOptions": {
"noEmit": true,
"declaration": true
},
"exclude": ["../packages/*/__tests__"]
}
import {
onShow,
onLoad,
onLaunch,
onError,
onThemeChange,
onPageNotFound,
onUnhandledRejection,
onAddToFavorites,
onBackPress,
onNavigationBarButtonTap,
onNavigationBarSearchInputChanged,
onNavigationBarSearchInputConfirmed,
onNavigationBarSearchInputFocusChanged,
onPageScroll,
onResize,
onShareAppMessage,
onShareTimeline,
onTabItemTap,
} from '@dcloudio/uni-app'
import { expectType } from './'
describe('apiLifecycle', () => {
onLaunch(({ path, query, scene }) => {
expectType<string>(path)
expectType<Record<string, string | undefined>>(query)
expectType<number>(scene)
})
onError((err) => {
expectType<string>(err)
})
onThemeChange(({ theme }) => {
expectType<'dark' | 'light'>(theme)
})
onPageNotFound(({ path, query }) => {
expectType<string>(path)
expectType<Record<string, string | undefined>>(query)
})
onUnhandledRejection(({ promise, reason }) => {
expectType<Promise<any>>(promise)
expectType<string>(reason)
})
onShow(({ path }) => {
expectType<string>(path)
})
onLoad((options) => {
expectType<string | undefined>(options.a)
})
onResize(({ size: { windowHeight, windowWidth } }) => {
expectType<number>(windowHeight)
expectType<number>(windowWidth)
})
onBackPress(({ from }) => {
expectType<'backbutton' | 'navigateBack'>(from)
})
onPageScroll(({ scrollTop }) => {
expectType<number>(scrollTop)
})
onTabItemTap(({ index, pagePath, text }) => {
expectType<string>(index)
expectType<string>(pagePath)
expectType<string>(text)
})
onShareTimeline(() => {})
onShareTimeline(() => {
return {
title: '',
query: '',
imageUrl: '',
}
})
onAddToFavorites(() => {})
onAddToFavorites(({ webviewUrl }) => {
expectType<string | undefined>(webviewUrl)
return {
title: '',
query: '',
imageUrl: '',
}
})
onShareAppMessage(() => {})
onShareAppMessage(({ from, target, webViewUrl }) => {
expectType<string>(from)
expectType<any>(target)
expectType<string | undefined>(webViewUrl)
return {
title: '',
path: '',
imageUrl: '',
}
})
onNavigationBarButtonTap(({ index }) => {
expectType<number>(index)
})
onNavigationBarSearchInputChanged(({ text }) => {
expectType<string>(text)
})
onNavigationBarSearchInputConfirmed(({ text }) => {
expectType<string>(text)
})
onNavigationBarSearchInputFocusChanged(({ focus }) => {
expectType<boolean>(focus)
})
})
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"skipLibCheck": true, "skipLibCheck": true,
"jsx": "preserve", "jsx": "preserve",
"lib": ["esnext", "dom"], "lib": ["esnext", "dom"],
"types": ["jest", "node", "@dcloudio/types", "miniprogram-api-typings"], "types": ["jest", "@dcloudio/types", "miniprogram-api-typings"],
"rootDir": ".", "rootDir": ".",
"paths": { "paths": {
"types/alias": ["packages/uni-cli-shared/types/alias.d.ts"], "types/alias": ["packages/uni-cli-shared/types/alias.d.ts"],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册