@xfe-repo/mini-app 1.6.3 → 2.0.0-beta.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/README.md +29 -2
- package/babel.config.js +2 -12
- package/config/dev.ts +1 -25
- package/config/index.ts +50 -14
- package/config/prod.ts +1 -7
- package/dist/{chunk-75BJNL7E.mjs → chunk-UC6ZB6VU.mjs} +4 -1
- package/dist/chunk-Y6FXYEAI.mjs +11 -0
- package/dist/cli.js +29 -6
- package/dist/cli.mjs +27 -6
- package/dist/config.d.mts +5 -5
- package/dist/config.d.ts +5 -5
- package/dist/config.js +4 -1
- package/dist/config.mjs +2 -1
- package/dist/preview.mjs +1 -0
- package/dist/upload.mjs +1 -0
- package/package.json +17 -17
package/README.md
CHANGED
|
@@ -1,7 +1,34 @@
|
|
|
1
1
|
# `@xfe-repo/mini-app`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
统一管理小程序与 H5 的 Taro 工具链,当前稳定版本为 Taro **4.3.2**,继续使用 React/ReactDOM **18.2.0**。Taro React 渲染器要求 React 18,不能直接复用 Web 的 React 19。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 兼容配置
|
|
6
|
+
|
|
7
|
+
兼容逻辑直接在现有 `config/index.ts` 中归并,不增加配置文件:
|
|
8
|
+
|
|
9
|
+
- React 与已直接安装的 React Redux/RTK 单实例别名,使用消费应用的运行时。
|
|
10
|
+
- H5 的 ReactDOM 别名;小程序的 ReactDOM → Taro 渲染器映射由官方插件接管。
|
|
11
|
+
- Mini/H5 共用的 TypeScript 路径解析。
|
|
12
|
+
- H5 启动前的 `core-js/stable` 和生产依赖转译。
|
|
13
|
+
|
|
14
|
+
`createRuntimeAliases()` 统一运行时别名;`configureWebpack()` 共用于 Mini/H5,同时装配路径解析、开发路由类型和 H5 polyfill,避免 dev 配置覆盖主配置的 webpackChain。`dev.ts`、`prod.ts` 只保留环境差异;浏览器语法目标仍由 `babel.config.js` 维护。业务仍只使用 `xfe-mini` 命令,不维护底层构建配置。
|
|
15
|
+
|
|
16
|
+
## Taro 升级
|
|
17
|
+
|
|
18
|
+
所有 Mini 包的 Taro 依赖、peer、Babel preset 和 ESLint 配置统一引用 `pnpm-workspace.yaml` 的 `catalogs.taro`。更新版本时需同步修改该 catalog 中所有项目,不混用 CLI/运行时版本。pnpm 打包会将 `catalog:taro` 替换为实际版本,不要求下游项目配置 catalog。
|
|
19
|
+
|
|
20
|
+
本次由 4.0.8 升级到 4.3.2,不切换 Webpack 5、不升级 React 主版本。下游项目如直接声明了 `@tarojs/*`、`babel-preset-taro` 或 `eslint-config-taro`,也应同步到 4.3.2,然后重新安装依赖、执行 weapp 与 H5 构建。
|
|
21
|
+
|
|
22
|
+
参考:[Taro 4.3.2 发布记录](https://github.com/NervJS/taro/releases/tag/v4.3.2)、[React 渲染器兼容范围](https://github.com/NervJS/taro/blob/v4.3.2/packages/taro-react/package.json)。
|
|
23
|
+
|
|
24
|
+
## 升级验证(2026-11-05)
|
|
25
|
+
|
|
26
|
+
- Mini 工具链、运行时、peer 均解析到 4.3.2;发布 tarball 的 catalog 已替换为实际版本,不包含额外兼容配置文件。
|
|
27
|
+
- 10 个相关框架包构建通过;Mini/Web 示例类型检查和 Mini 配置类型检查通过。
|
|
28
|
+
- weapp、H5 生产构建与 H5 开发预编译通过,开发首页及脚本返回 200。
|
|
29
|
+
- 配置 9 项、Mini register 4 项、Redux 14 项、路由生成器 6 项测试通过;覆盖开发配置合并、多个 Query API 及 H5 页面配置不在模块图中的场景。
|
|
30
|
+
- Taro 新类型中的可选 request header 已适配,H5 自动路由仍保留页面标题。
|
|
31
|
+
|
|
32
|
+
H5 构建仍有 bundle 体积及旧 Browserslist 数据告警;未做真机或旧浏览器交互回归。
|
|
6
33
|
|
|
7
34
|
这是 JS 兼容基线;具体组件样式和浏览器 Web API 仍需在目标浏览器验证。
|
package/babel.config.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
// https://docs.taro.zone/docs/next/babel-config
|
|
1
|
+
/** Babel 的框架转换与 H5 浏览器语法目标。 */
|
|
3
2
|
module.exports = {
|
|
4
3
|
presets: [
|
|
5
4
|
[
|
|
@@ -9,16 +8,7 @@ module.exports = {
|
|
|
9
8
|
ts: true,
|
|
10
9
|
compiler: 'webpack5',
|
|
11
10
|
targets:
|
|
12
|
-
process.env.TARO_ENV === 'h5'
|
|
13
|
-
? {
|
|
14
|
-
edge: '18',
|
|
15
|
-
chrome: '64',
|
|
16
|
-
firefox: '60',
|
|
17
|
-
safari: '12',
|
|
18
|
-
ios: '9',
|
|
19
|
-
android: '5',
|
|
20
|
-
}
|
|
21
|
-
: undefined,
|
|
11
|
+
process.env.TARO_ENV === 'h5' ? { edge: '18', chrome: '64', firefox: '60', safari: '12', ios: '9', android: '5' } : undefined,
|
|
22
12
|
},
|
|
23
13
|
],
|
|
24
14
|
],
|
package/config/dev.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
/** 开发环境只维护日志与服务选项,共用插件由主配置统一装配。 */
|
|
1
2
|
import type { UserConfigExport } from '@tarojs/cli'
|
|
2
|
-
import RoutesDefineWebpackPlugin from '@xfe-repo/routes-define-webpack-plugin'
|
|
3
|
-
import path from 'path'
|
|
4
|
-
import { appProjectRootRelPath } from '.'
|
|
5
3
|
|
|
6
4
|
export default {
|
|
7
5
|
env: {
|
|
@@ -11,29 +9,7 @@ export default {
|
|
|
11
9
|
quiet: false,
|
|
12
10
|
stats: true,
|
|
13
11
|
},
|
|
14
|
-
mini: {
|
|
15
|
-
webpackChain(chain) {
|
|
16
|
-
// 生成路由定义文件
|
|
17
|
-
chain.plugin('routesDefine').use(RoutesDefineWebpackPlugin, [
|
|
18
|
-
{
|
|
19
|
-
routePrefix: 'pages',
|
|
20
|
-
routeSuffix: 'index',
|
|
21
|
-
outputPath: path.join(appProjectRootRelPath, 'src'),
|
|
22
|
-
},
|
|
23
|
-
])
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
12
|
h5: {
|
|
27
|
-
webpackChain(chain) {
|
|
28
|
-
// 生成路由定义文件
|
|
29
|
-
chain.plugin('routesDefine').use(RoutesDefineWebpackPlugin, [
|
|
30
|
-
{
|
|
31
|
-
routePrefix: 'pages',
|
|
32
|
-
routeSuffix: 'index',
|
|
33
|
-
outputPath: path.join(appProjectRootRelPath, 'src'),
|
|
34
|
-
},
|
|
35
|
-
])
|
|
36
|
-
},
|
|
37
13
|
devServer: {
|
|
38
14
|
port: 9000,
|
|
39
15
|
},
|
package/config/index.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
/** 小程序通用构建配置,运行时别名与 Mini/H5 共用插件在此统一维护。 */
|
|
1
2
|
import { defineConfig, type UserConfigExport } from '@tarojs/cli'
|
|
3
|
+
import type { IH5Config } from '@tarojs/taro/types/compile'
|
|
4
|
+
import RoutesDefineWebpackPlugin from '@xfe-repo/routes-define-webpack-plugin'
|
|
2
5
|
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'
|
|
6
|
+
import { existsSync } from 'node:fs'
|
|
3
7
|
import path from 'path'
|
|
4
8
|
import devConfig from './dev'
|
|
5
9
|
import prodConfig from './prod'
|
|
@@ -16,6 +20,40 @@ export const XFE_JWT_AUD = JSON.stringify(process.env.XFE_JWT_AUD || '')
|
|
|
16
20
|
export const XFE_JWT_PRIVATE_KEY = JSON.stringify(process.env.XFE_JWT_PRIVATE_KEY || '')
|
|
17
21
|
export const XFE_JWT_KEY_ID = JSON.stringify(process.env.XFE_JWT_KEY_ID || '')
|
|
18
22
|
|
|
23
|
+
const createRuntimeAliases = () => {
|
|
24
|
+
const runtimes = ['react', 'react-redux', '@reduxjs/toolkit']
|
|
25
|
+
|
|
26
|
+
// 小程序渲染器由 Taro 接管,只有 H5 使用应用自己的 ReactDOM。
|
|
27
|
+
if (process.env.TARO_ENV === 'h5') runtimes.push('react-dom')
|
|
28
|
+
|
|
29
|
+
return Object.fromEntries(
|
|
30
|
+
runtimes
|
|
31
|
+
.filter((name) => name === 'react' || existsSync(path.join(appProjectRootAbsPath, 'node_modules', name)))
|
|
32
|
+
.map((name) => [name, path.join(appProjectRootAbsPath, 'node_modules', name)]),
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const configureWebpack: NonNullable<IH5Config<'webpack5'>['webpackChain']> = (chain, webpack) => {
|
|
37
|
+
chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin)
|
|
38
|
+
|
|
39
|
+
if (process.env.NODE_ENV === 'development') {
|
|
40
|
+
chain
|
|
41
|
+
.plugin('routesDefine')
|
|
42
|
+
.use(RoutesDefineWebpackPlugin, [{ routePrefix: 'pages', routeSuffix: 'index', outputPath: path.join(appProjectRootAbsPath, 'src') }])
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (process.env.TARO_ENV !== 'h5') return
|
|
46
|
+
|
|
47
|
+
// 保留 Taro 用于预编译的应用入口,polyfill 由独立插件优先加载。
|
|
48
|
+
chain
|
|
49
|
+
.plugin('h5-polyfill')
|
|
50
|
+
.use(webpack.EntryPlugin, [
|
|
51
|
+
appProjectRootAbsPath,
|
|
52
|
+
require.resolve('core-js/stable', { paths: [require.resolve('babel-preset-taro')] }),
|
|
53
|
+
{ name: 'app' },
|
|
54
|
+
])
|
|
55
|
+
}
|
|
56
|
+
|
|
19
57
|
export default defineConfig<'webpack5'>(async (merge) => {
|
|
20
58
|
const baseConfig: UserConfigExport<'webpack5'> = {
|
|
21
59
|
projectName: 'xfe-mini',
|
|
@@ -40,7 +78,7 @@ export default defineConfig<'webpack5'>(async (merge) => {
|
|
|
40
78
|
},
|
|
41
79
|
// 别名 需要注意 此处需要提供绝对路径
|
|
42
80
|
alias: {
|
|
43
|
-
|
|
81
|
+
...createRuntimeAliases(),
|
|
44
82
|
'@': path.join(appProjectRootAbsPath, 'src'),
|
|
45
83
|
'@common/services': '@xfe-repo/mini-service',
|
|
46
84
|
},
|
|
@@ -56,6 +94,7 @@ export default defineConfig<'webpack5'>(async (merge) => {
|
|
|
56
94
|
enable: false, // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
|
|
57
95
|
},
|
|
58
96
|
mini: {
|
|
97
|
+
webpackChain: configureWebpack,
|
|
59
98
|
miniCssExtractPluginOption: {
|
|
60
99
|
ignoreOrder: true,
|
|
61
100
|
},
|
|
@@ -81,11 +120,15 @@ export default defineConfig<'webpack5'>(async (merge) => {
|
|
|
81
120
|
},
|
|
82
121
|
},
|
|
83
122
|
},
|
|
84
|
-
webpackChain(chain) {
|
|
85
|
-
chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin)
|
|
86
|
-
},
|
|
87
123
|
},
|
|
88
124
|
h5: {
|
|
125
|
+
webpackChain: configureWebpack,
|
|
126
|
+
compile: {
|
|
127
|
+
include:
|
|
128
|
+
process.env.NODE_ENV === 'production'
|
|
129
|
+
? [(filename: string) => !/node_modules[/\\](@babel|core-js|style-loader|css-loader|react|react-dom)[/\\]/.test(filename)]
|
|
130
|
+
: [],
|
|
131
|
+
},
|
|
89
132
|
router: {
|
|
90
133
|
mode: 'browser',
|
|
91
134
|
},
|
|
@@ -115,10 +158,6 @@ export default defineConfig<'webpack5'>(async (merge) => {
|
|
|
115
158
|
},
|
|
116
159
|
},
|
|
117
160
|
},
|
|
118
|
-
webpackChain(chain) {
|
|
119
|
-
chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin)
|
|
120
|
-
chain.entry('app').prepend(require.resolve('core-js/stable', { paths: [require.resolve('babel-preset-taro')] }))
|
|
121
|
-
},
|
|
122
161
|
},
|
|
123
162
|
rn: {
|
|
124
163
|
appName: 'xfe-mini',
|
|
@@ -129,10 +168,7 @@ export default defineConfig<'webpack5'>(async (merge) => {
|
|
|
129
168
|
},
|
|
130
169
|
},
|
|
131
170
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
// 生产构建配置(默认开启压缩混淆等)
|
|
137
|
-
return merge({}, baseConfig, prodConfig)
|
|
171
|
+
const environmentConfig = process.env.NODE_ENV === 'development' ? devConfig : prodConfig
|
|
172
|
+
|
|
173
|
+
return merge({}, baseConfig, environmentConfig)
|
|
138
174
|
})
|
package/config/prod.ts
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
+
/** 生产环境只声明环境差异,共用构建选项由主配置维护。 */
|
|
1
2
|
import type { UserConfigExport } from '@tarojs/cli'
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
5
|
env: {
|
|
5
6
|
NODE_ENV: '"production"',
|
|
6
7
|
},
|
|
7
|
-
mini: {},
|
|
8
|
-
h5: {
|
|
9
|
-
compile: {
|
|
10
|
-
// 工作区依赖可能解析到 node_modules 外,也需要转译。
|
|
11
|
-
include: [(filename: string) => !/node_modules[/\\](@babel|core-js|style-loader|css-loader|react|react-dom)[/\\]/.test(filename)],
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
8
|
} satisfies UserConfigExport<'webpack5'>
|
|
@@ -176,7 +176,10 @@ var getJwtEnv = function getJwtEnv() {
|
|
|
176
176
|
switch(_state.label){
|
|
177
177
|
case 0:
|
|
178
178
|
xfeConfig = loadXfeConfig();
|
|
179
|
-
if (!(xfeConfig === null || xfeConfig === void 0 ? void 0 : xfeConfig.jwt))
|
|
179
|
+
if (!(xfeConfig === null || xfeConfig === void 0 ? void 0 : xfeConfig.jwt)) return [
|
|
180
|
+
2,
|
|
181
|
+
{}
|
|
182
|
+
];
|
|
180
183
|
_xfeConfig_jwt = xfeConfig.jwt, _xfeConfig_jwt_aud = _xfeConfig_jwt.aud, aud = _xfeConfig_jwt_aud === void 0 ? "" : _xfeConfig_jwt_aud;
|
|
181
184
|
if (!aud) throw new Error("xfe.json \u4E2D\u7684 jwt \u914D\u7F6E\u4E0D\u5B8C\u6574\uFF0C\u8BF7\u786E\u4FDD\u5305\u542B aud \u5B57\u6BB5\u3002");
|
|
182
185
|
return [
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ function(x) {
|
|
2
|
+
return typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
|
+
get: function get(a, b) {
|
|
4
|
+
return (typeof require !== "undefined" ? require : a)[b];
|
|
5
|
+
}
|
|
6
|
+
}) : x;
|
|
7
|
+
}(function(x) {
|
|
8
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
9
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
10
|
+
});
|
|
11
|
+
export { __require };
|
package/dist/cli.js
CHANGED
|
@@ -7,6 +7,9 @@ function _array_like_to_array(arr, len) {
|
|
|
7
7
|
function _array_with_holes(arr) {
|
|
8
8
|
if (Array.isArray(arr)) return arr;
|
|
9
9
|
}
|
|
10
|
+
function _array_without_holes(arr) {
|
|
11
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
12
|
+
}
|
|
10
13
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
11
14
|
try {
|
|
12
15
|
var info = gen[key](arg);
|
|
@@ -62,6 +65,9 @@ function _inherits(subClass, superClass) {
|
|
|
62
65
|
});
|
|
63
66
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
64
67
|
}
|
|
68
|
+
function _iterable_to_array(iter) {
|
|
69
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
70
|
+
}
|
|
65
71
|
function _iterable_to_array_limit(arr, i) {
|
|
66
72
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
67
73
|
if (_i == null) return;
|
|
@@ -89,6 +95,9 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
89
95
|
function _non_iterable_rest() {
|
|
90
96
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
91
97
|
}
|
|
98
|
+
function _non_iterable_spread() {
|
|
99
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
100
|
+
}
|
|
92
101
|
function _object_spread(target) {
|
|
93
102
|
for(var i = 1; i < arguments.length; i++){
|
|
94
103
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -174,6 +183,9 @@ function _set_prototype_of(o, p) {
|
|
|
174
183
|
function _sliced_to_array(arr, i) {
|
|
175
184
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
176
185
|
}
|
|
186
|
+
function _to_consumable_array(arr) {
|
|
187
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
188
|
+
}
|
|
177
189
|
function _type_of(obj) {
|
|
178
190
|
"@swc/helpers - typeof";
|
|
179
191
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
@@ -393,7 +405,7 @@ var __toESM = function __toESM(mod, isNodeMode, target) {
|
|
|
393
405
|
// src/cli.ts
|
|
394
406
|
var import_minimist = __toESM(require("minimist"));
|
|
395
407
|
var import_path3 = __toESM(require("path"));
|
|
396
|
-
var
|
|
408
|
+
var import_node_child_process = require("child_process");
|
|
397
409
|
// src/config.ts
|
|
398
410
|
var import_path = __toESM(require("path"));
|
|
399
411
|
var import_fs = __toESM(require("fs"));
|
|
@@ -444,7 +456,10 @@ var getJwtEnv = function getJwtEnv() {
|
|
|
444
456
|
switch(_state.label){
|
|
445
457
|
case 0:
|
|
446
458
|
xfeConfig = loadXfeConfig();
|
|
447
|
-
if (!(xfeConfig === null || xfeConfig === void 0 ? void 0 : xfeConfig.jwt))
|
|
459
|
+
if (!(xfeConfig === null || xfeConfig === void 0 ? void 0 : xfeConfig.jwt)) return [
|
|
460
|
+
2,
|
|
461
|
+
{}
|
|
462
|
+
];
|
|
448
463
|
_xfeConfig_jwt = xfeConfig.jwt, _xfeConfig_jwt_aud = _xfeConfig_jwt.aud, aud = _xfeConfig_jwt_aud === void 0 ? "" : _xfeConfig_jwt_aud;
|
|
449
464
|
if (!aud) throw new Error("xfe.json \u4E2D\u7684 jwt \u914D\u7F6E\u4E0D\u5B8C\u6574\uFF0C\u8BF7\u786E\u4FDD\u5305\u542B aud \u5B57\u6BB5\u3002");
|
|
450
465
|
return [
|
|
@@ -643,10 +658,11 @@ var appProjectRoot = process.cwd();
|
|
|
643
658
|
var env = _object_spread_props(_object_spread({}, process.env), {
|
|
644
659
|
APP_PROJECT_ROOT: appProjectRoot
|
|
645
660
|
});
|
|
646
|
-
var
|
|
661
|
+
var taroBin = require.resolve("@tarojs/cli/bin/taro");
|
|
662
|
+
var taroArgs = Object.entries(args).map(function(param) {
|
|
647
663
|
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
648
664
|
return "--".concat(key, "=").concat(value);
|
|
649
|
-
})
|
|
665
|
+
});
|
|
650
666
|
function main() {
|
|
651
667
|
return _async_to_generator(function() {
|
|
652
668
|
var jwtEnv, jwtEnv1, v, version, d, desc, P, progress, v1, version1, p, previewPath, d1, desc1, s, scene, P1, progress1;
|
|
@@ -663,7 +679,11 @@ function main() {
|
|
|
663
679
|
];
|
|
664
680
|
case 1:
|
|
665
681
|
jwtEnv = _state.sent();
|
|
666
|
-
(0,
|
|
682
|
+
(0, import_node_child_process.execFileSync)(process.execPath, [
|
|
683
|
+
taroBin,
|
|
684
|
+
"build",
|
|
685
|
+
"--watch"
|
|
686
|
+
].concat(_to_consumable_array(taroArgs)), {
|
|
667
687
|
stdio: "inherit",
|
|
668
688
|
cwd: appPackageRoot,
|
|
669
689
|
env: _object_spread({}, env, jwtEnv)
|
|
@@ -683,7 +703,10 @@ function main() {
|
|
|
683
703
|
];
|
|
684
704
|
case 3:
|
|
685
705
|
jwtEnv1 = _state.sent();
|
|
686
|
-
(0,
|
|
706
|
+
(0, import_node_child_process.execFileSync)(process.execPath, [
|
|
707
|
+
taroBin,
|
|
708
|
+
"build"
|
|
709
|
+
].concat(_to_consumable_array(taroArgs)), {
|
|
687
710
|
stdio: "inherit",
|
|
688
711
|
cwd: appPackageRoot,
|
|
689
712
|
env: _object_spread({}, env, jwtEnv1)
|
package/dist/cli.mjs
CHANGED
|
@@ -6,6 +6,9 @@ function _array_like_to_array(arr, len) {
|
|
|
6
6
|
function _array_with_holes(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
+
function _array_without_holes(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
|
+
}
|
|
9
12
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
10
13
|
try {
|
|
11
14
|
var info = gen[key](arg);
|
|
@@ -48,6 +51,9 @@ function _define_property(obj, key, value) {
|
|
|
48
51
|
}
|
|
49
52
|
return obj;
|
|
50
53
|
}
|
|
54
|
+
function _iterable_to_array(iter) {
|
|
55
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
56
|
+
}
|
|
51
57
|
function _iterable_to_array_limit(arr, i) {
|
|
52
58
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
53
59
|
if (_i == null) return;
|
|
@@ -75,6 +81,9 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
75
81
|
function _non_iterable_rest() {
|
|
76
82
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
77
83
|
}
|
|
84
|
+
function _non_iterable_spread() {
|
|
85
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
86
|
+
}
|
|
78
87
|
function _object_spread(target) {
|
|
79
88
|
for(var i = 1; i < arguments.length; i++){
|
|
80
89
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -153,6 +162,9 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
153
162
|
function _sliced_to_array(arr, i) {
|
|
154
163
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
155
164
|
}
|
|
165
|
+
function _to_consumable_array(arr) {
|
|
166
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
167
|
+
}
|
|
156
168
|
function _unsupported_iterable_to_array(o, minLen) {
|
|
157
169
|
if (!o) return;
|
|
158
170
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
@@ -260,13 +272,14 @@ function _ts_generator(thisArg, body) {
|
|
|
260
272
|
};
|
|
261
273
|
}
|
|
262
274
|
}
|
|
263
|
-
import { configDeploy, getJwtEnv } from "./chunk-
|
|
275
|
+
import { configDeploy, getJwtEnv } from "./chunk-UC6ZB6VU.mjs";
|
|
264
276
|
import { uploadMini } from "./chunk-4JD7C4FF.mjs";
|
|
265
277
|
import { previewMini } from "./chunk-MLSNG3O7.mjs";
|
|
278
|
+
import { __require } from "./chunk-Y6FXYEAI.mjs";
|
|
266
279
|
// src/cli.ts
|
|
267
280
|
import minimist from "minimist";
|
|
268
281
|
import path from "path";
|
|
269
|
-
import {
|
|
282
|
+
import { execFileSync } from "child_process";
|
|
270
283
|
var argv = minimist(process.argv.slice(2));
|
|
271
284
|
var commands = argv._, args = _object_without_properties(argv, [
|
|
272
285
|
"_"
|
|
@@ -277,10 +290,11 @@ var appProjectRoot = process.cwd();
|
|
|
277
290
|
var env = _object_spread_props(_object_spread({}, process.env), {
|
|
278
291
|
APP_PROJECT_ROOT: appProjectRoot
|
|
279
292
|
});
|
|
280
|
-
var
|
|
293
|
+
var taroBin = __require.resolve("@tarojs/cli/bin/taro");
|
|
294
|
+
var taroArgs = Object.entries(args).map(function(param) {
|
|
281
295
|
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
282
296
|
return "--".concat(key, "=").concat(value);
|
|
283
|
-
})
|
|
297
|
+
});
|
|
284
298
|
function main() {
|
|
285
299
|
return _async_to_generator(function() {
|
|
286
300
|
var jwtEnv, jwtEnv1, v, version, d, desc, P, progress, v1, version1, p, previewPath, d1, desc1, s, scene, P1, progress1;
|
|
@@ -297,7 +311,11 @@ function main() {
|
|
|
297
311
|
];
|
|
298
312
|
case 1:
|
|
299
313
|
jwtEnv = _state.sent();
|
|
300
|
-
|
|
314
|
+
execFileSync(process.execPath, [
|
|
315
|
+
taroBin,
|
|
316
|
+
"build",
|
|
317
|
+
"--watch"
|
|
318
|
+
].concat(_to_consumable_array(taroArgs)), {
|
|
301
319
|
stdio: "inherit",
|
|
302
320
|
cwd: appPackageRoot,
|
|
303
321
|
env: _object_spread({}, env, jwtEnv)
|
|
@@ -317,7 +335,10 @@ function main() {
|
|
|
317
335
|
];
|
|
318
336
|
case 3:
|
|
319
337
|
jwtEnv1 = _state.sent();
|
|
320
|
-
|
|
338
|
+
execFileSync(process.execPath, [
|
|
339
|
+
taroBin,
|
|
340
|
+
"build"
|
|
341
|
+
].concat(_to_consumable_array(taroArgs)), {
|
|
321
342
|
stdio: "inherit",
|
|
322
343
|
cwd: appPackageRoot,
|
|
323
344
|
env: _object_spread({}, env, jwtEnv1)
|
package/dist/config.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
declare const loadXfeConfig: () => Record<string, any>;
|
|
2
2
|
declare const configDeploy: () => void;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
/**
|
|
4
|
+
* 仅在项目声明了旧 BFF JWT 时获取签名密钥。
|
|
5
|
+
* 直连新 API 的小程序不需要这组构建时凭据。
|
|
6
|
+
*/
|
|
7
|
+
declare const getJwtEnv: () => Promise<Record<string, string>>;
|
|
8
8
|
|
|
9
9
|
export { configDeploy, getJwtEnv, loadXfeConfig };
|
package/dist/config.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
declare const loadXfeConfig: () => Record<string, any>;
|
|
2
2
|
declare const configDeploy: () => void;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
/**
|
|
4
|
+
* 仅在项目声明了旧 BFF JWT 时获取签名密钥。
|
|
5
|
+
* 直连新 API 的小程序不需要这组构建时凭据。
|
|
6
|
+
*/
|
|
7
|
+
declare const getJwtEnv: () => Promise<Record<string, string>>;
|
|
8
8
|
|
|
9
9
|
export { configDeploy, getJwtEnv, loadXfeConfig };
|
package/dist/config.js
CHANGED
|
@@ -252,7 +252,10 @@ var getJwtEnv = function getJwtEnv() {
|
|
|
252
252
|
switch(_state.label){
|
|
253
253
|
case 0:
|
|
254
254
|
xfeConfig = loadXfeConfig();
|
|
255
|
-
if (!(xfeConfig === null || xfeConfig === void 0 ? void 0 : xfeConfig.jwt))
|
|
255
|
+
if (!(xfeConfig === null || xfeConfig === void 0 ? void 0 : xfeConfig.jwt)) return [
|
|
256
|
+
2,
|
|
257
|
+
{}
|
|
258
|
+
];
|
|
256
259
|
_xfeConfig_jwt = xfeConfig.jwt, _xfeConfig_jwt_aud = _xfeConfig_jwt.aud, aud = _xfeConfig_jwt_aud === void 0 ? "" : _xfeConfig_jwt_aud;
|
|
257
260
|
if (!aud) throw new Error("xfe.json \u4E2D\u7684 jwt \u914D\u7F6E\u4E0D\u5B8C\u6574\uFF0C\u8BF7\u786E\u4FDD\u5305\u542B aud \u5B57\u6BB5\u3002");
|
|
258
261
|
return [
|
package/dist/config.mjs
CHANGED
package/dist/preview.mjs
CHANGED
package/dist/upload.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xfe-repo/mini-app",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
4
|
"bin": {
|
|
5
5
|
"xfe-mini": "./bin/index.js"
|
|
6
6
|
},
|
|
@@ -19,25 +19,25 @@
|
|
|
19
19
|
"@babel/preset-react": "^7.24.1",
|
|
20
20
|
"@babel/runtime": "^7.21.5",
|
|
21
21
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
|
|
22
|
-
"@tarojs/cli": "4.
|
|
23
|
-
"@tarojs/components": "4.
|
|
24
|
-
"@tarojs/helper": "4.
|
|
25
|
-
"@tarojs/plugin-framework-react": "4.
|
|
26
|
-
"@tarojs/plugin-platform-h5": "4.
|
|
27
|
-
"@tarojs/plugin-platform-weapp": "4.
|
|
28
|
-
"@tarojs/react": "4.
|
|
29
|
-
"@tarojs/runtime": "4.
|
|
30
|
-
"@tarojs/shared": "4.
|
|
31
|
-
"@tarojs/taro": "4.
|
|
32
|
-
"@tarojs/taro-loader": "4.
|
|
33
|
-
"@tarojs/webpack5-runner": "4.
|
|
22
|
+
"@tarojs/cli": "4.3.2",
|
|
23
|
+
"@tarojs/components": "4.3.2",
|
|
24
|
+
"@tarojs/helper": "4.3.2",
|
|
25
|
+
"@tarojs/plugin-framework-react": "4.3.2",
|
|
26
|
+
"@tarojs/plugin-platform-h5": "4.3.2",
|
|
27
|
+
"@tarojs/plugin-platform-weapp": "4.3.2",
|
|
28
|
+
"@tarojs/react": "4.3.2",
|
|
29
|
+
"@tarojs/runtime": "4.3.2",
|
|
30
|
+
"@tarojs/shared": "4.3.2",
|
|
31
|
+
"@tarojs/taro": "4.3.2",
|
|
32
|
+
"@tarojs/taro-loader": "4.3.2",
|
|
33
|
+
"@tarojs/webpack5-runner": "4.3.2",
|
|
34
34
|
"@types/minimist": "^1.2.5",
|
|
35
35
|
"@types/node": "^20.17.0",
|
|
36
36
|
"@types/react": "^18.2.0",
|
|
37
37
|
"@types/webpack-env": "^1.13.6",
|
|
38
|
-
"babel-preset-taro": "4.
|
|
38
|
+
"babel-preset-taro": "4.3.2",
|
|
39
39
|
"eslint": "^8.57.0",
|
|
40
|
-
"eslint-config-taro": "4.
|
|
40
|
+
"eslint-config-taro": "4.3.2",
|
|
41
41
|
"eslint-plugin-react": "^7.34.1",
|
|
42
42
|
"eslint-plugin-react-hooks": "^4.4.0",
|
|
43
43
|
"fs-extra": "^11.2.0",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"typescript": "5.3.3",
|
|
52
52
|
"webpack": "5.91.0",
|
|
53
53
|
"yaml": "^2.3.4",
|
|
54
|
-
"@xfe-repo/typescript-config": "
|
|
55
|
-
"@xfe-repo/routes-define-webpack-plugin": "
|
|
54
|
+
"@xfe-repo/typescript-config": "2.0.0-beta.1",
|
|
55
|
+
"@xfe-repo/routes-define-webpack-plugin": "2.0.0-beta.1"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"react": "18.2.0",
|