@sanity/runtime-cli 17.21.2-next.g5ace047 → 17.21.2-next.g6c4136d

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/README.md CHANGED
@@ -90,7 +90,7 @@ EXAMPLES
90
90
  $ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
91
91
  ```
92
92
 
93
- _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/blueprints/add.ts)_
93
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/blueprints/add.ts)_
94
94
 
95
95
  ## `sanity-run blueprints config`
96
96
 
@@ -127,7 +127,7 @@ EXAMPLES
127
127
  $ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
128
128
  ```
129
129
 
130
- _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/blueprints/config.ts)_
130
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/blueprints/config.ts)_
131
131
 
132
132
  ## `sanity-run blueprints deploy`
133
133
 
@@ -183,7 +183,7 @@ EXAMPLES
183
183
  $ sanity-run blueprints deploy --new-stack-name <new-name>
184
184
  ```
185
185
 
186
- _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/blueprints/deploy.ts)_
186
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/blueprints/deploy.ts)_
187
187
 
188
188
  ## `sanity-run blueprints destroy`
189
189
 
@@ -221,7 +221,7 @@ EXAMPLES
221
221
  $ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
222
222
  ```
223
223
 
224
- _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/blueprints/destroy.ts)_
224
+ _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/blueprints/destroy.ts)_
225
225
 
226
226
  ## `sanity-run blueprints doctor`
227
227
 
@@ -253,7 +253,7 @@ EXAMPLES
253
253
  $ sanity-run blueprints doctor --fix
254
254
  ```
255
255
 
256
- _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/blueprints/doctor.ts)_
256
+ _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/blueprints/doctor.ts)_
257
257
 
258
258
  ## `sanity-run blueprints info`
259
259
 
@@ -291,7 +291,7 @@ EXAMPLES
291
291
  $ sanity-run blueprints info --organization-id <orgId> --stack <name-or-id>
292
292
  ```
293
293
 
294
- _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/blueprints/info.ts)_
294
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/blueprints/info.ts)_
295
295
 
296
296
  ## `sanity-run blueprints init [DIR]`
297
297
 
@@ -355,7 +355,7 @@ EXAMPLES
355
355
  $ sanity-run blueprints init old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>
356
356
  ```
357
357
 
358
- _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/blueprints/init.ts)_
358
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/blueprints/init.ts)_
359
359
 
360
360
  ## `sanity-run blueprints logs`
361
361
 
@@ -401,7 +401,7 @@ EXAMPLES
401
401
  $ sanity-run blueprints logs --before 2026-05-01T00:00:00Z
402
402
  ```
403
403
 
404
- _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/blueprints/logs.ts)_
404
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/blueprints/logs.ts)_
405
405
 
406
406
  ## `sanity-run blueprints mint-deploy-token`
407
407
 
@@ -446,7 +446,7 @@ EXAMPLES
446
446
  $ sanity-run blueprints mint-deploy-token --organization-id <orgId>
447
447
  ```
448
448
 
449
- _See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/blueprints/mint-deploy-token.ts)_
449
+ _See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/blueprints/mint-deploy-token.ts)_
450
450
 
451
451
  ## `sanity-run blueprints plan`
452
452
 
@@ -479,7 +479,7 @@ EXAMPLES
479
479
  $ sanity-run blueprints plan --organization-id <orgId> --stack <name-or-id>
480
480
  ```
481
481
 
482
- _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/blueprints/plan.ts)_
482
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/blueprints/plan.ts)_
483
483
 
484
484
  ## `sanity-run blueprints promote`
485
485
 
@@ -515,7 +515,7 @@ EXAMPLES
515
515
  $ sanity-run blueprints promote --new-stack-name <new-name>
516
516
  ```
517
517
 
518
- _See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/blueprints/promote.ts)_
518
+ _See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/blueprints/promote.ts)_
519
519
 
520
520
  ## `sanity-run blueprints stacks`
521
521
 
@@ -556,7 +556,7 @@ EXAMPLES
556
556
  $ sanity-run blueprints stacks --organization-id <organizationId> --include-projects
557
557
  ```
558
558
 
