@camstack/server 1.2.731 → 1.2.733
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 +13 -0
- package/dist/api/core/cap-providers.js +1 -0
- package/dist/api/core/logging-settings.js +88 -1
- package/dist/api/trpc/generated-cap-routers.js +49 -0
- package/dist/core/addon/addon-registry.service.js +61 -59
- package/package.json +11 -19
- package/system/dist/addon-runner.js +1 -0
- package/system/dist/addon-runner.mjs +2 -1
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/{agent-https-AJPmB73W.mjs → agent-https-D3dptveB.mjs} +1 -1
- package/system/dist/{agent-https-CLJhq0GZ.js → agent-https-v5uyVgpk.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 +2 -2
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
- 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 +220 -16
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +220 -16
- package/system/dist/builtins/device-manager/discovery-proposal-service.d.ts +38 -0
- package/system/dist/builtins/device-manager/discovery-proposal-store.d.ts +28 -0
- package/system/dist/builtins/device-manager/record-kinds.d.ts +2 -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.d.ts +10 -0
- package/system/dist/builtins/local-network/local-network.addon.js +297 -190
- package/system/dist/builtins/local-network/local-network.addon.mjs +294 -187
- package/system/dist/builtins/local-network/passive/discovery-watcher.d.ts +60 -0
- package/system/dist/builtins/local-network/passive/passive-io-node.d.ts +2 -0
- package/system/dist/builtins/local-network/passive/passive-packets.d.ts +10 -0
- package/system/dist/builtins/local-network/scan/dns-wire.d.ts +6 -2
- package/system/dist/builtins/local-network/scan/scan-engine.d.ts +1 -1
- package/system/dist/builtins/local-network/scan/scan-io.d.ts +6 -0
- 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 +115 -115
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{composition-sources-D-S2hhdw.mjs → composition-sources-Dnyu7-1p.mjs} +1 -1
- package/system/dist/{composition-sources-BNBlJAgu.js → composition-sources-j_bFq7Tx.js} +1 -1
- package/system/dist/{constants-CKwdQTnw.js → constants-C6zJ_38f.js} +1 -1
- package/system/dist/{constants-DmithOex.mjs → constants-GDBin8zB.mjs} +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-D-Cvxobt.mjs → device-ca-Bpqrad00.mjs} +1 -1
- package/system/dist/{device-ca-TbdQfW4d.js → device-ca-CV9QZvoy.js} +1 -1
- package/system/dist/{dist-dQKZfa3-.js → dist-CwYYyGAB.js} +227 -3
- package/system/dist/{dist-yrk6fm65.mjs → dist-DcHvuBfD.mjs} +210 -4
- package/system/dist/dns-wire-CqgMi_uB.js +202 -0
- package/system/dist/dns-wire-DO56tOHL.mjs +173 -0
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-Cae5VWUc.mjs → hub-mdns-ciao-D2sU6sKd.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-DP3_GNZw.js → hub-mdns-ciao-DNLnbJNG.js} +2 -2
- package/system/dist/index.js +24 -7
- package/system/dist/index.mjs +236 -219
- package/system/dist/{restore-archive-BJ5gxMvf.mjs → restore-archive-BGK6EnYj.mjs} +94 -94
- package/system/dist/{restore-archive-X9c_wEBY.js → restore-archive-xTqhDFkW.js} +1 -1
- package/system/dist/{retention-DBrdAv12.mjs → retention-CXu8PB2L.mjs} +1 -1
- package/system/dist/{retention-DRT2wUyB.js → retention-gQ3GIUA3.js} +1 -1
- package/system/dist/{wal-maintenance-Bi4yImEY.mjs → wal-maintenance-D7XmFaUD.mjs} +0 -0
- package/system/dist/{wal-maintenance-hsgNGrjh.js → wal-maintenance-Hwzm3DCe.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 {
|
|
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 { As as readinessKey, Dr as interpolate, Ds as parseJsonObject, E as CatalogFileSchema, Go as asJsonObject$1, Hs as withoutCallerStamp, Ko as asNumber, Ks as errMsg$1, Lr as isObjectInput, Mo as ReadinessRegistry, Mr as isCollectionArrayMethod, Ms as resolveCapMount, No as ReadinessTimeoutError, Oi as procedureAuthKey, Os as parseJsonUnknown, Ps as scopeKey, Qi as scopesAllowDeviceCap, Qr as looseSchema, Rr as isVoidInput, Ui as resolveMethodAuth, Vs as userError, Wr as lifecycleJobSchema, Zi as scopesAllowAddon, Zr as logLevelAtMost, a as AGENT_MDNS_TXT_KEYS, an as addonSettingsCapability, as as emitDownForOwnedCaps, bt as METHOD_ACCESS_MAP, ca as splitTranslationRef, ga as supportedRuntimes, go as DEVICE_STATUS_METHOD, hi as objectInputDeclaresRequiredDeviceId, ho as DEVICE_SETTINGS_CONTRIBUTION_METHODS, i as AGENT_MDNS_SERVICE_TYPE, is as defineRecordKinds, jo as RUNTIME_DEFAULTS, jr as isArrayOutputSchema, ls as getDebugInterest, mi as objectInputDeclaresAddonId, mo as DATAPLANE_SECRET_HEADER$1, mr as extractNestedAddonId, o as ALL_CAPABILITY_DEFINITIONS, po as CALLER_STAMPED_CAPABILITIES$1, ps as isDebugChannelName, qo as asString$1, qs as EventCategory$1, ss as expandCapMethods, ts as createEvent$1, vt as LOG_LEVEL_RANK, y as CATALOG_LANGS, zr as kebabToCamel$1 } from "./dist-DcHvuBfD.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-Bpqrad00.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-D7XmFaUD.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-D3dptveB.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-GDBin8zB.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-D2sU6sKd.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-BGK6EnYj.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";
|
|
@@ -54,8 +54,8 @@ import { promisify } from "node:util";
|
|
|
54
54
|
import * as os$1 from "node:os";
|
|
55
55
|
import { tmpdir } from "node:os";
|
|
56
56
|
import { pathToFileURL } from "node:url";
|
|
57
|
-
import { BOOT_RECOVERY_BACKOFF_MS, CALLER_STAMPED_CAPABILITIES, DATAPLANE_SECRET_HEADER, DEVICE_CHILDREN_BATCH_MAX, DeviceType, DisposerChain, ErrorI18nPayloadSchema, EventCategory, PEER_BYTES_CHUNK_BYTES, PEER_BYTES_MAX_OUTSTANDING, PEER_BYTES_STALL_MS, PEER_BYTES_TICKET_TTL_MS, ReadinessRegistry as ReadinessRegistry$1, addonSliceHandleApi, asJsonObject, asString, collectZodSecretPaths, createDeviceProxy, createEvent, createEventBusSliceSource, createRecordsAccess, createSecretsAccess, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods as expandCapMethods$1, maskUrlCredentials, readErrorI18n, readNodePin, scopeKey as scopeKey$1, scrubKnownSecrets, sleep, withCapInputDefaults } from "@camstack/types/addon";
|
|
58
|
-
import * as fs from "node:fs";
|
|
57
|
+
import { BOOT_RECOVERY_BACKOFF_MS, CALLER_STAMPED_CAPABILITIES, DATAPLANE_SECRET_HEADER, DEVICE_CHILDREN_BATCH_MAX, DeviceType, DisposerChain, ErrorI18nPayloadSchema, EventCategory, PEER_BYTES_CHUNK_BYTES, PEER_BYTES_MAX_OUTSTANDING, PEER_BYTES_STALL_MS, PEER_BYTES_TICKET_TTL_MS, ReadinessRegistry as ReadinessRegistry$1, addonSliceHandleApi, asJsonObject, asString, collectZodSecretPaths, createDebugEmitter, createDeviceProxy, createEvent, createEventBusSliceSource, createRecordsAccess, createSecretsAccess, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods as expandCapMethods$1, maskUrlCredentials, readErrorI18n, readNodePin, scopeKey as scopeKey$1, scrubKnownSecrets, sleep, withCapInputDefaults } from "@camstack/types/addon";
|
|
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";
|
|
@@ -3986,6 +3986,17 @@ function matchesLogTags(entryTags, filterTags) {
|
|
|
3986
3986
|
}
|
|
3987
3987
|
return true;
|
|
3988
3988
|
}
|
|
3989
|
+
/**
|
|
3990
|
+
* A `debug.<channel>` line enters the ring only while somebody is watching
|
|
3991
|
+
* that device — a disabled channel never costs ring space. Every other line
|
|
3992
|
+
* is admitted unchanged.
|
|
3993
|
+
*/
|
|
3994
|
+
function admitsDebugLine(entry) {
|
|
3995
|
+
const channel = entry.tags?.logChannel;
|
|
3996
|
+
if (channel === void 0 || !isDebugChannelName(channel)) return true;
|
|
3997
|
+
const deviceId = entry.tags?.deviceId;
|
|
3998
|
+
return typeof deviceId === "number" && getDebugInterest().wants(channel, deviceId);
|
|
3999
|
+
}
|
|
3989
4000
|
var LogRingBuffer = class {
|
|
3990
4001
|
capacity;
|
|
3991
4002
|
buffer;
|
|
@@ -3996,6 +4007,7 @@ var LogRingBuffer = class {
|
|
|
3996
4007
|
this.buffer = Array.from({ length: capacity });
|
|
3997
4008
|
}
|
|
3998
4009
|
push(entry) {
|
|
4010
|
+
if (!admitsDebugLine(entry)) return;
|
|
3999
4011
|
this.buffer[this.head] = entry;
|
|
4000
4012
|
this.head = (this.head + 1) % this.capacity;
|
|
4001
4013
|
if (this.count < this.capacity) this.count++;
|
|
@@ -5101,7 +5113,7 @@ var PythonEnvManager = class {
|
|
|
5101
5113
|
async ensure(options) {
|
|
5102
5114
|
const probe = await this.probe();
|
|
5103
5115
|
if (!probe.available || !probe.path) throw userError("system.python-required", void 0, "Python 3.10+ is required but not found on this system");
|
|
5104
|
-
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, [
|
|
5105
5117
|
"-m",
|
|
5106
5118
|
"venv",
|
|
5107
5119
|
this.venvPath
|
|
@@ -5124,7 +5136,7 @@ var PythonEnvManager = class {
|
|
|
5124
5136
|
}
|
|
5125
5137
|
spawn(script, args) {
|
|
5126
5138
|
const venvPython = path$1.join(this.venvPath, "bin", "python");
|
|
5127
|
-
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.");
|
|
5128
5140
|
return spawn(venvPython, [script, ...args]);
|
|
5129
5141
|
}
|
|
5130
5142
|
};
|
|
@@ -5476,20 +5488,20 @@ var StorageManager = class {
|
|
|
5476
5488
|
const basePath = this.locationManager.getBackend(mappedName).basePath;
|
|
5477
5489
|
location.files = {
|
|
5478
5490
|
async readFile(p) {
|
|
5479
|
-
return fs.promises.readFile(path$1.join(basePath, p));
|
|
5491
|
+
return fs$1.promises.readFile(path$1.join(basePath, p));
|
|
5480
5492
|
},
|
|
5481
5493
|
async writeFile(p, data) {
|
|
5482
5494
|
const full = path$1.join(basePath, p);
|
|
5483
|
-
await fs.promises.mkdir(path$1.dirname(full), { recursive: true });
|
|
5484
|
-
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);
|
|
5485
5497
|
},
|
|
5486
5498
|
async deleteFile(p) {
|
|
5487
|
-
await fs.promises.rm(path$1.join(basePath, p), { force: true });
|
|
5499
|
+
await fs$1.promises.rm(path$1.join(basePath, p), { force: true });
|
|
5488
5500
|
},
|
|
5489
5501
|
async listFiles(prefix) {
|
|
5490
5502
|
const dir = prefix ? path$1.join(basePath, prefix) : basePath;
|
|
5491
5503
|
try {
|
|
5492
|
-
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);
|
|
5493
5505
|
} catch {
|
|
5494
5506
|
return [];
|
|
5495
5507
|
}
|
|
@@ -5499,7 +5511,7 @@ var StorageManager = class {
|
|
|
5499
5511
|
},
|
|
5500
5512
|
async exists(p) {
|
|
5501
5513
|
try {
|
|
5502
|
-
await fs.promises.access(path$1.join(basePath, p));
|
|
5514
|
+
await fs$1.promises.access(path$1.join(basePath, p));
|
|
5503
5515
|
return true;
|
|
5504
5516
|
} catch {
|
|
5505
5517
|
return false;
|
|
@@ -6270,7 +6282,7 @@ var TRADITIONAL_NATIVE_PACKAGES = ["better-sqlite3"];
|
|
|
6270
6282
|
function hasDotNode(dir, maxDepth) {
|
|
6271
6283
|
let entries;
|
|
6272
6284
|
try {
|
|
6273
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
6285
|
+
entries = fs$1.readdirSync(dir, { withFileTypes: true });
|
|
6274
6286
|
} catch {
|
|
6275
6287
|
return false;
|
|
6276
6288
|
}
|
|
@@ -6281,7 +6293,7 @@ function hasDotNode(dir, maxDepth) {
|
|
|
6281
6293
|
}
|
|
6282
6294
|
/** Locate the bundled `prebuild-install` bin.js inside the staged closure. */
|
|
6283
6295
|
function resolvePrebuildInstallBin(closureDir, moduleDir) {
|
|
6284
|
-
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;
|
|
6296
|
+
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;
|
|
6285
6297
|
}
|
|
6286
6298
|
/**
|
|
6287
6299
|
* Default fetcher: run the closure's own `prebuild-install` under the CURRENT
|
|
@@ -6334,7 +6346,7 @@ async function ensureNativePrebuilds(closureDir, options) {
|
|
|
6334
6346
|
const fetched = [];
|
|
6335
6347
|
for (const pkg of packages) {
|
|
6336
6348
|
const moduleDir = path$1.join(nm, pkg);
|
|
6337
|
-
if (!fs.existsSync(moduleDir)) continue;
|
|
6349
|
+
if (!fs$1.existsSync(moduleDir)) continue;
|
|
6338
6350
|
if (hasDotNode(moduleDir, 4)) continue;
|
|
6339
6351
|
options.logger.warn("staged closure native prebuild missing — fetching for running ABI", { meta: {
|
|
6340
6352
|
pkg,
|
|
@@ -6397,12 +6409,12 @@ async function ensureNativePrebuilds(closureDir, options) {
|
|
|
6397
6409
|
function replantFromBundled(srcModuleDir, dstModuleDir, hasNative) {
|
|
6398
6410
|
if (!hasNative(srcModuleDir)) return false;
|
|
6399
6411
|
try {
|
|
6400
|
-
fs.rmSync(dstModuleDir, {
|
|
6412
|
+
fs$1.rmSync(dstModuleDir, {
|
|
6401
6413
|
recursive: true,
|
|
6402
6414
|
force: true
|
|
6403
6415
|
});
|
|
6404
|
-
fs.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
|
|
6405
|
-
fs.cpSync(srcModuleDir, dstModuleDir, {
|
|
6416
|
+
fs$1.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
|
|
6417
|
+
fs$1.cpSync(srcModuleDir, dstModuleDir, {
|
|
6406
6418
|
recursive: true,
|
|
6407
6419
|
dereference: true
|
|
6408
6420
|
});
|
|
@@ -6431,7 +6443,7 @@ async function ensureAddonNativePrebuilds(addonDir, options) {
|
|
|
6431
6443
|
const missing = [];
|
|
6432
6444
|
for (const pkg of packages) {
|
|
6433
6445
|
const moduleDir = path$1.join(nm, pkg);
|
|
6434
|
-
if (!fs.existsSync(moduleDir)) continue;
|
|
6446
|
+
if (!fs$1.existsSync(moduleDir)) continue;
|
|
6435
6447
|
if (hasNative(moduleDir)) {
|
|
6436
6448
|
results.push({
|
|
6437
6449
|
pkg,
|
|
@@ -6530,7 +6542,7 @@ async function defaultDownloadTarball(url, destTgz) {
|
|
|
6530
6542
|
const res = await fetch(url);
|
|
6531
6543
|
if (!res.ok || !res.body) throw new Error(`HTTP ${res.status} downloading ${url}`);
|
|
6532
6544
|
const bytes = Buffer.from(await res.arrayBuffer());
|
|
6533
|
-
await fs.promises.writeFile(destTgz, bytes);
|
|
6545
|
+
await fs$1.promises.writeFile(destTgz, bytes);
|
|
6534
6546
|
}
|
|
6535
6547
|
async function defaultExtractTarball(tgzPath, destDir) {
|
|
6536
6548
|
await execFileAsync$5("tar", [
|
|
@@ -6616,7 +6628,7 @@ async function resolveUncached(options) {
|
|
|
6616
6628
|
argsPrefix: []
|
|
6617
6629
|
};
|
|
6618
6630
|
const cliPath = bootstrappedCliPath(options.cacheDir);
|
|
6619
|
-
if (fs.existsSync(cliPath)) {
|
|
6631
|
+
if (fs$1.existsSync(cliPath)) {
|
|
6620
6632
|
options.logger.info("system npm unavailable — using bootstrapped npm", { meta: { cliPath } });
|
|
6621
6633
|
return {
|
|
6622
6634
|
command: process.execPath,
|
|
@@ -6628,12 +6640,12 @@ async function resolveUncached(options) {
|
|
|
6628
6640
|
const registry = (options.registry ?? DEFAULT_REGISTRY).replace(/\/+$/, "");
|
|
6629
6641
|
const tarballUrl = tarballUrlOf(await (options.fetchJson ?? defaultFetchJson)(`${registry}/npm/latest`));
|
|
6630
6642
|
if (!tarballUrl) throw new Error(`registry metadata for 'npm' carries no dist.tarball (${registry})`);
|
|
6631
|
-
await fs.promises.mkdir(options.cacheDir, { recursive: true });
|
|
6643
|
+
await fs$1.promises.mkdir(options.cacheDir, { recursive: true });
|
|
6632
6644
|
const tgzPath = path$1.join(options.cacheDir, "npm-bootstrap.tgz");
|
|
6633
6645
|
await (options.downloadTarball ?? defaultDownloadTarball)(tarballUrl, tgzPath);
|
|
6634
6646
|
await (options.extractTarball ?? defaultExtractTarball)(tgzPath, options.cacheDir);
|
|
6635
|
-
await fs.promises.rm(tgzPath, { force: true });
|
|
6636
|
-
if (!fs.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
|
|
6647
|
+
await fs$1.promises.rm(tgzPath, { force: true });
|
|
6648
|
+
if (!fs$1.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
|
|
6637
6649
|
options.logger.info("npm bootstrapped", { meta: { cliPath } });
|
|
6638
6650
|
return {
|
|
6639
6651
|
command: process.execPath,
|
|
@@ -6699,7 +6711,7 @@ function readOwningPackageVersion(entryPath) {
|
|
|
6699
6711
|
let dir = path$1.dirname(entryPath);
|
|
6700
6712
|
for (let hop = 0; hop < PACKAGE_JSON_LOOKUP_DEPTH; hop++) {
|
|
6701
6713
|
try {
|
|
6702
|
-
const version = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
|
|
6714
|
+
const version = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
|
|
6703
6715
|
if (typeof version === "string" && version.length > 0) return version;
|
|
6704
6716
|
} catch {}
|
|
6705
6717
|
const parent = path$1.dirname(dir);
|
|
@@ -6743,14 +6755,14 @@ function readOwningPackageVersion(entryPath) {
|
|
|
6743
6755
|
function addonModuleCacheKey(entryPath) {
|
|
6744
6756
|
let stat;
|
|
6745
6757
|
try {
|
|
6746
|
-
stat = fs.statSync(entryPath);
|
|
6758
|
+
stat = fs$1.statSync(entryPath);
|
|
6747
6759
|
} catch {
|
|
6748
6760
|
return null;
|
|
6749
6761
|
}
|
|
6750
6762
|
const version = readOwningPackageVersion(entryPath) ?? `m${stat.mtimeMs}`;
|
|
6751
6763
|
let content;
|
|
6752
6764
|
try {
|
|
6753
|
-
content = createHash("sha1").update(fs.readFileSync(entryPath)).digest("hex").slice(0, 16);
|
|
6765
|
+
content = createHash("sha1").update(fs$1.readFileSync(entryPath)).digest("hex").slice(0, 16);
|
|
6754
6766
|
} catch {
|
|
6755
6767
|
content = `m${stat.mtimeMs}s${stat.size}`;
|
|
6756
6768
|
}
|
|
@@ -6854,14 +6866,14 @@ var AddonLoader = class {
|
|
|
6854
6866
|
* BUILTINS from the active closure, not the (now-inert) addons-dir copy, so
|
|
6855
6867
|
* the addons-dir `@camstack/server/system` must NOT be double-loaded here. */
|
|
6856
6868
|
async loadFromDirectory(addonsDir, skipPackages = []) {
|
|
6857
|
-
if (!fs.existsSync(addonsDir)) return;
|
|
6869
|
+
if (!fs$1.existsSync(addonsDir)) return;
|
|
6858
6870
|
const skip = new Set(skipPackages);
|
|
6859
|
-
const entries = fs.readdirSync(addonsDir, { withFileTypes: true });
|
|
6871
|
+
const entries = fs$1.readdirSync(addonsDir, { withFileTypes: true });
|
|
6860
6872
|
for (const entry of entries) {
|
|
6861
6873
|
if (!isDirectoryEntry(entry, addonsDir)) continue;
|
|
6862
6874
|
if (entry.name.startsWith("@")) {
|
|
6863
6875
|
const scopeDir = path$1.join(addonsDir, entry.name);
|
|
6864
|
-
const scopeEntries = fs.readdirSync(scopeDir, { withFileTypes: true });
|
|
6876
|
+
const scopeEntries = fs$1.readdirSync(scopeDir, { withFileTypes: true });
|
|
6865
6877
|
for (const scopeEntry of scopeEntries) {
|
|
6866
6878
|
if (!isDirectoryEntry(scopeEntry, scopeDir)) continue;
|
|
6867
6879
|
if (skip.has(`${entry.name}/${scopeEntry.name}`)) continue;
|
|
@@ -6875,7 +6887,7 @@ var AddonLoader = class {
|
|
|
6875
6887
|
}
|
|
6876
6888
|
async tryLoadAddon(addonDir) {
|
|
6877
6889
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
6878
|
-
if (!fs.existsSync(pkgJsonPath)) return;
|
|
6890
|
+
if (!fs$1.existsSync(pkgJsonPath)) return;
|
|
6879
6891
|
try {
|
|
6880
6892
|
await this.loadFromAddonDir(addonDir);
|
|
6881
6893
|
} catch (err) {
|
|
@@ -6893,7 +6905,7 @@ var AddonLoader = class {
|
|
|
6893
6905
|
/** Load addon from a specific directory (package.json + dist/) */
|
|
6894
6906
|
async loadFromAddonDir(addonDir) {
|
|
6895
6907
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
6896
|
-
const pkgJson = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
6908
|
+
const pkgJson = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
6897
6909
|
const packageNameRaw = pkgJson["name"];
|
|
6898
6910
|
const packageName = typeof packageNameRaw === "string" ? packageNameRaw : "";
|
|
6899
6911
|
const packageVersionRaw = pkgJson["version"];
|
|
@@ -6940,7 +6952,7 @@ var AddonLoader = class {
|
|
|
6940
6952
|
}
|
|
6941
6953
|
const entryFile = declaration.entry.replace(/^\.\//, "").replace(/^src\//, "dist/").replace(/\.ts$/, ".js");
|
|
6942
6954
|
let entryPath = path$1.resolve(addonDir, entryFile);
|
|
6943
|
-
if (!fs.existsSync(entryPath)) {
|
|
6955
|
+
if (!fs$1.existsSync(entryPath)) {
|
|
6944
6956
|
const base = entryPath.replace(/\.(js|cjs|mjs)$/, "");
|
|
6945
6957
|
entryPath = [
|
|
6946
6958
|
`${base}.cjs`,
|
|
@@ -6949,9 +6961,9 @@ var AddonLoader = class {
|
|
|
6949
6961
|
path$1.resolve(addonDir, "dist", "index.cjs"),
|
|
6950
6962
|
path$1.resolve(addonDir, "dist", "index.mjs"),
|
|
6951
6963
|
path$1.resolve(addonDir, declaration.entry)
|
|
6952
|
-
].find((p) => fs.existsSync(p)) ?? entryPath;
|
|
6964
|
+
].find((p) => fs$1.existsSync(p)) ?? entryPath;
|
|
6953
6965
|
}
|
|
6954
|
-
if (!fs.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
|
|
6966
|
+
if (!fs$1.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
|
|
6955
6967
|
const modUnknown = await importAddonModuleFresh(entryPath);
|
|
6956
6968
|
const mod = isRecord$4(modUnknown) ? modUnknown : {};
|
|
6957
6969
|
const AddonClass = resolveAddonClass(mod);
|
|
@@ -7036,7 +7048,7 @@ function isDirectoryEntry(entry, parentDir) {
|
|
|
7036
7048
|
if (entry.name.startsWith(".")) return false;
|
|
7037
7049
|
if (entry.isDirectory()) return true;
|
|
7038
7050
|
if (entry.isSymbolicLink()) try {
|
|
7039
|
-
return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
7051
|
+
return fs$1.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
7040
7052
|
} catch {
|
|
7041
7053
|
return false;
|
|
7042
7054
|
}
|
|
@@ -7130,7 +7142,7 @@ var execFileAsync$4 = promisify(execFile);
|
|
|
7130
7142
|
* Single source of truth — replaces scattered mkdirSync calls.
|
|
7131
7143
|
*/
|
|
7132
7144
|
function ensureDir(dirPath) {
|
|
7133
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
|
7145
|
+
fs$1.mkdirSync(dirPath, { recursive: true });
|
|
7134
7146
|
}
|
|
7135
7147
|
/**
|
|
7136
7148
|
* Copy a directory recursively — ASYNC so it never blocks the event loop.
|
|
@@ -7143,7 +7155,7 @@ function ensureDir(dirPath) {
|
|
|
7143
7155
|
* `fs.promises.cp` keeps the I/O off the event loop. (Node ≥18 stable.)
|
|
7144
7156
|
*/
|
|
7145
7157
|
async function copyDirRecursive(src, dest) {
|
|
7146
|
-
await fs.promises.cp(src, dest, {
|
|
7158
|
+
await fs$1.promises.cp(src, dest, {
|
|
7147
7159
|
recursive: true,
|
|
7148
7160
|
force: true
|
|
7149
7161
|
});
|
|
@@ -7248,13 +7260,13 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
7248
7260
|
if (typeof fileEntry !== "string") continue;
|
|
7249
7261
|
if (fileEntry === "dist" || fileEntry.includes("*")) continue;
|
|
7250
7262
|
const srcPath = path$1.join(sourceDir, fileEntry);
|
|
7251
|
-
if (!fs.existsSync(srcPath)) continue;
|
|
7263
|
+
if (!fs$1.existsSync(srcPath)) continue;
|
|
7252
7264
|
const destPath = path$1.join(destDir, fileEntry);
|
|
7253
|
-
const stat = await fs.promises.stat(srcPath);
|
|
7265
|
+
const stat = await fs$1.promises.stat(srcPath);
|
|
7254
7266
|
if (stat.isDirectory()) await copyDirRecursive(srcPath, destPath);
|
|
7255
7267
|
else if (stat.isFile()) {
|
|
7256
7268
|
ensureDir(path$1.dirname(destPath));
|
|
7257
|
-
await fs.promises.copyFile(srcPath, destPath);
|
|
7269
|
+
await fs$1.promises.copyFile(srcPath, destPath);
|
|
7258
7270
|
}
|
|
7259
7271
|
}
|
|
7260
7272
|
}
|
|
@@ -7265,10 +7277,10 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
7265
7277
|
function isSourceNewer(packageDir) {
|
|
7266
7278
|
const srcDir = path$1.join(packageDir, "src");
|
|
7267
7279
|
const distDir = path$1.join(packageDir, "dist");
|
|
7268
|
-
if (!fs.existsSync(srcDir) || !fs.existsSync(distDir)) return true;
|
|
7280
|
+
if (!fs$1.existsSync(srcDir) || !fs$1.existsSync(distDir)) return true;
|
|
7269
7281
|
try {
|
|
7270
|
-
const distMtime = fs.statSync(distDir).mtimeMs;
|
|
7271
|
-
const entries = fs.readdirSync(srcDir, {
|
|
7282
|
+
const distMtime = fs$1.statSync(distDir).mtimeMs;
|
|
7283
|
+
const entries = fs$1.readdirSync(srcDir, {
|
|
7272
7284
|
withFileTypes: true,
|
|
7273
7285
|
recursive: true
|
|
7274
7286
|
});
|
|
@@ -7276,7 +7288,7 @@ function isSourceNewer(packageDir) {
|
|
|
7276
7288
|
if (!entry.isFile()) continue;
|
|
7277
7289
|
const parentDir = entry.parentPath ?? String(Reflect.get(entry, "path") ?? "");
|
|
7278
7290
|
const filePath = path$1.join(parentDir, entry.name);
|
|
7279
|
-
if (fs.statSync(filePath).mtimeMs > distMtime) return true;
|
|
7291
|
+
if (fs$1.statSync(filePath).mtimeMs > distMtime) return true;
|
|
7280
7292
|
}
|
|
7281
7293
|
return false;
|
|
7282
7294
|
} catch {
|
|
@@ -7293,7 +7305,7 @@ function isSourceNewer(packageDir) {
|
|
|
7293
7305
|
* `copyDirRecursive` for the wedge this prevents.
|
|
7294
7306
|
*/
|
|
7295
7307
|
async function installPackageFromNpm(packageName, targetDir) {
|
|
7296
|
-
const tmpDir = await fs.promises.mkdtemp(path$1.join(os$1.tmpdir(), "camstack-install-"));
|
|
7308
|
+
const tmpDir = await fs$1.promises.mkdtemp(path$1.join(os$1.tmpdir(), "camstack-install-"));
|
|
7297
7309
|
try {
|
|
7298
7310
|
const { stdout } = await execFileAsync$4("npm", [
|
|
7299
7311
|
"pack",
|
|
@@ -7316,21 +7328,21 @@ async function installPackageFromNpm(packageName, targetDir) {
|
|
|
7316
7328
|
extractDir
|
|
7317
7329
|
], { timeout: 3e4 });
|
|
7318
7330
|
const packageSubDir = path$1.join(extractDir, "package");
|
|
7319
|
-
const srcPkgJsonDir = fs.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
|
|
7320
|
-
await fs.promises.rm(targetDir, {
|
|
7331
|
+
const srcPkgJsonDir = fs$1.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
|
|
7332
|
+
await fs$1.promises.rm(targetDir, {
|
|
7321
7333
|
recursive: true,
|
|
7322
7334
|
force: true
|
|
7323
7335
|
});
|
|
7324
7336
|
ensureDir(targetDir);
|
|
7325
|
-
await fs.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
|
|
7337
|
+
await fs$1.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
|
|
7326
7338
|
const distSrc = path$1.join(srcPkgJsonDir, "dist");
|
|
7327
|
-
if (fs.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
|
|
7339
|
+
if (fs$1.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
|
|
7328
7340
|
try {
|
|
7329
|
-
const npmPkg = asJsonObject$1(parseJsonUnknown(await fs.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
7341
|
+
const npmPkg = asJsonObject$1(parseJsonUnknown(await fs$1.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
7330
7342
|
if (npmPkg) await copyExtraFileDirs(npmPkg, srcPkgJsonDir, targetDir);
|
|
7331
7343
|
} catch {}
|
|
7332
7344
|
} finally {
|
|
7333
|
-
await fs.promises.rm(tmpDir, {
|
|
7345
|
+
await fs$1.promises.rm(tmpDir, {
|
|
7334
7346
|
recursive: true,
|
|
7335
7347
|
force: true
|
|
7336
7348
|
});
|
|
@@ -7355,7 +7367,7 @@ function packageDirName$1(declaredName) {
|
|
|
7355
7367
|
}
|
|
7356
7368
|
function isDirLike$1(p) {
|
|
7357
7369
|
try {
|
|
7358
|
-
return fs.statSync(p).isDirectory();
|
|
7370
|
+
return fs$1.statSync(p).isDirectory();
|
|
7359
7371
|
} catch {
|
|
7360
7372
|
return false;
|
|
7361
7373
|
}
|
|
@@ -7373,12 +7385,12 @@ var AddonManifest = class {
|
|
|
7373
7385
|
*/
|
|
7374
7386
|
read() {
|
|
7375
7387
|
if (this.cache != null) return this.cache;
|
|
7376
|
-
if (!fs.existsSync(this.manifestPath)) {
|
|
7388
|
+
if (!fs$1.existsSync(this.manifestPath)) {
|
|
7377
7389
|
this.cache = this.empty();
|
|
7378
7390
|
return this.cache;
|
|
7379
7391
|
}
|
|
7380
7392
|
try {
|
|
7381
|
-
const raw = fs.readFileSync(this.manifestPath, "utf-8");
|
|
7393
|
+
const raw = fs$1.readFileSync(this.manifestPath, "utf-8");
|
|
7382
7394
|
const parsed = JSON.parse(raw);
|
|
7383
7395
|
if (parsed.version !== MANIFEST_VERSION) {
|
|
7384
7396
|
process.stderr.write(`[AddonManifest] schema mismatch (file=${parsed.version} vs runtime=${MANIFEST_VERSION}); starting empty\n`);
|
|
@@ -7399,13 +7411,13 @@ var AddonManifest = class {
|
|
|
7399
7411
|
* a half-written file.
|
|
7400
7412
|
*/
|
|
7401
7413
|
write(manifest) {
|
|
7402
|
-
fs.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
|
|
7414
|
+
fs$1.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
|
|
7403
7415
|
const tmp = `${this.manifestPath}.tmp.${process.pid}.${Date.now()}`;
|
|
7404
|
-
fs.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
|
|
7416
|
+
fs$1.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
|
|
7405
7417
|
encoding: "utf-8",
|
|
7406
7418
|
mode: 384
|
|
7407
7419
|
});
|
|
7408
|
-
fs.renameSync(tmp, this.manifestPath);
|
|
7420
|
+
fs$1.renameSync(tmp, this.manifestPath);
|
|
7409
7421
|
this.cache = manifest;
|
|
7410
7422
|
}
|
|
7411
7423
|
/** Lookup a single addon's manifest entry, or `null` if not tracked. */
|
|
@@ -7480,22 +7492,22 @@ var AddonManifest = class {
|
|
|
7480
7492
|
* exactly what moved. Returns the total number of changes.
|
|
7481
7493
|
*/
|
|
7482
7494
|
reconcileFromDisk(addonsDir, onChange) {
|
|
7483
|
-
if (!fs.existsSync(addonsDir)) return 0;
|
|
7495
|
+
if (!fs$1.existsSync(addonsDir)) return 0;
|
|
7484
7496
|
const m = this.read();
|
|
7485
7497
|
let changes = 0;
|
|
7486
7498
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7487
7499
|
/** Package name → version, for every ADDON package actually installed. */
|
|
7488
7500
|
const onDisk = /* @__PURE__ */ new Map();
|
|
7489
|
-
for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7501
|
+
for (const scope of fs$1.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7490
7502
|
if (!scope.name.startsWith("@") || !isDirLike$1(path$1.join(addonsDir, scope.name))) continue;
|
|
7491
7503
|
const scopeDir = path$1.join(addonsDir, scope.name);
|
|
7492
|
-
for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7504
|
+
for (const pkg of fs$1.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7493
7505
|
if (!isDirLike$1(path$1.join(scopeDir, pkg.name))) continue;
|
|
7494
7506
|
const pkgJsonPath = path$1.join(scopeDir, pkg.name, "package.json");
|
|
7495
|
-
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
7507
|
+
if (!fs$1.existsSync(pkgJsonPath)) continue;
|
|
7496
7508
|
let pkgJson;
|
|
7497
7509
|
try {
|
|
7498
|
-
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
7510
|
+
const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
|
|
7499
7511
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
7500
7512
|
pkgJson = parsed;
|
|
7501
7513
|
} catch {
|
|
@@ -7566,28 +7578,28 @@ var AddonManifest = class {
|
|
|
7566
7578
|
migrateFromInstallSourceMarkers(addonsDir) {
|
|
7567
7579
|
const m = this.read();
|
|
7568
7580
|
if (Object.keys(m.addons).length > 0) return 0;
|
|
7569
|
-
if (!fs.existsSync(addonsDir)) return 0;
|
|
7581
|
+
if (!fs$1.existsSync(addonsDir)) return 0;
|
|
7570
7582
|
let migrated = 0;
|
|
7571
7583
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7572
|
-
for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7584
|
+
for (const scope of fs$1.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7573
7585
|
if (!scope.isDirectory() || !scope.name.startsWith("@")) continue;
|
|
7574
7586
|
const scopeDir = path$1.join(addonsDir, scope.name);
|
|
7575
|
-
for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7587
|
+
for (const pkg of fs$1.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7576
7588
|
if (!pkg.isDirectory()) continue;
|
|
7577
7589
|
const pkgDir = path$1.join(scopeDir, pkg.name);
|
|
7578
7590
|
const markerPath = path$1.join(pkgDir, ".install-source");
|
|
7579
7591
|
const pkgJsonPath = path$1.join(pkgDir, "package.json");
|
|
7580
|
-
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
7592
|
+
if (!fs$1.existsSync(pkgJsonPath)) continue;
|
|
7581
7593
|
let pkgJson;
|
|
7582
7594
|
try {
|
|
7583
|
-
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
7595
|
+
const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
|
|
7584
7596
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
7585
7597
|
pkgJson = parsed;
|
|
7586
7598
|
} catch {
|
|
7587
7599
|
continue;
|
|
7588
7600
|
}
|
|
7589
7601
|
if (!pkgJson.name || !pkgJson.version) continue;
|
|
7590
|
-
const source = fs.existsSync(markerPath) ? fs.readFileSync(markerPath, "utf-8").trim() : "bundled";
|
|
7602
|
+
const source = fs$1.existsSync(markerPath) ? fs$1.readFileSync(markerPath, "utf-8").trim() : "bundled";
|
|
7591
7603
|
m.addons[pkgJson.name] = {
|
|
7592
7604
|
name: pkgJson.name,
|
|
7593
7605
|
version: pkgJson.version,
|
|
@@ -7791,7 +7803,7 @@ function planClosureDedupe(input) {
|
|
|
7791
7803
|
function readTreeManifest(pkgJsonPath) {
|
|
7792
7804
|
let raw;
|
|
7793
7805
|
try {
|
|
7794
|
-
raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
|
|
7806
|
+
raw = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8")));
|
|
7795
7807
|
} catch {
|
|
7796
7808
|
return null;
|
|
7797
7809
|
}
|
|
@@ -7816,7 +7828,7 @@ function readTreeManifest(pkgJsonPath) {
|
|
|
7816
7828
|
function listTopLevelEntries(nodeModulesDir) {
|
|
7817
7829
|
let entries;
|
|
7818
7830
|
try {
|
|
7819
|
-
entries = fs.readdirSync(nodeModulesDir, { withFileTypes: true });
|
|
7831
|
+
entries = fs$1.readdirSync(nodeModulesDir, { withFileTypes: true });
|
|
7820
7832
|
} catch {
|
|
7821
7833
|
return [];
|
|
7822
7834
|
}
|
|
@@ -7826,7 +7838,7 @@ function listTopLevelEntries(nodeModulesDir) {
|
|
|
7826
7838
|
if (entry.name.startsWith("@")) {
|
|
7827
7839
|
let inner;
|
|
7828
7840
|
try {
|
|
7829
|
-
inner = fs.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
|
|
7841
|
+
inner = fs$1.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
|
|
7830
7842
|
} catch {
|
|
7831
7843
|
continue;
|
|
7832
7844
|
}
|
|
@@ -7859,14 +7871,14 @@ function collectAddonTreeState(addonDir) {
|
|
|
7859
7871
|
const entryDir = path$1.join(nodeModulesDir, name);
|
|
7860
7872
|
let isLink = false;
|
|
7861
7873
|
try {
|
|
7862
|
-
isLink = fs.lstatSync(entryDir).isSymbolicLink();
|
|
7874
|
+
isLink = fs$1.lstatSync(entryDir).isSymbolicLink();
|
|
7863
7875
|
} catch {
|
|
7864
7876
|
continue;
|
|
7865
7877
|
}
|
|
7866
7878
|
if (isLink) {
|
|
7867
7879
|
let target = "";
|
|
7868
7880
|
try {
|
|
7869
|
-
target = fs.readlinkSync(entryDir);
|
|
7881
|
+
target = fs$1.readlinkSync(entryDir);
|
|
7870
7882
|
} catch {}
|
|
7871
7883
|
existingLinks.push({
|
|
7872
7884
|
name,
|
|
@@ -7880,7 +7892,7 @@ function collectAddonTreeState(addonDir) {
|
|
|
7880
7892
|
version: manifest.version
|
|
7881
7893
|
});
|
|
7882
7894
|
for (const [depName, range] of manifest.ranges) {
|
|
7883
|
-
if (fs.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
|
|
7895
|
+
if (fs$1.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
|
|
7884
7896
|
addRange(depName, range);
|
|
7885
7897
|
}
|
|
7886
7898
|
}
|
|
@@ -7910,7 +7922,7 @@ function resolveClosureNodeModulesDir(explicitDir) {
|
|
|
7910
7922
|
const frameworkDir = explicitDir ?? process.env["CAMSTACK_FRAMEWORK_DIR"];
|
|
7911
7923
|
if (frameworkDir === void 0 || frameworkDir.length === 0) return null;
|
|
7912
7924
|
const nodeModulesDir = explicitDir ?? path$1.join(frameworkDir, "node_modules");
|
|
7913
|
-
return fs.existsSync(nodeModulesDir) ? nodeModulesDir : null;
|
|
7925
|
+
return fs$1.existsSync(nodeModulesDir) ? nodeModulesDir : null;
|
|
7914
7926
|
}
|
|
7915
7927
|
function symlinkType() {
|
|
7916
7928
|
return process.platform === "win32" ? "junction" : "dir";
|
|
@@ -7929,10 +7941,10 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
|
|
|
7929
7941
|
const nodeModulesDir = path$1.join(addonDir, "node_modules");
|
|
7930
7942
|
const probePath = path$1.join(nodeModulesDir, ".closure-link-probe");
|
|
7931
7943
|
try {
|
|
7932
|
-
fs.mkdirSync(nodeModulesDir, { recursive: true });
|
|
7933
|
-
fs.rmSync(probePath, { force: true });
|
|
7934
|
-
fs.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
|
|
7935
|
-
fs.rmSync(probePath, { force: true });
|
|
7944
|
+
fs$1.mkdirSync(nodeModulesDir, { recursive: true });
|
|
7945
|
+
fs$1.rmSync(probePath, { force: true });
|
|
7946
|
+
fs$1.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
|
|
7947
|
+
fs$1.rmSync(probePath, { force: true });
|
|
7936
7948
|
} catch (err) {
|
|
7937
7949
|
logger.warn("closure dedupe skipped — symlinks unavailable on this volume", { meta: {
|
|
7938
7950
|
addonDir,
|
|
@@ -7954,12 +7966,12 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
|
|
|
7954
7966
|
}
|
|
7955
7967
|
const entryDir = path$1.join(nodeModulesDir, link.name);
|
|
7956
7968
|
try {
|
|
7957
|
-
fs.rmSync(entryDir, {
|
|
7969
|
+
fs$1.rmSync(entryDir, {
|
|
7958
7970
|
recursive: true,
|
|
7959
7971
|
force: true
|
|
7960
7972
|
});
|
|
7961
|
-
fs.mkdirSync(path$1.dirname(entryDir), { recursive: true });
|
|
7962
|
-
fs.symlinkSync(target, entryDir, symlinkType());
|
|
7973
|
+
fs$1.mkdirSync(path$1.dirname(entryDir), { recursive: true });
|
|
7974
|
+
fs$1.symlinkSync(target, entryDir, symlinkType());
|
|
7963
7975
|
linked.push(link.name);
|
|
7964
7976
|
} catch (err) {
|
|
7965
7977
|
logger.warn("closure dedupe — link failed; entry removed copy may need reinstall", { meta: {
|
|
@@ -8035,7 +8047,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
|
|
|
8035
8047
|
count: Object.keys(native).length
|
|
8036
8048
|
} });
|
|
8037
8049
|
try {
|
|
8038
|
-
fs.writeFileSync(markerFile, markerHash);
|
|
8050
|
+
fs$1.writeFileSync(markerFile, markerHash);
|
|
8039
8051
|
} catch (err) {
|
|
8040
8052
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
8041
8053
|
markerFile,
|
|
@@ -8073,7 +8085,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
|
|
|
8073
8085
|
}
|
|
8074
8086
|
await rebuildNativeDeps(addonDir, pending.map(([name]) => name), logger, npmCacheDir ?? defaultNpmCacheDir(), registry);
|
|
8075
8087
|
try {
|
|
8076
|
-
fs.writeFileSync(markerFile, markerHash);
|
|
8088
|
+
fs$1.writeFileSync(markerFile, markerHash);
|
|
8077
8089
|
} catch (err) {
|
|
8078
8090
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
8079
8091
|
markerFile,
|
|
@@ -8095,12 +8107,12 @@ function copyPrebuiltNativeDep(name, addonDir, logger) {
|
|
|
8095
8107
|
if (source === target) continue;
|
|
8096
8108
|
if (!hasBuiltBinary(source)) continue;
|
|
8097
8109
|
try {
|
|
8098
|
-
fs.rmSync(target, {
|
|
8110
|
+
fs$1.rmSync(target, {
|
|
8099
8111
|
recursive: true,
|
|
8100
8112
|
force: true
|
|
8101
8113
|
});
|
|
8102
|
-
fs.mkdirSync(path$1.dirname(target), { recursive: true });
|
|
8103
|
-
fs.cpSync(source, target, {
|
|
8114
|
+
fs$1.mkdirSync(path$1.dirname(target), { recursive: true });
|
|
8115
|
+
fs$1.cpSync(source, target, {
|
|
8104
8116
|
recursive: true,
|
|
8105
8117
|
dereference: true
|
|
8106
8118
|
});
|
|
@@ -8136,7 +8148,7 @@ var BUNDLED_NATIVE_SIBLING_SCOPES = {
|
|
|
8136
8148
|
function hasAnyDotNode(dir, maxDepth) {
|
|
8137
8149
|
let entries;
|
|
8138
8150
|
try {
|
|
8139
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
8151
|
+
entries = fs$1.readdirSync(dir, { withFileTypes: true });
|
|
8140
8152
|
} catch {
|
|
8141
8153
|
return false;
|
|
8142
8154
|
}
|
|
@@ -8150,12 +8162,12 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
|
|
|
8150
8162
|
if (!hasAnyDotNode(src, 5)) return;
|
|
8151
8163
|
if (hasAnyDotNode(dst, 5)) return;
|
|
8152
8164
|
try {
|
|
8153
|
-
fs.rmSync(dst, {
|
|
8165
|
+
fs$1.rmSync(dst, {
|
|
8154
8166
|
recursive: true,
|
|
8155
8167
|
force: true
|
|
8156
8168
|
});
|
|
8157
|
-
fs.mkdirSync(path$1.dirname(dst), { recursive: true });
|
|
8158
|
-
fs.cpSync(src, dst, {
|
|
8169
|
+
fs$1.mkdirSync(path$1.dirname(dst), { recursive: true });
|
|
8170
|
+
fs$1.cpSync(src, dst, {
|
|
8159
8171
|
recursive: true,
|
|
8160
8172
|
dereference: true
|
|
8161
8173
|
});
|
|
@@ -8190,7 +8202,7 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
|
|
|
8190
8202
|
*/
|
|
8191
8203
|
function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
8192
8204
|
const srcNm = path$1.join(sourceDir, "node_modules");
|
|
8193
|
-
if (!fs.existsSync(srcNm)) return;
|
|
8205
|
+
if (!fs$1.existsSync(srcNm)) return;
|
|
8194
8206
|
const dstNm = path$1.join(targetDir, "node_modules");
|
|
8195
8207
|
for (const [name, scopes] of Object.entries(BUNDLED_NATIVE_SIBLING_SCOPES)) {
|
|
8196
8208
|
copyPrebuiltModuleDir(path$1.join(srcNm, name), path$1.join(dstNm, name), name, logger);
|
|
@@ -8198,7 +8210,7 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
|
8198
8210
|
const scopeSrc = path$1.join(srcNm, scope);
|
|
8199
8211
|
let siblings;
|
|
8200
8212
|
try {
|
|
8201
|
-
siblings = fs.readdirSync(scopeSrc);
|
|
8213
|
+
siblings = fs$1.readdirSync(scopeSrc);
|
|
8202
8214
|
} catch {
|
|
8203
8215
|
continue;
|
|
8204
8216
|
}
|
|
@@ -8208,12 +8220,12 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
|
8208
8220
|
}
|
|
8209
8221
|
/** A package dir is "built" when it carries a compiled `.node` or a prebuilds tree. */
|
|
8210
8222
|
function hasBuiltBinary(pkgDir) {
|
|
8211
|
-
if (!fs.existsSync(path$1.join(pkgDir, "package.json"))) return false;
|
|
8223
|
+
if (!fs$1.existsSync(path$1.join(pkgDir, "package.json"))) return false;
|
|
8212
8224
|
const releaseDir = path$1.join(pkgDir, "build", "Release");
|
|
8213
8225
|
try {
|
|
8214
|
-
if (fs.existsSync(releaseDir) && fs.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
|
|
8226
|
+
if (fs$1.existsSync(releaseDir) && fs$1.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
|
|
8215
8227
|
} catch {}
|
|
8216
|
-
return fs.existsSync(path$1.join(pkgDir, "prebuilds"));
|
|
8228
|
+
return fs$1.existsSync(path$1.join(pkgDir, "prebuilds"));
|
|
8217
8229
|
}
|
|
8218
8230
|
/** Candidate hoisted locations for `<name>`: NODE_PATH entries + ancestors of `addonDir`. */
|
|
8219
8231
|
function candidateHoistedDirs(name, addonDir) {
|
|
@@ -8251,7 +8263,7 @@ function hashDeclaration(deps) {
|
|
|
8251
8263
|
}
|
|
8252
8264
|
function markerMatches(markerFile, expected) {
|
|
8253
8265
|
try {
|
|
8254
|
-
return fs.readFileSync(markerFile, "utf-8").trim() === expected;
|
|
8266
|
+
return fs$1.readFileSync(markerFile, "utf-8").trim() === expected;
|
|
8255
8267
|
} catch {
|
|
8256
8268
|
return false;
|
|
8257
8269
|
}
|
|
@@ -8358,7 +8370,7 @@ function parseInstallSource(value) {
|
|
|
8358
8370
|
function readPackageJson(pkgJsonPath) {
|
|
8359
8371
|
let raw;
|
|
8360
8372
|
try {
|
|
8361
|
-
raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
|
|
8373
|
+
raw = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8")));
|
|
8362
8374
|
} catch {
|
|
8363
8375
|
return null;
|
|
8364
8376
|
}
|
|
@@ -8400,7 +8412,7 @@ function shouldSkipClosureProvidedSeed(packageName, isResolvable) {
|
|
|
8400
8412
|
var REGISTRY_LATEST_TIMEOUT_MS = 15e3;
|
|
8401
8413
|
function readInstalledPackageVersion(addonDir) {
|
|
8402
8414
|
try {
|
|
8403
|
-
const raw = JSON.parse(fs.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
|
|
8415
|
+
const raw = JSON.parse(fs$1.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
|
|
8404
8416
|
if (raw === null || typeof raw !== "object") return null;
|
|
8405
8417
|
const version = Reflect.get(raw, "version");
|
|
8406
8418
|
return typeof version === "string" && version.length > 0 ? version : null;
|
|
@@ -8541,7 +8553,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8541
8553
|
} catch {
|
|
8542
8554
|
return Object.freeze([]);
|
|
8543
8555
|
}
|
|
8544
|
-
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
8556
|
+
const raw = fs$1.readFileSync(pkgPath, "utf-8");
|
|
8545
8557
|
const parsed = JSON.parse(raw);
|
|
8546
8558
|
const deps = Object.keys(parsed.dependencies ?? {});
|
|
8547
8559
|
const agentOnly = new Set(parsed.camstack?.agentOnlyBootstrapAddons ?? []);
|
|
@@ -8586,7 +8598,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8586
8598
|
} catch {
|
|
8587
8599
|
return Object.freeze([]);
|
|
8588
8600
|
}
|
|
8589
|
-
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
8601
|
+
const raw = fs$1.readFileSync(pkgPath, "utf-8");
|
|
8590
8602
|
const addons = JSON.parse(raw).camstack?.agentBootstrapAddons ?? [];
|
|
8591
8603
|
return Object.freeze(["@camstack/server", ...addons]);
|
|
8592
8604
|
}
|
|
@@ -8616,7 +8628,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8616
8628
|
this.logger.info(`Install source: ${isLocal ? `bundle (${this.bundledAddonsDir})` : "npm"}, ${pkgList.length} package(s)`);
|
|
8617
8629
|
for (const packageName of pkgList) {
|
|
8618
8630
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
8619
|
-
if (fs.existsSync(path$1.join(addonDir, "package.json"))) {
|
|
8631
|
+
if (fs$1.existsSync(path$1.join(addonDir, "package.json"))) {
|
|
8620
8632
|
if (isLocal || shouldSkipClosureProvidedSeed(packageName, this.isResolvableFromClosure(packageName))) {
|
|
8621
8633
|
this.logger.debug(`${packageName} — already installed, skipping`);
|
|
8622
8634
|
continue;
|
|
@@ -8760,7 +8772,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8760
8772
|
const installedPackages = this.listInstalled();
|
|
8761
8773
|
for (const pkg of installedPackages) {
|
|
8762
8774
|
try {
|
|
8763
|
-
if (fs.lstatSync(pkg.dir).isSymbolicLink()) continue;
|
|
8775
|
+
if (fs$1.lstatSync(pkg.dir).isSymbolicLink()) continue;
|
|
8764
8776
|
} catch {
|
|
8765
8777
|
continue;
|
|
8766
8778
|
}
|
|
@@ -8800,7 +8812,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8800
8812
|
if (closureNodeModules !== null) for (const link of state.existingLinks) {
|
|
8801
8813
|
if (!isClosureLinkTarget(link.target, closureNodeModules)) continue;
|
|
8802
8814
|
const linkDir = path$1.join(nodeModulesDir, link.name);
|
|
8803
|
-
const targetManifest = fs.existsSync(path$1.join(linkDir, "package.json"));
|
|
8815
|
+
const targetManifest = fs$1.existsSync(path$1.join(linkDir, "package.json"));
|
|
8804
8816
|
const ranges = state.requirements.get(link.name) ?? [];
|
|
8805
8817
|
let holds = targetManifest;
|
|
8806
8818
|
if (holds && ranges.length > 0) {
|
|
@@ -8809,14 +8821,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8809
8821
|
}
|
|
8810
8822
|
if (!holds) {
|
|
8811
8823
|
this.logger.warn(`${packageName} — closure link for ${link.name} no longer holds; reinstalling this addon's deps`, { meta: { target: link.target } });
|
|
8812
|
-
fs.rmSync(linkDir, { force: true });
|
|
8824
|
+
fs$1.rmSync(linkDir, { force: true });
|
|
8813
8825
|
needsInstall = true;
|
|
8814
8826
|
}
|
|
8815
8827
|
}
|
|
8816
8828
|
const linked = [];
|
|
8817
8829
|
for (const [depName, range] of declaredEntries) {
|
|
8818
8830
|
if (typeof range !== "string") continue;
|
|
8819
|
-
if (fs.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
|
|
8831
|
+
if (fs$1.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
|
|
8820
8832
|
const closureVersion = closureNodeModules === null ? void 0 : readClosureVersions(closureNodeModules, [depName]).get(depName);
|
|
8821
8833
|
if (closureNodeModules !== null && closureVersion !== void 0 && closureSatisfiesRange(range, closureVersion)) {
|
|
8822
8834
|
if (executeClosureDedupe(addonDir, closureNodeModules, {
|
|
@@ -8849,7 +8861,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8849
8861
|
const closureNodeModules = resolveClosureNodeModulesDir(this.closureNodeModulesDir);
|
|
8850
8862
|
if (closureNodeModules !== null) {
|
|
8851
8863
|
const state = collectAddonTreeState(addonDir);
|
|
8852
|
-
for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
|
|
8864
|
+
for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs$1.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
|
|
8853
8865
|
}
|
|
8854
8866
|
this.logger.info(`${packageName} — reinstalling runtime dependencies`, { meta: { addonDir } });
|
|
8855
8867
|
await runNpm([
|
|
@@ -8894,7 +8906,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8894
8906
|
async realignFromClosure(packageName, closureDir) {
|
|
8895
8907
|
const targetDir = path$1.join(this.addonsDir, packageName);
|
|
8896
8908
|
const result = await this.installLocal(packageName, closureDir);
|
|
8897
|
-
await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
|
|
8909
|
+
await fs$1.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
|
|
8898
8910
|
this.manifest.upsert(result.name, {
|
|
8899
8911
|
version: result.version,
|
|
8900
8912
|
source: "closure"
|
|
@@ -8910,17 +8922,17 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8910
8922
|
async installCopy(packageName, sourceDir, pkgData, targetDir) {
|
|
8911
8923
|
await this.ensureBuilt(packageName, sourceDir, pkgData);
|
|
8912
8924
|
const distDir = path$1.join(sourceDir, "dist");
|
|
8913
|
-
if (!fs.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
|
|
8914
|
-
await fs.promises.rm(targetDir, {
|
|
8925
|
+
if (!fs$1.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
|
|
8926
|
+
await fs$1.promises.rm(targetDir, {
|
|
8915
8927
|
recursive: true,
|
|
8916
8928
|
force: true
|
|
8917
8929
|
});
|
|
8918
8930
|
ensureDir(targetDir);
|
|
8919
|
-
await fs.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
|
|
8931
|
+
await fs$1.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
|
|
8920
8932
|
await copyDirRecursive(distDir, path$1.join(targetDir, "dist"));
|
|
8921
8933
|
await copyExtraFileDirs(pkgData, sourceDir, targetDir);
|
|
8922
8934
|
copyBundledNativeModules(sourceDir, targetDir, this.logger);
|
|
8923
|
-
await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
|
|
8935
|
+
await fs$1.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
|
|
8924
8936
|
const localPkgVersion = asString$1(pkgData.version, "0.0.0");
|
|
8925
8937
|
this.manifest.upsert(packageName, {
|
|
8926
8938
|
version: localPkgVersion,
|
|
@@ -8961,7 +8973,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8961
8973
|
* unusual auth, offline mode, etc).
|
|
8962
8974
|
*/
|
|
8963
8975
|
async installFromNpm(packageName, version) {
|
|
8964
|
-
const tmpDir = fs.mkdtempSync(path$1.join(os$1.tmpdir(), "camstack-addon-npm-"));
|
|
8976
|
+
const tmpDir = fs$1.mkdtempSync(path$1.join(os$1.tmpdir(), "camstack-addon-npm-"));
|
|
8965
8977
|
const packageSpec = version ? `${packageName}@${version}` : packageName;
|
|
8966
8978
|
this.logger.info(`${packageName} — installing from npm`);
|
|
8967
8979
|
try {
|
|
@@ -8975,19 +8987,19 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8975
8987
|
];
|
|
8976
8988
|
if (this.registry) args.push("--registry", this.registry);
|
|
8977
8989
|
const { stdout } = await runNpm(args, this.npmRunOptions(tmpDir, 12e4));
|
|
8978
|
-
const tgzFiles = fs.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
|
|
8990
|
+
const tgzFiles = fs$1.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
|
|
8979
8991
|
if (tgzFiles.length === 0) throw new Error(`npm pack produced no tgz. stdout: ${stdout.trim()}`);
|
|
8980
8992
|
return path$1.join(tmpDir, tgzFiles[0]);
|
|
8981
8993
|
});
|
|
8982
8994
|
const result = await this.installFromTgz(tgzPath);
|
|
8983
|
-
fs.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
|
|
8995
|
+
fs$1.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
|
|
8984
8996
|
this.manifest.upsert(result.name, {
|
|
8985
8997
|
version: result.version,
|
|
8986
8998
|
source: "npm"
|
|
8987
8999
|
});
|
|
8988
9000
|
return result;
|
|
8989
9001
|
} finally {
|
|
8990
|
-
fs.rmSync(tmpDir, {
|
|
9002
|
+
fs$1.rmSync(tmpDir, {
|
|
8991
9003
|
recursive: true,
|
|
8992
9004
|
force: true
|
|
8993
9005
|
});
|
|
@@ -9025,7 +9037,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9025
9037
|
if (!tarRes.ok) throw new Error(`tarball GET ${tarballUrl} → ${tarRes.status}`);
|
|
9026
9038
|
const tgzPath = path$1.join(tmpDir, `${packageName.replace(/[/@]/g, "-").replace(/^-+/, "")}-${resolvedVersion}.tgz`);
|
|
9027
9039
|
const buf = Buffer.from(await tarRes.arrayBuffer());
|
|
9028
|
-
fs.writeFileSync(tgzPath, buf);
|
|
9040
|
+
fs$1.writeFileSync(tgzPath, buf);
|
|
9029
9041
|
return tgzPath;
|
|
9030
9042
|
}
|
|
9031
9043
|
/**
|
|
@@ -9046,7 +9058,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9046
9058
|
* on the next deploy.
|
|
9047
9059
|
*/
|
|
9048
9060
|
async evictInstallDir(targetDir) {
|
|
9049
|
-
if (!fs.existsSync(targetDir)) return;
|
|
9061
|
+
if (!fs$1.existsSync(targetDir)) return;
|
|
9050
9062
|
const graveyard = path$1.join(this.addonsDir, ".evicting");
|
|
9051
9063
|
ensureDir(graveyard);
|
|
9052
9064
|
await this.sweepGraveyard(graveyard);
|
|
@@ -9054,10 +9066,10 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9054
9066
|
const flatName = path$1.relative(this.addonsDir, targetDir).replace(/[/\\]/g, "-");
|
|
9055
9067
|
const asideDir = path$1.join(graveyard, `${flatName}-${ts}`);
|
|
9056
9068
|
try {
|
|
9057
|
-
fs.renameSync(targetDir, asideDir);
|
|
9069
|
+
fs$1.renameSync(targetDir, asideDir);
|
|
9058
9070
|
} catch (renameErr) {
|
|
9059
9071
|
if (renameErr.code === "EXDEV") {
|
|
9060
|
-
await fs.promises.rm(targetDir, {
|
|
9072
|
+
await fs$1.promises.rm(targetDir, {
|
|
9061
9073
|
recursive: true,
|
|
9062
9074
|
force: true
|
|
9063
9075
|
});
|
|
@@ -9065,7 +9077,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9065
9077
|
}
|
|
9066
9078
|
throw renameErr;
|
|
9067
9079
|
}
|
|
9068
|
-
await fs.promises.rm(asideDir, {
|
|
9080
|
+
await fs$1.promises.rm(asideDir, {
|
|
9069
9081
|
recursive: true,
|
|
9070
9082
|
force: true
|
|
9071
9083
|
}).catch((cleanupErr) => {
|
|
@@ -9086,14 +9098,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9086
9098
|
async sweepStagingResidue(stagingRoot) {
|
|
9087
9099
|
let names;
|
|
9088
9100
|
try {
|
|
9089
|
-
names = fs.readdirSync(stagingRoot);
|
|
9101
|
+
names = fs$1.readdirSync(stagingRoot);
|
|
9090
9102
|
} catch {
|
|
9091
9103
|
return;
|
|
9092
9104
|
}
|
|
9093
9105
|
const now = Date.now();
|
|
9094
9106
|
const ages = [];
|
|
9095
9107
|
for (const name of names) try {
|
|
9096
|
-
const stat = fs.statSync(path$1.join(stagingRoot, name));
|
|
9108
|
+
const stat = fs$1.statSync(path$1.join(stagingRoot, name));
|
|
9097
9109
|
ages.push({
|
|
9098
9110
|
name,
|
|
9099
9111
|
ageMs: now - stat.mtimeMs
|
|
@@ -9104,7 +9116,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9104
9116
|
stagingRoot,
|
|
9105
9117
|
entries: sweepable
|
|
9106
9118
|
} });
|
|
9107
|
-
await Promise.all(sweepable.map((name) => fs.promises.rm(path$1.join(stagingRoot, name), {
|
|
9119
|
+
await Promise.all(sweepable.map((name) => fs$1.promises.rm(path$1.join(stagingRoot, name), {
|
|
9108
9120
|
recursive: true,
|
|
9109
9121
|
force: true
|
|
9110
9122
|
}).catch(() => void 0)));
|
|
@@ -9113,11 +9125,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9113
9125
|
async sweepGraveyard(graveyard) {
|
|
9114
9126
|
let entries;
|
|
9115
9127
|
try {
|
|
9116
|
-
entries = fs.readdirSync(graveyard);
|
|
9128
|
+
entries = fs$1.readdirSync(graveyard);
|
|
9117
9129
|
} catch {
|
|
9118
9130
|
return;
|
|
9119
9131
|
}
|
|
9120
|
-
await Promise.all(entries.map((name) => fs.promises.rm(path$1.join(graveyard, name), {
|
|
9132
|
+
await Promise.all(entries.map((name) => fs$1.promises.rm(path$1.join(graveyard, name), {
|
|
9121
9133
|
recursive: true,
|
|
9122
9134
|
force: true
|
|
9123
9135
|
}).catch(() => void 0)));
|
|
@@ -9168,7 +9180,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9168
9180
|
return;
|
|
9169
9181
|
}
|
|
9170
9182
|
const strippedManifest = stripBundledDeps(pkgView.raw);
|
|
9171
|
-
await fs.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
|
|
9183
|
+
await fs$1.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
|
|
9172
9184
|
const deps = asJsonObject$1(strippedManifest["dependencies"]);
|
|
9173
9185
|
const depNames = deps ? Object.keys(deps) : [];
|
|
9174
9186
|
if (depNames.length === 0) return;
|
|
@@ -9300,9 +9312,9 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9300
9312
|
"-C",
|
|
9301
9313
|
stagingDir
|
|
9302
9314
|
], { timeout: 12e4 });
|
|
9303
|
-
const pkgDir = fs.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
|
|
9315
|
+
const pkgDir = fs$1.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
|
|
9304
9316
|
const pkgJsonPath = path$1.join(pkgDir, "package.json");
|
|
9305
|
-
if (!fs.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
|
|
9317
|
+
if (!fs$1.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
|
|
9306
9318
|
const pkgView = readPackageJson(pkgJsonPath);
|
|
9307
9319
|
if (!pkgView) throw new Error(`Invalid package.json at ${pkgJsonPath}`);
|
|
9308
9320
|
if (!pkgView.camstackAddons) throw new Error(`Package ${pkgView.name} has no camstack.addons manifest`);
|
|
@@ -9312,7 +9324,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9312
9324
|
this.dedupeTreeAgainstClosure(pkgDir, pkgView.name);
|
|
9313
9325
|
await this.evictInstallDir(targetDir);
|
|
9314
9326
|
ensureDir(path$1.dirname(targetDir));
|
|
9315
|
-
await fs.promises.rename(pkgDir, targetDir);
|
|
9327
|
+
await fs$1.promises.rename(pkgDir, targetDir);
|
|
9316
9328
|
this.manifest.upsert(pkgView.name, {
|
|
9317
9329
|
version: pkgView.version,
|
|
9318
9330
|
source: "bundled"
|
|
@@ -9323,7 +9335,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9323
9335
|
};
|
|
9324
9336
|
} finally {
|
|
9325
9337
|
this.inFlightStaging.delete(stagingName);
|
|
9326
|
-
await fs.promises.rm(stagingDir, {
|
|
9338
|
+
await fs$1.promises.rm(stagingDir, {
|
|
9327
9339
|
recursive: true,
|
|
9328
9340
|
force: true
|
|
9329
9341
|
}).catch(() => void 0);
|
|
@@ -9353,24 +9365,24 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9353
9365
|
const current = this.manifest.get(packageName);
|
|
9354
9366
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
9355
9367
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9356
|
-
if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9368
|
+
if (!fs$1.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9357
9369
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
9358
9370
|
const backupRoot = path$1.join(this.addonsDir, ".backups", packageName);
|
|
9359
9371
|
ensureDir(backupRoot);
|
|
9360
9372
|
const backupDir = path$1.join(backupRoot, ts);
|
|
9361
9373
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
9362
|
-
fs.renameSync(addonDir, backupDir);
|
|
9374
|
+
fs$1.renameSync(addonDir, backupDir);
|
|
9363
9375
|
let result;
|
|
9364
9376
|
try {
|
|
9365
9377
|
result = await this.installFromNpm(packageName, version);
|
|
9366
9378
|
} catch (installErr) {
|
|
9367
9379
|
this.logger.error(`${packageName} — install failed, restoring backup`, { meta: { error: errMsg$1(installErr) } });
|
|
9368
9380
|
try {
|
|
9369
|
-
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9381
|
+
if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
|
|
9370
9382
|
recursive: true,
|
|
9371
9383
|
force: true
|
|
9372
9384
|
});
|
|
9373
|
-
fs.renameSync(backupDir, addonDir);
|
|
9385
|
+
fs$1.renameSync(backupDir, addonDir);
|
|
9374
9386
|
this.manifest.upsert(packageName, {
|
|
9375
9387
|
version: current.version,
|
|
9376
9388
|
source: current.source,
|
|
@@ -9431,7 +9443,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9431
9443
|
const current = this.manifest.get(packageName);
|
|
9432
9444
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
9433
9445
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9434
|
-
if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9446
|
+
if (!fs$1.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9435
9447
|
await this.installRuntimeDependencies(stagedPath, packageName);
|
|
9436
9448
|
await this.installNativeDependencies(stagedPath, packageName);
|
|
9437
9449
|
this.dedupeTreeAgainstClosure(stagedPath, packageName);
|
|
@@ -9440,14 +9452,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9440
9452
|
ensureDir(backupRoot);
|
|
9441
9453
|
const backupDir = path$1.join(backupRoot, ts);
|
|
9442
9454
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
9443
|
-
fs.renameSync(addonDir, backupDir);
|
|
9455
|
+
fs$1.renameSync(addonDir, backupDir);
|
|
9444
9456
|
try {
|
|
9445
9457
|
try {
|
|
9446
|
-
fs.renameSync(stagedPath, addonDir);
|
|
9458
|
+
fs$1.renameSync(stagedPath, addonDir);
|
|
9447
9459
|
} catch (renameErr) {
|
|
9448
9460
|
if (renameErr.code === "EXDEV") {
|
|
9449
|
-
fs.cpSync(stagedPath, addonDir, { recursive: true });
|
|
9450
|
-
fs.rmSync(stagedPath, {
|
|
9461
|
+
fs$1.cpSync(stagedPath, addonDir, { recursive: true });
|
|
9462
|
+
fs$1.rmSync(stagedPath, {
|
|
9451
9463
|
recursive: true,
|
|
9452
9464
|
force: true
|
|
9453
9465
|
});
|
|
@@ -9456,11 +9468,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9456
9468
|
} catch (swapErr) {
|
|
9457
9469
|
this.logger.error(`${packageName} — staged swap failed, restoring backup`, { meta: { error: errMsg$1(swapErr) } });
|
|
9458
9470
|
try {
|
|
9459
|
-
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9471
|
+
if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
|
|
9460
9472
|
recursive: true,
|
|
9461
9473
|
force: true
|
|
9462
9474
|
});
|
|
9463
|
-
fs.renameSync(backupDir, addonDir);
|
|
9475
|
+
fs$1.renameSync(backupDir, addonDir);
|
|
9464
9476
|
this.manifest.upsert(packageName, {
|
|
9465
9477
|
version: current.version,
|
|
9466
9478
|
source: current.source,
|
|
@@ -9499,20 +9511,20 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9499
9511
|
this.logger.warn(`${packageName} — no backup to rollback to`);
|
|
9500
9512
|
return null;
|
|
9501
9513
|
}
|
|
9502
|
-
if (!fs.existsSync(entry.lastBackupDir)) {
|
|
9514
|
+
if (!fs$1.existsSync(entry.lastBackupDir)) {
|
|
9503
9515
|
this.logger.warn(`${packageName} — backup dir vanished: ${entry.lastBackupDir}`);
|
|
9504
9516
|
return null;
|
|
9505
9517
|
}
|
|
9506
9518
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9507
|
-
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9519
|
+
if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
|
|
9508
9520
|
recursive: true,
|
|
9509
9521
|
force: true
|
|
9510
9522
|
});
|
|
9511
|
-
fs.renameSync(entry.lastBackupDir, addonDir);
|
|
9523
|
+
fs$1.renameSync(entry.lastBackupDir, addonDir);
|
|
9512
9524
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
9513
9525
|
let restoredVersion = entry.version;
|
|
9514
|
-
if (fs.existsSync(pkgJsonPath)) try {
|
|
9515
|
-
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
9526
|
+
if (fs$1.existsSync(pkgJsonPath)) try {
|
|
9527
|
+
const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
|
|
9516
9528
|
if (typeof parsed === "object" && parsed != null) {
|
|
9517
9529
|
const v = parsed.version;
|
|
9518
9530
|
if (typeof v === "string" && v.length > 0) restoredVersion = v;
|
|
@@ -9560,7 +9572,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9560
9572
|
return false;
|
|
9561
9573
|
}
|
|
9562
9574
|
try {
|
|
9563
|
-
await fs.promises.rm(target, {
|
|
9575
|
+
await fs$1.promises.rm(target, {
|
|
9564
9576
|
recursive: true,
|
|
9565
9577
|
force: true
|
|
9566
9578
|
});
|
|
@@ -9578,7 +9590,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9578
9590
|
listBackupsFor(packageName) {
|
|
9579
9591
|
const dir = path$1.join(this.backupsRoot, packageName);
|
|
9580
9592
|
try {
|
|
9581
|
-
return fs.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
|
|
9593
|
+
return fs$1.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
|
|
9582
9594
|
} catch {
|
|
9583
9595
|
return [];
|
|
9584
9596
|
}
|
|
@@ -9610,7 +9622,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9610
9622
|
for (const dir of [pkgDir, path$1.dirname(pkgDir)]) {
|
|
9611
9623
|
if (!this.isInsideBackups(dir)) continue;
|
|
9612
9624
|
try {
|
|
9613
|
-
await fs.promises.rmdir(dir);
|
|
9625
|
+
await fs$1.promises.rmdir(dir);
|
|
9614
9626
|
} catch {
|
|
9615
9627
|
return;
|
|
9616
9628
|
}
|
|
@@ -9692,7 +9704,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9692
9704
|
*/
|
|
9693
9705
|
resolveBackupToKeep(packageName, backups) {
|
|
9694
9706
|
const liveDir = path$1.join(this.addonsDir, packageName);
|
|
9695
|
-
if (!fs.existsSync(liveDir)) {
|
|
9707
|
+
if (!fs$1.existsSync(liveDir)) {
|
|
9696
9708
|
const newest = backups[backups.length - 1] ?? null;
|
|
9697
9709
|
if (newest != null) this.logger.warn(`${packageName} — live install dir missing; retaining its newest backup as the only surviving copy`, { meta: {
|
|
9698
9710
|
liveDir,
|
|
@@ -9709,7 +9721,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9709
9721
|
listBackedUpPackages() {
|
|
9710
9722
|
let entries;
|
|
9711
9723
|
try {
|
|
9712
|
-
entries = fs.readdirSync(this.backupsRoot, { withFileTypes: true });
|
|
9724
|
+
entries = fs$1.readdirSync(this.backupsRoot, { withFileTypes: true });
|
|
9713
9725
|
} catch {
|
|
9714
9726
|
return [];
|
|
9715
9727
|
}
|
|
@@ -9721,14 +9733,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9721
9733
|
continue;
|
|
9722
9734
|
}
|
|
9723
9735
|
const scopeDir = path$1.join(this.backupsRoot, entry.name);
|
|
9724
|
-
for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
|
|
9736
|
+
for (const inner of fs$1.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
|
|
9725
9737
|
}
|
|
9726
9738
|
return names;
|
|
9727
9739
|
}
|
|
9728
9740
|
async uninstall(packageName) {
|
|
9729
9741
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9730
|
-
if (fs.existsSync(addonDir)) {
|
|
9731
|
-
fs.rmSync(addonDir, {
|
|
9742
|
+
if (fs$1.existsSync(addonDir)) {
|
|
9743
|
+
fs$1.rmSync(addonDir, {
|
|
9732
9744
|
recursive: true,
|
|
9733
9745
|
force: true
|
|
9734
9746
|
});
|
|
@@ -9736,8 +9748,8 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9736
9748
|
return;
|
|
9737
9749
|
}
|
|
9738
9750
|
const legacyDir = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""));
|
|
9739
|
-
if (fs.existsSync(legacyDir)) {
|
|
9740
|
-
fs.rmSync(legacyDir, {
|
|
9751
|
+
if (fs$1.existsSync(legacyDir)) {
|
|
9752
|
+
fs$1.rmSync(legacyDir, {
|
|
9741
9753
|
recursive: true,
|
|
9742
9754
|
force: true
|
|
9743
9755
|
});
|
|
@@ -9745,22 +9757,22 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9745
9757
|
}
|
|
9746
9758
|
}
|
|
9747
9759
|
listInstalled() {
|
|
9748
|
-
if (!fs.existsSync(this.addonsDir)) return [];
|
|
9760
|
+
if (!fs$1.existsSync(this.addonsDir)) return [];
|
|
9749
9761
|
const packageDirs = [];
|
|
9750
|
-
for (const entry of fs.readdirSync(this.addonsDir, { withFileTypes: true })) {
|
|
9762
|
+
for (const entry of fs$1.readdirSync(this.addonsDir, { withFileTypes: true })) {
|
|
9751
9763
|
if (!isDirEntry(entry, this.addonsDir)) continue;
|
|
9752
9764
|
if (entry.name.startsWith("@")) {
|
|
9753
9765
|
const scopeDir = path$1.join(this.addonsDir, entry.name);
|
|
9754
|
-
for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
|
|
9766
|
+
for (const inner of fs$1.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
|
|
9755
9767
|
} else packageDirs.push(path$1.join(this.addonsDir, entry.name));
|
|
9756
9768
|
}
|
|
9757
9769
|
return packageDirs.map((dir) => {
|
|
9758
9770
|
const pkgPath = path$1.join(dir, "package.json");
|
|
9759
|
-
if (!fs.existsSync(pkgPath)) return null;
|
|
9771
|
+
if (!fs$1.existsSync(pkgPath)) return null;
|
|
9760
9772
|
const pkg = readPackageJson(pkgPath);
|
|
9761
9773
|
if (!pkg || !pkg.camstackAddons) return null;
|
|
9762
9774
|
const sourceFile = path$1.join(dir, ".install-source");
|
|
9763
|
-
const installSource = fs.existsSync(sourceFile) ? parseInstallSource(fs.readFileSync(sourceFile, "utf-8").trim()) : void 0;
|
|
9775
|
+
const installSource = fs$1.existsSync(sourceFile) ? parseInstallSource(fs$1.readFileSync(sourceFile, "utf-8").trim()) : void 0;
|
|
9764
9776
|
return {
|
|
9765
9777
|
name: pkg.name,
|
|
9766
9778
|
version: pkg.version,
|
|
@@ -9770,13 +9782,13 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9770
9782
|
}).filter((item) => item !== null);
|
|
9771
9783
|
}
|
|
9772
9784
|
isInstalled(packageName) {
|
|
9773
|
-
if (fs.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
|
|
9774
|
-
return fs.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
|
|
9785
|
+
if (fs$1.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
|
|
9786
|
+
return fs$1.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
|
|
9775
9787
|
}
|
|
9776
9788
|
getInstalledPackage(packageName) {
|
|
9777
9789
|
let pkgPath = path$1.join(this.addonsDir, packageName, "package.json");
|
|
9778
|
-
if (!fs.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
|
|
9779
|
-
if (!fs.existsSync(pkgPath)) return null;
|
|
9790
|
+
if (!fs$1.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
|
|
9791
|
+
if (!fs$1.existsSync(pkgPath)) return null;
|
|
9780
9792
|
const pkg = readPackageJson(pkgPath);
|
|
9781
9793
|
if (!pkg) return null;
|
|
9782
9794
|
return {
|
|
@@ -9795,7 +9807,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9795
9807
|
]) {
|
|
9796
9808
|
const candidate = path$1.join(this.bundledAddonsDir, dirName);
|
|
9797
9809
|
try {
|
|
9798
|
-
const pkg = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
|
|
9810
|
+
const pkg = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
|
|
9799
9811
|
if (pkg && asString$1(pkg["name"]) === packageName) return candidate;
|
|
9800
9812
|
} catch {}
|
|
9801
9813
|
}
|
|
@@ -9804,7 +9816,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9804
9816
|
/** Ensure a package is built (dist/ exists and page bundles present) */
|
|
9805
9817
|
async ensureBuilt(packageName, sourceDir, pkgData) {
|
|
9806
9818
|
const distDir = path$1.join(sourceDir, "dist");
|
|
9807
|
-
if (!(!fs.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
|
|
9819
|
+
if (!(!fs$1.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
|
|
9808
9820
|
this.logger.info(`${packageName} — building (dist/ missing or incomplete)`);
|
|
9809
9821
|
try {
|
|
9810
9822
|
await runNpm(["run", "build"], this.npmRunOptions(sourceDir, 18e4));
|
|
@@ -9819,7 +9831,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9819
9831
|
if (!camstack?.addons) return false;
|
|
9820
9832
|
for (const addon of camstack.addons) {
|
|
9821
9833
|
if (!addon.pages) continue;
|
|
9822
|
-
for (const page of addon.pages) if (page.bundle && !fs.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
|
|
9834
|
+
for (const page of addon.pages) if (page.bundle && !fs$1.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
|
|
9823
9835
|
}
|
|
9824
9836
|
return false;
|
|
9825
9837
|
}
|
|
@@ -9828,7 +9840,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9828
9840
|
function isDirEntry(entry, parentDir) {
|
|
9829
9841
|
if (entry.isDirectory()) return true;
|
|
9830
9842
|
if (entry.isSymbolicLink()) try {
|
|
9831
|
-
return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
9843
|
+
return fs$1.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
9832
9844
|
} catch {
|
|
9833
9845
|
return false;
|
|
9834
9846
|
}
|
|
@@ -9927,7 +9939,7 @@ function selectAddonResidue(candidates) {
|
|
|
9927
9939
|
}
|
|
9928
9940
|
function readDeclaredName(dir) {
|
|
9929
9941
|
try {
|
|
9930
|
-
const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9942
|
+
const parsed = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9931
9943
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
9932
9944
|
const name = parsed.name;
|
|
9933
9945
|
return typeof name === "string" ? name : null;
|
|
@@ -9937,7 +9949,7 @@ function readDeclaredName(dir) {
|
|
|
9937
9949
|
}
|
|
9938
9950
|
function readDeclaredVersion(dir) {
|
|
9939
9951
|
try {
|
|
9940
|
-
const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9952
|
+
const parsed = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9941
9953
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
9942
9954
|
const version = parsed.version;
|
|
9943
9955
|
return typeof version === "string" ? version : null;
|
|
@@ -9947,7 +9959,7 @@ function readDeclaredVersion(dir) {
|
|
|
9947
9959
|
}
|
|
9948
9960
|
function isDirLike(p) {
|
|
9949
9961
|
try {
|
|
9950
|
-
return fs.statSync(p).isDirectory();
|
|
9962
|
+
return fs$1.statSync(p).isDirectory();
|
|
9951
9963
|
} catch {
|
|
9952
9964
|
return false;
|
|
9953
9965
|
}
|
|
@@ -9957,7 +9969,7 @@ function freeQuarantineTarget(store, scope, dirName) {
|
|
|
9957
9969
|
const base = scope === null ? dirName : `${scope.replace("@", "")}__${dirName}`;
|
|
9958
9970
|
let candidate = path$1.join(store, base);
|
|
9959
9971
|
let n = 1;
|
|
9960
|
-
while (fs.existsSync(candidate)) {
|
|
9972
|
+
while (fs$1.existsSync(candidate)) {
|
|
9961
9973
|
candidate = path$1.join(store, `${base}-${n}`);
|
|
9962
9974
|
n += 1;
|
|
9963
9975
|
}
|
|
@@ -9974,7 +9986,7 @@ function freeQuarantineTarget(store, scope, dirName) {
|
|
|
9974
9986
|
function quarantineAddonResidue(addonsDir, log) {
|
|
9975
9987
|
const quarantined = [];
|
|
9976
9988
|
const failed = [];
|
|
9977
|
-
if (!fs.existsSync(addonsDir)) return {
|
|
9989
|
+
if (!fs$1.existsSync(addonsDir)) return {
|
|
9978
9990
|
quarantined,
|
|
9979
9991
|
failed
|
|
9980
9992
|
};
|
|
@@ -9982,7 +9994,7 @@ function quarantineAddonResidue(addonsDir, log) {
|
|
|
9982
9994
|
const scan = (parent, scope) => {
|
|
9983
9995
|
let names;
|
|
9984
9996
|
try {
|
|
9985
|
-
names = fs.readdirSync(parent);
|
|
9997
|
+
names = fs$1.readdirSync(parent);
|
|
9986
9998
|
} catch {
|
|
9987
9999
|
return;
|
|
9988
10000
|
}
|
|
@@ -10001,8 +10013,8 @@ function quarantineAddonResidue(addonsDir, log) {
|
|
|
10001
10013
|
const version = readDeclaredVersion(full);
|
|
10002
10014
|
const to = freeQuarantineTarget(store, scope, dirName);
|
|
10003
10015
|
try {
|
|
10004
|
-
fs.mkdirSync(store, { recursive: true });
|
|
10005
|
-
fs.renameSync(full, to);
|
|
10016
|
+
fs$1.mkdirSync(store, { recursive: true });
|
|
10017
|
+
fs$1.renameSync(full, to);
|
|
10006
10018
|
} catch (err) {
|
|
10007
10019
|
const error = err instanceof Error ? err.message : String(err);
|
|
10008
10020
|
failed.push({
|
|
@@ -10060,11 +10072,11 @@ function getRestartMarkerPath(dataDir) {
|
|
|
10060
10072
|
* intact or no marker at all (never a half-written file).
|
|
10061
10073
|
*/
|
|
10062
10074
|
function writePendingRestart(dataDir, marker) {
|
|
10063
|
-
fs.mkdirSync(dataDir, { recursive: true });
|
|
10075
|
+
fs$1.mkdirSync(dataDir, { recursive: true });
|
|
10064
10076
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
10065
10077
|
const tmpPath = `${markerPath}.tmp`;
|
|
10066
|
-
fs.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
|
|
10067
|
-
fs.renameSync(tmpPath, markerPath);
|
|
10078
|
+
fs$1.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
|
|
10079
|
+
fs$1.renameSync(tmpPath, markerPath);
|
|
10068
10080
|
}
|
|
10069
10081
|
/**
|
|
10070
10082
|
* Read + consume the marker. Returns the parsed payload on success and
|
|
@@ -10089,10 +10101,10 @@ function writePendingRestart(dataDir, marker) {
|
|
|
10089
10101
|
*/
|
|
10090
10102
|
function readPendingRestart(dataDir) {
|
|
10091
10103
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
10092
|
-
if (!fs.existsSync(markerPath)) return null;
|
|
10104
|
+
if (!fs$1.existsSync(markerPath)) return null;
|
|
10093
10105
|
let raw;
|
|
10094
10106
|
try {
|
|
10095
|
-
raw = fs.readFileSync(markerPath, "utf-8");
|
|
10107
|
+
raw = fs$1.readFileSync(markerPath, "utf-8");
|
|
10096
10108
|
} catch (err) {
|
|
10097
10109
|
console.error("[restart-coordinator] Marker unreadable — leaving in place:", err);
|
|
10098
10110
|
return null;
|
|
@@ -10131,7 +10143,7 @@ function readPendingRestart(dataDir) {
|
|
|
10131
10143
|
/** Remove the marker if present. No-op if missing. */
|
|
10132
10144
|
function clearPendingRestart(dataDir) {
|
|
10133
10145
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
10134
|
-
fs.rmSync(markerPath, { force: true });
|
|
10146
|
+
fs$1.rmSync(markerPath, { force: true });
|
|
10135
10147
|
}
|
|
10136
10148
|
function isRestartKind(value) {
|
|
10137
10149
|
return value === "framework-update" || value === "manual" || value === "system";
|
|
@@ -10143,7 +10155,7 @@ function scheduleSelfRestart(options = {}) {
|
|
|
10143
10155
|
const touchTarget = process.env["CAMSTACK_RESTART_TOUCH_FILE"];
|
|
10144
10156
|
if (touchTarget !== void 0 && touchTarget.length > 0) try {
|
|
10145
10157
|
const now = /* @__PURE__ */ new Date();
|
|
10146
|
-
fs.utimesSync(touchTarget, now, now);
|
|
10158
|
+
fs$1.utimesSync(touchTarget, now, now);
|
|
10147
10159
|
return;
|
|
10148
10160
|
} catch (err) {
|
|
10149
10161
|
console.error("[restart-coordinator] dev touch-reload failed; falling through to process exit:", err);
|
|
@@ -14476,11 +14488,11 @@ function applyEnvOverrides(raw) {
|
|
|
14476
14488
|
return result;
|
|
14477
14489
|
}
|
|
14478
14490
|
function loadYaml(configPath) {
|
|
14479
|
-
if (!fs.existsSync(configPath)) {
|
|
14491
|
+
if (!fs$1.existsSync(configPath)) {
|
|
14480
14492
|
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`);
|
|
14481
14493
|
return {};
|
|
14482
14494
|
}
|
|
14483
|
-
const parsed = load(fs.readFileSync(configPath, "utf-8")) ?? {};
|
|
14495
|
+
const parsed = load(fs$1.readFileSync(configPath, "utf-8")) ?? {};
|
|
14484
14496
|
console.log(`[ConfigManager] Loaded config from: ${configPath}`);
|
|
14485
14497
|
return parsed;
|
|
14486
14498
|
}
|
|
@@ -22576,7 +22588,7 @@ async function probeVaapiInit(renderNode) {
|
|
|
22576
22588
|
*/
|
|
22577
22589
|
function safeExistsSync(path) {
|
|
22578
22590
|
try {
|
|
22579
|
-
return fs.existsSync(path);
|
|
22591
|
+
return fs$1.existsSync(path);
|
|
22580
22592
|
} catch {
|
|
22581
22593
|
return false;
|
|
22582
22594
|
}
|
|
@@ -22595,11 +22607,11 @@ function probeLinuxGpus() {
|
|
|
22595
22607
|
if (safeExistsSync("/dev/nvidia0") || safeExistsSync("/proc/driver/nvidia/version")) signals.hasNvidiaGpu = true;
|
|
22596
22608
|
try {
|
|
22597
22609
|
const drmDir = "/sys/class/drm";
|
|
22598
|
-
if (fs.existsSync(drmDir)) for (const entry of fs.readdirSync(drmDir)) {
|
|
22610
|
+
if (fs$1.existsSync(drmDir)) for (const entry of fs$1.readdirSync(drmDir)) {
|
|
22599
22611
|
if (!entry.startsWith("card")) continue;
|
|
22600
22612
|
const vendorPath = `${drmDir}/${entry}/device/vendor`;
|
|
22601
22613
|
if (!safeExistsSync(vendorPath)) continue;
|
|
22602
|
-
const vendor = fs.readFileSync(vendorPath, "utf8").trim().toLowerCase();
|
|
22614
|
+
const vendor = fs$1.readFileSync(vendorPath, "utf8").trim().toLowerCase();
|
|
22603
22615
|
if (vendor === "0x10de") signals.hasNvidiaGpu = true;
|
|
22604
22616
|
else if (vendor === "0x1002") signals.hasAmdGpu = true;
|
|
22605
22617
|
else if (vendor === "0x8086") signals.hasIntelGpu = true;
|
|
@@ -22817,21 +22829,21 @@ function sleep$1(ms) {
|
|
|
22817
22829
|
* crashed holder) is stolen.
|
|
22818
22830
|
*/
|
|
22819
22831
|
async function withFileLock(lockPath, fn) {
|
|
22820
|
-
fs.mkdirSync(join(lockPath, ".."), { recursive: true });
|
|
22832
|
+
fs$1.mkdirSync(join(lockPath, ".."), { recursive: true });
|
|
22821
22833
|
for (;;) try {
|
|
22822
|
-
const fd = fs.openSync(lockPath, "wx");
|
|
22823
|
-
fs.closeSync(fd);
|
|
22834
|
+
const fd = fs$1.openSync(lockPath, "wx");
|
|
22835
|
+
fs$1.closeSync(fd);
|
|
22824
22836
|
break;
|
|
22825
22837
|
} catch {
|
|
22826
22838
|
try {
|
|
22827
|
-
if (Date.now() - fs.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs.rmSync(lockPath, { force: true });
|
|
22839
|
+
if (Date.now() - fs$1.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs$1.rmSync(lockPath, { force: true });
|
|
22828
22840
|
else await sleep$1(LOCK_POLL_MS);
|
|
22829
22841
|
} catch {}
|
|
22830
22842
|
}
|
|
22831
22843
|
try {
|
|
22832
22844
|
return await fn();
|
|
22833
22845
|
} finally {
|
|
22834
|
-
fs.rmSync(lockPath, { force: true });
|
|
22846
|
+
fs$1.rmSync(lockPath, { force: true });
|
|
22835
22847
|
}
|
|
22836
22848
|
}
|
|
22837
22849
|
/** Coalesce in-process + serialize cross-process for one binary id. */
|
|
@@ -22889,7 +22901,7 @@ var AddonDepsManager = class {
|
|
|
22889
22901
|
* failed or tampered download throws, and provisioning reports it.
|
|
22890
22902
|
*/
|
|
22891
22903
|
async stageNativeDepsDeclaredBy(requirementsFile) {
|
|
22892
|
-
if (!declaresEdgetpuDelegate(fs.readFileSync(requirementsFile, "utf8"))) return;
|
|
22904
|
+
if (!declaresEdgetpuDelegate(fs$1.readFileSync(requirementsFile, "utf8"))) return;
|
|
22893
22905
|
await singleFlight(this.depsDir, "edgetpu-delegate", () => ensureEdgetpuDelegate(this.nodeRoot, this.logger));
|
|
22894
22906
|
}
|
|
22895
22907
|
getDepsDir() {
|
|
@@ -23926,7 +23938,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
|
|
|
23926
23938
|
const addonId = declaration.id;
|
|
23927
23939
|
const nodeDataDir = process.env["CAMSTACK_DATA"] ?? dataDir;
|
|
23928
23940
|
const addonDataDir = path$1.resolve(nodeDataDir, "addons-data", addonId);
|
|
23929
|
-
fs.mkdirSync(addonDataDir, { recursive: true });
|
|
23941
|
+
fs$1.mkdirSync(addonDataDir, { recursive: true });
|
|
23930
23942
|
if (runtime.mode === "broker") ensureBindingSubscription(runtime.broker);
|
|
23931
23943
|
const regs = getRegistries(nodeId);
|
|
23932
23944
|
const workerResolver = {
|
|
@@ -24130,6 +24142,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
|
|
|
24130
24142
|
id: addonId,
|
|
24131
24143
|
logger: scopedLogger,
|
|
24132
24144
|
eventBus: scopedEventBus,
|
|
24145
|
+
debug: createDebugEmitter(scopedLogger),
|
|
24133
24146
|
addonConfig: options?.addonConfig ?? {},
|
|
24134
24147
|
dataDir: addonDataDir,
|
|
24135
24148
|
nodeDataDir,
|
|
@@ -25727,7 +25740,7 @@ var FailedRunnerRetryLedger = class {
|
|
|
25727
25740
|
function readRunnerPackageVersions(addonDirs) {
|
|
25728
25741
|
const out = {};
|
|
25729
25742
|
for (const dir of addonDirs) try {
|
|
25730
|
-
const raw = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
25743
|
+
const raw = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
25731
25744
|
const version = typeof raw === "object" && raw !== null ? Reflect.get(raw, "version") : null;
|
|
25732
25745
|
out[dir] = typeof version === "string" && version.length > 0 ? version : null;
|
|
25733
25746
|
} catch {
|
|
@@ -25788,7 +25801,7 @@ function readAddonHeapDeclaration(spec) {
|
|
|
25788
25801
|
if (cached !== void 0) return cached;
|
|
25789
25802
|
let declaration = EMPTY_HEAP_DECLARATION;
|
|
25790
25803
|
for (const manifestPath of [path$1.join(spec.addonDir, "package.json"), path$1.join(path$1.dirname(spec.addonDir), "package.json")]) try {
|
|
25791
|
-
const raw = fs.readFileSync(manifestPath, "utf8");
|
|
25804
|
+
const raw = fs$1.readFileSync(manifestPath, "utf8");
|
|
25792
25805
|
const parsed = JSON.parse(raw);
|
|
25793
25806
|
const profile = extractHeapProfile(parsed, spec.addonId);
|
|
25794
25807
|
const maxOldSpaceMb = extractMaxOldSpaceMb(parsed, spec.addonId);
|
|
@@ -27010,17 +27023,17 @@ var JobJournal = class {
|
|
|
27010
27023
|
return path$1.join(this.jobsDir, `${id}.json`);
|
|
27011
27024
|
}
|
|
27012
27025
|
writeAtomic(filePath, data) {
|
|
27013
|
-
fs.mkdirSync(path$1.dirname(filePath), { recursive: true });
|
|
27026
|
+
fs$1.mkdirSync(path$1.dirname(filePath), { recursive: true });
|
|
27014
27027
|
const tmp = `${filePath}.tmp.${process.pid}.${Date.now()}`;
|
|
27015
|
-
fs.writeFileSync(tmp, JSON.stringify(data, null, 2), {
|
|
27028
|
+
fs$1.writeFileSync(tmp, JSON.stringify(data, null, 2), {
|
|
27016
27029
|
encoding: "utf-8",
|
|
27017
27030
|
mode: 384
|
|
27018
27031
|
});
|
|
27019
|
-
fs.renameSync(tmp, filePath);
|
|
27032
|
+
fs$1.renameSync(tmp, filePath);
|
|
27020
27033
|
}
|
|
27021
27034
|
readIndex() {
|
|
27022
27035
|
try {
|
|
27023
|
-
const raw = JSON.parse(fs.readFileSync(this.indexPath, "utf-8"));
|
|
27036
|
+
const raw = JSON.parse(fs$1.readFileSync(this.indexPath, "utf-8"));
|
|
27024
27037
|
if (raw && Array.isArray(raw.jobIds)) return {
|
|
27025
27038
|
version: 1,
|
|
27026
27039
|
jobIds: raw.jobIds
|
|
@@ -27045,7 +27058,7 @@ var JobJournal = class {
|
|
|
27045
27058
|
}
|
|
27046
27059
|
getJob(id) {
|
|
27047
27060
|
try {
|
|
27048
|
-
const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs.readFileSync(this.jobPath(id), "utf-8")));
|
|
27061
|
+
const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs$1.readFileSync(this.jobPath(id), "utf-8")));
|
|
27049
27062
|
return parsed.success ? parsed.data : null;
|
|
27050
27063
|
} catch {
|
|
27051
27064
|
return null;
|
|
@@ -27110,14 +27123,14 @@ var StagingArea = class {
|
|
|
27110
27123
|
}
|
|
27111
27124
|
async fetchAndStage(input) {
|
|
27112
27125
|
const destDir = path$1.join(this.stagingDir, input.jobId, safeSegment(input.name));
|
|
27113
|
-
fs.rmSync(destDir, {
|
|
27126
|
+
fs$1.rmSync(destDir, {
|
|
27114
27127
|
recursive: true,
|
|
27115
27128
|
force: true
|
|
27116
27129
|
});
|
|
27117
27130
|
const tgz = await this.deps.fetchTarball(input.name, input.version, input.signal);
|
|
27118
27131
|
if (input.signal.aborted) throw new Error("staging aborted after fetch");
|
|
27119
27132
|
await this.deps.extract(tgz, destDir);
|
|
27120
|
-
const raw = JSON.parse(fs.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
|
|
27133
|
+
const raw = JSON.parse(fs$1.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
|
|
27121
27134
|
if (typeof raw.version !== "string" || raw.version.length === 0) throw new Error(`staging validation failed: ${input.name} staged a package.json with no version`);
|
|
27122
27135
|
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}`);
|
|
27123
27136
|
return {
|
|
@@ -27126,7 +27139,7 @@ var StagingArea = class {
|
|
|
27126
27139
|
};
|
|
27127
27140
|
}
|
|
27128
27141
|
cleanup(jobId) {
|
|
27129
|
-
fs.rmSync(path$1.join(this.stagingDir, jobId), {
|
|
27142
|
+
fs$1.rmSync(path$1.join(this.stagingDir, jobId), {
|
|
27130
27143
|
recursive: true,
|
|
27131
27144
|
force: true
|
|
27132
27145
|
});
|
|
@@ -27141,13 +27154,13 @@ var StagingArea = class {
|
|
|
27141
27154
|
sweepOrphans() {
|
|
27142
27155
|
let entries;
|
|
27143
27156
|
try {
|
|
27144
|
-
entries = fs.readdirSync(this.stagingDir);
|
|
27157
|
+
entries = fs$1.readdirSync(this.stagingDir);
|
|
27145
27158
|
} catch {
|
|
27146
27159
|
return 0;
|
|
27147
27160
|
}
|
|
27148
27161
|
let removed = 0;
|
|
27149
27162
|
for (const name of entries) try {
|
|
27150
|
-
fs.rmSync(path$1.join(this.stagingDir, name), {
|
|
27163
|
+
fs$1.rmSync(path$1.join(this.stagingDir, name), {
|
|
27151
27164
|
recursive: true,
|
|
27152
27165
|
force: true
|
|
27153
27166
|
});
|
|
@@ -27325,7 +27338,7 @@ var LifecycleJobEngine = class {
|
|
|
27325
27338
|
* on failure → `failed`.
|
|
27326
27339
|
*/
|
|
27327
27340
|
async reconcileJob(job) {
|
|
27328
|
-
const exists = this.deps.stagedPathExists ?? ((p) => fs.existsSync(p));
|
|
27341
|
+
const exists = this.deps.stagedPathExists ?? ((p) => fs$1.existsSync(p));
|
|
27329
27342
|
for (const task of job.tasks) {
|
|
27330
27343
|
if (task.target === "framework") {
|
|
27331
27344
|
if (!this.isTerminal(task.phase)) this.skipFrameworkTask(job, task);
|
|
@@ -27544,6 +27557,8 @@ var en_default = {
|
|
|
27544
27557
|
"globalSettings.s_local-access.httpPort.description": "Dedicated listener. Must not equal the HTTPS port (4443 by default).",
|
|
27545
27558
|
"globalSettings.s_local-access.mdnsAdvertise.label": "Announce this hub on the LAN (mDNS)",
|
|
27546
27559
|
"globalSettings.s_local-access.mdnsAdvertise.description": "Lets `camstack login` find the hub without an address. Advertises only the HTTPS address, never a secret. Needs UDP 5353 multicast to reach the LAN (host networking or a dedicated container IP).",
|
|
27560
|
+
"globalSettings.s_local-access.passiveDiscovery.label": "Find new devices on the LAN by listening",
|
|
27561
|
+
"globalSettings.s_local-access.passiveDiscovery.description": "On by default. Listens for mDNS and SSDP announcements and proposes the devices an integration can adopt; a low-cost scan also runs every 30 minutes. It never sends a probe of its own. Needs UDP multicast to reach the LAN (host networking or a dedicated container IP).",
|
|
27547
27562
|
"globalSettings.s_local-access.localHostname.label": "Local hostname",
|
|
27548
27563
|
"globalSettings.s_local-access.localHostname.description": "Advertised to the viewer instead of the raw LAN IP, and added to the certificate SAN. Requires this name to resolve on the LAN (router DNS, mDNS, or a hosts file). Leave empty to keep using the IP.",
|
|
27549
27564
|
"globalSettings.s_loki-logging.title": "Loki",
|
|
@@ -27807,6 +27822,8 @@ var it_default = {
|
|
|
27807
27822
|
"globalSettings.s_local-access.httpPort.description": "Listener dedicato. Non deve coincidere con la porta HTTPS (4443 per impostazione predefinita).",
|
|
27808
27823
|
"globalSettings.s_local-access.mdnsAdvertise.label": "Annuncia questo hub sulla LAN (mDNS)",
|
|
27809
27824
|
"globalSettings.s_local-access.mdnsAdvertise.description": "Permette a `camstack login` di trovare l'hub senza indirizzo. Annuncia solo l'indirizzo HTTPS, mai un segreto. Richiede il multicast UDP 5353 per raggiungere la LAN (rete host o IP dedicato del container).",
|
|
27825
|
+
"globalSettings.s_local-access.passiveDiscovery.label": "Trova nuovi dispositivi in rete restando in ascolto",
|
|
27826
|
+
"globalSettings.s_local-access.passiveDiscovery.description": "Attivo di default. Ascolta gli annunci mDNS e SSDP e propone i dispositivi che un'integrazione puo' adottare; ogni 30 minuti parte anche una scansione leggera. Non invia mai sonde proprie. Richiede che il multicast UDP raggiunga la LAN (rete host o IP dedicato al container).",
|
|
27810
27827
|
"globalSettings.s_local-access.localHostname.label": "Nome host locale",
|
|
27811
27828
|
"globalSettings.s_local-access.localHostname.description": "Annunciato al visualizzatore al posto dell'IP LAN grezzo e aggiunto al SAN del certificato. Richiede che questo nome si risolva sulla LAN (DNS del router, mDNS o file hosts). Lascia vuoto per continuare a usare l'IP.",
|
|
27812
27829
|
"globalSettings.s_loki-logging.title": "Loki",
|
|
@@ -27962,7 +27979,7 @@ var CatalogRegistry = class {
|
|
|
27962
27979
|
const file = path$1.join(packageDir, "i18n", `${lang}.json`);
|
|
27963
27980
|
let text;
|
|
27964
27981
|
try {
|
|
27965
|
-
text = fs.readFileSync(file, "utf8");
|
|
27982
|
+
text = fs$1.readFileSync(file, "utf8");
|
|
27966
27983
|
} catch {
|
|
27967
27984
|
continue;
|
|
27968
27985
|
}
|