Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

refactor(desktop-native): replace nested ternaries in loaders

Hampus441636bda492
diff --git a/fluxer_desktop/native/app-store/loader-diagnostics.cjs b/fluxer_desktop/native/app-store/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/app-store/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/app-store/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/gateway-socket/loader-diagnostics.cjs b/fluxer_desktop/native/gateway-socket/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/gateway-socket/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/gateway-socket/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/linux-audio-capture/loader-diagnostics.cjs b/fluxer_desktop/native/linux-audio-capture/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/linux-audio-capture/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/linux-audio-capture/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/linux-evdev/loader-diagnostics.cjs b/fluxer_desktop/native/linux-evdev/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/linux-evdev/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/linux-evdev/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/linux-input-hook/loader-diagnostics.cjs b/fluxer_desktop/native/linux-input-hook/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/linux-input-hook/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/linux-input-hook/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/linux-notifications/loader-diagnostics.cjs b/fluxer_desktop/native/linux-notifications/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/linux-notifications/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/linux-notifications/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/linux-portals/loader-diagnostics.cjs b/fluxer_desktop/native/linux-portals/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/linux-portals/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/linux-portals/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/mac-app-audio/loader-diagnostics.cjs b/fluxer_desktop/native/mac-app-audio/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/mac-app-audio/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/mac-app-audio/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/mac-clipboard/loader-diagnostics.cjs b/fluxer_desktop/native/mac-clipboard/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/mac-clipboard/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/mac-clipboard/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/mac-screen-capture/loader-diagnostics.cjs b/fluxer_desktop/native/mac-screen-capture/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/mac-screen-capture/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/mac-screen-capture/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/mac-sysctl/loader-diagnostics.cjs b/fluxer_desktop/native/mac-sysctl/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/mac-sysctl/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/mac-sysctl/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/mac-tcc/loader-diagnostics.cjs b/fluxer_desktop/native/mac-tcc/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/mac-tcc/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/mac-tcc/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/macos-input-hook/loader-diagnostics.cjs b/fluxer_desktop/native/macos-input-hook/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/macos-input-hook/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/macos-input-hook/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/platform-info/loader-diagnostics.cjs b/fluxer_desktop/native/platform-info/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/platform-info/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/platform-info/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/system-hunspell/loader-diagnostics.cjs b/fluxer_desktop/native/system-hunspell/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/system-hunspell/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/system-hunspell/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/webauthn/loader-diagnostics.cjs b/fluxer_desktop/native/webauthn/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/webauthn/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/webauthn/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/win-clipboard/loader-diagnostics.cjs b/fluxer_desktop/native/win-clipboard/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/win-clipboard/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/win-clipboard/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/win-game-capture/loader-diagnostics.cjs b/fluxer_desktop/native/win-game-capture/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/win-game-capture/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/win-game-capture/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/win-process-loopback/loader-diagnostics.cjs b/fluxer_desktop/native/win-process-loopback/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/win-process-loopback/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/win-process-loopback/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/win-shell/loader-diagnostics.cjs b/fluxer_desktop/native/win-shell/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/win-shell/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/win-shell/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,
diff --git a/fluxer_desktop/native/windows-input-hook/loader-diagnostics.cjs b/fluxer_desktop/native/windows-input-hook/loader-diagnostics.cjs
index a9d17aecc..cd22891ec 100644
--- a/fluxer_desktop/native/windows-input-hook/loader-diagnostics.cjs
+++ b/fluxer_desktop/native/windows-input-hook/loader-diagnostics.cjs
@@ -92,10 +92,16 @@ function formatFileDiagnostic(diagnostic) {
function directoryDiagnostic(dirPath) {
if (!dirPath) return {path: null, ok: false, error: 'not resolved', entries: [], total: 0, omitted: 0};
try {
- const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => ({
- name: entry.name,
- type: entry.isDirectory() ? 'directory' : entry.isFile() ? 'file' : 'other',
- }));
+ const entries = readdirSync(dirPath, {withFileTypes: true}).map((entry) => {
+ const name = entry.name;
+ let type = 'other';
+ if (entry.isDirectory()) {
+ type = 'directory';
+ } else if (entry.isFile()) {
+ type = 'file';
+ }
+ return {name, type};
+ });
entries.sort((a, b) => a.name.localeCompare(b.name));
const visible = entries.slice(0, MAX_DIRECTORY_ENTRIES);
return {
@@ -306,13 +312,14 @@ function windowsImportProbe(nativePath) {
function dependencyProbe(nativePath) {
if (!nativePath || !existsSync(nativePath)) return null;
if (process.platform === 'win32') return windowsImportProbe(nativePath);
- const command =
- process.platform === 'linux'
- ? ['ldd', nativePath]
- : process.platform === 'darwin'
- ? ['otool', '-L', nativePath]
- : null;
- if (!command) return null;
+ let command;
+ if (process.platform === 'linux') {
+ command = ['ldd', nativePath];
+ } else if (process.platform === 'darwin') {
+ command = ['otool', '-L', nativePath];
+ } else {
+ return null;
+ }
const [bin, ...args] = command;
const result = spawnSync(bin, args, {
encoding: 'utf8',
@@ -342,11 +349,14 @@ function dependencyProbe(nativePath) {
function formatDependencyProbe(diagnostic) {
if (!diagnostic) return null;
- const status = diagnostic.error
- ? `error=${diagnostic.error}`
- : diagnostic.signal
- ? `signal=${diagnostic.signal}`
- : `status=${diagnostic.status}`;
+ let status;
+ if (diagnostic.error) {
+ status = `error=${diagnostic.error}`;
+ } else if (diagnostic.signal) {
+ status = `signal=${diagnostic.signal}`;
+ } else {
+ status = `status=${diagnostic.status}`;
+ }
return [
`$ ${diagnostic.command.join(' ')}`,
status,
@@ -573,11 +583,14 @@ function probeNativeBinary({moduleName, nativePath, nativeRoot, packageDir, skip
return null;
}
if (!probeReachedRequire(result)) return null;
- const reason = result.error
- ? result.error.message
- : result.signal
- ? `safety probe terminated by signal ${result.signal}`
- : `safety probe exited with code ${result.status}`;
+ let reason;
+ if (result.error) {
+ reason = result.error.message;
+ } else if (result.signal) {
+ reason = `safety probe terminated by signal ${result.signal}`;
+ } else {
+ reason = `safety probe exited with code ${result.status}`;
+ }
const probeStdout = trimText(stripProbeMarker(result.stdout));
return createNativeLoadError({
moduleName,