559
- _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/blueprints/stacks.ts)_
559
+ _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/blueprints/stacks.ts)_
560
560
 
561
561
  ## `sanity-run functions add`
562
562
 
@@ -608,7 +608,7 @@ EXAMPLES
608
608
  $ sanity-run functions add --name my-function --type document-create --type document-update --lang js
609
609
  ```
610
610
 
611
- _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/functions/add.ts)_
611
+ _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/functions/add.ts)_
612
612
 
613
613
  ## `sanity-run functions dev`
614
614
 
@@ -643,7 +643,7 @@ EXAMPLES
643
643
  $ sanity-run functions dev --timeout 60
644
644
  ```
645
645
 
646
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/functions/dev.ts)_
646
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/functions/dev.ts)_
647
647
 
648
648
  ## `sanity-run functions env add NAME KEY VALUE`
649
649
 
@@ -676,7 +676,7 @@ EXAMPLES
676
676
  $ sanity-run functions env add --stack <name-or-id> MyFunction API_URL https://api.example.com/
677
677
  ```
678
678
 
679
- _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/functions/env/add.ts)_
679
+ _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/functions/env/add.ts)_
680
680
 
681
681
  ## `sanity-run functions env list NAME`
682
682
 
@@ -706,7 +706,7 @@ EXAMPLES
706
706
  $ sanity-run functions env list --stack <name-or-id> MyFunction
707
707
  ```
708
708
 
709
- _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/functions/env/list.ts)_
709
+ _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/functions/env/list.ts)_
710
710
 
711
711
  ## `sanity-run functions env remove NAME KEY`
712
712
 
@@ -738,7 +738,7 @@ EXAMPLES
738
738
  $ sanity-run functions env remove --stack <name-or-id> MyFunction API_URL
739
739
  ```
740
740
 
741
- _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/functions/env/remove.ts)_
741
+ _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/functions/env/remove.ts)_
742
742
 
743
743
  ## `sanity-run functions logs [NAME]`
744
744
 
@@ -778,7 +778,7 @@ EXAMPLES
778
778
  $ sanity-run functions logs <name> --delete
779
779
  ```
780
780
 
781
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/functions/logs.ts)_
781
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/functions/logs.ts)_
782
782
 
783
783
  ## `sanity-run functions test [NAME]`
784
784
 
@@ -836,7 +836,7 @@ EXAMPLES
836
836
  $ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
