@tarojs/taro 3.7.0-alpha.18 → 3.7.0-alpha.19
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro",
|
|
3
|
-
"version": "3.7.0-alpha.
|
|
3
|
+
"version": "3.7.0-alpha.19",
|
|
4
4
|
"description": "Taro framework",
|
|
5
5
|
"homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
|
|
6
6
|
"main": "index.js",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"author": "O2Team",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@tarojs/api": "3.7.0-alpha.
|
|
25
|
-
"@tarojs/runtime": "3.7.0-alpha.
|
|
24
|
+
"@tarojs/api": "3.7.0-alpha.19",
|
|
25
|
+
"@tarojs/runtime": "3.7.0-alpha.19"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@tarojs/helper": "3.7.0-alpha.
|
|
29
|
-
"@tarojs/shared": "3.7.0-alpha.
|
|
28
|
+
"@tarojs/helper": "3.7.0-alpha.19",
|
|
29
|
+
"@tarojs/shared": "3.7.0-alpha.19"
|
|
30
30
|
},
|
|
31
31
|
"peerDependenciesMeta": {
|
|
32
32
|
"@types/react": {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { swc } from '@tarojs/helper'
|
|
2
2
|
import type Webpack from 'webpack'
|
|
3
3
|
|
|
4
|
-
type CompilerTypes =
|
|
4
|
+
export type CompilerTypes = CompilerWebpackTypes | 'vite'
|
|
5
|
+
|
|
6
|
+
export type CompilerWebpackTypes = 'webpack5' | 'webpack4'
|
|
5
7
|
|
|
6
8
|
interface IPrebundle {
|
|
7
9
|
enable?: boolean
|
|
@@ -17,9 +19,10 @@ interface IPrebundle {
|
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
interface ICompiler {
|
|
21
|
-
type:
|
|
22
|
+
interface ICompiler<T> {
|
|
23
|
+
type: T
|
|
22
24
|
prebundle?: IPrebundle
|
|
25
|
+
vitePlugins?: any
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
export type Compiler
|
|
28
|
+
export type Compiler<T extends CompilerTypes = CompilerWebpackTypes> = T | ICompiler<T>
|
|
@@ -4,6 +4,7 @@ import type webpackDevServer from 'webpack-dev-server'
|
|
|
4
4
|
import type HtmlWebpackPlugin from 'html-webpack-plugin'
|
|
5
5
|
import type { IOption, IPostcssOption, IUrlLoaderOption } from './util'
|
|
6
6
|
import type { OutputOptions as RollupOutputOptions } from 'rollup'
|
|
7
|
+
import type { CompilerTypes, CompilerWebpackTypes } from '../compiler'
|
|
7
8
|
|
|
8
9
|
export interface IH5RouterConfig {
|
|
9
10
|
/** 配置路由模式 */
|
|
@@ -17,7 +18,7 @@ export interface IH5RouterConfig {
|
|
|
17
18
|
forcePath?: string
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
export interface IH5Config <T
|
|
21
|
+
export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
|
|
21
22
|
/** 设置输出解析文件的目录(默认值:'/')*/
|
|
22
23
|
publicPath?: string
|
|
23
24
|
|
|
@@ -36,8 +37,9 @@ export interface IH5Config <T = 'webapck' | 'vite'> {
|
|
|
36
37
|
*/
|
|
37
38
|
webpackChain?: (chain: Chain, webpack: typeof Webpack) => void
|
|
38
39
|
|
|
39
|
-
/** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/)
|
|
40
|
-
|
|
40
|
+
/** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/)
|
|
41
|
+
* vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
|
|
42
|
+
*/
|
|
41
43
|
output?: T extends 'vite' ? Pick<RollupOutputOptions, 'chunkFileNames' | 'assetFileNames' > : Webpack.Configuration['output']
|
|
42
44
|
|
|
43
45
|
/** 路由相关的配置 */
|
|
@@ -2,6 +2,7 @@ import type Webpack from 'webpack'
|
|
|
2
2
|
import type Chain from 'webpack-chain'
|
|
3
3
|
import type { IOption, IPostcssOption, IUrlLoaderOption } from './util'
|
|
4
4
|
import type { OutputOptions as RollupOutputOptions } from 'rollup'
|
|
5
|
+
import type { CompilerTypes, CompilerWebpackTypes } from '../compiler'
|
|
5
6
|
|
|
6
7
|
interface Runtime {
|
|
7
8
|
enableInnerHTML: boolean
|
|
@@ -28,7 +29,7 @@ interface OutputExt {
|
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
export interface IMiniAppConfig<T
|
|
32
|
+
export interface IMiniAppConfig<T extends CompilerTypes = CompilerWebpackTypes> {
|
|
32
33
|
/** 默认值:'cheap-module-source-map', 具体参考[Webpack devtool 配置](https://webpack.js.org/configuration/devtool/#devtool) */
|
|
33
34
|
sourceMapType?: string
|
|
34
35
|
|
|
@@ -54,7 +55,8 @@ export interface IMiniAppConfig<T = 'webpack' | 'vite'> {
|
|
|
54
55
|
webpackChain?: (chain: Chain, webpack: typeof Webpack, PARSE_AST_TYPE: any) => void
|
|
55
56
|
|
|
56
57
|
/** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/)
|
|
57
|
-
vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames
|
|
58
|
+
* vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
|
|
59
|
+
*/
|
|
58
60
|
output?: T extends 'vite'
|
|
59
61
|
? Pick<RollupOutputOptions, 'chunkFileNames'> & OutputExt
|
|
60
62
|
: Webpack.Configuration['output'] & OutputExt
|
|
@@ -110,7 +112,7 @@ export interface IMiniAppConfig<T = 'webpack' | 'vite'> {
|
|
|
110
112
|
|
|
111
113
|
export interface IMiniFilesConfig {
|
|
112
114
|
[configName: string]: {
|
|
113
|
-
content:
|
|
115
|
+
content: any
|
|
114
116
|
path: string
|
|
115
117
|
}
|
|
116
118
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type Webpack from 'webpack'
|
|
2
2
|
import type Chain from 'webpack-chain'
|
|
3
3
|
import { type Input } from 'postcss'
|
|
4
|
-
import type { Compiler } from '../compiler'
|
|
4
|
+
import type { Compiler, IPrebundle, CompilerTypes, CompilerWebpackTypes } from '../compiler'
|
|
5
5
|
import type { IModifyChainData } from '../hooks'
|
|
6
6
|
import type { ICopyOptions, IOption, ISassOptions, TogglableOptions } from './util'
|
|
7
7
|
import type { IH5Config } from './h5'
|
|
8
8
|
import type { IMiniAppConfig, IMiniFilesConfig } from './mini'
|
|
9
9
|
import type { IRNConfig } from './rn'
|
|
10
|
-
import type { IPrebundle } from '../compiler'
|
|
11
10
|
|
|
12
11
|
export type PluginItem<T = object> = string | [string, T] | [string, () => T | Promise<T>]
|
|
13
12
|
|
|
@@ -204,9 +203,7 @@ export interface IProjectBaseConfig {
|
|
|
204
203
|
}
|
|
205
204
|
|
|
206
205
|
/** 暴露出来给 config/index 使用的配置类型,参考 https://github.com/NervJS/taro-doctor/blob/main/assets/config_schema.json */
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
interface IBaseProjectConfig {
|
|
206
|
+
export interface IProjectConfig<T extends CompilerTypes = CompilerWebpackTypes> {
|
|
210
207
|
/** 项目名称 */
|
|
211
208
|
projectName?: string
|
|
212
209
|
|
|
@@ -298,42 +295,23 @@ interface IBaseProjectConfig {
|
|
|
298
295
|
/** 使用的开发框架。可选值:react、preact、nerv、vue、vue3 */
|
|
299
296
|
framework?: 'react' | 'preact' | 'nerv' | 'vue' | 'vue3'
|
|
300
297
|
|
|
301
|
-
/** 使用的编译工具。可选值:webpack4、webpack5、vite */
|
|
302
|
-
compiler?: Compiler
|
|
303
|
-
|
|
304
298
|
/** Webpack5 持久化缓存配置。具体配置请参考 [WebpackConfig.cache](https://webpack.js.org/configuration/cache/#cache) */
|
|
305
299
|
cache?: ICache
|
|
306
300
|
|
|
307
301
|
/** 控制 Taro 编译日志的输出方式 */
|
|
308
302
|
logger?: ILogger
|
|
309
303
|
|
|
310
|
-
/**
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
[key: string]: any
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
export interface IViteProjectConfig extends IBaseProjectConfig {
|
|
318
|
-
compiler?: 'vite' | {
|
|
319
|
-
type: 'vite'
|
|
320
|
-
prebundle?: IPrebundle
|
|
321
|
-
vitePlugins?: any[]
|
|
322
|
-
}
|
|
304
|
+
/** 使用的编译工具。可选值:webpack4、webpack5、vite */
|
|
305
|
+
compiler?: Compiler<T>
|
|
323
306
|
|
|
324
307
|
/** 专属于 H5 的配置 */
|
|
325
|
-
h5?: IH5Config<
|
|
308
|
+
h5?: IH5Config<T>
|
|
326
309
|
|
|
327
310
|
/** 专属于小程序的配置 */
|
|
328
|
-
mini?: IMiniAppConfig<
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
interface IWebpackProjectConfig extends IBaseProjectConfig {
|
|
332
|
-
/** 专属于 H5 的配置 */
|
|
333
|
-
h5?: IH5Config<'webpack'>
|
|
311
|
+
mini?: IMiniAppConfig<T>
|
|
334
312
|
|
|
335
|
-
/**
|
|
336
|
-
|
|
337
|
-
}
|
|
313
|
+
/** 专属于 RN 的配置 */
|
|
314
|
+
rn?: IRNConfig
|
|
338
315
|
|
|
339
|
-
|
|
316
|
+
[key: string]: any
|
|
317
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AppConfig, PageConfig } from "../index"
|
|
2
2
|
import type { IMiniFilesConfig, IH5Config, IMiniAppConfig } from "./config"
|
|
3
|
-
import type {
|
|
3
|
+
import type { IProjectConfig } from './config/project'
|
|
4
4
|
import type { PluginContext } from "rollup"
|
|
5
5
|
import { IComponentConfig } from "./hooks"
|
|
6
6
|
|
|
@@ -48,7 +48,7 @@ export interface ViteH5BuildConfig extends CommonBuildConfig, IH5Config<'vite'>
|
|
|
48
48
|
runtimePath?: string | string[]
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export interface CommonBuildConfig extends
|
|
51
|
+
export interface CommonBuildConfig extends IProjectConfig<'vite'> {
|
|
52
52
|
entry: {
|
|
53
53
|
app: string | string[]
|
|
54
54
|
}
|
|
@@ -88,7 +88,6 @@ export interface ViteCompilerContext<T> {
|
|
|
88
88
|
sourceDir: string
|
|
89
89
|
taroConfig: T
|
|
90
90
|
rawTaroConfig: T
|
|
91
|
-
processConfig: () => void
|
|
92
91
|
frameworkExts: string[]
|
|
93
92
|
app: ViteAppMeta
|
|
94
93
|
pages: VitePageMeta[]
|