@powerlines/plugin-env 0.14.15 → 0.14.17
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/README.md +2 -2
- package/dist/components/docs.d.cts +1 -3
- package/dist/components/env.d.cts +0 -1
- package/dist/helpers/create-reflection-resource.d.cts +1 -2
- package/dist/plugin-alloy/src/core/contexts/context.cjs +1 -1
- package/dist/plugin-alloy/src/core/contexts/context.mjs +1 -1
- package/dist/plugin-alloy/src/index.cjs +1 -1
- package/dist/plugin-alloy/src/index.mjs +1 -1
- package/dist/plugin-alloy/src/types/plugin.d.cts +2 -3
- package/dist/types/plugin.d.cts +0 -1
- package/package.json +8 -8
- package/dist/plugin-alloy/src/vendor/index.d.cts +0 -7
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package is part of the 🔌 <b>Powerlines</b> monorepo. Powerlines packages
|
|
|
27
27
|
|
|
28
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
29
29
|
|
|
30
|
-
[](https://prettier.io/) [](https://prettier.io/) [](http://commitizen.github.io/cz-cli/)  
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
|
@@ -39,7 +39,7 @@ This package is part of the 🔌 <b>Powerlines</b> monorepo. Powerlines packages
|
|
|
39
39
|
<!-- prettier-ignore-end -->
|
|
40
40
|
|
|
41
41
|
<div align="center">
|
|
42
|
-
<
|
|
42
|
+
<a href="https://github.com/storm-software/powerlines" target="_blank"><b>Be sure to ⭐ this repository on GitHub so you can keep up to date with it's progress!</b></a>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
<br />
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
-
|
|
3
1
|
//#region src/components/docs.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* Generates the environment configuration markdown documentation for the Powerlines project.
|
|
6
4
|
*/
|
|
7
|
-
declare function EnvDocs():
|
|
5
|
+
declare function EnvDocs(): void 0;
|
|
8
6
|
//#endregion
|
|
9
7
|
export { EnvDocs };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type_d_exports } from "../deepkit/src/vendor/type.cjs";
|
|
2
2
|
import { EnvPluginContext } from "../types/plugin.cjs";
|
|
3
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
4
3
|
|
|
5
4
|
//#region src/helpers/create-reflection-resource.d.ts
|
|
6
5
|
|
|
@@ -10,6 +9,6 @@ import * as _alloy_js_core0 from "@alloy-js/core";
|
|
|
10
9
|
* @param context - The environment plugin context.
|
|
11
10
|
* @returns A resource that provides the reflection of the environment configuration.
|
|
12
11
|
*/
|
|
13
|
-
declare function createReflectionResource(context?: EnvPluginContext):
|
|
12
|
+
declare function createReflectionResource(context?: EnvPluginContext): void 0<type_d_exports.ReflectionClass<Record<string, any>>>;
|
|
14
13
|
//#endregion
|
|
15
14
|
export { createReflectionResource };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../vendor/index.cjs`),t=(0,e.vendor_exports.
|
|
1
|
+
const e=require(`../../vendor/index.cjs`),t=(0,e.vendor_exports.createNamedContext)(`powerlines`);exports.PowerlinesContext=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{vendor_exports as e}from"../../vendor/index.mjs";const t=(0,e.
|
|
1
|
+
import{vendor_exports as e}from"../../vendor/index.mjs";const t=(0,e.createNamedContext)(`powerlines`);export{t as PowerlinesContext};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./vendor/index.cjs`),n=require(`./core/components/output.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/rollup-plugin`);i=e.__toESM(i);let a=require(`@storm-software/config-tools/types`),o=require(`@stryke/json/storm-json`),s=require(`@stryke/path/is-parent-path`),c=require(`@stryke/path/replace`),l=require(`@stryke/type-checks/is-set-string`),u=require(`prettier/doc.js`);const d=(e={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...e},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@powerlines/plugin-alloy/vendor`}}},plugins:[(0,i.default)()]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@powerlines/plugin-alloy/vendor`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@powerlines/plugin-alloy/vendor`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@powerlines/plugin-alloy/vendor`),await this.fs.write(this.tsconfig.tsconfigFilePath,o.StormJSON.stringify(this.tsconfig.tsconfigJson))),this.config.alloy?.typescript!==!1&&(this.dependencies[`@alloy-js/typescript`]=`^0.22.0`),this.config.alloy?.json===!0&&(this.dependencies[`@alloy-js/json`]=`^0.22.0`),this.config.alloy?.markdown===!0&&(this.dependencies[`@alloy-js/markdown`]=`^0.22.0`)},resolveId(e){return e===`@alloy-js/core`?{id:`@powerlines/plugin-alloy/vendor`,external:!0}:e===`@alloy-js/core/jsx-runtime`?{id:`@powerlines/plugin-alloy/vendor/jsx-runtime`,external:!0}:null}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async e=>{let i=this,a=(0,t.vendor_exports.renderTree)((0,r.createComponent)(n.Output,{context:i,get basePath(){return i.workspaceConfig.workspaceRoot},children:e}));await p(this,a,this.config.alloy)}}}}];var f=d;async function p(e,n,r={}){await(0,t.vendor_exports.flushJobsAsync)();let i,o=async(n,l)=>{if(!Array.isArray(l))return;let u=async e=>{for(let t of l)await o(e,t)},d=(0,t.vendor_exports.getContextForRenderNode)(l);if(!d)return u(n);if(d.meta?.directory){let e={kind:`directory`,path:d.meta.directory.path,contents:[]};n?n.contents.push(e):i=e,await u(e)}else if(d.meta?.sourceFile){if(!n)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let t;if(d.meta?.builtin){if(!d.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");e.log(a.LogLevelLabel.TRACE,`Rendering built-in runtime module with ID: ${d.meta.builtin.id}`),t={kind:`builtin`,id:d.meta.builtin.id,path:(0,c.replacePath)(d.meta.sourceFile.path,e.builtinsPath),filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await m(e,l,r)}}else d.meta?.entry||(0,s.isParentPath)(e.entryPath,d.meta.sourceFile.path)?(e.log(a.LogLevelLabel.TRACE,`Rendering entry module at path: ${d.meta.sourceFile.path}`),t={kind:`entry`,typeDefinition:d.meta.entry?.typeDefinition,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await m(e,l,r)}):(e.log(a.LogLevelLabel.TRACE,`Rendering source file at path: ${d.meta.sourceFile.path}`),t={kind:`file`,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await m(e,l,r)});n.contents.push(t)}else if(d.meta?.copyFile){if(!n)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(e.log(a.LogLevelLabel.TRACE,`Processing copy file operation from "${d.meta.copyFile.sourcePath}" to "${d.meta.copyFile.path}"`),!d.meta.copyFile.sourcePath)throw Error("Copy file doesn't have a source path. Make sure you have provided a `sourcePath` property to the `meta.copyFile` context.");if(!d.meta.copyFile.path)throw Error("Copy file doesn't have a destination path. Make sure you have provided a `path` property to the `meta.copyFile` context.");n.contents.push({kind:`file`,path:d.meta.copyFile.path,sourcePath:d.meta.copyFile.sourcePath,preset:d.meta.output?.preset})}else await u(n)};await o(void 0,n);let u=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await u(e,n);else if(n.kind===`builtin`)await e.emitBuiltin(n.contents,n.id,n.path);else if(n.kind===`entry`)await e.emitEntry(n.contents,n.path,n.typeDefinition);else if(n.kind===`file`)if(`sourcePath`in n&&n.sourcePath){if(!e.fs.existsSync(n.sourcePath))throw Error(`Source file "${n.sourcePath}" for copy operation does not exist.`);let t=await e.fs.read(n.sourcePath);if(!(0,l.isSetString)(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&(0,l.isSetString)(n.contents))await e.fs.write(n.path,n.contents);else throw Error(`Unexpected output extracted from the render tree: \n\n${JSON.stringify(n,null,2)}`)};await u(e,i)}async function m(e,n,r={}){r.printWidth??=160,r.tabWidth??=2,r.useTabs??=!1,r.insertFinalNewLine??=!0,await(0,t.vendor_exports.flushJobsAsync)();let i=u.printer.printDocToString(h(n),r).formatted;return r.insertFinalNewLine&&!i.endsWith(`
|
|
1
|
+
const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./vendor/index.cjs`),n=require(`./core/components/output.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/rollup-plugin`);i=e.__toESM(i);let a=require(`@storm-software/config-tools/types`),o=require(`@stryke/json/storm-json`),s=require(`@stryke/path/is-parent-path`),c=require(`@stryke/path/replace`),l=require(`@stryke/type-checks/is-set-string`),u=require(`prettier/doc.js`);const d=(e={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...e},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@powerlines/plugin-alloy/vendor`}}},plugins:[(0,i.default)()],alias:{"@alloy-js/core":`@powerlines/plugin-alloy/vendor`,"@alloy-js/core/jsx-runtime":`@powerlines/plugin-alloy/vendor/jsx-runtime`}}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@powerlines/plugin-alloy/vendor`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@powerlines/plugin-alloy/vendor`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@powerlines/plugin-alloy/vendor`),await this.fs.write(this.tsconfig.tsconfigFilePath,o.StormJSON.stringify(this.tsconfig.tsconfigJson))),this.config.alloy?.typescript!==!1&&(this.dependencies[`@alloy-js/typescript`]=`^0.22.0`),this.config.alloy?.json===!0&&(this.dependencies[`@alloy-js/json`]=`^0.22.0`),this.config.alloy?.markdown===!0&&(this.dependencies[`@alloy-js/markdown`]=`^0.22.0`)},resolveId(e){return e===`@alloy-js/core`?{id:`@powerlines/plugin-alloy/vendor`,external:!0}:e===`@alloy-js/core/jsx-runtime`?{id:`@powerlines/plugin-alloy/vendor/jsx-runtime`,external:!0}:null}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async e=>{let i=this,a=(0,t.vendor_exports.renderTree)((0,r.createComponent)(n.Output,{context:i,get basePath(){return i.workspaceConfig.workspaceRoot},children:e}));await p(this,a,this.config.alloy)}}}}];var f=d;async function p(e,n,r={}){await(0,t.vendor_exports.flushJobsAsync)();let i,o=async(n,l)=>{if(!Array.isArray(l))return;let u=async e=>{for(let t of l)await o(e,t)},d=(0,t.vendor_exports.getContextForRenderNode)(l);if(!d)return u(n);if(d.meta?.directory){let e={kind:`directory`,path:d.meta.directory.path,contents:[]};n?n.contents.push(e):i=e,await u(e)}else if(d.meta?.sourceFile){if(!n)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let t;if(d.meta?.builtin){if(!d.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");e.log(a.LogLevelLabel.TRACE,`Rendering built-in runtime module with ID: ${d.meta.builtin.id}`),t={kind:`builtin`,id:d.meta.builtin.id,path:(0,c.replacePath)(d.meta.sourceFile.path,e.builtinsPath),filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await m(e,l,r)}}else d.meta?.entry||(0,s.isParentPath)(e.entryPath,d.meta.sourceFile.path)?(e.log(a.LogLevelLabel.TRACE,`Rendering entry module at path: ${d.meta.sourceFile.path}`),t={kind:`entry`,typeDefinition:d.meta.entry?.typeDefinition,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await m(e,l,r)}):(e.log(a.LogLevelLabel.TRACE,`Rendering source file at path: ${d.meta.sourceFile.path}`),t={kind:`file`,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await m(e,l,r)});n.contents.push(t)}else if(d.meta?.copyFile){if(!n)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(e.log(a.LogLevelLabel.TRACE,`Processing copy file operation from "${d.meta.copyFile.sourcePath}" to "${d.meta.copyFile.path}"`),!d.meta.copyFile.sourcePath)throw Error("Copy file doesn't have a source path. Make sure you have provided a `sourcePath` property to the `meta.copyFile` context.");if(!d.meta.copyFile.path)throw Error("Copy file doesn't have a destination path. Make sure you have provided a `path` property to the `meta.copyFile` context.");n.contents.push({kind:`file`,path:d.meta.copyFile.path,sourcePath:d.meta.copyFile.sourcePath,preset:d.meta.output?.preset})}else await u(n)};await o(void 0,n);let u=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await u(e,n);else if(n.kind===`builtin`)await e.emitBuiltin(n.contents,n.id,n.path);else if(n.kind===`entry`)await e.emitEntry(n.contents,n.path,n.typeDefinition);else if(n.kind===`file`)if(`sourcePath`in n&&n.sourcePath){if(!e.fs.existsSync(n.sourcePath))throw Error(`Source file "${n.sourcePath}" for copy operation does not exist.`);let t=await e.fs.read(n.sourcePath);if(!(0,l.isSetString)(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&(0,l.isSetString)(n.contents))await e.fs.write(n.path,n.contents);else throw Error(`Unexpected output extracted from the render tree: \n\n${JSON.stringify(n,null,2)}`)};await u(e,i)}async function m(e,n,r={}){r.printWidth??=160,r.tabWidth??=2,r.useTabs??=!1,r.insertFinalNewLine??=!0,await(0,t.vendor_exports.flushJobsAsync)();let i=u.printer.printDocToString(h(n),r).formatted;return r.insertFinalNewLine&&!i.endsWith(`
|
|
2
2
|
`)?`${i}\n`:i}function h(e){let n=[];for(let r of e)if(typeof r==`string`){let e=r.split(/\r?\n/).flatMap((e,t,n)=>(n.length-1,[e]));n.push(e)}else (0,t.vendor_exports.isPrintHook)(r)?n.push(r.print(r.subtree,h)):n.push(h(r));return n}exports.default=f;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{vendor_exports as e}from"./vendor/index.mjs";import{Output as t}from"./core/components/output.mjs";import{createComponent as n}from"@alloy-js/core/jsx-runtime";import r from"@alloy-js/rollup-plugin";import{LogLevelLabel as i}from"@storm-software/config-tools/types";import{StormJSON as a}from"@stryke/json/storm-json";import{isParentPath as o}from"@stryke/path/is-parent-path";import{replacePath as s}from"@stryke/path/replace";import{isSetString as c}from"@stryke/type-checks/is-set-string";import{printer as l}from"prettier/doc.js";var u=(i={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...i},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@powerlines/plugin-alloy/vendor`}}},plugins:[r()]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@powerlines/plugin-alloy/vendor`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@powerlines/plugin-alloy/vendor`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@powerlines/plugin-alloy/vendor`),await this.fs.write(this.tsconfig.tsconfigFilePath,a.stringify(this.tsconfig.tsconfigJson))),this.config.alloy?.typescript!==!1&&(this.dependencies[`@alloy-js/typescript`]=`^0.22.0`),this.config.alloy?.json===!0&&(this.dependencies[`@alloy-js/json`]=`^0.22.0`),this.config.alloy?.markdown===!0&&(this.dependencies[`@alloy-js/markdown`]=`^0.22.0`)},resolveId(e){return e===`@alloy-js/core`?{id:`@powerlines/plugin-alloy/vendor`,external:!0}:e===`@alloy-js/core/jsx-runtime`?{id:`@powerlines/plugin-alloy/vendor/jsx-runtime`,external:!0}:null}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async r=>{let i=this,a=(0,e.renderTree)(n(t,{context:i,get basePath(){return i.workspaceConfig.workspaceRoot},children:r}));await d(this,a,this.config.alloy)}}}}];async function d(t,n,r={}){await(0,e.flushJobsAsync)();let a,l=async(n,c)=>{if(!Array.isArray(c))return;let u=async e=>{for(let t of c)await l(e,t)},d=(0,e.getContextForRenderNode)(c);if(!d)return u(n);if(d.meta?.directory){let e={kind:`directory`,path:d.meta.directory.path,contents:[]};n?n.contents.push(e):a=e,await u(e)}else if(d.meta?.sourceFile){if(!n)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let e;if(d.meta?.builtin){if(!d.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");t.log(i.TRACE,`Rendering built-in runtime module with ID: ${d.meta.builtin.id}`),e={kind:`builtin`,id:d.meta.builtin.id,path:s(d.meta.sourceFile.path,t.builtinsPath),filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await f(t,c,r)}}else d.meta?.entry||o(t.entryPath,d.meta.sourceFile.path)?(t.log(i.TRACE,`Rendering entry module at path: ${d.meta.sourceFile.path}`),e={kind:`entry`,typeDefinition:d.meta.entry?.typeDefinition,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await f(t,c,r)}):(t.log(i.TRACE,`Rendering source file at path: ${d.meta.sourceFile.path}`),e={kind:`file`,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await f(t,c,r)});n.contents.push(e)}else if(d.meta?.copyFile){if(!n)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(t.log(i.TRACE,`Processing copy file operation from "${d.meta.copyFile.sourcePath}" to "${d.meta.copyFile.path}"`),!d.meta.copyFile.sourcePath)throw Error("Copy file doesn't have a source path. Make sure you have provided a `sourcePath` property to the `meta.copyFile` context.");if(!d.meta.copyFile.path)throw Error("Copy file doesn't have a destination path. Make sure you have provided a `path` property to the `meta.copyFile` context.");n.contents.push({kind:`file`,path:d.meta.copyFile.path,sourcePath:d.meta.copyFile.sourcePath,preset:d.meta.output?.preset})}else await u(n)};await l(void 0,n);let u=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await u(e,n);else if(n.kind===`builtin`)await e.emitBuiltin(n.contents,n.id,n.path);else if(n.kind===`entry`)await e.emitEntry(n.contents,n.path,n.typeDefinition);else if(n.kind===`file`)if(`sourcePath`in n&&n.sourcePath){if(!e.fs.existsSync(n.sourcePath))throw Error(`Source file "${n.sourcePath}" for copy operation does not exist.`);let t=await e.fs.read(n.sourcePath);if(!c(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&c(n.contents))await e.fs.write(n.path,n.contents);else throw Error(`Unexpected output extracted from the render tree: \n\n${JSON.stringify(n,null,2)}`)};await u(t,a)}async function f(t,n,r={}){r.printWidth??=160,r.tabWidth??=2,r.useTabs??=!1,r.insertFinalNewLine??=!0,await(0,e.flushJobsAsync)();let i=l.printDocToString(p(n),r).formatted;return r.insertFinalNewLine&&!i.endsWith(`
|
|
1
|
+
import{vendor_exports as e}from"./vendor/index.mjs";import{Output as t}from"./core/components/output.mjs";import{createComponent as n}from"@alloy-js/core/jsx-runtime";import r from"@alloy-js/rollup-plugin";import{LogLevelLabel as i}from"@storm-software/config-tools/types";import{StormJSON as a}from"@stryke/json/storm-json";import{isParentPath as o}from"@stryke/path/is-parent-path";import{replacePath as s}from"@stryke/path/replace";import{isSetString as c}from"@stryke/type-checks/is-set-string";import{printer as l}from"prettier/doc.js";var u=(i={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...i},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@powerlines/plugin-alloy/vendor`}}},plugins:[r()],alias:{"@alloy-js/core":`@powerlines/plugin-alloy/vendor`,"@alloy-js/core/jsx-runtime":`@powerlines/plugin-alloy/vendor/jsx-runtime`}}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@powerlines/plugin-alloy/vendor`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@powerlines/plugin-alloy/vendor`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@powerlines/plugin-alloy/vendor`),await this.fs.write(this.tsconfig.tsconfigFilePath,a.stringify(this.tsconfig.tsconfigJson))),this.config.alloy?.typescript!==!1&&(this.dependencies[`@alloy-js/typescript`]=`^0.22.0`),this.config.alloy?.json===!0&&(this.dependencies[`@alloy-js/json`]=`^0.22.0`),this.config.alloy?.markdown===!0&&(this.dependencies[`@alloy-js/markdown`]=`^0.22.0`)},resolveId(e){return e===`@alloy-js/core`?{id:`@powerlines/plugin-alloy/vendor`,external:!0}:e===`@alloy-js/core/jsx-runtime`?{id:`@powerlines/plugin-alloy/vendor/jsx-runtime`,external:!0}:null}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async r=>{let i=this,a=(0,e.renderTree)(n(t,{context:i,get basePath(){return i.workspaceConfig.workspaceRoot},children:r}));await d(this,a,this.config.alloy)}}}}];async function d(t,n,r={}){await(0,e.flushJobsAsync)();let a,l=async(n,c)=>{if(!Array.isArray(c))return;let u=async e=>{for(let t of c)await l(e,t)},d=(0,e.getContextForRenderNode)(c);if(!d)return u(n);if(d.meta?.directory){let e={kind:`directory`,path:d.meta.directory.path,contents:[]};n?n.contents.push(e):a=e,await u(e)}else if(d.meta?.sourceFile){if(!n)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let e;if(d.meta?.builtin){if(!d.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");t.log(i.TRACE,`Rendering built-in runtime module with ID: ${d.meta.builtin.id}`),e={kind:`builtin`,id:d.meta.builtin.id,path:s(d.meta.sourceFile.path,t.builtinsPath),filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await f(t,c,r)}}else d.meta?.entry||o(t.entryPath,d.meta.sourceFile.path)?(t.log(i.TRACE,`Rendering entry module at path: ${d.meta.sourceFile.path}`),e={kind:`entry`,typeDefinition:d.meta.entry?.typeDefinition,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await f(t,c,r)}):(t.log(i.TRACE,`Rendering source file at path: ${d.meta.sourceFile.path}`),e={kind:`file`,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await f(t,c,r)});n.contents.push(e)}else if(d.meta?.copyFile){if(!n)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(t.log(i.TRACE,`Processing copy file operation from "${d.meta.copyFile.sourcePath}" to "${d.meta.copyFile.path}"`),!d.meta.copyFile.sourcePath)throw Error("Copy file doesn't have a source path. Make sure you have provided a `sourcePath` property to the `meta.copyFile` context.");if(!d.meta.copyFile.path)throw Error("Copy file doesn't have a destination path. Make sure you have provided a `path` property to the `meta.copyFile` context.");n.contents.push({kind:`file`,path:d.meta.copyFile.path,sourcePath:d.meta.copyFile.sourcePath,preset:d.meta.output?.preset})}else await u(n)};await l(void 0,n);let u=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await u(e,n);else if(n.kind===`builtin`)await e.emitBuiltin(n.contents,n.id,n.path);else if(n.kind===`entry`)await e.emitEntry(n.contents,n.path,n.typeDefinition);else if(n.kind===`file`)if(`sourcePath`in n&&n.sourcePath){if(!e.fs.existsSync(n.sourcePath))throw Error(`Source file "${n.sourcePath}" for copy operation does not exist.`);let t=await e.fs.read(n.sourcePath);if(!c(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&c(n.contents))await e.fs.write(n.path,n.contents);else throw Error(`Unexpected output extracted from the render tree: \n\n${JSON.stringify(n,null,2)}`)};await u(t,a)}async function f(t,n,r={}){r.printWidth??=160,r.tabWidth??=2,r.useTabs??=!1,r.insertFinalNewLine??=!0,await(0,e.flushJobsAsync)();let i=l.printDocToString(p(n),r).formatted;return r.insertFinalNewLine&&!i.endsWith(`
|
|
2
2
|
`)?`${i}\n`:i}function p(t){let n=[];for(let r of t)if(typeof r==`string`){let e=r.split(/\r?\n/).flatMap((e,t,n)=>(n.length-1,[e]));n.push(e)}else (0,e.isPrintHook)(r)?n.push(r.print(r.subtree,p)):n.push(p(r));return n}export{u as default};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { index_d_exports } from "../vendor/index.cjs";
|
|
2
1
|
import { PluginContext } from "../../../powerlines/src/types/context.cjs";
|
|
3
2
|
import { UserConfig } from "../../../powerlines/src/types/config.cjs";
|
|
4
3
|
import { ResolvedConfig } from "../../../powerlines/src/types/resolved.cjs";
|
|
5
4
|
|
|
6
5
|
//#region ../plugin-alloy/src/types/plugin.d.ts
|
|
7
|
-
type AlloyPluginOptions = Partial<
|
|
6
|
+
type AlloyPluginOptions = Partial<PrintTreeOptions> & {
|
|
8
7
|
/**
|
|
9
8
|
* If true, the Alloy framework is used to generate Typescript output files.
|
|
10
9
|
*
|
|
@@ -31,7 +30,7 @@ type AlloyPluginResolvedConfig = ResolvedConfig & {
|
|
|
31
30
|
alloy: AlloyPluginOptions;
|
|
32
31
|
};
|
|
33
32
|
type AlloyPluginContext<TResolvedConfig extends AlloyPluginResolvedConfig = AlloyPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
|
|
34
|
-
render: <TContext extends AlloyPluginContext>(this: TContext, children:
|
|
33
|
+
render: <TContext extends AlloyPluginContext>(this: TContext, children: Children) => Promise<void>;
|
|
35
34
|
};
|
|
36
35
|
//#endregion
|
|
37
36
|
export { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig };
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -3,7 +3,6 @@ import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, Allo
|
|
|
3
3
|
import { AutoMDPluginOptions } from "../plugin-automd/src/types/plugin.cjs";
|
|
4
4
|
import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "../plugin-babel/src/types/plugin.cjs";
|
|
5
5
|
import { EnvInterface, SecretsInterface } from "./runtime.cjs";
|
|
6
|
-
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
7
6
|
import { DotenvConfiguration, TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
8
7
|
import { DotenvParseOutput } from "@stryke/env/types";
|
|
9
8
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-env",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin for injecting static .env configuration values to the code so that they're accessible at runtime.",
|
|
6
6
|
"repository": {
|
|
@@ -193,11 +193,11 @@
|
|
|
193
193
|
"@alloy-js/json": "^0.22.0",
|
|
194
194
|
"@babel/core": "^7.28.5",
|
|
195
195
|
"@babel/types": "^7.28.5",
|
|
196
|
-
"@powerlines/deepkit": "^0.5.
|
|
197
|
-
"@powerlines/plugin-alloy": "^0.
|
|
198
|
-
"@powerlines/plugin-automd": "^0.1.
|
|
199
|
-
"@powerlines/plugin-babel": "^0.12.
|
|
200
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
196
|
+
"@powerlines/deepkit": "^0.5.29",
|
|
197
|
+
"@powerlines/plugin-alloy": "^0.16.0",
|
|
198
|
+
"@powerlines/plugin-automd": "^0.1.114",
|
|
199
|
+
"@powerlines/plugin-babel": "^0.12.123",
|
|
200
|
+
"@powerlines/plugin-plugin": "^0.12.66",
|
|
201
201
|
"@storm-software/config-tools": "^1.188.74",
|
|
202
202
|
"@stryke/capnp": "^0.12.51",
|
|
203
203
|
"@stryke/env": "^0.20.43",
|
|
@@ -207,9 +207,9 @@
|
|
|
207
207
|
"@stryke/type-checks": "^0.5.14",
|
|
208
208
|
"@stryke/types": "^0.10.28",
|
|
209
209
|
"automd": "^0.4.2",
|
|
210
|
-
"powerlines": "^0.36.
|
|
210
|
+
"powerlines": "^0.36.19"
|
|
211
211
|
},
|
|
212
212
|
"devDependencies": { "@types/node": "^24.10.4", "vite": "8.0.0-beta.2" },
|
|
213
213
|
"publishConfig": { "access": "public" },
|
|
214
|
-
"gitHead": "
|
|
214
|
+
"gitHead": "b4b5079fef10cf5fccdaa2ff09dd8f728ff25bf7"
|
|
215
215
|
}
|