mdat 0.7.5 → 0.8.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.
@@ -17,6 +17,12 @@ declare const _default: {
17
17
  content(options: import("type-fest").JsonValue, tree: import("mdast").Root): Promise<string>;
18
18
  order: number;
19
19
  };
20
+ 'size-table': {
21
+ content(options: import("type-fest").JsonValue): Promise<string>;
22
+ };
23
+ size: {
24
+ content(options: import("type-fest").JsonValue): Promise<string>;
25
+ };
20
26
  'short-description': {
21
27
  content(): Promise<string>;
22
28
  order: number;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ 'size-table': {
3
+ content(options: import("type-fest").JsonValue): Promise<string>;
4
+ };
5
+ };
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ size: {
3
+ content(options: import("type-fest").JsonValue): Promise<string>;
4
+ };
5
+ };
6
+ export default _default;
@@ -0,0 +1,19 @@
1
+ type SizeInfo = {
2
+ bytes: number;
3
+ bytesPretty: string;
4
+ percent: number;
5
+ percentPretty: string;
6
+ };
7
+ export type SizeReport = {
8
+ brotli: SizeInfo;
9
+ gzip: SizeInfo;
10
+ original: SizeInfo;
11
+ };
12
+ /**
13
+ * Analyzes a file's size and its compressed sizes using Brotli and Gzip
14
+ * @param filePath - Path to the file to analyze
15
+ * @returns Promise containing detailed size report
16
+ * @throws Error if file cannot be read or compressed
17
+ */
18
+ export declare function createSizeReport(filePath: string): Promise<SizeReport>;
19
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdat",
3
- "version": "0.7.5",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "description": "CLI tool and 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.",
6
6
  "repository": "github:kitschpatrol/mdat",
@@ -39,43 +39,44 @@
39
39
  ],
40
40
  "dependencies": {
41
41
  "@clack/prompts": "^0.7.0",
42
- "@kitschpatrol/tldraw-cli": "^4.6.16",
42
+ "@kitschpatrol/tldraw-cli": "^4.6.22",
43
43
  "@types/mdast": "^4.0.4",
44
44
  "@types/node": "18.19.0",
45
45
  "@types/unist": "^3.0.3",
46
- "@types/which": "^3.0.4",
47
46
  "@types/yargs": "^17.0.33",
48
47
  "cosmiconfig": "^9.0.0",
49
- "cosmiconfig-typescript-loader": "^5.0.0",
50
- "execa": "^9.3.1",
48
+ "cosmiconfig-typescript-loader": "^5.1.0",
49
+ "execa": "^9.5.1",
51
50
  "globby": "^14.0.2",
52
51
  "read-pkg": "^9.0.1",
53
- "which": "^4.0.0"
52
+ "which": "^5.0.0"
54
53
  },
55
54
  "devDependencies": {
56
- "@kitschpatrol/shared-config": "^4.7.9",
57
- "bumpp": "^9.5.2",
55
+ "@kitschpatrol/shared-config": "^4.7.11",
56
+ "@types/which": "^3.0.4",
57
+ "bumpp": "^9.8.1",
58
58
  "chalk": "^5.3.0",
59
59
  "chevrotain": "^11.0.3",
60
60
  "find-up": "^7.0.0",
61
61
  "is-executable": "^2.0.1",
62
62
  "mdast-util-toc": "^7.1.0",
63
- "nanoid": "^5.0.7",
63
+ "nanoid": "^5.0.8",
64
64
  "package-up": "^5.0.0",
65
65
  "path-type": "^6.0.0",
66
66
  "pkg-dir": "^8.0.0",
67
67
  "plur": "^5.1.0",
68
+ "pretty-bytes": "^6.1.1",
68
69
  "pretty-ms": "^9.1.0",
69
70
  "remark": "^15.0.1",
70
71
  "remark-gfm": "^4.0.0",
71
- "remark-mdat": "^0.7.2",
72
+ "remark-mdat": "^0.7.3",
72
73
  "to-vfile": "^8.0.0",
73
- "tsup": "^8.2.4",
74
+ "tsup": "^8.3.5",
74
75
  "type-fest": "^4.26.1",
75
- "typescript": "^5.6.2",
76
+ "typescript": "^5.6.3",
76
77
  "untildify": "^5.0.0",
77
78
  "vfile": "^6.0.3",
78
- "vitest": "^2.1.1",
79
+ "vitest": "^2.1.4",
79
80
  "yargs": "^17.7.2",
80
81
  "zod": "^3.23.8"
81
82
  },
