react-native-update-cli 2.17.0 → 2.19.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.
Files changed (57) hide show
  1. package/lib/api.d.ts +1 -1
  2. package/lib/api.js +140 -134
  3. package/lib/app.d.ts +2 -2
  4. package/lib/app.js +60 -107
  5. package/lib/bin.js +38 -35
  6. package/lib/bundle-pack.js +57 -77
  7. package/lib/bundle-runner.js +249 -312
  8. package/lib/bundle.js +71 -89
  9. package/lib/diff.js +224 -198
  10. package/lib/exports.js +14 -37
  11. package/lib/index.js +16 -17
  12. package/lib/install.js +24 -37
  13. package/lib/locales/en.d.ts +1 -0
  14. package/lib/locales/en.js +4 -11
  15. package/lib/locales/zh.d.ts +1 -0
  16. package/lib/locales/zh.js +4 -11
  17. package/lib/package.js +164 -218
  18. package/lib/provider.js +85 -107
  19. package/lib/types.js +1 -3
  20. package/lib/user.d.ts +1 -1
  21. package/lib/user.js +26 -39
  22. package/lib/utils/add-gitignore.js +16 -29
  23. package/lib/utils/app-info-parser/aab.js +133 -157
  24. package/lib/utils/app-info-parser/apk.js +42 -39
  25. package/lib/utils/app-info-parser/app.js +5 -11
  26. package/lib/utils/app-info-parser/index.js +21 -31
  27. package/lib/utils/app-info-parser/ipa.js +35 -35
  28. package/lib/utils/app-info-parser/resource-finder.js +84 -71
  29. package/lib/utils/app-info-parser/utils.js +52 -77
  30. package/lib/utils/app-info-parser/xml-parser/binary.js +82 -90
  31. package/lib/utils/app-info-parser/xml-parser/manifest.js +88 -98
  32. package/lib/utils/app-info-parser/zip.js +43 -51
  33. package/lib/utils/check-lockfile.js +28 -37
  34. package/lib/utils/check-plugin.js +16 -32
  35. package/lib/utils/command-result.js +7 -20
  36. package/lib/utils/constants.js +23 -63
  37. package/lib/utils/dep-versions.js +21 -27
  38. package/lib/utils/git.js +20 -64
  39. package/lib/utils/hbcTransform.js +133 -246
  40. package/lib/utils/http-helper.js +33 -44
  41. package/lib/utils/i18n.js +17 -26
  42. package/lib/utils/index.js +137 -179
  43. package/lib/utils/latest-version/index.js +128 -137
  44. package/lib/utils/options.js +13 -34
  45. package/lib/utils/plugin-config.js +43 -56
  46. package/lib/utils/runtime.js +50 -108
  47. package/lib/utils/zip-entries.js +70 -97
  48. package/lib/utils/zip-options.js +80 -181
  49. package/lib/versions.js +231 -265
  50. package/package.json +19 -20
  51. package/src/api.ts +44 -3
  52. package/src/diff.ts +129 -2
  53. package/src/locales/en.ts +2 -0
  54. package/src/locales/zh.ts +2 -0
  55. package/src/package.ts +1 -1
  56. package/src/user.ts +1 -1
  57. package/src/versions.ts +1 -1
