react-native-update-cli 2.24.2 → 2.26.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/README.md +12 -5
- package/README.zh-CN.md +12 -5
- package/cli.json +7 -1
- package/lib/api.d.ts +2 -0
- package/lib/api.js +63 -18
- package/lib/app.js +25 -3
- package/lib/bin.js +39 -45
- package/lib/bundle-runner.d.ts +45 -1
- package/lib/bundle-runner.js +303 -34
- package/lib/bundle.d.ts +1 -1
- package/lib/bundle.js +23 -7
- package/lib/commands.d.ts +6 -0
- package/lib/commands.js +65 -0
- package/lib/locales/en.d.ts +7 -14
- package/lib/locales/en.js +10 -17
- package/lib/locales/zh.d.ts +7 -13
- package/lib/locales/zh.js +10 -16
- package/lib/package.js +4 -0
- package/lib/provider.d.ts +1 -1
- package/lib/provider.js +3 -1
- package/lib/symbolicate.js +7 -2
- package/lib/types.d.ts +1 -0
- package/lib/user.js +6 -0
- package/lib/utils/add-gitignore.js +7 -1
- package/lib/utils/dep-versions.d.ts +7 -0
- package/lib/utils/dep-versions.js +78 -26
- package/lib/utils/git.js +9 -6
- package/lib/utils/hbcTransform.d.ts +15 -0
- package/lib/utils/hbcTransform.js +22 -0
- package/lib/utils/hermes-base.d.ts +61 -6
- package/lib/utils/hermes-base.js +328 -46
- package/lib/utils/hermes-literals.d.ts +51 -0
- package/lib/utils/hermes-literals.js +210 -0
- package/lib/utils/i18n.d.ts +5 -0
- package/lib/utils/i18n.js +14 -1
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/index.js +9 -4
- package/lib/utils/latest-version/index.js +8 -0
- package/lib/utils/runtime.d.ts +21 -0
- package/lib/utils/runtime.js +138 -5
- package/lib/utils/zip-range.js +3 -2
- package/lib/versions.js +14 -4
- package/package.json +6 -3
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -17
- package/src/api.ts +0 -470
- package/src/app.ts +0 -241
- package/src/auto-update.ts +0 -647
- package/src/bin-cresc.ts +0 -8
- package/src/bin.ts +0 -115
- package/src/bundle-pack.ts +0 -61
- package/src/bundle-runner.ts +0 -1430
- package/src/bundle.ts +0 -371
- package/src/cache.ts +0 -20
- package/src/diff.ts +0 -1010
- package/src/exports.ts +0 -17
- package/src/index.ts +0 -1
- package/src/install.ts +0 -50
- package/src/locales/en.ts +0 -257
- package/src/locales/zh.ts +0 -234
- package/src/native-package.ts +0 -338
- package/src/package.ts +0 -482
- package/src/provider.ts +0 -294
- package/src/symbolicate.ts +0 -164
- package/src/types.ts +0 -150
- package/src/user.ts +0 -39
- package/src/utils/add-gitignore.ts +0 -35
- package/src/utils/app-info-parser/aab.ts +0 -241
- package/src/utils/app-info-parser/apk.ts +0 -92
- package/src/utils/app-info-parser/app.ts +0 -7
- package/src/utils/app-info-parser/index.ts +0 -54
- package/src/utils/app-info-parser/ipa.ts +0 -109
- package/src/utils/app-info-parser/resource-finder.ts +0 -508
- package/src/utils/app-info-parser/utils.ts +0 -161
- package/src/utils/app-info-parser/xml-parser/binary.ts +0 -693
- package/src/utils/app-info-parser/xml-parser/manifest.ts +0 -228
- package/src/utils/app-info-parser/zip.ts +0 -108
- package/src/utils/check-lockfile.ts +0 -93
- package/src/utils/check-plugin.ts +0 -38
- package/src/utils/command-result.ts +0 -24
- package/src/utils/constants.ts +0 -25
- package/src/utils/dep-versions.ts +0 -83
- package/src/utils/git.ts +0 -71
- package/src/utils/hbcTransform.ts +0 -649
- package/src/utils/hermes-base.ts +0 -1137
- package/src/utils/http-helper.ts +0 -152
- package/src/utils/i18n.ts +0 -39
- package/src/utils/index.ts +0 -698
- package/src/utils/latest-version/index.ts +0 -573
- package/src/utils/options.ts +0 -78
- package/src/utils/plugin-config.ts +0 -32
- package/src/utils/runtime.ts +0 -187
- package/src/utils/slim-sourcemap.ts +0 -105
- package/src/utils/zip-entries.ts +0 -209
- package/src/utils/zip-options.ts +0 -178
- package/src/utils/zip-range.ts +0 -727
- package/src/utils/zip-raw-writer.ts +0 -247
- package/src/versions.ts +0 -892
package/lib/locales/en.js
CHANGED
|
@@ -34,24 +34,18 @@ exports.default = {
|
|
|
34
34
|
bundlingWithRN: 'Bundling with react-native: {{version}}',
|
|
35
35
|
cancelled: 'Cancelled',
|
|
36
36
|
composingSourceMap: 'Composing source map',
|
|
37
|
-
copyFileFailed: 'Failed to copy file: {{error}}',
|
|
38
|
-
copyHarmonyBundleError: 'Error copying Harmony bundle: {{error}}',
|
|
39
37
|
copyingDebugId: 'Copying debugid',
|
|
40
38
|
createAppSuccess: 'App created successfully (id: {{id}})',
|
|
41
39
|
deleteFile: 'Delete {{- file}}',
|
|
42
|
-
deletingFile: 'Delete {{- file}}',
|
|
43
40
|
enterAppIdQuestion: 'Enter AppId:',
|
|
44
41
|
enterNativePackageId: 'Enter native package ID:',
|
|
45
|
-
errorInHarmonyApp: 'Error in getEntryFromHarmonyApp: {{error}}',
|
|
46
42
|
expiredStatus: '(Expired)',
|
|
47
|
-
failedToParseIcon: '[Warning] failed to parse icon: {{error}}',
|
|
48
43
|
failedToParseUpdateJson: 'Failed to parse file `{{- configPath}}`. Try to remove it manually.',
|
|
49
44
|
fileGenerated: '{{- file}} generated.',
|
|
50
45
|
fileSizeExceeded: 'This file size is {{fileSize}} , exceeding the current quota {{maxSize}} . You may consider upgrading to a higher plan to increase this quota. Details can be found at: {{- pricingPageUrl}}',
|
|
51
46
|
forceHermes: 'Forcing Hermes enabled for this build',
|
|
52
47
|
hermesEnabledCompiling: 'Hermes enabled, now compiling to hermes bytecode:\n',
|
|
53
48
|
ipaUploadSuccess: 'Successfully uploaded IPA native package (id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
|
54
|
-
keyStrings: 'Key strings:',
|
|
55
49
|
latestVersionTag: '(latest: {{version}})',
|
|
56
50
|
lockBestPractice: `
|
|
57
51
|
Best practices for lock files:
|
|
@@ -94,15 +88,9 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
94
88
|
packing: 'Packing',
|
|
95
89
|
pausedStatus: '(Paused)',
|
|
96
90
|
platform: 'Platform',
|
|
97
|
-
platformPrompt: 'Platform (ios/android/harmony):',
|
|
98
91
|
platformQuestion: 'Platform(ios/android/harmony):',
|
|
99
|
-
platformRequired: 'Platform must be specified.',
|
|
100
92
|
pluginDetectionError: 'error while detecting {{name}} plugin: {{error}}',
|
|
101
93
|
pluginDetected: 'detected {{name}} plugin',
|
|
102
|
-
ppkPackageGenerated: 'ppk package generated and saved to: {{- output}}',
|
|
103
|
-
processingError: 'Error processing file: {{error}}',
|
|
104
|
-
processingPackage: 'Processing the package {{count}} ...',
|
|
105
|
-
processingStringPool: 'Processing the string pool ...',
|
|
106
94
|
publishUsage: 'Usage: pushy publish <ppk file> --platform ios|android|harmony',
|
|
107
95
|
sourceMapNotFound: 'Source map not found: {{path}}',
|
|
108
96
|
sourceMapMissingWarning: 'No source map was archived with this version: crashes cannot be symbolicated later. Bundle with the default --sourcemap, or pass --sourcemap <file> to publish.',
|
|
@@ -122,7 +110,6 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
122
110
|
sentryReleaseCreated: 'Sentry release created for version: {{version}}',
|
|
123
111
|
totalApps: 'Total {{count}} {{platform}} apps',
|
|
124
112
|
totalPackages: 'Total {{count}} packages',
|
|
125
|
-
typeStrings: 'Type strings:',
|
|
126
113
|
unsupportedPlatform: 'Unsupported platform `{{platform}}`',
|
|
127
114
|
uploadBundlePrompt: 'Upload this bundle now?(Y/N)',
|
|
128
115
|
uploadingSourcemap: 'Uploading sourcemap',
|
|
@@ -132,7 +119,6 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
132
119
|
usageExtractApk: 'Usage: cresc extractApk <aab file> [--output <apk file>] [--includeAllSplits] [--splits <split names>]',
|
|
133
120
|
usageParseApp: 'Usage: cresc parseApp <app file>',
|
|
134
121
|
usageParseIpa: 'Usage: cresc parseIpa <ipa file>',
|
|
135
|
-
usageUnderDevelopment: 'Usage is under development now.',
|
|
136
122
|
usageUploadApk: 'Usage: cresc uploadApk <apk file>',
|
|
137
123
|
usageUploadAab: 'Usage: cresc uploadAab <aab file> [--includeAllSplits] [--splits <split names>]',
|
|
138
124
|
usageUploadApp: 'Usage: cresc uploadApp <app file>',
|
|
@@ -183,9 +169,16 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
|
|
183
169
|
hermesBaseRangeFallback: 'Hermes base: partial download unavailable ({{- reason}}); downloading the whole package',
|
|
184
170
|
hermesBaseCompileFailed: 'Hermes base compile failed ({{- reason}}); retrying without -base-bytecode',
|
|
185
171
|
hermesBaseCompileFailedLog: 'Hermes base: full compiler output written to {{- file}}',
|
|
186
|
-
hermesBasePlainCompileFailed: 'Hermes base: the plain compile used for verification failed ({{- reason}});
|
|
187
|
-
hermesBaseVerified: 'Hermes base: bytecode verified equivalent to a plain compile',
|
|
188
|
-
hermesBaseVerifyFailed: 'Hermes base: bytecode differs from a plain compile; dropping the base
|
|
172
|
+
hermesBasePlainCompileFailed: 'Hermes base: the plain compile used for verification failed ({{- reason}}); dropping the base and compiling again without it',
|
|
173
|
+
hermesBaseVerified: 'Hermes base: bytecode verified equivalent to a plain compile ({{functions}} functions)',
|
|
174
|
+
hermesBaseVerifyFailed: 'Hermes base: bytecode differs from a plain compile ({{- detail}}); dropping the base',
|
|
175
|
+
hermesBaseVerifyDumpFailed: 'Hermes base: could not compare the bytecode ({{- detail}}); dropping the base',
|
|
176
|
+
hermesBaseVerifyDumpsWritten: 'Hermes base: disassemblies written to {{- withBase}} and {{- plain}}',
|
|
189
177
|
cacheCleaned: 'Removed {{count}} cached bundle(s)',
|
|
190
178
|
cacheStats: 'Bundle cache: {{- dir}} — {{files}} file(s), {{mb}} MB',
|
|
179
|
+
loginCredentialsRequired: 'Email and password are required. Usage: {{scriptName}} login <email> <password>',
|
|
180
|
+
bundleUnexpectedArgs: 'bundle takes no positional arguments, got: {{- args}}. Boolean flags take no value; switch one off with --no-<flag> (e.g. --no-sourcemap).',
|
|
181
|
+
unsafeIntermediateDir: 'Refusing to empty {{- dir}} as the intermediate directory: it resolves to a protected or symbolic-link location. Point --intermediaDir at a dedicated build directory.',
|
|
182
|
+
appKeyMissing: 'App {{appId}} did not return a valid app key.',
|
|
183
|
+
errorStackHint: '(set RNU_DEBUG=1 to print the stack trace)',
|
|
191
184
|
};
|
package/lib/locales/zh.d.ts
CHANGED
|
@@ -32,24 +32,18 @@ declare const _default: {
|
|
|
32
32
|
bundlingWithRN: string;
|
|
33
33
|
cancelled: string;
|
|
34
34
|
composingSourceMap: string;
|
|
35
|
-
copyFileFailed: string;
|
|
36
|
-
copyHarmonyBundleError: string;
|
|
37
35
|
copyingDebugId: string;
|
|
38
36
|
createAppSuccess: string;
|
|
39
37
|
deleteFile: string;
|
|
40
|
-
deletingFile: string;
|
|
41
38
|
enterAppIdQuestion: string;
|
|
42
39
|
enterNativePackageId: string;
|
|
43
|
-
errorInHarmonyApp: string;
|
|
44
40
|
expiredStatus: string;
|
|
45
|
-
failedToParseIcon: string;
|
|
46
41
|
failedToParseUpdateJson: string;
|
|
47
42
|
fileGenerated: string;
|
|
48
43
|
fileSizeExceeded: string;
|
|
49
44
|
forceHermes: string;
|
|
50
45
|
hermesEnabledCompiling: string;
|
|
51
46
|
ipaUploadSuccess: string;
|
|
52
|
-
keyStrings: string;
|
|
53
47
|
latestVersionTag: string;
|
|
54
48
|
lockBestPractice: string;
|
|
55
49
|
lockNotFound: string;
|
|
@@ -86,15 +80,9 @@ declare const _default: {
|
|
|
86
80
|
packing: string;
|
|
87
81
|
pausedStatus: string;
|
|
88
82
|
platform: string;
|
|
89
|
-
platformPrompt: string;
|
|
90
83
|
platformQuestion: string;
|
|
91
|
-
platformRequired: string;
|
|
92
84
|
pluginDetectionError: string;
|
|
93
85
|
pluginDetected: string;
|
|
94
|
-
ppkPackageGenerated: string;
|
|
95
|
-
processingError: string;
|
|
96
|
-
processingPackage: string;
|
|
97
|
-
processingStringPool: string;
|
|
98
86
|
sourceMapNotFound: string;
|
|
99
87
|
sourceMapMissingWarning: string;
|
|
100
88
|
sourceMapArchived: string;
|
|
@@ -114,7 +102,6 @@ declare const _default: {
|
|
|
114
102
|
sentryReleaseCreated: string;
|
|
115
103
|
totalApps: string;
|
|
116
104
|
totalPackages: string;
|
|
117
|
-
typeStrings: string;
|
|
118
105
|
unsupportedPlatform: string;
|
|
119
106
|
uploadBundlePrompt: string;
|
|
120
107
|
uploadingSourcemap: string;
|
|
@@ -177,7 +164,14 @@ declare const _default: {
|
|
|
177
164
|
hermesBasePlainCompileFailed: string;
|
|
178
165
|
hermesBaseVerified: string;
|
|
179
166
|
hermesBaseVerifyFailed: string;
|
|
167
|
+
hermesBaseVerifyDumpFailed: string;
|
|
168
|
+
hermesBaseVerifyDumpsWritten: string;
|
|
180
169
|
cacheCleaned: string;
|
|
181
170
|
cacheStats: string;
|
|
171
|
+
loginCredentialsRequired: string;
|
|
172
|
+
bundleUnexpectedArgs: string;
|
|
173
|
+
unsafeIntermediateDir: string;
|
|
174
|
+
appKeyMissing: string;
|
|
175
|
+
errorStackHint: string;
|
|
182
176
|
};
|
|
183
177
|
export default _default;
|
package/lib/locales/zh.js
CHANGED
|
@@ -34,24 +34,18 @@ exports.default = {
|
|
|
34
34
|
bundlingWithRN: '正在使用 react-native {{version}} 打包',
|
|
35
35
|
cancelled: '已取消',
|
|
36
36
|
composingSourceMap: '正在生成 source map',
|
|
37
|
-
copyFileFailed: '复制文件失败:{{error}}',
|
|
38
|
-
copyHarmonyBundleError: '复制 Harmony bundle 错误:{{error}}',
|
|
39
37
|
copyingDebugId: '正在复制 debugid',
|
|
40
38
|
createAppSuccess: '已成功创建应用(id: {{id}})',
|
|
41
39
|
deleteFile: '删除 {{- file}}',
|
|
42
|
-
deletingFile: '删除 {{- file}}',
|
|
43
40
|
enterAppIdQuestion: '输入应用 id:',
|
|
44
41
|
enterNativePackageId: '输入原生包 id:',
|
|
45
|
-
errorInHarmonyApp: '获取 Harmony 应用入口时出错:{{error}}',
|
|
46
42
|
expiredStatus: '(已过期)',
|
|
47
|
-
failedToParseIcon: '[警告] 解析图标失败:{{error}}',
|
|
48
43
|
failedToParseUpdateJson: '无法解析文件 `{{- configPath}}`。请手动删除它。',
|
|
49
44
|
fileGenerated: '已生成 {{- file}}',
|
|
50
45
|
fileSizeExceeded: '此文件大小 {{fileSize}} , 超出当前额度 {{maxSize}} 。您可以考虑升级付费业务以提升此额度。详情请访问: {{- pricingPageUrl}}',
|
|
51
46
|
forceHermes: '强制启用 Hermes 编译',
|
|
52
47
|
hermesEnabledCompiling: 'Hermes 已启用,正在编译为 hermes 字节码:\n',
|
|
53
48
|
ipaUploadSuccess: '已成功上传ipa原生包(id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
|
54
|
-
keyStrings: '键字符串:',
|
|
55
49
|
latestVersionTag: '(最新:{{version}})',
|
|
56
50
|
lockBestPractice: `
|
|
57
51
|
关于 lock 文件的最佳实践:
|
|
@@ -94,15 +88,9 @@ exports.default = {
|
|
|
94
88
|
packing: '正在打包',
|
|
95
89
|
pausedStatus: '(已暂停)',
|
|
96
90
|
platform: '平台',
|
|
97
|
-
platformPrompt: '平台(ios/android/harmony):',
|
|
98
91
|
platformQuestion: '平台(ios/android/harmony):',
|
|
99
|
-
platformRequired: '必须指定平台。',
|
|
100
92
|
pluginDetectionError: '检测 {{name}} 插件时出错:{{error}}',
|
|
101
93
|
pluginDetected: '检测到 {{name}} 插件',
|
|
102
|
-
ppkPackageGenerated: 'ppk 热更包已生成并保存到: {{- output}}',
|
|
103
|
-
processingError: '处理文件时出错:{{error}}',
|
|
104
|
-
processingPackage: '正在处理包 {{count}}...',
|
|
105
|
-
processingStringPool: '正在处理字符串池...',
|
|
106
94
|
sourceMapNotFound: '找不到 source map:{{path}}',
|
|
107
95
|
sourceMapMissingWarning: '本版本没有归档 source map,之后的崩溃堆栈将无法还原。请用默认的 --sourcemap 打包,或在 publish 时传 --sourcemap <文件>。',
|
|
108
96
|
sourceMapArchived: 'source map 已随版本 {{id}} 归档',
|
|
@@ -122,7 +110,6 @@ exports.default = {
|
|
|
122
110
|
sentryReleaseCreated: '已为版本 {{version}} 创建 Sentry release',
|
|
123
111
|
totalApps: '共 {{count}} 个 {{platform}} 应用',
|
|
124
112
|
totalPackages: '共 {{count}} 个包',
|
|
125
|
-
typeStrings: '类型字符串:',
|
|
126
113
|
unsupportedPlatform: '无法识别的平台 `{{platform}}`',
|
|
127
114
|
uploadBundlePrompt: '是否现在上传此热更包?(Y/N)',
|
|
128
115
|
uploadingSourcemap: '正在上传 sourcemap',
|
|
@@ -182,9 +169,16 @@ exports.default = {
|
|
|
182
169
|
hermesBaseRangeFallback: 'Hermes base:无法按需下载({{- reason}}),改为下载整包',
|
|
183
170
|
hermesBaseCompileFailed: 'Hermes base 编译失败({{- reason}}),改为不带 -base-bytecode 重编',
|
|
184
171
|
hermesBaseCompileFailedLog: 'Hermes base:完整编译错误已写入 {{- file}}',
|
|
185
|
-
hermesBasePlainCompileFailed: 'Hermes base:用于校验的普通编译失败({{- reason}}
|
|
186
|
-
hermesBaseVerified: 'Hermes base
|
|
187
|
-
hermesBaseVerifyFailed: 'Hermes base
|
|
172
|
+
hermesBasePlainCompileFailed: 'Hermes base:用于校验的普通编译失败({{- reason}}),放弃 base,不带 base 重新编译',
|
|
173
|
+
hermesBaseVerified: 'Hermes base:字节码与普通编译等价,校验通过({{functions}} 个函数)',
|
|
174
|
+
hermesBaseVerifyFailed: 'Hermes base:字节码与普通编译不等价({{- detail}}),放弃 base',
|
|
175
|
+
hermesBaseVerifyDumpFailed: 'Hermes base:无法比对字节码({{- detail}}),放弃 base',
|
|
176
|
+
hermesBaseVerifyDumpsWritten: 'Hermes base:两份反汇编已写入 {{- withBase}} 与 {{- plain}}',
|
|
188
177
|
cacheCleaned: '已清理 {{count}} 个缓存 bundle',
|
|
189
178
|
cacheStats: 'bundle 缓存:{{- dir}} — {{files}} 个文件,{{mb}} MB',
|
|
179
|
+
loginCredentialsRequired: '需要提供邮箱和密码。用法:{{scriptName}} login <邮箱> <密码>',
|
|
180
|
+
bundleUnexpectedArgs: 'bundle 不接受位置参数,收到:{{- args}}。布尔选项不带值,关闭请使用 --no-<选项>(例如 --no-sourcemap)。',
|
|
181
|
+
unsafeIntermediateDir: '拒绝清空中间目录 {{- dir}}:该路径指向受保护目录或包含符号链接。请用 --intermediaDir 指定一个专用的构建目录。',
|
|
182
|
+
appKeyMissing: '应用 {{appId}} 未返回有效的 appKey。',
|
|
183
|
+
errorStackHint: '(设置 RNU_DEBUG=1 可打印完整堆栈)',
|
|
190
184
|
};
|
package/lib/package.js
CHANGED
|
@@ -206,6 +206,10 @@ async function listPackage(appId, packages) {
|
|
|
206
206
|
return allPkgs;
|
|
207
207
|
}
|
|
208
208
|
async function choosePackage(appId, packages) {
|
|
209
|
+
// Fail before fetching or rendering the package list when no prompt exists.
|
|
210
|
+
if ((0, utils_1.isNonInteractive)()) {
|
|
211
|
+
throw new Error((0, i18n_1.t)('packageIdRequired'));
|
|
212
|
+
}
|
|
209
213
|
const list = await listPackage(appId, packages);
|
|
210
214
|
const packageMap = new Map(list?.map((v) => [v.id.toString(), v]));
|
|
211
215
|
while (true) {
|
package/lib/provider.d.ts
CHANGED
|
@@ -20,5 +20,5 @@ export declare class CLIProviderImpl implements CLIProvider {
|
|
|
20
20
|
updateVersion(appId: string, versionId: string, updates: UpdateVersionOptions): Promise<CommandResult>;
|
|
21
21
|
getPlatform(platform?: Platform): Promise<Platform>;
|
|
22
22
|
loadSession(): Promise<Session>;
|
|
23
|
-
listPackages(appId
|
|
23
|
+
listPackages(appId: string): Promise<CommandResult>;
|
|
24
24
|
}
|
package/lib/provider.js
CHANGED
|
@@ -84,13 +84,15 @@ class CLIProviderImpl {
|
|
|
84
84
|
entryFile: options.entryFile || 'index.js',
|
|
85
85
|
output: options.output || DEFAULT_BUNDLE_OUTPUT,
|
|
86
86
|
'no-interactive': true,
|
|
87
|
-
|
|
87
|
+
// on by default like the CLI: archived with the version for symbolicate
|
|
88
|
+
sourcemap: options.sourcemap ?? true,
|
|
88
89
|
taro: options.taro || false,
|
|
89
90
|
expo: options.expo || false,
|
|
90
91
|
rncli: options.rncli || false,
|
|
91
92
|
hermes: options.hermes || false,
|
|
92
93
|
hermesBase: options.hermesBase || 'auto',
|
|
93
94
|
verifyHermesBase: options.verifyHermesBase ?? true,
|
|
95
|
+
resetCache: options.resetCache ?? true,
|
|
94
96
|
sentryRelease: options.sentryRelease,
|
|
95
97
|
sentryDist: options.sentryDist,
|
|
96
98
|
appId: options.appId,
|
package/lib/symbolicate.js
CHANGED
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.symbolicateCommands = void 0;
|
|
7
7
|
exports.symbolicateStack = symbolicateStack;
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
10
9
|
const source_map_1 = require("source-map");
|
|
11
10
|
const api_1 = require("./api");
|
|
12
11
|
const app_1 = require("./app");
|
|
13
12
|
const i18n_1 = require("./utils/i18n");
|
|
13
|
+
const runtime_1 = require("./utils/runtime");
|
|
14
14
|
const slim_sourcemap_1 = require("./utils/slim-sourcemap");
|
|
15
15
|
const versions_1 = require("./versions");
|
|
16
16
|
// A frame location inside a shipped bundle: `<bundle>:<line>:<column>`. Covers
|
|
@@ -59,6 +59,11 @@ async function findVersionByHash(appId, hash) {
|
|
|
59
59
|
}
|
|
60
60
|
async function readStack(source) {
|
|
61
61
|
if (!source || source === '-') {
|
|
62
|
+
// No file and an interactive terminal: nothing is piped in, so waiting on
|
|
63
|
+
// stdin would just hang. `-` is an explicit request for stdin either way.
|
|
64
|
+
if (!source && process.stdin.isTTY) {
|
|
65
|
+
throw new Error((0, i18n_1.t)('symbolicateUsage'));
|
|
66
|
+
}
|
|
62
67
|
return new Promise((resolve, reject) => {
|
|
63
68
|
const chunks = [];
|
|
64
69
|
process.stdin.on('data', (chunk) => chunks.push(Buffer.from(chunk)));
|
|
@@ -94,7 +99,7 @@ exports.symbolicateCommands = {
|
|
|
94
99
|
if (!located?.url) {
|
|
95
100
|
throw new Error((0, i18n_1.t)('symbolicateNoSourceMap', { id: versionId }));
|
|
96
101
|
}
|
|
97
|
-
const response = await (0,
|
|
102
|
+
const response = await (0, runtime_1.webFetch)(located.url);
|
|
98
103
|
if (!response.ok) {
|
|
99
104
|
throw new Error(`Failed to download source map: HTTP ${response.status}`);
|
|
100
105
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -123,6 +123,7 @@ export interface CLIProvider {
|
|
|
123
123
|
}>;
|
|
124
124
|
listVersions: (appId: string) => Promise<CommandResult>;
|
|
125
125
|
updateVersion: (appId: string, versionId: string, updates: UpdateVersionOptions) => Promise<CommandResult>;
|
|
126
|
+
listPackages: (appId: string) => Promise<CommandResult>;
|
|
126
127
|
getPlatform: (platform?: Platform) => Promise<Platform>;
|
|
127
128
|
loadSession: () => Promise<Session>;
|
|
128
129
|
}
|
package/lib/user.js
CHANGED
|
@@ -8,6 +8,7 @@ const crypto_1 = __importDefault(require("crypto"));
|
|
|
8
8
|
const api_1 = require("./api");
|
|
9
9
|
const utils_1 = require("./utils");
|
|
10
10
|
const add_gitignore_1 = require("./utils/add-gitignore");
|
|
11
|
+
const constants_1 = require("./utils/constants");
|
|
11
12
|
const i18n_1 = require("./utils/i18n");
|
|
12
13
|
function md5(str) {
|
|
13
14
|
return crypto_1.default.createHash('md5').update(str).digest('hex');
|
|
@@ -16,6 +17,11 @@ exports.userCommands = {
|
|
|
16
17
|
login: async ({ args }) => {
|
|
17
18
|
const email = args[0] || (await (0, utils_1.question)('email:'));
|
|
18
19
|
const pwd = args[1] || (await (0, utils_1.question)('password:', true));
|
|
20
|
+
if (!email || !pwd) {
|
|
21
|
+
// without a terminal `question` answers '': fail here instead of
|
|
22
|
+
// sending empty credentials to the server
|
|
23
|
+
throw new Error((0, i18n_1.t)('loginCredentialsRequired', { scriptName: constants_1.scriptName }));
|
|
24
|
+
}
|
|
19
25
|
const { token, info } = await (0, api_1.post)('/user/login', {
|
|
20
26
|
email,
|
|
21
27
|
pwd: md5(pwd),
|
|
@@ -16,8 +16,14 @@ function addGitIgnore() {
|
|
|
16
16
|
}
|
|
17
17
|
const gitignoreContent = fs_1.default.readFileSync(gitignorePath, 'utf-8');
|
|
18
18
|
const gitignoreLines = gitignoreContent.split('\n');
|
|
19
|
+
// `.pushy`, `/.pushy` and `.pushy/` all ignore the same directory; a
|
|
20
|
+
// trailing slash only matches directories, so it counts for tempDir alone
|
|
21
|
+
const covers = (entry, line) => {
|
|
22
|
+
const pattern = line.trim().replace(/^\//, '');
|
|
23
|
+
return pattern === entry || (entry === constants_1.tempDir && pattern === `${entry}/`);
|
|
24
|
+
};
|
|
19
25
|
for (const line of gitignoreLines) {
|
|
20
|
-
const index = shouldIgnore.
|
|
26
|
+
const index = shouldIgnore.findIndex((entry) => covers(entry, line));
|
|
21
27
|
if (index !== -1) {
|
|
22
28
|
shouldIgnore.splice(index, 1);
|
|
23
29
|
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
/** Installed versions of the cwd project's dependencies, keys sorted. */
|
|
2
2
|
export declare function getDepVersions(): Record<string, string>;
|
|
3
|
+
/**
|
|
4
|
+
* Installed version of one direct (dev)dependency of the cwd project, or
|
|
5
|
+
* undefined when the project does not declare it or it is not installed.
|
|
6
|
+
* Two file reads instead of one per dependency: the version banner printed
|
|
7
|
+
* before every command must not scale with the size of the project.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getDepVersion(name: string, cwd?: string): string | undefined;
|
|
3
10
|
/**
|
|
4
11
|
* Same data as `getDepVersions()` but as a lazily populated object, for the
|
|
5
12
|
* remaining property-access call sites (`depVersions['react-native']`).
|
|
@@ -1,37 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Installed versions of
|
|
3
|
-
// Resolving them means reading one package.json per dependency, so
|
|
4
|
-
//
|
|
5
|
-
//
|
|
2
|
+
// Installed versions of the dependencies/devDependencies of the project in
|
|
3
|
+
// cwd. Resolving them means reading one package.json per dependency, so the
|
|
4
|
+
// full map is built lazily (on first use) and memoized rather than at import
|
|
5
|
+
// time, and the version banner printed by every command asks for the single
|
|
6
|
+
// dependency it needs (`getDepVersion`) instead of the whole map.
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
6
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
11
|
exports.depVersions = void 0;
|
|
8
12
|
exports.getDepVersions = getDepVersions;
|
|
13
|
+
exports.getDepVersion = getDepVersion;
|
|
14
|
+
const fs_1 = __importDefault(require("fs"));
|
|
15
|
+
const path_1 = __importDefault(require("path"));
|
|
16
|
+
let cachedCwd;
|
|
9
17
|
let cached;
|
|
10
|
-
function
|
|
11
|
-
let currentPackage = null;
|
|
18
|
+
function readProjectPackageJson(cwd) {
|
|
12
19
|
try {
|
|
13
|
-
|
|
20
|
+
return JSON.parse(fs_1.default.readFileSync(path_1.default.join(cwd, 'package.json'), 'utf8'));
|
|
14
21
|
}
|
|
15
|
-
catch
|
|
16
|
-
//
|
|
22
|
+
catch {
|
|
23
|
+
// no package.json (or not JSON): the project simply declares nothing
|
|
24
|
+
return null;
|
|
17
25
|
}
|
|
26
|
+
}
|
|
27
|
+
/** direct dependency names (dependencies + devDependencies), deduplicated */
|
|
28
|
+
function directDependencyNames(pkg) {
|
|
29
|
+
return [
|
|
30
|
+
...new Set([
|
|
31
|
+
...Object.keys(pkg.dependencies ?? {}),
|
|
32
|
+
...Object.keys(pkg.devDependencies ?? {}),
|
|
33
|
+
]),
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Version of the installed copy of `dep`: the nearest
|
|
38
|
+
* `node_modules/<dep>/package.json` from `cwd` upwards, read directly. Not
|
|
39
|
+
* `require.resolve`: a package whose `exports` map omits package.json makes
|
|
40
|
+
* it throw, and bun caches its answer per specifier, ignoring `paths`.
|
|
41
|
+
*/
|
|
42
|
+
function readInstalledVersion(dep, cwd) {
|
|
43
|
+
let dir = path_1.default.resolve(cwd);
|
|
44
|
+
for (;;) {
|
|
45
|
+
try {
|
|
46
|
+
const pkg = JSON.parse(fs_1.default.readFileSync(path_1.default.join(dir, 'node_modules', dep, 'package.json'), 'utf8'));
|
|
47
|
+
return typeof pkg.version === 'string' ? pkg.version : undefined;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// not installed at this level
|
|
51
|
+
}
|
|
52
|
+
const parent = path_1.default.dirname(dir);
|
|
53
|
+
if (parent === dir) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
dir = parent;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function readDepVersions(cwd) {
|
|
18
60
|
const versions = {};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
: [];
|
|
26
|
-
const dedupedDeps = [...new Set([...depKeys, ...devDepKeys])];
|
|
27
|
-
for (const dep of dedupedDeps) {
|
|
28
|
-
try {
|
|
29
|
-
const packageJsonPath = require.resolve(`${dep}/package.json`, {
|
|
30
|
-
paths: [process.cwd()],
|
|
31
|
-
});
|
|
32
|
-
versions[dep] = require(packageJsonPath).version;
|
|
61
|
+
const pkg = readProjectPackageJson(cwd);
|
|
62
|
+
if (pkg) {
|
|
63
|
+
for (const dep of directDependencyNames(pkg)) {
|
|
64
|
+
const version = readInstalledVersion(dep, cwd);
|
|
65
|
+
if (version) {
|
|
66
|
+
versions[dep] = version;
|
|
33
67
|
}
|
|
34
|
-
catch (_e) { }
|
|
35
68
|
}
|
|
36
69
|
}
|
|
37
70
|
// sorted keys: the object is sent to the server as-is and diffed
|
|
@@ -44,11 +77,30 @@ function readDepVersions() {
|
|
|
44
77
|
}
|
|
45
78
|
/** Installed versions of the cwd project's dependencies, keys sorted. */
|
|
46
79
|
function getDepVersions() {
|
|
47
|
-
|
|
48
|
-
|
|
80
|
+
const cwd = path_1.default.resolve(process.cwd());
|
|
81
|
+
if (!cached || cachedCwd !== cwd) {
|
|
82
|
+
cached = readDepVersions(cwd);
|
|
83
|
+
cachedCwd = cwd;
|
|
49
84
|
}
|
|
50
85
|
return cached;
|
|
51
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Installed version of one direct (dev)dependency of the cwd project, or
|
|
89
|
+
* undefined when the project does not declare it or it is not installed.
|
|
90
|
+
* Two file reads instead of one per dependency: the version banner printed
|
|
91
|
+
* before every command must not scale with the size of the project.
|
|
92
|
+
*/
|
|
93
|
+
function getDepVersion(name, cwd = process.cwd()) {
|
|
94
|
+
const resolvedCwd = path_1.default.resolve(cwd);
|
|
95
|
+
if (cached && cachedCwd === resolvedCwd) {
|
|
96
|
+
return cached[name];
|
|
97
|
+
}
|
|
98
|
+
const pkg = readProjectPackageJson(resolvedCwd);
|
|
99
|
+
if (!pkg || !directDependencyNames(pkg).includes(name)) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
return readInstalledVersion(name, resolvedCwd);
|
|
103
|
+
}
|
|
52
104
|
/**
|
|
53
105
|
* Same data as `getDepVersions()` but as a lazily populated object, for the
|
|
54
106
|
* remaining property-access call sites (`depVersions['react-native']`).
|
package/lib/utils/git.js
CHANGED
|
@@ -35,16 +35,19 @@ async function getRemoteOrigin(cwd) {
|
|
|
35
35
|
async function getCommitInfo() {
|
|
36
36
|
try {
|
|
37
37
|
const gitRoot = await gitOutput(['rev-parse', '--show-toplevel']);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
gitOutput(['log', '-1', '--format=%an'], gitRoot),
|
|
42
|
-
gitOutput(['log', '-1', '--format=%ct'], gitRoot),
|
|
38
|
+
// one `git log` for every commit field (NUL-separated, the multi-line
|
|
39
|
+
// message last) instead of one git process per field
|
|
40
|
+
const [log, origin] = await Promise.all([
|
|
41
|
+
gitOutput(['log', '-1', '--format=%H%x00%an%x00%ct%x00%B'], gitRoot),
|
|
43
42
|
getRemoteOrigin(gitRoot),
|
|
44
43
|
]);
|
|
44
|
+
const [hash, author, timestamp, ...message] = log.split('\0');
|
|
45
|
+
if (!hash) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
45
48
|
return {
|
|
46
49
|
hash,
|
|
47
|
-
message,
|
|
50
|
+
message: message.join('\0'),
|
|
48
51
|
author,
|
|
49
52
|
timestamp,
|
|
50
53
|
origin,
|
|
@@ -57,6 +57,21 @@ export declare function compileLayoutToWire(layout: HbcLayout): HbcLayoutWire;
|
|
|
57
57
|
export declare function getHbcVersion(buf: Buffer): number | null;
|
|
58
58
|
/** 同一版本号可能有多个候选布局(按声明顺序即优先级)。 */
|
|
59
59
|
export declare function findLayouts(version: number): HbcLayout[];
|
|
60
|
+
/** Byte range of one section of an HBC file (see resolveHbcSections). */
|
|
61
|
+
export type HbcSectionRange = {
|
|
62
|
+
start: number;
|
|
63
|
+
size: number;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Section byte ranges of an HBC file from its 128-byte header and total
|
|
67
|
+
* length, keyed by section name (arrayBuffer, objKeyBuffer, ... for v87–96;
|
|
68
|
+
* literalValueBuffer, objShapeTable, ... for v98). Null when no known layout
|
|
69
|
+
* fits, which callers treat as "cannot read this file structurally".
|
|
70
|
+
*/
|
|
71
|
+
export declare function resolveHbcSections(header: Buffer, fileLength: number): {
|
|
72
|
+
version: number;
|
|
73
|
+
sections: Map<string, HbcSectionRange>;
|
|
74
|
+
} | null;
|
|
60
75
|
/**
|
|
61
76
|
* 对 HBC buffer 执行变换(inverse=false)或逆变换(inverse=true)。
|
|
62
77
|
* 同一版本号可能存在多个候选布局(如 v98 早/晚两种头部),按声明顺序
|
|
@@ -20,6 +20,7 @@ exports.HBC_TRANSFORM_VERSION = exports.HBC_LAYOUTS = void 0;
|
|
|
20
20
|
exports.compileLayoutToWire = compileLayoutToWire;
|
|
21
21
|
exports.getHbcVersion = getHbcVersion;
|
|
22
22
|
exports.findLayouts = findLayouts;
|
|
23
|
+
exports.resolveHbcSections = resolveHbcSections;
|
|
23
24
|
exports.transformHbc = transformHbc;
|
|
24
25
|
exports.pickLayout = pickLayout;
|
|
25
26
|
exports.transformHbcWithLayout = transformHbcWithLayout;
|
|
@@ -319,6 +320,27 @@ function resolveSectionsFromHeader(header, fileLength, layout) {
|
|
|
319
320
|
}
|
|
320
321
|
return resolved;
|
|
321
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* Section byte ranges of an HBC file from its 128-byte header and total
|
|
325
|
+
* length, keyed by section name (arrayBuffer, objKeyBuffer, ... for v87–96;
|
|
326
|
+
* literalValueBuffer, objShapeTable, ... for v98). Null when no known layout
|
|
327
|
+
* fits, which callers treat as "cannot read this file structurally".
|
|
328
|
+
*/
|
|
329
|
+
function resolveHbcSections(header, fileLength) {
|
|
330
|
+
const version = getHbcVersion(header);
|
|
331
|
+
if (version === null)
|
|
332
|
+
return null;
|
|
333
|
+
for (const layout of findLayouts(version)) {
|
|
334
|
+
const resolved = resolveSectionsFromHeader(header, fileLength, layout);
|
|
335
|
+
if (resolved) {
|
|
336
|
+
return {
|
|
337
|
+
version,
|
|
338
|
+
sections: new Map(resolved.map((s) => [s.desc.name, { start: s.start, size: s.size }])),
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
322
344
|
function applyDelta(out, section, inverse) {
|
|
323
345
|
const { start, size, desc } = section;
|
|
324
346
|
for (const f of desc.deltaFields ?? []) {
|