@spcsn/taro 0.1.2 → 1.0.0

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 +25 -56
  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,118 +0,0 @@
1
- import type { OutputOptions as RollupOutputOptions } from 'rollup'
2
- import type Webpack from 'webpack'
3
- import type Chain from 'webpack-chain'
4
-
5
- import type { IOption, IPostcssOption, IUrlLoaderOption } from './util'
6
- import type { CompilerTypes, CompilerWebpackTypes } from '../compiler'
7
- import type { OutputExt } from './project'
8
-
9
- export interface IHarmonyRouterConfig {
10
- /** 配置自定义路由 */
11
- customRoutes?: IOption
12
- }
13
-
14
- export interface IHarmonyConfig<T extends CompilerTypes = 'vite'> {
15
- /** Harmony 项目地址 */
16
- projectPath: string
17
-
18
- /** hap 名
19
- * @default "entry"
20
- */
21
- hapName?: string
22
-
23
- /** 应用名称
24
- * @default "default"
25
- */
26
- name?: string
27
-
28
- /** oh-package.json 配置 */
29
- ohPackage?: {
30
- dependencies?: { [name: string]: string }
31
- devDependencies?: { [name: string]: string }
32
- main?: string
33
- [k: string]: any
34
- }
35
-
36
- /** ohpm-cli
37
- * @default "~/Library/Huawei/ohpm/bin/ohpm"
38
- */
39
- ohpm?: string
40
-
41
- /** 核心依赖前缀
42
- * @description 用于告诉编译内容如何解析核心依赖,传入时将直接使用依赖前缀,同时不会为工程导入核心依赖
43
- */
44
- chorePackagePrefix?: string
45
-
46
- /** 用于告诉 Taro 编译器需要抽取的公共文件 */
47
- commonChunks?: string[] | ((commonChunks: string[]) => string[])
48
-
49
- /** Harmony 编译过程的相关配置 */
50
- compile?: {
51
- exclude?: any[]
52
- include?: any[]
53
- filter?: (filename: string) => boolean
54
- }
55
-
56
- /** 用于配置半编译模式下的选项 */
57
- compileModeSetting?: {
58
- componentReplace?: {
59
- [key: string]: {
60
- current_init: string
61
- dependency_define: string
62
- }
63
- }
64
- }
65
-
66
- /** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */
67
- enableSourceMap?: boolean
68
-
69
- /** 默认值:'cheap-module-source-map', 具体参考[Webpack devtool 配置](https://webpack.js.org/configuration/devtool/#devtool) */
70
- sourceMapType?: string
71
-
72
- /** 指定 React 框架相关的代码是否使用开发环境(未压缩)代码,默认使用生产环境(压缩后)代码 */
73
- debugReact?: boolean
74
-
75
- /**
76
- * 自定义 Webpack 配置
77
- * @param chain [webpackChain](https://github.com/neutrinojs/webpack-chain) 对象
78
- * @param webpack webpack 实例
79
- */
80
- webpackChain?: (chain: Chain, webpack: typeof Webpack) => void
81
-
82
- /** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/)
83
- * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
84
- */
85
- output?: T extends 'vite'
86
- ? Pick<RollupOutputOptions, 'chunkFileNames'> & OutputExt
87
- : Webpack.Configuration['output'] & OutputExt
88
-
89
- /** 路由相关的配置 */
90
- router?: IHarmonyRouterConfig
91
-
92
- /** 配置 postcss 相关插件 */
93
- postcss?: IPostcssOption<'harmony'>
94
-
95
- /** [css-loader](https://github.com/webpack-contrib/css-loader) 的附加配置 */
96
- cssLoaderOption?: IOption
97
-
98
- /** [sass-loader](https://github.com/webpack-contrib/sass-loader) 的附加配置 */
99
- sassLoaderOption?: IOption
100
-
101
- /** [less-loader](https://github.com/webpack-contrib/less-loader) 的附加配置 */
102
- lessLoaderOption?: IOption
103
-
104
- /** [stylus-loader](https://github.com/shama/stylus-loader) 的附加配置 */
105
- stylusLoaderOption?: IOption
106
-
107
- /** 针对 mp4 | webm | ogg | mp3 | wav | flac | aac 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */
108
- mediaUrlLoaderOption?: IUrlLoaderOption
109
-
110
- /** 针对 woff | woff2 | eot | ttf | otf 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */
111
- fontUrlLoaderOption?: IUrlLoaderOption
112
-
113
- /** 针对 png | jpg | jpeg | gif | bpm | svg 文件的 [url-loader](https://github.com/webpack-contrib/url-loader) 配置 */
114
- imageUrlLoaderOption?: IUrlLoaderOption
115
-
116
- /** [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) 的附加配置 */
117
- miniCssExtractPluginOption?: IOption
118
- }
@@ -1,85 +0,0 @@
1
- import type Webpack from 'webpack'
2
- import type Chain from 'webpack-chain'
3
- import type webpackDevServer from 'webpack-dev-server'
4
- import type HtmlWebpackPlugin from 'html-webpack-plugin'
5
- import type { RollupOptions } from 'rollup'
6
- import type { IOption, IPostcssOption } from './util'
7
-
8
- export interface IRNConfig {
9
- /** 设置 RN bundle 中注册应用的名称 */
10
- appName?: string
11
-
12
- /** entry 利用模块查找规则{name}.{platform}.{ext}自动区分平台 */
13
- entry?: string
14
-
15
- /** 设置 Metro 打包生成 bundle 的输出路径,默认 dist 目录下 */
16
- output?: any
17
-
18
- /** [sass](https://github.com/sass/node-sass#options) 相关配置 */
19
- sass?: IOption
20
-
21
- /** [less](https://lesscss.org/usage/#less-options) 相关配置 */
22
- less?: IOption
23
-
24
- /** [stylus](https://github.com/NervJS/taro/blob/main/packages/taro-rn-style-transformer/README.md#rnstylus) 相关配置 */
25
- stylus?: IOption
26
-
27
- /** 配置 postcss 相关插件 */
28
- postcss?: {
29
- /** postcss 配置,参考 https://github.com/postcss/postcss#options */
30
- options?: any
31
- /** 默认true,控制是否对 css value 进行 scalePx2dp 转换,pxtransform配置 enable 才生效 */
32
- scalable?: boolean
33
- pxtransform?: {
34
- enable?: boolean
35
- /** 插件 pxtransform 配置项 */
36
- config?: {
37
- additionalProperties?: boolean
38
- [key: string]: any
39
- }
40
- },
41
- cssModules?: {
42
- enable: boolean
43
- },
44
- [key: string]: any
45
- }
46
-
47
- resolve?: any
48
-
49
- /** 支持多 className 转换,以 classname 或 style 结尾的, 提取前缀, 然后根据前缀,再生成对应的 xxxStyle。如:barClassName -> barStyle。默认值 false,不开启 */
50
- enableMultipleClassName?: boolean
51
-
52
- /** 当标签 style 属性值是数组时转换成对象。默认值 false,不开启 */
53
- enableMergeStyle?: boolean
54
-
55
- /** 将 svg 文件转换为组件引入。默认值 false,不开启 */
56
- enableSvgTransform?: boolean
57
-
58
- alias?: IOption
59
-
60
- /** 设计稿尺寸 */
61
- designWidth?: number | ((size?: string | number | Input) => number)
62
-
63
- /** 设计稿尺寸换算规则 */
64
- deviceRatio?: TaroGeneral.TDeviceRatio
65
-
66
- /** 原生组件编译配置 */
67
- nativeComponents?: {
68
- /**
69
- * 外部依赖
70
- */
71
- external?: Array<string | RegExp> | ((arr: Array<string | RegExp>) => Array<string | RegExp>)
72
- /**
73
- * 设置外部依赖,如果返回 string, 则将该值作为 external, 我们默认将 node_modules 路径下的文件设置为外部依赖
74
- */
75
- exteranlResolve?: (importee: string, importer: string) => string
76
- /**
77
- * 组件输出路径,默认值为 'dist'
78
- */
79
- output?: string
80
- /**
81
- * 修改 Rollup 打包配置
82
- */
83
- modifyRollupConfig?: (config: RollupOptions, innerPlugins: { taroResolver: typeof taroResolver, styleTransformer: typeof styleTransformer }) => RollupOptions
84
- }
85
- }