@powerlines/plugin-date 0.12.131 → 0.12.133

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 (108) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +37 -1
  2. package/dist/_virtual/rolldown_runtime.mjs +29 -1
  3. package/dist/components/date-fns.cjs +19 -5
  4. package/dist/components/date-fns.mjs +19 -5
  5. package/dist/components/dayjs.cjs +19 -5
  6. package/dist/components/dayjs.mjs +19 -5
  7. package/dist/components/index.cjs +4 -1
  8. package/dist/components/index.mjs +6 -1
  9. package/dist/components/luxon.cjs +19 -5
  10. package/dist/components/luxon.mjs +19 -5
  11. package/dist/components/moment.cjs +19 -5
  12. package/dist/components/moment.mjs +19 -5
  13. package/dist/deepkit/schemas/reflection.cjs +3998 -1
  14. package/dist/deepkit/schemas/reflection.mjs +3996 -1
  15. package/dist/deepkit/schemas/reflection2.cjs +4112 -1
  16. package/dist/deepkit/schemas/reflection2.mjs +4110 -1
  17. package/dist/deepkit/src/capnp.cjs +913 -1
  18. package/dist/deepkit/src/capnp.mjs +911 -1
  19. package/dist/deepkit/src/esbuild-plugin.cjs +47 -4
  20. package/dist/deepkit/src/esbuild-plugin.mjs +46 -4
  21. package/dist/deepkit/src/reflect-type.cjs +22 -1
  22. package/dist/deepkit/src/reflect-type.mjs +20 -1
  23. package/dist/deepkit/src/resolve-reflections.cjs +16 -1
  24. package/dist/deepkit/src/resolve-reflections.mjs +15 -1
  25. package/dist/deepkit/src/transformer.cjs +52 -1
  26. package/dist/deepkit/src/transformer.mjs +49 -1
  27. package/dist/deepkit/src/transpile.cjs +29 -1
  28. package/dist/deepkit/src/transpile.mjs +27 -1
  29. package/dist/deepkit/src/utilities.cjs +66 -1
  30. package/dist/deepkit/src/utilities.mjs +65 -1
  31. package/dist/deepkit/src/vendor/type-compiler/index.cjs +38 -1
  32. package/dist/deepkit/src/vendor/type-compiler/index.mjs +19 -1
  33. package/dist/deepkit/src/vendor/type.cjs +20 -1
  34. package/dist/deepkit/src/vendor/type.mjs +11 -1
  35. package/dist/index.cjs +69 -1
  36. package/dist/index.mjs +61 -1
  37. package/dist/plugin-alloy/src/core/components/output.cjs +38 -1
  38. package/dist/plugin-alloy/src/core/components/output.mjs +37 -1
  39. package/dist/plugin-alloy/src/core/contexts/context.cjs +11 -1
  40. package/dist/plugin-alloy/src/core/contexts/context.mjs +10 -1
  41. package/dist/plugin-alloy/src/index.cjs +90 -1
  42. package/dist/plugin-alloy/src/index.mjs +88 -1
  43. package/dist/plugin-automd/src/index.cjs +101 -1
  44. package/dist/plugin-automd/src/index.mjs +98 -1
  45. package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -1
  46. package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -1
  47. package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -1
  48. package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -1
  49. package/dist/plugin-babel/src/helpers/filters.cjs +23 -1
  50. package/dist/plugin-babel/src/helpers/filters.mjs +21 -1
  51. package/dist/plugin-babel/src/helpers/index.cjs +5 -1
  52. package/dist/plugin-babel/src/helpers/index.mjs +7 -1
  53. package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -1
  54. package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -1
  55. package/dist/plugin-babel/src/helpers/options.cjs +50 -1
  56. package/dist/plugin-babel/src/helpers/options.mjs +47 -1
  57. package/dist/plugin-babel/src/index.cjs +91 -1
  58. package/dist/plugin-babel/src/index.mjs +89 -1
  59. package/dist/plugin-env/src/babel/index.cjs +1 -1
  60. package/dist/plugin-env/src/babel/index.mjs +3 -1
  61. package/dist/plugin-env/src/babel/plugin.cjs +120 -4
  62. package/dist/plugin-env/src/babel/plugin.mjs +118 -4
  63. package/dist/plugin-env/src/components/docs.cjs +9 -1
  64. package/dist/plugin-env/src/components/docs.mjs +11 -1
  65. package/dist/plugin-env/src/components/env.cjs +349 -11
  66. package/dist/plugin-env/src/components/env.mjs +347 -9
  67. package/dist/plugin-env/src/components/index.cjs +2 -1
  68. package/dist/plugin-env/src/components/index.mjs +4 -1
  69. package/dist/plugin-env/src/helpers/automd-generator.cjs +22 -1
  70. package/dist/plugin-env/src/helpers/automd-generator.mjs +21 -1
  71. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +55 -1
  72. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +54 -1
  73. package/dist/plugin-env/src/helpers/index.cjs +6 -1
  74. package/dist/plugin-env/src/helpers/index.mjs +8 -1
  75. package/dist/plugin-env/src/helpers/load.cjs +83 -1
  76. package/dist/plugin-env/src/helpers/load.mjs +80 -1
  77. package/dist/plugin-env/src/helpers/persistence.cjs +200 -1
  78. package/dist/plugin-env/src/helpers/persistence.mjs +189 -1
  79. package/dist/plugin-env/src/helpers/reflect.cjs +125 -1
  80. package/dist/plugin-env/src/helpers/reflect.mjs +117 -1
  81. package/dist/plugin-env/src/helpers/source-file-env.cjs +24 -1
  82. package/dist/plugin-env/src/helpers/source-file-env.mjs +23 -1
  83. package/dist/plugin-env/src/helpers/template-helpers.cjs +2 -1
  84. package/dist/plugin-env/src/helpers/template-helpers.mjs +4 -1
  85. package/dist/plugin-env/src/index.cjs +167 -5
  86. package/dist/plugin-env/src/index.mjs +165 -5
  87. package/dist/powerlines/src/lib/build/esbuild.cjs +102 -14
  88. package/dist/powerlines/src/lib/build/esbuild.mjs +100 -14
  89. package/dist/powerlines/src/lib/entry.cjs +12 -1
  90. package/dist/powerlines/src/lib/entry.mjs +14 -1
  91. package/dist/powerlines/src/lib/logger.cjs +41 -1
  92. package/dist/powerlines/src/lib/logger.mjs +39 -1
  93. package/dist/powerlines/src/lib/utilities/bundle.cjs +35 -1
  94. package/dist/powerlines/src/lib/utilities/bundle.mjs +34 -1
  95. package/dist/powerlines/src/lib/utilities/file-header.cjs +19 -7
  96. package/dist/powerlines/src/lib/utilities/file-header.mjs +18 -7
  97. package/dist/powerlines/src/lib/utilities/resolve.cjs +30 -1
  98. package/dist/powerlines/src/lib/utilities/resolve.mjs +29 -1
  99. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -1
  100. package/dist/powerlines/src/plugin-utils/paths.mjs +3 -1
  101. package/dist/powerlines/src/types/build.d.mts +2 -0
  102. package/dist/powerlines/src/types/context.d.cts +27 -3
  103. package/dist/powerlines/src/types/context.d.mts +27 -3
  104. package/dist/powerlines/src/types/resolved.d.mts +1 -0
  105. package/dist/types/index.mjs +1 -1
  106. package/dist/types/plugin.mjs +1 -1
  107. package/dist/types/runtime.mjs +1 -1
  108. package/package.json +7 -7
