mdat 1.2.3 → 1.3.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/bin/cli.js +45 -25
- package/dist/config.d.ts +7 -2
- package/dist/index.js +35 -22
- package/dist/readme/config.d.ts +3 -1
- package/package.json +8 -11
- package/readme.md +51 -51
package/bin/cli.js
CHANGED
|
@@ -33,21 +33,30 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
33
33
|
var __commonJS = (cb, mod) => function() {
|
|
34
34
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
35
35
|
};
|
|
36
|
-
var __export = (all$2) => {
|
|
36
|
+
var __export = (all$2, symbols) => {
|
|
37
37
|
let target = {};
|
|
38
|
-
for (var name in all$2)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
for (var name in all$2) {
|
|
39
|
+
__defProp(target, name, {
|
|
40
|
+
get: all$2[name],
|
|
41
|
+
enumerable: true
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if (symbols) {
|
|
45
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
46
|
+
}
|
|
42
47
|
return target;
|
|
43
48
|
};
|
|
44
49
|
var __copyProps = (to, from, except, desc) => {
|
|
45
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
51
|
+
for (var keys$1 = __getOwnPropNames(from), i = 0, n = keys$1.length, key; i < n; i++) {
|
|
52
|
+
key = keys$1[i];
|
|
53
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
54
|
+
__defProp(to, key, {
|
|
55
|
+
get: ((k) => from[k]).bind(null, key),
|
|
56
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
51
60
|
}
|
|
52
61
|
return to;
|
|
53
62
|
};
|
|
@@ -4605,7 +4614,7 @@ var yargs_default = Yargs;
|
|
|
4605
4614
|
|
|
4606
4615
|
//#endregion
|
|
4607
4616
|
//#region package.json
|
|
4608
|
-
var version = "1.
|
|
4617
|
+
var version = "1.3.1";
|
|
4609
4618
|
|
|
4610
4619
|
//#endregion
|
|
4611
4620
|
//#region node_modules/.pnpm/irregular-plurals@4.2.0/node_modules/irregular-plurals/irregular-plurals.json
|
|
@@ -8440,7 +8449,6 @@ ZodNaN.create = (params) => {
|
|
|
8440
8449
|
...processCreateParams(params)
|
|
8441
8450
|
});
|
|
8442
8451
|
};
|
|
8443
|
-
const BRAND = Symbol("zod_brand");
|
|
8444
8452
|
var ZodBranded = class extends ZodType {
|
|
8445
8453
|
_parse(input) {
|
|
8446
8454
|
const { ctx } = this._processInputParams(input);
|
|
@@ -8765,12 +8773,12 @@ const configSchema = optionsSchema.merge(objectType({
|
|
|
8765
8773
|
/**
|
|
8766
8774
|
* Load and validate mdat configuration / rule sets
|
|
8767
8775
|
* Uses cosmiconfig to search in the usual places.
|
|
8768
|
-
* Merge precedence:
|
|
8776
|
+
* Merge precedence: Base Defaults < Readme Defaults < Searched Config < Additional Config Paths
|
|
8769
8777
|
*
|
|
8770
8778
|
* Generic to accommodate additional Config options, so set T to your custom config type if needed. You must provide a matching configExtensionSchema as well.
|
|
8771
8779
|
*/
|
|
8772
8780
|
async function loadConfig(options) {
|
|
8773
|
-
const { additionalConfig, additionalRules, searchFrom } = options ?? {};
|
|
8781
|
+
const { additionalConfig, additionalRules, readmeDefaults, searchFrom } = options ?? {};
|
|
8774
8782
|
let finalConfig = {
|
|
8775
8783
|
addMetaComment: false,
|
|
8776
8784
|
assetsPath: "./assets",
|
|
@@ -8780,6 +8788,7 @@ async function loadConfig(options) {
|
|
|
8780
8788
|
packageFile: await findPackage(),
|
|
8781
8789
|
rules: { mdat: `Powered by the Markdown Autophagic Template system: [mdat](https://github.com/kitschpatrol/mdat).` }
|
|
8782
8790
|
};
|
|
8791
|
+
if (readmeDefaults) finalConfig = deepMergeDefined(finalConfig, readmeDefaults);
|
|
8783
8792
|
const configExplorer = cosmiconfig("mdat", { loaders: { ".ts": TypeScriptLoader() } });
|
|
8784
8793
|
const results = await configExplorer.search(searchFrom);
|
|
8785
8794
|
if (results) {
|
|
@@ -27673,7 +27682,7 @@ var badges_default = { badges: {
|
|
|
27673
27682
|
const packageJson$1 = await getPackageJson();
|
|
27674
27683
|
const { name } = packageJson$1;
|
|
27675
27684
|
const badges = [];
|
|
27676
|
-
if (!packageJson$1.
|
|
27685
|
+
if (!packageJson$1.name.startsWith("@") || packageJson$1.publishConfig?.access === "public") badges.push(`[](https://npmjs.com/package/${name})`);
|
|
27677
27686
|
if (validOptions?.npm !== void 0) for (const name$1 of validOptions.npm) badges.push(`[](https://npmjs.com/package/${name$1})`);
|
|
27678
27687
|
const { license } = packageJson$1;
|
|
27679
27688
|
if (license !== void 0) badges.push(`[](https://opensource.org/licenses/${license})`);
|
|
@@ -28045,7 +28054,7 @@ const optionsSchema$1 = unionType([objectType({
|
|
|
28045
28054
|
showPercentage: booleanType().optional().default(false)
|
|
28046
28055
|
})]).transform((options) => {
|
|
28047
28056
|
if ("file" in options) {
|
|
28048
|
-
const { file
|
|
28057
|
+
const { file, ...rest } = options;
|
|
28049
28058
|
return {
|
|
28050
28059
|
files: file,
|
|
28051
28060
|
...rest
|
|
@@ -28620,10 +28629,10 @@ function one(node$1) {
|
|
|
28620
28629
|
if (node$1.type === "footnoteReference") return [];
|
|
28621
28630
|
if (node$1.type === "link" || node$1.type === "linkReference") return all(node$1.children);
|
|
28622
28631
|
if ("children" in node$1) {
|
|
28623
|
-
const { children, position: position$2
|
|
28632
|
+
const { children, position: position$2, ...copy$1 } = node$1;
|
|
28624
28633
|
return Object.assign(esm_default(copy$1), { children: all(node$1.children) });
|
|
28625
28634
|
}
|
|
28626
|
-
const { position: position$1
|
|
28635
|
+
const { position: position$1, ...copy } = node$1;
|
|
28627
28636
|
return esm_default(copy);
|
|
28628
28637
|
}
|
|
28629
28638
|
|
|
@@ -28747,16 +28756,19 @@ var rules_default = {
|
|
|
28747
28756
|
//#endregion
|
|
28748
28757
|
//#region src/lib/readme/config.ts
|
|
28749
28758
|
/**
|
|
28750
|
-
* Convenience loader to always include the default readme config
|
|
28759
|
+
* Convenience loader to always include the default readme config.
|
|
28760
|
+
* The readme defaults should have lower priority than searched/user config,
|
|
28761
|
+
* but higher priority than base mdat defaults.
|
|
28751
28762
|
*/
|
|
28752
28763
|
async function loadConfigReadme(options) {
|
|
28753
28764
|
const defaultReadmeConfig = {
|
|
28754
28765
|
addMetaComment: true,
|
|
28755
28766
|
rules: rules_default
|
|
28756
28767
|
};
|
|
28757
|
-
const { additionalConfig = []
|
|
28768
|
+
const { additionalConfig = [], readmeDefaults = defaultReadmeConfig, ...rest } = options ?? {};
|
|
28758
28769
|
const result = await loadConfig({
|
|
28759
|
-
additionalConfig:
|
|
28770
|
+
additionalConfig: Array.isArray(additionalConfig) ? additionalConfig : [additionalConfig],
|
|
28771
|
+
readmeDefaults,
|
|
28760
28772
|
...rest
|
|
28761
28773
|
});
|
|
28762
28774
|
if (result.packageFile === void 0) throw new Error("Package file path is required in `mdat readme` config");
|
|
@@ -28764,7 +28776,7 @@ async function loadConfigReadme(options) {
|
|
|
28764
28776
|
}
|
|
28765
28777
|
|
|
28766
28778
|
//#endregion
|
|
28767
|
-
//#region node_modules/.pnpm/yocto-queue@1.2.
|
|
28779
|
+
//#region node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
28768
28780
|
var Node = class {
|
|
28769
28781
|
value;
|
|
28770
28782
|
next;
|
|
@@ -28795,6 +28807,7 @@ var Queue = class {
|
|
|
28795
28807
|
if (!current) return;
|
|
28796
28808
|
this.#head = this.#head.next;
|
|
28797
28809
|
this.#size--;
|
|
28810
|
+
if (!this.#head) this.#tail = void 0;
|
|
28798
28811
|
return current.value;
|
|
28799
28812
|
}
|
|
28800
28813
|
peek() {
|
|
@@ -29186,8 +29199,15 @@ const configOption = { config: {
|
|
|
29186
29199
|
} };
|
|
29187
29200
|
const metaOption = { meta: {
|
|
29188
29201
|
alias: "m",
|
|
29189
|
-
|
|
29190
|
-
|
|
29202
|
+
coerce(value) {
|
|
29203
|
+
if (typeof value === "string") {
|
|
29204
|
+
if (value.toLowerCase() === "false" || value === "0") return false;
|
|
29205
|
+
if (value.toLowerCase() === "true" || value === "1") return true;
|
|
29206
|
+
return value;
|
|
29207
|
+
}
|
|
29208
|
+
return value;
|
|
29209
|
+
},
|
|
29210
|
+
description: "Embed an extra comment at the top of the generated Markdown warning editors that certain sections of the document have been generated dynamically. Can be a `boolean` to enable/disable the default message, or a `string` to provide a custom message. Defaults to `false` for `mdat` commands and `true` for `mdat readme` commands."
|
|
29191
29211
|
} };
|
|
29192
29212
|
const nameOption = { name: {
|
|
29193
29213
|
alias: "n",
|
package/dist/config.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type Config = Simplify<Options & {
|
|
|
6
6
|
packageFile?: string;
|
|
7
7
|
}>;
|
|
8
8
|
export type ConfigLoaded = {
|
|
9
|
-
addMetaComment: boolean;
|
|
9
|
+
addMetaComment: boolean | string;
|
|
10
10
|
assetsPath: string;
|
|
11
11
|
closingPrefix: string;
|
|
12
12
|
keywordPrefix: string;
|
|
@@ -28,7 +28,7 @@ export type RulesToLoad = Array<Rules | string> | Rules | string;
|
|
|
28
28
|
/**
|
|
29
29
|
* Load and validate mdat configuration / rule sets
|
|
30
30
|
* Uses cosmiconfig to search in the usual places.
|
|
31
|
-
* Merge precedence:
|
|
31
|
+
* Merge precedence: Base Defaults < Readme Defaults < Searched Config < Additional Config Paths
|
|
32
32
|
*
|
|
33
33
|
* Generic to accommodate additional Config options, so set T to your custom config type if needed. You must provide a matching configExtensionSchema as well.
|
|
34
34
|
*/
|
|
@@ -48,6 +48,11 @@ export declare function loadConfig(options?: {
|
|
|
48
48
|
* Accepts an individual item, or an array. Objects in the array will be merged right to left, and take precedence over any rules in previously loaded Config objects as well.
|
|
49
49
|
*/
|
|
50
50
|
additionalRules?: RulesToLoad;
|
|
51
|
+
/**
|
|
52
|
+
* Readme-specific defaults that have higher priority than base defaults but lower than searched config.
|
|
53
|
+
* Used internally by loadConfigReadme.
|
|
54
|
+
*/
|
|
55
|
+
readmeDefaults?: Config;
|
|
51
56
|
/** Search for config in specific directories, mainly useful for testing. Cosmiconfig default search paths used if unset. */
|
|
52
57
|
searchFrom?: string;
|
|
53
58
|
}): Promise<ConfigLoaded>;
|
package/dist/index.js
CHANGED
|
@@ -25,21 +25,30 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
25
25
|
var __commonJS = (cb, mod) => function() {
|
|
26
26
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
27
27
|
};
|
|
28
|
-
var __export = (all$2) => {
|
|
28
|
+
var __export = (all$2, symbols) => {
|
|
29
29
|
let target = {};
|
|
30
|
-
for (var name in all$2)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
for (var name in all$2) {
|
|
31
|
+
__defProp(target, name, {
|
|
32
|
+
get: all$2[name],
|
|
33
|
+
enumerable: true
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (symbols) {
|
|
37
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
38
|
+
}
|
|
34
39
|
return target;
|
|
35
40
|
};
|
|
36
41
|
var __copyProps = (to, from, except, desc) => {
|
|
37
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
+
for (var keys$1 = __getOwnPropNames(from), i = 0, n = keys$1.length, key; i < n; i++) {
|
|
44
|
+
key = keys$1[i];
|
|
45
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
46
|
+
__defProp(to, key, {
|
|
47
|
+
get: ((k) => from[k]).bind(null, key),
|
|
48
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
43
52
|
}
|
|
44
53
|
return to;
|
|
45
54
|
};
|
|
@@ -3951,7 +3960,6 @@ ZodNaN.create = (params) => {
|
|
|
3951
3960
|
...processCreateParams(params)
|
|
3952
3961
|
});
|
|
3953
3962
|
};
|
|
3954
|
-
const BRAND = Symbol("zod_brand");
|
|
3955
3963
|
var ZodBranded = class extends ZodType {
|
|
3956
3964
|
_parse(input) {
|
|
3957
3965
|
const { ctx } = this._processInputParams(input);
|
|
@@ -4276,12 +4284,12 @@ const configSchema = optionsSchema.merge(objectType({
|
|
|
4276
4284
|
/**
|
|
4277
4285
|
* Load and validate mdat configuration / rule sets
|
|
4278
4286
|
* Uses cosmiconfig to search in the usual places.
|
|
4279
|
-
* Merge precedence:
|
|
4287
|
+
* Merge precedence: Base Defaults < Readme Defaults < Searched Config < Additional Config Paths
|
|
4280
4288
|
*
|
|
4281
4289
|
* Generic to accommodate additional Config options, so set T to your custom config type if needed. You must provide a matching configExtensionSchema as well.
|
|
4282
4290
|
*/
|
|
4283
4291
|
async function loadConfig(options) {
|
|
4284
|
-
const { additionalConfig, additionalRules, searchFrom } = options ?? {};
|
|
4292
|
+
const { additionalConfig, additionalRules, readmeDefaults, searchFrom } = options ?? {};
|
|
4285
4293
|
let finalConfig = {
|
|
4286
4294
|
addMetaComment: false,
|
|
4287
4295
|
assetsPath: "./assets",
|
|
@@ -4291,6 +4299,7 @@ async function loadConfig(options) {
|
|
|
4291
4299
|
packageFile: await findPackage(),
|
|
4292
4300
|
rules: { mdat: `Powered by the Markdown Autophagic Template system: [mdat](https://github.com/kitschpatrol/mdat).` }
|
|
4293
4301
|
};
|
|
4302
|
+
if (readmeDefaults) finalConfig = deepMergeDefined(finalConfig, readmeDefaults);
|
|
4294
4303
|
const configExplorer = cosmiconfig("mdat", { loaders: { ".ts": TypeScriptLoader() } });
|
|
4295
4304
|
const results = await configExplorer.search(searchFrom);
|
|
4296
4305
|
if (results) {
|
|
@@ -23391,7 +23400,7 @@ var badges_default = { badges: {
|
|
|
23391
23400
|
const packageJson$1 = await getPackageJson();
|
|
23392
23401
|
const { name } = packageJson$1;
|
|
23393
23402
|
const badges = [];
|
|
23394
|
-
if (!packageJson$1.
|
|
23403
|
+
if (!packageJson$1.name.startsWith("@") || packageJson$1.publishConfig?.access === "public") badges.push(`[](https://npmjs.com/package/${name})`);
|
|
23395
23404
|
if (validOptions?.npm !== void 0) for (const name$1 of validOptions.npm) badges.push(`[](https://npmjs.com/package/${name$1})`);
|
|
23396
23405
|
const { license } = packageJson$1;
|
|
23397
23406
|
if (license !== void 0) badges.push(`[](https://opensource.org/licenses/${license})`);
|
|
@@ -23763,7 +23772,7 @@ const optionsSchema$1 = unionType([objectType({
|
|
|
23763
23772
|
showPercentage: booleanType().optional().default(false)
|
|
23764
23773
|
})]).transform((options) => {
|
|
23765
23774
|
if ("file" in options) {
|
|
23766
|
-
const { file
|
|
23775
|
+
const { file, ...rest } = options;
|
|
23767
23776
|
return {
|
|
23768
23777
|
files: file,
|
|
23769
23778
|
...rest
|
|
@@ -24338,10 +24347,10 @@ function one(node$1) {
|
|
|
24338
24347
|
if (node$1.type === "footnoteReference") return [];
|
|
24339
24348
|
if (node$1.type === "link" || node$1.type === "linkReference") return all(node$1.children);
|
|
24340
24349
|
if ("children" in node$1) {
|
|
24341
|
-
const { children, position: position$2
|
|
24350
|
+
const { children, position: position$2, ...copy$1 } = node$1;
|
|
24342
24351
|
return Object.assign(esm_default(copy$1), { children: all(node$1.children) });
|
|
24343
24352
|
}
|
|
24344
|
-
const { position: position$1
|
|
24353
|
+
const { position: position$1, ...copy } = node$1;
|
|
24345
24354
|
return esm_default(copy);
|
|
24346
24355
|
}
|
|
24347
24356
|
|
|
@@ -24465,16 +24474,19 @@ var rules_default = {
|
|
|
24465
24474
|
//#endregion
|
|
24466
24475
|
//#region src/lib/readme/config.ts
|
|
24467
24476
|
/**
|
|
24468
|
-
* Convenience loader to always include the default readme config
|
|
24477
|
+
* Convenience loader to always include the default readme config.
|
|
24478
|
+
* The readme defaults should have lower priority than searched/user config,
|
|
24479
|
+
* but higher priority than base mdat defaults.
|
|
24469
24480
|
*/
|
|
24470
24481
|
async function loadConfigReadme(options) {
|
|
24471
24482
|
const defaultReadmeConfig = {
|
|
24472
24483
|
addMetaComment: true,
|
|
24473
24484
|
rules: rules_default
|
|
24474
24485
|
};
|
|
24475
|
-
const { additionalConfig = []
|
|
24486
|
+
const { additionalConfig = [], readmeDefaults = defaultReadmeConfig, ...rest } = options ?? {};
|
|
24476
24487
|
const result = await loadConfig({
|
|
24477
|
-
additionalConfig:
|
|
24488
|
+
additionalConfig: Array.isArray(additionalConfig) ? additionalConfig : [additionalConfig],
|
|
24489
|
+
readmeDefaults,
|
|
24478
24490
|
...rest
|
|
24479
24491
|
});
|
|
24480
24492
|
if (result.packageFile === void 0) throw new Error("Package file path is required in `mdat readme` config");
|
|
@@ -24482,7 +24494,7 @@ async function loadConfigReadme(options) {
|
|
|
24482
24494
|
}
|
|
24483
24495
|
|
|
24484
24496
|
//#endregion
|
|
24485
|
-
//#region node_modules/.pnpm/yocto-queue@1.2.
|
|
24497
|
+
//#region node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
24486
24498
|
var Node = class {
|
|
24487
24499
|
value;
|
|
24488
24500
|
next;
|
|
@@ -24513,6 +24525,7 @@ var Queue = class {
|
|
|
24513
24525
|
if (!current) return;
|
|
24514
24526
|
this.#head = this.#head.next;
|
|
24515
24527
|
this.#size--;
|
|
24528
|
+
if (!this.#head) this.#tail = void 0;
|
|
24516
24529
|
return current.value;
|
|
24517
24530
|
}
|
|
24518
24531
|
peek() {
|
package/dist/readme/config.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ type ReadmeConfigLoaded = Simplify<ConfigLoaded & {
|
|
|
6
6
|
}>;
|
|
7
7
|
type LoadConfigOptions = Parameters<typeof loadConfig>[0];
|
|
8
8
|
/**
|
|
9
|
-
* Convenience loader to always include the default readme config
|
|
9
|
+
* Convenience loader to always include the default readme config.
|
|
10
|
+
* The readme defaults should have lower priority than searched/user config,
|
|
11
|
+
* but higher priority than base mdat defaults.
|
|
10
12
|
*/
|
|
11
13
|
export declare function loadConfigReadme(options?: LoadConfigOptions): Promise<ReadmeConfigLoaded>;
|
|
12
14
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdat",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.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",
|
|
@@ -39,20 +39,20 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@clack/prompts": "^0.11.0",
|
|
41
41
|
"@types/mdast": "^4.0.4",
|
|
42
|
-
"@types/node": "^22.19.
|
|
42
|
+
"@types/node": "^22.19.1",
|
|
43
43
|
"@types/unist": "^3.0.3",
|
|
44
|
-
"@types/yargs": "^17.0.
|
|
44
|
+
"@types/yargs": "^17.0.35",
|
|
45
45
|
"cosmiconfig": "^9.0.0",
|
|
46
46
|
"cosmiconfig-typescript-loader": "^6.2.0",
|
|
47
47
|
"globby": "^14.1.0",
|
|
48
|
-
"read-pkg": "^
|
|
49
|
-
"remark-mdat": "^1.
|
|
48
|
+
"read-pkg": "^10.0.0",
|
|
49
|
+
"remark-mdat": "^1.2.0",
|
|
50
50
|
"type-fest": "^5.2.0",
|
|
51
51
|
"unified-engine": "^11.2.2",
|
|
52
52
|
"vfile": "^6.0.3"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@kitschpatrol/shared-config": "^5.
|
|
55
|
+
"@kitschpatrol/shared-config": "^5.9.0",
|
|
56
56
|
"bumpp": "^10.3.1",
|
|
57
57
|
"execa": "^9.6.0",
|
|
58
58
|
"find-up": "^8.0.0",
|
|
@@ -71,20 +71,17 @@
|
|
|
71
71
|
"remark": "^15.0.1",
|
|
72
72
|
"remark-gfm": "^4.0.1",
|
|
73
73
|
"to-vfile": "^8.0.0",
|
|
74
|
-
"tsdown": "^0.16.
|
|
74
|
+
"tsdown": "^0.16.7",
|
|
75
75
|
"typescript": "~5.9.3",
|
|
76
76
|
"unplugin-raw": "^0.6.3",
|
|
77
77
|
"untildify": "^6.0.0",
|
|
78
|
-
"vitest": "^4.0.
|
|
78
|
+
"vitest": "^4.0.14",
|
|
79
79
|
"yargs": "^17.7.2",
|
|
80
80
|
"zod": "^3.25.76"
|
|
81
81
|
},
|
|
82
82
|
"engines": {
|
|
83
83
|
"node": ">=20.19.0"
|
|
84
84
|
},
|
|
85
|
-
"publishConfig": {
|
|
86
|
-
"access": "public"
|
|
87
|
-
},
|
|
88
85
|
"scripts": {
|
|
89
86
|
"build": "tsdown && tsc -p tsconfig.build.lib.json",
|
|
90
87
|
"clean": "git rm -f pnpm-lock.yaml ; git clean -fdX",
|
package/readme.md
CHANGED
|
@@ -269,18 +269,18 @@ mdat expand <files..> [options]
|
|
|
269
269
|
| ------------------- | -------------------------------------------------------------- | -------- |
|
|
270
270
|
| `files` | Markdown file(s) with MDAT placeholder comments. _(Required.)_ | `string` |
|
|
271
271
|
|
|
272
|
-
| Option | Description
|
|
273
|
-
| ------------------- |
|
|
274
|
-
| `--config` | Path(s) to files containing MDAT configuration.
|
|
275
|
-
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules.
|
|
276
|
-
| `--output`<br>`-o` | Output file directory.
|
|
277
|
-
| `--name`<br>`-n` | Output file name.
|
|
278
|
-
| `--meta`<br>`-m` | Embed an extra comment at the top of the generated Markdown warning editors that certain sections of the document have been generated dynamically.
|
|
279
|
-
| `--prefix` | Require a string prefix before all comments to be considered for expansion. Useful if you have a bunch of non-MDAT comments in your Markdown file, or if you're willing to trade some verbosity for safety.
|
|
280
|
-
| `--print` | Print the expanded Markdown to stdout instead of saving to a file. Ignores `--output` and `--name` options.
|
|
281
|
-
| `--verbose` | Enable verbose logging. All verbose logs and prefixed with their log level and are printed to stderr for ease of redirection.
|
|
282
|
-
| `--help`<br>`-h` | Show help
|
|
283
|
-
| `--version`<br>`-v` | Show version number
|
|
272
|
+
| Option | Description | Type | Default |
|
|
273
|
+
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------- |
|
|
274
|
+
| `--config` | Path(s) to files containing MDAT configuration. | `array` | Configuration is loaded if found from the usual places, or defaults are used. |
|
|
275
|
+
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules. | `array` | |
|
|
276
|
+
| `--output`<br>`-o` | Output file directory. | `string` | Same directory as input file. |
|
|
277
|
+
| `--name`<br>`-n` | Output file name. | `string` | Same name as input file. Overwrites the input file. |
|
|
278
|
+
| `--meta`<br>`-m` | Embed an extra comment at the top of the generated Markdown warning editors that certain sections of the document have been generated dynamically. Can be a `boolean` to enable/disable the default message, or a `string` to provide a custom message. Defaults to `false` for `mdat` commands and `true` for `mdat readme` commands. | | |
|
|
279
|
+
| `--prefix` | Require a string prefix before all comments to be considered for expansion. Useful if you have a bunch of non-MDAT comments in your Markdown file, or if you're willing to trade some verbosity for safety. | `string` | |
|
|
280
|
+
| `--print` | Print the expanded Markdown to stdout instead of saving to a file. Ignores `--output` and `--name` options. | `boolean` | |
|
|
281
|
+
| `--verbose` | Enable verbose logging. All verbose logs and prefixed with their log level and are printed to stderr for ease of redirection. | `boolean` | |
|
|
282
|
+
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
283
|
+
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
284
284
|
|
|
285
285
|
#### Subcommand: `mdat check`
|
|
286
286
|
|
|
@@ -296,15 +296,15 @@ mdat check <files..> [options]
|
|
|
296
296
|
| ------------------- | -------------------------------------------------------------- | -------- |
|
|
297
297
|
| `files` | Markdown file(s) with MDAT placeholder comments. _(Required.)_ | `string` |
|
|
298
298
|
|
|
299
|
-
| Option | Description
|
|
300
|
-
| ------------------- |
|
|
301
|
-
| `--config` | Path(s) to files containing MDAT configuration.
|
|
302
|
-
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules.
|
|
303
|
-
| `--meta`<br>`-m` | Embed an extra comment at the top of the generated Markdown warning editors that certain sections of the document have been generated dynamically.
|
|
304
|
-
| `--prefix` | Require a string prefix before all comments to be considered for expansion. Useful if you have a bunch of non-MDAT comments in your Markdown file, or if you're willing to trade some verbosity for safety.
|
|
305
|
-
| `--verbose` | Enable verbose logging. All verbose logs and prefixed with their log level and are printed to stderr for ease of redirection.
|
|
306
|
-
| `--help`<br>`-h` | Show help
|
|
307
|
-
| `--version`<br>`-v` | Show version number
|
|
299
|
+
| Option | Description | Type | Default |
|
|
300
|
+
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------- |
|
|
301
|
+
| `--config` | Path(s) to files containing MDAT configuration. | `array` | Configuration is loaded if found from the usual places, or defaults are used. |
|
|
302
|
+
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules. | `array` | |
|
|
303
|
+
| `--meta`<br>`-m` | Embed an extra comment at the top of the generated Markdown warning editors that certain sections of the document have been generated dynamically. Can be a `boolean` to enable/disable the default message, or a `string` to provide a custom message. Defaults to `false` for `mdat` commands and `true` for `mdat readme` commands. | | |
|
|
304
|
+
| `--prefix` | Require a string prefix before all comments to be considered for expansion. Useful if you have a bunch of non-MDAT comments in your Markdown file, or if you're willing to trade some verbosity for safety. | `string` | |
|
|
305
|
+
| `--verbose` | Enable verbose logging. All verbose logs and prefixed with their log level and are printed to stderr for ease of redirection. | `boolean` | |
|
|
306
|
+
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
307
|
+
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
308
308
|
|
|
309
309
|
#### Subcommand: `mdat collapse`
|
|
310
310
|
|
|
@@ -368,20 +368,20 @@ mdat readme expand [files..] [options]
|
|
|
368
368
|
| ------------------- | --------------------------------------------------------------------------------------------------- | -------- |
|
|
369
369
|
| `files` | Readme file(s) with MDAT placeholder comments. If not provided, the closest readme.md file is used. | `string` |
|
|
370
370
|
|
|
371
|
-
| Option | Description
|
|
372
|
-
| ------------------- |
|
|
373
|
-
| `--config` | Path(s) to files containing MDAT configuration.
|
|
374
|
-
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules.
|
|
375
|
-
| `--output`<br>`-o` | Output file directory.
|
|
376
|
-
| `--name`<br>`-n` | Output file name.
|
|
377
|
-
| `--package` | Path to the package.json file to use to populate the readme.
|
|
378
|
-
| `--assets` | Path to find and save readme-related assets.
|
|
379
|
-
| `--prefix` | Require a string prefix before all comments to be considered for expansion. Useful if you have a bunch of non-MDAT comments in your Markdown file, or if you're willing to trade some verbosity for safety.
|
|
380
|
-
| `--meta`<br>`-m` | Embed an extra comment at the top of the generated Markdown warning editors that certain sections of the document have been generated dynamically.
|
|
381
|
-
| `--print` | Print the expanded Markdown to stdout instead of saving to a file. Ignores `--output` and `--name` options.
|
|
382
|
-
| `--verbose` | Enable verbose logging. All verbose logs and prefixed with their log level and are printed to stderr for ease of redirection.
|
|
383
|
-
| `--help`<br>`-h` | Show help
|
|
384
|
-
| `--version`<br>`-v` | Show version number
|
|
371
|
+
| Option | Description | Type | Default |
|
|
372
|
+
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------- |
|
|
373
|
+
| `--config` | Path(s) to files containing MDAT configuration. | `array` | Configuration is loaded if found from the usual places, or defaults are used. |
|
|
374
|
+
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules. | `array` | |
|
|
375
|
+
| `--output`<br>`-o` | Output file directory. | `string` | Same directory as input file. |
|
|
376
|
+
| `--name`<br>`-n` | Output file name. | `string` | Same name as input file. Overwrites the input file. |
|
|
377
|
+
| `--package` | Path to the package.json file to use to populate the readme. | `string` | The closest package.json file is used by default. |
|
|
378
|
+
| `--assets` | Path to find and save readme-related assets. | `string` | `./assets` |
|
|
379
|
+
| `--prefix` | Require a string prefix before all comments to be considered for expansion. Useful if you have a bunch of non-MDAT comments in your Markdown file, or if you're willing to trade some verbosity for safety. | `string` | |
|
|
380
|
+
| `--meta`<br>`-m` | Embed an extra comment at the top of the generated Markdown warning editors that certain sections of the document have been generated dynamically. Can be a `boolean` to enable/disable the default message, or a `string` to provide a custom message. Defaults to `false` for `mdat` commands and `true` for `mdat readme` commands. | | |
|
|
381
|
+
| `--print` | Print the expanded Markdown to stdout instead of saving to a file. Ignores `--output` and `--name` options. | `boolean` | |
|
|
382
|
+
| `--verbose` | Enable verbose logging. All verbose logs and prefixed with their log level and are printed to stderr for ease of redirection. | `boolean` | |
|
|
383
|
+
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
384
|
+
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
385
385
|
|
|
386
386
|
#### Subcommand: `mdat readme check`
|
|
387
387
|
|
|
@@ -397,17 +397,17 @@ mdat readme check [files..] [options]
|
|
|
397
397
|
| ------------------- | --------------------------------------------------------------------------------------------------- | -------- |
|
|
398
398
|
| `files` | Readme file(s) with MDAT placeholder comments. If not provided, the closest readme.md file is used. | `string` |
|
|
399
399
|
|
|
400
|
-
| Option | Description
|
|
401
|
-
| ------------------- |
|
|
402
|
-
| `--config` | Path(s) to files containing MDAT configuration.
|
|
403
|
-
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules.
|
|
404
|
-
| `--package` | Path to the package.json file to use to populate the readme.
|
|
405
|
-
| `--assets` | Path to find and save readme-related assets.
|
|
406
|
-
| `--prefix` | Require a string prefix before all comments to be considered for expansion. Useful if you have a bunch of non-MDAT comments in your Markdown file, or if you're willing to trade some verbosity for safety.
|
|
407
|
-
| `--meta`<br>`-m` | Embed an extra comment at the top of the generated Markdown warning editors that certain sections of the document have been generated dynamically.
|
|
408
|
-
| `--verbose` | Enable verbose logging. All verbose logs and prefixed with their log level and are printed to stderr for ease of redirection.
|
|
409
|
-
| `--help`<br>`-h` | Show help
|
|
410
|
-
| `--version`<br>`-v` | Show version number
|
|
400
|
+
| Option | Description | Type | Default |
|
|
401
|
+
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------- |
|
|
402
|
+
| `--config` | Path(s) to files containing MDAT configuration. | `array` | Configuration is loaded if found from the usual places, or defaults are used. |
|
|
403
|
+
| `--rules`<br>`-r` | Path(s) to files containing MDAT comment expansion rules. | `array` | |
|
|
404
|
+
| `--package` | Path to the package.json file to use to populate the readme. | `string` | The closest package.json file is used by default. |
|
|
405
|
+
| `--assets` | Path to find and save readme-related assets. | `string` | `./assets` |
|
|
406
|
+
| `--prefix` | Require a string prefix before all comments to be considered for expansion. Useful if you have a bunch of non-MDAT comments in your Markdown file, or if you're willing to trade some verbosity for safety. | `string` | |
|
|
407
|
+
| `--meta`<br>`-m` | Embed an extra comment at the top of the generated Markdown warning editors that certain sections of the document have been generated dynamically. Can be a `boolean` to enable/disable the default message, or a `string` to provide a custom message. Defaults to `false` for `mdat` commands and `true` for `mdat readme` commands. | | |
|
|
408
|
+
| `--verbose` | Enable verbose logging. All verbose logs and prefixed with their log level and are printed to stderr for ease of redirection. | `boolean` | |
|
|
409
|
+
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
410
|
+
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
411
411
|
|
|
412
412
|
#### Subcommand: `mdat readme collapse`
|
|
413
413
|
|
|
@@ -638,7 +638,7 @@ The `mdat` configuration file is a record object allowing you to customize aspec
|
|
|
638
638
|
|
|
639
639
|
```ts
|
|
640
640
|
type Config = {
|
|
641
|
-
addMetaComment?: boolean // Defaults to true
|
|
641
|
+
addMetaComment?: boolean | string // Defaults to true. If a string is provided, it will be used as the meta comment content.
|
|
642
642
|
assetsPath?: string // Where asset-generating rules should store their output, defaults to './assets'
|
|
643
643
|
closingPrefix?: string // Defaults to '/'
|
|
644
644
|
keywordPrefix?: string // Defaults to ''
|
|
@@ -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.5 kB | 1.1 kB |
|
|
753
|
-
| readme.md |
|
|
752
|
+
| package.json | 2.5 kB | 1.1 kB | 982 B |
|
|
753
|
+
| readme.md | 64 kB | 11.7 kB | 9.3 kB |
|
|
754
754
|
|
|
755
755
|
<!-- /size-table -->
|
|
756
756
|
|
|
@@ -796,7 +796,7 @@ The `init` command provides a number of "starter readme" templates incorporating
|
|
|
796
796
|
|
|
797
797
|
## Plugins
|
|
798
798
|
|
|
799
|
-
Rule plugins are packages that
|
|
799
|
+
Rule plugins are packages that simplify sharing mdat expansion rules across multiple projects.
|
|
800
800
|
|
|
801
801
|
### Installing a rule plugin
|
|
802
802
|
|
|
@@ -845,7 +845,7 @@ Hello from the [mdat](https://github.com/kitschpatrol/mdat) example plugin!
|
|
|
845
845
|
|
|
846
846
|
### Creating a rule plugin
|
|
847
847
|
|
|
848
|
-
A rule plugin is a ESM module or npm package with a default export of or more mdat rules.
|
|
848
|
+
A rule plugin is a ESM module or npm package with a default export of one or more mdat rules.
|
|
849
849
|
|
|
850
850
|
If you just need a quick one-off rule specific to your project, you can define it directly in your `mdat.config.ts` file. A plugin is only necessary if you want to share the rule or use it across multiple projects.
|
|
851
851
|
|