package/lib/exports.js CHANGED
@@ -1,38 +1,15 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: Object.getOwnPropertyDescriptor(all, name).get
9
- });
10
- }
11
- _export(exports, {
12
- get CLIProviderImpl () {
13
- return _provider.CLIProviderImpl;
14
- },
15
- get diffCommands () {
16
- return _diff.diffCommands;
17
- },
18
- get getPlatform () {
19
- return _app.getPlatform;
20
- },
21
- get getSelectedApp () {
22
- return _app.getSelectedApp;
23
- },
24
- get getSession () {
25
- return _api.getSession;
26
- },
27
- get loadSession () {
28
- return _api.loadSession;
29
- },
30
- get question () {
31
- return _utils.question;
32
- }
33
- });
34
- const _api = require("./api");
35
- const _app = require("./app");
36
- const _diff = require("./diff");
37
- const _provider = require("./provider");
38
- const _utils = require("./utils");
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.question = exports.CLIProviderImpl = exports.diffCommands = exports.getSelectedApp = exports.getPlatform = exports.loadSession = exports.getSession = void 0;
4
+ var api_1 = require("./api");
5
+ Object.defineProperty(exports, "getSession", { enumerable: true, get: function () { return api_1.getSession; } });
6
+ Object.defineProperty(exports, "loadSession", { enumerable: true, get: function () { return api_1.loadSession; } });
7
+ var app_1 = require("./app");
8
+ Object.defineProperty(exports, "getPlatform", { enumerable: true, get: function () { return app_1.getPlatform; } });
9
+ Object.defineProperty(exports, "getSelectedApp", { enumerable: true, get: function () { return app_1.getSelectedApp; } });
10
+ var diff_1 = require("./diff");
11
+ Object.defineProperty(exports, "diffCommands", { enumerable: true, get: function () { return diff_1.diffCommands; } });
12
+ var provider_1 = require("./provider");
13
+ Object.defineProperty(exports, "CLIProviderImpl", { enumerable: true, get: function () { return provider_1.CLIProviderImpl; } });
14
+ var utils_1 = require("./utils");
15
+ Object.defineProperty(exports, "question", { enumerable: true, get: function () { return utils_1.question; } });
package/lib/index.js CHANGED
@@ -1,18 +1,17 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- _export_star(require("./exports"), exports);
6
- function _export_star(from, to) {
7
- Object.keys(from).forEach(function(k) {
8
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
- Object.defineProperty(to, k, {
10
- enumerable: true,
11
- get: function() {
12
- return from[k];
13
- }
14
- });
15
- }
16
- });
17
- return from;
18
- }
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./exports"), exports);
package/lib/install.js CHANGED
@@ -1,59 +1,46 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "installCommands", {
6
- enumerable: true,
7
- get: function() {
8
- return installCommands;
9
- }
10
- });
11
- const _child_process = require("child_process");
12
- const _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
- const _constants = require("./utils/constants");
14
- const _i18n = require("./utils/i18n");
15
- const _runtime = require("./utils/runtime");
16
- function _interop_require_default(obj) {
17
- return obj && obj.__esModule ? obj : {
18
- default: obj
19
- };
20
- }
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.installCommands = void 0;
7
+ const child_process_1 = require("child_process");
8
+ const path_1 = __importDefault(require("path"));
9
+ const constants_1 = require("./utils/constants");
10
+ const i18n_1 = require("./utils/i18n");
11
+ const runtime_1 = require("./utils/runtime");
21
12
  // package names / version specs only — rejects shell metacharacters since
22
13
  // Windows needs shell: true to run package manager .cmd shims
23
14
  const SAFE_PACKAGE_ARG = /^[@a-z0-9^~._/-]+$/i;
