utilful 3.2.0 → 3.3.0

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.
@@ -69,7 +69,7 @@ function createCliHarness(command, { entry, ...runOptions } = {}) {
69
69
  return new Promise((resolve, reject) => {
70
70
  execFile(process.execPath, [entry, ...argv], {
71
71
  cwd: options.cwd,
72
- maxBuffer: 64 * 1024 * 1024
72
+ maxBuffer: 67108864
73
73
  }, (spawnError, stdout, stderr) => {
74
74
  if (spawnError && typeof spawnError.code !== "number") reject(spawnError);
75
75
  else resolve({
@@ -4,7 +4,7 @@ import process from "node:process";
4
4
  //#region src/cli/usage.ts
5
5
  function renderUsage(command, { parent, stream = process.stdout } = {}) {
6
6
  const color = (style, text) => paint(style, text, stream);
7
- const heading = (title) => color(["bold", "underline"], title);
7
+ const heading = (title) => color("bold", title);
8
8
  const meta = command.meta ?? {};
9
9
  const parentMeta = parent?.meta ?? {};
10
10
  const commandName = [parentMeta.name, meta.name].filter((name) => name !== void 0).join(" ");
@@ -29,7 +29,7 @@ function renderUsage(command, { parent, stream = process.stdout } = {}) {
29
29
  }
30
30
  const spellings = [definition.alias === void 0 ? void 0 : `-${definition.alias}`, `--${name}`].filter((spelling) => spelling !== void 0).join(", ");
31
31
  const value = definition.type === "string" ? `<${definition.valueHint ?? name}>` : void 0;
32
- optionLines.push([color("cyan", value === void 0 ? spellings : `${spellings}=${value}`), hints]);
32
+ optionLines.push([color("cyan", spellings) + (value === void 0 ? "" : color("dim", `=${value}`)), hints]);
33
33
  if (definition.type === "boolean" && definition.default === true) optionLines.push([color("cyan", `--no-${name}`), ""]);
34
34
  if (isRequired) usageLine.push(`--${name}=${value}`);
35
35
  }
@@ -37,9 +37,10 @@ function renderUsage(command, { parent, stream = process.stdout } = {}) {
37
37
  const hasArguments = positionalLines.length > 0 || optionLines.length > 0;
38
38
  if (commandLines.length > 0 && !hasArguments) usageLine.push(Object.keys(command.subCommands).join("|"));
39
39
  const lines = [
40
- color("gray", `${meta.description ?? ""} (${commandName}${version === void 0 ? "" : ` v${version}`})`),
40
+ color("bold", version === void 0 ? commandName : `${commandName} v${version}`),
41
+ ...meta.description === void 0 ? [] : [meta.description],
41
42
  "",
42
- `${heading("USAGE")} ${color("cyan", [
43
+ `${heading("USAGE")} ${color("cyan", [
43
44
  commandName,
44
45
  hasArguments ? "[OPTIONS]" : void 0,
45
46
  ...usageLine
package/dist/csv.mjs CHANGED
@@ -154,15 +154,16 @@ var CSVParserCore = class {
154
154
  const character = text[i];
155
155
  const nextCharacter = i + 1 < text.length ? text[i + 1] : "";
156
156
  if (this.isFieldQuoted && !this.inQuotes && character !== this.delimiter && (character === SPACE || character === TAB)) continue;
157
- if (character === DOUBLE_QUOTE) if (this.currentField.length === 0 && !this.inQuotes) {
158
- this.inQuotes = true;
159
- this.isFieldQuoted = true;
160
- } else if (this.inQuotes && nextCharacter === DOUBLE_QUOTE) {
161
- this.currentField += DOUBLE_QUOTE;
162
- i++;
163
- } else if (this.inQuotes) this.inQuotes = false;
164
- else this.currentField += character;
165
- else if (character === this.delimiter && !this.inQuotes) this.appendField();
157
+ if (character === DOUBLE_QUOTE) {
158
+ if (this.currentField.length === 0 && !this.inQuotes) {
159
+ this.inQuotes = true;
160
+ this.isFieldQuoted = true;
161
+ } else if (this.inQuotes && nextCharacter === DOUBLE_QUOTE) {
162
+ this.currentField += DOUBLE_QUOTE;
163
+ i++;
164
+ } else if (this.inQuotes) this.inQuotes = false;
165
+ else this.currentField += character;
166
+ } else if (character === this.delimiter && !this.inQuotes) this.appendField();
166
167
  else if ((character === NEWLINE || character === CARRIAGE_RETURN) && !this.inQuotes) {
167
168
  if (character === CARRIAGE_RETURN && nextCharacter === NEWLINE) i++;
168
169
  this.appendRow();
package/dist/emitter.mjs CHANGED
@@ -28,8 +28,10 @@ function createEmitter(events) {
28
28
  */
29
29
  off(type, handler) {
30
30
  const handlers = events.get(type);
31
- if (handlers) if (handler) handlers.splice(handlers.indexOf(handler) >>> 0, 1);
32
- else events.set(type, []);
31
+ if (handlers) {
32
+ if (handler) handlers.splice(handlers.indexOf(handler) >>> 0, 1);
33
+ else events.set(type, []);
34
+ }
33
35
  },
34
36
  /**
35
37
  * Invokes all handlers for the given type.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "utilful",
3
3
  "type": "module",
4
- "version": "3.2.0",
5
- "packageManager": "pnpm@11.15.1",
4
+ "version": "3.3.0",
5
+ "packageManager": "pnpm@11.25.0",
6
6
  "description": "A collection of TypeScript utilities",
7
7
  "author": "Johann Schopplich <hello@johannschopplich.com>",
8
8
  "license": "MIT",
@@ -104,13 +104,13 @@
104
104
  }
105
105
  },
106
106
  "devDependencies": {
107
- "@antfu/eslint-config": "^9.1.0",
108
- "@types/node": "^26.1.1",
109
- "bumpp": "^12.0.0",
110
- "eslint": "^10.7.0",
107
+ "@antfu/eslint-config": "^9.5.0",
108
+ "@types/node": "^26.4.1",
109
+ "bumpp": "^12.2.2",
110
+ "eslint": "^10.9.1",
111
111
  "eslint-flat-config-utils": "^3.2.0",
112
- "tsdown": "^0.22.13",
112
+ "tsdown": "^0.22.14",
113
113
  "typescript": "^6.0.3",
114
- "vitest": "^4.1.10"
114
+ "vitest": "^4.1.11"
115
115
  }
116
116
  }