@spcsn/taro 0.1.2 → 1.0.1

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 (102) hide show
  1. package/README.md +13 -6
  2. package/dist/index.js +223 -1
  3. package/dist/index.js.map +1 -1
  4. package/package.json +17 -48
  5. package/types/api/ad/index.d.ts +3 -6
  6. package/types/api/base/debug.d.ts +8 -8
  7. package/types/api/base/env.d.ts +3 -3
  8. package/types/api/base/index.d.ts +3 -3
  9. package/types/api/base/performance.d.ts +5 -5
  10. package/types/api/base/system.d.ts +8 -16
  11. package/types/api/base/update.d.ts +6 -6
  12. package/types/api/base/weapp/app-event.d.ts +12 -12
  13. package/types/api/base/weapp/life-cycle.d.ts +1 -1
  14. package/types/api/canvas/index.d.ts +71 -72
  15. package/types/api/data-analysis/index.d.ts +1 -1
  16. package/types/api/device/accelerometer.d.ts +4 -4
  17. package/types/api/device/accessibility.d.ts +1 -1
  18. package/types/api/device/battery.d.ts +2 -2
  19. package/types/api/device/bluetooth-ble.d.ts +14 -14
  20. package/types/api/device/bluetooth-peripheral.d.ts +15 -15
  21. package/types/api/device/bluetooth.d.ts +11 -11
  22. package/types/api/device/calendar.d.ts +2 -2
  23. package/types/api/device/clipboard.d.ts +2 -4
  24. package/types/api/device/compass.d.ts +4 -4
  25. package/types/api/device/gyroscope.d.ts +4 -4
  26. package/types/api/device/iBeacon.d.ts +7 -7
  27. package/types/api/device/keyboard.d.ts +3 -3
  28. package/types/api/device/memory.d.ts +2 -2
  29. package/types/api/device/motion.d.ts +4 -4
  30. package/types/api/device/network.d.ts +5 -20
  31. package/types/api/device/nfc.d.ts +17 -17
  32. package/types/api/device/phone.d.ts +1 -1
  33. package/types/api/device/scan.d.ts +1 -1
  34. package/types/api/device/screen.d.ts +6 -6
  35. package/types/api/device/sms.d.ts +1 -1
  36. package/types/api/device/vibrate.d.ts +2 -2
  37. package/types/api/device/wifi.d.ts +10 -10
  38. package/types/api/ext/index.d.ts +2 -2
  39. package/types/api/files/index.d.ts +46 -46
  40. package/types/api/framework/index.d.ts +2 -2
  41. package/types/api/location/index.d.ts +38 -45
  42. package/types/api/media/audio.d.ts +30 -30
  43. package/types/api/media/background-audio.d.ts +1 -1
  44. package/types/api/media/camera.d.ts +12 -25
  45. package/types/api/media/image.d.ts +8 -13
  46. package/types/api/media/map.d.ts +15 -15
  47. package/types/api/media/recorder.d.ts +11 -11
  48. package/types/api/media/video.d.ts +19 -21
  49. package/types/api/navigate/index.d.ts +2 -2
  50. package/types/api/network/download.d.ts +7 -8
  51. package/types/api/network/request.d.ts +14 -33
  52. package/types/api/network/upload.d.ts +7 -9
  53. package/types/api/network/websocket.d.ts +14 -14
  54. package/types/api/open-api/account.d.ts +1 -1
  55. package/types/api/open-api/address.d.ts +5 -5
  56. package/types/api/open-api/authorize.d.ts +1 -1
  57. package/types/api/open-api/login.d.ts +5 -5
  58. package/types/api/open-api/settings.d.ts +2 -2
  59. package/types/api/open-api/subscribe-message.d.ts +15 -15
  60. package/types/api/open-api/user-info.d.ts +2 -3
  61. package/types/api/payment/index.d.ts +1 -1
  62. package/types/api/route/index.d.ts +5 -8
  63. package/types/api/share/index.d.ts +3 -3
  64. package/types/api/storage/background-fetch.d.ts +6 -9
  65. package/types/api/storage/index.d.ts +11 -11
  66. package/types/api/taro.extend.d.ts +7 -24
  67. package/types/api/taro.hooks.d.ts +8 -33
  68. package/types/api/ui/animation.d.ts +33 -36
  69. package/types/api/ui/background.d.ts +2 -4
  70. package/types/api/ui/custom-component.d.ts +1 -1
  71. package/types/api/ui/fonts.d.ts +1 -10
  72. package/types/api/ui/interaction.d.ts +6 -6
  73. package/types/api/ui/menu.d.ts +1 -1
  74. package/types/api/ui/navigation-bar.d.ts +5 -7
  75. package/types/api/ui/pull-down-refresh.d.ts +2 -3
  76. package/types/api/ui/scroll.d.ts +3 -4
  77. package/types/api/ui/tab-bar.d.ts +8 -8
  78. package/types/api/ui/window.d.ts +2 -2
  79. package/types/api/wxml/index.d.ts +19 -23
  80. package/types/compile/compiler.d.ts +4 -10
  81. package/types/compile/config/index.d.ts +0 -3
  82. package/types/compile/config/mini.d.ts +17 -39
  83. package/types/compile/config/plugin.d.ts +14 -4
  84. package/types/compile/config/project.d.ts +23 -61
  85. package/types/compile/config/util.d.ts +18 -73
  86. package/types/compile/index.d.ts +16 -1
  87. package/types/compile/viteCompilerContext.d.ts +18 -52
  88. package/types/global.d.ts +1 -12
  89. package/types/index.d.ts +0 -11
  90. package/types/taro.api.d.ts +0 -9
  91. package/types/taro.component.d.ts +0 -2
  92. package/types/taro.config.d.ts +0 -120
  93. package/types/taro.runtime.d.ts +7 -3
  94. package/types/api/alipay/index.d.ts +0 -69
  95. package/types/api/qq/index.d.ts +0 -354
  96. package/types/api/swan/bookshelf.d.ts +0 -307
  97. package/types/api/swan/download-package.d.ts +0 -80
  98. package/types/api/swan/index.d.ts +0 -251
  99. package/types/api/swan/pay.d.ts +0 -139
  100. package/types/compile/config/h5.d.ts +0 -134
  101. package/types/compile/config/harmony.d.ts +0 -118
  102. package/types/compile/config/rn.d.ts +0 -85
