ipsumify 2.5.0 → 2.7.1

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
@@ -6,6 +6,8 @@ Lorem ipsum for the command line and Node: markdown-ready placeholder text with
6
6
  npx ipsumify
7
7
  ```
8
8
 
9
+ ![Terminal output of npx ipsumify with a theme, headings, and a list](https://raw.githubusercontent.com/ICJIA/ipsumify-next-2026/main/documentation/screenshot-cli.png)
10
+
9
11
  With no arguments it prints five paragraphs of classic lorem ipsum. Nothing to install, no dependencies, Node 18.3 or later.
10
12
 
11
13
  It uses the same engine as [ipsumify.com](https://ipsumify.com) and its API: the same theme, block count, seed, and options give the same text in all three.
@@ -14,7 +16,7 @@ It uses the same engine as [ipsumify.com](https://ipsumify.com) and its API: the
14
16
 
15
17
  | Option | Short | What it does |
16
18
  | ------ | ----- | ------------ |
17
- | `--blocks <n>` | `-b` | Number of paragraphs, 1–20. Default 5. Also accepted as the first argument (`npx ipsumify 3`) or as `--paragraphs` / `-p` |
19
+ | `--blocks <n>` | `-b` | Number of paragraphs, 1–20. Default 5. Also accepted as the first argument (`npx ipsumify 3`) or as `--paragraphs` / `-p`; give it one way only |
18
20
  | `--theme <id>` | `-t` | `lorem` (default), `dog`, `cat`, `baked`, `bbq` |
19
21
  | `--seed <n>` | `-s` | Whole number from 0 to 2,147,483,647. The same seed always gives the same text. Random when omitted |
20
22
  | `--headings` | | Add markdown headings (also `--headers`) |
@@ -148,7 +150,7 @@ themes // [{ id: 'lorem', label: 'L
148
150
  | `noWrap` | boolean | `false` | Everything on one line |
149
151
  | `format` | string | `'markdown'` | `markdown`, `text`, `html` |
150
152
 
151
- An unknown theme or format, or a `blocks` or `seed` out of range, throws a `RangeError`. The package is ESM only and ships its own TypeScript types.
153
+ An unknown theme or format, or a `blocks` or `seed` out of range, throws a `RangeError`. Options that are not an object, or a switch that is not `true` or `false`, throw a `TypeError`. `paragraphs()` ignores `format`. The package is ESM only and ships its own TypeScript types.
152
154
 
153
155
  ## Links
154
156
 
package/dist/cli.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  paragraphs,
11
11
  randomSeed,
12
12
  themes
13
- } from "./shared-YONSI3TH.js";
13
+ } from "./shared-B3DMJ5UC.js";
14
14
 
15
15
  // packages/ipsumify/src/run.ts
16
16
  import { parseArgs } from "node:util";
@@ -57,14 +57,14 @@ Examples
57
57
  npx ipsumify --all --format html > sample.html
58
58
  npx ipsumify | pbcopy
59
59
  `;
60
- var MD_NAMES = {
61
- headings: "headers",
62
- headers: "headers",
63
- code: "code",
64
- quotes: "quotes",
65
- lists: "lists",
66
- links: "links"
67
- };
60
+ var MD_NAMES = /* @__PURE__ */ new Map([
61
+ ["headings", "headers"],
62
+ ["headers", "headers"],
63
+ ["code", "code"],
64
+ ["quotes", "quotes"],
65
+ ["lists", "lists"],
66
+ ["links", "links"]
67
+ ]);
68
68
  function fail(message) {
69
69
  return { code: 1, stdout: "", stderr: `ipsumify: ${message}
70
70
  Run "ipsumify --help" for usage.
@@ -119,7 +119,11 @@ function run(argv, version = "0.0.0") {
119
119
  if (positionals.length > 1) {
120
120
  throw new RangeError(`Unexpected argument "${positionals[1]}".`);
121
121
  }
122
- const blocksArg = values.blocks ?? values.paragraphs ?? positionals[0];
122
+ const blockCounts = [values.blocks, values.paragraphs, positionals[0]].filter((value) => value !== void 0);
123
+ if (blockCounts.length > 1) {
124
+ throw new RangeError("The number of blocks is given more than once. Use one of: a first argument, --blocks, --paragraphs.");
125
+ }
126
+ const blocksArg = blockCounts[0];
123
127
  const options = {
124
128
  theme: values.theme,
125
129
  blocks: blocksArg === void 0 ? void 0 : wholeNumber("blocks", blocksArg),
@@ -135,7 +139,7 @@ function run(argv, version = "0.0.0") {
135
139
  };
136
140
  if (values.md !== void 0) {
137
141
  for (const name of values.md.split(",").map((part) => part.trim()).filter(Boolean)) {
138
- const key = MD_NAMES[name];
142
+ const key = MD_NAMES.get(name);
139
143
  if (!key) {
140
144
  throw new RangeError(`Invalid --md value "${name}". Valid values: headings, code, quotes, lists, links`);
141
145
  }
@@ -174,7 +178,7 @@ function run(argv, version = "0.0.0") {
174
178
  }
175
179
 
176
180
  // packages/ipsumify/src/cli.ts
177
- var result = run(process.argv.slice(2), "2.5.0");
181
+ var result = run(process.argv.slice(2), "2.7.1");
178
182
  if (result.stdout) process.stdout.write(result.stdout);
179
183
  if (result.stderr) process.stderr.write(result.stderr);
180
184
  process.exitCode = result.code;
package/dist/index.d.ts CHANGED
@@ -41,12 +41,15 @@ export declare function randomSeed(): number
41
41
  /**
42
42
  * Generates placeholder text.
43
43
  * @throws {RangeError} For an unknown theme or format, or blocks or seed out of range
44
+ * @throws {TypeError} If options is not an object, or a switch is not a boolean
44
45
  */
45
46
  export declare function ipsumify(options?: IpsumifyOptions): string
46
47
 
47
48
  /**
48
49
  * Generates the body paragraphs as an array, one string per block, without markdown elements.
50
+ * `format` is ignored.
49
51
  * @throws {RangeError} For an unknown theme, or blocks or seed out of range
52
+ * @throws {TypeError} If options is not an object, or a switch is not a boolean
50
53
  */
51
54
  export declare function paragraphs(options?: IpsumifyOptions): string[]
52
55
 
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  randomSeed,
11
11
  src_default,
12
12
  themes
13
- } from "./shared-YONSI3TH.js";
13
+ } from "./shared-B3DMJ5UC.js";
14
14
  export {
15
15
  DEFAULT_BLOCKS,
16
16
  DEFAULT_THEME,