@powerlines/plugin-alloy 0.26.75 → 0.26.77
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/_virtual/_rolldown/runtime.cjs +29 -1
- package/dist/core/components/index.cjs +12 -1
- package/dist/core/components/index.mjs +7 -1
- package/dist/core/components/infrastructure-file.cjs +48 -1
- package/dist/core/components/infrastructure-file.mjs +45 -1
- package/dist/core/components/infrastructure-file.mjs.map +1 -1
- package/dist/core/components/output.cjs +41 -1
- package/dist/core/components/output.mjs +39 -1
- package/dist/core/components/output.mjs.map +1 -1
- package/dist/core/components/single-line-comment.cjs +23 -1
- package/dist/core/components/single-line-comment.mjs +21 -1
- package/dist/core/components/single-line-comment.mjs.map +1 -1
- package/dist/core/components/source-file.cjs +64 -1
- package/dist/core/components/source-file.mjs +61 -1
- package/dist/core/components/source-file.mjs.map +1 -1
- package/dist/core/components/spacing.cjs +20 -1
- package/dist/core/components/spacing.mjs +18 -1
- package/dist/core/components/spacing.mjs.map +1 -1
- package/dist/core/contexts/context.cjs +41 -1
- package/dist/core/contexts/context.mjs +36 -1
- package/dist/core/contexts/context.mjs.map +1 -1
- package/dist/core/contexts/index.cjs +22 -1
- package/dist/core/contexts/index.mjs +5 -1
- package/dist/core/contexts/meta.cjs +41 -1
- package/dist/core/contexts/meta.mjs +36 -1
- package/dist/core/contexts/meta.mjs.map +1 -1
- package/dist/core/contexts/reflection.cjs +80 -1
- package/dist/core/contexts/reflection.mjs +70 -1
- package/dist/core/contexts/reflection.mjs.map +1 -1
- package/dist/core/helpers/code.cjs +34 -1
- package/dist/core/helpers/code.mjs +32 -1
- package/dist/core/helpers/code.mjs.map +1 -1
- package/dist/core/helpers/index.cjs +4 -1
- package/dist/core/helpers/index.mjs +3 -1
- package/dist/core/index.cjs +37 -1
- package/dist/core/index.mjs +14 -1
- package/dist/hcl/components/block-declaration.cjs +34 -1
- package/dist/hcl/components/block-declaration.mjs +32 -1
- package/dist/hcl/components/block-declaration.mjs.map +1 -1
- package/dist/hcl/components/hcl-file.cjs +83 -1
- package/dist/hcl/components/hcl-file.mjs +80 -1
- package/dist/hcl/components/hcl-file.mjs.map +1 -1
- package/dist/hcl/components/index.cjs +11 -1
- package/dist/hcl/components/index.mjs +6 -1
- package/dist/hcl/components/packer-file.cjs +29 -1
- package/dist/hcl/components/packer-file.mjs +27 -1
- package/dist/hcl/components/packer-file.mjs.map +1 -1
- package/dist/hcl/components/terraform-file.cjs +30 -1
- package/dist/hcl/components/terraform-file.mjs +28 -1
- package/dist/hcl/components/terraform-file.mjs.map +1 -1
- package/dist/hcl/index.cjs +12 -1
- package/dist/hcl/index.mjs +7 -1
- package/dist/helpers/capnp.cjs +245 -37
- package/dist/helpers/capnp.mjs +227 -37
- package/dist/helpers/capnp.mjs.map +1 -1
- package/dist/helpers/create-builtin.cjs +20 -1
- package/dist/helpers/create-builtin.mjs +18 -1
- package/dist/helpers/create-builtin.mjs.map +1 -1
- package/dist/helpers/index.cjs +25 -1
- package/dist/helpers/index.mjs +6 -1
- package/dist/helpers/refkey.cjs +17 -1
- package/dist/helpers/refkey.mjs +15 -1
- package/dist/helpers/refkey.mjs.map +1 -1
- package/dist/helpers/typescript.cjs +43 -19
- package/dist/helpers/typescript.mjs +41 -19
- package/dist/helpers/typescript.mjs.map +1 -1
- package/dist/index.cjs +55 -1
- package/dist/index.mjs +51 -1
- package/dist/index.mjs.map +1 -1
- package/dist/markdown/components/front-matter.cjs +29 -1
- package/dist/markdown/components/front-matter.mjs +27 -1
- package/dist/markdown/components/front-matter.mjs.map +1 -1
- package/dist/markdown/components/heading.cjs +24 -1
- package/dist/markdown/components/heading.mjs +22 -1
- package/dist/markdown/components/heading.mjs.map +1 -1
- package/dist/markdown/components/index.cjs +13 -1
- package/dist/markdown/components/index.mjs +6 -1
- package/dist/markdown/components/markdown-file.cjs +135 -1
- package/dist/markdown/components/markdown-file.mjs +132 -1
- package/dist/markdown/components/markdown-file.mjs.map +1 -1
- package/dist/markdown/components/markdown-table.cjs +102 -1
- package/dist/markdown/components/markdown-table.mjs +98 -1
- package/dist/markdown/components/markdown-table.mjs.map +1 -1
- package/dist/markdown/contexts/index.cjs +7 -1
- package/dist/markdown/contexts/index.mjs +3 -1
- package/dist/markdown/contexts/markdown-table.cjs +38 -1
- package/dist/markdown/contexts/markdown-table.mjs +33 -1
- package/dist/markdown/contexts/markdown-table.mjs.map +1 -1
- package/dist/markdown/index.cjs +20 -1
- package/dist/markdown/index.mjs +9 -1
- package/dist/render.cjs +91 -1
- package/dist/render.mjs +88 -1
- package/dist/render.mjs.map +1 -1
- package/dist/types/components.cjs +9 -0
- package/dist/types/components.mjs +9 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/dist/typescript/components/builtin-file.cjs +63 -1
- package/dist/typescript/components/builtin-file.mjs +61 -1
- package/dist/typescript/components/builtin-file.mjs.map +1 -1
- package/dist/typescript/components/class-declaration.cjs +306 -1
- package/dist/typescript/components/class-declaration.mjs +299 -1
- package/dist/typescript/components/class-declaration.mjs.map +1 -1
- package/dist/typescript/components/dynamic-import-statement.cjs +26 -1
- package/dist/typescript/components/dynamic-import-statement.mjs +24 -1
- package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
- package/dist/typescript/components/entry-file.cjs +43 -1
- package/dist/typescript/components/entry-file.mjs +40 -1
- package/dist/typescript/components/entry-file.mjs.map +1 -1
- package/dist/typescript/components/index.cjs +64 -1
- package/dist/typescript/components/index.mjs +15 -1
- package/dist/typescript/components/interface-declaration.cjs +239 -1
- package/dist/typescript/components/interface-declaration.mjs +234 -1
- package/dist/typescript/components/interface-declaration.mjs.map +1 -1
- package/dist/typescript/components/object-declaration.cjs +139 -1
- package/dist/typescript/components/object-declaration.mjs +136 -1
- package/dist/typescript/components/object-declaration.mjs.map +1 -1
- package/dist/typescript/components/property-name.cjs +32 -1
- package/dist/typescript/components/property-name.mjs +30 -1
- package/dist/typescript/components/property-name.mjs.map +1 -1
- package/dist/typescript/components/record-expression.cjs +13 -3
- package/dist/typescript/components/record-expression.mjs +11 -3
- package/dist/typescript/components/record-expression.mjs.map +1 -1
- package/dist/typescript/components/tsdoc-reflection.cjs +331 -1
- package/dist/typescript/components/tsdoc-reflection.mjs +324 -1
- package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
- package/dist/typescript/components/tsdoc.cjs +497 -1
- package/dist/typescript/components/tsdoc.mjs +475 -1
- package/dist/typescript/components/tsdoc.mjs.map +1 -1
- package/dist/typescript/components/type-declaration.cjs +39 -1
- package/dist/typescript/components/type-declaration.mjs +37 -1
- package/dist/typescript/components/type-declaration.mjs.map +1 -1
- package/dist/typescript/components/type-parameters.cjs +83 -1
- package/dist/typescript/components/type-parameters.mjs +81 -1
- package/dist/typescript/components/type-parameters.mjs.map +1 -1
- package/dist/typescript/components/typescript-file.cjs +221 -1
- package/dist/typescript/components/typescript-file.mjs +217 -1
- package/dist/typescript/components/typescript-file.mjs.map +1 -1
- package/dist/typescript/contexts/index.cjs +4 -1
- package/dist/typescript/contexts/index.mjs +3 -1
- package/dist/typescript/contexts/lexical-scope.cjs +26 -1
- package/dist/typescript/contexts/lexical-scope.mjs +24 -1
- package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
- package/dist/typescript/contexts/member-scope.cjs +24 -1
- package/dist/typescript/contexts/member-scope.mjs +22 -1
- package/dist/typescript/contexts/member-scope.mjs.map +1 -1
- package/dist/typescript/helpers/get-call-signature-props.cjs +26 -1
- package/dist/typescript/helpers/get-call-signature-props.mjs +24 -1
- package/dist/typescript/helpers/get-call-signature-props.mjs.map +1 -1
- package/dist/typescript/helpers/index.cjs +6 -1
- package/dist/typescript/helpers/index.mjs +4 -1
- package/dist/typescript/helpers/utilities.cjs +15 -1
- package/dist/typescript/helpers/utilities.mjs +13 -1
- package/dist/typescript/helpers/utilities.mjs.map +1 -1
- package/dist/typescript/index.cjs +73 -1
- package/dist/typescript/index.mjs +21 -1
- package/dist/yaml/components/index.cjs +5 -1
- package/dist/yaml/components/index.mjs +3 -1
- package/dist/yaml/components/yaml-file.cjs +149 -1
- package/dist/yaml/components/yaml-file.mjs +146 -1
- package/dist/yaml/components/yaml-file.mjs.map +1 -1
- package/dist/yaml/index.cjs +6 -1
- package/dist/yaml/index.mjs +4 -1
- package/package.json +6 -6
|
@@ -1,2 +1,37 @@
|
|
|
1
|
-
import{createNamedContext
|
|
1
|
+
import { createNamedContext, useContext } from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
//#region src/core/contexts/context.ts
|
|
4
|
+
/**
|
|
5
|
+
* The Powerlines context used in template rendering.
|
|
6
|
+
*/
|
|
7
|
+
const PowerlinesContext = createNamedContext("Powerlines");
|
|
8
|
+
/**
|
|
9
|
+
* Hook to access the Powerlines Context.
|
|
10
|
+
*
|
|
11
|
+
* @returns The Context.
|
|
12
|
+
*/
|
|
13
|
+
function usePowerlinesContext() {
|
|
14
|
+
return useContext(PowerlinesContext);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Hook to safely access the {@link PluginContext | Powerlines context}.
|
|
18
|
+
*
|
|
19
|
+
* @returns The Powerlines context or undefined if not set.
|
|
20
|
+
*/
|
|
21
|
+
function usePowerlinesSafe() {
|
|
22
|
+
return usePowerlinesContext() ?? void 0;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Hook to access the {@link PluginContext | Powerlines context}.
|
|
26
|
+
*
|
|
27
|
+
* @returns The Powerlines context.
|
|
28
|
+
*/
|
|
29
|
+
function usePowerlines() {
|
|
30
|
+
const powerlines = usePowerlinesSafe();
|
|
31
|
+
if (!powerlines) throw new Error("Powerlines - Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
|
|
32
|
+
return powerlines;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { PowerlinesContext, usePowerlines, usePowerlinesContext, usePowerlinesSafe };
|
|
2
37
|
//# sourceMappingURL=context.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.mjs","names":[],"sources":["../../../src/core/contexts/context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ComponentContext,\n createNamedContext,\n useContext\n} from \"@alloy-js/core\";\nimport type { PluginContext } from \"powerlines\";\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const PowerlinesContext: ComponentContext<PluginContext> =\n createNamedContext<PluginContext>(\"Powerlines\");\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function usePowerlinesContext<\n TContext extends PluginContext = PluginContext\n>(): TContext | undefined {\n return useContext(PowerlinesContext) as TContext | undefined;\n}\n\n/**\n * Hook to safely access the {@link PluginContext | Powerlines context}.\n *\n * @returns The Powerlines context or undefined if not set.\n */\nexport function usePowerlinesSafe<\n TContext extends PluginContext = PluginContext\n>(): TContext | undefined {\n const powerlines = usePowerlinesContext<TContext>();\n\n return powerlines ?? undefined;\n}\n\n/**\n * Hook to access the {@link PluginContext | Powerlines context}.\n *\n * @returns The Powerlines context.\n */\nexport function usePowerlines<\n TContext extends PluginContext = PluginContext\n>(): TContext {\n const powerlines = usePowerlinesSafe<TContext>();\n if (!powerlines) {\n throw new Error(\n \"Powerlines - Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return powerlines;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.mjs","names":[],"sources":["../../../src/core/contexts/context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ComponentContext,\n createNamedContext,\n useContext\n} from \"@alloy-js/core\";\nimport type { PluginContext } from \"powerlines\";\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const PowerlinesContext: ComponentContext<PluginContext> =\n createNamedContext<PluginContext>(\"Powerlines\");\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function usePowerlinesContext<\n TContext extends PluginContext = PluginContext\n>(): TContext | undefined {\n return useContext(PowerlinesContext) as TContext | undefined;\n}\n\n/**\n * Hook to safely access the {@link PluginContext | Powerlines context}.\n *\n * @returns The Powerlines context or undefined if not set.\n */\nexport function usePowerlinesSafe<\n TContext extends PluginContext = PluginContext\n>(): TContext | undefined {\n const powerlines = usePowerlinesContext<TContext>();\n\n return powerlines ?? undefined;\n}\n\n/**\n * Hook to access the {@link PluginContext | Powerlines context}.\n *\n * @returns The Powerlines context.\n */\nexport function usePowerlines<\n TContext extends PluginContext = PluginContext\n>(): TContext {\n const powerlines = usePowerlinesSafe<TContext>();\n if (!powerlines) {\n throw new Error(\n \"Powerlines - Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return powerlines;\n}\n"],"mappings":";;;;;;AAsBA,MAAS,oBAAc,mBAAA,aAAA;;;;;;AAOvB,SAAE,uBAAmC;;;;;;;;AASrC,SAAgB,oBAAU;AAE1B,QADoB,sBACpB,IAAA;;;;;;;AAQA,SAAW,gBAAqB;CAC9B,MAAG,aAAW,mBAAU;AACxB,KAAA,CAAK;AAGP,QAAA"}
|
|
@@ -1 +1,22 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_core_contexts_context = require('./context.cjs');
|
|
3
|
+
const require_core_contexts_meta = require('./meta.cjs');
|
|
4
|
+
const require_core_contexts_reflection = require('./reflection.cjs');
|
|
5
|
+
|
|
6
|
+
exports.MetaContext = require_core_contexts_meta.MetaContext;
|
|
7
|
+
exports.PowerlinesContext = require_core_contexts_context.PowerlinesContext;
|
|
8
|
+
exports.ReflectionClassContext = require_core_contexts_reflection.ReflectionClassContext;
|
|
9
|
+
exports.ReflectionMethodContext = require_core_contexts_reflection.ReflectionMethodContext;
|
|
10
|
+
exports.ReflectionParameterContext = require_core_contexts_reflection.ReflectionParameterContext;
|
|
11
|
+
exports.ReflectionPropertyContext = require_core_contexts_reflection.ReflectionPropertyContext;
|
|
12
|
+
exports.useMeta = require_core_contexts_meta.useMeta;
|
|
13
|
+
exports.useMetaContext = require_core_contexts_meta.useMetaContext;
|
|
14
|
+
exports.useMetaSafe = require_core_contexts_meta.useMetaSafe;
|
|
15
|
+
exports.usePowerlines = require_core_contexts_context.usePowerlines;
|
|
16
|
+
exports.usePowerlinesContext = require_core_contexts_context.usePowerlinesContext;
|
|
17
|
+
exports.usePowerlinesSafe = require_core_contexts_context.usePowerlinesSafe;
|
|
18
|
+
exports.useReflectionClass = require_core_contexts_reflection.useReflectionClass;
|
|
19
|
+
exports.useReflectionMethod = require_core_contexts_reflection.useReflectionMethod;
|
|
20
|
+
exports.useReflectionParameter = require_core_contexts_reflection.useReflectionParameter;
|
|
21
|
+
exports.useReflectionProperty = require_core_contexts_reflection.useReflectionProperty;
|
|
22
|
+
exports.useReflectionPropertyContext = require_core_contexts_reflection.useReflectionPropertyContext;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import{PowerlinesContext
|
|
1
|
+
import { PowerlinesContext, usePowerlines, usePowerlinesContext, usePowerlinesSafe } from "./context.mjs";
|
|
2
|
+
import { MetaContext, useMeta, useMetaContext, useMetaSafe } from "./meta.mjs";
|
|
3
|
+
import { ReflectionClassContext, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty, useReflectionPropertyContext } from "./reflection.mjs";
|
|
4
|
+
|
|
5
|
+
export { MetaContext, PowerlinesContext, ReflectionClassContext, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, useMeta, useMetaContext, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty, useReflectionPropertyContext };
|
|
@@ -1 +1,41 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
4
|
+
|
|
5
|
+
//#region src/core/contexts/meta.ts
|
|
6
|
+
/**
|
|
7
|
+
* The Powerlines meta context used to determine metadata of files generated during rendering.
|
|
8
|
+
*/
|
|
9
|
+
const MetaContext = (0, _alloy_js_core.createNamedContext)("Meta");
|
|
10
|
+
/**
|
|
11
|
+
* Hook to access the Powerlines Context.
|
|
12
|
+
*
|
|
13
|
+
* @returns The Context.
|
|
14
|
+
*/
|
|
15
|
+
function useMetaContext() {
|
|
16
|
+
return (0, _alloy_js_core.useContext)(MetaContext);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Hook to safely access the render context's metadata.
|
|
20
|
+
*
|
|
21
|
+
* @returns The Powerlines context or undefined if not set.
|
|
22
|
+
*/
|
|
23
|
+
function useMetaSafe() {
|
|
24
|
+
return useMetaContext() ?? void 0;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Hook to access the render context's metadata.
|
|
28
|
+
*
|
|
29
|
+
* @returns The Powerlines context.
|
|
30
|
+
*/
|
|
31
|
+
function useMeta() {
|
|
32
|
+
const meta = useMetaSafe();
|
|
33
|
+
if (!meta) throw new Error("Powerlines metadata is not available in the rendering context. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
|
|
34
|
+
return meta;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
exports.MetaContext = MetaContext;
|
|
39
|
+
exports.useMeta = useMeta;
|
|
40
|
+
exports.useMetaContext = useMetaContext;
|
|
41
|
+
exports.useMetaSafe = useMetaSafe;
|
|
@@ -1,2 +1,37 @@
|
|
|
1
|
-
import{createNamedContext
|
|
1
|
+
import { createNamedContext, useContext } from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
//#region src/core/contexts/meta.ts
|
|
4
|
+
/**
|
|
5
|
+
* The Powerlines meta context used to determine metadata of files generated during rendering.
|
|
6
|
+
*/
|
|
7
|
+
const MetaContext = createNamedContext("Meta");
|
|
8
|
+
/**
|
|
9
|
+
* Hook to access the Powerlines Context.
|
|
10
|
+
*
|
|
11
|
+
* @returns The Context.
|
|
12
|
+
*/
|
|
13
|
+
function useMetaContext() {
|
|
14
|
+
return useContext(MetaContext);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Hook to safely access the render context's metadata.
|
|
18
|
+
*
|
|
19
|
+
* @returns The Powerlines context or undefined if not set.
|
|
20
|
+
*/
|
|
21
|
+
function useMetaSafe() {
|
|
22
|
+
return useMetaContext() ?? void 0;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Hook to access the render context's metadata.
|
|
26
|
+
*
|
|
27
|
+
* @returns The Powerlines context.
|
|
28
|
+
*/
|
|
29
|
+
function useMeta() {
|
|
30
|
+
const meta = useMetaSafe();
|
|
31
|
+
if (!meta) throw new Error("Powerlines metadata is not available in the rendering context. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
|
|
32
|
+
return meta;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { MetaContext, useMeta, useMetaContext, useMetaSafe };
|
|
2
37
|
//# sourceMappingURL=meta.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.mjs","names":[],"sources":["../../../src/core/contexts/meta.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ComponentContext,\n createNamedContext,\n useContext\n} from \"@alloy-js/core\";\nimport type { StoragePreset } from \"powerlines\";\n\nexport interface MetaItem {\n /**\n * The kind of metadata item.\n */\n kind?: \"builtin\" | \"entry\" | string;\n\n /**\n * Whether to skip formatting for this output.\n */\n skipFormat?: boolean;\n\n /**\n * The storage preset or adapter name for the output files.\n *\n * @remarks\n * If not specified, the output mode will be determined by the provided `output.mode` value.\n */\n storage?: StoragePreset | string;\n\n [key: string]: any;\n}\n\n/**\n * The Powerlines meta context used to determine metadata of files generated during rendering.\n */\nexport const MetaContext: ComponentContext<Record<string, MetaItem>> =\n createNamedContext<Record<string, MetaItem>>(\"Meta\");\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function useMetaContext(): Record<string, MetaItem> | undefined {\n return useContext(MetaContext);\n}\n\n/**\n * Hook to safely access the render context's metadata.\n *\n * @returns The Powerlines context or undefined if not set.\n */\nexport function useMetaSafe(): Record<string, MetaItem> | undefined {\n const meta = useMetaContext();\n\n return meta ?? undefined;\n}\n\n/**\n * Hook to access the render context's metadata.\n *\n * @returns The Powerlines context.\n */\nexport function useMeta(): Record<string, MetaItem> {\n const meta = useMetaSafe();\n if (!meta) {\n throw new Error(\n \"Powerlines metadata is not available in the rendering context. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return meta;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"meta.mjs","names":[],"sources":["../../../src/core/contexts/meta.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ComponentContext,\n createNamedContext,\n useContext\n} from \"@alloy-js/core\";\nimport type { StoragePreset } from \"powerlines\";\n\nexport interface MetaItem {\n /**\n * The kind of metadata item.\n */\n kind?: \"builtin\" | \"entry\" | string;\n\n /**\n * Whether to skip formatting for this output.\n */\n skipFormat?: boolean;\n\n /**\n * The storage preset or adapter name for the output files.\n *\n * @remarks\n * If not specified, the output mode will be determined by the provided `output.mode` value.\n */\n storage?: StoragePreset | string;\n\n [key: string]: any;\n}\n\n/**\n * The Powerlines meta context used to determine metadata of files generated during rendering.\n */\nexport const MetaContext: ComponentContext<Record<string, MetaItem>> =\n createNamedContext<Record<string, MetaItem>>(\"Meta\");\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function useMetaContext(): Record<string, MetaItem> | undefined {\n return useContext(MetaContext);\n}\n\n/**\n * Hook to safely access the render context's metadata.\n *\n * @returns The Powerlines context or undefined if not set.\n */\nexport function useMetaSafe(): Record<string, MetaItem> | undefined {\n const meta = useMetaContext();\n\n return meta ?? undefined;\n}\n\n/**\n * Hook to access the render context's metadata.\n *\n * @returns The Powerlines context.\n */\nexport function useMeta(): Record<string, MetaItem> {\n const meta = useMetaSafe();\n if (!meta) {\n throw new Error(\n \"Powerlines metadata is not available in the rendering context. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return meta;\n}\n"],"mappings":";;;;;;AAsBA,MAAS,cAAc,mBAAA,OAAA;;;;;;AAOvB,SAAU,iBAAqB;;;;;;;;AAS/B,SAAG,cAAA;AAED,QADI,gBACM,IAAA;;;;;;;AAQZ,SAAO,UAAgB;CACrB,MAAA,OAAA,aAAA;AACF,KAAM,CAAC,KACL,OAAA,IAAA,MAAkB,oNAAkC;AAEpD,QAAA"}
|
|
@@ -1 +1,80 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
4
|
+
|
|
5
|
+
//#region src/core/contexts/reflection.ts
|
|
6
|
+
/**
|
|
7
|
+
* The reflection class context used in template rendering.
|
|
8
|
+
*/
|
|
9
|
+
const ReflectionClassContext = (0, _alloy_js_core.createContext)();
|
|
10
|
+
/**
|
|
11
|
+
* Hook to access the Reflection context.
|
|
12
|
+
*
|
|
13
|
+
* @returns A reactive version of the current reflection.
|
|
14
|
+
*/
|
|
15
|
+
function useReflectionClass() {
|
|
16
|
+
const context = (0, _alloy_js_core.useContext)(ReflectionClassContext);
|
|
17
|
+
if (!context) throw new Error("Powerlines - ReflectionClass Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
|
|
18
|
+
return context;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The reflection property context used in template rendering.
|
|
22
|
+
*/
|
|
23
|
+
const ReflectionPropertyContext = (0, _alloy_js_core.createNamedContext)("ReflectionProperty");
|
|
24
|
+
/**
|
|
25
|
+
* Hook to access the Reflection Property context.
|
|
26
|
+
*
|
|
27
|
+
* @returns A reactive version of the current reflection.
|
|
28
|
+
*/
|
|
29
|
+
function useReflectionPropertyContext() {
|
|
30
|
+
const context = (0, _alloy_js_core.useContext)(ReflectionPropertyContext);
|
|
31
|
+
if (!context) throw new Error("Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
|
|
32
|
+
return context;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Hook to access the Reflection Property context.
|
|
36
|
+
*
|
|
37
|
+
* @returns A reactive version of the current reflection.
|
|
38
|
+
*/
|
|
39
|
+
function useReflectionProperty() {
|
|
40
|
+
const context = useReflectionPropertyContext();
|
|
41
|
+
if (!context) throw new Error("Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
|
|
42
|
+
return context;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The reflection method context used in template rendering.
|
|
46
|
+
*/
|
|
47
|
+
const ReflectionMethodContext = (0, _alloy_js_core.createNamedContext)("ReflectionMethod");
|
|
48
|
+
/**
|
|
49
|
+
* Hook to access the Reflection Method context.
|
|
50
|
+
*
|
|
51
|
+
* @returns A reactive version of the current reflection.
|
|
52
|
+
*/
|
|
53
|
+
function useReflectionMethod() {
|
|
54
|
+
const context = (0, _alloy_js_core.useContext)(ReflectionMethodContext);
|
|
55
|
+
if (!context) throw new Error("Powerlines - Reflection Method Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
|
|
56
|
+
return context;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The reflection parameter context used in template rendering.
|
|
60
|
+
*/
|
|
61
|
+
const ReflectionParameterContext = (0, _alloy_js_core.createNamedContext)("ReflectionParameter");
|
|
62
|
+
/**
|
|
63
|
+
* Hook to access the Reflection Parameter context.
|
|
64
|
+
*
|
|
65
|
+
* @returns A reactive version of the current reflection.
|
|
66
|
+
*/
|
|
67
|
+
function useReflectionParameter() {
|
|
68
|
+
return (0, _alloy_js_core.useContext)(ReflectionParameterContext);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
exports.ReflectionClassContext = ReflectionClassContext;
|
|
73
|
+
exports.ReflectionMethodContext = ReflectionMethodContext;
|
|
74
|
+
exports.ReflectionParameterContext = ReflectionParameterContext;
|
|
75
|
+
exports.ReflectionPropertyContext = ReflectionPropertyContext;
|
|
76
|
+
exports.useReflectionClass = useReflectionClass;
|
|
77
|
+
exports.useReflectionMethod = useReflectionMethod;
|
|
78
|
+
exports.useReflectionParameter = useReflectionParameter;
|
|
79
|
+
exports.useReflectionProperty = useReflectionProperty;
|
|
80
|
+
exports.useReflectionPropertyContext = useReflectionPropertyContext;
|
|
@@ -1,2 +1,71 @@
|
|
|
1
|
-
import{createContext
|
|
1
|
+
import { createContext, createNamedContext, useContext } from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
//#region src/core/contexts/reflection.ts
|
|
4
|
+
/**
|
|
5
|
+
* The reflection class context used in template rendering.
|
|
6
|
+
*/
|
|
7
|
+
const ReflectionClassContext = createContext();
|
|
8
|
+
/**
|
|
9
|
+
* Hook to access the Reflection context.
|
|
10
|
+
*
|
|
11
|
+
* @returns A reactive version of the current reflection.
|
|
12
|
+
*/
|
|
13
|
+
function useReflectionClass() {
|
|
14
|
+
const context = useContext(ReflectionClassContext);
|
|
15
|
+
if (!context) throw new Error("Powerlines - ReflectionClass Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
|
|
16
|
+
return context;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The reflection property context used in template rendering.
|
|
20
|
+
*/
|
|
21
|
+
const ReflectionPropertyContext = createNamedContext("ReflectionProperty");
|
|
22
|
+
/**
|
|
23
|
+
* Hook to access the Reflection Property context.
|
|
24
|
+
*
|
|
25
|
+
* @returns A reactive version of the current reflection.
|
|
26
|
+
*/
|
|
27
|
+
function useReflectionPropertyContext() {
|
|
28
|
+
const context = useContext(ReflectionPropertyContext);
|
|
29
|
+
if (!context) throw new Error("Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
|
|
30
|
+
return context;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Hook to access the Reflection Property context.
|
|
34
|
+
*
|
|
35
|
+
* @returns A reactive version of the current reflection.
|
|
36
|
+
*/
|
|
37
|
+
function useReflectionProperty() {
|
|
38
|
+
const context = useReflectionPropertyContext();
|
|
39
|
+
if (!context) throw new Error("Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
|
|
40
|
+
return context;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The reflection method context used in template rendering.
|
|
44
|
+
*/
|
|
45
|
+
const ReflectionMethodContext = createNamedContext("ReflectionMethod");
|
|
46
|
+
/**
|
|
47
|
+
* Hook to access the Reflection Method context.
|
|
48
|
+
*
|
|
49
|
+
* @returns A reactive version of the current reflection.
|
|
50
|
+
*/
|
|
51
|
+
function useReflectionMethod() {
|
|
52
|
+
const context = useContext(ReflectionMethodContext);
|
|
53
|
+
if (!context) throw new Error("Powerlines - Reflection Method Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
|
|
54
|
+
return context;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The reflection parameter context used in template rendering.
|
|
58
|
+
*/
|
|
59
|
+
const ReflectionParameterContext = createNamedContext("ReflectionParameter");
|
|
60
|
+
/**
|
|
61
|
+
* Hook to access the Reflection Parameter context.
|
|
62
|
+
*
|
|
63
|
+
* @returns A reactive version of the current reflection.
|
|
64
|
+
*/
|
|
65
|
+
function useReflectionParameter() {
|
|
66
|
+
return useContext(ReflectionParameterContext);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
export { ReflectionClassContext, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty, useReflectionPropertyContext };
|
|
2
71
|
//# sourceMappingURL=reflection.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflection.mjs","names":[],"sources":["../../../src/core/contexts/reflection.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createContext, createNamedContext, useContext } from \"@alloy-js/core\";\nimport type {\n ReflectionClass,\n ReflectionMethod,\n ReflectionParameter,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { ReflectionOverrideInterface } from \"../../types/components\";\n\nexport interface ReflectionClassContextInterface<\n T extends Record<string, any> = Record<string, any>\n> {\n reflection: ReflectionClass<T>;\n override?: ReflectionOverrideInterface<T>;\n}\n\n/**\n * The reflection class context used in template rendering.\n */\nexport const ReflectionClassContext: ComponentContext<\n ReflectionClassContextInterface<any>\n> = createContext<ReflectionClassContextInterface<any>>();\n\n/**\n * Hook to access the Reflection context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionClass<\n T extends Record<string, any> = Record<string, any>\n>() {\n const context = useContext<ReflectionClassContextInterface<T>>(\n ReflectionClassContext\n )!;\n\n if (!context) {\n throw new Error(\n \"Powerlines - ReflectionClass Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\nexport interface ReflectionPropertyContextInterface {\n property: ReflectionProperty;\n defaultValue?: any;\n}\n\n/**\n * The reflection property context used in template rendering.\n */\nexport const ReflectionPropertyContext: ComponentContext<ReflectionPropertyContextInterface> =\n createNamedContext<ReflectionPropertyContextInterface>(\"ReflectionProperty\");\n\n/**\n * Hook to access the Reflection Property context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionPropertyContext() {\n const context = useContext<ReflectionPropertyContextInterface>(\n ReflectionPropertyContext\n )!;\n\n if (!context) {\n throw new Error(\n \"Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\n/**\n * Hook to access the Reflection Property context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionProperty() {\n const context = useReflectionPropertyContext();\n\n if (!context) {\n throw new Error(\n \"Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\n/**\n * The reflection method context used in template rendering.\n */\nexport const ReflectionMethodContext: ComponentContext<ReflectionMethod> =\n createNamedContext<ReflectionMethod>(\"ReflectionMethod\");\n\n/**\n * Hook to access the Reflection Method context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionMethod() {\n const context = useContext<ReflectionMethod>(ReflectionMethodContext)!;\n\n if (!context) {\n throw new Error(\n \"Powerlines - Reflection Method Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ReflectionParameterContext: ComponentContext<ReflectionParameter> =\n createNamedContext<ReflectionParameter>(\"ReflectionParameter\");\n\n/**\n * Hook to access the Reflection Parameter context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionParameter() {\n return useContext<ReflectionParameter>(ReflectionParameterContext)!;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"reflection.mjs","names":[],"sources":["../../../src/core/contexts/reflection.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createContext, createNamedContext, useContext } from \"@alloy-js/core\";\nimport type {\n ReflectionClass,\n ReflectionMethod,\n ReflectionParameter,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { ReflectionOverrideInterface } from \"../../types/components\";\n\nexport interface ReflectionClassContextInterface<\n T extends Record<string, any> = Record<string, any>\n> {\n reflection: ReflectionClass<T>;\n override?: ReflectionOverrideInterface<T>;\n}\n\n/**\n * The reflection class context used in template rendering.\n */\nexport const ReflectionClassContext: ComponentContext<\n ReflectionClassContextInterface<any>\n> = createContext<ReflectionClassContextInterface<any>>();\n\n/**\n * Hook to access the Reflection context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionClass<\n T extends Record<string, any> = Record<string, any>\n>() {\n const context = useContext<ReflectionClassContextInterface<T>>(\n ReflectionClassContext\n )!;\n\n if (!context) {\n throw new Error(\n \"Powerlines - ReflectionClass Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\nexport interface ReflectionPropertyContextInterface {\n property: ReflectionProperty;\n defaultValue?: any;\n}\n\n/**\n * The reflection property context used in template rendering.\n */\nexport const ReflectionPropertyContext: ComponentContext<ReflectionPropertyContextInterface> =\n createNamedContext<ReflectionPropertyContextInterface>(\"ReflectionProperty\");\n\n/**\n * Hook to access the Reflection Property context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionPropertyContext() {\n const context = useContext<ReflectionPropertyContextInterface>(\n ReflectionPropertyContext\n )!;\n\n if (!context) {\n throw new Error(\n \"Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\n/**\n * Hook to access the Reflection Property context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionProperty() {\n const context = useReflectionPropertyContext();\n\n if (!context) {\n throw new Error(\n \"Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\n/**\n * The reflection method context used in template rendering.\n */\nexport const ReflectionMethodContext: ComponentContext<ReflectionMethod> =\n createNamedContext<ReflectionMethod>(\"ReflectionMethod\");\n\n/**\n * Hook to access the Reflection Method context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionMethod() {\n const context = useContext<ReflectionMethod>(ReflectionMethodContext)!;\n\n if (!context) {\n throw new Error(\n \"Powerlines - Reflection Method Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ReflectionParameterContext: ComponentContext<ReflectionParameter> =\n createNamedContext<ReflectionParameter>(\"ReflectionParameter\");\n\n/**\n * Hook to access the Reflection Parameter context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionParameter() {\n return useContext<ReflectionParameter>(ReflectionParameterContext)!;\n}\n"],"mappings":";;;;;;AAuBA,MAAE,yBAAmB,eAAA;;;;;;AAOrB,SAAE,qBAAA;CACA,MAAA,UAAY,WAAe,uBAAG;AAC9B,KAAA,CAAA,QACF,OAAA,IAAA,MAAA,sMAAA;AAEE,QAAA;;;;;AAKF,MAAI,4BAAc,mBAAuC,qBAAA;;;;;;AAOzD,SAAgB,+BAAkB;CAChC,MAAE,UAAc,WAAS,0BAAyB;AAClD,KAAE,CAAA,QACF,OAAM,IAAA,MAAU,0MAA8C;AAE9D,QAAE;;;;;;;AAQJ,SAAgB,wBAAA;CAChB,MAAA,UAAA,8BAAA;cAEA,OAAO,IAAA,MAAU,0MAAmC;AAElD,QAAA;;;;;AAMF,MAAa,0BAA0B,mBAAkB,mBAAA;;;;;;AAOzD,SAAE,sBAAA;CACF,MAAO,UAAS,WAAA,wBAA+B;AAC7C,KAAA,CAAK,QACH,OAAA,IAAA,MAAA,wMAAA;;;;;;;;;;;;AAeJ,SAAc,yBAAwB;AACpC,QAAA,WAAA,2BAAA"}
|
|
@@ -1 +1,34 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
4
|
+
|
|
5
|
+
//#region src/core/helpers/code.ts
|
|
6
|
+
/**
|
|
7
|
+
* Turn the provided string template into Children by replacing literal line
|
|
8
|
+
* breaks with hardlines and automatically indenting indented content. Similar
|
|
9
|
+
* in spirit to the `<code>` element in HTML.
|
|
10
|
+
*
|
|
11
|
+
* @see {@link text} for a similar function which treats whitespace similar to
|
|
12
|
+
* JSX template bodies.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* code`
|
|
17
|
+
* function greet(name: string) {
|
|
18
|
+
* console.log("Hello, " + name + "!");
|
|
19
|
+
* }
|
|
20
|
+
* `
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @param template - The template string to be processed into Children.
|
|
24
|
+
* @param substitutions - Any interpolated values within the template, which will be treated as Children and properly indented.
|
|
25
|
+
* @returns A Children representation of the provided template string, with proper handling of line breaks and indentation.
|
|
26
|
+
* @throws Will throw an error if the provided template contains only whitespace, as this is likely a mistake and would cause a less recognizable "Cannot read properties of undefined" exception later in the processing.
|
|
27
|
+
*/
|
|
28
|
+
function code(template, ...substitutions) {
|
|
29
|
+
if (template.filter((seg) => seg.trim()).length === 0 && substitutions.length === 0) throw new Error("The `code` function cannot be used with a template that contains only whitespace. Please provide a non-empty template.");
|
|
30
|
+
return (0, _alloy_js_core.code)(template, ...substitutions);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.code = code;
|
|
@@ -1,2 +1,33 @@
|
|
|
1
|
-
import{code as
|
|
1
|
+
import { code as code$1 } from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
//#region src/core/helpers/code.ts
|
|
4
|
+
/**
|
|
5
|
+
* Turn the provided string template into Children by replacing literal line
|
|
6
|
+
* breaks with hardlines and automatically indenting indented content. Similar
|
|
7
|
+
* in spirit to the `<code>` element in HTML.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link text} for a similar function which treats whitespace similar to
|
|
10
|
+
* JSX template bodies.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* code`
|
|
15
|
+
* function greet(name: string) {
|
|
16
|
+
* console.log("Hello, " + name + "!");
|
|
17
|
+
* }
|
|
18
|
+
* `
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param template - The template string to be processed into Children.
|
|
22
|
+
* @param substitutions - Any interpolated values within the template, which will be treated as Children and properly indented.
|
|
23
|
+
* @returns A Children representation of the provided template string, with proper handling of line breaks and indentation.
|
|
24
|
+
* @throws Will throw an error if the provided template contains only whitespace, as this is likely a mistake and would cause a less recognizable "Cannot read properties of undefined" exception later in the processing.
|
|
25
|
+
*/
|
|
26
|
+
function code(template, ...substitutions) {
|
|
27
|
+
if (template.filter((seg) => seg.trim()).length === 0 && substitutions.length === 0) throw new Error("The `code` function cannot be used with a template that contains only whitespace. Please provide a non-empty template.");
|
|
28
|
+
return code$1(template, ...substitutions);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { code };
|
|
2
33
|
//# sourceMappingURL=code.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.mjs","names":[],"sources":["../../../src/core/helpers/code.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code as baseCode, Children } from \"@alloy-js/core\";\n\n/**\n * Turn the provided string template into Children by replacing literal line\n * breaks with hardlines and automatically indenting indented content. Similar\n * in spirit to the `<code>` element in HTML.\n *\n * @see {@link text} for a similar function which treats whitespace similar to\n * JSX template bodies.\n *\n * @example\n * ```ts\n * code`\n * function greet(name: string) {\n * console.log(\"Hello, \" + name + \"!\");\n * }\n * `\n * ```\n *\n * @param template - The template string to be processed into Children.\n * @param substitutions - Any interpolated values within the template, which will be treated as Children and properly indented.\n * @returns A Children representation of the provided template string, with proper handling of line breaks and indentation.\n * @throws Will throw an error if the provided template contains only whitespace, as this is likely a mistake and would cause a less recognizable \"Cannot read properties of undefined\" exception later in the processing.\n */\nexport function code(\n template: TemplateStringsArray,\n ...substitutions: Children[]\n): Children {\n if (\n template.filter(seg => seg.trim()).length === 0 &&\n substitutions.length === 0\n ) {\n throw new Error(\n \"The `code` function cannot be used with a template that contains only whitespace. Please provide a non-empty template.\"\n );\n }\n\n return baseCode(template, ...substitutions);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"code.mjs","names":[],"sources":["../../../src/core/helpers/code.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code as baseCode, Children } from \"@alloy-js/core\";\n\n/**\n * Turn the provided string template into Children by replacing literal line\n * breaks with hardlines and automatically indenting indented content. Similar\n * in spirit to the `<code>` element in HTML.\n *\n * @see {@link text} for a similar function which treats whitespace similar to\n * JSX template bodies.\n *\n * @example\n * ```ts\n * code`\n * function greet(name: string) {\n * console.log(\"Hello, \" + name + \"!\");\n * }\n * `\n * ```\n *\n * @param template - The template string to be processed into Children.\n * @param substitutions - Any interpolated values within the template, which will be treated as Children and properly indented.\n * @returns A Children representation of the provided template string, with proper handling of line breaks and indentation.\n * @throws Will throw an error if the provided template contains only whitespace, as this is likely a mistake and would cause a less recognizable \"Cannot read properties of undefined\" exception later in the processing.\n */\nexport function code(\n template: TemplateStringsArray,\n ...substitutions: Children[]\n): Children {\n if (\n template.filter(seg => seg.trim()).length === 0 &&\n substitutions.length === 0\n ) {\n throw new Error(\n \"The `code` function cannot be used with a template that contains only whitespace. Please provide a non-empty template.\"\n );\n }\n\n return baseCode(template, ...substitutions);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,KAAI,UAAA,GAAA,eAAA;AAClB,KAAA,SAAU,QAAA,QAAA,IAAoB,MAAA,CAAA,CAAA,WAAA,KAAA,cAAA,WAAA,EAC5B,OAAC,IAAA,MAAe,yHAAS;AAE3B,QAAG,OAAA,UAAA,GAAA,cAAA"}
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_core_helpers_code = require('./code.cjs');
|
|
3
|
+
|
|
4
|
+
exports.code = require_core_helpers_code.code;
|
package/dist/core/index.cjs
CHANGED
|
@@ -1 +1,37 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_core_contexts_context = require('./contexts/context.cjs');
|
|
3
|
+
const require_core_contexts_meta = require('./contexts/meta.cjs');
|
|
4
|
+
const require_core_components_source_file = require('./components/source-file.cjs');
|
|
5
|
+
const require_core_components_infrastructure_file = require('./components/infrastructure-file.cjs');
|
|
6
|
+
const require_core_contexts_reflection = require('./contexts/reflection.cjs');
|
|
7
|
+
require('./contexts/index.cjs');
|
|
8
|
+
const require_core_components_output = require('./components/output.cjs');
|
|
9
|
+
const require_core_components_single_line_comment = require('./components/single-line-comment.cjs');
|
|
10
|
+
const require_core_components_spacing = require('./components/spacing.cjs');
|
|
11
|
+
require('./components/index.cjs');
|
|
12
|
+
const require_core_helpers_code = require('./helpers/code.cjs');
|
|
13
|
+
require('./helpers/index.cjs');
|
|
14
|
+
|
|
15
|
+
exports.InfrastructureFile = require_core_components_infrastructure_file.InfrastructureFile;
|
|
16
|
+
exports.MetaContext = require_core_contexts_meta.MetaContext;
|
|
17
|
+
exports.Output = require_core_components_output.Output;
|
|
18
|
+
exports.PowerlinesContext = require_core_contexts_context.PowerlinesContext;
|
|
19
|
+
exports.ReflectionClassContext = require_core_contexts_reflection.ReflectionClassContext;
|
|
20
|
+
exports.ReflectionMethodContext = require_core_contexts_reflection.ReflectionMethodContext;
|
|
21
|
+
exports.ReflectionParameterContext = require_core_contexts_reflection.ReflectionParameterContext;
|
|
22
|
+
exports.ReflectionPropertyContext = require_core_contexts_reflection.ReflectionPropertyContext;
|
|
23
|
+
exports.SingleLineComment = require_core_components_single_line_comment.SingleLineComment;
|
|
24
|
+
exports.SourceFile = require_core_components_source_file.SourceFile;
|
|
25
|
+
exports.Spacing = require_core_components_spacing.Spacing;
|
|
26
|
+
exports.code = require_core_helpers_code.code;
|
|
27
|
+
exports.useMeta = require_core_contexts_meta.useMeta;
|
|
28
|
+
exports.useMetaContext = require_core_contexts_meta.useMetaContext;
|
|
29
|
+
exports.useMetaSafe = require_core_contexts_meta.useMetaSafe;
|
|
30
|
+
exports.usePowerlines = require_core_contexts_context.usePowerlines;
|
|
31
|
+
exports.usePowerlinesContext = require_core_contexts_context.usePowerlinesContext;
|
|
32
|
+
exports.usePowerlinesSafe = require_core_contexts_context.usePowerlinesSafe;
|
|
33
|
+
exports.useReflectionClass = require_core_contexts_reflection.useReflectionClass;
|
|
34
|
+
exports.useReflectionMethod = require_core_contexts_reflection.useReflectionMethod;
|
|
35
|
+
exports.useReflectionParameter = require_core_contexts_reflection.useReflectionParameter;
|
|
36
|
+
exports.useReflectionProperty = require_core_contexts_reflection.useReflectionProperty;
|
|
37
|
+
exports.useReflectionPropertyContext = require_core_contexts_reflection.useReflectionPropertyContext;
|
package/dist/core/index.mjs
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { PowerlinesContext, usePowerlines, usePowerlinesContext, usePowerlinesSafe } from "./contexts/context.mjs";
|
|
2
|
+
import { MetaContext, useMeta, useMetaContext, useMetaSafe } from "./contexts/meta.mjs";
|
|
3
|
+
import { SourceFile } from "./components/source-file.mjs";
|
|
4
|
+
import { InfrastructureFile } from "./components/infrastructure-file.mjs";
|
|
5
|
+
import { ReflectionClassContext, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty, useReflectionPropertyContext } from "./contexts/reflection.mjs";
|
|
6
|
+
import "./contexts/index.mjs";
|
|
7
|
+
import { Output } from "./components/output.mjs";
|
|
8
|
+
import { SingleLineComment } from "./components/single-line-comment.mjs";
|
|
9
|
+
import { Spacing } from "./components/spacing.mjs";
|
|
10
|
+
import "./components/index.mjs";
|
|
11
|
+
import { code } from "./helpers/code.mjs";
|
|
12
|
+
import "./helpers/index.mjs";
|
|
13
|
+
|
|
14
|
+
export { InfrastructureFile, MetaContext, Output, PowerlinesContext, ReflectionClassContext, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, SingleLineComment, SourceFile, Spacing, code, useMeta, useMetaContext, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty, useReflectionPropertyContext };
|
|
@@ -1 +1,34 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_core_helpers_code = require('../../core/helpers/code.cjs');
|
|
4
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
6
|
+
|
|
7
|
+
//#region src/hcl/components/block-declaration.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A base component representing a block declaration in HCL. The children are rendered as a prose element, which means that they are broken into multiple lines. This component can be used to create more specific block declaration components, such as resource blocks, provider blocks, etc.
|
|
10
|
+
*
|
|
11
|
+
* @see https://developer.hashicorp.com/terraform/language#about-the-terraform-language
|
|
12
|
+
* @see https://opentofu.org/docs/language/attr-as-blocks/#summary
|
|
13
|
+
*
|
|
14
|
+
* @param props - The properties for the source file.
|
|
15
|
+
* @returns The rendered source file component.
|
|
16
|
+
*/
|
|
17
|
+
function BlockDeclaration(props) {
|
|
18
|
+
const { children, type, label } = props;
|
|
19
|
+
return [
|
|
20
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => require_core_helpers_code.code`${type} ${Array.isArray(label) ? label.join(" ") : label} {`),
|
|
21
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Prose, { get children() {
|
|
22
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
23
|
+
get when() {
|
|
24
|
+
return Boolean(children);
|
|
25
|
+
},
|
|
26
|
+
children
|
|
27
|
+
});
|
|
28
|
+
} }),
|
|
29
|
+
require_core_helpers_code.code`} `
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.BlockDeclaration = BlockDeclaration;
|
|
@@ -1,2 +1,33 @@
|
|
|
1
|
-
import{code as
|
|
1
|
+
import { code as code$1 } from "../../core/helpers/code.mjs";
|
|
2
|
+
import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { Prose, Show } from "@alloy-js/core";
|
|
4
|
+
|
|
5
|
+
//#region src/hcl/components/block-declaration.tsx
|
|
6
|
+
/**
|
|
7
|
+
* A base component representing a block declaration in HCL. The children are rendered as a prose element, which means that they are broken into multiple lines. This component can be used to create more specific block declaration components, such as resource blocks, provider blocks, etc.
|
|
8
|
+
*
|
|
9
|
+
* @see https://developer.hashicorp.com/terraform/language#about-the-terraform-language
|
|
10
|
+
* @see https://opentofu.org/docs/language/attr-as-blocks/#summary
|
|
11
|
+
*
|
|
12
|
+
* @param props - The properties for the source file.
|
|
13
|
+
* @returns The rendered source file component.
|
|
14
|
+
*/
|
|
15
|
+
function BlockDeclaration(props) {
|
|
16
|
+
const { children, type, label } = props;
|
|
17
|
+
return [
|
|
18
|
+
memo(() => code$1`${type} ${Array.isArray(label) ? label.join(" ") : label} {`),
|
|
19
|
+
createComponent(Prose, { get children() {
|
|
20
|
+
return createComponent(Show, {
|
|
21
|
+
get when() {
|
|
22
|
+
return Boolean(children);
|
|
23
|
+
},
|
|
24
|
+
children
|
|
25
|
+
});
|
|
26
|
+
} }),
|
|
27
|
+
code$1`} `
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { BlockDeclaration };
|
|
2
33
|
//# sourceMappingURL=block-declaration.mjs.map
|