@tarojs/taro 3.7.0-beta.1 → 3.7.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/package.json +11 -4
  2. package/types/api/ai/visionkit.d.ts +625 -54
  3. package/types/api/base/performance.d.ts +5 -5
  4. package/types/api/canvas/index.d.ts +67 -54
  5. package/types/api/device/accelerometer.d.ts +8 -6
  6. package/types/api/device/accessibility.d.ts +1 -1
  7. package/types/api/device/battery.d.ts +2 -2
  8. package/types/api/device/bluetooth-ble.d.ts +40 -17
  9. package/types/api/device/bluetooth-peripheral.d.ts +26 -26
  10. package/types/api/device/bluetooth.d.ts +37 -13
  11. package/types/api/device/calendar.d.ts +11 -1
  12. package/types/api/device/clipboard.d.ts +2 -2
  13. package/types/api/device/compass.d.ts +5 -5
  14. package/types/api/device/gyroscope.d.ts +4 -4
  15. package/types/api/device/iBeacon.d.ts +10 -8
  16. package/types/api/device/keyboard.d.ts +7 -5
  17. package/types/api/device/memory.d.ts +3 -4
  18. package/types/api/device/motion.d.ts +8 -6
  19. package/types/api/device/network.d.ts +12 -6
  20. package/types/api/device/nfc.d.ts +13 -13
  21. package/types/api/device/phone.d.ts +1 -1
  22. package/types/api/device/scan.d.ts +5 -3
  23. package/types/api/device/screen.d.ts +27 -11
  24. package/types/api/device/sms.d.ts +1 -1
  25. package/types/api/device/vibrate.d.ts +5 -5
  26. package/types/api/device/wifi.d.ts +25 -13
  27. package/types/api/media/camera.d.ts +9 -3
  28. package/types/api/open-api/device-voip.d.ts +2 -2
  29. package/types/api/open-api/login.d.ts +1 -1
  30. package/types/api/open-api/my-miniprogram.d.ts +2 -2
  31. package/types/api/open-api/privacy.d.ts +99 -0
  32. package/types/api/route/index.d.ts +1 -0
  33. package/types/api/skyline/index.d.ts +59 -0
  34. package/types/api/storage/cache-manager.d.ts +10 -10
  35. package/types/api/taro.extend.d.ts +1 -1
  36. package/types/api/ui/fonts.d.ts +4 -3
  37. package/types/compile/compiler.d.ts +7 -5
  38. package/types/compile/config/h5.d.ts +20 -10
  39. package/types/compile/config/mini.d.ts +36 -24
  40. package/types/compile/config/project.d.ts +8 -8
  41. package/types/compile/config/util.d.ts +18 -8
  42. package/types/compile/viteCompilerContext.d.ts +130 -0
  43. package/types/global.d.ts +1 -0
  44. package/types/index.d.ts +2 -0
  45. package/types/taro.api.d.ts +3 -0
  46. package/types/taro.component.d.ts +1 -1
  47. package/types/taro.config.d.ts +35 -4
