@camstack/server 1.2.764 → 1.2.765
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +21 -10
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/{agent-https-CJmfFcZE.mjs → agent-https-D03iyjJk.mjs} +1 -1
- package/system/dist/{agent-https-DH_lJHh9.js → agent-https-D62iihRo.js} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -5
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +3 -3
- package/system/dist/builtins/composer/composer.addon.mjs +3 -3
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +3 -3
- package/system/dist/builtins/keychain/index.mjs +3 -3
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +5 -5
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +1 -1
- package/system/dist/builtins/loki-logging/index.mjs +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +10 -10
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +285 -285
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{capture-engine-IOE87CGh.js → capture-engine-BpoL1zQ0.js} +1 -1
- package/system/dist/{capture-engine-CQUJKdm-.mjs → capture-engine-CYmRx0Ce.mjs} +1 -1
- package/system/dist/{composition-sources-d0b3s931.js → composition-sources-B7VyYbEU.js} +1 -1
- package/system/dist/{composition-sources-C4FTY6tR.mjs → composition-sources-CknQxftO.mjs} +1 -1
- package/system/dist/{constants-BbSsUU8s.mjs → constants-C9Gxs1jW.mjs} +1 -1
- package/system/dist/{constants-Bf3S16sn.js → constants-DJqUggkW.js} +1 -1
- package/system/dist/{coral-accelerators-BW3OcrLD.mjs → coral-accelerators-DBlgWB8k.mjs} +6 -6
- package/system/dist/{custom-action-registry-BIJZBObd.mjs → custom-action-registry-oHl1xltx.mjs} +37 -37
- package/system/dist/{device-ca-BTCCvC-f.js → device-ca-9BTS4o-T.js} +1 -1
- package/system/dist/{device-ca-DtVxvkgh.mjs → device-ca-D76OqRnW.mjs} +1 -1
- package/system/dist/{dist-DRMDBvu-.mjs → dist-BhR34kF8.mjs} +2 -1
- package/system/dist/{dist-DcyjtBjf.js → dist-DLVfdGSW.js} +2 -1
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-DTY0nvBg.js → hub-mdns-ciao-DimaT9WQ.js} +2 -2
- package/system/dist/{hub-mdns-ciao-Cljo9BPS.mjs → hub-mdns-ciao-i31GIYWP.mjs} +2 -2
- package/system/dist/index.js +7 -7
- package/system/dist/index.mjs +218 -218
- package/system/dist/{restore-archive-94Ko0oT3.js → restore-archive-BkiXu43U.js} +1 -1
- package/system/dist/{restore-archive-5dvmYOeA.mjs → restore-archive-nWi73iy0.mjs} +150 -150
- package/system/dist/{wal-maintenance-C1L9D5dT.mjs → wal-maintenance-DG2bwMif.mjs} +0 -0
- package/system/dist/{wal-maintenance-uH7RcUuL.js → wal-maintenance-UQEtPem2.js} +0 -0
- package/system/package.json +1 -1
package/system/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as __require } from "./chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { Ci as objectInputDeclaresRequiredDeviceId, Do as DATAPLANE_SECRET_HEADER$1, E as CatalogFileSchema, Ea as supportedRuntimes, Eo as CALLER_STAMPED_CAPABILITIES$1, Go as ReadinessRegistry, Gr as isVoidInput, Gs as parseJsonUnknown, Ii as procedureAuthKey, Ko as ReadinessTimeoutError, Kr as kebabToCamel$1, Lr as isArrayOutputSchema, Nr as interpolate, Oo as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Os as isDebugChannelName, Qi as resolveMethodAuth, Rr as isCollectionArrayMethod, Si as objectInputDeclaresAddonId, Ss as expandCapMethods, Ur as isObjectInput, Wo as RUNTIME_DEFAULTS, Ws as parseJsonObject, Ys as resolveCapMount, Zr as lifecycleJobSchema, Zs as scopeKey, a as AGENT_MDNS_TXT_KEYS, ac as userError, ai as looseSchema, as as asNumber, bs as emitDownForOwnedCaps, bt as METHOD_ACCESS_MAP, ca as scopesAllowDeviceCap, dc as EventCategory$1, fs as collectSecretMarkerRefs, i as AGENT_MDNS_SERVICE_TYPE, ii as logLevelAtMost, is as asJsonObject$1, ko as DEVICE_STATUS_METHOD, ln as addonSettingsCapability, ms as createEvent$1, o as ALL_CAPABILITY_DEFINITIONS, oc as withoutCallerStamp, os as asString$1, qs as readinessKey, sa as scopesAllowAddon, uc as errMsg$1, va as splitTranslationRef, vn as bareAddonId, vt as LOG_LEVEL_RANK, ws as getDebugInterest, y as CATALOG_LANGS, yr as extractNestedAddonId, ys as defineRecordKinds } from "./dist-
|
|
3
|
-
import { d as JWT_SIGNING_KEY_REF, f as JwtSigningKeyUnavailableError, g as processJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, p as SYSTEM_SECRET_OWNER, s as loadDeviceCa, u as verifyDeviceSignature, v as staticJwtSigningKey } from "./device-ca-
|
|
2
|
+
import { Ci as objectInputDeclaresRequiredDeviceId, Do as DATAPLANE_SECRET_HEADER$1, E as CatalogFileSchema, Ea as supportedRuntimes, Eo as CALLER_STAMPED_CAPABILITIES$1, Go as ReadinessRegistry, Gr as isVoidInput, Gs as parseJsonUnknown, Ii as procedureAuthKey, Ko as ReadinessTimeoutError, Kr as kebabToCamel$1, Lr as isArrayOutputSchema, Nr as interpolate, Oo as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Os as isDebugChannelName, Qi as resolveMethodAuth, Rr as isCollectionArrayMethod, Si as objectInputDeclaresAddonId, Ss as expandCapMethods, Ur as isObjectInput, Wo as RUNTIME_DEFAULTS, Ws as parseJsonObject, Ys as resolveCapMount, Zr as lifecycleJobSchema, Zs as scopeKey, a as AGENT_MDNS_TXT_KEYS, ac as userError, ai as looseSchema, as as asNumber, bs as emitDownForOwnedCaps, bt as METHOD_ACCESS_MAP, ca as scopesAllowDeviceCap, dc as EventCategory$1, fs as collectSecretMarkerRefs, i as AGENT_MDNS_SERVICE_TYPE, ii as logLevelAtMost, is as asJsonObject$1, ko as DEVICE_STATUS_METHOD, ln as addonSettingsCapability, ms as createEvent$1, o as ALL_CAPABILITY_DEFINITIONS, oc as withoutCallerStamp, os as asString$1, qs as readinessKey, sa as scopesAllowAddon, uc as errMsg$1, va as splitTranslationRef, vn as bareAddonId, vt as LOG_LEVEL_RANK, ws as getDebugInterest, y as CATALOG_LANGS, yr as extractNestedAddonId, ys as defineRecordKinds } from "./dist-BhR34kF8.mjs";
|
|
3
|
+
import { d as JWT_SIGNING_KEY_REF, f as JwtSigningKeyUnavailableError, g as processJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, p as SYSTEM_SECRET_OWNER, s as loadDeviceCa, u as verifyDeviceSignature, v as staticJwtSigningKey } from "./device-ca-D76OqRnW.mjs";
|
|
4
4
|
import { t as require_read_all_rows } from "./read-all-rows-TaPqdWNF.mjs";
|
|
5
5
|
import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
|
|
6
6
|
import "./builtins/alerts/index.mjs";
|
|
@@ -25,22 +25,22 @@ import { LokiDestination, LokiLoggingAddon } from "./builtins/loki-logging/index
|
|
|
25
25
|
import NativeMetricsAddon, { a as NativeMetricsProvider, i as parseProcStatusRss, n as nodeProcReader, r as parseProcStat } from "./builtins/native-metrics/native-metrics.addon.mjs";
|
|
26
26
|
import { DeviceHistoryAddon } from "./builtins/device-history/device-history.addon.mjs";
|
|
27
27
|
import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./builtins/sqlite-storage/filesystem-storage.addon.mjs";
|
|
28
|
-
import { D as RecordsEngine, l as SqliteSettingsBackend } from "./wal-maintenance-
|
|
28
|
+
import { D as RecordsEngine, l as SqliteSettingsBackend } from "./wal-maintenance-DG2bwMif.mjs";
|
|
29
29
|
import { SqliteSettingsAddon } from "./builtins/sqlite-storage/sqlite-settings.addon.mjs";
|
|
30
30
|
import { ConfigStore, DeviceStore } from "./builtins/sqlite-storage/index.mjs";
|
|
31
31
|
import { StorageOrchestratorAddon, a as stripForwardedCaller, i as createHubCapForwardService, l as STORAGE_DRAIN_STATE_LEGACY, n as HUB_CAP_FWD_ACTION, o as buildStorageLocationRegistry, r as HUB_CAP_FWD_SERVICE, t as StorageOrchestratorService, u as storageOrchestratorRecordKinds } from "./builtins/storage-orchestrator/storage-orchestrator.addon.mjs";
|
|
32
32
|
import "./builtins/storage-orchestrator/index.mjs";
|
|
33
|
-
import { A as buildNameConstraintSet, B as setProcessAgentHttpsNames, C as LEAF_RENEWAL_WINDOW_DAYS, E as evaluateExistingCert, F as readNameConstraints, I as AGENT_HTTPS_NAMES_COLLECTION, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, N as permitsIdentity, O as PERMITTED_DNS_SUFFIXES, P as permitsName, R as AgentHttpsNames, S as CA_VALIDITY_DAYS, T as SERVER_AUTH_OID, a as collectAgentNames, b as collectCertIdentity, c as installAgentHttps, d as issueAgentHttpsLeaf, f as loadAgentHttps, h as CA_COMMON_NAME, i as certificateNames, j as isConstrainedCa, k as PERMITTED_IP_RANGES, l as isContainerBridgeAddress, m as pinnedHttpsCaFingerprint, n as acceptAgentSans, o as createAgentHttpsRequest, p as pemDigest, r as agentHttpsPaths, s as describeHttpsLeaf, t as AgentHttpsInstallError, u as isPrivateAddress, w as MAX_LEAF_VALIDITY_DAYS, x as systemHostFacts, y as localCaCommonName, z as getProcessAgentHttpsNames } from "./agent-https-
|
|
34
|
-
import { a as MESH_CA_KEY_REF, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY } from "./constants-
|
|
33
|
+
import { A as buildNameConstraintSet, B as setProcessAgentHttpsNames, C as LEAF_RENEWAL_WINDOW_DAYS, E as evaluateExistingCert, F as readNameConstraints, I as AGENT_HTTPS_NAMES_COLLECTION, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, N as permitsIdentity, O as PERMITTED_DNS_SUFFIXES, P as permitsName, R as AgentHttpsNames, S as CA_VALIDITY_DAYS, T as SERVER_AUTH_OID, a as collectAgentNames, b as collectCertIdentity, c as installAgentHttps, d as issueAgentHttpsLeaf, f as loadAgentHttps, h as CA_COMMON_NAME, i as certificateNames, j as isConstrainedCa, k as PERMITTED_IP_RANGES, l as isContainerBridgeAddress, m as pinnedHttpsCaFingerprint, n as acceptAgentSans, o as createAgentHttpsRequest, p as pemDigest, r as agentHttpsPaths, s as describeHttpsLeaf, t as AgentHttpsInstallError, u as isPrivateAddress, w as MAX_LEAF_VALIDITY_DAYS, x as systemHostFacts, y as localCaCommonName, z as getProcessAgentHttpsNames } from "./agent-https-D03iyjJk.mjs";
|
|
34
|
+
import { a as MESH_CA_KEY_REF, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY } from "./constants-C9Gxs1jW.mjs";
|
|
35
35
|
import { $ as caFingerprintCompact, A as getProcessNodeMeshTransport, B as MESH_NODE_CERTIFICATES_COLLECTION, C as MESH_TLS_PORT_HELLO_FIELD, Ct as readOriginSetting, D as setProcessMeshTlsEnabler, Dt as readCidrSetting, E as ServiceBroker, Et as parseCidrList, F as renewMeshCertificate, G as getProcessMeshCertificateRegistry, H as MeshCertificateRegistry, I as revokeMeshCertificate, J as processMeshCrl, K as setProcessMeshCertificateRegistry, L as getProcessMeshTlsListenerState, M as isProcessVerifiedMeshPeer, N as onProcessNodeRegistered, O as dropProcessPeer, P as setProcessMeshPeerTransportLookup, Q as caFingerprint, R as openMeshTlsWhenRevocationsLoaded, S as verifyMembershipAnswer, St as parseOriginList, SystemConfigAddon, T as Errors, Tt as normalizeIp, U as RENEWAL_ABANDONED, V as MESH_NODE_CERTIFICATES_COLUMNS, W as describeMeshLeaf, X as getProcessMeshCaState, Y as MeshCaKeeper, Z as requireProcessMeshCa, _ as signPairingProof, _t as verifyAgentUiUnlockTicket, a as hubHostFromMeshAddress, at as issueMeshLeafForNode, b as MembershipResponder, bt as isInsecureOrigin, c as PAIRING_MAX_SESSIONS, ct as AGENT_DASHBOARD_ORIGINS_FIELD, d as PAIRING_PROTOCOL, dt as AGENT_UI_UNLOCK_USE, et as createMeshCsrPem, f as PAIRING_TTL_MS, ft as AGENT_UI_UNLOCK_VERSION, g as keyFingerprintShort, gt as parseAgentDashboardOrigins, h as describeCsr, ht as mintAgentUiUnlockTicket, i as AgentPairing, it as isValidAgentNodeId, j as getProcessPeerLeaf, k as emitProcessNodeRegistered, l as PAIRING_PATHS, lt as AGENT_UI_UNLOCK_TTL_MS, m as computePairingSas, mt as isAllowedAgentDashboardReturnTo, n as HubPairing, nt as generateMeshCa, o as PAIRING_CODE_DIGITS, ot as issueMeshLeafFromCsr, p as computePairingCommitment, pt as UnlockTicketJtiStore, q as MeshCrl, r as PairingHttpError, rt as generateMeshKeyPair, s as PAIRING_MAX_CODE_ATTEMPTS, st as loadMeshCa, tt as exportMeshPrivateKeyPem, u as PAIRING_PIN_DIGITS, ut as AGENT_UI_UNLOCK_TYP, v as verifyPairingProof, vt as InvalidCorsOriginError, w as TlsTcpTransporter, wt as createCidrMatcher, x as signMembershipProof, xt as normalizeOrigin, y as MEMBERSHIP_PATHS, yt as OPAQUE_ORIGIN, z as setProcessMeshTlsListenerState } from "./builtins/system-config/system-config.addon.mjs";
|
|
36
36
|
import "./builtins/system-config/index.mjs";
|
|
37
37
|
import { WinstonDestination, WinstonLoggingAddon } from "./builtins/winston-logging/index.mjs";
|
|
38
|
-
import { C as isModelDownloaded, E as setHuggingFaceReachabilityObserver, T as revisionWeightUrl, _ as downloadFile, a as startEventLoopStallMonitor, b as fetchJson, c as createAuthenticatedFileServer, d as resolveFilePath, f as ModelDownloadService, g as deleteModelFromDisk, h as collectModelFiles, i as attributeStall, l as parseRangeHeader, m as adoptModelRevisions, n as STALL_REPORT_MS, o as createFileDataPlaneHandler, r as STALL_TICK_MS, s as contentTypeFor, t as CustomActionRegistry, u as parseTokenizedUrl, v as downloadModel, w as resolveFormatRevision, x as getModelFilePath, y as ensureModel } from "./custom-action-registry-
|
|
39
|
-
import { A as retirePreviousLocalCa, C as checkUploadedCa, D as loadTlsCert, E as ensureTlsCert, F as closeLanHttp, I as readLanHttpState, L as registerLanHttpHandler, M as allFamiliesListenHost, N as applyLanHttp, O as reissueTlsLeaf, P as bindPendingLanHttp, S as chainsToPublicRoot, T as caReplacementMarkerFile, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, c as leafFingerprintOf, d as servedHttpsLeafFingerprint, f as prepareBootTls, g as readTlsEnabled, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, k as replaceUnconstrainedLocalCa, l as registerHttpsListener, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, p as UPLOADED_CA_FILE, r as regenerateCertificate, s as clearHttpsListener, t as createCiaoPublisher, u as reloadHttpsListener, v as splitPemCertificates, w as validateUploadedTls, x as writeTlsMode, y as writeExtraSans } from "./hub-mdns-ciao-
|
|
38
|
+
import { C as isModelDownloaded, E as setHuggingFaceReachabilityObserver, T as revisionWeightUrl, _ as downloadFile, a as startEventLoopStallMonitor, b as fetchJson, c as createAuthenticatedFileServer, d as resolveFilePath, f as ModelDownloadService, g as deleteModelFromDisk, h as collectModelFiles, i as attributeStall, l as parseRangeHeader, m as adoptModelRevisions, n as STALL_REPORT_MS, o as createFileDataPlaneHandler, r as STALL_TICK_MS, s as contentTypeFor, t as CustomActionRegistry, u as parseTokenizedUrl, v as downloadModel, w as resolveFormatRevision, x as getModelFilePath, y as ensureModel } from "./custom-action-registry-oHl1xltx.mjs";
|
|
39
|
+
import { A as retirePreviousLocalCa, C as checkUploadedCa, D as loadTlsCert, E as ensureTlsCert, F as closeLanHttp, I as readLanHttpState, L as registerLanHttpHandler, M as allFamiliesListenHost, N as applyLanHttp, O as reissueTlsLeaf, P as bindPendingLanHttp, S as chainsToPublicRoot, T as caReplacementMarkerFile, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, c as leafFingerprintOf, d as servedHttpsLeafFingerprint, f as prepareBootTls, g as readTlsEnabled, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, k as replaceUnconstrainedLocalCa, l as registerHttpsListener, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, p as UPLOADED_CA_FILE, r as regenerateCertificate, s as clearHttpsListener, t as createCiaoPublisher, u as reloadHttpsListener, v as splitPemCertificates, w as validateUploadedTls, x as writeTlsMode, y as writeExtraSans } from "./hub-mdns-ciao-i31GIYWP.mjs";
|
|
40
40
|
import { n as getPlatformKeychainKey, r as setPlatformKeychainKey, t as clearPlatformKeychainKey } from "./platform-key-source-BWlq0jjn.mjs";
|
|
41
41
|
import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-Di9daRwI.mjs";
|
|
42
|
-
import { _ as backupRecordStoresOf, c as BackupDecryptError, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, h as readBackupEncryptionHeader, l as BackupKeyFormatError, r as prepareRestoreArchive, s as SystemBackupService, t as BackupKeyRequiredError, u as BackupKeyMismatchError } from "./restore-archive-
|
|
43
|
-
import { r as nodeCoralFs, t as classifyCoralAccelerator } from "./coral-accelerators-
|
|
42
|
+
import { _ as backupRecordStoresOf, c as BackupDecryptError, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, h as readBackupEncryptionHeader, l as BackupKeyFormatError, r as prepareRestoreArchive, s as SystemBackupService, t as BackupKeyRequiredError, u as BackupKeyMismatchError } from "./restore-archive-nWi73iy0.mjs";
|
|
43
|
+
import { r as nodeCoralFs, t as classifyCoralAccelerator } from "./coral-accelerators-DBlgWB8k.mjs";
|
|
44
44
|
import { z } from "zod";
|
|
45
45
|
import * as crypto$1 from "node:crypto";
|
|
46
46
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
@@ -55,7 +55,7 @@ import { BOOT_RECOVERY_BACKOFF_MS, CALLER_STAMPED_CAPABILITIES, DATAPLANE_SECRET
|
|
|
55
55
|
import * as os$1 from "node:os";
|
|
56
56
|
import { tmpdir } from "node:os";
|
|
57
57
|
import { pathToFileURL } from "node:url";
|
|
58
|
-
import * as fs from "node:fs";
|
|
58
|
+
import * as fs$1 from "node:fs";
|
|
59
59
|
import { accessSync, constants, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync } from "node:fs";
|
|
60
60
|
import { execFile, spawn } from "node:child_process";
|
|
61
61
|
import { once } from "node:events";
|
|
@@ -5113,7 +5113,7 @@ var PythonEnvManager = class {
|
|
|
5113
5113
|
async ensure(options) {
|
|
5114
5114
|
const probe = await this.probe();
|
|
5115
5115
|
if (!probe.available || !probe.path) throw userError("system.python-required", void 0, "Python 3.10+ is required but not found on this system");
|
|
5116
|
-
if (!fs.existsSync(path$1.join(this.venvPath, "bin", "python"))) await execFileAsync$7(probe.path, [
|
|
5116
|
+
if (!fs$1.existsSync(path$1.join(this.venvPath, "bin", "python"))) await execFileAsync$7(probe.path, [
|
|
5117
5117
|
"-m",
|
|
5118
5118
|
"venv",
|
|
5119
5119
|
this.venvPath
|
|
@@ -5136,7 +5136,7 @@ var PythonEnvManager = class {
|
|
|
5136
5136
|
}
|
|
5137
5137
|
spawn(script, args) {
|
|
5138
5138
|
const venvPython = path$1.join(this.venvPath, "bin", "python");
|
|
5139
|
-
if (!fs.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
|
|
5139
|
+
if (!fs$1.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
|
|
5140
5140
|
return spawn(venvPython, [script, ...args]);
|
|
5141
5141
|
}
|
|
5142
5142
|
};
|
|
@@ -5488,20 +5488,20 @@ var StorageManager = class {
|
|
|
5488
5488
|
const basePath = this.locationManager.getBackend(mappedName).basePath;
|
|
5489
5489
|
location.files = {
|
|
5490
5490
|
async readFile(p) {
|
|
5491
|
-
return fs.promises.readFile(path$1.join(basePath, p));
|
|
5491
|
+
return fs$1.promises.readFile(path$1.join(basePath, p));
|
|
5492
5492
|
},
|
|
5493
5493
|
async writeFile(p, data) {
|
|
5494
5494
|
const full = path$1.join(basePath, p);
|
|
5495
|
-
await fs.promises.mkdir(path$1.dirname(full), { recursive: true });
|
|
5496
|
-
await fs.promises.writeFile(full, data);
|
|
5495
|
+
await fs$1.promises.mkdir(path$1.dirname(full), { recursive: true });
|
|
5496
|
+
await fs$1.promises.writeFile(full, data);
|
|
5497
5497
|
},
|
|
5498
5498
|
async deleteFile(p) {
|
|
5499
|
-
await fs.promises.rm(path$1.join(basePath, p), { force: true });
|
|
5499
|
+
await fs$1.promises.rm(path$1.join(basePath, p), { force: true });
|
|
5500
5500
|
},
|
|
5501
5501
|
async listFiles(prefix) {
|
|
5502
5502
|
const dir = prefix ? path$1.join(basePath, prefix) : basePath;
|
|
5503
5503
|
try {
|
|
5504
|
-
return (await fs.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
|
|
5504
|
+
return (await fs$1.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
|
|
5505
5505
|
} catch {
|
|
5506
5506
|
return [];
|
|
5507
5507
|
}
|
|
@@ -5511,7 +5511,7 @@ var StorageManager = class {
|
|
|
5511
5511
|
},
|
|
5512
5512
|
async exists(p) {
|
|
5513
5513
|
try {
|
|
5514
|
-
await fs.promises.access(path$1.join(basePath, p));
|
|
5514
|
+
await fs$1.promises.access(path$1.join(basePath, p));
|
|
5515
5515
|
return true;
|
|
5516
5516
|
} catch {
|
|
5517
5517
|
return false;
|
|
@@ -6328,7 +6328,7 @@ var TRADITIONAL_NATIVE_PACKAGES = ["better-sqlite3"];
|
|
|
6328
6328
|
function hasDotNode(dir, maxDepth) {
|
|
6329
6329
|
let entries;
|
|
6330
6330
|
try {
|
|
6331
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
6331
|
+
entries = fs$1.readdirSync(dir, { withFileTypes: true });
|
|
6332
6332
|
} catch {
|
|
6333
6333
|
return false;
|
|
6334
6334
|
}
|
|
@@ -6339,7 +6339,7 @@ function hasDotNode(dir, maxDepth) {
|
|
|
6339
6339
|
}
|
|
6340
6340
|
/** Locate the bundled `prebuild-install` bin.js inside the staged closure. */
|
|
6341
6341
|
function resolvePrebuildInstallBin(closureDir, moduleDir) {
|
|
6342
|
-
return [path$1.join(moduleDir, "node_modules", "prebuild-install", "bin.js"), path$1.join(closureDir, "node_modules", "prebuild-install", "bin.js")].find((c) => fs.existsSync(c)) ?? null;
|
|
6342
|
+
return [path$1.join(moduleDir, "node_modules", "prebuild-install", "bin.js"), path$1.join(closureDir, "node_modules", "prebuild-install", "bin.js")].find((c) => fs$1.existsSync(c)) ?? null;
|
|
6343
6343
|
}
|
|
6344
6344
|
/**
|
|
6345
6345
|
* Default fetcher: run the closure's own `prebuild-install` under the CURRENT
|
|
@@ -6392,7 +6392,7 @@ async function ensureNativePrebuilds(closureDir, options) {
|
|
|
6392
6392
|
const fetched = [];
|
|
6393
6393
|
for (const pkg of packages) {
|
|
6394
6394
|
const moduleDir = path$1.join(nm, pkg);
|
|
6395
|
-
if (!fs.existsSync(moduleDir)) continue;
|
|
6395
|
+
if (!fs$1.existsSync(moduleDir)) continue;
|
|
6396
6396
|
if (hasDotNode(moduleDir, 4)) continue;
|
|
6397
6397
|
options.logger.warn("staged closure native prebuild missing — fetching for running ABI", { meta: {
|
|
6398
6398
|
pkg,
|
|
@@ -6455,12 +6455,12 @@ async function ensureNativePrebuilds(closureDir, options) {
|
|
|
6455
6455
|
function replantFromBundled(srcModuleDir, dstModuleDir, hasNative) {
|
|
6456
6456
|
if (!hasNative(srcModuleDir)) return false;
|
|
6457
6457
|
try {
|
|
6458
|
-
fs.rmSync(dstModuleDir, {
|
|
6458
|
+
fs$1.rmSync(dstModuleDir, {
|
|
6459
6459
|
recursive: true,
|
|
6460
6460
|
force: true
|
|
6461
6461
|
});
|
|
6462
|
-
fs.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
|
|
6463
|
-
fs.cpSync(srcModuleDir, dstModuleDir, {
|
|
6462
|
+
fs$1.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
|
|
6463
|
+
fs$1.cpSync(srcModuleDir, dstModuleDir, {
|
|
6464
6464
|
recursive: true,
|
|
6465
6465
|
dereference: true
|
|
6466
6466
|
});
|
|
@@ -6489,7 +6489,7 @@ async function ensureAddonNativePrebuilds(addonDir, options) {
|
|
|
6489
6489
|
const missing = [];
|
|
6490
6490
|
for (const pkg of packages) {
|
|
6491
6491
|
const moduleDir = path$1.join(nm, pkg);
|
|
6492
|
-
if (!fs.existsSync(moduleDir)) continue;
|
|
6492
|
+
if (!fs$1.existsSync(moduleDir)) continue;
|
|
6493
6493
|
if (hasNative(moduleDir)) {
|
|
6494
6494
|
results.push({
|
|
6495
6495
|
pkg,
|
|
@@ -6588,7 +6588,7 @@ async function defaultDownloadTarball(url, destTgz) {
|
|
|
6588
6588
|
const res = await fetch(url);
|
|
6589
6589
|
if (!res.ok || !res.body) throw new Error(`HTTP ${res.status} downloading ${url}`);
|
|
6590
6590
|
const bytes = Buffer.from(await res.arrayBuffer());
|
|
6591
|
-
await fs.promises.writeFile(destTgz, bytes);
|
|
6591
|
+
await fs$1.promises.writeFile(destTgz, bytes);
|
|
6592
6592
|
}
|
|
6593
6593
|
async function defaultExtractTarball(tgzPath, destDir) {
|
|
6594
6594
|
await execFileAsync$5("tar", [
|
|
@@ -6674,7 +6674,7 @@ async function resolveUncached(options) {
|
|
|
6674
6674
|
argsPrefix: []
|
|
6675
6675
|
};
|
|
6676
6676
|
const cliPath = bootstrappedCliPath(options.cacheDir);
|
|
6677
|
-
if (fs.existsSync(cliPath)) {
|
|
6677
|
+
if (fs$1.existsSync(cliPath)) {
|
|
6678
6678
|
options.logger.info("system npm unavailable — using bootstrapped npm", { meta: { cliPath } });
|
|
6679
6679
|
return {
|
|
6680
6680
|
command: process.execPath,
|
|
@@ -6686,12 +6686,12 @@ async function resolveUncached(options) {
|
|
|
6686
6686
|
const registry = (options.registry ?? DEFAULT_REGISTRY).replace(/\/+$/, "");
|
|
6687
6687
|
const tarballUrl = tarballUrlOf(await (options.fetchJson ?? defaultFetchJson)(`${registry}/npm/latest`));
|
|
6688
6688
|
if (!tarballUrl) throw new Error(`registry metadata for 'npm' carries no dist.tarball (${registry})`);
|
|
6689
|
-
await fs.promises.mkdir(options.cacheDir, { recursive: true });
|
|
6689
|
+
await fs$1.promises.mkdir(options.cacheDir, { recursive: true });
|
|
6690
6690
|
const tgzPath = path$1.join(options.cacheDir, "npm-bootstrap.tgz");
|
|
6691
6691
|
await (options.downloadTarball ?? defaultDownloadTarball)(tarballUrl, tgzPath);
|
|
6692
6692
|
await (options.extractTarball ?? defaultExtractTarball)(tgzPath, options.cacheDir);
|
|
6693
|
-
await fs.promises.rm(tgzPath, { force: true });
|
|
6694
|
-
if (!fs.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
|
|
6693
|
+
await fs$1.promises.rm(tgzPath, { force: true });
|
|
6694
|
+
if (!fs$1.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
|
|
6695
6695
|
options.logger.info("npm bootstrapped", { meta: { cliPath } });
|
|
6696
6696
|
return {
|
|
6697
6697
|
command: process.execPath,
|
|
@@ -6757,7 +6757,7 @@ function readOwningPackageVersion(entryPath) {
|
|
|
6757
6757
|
let dir = path$1.dirname(entryPath);
|
|
6758
6758
|
for (let hop = 0; hop < PACKAGE_JSON_LOOKUP_DEPTH; hop++) {
|
|
6759
6759
|
try {
|
|
6760
|
-
const version = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
|
|
6760
|
+
const version = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
|
|
6761
6761
|
if (typeof version === "string" && version.length > 0) return version;
|
|
6762
6762
|
} catch {}
|
|
6763
6763
|
const parent = path$1.dirname(dir);
|
|
@@ -6801,14 +6801,14 @@ function readOwningPackageVersion(entryPath) {
|
|
|
6801
6801
|
function addonModuleCacheKey(entryPath) {
|
|
6802
6802
|
let stat;
|
|
6803
6803
|
try {
|
|
6804
|
-
stat = fs.statSync(entryPath);
|
|
6804
|
+
stat = fs$1.statSync(entryPath);
|
|
6805
6805
|
} catch {
|
|
6806
6806
|
return null;
|
|
6807
6807
|
}
|
|
6808
6808
|
const version = readOwningPackageVersion(entryPath) ?? `m${stat.mtimeMs}`;
|
|
6809
6809
|
let content;
|
|
6810
6810
|
try {
|
|
6811
|
-
content = createHash("sha1").update(fs.readFileSync(entryPath)).digest("hex").slice(0, 16);
|
|
6811
|
+
content = createHash("sha1").update(fs$1.readFileSync(entryPath)).digest("hex").slice(0, 16);
|
|
6812
6812
|
} catch {
|
|
6813
6813
|
content = `m${stat.mtimeMs}s${stat.size}`;
|
|
6814
6814
|
}
|
|
@@ -6912,14 +6912,14 @@ var AddonLoader = class {
|
|
|
6912
6912
|
* BUILTINS from the active closure, not the (now-inert) addons-dir copy, so
|
|
6913
6913
|
* the addons-dir `@camstack/server/system` must NOT be double-loaded here. */
|
|
6914
6914
|
async loadFromDirectory(addonsDir, skipPackages = []) {
|
|
6915
|
-
if (!fs.existsSync(addonsDir)) return;
|
|
6915
|
+
if (!fs$1.existsSync(addonsDir)) return;
|
|
6916
6916
|
const skip = new Set(skipPackages);
|
|
6917
|
-
const entries = fs.readdirSync(addonsDir, { withFileTypes: true });
|
|
6917
|
+
const entries = fs$1.readdirSync(addonsDir, { withFileTypes: true });
|
|
6918
6918
|
for (const entry of entries) {
|
|
6919
6919
|
if (!isDirectoryEntry(entry, addonsDir)) continue;
|
|
6920
6920
|
if (entry.name.startsWith("@")) {
|
|
6921
6921
|
const scopeDir = path$1.join(addonsDir, entry.name);
|
|
6922
|
-
const scopeEntries = fs.readdirSync(scopeDir, { withFileTypes: true });
|
|
6922
|
+
const scopeEntries = fs$1.readdirSync(scopeDir, { withFileTypes: true });
|
|
6923
6923
|
for (const scopeEntry of scopeEntries) {
|
|
6924
6924
|
if (!isDirectoryEntry(scopeEntry, scopeDir)) continue;
|
|
6925
6925
|
if (skip.has(`${entry.name}/${scopeEntry.name}`)) continue;
|
|
@@ -6933,7 +6933,7 @@ var AddonLoader = class {
|
|
|
6933
6933
|
}
|
|
6934
6934
|
async tryLoadAddon(addonDir) {
|
|
6935
6935
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
6936
|
-
if (!fs.existsSync(pkgJsonPath)) return;
|
|
6936
|
+
if (!fs$1.existsSync(pkgJsonPath)) return;
|
|
6937
6937
|
try {
|
|
6938
6938
|
await this.loadFromAddonDir(addonDir);
|
|
6939
6939
|
} catch (err) {
|
|
@@ -6951,7 +6951,7 @@ var AddonLoader = class {
|
|
|
6951
6951
|
/** Load addon from a specific directory (package.json + dist/) */
|
|
6952
6952
|
async loadFromAddonDir(addonDir) {
|
|
6953
6953
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
6954
|
-
const pkgJson = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
6954
|
+
const pkgJson = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
6955
6955
|
const packageNameRaw = pkgJson["name"];
|
|
6956
6956
|
const packageName = typeof packageNameRaw === "string" ? packageNameRaw : "";
|
|
6957
6957
|
const packageVersionRaw = pkgJson["version"];
|
|
@@ -6999,7 +6999,7 @@ var AddonLoader = class {
|
|
|
6999
6999
|
}
|
|
7000
7000
|
const entryFile = declaration.entry.replace(/^\.\//, "").replace(/^src\//, "dist/").replace(/\.ts$/, ".js");
|
|
7001
7001
|
let entryPath = path$1.resolve(addonDir, entryFile);
|
|
7002
|
-
if (!fs.existsSync(entryPath)) {
|
|
7002
|
+
if (!fs$1.existsSync(entryPath)) {
|
|
7003
7003
|
const base = entryPath.replace(/\.(js|cjs|mjs)$/, "");
|
|
7004
7004
|
entryPath = [
|
|
7005
7005
|
`${base}.cjs`,
|
|
@@ -7008,9 +7008,9 @@ var AddonLoader = class {
|
|
|
7008
7008
|
path$1.resolve(addonDir, "dist", "index.cjs"),
|
|
7009
7009
|
path$1.resolve(addonDir, "dist", "index.mjs"),
|
|
7010
7010
|
path$1.resolve(addonDir, declaration.entry)
|
|
7011
|
-
].find((p) => fs.existsSync(p)) ?? entryPath;
|
|
7011
|
+
].find((p) => fs$1.existsSync(p)) ?? entryPath;
|
|
7012
7012
|
}
|
|
7013
|
-
if (!fs.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
|
|
7013
|
+
if (!fs$1.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
|
|
7014
7014
|
const modUnknown = await importAddonModuleFresh(entryPath);
|
|
7015
7015
|
const mod = isRecord$4(modUnknown) ? modUnknown : {};
|
|
7016
7016
|
const AddonClass = resolveAddonClass(mod);
|
|
@@ -7122,7 +7122,7 @@ function isDirectoryEntry(entry, parentDir) {
|
|
|
7122
7122
|
if (entry.name.startsWith(".")) return false;
|
|
7123
7123
|
if (entry.isDirectory()) return true;
|
|
7124
7124
|
if (entry.isSymbolicLink()) try {
|
|
7125
|
-
return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
7125
|
+
return fs$1.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
7126
7126
|
} catch {
|
|
7127
7127
|
return false;
|
|
7128
7128
|
}
|
|
@@ -7216,7 +7216,7 @@ var execFileAsync$4 = promisify(execFile);
|
|
|
7216
7216
|
* Single source of truth — replaces scattered mkdirSync calls.
|
|
7217
7217
|
*/
|
|
7218
7218
|
function ensureDir(dirPath) {
|
|
7219
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
|
7219
|
+
fs$1.mkdirSync(dirPath, { recursive: true });
|
|
7220
7220
|
}
|
|
7221
7221
|
/**
|
|
7222
7222
|
* Copy a directory recursively — ASYNC so it never blocks the event loop.
|
|
@@ -7229,7 +7229,7 @@ function ensureDir(dirPath) {
|
|
|
7229
7229
|
* `fs.promises.cp` keeps the I/O off the event loop. (Node ≥18 stable.)
|
|
7230
7230
|
*/
|
|
7231
7231
|
async function copyDirRecursive(src, dest) {
|
|
7232
|
-
await fs.promises.cp(src, dest, {
|
|
7232
|
+
await fs$1.promises.cp(src, dest, {
|
|
7233
7233
|
recursive: true,
|
|
7234
7234
|
force: true
|
|
7235
7235
|
});
|
|
@@ -7334,13 +7334,13 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
7334
7334
|
if (typeof fileEntry !== "string") continue;
|
|
7335
7335
|
if (fileEntry === "dist" || fileEntry.includes("*")) continue;
|
|
7336
7336
|
const srcPath = path$1.join(sourceDir, fileEntry);
|
|
7337
|
-
if (!fs.existsSync(srcPath)) continue;
|
|
7337
|
+
if (!fs$1.existsSync(srcPath)) continue;
|
|
7338
7338
|
const destPath = path$1.join(destDir, fileEntry);
|
|
7339
|
-
const stat = await fs.promises.stat(srcPath);
|
|
7339
|
+
const stat = await fs$1.promises.stat(srcPath);
|
|
7340
7340
|
if (stat.isDirectory()) await copyDirRecursive(srcPath, destPath);
|
|
7341
7341
|
else if (stat.isFile()) {
|
|
7342
7342
|
ensureDir(path$1.dirname(destPath));
|
|
7343
|
-
await fs.promises.copyFile(srcPath, destPath);
|
|
7343
|
+
await fs$1.promises.copyFile(srcPath, destPath);
|
|
7344
7344
|
}
|
|
7345
7345
|
}
|
|
7346
7346
|
}
|
|
@@ -7351,10 +7351,10 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
7351
7351
|
function isSourceNewer(packageDir) {
|
|
7352
7352
|
const srcDir = path$1.join(packageDir, "src");
|
|
7353
7353
|
const distDir = path$1.join(packageDir, "dist");
|
|
7354
|
-
if (!fs.existsSync(srcDir) || !fs.existsSync(distDir)) return true;
|
|
7354
|
+
if (!fs$1.existsSync(srcDir) || !fs$1.existsSync(distDir)) return true;
|
|
7355
7355
|
try {
|
|
7356
|
-
const distMtime = fs.statSync(distDir).mtimeMs;
|
|
7357
|
-
const entries = fs.readdirSync(srcDir, {
|
|
7356
|
+
const distMtime = fs$1.statSync(distDir).mtimeMs;
|
|
7357
|
+
const entries = fs$1.readdirSync(srcDir, {
|
|
7358
7358
|
withFileTypes: true,
|
|
7359
7359
|
recursive: true
|
|
7360
7360
|
});
|
|
@@ -7362,7 +7362,7 @@ function isSourceNewer(packageDir) {
|
|
|
7362
7362
|
if (!entry.isFile()) continue;
|
|
7363
7363
|
const parentDir = entry.parentPath ?? String(Reflect.get(entry, "path") ?? "");
|
|
7364
7364
|
const filePath = path$1.join(parentDir, entry.name);
|
|
7365
|
-
if (fs.statSync(filePath).mtimeMs > distMtime) return true;
|
|
7365
|
+
if (fs$1.statSync(filePath).mtimeMs > distMtime) return true;
|
|
7366
7366
|
}
|
|
7367
7367
|
return false;
|
|
7368
7368
|
} catch {
|
|
@@ -7379,7 +7379,7 @@ function isSourceNewer(packageDir) {
|
|
|
7379
7379
|
* `copyDirRecursive` for the wedge this prevents.
|
|
7380
7380
|
*/
|
|
7381
7381
|
async function installPackageFromNpm(packageName, targetDir) {
|
|
7382
|
-
const tmpDir = await fs.promises.mkdtemp(path$1.join(os$1.tmpdir(), "camstack-install-"));
|
|
7382
|
+
const tmpDir = await fs$1.promises.mkdtemp(path$1.join(os$1.tmpdir(), "camstack-install-"));
|
|
7383
7383
|
try {
|
|
7384
7384
|
const { stdout } = await execFileAsync$4("npm", [
|
|
7385
7385
|
"pack",
|
|
@@ -7402,21 +7402,21 @@ async function installPackageFromNpm(packageName, targetDir) {
|
|
|
7402
7402
|
extractDir
|
|
7403
7403
|
], { timeout: 3e4 });
|
|
7404
7404
|
const packageSubDir = path$1.join(extractDir, "package");
|
|
7405
|
-
const srcPkgJsonDir = fs.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
|
|
7406
|
-
await fs.promises.rm(targetDir, {
|
|
7405
|
+
const srcPkgJsonDir = fs$1.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
|
|
7406
|
+
await fs$1.promises.rm(targetDir, {
|
|
7407
7407
|
recursive: true,
|
|
7408
7408
|
force: true
|
|
7409
7409
|
});
|
|
7410
7410
|
ensureDir(targetDir);
|
|
7411
|
-
await fs.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
|
|
7411
|
+
await fs$1.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
|
|
7412
7412
|
const distSrc = path$1.join(srcPkgJsonDir, "dist");
|
|
7413
|
-
if (fs.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
|
|
7413
|
+
if (fs$1.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
|
|
7414
7414
|
try {
|
|
7415
|
-
const npmPkg = asJsonObject$1(parseJsonUnknown(await fs.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
7415
|
+
const npmPkg = asJsonObject$1(parseJsonUnknown(await fs$1.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
7416
7416
|
if (npmPkg) await copyExtraFileDirs(npmPkg, srcPkgJsonDir, targetDir);
|
|
7417
7417
|
} catch {}
|
|
7418
7418
|
} finally {
|
|
7419
|
-
await fs.promises.rm(tmpDir, {
|
|
7419
|
+
await fs$1.promises.rm(tmpDir, {
|
|
7420
7420
|
recursive: true,
|
|
7421
7421
|
force: true
|
|
7422
7422
|
});
|
|
@@ -7441,7 +7441,7 @@ function packageDirName$1(declaredName) {
|
|
|
7441
7441
|
}
|
|
7442
7442
|
function isDirLike$1(p) {
|
|
7443
7443
|
try {
|
|
7444
|
-
return fs.statSync(p).isDirectory();
|
|
7444
|
+
return fs$1.statSync(p).isDirectory();
|
|
7445
7445
|
} catch {
|
|
7446
7446
|
return false;
|
|
7447
7447
|
}
|
|
@@ -7459,12 +7459,12 @@ var AddonManifest = class {
|
|
|
7459
7459
|
*/
|
|
7460
7460
|
read() {
|
|
7461
7461
|
if (this.cache != null) return this.cache;
|
|
7462
|
-
if (!fs.existsSync(this.manifestPath)) {
|
|
7462
|
+
if (!fs$1.existsSync(this.manifestPath)) {
|
|
7463
7463
|
this.cache = this.empty();
|
|
7464
7464
|
return this.cache;
|
|
7465
7465
|
}
|
|
7466
7466
|
try {
|
|
7467
|
-
const raw = fs.readFileSync(this.manifestPath, "utf-8");
|
|
7467
|
+
const raw = fs$1.readFileSync(this.manifestPath, "utf-8");
|
|
7468
7468
|
const parsed = JSON.parse(raw);
|
|
7469
7469
|
if (parsed.version !== MANIFEST_VERSION) {
|
|
7470
7470
|
process.stderr.write(`[AddonManifest] schema mismatch (file=${parsed.version} vs runtime=${MANIFEST_VERSION}); starting empty\n`);
|
|
@@ -7485,13 +7485,13 @@ var AddonManifest = class {
|
|
|
7485
7485
|
* a half-written file.
|
|
7486
7486
|
*/
|
|
7487
7487
|
write(manifest) {
|
|
7488
|
-
fs.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
|
|
7488
|
+
fs$1.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
|
|
7489
7489
|
const tmp = `${this.manifestPath}.tmp.${process.pid}.${Date.now()}`;
|
|
7490
|
-
fs.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
|
|
7490
|
+
fs$1.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
|
|
7491
7491
|
encoding: "utf-8",
|
|
7492
7492
|
mode: 384
|
|
7493
7493
|
});
|
|
7494
|
-
fs.renameSync(tmp, this.manifestPath);
|
|
7494
|
+
fs$1.renameSync(tmp, this.manifestPath);
|
|
7495
7495
|
this.cache = manifest;
|
|
7496
7496
|
}
|
|
7497
7497
|
/** Lookup a single addon's manifest entry, or `null` if not tracked. */
|
|
@@ -7566,22 +7566,22 @@ var AddonManifest = class {
|
|
|
7566
7566
|
* exactly what moved. Returns the total number of changes.
|
|
7567
7567
|
*/
|
|
7568
7568
|
reconcileFromDisk(addonsDir, onChange) {
|
|
7569
|
-
if (!fs.existsSync(addonsDir)) return 0;
|
|
7569
|
+
if (!fs$1.existsSync(addonsDir)) return 0;
|
|
7570
7570
|
const m = this.read();
|
|
7571
7571
|
let changes = 0;
|
|
7572
7572
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7573
7573
|
/** Package name → version, for every ADDON package actually installed. */
|
|
7574
7574
|
const onDisk = /* @__PURE__ */ new Map();
|
|
7575
|
-
for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7575
|
+
for (const scope of fs$1.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7576
7576
|
if (!scope.name.startsWith("@") || !isDirLike$1(path$1.join(addonsDir, scope.name))) continue;
|
|
7577
7577
|
const scopeDir = path$1.join(addonsDir, scope.name);
|
|
7578
|
-
for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7578
|
+
for (const pkg of fs$1.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7579
7579
|
if (!isDirLike$1(path$1.join(scopeDir, pkg.name))) continue;
|
|
7580
7580
|
const pkgJsonPath = path$1.join(scopeDir, pkg.name, "package.json");
|
|
7581
|
-
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
7581
|
+
if (!fs$1.existsSync(pkgJsonPath)) continue;
|
|
7582
7582
|
let pkgJson;
|
|
7583
7583
|
try {
|
|
7584
|
-
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
7584
|
+
const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
|
|
7585
7585
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
7586
7586
|
pkgJson = parsed;
|
|
7587
7587
|
} catch {
|
|
@@ -7652,28 +7652,28 @@ var AddonManifest = class {
|
|
|
7652
7652
|
migrateFromInstallSourceMarkers(addonsDir) {
|
|
7653
7653
|
const m = this.read();
|
|
7654
7654
|
if (Object.keys(m.addons).length > 0) return 0;
|
|
7655
|
-
if (!fs.existsSync(addonsDir)) return 0;
|
|
7655
|
+
if (!fs$1.existsSync(addonsDir)) return 0;
|
|
7656
7656
|
let migrated = 0;
|
|
7657
7657
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7658
|
-
for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7658
|
+
for (const scope of fs$1.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7659
7659
|
if (!scope.isDirectory() || !scope.name.startsWith("@")) continue;
|
|
7660
7660
|
const scopeDir = path$1.join(addonsDir, scope.name);
|
|
7661
|
-
for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7661
|
+
for (const pkg of fs$1.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7662
7662
|
if (!pkg.isDirectory()) continue;
|
|
7663
7663
|
const pkgDir = path$1.join(scopeDir, pkg.name);
|
|
7664
7664
|
const markerPath = path$1.join(pkgDir, ".install-source");
|
|
7665
7665
|
const pkgJsonPath = path$1.join(pkgDir, "package.json");
|
|
7666
|
-
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
7666
|
+
if (!fs$1.existsSync(pkgJsonPath)) continue;
|
|
7667
7667
|
let pkgJson;
|
|
7668
7668
|
try {
|
|
7669
|
-
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
7669
|
+
const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
|
|
7670
7670
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
7671
7671
|
pkgJson = parsed;
|
|
7672
7672
|
} catch {
|
|
7673
7673
|
continue;
|
|
7674
7674
|
}
|
|
7675
7675
|
if (!pkgJson.name || !pkgJson.version) continue;
|
|
7676
|
-
const source = fs.existsSync(markerPath) ? fs.readFileSync(markerPath, "utf-8").trim() : "bundled";
|
|
7676
|
+
const source = fs$1.existsSync(markerPath) ? fs$1.readFileSync(markerPath, "utf-8").trim() : "bundled";
|
|
7677
7677
|
m.addons[pkgJson.name] = {
|
|
7678
7678
|
name: pkgJson.name,
|
|
7679
7679
|
version: pkgJson.version,
|
|
@@ -7877,7 +7877,7 @@ function planClosureDedupe(input) {
|
|
|
7877
7877
|
function readTreeManifest(pkgJsonPath) {
|
|
7878
7878
|
let raw;
|
|
7879
7879
|
try {
|
|
7880
|
-
raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
|
|
7880
|
+
raw = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8")));
|
|
7881
7881
|
} catch {
|
|
7882
7882
|
return null;
|
|
7883
7883
|
}
|
|
@@ -7902,7 +7902,7 @@ function readTreeManifest(pkgJsonPath) {
|
|
|
7902
7902
|
function listTopLevelEntries(nodeModulesDir) {
|
|
7903
7903
|
let entries;
|
|
7904
7904
|
try {
|
|
7905
|
-
entries = fs.readdirSync(nodeModulesDir, { withFileTypes: true });
|
|
7905
|
+
entries = fs$1.readdirSync(nodeModulesDir, { withFileTypes: true });
|
|
7906
7906
|
} catch {
|
|
7907
7907
|
return [];
|
|
7908
7908
|
}
|
|
@@ -7912,7 +7912,7 @@ function listTopLevelEntries(nodeModulesDir) {
|
|
|
7912
7912
|
if (entry.name.startsWith("@")) {
|
|
7913
7913
|
let inner;
|
|
7914
7914
|
try {
|
|
7915
|
-
inner = fs.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
|
|
7915
|
+
inner = fs$1.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
|
|
7916
7916
|
} catch {
|
|
7917
7917
|
continue;
|
|
7918
7918
|
}
|
|
@@ -7945,14 +7945,14 @@ function collectAddonTreeState(addonDir) {
|
|
|
7945
7945
|
const entryDir = path$1.join(nodeModulesDir, name);
|
|
7946
7946
|
let isLink = false;
|
|
7947
7947
|
try {
|
|
7948
|
-
isLink = fs.lstatSync(entryDir).isSymbolicLink();
|
|
7948
|
+
isLink = fs$1.lstatSync(entryDir).isSymbolicLink();
|
|
7949
7949
|
} catch {
|
|
7950
7950
|
continue;
|
|
7951
7951
|
}
|
|
7952
7952
|
if (isLink) {
|
|
7953
7953
|
let target = "";
|
|
7954
7954
|
try {
|
|
7955
|
-
target = fs.readlinkSync(entryDir);
|
|
7955
|
+
target = fs$1.readlinkSync(entryDir);
|
|
7956
7956
|
} catch {}
|
|
7957
7957
|
existingLinks.push({
|
|
7958
7958
|
name,
|
|
@@ -7966,7 +7966,7 @@ function collectAddonTreeState(addonDir) {
|
|
|
7966
7966
|
version: manifest.version
|
|
7967
7967
|
});
|
|
7968
7968
|
for (const [depName, range] of manifest.ranges) {
|
|
7969
|
-
if (fs.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
|
|
7969
|
+
if (fs$1.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
|
|
7970
7970
|
addRange(depName, range);
|
|
7971
7971
|
}
|
|
7972
7972
|
}
|
|
@@ -7996,7 +7996,7 @@ function resolveClosureNodeModulesDir(explicitDir) {
|
|
|
7996
7996
|
const frameworkDir = explicitDir ?? process.env["CAMSTACK_FRAMEWORK_DIR"];
|
|
7997
7997
|
if (frameworkDir === void 0 || frameworkDir.length === 0) return null;
|
|
7998
7998
|
const nodeModulesDir = explicitDir ?? path$1.join(frameworkDir, "node_modules");
|
|
7999
|
-
return fs.existsSync(nodeModulesDir) ? nodeModulesDir : null;
|
|
7999
|
+
return fs$1.existsSync(nodeModulesDir) ? nodeModulesDir : null;
|
|
8000
8000
|
}
|
|
8001
8001
|
function symlinkType() {
|
|
8002
8002
|
return process.platform === "win32" ? "junction" : "dir";
|
|
@@ -8015,10 +8015,10 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
|
|
|
8015
8015
|
const nodeModulesDir = path$1.join(addonDir, "node_modules");
|
|
8016
8016
|
const probePath = path$1.join(nodeModulesDir, ".closure-link-probe");
|
|
8017
8017
|
try {
|
|
8018
|
-
fs.mkdirSync(nodeModulesDir, { recursive: true });
|
|
8019
|
-
fs.rmSync(probePath, { force: true });
|
|
8020
|
-
fs.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
|
|
8021
|
-
fs.rmSync(probePath, { force: true });
|
|
8018
|
+
fs$1.mkdirSync(nodeModulesDir, { recursive: true });
|
|
8019
|
+
fs$1.rmSync(probePath, { force: true });
|
|
8020
|
+
fs$1.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
|
|
8021
|
+
fs$1.rmSync(probePath, { force: true });
|
|
8022
8022
|
} catch (err) {
|
|
8023
8023
|
logger.warn("closure dedupe skipped — symlinks unavailable on this volume", { meta: {
|
|
8024
8024
|
addonDir,
|
|
@@ -8040,12 +8040,12 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
|
|
|
8040
8040
|
}
|
|
8041
8041
|
const entryDir = path$1.join(nodeModulesDir, link.name);
|
|
8042
8042
|
try {
|
|
8043
|
-
fs.rmSync(entryDir, {
|
|
8043
|
+
fs$1.rmSync(entryDir, {
|
|
8044
8044
|
recursive: true,
|
|
8045
8045
|
force: true
|
|
8046
8046
|
});
|
|
8047
|
-
fs.mkdirSync(path$1.dirname(entryDir), { recursive: true });
|
|
8048
|
-
fs.symlinkSync(target, entryDir, symlinkType());
|
|
8047
|
+
fs$1.mkdirSync(path$1.dirname(entryDir), { recursive: true });
|
|
8048
|
+
fs$1.symlinkSync(target, entryDir, symlinkType());
|
|
8049
8049
|
linked.push(link.name);
|
|
8050
8050
|
} catch (err) {
|
|
8051
8051
|
logger.warn("closure dedupe — link failed; entry removed copy may need reinstall", { meta: {
|
|
@@ -8121,7 +8121,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
|
|
|
8121
8121
|
count: Object.keys(native).length
|
|
8122
8122
|
} });
|
|
8123
8123
|
try {
|
|
8124
|
-
fs.writeFileSync(markerFile, markerHash);
|
|
8124
|
+
fs$1.writeFileSync(markerFile, markerHash);
|
|
8125
8125
|
} catch (err) {
|
|
8126
8126
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
8127
8127
|
markerFile,
|
|
@@ -8159,7 +8159,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
|
|
|
8159
8159
|
}
|
|
8160
8160
|
await rebuildNativeDeps(addonDir, pending.map(([name]) => name), logger, npmCacheDir ?? defaultNpmCacheDir(), registry);
|
|
8161
8161
|
try {
|
|
8162
|
-
fs.writeFileSync(markerFile, markerHash);
|
|
8162
|
+
fs$1.writeFileSync(markerFile, markerHash);
|
|
8163
8163
|
} catch (err) {
|
|
8164
8164
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
8165
8165
|
markerFile,
|
|
@@ -8181,12 +8181,12 @@ function copyPrebuiltNativeDep(name, addonDir, logger) {
|
|
|
8181
8181
|
if (source === target) continue;
|
|
8182
8182
|
if (!hasBuiltBinary(source)) continue;
|
|
8183
8183
|
try {
|
|
8184
|
-
fs.rmSync(target, {
|
|
8184
|
+
fs$1.rmSync(target, {
|
|
8185
8185
|
recursive: true,
|
|
8186
8186
|
force: true
|
|
8187
8187
|
});
|
|
8188
|
-
fs.mkdirSync(path$1.dirname(target), { recursive: true });
|
|
8189
|
-
fs.cpSync(source, target, {
|
|
8188
|
+
fs$1.mkdirSync(path$1.dirname(target), { recursive: true });
|
|
8189
|
+
fs$1.cpSync(source, target, {
|
|
8190
8190
|
recursive: true,
|
|
8191
8191
|
dereference: true
|
|
8192
8192
|
});
|
|
@@ -8222,7 +8222,7 @@ var BUNDLED_NATIVE_SIBLING_SCOPES = {
|
|
|
8222
8222
|
function hasAnyDotNode(dir, maxDepth) {
|
|
8223
8223
|
let entries;
|
|
8224
8224
|
try {
|
|
8225
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
8225
|
+
entries = fs$1.readdirSync(dir, { withFileTypes: true });
|
|
8226
8226
|
} catch {
|
|
8227
8227
|
return false;
|
|
8228
8228
|
}
|
|
@@ -8236,12 +8236,12 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
|
|
|
8236
8236
|
if (!hasAnyDotNode(src, 5)) return;
|
|
8237
8237
|
if (hasAnyDotNode(dst, 5)) return;
|
|
8238
8238
|
try {
|
|
8239
|
-
fs.rmSync(dst, {
|
|
8239
|
+
fs$1.rmSync(dst, {
|
|
8240
8240
|
recursive: true,
|
|
8241
8241
|
force: true
|
|
8242
8242
|
});
|
|
8243
|
-
fs.mkdirSync(path$1.dirname(dst), { recursive: true });
|
|
8244
|
-
fs.cpSync(src, dst, {
|
|
8243
|
+
fs$1.mkdirSync(path$1.dirname(dst), { recursive: true });
|
|
8244
|
+
fs$1.cpSync(src, dst, {
|
|
8245
8245
|
recursive: true,
|
|
8246
8246
|
dereference: true
|
|
8247
8247
|
});
|
|
@@ -8276,7 +8276,7 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
|
|
|
8276
8276
|
*/
|
|
8277
8277
|
function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
8278
8278
|
const srcNm = path$1.join(sourceDir, "node_modules");
|
|
8279
|
-
if (!fs.existsSync(srcNm)) return;
|
|
8279
|
+
if (!fs$1.existsSync(srcNm)) return;
|
|
8280
8280
|
const dstNm = path$1.join(targetDir, "node_modules");
|
|
8281
8281
|
for (const [name, scopes] of Object.entries(BUNDLED_NATIVE_SIBLING_SCOPES)) {
|
|
8282
8282
|
copyPrebuiltModuleDir(path$1.join(srcNm, name), path$1.join(dstNm, name), name, logger);
|
|
@@ -8284,7 +8284,7 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
|
8284
8284
|
const scopeSrc = path$1.join(srcNm, scope);
|
|
8285
8285
|
let siblings;
|
|
8286
8286
|
try {
|
|
8287
|
-
siblings = fs.readdirSync(scopeSrc);
|
|
8287
|
+
siblings = fs$1.readdirSync(scopeSrc);
|
|
8288
8288
|
} catch {
|
|
8289
8289
|
continue;
|
|
8290
8290
|
}
|
|
@@ -8294,12 +8294,12 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
|
8294
8294
|
}
|
|
8295
8295
|
/** A package dir is "built" when it carries a compiled `.node` or a prebuilds tree. */
|
|
8296
8296
|
function hasBuiltBinary(pkgDir) {
|
|
8297
|
-
if (!fs.existsSync(path$1.join(pkgDir, "package.json"))) return false;
|
|
8297
|
+
if (!fs$1.existsSync(path$1.join(pkgDir, "package.json"))) return false;
|
|
8298
8298
|
const releaseDir = path$1.join(pkgDir, "build", "Release");
|
|
8299
8299
|
try {
|
|
8300
|
-
if (fs.existsSync(releaseDir) && fs.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
|
|
8300
|
+
if (fs$1.existsSync(releaseDir) && fs$1.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
|
|
8301
8301
|
} catch {}
|
|
8302
|
-
return fs.existsSync(path$1.join(pkgDir, "prebuilds"));
|
|
8302
|
+
return fs$1.existsSync(path$1.join(pkgDir, "prebuilds"));
|
|
8303
8303
|
}
|
|
8304
8304
|
/** Candidate hoisted locations for `<name>`: NODE_PATH entries + ancestors of `addonDir`. */
|
|
8305
8305
|
function candidateHoistedDirs(name, addonDir) {
|
|
@@ -8337,7 +8337,7 @@ function hashDeclaration(deps) {
|
|
|
8337
8337
|
}
|
|
8338
8338
|
function markerMatches(markerFile, expected) {
|
|
8339
8339
|
try {
|
|
8340
|
-
return fs.readFileSync(markerFile, "utf-8").trim() === expected;
|
|
8340
|
+
return fs$1.readFileSync(markerFile, "utf-8").trim() === expected;
|
|
8341
8341
|
} catch {
|
|
8342
8342
|
return false;
|
|
8343
8343
|
}
|
|
@@ -8444,7 +8444,7 @@ function parseInstallSource(value) {
|
|
|
8444
8444
|
function readPackageJson(pkgJsonPath) {
|
|
8445
8445
|
let raw;
|
|
8446
8446
|
try {
|
|
8447
|
-
raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
|
|
8447
|
+
raw = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8")));
|
|
8448
8448
|
} catch {
|
|
8449
8449
|
return null;
|
|
8450
8450
|
}
|
|
@@ -8486,7 +8486,7 @@ function shouldSkipClosureProvidedSeed(packageName, isResolvable) {
|
|
|
8486
8486
|
var REGISTRY_LATEST_TIMEOUT_MS = 15e3;
|
|
8487
8487
|
function readInstalledPackageVersion(addonDir) {
|
|
8488
8488
|
try {
|
|
8489
|
-
const raw = JSON.parse(fs.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
|
|
8489
|
+
const raw = JSON.parse(fs$1.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
|
|
8490
8490
|
if (raw === null || typeof raw !== "object") return null;
|
|
8491
8491
|
const version = Reflect.get(raw, "version");
|
|
8492
8492
|
return typeof version === "string" && version.length > 0 ? version : null;
|
|
@@ -8627,7 +8627,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8627
8627
|
} catch {
|
|
8628
8628
|
return Object.freeze([]);
|
|
8629
8629
|
}
|
|
8630
|
-
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
8630
|
+
const raw = fs$1.readFileSync(pkgPath, "utf-8");
|
|
8631
8631
|
const parsed = JSON.parse(raw);
|
|
8632
8632
|
const deps = Object.keys(parsed.dependencies ?? {});
|
|
8633
8633
|
const agentOnly = new Set(parsed.camstack?.agentOnlyBootstrapAddons ?? []);
|
|
@@ -8672,7 +8672,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8672
8672
|
} catch {
|
|
8673
8673
|
return Object.freeze([]);
|
|
8674
8674
|
}
|
|
8675
|
-
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
8675
|
+
const raw = fs$1.readFileSync(pkgPath, "utf-8");
|
|
8676
8676
|
const addons = JSON.parse(raw).camstack?.agentBootstrapAddons ?? [];
|
|
8677
8677
|
return Object.freeze(["@camstack/server", ...addons]);
|
|
8678
8678
|
}
|
|
@@ -8702,7 +8702,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8702
8702
|
this.logger.info(`Install source: ${isLocal ? `bundle (${this.bundledAddonsDir})` : "npm"}, ${pkgList.length} package(s)`);
|
|
8703
8703
|
for (const packageName of pkgList) {
|
|
8704
8704
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
8705
|
-
if (fs.existsSync(path$1.join(addonDir, "package.json"))) {
|
|
8705
|
+
if (fs$1.existsSync(path$1.join(addonDir, "package.json"))) {
|
|
8706
8706
|
if (isLocal || shouldSkipClosureProvidedSeed(packageName, this.isResolvableFromClosure(packageName))) {
|
|
8707
8707
|
this.logger.debug(`${packageName} — already installed, skipping`);
|
|
8708
8708
|
continue;
|
|
@@ -8846,7 +8846,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8846
8846
|
const installedPackages = this.listInstalled();
|
|
8847
8847
|
for (const pkg of installedPackages) {
|
|
8848
8848
|
try {
|
|
8849
|
-
if (fs.lstatSync(pkg.dir).isSymbolicLink()) continue;
|
|
8849
|
+
if (fs$1.lstatSync(pkg.dir).isSymbolicLink()) continue;
|
|
8850
8850
|
} catch {
|
|
8851
8851
|
continue;
|
|
8852
8852
|
}
|
|
@@ -8886,7 +8886,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8886
8886
|
if (closureNodeModules !== null) for (const link of state.existingLinks) {
|
|
8887
8887
|
if (!isClosureLinkTarget(link.target, closureNodeModules)) continue;
|
|
8888
8888
|
const linkDir = path$1.join(nodeModulesDir, link.name);
|
|
8889
|
-
const targetManifest = fs.existsSync(path$1.join(linkDir, "package.json"));
|
|
8889
|
+
const targetManifest = fs$1.existsSync(path$1.join(linkDir, "package.json"));
|
|
8890
8890
|
const ranges = state.requirements.get(link.name) ?? [];
|
|
8891
8891
|
let holds = targetManifest;
|
|
8892
8892
|
if (holds && ranges.length > 0) {
|
|
@@ -8895,14 +8895,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8895
8895
|
}
|
|
8896
8896
|
if (!holds) {
|
|
8897
8897
|
this.logger.warn(`${packageName} — closure link for ${link.name} no longer holds; reinstalling this addon's deps`, { meta: { target: link.target } });
|
|
8898
|
-
fs.rmSync(linkDir, { force: true });
|
|
8898
|
+
fs$1.rmSync(linkDir, { force: true });
|
|
8899
8899
|
needsInstall = true;
|
|
8900
8900
|
}
|
|
8901
8901
|
}
|
|
8902
8902
|
const linked = [];
|
|
8903
8903
|
for (const [depName, range] of declaredEntries) {
|
|
8904
8904
|
if (typeof range !== "string") continue;
|
|
8905
|
-
if (fs.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
|
|
8905
|
+
if (fs$1.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
|
|
8906
8906
|
const closureVersion = closureNodeModules === null ? void 0 : readClosureVersions(closureNodeModules, [depName]).get(depName);
|
|
8907
8907
|
if (closureNodeModules !== null && closureVersion !== void 0 && closureSatisfiesRange(range, closureVersion)) {
|
|
8908
8908
|
if (executeClosureDedupe(addonDir, closureNodeModules, {
|
|
@@ -8935,7 +8935,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8935
8935
|
const closureNodeModules = resolveClosureNodeModulesDir(this.closureNodeModulesDir);
|
|
8936
8936
|
if (closureNodeModules !== null) {
|
|
8937
8937
|
const state = collectAddonTreeState(addonDir);
|
|
8938
|
-
for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
|
|
8938
|
+
for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs$1.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
|
|
8939
8939
|
}
|
|
8940
8940
|
this.logger.info(`${packageName} — reinstalling runtime dependencies`, { meta: { addonDir } });
|
|
8941
8941
|
await runNpm([
|
|
@@ -8980,7 +8980,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8980
8980
|
async realignFromClosure(packageName, closureDir) {
|
|
8981
8981
|
const targetDir = path$1.join(this.addonsDir, packageName);
|
|
8982
8982
|
const result = await this.installLocal(packageName, closureDir);
|
|
8983
|
-
await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
|
|
8983
|
+
await fs$1.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
|
|
8984
8984
|
this.manifest.upsert(result.name, {
|
|
8985
8985
|
version: result.version,
|
|
8986
8986
|
source: "closure"
|
|
@@ -8996,17 +8996,17 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8996
8996
|
async installCopy(packageName, sourceDir, pkgData, targetDir) {
|
|
8997
8997
|
await this.ensureBuilt(packageName, sourceDir, pkgData);
|
|
8998
8998
|
const distDir = path$1.join(sourceDir, "dist");
|
|
8999
|
-
if (!fs.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
|
|
9000
|
-
await fs.promises.rm(targetDir, {
|
|
8999
|
+
if (!fs$1.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
|
|
9000
|
+
await fs$1.promises.rm(targetDir, {
|
|
9001
9001
|
recursive: true,
|
|
9002
9002
|
force: true
|
|
9003
9003
|
});
|
|
9004
9004
|
ensureDir(targetDir);
|
|
9005
|
-
await fs.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
|
|
9005
|
+
await fs$1.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
|
|
9006
9006
|
await copyDirRecursive(distDir, path$1.join(targetDir, "dist"));
|
|
9007
9007
|
await copyExtraFileDirs(pkgData, sourceDir, targetDir);
|
|
9008
9008
|
copyBundledNativeModules(sourceDir, targetDir, this.logger);
|
|
9009
|
-
await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
|
|
9009
|
+
await fs$1.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
|
|
9010
9010
|
const localPkgVersion = asString$1(pkgData.version, "0.0.0");
|
|
9011
9011
|
this.manifest.upsert(packageName, {
|
|
9012
9012
|
version: localPkgVersion,
|
|
@@ -9047,7 +9047,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9047
9047
|
* unusual auth, offline mode, etc).
|
|
9048
9048
|
*/
|
|
9049
9049
|
async installFromNpm(packageName, version) {
|
|
9050
|
-
const tmpDir = fs.mkdtempSync(path$1.join(os$1.tmpdir(), "camstack-addon-npm-"));
|
|
9050
|
+
const tmpDir = fs$1.mkdtempSync(path$1.join(os$1.tmpdir(), "camstack-addon-npm-"));
|
|
9051
9051
|
const packageSpec = version ? `${packageName}@${version}` : packageName;
|
|
9052
9052
|
this.logger.info(`${packageName} — installing from npm`);
|
|
9053
9053
|
try {
|
|
@@ -9061,19 +9061,19 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9061
9061
|
];
|
|
9062
9062
|
if (this.registry) args.push("--registry", this.registry);
|
|
9063
9063
|
const { stdout } = await runNpm(args, this.npmRunOptions(tmpDir, 12e4));
|
|
9064
|
-
const tgzFiles = fs.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
|
|
9064
|
+
const tgzFiles = fs$1.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
|
|
9065
9065
|
if (tgzFiles.length === 0) throw new Error(`npm pack produced no tgz. stdout: ${stdout.trim()}`);
|
|
9066
9066
|
return path$1.join(tmpDir, tgzFiles[0]);
|
|
9067
9067
|
});
|
|
9068
9068
|
const result = await this.installFromTgz(tgzPath);
|
|
9069
|
-
fs.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
|
|
9069
|
+
fs$1.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
|
|
9070
9070
|
this.manifest.upsert(result.name, {
|
|
9071
9071
|
version: result.version,
|
|
9072
9072
|
source: "npm"
|
|
9073
9073
|
});
|
|
9074
9074
|
return result;
|
|
9075
9075
|
} finally {
|
|
9076
|
-
fs.rmSync(tmpDir, {
|
|
9076
|
+
fs$1.rmSync(tmpDir, {
|
|
9077
9077
|
recursive: true,
|
|
9078
9078
|
force: true
|
|
9079
9079
|
});
|
|
@@ -9111,7 +9111,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9111
9111
|
if (!tarRes.ok) throw new Error(`tarball GET ${tarballUrl} → ${tarRes.status}`);
|
|
9112
9112
|
const tgzPath = path$1.join(tmpDir, `${packageName.replace(/[/@]/g, "-").replace(/^-+/, "")}-${resolvedVersion}.tgz`);
|
|
9113
9113
|
const buf = Buffer.from(await tarRes.arrayBuffer());
|
|
9114
|
-
fs.writeFileSync(tgzPath, buf);
|
|
9114
|
+
fs$1.writeFileSync(tgzPath, buf);
|
|
9115
9115
|
return tgzPath;
|
|
9116
9116
|
}
|
|
9117
9117
|
/**
|
|
@@ -9132,7 +9132,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9132
9132
|
* on the next deploy.
|
|
9133
9133
|
*/
|
|
9134
9134
|
async evictInstallDir(targetDir) {
|
|
9135
|
-
if (!fs.existsSync(targetDir)) return;
|
|
9135
|
+
if (!fs$1.existsSync(targetDir)) return;
|
|
9136
9136
|
const graveyard = path$1.join(this.addonsDir, ".evicting");
|
|
9137
9137
|
ensureDir(graveyard);
|
|
9138
9138
|
await this.sweepGraveyard(graveyard);
|
|
@@ -9140,10 +9140,10 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9140
9140
|
const flatName = path$1.relative(this.addonsDir, targetDir).replace(/[/\\]/g, "-");
|
|
9141
9141
|
const asideDir = path$1.join(graveyard, `${flatName}-${ts}`);
|
|
9142
9142
|
try {
|
|
9143
|
-
fs.renameSync(targetDir, asideDir);
|
|
9143
|
+
fs$1.renameSync(targetDir, asideDir);
|
|
9144
9144
|
} catch (renameErr) {
|
|
9145
9145
|
if (renameErr.code === "EXDEV") {
|
|
9146
|
-
await fs.promises.rm(targetDir, {
|
|
9146
|
+
await fs$1.promises.rm(targetDir, {
|
|
9147
9147
|
recursive: true,
|
|
9148
9148
|
force: true
|
|
9149
9149
|
});
|
|
@@ -9151,7 +9151,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9151
9151
|
}
|
|
9152
9152
|
throw renameErr;
|
|
9153
9153
|
}
|
|
9154
|
-
await fs.promises.rm(asideDir, {
|
|
9154
|
+
await fs$1.promises.rm(asideDir, {
|
|
9155
9155
|
recursive: true,
|
|
9156
9156
|
force: true
|
|
9157
9157
|
}).catch((cleanupErr) => {
|
|
@@ -9172,14 +9172,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9172
9172
|
async sweepStagingResidue(stagingRoot) {
|
|
9173
9173
|
let names;
|
|
9174
9174
|
try {
|
|
9175
|
-
names = fs.readdirSync(stagingRoot);
|
|
9175
|
+
names = fs$1.readdirSync(stagingRoot);
|
|
9176
9176
|
} catch {
|
|
9177
9177
|
return;
|
|
9178
9178
|
}
|
|
9179
9179
|
const now = Date.now();
|
|
9180
9180
|
const ages = [];
|
|
9181
9181
|
for (const name of names) try {
|
|
9182
|
-
const stat = fs.statSync(path$1.join(stagingRoot, name));
|
|
9182
|
+
const stat = fs$1.statSync(path$1.join(stagingRoot, name));
|
|
9183
9183
|
ages.push({
|
|
9184
9184
|
name,
|
|
9185
9185
|
ageMs: now - stat.mtimeMs
|
|
@@ -9190,7 +9190,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9190
9190
|
stagingRoot,
|
|
9191
9191
|
entries: sweepable
|
|
9192
9192
|
} });
|
|
9193
|
-
await Promise.all(sweepable.map((name) => fs.promises.rm(path$1.join(stagingRoot, name), {
|
|
9193
|
+
await Promise.all(sweepable.map((name) => fs$1.promises.rm(path$1.join(stagingRoot, name), {
|
|
9194
9194
|
recursive: true,
|
|
9195
9195
|
force: true
|
|
9196
9196
|
}).catch(() => void 0)));
|
|
@@ -9199,11 +9199,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9199
9199
|
async sweepGraveyard(graveyard) {
|
|
9200
9200
|
let entries;
|
|
9201
9201
|
try {
|
|
9202
|
-
entries = fs.readdirSync(graveyard);
|
|
9202
|
+
entries = fs$1.readdirSync(graveyard);
|
|
9203
9203
|
} catch {
|
|
9204
9204
|
return;
|
|
9205
9205
|
}
|
|
9206
|
-
await Promise.all(entries.map((name) => fs.promises.rm(path$1.join(graveyard, name), {
|
|
9206
|
+
await Promise.all(entries.map((name) => fs$1.promises.rm(path$1.join(graveyard, name), {
|
|
9207
9207
|
recursive: true,
|
|
9208
9208
|
force: true
|
|
9209
9209
|
}).catch(() => void 0)));
|
|
@@ -9254,7 +9254,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9254
9254
|
return;
|
|
9255
9255
|
}
|
|
9256
9256
|
const strippedManifest = stripBundledDeps(pkgView.raw);
|
|
9257
|
-
await fs.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
|
|
9257
|
+
await fs$1.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
|
|
9258
9258
|
const deps = asJsonObject$1(strippedManifest["dependencies"]);
|
|
9259
9259
|
const depNames = deps ? Object.keys(deps) : [];
|
|
9260
9260
|
if (depNames.length === 0) return;
|
|
@@ -9386,9 +9386,9 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9386
9386
|
"-C",
|
|
9387
9387
|
stagingDir
|
|
9388
9388
|
], { timeout: 12e4 });
|
|
9389
|
-
const pkgDir = fs.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
|
|
9389
|
+
const pkgDir = fs$1.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
|
|
9390
9390
|
const pkgJsonPath = path$1.join(pkgDir, "package.json");
|
|
9391
|
-
if (!fs.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
|
|
9391
|
+
if (!fs$1.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
|
|
9392
9392
|
const pkgView = readPackageJson(pkgJsonPath);
|
|
9393
9393
|
if (!pkgView) throw new Error(`Invalid package.json at ${pkgJsonPath}`);
|
|
9394
9394
|
if (!pkgView.camstackAddons) throw new Error(`Package ${pkgView.name} has no camstack.addons manifest`);
|
|
@@ -9398,7 +9398,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9398
9398
|
this.dedupeTreeAgainstClosure(pkgDir, pkgView.name);
|
|
9399
9399
|
await this.evictInstallDir(targetDir);
|
|
9400
9400
|
ensureDir(path$1.dirname(targetDir));
|
|
9401
|
-
await fs.promises.rename(pkgDir, targetDir);
|
|
9401
|
+
await fs$1.promises.rename(pkgDir, targetDir);
|
|
9402
9402
|
this.manifest.upsert(pkgView.name, {
|
|
9403
9403
|
version: pkgView.version,
|
|
9404
9404
|
source: "bundled"
|
|
@@ -9409,7 +9409,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9409
9409
|
};
|
|
9410
9410
|
} finally {
|
|
9411
9411
|
this.inFlightStaging.delete(stagingName);
|
|
9412
|
-
await fs.promises.rm(stagingDir, {
|
|
9412
|
+
await fs$1.promises.rm(stagingDir, {
|
|
9413
9413
|
recursive: true,
|
|
9414
9414
|
force: true
|
|
9415
9415
|
}).catch(() => void 0);
|
|
@@ -9439,24 +9439,24 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9439
9439
|
const current = this.manifest.get(packageName);
|
|
9440
9440
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
9441
9441
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9442
|
-
if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9442
|
+
if (!fs$1.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9443
9443
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
9444
9444
|
const backupRoot = path$1.join(this.addonsDir, ".backups", packageName);
|
|
9445
9445
|
ensureDir(backupRoot);
|
|
9446
9446
|
const backupDir = path$1.join(backupRoot, ts);
|
|
9447
9447
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
9448
|
-
fs.renameSync(addonDir, backupDir);
|
|
9448
|
+
fs$1.renameSync(addonDir, backupDir);
|
|
9449
9449
|
let result;
|
|
9450
9450
|
try {
|
|
9451
9451
|
result = await this.installFromNpm(packageName, version);
|
|
9452
9452
|
} catch (installErr) {
|
|
9453
9453
|
this.logger.error(`${packageName} — install failed, restoring backup`, { meta: { error: errMsg$1(installErr) } });
|
|
9454
9454
|
try {
|
|
9455
|
-
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9455
|
+
if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
|
|
9456
9456
|
recursive: true,
|
|
9457
9457
|
force: true
|
|
9458
9458
|
});
|
|
9459
|
-
fs.renameSync(backupDir, addonDir);
|
|
9459
|
+
fs$1.renameSync(backupDir, addonDir);
|
|
9460
9460
|
this.manifest.upsert(packageName, {
|
|
9461
9461
|
version: current.version,
|
|
9462
9462
|
source: current.source,
|
|
@@ -9517,7 +9517,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9517
9517
|
const current = this.manifest.get(packageName);
|
|
9518
9518
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
9519
9519
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9520
|
-
if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9520
|
+
if (!fs$1.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9521
9521
|
await this.installRuntimeDependencies(stagedPath, packageName);
|
|
9522
9522
|
await this.installNativeDependencies(stagedPath, packageName);
|
|
9523
9523
|
this.dedupeTreeAgainstClosure(stagedPath, packageName);
|
|
@@ -9526,14 +9526,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9526
9526
|
ensureDir(backupRoot);
|
|
9527
9527
|
const backupDir = path$1.join(backupRoot, ts);
|
|
9528
9528
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
9529
|
-
fs.renameSync(addonDir, backupDir);
|
|
9529
|
+
fs$1.renameSync(addonDir, backupDir);
|
|
9530
9530
|
try {
|
|
9531
9531
|
try {
|
|
9532
|
-
fs.renameSync(stagedPath, addonDir);
|
|
9532
|
+
fs$1.renameSync(stagedPath, addonDir);
|
|
9533
9533
|
} catch (renameErr) {
|
|
9534
9534
|
if (renameErr.code === "EXDEV") {
|
|
9535
|
-
fs.cpSync(stagedPath, addonDir, { recursive: true });
|
|
9536
|
-
fs.rmSync(stagedPath, {
|
|
9535
|
+
fs$1.cpSync(stagedPath, addonDir, { recursive: true });
|
|
9536
|
+
fs$1.rmSync(stagedPath, {
|
|
9537
9537
|
recursive: true,
|
|
9538
9538
|
force: true
|
|
9539
9539
|
});
|
|
@@ -9542,11 +9542,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9542
9542
|
} catch (swapErr) {
|
|
9543
9543
|
this.logger.error(`${packageName} — staged swap failed, restoring backup`, { meta: { error: errMsg$1(swapErr) } });
|
|
9544
9544
|
try {
|
|
9545
|
-
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9545
|
+
if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
|
|
9546
9546
|
recursive: true,
|
|
9547
9547
|
force: true
|
|
9548
9548
|
});
|
|
9549
|
-
fs.renameSync(backupDir, addonDir);
|
|
9549
|
+
fs$1.renameSync(backupDir, addonDir);
|
|
9550
9550
|
this.manifest.upsert(packageName, {
|
|
9551
9551
|
version: current.version,
|
|
9552
9552
|
source: current.source,
|
|
@@ -9585,20 +9585,20 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9585
9585
|
this.logger.warn(`${packageName} — no backup to rollback to`);
|
|
9586
9586
|
return null;
|
|
9587
9587
|
}
|
|
9588
|
-
if (!fs.existsSync(entry.lastBackupDir)) {
|
|
9588
|
+
if (!fs$1.existsSync(entry.lastBackupDir)) {
|
|
9589
9589
|
this.logger.warn(`${packageName} — backup dir vanished: ${entry.lastBackupDir}`);
|
|
9590
9590
|
return null;
|
|
9591
9591
|
}
|
|
9592
9592
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9593
|
-
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9593
|
+
if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
|
|
9594
9594
|
recursive: true,
|
|
9595
9595
|
force: true
|
|
9596
9596
|
});
|
|
9597
|
-
fs.renameSync(entry.lastBackupDir, addonDir);
|
|
9597
|
+
fs$1.renameSync(entry.lastBackupDir, addonDir);
|
|
9598
9598
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
9599
9599
|
let restoredVersion = entry.version;
|
|
9600
|
-
if (fs.existsSync(pkgJsonPath)) try {
|
|
9601
|
-
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
9600
|
+
if (fs$1.existsSync(pkgJsonPath)) try {
|
|
9601
|
+
const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
|
|
9602
9602
|
if (typeof parsed === "object" && parsed != null) {
|
|
9603
9603
|
const v = parsed.version;
|
|
9604
9604
|
if (typeof v === "string" && v.length > 0) restoredVersion = v;
|
|
@@ -9646,7 +9646,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9646
9646
|
return false;
|
|
9647
9647
|
}
|
|
9648
9648
|
try {
|
|
9649
|
-
await fs.promises.rm(target, {
|
|
9649
|
+
await fs$1.promises.rm(target, {
|
|
9650
9650
|
recursive: true,
|
|
9651
9651
|
force: true
|
|
9652
9652
|
});
|
|
@@ -9664,7 +9664,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9664
9664
|
listBackupsFor(packageName) {
|
|
9665
9665
|
const dir = path$1.join(this.backupsRoot, packageName);
|
|
9666
9666
|
try {
|
|
9667
|
-
return fs.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
|
|
9667
|
+
return fs$1.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
|
|
9668
9668
|
} catch {
|
|
9669
9669
|
return [];
|
|
9670
9670
|
}
|
|
@@ -9696,7 +9696,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9696
9696
|
for (const dir of [pkgDir, path$1.dirname(pkgDir)]) {
|
|
9697
9697
|
if (!this.isInsideBackups(dir)) continue;
|
|
9698
9698
|
try {
|
|
9699
|
-
await fs.promises.rmdir(dir);
|
|
9699
|
+
await fs$1.promises.rmdir(dir);
|
|
9700
9700
|
} catch {
|
|
9701
9701
|
return;
|
|
9702
9702
|
}
|
|
@@ -9778,7 +9778,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9778
9778
|
*/
|
|
9779
9779
|
resolveBackupToKeep(packageName, backups) {
|
|
9780
9780
|
const liveDir = path$1.join(this.addonsDir, packageName);
|
|
9781
|
-
if (!fs.existsSync(liveDir)) {
|
|
9781
|
+
if (!fs$1.existsSync(liveDir)) {
|
|
9782
9782
|
const newest = backups[backups.length - 1] ?? null;
|
|
9783
9783
|
if (newest != null) this.logger.warn(`${packageName} — live install dir missing; retaining its newest backup as the only surviving copy`, { meta: {
|
|
9784
9784
|
liveDir,
|
|
@@ -9795,7 +9795,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9795
9795
|
listBackedUpPackages() {
|
|
9796
9796
|
let entries;
|
|
9797
9797
|
try {
|
|
9798
|
-
entries = fs.readdirSync(this.backupsRoot, { withFileTypes: true });
|
|
9798
|
+
entries = fs$1.readdirSync(this.backupsRoot, { withFileTypes: true });
|
|
9799
9799
|
} catch {
|
|
9800
9800
|
return [];
|
|
9801
9801
|
}
|
|
@@ -9807,14 +9807,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9807
9807
|
continue;
|
|
9808
9808
|
}
|
|
9809
9809
|
const scopeDir = path$1.join(this.backupsRoot, entry.name);
|
|
9810
|
-
for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
|
|
9810
|
+
for (const inner of fs$1.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
|
|
9811
9811
|
}
|
|
9812
9812
|
return names;
|
|
9813
9813
|
}
|
|
9814
9814
|
async uninstall(packageName) {
|
|
9815
9815
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9816
|
-
if (fs.existsSync(addonDir)) {
|
|
9817
|
-
fs.rmSync(addonDir, {
|
|
9816
|
+
if (fs$1.existsSync(addonDir)) {
|
|
9817
|
+
fs$1.rmSync(addonDir, {
|
|
9818
9818
|
recursive: true,
|
|
9819
9819
|
force: true
|
|
9820
9820
|
});
|
|
@@ -9822,8 +9822,8 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9822
9822
|
return;
|
|
9823
9823
|
}
|
|
9824
9824
|
const legacyDir = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""));
|
|
9825
|
-
if (fs.existsSync(legacyDir)) {
|
|
9826
|
-
fs.rmSync(legacyDir, {
|
|
9825
|
+
if (fs$1.existsSync(legacyDir)) {
|
|
9826
|
+
fs$1.rmSync(legacyDir, {
|
|
9827
9827
|
recursive: true,
|
|
9828
9828
|
force: true
|
|
9829
9829
|
});
|
|
@@ -9831,22 +9831,22 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9831
9831
|
}
|
|
9832
9832
|
}
|
|
9833
9833
|
listInstalled() {
|
|
9834
|
-
if (!fs.existsSync(this.addonsDir)) return [];
|
|
9834
|
+
if (!fs$1.existsSync(this.addonsDir)) return [];
|
|
9835
9835
|
const packageDirs = [];
|
|
9836
|
-
for (const entry of fs.readdirSync(this.addonsDir, { withFileTypes: true })) {
|
|
9836
|
+
for (const entry of fs$1.readdirSync(this.addonsDir, { withFileTypes: true })) {
|
|
9837
9837
|
if (!isDirEntry(entry, this.addonsDir)) continue;
|
|
9838
9838
|
if (entry.name.startsWith("@")) {
|
|
9839
9839
|
const scopeDir = path$1.join(this.addonsDir, entry.name);
|
|
9840
|
-
for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
|
|
9840
|
+
for (const inner of fs$1.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
|
|
9841
9841
|
} else packageDirs.push(path$1.join(this.addonsDir, entry.name));
|
|
9842
9842
|
}
|
|
9843
9843
|
return packageDirs.map((dir) => {
|
|
9844
9844
|
const pkgPath = path$1.join(dir, "package.json");
|
|
9845
|
-
if (!fs.existsSync(pkgPath)) return null;
|
|
9845
|
+
if (!fs$1.existsSync(pkgPath)) return null;
|
|
9846
9846
|
const pkg = readPackageJson(pkgPath);
|
|
9847
9847
|
if (!pkg || !pkg.camstackAddons) return null;
|
|
9848
9848
|
const sourceFile = path$1.join(dir, ".install-source");
|
|
9849
|
-
const installSource = fs.existsSync(sourceFile) ? parseInstallSource(fs.readFileSync(sourceFile, "utf-8").trim()) : void 0;
|
|
9849
|
+
const installSource = fs$1.existsSync(sourceFile) ? parseInstallSource(fs$1.readFileSync(sourceFile, "utf-8").trim()) : void 0;
|
|
9850
9850
|
return {
|
|
9851
9851
|
name: pkg.name,
|
|
9852
9852
|
version: pkg.version,
|
|
@@ -9856,13 +9856,13 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9856
9856
|
}).filter((item) => item !== null);
|
|
9857
9857
|
}
|
|
9858
9858
|
isInstalled(packageName) {
|
|
9859
|
-
if (fs.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
|
|
9860
|
-
return fs.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
|
|
9859
|
+
if (fs$1.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
|
|
9860
|
+
return fs$1.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
|
|
9861
9861
|
}
|
|
9862
9862
|
getInstalledPackage(packageName) {
|
|
9863
9863
|
let pkgPath = path$1.join(this.addonsDir, packageName, "package.json");
|
|
9864
|
-
if (!fs.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
|
|
9865
|
-
if (!fs.existsSync(pkgPath)) return null;
|
|
9864
|
+
if (!fs$1.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
|
|
9865
|
+
if (!fs$1.existsSync(pkgPath)) return null;
|
|
9866
9866
|
const pkg = readPackageJson(pkgPath);
|
|
9867
9867
|
if (!pkg) return null;
|
|
9868
9868
|
return {
|
|
@@ -9881,7 +9881,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9881
9881
|
]) {
|
|
9882
9882
|
const candidate = path$1.join(this.bundledAddonsDir, dirName);
|
|
9883
9883
|
try {
|
|
9884
|
-
const pkg = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
|
|
9884
|
+
const pkg = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
|
|
9885
9885
|
if (pkg && asString$1(pkg["name"]) === packageName) return candidate;
|
|
9886
9886
|
} catch {}
|
|
9887
9887
|
}
|
|
@@ -9890,7 +9890,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9890
9890
|
/** Ensure a package is built (dist/ exists and page bundles present) */
|
|
9891
9891
|
async ensureBuilt(packageName, sourceDir, pkgData) {
|
|
9892
9892
|
const distDir = path$1.join(sourceDir, "dist");
|
|
9893
|
-
if (!(!fs.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
|
|
9893
|
+
if (!(!fs$1.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
|
|
9894
9894
|
this.logger.info(`${packageName} — building (dist/ missing or incomplete)`);
|
|
9895
9895
|
try {
|
|
9896
9896
|
await runNpm(["run", "build"], this.npmRunOptions(sourceDir, 18e4));
|
|
@@ -9905,7 +9905,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9905
9905
|
if (!camstack?.addons) return false;
|
|
9906
9906
|
for (const addon of camstack.addons) {
|
|
9907
9907
|
if (!addon.pages) continue;
|
|
9908
|
-
for (const page of addon.pages) if (page.bundle && !fs.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
|
|
9908
|
+
for (const page of addon.pages) if (page.bundle && !fs$1.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
|
|
9909
9909
|
}
|
|
9910
9910
|
return false;
|
|
9911
9911
|
}
|
|
@@ -9914,7 +9914,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9914
9914
|
function isDirEntry(entry, parentDir) {
|
|
9915
9915
|
if (entry.isDirectory()) return true;
|
|
9916
9916
|
if (entry.isSymbolicLink()) try {
|
|
9917
|
-
return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
9917
|
+
return fs$1.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
9918
9918
|
} catch {
|
|
9919
9919
|
return false;
|
|
9920
9920
|
}
|
|
@@ -10013,7 +10013,7 @@ function selectAddonResidue(candidates) {
|
|
|
10013
10013
|
}
|
|
10014
10014
|
function readDeclaredName(dir) {
|
|
10015
10015
|
try {
|
|
10016
|
-
const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
10016
|
+
const parsed = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
10017
10017
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
10018
10018
|
const name = parsed.name;
|
|
10019
10019
|
return typeof name === "string" ? name : null;
|
|
@@ -10023,7 +10023,7 @@ function readDeclaredName(dir) {
|
|
|
10023
10023
|
}
|
|
10024
10024
|
function readDeclaredVersion(dir) {
|
|
10025
10025
|
try {
|
|
10026
|
-
const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
10026
|
+
const parsed = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
10027
10027
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
10028
10028
|
const version = parsed.version;
|
|
10029
10029
|
return typeof version === "string" ? version : null;
|
|
@@ -10033,7 +10033,7 @@ function readDeclaredVersion(dir) {
|
|
|
10033
10033
|
}
|
|
10034
10034
|
function isDirLike(p) {
|
|
10035
10035
|
try {
|
|
10036
|
-
return fs.statSync(p).isDirectory();
|
|
10036
|
+
return fs$1.statSync(p).isDirectory();
|
|
10037
10037
|
} catch {
|
|
10038
10038
|
return false;
|
|
10039
10039
|
}
|
|
@@ -10043,7 +10043,7 @@ function freeQuarantineTarget(store, scope, dirName) {
|
|
|
10043
10043
|
const base = scope === null ? dirName : `${scope.replace("@", "")}__${dirName}`;
|
|
10044
10044
|
let candidate = path$1.join(store, base);
|
|
10045
10045
|
let n = 1;
|
|
10046
|
-
while (fs.existsSync(candidate)) {
|
|
10046
|
+
while (fs$1.existsSync(candidate)) {
|
|
10047
10047
|
candidate = path$1.join(store, `${base}-${n}`);
|
|
10048
10048
|
n += 1;
|
|
10049
10049
|
}
|
|
@@ -10060,7 +10060,7 @@ function freeQuarantineTarget(store, scope, dirName) {
|
|
|
10060
10060
|
function quarantineAddonResidue(addonsDir, log) {
|
|
10061
10061
|
const quarantined = [];
|
|
10062
10062
|
const failed = [];
|
|
10063
|
-
if (!fs.existsSync(addonsDir)) return {
|
|
10063
|
+
if (!fs$1.existsSync(addonsDir)) return {
|
|
10064
10064
|
quarantined,
|
|
10065
10065
|
failed
|
|
10066
10066
|
};
|
|
@@ -10068,7 +10068,7 @@ function quarantineAddonResidue(addonsDir, log) {
|
|
|
10068
10068
|
const scan = (parent, scope) => {
|
|
10069
10069
|
let names;
|
|
10070
10070
|
try {
|
|
10071
|
-
names = fs.readdirSync(parent);
|
|
10071
|
+
names = fs$1.readdirSync(parent);
|
|
10072
10072
|
} catch {
|
|
10073
10073
|
return;
|
|
10074
10074
|
}
|
|
@@ -10087,8 +10087,8 @@ function quarantineAddonResidue(addonsDir, log) {
|
|
|
10087
10087
|
const version = readDeclaredVersion(full);
|
|
10088
10088
|
const to = freeQuarantineTarget(store, scope, dirName);
|
|
10089
10089
|
try {
|
|
10090
|
-
fs.mkdirSync(store, { recursive: true });
|
|
10091
|
-
fs.renameSync(full, to);
|
|
10090
|
+
fs$1.mkdirSync(store, { recursive: true });
|
|
10091
|
+
fs$1.renameSync(full, to);
|
|
10092
10092
|
} catch (err) {
|
|
10093
10093
|
const error = err instanceof Error ? err.message : String(err);
|
|
10094
10094
|
failed.push({
|
|
@@ -10146,11 +10146,11 @@ function getRestartMarkerPath(dataDir) {
|
|
|
10146
10146
|
* intact or no marker at all (never a half-written file).
|
|
10147
10147
|
*/
|
|
10148
10148
|
function writePendingRestart(dataDir, marker) {
|
|
10149
|
-
fs.mkdirSync(dataDir, { recursive: true });
|
|
10149
|
+
fs$1.mkdirSync(dataDir, { recursive: true });
|
|
10150
10150
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
10151
10151
|
const tmpPath = `${markerPath}.tmp`;
|
|
10152
|
-
fs.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
|
|
10153
|
-
fs.renameSync(tmpPath, markerPath);
|
|
10152
|
+
fs$1.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
|
|
10153
|
+
fs$1.renameSync(tmpPath, markerPath);
|
|
10154
10154
|
}
|
|
10155
10155
|
/**
|
|
10156
10156
|
* Read + consume the marker. Returns the parsed payload on success and
|
|
@@ -10175,10 +10175,10 @@ function writePendingRestart(dataDir, marker) {
|
|
|
10175
10175
|
*/
|
|
10176
10176
|
function readPendingRestart(dataDir) {
|
|
10177
10177
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
10178
|
-
if (!fs.existsSync(markerPath)) return null;
|
|
10178
|
+
if (!fs$1.existsSync(markerPath)) return null;
|
|
10179
10179
|
let raw;
|
|
10180
10180
|
try {
|
|
10181
|
-
raw = fs.readFileSync(markerPath, "utf-8");
|
|
10181
|
+
raw = fs$1.readFileSync(markerPath, "utf-8");
|
|
10182
10182
|
} catch (err) {
|
|
10183
10183
|
console.error("[restart-coordinator] Marker unreadable — leaving in place:", err);
|
|
10184
10184
|
return null;
|
|
@@ -10217,7 +10217,7 @@ function readPendingRestart(dataDir) {
|
|
|
10217
10217
|
/** Remove the marker if present. No-op if missing. */
|
|
10218
10218
|
function clearPendingRestart(dataDir) {
|
|
10219
10219
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
10220
|
-
fs.rmSync(markerPath, { force: true });
|
|
10220
|
+
fs$1.rmSync(markerPath, { force: true });
|
|
10221
10221
|
}
|
|
10222
10222
|
function isRestartKind(value) {
|
|
10223
10223
|
return value === "framework-update" || value === "manual" || value === "system";
|
|
@@ -10229,7 +10229,7 @@ function scheduleSelfRestart(options = {}) {
|
|
|
10229
10229
|
const touchTarget = process.env["CAMSTACK_RESTART_TOUCH_FILE"];
|
|
10230
10230
|
if (touchTarget !== void 0 && touchTarget.length > 0) try {
|
|
10231
10231
|
const now = /* @__PURE__ */ new Date();
|
|
10232
|
-
fs.utimesSync(touchTarget, now, now);
|
|
10232
|
+
fs$1.utimesSync(touchTarget, now, now);
|
|
10233
10233
|
return;
|
|
10234
10234
|
} catch (err) {
|
|
10235
10235
|
console.error("[restart-coordinator] dev touch-reload failed; falling through to process exit:", err);
|
|
@@ -14593,11 +14593,11 @@ function applyEnvOverrides(raw) {
|
|
|
14593
14593
|
return result;
|
|
14594
14594
|
}
|
|
14595
14595
|
function loadYaml(configPath) {
|
|
14596
|
-
if (!fs.existsSync(configPath)) {
|
|
14596
|
+
if (!fs$1.existsSync(configPath)) {
|
|
14597
14597
|
console.warn(`[ConfigManager] Config file not found at: ${configPath}\n → Using built-in defaults. Set CONFIG_PATH env var or create the file.\n → Example path from project root: ./server/backend/data/config.yaml`);
|
|
14598
14598
|
return {};
|
|
14599
14599
|
}
|
|
14600
|
-
const parsed = load(fs.readFileSync(configPath, "utf-8")) ?? {};
|
|
14600
|
+
const parsed = load(fs$1.readFileSync(configPath, "utf-8")) ?? {};
|
|
14601
14601
|
console.log(`[ConfigManager] Loaded config from: ${configPath}`);
|
|
14602
14602
|
return parsed;
|
|
14603
14603
|
}
|
|
@@ -22752,7 +22752,7 @@ async function probeVaapiInit(renderNode) {
|
|
|
22752
22752
|
*/
|
|
22753
22753
|
function safeExistsSync(path) {
|
|
22754
22754
|
try {
|
|
22755
|
-
return fs.existsSync(path);
|
|
22755
|
+
return fs$1.existsSync(path);
|
|
22756
22756
|
} catch {
|
|
22757
22757
|
return false;
|
|
22758
22758
|
}
|
|
@@ -22771,11 +22771,11 @@ function probeLinuxGpus() {
|
|
|
22771
22771
|
if (safeExistsSync("/dev/nvidia0") || safeExistsSync("/proc/driver/nvidia/version")) signals.hasNvidiaGpu = true;
|
|
22772
22772
|
try {
|
|
22773
22773
|
const drmDir = "/sys/class/drm";
|
|
22774
|
-
if (fs.existsSync(drmDir)) for (const entry of fs.readdirSync(drmDir)) {
|
|
22774
|
+
if (fs$1.existsSync(drmDir)) for (const entry of fs$1.readdirSync(drmDir)) {
|
|
22775
22775
|
if (!entry.startsWith("card")) continue;
|
|
22776
22776
|
const vendorPath = `${drmDir}/${entry}/device/vendor`;
|
|
22777
22777
|
if (!safeExistsSync(vendorPath)) continue;
|
|
22778
|
-
const vendor = fs.readFileSync(vendorPath, "utf8").trim().toLowerCase();
|
|
22778
|
+
const vendor = fs$1.readFileSync(vendorPath, "utf8").trim().toLowerCase();
|
|
22779
22779
|
if (vendor === "0x10de") signals.hasNvidiaGpu = true;
|
|
22780
22780
|
else if (vendor === "0x1002") signals.hasAmdGpu = true;
|
|
22781
22781
|
else if (vendor === "0x8086") signals.hasIntelGpu = true;
|
|
@@ -22993,21 +22993,21 @@ function sleep$1(ms) {
|
|
|
22993
22993
|
* crashed holder) is stolen.
|
|
22994
22994
|
*/
|
|
22995
22995
|
async function withFileLock(lockPath, fn) {
|
|
22996
|
-
fs.mkdirSync(join(lockPath, ".."), { recursive: true });
|
|
22996
|
+
fs$1.mkdirSync(join(lockPath, ".."), { recursive: true });
|
|
22997
22997
|
for (;;) try {
|
|
22998
|
-
const fd = fs.openSync(lockPath, "wx");
|
|
22999
|
-
fs.closeSync(fd);
|
|
22998
|
+
const fd = fs$1.openSync(lockPath, "wx");
|
|
22999
|
+
fs$1.closeSync(fd);
|
|
23000
23000
|
break;
|
|
23001
23001
|
} catch {
|
|
23002
23002
|
try {
|
|
23003
|
-
if (Date.now() - fs.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs.rmSync(lockPath, { force: true });
|
|
23003
|
+
if (Date.now() - fs$1.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs$1.rmSync(lockPath, { force: true });
|
|
23004
23004
|
else await sleep$1(LOCK_POLL_MS);
|
|
23005
23005
|
} catch {}
|
|
23006
23006
|
}
|
|
23007
23007
|
try {
|
|
23008
23008
|
return await fn();
|
|
23009
23009
|
} finally {
|
|
23010
|
-
fs.rmSync(lockPath, { force: true });
|
|
23010
|
+
fs$1.rmSync(lockPath, { force: true });
|
|
23011
23011
|
}
|
|
23012
23012
|
}
|
|
23013
23013
|
/** Coalesce in-process + serialize cross-process for one binary id. */
|
|
@@ -23065,7 +23065,7 @@ var AddonDepsManager = class {
|
|
|
23065
23065
|
* failed or tampered download throws, and provisioning reports it.
|
|
23066
23066
|
*/
|
|
23067
23067
|
async stageNativeDepsDeclaredBy(requirementsFile) {
|
|
23068
|
-
if (!declaresEdgetpuDelegate(fs.readFileSync(requirementsFile, "utf8"))) return;
|
|
23068
|
+
if (!declaresEdgetpuDelegate(fs$1.readFileSync(requirementsFile, "utf8"))) return;
|
|
23069
23069
|
await singleFlight(this.depsDir, "edgetpu-delegate", () => ensureEdgetpuDelegate(this.nodeRoot, this.logger));
|
|
23070
23070
|
}
|
|
23071
23071
|
getDepsDir() {
|
|
@@ -24096,7 +24096,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
|
|
|
24096
24096
|
const addonId = declaration.id;
|
|
24097
24097
|
const nodeDataDir = process.env["CAMSTACK_DATA"] ?? dataDir;
|
|
24098
24098
|
const addonDataDir = path$1.resolve(nodeDataDir, "addons-data", addonId);
|
|
24099
|
-
fs.mkdirSync(addonDataDir, { recursive: true });
|
|
24099
|
+
fs$1.mkdirSync(addonDataDir, { recursive: true });
|
|
24100
24100
|
if (runtime.mode === "broker") ensureBindingSubscription(runtime.broker);
|
|
24101
24101
|
const regs = getRegistries(nodeId);
|
|
24102
24102
|
const workerResolver = {
|
|
@@ -25902,7 +25902,7 @@ var FailedRunnerRetryLedger = class {
|
|
|
25902
25902
|
function readRunnerPackageVersions(addonDirs) {
|
|
25903
25903
|
const out = {};
|
|
25904
25904
|
for (const dir of addonDirs) try {
|
|
25905
|
-
const raw = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
25905
|
+
const raw = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
25906
25906
|
const version = typeof raw === "object" && raw !== null ? Reflect.get(raw, "version") : null;
|
|
25907
25907
|
out[dir] = typeof version === "string" && version.length > 0 ? version : null;
|
|
25908
25908
|
} catch {
|
|
@@ -25963,7 +25963,7 @@ function readAddonHeapDeclaration(spec) {
|
|
|
25963
25963
|
if (cached !== void 0) return cached;
|
|
25964
25964
|
let declaration = EMPTY_HEAP_DECLARATION;
|
|
25965
25965
|
for (const manifestPath of [path$1.join(spec.addonDir, "package.json"), path$1.join(path$1.dirname(spec.addonDir), "package.json")]) try {
|
|
25966
|
-
const raw = fs.readFileSync(manifestPath, "utf8");
|
|
25966
|
+
const raw = fs$1.readFileSync(manifestPath, "utf8");
|
|
25967
25967
|
const parsed = JSON.parse(raw);
|
|
25968
25968
|
const profile = extractHeapProfile(parsed, spec.addonId);
|
|
25969
25969
|
const maxOldSpaceMb = extractMaxOldSpaceMb(parsed, spec.addonId);
|
|
@@ -27185,17 +27185,17 @@ var JobJournal = class {
|
|
|
27185
27185
|
return path$1.join(this.jobsDir, `${id}.json`);
|
|
27186
27186
|
}
|
|
27187
27187
|
writeAtomic(filePath, data) {
|
|
27188
|
-
fs.mkdirSync(path$1.dirname(filePath), { recursive: true });
|
|
27188
|
+
fs$1.mkdirSync(path$1.dirname(filePath), { recursive: true });
|
|
27189
27189
|
const tmp = `${filePath}.tmp.${process.pid}.${Date.now()}`;
|
|
27190
|
-
fs.writeFileSync(tmp, JSON.stringify(data, null, 2), {
|
|
27190
|
+
fs$1.writeFileSync(tmp, JSON.stringify(data, null, 2), {
|
|
27191
27191
|
encoding: "utf-8",
|
|
27192
27192
|
mode: 384
|
|
27193
27193
|
});
|
|
27194
|
-
fs.renameSync(tmp, filePath);
|
|
27194
|
+
fs$1.renameSync(tmp, filePath);
|
|
27195
27195
|
}
|
|
27196
27196
|
readIndex() {
|
|
27197
27197
|
try {
|
|
27198
|
-
const raw = JSON.parse(fs.readFileSync(this.indexPath, "utf-8"));
|
|
27198
|
+
const raw = JSON.parse(fs$1.readFileSync(this.indexPath, "utf-8"));
|
|
27199
27199
|
if (raw && Array.isArray(raw.jobIds)) return {
|
|
27200
27200
|
version: 1,
|
|
27201
27201
|
jobIds: raw.jobIds
|
|
@@ -27220,7 +27220,7 @@ var JobJournal = class {
|
|
|
27220
27220
|
}
|
|
27221
27221
|
getJob(id) {
|
|
27222
27222
|
try {
|
|
27223
|
-
const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs.readFileSync(this.jobPath(id), "utf-8")));
|
|
27223
|
+
const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs$1.readFileSync(this.jobPath(id), "utf-8")));
|
|
27224
27224
|
return parsed.success ? parsed.data : null;
|
|
27225
27225
|
} catch {
|
|
27226
27226
|
return null;
|
|
@@ -27285,14 +27285,14 @@ var StagingArea = class {
|
|
|
27285
27285
|
}
|
|
27286
27286
|
async fetchAndStage(input) {
|
|
27287
27287
|
const destDir = path$1.join(this.stagingDir, input.jobId, safeSegment(input.name));
|
|
27288
|
-
fs.rmSync(destDir, {
|
|
27288
|
+
fs$1.rmSync(destDir, {
|
|
27289
27289
|
recursive: true,
|
|
27290
27290
|
force: true
|
|
27291
27291
|
});
|
|
27292
27292
|
const tgz = await this.deps.fetchTarball(input.name, input.version, input.signal);
|
|
27293
27293
|
if (input.signal.aborted) throw new Error("staging aborted after fetch");
|
|
27294
27294
|
await this.deps.extract(tgz, destDir);
|
|
27295
|
-
const raw = JSON.parse(fs.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
|
|
27295
|
+
const raw = JSON.parse(fs$1.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
|
|
27296
27296
|
if (typeof raw.version !== "string" || raw.version.length === 0) throw new Error(`staging validation failed: ${input.name} staged a package.json with no version`);
|
|
27297
27297
|
if (EXACT_SEMVER.test(input.version) && raw.version !== input.version) throw new Error(`staging validation failed: ${input.name} expected version ${input.version}, got ${raw.version}`);
|
|
27298
27298
|
return {
|
|
@@ -27301,7 +27301,7 @@ var StagingArea = class {
|
|
|
27301
27301
|
};
|
|
27302
27302
|
}
|
|
27303
27303
|
cleanup(jobId) {
|
|
27304
|
-
fs.rmSync(path$1.join(this.stagingDir, jobId), {
|
|
27304
|
+
fs$1.rmSync(path$1.join(this.stagingDir, jobId), {
|
|
27305
27305
|
recursive: true,
|
|
27306
27306
|
force: true
|
|
27307
27307
|
});
|
|
@@ -27316,13 +27316,13 @@ var StagingArea = class {
|
|
|
27316
27316
|
sweepOrphans() {
|
|
27317
27317
|
let entries;
|
|
27318
27318
|
try {
|
|
27319
|
-
entries = fs.readdirSync(this.stagingDir);
|
|
27319
|
+
entries = fs$1.readdirSync(this.stagingDir);
|
|
27320
27320
|
} catch {
|
|
27321
27321
|
return 0;
|
|
27322
27322
|
}
|
|
27323
27323
|
let removed = 0;
|
|
27324
27324
|
for (const name of entries) try {
|
|
27325
|
-
fs.rmSync(path$1.join(this.stagingDir, name), {
|
|
27325
|
+
fs$1.rmSync(path$1.join(this.stagingDir, name), {
|
|
27326
27326
|
recursive: true,
|
|
27327
27327
|
force: true
|
|
27328
27328
|
});
|
|
@@ -27500,7 +27500,7 @@ var LifecycleJobEngine = class {
|
|
|
27500
27500
|
* on failure → `failed`.
|
|
27501
27501
|
*/
|
|
27502
27502
|
async reconcileJob(job) {
|
|
27503
|
-
const exists = this.deps.stagedPathExists ?? ((p) => fs.existsSync(p));
|
|
27503
|
+
const exists = this.deps.stagedPathExists ?? ((p) => fs$1.existsSync(p));
|
|
27504
27504
|
for (const task of job.tasks) {
|
|
27505
27505
|
if (task.target === "framework") {
|
|
27506
27506
|
if (!this.isTerminal(task.phase)) this.skipFrameworkTask(job, task);
|
|
@@ -28141,7 +28141,7 @@ var CatalogRegistry = class {
|
|
|
28141
28141
|
const file = path$1.join(packageDir, "i18n", `${lang}.json`);
|
|
28142
28142
|
let text;
|
|
28143
28143
|
try {
|
|
28144
|
-
text = fs.readFileSync(file, "utf8");
|
|
28144
|
+
text = fs$1.readFileSync(file, "utf8");
|
|
28145
28145
|
} catch {
|
|
28146
28146
|
continue;
|
|
28147
28147
|
}
|