@powerlines/plugin-alloy 0.19.3 → 0.19.5
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.
- package/dist/core/components/output.cjs +5 -15
- package/dist/core/components/output.d.cts +2 -2
- package/dist/core/components/output.d.mts +2 -2
- package/dist/core/components/output.mjs +5 -15
- package/dist/core/components/single-line-comment.d.cts +2 -2
- package/dist/core/components/source-file.d.cts +2 -2
- package/dist/core/components/source-file.d.mts +2 -2
- package/dist/core/contexts/context.cjs +6 -12
- package/dist/core/contexts/context.d.cts +6 -11
- package/dist/core/contexts/context.d.mts +6 -11
- package/dist/core/contexts/context.mjs +7 -11
- package/dist/core/contexts/index.cjs +0 -1
- package/dist/core/contexts/index.d.cts +2 -2
- package/dist/core/contexts/index.d.mts +2 -2
- package/dist/core/contexts/index.mjs +2 -2
- package/dist/core/index.cjs +1 -2
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.mjs +2 -2
- package/dist/index.cjs +35 -30
- package/dist/index.mjs +35 -30
- package/dist/internal/unctx.cjs +7 -0
- package/dist/internal/unctx.mjs +7 -0
- package/dist/markdown/components/front-matter.d.cts +2 -2
- package/dist/markdown/components/front-matter.d.mts +2 -2
- package/dist/markdown/components/markdown-file.cjs +1 -1
- package/dist/markdown/components/markdown-file.d.cts +3 -3
- package/dist/markdown/components/markdown-file.d.mts +3 -3
- package/dist/markdown/components/markdown-file.mjs +1 -1
- package/dist/markdown/components/markdown-table.d.cts +4 -4
- package/dist/markdown/components/markdown-table.d.mts +4 -4
- package/dist/node_modules/.pnpm/unctx@2.5.0/node_modules/unctx/dist/index.cjs +83 -0
- package/dist/node_modules/.pnpm/unctx@2.5.0/node_modules/unctx/dist/index.mjs +82 -0
- package/dist/typescript/components/builtin-file.d.cts +2 -2
- package/dist/typescript/components/builtin-file.d.mts +2 -2
- package/dist/typescript/components/dynamic-import-statement.d.cts +2 -2
- package/dist/typescript/components/dynamic-import-statement.d.mts +2 -2
- package/dist/typescript/components/entry-file.d.cts +2 -2
- package/dist/typescript/components/entry-file.d.mts +2 -2
- package/dist/typescript/components/tsdoc-reflection.d.cts +4 -4
- package/dist/typescript/components/tsdoc-reflection.d.mts +4 -4
- package/dist/typescript/components/typescript-file.cjs +1 -1
- package/dist/typescript/components/typescript-file.mjs +1 -1
- package/dist/typescript/components/typescript-interface.d.cts +3 -3
- package/dist/typescript/components/typescript-object.d.cts +3 -3
- package/dist/typescript/components/typescript-object.d.mts +3 -3
- package/package.json +64 -294
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_core_contexts_context = require('../contexts/context.cjs');
|
|
3
2
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
3
|
let __alloy_js_core = require("@alloy-js/core");
|
|
5
4
|
let __stryke_path_replace = require("@stryke/path/replace");
|
|
@@ -9,10 +8,9 @@ let __stryke_path_replace = require("@stryke/path/replace");
|
|
|
9
8
|
* Output component for rendering the Powerlines plugin's output files via templates.
|
|
10
9
|
*/
|
|
11
10
|
function Output(props) {
|
|
12
|
-
const [{ children, context,
|
|
11
|
+
const [{ children, context, basePath }, rest] = (0, __alloy_js_core.splitProps)(props, [
|
|
13
12
|
"children",
|
|
14
13
|
"context",
|
|
15
|
-
"meta",
|
|
16
14
|
"basePath"
|
|
17
15
|
]);
|
|
18
16
|
const basePathRef = (0, __alloy_js_core.computed)(() => basePath ? (0, __stryke_path_replace.replacePath)(basePath, context.workspaceConfig.workspaceRoot) : context.workspaceConfig.workspaceRoot);
|
|
@@ -21,19 +19,11 @@ function Output(props) {
|
|
|
21
19
|
return basePathRef.value;
|
|
22
20
|
},
|
|
23
21
|
get children() {
|
|
24
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
meta
|
|
22
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
23
|
+
get when() {
|
|
24
|
+
return Boolean(context);
|
|
28
25
|
},
|
|
29
|
-
|
|
30
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
31
|
-
get when() {
|
|
32
|
-
return Boolean(context);
|
|
33
|
-
},
|
|
34
|
-
children
|
|
35
|
-
});
|
|
36
|
-
}
|
|
26
|
+
children
|
|
37
27
|
});
|
|
38
28
|
}
|
|
39
29
|
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MetaItem } from "../contexts/context.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
import { OutputProps } from "@alloy-js/core";
|
|
4
4
|
import { PluginContext } from "powerlines/types/context";
|
|
5
5
|
|
|
@@ -17,7 +17,7 @@ interface OutputProps$1<TContext extends PluginContext = PluginContext, TMeta ex
|
|
|
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$1<TContext, TMeta>):
|
|
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
23
|
export { Output, OutputProps$1 as OutputProps, __ΩOutputProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MetaItem } from "../contexts/context.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
import { OutputProps } from "@alloy-js/core";
|
|
4
4
|
import { PluginContext } from "powerlines/types/context";
|
|
5
5
|
|
|
@@ -17,7 +17,7 @@ interface OutputProps$1<TContext extends PluginContext = PluginContext, TMeta ex
|
|
|
17
17
|
/**
|
|
18
18
|
* Output component for rendering the Powerlines plugin's output files via templates.
|
|
19
19
|
*/
|
|
20
|
-
declare function Output$1<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(props: OutputProps$1<TContext, TMeta>):
|
|
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
23
|
export { Output$1 as Output, OutputProps$1 as OutputProps, __ΩOutputProps };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PowerlinesContext } from "../contexts/context.mjs";
|
|
2
1
|
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
2
|
import { Output, Show, computed, splitProps } from "@alloy-js/core";
|
|
4
3
|
import { replacePath } from "@stryke/path/replace";
|
|
@@ -8,10 +7,9 @@ import { replacePath } from "@stryke/path/replace";
|
|
|
8
7
|
* Output component for rendering the Powerlines plugin's output files via templates.
|
|
9
8
|
*/
|
|
10
9
|
function Output$1(props) {
|
|
11
|
-
const [{ children, context,
|
|
10
|
+
const [{ children, context, basePath }, rest] = splitProps(props, [
|
|
12
11
|
"children",
|
|
13
12
|
"context",
|
|
14
|
-
"meta",
|
|
15
13
|
"basePath"
|
|
16
14
|
]);
|
|
17
15
|
const basePathRef = computed(() => basePath ? replacePath(basePath, context.workspaceConfig.workspaceRoot) : context.workspaceConfig.workspaceRoot);
|
|
@@ -20,19 +18,11 @@ function Output$1(props) {
|
|
|
20
18
|
return basePathRef.value;
|
|
21
19
|
},
|
|
22
20
|
get children() {
|
|
23
|
-
return createComponent(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
meta
|
|
21
|
+
return createComponent(Show, {
|
|
22
|
+
get when() {
|
|
23
|
+
return Boolean(context);
|
|
27
24
|
},
|
|
28
|
-
|
|
29
|
-
return createComponent(Show, {
|
|
30
|
-
get when() {
|
|
31
|
-
return Boolean(context);
|
|
32
|
-
},
|
|
33
|
-
children
|
|
34
|
-
});
|
|
35
|
-
}
|
|
25
|
+
children
|
|
36
26
|
});
|
|
37
27
|
}
|
|
38
28
|
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core4 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):
|
|
18
|
+
declare function SingleLineComment(props: SingleLineCommentProps): _alloy_js_core4.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.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
import { SourceFileProps } from "@alloy-js/core";
|
|
4
4
|
import { StoragePreset } from "powerlines/types/fs";
|
|
5
5
|
|
|
@@ -26,7 +26,7 @@ type SourceFileProps$1 = SourceFileProps & 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$1):
|
|
29
|
+
declare function SourceFile(props: SourceFileProps$1): _alloy_js_core0.Children;
|
|
30
30
|
declare type __ΩSourceFileProps = any[];
|
|
31
31
|
//#endregion
|
|
32
32
|
export { SourceFile, SourceFileProps$1 as SourceFileProps, __ΩSourceFileProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core1 from "@alloy-js/core";
|
|
3
3
|
import { SourceFileProps } from "@alloy-js/core";
|
|
4
4
|
import { StoragePreset } from "powerlines/types/fs";
|
|
5
5
|
|
|
@@ -26,7 +26,7 @@ type SourceFileProps$1 = SourceFileProps & 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$1):
|
|
29
|
+
declare function SourceFile(props: SourceFileProps$1): _alloy_js_core1.Children;
|
|
30
30
|
declare type __ΩSourceFileProps = any[];
|
|
31
31
|
//#endregion
|
|
32
32
|
export { SourceFile, SourceFileProps$1 as SourceFileProps, __ΩSourceFileProps };
|
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
const
|
|
2
|
-
let __alloy_js_core = require("@alloy-js/core");
|
|
1
|
+
const require_unctx = require('../../internal/unctx.cjs');
|
|
3
2
|
|
|
4
3
|
//#region src/core/contexts/context.ts
|
|
5
4
|
/**
|
|
6
|
-
* The Powerlines context used in template rendering.
|
|
7
|
-
*/
|
|
8
|
-
const PowerlinesContext = (0, __alloy_js_core.createNamedContext)("Powerlines");
|
|
9
|
-
/**
|
|
10
5
|
* Hook to access the Powerlines Context.
|
|
11
6
|
*
|
|
12
7
|
* @returns The Context.
|
|
13
8
|
*/
|
|
14
9
|
function usePowerlinesContext() {
|
|
15
|
-
return
|
|
10
|
+
return require_unctx.unctx.tryUse();
|
|
16
11
|
}
|
|
17
12
|
/**
|
|
18
13
|
* Hook to safely access the {@link PluginContext | Powerlines context}.
|
|
19
14
|
*
|
|
20
|
-
* @returns The Powerlines context or
|
|
15
|
+
* @returns The Powerlines context or null if not set.
|
|
21
16
|
*/
|
|
22
17
|
function usePowerlinesSafe() {
|
|
23
|
-
return usePowerlinesContext()?.value;
|
|
18
|
+
return usePowerlinesContext()?.value ?? null;
|
|
24
19
|
}
|
|
25
20
|
/**
|
|
26
21
|
* Hook to access the {@link PluginContext | Powerlines context}.
|
|
@@ -35,10 +30,10 @@ function usePowerlines() {
|
|
|
35
30
|
/**
|
|
36
31
|
* Hook to safely access the render context's metadata.
|
|
37
32
|
*
|
|
38
|
-
* @returns The Powerlines context or
|
|
33
|
+
* @returns The Powerlines context or null if not set.
|
|
39
34
|
*/
|
|
40
35
|
function useMetaSafe() {
|
|
41
|
-
return usePowerlinesContext()?.meta;
|
|
36
|
+
return usePowerlinesContext()?.meta ?? null;
|
|
42
37
|
}
|
|
43
38
|
/**
|
|
44
39
|
* Hook to access the render context's metadata.
|
|
@@ -52,7 +47,6 @@ function useMeta() {
|
|
|
52
47
|
}
|
|
53
48
|
|
|
54
49
|
//#endregion
|
|
55
|
-
exports.PowerlinesContext = PowerlinesContext;
|
|
56
50
|
exports.useMeta = useMeta;
|
|
57
51
|
exports.useMetaSafe = useMetaSafe;
|
|
58
52
|
exports.usePowerlines = usePowerlines;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ComponentContext } from "@alloy-js/core";
|
|
2
1
|
import { PluginContext } from "powerlines/types/context";
|
|
3
2
|
import { StoragePreset } from "powerlines/types/fs";
|
|
4
3
|
|
|
@@ -31,22 +30,18 @@ interface PowerlinesContextInterface<TContext extends PluginContext = PluginCont
|
|
|
31
30
|
*/
|
|
32
31
|
meta: TMeta;
|
|
33
32
|
}
|
|
34
|
-
/**
|
|
35
|
-
* The Powerlines context used in template rendering.
|
|
36
|
-
*/
|
|
37
|
-
declare const PowerlinesContext: ComponentContext<PowerlinesContextInterface<any, any>>;
|
|
38
33
|
/**
|
|
39
34
|
* Hook to access the Powerlines Context.
|
|
40
35
|
*
|
|
41
36
|
* @returns The Context.
|
|
42
37
|
*/
|
|
43
|
-
declare function usePowerlinesContext<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): PowerlinesContextInterface<TContext, TMeta> |
|
|
38
|
+
declare function usePowerlinesContext<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): PowerlinesContextInterface<TContext, TMeta> | null;
|
|
44
39
|
/**
|
|
45
40
|
* Hook to safely access the {@link PluginContext | Powerlines context}.
|
|
46
41
|
*
|
|
47
|
-
* @returns The Powerlines context or
|
|
42
|
+
* @returns The Powerlines context or null if not set.
|
|
48
43
|
*/
|
|
49
|
-
declare function usePowerlinesSafe<TContext extends PluginContext = PluginContext>(): TContext |
|
|
44
|
+
declare function usePowerlinesSafe<TContext extends PluginContext = PluginContext>(): TContext | null;
|
|
50
45
|
/**
|
|
51
46
|
* Hook to access the {@link PluginContext | Powerlines context}.
|
|
52
47
|
*
|
|
@@ -56,9 +51,9 @@ declare function usePowerlines<TContext extends PluginContext = PluginContext>()
|
|
|
56
51
|
/**
|
|
57
52
|
* Hook to safely access the render context's metadata.
|
|
58
53
|
*
|
|
59
|
-
* @returns The Powerlines context or
|
|
54
|
+
* @returns The Powerlines context or null if not set.
|
|
60
55
|
*/
|
|
61
|
-
declare function useMetaSafe<TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): TMeta |
|
|
56
|
+
declare function useMetaSafe<TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): TMeta | null;
|
|
62
57
|
/**
|
|
63
58
|
* Hook to access the render context's metadata.
|
|
64
59
|
*
|
|
@@ -68,4 +63,4 @@ declare function useMeta<TMeta extends Record<string, MetaItem> = Record<string,
|
|
|
68
63
|
declare type __ΩMetaItem = any[];
|
|
69
64
|
declare type __ΩPowerlinesContextInterface = any[];
|
|
70
65
|
//#endregion
|
|
71
|
-
export { MetaItem,
|
|
66
|
+
export { MetaItem, PowerlinesContextInterface, __ΩMetaItem, __ΩPowerlinesContextInterface, useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ComponentContext } from "@alloy-js/core";
|
|
2
1
|
import { PluginContext } from "powerlines/types/context";
|
|
3
2
|
import { StoragePreset } from "powerlines/types/fs";
|
|
4
3
|
|
|
@@ -31,22 +30,18 @@ interface PowerlinesContextInterface<TContext extends PluginContext = PluginCont
|
|
|
31
30
|
*/
|
|
32
31
|
meta: TMeta;
|
|
33
32
|
}
|
|
34
|
-
/**
|
|
35
|
-
* The Powerlines context used in template rendering.
|
|
36
|
-
*/
|
|
37
|
-
declare const PowerlinesContext: ComponentContext<PowerlinesContextInterface<any, any>>;
|
|
38
33
|
/**
|
|
39
34
|
* Hook to access the Powerlines Context.
|
|
40
35
|
*
|
|
41
36
|
* @returns The Context.
|
|
42
37
|
*/
|
|
43
|
-
declare function usePowerlinesContext<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): PowerlinesContextInterface<TContext, TMeta> |
|
|
38
|
+
declare function usePowerlinesContext<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): PowerlinesContextInterface<TContext, TMeta> | null;
|
|
44
39
|
/**
|
|
45
40
|
* Hook to safely access the {@link PluginContext | Powerlines context}.
|
|
46
41
|
*
|
|
47
|
-
* @returns The Powerlines context or
|
|
42
|
+
* @returns The Powerlines context or null if not set.
|
|
48
43
|
*/
|
|
49
|
-
declare function usePowerlinesSafe<TContext extends PluginContext = PluginContext>(): TContext |
|
|
44
|
+
declare function usePowerlinesSafe<TContext extends PluginContext = PluginContext>(): TContext | null;
|
|
50
45
|
/**
|
|
51
46
|
* Hook to access the {@link PluginContext | Powerlines context}.
|
|
52
47
|
*
|
|
@@ -56,9 +51,9 @@ declare function usePowerlines<TContext extends PluginContext = PluginContext>()
|
|
|
56
51
|
/**
|
|
57
52
|
* Hook to safely access the render context's metadata.
|
|
58
53
|
*
|
|
59
|
-
* @returns The Powerlines context or
|
|
54
|
+
* @returns The Powerlines context or null if not set.
|
|
60
55
|
*/
|
|
61
|
-
declare function useMetaSafe<TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): TMeta |
|
|
56
|
+
declare function useMetaSafe<TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(): TMeta | null;
|
|
62
57
|
/**
|
|
63
58
|
* Hook to access the render context's metadata.
|
|
64
59
|
*
|
|
@@ -68,4 +63,4 @@ declare function useMeta<TMeta extends Record<string, MetaItem> = Record<string,
|
|
|
68
63
|
declare type __ΩMetaItem = any[];
|
|
69
64
|
declare type __ΩPowerlinesContextInterface = any[];
|
|
70
65
|
//#endregion
|
|
71
|
-
export { MetaItem,
|
|
66
|
+
export { MetaItem, PowerlinesContextInterface, __ΩMetaItem, __ΩPowerlinesContextInterface, useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe };
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unctx } from "../../internal/unctx.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/core/contexts/context.ts
|
|
4
4
|
/**
|
|
5
|
-
* The Powerlines context used in template rendering.
|
|
6
|
-
*/
|
|
7
|
-
const PowerlinesContext = createNamedContext("Powerlines");
|
|
8
|
-
/**
|
|
9
5
|
* Hook to access the Powerlines Context.
|
|
10
6
|
*
|
|
11
7
|
* @returns The Context.
|
|
12
8
|
*/
|
|
13
9
|
function usePowerlinesContext() {
|
|
14
|
-
return
|
|
10
|
+
return unctx.tryUse();
|
|
15
11
|
}
|
|
16
12
|
/**
|
|
17
13
|
* Hook to safely access the {@link PluginContext | Powerlines context}.
|
|
18
14
|
*
|
|
19
|
-
* @returns The Powerlines context or
|
|
15
|
+
* @returns The Powerlines context or null if not set.
|
|
20
16
|
*/
|
|
21
17
|
function usePowerlinesSafe() {
|
|
22
|
-
return usePowerlinesContext()?.value;
|
|
18
|
+
return usePowerlinesContext()?.value ?? null;
|
|
23
19
|
}
|
|
24
20
|
/**
|
|
25
21
|
* Hook to access the {@link PluginContext | Powerlines context}.
|
|
@@ -34,10 +30,10 @@ function usePowerlines() {
|
|
|
34
30
|
/**
|
|
35
31
|
* Hook to safely access the render context's metadata.
|
|
36
32
|
*
|
|
37
|
-
* @returns The Powerlines context or
|
|
33
|
+
* @returns The Powerlines context or null if not set.
|
|
38
34
|
*/
|
|
39
35
|
function useMetaSafe() {
|
|
40
|
-
return usePowerlinesContext()?.meta;
|
|
36
|
+
return usePowerlinesContext()?.meta ?? null;
|
|
41
37
|
}
|
|
42
38
|
/**
|
|
43
39
|
* Hook to access the render context's metadata.
|
|
@@ -51,4 +47,4 @@ function useMeta() {
|
|
|
51
47
|
}
|
|
52
48
|
|
|
53
49
|
//#endregion
|
|
54
|
-
export {
|
|
50
|
+
export { useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const require_core_contexts_context = require('./context.cjs');
|
|
2
2
|
const require_core_contexts_reflection = require('./reflection.cjs');
|
|
3
3
|
|
|
4
|
-
exports.PowerlinesContext = require_core_contexts_context.PowerlinesContext;
|
|
5
4
|
exports.ReflectionClassContext = require_core_contexts_reflection.ReflectionClassContext;
|
|
6
5
|
exports.ReflectionMethodContext = require_core_contexts_reflection.ReflectionMethodContext;
|
|
7
6
|
exports.ReflectionParameterContext = require_core_contexts_reflection.ReflectionParameterContext;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { MetaItem,
|
|
1
|
+
import { MetaItem, PowerlinesContextInterface, __ΩMetaItem, __ΩPowerlinesContextInterface, useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe } from "./context.cjs";
|
|
2
2
|
import { ReflectionClassContext, ReflectionClassContextInterface, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, __ΩReflectionClassContextInterface, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty } from "./reflection.cjs";
|
|
3
|
-
export { MetaItem,
|
|
3
|
+
export { MetaItem, PowerlinesContextInterface, ReflectionClassContext, ReflectionClassContextInterface, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, __ΩMetaItem, __ΩPowerlinesContextInterface, __ΩReflectionClassContextInterface, useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { MetaItem,
|
|
1
|
+
import { MetaItem, PowerlinesContextInterface, __ΩMetaItem, __ΩPowerlinesContextInterface, useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe } from "./context.mjs";
|
|
2
2
|
import { ReflectionClassContext, ReflectionClassContextInterface, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, __ΩReflectionClassContextInterface, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty } from "./reflection.mjs";
|
|
3
|
-
export { MetaItem,
|
|
3
|
+
export { MetaItem, PowerlinesContextInterface, ReflectionClassContext, ReflectionClassContextInterface, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, __ΩMetaItem, __ΩPowerlinesContextInterface, __ΩReflectionClassContextInterface, useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe } from "./context.mjs";
|
|
2
2
|
import { ReflectionClassContext, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty } from "./reflection.mjs";
|
|
3
3
|
|
|
4
|
-
export {
|
|
4
|
+
export { ReflectionClassContext, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty };
|
package/dist/core/index.cjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
const require_core_contexts_context = require('./contexts/context.cjs');
|
|
2
1
|
const require_output = require('./components/output.cjs');
|
|
3
2
|
const require_single_line_comment = require('./components/single-line-comment.cjs');
|
|
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
6
|
const require_source_file = require('./components/source-file.cjs');
|
|
7
7
|
require('./components/index.cjs');
|
|
8
8
|
|
|
9
9
|
exports.Output = require_output.Output;
|
|
10
|
-
exports.PowerlinesContext = require_core_contexts_context.PowerlinesContext;
|
|
11
10
|
exports.ReflectionClassContext = require_core_contexts_reflection.ReflectionClassContext;
|
|
12
11
|
exports.ReflectionMethodContext = require_core_contexts_reflection.ReflectionMethodContext;
|
|
13
12
|
exports.ReflectionParameterContext = require_core_contexts_reflection.ReflectionParameterContext;
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { MetaItem,
|
|
1
|
+
import { MetaItem, PowerlinesContextInterface, __ΩMetaItem, __ΩPowerlinesContextInterface, useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe } from "./contexts/context.cjs";
|
|
2
2
|
import { Output, OutputProps, __ΩOutputProps } from "./components/output.cjs";
|
|
3
3
|
import { SingleLineComment, SingleLineCommentProps, SingleLineCommentVariant, __ΩSingleLineCommentProps, __ΩSingleLineCommentVariant } from "./components/single-line-comment.cjs";
|
|
4
4
|
import { SourceFile, SourceFileProps, __ΩSourceFileProps } from "./components/source-file.cjs";
|
|
5
5
|
import "./components/index.cjs";
|
|
6
6
|
import { ReflectionClassContext, ReflectionClassContextInterface, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, __ΩReflectionClassContextInterface, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty } from "./contexts/reflection.cjs";
|
|
7
7
|
import "./contexts/index.cjs";
|
|
8
|
-
export { MetaItem, Output, OutputProps,
|
|
8
|
+
export { MetaItem, Output, OutputProps, PowerlinesContextInterface, ReflectionClassContext, ReflectionClassContextInterface, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, SingleLineComment, SingleLineCommentProps, SingleLineCommentVariant, SourceFile, SourceFileProps, __ΩMetaItem, __ΩOutputProps, __ΩPowerlinesContextInterface, __ΩReflectionClassContextInterface, __ΩSingleLineCommentProps, __ΩSingleLineCommentVariant, __ΩSourceFileProps, useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty };
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { MetaItem,
|
|
1
|
+
import { MetaItem, PowerlinesContextInterface, __ΩMetaItem, __ΩPowerlinesContextInterface, useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe } from "./contexts/context.mjs";
|
|
2
2
|
import { Output, OutputProps, __ΩOutputProps } from "./components/output.mjs";
|
|
3
3
|
import { SingleLineComment, SingleLineCommentProps, SingleLineCommentVariant, __ΩSingleLineCommentProps, __ΩSingleLineCommentVariant } from "./components/single-line-comment.mjs";
|
|
4
4
|
import { SourceFile, SourceFileProps, __ΩSourceFileProps } from "./components/source-file.mjs";
|
|
5
5
|
import "./components/index.mjs";
|
|
6
6
|
import { ReflectionClassContext, ReflectionClassContextInterface, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, __ΩReflectionClassContextInterface, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty } from "./contexts/reflection.mjs";
|
|
7
7
|
import "./contexts/index.mjs";
|
|
8
|
-
export { MetaItem, Output, OutputProps,
|
|
8
|
+
export { MetaItem, Output, OutputProps, PowerlinesContextInterface, ReflectionClassContext, ReflectionClassContextInterface, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, SingleLineComment, SingleLineCommentProps, SingleLineCommentVariant, SourceFile, SourceFileProps, __ΩMetaItem, __ΩOutputProps, __ΩPowerlinesContextInterface, __ΩReflectionClassContextInterface, __ΩSingleLineCommentProps, __ΩSingleLineCommentVariant, __ΩSourceFileProps, useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty };
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { PowerlinesContext, useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe } from "./contexts/context.mjs";
|
|
2
1
|
import { Output } from "./components/output.mjs";
|
|
3
2
|
import { SingleLineComment } from "./components/single-line-comment.mjs";
|
|
3
|
+
import { useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe } from "./contexts/context.mjs";
|
|
4
4
|
import { ReflectionClassContext, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty } from "./contexts/reflection.mjs";
|
|
5
5
|
import "./contexts/index.mjs";
|
|
6
6
|
import { SourceFile } from "./components/source-file.mjs";
|
|
7
7
|
import "./components/index.mjs";
|
|
8
8
|
|
|
9
|
-
export { Output,
|
|
9
|
+
export { Output, ReflectionClassContext, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, SingleLineComment, SourceFile, useMeta, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty };
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
3
|
const require_output = require('./core/components/output.cjs');
|
|
4
|
+
const require_unctx = require('./internal/unctx.cjs');
|
|
4
5
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
6
|
let __alloy_js_babel_preset = require("@alloy-js/babel-preset");
|
|
6
7
|
__alloy_js_babel_preset = require_rolldown_runtime.__toESM(__alloy_js_babel_preset);
|
|
@@ -36,8 +37,7 @@ const plugin = (options = {}) => {
|
|
|
36
37
|
]] } },
|
|
37
38
|
build: {
|
|
38
39
|
inputOptions: { transform: { jsx: "preserve" } },
|
|
39
|
-
external: [/^@?powerlines\//, /^@alloy-js\//]
|
|
40
|
-
noExternal: ["@powerlines/plugin-alloy"]
|
|
40
|
+
external: [/^@?powerlines\//, /^@alloy-js\//]
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
},
|
|
@@ -58,38 +58,43 @@ 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;
|
|
62
61
|
const meta = {};
|
|
63
|
-
await
|
|
64
|
-
|
|
65
|
-
meta
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
62
|
+
await require_unctx.unctx.callAsync({
|
|
63
|
+
value: this,
|
|
64
|
+
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_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, {
|
|
81
90
|
skipFormat: metadata.skipFormat,
|
|
82
91
|
storage: metadata.storage,
|
|
83
|
-
|
|
92
|
+
...metadata.typeDefinition ?? {}
|
|
84
93
|
});
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
});
|
|
90
|
-
else this.emitSync(file.contents, file.path, metadata);
|
|
91
|
-
} else this.fs.copySync(file.sourcePath, file.path);
|
|
92
|
-
}
|
|
94
|
+
else this.emitSync(file.contents, file.path, metadata);
|
|
95
|
+
} else this.fs.copySync(file.sourcePath, file.path);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
93
98
|
});
|
|
94
99
|
};
|
|
95
100
|
}
|