@camstack/server 1.2.880 → 1.2.882
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 +12 -0
- package/package.json +8 -7
- package/system/dist/addon-utils.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 +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +3 -3
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -5
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +4 -4
- package/system/dist/builtins/composer/composer.addon.mjs +4 -4
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- 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 +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- 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 +3 -3
- package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
- package/system/dist/builtins/loki-logging/index.js +1 -1
- package/system/dist/builtins/loki-logging/index.mjs +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +10 -10
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
- 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/{capture-engine-CxD6UV_F.js → capture-engine-D1cSfGu_.js} +1 -1
- package/system/dist/{capture-engine-Btw78o_3.mjs → capture-engine-hBdaHSa5.mjs} +1 -1
- package/system/dist/{composition-sources-DcEvVNT0.js → composition-sources-CfKDTis7.js} +1 -1
- package/system/dist/{composition-sources-BeSuy_o2.mjs → composition-sources-Cpu22JMr.mjs} +1 -1
- package/system/dist/{constants-DfXUZ9B1.js → constants-CRKNMR3M.js} +1 -1
- package/system/dist/{constants-CFj_1tVH.mjs → constants-CTYmEHlW.mjs} +1 -1
- package/system/dist/{coral-accelerators-BW3OcrLD.mjs → coral-accelerators-DBlgWB8k.mjs} +6 -6
- package/system/dist/{custom-action-registry-N7flBDwT.mjs → custom-action-registry-B9zFBNVa.mjs} +37 -37
- package/system/dist/{device-ca-CJUo1gng.mjs → device-ca-Dj6nzcoq.mjs} +1 -1
- package/system/dist/{device-ca-DxQ_lJD2.js → device-ca-wlsnsg3M.js} +1 -1
- package/system/dist/{dist-BTJfwhbC.mjs → dist-BbuJa6G4.mjs} +102 -11
- package/system/dist/{dist-lI1nsGZD.js → dist-DFeAUBa8.js} +102 -11
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-identity-_lkdpfBw.mjs → hub-identity-CcEQJ8el.mjs} +10 -10
- package/system/dist/{hub-identity-DAo-4o-I.js → hub-identity-DPKmKOuk.js} +1 -1
- package/system/dist/{hub-mdns-ciao-D71EkR2r.js → hub-mdns-ciao-DP0ReXx8.js} +2 -2
- package/system/dist/{hub-mdns-ciao-rG5KvyjB.mjs → hub-mdns-ciao-p1Hky4He.mjs} +2 -2
- package/system/dist/index.js +8 -8
- package/system/dist/index.mjs +217 -217
- package/system/dist/{legacy-integration-rows-door-BWDa94xe.js → legacy-integration-rows-door-BxlPhgrH.js} +1 -1
- package/system/dist/{legacy-integration-rows-door-BTaWniqP.mjs → legacy-integration-rows-door-DJaNTUpH.mjs} +1 -1
- package/system/dist/{rename-composition-block-DFW6qzZI.js → rename-composition-block-BAiTDZoT.js} +1 -1
- package/system/dist/{rename-composition-block--_zxKuUp.mjs → rename-composition-block-DjyPUZPW.mjs} +1 -1
- package/system/dist/{restore-archive-05pKHcoC.mjs → restore-archive-BLJ9rXBX.mjs} +94 -94
- package/system/dist/{restore-archive-BDsgP18H.js → restore-archive-n-OmTBbN.js} +1 -1
- package/system/dist/{wal-maintenance-D7t11nIk.js → wal-maintenance-CrMVN_qH.js} +0 -0
- package/system/dist/{wal-maintenance-B0JAeEix.mjs → wal-maintenance-DKNovLM_.mjs} +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 { A as CatalogFileSchema, Ac as asJsonObject$1, Al as scopeKey, Ar as describeUnmet, At as LOG_LEVEL_RANK, C as CATALOG_LANGS, Ci as isArrayOutputSchema, Cl as parseJsonUnknown, Dl as resolveCapMount, Dn as addonSettingsCapability, Ht as PackageRequiresSchema, Jc as defineRecordKinds, Jl as EventCategory$1, Js as CALLER_STAMPED_CAPABILITIES$1, Ki as logLevelAtMost, Kl as errMsg$1, Ln as bareAddonId, Lo as supportedRuntimes, Mc as asString$1, Ni as isVoidInput, Oo as splitTranslationRef, Pi as kebabToCamel$1, Qc as expandCapMethods, Rl as userError, Sl as parseJsonObject, Ti as isCollectionArrayMethod, Tl as readinessKey, Uc as createEvent$1, Vl as withoutCallerStamp, Xr as extractNestedAddonId, Xs as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Yc as emitDownForOwnedCaps, Yo as unmetRequirements, Ys as DATAPLANE_SECRET_HEADER$1, Zs as DEVICE_STATUS_METHOD, a as AGENT_MDNS_SERVICE_TYPE, al as isDebugChannelName, da as objectInputDeclaresAddonId, el as getDebugInterest, fa as objectInputDeclaresRequiredDeviceId, hc as ReadinessTimeoutError, ho as scopesAllowDeviceCap, jc as asNumber, ji as isObjectInput, jt as METHOD_ACCESS_MAP, ka as procedureAuthKey, mc as ReadinessRegistry, mo as scopesAllowAddon, no as resolveMethodAuth, o as AGENT_MDNS_TXT_KEYS, or as compareVersions, pc as RUNTIME_DEFAULTS, qi as looseSchema, s as ALL_CAPABILITY_DEFINITIONS, vi as interpolate, yi as isAddonInstanceId, zc as collectSecretMarkerRefs, zi as lifecycleJobSchema } from "./dist-
|
|
3
|
-
import { d as JWT_SIGNING_KEY_REF, f as JwtSigningKeyUnavailableError, g as processJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, p as SYSTEM_SECRET_OWNER, s as loadDeviceCa, u as verifyDeviceSignature, v as staticJwtSigningKey } from "./device-ca-
|
|
2
|
+
import { A as CatalogFileSchema, Ac as asJsonObject$1, Al as scopeKey, Ar as describeUnmet, At as LOG_LEVEL_RANK, C as CATALOG_LANGS, Ci as isArrayOutputSchema, Cl as parseJsonUnknown, Dl as resolveCapMount, Dn as addonSettingsCapability, Ht as PackageRequiresSchema, Jc as defineRecordKinds, Jl as EventCategory$1, Js as CALLER_STAMPED_CAPABILITIES$1, Ki as logLevelAtMost, Kl as errMsg$1, Ln as bareAddonId, Lo as supportedRuntimes, Mc as asString$1, Ni as isVoidInput, Oo as splitTranslationRef, Pi as kebabToCamel$1, Qc as expandCapMethods, Rl as userError, Sl as parseJsonObject, Ti as isCollectionArrayMethod, Tl as readinessKey, Uc as createEvent$1, Vl as withoutCallerStamp, Xr as extractNestedAddonId, Xs as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Yc as emitDownForOwnedCaps, Yo as unmetRequirements, Ys as DATAPLANE_SECRET_HEADER$1, Zs as DEVICE_STATUS_METHOD, a as AGENT_MDNS_SERVICE_TYPE, al as isDebugChannelName, da as objectInputDeclaresAddonId, el as getDebugInterest, fa as objectInputDeclaresRequiredDeviceId, hc as ReadinessTimeoutError, ho as scopesAllowDeviceCap, jc as asNumber, ji as isObjectInput, jt as METHOD_ACCESS_MAP, ka as procedureAuthKey, mc as ReadinessRegistry, mo as scopesAllowAddon, no as resolveMethodAuth, o as AGENT_MDNS_TXT_KEYS, or as compareVersions, pc as RUNTIME_DEFAULTS, qi as looseSchema, s as ALL_CAPABILITY_DEFINITIONS, vi as interpolate, yi as isAddonInstanceId, zc as collectSecretMarkerRefs, zi as lifecycleJobSchema } from "./dist-BbuJa6G4.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-Dj6nzcoq.mjs";
|
|
4
4
|
import { t as require_read_all_rows } from "./read-all-rows-TaPqdWNF.mjs";
|
|
5
5
|
import { a as redactLogText, i as redactLogMeta, r as redactLogEntry, t as isCredentialKeyName } from "./log-redactor-XLDrPzOi.mjs";
|
|
6
6
|
import { AlertCenterAddon, n as lastCauseAfterChunk, r as readRunnerDisplayName, t as CRASH_BREAKER_ERROR_PREFIX } from "./builtins/alerts/alerts.addon.mjs";
|
|
@@ -27,29 +27,29 @@ import { LokiDestination, LokiLoggingAddon } from "./builtins/loki-logging/index
|
|
|
27
27
|
import NativeMetricsAddon, { a as NativeMetricsProvider, i as parseProcStatusRss, n as nodeProcReader, r as parseProcStat } from "./builtins/native-metrics/native-metrics.addon.mjs";
|
|
28
28
|
import { DeviceHistoryAddon } from "./builtins/device-history/device-history.addon.mjs";
|
|
29
29
|
import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./builtins/sqlite-storage/filesystem-storage.addon.mjs";
|
|
30
|
-
import { D as RecordsEngine, l as SqliteSettingsBackend } from "./wal-maintenance-
|
|
31
|
-
import { n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows } from "./legacy-integration-rows-door-
|
|
30
|
+
import { D as RecordsEngine, l as SqliteSettingsBackend } from "./wal-maintenance-DKNovLM_.mjs";
|
|
31
|
+
import { n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows } from "./legacy-integration-rows-door-DJaNTUpH.mjs";
|
|
32
32
|
import { SqliteSettingsAddon } from "./builtins/sqlite-storage/sqlite-settings.addon.mjs";
|
|
33
33
|
import { ConfigStore, DeviceStore } from "./builtins/sqlite-storage/index.mjs";
|
|
34
34
|
import { StorageOrchestratorAddon, a as createHubCapForwardService, i as HUB_CAP_FWD_SERVICE, o as stripForwardedCaller, r as HUB_CAP_FWD_ACTION, s as buildStorageLocationRegistry, t as StorageOrchestratorService, u as storageOrchestratorRecordKinds } from "./builtins/storage-orchestrator/storage-orchestrator.addon.mjs";
|
|
35
35
|
import "./builtins/storage-orchestrator/index.mjs";
|
|
36
|
-
import { A as evaluateExistingCert, B as AGENT_HTTPS_NAMES_COLLECTION, C as localCaCommonName, D as LEAF_RENEWAL_WINDOW_DAYS, E as CA_VALIDITY_DAYS, F as isConstrainedCa, H as AgentHttpsNames, I as isLocalOnlyHostname, L as permitsIdentity, M as PERMITTED_DNS_SUFFIXES, N as PERMITTED_IP_RANGES, O as MAX_LEAF_VALIDITY_DAYS, P as buildNameConstraintSet, R as permitsName, T as systemHostFacts, U as getProcessAgentHttpsNames, V as AGENT_HTTPS_NAMES_COLUMNS, W as setProcessAgentHttpsNames, _ as pemDigest, a as AgentHttpsInstallError, c as certificateNames, d as describeHttpsLeaf, f as installAgentHttps, g as loadAgentHttps, h as issueAgentHttpsLeaf, i as loadOrCreateHubId, k as SERVER_AUTH_OID, l as collectAgentNames, m as isPrivateAddress, n as HUB_IDENTITY_RELATIVE, o as acceptAgentSans, p as isContainerBridgeAddress, r as isAnnouncedHubId, s as agentHttpsPaths, t as HUB_IDENTITY_FILE, u as createAgentHttpsRequest, v as pinnedHttpsCaFingerprint, w as collectCertIdentity, y as CA_COMMON_NAME, z as readNameConstraints } from "./hub-identity-
|
|
37
|
-
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-
|
|
36
|
+
import { A as evaluateExistingCert, B as AGENT_HTTPS_NAMES_COLLECTION, C as localCaCommonName, D as LEAF_RENEWAL_WINDOW_DAYS, E as CA_VALIDITY_DAYS, F as isConstrainedCa, H as AgentHttpsNames, I as isLocalOnlyHostname, L as permitsIdentity, M as PERMITTED_DNS_SUFFIXES, N as PERMITTED_IP_RANGES, O as MAX_LEAF_VALIDITY_DAYS, P as buildNameConstraintSet, R as permitsName, T as systemHostFacts, U as getProcessAgentHttpsNames, V as AGENT_HTTPS_NAMES_COLUMNS, W as setProcessAgentHttpsNames, _ as pemDigest, a as AgentHttpsInstallError, c as certificateNames, d as describeHttpsLeaf, f as installAgentHttps, g as loadAgentHttps, h as issueAgentHttpsLeaf, i as loadOrCreateHubId, k as SERVER_AUTH_OID, l as collectAgentNames, m as isPrivateAddress, n as HUB_IDENTITY_RELATIVE, o as acceptAgentSans, p as isContainerBridgeAddress, r as isAnnouncedHubId, s as agentHttpsPaths, t as HUB_IDENTITY_FILE, u as createAgentHttpsRequest, v as pinnedHttpsCaFingerprint, w as collectCertIdentity, y as CA_COMMON_NAME, z as readNameConstraints } from "./hub-identity-CcEQJ8el.mjs";
|
|
37
|
+
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-CTYmEHlW.mjs";
|
|
38
38
|
import { $ as getProcessMeshCaState, A as emitProcessNodeRegistered, At as readCidrSetting, B as getProcessMeshTlsListenerState, C as verifyMembershipAnswer, Ct as isInsecureOrigin, D as ServiceBroker, Dt as createCidrMatcher, E as Errors, Et as readOriginSetting, F as onProcessNodeRegistered, G as MeshCertificateRegistry, H as setProcessMeshTlsListenerState, I as setProcessMeshHandshakeReporter, J as getProcessMeshCertificateRegistry, K as RENEWAL_ABANDONED, L as setProcessMeshPeerTransportLookup, M as getProcessNodeMeshTransport, N as getProcessPeerLeaf, O as setProcessMeshTlsEnabler, Ot as normalizeIp, P as isProcessVerifiedMeshPeer, Q as MeshCaKeeper, R as renewMeshCertificate, S as signMembershipProof, St as OPAQUE_ORIGIN, SystemConfigAddon, T as TlsTcpTransporter, Tt as parseOriginList, U as MESH_NODE_CERTIFICATES_COLLECTION, V as openMeshTlsWhenRevocationsLoaded, W as MESH_NODE_CERTIFICATES_COLUMNS, X as MeshCrl, Y as setProcessMeshCertificateRegistry, Z as processMeshCrl, _ as keyFingerprintShort, _t as isAllowedAgentDashboardReturnTo, a as dialableHubHost, at as generateMeshCa, b as MEMBERSHIP_PATHS, bt as verifyAgentUiUnlockTicket, c as PAIRING_MAX_CODE_ATTEMPTS, ct as issueMeshLeafForNode, d as PAIRING_PIN_DIGITS, dt as AGENT_DASHBOARD_ORIGINS_FIELD, et as requireProcessMeshCa, f as PAIRING_PROTOCOL, ft as AGENT_UI_UNLOCK_TTL_MS, g as describeCsr, gt as UnlockTicketJtiStore, h as computePairingSas, ht as AGENT_UI_UNLOCK_VERSION, i as AgentPairing, it as exportMeshPrivateKeyPem, j as getProcessMeshHandshakeReporter, k as dropProcessPeer, kt as parseCidrList, l as PAIRING_MAX_SESSIONS, lt as issueMeshLeafFromCsr, m as computePairingCommitment, mt as AGENT_UI_UNLOCK_USE, n as HubPairing, nt as caFingerprintCompact, o as hubHostFromMeshAddress, ot as generateMeshKeyPair, p as PAIRING_TTL_MS, pt as AGENT_UI_UNLOCK_TYP, q as describeMeshLeaf, r as PairingHttpError, rt as createMeshCsrPem, s as PAIRING_CODE_DIGITS, st as isValidAgentNodeId, tt as caFingerprint, u as PAIRING_PATHS, ut as loadMeshCa, v as signPairingProof, vt as mintAgentUiUnlockTicket, w as MESH_TLS_PORT_HELLO_FIELD, wt as normalizeOrigin, x as MembershipResponder, xt as InvalidCorsOriginError, y as verifyPairingProof, yt as parseAgentDashboardOrigins, z as revokeMeshCertificate } from "./builtins/system-config/system-config.addon.mjs";
|
|
39
39
|
import "./builtins/system-config/index.mjs";
|
|
40
40
|
import { WinstonDestination, WinstonLoggingAddon } from "./builtins/winston-logging/index.mjs";
|
|
41
|
-
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-
|
|
42
|
-
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-
|
|
41
|
+
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-B9zFBNVa.mjs";
|
|
42
|
+
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-p1Hky4He.mjs";
|
|
43
43
|
import { n as getPlatformKeychainKey, r as setPlatformKeychainKey, t as clearPlatformKeychainKey } from "./platform-key-source-BWlq0jjn.mjs";
|
|
44
44
|
import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-Di9daRwI.mjs";
|
|
45
|
-
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-
|
|
46
|
-
import { r as nodeCoralFs, t as classifyCoralAccelerator } from "./coral-accelerators-
|
|
45
|
+
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-BLJ9rXBX.mjs";
|
|
46
|
+
import { r as nodeCoralFs, t as classifyCoralAccelerator } from "./coral-accelerators-DBlgWB8k.mjs";
|
|
47
47
|
import { z } from "zod";
|
|
48
48
|
import * as crypto$1 from "node:crypto";
|
|
49
49
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
50
50
|
import { PYTHON_VERSION, buildBinaryPath, declaresEdgetpuDelegate, downloadBinary, ensureBinary, ensureBinary as ensureBinary$1, ensureEdgetpuDelegate, ensureFfmpeg, ensureFfmpeg as ensureFfmpeg$1, ensurePython, ensurePython as ensurePython$1, findInPath, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, implementedMethodsOf, installPythonPackages, installPythonPackages as installPythonPackages$1, installPythonRequirements, installPythonRequirements as installPythonRequirements$1 } from "@camstack/types/node";
|
|
51
51
|
import { connect, createConnection, createServer } from "node:net";
|
|
52
|
-
import * as fs from "node:fs";
|
|
52
|
+
import * as fs$1 from "node:fs";
|
|
53
53
|
import { accessSync, constants, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync } from "node:fs";
|
|
54
54
|
import * as path$1 from "node:path";
|
|
55
55
|
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
@@ -5066,7 +5066,7 @@ var PythonEnvManager = class {
|
|
|
5066
5066
|
async ensure(options) {
|
|
5067
5067
|
const probe = await this.probe();
|
|
5068
5068
|
if (!probe.available || !probe.path) throw userError("system.python-required", void 0, "Python 3.10+ is required but not found on this system");
|
|
5069
|
-
if (!fs.existsSync(path$1.join(this.venvPath, "bin", "python"))) await execFileAsync$7(probe.path, [
|
|
5069
|
+
if (!fs$1.existsSync(path$1.join(this.venvPath, "bin", "python"))) await execFileAsync$7(probe.path, [
|
|
5070
5070
|
"-m",
|
|
5071
5071
|
"venv",
|
|
5072
5072
|
this.venvPath
|
|
@@ -5089,7 +5089,7 @@ var PythonEnvManager = class {
|
|
|
5089
5089
|
}
|
|
5090
5090
|
spawn(script, args) {
|
|
5091
5091
|
const venvPython = path$1.join(this.venvPath, "bin", "python");
|
|
5092
|
-
if (!fs.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
|
|
5092
|
+
if (!fs$1.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
|
|
5093
5093
|
return spawn(venvPython, [script, ...args]);
|
|
5094
5094
|
}
|
|
5095
5095
|
};
|
|
@@ -5441,20 +5441,20 @@ var StorageManager = class {
|
|
|
5441
5441
|
const basePath = this.locationManager.getBackend(mappedName).basePath;
|
|
5442
5442
|
location.files = {
|
|
5443
5443
|
async readFile(p) {
|
|
5444
|
-
return fs.promises.readFile(path$1.join(basePath, p));
|
|
5444
|
+
return fs$1.promises.readFile(path$1.join(basePath, p));
|
|
5445
5445
|
},
|
|
5446
5446
|
async writeFile(p, data) {
|
|
5447
5447
|
const full = path$1.join(basePath, p);
|
|
5448
|
-
await fs.promises.mkdir(path$1.dirname(full), { recursive: true });
|
|
5449
|
-
await fs.promises.writeFile(full, data);
|
|
5448
|
+
await fs$1.promises.mkdir(path$1.dirname(full), { recursive: true });
|
|
5449
|
+
await fs$1.promises.writeFile(full, data);
|
|
5450
5450
|
},
|
|
5451
5451
|
async deleteFile(p) {
|
|
5452
|
-
await fs.promises.rm(path$1.join(basePath, p), { force: true });
|
|
5452
|
+
await fs$1.promises.rm(path$1.join(basePath, p), { force: true });
|
|
5453
5453
|
},
|
|
5454
5454
|
async listFiles(prefix) {
|
|
5455
5455
|
const dir = prefix ? path$1.join(basePath, prefix) : basePath;
|
|
5456
5456
|
try {
|
|
5457
|
-
return (await fs.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
|
|
5457
|
+
return (await fs$1.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
|
|
5458
5458
|
} catch {
|
|
5459
5459
|
return [];
|
|
5460
5460
|
}
|
|
@@ -5464,7 +5464,7 @@ var StorageManager = class {
|
|
|
5464
5464
|
},
|
|
5465
5465
|
async exists(p) {
|
|
5466
5466
|
try {
|
|
5467
|
-
await fs.promises.access(path$1.join(basePath, p));
|
|
5467
|
+
await fs$1.promises.access(path$1.join(basePath, p));
|
|
5468
5468
|
return true;
|
|
5469
5469
|
} catch {
|
|
5470
5470
|
return false;
|
|
@@ -5914,7 +5914,7 @@ var TRADITIONAL_NATIVE_PACKAGES = ["better-sqlite3"];
|
|
|
5914
5914
|
function hasDotNode(dir, maxDepth) {
|
|
5915
5915
|
let entries;
|
|
5916
5916
|
try {
|
|
5917
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
5917
|
+
entries = fs$1.readdirSync(dir, { withFileTypes: true });
|
|
5918
5918
|
} catch {
|
|
5919
5919
|
return false;
|
|
5920
5920
|
}
|
|
@@ -5925,7 +5925,7 @@ function hasDotNode(dir, maxDepth) {
|
|
|
5925
5925
|
}
|
|
5926
5926
|
/** Locate the bundled `prebuild-install` bin.js inside the staged closure. */
|
|
5927
5927
|
function resolvePrebuildInstallBin(closureDir, moduleDir) {
|
|
5928
|
-
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;
|
|
5928
|
+
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;
|
|
5929
5929
|
}
|
|
5930
5930
|
/**
|
|
5931
5931
|
* Default fetcher: run the closure's own `prebuild-install` under the CURRENT
|
|
@@ -5978,7 +5978,7 @@ async function ensureNativePrebuilds(closureDir, options) {
|
|
|
5978
5978
|
const fetched = [];
|
|
5979
5979
|
for (const pkg of packages) {
|
|
5980
5980
|
const moduleDir = path$1.join(nm, pkg);
|
|
5981
|
-
if (!fs.existsSync(moduleDir)) continue;
|
|
5981
|
+
if (!fs$1.existsSync(moduleDir)) continue;
|
|
5982
5982
|
if (hasDotNode(moduleDir, 4)) continue;
|
|
5983
5983
|
options.logger.warn("staged closure native prebuild missing — fetching for running ABI", { meta: {
|
|
5984
5984
|
pkg,
|
|
@@ -6041,12 +6041,12 @@ async function ensureNativePrebuilds(closureDir, options) {
|
|
|
6041
6041
|
function replantFromBundled(srcModuleDir, dstModuleDir, hasNative) {
|
|
6042
6042
|
if (!hasNative(srcModuleDir)) return false;
|
|
6043
6043
|
try {
|
|
6044
|
-
fs.rmSync(dstModuleDir, {
|
|
6044
|
+
fs$1.rmSync(dstModuleDir, {
|
|
6045
6045
|
recursive: true,
|
|
6046
6046
|
force: true
|
|
6047
6047
|
});
|
|
6048
|
-
fs.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
|
|
6049
|
-
fs.cpSync(srcModuleDir, dstModuleDir, {
|
|
6048
|
+
fs$1.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
|
|
6049
|
+
fs$1.cpSync(srcModuleDir, dstModuleDir, {
|
|
6050
6050
|
recursive: true,
|
|
6051
6051
|
dereference: true
|
|
6052
6052
|
});
|
|
@@ -6075,7 +6075,7 @@ async function ensureAddonNativePrebuilds(addonDir, options) {
|
|
|
6075
6075
|
const missing = [];
|
|
6076
6076
|
for (const pkg of packages) {
|
|
6077
6077
|
const moduleDir = path$1.join(nm, pkg);
|
|
6078
|
-
if (!fs.existsSync(moduleDir)) continue;
|
|
6078
|
+
if (!fs$1.existsSync(moduleDir)) continue;
|
|
6079
6079
|
if (hasNative(moduleDir)) {
|
|
6080
6080
|
results.push({
|
|
6081
6081
|
pkg,
|
|
@@ -6174,7 +6174,7 @@ async function defaultDownloadTarball(url, destTgz) {
|
|
|
6174
6174
|
const res = await fetch(url);
|
|
6175
6175
|
if (!res.ok || !res.body) throw new Error(`HTTP ${res.status} downloading ${url}`);
|
|
6176
6176
|
const bytes = Buffer.from(await res.arrayBuffer());
|
|
6177
|
-
await fs.promises.writeFile(destTgz, bytes);
|
|
6177
|
+
await fs$1.promises.writeFile(destTgz, bytes);
|
|
6178
6178
|
}
|
|
6179
6179
|
async function defaultExtractTarball(tgzPath, destDir) {
|
|
6180
6180
|
await execFileAsync$5("tar", [
|
|
@@ -6260,7 +6260,7 @@ async function resolveUncached(options) {
|
|
|
6260
6260
|
argsPrefix: []
|
|
6261
6261
|
};
|
|
6262
6262
|
const cliPath = bootstrappedCliPath(options.cacheDir);
|
|
6263
|
-
if (fs.existsSync(cliPath)) {
|
|
6263
|
+
if (fs$1.existsSync(cliPath)) {
|
|
6264
6264
|
options.logger.info("system npm unavailable — using bootstrapped npm", { meta: { cliPath } });
|
|
6265
6265
|
return {
|
|
6266
6266
|
command: process.execPath,
|
|
@@ -6272,12 +6272,12 @@ async function resolveUncached(options) {
|
|
|
6272
6272
|
const registry = (options.registry ?? DEFAULT_REGISTRY$1).replace(/\/+$/, "");
|
|
6273
6273
|
const tarballUrl = tarballUrlOf(await (options.fetchJson ?? defaultFetchJson)(`${registry}/npm/latest`));
|
|
6274
6274
|
if (!tarballUrl) throw new Error(`registry metadata for 'npm' carries no dist.tarball (${registry})`);
|
|
6275
|
-
await fs.promises.mkdir(options.cacheDir, { recursive: true });
|
|
6275
|
+
await fs$1.promises.mkdir(options.cacheDir, { recursive: true });
|
|
6276
6276
|
const tgzPath = path$1.join(options.cacheDir, "npm-bootstrap.tgz");
|
|
6277
6277
|
await (options.downloadTarball ?? defaultDownloadTarball)(tarballUrl, tgzPath);
|
|
6278
6278
|
await (options.extractTarball ?? defaultExtractTarball)(tgzPath, options.cacheDir);
|
|
6279
|
-
await fs.promises.rm(tgzPath, { force: true });
|
|
6280
|
-
if (!fs.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
|
|
6279
|
+
await fs$1.promises.rm(tgzPath, { force: true });
|
|
6280
|
+
if (!fs$1.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
|
|
6281
6281
|
options.logger.info("npm bootstrapped", { meta: { cliPath } });
|
|
6282
6282
|
return {
|
|
6283
6283
|
command: process.execPath,
|
|
@@ -6343,7 +6343,7 @@ function readOwningPackageVersion(entryPath) {
|
|
|
6343
6343
|
let dir = path$1.dirname(entryPath);
|
|
6344
6344
|
for (let hop = 0; hop < PACKAGE_JSON_LOOKUP_DEPTH; hop++) {
|
|
6345
6345
|
try {
|
|
6346
|
-
const version = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
|
|
6346
|
+
const version = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
|
|
6347
6347
|
if (typeof version === "string" && version.length > 0) return version;
|
|
6348
6348
|
} catch {}
|
|
6349
6349
|
const parent = path$1.dirname(dir);
|
|
@@ -6387,14 +6387,14 @@ function readOwningPackageVersion(entryPath) {
|
|
|
6387
6387
|
function addonModuleCacheKey(entryPath) {
|
|
6388
6388
|
let stat;
|
|
6389
6389
|
try {
|
|
6390
|
-
stat = fs.statSync(entryPath);
|
|
6390
|
+
stat = fs$1.statSync(entryPath);
|
|
6391
6391
|
} catch {
|
|
6392
6392
|
return null;
|
|
6393
6393
|
}
|
|
6394
6394
|
const version = readOwningPackageVersion(entryPath) ?? `m${stat.mtimeMs}`;
|
|
6395
6395
|
let content;
|
|
6396
6396
|
try {
|
|
6397
|
-
content = createHash("sha1").update(fs.readFileSync(entryPath)).digest("hex").slice(0, 16);
|
|
6397
|
+
content = createHash("sha1").update(fs$1.readFileSync(entryPath)).digest("hex").slice(0, 16);
|
|
6398
6398
|
} catch {
|
|
6399
6399
|
content = `m${stat.mtimeMs}s${stat.size}`;
|
|
6400
6400
|
}
|
|
@@ -6498,14 +6498,14 @@ var AddonLoader = class {
|
|
|
6498
6498
|
* BUILTINS from the active closure, not the (now-inert) addons-dir copy, so
|
|
6499
6499
|
* the addons-dir `@camstack/server/system` must NOT be double-loaded here. */
|
|
6500
6500
|
async loadFromDirectory(addonsDir, skipPackages = []) {
|
|
6501
|
-
if (!fs.existsSync(addonsDir)) return;
|
|
6501
|
+
if (!fs$1.existsSync(addonsDir)) return;
|
|
6502
6502
|
const skip = new Set(skipPackages);
|
|
6503
|
-
const entries = fs.readdirSync(addonsDir, { withFileTypes: true });
|
|
6503
|
+
const entries = fs$1.readdirSync(addonsDir, { withFileTypes: true });
|
|
6504
6504
|
for (const entry of entries) {
|
|
6505
6505
|
if (!isDirectoryEntry(entry, addonsDir)) continue;
|
|
6506
6506
|
if (entry.name.startsWith("@")) {
|
|
6507
6507
|
const scopeDir = path$1.join(addonsDir, entry.name);
|
|
6508
|
-
const scopeEntries = fs.readdirSync(scopeDir, { withFileTypes: true });
|
|
6508
|
+
const scopeEntries = fs$1.readdirSync(scopeDir, { withFileTypes: true });
|
|
6509
6509
|
for (const scopeEntry of scopeEntries) {
|
|
6510
6510
|
if (!isDirectoryEntry(scopeEntry, scopeDir)) continue;
|
|
6511
6511
|
if (skip.has(`${entry.name}/${scopeEntry.name}`)) continue;
|
|
@@ -6519,7 +6519,7 @@ var AddonLoader = class {
|
|
|
6519
6519
|
}
|
|
6520
6520
|
async tryLoadAddon(addonDir) {
|
|
6521
6521
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
6522
|
-
if (!fs.existsSync(pkgJsonPath)) return;
|
|
6522
|
+
if (!fs$1.existsSync(pkgJsonPath)) return;
|
|
6523
6523
|
try {
|
|
6524
6524
|
await this.loadFromAddonDir(addonDir);
|
|
6525
6525
|
} catch (err) {
|
|
@@ -6537,7 +6537,7 @@ var AddonLoader = class {
|
|
|
6537
6537
|
/** Load addon from a specific directory (package.json + dist/) */
|
|
6538
6538
|
async loadFromAddonDir(addonDir) {
|
|
6539
6539
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
6540
|
-
const pkgJson = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
6540
|
+
const pkgJson = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
6541
6541
|
const packageNameRaw = pkgJson["name"];
|
|
6542
6542
|
const packageName = typeof packageNameRaw === "string" ? packageNameRaw : "";
|
|
6543
6543
|
const packageVersionRaw = pkgJson["version"];
|
|
@@ -6585,7 +6585,7 @@ var AddonLoader = class {
|
|
|
6585
6585
|
}
|
|
6586
6586
|
const entryFile = declaration.entry.replace(/^\.\//, "").replace(/^src\//, "dist/").replace(/\.ts$/, ".js");
|
|
6587
6587
|
let entryPath = path$1.resolve(addonDir, entryFile);
|
|
6588
|
-
if (!fs.existsSync(entryPath)) {
|
|
6588
|
+
if (!fs$1.existsSync(entryPath)) {
|
|
6589
6589
|
const base = entryPath.replace(/\.(js|cjs|mjs)$/, "");
|
|
6590
6590
|
entryPath = [
|
|
6591
6591
|
`${base}.cjs`,
|
|
@@ -6594,9 +6594,9 @@ var AddonLoader = class {
|
|
|
6594
6594
|
path$1.resolve(addonDir, "dist", "index.cjs"),
|
|
6595
6595
|
path$1.resolve(addonDir, "dist", "index.mjs"),
|
|
6596
6596
|
path$1.resolve(addonDir, declaration.entry)
|
|
6597
|
-
].find((p) => fs.existsSync(p)) ?? entryPath;
|
|
6597
|
+
].find((p) => fs$1.existsSync(p)) ?? entryPath;
|
|
6598
6598
|
}
|
|
6599
|
-
if (!fs.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
|
|
6599
|
+
if (!fs$1.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
|
|
6600
6600
|
const modUnknown = await importAddonModuleFresh(entryPath);
|
|
6601
6601
|
const mod = isRecord$4(modUnknown) ? modUnknown : {};
|
|
6602
6602
|
const AddonClass = resolveAddonClass(mod);
|
|
@@ -6708,7 +6708,7 @@ function isDirectoryEntry(entry, parentDir) {
|
|
|
6708
6708
|
if (entry.name.startsWith(".")) return false;
|
|
6709
6709
|
if (entry.isDirectory()) return true;
|
|
6710
6710
|
if (entry.isSymbolicLink()) try {
|
|
6711
|
-
return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
6711
|
+
return fs$1.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
6712
6712
|
} catch {
|
|
6713
6713
|
return false;
|
|
6714
6714
|
}
|
|
@@ -6802,7 +6802,7 @@ var execFileAsync$4 = promisify(execFile);
|
|
|
6802
6802
|
* Single source of truth — replaces scattered mkdirSync calls.
|
|
6803
6803
|
*/
|
|
6804
6804
|
function ensureDir(dirPath) {
|
|
6805
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
|
6805
|
+
fs$1.mkdirSync(dirPath, { recursive: true });
|
|
6806
6806
|
}
|
|
6807
6807
|
/**
|
|
6808
6808
|
* Copy a directory recursively — ASYNC so it never blocks the event loop.
|
|
@@ -6815,7 +6815,7 @@ function ensureDir(dirPath) {
|
|
|
6815
6815
|
* `fs.promises.cp` keeps the I/O off the event loop. (Node ≥18 stable.)
|
|
6816
6816
|
*/
|
|
6817
6817
|
async function copyDirRecursive(src, dest) {
|
|
6818
|
-
await fs.promises.cp(src, dest, {
|
|
6818
|
+
await fs$1.promises.cp(src, dest, {
|
|
6819
6819
|
recursive: true,
|
|
6820
6820
|
force: true
|
|
6821
6821
|
});
|
|
@@ -6920,13 +6920,13 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
6920
6920
|
if (typeof fileEntry !== "string") continue;
|
|
6921
6921
|
if (fileEntry === "dist" || fileEntry.includes("*")) continue;
|
|
6922
6922
|
const srcPath = path$1.join(sourceDir, fileEntry);
|
|
6923
|
-
if (!fs.existsSync(srcPath)) continue;
|
|
6923
|
+
if (!fs$1.existsSync(srcPath)) continue;
|
|
6924
6924
|
const destPath = path$1.join(destDir, fileEntry);
|
|
6925
|
-
const stat = await fs.promises.stat(srcPath);
|
|
6925
|
+
const stat = await fs$1.promises.stat(srcPath);
|
|
6926
6926
|
if (stat.isDirectory()) await copyDirRecursive(srcPath, destPath);
|
|
6927
6927
|
else if (stat.isFile()) {
|
|
6928
6928
|
ensureDir(path$1.dirname(destPath));
|
|
6929
|
-
await fs.promises.copyFile(srcPath, destPath);
|
|
6929
|
+
await fs$1.promises.copyFile(srcPath, destPath);
|
|
6930
6930
|
}
|
|
6931
6931
|
}
|
|
6932
6932
|
}
|
|
@@ -6937,10 +6937,10 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
6937
6937
|
function isSourceNewer(packageDir) {
|
|
6938
6938
|
const srcDir = path$1.join(packageDir, "src");
|
|
6939
6939
|
const distDir = path$1.join(packageDir, "dist");
|
|
6940
|
-
if (!fs.existsSync(srcDir) || !fs.existsSync(distDir)) return true;
|
|
6940
|
+
if (!fs$1.existsSync(srcDir) || !fs$1.existsSync(distDir)) return true;
|
|
6941
6941
|
try {
|
|
6942
|
-
const distMtime = fs.statSync(distDir).mtimeMs;
|
|
6943
|
-
const entries = fs.readdirSync(srcDir, {
|
|
6942
|
+
const distMtime = fs$1.statSync(distDir).mtimeMs;
|
|
6943
|
+
const entries = fs$1.readdirSync(srcDir, {
|
|
6944
6944
|
withFileTypes: true,
|
|
6945
6945
|
recursive: true
|
|
6946
6946
|
});
|
|
@@ -6948,7 +6948,7 @@ function isSourceNewer(packageDir) {
|
|
|
6948
6948
|
if (!entry.isFile()) continue;
|
|
6949
6949
|
const parentDir = entry.parentPath ?? String(Reflect.get(entry, "path") ?? "");
|
|
6950
6950
|
const filePath = path$1.join(parentDir, entry.name);
|
|
6951
|
-
if (fs.statSync(filePath).mtimeMs > distMtime) return true;
|
|
6951
|
+
if (fs$1.statSync(filePath).mtimeMs > distMtime) return true;
|
|
6952
6952
|
}
|
|
6953
6953
|
return false;
|
|
6954
6954
|
} catch {
|
|
@@ -6965,7 +6965,7 @@ function isSourceNewer(packageDir) {
|
|
|
6965
6965
|
* `copyDirRecursive` for the wedge this prevents.
|
|
6966
6966
|
*/
|
|
6967
6967
|
async function installPackageFromNpm(packageName, targetDir) {
|
|
6968
|
-
const tmpDir = await fs.promises.mkdtemp(path$1.join(os$1.tmpdir(), "camstack-install-"));
|
|
6968
|
+
const tmpDir = await fs$1.promises.mkdtemp(path$1.join(os$1.tmpdir(), "camstack-install-"));
|
|
6969
6969
|
try {
|
|
6970
6970
|
const { stdout } = await execFileAsync$4("npm", [
|
|
6971
6971
|
"pack",
|
|
@@ -6988,21 +6988,21 @@ async function installPackageFromNpm(packageName, targetDir) {
|
|
|
6988
6988
|
extractDir
|
|
6989
6989
|
], { timeout: 3e4 });
|
|
6990
6990
|
const packageSubDir = path$1.join(extractDir, "package");
|
|
6991
|
-
const srcPkgJsonDir = fs.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
|
|
6992
|
-
await fs.promises.rm(targetDir, {
|
|
6991
|
+
const srcPkgJsonDir = fs$1.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
|
|
6992
|
+
await fs$1.promises.rm(targetDir, {
|
|
6993
6993
|
recursive: true,
|
|
6994
6994
|
force: true
|
|
6995
6995
|
});
|
|
6996
6996
|
ensureDir(targetDir);
|
|
6997
|
-
await fs.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
|
|
6997
|
+
await fs$1.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
|
|
6998
6998
|
const distSrc = path$1.join(srcPkgJsonDir, "dist");
|
|
6999
|
-
if (fs.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
|
|
6999
|
+
if (fs$1.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
|
|
7000
7000
|
try {
|
|
7001
|
-
const npmPkg = asJsonObject$1(parseJsonUnknown(await fs.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
7001
|
+
const npmPkg = asJsonObject$1(parseJsonUnknown(await fs$1.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
7002
7002
|
if (npmPkg) await copyExtraFileDirs(npmPkg, srcPkgJsonDir, targetDir);
|
|
7003
7003
|
} catch {}
|
|
7004
7004
|
} finally {
|
|
7005
|
-
await fs.promises.rm(tmpDir, {
|
|
7005
|
+
await fs$1.promises.rm(tmpDir, {
|
|
7006
7006
|
recursive: true,
|
|
7007
7007
|
force: true
|
|
7008
7008
|
});
|
|
@@ -7027,7 +7027,7 @@ function packageDirName$1(declaredName) {
|
|
|
7027
7027
|
}
|
|
7028
7028
|
function isDirLike$1(p) {
|
|
7029
7029
|
try {
|
|
7030
|
-
return fs.statSync(p).isDirectory();
|
|
7030
|
+
return fs$1.statSync(p).isDirectory();
|
|
7031
7031
|
} catch {
|
|
7032
7032
|
return false;
|
|
7033
7033
|
}
|
|
@@ -7045,12 +7045,12 @@ var AddonManifest = class {
|
|
|
7045
7045
|
*/
|
|
7046
7046
|
read() {
|
|
7047
7047
|
if (this.cache != null) return this.cache;
|
|
7048
|
-
if (!fs.existsSync(this.manifestPath)) {
|
|
7048
|
+
if (!fs$1.existsSync(this.manifestPath)) {
|
|
7049
7049
|
this.cache = this.empty();
|
|
7050
7050
|
return this.cache;
|
|
7051
7051
|
}
|
|
7052
7052
|
try {
|
|
7053
|
-
const raw = fs.readFileSync(this.manifestPath, "utf-8");
|
|
7053
|
+
const raw = fs$1.readFileSync(this.manifestPath, "utf-8");
|
|
7054
7054
|
const parsed = JSON.parse(raw);
|
|
7055
7055
|
if (parsed.version !== MANIFEST_VERSION) {
|
|
7056
7056
|
process.stderr.write(`[AddonManifest] schema mismatch (file=${parsed.version} vs runtime=${MANIFEST_VERSION}); starting empty\n`);
|
|
@@ -7071,13 +7071,13 @@ var AddonManifest = class {
|
|
|
7071
7071
|
* a half-written file.
|
|
7072
7072
|
*/
|
|
7073
7073
|
write(manifest) {
|
|
7074
|
-
fs.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
|
|
7074
|
+
fs$1.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
|
|
7075
7075
|
const tmp = `${this.manifestPath}.tmp.${process.pid}.${Date.now()}`;
|
|
7076
|
-
fs.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
|
|
7076
|
+
fs$1.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
|
|
7077
7077
|
encoding: "utf-8",
|
|
7078
7078
|
mode: 384
|
|
7079
7079
|
});
|
|
7080
|
-
fs.renameSync(tmp, this.manifestPath);
|
|
7080
|
+
fs$1.renameSync(tmp, this.manifestPath);
|
|
7081
7081
|
this.cache = manifest;
|
|
7082
7082
|
}
|
|
7083
7083
|
/** Lookup a single addon's manifest entry, or `null` if not tracked. */
|
|
@@ -7152,22 +7152,22 @@ var AddonManifest = class {
|
|
|
7152
7152
|
* exactly what moved. Returns the total number of changes.
|
|
7153
7153
|
*/
|
|
7154
7154
|
reconcileFromDisk(addonsDir, onChange) {
|
|
7155
|
-
if (!fs.existsSync(addonsDir)) return 0;
|
|
7155
|
+
if (!fs$1.existsSync(addonsDir)) return 0;
|
|
7156
7156
|
const m = this.read();
|
|
7157
7157
|
let changes = 0;
|
|
7158
7158
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7159
7159
|
/** Package name → version, for every ADDON package actually installed. */
|
|
7160
7160
|
const onDisk = /* @__PURE__ */ new Map();
|
|
7161
|
-
for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7161
|
+
for (const scope of fs$1.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7162
7162
|
if (!scope.name.startsWith("@") || !isDirLike$1(path$1.join(addonsDir, scope.name))) continue;
|
|
7163
7163
|
const scopeDir = path$1.join(addonsDir, scope.name);
|
|
7164
|
-
for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7164
|
+
for (const pkg of fs$1.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7165
7165
|
if (!isDirLike$1(path$1.join(scopeDir, pkg.name))) continue;
|
|
7166
7166
|
const pkgJsonPath = path$1.join(scopeDir, pkg.name, "package.json");
|
|
7167
|
-
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
7167
|
+
if (!fs$1.existsSync(pkgJsonPath)) continue;
|
|
7168
7168
|
let pkgJson;
|
|
7169
7169
|
try {
|
|
7170
|
-
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
7170
|
+
const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
|
|
7171
7171
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
7172
7172
|
pkgJson = parsed;
|
|
7173
7173
|
} catch {
|
|
@@ -7238,28 +7238,28 @@ var AddonManifest = class {
|
|
|
7238
7238
|
migrateFromInstallSourceMarkers(addonsDir) {
|
|
7239
7239
|
const m = this.read();
|
|
7240
7240
|
if (Object.keys(m.addons).length > 0) return 0;
|
|
7241
|
-
if (!fs.existsSync(addonsDir)) return 0;
|
|
7241
|
+
if (!fs$1.existsSync(addonsDir)) return 0;
|
|
7242
7242
|
let migrated = 0;
|
|
7243
7243
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7244
|
-
for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7244
|
+
for (const scope of fs$1.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7245
7245
|
if (!scope.isDirectory() || !scope.name.startsWith("@")) continue;
|
|
7246
7246
|
const scopeDir = path$1.join(addonsDir, scope.name);
|
|
7247
|
-
for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7247
|
+
for (const pkg of fs$1.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7248
7248
|
if (!pkg.isDirectory()) continue;
|
|
7249
7249
|
const pkgDir = path$1.join(scopeDir, pkg.name);
|
|
7250
7250
|
const markerPath = path$1.join(pkgDir, ".install-source");
|
|
7251
7251
|
const pkgJsonPath = path$1.join(pkgDir, "package.json");
|
|
7252
|
-
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
7252
|
+
if (!fs$1.existsSync(pkgJsonPath)) continue;
|
|
7253
7253
|
let pkgJson;
|
|
7254
7254
|
try {
|
|
7255
|
-
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
7255
|
+
const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
|
|
7256
7256
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
7257
7257
|
pkgJson = parsed;
|
|
7258
7258
|
} catch {
|
|
7259
7259
|
continue;
|
|
7260
7260
|
}
|
|
7261
7261
|
if (!pkgJson.name || !pkgJson.version) continue;
|
|
7262
|
-
const source = fs.existsSync(markerPath) ? fs.readFileSync(markerPath, "utf-8").trim() : "bundled";
|
|
7262
|
+
const source = fs$1.existsSync(markerPath) ? fs$1.readFileSync(markerPath, "utf-8").trim() : "bundled";
|
|
7263
7263
|
m.addons[pkgJson.name] = {
|
|
7264
7264
|
name: pkgJson.name,
|
|
7265
7265
|
version: pkgJson.version,
|
|
@@ -7463,7 +7463,7 @@ function planClosureDedupe(input) {
|
|
|
7463
7463
|
function readTreeManifest(pkgJsonPath) {
|
|
7464
7464
|
let raw;
|
|
7465
7465
|
try {
|
|
7466
|
-
raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
|
|
7466
|
+
raw = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8")));
|
|
7467
7467
|
} catch {
|
|
7468
7468
|
return null;
|
|
7469
7469
|
}
|
|
@@ -7488,7 +7488,7 @@ function readTreeManifest(pkgJsonPath) {
|
|
|
7488
7488
|
function listTopLevelEntries(nodeModulesDir) {
|
|
7489
7489
|
let entries;
|
|
7490
7490
|
try {
|
|
7491
|
-
entries = fs.readdirSync(nodeModulesDir, { withFileTypes: true });
|
|
7491
|
+
entries = fs$1.readdirSync(nodeModulesDir, { withFileTypes: true });
|
|
7492
7492
|
} catch {
|
|
7493
7493
|
return [];
|
|
7494
7494
|
}
|
|
@@ -7498,7 +7498,7 @@ function listTopLevelEntries(nodeModulesDir) {
|
|
|
7498
7498
|
if (entry.name.startsWith("@")) {
|
|
7499
7499
|
let inner;
|
|
7500
7500
|
try {
|
|
7501
|
-
inner = fs.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
|
|
7501
|
+
inner = fs$1.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
|
|
7502
7502
|
} catch {
|
|
7503
7503
|
continue;
|
|
7504
7504
|
}
|
|
@@ -7531,14 +7531,14 @@ function collectAddonTreeState(addonDir) {
|
|
|
7531
7531
|
const entryDir = path$1.join(nodeModulesDir, name);
|
|
7532
7532
|
let isLink = false;
|
|
7533
7533
|
try {
|
|
7534
|
-
isLink = fs.lstatSync(entryDir).isSymbolicLink();
|
|
7534
|
+
isLink = fs$1.lstatSync(entryDir).isSymbolicLink();
|
|
7535
7535
|
} catch {
|
|
7536
7536
|
continue;
|
|
7537
7537
|
}
|
|
7538
7538
|
if (isLink) {
|
|
7539
7539
|
let target = "";
|
|
7540
7540
|
try {
|
|
7541
|
-
target = fs.readlinkSync(entryDir);
|
|
7541
|
+
target = fs$1.readlinkSync(entryDir);
|
|
7542
7542
|
} catch {}
|
|
7543
7543
|
existingLinks.push({
|
|
7544
7544
|
name,
|
|
@@ -7552,7 +7552,7 @@ function collectAddonTreeState(addonDir) {
|
|
|
7552
7552
|
version: manifest.version
|
|
7553
7553
|
});
|
|
7554
7554
|
for (const [depName, range] of manifest.ranges) {
|
|
7555
|
-
if (fs.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
|
|
7555
|
+
if (fs$1.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
|
|
7556
7556
|
addRange(depName, range);
|
|
7557
7557
|
}
|
|
7558
7558
|
}
|
|
@@ -7582,7 +7582,7 @@ function resolveClosureNodeModulesDir(explicitDir) {
|
|
|
7582
7582
|
const frameworkDir = explicitDir ?? process.env["CAMSTACK_FRAMEWORK_DIR"];
|
|
7583
7583
|
if (frameworkDir === void 0 || frameworkDir.length === 0) return null;
|
|
7584
7584
|
const nodeModulesDir = explicitDir ?? path$1.join(frameworkDir, "node_modules");
|
|
7585
|
-
return fs.existsSync(nodeModulesDir) ? nodeModulesDir : null;
|
|
7585
|
+
return fs$1.existsSync(nodeModulesDir) ? nodeModulesDir : null;
|
|
7586
7586
|
}
|
|
7587
7587
|
function symlinkType() {
|
|
7588
7588
|
return process.platform === "win32" ? "junction" : "dir";
|
|
@@ -7601,10 +7601,10 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
|
|
|
7601
7601
|
const nodeModulesDir = path$1.join(addonDir, "node_modules");
|
|
7602
7602
|
const probePath = path$1.join(nodeModulesDir, ".closure-link-probe");
|
|
7603
7603
|
try {
|
|
7604
|
-
fs.mkdirSync(nodeModulesDir, { recursive: true });
|
|
7605
|
-
fs.rmSync(probePath, { force: true });
|
|
7606
|
-
fs.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
|
|
7607
|
-
fs.rmSync(probePath, { force: true });
|
|
7604
|
+
fs$1.mkdirSync(nodeModulesDir, { recursive: true });
|
|
7605
|
+
fs$1.rmSync(probePath, { force: true });
|
|
7606
|
+
fs$1.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
|
|
7607
|
+
fs$1.rmSync(probePath, { force: true });
|
|
7608
7608
|
} catch (err) {
|
|
7609
7609
|
logger.warn("closure dedupe skipped — symlinks unavailable on this volume", { meta: {
|
|
7610
7610
|
addonDir,
|
|
@@ -7626,12 +7626,12 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
|
|
|
7626
7626
|
}
|
|
7627
7627
|
const entryDir = path$1.join(nodeModulesDir, link.name);
|
|
7628
7628
|
try {
|
|
7629
|
-
fs.rmSync(entryDir, {
|
|
7629
|
+
fs$1.rmSync(entryDir, {
|
|
7630
7630
|
recursive: true,
|
|
7631
7631
|
force: true
|
|
7632
7632
|
});
|
|
7633
|
-
fs.mkdirSync(path$1.dirname(entryDir), { recursive: true });
|
|
7634
|
-
fs.symlinkSync(target, entryDir, symlinkType());
|
|
7633
|
+
fs$1.mkdirSync(path$1.dirname(entryDir), { recursive: true });
|
|
7634
|
+
fs$1.symlinkSync(target, entryDir, symlinkType());
|
|
7635
7635
|
linked.push(link.name);
|
|
7636
7636
|
} catch (err) {
|
|
7637
7637
|
logger.warn("closure dedupe — link failed; entry removed copy may need reinstall", { meta: {
|
|
@@ -7707,7 +7707,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
|
|
|
7707
7707
|
count: Object.keys(native).length
|
|
7708
7708
|
} });
|
|
7709
7709
|
try {
|
|
7710
|
-
fs.writeFileSync(markerFile, markerHash);
|
|
7710
|
+
fs$1.writeFileSync(markerFile, markerHash);
|
|
7711
7711
|
} catch (err) {
|
|
7712
7712
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
7713
7713
|
markerFile,
|
|
@@ -7745,7 +7745,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
|
|
|
7745
7745
|
}
|
|
7746
7746
|
await rebuildNativeDeps(addonDir, pending.map(([name]) => name), logger, npmCacheDir ?? defaultNpmCacheDir(), registry);
|
|
7747
7747
|
try {
|
|
7748
|
-
fs.writeFileSync(markerFile, markerHash);
|
|
7748
|
+
fs$1.writeFileSync(markerFile, markerHash);
|
|
7749
7749
|
} catch (err) {
|
|
7750
7750
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
7751
7751
|
markerFile,
|
|
@@ -7767,12 +7767,12 @@ function copyPrebuiltNativeDep(name, addonDir, logger) {
|
|
|
7767
7767
|
if (source === target) continue;
|
|
7768
7768
|
if (!hasBuiltBinary(source)) continue;
|
|
7769
7769
|
try {
|
|
7770
|
-
fs.rmSync(target, {
|
|
7770
|
+
fs$1.rmSync(target, {
|
|
7771
7771
|
recursive: true,
|
|
7772
7772
|
force: true
|
|
7773
7773
|
});
|
|
7774
|
-
fs.mkdirSync(path$1.dirname(target), { recursive: true });
|
|
7775
|
-
fs.cpSync(source, target, {
|
|
7774
|
+
fs$1.mkdirSync(path$1.dirname(target), { recursive: true });
|
|
7775
|
+
fs$1.cpSync(source, target, {
|
|
7776
7776
|
recursive: true,
|
|
7777
7777
|
dereference: true
|
|
7778
7778
|
});
|
|
@@ -7808,7 +7808,7 @@ var BUNDLED_NATIVE_SIBLING_SCOPES = {
|
|
|
7808
7808
|
function hasAnyDotNode(dir, maxDepth) {
|
|
7809
7809
|
let entries;
|
|
7810
7810
|
try {
|
|
7811
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
7811
|
+
entries = fs$1.readdirSync(dir, { withFileTypes: true });
|
|
7812
7812
|
} catch {
|
|
7813
7813
|
return false;
|
|
7814
7814
|
}
|
|
@@ -7822,12 +7822,12 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
|
|
|
7822
7822
|
if (!hasAnyDotNode(src, 5)) return;
|
|
7823
7823
|
if (hasAnyDotNode(dst, 5)) return;
|
|
7824
7824
|
try {
|
|
7825
|
-
fs.rmSync(dst, {
|
|
7825
|
+
fs$1.rmSync(dst, {
|
|
7826
7826
|
recursive: true,
|
|
7827
7827
|
force: true
|
|
7828
7828
|
});
|
|
7829
|
-
fs.mkdirSync(path$1.dirname(dst), { recursive: true });
|
|
7830
|
-
fs.cpSync(src, dst, {
|
|
7829
|
+
fs$1.mkdirSync(path$1.dirname(dst), { recursive: true });
|
|
7830
|
+
fs$1.cpSync(src, dst, {
|
|
7831
7831
|
recursive: true,
|
|
7832
7832
|
dereference: true
|
|
7833
7833
|
});
|
|
@@ -7862,7 +7862,7 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
|
|
|
7862
7862
|
*/
|
|
7863
7863
|
function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
7864
7864
|
const srcNm = path$1.join(sourceDir, "node_modules");
|
|
7865
|
-
if (!fs.existsSync(srcNm)) return;
|
|
7865
|
+
if (!fs$1.existsSync(srcNm)) return;
|
|
7866
7866
|
const dstNm = path$1.join(targetDir, "node_modules");
|
|
7867
7867
|
for (const [name, scopes] of Object.entries(BUNDLED_NATIVE_SIBLING_SCOPES)) {
|
|
7868
7868
|
copyPrebuiltModuleDir(path$1.join(srcNm, name), path$1.join(dstNm, name), name, logger);
|
|
@@ -7870,7 +7870,7 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
|
7870
7870
|
const scopeSrc = path$1.join(srcNm, scope);
|
|
7871
7871
|
let siblings;
|
|
7872
7872
|
try {
|
|
7873
|
-
siblings = fs.readdirSync(scopeSrc);
|
|
7873
|
+
siblings = fs$1.readdirSync(scopeSrc);
|
|
7874
7874
|
} catch {
|
|
7875
7875
|
continue;
|
|
7876
7876
|
}
|
|
@@ -7880,12 +7880,12 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
|
7880
7880
|
}
|
|
7881
7881
|
/** A package dir is "built" when it carries a compiled `.node` or a prebuilds tree. */
|
|
7882
7882
|
function hasBuiltBinary(pkgDir) {
|
|
7883
|
-
if (!fs.existsSync(path$1.join(pkgDir, "package.json"))) return false;
|
|
7883
|
+
if (!fs$1.existsSync(path$1.join(pkgDir, "package.json"))) return false;
|
|
7884
7884
|
const releaseDir = path$1.join(pkgDir, "build", "Release");
|
|
7885
7885
|
try {
|
|
7886
|
-
if (fs.existsSync(releaseDir) && fs.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
|
|
7886
|
+
if (fs$1.existsSync(releaseDir) && fs$1.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
|
|
7887
7887
|
} catch {}
|
|
7888
|
-
return fs.existsSync(path$1.join(pkgDir, "prebuilds"));
|
|
7888
|
+
return fs$1.existsSync(path$1.join(pkgDir, "prebuilds"));
|
|
7889
7889
|
}
|
|
7890
7890
|
/** Candidate hoisted locations for `<name>`: NODE_PATH entries + ancestors of `addonDir`. */
|
|
7891
7891
|
function candidateHoistedDirs(name, addonDir) {
|
|
@@ -7923,7 +7923,7 @@ function hashDeclaration(deps) {
|
|
|
7923
7923
|
}
|
|
7924
7924
|
function markerMatches(markerFile, expected) {
|
|
7925
7925
|
try {
|
|
7926
|
-
return fs.readFileSync(markerFile, "utf-8").trim() === expected;
|
|
7926
|
+
return fs$1.readFileSync(markerFile, "utf-8").trim() === expected;
|
|
7927
7927
|
} catch {
|
|
7928
7928
|
return false;
|
|
7929
7929
|
}
|
|
@@ -8134,7 +8134,7 @@ function parseInstallSource(value) {
|
|
|
8134
8134
|
function readPackageJson(pkgJsonPath) {
|
|
8135
8135
|
let raw;
|
|
8136
8136
|
try {
|
|
8137
|
-
raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
|
|
8137
|
+
raw = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8")));
|
|
8138
8138
|
} catch {
|
|
8139
8139
|
return null;
|
|
8140
8140
|
}
|
|
@@ -8178,7 +8178,7 @@ var REGISTRY_LATEST_TIMEOUT_MS = 15e3;
|
|
|
8178
8178
|
var FALLBACK_VERSION_PROBES = 25;
|
|
8179
8179
|
function readInstalledPackageVersion(addonDir) {
|
|
8180
8180
|
try {
|
|
8181
|
-
const raw = JSON.parse(fs.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
|
|
8181
|
+
const raw = JSON.parse(fs$1.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
|
|
8182
8182
|
if (raw === null || typeof raw !== "object") return null;
|
|
8183
8183
|
const version = Reflect.get(raw, "version");
|
|
8184
8184
|
return typeof version === "string" && version.length > 0 ? version : null;
|
|
@@ -8326,7 +8326,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8326
8326
|
} catch {
|
|
8327
8327
|
return Object.freeze([]);
|
|
8328
8328
|
}
|
|
8329
|
-
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
8329
|
+
const raw = fs$1.readFileSync(pkgPath, "utf-8");
|
|
8330
8330
|
const parsed = JSON.parse(raw);
|
|
8331
8331
|
const deps = Object.keys(parsed.dependencies ?? {});
|
|
8332
8332
|
const agentOnly = new Set(parsed.camstack?.agentOnlyBootstrapAddons ?? []);
|
|
@@ -8371,7 +8371,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8371
8371
|
} catch {
|
|
8372
8372
|
return Object.freeze([]);
|
|
8373
8373
|
}
|
|
8374
|
-
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
8374
|
+
const raw = fs$1.readFileSync(pkgPath, "utf-8");
|
|
8375
8375
|
const addons = JSON.parse(raw).camstack?.agentBootstrapAddons ?? [];
|
|
8376
8376
|
return Object.freeze(["@camstack/server", ...addons]);
|
|
8377
8377
|
}
|
|
@@ -8401,7 +8401,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8401
8401
|
this.logger.info(`Install source: ${isLocal ? `bundle (${this.bundledAddonsDir})` : "npm"}, ${pkgList.length} package(s)`);
|
|
8402
8402
|
for (const packageName of pkgList) {
|
|
8403
8403
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
8404
|
-
if (fs.existsSync(path$1.join(addonDir, "package.json"))) {
|
|
8404
|
+
if (fs$1.existsSync(path$1.join(addonDir, "package.json"))) {
|
|
8405
8405
|
if (isLocal || shouldSkipClosureProvidedSeed(packageName, this.isResolvableFromClosure(packageName))) {
|
|
8406
8406
|
this.logger.debug(`${packageName} — already installed, skipping`);
|
|
8407
8407
|
continue;
|
|
@@ -8652,7 +8652,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8652
8652
|
const installedPackages = this.listInstalled();
|
|
8653
8653
|
for (const pkg of installedPackages) {
|
|
8654
8654
|
try {
|
|
8655
|
-
if (fs.lstatSync(pkg.dir).isSymbolicLink()) continue;
|
|
8655
|
+
if (fs$1.lstatSync(pkg.dir).isSymbolicLink()) continue;
|
|
8656
8656
|
} catch {
|
|
8657
8657
|
continue;
|
|
8658
8658
|
}
|
|
@@ -8692,7 +8692,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8692
8692
|
if (closureNodeModules !== null) for (const link of state.existingLinks) {
|
|
8693
8693
|
if (!isClosureLinkTarget(link.target, closureNodeModules)) continue;
|
|
8694
8694
|
const linkDir = path$1.join(nodeModulesDir, link.name);
|
|
8695
|
-
const targetManifest = fs.existsSync(path$1.join(linkDir, "package.json"));
|
|
8695
|
+
const targetManifest = fs$1.existsSync(path$1.join(linkDir, "package.json"));
|
|
8696
8696
|
const ranges = state.requirements.get(link.name) ?? [];
|
|
8697
8697
|
let holds = targetManifest;
|
|
8698
8698
|
if (holds && ranges.length > 0) {
|
|
@@ -8701,14 +8701,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8701
8701
|
}
|
|
8702
8702
|
if (!holds) {
|
|
8703
8703
|
this.logger.warn(`${packageName} — closure link for ${link.name} no longer holds; reinstalling this addon's deps`, { meta: { target: link.target } });
|
|
8704
|
-
fs.rmSync(linkDir, { force: true });
|
|
8704
|
+
fs$1.rmSync(linkDir, { force: true });
|
|
8705
8705
|
needsInstall = true;
|
|
8706
8706
|
}
|
|
8707
8707
|
}
|
|
8708
8708
|
const linked = [];
|
|
8709
8709
|
for (const [depName, range] of declaredEntries) {
|
|
8710
8710
|
if (typeof range !== "string") continue;
|
|
8711
|
-
if (fs.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
|
|
8711
|
+
if (fs$1.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
|
|
8712
8712
|
const closureVersion = closureNodeModules === null ? void 0 : readClosureVersions(closureNodeModules, [depName]).get(depName);
|
|
8713
8713
|
if (closureNodeModules !== null && closureVersion !== void 0 && closureSatisfiesRange(range, closureVersion)) {
|
|
8714
8714
|
if (executeClosureDedupe(addonDir, closureNodeModules, {
|
|
@@ -8741,7 +8741,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8741
8741
|
const closureNodeModules = resolveClosureNodeModulesDir(this.closureNodeModulesDir);
|
|
8742
8742
|
if (closureNodeModules !== null) {
|
|
8743
8743
|
const state = collectAddonTreeState(addonDir);
|
|
8744
|
-
for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
|
|
8744
|
+
for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs$1.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
|
|
8745
8745
|
}
|
|
8746
8746
|
this.logger.info(`${packageName} — reinstalling runtime dependencies`, { meta: { addonDir } });
|
|
8747
8747
|
await runNpm([
|
|
@@ -8786,7 +8786,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8786
8786
|
async realignFromClosure(packageName, closureDir) {
|
|
8787
8787
|
const targetDir = path$1.join(this.addonsDir, packageName);
|
|
8788
8788
|
const result = await this.installLocal(packageName, closureDir);
|
|
8789
|
-
await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
|
|
8789
|
+
await fs$1.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
|
|
8790
8790
|
this.manifest.upsert(result.name, {
|
|
8791
8791
|
version: result.version,
|
|
8792
8792
|
source: "closure"
|
|
@@ -8802,17 +8802,17 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8802
8802
|
async installCopy(packageName, sourceDir, pkgData, targetDir) {
|
|
8803
8803
|
await this.ensureBuilt(packageName, sourceDir, pkgData);
|
|
8804
8804
|
const distDir = path$1.join(sourceDir, "dist");
|
|
8805
|
-
if (!fs.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
|
|
8806
|
-
await fs.promises.rm(targetDir, {
|
|
8805
|
+
if (!fs$1.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
|
|
8806
|
+
await fs$1.promises.rm(targetDir, {
|
|
8807
8807
|
recursive: true,
|
|
8808
8808
|
force: true
|
|
8809
8809
|
});
|
|
8810
8810
|
ensureDir(targetDir);
|
|
8811
|
-
await fs.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
|
|
8811
|
+
await fs$1.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
|
|
8812
8812
|
await copyDirRecursive(distDir, path$1.join(targetDir, "dist"));
|
|
8813
8813
|
await copyExtraFileDirs(pkgData, sourceDir, targetDir);
|
|
8814
8814
|
copyBundledNativeModules(sourceDir, targetDir, this.logger);
|
|
8815
|
-
await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
|
|
8815
|
+
await fs$1.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
|
|
8816
8816
|
const localPkgVersion = asString$1(pkgData.version, "0.0.0");
|
|
8817
8817
|
this.manifest.upsert(packageName, {
|
|
8818
8818
|
version: localPkgVersion,
|
|
@@ -8853,7 +8853,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8853
8853
|
* unusual auth, offline mode, etc).
|
|
8854
8854
|
*/
|
|
8855
8855
|
async installFromNpm(packageName, version) {
|
|
8856
|
-
const tmpDir = fs.mkdtempSync(path$1.join(os$1.tmpdir(), "camstack-addon-npm-"));
|
|
8856
|
+
const tmpDir = fs$1.mkdtempSync(path$1.join(os$1.tmpdir(), "camstack-addon-npm-"));
|
|
8857
8857
|
const packageSpec = version ? `${packageName}@${version}` : packageName;
|
|
8858
8858
|
this.logger.info(`${packageName} — installing from npm`);
|
|
8859
8859
|
try {
|
|
@@ -8867,19 +8867,19 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8867
8867
|
];
|
|
8868
8868
|
if (this.registry) args.push("--registry", this.registry);
|
|
8869
8869
|
const { stdout } = await runNpm(args, this.npmRunOptions(tmpDir, 12e4));
|
|
8870
|
-
const tgzFiles = fs.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
|
|
8870
|
+
const tgzFiles = fs$1.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
|
|
8871
8871
|
if (tgzFiles.length === 0) throw new Error(`npm pack produced no tgz. stdout: ${stdout.trim()}`);
|
|
8872
8872
|
return path$1.join(tmpDir, tgzFiles[0]);
|
|
8873
8873
|
});
|
|
8874
8874
|
const result = await this.installFromTgz(tgzPath);
|
|
8875
|
-
fs.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
|
|
8875
|
+
fs$1.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
|
|
8876
8876
|
this.manifest.upsert(result.name, {
|
|
8877
8877
|
version: result.version,
|
|
8878
8878
|
source: "npm"
|
|
8879
8879
|
});
|
|
8880
8880
|
return result;
|
|
8881
8881
|
} finally {
|
|
8882
|
-
fs.rmSync(tmpDir, {
|
|
8882
|
+
fs$1.rmSync(tmpDir, {
|
|
8883
8883
|
recursive: true,
|
|
8884
8884
|
force: true
|
|
8885
8885
|
});
|
|
@@ -8917,7 +8917,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8917
8917
|
if (!tarRes.ok) throw new Error(`tarball GET ${tarballUrl} → ${tarRes.status}`);
|
|
8918
8918
|
const tgzPath = path$1.join(tmpDir, `${packageName.replace(/[/@]/g, "-").replace(/^-+/, "")}-${resolvedVersion}.tgz`);
|
|
8919
8919
|
const buf = Buffer.from(await tarRes.arrayBuffer());
|
|
8920
|
-
fs.writeFileSync(tgzPath, buf);
|
|
8920
|
+
fs$1.writeFileSync(tgzPath, buf);
|
|
8921
8921
|
return tgzPath;
|
|
8922
8922
|
}
|
|
8923
8923
|
/**
|
|
@@ -8938,7 +8938,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8938
8938
|
* on the next deploy.
|
|
8939
8939
|
*/
|
|
8940
8940
|
async evictInstallDir(targetDir) {
|
|
8941
|
-
if (!fs.existsSync(targetDir)) return;
|
|
8941
|
+
if (!fs$1.existsSync(targetDir)) return;
|
|
8942
8942
|
const graveyard = path$1.join(this.addonsDir, ".evicting");
|
|
8943
8943
|
ensureDir(graveyard);
|
|
8944
8944
|
await this.sweepGraveyard(graveyard);
|
|
@@ -8946,10 +8946,10 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8946
8946
|
const flatName = path$1.relative(this.addonsDir, targetDir).replace(/[/\\]/g, "-");
|
|
8947
8947
|
const asideDir = path$1.join(graveyard, `${flatName}-${ts}`);
|
|
8948
8948
|
try {
|
|
8949
|
-
fs.renameSync(targetDir, asideDir);
|
|
8949
|
+
fs$1.renameSync(targetDir, asideDir);
|
|
8950
8950
|
} catch (renameErr) {
|
|
8951
8951
|
if (renameErr.code === "EXDEV") {
|
|
8952
|
-
await fs.promises.rm(targetDir, {
|
|
8952
|
+
await fs$1.promises.rm(targetDir, {
|
|
8953
8953
|
recursive: true,
|
|
8954
8954
|
force: true
|
|
8955
8955
|
});
|
|
@@ -8957,7 +8957,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8957
8957
|
}
|
|
8958
8958
|
throw renameErr;
|
|
8959
8959
|
}
|
|
8960
|
-
await fs.promises.rm(asideDir, {
|
|
8960
|
+
await fs$1.promises.rm(asideDir, {
|
|
8961
8961
|
recursive: true,
|
|
8962
8962
|
force: true
|
|
8963
8963
|
}).catch((cleanupErr) => {
|
|
@@ -8978,14 +8978,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8978
8978
|
async sweepStagingResidue(stagingRoot) {
|
|
8979
8979
|
let names;
|
|
8980
8980
|
try {
|
|
8981
|
-
names = fs.readdirSync(stagingRoot);
|
|
8981
|
+
names = fs$1.readdirSync(stagingRoot);
|
|
8982
8982
|
} catch {
|
|
8983
8983
|
return;
|
|
8984
8984
|
}
|
|
8985
8985
|
const now = Date.now();
|
|
8986
8986
|
const ages = [];
|
|
8987
8987
|
for (const name of names) try {
|
|
8988
|
-
const stat = fs.statSync(path$1.join(stagingRoot, name));
|
|
8988
|
+
const stat = fs$1.statSync(path$1.join(stagingRoot, name));
|
|
8989
8989
|
ages.push({
|
|
8990
8990
|
name,
|
|
8991
8991
|
ageMs: now - stat.mtimeMs
|
|
@@ -8996,7 +8996,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8996
8996
|
stagingRoot,
|
|
8997
8997
|
entries: sweepable
|
|
8998
8998
|
} });
|
|
8999
|
-
await Promise.all(sweepable.map((name) => fs.promises.rm(path$1.join(stagingRoot, name), {
|
|
8999
|
+
await Promise.all(sweepable.map((name) => fs$1.promises.rm(path$1.join(stagingRoot, name), {
|
|
9000
9000
|
recursive: true,
|
|
9001
9001
|
force: true
|
|
9002
9002
|
}).catch(() => void 0)));
|
|
@@ -9005,11 +9005,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9005
9005
|
async sweepGraveyard(graveyard) {
|
|
9006
9006
|
let entries;
|
|
9007
9007
|
try {
|
|
9008
|
-
entries = fs.readdirSync(graveyard);
|
|
9008
|
+
entries = fs$1.readdirSync(graveyard);
|
|
9009
9009
|
} catch {
|
|
9010
9010
|
return;
|
|
9011
9011
|
}
|
|
9012
|
-
await Promise.all(entries.map((name) => fs.promises.rm(path$1.join(graveyard, name), {
|
|
9012
|
+
await Promise.all(entries.map((name) => fs$1.promises.rm(path$1.join(graveyard, name), {
|
|
9013
9013
|
recursive: true,
|
|
9014
9014
|
force: true
|
|
9015
9015
|
}).catch(() => void 0)));
|
|
@@ -9060,7 +9060,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9060
9060
|
return;
|
|
9061
9061
|
}
|
|
9062
9062
|
const strippedManifest = stripBundledDeps(pkgView.raw);
|
|
9063
|
-
await fs.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
|
|
9063
|
+
await fs$1.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
|
|
9064
9064
|
const deps = asJsonObject$1(strippedManifest["dependencies"]);
|
|
9065
9065
|
const depNames = deps ? Object.keys(deps) : [];
|
|
9066
9066
|
if (depNames.length === 0) return;
|
|
@@ -9192,9 +9192,9 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9192
9192
|
"-C",
|
|
9193
9193
|
stagingDir
|
|
9194
9194
|
], { timeout: 12e4 });
|
|
9195
|
-
const pkgDir = fs.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
|
|
9195
|
+
const pkgDir = fs$1.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
|
|
9196
9196
|
const pkgJsonPath = path$1.join(pkgDir, "package.json");
|
|
9197
|
-
if (!fs.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
|
|
9197
|
+
if (!fs$1.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
|
|
9198
9198
|
const pkgView = readPackageJson(pkgJsonPath);
|
|
9199
9199
|
if (!pkgView) throw new Error(`Invalid package.json at ${pkgJsonPath}`);
|
|
9200
9200
|
if (!pkgView.camstackAddons) throw new Error(`Package ${pkgView.name} has no camstack.addons manifest`);
|
|
@@ -9204,7 +9204,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9204
9204
|
this.dedupeTreeAgainstClosure(pkgDir, pkgView.name);
|
|
9205
9205
|
await this.evictInstallDir(targetDir);
|
|
9206
9206
|
ensureDir(path$1.dirname(targetDir));
|
|
9207
|
-
await fs.promises.rename(pkgDir, targetDir);
|
|
9207
|
+
await fs$1.promises.rename(pkgDir, targetDir);
|
|
9208
9208
|
this.manifest.upsert(pkgView.name, {
|
|
9209
9209
|
version: pkgView.version,
|
|
9210
9210
|
source: "bundled"
|
|
@@ -9215,7 +9215,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9215
9215
|
};
|
|
9216
9216
|
} finally {
|
|
9217
9217
|
this.inFlightStaging.delete(stagingName);
|
|
9218
|
-
await fs.promises.rm(stagingDir, {
|
|
9218
|
+
await fs$1.promises.rm(stagingDir, {
|
|
9219
9219
|
recursive: true,
|
|
9220
9220
|
force: true
|
|
9221
9221
|
}).catch(() => void 0);
|
|
@@ -9245,24 +9245,24 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9245
9245
|
const current = this.manifest.get(packageName);
|
|
9246
9246
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
9247
9247
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9248
|
-
if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9248
|
+
if (!fs$1.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9249
9249
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
9250
9250
|
const backupRoot = path$1.join(this.addonsDir, ".backups", packageName);
|
|
9251
9251
|
ensureDir(backupRoot);
|
|
9252
9252
|
const backupDir = path$1.join(backupRoot, ts);
|
|
9253
9253
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
9254
|
-
fs.renameSync(addonDir, backupDir);
|
|
9254
|
+
fs$1.renameSync(addonDir, backupDir);
|
|
9255
9255
|
let result;
|
|
9256
9256
|
try {
|
|
9257
9257
|
result = await this.installFromNpm(packageName, version);
|
|
9258
9258
|
} catch (installErr) {
|
|
9259
9259
|
this.logger.error(`${packageName} — install failed, restoring backup`, { meta: { error: errMsg$1(installErr) } });
|
|
9260
9260
|
try {
|
|
9261
|
-
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9261
|
+
if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
|
|
9262
9262
|
recursive: true,
|
|
9263
9263
|
force: true
|
|
9264
9264
|
});
|
|
9265
|
-
fs.renameSync(backupDir, addonDir);
|
|
9265
|
+
fs$1.renameSync(backupDir, addonDir);
|
|
9266
9266
|
this.manifest.upsert(packageName, {
|
|
9267
9267
|
version: current.version,
|
|
9268
9268
|
source: current.source,
|
|
@@ -9323,7 +9323,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9323
9323
|
const current = this.manifest.get(packageName);
|
|
9324
9324
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
9325
9325
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9326
|
-
if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9326
|
+
if (!fs$1.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9327
9327
|
await this.installRuntimeDependencies(stagedPath, packageName);
|
|
9328
9328
|
await this.installNativeDependencies(stagedPath, packageName);
|
|
9329
9329
|
this.dedupeTreeAgainstClosure(stagedPath, packageName);
|
|
@@ -9332,14 +9332,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9332
9332
|
ensureDir(backupRoot);
|
|
9333
9333
|
const backupDir = path$1.join(backupRoot, ts);
|
|
9334
9334
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
9335
|
-
fs.renameSync(addonDir, backupDir);
|
|
9335
|
+
fs$1.renameSync(addonDir, backupDir);
|
|
9336
9336
|
try {
|
|
9337
9337
|
try {
|
|
9338
|
-
fs.renameSync(stagedPath, addonDir);
|
|
9338
|
+
fs$1.renameSync(stagedPath, addonDir);
|
|
9339
9339
|
} catch (renameErr) {
|
|
9340
9340
|
if (renameErr.code === "EXDEV") {
|
|
9341
|
-
fs.cpSync(stagedPath, addonDir, { recursive: true });
|
|
9342
|
-
fs.rmSync(stagedPath, {
|
|
9341
|
+
fs$1.cpSync(stagedPath, addonDir, { recursive: true });
|
|
9342
|
+
fs$1.rmSync(stagedPath, {
|
|
9343
9343
|
recursive: true,
|
|
9344
9344
|
force: true
|
|
9345
9345
|
});
|
|
@@ -9348,11 +9348,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9348
9348
|
} catch (swapErr) {
|
|
9349
9349
|
this.logger.error(`${packageName} — staged swap failed, restoring backup`, { meta: { error: errMsg$1(swapErr) } });
|
|
9350
9350
|
try {
|
|
9351
|
-
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9351
|
+
if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
|
|
9352
9352
|
recursive: true,
|
|
9353
9353
|
force: true
|
|
9354
9354
|
});
|
|
9355
|
-
fs.renameSync(backupDir, addonDir);
|
|
9355
|
+
fs$1.renameSync(backupDir, addonDir);
|
|
9356
9356
|
this.manifest.upsert(packageName, {
|
|
9357
9357
|
version: current.version,
|
|
9358
9358
|
source: current.source,
|
|
@@ -9391,20 +9391,20 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9391
9391
|
this.logger.warn(`${packageName} — no backup to rollback to`);
|
|
9392
9392
|
return null;
|
|
9393
9393
|
}
|
|
9394
|
-
if (!fs.existsSync(entry.lastBackupDir)) {
|
|
9394
|
+
if (!fs$1.existsSync(entry.lastBackupDir)) {
|
|
9395
9395
|
this.logger.warn(`${packageName} — backup dir vanished: ${entry.lastBackupDir}`);
|
|
9396
9396
|
return null;
|
|
9397
9397
|
}
|
|
9398
9398
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9399
|
-
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9399
|
+
if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
|
|
9400
9400
|
recursive: true,
|
|
9401
9401
|
force: true
|
|
9402
9402
|
});
|
|
9403
|
-
fs.renameSync(entry.lastBackupDir, addonDir);
|
|
9403
|
+
fs$1.renameSync(entry.lastBackupDir, addonDir);
|
|
9404
9404
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
9405
9405
|
let restoredVersion = entry.version;
|
|
9406
|
-
if (fs.existsSync(pkgJsonPath)) try {
|
|
9407
|
-
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
9406
|
+
if (fs$1.existsSync(pkgJsonPath)) try {
|
|
9407
|
+
const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
|
|
9408
9408
|
if (typeof parsed === "object" && parsed != null) {
|
|
9409
9409
|
const v = parsed.version;
|
|
9410
9410
|
if (typeof v === "string" && v.length > 0) restoredVersion = v;
|
|
@@ -9452,7 +9452,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9452
9452
|
return false;
|
|
9453
9453
|
}
|
|
9454
9454
|
try {
|
|
9455
|
-
await fs.promises.rm(target, {
|
|
9455
|
+
await fs$1.promises.rm(target, {
|
|
9456
9456
|
recursive: true,
|
|
9457
9457
|
force: true
|
|
9458
9458
|
});
|
|
@@ -9470,7 +9470,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9470
9470
|
listBackupsFor(packageName) {
|
|
9471
9471
|
const dir = path$1.join(this.backupsRoot, packageName);
|
|
9472
9472
|
try {
|
|
9473
|
-
return fs.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
|
|
9473
|
+
return fs$1.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
|
|
9474
9474
|
} catch {
|
|
9475
9475
|
return [];
|
|
9476
9476
|
}
|
|
@@ -9502,7 +9502,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9502
9502
|
for (const dir of [pkgDir, path$1.dirname(pkgDir)]) {
|
|
9503
9503
|
if (!this.isInsideBackups(dir)) continue;
|
|
9504
9504
|
try {
|
|
9505
|
-
await fs.promises.rmdir(dir);
|
|
9505
|
+
await fs$1.promises.rmdir(dir);
|
|
9506
9506
|
} catch {
|
|
9507
9507
|
return;
|
|
9508
9508
|
}
|
|
@@ -9584,7 +9584,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9584
9584
|
*/
|
|
9585
9585
|
resolveBackupToKeep(packageName, backups) {
|
|
9586
9586
|
const liveDir = path$1.join(this.addonsDir, packageName);
|
|
9587
|
-
if (!fs.existsSync(liveDir)) {
|
|
9587
|
+
if (!fs$1.existsSync(liveDir)) {
|
|
9588
9588
|
const newest = backups[backups.length - 1] ?? null;
|
|
9589
9589
|
if (newest != null) this.logger.warn(`${packageName} — live install dir missing; retaining its newest backup as the only surviving copy`, { meta: {
|
|
9590
9590
|
liveDir,
|
|
@@ -9601,7 +9601,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9601
9601
|
listBackedUpPackages() {
|
|
9602
9602
|
let entries;
|
|
9603
9603
|
try {
|
|
9604
|
-
entries = fs.readdirSync(this.backupsRoot, { withFileTypes: true });
|
|
9604
|
+
entries = fs$1.readdirSync(this.backupsRoot, { withFileTypes: true });
|
|
9605
9605
|
} catch {
|
|
9606
9606
|
return [];
|
|
9607
9607
|
}
|
|
@@ -9613,14 +9613,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9613
9613
|
continue;
|
|
9614
9614
|
}
|
|
9615
9615
|
const scopeDir = path$1.join(this.backupsRoot, entry.name);
|
|
9616
|
-
for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
|
|
9616
|
+
for (const inner of fs$1.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
|
|
9617
9617
|
}
|
|
9618
9618
|
return names;
|
|
9619
9619
|
}
|
|
9620
9620
|
async uninstall(packageName) {
|
|
9621
9621
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9622
|
-
if (fs.existsSync(addonDir)) {
|
|
9623
|
-
fs.rmSync(addonDir, {
|
|
9622
|
+
if (fs$1.existsSync(addonDir)) {
|
|
9623
|
+
fs$1.rmSync(addonDir, {
|
|
9624
9624
|
recursive: true,
|
|
9625
9625
|
force: true
|
|
9626
9626
|
});
|
|
@@ -9628,8 +9628,8 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9628
9628
|
return;
|
|
9629
9629
|
}
|
|
9630
9630
|
const legacyDir = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""));
|
|
9631
|
-
if (fs.existsSync(legacyDir)) {
|
|
9632
|
-
fs.rmSync(legacyDir, {
|
|
9631
|
+
if (fs$1.existsSync(legacyDir)) {
|
|
9632
|
+
fs$1.rmSync(legacyDir, {
|
|
9633
9633
|
recursive: true,
|
|
9634
9634
|
force: true
|
|
9635
9635
|
});
|
|
@@ -9637,22 +9637,22 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9637
9637
|
}
|
|
9638
9638
|
}
|
|
9639
9639
|
listInstalled() {
|
|
9640
|
-
if (!fs.existsSync(this.addonsDir)) return [];
|
|
9640
|
+
if (!fs$1.existsSync(this.addonsDir)) return [];
|
|
9641
9641
|
const packageDirs = [];
|
|
9642
|
-
for (const entry of fs.readdirSync(this.addonsDir, { withFileTypes: true })) {
|
|
9642
|
+
for (const entry of fs$1.readdirSync(this.addonsDir, { withFileTypes: true })) {
|
|
9643
9643
|
if (!isDirEntry(entry, this.addonsDir)) continue;
|
|
9644
9644
|
if (entry.name.startsWith("@")) {
|
|
9645
9645
|
const scopeDir = path$1.join(this.addonsDir, entry.name);
|
|
9646
|
-
for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
|
|
9646
|
+
for (const inner of fs$1.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
|
|
9647
9647
|
} else packageDirs.push(path$1.join(this.addonsDir, entry.name));
|
|
9648
9648
|
}
|
|
9649
9649
|
return packageDirs.map((dir) => {
|
|
9650
9650
|
const pkgPath = path$1.join(dir, "package.json");
|
|
9651
|
-
if (!fs.existsSync(pkgPath)) return null;
|
|
9651
|
+
if (!fs$1.existsSync(pkgPath)) return null;
|
|
9652
9652
|
const pkg = readPackageJson(pkgPath);
|
|
9653
9653
|
if (!pkg || !pkg.camstackAddons) return null;
|
|
9654
9654
|
const sourceFile = path$1.join(dir, ".install-source");
|
|
9655
|
-
const installSource = fs.existsSync(sourceFile) ? parseInstallSource(fs.readFileSync(sourceFile, "utf-8").trim()) : void 0;
|
|
9655
|
+
const installSource = fs$1.existsSync(sourceFile) ? parseInstallSource(fs$1.readFileSync(sourceFile, "utf-8").trim()) : void 0;
|
|
9656
9656
|
return {
|
|
9657
9657
|
name: pkg.name,
|
|
9658
9658
|
version: pkg.version,
|
|
@@ -9662,13 +9662,13 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9662
9662
|
}).filter((item) => item !== null);
|
|
9663
9663
|
}
|
|
9664
9664
|
isInstalled(packageName) {
|
|
9665
|
-
if (fs.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
|
|
9666
|
-
return fs.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
|
|
9665
|
+
if (fs$1.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
|
|
9666
|
+
return fs$1.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
|
|
9667
9667
|
}
|
|
9668
9668
|
getInstalledPackage(packageName) {
|
|
9669
9669
|
let pkgPath = path$1.join(this.addonsDir, packageName, "package.json");
|
|
9670
|
-
if (!fs.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
|
|
9671
|
-
if (!fs.existsSync(pkgPath)) return null;
|
|
9670
|
+
if (!fs$1.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
|
|
9671
|
+
if (!fs$1.existsSync(pkgPath)) return null;
|
|
9672
9672
|
const pkg = readPackageJson(pkgPath);
|
|
9673
9673
|
if (!pkg) return null;
|
|
9674
9674
|
return {
|
|
@@ -9687,7 +9687,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9687
9687
|
]) {
|
|
9688
9688
|
const candidate = path$1.join(this.bundledAddonsDir, dirName);
|
|
9689
9689
|
try {
|
|
9690
|
-
const pkg = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
|
|
9690
|
+
const pkg = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
|
|
9691
9691
|
if (pkg && asString$1(pkg["name"]) === packageName) return candidate;
|
|
9692
9692
|
} catch {}
|
|
9693
9693
|
}
|
|
@@ -9696,7 +9696,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9696
9696
|
/** Ensure a package is built (dist/ exists and page bundles present) */
|
|
9697
9697
|
async ensureBuilt(packageName, sourceDir, pkgData) {
|
|
9698
9698
|
const distDir = path$1.join(sourceDir, "dist");
|
|
9699
|
-
if (!(!fs.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
|
|
9699
|
+
if (!(!fs$1.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
|
|
9700
9700
|
this.logger.info(`${packageName} — building (dist/ missing or incomplete)`);
|
|
9701
9701
|
try {
|
|
9702
9702
|
await runNpm(["run", "build"], this.npmRunOptions(sourceDir, 18e4));
|
|
@@ -9711,7 +9711,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9711
9711
|
if (!camstack?.addons) return false;
|
|
9712
9712
|
for (const addon of camstack.addons) {
|
|
9713
9713
|
if (!addon.pages) continue;
|
|
9714
|
-
for (const page of addon.pages) if (page.bundle && !fs.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
|
|
9714
|
+
for (const page of addon.pages) if (page.bundle && !fs$1.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
|
|
9715
9715
|
}
|
|
9716
9716
|
return false;
|
|
9717
9717
|
}
|
|
@@ -9720,7 +9720,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9720
9720
|
function isDirEntry(entry, parentDir) {
|
|
9721
9721
|
if (entry.isDirectory()) return true;
|
|
9722
9722
|
if (entry.isSymbolicLink()) try {
|
|
9723
|
-
return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
9723
|
+
return fs$1.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
9724
9724
|
} catch {
|
|
9725
9725
|
return false;
|
|
9726
9726
|
}
|
|
@@ -9819,7 +9819,7 @@ function selectAddonResidue(candidates) {
|
|
|
9819
9819
|
}
|
|
9820
9820
|
function readDeclaredName(dir) {
|
|
9821
9821
|
try {
|
|
9822
|
-
const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9822
|
+
const parsed = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9823
9823
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
9824
9824
|
const name = parsed.name;
|
|
9825
9825
|
return typeof name === "string" ? name : null;
|
|
@@ -9829,7 +9829,7 @@ function readDeclaredName(dir) {
|
|
|
9829
9829
|
}
|
|
9830
9830
|
function readDeclaredVersion(dir) {
|
|
9831
9831
|
try {
|
|
9832
|
-
const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9832
|
+
const parsed = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9833
9833
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
9834
9834
|
const version = parsed.version;
|
|
9835
9835
|
return typeof version === "string" ? version : null;
|
|
@@ -9839,7 +9839,7 @@ function readDeclaredVersion(dir) {
|
|
|
9839
9839
|
}
|
|
9840
9840
|
function isDirLike(p) {
|
|
9841
9841
|
try {
|
|
9842
|
-
return fs.statSync(p).isDirectory();
|
|
9842
|
+
return fs$1.statSync(p).isDirectory();
|
|
9843
9843
|
} catch {
|
|
9844
9844
|
return false;
|
|
9845
9845
|
}
|
|
@@ -9849,7 +9849,7 @@ function freeQuarantineTarget(store, scope, dirName) {
|
|
|
9849
9849
|
const base = scope === null ? dirName : `${scope.replace("@", "")}__${dirName}`;
|
|
9850
9850
|
let candidate = path$1.join(store, base);
|
|
9851
9851
|
let n = 1;
|
|
9852
|
-
while (fs.existsSync(candidate)) {
|
|
9852
|
+
while (fs$1.existsSync(candidate)) {
|
|
9853
9853
|
candidate = path$1.join(store, `${base}-${n}`);
|
|
9854
9854
|
n += 1;
|
|
9855
9855
|
}
|
|
@@ -9866,7 +9866,7 @@ function freeQuarantineTarget(store, scope, dirName) {
|
|
|
9866
9866
|
function quarantineAddonResidue(addonsDir, log) {
|
|
9867
9867
|
const quarantined = [];
|
|
9868
9868
|
const failed = [];
|
|
9869
|
-
if (!fs.existsSync(addonsDir)) return {
|
|
9869
|
+
if (!fs$1.existsSync(addonsDir)) return {
|
|
9870
9870
|
quarantined,
|
|
9871
9871
|
failed
|
|
9872
9872
|
};
|
|
@@ -9874,7 +9874,7 @@ function quarantineAddonResidue(addonsDir, log) {
|
|
|
9874
9874
|
const scan = (parent, scope) => {
|
|
9875
9875
|
let names;
|
|
9876
9876
|
try {
|
|
9877
|
-
names = fs.readdirSync(parent);
|
|
9877
|
+
names = fs$1.readdirSync(parent);
|
|
9878
9878
|
} catch {
|
|
9879
9879
|
return;
|
|
9880
9880
|
}
|
|
@@ -9893,8 +9893,8 @@ function quarantineAddonResidue(addonsDir, log) {
|
|
|
9893
9893
|
const version = readDeclaredVersion(full);
|
|
9894
9894
|
const to = freeQuarantineTarget(store, scope, dirName);
|
|
9895
9895
|
try {
|
|
9896
|
-
fs.mkdirSync(store, { recursive: true });
|
|
9897
|
-
fs.renameSync(full, to);
|
|
9896
|
+
fs$1.mkdirSync(store, { recursive: true });
|
|
9897
|
+
fs$1.renameSync(full, to);
|
|
9898
9898
|
} catch (err) {
|
|
9899
9899
|
const error = err instanceof Error ? err.message : String(err);
|
|
9900
9900
|
failed.push({
|
|
@@ -9952,11 +9952,11 @@ function getRestartMarkerPath(dataDir) {
|
|
|
9952
9952
|
* intact or no marker at all (never a half-written file).
|
|
9953
9953
|
*/
|
|
9954
9954
|
function writePendingRestart(dataDir, marker) {
|
|
9955
|
-
fs.mkdirSync(dataDir, { recursive: true });
|
|
9955
|
+
fs$1.mkdirSync(dataDir, { recursive: true });
|
|
9956
9956
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
9957
9957
|
const tmpPath = `${markerPath}.tmp`;
|
|
9958
|
-
fs.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
|
|
9959
|
-
fs.renameSync(tmpPath, markerPath);
|
|
9958
|
+
fs$1.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
|
|
9959
|
+
fs$1.renameSync(tmpPath, markerPath);
|
|
9960
9960
|
}
|
|
9961
9961
|
/**
|
|
9962
9962
|
* Read + consume the marker. Returns the parsed payload on success and
|
|
@@ -9981,10 +9981,10 @@ function writePendingRestart(dataDir, marker) {
|
|
|
9981
9981
|
*/
|
|
9982
9982
|
function readPendingRestart(dataDir) {
|
|
9983
9983
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
9984
|
-
if (!fs.existsSync(markerPath)) return null;
|
|
9984
|
+
if (!fs$1.existsSync(markerPath)) return null;
|
|
9985
9985
|
let raw;
|
|
9986
9986
|
try {
|
|
9987
|
-
raw = fs.readFileSync(markerPath, "utf-8");
|
|
9987
|
+
raw = fs$1.readFileSync(markerPath, "utf-8");
|
|
9988
9988
|
} catch (err) {
|
|
9989
9989
|
console.error("[restart-coordinator] Marker unreadable — leaving in place:", err);
|
|
9990
9990
|
return null;
|
|
@@ -10023,7 +10023,7 @@ function readPendingRestart(dataDir) {
|
|
|
10023
10023
|
/** Remove the marker if present. No-op if missing. */
|
|
10024
10024
|
function clearPendingRestart(dataDir) {
|
|
10025
10025
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
10026
|
-
fs.rmSync(markerPath, { force: true });
|
|
10026
|
+
fs$1.rmSync(markerPath, { force: true });
|
|
10027
10027
|
}
|
|
10028
10028
|
function isRestartKind(value) {
|
|
10029
10029
|
return value === "framework-update" || value === "manual" || value === "system";
|
|
@@ -10035,7 +10035,7 @@ function scheduleSelfRestart(options = {}) {
|
|
|
10035
10035
|
const touchTarget = process.env["CAMSTACK_RESTART_TOUCH_FILE"];
|
|
10036
10036
|
if (touchTarget !== void 0 && touchTarget.length > 0) try {
|
|
10037
10037
|
const now = /* @__PURE__ */ new Date();
|
|
10038
|
-
fs.utimesSync(touchTarget, now, now);
|
|
10038
|
+
fs$1.utimesSync(touchTarget, now, now);
|
|
10039
10039
|
return;
|
|
10040
10040
|
} catch (err) {
|
|
10041
10041
|
console.error("[restart-coordinator] dev touch-reload failed; falling through to process exit:", err);
|
|
@@ -20543,7 +20543,7 @@ async function probeVaapiInit(renderNode) {
|
|
|
20543
20543
|
*/
|
|
20544
20544
|
function safeExistsSync(path) {
|
|
20545
20545
|
try {
|
|
20546
|
-
return fs.existsSync(path);
|
|
20546
|
+
return fs$1.existsSync(path);
|
|
20547
20547
|
} catch {
|
|
20548
20548
|
return false;
|
|
20549
20549
|
}
|
|
@@ -20562,11 +20562,11 @@ function probeLinuxGpus() {
|
|
|
20562
20562
|
if (safeExistsSync("/dev/nvidia0") || safeExistsSync("/proc/driver/nvidia/version")) signals.hasNvidiaGpu = true;
|
|
20563
20563
|
try {
|
|
20564
20564
|
const drmDir = "/sys/class/drm";
|
|
20565
|
-
if (fs.existsSync(drmDir)) for (const entry of fs.readdirSync(drmDir)) {
|
|
20565
|
+
if (fs$1.existsSync(drmDir)) for (const entry of fs$1.readdirSync(drmDir)) {
|
|
20566
20566
|
if (!entry.startsWith("card")) continue;
|
|
20567
20567
|
const vendorPath = `${drmDir}/${entry}/device/vendor`;
|
|
20568
20568
|
if (!safeExistsSync(vendorPath)) continue;
|
|
20569
|
-
const vendor = fs.readFileSync(vendorPath, "utf8").trim().toLowerCase();
|
|
20569
|
+
const vendor = fs$1.readFileSync(vendorPath, "utf8").trim().toLowerCase();
|
|
20570
20570
|
if (vendor === "0x10de") signals.hasNvidiaGpu = true;
|
|
20571
20571
|
else if (vendor === "0x1002") signals.hasAmdGpu = true;
|
|
20572
20572
|
else if (vendor === "0x8086") signals.hasIntelGpu = true;
|
|
@@ -20784,21 +20784,21 @@ function sleep$1(ms) {
|
|
|
20784
20784
|
* crashed holder) is stolen.
|
|
20785
20785
|
*/
|
|
20786
20786
|
async function withFileLock(lockPath, fn) {
|
|
20787
|
-
fs.mkdirSync(join(lockPath, ".."), { recursive: true });
|
|
20787
|
+
fs$1.mkdirSync(join(lockPath, ".."), { recursive: true });
|
|
20788
20788
|
for (;;) try {
|
|
20789
|
-
const fd = fs.openSync(lockPath, "wx");
|
|
20790
|
-
fs.closeSync(fd);
|
|
20789
|
+
const fd = fs$1.openSync(lockPath, "wx");
|
|
20790
|
+
fs$1.closeSync(fd);
|
|
20791
20791
|
break;
|
|
20792
20792
|
} catch {
|
|
20793
20793
|
try {
|
|
20794
|
-
if (Date.now() - fs.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs.rmSync(lockPath, { force: true });
|
|
20794
|
+
if (Date.now() - fs$1.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs$1.rmSync(lockPath, { force: true });
|
|
20795
20795
|
else await sleep$1(LOCK_POLL_MS);
|
|
20796
20796
|
} catch {}
|
|
20797
20797
|
}
|
|
20798
20798
|
try {
|
|
20799
20799
|
return await fn();
|
|
20800
20800
|
} finally {
|
|
20801
|
-
fs.rmSync(lockPath, { force: true });
|
|
20801
|
+
fs$1.rmSync(lockPath, { force: true });
|
|
20802
20802
|
}
|
|
20803
20803
|
}
|
|
20804
20804
|
/** Coalesce in-process + serialize cross-process for one binary id. */
|
|
@@ -20856,7 +20856,7 @@ var AddonDepsManager = class {
|
|
|
20856
20856
|
* failed or tampered download throws, and provisioning reports it.
|
|
20857
20857
|
*/
|
|
20858
20858
|
async stageNativeDepsDeclaredBy(requirementsFile) {
|
|
20859
|
-
if (!declaresEdgetpuDelegate(fs.readFileSync(requirementsFile, "utf8"))) return;
|
|
20859
|
+
if (!declaresEdgetpuDelegate(fs$1.readFileSync(requirementsFile, "utf8"))) return;
|
|
20860
20860
|
await singleFlight(this.depsDir, "edgetpu-delegate", () => ensureEdgetpuDelegate(this.nodeRoot, this.logger));
|
|
20861
20861
|
}
|
|
20862
20862
|
getDepsDir() {
|
|
@@ -21887,7 +21887,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
|
|
|
21887
21887
|
const addonId = declaration.id;
|
|
21888
21888
|
const nodeDataDir = process.env["CAMSTACK_DATA"] ?? dataDir;
|
|
21889
21889
|
const addonDataDir = path$1.resolve(nodeDataDir, "addons-data", addonId);
|
|
21890
|
-
fs.mkdirSync(addonDataDir, { recursive: true });
|
|
21890
|
+
fs$1.mkdirSync(addonDataDir, { recursive: true });
|
|
21891
21891
|
if (runtime.mode === "broker") ensureBindingSubscription(runtime.broker);
|
|
21892
21892
|
const regs = getRegistries(nodeId);
|
|
21893
21893
|
const workerResolver = {
|
|
@@ -23837,7 +23837,7 @@ var FailedRunnerRetryLedger = class {
|
|
|
23837
23837
|
function readRunnerPackageVersions(addonDirs) {
|
|
23838
23838
|
const out = {};
|
|
23839
23839
|
for (const dir of addonDirs) try {
|
|
23840
|
-
const raw = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
23840
|
+
const raw = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
23841
23841
|
const version = typeof raw === "object" && raw !== null ? Reflect.get(raw, "version") : null;
|
|
23842
23842
|
out[dir] = typeof version === "string" && version.length > 0 ? version : null;
|
|
23843
23843
|
} catch {
|
|
@@ -23898,7 +23898,7 @@ function readAddonHeapDeclaration(spec) {
|
|
|
23898
23898
|
if (cached !== void 0) return cached;
|
|
23899
23899
|
let declaration = EMPTY_HEAP_DECLARATION;
|
|
23900
23900
|
for (const manifestPath of [path$1.join(spec.addonDir, "package.json"), path$1.join(path$1.dirname(spec.addonDir), "package.json")]) try {
|
|
23901
|
-
const raw = fs.readFileSync(manifestPath, "utf8");
|
|
23901
|
+
const raw = fs$1.readFileSync(manifestPath, "utf8");
|
|
23902
23902
|
const parsed = JSON.parse(raw);
|
|
23903
23903
|
const profile = extractHeapProfile(parsed, spec.addonId);
|
|
23904
23904
|
const maxOldSpaceMb = extractMaxOldSpaceMb(parsed, spec.addonId);
|
|
@@ -25131,17 +25131,17 @@ var JobJournal = class {
|
|
|
25131
25131
|
return path$1.join(this.jobsDir, `${id}.json`);
|
|
25132
25132
|
}
|
|
25133
25133
|
writeAtomic(filePath, data) {
|
|
25134
|
-
fs.mkdirSync(path$1.dirname(filePath), { recursive: true });
|
|
25134
|
+
fs$1.mkdirSync(path$1.dirname(filePath), { recursive: true });
|
|
25135
25135
|
const tmp = `${filePath}.tmp.${process.pid}.${Date.now()}`;
|
|
25136
|
-
fs.writeFileSync(tmp, JSON.stringify(data, null, 2), {
|
|
25136
|
+
fs$1.writeFileSync(tmp, JSON.stringify(data, null, 2), {
|
|
25137
25137
|
encoding: "utf-8",
|
|
25138
25138
|
mode: 384
|
|
25139
25139
|
});
|
|
25140
|
-
fs.renameSync(tmp, filePath);
|
|
25140
|
+
fs$1.renameSync(tmp, filePath);
|
|
25141
25141
|
}
|
|
25142
25142
|
readIndex() {
|
|
25143
25143
|
try {
|
|
25144
|
-
const raw = JSON.parse(fs.readFileSync(this.indexPath, "utf-8"));
|
|
25144
|
+
const raw = JSON.parse(fs$1.readFileSync(this.indexPath, "utf-8"));
|
|
25145
25145
|
if (raw && Array.isArray(raw.jobIds)) return {
|
|
25146
25146
|
version: 1,
|
|
25147
25147
|
jobIds: raw.jobIds
|
|
@@ -25166,7 +25166,7 @@ var JobJournal = class {
|
|
|
25166
25166
|
}
|
|
25167
25167
|
getJob(id) {
|
|
25168
25168
|
try {
|
|
25169
|
-
const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs.readFileSync(this.jobPath(id), "utf-8")));
|
|
25169
|
+
const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs$1.readFileSync(this.jobPath(id), "utf-8")));
|
|
25170
25170
|
return parsed.success ? parsed.data : null;
|
|
25171
25171
|
} catch {
|
|
25172
25172
|
return null;
|
|
@@ -25231,14 +25231,14 @@ var StagingArea = class {
|
|
|
25231
25231
|
}
|
|
25232
25232
|
async fetchAndStage(input) {
|
|
25233
25233
|
const destDir = path$1.join(this.stagingDir, input.jobId, safeSegment(input.name));
|
|
25234
|
-
fs.rmSync(destDir, {
|
|
25234
|
+
fs$1.rmSync(destDir, {
|
|
25235
25235
|
recursive: true,
|
|
25236
25236
|
force: true
|
|
25237
25237
|
});
|
|
25238
25238
|
const tgz = await this.deps.fetchTarball(input.name, input.version, input.signal);
|
|
25239
25239
|
if (input.signal.aborted) throw new Error("staging aborted after fetch");
|
|
25240
25240
|
await this.deps.extract(tgz, destDir);
|
|
25241
|
-
const raw = JSON.parse(fs.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
|
|
25241
|
+
const raw = JSON.parse(fs$1.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
|
|
25242
25242
|
if (typeof raw.version !== "string" || raw.version.length === 0) throw new Error(`staging validation failed: ${input.name} staged a package.json with no version`);
|
|
25243
25243
|
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}`);
|
|
25244
25244
|
return {
|
|
@@ -25247,7 +25247,7 @@ var StagingArea = class {
|
|
|
25247
25247
|
};
|
|
25248
25248
|
}
|
|
25249
25249
|
cleanup(jobId) {
|
|
25250
|
-
fs.rmSync(path$1.join(this.stagingDir, jobId), {
|
|
25250
|
+
fs$1.rmSync(path$1.join(this.stagingDir, jobId), {
|
|
25251
25251
|
recursive: true,
|
|
25252
25252
|
force: true
|
|
25253
25253
|
});
|
|
@@ -25262,13 +25262,13 @@ var StagingArea = class {
|
|
|
25262
25262
|
sweepOrphans() {
|
|
25263
25263
|
let entries;
|
|
25264
25264
|
try {
|
|
25265
|
-
entries = fs.readdirSync(this.stagingDir);
|
|
25265
|
+
entries = fs$1.readdirSync(this.stagingDir);
|
|
25266
25266
|
} catch {
|
|
25267
25267
|
return 0;
|
|
25268
25268
|
}
|
|
25269
25269
|
let removed = 0;
|
|
25270
25270
|
for (const name of entries) try {
|
|
25271
|
-
fs.rmSync(path$1.join(this.stagingDir, name), {
|
|
25271
|
+
fs$1.rmSync(path$1.join(this.stagingDir, name), {
|
|
25272
25272
|
recursive: true,
|
|
25273
25273
|
force: true
|
|
25274
25274
|
});
|
|
@@ -25446,7 +25446,7 @@ var LifecycleJobEngine = class {
|
|
|
25446
25446
|
* on failure → `failed`.
|
|
25447
25447
|
*/
|
|
25448
25448
|
async reconcileJob(job) {
|
|
25449
|
-
const exists = this.deps.stagedPathExists ?? ((p) => fs.existsSync(p));
|
|
25449
|
+
const exists = this.deps.stagedPathExists ?? ((p) => fs$1.existsSync(p));
|
|
25450
25450
|
for (const task of job.tasks) {
|
|
25451
25451
|
if (task.target === "framework") {
|
|
25452
25452
|
if (!this.isTerminal(task.phase)) this.skipFrameworkTask(job, task);
|
|
@@ -26103,7 +26103,7 @@ var CatalogRegistry = class {
|
|
|
26103
26103
|
const file = path$1.join(packageDir, "i18n", `${lang}.json`);
|
|
26104
26104
|
let text;
|
|
26105
26105
|
try {
|
|
26106
|
-
text = fs.readFileSync(file, "utf8");
|
|
26106
|
+
text = fs$1.readFileSync(file, "utf8");
|
|
26107
26107
|
} catch {
|
|
26108
26108
|
continue;
|
|
26109
26109
|
}
|