@powerlines/plugin-env 0.14.20 → 0.14.22

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 (135) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +37 -1
  2. package/dist/_virtual/rolldown_runtime.mjs +29 -1
  3. package/dist/babel/index.cjs +1 -1
  4. package/dist/babel/index.mjs +3 -1
  5. package/dist/babel/plugin.cjs +120 -4
  6. package/dist/babel/plugin.d.cts +2 -3
  7. package/dist/babel/plugin.d.mts +3 -2
  8. package/dist/babel/plugin.mjs +118 -4
  9. package/dist/components/docs.cjs +71 -1
  10. package/dist/components/docs.d.cts +3 -1
  11. package/dist/components/docs.mjs +70 -1
  12. package/dist/components/env.cjs +432 -11
  13. package/dist/components/env.d.cts +1 -0
  14. package/dist/components/env.mjs +430 -9
  15. package/dist/components/index.cjs +6 -1
  16. package/dist/components/index.mjs +4 -1
  17. package/dist/deepkit/schemas/reflection.cjs +3940 -1
  18. package/dist/deepkit/schemas/reflection.mjs +3938 -1
  19. package/dist/deepkit/schemas/reflection2.cjs +4112 -1
  20. package/dist/deepkit/schemas/reflection2.mjs +4110 -1
  21. package/dist/deepkit/src/capnp.cjs +913 -1
  22. package/dist/deepkit/src/capnp.mjs +911 -1
  23. package/dist/deepkit/src/esbuild-plugin.cjs +47 -4
  24. package/dist/deepkit/src/esbuild-plugin.mjs +46 -4
  25. package/dist/deepkit/src/reflect-type.cjs +22 -1
  26. package/dist/deepkit/src/reflect-type.mjs +20 -1
  27. package/dist/deepkit/src/resolve-reflections.cjs +16 -1
  28. package/dist/deepkit/src/resolve-reflections.mjs +15 -1
  29. package/dist/deepkit/src/transformer.cjs +52 -1
  30. package/dist/deepkit/src/transformer.mjs +49 -1
  31. package/dist/deepkit/src/transpile.cjs +29 -1
  32. package/dist/deepkit/src/transpile.mjs +27 -1
  33. package/dist/deepkit/src/utilities.cjs +66 -1
  34. package/dist/deepkit/src/utilities.mjs +65 -1
  35. package/dist/deepkit/src/vendor/type-compiler/index.cjs +38 -1
  36. package/dist/deepkit/src/vendor/type-compiler/index.mjs +19 -1
  37. package/dist/deepkit/src/vendor/type.cjs +20 -1
  38. package/dist/deepkit/src/vendor/type.mjs +11 -1
  39. package/dist/helpers/automd-generator.cjs +22 -1
  40. package/dist/helpers/automd-generator.mjs +21 -1
  41. package/dist/helpers/create-reflection-resource.cjs +55 -1
  42. package/dist/helpers/create-reflection-resource.d.cts +2 -1
  43. package/dist/helpers/create-reflection-resource.mjs +54 -1
  44. package/dist/helpers/index.cjs +6 -1
  45. package/dist/helpers/index.mjs +8 -1
  46. package/dist/helpers/load.cjs +83 -1
  47. package/dist/helpers/load.d.cts +2 -2
  48. package/dist/helpers/load.d.mts +3 -2
  49. package/dist/helpers/load.mjs +80 -1
  50. package/dist/helpers/persistence.cjs +214 -1
  51. package/dist/helpers/persistence.d.cts +1 -1
  52. package/dist/helpers/persistence.d.mts +1 -1
  53. package/dist/helpers/persistence.mjs +202 -1
  54. package/dist/helpers/reflect.cjs +111 -1
  55. package/dist/helpers/reflect.mjs +103 -1
  56. package/dist/helpers/source-file-env.cjs +28 -1
  57. package/dist/helpers/source-file-env.mjs +26 -1
  58. package/dist/helpers/template-helpers.cjs +42 -1
  59. package/dist/helpers/template-helpers.mjs +41 -1
  60. package/dist/index.cjs +203 -5
  61. package/dist/index.d.cts +1 -3
  62. package/dist/index.d.mts +2 -1
  63. package/dist/index.mjs +170 -5
  64. package/dist/plugin-alloy/src/core/components/output.cjs +45 -1
  65. package/dist/plugin-alloy/src/core/components/output.mjs +44 -1
  66. package/dist/plugin-alloy/src/core/contexts/context.cjs +11 -1
  67. package/dist/plugin-alloy/src/core/contexts/context.mjs +10 -1
  68. package/dist/plugin-alloy/src/index.cjs +93 -2
  69. package/dist/plugin-alloy/src/index.mjs +91 -2
  70. package/dist/plugin-alloy/src/types/components.d.mts +1 -1
  71. package/dist/plugin-alloy/src/types/plugin.d.cts +3 -2
  72. package/dist/plugin-alloy/src/types/plugin.d.mts +5 -5
  73. package/dist/plugin-automd/src/index.cjs +101 -1
  74. package/dist/plugin-automd/src/index.mjs +98 -1
  75. package/dist/plugin-automd/src/types/plugin.d.mts +2 -2
  76. package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -1
  77. package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -1
  78. package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -1
  79. package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -1
  80. package/dist/plugin-babel/src/helpers/filters.cjs +23 -1
  81. package/dist/plugin-babel/src/helpers/filters.mjs +21 -1
  82. package/dist/plugin-babel/src/helpers/index.cjs +5 -1
  83. package/dist/plugin-babel/src/helpers/index.mjs +7 -1
  84. package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -1
  85. package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -1
  86. package/dist/plugin-babel/src/helpers/options.cjs +50 -1
  87. package/dist/plugin-babel/src/helpers/options.mjs +47 -1
  88. package/dist/plugin-babel/src/index.cjs +91 -1
  89. package/dist/plugin-babel/src/index.mjs +89 -1
  90. package/dist/plugin-babel/src/types/plugin.d.cts +2 -2
  91. package/dist/plugin-babel/src/types/plugin.d.mts +2 -2
  92. package/dist/powerlines/schemas/fs.d.mts +1 -0
  93. package/dist/powerlines/src/api.d.mts +7 -0
  94. package/dist/powerlines/src/index.d.mts +12 -0
  95. package/dist/powerlines/src/internal/helpers/hooks.d.mts +5 -0
  96. package/dist/powerlines/src/lib/build/esbuild.cjs +102 -14
  97. package/dist/powerlines/src/lib/build/esbuild.mjs +100 -14
  98. package/dist/powerlines/src/lib/entry.cjs +12 -1
  99. package/dist/powerlines/src/lib/entry.mjs +14 -1
  100. package/dist/powerlines/src/lib/logger.cjs +41 -1
  101. package/dist/powerlines/src/lib/logger.mjs +39 -1
  102. package/dist/powerlines/src/lib/utilities/bundle.cjs +35 -1
  103. package/dist/powerlines/src/lib/utilities/bundle.mjs +34 -1
  104. package/dist/powerlines/src/lib/utilities/resolve.cjs +30 -1
  105. package/dist/powerlines/src/lib/utilities/resolve.mjs +29 -1
  106. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -1
  107. package/dist/powerlines/src/plugin-utils/paths.mjs +3 -1
  108. package/dist/powerlines/src/types/api.d.mts +5 -0
  109. package/dist/powerlines/src/types/babel.d.cts +3 -2
  110. package/dist/powerlines/src/types/babel.d.mts +3 -2
  111. package/dist/powerlines/src/types/commands.d.cts +1 -1
  112. package/dist/powerlines/src/types/commands.d.mts +2 -2
  113. package/dist/powerlines/src/types/config.d.cts +5 -5
  114. package/dist/powerlines/src/types/config.d.mts +7 -7
  115. package/dist/powerlines/src/types/context.d.cts +44 -3
  116. package/dist/powerlines/src/types/context.d.mts +46 -5
  117. package/dist/powerlines/src/types/fs.d.cts +15 -1
  118. package/dist/powerlines/src/types/fs.d.mts +15 -1
  119. package/dist/powerlines/src/types/index.d.mts +12 -0
  120. package/dist/powerlines/src/types/plugin.d.cts +3 -3
  121. package/dist/powerlines/src/types/plugin.d.mts +4 -4
  122. package/dist/powerlines/src/types/resolved.d.cts +1 -1
  123. package/dist/powerlines/src/types/resolved.d.mts +2 -2
  124. package/dist/powerlines/src/types/tsconfig.d.mts +1 -1
  125. package/dist/powerlines/src/types/unplugin.d.mts +7 -0
  126. package/dist/types/index.mjs +1 -1
  127. package/dist/types/plugin.d.cts +1 -0
  128. package/dist/types/plugin.mjs +1 -1
  129. package/dist/types/runtime.mjs +1 -1
  130. package/package.json +15 -15
  131. package/dist/babel/index.d.cts +0 -1
  132. package/dist/helpers/index.d.cts +0 -6
  133. package/dist/plugin-alloy/src/vendor/index.cjs +0 -1
  134. package/dist/plugin-alloy/src/vendor/index.d.mts +0 -7
  135. package/dist/plugin-alloy/src/vendor/index.mjs +0 -1
