@camstack/server 1.2.738 → 1.2.740
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/api/core/cap-providers.js +14 -16
- package/dist/api/trpc/generated-cap-routers.js +10 -6
- package/package.json +16 -9
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/{agent-https-Bi3JY1e0.js → agent-https-DXWlu1kP.js} +1 -1
- package/system/dist/{agent-https-DiK6iQzW.mjs → agent-https-DcYKH3q_.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 +1 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -5
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +3 -3
- package/system/dist/builtins/composer/composer.addon.mjs +3 -3
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +3 -3
- package/system/dist/builtins/keychain/index.mjs +3 -3
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +5 -5
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +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 +3 -3
- package/system/dist/builtins/snapshot/index.mjs +3 -3
- 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/migrations/installed-runner-resolver.d.ts +3 -0
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +59 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +60 -4
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +115 -115
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{composition-sources-lnsR-YuH.mjs → composition-sources-BNa_vU07.mjs} +1 -1
- package/system/dist/{composition-sources-DQLGJMMh.js → composition-sources-BfWnLt2j.js} +1 -1
- package/system/dist/{constants-D7I0cM20.mjs → constants-DCYUT12P.mjs} +1 -1
- package/system/dist/{constants-DA5jgmYT.js → constants-DugYIgQF.js} +1 -1
- package/system/dist/{coral-accelerators-DBlgWB8k.mjs → coral-accelerators-BW3OcrLD.mjs} +6 -6
- package/system/dist/{custom-action-registry-oHl1xltx.mjs → custom-action-registry-BIJZBObd.mjs} +37 -37
- package/system/dist/{device-ca-Clr2bCe-.mjs → device-ca-BnBFt1ex.mjs} +1 -1
- package/system/dist/{device-ca-GPjZE-Mm.js → device-ca-CFs0PY9S.js} +1 -1
- package/system/dist/{dist-Cyj93AvD.mjs → dist-BF9MiiHX.mjs} +79 -41
- package/system/dist/{dist-Xi7ZQ7UI.js → dist-DwI4ifnv.js} +84 -40
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-ouzCfqVS.mjs → hub-mdns-ciao-CnSqBHO9.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-BMgUdxgG.js → hub-mdns-ciao-Dsk7HF0G.js} +2 -2
- package/system/dist/index.js +7 -7
- package/system/dist/index.mjs +218 -218
- package/system/dist/{restore-archive-UXCD7JO3.mjs → restore-archive-CDgSTubW.mjs} +94 -94
- package/system/dist/{restore-archive-CZozfCX-.js → restore-archive-CnG6nyar.js} +1 -1
- package/system/dist/{retention-BfC_C1vy.mjs → retention-csYEu0l3.mjs} +1 -1
- package/system/dist/{retention-DCrdPMot.js → retention-voCdtR4h.js} +1 -1
- package/system/dist/{wal-maintenance-C2GNRuvy.mjs → wal-maintenance-CTsOr0e7.mjs} +0 -0
- package/system/dist/{wal-maintenance-PjOoh6-K.js → wal-maintenance-DrLnLCGO.js} +0 -0
- package/system/package.json +1 -1
package/system/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as __require } from "./chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { $
|
|
3
|
-
import { d as JWT_SIGNING_KEY_REF, f as JwtSigningKeyUnavailableError, g as processJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, p as SYSTEM_SECRET_OWNER, s as loadDeviceCa, u as verifyDeviceSignature, v as staticJwtSigningKey } from "./device-ca-
|
|
2
|
+
import { $r as logLevelAtMost, Ai as procedureAuthKey, Br as isVoidInput, E as CatalogFileSchema, Fo as ReadinessRegistry, Fs as parseJsonUnknown, Gi as resolveMethodAuth, Io as ReadinessTimeoutError, Jo as asJsonObject$1, Kr as lifecycleJobSchema, Ls as readinessKey, Nr as isArrayOutputSchema, Po as RUNTIME_DEFAULTS, Pr as isCollectionArrayMethod, Ps as parseJsonObject, Vr as kebabToCamel$1, Vs as scopeKey, Xo as asString$1, Xs as withoutCallerStamp, Yo as asNumber, Ys as userError, _i as objectInputDeclaresRequiredDeviceId, _o as DATAPLANE_SECRET_HEADER$1, a as AGENT_MDNS_TXT_KEYS, bt as METHOD_ACCESS_MAP, da as splitTranslationRef, ea as scopesAllowAddon, ec as errMsg$1, ei as looseSchema, fs as expandCapMethods, gi as objectInputDeclaresAddonId, go as CALLER_STAMPED_CAPABILITIES$1, hr as extractNestedAddonId, i as AGENT_MDNS_SERVICE_TYPE, is as createEvent$1, kr as interpolate, ls as defineRecordKinds, ms as getDebugInterest, o as ALL_CAPABILITY_DEFINITIONS, on as addonSettingsCapability, ta as scopesAllowDeviceCap, tc as EventCategory$1, us as emitDownForOwnedCaps, vo as DEVICE_SETTINGS_CONTRIBUTION_METHODS, vs as isDebugChannelName, vt as LOG_LEVEL_RANK, y as CATALOG_LANGS, ya as supportedRuntimes, yo as DEVICE_STATUS_METHOD, zr as isObjectInput, zs as resolveCapMount } from "./dist-BF9MiiHX.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-BnBFt1ex.mjs";
|
|
4
4
|
import { t as require_read_all_rows } from "./read-all-rows-TaPqdWNF.mjs";
|
|
5
5
|
import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
|
|
6
6
|
import "./builtins/alerts/index.mjs";
|
|
@@ -25,22 +25,22 @@ import { LokiDestination, LokiLoggingAddon } from "./builtins/loki-logging/index
|
|
|
25
25
|
import NativeMetricsAddon, { a as NativeMetricsProvider, i as parseProcStatusRss, n as nodeProcReader, r as parseProcStat } from "./builtins/native-metrics/native-metrics.addon.mjs";
|
|
26
26
|
import { DeviceHistoryAddon } from "./builtins/device-history/device-history.addon.mjs";
|
|
27
27
|
import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./builtins/sqlite-storage/filesystem-storage.addon.mjs";
|
|
28
|
-
import { D as RecordsEngine, l as SqliteSettingsBackend } from "./wal-maintenance-
|
|
28
|
+
import { D as RecordsEngine, l as SqliteSettingsBackend } from "./wal-maintenance-CTsOr0e7.mjs";
|
|
29
29
|
import { SqliteSettingsAddon } from "./builtins/sqlite-storage/sqlite-settings.addon.mjs";
|
|
30
30
|
import { ConfigStore, DeviceStore } from "./builtins/sqlite-storage/index.mjs";
|
|
31
31
|
import { StorageOrchestratorAddon, a as stripForwardedCaller, i as createHubCapForwardService, l as STORAGE_DRAIN_STATE_LEGACY, n as HUB_CAP_FWD_ACTION, o as buildStorageLocationRegistry, r as HUB_CAP_FWD_SERVICE, t as StorageOrchestratorService, u as storageOrchestratorRecordKinds } from "./builtins/storage-orchestrator/storage-orchestrator.addon.mjs";
|
|
32
32
|
import "./builtins/storage-orchestrator/index.mjs";
|
|
33
|
-
import { A as buildNameConstraintSet, B as setProcessAgentHttpsNames, C as LEAF_RENEWAL_WINDOW_DAYS, E as evaluateExistingCert, F as readNameConstraints, I as AGENT_HTTPS_NAMES_COLLECTION, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, N as permitsIdentity, O as PERMITTED_DNS_SUFFIXES, P as permitsName, R as AgentHttpsNames, S as CA_VALIDITY_DAYS, T as SERVER_AUTH_OID, a as collectAgentNames, b as collectCertIdentity, c as installAgentHttps, d as issueAgentHttpsLeaf, f as loadAgentHttps, h as CA_COMMON_NAME, i as certificateNames, j as isConstrainedCa, k as PERMITTED_IP_RANGES, l as isContainerBridgeAddress, m as pinnedHttpsCaFingerprint, n as acceptAgentSans, o as createAgentHttpsRequest, p as pemDigest, r as agentHttpsPaths, s as describeHttpsLeaf, t as AgentHttpsInstallError, u as isPrivateAddress, w as MAX_LEAF_VALIDITY_DAYS, x as systemHostFacts, y as localCaCommonName, z as getProcessAgentHttpsNames } from "./agent-https-
|
|
34
|
-
import { a as MESH_CA_KEY_REF, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY } from "./constants-
|
|
33
|
+
import { A as buildNameConstraintSet, B as setProcessAgentHttpsNames, C as LEAF_RENEWAL_WINDOW_DAYS, E as evaluateExistingCert, F as readNameConstraints, I as AGENT_HTTPS_NAMES_COLLECTION, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, N as permitsIdentity, O as PERMITTED_DNS_SUFFIXES, P as permitsName, R as AgentHttpsNames, S as CA_VALIDITY_DAYS, T as SERVER_AUTH_OID, a as collectAgentNames, b as collectCertIdentity, c as installAgentHttps, d as issueAgentHttpsLeaf, f as loadAgentHttps, h as CA_COMMON_NAME, i as certificateNames, j as isConstrainedCa, k as PERMITTED_IP_RANGES, l as isContainerBridgeAddress, m as pinnedHttpsCaFingerprint, n as acceptAgentSans, o as createAgentHttpsRequest, p as pemDigest, r as agentHttpsPaths, s as describeHttpsLeaf, t as AgentHttpsInstallError, u as isPrivateAddress, w as MAX_LEAF_VALIDITY_DAYS, x as systemHostFacts, y as localCaCommonName, z as getProcessAgentHttpsNames } from "./agent-https-DcYKH3q_.mjs";
|
|
34
|
+
import { a as MESH_CA_KEY_REF, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY } from "./constants-DCYUT12P.mjs";
|
|
35
35
|
import { $ as caFingerprintCompact, A as getProcessNodeMeshTransport, B as MESH_NODE_CERTIFICATES_COLLECTION, C as MESH_TLS_PORT_HELLO_FIELD, Ct as readOriginSetting, D as setProcessMeshTlsEnabler, Dt as readCidrSetting, E as ServiceBroker, Et as parseCidrList, F as renewMeshCertificate, G as getProcessMeshCertificateRegistry, H as MeshCertificateRegistry, I as revokeMeshCertificate, J as processMeshCrl, K as setProcessMeshCertificateRegistry, L as getProcessMeshTlsListenerState, M as isProcessVerifiedMeshPeer, N as onProcessNodeRegistered, O as dropProcessPeer, P as setProcessMeshPeerTransportLookup, Q as caFingerprint, R as openMeshTlsWhenRevocationsLoaded, S as verifyMembershipAnswer, St as parseOriginList, SystemConfigAddon, T as Errors, Tt as normalizeIp, U as RENEWAL_ABANDONED, V as MESH_NODE_CERTIFICATES_COLUMNS, W as describeMeshLeaf, X as getProcessMeshCaState, Y as MeshCaKeeper, Z as requireProcessMeshCa, _ as signPairingProof, _t as verifyAgentUiUnlockTicket, a as hubHostFromMeshAddress, at as issueMeshLeafForNode, b as MembershipResponder, bt as isInsecureOrigin, c as PAIRING_MAX_SESSIONS, ct as AGENT_DASHBOARD_ORIGINS_FIELD, d as PAIRING_PROTOCOL, dt as AGENT_UI_UNLOCK_USE, et as createMeshCsrPem, f as PAIRING_TTL_MS, ft as AGENT_UI_UNLOCK_VERSION, g as keyFingerprintShort, gt as parseAgentDashboardOrigins, h as describeCsr, ht as mintAgentUiUnlockTicket, i as AgentPairing, it as isValidAgentNodeId, j as getProcessPeerLeaf, k as emitProcessNodeRegistered, l as PAIRING_PATHS, lt as AGENT_UI_UNLOCK_TTL_MS, m as computePairingSas, mt as isAllowedAgentDashboardReturnTo, n as HubPairing, nt as generateMeshCa, o as PAIRING_CODE_DIGITS, ot as issueMeshLeafFromCsr, p as computePairingCommitment, pt as UnlockTicketJtiStore, q as MeshCrl, r as PairingHttpError, rt as generateMeshKeyPair, s as PAIRING_MAX_CODE_ATTEMPTS, st as loadMeshCa, tt as exportMeshPrivateKeyPem, u as PAIRING_PIN_DIGITS, ut as AGENT_UI_UNLOCK_TYP, v as verifyPairingProof, vt as InvalidCorsOriginError, w as TlsTcpTransporter, wt as createCidrMatcher, x as signMembershipProof, xt as normalizeOrigin, y as MEMBERSHIP_PATHS, yt as OPAQUE_ORIGIN, z as setProcessMeshTlsListenerState } from "./builtins/system-config/system-config.addon.mjs";
|
|
36
36
|
import "./builtins/system-config/index.mjs";
|
|
37
37
|
import { WinstonDestination, WinstonLoggingAddon } from "./builtins/winston-logging/index.mjs";
|
|
38
|
-
import { C as isModelDownloaded, E as setHuggingFaceReachabilityObserver, T as revisionWeightUrl, _ as downloadFile, a as startEventLoopStallMonitor, b as fetchJson, c as createAuthenticatedFileServer, d as resolveFilePath, f as ModelDownloadService, g as deleteModelFromDisk, h as collectModelFiles, i as attributeStall, l as parseRangeHeader, m as adoptModelRevisions, n as STALL_REPORT_MS, o as createFileDataPlaneHandler, r as STALL_TICK_MS, s as contentTypeFor, t as CustomActionRegistry, u as parseTokenizedUrl, v as downloadModel, w as resolveFormatRevision, x as getModelFilePath, y as ensureModel } from "./custom-action-registry-
|
|
39
|
-
import { A as retirePreviousLocalCa, C as checkUploadedCa, D as loadTlsCert, E as ensureTlsCert, F as closeLanHttp, I as readLanHttpState, L as registerLanHttpHandler, M as allFamiliesListenHost, N as applyLanHttp, O as reissueTlsLeaf, P as bindPendingLanHttp, S as chainsToPublicRoot, T as caReplacementMarkerFile, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, c as leafFingerprintOf, d as servedHttpsLeafFingerprint, f as prepareBootTls, g as readTlsEnabled, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, k as replaceUnconstrainedLocalCa, l as registerHttpsListener, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, p as UPLOADED_CA_FILE, r as regenerateCertificate, s as clearHttpsListener, t as createCiaoPublisher, u as reloadHttpsListener, v as splitPemCertificates, w as validateUploadedTls, x as writeTlsMode, y as writeExtraSans } from "./hub-mdns-ciao-
|
|
38
|
+
import { C as isModelDownloaded, E as setHuggingFaceReachabilityObserver, T as revisionWeightUrl, _ as downloadFile, a as startEventLoopStallMonitor, b as fetchJson, c as createAuthenticatedFileServer, d as resolveFilePath, f as ModelDownloadService, g as deleteModelFromDisk, h as collectModelFiles, i as attributeStall, l as parseRangeHeader, m as adoptModelRevisions, n as STALL_REPORT_MS, o as createFileDataPlaneHandler, r as STALL_TICK_MS, s as contentTypeFor, t as CustomActionRegistry, u as parseTokenizedUrl, v as downloadModel, w as resolveFormatRevision, x as getModelFilePath, y as ensureModel } from "./custom-action-registry-BIJZBObd.mjs";
|
|
39
|
+
import { A as retirePreviousLocalCa, C as checkUploadedCa, D as loadTlsCert, E as ensureTlsCert, F as closeLanHttp, I as readLanHttpState, L as registerLanHttpHandler, M as allFamiliesListenHost, N as applyLanHttp, O as reissueTlsLeaf, P as bindPendingLanHttp, S as chainsToPublicRoot, T as caReplacementMarkerFile, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, c as leafFingerprintOf, d as servedHttpsLeafFingerprint, f as prepareBootTls, g as readTlsEnabled, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, k as replaceUnconstrainedLocalCa, l as registerHttpsListener, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, p as UPLOADED_CA_FILE, r as regenerateCertificate, s as clearHttpsListener, t as createCiaoPublisher, u as reloadHttpsListener, v as splitPemCertificates, w as validateUploadedTls, x as writeTlsMode, y as writeExtraSans } from "./hub-mdns-ciao-CnSqBHO9.mjs";
|
|
40
40
|
import { n as getPlatformKeychainKey, r as setPlatformKeychainKey, t as clearPlatformKeychainKey } from "./platform-key-source-BWlq0jjn.mjs";
|
|
41
41
|
import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-Di9daRwI.mjs";
|
|
42
|
-
import { _ as backupRecordStoresOf, c as BackupDecryptError, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, h as readBackupEncryptionHeader, l as BackupKeyFormatError, r as prepareRestoreArchive, s as SystemBackupService, t as BackupKeyRequiredError, u as BackupKeyMismatchError } from "./restore-archive-
|
|
43
|
-
import { r as nodeCoralFs, t as classifyCoralAccelerator } from "./coral-accelerators-
|
|
42
|
+
import { _ as backupRecordStoresOf, c as BackupDecryptError, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, h as readBackupEncryptionHeader, l as BackupKeyFormatError, r as prepareRestoreArchive, s as SystemBackupService, t as BackupKeyRequiredError, u as BackupKeyMismatchError } from "./restore-archive-CDgSTubW.mjs";
|
|
43
|
+
import { r as nodeCoralFs, t as classifyCoralAccelerator } from "./coral-accelerators-BW3OcrLD.mjs";
|
|
44
44
|
import { z } from "zod";
|
|
45
45
|
import * as crypto$1 from "node:crypto";
|
|
46
46
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
@@ -55,7 +55,7 @@ import { BOOT_RECOVERY_BACKOFF_MS, CALLER_STAMPED_CAPABILITIES, DATAPLANE_SECRET
|
|
|
55
55
|
import * as os$1 from "node:os";
|
|
56
56
|
import { tmpdir } from "node:os";
|
|
57
57
|
import { pathToFileURL } from "node:url";
|
|
58
|
-
import * as fs
|
|
58
|
+
import * as fs from "node:fs";
|
|
59
59
|
import { accessSync, constants, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync } from "node:fs";
|
|
60
60
|
import { execFile, spawn } from "node:child_process";
|
|
61
61
|
import { once } from "node:events";
|
|
@@ -5113,7 +5113,7 @@ var PythonEnvManager = class {
|
|
|
5113
5113
|
async ensure(options) {
|
|
5114
5114
|
const probe = await this.probe();
|
|
5115
5115
|
if (!probe.available || !probe.path) throw userError("system.python-required", void 0, "Python 3.10+ is required but not found on this system");
|
|
5116
|
-
if (!fs
|
|
5116
|
+
if (!fs.existsSync(path$1.join(this.venvPath, "bin", "python"))) await execFileAsync$7(probe.path, [
|
|
5117
5117
|
"-m",
|
|
5118
5118
|
"venv",
|
|
5119
5119
|
this.venvPath
|
|
@@ -5136,7 +5136,7 @@ var PythonEnvManager = class {
|
|
|
5136
5136
|
}
|
|
5137
5137
|
spawn(script, args) {
|
|
5138
5138
|
const venvPython = path$1.join(this.venvPath, "bin", "python");
|
|
5139
|
-
if (!fs
|
|
5139
|
+
if (!fs.existsSync(venvPython)) throw new Error("Python venv not initialized. Call ensure() first.");
|
|
5140
5140
|
return spawn(venvPython, [script, ...args]);
|
|
5141
5141
|
}
|
|
5142
5142
|
};
|
|
@@ -5488,20 +5488,20 @@ var StorageManager = class {
|
|
|
5488
5488
|
const basePath = this.locationManager.getBackend(mappedName).basePath;
|
|
5489
5489
|
location.files = {
|
|
5490
5490
|
async readFile(p) {
|
|
5491
|
-
return fs
|
|
5491
|
+
return fs.promises.readFile(path$1.join(basePath, p));
|
|
5492
5492
|
},
|
|
5493
5493
|
async writeFile(p, data) {
|
|
5494
5494
|
const full = path$1.join(basePath, p);
|
|
5495
|
-
await fs
|
|
5496
|
-
await fs
|
|
5495
|
+
await fs.promises.mkdir(path$1.dirname(full), { recursive: true });
|
|
5496
|
+
await fs.promises.writeFile(full, data);
|
|
5497
5497
|
},
|
|
5498
5498
|
async deleteFile(p) {
|
|
5499
|
-
await fs
|
|
5499
|
+
await fs.promises.rm(path$1.join(basePath, p), { force: true });
|
|
5500
5500
|
},
|
|
5501
5501
|
async listFiles(prefix) {
|
|
5502
5502
|
const dir = prefix ? path$1.join(basePath, prefix) : basePath;
|
|
5503
5503
|
try {
|
|
5504
|
-
return (await fs
|
|
5504
|
+
return (await fs.promises.readdir(dir)).map((f) => prefix ? `${prefix}/${f}` : f);
|
|
5505
5505
|
} catch {
|
|
5506
5506
|
return [];
|
|
5507
5507
|
}
|
|
@@ -5511,7 +5511,7 @@ var StorageManager = class {
|
|
|
5511
5511
|
},
|
|
5512
5512
|
async exists(p) {
|
|
5513
5513
|
try {
|
|
5514
|
-
await fs
|
|
5514
|
+
await fs.promises.access(path$1.join(basePath, p));
|
|
5515
5515
|
return true;
|
|
5516
5516
|
} catch {
|
|
5517
5517
|
return false;
|
|
@@ -6282,7 +6282,7 @@ var TRADITIONAL_NATIVE_PACKAGES = ["better-sqlite3"];
|
|
|
6282
6282
|
function hasDotNode(dir, maxDepth) {
|
|
6283
6283
|
let entries;
|
|
6284
6284
|
try {
|
|
6285
|
-
entries = fs
|
|
6285
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
6286
6286
|
} catch {
|
|
6287
6287
|
return false;
|
|
6288
6288
|
}
|
|
@@ -6293,7 +6293,7 @@ function hasDotNode(dir, maxDepth) {
|
|
|
6293
6293
|
}
|
|
6294
6294
|
/** Locate the bundled `prebuild-install` bin.js inside the staged closure. */
|
|
6295
6295
|
function resolvePrebuildInstallBin(closureDir, moduleDir) {
|
|
6296
|
-
return [path$1.join(moduleDir, "node_modules", "prebuild-install", "bin.js"), path$1.join(closureDir, "node_modules", "prebuild-install", "bin.js")].find((c) => fs
|
|
6296
|
+
return [path$1.join(moduleDir, "node_modules", "prebuild-install", "bin.js"), path$1.join(closureDir, "node_modules", "prebuild-install", "bin.js")].find((c) => fs.existsSync(c)) ?? null;
|
|
6297
6297
|
}
|
|
6298
6298
|
/**
|
|
6299
6299
|
* Default fetcher: run the closure's own `prebuild-install` under the CURRENT
|
|
@@ -6346,7 +6346,7 @@ async function ensureNativePrebuilds(closureDir, options) {
|
|
|
6346
6346
|
const fetched = [];
|
|
6347
6347
|
for (const pkg of packages) {
|
|
6348
6348
|
const moduleDir = path$1.join(nm, pkg);
|
|
6349
|
-
if (!fs
|
|
6349
|
+
if (!fs.existsSync(moduleDir)) continue;
|
|
6350
6350
|
if (hasDotNode(moduleDir, 4)) continue;
|
|
6351
6351
|
options.logger.warn("staged closure native prebuild missing — fetching for running ABI", { meta: {
|
|
6352
6352
|
pkg,
|
|
@@ -6409,12 +6409,12 @@ async function ensureNativePrebuilds(closureDir, options) {
|
|
|
6409
6409
|
function replantFromBundled(srcModuleDir, dstModuleDir, hasNative) {
|
|
6410
6410
|
if (!hasNative(srcModuleDir)) return false;
|
|
6411
6411
|
try {
|
|
6412
|
-
fs
|
|
6412
|
+
fs.rmSync(dstModuleDir, {
|
|
6413
6413
|
recursive: true,
|
|
6414
6414
|
force: true
|
|
6415
6415
|
});
|
|
6416
|
-
fs
|
|
6417
|
-
fs
|
|
6416
|
+
fs.mkdirSync(path$1.dirname(dstModuleDir), { recursive: true });
|
|
6417
|
+
fs.cpSync(srcModuleDir, dstModuleDir, {
|
|
6418
6418
|
recursive: true,
|
|
6419
6419
|
dereference: true
|
|
6420
6420
|
});
|
|
@@ -6443,7 +6443,7 @@ async function ensureAddonNativePrebuilds(addonDir, options) {
|
|
|
6443
6443
|
const missing = [];
|
|
6444
6444
|
for (const pkg of packages) {
|
|
6445
6445
|
const moduleDir = path$1.join(nm, pkg);
|
|
6446
|
-
if (!fs
|
|
6446
|
+
if (!fs.existsSync(moduleDir)) continue;
|
|
6447
6447
|
if (hasNative(moduleDir)) {
|
|
6448
6448
|
results.push({
|
|
6449
6449
|
pkg,
|
|
@@ -6542,7 +6542,7 @@ async function defaultDownloadTarball(url, destTgz) {
|
|
|
6542
6542
|
const res = await fetch(url);
|
|
6543
6543
|
if (!res.ok || !res.body) throw new Error(`HTTP ${res.status} downloading ${url}`);
|
|
6544
6544
|
const bytes = Buffer.from(await res.arrayBuffer());
|
|
6545
|
-
await fs
|
|
6545
|
+
await fs.promises.writeFile(destTgz, bytes);
|
|
6546
6546
|
}
|
|
6547
6547
|
async function defaultExtractTarball(tgzPath, destDir) {
|
|
6548
6548
|
await execFileAsync$5("tar", [
|
|
@@ -6628,7 +6628,7 @@ async function resolveUncached(options) {
|
|
|
6628
6628
|
argsPrefix: []
|
|
6629
6629
|
};
|
|
6630
6630
|
const cliPath = bootstrappedCliPath(options.cacheDir);
|
|
6631
|
-
if (fs
|
|
6631
|
+
if (fs.existsSync(cliPath)) {
|
|
6632
6632
|
options.logger.info("system npm unavailable — using bootstrapped npm", { meta: { cliPath } });
|
|
6633
6633
|
return {
|
|
6634
6634
|
command: process.execPath,
|
|
@@ -6640,12 +6640,12 @@ async function resolveUncached(options) {
|
|
|
6640
6640
|
const registry = (options.registry ?? DEFAULT_REGISTRY).replace(/\/+$/, "");
|
|
6641
6641
|
const tarballUrl = tarballUrlOf(await (options.fetchJson ?? defaultFetchJson)(`${registry}/npm/latest`));
|
|
6642
6642
|
if (!tarballUrl) throw new Error(`registry metadata for 'npm' carries no dist.tarball (${registry})`);
|
|
6643
|
-
await fs
|
|
6643
|
+
await fs.promises.mkdir(options.cacheDir, { recursive: true });
|
|
6644
6644
|
const tgzPath = path$1.join(options.cacheDir, "npm-bootstrap.tgz");
|
|
6645
6645
|
await (options.downloadTarball ?? defaultDownloadTarball)(tarballUrl, tgzPath);
|
|
6646
6646
|
await (options.extractTarball ?? defaultExtractTarball)(tgzPath, options.cacheDir);
|
|
6647
|
-
await fs
|
|
6648
|
-
if (!fs
|
|
6647
|
+
await fs.promises.rm(tgzPath, { force: true });
|
|
6648
|
+
if (!fs.existsSync(cliPath)) throw new Error(`extracted npm tarball is missing ${cliPath}`);
|
|
6649
6649
|
options.logger.info("npm bootstrapped", { meta: { cliPath } });
|
|
6650
6650
|
return {
|
|
6651
6651
|
command: process.execPath,
|
|
@@ -6711,7 +6711,7 @@ function readOwningPackageVersion(entryPath) {
|
|
|
6711
6711
|
let dir = path$1.dirname(entryPath);
|
|
6712
6712
|
for (let hop = 0; hop < PACKAGE_JSON_LOOKUP_DEPTH; hop++) {
|
|
6713
6713
|
try {
|
|
6714
|
-
const version = asJsonObject$1(parseJsonUnknown(fs
|
|
6714
|
+
const version = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8")))?.["version"];
|
|
6715
6715
|
if (typeof version === "string" && version.length > 0) return version;
|
|
6716
6716
|
} catch {}
|
|
6717
6717
|
const parent = path$1.dirname(dir);
|
|
@@ -6755,14 +6755,14 @@ function readOwningPackageVersion(entryPath) {
|
|
|
6755
6755
|
function addonModuleCacheKey(entryPath) {
|
|
6756
6756
|
let stat;
|
|
6757
6757
|
try {
|
|
6758
|
-
stat = fs
|
|
6758
|
+
stat = fs.statSync(entryPath);
|
|
6759
6759
|
} catch {
|
|
6760
6760
|
return null;
|
|
6761
6761
|
}
|
|
6762
6762
|
const version = readOwningPackageVersion(entryPath) ?? `m${stat.mtimeMs}`;
|
|
6763
6763
|
let content;
|
|
6764
6764
|
try {
|
|
6765
|
-
content = createHash("sha1").update(fs
|
|
6765
|
+
content = createHash("sha1").update(fs.readFileSync(entryPath)).digest("hex").slice(0, 16);
|
|
6766
6766
|
} catch {
|
|
6767
6767
|
content = `m${stat.mtimeMs}s${stat.size}`;
|
|
6768
6768
|
}
|
|
@@ -6866,14 +6866,14 @@ var AddonLoader = class {
|
|
|
6866
6866
|
* BUILTINS from the active closure, not the (now-inert) addons-dir copy, so
|
|
6867
6867
|
* the addons-dir `@camstack/server/system` must NOT be double-loaded here. */
|
|
6868
6868
|
async loadFromDirectory(addonsDir, skipPackages = []) {
|
|
6869
|
-
if (!fs
|
|
6869
|
+
if (!fs.existsSync(addonsDir)) return;
|
|
6870
6870
|
const skip = new Set(skipPackages);
|
|
6871
|
-
const entries = fs
|
|
6871
|
+
const entries = fs.readdirSync(addonsDir, { withFileTypes: true });
|
|
6872
6872
|
for (const entry of entries) {
|
|
6873
6873
|
if (!isDirectoryEntry(entry, addonsDir)) continue;
|
|
6874
6874
|
if (entry.name.startsWith("@")) {
|
|
6875
6875
|
const scopeDir = path$1.join(addonsDir, entry.name);
|
|
6876
|
-
const scopeEntries = fs
|
|
6876
|
+
const scopeEntries = fs.readdirSync(scopeDir, { withFileTypes: true });
|
|
6877
6877
|
for (const scopeEntry of scopeEntries) {
|
|
6878
6878
|
if (!isDirectoryEntry(scopeEntry, scopeDir)) continue;
|
|
6879
6879
|
if (skip.has(`${entry.name}/${scopeEntry.name}`)) continue;
|
|
@@ -6887,7 +6887,7 @@ var AddonLoader = class {
|
|
|
6887
6887
|
}
|
|
6888
6888
|
async tryLoadAddon(addonDir) {
|
|
6889
6889
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
6890
|
-
if (!fs
|
|
6890
|
+
if (!fs.existsSync(pkgJsonPath)) return;
|
|
6891
6891
|
try {
|
|
6892
6892
|
await this.loadFromAddonDir(addonDir);
|
|
6893
6893
|
} catch (err) {
|
|
@@ -6905,7 +6905,7 @@ var AddonLoader = class {
|
|
|
6905
6905
|
/** Load addon from a specific directory (package.json + dist/) */
|
|
6906
6906
|
async loadFromAddonDir(addonDir) {
|
|
6907
6907
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
6908
|
-
const pkgJson = asJsonObject$1(parseJsonUnknown(fs
|
|
6908
|
+
const pkgJson = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
6909
6909
|
const packageNameRaw = pkgJson["name"];
|
|
6910
6910
|
const packageName = typeof packageNameRaw === "string" ? packageNameRaw : "";
|
|
6911
6911
|
const packageVersionRaw = pkgJson["version"];
|
|
@@ -6952,7 +6952,7 @@ var AddonLoader = class {
|
|
|
6952
6952
|
}
|
|
6953
6953
|
const entryFile = declaration.entry.replace(/^\.\//, "").replace(/^src\//, "dist/").replace(/\.ts$/, ".js");
|
|
6954
6954
|
let entryPath = path$1.resolve(addonDir, entryFile);
|
|
6955
|
-
if (!fs
|
|
6955
|
+
if (!fs.existsSync(entryPath)) {
|
|
6956
6956
|
const base = entryPath.replace(/\.(js|cjs|mjs)$/, "");
|
|
6957
6957
|
entryPath = [
|
|
6958
6958
|
`${base}.cjs`,
|
|
@@ -6961,9 +6961,9 @@ var AddonLoader = class {
|
|
|
6961
6961
|
path$1.resolve(addonDir, "dist", "index.cjs"),
|
|
6962
6962
|
path$1.resolve(addonDir, "dist", "index.mjs"),
|
|
6963
6963
|
path$1.resolve(addonDir, declaration.entry)
|
|
6964
|
-
].find((p) => fs
|
|
6964
|
+
].find((p) => fs.existsSync(p)) ?? entryPath;
|
|
6965
6965
|
}
|
|
6966
|
-
if (!fs
|
|
6966
|
+
if (!fs.existsSync(entryPath)) throw new Error(`Entry not found: ${entryPath}`);
|
|
6967
6967
|
const modUnknown = await importAddonModuleFresh(entryPath);
|
|
6968
6968
|
const mod = isRecord$4(modUnknown) ? modUnknown : {};
|
|
6969
6969
|
const AddonClass = resolveAddonClass(mod);
|
|
@@ -7048,7 +7048,7 @@ function isDirectoryEntry(entry, parentDir) {
|
|
|
7048
7048
|
if (entry.name.startsWith(".")) return false;
|
|
7049
7049
|
if (entry.isDirectory()) return true;
|
|
7050
7050
|
if (entry.isSymbolicLink()) try {
|
|
7051
|
-
return fs
|
|
7051
|
+
return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
7052
7052
|
} catch {
|
|
7053
7053
|
return false;
|
|
7054
7054
|
}
|
|
@@ -7142,7 +7142,7 @@ var execFileAsync$4 = promisify(execFile);
|
|
|
7142
7142
|
* Single source of truth — replaces scattered mkdirSync calls.
|
|
7143
7143
|
*/
|
|
7144
7144
|
function ensureDir(dirPath) {
|
|
7145
|
-
fs
|
|
7145
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
7146
7146
|
}
|
|
7147
7147
|
/**
|
|
7148
7148
|
* Copy a directory recursively — ASYNC so it never blocks the event loop.
|
|
@@ -7155,7 +7155,7 @@ function ensureDir(dirPath) {
|
|
|
7155
7155
|
* `fs.promises.cp` keeps the I/O off the event loop. (Node ≥18 stable.)
|
|
7156
7156
|
*/
|
|
7157
7157
|
async function copyDirRecursive(src, dest) {
|
|
7158
|
-
await fs
|
|
7158
|
+
await fs.promises.cp(src, dest, {
|
|
7159
7159
|
recursive: true,
|
|
7160
7160
|
force: true
|
|
7161
7161
|
});
|
|
@@ -7260,13 +7260,13 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
7260
7260
|
if (typeof fileEntry !== "string") continue;
|
|
7261
7261
|
if (fileEntry === "dist" || fileEntry.includes("*")) continue;
|
|
7262
7262
|
const srcPath = path$1.join(sourceDir, fileEntry);
|
|
7263
|
-
if (!fs
|
|
7263
|
+
if (!fs.existsSync(srcPath)) continue;
|
|
7264
7264
|
const destPath = path$1.join(destDir, fileEntry);
|
|
7265
|
-
const stat = await fs
|
|
7265
|
+
const stat = await fs.promises.stat(srcPath);
|
|
7266
7266
|
if (stat.isDirectory()) await copyDirRecursive(srcPath, destPath);
|
|
7267
7267
|
else if (stat.isFile()) {
|
|
7268
7268
|
ensureDir(path$1.dirname(destPath));
|
|
7269
|
-
await fs
|
|
7269
|
+
await fs.promises.copyFile(srcPath, destPath);
|
|
7270
7270
|
}
|
|
7271
7271
|
}
|
|
7272
7272
|
}
|
|
@@ -7277,10 +7277,10 @@ async function copyExtraFileDirs(pkgJson, sourceDir, destDir) {
|
|
|
7277
7277
|
function isSourceNewer(packageDir) {
|
|
7278
7278
|
const srcDir = path$1.join(packageDir, "src");
|
|
7279
7279
|
const distDir = path$1.join(packageDir, "dist");
|
|
7280
|
-
if (!fs
|
|
7280
|
+
if (!fs.existsSync(srcDir) || !fs.existsSync(distDir)) return true;
|
|
7281
7281
|
try {
|
|
7282
|
-
const distMtime = fs
|
|
7283
|
-
const entries = fs
|
|
7282
|
+
const distMtime = fs.statSync(distDir).mtimeMs;
|
|
7283
|
+
const entries = fs.readdirSync(srcDir, {
|
|
7284
7284
|
withFileTypes: true,
|
|
7285
7285
|
recursive: true
|
|
7286
7286
|
});
|
|
@@ -7288,7 +7288,7 @@ function isSourceNewer(packageDir) {
|
|
|
7288
7288
|
if (!entry.isFile()) continue;
|
|
7289
7289
|
const parentDir = entry.parentPath ?? String(Reflect.get(entry, "path") ?? "");
|
|
7290
7290
|
const filePath = path$1.join(parentDir, entry.name);
|
|
7291
|
-
if (fs
|
|
7291
|
+
if (fs.statSync(filePath).mtimeMs > distMtime) return true;
|
|
7292
7292
|
}
|
|
7293
7293
|
return false;
|
|
7294
7294
|
} catch {
|
|
@@ -7305,7 +7305,7 @@ function isSourceNewer(packageDir) {
|
|
|
7305
7305
|
* `copyDirRecursive` for the wedge this prevents.
|
|
7306
7306
|
*/
|
|
7307
7307
|
async function installPackageFromNpm(packageName, targetDir) {
|
|
7308
|
-
const tmpDir = await fs
|
|
7308
|
+
const tmpDir = await fs.promises.mkdtemp(path$1.join(os$1.tmpdir(), "camstack-install-"));
|
|
7309
7309
|
try {
|
|
7310
7310
|
const { stdout } = await execFileAsync$4("npm", [
|
|
7311
7311
|
"pack",
|
|
@@ -7328,21 +7328,21 @@ async function installPackageFromNpm(packageName, targetDir) {
|
|
|
7328
7328
|
extractDir
|
|
7329
7329
|
], { timeout: 3e4 });
|
|
7330
7330
|
const packageSubDir = path$1.join(extractDir, "package");
|
|
7331
|
-
const srcPkgJsonDir = fs
|
|
7332
|
-
await fs
|
|
7331
|
+
const srcPkgJsonDir = fs.existsSync(path$1.join(packageSubDir, "package.json")) ? packageSubDir : extractDir;
|
|
7332
|
+
await fs.promises.rm(targetDir, {
|
|
7333
7333
|
recursive: true,
|
|
7334
7334
|
force: true
|
|
7335
7335
|
});
|
|
7336
7336
|
ensureDir(targetDir);
|
|
7337
|
-
await fs
|
|
7337
|
+
await fs.promises.copyFile(path$1.join(srcPkgJsonDir, "package.json"), path$1.join(targetDir, "package.json"));
|
|
7338
7338
|
const distSrc = path$1.join(srcPkgJsonDir, "dist");
|
|
7339
|
-
if (fs
|
|
7339
|
+
if (fs.existsSync(distSrc)) await copyDirRecursive(distSrc, path$1.join(targetDir, "dist"));
|
|
7340
7340
|
try {
|
|
7341
|
-
const npmPkg = asJsonObject$1(parseJsonUnknown(await fs
|
|
7341
|
+
const npmPkg = asJsonObject$1(parseJsonUnknown(await fs.promises.readFile(path$1.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
7342
7342
|
if (npmPkg) await copyExtraFileDirs(npmPkg, srcPkgJsonDir, targetDir);
|
|
7343
7343
|
} catch {}
|
|
7344
7344
|
} finally {
|
|
7345
|
-
await fs
|
|
7345
|
+
await fs.promises.rm(tmpDir, {
|
|
7346
7346
|
recursive: true,
|
|
7347
7347
|
force: true
|
|
7348
7348
|
});
|
|
@@ -7367,7 +7367,7 @@ function packageDirName$1(declaredName) {
|
|
|
7367
7367
|
}
|
|
7368
7368
|
function isDirLike$1(p) {
|
|
7369
7369
|
try {
|
|
7370
|
-
return fs
|
|
7370
|
+
return fs.statSync(p).isDirectory();
|
|
7371
7371
|
} catch {
|
|
7372
7372
|
return false;
|
|
7373
7373
|
}
|
|
@@ -7385,12 +7385,12 @@ var AddonManifest = class {
|
|
|
7385
7385
|
*/
|
|
7386
7386
|
read() {
|
|
7387
7387
|
if (this.cache != null) return this.cache;
|
|
7388
|
-
if (!fs
|
|
7388
|
+
if (!fs.existsSync(this.manifestPath)) {
|
|
7389
7389
|
this.cache = this.empty();
|
|
7390
7390
|
return this.cache;
|
|
7391
7391
|
}
|
|
7392
7392
|
try {
|
|
7393
|
-
const raw = fs
|
|
7393
|
+
const raw = fs.readFileSync(this.manifestPath, "utf-8");
|
|
7394
7394
|
const parsed = JSON.parse(raw);
|
|
7395
7395
|
if (parsed.version !== MANIFEST_VERSION) {
|
|
7396
7396
|
process.stderr.write(`[AddonManifest] schema mismatch (file=${parsed.version} vs runtime=${MANIFEST_VERSION}); starting empty\n`);
|
|
@@ -7411,13 +7411,13 @@ var AddonManifest = class {
|
|
|
7411
7411
|
* a half-written file.
|
|
7412
7412
|
*/
|
|
7413
7413
|
write(manifest) {
|
|
7414
|
-
fs
|
|
7414
|
+
fs.mkdirSync(path$1.dirname(this.manifestPath), { recursive: true });
|
|
7415
7415
|
const tmp = `${this.manifestPath}.tmp.${process.pid}.${Date.now()}`;
|
|
7416
|
-
fs
|
|
7416
|
+
fs.writeFileSync(tmp, JSON.stringify(manifest, null, 2), {
|
|
7417
7417
|
encoding: "utf-8",
|
|
7418
7418
|
mode: 384
|
|
7419
7419
|
});
|
|
7420
|
-
fs
|
|
7420
|
+
fs.renameSync(tmp, this.manifestPath);
|
|
7421
7421
|
this.cache = manifest;
|
|
7422
7422
|
}
|
|
7423
7423
|
/** Lookup a single addon's manifest entry, or `null` if not tracked. */
|
|
@@ -7492,22 +7492,22 @@ var AddonManifest = class {
|
|
|
7492
7492
|
* exactly what moved. Returns the total number of changes.
|
|
7493
7493
|
*/
|
|
7494
7494
|
reconcileFromDisk(addonsDir, onChange) {
|
|
7495
|
-
if (!fs
|
|
7495
|
+
if (!fs.existsSync(addonsDir)) return 0;
|
|
7496
7496
|
const m = this.read();
|
|
7497
7497
|
let changes = 0;
|
|
7498
7498
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7499
7499
|
/** Package name → version, for every ADDON package actually installed. */
|
|
7500
7500
|
const onDisk = /* @__PURE__ */ new Map();
|
|
7501
|
-
for (const scope of fs
|
|
7501
|
+
for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7502
7502
|
if (!scope.name.startsWith("@") || !isDirLike$1(path$1.join(addonsDir, scope.name))) continue;
|
|
7503
7503
|
const scopeDir = path$1.join(addonsDir, scope.name);
|
|
7504
|
-
for (const pkg of fs
|
|
7504
|
+
for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7505
7505
|
if (!isDirLike$1(path$1.join(scopeDir, pkg.name))) continue;
|
|
7506
7506
|
const pkgJsonPath = path$1.join(scopeDir, pkg.name, "package.json");
|
|
7507
|
-
if (!fs
|
|
7507
|
+
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
7508
7508
|
let pkgJson;
|
|
7509
7509
|
try {
|
|
7510
|
-
const parsed = JSON.parse(fs
|
|
7510
|
+
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
7511
7511
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
7512
7512
|
pkgJson = parsed;
|
|
7513
7513
|
} catch {
|
|
@@ -7578,28 +7578,28 @@ var AddonManifest = class {
|
|
|
7578
7578
|
migrateFromInstallSourceMarkers(addonsDir) {
|
|
7579
7579
|
const m = this.read();
|
|
7580
7580
|
if (Object.keys(m.addons).length > 0) return 0;
|
|
7581
|
-
if (!fs
|
|
7581
|
+
if (!fs.existsSync(addonsDir)) return 0;
|
|
7582
7582
|
let migrated = 0;
|
|
7583
7583
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7584
|
-
for (const scope of fs
|
|
7584
|
+
for (const scope of fs.readdirSync(addonsDir, { withFileTypes: true })) {
|
|
7585
7585
|
if (!scope.isDirectory() || !scope.name.startsWith("@")) continue;
|
|
7586
7586
|
const scopeDir = path$1.join(addonsDir, scope.name);
|
|
7587
|
-
for (const pkg of fs
|
|
7587
|
+
for (const pkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
|
|
7588
7588
|
if (!pkg.isDirectory()) continue;
|
|
7589
7589
|
const pkgDir = path$1.join(scopeDir, pkg.name);
|
|
7590
7590
|
const markerPath = path$1.join(pkgDir, ".install-source");
|
|
7591
7591
|
const pkgJsonPath = path$1.join(pkgDir, "package.json");
|
|
7592
|
-
if (!fs
|
|
7592
|
+
if (!fs.existsSync(pkgJsonPath)) continue;
|
|
7593
7593
|
let pkgJson;
|
|
7594
7594
|
try {
|
|
7595
|
-
const parsed = JSON.parse(fs
|
|
7595
|
+
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
7596
7596
|
if (typeof parsed !== "object" || parsed == null) continue;
|
|
7597
7597
|
pkgJson = parsed;
|
|
7598
7598
|
} catch {
|
|
7599
7599
|
continue;
|
|
7600
7600
|
}
|
|
7601
7601
|
if (!pkgJson.name || !pkgJson.version) continue;
|
|
7602
|
-
const source = fs
|
|
7602
|
+
const source = fs.existsSync(markerPath) ? fs.readFileSync(markerPath, "utf-8").trim() : "bundled";
|
|
7603
7603
|
m.addons[pkgJson.name] = {
|
|
7604
7604
|
name: pkgJson.name,
|
|
7605
7605
|
version: pkgJson.version,
|
|
@@ -7803,7 +7803,7 @@ function planClosureDedupe(input) {
|
|
|
7803
7803
|
function readTreeManifest(pkgJsonPath) {
|
|
7804
7804
|
let raw;
|
|
7805
7805
|
try {
|
|
7806
|
-
raw = asJsonObject$1(parseJsonUnknown(fs
|
|
7806
|
+
raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
|
|
7807
7807
|
} catch {
|
|
7808
7808
|
return null;
|
|
7809
7809
|
}
|
|
@@ -7828,7 +7828,7 @@ function readTreeManifest(pkgJsonPath) {
|
|
|
7828
7828
|
function listTopLevelEntries(nodeModulesDir) {
|
|
7829
7829
|
let entries;
|
|
7830
7830
|
try {
|
|
7831
|
-
entries = fs
|
|
7831
|
+
entries = fs.readdirSync(nodeModulesDir, { withFileTypes: true });
|
|
7832
7832
|
} catch {
|
|
7833
7833
|
return [];
|
|
7834
7834
|
}
|
|
@@ -7838,7 +7838,7 @@ function listTopLevelEntries(nodeModulesDir) {
|
|
|
7838
7838
|
if (entry.name.startsWith("@")) {
|
|
7839
7839
|
let inner;
|
|
7840
7840
|
try {
|
|
7841
|
-
inner = fs
|
|
7841
|
+
inner = fs.readdirSync(path$1.join(nodeModulesDir, entry.name), { withFileTypes: true });
|
|
7842
7842
|
} catch {
|
|
7843
7843
|
continue;
|
|
7844
7844
|
}
|
|
@@ -7871,14 +7871,14 @@ function collectAddonTreeState(addonDir) {
|
|
|
7871
7871
|
const entryDir = path$1.join(nodeModulesDir, name);
|
|
7872
7872
|
let isLink = false;
|
|
7873
7873
|
try {
|
|
7874
|
-
isLink = fs
|
|
7874
|
+
isLink = fs.lstatSync(entryDir).isSymbolicLink();
|
|
7875
7875
|
} catch {
|
|
7876
7876
|
continue;
|
|
7877
7877
|
}
|
|
7878
7878
|
if (isLink) {
|
|
7879
7879
|
let target = "";
|
|
7880
7880
|
try {
|
|
7881
|
-
target = fs
|
|
7881
|
+
target = fs.readlinkSync(entryDir);
|
|
7882
7882
|
} catch {}
|
|
7883
7883
|
existingLinks.push({
|
|
7884
7884
|
name,
|
|
@@ -7892,7 +7892,7 @@ function collectAddonTreeState(addonDir) {
|
|
|
7892
7892
|
version: manifest.version
|
|
7893
7893
|
});
|
|
7894
7894
|
for (const [depName, range] of manifest.ranges) {
|
|
7895
|
-
if (fs
|
|
7895
|
+
if (fs.existsSync(path$1.join(entryDir, "node_modules", depName))) continue;
|
|
7896
7896
|
addRange(depName, range);
|
|
7897
7897
|
}
|
|
7898
7898
|
}
|
|
@@ -7922,7 +7922,7 @@ function resolveClosureNodeModulesDir(explicitDir) {
|
|
|
7922
7922
|
const frameworkDir = explicitDir ?? process.env["CAMSTACK_FRAMEWORK_DIR"];
|
|
7923
7923
|
if (frameworkDir === void 0 || frameworkDir.length === 0) return null;
|
|
7924
7924
|
const nodeModulesDir = explicitDir ?? path$1.join(frameworkDir, "node_modules");
|
|
7925
|
-
return fs
|
|
7925
|
+
return fs.existsSync(nodeModulesDir) ? nodeModulesDir : null;
|
|
7926
7926
|
}
|
|
7927
7927
|
function symlinkType() {
|
|
7928
7928
|
return process.platform === "win32" ? "junction" : "dir";
|
|
@@ -7941,10 +7941,10 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
|
|
|
7941
7941
|
const nodeModulesDir = path$1.join(addonDir, "node_modules");
|
|
7942
7942
|
const probePath = path$1.join(nodeModulesDir, ".closure-link-probe");
|
|
7943
7943
|
try {
|
|
7944
|
-
fs
|
|
7945
|
-
fs
|
|
7946
|
-
fs
|
|
7947
|
-
fs
|
|
7944
|
+
fs.mkdirSync(nodeModulesDir, { recursive: true });
|
|
7945
|
+
fs.rmSync(probePath, { force: true });
|
|
7946
|
+
fs.symlinkSync(closureNodeModulesDir, probePath, symlinkType());
|
|
7947
|
+
fs.rmSync(probePath, { force: true });
|
|
7948
7948
|
} catch (err) {
|
|
7949
7949
|
logger.warn("closure dedupe skipped — symlinks unavailable on this volume", { meta: {
|
|
7950
7950
|
addonDir,
|
|
@@ -7966,12 +7966,12 @@ function executeClosureDedupe(addonDir, closureNodeModulesDir, plan, logger) {
|
|
|
7966
7966
|
}
|
|
7967
7967
|
const entryDir = path$1.join(nodeModulesDir, link.name);
|
|
7968
7968
|
try {
|
|
7969
|
-
fs
|
|
7969
|
+
fs.rmSync(entryDir, {
|
|
7970
7970
|
recursive: true,
|
|
7971
7971
|
force: true
|
|
7972
7972
|
});
|
|
7973
|
-
fs
|
|
7974
|
-
fs
|
|
7973
|
+
fs.mkdirSync(path$1.dirname(entryDir), { recursive: true });
|
|
7974
|
+
fs.symlinkSync(target, entryDir, symlinkType());
|
|
7975
7975
|
linked.push(link.name);
|
|
7976
7976
|
} catch (err) {
|
|
7977
7977
|
logger.warn("closure dedupe — link failed; entry removed copy may need reinstall", { meta: {
|
|
@@ -8047,7 +8047,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
|
|
|
8047
8047
|
count: Object.keys(native).length
|
|
8048
8048
|
} });
|
|
8049
8049
|
try {
|
|
8050
|
-
fs
|
|
8050
|
+
fs.writeFileSync(markerFile, markerHash);
|
|
8051
8051
|
} catch (err) {
|
|
8052
8052
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
8053
8053
|
markerFile,
|
|
@@ -8085,7 +8085,7 @@ async function installManifestNativeDeps(addonDir, pkgRaw, logger, registry, npm
|
|
|
8085
8085
|
}
|
|
8086
8086
|
await rebuildNativeDeps(addonDir, pending.map(([name]) => name), logger, npmCacheDir ?? defaultNpmCacheDir(), registry);
|
|
8087
8087
|
try {
|
|
8088
|
-
fs
|
|
8088
|
+
fs.writeFileSync(markerFile, markerHash);
|
|
8089
8089
|
} catch (err) {
|
|
8090
8090
|
logger.warn("Failed to write native deps marker", { meta: {
|
|
8091
8091
|
markerFile,
|
|
@@ -8107,12 +8107,12 @@ function copyPrebuiltNativeDep(name, addonDir, logger) {
|
|
|
8107
8107
|
if (source === target) continue;
|
|
8108
8108
|
if (!hasBuiltBinary(source)) continue;
|
|
8109
8109
|
try {
|
|
8110
|
-
fs
|
|
8110
|
+
fs.rmSync(target, {
|
|
8111
8111
|
recursive: true,
|
|
8112
8112
|
force: true
|
|
8113
8113
|
});
|
|
8114
|
-
fs
|
|
8115
|
-
fs
|
|
8114
|
+
fs.mkdirSync(path$1.dirname(target), { recursive: true });
|
|
8115
|
+
fs.cpSync(source, target, {
|
|
8116
8116
|
recursive: true,
|
|
8117
8117
|
dereference: true
|
|
8118
8118
|
});
|
|
@@ -8148,7 +8148,7 @@ var BUNDLED_NATIVE_SIBLING_SCOPES = {
|
|
|
8148
8148
|
function hasAnyDotNode(dir, maxDepth) {
|
|
8149
8149
|
let entries;
|
|
8150
8150
|
try {
|
|
8151
|
-
entries = fs
|
|
8151
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
8152
8152
|
} catch {
|
|
8153
8153
|
return false;
|
|
8154
8154
|
}
|
|
@@ -8162,12 +8162,12 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
|
|
|
8162
8162
|
if (!hasAnyDotNode(src, 5)) return;
|
|
8163
8163
|
if (hasAnyDotNode(dst, 5)) return;
|
|
8164
8164
|
try {
|
|
8165
|
-
fs
|
|
8165
|
+
fs.rmSync(dst, {
|
|
8166
8166
|
recursive: true,
|
|
8167
8167
|
force: true
|
|
8168
8168
|
});
|
|
8169
|
-
fs
|
|
8170
|
-
fs
|
|
8169
|
+
fs.mkdirSync(path$1.dirname(dst), { recursive: true });
|
|
8170
|
+
fs.cpSync(src, dst, {
|
|
8171
8171
|
recursive: true,
|
|
8172
8172
|
dereference: true
|
|
8173
8173
|
});
|
|
@@ -8202,7 +8202,7 @@ function copyPrebuiltModuleDir(src, dst, label, logger) {
|
|
|
8202
8202
|
*/
|
|
8203
8203
|
function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
8204
8204
|
const srcNm = path$1.join(sourceDir, "node_modules");
|
|
8205
|
-
if (!fs
|
|
8205
|
+
if (!fs.existsSync(srcNm)) return;
|
|
8206
8206
|
const dstNm = path$1.join(targetDir, "node_modules");
|
|
8207
8207
|
for (const [name, scopes] of Object.entries(BUNDLED_NATIVE_SIBLING_SCOPES)) {
|
|
8208
8208
|
copyPrebuiltModuleDir(path$1.join(srcNm, name), path$1.join(dstNm, name), name, logger);
|
|
@@ -8210,7 +8210,7 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
|
8210
8210
|
const scopeSrc = path$1.join(srcNm, scope);
|
|
8211
8211
|
let siblings;
|
|
8212
8212
|
try {
|
|
8213
|
-
siblings = fs
|
|
8213
|
+
siblings = fs.readdirSync(scopeSrc);
|
|
8214
8214
|
} catch {
|
|
8215
8215
|
continue;
|
|
8216
8216
|
}
|
|
@@ -8220,12 +8220,12 @@ function copyBundledNativeModules(sourceDir, targetDir, logger) {
|
|
|
8220
8220
|
}
|
|
8221
8221
|
/** A package dir is "built" when it carries a compiled `.node` or a prebuilds tree. */
|
|
8222
8222
|
function hasBuiltBinary(pkgDir) {
|
|
8223
|
-
if (!fs
|
|
8223
|
+
if (!fs.existsSync(path$1.join(pkgDir, "package.json"))) return false;
|
|
8224
8224
|
const releaseDir = path$1.join(pkgDir, "build", "Release");
|
|
8225
8225
|
try {
|
|
8226
|
-
if (fs
|
|
8226
|
+
if (fs.existsSync(releaseDir) && fs.readdirSync(releaseDir).some((f) => f.endsWith(".node"))) return true;
|
|
8227
8227
|
} catch {}
|
|
8228
|
-
return fs
|
|
8228
|
+
return fs.existsSync(path$1.join(pkgDir, "prebuilds"));
|
|
8229
8229
|
}
|
|
8230
8230
|
/** Candidate hoisted locations for `<name>`: NODE_PATH entries + ancestors of `addonDir`. */
|
|
8231
8231
|
function candidateHoistedDirs(name, addonDir) {
|
|
@@ -8263,7 +8263,7 @@ function hashDeclaration(deps) {
|
|
|
8263
8263
|
}
|
|
8264
8264
|
function markerMatches(markerFile, expected) {
|
|
8265
8265
|
try {
|
|
8266
|
-
return fs
|
|
8266
|
+
return fs.readFileSync(markerFile, "utf-8").trim() === expected;
|
|
8267
8267
|
} catch {
|
|
8268
8268
|
return false;
|
|
8269
8269
|
}
|
|
@@ -8370,7 +8370,7 @@ function parseInstallSource(value) {
|
|
|
8370
8370
|
function readPackageJson(pkgJsonPath) {
|
|
8371
8371
|
let raw;
|
|
8372
8372
|
try {
|
|
8373
|
-
raw = asJsonObject$1(parseJsonUnknown(fs
|
|
8373
|
+
raw = asJsonObject$1(parseJsonUnknown(fs.readFileSync(pkgJsonPath, "utf-8")));
|
|
8374
8374
|
} catch {
|
|
8375
8375
|
return null;
|
|
8376
8376
|
}
|
|
@@ -8412,7 +8412,7 @@ function shouldSkipClosureProvidedSeed(packageName, isResolvable) {
|
|
|
8412
8412
|
var REGISTRY_LATEST_TIMEOUT_MS = 15e3;
|
|
8413
8413
|
function readInstalledPackageVersion(addonDir) {
|
|
8414
8414
|
try {
|
|
8415
|
-
const raw = JSON.parse(fs
|
|
8415
|
+
const raw = JSON.parse(fs.readFileSync(path$1.join(addonDir, "package.json"), "utf-8"));
|
|
8416
8416
|
if (raw === null || typeof raw !== "object") return null;
|
|
8417
8417
|
const version = Reflect.get(raw, "version");
|
|
8418
8418
|
return typeof version === "string" && version.length > 0 ? version : null;
|
|
@@ -8553,7 +8553,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8553
8553
|
} catch {
|
|
8554
8554
|
return Object.freeze([]);
|
|
8555
8555
|
}
|
|
8556
|
-
const raw = fs
|
|
8556
|
+
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
8557
8557
|
const parsed = JSON.parse(raw);
|
|
8558
8558
|
const deps = Object.keys(parsed.dependencies ?? {});
|
|
8559
8559
|
const agentOnly = new Set(parsed.camstack?.agentOnlyBootstrapAddons ?? []);
|
|
@@ -8598,7 +8598,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8598
8598
|
} catch {
|
|
8599
8599
|
return Object.freeze([]);
|
|
8600
8600
|
}
|
|
8601
|
-
const raw = fs
|
|
8601
|
+
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
8602
8602
|
const addons = JSON.parse(raw).camstack?.agentBootstrapAddons ?? [];
|
|
8603
8603
|
return Object.freeze(["@camstack/server", ...addons]);
|
|
8604
8604
|
}
|
|
@@ -8628,7 +8628,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8628
8628
|
this.logger.info(`Install source: ${isLocal ? `bundle (${this.bundledAddonsDir})` : "npm"}, ${pkgList.length} package(s)`);
|
|
8629
8629
|
for (const packageName of pkgList) {
|
|
8630
8630
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
8631
|
-
if (fs
|
|
8631
|
+
if (fs.existsSync(path$1.join(addonDir, "package.json"))) {
|
|
8632
8632
|
if (isLocal || shouldSkipClosureProvidedSeed(packageName, this.isResolvableFromClosure(packageName))) {
|
|
8633
8633
|
this.logger.debug(`${packageName} — already installed, skipping`);
|
|
8634
8634
|
continue;
|
|
@@ -8772,7 +8772,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8772
8772
|
const installedPackages = this.listInstalled();
|
|
8773
8773
|
for (const pkg of installedPackages) {
|
|
8774
8774
|
try {
|
|
8775
|
-
if (fs
|
|
8775
|
+
if (fs.lstatSync(pkg.dir).isSymbolicLink()) continue;
|
|
8776
8776
|
} catch {
|
|
8777
8777
|
continue;
|
|
8778
8778
|
}
|
|
@@ -8812,7 +8812,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8812
8812
|
if (closureNodeModules !== null) for (const link of state.existingLinks) {
|
|
8813
8813
|
if (!isClosureLinkTarget(link.target, closureNodeModules)) continue;
|
|
8814
8814
|
const linkDir = path$1.join(nodeModulesDir, link.name);
|
|
8815
|
-
const targetManifest = fs
|
|
8815
|
+
const targetManifest = fs.existsSync(path$1.join(linkDir, "package.json"));
|
|
8816
8816
|
const ranges = state.requirements.get(link.name) ?? [];
|
|
8817
8817
|
let holds = targetManifest;
|
|
8818
8818
|
if (holds && ranges.length > 0) {
|
|
@@ -8821,14 +8821,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8821
8821
|
}
|
|
8822
8822
|
if (!holds) {
|
|
8823
8823
|
this.logger.warn(`${packageName} — closure link for ${link.name} no longer holds; reinstalling this addon's deps`, { meta: { target: link.target } });
|
|
8824
|
-
fs
|
|
8824
|
+
fs.rmSync(linkDir, { force: true });
|
|
8825
8825
|
needsInstall = true;
|
|
8826
8826
|
}
|
|
8827
8827
|
}
|
|
8828
8828
|
const linked = [];
|
|
8829
8829
|
for (const [depName, range] of declaredEntries) {
|
|
8830
8830
|
if (typeof range !== "string") continue;
|
|
8831
|
-
if (fs
|
|
8831
|
+
if (fs.existsSync(path$1.join(nodeModulesDir, depName, "package.json"))) continue;
|
|
8832
8832
|
const closureVersion = closureNodeModules === null ? void 0 : readClosureVersions(closureNodeModules, [depName]).get(depName);
|
|
8833
8833
|
if (closureNodeModules !== null && closureVersion !== void 0 && closureSatisfiesRange(range, closureVersion)) {
|
|
8834
8834
|
if (executeClosureDedupe(addonDir, closureNodeModules, {
|
|
@@ -8861,7 +8861,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8861
8861
|
const closureNodeModules = resolveClosureNodeModulesDir(this.closureNodeModulesDir);
|
|
8862
8862
|
if (closureNodeModules !== null) {
|
|
8863
8863
|
const state = collectAddonTreeState(addonDir);
|
|
8864
|
-
for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs
|
|
8864
|
+
for (const link of state.existingLinks) if (isClosureLinkTarget(link.target, closureNodeModules)) fs.rmSync(path$1.join(addonDir, "node_modules", link.name), { force: true });
|
|
8865
8865
|
}
|
|
8866
8866
|
this.logger.info(`${packageName} — reinstalling runtime dependencies`, { meta: { addonDir } });
|
|
8867
8867
|
await runNpm([
|
|
@@ -8906,7 +8906,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8906
8906
|
async realignFromClosure(packageName, closureDir) {
|
|
8907
8907
|
const targetDir = path$1.join(this.addonsDir, packageName);
|
|
8908
8908
|
const result = await this.installLocal(packageName, closureDir);
|
|
8909
|
-
await fs
|
|
8909
|
+
await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "closure");
|
|
8910
8910
|
this.manifest.upsert(result.name, {
|
|
8911
8911
|
version: result.version,
|
|
8912
8912
|
source: "closure"
|
|
@@ -8922,17 +8922,17 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8922
8922
|
async installCopy(packageName, sourceDir, pkgData, targetDir) {
|
|
8923
8923
|
await this.ensureBuilt(packageName, sourceDir, pkgData);
|
|
8924
8924
|
const distDir = path$1.join(sourceDir, "dist");
|
|
8925
|
-
if (!fs
|
|
8926
|
-
await fs
|
|
8925
|
+
if (!fs.existsSync(distDir)) throw new Error(`${packageName} has no dist/ after build`);
|
|
8926
|
+
await fs.promises.rm(targetDir, {
|
|
8927
8927
|
recursive: true,
|
|
8928
8928
|
force: true
|
|
8929
8929
|
});
|
|
8930
8930
|
ensureDir(targetDir);
|
|
8931
|
-
await fs
|
|
8931
|
+
await fs.promises.writeFile(path$1.join(targetDir, "package.json"), JSON.stringify(stripBundledDeps(pkgData), null, 2));
|
|
8932
8932
|
await copyDirRecursive(distDir, path$1.join(targetDir, "dist"));
|
|
8933
8933
|
await copyExtraFileDirs(pkgData, sourceDir, targetDir);
|
|
8934
8934
|
copyBundledNativeModules(sourceDir, targetDir, this.logger);
|
|
8935
|
-
await fs
|
|
8935
|
+
await fs.promises.writeFile(path$1.join(targetDir, ".install-source"), "local");
|
|
8936
8936
|
const localPkgVersion = asString$1(pkgData.version, "0.0.0");
|
|
8937
8937
|
this.manifest.upsert(packageName, {
|
|
8938
8938
|
version: localPkgVersion,
|
|
@@ -8973,7 +8973,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8973
8973
|
* unusual auth, offline mode, etc).
|
|
8974
8974
|
*/
|
|
8975
8975
|
async installFromNpm(packageName, version) {
|
|
8976
|
-
const tmpDir = fs
|
|
8976
|
+
const tmpDir = fs.mkdtempSync(path$1.join(os$1.tmpdir(), "camstack-addon-npm-"));
|
|
8977
8977
|
const packageSpec = version ? `${packageName}@${version}` : packageName;
|
|
8978
8978
|
this.logger.info(`${packageName} — installing from npm`);
|
|
8979
8979
|
try {
|
|
@@ -8987,19 +8987,19 @@ var AddonInstaller = class AddonInstaller {
|
|
|
8987
8987
|
];
|
|
8988
8988
|
if (this.registry) args.push("--registry", this.registry);
|
|
8989
8989
|
const { stdout } = await runNpm(args, this.npmRunOptions(tmpDir, 12e4));
|
|
8990
|
-
const tgzFiles = fs
|
|
8990
|
+
const tgzFiles = fs.readdirSync(tmpDir).filter((f) => f.endsWith(".tgz"));
|
|
8991
8991
|
if (tgzFiles.length === 0) throw new Error(`npm pack produced no tgz. stdout: ${stdout.trim()}`);
|
|
8992
8992
|
return path$1.join(tmpDir, tgzFiles[0]);
|
|
8993
8993
|
});
|
|
8994
8994
|
const result = await this.installFromTgz(tgzPath);
|
|
8995
|
-
fs
|
|
8995
|
+
fs.writeFileSync(path$1.join(this.addonsDir, result.name, ".install-source"), "npm");
|
|
8996
8996
|
this.manifest.upsert(result.name, {
|
|
8997
8997
|
version: result.version,
|
|
8998
8998
|
source: "npm"
|
|
8999
8999
|
});
|
|
9000
9000
|
return result;
|
|
9001
9001
|
} finally {
|
|
9002
|
-
fs
|
|
9002
|
+
fs.rmSync(tmpDir, {
|
|
9003
9003
|
recursive: true,
|
|
9004
9004
|
force: true
|
|
9005
9005
|
});
|
|
@@ -9037,7 +9037,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9037
9037
|
if (!tarRes.ok) throw new Error(`tarball GET ${tarballUrl} → ${tarRes.status}`);
|
|
9038
9038
|
const tgzPath = path$1.join(tmpDir, `${packageName.replace(/[/@]/g, "-").replace(/^-+/, "")}-${resolvedVersion}.tgz`);
|
|
9039
9039
|
const buf = Buffer.from(await tarRes.arrayBuffer());
|
|
9040
|
-
fs
|
|
9040
|
+
fs.writeFileSync(tgzPath, buf);
|
|
9041
9041
|
return tgzPath;
|
|
9042
9042
|
}
|
|
9043
9043
|
/**
|
|
@@ -9058,7 +9058,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9058
9058
|
* on the next deploy.
|
|
9059
9059
|
*/
|
|
9060
9060
|
async evictInstallDir(targetDir) {
|
|
9061
|
-
if (!fs
|
|
9061
|
+
if (!fs.existsSync(targetDir)) return;
|
|
9062
9062
|
const graveyard = path$1.join(this.addonsDir, ".evicting");
|
|
9063
9063
|
ensureDir(graveyard);
|
|
9064
9064
|
await this.sweepGraveyard(graveyard);
|
|
@@ -9066,10 +9066,10 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9066
9066
|
const flatName = path$1.relative(this.addonsDir, targetDir).replace(/[/\\]/g, "-");
|
|
9067
9067
|
const asideDir = path$1.join(graveyard, `${flatName}-${ts}`);
|
|
9068
9068
|
try {
|
|
9069
|
-
fs
|
|
9069
|
+
fs.renameSync(targetDir, asideDir);
|
|
9070
9070
|
} catch (renameErr) {
|
|
9071
9071
|
if (renameErr.code === "EXDEV") {
|
|
9072
|
-
await fs
|
|
9072
|
+
await fs.promises.rm(targetDir, {
|
|
9073
9073
|
recursive: true,
|
|
9074
9074
|
force: true
|
|
9075
9075
|
});
|
|
@@ -9077,7 +9077,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9077
9077
|
}
|
|
9078
9078
|
throw renameErr;
|
|
9079
9079
|
}
|
|
9080
|
-
await fs
|
|
9080
|
+
await fs.promises.rm(asideDir, {
|
|
9081
9081
|
recursive: true,
|
|
9082
9082
|
force: true
|
|
9083
9083
|
}).catch((cleanupErr) => {
|
|
@@ -9098,14 +9098,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9098
9098
|
async sweepStagingResidue(stagingRoot) {
|
|
9099
9099
|
let names;
|
|
9100
9100
|
try {
|
|
9101
|
-
names = fs
|
|
9101
|
+
names = fs.readdirSync(stagingRoot);
|
|
9102
9102
|
} catch {
|
|
9103
9103
|
return;
|
|
9104
9104
|
}
|
|
9105
9105
|
const now = Date.now();
|
|
9106
9106
|
const ages = [];
|
|
9107
9107
|
for (const name of names) try {
|
|
9108
|
-
const stat = fs
|
|
9108
|
+
const stat = fs.statSync(path$1.join(stagingRoot, name));
|
|
9109
9109
|
ages.push({
|
|
9110
9110
|
name,
|
|
9111
9111
|
ageMs: now - stat.mtimeMs
|
|
@@ -9116,7 +9116,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9116
9116
|
stagingRoot,
|
|
9117
9117
|
entries: sweepable
|
|
9118
9118
|
} });
|
|
9119
|
-
await Promise.all(sweepable.map((name) => fs
|
|
9119
|
+
await Promise.all(sweepable.map((name) => fs.promises.rm(path$1.join(stagingRoot, name), {
|
|
9120
9120
|
recursive: true,
|
|
9121
9121
|
force: true
|
|
9122
9122
|
}).catch(() => void 0)));
|
|
@@ -9125,11 +9125,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9125
9125
|
async sweepGraveyard(graveyard) {
|
|
9126
9126
|
let entries;
|
|
9127
9127
|
try {
|
|
9128
|
-
entries = fs
|
|
9128
|
+
entries = fs.readdirSync(graveyard);
|
|
9129
9129
|
} catch {
|
|
9130
9130
|
return;
|
|
9131
9131
|
}
|
|
9132
|
-
await Promise.all(entries.map((name) => fs
|
|
9132
|
+
await Promise.all(entries.map((name) => fs.promises.rm(path$1.join(graveyard, name), {
|
|
9133
9133
|
recursive: true,
|
|
9134
9134
|
force: true
|
|
9135
9135
|
}).catch(() => void 0)));
|
|
@@ -9180,7 +9180,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9180
9180
|
return;
|
|
9181
9181
|
}
|
|
9182
9182
|
const strippedManifest = stripBundledDeps(pkgView.raw);
|
|
9183
|
-
await fs
|
|
9183
|
+
await fs.promises.writeFile(pkgJsonPath, JSON.stringify(strippedManifest, null, 2));
|
|
9184
9184
|
const deps = asJsonObject$1(strippedManifest["dependencies"]);
|
|
9185
9185
|
const depNames = deps ? Object.keys(deps) : [];
|
|
9186
9186
|
if (depNames.length === 0) return;
|
|
@@ -9312,9 +9312,9 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9312
9312
|
"-C",
|
|
9313
9313
|
stagingDir
|
|
9314
9314
|
], { timeout: 12e4 });
|
|
9315
|
-
const pkgDir = fs
|
|
9315
|
+
const pkgDir = fs.existsSync(path$1.join(stagingDir, "package", "package.json")) ? path$1.join(stagingDir, "package") : stagingDir;
|
|
9316
9316
|
const pkgJsonPath = path$1.join(pkgDir, "package.json");
|
|
9317
|
-
if (!fs
|
|
9317
|
+
if (!fs.existsSync(pkgJsonPath)) throw new Error("No package.json found in tgz archive");
|
|
9318
9318
|
const pkgView = readPackageJson(pkgJsonPath);
|
|
9319
9319
|
if (!pkgView) throw new Error(`Invalid package.json at ${pkgJsonPath}`);
|
|
9320
9320
|
if (!pkgView.camstackAddons) throw new Error(`Package ${pkgView.name} has no camstack.addons manifest`);
|
|
@@ -9324,7 +9324,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9324
9324
|
this.dedupeTreeAgainstClosure(pkgDir, pkgView.name);
|
|
9325
9325
|
await this.evictInstallDir(targetDir);
|
|
9326
9326
|
ensureDir(path$1.dirname(targetDir));
|
|
9327
|
-
await fs
|
|
9327
|
+
await fs.promises.rename(pkgDir, targetDir);
|
|
9328
9328
|
this.manifest.upsert(pkgView.name, {
|
|
9329
9329
|
version: pkgView.version,
|
|
9330
9330
|
source: "bundled"
|
|
@@ -9335,7 +9335,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9335
9335
|
};
|
|
9336
9336
|
} finally {
|
|
9337
9337
|
this.inFlightStaging.delete(stagingName);
|
|
9338
|
-
await fs
|
|
9338
|
+
await fs.promises.rm(stagingDir, {
|
|
9339
9339
|
recursive: true,
|
|
9340
9340
|
force: true
|
|
9341
9341
|
}).catch(() => void 0);
|
|
@@ -9365,24 +9365,24 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9365
9365
|
const current = this.manifest.get(packageName);
|
|
9366
9366
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
9367
9367
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9368
|
-
if (!fs
|
|
9368
|
+
if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9369
9369
|
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
9370
9370
|
const backupRoot = path$1.join(this.addonsDir, ".backups", packageName);
|
|
9371
9371
|
ensureDir(backupRoot);
|
|
9372
9372
|
const backupDir = path$1.join(backupRoot, ts);
|
|
9373
9373
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
9374
|
-
fs
|
|
9374
|
+
fs.renameSync(addonDir, backupDir);
|
|
9375
9375
|
let result;
|
|
9376
9376
|
try {
|
|
9377
9377
|
result = await this.installFromNpm(packageName, version);
|
|
9378
9378
|
} catch (installErr) {
|
|
9379
9379
|
this.logger.error(`${packageName} — install failed, restoring backup`, { meta: { error: errMsg$1(installErr) } });
|
|
9380
9380
|
try {
|
|
9381
|
-
if (fs
|
|
9381
|
+
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9382
9382
|
recursive: true,
|
|
9383
9383
|
force: true
|
|
9384
9384
|
});
|
|
9385
|
-
fs
|
|
9385
|
+
fs.renameSync(backupDir, addonDir);
|
|
9386
9386
|
this.manifest.upsert(packageName, {
|
|
9387
9387
|
version: current.version,
|
|
9388
9388
|
source: current.source,
|
|
@@ -9443,7 +9443,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9443
9443
|
const current = this.manifest.get(packageName);
|
|
9444
9444
|
if (current == null) throw new Error(`Cannot update ${packageName}: not currently tracked in manifest`);
|
|
9445
9445
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9446
|
-
if (!fs
|
|
9446
|
+
if (!fs.existsSync(addonDir)) throw new Error(`Cannot update ${packageName}: install dir ${addonDir} missing`);
|
|
9447
9447
|
await this.installRuntimeDependencies(stagedPath, packageName);
|
|
9448
9448
|
await this.installNativeDependencies(stagedPath, packageName);
|
|
9449
9449
|
this.dedupeTreeAgainstClosure(stagedPath, packageName);
|
|
@@ -9452,14 +9452,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9452
9452
|
ensureDir(backupRoot);
|
|
9453
9453
|
const backupDir = path$1.join(backupRoot, ts);
|
|
9454
9454
|
this.logger.info(`${packageName} — backing up v${current.version} → ${backupDir}`);
|
|
9455
|
-
fs
|
|
9455
|
+
fs.renameSync(addonDir, backupDir);
|
|
9456
9456
|
try {
|
|
9457
9457
|
try {
|
|
9458
|
-
fs
|
|
9458
|
+
fs.renameSync(stagedPath, addonDir);
|
|
9459
9459
|
} catch (renameErr) {
|
|
9460
9460
|
if (renameErr.code === "EXDEV") {
|
|
9461
|
-
fs
|
|
9462
|
-
fs
|
|
9461
|
+
fs.cpSync(stagedPath, addonDir, { recursive: true });
|
|
9462
|
+
fs.rmSync(stagedPath, {
|
|
9463
9463
|
recursive: true,
|
|
9464
9464
|
force: true
|
|
9465
9465
|
});
|
|
@@ -9468,11 +9468,11 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9468
9468
|
} catch (swapErr) {
|
|
9469
9469
|
this.logger.error(`${packageName} — staged swap failed, restoring backup`, { meta: { error: errMsg$1(swapErr) } });
|
|
9470
9470
|
try {
|
|
9471
|
-
if (fs
|
|
9471
|
+
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9472
9472
|
recursive: true,
|
|
9473
9473
|
force: true
|
|
9474
9474
|
});
|
|
9475
|
-
fs
|
|
9475
|
+
fs.renameSync(backupDir, addonDir);
|
|
9476
9476
|
this.manifest.upsert(packageName, {
|
|
9477
9477
|
version: current.version,
|
|
9478
9478
|
source: current.source,
|
|
@@ -9511,20 +9511,20 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9511
9511
|
this.logger.warn(`${packageName} — no backup to rollback to`);
|
|
9512
9512
|
return null;
|
|
9513
9513
|
}
|
|
9514
|
-
if (!fs
|
|
9514
|
+
if (!fs.existsSync(entry.lastBackupDir)) {
|
|
9515
9515
|
this.logger.warn(`${packageName} — backup dir vanished: ${entry.lastBackupDir}`);
|
|
9516
9516
|
return null;
|
|
9517
9517
|
}
|
|
9518
9518
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9519
|
-
if (fs
|
|
9519
|
+
if (fs.existsSync(addonDir)) fs.rmSync(addonDir, {
|
|
9520
9520
|
recursive: true,
|
|
9521
9521
|
force: true
|
|
9522
9522
|
});
|
|
9523
|
-
fs
|
|
9523
|
+
fs.renameSync(entry.lastBackupDir, addonDir);
|
|
9524
9524
|
const pkgJsonPath = path$1.join(addonDir, "package.json");
|
|
9525
9525
|
let restoredVersion = entry.version;
|
|
9526
|
-
if (fs
|
|
9527
|
-
const parsed = JSON.parse(fs
|
|
9526
|
+
if (fs.existsSync(pkgJsonPath)) try {
|
|
9527
|
+
const parsed = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
|
|
9528
9528
|
if (typeof parsed === "object" && parsed != null) {
|
|
9529
9529
|
const v = parsed.version;
|
|
9530
9530
|
if (typeof v === "string" && v.length > 0) restoredVersion = v;
|
|
@@ -9572,7 +9572,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9572
9572
|
return false;
|
|
9573
9573
|
}
|
|
9574
9574
|
try {
|
|
9575
|
-
await fs
|
|
9575
|
+
await fs.promises.rm(target, {
|
|
9576
9576
|
recursive: true,
|
|
9577
9577
|
force: true
|
|
9578
9578
|
});
|
|
@@ -9590,7 +9590,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9590
9590
|
listBackupsFor(packageName) {
|
|
9591
9591
|
const dir = path$1.join(this.backupsRoot, packageName);
|
|
9592
9592
|
try {
|
|
9593
|
-
return fs
|
|
9593
|
+
return fs.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path$1.join(dir, e.name)).sort();
|
|
9594
9594
|
} catch {
|
|
9595
9595
|
return [];
|
|
9596
9596
|
}
|
|
@@ -9622,7 +9622,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9622
9622
|
for (const dir of [pkgDir, path$1.dirname(pkgDir)]) {
|
|
9623
9623
|
if (!this.isInsideBackups(dir)) continue;
|
|
9624
9624
|
try {
|
|
9625
|
-
await fs
|
|
9625
|
+
await fs.promises.rmdir(dir);
|
|
9626
9626
|
} catch {
|
|
9627
9627
|
return;
|
|
9628
9628
|
}
|
|
@@ -9704,7 +9704,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9704
9704
|
*/
|
|
9705
9705
|
resolveBackupToKeep(packageName, backups) {
|
|
9706
9706
|
const liveDir = path$1.join(this.addonsDir, packageName);
|
|
9707
|
-
if (!fs
|
|
9707
|
+
if (!fs.existsSync(liveDir)) {
|
|
9708
9708
|
const newest = backups[backups.length - 1] ?? null;
|
|
9709
9709
|
if (newest != null) this.logger.warn(`${packageName} — live install dir missing; retaining its newest backup as the only surviving copy`, { meta: {
|
|
9710
9710
|
liveDir,
|
|
@@ -9721,7 +9721,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9721
9721
|
listBackedUpPackages() {
|
|
9722
9722
|
let entries;
|
|
9723
9723
|
try {
|
|
9724
|
-
entries = fs
|
|
9724
|
+
entries = fs.readdirSync(this.backupsRoot, { withFileTypes: true });
|
|
9725
9725
|
} catch {
|
|
9726
9726
|
return [];
|
|
9727
9727
|
}
|
|
@@ -9733,14 +9733,14 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9733
9733
|
continue;
|
|
9734
9734
|
}
|
|
9735
9735
|
const scopeDir = path$1.join(this.backupsRoot, entry.name);
|
|
9736
|
-
for (const inner of fs
|
|
9736
|
+
for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (inner.isDirectory()) names.push(`${entry.name}/${inner.name}`);
|
|
9737
9737
|
}
|
|
9738
9738
|
return names;
|
|
9739
9739
|
}
|
|
9740
9740
|
async uninstall(packageName) {
|
|
9741
9741
|
const addonDir = path$1.join(this.addonsDir, packageName);
|
|
9742
|
-
if (fs
|
|
9743
|
-
fs
|
|
9742
|
+
if (fs.existsSync(addonDir)) {
|
|
9743
|
+
fs.rmSync(addonDir, {
|
|
9744
9744
|
recursive: true,
|
|
9745
9745
|
force: true
|
|
9746
9746
|
});
|
|
@@ -9748,8 +9748,8 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9748
9748
|
return;
|
|
9749
9749
|
}
|
|
9750
9750
|
const legacyDir = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""));
|
|
9751
|
-
if (fs
|
|
9752
|
-
fs
|
|
9751
|
+
if (fs.existsSync(legacyDir)) {
|
|
9752
|
+
fs.rmSync(legacyDir, {
|
|
9753
9753
|
recursive: true,
|
|
9754
9754
|
force: true
|
|
9755
9755
|
});
|
|
@@ -9757,22 +9757,22 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9757
9757
|
}
|
|
9758
9758
|
}
|
|
9759
9759
|
listInstalled() {
|
|
9760
|
-
if (!fs
|
|
9760
|
+
if (!fs.existsSync(this.addonsDir)) return [];
|
|
9761
9761
|
const packageDirs = [];
|
|
9762
|
-
for (const entry of fs
|
|
9762
|
+
for (const entry of fs.readdirSync(this.addonsDir, { withFileTypes: true })) {
|
|
9763
9763
|
if (!isDirEntry(entry, this.addonsDir)) continue;
|
|
9764
9764
|
if (entry.name.startsWith("@")) {
|
|
9765
9765
|
const scopeDir = path$1.join(this.addonsDir, entry.name);
|
|
9766
|
-
for (const inner of fs
|
|
9766
|
+
for (const inner of fs.readdirSync(scopeDir, { withFileTypes: true })) if (isDirEntry(inner, scopeDir)) packageDirs.push(path$1.join(scopeDir, inner.name));
|
|
9767
9767
|
} else packageDirs.push(path$1.join(this.addonsDir, entry.name));
|
|
9768
9768
|
}
|
|
9769
9769
|
return packageDirs.map((dir) => {
|
|
9770
9770
|
const pkgPath = path$1.join(dir, "package.json");
|
|
9771
|
-
if (!fs
|
|
9771
|
+
if (!fs.existsSync(pkgPath)) return null;
|
|
9772
9772
|
const pkg = readPackageJson(pkgPath);
|
|
9773
9773
|
if (!pkg || !pkg.camstackAddons) return null;
|
|
9774
9774
|
const sourceFile = path$1.join(dir, ".install-source");
|
|
9775
|
-
const installSource = fs
|
|
9775
|
+
const installSource = fs.existsSync(sourceFile) ? parseInstallSource(fs.readFileSync(sourceFile, "utf-8").trim()) : void 0;
|
|
9776
9776
|
return {
|
|
9777
9777
|
name: pkg.name,
|
|
9778
9778
|
version: pkg.version,
|
|
@@ -9782,13 +9782,13 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9782
9782
|
}).filter((item) => item !== null);
|
|
9783
9783
|
}
|
|
9784
9784
|
isInstalled(packageName) {
|
|
9785
|
-
if (fs
|
|
9786
|
-
return fs
|
|
9785
|
+
if (fs.existsSync(path$1.join(this.addonsDir, packageName, "package.json"))) return true;
|
|
9786
|
+
return fs.existsSync(path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json"));
|
|
9787
9787
|
}
|
|
9788
9788
|
getInstalledPackage(packageName) {
|
|
9789
9789
|
let pkgPath = path$1.join(this.addonsDir, packageName, "package.json");
|
|
9790
|
-
if (!fs
|
|
9791
|
-
if (!fs
|
|
9790
|
+
if (!fs.existsSync(pkgPath)) pkgPath = path$1.join(this.addonsDir, packageName.replace(/^@[^/]+\//, ""), "package.json");
|
|
9791
|
+
if (!fs.existsSync(pkgPath)) return null;
|
|
9792
9792
|
const pkg = readPackageJson(pkgPath);
|
|
9793
9793
|
if (!pkg) return null;
|
|
9794
9794
|
return {
|
|
@@ -9807,7 +9807,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9807
9807
|
]) {
|
|
9808
9808
|
const candidate = path$1.join(this.bundledAddonsDir, dirName);
|
|
9809
9809
|
try {
|
|
9810
|
-
const pkg = asJsonObject$1(parseJsonUnknown(fs
|
|
9810
|
+
const pkg = asJsonObject$1(parseJsonUnknown(fs.readFileSync(path$1.join(candidate, "package.json"), "utf-8")));
|
|
9811
9811
|
if (pkg && asString$1(pkg["name"]) === packageName) return candidate;
|
|
9812
9812
|
} catch {}
|
|
9813
9813
|
}
|
|
@@ -9816,7 +9816,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9816
9816
|
/** Ensure a package is built (dist/ exists and page bundles present) */
|
|
9817
9817
|
async ensureBuilt(packageName, sourceDir, pkgData) {
|
|
9818
9818
|
const distDir = path$1.join(sourceDir, "dist");
|
|
9819
|
-
if (!(!fs
|
|
9819
|
+
if (!(!fs.existsSync(distDir) || this.isDistIncomplete(pkgData, sourceDir))) return;
|
|
9820
9820
|
this.logger.info(`${packageName} — building (dist/ missing or incomplete)`);
|
|
9821
9821
|
try {
|
|
9822
9822
|
await runNpm(["run", "build"], this.npmRunOptions(sourceDir, 18e4));
|
|
@@ -9831,7 +9831,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9831
9831
|
if (!camstack?.addons) return false;
|
|
9832
9832
|
for (const addon of camstack.addons) {
|
|
9833
9833
|
if (!addon.pages) continue;
|
|
9834
|
-
for (const page of addon.pages) if (page.bundle && !fs
|
|
9834
|
+
for (const page of addon.pages) if (page.bundle && !fs.existsSync(path$1.join(sourceDir, "dist", page.bundle))) return true;
|
|
9835
9835
|
}
|
|
9836
9836
|
return false;
|
|
9837
9837
|
}
|
|
@@ -9840,7 +9840,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
9840
9840
|
function isDirEntry(entry, parentDir) {
|
|
9841
9841
|
if (entry.isDirectory()) return true;
|
|
9842
9842
|
if (entry.isSymbolicLink()) try {
|
|
9843
|
-
return fs
|
|
9843
|
+
return fs.statSync(path$1.join(parentDir, entry.name)).isDirectory();
|
|
9844
9844
|
} catch {
|
|
9845
9845
|
return false;
|
|
9846
9846
|
}
|
|
@@ -9939,7 +9939,7 @@ function selectAddonResidue(candidates) {
|
|
|
9939
9939
|
}
|
|
9940
9940
|
function readDeclaredName(dir) {
|
|
9941
9941
|
try {
|
|
9942
|
-
const parsed = JSON.parse(fs
|
|
9942
|
+
const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9943
9943
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
9944
9944
|
const name = parsed.name;
|
|
9945
9945
|
return typeof name === "string" ? name : null;
|
|
@@ -9949,7 +9949,7 @@ function readDeclaredName(dir) {
|
|
|
9949
9949
|
}
|
|
9950
9950
|
function readDeclaredVersion(dir) {
|
|
9951
9951
|
try {
|
|
9952
|
-
const parsed = JSON.parse(fs
|
|
9952
|
+
const parsed = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
9953
9953
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
9954
9954
|
const version = parsed.version;
|
|
9955
9955
|
return typeof version === "string" ? version : null;
|
|
@@ -9959,7 +9959,7 @@ function readDeclaredVersion(dir) {
|
|
|
9959
9959
|
}
|
|
9960
9960
|
function isDirLike(p) {
|
|
9961
9961
|
try {
|
|
9962
|
-
return fs
|
|
9962
|
+
return fs.statSync(p).isDirectory();
|
|
9963
9963
|
} catch {
|
|
9964
9964
|
return false;
|
|
9965
9965
|
}
|
|
@@ -9969,7 +9969,7 @@ function freeQuarantineTarget(store, scope, dirName) {
|
|
|
9969
9969
|
const base = scope === null ? dirName : `${scope.replace("@", "")}__${dirName}`;
|
|
9970
9970
|
let candidate = path$1.join(store, base);
|
|
9971
9971
|
let n = 1;
|
|
9972
|
-
while (fs
|
|
9972
|
+
while (fs.existsSync(candidate)) {
|
|
9973
9973
|
candidate = path$1.join(store, `${base}-${n}`);
|
|
9974
9974
|
n += 1;
|
|
9975
9975
|
}
|
|
@@ -9986,7 +9986,7 @@ function freeQuarantineTarget(store, scope, dirName) {
|
|
|
9986
9986
|
function quarantineAddonResidue(addonsDir, log) {
|
|
9987
9987
|
const quarantined = [];
|
|
9988
9988
|
const failed = [];
|
|
9989
|
-
if (!fs
|
|
9989
|
+
if (!fs.existsSync(addonsDir)) return {
|
|
9990
9990
|
quarantined,
|
|
9991
9991
|
failed
|
|
9992
9992
|
};
|
|
@@ -9994,7 +9994,7 @@ function quarantineAddonResidue(addonsDir, log) {
|
|
|
9994
9994
|
const scan = (parent, scope) => {
|
|
9995
9995
|
let names;
|
|
9996
9996
|
try {
|
|
9997
|
-
names = fs
|
|
9997
|
+
names = fs.readdirSync(parent);
|
|
9998
9998
|
} catch {
|
|
9999
9999
|
return;
|
|
10000
10000
|
}
|
|
@@ -10013,8 +10013,8 @@ function quarantineAddonResidue(addonsDir, log) {
|
|
|
10013
10013
|
const version = readDeclaredVersion(full);
|
|
10014
10014
|
const to = freeQuarantineTarget(store, scope, dirName);
|
|
10015
10015
|
try {
|
|
10016
|
-
fs
|
|
10017
|
-
fs
|
|
10016
|
+
fs.mkdirSync(store, { recursive: true });
|
|
10017
|
+
fs.renameSync(full, to);
|
|
10018
10018
|
} catch (err) {
|
|
10019
10019
|
const error = err instanceof Error ? err.message : String(err);
|
|
10020
10020
|
failed.push({
|
|
@@ -10072,11 +10072,11 @@ function getRestartMarkerPath(dataDir) {
|
|
|
10072
10072
|
* intact or no marker at all (never a half-written file).
|
|
10073
10073
|
*/
|
|
10074
10074
|
function writePendingRestart(dataDir, marker) {
|
|
10075
|
-
fs
|
|
10075
|
+
fs.mkdirSync(dataDir, { recursive: true });
|
|
10076
10076
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
10077
10077
|
const tmpPath = `${markerPath}.tmp`;
|
|
10078
|
-
fs
|
|
10079
|
-
fs
|
|
10078
|
+
fs.writeFileSync(tmpPath, JSON.stringify(marker, null, 2), "utf-8");
|
|
10079
|
+
fs.renameSync(tmpPath, markerPath);
|
|
10080
10080
|
}
|
|
10081
10081
|
/**
|
|
10082
10082
|
* Read + consume the marker. Returns the parsed payload on success and
|
|
@@ -10101,10 +10101,10 @@ function writePendingRestart(dataDir, marker) {
|
|
|
10101
10101
|
*/
|
|
10102
10102
|
function readPendingRestart(dataDir) {
|
|
10103
10103
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
10104
|
-
if (!fs
|
|
10104
|
+
if (!fs.existsSync(markerPath)) return null;
|
|
10105
10105
|
let raw;
|
|
10106
10106
|
try {
|
|
10107
|
-
raw = fs
|
|
10107
|
+
raw = fs.readFileSync(markerPath, "utf-8");
|
|
10108
10108
|
} catch (err) {
|
|
10109
10109
|
console.error("[restart-coordinator] Marker unreadable — leaving in place:", err);
|
|
10110
10110
|
return null;
|
|
@@ -10143,7 +10143,7 @@ function readPendingRestart(dataDir) {
|
|
|
10143
10143
|
/** Remove the marker if present. No-op if missing. */
|
|
10144
10144
|
function clearPendingRestart(dataDir) {
|
|
10145
10145
|
const markerPath = getRestartMarkerPath(dataDir);
|
|
10146
|
-
fs
|
|
10146
|
+
fs.rmSync(markerPath, { force: true });
|
|
10147
10147
|
}
|
|
10148
10148
|
function isRestartKind(value) {
|
|
10149
10149
|
return value === "framework-update" || value === "manual" || value === "system";
|
|
@@ -10155,7 +10155,7 @@ function scheduleSelfRestart(options = {}) {
|
|
|
10155
10155
|
const touchTarget = process.env["CAMSTACK_RESTART_TOUCH_FILE"];
|
|
10156
10156
|
if (touchTarget !== void 0 && touchTarget.length > 0) try {
|
|
10157
10157
|
const now = /* @__PURE__ */ new Date();
|
|
10158
|
-
fs
|
|
10158
|
+
fs.utimesSync(touchTarget, now, now);
|
|
10159
10159
|
return;
|
|
10160
10160
|
} catch (err) {
|
|
10161
10161
|
console.error("[restart-coordinator] dev touch-reload failed; falling through to process exit:", err);
|
|
@@ -14519,11 +14519,11 @@ function applyEnvOverrides(raw) {
|
|
|
14519
14519
|
return result;
|
|
14520
14520
|
}
|
|
14521
14521
|
function loadYaml(configPath) {
|
|
14522
|
-
if (!fs
|
|
14522
|
+
if (!fs.existsSync(configPath)) {
|
|
14523
14523
|
console.warn(`[ConfigManager] Config file not found at: ${configPath}\n → Using built-in defaults. Set CONFIG_PATH env var or create the file.\n → Example path from project root: ./server/backend/data/config.yaml`);
|
|
14524
14524
|
return {};
|
|
14525
14525
|
}
|
|
14526
|
-
const parsed = load(fs
|
|
14526
|
+
const parsed = load(fs.readFileSync(configPath, "utf-8")) ?? {};
|
|
14527
14527
|
console.log(`[ConfigManager] Loaded config from: ${configPath}`);
|
|
14528
14528
|
return parsed;
|
|
14529
14529
|
}
|
|
@@ -22619,7 +22619,7 @@ async function probeVaapiInit(renderNode) {
|
|
|
22619
22619
|
*/
|
|
22620
22620
|
function safeExistsSync(path) {
|
|
22621
22621
|
try {
|
|
22622
|
-
return fs
|
|
22622
|
+
return fs.existsSync(path);
|
|
22623
22623
|
} catch {
|
|
22624
22624
|
return false;
|
|
22625
22625
|
}
|
|
@@ -22638,11 +22638,11 @@ function probeLinuxGpus() {
|
|
|
22638
22638
|
if (safeExistsSync("/dev/nvidia0") || safeExistsSync("/proc/driver/nvidia/version")) signals.hasNvidiaGpu = true;
|
|
22639
22639
|
try {
|
|
22640
22640
|
const drmDir = "/sys/class/drm";
|
|
22641
|
-
if (fs
|
|
22641
|
+
if (fs.existsSync(drmDir)) for (const entry of fs.readdirSync(drmDir)) {
|
|
22642
22642
|
if (!entry.startsWith("card")) continue;
|
|
22643
22643
|
const vendorPath = `${drmDir}/${entry}/device/vendor`;
|
|
22644
22644
|
if (!safeExistsSync(vendorPath)) continue;
|
|
22645
|
-
const vendor = fs
|
|
22645
|
+
const vendor = fs.readFileSync(vendorPath, "utf8").trim().toLowerCase();
|
|
22646
22646
|
if (vendor === "0x10de") signals.hasNvidiaGpu = true;
|
|
22647
22647
|
else if (vendor === "0x1002") signals.hasAmdGpu = true;
|
|
22648
22648
|
else if (vendor === "0x8086") signals.hasIntelGpu = true;
|
|
@@ -22860,21 +22860,21 @@ function sleep$1(ms) {
|
|
|
22860
22860
|
* crashed holder) is stolen.
|
|
22861
22861
|
*/
|
|
22862
22862
|
async function withFileLock(lockPath, fn) {
|
|
22863
|
-
fs
|
|
22863
|
+
fs.mkdirSync(join(lockPath, ".."), { recursive: true });
|
|
22864
22864
|
for (;;) try {
|
|
22865
|
-
const fd = fs
|
|
22866
|
-
fs
|
|
22865
|
+
const fd = fs.openSync(lockPath, "wx");
|
|
22866
|
+
fs.closeSync(fd);
|
|
22867
22867
|
break;
|
|
22868
22868
|
} catch {
|
|
22869
22869
|
try {
|
|
22870
|
-
if (Date.now() - fs
|
|
22870
|
+
if (Date.now() - fs.statSync(lockPath).mtimeMs > LOCK_STALE_MS) fs.rmSync(lockPath, { force: true });
|
|
22871
22871
|
else await sleep$1(LOCK_POLL_MS);
|
|
22872
22872
|
} catch {}
|
|
22873
22873
|
}
|
|
22874
22874
|
try {
|
|
22875
22875
|
return await fn();
|
|
22876
22876
|
} finally {
|
|
22877
|
-
fs
|
|
22877
|
+
fs.rmSync(lockPath, { force: true });
|
|
22878
22878
|
}
|
|
22879
22879
|
}
|
|
22880
22880
|
/** Coalesce in-process + serialize cross-process for one binary id. */
|
|
@@ -22932,7 +22932,7 @@ var AddonDepsManager = class {
|
|
|
22932
22932
|
* failed or tampered download throws, and provisioning reports it.
|
|
22933
22933
|
*/
|
|
22934
22934
|
async stageNativeDepsDeclaredBy(requirementsFile) {
|
|
22935
|
-
if (!declaresEdgetpuDelegate(fs
|
|
22935
|
+
if (!declaresEdgetpuDelegate(fs.readFileSync(requirementsFile, "utf8"))) return;
|
|
22936
22936
|
await singleFlight(this.depsDir, "edgetpu-delegate", () => ensureEdgetpuDelegate(this.nodeRoot, this.logger));
|
|
22937
22937
|
}
|
|
22938
22938
|
getDepsDir() {
|
|
@@ -23963,7 +23963,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
|
|
|
23963
23963
|
const addonId = declaration.id;
|
|
23964
23964
|
const nodeDataDir = process.env["CAMSTACK_DATA"] ?? dataDir;
|
|
23965
23965
|
const addonDataDir = path$1.resolve(nodeDataDir, "addons-data", addonId);
|
|
23966
|
-
fs
|
|
23966
|
+
fs.mkdirSync(addonDataDir, { recursive: true });
|
|
23967
23967
|
if (runtime.mode === "broker") ensureBindingSubscription(runtime.broker);
|
|
23968
23968
|
const regs = getRegistries(nodeId);
|
|
23969
23969
|
const workerResolver = {
|
|
@@ -25765,7 +25765,7 @@ var FailedRunnerRetryLedger = class {
|
|
|
25765
25765
|
function readRunnerPackageVersions(addonDirs) {
|
|
25766
25766
|
const out = {};
|
|
25767
25767
|
for (const dir of addonDirs) try {
|
|
25768
|
-
const raw = JSON.parse(fs
|
|
25768
|
+
const raw = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
25769
25769
|
const version = typeof raw === "object" && raw !== null ? Reflect.get(raw, "version") : null;
|
|
25770
25770
|
out[dir] = typeof version === "string" && version.length > 0 ? version : null;
|
|
25771
25771
|
} catch {
|
|
@@ -25826,7 +25826,7 @@ function readAddonHeapDeclaration(spec) {
|
|
|
25826
25826
|
if (cached !== void 0) return cached;
|
|
25827
25827
|
let declaration = EMPTY_HEAP_DECLARATION;
|
|
25828
25828
|
for (const manifestPath of [path$1.join(spec.addonDir, "package.json"), path$1.join(path$1.dirname(spec.addonDir), "package.json")]) try {
|
|
25829
|
-
const raw = fs
|
|
25829
|
+
const raw = fs.readFileSync(manifestPath, "utf8");
|
|
25830
25830
|
const parsed = JSON.parse(raw);
|
|
25831
25831
|
const profile = extractHeapProfile(parsed, spec.addonId);
|
|
25832
25832
|
const maxOldSpaceMb = extractMaxOldSpaceMb(parsed, spec.addonId);
|
|
@@ -27048,17 +27048,17 @@ var JobJournal = class {
|
|
|
27048
27048
|
return path$1.join(this.jobsDir, `${id}.json`);
|
|
27049
27049
|
}
|
|
27050
27050
|
writeAtomic(filePath, data) {
|
|
27051
|
-
fs
|
|
27051
|
+
fs.mkdirSync(path$1.dirname(filePath), { recursive: true });
|
|
27052
27052
|
const tmp = `${filePath}.tmp.${process.pid}.${Date.now()}`;
|
|
27053
|
-
fs
|
|
27053
|
+
fs.writeFileSync(tmp, JSON.stringify(data, null, 2), {
|
|
27054
27054
|
encoding: "utf-8",
|
|
27055
27055
|
mode: 384
|
|
27056
27056
|
});
|
|
27057
|
-
fs
|
|
27057
|
+
fs.renameSync(tmp, filePath);
|
|
27058
27058
|
}
|
|
27059
27059
|
readIndex() {
|
|
27060
27060
|
try {
|
|
27061
|
-
const raw = JSON.parse(fs
|
|
27061
|
+
const raw = JSON.parse(fs.readFileSync(this.indexPath, "utf-8"));
|
|
27062
27062
|
if (raw && Array.isArray(raw.jobIds)) return {
|
|
27063
27063
|
version: 1,
|
|
27064
27064
|
jobIds: raw.jobIds
|
|
@@ -27083,7 +27083,7 @@ var JobJournal = class {
|
|
|
27083
27083
|
}
|
|
27084
27084
|
getJob(id) {
|
|
27085
27085
|
try {
|
|
27086
|
-
const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs
|
|
27086
|
+
const parsed = lifecycleJobSchema.safeParse(JSON.parse(fs.readFileSync(this.jobPath(id), "utf-8")));
|
|
27087
27087
|
return parsed.success ? parsed.data : null;
|
|
27088
27088
|
} catch {
|
|
27089
27089
|
return null;
|
|
@@ -27148,14 +27148,14 @@ var StagingArea = class {
|
|
|
27148
27148
|
}
|
|
27149
27149
|
async fetchAndStage(input) {
|
|
27150
27150
|
const destDir = path$1.join(this.stagingDir, input.jobId, safeSegment(input.name));
|
|
27151
|
-
fs
|
|
27151
|
+
fs.rmSync(destDir, {
|
|
27152
27152
|
recursive: true,
|
|
27153
27153
|
force: true
|
|
27154
27154
|
});
|
|
27155
27155
|
const tgz = await this.deps.fetchTarball(input.name, input.version, input.signal);
|
|
27156
27156
|
if (input.signal.aborted) throw new Error("staging aborted after fetch");
|
|
27157
27157
|
await this.deps.extract(tgz, destDir);
|
|
27158
|
-
const raw = JSON.parse(fs
|
|
27158
|
+
const raw = JSON.parse(fs.readFileSync(path$1.join(destDir, "package.json"), "utf-8"));
|
|
27159
27159
|
if (typeof raw.version !== "string" || raw.version.length === 0) throw new Error(`staging validation failed: ${input.name} staged a package.json with no version`);
|
|
27160
27160
|
if (EXACT_SEMVER.test(input.version) && raw.version !== input.version) throw new Error(`staging validation failed: ${input.name} expected version ${input.version}, got ${raw.version}`);
|
|
27161
27161
|
return {
|
|
@@ -27164,7 +27164,7 @@ var StagingArea = class {
|
|
|
27164
27164
|
};
|
|
27165
27165
|
}
|
|
27166
27166
|
cleanup(jobId) {
|
|
27167
|
-
fs
|
|
27167
|
+
fs.rmSync(path$1.join(this.stagingDir, jobId), {
|
|
27168
27168
|
recursive: true,
|
|
27169
27169
|
force: true
|
|
27170
27170
|
});
|
|
@@ -27179,13 +27179,13 @@ var StagingArea = class {
|
|
|
27179
27179
|
sweepOrphans() {
|
|
27180
27180
|
let entries;
|
|
27181
27181
|
try {
|
|
27182
|
-
entries = fs
|
|
27182
|
+
entries = fs.readdirSync(this.stagingDir);
|
|
27183
27183
|
} catch {
|
|
27184
27184
|
return 0;
|
|
27185
27185
|
}
|
|
27186
27186
|
let removed = 0;
|
|
27187
27187
|
for (const name of entries) try {
|
|
27188
|
-
fs
|
|
27188
|
+
fs.rmSync(path$1.join(this.stagingDir, name), {
|
|
27189
27189
|
recursive: true,
|
|
27190
27190
|
force: true
|
|
27191
27191
|
});
|
|
@@ -27363,7 +27363,7 @@ var LifecycleJobEngine = class {
|
|
|
27363
27363
|
* on failure → `failed`.
|
|
27364
27364
|
*/
|
|
27365
27365
|
async reconcileJob(job) {
|
|
27366
|
-
const exists = this.deps.stagedPathExists ?? ((p) => fs
|
|
27366
|
+
const exists = this.deps.stagedPathExists ?? ((p) => fs.existsSync(p));
|
|
27367
27367
|
for (const task of job.tasks) {
|
|
27368
27368
|
if (task.target === "framework") {
|
|
27369
27369
|
if (!this.isTerminal(task.phase)) this.skipFrameworkTask(job, task);
|
|
@@ -28004,7 +28004,7 @@ var CatalogRegistry = class {
|
|
|
28004
28004
|
const file = path$1.join(packageDir, "i18n", `${lang}.json`);
|
|
28005
28005
|
let text;
|
|
28006
28006
|
try {
|
|
28007
|
-
text = fs
|
|
28007
|
+
text = fs.readFileSync(file, "utf8");
|
|
28008
28008
|
} catch {
|
|
28009
28009
|
continue;
|
|
28010
28010
|
}
|