24
- const installCommands = {
25
- install: async ({ args })=>{
15
+ exports.installCommands = {
16
+ install: async ({ args }) => {
26
17
  if (args.length === 0) {
27
- throw new Error((0, _i18n.t)('installPackageRequired', {
28
- scriptName: _constants.scriptName
29
- }));
18
+ throw new Error((0, i18n_1.t)('installPackageRequired', { scriptName: constants_1.scriptName }));
30
19
  }
31
- for (const arg of args){
20
+ for (const arg of args) {
32
21
  if (!SAFE_PACKAGE_ARG.test(arg)) {
33
- throw new Error((0, _i18n.t)('installPackageRequired', {
34
- scriptName: _constants.scriptName
35
- }));
22
+ throw new Error((0, i18n_1.t)('installPackageRequired', { scriptName: constants_1.scriptName }));
36
23
  }
37
24
  }
38
- const cliDir = _path.default.resolve(__dirname, '..');
39
- const installCommand = (0, _runtime.getInstallCommand)(args, cliDir);
40
- const result = (0, _child_process.spawnSync)(installCommand.command, installCommand.args, {
25
+ const cliDir = path_1.default.resolve(__dirname, '..');
26
+ const installCommand = (0, runtime_1.getInstallCommand)(args, cliDir);
27
+ const result = (0, child_process_1.spawnSync)(installCommand.command, installCommand.args, {
41
28
  cwd: cliDir,
42
29
  stdio: 'inherit',
43
30
  // package manager executables are .cmd shims on Windows
44
- shell: process.platform === 'win32'
31
+ shell: process.platform === 'win32',
45
32
  });
46
33
  if (result.error) {
47
- throw new Error((0, _i18n.t)('installFailed', {
34
+ throw new Error((0, i18n_1.t)('installFailed', {
48
35
  packages: args.join(' '),
49
- error: result.error.message
36
+ error: result.error.message,
50
37
  }));
51
38
  }
52
39
  if (result.status !== 0) {
53
- throw new Error((0, _i18n.t)('installFailed', {
40
+ throw new Error((0, i18n_1.t)('installFailed', {
54
41
  packages: args.join(' '),
55
- error: `${installCommand.command} exited with code ${result.status}`
42
+ error: `${installCommand.command} exited with code ${result.status}`,
56
43
  }));
57
44
  }
58
- }
45
+ },
59
46
  };
@@ -138,6 +138,7 @@ declare const _default: {
138
138
  nodeHdiffpatchRequired: string;
139
139
  hbcTransformRoundTripFailed: string;
140
140
  hbcTransformNeedsPatch: string;
141
+ bundleStreamNeedsHdiffpatch: string;
141
142
  apkExtracted: string;
142
143
  composeSourceMapsNotFound: string;
143
144
  installPackageRequired: string;
package/lib/locales/en.js CHANGED
@@ -1,14 +1,6 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- const _default = {
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
12
4
  addedToGitignore: 'Added {{line}} to .gitignore',
13
5
  androidCrunchPngsWarning: 'The crunchPngs option of android seems not disabled (Please ignore this warning if already disabled), which may cause abnormal consumption of mobile network traffic. Please refer to https://cresc.dev/docs/getting-started#disable-crunchpngs-on-android \n',
14
6
  aabOpenApksFailed: 'Failed to open generated .apks file',
@@ -154,6 +146,7 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
154
146
  nodeHdiffpatchRequired: 'This function needs "node-hdiffpatch". Please run "{{scriptName}} install node-hdiffpatch" to install',
155
147
  hbcTransformRoundTripFailed: 'HBC transform round-trip verification failed; falling back to plain diff.',
156
148
  hbcTransformNeedsPatch: 'hbcTransform requires patch support from node-hdiffpatch; option ignored.',
149
+ bundleStreamNeedsHdiffpatch: 'bundleStreamThreshold requires diffStream/patchStream from node-hdiffpatch; option ignored.',
157
150
  apkExtracted: 'APK extracted to {{output}}',
158
151
  composeSourceMapsNotFound: 'Cannot find react-native/scripts/compose-source-maps.js, skipping hermes sourcemap composing. The uploaded sourcemap may not match the compiled bundle.',
159
152
  installPackageRequired: 'Please specify the package to install, e.g. "{{scriptName}} install node-hdiffpatch"',
@@ -168,5 +161,5 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
168
161
  unknownCommand: 'Unknown command: {{command}}',
169
162
  unsupportedPlatformForHermes: 'Unsupported platform for Hermes: {{platform}}',
170
163
  invalidManifest: 'Invalid manifest',
171
- failedToResolveResource: 'Failed to resolve resource: {{error}}'
164
+ failedToResolveResource: 'Failed to resolve resource: {{error}}',
172
165
  };
@@ -137,6 +137,7 @@ declare const _default: {
137
137
  nodeHdiffpatchRequired: string;
138
138
  hbcTransformRoundTripFailed: string;
139
139
  hbcTransformNeedsPatch: string;
140
+ bundleStreamNeedsHdiffpatch: string;
140
141
  apkExtracted: string;
141
142
  composeSourceMapsNotFound: string;
142
143
  installPackageRequired: string;
package/lib/locales/zh.js CHANGED
@@ -1,14 +1,6 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- const _default = {
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
12
4
  addedToGitignore: '已将 {{line}} 添加到 .gitignore',
13
5
  androidCrunchPngsWarning: 'android 的 crunchPngs 选项似乎尚未禁用(如已禁用则请忽略此提示),这可能导致热更包体积异常增大,具体请参考 https://pushy.reactnative.cn/docs/getting-started.html#%E7%A6%81%E7%94%A8-android-%E7%9A%84-crunch-%E4%BC%98%E5%8C%96 \n',
14
6
  aabOpenApksFailed: '无法打开生成的 .apks 文件',
@@ -153,6 +145,7 @@ const _default = {
153
145
  nodeHdiffpatchRequired: '此功能需要 "node-hdiffpatch"。请运行 "{{scriptName}} install node-hdiffpatch" 来安装',
154
146
  hbcTransformRoundTripFailed: 'HBC 变换 round-trip 自检未通过,已回退普通 diff。',
155
147
  hbcTransformNeedsPatch: 'hbcTransform 需要 node-hdiffpatch 的 patch 能力,选项已忽略。',
148
+ bundleStreamNeedsHdiffpatch: 'bundleStreamThreshold 需要 node-hdiffpatch 的 diffStream/patchStream 能力,选项已忽略。',
156
149
  apkExtracted: 'APK 已提取到 {{output}}',
157
150
  composeSourceMapsNotFound: '找不到 react-native/scripts/compose-source-maps.js,跳过 hermes sourcemap 合成。上传的 sourcemap 可能与编译后的 bundle 不匹配。',
158
151
  installPackageRequired: '请指定要安装的包,例如 "{{scriptName}} install node-hdiffpatch"',
@@ -167,5 +160,5 @@ const _default = {
167
160
  unknownCommand: '未知命令:{{command}}',
168
161
  unsupportedPlatformForHermes: 'Hermes 不支持当前系统平台:{{platform}}',
169
162
  invalidManifest: '无效的 manifest',
170
- failedToResolveResource: '资源解析失败:{{error}}'
163
+ failedToResolveResource: '资源解析失败:{{error}}',
171
164
  };