@powerlines/plugin-env 0.15.4 → 0.15.6

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.
Files changed (264) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/babel/index.cjs +1 -0
  3. package/dist/babel/index.d.cts +1 -0
  4. package/dist/babel/index.d.mts +1 -0
  5. package/dist/babel/index.mjs +3 -0
  6. package/dist/babel/plugin.cjs +200 -0
  7. package/dist/babel/plugin.d.cts +8 -0
  8. package/dist/babel/plugin.d.mts +9 -0
  9. package/dist/babel/plugin.mjs +198 -0
  10. package/dist/components/docs.cjs +70 -3
  11. package/dist/components/docs.d.cts +8 -1
  12. package/dist/components/docs.d.mts +8 -1
  13. package/dist/components/docs.mjs +68 -2
  14. package/dist/components/env.cjs +574 -4
  15. package/dist/components/env.d.cts +19 -2
  16. package/dist/components/env.d.mts +19 -3
  17. package/dist/components/env.mjs +570 -2
  18. package/dist/components/index.cjs +5 -7
  19. package/dist/components/index.d.cts +2 -4
  20. package/dist/components/index.d.mts +2 -5
  21. package/dist/components/index.mjs +2 -4
  22. package/dist/deepkit/schemas/reflection.cjs +5368 -0
  23. package/dist/{plugin-BwuEBScL.d.cts → deepkit/schemas/reflection.d.cts} +1 -268
  24. package/dist/{plugin-BaInAuAh.d.mts → deepkit/schemas/reflection.d.mts} +59 -326
  25. package/dist/deepkit/schemas/reflection.mjs +5365 -0
  26. package/dist/deepkit/schemas/reflection2.cjs +4112 -0
  27. package/dist/deepkit/schemas/reflection2.mjs +4110 -0
  28. package/dist/deepkit/src/capnp.cjs +1692 -0
  29. package/dist/deepkit/src/capnp.mjs +1690 -0
  30. package/dist/deepkit/src/esbuild-plugin.cjs +99 -0
  31. package/dist/deepkit/src/esbuild-plugin.mjs +98 -0
  32. package/dist/deepkit/src/reflect-type.cjs +40 -0
  33. package/dist/deepkit/src/reflect-type.mjs +38 -0
  34. package/dist/deepkit/src/resolve-reflections.cjs +23 -0
  35. package/dist/deepkit/src/resolve-reflections.mjs +22 -0
  36. package/dist/deepkit/src/transformer.cjs +92 -0
  37. package/dist/deepkit/src/transformer.mjs +89 -0
  38. package/dist/deepkit/src/transpile.cjs +39 -0
  39. package/dist/deepkit/src/transpile.mjs +37 -0
  40. package/dist/deepkit/src/types.cjs +22 -0
  41. package/dist/deepkit/src/types.d.cts +10 -0
  42. package/dist/deepkit/src/types.d.mts +10 -0
  43. package/dist/deepkit/src/types.mjs +21 -0
  44. package/dist/deepkit/src/utilities.cjs +182 -0
  45. package/dist/deepkit/src/utilities.mjs +181 -0
  46. package/dist/helpers/automd-generator.cjs +32 -0
  47. package/dist/helpers/automd-generator.mjs +31 -0
  48. package/dist/helpers/create-reflection-resource.cjs +98 -0
  49. package/dist/helpers/create-reflection-resource.d.cts +15 -0
  50. package/dist/helpers/create-reflection-resource.d.mts +15 -0
  51. package/dist/helpers/create-reflection-resource.mjs +97 -0
  52. package/dist/helpers/index.cjs +6 -0
  53. package/dist/helpers/index.d.cts +6 -0
  54. package/dist/helpers/index.d.mts +6 -0
  55. package/dist/helpers/index.mjs +8 -0
  56. package/dist/helpers/load.cjs +134 -0
  57. package/dist/helpers/load.d.cts +35 -0
  58. package/dist/helpers/load.d.mts +36 -0
  59. package/dist/helpers/load.mjs +131 -0
  60. package/dist/helpers/persistence.cjs +320 -0
  61. package/dist/helpers/persistence.d.cts +84 -0
  62. package/dist/helpers/persistence.d.mts +84 -0
  63. package/dist/helpers/persistence.mjs +308 -0
  64. package/dist/helpers/reflect.cjs +263 -0
  65. package/dist/helpers/reflect.d.cts +46 -0
  66. package/dist/helpers/reflect.d.mts +46 -0
  67. package/dist/helpers/reflect.mjs +254 -0
  68. package/dist/helpers/source-file-env.cjs +58 -0
  69. package/dist/helpers/source-file-env.d.cts +8 -0
  70. package/dist/helpers/source-file-env.d.mts +8 -0
  71. package/dist/helpers/source-file-env.mjs +56 -0
  72. package/dist/helpers/template-helpers.cjs +70 -0
  73. package/dist/helpers/template-helpers.d.cts +15 -0
  74. package/dist/helpers/template-helpers.d.mts +15 -0
  75. package/dist/helpers/template-helpers.mjs +69 -0
  76. package/dist/index.cjs +82 -696
  77. package/dist/index.d.cts +16 -185
  78. package/dist/index.d.mts +17 -190
  79. package/dist/index.mjs +31 -648
  80. package/dist/plugin-alloy/src/core/components/output.cjs +45 -0
  81. package/dist/plugin-alloy/src/core/components/output.mjs +44 -0
  82. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +22 -0
  83. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +21 -0
  84. package/dist/plugin-alloy/src/core/components/source-file.cjs +64 -0
  85. package/dist/plugin-alloy/src/core/components/source-file.d.cts +23 -0
  86. package/dist/plugin-alloy/src/core/components/source-file.d.mts +23 -0
  87. package/dist/plugin-alloy/src/core/components/source-file.mjs +62 -0
  88. package/dist/plugin-alloy/src/core/contexts/context.cjs +136 -0
  89. package/dist/plugin-alloy/src/core/contexts/context.mjs +128 -0
  90. package/dist/plugin-alloy/src/core/contexts/index.cjs +2 -0
  91. package/dist/plugin-alloy/src/core/contexts/index.mjs +4 -0
  92. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +110 -0
  93. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +101 -0
  94. package/dist/plugin-alloy/src/helpers/refkey.cjs +23 -0
  95. package/dist/plugin-alloy/src/helpers/refkey.mjs +22 -0
  96. package/dist/plugin-alloy/src/index.cjs +93 -0
  97. package/dist/plugin-alloy/src/index.mjs +91 -0
  98. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +115 -0
  99. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +114 -0
  100. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +39 -0
  101. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +38 -0
  102. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +72 -0
  103. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +71 -0
  104. package/dist/plugin-alloy/src/types/components.cjs +22 -0
  105. package/dist/plugin-alloy/src/types/components.d.cts +22 -0
  106. package/dist/{components-8W0Zgj0y.d.mts → plugin-alloy/src/types/components.d.mts} +2 -1
  107. package/dist/plugin-alloy/src/types/components.mjs +21 -0
  108. package/dist/plugin-alloy/src/types/index.d.mts +2 -0
  109. package/dist/plugin-alloy/src/types/plugin.cjs +55 -0
  110. package/dist/plugin-alloy/src/types/plugin.d.cts +37 -0
  111. package/dist/plugin-alloy/src/types/plugin.d.mts +37 -0
  112. package/dist/plugin-alloy/src/types/plugin.mjs +52 -0
  113. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +57 -0
  114. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +25 -0
  115. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +26 -0
  116. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +56 -0
  117. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +126 -0
  118. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +124 -0
  119. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +442 -0
  120. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +27 -0
  121. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +28 -0
  122. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +433 -0
  123. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +194 -0
  124. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +14 -0
  125. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +15 -0
  126. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +191 -0
  127. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +68 -0
  128. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +11 -0
  129. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +12 -0
  130. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +67 -0
  131. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +124 -0
  132. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +123 -0
  133. package/dist/plugin-automd/src/index.cjs +127 -0
  134. package/dist/plugin-automd/src/index.mjs +124 -0
  135. package/dist/plugin-automd/src/types/plugin.cjs +47 -0
  136. package/dist/plugin-automd/src/types/plugin.d.cts +38 -0
  137. package/dist/plugin-automd/src/types/plugin.d.mts +40 -0
  138. package/dist/plugin-automd/src/types/plugin.mjs +47 -0
  139. package/dist/plugin-automd/src/types/toc.cjs +26 -0
  140. package/dist/plugin-automd/src/types/toc.d.cts +33 -0
  141. package/dist/plugin-automd/src/types/toc.d.mts +33 -0
  142. package/dist/plugin-automd/src/types/toc.mjs +25 -0
  143. package/dist/plugin-babel/src/helpers/ast-utils.cjs +74 -0
  144. package/dist/plugin-babel/src/helpers/ast-utils.mjs +70 -0
  145. package/dist/plugin-babel/src/helpers/create-plugin.cjs +71 -0
  146. package/dist/plugin-babel/src/helpers/create-plugin.mjs +69 -0
  147. package/dist/plugin-babel/src/helpers/filters.cjs +158 -0
  148. package/dist/plugin-babel/src/helpers/filters.mjs +154 -0
  149. package/dist/plugin-babel/src/helpers/index.cjs +5 -0
  150. package/dist/plugin-babel/src/helpers/index.mjs +7 -0
  151. package/dist/plugin-babel/src/helpers/module-helpers.cjs +200 -0
  152. package/dist/plugin-babel/src/helpers/module-helpers.mjs +192 -0
  153. package/dist/plugin-babel/src/helpers/options.cjs +74 -0
  154. package/dist/plugin-babel/src/helpers/options.mjs +71 -0
  155. package/dist/plugin-babel/src/index.cjs +134 -0
  156. package/dist/plugin-babel/src/index.mjs +132 -0
  157. package/dist/plugin-babel/src/types/index.d.mts +1 -0
  158. package/dist/plugin-babel/src/types/plugin.cjs +42 -0
  159. package/dist/plugin-babel/src/types/plugin.d.cts +15 -0
  160. package/dist/plugin-babel/src/types/plugin.d.mts +15 -0
  161. package/dist/plugin-babel/src/types/plugin.mjs +39 -0
  162. package/dist/powerlines/schemas/fs.d.mts +1 -0
  163. package/dist/powerlines/src/api.d.mts +7 -0
  164. package/dist/powerlines/src/index.d.mts +12 -0
  165. package/dist/powerlines/src/internal/helpers/hooks.cjs +119 -0
  166. package/dist/powerlines/src/internal/helpers/hooks.d.mts +5 -0
  167. package/dist/powerlines/src/internal/helpers/hooks.mjs +118 -0
  168. package/dist/powerlines/src/lib/build/esbuild.cjs +161 -0
  169. package/dist/powerlines/src/lib/build/esbuild.mjs +159 -0
  170. package/dist/powerlines/src/lib/entry.cjs +203 -0
  171. package/dist/powerlines/src/lib/entry.mjs +201 -0
  172. package/dist/powerlines/src/lib/logger.cjs +108 -0
  173. package/dist/powerlines/src/lib/logger.mjs +106 -0
  174. package/dist/powerlines/src/lib/utilities/bundle.cjs +67 -0
  175. package/dist/powerlines/src/lib/utilities/bundle.mjs +66 -0
  176. package/dist/powerlines/src/lib/utilities/resolve.cjs +49 -0
  177. package/dist/powerlines/src/lib/utilities/resolve.mjs +48 -0
  178. package/dist/powerlines/src/plugin-utils/paths.cjs +46 -0
  179. package/dist/powerlines/src/plugin-utils/paths.mjs +45 -0
  180. package/dist/powerlines/src/types/api.cjs +1 -0
  181. package/dist/powerlines/src/types/api.d.mts +5 -0
  182. package/dist/powerlines/src/types/api.mjs +3 -0
  183. package/dist/powerlines/src/types/babel.cjs +156 -0
  184. package/dist/powerlines/src/types/babel.d.cts +23 -0
  185. package/dist/powerlines/src/types/babel.d.mts +23 -0
  186. package/dist/powerlines/src/types/babel.mjs +147 -0
  187. package/dist/powerlines/src/types/build.cjs +105 -0
  188. package/dist/powerlines/src/types/build.d.cts +145 -0
  189. package/dist/powerlines/src/types/build.d.mts +147 -0
  190. package/dist/powerlines/src/types/build.mjs +101 -0
  191. package/dist/powerlines/src/types/commands.cjs +16 -0
  192. package/dist/powerlines/src/types/commands.d.cts +8 -0
  193. package/dist/powerlines/src/types/commands.d.mts +9 -0
  194. package/dist/powerlines/src/types/commands.mjs +15 -0
  195. package/dist/powerlines/src/types/config.cjs +306 -0
  196. package/dist/powerlines/src/types/config.d.cts +387 -0
  197. package/dist/powerlines/src/types/config.d.mts +388 -0
  198. package/dist/powerlines/src/types/config.mjs +293 -0
  199. package/dist/powerlines/src/types/context.cjs +324 -0
  200. package/dist/powerlines/src/types/context.d.cts +414 -0
  201. package/dist/powerlines/src/types/context.d.mts +416 -0
  202. package/dist/powerlines/src/types/context.mjs +311 -0
  203. package/dist/powerlines/src/types/fs.cjs +78 -0
  204. package/dist/powerlines/src/types/fs.d.cts +486 -0
  205. package/dist/powerlines/src/types/fs.d.mts +486 -0
  206. package/dist/powerlines/src/types/fs.mjs +75 -0
  207. package/dist/powerlines/src/types/hooks.cjs +52 -0
  208. package/dist/powerlines/src/types/hooks.d.mts +2 -0
  209. package/dist/powerlines/src/types/hooks.mjs +48 -0
  210. package/dist/powerlines/src/types/index.cjs +11 -0
  211. package/dist/powerlines/src/types/index.d.mts +12 -0
  212. package/dist/powerlines/src/types/index.mjs +13 -0
  213. package/dist/powerlines/src/types/plugin.cjs +249 -0
  214. package/dist/powerlines/src/types/plugin.d.cts +231 -0
  215. package/dist/powerlines/src/types/plugin.d.mts +231 -0
  216. package/dist/powerlines/src/types/plugin.mjs +240 -0
  217. package/dist/powerlines/src/types/resolved.cjs +153 -0
  218. package/dist/powerlines/src/types/resolved.d.cts +82 -0
  219. package/dist/powerlines/src/types/resolved.d.mts +83 -0
  220. package/dist/powerlines/src/types/resolved.mjs +148 -0
  221. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  222. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  223. package/dist/powerlines/src/types/unplugin.cjs +1 -0
  224. package/dist/powerlines/src/types/unplugin.d.mts +7 -0
  225. package/dist/powerlines/src/types/unplugin.mjs +3 -0
  226. package/dist/types/index.cjs +10 -3
  227. package/dist/types/index.d.cts +2 -4
  228. package/dist/types/index.d.mts +2 -5
  229. package/dist/types/index.mjs +3 -4
  230. package/dist/types/plugin.cjs +133 -1
  231. package/dist/types/plugin.d.cts +156 -3
  232. package/dist/types/plugin.d.mts +158 -4
  233. package/dist/types/plugin.mjs +128 -2
  234. package/dist/types/runtime.cjs +242 -1
  235. package/dist/types/runtime.d.cts +793 -2
  236. package/dist/types/runtime.d.mts +793 -2
  237. package/dist/types/runtime.mjs +240 -2
  238. package/package.json +13 -9
  239. package/dist/components-C9bYrQVK.cjs +0 -0
  240. package/dist/components-CNIQFfeK.mjs +0 -1
  241. package/dist/create-reflection-resource-BNYxBgW2.mjs +0 -9846
  242. package/dist/create-reflection-resource-BWYhmX7O.cjs +0 -10085
  243. package/dist/docs-5r844zC1.d.mts +0 -9
  244. package/dist/docs-B66b9li3.mjs +0 -219
  245. package/dist/docs-_MmTNBQX.d.cts +0 -9
  246. package/dist/docs-hBlKCRWK.cjs +0 -224
  247. package/dist/env-BPodCdD1.d.cts +0 -116
  248. package/dist/env-IQvgnabX.mjs +0 -1578
  249. package/dist/env-cO4BUDn1.cjs +0 -1596
  250. package/dist/env-zhzvpUI5.d.mts +0 -98
  251. package/dist/index-BXxhKmeA.d.mts +0 -1
  252. package/dist/index-Cc7fCJU9.d.mts +0 -1
  253. package/dist/index-CqdNToYT.d.cts +0 -1
  254. package/dist/index-DWPDThxu.d.cts +0 -1
  255. package/dist/plugin-D3B5E_Hg.mjs +0 -1
  256. package/dist/plugin-D5qyQPqC.cjs +0 -0
  257. package/dist/resolved-BZG2cwRG.d.cts +0 -1789
  258. package/dist/resolved-V5COsfDu.d.mts +0 -1791
  259. package/dist/runtime-Bisl_1Ja.cjs +0 -0
  260. package/dist/runtime-Q8Ni8SeN.d.cts +0 -794
  261. package/dist/runtime-azNoeKr-.mjs +0 -1
  262. package/dist/runtime-qZ0Z2kEd.d.mts +0 -794
  263. package/dist/types-DwElXV6q.mjs +0 -1
  264. package/dist/types-MYBaygjr.cjs +0 -0
