@powerlines/plugin-alloy 0.18.119 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/core/components/index.cjs +6 -6
  2. package/dist/core/components/output.d.cts +5 -5
  3. package/dist/core/components/output.d.mts +5 -5
  4. package/dist/core/components/output.mjs +4 -4
  5. package/dist/core/components/single-line-comment.d.cts +2 -2
  6. package/dist/core/components/single-line-comment.d.mts +2 -2
  7. package/dist/core/components/source-file.d.cts +5 -5
  8. package/dist/core/components/source-file.d.mts +4 -4
  9. package/dist/core/contexts/context.cjs +5 -5
  10. package/dist/core/contexts/context.d.cts +5 -5
  11. package/dist/core/contexts/context.d.mts +5 -5
  12. package/dist/core/contexts/context.mjs +5 -5
  13. package/dist/core/index.cjs +6 -6
  14. package/dist/index.cjs +32 -32
  15. package/dist/index.mjs +31 -31
  16. package/dist/internal/unctx.cjs +1 -5
  17. package/dist/internal/unctx.mjs +1 -5
  18. package/dist/markdown/components/front-matter.cjs +28 -0
  19. package/dist/markdown/components/front-matter.d.cts +15 -0
  20. package/dist/markdown/components/front-matter.d.mts +15 -0
  21. package/dist/markdown/components/front-matter.mjs +27 -0
  22. package/dist/markdown/components/index.cjs +9 -7
  23. package/dist/markdown/components/index.d.cts +3 -2
  24. package/dist/markdown/components/index.d.mts +3 -2
  25. package/dist/markdown/components/index.mjs +2 -1
  26. package/dist/markdown/components/markdown-file.cjs +28 -13
  27. package/dist/markdown/components/markdown-file.d.cts +10 -5
  28. package/dist/markdown/components/markdown-file.d.mts +10 -5
  29. package/dist/markdown/components/markdown-file.mjs +21 -6
  30. package/dist/markdown/components/markdown-table.d.cts +4 -4
  31. package/dist/markdown/components/markdown-table.d.mts +4 -4
  32. package/dist/markdown/index.cjs +9 -7
  33. package/dist/markdown/index.d.cts +3 -2
  34. package/dist/markdown/index.d.mts +3 -2
  35. package/dist/markdown/index.mjs +2 -1
  36. package/dist/typescript/components/builtin-file.cjs +6 -6
  37. package/dist/typescript/components/builtin-file.d.cts +2 -2
  38. package/dist/typescript/components/builtin-file.d.mts +2 -2
  39. package/dist/typescript/components/dynamic-import-statement.d.cts +2 -2
  40. package/dist/typescript/components/dynamic-import-statement.d.mts +2 -2
  41. package/dist/typescript/components/entry-file.cjs +2 -2
  42. package/dist/typescript/components/entry-file.d.cts +2 -2
  43. package/dist/typescript/components/entry-file.d.mts +2 -2
  44. package/dist/typescript/components/index.cjs +43 -43
  45. package/dist/typescript/components/tsdoc-reflection.cjs +7 -7
  46. package/dist/typescript/components/tsdoc-reflection.d.mts +4 -4
  47. package/dist/typescript/components/typescript-file.cjs +8 -8
  48. package/dist/typescript/components/typescript-interface.cjs +3 -3
  49. package/dist/typescript/components/typescript-interface.d.cts +3 -3
  50. package/dist/typescript/components/typescript-interface.d.mts +3 -3
  51. package/dist/typescript/components/typescript-object.cjs +3 -3
  52. package/dist/typescript/components/typescript-object.d.cts +3 -3
  53. package/dist/typescript/components/typescript-object.d.mts +3 -3
  54. package/dist/typescript/index.cjs +43 -43
  55. package/package.json +16 -16
@@ -1,7 +1,7 @@
1
- const require_core_components_output = require('./output.cjs');
2
- const require_core_components_single_line_comment = require('./single-line-comment.cjs');
3
- const require_core_components_source_file = require('./source-file.cjs');
1
+ const require_output = require('./output.cjs');
2
+ const require_single_line_comment = require('./single-line-comment.cjs');
3
+ const require_source_file = require('./source-file.cjs');
4
4
 
