@expo/fingerprint 0.6.1 → 0.7.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/bin/cli.js +6 -2
- package/build/Dedup.js +1 -1
- package/build/Dedup.js.map +1 -1
- package/build/Fingerprint.types.d.ts +43 -1
- package/build/Fingerprint.types.js.map +1 -1
- package/build/Options.js +25 -0
- package/build/Options.js.map +1 -1
- package/build/hash/Hash.d.ts +4 -4
- package/build/hash/Hash.js +33 -12
- package/build/hash/Hash.js.map +1 -1
- package/build/sourcer/Expo.d.ts +4 -0
- package/build/sourcer/Expo.js +54 -3
- package/build/sourcer/Expo.js.map +1 -1
- package/build/sourcer/Packages.d.ts +18 -0
- package/build/sourcer/Packages.js +42 -0
- package/build/sourcer/Packages.js.map +1 -0
- package/build/sourcer/Sourcer.js +14 -10
- package/build/sourcer/Sourcer.js.map +1 -1
- package/build/utils/Predicates.d.ts +1 -0
- package/build/utils/Predicates.js +8 -0
- package/build/utils/Predicates.js.map +1 -0
- package/build/utils/Profile.d.ts +2 -1
- package/build/utils/Profile.js +2 -2
- package/build/utils/Profile.js.map +1 -1
- package/package.json +5 -4
package/bin/cli.js
CHANGED
|
@@ -29,15 +29,19 @@ if (!Fingerprint) {
|
|
|
29
29
|
|
|
30
30
|
const projectRoot = process.argv[2];
|
|
31
31
|
|
|
32
|
+
const options = {
|
|
33
|
+
debug: !!process.env.DEBUG,
|
|
34
|
+
}
|
|
32
35
|
try {
|
|
33
36
|
if (comparatorFingerprint) {
|
|
34
37
|
const diff = await Fingerprint.diffFingerprintChangesAsync(
|
|
35
38
|
comparatorFingerprint,
|
|
36
|
-
projectRoot
|
|
39
|
+
projectRoot,
|
|
40
|
+
options
|
|
37
41
|
);
|
|
38
42
|
console.log(JSON.stringify(diff, null, 2));
|
|
39
43
|
} else {
|
|
40
|
-
const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);
|
|
44
|
+
const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot, options);
|
|
41
45
|
console.log(JSON.stringify(fingerprint, null, 2));
|
|
42
46
|
}
|
|
43
47
|
// console.log(fingerprint.hash);
|
package/build/Dedup.js
CHANGED
|
@@ -16,7 +16,7 @@ function dedupSources(sources, projectRoot) {
|
|
|
16
16
|
const [duplicatedItemIndex, shouldSwapSource] = findDuplicatedSourceIndex(newSources, source, projectRoot);
|
|
17
17
|
if (duplicatedItemIndex >= 0) {
|
|
18
18
|
const duplicatedItem = newSources[duplicatedItemIndex];
|
|
19
|
-
debug(`Skipping duplicated source: ${source}`);
|
|
19
|
+
debug(`Skipping duplicated source: ${JSON.stringify(source)}`);
|
|
20
20
|
if (shouldSwapSource) {
|
|
21
21
|
newSources[duplicatedItemIndex] = {
|
|
22
22
|
...source,
|
package/build/Dedup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dedup.js","sourceRoot":"","sources":["../src/Dedup.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,gDAAwB;AAIxB,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,wBAAwB,CAAC,CAAC;AAEzD;;GAEG;AACH,SAAgB,YAAY,CAAC,OAAqB,EAAE,WAAmB;IACrE,MAAM,UAAU,GAAiB,EAAE,CAAC;IACpC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,GAAG,yBAAyB,CACvE,UAAU,EACV,MAAM,EACN,WAAW,CACZ,CAAC;QACF,IAAI,mBAAmB,IAAI,CAAC,EAAE;YAC5B,MAAM,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;YACvD,KAAK,CAAC,+BAA+B,MAAM,EAAE,CAAC,CAAC;YAC/
|
|
1
|
+
{"version":3,"file":"Dedup.js","sourceRoot":"","sources":["../src/Dedup.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,gDAAwB;AAIxB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,QAAQ,MAAM,GAAG,CAC1F,CAAC;KACH;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -5,6 +5,11 @@ export type FingerprintSource = HashSource & {
|
|
|
5
5
|
* If the source is excluding by `Options.dirExcludes`, the value will be null.
|
|
6
6
|
*/
|
|
7
7
|
hash: string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Debug info from the hashing process. Differs based on source type. Designed to be consumed by humans
|
|
10
|
+
* as opposed to programmatically.
|
|
11
|
+
*/
|
|
12
|
+
debugInfo?: DebugInfo;
|
|
8
13
|
};
|
|
9
14
|
export interface Fingerprint {
|
|
10
15
|
/**
|
|
@@ -50,6 +55,15 @@ export interface Options {
|
|
|
50
55
|
* Additional sources for hashing.
|
|
51
56
|
*/
|
|
52
57
|
extraSources?: HashSource[];
|
|
58
|
+
/**
|
|
59
|
+
* Whether running the functions should mute all console output. This is useful when fingerprinting is being done as
|
|
60
|
+
* part of a CLI that outputs a fingerprint and outputting anything else pollutes the results.
|
|
61
|
+
*/
|
|
62
|
+
silent?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Whether to include verbose debug info in source output. Useful for debugging.
|
|
65
|
+
*/
|
|
66
|
+
debug?: boolean;
|
|
53
67
|
}
|
|
54
68
|
export interface NormalizedOptions extends Options {
|
|
55
69
|
platforms: NonNullable<Options['platforms']>;
|
|
@@ -83,7 +97,35 @@ export interface HashSourceContents {
|
|
|
83
97
|
reasons: string[];
|
|
84
98
|
}
|
|
85
99
|
export type HashSource = HashSourceFile | HashSourceDir | HashSourceContents;
|
|
86
|
-
export interface
|
|
100
|
+
export interface DebugInfoFile {
|
|
101
|
+
path: string;
|
|
102
|
+
hash: string;
|
|
103
|
+
}
|
|
104
|
+
export interface DebugInfoDir {
|
|
105
|
+
path: string;
|
|
106
|
+
hash: string;
|
|
107
|
+
children: (DebugInfoFile | DebugInfoDir | undefined)[];
|
|
108
|
+
}
|
|
109
|
+
export interface DebugInfoContents {
|
|
110
|
+
hash: string;
|
|
111
|
+
}
|
|
112
|
+
export type DebugInfo = DebugInfoFile | DebugInfoDir | DebugInfoContents;
|
|
113
|
+
export interface HashResultFile {
|
|
114
|
+
type: 'file';
|
|
115
|
+
id: string;
|
|
116
|
+
hex: string;
|
|
117
|
+
debugInfo?: DebugInfoFile;
|
|
118
|
+
}
|
|
119
|
+
export interface HashResultDir {
|
|
120
|
+
type: 'dir';
|
|
121
|
+
id: string;
|
|
122
|
+
hex: string;
|
|
123
|
+
debugInfo?: DebugInfoDir;
|
|
124
|
+
}
|
|
125
|
+
export interface HashResultContents {
|
|
126
|
+
type: 'contents';
|
|
87
127
|
id: string;
|
|
88
128
|
hex: string;
|
|
129
|
+
debugInfo?: DebugInfoContents;
|
|
89
130
|
}
|
|
131
|
+
export type HashResult = HashResultFile | HashResultDir | HashResultContents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fingerprint.types.js","sourceRoot":"","sources":["../src/Fingerprint.types.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"Fingerprint.types.js","sourceRoot":"","sources":["../src/Fingerprint.types.ts"],"names":[],"mappings":";;AAgKA,YAAY"}
|
package/build/Options.js
CHANGED
|
@@ -10,10 +10,33 @@ const path_1 = __importDefault(require("path"));
|
|
|
10
10
|
exports.FINGERPRINT_IGNORE_FILENAME = '.fingerprintignore';
|
|
11
11
|
exports.DEFAULT_IGNORE_PATHS = [
|
|
12
12
|
exports.FINGERPRINT_IGNORE_FILENAME,
|
|
13
|
+
// Android
|
|
13
14
|
'**/android/build/**/*',
|
|
15
|
+
'**/android/.cxx/**/*',
|
|
16
|
+
'**/android/.gradle/**/*',
|
|
14
17
|
'**/android/app/build/**/*',
|
|
15
18
|
'**/android/app/.cxx/**/*',
|
|
19
|
+
'**/android/app/.gradle/**/*',
|
|
20
|
+
'**/android-annotation/build/**/*',
|
|
21
|
+
'**/android-annotation/.cxx/**/*',
|
|
22
|
+
'**/android-annotation/.gradle/**/*',
|
|
23
|
+
'**/android-annotation-processor/build/**/*',
|
|
24
|
+
'**/android-annotation-processor/.cxx/**/*',
|
|
25
|
+
'**/android-annotation-processor/.gradle/**/*',
|
|
26
|
+
// Often has different line endings, thus we have to ignore it
|
|
27
|
+
'**/android/gradlew.bat',
|
|
28
|
+
// Android gradle plugins
|
|
29
|
+
'**/*-gradle-plugin/build/**/*',
|
|
30
|
+
'**/*-gradle-plugin/.cxx/**/*',
|
|
31
|
+
'**/*-gradle-plugin/.gradle/**/*',
|
|
32
|
+
// iOS
|
|
16
33
|
'**/ios/Pods/**/*',
|
|
34
|
+
'**/ios/build/**/*',
|
|
35
|
+
'**/ios/.xcode.env.local',
|
|
36
|
+
'**/ios/**/project.xcworkspace',
|
|
37
|
+
'**/ios/*.xcworkspace/xcuserdata/**/*',
|
|
38
|
+
// System files that differ from machine to machine
|
|
39
|
+
'**/.DS_Store',
|
|
17
40
|
// Ignore all expo configs because we will read expo config in a HashSourceContents already
|
|
18
41
|
'app.config.ts',
|
|
19
42
|
'app.config.js',
|
|
@@ -26,6 +49,7 @@ exports.DEFAULT_IGNORE_PATHS = [
|
|
|
26
49
|
'**/node_modules/expo/config.js',
|
|
27
50
|
'**/node_modules/expo/config-plugins.js',
|
|
28
51
|
`**/node_modules/{${[
|
|
52
|
+
'chalk',
|
|
29
53
|
'debug',
|
|
30
54
|
'escape-string-regexp',
|
|
31
55
|
'getenv',
|
|
@@ -34,6 +58,7 @@ exports.DEFAULT_IGNORE_PATHS = [
|
|
|
34
58
|
'imurmurhash',
|
|
35
59
|
'js-tokens',
|
|
36
60
|
'json5',
|
|
61
|
+
'picocolors',
|
|
37
62
|
'lines-and-columns',
|
|
38
63
|
'require-from-string',
|
|
39
64
|
'resolve-from',
|
package/build/Options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Options.js","sourceRoot":"","sources":["../src/Options.ts"],"names":[],"mappings":";;;;;;AAAA,2DAA6B;AAC7B,4CAAoB;AACpB,gDAAwB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
import type { Fingerprint, FingerprintSource,
|
|
2
|
+
import type { Fingerprint, FingerprintSource, HashResultContents, HashResultDir, HashResultFile, HashSource, HashSourceContents, NormalizedOptions } from '../Fingerprint.types';
|
|
3
3
|
/**
|
|
4
4
|
* Create a `Fingerprint` from `HashSources` array
|
|
5
5
|
*/
|
|
@@ -12,16 +12,16 @@ export declare function createFingerprintSourceAsync(source: HashSource, limiter
|
|
|
12
12
|
/**
|
|
13
13
|
* Create a `HashResult` from a file
|
|
14
14
|
*/
|
|
15
|
-
export declare function createFileHashResultsAsync(filePath: string, limiter: pLimit.Limit, projectRoot: string, options: NormalizedOptions): Promise<
|
|
15
|
+
export declare function createFileHashResultsAsync(filePath: string, limiter: pLimit.Limit, projectRoot: string, options: NormalizedOptions): Promise<HashResultFile | null>;
|
|
16
16
|
/**
|
|
17
17
|
* Create `HashResult` for a dir.
|
|
18
18
|
* If the dir is excluded, returns null rather than a HashResult
|
|
19
19
|
*/
|
|
20
|
-
export declare function createDirHashResultsAsync(dirPath: string, limiter: pLimit.Limit, projectRoot: string, options: NormalizedOptions, depth?: number): Promise<
|
|
20
|
+
export declare function createDirHashResultsAsync(dirPath: string, limiter: pLimit.Limit, projectRoot: string, options: NormalizedOptions, depth?: number): Promise<HashResultDir | null>;
|
|
21
21
|
/**
|
|
22
22
|
* Create `HashResult` for a `HashSourceContents`
|
|
23
23
|
*/
|
|
24
|
-
export declare function createContentsHashResultsAsync(source: HashSourceContents, options: NormalizedOptions): Promise<
|
|
24
|
+
export declare function createContentsHashResultsAsync(source: HashSourceContents, options: NormalizedOptions): Promise<HashResultContents>;
|
|
25
25
|
/**
|
|
26
26
|
* Create id from given source
|
|
27
27
|
*/
|
package/build/hash/Hash.js
CHANGED
|
@@ -10,6 +10,7 @@ const promises_1 = __importDefault(require("fs/promises"));
|
|
|
10
10
|
const p_limit_1 = __importDefault(require("p-limit"));
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
12
12
|
const Path_1 = require("../utils/Path");
|
|
13
|
+
const Predicates_1 = require("../utils/Predicates");
|
|
13
14
|
const Profile_1 = require("../utils/Profile");
|
|
14
15
|
/**
|
|
15
16
|
* Create a `Fingerprint` from `HashSources` array
|
|
@@ -45,12 +46,16 @@ async function createFingerprintSourceAsync(source, limiter, projectRoot, option
|
|
|
45
46
|
result = await createFileHashResultsAsync(source.filePath, limiter, projectRoot, options);
|
|
46
47
|
break;
|
|
47
48
|
case 'dir':
|
|
48
|
-
result = await (0, Profile_1.profile)(createDirHashResultsAsync, `createDirHashResultsAsync(${source.filePath})`)(source.filePath, limiter, projectRoot, options);
|
|
49
|
+
result = await (0, Profile_1.profile)(options, createDirHashResultsAsync, `createDirHashResultsAsync(${source.filePath})`)(source.filePath, limiter, projectRoot, options);
|
|
49
50
|
break;
|
|
50
51
|
default:
|
|
51
52
|
throw new Error('Unsupported source type');
|
|
52
53
|
}
|
|
53
|
-
return {
|
|
54
|
+
return {
|
|
55
|
+
...source,
|
|
56
|
+
hash: result?.hex ?? null,
|
|
57
|
+
...(options.debug ? { debugInfo: result?.debugInfo } : undefined),
|
|
58
|
+
};
|
|
54
59
|
}
|
|
55
60
|
exports.createFingerprintSourceAsync = createFingerprintSourceAsync;
|
|
56
61
|
/**
|
|
@@ -89,7 +94,12 @@ async function createFileHashResultsAsync(filePath, limiter, projectRoot, option
|
|
|
89
94
|
stream.on('close', () => {
|
|
90
95
|
if (!resolved) {
|
|
91
96
|
const hex = hasher.digest('hex');
|
|
92
|
-
resolve({
|
|
97
|
+
resolve({
|
|
98
|
+
type: 'file',
|
|
99
|
+
id: filePath,
|
|
100
|
+
hex,
|
|
101
|
+
...(options.debug ? { debugInfo: { path: filePath, hash: hex } } : undefined),
|
|
102
|
+
});
|
|
93
103
|
resolved = true;
|
|
94
104
|
}
|
|
95
105
|
});
|
|
@@ -112,28 +122,34 @@ async function createDirHashResultsAsync(dirPath, limiter, projectRoot, options,
|
|
|
112
122
|
return null;
|
|
113
123
|
}
|
|
114
124
|
const dirents = (await promises_1.default.readdir(path_1.default.join(projectRoot, dirPath), { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name));
|
|
115
|
-
const
|
|
116
|
-
for (const dirent of dirents) {
|
|
125
|
+
const results = (await Promise.all(dirents.map(async (dirent) => {
|
|
117
126
|
if (dirent.isDirectory()) {
|
|
118
127
|
const filePath = path_1.default.join(dirPath, dirent.name);
|
|
119
|
-
|
|
128
|
+
return await createDirHashResultsAsync(filePath, limiter, projectRoot, options, depth + 1);
|
|
120
129
|
}
|
|
121
130
|
else if (dirent.isFile()) {
|
|
122
131
|
const filePath = path_1.default.join(dirPath, dirent.name);
|
|
123
|
-
|
|
132
|
+
return await createFileHashResultsAsync(filePath, limiter, projectRoot, options);
|
|
124
133
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const results = (await Promise.all(promises)).filter((result) => result != null);
|
|
134
|
+
return null;
|
|
135
|
+
}))).filter(Predicates_1.nonNullish);
|
|
128
136
|
if (results.length === 0) {
|
|
129
137
|
return null;
|
|
130
138
|
}
|
|
139
|
+
const hasher = (0, crypto_1.createHash)(options.hashAlgorithm);
|
|
140
|
+
const children = [];
|
|
131
141
|
for (const result of results) {
|
|
132
142
|
hasher.update(result.id);
|
|
133
143
|
hasher.update(result.hex);
|
|
144
|
+
children.push(result.debugInfo);
|
|
134
145
|
}
|
|
135
146
|
const hex = hasher.digest('hex');
|
|
136
|
-
return {
|
|
147
|
+
return {
|
|
148
|
+
type: 'dir',
|
|
149
|
+
id: dirPath,
|
|
150
|
+
hex,
|
|
151
|
+
...(options.debug ? { debugInfo: { path: dirPath, children, hash: hex } } : undefined),
|
|
152
|
+
};
|
|
137
153
|
}
|
|
138
154
|
exports.createDirHashResultsAsync = createDirHashResultsAsync;
|
|
139
155
|
/**
|
|
@@ -141,7 +157,12 @@ exports.createDirHashResultsAsync = createDirHashResultsAsync;
|
|
|
141
157
|
*/
|
|
142
158
|
async function createContentsHashResultsAsync(source, options) {
|
|
143
159
|
const hex = (0, crypto_1.createHash)(options.hashAlgorithm).update(source.contents).digest('hex');
|
|
144
|
-
return {
|
|
160
|
+
return {
|
|
161
|
+
type: 'contents',
|
|
162
|
+
id: source.id,
|
|
163
|
+
hex,
|
|
164
|
+
...(options.debug ? { debugInfo: { hash: hex } } : undefined),
|
|
165
|
+
};
|
|
145
166
|
}
|
|
146
167
|
exports.createContentsHashResultsAsync = createContentsHashResultsAsync;
|
|
147
168
|
/**
|
package/build/hash/Hash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hash.js","sourceRoot":"","sources":["../../src/hash/Hash.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAoC;AACpC,2BAAsC;AACtC,2DAA6B;AAC7B,sDAA6B;AAC7B,gDAAwB;
|
|
1
|
+
{"version":3,"file":"Hash.js","sourceRoot":"","sources":["../../src/hash/Hash.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAoC;AACpC,2BAAsC;AACtC,2DAA6B;AAC7B,sDAA6B;AAC7B,gDAAwB;AAexB,wCAA8C;AAC9C,oDAAiD;AACjD,8CAA2C;AAE3C;;GAEG;AACI,KAAK,UAAU,iCAAiC,CACrD,OAAqB,EACrB,WAAmB,EACnB,OAA0B;IAE1B,MAAM,OAAO,GAAG,IAAA,iBAAM,EAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAClD,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,GAAG,CAC1C,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,4BAA4B,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAC7F,CAAC;IAEF,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACjD,KAAK,MAAM,MAAM,IAAI,kBAAkB,EAAE;QACvC,IAAI,MAAM,CAAC,IAAI,IAAI,IAAI,EAAE;YACvB,MAAM,CAAC,MAAM,CAAC,cAAc,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,CAAC,CAAC,SAAS,CAAC;KAC9D,CAAC;AACJ,CAAC;AAXD,wEAWC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,MAAkB;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/sourcer/Expo.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ import type { HashSource, NormalizedOptions } from '../Fingerprint.types';
|
|
|
2
2
|
export declare function getExpoConfigSourcesAsync(projectRoot: string, options: NormalizedOptions): Promise<HashSource[]>;
|
|
3
3
|
export declare function getEasBuildSourcesAsync(projectRoot: string, options: NormalizedOptions): Promise<HashSource[]>;
|
|
4
4
|
export declare function getExpoAutolinkingAndroidSourcesAsync(projectRoot: string, options: NormalizedOptions): Promise<HashSource[]>;
|
|
5
|
+
/**
|
|
6
|
+
* Gets the patch sources for the `patch-project`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getExpoCNGPatchSourcesAsync(projectRoot: string, options: NormalizedOptions): Promise<HashSource[]>;
|
|
5
9
|
export declare function getExpoAutolinkingIosSourcesAsync(projectRoot: string, options: NormalizedOptions): Promise<HashSource[]>;
|
|
6
10
|
/**
|
|
7
11
|
* Sort the expo-modules-autolinking android config to make it stable from hashing.
|
package/build/sourcer/Expo.js
CHANGED
|
@@ -3,13 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.sortExpoAutolinkingAndroidConfig = exports.getExpoAutolinkingIosSourcesAsync = exports.getExpoAutolinkingAndroidSourcesAsync = exports.getEasBuildSourcesAsync = exports.getExpoConfigSourcesAsync = void 0;
|
|
6
|
+
exports.sortExpoAutolinkingAndroidConfig = exports.getExpoAutolinkingIosSourcesAsync = exports.getExpoCNGPatchSourcesAsync = exports.getExpoAutolinkingAndroidSourcesAsync = exports.getEasBuildSourcesAsync = exports.getExpoConfigSourcesAsync = void 0;
|
|
7
7
|
const spawn_async_1 = __importDefault(require("@expo/spawn-async"));
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
10
10
|
const os_1 = __importDefault(require("os"));
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
12
12
|
const resolve_from_1 = __importDefault(require("resolve-from"));
|
|
13
|
+
const semver_1 = __importDefault(require("semver"));
|
|
13
14
|
const ExpoConfigLoader_1 = require("./ExpoConfigLoader");
|
|
14
15
|
const Utils_1 = require("./Utils");
|
|
15
16
|
const debug = require('debug')('expo:fingerprint:sourcer:Expo');
|
|
@@ -85,7 +86,18 @@ exports.getExpoConfigSourcesAsync = getExpoConfigSourcesAsync;
|
|
|
85
86
|
function normalizeExpoConfig(config) {
|
|
86
87
|
// Deep clone by JSON.parse/stringify that assumes the config is serializable.
|
|
87
88
|
const normalizedConfig = JSON.parse(JSON.stringify(config));
|
|
88
|
-
|
|
89
|
+
if (typeof normalizedConfig.runtimeVersion === 'string') {
|
|
90
|
+
delete normalizedConfig.runtimeVersion;
|
|
91
|
+
}
|
|
92
|
+
if (typeof normalizedConfig.android?.runtimeVersion === 'string') {
|
|
93
|
+
delete normalizedConfig.android.runtimeVersion;
|
|
94
|
+
}
|
|
95
|
+
if (typeof normalizedConfig.ios?.runtimeVersion === 'string') {
|
|
96
|
+
delete normalizedConfig.ios.runtimeVersion;
|
|
97
|
+
}
|
|
98
|
+
if (typeof normalizedConfig.web?.runtimeVersion === 'string') {
|
|
99
|
+
delete normalizedConfig.web.runtimeVersion;
|
|
100
|
+
}
|
|
89
101
|
delete normalizedConfig._internal;
|
|
90
102
|
return (0, Utils_1.stringifyJsonSorted)(normalizedConfig);
|
|
91
103
|
}
|
|
@@ -126,6 +138,14 @@ async function getExpoAutolinkingAndroidSourcesAsync(projectRoot, options) {
|
|
|
126
138
|
debug(`Adding expo-modules-autolinking android dir - ${chalk_1.default.dim(filePath)}`);
|
|
127
139
|
results.push({ type: 'dir', filePath, reasons });
|
|
128
140
|
}
|
|
141
|
+
if (module.plugins) {
|
|
142
|
+
for (const plugin of module.plugins) {
|
|
143
|
+
const filePath = path_1.default.relative(projectRoot, plugin.sourceDir);
|
|
144
|
+
plugin.sourceDir = filePath; // use relative path for the dir
|
|
145
|
+
debug(`Adding expo-modules-autolinking android dir - ${chalk_1.default.dim(filePath)}`);
|
|
146
|
+
results.push({ type: 'dir', filePath, reasons });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
129
149
|
}
|
|
130
150
|
results.push({
|
|
131
151
|
type: 'contents',
|
|
@@ -140,14 +160,27 @@ async function getExpoAutolinkingAndroidSourcesAsync(projectRoot, options) {
|
|
|
140
160
|
}
|
|
141
161
|
}
|
|
142
162
|
exports.getExpoAutolinkingAndroidSourcesAsync = getExpoAutolinkingAndroidSourcesAsync;
|
|
163
|
+
/**
|
|
164
|
+
* Gets the patch sources for the `patch-project`.
|
|
165
|
+
*/
|
|
166
|
+
async function getExpoCNGPatchSourcesAsync(projectRoot, options) {
|
|
167
|
+
const result = await (0, Utils_1.getFileBasedHashSourceAsync)(projectRoot, 'cng-patches', 'expoCNGPatches');
|
|
168
|
+
if (result != null) {
|
|
169
|
+
debug(`Adding dir - ${chalk_1.default.dim('cng-patches')}`);
|
|
170
|
+
return [result];
|
|
171
|
+
}
|
|
172
|
+
return [];
|
|
173
|
+
}
|
|
174
|
+
exports.getExpoCNGPatchSourcesAsync = getExpoCNGPatchSourcesAsync;
|
|
143
175
|
async function getExpoAutolinkingIosSourcesAsync(projectRoot, options) {
|
|
144
176
|
if (!options.platforms.includes('ios')) {
|
|
145
177
|
return [];
|
|
146
178
|
}
|
|
179
|
+
const platform = getIosAutolinkingPlatformParam(projectRoot);
|
|
147
180
|
try {
|
|
148
181
|
const reasons = ['expoAutolinkingIos'];
|
|
149
182
|
const results = [];
|
|
150
|
-
const { stdout } = await (0, spawn_async_1.default)('npx', ['expo-modules-autolinking', 'resolve', '-p',
|
|
183
|
+
const { stdout } = await (0, spawn_async_1.default)('npx', ['expo-modules-autolinking', 'resolve', '-p', platform, '--json'], { cwd: projectRoot });
|
|
151
184
|
const config = JSON.parse(stdout);
|
|
152
185
|
for (const module of config.modules) {
|
|
153
186
|
for (const pod of module.pods) {
|
|
@@ -181,4 +214,22 @@ function sortExpoAutolinkingAndroidConfig(config) {
|
|
|
181
214
|
return config;
|
|
182
215
|
}
|
|
183
216
|
exports.sortExpoAutolinkingAndroidConfig = sortExpoAutolinkingAndroidConfig;
|
|
217
|
+
/**
|
|
218
|
+
* Get the platform parameter for expo-modules-autolinking.
|
|
219
|
+
*
|
|
220
|
+
* Older autolinking uses `ios` and newer autolinking uses `apple`.
|
|
221
|
+
*/
|
|
222
|
+
function getIosAutolinkingPlatformParam(projectRoot) {
|
|
223
|
+
let platformParam = 'apple';
|
|
224
|
+
const expoPackageRoot = resolve_from_1.default.silent(projectRoot, 'expo/package.json');
|
|
225
|
+
const autolinkingPackageJsonPath = resolve_from_1.default.silent(expoPackageRoot ?? projectRoot, 'expo-modules-autolinking/package.json');
|
|
226
|
+
if (autolinkingPackageJsonPath) {
|
|
227
|
+
const autolinkingPackageJson = require(autolinkingPackageJsonPath);
|
|
228
|
+
// expo-modules-autolinking 1.10.0 added support for apple platform
|
|
229
|
+
if (semver_1.default.lt(autolinkingPackageJson.version, '1.10.0')) {
|
|
230
|
+
platformParam = 'ios';
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return platformParam;
|
|
234
|
+
}
|
|
184
235
|
//# sourceMappingURL=Expo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Expo.js","sourceRoot":"","sources":["../../src/sourcer/Expo.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA2C;AAC3C,kDAA0B;AAE1B,2DAA6B;AAC7B,4CAAoB;AACpB,gDAAwB;AACxB,gEAAuC;
|
|
1
|
+
{"version":3,"file":"Expo.js","sourceRoot":"","sources":["../../src/sourcer/Expo.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA2C;AAC3C,kDAA0B;AAE1B,2DAA6B;AAC7B,4CAAoB;AACpB,gDAAwB;AACxB,gEAAuC;AACvC,oDAA4B;AAE5B,yDAA6D;AAC7D,mCAA2E;AAG3E,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,+BAA+B,CAAC,CAAC;AAEzD,KAAK,UAAU,yBAAyB,CAC7C,WAAmB,EACnB,OAA0B;IAE1B,IAAI,CAAC,sBAAW,CAAC,MAAM,CAAC,cAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,EAAE;QACjE,OAAO,EAAE,CAAC;KACX;IAED,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,IAAI,MAAqB,CAAC;IAC1B,IAAI,aAAa,GAAa,EAAE,CAAC;IACjC,MAAM,WAAW,GAAG,MAAM,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAC9D,IAAI;QACF,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,qBAAU,EACjC,MAAM,EACN,CAAC,IAAA,0CAAuB,GAAE,EAAE,cAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,EACnE,EAAE,GAAG,EAAE,SAAS,EAAE,CACnB,CAAC;QACF,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACtC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAC3B,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;QACzC,OAAO,CAAC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,WAAmB;IACzD,IAAI,aAAa,GAAG,OAAO,CAAC;IAC5B,MAAM,eAAe,GAAG,sBAAW,CAAC,MAAM,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;IAC7E,MAAM,0BAA0B,GAAG,sBAAW,CAAC,MAAM,CACnD,eAAe,IAAI,WAAW,EAC9B,uCAAuC,CACxC,CAAC;IACF,IAAI,0BAA0B,EAAE;QAC9B,MAAM,sBAAsB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;QACnE,mEAAmE;QACnE,IAAI,gBAAM,CAAC,EAAE,CAAC,sBAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;YACvD,aAAa,GAAG,KAAK,CAAC;SACvB;KACF;IACD,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { HashSource, NormalizedOptions } from '../Fingerprint.types';
|
|
2
|
+
interface PackageSourcerParams {
|
|
3
|
+
/**
|
|
4
|
+
* The package name.
|
|
5
|
+
*
|
|
6
|
+
* Note that the package should be a direct dependency or devDependency of the project.
|
|
7
|
+
* Otherwise on pnpm isolated mode the resolution will fail.
|
|
8
|
+
*/
|
|
9
|
+
packageName: string;
|
|
10
|
+
/**
|
|
11
|
+
* Hashing **package.json** file for the package rather than the entire directory.
|
|
12
|
+
* This is useful when the package contains a lot of files.
|
|
13
|
+
*/
|
|
14
|
+
packageJsonOnly: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function getDefaultPackageSourcesAsync(projectRoot: string, options: NormalizedOptions): Promise<HashSource[]>;
|
|
17
|
+
export declare function getPackageSourceAsync(projectRoot: string, params: PackageSourcerParams): Promise<HashSource | null>;
|
|
18
|
+
export {};
|
|
@@ -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.getPackageSourceAsync = exports.getDefaultPackageSourcesAsync = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const resolve_from_1 = __importDefault(require("resolve-from"));
|
|
10
|
+
const Utils_1 = require("./Utils");
|
|
11
|
+
const debug = require('debug')('expo:fingerprint:sourcer:Packages');
|
|
12
|
+
const DEFAULT_PACKAGES = [
|
|
13
|
+
{
|
|
14
|
+
packageName: 'react-native',
|
|
15
|
+
packageJsonOnly: true,
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
async function getDefaultPackageSourcesAsync(projectRoot, options) {
|
|
19
|
+
const results = await Promise.all(DEFAULT_PACKAGES.map((params) => getPackageSourceAsync(projectRoot, params)));
|
|
20
|
+
return results.filter(Boolean);
|
|
21
|
+
}
|
|
22
|
+
exports.getDefaultPackageSourcesAsync = getDefaultPackageSourcesAsync;
|
|
23
|
+
async function getPackageSourceAsync(projectRoot, params) {
|
|
24
|
+
const reason = `package:${params.packageName}`;
|
|
25
|
+
const packageJsonPath = resolve_from_1.default.silent(projectRoot, `${params.packageName}/package.json`);
|
|
26
|
+
if (packageJsonPath == null) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
debug(`Adding package - ${chalk_1.default.dim(params.packageName)}`);
|
|
30
|
+
if (params.packageJsonOnly) {
|
|
31
|
+
return {
|
|
32
|
+
type: 'contents',
|
|
33
|
+
id: reason,
|
|
34
|
+
contents: JSON.stringify(require(packageJsonPath)),
|
|
35
|
+
reasons: [reason],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const packageRoot = path_1.default.relative(projectRoot, path_1.default.dirname(packageJsonPath));
|
|
39
|
+
return await (0, Utils_1.getFileBasedHashSourceAsync)(projectRoot, packageRoot, reason);
|
|
40
|
+
}
|
|
41
|
+
exports.getPackageSourceAsync = getPackageSourceAsync;
|
|
42
|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AAO,EAAE,CAAC,MAAM,CAAC;SAClB,CAAC;KACH;IAED,MAAM,WAAW,GAAG,cAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,cAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC;IAC9E,OAAO,MAAM,IAAA,mCAA2B,EAAC,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;AAC7E,CAAC;AAvBD,sDAuBC"}
|
package/build/sourcer/Sourcer.js
CHANGED
|
@@ -7,26 +7,30 @@ exports.getHashSourcesAsync = void 0;
|
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const Bare_1 = require("./Bare");
|
|
9
9
|
const Expo_1 = require("./Expo");
|
|
10
|
+
const Packages_1 = require("./Packages");
|
|
10
11
|
const PatchPackage_1 = require("./PatchPackage");
|
|
11
12
|
const Profile_1 = require("../utils/Profile");
|
|
12
13
|
const debug = require('debug')('expo:fingerprint:sourcer:Sourcer');
|
|
13
14
|
async function getHashSourcesAsync(projectRoot, options) {
|
|
14
15
|
const results = await Promise.all([
|
|
15
16
|
// 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),
|
|
17
|
+
(0, Profile_1.profile)(options, Expo_1.getExpoAutolinkingAndroidSourcesAsync)(projectRoot, options),
|
|
18
|
+
(0, Profile_1.profile)(options, Expo_1.getExpoAutolinkingIosSourcesAsync)(projectRoot, options),
|
|
19
|
+
(0, Profile_1.profile)(options, Expo_1.getExpoConfigSourcesAsync)(projectRoot, options),
|
|
20
|
+
(0, Profile_1.profile)(options, Expo_1.getEasBuildSourcesAsync)(projectRoot, options),
|
|
21
|
+
(0, Profile_1.profile)(options, Expo_1.getExpoCNGPatchSourcesAsync)(projectRoot, options),
|
|
20
22
|
// bare managed files
|
|
21
|
-
(0, Profile_1.profile)(Bare_1.getGitIgnoreSourcesAsync)(projectRoot, options),
|
|
22
|
-
(0, Profile_1.profile)(Bare_1.getPackageJsonScriptSourcesAsync)(projectRoot, options),
|
|
23
|
+
(0, Profile_1.profile)(options, Bare_1.getGitIgnoreSourcesAsync)(projectRoot, options),
|
|
24
|
+
(0, Profile_1.profile)(options, Bare_1.getPackageJsonScriptSourcesAsync)(projectRoot, options),
|
|
23
25
|
// bare native files
|
|
24
|
-
(0, Profile_1.profile)(Bare_1.getBareAndroidSourcesAsync)(projectRoot, options),
|
|
25
|
-
(0, Profile_1.profile)(Bare_1.getBareIosSourcesAsync)(projectRoot, options),
|
|
26
|
+
(0, Profile_1.profile)(options, Bare_1.getBareAndroidSourcesAsync)(projectRoot, options),
|
|
27
|
+
(0, Profile_1.profile)(options, Bare_1.getBareIosSourcesAsync)(projectRoot, options),
|
|
26
28
|
// rn-cli autolinking
|
|
27
|
-
(0, Profile_1.profile)(Bare_1.getRncliAutolinkingSourcesAsync)(projectRoot, options),
|
|
29
|
+
(0, Profile_1.profile)(options, Bare_1.getRncliAutolinkingSourcesAsync)(projectRoot, options),
|
|
28
30
|
// patch-package
|
|
29
|
-
(0, Profile_1.profile)(PatchPackage_1.getPatchPackageSourcesAsync)(projectRoot, options),
|
|
31
|
+
(0, Profile_1.profile)(options, PatchPackage_1.getPatchPackageSourcesAsync)(projectRoot, options),
|
|
32
|
+
// some known dependencies, e.g. react-native
|
|
33
|
+
(0, Profile_1.profile)(options, Packages_1.getDefaultPackageSourcesAsync)(projectRoot, options),
|
|
30
34
|
]);
|
|
31
35
|
// extra sources
|
|
32
36
|
if (options.extraSources) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sourcer.js","sourceRoot":"","sources":["../../src/sourcer/Sourcer.ts"],"names":[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,EAAC,OAAO,EAAE,sCAA+B,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC;QAEvE,gBAAgB;QAChB,IAAA,iBAAO,EAAC,OAAO,EAAE,0CAA2B,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC;QAEnE,6CAA6C;QAC7C,IAAA,iBAAO,EAAC,OAAO,EAAE,wCAA6B,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC;KACtE,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;AAxCD,kDAwCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function nonNullish<TValue>(value: TValue | null | undefined): value is NonNullable<TValue>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nonNullish = void 0;
|
|
4
|
+
function nonNullish(value) {
|
|
5
|
+
return value !== null && value !== undefined;
|
|
6
|
+
}
|
|
7
|
+
exports.nonNullish = nonNullish;
|
|
8
|
+
//# sourceMappingURL=Predicates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Predicates.js","sourceRoot":"","sources":["../../src/utils/Predicates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,UAAU,CAAS,KAAgC;IACjE,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC;AAFD,gCAEC"}
|
package/build/utils/Profile.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NormalizedOptions } from '../Fingerprint.types';
|
|
1
2
|
/**
|
|
2
3
|
* Wrap a method and profile the time it takes to execute the method using `EXPO_PROFILE`.
|
|
3
4
|
* Works best with named functions (i.e. not arrow functions).
|
|
@@ -5,4 +6,4 @@
|
|
|
5
6
|
* @param fn function to profile.
|
|
6
7
|
* @param functionName optional name of the function to display in the profile output.
|
|
7
8
|
*/
|
|
8
|
-
export declare function profile<IArgs extends any[], T extends (...args: IArgs) => any>(fn: T, functionName?: string): T;
|
|
9
|
+
export declare function profile<IArgs extends any[], T extends (...args: IArgs) => any>(options: NormalizedOptions, fn: T, functionName?: string): T;
|
package/build/utils/Profile.js
CHANGED
|
@@ -12,8 +12,8 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
12
12
|
* @param fn function to profile.
|
|
13
13
|
* @param functionName optional name of the function to display in the profile output.
|
|
14
14
|
*/
|
|
15
|
-
function profile(fn, functionName = fn.name) {
|
|
16
|
-
if (!process.env['DEBUG']) {
|
|
15
|
+
function profile(options, fn, functionName = fn.name) {
|
|
16
|
+
if (!process.env['DEBUG'] || options.silent) {
|
|
17
17
|
return fn;
|
|
18
18
|
}
|
|
19
19
|
const name = chalk_1.default.dim(`⏱ [profile] ${functionName ?? 'unknown'}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Profile.js","sourceRoot":"","sources":["../../src/utils/Profile.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;
|
|
1
|
+
{"version":3,"file":"Profile.js","sourceRoot":"","sources":["../../src/utils/Profile.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAI1B;;;;;;GAMG;AACH,SAAgB,OAAO,CACrB,OAA0B,EAC1B,EAAK,EACL,eAAuB,EAAE,CAAC,IAAI;IAE9B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE;QAC3C,OAAO,EAAE,CAAC;KACX;IAED,MAAM,IAAI,GAAG,eAAK,CAAC,GAAG,CAAC,gBAAgB,YAAY,IAAI,SAAS,EAAE,CAAC,CAAC;IAEpE,OAAO,CAAC,CAAC,GAAG,IAAW,EAAE,EAAE;QACzB,mBAAmB;QACnB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEnB,qBAAqB;QACrB,MAAM,OAAO,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QAE5B,oCAAoC;QACpC,IAAI,CAAC,CAAC,OAAO,YAAY,OAAO,CAAC,EAAE;YACjC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACtB,OAAO,OAAO,CAAC;SAChB;QAED,yDAAyD;QACzD,OAAO,IAAI,OAAO,CAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC7D,OAAO,CAAC,IAAI,CACV,CAAC,OAAO,EAAE,EAAE;gBACV,OAAO,CAAC,OAAO,CAAC,CAAC;gBACjB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACxB,CAAC,EACD,CAAC,MAAM,EAAE,EAAE;gBACT,MAAM,CAAC,MAAM,CAAC,CAAC;gBACf,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACxB,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAM,CAAC;AACV,CAAC;AAtCD,0BAsCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/fingerprint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "A library to generate a fingerprint from a React Native project",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -41,13 +41,14 @@
|
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"homepage": "https://github.com/expo/expo/tree/main/packages/@expo/fingerprint#readme",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@expo/spawn-async": "^1.
|
|
44
|
+
"@expo/spawn-async": "^1.7.2",
|
|
45
45
|
"chalk": "^4.1.2",
|
|
46
46
|
"debug": "^4.3.4",
|
|
47
47
|
"find-up": "^5.0.0",
|
|
48
48
|
"minimatch": "^3.0.4",
|
|
49
49
|
"p-limit": "^3.1.0",
|
|
50
|
-
"resolve-from": "^5.0.0"
|
|
50
|
+
"resolve-from": "^5.0.0",
|
|
51
|
+
"semver": "^7.6.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@types/find-up": "^4.0.0",
|
|
@@ -55,5 +56,5 @@
|
|
|
55
56
|
"glob": "^7.1.7",
|
|
56
57
|
"temp-dir": "^2.0.0"
|
|
57
58
|
},
|
|
58
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "ee4f30ef3b5fa567ad1bf94794197f7683fdd481"
|
|
59
60
|
}
|