chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -8,10 +8,7 @@ type IsMainModuleOptions = {
|
||||
cwd?: string;
|
||||
};
|
||||
|
||||
function normalizePathCandidate(
|
||||
candidate: string | undefined,
|
||||
cwd: string,
|
||||
): string | undefined {
|
||||
function normalizePathCandidate(candidate: string | undefined, cwd: string): string | undefined {
|
||||
if (!candidate) return undefined;
|
||||
|
||||
const resolved = path.resolve(cwd, candidate);
|
||||
@@ -31,22 +28,14 @@ export function isMainModule({
|
||||
const normalizedCurrent = normalizePathCandidate(currentFile, cwd);
|
||||
const normalizedArgv1 = normalizePathCandidate(argv[1], cwd);
|
||||
|
||||
if (
|
||||
normalizedCurrent &&
|
||||
normalizedArgv1 &&
|
||||
normalizedCurrent === normalizedArgv1
|
||||
) {
|
||||
if (normalizedCurrent && normalizedArgv1 && normalizedCurrent === normalizedArgv1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// PM2 runs the script via an internal wrapper; `argv[1]` points at the wrapper.
|
||||
// PM2 exposes the actual script path in `pm_exec_path`.
|
||||
const normalizedPmExecPath = normalizePathCandidate(env.pm_exec_path, cwd);
|
||||
if (
|
||||
normalizedCurrent &&
|
||||
normalizedPmExecPath &&
|
||||
normalizedCurrent === normalizedPmExecPath
|
||||
) {
|
||||
if (normalizedCurrent && normalizedPmExecPath && normalizedCurrent === normalizedPmExecPath) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user