@@ -1,2 +1,93 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./vendor/index.cjs`),n=require(`./core/components/output.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/rollup-plugin`);i=e.__toESM(i);let a=require(`@storm-software/config-tools/types`),o=require(`@stryke/json/storm-json`),s=require(`@stryke/path/is-parent-path`),c=require(`@stryke/path/replace`),l=require(`@stryke/type-checks/is-set-string`),u=require(`prettier/doc.js`),d=require(`rolldown/experimental`);const f=(e={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...e},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@powerlines/plugin-alloy/vendor`}}},plugins:[(0,i.default)(),(0,d.viteAliasPlugin)({entries:[{find:`@alloy-js/core`,replacement:`@powerlines/plugin-alloy/vendor`},{find:`@alloy-js/core/jsx-runtime`,replacement:`@powerlines/plugin-alloy/vendor/jsx-runtime`}]})],alias:{"@alloy-js/core":`@powerlines/plugin-alloy/vendor`,"@alloy-js/core/jsx-runtime":`@powerlines/plugin-alloy/vendor/jsx-runtime`}}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@powerlines/plugin-alloy/vendor`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@powerlines/plugin-alloy/vendor`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@powerlines/plugin-alloy/vendor`),await this.fs.write(this.tsconfig.tsconfigFilePath,o.StormJSON.stringify(this.tsconfig.tsconfigJson))),this.config.alloy?.typescript!==!1&&(this.dependencies[`@alloy-js/typescript`]=`^0.22.0`),this.config.alloy?.json===!0&&(this.dependencies[`@alloy-js/json`]=`^0.22.0`),this.config.alloy?.markdown===!0&&(this.dependencies[`@alloy-js/markdown`]=`^0.22.0`)},resolveId(e){return e===`@alloy-js/core`?{id:`@powerlines/plugin-alloy/vendor`,external:!0}:e===`@alloy-js/core/jsx-runtime`?{id:`@powerlines/plugin-alloy/vendor/jsx-runtime`,external:!0}:null}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async e=>{let i=this,a=(0,t.vendor_exports.renderTree)((0,r.createComponent)(n.Output,{context:i,get basePath(){return i.workspaceConfig.workspaceRoot},children:e}));await m(this,a,this.config.alloy)}}}}];var p=f;async function m(e,n,r={}){await(0,t.vendor_exports.flushJobsAsync)();let i,o=async(n,l)=>{if(!Array.isArray(l))return;let u=async e=>{for(let t of l)await o(e,t)},d=(0,t.vendor_exports.getContextForRenderNode)(l);if(!d)return u(n);if(d.meta?.directory){let e={kind:`directory`,path:d.meta.directory.path,contents:[]};n?n.contents.push(e):i=e,await u(e)}else if(d.meta?.sourceFile){if(!n)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let t;if(d.meta?.builtin){if(!d.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");e.log(a.LogLevelLabel.TRACE,`Rendering built-in runtime module with ID: ${d.meta.builtin.id}`),t={kind:`builtin`,id:d.meta.builtin.id,path:(0,c.replacePath)(d.meta.sourceFile.path,e.builtinsPath),filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,l,r)}}else d.meta?.entry||(0,s.isParentPath)(e.entryPath,d.meta.sourceFile.path)?(e.log(a.LogLevelLabel.TRACE,`Rendering entry module at path: ${d.meta.sourceFile.path}`),t={kind:`entry`,typeDefinition:d.meta.entry?.typeDefinition,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,l,r)}):(e.log(a.LogLevelLabel.TRACE,`Rendering source file at path: ${d.meta.sourceFile.path}`),t={kind:`file`,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,l,r)});n.contents.push(t)}else if(d.meta?.copyFile){if(!n)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(e.log(a.LogLevelLabel.TRACE,`Processing copy file operation from "${d.meta.copyFile.sourcePath}" to "${d.meta.copyFile.path}"`),!d.meta.copyFile.sourcePath)throw Error("Copy file doesn't have a source path. Make sure you have provided a `sourcePath` property to the `meta.copyFile` context.");if(!d.meta.copyFile.path)throw Error("Copy file doesn't have a destination path. Make sure you have provided a `path` property to the `meta.copyFile` context.");n.contents.push({kind:`file`,path:d.meta.copyFile.path,sourcePath:d.meta.copyFile.sourcePath,preset:d.meta.output?.preset})}else await u(n)};await o(void 0,n);let u=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await u(e,n);else if(n.kind===`builtin`)await e.emitBuiltin(n.contents,n.id,n.path);else if(n.kind===`entry`)await e.emitEntry(n.contents,n.path,n.typeDefinition);else if(n.kind===`file`)if(`sourcePath`in n&&n.sourcePath){if(!e.fs.existsSync(n.sourcePath))throw Error(`Source file "${n.sourcePath}" for copy operation does not exist.`);let t=await e.fs.read(n.sourcePath);if(!(0,l.isSetString)(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&(0,l.isSetString)(n.contents))await e.fs.write(n.path,n.contents);else throw Error(`Unexpected output extracted from the render tree: \n\n${JSON.stringify(n,null,2)}`)};await u(e,i)}async function h(e,n,r={}){r.printWidth??=160,r.tabWidth??=2,r.useTabs??=!1,r.insertFinalNewLine??=!0,await(0,t.vendor_exports.flushJobsAsync)();let i=u.printer.printDocToString(g(n),r).formatted;return r.insertFinalNewLine&&!i.endsWith(`
2
- `)?`${i}\n`:i}function g(e){let n=[];for(let r of e)if(typeof r==`string`){let e=r.split(/\r?\n/).flatMap((e,t,n)=>(n.length-1,[e]));n.push(e)}else (0,t.vendor_exports.isPrintHook)(r)?n.push(r.print(r.subtree,g)):n.push(g(r));return n}exports.default=p;
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_output = require('./core/components/output.cjs');
3
+ let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
4
+ let __alloy_js_core = require("@alloy-js/core");
5
+ let __alloy_js_rollup_plugin = require("@alloy-js/rollup-plugin");
6
+ __alloy_js_rollup_plugin = require_rolldown_runtime.__toESM(__alloy_js_rollup_plugin);
7
+ let __stryke_json_storm_json = require("@stryke/json/storm-json");
8
+
9
+ //#region ../plugin-alloy/src/index.tsx
10
+ /**
11
+ * Alloy-js plugin for Powerlines.
12
+ *
13
+ * @param options - The Alloy-js plugin user configuration options.
14
+ * @returns A Powerlines plugin that integrates Alloy-js transformations.
15
+ */
16
+ const plugin = (options = {}) => {
17
+ return [{
18
+ name: "alloy:config",
19
+ config() {
20
+ return {
21
+ alloy: {
22
+ typescript: true,
23
+ ...options
24
+ },
25
+ build: {
26
+ inputOptions: { transform: { jsx: {
27
+ runtime: "classic",
28
+ pragma: "Alloy.createElement",
29
+ importSource: "@alloy-js/core"
30
+ } } },
31
+ plugins: [(0, __alloy_js_rollup_plugin.default)()]
32
+ }
33
+ };
34
+ },
35
+ async configResolved() {
36
+ if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !== "@alloy-js/core") {
37
+ this.tsconfig.tsconfigJson.compilerOptions ??= {};
38
+ if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "preserve") this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
39
+ if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !== "@alloy-js/core") this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = "@alloy-js/core";
40
+ await this.fs.write(this.tsconfig.tsconfigFilePath, __stryke_json_storm_json.StormJSON.stringify(this.tsconfig.tsconfigJson));
41
+ }
42
+ this.dependencies["@alloy-js/core"] = "^0.22.0";
43
+ if (this.config.alloy?.typescript !== false) this.dependencies["@alloy-js/typescript"] = "^0.22.0";
44
+ if (this.config.alloy?.json === true) this.dependencies["@alloy-js/json"] = "^0.22.0";
45
+ if (this.config.alloy?.markdown === true) this.dependencies["@alloy-js/markdown"] = "^0.22.0";
46
+ }
47
+ }, {
48
+ name: "alloy:update-context",
49
+ configResolved: {
50
+ order: "pre",
51
+ async handler() {
52
+ this.render = async (children) => {
53
+ const _self$ = this;
54
+ const meta = {};
55
+ await (0, __alloy_js_core.traverseOutput)(await (0, __alloy_js_core.renderAsync)((0, __alloy_js_core_jsx_runtime.createComponent)(require_output.Output, {
56
+ context: _self$,
57
+ meta,
58
+ get basePath() {
59
+ return _self$.workspaceConfig.workspaceRoot;
60
+ },
61
+ children
62
+ })), {
63
+ visitDirectory: (directory) => {
64
+ if (this.fs.existsSync(directory.path)) return;
65
+ this.fs.mkdirSync(directory.path);
66
+ },
67
+ visitFile: (file) => {
68
+ if ("contents" in file) {
69
+ const metadata = meta[file.path] ?? {};
70
+ if (metadata.kind === "builtin") {
71
+ if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
72
+ this.emitBuiltinSync(file.contents, metadata.id, file.path, {
73
+ skipFormat: metadata.skipFormat,
74
+ storage: metadata.storage
75
+ });
76
+ } else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
77
+ skipFormat: metadata.skipFormat,
78
+ storage: metadata.storage,
79
+ ...metadata.typeDefinition ?? {}
80
+ });
81
+ else this.emitSync(file.path, file.contents, metadata);
82
+ } else this.fs.copySync(file.sourcePath, file.path);
83
+ }
84
+ });
85
+ };
86
+ }
87
+ }
88
+ }];
89
+ };
90
+ var src_default = plugin;
91
+
92
+ //#endregion
93
+ exports.default = src_default;
@@ -1,2 +1,91 @@
1
- import{vendor_exports as e}from"./vendor/index.mjs";import{Output as t}from"./core/components/output.mjs";import{createComponent as n}from"@alloy-js/core/jsx-runtime";import r from"@alloy-js/rollup-plugin";import{LogLevelLabel as i}from"@storm-software/config-tools/types";import{StormJSON as a}from"@stryke/json/storm-json";import{isParentPath as o}from"@stryke/path/is-parent-path";import{replacePath as s}from"@stryke/path/replace";import{isSetString as c}from"@stryke/type-checks/is-set-string";import{printer as l}from"prettier/doc.js";import{viteAliasPlugin as u}from"rolldown/experimental";var d=(i={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...i},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@powerlines/plugin-alloy/vendor`}}},plugins:[r(),u({entries:[{find:`@alloy-js/core`,replacement:`@powerlines/plugin-alloy/vendor`},{find:`@alloy-js/core/jsx-runtime`,replacement:`@powerlines/plugin-alloy/vendor/jsx-runtime`}]})],alias:{"@alloy-js/core":`@powerlines/plugin-alloy/vendor`,"@alloy-js/core/jsx-runtime":`@powerlines/plugin-alloy/vendor/jsx-runtime`}}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@powerlines/plugin-alloy/vendor`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@powerlines/plugin-alloy/vendor`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@powerlines/plugin-alloy/vendor`),await this.fs.write(this.tsconfig.tsconfigFilePath,a.stringify(this.tsconfig.tsconfigJson))),this.config.alloy?.typescript!==!1&&(this.dependencies[`@alloy-js/typescript`]=`^0.22.0`),this.config.alloy?.json===!0&&(this.dependencies[`@alloy-js/json`]=`^0.22.0`),this.config.alloy?.markdown===!0&&(this.dependencies[`@alloy-js/markdown`]=`^0.22.0`)},resolveId(e){return e===`@alloy-js/core`?{id:`@powerlines/plugin-alloy/vendor`,external:!0}:e===`@alloy-js/core/jsx-runtime`?{id:`@powerlines/plugin-alloy/vendor/jsx-runtime`,external:!0}:null}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async r=>{let i=this,a=(0,e.renderTree)(n(t,{context:i,get basePath(){return i.workspaceConfig.workspaceRoot},children:r}));await f(this,a,this.config.alloy)}}}}];async function f(t,n,r={}){await(0,e.flushJobsAsync)();let a,l=async(n,c)=>{if(!Array.isArray(c))return;let u=async e=>{for(let t of c)await l(e,t)},d=(0,e.getContextForRenderNode)(c);if(!d)return u(n);if(d.meta?.directory){let e={kind:`directory`,path:d.meta.directory.path,contents:[]};n?n.contents.push(e):a=e,await u(e)}else if(d.meta?.sourceFile){if(!n)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let e;if(d.meta?.builtin){if(!d.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");t.log(i.TRACE,`Rendering built-in runtime module with ID: ${d.meta.builtin.id}`),e={kind:`builtin`,id:d.meta.builtin.id,path:s(d.meta.sourceFile.path,t.builtinsPath),filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await p(t,c,r)}}else d.meta?.entry||o(t.entryPath,d.meta.sourceFile.path)?(t.log(i.TRACE,`Rendering entry module at path: ${d.meta.sourceFile.path}`),e={kind:`entry`,typeDefinition:d.meta.entry?.typeDefinition,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await p(t,c,r)}):(t.log(i.TRACE,`Rendering source file at path: ${d.meta.sourceFile.path}`),e={kind:`file`,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await p(t,c,r)});n.contents.push(e)}else if(d.meta?.copyFile){if(!n)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(t.log(i.TRACE,`Processing copy file operation from "${d.meta.copyFile.sourcePath}" to "${d.meta.copyFile.path}"`),!d.meta.copyFile.sourcePath)throw Error("Copy file doesn't have a source path. Make sure you have provided a `sourcePath` property to the `meta.copyFile` context.");if(!d.meta.copyFile.path)throw Error("Copy file doesn't have a destination path. Make sure you have provided a `path` property to the `meta.copyFile` context.");n.contents.push({kind:`file`,path:d.meta.copyFile.path,sourcePath:d.meta.copyFile.sourcePath,preset:d.meta.output?.preset})}else await u(n)};await l(void 0,n);let u=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await u(e,n);else if(n.kind===`builtin`)await e.emitBuiltin(n.contents,n.id,n.path);else if(n.kind===`entry`)await e.emitEntry(n.contents,n.path,n.typeDefinition);else if(n.kind===`file`)if(`sourcePath`in n&&n.sourcePath){if(!e.fs.existsSync(n.sourcePath))throw Error(`Source file "${n.sourcePath}" for copy operation does not exist.`);let t=await e.fs.read(n.sourcePath);if(!c(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&c(n.contents))await e.fs.write(n.path,n.contents);else throw Error(`Unexpected output extracted from the render tree: \n\n${JSON.stringify(n,null,2)}`)};await u(t,a)}async function p(t,n,r={}){r.printWidth??=160,r.tabWidth??=2,r.useTabs??=!1,r.insertFinalNewLine??=!0,await(0,e.flushJobsAsync)();let i=l.printDocToString(m(n),r).formatted;return r.insertFinalNewLine&&!i.endsWith(`
2
- `)?`${i}\n`:i}function m(t){let n=[];for(let r of t)if(typeof r==`string`){let e=r.split(/\r?\n/).flatMap((e,t,n)=>(n.length-1,[e]));n.push(e)}else (0,e.isPrintHook)(r)?n.push(r.print(r.subtree,m)):n.push(m(r));return n}export{d as default};
1
+ import { Output as Output$1 } from "./core/components/output.mjs";
2
+ import { createComponent } from "@alloy-js/core/jsx-runtime";
3
+ import { renderAsync, traverseOutput } from "@alloy-js/core";
4
+ import alloy from "@alloy-js/rollup-plugin";
5
+ import { StormJSON } from "@stryke/json/storm-json";
6
+
7
+ //#region ../plugin-alloy/src/index.tsx
8
+ /**
9
+ * Alloy-js plugin for Powerlines.
10
+ *
11
+ * @param options - The Alloy-js plugin user configuration options.
12
+ * @returns A Powerlines plugin that integrates Alloy-js transformations.
13
+ */
14
+ const plugin = (options = {}) => {
15
+ return [{
16
+ name: "alloy:config",
17
+ config() {
18
+ return {
19
+ alloy: {
20
+ typescript: true,
21
+ ...options
22
+ },
23
+ build: {
24
+ inputOptions: { transform: { jsx: {
25
+ runtime: "classic",
26
+ pragma: "Alloy.createElement",
27
+ importSource: "@alloy-js/core"
28
+ } } },
29
+ plugins: [alloy()]
30
+ }
31
+ };
32
+ },
33
+ async configResolved() {
34
+ if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !== "@alloy-js/core") {
35
+ this.tsconfig.tsconfigJson.compilerOptions ??= {};
36
+ if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "preserve") this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
37
+ if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !== "@alloy-js/core") this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = "@alloy-js/core";
38
+ await this.fs.write(this.tsconfig.tsconfigFilePath, StormJSON.stringify(this.tsconfig.tsconfigJson));
39
+ }
40
+ this.dependencies["@alloy-js/core"] = "^0.22.0";
41
+ if (this.config.alloy?.typescript !== false) this.dependencies["@alloy-js/typescript"] = "^0.22.0";
42
+ if (this.config.alloy?.json === true) this.dependencies["@alloy-js/json"] = "^0.22.0";
43
+ if (this.config.alloy?.markdown === true) this.dependencies["@alloy-js/markdown"] = "^0.22.0";
44
+ }
45
+ }, {
46
+ name: "alloy:update-context",
47
+ configResolved: {
48
+ order: "pre",
49
+ async handler() {
50
+ this.render = async (children) => {
51
+ const _self$ = this;
52
+ const meta = {};
53
+ await traverseOutput(await renderAsync(createComponent(Output$1, {
54
+ context: _self$,
55
+ meta,
56
+ get basePath() {
57
+ return _self$.workspaceConfig.workspaceRoot;
58
+ },
59
+ children
60
+ })), {
61
+ visitDirectory: (directory) => {
62
+ if (this.fs.existsSync(directory.path)) return;
63
+ this.fs.mkdirSync(directory.path);
64
+ },
65
+ visitFile: (file) => {
66
+ if ("contents" in file) {
67
+ const metadata = meta[file.path] ?? {};
68
+ if (metadata.kind === "builtin") {
69
+ if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
70
+ this.emitBuiltinSync(file.contents, metadata.id, file.path, {
71
+ skipFormat: metadata.skipFormat,
72
+ storage: metadata.storage
73
+ });
74
+ } else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
75
+ skipFormat: metadata.skipFormat,
76
+ storage: metadata.storage,
77
+ ...metadata.typeDefinition ?? {}
78
+ });
79
+ else this.emitSync(file.path, file.contents, metadata);
80
+ } else this.fs.copySync(file.sourcePath, file.path);
81
+ }
82
+ });
83
+ };
84
+ }
85
+ }
86
+ }];
87
+ };
88
+ var src_default = plugin;
89
+
90
+ //#endregion
91
+ export { src_default as default };
@@ -1,4 +1,4 @@
1
- import "../vendor/index.mjs";
2
1
  import "../../../powerlines/src/types/fs.mjs";
3
2
  import "../../../powerlines/src/types/resolved.mjs";
3
+ import { Children } from "@alloy-js/core";
4
4
  import "@alloy-js/typescript";
@@ -1,6 +1,7 @@
1
- import { PluginContext } from "../../../powerlines/src/types/context.cjs";
2
- import { UserConfig } from "../../../powerlines/src/types/config.cjs";
3
1
  import { ResolvedConfig } from "../../../powerlines/src/types/resolved.cjs";
2
+ import { UserConfig } from "../../../powerlines/src/types/config.cjs";
3
+ import { PluginContext } from "../../../powerlines/src/types/context.cjs";
4
+ import { Children, PrintTreeOptions } from "@alloy-js/core";
4
5
 
5
6
  //#region ../plugin-alloy/src/types/plugin.d.ts
6
7
  type AlloyPluginOptions = Partial<PrintTreeOptions> & {
@@ -1,10 +1,10 @@
1
- import { index_d_exports } from "../vendor/index.mjs";
2
- import { PluginContext } from "../../../powerlines/src/types/context.mjs";
3
- import { UserConfig } from "../../../powerlines/src/types/config.mjs";
4
1
  import { ResolvedConfig } from "../../../powerlines/src/types/resolved.mjs";
2
+ import { UserConfig } from "../../../powerlines/src/types/config.mjs";
3
+ import { PluginContext } from "../../../powerlines/src/types/context.mjs";
4
+ import { Children, PrintTreeOptions } from "@alloy-js/core";
5
5
 
6
6
  //#region ../plugin-alloy/src/types/plugin.d.ts
7
- type AlloyPluginOptions = Partial<index_d_exports.PrintTreeOptions> & {
7
+ type AlloyPluginOptions = Partial<PrintTreeOptions> & {
8
8
  /**
9
9
  * If true, the Alloy framework is used to generate Typescript output files.
10
10
  *
@@ -31,7 +31,7 @@ type AlloyPluginResolvedConfig = ResolvedConfig & {
31
31
  alloy: AlloyPluginOptions;
32
32
  };
33
33
  type AlloyPluginContext<TResolvedConfig extends AlloyPluginResolvedConfig = AlloyPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
34
- render: <TContext extends AlloyPluginContext>(this: TContext, children: index_d_exports.Children) => Promise<void>;
34
+ render: <TContext extends AlloyPluginContext>(this: TContext, children: Children) => Promise<void>;
35
35
  };
36
36
  //#endregion
37
37
  export { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig };
@@ -1 +1,101 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/replace`),n=require(`@stryke/convert/to-array`),r=require(`@stryke/fs/is-file`),i=require(`@stryke/fs/list-files`),a=require(`@stryke/path/append`),o=require(`@stryke/path/is-type`),s=require(`@stryke/path/join-paths`),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 t=await(0,c.loadConfig)((0,s.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot),e);return(!t.prefix||!Array.isArray(t.prefix))&&(t.prefix=(0,n.toArray)(t.prefix??[])),t.prefix.includes(`automd`)||t.prefix.push(`automd`),t.prefix.includes(`powerlines`)||t.prefix.push(`powerlines`),{automd:(0,u.default)(t??{},{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,n.toArray)(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=(0,n.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,n.toArray)(e.prefix??[])}))}this.config.automd.input=(await Promise.all((0,n.toArray)(this.config.automd.input).map(async e=>e.includes(`*`)?(0,i.listFiles)((0,o.isAbsolutePath)(e)?e:(0,a.appendPath)(e,this.config.projectRoot),{ignore:this.config.automd.ignore}):(0,o.isAbsolutePath)(e)?e:(0,a.appendPath)(e,this.config.projectRoot)))).flat(),this.config.automd.output&&!(0,o.isAbsolutePath)(this.config.automd.output)&&(this.config.automd.output=(0,a.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,n.toArray)(this.config.automd.input).map(async e=>{let n=await this.fs.read(e);if(n){let i=await(0,c.transform)(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((0,a.appendPath)(this.config.automd.output?(0,r.isDirectory)(this.config.automd.output)?(0,t.replacePath)(e,this.config.automd.output):this.config.automd.output:e,this.config.projectRoot),i.contents)}}))}});var p=f;exports.default=p;
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_path_replace = require("@stryke/path/replace");
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 automd = require("automd");
10
+ let c12 = require("c12");
11
+ let defu = require("defu");
12
+ defu = require_rolldown_runtime.__toESM(defu);
13
+ let markdown_toc = require("markdown-toc");
14
+ markdown_toc = require_rolldown_runtime.__toESM(markdown_toc);
15
+
16
+ //#region ../plugin-automd/src/index.ts
17
+ /**
18
+ * AutoMD Plugin
19
+ *
20
+ * @remarks
21
+ * A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.
22
+ *
23
+ * @see https://automd.unjs.io/
24
+ *
25
+ * @param options - The plugin options.
26
+ * @returns A Powerlines plugin instance.
27
+ */
28
+ const plugin = (options = {}) => {
29
+ return {
30
+ name: "automd",
31
+ async config() {
32
+ const config = await (0, automd.loadConfig)((0, __stryke_path_join_paths.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot), options);
33
+ if (!config.prefix || !Array.isArray(config.prefix)) config.prefix = (0, __stryke_convert_to_array.toArray)(config.prefix ?? []);
34
+ if (!config.prefix.includes("automd")) config.prefix.push("automd");
35
+ if (!config.prefix.includes("powerlines")) config.prefix.push("powerlines");
36
+ return { automd: (0, defu.default)(config ?? {}, {
37
+ configFile: options.configFile,
38
+ allowIssues: true,
39
+ dir: this.config.projectRoot,
40
+ watch: false,
41
+ input: "README.md",
42
+ toc: {
43
+ maxDepth: 6,
44
+ bullets: "-"
45
+ }
46
+ }) };
47
+ },
48
+ async configResolved() {
49
+ 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);
50
+ if (this.config.automd.configFile) {
51
+ const { config } = await (0, c12.loadConfig)({
52
+ cwd: this.config.automd.dir,
53
+ configFile: this.config.automd.configFile,
54
+ defaults: {
55
+ ignore: [
56
+ "**/node_modules",
57
+ "**/dist",
58
+ "**/.*"
59
+ ],
60
+ dir: this.config.automd.dir
61
+ }
62
+ });
63
+ this.config.automd = (0, automd.resolveConfig)((0, defu.default)(this.config.automd, {
64
+ ...config,
65
+ prefix: (0, __stryke_convert_to_array.toArray)(config.prefix ?? [])
66
+ }));
67
+ }
68
+ this.config.automd.input = (await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.automd.input).map(async (input) => {
69
+ 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 });
70
+ return (0, __stryke_path_is_type.isAbsolutePath)(input) ? input : (0, __stryke_path_append.appendPath)(input, this.config.projectRoot);
71
+ }))).flat();
72
+ 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
+ this.config.automd.generators ??= {};
74
+ if (this.config.automd.toc !== false) this.config.automd.generators.toc ??= {
75
+ name: "toc",
76
+ generate: (ctx) => {
77
+ const opts = this.config.automd.toc ?? {};
78
+ return { contents: (0, markdown_toc.default)(ctx.block.md, {
79
+ ...opts,
80
+ maxdepth: opts.maxDepth,
81
+ first1: opts.firstH1
82
+ }).content };
83
+ }
84
+ };
85
+ },
86
+ async docs() {
87
+ await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.automd.input).map(async (input) => {
88
+ const contents = await this.fs.read(input);
89
+ if (contents) {
90
+ const result = await (0, automd.transform)(contents, this.config.automd);
91
+ 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.`);
92
+ 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
+ }
94
+ }));
95
+ }
96
+ };
97
+ };
98
+ var src_default = plugin;
99
+
100
+ //#endregion
101
+ exports.default = src_default;
@@ -1 +1,98 @@
1
- import{replacePath as e}from"@stryke/path/replace";import{toArray as t}from"@stryke/convert/to-array";import{isDirectory as n}from"@stryke/fs/is-file";import{listFiles as r}from"@stryke/fs/list-files";import{appendPath as i}from"@stryke/path/append";import{isAbsolutePath as a}from"@stryke/path/is-type";import{joinPaths as o}from"@stryke/path/join-paths";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";var p=(p={})=>({name:`automd`,async config(){let e=await s(o(this.workspaceConfig.workspaceRoot,this.config.projectRoot),p);return(!e.prefix||!Array.isArray(e.prefix))&&(e.prefix=t(e.prefix??[])),e.prefix.includes(`automd`)||e.prefix.push(`automd`),e.prefix.includes(`powerlines`)||e.prefix.push(`powerlines`),{automd:d(e??{},{configFile:p.configFile,allowIssues:!0,dir:this.config.projectRoot,watch:!1,input:`README.md`,toc:{maxDepth:6,bullets:`-`}})}},async configResolved(){if(this.config.framework&&!t(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=t(this.config.automd.prefix).concat(this.config.framework)),this.config.automd.configFile){let{config:e}=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,{...e,prefix:t(e.prefix??[])}))}this.config.automd.input=(await Promise.all(t(this.config.automd.input).map(async e=>e.includes(`*`)?r(a(e)?e:i(e,this.config.projectRoot),{ignore:this.config.automd.ignore}):a(e)?e:i(e,this.config.projectRoot)))).flat(),this.config.automd.output&&!a(this.config.automd.output)&&(this.config.automd.output=i(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(t(this.config.automd.input).map(async t=>{let r=await this.fs.read(t);if(r){let a=await l(r,this.config.automd);if(a.hasIssues&&this.config.automd.allowIssues===!1)throw Error(`AutoMD found issues in file "${t}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);a.hasChanged&&await this.fs.write(i(this.config.automd.output?n(this.config.automd.output)?e(t,this.config.automd.output):this.config.automd.output:t,this.config.projectRoot),a.contents)}}))}});export{p as default};
1
+ import { replacePath } from "@stryke/path/replace";
2
+ import { toArray } from "@stryke/convert/to-array";
3
+ import { isDirectory } from "@stryke/fs/is-file";
4
+ import { listFiles } from "@stryke/fs/list-files";
5
+ import { appendPath } from "@stryke/path/append";
6
+ import { isAbsolutePath } from "@stryke/path/is-type";
7
+ import { joinPaths } from "@stryke/path/join-paths";
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 ../plugin-automd/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 };
@@ -1,6 +1,6 @@
1
- import "../../../powerlines/src/types/context.mjs";
2
- import "../../../powerlines/src/types/config.mjs";
3
1
  import "../../../powerlines/src/types/resolved.mjs";
2
+ import "../../../powerlines/src/types/config.mjs";
3
+ import "../../../powerlines/src/types/context.mjs";
4
4
  import { TOCOptions } from "./toc.mjs";
5
5
  import { Config } from "automd";
6
6
 
@@ -1 +1,10 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@babel/generator`);t=e.__toESM(t),require(`@babel/parser`);let n=t.default;`default`in n&&(n=n.default);
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
+ require("@babel/parser");
5
+
6
+ //#region ../plugin-babel/src/helpers/ast-utils.ts
7
+ let generate = __babel_generator.default;
8
+ if ("default" in generate) generate = generate.default;
9
+
10
+ //#endregion
@@ -1 +1,9 @@
1
- import e from"@babel/generator";import"@babel/parser";let t=e;`default`in t&&(t=t.default);export{};
1
+ import _generate from "@babel/generator";
2
+ import "@babel/parser";
3
+
4
+ //#region ../plugin-babel/src/helpers/ast-utils.ts
5
+ let generate = _generate;
6
+ if ("default" in generate) generate = generate.default;
7
+
8
+ //#endregion
9
+ export { };
@@ -1 +1,41 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../../../powerlines/src/lib/logger.cjs`);let n=require(`@storm-software/config-tools/types`),r=require(`chalk`);r=e.__toESM(r);let i=require(`@babel/helper-plugin-utils`);function a(e,a){let o=o=>(0,i.declare)((i,s,c)=>{i.cache.using(()=>o.meta.checksum),i.assertVersion(`^7.0.0-0`);let l=t.extendLog(o.log,e);l(n.LogLevelLabel.TRACE,`Initializing the ${r.default.bold.cyanBright(e)} Babel plugin`);let u=a({log:l,name:e,api:i,options:s,context:o,dirname:c});return u.name=e,l(n.LogLevelLabel.TRACE,`Completed initialization of the ${r.default.bold.cyanBright(e)} Babel plugin`),u});return o.$$name=e,o}exports.createBabelPlugin=a;
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ const require_logger = require('../../../powerlines/src/lib/logger.cjs');
3
+ let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
4
+ let chalk = require("chalk");
5
+ chalk = require_rolldown_runtime.__toESM(chalk);
6
+ let __babel_helper_plugin_utils = require("@babel/helper-plugin-utils");
7
+
8
+ //#region ../plugin-babel/src/helpers/create-plugin.ts
9
+ /**
10
+ * Create a Babel plugin using the provided builder function.
11
+ *
12
+ * @param name - The name of the plugin.
13
+ * @param builder - The builder function that defines the plugin behavior.
14
+ * @returns A Babel plugin declaration.
15
+ */
16
+ function createBabelPlugin(name, builder) {
17
+ const plugin = (context) => {
18
+ return (0, __babel_helper_plugin_utils.declare)((api, options, dirname) => {
19
+ api.cache.using(() => context.meta.checksum);
20
+ api.assertVersion("^7.0.0-0");
21
+ const log = require_logger.extendLog(context.log, name);
22
+ log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Initializing the ${chalk.default.bold.cyanBright(name)} Babel plugin`);
23
+ const result = builder({
24
+ log,
25
+ name,
26
+ api,
27
+ options,
28
+ context,
29
+ dirname
30
+ });
31
+ result.name = name;
32
+ log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Completed initialization of the ${chalk.default.bold.cyanBright(name)} Babel plugin`);
33
+ return result;
34
+ });
35
+ };
36
+ plugin.$$name = name;
37
+ return plugin;
38
+ }
39
+
40
+ //#endregion
41
+ exports.createBabelPlugin = createBabelPlugin;
@@ -1 +1,39 @@
1
- import{extendLog as e}from"../../../powerlines/src/lib/logger.mjs";import{LogLevelLabel as t}from"@storm-software/config-tools/types";import n from"chalk";import{declare as r}from"@babel/helper-plugin-utils";function i(i,a){let o=o=>r((r,s,c)=>{r.cache.using(()=>o.meta.checksum),r.assertVersion(`^7.0.0-0`);let l=e(o.log,i);l(t.TRACE,`Initializing the ${n.bold.cyanBright(i)} Babel plugin`);let u=a({log:l,name:i,api:r,options:s,context:o,dirname:c});return u.name=i,l(t.TRACE,`Completed initialization of the ${n.bold.cyanBright(i)} Babel plugin`),u});return o.$$name=i,o}export{i as createBabelPlugin};
1
+ import { extendLog } from "../../../powerlines/src/lib/logger.mjs";
2
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
3
+ import chalk from "chalk";
4
+ import { declare } from "@babel/helper-plugin-utils";
5
+
6
+ //#region ../plugin-babel/src/helpers/create-plugin.ts
7
+ /**
8
+ * Create a Babel plugin using the provided builder function.
9
+ *
10
+ * @param name - The name of the plugin.
11
+ * @param builder - The builder function that defines the plugin behavior.
12
+ * @returns A Babel plugin declaration.
13
+ */
14
+ function createBabelPlugin(name, builder) {
15
+ const plugin = (context) => {
16
+ return declare((api, options, dirname) => {
17
+ api.cache.using(() => context.meta.checksum);
18
+ api.assertVersion("^7.0.0-0");
19
+ const log = extendLog(context.log, name);
20
+ log(LogLevelLabel.TRACE, `Initializing the ${chalk.bold.cyanBright(name)} Babel plugin`);
21
+ const result = builder({
22
+ log,
23
+ name,
24
+ api,
25
+ options,
26
+ context,
27
+ dirname
28
+ });
29
+ result.name = name;
30
+ log(LogLevelLabel.TRACE, `Completed initialization of the ${chalk.bold.cyanBright(name)} Babel plugin`);
31
+ return result;
32
+ });
33
+ };
34
+ plugin.$$name = name;
35
+ return plugin;
36
+ }
37
+
38
+ //#endregion
39
+ export { createBabelPlugin };
@@ -1 +1,23 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/type-checks/is-set-string`),n=require(`@stryke/type-checks/is-function`);require(`@stryke/type-checks/is-object`);function r(e){return(0,t.isSetString)(e)?e:Array.isArray(e)&&e.length>0?r(e[0]):e.$$name||e.name?e.$$name||e.name:void 0}function i(e,t){return!!(r(t)&&e.some(e=>Array.isArray(e)&&r(e[0])===r(t)))}exports.getPluginName=r,exports.isDuplicatePlugin=i;
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
3
+ require("@stryke/type-checks/is-object");
4
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
5
+
6
+ //#region ../plugin-babel/src/helpers/filters.ts
7
+ function getPluginName(plugin) {
8
+ return (0, __stryke_type_checks_is_set_string.isSetString)(plugin) ? plugin : Array.isArray(plugin) && plugin.length > 0 ? getPluginName(plugin[0]) : plugin.$$name || plugin.name ? plugin.$$name || plugin.name : void 0;
9
+ }
10
+ /**
11
+ * Check if a Babel plugin is a duplicate of another plugin in the list.
12
+ *
13
+ * @param plugins - The list of existing Babel plugins.
14
+ * @param plugin - The Babel plugin to check for duplicates.
15
+ * @returns True if the plugin is a duplicate, false otherwise.
16
+ */
17
+ function isDuplicatePlugin(plugins, plugin) {
18
+ return !!(getPluginName(plugin) && plugins.some((existing) => Array.isArray(existing) && getPluginName(existing[0]) === getPluginName(plugin)));
19
+ }
20
+
21
+ //#endregion
22
+ exports.getPluginName = getPluginName;
23
+ exports.isDuplicatePlugin = isDuplicatePlugin;
@@ -1 +1,21 @@
1
- import{isSetString as e}from"@stryke/type-checks/is-set-string";import{isFunction as t}from"@stryke/type-checks/is-function";import"@stryke/type-checks/is-object";function n(t){return e(t)?t:Array.isArray(t)&&t.length>0?n(t[0]):t.$$name||t.name?t.$$name||t.name:void 0}function r(e,t){return!!(n(t)&&e.some(e=>Array.isArray(e)&&n(e[0])===n(t)))}export{n as getPluginName,r as isDuplicatePlugin};
1
+ import { isFunction } from "@stryke/type-checks/is-function";
2
+ import "@stryke/type-checks/is-object";
3
+ import { isSetString } from "@stryke/type-checks/is-set-string";
4
+
5
+ //#region ../plugin-babel/src/helpers/filters.ts
6
+ function getPluginName(plugin) {
7
+ return isSetString(plugin) ? plugin : Array.isArray(plugin) && plugin.length > 0 ? getPluginName(plugin[0]) : plugin.$$name || plugin.name ? plugin.$$name || plugin.name : void 0;
8
+ }
9
+ /**
10
+ * Check if a Babel plugin is a duplicate of another plugin in the list.
11
+ *
12
+ * @param plugins - The list of existing Babel plugins.
13
+ * @param plugin - The Babel plugin to check for duplicates.
14
+ * @returns True if the plugin is a duplicate, false otherwise.
15
+ */
16
+ function isDuplicatePlugin(plugins, plugin) {
17
+ return !!(getPluginName(plugin) && plugins.some((existing) => Array.isArray(existing) && getPluginName(existing[0]) === getPluginName(plugin)));
18
+ }
19
+
20
+ //#endregion
21
+ export { getPluginName, isDuplicatePlugin };
@@ -1 +1,5 @@
1
- const e=require(`./filters.cjs`),t=require(`./options.cjs`);require(`./ast-utils.cjs`);const n=require(`./create-plugin.cjs`),r=require(`./module-helpers.cjs`);
1
+ const require_filters = require('./filters.cjs');
2
+ const require_options = require('./options.cjs');
3
+ require('./ast-utils.cjs');
4
+ const require_create_plugin = require('./create-plugin.cjs');
5
+ const require_module_helpers = require('./module-helpers.cjs');