@powerlines/plugin-automd 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var toArray=require('@stryke/convert/to-array'),isFile=require('@stryke/fs/is-file'),listFiles=require('@stryke/fs/list-files'),append=require('@stryke/path/append'),isType=require('@stryke/path/is-type'),joinPaths=require('@stryke/path/join-paths'),replace=require('@stryke/path/replace'),automd=require('automd'),c12=require('c12'),f=require('defu'),C=require('markdown-toc'),types=require('./types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var f__default=/*#__PURE__*/_interopDefault(f);var C__default=/*#__PURE__*/_interopDefault(C);/*****************************************
2
+ *
3
+ * ⚡ Built by Storm Software
4
+ *
5
+ *****************************************/
6
+
7
+ var u=Object.defineProperty;var r=(i,o)=>u(i,"name",{value:o,configurable:true});const w=r((i={})=>({name:"automd",async config(){const o=await automd.loadConfig(joinPaths.joinPaths(this.workspaceConfig.workspaceRoot,this.config.projectRoot),i);return (!o.prefix||!Array.isArray(o.prefix))&&(o.prefix=toArray.toArray(o.prefix??[])),o.prefix.includes("automd")||o.prefix.push("automd"),o.prefix.includes("powerlines")||o.prefix.push("powerlines"),{automd:f__default.default(o??{},{configFile:i.configFile,allowIssues:true,dir:this.config.projectRoot,watch:false,input:"README.md",toc:{maxDepth:6,bullets:"-"}})}},async configResolved(){if(this.config.automd.configFile){const{config:o}=await c12.loadConfig({cwd:this.config.automd.dir,configFile:this.config.automd.configFile,defaults:{ignore:["**/node_modules","**/dist","**/.*"],dir:this.config.automd.dir}});this.config.automd=automd.resolveConfig(f__default.default(this.config.automd,{...o,prefix:toArray.toArray(o.prefix??[])}));}this.config.automd.input=(await Promise.all(toArray.toArray(this.config.automd.input).map(async o=>o.includes("*")?listFiles.listFiles(isType.isAbsolutePath(o)?o:append.appendPath(o,this.config.projectRoot),{ignore:this.config.automd.ignore}):isType.isAbsolutePath(o)?o:append.appendPath(o,this.config.projectRoot)))).flat(),this.config.automd.output&&!isType.isAbsolutePath(this.config.automd.output)&&(this.config.automd.output=append.appendPath(this.config.automd.output,this.config.projectRoot)),this.config.automd.generators??={},this.config.automd.toc!==false&&(this.config.automd.generators.toc??={name:"toc",generate:r(o=>{const t=this.config.automd.toc??{};return {contents:C__default.default(o.block.md,{...t,maxdepth:t.maxDepth,firsth1:t.firstH1}).content}},"generate")});},async docs(){await Promise.all(toArray.toArray(this.config.automd.input).map(async o=>{const t=await this.fs.readFile(o);if(t){const n=await automd.transform(t,this.config.automd);if(n.hasIssues&&this.config.automd.allowIssues===false)throw new Error(`AutoMD found issues in file "${o}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);n.hasChanged&&await this.fs.writeFile(append.appendPath(this.config.automd.output?isFile.isDirectory(this.config.automd.output)?replace.replacePath(o,this.config.automd.output):this.config.automd.output:o,this.config.projectRoot),n.contents,{mode:"fs"});}}));}}),"plugin");var K=w;exports.default=K;exports.plugin=w;Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
@@ -0,0 +1,39 @@
1
+ import { A as AutoMDPluginContext, a as AutoMDPluginOptions, P as Plugin } from '../index-DOPvmpxM.cjs';
2
+ export { c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from '../index-DOPvmpxM.cjs';
3
+ export { TOCOptions } from '../types/toc.cjs';
4
+ import 'automd';
5
+ import '@storm-software/build-tools/types';
6
+ import '@storm-software/config-tools/types';
7
+ import '@storm-software/config/types';
8
+ import '@stryke/types/base';
9
+ import '@stryke/types/configuration';
10
+ import '@stryke/types/file';
11
+ import 'vite';
12
+ import '@stryke/env/get-env-paths';
13
+ import '@stryke/types/package-json';
14
+ import 'jiti';
15
+ import 'oxc-parser';
16
+ import 'semver';
17
+ import 'unplugin';
18
+ import '@stryke/types/tsconfig';
19
+ import 'typescript';
20
+ import '@stryke/json/types';
21
+ import 'memfs';
22
+ import 'node:fs';
23
+ import 'unionfs';
24
+ import '@stryke/types/array';
25
+
26
+ /**
27
+ * AutoMD Plugin
28
+ *
29
+ * @remarks
30
+ * A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.
31
+ *
32
+ * @see https://automd.unjs.io/
33
+ *
34
+ * @param options - The plugin options.
35
+ * @returns A Powerlines plugin instance.
36
+ */
37
+ declare const plugin: <TContext extends AutoMDPluginContext = AutoMDPluginContext>(options?: AutoMDPluginOptions) => Plugin<TContext>;
38
+
39
+ export { AutoMDPluginContext, AutoMDPluginOptions, plugin as default, plugin };
@@ -0,0 +1,39 @@
1
+ import { A as AutoMDPluginContext, a as AutoMDPluginOptions, P as Plugin } from '../index-4ixdjnnj.js';
2
+ export { c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from '../index-4ixdjnnj.js';
3
+ export { TOCOptions } from '../types/toc.js';
4
+ import 'automd';
5
+ import '@storm-software/build-tools/types';
6
+ import '@storm-software/config-tools/types';
7
+ import '@storm-software/config/types';
8
+ import '@stryke/types/base';
9
+ import '@stryke/types/configuration';
10
+ import '@stryke/types/file';
11
+ import 'vite';
12
+ import '@stryke/env/get-env-paths';
13
+ import '@stryke/types/package-json';
14
+ import 'jiti';
15
+ import 'oxc-parser';
16
+ import 'semver';
17
+ import 'unplugin';
18
+ import '@stryke/types/tsconfig';
19
+ import 'typescript';
20
+ import '@stryke/json/types';
21
+ import 'memfs';
22
+ import 'node:fs';
23
+ import 'unionfs';
24
+ import '@stryke/types/array';
25
+
26
+ /**
27
+ * AutoMD Plugin
28
+ *
29
+ * @remarks
30
+ * A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.
31
+ *
32
+ * @see https://automd.unjs.io/
33
+ *
34
+ * @param options - The plugin options.
35
+ * @returns A Powerlines plugin instance.
36
+ */
37
+ declare const plugin: <TContext extends AutoMDPluginContext = AutoMDPluginContext>(options?: AutoMDPluginOptions) => Plugin<TContext>;
38
+
39
+ export { AutoMDPluginContext, AutoMDPluginOptions, plugin as default, plugin };
@@ -0,0 +1,7 @@
1
+ import {toArray}from'@stryke/convert/to-array';import {isDirectory}from'@stryke/fs/is-file';import {listFiles}from'@stryke/fs/list-files';import {appendPath}from'@stryke/path/append';import {isAbsolutePath}from'@stryke/path/is-type';import {joinPaths}from'@stryke/path/join-paths';import {replacePath}from'@stryke/path/replace';import {transform,resolveConfig,loadConfig as loadConfig$1}from'automd';import {loadConfig}from'c12';import f from'defu';import C from'markdown-toc';export*from'./types';/*****************************************
2
+ *
3
+ * ⚡ Built by Storm Software
4
+ *
5
+ *****************************************/
6
+
7
+ var u=Object.defineProperty;var r=(i,o)=>u(i,"name",{value:o,configurable:true});const w=r((i={})=>({name:"automd",async config(){const o=await loadConfig$1(joinPaths(this.workspaceConfig.workspaceRoot,this.config.projectRoot),i);return (!o.prefix||!Array.isArray(o.prefix))&&(o.prefix=toArray(o.prefix??[])),o.prefix.includes("automd")||o.prefix.push("automd"),o.prefix.includes("powerlines")||o.prefix.push("powerlines"),{automd:f(o??{},{configFile:i.configFile,allowIssues:true,dir:this.config.projectRoot,watch:false,input:"README.md",toc:{maxDepth:6,bullets:"-"}})}},async configResolved(){if(this.config.automd.configFile){const{config:o}=await loadConfig({cwd:this.config.automd.dir,configFile:this.config.automd.configFile,defaults:{ignore:["**/node_modules","**/dist","**/.*"],dir:this.config.automd.dir}});this.config.automd=resolveConfig(f(this.config.automd,{...o,prefix:toArray(o.prefix??[])}));}this.config.automd.input=(await Promise.all(toArray(this.config.automd.input).map(async o=>o.includes("*")?listFiles(isAbsolutePath(o)?o:appendPath(o,this.config.projectRoot),{ignore:this.config.automd.ignore}):isAbsolutePath(o)?o:appendPath(o,this.config.projectRoot)))).flat(),this.config.automd.output&&!isAbsolutePath(this.config.automd.output)&&(this.config.automd.output=appendPath(this.config.automd.output,this.config.projectRoot)),this.config.automd.generators??={},this.config.automd.toc!==false&&(this.config.automd.generators.toc??={name:"toc",generate:r(o=>{const t=this.config.automd.toc??{};return {contents:C(o.block.md,{...t,maxdepth:t.maxDepth,firsth1:t.firstH1}).content}},"generate")});},async docs(){await Promise.all(toArray(this.config.automd.input).map(async o=>{const t=await this.fs.readFile(o);if(t){const n=await transform(t,this.config.automd);if(n.hasIssues&&this.config.automd.allowIssues===false)throw new Error(`AutoMD found issues in file "${o}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);n.hasChanged&&await this.fs.writeFile(appendPath(this.config.automd.output?isDirectory(this.config.automd.output)?replacePath(o,this.config.automd.output):this.config.automd.output:o,this.config.projectRoot),n.contents,{mode:"fs"});}}));}}),"plugin");var L=w;export{L as default,w as plugin};
@@ -0,0 +1 @@
1
+ 'use strict';var plugin=require('./plugin'),toc=require('./toc');Object.keys(plugin).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return plugin[k]}})});Object.keys(toc).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return toc[k]}})});
@@ -0,0 +1,23 @@
1
+ export { A as AutoMDPluginContext, a as AutoMDPluginOptions, c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from '../index-DOPvmpxM.cjs';
2
+ export { TOCOptions } from './toc.cjs';
3
+ import 'automd';
4
+ import '@storm-software/build-tools/types';
5
+ import '@storm-software/config-tools/types';
6
+ import '@storm-software/config/types';
7
+ import '@stryke/types/base';
8
+ import '@stryke/types/configuration';
9
+ import '@stryke/types/file';
10
+ import 'vite';
11
+ import '@stryke/env/get-env-paths';
12
+ import '@stryke/types/package-json';
13
+ import 'jiti';
14
+ import 'oxc-parser';
15
+ import 'semver';
16
+ import 'unplugin';
17
+ import '@stryke/types/tsconfig';
18
+ import 'typescript';
19
+ import '@stryke/json/types';
20
+ import 'memfs';
21
+ import 'node:fs';
22
+ import 'unionfs';
23
+ import '@stryke/types/array';
@@ -0,0 +1,23 @@
1
+ export { A as AutoMDPluginContext, a as AutoMDPluginOptions, c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from '../index-4ixdjnnj.js';
2
+ export { TOCOptions } from './toc.js';
3
+ import 'automd';
4
+ import '@storm-software/build-tools/types';
5
+ import '@storm-software/config-tools/types';
6
+ import '@storm-software/config/types';
7
+ import '@stryke/types/base';
8
+ import '@stryke/types/configuration';
9
+ import '@stryke/types/file';
10
+ import 'vite';
11
+ import '@stryke/env/get-env-paths';
12
+ import '@stryke/types/package-json';
13
+ import 'jiti';
14
+ import 'oxc-parser';
15
+ import 'semver';
16
+ import 'unplugin';
17
+ import '@stryke/types/tsconfig';
18
+ import 'typescript';
19
+ import '@stryke/json/types';
20
+ import 'memfs';
21
+ import 'node:fs';
22
+ import 'unionfs';
23
+ import '@stryke/types/array';
@@ -0,0 +1 @@
1
+ export*from'./plugin';export*from'./toc';
@@ -0,0 +1 @@
1
+ 'use strict';
@@ -0,0 +1,23 @@
1
+ import 'automd';
2
+ export { A as AutoMDPluginContext, a as AutoMDPluginOptions, c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from '../index-DOPvmpxM.cjs';
3
+ import './toc.cjs';
4
+ import '@storm-software/build-tools/types';
5
+ import '@storm-software/config-tools/types';
6
+ import '@storm-software/config/types';
7
+ import '@stryke/types/base';
8
+ import '@stryke/types/configuration';
9
+ import '@stryke/types/file';
10
+ import 'vite';
11
+ import '@stryke/env/get-env-paths';
12
+ import '@stryke/types/package-json';
13
+ import 'jiti';
14
+ import 'oxc-parser';
15
+ import 'semver';
16
+ import 'unplugin';
17
+ import '@stryke/types/tsconfig';
18
+ import 'typescript';
19
+ import '@stryke/json/types';
20
+ import 'memfs';
21
+ import 'node:fs';
22
+ import 'unionfs';
23
+ import '@stryke/types/array';
@@ -0,0 +1,23 @@
1
+ import 'automd';
2
+ export { A as AutoMDPluginContext, a as AutoMDPluginOptions, c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from '../index-4ixdjnnj.js';
3
+ import './toc.js';
4
+ import '@storm-software/build-tools/types';
5
+ import '@storm-software/config-tools/types';
6
+ import '@storm-software/config/types';
7
+ import '@stryke/types/base';
8
+ import '@stryke/types/configuration';
9
+ import '@stryke/types/file';
10
+ import 'vite';
11
+ import '@stryke/env/get-env-paths';
12
+ import '@stryke/types/package-json';
13
+ import 'jiti';
14
+ import 'oxc-parser';
15
+ import 'semver';
16
+ import 'unplugin';
17
+ import '@stryke/types/tsconfig';
18
+ import 'typescript';
19
+ import '@stryke/json/types';
20
+ import 'memfs';
21
+ import 'node:fs';
22
+ import 'unionfs';
23
+ import '@stryke/types/array';
File without changes
@@ -0,0 +1 @@
1
+ 'use strict';
@@ -0,0 +1,32 @@
1
+ interface TOCOptions {
2
+ /**
3
+ * A slugify function to generate slugs for the headings.
4
+ */
5
+ slugify?: (str: string) => string;
6
+ /**
7
+ * The maximum depth of headings to include in the TOC.
8
+ *
9
+ * @defaultValue 6
10
+ */
11
+ maxDepth?: number;
12
+ /**
13
+ * Whether to include the first H1 heading in the TOC.
14
+ */
15
+ firstH1?: boolean;
16
+ /**
17
+ * The bullet character to use for list items in the TOC.
18
+ *
19
+ * @defaultValue "-"
20
+ */
21
+ bullets?: string;
22
+ /**
23
+ * A prefix to add to each heading in the TOC.
24
+ */
25
+ prefix?: string;
26
+ /**
27
+ * A filter function to determine which headings to include in the TOC.
28
+ */
29
+ filter?: (str: string, level: number) => boolean;
30
+ }
31
+
32
+ export type { TOCOptions };
@@ -0,0 +1,32 @@
1
+ interface TOCOptions {
2
+ /**
3
+ * A slugify function to generate slugs for the headings.
4
+ */
5
+ slugify?: (str: string) => string;
6
+ /**
7
+ * The maximum depth of headings to include in the TOC.
8
+ *
9
+ * @defaultValue 6
10
+ */
11
+ maxDepth?: number;
12
+ /**
13
+ * Whether to include the first H1 heading in the TOC.
14
+ */
15
+ firstH1?: boolean;
16
+ /**
17
+ * The bullet character to use for list items in the TOC.
18
+ *
19
+ * @defaultValue "-"
20
+ */
21
+ bullets?: string;
22
+ /**
23
+ * A prefix to add to each heading in the TOC.
24
+ */
25
+ prefix?: string;
26
+ /**
27
+ * A filter function to determine which headings to include in the TOC.
28
+ */
29
+ filter?: (str: string, level: number) => boolean;
30
+ }
31
+
32
+ export type { TOCOptions };
File without changes
package/package.json ADDED
@@ -0,0 +1,120 @@
1
+ {
2
+ "name": "@powerlines/plugin-automd",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "A Powerlines plugin to maintain a project's markdown files using AutoMD generators.",
6
+ "repository": {
7
+ "type": "github",
8
+ "url": "https://github.com/storm-software/powerlines.git",
9
+ "directory": "packages/plugin-automd"
10
+ },
11
+ "homepage": "https://stormsoftware.com",
12
+ "bugs": {
13
+ "url": "https://stormsoftware.com/support",
14
+ "email": "support@stormsoftware.com"
15
+ },
16
+ "author": {
17
+ "name": "Storm Software",
18
+ "email": "contact@stormsoftware.com",
19
+ "url": "https://stormsoftware.com"
20
+ },
21
+ "maintainers": [
22
+ {
23
+ "name": "Storm Software",
24
+ "email": "contact@stormsoftware.com",
25
+ "url": "https://stormsoftware.com"
26
+ }
27
+ ],
28
+ "contributors": [
29
+ {
30
+ "name": "Storm Software",
31
+ "email": "contact@stormsoftware.com",
32
+ "url": "https://stormsoftware.com"
33
+ }
34
+ ],
35
+ "funding": {
36
+ "type": "github",
37
+ "url": "https://github.com/sponsors/storm-software"
38
+ },
39
+ "license": "Apache-2.0",
40
+ "private": false,
41
+ "main": "dist/index.cjs",
42
+ "module": "dist/index.js",
43
+ "exports": {
44
+ "./package.json": "./package.json",
45
+ ".": {
46
+ "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
47
+ "require": {
48
+ "types": "./dist/index.d.cts",
49
+ "default": "./dist/index.cjs"
50
+ },
51
+ "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
52
+ },
53
+ "./index": {
54
+ "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
55
+ "require": {
56
+ "types": "./dist/index.d.cts",
57
+ "default": "./dist/index.cjs"
58
+ },
59
+ "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
60
+ },
61
+ "./plugin": {
62
+ "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
63
+ "require": {
64
+ "types": "./dist/index.d.cts",
65
+ "default": "./dist/index.cjs"
66
+ },
67
+ "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
68
+ },
69
+ "./types": {
70
+ "import": {
71
+ "types": "./dist/types/index.d.ts",
72
+ "default": "./dist/types/index.js"
73
+ },
74
+ "require": {
75
+ "types": "./dist/types/index.d.cts",
76
+ "default": "./dist/types/index.cjs"
77
+ },
78
+ "default": {
79
+ "types": "./dist/types/index.d.ts",
80
+ "default": "./dist/types/index.js"
81
+ }
82
+ },
83
+ "./types/*": {
84
+ "import": {
85
+ "types": "./dist/types/*.d.ts",
86
+ "default": "./dist/types/*.js"
87
+ },
88
+ "require": {
89
+ "types": "./dist/types/*.d.cts",
90
+ "default": "./dist/types/*.cjs"
91
+ },
92
+ "default": {
93
+ "types": "./dist/types/*.d.ts",
94
+ "default": "./dist/types/*.js"
95
+ }
96
+ }
97
+ },
98
+ "typings": "dist/index.d.ts",
99
+ "files": ["dist/**/*"],
100
+ "keywords": ["automd", "powerlines", "storm-software", "powerlines-plugin"],
101
+ "dependencies": {
102
+ "@stryke/convert": "^0.6.0",
103
+ "@stryke/fs": "^0.32.10",
104
+ "@stryke/path": "^0.18.5",
105
+ "@stryke/type-checks": "^0.3.10",
106
+ "@stryke/types": "^0.10.0",
107
+ "c12": "^3.3.1",
108
+ "defu": "^6.1.4",
109
+ "markdown-toc": "^1.2.0",
110
+ "powerlines": "^0.15.0"
111
+ },
112
+ "devDependencies": {
113
+ "@powerlines/nx": "^0.10.0",
114
+ "@powerlines/plugin-plugin": "^0.11.8",
115
+ "@types/node": "^22.19.0",
116
+ "automd": "^0.4.2"
117
+ },
118
+ "publishConfig": { "access": "public" },
119
+ "gitHead": "b64f9a9d53b6eb8054c361da347f6623a7ba9e45"
120
+ }