837
837
  ```
838
838
 
839
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g5ace047/src/commands/functions/test.ts)_
839
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.21.2-next.g6c4136d/src/commands/functions/test.ts)_
840
840
 
841
841
  ## `sanity-run help [COMMAND]`
842
842
 
@@ -64,11 +64,11 @@ class ConsolePanel extends ApiBaseElement {
64
64
 
65
65
  if (this.api.store.preserveLog) {
66
66
  // Nested output was already appended live during the run; keep it in place.
67
- this.consoleOutput.textContent = this.consoleOutput.textContent + update
67
+ this.consoleOutput.innerText = this.consoleOutput.innerText + update
68
68
  } else {
69
69
  // Re-render so the nested output is shown in call order rather than the
70
70
  // completion order it streamed in (and so it survives this overwrite).
71
- this.consoleOutput.textContent = update + this.renderNestedEntries()
71
+ this.consoleOutput.innerText = update + this.renderNestedEntries()
72
72
  }
73
73
  }
74
74
 
@@ -96,7 +96,7 @@ class ConsolePanel extends ApiBaseElement {
96
96
  const text = `↳ BEGIN: invoke('${name}')\n${body.trim()}\n↳ END: invoke('${name}')\n`
97
97
  this.nestedEntries.push({order, text})
98
98
  // Append live for immediate feedback; the final result render reorders.
99
- this.consoleOutput.textContent = this.consoleOutput.textContent + text
99
+ this.consoleOutput.innerText = this.consoleOutput.innerText + text
100
100
  }
101
101
 
102
102
  // A new invocation is starting; drop the previous run's nested output.
@@ -108,7 +108,7 @@ class ConsolePanel extends ApiBaseElement {
108
108
  const backUp = this.api.store.preserveLog
109
109
  this.api.store.result = {logs: undefined, error: undefined}
110
110
  this.nestedEntries = []
111
- this.consoleOutput.textContent = ''
111
+ this.consoleOutput.innerText = ''
112
112
  this.api.store.preserveLog = backUp
113
113
  }
114
114
 
@@ -74,18 +74,18 @@ class ResponsePanel extends ApiBaseElement {
74
74
  })
75
75
  this.api.store.response.dispatch(transaction)
76
76
 
77
- this.size.textContent = json ? prettyBytes(JSON.stringify(json).length) : ''
77
+ this.size.innerText = json ? prettyBytes(JSON.stringify(json).length) : ''
78
78
 
79
79
  if (timings && 'bundle' in timings && 'execute' in timings) {
80
80
  const bundleTime = prettyMilliseconds(timings.bundle)
81
81
  const executeTime = prettyMilliseconds(timings.execute)
82
- this.time.textContent = `${executeTime} (+${bundleTime} bundle time)`
82
+ this.time.innerText = `${executeTime} (+${bundleTime} bundle time)`
83
83
  this.time.dateTime = `PT${executeTime / 1000}S`
84
84
  } else if (timings && 'execute' in timings) {
85
- this.time.textContent = prettyMilliseconds(timings.execute)
85
+ this.time.innerText = prettyMilliseconds(timings.execute)
86
86
  this.time.dateTime = `PT${timings.execute / 1000}S`
87
87
  } else {
88
- this.time.textContent = ''
88
+ this.time.innerText = ''
89
89
  this.time.dateTime = ''
90
90
  }
91
91
  } else {
@@ -93,8 +93,8 @@ class ResponsePanel extends ApiBaseElement {
93
93
  changes: {from: 0, to: this.api.store.response.state.doc.length, insert: ''},
94
94
  })
95
95
  this.api.store.response.dispatch(transaction)
96
- this.size.textContent = ''
97
- this.time.textContent = ''
96
+ this.size.innerText = ''
97
+ this.time.innerText = ''
98
98
  this.time.removeAttribute('datetime')
99
99
  }
100
100
  }
@@ -3143,7 +3143,7 @@ function styleTags(spec) {
3143
3143
  var ruleNodeProp = new NodeProp({ combine(a, b) {
3144
3144
  let cur, root, take;
3145
3145
  while (a || b) {
3146
- if (!a || b && a.depth <= b.depth) {
3146
+ if (!a || b && a.depth >= b.depth) {
3147
3147
  take = b;
3148
3148
  b = b.next;
3149
3149
  } else {
@@ -3326,7 +3326,7 @@ and necessarily incomplete. A full ontology of syntactic
3326
3326
  constructs would fill a stack of books, and be impractical to
3327
3327
  write themes for. So try to make do with this set. If all else
3328
3328
  fails, [open an
3329
- issue](https://code.haverbeke.berlin/codemirror/dev/issues) to propose a
3329
+ issue](https://github.com/codemirror/codemirror.next) to propose a
3330
3330
  new tag, or [define](#highlight.Tag^define) a local custom tag for
3331
3331
  your use case.
3332
3332
 
@@ -6260,7 +6260,7 @@ var EditorState = class EditorState {
6260
6260
  to: range.to,
6261
6261
  insert: text
6262
6262
  },
6263
- range: EditorSelection.cursor(range.from + text.length, -1)
6263
+ range: EditorSelection.cursor(range.from + text.length)
6264
6264
  }));
6265
6265
  }
6266
6266
  /**
@@ -7301,10 +7301,7 @@ function compare(a, startA, b, startB, length, comparator) {
7301
7301
  if (!(a.point && b.point && cmpVal(a.point, b.point) && sameValues(a.activeForPoint(a.to), b.activeForPoint(b.to)))) comparator.comparePoint(pos, clipEnd, a.point, b.point);
7302
7302
  boundChange = false;
7303
7303
  } else {
7304
- if (boundChange) {
7305
- comparator.boundChange(pos);
7306
- boundChange = false;
7307
- }
7304
+ if (boundChange) comparator.boundChange(pos);
7308
7305
  if (clipEnd > pos && !sameValues(a.active, b.active)) comparator.compareRange(pos, clipEnd, a.active, b.active);
7309
7306
  if (bounds && clipEnd < endB && (dEnd || a.openEnd(end) != b.openEnd(end))) boundChange = true;
7310
7307
  }
@@ -24166,78 +24163,59 @@ var basicSetup = /*@__PURE__*/ (() => [
24166
24163
  ])
24167
24164
  ])();
24168
24165
  // node_modules/pretty-bytes/index.js
24169
- var UNIT_SETS = [
24170
- [
24171
- "B",
24172
- "kB",
24173
- "MB",
24174
- "GB",
24175
- "TB",
24176
- "PB",
24177
- "EB",
24178
- "ZB",
24179
- "YB"
24180
- ],
24181
- [
24182
- "B",
24183
- "KiB",
24184
- "MiB",
24185
- "GiB",
24186
- "TiB",
24187
- "PiB",
24188
- "EiB",
24189
- "ZiB",
24190
- "YiB"
24191
- ],
24192
- [
24193
- "b",
24194
- "kbit",
24195
- "Mbit",
24196
- "Gbit",
24197
- "Tbit",
24198
- "Pbit",
24199
- "Ebit",
24200
- "Zbit",
24201
- "Ybit"
24202
- ],
24203
- [
24204
- "b",
24205
- "kibit",
24206
- "Mibit",
24207
- "Gibit",
24208
- "Tibit",
24209
- "Pibit",
24210
- "Eibit",
24211
- "Zibit",
24212
- "Yibit"
24213
- ]
24166
+ var BYTE_UNITS = [
24167
+ "B",
24168
+ "kB",
24169
+ "MB",
24170
+ "GB",
24171
+ "TB",
24172
+ "PB",
24173
+ "EB",
24174
+ "ZB",
24175
+ "YB"
24176
+ ];
24177
+ var BIBYTE_UNITS = [
24178
+ "B",
24179
+ "KiB",
24180
+ "MiB",
24181
+ "GiB",
24182
+ "TiB",
24183
+ "PiB",
24184
+ "EiB",
24185
+ "ZiB",
24186
+ "YiB"
24187
+ ];
24188
+ var BIT_UNITS = [
24189
+ "b",
24190
+ "kbit",
24191
+ "Mbit",
24192
+ "Gbit",
24193
+ "Tbit",
24194
+ "Pbit",
24195
+ "Ebit",
24196
+ "Zbit",
24197
+ "Ybit"
24198
+ ];
24199
+ var BIBIT_UNITS = [
24200
+ "b",
24201
+ "kibit",
24202
+ "Mibit",
24203
+ "Gibit",
24204
+ "Tibit",
24205
+ "Pibit",
24206
+ "Eibit",
24207
+ "Zibit",
24208
+ "Yibit"
24214
24209
  ];
24215
- var toDecimalString = (number) => {
24216
- if (number >= 1e-6 && number < 1e21) return String(number);
24217
- const [mantissa, exponentString] = number.toExponential().split("e");
24218
- const digits = mantissa.replace(".", "");
24219
- const pointPosition = Number(exponentString) + 1;
24220
- const isPositive = pointPosition > 0;
24221
- const padded = isPositive ? digits.padEnd(pointPosition, "0") : "0".repeat(1 - pointPosition) + digits;
24222
- const integerPart = padded.slice(0, isPositive ? pointPosition : 1);
24223
- const fractionPart = padded.slice(isPositive ? pointPosition : 1).replace(/0+$/, "");
24224
- return fractionPart ? `${integerPart}.${fractionPart}` : integerPart;
24225
- };
24226
24210
  var toLocaleString = (number, locale, options) => {
24227
- if (typeof locale === "string" || Array.isArray(locale) || locale === true) {
24228
- const locales = locale === true ? void 0 : locale;
24229
- if (options !== void 0) return number.toLocaleString(locales, options);
24230
- const text = toDecimalString(number);
24231
- const pointIndex = text.indexOf(".");
24232
- const maximumFractionDigits = pointIndex === -1 ? 0 : text.length - pointIndex - 1;
24233
- if (maximumFractionDigits > 100) return text;
24234
- return number.toLocaleString(locales, { maximumFractionDigits });
24235
- }
24236
- if (options === void 0) return toDecimalString(number);
24237
- return number.toLocaleString("en-US", {
24211
+ let result = number;
24212
+ if (typeof locale === "string" || Array.isArray(locale)) result = number.toLocaleString(locale, options);
24213
+ else if (locale === true) result = number.toLocaleString(void 0, options);
24214
+ else if (options !== void 0) result = number.toLocaleString("en-US", {
24238
24215
  ...options,
24239
24216
  useGrouping: false
24240
24217
  });
24218
+ return result;
24241
24219
  };
24242
24220
  var log10 = (numberOrBigInt) => {
24243
24221
  if (typeof numberOrBigInt === "number") return Math.log10(numberOrBigInt);
@@ -24248,40 +24226,21 @@ var log = (numberOrBigInt) => {
24248
24226
  if (typeof numberOrBigInt === "number") return Math.log(numberOrBigInt);
24249
24227
  return log10(numberOrBigInt) * Math.log(10);
24250
24228
  };
24251
- var divide = (numberOrBigInt, base, exponent) => {
24252
- const divisor = base ** exponent;
24253
- if (typeof numberOrBigInt === "number" || numberOrBigInt <= Number.MAX_SAFE_INTEGER) return Number(numberOrBigInt) / divisor;
24254
- const bigintDivisor = BigInt(base) ** BigInt(exponent);
24255
- const integerPart = numberOrBigInt / bigintDivisor;
24256
- const remainder = numberOrBigInt % bigintDivisor;
24229
+ var divide = (numberOrBigInt, divisor) => {
24230
+ if (typeof numberOrBigInt === "number") return numberOrBigInt / divisor;
24231
+ const integerPart = numberOrBigInt / BigInt(divisor);
24232
+ const remainder = numberOrBigInt % BigInt(divisor);
24257
24233
  return Number(integerPart) + Number(remainder) / divisor;
24258
24234
  };
24259
- var toUnrepresentableString = (number, base, exponent, localeOptions) => {
24260
- const scale = BigInt(base) ** BigInt(exponent);
24261
- const whole = number / scale;
24262
- if (localeOptions === void 0) return whole.toString();
24263
- const minimumFractionDigits = localeOptions.minimumFractionDigits ?? 0;
24264
- const maximumFractionDigits = Math.max(localeOptions.maximumFractionDigits ?? 3, minimumFractionDigits);
24265
- const fraction = (number % scale * 10n ** BigInt(maximumFractionDigits) / scale).toString().padStart(maximumFractionDigits, "0").replace(/0+$/, "").padEnd(minimumFractionDigits, "0");
24266
- return fraction ? `${whole}.${fraction}` : whole.toString();
24267
- };
24268
- var signOf = (number, signed) => {
24269
- if (number < 0) return "-";
24270
- if (!signed) return "";
24271
- return number === 0 || number === 0n ? " " : "+";
24272
- };
24273
- var assertFixedWidth = (fixedWidth) => {
24274
- if (fixedWidth !== void 0 && (typeof fixedWidth !== "number" || !Number.isSafeInteger(fixedWidth) || fixedWidth < 0)) throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof fixedWidth}: ${fixedWidth}`);
24275
- };
24276
- var assertFractionDigits = (name, value) => {
24277
- if (value !== void 0 && (typeof value !== "number" || !Number.isInteger(value) || value < 0 || value > 100)) throw new TypeError(`Expected ${name} to be an integer between 0 and 100, got ${typeof value}: ${value}`);
24235
+ var applyFixedWidth = (result, fixedWidth) => {
24236
+ if (fixedWidth === void 0) return result;
24237
+ if (typeof fixedWidth !== "number" || !Number.isSafeInteger(fixedWidth) || fixedWidth < 0) throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof fixedWidth}: ${fixedWidth}`);
24238
+ if (fixedWidth === 0) return result;
24239
+ return result.length < fixedWidth ? result.padStart(fixedWidth, " ") : result;
24278
24240
  };
24279
24241
  var buildLocaleOptions = (options) => {
24280
24242
  const { minimumFractionDigits, maximumFractionDigits } = options;
24281
24243
  if (minimumFractionDigits === void 0 && maximumFractionDigits === void 0) return;
24282
- assertFractionDigits("minimumFractionDigits", minimumFractionDigits);
24283
- assertFractionDigits("maximumFractionDigits", maximumFractionDigits);
24284
- if (minimumFractionDigits > maximumFractionDigits) throw new RangeError(`Expected minimumFractionDigits (${minimumFractionDigits}) to not be greater than maximumFractionDigits (${maximumFractionDigits})`);
24285
24244
  return {
24286
24245
  ...minimumFractionDigits !== void 0 && { minimumFractionDigits },
24287
24246
  ...maximumFractionDigits !== void 0 && { maximumFractionDigits },
@@ -24297,35 +24256,27 @@ function prettyBytes(number, options) {
24297
24256
  nonBreakingSpace: false,
24298
24257
  ...options
24299
24258
  };
24300
- assertFixedWidth(options.fixedWidth);
24301
- const localeOptions = buildLocaleOptions(options);
24302
- const UNITS = UNIT_SETS[(options.bits ? 2 : 0) + (options.binary ? 1 : 0)];
24259
+ const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
24303
24260
  const separator = options.space ? options.nonBreakingSpace ? "\xA0" : " " : "";
24304
- if (Object.is(number, -0)) number = 0;
24305
- const prefix = signOf(number, options.signed);
24306
- if (number < 0) number = -number;
24261
+ const isZero = typeof number === "number" ? number === 0 : number === 0n;
24262
+ if (options.signed && isZero) return applyFixedWidth(` 0${separator}${UNITS[0]}`, options.fixedWidth);
24263
+ const isNegative = number < 0;
24264
+ const prefix = isNegative ? "-" : options.signed ? "+" : "";
24265
+ if (isNegative) number = -number;
24266
+ const localeOptions = buildLocaleOptions(options);
24307
24267
  const base = options.binary ? 1024 : 1e3;
24308
24268
  let exponent = 0;
24309
24269
  if (number >= 1) exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(base) : log10(number) / 3), UNITS.length - 1);
24310
- const scaled = divide(number, base, exponent);
24311
- let numberString;
24312
- if (Number.isFinite(scaled)) {
24313
- number = scaled;
24314
- if (number < 1 && exponent > 0) {
24315
- number *= base;
24316
- exponent -= 1;
24317
- }
24318
- if (!localeOptions) {
24319
- const minimumPrecision = Math.max(3, Math.floor(number).toString().length);
24320
- number = Number(number.toPrecision(minimumPrecision));
24321
- if (number >= base && exponent < UNITS.length - 1) {
24322
- number /= base;
24323
- exponent += 1;
24324
- }
24325
- }
24326
- numberString = toLocaleString(number, options.locale, localeOptions);
24327
- } else numberString = toUnrepresentableString(number, base, exponent, localeOptions);
24328
- return (prefix + numberString + separator + UNITS[exponent]).padStart(options.fixedWidth ?? 0);
24270
+ number = divide(number, base ** exponent);
24271
+ if (!localeOptions) {
24272
+ const minimumPrecision = Math.max(3, Math.floor(number).toString().length);
24273
+ number = Number(number.toPrecision(minimumPrecision));
24274
+ if (number >= base && exponent < UNITS.length - 1) {
24275
+ number /= base;
24276
+ exponent += 1;
24277
+ }
24278
+ }
24279
+ return applyFixedWidth(prefix + toLocaleString(number, options.locale, localeOptions) + separator + UNITS[exponent], options.fixedWidth);
24329
24280
  }
24330
24281
  // node_modules/parse-ms/index.js
24331
24282
  var toZeroIfInfinity = (value) => Number.isFinite(value) ? value : 0;