ipsumify 0.0.0-stage → 2.5.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.
- package/LICENSE +21 -0
- package/README.md +159 -2
- package/dist/cli.js +180 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +26 -0
- package/dist/shared-YONSI3TH.js +1649 -0
- package/package.json +40 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ipsumify
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,160 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ipsumify
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Lorem ipsum for the command line and Node: markdown-ready placeholder text with themes, seeds, and plain text, HTML, or JSON output.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx ipsumify
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
With no arguments it prints five paragraphs of classic lorem ipsum. Nothing to install, no dependencies, Node 18.3 or later.
|
|
10
|
+
|
|
11
|
+
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.
|
|
12
|
+
|
|
13
|
+
### Options
|
|
14
|
+
|
|
15
|
+
| Option | Short | What it does |
|
|
16
|
+
| ------ | ----- | ------------ |
|
|
17
|
+
| `--blocks <n>` | `-b` | Number of paragraphs, 1–20. Default 5. Also accepted as the first argument (`npx ipsumify 3`) or as `--paragraphs` / `-p` |
|
|
18
|
+
| `--theme <id>` | `-t` | `lorem` (default), `dog`, `cat`, `baked`, `bbq` |
|
|
19
|
+
| `--seed <n>` | `-s` | Whole number from 0 to 2,147,483,647. The same seed always gives the same text. Random when omitted |
|
|
20
|
+
| `--headings` | | Add markdown headings (also `--headers`) |
|
|
21
|
+
| `--code` | | Add code snippets |
|
|
22
|
+
| `--quotes` | | Add blockquotes |
|
|
23
|
+
| `--lists` | | Add bullet lists |
|
|
24
|
+
| `--links` | | Add links |
|
|
25
|
+
| `--all` | `-a` | All five markdown elements |
|
|
26
|
+
| `--md <list>` | | The same, comma-separated, as the API takes them: `--md headings,lists` |
|
|
27
|
+
| `--lower` | | Lowercase everything |
|
|
28
|
+
| `--no-linebreaks` | | Everything on one line (also `--nowrap`) |
|
|
29
|
+
| `--format <name>` | `-f` | `markdown` (default), `text`, `html`, `json` |
|
|
30
|
+
| `--themes` | | List the themes |
|
|
31
|
+
| `--help` | `-h` | Show help |
|
|
32
|
+
| `--version` | `-v` | Show the version |
|
|
33
|
+
|
|
34
|
+
Code snippets appear before every third block, blockquotes before every second, lists before the third, sixth, and so on, and links before every fourth, so a short run may not include every element you asked for.
|
|
35
|
+
|
|
36
|
+
Invalid input prints a message to stderr and exits with code 1.
|
|
37
|
+
|
|
38
|
+
### Examples
|
|
39
|
+
|
|
40
|
+
One paragraph. `--seed` makes it repeatable; leave it off for different text each run:
|
|
41
|
+
|
|
42
|
+
```console
|
|
43
|
+
$ npx ipsumify 1 --seed 42
|
|
44
|
+
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
A theme, with headings and a list:
|
|
48
|
+
|
|
49
|
+
```console
|
|
50
|
+
$ npx ipsumify 3 --theme bbq --headings --lists --seed 7
|
|
51
|
+
# Building the Perfect Fire
|
|
52
|
+
|
|
53
|
+
Brisketum planum puntum totum, pinguem capsum updownum debatum. Fumus annulus roseum halum, probatum technicum igneum. Sectum contra granum semper, humidus macer finibus ustum. Pullum femur quartum totum, pellis crispum carnem sucum. Alabama salsamentum album, acetum Carolina moppum stylum. Tractum fumatum grillum optiones, gallinaceum rectum bonum.
|
|
54
|
+
|
|
55
|
+
Fumus surgit caminus ascendit, linea formatur mane fidelis. Venditum signum timendum, mane avis obtinet carneum. Dignum omnis expectatio minutum, pitmasterus ars respectum. Fricatum siccum pasta humidum, pernoctem frigidarium marinatum requiem. Sal piper simplex Texanum, complexum Memphis mixtum secretum. Applicare generosum aequum tegmen, cortex formatur pulchre.
|
|
56
|
+
|
|
57
|
+
- Smoky goodness
|
|
58
|
+
- Fall off the bone
|
|
59
|
+
- Worth the wait
|
|
60
|
+
|
|
61
|
+
Lateribus fabae coleslavium paniscornum, caseum macaroni salatum tuberosum. Pickledus cepae jalapeñus, panisalbus butyrum sectum. Completum plateum aequilibratum prandium, carneum stella lateribus sustentum.
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
One line, lowercase — handy for seed data:
|
|
65
|
+
|
|
66
|
+
```console
|
|
67
|
+
$ npx ipsumify 1 --theme cat --no-linebreaks --lower --seed 3
|
|
68
|
+
himalayan persicum pointus fluffium, exotic shorthair teddybearum calmicus. ragamuffin largeum sweeticus docilum, selkirk rex curlycoatum sheepii patientum. laperm curlicus wavium uniqueum.
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Rendered HTML:
|
|
72
|
+
|
|
73
|
+
```console
|
|
74
|
+
$ npx ipsumify 1 --all --format html --seed 42
|
|
75
|
+
<h1>Key Concepts</h1>
|
|
76
|
+
<pre><code class="language-javascript">const example = 'code';
|
|
77
|
+
</code></pre>
|
|
78
|
+
<p><a href="https://example.com">Learn more</a> Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.</p>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Plain text, with the markdown syntax stripped:
|
|
82
|
+
|
|
83
|
+
```console
|
|
84
|
+
$ npx ipsumify 1 --all --format text --seed 42
|
|
85
|
+
Key Concepts
|
|
86
|
+
|
|
87
|
+
Learn more Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
JSON, in the same shape the API returns. `output` holds each paragraph's body text; `seed` reports the seed that was used, so a random run can be reproduced:
|
|
91
|
+
|
|
92
|
+
```console
|
|
93
|
+
$ npx ipsumify 2 --format json --seed 42
|
|
94
|
+
{
|
|
95
|
+
"theme": "lorem",
|
|
96
|
+
"blocks": 2,
|
|
97
|
+
"seed": 42,
|
|
98
|
+
"format": "json",
|
|
99
|
+
"options": {
|
|
100
|
+
"headers": false,
|
|
101
|
+
"codeSnippets": false,
|
|
102
|
+
"blockquotes": false,
|
|
103
|
+
"lists": false,
|
|
104
|
+
"links": false,
|
|
105
|
+
"capitalize": true,
|
|
106
|
+
"noWrap": false
|
|
107
|
+
},
|
|
108
|
+
"output": [
|
|
109
|
+
"Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.",
|
|
110
|
+
"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt."
|
|
111
|
+
],
|
|
112
|
+
"markdown": "Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.\n\nSed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt."
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Into a file or the clipboard:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npx ipsumify 10 --all > placeholder.md
|
|
120
|
+
npx ipsumify | pbcopy
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Use from JavaScript
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm install ipsumify
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
```js
|
|
130
|
+
import ipsumify, { paragraphs, themes } from 'ipsumify'
|
|
131
|
+
|
|
132
|
+
ipsumify() // five paragraphs, random
|
|
133
|
+
ipsumify({ blocks: 2, theme: 'dog', seed: 42 }) // repeatable
|
|
134
|
+
ipsumify({ headers: true, lists: true }) // markdown elements
|
|
135
|
+
ipsumify({ format: 'html' }) // or 'text'
|
|
136
|
+
|
|
137
|
+
paragraphs({ blocks: 3 }) // ['…', '…', '…']
|
|
138
|
+
themes // [{ id: 'lorem', label: 'Lorem Ipsum' }, …]
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
| Option | Type | Default | |
|
|
142
|
+
| ------ | ---- | ------- | - |
|
|
143
|
+
| `theme` | string | `'lorem'` | `lorem`, `dog`, `cat`, `baked`, `bbq` |
|
|
144
|
+
| `blocks` | number | `5` | 1–20 |
|
|
145
|
+
| `seed` | number | random | 0–2,147,483,647 |
|
|
146
|
+
| `headers`, `code`, `quotes`, `lists`, `links` | boolean | `false` | Markdown elements |
|
|
147
|
+
| `lowercase` | boolean | `false` | Lowercase everything |
|
|
148
|
+
| `noWrap` | boolean | `false` | Everything on one line |
|
|
149
|
+
| `format` | string | `'markdown'` | `markdown`, `text`, `html` |
|
|
150
|
+
|
|
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.
|
|
152
|
+
|
|
153
|
+
## Links
|
|
154
|
+
|
|
155
|
+
- Web app: https://ipsumify.com
|
|
156
|
+
- Source and issues: https://github.com/ICJIA/ipsumify-next-2026
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_BLOCKS,
|
|
4
|
+
DEFAULT_THEME,
|
|
5
|
+
FORMATS,
|
|
6
|
+
MAX_BLOCKS,
|
|
7
|
+
MAX_SEED,
|
|
8
|
+
MIN_BLOCKS,
|
|
9
|
+
ipsumify,
|
|
10
|
+
paragraphs,
|
|
11
|
+
randomSeed,
|
|
12
|
+
themes
|
|
13
|
+
} from "./shared-YONSI3TH.js";
|
|
14
|
+
|
|
15
|
+
// packages/ipsumify/src/run.ts
|
|
16
|
+
import { parseArgs } from "node:util";
|
|
17
|
+
var CLI_FORMATS = [...FORMATS, "json"];
|
|
18
|
+
var HELP = `ipsumify \u2014 lorem ipsum generator
|
|
19
|
+
|
|
20
|
+
Usage
|
|
21
|
+
npx ipsumify [blocks] [options]
|
|
22
|
+
|
|
23
|
+
With no arguments, prints ${DEFAULT_BLOCKS} paragraphs of lorem ipsum.
|
|
24
|
+
|
|
25
|
+
Content
|
|
26
|
+
-b, --blocks <n> Number of paragraphs, ${MIN_BLOCKS}-${MAX_BLOCKS} (default ${DEFAULT_BLOCKS}).
|
|
27
|
+
Also accepted as the first argument, or as --paragraphs.
|
|
28
|
+
-t, --theme <id> ${themes.map((t) => t.id).join(", ")} (default ${DEFAULT_THEME})
|
|
29
|
+
-s, --seed <n> Whole number, 0-${MAX_SEED}. The same seed always
|
|
30
|
+
gives the same text. Random when omitted.
|
|
31
|
+
|
|
32
|
+
Markdown elements
|
|
33
|
+
--headings Add headings (also --headers)
|
|
34
|
+
--code Add code snippets
|
|
35
|
+
--quotes Add blockquotes
|
|
36
|
+
--lists Add bullet lists
|
|
37
|
+
--links Add links
|
|
38
|
+
-a, --all All five of the above
|
|
39
|
+
--md <list> The same, comma-separated: --md headings,lists
|
|
40
|
+
|
|
41
|
+
Formatting
|
|
42
|
+
--lower Lowercase everything
|
|
43
|
+
--no-linebreaks Everything on one line (also --nowrap)
|
|
44
|
+
-f, --format <name> markdown (default), text, html, json
|
|
45
|
+
|
|
46
|
+
Other
|
|
47
|
+
--themes List the themes
|
|
48
|
+
-h, --help Show this help
|
|
49
|
+
-v, --version Show the version
|
|
50
|
+
|
|
51
|
+
Examples
|
|
52
|
+
npx ipsumify
|
|
53
|
+
npx ipsumify 2
|
|
54
|
+
npx ipsumify --theme dog --blocks 3
|
|
55
|
+
npx ipsumify --headings --lists --seed 42
|
|
56
|
+
npx ipsumify 1 --no-linebreaks --lower
|
|
57
|
+
npx ipsumify --all --format html > sample.html
|
|
58
|
+
npx ipsumify | pbcopy
|
|
59
|
+
`;
|
|
60
|
+
var MD_NAMES = {
|
|
61
|
+
headings: "headers",
|
|
62
|
+
headers: "headers",
|
|
63
|
+
code: "code",
|
|
64
|
+
quotes: "quotes",
|
|
65
|
+
lists: "lists",
|
|
66
|
+
links: "links"
|
|
67
|
+
};
|
|
68
|
+
function fail(message) {
|
|
69
|
+
return { code: 1, stdout: "", stderr: `ipsumify: ${message}
|
|
70
|
+
Run "ipsumify --help" for usage.
|
|
71
|
+
` };
|
|
72
|
+
}
|
|
73
|
+
function wholeNumber(name, value) {
|
|
74
|
+
if (!/^\d{1,10}$/.test(value)) {
|
|
75
|
+
throw new RangeError(`Invalid ${name} "${value}". Must be a whole number.`);
|
|
76
|
+
}
|
|
77
|
+
return Number(value);
|
|
78
|
+
}
|
|
79
|
+
function run(argv, version = "0.0.0") {
|
|
80
|
+
let parsed;
|
|
81
|
+
try {
|
|
82
|
+
parsed = parseArgs({
|
|
83
|
+
args: argv,
|
|
84
|
+
allowPositionals: true,
|
|
85
|
+
options: {
|
|
86
|
+
"blocks": { type: "string", short: "b" },
|
|
87
|
+
"paragraphs": { type: "string", short: "p" },
|
|
88
|
+
"theme": { type: "string", short: "t" },
|
|
89
|
+
"seed": { type: "string", short: "s" },
|
|
90
|
+
"headings": { type: "boolean" },
|
|
91
|
+
"headers": { type: "boolean" },
|
|
92
|
+
"code": { type: "boolean" },
|
|
93
|
+
"quotes": { type: "boolean" },
|
|
94
|
+
"lists": { type: "boolean" },
|
|
95
|
+
"links": { type: "boolean" },
|
|
96
|
+
"all": { type: "boolean", short: "a" },
|
|
97
|
+
"md": { type: "string" },
|
|
98
|
+
"lower": { type: "boolean" },
|
|
99
|
+
"nowrap": { type: "boolean" },
|
|
100
|
+
"no-linebreaks": { type: "boolean" },
|
|
101
|
+
"format": { type: "string", short: "f" },
|
|
102
|
+
"themes": { type: "boolean" },
|
|
103
|
+
"help": { type: "boolean", short: "h" },
|
|
104
|
+
"version": { type: "boolean", short: "v" }
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
} catch (error) {
|
|
108
|
+
return fail(error.message);
|
|
109
|
+
}
|
|
110
|
+
const { values, positionals } = parsed;
|
|
111
|
+
if (values.help) return { code: 0, stdout: HELP, stderr: "" };
|
|
112
|
+
if (values.version) return { code: 0, stdout: `${version}
|
|
113
|
+
`, stderr: "" };
|
|
114
|
+
if (values.themes) {
|
|
115
|
+
const width = Math.max(...themes.map((t) => t.id.length));
|
|
116
|
+
return { code: 0, stdout: themes.map((t) => `${t.id.padEnd(width)} ${t.label}`).join("\n") + "\n", stderr: "" };
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
if (positionals.length > 1) {
|
|
120
|
+
throw new RangeError(`Unexpected argument "${positionals[1]}".`);
|
|
121
|
+
}
|
|
122
|
+
const blocksArg = values.blocks ?? values.paragraphs ?? positionals[0];
|
|
123
|
+
const options = {
|
|
124
|
+
theme: values.theme,
|
|
125
|
+
blocks: blocksArg === void 0 ? void 0 : wholeNumber("blocks", blocksArg),
|
|
126
|
+
// Chosen here, not inside the library, so the json output can report it
|
|
127
|
+
seed: values.seed === void 0 ? randomSeed() : wholeNumber("seed", values.seed),
|
|
128
|
+
headers: values.all || values.headings || values.headers,
|
|
129
|
+
code: values.all || values.code,
|
|
130
|
+
quotes: values.all || values.quotes,
|
|
131
|
+
lists: values.all || values.lists,
|
|
132
|
+
links: values.all || values.links,
|
|
133
|
+
lowercase: values.lower,
|
|
134
|
+
noWrap: values.nowrap || values["no-linebreaks"]
|
|
135
|
+
};
|
|
136
|
+
if (values.md !== void 0) {
|
|
137
|
+
for (const name of values.md.split(",").map((part) => part.trim()).filter(Boolean)) {
|
|
138
|
+
const key = MD_NAMES[name];
|
|
139
|
+
if (!key) {
|
|
140
|
+
throw new RangeError(`Invalid --md value "${name}". Valid values: headings, code, quotes, lists, links`);
|
|
141
|
+
}
|
|
142
|
+
options[key] = true;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const format = values.format ?? "markdown";
|
|
146
|
+
if (!CLI_FORMATS.includes(format)) {
|
|
147
|
+
throw new RangeError(`Invalid format "${format}". Valid formats: ${CLI_FORMATS.join(", ")}`);
|
|
148
|
+
}
|
|
149
|
+
if (format === "json") {
|
|
150
|
+
const markdown = ipsumify(options);
|
|
151
|
+
const json = {
|
|
152
|
+
theme: options.theme ?? DEFAULT_THEME,
|
|
153
|
+
blocks: options.blocks ?? DEFAULT_BLOCKS,
|
|
154
|
+
seed: options.seed,
|
|
155
|
+
format,
|
|
156
|
+
options: {
|
|
157
|
+
headers: !!options.headers,
|
|
158
|
+
codeSnippets: !!options.code,
|
|
159
|
+
blockquotes: !!options.quotes,
|
|
160
|
+
lists: !!options.lists,
|
|
161
|
+
links: !!options.links,
|
|
162
|
+
capitalize: !options.lowercase,
|
|
163
|
+
noWrap: !!options.noWrap
|
|
164
|
+
},
|
|
165
|
+
output: paragraphs(options),
|
|
166
|
+
markdown
|
|
167
|
+
};
|
|
168
|
+
return { code: 0, stdout: JSON.stringify(json, null, 2) + "\n", stderr: "" };
|
|
169
|
+
}
|
|
170
|
+
return { code: 0, stdout: ipsumify({ ...options, format }) + "\n", stderr: "" };
|
|
171
|
+
} catch (error) {
|
|
172
|
+
return fail(error.message);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// packages/ipsumify/src/cli.ts
|
|
177
|
+
var result = run(process.argv.slice(2), "2.5.0");
|
|
178
|
+
if (result.stdout) process.stdout.write(result.stdout);
|
|
179
|
+
if (result.stderr) process.stderr.write(result.stderr);
|
|
180
|
+
process.exitCode = result.code;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type Format = 'markdown' | 'text' | 'html'
|
|
2
|
+
|
|
3
|
+
export interface IpsumifyOptions {
|
|
4
|
+
/** Theme id: lorem (default), dog, cat, baked, bbq */
|
|
5
|
+
theme?: string
|
|
6
|
+
/** Number of blocks (paragraphs), 1 to 20. Default 5 */
|
|
7
|
+
blocks?: number
|
|
8
|
+
/** Whole number from 0 to 2147483647. The same seed gives the same text. Random when omitted */
|
|
9
|
+
seed?: number
|
|
10
|
+
/** Add markdown headings */
|
|
11
|
+
headers?: boolean
|
|
12
|
+
/** Add code snippets */
|
|
13
|
+
code?: boolean
|
|
14
|
+
/** Add blockquotes */
|
|
15
|
+
quotes?: boolean
|
|
16
|
+
/** Add bullet lists */
|
|
17
|
+
lists?: boolean
|
|
18
|
+
/** Add links */
|
|
19
|
+
links?: boolean
|
|
20
|
+
/** Lowercase everything */
|
|
21
|
+
lowercase?: boolean
|
|
22
|
+
/** Put everything on one line, with no line breaks */
|
|
23
|
+
noWrap?: boolean
|
|
24
|
+
/** markdown (default), text (markdown syntax stripped), or html */
|
|
25
|
+
format?: Format
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export declare const MIN_BLOCKS: number
|
|
29
|
+
export declare const MAX_BLOCKS: number
|
|
30
|
+
export declare const DEFAULT_BLOCKS: number
|
|
31
|
+
export declare const DEFAULT_THEME: string
|
|
32
|
+
export declare const MAX_SEED: number
|
|
33
|
+
export declare const FORMATS: readonly Format[]
|
|
34
|
+
|
|
35
|
+
/** The available themes. */
|
|
36
|
+
export declare const themes: readonly { id: string, label: string }[]
|
|
37
|
+
|
|
38
|
+
/** A seed chosen at random. */
|
|
39
|
+
export declare function randomSeed(): number
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Generates placeholder text.
|
|
43
|
+
* @throws {RangeError} For an unknown theme or format, or blocks or seed out of range
|
|
44
|
+
*/
|
|
45
|
+
export declare function ipsumify(options?: IpsumifyOptions): string
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Generates the body paragraphs as an array, one string per block, without markdown elements.
|
|
49
|
+
* @throws {RangeError} For an unknown theme, or blocks or seed out of range
|
|
50
|
+
*/
|
|
51
|
+
export declare function paragraphs(options?: IpsumifyOptions): string[]
|
|
52
|
+
|
|
53
|
+
export default ipsumify
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_BLOCKS,
|
|
3
|
+
DEFAULT_THEME,
|
|
4
|
+
FORMATS,
|
|
5
|
+
MAX_BLOCKS,
|
|
6
|
+
MAX_SEED,
|
|
7
|
+
MIN_BLOCKS,
|
|
8
|
+
ipsumify,
|
|
9
|
+
paragraphs,
|
|
10
|
+
randomSeed,
|
|
11
|
+
src_default,
|
|
12
|
+
themes
|
|
13
|
+
} from "./shared-YONSI3TH.js";
|
|
14
|
+
export {
|
|
15
|
+
DEFAULT_BLOCKS,
|
|
16
|
+
DEFAULT_THEME,
|
|
17
|
+
FORMATS,
|
|
18
|
+
MAX_BLOCKS,
|
|
19
|
+
MAX_SEED,
|
|
20
|
+
MIN_BLOCKS,
|
|
21
|
+
src_default as default,
|
|
22
|
+
ipsumify,
|
|
23
|
+
paragraphs,
|
|
24
|
+
randomSeed,
|
|
25
|
+
themes
|
|
26
|
+
};
|