@powerlines/plugin-automd 0.1.116 → 0.1.118

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.
@@ -1 +1,29 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
1
+ //#region rolldown:runtime
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,103 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/convert/to-array`),n=require(`@stryke/fs/is-file`),r=require(`@stryke/fs/list-files`),i=require(`@stryke/path/append`),a=require(`@stryke/path/is-type`),o=require(`@stryke/path/join-paths`),s=require(`@stryke/path/replace`),c=require(`automd`),l=require(`c12`),u=require(`defu`);u=e.__toESM(u);let d=require(`markdown-toc`);d=e.__toESM(d);const f=(e={})=>({name:`automd`,async config(){let n=await(0,c.loadConfig)((0,o.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot),e);return(!n.prefix||!Array.isArray(n.prefix))&&(n.prefix=(0,t.toArray)(n.prefix??[])),n.prefix.includes(`automd`)||n.prefix.push(`automd`),n.prefix.includes(`powerlines`)||n.prefix.push(`powerlines`),{automd:(0,u.default)(n??{},{configFile:e.configFile,allowIssues:!0,dir:this.config.projectRoot,watch:!1,input:`README.md`,toc:{maxDepth:6,bullets:`-`}})}},async configResolved(){if(this.config.framework&&!(0,t.toArray)(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=(0,t.toArray)(this.config.automd.prefix).concat(this.config.framework)),this.config.automd.configFile){let{config:e}=await(0,l.loadConfig)({cwd:this.config.automd.dir,configFile:this.config.automd.configFile,defaults:{ignore:[`**/node_modules`,`**/dist`,`**/.*`],dir:this.config.automd.dir}});this.config.automd=(0,c.resolveConfig)((0,u.default)(this.config.automd,{...e,prefix:(0,t.toArray)(e.prefix??[])}))}this.config.automd.input=(await Promise.all((0,t.toArray)(this.config.automd.input).map(async e=>e.includes(`*`)?(0,r.listFiles)((0,a.isAbsolutePath)(e)?e:(0,i.appendPath)(e,this.config.projectRoot),{ignore:this.config.automd.ignore}):(0,a.isAbsolutePath)(e)?e:(0,i.appendPath)(e,this.config.projectRoot)))).flat(),this.config.automd.output&&!(0,a.isAbsolutePath)(this.config.automd.output)&&(this.config.automd.output=(0,i.appendPath)(this.config.automd.output,this.config.projectRoot)),this.config.automd.generators??={},this.config.automd.toc!==!1&&(this.config.automd.generators.toc??={name:`toc`,generate:e=>{let t=this.config.automd.toc??{};return{contents:(0,d.default)(e.block.md,{...t,maxdepth:t.maxDepth,first1:t.firstH1}).content}}})},async docs(){await Promise.all((0,t.toArray)(this.config.automd.input).map(async e=>{let t=await this.fs.read(e);if(t){let r=await(0,c.transform)(t,this.config.automd);if(r.hasIssues&&this.config.automd.allowIssues===!1)throw Error(`AutoMD found issues in file "${e}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);r.hasChanged&&await this.fs.write((0,i.appendPath)(this.config.automd.output?(0,n.isDirectory)(this.config.automd.output)?(0,s.replacePath)(e,this.config.automd.output):this.config.automd.output:e,this.config.projectRoot),r.contents)}}))}});var p=f;exports.default=p,exports.plugin=f;
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ const require_rolldown_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_rolldown_runtime.__toESM(defu);
14
+ let markdown_toc = require("markdown-toc");
15
+ markdown_toc = require_rolldown_runtime.__toESM(markdown_toc);
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.workspaceConfig.workspaceRoot, this.config.projectRoot), 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.projectRoot,
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.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);
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);
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.md, {
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.projectRoot), result.contents);
94
+ }
95
+ }));
96
+ }
97
+ };
98
+ };
99
+ var src_default = plugin;
100
+
101
+ //#endregion
102
+ exports.default = src_default;
103
+ exports.plugin = plugin;
package/dist/index.mjs CHANGED
@@ -1 +1,98 @@
1
- import{toArray as e}from"@stryke/convert/to-array";import{isDirectory as t}from"@stryke/fs/is-file";import{listFiles as n}from"@stryke/fs/list-files";import{appendPath as r}from"@stryke/path/append";import{isAbsolutePath as i}from"@stryke/path/is-type";import{joinPaths as a}from"@stryke/path/join-paths";import{replacePath as o}from"@stryke/path/replace";import{loadConfig as s,resolveConfig as c,transform as l}from"automd";import{loadConfig as u}from"c12";import d from"defu";import f from"markdown-toc";const p=(p={})=>({name:`automd`,async config(){let t=await s(a(this.workspaceConfig.workspaceRoot,this.config.projectRoot),p);return(!t.prefix||!Array.isArray(t.prefix))&&(t.prefix=e(t.prefix??[])),t.prefix.includes(`automd`)||t.prefix.push(`automd`),t.prefix.includes(`powerlines`)||t.prefix.push(`powerlines`),{automd:d(t??{},{configFile:p.configFile,allowIssues:!0,dir:this.config.projectRoot,watch:!1,input:`README.md`,toc:{maxDepth:6,bullets:`-`}})}},async configResolved(){if(this.config.framework&&!e(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=e(this.config.automd.prefix).concat(this.config.framework)),this.config.automd.configFile){let{config:t}=await u({cwd:this.config.automd.dir,configFile:this.config.automd.configFile,defaults:{ignore:[`**/node_modules`,`**/dist`,`**/.*`],dir:this.config.automd.dir}});this.config.automd=c(d(this.config.automd,{...t,prefix:e(t.prefix??[])}))}this.config.automd.input=(await Promise.all(e(this.config.automd.input).map(async e=>e.includes(`*`)?n(i(e)?e:r(e,this.config.projectRoot),{ignore:this.config.automd.ignore}):i(e)?e:r(e,this.config.projectRoot)))).flat(),this.config.automd.output&&!i(this.config.automd.output)&&(this.config.automd.output=r(this.config.automd.output,this.config.projectRoot)),this.config.automd.generators??={},this.config.automd.toc!==!1&&(this.config.automd.generators.toc??={name:`toc`,generate:e=>{let t=this.config.automd.toc??{};return{contents:f(e.block.md,{...t,maxdepth:t.maxDepth,first1:t.firstH1}).content}}})},async docs(){await Promise.all(e(this.config.automd.input).map(async e=>{let n=await this.fs.read(e);if(n){let i=await l(n,this.config.automd);if(i.hasIssues&&this.config.automd.allowIssues===!1)throw Error(`AutoMD found issues in file "${e}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);i.hasChanged&&await this.fs.write(r(this.config.automd.output?t(this.config.automd.output)?o(e,this.config.automd.output):this.config.automd.output:e,this.config.projectRoot),i.contents)}}))}});var m=p;export{m as default,p as plugin};
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.workspaceConfig.workspaceRoot, this.config.projectRoot), 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.projectRoot,
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.projectRoot), { ignore: this.config.automd.ignore });
67
+ return isAbsolutePath(input) ? input : appendPath(input, this.config.projectRoot);
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);
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.md, {
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.projectRoot), result.contents);
90
+ }
91
+ }));
92
+ }
93
+ };
94
+ };
95
+ var src_default = plugin;
96
+
97
+ //#endregion
98
+ export { src_default as default, plugin };
@@ -78,10 +78,18 @@ interface ParseOptions extends ParserOptions {
78
78
  */
79
79
  allowReturnOutsideFunction?: boolean;
80
80
  }
81
+ interface EmitOptions extends WriteOptions {
82
+ /**
83
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
84
+ */
85
+ emitWithBundler?: boolean;
86
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
87
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
88
+ }
81
89
  /**
82
90
  * Options for emitting entry virtual files
83
91
  */
84
- type EmitEntryOptions = WriteOptions & Omit<ResolvedEntryTypeDefinition, "file">;
92
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
85
93
  /**
86
94
  * The unresolved Powerlines context.
87
95
  *
@@ -292,6 +300,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
292
300
  * The Powerlines builtin virtual files
293
301
  */
294
302
  getBuiltins: () => Promise<VirtualFile[]>;
303
+ /**
304
+ * Resolves a file and writes it to the VFS if it does not already exist
305
+ *
306
+ * @param code - The source code of the file
307
+ * @param path - The path to write the file to
308
+ * @param options - Additional options for writing the file
309
+ */
310
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
311
+ /**
312
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
313
+ *
314
+ * @param code - The source code of the file
315
+ * @param path - The path to write the file to
316
+ * @param options - Additional options for writing the file
317
+ */
318
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
295
319
  /**
296
320
  * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
297
321
  *
@@ -300,7 +324,16 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
300
324
  * @param path - An optional path to write the builtin file to
301
325
  * @param options - Additional options for writing the builtin file
302
326
  */
303
- emitBuiltin: (code: string, id: string, path?: string, options?: WriteOptions) => Promise<void>;
327
+ emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
328
+ /**
329
+ * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
330
+ *
331
+ * @param code - The source code of the builtin file
332
+ * @param id - The unique identifier of the builtin file
333
+ * @param path - An optional path to write the builtin file to
334
+ * @param options - Additional options for writing the builtin file
335
+ */
336
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
304
337
  /**
305
338
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
306
339
  *
@@ -309,6 +342,14 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
309
342
  * @param options - Additional options for writing the entry file
310
343
  */
311
344
  emitEntry: (code: string, path: string, options?: EmitEntryOptions) => Promise<void>;
345
+ /**
346
+ * Synchronously resolves a entry virtual file and writes it to the VFS if it does not already exist
347
+ *
348
+ * @param code - The source code of the entry file
349
+ * @param path - An optional path to write the entry file to
350
+ * @param options - Additional options for writing the entry file
351
+ */
352
+ emitEntrySync: (code: string, path: string, options?: EmitEntryOptions) => void;
312
353
  /**
313
354
  * A function to update the context fields using a new user configuration options
314
355
  */
@@ -80,10 +80,18 @@ interface ParseOptions extends ParserOptions {
80
80
  */
81
81
  allowReturnOutsideFunction?: boolean;
82
82
  }
83
+ interface EmitOptions extends WriteOptions {
84
+ /**
85
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
86
+ */
87
+ emitWithBundler?: boolean;
88
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
89
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
90
+ }
83
91
  /**
84
92
  * Options for emitting entry virtual files
85
93
  */
86
- type EmitEntryOptions = WriteOptions & Omit<ResolvedEntryTypeDefinition, "file">;
94
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
87
95
  /**
88
96
  * The unresolved Powerlines context.
89
97
  *
@@ -294,6 +302,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
294
302
  * The Powerlines builtin virtual files
295
303
  */
296
304
  getBuiltins: () => Promise<VirtualFile[]>;
305
+ /**
306
+ * Resolves a file and writes it to the VFS if it does not already exist
307
+ *
308
+ * @param code - The source code of the file
309
+ * @param path - The path to write the file to
310
+ * @param options - Additional options for writing the file
311
+ */
312
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
313
+ /**
314
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
315
+ *
316
+ * @param code - The source code of the file
317
+ * @param path - The path to write the file to
318
+ * @param options - Additional options for writing the file
319
+ */
320
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
297
321
  /**
298
322
  * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
299
323
  *
@@ -302,7 +326,16 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
302
326
  * @param path - An optional path to write the builtin file to
303
327
  * @param options - Additional options for writing the builtin file
304
328
  */
305
- emitBuiltin: (code: string, id: string, path?: string, options?: WriteOptions) => Promise<void>;
329
+ emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
330
+ /**
331
+ * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
332
+ *
333
+ * @param code - The source code of the builtin file
334
+ * @param id - The unique identifier of the builtin file
335
+ * @param path - An optional path to write the builtin file to
336
+ * @param options - Additional options for writing the builtin file
337
+ */
338
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
306
339
  /**
307
340
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
308
341
  *
@@ -311,6 +344,14 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
311
344
  * @param options - Additional options for writing the entry file
312
345
  */
313
346
  emitEntry: (code: string, path: string, options?: EmitEntryOptions) => Promise<void>;
347
+ /**
348
+ * Synchronously resolves a entry virtual file and writes it to the VFS if it does not already exist
349
+ *
350
+ * @param code - The source code of the entry file
351
+ * @param path - An optional path to write the entry file to
352
+ * @param options - Additional options for writing the entry file
353
+ */
354
+ emitEntrySync: (code: string, path: string, options?: EmitEntryOptions) => void;
314
355
  /**
315
356
  * A function to update the context fields using a new user configuration options
316
357
  */
@@ -13,6 +13,13 @@ interface StorageAdapter {
13
13
  * A name identifying the storage adapter type.
14
14
  */
15
15
  name: string;
16
+ /**
17
+ * The storage preset for the adapter.
18
+ *
19
+ * @remarks
20
+ * This can be used as an alternate way to identify the type of storage being used.
21
+ */
22
+ preset?: StoragePreset | null;
16
23
  /**
17
24
  * Checks if a key exists in the storage.
18
25
  *
@@ -207,6 +214,13 @@ interface WriteOptions {
207
214
  * @defaultValue false
208
215
  */
209
216
  skipFormat?: boolean;
217
+ /**
218
+ * The storage preset or adapter name for the output file.
219
+ *
220
+ * @remarks
221
+ * If not specified, the output mode will be determined by the provided `output.mode` value.
222
+ */
223
+ storage?: StoragePreset | string;
210
224
  /**
211
225
  * Additional metadata for the file.
212
226
  */
@@ -13,6 +13,13 @@ interface StorageAdapter {
13
13
  * A name identifying the storage adapter type.
14
14
  */
15
15
  name: string;
16
+ /**
17
+ * The storage preset for the adapter.
18
+ *
19
+ * @remarks
20
+ * This can be used as an alternate way to identify the type of storage being used.
21
+ */
22
+ preset?: StoragePreset | null;
16
23
  /**
17
24
  * Checks if a key exists in the storage.
18
25
  *
@@ -207,6 +214,13 @@ interface WriteOptions {
207
214
  * @defaultValue false
208
215
  */
209
216
  skipFormat?: boolean;
217
+ /**
218
+ * The storage preset or adapter name for the output file.
219
+ *
220
+ * @remarks
221
+ * If not specified, the output mode will be determined by the provided `output.mode` value.
222
+ */
223
+ storage?: StoragePreset | string;
210
224
  /**
211
225
  * Additional metadata for the file.
212
226
  */
@@ -1 +1 @@
1
- export{};
1
+ export { };
@@ -1 +1 @@
1
- export{};
1
+ export { };
@@ -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.116",
3
+ "version": "0.1.118",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin to maintain a project's markdown files using AutoMD generators.",
6
6
  "repository": {
@@ -117,22 +117,22 @@
117
117
  "files": ["dist/**/*"],
118
118
  "keywords": ["automd", "powerlines", "storm-software", "powerlines-plugin"],
119
119
  "dependencies": {
120
- "@stryke/convert": "^0.6.29",
121
- "@stryke/fs": "^0.33.26",
122
- "@stryke/path": "^0.24.0",
123
- "@stryke/type-checks": "^0.5.14",
124
- "@stryke/types": "^0.10.28",
120
+ "@stryke/convert": "^0.6.30",
121
+ "@stryke/fs": "^0.33.27",
122
+ "@stryke/path": "^0.24.1",
123
+ "@stryke/type-checks": "^0.5.15",
124
+ "@stryke/types": "^0.10.29",
125
125
  "c12": "^3.3.3",
126
126
  "defu": "^6.1.4",
127
127
  "markdown-toc": "^1.2.0",
128
- "powerlines": "^0.36.21"
128
+ "powerlines": "^0.36.23"
129
129
  },
130
130
  "devDependencies": {
131
- "@powerlines/nx": "^0.11.47",
132
- "@powerlines/plugin-plugin": "^0.12.68",
131
+ "@powerlines/nx": "^0.11.49",
132
+ "@powerlines/plugin-plugin": "^0.12.70",
133
133
  "@types/node": "^24.10.4",
134
134
  "automd": "^0.4.2"
135
135
  },
136
136
  "publishConfig": { "access": "public" },
137
- "gitHead": "b16324cf857ea5743fd7ad06e18607b1ba32abe0"
137
+ "gitHead": "be47e546b48b9a82e460b5c5d4f02fb66e821f18"
138
138
  }