@powerlines/plugin-env 0.14.18 → 0.14.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.
@@ -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)()],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
- `)?`${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
+ 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`),d=require(`rolldown/experimental`);const f=(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)(),(0,d.viteAliasPlugin)({entries:[{find:`@alloy-js/core`,replacement:`@powerlines/plugin-alloy/vendor`},{find:`@alloy-js/core/jsx-runtime`,replacement:`@powerlines/plugin-alloy/vendor/jsx-runtime`}]})],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 m(this,a,this.config.alloy)}}}}];var p=f;async function m(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 h(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 h(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 h(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 h(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(g(n),r).formatted;return r.insertFinalNewLine&&!i.endsWith(`
2
+ `)?`${i}\n`:i}function g(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,g)):n.push(g(r));return n}exports.default=p;
@@ -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()],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
- `)?`${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
+ 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";import{viteAliasPlugin as u}from"rolldown/experimental";var d=(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(),u({entries:[{find:`@alloy-js/core`,replacement:`@powerlines/plugin-alloy/vendor`},{find:`@alloy-js/core/jsx-runtime`,replacement:`@powerlines/plugin-alloy/vendor/jsx-runtime`}]})],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 f(this,a,this.config.alloy)}}}}];async function f(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 p(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 p(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 p(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 p(t,n,r={}){r.printWidth??=160,r.tabWidth??=2,r.useTabs??=!1,r.insertFinalNewLine??=!0,await(0,e.flushJobsAsync)();let i=l.printDocToString(m(n),r).formatted;return r.insertFinalNewLine&&!i.endsWith(`
2
+ `)?`${i}\n`:i}function m(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,m)):n.push(m(r));return n}export{d as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-env",
3
- "version": "0.14.18",
3
+ "version": "0.14.19",
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.29",
197
- "@powerlines/plugin-alloy": "^0.16.1",
198
- "@powerlines/plugin-automd": "^0.1.114",
199
- "@powerlines/plugin-babel": "^0.12.123",
200
- "@powerlines/plugin-plugin": "^0.12.66",
196
+ "@powerlines/deepkit": "^0.5.30",
197
+ "@powerlines/plugin-alloy": "^0.16.2",
198
+ "@powerlines/plugin-automd": "^0.1.115",
199
+ "@powerlines/plugin-babel": "^0.12.124",
200
+ "@powerlines/plugin-plugin": "^0.12.67",
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.19"
210
+ "powerlines": "^0.36.20"
211
211
  },
212
212
  "devDependencies": { "@types/node": "^24.10.4", "vite": "8.0.0-beta.2" },
213
213
  "publishConfig": { "access": "public" },
214
- "gitHead": "fd101cb5a79b50099a157f8c39d934b26cbd9896"
214
+ "gitHead": "bf1440eb5eb29cb9650051e56b0c17e596eb3942"
215
215
  }