@heybox/hb-sdk 0.6.7-alpha.0 → 0.6.7-alpha.2
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 +3 -3
- package/dist/cli-chunks/{build-mTmtBJbp.cjs → build-CQmYxfxm.cjs} +25 -29
- package/dist/cli-chunks/{context-wI8oXc58.cjs → context-ChkYWwH_.cjs} +23 -122
- package/dist/cli-chunks/{create-DEwECU7u.cjs → create-CC5r_8bL.cjs} +1 -1
- package/dist/cli-chunks/{dev-BZ7FJEeZ.cjs → dev-CD-38TgO.cjs} +110 -21
- package/dist/cli-chunks/{doctor-DbJQPPs2.cjs → doctor-43yEfVr0.cjs} +1 -1
- package/dist/cli-chunks/{index-UecHob74.cjs → index-BM6oH2Hs.cjs} +3 -3
- package/dist/cli-chunks/{runtime-permission-env-BSs4uCNa.cjs → index-BQm5XmMC.cjs} +0 -71
- package/dist/cli-chunks/{index-Df14XqmW.cjs → index-CQnkS0Z8.cjs} +14 -14
- package/dist/cli-chunks/{login-BzSUtgRH.cjs → login-BmisXAdp.cjs} +2 -2
- package/dist/cli-chunks/{project-vite-D2Hx7XPp.cjs → project-vite-D9_v57vp.cjs} +1 -1
- package/dist/cli-chunks/{remote-BZiSfXOm.cjs → remote-BXtT6M2f.cjs} +22 -40
- package/dist/cli-chunks/{runtime-gate--rPXjiG6.cjs → runtime-gate-B2MQf1vc.cjs} +3 -3
- package/dist/cli-chunks/{session-CqycMFvy.cjs → session-BjtjhtPg.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/devtools/mock-host/main.js +187 -21
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/vite.cjs.js +50 -28
- package/dist/vite.esm.js +50 -28
- package/package.json +1 -1
- package/skill/references/api-root.md +7 -9
- package/skill/skill.json +4 -4
- package/types/vite/html-policy.d.ts +0 -1
- package/types/vite/index.d.ts +1 -0
- package/types/vite/runtime-permission-env.d.ts +0 -9
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var node_async_hooks = require('node:async_hooks');
|
|
4
|
-
|
|
5
3
|
var re = {exports: {}};
|
|
6
4
|
|
|
7
5
|
var constants;
|
|
@@ -2881,72 +2879,6 @@ function shouldUploadDistFile(relativePath) {
|
|
|
2881
2879
|
return true;
|
|
2882
2880
|
}
|
|
2883
2881
|
|
|
2884
|
-
const HB_SDK_RUNTIME_USE_OFFICIAL_DOMAIN_ENV = 'HB_SDK_RUNTIME_USE_OFFICIAL_DOMAIN';
|
|
2885
|
-
const HB_SDK_RUNTIME_PERMISSION_CONTEXT_ENV = 'HB_SDK_RUNTIME_PERMISSION_CONTEXT';
|
|
2886
|
-
const VERIFIED_RUNTIME_PERMISSION_CONTEXT = 'verified';
|
|
2887
|
-
const environmentScopeStorage = new node_async_hooks.AsyncLocalStorage();
|
|
2888
|
-
let environmentScopeTail = Promise.resolve();
|
|
2889
|
-
function shouldSkipMiniappPlatformCspFromEnv(env = process.env) {
|
|
2890
|
-
return env[HB_SDK_RUNTIME_PERMISSION_CONTEXT_ENV] === VERIFIED_RUNTIME_PERMISSION_CONTEXT && env[HB_SDK_RUNTIME_USE_OFFICIAL_DOMAIN_ENV] === '1';
|
|
2891
|
-
}
|
|
2892
|
-
function createMiniappPlatformCspEnv(env, skipPlatformCsp) {
|
|
2893
|
-
return {
|
|
2894
|
-
...env,
|
|
2895
|
-
[HB_SDK_RUNTIME_PERMISSION_CONTEXT_ENV]: VERIFIED_RUNTIME_PERMISSION_CONTEXT,
|
|
2896
|
-
[HB_SDK_RUNTIME_USE_OFFICIAL_DOMAIN_ENV]: skipPlatformCsp ? '1' : '0',
|
|
2897
|
-
};
|
|
2898
|
-
}
|
|
2899
|
-
async function withMiniappPlatformCspEnv(skipPlatformCsp, action, env = process.env) {
|
|
2900
|
-
if (environmentScopeStorage.getStore()?.active) {
|
|
2901
|
-
return runMiniappPlatformCspEnvScope(skipPlatformCsp, action, env);
|
|
2902
|
-
}
|
|
2903
|
-
let releaseScope = () => undefined;
|
|
2904
|
-
const previousScope = environmentScopeTail;
|
|
2905
|
-
environmentScopeTail = new Promise((resolve) => {
|
|
2906
|
-
releaseScope = resolve;
|
|
2907
|
-
});
|
|
2908
|
-
await previousScope;
|
|
2909
|
-
const scope = { active: true };
|
|
2910
|
-
try {
|
|
2911
|
-
return await environmentScopeStorage.run(scope, () => runMiniappPlatformCspEnvScope(skipPlatformCsp, action, env));
|
|
2912
|
-
}
|
|
2913
|
-
finally {
|
|
2914
|
-
scope.active = false;
|
|
2915
|
-
releaseScope();
|
|
2916
|
-
}
|
|
2917
|
-
}
|
|
2918
|
-
async function runMiniappPlatformCspEnvScope(skipPlatformCsp, action, env) {
|
|
2919
|
-
const targets = env === process.env ? [env] : [env, process.env];
|
|
2920
|
-
const previousValues = targets.map((target) => ({
|
|
2921
|
-
context: target[HB_SDK_RUNTIME_PERMISSION_CONTEXT_ENV],
|
|
2922
|
-
officialDomain: target[HB_SDK_RUNTIME_USE_OFFICIAL_DOMAIN_ENV],
|
|
2923
|
-
}));
|
|
2924
|
-
for (const target of targets) {
|
|
2925
|
-
target[HB_SDK_RUNTIME_PERMISSION_CONTEXT_ENV] = VERIFIED_RUNTIME_PERMISSION_CONTEXT;
|
|
2926
|
-
target[HB_SDK_RUNTIME_USE_OFFICIAL_DOMAIN_ENV] = skipPlatformCsp ? '1' : '0';
|
|
2927
|
-
}
|
|
2928
|
-
try {
|
|
2929
|
-
return await action();
|
|
2930
|
-
}
|
|
2931
|
-
finally {
|
|
2932
|
-
targets.forEach((target, index) => {
|
|
2933
|
-
const previousValue = previousValues[index];
|
|
2934
|
-
if (previousValue?.context === undefined) {
|
|
2935
|
-
delete target[HB_SDK_RUNTIME_PERMISSION_CONTEXT_ENV];
|
|
2936
|
-
}
|
|
2937
|
-
else {
|
|
2938
|
-
target[HB_SDK_RUNTIME_PERMISSION_CONTEXT_ENV] = previousValue.context;
|
|
2939
|
-
}
|
|
2940
|
-
if (previousValue?.officialDomain === undefined) {
|
|
2941
|
-
delete target[HB_SDK_RUNTIME_USE_OFFICIAL_DOMAIN_ENV];
|
|
2942
|
-
}
|
|
2943
|
-
else {
|
|
2944
|
-
target[HB_SDK_RUNTIME_USE_OFFICIAL_DOMAIN_ENV] = previousValue.officialDomain;
|
|
2945
|
-
}
|
|
2946
|
-
});
|
|
2947
|
-
}
|
|
2948
|
-
}
|
|
2949
|
-
|
|
2950
2882
|
exports.ACTIVITY_UPLOAD_KEY_MAX_LENGTH = ACTIVITY_UPLOAD_KEY_MAX_LENGTH;
|
|
2951
2883
|
exports.CREATE_USER_MINIPROGRAM_API_PATH = CREATE_USER_MINIPROGRAM_API_PATH;
|
|
2952
2884
|
exports.CREATE_USER_MINIPROGRAM_LEADERBOARD_API_PATH = CREATE_USER_MINIPROGRAM_LEADERBOARD_API_PATH;
|
|
@@ -2971,14 +2903,11 @@ exports.USER_MINIPROGRAM_ACCESS_STATUS_API_PATH = USER_MINIPROGRAM_ACCESS_STATUS
|
|
|
2971
2903
|
exports.USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH = USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH;
|
|
2972
2904
|
exports.USER_MINIPROGRAM_VERSION_PREVIEW_INFO_API_PATH = USER_MINIPROGRAM_VERSION_PREVIEW_INFO_API_PATH;
|
|
2973
2905
|
exports.WITHDRAW_USER_MINIPROGRAM_VERSION_API_PATH = WITHDRAW_USER_MINIPROGRAM_VERSION_API_PATH;
|
|
2974
|
-
exports.createMiniappPlatformCspEnv = createMiniappPlatformCspEnv;
|
|
2975
2906
|
exports.getMiniappUploadKey = getMiniappUploadKey;
|
|
2976
2907
|
exports.normalizeRelativePath = normalizeRelativePath;
|
|
2977
2908
|
exports.relativePathContainsNodeModulesSegment = relativePathContainsNodeModulesSegment;
|
|
2978
2909
|
exports.requireSemver = requireSemver;
|
|
2979
2910
|
exports.semverExports = semverExports;
|
|
2980
|
-
exports.shouldSkipMiniappPlatformCspFromEnv = shouldSkipMiniappPlatformCspFromEnv;
|
|
2981
2911
|
exports.shouldUploadDistFile = shouldUploadDistFile;
|
|
2982
2912
|
exports.validateUploadPaths = validateUploadPaths;
|
|
2983
2913
|
exports.validateUploadTotalSize = validateUploadTotalSize;
|
|
2984
|
-
exports.withMiniappPlatformCspEnv = withMiniappPlatformCspEnv;
|
|
@@ -234,19 +234,19 @@ function requireArgument () {
|
|
|
234
234
|
|
|
235
235
|
var command = {};
|
|
236
236
|
|
|
237
|
-
const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
237
|
+
const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-CQnkS0Z8.cjs', document.baseURI).href)));
|
|
238
238
|
function __require$4() { return require$5("node:events"); }
|
|
239
239
|
|
|
240
|
-
const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
240
|
+
const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-CQnkS0Z8.cjs', document.baseURI).href)));
|
|
241
241
|
function __require$3() { return require$4("node:child_process"); }
|
|
242
242
|
|
|
243
|
-
const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
243
|
+
const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-CQnkS0Z8.cjs', document.baseURI).href)));
|
|
244
244
|
function __require$2() { return require$3("node:path"); }
|
|
245
245
|
|
|
246
|
-
const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
246
|
+
const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-CQnkS0Z8.cjs', document.baseURI).href)));
|
|
247
247
|
function __require$1() { return require$2("node:fs"); }
|
|
248
248
|
|
|
249
|
-
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-
|
|
249
|
+
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-CQnkS0Z8.cjs', document.baseURI).href)));
|
|
250
250
|
function __require() { return require$1("node:process"); }
|
|
251
251
|
|
|
252
252
|
var help = {};
|
|
@@ -13347,7 +13347,7 @@ function getPathname(pathWithQuery) {
|
|
|
13347
13347
|
}
|
|
13348
13348
|
|
|
13349
13349
|
const CLI_VERSION_PLACEHOLDER = ['__HB', 'SDK', 'CLI', 'VERSION__'].join('_');
|
|
13350
|
-
const BUILT_CLI_VERSION = '0.6.7-alpha.
|
|
13350
|
+
const BUILT_CLI_VERSION = '0.6.7-alpha.2';
|
|
13351
13351
|
const PACKAGE_JSON_CANDIDATES = [
|
|
13352
13352
|
path.resolve(__dirname, '..', '..', 'package.json'),
|
|
13353
13353
|
path.resolve(__dirname, '..', 'package.json'),
|
|
@@ -13680,35 +13680,35 @@ function createCommandLoggerResolver(options) {
|
|
|
13680
13680
|
};
|
|
13681
13681
|
}
|
|
13682
13682
|
const defaultClearLoginStatus = async (...args) => {
|
|
13683
|
-
const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-
|
|
13683
|
+
const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-BmisXAdp.cjs'); });
|
|
13684
13684
|
return clearLoginStatus(...args);
|
|
13685
13685
|
};
|
|
13686
13686
|
const defaultLoginToHeybox = async (...args) => {
|
|
13687
|
-
const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-
|
|
13687
|
+
const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-BmisXAdp.cjs'); });
|
|
13688
13688
|
return loginToHeybox(...args);
|
|
13689
13689
|
};
|
|
13690
13690
|
const defaultPrintLoginStatus = async (...args) => {
|
|
13691
|
-
const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-
|
|
13691
|
+
const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-BmisXAdp.cjs'); });
|
|
13692
13692
|
return printLoginStatus(...args);
|
|
13693
13693
|
};
|
|
13694
13694
|
const defaultRunBuildCommand = async (...args) => {
|
|
13695
|
-
const { runBuildCommand } = await Promise.resolve().then(function () { return require('./build-
|
|
13695
|
+
const { runBuildCommand } = await Promise.resolve().then(function () { return require('./build-CQmYxfxm.cjs'); });
|
|
13696
13696
|
return runBuildCommand(...args);
|
|
13697
13697
|
};
|
|
13698
13698
|
const defaultRunCreateCommand = async (...args) => {
|
|
13699
|
-
const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-
|
|
13699
|
+
const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-CC5r_8bL.cjs'); });
|
|
13700
13700
|
return runCreateCommand(...args);
|
|
13701
13701
|
};
|
|
13702
13702
|
const defaultRunDevCommand = async (...args) => {
|
|
13703
|
-
const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-
|
|
13703
|
+
const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-CD-38TgO.cjs'); });
|
|
13704
13704
|
return runDevCommand(...args);
|
|
13705
13705
|
};
|
|
13706
13706
|
const defaultRunDoctorCommand = async (...args) => {
|
|
13707
|
-
const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-
|
|
13707
|
+
const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-43yEfVr0.cjs'); });
|
|
13708
13708
|
return runDoctorCommand(...args);
|
|
13709
13709
|
};
|
|
13710
13710
|
const defaultRunRemoteCommand = async (...args) => {
|
|
13711
|
-
const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-
|
|
13711
|
+
const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-BXtT6M2f.cjs'); });
|
|
13712
13712
|
return runRemoteCommand(...args);
|
|
13713
13713
|
};
|
|
13714
13714
|
function resolveStandaloneLogger(options, verbose) {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
var promises = require('node:readline/promises');
|
|
4
4
|
var node_crypto = require('node:crypto');
|
|
5
5
|
var node_http = require('node:http');
|
|
6
|
-
var session = require('./session-
|
|
6
|
+
var session = require('./session-BjtjhtPg.cjs');
|
|
7
7
|
var browser = require('./browser-RAy8e8cV.cjs');
|
|
8
|
-
var index = require('./index-
|
|
8
|
+
var index = require('./index-CQnkS0Z8.cjs');
|
|
9
9
|
require('node:path');
|
|
10
10
|
require('fs');
|
|
11
11
|
require('constants');
|
|
@@ -5,7 +5,7 @@ var fs$1 = require('node:fs/promises');
|
|
|
5
5
|
var node_module = require('node:module');
|
|
6
6
|
var path = require('node:path');
|
|
7
7
|
var node_url = require('node:url');
|
|
8
|
-
var index = require('./index-
|
|
8
|
+
var index = require('./index-CQnkS0Z8.cjs');
|
|
9
9
|
|
|
10
10
|
function findProjectRoot(startDir) {
|
|
11
11
|
let current = path.resolve(startDir);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var promises = require('node:readline/promises');
|
|
4
|
-
var index = require('./index-
|
|
5
|
-
var session = require('./session-
|
|
4
|
+
var index = require('./index-CQnkS0Z8.cjs');
|
|
5
|
+
var session = require('./session-BjtjhtPg.cjs');
|
|
6
6
|
var childProcess = require('node:child_process');
|
|
7
7
|
var fs = require('node:fs');
|
|
8
8
|
var fs$1 = require('node:fs/promises');
|
|
9
9
|
var path = require('node:path');
|
|
10
|
-
var
|
|
11
|
-
var runtimeGate = require('./runtime-gate
|
|
12
|
-
var context = require('./context-
|
|
10
|
+
var index$1 = require('./index-BQm5XmMC.cjs');
|
|
11
|
+
var runtimeGate = require('./runtime-gate-B2MQf1vc.cjs');
|
|
12
|
+
var context = require('./context-ChkYWwH_.cjs');
|
|
13
13
|
require('node:module');
|
|
14
14
|
require('path');
|
|
15
15
|
require('os');
|
|
@@ -23,7 +23,6 @@ require('util');
|
|
|
23
23
|
require('node:crypto');
|
|
24
24
|
require('fs');
|
|
25
25
|
require('constants');
|
|
26
|
-
require('node:async_hooks');
|
|
27
26
|
|
|
28
27
|
async function getCDNUploadInfo(options, runtime = {}) {
|
|
29
28
|
const body = new URLSearchParams();
|
|
@@ -70,7 +69,7 @@ async function runUpload(options, runtime = {}) {
|
|
|
70
69
|
const postCDNUploadCallback$1 = runtime.postCDNUploadCallback ?? postCDNUploadCallback;
|
|
71
70
|
const createReadStream = runtime.createReadStream ?? fs.createReadStream;
|
|
72
71
|
const orderedFiles = [...options.files].sort((a, b) => a.relativePath.localeCompare(b.relativePath));
|
|
73
|
-
const batches = chunkUploadFiles(orderedFiles,
|
|
72
|
+
const batches = chunkUploadFiles(orderedFiles, index$1.MINIAPP_UPLOAD_BATCH_SIZE);
|
|
74
73
|
await logger.task(`正在上传 ${orderedFiles.length} 个文件`, async (taskContext) => {
|
|
75
74
|
logger.debug(`上传并发数: ${concurrency}`);
|
|
76
75
|
logger.debug(`上传批次数: ${batches.length}`);
|
|
@@ -80,7 +79,7 @@ async function runUpload(options, runtime = {}) {
|
|
|
80
79
|
logger.debug(`正在处理上传批次 ${batchIndex + 1}/${batches.length},文件数: ${batch.length}`);
|
|
81
80
|
logger.debug('正在获取 CDN 上传信息');
|
|
82
81
|
const fileInfos = createUploadFileInfos(batch, options);
|
|
83
|
-
const uploadInfo = await getCDNUploadInfo$1({ session: options.session, scope:
|
|
82
|
+
const uploadInfo = await getCDNUploadInfo$1({ session: options.session, scope: index$1.MINIAPP_UPLOAD_SCOPE, fileInfos, needCache: false }, { baseUrl: runtime.baseUrl, fetchImpl });
|
|
84
83
|
logger.debug(`CDN bucket: ${uploadInfo.bucket}`);
|
|
85
84
|
logger.debug(`CDN region: ${uploadInfo.region}`);
|
|
86
85
|
validateUploadInfoKeys(batch, uploadInfo.keys, options);
|
|
@@ -141,7 +140,7 @@ function createUploadFileInfos(files, options) {
|
|
|
141
140
|
name: file.relativePath.split('/').pop() ?? file.relativePath,
|
|
142
141
|
mimetype: file.mimeType,
|
|
143
142
|
fsize: file.size,
|
|
144
|
-
path:
|
|
143
|
+
path: index$1.getMiniappUploadKey({
|
|
145
144
|
miniProgramId: options.miniProgramId,
|
|
146
145
|
version: options.version,
|
|
147
146
|
relativePath: file.relativePath,
|
|
@@ -152,15 +151,15 @@ function validateUploadInfoKeys(files, keys, options) {
|
|
|
152
151
|
if (keys.length !== files.length) {
|
|
153
152
|
throw new index.CliError(`CDN 上传接口返回 key 数量异常:期望 ${files.length},实际 ${keys.length}`);
|
|
154
153
|
}
|
|
155
|
-
for (let index$
|
|
156
|
-
const expectedKey =
|
|
154
|
+
for (let index$2 = 0; index$2 < files.length; index$2 += 1) {
|
|
155
|
+
const expectedKey = index$1.getMiniappUploadKey({
|
|
157
156
|
miniProgramId: options.miniProgramId,
|
|
158
157
|
version: options.version,
|
|
159
|
-
relativePath: files[index$
|
|
158
|
+
relativePath: files[index$2].relativePath,
|
|
160
159
|
});
|
|
161
|
-
const actualKey = keys[index$
|
|
160
|
+
const actualKey = keys[index$2];
|
|
162
161
|
if (actualKey !== expectedKey) {
|
|
163
|
-
throw new index.CliError(`CDN 上传接口返回 key 异常:${files[index$
|
|
162
|
+
throw new index.CliError(`CDN 上传接口返回 key 异常:${files[index$2].relativePath}`, [`CDN 上传接口返回 key 异常:${files[index$2].relativePath}`, `expected: ${expectedKey}`, `actual: ${actualKey}`].join('\n'));
|
|
164
163
|
}
|
|
165
164
|
}
|
|
166
165
|
}
|
|
@@ -192,7 +191,7 @@ async function createDefaultCosClient(uploadToken) {
|
|
|
192
191
|
};
|
|
193
192
|
}
|
|
194
193
|
async function loadCosConstructor() {
|
|
195
|
-
const cosModule = await Promise.resolve().then(function () { return require('./index-
|
|
194
|
+
const cosModule = await Promise.resolve().then(function () { return require('./index-BM6oH2Hs.cjs'); }).then(function (n) { return n.index; });
|
|
196
195
|
return cosModule.default;
|
|
197
196
|
}
|
|
198
197
|
function formatSize(bytes) {
|
|
@@ -236,7 +235,7 @@ function isRecord(value) {
|
|
|
236
235
|
}
|
|
237
236
|
|
|
238
237
|
async function precheckUserMiniprogramVersion(options, runtime = {}) {
|
|
239
|
-
return postUserMiniprogramVersionForm(
|
|
238
|
+
return postUserMiniprogramVersionForm(index$1.PRECHECK_USER_MINIPROGRAM_VERSION_API_PATH, options, {
|
|
240
239
|
// 展示资料由服务端沿用 last approved 或注入默认名/默认图;CLI 不传 name/icon/cover。
|
|
241
240
|
...(options.version ? { version: options.version } : {}),
|
|
242
241
|
...(options.source_version ? { source_version: options.source_version } : {}),
|
|
@@ -245,7 +244,7 @@ async function precheckUserMiniprogramVersion(options, runtime = {}) {
|
|
|
245
244
|
}, runtime);
|
|
246
245
|
}
|
|
247
246
|
async function submitUserMiniprogramAudit(options, runtime = {}) {
|
|
248
|
-
return postUserMiniprogramVersionForm(
|
|
247
|
+
return postUserMiniprogramVersionForm(index$1.SUBMIT_USER_MINIPROGRAM_AUDIT_API_PATH, options, {
|
|
249
248
|
// 展示资料由服务端沿用 last approved 或注入默认名/默认图;CLI 不传 name/icon/cover。
|
|
250
249
|
...(options.manifest ? { manifest: JSON.stringify(options.manifest) } : {}),
|
|
251
250
|
...(options.source_version ? { source_version: options.source_version } : {}),
|
|
@@ -342,28 +341,11 @@ async function runDeployCommand(options, runtime = {}) {
|
|
|
342
341
|
releaseNote,
|
|
343
342
|
autoPublish,
|
|
344
343
|
}, runtime, apiBaseUrl, projectRoot, logger);
|
|
345
|
-
let skipPlatformCsp = false;
|
|
346
|
-
try {
|
|
347
|
-
const { detail } = await logger.task('正在读取远端小程序权限', () => (runtime.getBoundMiniProgram ?? context.getBoundMiniProgram)({
|
|
348
|
-
allowUnsafeApiBaseUrl: options.allowUnsafeApiBaseUrl,
|
|
349
|
-
apiBaseUrl,
|
|
350
|
-
cwd: projectRoot,
|
|
351
|
-
env,
|
|
352
|
-
fetchImpl: runtime.fetchImpl,
|
|
353
|
-
loginBaseUrl,
|
|
354
|
-
session: session$1,
|
|
355
|
-
}), { successText: '已读取远端小程序权限' });
|
|
356
|
-
skipPlatformCsp = context.shouldSkipMiniappPlatformCsp(detail.runtime_permissions);
|
|
357
|
-
}
|
|
358
|
-
catch (error) {
|
|
359
|
-
logger.warn('未读取到远端 Runtime 权限,构建将继续注入平台 CSP。');
|
|
360
|
-
logger.debug(`远端 Runtime 权限读取失败详情:${index.readRedactedErrorMessage(error, { verbose: true })}`);
|
|
361
|
-
}
|
|
362
344
|
const pm = detectPackageManager(projectRoot);
|
|
363
345
|
const buildMode = env.HB_SDK_ENV?.trim();
|
|
364
346
|
logger.info(`开始构建: ${pm} ${createBuildArgs(pm, buildMode).join(' ')}`);
|
|
365
347
|
await runBuildScript(pm, projectRoot, runtime.spawn ?? childProcess.spawn, {
|
|
366
|
-
env
|
|
348
|
+
env,
|
|
367
349
|
mode: buildMode,
|
|
368
350
|
outputMode: options.buildOutputMode ?? 'inherit',
|
|
369
351
|
stderr: runtime.stderr,
|
|
@@ -382,16 +364,16 @@ async function runDeployCommand(options, runtime = {}) {
|
|
|
382
364
|
}
|
|
383
365
|
const uploadFiles = await logger.task('正在校验 dist 上传文件', async () => {
|
|
384
366
|
const allFiles = await walkDistFiles(distDir);
|
|
385
|
-
const blocked = allFiles.find((entry) =>
|
|
367
|
+
const blocked = allFiles.find((entry) => index$1.relativePathContainsNodeModulesSegment(entry.relativePath));
|
|
386
368
|
if (blocked) {
|
|
387
369
|
throw new Error(`dist 目录含 node_modules:${blocked.relativePath}`);
|
|
388
370
|
}
|
|
389
|
-
const files = allFiles.filter((entry) =>
|
|
390
|
-
const pathError =
|
|
371
|
+
const files = allFiles.filter((entry) => index$1.shouldUploadDistFile(entry.relativePath));
|
|
372
|
+
const pathError = index$1.validateUploadPaths(files, { miniProgramId, version, maxLength: index$1.ACTIVITY_UPLOAD_KEY_MAX_LENGTH });
|
|
391
373
|
if (pathError) {
|
|
392
374
|
throw new Error(pathError);
|
|
393
375
|
}
|
|
394
|
-
const sizeError =
|
|
376
|
+
const sizeError = index$1.validateUploadTotalSize(files);
|
|
395
377
|
if (sizeError) {
|
|
396
378
|
throw new Error(sizeError);
|
|
397
379
|
}
|
|
@@ -600,7 +582,7 @@ async function walkDistFiles(distDir) {
|
|
|
600
582
|
}
|
|
601
583
|
const fileStat = await fs$1.stat(absPath);
|
|
602
584
|
results.push({
|
|
603
|
-
relativePath:
|
|
585
|
+
relativePath: index$1.normalizeRelativePath(relPath),
|
|
604
586
|
absolutePath: absPath,
|
|
605
587
|
size: fileStat.size,
|
|
606
588
|
mimeType: inferMimeType(entry.name),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var index = require('./index-BQm5XmMC.cjs');
|
|
4
4
|
|
|
5
5
|
function isValidMiniappManifestVersion(version) {
|
|
6
6
|
return getMiniappManifestVersionError(version) === undefined;
|
|
@@ -41,7 +41,7 @@ function validateSdkVersion(version, sourceLabel = 'sdkVersion') {
|
|
|
41
41
|
throw new Error(`${sourceLabel} 必须是合法 SemVer:${String(version)}`);
|
|
42
42
|
}
|
|
43
43
|
const normalized = version.trim();
|
|
44
|
-
const parsed =
|
|
44
|
+
const parsed = index.semverExports.parse(normalized);
|
|
45
45
|
if (!parsed || parsed.version !== normalized || parsed.build.length > 0) {
|
|
46
46
|
throw new Error(`${sourceLabel} 必须是合法 SemVer:${normalized}`);
|
|
47
47
|
}
|
|
@@ -55,7 +55,7 @@ function getMiniappManifestVersionError(version) {
|
|
|
55
55
|
return `必须是合法 SemVer:${String(version)}`;
|
|
56
56
|
}
|
|
57
57
|
const normalized = version.trim();
|
|
58
|
-
const parsed =
|
|
58
|
+
const parsed = index.semverExports.parse(normalized);
|
|
59
59
|
if (!parsed) {
|
|
60
60
|
return `必须是合法 SemVer:${normalized}`;
|
|
61
61
|
}
|