@powerlines/plugin-env 0.14.10 → 0.14.11
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/index.d.cts +2 -0
- package/dist/plugin-alloy/src/index.cjs +1 -1
- package/dist/plugin-alloy/src/index.mjs +1 -1
- package/dist/plugin-alloy/src/types/components.d.cts +2 -0
- package/dist/plugin-alloy/src/types/index.d.cts +2 -0
- package/dist/powerlines/src/types/config.d.cts +12 -0
- package/dist/powerlines/src/types/config.d.mts +12 -0
- package/dist/powerlines/src/types/resolved.d.cts +1 -1
- package/dist/powerlines/src/types/resolved.d.mts +1 -1
- package/dist/types/plugin.d.cts +1 -0
- package/package.json +8 -8
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EnvDocs } from "./components/docs.cjs";
|
|
2
2
|
import { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps } from "./components/env.cjs";
|
|
3
|
+
import "./components/index.cjs";
|
|
3
4
|
import { EnvInterface, SecretsInterface, __ΩEnvInterface, __ΩSecretsInterface } from "./types/runtime.cjs";
|
|
4
5
|
import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from "./types/plugin.cjs";
|
|
5
6
|
import { envBabelPlugin } from "./babel/plugin.cjs";
|
|
@@ -11,6 +12,7 @@ import { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflecti
|
|
|
11
12
|
import { formatEnvField, removeEnvPrefix } from "./helpers/source-file-env.cjs";
|
|
12
13
|
import { createTemplateReflection } from "./helpers/template-helpers.cjs";
|
|
13
14
|
import "./helpers/index.cjs";
|
|
15
|
+
import "./types/index.cjs";
|
|
14
16
|
import { Plugin } from "powerlines";
|
|
15
17
|
|
|
16
18
|
//#region src/index.d.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./core/contexts/context.cjs`),n=require(`./core/components/output.cjs`);require(`./core/index.cjs`),require(`./helpers/index.cjs`),require(`./markdown/index.cjs`),require(`./typescript/index.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/core`),a=require(`@alloy-js/rollup-plugin`);a=e.__toESM(a);let o=require(`@storm-software/config-tools/types`),s=require(`@stryke/json/storm-json`),c=require(`@stryke/path/is-parent-path`),l=require(`@stryke/path/replace`),u=require(`@stryke/type-checks/is-set-string`),d=require(`prettier/doc.js`);const f=(e={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...e},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@alloy-js/core`}}},plugins:[(0,a.default)()]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@alloy-js/core`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@alloy-js/core`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@alloy-js/core`),await this.fs.write(this.tsconfig.tsconfigFilePath,s.StormJSON.stringify(this.tsconfig.tsconfigJson))),this.dependencies[`@alloy-js/core`]=`^0.22.0`,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`)}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async e=>{let t=this,a=(0,i.renderTree)((0,r.createComponent)(n.Output,{context:t,get basePath(){return t.workspaceConfig.workspaceRoot},children:e}));await m(this,a,this.config.alloy)}}}}];var p=f;async function m(e,t,n={}){await(0,i.flushJobsAsync)();let r,a=async(t,s)=>{if(!Array.isArray(s))return;let u=async e=>{for(let t of s)await a(e,t)},d=(0,i.getContextForRenderNode)(s);if(!d)return u(t);if(d.meta?.directory){let e={kind:`directory`,path:d.meta.directory.path,contents:[]};t?t.contents.push(e):r=e,await u(e)}else if(d.meta?.sourceFile){if(!t)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let r;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(o.LogLevelLabel.TRACE,`Rendering built-in runtime module with ID: ${d.meta.builtin.id}`),r={kind:`builtin`,id:d.meta.builtin.id,path:(0,l.replacePath)(d.meta.sourceFile.path,e.builtinsPath),filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,s,n)}}else d.meta?.entry||(0,c.isParentPath)(e.entryPath,d.meta.sourceFile.path)?(e.log(o.LogLevelLabel.TRACE,`Rendering entry module at path: ${d.meta.sourceFile.path}`),r={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,s,n)}):(e.log(o.LogLevelLabel.TRACE,`Rendering source file at path: ${d.meta.sourceFile.path}`),r={kind:`file`,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,s,n)});t.contents.push(r)}else if(d.meta?.copyFile){if(!t)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(e.log(o.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.");t.contents.push({kind:`file`,path:d.meta.copyFile.path,sourcePath:d.meta.copyFile.sourcePath,preset:d.meta.output?.preset})}else await u(t)};await a(void 0,t);let s=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await s(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,u.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,u.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 s(e,r)}async function h(e,t,n={}){n.printWidth??=160,n.tabWidth??=2,n.useTabs??=!1,n.insertFinalNewLine??=!0,await(0,i.flushJobsAsync)();let r=d.printer.printDocToString(g(t),n).formatted;return n.insertFinalNewLine&&!r.endsWith(`
|
|
1
|
+
const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./core/contexts/context.cjs`),n=require(`./core/components/output.cjs`);require(`./core/index.cjs`),require(`./helpers/index.cjs`),require(`./markdown/index.cjs`),require(`./typescript/index.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/core`),a=require(`@alloy-js/rollup-plugin`);a=e.__toESM(a);let o=require(`@storm-software/config-tools/types`),s=require(`@stryke/json/storm-json`),c=require(`@stryke/path/is-parent-path`),l=require(`@stryke/path/replace`),u=require(`@stryke/type-checks/is-set-string`),d=require(`prettier/doc.js`);const f=(e={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...e},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@alloy-js/core`}}},plugins:[(0,a.default)()],alias:{"@alloy-js/core":`@powerlines/plugin-alloy/vendor`},external:[`@alloy-js/core`,`@vue/reactivity`,`@vue/shared`]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@alloy-js/core`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@alloy-js/core`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@alloy-js/core`),await this.fs.write(this.tsconfig.tsconfigFilePath,s.StormJSON.stringify(this.tsconfig.tsconfigJson))),this.dependencies[`@alloy-js/core`]=`^0.22.0`,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`)}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async e=>{let t=this,a=(0,i.renderTree)((0,r.createComponent)(n.Output,{context:t,get basePath(){return t.workspaceConfig.workspaceRoot},children:e}));await m(this,a,this.config.alloy)}}}}];var p=f;async function m(e,t,n={}){await(0,i.flushJobsAsync)();let r,a=async(t,s)=>{if(!Array.isArray(s))return;let u=async e=>{for(let t of s)await a(e,t)},d=(0,i.getContextForRenderNode)(s);if(!d)return u(t);if(d.meta?.directory){let e={kind:`directory`,path:d.meta.directory.path,contents:[]};t?t.contents.push(e):r=e,await u(e)}else if(d.meta?.sourceFile){if(!t)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let r;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(o.LogLevelLabel.TRACE,`Rendering built-in runtime module with ID: ${d.meta.builtin.id}`),r={kind:`builtin`,id:d.meta.builtin.id,path:(0,l.replacePath)(d.meta.sourceFile.path,e.builtinsPath),filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,s,n)}}else d.meta?.entry||(0,c.isParentPath)(e.entryPath,d.meta.sourceFile.path)?(e.log(o.LogLevelLabel.TRACE,`Rendering entry module at path: ${d.meta.sourceFile.path}`),r={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,s,n)}):(e.log(o.LogLevelLabel.TRACE,`Rendering source file at path: ${d.meta.sourceFile.path}`),r={kind:`file`,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,s,n)});t.contents.push(r)}else if(d.meta?.copyFile){if(!t)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(e.log(o.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.");t.contents.push({kind:`file`,path:d.meta.copyFile.path,sourcePath:d.meta.copyFile.sourcePath,preset:d.meta.output?.preset})}else await u(t)};await a(void 0,t);let s=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await s(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,u.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,u.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 s(e,r)}async function h(e,t,n={}){n.printWidth??=160,n.tabWidth??=2,n.useTabs??=!1,n.insertFinalNewLine??=!0,await(0,i.flushJobsAsync)();let r=d.printer.printDocToString(g(t),n).formatted;return n.insertFinalNewLine&&!r.endsWith(`
|
|
2
2
|
`)?`${r}\n`:r}function g(e){let t=[];for(let n of e)if(typeof n==`string`){let e=n.split(/\r?\n/).flatMap((e,t,n)=>(n.length-1,[e]));t.push(e)}else (0,i.isPrintHook)(n)?t.push(n.print(n.subtree,g)):t.push(g(n));return t}exports.default=p;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{PowerlinesContext as e}from"./core/contexts/context.mjs";import{Output as t}from"./core/components/output.mjs";import"./core/index.mjs";import"./helpers/index.mjs";import"./markdown/index.mjs";import"./typescript/index.mjs";import{createComponent as n}from"@alloy-js/core/jsx-runtime";import{flushJobsAsync as r,getContextForRenderNode as i,isPrintHook as a,renderTree as o}from"@alloy-js/core";import s from"@alloy-js/rollup-plugin";import{LogLevelLabel as c}from"@storm-software/config-tools/types";import{StormJSON as l}from"@stryke/json/storm-json";import{isParentPath as u}from"@stryke/path/is-parent-path";import{replacePath as d}from"@stryke/path/replace";import{isSetString as f}from"@stryke/type-checks/is-set-string";import{printer as p}from"prettier/doc.js";var m=(e={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...e},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@alloy-js/core`}}},plugins:[s()]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@alloy-js/core`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@alloy-js/core`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@alloy-js/core`),await this.fs.write(this.tsconfig.tsconfigFilePath,l.stringify(this.tsconfig.tsconfigJson))),this.dependencies[`@alloy-js/core`]=`^0.22.0`,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`)}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async e=>{let r=this,i=o(n(t,{context:r,get basePath(){return r.workspaceConfig.workspaceRoot},children:e}));await h(this,i,this.config.alloy)}}}}];async function h(e,t,n={}){await r();let a,o=async(t,r)=>{if(!Array.isArray(r))return;let s=async e=>{for(let t of r)await o(e,t)},l=i(r);if(!l)return s(t);if(l.meta?.directory){let e={kind:`directory`,path:l.meta.directory.path,contents:[]};t?t.contents.push(e):a=e,await s(e)}else if(l.meta?.sourceFile){if(!t)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let i;if(l.meta?.builtin){if(!l.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");e.log(c.TRACE,`Rendering built-in runtime module with ID: ${l.meta.builtin.id}`),i={kind:`builtin`,id:l.meta.builtin.id,path:d(l.meta.sourceFile.path,e.builtinsPath),filetype:l.meta.sourceFile.filetype,preset:l.meta.output?.mode,contents:await g(e,r,n)}}else l.meta?.entry||u(e.entryPath,l.meta.sourceFile.path)?(e.log(c.TRACE,`Rendering entry module at path: ${l.meta.sourceFile.path}`),i={kind:`entry`,typeDefinition:l.meta.entry?.typeDefinition,path:l.meta.sourceFile.path,filetype:l.meta.sourceFile.filetype,preset:l.meta.output?.mode,contents:await g(e,r,n)}):(e.log(c.TRACE,`Rendering source file at path: ${l.meta.sourceFile.path}`),i={kind:`file`,path:l.meta.sourceFile.path,filetype:l.meta.sourceFile.filetype,preset:l.meta.output?.mode,contents:await g(e,r,n)});t.contents.push(i)}else if(l.meta?.copyFile){if(!t)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(e.log(c.TRACE,`Processing copy file operation from "${l.meta.copyFile.sourcePath}" to "${l.meta.copyFile.path}"`),!l.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(!l.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.");t.contents.push({kind:`file`,path:l.meta.copyFile.path,sourcePath:l.meta.copyFile.sourcePath,preset:l.meta.output?.preset})}else await s(t)};await o(void 0,t);let s=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await s(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(!f(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&f(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 s(e,a)}async function g(e,t,n={}){n.printWidth??=160,n.tabWidth??=2,n.useTabs??=!1,n.insertFinalNewLine??=!0,await r();let i=p.printDocToString(_(t),n).formatted;return n.insertFinalNewLine&&!i.endsWith(`
|
|
1
|
+
import{PowerlinesContext as e}from"./core/contexts/context.mjs";import{Output as t}from"./core/components/output.mjs";import"./core/index.mjs";import"./helpers/index.mjs";import"./markdown/index.mjs";import"./typescript/index.mjs";import{createComponent as n}from"@alloy-js/core/jsx-runtime";import{flushJobsAsync as r,getContextForRenderNode as i,isPrintHook as a,renderTree as o}from"@alloy-js/core";import s from"@alloy-js/rollup-plugin";import{LogLevelLabel as c}from"@storm-software/config-tools/types";import{StormJSON as l}from"@stryke/json/storm-json";import{isParentPath as u}from"@stryke/path/is-parent-path";import{replacePath as d}from"@stryke/path/replace";import{isSetString as f}from"@stryke/type-checks/is-set-string";import{printer as p}from"prettier/doc.js";var m=(e={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...e},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@alloy-js/core`}}},plugins:[s()],alias:{"@alloy-js/core":`@powerlines/plugin-alloy/vendor`},external:[`@alloy-js/core`,`@vue/reactivity`,`@vue/shared`]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@alloy-js/core`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@alloy-js/core`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@alloy-js/core`),await this.fs.write(this.tsconfig.tsconfigFilePath,l.stringify(this.tsconfig.tsconfigJson))),this.dependencies[`@alloy-js/core`]=`^0.22.0`,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`)}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async e=>{let r=this,i=o(n(t,{context:r,get basePath(){return r.workspaceConfig.workspaceRoot},children:e}));await h(this,i,this.config.alloy)}}}}];async function h(e,t,n={}){await r();let a,o=async(t,r)=>{if(!Array.isArray(r))return;let s=async e=>{for(let t of r)await o(e,t)},l=i(r);if(!l)return s(t);if(l.meta?.directory){let e={kind:`directory`,path:l.meta.directory.path,contents:[]};t?t.contents.push(e):a=e,await s(e)}else if(l.meta?.sourceFile){if(!t)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let i;if(l.meta?.builtin){if(!l.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");e.log(c.TRACE,`Rendering built-in runtime module with ID: ${l.meta.builtin.id}`),i={kind:`builtin`,id:l.meta.builtin.id,path:d(l.meta.sourceFile.path,e.builtinsPath),filetype:l.meta.sourceFile.filetype,preset:l.meta.output?.mode,contents:await g(e,r,n)}}else l.meta?.entry||u(e.entryPath,l.meta.sourceFile.path)?(e.log(c.TRACE,`Rendering entry module at path: ${l.meta.sourceFile.path}`),i={kind:`entry`,typeDefinition:l.meta.entry?.typeDefinition,path:l.meta.sourceFile.path,filetype:l.meta.sourceFile.filetype,preset:l.meta.output?.mode,contents:await g(e,r,n)}):(e.log(c.TRACE,`Rendering source file at path: ${l.meta.sourceFile.path}`),i={kind:`file`,path:l.meta.sourceFile.path,filetype:l.meta.sourceFile.filetype,preset:l.meta.output?.mode,contents:await g(e,r,n)});t.contents.push(i)}else if(l.meta?.copyFile){if(!t)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(e.log(c.TRACE,`Processing copy file operation from "${l.meta.copyFile.sourcePath}" to "${l.meta.copyFile.path}"`),!l.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(!l.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.");t.contents.push({kind:`file`,path:l.meta.copyFile.path,sourcePath:l.meta.copyFile.sourcePath,preset:l.meta.output?.preset})}else await s(t)};await o(void 0,t);let s=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await s(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(!f(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&f(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 s(e,a)}async function g(e,t,n={}){n.printWidth??=160,n.tabWidth??=2,n.useTabs??=!1,n.insertFinalNewLine??=!0,await r();let i=p.printDocToString(_(t),n).formatted;return n.insertFinalNewLine&&!i.endsWith(`
|
|
2
2
|
`)?`${i}\n`:i}function _(e){let t=[];for(let n of e)if(typeof n==`string`){let e=n.split(/\r?\n/).flatMap((e,t,n)=>(n.length-1,[e]));t.push(e)}else a(n)?t.push(n.print(n.subtree,_)):t.push(_(n));return t}export{m as default};
|
|
@@ -12,6 +12,7 @@ import { transformAsync } from "@babel/core";
|
|
|
12
12
|
import { Format } from "@storm-software/build-tools/types";
|
|
13
13
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
14
14
|
import { StormWorkspaceConfig } from "@storm-software/config/types";
|
|
15
|
+
import { DateString } from "compatx";
|
|
15
16
|
|
|
16
17
|
//#region ../powerlines/src/types/config.d.ts
|
|
17
18
|
type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
|
|
@@ -249,6 +250,17 @@ interface CommonUserConfig extends BaseConfig {
|
|
|
249
250
|
* If this option is not provided, the build process will try to use the \`description\` value from the `\package.json\` file.
|
|
250
251
|
*/
|
|
251
252
|
description?: string;
|
|
253
|
+
/**
|
|
254
|
+
* The date to use for compatibility checks
|
|
255
|
+
*
|
|
256
|
+
* @remarks
|
|
257
|
+
* This date can be used by plugins and build processes to determine compatibility with certain features or APIs. It is recommended to set this date to the date when the project was last known to be compatible with the desired features or APIs.
|
|
258
|
+
*
|
|
259
|
+
* @see https://developers.cloudflare.com/pages/platform/compatibility-dates/
|
|
260
|
+
* @see https://docs.netlify.com/configure-builds/get-started/#set-a-compatibility-date
|
|
261
|
+
* @see https://github.com/unjs/compatx
|
|
262
|
+
*/
|
|
263
|
+
compatibilityDate?: DateString;
|
|
252
264
|
/**
|
|
253
265
|
* The log level to use for the Powerlines processes.
|
|
254
266
|
*
|
|
@@ -13,6 +13,7 @@ import { TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
|
13
13
|
import { PreviewOptions } from "vite";
|
|
14
14
|
import { Format } from "@storm-software/build-tools/types";
|
|
15
15
|
import { StormWorkspaceConfig } from "@storm-software/config/types";
|
|
16
|
+
import { DateString } from "compatx";
|
|
16
17
|
|
|
17
18
|
//#region ../powerlines/src/types/config.d.ts
|
|
18
19
|
type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
|
|
@@ -250,6 +251,17 @@ interface CommonUserConfig extends BaseConfig {
|
|
|
250
251
|
* If this option is not provided, the build process will try to use the \`description\` value from the `\package.json\` file.
|
|
251
252
|
*/
|
|
252
253
|
description?: string;
|
|
254
|
+
/**
|
|
255
|
+
* The date to use for compatibility checks
|
|
256
|
+
*
|
|
257
|
+
* @remarks
|
|
258
|
+
* This date can be used by plugins and build processes to determine compatibility with certain features or APIs. It is recommended to set this date to the date when the project was last known to be compatible with the desired features or APIs.
|
|
259
|
+
*
|
|
260
|
+
* @see https://developers.cloudflare.com/pages/platform/compatibility-dates/
|
|
261
|
+
* @see https://docs.netlify.com/configure-builds/get-started/#set-a-compatibility-date
|
|
262
|
+
* @see https://github.com/unjs/compatx
|
|
263
|
+
*/
|
|
264
|
+
compatibilityDate?: DateString;
|
|
253
265
|
/**
|
|
254
266
|
* The log level to use for the Powerlines processes.
|
|
255
267
|
*
|
|
@@ -33,7 +33,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> &
|
|
|
33
33
|
/**
|
|
34
34
|
* The resolved options for the Powerlines project configuration.
|
|
35
35
|
*/
|
|
36
|
-
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
|
|
36
|
+
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "compatibilityDate" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "compatibilityDate" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
|
|
37
37
|
/**
|
|
38
38
|
* The configuration options that were provided inline to the Powerlines CLI.
|
|
39
39
|
*/
|
|
@@ -34,7 +34,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> &
|
|
|
34
34
|
/**
|
|
35
35
|
* The resolved options for the Powerlines project configuration.
|
|
36
36
|
*/
|
|
37
|
-
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
|
|
37
|
+
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "compatibilityDate" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "compatibilityDate" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
|
|
38
38
|
/**
|
|
39
39
|
* The configuration options that were provided inline to the Powerlines CLI.
|
|
40
40
|
*/
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Reflection } from "../deepkit/src/types.cjs";
|
|
2
2
|
import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "../plugin-alloy/src/types/plugin.cjs";
|
|
3
|
+
import "../plugin-alloy/src/types/index.cjs";
|
|
3
4
|
import { AutoMDPluginOptions } from "../plugin-automd/src/types/plugin.cjs";
|
|
4
5
|
import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "../plugin-babel/src/types/plugin.cjs";
|
|
5
6
|
import { EnvInterface, SecretsInterface } from "./runtime.cjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-env",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.11",
|
|
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.15.
|
|
198
|
-
"@powerlines/plugin-automd": "^0.1.
|
|
199
|
-
"@powerlines/plugin-babel": "^0.12.
|
|
200
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
196
|
+
"@powerlines/deepkit": "^0.5.23",
|
|
197
|
+
"@powerlines/plugin-alloy": "^0.15.5",
|
|
198
|
+
"@powerlines/plugin-automd": "^0.1.108",
|
|
199
|
+
"@powerlines/plugin-babel": "^0.12.117",
|
|
200
|
+
"@powerlines/plugin-plugin": "^0.12.60",
|
|
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.13"
|
|
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": "483677f34524b653a72b313c463081c800043753"
|
|
215
215
|
}
|