5
- exports.Output = require_core_components_output.Output;
6
- exports.SingleLineComment = require_core_components_single_line_comment.SingleLineComment;
7
- exports.SourceFile = require_core_components_source_file.SourceFile;
5
+ exports.Output = require_output.Output;
6
+ exports.SingleLineComment = require_single_line_comment.SingleLineComment;
7
+ exports.SourceFile = require_source_file.SourceFile;
@@ -1,10 +1,10 @@
1
1
  import { MetaItem } from "../contexts/context.cjs";
2
- import * as _alloy_js_core7 from "@alloy-js/core";
3
- import { OutputProps as OutputProps$1 } from "@alloy-js/core";
2
+ import * as _alloy_js_core0 from "@alloy-js/core";
3
+ import { OutputProps } from "@alloy-js/core";
4
4
  import { PluginContext } from "powerlines/types/context";
5
5
 
6
6
  //#region src/core/components/output.d.ts
7
- interface OutputProps<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>> extends OutputProps$1 {
7
+ interface OutputProps$1<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>> extends OutputProps {
8
8
  /**
9
9
  * The current Powerlines process context.
10
10
  */
@@ -17,7 +17,7 @@ interface OutputProps<TContext extends PluginContext = PluginContext, TMeta exte
17
17
  /**
18
18
  * Output component for rendering the Powerlines plugin's output files via templates.
19
19
  */
20
- declare function Output<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(props: OutputProps<TContext, TMeta>): _alloy_js_core7.Children;
20
+ declare function Output<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(props: OutputProps$1<TContext, TMeta>): _alloy_js_core0.Children;
21
21
  declare type __ΩOutputProps = any[];
22
22
  //#endregion
23
- export { Output, OutputProps, __ΩOutputProps };
23
+ export { Output, OutputProps$1 as OutputProps, __ΩOutputProps };
@@ -1,10 +1,10 @@
1
1
  import { MetaItem } from "../contexts/context.mjs";
2
- import * as _alloy_js_core1 from "@alloy-js/core";
3
- import { OutputProps as OutputProps$1 } from "@alloy-js/core";
2
+ import * as _alloy_js_core0 from "@alloy-js/core";
3
+ import { OutputProps } from "@alloy-js/core";
4
4
  import { PluginContext } from "powerlines/types/context";
5
5
 
6
6
  //#region src/core/components/output.d.ts
7
- interface OutputProps<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>> extends OutputProps$1 {
7
+ interface OutputProps$1<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>> extends OutputProps {
8
8
  /**
9
9
  * The current Powerlines process context.
10
10
  */
@@ -17,7 +17,7 @@ interface OutputProps<TContext extends PluginContext = PluginContext, TMeta exte
17
17
  /**
18
18
  * Output component for rendering the Powerlines plugin's output files via templates.
19
19
  */
20
- declare function Output<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(props: OutputProps<TContext, TMeta>): _alloy_js_core1.Children;
20
+ declare function Output$1<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(props: OutputProps$1<TContext, TMeta>): _alloy_js_core0.Children;
21
21
  declare type __ΩOutputProps = any[];
22
22
  //#endregion
23
- export { Output, OutputProps, __ΩOutputProps };
23
+ export { Output$1 as Output, OutputProps$1 as OutputProps, __ΩOutputProps };
@@ -1,19 +1,19 @@
1
1
  import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
2
- import { Output as Output$1, Show, computed, splitProps } from "@alloy-js/core";
2
+ import { Output, Show, computed, splitProps } from "@alloy-js/core";
3
3
  import { replacePath } from "@stryke/path/replace";
4
4
 
5
5
  //#region src/core/components/output.tsx
6
6
  /**
7
7
  * Output component for rendering the Powerlines plugin's output files via templates.
8
8
  */
9
- function Output(props) {
9
+ function Output$1(props) {
10
10
  const [{ children, context, basePath }, rest] = splitProps(props, [
11
11
  "children",
12
12
  "context",
13
13
  "basePath"
14
14
  ]);
15
15
  const basePathRef = computed(() => basePath ? replacePath(basePath, context.workspaceConfig.workspaceRoot) : context.workspaceConfig.workspaceRoot);
16
- return createComponent(Output$1, mergeProps(rest, {
16
+ return createComponent(Output, mergeProps(rest, {
17
17
  get basePath() {
18
18
  return basePathRef.value;
19
19
  },
@@ -29,4 +29,4 @@ function Output(props) {
29
29
  }
30
30
 
31
31
  //#endregion
32
- export { Output };
32
+ export { Output$1 as Output };
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps } from "../../types/components.cjs";
2
- import * as _alloy_js_core8 from "@alloy-js/core";
2
+ import * as _alloy_js_core1 from "@alloy-js/core";
3
3
 
4
4
  //#region src/core/components/single-line-comment.d.ts
5
5
  type SingleLineCommentVariant = "double-slash" | "triple-slash" | "slash-star" | "slash-star-star" | "markdown";
@@ -15,7 +15,7 @@ interface SingleLineCommentProps extends ComponentProps {
15
15
  * A single line comment block. The children are rendered as a prose element, which means that they
16
16
  * are broken into multiple lines
17
17
  */
18
- declare function SingleLineComment(props: SingleLineCommentProps): _alloy_js_core8.Children;
18
+ declare function SingleLineComment(props: SingleLineCommentProps): _alloy_js_core1.Children;
19
19
  declare type __ΩSingleLineCommentVariant = any[];
20
20
  declare type __ΩSingleLineCommentProps = any[];
21
21
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps } from "../../types/components.mjs";
2
- import * as _alloy_js_core0 from "@alloy-js/core";
2
+ import * as _alloy_js_core1 from "@alloy-js/core";
3
3
 
4
4
  //#region src/core/components/single-line-comment.d.ts
5
5
  type SingleLineCommentVariant = "double-slash" | "triple-slash" | "slash-star" | "slash-star-star" | "markdown";
@@ -15,7 +15,7 @@ interface SingleLineCommentProps extends ComponentProps {
15
15
  * A single line comment block. The children are rendered as a prose element, which means that they
16
16
  * are broken into multiple lines
17
17
  */
18
- declare function SingleLineComment(props: SingleLineCommentProps): _alloy_js_core0.Children;
18
+ declare function SingleLineComment(props: SingleLineCommentProps): _alloy_js_core1.Children;
19
19
  declare type __ΩSingleLineCommentVariant = any[];
20
20
  declare type __ΩSingleLineCommentProps = any[];
21
21
  //#endregion
@@ -1,10 +1,10 @@
1
1
  import { ComponentProps } from "../../types/components.cjs";
2
- import * as _alloy_js_core4 from "@alloy-js/core";
3
- import { SourceFileProps as SourceFileProps$1 } from "@alloy-js/core";
2
+ import * as _alloy_js_core0 from "@alloy-js/core";
3
+ import { SourceFileProps } from "@alloy-js/core";
4
4
  import { StoragePreset } from "powerlines/types/fs";
5
5
 
6
6
  //#region src/core/components/source-file.d.ts
7
- type SourceFileProps = SourceFileProps$1 & ComponentProps & {
7
+ type SourceFileProps$1 = SourceFileProps & ComponentProps & {
8
8
  /**
9
9
  * The storage preset for the output files.
10
10
  *
@@ -26,7 +26,7 @@ type SourceFileProps = SourceFileProps$1 & ComponentProps & {
26
26
  * @param props - The properties for the source file.
27
27
  * @returns The rendered source file component.
28
28
  */
29
- declare function SourceFile(props: SourceFileProps): _alloy_js_core4.Children;
29
+ declare function SourceFile(props: SourceFileProps$1): _alloy_js_core0.Children;
30
30
  declare type __ΩSourceFileProps = any[];
31
31
  //#endregion
32
- export { SourceFile, SourceFileProps, __ΩSourceFileProps };
32
+ export { SourceFile, SourceFileProps$1 as SourceFileProps, __ΩSourceFileProps };
@@ -1,10 +1,10 @@
1
1
  import { ComponentProps } from "../../types/components.mjs";
2
2
  import * as _alloy_js_core0 from "@alloy-js/core";
3
- import { SourceFileProps as SourceFileProps$1 } from "@alloy-js/core";
3
+ import { SourceFileProps } from "@alloy-js/core";
4
4
  import { StoragePreset } from "powerlines/types/fs";
5
5
 
6
6
  //#region src/core/components/source-file.d.ts
7
- type SourceFileProps = SourceFileProps$1 & ComponentProps & {
7
+ type SourceFileProps$1 = SourceFileProps & ComponentProps & {
8
8
  /**
9
9
  * The storage preset for the output files.
10
10
  *
@@ -26,7 +26,7 @@ type SourceFileProps = SourceFileProps$1 & ComponentProps & {
26
26
  * @param props - The properties for the source file.
27
27
  * @returns The rendered source file component.
28
28
  */
29
- declare function SourceFile(props: SourceFileProps): _alloy_js_core0.Children;
29
+ declare function SourceFile(props: SourceFileProps$1): _alloy_js_core0.Children;
30
30
  declare type __ΩSourceFileProps = any[];
31
31
  //#endregion
32
- export { SourceFile, SourceFileProps, __ΩSourceFileProps };
32
+ export { SourceFile, SourceFileProps$1 as SourceFileProps, __ΩSourceFileProps };
@@ -7,15 +7,15 @@ const require_unctx = require('../../internal/unctx.cjs');
7
7
  * @returns The Context.
8
8
  */
9
9
  function usePowerlinesContext() {
10
- return require_unctx.unctx.use();
10
+ return require_unctx.unctx.tryUse();
11
11
  }
12
12
  /**
13
13
  * Hook to safely access the {@link PluginContext | Powerlines context}.
14
14
  *
15
- * @returns The Powerlines context or undefined if not set.
15
+ * @returns The Powerlines context or null if not set.
16
16
  */
17
17
  function usePowerlinesSafe() {
18
- return usePowerlinesContext()?.value;
18
+ return usePowerlinesContext()?.value ?? null;
19
19
  }
20
20
  /**
21
21
  * Hook to access the {@link PluginContext | Powerlines context}.
@@ -30,10 +30,10 @@ function usePowerlines() {
30
30
  /**
31
31
  * Hook to safely access the render context's metadata.
32
32
  *
33
- * @returns The Powerlines context or undefined if not set.
33
+ * @returns The Powerlines context or null if not set.
34
34
  */
35
35
  function useMetaSafe() {
36
- return usePowerlinesContext()?.meta;
36
+ return usePowerlinesContext()?.meta ?? null;
37
37
  }
38
38
  /**
39
39
  * Hook to access the render context's metadata.
@@ -35,13 +35,13 @@ interface PowerlinesContextInterface<TContext extends PluginContext = PluginCont
35
35
  *
36
36
  * @returns The Context.
37
37
  */
38
- declare function usePowerlinesContext<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): PowerlinesContextInterface<TContext, TMeta> | undefined;
38
+ declare function usePowerlinesContext<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): PowerlinesContextInterface<TContext, TMeta> | null;
39
39
  /**
40
40
  * Hook to safely access the {@link PluginContext | Powerlines context}.
41
41
  *
42
- * @returns The Powerlines context or undefined if not set.
42
+ * @returns The Powerlines context or null if not set.
43
43
  */
44
- declare function usePowerlinesSafe<TContext extends PluginContext = PluginContext>(): TContext | undefined;
44
+ declare function usePowerlinesSafe<TContext extends PluginContext = PluginContext>(): TContext | null;
45
45
  /**
46
46
  * Hook to access the {@link PluginContext | Powerlines context}.
47
47
  *
@@ -51,9 +51,9 @@ declare function usePowerlines<TContext extends PluginContext = PluginContext>()
51
51
  /**
52
52
  * Hook to safely access the render context's metadata.
53
53
  *
54
- * @returns The Powerlines context or undefined if not set.
54
+ * @returns The Powerlines context or null if not set.
55
55
  */
56
- declare function useMetaSafe<TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): TMeta | undefined;
56
+ declare function useMetaSafe<TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): TMeta | null;
57
57
  /**
58
58
  * Hook to access the render context's metadata.
59
59
  *
@@ -35,13 +35,13 @@ interface PowerlinesContextInterface<TContext extends PluginContext = PluginCont
35
35
  *
36
36
  * @returns The Context.
37
37
  */
38
- declare function usePowerlinesContext<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): PowerlinesContextInterface<TContext, TMeta> | undefined;
38
+ declare function usePowerlinesContext<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): PowerlinesContextInterface<TContext, TMeta> | null;
39
39
  /**
40
40
  * Hook to safely access the {@link PluginContext | Powerlines context}.
41
41
  *
42
- * @returns The Powerlines context or undefined if not set.
42
+ * @returns The Powerlines context or null if not set.
43
43
  */
44
- declare function usePowerlinesSafe<TContext extends PluginContext = PluginContext>(): TContext | undefined;
44
+ declare function usePowerlinesSafe<TContext extends PluginContext = PluginContext>(): TContext | null;
45
45
  /**
46
46
  * Hook to access the {@link PluginContext | Powerlines context}.
47
47
  *
@@ -51,9 +51,9 @@ declare function usePowerlines<TContext extends PluginContext = PluginContext>()
51
51
  /**
52
52
  * Hook to safely access the render context's metadata.
53
53
  *
54
- * @returns The Powerlines context or undefined if not set.
54
+ * @returns The Powerlines context or null if not set.
55
55
  */
56
- declare function useMetaSafe<TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): TMeta | undefined;
56
+ declare function useMetaSafe<TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): TMeta | null;
57
57
  /**
58
58
  * Hook to access the render context's metadata.
59
59
  *
@@ -7,15 +7,15 @@ import { unctx } from "../../internal/unctx.mjs";
7
7
  * @returns The Context.
8
8
  */
9
9
  function usePowerlinesContext() {
10
- return unctx.use();
10
+ return unctx.tryUse();
11
11
  }
12
12
  /**
13
13
  * Hook to safely access the {@link PluginContext | Powerlines context}.
14
14
  *
15
- * @returns The Powerlines context or undefined if not set.
15
+ * @returns The Powerlines context or null if not set.
16
16
  */
17
17
  function usePowerlinesSafe() {
18
- return usePowerlinesContext()?.value;
18
+ return usePowerlinesContext()?.value ?? null;
19
19
  }
20
20
  /**
21
21
  * Hook to access the {@link PluginContext | Powerlines context}.
@@ -30,10 +30,10 @@ function usePowerlines() {
30
30
  /**
31
31
  * Hook to safely access the render context's metadata.
32
32
  *
33
- * @returns The Powerlines context or undefined if not set.
33
+ * @returns The Powerlines context or null if not set.
34
34
  */
35
35
  function useMetaSafe() {
36
- return usePowerlinesContext()?.meta;
36
+ return usePowerlinesContext()?.meta ?? null;
37
37
  }
38
38
  /**
39
39
  * Hook to access the render context's metadata.
@@ -1,18 +1,18 @@
1
- const require_core_components_output = require('./components/output.cjs');
2
- const require_core_components_single_line_comment = require('./components/single-line-comment.cjs');
1
+ const require_output = require('./components/output.cjs');
2
+ const require_single_line_comment = require('./components/single-line-comment.cjs');
3
3
  const require_core_contexts_context = require('./contexts/context.cjs');
4
4
  const require_core_contexts_reflection = require('./contexts/reflection.cjs');
5
5
  require('./contexts/index.cjs');
6
- const require_core_components_source_file = require('./components/source-file.cjs');
6
+ const require_source_file = require('./components/source-file.cjs');
7
7
  require('./components/index.cjs');
8
8
 
9
- exports.Output = require_core_components_output.Output;
9
+ exports.Output = require_output.Output;
10
10
  exports.ReflectionClassContext = require_core_contexts_reflection.ReflectionClassContext;
11
11
  exports.ReflectionMethodContext = require_core_contexts_reflection.ReflectionMethodContext;
12
12
  exports.ReflectionParameterContext = require_core_contexts_reflection.ReflectionParameterContext;
13
13
  exports.ReflectionPropertyContext = require_core_contexts_reflection.ReflectionPropertyContext;
14
- exports.SingleLineComment = require_core_components_single_line_comment.SingleLineComment;
15
- exports.SourceFile = require_core_components_source_file.SourceFile;
14
+ exports.SingleLineComment = require_single_line_comment.SingleLineComment;
15
+ exports.SourceFile = require_source_file.SourceFile;
16
16
  exports.useMeta = require_core_contexts_context.useMeta;
17
17
  exports.useMetaSafe = require_core_contexts_context.useMetaSafe;
18
18
  exports.usePowerlines = require_core_contexts_context.usePowerlines;
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
2
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
- const require_core_components_output = require('./core/components/output.cjs');
3
+ const require_output = require('./core/components/output.cjs');
4
4
  const require_unctx = require('./internal/unctx.cjs');
5
5
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
6
  let __alloy_js_babel_preset = require("@alloy-js/babel-preset");
@@ -58,44 +58,44 @@ const plugin = (options = {}) => {
58
58
  async handler() {
59
59
  this.debug("Attaching the `render` method to the context object.");
60
60
  this.render = async (children) => {
61
+ const _self$ = this;
61
62
  const meta = {};
62
- await require_unctx.unctx.callAsync({
63
+ require_unctx.unctx.set({
63
64
  value: this,
64
65
  meta
65
- }, async () => {
66
- const _self$ = this;
67
- await (0, __alloy_js_core.traverseOutput)(await (0, __alloy_js_core.renderAsync)((0, __alloy_js_core_jsx_runtime.createComponent)(require_core_components_output.Output, {
68
- context: _self$,
69
- meta,
70
- get basePath() {
71
- return _self$.workspaceConfig.workspaceRoot;
72
- },
73
- children
74
- })), {
75
- visitDirectory: (directory) => {
76
- if (this.fs.existsSync(directory.path)) return;
77
- this.fs.mkdirSync(directory.path);
78
- },
79
- visitFile: (file) => {
80
- if ("contents" in file) {
81
- const metadata = meta[file.path] ?? {};
82
- if (metadata.kind === "builtin") {
83
- if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
84
- this.emitBuiltinSync(file.contents, metadata.id, {
85
- skipFormat: metadata.skipFormat,
86
- storage: metadata.storage,
87
- extension: (0, __stryke_path_file_path_fns.findFileExtension)(file.path)
88
- });
89
- } else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
66
+ });
67
+ await (0, __alloy_js_core.traverseOutput)(await (0, __alloy_js_core.renderAsync)((0, __alloy_js_core_jsx_runtime.createComponent)(require_output.Output, {
68
+ context: _self$,
69
+ meta,
70
+ get basePath() {
71
+ return _self$.workspaceConfig.workspaceRoot;
72
+ },
73
+ children
74
+ })), {
75
+ visitDirectory: (directory) => {
76
+ if (this.fs.existsSync(directory.path)) return;
77
+ this.fs.mkdirSync(directory.path);
78
+ },
79
+ visitFile: (file) => {
80
+ if ("contents" in file) {
81
+ const metadata = meta[file.path] ?? {};
82
+ if (metadata.kind === "builtin") {
83
+ if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
84
+ this.emitBuiltinSync(file.contents, metadata.id, {
90
85
  skipFormat: metadata.skipFormat,
91
86
  storage: metadata.storage,
92
- ...metadata.typeDefinition ?? {}
87
+ extension: (0, __stryke_path_file_path_fns.findFileExtension)(file.path)
93
88
  });
94
- else this.emitSync(file.contents, file.path, metadata);
95
- } else this.fs.copySync(file.sourcePath, file.path);
96
- }
97
- });
89
+ } else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
90
+ skipFormat: metadata.skipFormat,
91
+ storage: metadata.storage,
92
+ ...metadata.typeDefinition ?? {}
93
+ });
94
+ else this.emitSync(file.contents, file.path, metadata);
95
+ } else this.fs.copySync(file.sourcePath, file.path);
96
+ }
98
97
  });
98
+ require_unctx.unctx.unset();
99
99
  };
100
100
  }
101
101
  }
package/dist/index.mjs CHANGED
@@ -54,44 +54,44 @@ const plugin = (options = {}) => {
54
54
  async handler() {
55
55
  this.debug("Attaching the `render` method to the context object.");
56
56
  this.render = async (children) => {
57
+ const _self$ = this;
57
58
  const meta = {};
58
- await unctx.callAsync({
59
+ unctx.set({
59
60
  value: this,
60
61
  meta
61
- }, async () => {
62
- const _self$ = this;
63
- await traverseOutput(await renderAsync(createComponent(Output$1, {
64
- context: _self$,
65
- meta,
66
- get basePath() {
67
- return _self$.workspaceConfig.workspaceRoot;
68
- },
69
- children
70
- })), {
71
- visitDirectory: (directory) => {
72
- if (this.fs.existsSync(directory.path)) return;
73
- this.fs.mkdirSync(directory.path);
74
- },
75
- visitFile: (file) => {
76
- if ("contents" in file) {
77
- const metadata = meta[file.path] ?? {};
78
- if (metadata.kind === "builtin") {
79
- if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
80
- this.emitBuiltinSync(file.contents, metadata.id, {
81
- skipFormat: metadata.skipFormat,
82
- storage: metadata.storage,
83
- extension: findFileExtension(file.path)
84
- });
85
- } else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
62
+ });
63
+ await traverseOutput(await renderAsync(createComponent(Output$1, {
64
+ context: _self$,
65
+ meta,
66
+ get basePath() {
67
+ return _self$.workspaceConfig.workspaceRoot;
68
+ },
69
+ children
70
+ })), {
71
+ visitDirectory: (directory) => {
72
+ if (this.fs.existsSync(directory.path)) return;
73
+ this.fs.mkdirSync(directory.path);
74
+ },
75
+ visitFile: (file) => {
76
+ if ("contents" in file) {
77
+ const metadata = meta[file.path] ?? {};
78
+ if (metadata.kind === "builtin") {
79
+ if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
80
+ this.emitBuiltinSync(file.contents, metadata.id, {
86
81
  skipFormat: metadata.skipFormat,
87
82
  storage: metadata.storage,
88
- ...metadata.typeDefinition ?? {}
83
+ extension: findFileExtension(file.path)
89
84
  });
90
- else this.emitSync(file.contents, file.path, metadata);
91
- } else this.fs.copySync(file.sourcePath, file.path);
92
- }
93
- });
85
+ } else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
86
+ skipFormat: metadata.skipFormat,
87
+ storage: metadata.storage,
88
+ ...metadata.typeDefinition ?? {}
89
+ });
90
+ else this.emitSync(file.contents, file.path, metadata);
91
+ } else this.fs.copySync(file.sourcePath, file.path);
92
+ }
94
93
  });
94
+ unctx.unset();
95
95
  };
96
96
  }
97
97
  }
@@ -1,12 +1,8 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- let node_async_hooks = require("node:async_hooks");
3
2
  let unctx = require("unctx");
4
3
 
5
4
  //#region src/internal/unctx.ts
6
- const unctx$1 = (0, unctx.createContext)({
7
- asyncContext: true,
8
- AsyncLocalStorage: node_async_hooks.AsyncLocalStorage
9
- });
5
+ const unctx$1 = (0, unctx.createContext)();
10
6
 
11
7
  //#endregion
12
8
  exports.unctx = unctx$1;
@@ -1,11 +1,7 @@
1
- import { AsyncLocalStorage } from "node:async_hooks";
2
1
  import { createContext } from "unctx";
3
2
 
4
3
  //#region src/internal/unctx.ts
5
- const unctx = createContext({
6
- asyncContext: true,
7
- AsyncLocalStorage
8
- });
4
+ const unctx = createContext();
9
5
 
10
6
  //#endregion
11
7
  export { unctx };
@@ -0,0 +1,28 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
3
+ let __alloy_js_core = require("@alloy-js/core");
4
+
5
+ //#region src/markdown/components/front-matter.tsx
6
+ /**
7
+ * Renders YAML front matter for a markdown file.
8
+ *
9
+ * @see https://jekyllrb.com/docs/front-matter/
10
+ */
11
+ function FrontMatter(props) {
12
+ return [
13
+ "---",
14
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
15
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
16
+ get each() {
17
+ return Object.entries(props.data);
18
+ },
19
+ hardline: true,
20
+ children: ([key, value]) => __alloy_js_core.code`${key}: ${JSON.stringify(value)}`
21
+ }),
22
+ "---",
23
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
24
+ ];
25
+ }
26
+
27
+ //#endregion
28
+ exports.FrontMatter = FrontMatter;
@@ -0,0 +1,15 @@
1
+ import * as _alloy_js_core2 from "@alloy-js/core";
2
+
3
+ //#region src/markdown/components/front-matter.d.ts
4
+ interface FrontMatterProps {
5
+ data: Record<string, any>;
6
+ }
7
+ /**
8
+ * Renders YAML front matter for a markdown file.
9
+ *
10
+ * @see https://jekyllrb.com/docs/front-matter/
11
+ */
12
+ declare function FrontMatter(props: FrontMatterProps): _alloy_js_core2.Children;
13
+ declare type __ΩFrontMatterProps = any[];
14
+ //#endregion
15
+ export { FrontMatter, FrontMatterProps, __ΩFrontMatterProps };
@@ -0,0 +1,15 @@
1
+ import * as _alloy_js_core5 from "@alloy-js/core";
2
+
3
+ //#region src/markdown/components/front-matter.d.ts
4
+ interface FrontMatterProps {
5
+ data: Record<string, any>;
6
+ }
7
+ /**
8
+ * Renders YAML front matter for a markdown file.
9
+ *
10
+ * @see https://jekyllrb.com/docs/front-matter/
11
+ */
12
+ declare function FrontMatter(props: FrontMatterProps): _alloy_js_core5.Children;
13
+ declare type __ΩFrontMatterProps = any[];
14
+ //#endregion
15
+ export { FrontMatter, FrontMatterProps, __ΩFrontMatterProps };
@@ -0,0 +1,27 @@
1
+ import { createComponent, createIntrinsic } from "@alloy-js/core/jsx-runtime";
2
+ import { For, code } from "@alloy-js/core";
3
+
4
+ //#region src/markdown/components/front-matter.tsx
5
+ /**
6
+ * Renders YAML front matter for a markdown file.
7
+ *
8
+ * @see https://jekyllrb.com/docs/front-matter/
9
+ */
10
+ function FrontMatter(props) {
11
+ return [
12
+ "---",
13
+ createIntrinsic("hbr", {}),
14
+ createComponent(For, {
15
+ get each() {
16
+ return Object.entries(props.data);
17
+ },
18
+ hardline: true,
19
+ children: ([key, value]) => code`${key}: ${JSON.stringify(value)}`
20
+ }),
21
+ "---",
22
+ createIntrinsic("hbr", {})
23
+ ];
24
+ }
25
+
26
+ //#endregion
27
+ export { FrontMatter };
@@ -1,8 +1,10 @@
1
- const require_markdown_components_markdown_file = require('./markdown-file.cjs');
2
- const require_markdown_components_markdown_table = require('./markdown-table.cjs');
1
+ const require_front_matter = require('./front-matter.cjs');
2
+ const require_markdown_file = require('./markdown-file.cjs');
3
+ const require_markdown_table = require('./markdown-table.cjs');
3
4
 
4
- exports.MarkdownFile = require_markdown_components_markdown_file.MarkdownFile;
5
- exports.MarkdownFileHeader = require_markdown_components_markdown_file.MarkdownFileHeader;
6
- exports.MarkdownTable = require_markdown_components_markdown_table.MarkdownTable;
7
- exports.MarkdownTableColumn = require_markdown_components_markdown_table.MarkdownTableColumn;
8
- exports.MarkdownTableColumnHeader = require_markdown_components_markdown_table.MarkdownTableColumnHeader;
5
+ exports.FrontMatter = require_front_matter.FrontMatter;
6
+ exports.MarkdownFile = require_markdown_file.MarkdownFile;
7
+ exports.MarkdownFileHeader = require_markdown_file.MarkdownFileHeader;
8
+ exports.MarkdownTable = require_markdown_table.MarkdownTable;
9
+ exports.MarkdownTableColumn = require_markdown_table.MarkdownTableColumn;
10
+ exports.MarkdownTableColumnHeader = require_markdown_table.MarkdownTableColumnHeader;
@@ -1,3 +1,4 @@
1
- import { MarkdownFile, MarkdownFileHeader, MarkdownFileProps, __ΩMarkdownFileProps } from "./markdown-file.cjs";
1
+ import { FrontMatter, FrontMatterProps, __ΩFrontMatterProps } from "./front-matter.cjs";
2
+ import { MarkdownFile, MarkdownFileHeader, MarkdownFileHeaderProps, MarkdownFileProps, __ΩMarkdownFileHeaderProps, __ΩMarkdownFileProps } from "./markdown-file.cjs";
2
3
  import { MarkdownTable, MarkdownTableColumn, MarkdownTableColumnHeader, MarkdownTableColumnProps, MarkdownTableProps, __ΩMarkdownTableColumnProps, __ΩMarkdownTableProps } from "./markdown-table.cjs";
3
- export { MarkdownFile, MarkdownFileHeader, MarkdownFileProps, MarkdownTable, MarkdownTableColumn, MarkdownTableColumnHeader, MarkdownTableColumnProps, MarkdownTableProps, __ΩMarkdownFileProps, __ΩMarkdownTableColumnProps, __ΩMarkdownTableProps };
4
+ export { FrontMatter, FrontMatterProps, MarkdownFile, MarkdownFileHeader, MarkdownFileHeaderProps, MarkdownFileProps, MarkdownTable, MarkdownTableColumn, MarkdownTableColumnHeader, MarkdownTableColumnProps, MarkdownTableProps, __ΩFrontMatterProps, __ΩMarkdownFileHeaderProps, __ΩMarkdownFileProps, __ΩMarkdownTableColumnProps, __ΩMarkdownTableProps };