@islamihab/kds 0.1.2 → 0.1.3

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 (2) hide show
  1. package/index.js +22 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -14421,7 +14421,9 @@ var printHelp = (help) => {
14421
14421
  console.log(`${help.description}
14422
14422
  `);
14423
14423
  console.log(`Usage: ${help.path}${usageCommands}${usageOptions}${usagePositionals}`);
14424
- const printSection = (title, entries, width) => {
14424
+ const labels = [commands, positionals, options].flatMap((entries) => entries ?? []);
14425
+ const width = Math.max(...labels.map(({ label }) => label.length));
14426
+ const printSection = (title, entries) => {
14425
14427
  if (!entries?.length)
14426
14428
  return;
14427
14429
  console.log(`
@@ -14429,9 +14431,9 @@ ${title}:`);
14429
14431
  for (const entry of entries)
14430
14432
  console.log(` ${entry.label.padEnd(width)} ${entry.description}`);
14431
14433
  };
14432
- printSection("Commands", commands, 12);
14433
- printSection("Arguments", positionals, 28);
14434
- printSection("Options", options, 28);
14434
+ printSection("Commands", commands);
14435
+ printSection("Arguments", positionals);
14436
+ printSection("Options", options);
14435
14437
  };
14436
14438
  var baseType = (field) => {
14437
14439
  let t = field;
@@ -14585,7 +14587,7 @@ import { join } from "path";
14585
14587
  // package.json
14586
14588
  var package_default = {
14587
14589
  name: "cli",
14588
- version: "0.1.2",
14590
+ version: "0.1.3",
14589
14591
  private: true,
14590
14592
  type: "module",
14591
14593
  bin: {
@@ -15111,6 +15113,7 @@ var components = componentsGeneric();
15111
15113
  var KDS_DEVICE_AUTH_CLIENT_ID = "kds-cli";
15112
15114
  var PAGE_MODES = ["themed", "raw"];
15113
15115
  var PAGE_VISIBILITIES = ["public", "private"];
15116
+ var MAX_PAGE_HTML_BYTES = 4000000;
15114
15117
 
15115
15118
  // src/commands/auth/login.ts
15116
15119
  import open from "open";
@@ -17771,7 +17774,20 @@ var detectRepoGroup = async () => {
17771
17774
  var groupForCreate = async (group2) => group2 === null ? undefined : group2 ?? await detectRepoGroup();
17772
17775
 
17773
17776
  // src/lib/input.ts
17774
- var readBody = async (path) => path === "-" ? await Bun.stdin.text() : await Bun.file(path).text();
17777
+ var assertSize = (size) => {
17778
+ if (size > MAX_PAGE_HTML_BYTES)
17779
+ throw new Error(`Page is too large (${size} bytes; max ${MAX_PAGE_HTML_BYTES}).`);
17780
+ };
17781
+ var readBody = async (path) => {
17782
+ if (path === "-") {
17783
+ const html = await Bun.stdin.text();
17784
+ assertSize(new TextEncoder().encode(html).length);
17785
+ return html;
17786
+ }
17787
+ const file2 = Bun.file(path);
17788
+ assertSize(file2.size);
17789
+ return await file2.text();
17790
+ };
17775
17791
  var readPageId = (value) => {
17776
17792
  const trimmed = value.trim();
17777
17793
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@islamihab/kds",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Command-line client for Kai Dev Studio",
5
5
  "license": "MIT",
6
6
  "publishConfig": {