@@ -1,5 +1,5 @@
1
- import type { Input } from 'postcss'
2
- import type { Options as PostcssUrlOption } from 'postcss-url'
1
+ type PostcssInput = string | number
2
+ type PostcssUrlOption = Record<string, any>
3
3
 
4
4
  export type Func = (...args: any[]) => any
5
5
 
@@ -26,12 +26,12 @@ export namespace PostcssOption {
26
26
  }
27
27
 
28
28
  export interface IHtmlTransformOption {
29
- /** 是否启用 postcss-html-transform 插件 */
29
+ /** 是否启用内置 HTML 选择器转换 */
30
30
  enable?: boolean
31
31
  config?: {
32
- /** 当前编译平台 (此选项插件内部根据编译平台自行生成,无需传入) */
33
- readonly platform?: string
34
- /** 设置是否去除 cursor 相关样式 (h5默认值:true) */
32
+ /** 当前编译平台,内部根据编译平台自行生成,无需传入 */
33
+ readonly platform?: 'weapp'
34
+ /** 设置是否去除 cursor 相关样式 */
35
35
  removeCursorStyle: boolean
36
36
  }
37
37
  }
@@ -51,32 +51,14 @@ export interface IPxTransformOption {
51
51
  mediaQuery?: boolean
52
52
  /** 设置一个可被转换的最小 px 值 */
53
53
  minPixelValue?: number
54
- /**
55
- * 转换后的单位,可选值为 rpx、vw、rem,当前仅支持小程序 (默认 rpx) 和 Web 端 (默认 rem)
56
- * @description Web 端使用 rem 单位时会注入脚本用于设置 body 上的 font-size 属性,其他单位无该操作
57
- */
58
- targetUnit?: 'rpx' | 'vw' | 'rem'
59
- /**
60
- * H5 字体尺寸大小基准值,开发者可以自行调整单位换算的基准值(默认20)
61
- * @supported h5
62
- */
63
- baseFontSize?: number
64
- /**
65
- * H5 根节点 font-size 的最大值 (默认 40)
66
- * @supported h5
67
- */
68
- maxRootSize?: number
69
- /**
70
- * H5 根节点 font-size 的最小值(默认 20)
71
- * @supported h5
72
- */
73
- minRootSize?: number
54
+ /** 转换后的单位,当前仅支持小程序 rpx */
55
+ targetUnit?: 'rpx'
74
56
  /** 设计稿尺寸 */
75
- designWidth?: number | ((size?: string | number | Input) => number)
57
+ designWidth?: number | ((size?: PostcssInput) => number)
76
58
  /** 设计稿尺寸换算规则 */
77
59
  deviceRatio?: TaroGeneral.TDeviceRatio
78
60
  /** 平台 */
79
- platform?: 'weapp' | 'h5' | string
61
+ platform?: 'weapp'
80
62
  /** 启用的能力 Scope 默认为 ['platform', 'size'] */
81
63
  methods?: string[]
82
64
  /** filter 回调函数,可 exclude 不处理的文件 */
@@ -87,16 +69,15 @@ interface IBasePostcssOption {
87
69
  autoprefixer?: TogglableOptions
88
70
  pxtransform?: TogglableOptions<IPxTransformOption>
89
71
  cssModules?: PostcssOption.cssModules
90
- /** 插件 postcss-html-transform 相关配置, 一般启用了 @tarojs/plugin-html 插件才配置 */
72
+ /** 内置 HTML 选择器转换配置 */
91
73
  htmltransform?: IHtmlTransformOption
92
74
  [key: string]: any
93
75
  }
94
76
 
95
- export type IPostcssOption<T = 'h5' | 'harmony' | 'mini'> = T extends 'h5'
96
- ? IBasePostcssOption & { url?: PostcssOption.url }
97
- : IBasePostcssOption
77
+ export type IPostcssOption<T extends 'mini' = 'mini'> = T extends 'mini' ? IBasePostcssOption : never
98
78
 
99
- export type Config = ViteConfig | WebpackConfig
79
+ export type ViteConfig = Record<string, unknown>
80
+ export type Config = ViteConfig
100
81
 
101
82
  export interface ICopyOptions {
102
83
  patterns: {
@@ -110,61 +91,25 @@ export interface ICopyOptions {
110
91
  ignore?: string[]
111
92
  }
112
93
  }
113
-
114
- export interface ISassOptions {
115
- /**
116
- * 引入的全局 sass 文件,如果要引入多个文件,支持数组形式传入
117
- */
118
- resource?: string | string[]
119
- /**
120
- * 项目根目录的绝对地址(若为小程序云开发模板,则应该是client目录)
121
- */
122
- projectDirectory?: string
123
- /**
124
- * 全局 scss 变量,若 data 与 resource 中设置了同样的变量,则 data 的优先级高于 resource
125
- */
126
- data?: string
127
- }
128
-
129
94
  export interface ICompileOption {
130
95
  exclude?: string[]
131
96
  include?: string[]
132
97
  }
133
98
 
134
99
  export const enum TEMPLATE_TYPES {
135
- WEAPP = '.wxml',
136
- SWAN = '.swan',
137
- ALIPAY = '.axml',
138
- TT = '.ttml',
139
- QUICKAPP = '.ux',
140
- QQ = '.qml'
100
+ WEAPP = '.wxml'
141
101
  }
142
102
 
143
103
  export const enum STYLE_TYPES {
144
- WEAPP = '.wxss',
145
- SWAN = '.css',
146
- ALIPAY = '.acss',
147
- TT = '.ttss',
148
- QUICKAPP = '.css',
149
- QQ = '.qss'
104
+ WEAPP = '.wxss'
150
105
  }
151
106
 
152
107
  export const enum SCRIPT_TYPES {
153
- WEAPP = '.js',
154
- SWAN = '.js',
155
- ALIPAY = '.js',
156
- TT = '.js',
157
- QUICKAPP = '.js',
158
- QQ = '.js'
108
+ WEAPP = '.js'
159
109
  }
160
110
 
161
111
  export const enum CONFIG_TYPES {
162
- WEAPP = '.json',
163
- SWAN = '.json',
164
- ALIPAY = '.json',
165
- TT = '.json',
166
- QUICKAPP = '.json',
167
- QQ = '.json'
112
+ WEAPP = '.json'
168
113
  }
169
114
 
170
115
  export type IMINI_APP_FILE_TYPE = {
@@ -1,4 +1,19 @@
1
- export { Current } from '@spcsn/taro-runtime'
1
+ export interface Current {
2
+ app: any | null
3
+ router: {
4
+ params: Record<string, unknown>
5
+ path: string
6
+ $taroPath: string
7
+ onReady: string
8
+ onHide: string
9
+ onShow: string
10
+ exitState?: any
11
+ } | null
12
+ page: any | null
13
+ preloadData?: any
14
+ }
15
+
16
+ export const Current: Current
2
17
 
3
18
  export interface IFileType {
4
19
  style: string
@@ -1,12 +1,10 @@
1
- import type { RecursiveTemplate, UnRecursiveTemplate } from '@spcsn/taro-shared/dist/template'
2
-
3
- import type { PluginContext } from 'rollup'
4
- import type { IMiniFilesConfig, IH5Config, IHarmonyConfig, IMiniAppConfig } from './config'
1
+ import type { IMiniAppConfig, IMiniFilesConfig } from './config'
5
2
  import type { IProjectConfig } from './config/project'
6
3
  import type { IComponentConfig } from './hooks'
7
- import type { IFileType } from './index'
8
4
  import type { AppConfig, PageConfig } from '../index'
9
5
 
6
+ type RollupPluginContext = any
7
+
10
8
  export interface ViteNativeCompMeta {
11
9
  name: string
12
10
  exportName: string
@@ -28,6 +26,17 @@ export interface ViteFileType {
28
26
  xs?: string
29
27
  }
30
28
 
29
+ export interface ViteMiniTemplate {
30
+ isSupportRecursive: boolean
31
+ isUseCompileMode?: boolean
32
+ isUseXS?: boolean
33
+ buildBaseComponentTemplate: (ext: string) => string
34
+ buildCustomComponentTemplate: (ext: string) => string
35
+ buildPageTemplate: (baseTempPath: string, page?: { content: Record<string, any>; path: string }) => string
36
+ buildTemplate: (componentConfig: IComponentConfig) => string
37
+ buildXScript: () => string
38
+ }
39
+
31
40
  export interface ViteAppMeta {
32
41
  name: string
33
42
  scriptPath: string
@@ -46,22 +55,6 @@ export interface VitePageMeta {
46
55
  cssPath?: string
47
56
  }
48
57
 
49
- export interface ViteH5BuildConfig extends CommonBuildConfig, IH5Config<'vite'> {
50
- entryFileName?: string
51
- runtimePath?: string | string[]
52
- }
53
-
54
- export interface ViteHarmonyBuildConfig extends CommonBuildConfig, IHarmonyConfig {
55
- fileType: IFileType
56
- useETS?: boolean
57
- useJSON5?: boolean
58
- blended?: boolean
59
- runtimePath?: string | string[]
60
- isPure?: boolean
61
- taroComponentsPath: string
62
- cssVariables?: boolean // 是否动态解析css变量
63
- }
64
-
65
58
  export interface CommonBuildConfig extends IProjectConfig<'vite'> {
66
59
  entry: {
67
60
  app: string | string[]
@@ -72,7 +65,6 @@ export interface CommonBuildConfig extends IProjectConfig<'vite'> {
72
65
  /** special mode */
73
66
  isBuildNativeComp?: boolean
74
67
  /** hooks */
75
- onCompilerMake: (compilation) => Promise<any>
76
68
  onParseCreateElement: (nodeName, componentConfig) => Promise<any>
77
69
  }
78
70
 
@@ -84,7 +76,7 @@ export interface ViteMiniBuildConfig extends CommonBuildConfig, IMiniAppConfig<'
84
76
  nodeModulesPath: string
85
77
  fileType: ViteFileType
86
78
  globalObject: string
87
- template: RecursiveTemplate | UnRecursiveTemplate
79
+ template: ViteMiniTemplate
88
80
  runtimePath?: string | string[]
89
81
  taroComponentsPath: string
90
82
  blended?: boolean
@@ -111,8 +103,8 @@ export interface ViteCompilerContext<T> {
111
103
  filesConfig: IMiniFilesConfig
112
104
  configFileList: string[]
113
105
  compilePage: (pageName: string) => VitePageMeta
114
- watchConfigFile: (rollupCtx: PluginContext) => void
115
- collectedDeps: (rollupCtx: PluginContext, id: string, filter, cache: Set<string> = new Set()) => Promise<Set<string>>
106
+ watchConfigFile: (rollupCtx: RollupPluginContext) => void
107
+ collectedDeps: (rollupCtx: RollupPluginContext, id: string, filter, cache: Set<string> = new Set()) => Promise<Set<string>>
116
108
  getAppScriptPath: () => string
117
109
  getApp: () => ViteAppMeta
118
110
  getPages: () => VitePageMeta[]
@@ -126,32 +118,6 @@ export interface ViteCompilerContext<T> {
126
118
  getTargetFilePath: (filePath: string, targetExtName: string) => string
127
119
  }
128
120
 
129
- export interface ViteH5CompilerContext extends ViteCompilerContext<ViteH5BuildConfig> {
130
- getBrowserslist: () => void
131
- routerMeta: {
132
- routerCreator: string
133
- getRoutesConfig: (pageName?: string) => string
134
- }
135
- browserslist: string[]
136
- }
137
-
138
- export interface ViteHarmonyCompilerContext extends ViteCompilerContext<ViteHarmonyBuildConfig> {
139
- nativeExt: string[]
140
- fileType: ViteFileType
141
- commonChunks: string[]
142
- extraComponents: string[]
143
- nativeComponents : Map<string, ViteNativeCompMeta>
144
- getCommonChunks: () => string[]
145
- modifyHarmonyConfig: (config: Partial<AppConfig>) => void
146
- modifyHostPackage: (deps?: Record<string, string>, devDeps?: Record<string, string>) => Exclude<IHarmonyConfig['ohPackage'], void>
147
- resolvePageImportPath: (scriptPath: string, pageName: string) => string
148
- collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => ViteNativeCompMeta[]
149
- generateNativeComponent: (rollupCtx: PluginContext, meta: ViteNativeCompMeta, implicitlyLoadedAfterOneOf: string[] = []) => void
150
- getScriptPath: (filePath: string) => string
151
- getStylePath: (filePath: string) => string
152
- getConfigPath: (filePath: string) => string
153
- }
154
-
155
121
  export interface ViteMiniCompilerContext extends ViteCompilerContext<ViteMiniBuildConfig> {
156
122
  fileType: ViteFileType
157
123
  commonChunks: string[]
@@ -159,7 +125,7 @@ export interface ViteMiniCompilerContext extends ViteCompilerContext<ViteMiniBui
159
125
  getCommonChunks: () => string[]
160
126
  resolvePageImportPath: (scriptPath: string, pageName: string) => string
161
127
  collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => ViteNativeCompMeta[]
162
- generateNativeComponent: (rollupCtx: PluginContext, meta: ViteNativeCompMeta, implicitlyLoadedAfterOneOf: string[] = []) => void
128
+ generateNativeComponent: (rollupCtx: RollupPluginContext, meta: ViteNativeCompMeta) => void
163
129
  getScriptPath: (filePath: string) => string
164
130
  getTemplatePath: (filePath: string) => string
165
131
  getStylePath: (filePath: string) => string
package/types/global.d.ts CHANGED
@@ -410,18 +410,7 @@ declare namespace TaroGeneral {
410
410
 
411
411
  // ENV_TYPE
412
412
  enum ENV_TYPE {
413
- ASCF = 'ASCF',
414
- WEAPP = 'WEAPP',
415
- SWAN = 'SWAN',
416
- ALIPAY = 'ALIPAY',
417
- TT = 'TT',
418
- QQ = 'QQ',
419
- JD = 'JD',
420
- WEB = 'WEB',
421
- RN = 'RN',
422
- HARMONY = 'HARMONY',
423
- QUICKAPP = 'QUICKAPP',
424
- HARMONYHYBRID = 'HARMONYHYBRID'
413
+ WEAPP = 'WEAPP'
425
414
  }
426
415
 
427
416
  type TDeviceRatio = Record<string, number>
package/types/index.d.ts CHANGED
@@ -9,8 +9,6 @@
9
9
  * │   │   ├── face.d.ts 人脸检测 API
10
10
  * │   │   ├── inference.d.ts AI 推理 API
11
11
  * │   │   └── visionkit.d.ts 视觉算法 API
12
- * │   ├── alipay
13
- * │ │ └── index.d.ts 支付宝小程序 API
14
12
  * │   ├── base
15
13
  * │ │ ├── index.d.ts 基础 API
16
14
  * │   │   ├── crypto.d.ts 基础 -> 加密 API
@@ -109,8 +107,6 @@
109
107
  * │ │ └── werun.d.ts 开放接口 -> 微信运动 API
110
108
  * │   ├── payment
111
109
  * │   │   └── index.d.ts 支付 API
112
- * │   ├── qq
113
- * │   │   └── index.d.ts QQ 小程序 API
114
110
  * │   ├── route
115
111
  * │ │ └── index.d.ts 路由 API
116
112
  * │   ├── share
@@ -121,11 +117,6 @@
121
117
  * │ │ ├── background-fetch.d.ts 数据缓存 -> 后台获取 API
122
118
  * │   │   ├── cache-manager.d.ts 数据缓存 -> 缓存管理 API
123
119
  * │   │   └── index.d.ts 数据缓存 API
124
- * │   ├── swan
125
- * │   │   ├── bookshelf.d.ts 百度小程序 -> 书架 API
126
- * │   │   ├── download-package.d.ts 百度小程序 -> 下载包 API
127
- * │ │ └── index.d.ts 百度小程序 API
128
- * │   │   └── pay.d.ts 百度小程序 -> 支付 API
129
120
  * │   ├── taro.extend.d.ts Taro 扩展 API 类型定义
130
121
  * │   ├── taro.hooks.d.ts Taro Hooks 类型定义
131
122
  * │   ├── ui
@@ -173,8 +164,6 @@
173
164
  /// <reference path="taro.lifecycle.d.ts" />
174
165
  /// <reference path="taro.runtime.d.ts" />
175
166
 
176
- /// <reference types="@spcsn/taro-plugin-platform-weapp/types/shims-weapp" />
177
-
178
167
  export = Taro
179
168
  export as namespace Taro
180
169
 
@@ -117,14 +117,5 @@
117
117
 
118
118
  /// <reference path="api/cloud/index.d.ts" />
119
119
 
120
- /// <reference path="api/alipay/index.d.ts" />
121
- /// <reference path="api/qq/index.d.ts" />
122
-
123
- /// <reference path="api/swan/bookshelf.d.ts" />
124
- /// <reference path="api/swan/download-package.d.ts" />
125
- /// <reference path="api/swan/index.d.ts" />
126
- /// <reference path="api/swan/pay.d.ts" />
127
-
128
-
129
120
  /// <reference path="api/taro.extend.d.ts" />
130
121
  /// <reference path="api/taro.hooks.d.ts" />
@@ -45,8 +45,6 @@ declare module './index' {
45
45
  eh?(event: MpEvent): void
46
46
  onLoad(options: Record<string, unknown>): void
47
47
  onOptionMenuClick?(): void
48
- /** 键盘高度变化时触发 @supported alipay */
49
- onKeyboardHeight?(opt: { height: number; }): void
50
48
  onPageScroll?(opt: PageScrollObject): void
51
49
  onPopMenuClick?(): void
52
50
  onPullDownRefresh?(): void
@@ -81,80 +81,6 @@ declare module './index' {
81
81
  * 支持 static / manual / auto
82
82
  */
83
83
  handleWebviewPreload?: string
84
- /** 是否允许向下拉拽。
85
- * @default: "YES"
86
- * @supported alipay
87
- */
88
- allowsBounceVertical?: 'YES' | 'NO'
89
- /**
90
- * 下拉露出显示背景图的底色。例:白色 "#FFFFFF"。**仅安卓下有效,iOS 下页面背景图底色会使用 backgroundColor 的值**
91
- * @supported alipay
92
- * @type {HexColor}
93
- */
94
- backgroundImageColor?: string
95
- /**
96
- * 下拉露出显示背景图的链接
97
- * @supported alipay
98
- */
99
- backgroundImageUrl?: string
100
- /**
101
- * 页面默认标题
102
- * @supported alipay
103
- */
104
- defaultTitle?: string
105
- /**
106
- * 仅支持 Android,是否显示 WebView 滚动条。默认 YES,支持 YES / NO。
107
- * @default "YES"
108
- * @supported alipay
109
- */
110
- enableScrollBar?: string
111
- /**
112
- * 仅支持 iOS,是否支持手势返回。默认 YES,支持 YES / NO。
113
- * @supported alipay
114
- */
115
- gestureBack?: string
116
- /** 是否允许下拉刷新
117
- * @desc
118
- * 1. 下拉刷新生效的前提是 allowsBounceVertical 值为 true
119
- * 2. window 全局配置后全局生效,但是如果单个页面配置了该参数,以页面的配置为准。
120
- * @default true
121
- * @supported alipay
122
- */
123
- pullRefresh?: boolean
124
- /**
125
- * rpx 单位是否宽度自适应 ,默认 true,当设置为 false 时,2 rpx 将恒等于 1 px,不再根据屏幕宽度进行自适应,注意,此时 750 rpx 将不再等于 100% 宽度。
126
- * @supported alipay
127
- */
128
- responsive?: boolean
129
- /**
130
- * 是否进入时显示导航栏的 loading。默认 NO,支持 YES / NO。
131
- * @default "NO"
132
- * @supported alipay
133
- */
134
- showTitleLoading?: string
135
- /**
136
- * 导航栏透明设置。默认 none,支持 always 一直透明 / auto 滑动自适应 / none 不透明。
137
- * @default "none"
138
- * @supported alipay
139
- */
140
- transparentTitle?: string
141
- /**
142
- * 是否允许导航栏点击穿透。默认 NO,支持 YES / NO。
143
- * @default "NO"
144
- * @supported alipay
145
- */
146
- titlePenetrate?: string
147
- /**
148
- * 导航栏图片地址。
149
- * @supported alipay
150
- */
151
- titleImage?: string
152
- /**
153
- * 导航栏背景色。例:白色 "#FFFFFF"。
154
- * @supported alipay
155
- * @type {HexColor}
156
- */
157
- titleBarColor?: string
158
84
  }
159
85
 
160
86
  interface PageConfig extends CommonConfig {
@@ -246,18 +172,6 @@ declare module './index' {
246
172
  * shared 表示页面 wxss 样式将影响到自定义组件,自定义组件 wxss 中指定的样式也会影响页面和其他设置了 apply-shared 或 shared 的自定义组件。(这个选项在插件中不可用。)
247
173
  */
248
174
  styleIsolation?: 'isolated' | 'apply-shared' | 'shared'
249
- /**
250
- * 设置导航栏额外图标,目前支持设置属性 icon,值为图标 url(以 https/http 开头)或 base64 字符串,大小建议 30*30 px
251
- *
252
- * 点击后触发 onOptionMenuClick(**注意**:该配置即将废弃。)。
253
- * @supported alipay
254
- */
255
- optionMenu?: Record<string, string>
256
- /**
257
- * 设置导航栏图标主题,仅支持真机预览。"default" 为蓝色图标,"light" 为白色图标。
258
- * @supported alipay
259
- */
260
- barButtonTheme?: string
261
175
  }
262
176
 
263
177
  interface WindowConfig extends CommonConfig {}
@@ -415,20 +329,6 @@ declare module './index' {
415
329
  [key: string]: unknown
416
330
  }
417
331
  }
418
-
419
- interface Behavior {
420
- /**
421
- * 使用小程序默认分享功能时(即不显式设置 Page.onShareAppMessage),当设置此字段后,会使客户端生成的用于分享的 scheme 带上当前用户打开的页面所携带的 query 参数。
422
- * @supported alipay 基础库 2.7.10 及以上开始支持,同时需使用 IDE 2.7.0 及以上版本进行构建。
423
- */
424
- shareAppMessage?: 'appendQuery'
425
- /**
426
- * 小程序在解析全局参数、页面参数时默认会对键/值做 encodeURIComponent。当设置为 disable 后,则不再对键/值做encodeURIComponent
427
- * @supported alipay 基础库 2.7.19 及以上开始支持,同时需使用 IDE 3.0.0 及以上版本进行构建。
428
- */
429
- decodeQuery?: 'disable'
430
- }
431
-
432
332
  export interface AppConfig {
433
333
  /** 小程序默认启动首页,未指定 entryPagePath 时,数组的第一项代表小程序的初始页面(首页)。 */
434
334
  entryPagePath?: string
@@ -631,11 +531,6 @@ declare module './index' {
631
531
  * @since 3.3.18
632
532
  */
633
533
  appId?: string
634
- /** 是否开启 h5 端路由动画功能,默认开启
635
- * @supported h5
636
- * @since 3.3.18
637
- */
638
- animation?: RouterAnimate | boolean
639
534
  /**
640
535
  * 指定小程序全局的默认渲染后端。
641
536
  * @default "webview"
@@ -673,21 +568,6 @@ declare module './index' {
673
568
  * @see https://dev.weixin.qq.com/docs/framework/guideline/devtools/condition-compile.html#%E8%B5%84%E6%BA%90
674
569
  */
675
570
  static?: { pattern: string; platforms: string[] }[]
676
- /**
677
- * 动态插件配置规则,声明小程序需要使用动态插件
678
- * @supported alipay
679
- */
680
- useDynamicPlugins?: boolean
681
- /**
682
- * 用于改变小程序若干运行行为
683
- * @supported alipay
684
- */
685
- behavior?: Behavior
686
- /**
687
- * 用于开启抖音小程序的 tt-dom 渲染模式
688
- * @supported tt
689
- */
690
- enableTTDom?: boolean
691
571
  }
692
572
 
693
573
  interface Config extends PageConfig, AppConfig {
@@ -1,9 +1,13 @@
1
- import type { options } from '@spcsn/taro-runtime'
2
-
3
1
  import Taro from './index'
4
2
 
3
+ export interface TaroRuntimeOptions {
4
+ prerender: boolean
5
+ debug: boolean
6
+ miniGlobal?: any
7
+ }
8
+
5
9
  declare module './index' {
6
10
  interface TaroStatic {
7
- options: typeof options
11
+ options: TaroRuntimeOptions
8
12
  }
9
13
  }
@@ -1,69 +0,0 @@
1
- import Taro from '../../index'
2
-
3
- declare module '../../index' {
4
- namespace getOpenUserInfo {
5
- interface Option {
6
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
7
- complete?:(res: TaroGeneral.CallbackResult) => void
8
- /** 接口调用失败的回调函数 */
9
- fail?: (res: TaroGeneral.CallbackResult) => void
10
- /** 接口调用成功的回调函数 */
11
- success?: (res: SuccessCallbackResult) => void
12
- }
13
- interface SuccessCallbackResult {
14
- /** 返回一个 Object 类型的对象 res。使用 JSON.parse(res.response).response 解析 */
15
- response: string
16
- }
17
- }
18
- namespace tradePay {
19
- interface Option {
20
- /** 接入小程序支付时传入此参数。此参数为支付宝交易号,注意参数有大小写区分(调用 小程序支付 时必填) */
21
- tradeNO?: string
22
- /** 完整的支付参数拼接成的字符串,从服务端获取(调用 支付宝预授权 时必填) */
23
- orderStr?: string
24
- /** 接口调用成功的回调函数 */
25
- success?: (res: SuccessCallbackResult) => void
26
- /** 接口调用失败的回调函数 */
27
- fail?: (res: TaroGeneral.CallbackResult) => void
28
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
29
- complete?:(res: TaroGeneral.CallbackResult) => void
30
- }
31
- interface ResultCode {
32
- /** 无权限调用(N22104) */
33
- 4
34
- /** 订单处理成功 */
35
- 9000
36
- /** 正在处理中。支付结果未知(有可能已经支付成功) */
37
- 8000
38
- /** 订单处理失败 */
39
- 4000
40
- /** 用户中途取消 */
41
- 6001
42
- /** 网络连接出错 */
43
- 6002
44
- /** 处理结果未知(有可能已经成功) */
45
- 6004
46
- }
47
- interface SuccessCallbackResult {
48
- /** success 回调函数会携带一个 Object 类型的对象,其属性如下: */
49
- response: {
50
- resultCode: ResultCode
51
- }
52
- }
53
- }
54
- interface TaroStatic {
55
- /**
56
- * 此接口可获取支付宝会员的基础信息(头像图片地址、昵称、性别、国家码、省份、所在市区),接入方法请参考 获取会员基础信息介绍。如需获取支付宝会员标识(user_id),请调用 my.getAuthCode 和 alipay.system.oauth.token 接口。
57
- * @supported alipay
58
- * @see https://docs.alipay.com/mini/api/ch8chh
59
- */
60
- getOpenUserInfo(Option: getOpenUserInfo.Option): Promise<getOpenUserInfo.SuccessCallbackResult>
61
-
62
- /**
63
- * 此接口是用于发起支付的 API,此 API 暂仅支持企业支付宝小程序使用
64
- * @supported alipay
65
- * @see https://opendocs.alipay.com/mini/api/openapi-pay
66
- */
67
- tradePay(Option: tradePay.Option): Promise<tradePay.SuccessCallbackResult>
68
- }
69
- }