@camstack/server 1.2.741 → 1.2.742
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 +7 -0
- package/dist/api/core/cap-providers.js +167 -43
- package/dist/api/core/integration-role.js +20 -0
- package/dist/api/trpc/generated-cap-mounts.js +18 -1
- package/dist/api/trpc/generated-cap-routers.js +2427 -2381
- package/package.json +14 -12
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/{agent-https-CNf7_i1z.js → agent-https-CsDhLoui.js} +1 -1
- package/system/dist/{agent-https-BtTMjLgk.mjs → agent-https-lgka7y2l.mjs} +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 +4 -4
- package/system/dist/builtins/alerts/alerts.addon.mjs +4 -4
- 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 +4 -4
- package/system/dist/builtins/camera-grid/index.mjs +4 -4
- 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 +193 -3
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +193 -3
- package/system/dist/builtins/core-blocks/migrations/index.d.ts +5 -0
- package/system/dist/builtins/core-blocks/migrations/pump-cycle-split.d.ts +43 -0
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +3 -3
- package/system/dist/builtins/keychain/index.mjs +3 -3
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +5 -5
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +30 -27
- package/system/dist/builtins/loki-logging/index.mjs +30 -27
- package/system/dist/builtins/loki-logging/loki-logging.addon.d.ts +7 -0
- package/system/dist/builtins/loki-logging/migrations/index.d.ts +7 -0
- package/system/dist/builtins/loki-logging/retire-enabled-flag.d.ts +8 -23
- 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/integration-registry.d.ts +2 -2
- 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-DUmnnLrw.mjs → composition-sources-BE6yrVCB.mjs} +1 -1
- package/system/dist/{composition-sources-D9GBwT5d.js → composition-sources-ny5MCbhd.js} +1 -1
- package/system/dist/{constants-Cy5svHxz.js → constants-BbgVaoOX.js} +1 -1
- package/system/dist/{constants-BkiDA8Cf.mjs → constants-DiDTdj26.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-CxlqxrvG.js → device-ca-BdgE_3J6.js} +1 -1
- package/system/dist/{device-ca-Cxu7j6aY.mjs → device-ca-CVcZIfhA.mjs} +1 -1
- package/system/dist/{dist-C5sQPOZX.mjs → dist-BqlGZK-1.mjs} +297 -132
- package/system/dist/{dist-Cyc4oyGh.js → dist-DdlfeOQx.js} +302 -131
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-CTPWSgwo.mjs → hub-mdns-ciao-BZsVTXQ7.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-YxQ97aHW.js → hub-mdns-ciao-D3ZQMWjg.js} +2 -2
- package/system/dist/index.js +14 -9
- package/system/dist/index.mjs +225 -220
- package/system/dist/migrations/hub/2026-11-02-integration-addon-id-bare.d.ts +3 -0
- package/system/dist/{restore-archive-08Uthry1.mjs → restore-archive-BFem7ZuS.mjs} +94 -94
- package/system/dist/{restore-archive-b5rBXY1e.js → restore-archive-Ch76C3VQ.js} +1 -1
- package/system/dist/{retention-i8aZ6vE5.mjs → retention-D5Vk8FXc.mjs} +1 -1
- package/system/dist/{retention-DWCHp91p.js → retention-DWsfcaKe.js} +1 -1
- package/system/dist/{wal-maintenance-CEi8PqMh.mjs → wal-maintenance-CS-Wtg9w.mjs} +0 -0
- package/system/dist/{wal-maintenance-DNE7RTcS.js → wal-maintenance-DcVdVWDD.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 { Bs as resolveCapMount, E as CatalogFileSchema, Fo as RUNTIME_DEFAULTS, Fs as parseJsonObject, Hr as kebabToCamel$1, Hs as scopeKey, Io as ReadinessRegistry, Is as parseJsonUnknown, Ki as resolveMethodAuth, Lo as ReadinessTimeoutError, Nr as isArrayOutputSchema, Pr as isCollectionArrayMethod, Rs as readinessKey, Vr as isVoidInput, Xo as asNumber, Xs as userError, Yo as asJsonObject$1, Zo as asString$1, Zs as withoutCallerStamp, _i as objectInputDeclaresAddonId, _o as CALLER_STAMPED_CAPABILITIES$1, a as AGENT_MDNS_TXT_KEYS, as as createEvent$1, ba as supportedRuntimes, bo as DEVICE_STATUS_METHOD, bt as METHOD_ACCESS_MAP, ds as emitDownForOwnedCaps, ei as logLevelAtMost, fa as splitTranslationRef, hn as bareAddonId, hr as extractNestedAddonId, hs as getDebugInterest, i as AGENT_MDNS_SERVICE_TYPE, ji as procedureAuthKey, kr as interpolate, na as scopesAllowDeviceCap, nc as EventCategory$1, o as ALL_CAPABILITY_DEFINITIONS, on as addonSettingsCapability, ps as expandCapMethods, qr as lifecycleJobSchema, ta as scopesAllowAddon, tc as errMsg$1, ti as looseSchema, us as defineRecordKinds, vi as objectInputDeclaresRequiredDeviceId, vo as DATAPLANE_SECRET_HEADER$1, vt as LOG_LEVEL_RANK, y as CATALOG_LANGS, yo as DEVICE_SETTINGS_CONTRIBUTION_METHODS, ys as isDebugChannelName, zr as isObjectInput } from "./dist-BqlGZK-1.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-CVcZIfhA.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-CS-Wtg9w.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-lgka7y2l.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-DiDTdj26.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-BZsVTXQ7.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-BFem7ZuS.mjs";
|
|
43
|
+
import { r as nodeCoralFs, t as classifyCoralAccelerator } from "./coral-accelerators-DBlgWB8k.mjs";
|
|
44
44
|
import { z } from "zod";
|
|
45
45
|
import * as crypto$1 from "node:crypto";
|
|
46
46
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
@@ -55,7 +55,7 @@ import { BOOT_RECOVERY_BACKOFF_MS, CALLER_STAMPED_CAPABILITIES, DATAPLANE_SECRET
|
|
|
55
55
|
import * as os$1 from "node:os";
|
|
56
56
|
import { tmpdir } from "node:os";
|
|
57
57
|
import { pathToFileURL } from "node:url";
|
|
58
|
-
import * as fs from "node:fs";
|
|
58
|
+
import * as fs$1 from "node:fs";
|
|
59
59
|
import { accessSync, constants, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync } from "node:fs";
|
|
60
60
|
import { execFile, spawn } from "node:child_process";
|
|
61
61
|
import { once } from "node:events";
|
|
@@ -5113,7 +5113,7 @@ var PythonEnvManager = class {
|
|
|
5113
5113
|
async ensure(options) {
|
|
5114
5114
|
const probe = await this.probe();
|
|
5115
5115
|
if (!probe.available || !probe.path) throw userError("system.python-required", void 0, "Python 3.10+ is required but not found on this system");
|
|
5116
|
-
if (!fs.existsSync(path$1.join(this.venvPath, "bin", "python"))) await execFileAsync$7(probe.path, [
|
|
5116
|
+
if (!fs$1.existsSync(path$1.join(this.venvPath, "bin", "python"))) await execFileAsync$7(probe.path, [
|
|
5117
5117
|
"-m",
|
|
5118
5118
|
"venv",
|
|
5119
5119
|
this.venvPath
|
|
@@ -5136,7 +5136,7 @@ var PythonEnvManager = class {
|
|
|
5136
5136
|
}
|
|
5137
5137
|
spawn(script, args) {
|
|
5138
5138
|
const venvPython = path$1.join(this.venvPath, "bin", "python");
|
|
5139
|
-
if (!fs.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
|
|
5139
|
+
if (!fs$1.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
|
|
5140
5140
|
return spawn(venvPython, [script, ...args]);
|
|
5141
5141
|
}
|
|
5142
5142
|
};
|
|
@@ -5488,20 +5488,20 @@ var StorageManager = class {
|
|
|
5488
5488
|
const basePath = this.locationManager.getBackend(mappedName).basePath;
|
|
5489
5489
|
location.files = {
|
|
5490
5490
|
async readFile(p) {
|
|
5491
|
-
return fs.promises.readFile(path$1.join(basePath, p));
|
|
5491
|
+
return fs$1.promises.readFile(path$1.join(basePath, p));
|
|
5492
5492
|
},
|
|
5493
5493
|
async writeFile(p, data) {
|
|
5494
5494
|
const full = path$1.join(basePath, p);
|
|
5495
|
-
await fs.promises.mkdir(path$1.dirname(full), { recursive: true });
|
|
5496
|
-
await fs.promises.writeFile(full, data);
|
|
5495
|
+
await fs$1.promises.mkdir(path$1.dirname(full), { recursive: true });
|
|
5496
|
+
await fs$1.promises.writeFile(full, data);
|
|
5497
5497
|
},
|
|
5498
5498
|
async deleteFile(p) {
|
|
5499
|
-
await fs.promises.rm(path$1.join(basePath, p), { force: true });
|
|
5499
|
+
await fs$1.promises.rm(path$1.join(basePath, p), { force: true });
|
|
5500
5500
|
},
|
|
5501
5501
|
async listFiles(prefix) {
|
|
5502
5502
|
const dir = prefix ? path$1.join(basePath, prefix) : basePath;
|
|
5503
5503
|
try {
|
|
5504
|
-
return (await fs.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
|
|
5504
|
+
return (await fs$1.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
|
|
5505
5505
|
} catch {
|
|
5506
5506
|
return [];
|
|
5507
5507
|
}
|
|
@@ -5511,7 +5511,7 @@ var StorageManager = class {
|
|
|
5511
5511
|
},
|
|
5512
5512
|
async exists(p) {
|
|
5513
5513
|
try {
|
|
5514
|
-
await fs.promises.access(path$1.join(basePath, p));
|
|
5514
|
+
await fs$1.promises.access(path$1.join(basePath, p));
|
|
5515
5515
|
return true;
|
|
5516
5516
|
} catch {
|
|
5517
5517
|
return false;
|
|
@@ -5950,7 +5950,11 @@ var IntegrationRegistry = class IntegrationRegistry {
|
|
|
5950
5950
|
if (!isNaN(num)) integrationCounter = num;
|
|
5951
5951
|
}
|
|
5952
5952
|
}
|
|
5953
|
-
async createIntegration(
|
|
5953
|
+
async createIntegration(rawInput) {
|
|
5954
|
+
const input = {
|
|
5955
|
+
...rawInput,
|
|
5956
|
+
addonId: bareAddonId(rawInput.addonId)
|
|
5957
|
+
};
|
|
5954
5958
|
const id = nextIntegrationId();
|
|
5955
5959
|
const now = Math.floor(Date.now() / 1e3);
|
|
5956
5960
|
const enabled = input.enabled !== false;
|
|
@@ -6011,7 +6015,8 @@ var IntegrationRegistry = class IntegrationRegistry {
|
|
|
6011
6015
|
});
|
|
6012
6016
|
return rows[0] ? this.mapIntegration(rows[0].data) : null;
|
|
6013
6017
|
}
|
|
6014
|
-
async getIntegrationByAddonId(
|
|
6018
|
+
async getIntegrationByAddonId(rawAddonId) {
|
|
6019
|
+
const addonId = bareAddonId(rawAddonId);
|
|
6015
6020
|
const kind = this.recordStores?.integrations;
|
|
6016
6021
|
if (kind !== void 0) {
|
|
6017
6022
|
const row = (await kind.query({
|
|
@@ -6282,7 +6287,7 @@ var TRADITIONAL_NATIVE_PACKAGES = ["better-sqlite3"];
|
|
|
6282
6287
|
function hasDotNode(dir, maxDepth) {
|
|
6283
6288
|
let entries;
|
|
6284
6289
|
try {
|
|
6285
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
6290
|
+
entries = fs$1.readdirSync(dir, { withFileTypes: true });
|
|
6286
6291
|
} catch {
|
|
6287
6292
|
return false;
|
|
6288
6293
|
}
|
|
@@ -6293,7 +6298,7 @@ function hasDotNode(dir, maxDepth) {
|
|
|
6293
6298
|
}
|
|
6294
6299
|
/** Locate the bundled `prebuild-install` bin.js inside the staged closure. */
|
|
6295
6300
|
function resolvePrebuildInstallBin(closureDir, moduleDir) {
|
|
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.existsSync(c)) ?? null;
|
|
6301
|
+
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;
|
|
6297
6302
|
}
|
|
6298
6303
|
/**
|
|
6299
6304
|
* Default fetcher: run the closure's own `prebuild-install` under the CURRENT
|
|
@@ -6346,7 +6351,7 @@ async function ensureNativePrebuilds(closureDir, options) {
|
|
|
6346
6351
|
const fetched = [];
|
|
6347
6352
|
for (const pkg of packages) {
|
|
6348
6353
|
const moduleDir = path$1.join(nm, pkg);
|
|
6349
|
-
if (!fs.existsSync(moduleDir)) continue;
|
|
6354
|
+
if (!fs$1.existsSync(moduleDir)) continue;
|
|
6350
6355
|
if (hasDotNode(moduleDir, 4)) continue;
|
|
6351
6356
|
options.logger.warn("staged closure native prebuild missing — fetching for running ABI", { meta: {
|
|
6352
6357
|
pkg,
|
|
@@ -6409,12 +6414,12 @@ async function ensureNativePrebuilds(closureDir, options) {
|
|
|
6409
6414
|
function replantFromBundled(srcModuleDir, dstModuleDir, hasNative) {
|
|
6410
6415
|
if (!hasNative(srcModuleDir)) return false;
|
|
6411
6416
|
try {
|
|
6412
|
-
fs.rmSync(dstModuleDir, {
|
|
6417
|
+
fs$1.rmSync(dstModuleDir, {
|
|
6413
6418
|
recursive: true,
|
|
6414
6419
|
force: true
|
|
6415
6420
|
});
|
|
6416
|
-
fs.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
|
|
6417
|
-
fs.cpSync(srcModuleDir, dstModuleDir, {
|
|
6421
|
+
fs$1.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
|
|
6422
|
+
fs$1.cpSync(srcModuleDir, dstModuleDir, {
|
|
6418
6423
|
recursive: true,
|
|
6419
6424
|
dereference: true
|
|
6420
6425
|
});
|
|
@@ -6443,7 +6448,7 @@ async function ensureAddonNativePrebuilds(addonDir, options) {
|
|
|
6443
6448
|
const missing = [];
|
|
6444
6449
|
for (const pkg of packages) {
|
|
6445
6450
|
const moduleDir = path$1.join(nm, pkg);
|
|
6446
|
-
if (!fs.existsSync(moduleDir)) continue;
|
|
6451
|
+
if (!fs$1.existsSync(moduleDir)) continue;
|
|
6447
6452
|
if (hasNative(moduleDir)) {
|
|
6448
6453
|
results.push({
|
|
6449
6454
|
pkg,
|
|
@@ -6542,7 +6547,7 @@ async function defaultDownloadTarball(url, destTgz) {
|
|
|
6542
6547
|
const res = await fetch(url);
|
|
6543
6548
|
if (!res.ok || !res.body) throw new Error(`HTTP ${res.status} downloading ${url}`);
|
|
6544
6549
|
const bytes = Buffer.from(await res.arrayBuffer());
|
|
6545
|
-
await fs.promises.writeFile(destTgz, bytes);
|
|
6550
|
+
await fs$1.promises.writeFile(destTgz, bytes);
|
|
6546
6551
|
}
|
|
6547
6552
|
async function defaultExtractTarball(tgzPath, destDir) {
|
|
6548
6553
|
await execFileAsync$5("tar", [
|
|
@@ -6628,7 +6633,7 @@ async function resolveUncached(options) {
|
|
|
6628
6633
|
argsPrefix: []
|
|
6629
6634
|
};
|
|
6630
6635
|
const cliPath = bootstrappedCliPath(options.cacheDir);
|
|
6631
|
-
if (fs.existsSync(cliPath)) {
|
|
6636
|
+
if (fs$1.existsSync(cliPath)) {
|
|
6632
6637
|
options.logger.info("system npm unavailable — using bootstrapped npm", { meta: { cliPath } });
|
|
6633
6638
|
return {
|
|
6634
6639
|
command: process.execPath,
|
|
@@ -6640,12 +6645,12 @@ async function resolveUncached(options) {
|
|
|
6640
6645
|
const registry = (options.registry ?? DEFAULT_REGISTRY).replace(/\/+$/, "");
|
|
6641
6646
|
const tarballUrl = tarballUrlOf(await (options.fetchJson ?? defaultFetchJson)(`${registry}/npm/latest`));
|
|
6642
6647
|
if (!tarballUrl) throw new Error(`registry metadata for 'npm' carries no dist.tarball (${registry})`);
|
|
6643
|
-
await fs.promises.mkdir(options.cacheDir, { recursive: true });
|
|
6648
|
+
await fs$1.promises.mkdir(options.cacheDir, { recursive: true });
|
|
6644
6649
|
const tgzPath = path$1.join(options.cacheDir, "npm-bootstrap.tgz");
|
|
6645
6650
|
await (options.downloadTarball ?? defaultDownloadTarball)(tarballUrl, tgzPath);
|
|
6646
6651
|
await (options.extractTarball ?? defaultExtractTarball)(tgzPath, options.cacheDir);
|
|
6647
|
-
await fs.promises.rm(tgzPath, { force: true });
|
|
6648
|
-
if (!fs.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
|
|
6652
|
+
await fs$1.promises.rm(tgzPath, { force: true });
|
|
6653
|
+
if (!fs$1.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
|
|
6649
6654
|
options.logger.info("npm bootstrapped", { meta: { cliPath } });
|
|
6650
6655
|
return {
|
|
6651
6656
|
command: process.execPath,
|
|
@@ -6711,7 +6716,7 @@ function readOwningPackageVersion(entryPath) {
|
|
|
6711
6716
|
let dir = path$1.dirname(entryPath);
|
|
6712
6717
|
for (let hop = 0; hop < PACKAGE_JSON_LOOKUP_DEPTH; hop++) {
|
|
6713
6718
|
try {
|
|
6714
|
-
const version = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
|
|
6719
|
+
const version = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
|
|
6715
6720
|
if (typeof version === "string" && version.length > 0) return version;
|
|
6716
6721
|
} catch {}
|
|
6717
6722
|
const parent = path$1.dirname(dir);
|
|
@@ -6755,14 +6760,14 @@ function readOwningPackageVersion(entryPath) {
|
|
|
6755
6760
|
function addonModuleCacheKey(entryPath) {
|
|
6756
6761
|
let stat;
|
|
6757
6762
|
try {
|
|
6758
|
-
stat = fs.statSync(entryPath);
|
|
6763
|
+
stat = fs$1.statSync(entryPath);
|
|
6759
6764
|
} catch {
|
|
6760
6765
|
return null;
|
|
6761
6766
|
}
|
|
6762
6767
|
const version = readOwningPackageVersion(entryPath) ?? `m${stat.mtimeMs}`;
|
|
6763
6768
|
let content;
|
|
6764
6769
|
try {
|
|
6765
|
-
content = createHash("sha1").update(fs.readFileSync(entryPath)).digest("hex").slice(0, 16);
|
|
6770
|
+
content = createHash("sha1").update(fs$1.readFileSync(entryPath)).digest("hex").slice(0, 16);
|
|
6766
6771
|
} catch {
|
|
6767
6772
|
content = `m${stat.mtimeMs}s${stat.size}`;
|
|
6768
6773
|
}
|
|
@@ -6866,14 +6871,14 @@ var AddonLoader = class {
|
|
|
6866
6871
|
* BUILTINS from the active closure, not the (now-inert) addons-dir copy, so
|
|
6867
6872
|
* the addons-dir `@camstack/server/system` must NOT be double-loaded here. */
|
|
6868
6873
|
async loadFromDirectory(addonsDir, skipPackages = []) {
|
|
6869
|
-
if (!fs.existsSync(addonsDir)) return;
|
|
6874
|
+
if (!fs$1.existsSync(addonsDir)) return;
|
|
6870
6875
|
const skip = new Set(skipPackages);
|
|
6871
|
-
const entries = fs.readdirSync(addonsDir, { withFileTypes: true });
|
|
6876
|
+
const entries = fs$1.readdirSync(addonsDir, { withFileTypes: true });
|
|
6872
6877
|
for (const entry of entries) {
|
|
6873
6878
|
if (!isDirectoryEntry(entry, addonsDir)) continue;
|
|
6874
6879
|
if (entry.name.startsWith("@")) {
|
|
6875
6880
|
const scopeDir = path$1.join(addonsDir, entry.name);
|
|
6876
|
-
const scopeEntries = fs.readdirSync(scopeDir, { withFileTypes: true });
|
|
6881
|
+
const scopeEntries = fs$1.readdirSync(scopeDir, { withFileTypes: true });
|
|
6877
6882
|
for (const scopeEntry of scopeEntries) {
|
|
6878
6883
|
if (!isDirectoryEntry(scopeEntry, scopeDir)) continue;
|
|
6879
6884
|
if (skip.has(`${entry.name}/${scopeEntry.name}`)) continue;
|
|
@@ -6887,7 +6892,7 @@ var AddonLoader = class {
|
|
|
6887
6892
|
}
|
|
6888
6893
|
async tryLoadAddon(addonDir) {
|
|
6889
6894
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
6890
|
-
if (!fs.existsSync(pkgJsonPath)) return;
|
|
6895
|
+
if (!fs$1.existsSync(pkgJsonPath)) return;
|
|
6891
6896
|
try {
|
|
6892
6897
|
await this.loadFromAddonDir(addonDir);
|
|
6893
6898
|
} catch (err) {
|
|
@@ -6905,7 +6910,7 @@ var AddonLoader = class {
|
|
|
6905
6910
|
/** Load addon from a specific directory (package.json + dist/) */
|
|
6906
6911
|
async loadFromAddonDir(addonDir) {
|
|
6907
6912
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
6908
|
-
const pkgJson = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
6913
|
+
const pkgJson = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
6909
6914
|
const packageNameRaw = pkgJson["name"];
|
|
6910
6915
|
const packageName = typeof packageNameRaw === "string" ? packageNameRaw : "";
|
|
6911
6916
|
const packageVersionRaw = pkgJson["version"];
|
|
@@ -6952,7 +6957,7 @@ var AddonLoader = class {
|
|
|
6952
6957
|
}
|
|
6953
6958
|
const entryFile = declaration.entry.replace(/^\.\//, "").replace(/^src\//, "dist/").replace(/\.ts$/, ".js");
|
|
6954
6959
|
let entryPath = path$1.resolve(addonDir, entryFile);
|
|
6955
|
-
if (!fs.existsSync(entryPath)) {
|
|
6960
|
+
if (!fs$1.existsSync(entryPath)) {
|
|
6956
6961
|
const base = entryPath.replace(/\.(js|cjs|mjs)$/, "");
|
|
6957
6962
|
entryPath = [
|
|
6958
6963
|
`${base}.cjs`,
|
|
@@ -6961,9 +6966,9 @@ var AddonLoader = class {
|
|
|
6961
6966
|
path$1.resolve(addonDir, "dist", "index.cjs"),
|
|
6962
6967
|
path$1.resolve(addonDir, "dist", "index.mjs"),
|
|
6963
6968
|
path$1.resolve(addonDir, declaration.entry)
|
|
6964
|
-
].find((p) => fs.existsSync(p)) ?? entryPath;
|
|
6969
|
+
].find((p) => fs$1.existsSync(p)) ?? entryPath;
|
|
6965
6970
|
}
|
|
6966
|
-
if (!fs.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
|
|
6971
|
+
if (!fs$1.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
|
|
6967
6972
|
const modUnknown = await importAddonModuleFresh(entryPath);
|
|
6968
6973
|
const mod = isRecord$4(modUnknown) ? modUnknown : {};
|
|
6969
6974
|
const AddonClass = resolveAddonClass(mod);
|
|
@@ -7048,7 +7053,7 @@ function isDirectoryEntry(entry, parentDir) {
|
|
|
7048
7053
|
if (entry.name.startsWith(".")) return false;
|
|
7049
7054
|
if (entry.isDirectory()) return true;
|
|
7050
7055
|
if (entry.isSymbolicLink()) try {
|
|
7051
|
-
return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
7056
|
+
return fs$1.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
7052
7057
|
} catch {
|
|
7053
7058
|
return false;
|
|
7054
7059
|
}
|
|
@@ -7142,7 +7147,7 @@ var execFileAsync$4 = promisify(execFile);
|
|
|
7142
7147
|
* Single source of truth — replaces scattered mkdirSync calls.
|
|
7143
7148
|
*/
|
|
7144
7149
|
function ensureDir(dirPath) {
|
|
7145
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
|
7150
|
+
fs$1.mkdirSync(dirPath, { recursive: true });
|
|
7146
7151
|
}
|
|
7147
7152
|
/**
|
|
7148
7153
|
* Copy a directory recursively — ASYNC so it never blocks the event loop.
|
|
@@ -7155,7 +7160,7 @@ function ensureDir(dirPath) {
|
|
|
7155
7160
|
* `fs.promises.cp` keeps the I/O off the event loop. (Node ≥18 stable.)
|
|
7156
7161
|
*/
|
|
7157
7162
|
async function copyDirRecursive(src, dest) {
|
|
7158
|
-
await fs.promises.cp(src, dest, {
|
|
7163
|
+
await fs$1.promises.cp(src, dest, {
|
|
7159
7164
|
recursive: true,
|
|
7160
7165
|
force: true
|
|
7161
7166
|
});
|
|
@@ -7260,13 +7265,13 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
7260
7265
|
if (typeof fileEntry !== "string") continue;
|
|
7261
7266
|
if (fileEntry === "dist" || fileEntry.includes("*")) continue;
|
|
7262
7267
|
const srcPath = path$1.join(sourceDir, fileEntry);
|
|
7263
|
-
if (!fs.existsSync(srcPath)) continue;
|
|
7268
|
+
if (!fs$1.existsSync(srcPath)) continue;
|
|
7264
7269
|
const destPath = path$1.join(destDir, fileEntry);
|
|
7265
|
-
const stat = await fs.promises.stat(srcPath);
|
|
7270
|
+
const stat = await fs$1.promises.stat(srcPath);
|
|
7266
7271
|
if (stat.isDirectory()) await copyDirRecursive(srcPath, destPath);
|
|
7267
7272
|
else if (stat.isFile()) {
|
|
7268
7273
|
ensureDir(path$1.dirname(destPath));
|
|
7269
|
-
await fs.promises.copyFile(srcPath, destPath);
|
|
7274
|
+
await fs$1.promises.copyFile(srcPath, destPath);
|
|
7270
7275
|
}
|
|
7271
7276
|
}
|
|
7272
7277
|
}
|
|
@@ -7277,10 +7282,10 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
7277
7282
|
function isSourceNewer(packageDir) {
|
|
7278
7283
|
const srcDir = path$1.join(packageDir, "src");
|
|
7279
7284
|
const distDir = path$1.join(packageDir, "dist");
|
|
7280
|
-
if (!fs.existsSync(srcDir) || !fs.existsSync(distDir)) return true;
|
|
7285
|
+
if (!fs$1.existsSync(srcDir) || !fs$1.existsSync(distDir)) return true;
|
|
7281
7286
|
try {
|
|
7282
|
-
const distMtime = fs.statSync(distDir).mtimeMs;
|
|
7283
|
-
const entries = fs.readdirSync(srcDir, {
|
|
7287
|
+
const distMtime = fs$1.statSync(distDir).mtimeMs;
|
|
7288
|
+
const entries = fs$1.readdirSync(srcDir, {
|
|
7284
7289
|
withFileTypes: true,
|
|
7285
7290
|
recursive: true
|
|
7286
7291
|
});
|
|
@@ -7288,7 +7293,7 @@ function isSourceNewer(packageDir) {
|
|
|
7288
7293
|
if (!entry.isFile()) continue;
|
|
7289
7294
|
const parentDir = entry.parentPath ?? String(Reflect.get(entry, "path") ?? "");
|
|
7290
7295
|
const filePath = path$1.join(parentDir, entry.name);
|
|
7291
|
-
if (fs.statSync(filePath).mtimeMs > distMtime) return true;
|
|
7296
|
+
if (fs$1.statSync(filePath).mtimeMs > distMtime) return true;
|
|
7292
7297
|
}
|
|
7293
7298
|
return false;
|
|
7294
7299
|
} catch {
|
|
@@ -7305,7 +7310,7 @@ function isSourceNewer(packageDir) {
|
|
|
7305
7310
|
* `copyDirRecursive` for the wedge this prevents.
|
|
7306
7311
|
*/
|
|
7307
7312
|
async function installPackageFromNpm(packageName, targetDir) {
|
|
7308
|
-
const tmpDir = await fs.promises.mkdtemp(path$1.join(os$1.tmpdir(), "camstack-install-"));
|
|
7313
|
+
const tmpDir = await fs$1.promises.mkdtemp(path$1.join(os$1.tmpdir(), "camstack-install-"));
|
|
7309
7314
|
try {
|
|
7310
7315
|
const { stdout } = await execFileAsync$4("npm", [
|
|
7311
7316
|
"pack",
|
|
@@ -7328,21 +7333,21 @@ async function installPackageFromNpm(packageName, targetDir) {
|
|
|
7328
7333
|
extractDir
|
|
7329
7334
|
], { timeout: 3e4 });
|
|
7330
7335
|
const packageSubDir = path$1.join(extractDir, "package");
|
|
7331
|
-
const srcPkgJsonDir = fs.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
|
|
7332
|
-
await fs.promises.rm(targetDir, {
|
|
7336
|
+
const srcPkgJsonDir = fs$1.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
|
|
7337
|
+
await fs$1.promises.rm(targetDir, {
|
|
7333
7338
|
recursive: true,
|
|
7334
7339
|
force: true
|
|
7335
7340
|
});
|
|
7336
7341
|
ensureDir(targetDir);
|
|
7337
|
-
await fs.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
|
|
7342
|
+
await fs$1.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
|
|
7338
7343
|
const distSrc = path$1.join(srcPkgJsonDir, "dist");
|
|
7339
|
-
if (fs.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
|
|
7344
|
+
if (fs$1.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
|
|
7340
7345
|
try {
|
|
7341
|
-
const npmPkg = asJsonObject$1(parseJsonUnknown(await fs.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
7346
|
+
const npmPkg = asJsonObject$1(parseJsonUnknown(await fs$1.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
7342
7347
|
if (npmPkg) await copyExtraFileDirs(npmPkg, srcPkgJsonDir, targetDir);
|
|
7343
7348
|
} catch {}
|
|
7344
7349
|
} finally {
|
|
7345
|
-
await fs.promises.rm(tmpDir, {
|
|
7350
|
+
await fs$1.promises.rm(tmpDir, {
|
|
7346
7351
|
recursive: true,
|
|
7347
7352
|
force: true
|
|
7348
7353
|
});
|
|
@@ -7367,7 +7372,7 @@ function packageDirName$1(declaredName) {
|
|
|
7367
7372
|
}
|
|
7368
7373
|
function isDirLike$1(p) {
|
|
7369
7374
|
try {
|
|
7370
|
-
return fs.statSync(p).isDirectory();
|
|
7375
|
+
return fs$1.statSync(p).isDirectory();
|
|
7371
7376
|
} catch {
|
|
7372
7377
|
return false;
|
|
7373
7378
|
}
|
|
@@ -7385,12 +7390,12 @@ var AddonManifest = class {
|
|
|
7385
7390
|
*/
|
|
7386
7391
|
read() {
|
|
7387
7392
|
if (this.cache != null) return this.cache;
|
|
7388
|
-
if (!fs.existsSync(this.manifestPath)) {
|
|
7393
|
+
if (!fs$1.existsSync(this.manifestPath)) {
|
|
7389
7394
|
this.cache = this.empty();
|
|
7390
7395
|
return this.cache;
|
|
7391
7396
|
}
|
|
7392
7397
|
try {
|
|
7393
|
-
const raw = fs.readFileSync(this.manifestPath, "utf-8");
|
|
7398
|
+
const raw = fs$1.readFileSync(this.manifestPath, "utf-8");
|
|
7394
7399
|
const parsed = JSON.parse(raw);
|
|
7395
7400
|
if (parsed.version !== MANIFEST_VERSION) {
|
|
7396
7401
|
process.stderr.write(`[AddonManifest] schema mismatch (file=${parsed.version} vs runtime=${MANIFEST_VERSION}); starting empty\n`);
|
|
@@ -7411,13 +7416,13 @@ var AddonManifest = class {
|
|
|
7411
7416
|
* a half-written file.
|
|
7412
7417
|
*/
|
|
7413
7418
|
write(manifest) {
|
|
7414
|
-
fs.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
|
|
7419
|
+
fs$1.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
|
|
7415
7420
|
const tmp = `${this.manifestPath}.tmp.${process.pid}.${Date.now()}`;
|
|
7416
|
-
fs.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
|
|
7421
|
+
fs$1.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
|
|
7417
7422
|
encoding: "utf-8",
|
|
7418
7423
|
mode: 384
|
|
7419
7424
|
});
|
|
7420
|
-
fs.renameSync(tmp, this.manifestPath);
|
|
7425
|
+
fs$1.renameSync(tmp, this.manifestPath);
|
|
7421
7426
|
this.cache = manifest;
|
|
7422
7427
|
}
|
|
7423
7428
|
/** Lookup a single addon's manifest entry, or `null` if not tracked. */
|
|
@@ -7492,22 +7497,22 @@ var AddonManifest = class {
|
|
|
7492
7497
|
* exactly what moved. Returns the total number of changes.
|
|
7493
7498
|
*/
|
|
7494
7499
|
reconcileFromDisk(addonsDir, onChange) {
|
|
7495
|
-
if (!fs.existsSync(addonsDir)) return 0;
|
|
7500
|
+
if (!fs$1.existsSync(addonsDir)) return 0;
|
|
7496
7501
|
const m = this.read();
|
|
7497
7502
|
let changes = 0;
|
|
7498
7503
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7499
7504
|
/** Package name → version, for every ADDON package actually installed. */
|
|
7500
7505
|
const onDisk = /* @__PURE__ */ new Map();
|
|
7501
|
-
for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7506
|
+
for (const scope of fs$1.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7502
7507
|
if (!scope.name.startsWith("@") || !isDirLike$1(path$1.join(addonsDir, scope.name))) continue;
|
|
7503
7508
|
const scopeDir = path$1.join(addonsDir, scope.name);
|
|
7504
|
-
for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7509
|
+
for (const pkg of fs$1.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7505
7510
|
if (!isDirLike$1(path$1.join(scopeDir, pkg.name))) continue;
|
|
7506
7511
|
const pkgJsonPath = path$1.join(scopeDir, pkg.name, "package.json");
|
|
7507
|
-
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
7512
|
+
if (!fs$1.existsSync(pkgJsonPath)) continue;
|
|
7508
7513
|
let pkgJson;
|
|
7509
7514
|
try {
|
|
7510
|
-
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
7515
|
+
const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
|
|
7511
7516
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
7512
7517
|
pkgJson = parsed;
|
|
7513
7518
|
} catch {
|
|
@@ -7578,28 +7583,28 @@ var AddonManifest = class {
|
|
|
7578
7583
|
migrateFromInstallSourceMarkers(addonsDir) {
|
|
7579
7584
|
const m = this.read();
|
|
7580
7585
|
if (Object.keys(m.addons).length > 0) return 0;
|
|
7581
|
-
if (!fs.existsSync(addonsDir)) return 0;
|
|
7586
|
+
if (!fs$1.existsSync(addonsDir)) return 0;
|
|
7582
7587
|
let migrated = 0;
|
|
7583
7588
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7584
|
-
for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7589
|
+
for (const scope of fs$1.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7585
7590
|
if (!scope.isDirectory() || !scope.name.startsWith("@")) continue;
|
|
7586
7591
|
const scopeDir = path$1.join(addonsDir, scope.name);
|
|
7587
|
-
for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7592
|
+
for (const pkg of fs$1.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7588
7593
|
if (!pkg.isDirectory()) continue;
|
|
7589
7594
|
const pkgDir = path$1.join(scopeDir, pkg.name);
|
|
7590
7595
|
const markerPath = path$1.join(pkgDir, ".install-source");
|
|
7591
7596
|
const pkgJsonPath = path$1.join(pkgDir, "package.json");
|
|
7592
|
-
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
7597
|
+
if (!fs$1.existsSync(pkgJsonPath)) continue;
|
|
7593
7598
|
let pkgJson;
|
|
7594
7599
|
try {
|
|
7595
|
-
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
7600
|
+
const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
|
|
7596
7601
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
7597
7602
|
pkgJson = parsed;
|
|
7598
7603
|
} catch {
|
|
7599
7604
|
continue;
|
|
7600
7605
|
}
|
|
7601
7606
|
if (!pkgJson.name || !pkgJson.version) continue;
|
|
7602
|
-
const source = fs.existsSync(markerPath) ? fs.readFileSync(markerPath, "utf-8").trim() : "bundled";
|
|
7607
|
+
const source = fs$1.existsSync(markerPath) ? fs$1.readFileSync(markerPath, "utf-8").trim() : "bundled";
|
|
7603
7608
|
m.addons[pkgJson.name] = {
|
|
7604
7609
|
name: pkgJson.name,
|
|
7605
7610
|
version: pkgJson.version,
|
|
@@ -7803,7 +7808,7 @@ function planClosureDedupe(input) {
|
|
|
7803
7808
|
function readTreeManifest(pkgJsonPath) {
|
|
7804
7809
|
let raw;
|
|
7805
7810
|
try {
|
|
7806
|
-
raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
|
|
7811
|
+
raw = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8")));
|
|
7807
7812
|
} catch {
|
|
7808
7813
|
return null;
|
|
7809
7814
|
}
|
|
@@ -7828,7 +7833,7 @@ function readTreeManifest(pkgJsonPath) {
|
|
|
7828
7833
|
function listTopLevelEntries(nodeModulesDir) {
|
|
7829
7834
|
let entries;
|
|
7830
7835
|
try {
|
|
7831
|
-
entries = fs.readdirSync(nodeModulesDir, { withFileTypes: true });
|
|
7836
|
+
entries = fs$1.readdirSync(nodeModulesDir, { withFileTypes: true });
|
|
7832
7837
|
} catch {
|
|
7833
7838
|
return [];
|
|
7834
7839
|
}
|
|
@@ -7838,7 +7843,7 @@ function listTopLevelEntries(nodeModulesDir) {
|
|
|
7838
7843
|
if (entry.name.startsWith("@")) {
|
|
7839
7844
|
let inner;
|
|
7840
7845
|
try {
|
|
7841
|
-
inner = fs.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
|
|
7846
|
+
inner = fs$1.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
|
|
7842
7847
|
} catch {
|
|
7843
7848
|
continue;
|
|
7844
7849
|
}
|
|
@@ -7871,14 +7876,14 @@ function collectAddonTreeState(addonDir) {
|
|
|
7871
7876
|
const entryDir = path$1.join(nodeModulesDir, name);
|
|
7872
7877
|
let isLink = false;
|
|
7873
7878
|
try {
|
|
7874
|
-
isLink = fs.lstatSync(entryDir).isSymbolicLink();
|
|
7879
|
+
isLink = fs$1.lstatSync(entryDir).isSymbolicLink();
|
|
7875
7880
|
} catch {
|
|
7876
7881
|
continue;
|
|
7877
7882
|
}
|
|
7878
7883
|
if (isLink) {
|
|
7879
7884
|
let target = "";
|
|
7880
7885
|
try {
|
|
7881
|
-
target = fs.readlinkSync(entryDir);
|
|
7886
|
+
target = fs$1.readlinkSync(entryDir);
|
|
7882
7887
|
} catch {}
|
|
7883
7888
|
existingLinks.push({
|
|
7884
7889
|
name,
|
|
@@ -7892,7 +7897,7 @@ function collectAddonTreeState(addonDir) {
|
|
|
7892
7897
|
version: manifest.version
|
|
7893
7898
|
});
|
|
7894
7899
|
for (const [depName, range] of manifest.ranges) {
|
|
7895
|
-
if (fs.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
|
|
7900
|
+
if (fs$1.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
|
|
7896
7901
|
addRange(depName, range);
|
|
7897
7902
|
}
|
|
7898
7903
|
}
|
|
@@ -7922,7 +7927,7 @@ function resolveClosureNodeModulesDir(explicitDir) {
|
|
|
7922
7927
|
const frameworkDir = explicitDir ?? process.env["CAMSTACK_FRAMEWORK_DIR"];
|
|
7923
7928
|
if (frameworkDir === void 0 || frameworkDir.length === 0) return null;
|
|
7924
7929
|
const nodeModulesDir = explicitDir ?? path$1.join(frameworkDir, "node_modules");
|
|
7925
|
-
return fs.existsSync(nodeModulesDir) ? nodeModulesDir : null;
|
|
7930
|
+
return fs$1.existsSync(nodeModulesDir) ? nodeModulesDir : null;
|
|
7926
7931
|
}
|
|
7927
7932
|
function symlinkType() {
|
|
7928
7933
|
return process.platform === "win32" ? "junction" : "dir";
|
|
@@ -7941,10 +7946,10 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
|
|
|
7941
7946
|
const nodeModulesDir = path$1.join(addonDir, "node_modules");
|
|
7942
7947
|
const probePath = path$1.join(nodeModulesDir, ".closure-link-probe");
|
|
7943
7948
|
try {
|
|
7944
|
-
fs.mkdirSync(nodeModulesDir, { recursive: true });
|
|
7945
|
-
fs.rmSync(probePath, { force: true });
|
|
7946
|
-
fs.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
|
|
7947
|
-
fs.rmSync(probePath, { force: true });
|
|
7949
|
+
fs$1.mkdirSync(nodeModulesDir, { recursive: true });
|
|
7950
|
+
fs$1.rmSync(probePath, { force: true });
|
|
7951
|
+
fs$1.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
|
|
7952
|
+
fs$1.rmSync(probePath, { force: true });
|
|
7948
7953
|
} catch (err) {
|
|
7949
7954
|
logger.warn("closure dedupe skipped — symlinks unavailable on this volume", { meta: {
|
|
7950
7955
|
addonDir,
|
|
@@ -7966,12 +7971,12 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
|
|
|
7966
7971
|
}
|
|
7967
7972
|
const entryDir = path$1.join(nodeModulesDir, link.name);
|
|
7968
7973
|
try {
|
|
7969
|
-
fs.rmSync(entryDir, {
|
|
7974
|
+
fs$1.rmSync(entryDir, {
|
|
7970
7975
|
recursive: true,
|
|
7971
7976
|
force: true
|
|
7972
7977
|
});
|
|
7973
|
-
fs.mkdirSync(path$1.dirname(entryDir), { recursive: true });
|
|
7974
|
-
fs.symlinkSync(target, entryDir, symlinkType());
|
|
7978
|
+
fs$1.mkdirSync(path$1.dirname(entryDir), { recursive: true });
|
|
7979
|
+
fs$1.symlinkSync(target, entryDir, symlinkType());
|
|
7975
7980
|
linked.push(link.name);
|
|
7976
7981
|
} catch (err) {
|
|
7977
7982
|
logger.warn("closure dedupe — link failed; entry removed copy may need reinstall", { meta: {
|
|
@@ -8047,7 +8052,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
|
|
|
8047
8052
|
count: Object.keys(native).length
|
|
8048
8053
|
} });
|
|
8049
8054
|
try {
|
|
8050
|
-
fs.writeFileSync(markerFile, markerHash);
|
|
8055
|
+
fs$1.writeFileSync(markerFile, markerHash);
|
|
8051
8056
|
} catch (err) {
|
|
8052
8057
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
8053
8058
|
markerFile,
|
|
@@ -8085,7 +8090,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
|
|
|
8085
8090
|
}
|
|
8086
8091
|
await rebuildNativeDeps(addonDir, pending.map(([name]) => name), logger, npmCacheDir ?? defaultNpmCacheDir(), registry);
|
|
8087
8092
|
try {
|
|
8088
|
-
fs.writeFileSync(markerFile, markerHash);
|
|
8093
|
+
fs$1.writeFileSync(markerFile, markerHash);
|
|
8089
8094
|
} catch (err) {
|
|
8090
8095
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
8091
8096
|
markerFile,
|
|
@@ -8107,12 +8112,12 @@ function copyPrebuiltNativeDep(name, addonDir, logger) {
|
|
|
8107
8112
|
if (source === target) continue;
|
|
8108
8113
|
if (!hasBuiltBinary(source)) continue;
|
|
8109
8114
|
try {
|
|
8110
|
-
fs.rmSync(target, {
|
|
8115
|
+
fs$1.rmSync(target, {
|
|
8111
8116
|
recursive: true,
|
|
8112
8117
|
force: true
|
|
8113
8118
|
});
|
|
8114
|
-
fs.mkdirSync(path$1.dirname(target), { recursive: true });
|
|
8115
|
-
fs.cpSync(source, target, {
|
|
8119
|
+
fs$1.mkdirSync(path$1.dirname(target), { recursive: true });
|
|
8120
|
+
fs$1.cpSync(source, target, {
|
|
8116
8121
|
recursive: true,
|
|
8117
8122
|
dereference: true
|
|
8118
8123
|
});
|
|
@@ -8148,7 +8153,7 @@ var BUNDLED_NATIVE_SIBLING_SCOPES = {
|
|
|
8148
8153
|
function hasAnyDotNode(dir, maxDepth) {
|
|
8149
8154
|
let entries;
|
|
8150
8155
|
try {
|
|
8151
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
8156
|
+
entries = fs$1.readdirSync(dir, { withFileTypes: true });
|
|
8152
8157
|
} catch {
|
|
8153
8158
|
return false;
|
|
8154
8159
|
}
|
|
@@ -8162,12 +8167,12 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
|
|
|
8162
8167
|
if (!hasAnyDotNode(src, 5)) return;
|
|
8163
8168
|
if (hasAnyDotNode(dst, 5)) return;
|
|
8164
8169
|
try {
|
|
8165
|
-
fs.rmSync(dst, {
|
|
8170
|
+
fs$1.rmSync(dst, {
|
|
8166
8171
|
recursive: true,
|
|
8167
8172
|
force: true
|
|
8168
8173
|
});
|
|
8169
|
-
fs.mkdirSync(path$1.dirname(dst), { recursive: true });
|
|
8170
|
-
fs.cpSync(src, dst, {
|
|
8174
|
+
fs$1.mkdirSync(path$1.dirname(dst), { recursive: true });
|
|
8175
|
+
fs$1.cpSync(src, dst, {
|
|
8171
8176
|
recursive: true,
|
|
8172
8177
|
dereference: true
|
|
8173
8178
|
});
|
|
@@ -8202,7 +8207,7 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
|
|
|
8202
8207
|
*/
|
|
8203
8208
|
function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
8204
8209
|
const srcNm = path$1.join(sourceDir, "node_modules");
|
|
8205
|
-
if (!fs.existsSync(srcNm)) return;
|
|
8210
|
+
if (!fs$1.existsSync(srcNm)) return;
|
|
8206
8211
|
const dstNm = path$1.join(targetDir, "node_modules");
|
|
8207
8212
|
for (const [name, scopes] of Object.entries(BUNDLED_NATIVE_SIBLING_SCOPES)) {
|
|
8208
8213
|
copyPrebuiltModuleDir(path$1.join(srcNm, name), path$1.join(dstNm, name), name, logger);
|
|
@@ -8210,7 +8215,7 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
|
8210
8215
|
const scopeSrc = path$1.join(srcNm, scope);
|
|
8211
8216
|
let siblings;
|
|
8212
8217
|
try {
|
|
8213
|
-
siblings = fs.readdirSync(scopeSrc);
|
|
8218
|
+
siblings = fs$1.readdirSync(scopeSrc);
|
|
8214
8219
|
} catch {
|
|
8215
8220
|
continue;
|
|
8216
8221
|
}
|
|
@@ -8220,12 +8225,12 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
|
8220
8225
|
}
|
|
8221
8226
|
/** A package dir is "built" when it carries a compiled `.node` or a prebuilds tree. */
|
|
8222
8227
|
function hasBuiltBinary(pkgDir) {
|
|
8223
|
-
if (!fs.existsSync(path$1.join(pkgDir, "package.json"))) return false;
|
|
8228
|
+
if (!fs$1.existsSync(path$1.join(pkgDir, "package.json"))) return false;
|
|
8224
8229
|
const releaseDir = path$1.join(pkgDir, "build", "Release");
|
|
8225
8230
|
try {
|
|
8226
|
-
if (fs.existsSync(releaseDir) && fs.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
|
|
8231
|
+
if (fs$1.existsSync(releaseDir) && fs$1.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
|
|
8227
8232
|
} catch {}
|
|
8228
|
-
return fs.existsSync(path$1.join(pkgDir, "prebuilds"));
|
|
8233
|
+
return fs$1.existsSync(path$1.join(pkgDir, "prebuilds"));
|
|
8229
8234
|
}
|
|
8230
8235
|
/** Candidate hoisted locations for `<name>`: NODE_PATH entries + ancestors of `addonDir`. */
|
|
8231
8236
|
function candidateHoistedDirs(name, addonDir) {
|
|
@@ -8263,7 +8268,7 @@ function hashDeclaration(deps) {
|
|
|
8263
8268
|
}
|
|
8264
8269
|
function markerMatches(markerFile, expected) {
|
|
8265
8270
|
try {
|
|
8266
|
-
return fs.readFileSync(markerFile, "utf-8").trim() === expected;
|
|
8271
|
+
return fs$1.readFileSync(markerFile, "utf-8").trim() === expected;
|
|
8267
8272
|
} catch {
|
|
8268
8273
|
return false;
|
|
8269
8274
|
}
|
|
@@ -8370,7 +8375,7 @@ function parseInstallSource(value) {
|
|
|
8370
8375
|
function readPackageJson(pkgJsonPath) {
|
|
8371
8376
|
let raw;
|
|
8372
8377
|
try {
|
|
8373
|
-
raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
|
|
8378
|
+
raw = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8")));
|
|
8374
8379
|
} catch {
|
|
8375
8380
|
return null;
|
|
8376
8381
|
}
|
|
@@ -8412,7 +8417,7 @@ function shouldSkipClosureProvidedSeed(packageName, isResolvable) {
|
|
|
8412
8417
|
var REGISTRY_LATEST_TIMEOUT_MS = 15e3;
|
|
8413
8418
|
function readInstalledPackageVersion(addonDir) {
|
|
8414
8419
|
try {
|
|
8415
|
-
const raw = JSON.parse(fs.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
|
|
8420
|
+
const raw = JSON.parse(fs$1.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
|
|
8416
8421
|
if (raw === null || typeof raw !== "object") return null;
|
|
8417
8422
|
const version = Reflect.get(raw, "version");
|
|
8418
8423
|
return typeof version === "string" && version.length > 0 ? version : null;
|
|
@@ -8553,7 +8558,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8553
8558
|
} catch {
|
|
8554
8559
|
return Object.freeze([]);
|
|
8555
8560
|
}
|
|
8556
|
-
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
8561
|
+
const raw = fs$1.readFileSync(pkgPath, "utf-8");
|
|
8557
8562
|
const parsed = JSON.parse(raw);
|
|
8558
8563
|
const deps = Object.keys(parsed.dependencies ?? {});
|
|
8559
8564
|
const agentOnly = new Set(parsed.camstack?.agentOnlyBootstrapAddons ?? []);
|
|
@@ -8598,7 +8603,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8598
8603
|
} catch {
|
|
8599
8604
|
return Object.freeze([]);
|
|
8600
8605
|
}
|
|
8601
|
-
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
8606
|
+
const raw = fs$1.readFileSync(pkgPath, "utf-8");
|
|
8602
8607
|
const addons = JSON.parse(raw).camstack?.agentBootstrapAddons ?? [];
|
|
8603
8608
|
return Object.freeze(["@camstack/server", ...addons]);
|
|
8604
8609
|
}
|
|
@@ -8628,7 +8633,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8628
8633
|
this.logger.info(`Install source: ${isLocal ? `bundle (${this.bundledAddonsDir})` : "npm"}, ${pkgList.length} package(s)`);
|
|
8629
8634
|
for (const packageName of pkgList) {
|
|
8630
8635
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
8631
|
-
if (fs.existsSync(path$1.join(addonDir, "package.json"))) {
|
|
8636
|
+
if (fs$1.existsSync(path$1.join(addonDir, "package.json"))) {
|
|
8632
8637
|
if (isLocal || shouldSkipClosureProvidedSeed(packageName, this.isResolvableFromClosure(packageName))) {
|
|
8633
8638
|
this.logger.debug(`${packageName} — already installed, skipping`);
|
|
8634
8639
|
continue;
|
|
@@ -8772,7 +8777,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8772
8777
|
const installedPackages = this.listInstalled();
|
|
8773
8778
|
for (const pkg of installedPackages) {
|
|
8774
8779
|
try {
|
|
8775
|
-
if (fs.lstatSync(pkg.dir).isSymbolicLink()) continue;
|
|
8780
|
+
if (fs$1.lstatSync(pkg.dir).isSymbolicLink()) continue;
|
|
8776
8781
|
} catch {
|
|
8777
8782
|
continue;
|
|
8778
8783
|
}
|
|
@@ -8812,7 +8817,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8812
8817
|
if (closureNodeModules !== null) for (const link of state.existingLinks) {
|
|
8813
8818
|
if (!isClosureLinkTarget(link.target, closureNodeModules)) continue;
|
|
8814
8819
|
const linkDir = path$1.join(nodeModulesDir, link.name);
|
|
8815
|
-
const targetManifest = fs.existsSync(path$1.join(linkDir, "package.json"));
|
|
8820
|
+
const targetManifest = fs$1.existsSync(path$1.join(linkDir, "package.json"));
|
|
8816
8821
|
const ranges = state.requirements.get(link.name) ?? [];
|
|
8817
8822
|
let holds = targetManifest;
|
|
8818
8823
|
if (holds && ranges.length > 0) {
|
|
@@ -8821,14 +8826,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8821
8826
|
}
|
|
8822
8827
|
if (!holds) {
|
|
8823
8828
|
this.logger.warn(`${packageName} — closure link for ${link.name} no longer holds; reinstalling this addon's deps`, { meta: { target: link.target } });
|
|
8824
|
-
fs.rmSync(linkDir, { force: true });
|
|
8829
|
+
fs$1.rmSync(linkDir, { force: true });
|
|
8825
8830
|
needsInstall = true;
|
|
8826
8831
|
}
|
|
8827
8832
|
}
|
|
8828
8833
|
const linked = [];
|
|
8829
8834
|
for (const [depName, range] of declaredEntries) {
|
|
8830
8835
|
if (typeof range !== "string") continue;
|
|
8831
|
-
if (fs.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
|
|
8836
|
+
if (fs$1.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
|
|
8832
8837
|
const closureVersion = closureNodeModules === null ? void 0 : readClosureVersions(closureNodeModules, [depName]).get(depName);
|
|
8833
8838
|
if (closureNodeModules !== null && closureVersion !== void 0 && closureSatisfiesRange(range, closureVersion)) {
|
|
8834
8839
|
if (executeClosureDedupe(addonDir, closureNodeModules, {
|
|
@@ -8861,7 +8866,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8861
8866
|
const closureNodeModules = resolveClosureNodeModulesDir(this.closureNodeModulesDir);
|
|
8862
8867
|
if (closureNodeModules !== null) {
|
|
8863
8868
|
const state = collectAddonTreeState(addonDir);
|
|
8864
|
-
for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
|
|
8869
|
+
for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs$1.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
|
|
8865
8870
|
}
|
|
8866
8871
|
this.logger.info(`${packageName} — reinstalling runtime dependencies`, { meta: { addonDir } });
|
|
8867
8872
|
await runNpm([
|
|
@@ -8906,7 +8911,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8906
8911
|
async realignFromClosure(packageName, closureDir) {
|
|
8907
8912
|
const targetDir = path$1.join(this.addonsDir, packageName);
|
|
8908
8913
|
const result = await this.installLocal(packageName, closureDir);
|
|
8909
|
-
await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
|
|
8914
|
+
await fs$1.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
|
|
8910
8915
|
this.manifest.upsert(result.name, {
|
|
8911
8916
|
version: result.version,
|
|
8912
8917
|
source: "closure"
|
|
@@ -8922,17 +8927,17 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8922
8927
|
async installCopy(packageName, sourceDir, pkgData, targetDir) {
|
|
8923
8928
|
await this.ensureBuilt(packageName, sourceDir, pkgData);
|
|
8924
8929
|
const distDir = path$1.join(sourceDir, "dist");
|
|
8925
|
-
if (!fs.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
|
|
8926
|
-
await fs.promises.rm(targetDir, {
|
|
8930
|
+
if (!fs$1.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
|
|
8931
|
+
await fs$1.promises.rm(targetDir, {
|
|
8927
8932
|
recursive: true,
|
|
8928
8933
|
force: true
|
|
8929
8934
|
});
|
|
8930
8935
|
ensureDir(targetDir);
|
|
8931
|
-
await fs.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
|
|
8936
|
+
await fs$1.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
|
|
8932
8937
|
await copyDirRecursive(distDir, path$1.join(targetDir, "dist"));
|
|
8933
8938
|
await copyExtraFileDirs(pkgData, sourceDir, targetDir);
|
|
8934
8939
|
copyBundledNativeModules(sourceDir, targetDir, this.logger);
|
|
8935
|
-
await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
|
|
8940
|
+
await fs$1.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
|
|
8936
8941
|
const localPkgVersion = asString$1(pkgData.version, "0.0.0");
|
|
8937
8942
|
this.manifest.upsert(packageName, {
|
|
8938
8943
|
version: localPkgVersion,
|
|
@@ -8973,7 +8978,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8973
8978
|
* unusual auth, offline mode, etc).
|
|
8974
8979
|
*/
|
|
8975
8980
|
async installFromNpm(packageName, version) {
|
|
8976
|
-
const tmpDir = fs.mkdtempSync(path$1.join(os$1.tmpdir(), "camstack-addon-npm-"));
|
|
8981
|
+
const tmpDir = fs$1.mkdtempSync(path$1.join(os$1.tmpdir(), "camstack-addon-npm-"));
|
|
8977
8982
|
const packageSpec = version ? `${packageName}@${version}` : packageName;
|
|
8978
8983
|
this.logger.info(`${packageName} — installing from npm`);
|
|
8979
8984
|
try {
|
|
@@ -8987,19 +8992,19 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8987
8992
|
];
|
|
8988
8993
|
if (this.registry) args.push("--registry", this.registry);
|
|
8989
8994
|
const { stdout } = await runNpm(args, this.npmRunOptions(tmpDir, 12e4));
|
|
8990
|
-
const tgzFiles = fs.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
|
|
8995
|
+
const tgzFiles = fs$1.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
|
|
8991
8996
|
if (tgzFiles.length === 0) throw new Error(`npm pack produced no tgz. stdout: ${stdout.trim()}`);
|
|
8992
8997
|
return path$1.join(tmpDir, tgzFiles[0]);
|
|
8993
8998
|
});
|
|
8994
8999
|
const result = await this.installFromTgz(tgzPath);
|
|
8995
|
-
fs.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
|
|
9000
|
+
fs$1.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
|
|
8996
9001
|
this.manifest.upsert(result.name, {
|
|
8997
9002
|
version: result.version,
|
|
8998
9003
|
source: "npm"
|
|
8999
9004
|
});
|
|
9000
9005
|
return result;
|
|
9001
9006
|
} finally {
|
|
9002
|
-
fs.rmSync(tmpDir, {
|
|
9007
|
+
fs$1.rmSync(tmpDir, {
|
|
9003
9008
|
recursive: true,
|
|
9004
9009
|
force: true
|
|
9005
9010
|
});
|
|
@@ -9037,7 +9042,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9037
9042
|
if (!tarRes.ok) throw new Error(`tarball GET ${tarballUrl} → ${tarRes.status}`);
|
|
9038
9043
|
const tgzPath = path$1.join(tmpDir, `${packageName.replace(/[/@]/g, "-").replace(/^-+/, "")}-${resolvedVersion}.tgz`);
|
|
9039
9044
|
const buf = Buffer.from(await tarRes.arrayBuffer());
|
|
9040
|
-
fs.writeFileSync(tgzPath, buf);
|
|
9045
|
+
fs$1.writeFileSync(tgzPath, buf);
|
|
9041
9046
|
return tgzPath;
|
|
9042
9047
|
}
|
|
9043
9048
|
/**
|
|
@@ -9058,7 +9063,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9058
9063
|
* on the next deploy.
|
|
9059
9064
|
*/
|
|
9060
9065
|
async evictInstallDir(targetDir) {
|
|
9061
|
-
if (!fs.existsSync(targetDir)) return;
|
|
9066
|
+
if (!fs$1.existsSync(targetDir)) return;
|
|
9062
9067
|
const graveyard = path$1.join(this.addonsDir, ".evicting");
|
|
9063
9068
|
ensureDir(graveyard);
|
|
9064
9069
|
await this.sweepGraveyard(graveyard);
|
|
@@ -9066,10 +9071,10 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9066
9071
|
const flatName = path$1.relative(this.addonsDir, targetDir).replace(/[/\\]/g, "-");
|
|
9067
9072
|
const asideDir = path$1.join(graveyard, `${flatName}-${ts}`);
|
|
9068
9073
|
try {
|
|
9069
|
-
fs.renameSync(targetDir, asideDir);
|
|
9074
|
+
fs$1.renameSync(targetDir, asideDir);
|
|
9070
9075
|
} catch (renameErr) {
|
|
9071
9076
|
if (renameErr.code === "EXDEV") {
|
|
9072
|
-
await fs.promises.rm(targetDir, {
|
|
9077
|
+
await fs$1.promises.rm(targetDir, {
|
|
9073
9078
|
recursive: true,
|
|
9074
9079
|
force: true
|
|
9075
9080
|
});
|
|
@@ -9077,7 +9082,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9077
9082
|
}
|
|
9078
9083
|
throw renameErr;
|
|
9079
9084
|
}
|
|
9080
|
-
await fs.promises.rm(asideDir, {
|
|
9085
|
+
await fs$1.promises.rm(asideDir, {
|
|
9081
9086
|
recursive: true,
|
|
9082
9087
|
force: true
|
|
9083
9088
|
}).catch((cleanupErr) => {
|
|
@@ -9098,14 +9103,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9098
9103
|
async sweepStagingResidue(stagingRoot) {
|
|
9099
9104
|
let names;
|
|
9100
9105
|
try {
|
|
9101
|
-
names = fs.readdirSync(stagingRoot);
|
|
9106
|
+
names = fs$1.readdirSync(stagingRoot);
|
|
9102
9107
|
} catch {
|
|
9103
9108
|
return;
|
|
9104
9109
|
}
|
|
9105
9110
|
const now = Date.now();
|
|
9106
9111
|
const ages = [];
|
|
9107
9112
|
for (const name of names) try {
|
|
9108
|
-
const stat = fs.statSync(path$1.join(stagingRoot, name));
|
|
9113
|
+
const stat = fs$1.statSync(path$1.join(stagingRoot, name));
|
|
9109
9114
|
ages.push({
|
|
9110
9115
|
name,
|
|
9111
9116
|
ageMs: now - stat.mtimeMs
|
|
@@ -9116,7 +9121,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9116
9121
|
stagingRoot,
|
|
9117
9122
|
entries: sweepable
|
|
9118
9123
|
} });
|
|
9119
|
-
await Promise.all(sweepable.map((name) => fs.promises.rm(path$1.join(stagingRoot, name), {
|
|
9124
|
+
await Promise.all(sweepable.map((name) => fs$1.promises.rm(path$1.join(stagingRoot, name), {
|
|
9120
9125
|
recursive: true,
|
|
9121
9126
|
force: true
|
|
9122
9127
|
}).catch(() => void 0)));
|
|
@@ -9125,11 +9130,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9125
9130
|
async sweepGraveyard(graveyard) {
|
|
9126
9131
|
let entries;
|
|
9127
9132
|
try {
|
|
9128
|
-
entries = fs.readdirSync(graveyard);
|
|
9133
|
+
entries = fs$1.readdirSync(graveyard);
|
|
9129
9134
|
} catch {
|
|
9130
9135
|
return;
|
|
9131
9136
|
}
|
|
9132
|
-
await Promise.all(entries.map((name) => fs.promises.rm(path$1.join(graveyard, name), {
|
|
9137
|
+
await Promise.all(entries.map((name) => fs$1.promises.rm(path$1.join(graveyard, name), {
|
|
9133
9138
|
recursive: true,
|
|
9134
9139
|
force: true
|
|
9135
9140
|
}).catch(() => void 0)));
|
|
@@ -9180,7 +9185,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9180
9185
|
return;
|
|
9181
9186
|
}
|
|
9182
9187
|
const strippedManifest = stripBundledDeps(pkgView.raw);
|
|
9183
|
-
await fs.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
|
|
9188
|
+
await fs$1.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
|
|
9184
9189
|
const deps = asJsonObject$1(strippedManifest["dependencies"]);
|
|
9185
9190
|
const depNames = deps ? Object.keys(deps) : [];
|
|
9186
9191
|
if (depNames.length === 0) return;
|
|
@@ -9312,9 +9317,9 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9312
9317
|
"-C",
|
|
9313
9318
|
stagingDir
|
|
9314
9319
|
], { timeout: 12e4 });
|
|
9315
|
-
const pkgDir = fs.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
|
|
9320
|
+
const pkgDir = fs$1.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
|
|
9316
9321
|
const pkgJsonPath = path$1.join(pkgDir, "package.json");
|
|
9317
|
-
if (!fs.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
|
|
9322
|
+
if (!fs$1.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
|
|
9318
9323
|
const pkgView = readPackageJson(pkgJsonPath);
|
|
9319
9324
|
if (!pkgView) throw new Error(`Invalid package.json at ${pkgJsonPath}`);
|
|
9320
9325
|
if (!pkgView.camstackAddons) throw new Error(`Package ${pkgView.name} has no camstack.addons manifest`);
|
|
@@ -9324,7 +9329,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9324
9329
|
this.dedupeTreeAgainstClosure(pkgDir, pkgView.name);
|
|
9325
9330
|
await this.evictInstallDir(targetDir);
|
|
9326
9331
|
ensureDir(path$1.dirname(targetDir));
|
|
9327
|
-
await fs.promises.rename(pkgDir, targetDir);
|
|
9332
|
+
await fs$1.promises.rename(pkgDir, targetDir);
|
|
9328
9333
|
this.manifest.upsert(pkgView.name, {
|
|
9329
9334
|
version: pkgView.version,
|
|
9330
9335
|
source: "bundled"
|
|
@@ -9335,7 +9340,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9335
9340
|
};
|
|
9336
9341
|
} finally {
|
|
9337
9342
|
this.inFlightStaging.delete(stagingName);
|
|
9338
|
-
await fs.promises.rm(stagingDir, {
|
|
9343
|
+
await fs$1.promises.rm(stagingDir, {
|
|
9339
9344
|
recursive: true,
|
|
9340
9345
|
force: true
|
|
9341
9346
|
}).catch(() => void 0);
|
|
@@ -9365,24 +9370,24 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9365
9370
|
const current = this.manifest.get(packageName);
|
|
9366
9371
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
9367
9372
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9368
|
-
if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9373
|
+
if (!fs$1.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9369
9374
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
9370
9375
|
const backupRoot = path$1.join(this.addonsDir, ".backups", packageName);
|
|
9371
9376
|
ensureDir(backupRoot);
|
|
9372
9377
|
const backupDir = path$1.join(backupRoot, ts);
|
|
9373
9378
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
9374
|
-
fs.renameSync(addonDir, backupDir);
|
|
9379
|
+
fs$1.renameSync(addonDir, backupDir);
|
|
9375
9380
|
let result;
|
|
9376
9381
|
try {
|
|
9377
9382
|
result = await this.installFromNpm(packageName, version);
|
|
9378
9383
|
} catch (installErr) {
|
|
9379
9384
|
this.logger.error(`${packageName} — install failed, restoring backup`, { meta: { error: errMsg$1(installErr) } });
|
|
9380
9385
|
try {
|
|
9381
|
-
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9386
|
+
if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
|
|
9382
9387
|
recursive: true,
|
|
9383
9388
|
force: true
|
|
9384
9389
|
});
|
|
9385
|
-
fs.renameSync(backupDir, addonDir);
|
|
9390
|
+
fs$1.renameSync(backupDir, addonDir);
|
|
9386
9391
|
this.manifest.upsert(packageName, {
|
|
9387
9392
|
version: current.version,
|
|
9388
9393
|
source: current.source,
|
|
@@ -9443,7 +9448,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9443
9448
|
const current = this.manifest.get(packageName);
|
|
9444
9449
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
9445
9450
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9446
|
-
if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9451
|
+
if (!fs$1.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9447
9452
|
await this.installRuntimeDependencies(stagedPath, packageName);
|
|
9448
9453
|
await this.installNativeDependencies(stagedPath, packageName);
|
|
9449
9454
|
this.dedupeTreeAgainstClosure(stagedPath, packageName);
|
|
@@ -9452,14 +9457,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9452
9457
|
ensureDir(backupRoot);
|
|
9453
9458
|
const backupDir = path$1.join(backupRoot, ts);
|
|
9454
9459
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
9455
|
-
fs.renameSync(addonDir, backupDir);
|
|
9460
|
+
fs$1.renameSync(addonDir, backupDir);
|
|
9456
9461
|
try {
|
|
9457
9462
|
try {
|
|
9458
|
-
fs.renameSync(stagedPath, addonDir);
|
|
9463
|
+
fs$1.renameSync(stagedPath, addonDir);
|
|
9459
9464
|
} catch (renameErr) {
|
|
9460
9465
|
if (renameErr.code === "EXDEV") {
|
|
9461
|
-
fs.cpSync(stagedPath, addonDir, { recursive: true });
|
|
9462
|
-
fs.rmSync(stagedPath, {
|
|
9466
|
+
fs$1.cpSync(stagedPath, addonDir, { recursive: true });
|
|
9467
|
+
fs$1.rmSync(stagedPath, {
|
|
9463
9468
|
recursive: true,
|
|
9464
9469
|
force: true
|
|
9465
9470
|
});
|
|
@@ -9468,11 +9473,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9468
9473
|
} catch (swapErr) {
|
|
9469
9474
|
this.logger.error(`${packageName} — staged swap failed, restoring backup`, { meta: { error: errMsg$1(swapErr) } });
|
|
9470
9475
|
try {
|
|
9471
|
-
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9476
|
+
if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
|
|
9472
9477
|
recursive: true,
|
|
9473
9478
|
force: true
|
|
9474
9479
|
});
|
|
9475
|
-
fs.renameSync(backupDir, addonDir);
|
|
9480
|
+
fs$1.renameSync(backupDir, addonDir);
|
|
9476
9481
|
this.manifest.upsert(packageName, {
|
|
9477
9482
|
version: current.version,
|
|
9478
9483
|
source: current.source,
|
|
@@ -9511,20 +9516,20 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9511
9516
|
this.logger.warn(`${packageName} — no backup to rollback to`);
|
|
9512
9517
|
return null;
|
|
9513
9518
|
}
|
|
9514
|
-
if (!fs.existsSync(entry.lastBackupDir)) {
|
|
9519
|
+
if (!fs$1.existsSync(entry.lastBackupDir)) {
|
|
9515
9520
|
this.logger.warn(`${packageName} — backup dir vanished: ${entry.lastBackupDir}`);
|
|
9516
9521
|
return null;
|
|
9517
9522
|
}
|
|
9518
9523
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9519
|
-
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9524
|
+
if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
|
|
9520
9525
|
recursive: true,
|
|
9521
9526
|
force: true
|
|
9522
9527
|
});
|
|
9523
|
-
fs.renameSync(entry.lastBackupDir, addonDir);
|
|
9528
|
+
fs$1.renameSync(entry.lastBackupDir, addonDir);
|
|
9524
9529
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
9525
9530
|
let restoredVersion = entry.version;
|
|
9526
|
-
if (fs.existsSync(pkgJsonPath)) try {
|
|
9527
|
-
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
9531
|
+
if (fs$1.existsSync(pkgJsonPath)) try {
|
|
9532
|
+
const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
|
|
9528
9533
|
if (typeof parsed === "object" && parsed != null) {
|
|
9529
9534
|
const v = parsed.version;
|
|
9530
9535
|
if (typeof v === "string" && v.length > 0) restoredVersion = v;
|
|
@@ -9572,7 +9577,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9572
9577
|
return false;
|
|
9573
9578
|
}
|
|
9574
9579
|
try {
|
|
9575
|
-
await fs.promises.rm(target, {
|
|
9580
|
+
await fs$1.promises.rm(target, {
|
|
9576
9581
|
recursive: true,
|
|
9577
9582
|
force: true
|
|
9578
9583
|
});
|
|
@@ -9590,7 +9595,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9590
9595
|
listBackupsFor(packageName) {
|
|
9591
9596
|
const dir = path$1.join(this.backupsRoot, packageName);
|
|
9592
9597
|
try {
|
|
9593
|
-
return fs.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
|
|
9598
|
+
return fs$1.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
|
|
9594
9599
|
} catch {
|
|
9595
9600
|
return [];
|
|
9596
9601
|
}
|
|
@@ -9622,7 +9627,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9622
9627
|
for (const dir of [pkgDir, path$1.dirname(pkgDir)]) {
|
|
9623
9628
|
if (!this.isInsideBackups(dir)) continue;
|
|
9624
9629
|
try {
|
|
9625
|
-
await fs.promises.rmdir(dir);
|
|
9630
|
+
await fs$1.promises.rmdir(dir);
|
|
9626
9631
|
} catch {
|
|
9627
9632
|
return;
|
|
9628
9633
|
}
|
|
@@ -9704,7 +9709,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9704
9709
|
*/
|
|
9705
9710
|
resolveBackupToKeep(packageName, backups) {
|
|
9706
9711
|
const liveDir = path$1.join(this.addonsDir, packageName);
|
|
9707
|
-
if (!fs.existsSync(liveDir)) {
|
|
9712
|
+
if (!fs$1.existsSync(liveDir)) {
|
|
9708
9713
|
const newest = backups[backups.length - 1] ?? null;
|
|
9709
9714
|
if (newest != null) this.logger.warn(`${packageName} — live install dir missing; retaining its newest backup as the only surviving copy`, { meta: {
|
|
9710
9715
|
liveDir,
|
|
@@ -9721,7 +9726,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9721
9726
|
listBackedUpPackages() {
|
|
9722
9727
|
let entries;
|
|
9723
9728
|
try {
|
|
9724
|
-
entries = fs.readdirSync(this.backupsRoot, { withFileTypes: true });
|
|
9729
|
+
entries = fs$1.readdirSync(this.backupsRoot, { withFileTypes: true });
|
|
9725
9730
|
} catch {
|
|
9726
9731
|
return [];
|
|
9727
9732
|
}
|
|
@@ -9733,14 +9738,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9733
9738
|
continue;
|
|
9734
9739
|
}
|
|
9735
9740
|
const scopeDir = path$1.join(this.backupsRoot, entry.name);
|
|
9736
|
-
for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
|
|
9741
|
+
for (const inner of fs$1.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
|
|
9737
9742
|
}
|
|
9738
9743
|
return names;
|
|
9739
9744
|
}
|
|
9740
9745
|
async uninstall(packageName) {
|
|
9741
9746
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9742
|
-
if (fs.existsSync(addonDir)) {
|
|
9743
|
-
fs.rmSync(addonDir, {
|
|
9747
|
+
if (fs$1.existsSync(addonDir)) {
|
|
9748
|
+
fs$1.rmSync(addonDir, {
|
|
9744
9749
|
recursive: true,
|
|
9745
9750
|
force: true
|
|
9746
9751
|
});
|
|
@@ -9748,8 +9753,8 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9748
9753
|
return;
|
|
9749
9754
|
}
|
|
9750
9755
|
const legacyDir = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""));
|
|
9751
|
-
if (fs.existsSync(legacyDir)) {
|
|
9752
|
-
fs.rmSync(legacyDir, {
|
|
9756
|
+
if (fs$1.existsSync(legacyDir)) {
|
|
9757
|
+
fs$1.rmSync(legacyDir, {
|
|
9753
9758
|
recursive: true,
|
|
9754
9759
|
force: true
|
|
9755
9760
|
});
|
|
@@ -9757,22 +9762,22 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9757
9762
|
}
|
|
9758
9763
|
}
|
|
9759
9764
|
listInstalled() {
|
|
9760
|
-
if (!fs.existsSync(this.addonsDir)) return [];
|
|
9765
|
+
if (!fs$1.existsSync(this.addonsDir)) return [];
|
|
9761
9766
|
const packageDirs = [];
|
|
9762
|
-
for (const entry of fs.readdirSync(this.addonsDir, { withFileTypes: true })) {
|
|
9767
|
+
for (const entry of fs$1.readdirSync(this.addonsDir, { withFileTypes: true })) {
|
|
9763
9768
|
if (!isDirEntry(entry, this.addonsDir)) continue;
|
|
9764
9769
|
if (entry.name.startsWith("@")) {
|
|
9765
9770
|
const scopeDir = path$1.join(this.addonsDir, entry.name);
|
|
9766
|
-
for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
|
|
9771
|
+
for (const inner of fs$1.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
|
|
9767
9772
|
} else packageDirs.push(path$1.join(this.addonsDir, entry.name));
|
|
9768
9773
|
}
|
|
9769
9774
|
return packageDirs.map((dir) => {
|
|
9770
9775
|
const pkgPath = path$1.join(dir, "package.json");
|
|
9771
|
-
if (!fs.existsSync(pkgPath)) return null;
|
|
9776
|
+
if (!fs$1.existsSync(pkgPath)) return null;
|
|
9772
9777
|
const pkg = readPackageJson(pkgPath);
|
|
9773
9778
|
if (!pkg || !pkg.camstackAddons) return null;
|
|
9774
9779
|
const sourceFile = path$1.join(dir, ".install-source");
|
|
9775
|
-
const installSource = fs.existsSync(sourceFile) ? parseInstallSource(fs.readFileSync(sourceFile, "utf-8").trim()) : void 0;
|
|
9780
|
+
const installSource = fs$1.existsSync(sourceFile) ? parseInstallSource(fs$1.readFileSync(sourceFile, "utf-8").trim()) : void 0;
|
|
9776
9781
|
return {
|
|
9777
9782
|
name: pkg.name,
|
|
9778
9783
|
version: pkg.version,
|
|
@@ -9782,13 +9787,13 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9782
9787
|
}).filter((item) => item !== null);
|
|
9783
9788
|
}
|
|
9784
9789
|
isInstalled(packageName) {
|
|
9785
|
-
if (fs.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
|
|
9786
|
-
return fs.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
|
|
9790
|
+
if (fs$1.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
|
|
9791
|
+
return fs$1.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
|
|
9787
9792
|
}
|
|
9788
9793
|
getInstalledPackage(packageName) {
|
|
9789
9794
|
let pkgPath = path$1.join(this.addonsDir, packageName, "package.json");
|
|
9790
|
-
if (!fs.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
|
|
9791
|
-
if (!fs.existsSync(pkgPath)) return null;
|
|
9795
|
+
if (!fs$1.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
|
|
9796
|
+
if (!fs$1.existsSync(pkgPath)) return null;
|
|
9792
9797
|
const pkg = readPackageJson(pkgPath);
|
|
9793
9798
|
if (!pkg) return null;
|
|
9794
9799
|
return {
|
|
@@ -9807,7 +9812,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9807
9812
|
]) {
|
|
9808
9813
|
const candidate = path$1.join(this.bundledAddonsDir, dirName);
|
|
9809
9814
|
try {
|
|
9810
|
-
const pkg = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
|
|
9815
|
+
const pkg = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
|
|
9811
9816
|
if (pkg && asString$1(pkg["name"]) === packageName) return candidate;
|
|
9812
9817
|
} catch {}
|
|
9813
9818
|
}
|
|
@@ -9816,7 +9821,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9816
9821
|
/** Ensure a package is built (dist/ exists and page bundles present) */
|
|
9817
9822
|
async ensureBuilt(packageName, sourceDir, pkgData) {
|
|
9818
9823
|
const distDir = path$1.join(sourceDir, "dist");
|
|
9819
|
-
if (!(!fs.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
|
|
9824
|
+
if (!(!fs$1.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
|
|
9820
9825
|
this.logger.info(`${packageName} — building (dist/ missing or incomplete)`);
|
|
9821
9826
|
try {
|
|
9822
9827
|
await runNpm(["run", "build"], this.npmRunOptions(sourceDir, 18e4));
|
|
@@ -9831,7 +9836,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9831
9836
|
if (!camstack?.addons) return false;
|
|
9832
9837
|
for (const addon of camstack.addons) {
|
|
9833
9838
|
if (!addon.pages) continue;
|
|
9834
|
-
for (const page of addon.pages) if (page.bundle && !fs.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
|
|
9839
|
+
for (const page of addon.pages) if (page.bundle && !fs$1.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
|
|
9835
9840
|
}
|
|
9836
9841
|
return false;
|
|
9837
9842
|
}
|
|
@@ -9840,7 +9845,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9840
9845
|
function isDirEntry(entry, parentDir) {
|
|
9841
9846
|
if (entry.isDirectory()) return true;
|
|
9842
9847
|
if (entry.isSymbolicLink()) try {
|
|
9843
|
-
return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
9848
|
+
return fs$1.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
9844
9849
|
} catch {
|
|
9845
9850
|
return false;
|
|
9846
9851
|
}
|
|
@@ -9939,7 +9944,7 @@ function selectAddonResidue(candidates) {
|
|
|
9939
9944
|
}
|
|
9940
9945
|
function readDeclaredName(dir) {
|
|
9941
9946
|
try {
|
|
9942
|
-
const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9947
|
+
const parsed = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9943
9948
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
9944
9949
|
const name = parsed.name;
|
|
9945
9950
|
return typeof name === "string" ? name : null;
|
|
@@ -9949,7 +9954,7 @@ function readDeclaredName(dir) {
|
|
|
9949
9954
|
}
|
|
9950
9955
|
function readDeclaredVersion(dir) {
|
|
9951
9956
|
try {
|
|
9952
|
-
const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9957
|
+
const parsed = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9953
9958
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
9954
9959
|
const version = parsed.version;
|
|
9955
9960
|
return typeof version === "string" ? version : null;
|
|
@@ -9959,7 +9964,7 @@ function readDeclaredVersion(dir) {
|
|
|
9959
9964
|
}
|
|
9960
9965
|
function isDirLike(p) {
|
|
9961
9966
|
try {
|
|
9962
|
-
return fs.statSync(p).isDirectory();
|
|
9967
|
+
return fs$1.statSync(p).isDirectory();
|
|
9963
9968
|
} catch {
|
|
9964
9969
|
return false;
|
|
9965
9970
|
}
|
|
@@ -9969,7 +9974,7 @@ function freeQuarantineTarget(store, scope, dirName) {
|
|
|
9969
9974
|
const base = scope === null ? dirName : `${scope.replace("@", "")}__${dirName}`;
|
|
9970
9975
|
let candidate = path$1.join(store, base);
|
|
9971
9976
|
let n = 1;
|
|
9972
|
-
while (fs.existsSync(candidate)) {
|
|
9977
|
+
while (fs$1.existsSync(candidate)) {
|
|
9973
9978
|
candidate = path$1.join(store, `${base}-${n}`);
|
|
9974
9979
|
n += 1;
|
|
9975
9980
|
}
|
|
@@ -9986,7 +9991,7 @@ function freeQuarantineTarget(store, scope, dirName) {
|
|
|
9986
9991
|
function quarantineAddonResidue(addonsDir, log) {
|
|
9987
9992
|
const quarantined = [];
|
|
9988
9993
|
const failed = [];
|
|
9989
|
-
if (!fs.existsSync(addonsDir)) return {
|
|
9994
|
+
if (!fs$1.existsSync(addonsDir)) return {
|
|
9990
9995
|
quarantined,
|
|
9991
9996
|
failed
|
|
9992
9997
|
};
|
|
@@ -9994,7 +9999,7 @@ function quarantineAddonResidue(addonsDir, log) {
|
|
|
9994
9999
|
const scan = (parent, scope) => {
|
|
9995
10000
|
let names;
|
|
9996
10001
|
try {
|
|
9997
|
-
names = fs.readdirSync(parent);
|
|
10002
|
+
names = fs$1.readdirSync(parent);
|
|
9998
10003
|
} catch {
|
|
9999
10004
|
return;
|
|
10000
10005
|
}
|
|
@@ -10013,8 +10018,8 @@ function quarantineAddonResidue(addonsDir, log) {
|
|
|
10013
10018
|
const version = readDeclaredVersion(full);
|
|
10014
10019
|
const to = freeQuarantineTarget(store, scope, dirName);
|
|
10015
10020
|
try {
|
|
10016
|
-
fs.mkdirSync(store, { recursive: true });
|
|
10017
|
-
fs.renameSync(full, to);
|
|
10021
|
+
fs$1.mkdirSync(store, { recursive: true });
|
|
10022
|
+
fs$1.renameSync(full, to);
|
|
10018
10023
|
} catch (err) {
|
|
10019
10024
|
const error = err instanceof Error ? err.message : String(err);
|
|
10020
10025
|
failed.push({
|
|
@@ -10072,11 +10077,11 @@ function getRestartMarkerPath(dataDir) {
|
|
|
10072
10077
|
* intact or no marker at all (never a half-written file).
|
|
10073
10078
|
*/
|
|
10074
10079
|
function writePendingRestart(dataDir, marker) {
|
|
10075
|
-
fs.mkdirSync(dataDir, { recursive: true });
|
|
10080
|
+
fs$1.mkdirSync(dataDir, { recursive: true });
|
|
10076
10081
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
10077
10082
|
const tmpPath = `${markerPath}.tmp`;
|
|
10078
|
-
fs.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
|
|
10079
|
-
fs.renameSync(tmpPath, markerPath);
|
|
10083
|
+
fs$1.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
|
|
10084
|
+
fs$1.renameSync(tmpPath, markerPath);
|
|
10080
10085
|
}
|
|
10081
10086
|
/**
|
|
10082
10087
|
* Read + consume the marker. Returns the parsed payload on success and
|
|
@@ -10101,10 +10106,10 @@ function writePendingRestart(dataDir, marker) {
|
|
|
10101
10106
|
*/
|
|
10102
10107
|
function readPendingRestart(dataDir) {
|
|
10103
10108
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
10104
|
-
if (!fs.existsSync(markerPath)) return null;
|
|
10109
|
+
if (!fs$1.existsSync(markerPath)) return null;
|
|
10105
10110
|
let raw;
|
|
10106
10111
|
try {
|
|
10107
|
-
raw = fs.readFileSync(markerPath, "utf-8");
|
|
10112
|
+
raw = fs$1.readFileSync(markerPath, "utf-8");
|
|
10108
10113
|
} catch (err) {
|
|
10109
10114
|
console.error("[restart-coordinator] Marker unreadable — leaving in place:", err);
|
|
10110
10115
|
return null;
|
|
@@ -10143,7 +10148,7 @@ function readPendingRestart(dataDir) {
|
|
|
10143
10148
|
/** Remove the marker if present. No-op if missing. */
|
|
10144
10149
|
function clearPendingRestart(dataDir) {
|
|
10145
10150
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
10146
|
-
fs.rmSync(markerPath, { force: true });
|
|
10151
|
+
fs$1.rmSync(markerPath, { force: true });
|
|
10147
10152
|
}
|
|
10148
10153
|
function isRestartKind(value) {
|
|
10149
10154
|
return value === "framework-update" || value === "manual" || value === "system";
|
|
@@ -10155,7 +10160,7 @@ function scheduleSelfRestart(options = {}) {
|
|
|
10155
10160
|
const touchTarget = process.env["CAMSTACK_RESTART_TOUCH_FILE"];
|
|
10156
10161
|
if (touchTarget !== void 0 && touchTarget.length > 0) try {
|
|
10157
10162
|
const now = /* @__PURE__ */ new Date();
|
|
10158
|
-
fs.utimesSync(touchTarget, now, now);
|
|
10163
|
+
fs$1.utimesSync(touchTarget, now, now);
|
|
10159
10164
|
return;
|
|
10160
10165
|
} catch (err) {
|
|
10161
10166
|
console.error("[restart-coordinator] dev touch-reload failed; falling through to process exit:", err);
|
|
@@ -14519,11 +14524,11 @@ function applyEnvOverrides(raw) {
|
|
|
14519
14524
|
return result;
|
|
14520
14525
|
}
|
|
14521
14526
|
function loadYaml(configPath) {
|
|
14522
|
-
if (!fs.existsSync(configPath)) {
|
|
14527
|
+
if (!fs$1.existsSync(configPath)) {
|
|
14523
14528
|
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`);
|
|
14524
14529
|
return {};
|
|
14525
14530
|
}
|
|
14526
|
-
const parsed = load(fs.readFileSync(configPath, "utf-8")) ?? {};
|
|
14531
|
+
const parsed = load(fs$1.readFileSync(configPath, "utf-8")) ?? {};
|
|
14527
14532
|
console.log(`[ConfigManager] Loaded config from: ${configPath}`);
|
|
14528
14533
|
return parsed;
|
|
14529
14534
|
}
|
|
@@ -22619,7 +22624,7 @@ async function probeVaapiInit(renderNode) {
|
|
|
22619
22624
|
*/
|
|
22620
22625
|
function safeExistsSync(path) {
|
|
22621
22626
|
try {
|
|
22622
|
-
return fs.existsSync(path);
|
|
22627
|
+
return fs$1.existsSync(path);
|
|
22623
22628
|
} catch {
|
|
22624
22629
|
return false;
|
|
22625
22630
|
}
|
|
@@ -22638,11 +22643,11 @@ function probeLinuxGpus() {
|
|
|
22638
22643
|
if (safeExistsSync("/dev/nvidia0") || safeExistsSync("/proc/driver/nvidia/version")) signals.hasNvidiaGpu = true;
|
|
22639
22644
|
try {
|
|
22640
22645
|
const drmDir = "/sys/class/drm";
|
|
22641
|
-
if (fs.existsSync(drmDir)) for (const entry of fs.readdirSync(drmDir)) {
|
|
22646
|
+
if (fs$1.existsSync(drmDir)) for (const entry of fs$1.readdirSync(drmDir)) {
|
|
22642
22647
|
if (!entry.startsWith("card")) continue;
|
|
22643
22648
|
const vendorPath = `${drmDir}/${entry}/device/vendor`;
|
|
22644
22649
|
if (!safeExistsSync(vendorPath)) continue;
|
|
22645
|
-
const vendor = fs.readFileSync(vendorPath, "utf8").trim().toLowerCase();
|
|
22650
|
+
const vendor = fs$1.readFileSync(vendorPath, "utf8").trim().toLowerCase();
|
|
22646
22651
|
if (vendor === "0x10de") signals.hasNvidiaGpu = true;
|
|
22647
22652
|
else if (vendor === "0x1002") signals.hasAmdGpu = true;
|
|
22648
22653
|
else if (vendor === "0x8086") signals.hasIntelGpu = true;
|
|
@@ -22860,21 +22865,21 @@ function sleep$1(ms) {
|
|
|
22860
22865
|
* crashed holder) is stolen.
|
|
22861
22866
|
*/
|
|
22862
22867
|
async function withFileLock(lockPath, fn) {
|
|
22863
|
-
fs.mkdirSync(join(lockPath, ".."), { recursive: true });
|
|
22868
|
+
fs$1.mkdirSync(join(lockPath, ".."), { recursive: true });
|
|
22864
22869
|
for (;;) try {
|
|
22865
|
-
const fd = fs.openSync(lockPath, "wx");
|
|
22866
|
-
fs.closeSync(fd);
|
|
22870
|
+
const fd = fs$1.openSync(lockPath, "wx");
|
|
22871
|
+
fs$1.closeSync(fd);
|
|
22867
22872
|
break;
|
|
22868
22873
|
} catch {
|
|
22869
22874
|
try {
|
|
22870
|
-
if (Date.now() - fs.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs.rmSync(lockPath, { force: true });
|
|
22875
|
+
if (Date.now() - fs$1.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs$1.rmSync(lockPath, { force: true });
|
|
22871
22876
|
else await sleep$1(LOCK_POLL_MS);
|
|
22872
22877
|
} catch {}
|
|
22873
22878
|
}
|
|
22874
22879
|
try {
|
|
22875
22880
|
return await fn();
|
|
22876
22881
|
} finally {
|
|
22877
|
-
fs.rmSync(lockPath, { force: true });
|
|
22882
|
+
fs$1.rmSync(lockPath, { force: true });
|
|
22878
22883
|
}
|
|
22879
22884
|
}
|
|
22880
22885
|
/** Coalesce in-process + serialize cross-process for one binary id. */
|
|
@@ -22932,7 +22937,7 @@ var AddonDepsManager = class {
|
|
|
22932
22937
|
* failed or tampered download throws, and provisioning reports it.
|
|
22933
22938
|
*/
|
|
22934
22939
|
async stageNativeDepsDeclaredBy(requirementsFile) {
|
|
22935
|
-
if (!declaresEdgetpuDelegate(fs.readFileSync(requirementsFile, "utf8"))) return;
|
|
22940
|
+
if (!declaresEdgetpuDelegate(fs$1.readFileSync(requirementsFile, "utf8"))) return;
|
|
22936
22941
|
await singleFlight(this.depsDir, "edgetpu-delegate", () => ensureEdgetpuDelegate(this.nodeRoot, this.logger));
|
|
22937
22942
|
}
|
|
22938
22943
|
getDepsDir() {
|
|
@@ -23963,7 +23968,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
|
|
|
23963
23968
|
const addonId = declaration.id;
|
|
23964
23969
|
const nodeDataDir = process.env["CAMSTACK_DATA"] ?? dataDir;
|
|
23965
23970
|
const addonDataDir = path$1.resolve(nodeDataDir, "addons-data", addonId);
|
|
23966
|
-
fs.mkdirSync(addonDataDir, { recursive: true });
|
|
23971
|
+
fs$1.mkdirSync(addonDataDir, { recursive: true });
|
|
23967
23972
|
if (runtime.mode === "broker") ensureBindingSubscription(runtime.broker);
|
|
23968
23973
|
const regs = getRegistries(nodeId);
|
|
23969
23974
|
const workerResolver = {
|
|
@@ -25765,7 +25770,7 @@ var FailedRunnerRetryLedger = class {
|
|
|
25765
25770
|
function readRunnerPackageVersions(addonDirs) {
|
|
25766
25771
|
const out = {};
|
|
25767
25772
|
for (const dir of addonDirs) try {
|
|
25768
|
-
const raw = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
25773
|
+
const raw = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
25769
25774
|
const version = typeof raw === "object" && raw !== null ? Reflect.get(raw, "version") : null;
|
|
25770
25775
|
out[dir] = typeof version === "string" && version.length > 0 ? version : null;
|
|
25771
25776
|
} catch {
|
|
@@ -25826,7 +25831,7 @@ function readAddonHeapDeclaration(spec) {
|
|
|
25826
25831
|
if (cached !== void 0) return cached;
|
|
25827
25832
|
let declaration = EMPTY_HEAP_DECLARATION;
|
|
25828
25833
|
for (const manifestPath of [path$1.join(spec.addonDir, "package.json"), path$1.join(path$1.dirname(spec.addonDir), "package.json")]) try {
|
|
25829
|
-
const raw = fs.readFileSync(manifestPath, "utf8");
|
|
25834
|
+
const raw = fs$1.readFileSync(manifestPath, "utf8");
|
|
25830
25835
|
const parsed = JSON.parse(raw);
|
|
25831
25836
|
const profile = extractHeapProfile(parsed, spec.addonId);
|
|
25832
25837
|
const maxOldSpaceMb = extractMaxOldSpaceMb(parsed, spec.addonId);
|
|
@@ -27048,17 +27053,17 @@ var JobJournal = class {
|
|
|
27048
27053
|
return path$1.join(this.jobsDir, `${id}.json`);
|
|
27049
27054
|
}
|
|
27050
27055
|
writeAtomic(filePath, data) {
|
|
27051
|
-
fs.mkdirSync(path$1.dirname(filePath), { recursive: true });
|
|
27056
|
+
fs$1.mkdirSync(path$1.dirname(filePath), { recursive: true });
|
|
27052
27057
|
const tmp = `${filePath}.tmp.${process.pid}.${Date.now()}`;
|
|
27053
|
-
fs.writeFileSync(tmp, JSON.stringify(data, null, 2), {
|
|
27058
|
+
fs$1.writeFileSync(tmp, JSON.stringify(data, null, 2), {
|
|
27054
27059
|
encoding: "utf-8",
|
|
27055
27060
|
mode: 384
|
|
27056
27061
|
});
|
|
27057
|
-
fs.renameSync(tmp, filePath);
|
|
27062
|
+
fs$1.renameSync(tmp, filePath);
|
|
27058
27063
|
}
|
|
27059
27064
|
readIndex() {
|
|
27060
27065
|
try {
|
|
27061
|
-
const raw = JSON.parse(fs.readFileSync(this.indexPath, "utf-8"));
|
|
27066
|
+
const raw = JSON.parse(fs$1.readFileSync(this.indexPath, "utf-8"));
|
|
27062
27067
|
if (raw && Array.isArray(raw.jobIds)) return {
|
|
27063
27068
|
version: 1,
|
|
27064
27069
|
jobIds: raw.jobIds
|
|
@@ -27083,7 +27088,7 @@ var JobJournal = class {
|
|
|
27083
27088
|
}
|
|
27084
27089
|
getJob(id) {
|
|
27085
27090
|
try {
|
|
27086
|
-
const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs.readFileSync(this.jobPath(id), "utf-8")));
|
|
27091
|
+
const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs$1.readFileSync(this.jobPath(id), "utf-8")));
|
|
27087
27092
|
return parsed.success ? parsed.data : null;
|
|
27088
27093
|
} catch {
|
|
27089
27094
|
return null;
|
|
@@ -27148,14 +27153,14 @@ var StagingArea = class {
|
|
|
27148
27153
|
}
|
|
27149
27154
|
async fetchAndStage(input) {
|
|
27150
27155
|
const destDir = path$1.join(this.stagingDir, input.jobId, safeSegment(input.name));
|
|
27151
|
-
fs.rmSync(destDir, {
|
|
27156
|
+
fs$1.rmSync(destDir, {
|
|
27152
27157
|
recursive: true,
|
|
27153
27158
|
force: true
|
|
27154
27159
|
});
|
|
27155
27160
|
const tgz = await this.deps.fetchTarball(input.name, input.version, input.signal);
|
|
27156
27161
|
if (input.signal.aborted) throw new Error("staging aborted after fetch");
|
|
27157
27162
|
await this.deps.extract(tgz, destDir);
|
|
27158
|
-
const raw = JSON.parse(fs.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
|
|
27163
|
+
const raw = JSON.parse(fs$1.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
|
|
27159
27164
|
if (typeof raw.version !== "string" || raw.version.length === 0) throw new Error(`staging validation failed: ${input.name} staged a package.json with no version`);
|
|
27160
27165
|
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}`);
|
|
27161
27166
|
return {
|
|
@@ -27164,7 +27169,7 @@ var StagingArea = class {
|
|
|
27164
27169
|
};
|
|
27165
27170
|
}
|
|
27166
27171
|
cleanup(jobId) {
|
|
27167
|
-
fs.rmSync(path$1.join(this.stagingDir, jobId), {
|
|
27172
|
+
fs$1.rmSync(path$1.join(this.stagingDir, jobId), {
|
|
27168
27173
|
recursive: true,
|
|
27169
27174
|
force: true
|
|
27170
27175
|
});
|
|
@@ -27179,13 +27184,13 @@ var StagingArea = class {
|
|
|
27179
27184
|
sweepOrphans() {
|
|
27180
27185
|
let entries;
|
|
27181
27186
|
try {
|
|
27182
|
-
entries = fs.readdirSync(this.stagingDir);
|
|
27187
|
+
entries = fs$1.readdirSync(this.stagingDir);
|
|
27183
27188
|
} catch {
|
|
27184
27189
|
return 0;
|
|
27185
27190
|
}
|
|
27186
27191
|
let removed = 0;
|
|
27187
27192
|
for (const name of entries) try {
|
|
27188
|
-
fs.rmSync(path$1.join(this.stagingDir, name), {
|
|
27193
|
+
fs$1.rmSync(path$1.join(this.stagingDir, name), {
|
|
27189
27194
|
recursive: true,
|
|
27190
27195
|
force: true
|
|
27191
27196
|
});
|
|
@@ -27363,7 +27368,7 @@ var LifecycleJobEngine = class {
|
|
|
27363
27368
|
* on failure → `failed`.
|
|
27364
27369
|
*/
|
|
27365
27370
|
async reconcileJob(job) {
|
|
27366
|
-
const exists = this.deps.stagedPathExists ?? ((p) => fs.existsSync(p));
|
|
27371
|
+
const exists = this.deps.stagedPathExists ?? ((p) => fs$1.existsSync(p));
|
|
27367
27372
|
for (const task of job.tasks) {
|
|
27368
27373
|
if (task.target === "framework") {
|
|
27369
27374
|
if (!this.isTerminal(task.phase)) this.skipFrameworkTask(job, task);
|
|
@@ -28004,7 +28009,7 @@ var CatalogRegistry = class {
|
|
|
28004
28009
|
const file = path$1.join(packageDir, "i18n", `${lang}.json`);
|
|
28005
28010
|
let text;
|
|
28006
28011
|
try {
|
|
28007
|
-
text = fs.readFileSync(file, "utf8");
|
|
28012
|
+
text = fs$1.readFileSync(file, "utf8");
|
|
28008
28013
|
} catch {
|
|
28009
28014
|
continue;
|
|
28010
28015
|
}
|