mdat 1.4.0 → 1.4.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/dist/.DS_Store +0 -0
- package/dist/bin/cli.js +130565 -1192
- package/dist/bin/typescript-Tc4ICZlB.js +5 -0
- package/dist/bin/typescript-k7xJb58k.js +147177 -0
- package/dist/lib/index.js +1 -26
- package/package.json +3 -3
- package/dist/bin/typescript-DT_UEyMt.js +0 -1
- package/dist/bin/typescript-HSmT12zI.js +0 -449
package/dist/lib/index.js
CHANGED
|
@@ -22,7 +22,6 @@ import prettyBytes from "pretty-bytes";
|
|
|
22
22
|
import { toc } from "mdast-util-toc";
|
|
23
23
|
import { findUp } from "find-up";
|
|
24
24
|
import { packageDirectory } from "package-directory";
|
|
25
|
-
|
|
26
25
|
//#region src/lib/mdat-json-loader.ts
|
|
27
26
|
/**
|
|
28
27
|
* Lets arbitrary JSON objects (like from package.json) become reasonably good mdat rule sets
|
|
@@ -42,7 +41,6 @@ function flattenJson(jsonObject, parentKey = "", result = {}) {
|
|
|
42
41
|
}
|
|
43
42
|
return result;
|
|
44
43
|
}
|
|
45
|
-
|
|
46
44
|
//#endregion
|
|
47
45
|
//#region src/lib/utilities.ts
|
|
48
46
|
function zeroPad(n, nMax) {
|
|
@@ -111,7 +109,6 @@ async function loadAmbientRemarkConfig() {
|
|
|
111
109
|
settings: {}
|
|
112
110
|
};
|
|
113
111
|
}
|
|
114
|
-
|
|
115
112
|
//#endregion
|
|
116
113
|
//#region src/lib/config.ts
|
|
117
114
|
const configSchema = optionsSchema.merge(z.object({
|
|
@@ -244,7 +241,6 @@ async function getPackageJson() {
|
|
|
244
241
|
function mergeConfigs(a, b) {
|
|
245
242
|
return deepMergeDefined(a, b);
|
|
246
243
|
}
|
|
247
|
-
|
|
248
244
|
//#endregion
|
|
249
245
|
//#region src/lib/processors.ts
|
|
250
246
|
async function processFiles(files, loader, processorGetter, name, output, config, rules) {
|
|
@@ -301,7 +297,6 @@ function getCheckProcessor(options, ambientRemarkConfig) {
|
|
|
301
297
|
});
|
|
302
298
|
});
|
|
303
299
|
}
|
|
304
|
-
|
|
305
300
|
//#endregion
|
|
306
301
|
//#region src/lib/api.ts
|
|
307
302
|
/**
|
|
@@ -345,7 +340,6 @@ async function collapseFiles(files, name, output, config, rules) {
|
|
|
345
340
|
async function collapseString(markdown, config, rules) {
|
|
346
341
|
return processString(markdown, loadConfig, getCleanProcessor, config, rules);
|
|
347
342
|
}
|
|
348
|
-
|
|
349
343
|
//#endregion
|
|
350
344
|
//#region src/lib/readme/rules/badges.ts
|
|
351
345
|
var badges_default = { badges: {
|
|
@@ -370,7 +364,6 @@ var badges_default = { badges: {
|
|
|
370
364
|
},
|
|
371
365
|
order: 3
|
|
372
366
|
} };
|
|
373
|
-
|
|
374
367
|
//#endregion
|
|
375
368
|
//#region src/lib/readme/rules/banner.ts
|
|
376
369
|
var banner_default = { banner: {
|
|
@@ -448,7 +441,6 @@ function isUrl(text, lenient = true) {
|
|
|
448
441
|
return false;
|
|
449
442
|
}
|
|
450
443
|
}
|
|
451
|
-
|
|
452
444
|
//#endregion
|
|
453
445
|
//#region src/lib/readme/rules/code.ts
|
|
454
446
|
var code_default = { code: { async content(options) {
|
|
@@ -461,7 +453,6 @@ var code_default = { code: { async content(options) {
|
|
|
461
453
|
const exampleCode = await fs.readFile(path.join(process.cwd(), validOptions.file), "utf8");
|
|
462
454
|
return `\`\`\`${lang}\n${validOptions.trim ? exampleCode.trim() : exampleCode}\n\`\`\``;
|
|
463
455
|
} } };
|
|
464
|
-
|
|
465
456
|
//#endregion
|
|
466
457
|
//#region src/lib/readme/rules/contributing.ts
|
|
467
458
|
var contributing_default = { contributing: {
|
|
@@ -472,7 +463,6 @@ var contributing_default = { contributing: {
|
|
|
472
463
|
},
|
|
473
464
|
order: 15
|
|
474
465
|
} };
|
|
475
|
-
|
|
476
466
|
//#endregion
|
|
477
467
|
//#region src/lib/readme/rules/description.ts
|
|
478
468
|
/**
|
|
@@ -486,7 +476,6 @@ var description_default = { description: {
|
|
|
486
476
|
},
|
|
487
477
|
order: 4
|
|
488
478
|
} };
|
|
489
|
-
|
|
490
479
|
//#endregion
|
|
491
480
|
//#region src/lib/readme/rules/license.ts
|
|
492
481
|
var license_default = { license: {
|
|
@@ -498,14 +487,12 @@ var license_default = { license: {
|
|
|
498
487
|
},
|
|
499
488
|
order: 16
|
|
500
489
|
} };
|
|
501
|
-
|
|
502
490
|
//#endregion
|
|
503
491
|
//#region src/lib/readme/rules/footer.ts
|
|
504
492
|
var footer_default = { footer: {
|
|
505
493
|
content: [getSoleRule(contributing_default), getSoleRule(license_default)],
|
|
506
494
|
order: 17
|
|
507
495
|
} };
|
|
508
|
-
|
|
509
496
|
//#endregion
|
|
510
497
|
//#region src/lib/readme/rules/short-description.ts
|
|
511
498
|
/**
|
|
@@ -514,7 +501,6 @@ var footer_default = { footer: {
|
|
|
514
501
|
* spec.
|
|
515
502
|
*/
|
|
516
503
|
var short_description_default = { "short-description": getSoleRule(description_default) };
|
|
517
|
-
|
|
518
504
|
//#endregion
|
|
519
505
|
//#region src/lib/readme/rules/title.ts
|
|
520
506
|
var title_default = { title: {
|
|
@@ -533,7 +519,6 @@ var title_default = { title: {
|
|
|
533
519
|
function makeTitleCase(text) {
|
|
534
520
|
return text.split(/[ _-]+/).filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
535
521
|
}
|
|
536
|
-
|
|
537
522
|
//#endregion
|
|
538
523
|
//#region src/lib/readme/rules/header.ts
|
|
539
524
|
var header_default = { header: {
|
|
@@ -546,7 +531,6 @@ var header_default = { header: {
|
|
|
546
531
|
],
|
|
547
532
|
order: 1
|
|
548
533
|
} };
|
|
549
|
-
|
|
550
534
|
//#endregion
|
|
551
535
|
//#region src/lib/readme/rules/utilities/size/size-report.ts
|
|
552
536
|
const brotliCompressAsync = promisify(brotliCompress);
|
|
@@ -585,7 +569,6 @@ async function createSizeReport(filePath) {
|
|
|
585
569
|
throw new Error(`Failed to analyze file: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
586
570
|
}
|
|
587
571
|
}
|
|
588
|
-
|
|
589
572
|
//#endregion
|
|
590
573
|
//#region src/lib/readme/rules/size.ts
|
|
591
574
|
const optionsSchema$2 = z.object({
|
|
@@ -607,7 +590,6 @@ var size_default = { size: { async content(options) {
|
|
|
607
590
|
const validOptions = optionsSchema$2.parse(options);
|
|
608
591
|
return getSizeForCompression(await createSizeReport(path.join(process.cwd(), validOptions.file)), validOptions.compression);
|
|
609
592
|
} } };
|
|
610
|
-
|
|
611
593
|
//#endregion
|
|
612
594
|
//#region src/lib/readme/rules/size-table.ts
|
|
613
595
|
const fileSchema = z.union([z.string(), z.array(z.string())]).transform((files) => Array.isArray(files) ? files : [files]);
|
|
@@ -663,7 +645,6 @@ var size_table_default = { "size-table": { async content(options) {
|
|
|
663
645
|
showPercentage: validOptions.showPercentage
|
|
664
646
|
});
|
|
665
647
|
} } };
|
|
666
|
-
|
|
667
648
|
//#endregion
|
|
668
649
|
//#region src/lib/readme/rules/table-of-contents.ts
|
|
669
650
|
var table_of_contents_default = { "table-of-contents": {
|
|
@@ -691,14 +672,12 @@ var table_of_contents_default = { "table-of-contents": {
|
|
|
691
672
|
},
|
|
692
673
|
order: 6
|
|
693
674
|
} };
|
|
694
|
-
|
|
695
675
|
//#endregion
|
|
696
676
|
//#region src/lib/readme/rules/toc.ts
|
|
697
677
|
/**
|
|
698
678
|
* Simple alias for table-of-contents
|
|
699
679
|
*/
|
|
700
680
|
var toc_default = { toc: getSoleRule(table_of_contents_default) };
|
|
701
|
-
|
|
702
681
|
//#endregion
|
|
703
682
|
//#region src/lib/readme/rules/index.ts
|
|
704
683
|
var rules_default = {
|
|
@@ -717,7 +696,6 @@ var rules_default = {
|
|
|
717
696
|
...title_default,
|
|
718
697
|
...toc_default
|
|
719
698
|
};
|
|
720
|
-
|
|
721
699
|
//#endregion
|
|
722
700
|
//#region src/lib/readme/config.ts
|
|
723
701
|
/**
|
|
@@ -739,7 +717,6 @@ async function loadConfigReadme(options) {
|
|
|
739
717
|
if (result.packageFile === void 0) throw new Error("Package file path is required in `mdat readme` config");
|
|
740
718
|
return result;
|
|
741
719
|
}
|
|
742
|
-
|
|
743
720
|
//#endregion
|
|
744
721
|
//#region src/lib/readme/utilities.ts
|
|
745
722
|
/**
|
|
@@ -771,7 +748,6 @@ async function findReadmeThrows() {
|
|
|
771
748
|
if (readme === void 0) throw new Error("No readme found");
|
|
772
749
|
return readme;
|
|
773
750
|
}
|
|
774
|
-
|
|
775
751
|
//#endregion
|
|
776
752
|
//#region src/lib/readme/api.ts
|
|
777
753
|
/**
|
|
@@ -837,6 +813,5 @@ async function collapseReadmeFiles(files, name, output, config, rules) {
|
|
|
837
813
|
files ??= await findReadmeThrows();
|
|
838
814
|
return processFiles(files, loadConfigReadme, getCleanProcessor, name, output, config, rules);
|
|
839
815
|
}
|
|
840
|
-
|
|
841
816
|
//#endregion
|
|
842
|
-
export { checkFiles, checkReadme, checkReadmeFiles, checkReadmeString, checkString, collapseFiles, collapseReadme, collapseReadmeFiles, collapseString, expandFiles, expandReadme, expandReadmeFiles, expandReadmeString, expandString, loadConfig, loadConfigReadme, mergeConfigs };
|
|
817
|
+
export { checkFiles, checkReadme, checkReadmeFiles, checkReadmeString, checkString, collapseFiles, collapseReadme, collapseReadmeFiles, collapseString, expandFiles, expandReadme, expandReadmeFiles, expandReadmeString, expandString, loadConfig, loadConfigReadme, mergeConfigs };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdat",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "CLI tool and TypeScript library implementing the Markdown Autophagic Template (MDAT) system. MDAT lets you use comments as dynamic content templates in Markdown files, making it easy to generate and update readme boilerplate.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mdat",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dist/*"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@clack/prompts": "^1.0
|
|
46
|
+
"@clack/prompts": "^1.1.0",
|
|
47
47
|
"cosmiconfig": "^9.0.1",
|
|
48
48
|
"cosmiconfig-typescript-loader": "^6.2.0",
|
|
49
49
|
"find-up": "^8.0.0",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"mdat-plugin-tldraw": "^1.0.7",
|
|
83
83
|
"nanoid": "^5.1.6",
|
|
84
84
|
"publint": "^0.3.18",
|
|
85
|
-
"tsdown": "^0.
|
|
85
|
+
"tsdown": "^0.21.0",
|
|
86
86
|
"typescript": "~5.9.3",
|
|
87
87
|
"unplugin-raw": "^0.6.4",
|
|
88
88
|
"vitest": "^4.0.18"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./typescript-HSmT12zI.js";export default e();export{};
|