@@ -0,0 +1,130 @@
1
+ import type { AppConfig, PageConfig } from '../index'
2
+ import type { IMiniFilesConfig, IH5Config, IMiniAppConfig } from './config'
3
+ import type { IProjectConfig } from './config/project'
4
+ import type { PluginContext } from "rollup"
5
+ import { IComponentConfig } from "./hooks"
6
+
7
+ import type { RecursiveTemplate, UnRecursiveTemplate } from '@tarojs/shared/dist/template'
8
+
9
+ export interface ViteNativeCompMeta {
10
+ name: string
11
+ scriptPath: string
12
+ configPath: string
13
+ config: PageConfig
14
+ isNative: true
15
+ templatePath: string
16
+ cssPath?: string
17
+ }
18
+
19
+ export interface ViteFileType {
20
+ config: string
21
+ script: string
22
+ templ: string
23
+ style: string
24
+ xs?: string
25
+ }
26
+
27
+ export interface ViteAppMeta {
28
+ name: string
29
+ scriptPath: string
30
+ configPath: string
31
+ config: AppConfig
32
+ isNative: false
33
+ }
34
+
35
+ export interface VitePageMeta {
36
+ name: string
37
+ scriptPath: string
38
+ configPath: string
39
+ config: PageConfig
40
+ isNative: boolean
41
+ templatePath?: string
42
+ cssPath?: string
43
+ }
44
+
45
+
46
+ export interface ViteH5BuildConfig extends CommonBuildConfig, IH5Config<'vite'> {
47
+ entryFileName?: string
48
+ runtimePath?: string | string[]
49
+ }
50
+
51
+ export interface CommonBuildConfig extends IProjectConfig<'vite'> {
52
+ entry: {
53
+ app: string | string[]
54
+ }
55
+ mode: 'production' | 'development' | 'none'
56
+ buildAdapter: string // weapp | swan | alipay | tt | qq | jd | h5
57
+ platformType: string // mini | web
58
+ /** special mode */
59
+ isBuildNativeComp?: boolean
60
+ /** hooks */
61
+ onCompilerMake: (compilation) => Promise<any>
62
+ onParseCreateElement: (nodeName, componentConfig) => Promise<any>
63
+ }
64
+
65
+
66
+ export interface ViteMiniBuildConfig extends CommonBuildConfig, IMiniAppConfig<'vite'> {
67
+ isBuildPlugin: boolean
68
+ isSupportRecursive: boolean
69
+ isSupportXS: boolean
70
+ nodeModulesPath: string
71
+ fileType: ViteFileType
72
+ globalObject: string
73
+ template: RecursiveTemplate | UnRecursiveTemplate
74
+ runtimePath?: string | string[]
75
+ taroComponentsPath?: string
76
+ blended?: boolean
77
+ hot?: boolean
78
+ injectOptions?: {
79
+ include?: Record<string, string | string[]>
80
+ exclude?: string[]
81
+ }
82
+ /** hooks */
83
+ modifyComponentConfig: (componentConfig: IComponentConfig, config: Partial<ViteMiniBuildConfig>) => Promise<any>
84
+ }
85
+
86
+ export interface ViteCompilerContext<T> {
87
+ cwd: string
88
+ sourceDir: string
89
+ taroConfig: T
90
+ rawTaroConfig: T
91
+ frameworkExts: string[]
92
+ app: ViteAppMeta
93
+ pages: VitePageMeta[]
94
+ loaderMeta: any
95
+ logger
96
+ filesConfig: IMiniFilesConfig
97
+ configFileList: string[]
98
+ compilePage: (pageName: string) => VitePageMeta
99
+ watchConfigFile: (rollupCtx: PluginContext) => void
100
+ getAppScriptPath: () => string
101
+ getApp: () => ViteAppMeta
102
+ getPages: () => VitePageMeta[]
103
+ isApp: (id: string) => boolean
104
+ isPage: (id: string) => boolean
105
+ isNativePageORComponent: (templatePath: string) => boolean
106
+ getPageById: (id: string) => VitePageMeta| undefined
107
+ getConfigFilePath: (filePath: string) => string
108
+ getTargetFilePath: (filePath: string, targetExtName: string) => string
109
+ }
110
+
111
+ export interface ViteH5CompilerContext extends ViteCompilerContext<ViteH5BuildConfig> {
112
+ getBrowserslist: () => void
113
+ routerMeta: {
114
+ routerCreator: string
115
+ getRoutesConfig: (pageName?: string) => string
116
+ }
117
+ browserslist: string[]
118
+ }
119
+
120
+ export interface ViteMiniCompilerContext extends ViteCompilerContext<ViteMiniBuildConfig> {
121
+ fileType: ViteFileType
122
+ commonChunks: string[]
123
+ nativeComponents : Map<string, ViteNativeCompMeta>
124
+ getCommonChunks: () => string[]
125
+ collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => void
126
+ getScriptPath: (filePath: string) => string
127
+ getTemplatePath: (filePath: string) => string
128
+ getStylePath: (filePath: string) => string
129
+ getConfigPath: (filePath: string) => string
130
+ }
package/types/global.d.ts CHANGED
@@ -2,6 +2,7 @@ declare namespace TaroGeneral {
2
2
  type IAnyObject = Record<string, any>
3
3
  type Optional<F> = F extends (arg: infer P) => infer R ? (arg?: P) => R : F
4
4
  type OptionalInterface<T> = { [K in keyof T]: Optional<T[K]> }
5
+ type TFunc = (...args: any[]) => any
5
6
  /** 事件监听函数 */
6
7
  type EventCallback = (
7
8
  /** 触发事件参数 */
package/types/index.d.ts CHANGED
@@ -87,6 +87,8 @@
87
87
  * │ │ └── index.d.ts 路由 API
88
88
  * │ ├── share
89
89
  * │ │ └── index.d.ts 转发 API
90
+ * │ ├── skyline
91
+ * │ │ └── index.d.ts 微信 Skyline API
90
92
  * │ ├── storage
91
93
  * │ │ ├── background-fetch.d.ts 数据缓存 -> 后台获取 API
92
94
  * │ │ └── index.d.ts 数据缓存 API
@@ -72,10 +72,12 @@
72
72
  /// <reference path="api/open-api/subscribe-message.d.ts" />
73
73
  /// <reference path="api/open-api/redpackage.d.ts" />
74
74
  /// <reference path="api/open-api/favorites.d.ts" />
75
+ /// <reference path="api/open-api/my-miniprogram.d.ts" />
75
76
  /// <reference path="api/open-api/license-plate.d.ts" />
76
77
  /// <reference path="api/open-api/channels.d.ts" />
77
78
  /// <reference path="api/open-api/device-voip.d.ts" />
78
79
  /// <reference path="api/open-api/group.d.ts" />
80
+ /// <reference path="api/open-api/privacy.d.ts" />
79
81
  /// <reference path="api/open-api/customer-service.d.ts" />
80
82
  /// <reference path="api/device/bluetooth.d.ts" />
81
83
  /// <reference path="api/device/bluetooth-ble.d.ts" />
@@ -107,6 +109,7 @@
107
109
  /// <reference path="api/wxml/index.d.ts" />
108
110
  /// <reference path="api/ext/index.d.ts" />
109
111
  /// <reference path="api/ad/index.d.ts" />
112
+ /// <reference path="api/skyline/index.d.ts" />
110
113
 
111
114
  /// <reference path="api/cloud/index.d.ts" />
112
115
  /// <reference path="api/open-api/facial.d.ts" />
@@ -90,7 +90,7 @@ declare module './index' {
90
90
  /** 创建一个 SelectorQuery 对象,选择器选取范围为这个组件实例内 */
91
91
  createSelectorQuery?(): SelectorQuery
92
92
  /** 创建一个 IntersectionObserver 对象,选择器选取范围为这个组件实例内 */
93
- createIntersectionObserver?(): IntersectionObserver
93
+ createIntersectionObserver?(options?: createIntersectionObserver.Option): IntersectionObserver
94
94
  /** 创建一个 MediaQueryObserver 对象 */
95
95
  createMediaQueryObserver?(): MediaQueryObserver
96
96
  /** 使用选择器选择组件实例节点,返回匹配到的第一个组件实例对象(会被 wx://component-export 影响) */
@@ -363,16 +363,41 @@ declare module './index' {
363
363
 
364
364
  interface RenderOptions {
365
365
  skyline: {
366
- /**
367
- * 开启默认Block布局
366
+ /** 开启默认Block布局
368
367
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/wxss.html#%E5%BC%80%E5%90%AF%E9%BB%98%E8%AE%A4Block%E5%B8%83%E5%B1%80
368
+ * @supported weapp
369
369
  */
370
370
  defaultDisplayBlock?: boolean
371
- /**
372
- * 关闭 Skyline AB 实验
371
+ /** 关闭 Skyline AB 实验
373
372
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/migration/release.html#%E5%8F%91%E5%B8%83%E4%B8%8A%E7%BA%BF
373
+ * @supported weapp
374
374
  */
375
375
  disableABTest?: boolean
376
+ /** 基础库最低版本
377
+ * @supported weapp
378
+ */
379
+ sdkVersionBegin?: string
380
+ /** 基础库最高版本
381
+ * @supported weapp
382
+ */
383
+ sdkVersionEnd?: string
384
+ /** iOS 微信最低版本
385
+ * @supported weapp
386
+ */
387
+ iosVersionBegin?: string
388
+ /** iOS 微信最高版本
389
+ * @supported weapp
390
+ */
391
+ iosVersionEnd?: string
392
+ /** 安卓微信最低版本
393
+ * @supported weapp
394
+ */
395
+ androidVersionBegin?: string
396
+ /** 安卓微信最高版本
397
+ * @supported weapp
398
+ */
399
+ androidVersionEnd?: string
400
+ [key: string]: unknown
376
401
  }
377
402
  }
378
403
 
@@ -622,6 +647,12 @@ declare module './index' {
622
647
  */
623
648
  useAuthorizePage: boolean
624
649
  }
650
+ /**
651
+ * 在 2023年9月15号之前,在 app.json 中配置 __usePrivacyCheck__: true 后,会启用隐私相关功能,如果不配置或者配置为 false 则不会启用。
652
+ * 在 2023年9月15号之后,不论 app.json 中是否有配置 __usePrivacyCheck__,隐私相关功能都会启用
653
+ * @supported weapp
654
+ */
655
+ __usePrivacyCheck__?: boolean
625
656
  /**
626
657
  * 正常情况下默认所有资源文件都被打包发布到所有平台,可以通过 static 字段配置特定每个目录/文件只能发布到特定的平台(多端场景)
627
658
  * @see https://dev.weixin.qq.com/docs/framework/guideline/devtools/condition-compile.html#%E8%B5%84%E6%BA%90