@power-plant/alloy-js 0.0.18 → 0.0.19
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/contexts/execution.d.mts +1 -1
- package/dist/core/contexts/index.d.mts +1 -1
- package/dist/core/index.d.mts +1 -1
- package/dist/{execution-BGY24cO8.d.mts → execution-zVRllrpa.d.mts} +3 -3
- package/dist/execution-zVRllrpa.d.mts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/render.cjs +1 -1
- package/dist/render.d.cts +17 -3
- package/dist/render.d.cts.map +1 -1
- package/dist/render.d.mts +17 -3
- package/dist/render.mjs +1 -1
- package/package.json +2 -2
- package/dist/execution-BGY24cO8.d.mts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as useExecution, r as useExecutionSafe, t as ExecutionContext } from "../../execution-
|
|
1
|
+
import { n as useExecution, r as useExecutionSafe, t as ExecutionContext } from "../../execution-zVRllrpa.mjs";
|
|
2
2
|
export { ExecutionContext, useExecution, useExecutionSafe };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as useExecution, r as useExecutionSafe, t as ExecutionContext } from "../../execution-
|
|
1
|
+
import { n as useExecution, r as useExecutionSafe, t as ExecutionContext } from "../../execution-zVRllrpa.mjs";
|
|
2
2
|
import { n as useMeta, r as useMetaSafe, t as MetaContext } from "../../meta-DtIlHZG5.mjs";
|
|
3
3
|
import { a as useSchemaPropertySafe, i as useSchemaProperty, n as SchemaPropertyContext, o as useSchemaSafe, r as useSchema, t as SchemaContext } from "../../schema-CkCXkDzU.mjs";
|
|
4
4
|
import { n as useSession, r as useSessionSafe, t as SessionContext } from "../../session-C2p15ap9.mjs";
|
package/dist/core/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { n as SingleLineCommentProps, r as SingleLineCommentVariant, t as Single
|
|
|
3
3
|
import { n as SourceFileProps, t as SourceFile } from "../source-file-DEGtBMgH.mjs";
|
|
4
4
|
import { n as SpacingProps, t as Spacing } from "../spacing-HIHoQdxS.mjs";
|
|
5
5
|
import "./components/index.mjs";
|
|
6
|
-
import { n as useExecution, r as useExecutionSafe, t as ExecutionContext } from "../execution-
|
|
6
|
+
import { n as useExecution, r as useExecutionSafe, t as ExecutionContext } from "../execution-zVRllrpa.mjs";
|
|
7
7
|
import { n as useMeta, r as useMetaSafe, t as MetaContext } from "../meta-DtIlHZG5.mjs";
|
|
8
8
|
import { a as useSchemaPropertySafe, i as useSchemaProperty, n as SchemaPropertyContext, o as useSchemaSafe, r as useSchema, t as SchemaContext } from "../schema-CkCXkDzU.mjs";
|
|
9
9
|
import { n as useSession, r as useSessionSafe, t as SessionContext } from "../session-C2p15ap9.mjs";
|
|
@@ -11,7 +11,7 @@ declare const ExecutionContext$1: ComponentContext<ExecutionContext<any, any, an
|
|
|
11
11
|
* @returns The Execution context.
|
|
12
12
|
* @throws An error if the execution context is not set.
|
|
13
13
|
*/
|
|
14
|
-
declare function useExecution(): ExecutionContext<any, any, any>;
|
|
14
|
+
declare function useExecution$1(): ExecutionContext<any, any, any>;
|
|
15
15
|
/**
|
|
16
16
|
* Hook to safely access the {@link ExecutionContext | Execution context}.
|
|
17
17
|
*
|
|
@@ -19,5 +19,5 @@ declare function useExecution(): ExecutionContext<any, any, any>;
|
|
|
19
19
|
*/
|
|
20
20
|
declare function useExecutionSafe(): ExecutionContext<any, any, any> | undefined;
|
|
21
21
|
//#endregion
|
|
22
|
-
export { useExecution as n, useExecutionSafe as r, ExecutionContext$1 as t };
|
|
23
|
-
//# sourceMappingURL=execution-
|
|
22
|
+
export { useExecution$1 as n, useExecutionSafe as r, ExecutionContext$1 as t };
|
|
23
|
+
//# sourceMappingURL=execution-zVRllrpa.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-zVRllrpa.d.mts","names":[],"sources":["../src/core/contexts/execution.ts"],"mappings":""}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./render.cjs");
|
|
1
|
+
const e=require("./render.cjs");var t=(0,require("@power-plant/core").defineGenerator)({meta:{name:`alloy-js`,description:`A generator that uses Alloy-js to generate source code from a specification.`,version:`1.0`,tags:[`alloy-js`],links:[{description:`Alloy-js Repository`,href:`https://github.com/alloy-framework/alloy`},{description:`Alloy-js Documentation`,href:`https://alloy-framework.github.io/alloy/guides/getting-started/`}]},generator:async(t,n)=>e.render(n.template)});module.exports=t;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{render as e}from"./render.mjs";import{defineGenerator as t
|
|
1
|
+
import{render as e}from"./render.mjs";import{defineGenerator as t}from"@power-plant/core";var n=t({meta:{name:`alloy-js`,description:`A generator that uses Alloy-js to generate source code from a specification.`,version:`1.0`,tags:[`alloy-js`],links:[{description:`Alloy-js Repository`,href:`https://github.com/alloy-framework/alloy`},{description:`Alloy-js Documentation`,href:`https://alloy-framework.github.io/alloy/guides/getting-started/`}]},generator:async(t,n)=>e(n.template)});export{n as default};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/render.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-CMqjfN_6.cjs"),t=require("./core/components/output.cjs");require("./core/index.cjs");let n=require("@alloy-js/core/jsx-runtime"),r=require("@alloy-js/core"),i=require("@stryke/helpers/noop"),
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-CMqjfN_6.cjs"),t=require("./core/components/output.cjs");require("./core/index.cjs");let n=require("@alloy-js/core/jsx-runtime"),r=require("@alloy-js/core"),i=require("@power-plant/core"),a=require("@stryke/helpers/noop"),o=require("@stryke/path/replace"),s=require("@stryke/string-format/list"),c=require("defu");c=e.t(c,1);async function l(e,i){let l={},{cwd:u,logger:d}=e,f=await(0,r.renderAsync)((0,n.createComponent)(t.Output,{context:e,meta:l,children:i})),p=[];if(await(0,r.traverseOutput)(f,{visitDirectory:a.noop,visitFile:e=>p.push(e)}),!p.length)return d.debug(`No output files were rendered by the Alloy-js components.`),{};d.debug(`Rendering ${p.length} output files from Alloy-js components: ${(0,s.list)(p.map(e=>(0,o.replacePath)(e.path,u)))}.`);let m={},h={};await(0,r.traverseOutput)(f,{visitDirectory:a.noop,visitFile:e=>{if(`contents`in e){let t=l[e.path]??{};m[e.path]={path:e.path,chunks:[{content:e.contents,meta:t}]}}else e.sourcePath&&(h[e.sourcePath]=e.path)}});for(let[e,t]of Object.entries(h))if(m[e])m[t]={...m[e],path:t,chunks:m[e].chunks?.map(e=>(0,c.default)(e,{meta:l[t]??{}}))};else throw Error(`Source path ${e} not found in documents.`);return m}async function u(e){return l((0,i.useExecution)(),e)}exports.render=u,exports.renderBase=l;
|
package/dist/render.d.cts
CHANGED
|
@@ -8,14 +8,28 @@ import { ExecutionContext, GeneratorFunctionResult } from "@power-plant/core";
|
|
|
8
8
|
* ```tsx
|
|
9
9
|
* import { render } from "@power-plant/alloy-js/render";
|
|
10
10
|
*
|
|
11
|
-
* await
|
|
11
|
+
* await renderBase(context, <> ... </>);
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
14
|
* @param context - The Power Plant execution context.
|
|
15
15
|
* @param children - The children components to render.
|
|
16
16
|
* @returns A promise that resolves when rendering is complete.
|
|
17
17
|
*/
|
|
18
|
-
declare function
|
|
18
|
+
declare function renderBase<TSpec, TOptions extends object, TReturns = void>(context: ExecutionContext<TSpec, TOptions, TReturns>, children: Children): Promise<GeneratorFunctionResult<TSpec, TOptions>>;
|
|
19
|
+
/**
|
|
20
|
+
* A function to render children components within the [Alloy](https://alloy-framework.github.io) context, and register any generated documents on the execution context.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* import { render } from "@power-plant/alloy-js/render";
|
|
25
|
+
*
|
|
26
|
+
* await render(<> ... </>);
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @param children - The children components to render.
|
|
30
|
+
* @returns A promise that resolves when rendering is complete.
|
|
31
|
+
*/
|
|
32
|
+
declare function render<TSpec, TOptions extends object, TReturns = void>(children: Children): Promise<GeneratorFunctionResult<TSpec, TOptions>>;
|
|
19
33
|
//#endregion
|
|
20
|
-
export { render };
|
|
34
|
+
export { render, renderBase };
|
|
21
35
|
//# sourceMappingURL=render.d.cts.map
|
package/dist/render.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.cts","names":[],"sources":["../src/render.tsx"],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"render.d.cts","names":[],"sources":["../src/render.tsx"],"mappings":";;;;;;;;;;;;;;;;;iBA8CsB,WACpB,OACA,yBACA,iBAEA,SAAS,iBAAiB,OAAO,UAAU,WAC3C,UAAU,WACT,QAAQ,wBAAwB,OAAO;;;;;;;;;;;;;;iBAkFpB,OAAO,OAAO,yBAAyB,iBAC3D,UAAU,WACT,QAAQ,wBAAwB,OAAO"}
|
package/dist/render.d.mts
CHANGED
|
@@ -8,14 +8,28 @@ import { ExecutionContext, GeneratorFunctionResult } from "@power-plant/core";
|
|
|
8
8
|
* ```tsx
|
|
9
9
|
* import { render } from "@power-plant/alloy-js/render";
|
|
10
10
|
*
|
|
11
|
-
* await
|
|
11
|
+
* await renderBase(context, <> ... </>);
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
14
|
* @param context - The Power Plant execution context.
|
|
15
15
|
* @param children - The children components to render.
|
|
16
16
|
* @returns A promise that resolves when rendering is complete.
|
|
17
17
|
*/
|
|
18
|
-
declare function
|
|
18
|
+
declare function renderBase<TSpec, TOptions extends object, TReturns = void>(context: ExecutionContext<TSpec, TOptions, TReturns>, children: Children): Promise<GeneratorFunctionResult<TSpec, TOptions>>;
|
|
19
|
+
/**
|
|
20
|
+
* A function to render children components within the [Alloy](https://alloy-framework.github.io) context, and register any generated documents on the execution context.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* import { render } from "@power-plant/alloy-js/render";
|
|
25
|
+
*
|
|
26
|
+
* await render(<> ... </>);
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @param children - The children components to render.
|
|
30
|
+
* @returns A promise that resolves when rendering is complete.
|
|
31
|
+
*/
|
|
32
|
+
declare function render<TSpec, TOptions extends object, TReturns = void>(children: Children): Promise<GeneratorFunctionResult<TSpec, TOptions>>;
|
|
19
33
|
//#endregion
|
|
20
|
-
export { render };
|
|
34
|
+
export { render, renderBase };
|
|
21
35
|
//# sourceMappingURL=render.d.mts.map
|
package/dist/render.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Output as e}from"./core/components/output.mjs";import"./core/index.mjs";import{createComponent as t}from"@alloy-js/core/jsx-runtime";import{renderAsync as n,traverseOutput as r}from"@alloy-js/core";import{
|
|
1
|
+
import{Output as e}from"./core/components/output.mjs";import"./core/index.mjs";import{createComponent as t}from"@alloy-js/core/jsx-runtime";import{renderAsync as n,traverseOutput as r}from"@alloy-js/core";import{useExecution as i}from"@power-plant/core";import{noop as a}from"@stryke/helpers/noop";import{replacePath as o}from"@stryke/path/replace";import{list as s}from"@stryke/string-format/list";import c from"defu";async function l(i,l){let u={},{cwd:d,logger:f}=i,p=await n(t(e,{context:i,meta:u,children:l})),m=[];if(await r(p,{visitDirectory:a,visitFile:e=>m.push(e)}),!m.length)return f.debug(`No output files were rendered by the Alloy-js components.`),{};f.debug(`Rendering ${m.length} output files from Alloy-js components: ${s(m.map(e=>o(e.path,d)))}.`);let h={},g={};await r(p,{visitDirectory:a,visitFile:e=>{if(`contents`in e){let t=u[e.path]??{};h[e.path]={path:e.path,chunks:[{content:e.contents,meta:t}]}}else e.sourcePath&&(g[e.sourcePath]=e.path)}});for(let[e,t]of Object.entries(g))if(h[e])h[t]={...h[e],path:t,chunks:h[e].chunks?.map(e=>c(e,{meta:u[t]??{}}))};else throw Error(`Source path ${e} not found in documents.`);return h}async function u(e){return l(i(),e)}export{u as render,l as renderBase};
|
|
2
2
|
//# sourceMappingURL=render.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@power-plant/alloy-js",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Power Plant generator for using Alloy JS to generate source code.",
|
|
6
6
|
"keywords": [
|
|
@@ -892,5 +892,5 @@
|
|
|
892
892
|
"peerDependencies": { "@alloy-js/babel-preset": ">=0.3.0" },
|
|
893
893
|
"peerDependenciesMeta": { "@alloy-js/babel-preset": { "optional": false } },
|
|
894
894
|
"publishConfig": { "access": "public" },
|
|
895
|
-
"gitHead": "
|
|
895
|
+
"gitHead": "79c19a661afc8b7f551988af50af27b372996e28"
|
|
896
896
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"execution-BGY24cO8.d.mts","names":[],"sources":["../src/core/contexts/execution.ts"],"mappings":""}
|