@@ -0,0 +1,127 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_toc = require('./types/toc.cjs');
3
+ const require_plugin = require('./types/plugin.cjs');
4
+ const require_plugin$1 = require('../../powerlines/src/types/plugin.cjs');
5
+ let __stryke_path_replace = require("@stryke/path/replace");
6
+ let __stryke_convert_to_array = require("@stryke/convert/to-array");
7
+ let __stryke_fs_is_file = require("@stryke/fs/is-file");
8
+ let __stryke_fs_list_files = require("@stryke/fs/list-files");
9
+ let __stryke_path_append = require("@stryke/path/append");
10
+ let __stryke_path_is_type = require("@stryke/path/is-type");
11
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
12
+ let automd = require("automd");
13
+ let c12 = require("c12");
14
+ let defu = require("defu");
15
+ defu = require_rolldown_runtime.__toESM(defu);
16
+ let markdown_toc = require("markdown-toc");
17
+ markdown_toc = require_rolldown_runtime.__toESM(markdown_toc);
18
+
19
+ //#region ../plugin-automd/src/index.ts
20
+ function __assignType(fn, args) {
21
+ fn.__type = args;
22
+ return fn;
23
+ }
24
+ /**
25
+ * AutoMD Plugin
26
+ *
27
+ * @remarks
28
+ * A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.
29
+ *
30
+ * @see https://automd.unjs.io/
31
+ *
32
+ * @param options - The plugin options.
33
+ * @returns A Powerlines plugin instance.
34
+ */
35
+ const plugin = __assignType((options = {}) => {
36
+ return {
37
+ name: "automd",
38
+ config: __assignType(async function config() {
39
+ const config$1 = await (0, automd.loadConfig)((0, __stryke_path_join_paths.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot), options);
40
+ if (!config$1.prefix || !Array.isArray(config$1.prefix)) config$1.prefix = (0, __stryke_convert_to_array.toArray)(config$1.prefix ?? []);
41
+ if (!config$1.prefix.includes("automd")) config$1.prefix.push("automd");
42
+ if (!config$1.prefix.includes("powerlines")) config$1.prefix.push("powerlines");
43
+ return { automd: (0, defu.default)(config$1 ?? {}, {
44
+ configFile: options.configFile,
45
+ allowIssues: true,
46
+ dir: this.config.projectRoot,
47
+ watch: false,
48
+ input: "README.md",
49
+ toc: {
50
+ maxDepth: 6,
51
+ bullets: "-"
52
+ }
53
+ }) };
54
+ }, ["config", "P\"/!"]),
55
+ async configResolved() {
56
+ 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);
57
+ if (this.config.automd.configFile) {
58
+ const { config } = await (c12.loadConfig.Ω = [["!"]], (0, c12.loadConfig)({
59
+ cwd: this.config.automd.dir,
60
+ configFile: this.config.automd.configFile,
61
+ defaults: {
62
+ ignore: [
63
+ "**/node_modules",
64
+ "**/dist",
65
+ "**/.*"
66
+ ],
67
+ dir: this.config.automd.dir
68
+ }
69
+ }));
70
+ this.config.automd = (0, automd.resolveConfig)((0, defu.default)(this.config.automd, {
71
+ ...config,
72
+ prefix: (0, __stryke_convert_to_array.toArray)(config.prefix ?? [])
73
+ }));
74
+ }
75
+ this.config.automd.input = (await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.automd.input).map(__assignType(async (input) => {
76
+ 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 });
77
+ return (0, __stryke_path_is_type.isAbsolutePath)(input) ? input : (0, __stryke_path_append.appendPath)(input, this.config.projectRoot);
78
+ }, [
79
+ "input",
80
+ "",
81
+ "P\"2!\"/\""
82
+ ])))).flat();
83
+ 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);
84
+ this.config.automd.generators ??= {};
85
+ if (this.config.automd.toc !== false) this.config.automd.generators.toc ??= {
86
+ name: "toc",
87
+ generate: __assignType((ctx) => {
88
+ const opts = this.config.automd.toc ?? {};
89
+ return { contents: (0, markdown_toc.default)(ctx.block.md, {
90
+ ...opts,
91
+ maxdepth: opts.maxDepth,
92
+ first1: opts.firstH1
93
+ }).content };
94
+ }, [
95
+ "ctx",
96
+ "",
97
+ "P!2!!/\""
98
+ ])
99
+ };
100
+ },
101
+ async docs() {
102
+ await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.automd.input).map(__assignType(async (input) => {
103
+ const contents = await this.fs.read(input);
104
+ if (contents) {
105
+ const result = await (0, automd.transform)(contents, this.config.automd);
106
+ 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.`);
107
+ 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);
108
+ }
109
+ }, [
110
+ "input",
111
+ "",
112
+ "P\"2!\"/\""
113
+ ])));
114
+ }
115
+ };
116
+ }, [
117
+ () => require_plugin.__ΩAutoMDPluginOptions,
118
+ "options",
119
+ () => ({}),
120
+ () => require_plugin$1.__ΩPlugin,
121
+ "",
122
+ "Pn!2\">#\"o$\"/%"
123
+ ]);
124
+ var src_default = plugin;
125
+
126
+ //#endregion
127
+ exports.default = src_default;
@@ -0,0 +1,124 @@
1
+ import { __ΩTOCOptions } from "./types/toc.mjs";
2
+ import { __ΩAutoMDPluginOptions } from "./types/plugin.mjs";
3
+ import { __ΩPlugin } from "../../powerlines/src/types/plugin.mjs";
4
+ import { replacePath } from "@stryke/path/replace";
5
+ import { toArray } from "@stryke/convert/to-array";
6
+ import { isDirectory } from "@stryke/fs/is-file";
7
+ import { listFiles } from "@stryke/fs/list-files";
8
+ import { appendPath } from "@stryke/path/append";
9
+ import { isAbsolutePath } from "@stryke/path/is-type";
10
+ import { joinPaths } from "@stryke/path/join-paths";
11
+ import { loadConfig, resolveConfig, transform } from "automd";
12
+ import { loadConfig as loadConfig$1 } from "c12";
13
+ import defu$1 from "defu";
14
+ import toc from "markdown-toc";
15
+
16
+ //#region ../plugin-automd/src/index.ts
17
+ function __assignType(fn, args) {
18
+ fn.__type = args;
19
+ return fn;
20
+ }
21
+ /**
22
+ * AutoMD Plugin
23
+ *
24
+ * @remarks
25
+ * A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.
26
+ *
27
+ * @see https://automd.unjs.io/
28
+ *
29
+ * @param options - The plugin options.
30
+ * @returns A Powerlines plugin instance.
31
+ */
32
+ const plugin = __assignType((options = {}) => {
33
+ return {
34
+ name: "automd",
35
+ config: __assignType(async function config() {
36
+ const config$1 = await loadConfig(joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot), options);
37
+ if (!config$1.prefix || !Array.isArray(config$1.prefix)) config$1.prefix = toArray(config$1.prefix ?? []);
38
+ if (!config$1.prefix.includes("automd")) config$1.prefix.push("automd");
39
+ if (!config$1.prefix.includes("powerlines")) config$1.prefix.push("powerlines");
40
+ return { automd: defu$1(config$1 ?? {}, {
41
+ configFile: options.configFile,
42
+ allowIssues: true,
43
+ dir: this.config.projectRoot,
44
+ watch: false,
45
+ input: "README.md",
46
+ toc: {
47
+ maxDepth: 6,
48
+ bullets: "-"
49
+ }
50
+ }) };
51
+ }, ["config", "P\"/!"]),
52
+ async configResolved() {
53
+ 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);
54
+ if (this.config.automd.configFile) {
55
+ const { config } = await (loadConfig$1.Ω = [["!"]], loadConfig$1({
56
+ cwd: this.config.automd.dir,
57
+ configFile: this.config.automd.configFile,
58
+ defaults: {
59
+ ignore: [
60
+ "**/node_modules",
61
+ "**/dist",
62
+ "**/.*"
63
+ ],
64
+ dir: this.config.automd.dir
65
+ }
66
+ }));
67
+ this.config.automd = resolveConfig(defu$1(this.config.automd, {
68
+ ...config,
69
+ prefix: toArray(config.prefix ?? [])
70
+ }));
71
+ }
72
+ this.config.automd.input = (await Promise.all(toArray(this.config.automd.input).map(__assignType(async (input) => {
73
+ if (input.includes("*")) return listFiles(isAbsolutePath(input) ? input : appendPath(input, this.config.projectRoot), { ignore: this.config.automd.ignore });
74
+ return isAbsolutePath(input) ? input : appendPath(input, this.config.projectRoot);
75
+ }, [
76
+ "input",
77
+ "",
78
+ "P\"2!\"/\""
79
+ ])))).flat();
80
+ if (this.config.automd.output && !isAbsolutePath(this.config.automd.output)) this.config.automd.output = appendPath(this.config.automd.output, this.config.projectRoot);
81
+ this.config.automd.generators ??= {};
82
+ if (this.config.automd.toc !== false) this.config.automd.generators.toc ??= {
83
+ name: "toc",
84
+ generate: __assignType((ctx) => {
85
+ const opts = this.config.automd.toc ?? {};
86
+ return { contents: toc(ctx.block.md, {
87
+ ...opts,
88
+ maxdepth: opts.maxDepth,
89
+ first1: opts.firstH1
90
+ }).content };
91
+ }, [
92
+ "ctx",
93
+ "",
94
+ "P!2!!/\""
95
+ ])
96
+ };
97
+ },
98
+ async docs() {
99
+ await Promise.all(toArray(this.config.automd.input).map(__assignType(async (input) => {
100
+ const contents = await this.fs.read(input);
101
+ if (contents) {
102
+ const result = await transform(contents, this.config.automd);
103
+ 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.`);
104
+ 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);
105
+ }
106
+ }, [
107
+ "input",
108
+ "",
109
+ "P\"2!\"/\""
110
+ ])));
111
+ }
112
+ };
113
+ }, [
114
+ () => __ΩAutoMDPluginOptions,
115
+ "options",
116
+ () => ({}),
117
+ () => __ΩPlugin,
118
+ "",
119
+ "Pn!2\">#\"o$\"/%"
120
+ ]);
121
+ var src_default = plugin;
122
+
123
+ //#endregion
124
+ export { src_default as default };
@@ -0,0 +1,47 @@
1
+ const require_toc = require('./toc.cjs');
2
+
3
+ //#region ../plugin-automd/src/types/plugin.ts
4
+ const __ΩOmit = [
5
+ "T",
6
+ "K",
7
+ () => __ΩPick,
8
+ () => __ΩExclude,
9
+ "Omit",
10
+ "b!b\"e!!e!!ge!\"o$#o##w%y"
11
+ ];
12
+ const __ΩPick = [
13
+ "T",
14
+ "K",
15
+ "Pick",
16
+ "l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
17
+ ];
18
+ const __ΩExclude = [
19
+ "T",
20
+ "U",
21
+ "Exclude",
22
+ "l6!Re$!RPe#!e$\"qk#%QRb!b\"Pde\"!p)w#y"
23
+ ];
24
+ const __ΩAutoMDPluginOptions = [
25
+ () => __ΩOmit,
26
+ "dir",
27
+ "watch",
28
+ "onWatch",
29
+ "prefix",
30
+ "configFile",
31
+ "Path to the AutoMD configuration file.",
32
+ "allowIssues",
33
+ true,
34
+ "An indicator specifying whether or not issues found by AutoMD during the prepare task are considered fatal.",
35
+ "prefix",
36
+ "[\"automd\", \"powerlines\", \"\\{framework\\}\"]",
37
+ "Alternate prefix strings to use for finding generators",
38
+ false,
39
+ () => require_toc.__ΩTOCOptions,
40
+ "toc",
41
+ "Table of Contents generator options",
42
+ "AutoMDPluginOptions",
43
+ "P!P.\".#.$.%Jo!#P&4&8?')4(8>)?*P&&FJ4+8>,?-P..n/J408?1MKw2y"
44
+ ];
45
+
46
+ //#endregion
47
+ exports.__ΩAutoMDPluginOptions = __ΩAutoMDPluginOptions;
@@ -0,0 +1,38 @@
1
+ import { TOCOptions } from "./toc.cjs";
2
+ import { Config } from "automd";
3
+
4
+ //#region ../plugin-automd/src/types/plugin.d.ts
5
+
6
+ type AutoMDPluginOptions = Omit<Config, "dir" | "watch" | "onWatch" | "prefix"> & {
7
+ /**
8
+ * Path to the AutoMD configuration file.
9
+ *
10
+ * @remarks
11
+ * If not provided, the plugin will use the default AutoMD configuration resolution mechanism.
12
+ */
13
+ configFile?: string;
14
+ /**
15
+ * An indicator specifying whether or not issues found by AutoMD during the prepare task are considered fatal.
16
+ *
17
+ * @defaultValue true
18
+ */
19
+ allowIssues?: boolean;
20
+ /**
21
+ * Alternate prefix strings to use for finding generators
22
+ *
23
+ * @remarks
24
+ * By default, AutoMD looks for generators with the "automd" prefix, so that any `<!-- automd:generator [...args] --> ... <!-- /automd -->` comments will be picked up. If you want to use different prefixes (for example, to avoid conflicts with other tools), you would provide a value like "myPrefix" and AutoMD would also look for `<!-- myPrefix:generator [...args] --> ... <!-- /myPrefix -->` comments.
25
+ *
26
+ * @defaultValue ["automd", "powerlines", "\{framework\}"]
27
+ */
28
+ prefix?: string | string[];
29
+ /**
30
+ * Table of Contents generator options
31
+ *
32
+ * @remarks
33
+ * If set to `false`, the built-in Table of Contents generator will be disabled.
34
+ */
35
+ toc?: false | TOCOptions;
36
+ };
37
+ //#endregion
38
+ export { AutoMDPluginOptions };
@@ -0,0 +1,40 @@
1
+ import "../../../powerlines/src/types/context.mjs";
2
+ import "../../../powerlines/src/types/config.mjs";
3
+ import "../../../powerlines/src/types/resolved.mjs";
4
+ import { TOCOptions } from "./toc.mjs";
5
+ import { Config } from "automd";
6
+
7
+ //#region ../plugin-automd/src/types/plugin.d.ts
8
+ type AutoMDPluginOptions = Omit<Config, "dir" | "watch" | "onWatch" | "prefix"> & {
9
+ /**
10
+ * Path to the AutoMD configuration file.
11
+ *
12
+ * @remarks
13
+ * If not provided, the plugin will use the default AutoMD configuration resolution mechanism.
14
+ */
15
+ configFile?: string;
16
+ /**
17
+ * An indicator specifying whether or not issues found by AutoMD during the prepare task are considered fatal.
18
+ *
19
+ * @defaultValue true
20
+ */
21
+ allowIssues?: boolean;
22
+ /**
23
+ * Alternate prefix strings to use for finding generators
24
+ *
25
+ * @remarks
26
+ * By default, AutoMD looks for generators with the "automd" prefix, so that any `<!-- automd:generator [...args] --> ... <!-- /automd -->` comments will be picked up. If you want to use different prefixes (for example, to avoid conflicts with other tools), you would provide a value like "myPrefix" and AutoMD would also look for `<!-- myPrefix:generator [...args] --> ... <!-- /myPrefix -->` comments.
27
+ *
28
+ * @defaultValue ["automd", "powerlines", "\{framework\}"]
29
+ */
30
+ prefix?: string | string[];
31
+ /**
32
+ * Table of Contents generator options
33
+ *
34
+ * @remarks
35
+ * If set to `false`, the built-in Table of Contents generator will be disabled.
36
+ */
37
+ toc?: false | TOCOptions;
38
+ };
39
+ //#endregion
40
+ export { AutoMDPluginOptions };
@@ -0,0 +1,47 @@
1
+ import { __ΩTOCOptions } from "./toc.mjs";
2
+
3
+ //#region ../plugin-automd/src/types/plugin.ts
4
+ const __ΩOmit = [
5
+ "T",
6
+ "K",
7
+ () => __ΩPick,
8
+ () => __ΩExclude,
9
+ "Omit",
10
+ "b!b\"e!!e!!ge!\"o$#o##w%y"
11
+ ];
12
+ const __ΩPick = [
13
+ "T",
14
+ "K",
15
+ "Pick",
16
+ "l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
17
+ ];
18
+ const __ΩExclude = [
19
+ "T",
20
+ "U",
21
+ "Exclude",
22
+ "l6!Re$!RPe#!e$\"qk#%QRb!b\"Pde\"!p)w#y"
23
+ ];
24
+ const __ΩAutoMDPluginOptions = [
25
+ () => __ΩOmit,
26
+ "dir",
27
+ "watch",
28
+ "onWatch",
29
+ "prefix",
30
+ "configFile",
31
+ "Path to the AutoMD configuration file.",
32
+ "allowIssues",
33
+ true,
34
+ "An indicator specifying whether or not issues found by AutoMD during the prepare task are considered fatal.",
35
+ "prefix",
36
+ "[\"automd\", \"powerlines\", \"\\{framework\\}\"]",
37
+ "Alternate prefix strings to use for finding generators",
38
+ false,
39
+ () => __ΩTOCOptions,
40
+ "toc",
41
+ "Table of Contents generator options",
42
+ "AutoMDPluginOptions",
43
+ "P!P.\".#.$.%Jo!#P&4&8?')4(8>)?*P&&FJ4+8>,?-P..n/J408?1MKw2y"
44
+ ];
45
+
46
+ //#endregion
47
+ export { __ΩAutoMDPluginOptions };
@@ -0,0 +1,26 @@
1
+
2
+ //#region ../plugin-automd/src/types/toc.ts
3
+ const __ΩTOCOptions = [
4
+ "str",
5
+ "",
6
+ "slugify",
7
+ "A slugify function to generate slugs for the headings.",
8
+ "maxDepth",
9
+ 6,
10
+ "The maximum depth of headings to include in the TOC.",
11
+ "firstH1",
12
+ "Whether to include the first H1 heading in the TOC.",
13
+ "bullets",
14
+ "-",
15
+ "The bullet character to use for list items in the TOC.",
16
+ "prefix",
17
+ "A prefix to add to each heading in the TOC.",
18
+ "level",
19
+ "filter",
20
+ "A filter function to determine which headings to include in the TOC.",
21
+ "TOCOptions",
22
+ "PP&2!&/\"4#8?$'4%8>&?')4(8?)&4*8>+?,&4-8?.P&2!'2/)/\"408?1Mw2y"
23
+ ];
24
+
25
+ //#endregion
26
+ exports.__ΩTOCOptions = __ΩTOCOptions;
@@ -0,0 +1,33 @@
1
+ //#region ../plugin-automd/src/types/toc.d.ts
2
+ interface TOCOptions {
3
+ /**
4
+ * A slugify function to generate slugs for the headings.
5
+ */
6
+ slugify?: (str: string) => string;
7
+ /**
8
+ * The maximum depth of headings to include in the TOC.
9
+ *
10
+ * @defaultValue 6
11
+ */
12
+ maxDepth?: number;
13
+ /**
14
+ * Whether to include the first H1 heading in the TOC.
15
+ */
16
+ firstH1?: boolean;
17
+ /**
18
+ * The bullet character to use for list items in the TOC.
19
+ *
20
+ * @defaultValue "-"
21
+ */
22
+ bullets?: string;
23
+ /**
24
+ * A prefix to add to each heading in the TOC.
25
+ */
26
+ prefix?: string;
27
+ /**
28
+ * A filter function to determine which headings to include in the TOC.
29
+ */
30
+ filter?: (str: string, level: number) => boolean;
31
+ }
32
+ //#endregion
33
+ export { TOCOptions };
@@ -0,0 +1,33 @@
1
+ //#region ../plugin-automd/src/types/toc.d.ts
2
+ interface TOCOptions {
3
+ /**
4
+ * A slugify function to generate slugs for the headings.
5
+ */
6
+ slugify?: (str: string) => string;
7
+ /**
8
+ * The maximum depth of headings to include in the TOC.
9
+ *
10
+ * @defaultValue 6
11
+ */
12
+ maxDepth?: number;
13
+ /**
14
+ * Whether to include the first H1 heading in the TOC.
15
+ */
16
+ firstH1?: boolean;
17
+ /**
18
+ * The bullet character to use for list items in the TOC.
19
+ *
20
+ * @defaultValue "-"
21
+ */
22
+ bullets?: string;
23
+ /**
24
+ * A prefix to add to each heading in the TOC.
25
+ */
26
+ prefix?: string;
27
+ /**
28
+ * A filter function to determine which headings to include in the TOC.
29
+ */
30
+ filter?: (str: string, level: number) => boolean;
31
+ }
32
+ //#endregion
33
+ export { TOCOptions };
@@ -0,0 +1,25 @@
1
+ //#region ../plugin-automd/src/types/toc.ts
2
+ const __ΩTOCOptions = [
3
+ "str",
4
+ "",
5
+ "slugify",
6
+ "A slugify function to generate slugs for the headings.",
7
+ "maxDepth",
8
+ 6,
9
+ "The maximum depth of headings to include in the TOC.",
10
+ "firstH1",
11
+ "Whether to include the first H1 heading in the TOC.",
12
+ "bullets",
13
+ "-",
14
+ "The bullet character to use for list items in the TOC.",
15
+ "prefix",
16
+ "A prefix to add to each heading in the TOC.",
17
+ "level",
18
+ "filter",
19
+ "A filter function to determine which headings to include in the TOC.",
20
+ "TOCOptions",
21
+ "PP&2!&/\"4#8?$'4%8>&?')4(8?)&4*8>+?,&4-8?.P&2!'2/)/\"408?1Mw2y"
22
+ ];
23
+
24
+ //#endregion
25
+ export { __ΩTOCOptions };
@@ -0,0 +1,74 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ let __babel_generator = require("@babel/generator");
3
+ __babel_generator = require_rolldown_runtime.__toESM(__babel_generator);
4
+ let __babel_parser = require("@babel/parser");
5
+
6
+ //#region ../plugin-babel/src/helpers/ast-utils.ts
7
+ const __ΩRequired = [
8
+ "T",
9
+ "Required",
10
+ "l+e#!e\"!fRb!Pde\"!gN##w\"y"
11
+ ];
12
+ const __ΩPick = [
13
+ "T",
14
+ "K",
15
+ "Pick",
16
+ "l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
17
+ ];
18
+ /**
19
+ * Parse the given code into an AST.
20
+ *
21
+ * @param code - The code to parse.
22
+ * @param opts - The options for parsing.
23
+ * @returns The parsed AST.
24
+ */
25
+ function parseAst(code, opts = {}) {
26
+ return (0, __babel_parser.parse)(code, {
27
+ plugins: ["typescript"],
28
+ sourceType: "module",
29
+ allowImportExportEverywhere: true,
30
+ allowAwaitOutsideFunction: true,
31
+ ...opts
32
+ });
33
+ }
34
+ parseAst.__type = [
35
+ "code",
36
+ "ParserOptions",
37
+ "opts",
38
+ () => ({}),
39
+ "ParseResult",
40
+ "parseAst",
41
+ "Parse the given code into an AST.",
42
+ "P&2!\"w\"2#>$\"w%/&?'"
43
+ ];
44
+ let generate = __babel_generator.default;
45
+ if ("default" in generate) generate = generate.default;
46
+ const __ΩGenerateFromAstOptions = [
47
+ "GeneratorOptions",
48
+ () => __ΩRequired,
49
+ () => __ΩPick,
50
+ "sourceFileName",
51
+ "filename",
52
+ "GenerateFromAstOptions",
53
+ "P\"w!\"w!P.$.%Jo##o\"\"Kw&y"
54
+ ];
55
+ function generateFromAst(ast, opts) {
56
+ return generate(ast, opts ? {
57
+ importAttributesKeyword: "with",
58
+ sourceMaps: true,
59
+ ...opts
60
+ } : void 0);
61
+ }
62
+ generateFromAst.__type = [
63
+ "ast",
64
+ () => __ΩGenerateFromAstOptions,
65
+ "opts",
66
+ "GeneratorResult",
67
+ "generateFromAst",
68
+ "P!2!n\"2#8\"w$/%"
69
+ ];
70
+
71
+ //#endregion
72
+ exports.__ΩGenerateFromAstOptions = __ΩGenerateFromAstOptions;
73
+ exports.generateFromAst = generateFromAst;
74
+ exports.parseAst = parseAst;