@pkcprotocol/pkc-js 0.0.128 → 0.0.130

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.
Files changed (102) hide show
  1. package/README.md +16 -5
  2. package/dist/browser/clients/rpc-client/pkc-rpc-client.d.ts +2 -2
  3. package/dist/browser/clients/rpc-client/pkc-rpc-client.js +8 -3
  4. package/dist/browser/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  5. package/dist/browser/clients/rpc-client/schema.d.ts +10 -1
  6. package/dist/browser/clients/rpc-client/schema.js +8 -1
  7. package/dist/browser/clients/rpc-client/schema.js.map +1 -1
  8. package/dist/browser/clients/rpc-client/types.d.ts +5 -1
  9. package/dist/browser/community/communities-entry-util.d.ts +14 -0
  10. package/dist/browser/community/communities-entry-util.js +20 -0
  11. package/dist/browser/community/communities-entry-util.js.map +1 -0
  12. package/dist/browser/errors.d.ts +1 -0
  13. package/dist/browser/errors.js +1 -0
  14. package/dist/browser/errors.js.map +1 -1
  15. package/dist/browser/generated-version.d.ts +1 -1
  16. package/dist/browser/generated-version.js +1 -1
  17. package/dist/browser/pkc/pkc-with-rpc-client.d.ts +2 -0
  18. package/dist/browser/pkc/pkc-with-rpc-client.js +66 -3
  19. package/dist/browser/pkc/pkc-with-rpc-client.js.map +1 -1
  20. package/dist/browser/pkc/pkc.d.ts +5 -3
  21. package/dist/browser/pkc/pkc.js +15 -10
  22. package/dist/browser/pkc/pkc.js.map +1 -1
  23. package/dist/browser/pkc-error.d.ts +1 -1
  24. package/dist/browser/rpc/src/index.js +10 -8
  25. package/dist/browser/rpc/src/index.js.map +1 -1
  26. package/dist/browser/runtime/browser/util.d.ts +1 -0
  27. package/dist/browser/runtime/browser/util.js +3 -0
  28. package/dist/browser/runtime/browser/util.js.map +1 -1
  29. package/dist/browser/runtime/node/community/db-handler.js +2 -4
  30. package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
  31. package/dist/browser/runtime/node/community/local-community/editing.js +13 -6
  32. package/dist/browser/runtime/node/community/local-community/editing.js.map +1 -1
  33. package/dist/browser/runtime/node/community/local-community.js +9 -1
  34. package/dist/browser/runtime/node/community/local-community.js.map +1 -1
  35. package/dist/browser/runtime/node/community/start-lock.d.ts +8 -0
  36. package/dist/browser/runtime/node/community/start-lock.js +18 -0
  37. package/dist/browser/runtime/node/community/start-lock.js.map +1 -0
  38. package/dist/browser/runtime/node/util.d.ts +6 -0
  39. package/dist/browser/runtime/node/util.js +106 -8
  40. package/dist/browser/runtime/node/util.js.map +1 -1
  41. package/dist/browser/test/test-util.d.ts +20 -0
  42. package/dist/browser/test/test-util.js +25 -0
  43. package/dist/browser/test/test-util.js.map +1 -1
  44. package/dist/browser/types.d.ts +7 -3
  45. package/dist/bundled/bundle-manifest.json +53 -51
  46. package/dist/bundled/challenges.js +1 -1
  47. package/dist/bundled/chunks/{helia-for-pkc-6kkeZX1a.js → helia-for-pkc-CVGt82_T.js} +31 -31
  48. package/dist/bundled/chunks/{local-community-BST1U_f3.js → local-community-fdVlmCGN.js} +1 -1
  49. package/dist/bundled/chunks/{local-community-B79BAYRo.js → local-community-wNpPFFZe.js} +18 -1381
  50. package/dist/bundled/chunks/{node-BEH8NA_I.js → node-Z0wgsXeR.js} +76 -16
  51. package/dist/bundled/chunks/{page-sort-scoring-2FkqYYNf.js → page-sort-scoring-DerjGUL1.js} +1 -1
  52. package/dist/bundled/chunks/{rpc-local-community-SmLDPm1j.js → rpc-local-community-CJbuAfCd.js} +1571 -48
  53. package/dist/bundled/chunks/{util-LwSS90AE.js → util-B_sAleCo.js} +20 -19
  54. package/dist/bundled/chunks/{util-jyIDYw_Q.js → util-kemFUDC0.js} +1 -1
  55. package/dist/bundled/chunks/{validate-package-factories-_KKnb8At.js → validate-package-factories-DLuTOpn4.js} +2 -2
  56. package/dist/bundled/index.js +1 -1
  57. package/dist/bundled/page-sorts.js +1 -1
  58. package/dist/bundled/rpc/src/index.js +10 -9
  59. package/dist/node/clients/rpc-client/pkc-rpc-client.d.ts +2 -2
  60. package/dist/node/clients/rpc-client/pkc-rpc-client.js +8 -3
  61. package/dist/node/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  62. package/dist/node/clients/rpc-client/schema.d.ts +10 -1
  63. package/dist/node/clients/rpc-client/schema.js +8 -1
  64. package/dist/node/clients/rpc-client/schema.js.map +1 -1
  65. package/dist/node/clients/rpc-client/types.d.ts +5 -1
  66. package/dist/node/community/communities-entry-util.d.ts +14 -0
  67. package/dist/node/community/communities-entry-util.js +20 -0
  68. package/dist/node/community/communities-entry-util.js.map +1 -0
  69. package/dist/node/errors.d.ts +1 -0
  70. package/dist/node/errors.js +1 -0
  71. package/dist/node/errors.js.map +1 -1
  72. package/dist/node/generated-version.d.ts +1 -1
  73. package/dist/node/generated-version.js +1 -1
  74. package/dist/node/pkc/pkc-with-rpc-client.d.ts +2 -0
  75. package/dist/node/pkc/pkc-with-rpc-client.js +66 -3
  76. package/dist/node/pkc/pkc-with-rpc-client.js.map +1 -1
  77. package/dist/node/pkc/pkc.d.ts +5 -3
  78. package/dist/node/pkc/pkc.js +15 -10
  79. package/dist/node/pkc/pkc.js.map +1 -1
  80. package/dist/node/pkc-error.d.ts +1 -1
  81. package/dist/node/rpc/src/index.js +10 -8
  82. package/dist/node/rpc/src/index.js.map +1 -1
  83. package/dist/node/runtime/browser/util.d.ts +1 -0
  84. package/dist/node/runtime/browser/util.js +3 -0
  85. package/dist/node/runtime/browser/util.js.map +1 -1
  86. package/dist/node/runtime/node/community/db-handler.js +2 -4
  87. package/dist/node/runtime/node/community/db-handler.js.map +1 -1
  88. package/dist/node/runtime/node/community/local-community/editing.js +13 -6
  89. package/dist/node/runtime/node/community/local-community/editing.js.map +1 -1
  90. package/dist/node/runtime/node/community/local-community.js +9 -1
  91. package/dist/node/runtime/node/community/local-community.js.map +1 -1
  92. package/dist/node/runtime/node/community/start-lock.d.ts +8 -0
  93. package/dist/node/runtime/node/community/start-lock.js +18 -0
  94. package/dist/node/runtime/node/community/start-lock.js.map +1 -0
  95. package/dist/node/runtime/node/util.d.ts +6 -0
  96. package/dist/node/runtime/node/util.js +106 -8
  97. package/dist/node/runtime/node/util.js.map +1 -1
  98. package/dist/node/test/test-util.d.ts +20 -0
  99. package/dist/node/test/test-util.js +25 -0
  100. package/dist/node/test/test-util.js.map +1 -1
  101. package/dist/node/types.d.ts +7 -3
  102. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as retryKuboIpfsAddAndProvide, $n as CommentEditReservedFields, An as VoteTablesRowSchema, At as ChallengeAnswerMessageSchema, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Ct as trackUpdatingCommunity, Dn as VotePubsubMessagePublicationSchema, Dt as require_sha256, Et as untrackUpdatingCommunity, F as isLinkOfVideo, G as removeMfsFilesSafely, I as isLinkValid, It as ChallengeVerificationMessageSchema, Jt as version_default, Lr as PKCError, M as isLinkOfAudio, Mt as ChallengeMessageSchema, N as isLinkOfImage, Nn as CommentIpfsSchema, On as VotePubsubReservedFields, Or as t$4, P as isLinkOfMedia, Pn as CommentPubsubMessageReservedFields, Pt as ChallengeRequestMessageSchema, Qn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Rr as messages, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tr as t$3, Un as CommentUpdateTableRowSchema, Vn as CommentUpdateSchema, W as removeBlocksFromKuboNode, Wn as CommentsTableRowSchema, Xt as CommunityEditPublicationPubsubReservedFields, Z as retryKuboBlockPutPinAndProvidePubsubTopic, Zn as CommentEditPubsubMessagePublicationSchema, _ as genToArray, _r as t$7, at as timestamp, b as getIpnsRecordInLocalKuboNode, br as t$6, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeysDeep, dt as findStartedCommunity, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as n$3, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, j as isLinkOfAnimatedImage, jr as require_retry, kr as t$2, kt as pTimeout, l as contentContainsMarkdownVideos, lt as writeKuboFilesWithTimeout, mn as CommunitySignedPropertyNames, nn as CommentModerationReservedFields, nt as sleepUntilTimeoutOrAbort, o as calculateUnixFsDagSizeCidV0, or as AuthorReservedFields, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, q as removeNullUndefinedValues, r as calculateIpfsCidV0, rt as statMfsPathSafely, s as contentContainsMarkdownAudio, st as withSortedKeys, t as areEquivalentCommunityAddresses, ti as ZodError, tn as CommentModerationPubsubMessagePublicationSchema, tr as CommentEditsTableRowSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$2, wn as isStringDomain, wr as r$1, wt as untrackStartedCommunity, xr as e$1, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$5, z as pubsubTopicToDhtKey, zr as logger_default, zt as DecryptedChallengeRequestPublicationSchema } from "./util-LwSS90AE.js";
