@camstack/server 1.2.832 → 1.2.834
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/dist/api/trpc/cap-router-runtime.js +16 -1
- package/dist/api/trpc/generated-cap-mounts.js +1 -2
- package/dist/api/trpc/generated-cap-routers.js +2132 -2183
- package/dist/core/addon/instance-lifecycle.js +21 -3
- 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/capture/device-directory.d.ts +1 -1
- 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-D8AiIjQC.mjs → capture-engine-BQjIa865.mjs} +3 -3
- package/system/dist/{capture-engine-CAXBK7ww.js → capture-engine-Bgml6l8Z.js} +3 -3
- package/system/dist/{composition-sources-BunkRPGS.js → composition-sources-C7hUy8w0.js} +1 -1
- package/system/dist/{composition-sources-UhXWDHi8.mjs → composition-sources-CrL4KcSA.mjs} +1 -1
- package/system/dist/{constants-C0KB1WOf.mjs → constants-Bw5qtfbX.mjs} +1 -1
- package/system/dist/{constants-B5QCyskv.js → constants-CUAo3cLm.js} +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-I_cMOy9W.mjs → device-ca-BDmoMgA3.mjs} +1 -1
- package/system/dist/{device-ca-DJNiUFgb.js → device-ca-YELIR9gF.js} +1 -1
- package/system/dist/{dist-BObCeiJC.js → dist-D3_60xED.js} +48 -232
- package/system/dist/{dist-BkjJt6LD.mjs → dist-yQfQUpYA.mjs} +48 -232
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-identity-Db2RwtZ2.mjs → hub-identity-C8FGw7Mt.mjs} +10 -10
- package/system/dist/{hub-identity-QhEXr2sn.js → hub-identity-c_zPVKOY.js} +1 -1
- package/system/dist/{hub-mdns-ciao-DJYolZOM.mjs → hub-mdns-ciao-CM64AtFQ.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-L9Qt3eVs.js → hub-mdns-ciao-CaWa1FY1.js} +2 -2
- package/system/dist/index.js +12 -10
- package/system/dist/index.mjs +223 -221
- package/system/dist/{legacy-integration-rows-door-4SwHHOO6.js → legacy-integration-rows-door-BnEJMuwz.js} +1 -1
- package/system/dist/{legacy-integration-rows-door-tl15MjSN.mjs → legacy-integration-rows-door-D5Qe0A95.mjs} +1 -1
- package/system/dist/{rename-composition-block-BRlgC6CC.js → rename-composition-block-CbAR4yC9.js} +1 -1
- package/system/dist/{rename-composition-block-DunKva8Y.mjs → rename-composition-block-DXN1dVXs.mjs} +1 -1
- package/system/dist/{restore-archive-WeQO8IMV.mjs → restore-archive-C88Ee7w9.mjs} +94 -94
- package/system/dist/{restore-archive-DDeWKKhR.js → restore-archive-DDzgcjNf.js} +1 -1
- package/system/dist/{wal-maintenance-CXx0PMNE.js → wal-maintenance-BNN52u-q.js} +0 -0
- package/system/dist/{wal-maintenance-7Zug5GTs.mjs → wal-maintenance-EvgkvDZK.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 { Di as looseSchema, Dt as METHOD_ACCESS_MAP, Ei as logLevelAtMost, Et as LOG_LEVEL_RANK, Fs as ReadinessRegistry, Gc as readinessKey, Gi as objectInputDeclaresAddonId, Ha as scopesAllowDeviceCap, Hc as parseJsonObject, Is as ReadinessTimeoutError, Ki as objectInputDeclaresRequiredDeviceId, Lr as extractNestedAddonId, O as CatalogFileSchema, Ps as RUNTIME_DEFAULTS, Qs as asString$1, Rt as PackageRequiresSchema, Tc as isDebugChannelName, Uc as parseJsonUnknown, Va as scopesAllowAddon, Xc as scopeKey, Xn as compareVersions, Xs as asJsonObject$1, Zs as asNumber, _s as DEVICE_SETTINGS_CONTRIBUTION_METHODS, a as AGENT_MDNS_SERVICE_TYPE, ac as collectSecretMarkerRefs, ai as isCollectionArrayMethod, bc as getDebugInterest, bn as addonSettingsCapability, di as isObjectInput, dl as errMsg$1, ei as interpolate, eo as splitTranslationRef, gs as DATAPLANE_SECRET_HEADER$1, hc as emitDownForOwnedCaps, hs as CALLER_STAMPED_CAPABILITIES$1, ii as isArrayOutputSchema, il as userError, ka as resolveMethodAuth, kn as bareAddonId, lc as createEvent$1, lo as supportedRuntimes, mc as defineRecordKinds, mi as kebabToCamel$1, o as AGENT_MDNS_TXT_KEYS, ol as withoutCallerStamp, pi as isVoidInput, pl as EventCategory$1, qc as resolveCapMount, s as ALL_CAPABILITY_DEFINITIONS, sa as procedureAuthKey, vc as expandCapMethods, vr as describeUnmet, vs as DEVICE_STATUS_METHOD, x as CATALOG_LANGS, yi as lifecycleJobSchema, yo as unmetRequirements } 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 { Di as looseSchema, Dt as METHOD_ACCESS_MAP, Ei as logLevelAtMost, Et as LOG_LEVEL_RANK, Fs as ReadinessRegistry, Gc as readinessKey, Gi as objectInputDeclaresAddonId, Ha as scopesAllowDeviceCap, Hc as parseJsonObject, Is as ReadinessTimeoutError, Ki as objectInputDeclaresRequiredDeviceId, Lr as extractNestedAddonId, O as CatalogFileSchema, Ps as RUNTIME_DEFAULTS, Qs as asString$1, Rt as PackageRequiresSchema, Tc as isDebugChannelName, Uc as parseJsonUnknown, Va as scopesAllowAddon, Xc as scopeKey, Xn as compareVersions, Xs as asJsonObject$1, Zs as asNumber, _s as DEVICE_SETTINGS_CONTRIBUTION_METHODS, a as AGENT_MDNS_SERVICE_TYPE, ac as collectSecretMarkerRefs, ai as isCollectionArrayMethod, bc as getDebugInterest, bn as addonSettingsCapability, di as isObjectInput, dl as errMsg$1, ei as interpolate, eo as splitTranslationRef, gs as DATAPLANE_SECRET_HEADER$1, hc as emitDownForOwnedCaps, hs as CALLER_STAMPED_CAPABILITIES$1, ii as isArrayOutputSchema, il as userError, ka as resolveMethodAuth, kn as bareAddonId, lc as createEvent$1, lo as supportedRuntimes, mc as defineRecordKinds, mi as kebabToCamel$1, o as AGENT_MDNS_TXT_KEYS, ol as withoutCallerStamp, pi as isVoidInput, pl as EventCategory$1, qc as resolveCapMount, s as ALL_CAPABILITY_DEFINITIONS, sa as procedureAuthKey, vc as expandCapMethods, vr as describeUnmet, vs as DEVICE_STATUS_METHOD, x as CATALOG_LANGS, yi as lifecycleJobSchema, yo as unmetRequirements } from "./dist-yQfQUpYA.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-BDmoMgA3.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-EvgkvDZK.mjs";
|
|
31
|
+
import { n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows } from "./legacy-integration-rows-door-D5Qe0A95.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-C8FGw7Mt.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-Bw5qtfbX.mjs";
|
|
38
38
|
import { $ as caFingerprint, A as emitProcessNodeRegistered, B as setProcessMeshTlsListenerState, C as verifyMembershipAnswer, Ct as parseOriginList, D as ServiceBroker, Dt as parseCidrList, E as Errors, Et as normalizeIp, F as setProcessMeshPeerTransportLookup, G as describeMeshLeaf, H as MESH_NODE_CERTIFICATES_COLUMNS, I as renewMeshCertificate, J as MeshCrl, K as getProcessMeshCertificateRegistry, L as revokeMeshCertificate, M as getProcessPeerLeaf, N as isProcessVerifiedMeshPeer, O as setProcessMeshTlsEnabler, Ot as readCidrSetting, P as onProcessNodeRegistered, Q as requireProcessMeshCa, R as getProcessMeshTlsListenerState, S as signMembershipProof, St as normalizeOrigin, SystemConfigAddon, T as TlsTcpTransporter, Tt as createCidrMatcher, U as MeshCertificateRegistry, V as MESH_NODE_CERTIFICATES_COLLECTION, W as RENEWAL_ABANDONED, X as MeshCaKeeper, Y as processMeshCrl, Z as getProcessMeshCaState, _ as keyFingerprintShort, _t as parseAgentDashboardOrigins, a as dialableHubHost, at as isValidAgentNodeId, b as MEMBERSHIP_PATHS, bt as OPAQUE_ORIGIN, c as PAIRING_MAX_CODE_ATTEMPTS, ct as loadMeshCa, d as PAIRING_PIN_DIGITS, dt as AGENT_UI_UNLOCK_TYP, et as caFingerprintCompact, f as PAIRING_PROTOCOL, ft as AGENT_UI_UNLOCK_USE, g as describeCsr, gt as mintAgentUiUnlockTicket, h as computePairingSas, ht as isAllowedAgentDashboardReturnTo, i as AgentPairing, it as generateMeshKeyPair, j as getProcessNodeMeshTransport, k as dropProcessPeer, l as PAIRING_MAX_SESSIONS, lt as AGENT_DASHBOARD_ORIGINS_FIELD, m as computePairingCommitment, mt as UnlockTicketJtiStore, n as HubPairing, nt as exportMeshPrivateKeyPem, o as hubHostFromMeshAddress, ot as issueMeshLeafForNode, p as PAIRING_TTL_MS, pt as AGENT_UI_UNLOCK_VERSION, q as setProcessMeshCertificateRegistry, r as PairingHttpError, rt as generateMeshCa, s as PAIRING_CODE_DIGITS, st as issueMeshLeafFromCsr, tt as createMeshCsrPem, u as PAIRING_PATHS, ut as AGENT_UI_UNLOCK_TTL_MS, v as signPairingProof, vt as verifyAgentUiUnlockTicket, w as MESH_TLS_PORT_HELLO_FIELD, wt as readOriginSetting, x as MembershipResponder, xt as isInsecureOrigin, y as verifyPairingProof, yt as InvalidCorsOriginError, z as openMeshTlsWhenRevocationsLoaded } 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-CM64AtFQ.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-C88Ee7w9.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";
|
|
@@ -5022,7 +5022,7 @@ var PythonEnvManager = class {
|
|
|
5022
5022
|
async ensure(options) {
|
|
5023
5023
|
const probe = await this.probe();
|
|
5024
5024
|
if (!probe.available || !probe.path) throw userError("system.python-required", void 0, "Python 3.10+ is required but not found on this system");
|
|
5025
|
-
if (!fs.existsSync(path$1.join(this.venvPath, "bin", "python"))) await execFileAsync$7(probe.path, [
|
|
5025
|
+
if (!fs$1.existsSync(path$1.join(this.venvPath, "bin", "python"))) await execFileAsync$7(probe.path, [
|
|
5026
5026
|
"-m",
|
|
5027
5027
|
"venv",
|
|
5028
5028
|
this.venvPath
|
|
@@ -5045,7 +5045,7 @@ var PythonEnvManager = class {
|
|
|
5045
5045
|
}
|
|
5046
5046
|
spawn(script, args) {
|
|
5047
5047
|
const venvPython = path$1.join(this.venvPath, "bin", "python");
|
|
5048
|
-
if (!fs.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
|
|
5048
|
+
if (!fs$1.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
|
|
5049
5049
|
return spawn(venvPython, [script, ...args]);
|
|
5050
5050
|
}
|
|
5051
5051
|
};
|
|
@@ -5397,20 +5397,20 @@ var StorageManager = class {
|
|
|
5397
5397
|
const basePath = this.locationManager.getBackend(mappedName).basePath;
|
|
5398
5398
|
location.files = {
|
|
5399
5399
|
async readFile(p) {
|
|
5400
|
-
return fs.promises.readFile(path$1.join(basePath, p));
|
|
5400
|
+
return fs$1.promises.readFile(path$1.join(basePath, p));
|
|
5401
5401
|
},
|
|
5402
5402
|
async writeFile(p, data) {
|
|
5403
5403
|
const full = path$1.join(basePath, p);
|
|
5404
|
-
await fs.promises.mkdir(path$1.dirname(full), { recursive: true });
|
|
5405
|
-
await fs.promises.writeFile(full, data);
|
|
5404
|
+
await fs$1.promises.mkdir(path$1.dirname(full), { recursive: true });
|
|
5405
|
+
await fs$1.promises.writeFile(full, data);
|
|
5406
5406
|
},
|
|
5407
5407
|
async deleteFile(p) {
|
|
5408
|
-
await fs.promises.rm(path$1.join(basePath, p), { force: true });
|
|
5408
|
+
await fs$1.promises.rm(path$1.join(basePath, p), { force: true });
|
|
5409
5409
|
},
|
|
5410
5410
|
async listFiles(prefix) {
|
|
5411
5411
|
const dir = prefix ? path$1.join(basePath, prefix) : basePath;
|
|
5412
5412
|
try {
|
|
5413
|
-
return (await fs.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
|
|
5413
|
+
return (await fs$1.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
|
|
5414
5414
|
} catch {
|
|
5415
5415
|
return [];
|
|
5416
5416
|
}
|
|
@@ -5420,7 +5420,7 @@ var StorageManager = class {
|
|
|
5420
5420
|
},
|
|
5421
5421
|
async exists(p) {
|
|
5422
5422
|
try {
|
|
5423
|
-
await fs.promises.access(path$1.join(basePath, p));
|
|
5423
|
+
await fs$1.promises.access(path$1.join(basePath, p));
|
|
5424
5424
|
return true;
|
|
5425
5425
|
} catch {
|
|
5426
5426
|
return false;
|
|
@@ -5870,7 +5870,7 @@ var TRADITIONAL_NATIVE_PACKAGES = ["better-sqlite3"];
|
|
|
5870
5870
|
function hasDotNode(dir, maxDepth) {
|
|
5871
5871
|
let entries;
|
|
5872
5872
|
try {
|
|
5873
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
5873
|
+
entries = fs$1.readdirSync(dir, { withFileTypes: true });
|
|
5874
5874
|
} catch {
|
|
5875
5875
|
return false;
|
|
5876
5876
|
}
|
|
@@ -5881,7 +5881,7 @@ function hasDotNode(dir, maxDepth) {
|
|
|
5881
5881
|
}
|
|
5882
5882
|
/** Locate the bundled `prebuild-install` bin.js inside the staged closure. */
|
|
5883
5883
|
function resolvePrebuildInstallBin(closureDir, moduleDir) {
|
|
5884
|
-
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;
|
|
5884
|
+
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;
|
|
5885
5885
|
}
|
|
5886
5886
|
/**
|
|
5887
5887
|
* Default fetcher: run the closure's own `prebuild-install` under the CURRENT
|
|
@@ -5934,7 +5934,7 @@ async function ensureNativePrebuilds(closureDir, options) {
|
|
|
5934
5934
|
const fetched = [];
|
|
5935
5935
|
for (const pkg of packages) {
|
|
5936
5936
|
const moduleDir = path$1.join(nm, pkg);
|
|
5937
|
-
if (!fs.existsSync(moduleDir)) continue;
|
|
5937
|
+
if (!fs$1.existsSync(moduleDir)) continue;
|
|
5938
5938
|
if (hasDotNode(moduleDir, 4)) continue;
|
|
5939
5939
|
options.logger.warn("staged closure native prebuild missing — fetching for running ABI", { meta: {
|
|
5940
5940
|
pkg,
|
|
@@ -5997,12 +5997,12 @@ async function ensureNativePrebuilds(closureDir, options) {
|
|
|
5997
5997
|
function replantFromBundled(srcModuleDir, dstModuleDir, hasNative) {
|
|
5998
5998
|
if (!hasNative(srcModuleDir)) return false;
|
|
5999
5999
|
try {
|
|
6000
|
-
fs.rmSync(dstModuleDir, {
|
|
6000
|
+
fs$1.rmSync(dstModuleDir, {
|
|
6001
6001
|
recursive: true,
|
|
6002
6002
|
force: true
|
|
6003
6003
|
});
|
|
6004
|
-
fs.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
|
|
6005
|
-
fs.cpSync(srcModuleDir, dstModuleDir, {
|
|
6004
|
+
fs$1.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
|
|
6005
|
+
fs$1.cpSync(srcModuleDir, dstModuleDir, {
|
|
6006
6006
|
recursive: true,
|
|
6007
6007
|
dereference: true
|
|
6008
6008
|
});
|
|
@@ -6031,7 +6031,7 @@ async function ensureAddonNativePrebuilds(addonDir, options) {
|
|
|
6031
6031
|
const missing = [];
|
|
6032
6032
|
for (const pkg of packages) {
|
|
6033
6033
|
const moduleDir = path$1.join(nm, pkg);
|
|
6034
|
-
if (!fs.existsSync(moduleDir)) continue;
|
|
6034
|
+
if (!fs$1.existsSync(moduleDir)) continue;
|
|
6035
6035
|
if (hasNative(moduleDir)) {
|
|
6036
6036
|
results.push({
|
|
6037
6037
|
pkg,
|
|
@@ -6130,7 +6130,7 @@ async function defaultDownloadTarball(url, destTgz) {
|
|
|
6130
6130
|
const res = await fetch(url);
|
|
6131
6131
|
if (!res.ok || !res.body) throw new Error(`HTTP ${res.status} downloading ${url}`);
|
|
6132
6132
|
const bytes = Buffer.from(await res.arrayBuffer());
|
|
6133
|
-
await fs.promises.writeFile(destTgz, bytes);
|
|
6133
|
+
await fs$1.promises.writeFile(destTgz, bytes);
|
|
6134
6134
|
}
|
|
6135
6135
|
async function defaultExtractTarball(tgzPath, destDir) {
|
|
6136
6136
|
await execFileAsync$5("tar", [
|
|
@@ -6216,7 +6216,7 @@ async function resolveUncached(options) {
|
|
|
6216
6216
|
argsPrefix: []
|
|
6217
6217
|
};
|
|
6218
6218
|
const cliPath = bootstrappedCliPath(options.cacheDir);
|
|
6219
|
-
if (fs.existsSync(cliPath)) {
|
|
6219
|
+
if (fs$1.existsSync(cliPath)) {
|
|
6220
6220
|
options.logger.info("system npm unavailable — using bootstrapped npm", { meta: { cliPath } });
|
|
6221
6221
|
return {
|
|
6222
6222
|
command: process.execPath,
|
|
@@ -6228,12 +6228,12 @@ async function resolveUncached(options) {
|
|
|
6228
6228
|
const registry = (options.registry ?? DEFAULT_REGISTRY$1).replace(/\/+$/, "");
|
|
6229
6229
|
const tarballUrl = tarballUrlOf(await (options.fetchJson ?? defaultFetchJson)(`${registry}/npm/latest`));
|
|
6230
6230
|
if (!tarballUrl) throw new Error(`registry metadata for 'npm' carries no dist.tarball (${registry})`);
|
|
6231
|
-
await fs.promises.mkdir(options.cacheDir, { recursive: true });
|
|
6231
|
+
await fs$1.promises.mkdir(options.cacheDir, { recursive: true });
|
|
6232
6232
|
const tgzPath = path$1.join(options.cacheDir, "npm-bootstrap.tgz");
|
|
6233
6233
|
await (options.downloadTarball ?? defaultDownloadTarball)(tarballUrl, tgzPath);
|
|
6234
6234
|
await (options.extractTarball ?? defaultExtractTarball)(tgzPath, options.cacheDir);
|
|
6235
|
-
await fs.promises.rm(tgzPath, { force: true });
|
|
6236
|
-
if (!fs.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
|
|
6235
|
+
await fs$1.promises.rm(tgzPath, { force: true });
|
|
6236
|
+
if (!fs$1.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
|
|
6237
6237
|
options.logger.info("npm bootstrapped", { meta: { cliPath } });
|
|
6238
6238
|
return {
|
|
6239
6239
|
command: process.execPath,
|
|
@@ -6299,7 +6299,7 @@ function readOwningPackageVersion(entryPath) {
|
|
|
6299
6299
|
let dir = path$1.dirname(entryPath);
|
|
6300
6300
|
for (let hop = 0; hop < PACKAGE_JSON_LOOKUP_DEPTH; hop++) {
|
|
6301
6301
|
try {
|
|
6302
|
-
const version = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
|
|
6302
|
+
const version = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
|
|
6303
6303
|
if (typeof version === "string" && version.length > 0) return version;
|
|
6304
6304
|
} catch {}
|
|
6305
6305
|
const parent = path$1.dirname(dir);
|
|
@@ -6343,14 +6343,14 @@ function readOwningPackageVersion(entryPath) {
|
|
|
6343
6343
|
function addonModuleCacheKey(entryPath) {
|
|
6344
6344
|
let stat;
|
|
6345
6345
|
try {
|
|
6346
|
-
stat = fs.statSync(entryPath);
|
|
6346
|
+
stat = fs$1.statSync(entryPath);
|
|
6347
6347
|
} catch {
|
|
6348
6348
|
return null;
|
|
6349
6349
|
}
|
|
6350
6350
|
const version = readOwningPackageVersion(entryPath) ?? `m${stat.mtimeMs}`;
|
|
6351
6351
|
let content;
|
|
6352
6352
|
try {
|
|
6353
|
-
content = createHash("sha1").update(fs.readFileSync(entryPath)).digest("hex").slice(0, 16);
|
|
6353
|
+
content = createHash("sha1").update(fs$1.readFileSync(entryPath)).digest("hex").slice(0, 16);
|
|
6354
6354
|
} catch {
|
|
6355
6355
|
content = `m${stat.mtimeMs}s${stat.size}`;
|
|
6356
6356
|
}
|
|
@@ -6454,14 +6454,14 @@ var AddonLoader = class {
|
|
|
6454
6454
|
* BUILTINS from the active closure, not the (now-inert) addons-dir copy, so
|
|
6455
6455
|
* the addons-dir `@camstack/server/system` must NOT be double-loaded here. */
|
|
6456
6456
|
async loadFromDirectory(addonsDir, skipPackages = []) {
|
|
6457
|
-
if (!fs.existsSync(addonsDir)) return;
|
|
6457
|
+
if (!fs$1.existsSync(addonsDir)) return;
|
|
6458
6458
|
const skip = new Set(skipPackages);
|
|
6459
|
-
const entries = fs.readdirSync(addonsDir, { withFileTypes: true });
|
|
6459
|
+
const entries = fs$1.readdirSync(addonsDir, { withFileTypes: true });
|
|
6460
6460
|
for (const entry of entries) {
|
|
6461
6461
|
if (!isDirectoryEntry(entry, addonsDir)) continue;
|
|
6462
6462
|
if (entry.name.startsWith("@")) {
|
|
6463
6463
|
const scopeDir = path$1.join(addonsDir, entry.name);
|
|
6464
|
-
const scopeEntries = fs.readdirSync(scopeDir, { withFileTypes: true });
|
|
6464
|
+
const scopeEntries = fs$1.readdirSync(scopeDir, { withFileTypes: true });
|
|
6465
6465
|
for (const scopeEntry of scopeEntries) {
|
|
6466
6466
|
if (!isDirectoryEntry(scopeEntry, scopeDir)) continue;
|
|
6467
6467
|
if (skip.has(`${entry.name}/${scopeEntry.name}`)) continue;
|
|
@@ -6475,7 +6475,7 @@ var AddonLoader = class {
|
|
|
6475
6475
|
}
|
|
6476
6476
|
async tryLoadAddon(addonDir) {
|
|
6477
6477
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
6478
|
-
if (!fs.existsSync(pkgJsonPath)) return;
|
|
6478
|
+
if (!fs$1.existsSync(pkgJsonPath)) return;
|
|
6479
6479
|
try {
|
|
6480
6480
|
await this.loadFromAddonDir(addonDir);
|
|
6481
6481
|
} catch (err) {
|
|
@@ -6493,7 +6493,7 @@ var AddonLoader = class {
|
|
|
6493
6493
|
/** Load addon from a specific directory (package.json + dist/) */
|
|
6494
6494
|
async loadFromAddonDir(addonDir) {
|
|
6495
6495
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
6496
|
-
const pkgJson = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
6496
|
+
const pkgJson = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
6497
6497
|
const packageNameRaw = pkgJson["name"];
|
|
6498
6498
|
const packageName = typeof packageNameRaw === "string" ? packageNameRaw : "";
|
|
6499
6499
|
const packageVersionRaw = pkgJson["version"];
|
|
@@ -6541,7 +6541,7 @@ var AddonLoader = class {
|
|
|
6541
6541
|
}
|
|
6542
6542
|
const entryFile = declaration.entry.replace(/^\.\//, "").replace(/^src\//, "dist/").replace(/\.ts$/, ".js");
|
|
6543
6543
|
let entryPath = path$1.resolve(addonDir, entryFile);
|
|
6544
|
-
if (!fs.existsSync(entryPath)) {
|
|
6544
|
+
if (!fs$1.existsSync(entryPath)) {
|
|
6545
6545
|
const base = entryPath.replace(/\.(js|cjs|mjs)$/, "");
|
|
6546
6546
|
entryPath = [
|
|
6547
6547
|
`${base}.cjs`,
|
|
@@ -6550,9 +6550,9 @@ var AddonLoader = class {
|
|
|
6550
6550
|
path$1.resolve(addonDir, "dist", "index.cjs"),
|
|
6551
6551
|
path$1.resolve(addonDir, "dist", "index.mjs"),
|
|
6552
6552
|
path$1.resolve(addonDir, declaration.entry)
|
|
6553
|
-
].find((p) => fs.existsSync(p)) ?? entryPath;
|
|
6553
|
+
].find((p) => fs$1.existsSync(p)) ?? entryPath;
|
|
6554
6554
|
}
|
|
6555
|
-
if (!fs.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
|
|
6555
|
+
if (!fs$1.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
|
|
6556
6556
|
const modUnknown = await importAddonModuleFresh(entryPath);
|
|
6557
6557
|
const mod = isRecord$5(modUnknown) ? modUnknown : {};
|
|
6558
6558
|
const AddonClass = resolveAddonClass(mod);
|
|
@@ -6664,7 +6664,7 @@ function isDirectoryEntry(entry, parentDir) {
|
|
|
6664
6664
|
if (entry.name.startsWith(".")) return false;
|
|
6665
6665
|
if (entry.isDirectory()) return true;
|
|
6666
6666
|
if (entry.isSymbolicLink()) try {
|
|
6667
|
-
return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
6667
|
+
return fs$1.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
6668
6668
|
} catch {
|
|
6669
6669
|
return false;
|
|
6670
6670
|
}
|
|
@@ -6758,7 +6758,7 @@ var execFileAsync$4 = promisify(execFile);
|
|
|
6758
6758
|
* Single source of truth — replaces scattered mkdirSync calls.
|
|
6759
6759
|
*/
|
|
6760
6760
|
function ensureDir(dirPath) {
|
|
6761
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
|
6761
|
+
fs$1.mkdirSync(dirPath, { recursive: true });
|
|
6762
6762
|
}
|
|
6763
6763
|
/**
|
|
6764
6764
|
* Copy a directory recursively — ASYNC so it never blocks the event loop.
|
|
@@ -6771,7 +6771,7 @@ function ensureDir(dirPath) {
|
|
|
6771
6771
|
* `fs.promises.cp` keeps the I/O off the event loop. (Node ≥18 stable.)
|
|
6772
6772
|
*/
|
|
6773
6773
|
async function copyDirRecursive(src, dest) {
|
|
6774
|
-
await fs.promises.cp(src, dest, {
|
|
6774
|
+
await fs$1.promises.cp(src, dest, {
|
|
6775
6775
|
recursive: true,
|
|
6776
6776
|
force: true
|
|
6777
6777
|
});
|
|
@@ -6876,13 +6876,13 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
6876
6876
|
if (typeof fileEntry !== "string") continue;
|
|
6877
6877
|
if (fileEntry === "dist" || fileEntry.includes("*")) continue;
|
|
6878
6878
|
const srcPath = path$1.join(sourceDir, fileEntry);
|
|
6879
|
-
if (!fs.existsSync(srcPath)) continue;
|
|
6879
|
+
if (!fs$1.existsSync(srcPath)) continue;
|
|
6880
6880
|
const destPath = path$1.join(destDir, fileEntry);
|
|
6881
|
-
const stat = await fs.promises.stat(srcPath);
|
|
6881
|
+
const stat = await fs$1.promises.stat(srcPath);
|
|
6882
6882
|
if (stat.isDirectory()) await copyDirRecursive(srcPath, destPath);
|
|
6883
6883
|
else if (stat.isFile()) {
|
|
6884
6884
|
ensureDir(path$1.dirname(destPath));
|
|
6885
|
-
await fs.promises.copyFile(srcPath, destPath);
|
|
6885
|
+
await fs$1.promises.copyFile(srcPath, destPath);
|
|
6886
6886
|
}
|
|
6887
6887
|
}
|
|
6888
6888
|
}
|
|
@@ -6893,10 +6893,10 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
6893
6893
|
function isSourceNewer(packageDir) {
|
|
6894
6894
|
const srcDir = path$1.join(packageDir, "src");
|
|
6895
6895
|
const distDir = path$1.join(packageDir, "dist");
|
|
6896
|
-
if (!fs.existsSync(srcDir) || !fs.existsSync(distDir)) return true;
|
|
6896
|
+
if (!fs$1.existsSync(srcDir) || !fs$1.existsSync(distDir)) return true;
|
|
6897
6897
|
try {
|
|
6898
|
-
const distMtime = fs.statSync(distDir).mtimeMs;
|
|
6899
|
-
const entries = fs.readdirSync(srcDir, {
|
|
6898
|
+
const distMtime = fs$1.statSync(distDir).mtimeMs;
|
|
6899
|
+
const entries = fs$1.readdirSync(srcDir, {
|
|
6900
6900
|
withFileTypes: true,
|
|
6901
6901
|
recursive: true
|
|
6902
6902
|
});
|
|
@@ -6904,7 +6904,7 @@ function isSourceNewer(packageDir) {
|
|
|
6904
6904
|
if (!entry.isFile()) continue;
|
|
6905
6905
|
const parentDir = entry.parentPath ?? String(Reflect.get(entry, "path") ?? "");
|
|
6906
6906
|
const filePath = path$1.join(parentDir, entry.name);
|
|
6907
|
-
if (fs.statSync(filePath).mtimeMs > distMtime) return true;
|
|
6907
|
+
if (fs$1.statSync(filePath).mtimeMs > distMtime) return true;
|
|
6908
6908
|
}
|
|
6909
6909
|
return false;
|
|
6910
6910
|
} catch {
|
|
@@ -6921,7 +6921,7 @@ function isSourceNewer(packageDir) {
|
|
|
6921
6921
|
* `copyDirRecursive` for the wedge this prevents.
|
|
6922
6922
|
*/
|
|
6923
6923
|
async function installPackageFromNpm(packageName, targetDir) {
|
|
6924
|
-
const tmpDir = await fs.promises.mkdtemp(path$1.join(os$1.tmpdir(), "camstack-install-"));
|
|
6924
|
+
const tmpDir = await fs$1.promises.mkdtemp(path$1.join(os$1.tmpdir(), "camstack-install-"));
|
|
6925
6925
|
try {
|
|
6926
6926
|
const { stdout } = await execFileAsync$4("npm", [
|
|
6927
6927
|
"pack",
|
|
@@ -6944,21 +6944,21 @@ async function installPackageFromNpm(packageName, targetDir) {
|
|
|
6944
6944
|
extractDir
|
|
6945
6945
|
], { timeout: 3e4 });
|
|
6946
6946
|
const packageSubDir = path$1.join(extractDir, "package");
|
|
6947
|
-
const srcPkgJsonDir = fs.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
|
|
6948
|
-
await fs.promises.rm(targetDir, {
|
|
6947
|
+
const srcPkgJsonDir = fs$1.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
|
|
6948
|
+
await fs$1.promises.rm(targetDir, {
|
|
6949
6949
|
recursive: true,
|
|
6950
6950
|
force: true
|
|
6951
6951
|
});
|
|
6952
6952
|
ensureDir(targetDir);
|
|
6953
|
-
await fs.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
|
|
6953
|
+
await fs$1.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
|
|
6954
6954
|
const distSrc = path$1.join(srcPkgJsonDir, "dist");
|
|
6955
|
-
if (fs.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
|
|
6955
|
+
if (fs$1.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
|
|
6956
6956
|
try {
|
|
6957
|
-
const npmPkg = asJsonObject$1(parseJsonUnknown(await fs.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
6957
|
+
const npmPkg = asJsonObject$1(parseJsonUnknown(await fs$1.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
6958
6958
|
if (npmPkg) await copyExtraFileDirs(npmPkg, srcPkgJsonDir, targetDir);
|
|
6959
6959
|
} catch {}
|
|
6960
6960
|
} finally {
|
|
6961
|
-
await fs.promises.rm(tmpDir, {
|
|
6961
|
+
await fs$1.promises.rm(tmpDir, {
|
|
6962
6962
|
recursive: true,
|
|
6963
6963
|
force: true
|
|
6964
6964
|
});
|
|
@@ -6983,7 +6983,7 @@ function packageDirName$1(declaredName) {
|
|
|
6983
6983
|
}
|
|
6984
6984
|
function isDirLike$1(p) {
|
|
6985
6985
|
try {
|
|
6986
|
-
return fs.statSync(p).isDirectory();
|
|
6986
|
+
return fs$1.statSync(p).isDirectory();
|
|
6987
6987
|
} catch {
|
|
6988
6988
|
return false;
|
|
6989
6989
|
}
|
|
@@ -7001,12 +7001,12 @@ var AddonManifest = class {
|
|
|
7001
7001
|
*/
|
|
7002
7002
|
read() {
|
|
7003
7003
|
if (this.cache != null) return this.cache;
|
|
7004
|
-
if (!fs.existsSync(this.manifestPath)) {
|
|
7004
|
+
if (!fs$1.existsSync(this.manifestPath)) {
|
|
7005
7005
|
this.cache = this.empty();
|
|
7006
7006
|
return this.cache;
|
|
7007
7007
|
}
|
|
7008
7008
|
try {
|
|
7009
|
-
const raw = fs.readFileSync(this.manifestPath, "utf-8");
|
|
7009
|
+
const raw = fs$1.readFileSync(this.manifestPath, "utf-8");
|
|
7010
7010
|
const parsed = JSON.parse(raw);
|
|
7011
7011
|
if (parsed.version !== MANIFEST_VERSION) {
|
|
7012
7012
|
process.stderr.write(`[AddonManifest] schema mismatch (file=${parsed.version} vs runtime=${MANIFEST_VERSION}); starting empty\n`);
|
|
@@ -7027,13 +7027,13 @@ var AddonManifest = class {
|
|
|
7027
7027
|
* a half-written file.
|
|
7028
7028
|
*/
|
|
7029
7029
|
write(manifest) {
|
|
7030
|
-
fs.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
|
|
7030
|
+
fs$1.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
|
|
7031
7031
|
const tmp = `${this.manifestPath}.tmp.${process.pid}.${Date.now()}`;
|
|
7032
|
-
fs.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
|
|
7032
|
+
fs$1.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
|
|
7033
7033
|
encoding: "utf-8",
|
|
7034
7034
|
mode: 384
|
|
7035
7035
|
});
|
|
7036
|
-
fs.renameSync(tmp, this.manifestPath);
|
|
7036
|
+
fs$1.renameSync(tmp, this.manifestPath);
|
|
7037
7037
|
this.cache = manifest;
|
|
7038
7038
|
}
|
|
7039
7039
|
/** Lookup a single addon's manifest entry, or `null` if not tracked. */
|
|
@@ -7108,22 +7108,22 @@ var AddonManifest = class {
|
|
|
7108
7108
|
* exactly what moved. Returns the total number of changes.
|
|
7109
7109
|
*/
|
|
7110
7110
|
reconcileFromDisk(addonsDir, onChange) {
|
|
7111
|
-
if (!fs.existsSync(addonsDir)) return 0;
|
|
7111
|
+
if (!fs$1.existsSync(addonsDir)) return 0;
|
|
7112
7112
|
const m = this.read();
|
|
7113
7113
|
let changes = 0;
|
|
7114
7114
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7115
7115
|
/** Package name → version, for every ADDON package actually installed. */
|
|
7116
7116
|
const onDisk = /* @__PURE__ */ new Map();
|
|
7117
|
-
for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7117
|
+
for (const scope of fs$1.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7118
7118
|
if (!scope.name.startsWith("@") || !isDirLike$1(path$1.join(addonsDir, scope.name))) continue;
|
|
7119
7119
|
const scopeDir = path$1.join(addonsDir, scope.name);
|
|
7120
|
-
for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7120
|
+
for (const pkg of fs$1.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7121
7121
|
if (!isDirLike$1(path$1.join(scopeDir, pkg.name))) continue;
|
|
7122
7122
|
const pkgJsonPath = path$1.join(scopeDir, pkg.name, "package.json");
|
|
7123
|
-
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
7123
|
+
if (!fs$1.existsSync(pkgJsonPath)) continue;
|
|
7124
7124
|
let pkgJson;
|
|
7125
7125
|
try {
|
|
7126
|
-
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
7126
|
+
const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
|
|
7127
7127
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
7128
7128
|
pkgJson = parsed;
|
|
7129
7129
|
} catch {
|
|
@@ -7194,28 +7194,28 @@ var AddonManifest = class {
|
|
|
7194
7194
|
migrateFromInstallSourceMarkers(addonsDir) {
|
|
7195
7195
|
const m = this.read();
|
|
7196
7196
|
if (Object.keys(m.addons).length > 0) return 0;
|
|
7197
|
-
if (!fs.existsSync(addonsDir)) return 0;
|
|
7197
|
+
if (!fs$1.existsSync(addonsDir)) return 0;
|
|
7198
7198
|
let migrated = 0;
|
|
7199
7199
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7200
|
-
for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7200
|
+
for (const scope of fs$1.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7201
7201
|
if (!scope.isDirectory() || !scope.name.startsWith("@")) continue;
|
|
7202
7202
|
const scopeDir = path$1.join(addonsDir, scope.name);
|
|
7203
|
-
for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7203
|
+
for (const pkg of fs$1.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7204
7204
|
if (!pkg.isDirectory()) continue;
|
|
7205
7205
|
const pkgDir = path$1.join(scopeDir, pkg.name);
|
|
7206
7206
|
const markerPath = path$1.join(pkgDir, ".install-source");
|
|
7207
7207
|
const pkgJsonPath = path$1.join(pkgDir, "package.json");
|
|
7208
|
-
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
7208
|
+
if (!fs$1.existsSync(pkgJsonPath)) continue;
|
|
7209
7209
|
let pkgJson;
|
|
7210
7210
|
try {
|
|
7211
|
-
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
7211
|
+
const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
|
|
7212
7212
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
7213
7213
|
pkgJson = parsed;
|
|
7214
7214
|
} catch {
|
|
7215
7215
|
continue;
|
|
7216
7216
|
}
|
|
7217
7217
|
if (!pkgJson.name || !pkgJson.version) continue;
|
|
7218
|
-
const source = fs.existsSync(markerPath) ? fs.readFileSync(markerPath, "utf-8").trim() : "bundled";
|
|
7218
|
+
const source = fs$1.existsSync(markerPath) ? fs$1.readFileSync(markerPath, "utf-8").trim() : "bundled";
|
|
7219
7219
|
m.addons[pkgJson.name] = {
|
|
7220
7220
|
name: pkgJson.name,
|
|
7221
7221
|
version: pkgJson.version,
|
|
@@ -7419,7 +7419,7 @@ function planClosureDedupe(input) {
|
|
|
7419
7419
|
function readTreeManifest(pkgJsonPath) {
|
|
7420
7420
|
let raw;
|
|
7421
7421
|
try {
|
|
7422
|
-
raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
|
|
7422
|
+
raw = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8")));
|
|
7423
7423
|
} catch {
|
|
7424
7424
|
return null;
|
|
7425
7425
|
}
|
|
@@ -7444,7 +7444,7 @@ function readTreeManifest(pkgJsonPath) {
|
|
|
7444
7444
|
function listTopLevelEntries(nodeModulesDir) {
|
|
7445
7445
|
let entries;
|
|
7446
7446
|
try {
|
|
7447
|
-
entries = fs.readdirSync(nodeModulesDir, { withFileTypes: true });
|
|
7447
|
+
entries = fs$1.readdirSync(nodeModulesDir, { withFileTypes: true });
|
|
7448
7448
|
} catch {
|
|
7449
7449
|
return [];
|
|
7450
7450
|
}
|
|
@@ -7454,7 +7454,7 @@ function listTopLevelEntries(nodeModulesDir) {
|
|
|
7454
7454
|
if (entry.name.startsWith("@")) {
|
|
7455
7455
|
let inner;
|
|
7456
7456
|
try {
|
|
7457
|
-
inner = fs.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
|
|
7457
|
+
inner = fs$1.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
|
|
7458
7458
|
} catch {
|
|
7459
7459
|
continue;
|
|
7460
7460
|
}
|
|
@@ -7487,14 +7487,14 @@ function collectAddonTreeState(addonDir) {
|
|
|
7487
7487
|
const entryDir = path$1.join(nodeModulesDir, name);
|
|
7488
7488
|
let isLink = false;
|
|
7489
7489
|
try {
|
|
7490
|
-
isLink = fs.lstatSync(entryDir).isSymbolicLink();
|
|
7490
|
+
isLink = fs$1.lstatSync(entryDir).isSymbolicLink();
|
|
7491
7491
|
} catch {
|
|
7492
7492
|
continue;
|
|
7493
7493
|
}
|
|
7494
7494
|
if (isLink) {
|
|
7495
7495
|
let target = "";
|
|
7496
7496
|
try {
|
|
7497
|
-
target = fs.readlinkSync(entryDir);
|
|
7497
|
+
target = fs$1.readlinkSync(entryDir);
|
|
7498
7498
|
} catch {}
|
|
7499
7499
|
existingLinks.push({
|
|
7500
7500
|
name,
|
|
@@ -7508,7 +7508,7 @@ function collectAddonTreeState(addonDir) {
|
|
|
7508
7508
|
version: manifest.version
|
|
7509
7509
|
});
|
|
7510
7510
|
for (const [depName, range] of manifest.ranges) {
|
|
7511
|
-
if (fs.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
|
|
7511
|
+
if (fs$1.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
|
|
7512
7512
|
addRange(depName, range);
|
|
7513
7513
|
}
|
|
7514
7514
|
}
|
|
@@ -7538,7 +7538,7 @@ function resolveClosureNodeModulesDir(explicitDir) {
|
|
|
7538
7538
|
const frameworkDir = explicitDir ?? process.env["CAMSTACK_FRAMEWORK_DIR"];
|
|
7539
7539
|
if (frameworkDir === void 0 || frameworkDir.length === 0) return null;
|
|
7540
7540
|
const nodeModulesDir = explicitDir ?? path$1.join(frameworkDir, "node_modules");
|
|
7541
|
-
return fs.existsSync(nodeModulesDir) ? nodeModulesDir : null;
|
|
7541
|
+
return fs$1.existsSync(nodeModulesDir) ? nodeModulesDir : null;
|
|
7542
7542
|
}
|
|
7543
7543
|
function symlinkType() {
|
|
7544
7544
|
return process.platform === "win32" ? "junction" : "dir";
|
|
@@ -7557,10 +7557,10 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
|
|
|
7557
7557
|
const nodeModulesDir = path$1.join(addonDir, "node_modules");
|
|
7558
7558
|
const probePath = path$1.join(nodeModulesDir, ".closure-link-probe");
|
|
7559
7559
|
try {
|
|
7560
|
-
fs.mkdirSync(nodeModulesDir, { recursive: true });
|
|
7561
|
-
fs.rmSync(probePath, { force: true });
|
|
7562
|
-
fs.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
|
|
7563
|
-
fs.rmSync(probePath, { force: true });
|
|
7560
|
+
fs$1.mkdirSync(nodeModulesDir, { recursive: true });
|
|
7561
|
+
fs$1.rmSync(probePath, { force: true });
|
|
7562
|
+
fs$1.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
|
|
7563
|
+
fs$1.rmSync(probePath, { force: true });
|
|
7564
7564
|
} catch (err) {
|
|
7565
7565
|
logger.warn("closure dedupe skipped — symlinks unavailable on this volume", { meta: {
|
|
7566
7566
|
addonDir,
|
|
@@ -7582,12 +7582,12 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
|
|
|
7582
7582
|
}
|
|
7583
7583
|
const entryDir = path$1.join(nodeModulesDir, link.name);
|
|
7584
7584
|
try {
|
|
7585
|
-
fs.rmSync(entryDir, {
|
|
7585
|
+
fs$1.rmSync(entryDir, {
|
|
7586
7586
|
recursive: true,
|
|
7587
7587
|
force: true
|
|
7588
7588
|
});
|
|
7589
|
-
fs.mkdirSync(path$1.dirname(entryDir), { recursive: true });
|
|
7590
|
-
fs.symlinkSync(target, entryDir, symlinkType());
|
|
7589
|
+
fs$1.mkdirSync(path$1.dirname(entryDir), { recursive: true });
|
|
7590
|
+
fs$1.symlinkSync(target, entryDir, symlinkType());
|
|
7591
7591
|
linked.push(link.name);
|
|
7592
7592
|
} catch (err) {
|
|
7593
7593
|
logger.warn("closure dedupe — link failed; entry removed copy may need reinstall", { meta: {
|
|
@@ -7663,7 +7663,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
|
|
|
7663
7663
|
count: Object.keys(native).length
|
|
7664
7664
|
} });
|
|
7665
7665
|
try {
|
|
7666
|
-
fs.writeFileSync(markerFile, markerHash);
|
|
7666
|
+
fs$1.writeFileSync(markerFile, markerHash);
|
|
7667
7667
|
} catch (err) {
|
|
7668
7668
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
7669
7669
|
markerFile,
|
|
@@ -7701,7 +7701,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
|
|
|
7701
7701
|
}
|
|
7702
7702
|
await rebuildNativeDeps(addonDir, pending.map(([name]) => name), logger, npmCacheDir ?? defaultNpmCacheDir(), registry);
|
|
7703
7703
|
try {
|
|
7704
|
-
fs.writeFileSync(markerFile, markerHash);
|
|
7704
|
+
fs$1.writeFileSync(markerFile, markerHash);
|
|
7705
7705
|
} catch (err) {
|
|
7706
7706
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
7707
7707
|
markerFile,
|
|
@@ -7723,12 +7723,12 @@ function copyPrebuiltNativeDep(name, addonDir, logger) {
|
|
|
7723
7723
|
if (source === target) continue;
|
|
7724
7724
|
if (!hasBuiltBinary(source)) continue;
|
|
7725
7725
|
try {
|
|
7726
|
-
fs.rmSync(target, {
|
|
7726
|
+
fs$1.rmSync(target, {
|
|
7727
7727
|
recursive: true,
|
|
7728
7728
|
force: true
|
|
7729
7729
|
});
|
|
7730
|
-
fs.mkdirSync(path$1.dirname(target), { recursive: true });
|
|
7731
|
-
fs.cpSync(source, target, {
|
|
7730
|
+
fs$1.mkdirSync(path$1.dirname(target), { recursive: true });
|
|
7731
|
+
fs$1.cpSync(source, target, {
|
|
7732
7732
|
recursive: true,
|
|
7733
7733
|
dereference: true
|
|
7734
7734
|
});
|
|
@@ -7764,7 +7764,7 @@ var BUNDLED_NATIVE_SIBLING_SCOPES = {
|
|
|
7764
7764
|
function hasAnyDotNode(dir, maxDepth) {
|
|
7765
7765
|
let entries;
|
|
7766
7766
|
try {
|
|
7767
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
7767
|
+
entries = fs$1.readdirSync(dir, { withFileTypes: true });
|
|
7768
7768
|
} catch {
|
|
7769
7769
|
return false;
|
|
7770
7770
|
}
|
|
@@ -7778,12 +7778,12 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
|
|
|
7778
7778
|
if (!hasAnyDotNode(src, 5)) return;
|
|
7779
7779
|
if (hasAnyDotNode(dst, 5)) return;
|
|
7780
7780
|
try {
|
|
7781
|
-
fs.rmSync(dst, {
|
|
7781
|
+
fs$1.rmSync(dst, {
|
|
7782
7782
|
recursive: true,
|
|
7783
7783
|
force: true
|
|
7784
7784
|
});
|
|
7785
|
-
fs.mkdirSync(path$1.dirname(dst), { recursive: true });
|
|
7786
|
-
fs.cpSync(src, dst, {
|
|
7785
|
+
fs$1.mkdirSync(path$1.dirname(dst), { recursive: true });
|
|
7786
|
+
fs$1.cpSync(src, dst, {
|
|
7787
7787
|
recursive: true,
|
|
7788
7788
|
dereference: true
|
|
7789
7789
|
});
|
|
@@ -7818,7 +7818,7 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
|
|
|
7818
7818
|
*/
|
|
7819
7819
|
function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
7820
7820
|
const srcNm = path$1.join(sourceDir, "node_modules");
|
|
7821
|
-
if (!fs.existsSync(srcNm)) return;
|
|
7821
|
+
if (!fs$1.existsSync(srcNm)) return;
|
|
7822
7822
|
const dstNm = path$1.join(targetDir, "node_modules");
|
|
7823
7823
|
for (const [name, scopes] of Object.entries(BUNDLED_NATIVE_SIBLING_SCOPES)) {
|
|
7824
7824
|
copyPrebuiltModuleDir(path$1.join(srcNm, name), path$1.join(dstNm, name), name, logger);
|
|
@@ -7826,7 +7826,7 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
|
7826
7826
|
const scopeSrc = path$1.join(srcNm, scope);
|
|
7827
7827
|
let siblings;
|
|
7828
7828
|
try {
|
|
7829
|
-
siblings = fs.readdirSync(scopeSrc);
|
|
7829
|
+
siblings = fs$1.readdirSync(scopeSrc);
|
|
7830
7830
|
} catch {
|
|
7831
7831
|
continue;
|
|
7832
7832
|
}
|
|
@@ -7836,12 +7836,12 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
|
7836
7836
|
}
|
|
7837
7837
|
/** A package dir is "built" when it carries a compiled `.node` or a prebuilds tree. */
|
|
7838
7838
|
function hasBuiltBinary(pkgDir) {
|
|
7839
|
-
if (!fs.existsSync(path$1.join(pkgDir, "package.json"))) return false;
|
|
7839
|
+
if (!fs$1.existsSync(path$1.join(pkgDir, "package.json"))) return false;
|
|
7840
7840
|
const releaseDir = path$1.join(pkgDir, "build", "Release");
|
|
7841
7841
|
try {
|
|
7842
|
-
if (fs.existsSync(releaseDir) && fs.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
|
|
7842
|
+
if (fs$1.existsSync(releaseDir) && fs$1.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
|
|
7843
7843
|
} catch {}
|
|
7844
|
-
return fs.existsSync(path$1.join(pkgDir, "prebuilds"));
|
|
7844
|
+
return fs$1.existsSync(path$1.join(pkgDir, "prebuilds"));
|
|
7845
7845
|
}
|
|
7846
7846
|
/** Candidate hoisted locations for `<name>`: NODE_PATH entries + ancestors of `addonDir`. */
|
|
7847
7847
|
function candidateHoistedDirs(name, addonDir) {
|
|
@@ -7879,7 +7879,7 @@ function hashDeclaration(deps) {
|
|
|
7879
7879
|
}
|
|
7880
7880
|
function markerMatches(markerFile, expected) {
|
|
7881
7881
|
try {
|
|
7882
|
-
return fs.readFileSync(markerFile, "utf-8").trim() === expected;
|
|
7882
|
+
return fs$1.readFileSync(markerFile, "utf-8").trim() === expected;
|
|
7883
7883
|
} catch {
|
|
7884
7884
|
return false;
|
|
7885
7885
|
}
|
|
@@ -8090,7 +8090,7 @@ function parseInstallSource(value) {
|
|
|
8090
8090
|
function readPackageJson(pkgJsonPath) {
|
|
8091
8091
|
let raw;
|
|
8092
8092
|
try {
|
|
8093
|
-
raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
|
|
8093
|
+
raw = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(pkgJsonPath, "utf-8")));
|
|
8094
8094
|
} catch {
|
|
8095
8095
|
return null;
|
|
8096
8096
|
}
|
|
@@ -8134,7 +8134,7 @@ var REGISTRY_LATEST_TIMEOUT_MS = 15e3;
|
|
|
8134
8134
|
var FALLBACK_VERSION_PROBES = 25;
|
|
8135
8135
|
function readInstalledPackageVersion(addonDir) {
|
|
8136
8136
|
try {
|
|
8137
|
-
const raw = JSON.parse(fs.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
|
|
8137
|
+
const raw = JSON.parse(fs$1.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
|
|
8138
8138
|
if (raw === null || typeof raw !== "object") return null;
|
|
8139
8139
|
const version = Reflect.get(raw, "version");
|
|
8140
8140
|
return typeof version === "string" && version.length > 0 ? version : null;
|
|
@@ -8282,7 +8282,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8282
8282
|
} catch {
|
|
8283
8283
|
return Object.freeze([]);
|
|
8284
8284
|
}
|
|
8285
|
-
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
8285
|
+
const raw = fs$1.readFileSync(pkgPath, "utf-8");
|
|
8286
8286
|
const parsed = JSON.parse(raw);
|
|
8287
8287
|
const deps = Object.keys(parsed.dependencies ?? {});
|
|
8288
8288
|
const agentOnly = new Set(parsed.camstack?.agentOnlyBootstrapAddons ?? []);
|
|
@@ -8327,7 +8327,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8327
8327
|
} catch {
|
|
8328
8328
|
return Object.freeze([]);
|
|
8329
8329
|
}
|
|
8330
|
-
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
8330
|
+
const raw = fs$1.readFileSync(pkgPath, "utf-8");
|
|
8331
8331
|
const addons = JSON.parse(raw).camstack?.agentBootstrapAddons ?? [];
|
|
8332
8332
|
return Object.freeze(["@camstack/server", ...addons]);
|
|
8333
8333
|
}
|
|
@@ -8357,7 +8357,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8357
8357
|
this.logger.info(`Install source: ${isLocal ? `bundle (${this.bundledAddonsDir})` : "npm"}, ${pkgList.length} package(s)`);
|
|
8358
8358
|
for (const packageName of pkgList) {
|
|
8359
8359
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
8360
|
-
if (fs.existsSync(path$1.join(addonDir, "package.json"))) {
|
|
8360
|
+
if (fs$1.existsSync(path$1.join(addonDir, "package.json"))) {
|
|
8361
8361
|
if (isLocal || shouldSkipClosureProvidedSeed(packageName, this.isResolvableFromClosure(packageName))) {
|
|
8362
8362
|
this.logger.debug(`${packageName} — already installed, skipping`);
|
|
8363
8363
|
continue;
|
|
@@ -8608,7 +8608,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8608
8608
|
const installedPackages = this.listInstalled();
|
|
8609
8609
|
for (const pkg of installedPackages) {
|
|
8610
8610
|
try {
|
|
8611
|
-
if (fs.lstatSync(pkg.dir).isSymbolicLink()) continue;
|
|
8611
|
+
if (fs$1.lstatSync(pkg.dir).isSymbolicLink()) continue;
|
|
8612
8612
|
} catch {
|
|
8613
8613
|
continue;
|
|
8614
8614
|
}
|
|
@@ -8648,7 +8648,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8648
8648
|
if (closureNodeModules !== null) for (const link of state.existingLinks) {
|
|
8649
8649
|
if (!isClosureLinkTarget(link.target, closureNodeModules)) continue;
|
|
8650
8650
|
const linkDir = path$1.join(nodeModulesDir, link.name);
|
|
8651
|
-
const targetManifest = fs.existsSync(path$1.join(linkDir, "package.json"));
|
|
8651
|
+
const targetManifest = fs$1.existsSync(path$1.join(linkDir, "package.json"));
|
|
8652
8652
|
const ranges = state.requirements.get(link.name) ?? [];
|
|
8653
8653
|
let holds = targetManifest;
|
|
8654
8654
|
if (holds && ranges.length > 0) {
|
|
@@ -8657,14 +8657,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8657
8657
|
}
|
|
8658
8658
|
if (!holds) {
|
|
8659
8659
|
this.logger.warn(`${packageName} — closure link for ${link.name} no longer holds; reinstalling this addon's deps`, { meta: { target: link.target } });
|
|
8660
|
-
fs.rmSync(linkDir, { force: true });
|
|
8660
|
+
fs$1.rmSync(linkDir, { force: true });
|
|
8661
8661
|
needsInstall = true;
|
|
8662
8662
|
}
|
|
8663
8663
|
}
|
|
8664
8664
|
const linked = [];
|
|
8665
8665
|
for (const [depName, range] of declaredEntries) {
|
|
8666
8666
|
if (typeof range !== "string") continue;
|
|
8667
|
-
if (fs.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
|
|
8667
|
+
if (fs$1.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
|
|
8668
8668
|
const closureVersion = closureNodeModules === null ? void 0 : readClosureVersions(closureNodeModules, [depName]).get(depName);
|
|
8669
8669
|
if (closureNodeModules !== null && closureVersion !== void 0 && closureSatisfiesRange(range, closureVersion)) {
|
|
8670
8670
|
if (executeClosureDedupe(addonDir, closureNodeModules, {
|
|
@@ -8697,7 +8697,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8697
8697
|
const closureNodeModules = resolveClosureNodeModulesDir(this.closureNodeModulesDir);
|
|
8698
8698
|
if (closureNodeModules !== null) {
|
|
8699
8699
|
const state = collectAddonTreeState(addonDir);
|
|
8700
|
-
for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
|
|
8700
|
+
for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs$1.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
|
|
8701
8701
|
}
|
|
8702
8702
|
this.logger.info(`${packageName} — reinstalling runtime dependencies`, { meta: { addonDir } });
|
|
8703
8703
|
await runNpm([
|
|
@@ -8742,7 +8742,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8742
8742
|
async realignFromClosure(packageName, closureDir) {
|
|
8743
8743
|
const targetDir = path$1.join(this.addonsDir, packageName);
|
|
8744
8744
|
const result = await this.installLocal(packageName, closureDir);
|
|
8745
|
-
await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
|
|
8745
|
+
await fs$1.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
|
|
8746
8746
|
this.manifest.upsert(result.name, {
|
|
8747
8747
|
version: result.version,
|
|
8748
8748
|
source: "closure"
|
|
@@ -8758,17 +8758,17 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8758
8758
|
async installCopy(packageName, sourceDir, pkgData, targetDir) {
|
|
8759
8759
|
await this.ensureBuilt(packageName, sourceDir, pkgData);
|
|
8760
8760
|
const distDir = path$1.join(sourceDir, "dist");
|
|
8761
|
-
if (!fs.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
|
|
8762
|
-
await fs.promises.rm(targetDir, {
|
|
8761
|
+
if (!fs$1.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
|
|
8762
|
+
await fs$1.promises.rm(targetDir, {
|
|
8763
8763
|
recursive: true,
|
|
8764
8764
|
force: true
|
|
8765
8765
|
});
|
|
8766
8766
|
ensureDir(targetDir);
|
|
8767
|
-
await fs.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
|
|
8767
|
+
await fs$1.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
|
|
8768
8768
|
await copyDirRecursive(distDir, path$1.join(targetDir, "dist"));
|
|
8769
8769
|
await copyExtraFileDirs(pkgData, sourceDir, targetDir);
|
|
8770
8770
|
copyBundledNativeModules(sourceDir, targetDir, this.logger);
|
|
8771
|
-
await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
|
|
8771
|
+
await fs$1.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
|
|
8772
8772
|
const localPkgVersion = asString$1(pkgData.version, "0.0.0");
|
|
8773
8773
|
this.manifest.upsert(packageName, {
|
|
8774
8774
|
version: localPkgVersion,
|
|
@@ -8809,7 +8809,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8809
8809
|
* unusual auth, offline mode, etc).
|
|
8810
8810
|
*/
|
|
8811
8811
|
async installFromNpm(packageName, version) {
|
|
8812
|
-
const tmpDir = fs.mkdtempSync(path$1.join(os$1.tmpdir(), "camstack-addon-npm-"));
|
|
8812
|
+
const tmpDir = fs$1.mkdtempSync(path$1.join(os$1.tmpdir(), "camstack-addon-npm-"));
|
|
8813
8813
|
const packageSpec = version ? `${packageName}@${version}` : packageName;
|
|
8814
8814
|
this.logger.info(`${packageName} — installing from npm`);
|
|
8815
8815
|
try {
|
|
@@ -8823,19 +8823,19 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8823
8823
|
];
|
|
8824
8824
|
if (this.registry) args.push("--registry", this.registry);
|
|
8825
8825
|
const { stdout } = await runNpm(args, this.npmRunOptions(tmpDir, 12e4));
|
|
8826
|
-
const tgzFiles = fs.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
|
|
8826
|
+
const tgzFiles = fs$1.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
|
|
8827
8827
|
if (tgzFiles.length === 0) throw new Error(`npm pack produced no tgz. stdout: ${stdout.trim()}`);
|
|
8828
8828
|
return path$1.join(tmpDir, tgzFiles[0]);
|
|
8829
8829
|
});
|
|
8830
8830
|
const result = await this.installFromTgz(tgzPath);
|
|
8831
|
-
fs.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
|
|
8831
|
+
fs$1.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
|
|
8832
8832
|
this.manifest.upsert(result.name, {
|
|
8833
8833
|
version: result.version,
|
|
8834
8834
|
source: "npm"
|
|
8835
8835
|
});
|
|
8836
8836
|
return result;
|
|
8837
8837
|
} finally {
|
|
8838
|
-
fs.rmSync(tmpDir, {
|
|
8838
|
+
fs$1.rmSync(tmpDir, {
|
|
8839
8839
|
recursive: true,
|
|
8840
8840
|
force: true
|
|
8841
8841
|
});
|
|
@@ -8873,7 +8873,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8873
8873
|
if (!tarRes.ok) throw new Error(`tarball GET ${tarballUrl} → ${tarRes.status}`);
|
|
8874
8874
|
const tgzPath = path$1.join(tmpDir, `${packageName.replace(/[/@]/g, "-").replace(/^-+/, "")}-${resolvedVersion}.tgz`);
|
|
8875
8875
|
const buf = Buffer.from(await tarRes.arrayBuffer());
|
|
8876
|
-
fs.writeFileSync(tgzPath, buf);
|
|
8876
|
+
fs$1.writeFileSync(tgzPath, buf);
|
|
8877
8877
|
return tgzPath;
|
|
8878
8878
|
}
|
|
8879
8879
|
/**
|
|
@@ -8894,7 +8894,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8894
8894
|
* on the next deploy.
|
|
8895
8895
|
*/
|
|
8896
8896
|
async evictInstallDir(targetDir) {
|
|
8897
|
-
if (!fs.existsSync(targetDir)) return;
|
|
8897
|
+
if (!fs$1.existsSync(targetDir)) return;
|
|
8898
8898
|
const graveyard = path$1.join(this.addonsDir, ".evicting");
|
|
8899
8899
|
ensureDir(graveyard);
|
|
8900
8900
|
await this.sweepGraveyard(graveyard);
|
|
@@ -8902,10 +8902,10 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8902
8902
|
const flatName = path$1.relative(this.addonsDir, targetDir).replace(/[/\\]/g, "-");
|
|
8903
8903
|
const asideDir = path$1.join(graveyard, `${flatName}-${ts}`);
|
|
8904
8904
|
try {
|
|
8905
|
-
fs.renameSync(targetDir, asideDir);
|
|
8905
|
+
fs$1.renameSync(targetDir, asideDir);
|
|
8906
8906
|
} catch (renameErr) {
|
|
8907
8907
|
if (renameErr.code === "EXDEV") {
|
|
8908
|
-
await fs.promises.rm(targetDir, {
|
|
8908
|
+
await fs$1.promises.rm(targetDir, {
|
|
8909
8909
|
recursive: true,
|
|
8910
8910
|
force: true
|
|
8911
8911
|
});
|
|
@@ -8913,7 +8913,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8913
8913
|
}
|
|
8914
8914
|
throw renameErr;
|
|
8915
8915
|
}
|
|
8916
|
-
await fs.promises.rm(asideDir, {
|
|
8916
|
+
await fs$1.promises.rm(asideDir, {
|
|
8917
8917
|
recursive: true,
|
|
8918
8918
|
force: true
|
|
8919
8919
|
}).catch((cleanupErr) => {
|
|
@@ -8934,14 +8934,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8934
8934
|
async sweepStagingResidue(stagingRoot) {
|
|
8935
8935
|
let names;
|
|
8936
8936
|
try {
|
|
8937
|
-
names = fs.readdirSync(stagingRoot);
|
|
8937
|
+
names = fs$1.readdirSync(stagingRoot);
|
|
8938
8938
|
} catch {
|
|
8939
8939
|
return;
|
|
8940
8940
|
}
|
|
8941
8941
|
const now = Date.now();
|
|
8942
8942
|
const ages = [];
|
|
8943
8943
|
for (const name of names) try {
|
|
8944
|
-
const stat = fs.statSync(path$1.join(stagingRoot, name));
|
|
8944
|
+
const stat = fs$1.statSync(path$1.join(stagingRoot, name));
|
|
8945
8945
|
ages.push({
|
|
8946
8946
|
name,
|
|
8947
8947
|
ageMs: now - stat.mtimeMs
|
|
@@ -8952,7 +8952,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8952
8952
|
stagingRoot,
|
|
8953
8953
|
entries: sweepable
|
|
8954
8954
|
} });
|
|
8955
|
-
await Promise.all(sweepable.map((name) => fs.promises.rm(path$1.join(stagingRoot, name), {
|
|
8955
|
+
await Promise.all(sweepable.map((name) => fs$1.promises.rm(path$1.join(stagingRoot, name), {
|
|
8956
8956
|
recursive: true,
|
|
8957
8957
|
force: true
|
|
8958
8958
|
}).catch(() => void 0)));
|
|
@@ -8961,11 +8961,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8961
8961
|
async sweepGraveyard(graveyard) {
|
|
8962
8962
|
let entries;
|
|
8963
8963
|
try {
|
|
8964
|
-
entries = fs.readdirSync(graveyard);
|
|
8964
|
+
entries = fs$1.readdirSync(graveyard);
|
|
8965
8965
|
} catch {
|
|
8966
8966
|
return;
|
|
8967
8967
|
}
|
|
8968
|
-
await Promise.all(entries.map((name) => fs.promises.rm(path$1.join(graveyard, name), {
|
|
8968
|
+
await Promise.all(entries.map((name) => fs$1.promises.rm(path$1.join(graveyard, name), {
|
|
8969
8969
|
recursive: true,
|
|
8970
8970
|
force: true
|
|
8971
8971
|
}).catch(() => void 0)));
|
|
@@ -9016,7 +9016,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9016
9016
|
return;
|
|
9017
9017
|
}
|
|
9018
9018
|
const strippedManifest = stripBundledDeps(pkgView.raw);
|
|
9019
|
-
await fs.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
|
|
9019
|
+
await fs$1.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
|
|
9020
9020
|
const deps = asJsonObject$1(strippedManifest["dependencies"]);
|
|
9021
9021
|
const depNames = deps ? Object.keys(deps) : [];
|
|
9022
9022
|
if (depNames.length === 0) return;
|
|
@@ -9148,9 +9148,9 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9148
9148
|
"-C",
|
|
9149
9149
|
stagingDir
|
|
9150
9150
|
], { timeout: 12e4 });
|
|
9151
|
-
const pkgDir = fs.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
|
|
9151
|
+
const pkgDir = fs$1.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
|
|
9152
9152
|
const pkgJsonPath = path$1.join(pkgDir, "package.json");
|
|
9153
|
-
if (!fs.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
|
|
9153
|
+
if (!fs$1.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
|
|
9154
9154
|
const pkgView = readPackageJson(pkgJsonPath);
|
|
9155
9155
|
if (!pkgView) throw new Error(`Invalid package.json at ${pkgJsonPath}`);
|
|
9156
9156
|
if (!pkgView.camstackAddons) throw new Error(`Package ${pkgView.name} has no camstack.addons manifest`);
|
|
@@ -9160,7 +9160,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9160
9160
|
this.dedupeTreeAgainstClosure(pkgDir, pkgView.name);
|
|
9161
9161
|
await this.evictInstallDir(targetDir);
|
|
9162
9162
|
ensureDir(path$1.dirname(targetDir));
|
|
9163
|
-
await fs.promises.rename(pkgDir, targetDir);
|
|
9163
|
+
await fs$1.promises.rename(pkgDir, targetDir);
|
|
9164
9164
|
this.manifest.upsert(pkgView.name, {
|
|
9165
9165
|
version: pkgView.version,
|
|
9166
9166
|
source: "bundled"
|
|
@@ -9171,7 +9171,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9171
9171
|
};
|
|
9172
9172
|
} finally {
|
|
9173
9173
|
this.inFlightStaging.delete(stagingName);
|
|
9174
|
-
await fs.promises.rm(stagingDir, {
|
|
9174
|
+
await fs$1.promises.rm(stagingDir, {
|
|
9175
9175
|
recursive: true,
|
|
9176
9176
|
force: true
|
|
9177
9177
|
}).catch(() => void 0);
|
|
@@ -9201,24 +9201,24 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9201
9201
|
const current = this.manifest.get(packageName);
|
|
9202
9202
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
9203
9203
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9204
|
-
if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9204
|
+
if (!fs$1.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9205
9205
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
9206
9206
|
const backupRoot = path$1.join(this.addonsDir, ".backups", packageName);
|
|
9207
9207
|
ensureDir(backupRoot);
|
|
9208
9208
|
const backupDir = path$1.join(backupRoot, ts);
|
|
9209
9209
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
9210
|
-
fs.renameSync(addonDir, backupDir);
|
|
9210
|
+
fs$1.renameSync(addonDir, backupDir);
|
|
9211
9211
|
let result;
|
|
9212
9212
|
try {
|
|
9213
9213
|
result = await this.installFromNpm(packageName, version);
|
|
9214
9214
|
} catch (installErr) {
|
|
9215
9215
|
this.logger.error(`${packageName} — install failed, restoring backup`, { meta: { error: errMsg$1(installErr) } });
|
|
9216
9216
|
try {
|
|
9217
|
-
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9217
|
+
if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
|
|
9218
9218
|
recursive: true,
|
|
9219
9219
|
force: true
|
|
9220
9220
|
});
|
|
9221
|
-
fs.renameSync(backupDir, addonDir);
|
|
9221
|
+
fs$1.renameSync(backupDir, addonDir);
|
|
9222
9222
|
this.manifest.upsert(packageName, {
|
|
9223
9223
|
version: current.version,
|
|
9224
9224
|
source: current.source,
|
|
@@ -9279,7 +9279,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9279
9279
|
const current = this.manifest.get(packageName);
|
|
9280
9280
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
9281
9281
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9282
|
-
if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9282
|
+
if (!fs$1.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9283
9283
|
await this.installRuntimeDependencies(stagedPath, packageName);
|
|
9284
9284
|
await this.installNativeDependencies(stagedPath, packageName);
|
|
9285
9285
|
this.dedupeTreeAgainstClosure(stagedPath, packageName);
|
|
@@ -9288,14 +9288,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9288
9288
|
ensureDir(backupRoot);
|
|
9289
9289
|
const backupDir = path$1.join(backupRoot, ts);
|
|
9290
9290
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
9291
|
-
fs.renameSync(addonDir, backupDir);
|
|
9291
|
+
fs$1.renameSync(addonDir, backupDir);
|
|
9292
9292
|
try {
|
|
9293
9293
|
try {
|
|
9294
|
-
fs.renameSync(stagedPath, addonDir);
|
|
9294
|
+
fs$1.renameSync(stagedPath, addonDir);
|
|
9295
9295
|
} catch (renameErr) {
|
|
9296
9296
|
if (renameErr.code === "EXDEV") {
|
|
9297
|
-
fs.cpSync(stagedPath, addonDir, { recursive: true });
|
|
9298
|
-
fs.rmSync(stagedPath, {
|
|
9297
|
+
fs$1.cpSync(stagedPath, addonDir, { recursive: true });
|
|
9298
|
+
fs$1.rmSync(stagedPath, {
|
|
9299
9299
|
recursive: true,
|
|
9300
9300
|
force: true
|
|
9301
9301
|
});
|
|
@@ -9304,11 +9304,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9304
9304
|
} catch (swapErr) {
|
|
9305
9305
|
this.logger.error(`${packageName} — staged swap failed, restoring backup`, { meta: { error: errMsg$1(swapErr) } });
|
|
9306
9306
|
try {
|
|
9307
|
-
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9307
|
+
if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
|
|
9308
9308
|
recursive: true,
|
|
9309
9309
|
force: true
|
|
9310
9310
|
});
|
|
9311
|
-
fs.renameSync(backupDir, addonDir);
|
|
9311
|
+
fs$1.renameSync(backupDir, addonDir);
|
|
9312
9312
|
this.manifest.upsert(packageName, {
|
|
9313
9313
|
version: current.version,
|
|
9314
9314
|
source: current.source,
|
|
@@ -9347,20 +9347,20 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9347
9347
|
this.logger.warn(`${packageName} — no backup to rollback to`);
|
|
9348
9348
|
return null;
|
|
9349
9349
|
}
|
|
9350
|
-
if (!fs.existsSync(entry.lastBackupDir)) {
|
|
9350
|
+
if (!fs$1.existsSync(entry.lastBackupDir)) {
|
|
9351
9351
|
this.logger.warn(`${packageName} — backup dir vanished: ${entry.lastBackupDir}`);
|
|
9352
9352
|
return null;
|
|
9353
9353
|
}
|
|
9354
9354
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9355
|
-
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9355
|
+
if (fs$1.existsSync(addonDir)) fs$1.rmSync(addonDir, {
|
|
9356
9356
|
recursive: true,
|
|
9357
9357
|
force: true
|
|
9358
9358
|
});
|
|
9359
|
-
fs.renameSync(entry.lastBackupDir, addonDir);
|
|
9359
|
+
fs$1.renameSync(entry.lastBackupDir, addonDir);
|
|
9360
9360
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
9361
9361
|
let restoredVersion = entry.version;
|
|
9362
|
-
if (fs.existsSync(pkgJsonPath)) try {
|
|
9363
|
-
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
9362
|
+
if (fs$1.existsSync(pkgJsonPath)) try {
|
|
9363
|
+
const parsed = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf-8"));
|
|
9364
9364
|
if (typeof parsed === "object" && parsed != null) {
|
|
9365
9365
|
const v = parsed.version;
|
|
9366
9366
|
if (typeof v === "string" && v.length > 0) restoredVersion = v;
|
|
@@ -9408,7 +9408,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9408
9408
|
return false;
|
|
9409
9409
|
}
|
|
9410
9410
|
try {
|
|
9411
|
-
await fs.promises.rm(target, {
|
|
9411
|
+
await fs$1.promises.rm(target, {
|
|
9412
9412
|
recursive: true,
|
|
9413
9413
|
force: true
|
|
9414
9414
|
});
|
|
@@ -9426,7 +9426,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9426
9426
|
listBackupsFor(packageName) {
|
|
9427
9427
|
const dir = path$1.join(this.backupsRoot, packageName);
|
|
9428
9428
|
try {
|
|
9429
|
-
return fs.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
|
|
9429
|
+
return fs$1.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
|
|
9430
9430
|
} catch {
|
|
9431
9431
|
return [];
|
|
9432
9432
|
}
|
|
@@ -9458,7 +9458,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9458
9458
|
for (const dir of [pkgDir, path$1.dirname(pkgDir)]) {
|
|
9459
9459
|
if (!this.isInsideBackups(dir)) continue;
|
|
9460
9460
|
try {
|
|
9461
|
-
await fs.promises.rmdir(dir);
|
|
9461
|
+
await fs$1.promises.rmdir(dir);
|
|
9462
9462
|
} catch {
|
|
9463
9463
|
return;
|
|
9464
9464
|
}
|
|
@@ -9540,7 +9540,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9540
9540
|
*/
|
|
9541
9541
|
resolveBackupToKeep(packageName, backups) {
|
|
9542
9542
|
const liveDir = path$1.join(this.addonsDir, packageName);
|
|
9543
|
-
if (!fs.existsSync(liveDir)) {
|
|
9543
|
+
if (!fs$1.existsSync(liveDir)) {
|
|
9544
9544
|
const newest = backups[backups.length - 1] ?? null;
|
|
9545
9545
|
if (newest != null) this.logger.warn(`${packageName} — live install dir missing; retaining its newest backup as the only surviving copy`, { meta: {
|
|
9546
9546
|
liveDir,
|
|
@@ -9557,7 +9557,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9557
9557
|
listBackedUpPackages() {
|
|
9558
9558
|
let entries;
|
|
9559
9559
|
try {
|
|
9560
|
-
entries = fs.readdirSync(this.backupsRoot, { withFileTypes: true });
|
|
9560
|
+
entries = fs$1.readdirSync(this.backupsRoot, { withFileTypes: true });
|
|
9561
9561
|
} catch {
|
|
9562
9562
|
return [];
|
|
9563
9563
|
}
|
|
@@ -9569,14 +9569,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9569
9569
|
continue;
|
|
9570
9570
|
}
|
|
9571
9571
|
const scopeDir = path$1.join(this.backupsRoot, entry.name);
|
|
9572
|
-
for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
|
|
9572
|
+
for (const inner of fs$1.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
|
|
9573
9573
|
}
|
|
9574
9574
|
return names;
|
|
9575
9575
|
}
|
|
9576
9576
|
async uninstall(packageName) {
|
|
9577
9577
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9578
|
-
if (fs.existsSync(addonDir)) {
|
|
9579
|
-
fs.rmSync(addonDir, {
|
|
9578
|
+
if (fs$1.existsSync(addonDir)) {
|
|
9579
|
+
fs$1.rmSync(addonDir, {
|
|
9580
9580
|
recursive: true,
|
|
9581
9581
|
force: true
|
|
9582
9582
|
});
|
|
@@ -9584,8 +9584,8 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9584
9584
|
return;
|
|
9585
9585
|
}
|
|
9586
9586
|
const legacyDir = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""));
|
|
9587
|
-
if (fs.existsSync(legacyDir)) {
|
|
9588
|
-
fs.rmSync(legacyDir, {
|
|
9587
|
+
if (fs$1.existsSync(legacyDir)) {
|
|
9588
|
+
fs$1.rmSync(legacyDir, {
|
|
9589
9589
|
recursive: true,
|
|
9590
9590
|
force: true
|
|
9591
9591
|
});
|
|
@@ -9593,22 +9593,22 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9593
9593
|
}
|
|
9594
9594
|
}
|
|
9595
9595
|
listInstalled() {
|
|
9596
|
-
if (!fs.existsSync(this.addonsDir)) return [];
|
|
9596
|
+
if (!fs$1.existsSync(this.addonsDir)) return [];
|
|
9597
9597
|
const packageDirs = [];
|
|
9598
|
-
for (const entry of fs.readdirSync(this.addonsDir, { withFileTypes: true })) {
|
|
9598
|
+
for (const entry of fs$1.readdirSync(this.addonsDir, { withFileTypes: true })) {
|
|
9599
9599
|
if (!isDirEntry(entry, this.addonsDir)) continue;
|
|
9600
9600
|
if (entry.name.startsWith("@")) {
|
|
9601
9601
|
const scopeDir = path$1.join(this.addonsDir, entry.name);
|
|
9602
|
-
for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
|
|
9602
|
+
for (const inner of fs$1.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
|
|
9603
9603
|
} else packageDirs.push(path$1.join(this.addonsDir, entry.name));
|
|
9604
9604
|
}
|
|
9605
9605
|
return packageDirs.map((dir) => {
|
|
9606
9606
|
const pkgPath = path$1.join(dir, "package.json");
|
|
9607
|
-
if (!fs.existsSync(pkgPath)) return null;
|
|
9607
|
+
if (!fs$1.existsSync(pkgPath)) return null;
|
|
9608
9608
|
const pkg = readPackageJson(pkgPath);
|
|
9609
9609
|
if (!pkg || !pkg.camstackAddons) return null;
|
|
9610
9610
|
const sourceFile = path$1.join(dir, ".install-source");
|
|
9611
|
-
const installSource = fs.existsSync(sourceFile) ? parseInstallSource(fs.readFileSync(sourceFile, "utf-8").trim()) : void 0;
|
|
9611
|
+
const installSource = fs$1.existsSync(sourceFile) ? parseInstallSource(fs$1.readFileSync(sourceFile, "utf-8").trim()) : void 0;
|
|
9612
9612
|
return {
|
|
9613
9613
|
name: pkg.name,
|
|
9614
9614
|
version: pkg.version,
|
|
@@ -9618,13 +9618,13 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9618
9618
|
}).filter((item) => item !== null);
|
|
9619
9619
|
}
|
|
9620
9620
|
isInstalled(packageName) {
|
|
9621
|
-
if (fs.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
|
|
9622
|
-
return fs.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
|
|
9621
|
+
if (fs$1.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
|
|
9622
|
+
return fs$1.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
|
|
9623
9623
|
}
|
|
9624
9624
|
getInstalledPackage(packageName) {
|
|
9625
9625
|
let pkgPath = path$1.join(this.addonsDir, packageName, "package.json");
|
|
9626
|
-
if (!fs.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
|
|
9627
|
-
if (!fs.existsSync(pkgPath)) return null;
|
|
9626
|
+
if (!fs$1.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
|
|
9627
|
+
if (!fs$1.existsSync(pkgPath)) return null;
|
|
9628
9628
|
const pkg = readPackageJson(pkgPath);
|
|
9629
9629
|
if (!pkg) return null;
|
|
9630
9630
|
return {
|
|
@@ -9643,7 +9643,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9643
9643
|
]) {
|
|
9644
9644
|
const candidate = path$1.join(this.bundledAddonsDir, dirName);
|
|
9645
9645
|
try {
|
|
9646
|
-
const pkg = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
|
|
9646
|
+
const pkg = asJsonObject$1(parseJsonUnknown(fs$1.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
|
|
9647
9647
|
if (pkg && asString$1(pkg["name"]) === packageName) return candidate;
|
|
9648
9648
|
} catch {}
|
|
9649
9649
|
}
|
|
@@ -9652,7 +9652,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9652
9652
|
/** Ensure a package is built (dist/ exists and page bundles present) */
|
|
9653
9653
|
async ensureBuilt(packageName, sourceDir, pkgData) {
|
|
9654
9654
|
const distDir = path$1.join(sourceDir, "dist");
|
|
9655
|
-
if (!(!fs.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
|
|
9655
|
+
if (!(!fs$1.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
|
|
9656
9656
|
this.logger.info(`${packageName} — building (dist/ missing or incomplete)`);
|
|
9657
9657
|
try {
|
|
9658
9658
|
await runNpm(["run", "build"], this.npmRunOptions(sourceDir, 18e4));
|
|
@@ -9667,7 +9667,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9667
9667
|
if (!camstack?.addons) return false;
|
|
9668
9668
|
for (const addon of camstack.addons) {
|
|
9669
9669
|
if (!addon.pages) continue;
|
|
9670
|
-
for (const page of addon.pages) if (page.bundle && !fs.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
|
|
9670
|
+
for (const page of addon.pages) if (page.bundle && !fs$1.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
|
|
9671
9671
|
}
|
|
9672
9672
|
return false;
|
|
9673
9673
|
}
|
|
@@ -9676,7 +9676,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9676
9676
|
function isDirEntry(entry, parentDir) {
|
|
9677
9677
|
if (entry.isDirectory()) return true;
|
|
9678
9678
|
if (entry.isSymbolicLink()) try {
|
|
9679
|
-
return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
9679
|
+
return fs$1.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
9680
9680
|
} catch {
|
|
9681
9681
|
return false;
|
|
9682
9682
|
}
|
|
@@ -9775,7 +9775,7 @@ function selectAddonResidue(candidates) {
|
|
|
9775
9775
|
}
|
|
9776
9776
|
function readDeclaredName(dir) {
|
|
9777
9777
|
try {
|
|
9778
|
-
const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9778
|
+
const parsed = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9779
9779
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
9780
9780
|
const name = parsed.name;
|
|
9781
9781
|
return typeof name === "string" ? name : null;
|
|
@@ -9785,7 +9785,7 @@ function readDeclaredName(dir) {
|
|
|
9785
9785
|
}
|
|
9786
9786
|
function readDeclaredVersion(dir) {
|
|
9787
9787
|
try {
|
|
9788
|
-
const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9788
|
+
const parsed = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9789
9789
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
9790
9790
|
const version = parsed.version;
|
|
9791
9791
|
return typeof version === "string" ? version : null;
|
|
@@ -9795,7 +9795,7 @@ function readDeclaredVersion(dir) {
|
|
|
9795
9795
|
}
|
|
9796
9796
|
function isDirLike(p) {
|
|
9797
9797
|
try {
|
|
9798
|
-
return fs.statSync(p).isDirectory();
|
|
9798
|
+
return fs$1.statSync(p).isDirectory();
|
|
9799
9799
|
} catch {
|
|
9800
9800
|
return false;
|
|
9801
9801
|
}
|
|
@@ -9805,7 +9805,7 @@ function freeQuarantineTarget(store, scope, dirName) {
|
|
|
9805
9805
|
const base = scope === null ? dirName : `${scope.replace("@", "")}__${dirName}`;
|
|
9806
9806
|
let candidate = path$1.join(store, base);
|
|
9807
9807
|
let n = 1;
|
|
9808
|
-
while (fs.existsSync(candidate)) {
|
|
9808
|
+
while (fs$1.existsSync(candidate)) {
|
|
9809
9809
|
candidate = path$1.join(store, `${base}-${n}`);
|
|
9810
9810
|
n += 1;
|
|
9811
9811
|
}
|
|
@@ -9822,7 +9822,7 @@ function freeQuarantineTarget(store, scope, dirName) {
|
|
|
9822
9822
|
function quarantineAddonResidue(addonsDir, log) {
|
|
9823
9823
|
const quarantined = [];
|
|
9824
9824
|
const failed = [];
|
|
9825
|
-
if (!fs.existsSync(addonsDir)) return {
|
|
9825
|
+
if (!fs$1.existsSync(addonsDir)) return {
|
|
9826
9826
|
quarantined,
|
|
9827
9827
|
failed
|
|
9828
9828
|
};
|
|
@@ -9830,7 +9830,7 @@ function quarantineAddonResidue(addonsDir, log) {
|
|
|
9830
9830
|
const scan = (parent, scope) => {
|
|
9831
9831
|
let names;
|
|
9832
9832
|
try {
|
|
9833
|
-
names = fs.readdirSync(parent);
|
|
9833
|
+
names = fs$1.readdirSync(parent);
|
|
9834
9834
|
} catch {
|
|
9835
9835
|
return;
|
|
9836
9836
|
}
|
|
@@ -9849,8 +9849,8 @@ function quarantineAddonResidue(addonsDir, log) {
|
|
|
9849
9849
|
const version = readDeclaredVersion(full);
|
|
9850
9850
|
const to = freeQuarantineTarget(store, scope, dirName);
|
|
9851
9851
|
try {
|
|
9852
|
-
fs.mkdirSync(store, { recursive: true });
|
|
9853
|
-
fs.renameSync(full, to);
|
|
9852
|
+
fs$1.mkdirSync(store, { recursive: true });
|
|
9853
|
+
fs$1.renameSync(full, to);
|
|
9854
9854
|
} catch (err) {
|
|
9855
9855
|
const error = err instanceof Error ? err.message : String(err);
|
|
9856
9856
|
failed.push({
|
|
@@ -9908,11 +9908,11 @@ function getRestartMarkerPath(dataDir) {
|
|
|
9908
9908
|
* intact or no marker at all (never a half-written file).
|
|
9909
9909
|
*/
|
|
9910
9910
|
function writePendingRestart(dataDir, marker) {
|
|
9911
|
-
fs.mkdirSync(dataDir, { recursive: true });
|
|
9911
|
+
fs$1.mkdirSync(dataDir, { recursive: true });
|
|
9912
9912
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
9913
9913
|
const tmpPath = `${markerPath}.tmp`;
|
|
9914
|
-
fs.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
|
|
9915
|
-
fs.renameSync(tmpPath, markerPath);
|
|
9914
|
+
fs$1.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
|
|
9915
|
+
fs$1.renameSync(tmpPath, markerPath);
|
|
9916
9916
|
}
|
|
9917
9917
|
/**
|
|
9918
9918
|
* Read + consume the marker. Returns the parsed payload on success and
|
|
@@ -9937,10 +9937,10 @@ function writePendingRestart(dataDir, marker) {
|
|
|
9937
9937
|
*/
|
|
9938
9938
|
function readPendingRestart(dataDir) {
|
|
9939
9939
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
9940
|
-
if (!fs.existsSync(markerPath)) return null;
|
|
9940
|
+
if (!fs$1.existsSync(markerPath)) return null;
|
|
9941
9941
|
let raw;
|
|
9942
9942
|
try {
|
|
9943
|
-
raw = fs.readFileSync(markerPath, "utf-8");
|
|
9943
|
+
raw = fs$1.readFileSync(markerPath, "utf-8");
|
|
9944
9944
|
} catch (err) {
|
|
9945
9945
|
console.error("[restart-coordinator] Marker unreadable — leaving in place:", err);
|
|
9946
9946
|
return null;
|
|
@@ -9979,7 +9979,7 @@ function readPendingRestart(dataDir) {
|
|
|
9979
9979
|
/** Remove the marker if present. No-op if missing. */
|
|
9980
9980
|
function clearPendingRestart(dataDir) {
|
|
9981
9981
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
9982
|
-
fs.rmSync(markerPath, { force: true });
|
|
9982
|
+
fs$1.rmSync(markerPath, { force: true });
|
|
9983
9983
|
}
|
|
9984
9984
|
function isRestartKind(value) {
|
|
9985
9985
|
return value === "framework-update" || value === "manual" || value === "system";
|
|
@@ -9991,7 +9991,7 @@ function scheduleSelfRestart(options = {}) {
|
|
|
9991
9991
|
const touchTarget = process.env["CAMSTACK_RESTART_TOUCH_FILE"];
|
|
9992
9992
|
if (touchTarget !== void 0 && touchTarget.length > 0) try {
|
|
9993
9993
|
const now = /* @__PURE__ */ new Date();
|
|
9994
|
-
fs.utimesSync(touchTarget, now, now);
|
|
9994
|
+
fs$1.utimesSync(touchTarget, now, now);
|
|
9995
9995
|
return;
|
|
9996
9996
|
} catch (err) {
|
|
9997
9997
|
console.error("[restart-coordinator] dev touch-reload failed; falling through to process exit:", err);
|
|
@@ -14384,7 +14384,7 @@ function legacyConfigYamlCandidates(env) {
|
|
|
14384
14384
|
];
|
|
14385
14385
|
}
|
|
14386
14386
|
function findLegacyFile(env) {
|
|
14387
|
-
return legacyConfigYamlCandidates(env).find((candidate) => fs.existsSync(candidate));
|
|
14387
|
+
return legacyConfigYamlCandidates(env).find((candidate) => fs$1.existsSync(candidate));
|
|
14388
14388
|
}
|
|
14389
14389
|
/** The legacy value of a key when it is well-formed, else undefined. */
|
|
14390
14390
|
function legacyValue(server, key) {
|
|
@@ -14420,7 +14420,7 @@ function reconcileLegacyConfigYaml(env, effective) {
|
|
|
14420
14420
|
if (file === void 0) return NOTHING_TO_APPLY;
|
|
14421
14421
|
let raw;
|
|
14422
14422
|
try {
|
|
14423
|
-
raw = asJsonObject(load(fs.readFileSync(file, "utf-8"))) ?? {};
|
|
14423
|
+
raw = asJsonObject(load(fs$1.readFileSync(file, "utf-8"))) ?? {};
|
|
14424
14424
|
} catch (err) {
|
|
14425
14425
|
return {
|
|
14426
14426
|
overrides: {},
|
|
@@ -22889,7 +22889,7 @@ async function probeVaapiInit(renderNode) {
|
|
|
22889
22889
|
*/
|
|
22890
22890
|
function safeExistsSync(path) {
|
|
22891
22891
|
try {
|
|
22892
|
-
return fs.existsSync(path);
|
|
22892
|
+
return fs$1.existsSync(path);
|
|
22893
22893
|
} catch {
|
|
22894
22894
|
return false;
|
|
22895
22895
|
}
|
|
@@ -22908,11 +22908,11 @@ function probeLinuxGpus() {
|
|
|
22908
22908
|
if (safeExistsSync("/dev/nvidia0") || safeExistsSync("/proc/driver/nvidia/version")) signals.hasNvidiaGpu = true;
|
|
22909
22909
|
try {
|
|
22910
22910
|
const drmDir = "/sys/class/drm";
|
|
22911
|
-
if (fs.existsSync(drmDir)) for (const entry of fs.readdirSync(drmDir)) {
|
|
22911
|
+
if (fs$1.existsSync(drmDir)) for (const entry of fs$1.readdirSync(drmDir)) {
|
|
22912
22912
|
if (!entry.startsWith("card")) continue;
|
|
22913
22913
|
const vendorPath = `${drmDir}/${entry}/device/vendor`;
|
|
22914
22914
|
if (!safeExistsSync(vendorPath)) continue;
|
|
22915
|
-
const vendor = fs.readFileSync(vendorPath, "utf8").trim().toLowerCase();
|
|
22915
|
+
const vendor = fs$1.readFileSync(vendorPath, "utf8").trim().toLowerCase();
|
|
22916
22916
|
if (vendor === "0x10de") signals.hasNvidiaGpu = true;
|
|
22917
22917
|
else if (vendor === "0x1002") signals.hasAmdGpu = true;
|
|
22918
22918
|
else if (vendor === "0x8086") signals.hasIntelGpu = true;
|
|
@@ -23130,21 +23130,21 @@ function sleep$1(ms) {
|
|
|
23130
23130
|
* crashed holder) is stolen.
|
|
23131
23131
|
*/
|
|
23132
23132
|
async function withFileLock(lockPath, fn) {
|
|
23133
|
-
fs.mkdirSync(join(lockPath, ".."), { recursive: true });
|
|
23133
|
+
fs$1.mkdirSync(join(lockPath, ".."), { recursive: true });
|
|
23134
23134
|
for (;;) try {
|
|
23135
|
-
const fd = fs.openSync(lockPath, "wx");
|
|
23136
|
-
fs.closeSync(fd);
|
|
23135
|
+
const fd = fs$1.openSync(lockPath, "wx");
|
|
23136
|
+
fs$1.closeSync(fd);
|
|
23137
23137
|
break;
|
|
23138
23138
|
} catch {
|
|
23139
23139
|
try {
|
|
23140
|
-
if (Date.now() - fs.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs.rmSync(lockPath, { force: true });
|
|
23140
|
+
if (Date.now() - fs$1.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs$1.rmSync(lockPath, { force: true });
|
|
23141
23141
|
else await sleep$1(LOCK_POLL_MS);
|
|
23142
23142
|
} catch {}
|
|
23143
23143
|
}
|
|
23144
23144
|
try {
|
|
23145
23145
|
return await fn();
|
|
23146
23146
|
} finally {
|
|
23147
|
-
fs.rmSync(lockPath, { force: true });
|
|
23147
|
+
fs$1.rmSync(lockPath, { force: true });
|
|
23148
23148
|
}
|
|
23149
23149
|
}
|
|
23150
23150
|
/** Coalesce in-process + serialize cross-process for one binary id. */
|
|
@@ -23202,7 +23202,7 @@ var AddonDepsManager = class {
|
|
|
23202
23202
|
* failed or tampered download throws, and provisioning reports it.
|
|
23203
23203
|
*/
|
|
23204
23204
|
async stageNativeDepsDeclaredBy(requirementsFile) {
|
|
23205
|
-
if (!declaresEdgetpuDelegate(fs.readFileSync(requirementsFile, "utf8"))) return;
|
|
23205
|
+
if (!declaresEdgetpuDelegate(fs$1.readFileSync(requirementsFile, "utf8"))) return;
|
|
23206
23206
|
await singleFlight(this.depsDir, "edgetpu-delegate", () => ensureEdgetpuDelegate(this.nodeRoot, this.logger));
|
|
23207
23207
|
}
|
|
23208
23208
|
getDepsDir() {
|
|
@@ -24233,7 +24233,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
|
|
|
24233
24233
|
const addonId = declaration.id;
|
|
24234
24234
|
const nodeDataDir = process.env["CAMSTACK_DATA"] ?? dataDir;
|
|
24235
24235
|
const addonDataDir = path$1.resolve(nodeDataDir, "addons-data", addonId);
|
|
24236
|
-
fs.mkdirSync(addonDataDir, { recursive: true });
|
|
24236
|
+
fs$1.mkdirSync(addonDataDir, { recursive: true });
|
|
24237
24237
|
if (runtime.mode === "broker") ensureBindingSubscription(runtime.broker);
|
|
24238
24238
|
const regs = getRegistries(nodeId);
|
|
24239
24239
|
const workerResolver = {
|
|
@@ -26183,7 +26183,7 @@ var FailedRunnerRetryLedger = class {
|
|
|
26183
26183
|
function readRunnerPackageVersions(addonDirs) {
|
|
26184
26184
|
const out = {};
|
|
26185
26185
|
for (const dir of addonDirs) try {
|
|
26186
|
-
const raw = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
26186
|
+
const raw = JSON.parse(fs$1.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
26187
26187
|
const version = typeof raw === "object" && raw !== null ? Reflect.get(raw, "version") : null;
|
|
26188
26188
|
out[dir] = typeof version === "string" && version.length > 0 ? version : null;
|
|
26189
26189
|
} catch {
|
|
@@ -26244,7 +26244,7 @@ function readAddonHeapDeclaration(spec) {
|
|
|
26244
26244
|
if (cached !== void 0) return cached;
|
|
26245
26245
|
let declaration = EMPTY_HEAP_DECLARATION;
|
|
26246
26246
|
for (const manifestPath of [path$1.join(spec.addonDir, "package.json"), path$1.join(path$1.dirname(spec.addonDir), "package.json")]) try {
|
|
26247
|
-
const raw = fs.readFileSync(manifestPath, "utf8");
|
|
26247
|
+
const raw = fs$1.readFileSync(manifestPath, "utf8");
|
|
26248
26248
|
const parsed = JSON.parse(raw);
|
|
26249
26249
|
const profile = extractHeapProfile(parsed, spec.addonId);
|
|
26250
26250
|
const maxOldSpaceMb = extractMaxOldSpaceMb(parsed, spec.addonId);
|
|
@@ -27477,17 +27477,17 @@ var JobJournal = class {
|
|
|
27477
27477
|
return path$1.join(this.jobsDir, `${id}.json`);
|
|
27478
27478
|
}
|
|
27479
27479
|
writeAtomic(filePath, data) {
|
|
27480
|
-
fs.mkdirSync(path$1.dirname(filePath), { recursive: true });
|
|
27480
|
+
fs$1.mkdirSync(path$1.dirname(filePath), { recursive: true });
|
|
27481
27481
|
const tmp = `${filePath}.tmp.${process.pid}.${Date.now()}`;
|
|
27482
|
-
fs.writeFileSync(tmp, JSON.stringify(data, null, 2), {
|
|
27482
|
+
fs$1.writeFileSync(tmp, JSON.stringify(data, null, 2), {
|
|
27483
27483
|
encoding: "utf-8",
|
|
27484
27484
|
mode: 384
|
|
27485
27485
|
});
|
|
27486
|
-
fs.renameSync(tmp, filePath);
|
|
27486
|
+
fs$1.renameSync(tmp, filePath);
|
|
27487
27487
|
}
|
|
27488
27488
|
readIndex() {
|
|
27489
27489
|
try {
|
|
27490
|
-
const raw = JSON.parse(fs.readFileSync(this.indexPath, "utf-8"));
|
|
27490
|
+
const raw = JSON.parse(fs$1.readFileSync(this.indexPath, "utf-8"));
|
|
27491
27491
|
if (raw && Array.isArray(raw.jobIds)) return {
|
|
27492
27492
|
version: 1,
|
|
27493
27493
|
jobIds: raw.jobIds
|
|
@@ -27512,7 +27512,7 @@ var JobJournal = class {
|
|
|
27512
27512
|
}
|
|
27513
27513
|
getJob(id) {
|
|
27514
27514
|
try {
|
|
27515
|
-
const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs.readFileSync(this.jobPath(id), "utf-8")));
|
|
27515
|
+
const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs$1.readFileSync(this.jobPath(id), "utf-8")));
|
|
27516
27516
|
return parsed.success ? parsed.data : null;
|
|
27517
27517
|
} catch {
|
|
27518
27518
|
return null;
|
|
@@ -27577,14 +27577,14 @@ var StagingArea = class {
|
|
|
27577
27577
|
}
|
|
27578
27578
|
async fetchAndStage(input) {
|
|
27579
27579
|
const destDir = path$1.join(this.stagingDir, input.jobId, safeSegment(input.name));
|
|
27580
|
-
fs.rmSync(destDir, {
|
|
27580
|
+
fs$1.rmSync(destDir, {
|
|
27581
27581
|
recursive: true,
|
|
27582
27582
|
force: true
|
|
27583
27583
|
});
|
|
27584
27584
|
const tgz = await this.deps.fetchTarball(input.name, input.version, input.signal);
|
|
27585
27585
|
if (input.signal.aborted) throw new Error("staging aborted after fetch");
|
|
27586
27586
|
await this.deps.extract(tgz, destDir);
|
|
27587
|
-
const raw = JSON.parse(fs.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
|
|
27587
|
+
const raw = JSON.parse(fs$1.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
|
|
27588
27588
|
if (typeof raw.version !== "string" || raw.version.length === 0) throw new Error(`staging validation failed: ${input.name} staged a package.json with no version`);
|
|
27589
27589
|
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}`);
|
|
27590
27590
|
return {
|
|
@@ -27593,7 +27593,7 @@ var StagingArea = class {
|
|
|
27593
27593
|
};
|
|
27594
27594
|
}
|
|
27595
27595
|
cleanup(jobId) {
|
|
27596
|
-
fs.rmSync(path$1.join(this.stagingDir, jobId), {
|
|
27596
|
+
fs$1.rmSync(path$1.join(this.stagingDir, jobId), {
|
|
27597
27597
|
recursive: true,
|
|
27598
27598
|
force: true
|
|
27599
27599
|
});
|
|
@@ -27608,13 +27608,13 @@ var StagingArea = class {
|
|
|
27608
27608
|
sweepOrphans() {
|
|
27609
27609
|
let entries;
|
|
27610
27610
|
try {
|
|
27611
|
-
entries = fs.readdirSync(this.stagingDir);
|
|
27611
|
+
entries = fs$1.readdirSync(this.stagingDir);
|
|
27612
27612
|
} catch {
|
|
27613
27613
|
return 0;
|
|
27614
27614
|
}
|
|
27615
27615
|
let removed = 0;
|
|
27616
27616
|
for (const name of entries) try {
|
|
27617
|
-
fs.rmSync(path$1.join(this.stagingDir, name), {
|
|
27617
|
+
fs$1.rmSync(path$1.join(this.stagingDir, name), {
|
|
27618
27618
|
recursive: true,
|
|
27619
27619
|
force: true
|
|
27620
27620
|
});
|
|
@@ -27792,7 +27792,7 @@ var LifecycleJobEngine = class {
|
|
|
27792
27792
|
* on failure → `failed`.
|
|
27793
27793
|
*/
|
|
27794
27794
|
async reconcileJob(job) {
|
|
27795
|
-
const exists = this.deps.stagedPathExists ?? ((p) => fs.existsSync(p));
|
|
27795
|
+
const exists = this.deps.stagedPathExists ?? ((p) => fs$1.existsSync(p));
|
|
27796
27796
|
for (const task of job.tasks) {
|
|
27797
27797
|
if (task.target === "framework") {
|
|
27798
27798
|
if (!this.isTerminal(task.phase)) this.skipFrameworkTask(job, task);
|
|
@@ -28122,7 +28122,8 @@ var en_default = {
|
|
|
28122
28122
|
"globalSettings.s_local-access.tlsEnabled.description": "On by default. Turn off only behind a reverse proxy that terminates TLS for you: browsers refuse passkeys, the camera and the microphone over plain HTTP. Applies after the hub restarts.",
|
|
28123
28123
|
"timedRunConfig.timedRun_quickRunDuration.label": "One-tap run",
|
|
28124
28124
|
"section.s_timed-run.title": "One-tap run",
|
|
28125
|
-
"section.s_timed-run.description": "How long the Run button starts this device for. The hub switches it off when the time is up."
|
|
28125
|
+
"section.s_timed-run.description": "How long the Run button starts this device for. The hub switches it off when the time is up.",
|
|
28126
|
+
"integration-instances.addon-not-running": "\"{{addon}}\" is not running: start it first"
|
|
28126
28127
|
};
|
|
28127
28128
|
//#endregion
|
|
28128
28129
|
//#region src/i18n/it.json
|
|
@@ -28384,7 +28385,8 @@ var it_default = {
|
|
|
28384
28385
|
"globalSettings.s_local-access.tlsEnabled.description": "Attivo per impostazione predefinita. Disattivalo solo dietro un reverse proxy che termina il TLS: i browser rifiutano passkey, fotocamera e microfono su HTTP semplice. Si applica al riavvio dell'hub.",
|
|
28385
28386
|
"timedRunConfig.timedRun_quickRunDuration.label": "Avvio rapido",
|
|
28386
28387
|
"section.s_timed-run.title": "Avvio rapido",
|
|
28387
|
-
"section.s_timed-run.description": "Per quanto tempo il pulsante Avvia accende questo dispositivo. L'hub lo spegne allo scadere del tempo."
|
|
28388
|
+
"section.s_timed-run.description": "Per quanto tempo il pulsante Avvia accende questo dispositivo. L'hub lo spegne allo scadere del tempo.",
|
|
28389
|
+
"integration-instances.addon-not-running": "\"{{addon}}\" non è in esecuzione: avvialo prima"
|
|
28388
28390
|
};
|
|
28389
28391
|
//#endregion
|
|
28390
28392
|
//#region src/i18n/catalog-registry.ts
|
|
@@ -28427,7 +28429,7 @@ var CatalogRegistry = class {
|
|
|
28427
28429
|
const file = path$1.join(packageDir, "i18n", `${lang}.json`);
|
|
28428
28430
|
let text;
|
|
28429
28431
|
try {
|
|
28430
|
-
text = fs.readFileSync(file, "utf8");
|
|
28432
|
+
text = fs$1.readFileSync(file, "utf8");
|
|
28431
28433
|
} catch {
|
|
28432
28434
|
continue;
|
|
28433
28435
|
}
|