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

wip(uts): compiler

上级 7b8f051f
{"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;QACf,SAAS,MAAM,MAAM,GAAG,IAAI;;ACDvB,IAAS,MAAM,MAAM,MAAM,EAAE,KAAK,MAAM,iBAAE;IAC/C,QAAQ,GAAG,CAAC;IACZ,OAAO;QAAE,IAAA,OAAA;QAAM,IAAA,MAAA;KAAK;AACtB;cHFe,gBAAgB;ACM/B,IAAM,OAAO,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AAEC,WAAxB;IACH,SAAA,SAAQ,oBAA8B;IACtC,SAAA,MAAK,oBAA8B;IACnC,SAAA,UAAS,oBAA8B;AACzC;AACO,WAAM,OAAgB;IAC3B,iBAAM,MAAM,MAAM,MAAM,EAAE,KAAK,MAAM,8CAAE;QACrC,WAAW,KAAM;YACf,QAAQ,GAAG,CAAC;QACd;UAAG,IAAI;QACP,MAAM,MAAM;QACZ,IAAI,IAAI;QAER,QAAQ,GAAG,CAAC;QASZ,QAAQ,GAAG,CAAC;QAGZ,QAAQ,GAAG,CAAC;IAKd;IACA,aAAA,SAAS,MAAM,MAAM,EAAE,qBAAoB,EAAE;QAC3C,IAAI,IAAI,YAAS;IACnB;IACA,SAAA,KAAK,MAAM,IAAI,EAAE,CAAC;AACpB;AACA,UAAe,MAAM,MAAM,EAAE,gBAAgB,IAAI,EAAE,CAAC;AAC7C,IAAS,SAAS,MAAM,MAAM,EAAE,qBAAoB,EAAE,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;QACf,SAAS,MAAM,MAAM,GAAG,IAAI;;ACDvB,IAAS,MAAM,MAAM,MAAM,EAAE,KAAK,MAAM,iBAAE;IAC/C,QAAQ,GAAG,CAAC;IACZ,OAAO;QAAE,IAAA,OAAA;QAAM,IAAA,MAAA;KAAK;AACtB;cHFe,gBAAgB;ACM/B,IAAM,OAAO,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AAEC,WAAxB;IACH,SAAA,SAAQ,oBAA8B;IACtC,SAAA,MAAK,oBAA8B;IACnC,SAAA,UAAS,oBAA8B;AACzC;AACO,WAAM,OAAgB;IAC3B,iBAAM,MAAM,MAAM,MAAM,EAAE,KAAK,MAAM,8CAAE;QACrC,WAAW,KAAM;YACf,QAAQ,GAAG,CAAC;QACd;UAAG,IAAI;QACP,MAAM,MAAM;QACZ,IAAI,IAAI;QAER,QAAQ,GAAG,CAAC;QASZ,QAAQ,GAAG,CAAC;QAGZ,QAAQ,GAAG,CAAC;IAKd;IACA,aAAA,SAAS,MAAM,MAAM,EAAE,qBAAoB,EAAE;QAC3C,IAAI,IAAI,YAAS;IACnB;IACA,SAAA,KAAK,MAAM,IAAI,EAAE,CAAC;AACpB;AACA,UAAe,MAAM,MAAM,EAAE,gBAAgB,IAAI,EAAE,CAAC;AAC7C,IAAS,SAAS,MAAM,MAAM,EAAE,qBAAoB,EAAE,CAAC"}
\ No newline at end of file
{"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'\nimport { CLLocationManager, CLAuthorizationStatus } from 'CoreLocation'\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 console.log(CLLocationManager, CLAuthorizationStatus)\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;AACA;AAE6B;;MAAxB;IACH,WAAA,MAAM,MAAM,EAAA;IACZ,WAAA,KAAK,QAAM,EAAA;IACX,WAAA,SAAQ,aAA8B;IACtC,WAAA,MAAK,aAA8B;IACnC,WAAA,UAAS,aAA8B;AACzC;AAEe,KAAS,eAAe,EAAA,SAAS,qBAAqB,EAAE;IACrE,IAAM,MAAM;QACV,CAAA,SAAQ;QACR,CAAA,QAAO,SAAS,OAAO,CAAC,YAAY,GAAG,GAAG;QAC1C,CAAA,aAAY,SAAS,OAAO,CAAC,YAAY,IAAI,SAAS,YAAY,CAAC,QAAQ;MAC5E;IACD,IAAI,QAAQ,OAAO,IAAI,GAAI;QACzB,QAAQ,OAAO,EAAE;;IAEnB,IAAI,QAAQ,QAAQ,IAAI,GAAI;QAC1B,QAAQ,QAAQ,EAAE;;AAEtB;AAEO,KAAS,MAAM,EAAA,qBAAoB,KAAG,MAAM,CAAC;IAClD,QAAQ,GAAG,CAAC;IAKZ,QAAQ,GAAG,CAAC;IAGZ,QAAQ,GAAG,CAAC;IAMZ,QAAQ,GAAG,CAAC;IAKZ,QAAQ,GAAG,CAAC,mBAAmB;IAC/B,OAAO;AACT;AAEA,MAAM;AAAO;AACN;;MAAM;IACX,aAAc;QACR;IACN;IACA,YAAA,UAAQ,MAAM,EAAQ;QACpB,OAAO,GAAI;IACb;AACF;AAEO;KAAe,oCAAY;IAChC,OAAO;QAAE,CAAA,IAAG,CAAC;MAAE;AACjB;;;;wCAlDuC,EAAA,SAAS,qBAAqB;eAA7C,eAAe;;+BAcjB,EAAA,qBAAoB,KAAG,MAAM;eAAnC,MAAM;;;;qBAkCA"}
\ 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'\nimport { CLLocationManager, CLAuthorizationStatus } from 'CoreLocation'\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 console.log(CLLocationManager, CLAuthorizationStatus)\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;AACA;AAE6B;;MAAxB;IACH,WAAA,MAAM,MAAM,EAAA;IACZ,WAAA,KAAK,QAAM,EAAA;IACX,WAAA,SAAQ,aAA8B;IACtC,WAAA,MAAK,aAA8B;IACnC,WAAA,UAAS,aAA8B;AACzC;AAEe,KAAS,eAAe,EAAA,SAAS,qBAAqB,EAAE;IACrE,IAAM,MAAM;QACV,CAAA,SAAQ;QACR,CAAA,QAAO,SAAS,OAAO,CAAC,YAAY,GAAG,GAAG;QAC1C,CAAA,aAAY,SAAS,OAAO,CAAC,YAAY,IAAI,SAAS,YAAY,CAAC,QAAQ;MAC5E;IACD,IAAI,QAAQ,OAAO,IAAI,GAAI;QACzB,QAAQ,OAAO,EAAE;;IAEnB,IAAI,QAAQ,QAAQ,IAAI,GAAI;QAC1B,QAAQ,QAAQ,EAAE;;AAEtB;AAEO,KAAS,MAAM,EAAA,qBAAoB,KAAG,MAAM,CAAC;IAClD,QAAQ,GAAG,CAAC;IAKZ,QAAQ,GAAG,CAAC;IAGZ,QAAQ,GAAG,CAAC;IAMZ,QAAQ,GAAG,CAAC;IAKZ,QAAQ,GAAG,CAAC,mBAAmB;IAC/B,OAAO;AACT;AAEA,MAAM;AAAO;AACN;;MAAM;IACX,aAAc;QACR;IACN;IACA,YAAA,UAAQ,MAAM,EAAQ;QACpB,OAAO,GAAI;IACb;AACF;AAEO;KAAe,oCAAY;IAChC,OAAO;QAAE,CAAA,IAAG,CAAC;MAAE;AACjB;;;;wCAlDuC,EAAA,SAAS,qBAAqB;eAA7C,eAAe;;+BAcjB,EAAA,qBAAoB,KAAG,MAAM;eAAnC,MAAM;;;;qBAkCA"}
\ No newline at end of file
......@@ -3,14 +3,14 @@ import { parseInjects } from '../src/uni_modules'
describe('uni_modules:uni-ext-api', () => {
test('parseInjects', () => {
expect(
parseInjects('app', `@/uni_modules/uni-getbatteryinfo`, {
parseInjects(true, 'app', `@/uni_modules/uni-getbatteryinfo`, {
uni: 'getBatteryInfo',
})
).toEqual({
'uni.getBatteryInfo': '@/uni_modules/uni-getbatteryinfo',
})
expect(
parseInjects('app', `@/uni_modules/uni-getbatteryinfo`, {
parseInjects(true, 'app', `@/uni_modules/uni-getbatteryinfo`, {
uni: ['getBatteryInfo'],
})
).toEqual({
......@@ -20,7 +20,7 @@ describe('uni_modules:uni-ext-api', () => {
],
})
expect(
parseInjects('app', `@/uni_modules/uni-location`, {
parseInjects(true, 'app', `@/uni_modules/uni-location`, {
uni: ['openLocation', 'chooseLocation'],
})
).toEqual({
......@@ -28,7 +28,7 @@ describe('uni_modules:uni-ext-api', () => {
'uni.chooseLocation': ['@/uni_modules/uni-location', 'chooseLocation'],
})
expect(
parseInjects('app', `@/uni_modules/uni-capturescreen`, {
parseInjects(true, 'app', `@/uni_modules/uni-capturescreen`, {
uni: {
onUserCaptureScreen: 'onCaptureScreen',
offUserCaptureScreen: 'offUserCaptureScreen',
......@@ -47,7 +47,7 @@ describe('uni_modules:uni-ext-api', () => {
})
test('parseInjects with platform', () => {
expect(
parseInjects('web', `@/uni_modules/uni-getbatteryinfo`, {
parseInjects(true, 'web', `@/uni_modules/uni-getbatteryinfo`, {
uni: 'getBatteryInfo1',
web: {
uni: 'getBatteryInfo',
......@@ -57,13 +57,13 @@ describe('uni_modules:uni-ext-api', () => {
'uni.getBatteryInfo': '@/uni_modules/uni-getbatteryinfo',
})
expect(
parseInjects('web', `@/uni_modules/uni-getbatteryinfo`, {
parseInjects(true, 'web', `@/uni_modules/uni-getbatteryinfo`, {
uni: 'getBatteryInfo1',
web: false,
})
).toEqual({})
expect(
parseInjects('web', `@/uni_modules/uni-location`, {
parseInjects(true, 'web', `@/uni_modules/uni-location`, {
uni: ['openLocation'],
web: {
uni: ['chooseLocation'],
......
......@@ -372,7 +372,7 @@ function useMovableViewTransform(
'px) translateZ(0px) scale(' +
scale +
')'
if(rootRef.value) {
if (rootRef.value) {
rootRef.value.style.transform = transform
rootRef.value.style.webkitTransform = transform
_translateX.value = x
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册