react-native-update-cli 2.18.0 → 2.20.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 (56) hide show
  1. package/lib/api.d.ts +1 -1
  2. package/lib/api.js +143 -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 +190 -240
  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.js +3 -11
  14. package/lib/locales/zh.js +3 -11
  15. package/lib/native-package.d.ts +17 -0
  16. package/lib/native-package.js +232 -0
  17. package/lib/package.js +180 -225
  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 -21
  51. package/src/api.ts +47 -3
  52. package/src/diff.ts +12 -20
  53. package/src/native-package.ts +248 -0
  54. package/src/package.ts +29 -19
  55. package/src/user.ts +1 -1
  56. package/src/versions.ts +1 -1
@@ -1,77 +1,57 @@
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 ONE_DAY () {
13
- return ONE_DAY;
14
- },
15
- get default () {
16
- return _default;
17
- }
18
- });
19
- const _fs = require("fs");
20
- const _globaldirs = require("global-dirs");
21
- const _os = require("os");
22
- const _path = require("path");
23
- const _registryauthtoken = /*#__PURE__*/ _interop_require_default(require("registry-auth-token"));
24
- const _registryurl = /*#__PURE__*/ _interop_require_default(require("registry-auth-token/registry-url"));
25
- const _gt = /*#__PURE__*/ _interop_require_default(require("semver/functions/gt"));
26
- const _maxsatisfying = /*#__PURE__*/ _interop_require_default(require("semver/ranges/max-satisfying"));
27
- const _url = require("url");
28
- function _interop_require_default(obj) {
29
- return obj && obj.__esModule ? obj : {
30
- default: obj
31
- };
32
- }
33
- const ONE_DAY = 1000 * 60 * 60 * 24; // eslint-disable-line @typescript-eslint/naming-convention
34
- const isPackageJson = (obj)=>{
35
- return obj.dependencies !== undefined || obj.devDependencies !== undefined || obj.peerDependencies !== undefined;
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.ONE_DAY = void 0;
7
+ const fs_1 = require("fs");
8
+ const global_dirs_1 = require("global-dirs");
9
+ const os_1 = require("os");
10
+ const path_1 = require("path");
11
+ const registry_auth_token_1 = __importDefault(require("registry-auth-token"));
12
+ const registry_url_1 = __importDefault(require("registry-auth-token/registry-url"));
13
+ const gt_1 = __importDefault(require("semver/functions/gt"));
14
+ const max_satisfying_1 = __importDefault(require("semver/ranges/max-satisfying"));
15
+ const url_1 = require("url");
16
+ exports.ONE_DAY = 1000 * 60 * 60 * 24; // eslint-disable-line @typescript-eslint/naming-convention
17
+ const isPackageJson = (obj) => {
18
+ return (obj.dependencies !== undefined ||
19
+ obj.devDependencies !== undefined ||
20
+ obj.peerDependencies !== undefined);
36
21
  };
37
- const downloadMetadata = (pkgName, options)=>{
38
- return new Promise((resolve, reject)=>{
39
- var _ref;
22
+ const downloadMetadata = (pkgName, options) => {
23
+ return new Promise((resolve, reject) => {
40
24
  const i = pkgName.indexOf('/');
41
25
  const pkgScope = i !== -1 ? pkgName.slice(0, i) : '';
42
- const registryUrl = (_ref = options == null ? void 0 : options.registryUrl) != null ? _ref : (0, _registryurl.default)(pkgScope);
43
- const pkgUrl = new _url.URL(encodeURIComponent(pkgName).replace(/^%40/, '@'), registryUrl);
26
+ const registryUrl = options?.registryUrl ?? (0, registry_url_1.default)(pkgScope);
27
+ const pkgUrl = new url_1.URL(encodeURIComponent(pkgName).replace(/^%40/, '@'), registryUrl);
44
28
  let requestOptions = {
45
29
  headers: {
46
- accept: 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*'
30
+ accept: 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*',
47
31
  },
48
32
  host: pkgUrl.hostname,
49
33
  path: pkgUrl.pathname,
50
- port: pkgUrl.port
34
+ port: pkgUrl.port,
51
35
  };
52
- const authInfo = (0, _registryauthtoken.default)(pkgUrl.toString(), {
53
- recursive: true
54
- });
36
+ const authInfo = (0, registry_auth_token_1.default)(pkgUrl.toString(), { recursive: true });
55
37
  if (authInfo && requestOptions.headers) {
56
- requestOptions.headers.authorization = `${authInfo.type} ${authInfo.token}`;
38
+ requestOptions.headers.authorization =
39
+ `${authInfo.type} ${authInfo.token}`;
57
40
  }
58
- if (options == null ? void 0 : options.requestOptions) {
59
- requestOptions = {
60
- ...requestOptions,
61
- ...options.requestOptions
62
- };
41
+ if (options?.requestOptions) {
42
+ requestOptions = { ...requestOptions, ...options.requestOptions };
63
43
  }
64
44
  const { get } = require(pkgUrl.protocol === 'https:' ? 'https' : 'http');
65
- const request = get(requestOptions, (res)=>{
45
+ const request = get(requestOptions, (res) => {
66
46
  if (res.statusCode === 200) {
67
47
  let rawData = '';
68
48
  res.setEncoding('utf8');
69
- res.on('data', (chunk)=>rawData += chunk);
70
- res.once('error', (err)=>{
49
+ res.on('data', (chunk) => (rawData += chunk));
50
+ res.once('error', (err) => {
71
51
  res.removeAllListeners();
72
52
  reject(`Request error (${err.message}): ${pkgUrl}`);
73
53
  });
74
- res.once('end', ()=>{
54
+ res.once('end', () => {
75
55
  res.removeAllListeners();
76
56
  try {
77
57
  const pkgMetadata = JSON.parse(rawData);
@@ -79,65 +59,62 @@ const downloadMetadata = (pkgName, options)=>{
79
59
  name: pkgName,
80
60
  lastUpdateDate: Date.now(),
81
61
  versions: Object.keys(pkgMetadata.versions),
82
- distTags: pkgMetadata['dist-tags']
62
+ distTags: pkgMetadata['dist-tags'],
83
63
  });
84
64
  return;
85
- } catch (err) {
65
+ }
66
+ catch (err) {
86
67
  reject(err);
87
68
  return;
88
69
  }
89
70
  });
90
- } else {
71
+ }
72
+ else {
91
73
  res.removeAllListeners();
92
74
  res.resume(); // consume response data to free up memory
93
75
  reject(`Request error (${res.statusCode}): ${pkgUrl}`);
94
76
  return;
95
77
  }
96
78
  });
97
- const abort = (error)=>{
79
+ const abort = (error) => {
98
80
  request.destroy();
99
81
  reject(error);
100
82
  };
101
- request.once('timeout', ()=>{
83
+ request.once('timeout', () => {
102
84
  abort(`Request timed out: ${pkgUrl}`);
103
85
  });
104
- request.once('error', (err)=>{
86
+ request.once('error', (err) => {
105
87
  abort(err);
106
88
  });
107
- request.on('close', ()=>{
89
+ request.on('close', () => {
108
90
  request.removeAllListeners();
109
91
  });
110
92
  });
111
93
  };
112
- const getCacheDir = (name = '@badisi/latest-version')=>{
113
- const homeDir = (0, _os.homedir)();
114
- switch(process.platform){
94
+ const getCacheDir = (name = '@badisi/latest-version') => {
95
+ const homeDir = (0, os_1.homedir)();
96
+ switch (process.platform) {
115
97
  case 'darwin':
116
- return (0, _path.join)(homeDir, 'Library', 'Caches', name);
98
+ return (0, path_1.join)(homeDir, 'Library', 'Caches', name);
117
99
  case 'win32':
118
- var _process_env_LOCALAPPDATA;
119
- return (0, _path.join)((_process_env_LOCALAPPDATA = process.env.LOCALAPPDATA) != null ? _process_env_LOCALAPPDATA : (0, _path.join)(homeDir, 'AppData', 'Local'), name, 'Cache');
100
+ return (0, path_1.join)(process.env.LOCALAPPDATA ?? (0, path_1.join)(homeDir, 'AppData', 'Local'), name, 'Cache');
120
101
  default:
121
- var _process_env_XDG_CACHE_HOME;
122
- return (0, _path.join)((_process_env_XDG_CACHE_HOME = process.env.XDG_CACHE_HOME) != null ? _process_env_XDG_CACHE_HOME : (0, _path.join)(homeDir, '.cache'), name);
102
+ return (0, path_1.join)(process.env.XDG_CACHE_HOME ?? (0, path_1.join)(homeDir, '.cache'), name);
123
103
  }
124
104
  };
125
- const saveMetadataToCache = (pkg)=>{
126
- const filePath = (0, _path.join)(getCacheDir(), `${pkg.name}.json`);
127
- if (!(0, _fs.existsSync)((0, _path.dirname)(filePath))) {
128
- (0, _fs.mkdirSync)((0, _path.dirname)(filePath), {
129
- recursive: true
130
- });
105
+ const saveMetadataToCache = (pkg) => {
106
+ const filePath = (0, path_1.join)(getCacheDir(), `${pkg.name}.json`);
107
+ if (!(0, fs_1.existsSync)((0, path_1.dirname)(filePath))) {
108
+ (0, fs_1.mkdirSync)((0, path_1.dirname)(filePath), { recursive: true });
131
109
  }
132
- (0, _fs.writeFileSync)(filePath, JSON.stringify(pkg));
110
+ (0, fs_1.writeFileSync)(filePath, JSON.stringify(pkg));
133
111
  };
134
- const getMetadataFromCache = (pkgName, options)=>{
135
- var _ref;
136
- const maxAge = (_ref = options == null ? void 0 : options.cacheMaxAge) != null ? _ref : ONE_DAY;
112
+ const getMetadataFromCache = (pkgName, options) => {
113
+ const maxAge = options?.cacheMaxAge ?? exports.ONE_DAY;
137
114
  if (maxAge !== 0) {
138
- const pkgCacheFilePath = (0, _path.join)(getCacheDir(), `${pkgName}.json`);
139
- if ((0, _fs.existsSync)(pkgCacheFilePath)) {
140
- const pkg = JSON.parse((0, _fs.readFileSync)(pkgCacheFilePath).toString());
115
+ const pkgCacheFilePath = (0, path_1.join)(getCacheDir(), `${pkgName}.json`);
116
+ if ((0, fs_1.existsSync)(pkgCacheFilePath)) {
117
+ const pkg = JSON.parse((0, fs_1.readFileSync)(pkgCacheFilePath).toString());
141
118
  if (Date.now() - pkg.lastUpdateDate < maxAge) {
142
119
  return pkg;
143
120
  }
@@ -145,76 +122,77 @@ const getMetadataFromCache = (pkgName, options)=>{
145
122
  }
146
123
  return undefined; // invalidates cache
147
124
  };
148
- const getRegistryVersions = async (pkgName, tagOrRange, options)=>{
125
+ const getRegistryVersions = async (pkgName, tagOrRange, options) => {
149
126
  let pkgMetadata;
150
- if (pkgName.length && (options == null ? void 0 : options.useCache)) {
127
+ if (pkgName.length && options?.useCache) {
151
128
  pkgMetadata = getMetadataFromCache(pkgName, options);
152
129
  if (!pkgMetadata) {
153
130
  pkgMetadata = await downloadMetadata(pkgName, options);
154
131
  saveMetadataToCache(pkgMetadata);
155
132
  }
156
- } else if (pkgName.length) {
133
+ }
134
+ else if (pkgName.length) {
157
135
  pkgMetadata = await downloadMetadata(pkgName, options);
158
136
  }
159
137
  const versions = {
160
- latest: pkgMetadata == null ? void 0 : pkgMetadata.distTags.latest,
161
- next: pkgMetadata == null ? void 0 : pkgMetadata.distTags.next
138
+ latest: pkgMetadata?.distTags.latest,
139
+ next: pkgMetadata?.distTags.next,
162
140
  };
163
- if (tagOrRange && (pkgMetadata == null ? void 0 : pkgMetadata.distTags[tagOrRange])) {
141
+ if (tagOrRange && pkgMetadata?.distTags[tagOrRange]) {
164
142
  versions.wanted = pkgMetadata.distTags[tagOrRange];
165
- } else if (tagOrRange && (pkgMetadata == null ? void 0 : pkgMetadata.versions.length)) {
166
- var _maxSatisfying;
167
- versions.wanted = (_maxSatisfying = (0, _maxsatisfying.default)(pkgMetadata.versions, tagOrRange)) != null ? _maxSatisfying : undefined;
143
+ }
144
+ else if (tagOrRange && pkgMetadata?.versions.length) {
145
+ versions.wanted =
146
+ (0, max_satisfying_1.default)(pkgMetadata.versions, tagOrRange) ?? undefined;
168
147
  }
169
148
  return versions;
170
149
  };
171
- const getInstalledVersion = (pkgName, location = 'local')=>{
150
+ const getInstalledVersion = (pkgName, location = 'local') => {
172
151
  try {
173
152
  if (location === 'globalNpm') {
174
- var _require;
175
- return (_require = require((0, _path.join)(_globaldirs.npm.packages, pkgName, 'package.json'))) == null ? void 0 : _require.version;
153
+ return require((0, path_1.join)(global_dirs_1.npm.packages, pkgName, 'package.json'))
154
+ ?.version;
176
155
  }
177
156
  if (location === 'globalYarn') {
178
- var _yarnGlobalPkg_dependencies, _require1;
179
157
  // Make sure package is globally installed by Yarn
180
- const yarnGlobalPkg = require((0, _path.resolve)(_globaldirs.yarn.packages, '..', 'package.json'));
181
- if (!(yarnGlobalPkg == null ? void 0 : (_yarnGlobalPkg_dependencies = yarnGlobalPkg.dependencies) == null ? void 0 : _yarnGlobalPkg_dependencies[pkgName])) {
158
+ const yarnGlobalPkg = require((0, path_1.resolve)(global_dirs_1.yarn.packages, '..', 'package.json'));
159
+ if (!yarnGlobalPkg?.dependencies?.[pkgName]) {
182
160
  return undefined;
183
161
  }
184
- return (_require1 = require((0, _path.join)(_globaldirs.yarn.packages, pkgName, 'package.json'))) == null ? void 0 : _require1.version;
162
+ return require((0, path_1.join)(global_dirs_1.yarn.packages, pkgName, 'package.json'))
163
+ ?.version;
185
164
  }
186
165
  /**
187
- * Compute the local paths manually as require.resolve() and require.resolve.paths()
188
- * cannot be trusted anymore.
189
- * @see https://github.com/nodejs/node/issues/33460
190
- * @see https://github.com/nodejs/loaders/issues/26
191
- */ const { root } = (0, _path.parse)(process.cwd());
166
+ * Compute the local paths manually as require.resolve() and require.resolve.paths()
167
+ * cannot be trusted anymore.
168
+ * @see https://github.com/nodejs/node/issues/33460
169
+ * @see https://github.com/nodejs/loaders/issues/26
170
+ */
171
+ const { root } = (0, path_1.parse)(process.cwd());
192
172
  let path = process.cwd();
193
- const localPaths = [
194
- (0, _path.join)(path, 'node_modules')
195
- ];
196
- while(path !== root){
197
- path = (0, _path.dirname)(path);
198
- localPaths.push((0, _path.join)(path, 'node_modules'));
173
+ const localPaths = [(0, path_1.join)(path, 'node_modules')];
174
+ while (path !== root) {
175
+ path = (0, path_1.dirname)(path);
176
+ localPaths.push((0, path_1.join)(path, 'node_modules'));
199
177
  }
200
- for (const localPath of localPaths){
201
- const pkgPath = (0, _path.join)(localPath, pkgName, 'package.json');
202
- if ((0, _fs.existsSync)(pkgPath)) {
203
- var _require2;
204
- return (_require2 = require(pkgPath)) == null ? void 0 : _require2.version;
178
+ for (const localPath of localPaths) {
179
+ const pkgPath = (0, path_1.join)(localPath, pkgName, 'package.json');
180
+ if ((0, fs_1.existsSync)(pkgPath)) {
181
+ return require(pkgPath)?.version;
205
182
  }
206
183
  }
207
184
  return undefined;
208
- } catch (unused) {
185
+ }
186
+ catch {
209
187
  return undefined;
210
188
  }
211
189
  };
212
- const getInfo = async (pkg, options)=>{
190
+ const getInfo = async (pkg, options) => {
213
191
  const i = pkg.lastIndexOf('@');
214
192
  let pkgInfo = {
215
193
  name: i > 1 ? pkg.slice(0, i) : pkg,
216
194
  wantedTagOrRange: i > 1 ? pkg.slice(i + 1) : 'latest',
217
- updatesAvailable: false
195
+ updatesAvailable: false,
218
196
  };
219
197
  try {
220
198
  pkgInfo = {
@@ -222,40 +200,53 @@ const getInfo = async (pkg, options)=>{
222
200
  local: getInstalledVersion(pkgInfo.name, 'local'),
223
201
  globalNpm: getInstalledVersion(pkgInfo.name, 'globalNpm'),
224
202
  globalYarn: getInstalledVersion(pkgInfo.name, 'globalYarn'),
225
- ...await getRegistryVersions(pkgInfo.name, pkgInfo.wantedTagOrRange, options)
203
+ ...(await getRegistryVersions(pkgInfo.name, pkgInfo.wantedTagOrRange, options)),
226
204
  };
227
- const local = pkgInfo.local && pkgInfo.wanted ? (0, _gt.default)(pkgInfo.wanted, pkgInfo.local) ? pkgInfo.wanted : false : false;
228
- const globalNpm = pkgInfo.globalNpm && pkgInfo.wanted ? (0, _gt.default)(pkgInfo.wanted, pkgInfo.globalNpm) ? pkgInfo.wanted : false : false;
229
- const globalYarn = pkgInfo.globalYarn && pkgInfo.wanted ? (0, _gt.default)(pkgInfo.wanted, pkgInfo.globalYarn) ? pkgInfo.wanted : false : false;
230
- pkgInfo.updatesAvailable = local || globalNpm || globalYarn ? {
231
- local,
232
- globalNpm,
233
- globalYarn
234
- } : false;
235
- } catch (err) {
236
- var _ref;
237
- pkgInfo.error = (_ref = err == null ? void 0 : err.message) != null ? _ref : err;
205
+ const local = pkgInfo.local && pkgInfo.wanted
206
+ ? (0, gt_1.default)(pkgInfo.wanted, pkgInfo.local)
207
+ ? pkgInfo.wanted
208
+ : false
209
+ : false;
210
+ const globalNpm = pkgInfo.globalNpm && pkgInfo.wanted
211
+ ? (0, gt_1.default)(pkgInfo.wanted, pkgInfo.globalNpm)
212
+ ? pkgInfo.wanted
213
+ : false
214
+ : false;
215
+ const globalYarn = pkgInfo.globalYarn && pkgInfo.wanted
216
+ ? (0, gt_1.default)(pkgInfo.wanted, pkgInfo.globalYarn)
217
+ ? pkgInfo.wanted
218
+ : false
219
+ : false;
220
+ pkgInfo.updatesAvailable =
221
+ local || globalNpm || globalYarn
222
+ ? { local, globalNpm, globalYarn }
223
+ : false;
224
+ }
225
+ catch (err) {
226
+ pkgInfo.error = err?.message ?? err;
238
227
  }
239
228
  return pkgInfo;
240
229
  };
241
- const latestVersion = async (arg, options)=>{
230
+ const latestVersion = async (arg, options) => {
242
231
  const pkgs = [];
243
232
  if (typeof arg === 'string') {
244
233
  pkgs.push(arg);
245
- } else if (Array.isArray(arg)) {
234
+ }
235
+ else if (Array.isArray(arg)) {
246
236
  pkgs.push(...arg);
247
- } else if (isPackageJson(arg)) {
248
- const addDeps = (deps)=>{
237
+ }
238
+ else if (isPackageJson(arg)) {
239
+ const addDeps = (deps) => {
249
240
  if (deps) {
250
- pkgs.push(...Object.keys(deps).map((key)=>`${key}@${deps[key]}`));
241
+ pkgs.push(...Object.keys(deps).map((key) => `${key}@${deps[key]}`));
251
242
  }
252
243
  };
253
244
  addDeps(arg.dependencies);
254
245
  addDeps(arg.devDependencies);
255
246
  addDeps(arg.peerDependencies);
256
247
  }
257
- const jobs = await Promise.allSettled(pkgs.map((pkg)=>getInfo(pkg, options)));
258
- const results = jobs.map((jobResult)=>jobResult.value);
248
+ const jobs = await Promise.allSettled(pkgs.map((pkg) => getInfo(pkg, options)));
249
+ const results = jobs.map((jobResult) => jobResult.value);
259
250
  return typeof arg === 'string' ? results[0] : results;
260
251
  };
261
- const _default = latestVersion;
252
+ exports.default = latestVersion;
@@ -1,30 +1,10 @@
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 getBooleanOption () {
13
- return getBooleanOption;
14
- },
15
- get getOptionalStringOption () {
16
- return getOptionalStringOption;
17
- },
18
- get getStringListOption () {
19
- return getStringListOption;
20
- },
21
- get getStringOption () {
22
- return getStringOption;
23
- },
24
- get toObjectState () {
25
- return toObjectState;
26
- }
27
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBooleanOption = getBooleanOption;
4
+ exports.getStringOption = getStringOption;
5
+ exports.getOptionalStringOption = getOptionalStringOption;
6
+ exports.getStringListOption = getStringListOption;
7
+ exports.toObjectState = toObjectState;
28
8
  function getBooleanOption(options, key, fallback = false) {
29
9
  const value = options[key];
30
10
  if (typeof value === 'boolean') {
@@ -60,17 +40,16 @@ function getOptionalStringOption(options, key) {
60
40
  }
61
41
  function getStringListOption(options, key) {
62
42
  const value = options[key];
63
- const rawValues = Array.isArray(value) ? value : [
64
- value
65
- ];
66
- const result = rawValues.flatMap((item)=>{
43
+ const rawValues = Array.isArray(value) ? value : [value];
44
+ const result = rawValues.flatMap((item) => {
67
45
  if (typeof item === 'string') {
68
- return item.split(',').map((value)=>value.trim()).filter(Boolean);
46
+ return item
47
+ .split(',')
48
+ .map((value) => value.trim())
49
+ .filter(Boolean);
69
50
  }
70
51
  if (typeof item === 'number' || typeof item === 'boolean') {
71
- return [
72
- String(item)
73
- ];
52
+ return [String(item)];
74
53
  }
75
54
  return [];
76
55
  });
@@ -1,74 +1,61 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "plugins", {
6
- enumerable: true,
7
- get: function() {
8
- return plugins;
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]; } };
9
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
10
17
  });
11
- const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
12
- function _getRequireWildcardCache(nodeInterop) {
13
- if (typeof WeakMap !== "function") return null;
14
- var cacheBabelInterop = new WeakMap();
15
- var cacheNodeInterop = new WeakMap();
16
- return (_getRequireWildcardCache = function(nodeInterop) {
17
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
18
- })(nodeInterop);
19
- }
20
- function _interop_require_wildcard(obj, nodeInterop) {
21
- if (!nodeInterop && obj && obj.__esModule) {
22
- return obj;
23
- }
24
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
25
- return {
26
- default: obj
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
27
24
  };
28
- }
29
- var cache = _getRequireWildcardCache(nodeInterop);
30
- if (cache && cache.has(obj)) {
31
- return cache.get(obj);
32
- }
33
- var newObj = {
34
- __proto__: null
25
+ return ownKeys(o);
35
26
  };
36
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
37
- for(var key in obj){
38
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
39
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
40
- if (desc && (desc.get || desc.set)) {
41
- Object.defineProperty(newObj, key, desc);
42
- } else {
43
- newObj[key] = obj[key];
44
- }
45
- }
46
- }
47
- newObj.default = obj;
48
- if (cache) {
49
- cache.set(obj, newObj);
50
- }
51
- return newObj;
52
- }
53
- const plugins = [
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.plugins = void 0;
37
+ const fs = __importStar(require("fs-extra"));
38
+ exports.plugins = [
54
39
  {
55
40
  name: 'sentry',
56
41
  bundleParams: {
57
42
  sentry: true,
58
- sourcemap: true
43
+ sourcemap: true,
59
44
  },
60
- detect: async ()=>{
45
+ detect: async () => {
61
46
  try {
62
- await _fsextra.access('ios/sentry.properties');
47
+ await fs.access('ios/sentry.properties');
63
48
  return true;
64
- } catch (unused) {
49
+ }
50
+ catch {
65
51
  try {
66
- await _fsextra.access('android/sentry.properties');
52
+ await fs.access('android/sentry.properties');
67
53
  return true;
68
- } catch (unused) {
54
+ }
55
+ catch {
69
56
  return false;
70
57
  }
71
58
  }
72
- }
73
- }
59
+ },
60
+ },
74
61
  ];