-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: reduce the bundle size of client (#644)
- Loading branch information
Showing
15 changed files
with
73 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { SDK } from '@rsdoctor/types'; | ||
import { | ||
import type { | ||
Module, | ||
ModuleGraph, | ||
Statement, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Replace lodash's isUndefined function | ||
export function isUndefined(value: unknown): value is undefined { | ||
return typeof value === 'undefined'; | ||
} | ||
|
||
// Replace lodash's isNumber function | ||
export function isNumber(value: unknown): value is number { | ||
return typeof value === 'number' && !Number.isNaN(value); | ||
} | ||
|
||
export function isObject(value: unknown): value is Record<string, unknown> { | ||
return typeof value === 'object' && value !== null; | ||
} | ||
|
||
// Replace lodash's isEmpty function | ||
export function isEmpty(value: unknown): boolean { | ||
return ( | ||
value == null || // Check for null or undefined | ||
(Array.isArray(value) && value.length === 0) || // Check for empty array | ||
(typeof value === 'object' && Object.keys(value).length === 0) // Check for empty object | ||
); | ||
} | ||
|
||
// Replace lodash's last function | ||
export function last<T>(array: T[]): T | undefined { | ||
return array[array.length - 1]; | ||
} | ||
|
||
// Replace lodash's compact function | ||
export function compact<T>(array: (T | null | undefined)[]): T[] { | ||
return array.filter((item): item is T => item != null || !item); // Filter out null and undefined | ||
} | ||
|
||
// Replace lodash's isNil function | ||
export function isNil(value: unknown): value is null | undefined { | ||
return value === null || value === undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.