@tarojs/taro 4.2.3-beta.1 → 4.3.1-alpha.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro",
3
- "version": "4.2.3-beta.1",
3
+ "version": "4.3.1-alpha.0",
4
4
  "description": "Taro framework",
5
5
  "author": "O2Team",
6
6
  "license": "MIT",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@types/postcss-url": "^10.0.4",
27
- "@tarojs/api": "4.2.3-beta.1",
28
- "@tarojs/runtime": "4.2.3-beta.1"
27
+ "@tarojs/api": "4.3.1-alpha.0",
28
+ "@tarojs/runtime": "4.3.1-alpha.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "html-webpack-plugin": "^5.6.0",
@@ -33,9 +33,9 @@
33
33
  "webpack-chain": "^6.5.1",
34
34
  "webpack-dev-server": "^4.15.2",
35
35
  "rollup": "^3.29.4",
36
- "@tarojs/components": "4.2.3-beta.1",
37
- "@tarojs/helper": "4.2.3-beta.1",
38
- "@tarojs/shared": "4.2.3-beta.1"
36
+ "@tarojs/components": "4.3.1-alpha.0",
37
+ "@tarojs/helper": "4.3.1-alpha.0",
38
+ "@tarojs/shared": "4.3.1-alpha.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@types/react": "^18",
@@ -46,9 +46,9 @@
46
46
  "webpack": "^5",
47
47
  "webpack-chain": "^6",
48
48
  "webpack-dev-server": "^4",
49
- "@tarojs/components": "4.2.3-beta.1",
50
- "@tarojs/helper": "4.2.3-beta.1",
51
- "@tarojs/shared": "4.2.3-beta.1"
49
+ "@tarojs/shared": "4.3.1-alpha.0",
50
+ "@tarojs/helper": "4.3.1-alpha.0",
51
+ "@tarojs/components": "4.3.1-alpha.0"
52
52
  },
