@expo/fingerprint 0.0.1
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/.eslintignore +1 -0
- package/LICENSE +22 -0
- package/README.md +118 -0
- package/__mocks__/fs/promises.ts +2 -0
- package/__mocks__/fs.ts +2 -0
- package/babel.config.js +6 -0
- package/bin/cli.js +27 -0
- package/build/Dedup.d.ts +9 -0
- package/build/Dedup.js +83 -0
- package/build/Dedup.js.map +1 -0
- package/build/Fingerprint.d.ts +13 -0
- package/build/Fingerprint.js +42 -0
- package/build/Fingerprint.js.map +1 -0
- package/build/Fingerprint.types.d.ts +78 -0
- package/build/Fingerprint.types.js +4 -0
- package/build/Fingerprint.types.js.map +1 -0
- package/build/Options.d.ts +2 -0
- package/build/Options.js +23 -0
- package/build/Options.js.map +1 -0
- package/build/Sort.d.ts +2 -0
- package/build/Sort.js +27 -0
- package/build/Sort.js.map +1 -0
- package/build/hash/Hash.d.ts +28 -0
- package/build/hash/Hash.js +166 -0
- package/build/hash/Hash.js.map +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +22 -0
- package/build/index.js.map +1 -0
- package/build/sourcer/Bare.d.ts +6 -0
- package/build/sourcer/Bare.js +107 -0
- package/build/sourcer/Bare.js.map +1 -0
- package/build/sourcer/Expo.d.ts +5 -0
- package/build/sourcer/Expo.js +175 -0
- package/build/sourcer/Expo.js.map +1 -0
- package/build/sourcer/PatchPackage.d.ts +2 -0
- package/build/sourcer/PatchPackage.js +19 -0
- package/build/sourcer/PatchPackage.js.map +1 -0
- package/build/sourcer/Sourcer.d.ts +2 -0
- package/build/sourcer/Sourcer.js +42 -0
- package/build/sourcer/Sourcer.js.map +1 -0
- package/build/sourcer/Utils.d.ts +2 -0
- package/build/sourcer/Utils.js +25 -0
- package/build/sourcer/Utils.js.map +1 -0
- package/build/utils/Profile.d.ts +8 -0
- package/build/utils/Profile.js +43 -0
- package/build/utils/Profile.js.map +1 -0
- package/e2e/__tests__/__snapshots__/managed-test.ts.snap +200 -0
- package/e2e/__tests__/bare-test.ts +66 -0
- package/e2e/__tests__/managed-test.ts +162 -0
- package/e2e/jest.config.js +10 -0
- package/jest.config.js +10 -0
- package/package.json +70 -0
- package/scripts/createFixture.ts +81 -0
- package/src/Dedup.ts +97 -0
- package/src/Fingerprint.ts +51 -0
- package/src/Fingerprint.types.ts +98 -0
- package/src/Options.ts +18 -0
- package/src/Sort.ts +22 -0
- package/src/__tests__/Dedup-test.ts +177 -0
- package/src/__tests__/Fingerprint-test.ts +116 -0
- package/src/__tests__/Sort-test.ts +56 -0
- package/src/hash/Hash.ts +204 -0
- package/src/hash/__tests__/Hash-test.ts +192 -0
- package/src/index.ts +3 -0
- package/src/sourcer/Bare.ts +114 -0
- package/src/sourcer/Expo.ts +216 -0
- package/src/sourcer/PatchPackage.ts +18 -0
- package/src/sourcer/Sourcer.ts +58 -0
- package/src/sourcer/Utils.ts +23 -0
- package/src/sourcer/__tests__/Bare-test.ts +59 -0
- package/src/sourcer/__tests__/Expo-test.ts +265 -0
- package/src/sourcer/__tests__/PatchPackage-test.ts +54 -0
- package/src/sourcer/__tests__/Sourcer-test.ts +14 -0
- package/src/sourcer/__tests__/__snapshots__/Bare-test.ts.snap +29 -0
- package/src/sourcer/__tests__/__snapshots__/Expo-test.ts.snap +139 -0
- package/src/sourcer/__tests__/fixtures/BareReactNative70Project.json +47 -0
- package/src/sourcer/__tests__/fixtures/ExpoAutolinkingAndroid.json +82 -0
- package/src/sourcer/__tests__/fixtures/ExpoAutolinkingIos.json +114 -0
- package/src/sourcer/__tests__/fixtures/ExpoManaged47Project.json +6 -0
- package/src/sourcer/__tests__/fixtures/PatchPackage.json +4 -0
- package/src/sourcer/__tests__/fixtures/RncliAutoLinking.json +165 -0
- package/src/utils/Profile.ts +47 -0
- package/src/utils/__tests__/Profile-test.ts +11 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
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.createSourceId = exports.createContentsHashResultsAsync = exports.createDirHashResultsAsync = exports.createFileHashResultsAsync = exports.createFingerprintSourceAsync = exports.createFingerprintFromSourcesAsync = void 0;
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
10
|
+
const minimatch_1 = __importDefault(require("minimatch"));
|
|
11
|
+
const p_limit_1 = __importDefault(require("p-limit"));
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
13
|
+
const Profile_1 = require("../utils/Profile");
|
|
14
|
+
/**
|
|
15
|
+
* Create a `Fingerprint` from `HashSources` array
|
|
16
|
+
*/
|
|
17
|
+
async function createFingerprintFromSourcesAsync(sources, projectRoot, options) {
|
|
18
|
+
const limiter = (0, p_limit_1.default)(options.concurrentIoLimit);
|
|
19
|
+
const fingerprintSources = await Promise.all(sources.map((source) => createFingerprintSourceAsync(source, limiter, projectRoot, options)));
|
|
20
|
+
const hasher = (0, crypto_1.createHash)(options.hashAlgorithm);
|
|
21
|
+
for (const source of fingerprintSources) {
|
|
22
|
+
if (source.hash != null) {
|
|
23
|
+
hasher.update(createSourceId(source));
|
|
24
|
+
hasher.update(source.hash);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const hash = hasher.digest('hex');
|
|
28
|
+
return {
|
|
29
|
+
sources: fingerprintSources,
|
|
30
|
+
hash,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
exports.createFingerprintFromSourcesAsync = createFingerprintFromSourcesAsync;
|
|
34
|
+
/**
|
|
35
|
+
* Create a `FingerprintSource` from a `HashSource`
|
|
36
|
+
* This function will get a hash value and merge back to original source
|
|
37
|
+
*/
|
|
38
|
+
async function createFingerprintSourceAsync(source, limiter, projectRoot, options) {
|
|
39
|
+
let result = null;
|
|
40
|
+
switch (source.type) {
|
|
41
|
+
case 'contents':
|
|
42
|
+
result = await createContentsHashResultsAsync(source, options);
|
|
43
|
+
break;
|
|
44
|
+
case 'file':
|
|
45
|
+
result = await createFileHashResultsAsync(source.filePath, limiter, projectRoot, options);
|
|
46
|
+
break;
|
|
47
|
+
case 'dir':
|
|
48
|
+
result = await (0, Profile_1.profile)(createDirHashResultsAsync, `createDirHashResultsAsync(${source.filePath})`)(source.filePath, limiter, projectRoot, options);
|
|
49
|
+
break;
|
|
50
|
+
default:
|
|
51
|
+
throw new Error('Unsupported source type');
|
|
52
|
+
}
|
|
53
|
+
return { ...source, hash: result?.hex ?? null };
|
|
54
|
+
}
|
|
55
|
+
exports.createFingerprintSourceAsync = createFingerprintSourceAsync;
|
|
56
|
+
/**
|
|
57
|
+
* Create a `HashResult` from a file
|
|
58
|
+
*/
|
|
59
|
+
async function createFileHashResultsAsync(filePath, limiter, projectRoot, options) {
|
|
60
|
+
// Backup code for faster hashing
|
|
61
|
+
/*
|
|
62
|
+
return limiter(async () => {
|
|
63
|
+
const hasher = createHash(options.hashAlgorithm);
|
|
64
|
+
|
|
65
|
+
const stat = await fs.stat(filePath);
|
|
66
|
+
hasher.update(`${stat.size}`);
|
|
67
|
+
|
|
68
|
+
const buffer = Buffer.alloc(4096);
|
|
69
|
+
const fd = await fs.open(filePath, 'r');
|
|
70
|
+
await fd.read(buffer, 0, buffer.length, 0);
|
|
71
|
+
await fd.close();
|
|
72
|
+
hasher.update(buffer);
|
|
73
|
+
console.log('stat', filePath, stat.size);
|
|
74
|
+
return { id: path.relative(projectRoot, filePath), hex: hasher.digest('hex') };
|
|
75
|
+
});
|
|
76
|
+
*/
|
|
77
|
+
return limiter(() => {
|
|
78
|
+
return new Promise((resolve, reject) => {
|
|
79
|
+
let resolved = false;
|
|
80
|
+
const hasher = (0, crypto_1.createHash)(options.hashAlgorithm);
|
|
81
|
+
const stream = (0, fs_1.createReadStream)(path_1.default.join(projectRoot, filePath));
|
|
82
|
+
stream.on('close', () => {
|
|
83
|
+
if (!resolved) {
|
|
84
|
+
const hex = hasher.digest('hex');
|
|
85
|
+
resolve({ id: filePath, hex });
|
|
86
|
+
resolved = true;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
stream.on('error', (e) => {
|
|
90
|
+
reject(e);
|
|
91
|
+
});
|
|
92
|
+
stream.on('data', (chunk) => {
|
|
93
|
+
hasher.update(chunk);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
exports.createFileHashResultsAsync = createFileHashResultsAsync;
|
|
99
|
+
/**
|
|
100
|
+
* Indicate the given `dirPath` should be excluded by `dirExcludes`
|
|
101
|
+
*/
|
|
102
|
+
function isExcludedDir(dirPath, dirExcludes) {
|
|
103
|
+
for (const exclude of dirExcludes) {
|
|
104
|
+
if ((0, minimatch_1.default)(dirPath, exclude)) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Create `HashResult` for a dir.
|
|
112
|
+
* If the dir is excluded, returns null rather than a HashResult
|
|
113
|
+
*/
|
|
114
|
+
async function createDirHashResultsAsync(dirPath, limiter, projectRoot, options, depth = 0) {
|
|
115
|
+
if (isExcludedDir(dirPath, options.dirExcludes)) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
const dirents = (await promises_1.default.readdir(path_1.default.join(projectRoot, dirPath), { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name));
|
|
119
|
+
const promises = [];
|
|
120
|
+
for (const dirent of dirents) {
|
|
121
|
+
if (dirent.isDirectory()) {
|
|
122
|
+
const filePath = path_1.default.join(dirPath, dirent.name);
|
|
123
|
+
promises.push(createDirHashResultsAsync(filePath, limiter, projectRoot, options, depth + 1));
|
|
124
|
+
}
|
|
125
|
+
else if (dirent.isFile()) {
|
|
126
|
+
const filePath = path_1.default.join(dirPath, dirent.name);
|
|
127
|
+
promises.push(createFileHashResultsAsync(filePath, limiter, projectRoot, options));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const hasher = (0, crypto_1.createHash)(options.hashAlgorithm);
|
|
131
|
+
const results = await Promise.all(promises);
|
|
132
|
+
for (const result of results) {
|
|
133
|
+
if (result != null) {
|
|
134
|
+
hasher.update(result.id);
|
|
135
|
+
hasher.update(result.hex);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const hex = hasher.digest('hex');
|
|
139
|
+
return { id: dirPath, hex };
|
|
140
|
+
}
|
|
141
|
+
exports.createDirHashResultsAsync = createDirHashResultsAsync;
|
|
142
|
+
/**
|
|
143
|
+
* Create `HashResult` for a `HashSourceContents`
|
|
144
|
+
*/
|
|
145
|
+
async function createContentsHashResultsAsync(source, options) {
|
|
146
|
+
const hex = (0, crypto_1.createHash)(options.hashAlgorithm).update(source.contents).digest('hex');
|
|
147
|
+
return { id: source.id, hex };
|
|
148
|
+
}
|
|
149
|
+
exports.createContentsHashResultsAsync = createContentsHashResultsAsync;
|
|
150
|
+
/**
|
|
151
|
+
* Create id from given source
|
|
152
|
+
*/
|
|
153
|
+
function createSourceId(source) {
|
|
154
|
+
switch (source.type) {
|
|
155
|
+
case 'contents':
|
|
156
|
+
return source.id;
|
|
157
|
+
case 'file':
|
|
158
|
+
return source.filePath;
|
|
159
|
+
case 'dir':
|
|
160
|
+
return source.filePath;
|
|
161
|
+
default:
|
|
162
|
+
throw new Error('Unsupported source type');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
exports.createSourceId = createSourceId;
|
|
166
|
+
//# sourceMappingURL=Hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Hash.js","sourceRoot":"","sources":["../../src/hash/Hash.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAoC;AACpC,2BAAsC;AACtC,2DA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AkB;IAC/C,QAAQ,MAAM,CAAC,IAAI,EAAE;QACnB,KAAK,UAAU;YACb,OAAO,MAAM,CAAC,EAAE,CAAC;QACnB,KAAK,MAAM;YACT,OAAO,MAAM,CAAC,QAAQ,CAAC;QACzB,KAAK,KAAK;YACR,OAAO,MAAM,CAAC,QAAQ,CAAC;QACzB;YACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC9C;AACH,CAAC;AAXD,wCAWC"}
|
package/build/index.d.ts
ADDED
package/build/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
exports.createProjectHashAsync = exports.createFingerprintAsync = void 0;
|
|
18
|
+
var Fingerprint_1 = require("./Fingerprint");
|
|
19
|
+
Object.defineProperty(exports, "createFingerprintAsync", { enumerable: true, get: function () { return Fingerprint_1.createFingerprintAsync; } });
|
|
20
|
+
Object.defineProperty(exports, "createProjectHashAsync", { enumerable: true, get: function () { return Fingerprint_1.createProjectHashAsync; } });
|
|
21
|
+
__exportStar(require("./Fingerprint.types"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAA+E;AAAtE,qHAAA,sBAAsB,OAAA;AAAE,qHAAA,sBAAsB,OAAA;AAEvD,sDAAoC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { HashSource, NormalizedOptions } from '../Fingerprint.types';
|
|
2
|
+
export declare function getBareAndroidSourcesAsync(projectRoot: string, options: NormalizedOptions): Promise<HashSource[]>;
|
|
3
|
+
export declare function getBareIosSourcesAsync(projectRoot: string, options: NormalizedOptions): Promise<HashSource[]>;
|
|
4
|
+
export declare function getPackageJsonScriptSourcesAsync(projectRoot: string, options: NormalizedOptions): Promise<HashSource[]>;
|
|
5
|
+
export declare function getGitIgnoreSourcesAsync(projectRoot: string, options: NormalizedOptions): Promise<HashSource[]>;
|
|
6
|
+
export declare function getRncliAutolinkingSourcesAsync(projectRoot: string, options: NormalizedOptions): Promise<HashSource[]>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
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.getRncliAutolinkingSourcesAsync = exports.getGitIgnoreSourcesAsync = exports.getPackageJsonScriptSourcesAsync = exports.getBareIosSourcesAsync = exports.getBareAndroidSourcesAsync = void 0;
|
|
7
|
+
const spawn_async_1 = __importDefault(require("@expo/spawn-async"));
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const Utils_1 = require("./Utils");
|
|
11
|
+
const debug = require('debug')('expo:fingerprint:sourcer:Bare');
|
|
12
|
+
async function getBareAndroidSourcesAsync(projectRoot, options) {
|
|
13
|
+
if (options.platforms.includes('android')) {
|
|
14
|
+
const result = await (0, Utils_1.getFileBasedHashSourceAsync)(projectRoot, 'android', 'bareNativeDir');
|
|
15
|
+
if (result != null) {
|
|
16
|
+
debug(`Adding bare native dir - ${chalk_1.default.dim('android')}`);
|
|
17
|
+
return [result];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
exports.getBareAndroidSourcesAsync = getBareAndroidSourcesAsync;
|
|
23
|
+
async function getBareIosSourcesAsync(projectRoot, options) {
|
|
24
|
+
if (options.platforms.includes('ios')) {
|
|
25
|
+
const result = await (0, Utils_1.getFileBasedHashSourceAsync)(projectRoot, 'ios', 'bareNativeDir');
|
|
26
|
+
if (result != null) {
|
|
27
|
+
debug(`Adding bare native dir - ${chalk_1.default.dim('ios')}`);
|
|
28
|
+
return [result];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
exports.getBareIosSourcesAsync = getBareIosSourcesAsync;
|
|
34
|
+
async function getPackageJsonScriptSourcesAsync(projectRoot, options) {
|
|
35
|
+
let packageJson;
|
|
36
|
+
try {
|
|
37
|
+
packageJson = require(`${projectRoot}/package.json`);
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
debug(`Unable to read package.json from ${projectRoot}/package.json: ` + e);
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
const results = [];
|
|
44
|
+
if (packageJson.scripts) {
|
|
45
|
+
debug(`Adding package.json contents - ${chalk_1.default.dim('scripts')}`);
|
|
46
|
+
const id = 'packageJson:scripts';
|
|
47
|
+
results.push({
|
|
48
|
+
type: 'contents',
|
|
49
|
+
id,
|
|
50
|
+
contents: JSON.stringify(packageJson.scripts),
|
|
51
|
+
reasons: [id],
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return results;
|
|
55
|
+
}
|
|
56
|
+
exports.getPackageJsonScriptSourcesAsync = getPackageJsonScriptSourcesAsync;
|
|
57
|
+
async function getGitIgnoreSourcesAsync(projectRoot, options) {
|
|
58
|
+
const result = await (0, Utils_1.getFileBasedHashSourceAsync)(projectRoot, '.gitignore', 'bareGitIgnore');
|
|
59
|
+
if (result != null) {
|
|
60
|
+
debug(`Adding file - ${chalk_1.default.dim('.gitignore')}`);
|
|
61
|
+
return [result];
|
|
62
|
+
}
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
exports.getGitIgnoreSourcesAsync = getGitIgnoreSourcesAsync;
|
|
66
|
+
async function getRncliAutolinkingSourcesAsync(projectRoot, options) {
|
|
67
|
+
try {
|
|
68
|
+
const results = [];
|
|
69
|
+
const { stdout } = await (0, spawn_async_1.default)('npx', ['react-native', 'config'], { cwd: projectRoot });
|
|
70
|
+
const config = JSON.parse(stdout);
|
|
71
|
+
const { root } = config;
|
|
72
|
+
const reasons = ['bareRncliAutolinking'];
|
|
73
|
+
for (const depData of Object.values(config.dependencies)) {
|
|
74
|
+
const filePath = path_1.default.relative(root, depData.root);
|
|
75
|
+
results.push({ type: 'dir', filePath, reasons });
|
|
76
|
+
debug(`Adding react-native-cli autolinking dir - ${chalk_1.default.dim(filePath)}`);
|
|
77
|
+
for (const platform of options.platforms) {
|
|
78
|
+
const platformData = getRncliPlatformData(depData, root, platform);
|
|
79
|
+
if (platformData) {
|
|
80
|
+
results.push({
|
|
81
|
+
type: 'contents',
|
|
82
|
+
id: `rncliAutolinkingConfig:${depData.name}:${platform}`,
|
|
83
|
+
contents: platformData,
|
|
84
|
+
reasons,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return results;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.getRncliAutolinkingSourcesAsync = getRncliAutolinkingSourcesAsync;
|
|
96
|
+
function getRncliPlatformData(dependency, root, platform) {
|
|
97
|
+
const platformData = dependency.platforms[platform];
|
|
98
|
+
if (!platformData) {
|
|
99
|
+
return '';
|
|
100
|
+
}
|
|
101
|
+
const json = {};
|
|
102
|
+
for (const [key, value] of Object.entries(platformData)) {
|
|
103
|
+
json[key] = value?.startsWith?.(root) ? path_1.default.relative(root, value) : value;
|
|
104
|
+
}
|
|
105
|
+
return JSON.stringify(json);
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=Bare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bare.js","sourceRoot":"","sources":["../../src/sourcer/Bare.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA2C;AAC3C,kDAA0B;AAC1B,gDAAwB;AAGxB,mCAAsD;AAEtD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,+BAA+B,CAAC,CAAC;AAEzD,KAAK,UAAU,0BAA0B,CAC9C,WAAmB,EACnB,OAA0B;IAE1B,IAAI,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;QACzC,MAAM,MAAM,GAAG,MAAM,IAAA,mCAA2B,EAAC,WAAW,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;QAC1F,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,KAAK,CAAC,4BAA4B,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;YAC1D,OAAO,CAAC,MAAM,CAAC,CAAC;SACjB;KACF;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAZD,gEAYC;AAEM,KAAK,UAAU,sBAAsB,CAC1C,WAAmB,EACnB,OAA0B;IAE1B,IAAI,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACrC,MAAM,MAAM,GAAG,MAAM,IAAA,mCAA2B,EAAC,WAAW,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;QACtF,IAAI,MAAM,IAAI,IAAI,EAAE;Y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A8BC;AAED,SAAS,oBAAoB,CAAC,UAAe,EAAE,IAAY,EAAE,QAAkB;IAC7E,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACpD,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,EAAE,CAAC;KACX;IACD,MAAM,IAAI,GAA2B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAM,YAAY,CAAC,EAAE;QAC5D,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,cAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;KAC5E;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HashSource, NormalizedOptions } from '../Fingerprint.types';
|
|
2
|
+
export declare function getExpoConfigSourcesAsync(projectRoot: string, options: NormalizedOptions): Promise<HashSource[]>;
|
|
3
|
+
export declare function getEasBuildSourcesAsync(projectRoot: string, options: NormalizedOptions): Promise<HashSource[]>;
|
|
4
|
+
export declare function getExpoAutolinkingAndroidSourcesAsync(projectRoot: string, options: NormalizedOptions): Promise<HashSource[]>;
|
|
5
|
+
export declare function getExpoAutolinkingIosSourcesAsync(projectRoot: string, options: NormalizedOptions): Promise<HashSource[]>;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
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.getExpoAutolinkingIosSourcesAsync = exports.getExpoAutolinkingAndroidSourcesAsync = exports.getEasBuildSourcesAsync = exports.getExpoConfigSourcesAsync = void 0;
|
|
7
|
+
const spawn_async_1 = __importDefault(require("@expo/spawn-async"));
|
|
8
|
+
const assert_1 = __importDefault(require("assert"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const config_1 = require("expo/config");
|
|
11
|
+
const find_up_1 = __importDefault(require("find-up"));
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
13
|
+
const resolve_from_1 = __importDefault(require("resolve-from"));
|
|
14
|
+
const Utils_1 = require("./Utils");
|
|
15
|
+
const debug = require('debug')('expo:fingerprint:sourcer:Expo');
|
|
16
|
+
async function getExpoConfigSourcesAsync(projectRoot, options) {
|
|
17
|
+
let config;
|
|
18
|
+
try {
|
|
19
|
+
config = await (0, config_1.getConfig)(projectRoot, { skipSDKVersionRequirement: true });
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
debug('Cannot get Expo config: ' + e);
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
const results = [];
|
|
26
|
+
// app config files
|
|
27
|
+
const configFiles = ['app.config.ts', 'app.config.js', 'app.config.json', 'app.json'];
|
|
28
|
+
const configFileSources = (await Promise.all(configFiles.map(async (file) => {
|
|
29
|
+
const result = await (0, Utils_1.getFileBasedHashSourceAsync)(projectRoot, file, 'expoConfig');
|
|
30
|
+
if (result != null) {
|
|
31
|
+
debug(`Adding config file - ${chalk_1.default.dim(file)}`);
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}))).filter(Boolean);
|
|
35
|
+
results.push(...configFileSources);
|
|
36
|
+
// external files in config
|
|
37
|
+
const isAndroid = options.platforms.includes('android');
|
|
38
|
+
const isIos = options.platforms.includes('ios');
|
|
39
|
+
const externalFiles = [
|
|
40
|
+
// icons
|
|
41
|
+
config.exp.icon,
|
|
42
|
+
isAndroid ? config.exp.android?.icon : undefined,
|
|
43
|
+
isIos ? config.exp.ios?.icon : undefined,
|
|
44
|
+
isAndroid ? config.exp.android?.adaptiveIcon?.foregroundImage : undefined,
|
|
45
|
+
isAndroid ? config.exp.android?.adaptiveIcon?.backgroundImage : undefined,
|
|
46
|
+
config.exp.notification?.icon,
|
|
47
|
+
// splash images
|
|
48
|
+
config.exp.splash?.image,
|
|
49
|
+
isAndroid ? config.exp.android?.splash?.image : undefined,
|
|
50
|
+
isAndroid ? config.exp.android?.splash?.mdpi : undefined,
|
|
51
|
+
isAndroid ? config.exp.android?.splash?.hdpi : undefined,
|
|
52
|
+
isAndroid ? config.exp.android?.splash?.xhdpi : undefined,
|
|
53
|
+
isAndroid ? config.exp.android?.splash?.xxhdpi : undefined,
|
|
54
|
+
isAndroid ? config.exp.android?.splash?.xxxhdpi : undefined,
|
|
55
|
+
isIos ? config.exp.ios?.splash?.image : undefined,
|
|
56
|
+
isIos ? config.exp.ios?.splash?.tabletImage : undefined,
|
|
57
|
+
// google service files
|
|
58
|
+
isAndroid ? config.exp.android?.googleServicesFile : undefined,
|
|
59
|
+
isIos ? config.exp.ios?.googleServicesFile : undefined,
|
|
60
|
+
].filter(Boolean);
|
|
61
|
+
const externalFileSources = (await Promise.all(externalFiles.map(async (file) => {
|
|
62
|
+
const result = await (0, Utils_1.getFileBasedHashSourceAsync)(projectRoot, file, 'expoConfigExternalFile');
|
|
63
|
+
if (result != null) {
|
|
64
|
+
debug(`Adding config external file - ${chalk_1.default.dim(file)}`);
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}))).filter(Boolean);
|
|
68
|
+
results.push(...externalFileSources);
|
|
69
|
+
// config plugins
|
|
70
|
+
const configPluginSources = getConfigPluginSourcesAsync(projectRoot, config.exp.plugins);
|
|
71
|
+
results.push(...configPluginSources);
|
|
72
|
+
return results;
|
|
73
|
+
}
|
|
74
|
+
exports.getExpoConfigSourcesAsync = getExpoConfigSourcesAsync;
|
|
75
|
+
function findUpPluginRoot(entryFile) {
|
|
76
|
+
const entryRoot = path_1.default.dirname(entryFile);
|
|
77
|
+
const packageJson = find_up_1.default.sync('package.json', { cwd: path_1.default.dirname(entryFile) });
|
|
78
|
+
(0, assert_1.default)(packageJson, `No package.json found for module "${entryRoot}"`);
|
|
79
|
+
return path_1.default.dirname(packageJson);
|
|
80
|
+
}
|
|
81
|
+
function getConfigPluginSourcesAsync(projectRoot, plugins) {
|
|
82
|
+
if (plugins == null) {
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
const reasons = ['expoConfigPlugins'];
|
|
86
|
+
const nullableResults = plugins.map((plugin) => {
|
|
87
|
+
const pluginPackageName = Array.isArray(plugin) ? plugin[0] : plugin;
|
|
88
|
+
if (typeof pluginPackageName === 'string') {
|
|
89
|
+
const pluginPackageEntryFile = resolve_from_1.default.silent(projectRoot, pluginPackageName);
|
|
90
|
+
const pluginPackageRoot = pluginPackageEntryFile
|
|
91
|
+
? findUpPluginRoot(pluginPackageEntryFile)
|
|
92
|
+
: null;
|
|
93
|
+
if (pluginPackageRoot) {
|
|
94
|
+
debug(`Adding config-plugin root - ${chalk_1.default.dim(pluginPackageRoot)}`);
|
|
95
|
+
return { type: 'dir', filePath: path_1.default.relative(projectRoot, pluginPackageRoot), reasons };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
});
|
|
100
|
+
const results = nullableResults.filter(Boolean);
|
|
101
|
+
return results;
|
|
102
|
+
}
|
|
103
|
+
async function getEasBuildSourcesAsync(projectRoot, options) {
|
|
104
|
+
const files = ['eas.json', '.easignore'];
|
|
105
|
+
const results = (await Promise.all(files.map(async (file) => {
|
|
106
|
+
const result = await (0, Utils_1.getFileBasedHashSourceAsync)(projectRoot, file, 'easBuild');
|
|
107
|
+
if (result != null) {
|
|
108
|
+
debug(`Adding eas file - ${chalk_1.default.dim(file)}`);
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
}))).filter(Boolean);
|
|
112
|
+
return results;
|
|
113
|
+
}
|
|
114
|
+
exports.getEasBuildSourcesAsync = getEasBuildSourcesAsync;
|
|
115
|
+
async function getExpoAutolinkingAndroidSourcesAsync(projectRoot, options) {
|
|
116
|
+
if (!options.platforms.includes('android')) {
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
const reasons = ['expoAutolinkingAndroid'];
|
|
121
|
+
const results = [];
|
|
122
|
+
const { stdout } = await (0, spawn_async_1.default)('npx', ['expo-modules-autolinking', 'resolve', '-p', 'android', '--json'], { cwd: projectRoot });
|
|
123
|
+
const config = JSON.parse(stdout);
|
|
124
|
+
for (const module of config.modules) {
|
|
125
|
+
for (const project of module.projects) {
|
|
126
|
+
const filePath = path_1.default.relative(projectRoot, project.sourceDir);
|
|
127
|
+
project.sourceDir = filePath; // use relative path for the dir
|
|
128
|
+
debug(`Adding expo-modules-autolinking android dir - ${chalk_1.default.dim(filePath)}`);
|
|
129
|
+
results.push({ type: 'dir', filePath, reasons });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
results.push({
|
|
133
|
+
type: 'contents',
|
|
134
|
+
id: 'expoAutolinkingConfig:android',
|
|
135
|
+
contents: JSON.stringify(config),
|
|
136
|
+
reasons,
|
|
137
|
+
});
|
|
138
|
+
return results;
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return [];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.getExpoAutolinkingAndroidSourcesAsync = getExpoAutolinkingAndroidSourcesAsync;
|
|
145
|
+
async function getExpoAutolinkingIosSourcesAsync(projectRoot, options) {
|
|
146
|
+
if (!options.platforms.includes('ios')) {
|
|
147
|
+
return [];
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
const reasons = ['expoAutolinkingIos'];
|
|
151
|
+
const results = [];
|
|
152
|
+
const { stdout } = await (0, spawn_async_1.default)('npx', ['expo-modules-autolinking', 'resolve', '-p', 'ios', '--json'], { cwd: projectRoot });
|
|
153
|
+
const config = JSON.parse(stdout);
|
|
154
|
+
for (const module of config.modules) {
|
|
155
|
+
for (const pod of module.pods) {
|
|
156
|
+
const filePath = path_1.default.relative(projectRoot, pod.podspecDir);
|
|
157
|
+
pod.podspecDir = filePath; // use relative path for the dir
|
|
158
|
+
debug(`Adding expo-modules-autolinking ios dir - ${chalk_1.default.dim(filePath)}`);
|
|
159
|
+
results.push({ type: 'dir', filePath, reasons });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
results.push({
|
|
163
|
+
type: 'contents',
|
|
164
|
+
id: 'expoAutolinkingConfig:ios',
|
|
165
|
+
contents: JSON.stringify(config),
|
|
166
|
+
reasons,
|
|
167
|
+
});
|
|
168
|
+
return results;
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.getExpoAutolinkingIosSourcesAsync = getExpoAutolinkingIosSourcesAsync;
|
|
175
|
+
//# sourceMappingURL=Expo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Expo.js","sourceRoot":"","sources":["../../src/sourcer/Expo.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA2C;AAC3C,oDAA4B;AAC5B,kDAA0B;AAC1B,wCAAyD;AACzD,sDAA6B;AAC7B,gDAAwB;AACxB,gEAAuC;AAGvC,mCAAsD;AAEtD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,+BAA+B,CAAC,CAAC;AAEzD,KAAK,UAAU,yBAAyB,CAC7C,WAAmB,EACnB,OAA0B;IAE1B,IAAI,MAAM,CAAC;IACX,IAAI;QACF,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,WAAW,EAAE,EAAE,yBAAyB,EAAE,IAAI,EAAE,CAAC,CAAC;KAC5E;IAAC,OAAO,CAAU,EAAE;QACnB,KAAK,CAAC,0BAA0B,GAAG,CAAC,CAAC,CAAC;QACtC,OAAO,EAAE,CAAC;KACX;IAED,MAAM,OAAO,GAAiB,EAAE,CAAC;IAEjC,mBAAmB;IACnB,MAA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,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;YAChC,OAAO;SACR,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;KAChB;IAAC,MAAM;QACN,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAnCD,8EAmCC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
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.getPatchPackageSourcesAsync = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const Utils_1 = require("./Utils");
|
|
9
|
+
const debug = require('debug')('expo:fingerprint:sourcer:PatchPackage');
|
|
10
|
+
async function getPatchPackageSourcesAsync(projectRoot, options) {
|
|
11
|
+
const result = await (0, Utils_1.getFileBasedHashSourceAsync)(projectRoot, 'patches', 'patchPackage');
|
|
12
|
+
if (result != null) {
|
|
13
|
+
debug(`Adding dir - ${chalk_1.default.dim('patches')}`);
|
|
14
|
+
return [result];
|
|
15
|
+
}
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
exports.getPatchPackageSourcesAsync = getPatchPackageSourcesAsync;
|
|
19
|
+
//# sourceMappingURL=PatchPackage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PatchPackage.js","sourceRoot":"","sources":["../../src/sourcer/PatchPackage.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,mCAAsD;AAEtD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,uCAAuC,CAAC,CAAC;AAEjE,KAAK,UAAU,2BAA2B,CAC/C,WAAmB,EACnB,OAA0B;IAE1B,MAAM,MAAM,GAAG,MAAM,IAAA,mCAA2B,EAAC,WAAW,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;IACzF,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,KAAK,CAAC,gBAAgB,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,MAAM,CAAC,CAAC;KACjB;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAVD,kEAUC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
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.getHashSourcesAsync = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const Profile_1 = require("../utils/Profile");
|
|
9
|
+
const Bare_1 = require("./Bare");
|
|
10
|
+
const Expo_1 = require("./Expo");
|
|
11
|
+
const PatchPackage_1 = require("./PatchPackage");
|
|
12
|
+
const debug = require('debug')('expo:fingerprint:sourcer:Sourcer');
|
|
13
|
+
async function getHashSourcesAsync(projectRoot, options) {
|
|
14
|
+
const results = await Promise.all([
|
|
15
|
+
// expo
|
|
16
|
+
(0, Profile_1.profile)(Expo_1.getExpoAutolinkingAndroidSourcesAsync)(projectRoot, options),
|
|
17
|
+
(0, Profile_1.profile)(Expo_1.getExpoAutolinkingIosSourcesAsync)(projectRoot, options),
|
|
18
|
+
(0, Profile_1.profile)(Expo_1.getExpoConfigSourcesAsync)(projectRoot, options),
|
|
19
|
+
(0, Profile_1.profile)(Expo_1.getEasBuildSourcesAsync)(projectRoot, options),
|
|
20
|
+
// bare managed files
|
|
21
|
+
(0, Profile_1.profile)(Bare_1.getGitIgnoreSourcesAsync)(projectRoot, options),
|
|
22
|
+
(0, Profile_1.profile)(Bare_1.getPackageJsonScriptSourcesAsync)(projectRoot, options),
|
|
23
|
+
// bare native files
|
|
24
|
+
(0, Profile_1.profile)(Bare_1.getBareAndroidSourcesAsync)(projectRoot, options),
|
|
25
|
+
(0, Profile_1.profile)(Bare_1.getBareIosSourcesAsync)(projectRoot, options),
|
|
26
|
+
// rn-cli autolinking
|
|
27
|
+
(0, Profile_1.profile)(Bare_1.getRncliAutolinkingSourcesAsync)(projectRoot, options),
|
|
28
|
+
// patch-package
|
|
29
|
+
(0, Profile_1.profile)(PatchPackage_1.getPatchPackageSourcesAsync)(projectRoot, options),
|
|
30
|
+
]);
|
|
31
|
+
// extra sources
|
|
32
|
+
if (options.extraSources) {
|
|
33
|
+
for (const source of options.extraSources) {
|
|
34
|
+
debug(`Adding extra source - ${chalk_1.default.dim(JSON.stringify(source))}`);
|
|
35
|
+
}
|
|
36
|
+
results.push(options.extraSources);
|
|
37
|
+
}
|
|
38
|
+
// flatten results
|
|
39
|
+
return [].concat(...results);
|
|
40
|
+
}
|
|
41
|
+
exports.getHashSourcesAsync = getHashSourcesAsync;
|
|
42
|
+
//# sourceMappingURL=Sourcer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sourcer.js","sourceRoot":"","sources":["../../src/sourcer/Sourcer.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,8CAA2C;AAC3C,iCAMgB;AAChB,iCAKgB;AAChB,iDAA6D;AAE7D,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,kCAAkC,CAAC,CAAC;AAE5D,KAAK,UAAU,mBAAmB,CACvC,WAAmB,EACnB,OAA0B;IAE1B,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAChC,OAAO;QACP,IAAA,iBAAO,EAAC,4CAAqC,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC;QACpE,IAAA,iBAAO,EAAC,wCAAiC,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC;QAChE,IAAA,iBAAO,EAAC,gCAAyB,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC;QACxD,IAAA,iBAAO,EAAC,8BAAuB,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC;QAEtD,qBAAqB;QACrB,IAAA,iBAAO,EAAC,+BAAwB,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC;QACvD,IAAA,iBAAO,EAAC,uCAAgC,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC;QAE/D,oBAAoB;QACpB,IAAA,iBAAO,EAAC,iCAA0B,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC;QACzD,IAAA,iBAAO,EAAC,6BAAsB,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC;QAErD,qBAAqB;QACrB,IAAA,iBAAO,EAAC,sCAA+B,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC;QAE9D,gBAAgB;QAChB,IAAA,iBAAO,EAAC,0CAA2B,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC;KAC3D,CAAC,CAAC;IAEH,gBAAgB;IAChB,IAAI,OAAO,CAAC,YAAY,EAAE;QACxB,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,YAAY,EAAE;YACzC,KAAK,CAAC,yBAAyB,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;SACrE;QACD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;KACpC;IAED,kBAAkB;IAClB,OAAQ,EAAmB,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC;AACjD,CAAC;AApCD,kDAoCC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
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.getFileBasedHashSourceAsync = void 0;
|
|
7
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
async function getFileBasedHashSourceAsync(projectRoot, filePath, reason) {
|
|
10
|
+
let result = null;
|
|
11
|
+
try {
|
|
12
|
+
const stat = await promises_1.default.stat(path_1.default.join(projectRoot, filePath));
|
|
13
|
+
result = {
|
|
14
|
+
type: stat.isDirectory() ? 'dir' : 'file',
|
|
15
|
+
filePath,
|
|
16
|
+
reasons: [reason],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
result = null;
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
exports.getFileBasedHashSourceAsync = getFileBasedHashSourceAsync;
|
|
25
|
+
//# sourceMappingURL=Utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../src/sourcer/Utils.ts"],"names":[],"mappings":";;;;;;AAAA,2DAA6B;AAC7B,gDAAwB;AAIjB,KAAK,UAAU,2BAA2B,CAC/C,WAAmB,EACnB,QAAgB,EAChB,MAAc;IAEd,IAAI,MAAM,GAAsB,IAAI,CAAC;IACrC,IAAI;QACF,MAAM,IAAI,GAAG,MAAM,kBAAE,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC7D,MAAM,GAAG;YACP,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM;YACzC,QAAQ;YACR,OAAO,EAAE,CAAC,MAAM,CAAC;SAClB,CAAC;KACH;IAAC,MAAM;QACN,MAAM,GAAG,IAAI,CAAC;KACf;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAjBD,kEAiBC"}
|