superbee 0.4.4-pre.3 → 0.4.4-pre.5

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.
@@ -3397,6 +3397,11 @@ function stringifyDoc(frontmatter2, body) {
3397
3397
  return stringifyWithData(frontmatter2, body);
3398
3398
  }
3399
3399
 
3400
+ // ../core/src/code-unit-order.ts
3401
+ function compareCodeUnits(a, b) {
3402
+ return a < b ? -1 : a > b ? 1 : 0;
3403
+ }
3404
+
3400
3405
  // ../core/src/links.ts
3401
3406
  function normalizeSegments(segments) {
3402
3407
  const out = [];
@@ -3857,7 +3862,7 @@ async function scanMatching(backend, filter, onSkip) {
3857
3862
  for (const result of await readManyExisting(backend, ids, onSkip)) {
3858
3863
  if (matchesFilter(result.doc, filter)) results.push(result);
3859
3864
  }
3860
- results.sort((a, b) => a.doc.id.localeCompare(b.doc.id));
3865
+ results.sort((a, b) => compareCodeUnits(a.doc.id, b.doc.id));
3861
3866
  return results;
3862
3867
  }
3863
3868
  async function query(backend, filter = {}, options = {}) {
@@ -3866,7 +3871,7 @@ async function query(backend, filter = {}, options = {}) {
3866
3871
  async function queryHeads(backend, filter = {}, options = {}) {
3867
3872
  if (backend.queryHeads) {
3868
3873
  const rows = (await backend.queryHeads(filter, options.onSkip ? { onSkip: options.onSkip } : void 0)).filter((row) => matchesFilter(row, filter));
3869
- rows.sort((a, b) => a.id.localeCompare(b.id));
3874
+ rows.sort((a, b) => compareCodeUnits(a.id, b.id));
3870
3875
  return rows;
3871
3876
  }
3872
3877
  return (await scanMatching(backend, filter, options.onSkip)).map(({ doc, version: version2 }) => ({
@@ -3906,7 +3911,7 @@ async function queryEdges(backend, filter = {}, options = {}) {
3906
3911
  edges.push(link);
3907
3912
  }
3908
3913
  }
3909
- edges.sort((a, b) => a.from.localeCompare(b.from) || a.to.localeCompare(b.to) || a.text.localeCompare(b.text));
3914
+ edges.sort((a, b) => compareCodeUnits(a.from, b.from) || compareCodeUnits(a.to, b.to) || compareCodeUnits(a.text, b.text));
3910
3915
  return edges;
3911
3916
  }
3912
3917
 
@@ -5458,11 +5463,6 @@ async function queryEdges2(bundle, filter = {}, options = {}) {
5458
5463
  // ../core/src/bundle.ts
5459
5464
  setDefaultBackendFactory((root) => new FilesystemBackend(root));
5460
5465
 
5461
- // ../core/src/code-unit-order.ts
5462
- function compareCodeUnits(a, b) {
5463
- return a < b ? -1 : a > b ? 1 : 0;
5464
- }
5465
-
5466
5466
  // ../core/src/managed-document-metadata.ts
5467
5467
  var MANAGED_DOCUMENT_METADATA_FIELDS = /* @__PURE__ */ new Set([
5468
5468
  "generated",
@@ -6598,7 +6598,7 @@ function replyWithinLimit(reply) {
6598
6598
  }
6599
6599
  function skippedReply(skipped) {
6600
6600
  if (skipped.length === 0) return {};
6601
- return { skipped: [...skipped].sort((a, b) => a.id.localeCompare(b.id)).slice(0, MAX_QUERY_ROWS) };
6601
+ return { skipped: [...skipped].sort((a, b) => compareCodeUnits(a.id, b.id)).slice(0, MAX_QUERY_ROWS) };
6602
6602
  }
6603
6603
  function boundedRows(rows, params, kinds) {
6604
6604
  const requested = params.limit === 0 || params.limit === void 0 ? MAX_QUERY_ROWS : Math.min(params.limit, MAX_QUERY_ROWS);
@@ -6713,7 +6713,7 @@ var BridgeService = class {
6713
6713
  for (const id of subscription.baseline.keys()) {
6714
6714
  if (!next.has(id)) removed.push(id);
6715
6715
  }
6716
- changes.sort((a, b) => a.id.localeCompare(b.id));
6716
+ changes.sort((a, b) => compareCodeUnits(a.id, b.id));
6717
6717
  removed.sort();
6718
6718
  if (changes.length === 0 && removed.length === 0) return { status: "unchanged" };
6719
6719
  if (changes.length > MAX_CHANGE_ROWS || removed.length > MAX_CHANGE_ROWS) {
@@ -6742,7 +6742,7 @@ var BridgeService = class {
6742
6742
  throw new Error("the bundle is too large for the experimental View polling snapshot");
6743
6743
  }
6744
6744
  return new Map(
6745
- [...rows].sort((a, b) => a.id.localeCompare(b.id)).map((row) => [row.id, row.version])
6745
+ [...rows].sort((a, b) => compareCodeUnits(a.id, b.id)).map((row) => [row.id, row.version])
6746
6746
  );
6747
6747
  }
6748
6748
  /**
@@ -31351,6 +31351,11 @@ function stringifyDoc(frontmatter2, body) {
31351
31351
  return stringifyWithData(frontmatter2, body);
31352
31352
  }
31353
31353
 
31354
+ // ../core/src/code-unit-order.ts
31355
+ function compareCodeUnits(a, b) {
31356
+ return a < b ? -1 : a > b ? 1 : 0;
31357
+ }
31358
+
31354
31359
  // ../core/src/links.ts
31355
31360
  function normalizeSegments(segments) {
31356
31361
  const out = [];
@@ -31811,7 +31816,7 @@ async function scanMatching(backend, filter, onSkip) {
31811
31816
  for (const result of await readManyExisting(backend, ids, onSkip)) {
31812
31817
  if (matchesFilter(result.doc, filter)) results.push(result);
31813
31818
  }
31814
- results.sort((a, b) => a.doc.id.localeCompare(b.doc.id));
31819
+ results.sort((a, b) => compareCodeUnits(a.doc.id, b.doc.id));
31815
31820
  return results;
31816
31821
  }
31817
31822
  async function query(backend, filter = {}, options = {}) {
@@ -31820,7 +31825,7 @@ async function query(backend, filter = {}, options = {}) {
31820
31825
  async function queryHeads(backend, filter = {}, options = {}) {
31821
31826
  if (backend.queryHeads) {
31822
31827
  const rows = (await backend.queryHeads(filter, options.onSkip ? { onSkip: options.onSkip } : void 0)).filter((row) => matchesFilter(row, filter));
31823
- rows.sort((a, b) => a.id.localeCompare(b.id));
31828
+ rows.sort((a, b) => compareCodeUnits(a.id, b.id));
31824
31829
  return rows;
31825
31830
  }
31826
31831
  return (await scanMatching(backend, filter, options.onSkip)).map(({ doc, version: version2 }) => ({
@@ -31860,7 +31865,7 @@ async function queryEdges(backend, filter = {}, options = {}) {
31860
31865
  edges.push(link);
31861
31866
  }
31862
31867
  }
31863
- edges.sort((a, b) => a.from.localeCompare(b.from) || a.to.localeCompare(b.to) || a.text.localeCompare(b.text));
31868
+ edges.sort((a, b) => compareCodeUnits(a.from, b.from) || compareCodeUnits(a.to, b.to) || compareCodeUnits(a.text, b.text));
31864
31869
  return edges;
31865
31870
  }
31866
31871
 
@@ -33442,11 +33447,6 @@ async function queryEdges2(bundle, filter = {}, options = {}) {
33442
33447
  // ../core/src/bundle.ts
33443
33448
  setDefaultBackendFactory((root) => new FilesystemBackend(root));
33444
33449
 
33445
- // ../core/src/code-unit-order.ts
33446
- function compareCodeUnits(a, b) {
33447
- return a < b ? -1 : a > b ? 1 : 0;
33448
- }
33449
-
33450
33450
  // ../core/src/managed-document-metadata.ts
33451
33451
  var MANAGED_DOCUMENT_METADATA_FIELDS = /* @__PURE__ */ new Set([
33452
33452
  "generated",
@@ -43813,7 +43813,7 @@ function replyWithinLimit(reply) {
43813
43813
  }
43814
43814
  function skippedReply(skipped) {
43815
43815
  if (skipped.length === 0) return {};
43816
- return { skipped: [...skipped].sort((a, b) => a.id.localeCompare(b.id)).slice(0, MAX_QUERY_ROWS) };
43816
+ return { skipped: [...skipped].sort((a, b) => compareCodeUnits(a.id, b.id)).slice(0, MAX_QUERY_ROWS) };
43817
43817
  }
43818
43818
  function boundedRows(rows, params, kinds) {
43819
43819
  const requested = params.limit === 0 || params.limit === void 0 ? MAX_QUERY_ROWS : Math.min(params.limit, MAX_QUERY_ROWS);
@@ -43928,7 +43928,7 @@ var BridgeService = class {
43928
43928
  for (const id of subscription.baseline.keys()) {
43929
43929
  if (!next.has(id)) removed.push(id);
43930
43930
  }
43931
- changes.sort((a, b) => a.id.localeCompare(b.id));
43931
+ changes.sort((a, b) => compareCodeUnits(a.id, b.id));
43932
43932
  removed.sort();
43933
43933
  if (changes.length === 0 && removed.length === 0) return { status: "unchanged" };
43934
43934
  if (changes.length > MAX_CHANGE_ROWS || removed.length > MAX_CHANGE_ROWS) {
@@ -43957,7 +43957,7 @@ var BridgeService = class {
43957
43957
  throw new Error("the bundle is too large for the experimental View polling snapshot");
43958
43958
  }
43959
43959
  return new Map(
43960
- [...rows].sort((a, b) => a.id.localeCompare(b.id)).map((row) => [row.id, row.version])
43960
+ [...rows].sort((a, b) => compareCodeUnits(a.id, b.id)).map((row) => [row.id, row.version])
43961
43961
  );
43962
43962
  }
43963
43963
  /**
@@ -44560,22 +44560,22 @@ function buildSnapshot(first) {
44560
44560
  });
44561
44561
  relationships.push(...parseLinksFromDoc(doc).map((link) => ({ ...link })));
44562
44562
  }
44563
- documents.sort((a, b) => a.id.localeCompare(b.id));
44564
- relationships.sort((a, b) => a.from.localeCompare(b.from) || a.to.localeCompare(b.to) || a.text.localeCompare(b.text) || a.href.localeCompare(b.href));
44563
+ documents.sort((a, b) => compareCodeUnits(a.id, b.id));
44564
+ relationships.sort((a, b) => compareCodeUnits(a.from, b.from) || compareCodeUnits(a.to, b.to) || compareCodeUnits(a.text, b.text) || compareCodeUnits(a.href, b.href));
44565
44565
  const reserved = first.reserved.map((row) => ({
44566
44566
  dir: row.dir,
44567
44567
  name: row.name,
44568
44568
  version: row.version,
44569
44569
  object: addObject(objects, row.bytes, "text/markdown; charset=utf-8", "exact")
44570
44570
  }));
44571
- reserved.sort((a, b) => `${a.dir}/${a.name}`.localeCompare(`${b.dir}/${b.name}`));
44571
+ reserved.sort((a, b) => compareCodeUnits(`${a.dir}/${a.name}`, `${b.dir}/${b.name}`));
44572
44572
  const blobs = first.blobs.map((row) => ({
44573
44573
  key: row.key,
44574
44574
  version: row.version,
44575
44575
  contentType: row.contentType,
44576
44576
  object: addObject(objects, row.bytes, row.contentType, "exact")
44577
44577
  }));
44578
- blobs.sort((a, b) => a.key.localeCompare(b.key));
44578
+ blobs.sort((a, b) => compareCodeUnits(a.key, b.key));
44579
44579
  const blobsByKey = new Map(blobs.map((row) => [row.key, row]));
44580
44580
  const views = [];
44581
44581
  for (const { doc, version: version2 } of parsedDocs.values()) {
@@ -44617,7 +44617,7 @@ function buildSnapshot(first) {
44617
44617
  entryObject: blob.object
44618
44618
  });
44619
44619
  }
44620
- views.sort((a, b) => a.id.localeCompare(b.id));
44620
+ views.sort((a, b) => compareCodeUnits(a.id, b.id));
44621
44621
  const withoutDigest = {
44622
44622
  schema: PUBLICATION_SNAPSHOT_V1,
44623
44623
  schemaVersion: 1,