Skip to content

Commit 9100596

Browse files
authored
Merge branch 'main' into fixtoggleProfileTool
2 parents 14fde5a + c2f2ebf commit 9100596

99 files changed

Lines changed: 1606 additions & 847 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Mobile-Expensify

__mocks__/@ua/react-native-airship.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ enum EventType {
66
PushReceived = 'com.airship.push_received',
77
}
88

9+
// eslint-disable-next-line no-restricted-syntax
10+
enum PermissionStatus {
11+
Granted = 'granted',
12+
Denied = 'denied',
13+
NotDetermined = 'not_determined',
14+
}
15+
916
// eslint-disable-next-line @typescript-eslint/no-namespace
1017
namespace iOS {
1118
/**
@@ -71,4 +78,4 @@ const Airship: Partial<AirshipRoot> = {
7178

7279
export default Airship;
7380

74-
export {EventType, iOS};
81+
export {EventType, iOS, PermissionStatus};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const NitroModules = {
2+
createHybridObject: jest.fn(() => ({
3+
getAll: jest.fn(() => Promise.resolve([])),
4+
})),
5+
};
6+
7+
export {
8+
// eslint-disable-next-line import/prefer-default-export
9+
NitroModules,
10+
};
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* eslint-disable no-console */
2+
import type {Compiler} from 'webpack';
3+
4+
/**
5+
* Custom webpack plugin that forces garbage collection every 5 compilations
6+
* and logs memory usage to help monitor memory consumption during development.
7+
*
8+
* Note: Requires Node.js to be started with --expose-gc flag to enable garbage collection.
9+
*/
10+
class ForceGarbageCollectionPlugin {
11+
private compilationCount = 0;
12+
13+
apply(compiler: Compiler) {
14+
if (gc && typeof gc === 'function') {
15+
compiler.hooks.done.tap(this.constructor.name, () => {
16+
this.compilationCount++;
17+
18+
// Log memory usage every compilation
19+
const memUsage = process.memoryUsage();
20+
const heapUsedMB = Math.round(memUsage.heapUsed / 1024 / 1024);
21+
const heapTotalMB = Math.round(memUsage.heapTotal / 1024 / 1024);
22+
23+
console.log(`📊 Compilation #${this.compilationCount} - Heap: ${heapUsedMB}MB/${heapTotalMB}MB`);
24+
if (this.compilationCount % 5 === 0) {
25+
console.log(`🗑️ Forcing garbage collection after ${this.compilationCount} compilations`);
26+
// @ts-expect-error - gc is a global function provided when Node.js is started with --expose-gc flag
27+
gc();
28+
29+
// Log memory after garbage collection
30+
const memAfterGC = process.memoryUsage();
31+
const heapAfterMB = Math.round(memAfterGC.heapUsed / 1024 / 1024);
32+
console.log(`✅ Post-GC heap size: ${heapAfterMB}MB (freed ${heapUsedMB - heapAfterMB}MB)`);
33+
}
34+
});
35+
} else {
36+
console.warn('⚠️ ForceGarbageCollectionPlugin: gc() function not available. Start Node.js with --expose-gc flag to enable garbage collection.');
37+
}
38+
}
39+
}
40+
41+
export default ForceGarbageCollectionPlugin;

0 commit comments

Comments
 (0)