3
- import { $ as createSchemaRowParser, Ar as t$10, Cn as signCommentUpdate, Dr as resolveDbPostsCidRefs, Dt as parseJsonWithPKCErrorIfFails, Er as refreshCommunitiesList, Fn as verifyCommentModeration, Fr as n$4, Gn as getAuthorNameFromWire, Hn as buildRuntimeAuthor, In as verifyCommentPubsubMessage, Ln as verifyCommentUpdate, Lr as t$9, Mr as r$2, N as MAX_PAGE_SIZE_BYTES, Nn as verifyCommentEdit, Nr as t$8, Pn as verifyCommentIpfs, Pr as n$5, Q as collectSchemaRowCoercions, Rn as verifyCommunity, Rr as stringify, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sr as importSignerIntoKuboNode, Tn as signCommunity, Tr as moveCommunityDbToDeletedDirectory, Un as cleanWireAuthor, Ur as STORAGE_KEYS, Vn as verifyVote, W as pLimit, Wr as require_lodash_merge, X as coerceSchemaRowBoolean, Xn as crosspostChainDepthUpTo, Z as coerceSchemaRowJson, Zn as effectiveMaxCrosspostDepth, _ as createAuthorIdentityMatcher, _n as signChallengeMessage, _r as deriveDbPosts, a as generatePagesReportingFailedSorts, b as KeyvBetterSqlite3, bn as signComment, c as resolvePageSortsOrThrow, cr as getPKCAddressFromPublicKeySync, d as getChallengeVerification, dn as decryptEd25519AesGcmPublicKeyBuffer, dr as backupCommunityDb, dt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, er as getCommunityNameFromWire, f as getCommunityChallengeFromCommunityChallengeSettings, fr as calculateExpectedSignatureSize, g as authorNameResolveFailureReason, gr as deriveCommentIpfsFromCommentTableRow, h as authorIdentityMatcherForRequest, hn as cleanUpBeforePublishing, hr as deleteOldCommunityInWindows, i as derivePublicPageSorts, ir as encode, j as iterateOverPageCidsToFindAllCids, jn as verifyChallengeRequest, jr as t$11, kn as verifyChallengeAnswer, lr as getPublicKeyFromPrivateKey, m as pkcJsChallenges, mn as _validateSignatureOfPKCRecord, o as loadPageSortsForStartedCommunity, or as getIpfsKeyFromPrivateKey, p as loadChallengeFileFromCommunityChallengeSettings, pn as encryptEd25519AesGcmPublicKeyBuffer, pr as calculateInlineRepliesBudget, pt as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, r as computePageSortsFingerprint, rr as decode, s as lookupPageSortFactories, sn as SignerWithPublicKeyAddress, sr as getPKCAddressFromPublicKey, t as RpcLocalCommunity, tr as getCommunityPublicKeyFromWire, u as deriveCommunityChallengesOrThrow, ur as BackupAbortError, v as TrackedInstanceRegistry, vr as deriveDbReplies, w as TIMEFRAMES_TO_SECONDS, wn as signCommentUpdateForChallengeVerification, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, xn as signCommentEdit, xr as getThumbnailPropsOfLink, y as LRUCache, yn as signChallengeVerification, yr as getDefaultCommunityDbConfig, zn as verifyCommunityEdit } from "./rpc-local-community-SmLDPm1j.js";
4
- import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-2FkqYYNf.js";
1
+ import { i as __toESM } from "./chunk-2rV9d50f.js";
2
+ import { $ as retryKuboIpfsAddAndProvide, $n as CommentEditsTableRowSchema, At as ChallengeAnswerMessageSchema, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Ct as trackUpdatingCommunity, Dt as require_sha256, En as VotePubsubReservedFields, Et as untrackUpdatingCommunity, F as isLinkOfVideo, G as removeMfsFilesSafely, Hn as CommentsTableRowSchema, I as isLinkValid, It as ChallengeVerificationMessageSchema, Jt as version_default, Lr as PKCError, M as isLinkOfAudio, Mn as CommentPubsubMessageReservedFields, Mt as ChallengeMessageSchema, N as isLinkOfImage, On as VoteTablesRowSchema, Or as t$4, P as isLinkOfMedia, Pt as ChallengeRequestMessageSchema, Rr as messages, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$3, Vn as CommentUpdateTableRowSchema, W as removeBlocksFromKuboNode, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xt as CommunityEditPublicationPubsubReservedFields, Yn as CommentEditPubsubMessagePublicationSchema, Z as retryKuboBlockPutPinAndProvidePubsubTopic, Zn as CommentEditReservedFields, _ as genToArray, _r as t$7, at as timestamp, b as getIpnsRecordInLocalKuboNode, br as t$6, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeysDeep, dt as findStartedCommunity, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as n$3, hr as isStringDomain, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, j as isLinkOfAnimatedImage, jn as CommentIpfsSchema, jr as require_retry, kr as t$2, kt as pTimeout, l as contentContainsMarkdownVideos, lt as writeKuboFilesWithTimeout, mn as CommunitySignedPropertyNames, nn as CommentModerationReservedFields, nt as sleepUntilTimeoutOrAbort, o as calculateUnixFsDagSizeCidV0, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, q as removeNullUndefinedValues, r as calculateIpfsCidV0, rt as statMfsPathSafely, s as contentContainsMarkdownAudio, st as withSortedKeys, ti as ZodError, tn as CommentModerationPubsubMessagePublicationSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$2, wr as r$1, wt as untrackStartedCommunity, xr as e$1, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$5, z as pubsubTopicToDhtKey, zn as CommentUpdateSchema, zr as logger_default, zt as DecryptedChallengeRequestPublicationSchema } from "./util-B_sAleCo.js";
3
+ import { $ as createSchemaRowParser, An as verifyChallengeAnswer, Bn as verifyCommunityEdit, Br as t$8, Cr as getThumbnailPropsOfLink, Dr as moveCommunityDbToDeletedDirectory, Dt as parseJsonWithPKCErrorIfFails, En as signCommunity, Fn as verifyCommentIpfs, Fr as isCommunityStartLocked, Gr as stringify, Hn as verifyVote, Hr as n$4, In as verifyCommentModeration, Ir as require_src, Kn as getAuthorNameFromWire, Ln as verifyCommentPubsubMessage, Lr as t$10, Mn as verifyChallengeRequest, Mr as findCommunitiesEntry, N as MAX_PAGE_SIZE_BYTES, Or as refreshCommunitiesList, Pn as verifyCommentEdit, Q as collectSchemaRowCoercions, Qn as effectiveMaxCrosspostDepth, Rn as verifyCommentUpdate, Rr as t$11, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sn as signCommentEdit, Tn as signCommentUpdateForChallengeVerification, Un as buildRuntimeAuthor, Vr as n$5, W as pLimit, Wn as cleanWireAuthor, Wr as t$9, X as coerceSchemaRowBoolean, Xr as STORAGE_KEYS, Z as coerceSchemaRowJson, Zn as crosspostChainDepthUpTo, Zr as require_lodash_merge, _ as createAuthorIdentityMatcher, _r as deriveCommentIpfsFromCommentTableRow, a as generatePagesReportingFailedSorts, ar as encode, b as KeyvBetterSqlite3, bn as signChallengeVerification, c as resolvePageSortsOrThrow, cn as SignerWithPublicKeyAddress, cr as getPKCAddressFromPublicKey, d as getChallengeVerification, dr as BackupAbortError, dt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, f as getCommunityChallengeFromCommunityChallengeSettings, fn as decryptEd25519AesGcmPublicKeyBuffer, fr as backupCommunityDb, g as authorNameResolveFailureReason, gn as cleanUpBeforePublishing, gr as deleteOldCommunityInWindows, h as authorIdentityMatcherForRequest, hn as _validateSignatureOfPKCRecord, i as derivePublicPageSorts, ir as decode, j as iterateOverPageCidsToFindAllCids, kr as resolveDbPostsCidRefs, lr as getPKCAddressFromPublicKeySync, m as pkcJsChallenges, mn as encryptEd25519AesGcmPublicKeyBuffer, mr as calculateInlineRepliesBudget, nr as getCommunityPublicKeyFromWire, o as loadPageSortsForStartedCommunity, p as loadChallengeFileFromCommunityChallengeSettings, pr as calculateExpectedSignatureSize, pt as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, r as computePageSortsFingerprint, s as lookupPageSortFactories, sr as getIpfsKeyFromPrivateKey, t as RpcLocalCommunity, tr as getCommunityNameFromWire, u as deriveCommunityChallengesOrThrow, ur as getPublicKeyFromPrivateKey, v as TrackedInstanceRegistry, vn as signChallengeMessage, vr as deriveDbPosts, w as TIMEFRAMES_TO_SECONDS, wn as signCommentUpdate, wr as importSignerIntoKuboNode, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, xn as signComment, xr as getDefaultCommunityDbConfig, y as LRUCache, yr as deriveDbReplies, zn as verifyCommunity, zr as r$2 } from "./rpc-local-community-CJbuAfCd.js";
4
+ import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-DerjGUL1.js";
5
5
  import { randomFillSync, randomUUID } from "node:crypto";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