package/dist/index.cjs CHANGED
@@ -1 +1,69 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./plugin-env/src/index.cjs`),n=require(`./components/date-fns.cjs`),r=require(`./components/dayjs.cjs`),i=require(`./components/luxon.cjs`),a=require(`./components/moment.cjs`);require(`./components/index.cjs`);let o=require(`defu`);o=e.__toESM(o);let s=require(`@storm-software/config-tools/types`);function c(e={}){return[t.default(e.env),{name:`date`,async config(){this.log(s.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `date` build plugin.");let t={date:(0,o.default)(e,{type:`date-fns`})};return(!t.date.type||![`date-fns`,`dayjs`,`luxon`,`moment`].includes(t.date.type))&&(t.date.type&&this.log(s.LogLevelLabel.WARN,`Invalid date library type "${t.date.type}" specified. Defaulting to "date-fns".`),t.date.type=`date-fns`),this.log(s.LogLevelLabel.DEBUG,`Using date library: ${t.date.type}`),t},async configResolved(){this.log(s.LogLevelLabel.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.dependencies[this.config.date.type]=`latest`},async prepare(){this.log(s.LogLevelLabel.TRACE,`Preparing the Date runtime artifacts for the Powerlines project.`);let e;switch(this.config.date.type){case`dayjs`:e=r.dayjsModule;break;case`luxon`:e=i.luxonModule;break;case`moment`:e=a.momentModule;break;case`date-fns`:default:e=n.dateFnsModule;break}await this.emitBuiltin(await Promise.resolve(e(this)),`date`,`date.ts`)}}]}var l=c;exports.dateFnsModule=n.dateFnsModule,exports.dayjsModule=r.dayjsModule,exports.default=l,exports.luxonModule=i.luxonModule,exports.momentModule=a.momentModule,exports.plugin=c;
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
+ const require_index = require('./plugin-env/src/index.cjs');
4
+ const require_date_fns = require('./components/date-fns.cjs');
5
+ const require_dayjs = require('./components/dayjs.cjs');
6
+ const require_luxon = require('./components/luxon.cjs');
7
+ const require_moment = require('./components/moment.cjs');
8
+ require('./components/index.cjs');
9
+ let defu = require("defu");
10
+ defu = require_rolldown_runtime.__toESM(defu);
11
+ let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
12
+
13
+ //#region src/index.ts
14
+ /**
15
+ * A Powerlines plugin to assist in developing other Powerlines plugins.
16
+ */
17
+ function plugin(options = {}) {
18
+ return [require_index.default(options.env), {
19
+ name: "date",
20
+ async config() {
21
+ this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, "Providing default configuration for the Powerlines `date` build plugin.");
22
+ const config = { date: (0, defu.default)(options, { type: "date-fns" }) };
23
+ if (!config.date.type || ![
24
+ "date-fns",
25
+ "dayjs",
26
+ "luxon",
27
+ "moment"
28
+ ].includes(config.date.type)) {
29
+ if (config.date.type) this.log(__storm_software_config_tools_types.LogLevelLabel.WARN, `Invalid date library type "${config.date.type}" specified. Defaulting to "date-fns".`);
30
+ config.date.type = "date-fns";
31
+ }
32
+ this.log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, `Using date library: ${config.date.type}`);
33
+ return config;
34
+ },
35
+ async configResolved() {
36
+ this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment plugin configuration has been resolved for the Powerlines project.`);
37
+ this.dependencies[this.config.date.type] = "latest";
38
+ },
39
+ async prepare() {
40
+ this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Preparing the Date runtime artifacts for the Powerlines project.`);
41
+ let dateModule;
42
+ switch (this.config.date.type) {
43
+ case "dayjs":
44
+ dateModule = require_dayjs.dayjsModule;
45
+ break;
46
+ case "luxon":
47
+ dateModule = require_luxon.luxonModule;
48
+ break;
49
+ case "moment":
50
+ dateModule = require_moment.momentModule;
51
+ break;
52
+ case "date-fns":
53
+ default:
54
+ dateModule = require_date_fns.dateFnsModule;
55
+ break;
56
+ }
57
+ await this.emitBuiltin(await Promise.resolve(dateModule(this)), "date", "date.ts");
58
+ }
59
+ }];
60
+ }
61
+ var src_default = plugin;
62
+
63
+ //#endregion
64
+ exports.dateFnsModule = require_date_fns.dateFnsModule;
65
+ exports.dayjsModule = require_dayjs.dayjsModule;
66
+ exports.default = src_default;
67
+ exports.luxonModule = require_luxon.luxonModule;
68
+ exports.momentModule = require_moment.momentModule;
69
+ exports.plugin = plugin;
package/dist/index.mjs CHANGED
@@ -1 +1,61 @@
1
- import e from"./plugin-env/src/index.mjs";import{dateFnsModule as t}from"./components/date-fns.mjs";import{dayjsModule as n}from"./components/dayjs.mjs";import{luxonModule as r}from"./components/luxon.mjs";import{momentModule as i}from"./components/moment.mjs";import"./components/index.mjs";import a from"defu";import{LogLevelLabel as o}from"@storm-software/config-tools/types";function s(s={}){return[e(s.env),{name:`date`,async config(){this.log(o.TRACE,"Providing default configuration for the Powerlines `date` build plugin.");let e={date:a(s,{type:`date-fns`})};return(!e.date.type||![`date-fns`,`dayjs`,`luxon`,`moment`].includes(e.date.type))&&(e.date.type&&this.log(o.WARN,`Invalid date library type "${e.date.type}" specified. Defaulting to "date-fns".`),e.date.type=`date-fns`),this.log(o.DEBUG,`Using date library: ${e.date.type}`),e},async configResolved(){this.log(o.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.dependencies[this.config.date.type]=`latest`},async prepare(){this.log(o.TRACE,`Preparing the Date runtime artifacts for the Powerlines project.`);let e;switch(this.config.date.type){case`dayjs`:e=n;break;case`luxon`:e=r;break;case`moment`:e=i;break;case`date-fns`:default:e=t;break}await this.emitBuiltin(await Promise.resolve(e(this)),`date`,`date.ts`)}}]}var c=s;export{t as dateFnsModule,n as dayjsModule,c as default,r as luxonModule,i as momentModule,s as plugin};
1
+ import src_default$1 from "./plugin-env/src/index.mjs";
2
+ import { dateFnsModule } from "./components/date-fns.mjs";
3
+ import { dayjsModule } from "./components/dayjs.mjs";
4
+ import { luxonModule } from "./components/luxon.mjs";
5
+ import { momentModule } from "./components/moment.mjs";
6
+ import "./components/index.mjs";
7
+ import defu from "defu";
8
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
9
+
10
+ //#region src/index.ts
11
+ /**
12
+ * A Powerlines plugin to assist in developing other Powerlines plugins.
13
+ */
14
+ function plugin(options = {}) {
15
+ return [src_default$1(options.env), {
16
+ name: "date",
17
+ async config() {
18
+ this.log(LogLevelLabel.TRACE, "Providing default configuration for the Powerlines `date` build plugin.");
19
+ const config = { date: defu(options, { type: "date-fns" }) };
20
+ if (!config.date.type || ![
21
+ "date-fns",
22
+ "dayjs",
23
+ "luxon",
24
+ "moment"
25
+ ].includes(config.date.type)) {
26
+ if (config.date.type) this.log(LogLevelLabel.WARN, `Invalid date library type "${config.date.type}" specified. Defaulting to "date-fns".`);
27
+ config.date.type = "date-fns";
28
+ }
29
+ this.log(LogLevelLabel.DEBUG, `Using date library: ${config.date.type}`);
30
+ return config;
31
+ },
32
+ async configResolved() {
33
+ this.log(LogLevelLabel.TRACE, `Environment plugin configuration has been resolved for the Powerlines project.`);
34
+ this.dependencies[this.config.date.type] = "latest";
35
+ },
36
+ async prepare() {
37
+ this.log(LogLevelLabel.TRACE, `Preparing the Date runtime artifacts for the Powerlines project.`);
38
+ let dateModule;
39
+ switch (this.config.date.type) {
40
+ case "dayjs":
41
+ dateModule = dayjsModule;
42
+ break;
43
+ case "luxon":
44
+ dateModule = luxonModule;
45
+ break;
46
+ case "moment":
47
+ dateModule = momentModule;
48
+ break;
49
+ case "date-fns":
50
+ default:
51
+ dateModule = dateFnsModule;
52
+ break;
53
+ }
54
+ await this.emitBuiltin(await Promise.resolve(dateModule(this)), "date", "date.ts");
55
+ }
56
+ }];
57
+ }
58
+ var src_default = plugin;
59
+
60
+ //#endregion
61
+ export { dateFnsModule, dayjsModule, src_default as default, luxonModule, momentModule, plugin };
@@ -1 +1,38 @@
1
- const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../contexts/context.cjs`);let n=require(`@alloy-js/core`),r=require(`@stryke/path/replace`),i=require(`react/jsx-runtime`);function a(e){let[{children:a,context:o,meta:s,basePath:c},l]=(0,n.splitProps)(e,[`children`,`context`,`meta`,`basePath`]),u=(0,n.ref)(o),d=(0,n.ref)(s??{}),f=(0,n.computed)(()=>c?(0,r.replacePath)(c,u.value.workspaceConfig.workspaceRoot):u.value.workspaceConfig.workspaceRoot);return(0,i.jsx)(n.Output,{...l,basePath:f.value,children:(0,i.jsx)(t.PowerlinesContext.Provider,{value:{ref:u,meta:d},children:(0,i.jsx)(n.Show,{when:!!u.value,children:a})})})}exports.Output=a;
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ const require_context = require('../contexts/context.cjs');
3
+ let __alloy_js_core = require("@alloy-js/core");
4
+ let __stryke_path_replace = require("@stryke/path/replace");
5
+ let react_jsx_runtime = require("react/jsx-runtime");
6
+
7
+ //#region ../plugin-alloy/src/core/components/output.tsx
8
+ /**
9
+ * Output component for rendering the Powerlines plugin's output files via templates.
10
+ */
11
+ function Output(props) {
12
+ const [{ children, context, meta, basePath }, rest] = (0, __alloy_js_core.splitProps)(props, [
13
+ "children",
14
+ "context",
15
+ "meta",
16
+ "basePath"
17
+ ]);
18
+ const contextRef = (0, __alloy_js_core.ref)(context);
19
+ const metaRef = (0, __alloy_js_core.ref)(meta ?? {});
20
+ const basePathRef = (0, __alloy_js_core.computed)(() => basePath ? (0, __stryke_path_replace.replacePath)(basePath, contextRef.value.workspaceConfig.workspaceRoot) : contextRef.value.workspaceConfig.workspaceRoot);
21
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Output, {
22
+ ...rest,
23
+ basePath: basePathRef.value,
24
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_context.PowerlinesContext.Provider, {
25
+ value: {
26
+ ref: contextRef,
27
+ meta: metaRef
28
+ },
29
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Show, {
30
+ when: Boolean(contextRef.value),
31
+ children
32
+ })
33
+ })
34
+ });
35
+ }
36
+
37
+ //#endregion
38
+ exports.Output = Output;
@@ -1 +1,37 @@
1
- import{PowerlinesContext as e}from"../contexts/context.mjs";import{Output as t,Show as n,computed as r,ref as i,splitProps as a}from"@alloy-js/core";import{replacePath as o}from"@stryke/path/replace";import{jsx as s}from"react/jsx-runtime";function c(c){let[{children:l,context:u,meta:d,basePath:f},p]=a(c,[`children`,`context`,`meta`,`basePath`]),m=i(u),h=i(d??{}),g=r(()=>f?o(f,m.value.workspaceConfig.workspaceRoot):m.value.workspaceConfig.workspaceRoot);return s(t,{...p,basePath:g.value,children:s(e.Provider,{value:{ref:m,meta:h},children:s(n,{when:!!m.value,children:l})})})}export{c as Output};
1
+ import { PowerlinesContext } from "../contexts/context.mjs";
2
+ import { Output, Show, computed, ref, splitProps } from "@alloy-js/core";
3
+ import { replacePath } from "@stryke/path/replace";
4
+ import { jsx } from "react/jsx-runtime";
5
+
6
+ //#region ../plugin-alloy/src/core/components/output.tsx
7
+ /**
8
+ * Output component for rendering the Powerlines plugin's output files via templates.
9
+ */
10
+ function Output$1(props) {
11
+ const [{ children, context, meta, basePath }, rest] = splitProps(props, [
12
+ "children",
13
+ "context",
14
+ "meta",
15
+ "basePath"
16
+ ]);
17
+ const contextRef = ref(context);
18
+ const metaRef = ref(meta ?? {});
19
+ const basePathRef = computed(() => basePath ? replacePath(basePath, contextRef.value.workspaceConfig.workspaceRoot) : contextRef.value.workspaceConfig.workspaceRoot);
20
+ return /* @__PURE__ */ jsx(Output, {
21
+ ...rest,
22
+ basePath: basePathRef.value,
23
+ children: /* @__PURE__ */ jsx(PowerlinesContext.Provider, {
24
+ value: {
25
+ ref: contextRef,
26
+ meta: metaRef
27
+ },
28
+ children: /* @__PURE__ */ jsx(Show, {
29
+ when: Boolean(contextRef.value),
30
+ children
31
+ })
32
+ })
33
+ });
34
+ }
35
+
36
+ //#endregion
37
+ export { Output$1 as Output };
@@ -1 +1,11 @@
1
- const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@alloy-js/core`);const n=(0,t.createNamedContext)(`powerlines`);exports.PowerlinesContext=n;
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ let __alloy_js_core = require("@alloy-js/core");
3
+
4
+ //#region ../plugin-alloy/src/core/contexts/context.ts
5
+ /**
6
+ * The Powerlines context used in template rendering.
7
+ */
8
+ const PowerlinesContext = (0, __alloy_js_core.createNamedContext)("powerlines");
9
+
10
+ //#endregion
11
+ exports.PowerlinesContext = PowerlinesContext;
@@ -1 +1,10 @@
1
- import{createNamedContext as e}from"@alloy-js/core";const t=e(`powerlines`);export{t as PowerlinesContext};
1
+ import { createNamedContext } from "@alloy-js/core";
2
+
3
+ //#region ../plugin-alloy/src/core/contexts/context.ts
4
+ /**
5
+ * The Powerlines context used in template rendering.
6
+ */
7
+ const PowerlinesContext = createNamedContext("powerlines");
8
+
9
+ //#endregion
10
+ export { PowerlinesContext };
@@ -1 +1,90 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./core/components/output.cjs`);let n=require(`@alloy-js/core`),r=require(`@alloy-js/rollup-plugin`);r=e.__toESM(r);let i=require(`@stryke/json/storm-json`),a=require(`react/jsx-runtime`);const o=(e={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...e},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@alloy-js/core`}}},plugins:[(0,r.default)()]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@alloy-js/core`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@alloy-js/core`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@alloy-js/core`),await this.fs.write(this.tsconfig.tsconfigFilePath,i.StormJSON.stringify(this.tsconfig.tsconfigJson))),this.dependencies[`@alloy-js/core`]=`^0.22.0`,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`)}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async e=>{let r={};await(0,n.traverseOutput)(await(0,n.renderAsync)((0,a.jsx)(t.Output,{context:this,meta:r,basePath:this.workspaceConfig.workspaceRoot,children:e})),{visitDirectory:e=>{this.fs.existsSync(e.path)||this.fs.mkdirSync(e.path)},visitFile:e=>{if(`contents`in e){let t=r[e.path]??{};if(t.kind===`builtin`){if(!t.id)throw Error(`Built-in file "${e.path}" is missing its ID in the render metadata.`);this.emitBuiltinSync(e.contents,t.id,e.path,{skipFormat:t.skipFormat,storage:t.storage})}else t.kind===`entry`?this.emitEntrySync(e.contents,e.path,{skipFormat:t.skipFormat,storage:t.storage,...t.typeDefinition??{}}):this.fs.writeSync(e.path,e.contents)}else this.fs.copySync(e.sourcePath,e.path)}})}}}}];var s=o;exports.default=s;
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_output = require('./core/components/output.cjs');
3
+ let __alloy_js_core = require("@alloy-js/core");
4
+ let __alloy_js_rollup_plugin = require("@alloy-js/rollup-plugin");
5
+ __alloy_js_rollup_plugin = require_rolldown_runtime.__toESM(__alloy_js_rollup_plugin);
6
+ let __stryke_json_storm_json = require("@stryke/json/storm-json");
7
+ let react_jsx_runtime = require("react/jsx-runtime");
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 meta = {};
54
+ await (0, __alloy_js_core.traverseOutput)(await (0, __alloy_js_core.renderAsync)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_output.Output, {
55
+ context: this,
56
+ meta,
57
+ basePath: this.workspaceConfig.workspaceRoot,
58
+ children
59
+ })), {
60
+ visitDirectory: (directory) => {
61
+ if (this.fs.existsSync(directory.path)) return;
62
+ this.fs.mkdirSync(directory.path);
63
+ },
64
+ visitFile: (file) => {
65
+ if ("contents" in file) {
66
+ const metadata = meta[file.path] ?? {};
67
+ if (metadata.kind === "builtin") {
68
+ if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
69
+ this.emitBuiltinSync(file.contents, metadata.id, file.path, {
70
+ skipFormat: metadata.skipFormat,
71
+ storage: metadata.storage
72
+ });
73
+ } else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
74
+ skipFormat: metadata.skipFormat,
75
+ storage: metadata.storage,
76
+ ...metadata.typeDefinition ?? {}
77
+ });
78
+ else this.emitSync(file.contents, file.path, metadata);
79
+ } else this.fs.copySync(file.sourcePath, file.path);
80
+ }
81
+ });
82
+ };
83
+ }
84
+ }
85
+ }];
86
+ };
87
+ var src_default = plugin;
88
+
89
+ //#endregion
90
+ exports.default = src_default;
@@ -1 +1,88 @@
1
- import{Output as e}from"./core/components/output.mjs";import{renderAsync as t,traverseOutput as n}from"@alloy-js/core";import r from"@alloy-js/rollup-plugin";import{StormJSON as i}from"@stryke/json/storm-json";import{jsx as a}from"react/jsx-runtime";var o=(o={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...o},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@alloy-js/core`}}},plugins:[r()]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@alloy-js/core`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@alloy-js/core`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@alloy-js/core`),await this.fs.write(this.tsconfig.tsconfigFilePath,i.stringify(this.tsconfig.tsconfigJson))),this.dependencies[`@alloy-js/core`]=`^0.22.0`,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`)}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async r=>{let i={};await n(await t(a(e,{context:this,meta:i,basePath:this.workspaceConfig.workspaceRoot,children:r})),{visitDirectory:e=>{this.fs.existsSync(e.path)||this.fs.mkdirSync(e.path)},visitFile:e=>{if(`contents`in e){let t=i[e.path]??{};if(t.kind===`builtin`){if(!t.id)throw Error(`Built-in file "${e.path}" is missing its ID in the render metadata.`);this.emitBuiltinSync(e.contents,t.id,e.path,{skipFormat:t.skipFormat,storage:t.storage})}else t.kind===`entry`?this.emitEntrySync(e.contents,e.path,{skipFormat:t.skipFormat,storage:t.storage,...t.typeDefinition??{}}):this.fs.writeSync(e.path,e.contents)}else this.fs.copySync(e.sourcePath,e.path)}})}}}}];export{o as default};
1
+ import { Output as Output$1 } from "./core/components/output.mjs";
2
+ import { renderAsync, traverseOutput } from "@alloy-js/core";
3
+ import alloy from "@alloy-js/rollup-plugin";
4
+ import { StormJSON } from "@stryke/json/storm-json";
5
+ import { jsx } from "react/jsx-runtime";
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 meta = {};
52
+ await traverseOutput(await renderAsync(/* @__PURE__ */ jsx(Output$1, {
53
+ context: this,
54
+ meta,
55
+ basePath: this.workspaceConfig.workspaceRoot,
56
+ children
57
+ })), {
58
+ visitDirectory: (directory) => {
59
+ if (this.fs.existsSync(directory.path)) return;
60
+ this.fs.mkdirSync(directory.path);
61
+ },
62
+ visitFile: (file) => {
63
+ if ("contents" in file) {
64
+ const metadata = meta[file.path] ?? {};
65
+ if (metadata.kind === "builtin") {
66
+ if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
67
+ this.emitBuiltinSync(file.contents, metadata.id, file.path, {
68
+ skipFormat: metadata.skipFormat,
69
+ storage: metadata.storage
70
+ });
71
+ } else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
72
+ skipFormat: metadata.skipFormat,
73
+ storage: metadata.storage,
74
+ ...metadata.typeDefinition ?? {}
75
+ });
76
+ else this.emitSync(file.contents, file.path, metadata);
77
+ } else this.fs.copySync(file.sourcePath, file.path);
78
+ }
79
+ });
80
+ };
81
+ }
82
+ }
83
+ }];
84
+ };
85
+ var src_default = plugin;
86
+
87
+ //#endregion
88
+ export { src_default as default };
@@ -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 +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