@powerlines/plugin-automd 0.1.457 → 0.1.459
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/_virtual/_rolldown/runtime.cjs +29 -1
- package/dist/index.cjs +102 -1
- package/dist/index.mjs +97 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/dist/types/toc.mjs +1 -1
- package/package.json +3 -3
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
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 (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
exports.__toESM = __toESM;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,102 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
4
|
+
let _stryke_fs_is_file = require("@stryke/fs/is-file");
|
|
5
|
+
let _stryke_fs_list_files = require("@stryke/fs/list-files");
|
|
6
|
+
let _stryke_path_append = require("@stryke/path/append");
|
|
7
|
+
let _stryke_path_is_type = require("@stryke/path/is-type");
|
|
8
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
9
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
10
|
+
let automd = require("automd");
|
|
11
|
+
let c12 = require("c12");
|
|
12
|
+
let defu = require("defu");
|
|
13
|
+
defu = require_runtime.__toESM(defu, 1);
|
|
14
|
+
let markdown_toc = require("markdown-toc");
|
|
15
|
+
markdown_toc = require_runtime.__toESM(markdown_toc, 1);
|
|
16
|
+
|
|
17
|
+
//#region src/index.ts
|
|
18
|
+
/**
|
|
19
|
+
* AutoMD Plugin
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.
|
|
23
|
+
*
|
|
24
|
+
* @see https://automd.unjs.io/
|
|
25
|
+
*
|
|
26
|
+
* @param options - The plugin options.
|
|
27
|
+
* @returns A Powerlines plugin instance.
|
|
28
|
+
*/
|
|
29
|
+
const plugin = (options = {}) => {
|
|
30
|
+
return {
|
|
31
|
+
name: "automd",
|
|
32
|
+
async config() {
|
|
33
|
+
const config = await (0, automd.loadConfig)((0, _stryke_path_join_paths.joinPaths)(this.config.cwd || process.cwd(), this.config.root), options);
|
|
34
|
+
if (!config.prefix || !Array.isArray(config.prefix)) config.prefix = (0, _stryke_convert_to_array.toArray)(config.prefix ?? []);
|
|
35
|
+
if (!config.prefix.includes("automd")) config.prefix.push("automd");
|
|
36
|
+
if (!config.prefix.includes("powerlines")) config.prefix.push("powerlines");
|
|
37
|
+
return { automd: (0, defu.default)(config ?? {}, {
|
|
38
|
+
configFile: options.configFile,
|
|
39
|
+
allowIssues: true,
|
|
40
|
+
dir: this.config.root,
|
|
41
|
+
watch: false,
|
|
42
|
+
input: "README.md",
|
|
43
|
+
toc: {
|
|
44
|
+
maxDepth: 6,
|
|
45
|
+
bullets: "-"
|
|
46
|
+
}
|
|
47
|
+
}) };
|
|
48
|
+
},
|
|
49
|
+
async configResolved() {
|
|
50
|
+
if (this.config.framework && !(0, _stryke_convert_to_array.toArray)(this.config.automd.prefix).includes(this.config.framework)) this.config.automd.prefix = (0, _stryke_convert_to_array.toArray)(this.config.automd.prefix).concat(this.config.framework);
|
|
51
|
+
if (this.config.automd.configFile) {
|
|
52
|
+
const { config } = await (0, c12.loadConfig)({
|
|
53
|
+
cwd: this.config.automd.dir,
|
|
54
|
+
configFile: this.config.automd.configFile,
|
|
55
|
+
defaults: {
|
|
56
|
+
ignore: [
|
|
57
|
+
"**/node_modules",
|
|
58
|
+
"**/dist",
|
|
59
|
+
"**/.*"
|
|
60
|
+
],
|
|
61
|
+
dir: this.config.automd.dir
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
this.config.automd = (0, automd.resolveConfig)((0, defu.default)(this.config.automd, {
|
|
65
|
+
...config,
|
|
66
|
+
prefix: (0, _stryke_convert_to_array.toArray)(config.prefix ?? [])
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
this.config.automd.input = (await Promise.all((0, _stryke_convert_to_array.toArray)(this.config.automd.input).map(async (input) => {
|
|
70
|
+
if (input.includes("*")) return (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_is_type.isAbsolutePath)(input) ? input : (0, _stryke_path_append.appendPath)(input, this.config.root), { ignore: this.config.automd.ignore });
|
|
71
|
+
return (0, _stryke_path_is_type.isAbsolutePath)(input) ? input : (0, _stryke_path_append.appendPath)(input, this.config.root);
|
|
72
|
+
}))).flat();
|
|
73
|
+
if (this.config.automd.output && !(0, _stryke_path_is_type.isAbsolutePath)(this.config.automd.output)) this.config.automd.output = (0, _stryke_path_append.appendPath)(this.config.automd.output, this.config.root);
|
|
74
|
+
this.config.automd.generators ??= {};
|
|
75
|
+
if (this.config.automd.toc !== false) this.config.automd.generators.toc ??= {
|
|
76
|
+
name: "toc",
|
|
77
|
+
generate: (ctx) => {
|
|
78
|
+
const opts = this.config.automd.toc ?? {};
|
|
79
|
+
return { contents: (0, markdown_toc.default)(ctx.block.contents, {
|
|
80
|
+
...opts,
|
|
81
|
+
maxdepth: opts.maxDepth,
|
|
82
|
+
first1: opts.firstH1
|
|
83
|
+
}).content };
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
async docs() {
|
|
88
|
+
await Promise.all((0, _stryke_convert_to_array.toArray)(this.config.automd.input).map(async (input) => {
|
|
89
|
+
const contents = await this.fs.read(input);
|
|
90
|
+
if (contents) {
|
|
91
|
+
const result = await (0, automd.transform)(contents, this.config.automd);
|
|
92
|
+
if (result.hasIssues && this.config.automd.allowIssues === false) throw new Error(`AutoMD found issues in file "${input}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);
|
|
93
|
+
if (result.hasChanged) await this.fs.write((0, _stryke_path_append.appendPath)(this.config.automd.output ? (0, _stryke_fs_is_file.isDirectory)(this.config.automd.output) ? (0, _stryke_path_replace.replacePath)(input, this.config.automd.output) : this.config.automd.output : input, this.config.root), result.contents);
|
|
94
|
+
}
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
//#endregion
|
|
101
|
+
exports.default = plugin;
|
|
102
|
+
exports.plugin = plugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,98 @@
|
|
|
1
|
-
import{toArray
|
|
1
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
2
|
+
import { isDirectory } from "@stryke/fs/is-file";
|
|
3
|
+
import { listFiles } from "@stryke/fs/list-files";
|
|
4
|
+
import { appendPath } from "@stryke/path/append";
|
|
5
|
+
import { isAbsolutePath } from "@stryke/path/is-type";
|
|
6
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
7
|
+
import { replacePath } from "@stryke/path/replace";
|
|
8
|
+
import { loadConfig, resolveConfig, transform } from "automd";
|
|
9
|
+
import { loadConfig as loadConfig$1 } from "c12";
|
|
10
|
+
import defu from "defu";
|
|
11
|
+
import toc from "markdown-toc";
|
|
12
|
+
|
|
13
|
+
//#region src/index.ts
|
|
14
|
+
/**
|
|
15
|
+
* AutoMD Plugin
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.
|
|
19
|
+
*
|
|
20
|
+
* @see https://automd.unjs.io/
|
|
21
|
+
*
|
|
22
|
+
* @param options - The plugin options.
|
|
23
|
+
* @returns A Powerlines plugin instance.
|
|
24
|
+
*/
|
|
25
|
+
const plugin = (options = {}) => {
|
|
26
|
+
return {
|
|
27
|
+
name: "automd",
|
|
28
|
+
async config() {
|
|
29
|
+
const config = await loadConfig(joinPaths(this.config.cwd || process.cwd(), this.config.root), options);
|
|
30
|
+
if (!config.prefix || !Array.isArray(config.prefix)) config.prefix = toArray(config.prefix ?? []);
|
|
31
|
+
if (!config.prefix.includes("automd")) config.prefix.push("automd");
|
|
32
|
+
if (!config.prefix.includes("powerlines")) config.prefix.push("powerlines");
|
|
33
|
+
return { automd: defu(config ?? {}, {
|
|
34
|
+
configFile: options.configFile,
|
|
35
|
+
allowIssues: true,
|
|
36
|
+
dir: this.config.root,
|
|
37
|
+
watch: false,
|
|
38
|
+
input: "README.md",
|
|
39
|
+
toc: {
|
|
40
|
+
maxDepth: 6,
|
|
41
|
+
bullets: "-"
|
|
42
|
+
}
|
|
43
|
+
}) };
|
|
44
|
+
},
|
|
45
|
+
async configResolved() {
|
|
46
|
+
if (this.config.framework && !toArray(this.config.automd.prefix).includes(this.config.framework)) this.config.automd.prefix = toArray(this.config.automd.prefix).concat(this.config.framework);
|
|
47
|
+
if (this.config.automd.configFile) {
|
|
48
|
+
const { config } = await loadConfig$1({
|
|
49
|
+
cwd: this.config.automd.dir,
|
|
50
|
+
configFile: this.config.automd.configFile,
|
|
51
|
+
defaults: {
|
|
52
|
+
ignore: [
|
|
53
|
+
"**/node_modules",
|
|
54
|
+
"**/dist",
|
|
55
|
+
"**/.*"
|
|
56
|
+
],
|
|
57
|
+
dir: this.config.automd.dir
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
this.config.automd = resolveConfig(defu(this.config.automd, {
|
|
61
|
+
...config,
|
|
62
|
+
prefix: toArray(config.prefix ?? [])
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
this.config.automd.input = (await Promise.all(toArray(this.config.automd.input).map(async (input) => {
|
|
66
|
+
if (input.includes("*")) return listFiles(isAbsolutePath(input) ? input : appendPath(input, this.config.root), { ignore: this.config.automd.ignore });
|
|
67
|
+
return isAbsolutePath(input) ? input : appendPath(input, this.config.root);
|
|
68
|
+
}))).flat();
|
|
69
|
+
if (this.config.automd.output && !isAbsolutePath(this.config.automd.output)) this.config.automd.output = appendPath(this.config.automd.output, this.config.root);
|
|
70
|
+
this.config.automd.generators ??= {};
|
|
71
|
+
if (this.config.automd.toc !== false) this.config.automd.generators.toc ??= {
|
|
72
|
+
name: "toc",
|
|
73
|
+
generate: (ctx) => {
|
|
74
|
+
const opts = this.config.automd.toc ?? {};
|
|
75
|
+
return { contents: toc(ctx.block.contents, {
|
|
76
|
+
...opts,
|
|
77
|
+
maxdepth: opts.maxDepth,
|
|
78
|
+
first1: opts.firstH1
|
|
79
|
+
}).content };
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
async docs() {
|
|
84
|
+
await Promise.all(toArray(this.config.automd.input).map(async (input) => {
|
|
85
|
+
const contents = await this.fs.read(input);
|
|
86
|
+
if (contents) {
|
|
87
|
+
const result = await transform(contents, this.config.automd);
|
|
88
|
+
if (result.hasIssues && this.config.automd.allowIssues === false) throw new Error(`AutoMD found issues in file "${input}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);
|
|
89
|
+
if (result.hasChanged) await this.fs.write(appendPath(this.config.automd.output ? isDirectory(this.config.automd.output) ? replacePath(input, this.config.automd.output) : this.config.automd.output : input, this.config.root), result.contents);
|
|
90
|
+
}
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
export { plugin as default, plugin };
|
|
2
98
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["loadConfigFile"],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isDirectory } from \"@stryke/fs/is-file\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isAbsolutePath } from \"@stryke/path/is-type\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport {\n Config,\n GenerateContext,\n GenerateResult,\n loadConfig,\n resolveConfig,\n transform\n} from \"automd\";\nimport { loadConfig as loadConfigFile } from \"c12\";\nimport defu from \"defu\";\nimport toc from \"markdown-toc\";\nimport type { Plugin } from \"powerlines\";\nimport { AutoMDPluginContext, AutoMDPluginOptions } from \"./types/plugin\";\nimport { TOCOptions } from \"./types/toc\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n automd?: AutoMDPluginOptions;\n }\n}\n\n/**\n * AutoMD Plugin\n *\n * @remarks\n * A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.\n *\n * @see https://automd.unjs.io/\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends AutoMDPluginContext = AutoMDPluginContext\n>(\n options: AutoMDPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"automd\",\n async config() {\n const config = await loadConfig(\n joinPaths(this.config.cwd || process.cwd(), this.config.root),\n options\n );\n\n if (!config.prefix || !Array.isArray(config.prefix)) {\n config.prefix = toArray(config.prefix ?? []);\n }\n\n if (!config.prefix.includes(\"automd\")) {\n config.prefix.push(\"automd\");\n }\n if (!config.prefix.includes(\"powerlines\")) {\n config.prefix.push(\"powerlines\");\n }\n\n return {\n automd: defu(config ?? {}, {\n configFile: options.configFile,\n allowIssues: true,\n dir: this.config.root,\n watch: false,\n input: \"README.md\",\n toc: {\n maxDepth: 6,\n bullets: \"-\"\n }\n })\n };\n },\n async configResolved() {\n if (\n this.config.framework &&\n !toArray(this.config.automd.prefix).includes(this.config.framework)\n ) {\n this.config.automd.prefix = toArray(this.config.automd.prefix).concat(\n this.config.framework\n );\n }\n\n if (this.config.automd.configFile) {\n const { config } = await loadConfigFile<Config>({\n cwd: this.config.automd.dir,\n configFile: this.config.automd.configFile,\n defaults: {\n ignore: [\"**/node_modules\", \"**/dist\", \"**/.*\"],\n dir: this.config.automd.dir\n }\n });\n\n this.config.automd = resolveConfig(\n defu(this.config.automd, {\n ...config,\n prefix: toArray(config.prefix ?? [])\n }) as Config\n );\n }\n\n this.config.automd.input = (\n await Promise.all(\n toArray(this.config.automd.input).map(async input => {\n if (input.includes(\"*\")) {\n return listFiles(\n isAbsolutePath(input)\n ? input\n : appendPath(input, this.config.root),\n {\n ignore: this.config.automd.ignore\n }\n );\n }\n\n return isAbsolutePath(input)\n ? input\n : appendPath(input, this.config.root);\n })\n )\n ).flat();\n\n if (\n this.config.automd.output &&\n !isAbsolutePath(this.config.automd.output)\n ) {\n this.config.automd.output = appendPath(\n this.config.automd.output,\n this.config.root\n );\n }\n\n this.config.automd.generators ??= {};\n\n if (this.config.automd.toc !== false) {\n this.config.automd.generators.toc ??= {\n name: \"toc\",\n generate: (ctx: GenerateContext): GenerateResult => {\n const opts = (this.config.automd.toc ?? {}) as TOCOptions;\n\n return {\n contents: toc(ctx.block.contents, {\n ...opts,\n maxdepth: opts.maxDepth,\n first1: opts.firstH1\n }).content\n };\n }\n };\n }\n },\n async docs() {\n await Promise.all(\n toArray(this.config.automd.input).map(async input => {\n const contents = await this.fs.read(input);\n if (contents) {\n const result = await transform(contents, this.config.automd);\n if (result.hasIssues && this.config.automd.allowIssues === false) {\n throw new Error(\n `AutoMD found issues in file \"${\n input\n }\". Please resolve the issues or set \\`allowIssues\\` to true in the plugin configuration to ignore them.`\n );\n }\n\n if (result.hasChanged) {\n await this.fs.write(\n appendPath(\n this.config.automd.output\n ? isDirectory(this.config.automd.output)\n ? replacePath(input, this.config.automd.output)\n : this.config.automd.output\n : input,\n this.config.root\n ),\n result.contents\n );\n }\n }\n })\n );\n }\n };\n};\n\nexport default plugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["loadConfigFile"],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isDirectory } from \"@stryke/fs/is-file\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isAbsolutePath } from \"@stryke/path/is-type\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport {\n Config,\n GenerateContext,\n GenerateResult,\n loadConfig,\n resolveConfig,\n transform\n} from \"automd\";\nimport { loadConfig as loadConfigFile } from \"c12\";\nimport defu from \"defu\";\nimport toc from \"markdown-toc\";\nimport type { Plugin } from \"powerlines\";\nimport { AutoMDPluginContext, AutoMDPluginOptions } from \"./types/plugin\";\nimport { TOCOptions } from \"./types/toc\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n automd?: AutoMDPluginOptions;\n }\n}\n\n/**\n * AutoMD Plugin\n *\n * @remarks\n * A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.\n *\n * @see https://automd.unjs.io/\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends AutoMDPluginContext = AutoMDPluginContext\n>(\n options: AutoMDPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"automd\",\n async config() {\n const config = await loadConfig(\n joinPaths(this.config.cwd || process.cwd(), this.config.root),\n options\n );\n\n if (!config.prefix || !Array.isArray(config.prefix)) {\n config.prefix = toArray(config.prefix ?? []);\n }\n\n if (!config.prefix.includes(\"automd\")) {\n config.prefix.push(\"automd\");\n }\n if (!config.prefix.includes(\"powerlines\")) {\n config.prefix.push(\"powerlines\");\n }\n\n return {\n automd: defu(config ?? {}, {\n configFile: options.configFile,\n allowIssues: true,\n dir: this.config.root,\n watch: false,\n input: \"README.md\",\n toc: {\n maxDepth: 6,\n bullets: \"-\"\n }\n })\n };\n },\n async configResolved() {\n if (\n this.config.framework &&\n !toArray(this.config.automd.prefix).includes(this.config.framework)\n ) {\n this.config.automd.prefix = toArray(this.config.automd.prefix).concat(\n this.config.framework\n );\n }\n\n if (this.config.automd.configFile) {\n const { config } = await loadConfigFile<Config>({\n cwd: this.config.automd.dir,\n configFile: this.config.automd.configFile,\n defaults: {\n ignore: [\"**/node_modules\", \"**/dist\", \"**/.*\"],\n dir: this.config.automd.dir\n }\n });\n\n this.config.automd = resolveConfig(\n defu(this.config.automd, {\n ...config,\n prefix: toArray(config.prefix ?? [])\n }) as Config\n );\n }\n\n this.config.automd.input = (\n await Promise.all(\n toArray(this.config.automd.input).map(async input => {\n if (input.includes(\"*\")) {\n return listFiles(\n isAbsolutePath(input)\n ? input\n : appendPath(input, this.config.root),\n {\n ignore: this.config.automd.ignore\n }\n );\n }\n\n return isAbsolutePath(input)\n ? input\n : appendPath(input, this.config.root);\n })\n )\n ).flat();\n\n if (\n this.config.automd.output &&\n !isAbsolutePath(this.config.automd.output)\n ) {\n this.config.automd.output = appendPath(\n this.config.automd.output,\n this.config.root\n );\n }\n\n this.config.automd.generators ??= {};\n\n if (this.config.automd.toc !== false) {\n this.config.automd.generators.toc ??= {\n name: \"toc\",\n generate: (ctx: GenerateContext): GenerateResult => {\n const opts = (this.config.automd.toc ?? {}) as TOCOptions;\n\n return {\n contents: toc(ctx.block.contents, {\n ...opts,\n maxdepth: opts.maxDepth,\n first1: opts.firstH1\n }).content\n };\n }\n };\n }\n },\n async docs() {\n await Promise.all(\n toArray(this.config.automd.input).map(async input => {\n const contents = await this.fs.read(input);\n if (contents) {\n const result = await transform(contents, this.config.automd);\n if (result.hasIssues && this.config.automd.allowIssues === false) {\n throw new Error(\n `AutoMD found issues in file \"${\n input\n }\". Please resolve the issues or set \\`allowIssues\\` to true in the plugin configuration to ignore them.`\n );\n }\n\n if (result.hasChanged) {\n await this.fs.write(\n appendPath(\n this.config.automd.output\n ? isDirectory(this.config.automd.output)\n ? replacePath(input, this.config.automd.output)\n : this.config.automd.output\n : input,\n this.config.root\n ),\n result.contents\n );\n }\n }\n })\n );\n }\n };\n};\n\nexport default plugin;\n"],"mappings":"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"}
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/dist/types/plugin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/dist/types/toc.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-automd",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.459",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Powerlines plugin to maintain a project's markdown files using AutoMD generators.",
|
|
6
6
|
"keywords": ["automd", "powerlines", "storm-software", "powerlines-plugin"],
|
|
@@ -114,10 +114,10 @@
|
|
|
114
114
|
"markdown-toc": "^1.2.0"
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
117
|
+
"@powerlines/plugin-plugin": "^0.12.410",
|
|
118
118
|
"@types/node": "^25.6.0",
|
|
119
119
|
"automd": "^0.4.3"
|
|
120
120
|
},
|
|
121
121
|
"publishConfig": { "access": "public" },
|
|
122
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "610c4c943933458c5f433b9002d8c187625b2d3f"
|
|
123
123
|
}
|