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

wip(uts): compiler

上级 44787db0
{"version":3,"sources":["uni_modules/test-component/utssdk/app-android/index.vue"],"sourcesContent":["\n\n\n\n\n\nimport Animator from 'android.animation.Animator'\nimport TextUtils from 'android.text.TextUtils'\nimport View from 'android.view.View'\nimport LottieAnimationView from 'com.airbnb.lottie.LottieAnimationView'\nimport LottieDrawable from 'com.airbnb.lottie.LottieDrawable'\n\n\nclass CustomAnimListener extends Animator.AnimatorListener {\n\n comp: UTSComponent<LottieAnimationView>\n constructor(com: UTSComponent<LottieAnimationView>) {\n super();\n this.comp = com\n }\n\n override onAnimationStart(animation: Animator | null) {\n }\n\n override onAnimationEnd(animation: Animator | null, isReverse: Boolean) {\n this.comp.emit(\"bindended\")\n }\n\n override onAnimationEnd(animation: Animator | null) {\n }\n\n override onAnimationCancel(animation: Animator | null) {\n }\n\n override onAnimationRepeat(animation: Animator | null) {\n }\n}\n\n//原生提供以下属性或方法的实现 \nexport default {\n /**\n * 当播放到末尾时触发 ended 事件(自然播放结束会触发回调,循环播放结束及手动停止动画不会触发)\n */\n emits: ['bindended'],\n props: {\n /**\n * 动画资源地址,目前只支持绝对路径\n */\n \"path\": {\n type: String,\n\t\t\tdefault:\"\"\n },\n /**\n * 动画是否循环播放\n */\n \"autoplay\": {\n type: Boolean,\n\t\t\tdefault:false\n },\n /**\n * 动画是否自动播放\n */\n \"loop\": {\n type: Boolean,\n\t\t\tdefault:false\n },\n /**\n * 是否隐藏动画\n */\n \"hidden\": {\n type: Boolean,\n\t\t\tdefault:false\n },\n /**\n * 动画操作,可取值 play、pause、stop\n */\n \"action\": {\n type: String,\n\t\t\tdefault:\"stop\"\n }\n\n },\n data() {\n return {\n\n }\n },\n watch: {\n \"path\": {\n handler(newPath: string, oldPath: string) {\n\n let lottieAnimationView = this.$el\n\n if (lottieAnimationView != null && !TextUtils.isEmpty(newPath)) {\n if (newPath.startsWith(\"http://\") || newPath.startsWith(\"https://\")) {\n lottieAnimationView.setAnimationFromUrl(newPath)\n } else {\n // 默认是asset了\n lottieAnimationView.setAnimation(newPath)\n }\n }\n if (this.autoplay) {\n lottieAnimationView.playAnimation()\n }\n },\n immediate: false //创建时是否通过此方法更新属性,默认值为false \n },\n \"loop\": {\n handler(newLoop: Boolean, oldLoop: Boolean) {\n\n if (newLoop) {\n this.$el.repeatCount = Int.MAX_VALUE\n } else {\n // 不循环则设置成1次\n this.$el.repeatCount = 0\n }\n\n if (this.autoplay) {\n this.$el.playAnimation()\n }\n },\n immediate: false //创建时是否通过此方法更新属性,默认值为false \n },\n\n \"autoplay\": {\n handler(newValue: boolean, oldValue: boolean) {\n\n if (newValue) {\n this.$el.playAnimation()\n }\n },\n immediate: false //创建时是否通过此方法更新属性,默认值为false \n },\n\n \"action\": {\n handler(newAction: string, oldAction: string) {\n\n if (newAction == \"play\" || newAction == \"pause\" || newAction == \"stop\") {\n\n\n if (this.action == \"play\") {\n this.$el.playAnimation()\n } else if (this.action == \"play\") {\n this.$el.pauseAnimation()\n } else if (this.action == \"stop\") {\n this.$el.cancelAnimation()\n this.$el.clearAnimation()\n }\n\n } else {\n // 非法入参,不管\n }\n },\n immediate: false //创建时是否通过此方法更新属性,默认值为false \n },\n\n \"hidden\": {\n handler(newValue: boolean, oldValue: boolean) {\n\n if (newValue) {\n this.$el.visibility = View.GONE\n } else {\n this.$el.visibility = View.VISIBLE\n }\n },\n immediate: false //创建时是否通过此方法更新属性,默认值为false \n },\n\n },\n methods: {\n setRepeatMode(repeat: string) {\n if (\"RESTART\" == repeat) {\n this.$el.repeatMode = LottieDrawable.RESTART\n } else if (\"REVERSE\" == repeat) {\n this.$el.repeatMode = LottieDrawable.RESTART\n }\n },\n privateMethod() {\t//如何定义不对外暴露的API? 暂不支持,需在export外写 \n }\n },\n created() {\t\t\t//创建组件,替换created \n\n },\n NVBeforeLoad() {\t\t//组件将要创建,对应前端beforeMount \n //可选实现,这里可以提前做一些操作 \n },\n NVLoad(): LottieAnimationView { //创建原生View,必须定义返回值类型(Android需要明确知道View类型,需特殊校验) \n //必须实现 \n let lottieAnimationView = new LottieAnimationView(getContext())\n return lottieAnimationView\n },\n NVLoaded() {\t\t\t//原生View已创建 \n //可选实现,这里可以做后续操作 \n this.$el.repeatMode = LottieDrawable.RESTART;\n this.$el.visibility = View.GONE\n this.$el.repeatCount = 0\n this.$el.addAnimatorListener(new CustomAnimListener(this))\n\n },\n NVLayouted() {\t//原生View布局完成 \n //可选实现,这里可以做布局后续操作 \n },\n NVBeforeUnload() {\t\t//原生View将释放 \n //可选实现,这里可以做释放View之前的操作 \n },\n NVUnloaded() {\t\t\t//原生View已释放 \n //可选实现,这里可以做释放View之后的操作 \n },\n NVMeasure(size: UTSSize): UTSSize {\n return UTSSize(100, 100)\n },\n unmounted() {\t//组件销毁 \n //可选实现 \n }\n}\n\n\n\n\n\n\n\n\n"],"names":[],"mappings":";;;;;;;;;AAMA,OAAqB,0BAA4B,CAAA;;AAGjD,OAAgC,qCAAuC,CAAA;AACvE,OAA2B,gCAAkC,CAAA;AAH7D,OAAsB,sBAAwB,CAAA;;;;AAC9C,OAAiB,iBAAmB,CAAA;;AAKpC,WAAM,qBAA2B,SAAS,gBAAgB;IAEtD,SAAA,MAAM,aAAa,qBAAoB;IACvC,YAAY,KAAK,aAAa,oBAAoB,IAC9C,KAAK,GAD2C;QAEhD,IAAI,CAAC,IAAI,GAAG;IAChB;IAEA,aAAS,iBAAiB,WAAW,SAAe,EAAE,CACtD;IAEA,aAAS,eAAe,WAAW,SAAe,EAAE,WAAW,OAAO,EAAE;QACpE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACnB;IAEA,aAAS,eAAe,WAAW,SAAe,EAAE,CACpD;IAEA,aAAS,kBAAkB,WAAW,SAAe,EAAE,CACvD;IAEA,aAAS,kBAAkB,WAAW,SAAe,EAAE,CACvD;AACJ;iDAsJc;;4BAxIH;iCAOA,KAAK;6BAOL,KAAK;+BAOL,KAAK;8BAOL;2BAsGG,CAEV;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EAAE;gBACf,IAAI,CAAC,KAAG,CAAC,aAAa;YAC1B;QACJ;;sBAKqC,OAAO,kBAApC,UAAmB,SAAmB;YAE1C,IAAI,UAAU;gBACV,IAAI,CAAC,KAAG,CAAC,aAAa;YAC1B;QACJ;;sBAKsC,MAAM,gBAApC,WAAmB,UAAmB;YAE1C,IAAI,aAAa,UAAU,aAAa,WAAW,aAAa,QAAQ;gBAGpE,IAAI,IAAI,CAAC,MAAM,IAAI,QAAQ;oBACvB,IAAI,CAAC,KAAG,CAAC,aAAa;gBAC1B,OAAO,IAAI,IAAI,CAAC,MAAM,IAAI,QAAQ;oBAC9B,IAAI,CAAC,KAAG,CAAC,cAAc;gBAC3B,OAAO,IAAI,IAAI,CAAC,MAAM,IAAI,QAAQ;oBAC9B,IAAI,CAAC,KAAG,CAAC,eAAe;oBACxB,IAAI,CAAC,KAAG,CAAC,cAAc;gBAC3B;YAEJ;QAGJ;;sBAKqC,OAAO,gBAApC,UAAmB,SAAmB;YAE1C,IAAI,UAAU;gBACV,IAAI,CAAC,KAAG,CAAC,UAAU,GAAG,KAAK,IAAI;YACnC,OAAO;gBACH,IAAI,CAAC,KAAG,CAAC,UAAU,GAAG,KAAK,OAAO;YACtC;QACJ"}
\ No newline at end of file
{"version":3,"sources":["uni_modules/test-component/utssdk/app-android/index.vue"],"sourcesContent":["\n\n\n\n\n\nimport Animator from 'android.animation.Animator'\nimport TextUtils from 'android.text.TextUtils'\nimport View from 'android.view.View'\nimport LottieAnimationView from 'com.airbnb.lottie.LottieAnimationView'\nimport LottieDrawable from 'com.airbnb.lottie.LottieDrawable'\n\n\nclass CustomAnimListener extends Animator.AnimatorListener {\n\n comp: UTSComponent<LottieAnimationView>\n constructor(com: UTSComponent<LottieAnimationView>) {\n super();\n this.comp = com\n }\n\n override onAnimationStart(animation: Animator | null) {\n }\n\n override onAnimationEnd(animation: Animator | null, isReverse: Boolean) {\n this.comp.emit(\"bindended\")\n }\n\n override onAnimationEnd(animation: Animator | null) {\n }\n\n override onAnimationCancel(animation: Animator | null) {\n }\n\n override onAnimationRepeat(animation: Animator | null) {\n }\n}\n\n//原生提供以下属性或方法的实现 \nexport default {\n /**\n * 当播放到末尾时触发 ended 事件(自然播放结束会触发回调,循环播放结束及手动停止动画不会触发)\n */\n emits: ['bindended'],\n props: {\n /**\n * 动画资源地址,目前只支持绝对路径\n */\n \"path\": {\n type: String,\n\t\t\tdefault:\"\"\n },\n /**\n * 动画是否循环播放\n */\n \"autoplay\": {\n type: Boolean,\n\t\t\tdefault:false\n },\n /**\n * 动画是否自动播放\n */\n \"loop\": {\n type: Boolean,\n\t\t\tdefault:false\n },\n /**\n * 是否隐藏动画\n */\n \"hidden\": {\n type: Boolean,\n\t\t\tdefault:false\n },\n /**\n * 动画操作,可取值 play、pause、stop\n */\n \"action\": {\n type: String,\n\t\t\tdefault:\"stop\"\n }\n\n },\n data() {\n return {\n\n }\n },\n watch: {\n \"path\": {\n handler(newPath: string, oldPath: string) {\n\n let lottieAnimationView = this.$el\n\n if (lottieAnimationView != null && !TextUtils.isEmpty(newPath)) {\n if (newPath.startsWith(\"http://\") || newPath.startsWith(\"https://\")) {\n lottieAnimationView.setAnimationFromUrl(newPath)\n } else {\n // 默认是asset了\n lottieAnimationView.setAnimation(newPath)\n }\n }\n if (this.autoplay) {\n lottieAnimationView.playAnimation()\n }\n },\n immediate: false //创建时是否通过此方法更新属性,默认值为false \n },\n \"loop\": {\n handler(newLoop: Boolean, oldLoop: Boolean) {\n\n if (newLoop) {\n this.$el.repeatCount = Int.MAX_VALUE\n } else {\n // 不循环则设置成1次\n this.$el.repeatCount = 0\n }\n\n if (this.autoplay) {\n this.$el.playAnimation()\n }\n },\n immediate: false //创建时是否通过此方法更新属性,默认值为false \n },\n\n \"autoplay\": {\n handler(newValue: boolean, oldValue: boolean) {\n\n if (newValue) {\n this.$el.playAnimation()\n }\n },\n immediate: false //创建时是否通过此方法更新属性,默认值为false \n },\n\n \"action\": {\n handler(newAction: string, oldAction: string) {\n\n if (newAction == \"play\" || newAction == \"pause\" || newAction == \"stop\") {\n\n\n if (this.action == \"play\") {\n this.$el.playAnimation()\n } else if (this.action == \"play\") {\n this.$el.pauseAnimation()\n } else if (this.action == \"stop\") {\n this.$el.cancelAnimation()\n this.$el.clearAnimation()\n }\n\n } else {\n // 非法入参,不管\n }\n },\n immediate: false //创建时是否通过此方法更新属性,默认值为false \n },\n\n \"hidden\": {\n handler(newValue: boolean, oldValue: boolean) {\n\n if (newValue) {\n this.$el.visibility = View.GONE\n } else {\n this.$el.visibility = View.VISIBLE\n }\n },\n immediate: false //创建时是否通过此方法更新属性,默认值为false \n },\n\n },\n methods: {\n setRepeatMode(repeat: string) {\n if (\"RESTART\" == repeat) {\n this.$el.repeatMode = LottieDrawable.RESTART\n } else if (\"REVERSE\" == repeat) {\n this.$el.repeatMode = LottieDrawable.RESTART\n }\n },\n privateMethod() {\t//如何定义不对外暴露的API? 暂不支持,需在export外写 \n }\n },\n created() {\t\t\t//创建组件,替换created \n\n },\n NVBeforeLoad() {\t\t//组件将要创建,对应前端beforeMount \n //可选实现,这里可以提前做一些操作 \n },\n NVLoad(): LottieAnimationView { //创建原生View,必须定义返回值类型(Android需要明确知道View类型,需特殊校验) \n //必须实现 \n let lottieAnimationView = new LottieAnimationView(getContext())\n return lottieAnimationView\n },\n NVLoaded() {\t\t\t//原生View已创建 \n //可选实现,这里可以做后续操作 \n this.$el.repeatMode = LottieDrawable.RESTART;\n this.$el.visibility = View.GONE\n this.$el.repeatCount = 0\n this.$el.addAnimatorListener(new CustomAnimListener(this))\n\n },\n NVLayouted() {\t//原生View布局完成 \n //可选实现,这里可以做布局后续操作 \n },\n NVBeforeUnload() {\t\t//原生View将释放 \n //可选实现,这里可以做释放View之前的操作 \n },\n NVUnloaded() {\t\t\t//原生View已释放 \n //可选实现,这里可以做释放View之后的操作 \n },\n NVMeasure(size: UTSSize): UTSSize {\n return UTSSize(100, 100)\n },\n unmounted() {\t//组件销毁 \n //可选实现 \n }\n}\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xB,IAAI,CAAC,KAAG,CAAC,cAAc;gBAC3B;YAEJ;QAGJ;;sBAKqC,OAAO,gBAApC,UAAmB,SAAmB;YAE1C,IAAI,UAAU;gBACV,IAAI,CAAC,KAAG,CAAC,UAAU,GAAG,KAAK,IAAI;YACnC,OAAO;gBACH,IAAI,CAAC,KAAG,CAAC,UAAU,GAAG,KAAK,OAAO;YACtC;QACJ"}
\ No newline at end of file
{"version":3,"sources":["uni_modules/test-uniplugin/utssdk/app-android/index.uts","uni_modules/test-uniplugin/utssdk/app-android/utils.uts","uni_modules/test-uniplugin/utssdk/app-android/login.uts","uni_modules/test-uniplugin/utssdk/app-android/interface.uts","uni_modules/test-uniplugin/static/logo.png","uni_modules/test-uniplugin/utssdk/interface.uts","uni_modules/test-component/utssdk/app-android/index.uts"],"sourcesContent":["import Log from 'android.util.Log'\nimport FrameLayout from 'android.widget.FrameLayout'\nimport View from 'android.view.View'\nimport { login } from 'login'\nimport { IUser } from './interface'\nimport logo from '../../static/logo.png'\nimport { ShowToast } from '../interface.uts'\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 for (let i = 0; i < 10; i++) {\n console.log(i)\n }\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 const a = -3\n console.log(~a)\n new XToast<XToast<unknown>>(getUniActivity())\n .setContentView(R.layout.toast_hint)\n .setDuration(1000)\n .setImageDrawable(android.R.id.icon, R.mipmap.ic_dialog_tip_finish)\n .setText(android.R.id.message, '点我消失')\n .show()\n }\n register(name: string, callback: () => void) {\n Log.info(logo as FrameLayout)\n }\n test(view: View) {\n console.log(new TestClass())\n }\n}\nfunction login(name: string, callback: () => void) { }\n\n@Suppress(\"DEPRECATION\")\n export function register(name: string, callback: () => void) { }\nexport function offMemoryWarning(\n callback: null | ((level: number) => void) = null\n) {\n uni.showToast()\n uni.showToast()\n uni.showModel()\n}\nclass TestClass {\n\n}\nexport const showToast1: ShowToast = (msg) => { }\nexport const showToast2: ShowToast = function (msg) { }\nexport const showToast3: ShowToast = function showToast(msg) { }\n","export function test(){\n console.log('test')\n}\n","import { test } from \"./utils.uts\"\nexport function login(name: string, pwd: string) {\n console.log('login')\n test()\n return { name, pwd }\n}\n","export interface IUser {\n register(name: string): void\n}\n","export default UTSAndroid.getResourcePath('uni_modules/test-uniplugin/static/logo.png')","export type ShowToast = (msg: string) => void\n","export { default as AnimationViewComponent } from './index.vue'"],"names":[],"mappings":";;;;;;;AACA,OAAwB,0BAA4B,CAAA;AADpD,OAAgB,gBAAkB,CAAA;AAElC,OAAiB,iBAAmB,CAAA;;;ACF7B,IAAS,OAAM;IAClB,QAAQ,GAAG,CAAC;AAChB;ACDO,IAAS,MAAM,MAAM,MAAM,EAAE,KAAK,MAAM,iBAAE;IAC/C,QAAQ,GAAG,CAAC;IACZ;IACA,OAAO;QAAE,IAAA,OAAA;QAAM,IAAA,MAAA;KAAK;AACtB;UCLiB;QACf,SAAS,MAAM,MAAM,GAAG,IAAI;;gBCDf,WAAW,eAAe,CAAC;UCA9B,aAAa,KAAK,MAAM,KAAK,IAAI;ALQ7C,IAAM,QAAO,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AAOrB,WAAM;IACX,SAAM,MAAM,MAAM,MAAM,EAAE,KAAK,MAAM,EAAE;QACrC,WAAW,KAAM;YACf,QAAQ,GAAG,CAAC;QACd;UAAG,IAAI;QACP,wCAAM,MAAM;YACZ;YAAK,IAAI,YAAI,CAAC;YAAd,MAAgB,IAAI,EAAE;gBACpB,QAAQ,GAAG,CAAC;gBADU;;QAExB;QACA,IAAI,IAAI;QAER,QAAQ,GAAG,CAAC;QASZ,QAAQ,GAAG,CAA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KAAK,MAAM,GAAK,IAAI;sBAApB"}
\ No newline at end of file
{"version":3,"sources":["uni_modules/test-uniplugin/utssdk/app-android/index.uts","uni_modules/test-uniplugin/utssdk/app-android/utils.uts","uni_modules/test-uniplugin/utssdk/app-android/login.uts","uni_modules/test-uniplugin/utssdk/app-android/interface.uts","uni_modules/test-uniplugin/static/logo.png","uni_modules/test-uniplugin/utssdk/interface.uts","uni_modules/test-component/utssdk/app-android/index.uts"],"sourcesContent":["import Log from 'android.util.Log'\nimport FrameLayout from 'android.widget.FrameLayout'\nimport View from 'android.view.View'\nimport { login } from 'login'\nimport { IUser } from './interface'\nimport logo from '../../static/logo.png'\nimport { ShowToast } from '../interface.uts'\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 for (let i = 0; i < 10; i++) {\n console.log(i)\n }\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 const a = -3\n console.log(~a)\n new XToast<XToast<unknown>>(getUniActivity())\n .setContentView(R.layout.toast_hint)\n .setDuration(1000)\n .setImageDrawable(android.R.id.icon, R.mipmap.ic_dialog_tip_finish)\n .setText(android.R.id.message, '点我消失')\n .show()\n }\n register(name: string, callback: () => void) {\n Log.info(logo as FrameLayout)\n }\n test(view: View) {\n console.log(new TestClass())\n }\n}\nfunction login(name: string, callback: () => void) { }\n\n@Suppress(\"DEPRECATION\")\n export function register(name: string, callback: () => void) { }\nexport function offMemoryWarning(\n callback: null | ((level: number) => void) = null\n) {\n uni.showToast()\n uni.showToast()\n uni.showModel()\n}\nclass TestClass {\n\n}\nexport const showToast1: ShowToast = (msg) => { }\nexport const showToast2: ShowToast = function (msg) { }\nexport const showToast3: ShowToast = function showToast(msg) { }\n","export function test(){\n console.log('test')\n}\n","import { test } from \"./utils.uts\"\nexport function login(name: string, pwd: string) {\n console.log('login')\n test()\n return { name, pwd }\n}\n","export interface IUser {\n register(name: string): void\n}\n","export default UTSAndroid.getResourcePath('uni_modules/test-uniplugin/static/logo.png')","export type ShowToast = (msg: string) => void\n","export { default as AnimationViewComponent } from './index.vue'"],"names":[],"mappings":";;;;;;;AACA,OAAwB,0BAA4B,CAAA;AADpD,OAAgB,gBAAkB,CAAA;AAElC,OAAiB,iBAAmB,CAAA;;;ACF7B,IAAS,OAAM;IAClB,QAAQ,GAAG,CAAC;AAChB;ACDO,IAAS,MAAM,MAAM,MAAM,EAAE,KAAK,MAAM,iBAAE;IAC/C,QAAQ,GAAG,CAAC;IACZ;IACA,OAAO;QAAE,IAAA,OAAA;QAAM,IAAA,MAAA;KAAK;AACtB;UCLiB;QACf,SAAS,MAAM,MAAM,GAAG,IAAI;;gBCDf,WAAW,eAAe,CAAC;UCA9B,aAAa,KAAK,MAAM,KAAK,IAAI;ALQ7C,IAAM,QAAO,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AAOrB,WAAM;IACX,SAAM,MAAM,MAAM,MAAM,EAAE,KAAK,MAAM,GAAE,WAAA,IAmCtC,EAnCsC;QAAA,YAAA,SAAA,IAmCtC,CAnCsC;YACrC,WAAW,KAAM;gBACf,QAAQ,GAAG,CAAC;YACd;cAAG,IAAI;YACP,wCAAM,MAAM;gBACZ;gBAAK,IAAI,YAAI,CAAC;gBAAd,MAAgB,IAAI,EAAE;oBACpB,QAAQ,GAAG,CAAC;oBADU;;YAExB;YACA,IAAI,IAAI;YAER,QAAQ,GAAG,CAAC;YASZ,QAAQ,GAAG,CAAC;YAGZ,QAAQ,GAAG,CAAC;YAKZ,IAAM,YAAI,EAAE;YACZ,QAAQ,GAAG,CAAC,AAAC,KAAC;YACV,OAAO,OAAO,CAAO,GAAG,kBACzB,cAAc,CAAC,EAAE,MAAM,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;;;yBAEvC,yBAA6C,IAAI;gCAA9B,OAAO,MAAM;QAAhC,iBAAmB;;;;mBKhEI,KAAK,MAAM,GAAK,IAAI;sBAApB;;mBAAA,KAAK,MAAM,GAAK,IAAI;sBAApB;;mBAAA,KAAK,MAAM,GAAK,IAAI;sBAApB"}
\ No newline at end of file
{"version":3,"sources":["utssdk/test-uts/app-android/index.uts"],"sourcesContent":["export function test(): number {\n return 1\n}\n"],"names":[],"mappings":";;;;;;;AAAO,IAAS,QAAQ,MAAM,CAAC;IAC7B,OAAO,CAAC;AACV;gBAFwB,MAAM"}
\ No newline at end of file
{"version":3,"sources":["utssdk/test-uts/app-android/index.uts"],"sourcesContent":["export function test(): number {\n return 1\n}\n"],"names":[],"mappings":";;;;;;AAAO,IAAS,QAAQ,MAAM,CAAC;IAC7B,OAAO,CAAC;AACV;gBAFwB,MAAM"}
\ No newline at end of file
......@@ -4,7 +4,6 @@ import io.dcloud.uts.Map;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.Deferred;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.async;
import io.dcloud.feature.uniapp.ui.action.AbsComponentData;
import io.dcloud.feature.uniapp.ui.component.AbsVContainer;
import android.animation.Animator;
......
......@@ -28,26 +28,41 @@ val `default` = UTSAndroid.getResourcePath("uni_modules/test-uniplugin/static/lo
typealias ShowToast = (msg: String) -> Unit;
val test1 = arrayOf(1, 2, 3);
open class User : IUser {
open fun login(name: String, pwd: String) {
setTimeout(fun(){
console.log("timeout", " at uni_modules/test-uniplugin/utssdk/app-android/index.uts:19");
open fun login(name: String, pwd: String): UTSPromise<Unit> {
suspend fun async(): Unit {
setTimeout(fun(){
console.log("timeout", " at uni_modules/test-uniplugin/utssdk/app-android/index.uts:19");
}
, 1000);
uts.modules.modules.testUniPlugin.login(name, pwd);
run {
var i: Number = 0;
while(i < 10){
console.log(i, " at uni_modules/test-uniplugin/utssdk/app-android/index.uts:23");
i++;
}
}
Log.info(`default`);
console.log("def android", " at uni_modules/test-uniplugin/utssdk/app-android/index.uts:27");
console.log("ndef ios", " at uni_modules/test-uniplugin/utssdk/app-android/index.uts:36");
console.log("def android || def ios", " at uni_modules/test-uniplugin/utssdk/app-android/index.uts:39");
val a: Number = -3;
console.log(a.inv(), " at uni_modules/test-uniplugin/utssdk/app-android/index.uts:45");
XToast<XToast<*>>(getUniActivity()).setContentView(R.layout.toast_hint).setDuration(1000).setImageDrawable(android.R.id.icon, R.mipmap.ic_dialog_tip_finish).setText(android.R.id.message, "点我消失").show();
}
, 1000);
uts.modules.modules.testUniPlugin.login(name, pwd);
run {
var i: Number = 0;
while(i < 10){
console.log(i, " at uni_modules/test-uniplugin/utssdk/app-android/index.uts:23");
i++;
return UTSPromise(fun(resolve, reject) {
kotlinx.coroutines.CoroutineScope(kotlinx.coroutines.Dispatchers.Default).async {
try {
val result = async();
resolve(result);
}
catch (e: Throwable) {
reject(e);
}
}
;
}
Log.info(`default`);
console.log("def android", " at uni_modules/test-uniplugin/utssdk/app-android/index.uts:27");
console.log("ndef ios", " at uni_modules/test-uniplugin/utssdk/app-android/index.uts:36");
console.log("def android || def ios", " at uni_modules/test-uniplugin/utssdk/app-android/index.uts:39");
val a: Number = -3;
console.log(a.inv(), " at uni_modules/test-uniplugin/utssdk/app-android/index.uts:45");
XToast<XToast<*>>(getUniActivity()).setContentView(R.layout.toast_hint).setDuration(1000).setImageDrawable(android.R.id.icon, R.mipmap.ic_dialog_tip_finish).setText(android.R.id.message, "点我消失").show();
);
}
override fun register(name: String, callback: () -> Unit) {
Log.info(`default` as FrameLayout);
......
......@@ -4,7 +4,6 @@ import io.dcloud.uts.Map;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.Deferred;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.async;
fun test(): Number {
return 1;
}
......
......@@ -10,11 +10,11 @@ import {
formatAtFilename,
generateCodeFrame,
insertBeforePlugin,
normalizePath,
parseVueRequest,
resolveMainPathOnce,
parseAssets,
preUVueCss,
normalizeNodeModules,
} from '@dcloudio/uni-cli-shared'
import { parse } from '@dcloudio/uni-nvue-styler'
......@@ -39,7 +39,7 @@ export function uniAppCssPlugin(): Plugin {
}
const { filename } = parseVueRequest(id)
if (isVue(filename)) {
return normalizePath(
return normalizeNodeModules(
path.relative(process.env.UNI_INPUT_DIR, filename) + '.style.uts'
)
}
......
......@@ -105,6 +105,21 @@ export function uniAppUTSPlugin(): UniVitePlugin {
}
return false
},
output: {
chunkFileNames(chunk) {
// if (chunk.isDynamicEntry && chunk.facadeModuleId) {
// const { filename } = parseVueRequest(chunk.facadeModuleId)
// if (filename.endsWith('.nvue')) {
// return (
// removeExt(
// normalizePath(path.relative(inputDir, filename))
// ) + '.js'
// )
// }
// }
return '[name].js'
},
},
},
},
}
......
......@@ -62,7 +62,14 @@ export function uvueOutDir() {
export function genClassName(fileName: string, prefix: string = 'Gen') {
return (
prefix +
capitalize(camelize(removeExt(normalizePath(fileName).replace(/\//g, '-'))))
capitalize(
camelize(
removeExt(normalizeNodeModules(fileName).replace(/\//g, '-')).replace(
/@/g, // node-modules/@dcloudio/....
''
)
)
)
)
}
......
......@@ -65,7 +65,7 @@ const initUniCloudWarningOnce = (0, uni_shared_1.once)(() => {
console.warn('当前项目使用了uniCloud,为避免云函数调用跨域问题,建议在HBuilderX内置浏览器里调试,如使用外部浏览器需处理跨域,详见:https://uniapp.dcloud.net.cn/uniCloud/publish.html#useinh5');
});
function checkProjectUniCloudDir() {
return !!(0, fast_glob_1.sync)(['uniCloud-aliyun', 'uniCloud-tcb'], {
return !!(0, fast_glob_1.sync)(['uniCloud-aliyun', 'uniCloud-tcb', 'uniCloud-alipay'], {
cwd: (0, uni_cli_shared_1.isInHBuilderX)()
? process.env.UNI_INPUT_DIR
: process.env.UNI_CLI_CONTEXT,
......@@ -86,7 +86,7 @@ function checkUniModules() {
if (!checkProjectUniCloudDir()) {
const uniCloudModules = resolveUniCloudModules();
if (uniCloudModules.length) {
console.warn(`${uniCloudModules.join(', ')} 使用了uniCloud,而项目未启uniCloud。需在项目点右键创建uniCloud环境`);
console.warn(`${uniCloudModules.join(', ')} 使用了uniCloud,而项目未启uniCloud。需在项目点右键创建uniCloud环境`);
}
}
}
......
<template>
<uni-cloud-db-element>
123123123
</uni-cloud-db-element>
</template>
<script lang="ts">
class UniCloudDBElement extends UniViewElement {
constructor(data: INodeData, pageNode: PageNode) {
super(data, pageNode)
}
test(): string {
return "test"
}
}
export default {
name: 'UniCloudDB',
rootElement: {
name: "uni-cloud-db-element",
class: UniCloudDBElement
}
}
</script>
......@@ -5,7 +5,8 @@
"main": "index.js",
"files": [
"style",
"lib"
"lib",
"lib-x"
],
"repository": {
"type": "git",
......
......@@ -180,7 +180,7 @@ const customElements = [
'mkt',
'page-container',
'page-meta',
'lottie'
'lottie',
];
const options = {
cdn: 2,
......
......@@ -68,6 +68,10 @@ const customElements = [
'pay-button',
'rate-button',
'member-button',
'confirm-receipt-button',
'live-preview',
'aweme-live-book',
'aweme-user-card',
];
const projectConfigFilename = 'project.config.json';
const nodeTransforms = [
......
......@@ -119,6 +119,7 @@ const UVUE_BUILT_IN_TAGS = [
'swiper-item',
'rich-text',
'sticky-view',
'sticky-header',
// 自定义
'uni-slider',
];
......@@ -174,6 +175,10 @@ const NVUE_CUSTOM_COMPONENTS = [
'picker-view-column',
];
function isAppUVueNativeTag(tag) {
// 前端实现的内置组件都会注册一个根组件
if (tag.startsWith('uni-') && tag.endsWith('-element')) {
return true;
}
if (UVUE_BUILT_IN_TAGS.includes(tag)) {
return true;
}
......
......@@ -117,6 +117,7 @@ const UVUE_BUILT_IN_TAGS = [
'swiper-item',
'rich-text',
'sticky-view',
'sticky-header',
// 自定义
'uni-slider',
];
......@@ -172,6 +173,10 @@ const NVUE_CUSTOM_COMPONENTS = [
'picker-view-column',
];
function isAppUVueNativeTag(tag) {
// 前端实现的内置组件都会注册一个根组件
if (tag.startsWith('uni-') && tag.endsWith('-element')) {
return true;
}
if (UVUE_BUILT_IN_TAGS.includes(tag)) {
return true;
}
......
......@@ -186,6 +186,10 @@ const NVUE_CUSTOM_COMPONENTS = [
]
export function isAppUVueNativeTag(tag: string) {
// 前端实现的内置组件都会注册一个根组件
if (tag.startsWith('uni-') && tag.endsWith('-element')) {
return true
}
if (UVUE_BUILT_IN_TAGS.includes(tag)) {
return true
}
......
......@@ -171,7 +171,7 @@ describe('uts:sourceMap', () => {
const originalPosition = await originalPositionFor({
sourceMapFile,
line: 68,
line: 83,
column: 0,
withSourceContent: true,
})
......
......@@ -101,13 +101,21 @@ export async function genProxyCode(
// 自动补充 VideoElement 导出
if (options.androidComponents) {
Object.keys(options.androidComponents).forEach((name) => {
options.meta!.types[capitalize(camelize(name)) + 'Element'] = 'class'
options.meta!.types[
(process.env.UNI_UTS_MODULE_PREFIX ? 'Uni' : '') +
capitalize(camelize(name)) +
'Element'
] = 'class'
components.add(name)
})
}
if (options.iosComponents) {
Object.keys(options.iosComponents).forEach((name) => {
options.meta!.types[capitalize(camelize(name)) + 'Element'] = 'class'
options.meta!.types[
(process.env.UNI_UTS_MODULE_PREFIX ? 'Uni' : '') +
capitalize(camelize(name)) +
'Element'
] = 'class'
components.add(name)
})
}
......
......@@ -310,7 +310,9 @@ export function genComponentsCode(
const className = capitalize(camelize(name))
codes.push(
`export { default as ${className}Component${
isX ? `, ${className}Element` : ''
isX
? `, ${process.env.UNI_UTS_MODULE_PREFIX ? 'Uni' : className}Element`
: ''
} } from '${source.startsWith('.') ? source : './' + source}'`
)
})
......
......@@ -23,7 +23,6 @@ parse(
})
const kotlinImports = [
'kotlinx.coroutines.async',
'kotlinx.coroutines.CoroutineScope',
'kotlinx.coroutines.Deferred',
'kotlinx.coroutines.Dispatchers',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册