1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3    return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6exports.normalizeOptionsAsync = exports.DEFAULT_IGNORE_PATHS = exports.FINGERPRINT_IGNORE_FILENAME = void 0;
7const promises_1 = __importDefault(require("fs/promises"));
8const os_1 = __importDefault(require("os"));
9const path_1 = __importDefault(require("path"));
10exports.FINGERPRINT_IGNORE_FILENAME = '.fingerprintignore';
11exports.DEFAULT_IGNORE_PATHS = [
12    exports.FINGERPRINT_IGNORE_FILENAME,
13    '**/android/build/**/*',
14    '**/android/app/build/**/*',
15    '**/android/app/.cxx/**/*',
16    '**/ios/Pods/**/*',
17    // Ignore all expo configs because we will read expo config in a HashSourceContents already
18    'app.config.ts',
19    'app.config.js',
20    'app.config.json',
21    'app.json',
22];
23async function normalizeOptionsAsync(projectRoot, options) {
24    return {
25        ...options,
26        platforms: options?.platforms ?? ['android', 'ios'],
27        concurrentIoLimit: options?.concurrentIoLimit ?? os_1.default.cpus().length,
28        hashAlgorithm: options?.hashAlgorithm ?? 'sha1',
29        ignorePaths: await collectIgnorePathsAsync(projectRoot, options),
30    };
31}
32exports.normalizeOptionsAsync = normalizeOptionsAsync;
33async function collectIgnorePathsAsync(projectRoot, options) {
34    const ignorePaths = [
35        ...exports.DEFAULT_IGNORE_PATHS,
36        ...(options?.ignorePaths ?? []),
37        ...(options?.dirExcludes?.map((dirExclude) => `${dirExclude}/**/*`) ?? []),
38    ];
39    const fingerprintIgnorePath = path_1.default.join(projectRoot, exports.FINGERPRINT_IGNORE_FILENAME);
40    try {
41        const fingerprintIgnore = await promises_1.default.readFile(fingerprintIgnorePath, 'utf8');
42        const fingerprintIgnoreLines = fingerprintIgnore.split('\n');
43        for (const line of fingerprintIgnoreLines) {
44            const trimmedLine = line.trim();
45            if (trimmedLine) {
46                ignorePaths.push(trimmedLine);
47            }
48        }
49    }
50    catch { }
51    return ignorePaths;
52}
53//# sourceMappingURL=Options.js.map