@powerlines/plugin-automd 0.1.289 → 0.1.291

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/index.cjs CHANGED
@@ -30,14 +30,14 @@ const plugin = (options = {}) => {
30
30
  return {
31
31
  name: "automd",
32
32
  async config() {
33
- const config = await require_index.loadConfig((0, __stryke_path_join_paths.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot), options);
33
+ const config = await require_index.loadConfig((0, __stryke_path_join_paths.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.root), options);
34
34
  if (!config.prefix || !Array.isArray(config.prefix)) config.prefix = (0, __stryke_convert_to_array.toArray)(config.prefix ?? []);
35
35
  if (!config.prefix.includes("automd")) config.prefix.push("automd");
36
36
  if (!config.prefix.includes("powerlines")) config.prefix.push("powerlines");
37
37
  return { automd: (0, defu.default)(config ?? {}, {
38
38
  configFile: options.configFile,
39
39
  allowIssues: true,
40
- dir: this.config.projectRoot,
40
+ dir: this.config.root,
41
41
  watch: false,
42
42
  input: "README.md",
43
43
  toc: {
@@ -67,16 +67,16 @@ const plugin = (options = {}) => {
67
67
  }));
68
68
  }
69
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.projectRoot), { ignore: this.config.automd.ignore });
71
- return (0, __stryke_path_is_type.isAbsolutePath)(input) ? input : (0, __stryke_path_append.appendPath)(input, this.config.projectRoot);
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
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.projectRoot);
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
74
  this.config.automd.generators ??= {};
75
75
  if (this.config.automd.toc !== false) this.config.automd.generators.toc ??= {
76
76
  name: "toc",
77
77
  generate: (ctx) => {
78
78
  const opts = this.config.automd.toc ?? {};
79
- return { contents: (0, markdown_toc.default)(ctx.block.md, {
79
+ return { contents: (0, markdown_toc.default)(ctx.block.contents, {
80
80
  ...opts,
81
81
  maxdepth: opts.maxDepth,
82
82
  first1: opts.firstH1
@@ -90,7 +90,7 @@ const plugin = (options = {}) => {
90
90
  if (contents) {
91
91
  const result = await require_index.transform(contents, this.config.automd);
92
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.projectRoot), result.contents);
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
94
  }
95
95
  }));
96
96
  }
package/dist/index.d.cts CHANGED
@@ -1,10 +1,14 @@
1
1
  import { TOCOptions, __ΩTOCOptions } from "./types/toc.cjs";
2
2
  import { AutoMDPluginContext, AutoMDPluginOptions, AutoMDPluginResolvedConfig, AutoMDPluginUserConfig, __ΩAutoMDPluginContext, __ΩAutoMDPluginOptions, __ΩAutoMDPluginResolvedConfig, __ΩAutoMDPluginUserConfig } from "./types/plugin.cjs";
3
3
  import "./types/index.cjs";
4
- import { Plugin } from "powerlines/types/plugin";
4
+ import { Plugin } from "powerlines";
5
5
 
6
6
  //#region src/index.d.ts
7
-
7
+ declare module "powerlines" {
8
+ interface UserConfig {
9
+ automd?: AutoMDPluginOptions;
10
+ }
11
+ }
8
12
  /**
9
13
  * AutoMD Plugin
10
14
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAyDA;;;;;;;;cAAa,0BACM,sBAAsB,+BAE9B,wBACR,OAAO"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;aAgDa;EAJW;;;;;AAmBxB;;;;;;;;cAAa,0BACM,sBAAsB,+BAE9B,wBACR,OAAO"}
package/dist/index.d.mts CHANGED
@@ -1,10 +1,14 @@
1
1
  import { TOCOptions, __ΩTOCOptions } from "./types/toc.mjs";
2
2
  import { AutoMDPluginContext, AutoMDPluginOptions, AutoMDPluginResolvedConfig, AutoMDPluginUserConfig, __ΩAutoMDPluginContext, __ΩAutoMDPluginOptions, __ΩAutoMDPluginResolvedConfig, __ΩAutoMDPluginUserConfig } from "./types/plugin.mjs";
3
3
  import "./types/index.mjs";
4
- import { Plugin } from "powerlines/types/plugin";
4
+ import { Plugin } from "powerlines";
5
5
 
6
6
  //#region src/index.d.ts
7
-
7
+ declare module "powerlines" {
8
+ interface UserConfig {
9
+ automd?: AutoMDPluginOptions;
10
+ }
11
+ }
8
12
  /**
9
13
  * AutoMD Plugin
10
14
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAyDA;;;;;;;;cAAa,0BACM,sBAAsB,+BAE9B,wBACR,OAAO"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;aAgDa;EAJW;;;;;AAmBxB;;;;;;;;cAAa,0BACM,sBAAsB,+BAE9B,wBACR,OAAO"}
package/dist/index.mjs CHANGED
@@ -26,14 +26,14 @@ const plugin = (options = {}) => {
26
26
  return {
27
27
  name: "automd",
28
28
  async config() {
29
- const config = await loadConfig$1(joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot), options);
29
+ const config = await loadConfig$1(joinPaths(this.workspaceConfig.workspaceRoot, this.config.root), options);
30
30
  if (!config.prefix || !Array.isArray(config.prefix)) config.prefix = toArray(config.prefix ?? []);
31
31
  if (!config.prefix.includes("automd")) config.prefix.push("automd");
32
32
  if (!config.prefix.includes("powerlines")) config.prefix.push("powerlines");
33
33
  return { automd: defu(config ?? {}, {
34
34
  configFile: options.configFile,
35
35
  allowIssues: true,
36
- dir: this.config.projectRoot,
36
+ dir: this.config.root,
37
37
  watch: false,
38
38
  input: "README.md",
39
39
  toc: {
@@ -63,16 +63,16 @@ const plugin = (options = {}) => {
63
63
  }));
64
64
  }
65
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.projectRoot), { ignore: this.config.automd.ignore });
67
- return isAbsolutePath(input) ? input : appendPath(input, this.config.projectRoot);
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
68
  }))).flat();
69
- if (this.config.automd.output && !isAbsolutePath(this.config.automd.output)) this.config.automd.output = appendPath(this.config.automd.output, this.config.projectRoot);
69
+ if (this.config.automd.output && !isAbsolutePath(this.config.automd.output)) this.config.automd.output = appendPath(this.config.automd.output, this.config.root);
70
70
  this.config.automd.generators ??= {};
71
71
  if (this.config.automd.toc !== false) this.config.automd.generators.toc ??= {
72
72
  name: "toc",
73
73
  generate: (ctx) => {
74
74
  const opts = this.config.automd.toc ?? {};
75
- return { contents: toc(ctx.block.md, {
75
+ return { contents: toc(ctx.block.contents, {
76
76
  ...opts,
77
77
  maxdepth: opts.maxDepth,
78
78
  first1: opts.firstH1
@@ -86,7 +86,7 @@ const plugin = (options = {}) => {
86
86
  if (contents) {
87
87
  const result = await transform(contents, this.config.automd);
88
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.projectRoot), result.contents);
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
90
  }
91
91
  }));
92
92
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["loadConfig","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 { Plugin } from \"powerlines/types/plugin\";\nimport {\n AutoMDPluginContext,\n AutoMDPluginOptions,\n AutoMDPluginUserConfig\n} from \"./types/plugin\";\nimport { TOCOptions } from \"./types/toc\";\n\nexport * from \"./types\";\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.workspaceConfig.workspaceRoot, this.config.projectRoot),\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.projectRoot,\n watch: false,\n input: \"README.md\",\n toc: {\n maxDepth: 6,\n bullets: \"-\"\n }\n })\n } as Partial<AutoMDPluginUserConfig>;\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.projectRoot),\n {\n ignore: this.config.automd.ignore\n }\n );\n }\n\n return isAbsolutePath(input)\n ? input\n : appendPath(input, this.config.projectRoot);\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.projectRoot\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.md, {\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.projectRoot\n ),\n result.contents\n );\n }\n }\n })\n );\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAa,UAGX,UAA+B,EAAE,KACZ;AACrB,QAAO;EACL,MAAM;EACN,MAAM,SAAS;GACb,MAAM,SAAS,MAAMA,aACnB,UAAU,KAAK,gBAAgB,eAAe,KAAK,OAAO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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 {\n AutoMDPluginContext,\n AutoMDPluginOptions,\n AutoMDPluginUserConfig\n} from \"./types/plugin\";\nimport { TOCOptions } from \"./types/toc\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n export interface UserConfig {\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.workspaceConfig.workspaceRoot, 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 } as Partial<AutoMDPluginUserConfig>;\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":";;;;;;;;;;;;;;;;;;;;;;;;AA+DA,MAAa,UAGX,UAA+B,EAAE,KACZ;AACrB,QAAO;EACL,MAAM;EACN,MAAM,SAAS;GACb,MAAM,SAAS,MAAMA,aACnB,UAAU,KAAK,gBAAgB,eAAe,KAAK,OAAO,KAAK,EAC/D,QACD;AAED,OAAI,CAAC,OAAO,UAAU,CAAC,MAAM,QAAQ,OAAO,OAAO,CACjD,QAAO,SAAS,QAAQ,OAAO,UAAU,EAAE,CAAC;AAG9C,OAAI,CAAC,OAAO,OAAO,SAAS,SAAS,CACnC,QAAO,OAAO,KAAK,SAAS;AAE9B,OAAI,CAAC,OAAO,OAAO,SAAS,aAAa,CACvC,QAAO,OAAO,KAAK,aAAa;AAGlC,UAAO,EACL,QAAQ,KAAK,UAAU,EAAE,EAAE;IACzB,YAAY,QAAQ;IACpB,aAAa;IACb,KAAK,KAAK,OAAO;IACjB,OAAO;IACP,OAAO;IACP,KAAK;KACH,UAAU;KACV,SAAS;KACV;IACF,CAAC,EACH;;EAEH,MAAM,iBAAiB;AACrB,OACE,KAAK,OAAO,aACZ,CAAC,QAAQ,KAAK,OAAO,OAAO,OAAO,CAAC,SAAS,KAAK,OAAO,UAAU,CAEnE,MAAK,OAAO,OAAO,SAAS,QAAQ,KAAK,OAAO,OAAO,OAAO,CAAC,OAC7D,KAA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Q,KAAK,OAAO,OAAO,MAAM,CAAC,IAAI,OAAM,UAAS;IACnD,MAAM,WAAW,MAAM,KAAK,GAAG,KAAK,MAAM;AAC1C,QAAI,UAAU;KACZ,MAAM,SAAS,MAAM,UAAU,UAAU,KAAK,OAAO,OAAO;AAC5D,SAAI,OAAO,aAAa,KAAK,OAAO,OAAO,gBAAgB,MACzD,OAAM,IAAI,MACR,gCACE,MACD,yGACF;AAGH,SAAI,OAAO,WACT,OAAM,KAAK,GAAG,MACZ,WACE,KAAK,OAAO,OAAO,SACf,YAAY,KAAK,OAAO,OAAO,OAAO,GACpC,YAAY,OAAO,KAAK,OAAO,OAAO,OAAO,GAC7C,KAAK,OAAO,OAAO,SACrB,OACJ,KAAK,OAAO,KACb,EACD,OAAO,SACR;;KAGL,CACH;;EAEJ;;AAGH,kBAAe"}
@@ -1,8 +1,6 @@
1
1
  import { TOCOptions } from "./toc.cjs";
2
+ import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
2
3
  import { Config } from "automd";
3
- import { UserConfig } from "powerlines/types/config";
4
- import { PluginContext } from "powerlines/types/context";
5
- import { ResolvedConfig } from "powerlines/types/resolved";
6
4
 
7
5
  //#region src/types/plugin.d.ts
8
6
  type AutoMDPluginOptions = Omit<Config, "dir" | "watch" | "onWatch" | "prefix"> & {
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;KAwBY,mBAAA,GAAsB,KAChC;;AADF;;;;;EAsCY,UAAA,CAAA,EAAA,MAAA;EAAyB;;;;;EAKzB,WAAA,CAAA,EAAA,OAAA;EAA6B;;;;;AAKzC;;;EAGkB,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA;EAAd;;;;;;gBAhBY;;KAGJ,sBAAA,GAAyB;WAC1B,SACP,KAAK;;KAGG,0BAAA,GAA6B;UAC/B,SACN,KAAK;;KAGG,4CACc,6BACtB,8BACA,cAAc"}
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;KAsBY,mBAAA,GAAsB,KAChC;;AADF;;;;;EAsCY,UAAA,CAAA,EAAA,MAAA;EAAyB;;;;;EAKzB,WAAA,CAAA,EAAA,OAAA;EAA6B;;;;;AAKzC;;;EAGkB,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA;EAAd;;;;;;gBAhBY;;KAGJ,sBAAA,GAAyB;WAC1B,SACP,KAAK;;KAGG,0BAAA,GAA6B;UAC/B,SACN,KAAK;;KAGG,4CACc,6BACtB,8BACA,cAAc"}
@@ -1,8 +1,6 @@
1
1
  import { TOCOptions } from "./toc.mjs";
2
+ import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
2
3
  import { Config } from "automd";
3
- import { UserConfig } from "powerlines/types/config";
4
- import { PluginContext } from "powerlines/types/context";
5
- import { ResolvedConfig } from "powerlines/types/resolved";
6
4
 
7
5
  //#region src/types/plugin.d.ts
8
6
  type AutoMDPluginOptions = Omit<Config, "dir" | "watch" | "onWatch" | "prefix"> & {
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;KAwBY,mBAAA,GAAsB,KAChC;;AADF;;;;;EAsCY,UAAA,CAAA,EAAA,MAAA;EAAyB;;;;;EAKzB,WAAA,CAAA,EAAA,OAAA;EAA6B;;;;;AAKzC;;;EAGkB,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA;EAAd;;;;;;gBAhBY;;KAGJ,sBAAA,GAAyB;WAC1B,SACP,KAAK;;KAGG,0BAAA,GAA6B;UAC/B,SACN,KAAK;;KAGG,4CACc,6BACtB,8BACA,cAAc"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;KAsBY,mBAAA,GAAsB,KAChC;;AADF;;;;;EAsCY,UAAA,CAAA,EAAA,MAAA;EAAyB;;;;;EAKzB,WAAA,CAAA,EAAA,OAAA;EAA6B;;;;;AAKzC;;;EAGkB,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA;EAAd;;;;;;gBAhBY;;KAGJ,sBAAA,GAAyB;WAC1B,SACP,KAAK;;KAGG,0BAAA,GAA6B;UAC/B,SACN,KAAK;;KAGG,4CACc,6BACtB,8BACA,cAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-automd",
3
- "version": "0.1.289",
3
+ "version": "0.1.291",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin to maintain a project's markdown files using AutoMD generators.",
6
6
  "repository": {
@@ -55,7 +55,7 @@
55
55
  "default": "./dist/index.mjs"
56
56
  }
57
57
  },
58
- "./package.json": "./package.json",
58
+ "./*": "./*",
59
59
  "./types": {
60
60
  "require": {
61
61
  "types": "./dist/types/index.d.cts",
@@ -111,14 +111,13 @@
111
111
  "@stryke/types": "^0.10.39",
112
112
  "c12": "^3.3.3",
113
113
  "defu": "^6.1.4",
114
- "markdown-toc": "^1.2.0",
115
- "powerlines": "^0.38.56"
114
+ "markdown-toc": "^1.2.0"
116
115
  },
117
116
  "devDependencies": {
118
- "@powerlines/plugin-plugin": "^0.12.240",
119
- "@types/node": "^25.3.0",
117
+ "@powerlines/plugin-plugin": "^0.12.242",
118
+ "@types/node": "^25.3.2",
120
119
  "automd": "^0.4.3"
121
120
  },
122
121
  "publishConfig": { "access": "public" },
123
- "gitHead": "256020b11a6afd9decac143ca57eaba68d102906"
122
+ "gitHead": "0dcb16f054b8a69915b074578e6d4dfa3ecc1529"
124
123
  }