@heybox/hb-sdk 0.9.3 → 0.9.4-alpha.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/CHANGELOG.md +13 -0
- package/dist/cli-chunks/{runtime-gate-BgWB2U5f.cjs → artifact-Dv6zPoPj.cjs} +136 -65
- package/dist/cli-chunks/{build-DrFbb0V-.cjs → build-BumRaEG6.cjs} +34 -83
- package/dist/cli-chunks/{create-Ccse2SW7.cjs → create-BQimWyVw.cjs} +1 -1
- package/dist/cli-chunks/{deploy-lock-DaGpgsU7.cjs → deploy-lock-C79P53O1.cjs} +1 -1
- package/dist/cli-chunks/{context-CTlwLbwn.cjs → dev-context-BoizHQIi.cjs} +299 -299
- package/dist/cli-chunks/{dev-BHsCFm4O.cjs → dev-kuYLlVkZ.cjs} +15469 -15357
- package/dist/cli-chunks/{doctor-BhTTMupn.cjs → doctor-DD1Uokke.cjs} +1 -1
- package/dist/cli-chunks/{games-BOP_ZDp6.cjs → games-B8OMXnyU.cjs} +2 -2
- package/dist/cli-chunks/{index-DMall69X.cjs → index-DGP5w5P8.cjs} +1 -1
- package/dist/cli-chunks/{index-CF6qh9ll.cjs → index-dXb0CRuR.cjs} +17 -17
- package/dist/cli-chunks/{index.esm-Cau47g22.cjs → index.esm-BeHd4gL3.cjs} +6 -6
- package/dist/cli-chunks/{login-BGDovscU.cjs → login-DLQ29GYc.cjs} +1 -1
- package/dist/cli-chunks/{project-vite-Dnev8Z34.cjs → project-vite-BkRatXiB.cjs} +1 -1
- package/dist/cli-chunks/{remote--MDcbz4m.cjs → remote-DKCzk6X3.cjs} +66 -144
- package/dist/cli-chunks/{runtime-permission-env-DmJ1zEpa.cjs → runtime-permission-env-DLLffpOa.cjs} +127 -128
- package/dist/cli-chunks/{skill-Bm1MmMN5.cjs → skill-kkoE3F-I.cjs} +2 -2
- package/dist/cli-chunks/{version-C6b3tkax.cjs → version-hdMctv12.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/devtools/browser-dev-host/assets/browser-dev-host-0UAlwnsV.js +102 -0
- package/dist/devtools/browser-dev-host/assets/{desktop-app-launch-Dl4RfM9z.js → desktop-app-launch-6LCHEMSe.js} +1 -1
- package/dist/devtools/browser-dev-host/assets/{index-DFLYLAXj.js → index-DW4VxPMl.js} +3 -3
- package/dist/devtools/browser-dev-host/index.html +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/vite.cjs.js +1 -1
- package/dist/vite.esm.js +1 -1
- package/package.json +6 -6
- package/skill/skill.json +4 -4
- package/dist/devtools/browser-dev-host/assets/browser-dev-host-BHtf4WWG.js +0 -102
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
本文件随 `@heybox/hb-sdk` npm 包公开分发,只记录外部小程序开发者可观察到的变化。
|
|
4
4
|
|
|
5
|
+
## 0.9.4-alpha.1 - 2026-10-26
|
|
6
|
+
|
|
7
|
+
### 行为调整
|
|
8
|
+
|
|
9
|
+
- [hb-sdk build](https://docs.xiaoheihe.cn/hb_sdk/guide/cli.html#%E7%94%9F%E4%BA%A7%E6%9E%84%E5%BB%BA) 与 [hb-sdk remote deploy](https://docs.xiaoheihe.cn/hb_sdk/guide/cli.html#%E9%83%A8%E7%BD%B2%E5%8F%91%E5%B8%83) 统一拒绝含真实反斜杠的文件名、空 `node_modules` 目录及符号链接;请调整产物内容后重新构建。
|
|
10
|
+
|
|
11
|
+
## 0.9.4-alpha.0 - 2026-10-26
|
|
12
|
+
|
|
13
|
+
### 问题修复
|
|
14
|
+
|
|
15
|
+
- 修复部分旧版 iOS 设备无法打开小程序的问题,需要 Host 配套更新。
|
|
16
|
+
- 修复小程序内返回上一页时,目标页面仍在加载却被提前判定失败的问题,需要 Host 配套更新。
|
|
17
|
+
|
|
5
18
|
## 0.9.3 - 2026-10-23
|
|
6
19
|
|
|
7
20
|
### 必须操作
|
|
@@ -1,18 +1,82 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var fs = require('node:fs');
|
|
4
|
+
var fs$1 = require('node:fs/promises');
|
|
5
|
+
var path = require('node:path');
|
|
6
|
+
var runtimePermissionEnv = require('./runtime-permission-env-DLLffpOa.cjs');
|
|
7
|
+
require('./version-hdMctv12.cjs');
|
|
8
|
+
var index = require('./index-dXb0CRuR.cjs');
|
|
3
9
|
var node_crypto = require('node:crypto');
|
|
10
|
+
require('node:zlib');
|
|
4
11
|
require('node:module');
|
|
5
12
|
require('node:url');
|
|
6
|
-
var fs = require('node:fs');
|
|
7
|
-
var path = require('node:path');
|
|
8
|
-
var runtimePermissionEnv = require('./runtime-permission-env-DmJ1zEpa.cjs');
|
|
9
|
-
var index = require('./index-CF6qh9ll.cjs');
|
|
10
13
|
var _commonjsDynamicModules = require('./_commonjs-dynamic-modules-DUamuDzp.cjs');
|
|
11
14
|
var require$$0$1 = require('fs');
|
|
12
15
|
var require$$1 = require('path');
|
|
13
16
|
var require$$0 = require('os');
|
|
14
17
|
var require$$6 = require('inspector');
|
|
15
18
|
|
|
19
|
+
// Shorthands
|
|
20
|
+
/**
|
|
21
|
+
* Parses an HTML string.
|
|
22
|
+
*
|
|
23
|
+
* @param html Input HTML string.
|
|
24
|
+
* @param options Parsing options.
|
|
25
|
+
* @returns Document
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
*
|
|
29
|
+
* ```js
|
|
30
|
+
* const parse5 = require('parse5');
|
|
31
|
+
*
|
|
32
|
+
* const document = parse5.parse('<!DOCTYPE html><html><head></head><body>Hi there!</body></html>');
|
|
33
|
+
*
|
|
34
|
+
* console.log(document.childNodes[1].tagName); //> 'html'
|
|
35
|
+
*```
|
|
36
|
+
*/
|
|
37
|
+
function parse(html, options) {
|
|
38
|
+
return runtimePermissionEnv.Parser.parse(html, options);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const RUNTIME_GATE_MARKER = 'data-heybox-runtime-gate';
|
|
42
|
+
const RUNTIME_GATE_STYLE_MARKER = 'data-heybox-runtime-gate-style';
|
|
43
|
+
const RUNTIME_GATE_BOOTSTRAP_MARKER = 'data-heybox-runtime-gate-bootstrap';
|
|
44
|
+
/**
|
|
45
|
+
* 检查 HTML 是否包含 Runtime Gate 的三个结构标记。
|
|
46
|
+
*
|
|
47
|
+
* @param html - 待检查的完整 HTML 文本,使用 HTML parser 解析。
|
|
48
|
+
* @returns Gate、隐藏样式及 bootstrap 标记均出现时返回 `true`,否则返回 `false`。
|
|
49
|
+
* @remarks 只识别标记,不验证脚本内容、标记所在节点或宿主握手;不能据此判断页面安全或实际可运行。
|
|
50
|
+
* @since 0.8.2
|
|
51
|
+
*/
|
|
52
|
+
function hasMiniappRuntimeGate(html) {
|
|
53
|
+
const document = parse(html);
|
|
54
|
+
let hasGate = false;
|
|
55
|
+
let hasGateStyle = false;
|
|
56
|
+
let hasGateBootstrap = false;
|
|
57
|
+
walk(document, (element) => {
|
|
58
|
+
hasGate ||= hasAttr(element, RUNTIME_GATE_MARKER);
|
|
59
|
+
hasGateStyle ||= hasAttr(element, RUNTIME_GATE_STYLE_MARKER);
|
|
60
|
+
hasGateBootstrap ||= hasAttr(element, RUNTIME_GATE_BOOTSTRAP_MARKER);
|
|
61
|
+
});
|
|
62
|
+
return hasGate && hasGateStyle && hasGateBootstrap;
|
|
63
|
+
}
|
|
64
|
+
function readAttr(element, name) {
|
|
65
|
+
return element.attrs.find((attr) => attr.name.toLowerCase() === name)?.value;
|
|
66
|
+
}
|
|
67
|
+
function hasAttr(element, name) {
|
|
68
|
+
return readAttr(element, name) !== undefined;
|
|
69
|
+
}
|
|
70
|
+
function walk(node, visit) {
|
|
71
|
+
if ('tagName' in node)
|
|
72
|
+
visit(node);
|
|
73
|
+
if ('childNodes' in node)
|
|
74
|
+
for (const child of node.childNodes)
|
|
75
|
+
walk(child, visit);
|
|
76
|
+
if ('content' in node && node.content)
|
|
77
|
+
walk(node.content, visit);
|
|
78
|
+
}
|
|
79
|
+
|
|
16
80
|
var typescript = {exports: {}};
|
|
17
81
|
|
|
18
82
|
var sourceMapSupport = {exports: {}};
|
|
@@ -201881,67 +201945,74 @@ function verifyWorkspaceCardArtifacts(root, manifest) {
|
|
|
201881
201945
|
}
|
|
201882
201946
|
}
|
|
201883
201947
|
|
|
201884
|
-
|
|
201885
|
-
|
|
201886
|
-
|
|
201887
|
-
|
|
201888
|
-
|
|
201889
|
-
|
|
201890
|
-
|
|
201891
|
-
|
|
201892
|
-
|
|
201893
|
-
|
|
201894
|
-
|
|
201895
|
-
|
|
201896
|
-
|
|
201897
|
-
|
|
201898
|
-
|
|
201899
|
-
|
|
201900
|
-
|
|
201901
|
-
|
|
201902
|
-
|
|
201903
|
-
|
|
201904
|
-
|
|
201905
|
-
|
|
201906
|
-
|
|
201907
|
-
|
|
201908
|
-
|
|
201909
|
-
|
|
201910
|
-
|
|
201911
|
-
|
|
201912
|
-
|
|
201913
|
-
|
|
201914
|
-
|
|
201915
|
-
|
|
201916
|
-
|
|
201917
|
-
|
|
201918
|
-
|
|
201919
|
-
|
|
201920
|
-
|
|
201921
|
-
|
|
201922
|
-
|
|
201923
|
-
hasGate ||= hasAttr(element, RUNTIME_GATE_MARKER);
|
|
201924
|
-
hasGateStyle ||= hasAttr(element, RUNTIME_GATE_STYLE_MARKER);
|
|
201925
|
-
hasGateBootstrap ||= hasAttr(element, RUNTIME_GATE_BOOTSTRAP_MARKER);
|
|
201926
|
-
});
|
|
201927
|
-
return hasGate && hasGateStyle && hasGateBootstrap;
|
|
201928
|
-
}
|
|
201929
|
-
function readAttr(element, name) {
|
|
201930
|
-
return element.attrs.find((attr) => attr.name.toLowerCase() === name)?.value;
|
|
201931
|
-
}
|
|
201932
|
-
function hasAttr(element, name) {
|
|
201933
|
-
return readAttr(element, name) !== undefined;
|
|
201948
|
+
/** 仅描述读取时刻的产物;文件没有加锁,发布仍须生成并复核 receipt。 */
|
|
201949
|
+
async function inspectVersionArtifact(input) {
|
|
201950
|
+
const distDir = path.join(input.projectRoot, 'dist');
|
|
201951
|
+
const entryHtmlPath = path.join(distDir, 'index.html');
|
|
201952
|
+
const manifestPath = path.join(distDir, 'manifest.json');
|
|
201953
|
+
if (!fs.existsSync(manifestPath))
|
|
201954
|
+
throw new Error('未找到 dist/manifest.json,请在 Vite 配置中显式启用 miniappManifest()');
|
|
201955
|
+
if (!fs.existsSync(entryHtmlPath))
|
|
201956
|
+
throw new Error('未找到 dist/index.html,Vite 构建产物不完整');
|
|
201957
|
+
if (!hasMiniappRuntimeGate(await fs$1.readFile(entryHtmlPath, 'utf8'))) {
|
|
201958
|
+
throw new Error('dist/index.html 缺少平台 Runtime 启动门禁,请在 Vite 配置中显式启用 miniappManifest()');
|
|
201959
|
+
}
|
|
201960
|
+
const { manifest, hadBom } = runtimePermissionEnv.parseMiniappManifestJson(await fs$1.readFile(manifestPath, 'utf8'), 'dist/manifest.json');
|
|
201961
|
+
const validated = runtimePermissionEnv.validateMiniappManifestForDeploy(manifest);
|
|
201962
|
+
const bindAppIds = validated.bindAppIds ?? [];
|
|
201963
|
+
if (validated.workspaceCards) {
|
|
201964
|
+
verifyWorkspaceCardsSnapshot({ ...validated, bindAppIds, workspaceCards: validated.workspaceCards });
|
|
201965
|
+
verifyWorkspaceCardArtifacts(distDir, validated.workspaceCards);
|
|
201966
|
+
}
|
|
201967
|
+
const declared = input.declarations;
|
|
201968
|
+
if (validated.category !== declared.category) {
|
|
201969
|
+
throw new Error('dist/manifest.json.category 与 package.json#heybox.category 不一致,请重新 build');
|
|
201970
|
+
}
|
|
201971
|
+
if (!runtimePermissionEnv.areMiniappPlatformsEqual(validated.platforms, declared.platforms)) {
|
|
201972
|
+
throw new Error('dist/manifest.json.platforms 与 package.json#heybox.platforms 不一致,请重新 build');
|
|
201973
|
+
}
|
|
201974
|
+
if (!runtimePermissionEnv.areMiniappWindowsEqual(validated.window, declared.window)) {
|
|
201975
|
+
throw new Error('dist/manifest.json.window 与 package.json#heybox.window 不一致,请重新 build');
|
|
201976
|
+
}
|
|
201977
|
+
if (bindAppIds.length !== declared.bindAppIds.length || bindAppIds.some((value, index) => value !== declared.bindAppIds[index])) {
|
|
201978
|
+
throw new Error('dist/manifest.json.bindAppIds 与 package.json#heybox.bindAppIds 不一致,请重新 build');
|
|
201979
|
+
}
|
|
201980
|
+
return {
|
|
201981
|
+
distDir,
|
|
201982
|
+
hadBom,
|
|
201983
|
+
// 上送仍保留原始未知字段,只归一原有 deploy 已处理的字段。
|
|
201984
|
+
manifest: { ...manifest, platforms: validated.platforms, ...(bindAppIds.length === 0 ? {} : { bindAppIds }) },
|
|
201985
|
+
summary: { ...validated, bindAppIds },
|
|
201986
|
+
};
|
|
201934
201987
|
}
|
|
201935
|
-
|
|
201936
|
-
|
|
201937
|
-
|
|
201938
|
-
|
|
201939
|
-
|
|
201940
|
-
|
|
201941
|
-
if (
|
|
201942
|
-
|
|
201988
|
+
/** 扫描不依赖元数据对象,不能把先前校验误当作文件持续不变的凭证。 */
|
|
201989
|
+
async function inspectVersionArtifactFiles(distDir) {
|
|
201990
|
+
const files = [];
|
|
201991
|
+
await walk(distDir, '');
|
|
201992
|
+
const uploadFiles = runtimePermissionEnv.prepareMiniappArtifactFiles(files.filter((file) => runtimePermissionEnv.shouldUploadDistFile(file.relativePath)));
|
|
201993
|
+
const sizeError = runtimePermissionEnv.validateMiniappUploadSizeBudgets(uploadFiles);
|
|
201994
|
+
if (sizeError)
|
|
201995
|
+
throw new Error(sizeError);
|
|
201996
|
+
return { files: uploadFiles, fileCount: uploadFiles.length, totalBytes: uploadFiles.reduce((total, file) => total + file.size, 0) };
|
|
201997
|
+
async function walk(directory, prefix) {
|
|
201998
|
+
for (const entry of await fs$1.readdir(directory, { withFileTypes: true })) {
|
|
201999
|
+
const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
202000
|
+
const absolutePath = path.join(directory, entry.name);
|
|
202001
|
+
const info = await fs$1.lstat(absolutePath);
|
|
202002
|
+
if (info.isSymbolicLink())
|
|
202003
|
+
throw new Error(`dist 目录包含 symlink,拒绝处理:${relativePath}`);
|
|
202004
|
+
if (relativePath.includes('\\'))
|
|
202005
|
+
throw new Error(`构建产物路径不能包含反斜杠:${relativePath}`);
|
|
202006
|
+
// 在进入目录前检查,因此空的禁用目录同样拒绝。
|
|
202007
|
+
if (runtimePermissionEnv.relativePathContainsNodeModulesSegment(relativePath))
|
|
202008
|
+
throw new Error(`dist 目录含 node_modules:${relativePath}`);
|
|
202009
|
+
if (info.isDirectory())
|
|
202010
|
+
await walk(absolutePath, relativePath);
|
|
202011
|
+
else if (info.isFile())
|
|
202012
|
+
files.push({ relativePath, absolutePath, size: info.size });
|
|
202013
|
+
}
|
|
202014
|
+
}
|
|
201943
202015
|
}
|
|
201944
202016
|
|
|
201945
|
-
exports.
|
|
201946
|
-
exports.
|
|
201947
|
-
exports.verifyWorkspaceCardsSnapshot = verifyWorkspaceCardsSnapshot;
|
|
202017
|
+
exports.inspectVersionArtifact = inspectVersionArtifact;
|
|
202018
|
+
exports.inspectVersionArtifactFiles = inspectVersionArtifactFiles;
|
|
@@ -1,35 +1,32 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var runtimeGate = require('./runtime-gate-BgWB2U5f.cjs');
|
|
4
|
-
var fs$1 = require('node:fs');
|
|
5
3
|
var fs = require('node:fs/promises');
|
|
6
4
|
var path = require('node:path');
|
|
7
|
-
var runtimePermissionEnv = require('./runtime-permission-env-
|
|
8
|
-
var index = require('./index-
|
|
5
|
+
var runtimePermissionEnv = require('./runtime-permission-env-DLLffpOa.cjs');
|
|
6
|
+
var index = require('./index-dXb0CRuR.cjs');
|
|
9
7
|
require('node:crypto');
|
|
8
|
+
require('node:fs');
|
|
10
9
|
require('node:zlib');
|
|
11
|
-
var
|
|
12
|
-
require('
|
|
13
|
-
require('
|
|
14
|
-
require('./_commonjs-dynamic-modules-DUamuDzp.cjs');
|
|
15
|
-
require('fs');
|
|
16
|
-
require('path');
|
|
17
|
-
require('os');
|
|
18
|
-
require('inspector');
|
|
19
|
-
require('./version-C6b3tkax.cjs');
|
|
10
|
+
var artifact = require('./artifact-Dv6zPoPj.cjs');
|
|
11
|
+
var projectVite = require('./project-vite-BkRatXiB.cjs');
|
|
12
|
+
require('./version-hdMctv12.cjs');
|
|
20
13
|
require('node:async_hooks');
|
|
14
|
+
require('node:module');
|
|
21
15
|
require('readline');
|
|
16
|
+
require('os');
|
|
22
17
|
require('tty');
|
|
23
18
|
require('assert');
|
|
24
19
|
require('events');
|
|
25
20
|
require('stream');
|
|
26
21
|
require('buffer');
|
|
27
22
|
require('util');
|
|
23
|
+
require('path');
|
|
24
|
+
require('fs');
|
|
28
25
|
require('constants');
|
|
26
|
+
require('node:url');
|
|
27
|
+
require('./_commonjs-dynamic-modules-DUamuDzp.cjs');
|
|
28
|
+
require('inspector');
|
|
29
29
|
|
|
30
|
-
function areStringArraysEqual(left, right) {
|
|
31
|
-
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
32
|
-
}
|
|
33
30
|
async function runBuildCommand(_options = {}, runtime = {}) {
|
|
34
31
|
const logger = runtime.logger ?? index.createCliLogger();
|
|
35
32
|
const projectRoot = projectVite.findProjectRoot(runtime.cwd ?? process.cwd());
|
|
@@ -89,84 +86,38 @@ function createFixedBuildOutputPlugin(projectRoot) {
|
|
|
89
86
|
};
|
|
90
87
|
}
|
|
91
88
|
async function validateBuildOutput(projectRoot, logger, declaredPlatforms, declaredWindow, declaredBindAppIds, declaredCategory) {
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (!runtimeGate.hasMiniappRuntimeGate(entryHtml)) {
|
|
103
|
-
throw new Error('dist/index.html 缺少平台 Runtime 启动门禁,请在 Vite 配置中显式启用 miniappManifest()');
|
|
104
|
-
}
|
|
105
|
-
const { manifest, hadBom } = runtimePermissionEnv.parseMiniappManifestJson(await fs.readFile(manifestPath, 'utf8'), 'dist/manifest.json');
|
|
106
|
-
if (hadBom) {
|
|
89
|
+
const artifact$1 = await artifact.inspectVersionArtifact({
|
|
90
|
+
projectRoot,
|
|
91
|
+
declarations: {
|
|
92
|
+
platforms: declaredPlatforms,
|
|
93
|
+
window: declaredWindow,
|
|
94
|
+
bindAppIds: declaredBindAppIds,
|
|
95
|
+
category: declaredCategory,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
if (artifact$1.hadBom)
|
|
107
99
|
logger.warn('dist/manifest.json 包含 BOM,已自动剥离');
|
|
100
|
+
let inventory;
|
|
101
|
+
try {
|
|
102
|
+
inventory = await artifact.inspectVersionArtifactFiles(artifact$1.distDir);
|
|
108
103
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
const { platforms, sdkVersion, version, permissions, window } = validated;
|
|
115
|
-
const bindAppIds = validated.bindAppIds ?? [];
|
|
116
|
-
if (validated.category !== declaredCategory) {
|
|
117
|
-
throw new Error('dist/manifest.json.category 与 package.json#heybox.category 不一致,请重新 build');
|
|
118
|
-
}
|
|
119
|
-
if (!runtimePermissionEnv.areMiniappPlatformsEqual(platforms, declaredPlatforms)) {
|
|
120
|
-
throw new Error('dist/manifest.json.platforms 与 package.json#heybox.platforms 不一致,请重新 build');
|
|
121
|
-
}
|
|
122
|
-
if (!runtimePermissionEnv.areMiniappWindowsEqual(window, declaredWindow)) {
|
|
123
|
-
throw new Error('dist/manifest.json.window 与 package.json#heybox.window 不一致,请重新 build');
|
|
124
|
-
}
|
|
125
|
-
if (!areStringArraysEqual(bindAppIds, declaredBindAppIds)) {
|
|
126
|
-
throw new Error('dist/manifest.json.bindAppIds 与 package.json#heybox.bindAppIds 不一致,请重新 build');
|
|
127
|
-
}
|
|
128
|
-
const allFiles = await walkDistFiles(distDir);
|
|
129
|
-
const uploadFiles = allFiles.filter((file) => runtimePermissionEnv.shouldUploadDistFile(file.relativePath));
|
|
130
|
-
const sizeError = runtimePermissionEnv.validateMiniappUploadSizeBudgets(uploadFiles);
|
|
131
|
-
if (sizeError) {
|
|
132
|
-
throw new Error(sizeError.replace('重新 deploy', '重新 build'));
|
|
104
|
+
catch (error) {
|
|
105
|
+
if (error instanceof Error)
|
|
106
|
+
error.message = error.message.replace('重新 deploy', '重新 build');
|
|
107
|
+
throw error;
|
|
133
108
|
}
|
|
109
|
+
const { platforms, sdkVersion, version, permissions, bindAppIds } = artifact$1.summary;
|
|
134
110
|
return {
|
|
135
|
-
distDir,
|
|
111
|
+
distDir: artifact$1.distDir,
|
|
136
112
|
bindAppIds,
|
|
137
|
-
fileCount:
|
|
113
|
+
fileCount: inventory.fileCount,
|
|
138
114
|
sdkVersion,
|
|
139
115
|
platforms,
|
|
140
116
|
...(permissions === undefined ? {} : { permissions }),
|
|
141
|
-
totalBytes:
|
|
117
|
+
totalBytes: inventory.totalBytes,
|
|
142
118
|
version,
|
|
143
119
|
};
|
|
144
120
|
}
|
|
145
|
-
async function walkDistFiles(distDir) {
|
|
146
|
-
const results = [];
|
|
147
|
-
await walk(distDir, '');
|
|
148
|
-
return results;
|
|
149
|
-
async function walk(absDir, relDir) {
|
|
150
|
-
const entries = await fs.readdir(absDir, { withFileTypes: true });
|
|
151
|
-
for (const entry of entries) {
|
|
152
|
-
const absPath = path.join(absDir, entry.name);
|
|
153
|
-
const relPath = runtimePermissionEnv.normalizeRelativePath(relDir ? `${relDir}/${entry.name}` : entry.name);
|
|
154
|
-
const link = await fs.lstat(absPath);
|
|
155
|
-
if (link.isSymbolicLink()) {
|
|
156
|
-
throw new Error(`dist 目录包含 symlink,拒绝处理:${relPath}`);
|
|
157
|
-
}
|
|
158
|
-
if (runtimePermissionEnv.relativePathContainsNodeModulesSegment(relPath)) {
|
|
159
|
-
throw new Error(`dist 目录含 node_modules:${relPath}`);
|
|
160
|
-
}
|
|
161
|
-
if (entry.isDirectory()) {
|
|
162
|
-
await walk(absPath, relPath);
|
|
163
|
-
}
|
|
164
|
-
else if (entry.isFile()) {
|
|
165
|
-
results.push({ relativePath: relPath, size: (await fs.stat(absPath)).size });
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
121
|
function formatSize(bytes) {
|
|
171
122
|
if (bytes < 1024)
|
|
172
123
|
return `${bytes} B`;
|
|
@@ -5,7 +5,7 @@ var fs = require('node:fs/promises');
|
|
|
5
5
|
var path = require('node:path');
|
|
6
6
|
var require$$0 = require('fs');
|
|
7
7
|
var require$$1 = require('path');
|
|
8
|
-
var index = require('./index-
|
|
8
|
+
var index = require('./index-dXb0CRuR.cjs');
|
|
9
9
|
require('node:module');
|
|
10
10
|
require('readline');
|
|
11
11
|
require('os');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var node_crypto = require('node:crypto');
|
|
4
4
|
var fs = require('node:fs/promises');
|
|
5
5
|
var path = require('node:path');
|
|
6
|
-
var index = require('./index-
|
|
6
|
+
var index = require('./index-dXb0CRuR.cjs');
|
|
7
7
|
|
|
8
8
|
const DEPLOY_LOCKED_MESSAGE = '当前设备已有同版本产物正在上传,请等待完成后重试';
|
|
9
9
|
const DEPLOY_LOCK_DIRECTORY_NAME = 'deploy-locks';
|