7
  import path from "node:path";
@@ -184,1374 +184,6 @@ async function reprovideAnchorRecordIfDue(community) {
184
184
  await reprovideAnchorRecordIfNeeded(community);
185
185
  }
186
186
  //#endregion
187
- //#region node_modules/graceful-fs/polyfills.js
188
- var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
189
- var constants = __require("constants");
190
- var origCwd = process.cwd;
191
- var cwd = null;
192
- var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
193
- process.cwd = function() {
194
- if (!cwd) cwd = origCwd.call(process);
195
- return cwd;
196
- };
197
- try {
198
- process.cwd();
199
- } catch (er) {}
200
- if (typeof process.chdir === "function") {
201
- var chdir = process.chdir;
202
- process.chdir = function(d) {
203
- cwd = null;
204
- chdir.call(process, d);
205
- };
206
- if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
207
- }
208
- module.exports = patch;
209
- function patch(fs) {
210
- if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs);
211
- if (!fs.lutimes) patchLutimes(fs);
212
- fs.chown = chownFix(fs.chown);
213
- fs.fchown = chownFix(fs.fchown);
214
- fs.lchown = chownFix(fs.lchown);
215
- fs.chmod = chmodFix(fs.chmod);
216
- fs.fchmod = chmodFix(fs.fchmod);
217
- fs.lchmod = chmodFix(fs.lchmod);
218
- fs.chownSync = chownFixSync(fs.chownSync);
219
- fs.fchownSync = chownFixSync(fs.fchownSync);
220
- fs.lchownSync = chownFixSync(fs.lchownSync);
221
- fs.chmodSync = chmodFixSync(fs.chmodSync);
222
- fs.fchmodSync = chmodFixSync(fs.fchmodSync);
223
- fs.lchmodSync = chmodFixSync(fs.lchmodSync);
224
- fs.stat = statFix(fs.stat);
225
- fs.fstat = statFix(fs.fstat);
226
- fs.lstat = statFix(fs.lstat);
227
- fs.statSync = statFixSync(fs.statSync);
228
- fs.fstatSync = statFixSync(fs.fstatSync);
229
- fs.lstatSync = statFixSync(fs.lstatSync);
230
- if (fs.chmod && !fs.lchmod) {
231
- fs.lchmod = function(path, mode, cb) {
232
- if (cb) process.nextTick(cb);
233
- };
234
- fs.lchmodSync = function() {};
235
- }
236
- if (fs.chown && !fs.lchown) {
237
- fs.lchown = function(path, uid, gid, cb) {
238
- if (cb) process.nextTick(cb);
239
- };
240
- fs.lchownSync = function() {};
241
- }
242
- if (platform === "win32") fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) {
243
- function rename(from, to, cb) {
244
- var start = Date.now();
245
- var backoff = 0;
246
- fs$rename(from, to, function CB(er) {
247
- if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
248
- setTimeout(function() {
249
- fs.stat(to, function(stater, st) {
250
- if (stater && stater.code === "ENOENT") fs$rename(from, to, CB);
251
- else cb(er);
252
- });
253
- }, backoff);
254
- if (backoff < 100) backoff += 10;
255
- return;
256
- }
257
- if (cb) cb(er);
258
- });
259
- }
260
- if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
261
- return rename;
262
- })(fs.rename);
263
- fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
264
- function read(fd, buffer, offset, length, position, callback_) {
265
- var callback;
266
- if (callback_ && typeof callback_ === "function") {
267
- var eagCounter = 0;
268
- callback = function(er, _, __) {
269
- if (er && er.code === "EAGAIN" && eagCounter < 10) {
270
- eagCounter++;
271
- return fs$read.call(fs, fd, buffer, offset, length, position, callback);
272
- }
273
- callback_.apply(this, arguments);
274
- };
275
- }
276
- return fs$read.call(fs, fd, buffer, offset, length, position, callback);
277
- }
278
- if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
279
- return read;
280
- })(fs.read);
281
- fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : (function(fs$readSync) {
282
- return function(fd, buffer, offset, length, position) {
283
- var eagCounter = 0;
284
- while (true) try {
285
- return fs$readSync.call(fs, fd, buffer, offset, length, position);
286
- } catch (er) {
287
- if (er.code === "EAGAIN" && eagCounter < 10) {
288
- eagCounter++;
289
- continue;
290
- }
291
- throw er;
292
- }
293
- };
294
- })(fs.readSync);
295
- function patchLchmod(fs) {
296
- fs.lchmod = function(path, mode, callback) {
297
- fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
298
- if (err) {
299
- if (callback) callback(err);
300
- return;
301
- }
302
- fs.fchmod(fd, mode, function(err) {
303
- fs.close(fd, function(err2) {
304
- if (callback) callback(err || err2);
305
- });
306
- });
307
- });
308
- };
309
- fs.lchmodSync = function(path, mode) {
310
- var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
311
- var threw = true;
312
- var ret;
313
- try {
314
- ret = fs.fchmodSync(fd, mode);
315
- threw = false;
316
- } finally {
317
- if (threw) try {
318
- fs.closeSync(fd);
319
- } catch (er) {}
320
- else fs.closeSync(fd);
321
- }
322
- return ret;
323
- };
324
- }
325
- function patchLutimes(fs) {
326
- if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
327
- fs.lutimes = function(path, at, mt, cb) {
328
- fs.open(path, constants.O_SYMLINK, function(er, fd) {
329
- if (er) {
330
- if (cb) cb(er);
331
- return;
332
- }
333
- fs.futimes(fd, at, mt, function(er) {
334
- fs.close(fd, function(er2) {
335
- if (cb) cb(er || er2);
336
- });
337
- });
338
- });
339
- };
340
- fs.lutimesSync = function(path, at, mt) {
341
- var fd = fs.openSync(path, constants.O_SYMLINK);
342
- var ret;
343
- var threw = true;
344
- try {
345
- ret = fs.futimesSync(fd, at, mt);
346
- threw = false;
347
- } finally {
348
- if (threw) try {
349
- fs.closeSync(fd);
350
- } catch (er) {}
351
- else fs.closeSync(fd);
352
- }
353
- return ret;
354
- };
355
- } else if (fs.futimes) {
356
- fs.lutimes = function(_a, _b, _c, cb) {
357
- if (cb) process.nextTick(cb);
358
- };
359
- fs.lutimesSync = function() {};
360
- }
361
- }
362
- function chmodFix(orig) {
363
- if (!orig) return orig;
364
- return function(target, mode, cb) {
365
- return orig.call(fs, target, mode, function(er) {
366
- if (chownErOk(er)) er = null;
367
- if (cb) cb.apply(this, arguments);
368
- });
369
- };
370
- }
371
- function chmodFixSync(orig) {
372
- if (!orig) return orig;
373
- return function(target, mode) {
374
- try {
375
- return orig.call(fs, target, mode);
376
- } catch (er) {
377
- if (!chownErOk(er)) throw er;
378
- }
379
- };
380
- }
381
- function chownFix(orig) {
382
- if (!orig) return orig;
383
- return function(target, uid, gid, cb) {
384
- return orig.call(fs, target, uid, gid, function(er) {
385
- if (chownErOk(er)) er = null;
386
- if (cb) cb.apply(this, arguments);
387
- });
388
- };
389
- }
390
- function chownFixSync(orig) {
391
- if (!orig) return orig;
392
- return function(target, uid, gid) {
393
- try {
394
- return orig.call(fs, target, uid, gid);
395
- } catch (er) {
396
- if (!chownErOk(er)) throw er;
397
- }
398
- };
399
- }
400
- function statFix(orig) {
401
- if (!orig) return orig;
402
- return function(target, options, cb) {
403
- if (typeof options === "function") {
404
- cb = options;
405
- options = null;
406
- }
407
- function callback(er, stats) {
408
- if (stats) {
409
- if (stats.uid < 0) stats.uid += 4294967296;
410
- if (stats.gid < 0) stats.gid += 4294967296;
411
- }
412
- if (cb) cb.apply(this, arguments);
413
- }
414
- return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
415
- };
416
- }
417
- function statFixSync(orig) {
418
- if (!orig) return orig;
419
- return function(target, options) {
420
- var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
421
- if (stats) {
422
- if (stats.uid < 0) stats.uid += 4294967296;
423
- if (stats.gid < 0) stats.gid += 4294967296;
424
- }
425
- return stats;
426
- };
427
- }
428
- function chownErOk(er) {
429
- if (!er) return true;
430
- if (er.code === "ENOSYS") return true;
431
- if (!process.getuid || process.getuid() !== 0) {
432
- if (er.code === "EINVAL" || er.code === "EPERM") return true;
433
- }
434
- return false;
435
- }
436
- }
437
- }));
438
- //#endregion
439
- //#region node_modules/graceful-fs/legacy-streams.js
440
- var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) => {
441
- var Stream = __require("stream").Stream;
442
- module.exports = legacy;
443
- function legacy(fs) {
444
- return {
445
- ReadStream,
446
- WriteStream
447
- };
448
- function ReadStream(path, options) {
449
- if (!(this instanceof ReadStream)) return new ReadStream(path, options);
450
- Stream.call(this);
451
- var self = this;
452
- this.path = path;
453
- this.fd = null;
454
- this.readable = true;
455
- this.paused = false;
456
- this.flags = "r";
457
- this.mode = 438;
458
- this.bufferSize = 64 * 1024;
459
- options = options || {};
460
- var keys = Object.keys(options);
461
- for (var index = 0, length = keys.length; index < length; index++) {
462
- var key = keys[index];
463
- this[key] = options[key];
464
- }
465
- if (this.encoding) this.setEncoding(this.encoding);
466
- if (this.start !== void 0) {
467
- if ("number" !== typeof this.start) throw TypeError("start must be a Number");
468
- if (this.end === void 0) this.end = Infinity;
469
- else if ("number" !== typeof this.end) throw TypeError("end must be a Number");
470
- if (this.start > this.end) throw new Error("start must be <= end");
471
- this.pos = this.start;
472
- }
473
- if (this.fd !== null) {
474
- process.nextTick(function() {
475
- self._read();
476
- });
477
- return;
478
- }
479
- fs.open(this.path, this.flags, this.mode, function(err, fd) {
480
- if (err) {
481
- self.emit("error", err);
482
- self.readable = false;
483
- return;
484
- }
485
- self.fd = fd;
486
- self.emit("open", fd);
487
- self._read();
488
- });
489
- }
490
- function WriteStream(path, options) {
491
- if (!(this instanceof WriteStream)) return new WriteStream(path, options);
492
- Stream.call(this);
493
- this.path = path;
494
- this.fd = null;
495
- this.writable = true;
496
- this.flags = "w";
497
- this.encoding = "binary";
498
- this.mode = 438;
499
- this.bytesWritten = 0;
500
- options = options || {};
501
- var keys = Object.keys(options);
502
- for (var index = 0, length = keys.length; index < length; index++) {
503
- var key = keys[index];
504
- this[key] = options[key];
505
- }
506
- if (this.start !== void 0) {
507
- if ("number" !== typeof this.start) throw TypeError("start must be a Number");
508
- if (this.start < 0) throw new Error("start must be >= zero");
509
- this.pos = this.start;
510
- }
511
- this.busy = false;
512
- this._queue = [];
513
- if (this.fd === null) {
514
- this._open = fs.open;
515
- this._queue.push([
516
- this._open,
517
- this.path,
518
- this.flags,
519
- this.mode,
520
- void 0
521
- ]);
522
- this.flush();
523
- }
524
- }
525
- }
526
- }));
527
- //#endregion
528
- //#region node_modules/graceful-fs/clone.js
529
- var require_clone = /* @__PURE__ */ __commonJSMin(((exports, module) => {
530
- module.exports = clone;
531
- var getPrototypeOf = Object.getPrototypeOf || function(obj) {
532
- return obj.__proto__;
533
- };
534
- function clone(obj) {
535
- if (obj === null || typeof obj !== "object") return obj;
536
- if (obj instanceof Object) var copy = { __proto__: getPrototypeOf(obj) };
537
- else var copy = Object.create(null);
538
- Object.getOwnPropertyNames(obj).forEach(function(key) {
539
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
540
- });
541
- return copy;
542
- }
543
- }));
544
- //#endregion
545
- //#region node_modules/graceful-fs/graceful-fs.js
546
- var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
547
- var fs$1 = __require("fs");
548
- var polyfills = require_polyfills();
549
- var legacy = require_legacy_streams();
550
- var clone = require_clone();
551
- var util = __require("util");
552
- /* istanbul ignore next - node 0.x polyfill */
553
- var gracefulQueue;
554
- var previousSymbol;
555
- /* istanbul ignore else - node 0.x polyfill */
556
- if (typeof Symbol === "function" && typeof Symbol.for === "function") {
557
- gracefulQueue = Symbol.for("graceful-fs.queue");
558
- previousSymbol = Symbol.for("graceful-fs.previous");
559
- } else {
560
- gracefulQueue = "___graceful-fs.queue";
561
- previousSymbol = "___graceful-fs.previous";
562
- }
563
- function noop() {}
564
- function publishQueue(context, queue) {
565
- Object.defineProperty(context, gracefulQueue, { get: function() {
566
- return queue;
567
- } });
568
- }
569
- var debug = noop;
570
- if (util.debuglog) debug = util.debuglog("gfs4");
571
- else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug = function() {
572
- var m = util.format.apply(util, arguments);
573
- m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
574
- console.error(m);
575
- };
576
- if (!fs$1[gracefulQueue]) {
577
- publishQueue(fs$1, global[gracefulQueue] || []);
578
- fs$1.close = (function(fs$close) {
579
- function close(fd, cb) {
580
- return fs$close.call(fs$1, fd, function(err) {
581
- if (!err) resetQueue();
582
- if (typeof cb === "function") cb.apply(this, arguments);
583
- });
584
- }
585
- Object.defineProperty(close, previousSymbol, { value: fs$close });
586
- return close;
587
- })(fs$1.close);
588
- fs$1.closeSync = (function(fs$closeSync) {
589
- function closeSync(fd) {
590
- fs$closeSync.apply(fs$1, arguments);
591
- resetQueue();
592
- }
593
- Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
594
- return closeSync;
595
- })(fs$1.closeSync);
596
- if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
597
- debug(fs$1[gracefulQueue]);
598
- __require("assert").equal(fs$1[gracefulQueue].length, 0);
599
- });
600
- }
601
- if (!global[gracefulQueue]) publishQueue(global, fs$1[gracefulQueue]);
602
- module.exports = patch(clone(fs$1));
603
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$1.__patched) {
604
- module.exports = patch(fs$1);
605
- fs$1.__patched = true;
606
- }
607
- function patch(fs) {
608
- polyfills(fs);
609
- fs.gracefulify = patch;
610
- fs.createReadStream = createReadStream;
611
- fs.createWriteStream = createWriteStream;
612
- var fs$readFile = fs.readFile;
613
- fs.readFile = readFile;
614
- function readFile(path, options, cb) {
615
- if (typeof options === "function") cb = options, options = null;
616
- return go$readFile(path, options, cb);
617
- function go$readFile(path, options, cb, startTime) {
618
- return fs$readFile(path, options, function(err) {
619
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
620
- go$readFile,
621
- [
622
- path,
623
- options,
624
- cb
625
- ],
626
- err,
627
- startTime || Date.now(),
628
- Date.now()
629
- ]);
630
- else if (typeof cb === "function") cb.apply(this, arguments);
631
- });
632
- }
633
- }
634
- var fs$writeFile = fs.writeFile;
635
- fs.writeFile = writeFile;
636
- function writeFile(path, data, options, cb) {
637
- if (typeof options === "function") cb = options, options = null;
638
- return go$writeFile(path, data, options, cb);
639
- function go$writeFile(path, data, options, cb, startTime) {
640
- return fs$writeFile(path, data, options, function(err) {
641
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
642
- go$writeFile,
643
- [
644
- path,
645
- data,
646
- options,
647
- cb
648
- ],
649
- err,
650
- startTime || Date.now(),
651
- Date.now()
652
- ]);
653
- else if (typeof cb === "function") cb.apply(this, arguments);
654
- });
655
- }
656
- }
657
- var fs$appendFile = fs.appendFile;
658
- if (fs$appendFile) fs.appendFile = appendFile;
659
- function appendFile(path, data, options, cb) {
660
- if (typeof options === "function") cb = options, options = null;
661
- return go$appendFile(path, data, options, cb);
662
- function go$appendFile(path, data, options, cb, startTime) {
663
- return fs$appendFile(path, data, options, function(err) {
664
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
665
- go$appendFile,
666
- [
667
- path,
668
- data,
669
- options,
670
- cb
671
- ],
672
- err,
673
- startTime || Date.now(),
674
- Date.now()
675
- ]);
676
- else if (typeof cb === "function") cb.apply(this, arguments);
677
- });
678
- }
679
- }
680
- var fs$copyFile = fs.copyFile;
681
- if (fs$copyFile) fs.copyFile = copyFile;
682
- function copyFile(src, dest, flags, cb) {
683
- if (typeof flags === "function") {
684
- cb = flags;
685
- flags = 0;
686
- }
687
- return go$copyFile(src, dest, flags, cb);
688
- function go$copyFile(src, dest, flags, cb, startTime) {
689
- return fs$copyFile(src, dest, flags, function(err) {
690
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
691
- go$copyFile,
692
- [
693
- src,
694
- dest,
695
- flags,
696
- cb
697
- ],
698
- err,
699
- startTime || Date.now(),
700
- Date.now()
701
- ]);
702
- else if (typeof cb === "function") cb.apply(this, arguments);
703
- });
704
- }
705
- }
706
- var fs$readdir = fs.readdir;
707
- fs.readdir = readdir;
708
- var noReaddirOptionVersions = /^v[0-5]\./;
709
- function readdir(path, options, cb) {
710
- if (typeof options === "function") cb = options, options = null;
711
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path, options, cb, startTime) {
712
- return fs$readdir(path, fs$readdirCallback(path, options, cb, startTime));
713
- } : function go$readdir(path, options, cb, startTime) {
714
- return fs$readdir(path, options, fs$readdirCallback(path, options, cb, startTime));
715
- };
716
- return go$readdir(path, options, cb);
717
- function fs$readdirCallback(path, options, cb, startTime) {
718
- return function(err, files) {
719
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
720
- go$readdir,
721
- [
722
- path,
723
- options,
724
- cb
725
- ],
726
- err,
727
- startTime || Date.now(),
728
- Date.now()
729
- ]);
730
- else {
731
- if (files && files.sort) files.sort();
732
- if (typeof cb === "function") cb.call(this, err, files);
733
- }
734
- };
735
- }
736
- }
737
- if (process.version.substr(0, 4) === "v0.8") {
738
- var legStreams = legacy(fs);
739
- ReadStream = legStreams.ReadStream;
740
- WriteStream = legStreams.WriteStream;
741
- }
742
- var fs$ReadStream = fs.ReadStream;
743
- if (fs$ReadStream) {
744
- ReadStream.prototype = Object.create(fs$ReadStream.prototype);
745
- ReadStream.prototype.open = ReadStream$open;
746
- }
747
- var fs$WriteStream = fs.WriteStream;
748
- if (fs$WriteStream) {
749
- WriteStream.prototype = Object.create(fs$WriteStream.prototype);
750
- WriteStream.prototype.open = WriteStream$open;
751
- }
752
- Object.defineProperty(fs, "ReadStream", {
753
- get: function() {
754
- return ReadStream;
755
- },
756
- set: function(val) {
757
- ReadStream = val;
758
- },
759
- enumerable: true,
760
- configurable: true
761
- });
762
- Object.defineProperty(fs, "WriteStream", {
763
- get: function() {
764
- return WriteStream;
765
- },
766
- set: function(val) {
767
- WriteStream = val;
768
- },
769
- enumerable: true,
770
- configurable: true
771
- });
772
- var FileReadStream = ReadStream;
773
- Object.defineProperty(fs, "FileReadStream", {
774
- get: function() {
775
- return FileReadStream;
776
- },
777
- set: function(val) {
778
- FileReadStream = val;
779
- },
780
- enumerable: true,
781
- configurable: true
782
- });
783
- var FileWriteStream = WriteStream;
784
- Object.defineProperty(fs, "FileWriteStream", {
785
- get: function() {
786
- return FileWriteStream;
787
- },
788
- set: function(val) {
789
- FileWriteStream = val;
790
- },
791
- enumerable: true,
792
- configurable: true
793
- });
794
- function ReadStream(path, options) {
795
- if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
796
- else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
797
- }
798
- function ReadStream$open() {
799
- var that = this;
800
- open(that.path, that.flags, that.mode, function(err, fd) {
801
- if (err) {
802
- if (that.autoClose) that.destroy();
803
- that.emit("error", err);
804
- } else {
805
- that.fd = fd;
806
- that.emit("open", fd);
807
- that.read();
808
- }
809
- });
810
- }
811
- function WriteStream(path, options) {
812
- if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
813
- else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
814
- }
815
- function WriteStream$open() {
816
- var that = this;
817
- open(that.path, that.flags, that.mode, function(err, fd) {
818
- if (err) {
819
- that.destroy();
820
- that.emit("error", err);
821
- } else {
822
- that.fd = fd;
823
- that.emit("open", fd);
824
- }
825
- });
826
- }
827
- function createReadStream(path, options) {
828
- return new fs.ReadStream(path, options);
829
- }
830
- function createWriteStream(path, options) {
831
- return new fs.WriteStream(path, options);
832
- }
833
- var fs$open = fs.open;
834
- fs.open = open;
835
- function open(path, flags, mode, cb) {
836
- if (typeof mode === "function") cb = mode, mode = null;
837
- return go$open(path, flags, mode, cb);
838
- function go$open(path, flags, mode, cb, startTime) {
839
- return fs$open(path, flags, mode, function(err, fd) {
840
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
841
- go$open,
842
- [
843
- path,
844
- flags,
845
- mode,
846
- cb
847
- ],
848
- err,
849
- startTime || Date.now(),
850
- Date.now()
851
- ]);
852
- else if (typeof cb === "function") cb.apply(this, arguments);
853
- });
854
- }
855
- }
856
- return fs;
857
- }
858
- function enqueue(elem) {
859
- debug("ENQUEUE", elem[0].name, elem[1]);
860
- fs$1[gracefulQueue].push(elem);
861
- retry();
862
- }
863
- var retryTimer;
864
- function resetQueue() {
865
- var now = Date.now();
866
- for (var i = 0; i < fs$1[gracefulQueue].length; ++i) if (fs$1[gracefulQueue][i].length > 2) {
867
- fs$1[gracefulQueue][i][3] = now;
868
- fs$1[gracefulQueue][i][4] = now;
869
- }
870
- retry();
871
- }
872
- function retry() {
873
- clearTimeout(retryTimer);
874
- retryTimer = void 0;
875
- if (fs$1[gracefulQueue].length === 0) return;
876
- var elem = fs$1[gracefulQueue].shift();
877
- var fn = elem[0];
878
- var args = elem[1];
879
- var err = elem[2];
880
- var startTime = elem[3];
881
- var lastTime = elem[4];
882
- if (startTime === void 0) {
883
- debug("RETRY", fn.name, args);
884
- fn.apply(null, args);
885
- } else if (Date.now() - startTime >= 6e4) {
886
- debug("TIMEOUT", fn.name, args);
887
- var cb = args.pop();
888
- if (typeof cb === "function") cb.call(null, err);
889
- } else {
890
- var sinceAttempt = Date.now() - lastTime;
891
- var sinceStart = Math.max(lastTime - startTime, 1);
892
- if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
893
- debug("RETRY", fn.name, args);
894
- fn.apply(null, args.concat([startTime]));
895
- } else fs$1[gracefulQueue].push(elem);
896
- }
897
- if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
898
- }
899
- }));
900
- //#endregion
901
- //#region node_modules/signal-exit/dist/cjs/signals.js
902
- var require_signals = /* @__PURE__ */ __commonJSMin(((exports) => {
903
- Object.defineProperty(exports, "__esModule", { value: true });
904
- exports.signals = void 0;
905
- /**
906
- * This is not the set of all possible signals.
907
- *
908
- * It IS, however, the set of all signals that trigger
909
- * an exit on either Linux or BSD systems. Linux is a
910
- * superset of the signal names supported on BSD, and
911
- * the unknown signals just fail to register, so we can
912
- * catch that easily enough.
913
- *
914
- * Windows signals are a different set, since there are
915
- * signals that terminate Windows processes, but don't
916
- * terminate (or don't even exist) on Posix systems.
917
- *
918
- * Don't bother with SIGKILL. It's uncatchable, which
919
- * means that we can't fire any callbacks anyway.
920
- *
921
- * If a user does happen to register a handler on a non-
922
- * fatal signal like SIGWINCH or something, and then
923
- * exit, it'll end up firing `process.emit('exit')`, so
924
- * the handler will be fired anyway.
925
- *
926
- * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
927
- * artificially, inherently leave the process in a
928
- * state from which it is not safe to try and enter JS
929
- * listeners.
930
- */
931
- exports.signals = [];
932
- exports.signals.push("SIGHUP", "SIGINT", "SIGTERM");
933
- if (process.platform !== "win32") exports.signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
934
- if (process.platform === "linux") exports.signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
935
- }));
936
- //#endregion
937
- //#region node_modules/signal-exit/dist/cjs/index.js
938
- var require_cjs = /* @__PURE__ */ __commonJSMin(((exports) => {
939
- var _a;
940
- Object.defineProperty(exports, "__esModule", { value: true });
941
- exports.unload = exports.load = exports.onExit = exports.signals = void 0;
942
- const signals_js_1 = require_signals();
943
- Object.defineProperty(exports, "signals", {
944
- enumerable: true,
945
- get: function() {
946
- return signals_js_1.signals;
947
- }
948
- });
949
- const processOk = (process) => !!process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
950
- const kExitEmitter = Symbol.for("signal-exit emitter");
951
- const global = globalThis;
952
- const ObjectDefineProperty = Object.defineProperty.bind(Object);
953
- var Emitter = class {
954
- emitted = {
955
- afterExit: false,
956
- exit: false
957
- };
958
- listeners = {
959
- afterExit: [],
960
- exit: []
961
- };
962
- count = 0;
963
- id = Math.random();
964
- constructor() {
965
- if (global[kExitEmitter]) return global[kExitEmitter];
966
- ObjectDefineProperty(global, kExitEmitter, {
967
- value: this,
968
- writable: false,
969
- enumerable: false,
970
- configurable: false
971
- });
972
- }
973
- on(ev, fn) {
974
- this.listeners[ev].push(fn);
975
- }
976
- removeListener(ev, fn) {
977
- const list = this.listeners[ev];
978
- const i = list.indexOf(fn);
979
- /* c8 ignore start */
980
- if (i === -1) return;
981
- /* c8 ignore stop */
982
- if (i === 0 && list.length === 1) list.length = 0;
983
- else list.splice(i, 1);
984
- }
985
- emit(ev, code, signal) {
986
- if (this.emitted[ev]) return false;
987
- this.emitted[ev] = true;
988
- let ret = false;
989
- for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
990
- if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
991
- return ret;
992
- }
993
- };
994
- var SignalExitBase = class {};
995
- const signalExitWrap = (handler) => {
996
- return {
997
- onExit(cb, opts) {
998
- return handler.onExit(cb, opts);
999
- },
1000
- load() {
1001
- return handler.load();
1002
- },
1003
- unload() {
1004
- return handler.unload();
1005
- }
1006
- };
1007
- };
1008
- var SignalExitFallback = class extends SignalExitBase {
1009
- onExit() {
1010
- return () => {};
1011
- }
1012
- load() {}
1013
- unload() {}
1014
- };
1015
- var SignalExit = class extends SignalExitBase {
1016
- /* c8 ignore start */
1017
- #hupSig = process.platform === "win32" ? "SIGINT" : "SIGHUP";
1018
- /* c8 ignore stop */
1019
- #emitter = new Emitter();
1020
- #process;
1021
- #originalProcessEmit;
1022
- #originalProcessReallyExit;
1023
- #sigListeners = {};
1024
- #loaded = false;
1025
- constructor(process) {
1026
- super();
1027
- this.#process = process;
1028
- this.#sigListeners = {};
1029
- for (const sig of signals_js_1.signals) this.#sigListeners[sig] = () => {
1030
- const listeners = this.#process.listeners(sig);
1031
- let { count } = this.#emitter;
1032
- /* c8 ignore start */
1033
- const p = process;
1034
- if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
1035
- /* c8 ignore stop */
1036
- if (listeners.length === count) {
1037
- this.unload();
1038
- const ret = this.#emitter.emit("exit", null, sig);
1039
- /* c8 ignore start */
1040
- const s = sig === "SIGHUP" ? this.#hupSig : sig;
1041
- if (!ret) process.kill(process.pid, s);
1042
- }
1043
- };
1044
- this.#originalProcessReallyExit = process.reallyExit;
1045
- this.#originalProcessEmit = process.emit;
1046
- }
1047
- onExit(cb, opts) {
1048
- /* c8 ignore start */
1049
- if (!processOk(this.#process)) return () => {};
1050
- /* c8 ignore stop */
1051
- if (this.#loaded === false) this.load();
1052
- const ev = opts?.alwaysLast ? "afterExit" : "exit";
1053
- this.#emitter.on(ev, cb);
1054
- return () => {
1055
- this.#emitter.removeListener(ev, cb);
1056
- if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
1057
- };
1058
- }
1059
- load() {
1060
- if (this.#loaded) return;
1061
- this.#loaded = true;
1062
- this.#emitter.count += 1;
1063
- for (const sig of signals_js_1.signals) try {
1064
- const fn = this.#sigListeners[sig];
1065
- if (fn) this.#process.on(sig, fn);
1066
- } catch (_) {}
1067
- this.#process.emit = (ev, ...a) => {
1068
- return this.#processEmit(ev, ...a);
1069
- };
1070
- this.#process.reallyExit = (code) => {
1071
- return this.#processReallyExit(code);
1072
- };
1073
- }
1074
- unload() {
1075
- if (!this.#loaded) return;
1076
- this.#loaded = false;
1077
- signals_js_1.signals.forEach((sig) => {
1078
- const listener = this.#sigListeners[sig];
1079
- /* c8 ignore start */
1080
- if (!listener) throw new Error("Listener not defined for signal: " + sig);
1081
- /* c8 ignore stop */
1082
- try {
1083
- this.#process.removeListener(sig, listener);
1084
- } catch (_) {}
1085
- /* c8 ignore stop */
1086
- });
1087
- this.#process.emit = this.#originalProcessEmit;
1088
- this.#process.reallyExit = this.#originalProcessReallyExit;
1089
- this.#emitter.count -= 1;
1090
- }
1091
- #processReallyExit(code) {
1092
- /* c8 ignore start */
1093
- if (!processOk(this.#process)) return 0;
1094
- this.#process.exitCode = code || 0;
1095
- /* c8 ignore stop */
1096
- this.#emitter.emit("exit", this.#process.exitCode, null);
1097
- return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
1098
- }
1099
- #processEmit(ev, ...args) {
1100
- const og = this.#originalProcessEmit;
1101
- if (ev === "exit" && processOk(this.#process)) {
1102
- if (typeof args[0] === "number") this.#process.exitCode = args[0];
1103
- /* c8 ignore start */
1104
- const ret = og.call(this.#process, ev, ...args);
1105
- /* c8 ignore start */
1106
- this.#emitter.emit("exit", this.#process.exitCode, null);
1107
- /* c8 ignore stop */
1108
- return ret;
1109
- } else return og.call(this.#process, ev, ...args);
1110
- }
1111
- };
1112
- const process = globalThis.process;
1113
- _a = signalExitWrap(processOk(process) ? new SignalExit(process) : new SignalExitFallback()), exports.onExit = _a.onExit, exports.load = _a.load, exports.unload = _a.unload;
1114
- }));
1115
- //#endregion
1116
- //#region node_modules/@pkcprotocol/proper-lock-file/dist/src/mtime-precision.js
1117
- var require_mtime_precision = /* @__PURE__ */ __commonJSMin(((exports) => {
1118
- Object.defineProperty(exports, "__esModule", { value: true });
1119
- exports.probe = probe;
1120
- exports.getMtime = getMtime;
1121
- const cacheSymbol = Symbol();
1122
- function probe(file, fs, callback) {
1123
- const cachedPrecision = fs[cacheSymbol];
1124
- if (cachedPrecision) return fs.stat(file, (err, stat) => {
1125
- /* istanbul ignore if */
1126
- if (err) return callback(err);
1127
- callback(null, stat.mtime, cachedPrecision);
1128
- });
1129
- const mtime = /* @__PURE__ */ new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
1130
- fs.utimes(file, mtime, mtime, (err) => {
1131
- /* istanbul ignore if */
1132
- if (err) return callback(err);
1133
- fs.stat(file, (err, stat) => {
1134
- /* istanbul ignore if */
1135
- if (err) return callback(err);
1136
- const precision = stat.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
1137
- Object.defineProperty(fs, cacheSymbol, { value: precision });
1138
- callback(null, stat.mtime, precision);
1139
- });
1140
- });
1141
- }
1142
- function getMtime(precision) {
1143
- let now = Date.now();
1144
- if (precision === "s") now = Math.ceil(now / 1e3) * 1e3;
1145
- return new Date(now);
1146
- }
1147
- }));
1148
- //#endregion
1149
- //#region node_modules/@pkcprotocol/proper-lock-file/dist/src/lockfile.js
1150
- var require_lockfile = /* @__PURE__ */ __commonJSMin(((exports) => {
1151
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
1152
- if (k2 === void 0) k2 = k;
1153
- var desc = Object.getOwnPropertyDescriptor(m, k);
1154
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
1155
- enumerable: true,
1156
- get: function() {
1157
- return m[k];
1158
- }
1159
- };
1160
- Object.defineProperty(o, k2, desc);
1161
- }) : (function(o, m, k, k2) {
1162
- if (k2 === void 0) k2 = k;
1163
- o[k2] = m[k];
1164
- }));
1165
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
1166
- Object.defineProperty(o, "default", {
1167
- enumerable: true,
1168
- value: v
1169
- });
1170
- }) : function(o, v) {
1171
- o["default"] = v;
1172
- });
1173
- var __importStar = exports && exports.__importStar || (function() {
1174
- var ownKeys = function(o) {
1175
- ownKeys = Object.getOwnPropertyNames || function(o) {
1176
- var ar = [];
1177
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
1178
- return ar;
1179
- };
1180
- return ownKeys(o);
1181
- };
1182
- return function(mod) {
1183
- if (mod && mod.__esModule) return mod;
1184
- var result = {};
1185
- if (mod != null) {
1186
- for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
1187
- }
1188
- __setModuleDefault(result, mod);
1189
- return result;
1190
- };
1191
- })();
1192
- var __importDefault = exports && exports.__importDefault || function(mod) {
1193
- return mod && mod.__esModule ? mod : { "default": mod };
1194
- };
1195
- Object.defineProperty(exports, "__esModule", { value: true });
1196
- exports.lock = lock;
1197
- exports.unlock = unlock;
1198
- exports.check = check;
1199
- exports.getLocks = getLocks;
1200
- const path_1 = __importDefault(__require("path"));
1201
- const graceful_fs_1 = __importDefault(require_graceful_fs());
1202
- const retry_1 = __importDefault(require_retry());
1203
- const signal_exit_1 = require_cjs();
1204
- const assert_1 = __importDefault(__require("assert"));
1205
- const mtimePrecision = __importStar(require_mtime_precision());
1206
- const locks = {};
1207
- function getLockFile(file, options) {
1208
- (0, assert_1.default)(typeof options.lockfilePath === "string");
1209
- return options.lockfilePath;
1210
- }
1211
- function resolveCanonicalPath(file, options, callback) {
1212
- if (!options.realpath) return callback(null, path_1.default.resolve(file));
1213
- options.fs.realpath(file, (err, resolvedPath) => {
1214
- callback(err, resolvedPath);
1215
- });
1216
- }
1217
- function acquireLock(file, options, callback) {
1218
- const lockfilePath = getLockFile(file, options);
1219
- options.fs.mkdir(lockfilePath, (err) => {
1220
- if (!err) return mtimePrecision.probe(lockfilePath, options.fs, (err, mtime, precision) => {
1221
- /* istanbul ignore if */
1222
- if (err) {
1223
- options.fs.rmdir(lockfilePath, () => {});
1224
- return callback(err);
1225
- }
1226
- callback(null, mtime, precision);
1227
- });
1228
- if (err.code !== "EEXIST") return callback(err);
1229
- if (options.stale <= 0) return callback(Object.assign(/* @__PURE__ */ new Error("Lock file is already being held"), {
1230
- code: "ELOCKED",
1231
- file
1232
- }));
1233
- options.fs.stat(lockfilePath, (err, stat) => {
1234
- if (err) {
1235
- if (err.code === "ENOENT") return acquireLock(file, {
1236
- ...options,
1237
- stale: 0
1238
- }, callback);
1239
- return callback(err);
1240
- }
1241
- if (!isLockStale(stat, options)) return callback(Object.assign(/* @__PURE__ */ new Error("Lock file is already being held"), {
1242
- code: "ELOCKED",
1243
- file
1244
- }));
1245
- removeLock(file, options, (err) => {
1246
- if (err) return callback(err);
1247
- acquireLock(file, {
1248
- ...options,
1249
- stale: 0
1250
- }, callback);
1251
- });
1252
- });
1253
- });
1254
- }
1255
- function isLockStale(stat, options) {
1256
- return stat.mtime.getTime() < Date.now() - options.stale;
1257
- }
1258
- function removeLock(file, options, callback) {
1259
- options.fs.rmdir(getLockFile(file, options), (err) => {
1260
- if (err && err.code !== "ENOENT") return callback(err);
1261
- callback();
1262
- });
1263
- }
1264
- function updateLock(file, options) {
1265
- if (typeof options.lockfilePath !== "string") throw Error("Options is not defined ");
1266
- const lock = locks[file + options.lockfilePath];
1267
- /* istanbul ignore if */
1268
- if (lock.updateTimeout) return;
1269
- lock.updateDelay = lock.updateDelay || options.update;
1270
- lock.updateTimeout = setTimeout(() => {
1271
- lock.updateTimeout = null;
1272
- options.fs.stat(lock.lockfilePath, (err, stat) => {
1273
- const isOverThreshold = lock.lastUpdate + options.stale < Date.now();
1274
- if (err) {
1275
- if (err.code === "ENOENT" || isOverThreshold) return setLockAsCompromised(file, lock, Object.assign(err, { code: "ECOMPROMISED" }));
1276
- lock.updateDelay = 1e3;
1277
- return updateLock(file, options);
1278
- }
1279
- if (!(lock.mtime.getTime() === stat.mtime.getTime())) return setLockAsCompromised(file, lock, Object.assign(/* @__PURE__ */ new Error("Unable to update lock within the stale threshold"), { code: "ECOMPROMISED" }));
1280
- const mtime = mtimePrecision.getMtime(lock.mtimePrecision);
1281
- options.fs.utimes(lock.lockfilePath, mtime, mtime, (err) => {
1282
- const isOverThreshold = lock.lastUpdate + options.stale < Date.now();
1283
- if (lock.released) return;
1284
- if (err) {
1285
- if (err.code === "ENOENT" || isOverThreshold) return setLockAsCompromised(file, lock, Object.assign(err, { code: "ECOMPROMISED" }));
1286
- lock.updateDelay = 1e3;
1287
- return updateLock(file, options);
1288
- }
1289
- lock.mtime = mtime;
1290
- lock.lastUpdate = Date.now();
1291
- lock.updateDelay = null;
1292
- updateLock(file, options);
1293
- });
1294
- });
1295
- }, lock.updateDelay);
1296
- /* istanbul ignore else */
1297
- if (lock.updateTimeout && lock.updateTimeout.unref) lock.updateTimeout.unref();
1298
- }
1299
- function setLockAsCompromised(file, lock, err) {
1300
- lock.released = true;
1301
- /* istanbul ignore if */
1302
- if (lock.updateTimeout) clearTimeout(lock.updateTimeout);
1303
- const lockKey = file + lock.lockfilePath;
1304
- if (locks[lockKey] === lock) delete locks[lockKey];
1305
- lock.options.onCompromised(err);
1306
- }
1307
- function lock(file, options, callback) {
1308
- /* istanbul ignore next */
1309
- const merged = {
1310
- stale: 1e4,
1311
- update: null,
1312
- realpath: true,
1313
- retries: { retries: 0 },
1314
- fs: graceful_fs_1.default,
1315
- onCompromised: (err) => {
1316
- throw err;
1317
- },
1318
- lockfilePath: "",
1319
- ...options
1320
- };
1321
- let retries = merged.retries || { retries: 0 };
1322
- retries = typeof retries === "number" ? { retries } : retries;
1323
- const stale = Math.max(merged.stale || 0, 2e3);
1324
- let update = merged.update == null ? stale / 2 : merged.update || 0;
1325
- update = Math.max(Math.min(update, stale / 2), 1e3);
1326
- const opts = {
1327
- stale,
1328
- update,
1329
- realpath: merged.realpath,
1330
- retries,
1331
- fs: merged.fs,
1332
- onCompromised: merged.onCompromised,
1333
- lockfilePath: merged.lockfilePath
1334
- };
1335
- resolveCanonicalPath(file, opts, (err, resolvedFile) => {
1336
- if (err) return callback(err);
1337
- file = resolvedFile;
1338
- const operation = retry_1.default.operation(opts.retries);
1339
- operation.attempt(() => {
1340
- acquireLock(file, opts, (err, mtime, precision) => {
1341
- if (operation.retry(err)) return;
1342
- if (err) return callback(operation.mainError());
1343
- const lockKey = file + opts.lockfilePath;
1344
- const lockEntry = locks[lockKey] = {
1345
- lockfilePath: getLockFile(file, opts),
1346
- file,
1347
- mtime,
1348
- mtimePrecision: precision,
1349
- options: opts,
1350
- lastUpdate: Date.now(),
1351
- released: false,
1352
- updateTimeout: null,
1353
- updateDelay: null
1354
- };
1355
- updateLock(file, opts);
1356
- callback(null, (releasedCallback) => {
1357
- if (lockEntry.released) return releasedCallback && releasedCallback(Object.assign(/* @__PURE__ */ new Error("Lock is already released"), { code: "ERELEASED" }));
1358
- unlock(file, {
1359
- ...opts,
1360
- realpath: false
1361
- }, releasedCallback);
1362
- });
1363
- });
1364
- });
1365
- });
1366
- }
1367
- function unlock(file, options, callback) {
1368
- const opts = {
1369
- fs: graceful_fs_1.default,
1370
- realpath: true,
1371
- lockfilePath: "",
1372
- ...options
1373
- };
1374
- resolveCanonicalPath(file, opts, (err, resolvedFile) => {
1375
- if (err) return callback(err);
1376
- file = resolvedFile;
1377
- const lockKey = file + opts.lockfilePath;
1378
- const lockEntry = locks[lockKey];
1379
- if (!lockEntry) return callback(Object.assign(/* @__PURE__ */ new Error("Lock is not acquired/owned by you"), { code: "ENOTACQUIRED" }));
1380
- lockEntry.updateTimeout && clearTimeout(lockEntry.updateTimeout);
1381
- lockEntry.released = true;
1382
- delete locks[lockKey];
1383
- removeLock(file, opts, callback);
1384
- });
1385
- }
1386
- function check(file, options, callback) {
1387
- const merged = {
1388
- stale: 1e4,
1389
- realpath: true,
1390
- fs: graceful_fs_1.default,
1391
- lockfilePath: "",
1392
- ...options
1393
- };
1394
- const opts = {
1395
- ...merged,
1396
- stale: Math.max(merged.stale || 0, 2e3)
1397
- };
1398
- resolveCanonicalPath(file, opts, (err, resolvedFile) => {
1399
- if (err) return callback(err);
1400
- file = resolvedFile;
1401
- opts.fs.stat(getLockFile(file, opts), (err, stat) => {
1402
- if (err) return err.code === "ENOENT" ? callback(null, false) : callback(err);
1403
- return callback(null, !isLockStale(stat, opts));
1404
- });
1405
- });
1406
- }
1407
- function getLocks() {
1408
- return locks;
1409
- }
1410
- /* istanbul ignore next */
1411
- (0, signal_exit_1.onExit)(() => {
1412
- for (const entry of Object.values(locks)) try {
1413
- entry.options.fs.rmdirSync(entry.lockfilePath);
1414
- } catch (e) {}
1415
- });
1416
- }));
1417
- //#endregion
1418
- //#region node_modules/@pkcprotocol/proper-lock-file/dist/src/adapter.js
1419
- var require_adapter = /* @__PURE__ */ __commonJSMin(((exports) => {
1420
- var __importDefault = exports && exports.__importDefault || function(mod) {
1421
- return mod && mod.__esModule ? mod : { "default": mod };
1422
- };
1423
- Object.defineProperty(exports, "__esModule", { value: true });
1424
- exports.toPromise = toPromise;
1425
- exports.toSync = toSync;
1426
- exports.toSyncOptions = toSyncOptions;
1427
- const graceful_fs_1 = __importDefault(require_graceful_fs());
1428
- function createSyncFs(inputFs) {
1429
- const methods = [
1430
- "mkdir",
1431
- "realpath",
1432
- "stat",
1433
- "rmdir",
1434
- "utimes"
1435
- ];
1436
- const newFs = { ...inputFs };
1437
- methods.forEach((method) => {
1438
- newFs[method] = (...args) => {
1439
- const callback = args.pop();
1440
- let ret;
1441
- try {
1442
- ret = inputFs[`${method}Sync`](...args);
1443
- } catch (err) {
1444
- return callback(err);
1445
- }
1446
- callback(null, ret);
1447
- };
1448
- });
1449
- return newFs;
1450
- }
1451
- function toPromise(method) {
1452
- return (...args) => new Promise((resolve, reject) => {
1453
- args.push((err, result) => {
1454
- if (err) reject(err);
1455
- else resolve(result);
1456
- });
1457
- method(...args);
1458
- });
1459
- }
1460
- function toSync(method) {
1461
- return (...args) => {
1462
- let err;
1463
- let result;
1464
- args.push((_err, _result) => {
1465
- err = _err ?? void 0;
1466
- result = _result;
1467
- });
1468
- method(...args);
1469
- if (err) throw err;
1470
- return result;
1471
- };
1472
- }
1473
- function toSyncOptions(options) {
1474
- const opts = { ...options };
1475
- opts.fs = createSyncFs(opts.fs || graceful_fs_1.default);
1476
- if (typeof opts.retries === "number" && opts.retries > 0 || opts.retries && typeof opts.retries.retries === "number" && opts.retries.retries > 0) throw Object.assign(/* @__PURE__ */ new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
1477
- return opts;
1478
- }
1479
- }));
1480
- //#endregion
1481
- //#region node_modules/@pkcprotocol/proper-lock-file/dist/src/index.js
1482
- var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1483
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
1484
- if (k2 === void 0) k2 = k;
1485
- var desc = Object.getOwnPropertyDescriptor(m, k);
1486
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
1487
- enumerable: true,
1488
- get: function() {
1489
- return m[k];
1490
- }
1491
- };
1492
- Object.defineProperty(o, k2, desc);
1493
- }) : (function(o, m, k, k2) {
1494
- if (k2 === void 0) k2 = k;
1495
- o[k2] = m[k];
1496
- }));
1497
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
1498
- Object.defineProperty(o, "default", {
1499
- enumerable: true,
1500
- value: v
1501
- });
1502
- }) : function(o, v) {
1503
- o["default"] = v;
1504
- });
1505
- const lockfileModule = (exports && exports.__importStar || (function() {
1506
- var ownKeys = function(o) {
1507
- ownKeys = Object.getOwnPropertyNames || function(o) {
1508
- var ar = [];
1509
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
1510
- return ar;
1511
- };
1512
- return ownKeys(o);
1513
- };
1514
- return function(mod) {
1515
- if (mod && mod.__esModule) return mod;
1516
- var result = {};
1517
- if (mod != null) {
1518
- for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
1519
- }
1520
- __setModuleDefault(result, mod);
1521
- return result;
1522
- };
1523
- })())(require_lockfile());
1524
- const adapter_1 = require_adapter();
1525
- async function lock(file, options) {
1526
- const release = await (0, adapter_1.toPromise)(lockfileModule.lock)(file, options);
1527
- return (0, adapter_1.toPromise)(release);
1528
- }
1529
- function lockSync(file, options) {
1530
- const release = (0, adapter_1.toSync)(lockfileModule.lock)(file, (0, adapter_1.toSyncOptions)(options));
1531
- return (0, adapter_1.toSync)(release);
1532
- }
1533
- function unlock(file, options) {
1534
- return (0, adapter_1.toPromise)(lockfileModule.unlock)(file, options);
1535
- }
1536
- function unlockSync(file, options) {
1537
- return (0, adapter_1.toSync)(lockfileModule.unlock)(file, (0, adapter_1.toSyncOptions)(options));
1538
- }
1539
- function check(file, options) {
1540
- return (0, adapter_1.toPromise)(lockfileModule.check)(file, options);
1541
- }
1542
- function checkSync(file, options) {
1543
- return (0, adapter_1.toSync)(lockfileModule.check)(file, (0, adapter_1.toSyncOptions)(options));
1544
- }
1545
- module.exports = Object.assign(lock, {
1546
- lock,
1547
- unlock,
1548
- lockSync,
1549
- unlockSync,
1550
- check,
1551
- checkSync
1552
- });
1553
- }));
1554
- //#endregion
1555
187
  //#region node_modules/uuid/dist-node/native.js
