@camstack/server 1.2.926 → 1.2.928
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 +14 -0
- package/package.json +10 -17
- 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 +4 -4
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +4 -4
- package/system/dist/builtins/core-notifier/core-notifier.addon.js +1 -1
- package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +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 +103 -55
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +103 -55
- package/system/dist/builtins/device-manager/transitions/transition-correlator.d.ts +24 -11
- 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.d.ts +13 -0
- package/system/dist/builtins/local-network/local-network.addon.js +47 -10
- package/system/dist/builtins/local-network/local-network.addon.mjs +47 -10
- 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-BEXh051r.js → capture-engine-BcuwOSXv.js} +1 -1
- package/system/dist/{capture-engine-CWfylyT8.mjs → capture-engine-Bz7eXFjT.mjs} +1 -1
- package/system/dist/{composition-sources-CcpMUxus.mjs → composition-sources-BI614LJx.mjs} +1 -1
- package/system/dist/{composition-sources-B3_FuKde.js → composition-sources-v_kkb8A9.js} +1 -1
- package/system/dist/{constants-fPesBGmF.mjs → constants-BcUTQd1M.mjs} +1 -1
- package/system/dist/{constants-B0tqNa2l.js → constants-D2etJ02O.js} +1 -1
- package/system/dist/{coral-accelerators-DBlgWB8k.mjs → coral-accelerators-BW3OcrLD.mjs} +6 -6
- package/system/dist/{custom-action-registry-B9zFBNVa.mjs → custom-action-registry-N7flBDwT.mjs} +37 -37
- package/system/dist/{device-ca-Bh0GEstW.js → device-ca-CU8zh9Pi.js} +1 -1
- package/system/dist/{device-ca-B98SR8Xf.mjs → device-ca-ExMN3xW3.mjs} +1 -1
- package/system/dist/{device-row-store-CfWN8mLZ.js → device-row-store-BMIR-n3m.js} +1 -1
- package/system/dist/{device-row-store-BBByy029.mjs → device-row-store-CeW_GWh9.mjs} +1 -1
- package/system/dist/{dist-CH-iCceM.mjs → dist-BCHMSqzc.mjs} +325 -2
- package/system/dist/{dist-CVjsCA7D.js → dist-BZfvhfS1.js} +325 -2
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-identity-DCqJbSVn.mjs → hub-identity-CYC1820R.mjs} +10 -10
- package/system/dist/{hub-identity-BU4XzogT.js → hub-identity-Csxx2Q8k.js} +1 -1
- package/system/dist/{hub-mdns-ciao-BNzmwsIH.js → hub-mdns-ciao-By5577HM.js} +2 -2
- package/system/dist/{hub-mdns-ciao-IOM82NRd.mjs → hub-mdns-ciao-CCDxM5qz.mjs} +2 -2
- package/system/dist/index.js +8 -8
- package/system/dist/index.mjs +217 -217
- package/system/dist/{legacy-integration-rows-door-CRcvhOWb.js → legacy-integration-rows-door-CVwOo5aq.js} +1 -1
- package/system/dist/{legacy-integration-rows-door-nQzjUyPU.mjs → legacy-integration-rows-door-D9tQOUzh.mjs} +1 -1
- package/system/dist/{rename-composition-block-oOfXrUWs.js → rename-composition-block-C9HuBrKS.js} +1 -1
- package/system/dist/{rename-composition-block-CJ-C9HoY.mjs → rename-composition-block-DtaYmYAR.mjs} +1 -1
- package/system/dist/{restore-archive-DaYf1tQb.mjs → restore-archive-BJfyu0sG.mjs} +94 -94
- package/system/dist/{restore-archive-BSdudYif.js → restore-archive-CIFvqOze.js} +1 -1
- package/system/dist/{wal-maintenance-CyOVe3E1.mjs → wal-maintenance-CTrCPzds.mjs} +0 -0
- package/system/dist/{wal-maintenance-BRc_MNtZ.js → wal-maintenance-dq7T3quB.js} +0 -0
- package/system/package.json +1 -1
package/system/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as __require } from "./chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { A as CatalogFileSchema, Al as collectSecretMarkerRefs, Au as supportedRuntimes, Bc as DATAPLANE_SECRET_HEADER$1, C as CATALOG_LANGS, Cl as asString$1, Ea as looseSchema, Er as compareVersions, Gl as expandCapMethods, Hc as DEVICE_STATUS_METHOD, Ho as resolveMethodAuth, Hu as errMsg$1, Ji as isAddonInstanceId, Ls as unmetRequirements, Lt as LOG_LEVEL_RANK, Lu as withoutCallerStamp, Pl as createEvent$1, Pu as userError, Qi as isArrayOutputSchema, Ql as isDebugChannelName, Qr as describeUnmet, Sl as asNumber, Ta as logLevelAtMost, Vc as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Vl as emitDownForOwnedCaps, Wn as addonSettingsCapability, Wu as EventCategory$1, Xa as objectInputDeclaresRequiredDeviceId, Ya as objectInputDeclaresAddonId, _a as lifecycleJobSchema, a as AGENT_MDNS_SERVICE_TYPE, al as ReadinessRegistry, bi as extractNestedAddonId, da as kebabToCamel$1, ea as isCollectionArrayMethod, er as bareAddonId, gs as splitTranslationRef, gu as parseJsonUnknown, hu as parseJsonObject, il as RUNTIME_DEFAULTS, la as isVoidInput, nn as PackageRequiresSchema, ns as scopesAllowDeviceCap, o as AGENT_MDNS_TXT_KEYS, ol as ReadinessTimeoutError, po as procedureAuthKey, qi as interpolate, ql as getDebugInterest, s as ALL_CAPABILITY_DEFINITIONS, sa as isObjectInput, ts as scopesAllowAddon, wu as scopeKey, xl as asJsonObject$1, xu as resolveCapMount, yu as readinessKey, zc as CALLER_STAMPED_CAPABILITIES$1, zl as defineRecordKinds, zt as METHOD_ACCESS_MAP } from "./dist-
|
|
3
|
-
import { d as JWT_SIGNING_KEY_REF, f as JwtSigningKeyUnavailableError, g as processJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, p as SYSTEM_SECRET_OWNER, s as loadDeviceCa, u as verifyDeviceSignature, v as staticJwtSigningKey } from "./device-ca-
|
|
2
|
+
import { A as CatalogFileSchema, Al as collectSecretMarkerRefs, Au as supportedRuntimes, Bc as DATAPLANE_SECRET_HEADER$1, C as CATALOG_LANGS, Cl as asString$1, Ea as looseSchema, Er as compareVersions, Gl as expandCapMethods, Hc as DEVICE_STATUS_METHOD, Ho as resolveMethodAuth, Hu as errMsg$1, Ji as isAddonInstanceId, Ls as unmetRequirements, Lt as LOG_LEVEL_RANK, Lu as withoutCallerStamp, Pl as createEvent$1, Pu as userError, Qi as isArrayOutputSchema, Ql as isDebugChannelName, Qr as describeUnmet, Sl as asNumber, Ta as logLevelAtMost, Vc as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Vl as emitDownForOwnedCaps, Wn as addonSettingsCapability, Wu as EventCategory$1, Xa as objectInputDeclaresRequiredDeviceId, Ya as objectInputDeclaresAddonId, _a as lifecycleJobSchema, a as AGENT_MDNS_SERVICE_TYPE, al as ReadinessRegistry, bi as extractNestedAddonId, da as kebabToCamel$1, ea as isCollectionArrayMethod, er as bareAddonId, gs as splitTranslationRef, gu as parseJsonUnknown, hu as parseJsonObject, il as RUNTIME_DEFAULTS, la as isVoidInput, nn as PackageRequiresSchema, ns as scopesAllowDeviceCap, o as AGENT_MDNS_TXT_KEYS, ol as ReadinessTimeoutError, po as procedureAuthKey, qi as interpolate, ql as getDebugInterest, s as ALL_CAPABILITY_DEFINITIONS, sa as isObjectInput, ts as scopesAllowAddon, wu as scopeKey, xl as asJsonObject$1, xu as resolveCapMount, yu as readinessKey, zc as CALLER_STAMPED_CAPABILITIES$1, zl as defineRecordKinds, zt as METHOD_ACCESS_MAP } from "./dist-BCHMSqzc.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-ExMN3xW3.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";
|
|
@@ -29,29 +29,29 @@ import { LokiDestination, LokiLoggingAddon } from "./builtins/loki-logging/index
|
|
|
29
29
|
import NativeMetricsAddon, { a as NativeMetricsProvider, i as parseProcStatusRss, n as nodeProcReader, r as parseProcStat } from "./builtins/native-metrics/native-metrics.addon.mjs";
|
|
30
30
|
import { DeviceHistoryAddon } from "./builtins/device-history/device-history.addon.mjs";
|
|
31
31
|
import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./builtins/sqlite-storage/filesystem-storage.addon.mjs";
|
|
32
|
-
import { D as RecordsEngine, l as SqliteSettingsBackend } from "./wal-maintenance-
|
|
33
|
-
import { n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows } from "./legacy-integration-rows-door-
|
|
32
|
+
import { D as RecordsEngine, l as SqliteSettingsBackend } from "./wal-maintenance-CTrCPzds.mjs";
|
|
33
|
+
import { n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows } from "./legacy-integration-rows-door-D9tQOUzh.mjs";
|
|
34
34
|
import { SqliteSettingsAddon } from "./builtins/sqlite-storage/sqlite-settings.addon.mjs";
|
|
35
35
|
import { ConfigStore, DeviceStore } from "./builtins/sqlite-storage/index.mjs";
|
|
36
36
|
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";
|
|
37
37
|
import "./builtins/storage-orchestrator/index.mjs";
|
|
38
|
-
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-
|
|
39
|
-
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-
|
|
38
|
+
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-CYC1820R.mjs";
|
|
39
|
+
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-BcUTQd1M.mjs";
|
|
40
40
|
import { $ as getProcessMeshCaState, A as emitProcessNodeRegistered, At as readCidrSetting, B as getProcessMeshTlsListenerState, C as verifyMembershipAnswer, Ct as isInsecureOrigin, D as ServiceBroker, Dt as createCidrMatcher, E as Errors, Et as readOriginSetting, F as onProcessNodeRegistered, G as MeshCertificateRegistry, H as setProcessMeshTlsListenerState, I as setProcessMeshHandshakeReporter, J as getProcessMeshCertificateRegistry, K as RENEWAL_ABANDONED, L as setProcessMeshPeerTransportLookup, M as getProcessNodeMeshTransport, N as getProcessPeerLeaf, O as setProcessMeshTlsEnabler, Ot as normalizeIp, P as isProcessVerifiedMeshPeer, Q as MeshCaKeeper, R as renewMeshCertificate, S as signMembershipProof, St as OPAQUE_ORIGIN, SystemConfigAddon, T as TlsTcpTransporter, Tt as parseOriginList, U as MESH_NODE_CERTIFICATES_COLLECTION, V as openMeshTlsWhenRevocationsLoaded, W as MESH_NODE_CERTIFICATES_COLUMNS, X as MeshCrl, Y as setProcessMeshCertificateRegistry, Z as processMeshCrl, _ as keyFingerprintShort, _t as isAllowedAgentDashboardReturnTo, a as dialableHubHost, at as generateMeshCa, b as MEMBERSHIP_PATHS, bt as verifyAgentUiUnlockTicket, c as PAIRING_MAX_CODE_ATTEMPTS, ct as issueMeshLeafForNode, d as PAIRING_PIN_DIGITS, dt as AGENT_DASHBOARD_ORIGINS_FIELD, et as requireProcessMeshCa, f as PAIRING_PROTOCOL, ft as AGENT_UI_UNLOCK_TTL_MS, g as describeCsr, gt as UnlockTicketJtiStore, h as computePairingSas, ht as AGENT_UI_UNLOCK_VERSION, i as AgentPairing, it as exportMeshPrivateKeyPem, j as getProcessMeshHandshakeReporter, k as dropProcessPeer, kt as parseCidrList, l as PAIRING_MAX_SESSIONS, lt as issueMeshLeafFromCsr, m as computePairingCommitment, mt as AGENT_UI_UNLOCK_USE, n as HubPairing, nt as caFingerprintCompact, o as hubHostFromMeshAddress, ot as generateMeshKeyPair, p as PAIRING_TTL_MS, pt as AGENT_UI_UNLOCK_TYP, q as describeMeshLeaf, r as PairingHttpError, rt as createMeshCsrPem, s as PAIRING_CODE_DIGITS, st as isValidAgentNodeId, tt as caFingerprint, u as PAIRING_PATHS, ut as loadMeshCa, v as signPairingProof, vt as mintAgentUiUnlockTicket, w as MESH_TLS_PORT_HELLO_FIELD, wt as normalizeOrigin, x as MembershipResponder, xt as InvalidCorsOriginError, y as verifyPairingProof, yt as parseAgentDashboardOrigins, z as revokeMeshCertificate } from "./builtins/system-config/system-config.addon.mjs";
|
|
41
41
|
import "./builtins/system-config/index.mjs";
|
|
42
42
|
import { WinstonDestination, WinstonLoggingAddon } from "./builtins/winston-logging/index.mjs";
|
|
43
|
-
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-
|
|
44
|
-
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-
|
|
43
|
+
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-N7flBDwT.mjs";
|
|
44
|
+
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-CCDxM5qz.mjs";
|
|
45
45
|
import { n as getPlatformKeychainKey, r as setPlatformKeychainKey, t as clearPlatformKeychainKey } from "./platform-key-source-BWlq0jjn.mjs";
|
|
46
46
|
import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-Di9daRwI.mjs";
|
|
47
|
-
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-
|
|
48
|
-
import { r as nodeCoralFs, t as classifyCoralAccelerator } from "./coral-accelerators-
|
|
47
|
+
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-BJfyu0sG.mjs";
|
|
48
|
+
import { r as nodeCoralFs, t as classifyCoralAccelerator } from "./coral-accelerators-BW3OcrLD.mjs";
|
|
49
49
|
import { z } from "zod";
|
|
50
50
|
import * as crypto$1 from "node:crypto";
|
|
51
51
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
52
52
|
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";
|
|
53
53
|
import { connect, createConnection, createServer } from "node:net";
|
|
54
|
-
import * as fs
|
|
54
|
+
import * as fs from "node:fs";
|
|
55
55
|
import { accessSync, constants, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync } from "node:fs";
|
|
56
56
|
import * as path$1 from "node:path";
|
|
57
57
|
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
@@ -5088,7 +5088,7 @@ var PythonEnvManager = class {
|
|
|
5088
5088
|
async ensure(options) {
|
|
5089
5089
|
const probe = await this.probe();
|
|
5090
5090
|
if (!probe.available || !probe.path) throw userError("system.python-required", void 0, "Python 3.10+ is required but not found on this system");
|
|
5091
|
-
if (!fs
|
|
5091
|
+
if (!fs.existsSync(path$1.join(this.venvPath, "bin", "python"))) await execFileAsync$7(probe.path, [
|
|
5092
5092
|
"-m",
|
|
5093
5093
|
"venv",
|
|
5094
5094
|
this.venvPath
|
|
@@ -5111,7 +5111,7 @@ var PythonEnvManager = class {
|
|
|
5111
5111
|
}
|
|
5112
5112
|
spawn(script, args) {
|
|
5113
5113
|
const venvPython = path$1.join(this.venvPath, "bin", "python");
|
|
5114
|
-
if (!fs
|
|
5114
|
+
if (!fs.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
|
|
5115
5115
|
return spawn(venvPython, [script, ...args]);
|
|
5116
5116
|
}
|
|
5117
5117
|
};
|
|
@@ -5463,20 +5463,20 @@ var StorageManager = class {
|
|
|
5463
5463
|
const basePath = this.locationManager.getBackend(mappedName).basePath;
|
|
5464
5464
|
location.files = {
|
|
5465
5465
|
async readFile(p) {
|
|
5466
|
-
return fs
|
|
5466
|
+
return fs.promises.readFile(path$1.join(basePath, p));
|
|
5467
5467
|
},
|
|
5468
5468
|
async writeFile(p, data) {
|
|
5469
5469
|
const full = path$1.join(basePath, p);
|
|
5470
|
-
await fs
|
|
5471
|
-
await fs
|
|
5470
|
+
await fs.promises.mkdir(path$1.dirname(full), { recursive: true });
|
|
5471
|
+
await fs.promises.writeFile(full, data);
|
|
5472
5472
|
},
|
|
5473
5473
|
async deleteFile(p) {
|
|
5474
|
-
await fs
|
|
5474
|
+
await fs.promises.rm(path$1.join(basePath, p), { force: true });
|
|
5475
5475
|
},
|
|
5476
5476
|
async listFiles(prefix) {
|
|
5477
5477
|
const dir = prefix ? path$1.join(basePath, prefix) : basePath;
|
|
5478
5478
|
try {
|
|
5479
|
-
return (await fs
|
|
5479
|
+
return (await fs.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
|
|
5480
5480
|
} catch {
|
|
5481
5481
|
return [];
|
|
5482
5482
|
}
|
|
@@ -5486,7 +5486,7 @@ var StorageManager = class {
|
|
|
5486
5486
|
},
|
|
5487
5487
|
async exists(p) {
|
|
5488
5488
|
try {
|
|
5489
|
-
await fs
|
|
5489
|
+
await fs.promises.access(path$1.join(basePath, p));
|
|
5490
5490
|
return true;
|
|
5491
5491
|
} catch {
|
|
5492
5492
|
return false;
|
|
@@ -5936,7 +5936,7 @@ var TRADITIONAL_NATIVE_PACKAGES = ["better-sqlite3"];
|
|
|
5936
5936
|
function hasDotNode(dir, maxDepth) {
|
|
5937
5937
|
let entries;
|
|
5938
5938
|
try {
|
|
5939
|
-
entries = fs
|
|
5939
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
5940
5940
|
} catch {
|
|
5941
5941
|
return false;
|
|
5942
5942
|
}
|
|
@@ -5947,7 +5947,7 @@ function hasDotNode(dir, maxDepth) {
|
|
|
5947
5947
|
}
|
|
5948
5948
|
/** Locate the bundled `prebuild-install` bin.js inside the staged closure. */
|
|
5949
5949
|
function resolvePrebuildInstallBin(closureDir, moduleDir) {
|
|
5950
|
-
return [path$1.join(moduleDir, "node_modules", "prebuild-install", "bin.js"), path$1.join(closureDir, "node_modules", "prebuild-install", "bin.js")].find((c) => fs
|
|
5950
|
+
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;
|
|
5951
5951
|
}
|
|
5952
5952
|
/**
|
|
5953
5953
|
* Default fetcher: run the closure's own `prebuild-install` under the CURRENT
|
|
@@ -6000,7 +6000,7 @@ async function ensureNativePrebuilds(closureDir, options) {
|
|
|
6000
6000
|
const fetched = [];
|
|
6001
6001
|
for (const pkg of packages) {
|
|
6002
6002
|
const moduleDir = path$1.join(nm, pkg);
|
|
6003
|
-
if (!fs
|
|
6003
|
+
if (!fs.existsSync(moduleDir)) continue;
|
|
6004
6004
|
if (hasDotNode(moduleDir, 4)) continue;
|
|
6005
6005
|
options.logger.warn("staged closure native prebuild missing — fetching for running ABI", { meta: {
|
|
6006
6006
|
pkg,
|
|
@@ -6063,12 +6063,12 @@ async function ensureNativePrebuilds(closureDir, options) {
|
|
|
6063
6063
|
function replantFromBundled(srcModuleDir, dstModuleDir, hasNative) {
|
|
6064
6064
|
if (!hasNative(srcModuleDir)) return false;
|
|
6065
6065
|
try {
|
|
6066
|
-
fs
|
|
6066
|
+
fs.rmSync(dstModuleDir, {
|
|
6067
6067
|
recursive: true,
|
|
6068
6068
|
force: true
|
|
6069
6069
|
});
|
|
6070
|
-
fs
|
|
6071
|
-
fs
|
|
6070
|
+
fs.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
|
|
6071
|
+
fs.cpSync(srcModuleDir, dstModuleDir, {
|
|
6072
6072
|
recursive: true,
|
|
6073
6073
|
dereference: true
|
|
6074
6074
|
});
|
|
@@ -6097,7 +6097,7 @@ async function ensureAddonNativePrebuilds(addonDir, options) {
|
|
|
6097
6097
|
const missing = [];
|
|
6098
6098
|
for (const pkg of packages) {
|
|
6099
6099
|
const moduleDir = path$1.join(nm, pkg);
|
|
6100
|
-
if (!fs
|
|
6100
|
+
if (!fs.existsSync(moduleDir)) continue;
|
|
6101
6101
|
if (hasNative(moduleDir)) {
|
|
6102
6102
|
results.push({
|
|
6103
6103
|
pkg,
|
|
@@ -6196,7 +6196,7 @@ async function defaultDownloadTarball(url, destTgz) {
|
|
|
6196
6196
|
const res = await fetch(url);
|
|
6197
6197
|
if (!res.ok || !res.body) throw new Error(`HTTP ${res.status} downloading ${url}`);
|
|
6198
6198
|
const bytes = Buffer.from(await res.arrayBuffer());
|
|
6199
|
-
await fs
|
|
6199
|
+
await fs.promises.writeFile(destTgz, bytes);
|
|
6200
6200
|
}
|
|
6201
6201
|
async function defaultExtractTarball(tgzPath, destDir) {
|
|
6202
6202
|
await execFileAsync$5("tar", [
|
|
@@ -6282,7 +6282,7 @@ async function resolveUncached(options) {
|
|
|
6282
6282
|
argsPrefix: []
|
|
6283
6283
|
};
|
|
6284
6284
|
const cliPath = bootstrappedCliPath(options.cacheDir);
|
|
6285
|
-
if (fs
|
|
6285
|
+
if (fs.existsSync(cliPath)) {
|
|
6286
6286
|
options.logger.info("system npm unavailable — using bootstrapped npm", { meta: { cliPath } });
|
|
6287
6287
|
return {
|
|
6288
6288
|
command: process.execPath,
|
|
@@ -6294,12 +6294,12 @@ async function resolveUncached(options) {
|
|
|
6294
6294
|
const registry = (options.registry ?? DEFAULT_REGISTRY$1).replace(/\/+$/, "");
|
|
6295
6295
|
const tarballUrl = tarballUrlOf(await (options.fetchJson ?? defaultFetchJson)(`${registry}/npm/latest`));
|
|
6296
6296
|
if (!tarballUrl) throw new Error(`registry metadata for 'npm' carries no dist.tarball (${registry})`);
|
|
6297
|
-
await fs
|
|
6297
|
+
await fs.promises.mkdir(options.cacheDir, { recursive: true });
|
|
6298
6298
|
const tgzPath = path$1.join(options.cacheDir, "npm-bootstrap.tgz");
|
|
6299
6299
|
await (options.downloadTarball ?? defaultDownloadTarball)(tarballUrl, tgzPath);
|
|
6300
6300
|
await (options.extractTarball ?? defaultExtractTarball)(tgzPath, options.cacheDir);
|
|
6301
|
-
await fs
|
|
6302
|
-
if (!fs
|
|
6301
|
+
await fs.promises.rm(tgzPath, { force: true });
|
|
6302
|
+
if (!fs.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
|
|
6303
6303
|
options.logger.info("npm bootstrapped", { meta: { cliPath } });
|
|
6304
6304
|
return {
|
|
6305
6305
|
command: process.execPath,
|
|
@@ -6365,7 +6365,7 @@ function readOwningPackageVersion(entryPath) {
|
|
|
6365
6365
|
let dir = path$1.dirname(entryPath);
|
|
6366
6366
|
for (let hop = 0; hop < PACKAGE_JSON_LOOKUP_DEPTH; hop++) {
|
|
6367
6367
|
try {
|
|
6368
|
-
const version = asJsonObject$1(parseJsonUnknown(fs
|
|
6368
|
+
const version = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
|
|
6369
6369
|
if (typeof version === "string" && version.length > 0) return version;
|
|
6370
6370
|
} catch {}
|
|
6371
6371
|
const parent = path$1.dirname(dir);
|
|
@@ -6409,14 +6409,14 @@ function readOwningPackageVersion(entryPath) {
|
|
|
6409
6409
|
function addonModuleCacheKey(entryPath) {
|
|
6410
6410
|
let stat;
|
|
6411
6411
|
try {
|
|
6412
|
-
stat = fs
|
|
6412
|
+
stat = fs.statSync(entryPath);
|
|
6413
6413
|
} catch {
|
|
6414
6414
|
return null;
|
|
6415
6415
|
}
|
|
6416
6416
|
const version = readOwningPackageVersion(entryPath) ?? `m${stat.mtimeMs}`;
|
|
6417
6417
|
let content;
|
|
6418
6418
|
try {
|
|
6419
|
-
content = createHash("sha1").update(fs
|
|
6419
|
+
content = createHash("sha1").update(fs.readFileSync(entryPath)).digest("hex").slice(0, 16);
|
|
6420
6420
|
} catch {
|
|
6421
6421
|
content = `m${stat.mtimeMs}s${stat.size}`;
|
|
6422
6422
|
}
|
|
@@ -6520,14 +6520,14 @@ var AddonLoader = class {
|
|
|
6520
6520
|
* BUILTINS from the active closure, not the (now-inert) addons-dir copy, so
|
|
6521
6521
|
* the addons-dir `@camstack/server/system` must NOT be double-loaded here. */
|
|
6522
6522
|
async loadFromDirectory(addonsDir, skipPackages = []) {
|
|
6523
|
-
if (!fs
|
|
6523
|
+
if (!fs.existsSync(addonsDir)) return;
|
|
6524
6524
|
const skip = new Set(skipPackages);
|
|
6525
|
-
const entries = fs
|
|
6525
|
+
const entries = fs.readdirSync(addonsDir, { withFileTypes: true });
|
|
6526
6526
|
for (const entry of entries) {
|
|
6527
6527
|
if (!isDirectoryEntry(entry, addonsDir)) continue;
|
|
6528
6528
|
if (entry.name.startsWith("@")) {
|
|
6529
6529
|
const scopeDir = path$1.join(addonsDir, entry.name);
|
|
6530
|
-
const scopeEntries = fs
|
|
6530
|
+
const scopeEntries = fs.readdirSync(scopeDir, { withFileTypes: true });
|
|
6531
6531
|
for (const scopeEntry of scopeEntries) {
|
|
6532
6532
|
if (!isDirectoryEntry(scopeEntry, scopeDir)) continue;
|
|
6533
6533
|
if (skip.has(`${entry.name}/${scopeEntry.name}`)) continue;
|
|
@@ -6541,7 +6541,7 @@ var AddonLoader = class {
|
|
|
6541
6541
|
}
|
|
6542
6542
|
async tryLoadAddon(addonDir) {
|
|
6543
6543
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
6544
|
-
if (!fs
|
|
6544
|
+
if (!fs.existsSync(pkgJsonPath)) return;
|
|
6545
6545
|
try {
|
|
6546
6546
|
await this.loadFromAddonDir(addonDir);
|
|
6547
6547
|
} catch (err) {
|
|
@@ -6559,7 +6559,7 @@ var AddonLoader = class {
|
|
|
6559
6559
|
/** Load addon from a specific directory (package.json + dist/) */
|
|
6560
6560
|
async loadFromAddonDir(addonDir) {
|
|
6561
6561
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
6562
|
-
const pkgJson = asJsonObject$1(parseJsonUnknown(fs
|
|
6562
|
+
const pkgJson = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
6563
6563
|
const packageNameRaw = pkgJson["name"];
|
|
6564
6564
|
const packageName = typeof packageNameRaw === "string" ? packageNameRaw : "";
|
|
6565
6565
|
const packageVersionRaw = pkgJson["version"];
|
|
@@ -6607,7 +6607,7 @@ var AddonLoader = class {
|
|
|
6607
6607
|
}
|
|
6608
6608
|
const entryFile = declaration.entry.replace(/^\.\//, "").replace(/^src\//, "dist/").replace(/\.ts$/, ".js");
|
|
6609
6609
|
let entryPath = path$1.resolve(addonDir, entryFile);
|
|
6610
|
-
if (!fs
|
|
6610
|
+
if (!fs.existsSync(entryPath)) {
|
|
6611
6611
|
const base = entryPath.replace(/\.(js|cjs|mjs)$/, "");
|
|
6612
6612
|
entryPath = [
|
|
6613
6613
|
`${base}.cjs`,
|
|
@@ -6616,9 +6616,9 @@ var AddonLoader = class {
|
|
|
6616
6616
|
path$1.resolve(addonDir, "dist", "index.cjs"),
|
|
6617
6617
|
path$1.resolve(addonDir, "dist", "index.mjs"),
|
|
6618
6618
|
path$1.resolve(addonDir, declaration.entry)
|
|
6619
|
-
].find((p) => fs
|
|
6619
|
+
].find((p) => fs.existsSync(p)) ?? entryPath;
|
|
6620
6620
|
}
|
|
6621
|
-
if (!fs
|
|
6621
|
+
if (!fs.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
|
|
6622
6622
|
const modUnknown = await importAddonModuleFresh(entryPath);
|
|
6623
6623
|
const mod = isRecord$4(modUnknown) ? modUnknown : {};
|
|
6624
6624
|
const AddonClass = resolveAddonClass(mod);
|
|
@@ -6730,7 +6730,7 @@ function isDirectoryEntry(entry, parentDir) {
|
|
|
6730
6730
|
if (entry.name.startsWith(".")) return false;
|
|
6731
6731
|
if (entry.isDirectory()) return true;
|
|
6732
6732
|
if (entry.isSymbolicLink()) try {
|
|
6733
|
-
return fs
|
|
6733
|
+
return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
6734
6734
|
} catch {
|
|
6735
6735
|
return false;
|
|
6736
6736
|
}
|
|
@@ -6824,7 +6824,7 @@ var execFileAsync$4 = promisify(execFile);
|
|
|
6824
6824
|
* Single source of truth — replaces scattered mkdirSync calls.
|
|
6825
6825
|
*/
|
|
6826
6826
|
function ensureDir(dirPath) {
|
|
6827
|
-
fs
|
|
6827
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
6828
6828
|
}
|
|
6829
6829
|
/**
|
|
6830
6830
|
* Copy a directory recursively — ASYNC so it never blocks the event loop.
|
|
@@ -6837,7 +6837,7 @@ function ensureDir(dirPath) {
|
|
|
6837
6837
|
* `fs.promises.cp` keeps the I/O off the event loop. (Node ≥18 stable.)
|
|
6838
6838
|
*/
|
|
6839
6839
|
async function copyDirRecursive(src, dest) {
|
|
6840
|
-
await fs
|
|
6840
|
+
await fs.promises.cp(src, dest, {
|
|
6841
6841
|
recursive: true,
|
|
6842
6842
|
force: true
|
|
6843
6843
|
});
|
|
@@ -6942,13 +6942,13 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
6942
6942
|
if (typeof fileEntry !== "string") continue;
|
|
6943
6943
|
if (fileEntry === "dist" || fileEntry.includes("*")) continue;
|
|
6944
6944
|
const srcPath = path$1.join(sourceDir, fileEntry);
|
|
6945
|
-
if (!fs
|
|
6945
|
+
if (!fs.existsSync(srcPath)) continue;
|
|
6946
6946
|
const destPath = path$1.join(destDir, fileEntry);
|
|
6947
|
-
const stat = await fs
|
|
6947
|
+
const stat = await fs.promises.stat(srcPath);
|
|
6948
6948
|
if (stat.isDirectory()) await copyDirRecursive(srcPath, destPath);
|
|
6949
6949
|
else if (stat.isFile()) {
|
|
6950
6950
|
ensureDir(path$1.dirname(destPath));
|
|
6951
|
-
await fs
|
|
6951
|
+
await fs.promises.copyFile(srcPath, destPath);
|
|
6952
6952
|
}
|
|
6953
6953
|
}
|
|
6954
6954
|
}
|
|
@@ -6959,10 +6959,10 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
6959
6959
|
function isSourceNewer(packageDir) {
|
|
6960
6960
|
const srcDir = path$1.join(packageDir, "src");
|
|
6961
6961
|
const distDir = path$1.join(packageDir, "dist");
|
|
6962
|
-
if (!fs
|
|
6962
|
+
if (!fs.existsSync(srcDir) || !fs.existsSync(distDir)) return true;
|
|
6963
6963
|
try {
|
|
6964
|
-
const distMtime = fs
|
|
6965
|
-
const entries = fs
|
|
6964
|
+
const distMtime = fs.statSync(distDir).mtimeMs;
|
|
6965
|
+
const entries = fs.readdirSync(srcDir, {
|
|
6966
6966
|
withFileTypes: true,
|
|
6967
6967
|
recursive: true
|
|
6968
6968
|
});
|
|
@@ -6970,7 +6970,7 @@ function isSourceNewer(packageDir) {
|
|
|
6970
6970
|
if (!entry.isFile()) continue;
|
|
6971
6971
|
const parentDir = entry.parentPath ?? String(Reflect.get(entry, "path") ?? "");
|
|
6972
6972
|
const filePath = path$1.join(parentDir, entry.name);
|
|
6973
|
-
if (fs
|
|
6973
|
+
if (fs.statSync(filePath).mtimeMs > distMtime) return true;
|
|
6974
6974
|
}
|
|
6975
6975
|
return false;
|
|
6976
6976
|
} catch {
|
|
@@ -6987,7 +6987,7 @@ function isSourceNewer(packageDir) {
|
|
|
6987
6987
|
* `copyDirRecursive` for the wedge this prevents.
|
|
6988
6988
|
*/
|
|
6989
6989
|
async function installPackageFromNpm(packageName, targetDir) {
|
|
6990
|
-
const tmpDir = await fs
|
|
6990
|
+
const tmpDir = await fs.promises.mkdtemp(path$1.join(os$1.tmpdir(), "camstack-install-"));
|
|
6991
6991
|
try {
|
|
6992
6992
|
const { stdout } = await execFileAsync$4("npm", [
|
|
6993
6993
|
"pack",
|
|
@@ -7010,21 +7010,21 @@ async function installPackageFromNpm(packageName, targetDir) {
|
|
|
7010
7010
|
extractDir
|
|
7011
7011
|
], { timeout: 3e4 });
|
|
7012
7012
|
const packageSubDir = path$1.join(extractDir, "package");
|
|
7013
|
-
const srcPkgJsonDir = fs
|
|
7014
|
-
await fs
|
|
7013
|
+
const srcPkgJsonDir = fs.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
|
|
7014
|
+
await fs.promises.rm(targetDir, {
|
|
7015
7015
|
recursive: true,
|
|
7016
7016
|
force: true
|
|
7017
7017
|
});
|
|
7018
7018
|
ensureDir(targetDir);
|
|
7019
|
-
await fs
|
|
7019
|
+
await fs.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
|
|
7020
7020
|
const distSrc = path$1.join(srcPkgJsonDir, "dist");
|
|
7021
|
-
if (fs
|
|
7021
|
+
if (fs.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
|
|
7022
7022
|
try {
|
|
7023
|
-
const npmPkg = asJsonObject$1(parseJsonUnknown(await fs
|
|
7023
|
+
const npmPkg = asJsonObject$1(parseJsonUnknown(await fs.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
7024
7024
|
if (npmPkg) await copyExtraFileDirs(npmPkg, srcPkgJsonDir, targetDir);
|
|
7025
7025
|
} catch {}
|
|
7026
7026
|
} finally {
|
|
7027
|
-
await fs
|
|
7027
|
+
await fs.promises.rm(tmpDir, {
|
|
7028
7028
|
recursive: true,
|
|
7029
7029
|
force: true
|
|
7030
7030
|
});
|
|
@@ -7049,7 +7049,7 @@ function packageDirName$1(declaredName) {
|
|
|
7049
7049
|
}
|
|
7050
7050
|
function isDirLike$1(p) {
|
|
7051
7051
|
try {
|
|
7052
|
-
return fs
|
|
7052
|
+
return fs.statSync(p).isDirectory();
|
|
7053
7053
|
} catch {
|
|
7054
7054
|
return false;
|
|
7055
7055
|
}
|
|
@@ -7067,12 +7067,12 @@ var AddonManifest = class {
|
|
|
7067
7067
|
*/
|
|
7068
7068
|
read() {
|
|
7069
7069
|
if (this.cache != null) return this.cache;
|
|
7070
|
-
if (!fs
|
|
7070
|
+
if (!fs.existsSync(this.manifestPath)) {
|
|
7071
7071
|
this.cache = this.empty();
|
|
7072
7072
|
return this.cache;
|
|
7073
7073
|
}
|
|
7074
7074
|
try {
|
|
7075
|
-
const raw = fs
|
|
7075
|
+
const raw = fs.readFileSync(this.manifestPath, "utf-8");
|
|
7076
7076
|
const parsed = JSON.parse(raw);
|
|
7077
7077
|
if (parsed.version !== MANIFEST_VERSION) {
|
|
7078
7078
|
process.stderr.write(`[AddonManifest] schema mismatch (file=${parsed.version} vs runtime=${MANIFEST_VERSION}); starting empty\n`);
|
|
@@ -7093,13 +7093,13 @@ var AddonManifest = class {
|
|
|
7093
7093
|
* a half-written file.
|
|
7094
7094
|
*/
|
|
7095
7095
|
write(manifest) {
|
|
7096
|
-
fs
|
|
7096
|
+
fs.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
|
|
7097
7097
|
const tmp = `${this.manifestPath}.tmp.${process.pid}.${Date.now()}`;
|
|
7098
|
-
fs
|
|
7098
|
+
fs.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
|
|
7099
7099
|
encoding: "utf-8",
|
|
7100
7100
|
mode: 384
|
|
7101
7101
|
});
|
|
7102
|
-
fs
|
|
7102
|
+
fs.renameSync(tmp, this.manifestPath);
|
|
7103
7103
|
this.cache = manifest;
|
|
7104
7104
|
}
|
|
7105
7105
|
/** Lookup a single addon's manifest entry, or `null` if not tracked. */
|
|
@@ -7174,22 +7174,22 @@ var AddonManifest = class {
|
|
|
7174
7174
|
* exactly what moved. Returns the total number of changes.
|
|
7175
7175
|
*/
|
|
7176
7176
|
reconcileFromDisk(addonsDir, onChange) {
|
|
7177
|
-
if (!fs
|
|
7177
|
+
if (!fs.existsSync(addonsDir)) return 0;
|
|
7178
7178
|
const m = this.read();
|
|
7179
7179
|
let changes = 0;
|
|
7180
7180
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7181
7181
|
/** Package name → version, for every ADDON package actually installed. */
|
|
7182
7182
|
const onDisk = /* @__PURE__ */ new Map();
|
|
7183
|
-
for (const scope of fs
|
|
7183
|
+
for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7184
7184
|
if (!scope.name.startsWith("@") || !isDirLike$1(path$1.join(addonsDir, scope.name))) continue;
|
|
7185
7185
|
const scopeDir = path$1.join(addonsDir, scope.name);
|
|
7186
|
-
for (const pkg of fs
|
|
7186
|
+
for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7187
7187
|
if (!isDirLike$1(path$1.join(scopeDir, pkg.name))) continue;
|
|
7188
7188
|
const pkgJsonPath = path$1.join(scopeDir, pkg.name, "package.json");
|
|
7189
|
-
if (!fs
|
|
7189
|
+
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
7190
7190
|
let pkgJson;
|
|
7191
7191
|
try {
|
|
7192
|
-
const parsed = JSON.parse(fs
|
|
7192
|
+
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
7193
7193
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
7194
7194
|
pkgJson = parsed;
|
|
7195
7195
|
} catch {
|
|
@@ -7260,28 +7260,28 @@ var AddonManifest = class {
|
|
|
7260
7260
|
migrateFromInstallSourceMarkers(addonsDir) {
|
|
7261
7261
|
const m = this.read();
|
|
7262
7262
|
if (Object.keys(m.addons).length > 0) return 0;
|
|
7263
|
-
if (!fs
|
|
7263
|
+
if (!fs.existsSync(addonsDir)) return 0;
|
|
7264
7264
|
let migrated = 0;
|
|
7265
7265
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7266
|
-
for (const scope of fs
|
|
7266
|
+
for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7267
7267
|
if (!scope.isDirectory() || !scope.name.startsWith("@")) continue;
|
|
7268
7268
|
const scopeDir = path$1.join(addonsDir, scope.name);
|
|
7269
|
-
for (const pkg of fs
|
|
7269
|
+
for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7270
7270
|
if (!pkg.isDirectory()) continue;
|
|
7271
7271
|
const pkgDir = path$1.join(scopeDir, pkg.name);
|
|
7272
7272
|
const markerPath = path$1.join(pkgDir, ".install-source");
|
|
7273
7273
|
const pkgJsonPath = path$1.join(pkgDir, "package.json");
|
|
7274
|
-
if (!fs
|
|
7274
|
+
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
7275
7275
|
let pkgJson;
|
|
7276
7276
|
try {
|
|
7277
|
-
const parsed = JSON.parse(fs
|
|
7277
|
+
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
7278
7278
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
7279
7279
|
pkgJson = parsed;
|
|
7280
7280
|
} catch {
|
|
7281
7281
|
continue;
|
|
7282
7282
|
}
|
|
7283
7283
|
if (!pkgJson.name || !pkgJson.version) continue;
|
|
7284
|
-
const source = fs
|
|
7284
|
+
const source = fs.existsSync(markerPath) ? fs.readFileSync(markerPath, "utf-8").trim() : "bundled";
|
|
7285
7285
|
m.addons[pkgJson.name] = {
|
|
7286
7286
|
name: pkgJson.name,
|
|
7287
7287
|
version: pkgJson.version,
|
|
@@ -7485,7 +7485,7 @@ function planClosureDedupe(input) {
|
|
|
7485
7485
|
function readTreeManifest(pkgJsonPath) {
|
|
7486
7486
|
let raw;
|
|
7487
7487
|
try {
|
|
7488
|
-
raw = asJsonObject$1(parseJsonUnknown(fs
|
|
7488
|
+
raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
|
|
7489
7489
|
} catch {
|
|
7490
7490
|
return null;
|
|
7491
7491
|
}
|
|
@@ -7510,7 +7510,7 @@ function readTreeManifest(pkgJsonPath) {
|
|
|
7510
7510
|
function listTopLevelEntries(nodeModulesDir) {
|
|
7511
7511
|
let entries;
|
|
7512
7512
|
try {
|
|
7513
|
-
entries = fs
|
|
7513
|
+
entries = fs.readdirSync(nodeModulesDir, { withFileTypes: true });
|
|
7514
7514
|
} catch {
|
|
7515
7515
|
return [];
|
|
7516
7516
|
}
|
|
@@ -7520,7 +7520,7 @@ function listTopLevelEntries(nodeModulesDir) {
|
|
|
7520
7520
|
if (entry.name.startsWith("@")) {
|
|
7521
7521
|
let inner;
|
|
7522
7522
|
try {
|
|
7523
|
-
inner = fs
|
|
7523
|
+
inner = fs.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
|
|
7524
7524
|
} catch {
|
|
7525
7525
|
continue;
|
|
7526
7526
|
}
|
|
@@ -7553,14 +7553,14 @@ function collectAddonTreeState(addonDir) {
|
|
|
7553
7553
|
const entryDir = path$1.join(nodeModulesDir, name);
|
|
7554
7554
|
let isLink = false;
|
|
7555
7555
|
try {
|
|
7556
|
-
isLink = fs
|
|
7556
|
+
isLink = fs.lstatSync(entryDir).isSymbolicLink();
|
|
7557
7557
|
} catch {
|
|
7558
7558
|
continue;
|
|
7559
7559
|
}
|
|
7560
7560
|
if (isLink) {
|
|
7561
7561
|
let target = "";
|
|
7562
7562
|
try {
|
|
7563
|
-
target = fs
|
|
7563
|
+
target = fs.readlinkSync(entryDir);
|
|
7564
7564
|
} catch {}
|
|
7565
7565
|
existingLinks.push({
|
|
7566
7566
|
name,
|
|
@@ -7574,7 +7574,7 @@ function collectAddonTreeState(addonDir) {
|
|
|
7574
7574
|
version: manifest.version
|
|
7575
7575
|
});
|
|
7576
7576
|
for (const [depName, range] of manifest.ranges) {
|
|
7577
|
-
if (fs
|
|
7577
|
+
if (fs.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
|
|
7578
7578
|
addRange(depName, range);
|
|
7579
7579
|
}
|
|
7580
7580
|
}
|
|
@@ -7604,7 +7604,7 @@ function resolveClosureNodeModulesDir(explicitDir) {
|
|
|
7604
7604
|
const frameworkDir = explicitDir ?? process.env["CAMSTACK_FRAMEWORK_DIR"];
|
|
7605
7605
|
if (frameworkDir === void 0 || frameworkDir.length === 0) return null;
|
|
7606
7606
|
const nodeModulesDir = explicitDir ?? path$1.join(frameworkDir, "node_modules");
|
|
7607
|
-
return fs
|
|
7607
|
+
return fs.existsSync(nodeModulesDir) ? nodeModulesDir : null;
|
|
7608
7608
|
}
|
|
7609
7609
|
function symlinkType() {
|
|
7610
7610
|
return process.platform === "win32" ? "junction" : "dir";
|
|
@@ -7623,10 +7623,10 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
|
|
|
7623
7623
|
const nodeModulesDir = path$1.join(addonDir, "node_modules");
|
|
7624
7624
|
const probePath = path$1.join(nodeModulesDir, ".closure-link-probe");
|
|
7625
7625
|
try {
|
|
7626
|
-
fs
|
|
7627
|
-
fs
|
|
7628
|
-
fs
|
|
7629
|
-
fs
|
|
7626
|
+
fs.mkdirSync(nodeModulesDir, { recursive: true });
|
|
7627
|
+
fs.rmSync(probePath, { force: true });
|
|
7628
|
+
fs.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
|
|
7629
|
+
fs.rmSync(probePath, { force: true });
|
|
7630
7630
|
} catch (err) {
|
|
7631
7631
|
logger.warn("closure dedupe skipped — symlinks unavailable on this volume", { meta: {
|
|
7632
7632
|
addonDir,
|
|
@@ -7648,12 +7648,12 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
|
|
|
7648
7648
|
}
|
|
7649
7649
|
const entryDir = path$1.join(nodeModulesDir, link.name);
|
|
7650
7650
|
try {
|
|
7651
|
-
fs
|
|
7651
|
+
fs.rmSync(entryDir, {
|
|
7652
7652
|
recursive: true,
|
|
7653
7653
|
force: true
|
|
7654
7654
|
});
|
|
7655
|
-
fs
|
|
7656
|
-
fs
|
|
7655
|
+
fs.mkdirSync(path$1.dirname(entryDir), { recursive: true });
|
|
7656
|
+
fs.symlinkSync(target, entryDir, symlinkType());
|
|
7657
7657
|
linked.push(link.name);
|
|
7658
7658
|
} catch (err) {
|
|
7659
7659
|
logger.warn("closure dedupe — link failed; entry removed copy may need reinstall", { meta: {
|
|
@@ -7729,7 +7729,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
|
|
|
7729
7729
|
count: Object.keys(native).length
|
|
7730
7730
|
} });
|
|
7731
7731
|
try {
|
|
7732
|
-
fs
|
|
7732
|
+
fs.writeFileSync(markerFile, markerHash);
|
|
7733
7733
|
} catch (err) {
|
|
7734
7734
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
7735
7735
|
markerFile,
|
|
@@ -7767,7 +7767,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
|
|
|
7767
7767
|
}
|
|
7768
7768
|
await rebuildNativeDeps(addonDir, pending.map(([name]) => name), logger, npmCacheDir ?? defaultNpmCacheDir(), registry);
|
|
7769
7769
|
try {
|
|
7770
|
-
fs
|
|
7770
|
+
fs.writeFileSync(markerFile, markerHash);
|
|
7771
7771
|
} catch (err) {
|
|
7772
7772
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
7773
7773
|
markerFile,
|
|
@@ -7789,12 +7789,12 @@ function copyPrebuiltNativeDep(name, addonDir, logger) {
|
|
|
7789
7789
|
if (source === target) continue;
|
|
7790
7790
|
if (!hasBuiltBinary(source)) continue;
|
|
7791
7791
|
try {
|
|
7792
|
-
fs
|
|
7792
|
+
fs.rmSync(target, {
|
|
7793
7793
|
recursive: true,
|
|
7794
7794
|
force: true
|
|
7795
7795
|
});
|
|
7796
|
-
fs
|
|
7797
|
-
fs
|
|
7796
|
+
fs.mkdirSync(path$1.dirname(target), { recursive: true });
|
|
7797
|
+
fs.cpSync(source, target, {
|
|
7798
7798
|
recursive: true,
|
|
7799
7799
|
dereference: true
|
|
7800
7800
|
});
|
|
@@ -7830,7 +7830,7 @@ var BUNDLED_NATIVE_SIBLING_SCOPES = {
|
|
|
7830
7830
|
function hasAnyDotNode(dir, maxDepth) {
|
|
7831
7831
|
let entries;
|
|
7832
7832
|
try {
|
|
7833
|
-
entries = fs
|
|
7833
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
7834
7834
|
} catch {
|
|
7835
7835
|
return false;
|
|
7836
7836
|
}
|
|
@@ -7844,12 +7844,12 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
|
|
|
7844
7844
|
if (!hasAnyDotNode(src, 5)) return;
|
|
7845
7845
|
if (hasAnyDotNode(dst, 5)) return;
|
|
7846
7846
|
try {
|
|
7847
|
-
fs
|
|
7847
|
+
fs.rmSync(dst, {
|
|
7848
7848
|
recursive: true,
|
|
7849
7849
|
force: true
|
|
7850
7850
|
});
|
|
7851
|
-
fs
|
|
7852
|
-
fs
|
|
7851
|
+
fs.mkdirSync(path$1.dirname(dst), { recursive: true });
|
|
7852
|
+
fs.cpSync(src, dst, {
|
|
7853
7853
|
recursive: true,
|
|
7854
7854
|
dereference: true
|
|
7855
7855
|
});
|
|
@@ -7884,7 +7884,7 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
|
|
|
7884
7884
|
*/
|
|
7885
7885
|
function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
7886
7886
|
const srcNm = path$1.join(sourceDir, "node_modules");
|
|
7887
|
-
if (!fs
|
|
7887
|
+
if (!fs.existsSync(srcNm)) return;
|
|
7888
7888
|
const dstNm = path$1.join(targetDir, "node_modules");
|
|
7889
7889
|
for (const [name, scopes] of Object.entries(BUNDLED_NATIVE_SIBLING_SCOPES)) {
|
|
7890
7890
|
copyPrebuiltModuleDir(path$1.join(srcNm, name), path$1.join(dstNm, name), name, logger);
|
|
@@ -7892,7 +7892,7 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
|
7892
7892
|
const scopeSrc = path$1.join(srcNm, scope);
|
|
7893
7893
|
let siblings;
|
|
7894
7894
|
try {
|
|
7895
|
-
siblings = fs
|
|
7895
|
+
siblings = fs.readdirSync(scopeSrc);
|
|
7896
7896
|
} catch {
|
|
7897
7897
|
continue;
|
|
7898
7898
|
}
|
|
@@ -7902,12 +7902,12 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
|
7902
7902
|
}
|
|
7903
7903
|
/** A package dir is "built" when it carries a compiled `.node` or a prebuilds tree. */
|
|
7904
7904
|
function hasBuiltBinary(pkgDir) {
|
|
7905
|
-
if (!fs
|
|
7905
|
+
if (!fs.existsSync(path$1.join(pkgDir, "package.json"))) return false;
|
|
7906
7906
|
const releaseDir = path$1.join(pkgDir, "build", "Release");
|
|
7907
7907
|
try {
|
|
7908
|
-
if (fs
|
|
7908
|
+
if (fs.existsSync(releaseDir) && fs.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
|
|
7909
7909
|
} catch {}
|
|
7910
|
-
return fs
|
|
7910
|
+
return fs.existsSync(path$1.join(pkgDir, "prebuilds"));
|
|
7911
7911
|
}
|
|
7912
7912
|
/** Candidate hoisted locations for `<name>`: NODE_PATH entries + ancestors of `addonDir`. */
|
|
7913
7913
|
function candidateHoistedDirs(name, addonDir) {
|
|
@@ -7945,7 +7945,7 @@ function hashDeclaration(deps) {
|
|
|
7945
7945
|
}
|
|
7946
7946
|
function markerMatches(markerFile, expected) {
|
|
7947
7947
|
try {
|
|
7948
|
-
return fs
|
|
7948
|
+
return fs.readFileSync(markerFile, "utf-8").trim() === expected;
|
|
7949
7949
|
} catch {
|
|
7950
7950
|
return false;
|
|
7951
7951
|
}
|
|
@@ -8156,7 +8156,7 @@ function parseInstallSource(value) {
|
|
|
8156
8156
|
function readPackageJson(pkgJsonPath) {
|
|
8157
8157
|
let raw;
|
|
8158
8158
|
try {
|
|
8159
|
-
raw = asJsonObject$1(parseJsonUnknown(fs
|
|
8159
|
+
raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
|
|
8160
8160
|
} catch {
|
|
8161
8161
|
return null;
|
|
8162
8162
|
}
|
|
@@ -8200,7 +8200,7 @@ var REGISTRY_LATEST_TIMEOUT_MS = 15e3;
|
|
|
8200
8200
|
var FALLBACK_VERSION_PROBES = 25;
|
|
8201
8201
|
function readInstalledPackageVersion(addonDir) {
|
|
8202
8202
|
try {
|
|
8203
|
-
const raw = JSON.parse(fs
|
|
8203
|
+
const raw = JSON.parse(fs.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
|
|
8204
8204
|
if (raw === null || typeof raw !== "object") return null;
|
|
8205
8205
|
const version = Reflect.get(raw, "version");
|
|
8206
8206
|
return typeof version === "string" && version.length > 0 ? version : null;
|
|
@@ -8348,7 +8348,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8348
8348
|
} catch {
|
|
8349
8349
|
return Object.freeze([]);
|
|
8350
8350
|
}
|
|
8351
|
-
const raw = fs
|
|
8351
|
+
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
8352
8352
|
const parsed = JSON.parse(raw);
|
|
8353
8353
|
const deps = Object.keys(parsed.dependencies ?? {});
|
|
8354
8354
|
const agentOnly = new Set(parsed.camstack?.agentOnlyBootstrapAddons ?? []);
|
|
@@ -8393,7 +8393,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8393
8393
|
} catch {
|
|
8394
8394
|
return Object.freeze([]);
|
|
8395
8395
|
}
|
|
8396
|
-
const raw = fs
|
|
8396
|
+
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
8397
8397
|
const addons = JSON.parse(raw).camstack?.agentBootstrapAddons ?? [];
|
|
8398
8398
|
return Object.freeze(["@camstack/server", ...addons]);
|
|
8399
8399
|
}
|
|
@@ -8423,7 +8423,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8423
8423
|
this.logger.info(`Install source: ${isLocal ? `bundle (${this.bundledAddonsDir})` : "npm"}, ${pkgList.length} package(s)`);
|
|
8424
8424
|
for (const packageName of pkgList) {
|
|
8425
8425
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
8426
|
-
if (fs
|
|
8426
|
+
if (fs.existsSync(path$1.join(addonDir, "package.json"))) {
|
|
8427
8427
|
if (isLocal || shouldSkipClosureProvidedSeed(packageName, this.isResolvableFromClosure(packageName))) {
|
|
8428
8428
|
this.logger.debug(`${packageName} — already installed, skipping`);
|
|
8429
8429
|
continue;
|
|
@@ -8674,7 +8674,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8674
8674
|
const installedPackages = this.listInstalled();
|
|
8675
8675
|
for (const pkg of installedPackages) {
|
|
8676
8676
|
try {
|
|
8677
|
-
if (fs
|
|
8677
|
+
if (fs.lstatSync(pkg.dir).isSymbolicLink()) continue;
|
|
8678
8678
|
} catch {
|
|
8679
8679
|
continue;
|
|
8680
8680
|
}
|
|
@@ -8714,7 +8714,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8714
8714
|
if (closureNodeModules !== null) for (const link of state.existingLinks) {
|
|
8715
8715
|
if (!isClosureLinkTarget(link.target, closureNodeModules)) continue;
|
|
8716
8716
|
const linkDir = path$1.join(nodeModulesDir, link.name);
|
|
8717
|
-
const targetManifest = fs
|
|
8717
|
+
const targetManifest = fs.existsSync(path$1.join(linkDir, "package.json"));
|
|
8718
8718
|
const ranges = state.requirements.get(link.name) ?? [];
|
|
8719
8719
|
let holds = targetManifest;
|
|
8720
8720
|
if (holds && ranges.length > 0) {
|
|
@@ -8723,14 +8723,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8723
8723
|
}
|
|
8724
8724
|
if (!holds) {
|
|
8725
8725
|
this.logger.warn(`${packageName} — closure link for ${link.name} no longer holds; reinstalling this addon's deps`, { meta: { target: link.target } });
|
|
8726
|
-
fs
|
|
8726
|
+
fs.rmSync(linkDir, { force: true });
|
|
8727
8727
|
needsInstall = true;
|
|
8728
8728
|
}
|
|
8729
8729
|
}
|
|
8730
8730
|
const linked = [];
|
|
8731
8731
|
for (const [depName, range] of declaredEntries) {
|
|
8732
8732
|
if (typeof range !== "string") continue;
|
|
8733
|
-
if (fs
|
|
8733
|
+
if (fs.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
|
|
8734
8734
|
const closureVersion = closureNodeModules === null ? void 0 : readClosureVersions(closureNodeModules, [depName]).get(depName);
|
|
8735
8735
|
if (closureNodeModules !== null && closureVersion !== void 0 && closureSatisfiesRange(range, closureVersion)) {
|
|
8736
8736
|
if (executeClosureDedupe(addonDir, closureNodeModules, {
|
|
@@ -8763,7 +8763,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8763
8763
|
const closureNodeModules = resolveClosureNodeModulesDir(this.closureNodeModulesDir);
|
|
8764
8764
|
if (closureNodeModules !== null) {
|
|
8765
8765
|
const state = collectAddonTreeState(addonDir);
|
|
8766
|
-
for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs
|
|
8766
|
+
for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
|
|
8767
8767
|
}
|
|
8768
8768
|
this.logger.info(`${packageName} — reinstalling runtime dependencies`, { meta: { addonDir } });
|
|
8769
8769
|
await runNpm([
|
|
@@ -8808,7 +8808,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8808
8808
|
async realignFromClosure(packageName, closureDir) {
|
|
8809
8809
|
const targetDir = path$1.join(this.addonsDir, packageName);
|
|
8810
8810
|
const result = await this.installLocal(packageName, closureDir);
|
|
8811
|
-
await fs
|
|
8811
|
+
await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
|
|
8812
8812
|
this.manifest.upsert(result.name, {
|
|
8813
8813
|
version: result.version,
|
|
8814
8814
|
source: "closure"
|
|
@@ -8824,17 +8824,17 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8824
8824
|
async installCopy(packageName, sourceDir, pkgData, targetDir) {
|
|
8825
8825
|
await this.ensureBuilt(packageName, sourceDir, pkgData);
|
|
8826
8826
|
const distDir = path$1.join(sourceDir, "dist");
|
|
8827
|
-
if (!fs
|
|
8828
|
-
await fs
|
|
8827
|
+
if (!fs.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
|
|
8828
|
+
await fs.promises.rm(targetDir, {
|
|
8829
8829
|
recursive: true,
|
|
8830
8830
|
force: true
|
|
8831
8831
|
});
|
|
8832
8832
|
ensureDir(targetDir);
|
|
8833
|
-
await fs
|
|
8833
|
+
await fs.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
|
|
8834
8834
|
await copyDirRecursive(distDir, path$1.join(targetDir, "dist"));
|
|
8835
8835
|
await copyExtraFileDirs(pkgData, sourceDir, targetDir);
|
|
8836
8836
|
copyBundledNativeModules(sourceDir, targetDir, this.logger);
|
|
8837
|
-
await fs
|
|
8837
|
+
await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
|
|
8838
8838
|
const localPkgVersion = asString$1(pkgData.version, "0.0.0");
|
|
8839
8839
|
this.manifest.upsert(packageName, {
|
|
8840
8840
|
version: localPkgVersion,
|
|
@@ -8875,7 +8875,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8875
8875
|
* unusual auth, offline mode, etc).
|
|
8876
8876
|
*/
|
|
8877
8877
|
async installFromNpm(packageName, version) {
|
|
8878
|
-
const tmpDir = fs
|
|
8878
|
+
const tmpDir = fs.mkdtempSync(path$1.join(os$1.tmpdir(), "camstack-addon-npm-"));
|
|
8879
8879
|
const packageSpec = version ? `${packageName}@${version}` : packageName;
|
|
8880
8880
|
this.logger.info(`${packageName} — installing from npm`);
|
|
8881
8881
|
try {
|
|
@@ -8889,19 +8889,19 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8889
8889
|
];
|
|
8890
8890
|
if (this.registry) args.push("--registry", this.registry);
|
|
8891
8891
|
const { stdout } = await runNpm(args, this.npmRunOptions(tmpDir, 12e4));
|
|
8892
|
-
const tgzFiles = fs
|
|
8892
|
+
const tgzFiles = fs.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
|
|
8893
8893
|
if (tgzFiles.length === 0) throw new Error(`npm pack produced no tgz. stdout: ${stdout.trim()}`);
|
|
8894
8894
|
return path$1.join(tmpDir, tgzFiles[0]);
|
|
8895
8895
|
});
|
|
8896
8896
|
const result = await this.installFromTgz(tgzPath);
|
|
8897
|
-
fs
|
|
8897
|
+
fs.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
|
|
8898
8898
|
this.manifest.upsert(result.name, {
|
|
8899
8899
|
version: result.version,
|
|
8900
8900
|
source: "npm"
|
|
8901
8901
|
});
|
|
8902
8902
|
return result;
|
|
8903
8903
|
} finally {
|
|
8904
|
-
fs
|
|
8904
|
+
fs.rmSync(tmpDir, {
|
|
8905
8905
|
recursive: true,
|
|
8906
8906
|
force: true
|
|
8907
8907
|
});
|
|
@@ -8939,7 +8939,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8939
8939
|
if (!tarRes.ok) throw new Error(`tarball GET ${tarballUrl} → ${tarRes.status}`);
|
|
8940
8940
|
const tgzPath = path$1.join(tmpDir, `${packageName.replace(/[/@]/g, "-").replace(/^-+/, "")}-${resolvedVersion}.tgz`);
|
|
8941
8941
|
const buf = Buffer.from(await tarRes.arrayBuffer());
|
|
8942
|
-
fs
|
|
8942
|
+
fs.writeFileSync(tgzPath, buf);
|
|
8943
8943
|
return tgzPath;
|
|
8944
8944
|
}
|
|
8945
8945
|
/**
|
|
@@ -8960,7 +8960,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8960
8960
|
* on the next deploy.
|
|
8961
8961
|
*/
|
|
8962
8962
|
async evictInstallDir(targetDir) {
|
|
8963
|
-
if (!fs
|
|
8963
|
+
if (!fs.existsSync(targetDir)) return;
|
|
8964
8964
|
const graveyard = path$1.join(this.addonsDir, ".evicting");
|
|
8965
8965
|
ensureDir(graveyard);
|
|
8966
8966
|
await this.sweepGraveyard(graveyard);
|
|
@@ -8968,10 +8968,10 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8968
8968
|
const flatName = path$1.relative(this.addonsDir, targetDir).replace(/[/\\]/g, "-");
|
|
8969
8969
|
const asideDir = path$1.join(graveyard, `${flatName}-${ts}`);
|
|
8970
8970
|
try {
|
|
8971
|
-
fs
|
|
8971
|
+
fs.renameSync(targetDir, asideDir);
|
|
8972
8972
|
} catch (renameErr) {
|
|
8973
8973
|
if (renameErr.code === "EXDEV") {
|
|
8974
|
-
await fs
|
|
8974
|
+
await fs.promises.rm(targetDir, {
|
|
8975
8975
|
recursive: true,
|
|
8976
8976
|
force: true
|
|
8977
8977
|
});
|
|
@@ -8979,7 +8979,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8979
8979
|
}
|
|
8980
8980
|
throw renameErr;
|
|
8981
8981
|
}
|
|
8982
|
-
await fs
|
|
8982
|
+
await fs.promises.rm(asideDir, {
|
|
8983
8983
|
recursive: true,
|
|
8984
8984
|
force: true
|
|
8985
8985
|
}).catch((cleanupErr) => {
|
|
@@ -9000,14 +9000,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9000
9000
|
async sweepStagingResidue(stagingRoot) {
|
|
9001
9001
|
let names;
|
|
9002
9002
|
try {
|
|
9003
|
-
names = fs
|
|
9003
|
+
names = fs.readdirSync(stagingRoot);
|
|
9004
9004
|
} catch {
|
|
9005
9005
|
return;
|
|
9006
9006
|
}
|
|
9007
9007
|
const now = Date.now();
|
|
9008
9008
|
const ages = [];
|
|
9009
9009
|
for (const name of names) try {
|
|
9010
|
-
const stat = fs
|
|
9010
|
+
const stat = fs.statSync(path$1.join(stagingRoot, name));
|
|
9011
9011
|
ages.push({
|
|
9012
9012
|
name,
|
|
9013
9013
|
ageMs: now - stat.mtimeMs
|
|
@@ -9018,7 +9018,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9018
9018
|
stagingRoot,
|
|
9019
9019
|
entries: sweepable
|
|
9020
9020
|
} });
|
|
9021
|
-
await Promise.all(sweepable.map((name) => fs
|
|
9021
|
+
await Promise.all(sweepable.map((name) => fs.promises.rm(path$1.join(stagingRoot, name), {
|
|
9022
9022
|
recursive: true,
|
|
9023
9023
|
force: true
|
|
9024
9024
|
}).catch(() => void 0)));
|
|
@@ -9027,11 +9027,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9027
9027
|
async sweepGraveyard(graveyard) {
|
|
9028
9028
|
let entries;
|
|
9029
9029
|
try {
|
|
9030
|
-
entries = fs
|
|
9030
|
+
entries = fs.readdirSync(graveyard);
|
|
9031
9031
|
} catch {
|
|
9032
9032
|
return;
|
|
9033
9033
|
}
|
|
9034
|
-
await Promise.all(entries.map((name) => fs
|
|
9034
|
+
await Promise.all(entries.map((name) => fs.promises.rm(path$1.join(graveyard, name), {
|
|
9035
9035
|
recursive: true,
|
|
9036
9036
|
force: true
|
|
9037
9037
|
}).catch(() => void 0)));
|
|
@@ -9082,7 +9082,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9082
9082
|
return;
|
|
9083
9083
|
}
|
|
9084
9084
|
const strippedManifest = stripBundledDeps(pkgView.raw);
|
|
9085
|
-
await fs
|
|
9085
|
+
await fs.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
|
|
9086
9086
|
const deps = asJsonObject$1(strippedManifest["dependencies"]);
|
|
9087
9087
|
const depNames = deps ? Object.keys(deps) : [];
|
|
9088
9088
|
if (depNames.length === 0) return;
|
|
@@ -9214,9 +9214,9 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9214
9214
|
"-C",
|
|
9215
9215
|
stagingDir
|
|
9216
9216
|
], { timeout: 12e4 });
|
|
9217
|
-
const pkgDir = fs
|
|
9217
|
+
const pkgDir = fs.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
|
|
9218
9218
|
const pkgJsonPath = path$1.join(pkgDir, "package.json");
|
|
9219
|
-
if (!fs
|
|
9219
|
+
if (!fs.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
|
|
9220
9220
|
const pkgView = readPackageJson(pkgJsonPath);
|
|
9221
9221
|
if (!pkgView) throw new Error(`Invalid package.json at ${pkgJsonPath}`);
|
|
9222
9222
|
if (!pkgView.camstackAddons) throw new Error(`Package ${pkgView.name} has no camstack.addons manifest`);
|
|
@@ -9226,7 +9226,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9226
9226
|
this.dedupeTreeAgainstClosure(pkgDir, pkgView.name);
|
|
9227
9227
|
await this.evictInstallDir(targetDir);
|
|
9228
9228
|
ensureDir(path$1.dirname(targetDir));
|
|
9229
|
-
await fs
|
|
9229
|
+
await fs.promises.rename(pkgDir, targetDir);
|
|
9230
9230
|
this.manifest.upsert(pkgView.name, {
|
|
9231
9231
|
version: pkgView.version,
|
|
9232
9232
|
source: "bundled"
|
|
@@ -9237,7 +9237,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9237
9237
|
};
|
|
9238
9238
|
} finally {
|
|
9239
9239
|
this.inFlightStaging.delete(stagingName);
|
|
9240
|
-
await fs
|
|
9240
|
+
await fs.promises.rm(stagingDir, {
|
|
9241
9241
|
recursive: true,
|
|
9242
9242
|
force: true
|
|
9243
9243
|
}).catch(() => void 0);
|
|
@@ -9267,24 +9267,24 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9267
9267
|
const current = this.manifest.get(packageName);
|
|
9268
9268
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
9269
9269
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9270
|
-
if (!fs
|
|
9270
|
+
if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9271
9271
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
9272
9272
|
const backupRoot = path$1.join(this.addonsDir, ".backups", packageName);
|
|
9273
9273
|
ensureDir(backupRoot);
|
|
9274
9274
|
const backupDir = path$1.join(backupRoot, ts);
|
|
9275
9275
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
9276
|
-
fs
|
|
9276
|
+
fs.renameSync(addonDir, backupDir);
|
|
9277
9277
|
let result;
|
|
9278
9278
|
try {
|
|
9279
9279
|
result = await this.installFromNpm(packageName, version);
|
|
9280
9280
|
} catch (installErr) {
|
|
9281
9281
|
this.logger.error(`${packageName} — install failed, restoring backup`, { meta: { error: errMsg$1(installErr) } });
|
|
9282
9282
|
try {
|
|
9283
|
-
if (fs
|
|
9283
|
+
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9284
9284
|
recursive: true,
|
|
9285
9285
|
force: true
|
|
9286
9286
|
});
|
|
9287
|
-
fs
|
|
9287
|
+
fs.renameSync(backupDir, addonDir);
|
|
9288
9288
|
this.manifest.upsert(packageName, {
|
|
9289
9289
|
version: current.version,
|
|
9290
9290
|
source: current.source,
|
|
@@ -9345,7 +9345,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9345
9345
|
const current = this.manifest.get(packageName);
|
|
9346
9346
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
9347
9347
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9348
|
-
if (!fs
|
|
9348
|
+
if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9349
9349
|
await this.installRuntimeDependencies(stagedPath, packageName);
|
|
9350
9350
|
await this.installNativeDependencies(stagedPath, packageName);
|
|
9351
9351
|
this.dedupeTreeAgainstClosure(stagedPath, packageName);
|
|
@@ -9354,14 +9354,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9354
9354
|
ensureDir(backupRoot);
|
|
9355
9355
|
const backupDir = path$1.join(backupRoot, ts);
|
|
9356
9356
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
9357
|
-
fs
|
|
9357
|
+
fs.renameSync(addonDir, backupDir);
|
|
9358
9358
|
try {
|
|
9359
9359
|
try {
|
|
9360
|
-
fs
|
|
9360
|
+
fs.renameSync(stagedPath, addonDir);
|
|
9361
9361
|
} catch (renameErr) {
|
|
9362
9362
|
if (renameErr.code === "EXDEV") {
|
|
9363
|
-
fs
|
|
9364
|
-
fs
|
|
9363
|
+
fs.cpSync(stagedPath, addonDir, { recursive: true });
|
|
9364
|
+
fs.rmSync(stagedPath, {
|
|
9365
9365
|
recursive: true,
|
|
9366
9366
|
force: true
|
|
9367
9367
|
});
|
|
@@ -9370,11 +9370,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9370
9370
|
} catch (swapErr) {
|
|
9371
9371
|
this.logger.error(`${packageName} — staged swap failed, restoring backup`, { meta: { error: errMsg$1(swapErr) } });
|
|
9372
9372
|
try {
|
|
9373
|
-
if (fs
|
|
9373
|
+
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9374
9374
|
recursive: true,
|
|
9375
9375
|
force: true
|
|
9376
9376
|
});
|
|
9377
|
-
fs
|
|
9377
|
+
fs.renameSync(backupDir, addonDir);
|
|
9378
9378
|
this.manifest.upsert(packageName, {
|
|
9379
9379
|
version: current.version,
|
|
9380
9380
|
source: current.source,
|
|
@@ -9413,20 +9413,20 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9413
9413
|
this.logger.warn(`${packageName} — no backup to rollback to`);
|
|
9414
9414
|
return null;
|
|
9415
9415
|
}
|
|
9416
|
-
if (!fs
|
|
9416
|
+
if (!fs.existsSync(entry.lastBackupDir)) {
|
|
9417
9417
|
this.logger.warn(`${packageName} — backup dir vanished: ${entry.lastBackupDir}`);
|
|
9418
9418
|
return null;
|
|
9419
9419
|
}
|
|
9420
9420
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9421
|
-
if (fs
|
|
9421
|
+
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9422
9422
|
recursive: true,
|
|
9423
9423
|
force: true
|
|
9424
9424
|
});
|
|
9425
|
-
fs
|
|
9425
|
+
fs.renameSync(entry.lastBackupDir, addonDir);
|
|
9426
9426
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
9427
9427
|
let restoredVersion = entry.version;
|
|
9428
|
-
if (fs
|
|
9429
|
-
const parsed = JSON.parse(fs
|
|
9428
|
+
if (fs.existsSync(pkgJsonPath)) try {
|
|
9429
|
+
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
9430
9430
|
if (typeof parsed === "object" && parsed != null) {
|
|
9431
9431
|
const v = parsed.version;
|
|
9432
9432
|
if (typeof v === "string" && v.length > 0) restoredVersion = v;
|
|
@@ -9474,7 +9474,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9474
9474
|
return false;
|
|
9475
9475
|
}
|
|
9476
9476
|
try {
|
|
9477
|
-
await fs
|
|
9477
|
+
await fs.promises.rm(target, {
|
|
9478
9478
|
recursive: true,
|
|
9479
9479
|
force: true
|
|
9480
9480
|
});
|
|
@@ -9492,7 +9492,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9492
9492
|
listBackupsFor(packageName) {
|
|
9493
9493
|
const dir = path$1.join(this.backupsRoot, packageName);
|
|
9494
9494
|
try {
|
|
9495
|
-
return fs
|
|
9495
|
+
return fs.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
|
|
9496
9496
|
} catch {
|
|
9497
9497
|
return [];
|
|
9498
9498
|
}
|
|
@@ -9524,7 +9524,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9524
9524
|
for (const dir of [pkgDir, path$1.dirname(pkgDir)]) {
|
|
9525
9525
|
if (!this.isInsideBackups(dir)) continue;
|
|
9526
9526
|
try {
|
|
9527
|
-
await fs
|
|
9527
|
+
await fs.promises.rmdir(dir);
|
|
9528
9528
|
} catch {
|
|
9529
9529
|
return;
|
|
9530
9530
|
}
|
|
@@ -9606,7 +9606,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9606
9606
|
*/
|
|
9607
9607
|
resolveBackupToKeep(packageName, backups) {
|
|
9608
9608
|
const liveDir = path$1.join(this.addonsDir, packageName);
|
|
9609
|
-
if (!fs
|
|
9609
|
+
if (!fs.existsSync(liveDir)) {
|
|
9610
9610
|
const newest = backups[backups.length - 1] ?? null;
|
|
9611
9611
|
if (newest != null) this.logger.warn(`${packageName} — live install dir missing; retaining its newest backup as the only surviving copy`, { meta: {
|
|
9612
9612
|
liveDir,
|
|
@@ -9623,7 +9623,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9623
9623
|
listBackedUpPackages() {
|
|
9624
9624
|
let entries;
|
|
9625
9625
|
try {
|
|
9626
|
-
entries = fs
|
|
9626
|
+
entries = fs.readdirSync(this.backupsRoot, { withFileTypes: true });
|
|
9627
9627
|
} catch {
|
|
9628
9628
|
return [];
|
|
9629
9629
|
}
|
|
@@ -9635,14 +9635,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9635
9635
|
continue;
|
|
9636
9636
|
}
|
|
9637
9637
|
const scopeDir = path$1.join(this.backupsRoot, entry.name);
|
|
9638
|
-
for (const inner of fs
|
|
9638
|
+
for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
|
|
9639
9639
|
}
|
|
9640
9640
|
return names;
|
|
9641
9641
|
}
|
|
9642
9642
|
async uninstall(packageName) {
|
|
9643
9643
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9644
|
-
if (fs
|
|
9645
|
-
fs
|
|
9644
|
+
if (fs.existsSync(addonDir)) {
|
|
9645
|
+
fs.rmSync(addonDir, {
|
|
9646
9646
|
recursive: true,
|
|
9647
9647
|
force: true
|
|
9648
9648
|
});
|
|
@@ -9650,8 +9650,8 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9650
9650
|
return;
|
|
9651
9651
|
}
|
|
9652
9652
|
const legacyDir = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""));
|
|
9653
|
-
if (fs
|
|
9654
|
-
fs
|
|
9653
|
+
if (fs.existsSync(legacyDir)) {
|
|
9654
|
+
fs.rmSync(legacyDir, {
|
|
9655
9655
|
recursive: true,
|
|
9656
9656
|
force: true
|
|
9657
9657
|
});
|
|
@@ -9659,22 +9659,22 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9659
9659
|
}
|
|
9660
9660
|
}
|
|
9661
9661
|
listInstalled() {
|
|
9662
|
-
if (!fs
|
|
9662
|
+
if (!fs.existsSync(this.addonsDir)) return [];
|
|
9663
9663
|
const packageDirs = [];
|
|
9664
|
-
for (const entry of fs
|
|
9664
|
+
for (const entry of fs.readdirSync(this.addonsDir, { withFileTypes: true })) {
|
|
9665
9665
|
if (!isDirEntry(entry, this.addonsDir)) continue;
|
|
9666
9666
|
if (entry.name.startsWith("@")) {
|
|
9667
9667
|
const scopeDir = path$1.join(this.addonsDir, entry.name);
|
|
9668
|
-
for (const inner of fs
|
|
9668
|
+
for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
|
|
9669
9669
|
} else packageDirs.push(path$1.join(this.addonsDir, entry.name));
|
|
9670
9670
|
}
|
|
9671
9671
|
return packageDirs.map((dir) => {
|
|
9672
9672
|
const pkgPath = path$1.join(dir, "package.json");
|
|
9673
|
-
if (!fs
|
|
9673
|
+
if (!fs.existsSync(pkgPath)) return null;
|
|
9674
9674
|
const pkg = readPackageJson(pkgPath);
|
|
9675
9675
|
if (!pkg || !pkg.camstackAddons) return null;
|
|
9676
9676
|
const sourceFile = path$1.join(dir, ".install-source");
|
|
9677
|
-
const installSource = fs
|
|
9677
|
+
const installSource = fs.existsSync(sourceFile) ? parseInstallSource(fs.readFileSync(sourceFile, "utf-8").trim()) : void 0;
|
|
9678
9678
|
return {
|
|
9679
9679
|
name: pkg.name,
|
|
9680
9680
|
version: pkg.version,
|
|
@@ -9684,13 +9684,13 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9684
9684
|
}).filter((item) => item !== null);
|
|
9685
9685
|
}
|
|
9686
9686
|
isInstalled(packageName) {
|
|
9687
|
-
if (fs
|
|
9688
|
-
return fs
|
|
9687
|
+
if (fs.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
|
|
9688
|
+
return fs.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
|
|
9689
9689
|
}
|
|
9690
9690
|
getInstalledPackage(packageName) {
|
|
9691
9691
|
let pkgPath = path$1.join(this.addonsDir, packageName, "package.json");
|
|
9692
|
-
if (!fs
|
|
9693
|
-
if (!fs
|
|
9692
|
+
if (!fs.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
|
|
9693
|
+
if (!fs.existsSync(pkgPath)) return null;
|
|
9694
9694
|
const pkg = readPackageJson(pkgPath);
|
|
9695
9695
|
if (!pkg) return null;
|
|
9696
9696
|
return {
|
|
@@ -9709,7 +9709,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9709
9709
|
]) {
|
|
9710
9710
|
const candidate = path$1.join(this.bundledAddonsDir, dirName);
|
|
9711
9711
|
try {
|
|
9712
|
-
const pkg = asJsonObject$1(parseJsonUnknown(fs
|
|
9712
|
+
const pkg = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
|
|
9713
9713
|
if (pkg && asString$1(pkg["name"]) === packageName) return candidate;
|
|
9714
9714
|
} catch {}
|
|
9715
9715
|
}
|
|
@@ -9718,7 +9718,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9718
9718
|
/** Ensure a package is built (dist/ exists and page bundles present) */
|
|
9719
9719
|
async ensureBuilt(packageName, sourceDir, pkgData) {
|
|
9720
9720
|
const distDir = path$1.join(sourceDir, "dist");
|
|
9721
|
-
if (!(!fs
|
|
9721
|
+
if (!(!fs.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
|
|
9722
9722
|
this.logger.info(`${packageName} — building (dist/ missing or incomplete)`);
|
|
9723
9723
|
try {
|
|
9724
9724
|
await runNpm(["run", "build"], this.npmRunOptions(sourceDir, 18e4));
|
|
@@ -9733,7 +9733,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9733
9733
|
if (!camstack?.addons) return false;
|
|
9734
9734
|
for (const addon of camstack.addons) {
|
|
9735
9735
|
if (!addon.pages) continue;
|
|
9736
|
-
for (const page of addon.pages) if (page.bundle && !fs
|
|
9736
|
+
for (const page of addon.pages) if (page.bundle && !fs.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
|
|
9737
9737
|
}
|
|
9738
9738
|
return false;
|
|
9739
9739
|
}
|
|
@@ -9742,7 +9742,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9742
9742
|
function isDirEntry(entry, parentDir) {
|
|
9743
9743
|
if (entry.isDirectory()) return true;
|
|
9744
9744
|
if (entry.isSymbolicLink()) try {
|
|
9745
|
-
return fs
|
|
9745
|
+
return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
9746
9746
|
} catch {
|
|
9747
9747
|
return false;
|
|
9748
9748
|
}
|
|
@@ -9841,7 +9841,7 @@ function selectAddonResidue(candidates) {
|
|
|
9841
9841
|
}
|
|
9842
9842
|
function readDeclaredName(dir) {
|
|
9843
9843
|
try {
|
|
9844
|
-
const parsed = JSON.parse(fs
|
|
9844
|
+
const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9845
9845
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
9846
9846
|
const name = parsed.name;
|
|
9847
9847
|
return typeof name === "string" ? name : null;
|
|
@@ -9851,7 +9851,7 @@ function readDeclaredName(dir) {
|
|
|
9851
9851
|
}
|
|
9852
9852
|
function readDeclaredVersion(dir) {
|
|
9853
9853
|
try {
|
|
9854
|
-
const parsed = JSON.parse(fs
|
|
9854
|
+
const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9855
9855
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
9856
9856
|
const version = parsed.version;
|
|
9857
9857
|
return typeof version === "string" ? version : null;
|
|
@@ -9861,7 +9861,7 @@ function readDeclaredVersion(dir) {
|
|
|
9861
9861
|
}
|
|
9862
9862
|
function isDirLike(p) {
|
|
9863
9863
|
try {
|
|
9864
|
-
return fs
|
|
9864
|
+
return fs.statSync(p).isDirectory();
|
|
9865
9865
|
} catch {
|
|
9866
9866
|
return false;
|
|
9867
9867
|
}
|
|
@@ -9871,7 +9871,7 @@ function freeQuarantineTarget(store, scope, dirName) {
|
|
|
9871
9871
|
const base = scope === null ? dirName : `${scope.replace("@", "")}__${dirName}`;
|
|
9872
9872
|
let candidate = path$1.join(store, base);
|
|
9873
9873
|
let n = 1;
|
|
9874
|
-
while (fs
|
|
9874
|
+
while (fs.existsSync(candidate)) {
|
|
9875
9875
|
candidate = path$1.join(store, `${base}-${n}`);
|
|
9876
9876
|
n += 1;
|
|
9877
9877
|
}
|
|
@@ -9888,7 +9888,7 @@ function freeQuarantineTarget(store, scope, dirName) {
|
|
|
9888
9888
|
function quarantineAddonResidue(addonsDir, log) {
|
|
9889
9889
|
const quarantined = [];
|
|
9890
9890
|
const failed = [];
|
|
9891
|
-
if (!fs
|
|
9891
|
+
if (!fs.existsSync(addonsDir)) return {
|
|
9892
9892
|
quarantined,
|
|
9893
9893
|
failed
|
|
9894
9894
|
};
|
|
@@ -9896,7 +9896,7 @@ function quarantineAddonResidue(addonsDir, log) {
|
|
|
9896
9896
|
const scan = (parent, scope) => {
|
|
9897
9897
|
let names;
|
|
9898
9898
|
try {
|
|
9899
|
-
names = fs
|
|
9899
|
+
names = fs.readdirSync(parent);
|
|
9900
9900
|
} catch {
|
|
9901
9901
|
return;
|
|
9902
9902
|
}
|
|
@@ -9915,8 +9915,8 @@ function quarantineAddonResidue(addonsDir, log) {
|
|
|
9915
9915
|
const version = readDeclaredVersion(full);
|
|
9916
9916
|
const to = freeQuarantineTarget(store, scope, dirName);
|
|
9917
9917
|
try {
|
|
9918
|
-
fs
|
|
9919
|
-
fs
|
|
9918
|
+
fs.mkdirSync(store, { recursive: true });
|
|
9919
|
+
fs.renameSync(full, to);
|
|
9920
9920
|
} catch (err) {
|
|
9921
9921
|
const error = err instanceof Error ? err.message : String(err);
|
|
9922
9922
|
failed.push({
|
|
@@ -9974,11 +9974,11 @@ function getRestartMarkerPath(dataDir) {
|
|
|
9974
9974
|
* intact or no marker at all (never a half-written file).
|
|
9975
9975
|
*/
|
|
9976
9976
|
function writePendingRestart(dataDir, marker) {
|
|
9977
|
-
fs
|
|
9977
|
+
fs.mkdirSync(dataDir, { recursive: true });
|
|
9978
9978
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
9979
9979
|
const tmpPath = `${markerPath}.tmp`;
|
|
9980
|
-
fs
|
|
9981
|
-
fs
|
|
9980
|
+
fs.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
|
|
9981
|
+
fs.renameSync(tmpPath, markerPath);
|
|
9982
9982
|
}
|
|
9983
9983
|
/**
|
|
9984
9984
|
* Read + consume the marker. Returns the parsed payload on success and
|
|
@@ -10003,10 +10003,10 @@ function writePendingRestart(dataDir, marker) {
|
|
|
10003
10003
|
*/
|
|
10004
10004
|
function readPendingRestart(dataDir) {
|
|
10005
10005
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
10006
|
-
if (!fs
|
|
10006
|
+
if (!fs.existsSync(markerPath)) return null;
|
|
10007
10007
|
let raw;
|
|
10008
10008
|
try {
|
|
10009
|
-
raw = fs
|
|
10009
|
+
raw = fs.readFileSync(markerPath, "utf-8");
|
|
10010
10010
|
} catch (err) {
|
|
10011
10011
|
console.error("[restart-coordinator] Marker unreadable — leaving in place:", err);
|
|
10012
10012
|
return null;
|
|
@@ -10045,7 +10045,7 @@ function readPendingRestart(dataDir) {
|
|
|
10045
10045
|
/** Remove the marker if present. No-op if missing. */
|
|
10046
10046
|
function clearPendingRestart(dataDir) {
|
|
10047
10047
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
10048
|
-
fs
|
|
10048
|
+
fs.rmSync(markerPath, { force: true });
|
|
10049
10049
|
}
|
|
10050
10050
|
function isRestartKind(value) {
|
|
10051
10051
|
return value === "framework-update" || value === "manual" || value === "system";
|
|
@@ -10057,7 +10057,7 @@ function scheduleSelfRestart(options = {}) {
|
|
|
10057
10057
|
const touchTarget = process.env["CAMSTACK_RESTART_TOUCH_FILE"];
|
|
10058
10058
|
if (touchTarget !== void 0 && touchTarget.length > 0) try {
|
|
10059
10059
|
const now = /* @__PURE__ */ new Date();
|
|
10060
|
-
fs
|
|
10060
|
+
fs.utimesSync(touchTarget, now, now);
|
|
10061
10061
|
return;
|
|
10062
10062
|
} catch (err) {
|
|
10063
10063
|
console.error("[restart-coordinator] dev touch-reload failed; falling through to process exit:", err);
|
|
@@ -20819,7 +20819,7 @@ async function probeVaapiInit(renderNode) {
|
|
|
20819
20819
|
*/
|
|
20820
20820
|
function safeExistsSync(path) {
|
|
20821
20821
|
try {
|
|
20822
|
-
return fs
|
|
20822
|
+
return fs.existsSync(path);
|
|
20823
20823
|
} catch {
|
|
20824
20824
|
return false;
|
|
20825
20825
|
}
|
|
@@ -20838,11 +20838,11 @@ function probeLinuxGpus() {
|
|
|
20838
20838
|
if (safeExistsSync("/dev/nvidia0") || safeExistsSync("/proc/driver/nvidia/version")) signals.hasNvidiaGpu = true;
|
|
20839
20839
|
try {
|
|
20840
20840
|
const drmDir = "/sys/class/drm";
|
|
20841
|
-
if (fs
|
|
20841
|
+
if (fs.existsSync(drmDir)) for (const entry of fs.readdirSync(drmDir)) {
|
|
20842
20842
|
if (!entry.startsWith("card")) continue;
|
|
20843
20843
|
const vendorPath = `${drmDir}/${entry}/device/vendor`;
|
|
20844
20844
|
if (!safeExistsSync(vendorPath)) continue;
|
|
20845
|
-
const vendor = fs
|
|
20845
|
+
const vendor = fs.readFileSync(vendorPath, "utf8").trim().toLowerCase();
|
|
20846
20846
|
if (vendor === "0x10de") signals.hasNvidiaGpu = true;
|
|
20847
20847
|
else if (vendor === "0x1002") signals.hasAmdGpu = true;
|
|
20848
20848
|
else if (vendor === "0x8086") signals.hasIntelGpu = true;
|
|
@@ -21065,21 +21065,21 @@ function sleep$1(ms) {
|
|
|
21065
21065
|
* crashed holder) is stolen.
|
|
21066
21066
|
*/
|
|
21067
21067
|
async function withFileLock(lockPath, fn) {
|
|
21068
|
-
fs
|
|
21068
|
+
fs.mkdirSync(join(lockPath, ".."), { recursive: true });
|
|
21069
21069
|
for (;;) try {
|
|
21070
|
-
const fd = fs
|
|
21071
|
-
fs
|
|
21070
|
+
const fd = fs.openSync(lockPath, "wx");
|
|
21071
|
+
fs.closeSync(fd);
|
|
21072
21072
|
break;
|
|
21073
21073
|
} catch {
|
|
21074
21074
|
try {
|
|
21075
|
-
if (Date.now() - fs
|
|
21075
|
+
if (Date.now() - fs.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs.rmSync(lockPath, { force: true });
|
|
21076
21076
|
else await sleep$1(LOCK_POLL_MS);
|
|
21077
21077
|
} catch {}
|
|
21078
21078
|
}
|
|
21079
21079
|
try {
|
|
21080
21080
|
return await fn();
|
|
21081
21081
|
} finally {
|
|
21082
|
-
fs
|
|
21082
|
+
fs.rmSync(lockPath, { force: true });
|
|
21083
21083
|
}
|
|
21084
21084
|
}
|
|
21085
21085
|
/** Coalesce in-process + serialize cross-process for one binary id. */
|
|
@@ -21137,7 +21137,7 @@ var AddonDepsManager = class {
|
|
|
21137
21137
|
* failed or tampered download throws, and provisioning reports it.
|
|
21138
21138
|
*/
|
|
21139
21139
|
async stageNativeDepsDeclaredBy(requirementsFile) {
|
|
21140
|
-
if (!declaresEdgetpuDelegate(fs
|
|
21140
|
+
if (!declaresEdgetpuDelegate(fs.readFileSync(requirementsFile, "utf8"))) return;
|
|
21141
21141
|
await singleFlight(this.depsDir, "edgetpu-delegate", () => ensureEdgetpuDelegate(this.nodeRoot, this.logger));
|
|
21142
21142
|
}
|
|
21143
21143
|
getDepsDir() {
|
|
@@ -22168,7 +22168,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
|
|
|
22168
22168
|
const addonId = declaration.id;
|
|
22169
22169
|
const nodeDataDir = process.env["CAMSTACK_DATA"] ?? dataDir;
|
|
22170
22170
|
const addonDataDir = path$1.resolve(nodeDataDir, "addons-data", addonId);
|
|
22171
|
-
fs
|
|
22171
|
+
fs.mkdirSync(addonDataDir, { recursive: true });
|
|
22172
22172
|
if (runtime.mode === "broker") ensureBindingSubscription(runtime.broker);
|
|
22173
22173
|
const regs = getRegistries(nodeId);
|
|
22174
22174
|
const workerResolver = {
|
|
@@ -24145,7 +24145,7 @@ var FailedRunnerRetryLedger = class {
|
|
|
24145
24145
|
function readRunnerPackageVersions(addonDirs) {
|
|
24146
24146
|
const out = {};
|
|
24147
24147
|
for (const dir of addonDirs) try {
|
|
24148
|
-
const raw = JSON.parse(fs
|
|
24148
|
+
const raw = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
24149
24149
|
const version = typeof raw === "object" && raw !== null ? Reflect.get(raw, "version") : null;
|
|
24150
24150
|
out[dir] = typeof version === "string" && version.length > 0 ? version : null;
|
|
24151
24151
|
} catch {
|
|
@@ -24206,7 +24206,7 @@ function readAddonHeapDeclaration(spec) {
|
|
|
24206
24206
|
if (cached !== void 0) return cached;
|
|
24207
24207
|
let declaration = EMPTY_HEAP_DECLARATION;
|
|
24208
24208
|
for (const manifestPath of [path$1.join(spec.addonDir, "package.json"), path$1.join(path$1.dirname(spec.addonDir), "package.json")]) try {
|
|
24209
|
-
const raw = fs
|
|
24209
|
+
const raw = fs.readFileSync(manifestPath, "utf8");
|
|
24210
24210
|
const parsed = JSON.parse(raw);
|
|
24211
24211
|
const profile = extractHeapProfile(parsed, spec.addonId);
|
|
24212
24212
|
const maxOldSpaceMb = extractMaxOldSpaceMb(parsed, spec.addonId);
|
|
@@ -25439,17 +25439,17 @@ var JobJournal = class {
|
|
|
25439
25439
|
return path$1.join(this.jobsDir, `${id}.json`);
|
|
25440
25440
|
}
|
|
25441
25441
|
writeAtomic(filePath, data) {
|
|
25442
|
-
fs
|
|
25442
|
+
fs.mkdirSync(path$1.dirname(filePath), { recursive: true });
|
|
25443
25443
|
const tmp = `${filePath}.tmp.${process.pid}.${Date.now()}`;
|
|
25444
|
-
fs
|
|
25444
|
+
fs.writeFileSync(tmp, JSON.stringify(data, null, 2), {
|
|
25445
25445
|
encoding: "utf-8",
|
|
25446
25446
|
mode: 384
|
|
25447
25447
|
});
|
|
25448
|
-
fs
|
|
25448
|
+
fs.renameSync(tmp, filePath);
|
|
25449
25449
|
}
|
|
25450
25450
|
readIndex() {
|
|
25451
25451
|
try {
|
|
25452
|
-
const raw = JSON.parse(fs
|
|
25452
|
+
const raw = JSON.parse(fs.readFileSync(this.indexPath, "utf-8"));
|
|
25453
25453
|
if (raw && Array.isArray(raw.jobIds)) return {
|
|
25454
25454
|
version: 1,
|
|
25455
25455
|
jobIds: raw.jobIds
|
|
@@ -25474,7 +25474,7 @@ var JobJournal = class {
|
|
|
25474
25474
|
}
|
|
25475
25475
|
getJob(id) {
|
|
25476
25476
|
try {
|
|
25477
|
-
const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs
|
|
25477
|
+
const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs.readFileSync(this.jobPath(id), "utf-8")));
|
|
25478
25478
|
return parsed.success ? parsed.data : null;
|
|
25479
25479
|
} catch {
|
|
25480
25480
|
return null;
|
|
@@ -25539,14 +25539,14 @@ var StagingArea = class {
|
|
|
25539
25539
|
}
|
|
25540
25540
|
async fetchAndStage(input) {
|
|
25541
25541
|
const destDir = path$1.join(this.stagingDir, input.jobId, safeSegment(input.name));
|
|
25542
|
-
fs
|
|
25542
|
+
fs.rmSync(destDir, {
|
|
25543
25543
|
recursive: true,
|
|
25544
25544
|
force: true
|
|
25545
25545
|
});
|
|
25546
25546
|
const tgz = await this.deps.fetchTarball(input.name, input.version, input.signal);
|
|
25547
25547
|
if (input.signal.aborted) throw new Error("staging aborted after fetch");
|
|
25548
25548
|
await this.deps.extract(tgz, destDir);
|
|
25549
|
-
const raw = JSON.parse(fs
|
|
25549
|
+
const raw = JSON.parse(fs.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
|
|
25550
25550
|
if (typeof raw.version !== "string" || raw.version.length === 0) throw new Error(`staging validation failed: ${input.name} staged a package.json with no version`);
|
|
25551
25551
|
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}`);
|
|
25552
25552
|
return {
|
|
@@ -25555,7 +25555,7 @@ var StagingArea = class {
|
|
|
25555
25555
|
};
|
|
25556
25556
|
}
|
|
25557
25557
|
cleanup(jobId) {
|
|
25558
|
-
fs
|
|
25558
|
+
fs.rmSync(path$1.join(this.stagingDir, jobId), {
|
|
25559
25559
|
recursive: true,
|
|
25560
25560
|
force: true
|
|
25561
25561
|
});
|
|
@@ -25570,13 +25570,13 @@ var StagingArea = class {
|
|
|
25570
25570
|
sweepOrphans() {
|
|
25571
25571
|
let entries;
|
|
25572
25572
|
try {
|
|
25573
|
-
entries = fs
|
|
25573
|
+
entries = fs.readdirSync(this.stagingDir);
|
|
25574
25574
|
} catch {
|
|
25575
25575
|
return 0;
|
|
25576
25576
|
}
|
|
25577
25577
|
let removed = 0;
|
|
25578
25578
|
for (const name of entries) try {
|
|
25579
|
-
fs
|
|
25579
|
+
fs.rmSync(path$1.join(this.stagingDir, name), {
|
|
25580
25580
|
recursive: true,
|
|
25581
25581
|
force: true
|
|
25582
25582
|
});
|
|
@@ -25754,7 +25754,7 @@ var LifecycleJobEngine = class {
|
|
|
25754
25754
|
* on failure → `failed`.
|
|
25755
25755
|
*/
|
|
25756
25756
|
async reconcileJob(job) {
|
|
25757
|
-
const exists = this.deps.stagedPathExists ?? ((p) => fs
|
|
25757
|
+
const exists = this.deps.stagedPathExists ?? ((p) => fs.existsSync(p));
|
|
25758
25758
|
for (const task of job.tasks) {
|
|
25759
25759
|
if (task.target === "framework") {
|
|
25760
25760
|
if (!this.isTerminal(task.phase)) this.skipFrameworkTask(job, task);
|
|
@@ -26403,7 +26403,7 @@ var CatalogRegistry = class {
|
|
|
26403
26403
|
const file = path$1.join(packageDir, "i18n", `${lang}.json`);
|
|
26404
26404
|
let text;
|
|
26405
26405
|
try {
|
|
26406
|
-
text = fs
|
|
26406
|
+
text = fs.readFileSync(file, "utf8");
|
|
26407
26407
|
} catch {
|
|
26408
26408
|
continue;
|
|
26409
26409
|
}
|