mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 17:17:38 +00:00
Combine the completed comment cleanup from 319 stacked PRs into one change against `main`, so the full CI suite validates the combined result once. This replaces the previous audit stack; no additional audit work is included. The change shortens redundant comments across 2,753 source and shell-snapshot files (25,235 net lines removed). Conflicts preserve current-main executable code. Runtime behavior, test assertions, directives, licenses, generated notices, SAFETY rationales, and compatibility markers are preserved. The audit tracker remains local, outside the repository. Validation: - Equivalent source/emitted AST and executable tokens across all 2,750 source files, with separate checks for embedded shell, SQL, JavaScript, CSS, and generated fixtures. - Identical executable lines in the three shell snapshots; protected comments unchanged. - Changed-code quality gate passed with no new findings. - 358 tests passed, 2 skipped across 23 focused test files. - `git diff --check` passed.
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import { basename, dirname, join } from 'node:path'
|
|
import { getAppEnvironment, hasAppEnvironment } from '../shared/app-environment'
|
|
|
|
/** Keep this reachable from plain-Node entries; the build guard rejects Electron imports here. */
|
|
export type WorkerEntryLayout = {
|
|
isPackaged: boolean
|
|
/** Undefined on a non-Electron host: `process.resourcesPath` is Electron-only. */
|
|
resourcesPath: string | undefined
|
|
moduleDir: string
|
|
}
|
|
|
|
export function resolveWorkerThreadEntryPath(
|
|
layout: WorkerEntryLayout,
|
|
entryFileName: string
|
|
): string {
|
|
// Plain-Node orcad can be packaged without Electron resources; its workers live beside the module.
|
|
if (layout.isPackaged && layout.resourcesPath) {
|
|
return join(layout.resourcesPath, 'app.asar', 'out', 'main', entryFileName)
|
|
}
|
|
return join(layout.moduleDir, entryFileName)
|
|
}
|
|
|
|
// The build's `chunkFileNames` folder; worker entries sit one level up, beside the main entry.
|
|
const SHARED_CHUNK_DIR_NAME = 'chunks'
|
|
|
|
export function currentWorkerEntryLayout(moduleDir: string): WorkerEntryLayout {
|
|
return {
|
|
isPackaged: hasAppEnvironment() && getAppEnvironment().isPackaged(),
|
|
resourcesPath:
|
|
'resourcesPath' in process && typeof process.resourcesPath === 'string'
|
|
? process.resourcesPath
|
|
: undefined,
|
|
// Why: a caller bundled into a shared chunk sees `out/main/chunks` as its `__dirname`.
|
|
moduleDir: basename(moduleDir) === SHARED_CHUNK_DIR_NAME ? dirname(moduleDir) : moduleDir
|
|
}
|
|
}
|