1556
188
  var native_default = { randomUUID };
1557
189
  //#endregion
@@ -5240,12 +3872,9 @@ var DbHandler = class {
5240
3872
  }
5241
3873
  }
5242
3874
  async isCommunityStartLocked(communityAddress = this._community.address) {
5243
- const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5244
- const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5245
- return await import_src.default.check(communityDbPath, {
5246
- lockfilePath,
5247
- realpath: false,
5248
- stale: 1e4
3875
+ return isCommunityStartLocked({
3876
+ dataPath: this._community._pkc.dataPath,
3877
+ communityAddress
5249
3878
  });
5250
3879
  }
5251
3880
  async lockCommunityState() {
@@ -8227,7 +6856,7 @@ async function applyPagesEdit(community, pagesEdit) {
8227
6856
  }
8228
6857
  async function validateNewAddressBeforeEditing(community, newAddress, log) {
8229
6858
  if (doesDomainAddressHaveCapitalLetter(newAddress)) throw new PKCError("ERR_COMMUNITY_NAME_HAS_CAPITAL_LETTER", { communityAddress: newAddress });
8230
- if (community._pkc.communities.find((existing) => areEquivalentCommunityAddresses(existing, newAddress) && !areEquivalentCommunityAddresses(existing, community.address))) throw new PKCError("ERR_COMMUNITY_OWNER_ATTEMPTED_EDIT_NEW_ADDRESS_THAT_ALREADY_EXISTS", {
6859
+ if (findCommunitiesEntry(community._pkc.communities.filter((entry) => entry.publicKey !== communityIdentityPublicKey(community)), { address: newAddress })) throw new PKCError("ERR_COMMUNITY_OWNER_ATTEMPTED_EDIT_NEW_ADDRESS_THAT_ALREADY_EXISTS", {
8231
6860
  currentCommunityAddress: community.address,
8232
6861
  newCommunityAddress: newAddress,
8233
6862
  currentSubs: community._pkc.communities
@@ -8254,6 +6883,9 @@ function deriveNameAndAddressEdit(community, editOptions) {
8254
6883
  name: isStringDomain(address) ? address : void 0
8255
6884
  };
8256
6885
  }
6886
+ function listRenamedCommunityNow(community) {
6887
+ refreshCommunitiesList(community._pkc);
6888
+ }
8257
6889
  async function editPropsOnStartedCommunity(community, parsedEditOptions, pagesEdit) {
8258
6890
  const log = logger_default("pkc-js:local-community:start:editPropsOnStartedCommunity");
8259
6891
  const oldAddress = t$9(community.address);
@@ -8262,7 +6894,7 @@ async function editPropsOnStartedCommunity(community, parsedEditOptions, pagesEd
8262
6894
  log(`Attempting to edit community.address from ${oldAddress} to ${parsedEditOptions.address}. We will stop community first`);
8263
6895
  await community.stop();
8264
6896
  await community._dbHandler.changeDbFilename(oldAddress, parsedEditOptions.address);
8265
- refreshCommunitiesList(community._pkc);
6897
+ listRenamedCommunityNow(community);
8266
6898
  community.setAddress(parsedEditOptions.address);
8267
6899
  await community._dbHandler.initDbIfNeeded();
8268
6900
  await community.start();
@@ -8305,7 +6937,7 @@ async function editPropsOnNotStartedCommunity(community, parsedEditOptions, page
8305
6937
  await movePostUpdatesFolderToNewAddress(community, community.address, parsedEditOptions.address);
8306
6938
  community._dbHandler.destoryConnection();
8307
6939
  await community._dbHandler.changeDbFilename(community.address, parsedEditOptions.address);
8308
- refreshCommunitiesList(community._pkc);
6940
+ listRenamedCommunityNow(community);
8309
6941
  await community._dbHandler.initDbIfNeeded();
8310
6942
  community.setAddress(parsedEditOptions.address);
8311
6943
  }
@@ -8682,6 +7314,11 @@ var LocalCommunity = class extends RpcLocalCommunity {
8682
7314
  }
8683
7315
  async _updateStartedValue() {
8684
7316
  this.started = await this._dbHandler.isCommunityStartLocked(this.address);
7317
+ try {
7318
+ refreshCommunitiesList(this._pkc);
7319
+ } catch (e) {
7320
+ logger_default("pkc-js:local-community:_updateStartedValue").error("Failed to refresh pkc.communities", e);
7321
+ }
8685
7322
  }
8686
7323
  async initNewLocalCommunityPropsNoMerge(newProps) {
8687
7324
  return initNewLocalCommunityPropsNoMerge(this, newProps);