53
53
  "peerDependenciesMeta": {
54
54
  "@types/react": {
@@ -2,7 +2,7 @@ import Taro from '../../index'
2
2
 
3
3
  declare module '../../index' {
4
4
  namespace request {
5
- interface Option<T = any, U extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any> {
5
+ interface Option<T = any, U = any> {
6
6
  /** 开发者服务器接口地址 */
7
7
  url: string
8
8
  /** 请求的参数 */
@@ -150,8 +150,7 @@ declare module '../../index' {
150
150
  storeCheck?(): boolean
151
151
  }
152
152
 
153
- interface SuccessCallbackResult<T extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any>
154
- extends TaroGeneral.CallbackResult {
153
+ interface SuccessCallbackResult<T = any> extends TaroGeneral.CallbackResult {
155
154
  /** 开发者服务器返回的数据 */
156
155
  data: T
157
156
  /** 开发者服务器返回的 HTTP Response Header */
@@ -379,6 +378,11 @@ declare module '../../index' {
379
378
  }
380
379
  }
381
380
 
381
+ /** @ignore */
382
+ interface RequestParams<T = any> extends request.Option<T, any> {
383
+ [propName: string]: any
384
+ }
385
+
382
386
  /** @ignore */
383
387
  type interceptor = (chain: Chain) => any
384
388
 
@@ -31,7 +31,7 @@ declare module '../../index' {
31
31
  */
32
32
  enableQuic?: boolean
33
33
  /** 上传的文件名
34
- * @supported h5
34
+ * @supported h5, rn
35
35
  */
36
36
  fileName?: string
37
37
  /** 是否应使用传出凭据 (cookie) 发送此请求
@@ -15,6 +15,31 @@ interface Runtime {
15
15
  enableMutationObserver?: boolean
16
16
  }
17
17
 
18
+ /**
19
+ * `mini.sharedRuntimeWebpackChain` 钩子收到的第三个参数:当前运行时核子构建的核心信息。
20
+ * 同步核与异步核各调用一次钩子,`name` 区分。
21
+ */
22
+ export interface ISharedRuntimeChainData {
23
+ /** 当前核:'taro-shared-sync'(同步核)| 'async-provider'(异步核),与产物文件名一致 */
24
+ name: string
25
+ /** 产物 emit 目标相对 outputDir 的目录:同步核为 ''(根),异步核为 'shared-async-v1' */
26
+ emitTo: string
27
+ /** 异步核加载路径(require.async 目标),业务 config 的 sharedRuntimeAsyncRequest 覆盖值或默认值 */
28
+ asyncRequest: string
29
+ /** config.mini.sharedRuntimeExtraPackages:随异步核加载的额外共享包 */
30
+ extraPackages: string[]
31
+ /** config.mini.sharedRuntimeSyncExtraPackages:随同步核加载的额外共享包 */
32
+ syncExtraPackages: string[]
33
+ /** 从 runtimePath 自动识别、被作为同步核额外入口的平台插件 runtime(plugin-html 等) */
34
+ missingRuntimes: string[]
35
+ /** 业务项目根目录 */
36
+ appPath: string
37
+ /** 产物输出目录(dist) */
38
+ outputDir: string
39
+ /** 平台全局对象名,如 'wx' */
40
+ globalObject: string
41
+ }
42
+
18
43
  export interface IMiniAppConfig<T extends CompilerTypes = CompilerWebpackTypes> {
19
44
  /** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */
20
45
  enableSourceMap?: boolean
@@ -100,6 +125,43 @@ export interface IMiniAppConfig<T extends CompilerTypes = CompilerWebpackTypes>
100
125
  /** 插件内部使用 */
101
126
  runtime?: Runtime
102
127
 
128
+ /**
129
+ * 共享运行时(split 模式):额外纳入共享的运行时包名列表。
130
+ * 用于把业务自研的运行时 API 也一并 external 到共享运行时全局,随异步核共享一份。
131
+ * 仅在使用 `--shared-runtime --shared-runtime-mode split` 编译时生效。
132
+ */
133
+ sharedRuntimeExtraPackages?: string[]
134
+
135
+ /**
136
+ * 共享运行时(split 模式):需要在**同步核**阶段就执行副作用的额外共享包名列表。
137
+ * 与 `sharedRuntimeExtraPackages` 平行——后者随异步核加载(`.then` 回调,晚于首屏 onLoad),
138
+ * 前者随业务 app.js 顶层同步 `require` 立即执行。适用于必须先于首屏 window `INIT`
139
+ * 事件广播就注册监听器/设置全局状态的场景(如 rem 根字号计算的 `window.on(CONTEXT_ACTIONS.INIT)`
140
+ * 注册)。代价:每个业务包各自打包一份(不共享),故此清单应仅放**必须首屏就位**的极小内容。
141
+ * 仅在 `--shared-runtime --shared-runtime-mode split` 编译时生效。
142
+ */
143
+ sharedRuntimeSyncExtraPackages?: string[]
144
+
145
+ /**
146
+ * 共享运行时(split 模式):自定义两个运行时核(同步核 taro-shared-sync / 异步核
147
+ * async-provider)各自独立 webpack 子构建的配置。
148
+ *
149
+ * 背景:这两个子构建与主构建**完全独立**——主构建的 `webpackChain` / `modifyWebpackChain`
150
+ * 只作用于主 chain,对两核无效。此前接入方没有任何入口可定制它们;而
151
+ * `sharedRuntimeExtraPackages` 引入的私有 runtime 若需要 loader / resolve 级定制
152
+ * (如私有语法插件、特殊 alias),必须从这里改。
153
+ *
154
+ * 同步核、异步核各调用一次本钩子,`data.name` 区分当前是哪个核
155
+ * (`'taro-shared-sync'` / `'async-provider'`,与产物文件名一致)。
156
+ *
157
+ * 注意:两个子构建默认已内置 ES5 转译(babel-loader + 业务项目 babel 配置)与
158
+ * `regenerator-runtime` alias,一般无需再配置;本钩子用于在此之上的微调
159
+ * (追加 loader、改 resolve、追加 plugin 等),不建议移除内置的 babel 规则。
160
+ *
161
+ * 仅在使用 `--shared-runtime --shared-runtime-mode split` 编译时生效。
162
+ */
163
+ sharedRuntimeWebpackChain?: (chain: Chain, webpack: typeof Webpack, data: ISharedRuntimeChainData) => void
164
+
103
165
  /** 使用的编译工具。可选值:webpack5、vite */
104
166
  compiler?: Compiler<T>
105
167
 
@@ -517,7 +517,7 @@ declare module './index' {
517
517
  */
518
518
  subPackages?: SubPackage[]
519
519
  subpackages?: SubPackage[]
520
- /** 子分包独立模板配置(用于 newBlended 模式),支持多入口配置
520
+ /** 微信小程序子分包独立模板配置(用于 newBlended 模式),支持多入口配置;其他平台会忽略该配置
521
521
  * @example
522
522
  * ```js
523
523
  * subPackageIndie: [