@unified-latex/unified-latex-cli 1.3.1 → 1.4.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.
Files changed (3) hide show
  1. package/package.json +9 -9
  2. package/index.cjs +0 -837
  3. package/index.cjs.map +0 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unified-latex/unified-latex-cli",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "Command line interface to common unified-latex options",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -8,15 +8,15 @@
8
8
  "unified-latex": "./unified-latex-cli.mjs"
9
9
  },
10
10
  "dependencies": {
11
- "@unified-latex/unified-latex-lint": "^1.3.1",
12
- "@unified-latex/unified-latex-to-hast": "^1.3.1",
11
+ "@unified-latex/unified-latex-lint": "^1.4.0",
12
+ "@unified-latex/unified-latex-to-hast": "^1.4.0",
13
13
  "@unified-latex/unified-latex-types": "^1.3.1",
14
- "@unified-latex/unified-latex-util-arguments": "^1.3.1",
15
- "@unified-latex/unified-latex-util-macros": "^1.3.1",
16
- "@unified-latex/unified-latex-util-packages": "^1.3.1",
17
- "@unified-latex/unified-latex-util-parse": "^1.3.1",
18
- "@unified-latex/unified-latex-util-print-raw": "^1.3.1",
19
- "@unified-latex/unified-latex-util-to-string": "^1.3.1",
14
+ "@unified-latex/unified-latex-util-arguments": "^1.4.0",
15
+ "@unified-latex/unified-latex-util-macros": "^1.4.0",
16
+ "@unified-latex/unified-latex-util-packages": "^1.4.0",
17
+ "@unified-latex/unified-latex-util-parse": "^1.4.0",
18
+ "@unified-latex/unified-latex-util-print-raw": "^1.4.0",
19
+ "@unified-latex/unified-latex-util-to-string": "^1.4.0",
20
20
  "camelcase": "^7.0.1",
21
21
  "chalk": "^5.2.0",
22
22
  "chokidar": "^3.5.3",
package/index.cjs DELETED
@@ -1,837 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
-
25
- // libs/unified-latex.ts
26
- var import_unified = require("unified");
27
- var import_unified_latex_util_parse = require("@unified-latex/unified-latex-util-parse");
28
- var import_unified_latex_util_to_string = require("@unified-latex/unified-latex-util-to-string");
29
- var processLatexViaUnified = (options2) => {
30
- return (0, import_unified.unified)().use(
31
- import_unified_latex_util_parse.unifiedLatexFromString,
32
- Object.assign({ environments: {}, macros: {} }, options2)
33
- ).use(
34
- import_unified_latex_util_to_string.unifiedLatexStringCompiler,
35
- Object.assign({ pretty: true, forceNewlineEnding: true }, options2)
36
- );
37
- };
38
-
39
- // libs/unified-args/index.ts
40
- var import_node_process = __toESM(require("node:process"), 1);
41
- var import_node_stream = __toESM(require("node:stream"), 1);
42
- var import_chalk = __toESM(require("chalk"), 1);
43
- var import_chokidar = __toESM(require("chokidar"), 1);
44
- var import_unified_engine = require("unified-engine");
45
- var import_unified_latex_to_hast = require("@unified-latex/unified-latex-to-hast");
46
-
47
- // libs/unified-args/options.ts
48
- var import_text_table = __toESM(require("text-table"), 1);
49
- var import_camelcase = __toESM(require("camelcase"), 1);
50
- var import_minimist = __toESM(require("minimist"), 1);
51
- var import_json52 = __toESM(require("json5"), 1);
52
- var import_fault = require("fault");
53
-
54
- // libs/lints/index.ts
55
- var import_unified_latex_lint = require("@unified-latex/unified-latex-lint");
56
- var availableLints = Object.fromEntries(
57
- Object.values(import_unified_latex_lint.lints).map((lint) => [
58
- lint.name.replace(/^unified-latex-lint:/, ""),
59
- lint
60
- ])
61
- );
62
-
63
- // libs/unified-args/schema.ts
64
- var schema = [
65
- {
66
- long: "help",
67
- description: "Output usage information",
68
- short: "h",
69
- type: "boolean",
70
- default: false
71
- },
72
- {
73
- long: "version",
74
- description: "Output version number",
75
- short: "v",
76
- type: "boolean",
77
- default: false
78
- },
79
- {
80
- long: "output",
81
- description: "Specify output location",
82
- short: "o",
83
- value: "[path]"
84
- },
85
- {
86
- long: "rc-path",
87
- description: "Specify configuration file",
88
- short: "r",
89
- type: "string",
90
- value: "<path>"
91
- },
92
- {
93
- long: "ignore-path",
94
- description: "Specify ignore file",
95
- short: "i",
96
- type: "string",
97
- value: "<path>"
98
- },
99
- {
100
- long: "ext",
101
- description: "Specify extensions",
102
- type: "string",
103
- value: "<extensions>"
104
- },
105
- {
106
- long: "lint",
107
- description: `Lint rules to apply. Use multiple times to specify multiple lints. Available rules: ${Object.keys(
108
- availableLints
109
- ).join(", ")}`,
110
- short: "l",
111
- type: "string",
112
- value: "<rule>"
113
- },
114
- {
115
- long: "lint-all",
116
- description: `Apply all available lint rules`,
117
- type: "boolean",
118
- default: false
119
- },
120
- {
121
- long: "fix-all",
122
- description: "Apply fixes for all applied lints",
123
- type: "boolean",
124
- default: false
125
- },
126
- {
127
- long: "watch",
128
- description: "Watch for changes and reprocess",
129
- short: "w",
130
- type: "boolean",
131
- default: false
132
- },
133
- {
134
- long: "macro",
135
- description: "Attach arguments of the specified macro (by default, unrecognized macros are parsed as having no arguments). Accepts a string of the form `\\newcommand{<name>}[<num args>]{<body>}` or a JSON string `{name: <name>, signature: <xparse argument signature>, body: <macro body>}`",
136
- short: "m",
137
- type: "string",
138
- value: "<rule>"
139
- },
140
- {
141
- long: "expand-macro",
142
- description: "Expand the specified macro. Accepts a string of the form `\\newcommand{<name>}[<num args>]{<body>}` or a JSON string `{name: <name>, signature: <xparse argument signature>, body: <macro body>}`",
143
- short: "e",
144
- type: "string",
145
- value: "<rule>"
146
- },
147
- {
148
- long: "expand-document-macro",
149
- description: "Expand the specified macro which is defined in the document. You can use --stats to list all macros defined in the document.",
150
- short: "d",
151
- type: "string",
152
- value: "<name>"
153
- },
154
- {
155
- long: "frail",
156
- description: "Exit with 1 on warnings",
157
- type: "boolean",
158
- default: false
159
- },
160
- {
161
- long: "tree",
162
- description: "Specify input and output as syntax tree",
163
- type: "boolean",
164
- default: false
165
- },
166
- {
167
- long: "report",
168
- description: "Specify reporter",
169
- type: "string",
170
- value: "<reporter>"
171
- },
172
- {
173
- long: "file-path",
174
- description: "Specify path to process as",
175
- type: "string",
176
- value: "<path>"
177
- },
178
- {
179
- long: "ignore-path-resolve-from",
180
- description: "Resolve patterns in `ignore-path` from its directory or cwd",
181
- type: "string",
182
- value: "dir|cwd",
183
- default: "dir"
184
- },
185
- {
186
- long: "ignore-pattern",
187
- description: "Specify ignore patterns",
188
- type: "string",
189
- value: "<globs>"
190
- },
191
- {
192
- long: "silently-ignore",
193
- description: "Do not fail when given ignored files",
194
- type: "boolean"
195
- },
196
- {
197
- long: "tree-in",
198
- description: "Specify input as syntax tree",
199
- type: "boolean"
200
- },
201
- {
202
- long: "tree-out",
203
- description: "Output syntax tree",
204
- type: "boolean"
205
- },
206
- {
207
- long: "inspect",
208
- description: "Output formatted syntax tree",
209
- type: "boolean"
210
- },
211
- {
212
- long: "stats",
213
- description: "Show information about the processed file",
214
- type: "boolean",
215
- default: false
216
- },
217
- {
218
- long: "stats-json",
219
- description: "Show information about the processed file and output the information as JSON",
220
- type: "boolean",
221
- default: false
222
- },
223
- {
224
- long: "html",
225
- description: "Convert the output to HTML. Note, for math to render properly, you will need to add a library like MathJax or KaTeX to your HTMl source; you should also expand/replace any macros not recognized by the converter",
226
- type: "boolean",
227
- default: false
228
- },
229
- {
230
- long: "stdout",
231
- description: "[Don't] write the processed file's contents to stdout",
232
- type: "boolean",
233
- truelike: true
234
- },
235
- {
236
- long: "color",
237
- description: "Specify color in report",
238
- type: "boolean",
239
- default: true
240
- },
241
- {
242
- long: "config",
243
- description: "Search for configuration files",
244
- type: "boolean",
245
- default: true
246
- },
247
- {
248
- long: "ignore",
249
- description: "Search for ignore files",
250
- type: "boolean",
251
- default: true
252
- }
253
- ];
254
-
255
- // libs/macros/parse-macro-expansion.ts
256
- var import_json5 = __toESM(require("json5"), 1);
257
- var import_unified_latex_util_macros = require("@unified-latex/unified-latex-util-macros");
258
- var import_unified_latex_util_parse2 = require("@unified-latex/unified-latex-util-parse");
259
- function parseMacroExpansion(def) {
260
- if (def.startsWith("\\")) {
261
- const macro = (0, import_unified_latex_util_parse2.parse)(def).content[0];
262
- const name = (0, import_unified_latex_util_macros.newcommandMacroToName)(macro);
263
- if (!name) {
264
- throw new Error(
265
- `Could extract macro definition from "${def}"; expected the macro to be defined via \\newcommand or similar syntax`
266
- );
267
- }
268
- const signature = (0, import_unified_latex_util_macros.newcommandMacroToSpec)(macro);
269
- const body = (0, import_unified_latex_util_macros.newcommandMacroToSubstitutionAst)(macro);
270
- return { name, signature, body };
271
- }
272
- const parsedSpec = import_json5.default.parse(def);
273
- if (parsedSpec.name == null || parsedSpec.body == null) {
274
- throw new Error(
275
- `Expected a "name" field and a "body" field to be defined on ${def}`
276
- );
277
- }
278
- parsedSpec.signature = parsedSpec.signature || "";
279
- return {
280
- name: parsedSpec.name,
281
- signature: parsedSpec.signature,
282
- body: (0, import_unified_latex_util_parse2.parse)(parsedSpec.body).content
283
- };
284
- }
285
-
286
- // libs/unified-args/options.ts
287
- var own = {}.hasOwnProperty;
288
- var minischema = {
289
- unknown: handleUnknownArgument,
290
- default: {},
291
- alias: {},
292
- string: [],
293
- boolean: []
294
- };
295
- var index = -1;
296
- while (++index < schema.length) {
297
- addEach(schema[index]);
298
- }
299
- function options(flags, configuration) {
300
- const extension = configuration.extensions[0];
301
- const name = configuration.name;
302
- const config = toCamelCase((0, import_minimist.default)(flags, minischema));
303
- let index2 = -1;
304
- while (++index2 < schema.length) {
305
- const option = schema[index2];
306
- if (option.type === "string" && config[option.long] === "") {
307
- throw (0, import_fault.fault)("Missing value:%s", inspect(option).join(" "));
308
- }
309
- }
310
- const ext = commaSeparated(config.ext);
311
- const report = reporter(config.report);
312
- const help = [
313
- inspectAll(schema),
314
- "",
315
- "Examples:",
316
- "",
317
- " # Process `input." + extension + "`",
318
- " $ " + name + " input." + extension + " -o output." + extension,
319
- "",
320
- " # Pipe",
321
- " $ " + name + " < input." + extension + " > output." + extension,
322
- "",
323
- " # Rewrite all applicable files",
324
- " $ " + name + " . -o",
325
- "",
326
- " # Lint files and display the lint output (but not the processed file)",
327
- " $ " + name + " . --lint-all --no-stdout"
328
- ].join("\n");
329
- const settings = parseSettings(config.setting);
330
- if (config.html && config.statsJson) {
331
- throw new Error(
332
- "Both --html and --stats-json were specified; only one may be used at a time."
333
- );
334
- }
335
- return {
336
- helpMessage: help,
337
- cwd: configuration.cwd,
338
- processor: configuration.processor,
339
- help: config.help,
340
- version: config.version,
341
- // XXX I have no idea why `minimist` is not assigning unknown arguments to "_"
342
- // but it appears unknown arguments are being assigned to "" instead...
343
- files: config._ || config[""],
344
- filePath: config.filePath,
345
- watch: config.watch,
346
- extensions: ext.length === 0 ? configuration.extensions : ext,
347
- output: config.output,
348
- out: config.stdout,
349
- tree: config.tree,
350
- treeIn: config.treeIn,
351
- treeOut: config.treeOut,
352
- inspect: config.inspect,
353
- rcName: configuration.rcName,
354
- packageField: configuration.packageField,
355
- rcPath: config.rcPath,
356
- detectConfig: config.config,
357
- settings,
358
- ignoreName: configuration.ignoreName,
359
- ignorePath: config.ignorePath,
360
- ignorePathResolveFrom: config.ignorePathResolveFrom,
361
- ignorePatterns: commaSeparated(config.ignorePattern),
362
- silentlyIgnore: config.silentlyIgnore,
363
- detectIgnore: config.ignore,
364
- pluginPrefix: configuration.pluginPrefix,
365
- plugins: [],
366
- lints: normalizeLints(config.lint, config),
367
- reporter: report[0],
368
- reporterOptions: report[1],
369
- color: config.color,
370
- silent: config.silent,
371
- quiet: config.quiet,
372
- frail: config.frail,
373
- stats: config.stats,
374
- statsJson: config.statsJson,
375
- expandMacro: normalizeToArray(config.expandMacro).map(
376
- parseMacroExpansion
377
- ),
378
- expandDocumentMacro: normalizeToArray(
379
- config.expandDocumentMacro
380
- ),
381
- macro: normalizeToArray(config.macro).map(
382
- parseMacroExpansion
383
- ),
384
- html: config.html
385
- };
386
- }
387
- function addEach(option) {
388
- const value = option.default;
389
- minischema.default[option.long] = value === void 0 ? null : value;
390
- if (option.type && option.type in minischema) {
391
- minischema[option.type].push(option.long);
392
- }
393
- if (option.short) {
394
- minischema.alias[option.short] = option.long;
395
- }
396
- }
397
- function commaSeparated(value) {
398
- return normalizeToArray(value).flatMap((d) => splitOnComma(d));
399
- }
400
- function normalizeLints(value, config) {
401
- const normalized = normalizeToArray(value).map(splitOnEquals);
402
- validateLintNames(normalized);
403
- if (config.lintAll) {
404
- normalized.push(...Object.keys(availableLints).map((v) => [v]));
405
- }
406
- const result = Object.fromEntries(
407
- normalized.map((value2) => {
408
- let params = value2[1] ? parseConfig(value2[1], {}) : void 0;
409
- if (config.fixAll) {
410
- if (params) {
411
- Object.assign(params, { fix: true });
412
- } else {
413
- params = { fix: true };
414
- }
415
- }
416
- return [value2[0], params];
417
- })
418
- );
419
- return result;
420
- }
421
- function reporter(value) {
422
- const all = normalizeToArray(value).map(splitOnEquals).map((value2) => [
423
- value2[0],
424
- value2[1] ? parseConfig(value2[1], {}) : void 0
425
- ]);
426
- return all[all.length - 1] || [];
427
- }
428
- function parseSettings(value) {
429
- const normalized = normalizeToArray(value);
430
- const cache = {};
431
- for (const value2 of normalized) {
432
- parseConfig(value2, cache);
433
- }
434
- return cache;
435
- }
436
- function parseConfig(value, cache) {
437
- let flags;
438
- let flag;
439
- try {
440
- flags = toCamelCase(parseJSON(value));
441
- } catch (error) {
442
- const exception = error;
443
- throw (0, import_fault.fault)(
444
- "Cannot parse `%s` as JSON: %s",
445
- value,
446
- // Fix position
447
- exception.message.replace(/at(?= position)/, "around")
448
- );
449
- }
450
- for (flag in flags) {
451
- if (own.call(flags, flag)) {
452
- cache[flag] = flags[flag];
453
- }
454
- }
455
- return cache;
456
- }
457
- function validateLintNames(lints2) {
458
- for (const lint of lints2) {
459
- const name = lint[0];
460
- if (!availableLints[name]) {
461
- const known = Object.keys(availableLints);
462
- throw (0, import_fault.fault)(
463
- "Unknown lint rule `%s`, available rules are:\n%s",
464
- name,
465
- " " + known.join("\n ")
466
- );
467
- }
468
- }
469
- return true;
470
- }
471
- function handleUnknownArgument(flag) {
472
- if (flag.charAt(0) === "-") {
473
- if (flag.charAt(1) === "-") {
474
- throw (0, import_fault.fault)(
475
- "Unknown option `%s`, expected:\n%s",
476
- flag,
477
- inspectAll(schema)
478
- );
479
- }
480
- const found = flag.slice(1).split("");
481
- const known = schema.filter((d) => d.short);
482
- const knownKeys = new Set(known.map((d) => d.short));
483
- let index2 = -1;
484
- while (++index2 < found.length) {
485
- const key = found[index2];
486
- if (!knownKeys.has(key)) {
487
- throw (0, import_fault.fault)(
488
- "Unknown short option `-%s`, expected:\n%s",
489
- key,
490
- inspectAll(known)
491
- );
492
- }
493
- }
494
- }
495
- return true;
496
- }
497
- function inspectAll(options2) {
498
- return (0, import_text_table.default)(options2.map((d) => inspect(d)));
499
- }
500
- function inspect(option) {
501
- let description = option.description;
502
- let long = option.long;
503
- if (option.default === true || option.truelike) {
504
- description += " (on by default)";
505
- long = "[no-]" + long;
506
- }
507
- return [
508
- "",
509
- option.short ? "-" + option.short : "",
510
- "--" + long + (option.value ? " " + option.value : ""),
511
- description
512
- ];
513
- }
514
- function normalizeToArray(value) {
515
- if (!value) {
516
- return [];
517
- }
518
- if (typeof value === "string") {
519
- return [value];
520
- }
521
- return value;
522
- }
523
- function splitOnEquals(value) {
524
- return value.split("=");
525
- }
526
- function splitOnComma(value) {
527
- return value.split(",");
528
- }
529
- function toCamelCase(object) {
530
- const result = {};
531
- let key;
532
- for (key in object) {
533
- if (own.call(object, key)) {
534
- let value = object[key];
535
- if (value && typeof value === "object" && !Array.isArray(value)) {
536
- value = toCamelCase(value);
537
- }
538
- result[(0, import_camelcase.default)(key)] = value;
539
- }
540
- }
541
- return result;
542
- }
543
- function parseJSON(value) {
544
- return import_json52.default.parse("{" + value + "}");
545
- }
546
-
547
- // libs/stats/index.ts
548
- var import_unified_latex_util_packages = require("@unified-latex/unified-latex-util-packages");
549
- var import_unified_latex_util_macros2 = require("@unified-latex/unified-latex-util-macros");
550
- var import_unified_latex_util_print_raw = require("@unified-latex/unified-latex-util-print-raw");
551
-
552
- // libs/stats/enclosing-position.ts
553
- function enclosingPosition(nodes) {
554
- var _a, _b, _c, _d;
555
- let start = { line: 1, column: 1, offset: 0 };
556
- let end = { line: 1, column: 1, offset: 0 };
557
- for (const node of nodes) {
558
- if (Number((_a = node.position) == null ? void 0 : _a.start.offset) < Number(start.offset)) {
559
- start = (_b = node.position) == null ? void 0 : _b.start;
560
- }
561
- if (Number((_c = node.position) == null ? void 0 : _c.end.offset) > Number(end.offset)) {
562
- end = (_d = node.position) == null ? void 0 : _d.end;
563
- }
564
- }
565
- return { start, end };
566
- }
567
-
568
- // libs/stats/index.ts
569
- var statsPlugin = function() {
570
- return (tree, file) => {
571
- const packages = (0, import_unified_latex_util_packages.listPackages)(tree);
572
- const packageNames = packages.map((s) => (0, import_unified_latex_util_print_raw.printRaw)(s));
573
- if (packages.length > 0) {
574
- file.info(
575
- `Found ${packages.length} imported packages: ${packageNames.join(", ")}`
576
- );
577
- }
578
- const newcommands = (0, import_unified_latex_util_macros2.listNewcommands)(tree);
579
- if (newcommands.length > 0) {
580
- file.info(
581
- `Found ${newcommands.length} defined commands: ${newcommands.map((c) => `\\${c.name}`).join(", ")}`,
582
- enclosingPosition(newcommands.map((c) => c.definition))
583
- );
584
- }
585
- };
586
- };
587
- var statsJsonPlugin = function() {
588
- this.Compiler = (tree, file) => {
589
- file.extname = ".json";
590
- file.basename += "-stats";
591
- const packages = (0, import_unified_latex_util_packages.listPackages)(tree).map((s) => (0, import_unified_latex_util_print_raw.printRaw)(s));
592
- const newcommands = (0, import_unified_latex_util_macros2.listNewcommands)(tree).map((c) => ({
593
- name: c.name,
594
- signature: c.signature,
595
- body: (0, import_unified_latex_util_print_raw.printRaw)(c.body),
596
- definition: (0, import_unified_latex_util_print_raw.printRaw)(c.definition)
597
- }));
598
- return JSON.stringify({ packages, newcommands }, null, 4) + "\n";
599
- };
600
- };
601
-
602
- // libs/macros/expand-macros-plugin.ts
603
- var import_unified_latex_util_macros3 = require("@unified-latex/unified-latex-util-macros");
604
- var import_unified_latex_util_arguments = require("@unified-latex/unified-latex-util-arguments");
605
- var expandMacrosPlugin = function(options2) {
606
- const { macros = [] } = options2 || {};
607
- const macroInfo = Object.fromEntries(
608
- macros.map((m) => [m.name, { signature: m.signature }])
609
- );
610
- return (tree) => {
611
- (0, import_unified_latex_util_arguments.attachMacroArgs)(tree, macroInfo);
612
- (0, import_unified_latex_util_macros3.expandMacros)(tree, macros);
613
- };
614
- };
615
-
616
- // libs/macros/attach-macro-args-plugin.ts
617
- var import_unified_latex_util_arguments2 = require("@unified-latex/unified-latex-util-arguments");
618
- var attachMacroArgsPlugin = function(options2) {
619
- const { macros = [] } = options2 || {};
620
- const macroInfo = Object.fromEntries(
621
- macros.map((m) => [m.name, { signature: m.signature }])
622
- );
623
- return (tree) => {
624
- (0, import_unified_latex_util_arguments2.attachMacroArgs)(tree, macroInfo);
625
- };
626
- };
627
-
628
- // libs/html/format.ts
629
- var import_rehype_stringify = __toESM(require("rehype-stringify"), 1);
630
- var import_prettier = __toESM(require("prettier"), 1);
631
- var import_unified2 = require("unified");
632
- var prettyPrintHtmlPlugin = function() {
633
- const processor = (0, import_unified2.unified)().use(import_rehype_stringify.default);
634
- this.Compiler = (tree, file) => {
635
- file.extname = ".html";
636
- const html = processor.stringify(tree, file);
637
- try {
638
- return import_prettier.default.format(html, { parser: "html", useTabs: true });
639
- } catch {
640
- }
641
- return html;
642
- };
643
- };
644
-
645
- // libs/macros/expand-document-macros-plugin.ts
646
- var import_unified_latex_util_macros4 = require("@unified-latex/unified-latex-util-macros");
647
- var import_unified_latex_util_arguments3 = require("@unified-latex/unified-latex-util-arguments");
648
- var expandDocumentMacrosPlugin = function(options2) {
649
- const { macros = [] } = options2 || {};
650
- const macrosSet = new Set(macros);
651
- return (tree) => {
652
- const newcommands = (0, import_unified_latex_util_macros4.listNewcommands)(tree);
653
- const macros2 = newcommands.filter((s) => macrosSet.has(s.name));
654
- const macroInfo = Object.fromEntries(
655
- macros2.map((m) => [m.name, { signature: m.signature }])
656
- );
657
- (0, import_unified_latex_util_arguments3.attachMacroArgs)(tree, macroInfo);
658
- (0, import_unified_latex_util_macros4.expandMacrosExcludingDefinitions)(tree, macros2);
659
- };
660
- };
661
-
662
- // libs/unified-args/index.ts
663
- var ttyStream = Object.assign(new import_node_stream.default.Readable(), { isTTY: true });
664
- var exitStatus = 0;
665
- import_node_process.default.on("exit", onexit);
666
- import_node_process.default.on("uncaughtException", fail);
667
- function unifiedArgs(cliConfig) {
668
- let config;
669
- let watcher;
670
- let output;
671
- try {
672
- config = options(import_node_process.default.argv.slice(2), cliConfig);
673
- } catch (error) {
674
- const exception = error;
675
- return fail(exception, true);
676
- }
677
- const processorOptions = { macros: {}, environments: {} };
678
- const originalProcessor = config.processor;
679
- config.processor = () => originalProcessor(processorOptions);
680
- if (config.help) {
681
- import_node_process.default.stdout.write(
682
- [
683
- "Usage: " + cliConfig.name + " [options] [path | glob ...]",
684
- "",
685
- " " + cliConfig.description,
686
- "",
687
- "Options:",
688
- "",
689
- config.helpMessage,
690
- ""
691
- ].join("\n"),
692
- noop
693
- );
694
- return;
695
- }
696
- if (config.version) {
697
- import_node_process.default.stdout.write(cliConfig.version + "\n", noop);
698
- return;
699
- }
700
- if (config.watch) {
701
- output = config.output;
702
- config.streamIn = ttyStream;
703
- config.out = false;
704
- import_node_process.default.stderr.write(
705
- import_chalk.default.bold("Watching...") + " (press CTRL+C to exit)\n",
706
- noop
707
- );
708
- if (output === true) {
709
- config.output = false;
710
- import_node_process.default.stderr.write(
711
- import_chalk.default.yellow("Note") + ": Ignoring `--output` until exit.\n",
712
- noop
713
- );
714
- }
715
- }
716
- if (config.lints) {
717
- for (const [lintName, lintArgs] of Object.entries(config.lints)) {
718
- const lint = availableLints[lintName];
719
- if (!lint) {
720
- throw new Error(
721
- `Could not find lint named "${lintName}"; available lints are ${Object.keys(
722
- availableLints
723
- ).join(", ")}`
724
- );
725
- }
726
- config.plugins.push([lint, lintArgs]);
727
- }
728
- }
729
- if (config.stats) {
730
- config.plugins.push([statsPlugin]);
731
- }
732
- if (config.macro.length > 0) {
733
- config.plugins.push([attachMacroArgsPlugin, { macros: config.macro }]);
734
- }
735
- if (config.expandMacro.length > 0) {
736
- processorOptions.macros = Object.assign(
737
- processorOptions.macros || {},
738
- Object.fromEntries(
739
- config.expandMacro.map((m) => [
740
- m.name,
741
- { signature: m.signature }
742
- ])
743
- )
744
- );
745
- config.plugins.push([
746
- expandMacrosPlugin,
747
- { macros: config.expandMacro }
748
- ]);
749
- }
750
- if (config.expandDocumentMacro.length > 0) {
751
- config.plugins.push([
752
- expandDocumentMacrosPlugin,
753
- { macros: config.expandDocumentMacro }
754
- ]);
755
- }
756
- if (config.statsJson) {
757
- config.plugins.push([statsJsonPlugin]);
758
- }
759
- if (config.html) {
760
- config.plugins.push([import_unified_latex_to_hast.unifiedLatexToHast]);
761
- config.plugins.push([prettyPrintHtmlPlugin]);
762
- }
763
- const done = function done2(error, code, context) {
764
- if (error) {
765
- clean();
766
- fail(error);
767
- } else {
768
- exitStatus = code || 0;
769
- if (config.watch && !watcher && context) {
770
- subscribe(context);
771
- }
772
- }
773
- };
774
- function clean() {
775
- if (watcher) {
776
- watcher.close();
777
- watcher = void 0;
778
- }
779
- }
780
- function subscribe(context) {
781
- var _a;
782
- watcher = import_chokidar.default.watch(((_a = context.fileSet) == null ? void 0 : _a.origins) || [], {
783
- cwd: config.cwd != null ? "" + config.cwd : config.cwd,
784
- ignoreInitial: true
785
- }).on("error", done).on("change", (filePath) => {
786
- config.files = [filePath];
787
- (0, import_unified_engine.engine)(config, done);
788
- });
789
- import_node_process.default.on("SIGINT", onsigint);
790
- function onsigint() {
791
- import_node_process.default.stderr.write("\n", noop);
792
- clean();
793
- if (output === true) {
794
- config.output = output;
795
- config.watch = false;
796
- (0, import_unified_engine.engine)(config, done);
797
- }
798
- }
799
- }
800
- (0, import_unified_engine.engine)(config, done);
801
- }
802
- function fail(error, pretty) {
803
- const message = String((pretty ? error : error.stack) || error);
804
- exitStatus = 1;
805
- import_node_process.default.stderr.write(message.trim() + "\n", noop);
806
- }
807
- function onexit() {
808
- import_node_process.default.exit(exitStatus);
809
- }
810
- function noop() {
811
- }
812
-
813
- // index.ts
814
- var import_node_fs = __toESM(require("node:fs"), 1);
815
- var import_meta = {};
816
- var version = "unknown (could not read version from package.json)";
817
- try {
818
- const packageJson = JSON.parse(
819
- import_node_fs.default.readFileSync(new URL("./package.json", import_meta.url), {
820
- encoding: "utf8"
821
- })
822
- );
823
- version = packageJson.version;
824
- } catch {
825
- }
826
- unifiedArgs({
827
- processor: processLatexViaUnified,
828
- name: "unified-latex",
829
- description: "LaTeX processor powered by unified-latex",
830
- version,
831
- extensions: ["tex"],
832
- ignoreName: ".unifiedlatexignore",
833
- packageField: "unifiedLatexConfig",
834
- rcName: ".unifiedlatexrc",
835
- pluginPrefix: "@unified-latex/"
836
- });
837
- //# sourceMappingURL=index.cjs.map
package/index.cjs.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../libs/unified-latex.ts", "../libs/unified-args/index.ts", "../libs/unified-args/options.ts", "../libs/lints/index.ts", "../libs/unified-args/schema.ts", "../libs/macros/parse-macro-expansion.ts", "../libs/stats/index.ts", "../libs/stats/enclosing-position.ts", "../libs/macros/expand-macros-plugin.ts", "../libs/macros/attach-macro-args-plugin.ts", "../libs/html/format.ts", "../libs/macros/expand-document-macros-plugin.ts", "../index.ts"],
4
- "sourcesContent": ["import { unified } from \"unified\";\nimport * as Ast from \"@unified-latex/unified-latex-types\";\nimport {\n unifiedLatexAstComplier,\n unifiedLatexFromString,\n} from \"@unified-latex/unified-latex-util-parse\";\nimport {\n unifiedLatexStringCompiler,\n PluginOptions as StringCompilerPluginOptions,\n} from \"@unified-latex/unified-latex-util-to-string\";\n/**\n * Use `unified()` to a string to an `Ast.Ast` and then pretty-print it.\n */\nexport const processLatexViaUnified = (\n options?: StringCompilerPluginOptions\n) => {\n return unified()\n .use(\n unifiedLatexFromString,\n Object.assign({ environments: {}, macros: {} }, options)\n )\n .use(\n unifiedLatexStringCompiler,\n Object.assign({ pretty: true, forceNewlineEnding: true }, options)\n );\n};\n\n/**\n * Use `unified()` to a string to an `Ast.Ast` and then return it. This function\n * will not print/pretty-print the `Ast.Ast` back to a string.\n */\nexport const processLatexToAstViaUnified = () => {\n return unified().use(unifiedLatexFromString).use(unifiedLatexAstComplier);\n};\n", "// Modified from unified-args https://github.com/unifiedjs/unified-args/blob/main/lib/index.js\n// MIT License\n\nimport process from \"node:process\";\nimport stream from \"node:stream\";\nimport chalk from \"chalk\";\nimport chokidar, { FSWatcher } from \"chokidar\";\nimport {\n engine,\n Callback as EngineCallback,\n Context as EngineContext,\n} from \"unified-engine\";\nimport { unifiedLatexToHast } from \"@unified-latex/unified-latex-to-hast\";\nimport { options, Options } from \"./options\";\nimport { availableLints } from \"../lints\";\nimport { statsJsonPlugin, statsPlugin } from \"../stats\";\nimport { expandMacrosPlugin } from \"../macros/expand-macros-plugin\";\nimport { attachMacroArgsPlugin } from \"../macros/attach-macro-args-plugin\";\nimport { prettyPrintHtmlPlugin } from \"../html/format\";\nimport { expandDocumentMacrosPlugin } from \"../macros/expand-document-macros-plugin\";\nimport { PluginOptions } from \"@unified-latex/unified-latex-util-parse\";\n\n// Fake TTY stream.\nconst ttyStream = Object.assign(new stream.Readable(), { isTTY: true });\n\n// Exit, lazily, with the correct exit status code.\nlet exitStatus = 0;\n\nprocess.on(\"exit\", onexit);\n\n// Handle uncaught errors, such as from unexpected async behavior.\nprocess.on(\"uncaughtException\", fail);\n\n/**\n * Start the CLI.\n *\n * @param {Options} cliConfig\n */\nexport function unifiedArgs(cliConfig: Options) {\n let config: ReturnType<typeof options>;\n let watcher: FSWatcher | undefined;\n let output: boolean | string | undefined;\n\n try {\n config = options(process.argv.slice(2), cliConfig);\n } catch (error) {\n const exception = error as Error;\n return fail(exception, true);\n }\n\n // We want to pass extra options to the processor. Because of that,\n // we remove it and replace it with one that passes in options.\n const processorOptions: PluginOptions = { macros: {}, environments: {} };\n const originalProcessor = config.processor as any;\n config.processor = () => originalProcessor(processorOptions);\n\n if (config.help) {\n process.stdout.write(\n [\n \"Usage: \" + cliConfig.name + \" [options] [path | glob ...]\",\n \"\",\n \" \" + cliConfig.description,\n \"\",\n \"Options:\",\n \"\",\n config.helpMessage,\n \"\",\n ].join(\"\\n\"),\n noop\n );\n\n return;\n }\n\n if (config.version) {\n process.stdout.write(cliConfig.version + \"\\n\", noop);\n\n return;\n }\n\n // Modify `config` for watching.\n if (config.watch) {\n output = config.output;\n\n // Do not read from stdin(4).\n config.streamIn = ttyStream;\n\n // Do not write to stdout(4).\n config.out = false;\n\n process.stderr.write(\n chalk.bold(\"Watching...\") + \" (press CTRL+C to exit)\\n\",\n noop\n );\n\n // Prevent infinite loop if set to regeneration.\n if (output === true) {\n config.output = false;\n\n process.stderr.write(\n chalk.yellow(\"Note\") + \": Ignoring `--output` until exit.\\n\",\n noop\n );\n }\n }\n\n if (config.lints) {\n for (const [lintName, lintArgs] of Object.entries(config.lints)) {\n const lint = availableLints[lintName];\n if (!lint) {\n throw new Error(\n `Could not find lint named \"${lintName}\"; available lints are ${Object.keys(\n availableLints\n ).join(\", \")}`\n );\n }\n config.plugins.push([lint, lintArgs]);\n }\n }\n\n if (config.stats) {\n config.plugins.push([statsPlugin]);\n }\n\n if (config.macro.length > 0) {\n config.plugins.push([attachMacroArgsPlugin, { macros: config.macro }]);\n }\n\n if (config.expandMacro.length > 0) {\n // We want to add parsing of these macros directly into the processor.\n // That way, if there is a name-clash with a builtin macro, the command-line\n // specified macro will take precedence.\n processorOptions.macros = Object.assign(\n processorOptions.macros || {},\n Object.fromEntries(\n config.expandMacro.map((m) => [\n m.name,\n { signature: m.signature },\n ])\n )\n );\n config.plugins.push([\n expandMacrosPlugin,\n { macros: config.expandMacro },\n ]);\n }\n\n if (config.expandDocumentMacro.length > 0) {\n config.plugins.push([\n expandDocumentMacrosPlugin,\n { macros: config.expandDocumentMacro },\n ]);\n }\n\n if (config.statsJson) {\n config.plugins.push([statsJsonPlugin]);\n }\n\n if (config.html) {\n config.plugins.push([unifiedLatexToHast]);\n config.plugins.push([prettyPrintHtmlPlugin]);\n }\n\n /**\n * Handle complete run.\n *\n * @type {EngineCallback}\n */\n const done: EngineCallback = function done(error, code, context) {\n if (error) {\n clean();\n fail(error);\n } else {\n exitStatus = code || 0;\n\n if (config.watch && !watcher && context) {\n subscribe(context);\n }\n }\n };\n\n // Clean the watcher.\n function clean() {\n if (watcher) {\n watcher.close();\n watcher = undefined;\n }\n }\n\n /**\n * Subscribe a chokidar watcher to all processed files.\n */\n function subscribe(context: EngineContext) {\n watcher = chokidar\n .watch(context.fileSet?.origins || [], {\n cwd: config.cwd != null ? \"\" + config.cwd : config.cwd,\n ignoreInitial: true,\n })\n .on(\"error\", done)\n .on(\"change\", (filePath) => {\n config.files = [filePath];\n engine(config, done);\n });\n\n process.on(\"SIGINT\", onsigint);\n\n /**\n * Handle a SIGINT.\n */\n function onsigint() {\n // Hide the `^C` in terminal.\n process.stderr.write(\"\\n\", noop);\n\n clean();\n\n // Do another process if `output` specified regeneration.\n if (output === true) {\n config.output = output;\n config.watch = false;\n engine(config, done);\n }\n }\n }\n\n // Initial run.\n engine(config, done);\n}\n\n/**\n * Print an error, optionally with stack.\n *\n * @param {Error} error\n * @param {boolean} [pretty=false]\n */\nfunction fail(error: Error, pretty?: boolean) {\n const message = String((pretty ? error : error.stack) || error);\n\n exitStatus = 1;\n\n process.stderr.write(message.trim() + \"\\n\", noop);\n}\n\nfunction onexit() {\n process.exit(exitStatus);\n}\n\nfunction noop() {}\n", "// Modified from unified-args https://github.com/unifiedjs/unified-args/blob/main/lib/index.js\n// MIT License\n\nimport table from \"text-table\";\nimport camelcase from \"camelcase\";\nimport minimist from \"minimist\";\nimport json5 from \"json5\";\nimport { fault } from \"fault\";\nimport { schema } from \"./schema\";\nimport type { Options as EngineOptions } from \"unified-engine\";\nimport type { Option } from \"./schema\";\nimport { PluggableList } from \"unified\";\nimport { availableLints } from \"../lints\";\nimport * as Ast from \"@unified-latex/unified-latex-types\";\nimport { parseMacroExpansion } from \"../macros/parse-macro-expansion\";\n\ntype RequiredEngineOptions = Required<\n Pick<\n EngineOptions,\n | \"extensions\"\n | \"ignoreName\"\n | \"packageField\"\n | \"pluginPrefix\"\n | \"processor\"\n | \"rcName\"\n >\n>;\n\ntype ArgsOptionsFields = {\n /**\n * Name of executable\n */\n name: string;\n /**\n * description of executable\n */\n description: string;\n /**\n * Version (semver) of executable\n */\n version: string;\n};\n\nexport type Options = RequiredEngineOptions &\n Pick<EngineOptions, \"cwd\"> &\n ArgsOptionsFields;\n\nconst own = {}.hasOwnProperty;\n\n/**\n * Schema for `minimist`.\n */\nconst minischema = {\n unknown: handleUnknownArgument,\n default: {} as Record<string, string | boolean | null>,\n alias: {} as Record<string, string>,\n string: [] as string[],\n boolean: [] as string[],\n};\n\nlet index = -1;\nwhile (++index < schema.length) {\n addEach(schema[index]);\n}\n\n/**\n * Parse CLI options.\n */\nexport function options(flags: string[], configuration: Options) {\n const extension = configuration.extensions[0];\n const name = configuration.name;\n const config = toCamelCase(minimist(flags, minischema));\n let index = -1;\n\n while (++index < schema.length) {\n const option = schema[index];\n if (option.type === \"string\" && config[option.long] === \"\") {\n throw fault(\"Missing value:%s\", inspect(option).join(\" \"));\n }\n }\n\n const ext = commaSeparated(config.ext as string | string[]);\n const report = reporter(config.report as string | string[]);\n const help = [\n inspectAll(schema),\n \"\",\n \"Examples:\",\n \"\",\n \" # Process `input.\" + extension + \"`\",\n \" $ \" + name + \" input.\" + extension + \" -o output.\" + extension,\n \"\",\n \" # Pipe\",\n \" $ \" + name + \" < input.\" + extension + \" > output.\" + extension,\n \"\",\n \" # Rewrite all applicable files\",\n \" $ \" + name + \" . -o\",\n \"\",\n \" # Lint files and display the lint output (but not the processed file)\",\n \" $ \" + name + \" . --lint-all --no-stdout\",\n ].join(\"\\n\");\n\n const settings = parseSettings(config.setting as string);\n\n if (config.html && config.statsJson) {\n throw new Error(\n \"Both --html and --stats-json were specified; only one may be used at a time.\"\n );\n }\n\n return {\n helpMessage: help,\n cwd: configuration.cwd,\n processor: configuration.processor,\n help: config.help,\n version: config.version,\n // XXX I have no idea why `minimist` is not assigning unknown arguments to \"_\"\n // but it appears unknown arguments are being assigned to \"\" instead...\n files: config._ || config[\"\"],\n filePath: config.filePath,\n watch: config.watch,\n extensions: ext.length === 0 ? configuration.extensions : ext,\n output: config.output,\n out: config.stdout,\n tree: config.tree,\n treeIn: config.treeIn,\n treeOut: config.treeOut,\n inspect: config.inspect,\n rcName: configuration.rcName,\n packageField: configuration.packageField,\n rcPath: config.rcPath,\n detectConfig: config.config,\n settings,\n ignoreName: configuration.ignoreName,\n ignorePath: config.ignorePath,\n ignorePathResolveFrom: config.ignorePathResolveFrom,\n ignorePatterns: commaSeparated(config.ignorePattern as string),\n silentlyIgnore: config.silentlyIgnore,\n detectIgnore: config.ignore,\n pluginPrefix: configuration.pluginPrefix,\n plugins: [],\n lints: normalizeLints(config.lint as string | string[], config),\n reporter: report[0],\n reporterOptions: report[1],\n color: config.color,\n silent: config.silent,\n quiet: config.quiet,\n frail: config.frail,\n stats: config.stats,\n statsJson: config.statsJson,\n expandMacro: normalizeToArray(config.expandMacro as string).map(\n parseMacroExpansion\n ),\n expandDocumentMacro: normalizeToArray(\n config.expandDocumentMacro as string\n ),\n macro: normalizeToArray(config.macro as string).map(\n parseMacroExpansion\n ),\n html: config.html,\n } as EngineOptions & {\n help: boolean;\n helpMessage: string;\n watch: boolean;\n version: boolean;\n lints: Record<string, Record<string, unknown> | undefined>;\n plugins: PluggableList;\n stats: boolean;\n statsJson: boolean;\n expandMacro: { name: string; signature: string; body: Ast.Node[] }[];\n expandDocumentMacro: string[];\n macro: { name: string; signature: string }[];\n html: boolean;\n };\n}\n\nfunction addEach(option: Option) {\n const value = option.default;\n\n minischema.default[option.long] = value === undefined ? null : value;\n\n if (option.type && option.type in minischema) {\n minischema[option.type].push(option.long);\n }\n\n if (option.short) {\n minischema.alias[option.short] = option.long;\n }\n}\n\n/**\n * Parse `extensions`.\n */\nfunction commaSeparated(value: string[] | string | null | undefined): string[] {\n return normalizeToArray(value).flatMap((d) => splitOnComma(d));\n}\n\n/**\n * Parse `plugins`.\n */\nfunction plugins(value: string[] | string | null | undefined) {\n const normalized = normalizeToArray(value).map(splitOnEquals);\n let index = -1;\n const result: Record<string, Record<string, unknown> | undefined> = {};\n\n while (++index < normalized.length) {\n const value = normalized[index];\n result[value[0]] = value[1] ? parseConfig(value[1], {}) : undefined;\n }\n\n return result;\n}\n\n/**\n * Normalize the specified lints\n */\nfunction normalizeLints(\n value: string[] | string | null | undefined,\n config: Record<\"lintAll\" | \"fixAll\", unknown>\n) {\n const normalized = normalizeToArray(value).map(splitOnEquals);\n validateLintNames(normalized);\n if (config.lintAll) {\n normalized.push(...Object.keys(availableLints).map((v) => [v]));\n }\n\n const result: Record<string, Record<string, unknown> | undefined> =\n Object.fromEntries(\n normalized.map((value) => {\n let params = value[1] ? parseConfig(value[1], {}) : undefined;\n if (config.fixAll) {\n if (params) {\n Object.assign(params, { fix: true });\n } else {\n params = { fix: true };\n }\n }\n return [value[0], params];\n })\n );\n\n return result;\n}\n\n/**\n * Parse `reporter`: only one is accepted.\n */\nfunction reporter(value: string[] | string | null | undefined) {\n const all = normalizeToArray(value)\n .map(splitOnEquals)\n .map((value) => [\n value[0],\n value[1] ? parseConfig(value[1], {}) : undefined,\n ]);\n\n return all[all.length - 1] || [];\n}\n\n/**\n * Parse `settings`.\n */\nfunction parseSettings(\n value: string[] | string | null | undefined\n): Record<string, unknown> {\n const normalized = normalizeToArray(value);\n const cache: Record<string, unknown> = {};\n\n for (const value of normalized) {\n parseConfig(value, cache);\n }\n\n return cache;\n}\n\n/**\n * Parse configuration.\n */\nfunction parseConfig(\n value: string,\n cache: Record<string, unknown>\n): Record<string, unknown> {\n let flags: Record<string, unknown>;\n let flag: string;\n\n try {\n flags = toCamelCase(parseJSON(value));\n } catch (error) {\n const exception = error as Error;\n throw fault(\n \"Cannot parse `%s` as JSON: %s\",\n value,\n // Fix position\n exception.message.replace(/at(?= position)/, \"around\")\n );\n }\n\n for (flag in flags) {\n if (own.call(flags, flag)) {\n cache[flag] = flags[flag];\n }\n }\n\n return cache;\n}\n/**\n * Handle an unknown flag.\n */\nfunction validateLintNames(lints: string[][]): boolean {\n for (const lint of lints) {\n const name = lint[0];\n if (!availableLints[name]) {\n const known = Object.keys(availableLints);\n throw fault(\n \"Unknown lint rule `%s`, available rules are:\\n%s\",\n name,\n \"\\t\" + known.join(\"\\n\\t\")\n );\n }\n }\n\n return true;\n}\n\n/**\n * Handle an unknown flag.\n */\nfunction handleUnknownArgument(flag: string): boolean {\n // Not a glob.\n if (flag.charAt(0) === \"-\") {\n // Long options, always unknown.\n if (flag.charAt(1) === \"-\") {\n throw fault(\n \"Unknown option `%s`, expected:\\n%s\",\n flag,\n inspectAll(schema)\n );\n }\n\n // Short options, can be grouped.\n const found = flag.slice(1).split(\"\");\n const known = schema.filter((d) => d.short);\n const knownKeys = new Set(known.map((d) => d.short));\n let index = -1;\n\n while (++index < found.length) {\n const key = found[index];\n if (!knownKeys.has(key)) {\n throw fault(\n \"Unknown short option `-%s`, expected:\\n%s\",\n key,\n inspectAll(known)\n );\n }\n }\n }\n\n return true;\n}\n\n/**\n * Inspect all `options`.\n */\nfunction inspectAll(options: Option[]): string {\n return table(options.map((d) => inspect(d)));\n}\n\n/**\n * Inspect one `option`.\n */\nfunction inspect(option: Option): string[] {\n let description = option.description;\n let long = option.long;\n\n if (option.default === true || option.truelike) {\n description += \" (on by default)\";\n long = \"[no-]\" + long;\n }\n\n return [\n \"\",\n option.short ? \"-\" + option.short : \"\",\n \"--\" + long + (option.value ? \" \" + option.value : \"\"),\n description,\n ];\n}\n\n/**\n * Normalize `value`.\n */\nfunction normalizeToArray(\n value: string | string[] | null | undefined\n): string[] {\n if (!value) {\n return [];\n }\n\n if (typeof value === \"string\") {\n return [value];\n }\n\n return value;\n}\n\nfunction splitOnEquals(value: string) {\n return value.split(\"=\");\n}\n\nfunction splitOnComma(value: string) {\n return value.split(\",\");\n}\n\n/**\n * Transform the keys on an object to camel-case, recursively.\n */\nfunction toCamelCase(object: Record<string, unknown>): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n let key: string;\n\n for (key in object) {\n if (own.call(object, key)) {\n let value = object[key];\n\n if (value && typeof value === \"object\" && !Array.isArray(value)) {\n // @ts-expect-error: looks like an object.\n value = toCamelCase(value);\n }\n\n result[camelcase(key)] = value;\n }\n }\n\n return result;\n}\n\n/**\n * Parse a (lazy?) JSON config.\n */\nfunction parseJSON(value: string): Record<string, unknown> {\n return json5.parse(\"{\" + value + \"}\");\n}\n", "import { lints } from \"@unified-latex/unified-latex-lint\";\n\nexport const availableLints = Object.fromEntries(\n Object.values(lints).map((lint) => [\n lint.name.replace(/^unified-latex-lint:/, \"\"),\n lint,\n ])\n);\n", "// Modified from unified-args https://github.com/unifiedjs/unified-args/blob/main/lib/index.js\n// MIT License\n\nimport { availableLints } from \"../lints\";\n\nexport type Option = {\n long: string;\n description: string;\n value?: string;\n short?: string;\n default?: string | boolean;\n truelike?: boolean;\n type?: \"boolean\" | \"string\";\n};\n\nexport const schema: Option[] = [\n {\n long: \"help\",\n description: \"Output usage information\",\n short: \"h\",\n type: \"boolean\",\n default: false,\n },\n {\n long: \"version\",\n description: \"Output version number\",\n short: \"v\",\n type: \"boolean\",\n default: false,\n },\n {\n long: \"output\",\n description: \"Specify output location\",\n short: \"o\",\n value: \"[path]\",\n },\n {\n long: \"rc-path\",\n description: \"Specify configuration file\",\n short: \"r\",\n type: \"string\",\n value: \"<path>\",\n },\n {\n long: \"ignore-path\",\n description: \"Specify ignore file\",\n short: \"i\",\n type: \"string\",\n value: \"<path>\",\n },\n {\n long: \"ext\",\n description: \"Specify extensions\",\n type: \"string\",\n value: \"<extensions>\",\n },\n {\n long: \"lint\",\n description: `Lint rules to apply. Use multiple times to specify multiple lints. Available rules: ${Object.keys(\n availableLints\n ).join(\", \")}`,\n short: \"l\",\n type: \"string\",\n value: \"<rule>\",\n },\n {\n long: \"lint-all\",\n description: `Apply all available lint rules`,\n type: \"boolean\",\n default: false,\n },\n {\n long: \"fix-all\",\n description: \"Apply fixes for all applied lints\",\n type: \"boolean\",\n default: false,\n },\n {\n long: \"watch\",\n description: \"Watch for changes and reprocess\",\n short: \"w\",\n type: \"boolean\",\n default: false,\n },\n {\n long: \"macro\",\n description:\n \"Attach arguments of the specified macro (by default, unrecognized macros are parsed as having no arguments). Accepts a string of the form `\\\\newcommand{<name>}[<num args>]{<body>}` or a JSON string `{name: <name>, signature: <xparse argument signature>, body: <macro body>}`\",\n short: \"m\",\n type: \"string\",\n value: \"<rule>\",\n },\n {\n long: \"expand-macro\",\n description:\n \"Expand the specified macro. Accepts a string of the form `\\\\newcommand{<name>}[<num args>]{<body>}` or a JSON string `{name: <name>, signature: <xparse argument signature>, body: <macro body>}`\",\n short: \"e\",\n type: \"string\",\n value: \"<rule>\",\n },\n {\n long: \"expand-document-macro\",\n description:\n \"Expand the specified macro which is defined in the document. You can use --stats to list all macros defined in the document.\",\n short: \"d\",\n type: \"string\",\n value: \"<name>\"\n },\n {\n long: \"frail\",\n description: \"Exit with 1 on warnings\",\n type: \"boolean\",\n default: false,\n },\n {\n long: \"tree\",\n description: \"Specify input and output as syntax tree\",\n type: \"boolean\",\n default: false,\n },\n {\n long: \"report\",\n description: \"Specify reporter\",\n type: \"string\",\n value: \"<reporter>\",\n },\n {\n long: \"file-path\",\n description: \"Specify path to process as\",\n type: \"string\",\n value: \"<path>\",\n },\n {\n long: \"ignore-path-resolve-from\",\n description:\n \"Resolve patterns in `ignore-path` from its directory or cwd\",\n type: \"string\",\n value: \"dir|cwd\",\n default: \"dir\",\n },\n {\n long: \"ignore-pattern\",\n description: \"Specify ignore patterns\",\n type: \"string\",\n value: \"<globs>\",\n },\n {\n long: \"silently-ignore\",\n description: \"Do not fail when given ignored files\",\n type: \"boolean\",\n },\n {\n long: \"tree-in\",\n description: \"Specify input as syntax tree\",\n type: \"boolean\",\n },\n {\n long: \"tree-out\",\n description: \"Output syntax tree\",\n type: \"boolean\",\n },\n {\n long: \"inspect\",\n description: \"Output formatted syntax tree\",\n type: \"boolean\",\n },\n {\n long: \"stats\",\n description: \"Show information about the processed file\",\n type: \"boolean\",\n default: false,\n },\n {\n long: \"stats-json\",\n description:\n \"Show information about the processed file and output the information as JSON\",\n type: \"boolean\",\n default: false,\n },\n {\n long: \"html\",\n description:\n \"Convert the output to HTML. Note, for math to render properly, you will need to add a library like MathJax or KaTeX to your HTMl source; you should also expand/replace any macros not recognized by the converter\",\n type: \"boolean\",\n default: false,\n },\n {\n long: \"stdout\",\n description: \"[Don't] write the processed file's contents to stdout\",\n type: \"boolean\",\n truelike: true,\n },\n {\n long: \"color\",\n description: \"Specify color in report\",\n type: \"boolean\",\n default: true,\n },\n {\n long: \"config\",\n description: \"Search for configuration files\",\n type: \"boolean\",\n default: true,\n },\n {\n long: \"ignore\",\n description: \"Search for ignore files\",\n type: \"boolean\",\n default: true,\n },\n];\n", "import json5 from \"json5\";\nimport * as Ast from \"@unified-latex/unified-latex-types\";\nimport {\n newcommandMacroToName,\n newcommandMacroToSpec,\n newcommandMacroToSubstitutionAst,\n} from \"@unified-latex/unified-latex-util-macros\";\nimport { parse } from \"@unified-latex/unified-latex-util-parse\";\n\n/**\n * Parse a macro specification given on the command line as either a \"\\newcommand\" string\n * or a JSON object specifying `name`, `signature`, and `body`.\n */\nexport function parseMacroExpansion(def: string): {\n name: string;\n signature: string;\n body: Ast.Node[];\n} {\n if (def.startsWith(\"\\\\\")) {\n const macro = parse(def).content[0] as Ast.Macro;\n const name = newcommandMacroToName(macro);\n if (!name) {\n // If there was no name specified, it must not have been a `\\newcommand` or other recognized macro\n throw new Error(\n `Could extract macro definition from \"${def}\"; expected the macro to be defined via \\\\newcommand or similar syntax`\n );\n }\n const signature = newcommandMacroToSpec(macro);\n const body = newcommandMacroToSubstitutionAst(macro);\n\n return { name, signature, body };\n }\n // If it wasn't specified via a `\\newcommand` macro, assume it's specified as JSON\n const parsedSpec = json5.parse(def);\n if (parsedSpec.name == null || parsedSpec.body == null) {\n throw new Error(\n `Expected a \"name\" field and a \"body\" field to be defined on ${def}`\n );\n }\n parsedSpec.signature = parsedSpec.signature || \"\";\n\n return {\n name: parsedSpec.name,\n signature: parsedSpec.signature,\n body: parse(parsedSpec.body).content,\n };\n}\n", "import * as Ast from \"@unified-latex/unified-latex-types\";\nimport { listPackages } from \"@unified-latex/unified-latex-util-packages\";\nimport { listNewcommands } from \"@unified-latex/unified-latex-util-macros\";\nimport { printRaw } from \"@unified-latex/unified-latex-util-print-raw\";\nimport { Plugin } from \"unified\";\nimport { enclosingPosition } from \"./enclosing-position\";\n\n/**\n * Plugin that reports statistics on the contents of LaTeX files.\n */\nexport const statsPlugin: Plugin<void[], Ast.Root, Ast.Root> = function () {\n return (tree, file) => {\n const packages = listPackages(tree);\n const packageNames = packages.map((s) => printRaw(s));\n if (packages.length > 0) {\n file.info(\n `Found ${\n packages.length\n } imported packages: ${packageNames.join(\", \")}`\n );\n }\n\n const newcommands = listNewcommands(tree);\n if (newcommands.length > 0) {\n file.info(\n `Found ${newcommands.length} defined commands: ${newcommands\n .map((c) => `\\\\${c.name}`)\n .join(\", \")}`,\n enclosingPosition(newcommands.map((c) => c.definition))\n );\n }\n };\n};\n\n/**\n * Plugin that reports statistics on the contents of LaTeX files and replaces the file output with a JSON\n * representation of the statistics.\n */\nexport const statsJsonPlugin: Plugin<void[], Ast.Root, string> = function () {\n this.Compiler = (tree, file) => {\n file.extname = \".json\";\n file.basename += \"-stats\";\n\n const packages = listPackages(tree).map((s) => printRaw(s));\n const newcommands = listNewcommands(tree).map((c) => ({\n name: c.name,\n signature: c.signature,\n body: printRaw(c.body),\n definition: printRaw(c.definition),\n }));\n\n return JSON.stringify({ packages, newcommands }, null, 4) + \"\\n\";\n };\n};\n", "import * as Ast from \"@unified-latex/unified-latex-types\";\n\ntype Position = { line: number; column: number; offset: number };\n\n/**\n * Find the smallest `position` object that contains all `nodes`.\n */\nexport function enclosingPosition(nodes: Ast.Node[]): {\n start: Position;\n end: Position;\n} {\n let start: Position = { line: 1, column: 1, offset: 0 };\n let end: Position = { line: 1, column: 1, offset: 0 };\n\n for (const node of nodes) {\n if (Number(node.position?.start.offset) < Number(start.offset)) {\n start = node.position?.start as Position;\n }\n if (Number(node.position?.end.offset) > Number(end.offset)) {\n end = node.position?.end as Position;\n }\n }\n\n return { start, end };\n}\n", "import * as Ast from \"@unified-latex/unified-latex-types\";\nimport {\n expandMacros,\n expandMacrosExcludingDefinitions,\n} from \"@unified-latex/unified-latex-util-macros\";\nimport { Plugin } from \"unified\";\nimport { attachMacroArgs } from \"@unified-latex/unified-latex-util-arguments\";\n\ntype PluginOptions = {\n macros: { name: string; signature: string; body: Ast.Node[] }[];\n};\n\n/**\n * Plugin that expands the specified macros.\n */\nexport const expandMacrosPlugin: Plugin<PluginOptions[], Ast.Root, Ast.Root> =\n function (options) {\n const { macros = [] } = options || {};\n const macroInfo = Object.fromEntries(\n macros.map((m) => [m.name, { signature: m.signature }])\n );\n return (tree) => {\n // We need to attach the arguments to each macro before we process it!\n attachMacroArgs(tree, macroInfo);\n expandMacros(tree, macros);\n };\n };\n", "import * as Ast from \"@unified-latex/unified-latex-types\";\nimport { Plugin } from \"unified\";\nimport { attachMacroArgs } from \"@unified-latex/unified-latex-util-arguments\";\n\ntype PluginOptions = {\n macros: { name: string; signature: string }[];\n};\n\n/**\n * Plugin that attaches the arguments of the specified macros.\n */\nexport const attachMacroArgsPlugin: Plugin<\n PluginOptions[],\n Ast.Root,\n Ast.Root\n> = function (options) {\n const { macros = [] } = options || {};\n const macroInfo = Object.fromEntries(\n macros.map((m) => [m.name, { signature: m.signature }])\n );\n return (tree) => {\n // We need to attach the arguments to each macro before we process it!\n attachMacroArgs(tree, macroInfo);\n };\n};\n", "import { Root } from \"hastscript/lib/core\";\nimport rehypeStringify from \"rehype-stringify\";\nimport Prettier from \"prettier\";\nimport { Plugin, unified } from \"unified\";\n\n/**\n * Plugin that pretty-prints HTML.\n */\nexport const prettyPrintHtmlPlugin: Plugin<void[], Root, string> = function () {\n const processor = unified().use(rehypeStringify);\n this.Compiler = (tree, file) => {\n file.extname = \".html\";\n\n const html = processor.stringify(tree, file);\n try {\n return Prettier.format(html, { parser: \"html\", useTabs: true });\n } catch {}\n return html;\n };\n};\n", "import * as Ast from \"@unified-latex/unified-latex-types\";\nimport {\n expandMacros,\n expandMacrosExcludingDefinitions,\n listNewcommands,\n} from \"@unified-latex/unified-latex-util-macros\";\nimport { Plugin } from \"unified\";\nimport { attachMacroArgs } from \"@unified-latex/unified-latex-util-arguments\";\n\ntype PluginOptions = {\n macros?: string[];\n};\n\n/**\n * Plugin that expands the specified macros by name. These macros must be defined in the document via\n * `\\newcommand...` or equivalent.\n */\nexport const expandDocumentMacrosPlugin: Plugin<\n PluginOptions[],\n Ast.Root,\n Ast.Root\n> = function (options) {\n const { macros = [] } = options || {};\n const macrosSet = new Set(macros);\n\n return (tree) => {\n const newcommands = listNewcommands(tree);\n const macros = newcommands.filter((s) => macrosSet.has(s.name));\n\n const macroInfo = Object.fromEntries(\n macros.map((m) => [m.name, { signature: m.signature }])\n );\n // We need to attach the arguments to each macro before we process it!\n attachMacroArgs(tree, macroInfo);\n expandMacrosExcludingDefinitions(tree, macros);\n };\n};\n", "import { processLatexViaUnified } from \"./libs/unified-latex\";\nimport { unifiedArgs } from \"./libs/unified-args\";\nimport fs from \"node:fs\";\n\nlet version = \"unknown (could not read version from package.json)\";\ntry {\n // Read the version dynamically on startup\n type PackageJson = { version: string };\n const packageJson: PackageJson = JSON.parse(\n fs.readFileSync(new URL(\"./package.json\", import.meta.url), {\n encoding: \"utf8\",\n })\n );\n version = packageJson.version;\n} catch {}\n\nunifiedArgs({\n processor: processLatexViaUnified,\n name: \"unified-latex\",\n description: \"LaTeX processor powered by unified-latex\",\n version,\n extensions: [\"tex\"],\n ignoreName: \".unifiedlatexignore\",\n packageField: \"unifiedLatexConfig\",\n rcName: \".unifiedlatexrc\",\n pluginPrefix: \"@unified-latex/\",\n});\n\n// NOTE: The docstring comment must be the last item in the index.ts file!\n/**\n * ## What is this?\n *\n * Command line interface to common `unified-latex` functions.\n *\n * ## When should I use this?\n *\n * If you want to reformat, process, or gather statistic on LaTeX files from the command line.\n *\n * ## Examples\n *\n * Reformat and pretty-print a file\n *\n * ```bash\n * unified-latex input.tex -o output.tex\n * ```\n *\n * List all commands defined via `\\newcommand` and friends (and hide the file output).\n *\n * ```bash\n * unified-latex input.tex --no-stdout --stats\n * ```\n *\n * Expand the definition of the macro `\\foo{...}`, which takes one argument.\n *\n * ```bash\n * unified-latex input.tex -e \"\\\\newcommand{foo}[1]{FOO(#1)}\"\n * ```\n *\n * View the parsed AST.\n *\n * ```bash\n * unified-latex input.tex --inspect\n * ```\n *\n * Convert the file to HTML. (Note, you will need to include and configure a library like _MathJax_ or _KaTeX_ to render\n * any math in the resulting HTML. Warnings are provided for macros that aren't recognized by the converter.)\n *\n * ```bash\n * unified-latex input.tex -o output.html --html\n * ```\n *\n * Lint all tex files in the current directory and watch for changes.\n *\n * ```bash\n * unified-latex . --no-stdout --lint-all --watch\n * ```\n */\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAwB;AAExB,sCAGO;AACP,0CAGO;AAIA,IAAM,yBAAyB,CAClCA,aACC;AACD,aAAO,wBAAQ,EACV;AAAA,IACG;AAAA,IACA,OAAO,OAAO,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,EAAE,GAAGA,QAAO;AAAA,EAC3D,EACC;AAAA,IACG;AAAA,IACA,OAAO,OAAO,EAAE,QAAQ,MAAM,oBAAoB,KAAK,GAAGA,QAAO;AAAA,EACrE;AACR;;;ACtBA,0BAAoB;AACpB,yBAAmB;AACnB,mBAAkB;AAClB,sBAAoC;AACpC,4BAIO;AACP,mCAAmC;;;ACTnC,wBAAkB;AAClB,uBAAsB;AACtB,sBAAqB;AACrB,IAAAC,gBAAkB;AAClB,mBAAsB;;;ACPtB,gCAAsB;AAEf,IAAM,iBAAiB,OAAO;AAAA,EACjC,OAAO,OAAO,+BAAK,EAAE,IAAI,CAAC,SAAS;AAAA,IAC/B,KAAK,KAAK,QAAQ,wBAAwB,EAAE;AAAA,IAC5C;AAAA,EACJ,CAAC;AACL;;;ACQO,IAAM,SAAmB;AAAA,EAC5B;AAAA,IACI,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,IACP,MAAM;AAAA,IACN,SAAS;AAAA,EACb;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,IACP,MAAM;AAAA,IACN,SAAS;AAAA,EACb;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,IACP,OAAO;AAAA,EACX;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,aAAa;AAAA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,QAAQ,IAAI;AACvB;AAQA,SAAS,KAAK,OAAc,QAAkB;AAC1C,QAAM,UAAU,QAAQ,SAAS,QAAQ,MAAM,UAAU,KAAK;AAE9D,eAAa;AAEb,sBAAAA,QAAQ,OAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,IAAI;AACpD;AAEA,SAAS,SAAS;AACd,sBAAAA,QAAQ,KAAK,UAAU;AAC3B;AAEA,SAAS,OAAO;AAAC;;;AWpPjB,qBAAe;AAFf;AAIA,IAAI,UAAU;AACd,IAAI;AAGA,QAAM,cAA2B,KAAK;AAAA,IAClC,eAAAI,QAAG,aAAa,IAAI,IAAI,kBAAkB,YAAY,GAAG,GAAG;AAAA,MACxD,UAAU;AAAA,IACd,CAAC;AAAA,EACL;AACA,YAAU,YAAY;AAC1B,QAAE;AAAO;AAET,YAAY;AAAA,EACR,WAAW;AAAA,EACX,MAAM;AAAA,EACN,aAAa;AAAA,EACb;AAAA,EACA,YAAY,CAAC,KAAK;AAAA,EAClB,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,cAAc;AAClB,CAAC;",
6
- "names": ["options", "import_json5", "import_unified_latex_util_parse", "json5", "minimist", "index", "value", "lints", "index", "options", "table", "camelcase", "json5", "import_unified_latex_util_macros", "import_unified_latex_util_macros", "options", "import_unified_latex_util_arguments", "options", "import_unified", "rehypeStringify", "Prettier", "import_unified_latex_util_macros", "import_unified_latex_util_arguments", "options", "macros", "stream", "process", "chalk", "done", "chokidar", "fs"]
7
- }