From e2791d25c2e8b526bdd16215780ab862c6443e4d Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Mon, 26 Sep 2022 15:18:30 +0800 Subject: [PATCH] chore: build --- .../uts/uni_modules/test-uniplugin/app-ios/index.uts | 4 ++++ .../uni_modules/test-uniplugin/app-android/index.kt.map | 2 +- .../app/uni_modules/test-uniplugin/app-ios/index.swift | 8 ++++++++ .../uni_modules/test-uniplugin/app-ios/index.swift.map | 2 +- packages/uni-app-plus/dist/uni.vue.js | 6 ++---- packages/uni-h5/dist/uni-h5.cjs.js | 4 +--- packages/uni-h5/dist/uni-h5.es.js | 6 ++---- packages/uni-mp-vue/dist/vue.runtime.esm.js | 6 ++---- packages/uni-shared/dist/uni-shared.cjs.js | 8 +++++++- packages/uni-shared/dist/uni-shared.d.ts | 3 +++ packages/uni-shared/dist/uni-shared.es.js | 9 +++++++-- 11 files changed, 38 insertions(+), 20 deletions(-) diff --git a/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts b/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts index fa1828cf49..14e2c526b4 100644 --- a/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts +++ b/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts @@ -54,3 +54,7 @@ export class Test { return null } } + +export async function testAsync() { + return { a: 1 } +} diff --git a/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-android/index.kt.map b/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-android/index.kt.map index 1204f2a4db..62029259a8 100644 --- a/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-android/index.kt.map +++ b/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-android/index.kt.map @@ -1 +1 @@ -{"version":3,"sources":["/Users/guoshengqiang/Documents/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/static/logo.png","/Users/guoshengqiang/Documents/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/index.uts","/Users/guoshengqiang/Documents/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/interface.uts","/Users/guoshengqiang/Documents/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/login.uts"],"sourcesContent":["import { getResourcePath } from 'io.dcloud.uts.android'\nexport default getResourcePath('uni_modules/test-uniplugin/static/logo.png')\n ","import Log from 'android.util.Log'\nimport FrameLayout from 'android.widget.FrameLayout'\nimport View from 'android.view.View'\nimport { IUser } from './interface.uts'\nimport { login } from './login.uts'\nimport logo from '../static/logo.png'\n\nconst test = arrayOf(1, 2, 3)\n\ntype GetBatteryInfoOptions = {\n success?: (res: UTSJSONObject) => void\n fail?: (res: UTSJSONObject) => void\n complete?: (res: UTSJSONObject) => void\n}\nexport class User implements IUser {\n async login(name: string, pwd: string) {\n setTimeout(() => {\n console.log('timeout')\n }, 1000)\n login(name, pwd)\n Log.info(logo)\n\n console.log('def android')\n\n\n\n\n\n\n\n\n console.log('ndef ios')\n\n\n console.log('def android || def ios')\n\n\n\n\n }\n register(name: string, callback: () => void) {\n Log.info(logo as FrameLayout)\n }\n test(view: View) {}\n}\nfunction login(name: string, callback: () => void) {}\nexport function register(name: string, callback: () => void) {}\n","export interface IUser {\n register(name: string): void\n}\n","export function login(name: string, pwd: string) {\n console.log('login')\n return { name, pwd }\n}\n"],"names":[],"mappings":";;;AAAA;ACAA,OAAgB,gBAAkB,CAAA;AAClC,OAAwB,0BAA4B,CAAA;AACpD,OAAiB,iBAAmB,CAAA;UCFnB,KAAK;QACpB,QAAQ,CAAC,IAAY,EAAN,MAAM,GAAG,IAAI;;ACDvB,IAAS,KAAK,CAAC,IAAY,EAAN,MAAM,EAAE,GAAW,EAAN,MAAM,iBAAE;IAC/C,OAAO,CAAC,GAAG,CAAC,OAAO,2DAAC;IACpB,OAAO;QAAE,IAAA,IAAI,GAAJ,IAAI;QAAE,IAAA,GAAG,GAAH,GAAG;KAAE,CAAA;AACtB;gBHFe,eAAe,CAAC,4CAA4C,CAAC;ACM5E,IAAM,IAAI,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAEA,WAAxB,qBAAqB;IACxB,SAAA,OAAO,EAAC,WAA8B,SAAA;IACtC,SAAA,IAAI,EAAC,WAA8B,SAAA;IACnC,SAAA,QAAQ,EAAC,WAA8B,SAAA;CACxC;AACM,WAAM,IAAI,GAAY,KAAK;qBAC1B,KAAK,CAAC,IAAY,EAAN,MAAM,EAAE,GAAW,EAAN,MAAM,8CAAE;QACrC,UAAU,CAAC,KAAM;YACf,OAAO,CAAC,GAAG,CAAC,SAAS,4DAAC;QACxB;QAAC,EAAE,IAAI,CAAC;QACR,MAAM,IAAI,EAAE,GAAG,CAAC;QAChB,GAAG,CAAC,IAAI,WAAM;QAEd,OAAO,CAAC,GAAG,CAAC,aAAa,4DAAC;QAS1B,OAAO,CAAC,GAAG,CAAC,UAAU,4DAAC;QAGvB,OAAO,CAAC,GAAG,CAAC,wBAAwB,4DAAC;IAKvC;iBACA,QAAQ,CAAC,IAAY,EAAN,MAAM,EAAE,QAAoB,aAAA,EAAE;QAC3C,GAAG,CAAC,IAAI,cAAS,WAAW,CAAC;IAC/B;aACA,IAAI,CAAC,IAAU,EAAJ,IAAI,EAAE,CAAC;CACnB;AACD,UAAe,IAAY,EAAN,MAAM,EAAE,QAAoB,QAAJ,IAAI,EAAE,CAAC,CAAC;AAC9C,IAAS,QAAQ,CAAC,IAAY,EAAN,MAAM,EAAE,QAAoB,aAAA,EAAE,CAAC,CAAC"} \ No newline at end of file +{"version":3,"sources":["/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/static/logo.png","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/index.uts","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/interface.uts","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/login.uts"],"sourcesContent":["import { getResourcePath } from 'io.dcloud.uts.android'\nexport default getResourcePath('uni_modules/test-uniplugin/static/logo.png')\n ","import Log from 'android.util.Log'\nimport FrameLayout from 'android.widget.FrameLayout'\nimport View from 'android.view.View'\nimport { IUser } from './interface.uts'\nimport { login } from './login.uts'\nimport logo from '../static/logo.png'\n\nconst test = arrayOf(1, 2, 3)\n\ntype GetBatteryInfoOptions = {\n success?: (res: UTSJSONObject) => void\n fail?: (res: UTSJSONObject) => void\n complete?: (res: UTSJSONObject) => void\n}\nexport class User implements IUser {\n async login(name: string, pwd: string) {\n setTimeout(() => {\n console.log('timeout')\n }, 1000)\n login(name, pwd)\n Log.info(logo)\n\n console.log('def android')\n\n\n\n\n\n\n\n\n console.log('ndef ios')\n\n\n console.log('def android || def ios')\n\n\n\n\n }\n register(name: string, callback: () => void) {\n Log.info(logo as FrameLayout)\n }\n test(view: View) {}\n}\nfunction login(name: string, callback: () => void) {}\nexport function register(name: string, callback: () => void) {}\n","export interface IUser {\n register(name: string): void\n}\n","export function login(name: string, pwd: string) {\n console.log('login')\n return { name, pwd }\n}\n"],"names":[],"mappings":";;;AAAA;ACAA,OAAgB,gBAAkB,CAAA;AAClC,OAAwB,0BAA4B,CAAA;AACpD,OAAiB,iBAAmB,CAAA;UCFnB,KAAK;QACpB,QAAQ,CAAC,IAAY,EAAN,MAAM,GAAG,IAAI;;ACDvB,IAAS,KAAK,CAAC,IAAY,EAAN,MAAM,EAAE,GAAW,EAAN,MAAM,iBAAE;IAC/C,OAAO,CAAC,GAAG,CAAC,OAAO,2DAAC;IACpB,OAAO;QAAE,IAAA,IAAI,GAAJ,IAAI;QAAE,IAAA,GAAG,GAAH,GAAG;KAAE,CAAA;AACtB;gBHFe,eAAe,CAAC,4CAA4C,CAAC;ACM5E,IAAM,IAAI,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAEA,WAAxB,qBAAqB;IACxB,SAAA,OAAO,EAAC,WAA8B,SAAA;IACtC,SAAA,IAAI,EAAC,WAA8B,SAAA;IACnC,SAAA,QAAQ,EAAC,WAA8B,SAAA;CACxC;AACM,WAAM,IAAI,GAAY,KAAK;qBAC1B,KAAK,CAAC,IAAY,EAAN,MAAM,EAAE,GAAW,EAAN,MAAM,8CAAE;QACrC,UAAU,CAAC,KAAM;YACf,OAAO,CAAC,GAAG,CAAC,SAAS,4DAAC;QACxB;QAAC,EAAE,IAAI,CAAC;QACR,MAAM,IAAI,EAAE,GAAG,CAAC;QAChB,GAAG,CAAC,IAAI,WAAM;QAEd,OAAO,CAAC,GAAG,CAAC,aAAa,4DAAC;QAS1B,OAAO,CAAC,GAAG,CAAC,UAAU,4DAAC;QAGvB,OAAO,CAAC,GAAG,CAAC,wBAAwB,4DAAC;IAKvC;iBACA,QAAQ,CAAC,IAAY,EAAN,MAAM,EAAE,QAAoB,aAAA,EAAE;QAC3C,GAAG,CAAC,IAAI,cAAS,WAAW,CAAC;IAC/B;aACA,IAAI,CAAC,IAAU,EAAJ,IAAI,EAAE,CAAC;CACnB;AACD,UAAe,IAAY,EAAN,MAAM,EAAE,QAAoB,QAAJ,IAAI,EAAE,CAAC,CAAC;AAC9C,IAAS,QAAQ,CAAC,IAAY,EAAN,MAAM,EAAE,QAAoB,aAAA,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift b/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift index 0e04cac1a6..92f4a10ba4 100644 --- a/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift +++ b/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift @@ -41,6 +41,11 @@ class Test : NSObject { return nil; } } +async func testAsync() -> Deferred { + return UTSJSONObject([ + "a": 1 + ]); +} @objc(UTSSDKModulesTestUniPluginIndexSwift) @objcMembers class IndexSwift : NSObject { @@ -50,4 +55,7 @@ class IndexSwift : NSObject { public static func s_test1(_ callback: UTSCallback) -> String { return test1(callback); } + public static func async s_testAsync() -> Deferred { + return testAsync(); + } } diff --git a/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift.map b/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift.map index a439ca1e5a..454ef3e777 100644 --- a/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift.map +++ b/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift.map @@ -1 +1 @@ -{"version":3,"sources":["/Users/guoshengqiang/Documents/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts"],"sourcesContent":["import { UIDevice } from 'UIKit'\n\ntype GetBatteryInfoOptions = {\n name: string\n pwd: number\n success?: (res: UTSJSONObject) => void\n fail?: (res: UTSJSONObject) => void\n complete?: (res: UTSJSONObject) => void\n}\n\nexport default function getBatteryInfo(options: GetBatteryInfoOptions) {\n const res = {\n errMsg: 'getBatteryInfo:ok',\n level: UIDevice.current.batteryLevel * 100,\n isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging,\n }\n if (options.success != null) {\n options.success!(res)\n }\n if (options.complete != null) {\n options.complete!(res)\n }\n}\n\nexport function test1(callback: () => void): string {\n console.log('test1')\n\n\n\n\n console.log('def ios')\n\n\n console.log('ndef android')\n\n\n\n\n\n console.log('def android || def ios')\n\n\n\n\n return 'test1'\n}\n\nclass Test1 {}\nexport class Test {\n constructor() {\n new Test1()\n }\n test(): string | null {\n return null\n }\n}\n"],"names":[],"mappings":";AAAA;AAE6B;;MAAxB,qBAAqB;IACxB,WAAA,IAAI,EAAE,MAAM,EAAA;IACZ,WAAA,GAAG,EAAE,QAAM,EAAA;IACX,WAAA,OAAO,EAAC,WAA8B,EAAA;IACtC,WAAA,IAAI,EAAC,WAA8B,EAAA;IACnC,WAAA,QAAQ,EAAC,WAA8B,EAAA;CACxC;AAEc,KAAS,cAAc,CAAC,EAAA,OAA8B,EAArB,qBAAqB,EAAE;IACrE,IAAM,GAAG,GAAG;QACV,CAAA,MAAM,GAAE,mBAAmB;QAC3B,CAAA,KAAK,GAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,GAAG,GAAG;QAC1C,CAAA,UAAU,GAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,IAAI,QAAQ,CAAC,YAAY,CAAC,QAAQ;MAC5E;IACD,IAAI,OAAO,CAAC,OAAO,IAAI,GAAI;QACzB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;;IAEvB,IAAI,OAAO,CAAC,QAAQ,IAAI,GAAI;QAC1B,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;;AAE1B;AAEO,KAAS,KAAK,CAAC,EAAA,QAAoB,aAAA,KAAG,MAAM,CAAC;IAClD,OAAO,CAAC,GAAG,CAAC,OAAO,wDAAC;IAKpB,OAAO,CAAC,GAAG,CAAC,SAAS,wDAAC;IAGtB,OAAO,CAAC,GAAG,CAAC,cAAc,wDAAC;IAM3B,OAAO,CAAC,GAAG,CAAC,wBAAwB,wDAAC;IAKrC,OAAO,OAAO,CAAA;AAChB;AAEA,MAAM,KAAK;CAAG;AACP;;MAAM,IAAI;IACf,aAAc;QACZ,AAAI,KAAK,EAAE;IACb;gBACA,IAAI,MAAI,MAAM,EAAQ;QACpB,OAAO,GAAI,CAAA;IACb;CACD;;;;wCA7CsC,EAAA,OAA8B,EAArB,qBAAqB;eAA7C,cAAc,CAAC,OAA8B;;+BAc/C,EAAA,QAAoB,aAAA,KAAG,MAAM;eAAnC,KAAK,CAAC,QAAoB"} \ No newline at end of file +{"version":3,"sources":["/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts"],"sourcesContent":["import { UIDevice } from 'UIKit'\n\ntype GetBatteryInfoOptions = {\n name: string\n pwd: number\n success?: (res: UTSJSONObject) => void\n fail?: (res: UTSJSONObject) => void\n complete?: (res: UTSJSONObject) => void\n}\n\nexport default function getBatteryInfo(options: GetBatteryInfoOptions) {\n const res = {\n errMsg: 'getBatteryInfo:ok',\n level: UIDevice.current.batteryLevel * 100,\n isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging,\n }\n if (options.success != null) {\n options.success!(res)\n }\n if (options.complete != null) {\n options.complete!(res)\n }\n}\n\nexport function test1(callback: () => void): string {\n console.log('test1')\n\n\n\n\n console.log('def ios')\n\n\n console.log('ndef android')\n\n\n\n\n\n console.log('def android || def ios')\n\n\n\n\n return 'test1'\n}\n\nclass Test1 {}\nexport class Test {\n constructor() {\n new Test1()\n }\n test(): string | null {\n return null\n }\n}\n\nexport async function testAsync() {\n return { a: 1 }\n}\n"],"names":[],"mappings":";AAAA;AAE6B;;MAAxB,qBAAqB;IACxB,WAAA,IAAI,EAAE,MAAM,EAAA;IACZ,WAAA,GAAG,EAAE,QAAM,EAAA;IACX,WAAA,OAAO,EAAC,WAA8B,EAAA;IACtC,WAAA,IAAI,EAAC,WAA8B,EAAA;IACnC,WAAA,QAAQ,EAAC,WAA8B,EAAA;CACxC;AAEc,KAAS,cAAc,CAAC,EAAA,OAA8B,EAArB,qBAAqB,EAAE;IACrE,IAAM,GAAG,GAAG;QACV,CAAA,MAAM,GAAE,mBAAmB;QAC3B,CAAA,KAAK,GAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,GAAG,GAAG;QAC1C,CAAA,UAAU,GAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,IAAI,QAAQ,CAAC,YAAY,CAAC,QAAQ;MAC5E;IACD,IAAI,OAAO,CAAC,OAAO,IAAI,GAAI;QACzB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;;IAEvB,IAAI,OAAO,CAAC,QAAQ,IAAI,GAAI;QAC1B,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;;AAE1B;AAEO,KAAS,KAAK,CAAC,EAAA,QAAoB,aAAA,KAAG,MAAM,CAAC;IAClD,OAAO,CAAC,GAAG,CAAC,OAAO,wDAAC;IAKpB,OAAO,CAAC,GAAG,CAAC,SAAS,wDAAC;IAGtB,OAAO,CAAC,GAAG,CAAC,cAAc,wDAAC;IAM3B,OAAO,CAAC,GAAG,CAAC,wBAAwB,wDAAC;IAKrC,OAAO,OAAO,CAAA;AAChB;AAEA,MAAM,KAAK;CAAG;AACP;;MAAM,IAAI;IACf,aAAc;QACZ,AAAI,KAAK,EAAE;IACb;gBACA,IAAI,MAAI,MAAM,EAAQ;QACpB,OAAO,GAAI,CAAA;IACb;CACD;AAEM,WAAe,SAAS,8BAAG;IAChC,OAAO;QAAE,CAAA,CAAC,GAAE,CAAC;MAAE,CAAA;AACjB;;;;wCAjDuC,EAAA,OAA8B,EAArB,qBAAqB;eAA7C,cAAc,CAAC,OAA8B;;+BAc/C,EAAA,QAAoB,aAAA,KAAG,MAAM;eAAnC,KAAK,CAAC,QAAoB;;;eAiCpB,SAAS"} \ No newline at end of file diff --git a/packages/uni-app-plus/dist/uni.vue.js b/packages/uni-app-plus/dist/uni.vue.js index 9ca6c01f42..3f50fa2f84 100644 --- a/packages/uni-app-plus/dist/uni.vue.js +++ b/packages/uni-app-plus/dist/uni.vue.js @@ -1,5 +1,5 @@ +import { invokeArrayFns, ON_LOAD, ON_SHOW, LINEFEED, RENDERJS_MODULES, WXS_PROTOCOL, formatLog, WXS_MODULES, UniLifecycleHooks, ON_ERROR, invokeCreateErrorHandler, invokeCreateVueAppHook } from '@dcloudio/uni-shared'; import { isString, isArray, isFunction } from '@vue/shared'; -import { invokeArrayFns, ON_LOAD, ON_SHOW, LINEFEED, RENDERJS_MODULES, WXS_PROTOCOL, formatLog, WXS_MODULES, ON_ERROR, UniLifecycleHooks, invokeCreateVueAppHook } from '@dcloudio/uni-shared'; import { injectHook } from 'vue'; function getCurrentPage() { @@ -255,9 +255,7 @@ function uniIdMixin(globalProperties) { function initApp(app) { const appConfig = app._context.config; - if (isFunction(app._component.onError)) { - appConfig.errorHandler = createErrorHandler(app); - } + appConfig.errorHandler = invokeCreateErrorHandler(app, createErrorHandler); initOptionMergeStrategies(appConfig.optionMergeStrategies); const globalProperties = appConfig.globalProperties; { diff --git a/packages/uni-h5/dist/uni-h5.cjs.js b/packages/uni-h5/dist/uni-h5.cjs.js index 162b24325a..84bed2c564 100644 --- a/packages/uni-h5/dist/uni-h5.cjs.js +++ b/packages/uni-h5/dist/uni-h5.cjs.js @@ -7063,9 +7063,7 @@ function uniIdMixin(globalProperties) { } function initApp$1(app) { const appConfig = app._context.config; - if (shared.isFunction(app._component.onError)) { - appConfig.errorHandler = createErrorHandler(app); - } + appConfig.errorHandler = uniShared.invokeCreateErrorHandler(app, createErrorHandler); initOptionMergeStrategies(appConfig.optionMergeStrategies); const globalProperties = appConfig.globalProperties; { diff --git a/packages/uni-h5/dist/uni-h5.es.js b/packages/uni-h5/dist/uni-h5.es.js index d326549e5d..37e3eafb0d 100644 --- a/packages/uni-h5/dist/uni-h5.es.js +++ b/packages/uni-h5/dist/uni-h5.es.js @@ -1,6 +1,6 @@ import { withModifiers, createVNode, getCurrentInstance, ref, defineComponent, openBlock, createElementBlock, provide, computed, watch, onUnmounted, inject, onBeforeUnmount, mergeProps, injectHook, reactive, onActivated, onMounted, nextTick, onBeforeMount, withDirectives, vShow, shallowRef, watchEffect, isVNode, Fragment, markRaw, Comment, h, createTextVNode, onBeforeActivate, onBeforeDeactivate, createBlock, renderList, onDeactivated, createApp, Transition, effectScope, withCtx, KeepAlive, resolveDynamicComponent, createElementVNode, normalizeStyle, renderSlot } from "vue"; import { isString, extend, isArray, remove, stringifyStyle, parseStringStyle, isPlainObject, 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, addLeadingSlash, invokeArrayFns, removeLeadingSlash, resolveOwnerVm, resolveOwnerEl, ON_WXS_INVOKE_CALL_METHOD, normalizeTarget, 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, ON_LOAD, UniLifecycleHooks, invokeCreateVueAppHook, NAVBAR_HEIGHT, parseQuery, ON_UNLOAD, ON_REACH_BOTTOM_DISTANCE, decodedQuery, WEB_INVOKE_APPSERVICE, ON_WEB_INVOKE_APP_SERVICE, updateElementStyle, sortObject, 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, addLeadingSlash, invokeArrayFns, removeLeadingSlash, resolveOwnerVm, resolveOwnerEl, ON_WXS_INVOKE_CALL_METHOD, normalizeTarget, 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, ON_LOAD, UniLifecycleHooks, invokeCreateErrorHandler, invokeCreateVueAppHook, NAVBAR_HEIGHT, parseQuery, ON_UNLOAD, ON_REACH_BOTTOM_DISTANCE, decodedQuery, WEB_INVOKE_APPSERVICE, ON_WEB_INVOKE_APP_SERVICE, updateElementStyle, sortObject, 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"; export { onCreateVueApp } 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"; @@ -14121,9 +14121,7 @@ function uniIdMixin(globalProperties) { } function initApp$1(app) { const appConfig = app._context.config; - if (isFunction(app._component.onError)) { - appConfig.errorHandler = createErrorHandler(app); - } + appConfig.errorHandler = invokeCreateErrorHandler(app, createErrorHandler); initOptionMergeStrategies(appConfig.optionMergeStrategies); const globalProperties = appConfig.globalProperties; { diff --git a/packages/uni-mp-vue/dist/vue.runtime.esm.js b/packages/uni-mp-vue/dist/vue.runtime.esm.js index e2e973e926..52aa96a0a7 100644 --- a/packages/uni-mp-vue/dist/vue.runtime.esm.js +++ b/packages/uni-mp-vue/dist/vue.runtime.esm.js @@ -1,6 +1,6 @@ +import { isRootHook, getValueByDataPath, ON_ERROR, UniLifecycleHooks, invokeCreateErrorHandler, dynamicSlotName } from '@dcloudio/uni-shared'; import { extend, isObject, toRawType, def, hasChanged, isArray, isString, isFunction, isPromise, remove, EMPTY_OBJ, toHandlerKey, camelize, capitalize, hasOwn, hyphenate, isReservedProp, normalizeClass, normalizeStyle, isOn, toTypeString, NOOP, isMap, isIntegerKey, isSet, isPlainObject, makeMap, invokeArrayFns, isBuiltInDirective, NO, isSymbol, toNumber, EMPTY_ARR, isModelListener, toDisplayString } from '@vue/shared'; export { EMPTY_OBJ, camelize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared'; -import { isRootHook, getValueByDataPath, ON_ERROR, UniLifecycleHooks, dynamicSlotName } from '@dcloudio/uni-shared'; function warn(msg, ...args) { console.warn(`[Vue warn] ${msg}`, ...args); @@ -5353,9 +5353,7 @@ function uniIdMixin(globalProperties) { function initApp(app) { const appConfig = app._context.config; - if (isFunction(app._component.onError)) { - appConfig.errorHandler = createErrorHandler(app); - } + appConfig.errorHandler = invokeCreateErrorHandler(app, createErrorHandler); initOptionMergeStrategies(appConfig.optionMergeStrategies); const globalProperties = appConfig.globalProperties; { diff --git a/packages/uni-shared/dist/uni-shared.cjs.js b/packages/uni-shared/dist/uni-shared.cjs.js index 866e5d09cb..4ce4f0b2b3 100644 --- a/packages/uni-shared/dist/uni-shared.cjs.js +++ b/packages/uni-shared/dist/uni-shared.cjs.js @@ -1302,7 +1302,12 @@ function onCreateVueApp(hook) { function invokeCreateVueAppHook(app) { vueApp = app; createVueAppHooks.forEach((hook) => hook(app)); -} +} +const invokeCreateErrorHandler = once((app, createErrorHandler) => { + if (shared.isFunction(app._component.onError)) { + return createErrorHandler(app); + } +}); const E = function () { // Keep this empty so it's easier to inherit from @@ -1488,6 +1493,7 @@ exports.getLen = getLen; exports.getValueByDataPath = getValueByDataPath; exports.initCustomDatasetOnce = initCustomDatasetOnce; exports.invokeArrayFns = invokeArrayFns; +exports.invokeCreateErrorHandler = invokeCreateErrorHandler; exports.invokeCreateVueAppHook = invokeCreateVueAppHook; exports.isAppNVueNativeTag = isAppNVueNativeTag; exports.isAppNativeTag = isAppNativeTag; diff --git a/packages/uni-shared/dist/uni-shared.d.ts b/packages/uni-shared/dist/uni-shared.d.ts index 9d25c6d432..84beb0c0ea 100644 --- a/packages/uni-shared/dist/uni-shared.d.ts +++ b/packages/uni-shared/dist/uni-shared.d.ts @@ -1,6 +1,7 @@ import type { App } from 'vue'; import type { ComponentInternalInstance } from '@vue/runtime-core'; import { ComponentOptionsBase } from '@vue/runtime-core'; +import { ComponentOptionsBase as ComponentOptionsBase_2 } from 'vue'; import type { ComponentPublicInstance } from '@vue/runtime-core'; import { ComponentPublicInstance as ComponentPublicInstance_2 } from 'vue'; import { createApp } from 'vue'; @@ -251,6 +252,8 @@ Partial? export declare const invokeArrayFns: (fns: Function[], arg?: any) => any; +export declare const invokeCreateErrorHandler: (app: App, createErrorHandler: (app: App) => App['config']['errorHandler']) => ((err: unknown, instance: ComponentPublicInstance_2< {}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase_2> | null, info: string) => void) | undefined; + export declare function invokeCreateVueAppHook(app: App): void; export declare function isAppNativeTag(tag: string): boolean; diff --git a/packages/uni-shared/dist/uni-shared.es.js b/packages/uni-shared/dist/uni-shared.es.js index 9236c9220a..133290f638 100644 --- a/packages/uni-shared/dist/uni-shared.es.js +++ b/packages/uni-shared/dist/uni-shared.es.js @@ -1298,7 +1298,12 @@ function onCreateVueApp(hook) { function invokeCreateVueAppHook(app) { vueApp = app; createVueAppHooks.forEach((hook) => hook(app)); -} +} +const invokeCreateErrorHandler = once((app, createErrorHandler) => { + if (isFunction(app._component.onError)) { + return createErrorHandler(app); + } +}); const E = function () { // Keep this empty so it's easier to inherit from @@ -1357,4 +1362,4 @@ function getEnvLocale() { return (lang && lang.replace(/[.:].*/, '')) || 'en'; } -export { ACTION_TYPE_ADD_EVENT, ACTION_TYPE_ADD_WXS_EVENT, ACTION_TYPE_CREATE, ACTION_TYPE_EVENT, ACTION_TYPE_INSERT, ACTION_TYPE_PAGE_CREATE, ACTION_TYPE_PAGE_CREATED, ACTION_TYPE_PAGE_SCROLL, ACTION_TYPE_REMOVE, ACTION_TYPE_REMOVE_ATTRIBUTE, ACTION_TYPE_REMOVE_EVENT, ACTION_TYPE_SET_ATTRIBUTE, ACTION_TYPE_SET_TEXT, ATTR_CHANGE_PREFIX, ATTR_CLASS, ATTR_INNER_HTML, ATTR_STYLE, ATTR_TEXT_CONTENT, ATTR_V_OWNER_ID, ATTR_V_RENDERJS, ATTR_V_SHOW, BACKGROUND_COLOR, BUILT_IN_TAGS, BUILT_IN_TAG_NAMES, COMPONENT_NAME_PREFIX, COMPONENT_PREFIX, COMPONENT_SELECTOR_PREFIX, DATA_RE, E$1 as Emitter, EventChannel, EventModifierFlags, I18N_JSON_DELIMITERS, JSON_PROTOCOL, LINEFEED, MINI_PROGRAM_PAGE_RUNTIME_HOOKS, NAVBAR_HEIGHT, NODE_TYPE_COMMENT, NODE_TYPE_ELEMENT, NODE_TYPE_PAGE, NODE_TYPE_TEXT, NVUE_BUILT_IN_TAGS, NVUE_U_BUILT_IN_TAGS, ON_ADD_TO_FAVORITES, ON_APP_ENTER_BACKGROUND, ON_APP_ENTER_FOREGROUND, ON_BACK_PRESS, ON_ERROR, ON_HIDE, ON_INIT, ON_KEYBOARD_HEIGHT_CHANGE, ON_LAUNCH, ON_LOAD, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_CHANGE, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_PAGE_NOT_FOUND, ON_PAGE_SCROLL, ON_PULL_DOWN_REFRESH, ON_REACH_BOTTOM, ON_REACH_BOTTOM_DISTANCE, ON_READY, ON_RESIZE, ON_SAVE_EXIT_STATE, ON_SHARE_APP_MESSAGE, ON_SHARE_TIMELINE, ON_SHOW, ON_TAB_ITEM_TAP, ON_THEME_CHANGE, ON_UNHANDLE_REJECTION, ON_UNLOAD, ON_WEB_INVOKE_APP_SERVICE, ON_WXS_INVOKE_CALL_METHOD, PLUS_RE, PRIMARY_COLOR, RENDERJS_MODULES, RESPONSIVE_MIN_WIDTH, SCHEME_RE, SELECTED_COLOR, SLOT_DEFAULT_NAME, TABBAR_HEIGHT, TAGS, UNI_SSR, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR_STORE, UNI_SSR_TITLE, UNI_STORAGE_LOCALE, UniBaseNode, UniCommentNode, UniElement, UniEvent, UniInputElement, UniLifecycleHooks, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, WXS_MODULES, WXS_PROTOCOL, addFont, addLeadingSlash, cache, cacheStringFunction, callOptions, createIsCustomElement, createRpx2Unit, createUniEvent, customizeEvent, debounce, decode, decodedQuery, defaultMiniProgramRpx2Unit, defaultNVueRpx2Unit, defaultRpx2Unit, dynamicSlotName, forcePatchProp, formatDateTime, formatLog, getCustomDataset, getEnvLocale, getLen, getValueByDataPath, initCustomDatasetOnce, invokeArrayFns, invokeCreateVueAppHook, isAppNVueNativeTag, isAppNativeTag, isBuiltInComponent, isComponentInternalInstance, isComponentTag, isH5CustomElement, isH5NativeTag, isMiniProgramNativeTag, isRootHook, isRootImmediateHook, normalizeDataset, normalizeEventType, normalizeTarget, onCreateVueApp, once, parseEventName, parseNVueDataset, parseQuery, parseUrl, passive, plusReady, removeLeadingSlash, resolveComponentInstance, resolveOwnerEl, resolveOwnerVm, sanitise, scrollTo, sortObject, stringifyQuery, updateElementStyle }; +export { ACTION_TYPE_ADD_EVENT, ACTION_TYPE_ADD_WXS_EVENT, ACTION_TYPE_CREATE, ACTION_TYPE_EVENT, ACTION_TYPE_INSERT, ACTION_TYPE_PAGE_CREATE, ACTION_TYPE_PAGE_CREATED, ACTION_TYPE_PAGE_SCROLL, ACTION_TYPE_REMOVE, ACTION_TYPE_REMOVE_ATTRIBUTE, ACTION_TYPE_REMOVE_EVENT, ACTION_TYPE_SET_ATTRIBUTE, ACTION_TYPE_SET_TEXT, ATTR_CHANGE_PREFIX, ATTR_CLASS, ATTR_INNER_HTML, ATTR_STYLE, ATTR_TEXT_CONTENT, ATTR_V_OWNER_ID, ATTR_V_RENDERJS, ATTR_V_SHOW, BACKGROUND_COLOR, BUILT_IN_TAGS, BUILT_IN_TAG_NAMES, COMPONENT_NAME_PREFIX, COMPONENT_PREFIX, COMPONENT_SELECTOR_PREFIX, DATA_RE, E$1 as Emitter, EventChannel, EventModifierFlags, I18N_JSON_DELIMITERS, JSON_PROTOCOL, LINEFEED, MINI_PROGRAM_PAGE_RUNTIME_HOOKS, NAVBAR_HEIGHT, NODE_TYPE_COMMENT, NODE_TYPE_ELEMENT, NODE_TYPE_PAGE, NODE_TYPE_TEXT, NVUE_BUILT_IN_TAGS, NVUE_U_BUILT_IN_TAGS, ON_ADD_TO_FAVORITES, ON_APP_ENTER_BACKGROUND, ON_APP_ENTER_FOREGROUND, ON_BACK_PRESS, ON_ERROR, ON_HIDE, ON_INIT, ON_KEYBOARD_HEIGHT_CHANGE, ON_LAUNCH, ON_LOAD, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_CHANGE, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_PAGE_NOT_FOUND, ON_PAGE_SCROLL, ON_PULL_DOWN_REFRESH, ON_REACH_BOTTOM, ON_REACH_BOTTOM_DISTANCE, ON_READY, ON_RESIZE, ON_SAVE_EXIT_STATE, ON_SHARE_APP_MESSAGE, ON_SHARE_TIMELINE, ON_SHOW, ON_TAB_ITEM_TAP, ON_THEME_CHANGE, ON_UNHANDLE_REJECTION, ON_UNLOAD, ON_WEB_INVOKE_APP_SERVICE, ON_WXS_INVOKE_CALL_METHOD, PLUS_RE, PRIMARY_COLOR, RENDERJS_MODULES, RESPONSIVE_MIN_WIDTH, SCHEME_RE, SELECTED_COLOR, SLOT_DEFAULT_NAME, TABBAR_HEIGHT, TAGS, UNI_SSR, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR_STORE, UNI_SSR_TITLE, UNI_STORAGE_LOCALE, UniBaseNode, UniCommentNode, UniElement, UniEvent, UniInputElement, UniLifecycleHooks, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, WXS_MODULES, WXS_PROTOCOL, addFont, addLeadingSlash, cache, cacheStringFunction, callOptions, createIsCustomElement, createRpx2Unit, createUniEvent, customizeEvent, debounce, decode, decodedQuery, defaultMiniProgramRpx2Unit, defaultNVueRpx2Unit, defaultRpx2Unit, dynamicSlotName, forcePatchProp, formatDateTime, formatLog, getCustomDataset, getEnvLocale, getLen, getValueByDataPath, initCustomDatasetOnce, invokeArrayFns, invokeCreateErrorHandler, invokeCreateVueAppHook, isAppNVueNativeTag, isAppNativeTag, isBuiltInComponent, isComponentInternalInstance, isComponentTag, isH5CustomElement, isH5NativeTag, isMiniProgramNativeTag, isRootHook, isRootImmediateHook, normalizeDataset, normalizeEventType, normalizeTarget, onCreateVueApp, once, parseEventName, parseNVueDataset, parseQuery, parseUrl, passive, plusReady, removeLeadingSlash, resolveComponentInstance, resolveOwnerEl, resolveOwnerVm, sanitise, scrollTo, sortObject, stringifyQuery, updateElementStyle }; -- GitLab