mdat 1.4.1 → 1.4.2
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 +17 -14
- package/dist/lib/index.js +14 -1
- package/package.json +11 -10
- package/readme.md +4 -2
package/dist/.DS_Store
CHANGED
|
Binary file
|
package/dist/bin/cli.js
CHANGED
|
@@ -35517,7 +35517,7 @@ function mergeOthers(values, utils, meta) {
|
|
|
35517
35517
|
}
|
|
35518
35518
|
|
|
35519
35519
|
//#endregion
|
|
35520
|
-
//#region node_modules/.pnpm/remark-mdat@1.2.
|
|
35520
|
+
//#region node_modules/.pnpm/remark-mdat@1.2.5/node_modules/remark-mdat/dist/index.js
|
|
35521
35521
|
const isNode = process?.versions?.node !== void 0;
|
|
35522
35522
|
const log$1 = {
|
|
35523
35523
|
verbose: false,
|
|
@@ -36130,16 +36130,6 @@ function getOriginalMarkup(mdastNode, hastNode) {
|
|
|
36130
36130
|
if (hastNode.position === void 0) throw new Error("Hast ElementContent node has no position!");
|
|
36131
36131
|
return mdastNode.value.slice(hastNode.position.start.offset, hastNode.position.end.offset);
|
|
36132
36132
|
}
|
|
36133
|
-
function stripUndefinedDeep(object) {
|
|
36134
|
-
if (Array.isArray(object)) return object.map((v) => v && typeof v === "object" ? stripUndefinedDeep(v) : v).filter((v) => v !== void 0);
|
|
36135
|
-
return Object.entries(object).map(([k, v]) => [k, v && typeof v === "object" ? stripUndefinedDeep(v) : v]).reduce((acc, [k, v]) => v === void 0 ? acc : {
|
|
36136
|
-
...acc,
|
|
36137
|
-
[k]: v
|
|
36138
|
-
}, {});
|
|
36139
|
-
}
|
|
36140
|
-
function deepMergeDefined(...objects) {
|
|
36141
|
-
return deepmerge(...objects.map((v, i) => i === 0 ? v : stripUndefinedDeep(v)));
|
|
36142
|
-
}
|
|
36143
36133
|
const optionsSchema$2 = objectType({
|
|
36144
36134
|
addMetaComment: unionType([booleanType(), stringType()]).optional(),
|
|
36145
36135
|
closingPrefix: stringType().min(1).optional(),
|
|
@@ -41579,7 +41569,7 @@ const Yargs = YargsFactory(esm_default$1);
|
|
|
41579
41569
|
|
|
41580
41570
|
//#endregion
|
|
41581
41571
|
//#region package.json
|
|
41582
|
-
var version = "1.4.
|
|
41572
|
+
var version = "1.4.2";
|
|
41583
41573
|
|
|
41584
41574
|
//#endregion
|
|
41585
41575
|
//#region node_modules/.pnpm/resolve-from@4.0.0/node_modules/resolve-from/index.js
|
|
@@ -92026,7 +92016,7 @@ function createJiti(id, opts = {}) {
|
|
|
92026
92016
|
}
|
|
92027
92017
|
|
|
92028
92018
|
//#endregion
|
|
92029
|
-
//#region node_modules/.pnpm/cosmiconfig-typescript-loader@6.2.0_@types+node@20.19.
|
|
92019
|
+
//#region node_modules/.pnpm/cosmiconfig-typescript-loader@6.2.0_@types+node@20.19.37_cosmiconfig@9.0.1_typescript@5.9.3__typescript@5.9.3/node_modules/cosmiconfig-typescript-loader/dist/esm/typescript-compile-error.mjs
|
|
92030
92020
|
var TypeScriptCompileError = class _TypeScriptCompileError extends Error {
|
|
92031
92021
|
constructor(message) {
|
|
92032
92022
|
super(message);
|
|
@@ -92042,7 +92032,7 @@ ${error.message}`);
|
|
|
92042
92032
|
};
|
|
92043
92033
|
|
|
92044
92034
|
//#endregion
|
|
92045
|
-
//#region node_modules/.pnpm/cosmiconfig-typescript-loader@6.2.0_@types+node@20.19.
|
|
92035
|
+
//#region node_modules/.pnpm/cosmiconfig-typescript-loader@6.2.0_@types+node@20.19.37_cosmiconfig@9.0.1_typescript@5.9.3__typescript@5.9.3/node_modules/cosmiconfig-typescript-loader/dist/esm/loader.mjs
|
|
92046
92036
|
function TypeScriptLoader(options) {
|
|
92047
92037
|
const loader = createJiti("", {
|
|
92048
92038
|
interopDefault: true,
|
|
@@ -95847,6 +95837,19 @@ async function readPackage({ cwd, normalize = true } = {}) {
|
|
|
95847
95837
|
return _readPackage(await fs$1.readFile(getPackagePath(cwd), "utf8"), normalize);
|
|
95848
95838
|
}
|
|
95849
95839
|
|
|
95840
|
+
//#endregion
|
|
95841
|
+
//#region src/lib/deep-merge-defined.ts
|
|
95842
|
+
function stripUndefinedDeep(object) {
|
|
95843
|
+
if (Array.isArray(object)) return object.map((v) => v && typeof v === "object" ? stripUndefinedDeep(v) : v).filter((v) => v !== void 0);
|
|
95844
|
+
return Object.entries(object).map(([k, v]) => [k, v && typeof v === "object" ? stripUndefinedDeep(v) : v]).reduce((acc, [k, v]) => v === void 0 ? acc : {
|
|
95845
|
+
...acc,
|
|
95846
|
+
[k]: v
|
|
95847
|
+
}, {});
|
|
95848
|
+
}
|
|
95849
|
+
function deepMergeDefined(...objects) {
|
|
95850
|
+
return deepmerge(...objects.map((v, i) => i === 0 ? v : stripUndefinedDeep(v)));
|
|
95851
|
+
}
|
|
95852
|
+
|
|
95850
95853
|
//#endregion
|
|
95851
95854
|
//#region src/lib/mdat-json-loader.ts
|
|
95852
95855
|
/**
|
package/dist/lib/index.js
CHANGED
|
@@ -5,8 +5,9 @@ import path from "node:path";
|
|
|
5
5
|
import picocolors from "picocolors";
|
|
6
6
|
import plur from "plur";
|
|
7
7
|
import { readPackage } from "read-pkg";
|
|
8
|
-
import {
|
|
8
|
+
import { getSoleRule, log, mdatCheck, mdatClean, mdatExpand, mdatSplit, optionsSchema, rulesSchema } from "remark-mdat";
|
|
9
9
|
import { z } from "zod";
|
|
10
|
+
import { deepmerge } from "deepmerge-ts";
|
|
10
11
|
import { packageUp } from "package-up";
|
|
11
12
|
import { isFile, isFileSync } from "path-type";
|
|
12
13
|
import { Configuration } from "unified-engine";
|
|
@@ -22,6 +23,18 @@ import prettyBytes from "pretty-bytes";
|
|
|
22
23
|
import { toc } from "mdast-util-toc";
|
|
23
24
|
import { findUp } from "find-up";
|
|
24
25
|
import { packageDirectory } from "package-directory";
|
|
26
|
+
//#region src/lib/deep-merge-defined.ts
|
|
27
|
+
function stripUndefinedDeep(object) {
|
|
28
|
+
if (Array.isArray(object)) return object.map((v) => v && typeof v === "object" ? stripUndefinedDeep(v) : v).filter((v) => v !== void 0);
|
|
29
|
+
return Object.entries(object).map(([k, v]) => [k, v && typeof v === "object" ? stripUndefinedDeep(v) : v]).reduce((acc, [k, v]) => v === void 0 ? acc : {
|
|
30
|
+
...acc,
|
|
31
|
+
[k]: v
|
|
32
|
+
}, {});
|
|
33
|
+
}
|
|
34
|
+
function deepMergeDefined(...objects) {
|
|
35
|
+
return deepmerge(...objects.map((v, i) => i === 0 ? v : stripUndefinedDeep(v)));
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
25
38
|
//#region src/lib/mdat-json-loader.ts
|
|
26
39
|
/**
|
|
27
40
|
* Lets arbitrary JSON objects (like from package.json) become reasonably good mdat rule sets
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdat",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
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",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"@clack/prompts": "^1.1.0",
|
|
47
47
|
"cosmiconfig": "^9.0.1",
|
|
48
48
|
"cosmiconfig-typescript-loader": "^6.2.0",
|
|
49
|
+
"deepmerge-ts": "^7.1.5",
|
|
49
50
|
"find-up": "^8.0.0",
|
|
50
51
|
"globby": "^16.1.1",
|
|
51
52
|
"mdast-util-toc": "^7.1.0",
|
|
@@ -59,9 +60,9 @@
|
|
|
59
60
|
"read-pkg": "^10.1.0",
|
|
60
61
|
"remark": "^15.0.1",
|
|
61
62
|
"remark-gfm": "^4.0.1",
|
|
62
|
-
"remark-mdat": "^1.2.
|
|
63
|
+
"remark-mdat": "^1.2.5",
|
|
63
64
|
"to-vfile": "^8.0.0",
|
|
64
|
-
"type-fest": "^5.
|
|
65
|
+
"type-fest": "^5.5.0",
|
|
65
66
|
"unified-engine": "^11.2.2",
|
|
66
67
|
"untildify": "^6.0.0",
|
|
67
68
|
"vfile": "^6.0.3",
|
|
@@ -70,22 +71,22 @@
|
|
|
70
71
|
},
|
|
71
72
|
"devDependencies": {
|
|
72
73
|
"@arethetypeswrong/core": "^0.18.2",
|
|
73
|
-
"@kitschpatrol/shared-config": "^6.0
|
|
74
|
+
"@kitschpatrol/shared-config": "^6.1.0",
|
|
74
75
|
"@types/mdast": "^4.0.4",
|
|
75
|
-
"@types/node": "~20.19.
|
|
76
|
+
"@types/node": "~20.19.37",
|
|
76
77
|
"@types/unist": "^3.0.3",
|
|
77
78
|
"@types/yargs": "^17.0.35",
|
|
78
|
-
"bumpp": "^
|
|
79
|
+
"bumpp": "^11.0.1",
|
|
79
80
|
"execa": "^9.6.1",
|
|
80
81
|
"mdat-plugin-cli-help": "^1.0.7",
|
|
81
82
|
"mdat-plugin-example": "^1.0.5",
|
|
82
|
-
"mdat-plugin-tldraw": "^1.0.
|
|
83
|
-
"nanoid": "^5.1.
|
|
83
|
+
"mdat-plugin-tldraw": "^1.0.8",
|
|
84
|
+
"nanoid": "^5.1.7",
|
|
84
85
|
"publint": "^0.3.18",
|
|
85
|
-
"tsdown": "^0.21.
|
|
86
|
+
"tsdown": "^0.21.4",
|
|
86
87
|
"typescript": "~5.9.3",
|
|
87
88
|
"unplugin-raw": "^0.6.4",
|
|
88
|
-
"vitest": "^4.
|
|
89
|
+
"vitest": "^4.1.1"
|
|
89
90
|
},
|
|
90
91
|
"engines": {
|
|
91
92
|
"node": ">=20.19.0"
|
package/readme.md
CHANGED
|
@@ -749,8 +749,8 @@ See the [Examples section](https://github.com/kitschpatrol/remark-mdat#examples)
|
|
|
749
749
|
|
|
750
750
|
| File | Original | Gzip | Brotli |
|
|
751
751
|
| ------------ | -------- | ------- | ------ |
|
|
752
|
-
| package.json | 2.7 kB | 1.
|
|
753
|
-
| readme.md | 64 kB
|
|
752
|
+
| package.json | 2.7 kB | 1.2 kB | 1 kB |
|
|
753
|
+
| readme.md | 64.2 kB | 11.7 kB | 9.4 kB |
|
|
754
754
|
|
|
755
755
|
<!-- /size-table -->
|
|
756
756
|
|
|
@@ -919,6 +919,8 @@ This has been done several times before:
|
|
|
919
919
|
- [AutoMD](https://automd.unjs.io/)\
|
|
920
920
|
Extremely similar functionality to mdat. The project was initiated around the same time as MDAT, but I didn't find the project until a few years later. Ships in the night.
|
|
921
921
|
|
|
922
|
+
- Anders Pitman's [tuplates](https://github.com/anderspitman/tuplates-py)\\
|
|
923
|
+
|
|
922
924
|
### Implementation notes
|
|
923
925
|
|
|
924
926
|
This project was split from a monorepo containing both `mdat` and `remark-mdat` into separate repos in July 2024.
|