@tarojs/taro 4.0.1-alpha.1 → 4.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.
- package/package.json +16 -40
- package/types/api/base/env.d.ts +1 -1
- package/types/api/base/system.d.ts +2 -2
- package/types/api/base/weapp/app-event.d.ts +4 -4
- package/types/api/device/accelerometer.d.ts +4 -4
- package/types/api/device/battery.d.ts +2 -2
- package/types/api/device/clipboard.d.ts +14 -14
- package/types/api/device/keyboard.d.ts +2 -2
- package/types/api/device/network.d.ts +3 -3
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/screen.d.ts +2 -2
- package/types/api/device/vibrate.d.ts +2 -2
- package/types/api/media/image.d.ts +2 -2
- package/types/api/network/request.d.ts +1 -1
- package/types/api/route/index.d.ts +5 -5
- package/types/api/storage/index.d.ts +4 -4
- package/types/api/swan/pay.d.ts +4 -4
- package/types/api/taro.extend.d.ts +3 -5
- package/types/api/ui/animation.d.ts +1 -1
- package/types/api/ui/interaction.d.ts +3 -3
- package/types/api/ui/navigation-bar.d.ts +5 -5
- package/types/api/ui/pull-down-refresh.d.ts +2 -2
- package/types/api/ui/scroll.d.ts +1 -1
- package/types/api/ui/tab-bar.d.ts +7 -7
- package/types/api/wxml/index.d.ts +9 -15
- package/types/compile/compiler.d.ts +4 -9
- package/types/compile/config/h5.d.ts +10 -23
- package/types/compile/config/index.d.ts +0 -1
- package/types/compile/config/mini.d.ts +24 -29
- package/types/compile/config/project.d.ts +21 -49
- package/types/compile/config/util.d.ts +7 -21
- package/types/compile/index.d.ts +0 -8
- package/types/index.d.ts +1 -0
- package/types/taro.component.d.ts +0 -1
- package/types/taro.config.d.ts +0 -5
- package/types/compile/config/harmony.d.ts +0 -118
- package/types/compile/config/plugin.d.ts +0 -34
- package/types/compile/viteCompilerContext.d.ts +0 -159
|
@@ -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,34 +0,0 @@
|
|
|
1
|
-
import type { CustomPluginOptions, ResolvedId, ResolveIdResult } from 'rollup'
|
|
2
|
-
|
|
3
|
-
interface IRollupPluginResolveIdOptions {
|
|
4
|
-
assertions?: Record<string, string>
|
|
5
|
-
custom?: CustomPluginOptions
|
|
6
|
-
isEntry?: boolean
|
|
7
|
-
skipSelf?: boolean
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export type TRollupResolveMethod = (
|
|
11
|
-
source: string,
|
|
12
|
-
importer?: string,
|
|
13
|
-
options?: IRollupPluginResolveIdOptions
|
|
14
|
-
) => Promise<ResolvedId | null>
|
|
15
|
-
|
|
16
|
-
export interface ILoaderMeta {
|
|
17
|
-
importFrameworkStatement: string
|
|
18
|
-
importFrameworkName: string
|
|
19
|
-
creator: string
|
|
20
|
-
creatorLocation: string
|
|
21
|
-
extraImportForWeb: string
|
|
22
|
-
execBeforeCreateWebApp: string
|
|
23
|
-
frameworkArgs: string
|
|
24
|
-
isNeedRawLoader?: boolean
|
|
25
|
-
mockAppStatement: string
|
|
26
|
-
modifyConfig?: (config: Record<string, any>, source: string) => void
|
|
27
|
-
modifyResolveId?: (res: {
|
|
28
|
-
source?: string
|
|
29
|
-
importer?: string
|
|
30
|
-
options?: IRollupPluginResolveIdOptions
|
|
31
|
-
name?: string
|
|
32
|
-
resolve: TRollupResolveMethod
|
|
33
|
-
}) => Promise<ResolveIdResult> | ResolveIdResult
|
|
34
|
-
}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import type { RecursiveTemplate, UnRecursiveTemplate } from '@tarojs/shared/dist/template'
|
|
2
|
-
|
|
3
|
-
import type { PluginContext } from 'rollup'
|
|
4
|
-
import type { IMiniFilesConfig, IH5Config, IHarmonyConfig, IMiniAppConfig } from './config'
|
|
5
|
-
import type { IProjectConfig } from './config/project'
|
|
6
|
-
import type { IComponentConfig } from './hooks'
|
|
7
|
-
import type { IFileType } from './index'
|
|
8
|
-
import type { AppConfig, PageConfig } from '../index'
|
|
9
|
-
|
|
10
|
-
export interface ViteNativeCompMeta {
|
|
11
|
-
name: string
|
|
12
|
-
scriptPath: string
|
|
13
|
-
configPath: string
|
|
14
|
-
config: PageConfig
|
|
15
|
-
isNative: true
|
|
16
|
-
templatePath: string
|
|
17
|
-
cssPath?: string
|
|
18
|
-
isPackage?: boolean
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface ViteFileType {
|
|
22
|
-
config: string
|
|
23
|
-
script: string
|
|
24
|
-
templ: string
|
|
25
|
-
style: string
|
|
26
|
-
xs?: string
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface ViteAppMeta {
|
|
30
|
-
name: string
|
|
31
|
-
scriptPath: string
|
|
32
|
-
configPath: string
|
|
33
|
-
config: AppConfig
|
|
34
|
-
isNative: false
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface VitePageMeta {
|
|
38
|
-
name: string
|
|
39
|
-
scriptPath: string
|
|
40
|
-
configPath: string
|
|
41
|
-
config: PageConfig
|
|
42
|
-
isNative: boolean
|
|
43
|
-
templatePath?: string
|
|
44
|
-
cssPath?: string
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface ViteH5BuildConfig extends CommonBuildConfig, IH5Config<'vite'> {
|
|
48
|
-
entryFileName?: string
|
|
49
|
-
runtimePath?: string | string[]
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface ViteHarmonyBuildConfig extends CommonBuildConfig, IHarmonyConfig {
|
|
53
|
-
fileType: IFileType
|
|
54
|
-
useETS?: boolean
|
|
55
|
-
useJSON5?: boolean
|
|
56
|
-
blended?: boolean
|
|
57
|
-
runtimePath?: string | string[]
|
|
58
|
-
isPure?: boolean
|
|
59
|
-
taroComponentsPath: string
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface CommonBuildConfig extends IProjectConfig<'vite'> {
|
|
63
|
-
entry: {
|
|
64
|
-
app: string | string[]
|
|
65
|
-
}
|
|
66
|
-
mode: 'production' | 'development' | 'none'
|
|
67
|
-
buildAdapter: string // weapp | swan | alipay | tt | qq | jd | h5
|
|
68
|
-
platformType: string // mini | web
|
|
69
|
-
/** special mode */
|
|
70
|
-
isBuildNativeComp?: boolean
|
|
71
|
-
/** hooks */
|
|
72
|
-
onCompilerMake: (compilation) => Promise<any>
|
|
73
|
-
onParseCreateElement: (nodeName, componentConfig) => Promise<any>
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
export interface ViteMiniBuildConfig extends CommonBuildConfig, IMiniAppConfig<'vite'> {
|
|
78
|
-
isBuildPlugin: boolean
|
|
79
|
-
isSupportRecursive: boolean
|
|
80
|
-
isSupportXS: boolean
|
|
81
|
-
nodeModulesPath: string
|
|
82
|
-
fileType: ViteFileType
|
|
83
|
-
globalObject: string
|
|
84
|
-
template: RecursiveTemplate | UnRecursiveTemplate
|
|
85
|
-
runtimePath?: string | string[]
|
|
86
|
-
taroComponentsPath?: string
|
|
87
|
-
blended?: boolean
|
|
88
|
-
hot?: boolean
|
|
89
|
-
injectOptions?: {
|
|
90
|
-
include?: Record<string, string | string[]>
|
|
91
|
-
exclude?: string[]
|
|
92
|
-
}
|
|
93
|
-
/** hooks */
|
|
94
|
-
modifyComponentConfig: (componentConfig: IComponentConfig, config: Partial<ViteMiniBuildConfig>) => Promise<any>
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export interface ViteCompilerContext<T> {
|
|
98
|
-
cwd: string
|
|
99
|
-
sourceDir: string
|
|
100
|
-
taroConfig: T
|
|
101
|
-
rawTaroConfig: T
|
|
102
|
-
frameworkExts: string[]
|
|
103
|
-
app: ViteAppMeta
|
|
104
|
-
pages: VitePageMeta[]
|
|
105
|
-
components?: VitePageMeta[]
|
|
106
|
-
loaderMeta: any
|
|
107
|
-
logger
|
|
108
|
-
filesConfig: IMiniFilesConfig
|
|
109
|
-
configFileList: string[]
|
|
110
|
-
compilePage: (pageName: string) => VitePageMeta
|
|
111
|
-
watchConfigFile: (rollupCtx: PluginContext) => void
|
|
112
|
-
getAppScriptPath: () => string
|
|
113
|
-
getApp: () => ViteAppMeta
|
|
114
|
-
getPages: () => VitePageMeta[]
|
|
115
|
-
isApp: (id: string) => boolean
|
|
116
|
-
isPage: (id: string) => boolean
|
|
117
|
-
isComponent: (id: string) => boolean
|
|
118
|
-
isNativePageORComponent: (templatePath: string) => boolean
|
|
119
|
-
getPageById: (id: string) => VitePageMeta| undefined
|
|
120
|
-
getComponentById: (id: string) => VitePageMeta| undefined
|
|
121
|
-
getConfigFilePath: (filePath: string) => string
|
|
122
|
-
getTargetFilePath: (filePath: string, targetExtName: string) => string
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface ViteH5CompilerContext extends ViteCompilerContext<ViteH5BuildConfig> {
|
|
126
|
-
getBrowserslist: () => void
|
|
127
|
-
routerMeta: {
|
|
128
|
-
routerCreator: string
|
|
129
|
-
getRoutesConfig: (pageName?: string) => string
|
|
130
|
-
}
|
|
131
|
-
browserslist: string[]
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export interface ViteHarmonyCompilerContext extends ViteCompilerContext<ViteHarmonyBuildConfig> {
|
|
135
|
-
nativeExt: string[]
|
|
136
|
-
fileType: ViteFileType
|
|
137
|
-
commonChunks: string[]
|
|
138
|
-
extraComponents: string[]
|
|
139
|
-
nativeComponents : Map<string, ViteNativeCompMeta>
|
|
140
|
-
getCommonChunks: () => string[]
|
|
141
|
-
modifyHarmonyConfig: (config: Partial<AppConfig>) => void
|
|
142
|
-
modifyHostPackage: (deps?: Record<string, string>, devDeps?: Record<string, string>) => Exclude<IHarmonyConfig['ohPackage'], void>
|
|
143
|
-
collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => void
|
|
144
|
-
getScriptPath: (filePath: string) => string
|
|
145
|
-
getStylePath: (filePath: string) => string
|
|
146
|
-
getConfigPath: (filePath: string) => string
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export interface ViteMiniCompilerContext extends ViteCompilerContext<ViteMiniBuildConfig> {
|
|
150
|
-
fileType: ViteFileType
|
|
151
|
-
commonChunks: string[]
|
|
152
|
-
nativeComponents : Map<string, ViteNativeCompMeta>
|
|
153
|
-
getCommonChunks: () => string[]
|
|
154
|
-
collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => void
|
|
155
|
-
getScriptPath: (filePath: string) => string
|
|
156
|
-
getTemplatePath: (filePath: string) => string
|
|
157
|
-
getStylePath: (filePath: string) => string
|
|
158
|
-
getConfigPath: (filePath: string) => string
|
|
159
|
-
}
|