package/readme.md CHANGED
@@ -190,7 +190,7 @@ As [noted below](#similar-projects), there are several similar projects out ther
190
190
  }
191
191
  ```
192
192
 
193
- This scales all the way up to some of the [more](src/lib/readme/rules/table-of-contents.ts) [elaborate](src/lib/readme/rules/cli-help) rules found in the `mdat readme` subcommand.
193
+ This scales all the way up to some of the [more](src/lib/readme/rules/table-of-contents.ts) [elaborate](src/lib/readme/rules/cli-help.ts) rules found in the `mdat readme` subcommand.
194
194
 
195
195
  You can also treat any JSON file as a rule set. MDAT will flatten it to allow any dot-notated key path to become a placeholder comment keyword.
196
196
 
@@ -453,7 +453,7 @@ mdat readme init [options]
453
453
 
454
454
  <!-- /cli-help -->
455
455
 
456
- _Meta note: The entire section above was generated automatically by the [`<!-- cli-help -->`](src/lib/readme/rules/cli-help/index.ts) mdat expansion rule provided in `mdat readme` subcommand. It dynamically parses the output from `mdat --help` into a Markdown table, recursively calling `--help` on subcommands to build a tidy representation of the help output._
456
+ _Meta note: The entire section above was generated automatically by the [`<!-- cli-help -->`](src/lib/readme/rules/cli-help.ts) mdat expansion rule provided in `mdat readme` subcommand. It dynamically parses the output from `mdat --help` into a Markdown table, recursively calling `--help` on subcommands to build a tidy representation of the help output._
457
457
 
458
458
  #### Examples
459
459
 
@@ -702,13 +702,30 @@ See the [Examples section](https://github.com/kitschpatrol/remark-mdat#examples)
702
702
 
703
703
  A quick way to embed a code block from elsewhere in your repository. Useful for examples.
704
704
 
705
+ - ###### `<!-- size { file: "./package.json" } -->`
706
+
707
+ Embeds the size of a file or, optionally, its Brotli or Gzip compressed size.
708
+
709
+ - ###### `<!-- size-table { files: ["package.json", "readme.md"] } -->`
710
+
711
+ Show a table of several file sizes, along with compressed sizes, for example:
712
+
713
+ <!-- size-table { files: ["package.json", "readme.md"] } -->
714
+
715
+ | File | Original | Gzip | Brotli |
716
+ | ------------ | -------- | ------- | ------ |
717
+ | package.json | 2.5 kB | 1.1 kB | 986 B |
718
+ | readme.md | 56.1 kB | 10.9 kB | 8.7 kB |
719
+
720
+ <!-- /size-table -->
721
+
705
722
  - ###### `<!-- cli-help -->`
706
723
 
707
724
  Automatically transform a CLI command's `--help` output into nicely formatted Markdown tables. The rule also recursively calls `--help` on any subcommands found for inclusion in the output.
708
725
 
709
726
  Currently, the rule can only parse help output in the format provided by [Yargs](https://yargs.js.org)- and [Meow](https://github.com/sindresorhus/meow)-based tools. If parsing fails, the rule will fall back to show the raw help output in a regular code block.
710
727
 
711
- ([Parsing help output](src/lib/readme/rules/cli-help/utilities/parsers) is a bit tricky. The [jc](https://github.com/kellyjonbrazil/jc) project is a heroic collection of output parsers, but does not currently implement help output parsing. It might be interesting to try to contribute mdat's help parsing implementations to jc.)
728
+ ([Parsing help output](src/lib/readme/rules/utilities/cli-help/parsers) is a bit tricky. The [jc](https://github.com/kellyjonbrazil/jc) project is a heroic collection of output parsers, but does not currently implement help output parsing. It might be interesting to try to contribute mdat's help parsing implementations to jc.)
712
729
 
713
730
  This rule is also aliased under the `<!-- cli -->` keyword.
714
731